var FKe=Object.defineProperty;var awe=e=>{throw TypeError(e)};var zKe=(e,t,n)=>t in e?FKe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ts=(e,t,n)=>zKe(e,typeof t!="symbol"?t+"":t,n),Fle=(e,t,n)=>t.has(e)||awe("Cannot "+n);var tr=(e,t,n)=>(Fle(e,t,"read from private field"),n?n.call(e):t.get(e)),xa=(e,t,n)=>t.has(e)?awe("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),_s=(e,t,n,s)=>(Fle(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),yi=(e,t,n)=>(Fle(e,t,"access private method"),n);var SL=(e,t,n,s)=>({set _(a){_s(e,t,a,n)},get _(){return tr(e,t,s)}});function BKe(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 UTe(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 qTe={exports:{}},ese={},VTe={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 UI=Symbol.for("react.element"),$Ke=Symbol.for("react.portal"),UKe=Symbol.for("react.fragment"),qKe=Symbol.for("react.strict_mode"),VKe=Symbol.for("react.profiler"),HKe=Symbol.for("react.provider"),WKe=Symbol.for("react.context"),GKe=Symbol.for("react.forward_ref"),KKe=Symbol.for("react.suspense"),ZKe=Symbol.for("react.memo"),YKe=Symbol.for("react.lazy"),iwe=Symbol.iterator;function XKe(e){return e===null||typeof e!="object"?null:(e=iwe&&e[iwe]||e["@@iterator"],typeof e=="function"?e:null)}var HTe={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},WTe=Object.assign,GTe={};function f3(e,t,n){this.props=e,this.context=t,this.refs=GTe,this.updater=n||HTe}f3.prototype.isReactComponent={};f3.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")};f3.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function KTe(){}KTe.prototype=f3.prototype;function nge(e,t,n){this.props=e,this.context=t,this.refs=GTe,this.updater=n||HTe}var sge=nge.prototype=new KTe;sge.constructor=nge;WTe(sge,f3.prototype);sge.isPureReactComponent=!0;var owe=Array.isArray,ZTe=Object.prototype.hasOwnProperty,age={current:null},YTe={key:!0,ref:!0,__self:!0,__source:!0};function XTe(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)ZTe.call(t,s)&&!YTe.hasOwnProperty(s)&&(a[s]=t[s]);var i=arguments.length-2;if(i===1)a.children=n;else if(1>>1,we=he[be];if(0>>1;bea(Me,Te))Iea($e,Me)?(he[be]=$e,he[Ie]=Te,be=Ie):(he[be]=Me,he[et]=Te,be=et);else if(Iea($e,Te))he[be]=$e,he[Ie]=Te,be=Ie;else break e}}return xe}function a(he,xe){var Te=he.sortIndex-xe.sortIndex;return Te!==0?Te:he.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(he){for(var xe=n(m);xe!==null;){if(xe.callback===null)s(m);else if(xe.startTime<=he)s(m),xe.sortIndex=xe.expirationTime,t(u,xe);else break;xe=n(m)}}function F(he){if(k=!1,P(he),!N)if(n(u)!==null)N=!0,ne(D);else{var xe=n(m);xe!==null&&me(F,xe.startTime-he)}}function D(he,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)||he&&!ae());){var be=y.callback;if(typeof be=="function"){y.callback=null,v=y.priorityLevel;var we=be(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 et=n(m);et!==null&&me(F,et.startTime-xe),ve=!1}return ve}finally{y=null,v=Te,b=!1}}var U=!1,V=null,W=-1,G=5,Q=-1;function ae(){return!(e.unstable_now()-Qhe||125be?(he.sortIndex=Te,t(m,he),n(u)===null&&he===n(m)&&(k?(I(W),W=-1):k=!0,me(F,Te-be))):(he.sortIndex=we,t(u,he),N||b||(N=!0,ne(D))),he},e.unstable_shouldYield=ae,e.unstable_wrapCallback=function(he){var xe=v;return function(){var Te=v;v=xe;try{return he.apply(this,arguments)}finally{v=Te}}}})(rAe);tAe.exports=rAe;var lZe=tAe.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 cZe=A,km=lZe;function In(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"),vue=Object.prototype.hasOwnProperty,dZe=/^[: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]*$/,cwe={},dwe={};function uZe(e){return vue.call(dwe,e)?!0:vue.call(cwe,e)?!1:dZe.test(e)?dwe[e]=!0:(cwe[e]=!0,!1)}function hZe(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 mZe(e,t,n,s){if(t===null||typeof t>"u"||hZe(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 lh(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 lh(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 lh(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){iu[e]=new lh(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){iu[e]=new lh(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 lh(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){iu[e]=new lh(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){iu[e]=new lh(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){iu[e]=new lh(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){iu[e]=new lh(e,5,!1,e.toLowerCase(),null,!1,!1)});var lge=/[\-:]([a-z])/g;function cge(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(lge,cge);iu[t]=new lh(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(lge,cge);iu[t]=new lh(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(lge,cge);iu[t]=new lh(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){iu[e]=new lh(e,1,!1,e.toLowerCase(),null,!1,!1)});iu.xlinkHref=new lh("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){iu[e]=new lh(e,1,!1,e.toLowerCase(),null,!0,!0)});function dge(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{$le=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?MT(e):""}function fZe(e){switch(e.tag){case 5:return MT(e.type);case 16:return MT("Lazy");case 13:return MT("Suspense");case 19:return MT("SuspenseList");case 0:case 2:case 15:return e=Ule(e.type,!1),e;case 11:return e=Ule(e.type.render,!1),e;case 1:return e=Ule(e.type,!0),e;default:return""}}function jue(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 _ue:return"Profiler";case uge:return"StrictMode";case bue:return"Suspense";case wue:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case aAe:return(e.displayName||"Context")+".Consumer";case sAe:return(e._context.displayName||"Context")+".Provider";case hge:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case mge:return t=e.displayName||null,t!==null?t:jue(e.type)||"Memo";case W0:t=e._payload,e=e._init;try{return jue(e(t))}catch{}}return null}function pZe(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 jue(t);case 8:return t===uge?"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 oAe(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function gZe(e){var t=oAe(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 TL(e){e._valueTracker||(e._valueTracker=gZe(e))}function lAe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=oAe(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function nte(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 kue(e,t){var n=t.checked;return Hl({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function hwe(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 cAe(e,t){t=t.checked,t!=null&&dge(e,"checked",t,!1)}function Nue(e,t){cAe(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")?Sue(e,t.type,n):t.hasOwnProperty("defaultValue")&&Sue(e,t.type,cv(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function mwe(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 Sue(e,t,n){(t!=="number"||nte(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var TT=Array.isArray;function h4(e,t,n,s){if(e=e.options,t){t={};for(var a=0;a"+t.valueOf().toString()+"",t=AL.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function lE(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var qT={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},xZe=["Webkit","ms","Moz","O"];Object.keys(qT).forEach(function(e){xZe.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),qT[t]=qT[e]})});function mAe(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||qT.hasOwnProperty(e)&&qT[e]?(""+t).trim():t+"px"}function fAe(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var s=n.indexOf("--")===0,a=mAe(n,t[n],s);n==="float"&&(n="cssFloat"),s?e.setProperty(n,a):e[n]=a}}var yZe=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 Tue(e,t){if(t){if(yZe[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(In(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(In(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(In(61))}if(t.style!=null&&typeof t.style!="object")throw Error(In(62))}}function Aue(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 Eue=null;function fge(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Iue=null,m4=null,f4=null;function gwe(e){if(e=HI(e)){if(typeof Iue!="function")throw Error(In(280));var t=e.stateNode;t&&(t=ase(t),Iue(e.stateNode,e.type,t))}}function pAe(e){m4?f4?f4.push(e):f4=[e]:m4=e}function gAe(){if(m4){var e=m4,t=f4;if(f4=m4=null,gwe(e),t)for(e=0;e>>=0,e===0?32:31-(TZe(e)/AZe|0)|0}var EL=64,IL=4194304;function AT(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ote(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=AT(i):(o&=l,o!==0&&(s=AT(o)))}else l=n&~a,l!==0?s=AT(l):o!==0&&(s=AT(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 qI(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 LZe(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=HT),Nwe=" ",Swe=!1;function DAe(e,t){switch(e){case"keyup":return lYe.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function RAe(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var KS=!1;function dYe(e,t){switch(e){case"compositionend":return RAe(t);case"keypress":return t.which!==32?null:(Swe=!0,Nwe);case"textInput":return e=t.data,e===Nwe&&Swe?null:e;default:return null}}function uYe(e,t){if(KS)return e==="compositionend"||!wge&&DAe(e,t)?(e=LAe(),XO=vge=k1=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=Awe(n)}}function $Ae(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?$Ae(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function UAe(){for(var e=window,t=nte();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=nte(e.document)}return t}function jge(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 _Ye(e){var t=UAe(),n=e.focusedElem,s=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&$Ae(n.ownerDocument.documentElement,n)){if(s!==null&&jge(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=Ewe(n,o);var l=Ewe(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,Fue=null,GT=null,zue=!1;function Iwe(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;zue||ZS==null||ZS!==nte(s)||(s=ZS,"selectionStart"in s&&jge(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}),GT&&fE(GT,s)||(GT=s,s=dte(Fue,"onSelect"),0QS||(e.current=Hue[QS],Hue[QS]=null,QS--)}function il(e,t){QS++,Hue[QS]=e.current,e.current=t}var dv={},wu=_v(dv),Ph=_v(!1),Qj=dv;function _C(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 Lh(e){return e=e.childContextTypes,e!=null}function hte(){vl(Ph),vl(wu)}function zwe(e,t,n){if(wu.current!==dv)throw Error(In(168));il(wu,t),il(Ph,n)}function XAe(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(In(108,pZe(e)||"Unknown",a));return Hl({},n,s)}function mte(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||dv,Qj=wu.current,il(wu,e),il(Ph,Ph.current),!0}function Bwe(e,t,n){var s=e.stateNode;if(!s)throw Error(In(169));n?(e=XAe(e,t,Qj),s.__reactInternalMemoizedMergedChildContext=e,vl(Ph),vl(wu),il(wu,e)):vl(Ph),il(Ph,n)}var Gx=null,ise=!1,rce=!1;function QAe(e){Gx===null?Gx=[e]:Gx.push(e)}function IYe(e){ise=!0,QAe(e)}function bv(){if(!rce&&Gx!==null){rce=!0;var e=0,t=Do;try{var n=Gx;for(Do=1;e>=l,a-=l,Jx=1<<32-Sp(t)+a|n<W?(G=V,V=null):G=V.sibling;var Q=v(I,V,P[W],F);if(Q===null){V===null&&(V=G);break}e&&V&&Q.alternate===null&&t(I,V),T=o(Q,T,W),U===null?D=Q:U.sibling=Q,U=Q,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,Q.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(Q.done)return n(I,V),Tl&&I_(I,W),D;if(V===null){for(;!Q.done;W++,Q=P.next())Q=y(I,Q.value,F),Q!==null&&(T=o(Q,T,W),U===null?D=Q:U.sibling=Q,U=Q);return Tl&&I_(I,W),D}for(V=s(I,V);!Q.done;W++,Q=P.next())Q=b(V,I,W,Q.value,F),Q!==null&&(e&&Q.alternate!==null&&V.delete(Q.key===null?W:Q.key),T=o(Q,T,W),U===null?D=Q:U.sibling=Q,U=Q);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 ML: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===W0&&qwe(D)===U.type){n(I,U.sibling),T=a(U,P.props),T.ref=QM(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=aD(P.type,P.key,P.props,null,I.mode,F),F.ref=QM(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=dce(P,I.mode,F),T.return=I,I=T}return l(I);case W0:return U=P._init,M(I,T,U(P._payload),F)}if(TT(P))return N(I,T,P,F);if(GM(P))return k(I,T,P,F);zL(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=cce(P,I.mode,F),T.return=I,I=T),l(I)):n(I,T)}return M}var wC=rEe(!0),nEe=rEe(!1),gte=_v(null),xte=null,t4=null,Cge=null;function Mge(){Cge=t4=xte=null}function Tge(e){var t=gte.current;vl(gte),e._currentValue=t}function Kue(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){xte=e,Cge=t4=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Th=!0),e.firstContext=null)}function vf(e){var t=e._currentValue;if(Cge!==e)if(e={context:e,memoizedValue:t,next:null},t4===null){if(xte===null)throw Error(In(308));t4=e,xte.dependencies={lanes:0,firstContext:e}}else t4=t4.next=e;return t}var nj=null;function Age(e){nj===null?nj=[e]:nj.push(e)}function sEe(e,t,n,s){var a=t.interleaved;return a===null?(n.next=n,Age(t)):(n.next=a.next,a.next=n),t.interleaved=n,Cy(e,s)}function Cy(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 G0=!1;function Ege(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function aEe(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 R1(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,Cy(e,n)}return a=s.interleaved,a===null?(t.next=t,Age(s)):(t.next=a.next,a.next=t),s.interleaved=t,Cy(e,n)}function JO(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,gge(e,n)}}function Vwe(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 yte(e,t,n,s){var a=e.updateQueue;G0=!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:G0=!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 Hwe(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var s=sce.transition;sce.transition={};try{e(!1),t()}finally{Do=n,sce.transition=s}}function wEe(){return _f().memoizedState}function DYe(e,t,n){var s=z1(e);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},jEe(e))kEe(t,n);else if(n=sEe(e,t,n,s),n!==null){var a=Ju();Cp(n,e,s,a),NEe(n,t,s)}}function RYe(e,t,n){var s=z1(e),a={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(jEe(e))kEe(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,Age(t)):(a.next=u.next,u.next=a),t.interleaved=a;return}}catch{}finally{}n=sEe(e,t,a,s),n!==null&&(a=Ju(),Cp(n,e,s,a),NEe(n,t,s))}}function jEe(e){var t=e.alternate;return e===$l||t!==null&&t===$l}function kEe(e,t){KT=_te=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function NEe(e,t,n){if(n&4194240){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,gge(e,n)}}var bte={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},FYe={readContext:vf,useCallback:function(e,t){return gg().memoizedState=[e,t===void 0?null:t],e},useContext:vf,useEffect:Gwe,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,tD(4194308,4,xEe.bind(null,t,e),n)},useLayoutEffect:function(e,t){return tD(4194308,4,e,t)},useInsertionEffect:function(e,t){return tD(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=DYe.bind(null,$l,e),[s.memoizedState,e]},useRef:function(e){var t=gg();return e={current:e},t.memoizedState=e},useState:Wwe,useDebugValue:zge,useDeferredValue:function(e){return gg().memoizedState=e},useTransition:function(){var e=Wwe(!1),t=e[0];return e=OYe.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(In(407));n=n()}else{if(n=t(),Rd===null)throw Error(In(349));ek&30||cEe(s,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Gwe(uEe.bind(null,s,o,e),[e]),s.flags|=2048,wE(9,dEe.bind(null,s,o,n,t),void 0,null),n},useId:function(){var e=gg(),t=Rd.identifierPrefix;if(Tl){var n=ey,s=Jx;n=(s&~(1<<32-Sp(s)-1)).toString(32)+n,t=":"+t+"R"+n,n=_E++,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[xE]=s,OEe(e,t,!1,!1),t.stateNode=e;e:{switch(l=Aue(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;aNC&&(t.flags|=128,s=!0,JM(o,!1),t.lanes=4194304)}else{if(!s)if(e=vte(l),e!==null){if(t.flags|=128,s=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),JM(o,!0),o.tail===null&&o.tailMode==="hidden"&&!l.alternate&&!Tl)return mu(t),null}else 2*vc()-o.renderingStartTime>NC&&n!==1073741824&&(t.flags|=128,s=!0,JM(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 Hge(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&t.mode&1?nm&1073741824&&(mu(t),t.subtreeFlags&6&&(t.flags|=8192)):mu(t),null;case 24:return null;case 25:return null}throw Error(In(156,t.tag))}function WYe(e,t){switch(Nge(t),t.tag){case 1:return Lh(t.type)&&hte(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return jC(),vl(Ph),vl(wu),Lge(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Pge(t),null;case 13:if(vl(Rl),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(In(340));bC()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return vl(Rl),null;case 4:return jC(),null;case 10:return Tge(t.type._context),null;case 22:case 23:return Hge(),null;case 24:return null;default:return null}}var $L=!1,xu=!1,GYe=typeof WeakSet=="function"?WeakSet:Set,Ns=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 nhe(e,t,n){try{n()}catch(s){Xl(e,t,s)}}var sje=!1;function KYe(e,t){if(Bue=lte,e=UAe(),jge(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($ue={focusedElem:e,selectionRange:n},lte=!1,Ns=t;Ns!==null;)if(t=Ns,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ns=e;else for(;Ns!==null;){t=Ns;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(In(163))}}catch(F){Xl(t,t.return,F)}if(e=t.sibling,e!==null){e.return=t.return,Ns=e;break}Ns=t.return}return N=sje,sje=!1,N}function ZT(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&&nhe(t,n,o)}a=a.next}while(a!==s)}}function cse(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 she(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 FEe(e){var t=e.alternate;t!==null&&(e.alternate=null,FEe(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ng],delete t[xE],delete t[Vue],delete t[AYe],delete t[EYe])),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 zEe(e){return e.tag===5||e.tag===3||e.tag===4}function aje(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||zEe(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 ahe(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=ute));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}function ihe(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(ihe(e,t,n),e=e.sibling;e!==null;)ihe(e,t,n),e=e.sibling}var Jd=null,up=!1;function O0(e,t,n){for(n=n.child;n!==null;)BEe(e,t,n),n=n.sibling}function BEe(e,t,n){if(Ig&&typeof Ig.onCommitFiberUnmount=="function")try{Ig.onCommitFiberUnmount(tse,n)}catch{}switch(n.tag){case 5:xu||r4(n,t);case 6:var s=Jd,a=up;Jd=null,O0(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?tce(e.parentNode,n):e.nodeType===1&&tce(e,n),hE(e)):tce(Jd,n.stateNode));break;case 4:s=Jd,a=up,Jd=n.stateNode.containerInfo,up=!0,O0(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)&&nhe(n,t,l),a=a.next}while(a!==s)}O0(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)}O0(e,t,n);break;case 21:O0(e,t,n);break;case 22:n.mode&1?(xu=(s=xu)||n.memoizedState!==null,O0(e,t,n),xu=s):O0(e,t,n);break;default:O0(e,t,n)}}function ije(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new GYe),t.forEach(function(s){var a=nXe.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*YYe(s/1960))-s,10e?16:e,N1===null)var s=!1;else{if(e=N1,N1=null,kte=0,lo&6)throw Error(In(331));var a=lo;for(lo|=4,Ns=e.current;Ns!==null;){var o=Ns,l=o.child;if(Ns.flags&16){var i=o.deletions;if(i!==null){for(var u=0;uvc()-qge?Sj(e,0):Uge|=n),Oh(e,t)}function KEe(e,t){t===0&&(e.mode&1?(t=IL,IL<<=1,!(IL&130023424)&&(IL=4194304)):t=1);var n=Ju();e=Cy(e,t),e!==null&&(qI(e,t,n),Oh(e,n))}function rXe(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),KEe(e,n)}function nXe(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(In(314))}s!==null&&s.delete(t),KEe(e,n)}var ZEe;ZEe=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ph.current)Th=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Th=!1,VYe(e,t,n);Th=!!(e.flags&131072)}else Th=!1,Tl&&t.flags&1048576&&JAe(t,pte,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;rD(e,t),e=t.pendingProps;var a=_C(t,wu.current);g4(t,n),a=Dge(null,t,s,e,a,n);var o=Rge();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,Lh(s)?(o=!0,mte(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Ege(t),a.updater=lse,t.stateNode=a,a._reactInternals=t,Yue(t,s,e,n),t=Jue(null,t,s,!0,o,n)):(t.tag=0,Tl&&o&&kge(t),Vu(null,t,a,n),t=t.child),t;case 16:s=t.elementType;e:{switch(rD(e,t),e=t.pendingProps,a=s._init,s=a(s._payload),t.type=s,a=t.tag=aXe(s),e=op(s,e),a){case 0:t=Que(null,t,s,e,n);break e;case 1:t=tje(null,t,s,e,n);break e;case 11:t=Jwe(null,t,s,e,n);break e;case 14:t=eje(null,t,s,op(s.type,e),n);break e}throw Error(In(306,s,""))}return t;case 0:return s=t.type,a=t.pendingProps,a=t.elementType===s?a:op(s,a),Que(e,t,s,a,n);case 1:return s=t.type,a=t.pendingProps,a=t.elementType===s?a:op(s,a),tje(e,t,s,a,n);case 3:e:{if(IEe(t),e===null)throw Error(In(387));s=t.pendingProps,o=t.memoizedState,a=o.element,aEe(e,t),yte(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=kC(Error(In(423)),t),t=rje(e,t,s,n,a);break e}else if(s!==a){a=kC(Error(In(424)),t),t=rje(e,t,s,n,a);break e}else for(hm=D1(t.stateNode.containerInfo.firstChild),mm=t,Tl=!0,pp=null,n=nEe(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(bC(),s===a){t=My(e,t,n);break e}Vu(e,t,s,n)}t=t.child}return t;case 5:return iEe(t),e===null&&Gue(t),s=t.type,a=t.pendingProps,o=e!==null?e.memoizedProps:null,l=a.children,Uue(s,a)?l=null:o!==null&&Uue(s,o)&&(t.flags|=32),EEe(e,t),Vu(e,t,l,n),t.child;case 6:return e===null&&Gue(t),null;case 13:return PEe(e,t,n);case 4:return Ige(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=wC(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),Jwe(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(gte,s._currentValue),s._currentValue=l,o!==null)if(Dp(o.value,l)){if(o.children===a.children&&!Ph.current){t=My(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),Kue(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(In(341));l.lanes|=n,i=l.alternate,i!==null&&(i.lanes|=n),Kue(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),eje(e,t,s,a,n);case 15:return TEe(e,t,t.type,t.pendingProps,n);case 17:return s=t.type,a=t.pendingProps,a=t.elementType===s?a:op(s,a),rD(e,t),t.tag=1,Lh(s)?(e=!0,mte(t)):e=!1,g4(t,n),SEe(t,s,a),Yue(t,s,a,n),Jue(null,t,s,!0,e,n);case 19:return LEe(e,t,n);case 22:return AEe(e,t,n)}throw Error(In(156,t.tag))};function YEe(e,t){return jAe(e,t)}function sXe(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 lf(e,t,n,s){return new sXe(e,t,n,s)}function Gge(e){return e=e.prototype,!(!e||!e.isReactComponent)}function aXe(e){if(typeof e=="function")return Gge(e)?1:0;if(e!=null){if(e=e.$$typeof,e===hge)return 11;if(e===mge)return 14}return 2}function B1(e,t){var n=e.alternate;return n===null?(n=lf(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 aD(e,t,n,s,a,o){var l=2;if(s=e,typeof e=="function")Gge(e)&&(l=1);else if(typeof e=="string")l=5;else e:switch(e){case GS:return Cj(n.children,a,o,t);case uge:l=8,a|=8;break;case _ue:return e=lf(12,n,t,a|2),e.elementType=_ue,e.lanes=o,e;case bue:return e=lf(13,n,t,a),e.elementType=bue,e.lanes=o,e;case wue:return e=lf(19,n,t,a),e.elementType=wue,e.lanes=o,e;case iAe:return use(n,a,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case sAe:l=10;break e;case aAe:l=9;break e;case hge:l=11;break e;case mge:l=14;break e;case W0:l=16,s=null;break e}throw Error(In(130,e==null?e:typeof e,""))}return t=lf(l,n,t,a),t.elementType=e,t.type=s,t.lanes=o,t}function Cj(e,t,n,s){return e=lf(7,e,s,t),e.lanes=n,e}function use(e,t,n,s){return e=lf(22,e,s,t),e.elementType=iAe,e.lanes=n,e.stateNode={isHidden:!1},e}function cce(e,t,n){return e=lf(6,e,null,t),e.lanes=n,e}function dce(e,t,n){return t=lf(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function iXe(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=Vle(0),this.expirationTimes=Vle(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vle(0),this.identifierPrefix=s,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function Kge(e,t,n,s,a,o,l,i,u){return e=new iXe(e,t,n,i,u),t===1?(t=1,o===!0&&(t|=8)):t=0,o=lf(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ege(o),e}function oXe(e,t,n){var s=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(eIe)}catch(e){console.error(e)}}eIe(),eAe.exports=Mm;var Ah=eAe.exports;const Qge=eo(Ah);var tIe,fje=Ah;tIe=fje.createRoot,fje.hydrateRoot;const hXe=1,mXe=1e6;let uce=0;function fXe(){return uce=(uce+1)%Number.MAX_SAFE_INTEGER,uce.toString()}const hce=new Map,pje=e=>{if(hce.has(e))return;const t=setTimeout(()=>{hce.delete(e),QT({type:"REMOVE_TOAST",toastId:e})},mXe);hce.set(e,t)},pXe=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,hXe)};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?pje(n):e.toasts.forEach(s=>{pje(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)}}},iD=[];let oD={toasts:[]};function QT(e){oD=pXe(oD,e),iD.forEach(t=>{t(oD)})}function Ca({...e}){const t=fXe(),n=a=>QT({type:"UPDATE_TOAST",toast:{...a,id:t}}),s=()=>QT({type:"DISMISS_TOAST",toastId:t});return QT({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:a=>{a||s()}}}),{id:t,dismiss:s,update:n}}function pi(){const[e,t]=A.useState(oD);return A.useEffect(()=>(iD.push(t),()=>{const n=iD.indexOf(t);n>-1&&iD.splice(n,1)}),[e]),{...e,toast:Ca,dismiss:n=>QT({type:"DISMISS_TOAST",toastId:n})}}function xn(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 gje(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ty(...e){return t=>{let n=!1;const s=e.map(a=>{const o=gje(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,xXe(a,...t)]}function xXe(...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=yXe(e),n=A.forwardRef((s,a)=>{const{children:o,...l}=s,i=A.Children.toArray(o),u=i.find(vXe);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 Jge=uv("Slot");function yXe(e){const t=A.forwardRef((n,s)=>{const{children:a,...o}=n;if(A.isValidElement(a)){const l=bXe(a),i=_Xe(o,a.props);return a.type!==A.Fragment&&(i.ref=s?Ty(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 rIe=Symbol("radix.slottable");function nIe(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=rIe,t}function vXe(e){return A.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===rIe}function _Xe(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 bXe(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 GI(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 wXe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Bn=wXe.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 exe(e,t){e&&Ah.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 jXe(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 kXe="DismissableLayer",uhe="dismissableLayer.update",NXe="dismissableLayer.pointerDownOutside",SXe="dismissableLayer.focusOutside",xje,sIe=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(sIe),[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=MXe(V=>{const W=V.target,G=[...m.branches].some(Q=>Q.contains(W));!F||G||(a==null||a(V),l==null||l(V),V.defaultPrevented||i==null||i())},v),U=TXe(V=>{const W=V.target;[...m.branches].some(Q=>Q.contains(W))||(o==null||o(V),l==null||l(V),V.defaultPrevented||i==null||i())},v);return jXe(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&&(xje=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(x)),m.layers.add(x),yje(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=xje)}},[x,v,n,m]),A.useEffect(()=>()=>{x&&(m.layers.delete(x),m.layersWithOutsidePointerEventsDisabled.delete(x),yje())},[x,m]),A.useEffect(()=>{const V=()=>b({});return document.addEventListener(uhe,V),()=>document.removeEventListener(uhe,V)},[]),r.jsx(Bn.div,{...u,ref:N,style:{pointerEvents:P?F?"auto":"none":void 0,...e.style},onFocusCapture:xn(e.onFocusCapture,U.onFocusCapture),onBlurCapture:xn(e.onBlurCapture,U.onBlurCapture),onPointerDownCapture:xn(e.onPointerDownCapture,D.onPointerDownCapture)})});wv.displayName=kXe;var CXe="DismissableLayerBranch",aIe=A.forwardRef((e,t)=>{const n=A.useContext(sIe),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(Bn.div,{...e,ref:a})});aIe.displayName=CXe;function MXe(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(){iIe(NXe,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 TXe(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&&iIe(SXe,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 yje(){const e=new CustomEvent(uhe);document.dispatchEvent(e)}function iIe(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?exe(a,o):a.dispatchEvent(o)}var AXe=wv,EXe=aIe,oc=globalThis!=null&&globalThis.document?A.useLayoutEffect:()=>{},IXe="Portal",x3=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?Qge.createPortal(r.jsx(Bn.div,{...s,ref:t}),l):null});x3.displayName=IXe;function PXe(e,t){return A.useReducer((n,s)=>t[n][s]??n,e)}var Ac=e=>{const{present:t,children:n}=e,s=LXe(t),a=typeof n=="function"?n({present:s.isPresent}):A.Children.only(n),o=ca(s.ref,OXe(a));return typeof n=="function"||s.isPresent?A.cloneElement(a,{ref:o}):null};Ac.displayName="Presence";function LXe(e){const[t,n]=A.useState(),s=A.useRef(null),a=A.useRef(e),o=A.useRef("none"),l=e?"mounted":"unmounted",[i,u]=PXe(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return A.useEffect(()=>{const m=VL(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=VL(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=VL(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=VL(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 VL(e){return(e==null?void 0:e.animationName)||"none"}function OXe(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 DXe=oge[" useInsertionEffect ".trim().toString()]||oc;function sh({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[a,o,l]=RXe({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=FXe(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 RXe({defaultProp:e,onChange:t}){const[n,s]=A.useState(e),a=A.useRef(n),o=A.useRef(t);return DXe(()=>{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 FXe(e){return typeof e=="function"}var oIe=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"}),zXe="VisuallyHidden",gse=A.forwardRef((e,t)=>r.jsx(Bn.span,{...e,ref:t,style:{...oIe,...e.style}}));gse.displayName=zXe;var BXe=gse,txe="ToastProvider",[rxe,$Xe,UXe]=GI("Toast"),[lIe]=cc("Toast",[UXe]),[qXe,xse]=lIe(txe),cIe=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 \`${txe}\`. Expected non-empty \`string\`.`),r.jsx(rxe.Provider,{scope:t,children:r.jsx(qXe,{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})})};cIe.displayName=txe;var dIe="ToastViewport",VXe=["F8"],hhe="toast.viewportPause",mhe="toast.viewportResume",uIe=A.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:s=VXe,label:a="Notifications ({hotkey})",...o}=e,l=xse(dIe,n),i=$Xe(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(hhe);I.dispatchEvent(U),l.isClosePausedRef.current=!0}},P=()=>{if(l.isClosePausedRef.current){const U=new CustomEvent(mhe);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,...nQe(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"}),de=oe.findIndex(se=>se===W);mce(oe.slice(de+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(EXe,{ref:u,role:"region","aria-label":a.replace("{hotkey}",b),tabIndex:-1,style:{pointerEvents:N?void 0:"none"},children:[N&&r.jsx(fhe,{ref:m,onFocusFromOutsideViewport:()=>{const M=k({tabbingDirection:"forwards"});mce(M)}}),r.jsx(rxe.Slot,{scope:n,children:r.jsx(Bn.ol,{tabIndex:-1,...o,ref:v})}),N&&r.jsx(fhe,{ref:x,onFocusFromOutsideViewport:()=>{const M=k({tabbingDirection:"backwards"});mce(M)}})]})});uIe.displayName=dIe;var hIe="ToastFocusProxy",fhe=A.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:s,...a}=e,o=xse(hIe,n);return r.jsx(gse,{"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()}})});fhe.displayName=hIe;var KI="Toast",HXe="toast.swipeStart",WXe="toast.swipeMove",GXe="toast.swipeCancel",KXe="toast.swipeEnd",mIe=A.forwardRef((e,t)=>{const{forceMount:n,open:s,defaultOpen:a,onOpenChange:o,...l}=e,[i,u]=sh({prop:s,defaultProp:a??!0,onChange:o,caller:KI});return r.jsx(Ac,{present:n||i,children:r.jsx(XXe,{open:i,...l,ref:t,onClose:()=>u(!1),onPause:sc(e.onPause),onResume:sc(e.onResume),onSwipeStart:xn(e.onSwipeStart,m=>{m.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:xn(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:xn(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:xn(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)})})})});mIe.displayName=KI;var[ZXe,YXe]=lIe(KI,{onClose(){}}),XXe=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=xse(KI,n),[M,I]=A.useState(null),T=ca(t,se=>I(se)),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:Q}=k,ae=sc(()=>{var pe;(M==null?void 0:M.contains(document.activeElement))&&((pe=k.viewport)==null||pe.focus()),l()}),oe=A.useCallback(se=>{!se||se===1/0||(window.clearTimeout(W.current),U.current=new Date().getTime(),W.current=window.setTimeout(ae,se))},[ae]);A.useEffect(()=>{const se=k.viewport;if(se){const pe=()=>{oe(V.current),m==null||m()},ne=()=>{const me=new Date().getTime()-U.current;V.current=V.current-me,window.clearTimeout(W.current),u==null||u()};return se.addEventListener(hhe,ne),se.addEventListener(mhe,pe),()=>{se.removeEventListener(hhe,ne),se.removeEventListener(mhe,pe)}}},[k.viewport,D,u,m,oe]),A.useEffect(()=>{o&&!k.isClosePausedRef.current&&oe(D)},[o,D,k.isClosePausedRef,oe]),A.useEffect(()=>(G(),()=>Q()),[G,Q]);const de=A.useMemo(()=>M?_Ie(M):null,[M]);return k.viewport?r.jsxs(r.Fragment,{children:[de&&r.jsx(QXe,{__scopeToast:n,role:"status","aria-live":s==="foreground"?"assertive":"polite","aria-atomic":!0,children:de}),r.jsx(ZXe,{scope:n,onClose:ae,children:Ah.createPortal(r.jsx(rxe.ItemSlot,{scope:n,children:r.jsx(AXe,{asChild:!0,onEscapeKeyDown:xn(i,()=>{k.isFocusedToastEscapeKeyDownRef.current||ae(),k.isFocusedToastEscapeKeyDownRef.current=!1}),children:r.jsx(Bn.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:xn(e.onKeyDown,se=>{se.key==="Escape"&&(i==null||i(se.nativeEvent),se.nativeEvent.defaultPrevented||(k.isFocusedToastEscapeKeyDownRef.current=!0,ae()))}),onPointerDown:xn(e.onPointerDown,se=>{se.button===0&&(P.current={x:se.clientX,y:se.clientY})}),onPointerMove:xn(e.onPointerMove,se=>{if(!P.current)return;const pe=se.clientX-P.current.x,ne=se.clientY-P.current.y,me=!!F.current,he=["left","right"].includes(k.swipeDirection),xe=["left","up"].includes(k.swipeDirection)?Math.min:Math.max,Te=he?xe(0,pe):0,be=he?0:xe(0,ne),we=se.pointerType==="touch"?10:2,ve={x:Te,y:be},et={originalEvent:se,delta:ve};me?(F.current=ve,HL(WXe,y,et,{discrete:!1})):vje(ve,k.swipeDirection,we)?(F.current=ve,HL(HXe,x,et,{discrete:!1}),se.target.setPointerCapture(se.pointerId)):(Math.abs(pe)>we||Math.abs(ne)>we)&&(P.current=null)}),onPointerUp:xn(e.onPointerUp,se=>{const pe=F.current,ne=se.target;if(ne.hasPointerCapture(se.pointerId)&&ne.releasePointerCapture(se.pointerId),F.current=null,P.current=null,pe){const me=se.currentTarget,he={originalEvent:se,delta:pe};vje(pe,k.swipeDirection,k.swipeThreshold)?HL(KXe,b,he,{discrete:!0}):HL(GXe,v,he,{discrete:!0}),me.addEventListener("click",xe=>xe.preventDefault(),{once:!0})}})})})}),k.viewport)})]}):null}),QXe=e=>{const{__scopeToast:t,children:n,...s}=e,a=xse(KI,t),[o,l]=A.useState(!1),[i,u]=A.useState(!1);return tQe(()=>l(!0)),A.useEffect(()=>{const m=window.setTimeout(()=>u(!0),1e3);return()=>window.clearTimeout(m)},[]),i?null:r.jsx(x3,{asChild:!0,children:r.jsx(gse,{...s,children:o&&r.jsxs(r.Fragment,{children:[a.label," ",n]})})})},JXe="ToastTitle",fIe=A.forwardRef((e,t)=>{const{__scopeToast:n,...s}=e;return r.jsx(Bn.div,{...s,ref:t})});fIe.displayName=JXe;var eQe="ToastDescription",pIe=A.forwardRef((e,t)=>{const{__scopeToast:n,...s}=e;return r.jsx(Bn.div,{...s,ref:t})});pIe.displayName=eQe;var gIe="ToastAction",xIe=A.forwardRef((e,t)=>{const{altText:n,...s}=e;return n.trim()?r.jsx(vIe,{altText:n,asChild:!0,children:r.jsx(nxe,{...s,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${gIe}\`. Expected non-empty \`string\`.`),null)});xIe.displayName=gIe;var yIe="ToastClose",nxe=A.forwardRef((e,t)=>{const{__scopeToast:n,...s}=e,a=YXe(yIe,n);return r.jsx(vIe,{asChild:!0,children:r.jsx(Bn.button,{type:"button",...s,ref:t,onClick:xn(e.onClick,a.onClose)})})});nxe.displayName=yIe;var vIe=A.forwardRef((e,t)=>{const{__scopeToast:n,altText:s,...a}=e;return r.jsx(Bn.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":s||void 0,...a,ref:t})});function _Ie(e){const t=[];return Array.from(e.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&t.push(s.textContent),rQe(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(..._Ie(s))}}),t}function HL(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?exe(a,o):a.dispatchEvent(o)}var vje=(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 tQe(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 rQe(e){return e.nodeType===e.ELEMENT_NODE}function nQe(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 mce(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var sQe=cIe,bIe=uIe,wIe=mIe,jIe=fIe,kIe=pIe,NIe=xIe,SIe=nxe;function CIe(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,bje=hi,y3=(e,t)=>n=>{var s;if((t==null?void 0:t.variants)==null)return bje(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=_je(x)||_je(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 bje(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 aQe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),MIe=(...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 iQe={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 TIe=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,...iQe,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:MIe("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(TIe,{ref:o,iconNode:t,className:MIe(`lucide-${aQe(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 lD=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 cD=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 dD=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 uD=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 hD=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 mD=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 fD=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 pD=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 gD=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 xD=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 yD=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 vD=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 _D=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 bD=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 wD=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 jD=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 kD=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 ND=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 SD=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 CD=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 MD=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 TD=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 AD=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 ED=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 ID=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 PD=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 LD=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 OD=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 DD=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 RD=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 FD=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 zD=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 BD=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 $D=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 UD=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 qD=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 VD=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 HD=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 WD=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 GD=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 KD=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 ZD=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 YD=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 XD=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 JT=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 QD=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 JD=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 e8=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 eA=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 t8=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 r8=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 n8=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 s8=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 a8=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 i8=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 o8=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 l8=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 c8=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 d8=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 u8=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 h8=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 m8=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 f8=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 p8=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 g8=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 x8=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 y8=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 v8=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 _8=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 b8=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 w8=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 j8=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 k8=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 N8=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 S8=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 C8=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 M8=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 T8=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 A8=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 E8=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 I8=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 uf=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 P8=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 L8=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 O8=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 D8=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 R8=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 F8=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 z8=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 B8=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 $8=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 U8=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 q8=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 V8=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 H8=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 W8=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 G8=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 K8=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 Z8=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 Y8=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 X8=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 Q8=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 J8=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 eR=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 tR=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 rR=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 nR=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 sR=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 aR=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 iR=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 oR=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 lR=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 cR=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 dR=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 $1=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 uR=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 hR=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 mR=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 fR=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 pR=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 gR=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 xR=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 yR=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 vR=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 _R=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 bR=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 U1=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 wR=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 jR=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 kR=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 NR=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 SR=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 CR=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 MR=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 TR=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 AR=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 ER=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 IR=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 PR=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 LR=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 OR=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 DR=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 RR=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 FR=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 zR=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 BR=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 $R=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 UR=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 qR=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 VR=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 HR=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 WR=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 GR=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 KR=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 ZR=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 YR=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 XR=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 QR=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 JR=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 eF=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 tF=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 rF=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 nF=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 sF=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 aF=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 iF=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 oF=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 lF=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 tA=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 cF=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 dF=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 uF=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 hF=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 mF=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 fF=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 pF=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 gF=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 xF=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 yF=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 rA=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 vF=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 _F=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 bF=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 wF=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 jF=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 kF=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 NF=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 SF=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 CF=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 nA=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 MF=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 TF=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 AF=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 EF=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 Dh=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 IF=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 PF=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 LF=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 OF=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 DF=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 mi=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 RF=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 FF=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 zF=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 BF=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 $F=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 fm=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 UF=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 qF=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 VF=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 HF=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 WF=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 GF=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 sA=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 KF=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 ZF=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 YF=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 XF=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 QF=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 JF=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 ez=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 tz=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 rz=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 nz=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 sz=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 az=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 Ts=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 iz=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 oz=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 lz=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 cz=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 dz=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 uz=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 hz=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 mz=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 fz=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 pz=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 gz=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 xz=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 yz=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 vz=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 _z=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 bz=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 wz=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 jz=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 kz=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 Nz=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 Sz=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 Cz=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 Mz=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 Tz=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 Az=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 Ez=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 Iz=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 Pz=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 Lz=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 Oz=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 fi=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 Dz=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 Rz=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 Fd=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 Fz=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 zz=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 Bz=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 $z=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 Uz=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 qz=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 Vz=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 Hz=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 Wz=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 Gz=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 Kz=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 Zz=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 Yz=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 Xz=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 li=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 Qz=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 Jz=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 e7=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 t7=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 r7=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 n7=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 s7=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 a7=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 i7=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 nf=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 o7=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 eh=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 l7=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 c7=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 d7=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 aA=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 u7=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 iA=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 h7=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 m7=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 f7=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 p7=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 g7=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 x7=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 y7=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 v7=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 _7=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 b7=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 w7=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 j7=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 k7=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 N7=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 S7=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 C7=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 M7=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 T7=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 A7=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 E7=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 I7=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 Qa=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 P7=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 L7=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 O7=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 D7=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 R7=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 F7=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 z7=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 B7=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 $7=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 U7=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 q7=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 V7=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 H7=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 W7=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 G7=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 K7=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 Z7=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 Y7=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 X7=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 Q7=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 J7=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 e9=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 t9=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 r9=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 n9=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 s9=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 a9=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 i9=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 o9=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 l9=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 c9=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 d9=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 u9=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 h9=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 m9=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 f9=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 p9=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 g9=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 x9=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 y9=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 Oo=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 v9=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 _9=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 b9=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 w9=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 j9=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 k9=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 N9=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 S9=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 C9=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 M9=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 T9=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 A9=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 hf=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 E9=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 I9=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 P9=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 L9=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 q1=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 O9=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 D9=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 R9=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 F9=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 z9=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 B9=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 $9=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 U9=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 q9=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 V9=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 H9=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 W9=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 G9=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 K9=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 Z9=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 Y9=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 X9=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 Q9=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 J9=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 eB=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 tB=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 rB=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 nB=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 sB=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 aB=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 iB=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 oB=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 lB=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 cB=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 dB=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 uB=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 zd=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 hB=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 mB=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 fB=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 pB=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 gB=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 xB=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 yB=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 vB=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 _B=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 bB=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 wB=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 jB=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 kB=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 NB=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 SB=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 CB=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 MB=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 TB=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 AB=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 EB=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 IB=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 PB=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 LB=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 OB=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 DB=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 Ms=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 RB=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 FB=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 zB=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 BB=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 $B=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 UB=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 qB=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 VB=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 HB=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 WB=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 GB=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 KB=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 ZB=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 YB=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 XB=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 QB=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 JB=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 e$=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 t$=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 r$=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 n$=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 s$=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 a$=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 V1=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 i$=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 o$=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 l$=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 c$=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 d$=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 u$=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 h$=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 m$=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 f$=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 p$=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 g$=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 x$=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 y$=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 v$=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 _$=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 b$=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 w$=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 j$=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 H1=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 k$=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 N$=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 S$=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 C$=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 M$=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 T$=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 A$=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 E$=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 I$=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 P$=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 L$=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 O$=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 D$=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 R$=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 F$=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 z$=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 Ad=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 B$=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 W1=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 $$=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 U$=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 q$=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 V$=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 H$=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 W$=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 G$=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 K$=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 Z$=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 pm=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 Y$=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 X$=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 Q$=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 J$=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 eU=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 tU=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 rU=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 nU=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 sU=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 aU=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 iU=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 oU=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 lU=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 cU=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 dU=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 uU=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 hU=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 mU=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 fU=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 pU=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 gU=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 xU=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 yU=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 vU=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 _U=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 bU=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 wU=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 jU=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 kU=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 NU=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 SU=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 CU=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 MU=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 TU=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 AU=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 EU=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 IU=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 PU=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 LU=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 OU=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 DU=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 RU=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 FU=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 zU=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 BU=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 $U=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 UU=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 qU=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 VU=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 HU=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 WU=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 GU=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 KU=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 ZU=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 YU=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 XU=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 QU=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 JU=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 eq=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 tq=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 rq=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 nq=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 sq=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 aq=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 iq=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 oq=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 lq=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 cq=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 dq=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 uq=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 hq=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 mq=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 fq=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 pq=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 gq=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 xq=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 yq=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 vq=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 _q=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 G1=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 bq=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 wq=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 jq=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 rm=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 kq=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 Nq=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 Sq=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 Cq=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 Mq=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 Tq=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 Aq=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 Eq=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 Iq=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 Pq=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 Lq=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 Oq=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 Dq=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 Rq=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 oA=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 Fq=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 zq=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 Bq=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 lA=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 cA=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 $q=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 Uq=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 qq=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 Vq=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 Hq=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 Wq=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 Gq=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 Kq=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 Zq=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 Yq=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 Xq=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 Qq=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 bi=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 Jq=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 eV=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 tV=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 rV=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 nV=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 sV=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 aV=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 iV=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 oV=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 lV=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 cV=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 dV=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 uV=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 hV=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 mV=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 fV=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 pV=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 gV=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 xV=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 yV=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 vV=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 _V=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 bV=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 wV=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 jV=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 kV=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 NV=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 SV=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 CV=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 gm=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 MV=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 TV=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 AV=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 EV=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 IV=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 PV=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 LV=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 OV=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 DV=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 RV=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 FV=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 zV=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 BV=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 $V=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 UV=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 qV=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 VV=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 HV=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 WV=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 GV=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 mf=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 KV=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 ZV=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 YV=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 XV=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 QV=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 JV=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 eH=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 tH=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 rH=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 nH=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 my=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 sH=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 xm=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 Ro=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 ym=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 aH=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 iH=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 oH=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 lH=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 cH=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 dH=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 uH=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 hH=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 mH=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 fH=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 pH=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 gH=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 xH=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 yH=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 ff=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 Wr=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 vH=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 _H=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 bH=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 wH=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 dA=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 jH=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 th=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 kH=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 NH=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 SH=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 CH=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 MH=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 TH=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 AH=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 EH=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 IH=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 PH=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 LH=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 uA=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 ks=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 OH=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 DH=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 RH=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 FH=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 zH=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 BH=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 $H=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 UH=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 qH=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 VH=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 HH=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 WH=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 Fo=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 GH=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 KH=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 ZH=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 YH=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 XH=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 fy=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 QH=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 JH=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 eW=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 hA=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 tW=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 rW=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 nW=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 sW=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 aW=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 iW=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 mA=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 oW=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 lW=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 cW=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 dW=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 uW=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 hW=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 mW=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 fA=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 fW=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 pW=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 gW=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 xW=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 pA=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 yW=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 vW=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 _W=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 bW=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 wW=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 zo=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 jW=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 kW=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 gA=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 NW=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 SW=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 CW=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 MW=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 TW=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 AW=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 EW=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 IW=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 PW=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 LW=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 OW=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 DW=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 RW=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 FW=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 zW=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 BW=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 $W=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 UW=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 qW=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 VW=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 HW=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 WW=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 GW=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 KW=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 ZW=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 YW=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 XW=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 QW=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 JW=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 eG=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 tG=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 rG=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 nG=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 sG=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 aG=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 iG=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 oG=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 lG=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 cG=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 dG=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 uG=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 hG=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 mG=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 fG=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 pG=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 gG=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 xG=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 yG=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 vG=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 xA=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 _G=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 py=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 bG=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 wG=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 jG=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 kG=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 NG=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 SG=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 CG=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 MG=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 TG=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 AG=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 EG=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 IG=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 PG=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 LG=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 OG=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 DG=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 RG=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 FG=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 zG=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 BG=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 $G=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 UG=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 qG=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 VG=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 HG=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 WG=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 GG=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 KG=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 ZG=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 YG=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 XG=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 QG=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 JG=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 eK=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 tK=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 rK=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 K0=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 P4=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 nK=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 sK=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 vm=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 aK=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 iK=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 Z0=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 oK=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 Y0=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 lK=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 cK=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 dK=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 Ja=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 uK=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 L4=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 hK=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 mK=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 fK=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 pK=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 gK=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 xK=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 yK=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 vK=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 Ii=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 _K=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 bK=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 wK=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 jK=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 kK=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 NK=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 SK=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 CK=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 MK=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 TK=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 AK=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 yA=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 EK=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 IK=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 PK=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 LK=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 OK=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 DK=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 vA=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 bn=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 RK=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 FK=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 zK=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 BK=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 $K=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 UK=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 qK=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 VK=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 HK=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 WK=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 gy=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 GK=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 KK=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 ZK=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 YK=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 XK=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 QK=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 _A=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 bA=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 JK=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 eZ=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 tZ=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 rZ=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 nZ=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 sZ=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 aZ=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 iZ=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 oZ=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 lZ=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 cZ=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 dZ=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 uZ=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 hZ=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 mZ=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 fZ=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 pZ=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 gZ=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 xZ=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 yZ=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 vZ=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 _Z=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 bZ=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 wZ=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 jZ=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 O4=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 kZ=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 NZ=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 SZ=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 Wo=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 CZ=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 MZ=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 TZ=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 AZ=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 EZ=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 wA=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 IZ=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 PZ=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 LZ=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 jA=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 OZ=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 DZ=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 RZ=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 FZ=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 zZ=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 D4=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 BZ=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 kA=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 $Z=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 UZ=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 qZ=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 VZ=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 HZ=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 WZ=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 GZ=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 KZ=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 ZZ=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 YZ=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 XZ=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 QZ=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 JZ=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 eY=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 tY=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 rY=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 nY=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 sY=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 aY=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 iY=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 oY=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 lY=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 cY=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 dY=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 uY=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 hY=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 mY=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 fY=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 pY=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 gY=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 xY=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 yY=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 vY=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 _Y=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 bY=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 wY=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 jY=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 kY=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 NY=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 SY=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 CY=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 MY=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 TY=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 AY=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 Bd=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 EY=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 NA=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 IY=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 PY=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 LY=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 OY=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 SA=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 DY=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 RY=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 FY=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 zY=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 BY=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 $Y=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 _m=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 UY=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 qY=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 VY=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 HY=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 Eh=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 WY=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 GY=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 KY=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 ZY=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 YY=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 XY=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 QY=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 JY=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 eX=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 tX=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 rX=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 nX=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 sX=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 aX=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 iX=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 oX=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 lX=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 cX=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 dX=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 uX=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 hX=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 CA=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 mX=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 fX=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 xy=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 pX=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 gX=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 xX=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 S1=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 yX=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 vX=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 _X=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 bX=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 wX=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 Ds=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 jX=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 kX=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 NX=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 SX=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 CX=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 MX=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 TX=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 AX=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 X0=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 EX=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 IX=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 PX=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 LX=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 OX=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 DX=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 RX=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 FX=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 zX=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 BX=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 Ss=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 $X=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 UX=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 qX=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 VX=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 HX=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 WX=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 GX=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 KX=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 ZX=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 YX=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 XX=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 QX=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 JX=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 eQ=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 tQ=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 rQ=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 nQ=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 sQ=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 aQ=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 iQ=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 oQ=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 lQ=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 cQ=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 R4=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 dQ=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 uQ=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 hQ=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 mQ=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 fQ=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 pQ=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 gQ=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 xQ=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 yQ=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 vQ=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 _Q=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 bQ=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 wQ=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 jQ=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 kQ=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 NQ=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 SQ=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 yy=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 CQ=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 MQ=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 TQ=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 AQ=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 EQ=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 IQ=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 PQ=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 LQ=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 OQ=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 DQ=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 RQ=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 FQ=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 zQ=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 BQ=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 $Q=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 MA=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 pd=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 UQ=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 qQ=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 VQ=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 HQ=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 WQ=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 GQ=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 TA=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 KQ=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 ZQ=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 YQ=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 XQ=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 QQ=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 JQ=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 eJ=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 tJ=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 rJ=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 nJ=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 sJ=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 aJ=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 iJ=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 oJ=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 lJ=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 cJ=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 dJ=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 uJ=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 hJ=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 Un=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 mJ=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 fJ=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 pJ=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 gJ=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 xJ=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 rh=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 Gu=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 yJ=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 vJ=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 AA=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 _J=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 bJ=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 wJ=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 jJ=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 kJ=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 NJ=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 SJ=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 CJ=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 MJ=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 TJ=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 AJ=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 EJ=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 F4=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 IJ=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 PJ=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 LJ=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 OJ=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 EA=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 DJ=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 RJ=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 IA=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 FJ=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 zJ=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 nh=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 BJ=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 $J=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 UJ=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 qJ=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 qn=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 VJ=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 PA=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 HJ=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 WJ=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 GJ=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 KJ=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 ZJ=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 YJ=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 Pa=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 XJ=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 QJ=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 JJ=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 eee=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 tee=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 ree=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 nee=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 see=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 aee=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 iee=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 oee=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 lee=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 cee=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 dee=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 uee=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 hee=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 mee=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 fee=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 pee=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 gee=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 xee=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 yee=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 vee=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 _ee=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 bee=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 wee=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 jee=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 kee=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 Nee=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 See=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 Cee=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 Mee=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 Tee=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 Aee=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 Eee=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 Iee=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 Pee=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 Lee=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 vy=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 us=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 Oee=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 Dee=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 z4=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 B4=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 oQe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:lD,AArrowUp:cD,ALargeSmall:dD,Accessibility:uD,Activity:Lg,AirVent:hD,Airplay:mD,AlarmClock:pD,AlarmClockCheck:L_,AlarmClockMinus:O_,AlarmClockOff:fD,AlarmClockPlus:D_,AlarmSmoke:gD,Album:xD,AlignCenter:y4,AlignCenterHorizontal:yD,AlignCenterVertical:vD,AlignEndHorizontal:_D,AlignEndVertical:bD,AlignHorizontalDistributeCenter:wD,AlignHorizontalDistributeEnd:jD,AlignHorizontalDistributeStart:kD,AlignHorizontalJustifyCenter:ND,AlignHorizontalJustifyEnd:SD,AlignHorizontalJustifyStart:CD,AlignHorizontalSpaceAround:MD,AlignHorizontalSpaceBetween:TD,AlignJustify:AD,AlignLeft:v4,AlignRight:_4,AlignStartHorizontal:ED,AlignStartVertical:ID,AlignVerticalDistributeCenter:PD,AlignVerticalDistributeEnd:LD,AlignVerticalDistributeStart:OD,AlignVerticalJustifyCenter:DD,AlignVerticalJustifyEnd:RD,AlignVerticalJustifyStart:FD,AlignVerticalSpaceAround:zD,AlignVerticalSpaceBetween:BD,Ambulance:$D,Ampersand:UD,Ampersands:qD,Amphora:VD,Anchor:HD,Angry:WD,Annoyed:GD,Antenna:KD,Anvil:ZD,Aperture:YD,AppWindow:JT,AppWindowMac:XD,Apple:QD,Archive:eA,ArchiveRestore:JD,ArchiveX:e8,Armchair:t8,ArrowBigDown:n8,ArrowBigDownDash:r8,ArrowBigLeft:a8,ArrowBigLeftDash:s8,ArrowBigRight:o8,ArrowBigRightDash:i8,ArrowBigUp:c8,ArrowBigUpDash:l8,ArrowDown:oy,ArrowDown01:d8,ArrowDown10:u8,ArrowDownAZ:R_,ArrowDownFromLine:h8,ArrowDownLeft:m8,ArrowDownNarrowWide:f8,ArrowDownRight:p8,ArrowDownToDot:g8,ArrowDownToLine:x8,ArrowDownUp:y8,ArrowDownWideNarrow:F_,ArrowDownZA:z_,ArrowLeft:Wi,ArrowLeftFromLine:v8,ArrowLeftRight:_8,ArrowLeftToLine:b8,ArrowRight:No,ArrowRightFromLine:w8,ArrowRightLeft:j8,ArrowRightToLine:k8,ArrowUp:uf,ArrowUp01:N8,ArrowUp10:S8,ArrowUpAZ:B_,ArrowUpDown:Og,ArrowUpFromDot:C8,ArrowUpFromLine:M8,ArrowUpLeft:T8,ArrowUpNarrowWide:$_,ArrowUpRight:A8,ArrowUpToLine:E8,ArrowUpWideNarrow:I8,ArrowUpZA:U_,ArrowsUpFromLine:P8,Asterisk:L8,AtSign:O8,Atom:D8,AudioLines:R8,AudioWaveform:F8,Award:Bl,Axe:z8,Axis3d:q_,Baby:B8,Backpack:$8,Badge:nR,BadgeAlert:U8,BadgeCent:q8,BadgeCheck:V_,BadgeDollarSign:V8,BadgeEuro:H8,BadgeHelp:W8,BadgeIndianRupee:G8,BadgeInfo:K8,BadgeJapaneseYen:Z8,BadgeMinus:Y8,BadgePercent:X8,BadgePlus:Q8,BadgePoundSterling:J8,BadgeRussianRuble:eR,BadgeSwissFranc:tR,BadgeX:rR,BaggageClaim:sR,Ban:aR,Banana:iR,Bandage:oR,Banknote:lR,Barcode:cR,Baseline:dR,Bath:$1,Battery:gR,BatteryCharging:uR,BatteryFull:hR,BatteryLow:mR,BatteryMedium:fR,BatteryWarning:pR,Beaker:xR,Bean:vR,BeanOff:yR,Bed:U1,BedDouble:_R,BedSingle:bR,Beef:wR,Beer:kR,BeerOff:jR,Bell:Dg,BellDot:NR,BellElectric:SR,BellMinus:CR,BellOff:Mj,BellPlus:MR,BellRing:TR,BetweenHorizontalEnd:H_,BetweenHorizontalStart:W_,BetweenVerticalEnd:AR,BetweenVerticalStart:ER,BicepsFlexed:IR,Bike:PR,Binary:LR,Binoculars:OR,Biohazard:DR,Bird:RR,Bitcoin:FR,Blend:zR,Blinds:BR,Blocks:$R,Bluetooth:HR,BluetoothConnected:UR,BluetoothOff:qR,BluetoothSearching:VR,Bold:b4,Bolt:WR,Bomb:GR,Bone:KR,Book:gF,BookA:ZR,BookAudio:YR,BookCheck:XR,BookCopy:QR,BookDashed:G_,BookDown:JR,BookHeadphones:eF,BookHeart:tF,BookImage:rF,BookKey:nF,BookLock:sF,BookMarked:aF,BookMinus:iF,BookOpen:tA,BookOpenCheck:oF,BookOpenText:lF,BookPlus:cF,BookText:dF,BookType:uF,BookUp:mF,BookUp2:hF,BookUser:fF,BookX:pF,Bookmark:Mp,BookmarkCheck:xF,BookmarkMinus:yF,BookmarkPlus:rA,BookmarkX:vF,BoomBox:_F,Bot:w4,BotMessageSquare:bF,BotOff:wF,Box:jF,Boxes:kF,Braces:K_,Brackets:NF,Brain:nA,BrainCircuit:SF,BrainCog:CF,BrickWall:MF,Briefcase:Dh,BriefcaseBusiness:TF,BriefcaseConveyorBelt:AF,BriefcaseMedical:EF,BringToFront:IF,Brush:PF,Bug:DF,BugOff:LF,BugPlay:OF,Building:Tj,Building2:mi,Bus:FF,BusFront:RF,Cable:BF,CableCar:zF,Cake:fm,CakeSlice:$F,Calculator:UF,Calendar:Ts,Calendar1:qF,CalendarArrowDown:VF,CalendarArrowUp:HF,CalendarCheck:GF,CalendarCheck2:WF,CalendarClock:sA,CalendarCog:KF,CalendarDays:Tp,CalendarFold:ZF,CalendarHeart:YF,CalendarMinus:QF,CalendarMinus2:XF,CalendarOff:JF,CalendarPlus:Aj,CalendarPlus2:ez,CalendarRange:tz,CalendarSearch:rz,CalendarSync:nz,CalendarX:az,CalendarX2:sz,Camera:Rg,CameraOff:iz,Candy:cz,CandyCane:oz,CandyOff:lz,Cannabis:dz,Captions:Z_,CaptionsOff:uz,Car:fz,CarFront:hz,CarTaxiFront:mz,Caravan:pz,Carrot:gz,CaseLower:xz,CaseSensitive:yz,CaseUpper:vz,CassetteTape:_z,Cast:bz,Castle:wz,Cat:jz,Cctv:kz,ChartArea:Y_,ChartBar:Q_,ChartBarBig:X_,ChartBarDecreasing:Nz,ChartBarIncreasing:Sz,ChartBarStacked:Cz,ChartCandlestick:J_,ChartColumn:_c,ChartColumnBig:eb,ChartColumnDecreasing:Mz,ChartColumnIncreasing:tb,ChartColumnStacked:Tz,ChartGantt:Az,ChartLine:rb,ChartNetwork:Ez,ChartNoAxesColumn:sb,ChartNoAxesColumnDecreasing:Iz,ChartNoAxesColumnIncreasing:nb,ChartNoAxesCombined:Pz,ChartNoAxesGantt:ab,ChartPie:ib,ChartScatter:ob,ChartSpline:Lz,Check:fi,CheckCheck:Oz,ChefHat:Dz,Cherry:Rz,ChevronDown:Fd,ChevronFirst:Fz,ChevronLast:zz,ChevronLeft:kc,ChevronRight:Gi,ChevronUp:ly,ChevronsDown:$z,ChevronsDownUp:Bz,ChevronsLeft:Vz,ChevronsLeftRight:qz,ChevronsLeftRightEllipsis:Uz,ChevronsRight:Wz,ChevronsRightLeft:Hz,ChevronsUp:Gz,ChevronsUpDown:cy,Chrome:Kz,Church:Zz,Cigarette:Xz,CigaretteOff:Yz,Circle:eh,CircleAlert:yl,CircleArrowDown:lb,CircleArrowLeft:cb,CircleArrowOutDownLeft:db,CircleArrowOutDownRight:ub,CircleArrowOutUpLeft:hb,CircleArrowOutUpRight:mb,CircleArrowRight:fb,CircleArrowUp:pb,CircleCheck:no,CircleCheckBig:li,CircleChevronDown:gb,CircleChevronLeft:xb,CircleChevronRight:yb,CircleChevronUp:vb,CircleDashed:Qz,CircleDivide:_b,CircleDollarSign:Jz,CircleDot:t7,CircleDotDashed:e7,CircleEllipsis:r7,CircleEqual:n7,CircleFadingArrowUp:s7,CircleFadingPlus:a7,CircleGauge:bb,CircleHelp:Kx,CircleMinus:wb,CircleOff:i7,CircleParking:kb,CircleParkingOff:jb,CirclePause:Nb,CirclePercent:Sb,CirclePlay:nf,CirclePlus:Cb,CirclePower:Mb,CircleSlash:o7,CircleSlash2:Tb,CircleStop:Ab,CircleUser:Ib,CircleUserRound:Eb,CircleX:bc,CircuitBoard:l7,Citrus:c7,Clapperboard:d7,Clipboard:x7,ClipboardCheck:aA,ClipboardCopy:u7,ClipboardList:iA,ClipboardMinus:h7,ClipboardPaste:m7,ClipboardPen:Lb,ClipboardPenLine:Pb,ClipboardPlus:f7,ClipboardType:p7,ClipboardX:g7,Clock:Qa,Clock1:y7,Clock10:v7,Clock11:_7,Clock12:b7,Clock2:w7,Clock3:j7,Clock4:k7,Clock5:N7,Clock6:S7,Clock7:C7,Clock8:M7,Clock9:T7,ClockAlert:A7,ClockArrowDown:E7,ClockArrowUp:I7,Cloud:G7,CloudAlert:P7,CloudCog:L7,CloudDownload:Ob,CloudDrizzle:O7,CloudFog:D7,CloudHail:R7,CloudLightning:F7,CloudMoon:B7,CloudMoonRain:z7,CloudOff:$7,CloudRain:q7,CloudRainWind:U7,CloudSnow:V7,CloudSun:W7,CloudSunRain:H7,CloudUpload:Db,Cloudy:K7,Clover:ty,Club:Z7,Code:Ej,CodeXml:Rb,Codepen:Y7,Codesandbox:X7,Coffee:Ij,Cog:Q7,Coins:J7,Columns2:Fb,Columns3:zb,Columns4:e9,Combine:t9,Command:r9,Compass:n9,Component:s9,Computer:a9,ConciergeBell:i9,Cone:o9,Construction:l9,Contact:c9,ContactRound:Bb,Container:d9,Contrast:u9,Cookie:h9,CookingPot:m9,Copy:Oo,CopyCheck:f9,CopyMinus:p9,CopyPlus:g9,CopySlash:x9,CopyX:y9,Copyleft:v9,Copyright:_9,CornerDownLeft:b9,CornerDownRight:w9,CornerLeftDown:j9,CornerLeftUp:k9,CornerRightDown:N9,CornerRightUp:S9,CornerUpLeft:C9,CornerUpRight:M9,Cpu:T9,CreativeCommons:A9,CreditCard:hf,Croissant:E9,Crop:I9,Cross:P9,Crosshair:L9,Crown:q1,Cuboid:O9,CupSoda:D9,Currency:R9,Cylinder:F9,Dam:z9,Database:U9,DatabaseBackup:B9,DatabaseZap:$9,Delete:q9,Dessert:V9,Diameter:H9,Diamond:K9,DiamondMinus:W9,DiamondPercent:$b,DiamondPlus:G9,Dice1:Z9,Dice2:Y9,Dice3:X9,Dice4:Q9,Dice5:J9,Dice6:eB,Dices:tB,Diff:rB,Disc:iB,Disc2:nB,Disc3:sB,DiscAlbum:aB,Divide:oB,Dna:cB,DnaOff:lB,Dock:dB,Dog:uB,DollarSign:zd,Donut:hB,DoorClosed:mB,DoorOpen:Pj,Dot:fB,Download:so,DraftingCompass:pB,Drama:gB,Dribbble:xB,Drill:yB,Droplet:vB,Droplets:_B,Drum:bB,Drumstick:wB,Dumbbell:jB,Ear:NB,EarOff:kB,Earth:Ub,EarthLock:SB,Eclipse:CB,Egg:j4,EggFried:MB,EggOff:TB,Ellipsis:gp,EllipsisVertical:kg,Equal:IB,EqualApproximately:AB,EqualNot:EB,Eraser:PB,EthernetPort:LB,Euro:OB,Expand:DB,ExternalLink:Ms,Eye:_o,EyeClosed:RB,EyeOff:Fg,Facebook:au,Factory:FB,Fan:zB,FastForward:BB,Feather:$B,Fence:UB,FerrisWheel:qB,Figma:VB,File:F$,FileArchive:HB,FileAudio:GB,FileAudio2:WB,FileAxis3d:qb,FileBadge:ZB,FileBadge2:KB,FileBox:YB,FileChartColumn:Hb,FileChartColumnIncreasing:Vb,FileChartLine:Wb,FileChartPie:Gb,FileCheck:QB,FileCheck2:XB,FileClock:JB,FileCode:t$,FileCode2:e$,FileCog:Kb,FileDiff:r$,FileDigit:n$,FileDown:s$,FileHeart:a$,FileImage:V1,FileInput:i$,FileJson:l$,FileJson2:o$,FileKey:d$,FileKey2:c$,FileLock:h$,FileLock2:u$,FileMinus:f$,FileMinus2:m$,FileMusic:p$,FileOutput:g$,FilePen:Yb,FilePenLine:Zb,FilePlus:y$,FilePlus2:x$,FileQuestion:v$,FileScan:_$,FileSearch:w$,FileSearch2:b$,FileSliders:j$,FileSpreadsheet:H1,FileStack:k$,FileSymlink:N$,FileTerminal:S$,FileText:_a,FileType:M$,FileType2:C$,FileUp:T$,FileUser:A$,FileVideo:I$,FileVideo2:E$,FileVolume:L$,FileVolume2:P$,FileWarning:O$,FileX:R$,FileX2:D$,Files:z$,Film:Ad,Filter:W1,FilterX:B$,Fingerprint:$$,FireExtinguisher:U$,Fish:H$,FishOff:q$,FishSymbol:V$,Flag:dy,FlagOff:W$,FlagTriangleLeft:G$,FlagTriangleRight:K$,Flame:pm,FlameKindling:Z$,Flashlight:X$,FlashlightOff:Y$,FlaskConical:Lj,FlaskConicalOff:Q$,FlaskRound:J$,FlipHorizontal:tU,FlipHorizontal2:eU,FlipVertical:nU,FlipVertical2:rU,Flower:sU,Flower2:bp,Focus:aU,FoldHorizontal:iU,FoldVertical:oU,Folder:LU,FolderArchive:lU,FolderCheck:cU,FolderClock:dU,FolderClosed:uU,FolderCode:hU,FolderCog:Xb,FolderDot:mU,FolderDown:fU,FolderGit:gU,FolderGit2:pU,FolderHeart:xU,FolderInput:yU,FolderKanban:vU,FolderKey:_U,FolderLock:bU,FolderMinus:wU,FolderOpen:Ap,FolderOpenDot:jU,FolderOutput:kU,FolderPen:Qb,FolderPlus:NU,FolderRoot:SU,FolderSearch:MU,FolderSearch2:CU,FolderSymlink:TU,FolderSync:AU,FolderTree:EU,FolderUp:IU,FolderX:PU,Folders:OU,Footprints:DU,Forklift:RU,Forward:FU,Frame:zU,Framer:BU,Frown:$U,Fuel:UU,Fullscreen:qU,GalleryHorizontal:HU,GalleryHorizontalEnd:VU,GalleryThumbnails:WU,GalleryVertical:KU,GalleryVerticalEnd:GU,Gamepad:YU,Gamepad2:ZU,Gauge:XU,Gavel:QU,Gem:JU,Ghost:Oj,Gift:ao,GitBranch:tq,GitBranchPlus:eq,GitCommitHorizontal:Jb,GitCommitVertical:rq,GitCompare:sq,GitCompareArrows:nq,GitFork:aq,GitGraph:iq,GitMerge:oq,GitPullRequest:mq,GitPullRequestArrow:lq,GitPullRequestClosed:cq,GitPullRequestCreate:uq,GitPullRequestCreateArrow:dq,GitPullRequestDraft:hq,Github:fq,Gitlab:pq,GlassWater:gq,Glasses:xq,Globe:uy,GlobeLock:yq,Goal:vq,Grab:_q,GraduationCap:G1,Grape:bq,Grid2x2:t2,Grid2x2Check:wq,Grid2x2Plus:e2,Grid2x2X:jq,Grid3x3:rm,Grip:Nq,GripHorizontal:kq,GripVertical:zg,Group:Sq,Guitar:Cq,Ham:Mq,Hammer:Tq,Hand:Lq,HandCoins:Aq,HandHeart:Eq,HandHelping:r2,HandMetal:Iq,HandPlatter:Pq,Handshake:Oq,HardDrive:oA,HardDriveDownload:Dq,HardDriveUpload:Rq,HardHat:Fq,Hash:k4,Haze:zq,HdmiPort:Bq,Heading:Hq,Heading1:lA,Heading2:cA,Heading3:$q,Heading4:Uq,Heading5:qq,Heading6:Vq,HeadphoneOff:Wq,Headphones:Gq,Headset:Kq,Heart:bi,HeartCrack:Zq,HeartHandshake:Yq,HeartOff:Xq,HeartPulse:Qq,Heater:Jq,Hexagon:eV,Highlighter:tV,History:N4,Hop:nV,HopOff:rV,Hospital:sV,Hotel:aV,Hourglass:iV,House:ya,HousePlug:oV,HousePlus:lV,IceCreamBowl:n2,IceCreamCone:s2,IdCard:cV,Image:Fl,ImageDown:dV,ImageMinus:uV,ImageOff:hV,ImagePlay:mV,ImagePlus:Dj,ImageUp:fV,ImageUpscale:pV,Images:gV,Import:xV,Inbox:yV,IndentDecrease:a2,IndentIncrease:i2,IndianRupee:vV,Infinity:_V,Info:bV,InspectionPanel:wV,Instagram:_u,Italic:S4,IterationCcw:jV,IterationCw:kV,JapaneseYen:NV,Joystick:SV,Kanban:hy,Key:gm,KeyRound:Rj,KeySquare:CV,Keyboard:AV,KeyboardMusic:MV,KeyboardOff:TV,Lamp:DV,LampCeiling:EV,LampDesk:IV,LampFloor:PV,LampWallDown:LV,LampWallUp:OV,LandPlot:RV,Landmark:FV,Languages:zV,Laptop:$V,LaptopMinimal:o2,LaptopMinimalCheck:BV,Lasso:qV,LassoSelect:UV,Laugh:VV,Layers:GV,Layers2:HV,Layers3:WV,LayoutDashboard:Fj,LayoutGrid:mf,LayoutList:KV,LayoutPanelLeft:ZV,LayoutPanelTop:YV,LayoutTemplate:zj,Leaf:XV,LeafyGreen:QV,Lectern:JV,LetterText:eH,Library:C4,LibraryBig:tH,LifeBuoy:M4,Ligature:rH,Lightbulb:my,LightbulbOff:nH,Link:Ro,Link2:xm,Link2Off:sH,Linkedin:ym,List:ff,ListCheck:aH,ListChecks:iH,ListCollapse:oH,ListEnd:lH,ListFilter:cH,ListMinus:dH,ListMusic:uH,ListOrdered:T4,ListPlus:hH,ListRestart:mH,ListStart:fH,ListTodo:pH,ListTree:gH,ListVideo:xH,ListX:yH,Loader:_H,LoaderCircle:Wr,LoaderPinwheel:vH,Locate:dA,LocateFixed:bH,LocateOff:wH,Lock:th,LockKeyhole:jH,LockKeyholeOpen:l2,LockOpen:c2,LogIn:A4,LogOut:E4,Logs:kH,Lollipop:NH,Luggage:SH,Magnet:CH,Mail:ks,MailCheck:MH,MailMinus:TH,MailOpen:AH,MailPlus:EH,MailQuestion:IH,MailSearch:PH,MailWarning:LH,MailX:uA,Mailbox:OH,Mails:DH,Map:KH,MapPin:Fo,MapPinCheck:FH,MapPinCheckInside:RH,MapPinHouse:zH,MapPinMinus:$H,MapPinMinusInside:BH,MapPinOff:UH,MapPinPlus:VH,MapPinPlusInside:qH,MapPinX:WH,MapPinXInside:HH,MapPinned:GH,Martini:ZH,Maximize:XH,Maximize2:YH,Medal:fy,Megaphone:Ep,MegaphoneOff:QH,Meh:JH,MemoryStick:eW,Menu:hA,Merge:tW,MessageCircle:Ul,MessageCircleCode:rW,MessageCircleDashed:nW,MessageCircleHeart:I4,MessageCircleMore:sW,MessageCircleOff:aW,MessageCirclePlus:iW,MessageCircleQuestion:mA,MessageCircleReply:oW,MessageCircleWarning:lW,MessageCircleX:cW,MessageSquare:zo,MessageSquareCode:dW,MessageSquareDashed:uW,MessageSquareDiff:hW,MessageSquareDot:mW,MessageSquareHeart:fA,MessageSquareLock:fW,MessageSquareMore:pW,MessageSquareOff:gW,MessageSquarePlus:xW,MessageSquareQuote:pA,MessageSquareReply:yW,MessageSquareShare:vW,MessageSquareText:_W,MessageSquareWarning:bW,MessageSquareX:wW,MessagesSquare:jW,Mic:gA,MicOff:kW,MicVocal:d2,Microchip:NW,Microscope:SW,Microwave:CW,Milestone:MW,Milk:AW,MilkOff:TW,Minimize:IW,Minimize2:EW,Minus:K1,Monitor:Bj,MonitorCheck:PW,MonitorCog:LW,MonitorDot:OW,MonitorDown:DW,MonitorOff:RW,MonitorPause:FW,MonitorPlay:zW,MonitorSmartphone:BW,MonitorSpeaker:$W,MonitorStop:UW,MonitorUp:qW,MonitorX:VW,Moon:WW,MoonStar:HW,Mountain:KW,MountainSnow:GW,Mouse:JW,MouseOff:ZW,MousePointer:QW,MousePointer2:YW,MousePointerBan:XW,MousePointerClick:Z1,Move:hG,Move3d:u2,MoveDiagonal:tG,MoveDiagonal2:eG,MoveDown:sG,MoveDownLeft:rG,MoveDownRight:nG,MoveHorizontal:aG,MoveLeft:iG,MoveRight:oG,MoveUp:dG,MoveUpLeft:lG,MoveUpRight:cG,MoveVertical:uG,Music:gG,Music2:mG,Music3:fG,Music4:pG,Navigation:xA,Navigation2:yG,Navigation2Off:xG,NavigationOff:vG,Network:_G,Newspaper:py,Nfc:bG,Notebook:NG,NotebookPen:wG,NotebookTabs:jG,NotebookText:kG,NotepadText:CG,NotepadTextDashed:SG,Nut:TG,NutOff:MG,Octagon:EG,OctagonAlert:h2,OctagonMinus:AG,OctagonPause:m2,OctagonX:f2,Omega:IG,Option:PG,Orbit:LG,Origami:OG,Package:ql,Package2:DG,PackageCheck:RG,PackageMinus:FG,PackageOpen:zG,PackagePlus:BG,PackageSearch:$G,PackageX:UG,PaintBucket:qG,PaintRoller:VG,Paintbrush:HG,PaintbrushVertical:p2,Palette:Vc,PanelBottom:KG,PanelBottomClose:WG,PanelBottomDashed:g2,PanelBottomOpen:GG,PanelLeft:_2,PanelLeftClose:x2,PanelLeftDashed:y2,PanelLeftOpen:v2,PanelRight:XG,PanelRightClose:ZG,PanelRightDashed:b2,PanelRightOpen:YG,PanelTop:eK,PanelTopClose:QG,PanelTopDashed:w2,PanelTopOpen:JG,PanelsLeftBottom:tK,PanelsRightBottom:rK,PanelsTopLeft:K0,Paperclip:P4,Parentheses:nK,ParkingMeter:sK,PartyPopper:Hc,Pause:vm,PawPrint:aK,PcCase:iK,Pen:Y0,PenLine:Z0,PenOff:oK,PenTool:$j,Pencil:Ja,PencilLine:lK,PencilOff:cK,PencilRuler:dK,Pentagon:uK,Percent:L4,PersonStanding:hK,PhilippinePeso:mK,Phone:Ii,PhoneCall:fK,PhoneForwarded:pK,PhoneIncoming:gK,PhoneMissed:xK,PhoneOff:yK,PhoneOutgoing:vK,Pi:_K,Piano:bK,Pickaxe:wK,PictureInPicture:kK,PictureInPicture2:jK,PiggyBank:NK,Pilcrow:MK,PilcrowLeft:SK,PilcrowRight:CK,Pill:AK,PillBottle:TK,Pin:Y1,PinOff:yA,Pipette:EK,Pizza:IK,Plane:OK,PlaneLanding:PK,PlaneTakeoff:LK,Play:Vl,Plug:vA,Plug2:DK,PlugZap:j2,Plus:bn,Pocket:FK,PocketKnife:RK,Podcast:zK,Pointer:$K,PointerOff:BK,Popcorn:UK,Popsicle:qK,PoundSterling:VK,Power:WK,PowerOff:HK,Presentation:gy,Printer:KK,PrinterCheck:GK,Projector:ZK,Proportions:YK,Puzzle:XK,Pyramid:QK,QrCode:_A,Quote:bA,Rabbit:JK,Radar:eZ,Radiation:tZ,Radical:rZ,Radio:Uj,RadioReceiver:nZ,RadioTower:sZ,Radius:aZ,RailSymbol:iZ,Rainbow:oZ,Rat:lZ,Ratio:cZ,Receipt:yZ,ReceiptCent:dZ,ReceiptEuro:uZ,ReceiptIndianRupee:hZ,ReceiptJapaneseYen:mZ,ReceiptPoundSterling:fZ,ReceiptRussianRuble:pZ,ReceiptSwissFranc:gZ,ReceiptText:xZ,RectangleEllipsis:k2,RectangleHorizontal:vZ,RectangleVertical:_Z,Recycle:bZ,Redo:O4,Redo2:wZ,RedoDot:jZ,RefreshCcw:NZ,RefreshCcwDot:kZ,RefreshCw:Wo,RefreshCwOff:SZ,Refrigerator:CZ,Regex:MZ,RemoveFormatting:TZ,Repeat:wA,Repeat1:AZ,Repeat2:EZ,Replace:PZ,ReplaceAll:IZ,Reply:jA,ReplyAll:LZ,Rewind:OZ,Ribbon:DZ,Rocket:Bg,RockingChair:RZ,RollerCoaster:FZ,Rotate3d:N2,RotateCcw:D4,RotateCcwSquare:zZ,RotateCw:kA,RotateCwSquare:BZ,Route:UZ,RouteOff:$Z,Router:qZ,Rows2:S2,Rows3:C2,Rows4:VZ,Rss:HZ,Ruler:WZ,RussianRuble:GZ,Sailboat:KZ,Salad:ZZ,Sandwich:YZ,Satellite:QZ,SatelliteDish:XZ,Save:Ip,SaveAll:JZ,SaveOff:eY,Scale:tY,Scale3d:M2,Scaling:rY,Scan:dY,ScanBarcode:nY,ScanEye:sY,ScanFace:aY,ScanLine:iY,ScanQrCode:oY,ScanSearch:lY,ScanText:cY,School:uY,Scissors:mY,ScissorsLineDashed:hY,ScreenShare:pY,ScreenShareOff:fY,Scroll:xY,ScrollText:gY,Search:ma,SearchCheck:yY,SearchCode:vY,SearchSlash:_Y,SearchX:bY,Section:wY,Send:Ji,SendHorizontal:T2,SendToBack:jY,SeparatorHorizontal:kY,SeparatorVertical:NY,Server:TY,ServerCog:SY,ServerCrash:CY,ServerOff:MY,Settings:Bd,Settings2:AY,Shapes:EY,Share:NA,Share2:Nc,Sheet:IY,Shell:PY,Shield:_m,ShieldAlert:LY,ShieldBan:OY,ShieldCheck:SA,ShieldEllipsis:DY,ShieldHalf:RY,ShieldMinus:FY,ShieldOff:zY,ShieldPlus:BY,ShieldQuestion:$Y,ShieldX:A2,Ship:qY,ShipWheel:UY,Shirt:VY,ShoppingBag:$g,ShoppingBasket:HY,ShoppingCart:Eh,Shovel:WY,ShowerHead:GY,Shrink:KY,Shrub:ZY,Shuffle:YY,Sigma:XY,Signal:rX,SignalHigh:QY,SignalLow:JY,SignalMedium:eX,SignalZero:tX,Signature:nX,Signpost:aX,SignpostBig:sX,Siren:iX,SkipBack:oX,SkipForward:lX,Skull:cX,Slack:dX,Slash:uX,Slice:hX,SlidersHorizontal:CA,SlidersVertical:E2,Smartphone:xy,SmartphoneCharging:mX,SmartphoneNfc:fX,Smile:gX,SmilePlus:pX,Snail:xX,Snowflake:S1,Sofa:yX,Soup:vX,Space:_X,Spade:bX,Sparkle:wX,Sparkles:Ds,Speaker:jX,Speech:kX,SpellCheck:SX,SpellCheck2:NX,Spline:CX,Split:MX,SprayCan:TX,Sprout:AX,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:X0,SquareChevronDown:K2,SquareChevronLeft:Z2,SquareChevronRight:Y2,SquareChevronUp:X2,SquareCode:Q2,SquareDashed:tw,SquareDashedBottom:IX,SquareDashedBottomCode:EX,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:PX,SquareScissors:_w,SquareSigma:bw,SquareSlash:ww,SquareSplitHorizontal:jw,SquareSplitVertical:kw,SquareSquare:LX,SquareStack:OX,SquareTerminal:Nw,SquareUser:Cw,SquareUserRound:Sw,SquareX:Mw,Squircle:DX,Squirrel:RX,Stamp:FX,Star:Ss,StarHalf:zX,StarOff:BX,StepBack:$X,StepForward:UX,Stethoscope:qX,Sticker:VX,StickyNote:HX,Store:WX,StretchHorizontal:GX,StretchVertical:KX,Strikethrough:ZX,Subscript:YX,Sun:X1,SunDim:XX,SunMedium:QX,SunMoon:JX,SunSnow:eQ,Sunrise:tQ,Sunset:rQ,Superscript:nQ,SwatchBook:sQ,SwissFranc:aQ,SwitchCamera:iQ,Sword:oQ,Swords:lQ,Syringe:cQ,Table:gQ,Table2:R4,TableCellsMerge:dQ,TableCellsSplit:uQ,TableColumnsSplit:hQ,TableOfContents:mQ,TableProperties:fQ,TableRowsSplit:pQ,Tablet:yQ,TabletSmartphone:xQ,Tablets:vQ,Tag:qg,Tags:_Q,Tally1:bQ,Tally2:wQ,Tally3:jQ,Tally4:kQ,Tally5:NQ,Tangent:SQ,Target:yy,Telescope:CQ,Tent:TQ,TentTree:MQ,Terminal:AQ,TestTube:EQ,TestTubeDiagonal:Tw,TestTubes:IQ,Text:RQ,TextCursor:LQ,TextCursorInput:PQ,TextQuote:OQ,TextSearch:DQ,TextSelect:Aw,Theater:FQ,Thermometer:$Q,ThermometerSnowflake:zQ,ThermometerSun:BQ,ThumbsDown:MA,ThumbsUp:pd,Ticket:TA,TicketCheck:UQ,TicketMinus:qQ,TicketPercent:VQ,TicketPlus:HQ,TicketSlash:WQ,TicketX:GQ,Tickets:ZQ,TicketsPlane:KQ,Timer:QQ,TimerOff:YQ,TimerReset:XQ,ToggleLeft:JQ,ToggleRight:eJ,Toilet:tJ,Tornado:rJ,Torus:nJ,Touchpad:aJ,TouchpadOff:sJ,TowerControl:iJ,ToyBrick:oJ,Tractor:lJ,TrafficCone:cJ,TrainFront:uJ,TrainFrontTunnel:dJ,TrainTrack:hJ,TramFront:Ew,Trash:mJ,Trash2:Un,TreeDeciduous:fJ,TreePalm:Iw,TreePine:Q1,Trees:pJ,Trello:gJ,TrendingDown:qj,TrendingUp:rh,TrendingUpDown:xJ,Triangle:vJ,TriangleAlert:Gu,TriangleRight:yJ,Trophy:io,Truck:AA,Turtle:_J,Tv:wJ,TvMinimal:Pw,TvMinimalPlay:bJ,Twitch:jJ,Twitter:kJ,Type:SJ,TypeOutline:NJ,Umbrella:MJ,UmbrellaOff:CJ,Underline:TJ,Undo:F4,Undo2:AJ,UndoDot:EJ,UnfoldHorizontal:IJ,UnfoldVertical:PJ,Ungroup:LJ,University:Lw,Unlink:EA,Unlink2:OJ,Unplug:DJ,Upload:bo,Usb:RJ,User:ic,UserCheck:Vj,UserCog:IA,UserMinus:FJ,UserPen:zJ,UserPlus:nh,UserRound:Bw,UserRoundCheck:Ow,UserRoundCog:Dw,UserRoundMinus:Rw,UserRoundPen:BJ,UserRoundPlus:Fw,UserRoundSearch:$J,UserRoundX:zw,UserSearch:UJ,UserX:qJ,Users:qn,UsersRound:$w,Utensils:qw,UtensilsCrossed:Uw,UtilityPole:VJ,Variable:PA,Vault:HJ,Vegan:WJ,VenetianMask:GJ,Vibrate:ZJ,VibrateOff:KJ,Video:Pa,VideoOff:YJ,Videotape:XJ,View:QJ,Voicemail:JJ,Volleyball:eee,Volume:aee,Volume1:tee,Volume2:ree,VolumeOff:nee,VolumeX:see,Vote:iee,Wallet:lee,WalletCards:oee,WalletMinimal:Vw,Wallpaper:cee,Wand:dee,WandSparkles:Hw,Warehouse:uee,WashingMachine:hee,Watch:mee,Waves:fee,Waypoints:pee,Webcam:gee,Webhook:yee,WebhookOff:xee,Weight:vee,Wheat:bee,WheatOff:_ee,WholeWord:wee,Wifi:Cee,WifiHigh:jee,WifiLow:kee,WifiOff:Nee,WifiZero:See,Wind:Tee,WindArrowDown:Mee,Wine:Eee,WineOff:Aee,Workflow:Iee,Worm:Pee,WrapText:Lee,Wrench:vy,X:us,Youtube:Oee,Zap:Vg,ZapOff:Dee,ZoomIn:z4,ZoomOut:B4},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 AIe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:lD,AArrowDownIcon:lD,AArrowUp:cD,AArrowUpIcon:cD,ALargeSmall:dD,ALargeSmallIcon:dD,Accessibility:uD,AccessibilityIcon:uD,Activity:Lg,ActivityIcon:Lg,ActivitySquare:I2,ActivitySquareIcon:I2,AirVent:hD,AirVentIcon:hD,Airplay:mD,AirplayIcon:mD,AlarmCheck:L_,AlarmCheckIcon:L_,AlarmClock:pD,AlarmClockCheck:L_,AlarmClockCheckIcon:L_,AlarmClockIcon:pD,AlarmClockMinus:O_,AlarmClockMinusIcon:O_,AlarmClockOff:fD,AlarmClockOffIcon:fD,AlarmClockPlus:D_,AlarmClockPlusIcon:D_,AlarmMinus:O_,AlarmMinusIcon:O_,AlarmPlus:D_,AlarmPlusIcon:D_,AlarmSmoke:gD,AlarmSmokeIcon:gD,Album:xD,AlbumIcon:xD,AlertCircle:yl,AlertCircleIcon:yl,AlertOctagon:h2,AlertOctagonIcon:h2,AlertTriangle:Gu,AlertTriangleIcon:Gu,AlignCenter:y4,AlignCenterHorizontal:yD,AlignCenterHorizontalIcon:yD,AlignCenterIcon:y4,AlignCenterVertical:vD,AlignCenterVerticalIcon:vD,AlignEndHorizontal:_D,AlignEndHorizontalIcon:_D,AlignEndVertical:bD,AlignEndVerticalIcon:bD,AlignHorizontalDistributeCenter:wD,AlignHorizontalDistributeCenterIcon:wD,AlignHorizontalDistributeEnd:jD,AlignHorizontalDistributeEndIcon:jD,AlignHorizontalDistributeStart:kD,AlignHorizontalDistributeStartIcon:kD,AlignHorizontalJustifyCenter:ND,AlignHorizontalJustifyCenterIcon:ND,AlignHorizontalJustifyEnd:SD,AlignHorizontalJustifyEndIcon:SD,AlignHorizontalJustifyStart:CD,AlignHorizontalJustifyStartIcon:CD,AlignHorizontalSpaceAround:MD,AlignHorizontalSpaceAroundIcon:MD,AlignHorizontalSpaceBetween:TD,AlignHorizontalSpaceBetweenIcon:TD,AlignJustify:AD,AlignJustifyIcon:AD,AlignLeft:v4,AlignLeftIcon:v4,AlignRight:_4,AlignRightIcon:_4,AlignStartHorizontal:ED,AlignStartHorizontalIcon:ED,AlignStartVertical:ID,AlignStartVerticalIcon:ID,AlignVerticalDistributeCenter:PD,AlignVerticalDistributeCenterIcon:PD,AlignVerticalDistributeEnd:LD,AlignVerticalDistributeEndIcon:LD,AlignVerticalDistributeStart:OD,AlignVerticalDistributeStartIcon:OD,AlignVerticalJustifyCenter:DD,AlignVerticalJustifyCenterIcon:DD,AlignVerticalJustifyEnd:RD,AlignVerticalJustifyEndIcon:RD,AlignVerticalJustifyStart:FD,AlignVerticalJustifyStartIcon:FD,AlignVerticalSpaceAround:zD,AlignVerticalSpaceAroundIcon:zD,AlignVerticalSpaceBetween:BD,AlignVerticalSpaceBetweenIcon:BD,Ambulance:$D,AmbulanceIcon:$D,Ampersand:UD,AmpersandIcon:UD,Ampersands:qD,AmpersandsIcon:qD,Amphora:VD,AmphoraIcon:VD,Anchor:HD,AnchorIcon:HD,Angry:WD,AngryIcon:WD,Annoyed:GD,AnnoyedIcon:GD,Antenna:KD,AntennaIcon:KD,Anvil:ZD,AnvilIcon:ZD,Aperture:YD,ApertureIcon:YD,AppWindow:JT,AppWindowIcon:JT,AppWindowMac:XD,AppWindowMacIcon:XD,Apple:QD,AppleIcon:QD,Archive:eA,ArchiveIcon:eA,ArchiveRestore:JD,ArchiveRestoreIcon:JD,ArchiveX:e8,ArchiveXIcon:e8,AreaChart:Y_,AreaChartIcon:Y_,Armchair:t8,ArmchairIcon:t8,ArrowBigDown:n8,ArrowBigDownDash:r8,ArrowBigDownDashIcon:r8,ArrowBigDownIcon:n8,ArrowBigLeft:a8,ArrowBigLeftDash:s8,ArrowBigLeftDashIcon:s8,ArrowBigLeftIcon:a8,ArrowBigRight:o8,ArrowBigRightDash:i8,ArrowBigRightDashIcon:i8,ArrowBigRightIcon:o8,ArrowBigUp:c8,ArrowBigUpDash:l8,ArrowBigUpDashIcon:l8,ArrowBigUpIcon:c8,ArrowDown:oy,ArrowDown01:d8,ArrowDown01Icon:d8,ArrowDown10:u8,ArrowDown10Icon:u8,ArrowDownAZ:R_,ArrowDownAZIcon:R_,ArrowDownAz:R_,ArrowDownAzIcon:R_,ArrowDownCircle:lb,ArrowDownCircleIcon:lb,ArrowDownFromLine:h8,ArrowDownFromLineIcon:h8,ArrowDownIcon:oy,ArrowDownLeft:m8,ArrowDownLeftFromCircle:db,ArrowDownLeftFromCircleIcon:db,ArrowDownLeftFromSquare:R2,ArrowDownLeftFromSquareIcon:R2,ArrowDownLeftIcon:m8,ArrowDownLeftSquare:P2,ArrowDownLeftSquareIcon:P2,ArrowDownNarrowWide:f8,ArrowDownNarrowWideIcon:f8,ArrowDownRight:p8,ArrowDownRightFromCircle:ub,ArrowDownRightFromCircleIcon:ub,ArrowDownRightFromSquare:F2,ArrowDownRightFromSquareIcon:F2,ArrowDownRightIcon:p8,ArrowDownRightSquare:L2,ArrowDownRightSquareIcon:L2,ArrowDownSquare:O2,ArrowDownSquareIcon:O2,ArrowDownToDot:g8,ArrowDownToDotIcon:g8,ArrowDownToLine:x8,ArrowDownToLineIcon:x8,ArrowDownUp:y8,ArrowDownUpIcon:y8,ArrowDownWideNarrow:F_,ArrowDownWideNarrowIcon:F_,ArrowDownZA:z_,ArrowDownZAIcon:z_,ArrowDownZa:z_,ArrowDownZaIcon:z_,ArrowLeft:Wi,ArrowLeftCircle:cb,ArrowLeftCircleIcon:cb,ArrowLeftFromLine:v8,ArrowLeftFromLineIcon:v8,ArrowLeftIcon:Wi,ArrowLeftRight:_8,ArrowLeftRightIcon:_8,ArrowLeftSquare:D2,ArrowLeftSquareIcon:D2,ArrowLeftToLine:b8,ArrowLeftToLineIcon:b8,ArrowRight:No,ArrowRightCircle:fb,ArrowRightCircleIcon:fb,ArrowRightFromLine:w8,ArrowRightFromLineIcon:w8,ArrowRightIcon:No,ArrowRightLeft:j8,ArrowRightLeftIcon:j8,ArrowRightSquare:$2,ArrowRightSquareIcon:$2,ArrowRightToLine:k8,ArrowRightToLineIcon:k8,ArrowUp:uf,ArrowUp01:N8,ArrowUp01Icon:N8,ArrowUp10:S8,ArrowUp10Icon:S8,ArrowUpAZ:B_,ArrowUpAZIcon:B_,ArrowUpAz:B_,ArrowUpAzIcon:B_,ArrowUpCircle:pb,ArrowUpCircleIcon:pb,ArrowUpDown:Og,ArrowUpDownIcon:Og,ArrowUpFromDot:C8,ArrowUpFromDotIcon:C8,ArrowUpFromLine:M8,ArrowUpFromLineIcon:M8,ArrowUpIcon:uf,ArrowUpLeft:T8,ArrowUpLeftFromCircle:hb,ArrowUpLeftFromCircleIcon:hb,ArrowUpLeftFromSquare:z2,ArrowUpLeftFromSquareIcon:z2,ArrowUpLeftIcon:T8,ArrowUpLeftSquare:U2,ArrowUpLeftSquareIcon:U2,ArrowUpNarrowWide:$_,ArrowUpNarrowWideIcon:$_,ArrowUpRight:A8,ArrowUpRightFromCircle:mb,ArrowUpRightFromCircleIcon:mb,ArrowUpRightFromSquare:B2,ArrowUpRightFromSquareIcon:B2,ArrowUpRightIcon:A8,ArrowUpRightSquare:q2,ArrowUpRightSquareIcon:q2,ArrowUpSquare:V2,ArrowUpSquareIcon:V2,ArrowUpToLine:E8,ArrowUpToLineIcon:E8,ArrowUpWideNarrow:I8,ArrowUpWideNarrowIcon:I8,ArrowUpZA:U_,ArrowUpZAIcon:U_,ArrowUpZa:U_,ArrowUpZaIcon:U_,ArrowsUpFromLine:P8,ArrowsUpFromLineIcon:P8,Asterisk:L8,AsteriskIcon:L8,AsteriskSquare:H2,AsteriskSquareIcon:H2,AtSign:O8,AtSignIcon:O8,Atom:D8,AtomIcon:D8,AudioLines:R8,AudioLinesIcon:R8,AudioWaveform:F8,AudioWaveformIcon:F8,Award:Bl,AwardIcon:Bl,Axe:z8,AxeIcon:z8,Axis3D:q_,Axis3DIcon:q_,Axis3d:q_,Axis3dIcon:q_,Baby:B8,BabyIcon:B8,Backpack:$8,BackpackIcon:$8,Badge:nR,BadgeAlert:U8,BadgeAlertIcon:U8,BadgeCent:q8,BadgeCentIcon:q8,BadgeCheck:V_,BadgeCheckIcon:V_,BadgeDollarSign:V8,BadgeDollarSignIcon:V8,BadgeEuro:H8,BadgeEuroIcon:H8,BadgeHelp:W8,BadgeHelpIcon:W8,BadgeIcon:nR,BadgeIndianRupee:G8,BadgeIndianRupeeIcon:G8,BadgeInfo:K8,BadgeInfoIcon:K8,BadgeJapaneseYen:Z8,BadgeJapaneseYenIcon:Z8,BadgeMinus:Y8,BadgeMinusIcon:Y8,BadgePercent:X8,BadgePercentIcon:X8,BadgePlus:Q8,BadgePlusIcon:Q8,BadgePoundSterling:J8,BadgePoundSterlingIcon:J8,BadgeRussianRuble:eR,BadgeRussianRubleIcon:eR,BadgeSwissFranc:tR,BadgeSwissFrancIcon:tR,BadgeX:rR,BadgeXIcon:rR,BaggageClaim:sR,BaggageClaimIcon:sR,Ban:aR,BanIcon:aR,Banana:iR,BananaIcon:iR,Bandage:oR,BandageIcon:oR,Banknote:lR,BanknoteIcon:lR,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:cR,BarcodeIcon:cR,Baseline:dR,BaselineIcon:dR,Bath:$1,BathIcon:$1,Battery:gR,BatteryCharging:uR,BatteryChargingIcon:uR,BatteryFull:hR,BatteryFullIcon:hR,BatteryIcon:gR,BatteryLow:mR,BatteryLowIcon:mR,BatteryMedium:fR,BatteryMediumIcon:fR,BatteryWarning:pR,BatteryWarningIcon:pR,Beaker:xR,BeakerIcon:xR,Bean:vR,BeanIcon:vR,BeanOff:yR,BeanOffIcon:yR,Bed:U1,BedDouble:_R,BedDoubleIcon:_R,BedIcon:U1,BedSingle:bR,BedSingleIcon:bR,Beef:wR,BeefIcon:wR,Beer:kR,BeerIcon:kR,BeerOff:jR,BeerOffIcon:jR,Bell:Dg,BellDot:NR,BellDotIcon:NR,BellElectric:SR,BellElectricIcon:SR,BellIcon:Dg,BellMinus:CR,BellMinusIcon:CR,BellOff:Mj,BellOffIcon:Mj,BellPlus:MR,BellPlusIcon:MR,BellRing:TR,BellRingIcon:TR,BetweenHorizonalEnd:H_,BetweenHorizonalEndIcon:H_,BetweenHorizonalStart:W_,BetweenHorizonalStartIcon:W_,BetweenHorizontalEnd:H_,BetweenHorizontalEndIcon:H_,BetweenHorizontalStart:W_,BetweenHorizontalStartIcon:W_,BetweenVerticalEnd:AR,BetweenVerticalEndIcon:AR,BetweenVerticalStart:ER,BetweenVerticalStartIcon:ER,BicepsFlexed:IR,BicepsFlexedIcon:IR,Bike:PR,BikeIcon:PR,Binary:LR,BinaryIcon:LR,Binoculars:OR,BinocularsIcon:OR,Biohazard:DR,BiohazardIcon:DR,Bird:RR,BirdIcon:RR,Bitcoin:FR,BitcoinIcon:FR,Blend:zR,BlendIcon:zR,Blinds:BR,BlindsIcon:BR,Blocks:$R,BlocksIcon:$R,Bluetooth:HR,BluetoothConnected:UR,BluetoothConnectedIcon:UR,BluetoothIcon:HR,BluetoothOff:qR,BluetoothOffIcon:qR,BluetoothSearching:VR,BluetoothSearchingIcon:VR,Bold:b4,BoldIcon:b4,Bolt:WR,BoltIcon:WR,Bomb:GR,BombIcon:GR,Bone:KR,BoneIcon:KR,Book:gF,BookA:ZR,BookAIcon:ZR,BookAudio:YR,BookAudioIcon:YR,BookCheck:XR,BookCheckIcon:XR,BookCopy:QR,BookCopyIcon:QR,BookDashed:G_,BookDashedIcon:G_,BookDown:JR,BookDownIcon:JR,BookHeadphones:eF,BookHeadphonesIcon:eF,BookHeart:tF,BookHeartIcon:tF,BookIcon:gF,BookImage:rF,BookImageIcon:rF,BookKey:nF,BookKeyIcon:nF,BookLock:sF,BookLockIcon:sF,BookMarked:aF,BookMarkedIcon:aF,BookMinus:iF,BookMinusIcon:iF,BookOpen:tA,BookOpenCheck:oF,BookOpenCheckIcon:oF,BookOpenIcon:tA,BookOpenText:lF,BookOpenTextIcon:lF,BookPlus:cF,BookPlusIcon:cF,BookTemplate:G_,BookTemplateIcon:G_,BookText:dF,BookTextIcon:dF,BookType:uF,BookTypeIcon:uF,BookUp:mF,BookUp2:hF,BookUp2Icon:hF,BookUpIcon:mF,BookUser:fF,BookUserIcon:fF,BookX:pF,BookXIcon:pF,Bookmark:Mp,BookmarkCheck:xF,BookmarkCheckIcon:xF,BookmarkIcon:Mp,BookmarkMinus:yF,BookmarkMinusIcon:yF,BookmarkPlus:rA,BookmarkPlusIcon:rA,BookmarkX:vF,BookmarkXIcon:vF,BoomBox:_F,BoomBoxIcon:_F,Bot:w4,BotIcon:w4,BotMessageSquare:bF,BotMessageSquareIcon:bF,BotOff:wF,BotOffIcon:wF,Box:jF,BoxIcon:jF,BoxSelect:tw,BoxSelectIcon:tw,Boxes:kF,BoxesIcon:kF,Braces:K_,BracesIcon:K_,Brackets:NF,BracketsIcon:NF,Brain:nA,BrainCircuit:SF,BrainCircuitIcon:SF,BrainCog:CF,BrainCogIcon:CF,BrainIcon:nA,BrickWall:MF,BrickWallIcon:MF,Briefcase:Dh,BriefcaseBusiness:TF,BriefcaseBusinessIcon:TF,BriefcaseConveyorBelt:AF,BriefcaseConveyorBeltIcon:AF,BriefcaseIcon:Dh,BriefcaseMedical:EF,BriefcaseMedicalIcon:EF,BringToFront:IF,BringToFrontIcon:IF,Brush:PF,BrushIcon:PF,Bug:DF,BugIcon:DF,BugOff:LF,BugOffIcon:LF,BugPlay:OF,BugPlayIcon:OF,Building:Tj,Building2:mi,Building2Icon:mi,BuildingIcon:Tj,Bus:FF,BusFront:RF,BusFrontIcon:RF,BusIcon:FF,Cable:BF,CableCar:zF,CableCarIcon:zF,CableIcon:BF,Cake:fm,CakeIcon:fm,CakeSlice:$F,CakeSliceIcon:$F,Calculator:UF,CalculatorIcon:UF,Calendar:Ts,Calendar1:qF,Calendar1Icon:qF,CalendarArrowDown:VF,CalendarArrowDownIcon:VF,CalendarArrowUp:HF,CalendarArrowUpIcon:HF,CalendarCheck:GF,CalendarCheck2:WF,CalendarCheck2Icon:WF,CalendarCheckIcon:GF,CalendarClock:sA,CalendarClockIcon:sA,CalendarCog:KF,CalendarCogIcon:KF,CalendarDays:Tp,CalendarDaysIcon:Tp,CalendarFold:ZF,CalendarFoldIcon:ZF,CalendarHeart:YF,CalendarHeartIcon:YF,CalendarIcon:Ts,CalendarMinus:QF,CalendarMinus2:XF,CalendarMinus2Icon:XF,CalendarMinusIcon:QF,CalendarOff:JF,CalendarOffIcon:JF,CalendarPlus:Aj,CalendarPlus2:ez,CalendarPlus2Icon:ez,CalendarPlusIcon:Aj,CalendarRange:tz,CalendarRangeIcon:tz,CalendarSearch:rz,CalendarSearchIcon:rz,CalendarSync:nz,CalendarSyncIcon:nz,CalendarX:az,CalendarX2:sz,CalendarX2Icon:sz,CalendarXIcon:az,Camera:Rg,CameraIcon:Rg,CameraOff:iz,CameraOffIcon:iz,CandlestickChart:J_,CandlestickChartIcon:J_,Candy:cz,CandyCane:oz,CandyCaneIcon:oz,CandyIcon:cz,CandyOff:lz,CandyOffIcon:lz,Cannabis:dz,CannabisIcon:dz,Captions:Z_,CaptionsIcon:Z_,CaptionsOff:uz,CaptionsOffIcon:uz,Car:fz,CarFront:hz,CarFrontIcon:hz,CarIcon:fz,CarTaxiFront:mz,CarTaxiFrontIcon:mz,Caravan:pz,CaravanIcon:pz,Carrot:gz,CarrotIcon:gz,CaseLower:xz,CaseLowerIcon:xz,CaseSensitive:yz,CaseSensitiveIcon:yz,CaseUpper:vz,CaseUpperIcon:vz,CassetteTape:_z,CassetteTapeIcon:_z,Cast:bz,CastIcon:bz,Castle:wz,CastleIcon:wz,Cat:jz,CatIcon:jz,Cctv:kz,CctvIcon:kz,ChartArea:Y_,ChartAreaIcon:Y_,ChartBar:Q_,ChartBarBig:X_,ChartBarBigIcon:X_,ChartBarDecreasing:Nz,ChartBarDecreasingIcon:Nz,ChartBarIcon:Q_,ChartBarIncreasing:Sz,ChartBarIncreasingIcon:Sz,ChartBarStacked:Cz,ChartBarStackedIcon:Cz,ChartCandlestick:J_,ChartCandlestickIcon:J_,ChartColumn:_c,ChartColumnBig:eb,ChartColumnBigIcon:eb,ChartColumnDecreasing:Mz,ChartColumnDecreasingIcon:Mz,ChartColumnIcon:_c,ChartColumnIncreasing:tb,ChartColumnIncreasingIcon:tb,ChartColumnStacked:Tz,ChartColumnStackedIcon:Tz,ChartGantt:Az,ChartGanttIcon:Az,ChartLine:rb,ChartLineIcon:rb,ChartNetwork:Ez,ChartNetworkIcon:Ez,ChartNoAxesColumn:sb,ChartNoAxesColumnDecreasing:Iz,ChartNoAxesColumnDecreasingIcon:Iz,ChartNoAxesColumnIcon:sb,ChartNoAxesColumnIncreasing:nb,ChartNoAxesColumnIncreasingIcon:nb,ChartNoAxesCombined:Pz,ChartNoAxesCombinedIcon:Pz,ChartNoAxesGantt:ab,ChartNoAxesGanttIcon:ab,ChartPie:ib,ChartPieIcon:ib,ChartScatter:ob,ChartScatterIcon:ob,ChartSpline:Lz,ChartSplineIcon:Lz,Check:fi,CheckCheck:Oz,CheckCheckIcon:Oz,CheckCircle:li,CheckCircle2:no,CheckCircle2Icon:no,CheckCircleIcon:li,CheckIcon:fi,CheckSquare:X0,CheckSquare2:G2,CheckSquare2Icon:G2,CheckSquareIcon:X0,ChefHat:Dz,ChefHatIcon:Dz,Cherry:Rz,CherryIcon:Rz,ChevronDown:Fd,ChevronDownCircle:gb,ChevronDownCircleIcon:gb,ChevronDownIcon:Fd,ChevronDownSquare:K2,ChevronDownSquareIcon:K2,ChevronFirst:Fz,ChevronFirstIcon:Fz,ChevronLast:zz,ChevronLastIcon:zz,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:$z,ChevronsDownIcon:$z,ChevronsDownUp:Bz,ChevronsDownUpIcon:Bz,ChevronsLeft:Vz,ChevronsLeftIcon:Vz,ChevronsLeftRight:qz,ChevronsLeftRightEllipsis:Uz,ChevronsLeftRightEllipsisIcon:Uz,ChevronsLeftRightIcon:qz,ChevronsRight:Wz,ChevronsRightIcon:Wz,ChevronsRightLeft:Hz,ChevronsRightLeftIcon:Hz,ChevronsUp:Gz,ChevronsUpDown:cy,ChevronsUpDownIcon:cy,ChevronsUpIcon:Gz,Chrome:Kz,ChromeIcon:Kz,Church:Zz,ChurchIcon:Zz,Cigarette:Xz,CigaretteIcon:Xz,CigaretteOff:Yz,CigaretteOffIcon:Yz,Circle:eh,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:li,CircleCheckBigIcon:li,CircleCheckIcon:no,CircleChevronDown:gb,CircleChevronDownIcon:gb,CircleChevronLeft:xb,CircleChevronLeftIcon:xb,CircleChevronRight:yb,CircleChevronRightIcon:yb,CircleChevronUp:vb,CircleChevronUpIcon:vb,CircleDashed:Qz,CircleDashedIcon:Qz,CircleDivide:_b,CircleDivideIcon:_b,CircleDollarSign:Jz,CircleDollarSignIcon:Jz,CircleDot:t7,CircleDotDashed:e7,CircleDotDashedIcon:e7,CircleDotIcon:t7,CircleEllipsis:r7,CircleEllipsisIcon:r7,CircleEqual:n7,CircleEqualIcon:n7,CircleFadingArrowUp:s7,CircleFadingArrowUpIcon:s7,CircleFadingPlus:a7,CircleFadingPlusIcon:a7,CircleGauge:bb,CircleGaugeIcon:bb,CircleHelp:Kx,CircleHelpIcon:Kx,CircleIcon:eh,CircleMinus:wb,CircleMinusIcon:wb,CircleOff:i7,CircleOffIcon:i7,CircleParking:kb,CircleParkingIcon:kb,CircleParkingOff:jb,CircleParkingOffIcon:jb,CirclePause:Nb,CirclePauseIcon:Nb,CirclePercent:Sb,CirclePercentIcon:Sb,CirclePlay:nf,CirclePlayIcon:nf,CirclePlus:Cb,CirclePlusIcon:Cb,CirclePower:Mb,CirclePowerIcon:Mb,CircleSlash:o7,CircleSlash2:Tb,CircleSlash2Icon:Tb,CircleSlashIcon:o7,CircleSlashed:Tb,CircleSlashedIcon:Tb,CircleStop:Ab,CircleStopIcon:Ab,CircleUser:Ib,CircleUserIcon:Ib,CircleUserRound:Eb,CircleUserRoundIcon:Eb,CircleX:bc,CircleXIcon:bc,CircuitBoard:l7,CircuitBoardIcon:l7,Citrus:c7,CitrusIcon:c7,Clapperboard:d7,ClapperboardIcon:d7,Clipboard:x7,ClipboardCheck:aA,ClipboardCheckIcon:aA,ClipboardCopy:u7,ClipboardCopyIcon:u7,ClipboardEdit:Lb,ClipboardEditIcon:Lb,ClipboardIcon:x7,ClipboardList:iA,ClipboardListIcon:iA,ClipboardMinus:h7,ClipboardMinusIcon:h7,ClipboardPaste:m7,ClipboardPasteIcon:m7,ClipboardPen:Lb,ClipboardPenIcon:Lb,ClipboardPenLine:Pb,ClipboardPenLineIcon:Pb,ClipboardPlus:f7,ClipboardPlusIcon:f7,ClipboardSignature:Pb,ClipboardSignatureIcon:Pb,ClipboardType:p7,ClipboardTypeIcon:p7,ClipboardX:g7,ClipboardXIcon:g7,Clock:Qa,Clock1:y7,Clock10:v7,Clock10Icon:v7,Clock11:_7,Clock11Icon:_7,Clock12:b7,Clock12Icon:b7,Clock1Icon:y7,Clock2:w7,Clock2Icon:w7,Clock3:j7,Clock3Icon:j7,Clock4:k7,Clock4Icon:k7,Clock5:N7,Clock5Icon:N7,Clock6:S7,Clock6Icon:S7,Clock7:C7,Clock7Icon:C7,Clock8:M7,Clock8Icon:M7,Clock9:T7,Clock9Icon:T7,ClockAlert:A7,ClockAlertIcon:A7,ClockArrowDown:E7,ClockArrowDownIcon:E7,ClockArrowUp:I7,ClockArrowUpIcon:I7,ClockIcon:Qa,Cloud:G7,CloudAlert:P7,CloudAlertIcon:P7,CloudCog:L7,CloudCogIcon:L7,CloudDownload:Ob,CloudDownloadIcon:Ob,CloudDrizzle:O7,CloudDrizzleIcon:O7,CloudFog:D7,CloudFogIcon:D7,CloudHail:R7,CloudHailIcon:R7,CloudIcon:G7,CloudLightning:F7,CloudLightningIcon:F7,CloudMoon:B7,CloudMoonIcon:B7,CloudMoonRain:z7,CloudMoonRainIcon:z7,CloudOff:$7,CloudOffIcon:$7,CloudRain:q7,CloudRainIcon:q7,CloudRainWind:U7,CloudRainWindIcon:U7,CloudSnow:V7,CloudSnowIcon:V7,CloudSun:W7,CloudSunIcon:W7,CloudSunRain:H7,CloudSunRainIcon:H7,CloudUpload:Db,CloudUploadIcon:Db,Cloudy:K7,CloudyIcon:K7,Clover:ty,CloverIcon:ty,Club:Z7,ClubIcon:Z7,Code:Ej,Code2:Rb,Code2Icon:Rb,CodeIcon:Ej,CodeSquare:Q2,CodeSquareIcon:Q2,CodeXml:Rb,CodeXmlIcon:Rb,Codepen:Y7,CodepenIcon:Y7,Codesandbox:X7,CodesandboxIcon:X7,Coffee:Ij,CoffeeIcon:Ij,Cog:Q7,CogIcon:Q7,Coins:J7,CoinsIcon:J7,Columns:Fb,Columns2:Fb,Columns2Icon:Fb,Columns3:zb,Columns3Icon:zb,Columns4:e9,Columns4Icon:e9,ColumnsIcon:Fb,Combine:t9,CombineIcon:t9,Command:r9,CommandIcon:r9,Compass:n9,CompassIcon:n9,Component:s9,ComponentIcon:s9,Computer:a9,ComputerIcon:a9,ConciergeBell:i9,ConciergeBellIcon:i9,Cone:o9,ConeIcon:o9,Construction:l9,ConstructionIcon:l9,Contact:c9,Contact2:Bb,Contact2Icon:Bb,ContactIcon:c9,ContactRound:Bb,ContactRoundIcon:Bb,Container:d9,ContainerIcon:d9,Contrast:u9,ContrastIcon:u9,Cookie:h9,CookieIcon:h9,CookingPot:m9,CookingPotIcon:m9,Copy:Oo,CopyCheck:f9,CopyCheckIcon:f9,CopyIcon:Oo,CopyMinus:p9,CopyMinusIcon:p9,CopyPlus:g9,CopyPlusIcon:g9,CopySlash:x9,CopySlashIcon:x9,CopyX:y9,CopyXIcon:y9,Copyleft:v9,CopyleftIcon:v9,Copyright:_9,CopyrightIcon:_9,CornerDownLeft:b9,CornerDownLeftIcon:b9,CornerDownRight:w9,CornerDownRightIcon:w9,CornerLeftDown:j9,CornerLeftDownIcon:j9,CornerLeftUp:k9,CornerLeftUpIcon:k9,CornerRightDown:N9,CornerRightDownIcon:N9,CornerRightUp:S9,CornerRightUpIcon:S9,CornerUpLeft:C9,CornerUpLeftIcon:C9,CornerUpRight:M9,CornerUpRightIcon:M9,Cpu:T9,CpuIcon:T9,CreativeCommons:A9,CreativeCommonsIcon:A9,CreditCard:hf,CreditCardIcon:hf,Croissant:E9,CroissantIcon:E9,Crop:I9,CropIcon:I9,Cross:P9,CrossIcon:P9,Crosshair:L9,CrosshairIcon:L9,Crown:q1,CrownIcon:q1,Cuboid:O9,CuboidIcon:O9,CupSoda:D9,CupSodaIcon:D9,CurlyBraces:K_,CurlyBracesIcon:K_,Currency:R9,CurrencyIcon:R9,Cylinder:F9,CylinderIcon:F9,Dam:z9,DamIcon:z9,Database:U9,DatabaseBackup:B9,DatabaseBackupIcon:B9,DatabaseIcon:U9,DatabaseZap:$9,DatabaseZapIcon:$9,Delete:q9,DeleteIcon:q9,Dessert:V9,DessertIcon:V9,Diameter:H9,DiameterIcon:H9,Diamond:K9,DiamondIcon:K9,DiamondMinus:W9,DiamondMinusIcon:W9,DiamondPercent:$b,DiamondPercentIcon:$b,DiamondPlus:G9,DiamondPlusIcon:G9,Dice1:Z9,Dice1Icon:Z9,Dice2:Y9,Dice2Icon:Y9,Dice3:X9,Dice3Icon:X9,Dice4:Q9,Dice4Icon:Q9,Dice5:J9,Dice5Icon:J9,Dice6:eB,Dice6Icon:eB,Dices:tB,DicesIcon:tB,Diff:rB,DiffIcon:rB,Disc:iB,Disc2:nB,Disc2Icon:nB,Disc3:sB,Disc3Icon:sB,DiscAlbum:aB,DiscAlbumIcon:aB,DiscIcon:iB,Divide:oB,DivideCircle:_b,DivideCircleIcon:_b,DivideIcon:oB,DivideSquare:rw,DivideSquareIcon:rw,Dna:cB,DnaIcon:cB,DnaOff:lB,DnaOffIcon:lB,Dock:dB,DockIcon:dB,Dog:uB,DogIcon:uB,DollarSign:zd,DollarSignIcon:zd,Donut:hB,DonutIcon:hB,DoorClosed:mB,DoorClosedIcon:mB,DoorOpen:Pj,DoorOpenIcon:Pj,Dot:fB,DotIcon:fB,DotSquare:nw,DotSquareIcon:nw,Download:so,DownloadCloud:Ob,DownloadCloudIcon:Ob,DownloadIcon:so,DraftingCompass:pB,DraftingCompassIcon:pB,Drama:gB,DramaIcon:gB,Dribbble:xB,DribbbleIcon:xB,Drill:yB,DrillIcon:yB,Droplet:vB,DropletIcon:vB,Droplets:_B,DropletsIcon:_B,Drum:bB,DrumIcon:bB,Drumstick:wB,DrumstickIcon:wB,Dumbbell:jB,DumbbellIcon:jB,Ear:NB,EarIcon:NB,EarOff:kB,EarOffIcon:kB,Earth:Ub,EarthIcon:Ub,EarthLock:SB,EarthLockIcon:SB,Eclipse:CB,EclipseIcon:CB,Edit:gc,Edit2:Y0,Edit2Icon:Y0,Edit3:Z0,Edit3Icon:Z0,EditIcon:gc,Egg:j4,EggFried:MB,EggFriedIcon:MB,EggIcon:j4,EggOff:TB,EggOffIcon:TB,Ellipsis:gp,EllipsisIcon:gp,EllipsisVertical:kg,EllipsisVerticalIcon:kg,Equal:IB,EqualApproximately:AB,EqualApproximatelyIcon:AB,EqualIcon:IB,EqualNot:EB,EqualNotIcon:EB,EqualSquare:sw,EqualSquareIcon:sw,Eraser:PB,EraserIcon:PB,EthernetPort:LB,EthernetPortIcon:LB,Euro:OB,EuroIcon:OB,Expand:DB,ExpandIcon:DB,ExternalLink:Ms,ExternalLinkIcon:Ms,Eye:_o,EyeClosed:RB,EyeClosedIcon:RB,EyeIcon:_o,EyeOff:Fg,EyeOffIcon:Fg,Facebook:au,FacebookIcon:au,Factory:FB,FactoryIcon:FB,Fan:zB,FanIcon:zB,FastForward:BB,FastForwardIcon:BB,Feather:$B,FeatherIcon:$B,Fence:UB,FenceIcon:UB,FerrisWheel:qB,FerrisWheelIcon:qB,Figma:VB,FigmaIcon:VB,File:F$,FileArchive:HB,FileArchiveIcon:HB,FileAudio:GB,FileAudio2:WB,FileAudio2Icon:WB,FileAudioIcon:GB,FileAxis3D:qb,FileAxis3DIcon:qb,FileAxis3d:qb,FileAxis3dIcon:qb,FileBadge:ZB,FileBadge2:KB,FileBadge2Icon:KB,FileBadgeIcon:ZB,FileBarChart:Vb,FileBarChart2:Hb,FileBarChart2Icon:Hb,FileBarChartIcon:Vb,FileBox:YB,FileBoxIcon:YB,FileChartColumn:Hb,FileChartColumnIcon:Hb,FileChartColumnIncreasing:Vb,FileChartColumnIncreasingIcon:Vb,FileChartLine:Wb,FileChartLineIcon:Wb,FileChartPie:Gb,FileChartPieIcon:Gb,FileCheck:QB,FileCheck2:XB,FileCheck2Icon:XB,FileCheckIcon:QB,FileClock:JB,FileClockIcon:JB,FileCode:t$,FileCode2:e$,FileCode2Icon:e$,FileCodeIcon:t$,FileCog:Kb,FileCog2:Kb,FileCog2Icon:Kb,FileCogIcon:Kb,FileDiff:r$,FileDiffIcon:r$,FileDigit:n$,FileDigitIcon:n$,FileDown:s$,FileDownIcon:s$,FileEdit:Yb,FileEditIcon:Yb,FileHeart:a$,FileHeartIcon:a$,FileIcon:F$,FileImage:V1,FileImageIcon:V1,FileInput:i$,FileInputIcon:i$,FileJson:l$,FileJson2:o$,FileJson2Icon:o$,FileJsonIcon:l$,FileKey:d$,FileKey2:c$,FileKey2Icon:c$,FileKeyIcon:d$,FileLineChart:Wb,FileLineChartIcon:Wb,FileLock:h$,FileLock2:u$,FileLock2Icon:u$,FileLockIcon:h$,FileMinus:f$,FileMinus2:m$,FileMinus2Icon:m$,FileMinusIcon:f$,FileMusic:p$,FileMusicIcon:p$,FileOutput:g$,FileOutputIcon:g$,FilePen:Yb,FilePenIcon:Yb,FilePenLine:Zb,FilePenLineIcon:Zb,FilePieChart:Gb,FilePieChartIcon:Gb,FilePlus:y$,FilePlus2:x$,FilePlus2Icon:x$,FilePlusIcon:y$,FileQuestion:v$,FileQuestionIcon:v$,FileScan:_$,FileScanIcon:_$,FileSearch:w$,FileSearch2:b$,FileSearch2Icon:b$,FileSearchIcon:w$,FileSignature:Zb,FileSignatureIcon:Zb,FileSliders:j$,FileSlidersIcon:j$,FileSpreadsheet:H1,FileSpreadsheetIcon:H1,FileStack:k$,FileStackIcon:k$,FileSymlink:N$,FileSymlinkIcon:N$,FileTerminal:S$,FileTerminalIcon:S$,FileText:_a,FileTextIcon:_a,FileType:M$,FileType2:C$,FileType2Icon:C$,FileTypeIcon:M$,FileUp:T$,FileUpIcon:T$,FileUser:A$,FileUserIcon:A$,FileVideo:I$,FileVideo2:E$,FileVideo2Icon:E$,FileVideoIcon:I$,FileVolume:L$,FileVolume2:P$,FileVolume2Icon:P$,FileVolumeIcon:L$,FileWarning:O$,FileWarningIcon:O$,FileX:R$,FileX2:D$,FileX2Icon:D$,FileXIcon:R$,Files:z$,FilesIcon:z$,Film:Ad,FilmIcon:Ad,Filter:W1,FilterIcon:W1,FilterX:B$,FilterXIcon:B$,Fingerprint:$$,FingerprintIcon:$$,FireExtinguisher:U$,FireExtinguisherIcon:U$,Fish:H$,FishIcon:H$,FishOff:q$,FishOffIcon:q$,FishSymbol:V$,FishSymbolIcon:V$,Flag:dy,FlagIcon:dy,FlagOff:W$,FlagOffIcon:W$,FlagTriangleLeft:G$,FlagTriangleLeftIcon:G$,FlagTriangleRight:K$,FlagTriangleRightIcon:K$,Flame:pm,FlameIcon:pm,FlameKindling:Z$,FlameKindlingIcon:Z$,Flashlight:X$,FlashlightIcon:X$,FlashlightOff:Y$,FlashlightOffIcon:Y$,FlaskConical:Lj,FlaskConicalIcon:Lj,FlaskConicalOff:Q$,FlaskConicalOffIcon:Q$,FlaskRound:J$,FlaskRoundIcon:J$,FlipHorizontal:tU,FlipHorizontal2:eU,FlipHorizontal2Icon:eU,FlipHorizontalIcon:tU,FlipVertical:nU,FlipVertical2:rU,FlipVertical2Icon:rU,FlipVerticalIcon:nU,Flower:sU,Flower2:bp,Flower2Icon:bp,FlowerIcon:sU,Focus:aU,FocusIcon:aU,FoldHorizontal:iU,FoldHorizontalIcon:iU,FoldVertical:oU,FoldVerticalIcon:oU,Folder:LU,FolderArchive:lU,FolderArchiveIcon:lU,FolderCheck:cU,FolderCheckIcon:cU,FolderClock:dU,FolderClockIcon:dU,FolderClosed:uU,FolderClosedIcon:uU,FolderCode:hU,FolderCodeIcon:hU,FolderCog:Xb,FolderCog2:Xb,FolderCog2Icon:Xb,FolderCogIcon:Xb,FolderDot:mU,FolderDotIcon:mU,FolderDown:fU,FolderDownIcon:fU,FolderEdit:Qb,FolderEditIcon:Qb,FolderGit:gU,FolderGit2:pU,FolderGit2Icon:pU,FolderGitIcon:gU,FolderHeart:xU,FolderHeartIcon:xU,FolderIcon:LU,FolderInput:yU,FolderInputIcon:yU,FolderKanban:vU,FolderKanbanIcon:vU,FolderKey:_U,FolderKeyIcon:_U,FolderLock:bU,FolderLockIcon:bU,FolderMinus:wU,FolderMinusIcon:wU,FolderOpen:Ap,FolderOpenDot:jU,FolderOpenDotIcon:jU,FolderOpenIcon:Ap,FolderOutput:kU,FolderOutputIcon:kU,FolderPen:Qb,FolderPenIcon:Qb,FolderPlus:NU,FolderPlusIcon:NU,FolderRoot:SU,FolderRootIcon:SU,FolderSearch:MU,FolderSearch2:CU,FolderSearch2Icon:CU,FolderSearchIcon:MU,FolderSymlink:TU,FolderSymlinkIcon:TU,FolderSync:AU,FolderSyncIcon:AU,FolderTree:EU,FolderTreeIcon:EU,FolderUp:IU,FolderUpIcon:IU,FolderX:PU,FolderXIcon:PU,Folders:OU,FoldersIcon:OU,Footprints:DU,FootprintsIcon:DU,ForkKnife:qw,ForkKnifeCrossed:Uw,ForkKnifeCrossedIcon:Uw,ForkKnifeIcon:qw,Forklift:RU,ForkliftIcon:RU,FormInput:k2,FormInputIcon:k2,Forward:FU,ForwardIcon:FU,Frame:zU,FrameIcon:zU,Framer:BU,FramerIcon:BU,Frown:$U,FrownIcon:$U,Fuel:UU,FuelIcon:UU,Fullscreen:qU,FullscreenIcon:qU,FunctionSquare:aw,FunctionSquareIcon:aw,GalleryHorizontal:HU,GalleryHorizontalEnd:VU,GalleryHorizontalEndIcon:VU,GalleryHorizontalIcon:HU,GalleryThumbnails:WU,GalleryThumbnailsIcon:WU,GalleryVertical:KU,GalleryVerticalEnd:GU,GalleryVerticalEndIcon:GU,GalleryVerticalIcon:KU,Gamepad:YU,Gamepad2:ZU,Gamepad2Icon:ZU,GamepadIcon:YU,GanttChart:ab,GanttChartIcon:ab,GanttChartSquare:pg,GanttChartSquareIcon:pg,Gauge:XU,GaugeCircle:bb,GaugeCircleIcon:bb,GaugeIcon:XU,Gavel:QU,GavelIcon:QU,Gem:JU,GemIcon:JU,Ghost:Oj,GhostIcon:Oj,Gift:ao,GiftIcon:ao,GitBranch:tq,GitBranchIcon:tq,GitBranchPlus:eq,GitBranchPlusIcon:eq,GitCommit:Jb,GitCommitHorizontal:Jb,GitCommitHorizontalIcon:Jb,GitCommitIcon:Jb,GitCommitVertical:rq,GitCommitVerticalIcon:rq,GitCompare:sq,GitCompareArrows:nq,GitCompareArrowsIcon:nq,GitCompareIcon:sq,GitFork:aq,GitForkIcon:aq,GitGraph:iq,GitGraphIcon:iq,GitMerge:oq,GitMergeIcon:oq,GitPullRequest:mq,GitPullRequestArrow:lq,GitPullRequestArrowIcon:lq,GitPullRequestClosed:cq,GitPullRequestClosedIcon:cq,GitPullRequestCreate:uq,GitPullRequestCreateArrow:dq,GitPullRequestCreateArrowIcon:dq,GitPullRequestCreateIcon:uq,GitPullRequestDraft:hq,GitPullRequestDraftIcon:hq,GitPullRequestIcon:mq,Github:fq,GithubIcon:fq,Gitlab:pq,GitlabIcon:pq,GlassWater:gq,GlassWaterIcon:gq,Glasses:xq,GlassesIcon:xq,Globe:uy,Globe2:Ub,Globe2Icon:Ub,GlobeIcon:uy,GlobeLock:yq,GlobeLockIcon:yq,Goal:vq,GoalIcon:vq,Grab:_q,GrabIcon:_q,GraduationCap:G1,GraduationCapIcon:G1,Grape:bq,GrapeIcon:bq,Grid:rm,Grid2X2:t2,Grid2X2Icon:t2,Grid2X2Plus:e2,Grid2X2PlusIcon:e2,Grid2x2:t2,Grid2x2Check:wq,Grid2x2CheckIcon:wq,Grid2x2Icon:t2,Grid2x2Plus:e2,Grid2x2PlusIcon:e2,Grid2x2X:jq,Grid2x2XIcon:jq,Grid3X3:rm,Grid3X3Icon:rm,Grid3x3:rm,Grid3x3Icon:rm,GridIcon:rm,Grip:Nq,GripHorizontal:kq,GripHorizontalIcon:kq,GripIcon:Nq,GripVertical:zg,GripVerticalIcon:zg,Group:Sq,GroupIcon:Sq,Guitar:Cq,GuitarIcon:Cq,Ham:Mq,HamIcon:Mq,Hammer:Tq,HammerIcon:Tq,Hand:Lq,HandCoins:Aq,HandCoinsIcon:Aq,HandHeart:Eq,HandHeartIcon:Eq,HandHelping:r2,HandHelpingIcon:r2,HandIcon:Lq,HandMetal:Iq,HandMetalIcon:Iq,HandPlatter:Pq,HandPlatterIcon:Pq,Handshake:Oq,HandshakeIcon:Oq,HardDrive:oA,HardDriveDownload:Dq,HardDriveDownloadIcon:Dq,HardDriveIcon:oA,HardDriveUpload:Rq,HardDriveUploadIcon:Rq,HardHat:Fq,HardHatIcon:Fq,Hash:k4,HashIcon:k4,Haze:zq,HazeIcon:zq,HdmiPort:Bq,HdmiPortIcon:Bq,Heading:Hq,Heading1:lA,Heading1Icon:lA,Heading2:cA,Heading2Icon:cA,Heading3:$q,Heading3Icon:$q,Heading4:Uq,Heading4Icon:Uq,Heading5:qq,Heading5Icon:qq,Heading6:Vq,Heading6Icon:Vq,HeadingIcon:Hq,HeadphoneOff:Wq,HeadphoneOffIcon:Wq,Headphones:Gq,HeadphonesIcon:Gq,Headset:Kq,HeadsetIcon:Kq,Heart:bi,HeartCrack:Zq,HeartCrackIcon:Zq,HeartHandshake:Yq,HeartHandshakeIcon:Yq,HeartIcon:bi,HeartOff:Xq,HeartOffIcon:Xq,HeartPulse:Qq,HeartPulseIcon:Qq,Heater:Jq,HeaterIcon:Jq,HelpCircle:Kx,HelpCircleIcon:Kx,HelpingHand:r2,HelpingHandIcon:r2,Hexagon:eV,HexagonIcon:eV,Highlighter:tV,HighlighterIcon:tV,History:N4,HistoryIcon:N4,Home:ya,HomeIcon:ya,Hop:nV,HopIcon:nV,HopOff:rV,HopOffIcon:rV,Hospital:sV,HospitalIcon:sV,Hotel:aV,HotelIcon:aV,Hourglass:iV,HourglassIcon:iV,House:ya,HouseIcon:ya,HousePlug:oV,HousePlugIcon:oV,HousePlus:lV,HousePlusIcon:lV,IceCream:s2,IceCream2:n2,IceCream2Icon:n2,IceCreamBowl:n2,IceCreamBowlIcon:n2,IceCreamCone:s2,IceCreamConeIcon:s2,IceCreamIcon:s2,Icon:TIe,IdCard:cV,IdCardIcon:cV,Image:Fl,ImageDown:dV,ImageDownIcon:dV,ImageIcon:Fl,ImageMinus:uV,ImageMinusIcon:uV,ImageOff:hV,ImageOffIcon:hV,ImagePlay:mV,ImagePlayIcon:mV,ImagePlus:Dj,ImagePlusIcon:Dj,ImageUp:fV,ImageUpIcon:fV,ImageUpscale:pV,ImageUpscaleIcon:pV,Images:gV,ImagesIcon:gV,Import:xV,ImportIcon:xV,Inbox:yV,InboxIcon:yV,Indent:i2,IndentDecrease:a2,IndentDecreaseIcon:a2,IndentIcon:i2,IndentIncrease:i2,IndentIncreaseIcon:i2,IndianRupee:vV,IndianRupeeIcon:vV,Infinity:_V,InfinityIcon:_V,Info:bV,InfoIcon:bV,Inspect:uw,InspectIcon:uw,InspectionPanel:wV,InspectionPanelIcon:wV,Instagram:_u,InstagramIcon:_u,Italic:S4,ItalicIcon:S4,IterationCcw:jV,IterationCcwIcon:jV,IterationCw:kV,IterationCwIcon:kV,JapaneseYen:NV,JapaneseYenIcon:NV,Joystick:SV,JoystickIcon:SV,Kanban:hy,KanbanIcon:hy,KanbanSquare:iw,KanbanSquareDashed:J2,KanbanSquareDashedIcon:J2,KanbanSquareIcon:iw,Key:gm,KeyIcon:gm,KeyRound:Rj,KeyRoundIcon:Rj,KeySquare:CV,KeySquareIcon:CV,Keyboard:AV,KeyboardIcon:AV,KeyboardMusic:MV,KeyboardMusicIcon:MV,KeyboardOff:TV,KeyboardOffIcon:TV,Lamp:DV,LampCeiling:EV,LampCeilingIcon:EV,LampDesk:IV,LampDeskIcon:IV,LampFloor:PV,LampFloorIcon:PV,LampIcon:DV,LampWallDown:LV,LampWallDownIcon:LV,LampWallUp:OV,LampWallUpIcon:OV,LandPlot:RV,LandPlotIcon:RV,Landmark:FV,LandmarkIcon:FV,Languages:zV,LanguagesIcon:zV,Laptop:$V,Laptop2:o2,Laptop2Icon:o2,LaptopIcon:$V,LaptopMinimal:o2,LaptopMinimalCheck:BV,LaptopMinimalCheckIcon:BV,LaptopMinimalIcon:o2,Lasso:qV,LassoIcon:qV,LassoSelect:UV,LassoSelectIcon:UV,Laugh:VV,LaughIcon:VV,Layers:GV,Layers2:HV,Layers2Icon:HV,Layers3:WV,Layers3Icon:WV,LayersIcon:GV,Layout:K0,LayoutDashboard:Fj,LayoutDashboardIcon:Fj,LayoutGrid:mf,LayoutGridIcon:mf,LayoutIcon:K0,LayoutList:KV,LayoutListIcon:KV,LayoutPanelLeft:ZV,LayoutPanelLeftIcon:ZV,LayoutPanelTop:YV,LayoutPanelTopIcon:YV,LayoutTemplate:zj,LayoutTemplateIcon:zj,Leaf:XV,LeafIcon:XV,LeafyGreen:QV,LeafyGreenIcon:QV,Lectern:JV,LecternIcon:JV,LetterText:eH,LetterTextIcon:eH,Library:C4,LibraryBig:tH,LibraryBigIcon:tH,LibraryIcon:C4,LibrarySquare:ow,LibrarySquareIcon:ow,LifeBuoy:M4,LifeBuoyIcon:M4,Ligature:rH,LigatureIcon:rH,Lightbulb:my,LightbulbIcon:my,LightbulbOff:nH,LightbulbOffIcon:nH,LineChart:rb,LineChartIcon:rb,Link:Ro,Link2:xm,Link2Icon:xm,Link2Off:sH,Link2OffIcon:sH,LinkIcon:Ro,Linkedin:ym,LinkedinIcon:ym,List:ff,ListCheck:aH,ListCheckIcon:aH,ListChecks:iH,ListChecksIcon:iH,ListCollapse:oH,ListCollapseIcon:oH,ListEnd:lH,ListEndIcon:lH,ListFilter:cH,ListFilterIcon:cH,ListIcon:ff,ListMinus:dH,ListMinusIcon:dH,ListMusic:uH,ListMusicIcon:uH,ListOrdered:T4,ListOrderedIcon:T4,ListPlus:hH,ListPlusIcon:hH,ListRestart:mH,ListRestartIcon:mH,ListStart:fH,ListStartIcon:fH,ListTodo:pH,ListTodoIcon:pH,ListTree:gH,ListTreeIcon:gH,ListVideo:xH,ListVideoIcon:xH,ListX:yH,ListXIcon:yH,Loader:_H,Loader2:Wr,Loader2Icon:Wr,LoaderCircle:Wr,LoaderCircleIcon:Wr,LoaderIcon:_H,LoaderPinwheel:vH,LoaderPinwheelIcon:vH,Locate:dA,LocateFixed:bH,LocateFixedIcon:bH,LocateIcon:dA,LocateOff:wH,LocateOffIcon:wH,Lock:th,LockIcon:th,LockKeyhole:jH,LockKeyholeIcon:jH,LockKeyholeOpen:l2,LockKeyholeOpenIcon:l2,LockOpen:c2,LockOpenIcon:c2,LogIn:A4,LogInIcon:A4,LogOut:E4,LogOutIcon:E4,Logs:kH,LogsIcon:kH,Lollipop:NH,LollipopIcon:NH,LucideAArrowDown:lD,LucideAArrowUp:cD,LucideALargeSmall:dD,LucideAccessibility:uD,LucideActivity:Lg,LucideActivitySquare:I2,LucideAirVent:hD,LucideAirplay:mD,LucideAlarmCheck:L_,LucideAlarmClock:pD,LucideAlarmClockCheck:L_,LucideAlarmClockMinus:O_,LucideAlarmClockOff:fD,LucideAlarmClockPlus:D_,LucideAlarmMinus:O_,LucideAlarmPlus:D_,LucideAlarmSmoke:gD,LucideAlbum:xD,LucideAlertCircle:yl,LucideAlertOctagon:h2,LucideAlertTriangle:Gu,LucideAlignCenter:y4,LucideAlignCenterHorizontal:yD,LucideAlignCenterVertical:vD,LucideAlignEndHorizontal:_D,LucideAlignEndVertical:bD,LucideAlignHorizontalDistributeCenter:wD,LucideAlignHorizontalDistributeEnd:jD,LucideAlignHorizontalDistributeStart:kD,LucideAlignHorizontalJustifyCenter:ND,LucideAlignHorizontalJustifyEnd:SD,LucideAlignHorizontalJustifyStart:CD,LucideAlignHorizontalSpaceAround:MD,LucideAlignHorizontalSpaceBetween:TD,LucideAlignJustify:AD,LucideAlignLeft:v4,LucideAlignRight:_4,LucideAlignStartHorizontal:ED,LucideAlignStartVertical:ID,LucideAlignVerticalDistributeCenter:PD,LucideAlignVerticalDistributeEnd:LD,LucideAlignVerticalDistributeStart:OD,LucideAlignVerticalJustifyCenter:DD,LucideAlignVerticalJustifyEnd:RD,LucideAlignVerticalJustifyStart:FD,LucideAlignVerticalSpaceAround:zD,LucideAlignVerticalSpaceBetween:BD,LucideAmbulance:$D,LucideAmpersand:UD,LucideAmpersands:qD,LucideAmphora:VD,LucideAnchor:HD,LucideAngry:WD,LucideAnnoyed:GD,LucideAntenna:KD,LucideAnvil:ZD,LucideAperture:YD,LucideAppWindow:JT,LucideAppWindowMac:XD,LucideApple:QD,LucideArchive:eA,LucideArchiveRestore:JD,LucideArchiveX:e8,LucideAreaChart:Y_,LucideArmchair:t8,LucideArrowBigDown:n8,LucideArrowBigDownDash:r8,LucideArrowBigLeft:a8,LucideArrowBigLeftDash:s8,LucideArrowBigRight:o8,LucideArrowBigRightDash:i8,LucideArrowBigUp:c8,LucideArrowBigUpDash:l8,LucideArrowDown:oy,LucideArrowDown01:d8,LucideArrowDown10:u8,LucideArrowDownAZ:R_,LucideArrowDownAz:R_,LucideArrowDownCircle:lb,LucideArrowDownFromLine:h8,LucideArrowDownLeft:m8,LucideArrowDownLeftFromCircle:db,LucideArrowDownLeftFromSquare:R2,LucideArrowDownLeftSquare:P2,LucideArrowDownNarrowWide:f8,LucideArrowDownRight:p8,LucideArrowDownRightFromCircle:ub,LucideArrowDownRightFromSquare:F2,LucideArrowDownRightSquare:L2,LucideArrowDownSquare:O2,LucideArrowDownToDot:g8,LucideArrowDownToLine:x8,LucideArrowDownUp:y8,LucideArrowDownWideNarrow:F_,LucideArrowDownZA:z_,LucideArrowDownZa:z_,LucideArrowLeft:Wi,LucideArrowLeftCircle:cb,LucideArrowLeftFromLine:v8,LucideArrowLeftRight:_8,LucideArrowLeftSquare:D2,LucideArrowLeftToLine:b8,LucideArrowRight:No,LucideArrowRightCircle:fb,LucideArrowRightFromLine:w8,LucideArrowRightLeft:j8,LucideArrowRightSquare:$2,LucideArrowRightToLine:k8,LucideArrowUp:uf,LucideArrowUp01:N8,LucideArrowUp10:S8,LucideArrowUpAZ:B_,LucideArrowUpAz:B_,LucideArrowUpCircle:pb,LucideArrowUpDown:Og,LucideArrowUpFromDot:C8,LucideArrowUpFromLine:M8,LucideArrowUpLeft:T8,LucideArrowUpLeftFromCircle:hb,LucideArrowUpLeftFromSquare:z2,LucideArrowUpLeftSquare:U2,LucideArrowUpNarrowWide:$_,LucideArrowUpRight:A8,LucideArrowUpRightFromCircle:mb,LucideArrowUpRightFromSquare:B2,LucideArrowUpRightSquare:q2,LucideArrowUpSquare:V2,LucideArrowUpToLine:E8,LucideArrowUpWideNarrow:I8,LucideArrowUpZA:U_,LucideArrowUpZa:U_,LucideArrowsUpFromLine:P8,LucideAsterisk:L8,LucideAsteriskSquare:H2,LucideAtSign:O8,LucideAtom:D8,LucideAudioLines:R8,LucideAudioWaveform:F8,LucideAward:Bl,LucideAxe:z8,LucideAxis3D:q_,LucideAxis3d:q_,LucideBaby:B8,LucideBackpack:$8,LucideBadge:nR,LucideBadgeAlert:U8,LucideBadgeCent:q8,LucideBadgeCheck:V_,LucideBadgeDollarSign:V8,LucideBadgeEuro:H8,LucideBadgeHelp:W8,LucideBadgeIndianRupee:G8,LucideBadgeInfo:K8,LucideBadgeJapaneseYen:Z8,LucideBadgeMinus:Y8,LucideBadgePercent:X8,LucideBadgePlus:Q8,LucideBadgePoundSterling:J8,LucideBadgeRussianRuble:eR,LucideBadgeSwissFranc:tR,LucideBadgeX:rR,LucideBaggageClaim:sR,LucideBan:aR,LucideBanana:iR,LucideBandage:oR,LucideBanknote:lR,LucideBarChart:nb,LucideBarChart2:sb,LucideBarChart3:_c,LucideBarChart4:tb,LucideBarChartBig:eb,LucideBarChartHorizontal:Q_,LucideBarChartHorizontalBig:X_,LucideBarcode:cR,LucideBaseline:dR,LucideBath:$1,LucideBattery:gR,LucideBatteryCharging:uR,LucideBatteryFull:hR,LucideBatteryLow:mR,LucideBatteryMedium:fR,LucideBatteryWarning:pR,LucideBeaker:xR,LucideBean:vR,LucideBeanOff:yR,LucideBed:U1,LucideBedDouble:_R,LucideBedSingle:bR,LucideBeef:wR,LucideBeer:kR,LucideBeerOff:jR,LucideBell:Dg,LucideBellDot:NR,LucideBellElectric:SR,LucideBellMinus:CR,LucideBellOff:Mj,LucideBellPlus:MR,LucideBellRing:TR,LucideBetweenHorizonalEnd:H_,LucideBetweenHorizonalStart:W_,LucideBetweenHorizontalEnd:H_,LucideBetweenHorizontalStart:W_,LucideBetweenVerticalEnd:AR,LucideBetweenVerticalStart:ER,LucideBicepsFlexed:IR,LucideBike:PR,LucideBinary:LR,LucideBinoculars:OR,LucideBiohazard:DR,LucideBird:RR,LucideBitcoin:FR,LucideBlend:zR,LucideBlinds:BR,LucideBlocks:$R,LucideBluetooth:HR,LucideBluetoothConnected:UR,LucideBluetoothOff:qR,LucideBluetoothSearching:VR,LucideBold:b4,LucideBolt:WR,LucideBomb:GR,LucideBone:KR,LucideBook:gF,LucideBookA:ZR,LucideBookAudio:YR,LucideBookCheck:XR,LucideBookCopy:QR,LucideBookDashed:G_,LucideBookDown:JR,LucideBookHeadphones:eF,LucideBookHeart:tF,LucideBookImage:rF,LucideBookKey:nF,LucideBookLock:sF,LucideBookMarked:aF,LucideBookMinus:iF,LucideBookOpen:tA,LucideBookOpenCheck:oF,LucideBookOpenText:lF,LucideBookPlus:cF,LucideBookTemplate:G_,LucideBookText:dF,LucideBookType:uF,LucideBookUp:mF,LucideBookUp2:hF,LucideBookUser:fF,LucideBookX:pF,LucideBookmark:Mp,LucideBookmarkCheck:xF,LucideBookmarkMinus:yF,LucideBookmarkPlus:rA,LucideBookmarkX:vF,LucideBoomBox:_F,LucideBot:w4,LucideBotMessageSquare:bF,LucideBotOff:wF,LucideBox:jF,LucideBoxSelect:tw,LucideBoxes:kF,LucideBraces:K_,LucideBrackets:NF,LucideBrain:nA,LucideBrainCircuit:SF,LucideBrainCog:CF,LucideBrickWall:MF,LucideBriefcase:Dh,LucideBriefcaseBusiness:TF,LucideBriefcaseConveyorBelt:AF,LucideBriefcaseMedical:EF,LucideBringToFront:IF,LucideBrush:PF,LucideBug:DF,LucideBugOff:LF,LucideBugPlay:OF,LucideBuilding:Tj,LucideBuilding2:mi,LucideBus:FF,LucideBusFront:RF,LucideCable:BF,LucideCableCar:zF,LucideCake:fm,LucideCakeSlice:$F,LucideCalculator:UF,LucideCalendar:Ts,LucideCalendar1:qF,LucideCalendarArrowDown:VF,LucideCalendarArrowUp:HF,LucideCalendarCheck:GF,LucideCalendarCheck2:WF,LucideCalendarClock:sA,LucideCalendarCog:KF,LucideCalendarDays:Tp,LucideCalendarFold:ZF,LucideCalendarHeart:YF,LucideCalendarMinus:QF,LucideCalendarMinus2:XF,LucideCalendarOff:JF,LucideCalendarPlus:Aj,LucideCalendarPlus2:ez,LucideCalendarRange:tz,LucideCalendarSearch:rz,LucideCalendarSync:nz,LucideCalendarX:az,LucideCalendarX2:sz,LucideCamera:Rg,LucideCameraOff:iz,LucideCandlestickChart:J_,LucideCandy:cz,LucideCandyCane:oz,LucideCandyOff:lz,LucideCannabis:dz,LucideCaptions:Z_,LucideCaptionsOff:uz,LucideCar:fz,LucideCarFront:hz,LucideCarTaxiFront:mz,LucideCaravan:pz,LucideCarrot:gz,LucideCaseLower:xz,LucideCaseSensitive:yz,LucideCaseUpper:vz,LucideCassetteTape:_z,LucideCast:bz,LucideCastle:wz,LucideCat:jz,LucideCctv:kz,LucideChartArea:Y_,LucideChartBar:Q_,LucideChartBarBig:X_,LucideChartBarDecreasing:Nz,LucideChartBarIncreasing:Sz,LucideChartBarStacked:Cz,LucideChartCandlestick:J_,LucideChartColumn:_c,LucideChartColumnBig:eb,LucideChartColumnDecreasing:Mz,LucideChartColumnIncreasing:tb,LucideChartColumnStacked:Tz,LucideChartGantt:Az,LucideChartLine:rb,LucideChartNetwork:Ez,LucideChartNoAxesColumn:sb,LucideChartNoAxesColumnDecreasing:Iz,LucideChartNoAxesColumnIncreasing:nb,LucideChartNoAxesCombined:Pz,LucideChartNoAxesGantt:ab,LucideChartPie:ib,LucideChartScatter:ob,LucideChartSpline:Lz,LucideCheck:fi,LucideCheckCheck:Oz,LucideCheckCircle:li,LucideCheckCircle2:no,LucideCheckSquare:X0,LucideCheckSquare2:G2,LucideChefHat:Dz,LucideCherry:Rz,LucideChevronDown:Fd,LucideChevronDownCircle:gb,LucideChevronDownSquare:K2,LucideChevronFirst:Fz,LucideChevronLast:zz,LucideChevronLeft:kc,LucideChevronLeftCircle:xb,LucideChevronLeftSquare:Z2,LucideChevronRight:Gi,LucideChevronRightCircle:yb,LucideChevronRightSquare:Y2,LucideChevronUp:ly,LucideChevronUpCircle:vb,LucideChevronUpSquare:X2,LucideChevronsDown:$z,LucideChevronsDownUp:Bz,LucideChevronsLeft:Vz,LucideChevronsLeftRight:qz,LucideChevronsLeftRightEllipsis:Uz,LucideChevronsRight:Wz,LucideChevronsRightLeft:Hz,LucideChevronsUp:Gz,LucideChevronsUpDown:cy,LucideChrome:Kz,LucideChurch:Zz,LucideCigarette:Xz,LucideCigaretteOff:Yz,LucideCircle:eh,LucideCircleAlert:yl,LucideCircleArrowDown:lb,LucideCircleArrowLeft:cb,LucideCircleArrowOutDownLeft:db,LucideCircleArrowOutDownRight:ub,LucideCircleArrowOutUpLeft:hb,LucideCircleArrowOutUpRight:mb,LucideCircleArrowRight:fb,LucideCircleArrowUp:pb,LucideCircleCheck:no,LucideCircleCheckBig:li,LucideCircleChevronDown:gb,LucideCircleChevronLeft:xb,LucideCircleChevronRight:yb,LucideCircleChevronUp:vb,LucideCircleDashed:Qz,LucideCircleDivide:_b,LucideCircleDollarSign:Jz,LucideCircleDot:t7,LucideCircleDotDashed:e7,LucideCircleEllipsis:r7,LucideCircleEqual:n7,LucideCircleFadingArrowUp:s7,LucideCircleFadingPlus:a7,LucideCircleGauge:bb,LucideCircleHelp:Kx,LucideCircleMinus:wb,LucideCircleOff:i7,LucideCircleParking:kb,LucideCircleParkingOff:jb,LucideCirclePause:Nb,LucideCirclePercent:Sb,LucideCirclePlay:nf,LucideCirclePlus:Cb,LucideCirclePower:Mb,LucideCircleSlash:o7,LucideCircleSlash2:Tb,LucideCircleSlashed:Tb,LucideCircleStop:Ab,LucideCircleUser:Ib,LucideCircleUserRound:Eb,LucideCircleX:bc,LucideCircuitBoard:l7,LucideCitrus:c7,LucideClapperboard:d7,LucideClipboard:x7,LucideClipboardCheck:aA,LucideClipboardCopy:u7,LucideClipboardEdit:Lb,LucideClipboardList:iA,LucideClipboardMinus:h7,LucideClipboardPaste:m7,LucideClipboardPen:Lb,LucideClipboardPenLine:Pb,LucideClipboardPlus:f7,LucideClipboardSignature:Pb,LucideClipboardType:p7,LucideClipboardX:g7,LucideClock:Qa,LucideClock1:y7,LucideClock10:v7,LucideClock11:_7,LucideClock12:b7,LucideClock2:w7,LucideClock3:j7,LucideClock4:k7,LucideClock5:N7,LucideClock6:S7,LucideClock7:C7,LucideClock8:M7,LucideClock9:T7,LucideClockAlert:A7,LucideClockArrowDown:E7,LucideClockArrowUp:I7,LucideCloud:G7,LucideCloudAlert:P7,LucideCloudCog:L7,LucideCloudDownload:Ob,LucideCloudDrizzle:O7,LucideCloudFog:D7,LucideCloudHail:R7,LucideCloudLightning:F7,LucideCloudMoon:B7,LucideCloudMoonRain:z7,LucideCloudOff:$7,LucideCloudRain:q7,LucideCloudRainWind:U7,LucideCloudSnow:V7,LucideCloudSun:W7,LucideCloudSunRain:H7,LucideCloudUpload:Db,LucideCloudy:K7,LucideClover:ty,LucideClub:Z7,LucideCode:Ej,LucideCode2:Rb,LucideCodeSquare:Q2,LucideCodeXml:Rb,LucideCodepen:Y7,LucideCodesandbox:X7,LucideCoffee:Ij,LucideCog:Q7,LucideCoins:J7,LucideColumns:Fb,LucideColumns2:Fb,LucideColumns3:zb,LucideColumns4:e9,LucideCombine:t9,LucideCommand:r9,LucideCompass:n9,LucideComponent:s9,LucideComputer:a9,LucideConciergeBell:i9,LucideCone:o9,LucideConstruction:l9,LucideContact:c9,LucideContact2:Bb,LucideContactRound:Bb,LucideContainer:d9,LucideContrast:u9,LucideCookie:h9,LucideCookingPot:m9,LucideCopy:Oo,LucideCopyCheck:f9,LucideCopyMinus:p9,LucideCopyPlus:g9,LucideCopySlash:x9,LucideCopyX:y9,LucideCopyleft:v9,LucideCopyright:_9,LucideCornerDownLeft:b9,LucideCornerDownRight:w9,LucideCornerLeftDown:j9,LucideCornerLeftUp:k9,LucideCornerRightDown:N9,LucideCornerRightUp:S9,LucideCornerUpLeft:C9,LucideCornerUpRight:M9,LucideCpu:T9,LucideCreativeCommons:A9,LucideCreditCard:hf,LucideCroissant:E9,LucideCrop:I9,LucideCross:P9,LucideCrosshair:L9,LucideCrown:q1,LucideCuboid:O9,LucideCupSoda:D9,LucideCurlyBraces:K_,LucideCurrency:R9,LucideCylinder:F9,LucideDam:z9,LucideDatabase:U9,LucideDatabaseBackup:B9,LucideDatabaseZap:$9,LucideDelete:q9,LucideDessert:V9,LucideDiameter:H9,LucideDiamond:K9,LucideDiamondMinus:W9,LucideDiamondPercent:$b,LucideDiamondPlus:G9,LucideDice1:Z9,LucideDice2:Y9,LucideDice3:X9,LucideDice4:Q9,LucideDice5:J9,LucideDice6:eB,LucideDices:tB,LucideDiff:rB,LucideDisc:iB,LucideDisc2:nB,LucideDisc3:sB,LucideDiscAlbum:aB,LucideDivide:oB,LucideDivideCircle:_b,LucideDivideSquare:rw,LucideDna:cB,LucideDnaOff:lB,LucideDock:dB,LucideDog:uB,LucideDollarSign:zd,LucideDonut:hB,LucideDoorClosed:mB,LucideDoorOpen:Pj,LucideDot:fB,LucideDotSquare:nw,LucideDownload:so,LucideDownloadCloud:Ob,LucideDraftingCompass:pB,LucideDrama:gB,LucideDribbble:xB,LucideDrill:yB,LucideDroplet:vB,LucideDroplets:_B,LucideDrum:bB,LucideDrumstick:wB,LucideDumbbell:jB,LucideEar:NB,LucideEarOff:kB,LucideEarth:Ub,LucideEarthLock:SB,LucideEclipse:CB,LucideEdit:gc,LucideEdit2:Y0,LucideEdit3:Z0,LucideEgg:j4,LucideEggFried:MB,LucideEggOff:TB,LucideEllipsis:gp,LucideEllipsisVertical:kg,LucideEqual:IB,LucideEqualApproximately:AB,LucideEqualNot:EB,LucideEqualSquare:sw,LucideEraser:PB,LucideEthernetPort:LB,LucideEuro:OB,LucideExpand:DB,LucideExternalLink:Ms,LucideEye:_o,LucideEyeClosed:RB,LucideEyeOff:Fg,LucideFacebook:au,LucideFactory:FB,LucideFan:zB,LucideFastForward:BB,LucideFeather:$B,LucideFence:UB,LucideFerrisWheel:qB,LucideFigma:VB,LucideFile:F$,LucideFileArchive:HB,LucideFileAudio:GB,LucideFileAudio2:WB,LucideFileAxis3D:qb,LucideFileAxis3d:qb,LucideFileBadge:ZB,LucideFileBadge2:KB,LucideFileBarChart:Vb,LucideFileBarChart2:Hb,LucideFileBox:YB,LucideFileChartColumn:Hb,LucideFileChartColumnIncreasing:Vb,LucideFileChartLine:Wb,LucideFileChartPie:Gb,LucideFileCheck:QB,LucideFileCheck2:XB,LucideFileClock:JB,LucideFileCode:t$,LucideFileCode2:e$,LucideFileCog:Kb,LucideFileCog2:Kb,LucideFileDiff:r$,LucideFileDigit:n$,LucideFileDown:s$,LucideFileEdit:Yb,LucideFileHeart:a$,LucideFileImage:V1,LucideFileInput:i$,LucideFileJson:l$,LucideFileJson2:o$,LucideFileKey:d$,LucideFileKey2:c$,LucideFileLineChart:Wb,LucideFileLock:h$,LucideFileLock2:u$,LucideFileMinus:f$,LucideFileMinus2:m$,LucideFileMusic:p$,LucideFileOutput:g$,LucideFilePen:Yb,LucideFilePenLine:Zb,LucideFilePieChart:Gb,LucideFilePlus:y$,LucideFilePlus2:x$,LucideFileQuestion:v$,LucideFileScan:_$,LucideFileSearch:w$,LucideFileSearch2:b$,LucideFileSignature:Zb,LucideFileSliders:j$,LucideFileSpreadsheet:H1,LucideFileStack:k$,LucideFileSymlink:N$,LucideFileTerminal:S$,LucideFileText:_a,LucideFileType:M$,LucideFileType2:C$,LucideFileUp:T$,LucideFileUser:A$,LucideFileVideo:I$,LucideFileVideo2:E$,LucideFileVolume:L$,LucideFileVolume2:P$,LucideFileWarning:O$,LucideFileX:R$,LucideFileX2:D$,LucideFiles:z$,LucideFilm:Ad,LucideFilter:W1,LucideFilterX:B$,LucideFingerprint:$$,LucideFireExtinguisher:U$,LucideFish:H$,LucideFishOff:q$,LucideFishSymbol:V$,LucideFlag:dy,LucideFlagOff:W$,LucideFlagTriangleLeft:G$,LucideFlagTriangleRight:K$,LucideFlame:pm,LucideFlameKindling:Z$,LucideFlashlight:X$,LucideFlashlightOff:Y$,LucideFlaskConical:Lj,LucideFlaskConicalOff:Q$,LucideFlaskRound:J$,LucideFlipHorizontal:tU,LucideFlipHorizontal2:eU,LucideFlipVertical:nU,LucideFlipVertical2:rU,LucideFlower:sU,LucideFlower2:bp,LucideFocus:aU,LucideFoldHorizontal:iU,LucideFoldVertical:oU,LucideFolder:LU,LucideFolderArchive:lU,LucideFolderCheck:cU,LucideFolderClock:dU,LucideFolderClosed:uU,LucideFolderCode:hU,LucideFolderCog:Xb,LucideFolderCog2:Xb,LucideFolderDot:mU,LucideFolderDown:fU,LucideFolderEdit:Qb,LucideFolderGit:gU,LucideFolderGit2:pU,LucideFolderHeart:xU,LucideFolderInput:yU,LucideFolderKanban:vU,LucideFolderKey:_U,LucideFolderLock:bU,LucideFolderMinus:wU,LucideFolderOpen:Ap,LucideFolderOpenDot:jU,LucideFolderOutput:kU,LucideFolderPen:Qb,LucideFolderPlus:NU,LucideFolderRoot:SU,LucideFolderSearch:MU,LucideFolderSearch2:CU,LucideFolderSymlink:TU,LucideFolderSync:AU,LucideFolderTree:EU,LucideFolderUp:IU,LucideFolderX:PU,LucideFolders:OU,LucideFootprints:DU,LucideForkKnife:qw,LucideForkKnifeCrossed:Uw,LucideForklift:RU,LucideFormInput:k2,LucideForward:FU,LucideFrame:zU,LucideFramer:BU,LucideFrown:$U,LucideFuel:UU,LucideFullscreen:qU,LucideFunctionSquare:aw,LucideGalleryHorizontal:HU,LucideGalleryHorizontalEnd:VU,LucideGalleryThumbnails:WU,LucideGalleryVertical:KU,LucideGalleryVerticalEnd:GU,LucideGamepad:YU,LucideGamepad2:ZU,LucideGanttChart:ab,LucideGanttChartSquare:pg,LucideGauge:XU,LucideGaugeCircle:bb,LucideGavel:QU,LucideGem:JU,LucideGhost:Oj,LucideGift:ao,LucideGitBranch:tq,LucideGitBranchPlus:eq,LucideGitCommit:Jb,LucideGitCommitHorizontal:Jb,LucideGitCommitVertical:rq,LucideGitCompare:sq,LucideGitCompareArrows:nq,LucideGitFork:aq,LucideGitGraph:iq,LucideGitMerge:oq,LucideGitPullRequest:mq,LucideGitPullRequestArrow:lq,LucideGitPullRequestClosed:cq,LucideGitPullRequestCreate:uq,LucideGitPullRequestCreateArrow:dq,LucideGitPullRequestDraft:hq,LucideGithub:fq,LucideGitlab:pq,LucideGlassWater:gq,LucideGlasses:xq,LucideGlobe:uy,LucideGlobe2:Ub,LucideGlobeLock:yq,LucideGoal:vq,LucideGrab:_q,LucideGraduationCap:G1,LucideGrape:bq,LucideGrid:rm,LucideGrid2X2:t2,LucideGrid2X2Plus:e2,LucideGrid2x2:t2,LucideGrid2x2Check:wq,LucideGrid2x2Plus:e2,LucideGrid2x2X:jq,LucideGrid3X3:rm,LucideGrid3x3:rm,LucideGrip:Nq,LucideGripHorizontal:kq,LucideGripVertical:zg,LucideGroup:Sq,LucideGuitar:Cq,LucideHam:Mq,LucideHammer:Tq,LucideHand:Lq,LucideHandCoins:Aq,LucideHandHeart:Eq,LucideHandHelping:r2,LucideHandMetal:Iq,LucideHandPlatter:Pq,LucideHandshake:Oq,LucideHardDrive:oA,LucideHardDriveDownload:Dq,LucideHardDriveUpload:Rq,LucideHardHat:Fq,LucideHash:k4,LucideHaze:zq,LucideHdmiPort:Bq,LucideHeading:Hq,LucideHeading1:lA,LucideHeading2:cA,LucideHeading3:$q,LucideHeading4:Uq,LucideHeading5:qq,LucideHeading6:Vq,LucideHeadphoneOff:Wq,LucideHeadphones:Gq,LucideHeadset:Kq,LucideHeart:bi,LucideHeartCrack:Zq,LucideHeartHandshake:Yq,LucideHeartOff:Xq,LucideHeartPulse:Qq,LucideHeater:Jq,LucideHelpCircle:Kx,LucideHelpingHand:r2,LucideHexagon:eV,LucideHighlighter:tV,LucideHistory:N4,LucideHome:ya,LucideHop:nV,LucideHopOff:rV,LucideHospital:sV,LucideHotel:aV,LucideHourglass:iV,LucideHouse:ya,LucideHousePlug:oV,LucideHousePlus:lV,LucideIceCream:s2,LucideIceCream2:n2,LucideIceCreamBowl:n2,LucideIceCreamCone:s2,LucideIdCard:cV,LucideImage:Fl,LucideImageDown:dV,LucideImageMinus:uV,LucideImageOff:hV,LucideImagePlay:mV,LucideImagePlus:Dj,LucideImageUp:fV,LucideImageUpscale:pV,LucideImages:gV,LucideImport:xV,LucideInbox:yV,LucideIndent:i2,LucideIndentDecrease:a2,LucideIndentIncrease:i2,LucideIndianRupee:vV,LucideInfinity:_V,LucideInfo:bV,LucideInspect:uw,LucideInspectionPanel:wV,LucideInstagram:_u,LucideItalic:S4,LucideIterationCcw:jV,LucideIterationCw:kV,LucideJapaneseYen:NV,LucideJoystick:SV,LucideKanban:hy,LucideKanbanSquare:iw,LucideKanbanSquareDashed:J2,LucideKey:gm,LucideKeyRound:Rj,LucideKeySquare:CV,LucideKeyboard:AV,LucideKeyboardMusic:MV,LucideKeyboardOff:TV,LucideLamp:DV,LucideLampCeiling:EV,LucideLampDesk:IV,LucideLampFloor:PV,LucideLampWallDown:LV,LucideLampWallUp:OV,LucideLandPlot:RV,LucideLandmark:FV,LucideLanguages:zV,LucideLaptop:$V,LucideLaptop2:o2,LucideLaptopMinimal:o2,LucideLaptopMinimalCheck:BV,LucideLasso:qV,LucideLassoSelect:UV,LucideLaugh:VV,LucideLayers:GV,LucideLayers2:HV,LucideLayers3:WV,LucideLayout:K0,LucideLayoutDashboard:Fj,LucideLayoutGrid:mf,LucideLayoutList:KV,LucideLayoutPanelLeft:ZV,LucideLayoutPanelTop:YV,LucideLayoutTemplate:zj,LucideLeaf:XV,LucideLeafyGreen:QV,LucideLectern:JV,LucideLetterText:eH,LucideLibrary:C4,LucideLibraryBig:tH,LucideLibrarySquare:ow,LucideLifeBuoy:M4,LucideLigature:rH,LucideLightbulb:my,LucideLightbulbOff:nH,LucideLineChart:rb,LucideLink:Ro,LucideLink2:xm,LucideLink2Off:sH,LucideLinkedin:ym,LucideList:ff,LucideListCheck:aH,LucideListChecks:iH,LucideListCollapse:oH,LucideListEnd:lH,LucideListFilter:cH,LucideListMinus:dH,LucideListMusic:uH,LucideListOrdered:T4,LucideListPlus:hH,LucideListRestart:mH,LucideListStart:fH,LucideListTodo:pH,LucideListTree:gH,LucideListVideo:xH,LucideListX:yH,LucideLoader:_H,LucideLoader2:Wr,LucideLoaderCircle:Wr,LucideLoaderPinwheel:vH,LucideLocate:dA,LucideLocateFixed:bH,LucideLocateOff:wH,LucideLock:th,LucideLockKeyhole:jH,LucideLockKeyholeOpen:l2,LucideLockOpen:c2,LucideLogIn:A4,LucideLogOut:E4,LucideLogs:kH,LucideLollipop:NH,LucideLuggage:SH,LucideMSquare:lw,LucideMagnet:CH,LucideMail:ks,LucideMailCheck:MH,LucideMailMinus:TH,LucideMailOpen:AH,LucideMailPlus:EH,LucideMailQuestion:IH,LucideMailSearch:PH,LucideMailWarning:LH,LucideMailX:uA,LucideMailbox:OH,LucideMails:DH,LucideMap:KH,LucideMapPin:Fo,LucideMapPinCheck:FH,LucideMapPinCheckInside:RH,LucideMapPinHouse:zH,LucideMapPinMinus:$H,LucideMapPinMinusInside:BH,LucideMapPinOff:UH,LucideMapPinPlus:VH,LucideMapPinPlusInside:qH,LucideMapPinX:WH,LucideMapPinXInside:HH,LucideMapPinned:GH,LucideMartini:ZH,LucideMaximize:XH,LucideMaximize2:YH,LucideMedal:fy,LucideMegaphone:Ep,LucideMegaphoneOff:QH,LucideMeh:JH,LucideMemoryStick:eW,LucideMenu:hA,LucideMenuSquare:cw,LucideMerge:tW,LucideMessageCircle:Ul,LucideMessageCircleCode:rW,LucideMessageCircleDashed:nW,LucideMessageCircleHeart:I4,LucideMessageCircleMore:sW,LucideMessageCircleOff:aW,LucideMessageCirclePlus:iW,LucideMessageCircleQuestion:mA,LucideMessageCircleReply:oW,LucideMessageCircleWarning:lW,LucideMessageCircleX:cW,LucideMessageSquare:zo,LucideMessageSquareCode:dW,LucideMessageSquareDashed:uW,LucideMessageSquareDiff:hW,LucideMessageSquareDot:mW,LucideMessageSquareHeart:fA,LucideMessageSquareLock:fW,LucideMessageSquareMore:pW,LucideMessageSquareOff:gW,LucideMessageSquarePlus:xW,LucideMessageSquareQuote:pA,LucideMessageSquareReply:yW,LucideMessageSquareShare:vW,LucideMessageSquareText:_W,LucideMessageSquareWarning:bW,LucideMessageSquareX:wW,LucideMessagesSquare:jW,LucideMic:gA,LucideMic2:d2,LucideMicOff:kW,LucideMicVocal:d2,LucideMicrochip:NW,LucideMicroscope:SW,LucideMicrowave:CW,LucideMilestone:MW,LucideMilk:AW,LucideMilkOff:TW,LucideMinimize:IW,LucideMinimize2:EW,LucideMinus:K1,LucideMinusCircle:wb,LucideMinusSquare:dw,LucideMonitor:Bj,LucideMonitorCheck:PW,LucideMonitorCog:LW,LucideMonitorDot:OW,LucideMonitorDown:DW,LucideMonitorOff:RW,LucideMonitorPause:FW,LucideMonitorPlay:zW,LucideMonitorSmartphone:BW,LucideMonitorSpeaker:$W,LucideMonitorStop:UW,LucideMonitorUp:qW,LucideMonitorX:VW,LucideMoon:WW,LucideMoonStar:HW,LucideMoreHorizontal:gp,LucideMoreVertical:kg,LucideMountain:KW,LucideMountainSnow:GW,LucideMouse:JW,LucideMouseOff:ZW,LucideMousePointer:QW,LucideMousePointer2:YW,LucideMousePointerBan:XW,LucideMousePointerClick:Z1,LucideMousePointerSquareDashed:ew,LucideMove:hG,LucideMove3D:u2,LucideMove3d:u2,LucideMoveDiagonal:tG,LucideMoveDiagonal2:eG,LucideMoveDown:sG,LucideMoveDownLeft:rG,LucideMoveDownRight:nG,LucideMoveHorizontal:aG,LucideMoveLeft:iG,LucideMoveRight:oG,LucideMoveUp:dG,LucideMoveUpLeft:lG,LucideMoveUpRight:cG,LucideMoveVertical:uG,LucideMusic:gG,LucideMusic2:mG,LucideMusic3:fG,LucideMusic4:pG,LucideNavigation:xA,LucideNavigation2:yG,LucideNavigation2Off:xG,LucideNavigationOff:vG,LucideNetwork:_G,LucideNewspaper:py,LucideNfc:bG,LucideNotebook:NG,LucideNotebookPen:wG,LucideNotebookTabs:jG,LucideNotebookText:kG,LucideNotepadText:CG,LucideNotepadTextDashed:SG,LucideNut:TG,LucideNutOff:MG,LucideOctagon:EG,LucideOctagonAlert:h2,LucideOctagonMinus:AG,LucideOctagonPause:m2,LucideOctagonX:f2,LucideOmega:IG,LucideOption:PG,LucideOrbit:LG,LucideOrigami:OG,LucideOutdent:a2,LucidePackage:ql,LucidePackage2:DG,LucidePackageCheck:RG,LucidePackageMinus:FG,LucidePackageOpen:zG,LucidePackagePlus:BG,LucidePackageSearch:$G,LucidePackageX:UG,LucidePaintBucket:qG,LucidePaintRoller:VG,LucidePaintbrush:HG,LucidePaintbrush2:p2,LucidePaintbrushVertical:p2,LucidePalette:Vc,LucidePalmtree:Iw,LucidePanelBottom:KG,LucidePanelBottomClose:WG,LucidePanelBottomDashed:g2,LucidePanelBottomInactive:g2,LucidePanelBottomOpen:GG,LucidePanelLeft:_2,LucidePanelLeftClose:x2,LucidePanelLeftDashed:y2,LucidePanelLeftInactive:y2,LucidePanelLeftOpen:v2,LucidePanelRight:XG,LucidePanelRightClose:ZG,LucidePanelRightDashed:b2,LucidePanelRightInactive:b2,LucidePanelRightOpen:YG,LucidePanelTop:eK,LucidePanelTopClose:QG,LucidePanelTopDashed:w2,LucidePanelTopInactive:w2,LucidePanelTopOpen:JG,LucidePanelsLeftBottom:tK,LucidePanelsLeftRight:zb,LucidePanelsRightBottom:rK,LucidePanelsTopBottom:C2,LucidePanelsTopLeft:K0,LucidePaperclip:P4,LucideParentheses:nK,LucideParkingCircle:kb,LucideParkingCircleOff:jb,LucideParkingMeter:sK,LucideParkingSquare:mw,LucideParkingSquareOff:hw,LucidePartyPopper:Hc,LucidePause:vm,LucidePauseCircle:Nb,LucidePauseOctagon:m2,LucidePawPrint:aK,LucidePcCase:iK,LucidePen:Y0,LucidePenBox:gc,LucidePenLine:Z0,LucidePenOff:oK,LucidePenSquare:gc,LucidePenTool:$j,LucidePencil:Ja,LucidePencilLine:lK,LucidePencilOff:cK,LucidePencilRuler:dK,LucidePentagon:uK,LucidePercent:L4,LucidePercentCircle:Sb,LucidePercentDiamond:$b,LucidePercentSquare:fw,LucidePersonStanding:hK,LucidePhilippinePeso:mK,LucidePhone:Ii,LucidePhoneCall:fK,LucidePhoneForwarded:pK,LucidePhoneIncoming:gK,LucidePhoneMissed:xK,LucidePhoneOff:yK,LucidePhoneOutgoing:vK,LucidePi:_K,LucidePiSquare:pw,LucidePiano:bK,LucidePickaxe:wK,LucidePictureInPicture:kK,LucidePictureInPicture2:jK,LucidePieChart:ib,LucidePiggyBank:NK,LucidePilcrow:MK,LucidePilcrowLeft:SK,LucidePilcrowRight:CK,LucidePilcrowSquare:gw,LucidePill:AK,LucidePillBottle:TK,LucidePin:Y1,LucidePinOff:yA,LucidePipette:EK,LucidePizza:IK,LucidePlane:OK,LucidePlaneLanding:PK,LucidePlaneTakeoff:LK,LucidePlay:Vl,LucidePlayCircle:nf,LucidePlaySquare:xw,LucidePlug:vA,LucidePlug2:DK,LucidePlugZap:j2,LucidePlugZap2:j2,LucidePlus:bn,LucidePlusCircle:Cb,LucidePlusSquare:yw,LucidePocket:FK,LucidePocketKnife:RK,LucidePodcast:zK,LucidePointer:$K,LucidePointerOff:BK,LucidePopcorn:UK,LucidePopsicle:qK,LucidePoundSterling:VK,LucidePower:WK,LucidePowerCircle:Mb,LucidePowerOff:HK,LucidePowerSquare:vw,LucidePresentation:gy,LucidePrinter:KK,LucidePrinterCheck:GK,LucideProjector:ZK,LucideProportions:YK,LucidePuzzle:XK,LucidePyramid:QK,LucideQrCode:_A,LucideQuote:bA,LucideRabbit:JK,LucideRadar:eZ,LucideRadiation:tZ,LucideRadical:rZ,LucideRadio:Uj,LucideRadioReceiver:nZ,LucideRadioTower:sZ,LucideRadius:aZ,LucideRailSymbol:iZ,LucideRainbow:oZ,LucideRat:lZ,LucideRatio:cZ,LucideReceipt:yZ,LucideReceiptCent:dZ,LucideReceiptEuro:uZ,LucideReceiptIndianRupee:hZ,LucideReceiptJapaneseYen:mZ,LucideReceiptPoundSterling:fZ,LucideReceiptRussianRuble:pZ,LucideReceiptSwissFranc:gZ,LucideReceiptText:xZ,LucideRectangleEllipsis:k2,LucideRectangleHorizontal:vZ,LucideRectangleVertical:_Z,LucideRecycle:bZ,LucideRedo:O4,LucideRedo2:wZ,LucideRedoDot:jZ,LucideRefreshCcw:NZ,LucideRefreshCcwDot:kZ,LucideRefreshCw:Wo,LucideRefreshCwOff:SZ,LucideRefrigerator:CZ,LucideRegex:MZ,LucideRemoveFormatting:TZ,LucideRepeat:wA,LucideRepeat1:AZ,LucideRepeat2:EZ,LucideReplace:PZ,LucideReplaceAll:IZ,LucideReply:jA,LucideReplyAll:LZ,LucideRewind:OZ,LucideRibbon:DZ,LucideRocket:Bg,LucideRockingChair:RZ,LucideRollerCoaster:FZ,LucideRotate3D:N2,LucideRotate3d:N2,LucideRotateCcw:D4,LucideRotateCcwSquare:zZ,LucideRotateCw:kA,LucideRotateCwSquare:BZ,LucideRoute:UZ,LucideRouteOff:$Z,LucideRouter:qZ,LucideRows:S2,LucideRows2:S2,LucideRows3:C2,LucideRows4:VZ,LucideRss:HZ,LucideRuler:WZ,LucideRussianRuble:GZ,LucideSailboat:KZ,LucideSalad:ZZ,LucideSandwich:YZ,LucideSatellite:QZ,LucideSatelliteDish:XZ,LucideSave:Ip,LucideSaveAll:JZ,LucideSaveOff:eY,LucideScale:tY,LucideScale3D:M2,LucideScale3d:M2,LucideScaling:rY,LucideScan:dY,LucideScanBarcode:nY,LucideScanEye:sY,LucideScanFace:aY,LucideScanLine:iY,LucideScanQrCode:oY,LucideScanSearch:lY,LucideScanText:cY,LucideScatterChart:ob,LucideSchool:uY,LucideSchool2:Lw,LucideScissors:mY,LucideScissorsLineDashed:hY,LucideScissorsSquare:_w,LucideScissorsSquareDashedBottom:W2,LucideScreenShare:pY,LucideScreenShareOff:fY,LucideScroll:xY,LucideScrollText:gY,LucideSearch:ma,LucideSearchCheck:yY,LucideSearchCode:vY,LucideSearchSlash:_Y,LucideSearchX:bY,LucideSection:wY,LucideSend:Ji,LucideSendHorizonal:T2,LucideSendHorizontal:T2,LucideSendToBack:jY,LucideSeparatorHorizontal:kY,LucideSeparatorVertical:NY,LucideServer:TY,LucideServerCog:SY,LucideServerCrash:CY,LucideServerOff:MY,LucideSettings:Bd,LucideSettings2:AY,LucideShapes:EY,LucideShare:NA,LucideShare2:Nc,LucideSheet:IY,LucideShell:PY,LucideShield:_m,LucideShieldAlert:LY,LucideShieldBan:OY,LucideShieldCheck:SA,LucideShieldClose:A2,LucideShieldEllipsis:DY,LucideShieldHalf:RY,LucideShieldMinus:FY,LucideShieldOff:zY,LucideShieldPlus:BY,LucideShieldQuestion:$Y,LucideShieldX:A2,LucideShip:qY,LucideShipWheel:UY,LucideShirt:VY,LucideShoppingBag:$g,LucideShoppingBasket:HY,LucideShoppingCart:Eh,LucideShovel:WY,LucideShowerHead:GY,LucideShrink:KY,LucideShrub:ZY,LucideShuffle:YY,LucideSidebar:_2,LucideSidebarClose:x2,LucideSidebarOpen:v2,LucideSigma:XY,LucideSigmaSquare:bw,LucideSignal:rX,LucideSignalHigh:QY,LucideSignalLow:JY,LucideSignalMedium:eX,LucideSignalZero:tX,LucideSignature:nX,LucideSignpost:aX,LucideSignpostBig:sX,LucideSiren:iX,LucideSkipBack:oX,LucideSkipForward:lX,LucideSkull:cX,LucideSlack:dX,LucideSlash:uX,LucideSlashSquare:ww,LucideSlice:hX,LucideSliders:E2,LucideSlidersHorizontal:CA,LucideSlidersVertical:E2,LucideSmartphone:xy,LucideSmartphoneCharging:mX,LucideSmartphoneNfc:fX,LucideSmile:gX,LucideSmilePlus:pX,LucideSnail:xX,LucideSnowflake:S1,LucideSofa:yX,LucideSortAsc:$_,LucideSortDesc:F_,LucideSoup:vX,LucideSpace:_X,LucideSpade:bX,LucideSparkle:wX,LucideSparkles:Ds,LucideSpeaker:jX,LucideSpeech:kX,LucideSpellCheck:SX,LucideSpellCheck2:NX,LucideSpline:CX,LucideSplit:MX,LucideSplitSquareHorizontal:jw,LucideSplitSquareVertical:kw,LucideSprayCan:TX,LucideSprout:AX,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:X0,LucideSquareChevronDown:K2,LucideSquareChevronLeft:Z2,LucideSquareChevronRight:Y2,LucideSquareChevronUp:X2,LucideSquareCode:Q2,LucideSquareDashed:tw,LucideSquareDashedBottom:IX,LucideSquareDashedBottomCode:EX,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:PX,LucideSquareScissors:_w,LucideSquareSigma:bw,LucideSquareSlash:ww,LucideSquareSplitHorizontal:jw,LucideSquareSplitVertical:kw,LucideSquareSquare:LX,LucideSquareStack:OX,LucideSquareTerminal:Nw,LucideSquareUser:Cw,LucideSquareUserRound:Sw,LucideSquareX:Mw,LucideSquircle:DX,LucideSquirrel:RX,LucideStamp:FX,LucideStar:Ss,LucideStarHalf:zX,LucideStarOff:BX,LucideStars:Ds,LucideStepBack:$X,LucideStepForward:UX,LucideStethoscope:qX,LucideSticker:VX,LucideStickyNote:HX,LucideStopCircle:Ab,LucideStore:WX,LucideStretchHorizontal:GX,LucideStretchVertical:KX,LucideStrikethrough:ZX,LucideSubscript:YX,LucideSubtitles:Z_,LucideSun:X1,LucideSunDim:XX,LucideSunMedium:QX,LucideSunMoon:JX,LucideSunSnow:eQ,LucideSunrise:tQ,LucideSunset:rQ,LucideSuperscript:nQ,LucideSwatchBook:sQ,LucideSwissFranc:aQ,LucideSwitchCamera:iQ,LucideSword:oQ,LucideSwords:lQ,LucideSyringe:cQ,LucideTable:gQ,LucideTable2:R4,LucideTableCellsMerge:dQ,LucideTableCellsSplit:uQ,LucideTableColumnsSplit:hQ,LucideTableOfContents:mQ,LucideTableProperties:fQ,LucideTableRowsSplit:pQ,LucideTablet:yQ,LucideTabletSmartphone:xQ,LucideTablets:vQ,LucideTag:qg,LucideTags:_Q,LucideTally1:bQ,LucideTally2:wQ,LucideTally3:jQ,LucideTally4:kQ,LucideTally5:NQ,LucideTangent:SQ,LucideTarget:yy,LucideTelescope:CQ,LucideTent:TQ,LucideTentTree:MQ,LucideTerminal:AQ,LucideTerminalSquare:Nw,LucideTestTube:EQ,LucideTestTube2:Tw,LucideTestTubeDiagonal:Tw,LucideTestTubes:IQ,LucideText:RQ,LucideTextCursor:LQ,LucideTextCursorInput:PQ,LucideTextQuote:OQ,LucideTextSearch:DQ,LucideTextSelect:Aw,LucideTextSelection:Aw,LucideTheater:FQ,LucideThermometer:$Q,LucideThermometerSnowflake:zQ,LucideThermometerSun:BQ,LucideThumbsDown:MA,LucideThumbsUp:pd,LucideTicket:TA,LucideTicketCheck:UQ,LucideTicketMinus:qQ,LucideTicketPercent:VQ,LucideTicketPlus:HQ,LucideTicketSlash:WQ,LucideTicketX:GQ,LucideTickets:ZQ,LucideTicketsPlane:KQ,LucideTimer:QQ,LucideTimerOff:YQ,LucideTimerReset:XQ,LucideToggleLeft:JQ,LucideToggleRight:eJ,LucideToilet:tJ,LucideTornado:rJ,LucideTorus:nJ,LucideTouchpad:aJ,LucideTouchpadOff:sJ,LucideTowerControl:iJ,LucideToyBrick:oJ,LucideTractor:lJ,LucideTrafficCone:cJ,LucideTrain:Ew,LucideTrainFront:uJ,LucideTrainFrontTunnel:dJ,LucideTrainTrack:hJ,LucideTramFront:Ew,LucideTrash:mJ,LucideTrash2:Un,LucideTreeDeciduous:fJ,LucideTreePalm:Iw,LucideTreePine:Q1,LucideTrees:pJ,LucideTrello:gJ,LucideTrendingDown:qj,LucideTrendingUp:rh,LucideTrendingUpDown:xJ,LucideTriangle:vJ,LucideTriangleAlert:Gu,LucideTriangleRight:yJ,LucideTrophy:io,LucideTruck:AA,LucideTurtle:_J,LucideTv:wJ,LucideTv2:Pw,LucideTvMinimal:Pw,LucideTvMinimalPlay:bJ,LucideTwitch:jJ,LucideTwitter:kJ,LucideType:SJ,LucideTypeOutline:NJ,LucideUmbrella:MJ,LucideUmbrellaOff:CJ,LucideUnderline:TJ,LucideUndo:F4,LucideUndo2:AJ,LucideUndoDot:EJ,LucideUnfoldHorizontal:IJ,LucideUnfoldVertical:PJ,LucideUngroup:LJ,LucideUniversity:Lw,LucideUnlink:EA,LucideUnlink2:OJ,LucideUnlock:c2,LucideUnlockKeyhole:l2,LucideUnplug:DJ,LucideUpload:bo,LucideUploadCloud:Db,LucideUsb:RJ,LucideUser:ic,LucideUser2:Bw,LucideUserCheck:Vj,LucideUserCheck2:Ow,LucideUserCircle:Ib,LucideUserCircle2:Eb,LucideUserCog:IA,LucideUserCog2:Dw,LucideUserMinus:FJ,LucideUserMinus2:Rw,LucideUserPen:zJ,LucideUserPlus:nh,LucideUserPlus2:Fw,LucideUserRound:Bw,LucideUserRoundCheck:Ow,LucideUserRoundCog:Dw,LucideUserRoundMinus:Rw,LucideUserRoundPen:BJ,LucideUserRoundPlus:Fw,LucideUserRoundSearch:$J,LucideUserRoundX:zw,LucideUserSearch:UJ,LucideUserSquare:Cw,LucideUserSquare2:Sw,LucideUserX:qJ,LucideUserX2:zw,LucideUsers:qn,LucideUsers2:$w,LucideUsersRound:$w,LucideUtensils:qw,LucideUtensilsCrossed:Uw,LucideUtilityPole:VJ,LucideVariable:PA,LucideVault:HJ,LucideVegan:WJ,LucideVenetianMask:GJ,LucideVerified:V_,LucideVibrate:ZJ,LucideVibrateOff:KJ,LucideVideo:Pa,LucideVideoOff:YJ,LucideVideotape:XJ,LucideView:QJ,LucideVoicemail:JJ,LucideVolleyball:eee,LucideVolume:aee,LucideVolume1:tee,LucideVolume2:ree,LucideVolumeOff:nee,LucideVolumeX:see,LucideVote:iee,LucideWallet:lee,LucideWallet2:Vw,LucideWalletCards:oee,LucideWalletMinimal:Vw,LucideWallpaper:cee,LucideWand:dee,LucideWand2:Hw,LucideWandSparkles:Hw,LucideWarehouse:uee,LucideWashingMachine:hee,LucideWatch:mee,LucideWaves:fee,LucideWaypoints:pee,LucideWebcam:gee,LucideWebhook:yee,LucideWebhookOff:xee,LucideWeight:vee,LucideWheat:bee,LucideWheatOff:_ee,LucideWholeWord:wee,LucideWifi:Cee,LucideWifiHigh:jee,LucideWifiLow:kee,LucideWifiOff:Nee,LucideWifiZero:See,LucideWind:Tee,LucideWindArrowDown:Mee,LucideWine:Eee,LucideWineOff:Aee,LucideWorkflow:Iee,LucideWorm:Pee,LucideWrapText:Lee,LucideWrench:vy,LucideX:us,LucideXCircle:bc,LucideXOctagon:f2,LucideXSquare:Mw,LucideYoutube:Oee,LucideZap:Vg,LucideZapOff:Dee,LucideZoomIn:z4,LucideZoomOut:B4,Luggage:SH,LuggageIcon:SH,MSquare:lw,MSquareIcon:lw,Magnet:CH,MagnetIcon:CH,Mail:ks,MailCheck:MH,MailCheckIcon:MH,MailIcon:ks,MailMinus:TH,MailMinusIcon:TH,MailOpen:AH,MailOpenIcon:AH,MailPlus:EH,MailPlusIcon:EH,MailQuestion:IH,MailQuestionIcon:IH,MailSearch:PH,MailSearchIcon:PH,MailWarning:LH,MailWarningIcon:LH,MailX:uA,MailXIcon:uA,Mailbox:OH,MailboxIcon:OH,Mails:DH,MailsIcon:DH,Map:KH,MapIcon:KH,MapPin:Fo,MapPinCheck:FH,MapPinCheckIcon:FH,MapPinCheckInside:RH,MapPinCheckInsideIcon:RH,MapPinHouse:zH,MapPinHouseIcon:zH,MapPinIcon:Fo,MapPinMinus:$H,MapPinMinusIcon:$H,MapPinMinusInside:BH,MapPinMinusInsideIcon:BH,MapPinOff:UH,MapPinOffIcon:UH,MapPinPlus:VH,MapPinPlusIcon:VH,MapPinPlusInside:qH,MapPinPlusInsideIcon:qH,MapPinX:WH,MapPinXIcon:WH,MapPinXInside:HH,MapPinXInsideIcon:HH,MapPinned:GH,MapPinnedIcon:GH,Martini:ZH,MartiniIcon:ZH,Maximize:XH,Maximize2:YH,Maximize2Icon:YH,MaximizeIcon:XH,Medal:fy,MedalIcon:fy,Megaphone:Ep,MegaphoneIcon:Ep,MegaphoneOff:QH,MegaphoneOffIcon:QH,Meh:JH,MehIcon:JH,MemoryStick:eW,MemoryStickIcon:eW,Menu:hA,MenuIcon:hA,MenuSquare:cw,MenuSquareIcon:cw,Merge:tW,MergeIcon:tW,MessageCircle:Ul,MessageCircleCode:rW,MessageCircleCodeIcon:rW,MessageCircleDashed:nW,MessageCircleDashedIcon:nW,MessageCircleHeart:I4,MessageCircleHeartIcon:I4,MessageCircleIcon:Ul,MessageCircleMore:sW,MessageCircleMoreIcon:sW,MessageCircleOff:aW,MessageCircleOffIcon:aW,MessageCirclePlus:iW,MessageCirclePlusIcon:iW,MessageCircleQuestion:mA,MessageCircleQuestionIcon:mA,MessageCircleReply:oW,MessageCircleReplyIcon:oW,MessageCircleWarning:lW,MessageCircleWarningIcon:lW,MessageCircleX:cW,MessageCircleXIcon:cW,MessageSquare:zo,MessageSquareCode:dW,MessageSquareCodeIcon:dW,MessageSquareDashed:uW,MessageSquareDashedIcon:uW,MessageSquareDiff:hW,MessageSquareDiffIcon:hW,MessageSquareDot:mW,MessageSquareDotIcon:mW,MessageSquareHeart:fA,MessageSquareHeartIcon:fA,MessageSquareIcon:zo,MessageSquareLock:fW,MessageSquareLockIcon:fW,MessageSquareMore:pW,MessageSquareMoreIcon:pW,MessageSquareOff:gW,MessageSquareOffIcon:gW,MessageSquarePlus:xW,MessageSquarePlusIcon:xW,MessageSquareQuote:pA,MessageSquareQuoteIcon:pA,MessageSquareReply:yW,MessageSquareReplyIcon:yW,MessageSquareShare:vW,MessageSquareShareIcon:vW,MessageSquareText:_W,MessageSquareTextIcon:_W,MessageSquareWarning:bW,MessageSquareWarningIcon:bW,MessageSquareX:wW,MessageSquareXIcon:wW,MessagesSquare:jW,MessagesSquareIcon:jW,Mic:gA,Mic2:d2,Mic2Icon:d2,MicIcon:gA,MicOff:kW,MicOffIcon:kW,MicVocal:d2,MicVocalIcon:d2,Microchip:NW,MicrochipIcon:NW,Microscope:SW,MicroscopeIcon:SW,Microwave:CW,MicrowaveIcon:CW,Milestone:MW,MilestoneIcon:MW,Milk:AW,MilkIcon:AW,MilkOff:TW,MilkOffIcon:TW,Minimize:IW,Minimize2:EW,Minimize2Icon:EW,MinimizeIcon:IW,Minus:K1,MinusCircle:wb,MinusCircleIcon:wb,MinusIcon:K1,MinusSquare:dw,MinusSquareIcon:dw,Monitor:Bj,MonitorCheck:PW,MonitorCheckIcon:PW,MonitorCog:LW,MonitorCogIcon:LW,MonitorDot:OW,MonitorDotIcon:OW,MonitorDown:DW,MonitorDownIcon:DW,MonitorIcon:Bj,MonitorOff:RW,MonitorOffIcon:RW,MonitorPause:FW,MonitorPauseIcon:FW,MonitorPlay:zW,MonitorPlayIcon:zW,MonitorSmartphone:BW,MonitorSmartphoneIcon:BW,MonitorSpeaker:$W,MonitorSpeakerIcon:$W,MonitorStop:UW,MonitorStopIcon:UW,MonitorUp:qW,MonitorUpIcon:qW,MonitorX:VW,MonitorXIcon:VW,Moon:WW,MoonIcon:WW,MoonStar:HW,MoonStarIcon:HW,MoreHorizontal:gp,MoreHorizontalIcon:gp,MoreVertical:kg,MoreVerticalIcon:kg,Mountain:KW,MountainIcon:KW,MountainSnow:GW,MountainSnowIcon:GW,Mouse:JW,MouseIcon:JW,MouseOff:ZW,MouseOffIcon:ZW,MousePointer:QW,MousePointer2:YW,MousePointer2Icon:YW,MousePointerBan:XW,MousePointerBanIcon:XW,MousePointerClick:Z1,MousePointerClickIcon:Z1,MousePointerIcon:QW,MousePointerSquareDashed:ew,MousePointerSquareDashedIcon:ew,Move:hG,Move3D:u2,Move3DIcon:u2,Move3d:u2,Move3dIcon:u2,MoveDiagonal:tG,MoveDiagonal2:eG,MoveDiagonal2Icon:eG,MoveDiagonalIcon:tG,MoveDown:sG,MoveDownIcon:sG,MoveDownLeft:rG,MoveDownLeftIcon:rG,MoveDownRight:nG,MoveDownRightIcon:nG,MoveHorizontal:aG,MoveHorizontalIcon:aG,MoveIcon:hG,MoveLeft:iG,MoveLeftIcon:iG,MoveRight:oG,MoveRightIcon:oG,MoveUp:dG,MoveUpIcon:dG,MoveUpLeft:lG,MoveUpLeftIcon:lG,MoveUpRight:cG,MoveUpRightIcon:cG,MoveVertical:uG,MoveVerticalIcon:uG,Music:gG,Music2:mG,Music2Icon:mG,Music3:fG,Music3Icon:fG,Music4:pG,Music4Icon:pG,MusicIcon:gG,Navigation:xA,Navigation2:yG,Navigation2Icon:yG,Navigation2Off:xG,Navigation2OffIcon:xG,NavigationIcon:xA,NavigationOff:vG,NavigationOffIcon:vG,Network:_G,NetworkIcon:_G,Newspaper:py,NewspaperIcon:py,Nfc:bG,NfcIcon:bG,Notebook:NG,NotebookIcon:NG,NotebookPen:wG,NotebookPenIcon:wG,NotebookTabs:jG,NotebookTabsIcon:jG,NotebookText:kG,NotebookTextIcon:kG,NotepadText:CG,NotepadTextDashed:SG,NotepadTextDashedIcon:SG,NotepadTextIcon:CG,Nut:TG,NutIcon:TG,NutOff:MG,NutOffIcon:MG,Octagon:EG,OctagonAlert:h2,OctagonAlertIcon:h2,OctagonIcon:EG,OctagonMinus:AG,OctagonMinusIcon:AG,OctagonPause:m2,OctagonPauseIcon:m2,OctagonX:f2,OctagonXIcon:f2,Omega:IG,OmegaIcon:IG,Option:PG,OptionIcon:PG,Orbit:LG,OrbitIcon:LG,Origami:OG,OrigamiIcon:OG,Outdent:a2,OutdentIcon:a2,Package:ql,Package2:DG,Package2Icon:DG,PackageCheck:RG,PackageCheckIcon:RG,PackageIcon:ql,PackageMinus:FG,PackageMinusIcon:FG,PackageOpen:zG,PackageOpenIcon:zG,PackagePlus:BG,PackagePlusIcon:BG,PackageSearch:$G,PackageSearchIcon:$G,PackageX:UG,PackageXIcon:UG,PaintBucket:qG,PaintBucketIcon:qG,PaintRoller:VG,PaintRollerIcon:VG,Paintbrush:HG,Paintbrush2:p2,Paintbrush2Icon:p2,PaintbrushIcon:HG,PaintbrushVertical:p2,PaintbrushVerticalIcon:p2,Palette:Vc,PaletteIcon:Vc,Palmtree:Iw,PalmtreeIcon:Iw,PanelBottom:KG,PanelBottomClose:WG,PanelBottomCloseIcon:WG,PanelBottomDashed:g2,PanelBottomDashedIcon:g2,PanelBottomIcon:KG,PanelBottomInactive:g2,PanelBottomInactiveIcon:g2,PanelBottomOpen:GG,PanelBottomOpenIcon:GG,PanelLeft:_2,PanelLeftClose:x2,PanelLeftCloseIcon:x2,PanelLeftDashed:y2,PanelLeftDashedIcon:y2,PanelLeftIcon:_2,PanelLeftInactive:y2,PanelLeftInactiveIcon:y2,PanelLeftOpen:v2,PanelLeftOpenIcon:v2,PanelRight:XG,PanelRightClose:ZG,PanelRightCloseIcon:ZG,PanelRightDashed:b2,PanelRightDashedIcon:b2,PanelRightIcon:XG,PanelRightInactive:b2,PanelRightInactiveIcon:b2,PanelRightOpen:YG,PanelRightOpenIcon:YG,PanelTop:eK,PanelTopClose:QG,PanelTopCloseIcon:QG,PanelTopDashed:w2,PanelTopDashedIcon:w2,PanelTopIcon:eK,PanelTopInactive:w2,PanelTopInactiveIcon:w2,PanelTopOpen:JG,PanelTopOpenIcon:JG,PanelsLeftBottom:tK,PanelsLeftBottomIcon:tK,PanelsLeftRight:zb,PanelsLeftRightIcon:zb,PanelsRightBottom:rK,PanelsRightBottomIcon:rK,PanelsTopBottom:C2,PanelsTopBottomIcon:C2,PanelsTopLeft:K0,PanelsTopLeftIcon:K0,Paperclip:P4,PaperclipIcon:P4,Parentheses:nK,ParenthesesIcon:nK,ParkingCircle:kb,ParkingCircleIcon:kb,ParkingCircleOff:jb,ParkingCircleOffIcon:jb,ParkingMeter:sK,ParkingMeterIcon:sK,ParkingSquare:mw,ParkingSquareIcon:mw,ParkingSquareOff:hw,ParkingSquareOffIcon:hw,PartyPopper:Hc,PartyPopperIcon:Hc,Pause:vm,PauseCircle:Nb,PauseCircleIcon:Nb,PauseIcon:vm,PauseOctagon:m2,PauseOctagonIcon:m2,PawPrint:aK,PawPrintIcon:aK,PcCase:iK,PcCaseIcon:iK,Pen:Y0,PenBox:gc,PenBoxIcon:gc,PenIcon:Y0,PenLine:Z0,PenLineIcon:Z0,PenOff:oK,PenOffIcon:oK,PenSquare:gc,PenSquareIcon:gc,PenTool:$j,PenToolIcon:$j,Pencil:Ja,PencilIcon:Ja,PencilLine:lK,PencilLineIcon:lK,PencilOff:cK,PencilOffIcon:cK,PencilRuler:dK,PencilRulerIcon:dK,Pentagon:uK,PentagonIcon:uK,Percent:L4,PercentCircle:Sb,PercentCircleIcon:Sb,PercentDiamond:$b,PercentDiamondIcon:$b,PercentIcon:L4,PercentSquare:fw,PercentSquareIcon:fw,PersonStanding:hK,PersonStandingIcon:hK,PhilippinePeso:mK,PhilippinePesoIcon:mK,Phone:Ii,PhoneCall:fK,PhoneCallIcon:fK,PhoneForwarded:pK,PhoneForwardedIcon:pK,PhoneIcon:Ii,PhoneIncoming:gK,PhoneIncomingIcon:gK,PhoneMissed:xK,PhoneMissedIcon:xK,PhoneOff:yK,PhoneOffIcon:yK,PhoneOutgoing:vK,PhoneOutgoingIcon:vK,Pi:_K,PiIcon:_K,PiSquare:pw,PiSquareIcon:pw,Piano:bK,PianoIcon:bK,Pickaxe:wK,PickaxeIcon:wK,PictureInPicture:kK,PictureInPicture2:jK,PictureInPicture2Icon:jK,PictureInPictureIcon:kK,PieChart:ib,PieChartIcon:ib,PiggyBank:NK,PiggyBankIcon:NK,Pilcrow:MK,PilcrowIcon:MK,PilcrowLeft:SK,PilcrowLeftIcon:SK,PilcrowRight:CK,PilcrowRightIcon:CK,PilcrowSquare:gw,PilcrowSquareIcon:gw,Pill:AK,PillBottle:TK,PillBottleIcon:TK,PillIcon:AK,Pin:Y1,PinIcon:Y1,PinOff:yA,PinOffIcon:yA,Pipette:EK,PipetteIcon:EK,Pizza:IK,PizzaIcon:IK,Plane:OK,PlaneIcon:OK,PlaneLanding:PK,PlaneLandingIcon:PK,PlaneTakeoff:LK,PlaneTakeoffIcon:LK,Play:Vl,PlayCircle:nf,PlayCircleIcon:nf,PlayIcon:Vl,PlaySquare:xw,PlaySquareIcon:xw,Plug:vA,Plug2:DK,Plug2Icon:DK,PlugIcon:vA,PlugZap:j2,PlugZap2:j2,PlugZap2Icon:j2,PlugZapIcon:j2,Plus:bn,PlusCircle:Cb,PlusCircleIcon:Cb,PlusIcon:bn,PlusSquare:yw,PlusSquareIcon:yw,Pocket:FK,PocketIcon:FK,PocketKnife:RK,PocketKnifeIcon:RK,Podcast:zK,PodcastIcon:zK,Pointer:$K,PointerIcon:$K,PointerOff:BK,PointerOffIcon:BK,Popcorn:UK,PopcornIcon:UK,Popsicle:qK,PopsicleIcon:qK,PoundSterling:VK,PoundSterlingIcon:VK,Power:WK,PowerCircle:Mb,PowerCircleIcon:Mb,PowerIcon:WK,PowerOff:HK,PowerOffIcon:HK,PowerSquare:vw,PowerSquareIcon:vw,Presentation:gy,PresentationIcon:gy,Printer:KK,PrinterCheck:GK,PrinterCheckIcon:GK,PrinterIcon:KK,Projector:ZK,ProjectorIcon:ZK,Proportions:YK,ProportionsIcon:YK,Puzzle:XK,PuzzleIcon:XK,Pyramid:QK,PyramidIcon:QK,QrCode:_A,QrCodeIcon:_A,Quote:bA,QuoteIcon:bA,Rabbit:JK,RabbitIcon:JK,Radar:eZ,RadarIcon:eZ,Radiation:tZ,RadiationIcon:tZ,Radical:rZ,RadicalIcon:rZ,Radio:Uj,RadioIcon:Uj,RadioReceiver:nZ,RadioReceiverIcon:nZ,RadioTower:sZ,RadioTowerIcon:sZ,Radius:aZ,RadiusIcon:aZ,RailSymbol:iZ,RailSymbolIcon:iZ,Rainbow:oZ,RainbowIcon:oZ,Rat:lZ,RatIcon:lZ,Ratio:cZ,RatioIcon:cZ,Receipt:yZ,ReceiptCent:dZ,ReceiptCentIcon:dZ,ReceiptEuro:uZ,ReceiptEuroIcon:uZ,ReceiptIcon:yZ,ReceiptIndianRupee:hZ,ReceiptIndianRupeeIcon:hZ,ReceiptJapaneseYen:mZ,ReceiptJapaneseYenIcon:mZ,ReceiptPoundSterling:fZ,ReceiptPoundSterlingIcon:fZ,ReceiptRussianRuble:pZ,ReceiptRussianRubleIcon:pZ,ReceiptSwissFranc:gZ,ReceiptSwissFrancIcon:gZ,ReceiptText:xZ,ReceiptTextIcon:xZ,RectangleEllipsis:k2,RectangleEllipsisIcon:k2,RectangleHorizontal:vZ,RectangleHorizontalIcon:vZ,RectangleVertical:_Z,RectangleVerticalIcon:_Z,Recycle:bZ,RecycleIcon:bZ,Redo:O4,Redo2:wZ,Redo2Icon:wZ,RedoDot:jZ,RedoDotIcon:jZ,RedoIcon:O4,RefreshCcw:NZ,RefreshCcwDot:kZ,RefreshCcwDotIcon:kZ,RefreshCcwIcon:NZ,RefreshCw:Wo,RefreshCwIcon:Wo,RefreshCwOff:SZ,RefreshCwOffIcon:SZ,Refrigerator:CZ,RefrigeratorIcon:CZ,Regex:MZ,RegexIcon:MZ,RemoveFormatting:TZ,RemoveFormattingIcon:TZ,Repeat:wA,Repeat1:AZ,Repeat1Icon:AZ,Repeat2:EZ,Repeat2Icon:EZ,RepeatIcon:wA,Replace:PZ,ReplaceAll:IZ,ReplaceAllIcon:IZ,ReplaceIcon:PZ,Reply:jA,ReplyAll:LZ,ReplyAllIcon:LZ,ReplyIcon:jA,Rewind:OZ,RewindIcon:OZ,Ribbon:DZ,RibbonIcon:DZ,Rocket:Bg,RocketIcon:Bg,RockingChair:RZ,RockingChairIcon:RZ,RollerCoaster:FZ,RollerCoasterIcon:FZ,Rotate3D:N2,Rotate3DIcon:N2,Rotate3d:N2,Rotate3dIcon:N2,RotateCcw:D4,RotateCcwIcon:D4,RotateCcwSquare:zZ,RotateCcwSquareIcon:zZ,RotateCw:kA,RotateCwIcon:kA,RotateCwSquare:BZ,RotateCwSquareIcon:BZ,Route:UZ,RouteIcon:UZ,RouteOff:$Z,RouteOffIcon:$Z,Router:qZ,RouterIcon:qZ,Rows:S2,Rows2:S2,Rows2Icon:S2,Rows3:C2,Rows3Icon:C2,Rows4:VZ,Rows4Icon:VZ,RowsIcon:S2,Rss:HZ,RssIcon:HZ,Ruler:WZ,RulerIcon:WZ,RussianRuble:GZ,RussianRubleIcon:GZ,Sailboat:KZ,SailboatIcon:KZ,Salad:ZZ,SaladIcon:ZZ,Sandwich:YZ,SandwichIcon:YZ,Satellite:QZ,SatelliteDish:XZ,SatelliteDishIcon:XZ,SatelliteIcon:QZ,Save:Ip,SaveAll:JZ,SaveAllIcon:JZ,SaveIcon:Ip,SaveOff:eY,SaveOffIcon:eY,Scale:tY,Scale3D:M2,Scale3DIcon:M2,Scale3d:M2,Scale3dIcon:M2,ScaleIcon:tY,Scaling:rY,ScalingIcon:rY,Scan:dY,ScanBarcode:nY,ScanBarcodeIcon:nY,ScanEye:sY,ScanEyeIcon:sY,ScanFace:aY,ScanFaceIcon:aY,ScanIcon:dY,ScanLine:iY,ScanLineIcon:iY,ScanQrCode:oY,ScanQrCodeIcon:oY,ScanSearch:lY,ScanSearchIcon:lY,ScanText:cY,ScanTextIcon:cY,ScatterChart:ob,ScatterChartIcon:ob,School:uY,School2:Lw,School2Icon:Lw,SchoolIcon:uY,Scissors:mY,ScissorsIcon:mY,ScissorsLineDashed:hY,ScissorsLineDashedIcon:hY,ScissorsSquare:_w,ScissorsSquareDashedBottom:W2,ScissorsSquareDashedBottomIcon:W2,ScissorsSquareIcon:_w,ScreenShare:pY,ScreenShareIcon:pY,ScreenShareOff:fY,ScreenShareOffIcon:fY,Scroll:xY,ScrollIcon:xY,ScrollText:gY,ScrollTextIcon:gY,Search:ma,SearchCheck:yY,SearchCheckIcon:yY,SearchCode:vY,SearchCodeIcon:vY,SearchIcon:ma,SearchSlash:_Y,SearchSlashIcon:_Y,SearchX:bY,SearchXIcon:bY,Section:wY,SectionIcon:wY,Send:Ji,SendHorizonal:T2,SendHorizonalIcon:T2,SendHorizontal:T2,SendHorizontalIcon:T2,SendIcon:Ji,SendToBack:jY,SendToBackIcon:jY,SeparatorHorizontal:kY,SeparatorHorizontalIcon:kY,SeparatorVertical:NY,SeparatorVerticalIcon:NY,Server:TY,ServerCog:SY,ServerCogIcon:SY,ServerCrash:CY,ServerCrashIcon:CY,ServerIcon:TY,ServerOff:MY,ServerOffIcon:MY,Settings:Bd,Settings2:AY,Settings2Icon:AY,SettingsIcon:Bd,Shapes:EY,ShapesIcon:EY,Share:NA,Share2:Nc,Share2Icon:Nc,ShareIcon:NA,Sheet:IY,SheetIcon:IY,Shell:PY,ShellIcon:PY,Shield:_m,ShieldAlert:LY,ShieldAlertIcon:LY,ShieldBan:OY,ShieldBanIcon:OY,ShieldCheck:SA,ShieldCheckIcon:SA,ShieldClose:A2,ShieldCloseIcon:A2,ShieldEllipsis:DY,ShieldEllipsisIcon:DY,ShieldHalf:RY,ShieldHalfIcon:RY,ShieldIcon:_m,ShieldMinus:FY,ShieldMinusIcon:FY,ShieldOff:zY,ShieldOffIcon:zY,ShieldPlus:BY,ShieldPlusIcon:BY,ShieldQuestion:$Y,ShieldQuestionIcon:$Y,ShieldX:A2,ShieldXIcon:A2,Ship:qY,ShipIcon:qY,ShipWheel:UY,ShipWheelIcon:UY,Shirt:VY,ShirtIcon:VY,ShoppingBag:$g,ShoppingBagIcon:$g,ShoppingBasket:HY,ShoppingBasketIcon:HY,ShoppingCart:Eh,ShoppingCartIcon:Eh,Shovel:WY,ShovelIcon:WY,ShowerHead:GY,ShowerHeadIcon:GY,Shrink:KY,ShrinkIcon:KY,Shrub:ZY,ShrubIcon:ZY,Shuffle:YY,ShuffleIcon:YY,Sidebar:_2,SidebarClose:x2,SidebarCloseIcon:x2,SidebarIcon:_2,SidebarOpen:v2,SidebarOpenIcon:v2,Sigma:XY,SigmaIcon:XY,SigmaSquare:bw,SigmaSquareIcon:bw,Signal:rX,SignalHigh:QY,SignalHighIcon:QY,SignalIcon:rX,SignalLow:JY,SignalLowIcon:JY,SignalMedium:eX,SignalMediumIcon:eX,SignalZero:tX,SignalZeroIcon:tX,Signature:nX,SignatureIcon:nX,Signpost:aX,SignpostBig:sX,SignpostBigIcon:sX,SignpostIcon:aX,Siren:iX,SirenIcon:iX,SkipBack:oX,SkipBackIcon:oX,SkipForward:lX,SkipForwardIcon:lX,Skull:cX,SkullIcon:cX,Slack:dX,SlackIcon:dX,Slash:uX,SlashIcon:uX,SlashSquare:ww,SlashSquareIcon:ww,Slice:hX,SliceIcon:hX,Sliders:E2,SlidersHorizontal:CA,SlidersHorizontalIcon:CA,SlidersIcon:E2,SlidersVertical:E2,SlidersVerticalIcon:E2,Smartphone:xy,SmartphoneCharging:mX,SmartphoneChargingIcon:mX,SmartphoneIcon:xy,SmartphoneNfc:fX,SmartphoneNfcIcon:fX,Smile:gX,SmileIcon:gX,SmilePlus:pX,SmilePlusIcon:pX,Snail:xX,SnailIcon:xX,Snowflake:S1,SnowflakeIcon:S1,Sofa:yX,SofaIcon:yX,SortAsc:$_,SortAscIcon:$_,SortDesc:F_,SortDescIcon:F_,Soup:vX,SoupIcon:vX,Space:_X,SpaceIcon:_X,Spade:bX,SpadeIcon:bX,Sparkle:wX,SparkleIcon:wX,Sparkles:Ds,SparklesIcon:Ds,Speaker:jX,SpeakerIcon:jX,Speech:kX,SpeechIcon:kX,SpellCheck:SX,SpellCheck2:NX,SpellCheck2Icon:NX,SpellCheckIcon:SX,Spline:CX,SplineIcon:CX,Split:MX,SplitIcon:MX,SplitSquareHorizontal:jw,SplitSquareHorizontalIcon:jw,SplitSquareVertical:kw,SplitSquareVerticalIcon:kw,SprayCan:TX,SprayCanIcon:TX,Sprout:AX,SproutIcon:AX,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:X0,SquareCheckBigIcon:X0,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:IX,SquareDashedBottomCode:EX,SquareDashedBottomCodeIcon:EX,SquareDashedBottomIcon:IX,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:PX,SquareRadicalIcon:PX,SquareScissors:_w,SquareScissorsIcon:_w,SquareSigma:bw,SquareSigmaIcon:bw,SquareSlash:ww,SquareSlashIcon:ww,SquareSplitHorizontal:jw,SquareSplitHorizontalIcon:jw,SquareSplitVertical:kw,SquareSplitVerticalIcon:kw,SquareSquare:LX,SquareSquareIcon:LX,SquareStack:OX,SquareStackIcon:OX,SquareTerminal:Nw,SquareTerminalIcon:Nw,SquareUser:Cw,SquareUserIcon:Cw,SquareUserRound:Sw,SquareUserRoundIcon:Sw,SquareX:Mw,SquareXIcon:Mw,Squircle:DX,SquircleIcon:DX,Squirrel:RX,SquirrelIcon:RX,Stamp:FX,StampIcon:FX,Star:Ss,StarHalf:zX,StarHalfIcon:zX,StarIcon:Ss,StarOff:BX,StarOffIcon:BX,Stars:Ds,StarsIcon:Ds,StepBack:$X,StepBackIcon:$X,StepForward:UX,StepForwardIcon:UX,Stethoscope:qX,StethoscopeIcon:qX,Sticker:VX,StickerIcon:VX,StickyNote:HX,StickyNoteIcon:HX,StopCircle:Ab,StopCircleIcon:Ab,Store:WX,StoreIcon:WX,StretchHorizontal:GX,StretchHorizontalIcon:GX,StretchVertical:KX,StretchVerticalIcon:KX,Strikethrough:ZX,StrikethroughIcon:ZX,Subscript:YX,SubscriptIcon:YX,Subtitles:Z_,SubtitlesIcon:Z_,Sun:X1,SunDim:XX,SunDimIcon:XX,SunIcon:X1,SunMedium:QX,SunMediumIcon:QX,SunMoon:JX,SunMoonIcon:JX,SunSnow:eQ,SunSnowIcon:eQ,Sunrise:tQ,SunriseIcon:tQ,Sunset:rQ,SunsetIcon:rQ,Superscript:nQ,SuperscriptIcon:nQ,SwatchBook:sQ,SwatchBookIcon:sQ,SwissFranc:aQ,SwissFrancIcon:aQ,SwitchCamera:iQ,SwitchCameraIcon:iQ,Sword:oQ,SwordIcon:oQ,Swords:lQ,SwordsIcon:lQ,Syringe:cQ,SyringeIcon:cQ,Table:gQ,Table2:R4,Table2Icon:R4,TableCellsMerge:dQ,TableCellsMergeIcon:dQ,TableCellsSplit:uQ,TableCellsSplitIcon:uQ,TableColumnsSplit:hQ,TableColumnsSplitIcon:hQ,TableIcon:gQ,TableOfContents:mQ,TableOfContentsIcon:mQ,TableProperties:fQ,TablePropertiesIcon:fQ,TableRowsSplit:pQ,TableRowsSplitIcon:pQ,Tablet:yQ,TabletIcon:yQ,TabletSmartphone:xQ,TabletSmartphoneIcon:xQ,Tablets:vQ,TabletsIcon:vQ,Tag:qg,TagIcon:qg,Tags:_Q,TagsIcon:_Q,Tally1:bQ,Tally1Icon:bQ,Tally2:wQ,Tally2Icon:wQ,Tally3:jQ,Tally3Icon:jQ,Tally4:kQ,Tally4Icon:kQ,Tally5:NQ,Tally5Icon:NQ,Tangent:SQ,TangentIcon:SQ,Target:yy,TargetIcon:yy,Telescope:CQ,TelescopeIcon:CQ,Tent:TQ,TentIcon:TQ,TentTree:MQ,TentTreeIcon:MQ,Terminal:AQ,TerminalIcon:AQ,TerminalSquare:Nw,TerminalSquareIcon:Nw,TestTube:EQ,TestTube2:Tw,TestTube2Icon:Tw,TestTubeDiagonal:Tw,TestTubeDiagonalIcon:Tw,TestTubeIcon:EQ,TestTubes:IQ,TestTubesIcon:IQ,Text:RQ,TextCursor:LQ,TextCursorIcon:LQ,TextCursorInput:PQ,TextCursorInputIcon:PQ,TextIcon:RQ,TextQuote:OQ,TextQuoteIcon:OQ,TextSearch:DQ,TextSearchIcon:DQ,TextSelect:Aw,TextSelectIcon:Aw,TextSelection:Aw,TextSelectionIcon:Aw,Theater:FQ,TheaterIcon:FQ,Thermometer:$Q,ThermometerIcon:$Q,ThermometerSnowflake:zQ,ThermometerSnowflakeIcon:zQ,ThermometerSun:BQ,ThermometerSunIcon:BQ,ThumbsDown:MA,ThumbsDownIcon:MA,ThumbsUp:pd,ThumbsUpIcon:pd,Ticket:TA,TicketCheck:UQ,TicketCheckIcon:UQ,TicketIcon:TA,TicketMinus:qQ,TicketMinusIcon:qQ,TicketPercent:VQ,TicketPercentIcon:VQ,TicketPlus:HQ,TicketPlusIcon:HQ,TicketSlash:WQ,TicketSlashIcon:WQ,TicketX:GQ,TicketXIcon:GQ,Tickets:ZQ,TicketsIcon:ZQ,TicketsPlane:KQ,TicketsPlaneIcon:KQ,Timer:QQ,TimerIcon:QQ,TimerOff:YQ,TimerOffIcon:YQ,TimerReset:XQ,TimerResetIcon:XQ,ToggleLeft:JQ,ToggleLeftIcon:JQ,ToggleRight:eJ,ToggleRightIcon:eJ,Toilet:tJ,ToiletIcon:tJ,Tornado:rJ,TornadoIcon:rJ,Torus:nJ,TorusIcon:nJ,Touchpad:aJ,TouchpadIcon:aJ,TouchpadOff:sJ,TouchpadOffIcon:sJ,TowerControl:iJ,TowerControlIcon:iJ,ToyBrick:oJ,ToyBrickIcon:oJ,Tractor:lJ,TractorIcon:lJ,TrafficCone:cJ,TrafficConeIcon:cJ,Train:Ew,TrainFront:uJ,TrainFrontIcon:uJ,TrainFrontTunnel:dJ,TrainFrontTunnelIcon:dJ,TrainIcon:Ew,TrainTrack:hJ,TrainTrackIcon:hJ,TramFront:Ew,TramFrontIcon:Ew,Trash:mJ,Trash2:Un,Trash2Icon:Un,TrashIcon:mJ,TreeDeciduous:fJ,TreeDeciduousIcon:fJ,TreePalm:Iw,TreePalmIcon:Iw,TreePine:Q1,TreePineIcon:Q1,Trees:pJ,TreesIcon:pJ,Trello:gJ,TrelloIcon:gJ,TrendingDown:qj,TrendingDownIcon:qj,TrendingUp:rh,TrendingUpDown:xJ,TrendingUpDownIcon:xJ,TrendingUpIcon:rh,Triangle:vJ,TriangleAlert:Gu,TriangleAlertIcon:Gu,TriangleIcon:vJ,TriangleRight:yJ,TriangleRightIcon:yJ,Trophy:io,TrophyIcon:io,Truck:AA,TruckIcon:AA,Turtle:_J,TurtleIcon:_J,Tv:wJ,Tv2:Pw,Tv2Icon:Pw,TvIcon:wJ,TvMinimal:Pw,TvMinimalIcon:Pw,TvMinimalPlay:bJ,TvMinimalPlayIcon:bJ,Twitch:jJ,TwitchIcon:jJ,Twitter:kJ,TwitterIcon:kJ,Type:SJ,TypeIcon:SJ,TypeOutline:NJ,TypeOutlineIcon:NJ,Umbrella:MJ,UmbrellaIcon:MJ,UmbrellaOff:CJ,UmbrellaOffIcon:CJ,Underline:TJ,UnderlineIcon:TJ,Undo:F4,Undo2:AJ,Undo2Icon:AJ,UndoDot:EJ,UndoDotIcon:EJ,UndoIcon:F4,UnfoldHorizontal:IJ,UnfoldHorizontalIcon:IJ,UnfoldVertical:PJ,UnfoldVerticalIcon:PJ,Ungroup:LJ,UngroupIcon:LJ,University:Lw,UniversityIcon:Lw,Unlink:EA,Unlink2:OJ,Unlink2Icon:OJ,UnlinkIcon:EA,Unlock:c2,UnlockIcon:c2,UnlockKeyhole:l2,UnlockKeyholeIcon:l2,Unplug:DJ,UnplugIcon:DJ,Upload:bo,UploadCloud:Db,UploadCloudIcon:Db,UploadIcon:bo,Usb:RJ,UsbIcon:RJ,User:ic,User2:Bw,User2Icon:Bw,UserCheck:Vj,UserCheck2:Ow,UserCheck2Icon:Ow,UserCheckIcon:Vj,UserCircle:Ib,UserCircle2:Eb,UserCircle2Icon:Eb,UserCircleIcon:Ib,UserCog:IA,UserCog2:Dw,UserCog2Icon:Dw,UserCogIcon:IA,UserIcon:ic,UserMinus:FJ,UserMinus2:Rw,UserMinus2Icon:Rw,UserMinusIcon:FJ,UserPen:zJ,UserPenIcon:zJ,UserPlus:nh,UserPlus2:Fw,UserPlus2Icon:Fw,UserPlusIcon:nh,UserRound:Bw,UserRoundCheck:Ow,UserRoundCheckIcon:Ow,UserRoundCog:Dw,UserRoundCogIcon:Dw,UserRoundIcon:Bw,UserRoundMinus:Rw,UserRoundMinusIcon:Rw,UserRoundPen:BJ,UserRoundPenIcon:BJ,UserRoundPlus:Fw,UserRoundPlusIcon:Fw,UserRoundSearch:$J,UserRoundSearchIcon:$J,UserRoundX:zw,UserRoundXIcon:zw,UserSearch:UJ,UserSearchIcon:UJ,UserSquare:Cw,UserSquare2:Sw,UserSquare2Icon:Sw,UserSquareIcon:Cw,UserX:qJ,UserX2:zw,UserX2Icon:zw,UserXIcon:qJ,Users:qn,Users2:$w,Users2Icon:$w,UsersIcon:qn,UsersRound:$w,UsersRoundIcon:$w,Utensils:qw,UtensilsCrossed:Uw,UtensilsCrossedIcon:Uw,UtensilsIcon:qw,UtilityPole:VJ,UtilityPoleIcon:VJ,Variable:PA,VariableIcon:PA,Vault:HJ,VaultIcon:HJ,Vegan:WJ,VeganIcon:WJ,VenetianMask:GJ,VenetianMaskIcon:GJ,Verified:V_,VerifiedIcon:V_,Vibrate:ZJ,VibrateIcon:ZJ,VibrateOff:KJ,VibrateOffIcon:KJ,Video:Pa,VideoIcon:Pa,VideoOff:YJ,VideoOffIcon:YJ,Videotape:XJ,VideotapeIcon:XJ,View:QJ,ViewIcon:QJ,Voicemail:JJ,VoicemailIcon:JJ,Volleyball:eee,VolleyballIcon:eee,Volume:aee,Volume1:tee,Volume1Icon:tee,Volume2:ree,Volume2Icon:ree,VolumeIcon:aee,VolumeOff:nee,VolumeOffIcon:nee,VolumeX:see,VolumeXIcon:see,Vote:iee,VoteIcon:iee,Wallet:lee,Wallet2:Vw,Wallet2Icon:Vw,WalletCards:oee,WalletCardsIcon:oee,WalletIcon:lee,WalletMinimal:Vw,WalletMinimalIcon:Vw,Wallpaper:cee,WallpaperIcon:cee,Wand:dee,Wand2:Hw,Wand2Icon:Hw,WandIcon:dee,WandSparkles:Hw,WandSparklesIcon:Hw,Warehouse:uee,WarehouseIcon:uee,WashingMachine:hee,WashingMachineIcon:hee,Watch:mee,WatchIcon:mee,Waves:fee,WavesIcon:fee,Waypoints:pee,WaypointsIcon:pee,Webcam:gee,WebcamIcon:gee,Webhook:yee,WebhookIcon:yee,WebhookOff:xee,WebhookOffIcon:xee,Weight:vee,WeightIcon:vee,Wheat:bee,WheatIcon:bee,WheatOff:_ee,WheatOffIcon:_ee,WholeWord:wee,WholeWordIcon:wee,Wifi:Cee,WifiHigh:jee,WifiHighIcon:jee,WifiIcon:Cee,WifiLow:kee,WifiLowIcon:kee,WifiOff:Nee,WifiOffIcon:Nee,WifiZero:See,WifiZeroIcon:See,Wind:Tee,WindArrowDown:Mee,WindArrowDownIcon:Mee,WindIcon:Tee,Wine:Eee,WineIcon:Eee,WineOff:Aee,WineOffIcon:Aee,Workflow:Iee,WorkflowIcon:Iee,Worm:Pee,WormIcon:Pee,WrapText:Lee,WrapTextIcon:Lee,Wrench:vy,WrenchIcon:vy,X:us,XCircle:bc,XCircleIcon:bc,XIcon:us,XOctagon:f2,XOctagonIcon:f2,XSquare:Mw,XSquareIcon:Mw,Youtube:Oee,YoutubeIcon:Oee,Zap:Vg,ZapIcon:Vg,ZapOff:Dee,ZapOffIcon:Dee,ZoomIn:z4,ZoomInIcon:z4,ZoomOut:B4,ZoomOutIcon:B4,createLucideIcon:q,icons:oQe},Symbol.toStringTag,{value:"Module"})),sxe="-",lQe=e=>{const t=dQe(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:l=>{const i=l.split(sxe);return i[0]===""&&i.length!==1&&i.shift(),EIe(i,t)||cQe(l)},getConflictingClassGroupIds:(l,i)=>{const u=n[l]||[];return i&&s[l]?[...u,...s[l]]:u}}},EIe=(e,t)=>{var l;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),a=s?EIe(e.slice(1),s):void 0;if(a)return a;if(t.validators.length===0)return;const o=e.join(sxe);return(l=t.validators.find(({validator:i})=>i(o)))==null?void 0:l.classGroupId},wje=/^\[(.+)\]$/,cQe=e=>{if(wje.test(e)){const t=wje.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},dQe=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return hQe(Object.entries(e.classGroups),n).forEach(([o,l])=>{phe(l,s,o,t)}),s},phe=(e,t,n,s)=>{e.forEach(a=>{if(typeof a=="string"){const o=a===""?t:jje(t,a);o.classGroupId=n;return}if(typeof a=="function"){if(uQe(a)){phe(a(s),t,n,s);return}t.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([o,l])=>{phe(l,jje(t,o),n,s)})})},jje=(e,t)=>{let n=e;return t.split(sxe).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},uQe=e=>e.isThemeGetter,hQe=(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,mQe=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)}}},IIe="!",fQe=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},pQe=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},gQe=e=>({cache:mQe(e.cacheSize),parseClassName:fQe(e),...lQe(e)}),xQe=/\s+/,yQe=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:a}=t,o=[],l=e.trim().split(xQe);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=pQe(x).join(":"),I=y?M+IIe: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 vQe(){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=gQe(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=yQe(u,n);return a(u,x),x}return function(){return o(vQe.apply(null,arguments))}}const ml=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},LIe=/^\[(?:([a-z-]+):)?(.+)\]$/i,bQe=/^\d+\/\d+$/,wQe=new Set(["px","full","screen"]),jQe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,kQe=/\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$/,NQe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,SQe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,CQe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Px=e=>$4(e)||wQe.has(e)||bQe.test(e),D0=e=>v3(e,"length",OQe),$4=e=>!!e&&!Number.isNaN(Number(e)),fce=e=>v3(e,"number",$4),tT=e=>!!e&&Number.isInteger(Number(e)),MQe=e=>e.endsWith("%")&&$4(e.slice(0,-1)),ui=e=>LIe.test(e),R0=e=>jQe.test(e),TQe=new Set(["length","size","percentage"]),AQe=e=>v3(e,TQe,OIe),EQe=e=>v3(e,"position",OIe),IQe=new Set(["image","url"]),PQe=e=>v3(e,IQe,RQe),LQe=e=>v3(e,"",DQe),rT=()=>!0,v3=(e,t,n)=>{const s=LIe.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},OQe=e=>kQe.test(e)&&!NQe.test(e),OIe=()=>!1,DQe=e=>SQe.test(e),RQe=e=>CQe.test(e),FQe=()=>{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"],Q=()=>["auto","hidden","clip","visible","scroll"],ae=()=>["auto",ui,t],oe=()=>[ui,t],de=()=>["",Px,D0],se=()=>["auto",$4,ui],pe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ne=()=>["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"],he=()=>["start","end","center","between","around","evenly","stretch"],xe=()=>["","0",ui],Te=()=>["auto","avoid","all","avoid-page","page","left","right","column"],be=()=>[$4,ui];return{cacheSize:500,separator:":",theme:{colors:[rT],spacing:[Px,D0],blur:["none","",R0,ui],brightness:be(),borderColor:[e],borderRadius:["none","","full",R0,ui],borderSpacing:oe(),borderWidth:de(),contrast:be(),grayscale:xe(),hueRotate:be(),invert:xe(),gap:oe(),gradientColorStops:[e],gradientColorStopPositions:[MQe,D0],inset:ae(),margin:ae(),opacity:be(),padding:oe(),saturate:be(),scale:be(),sepia:xe(),skew:be(),space:oe(),translate:oe()},classGroups:{aspect:[{aspect:["auto","square","video",ui]}],container:["container"],columns:[{columns:[R0]}],"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:[...pe(),ui]}],overflow:[{overflow:Q()}],"overflow-x":[{"overflow-x":Q()}],"overflow-y":[{"overflow-y":Q()}],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",tT,ui]}],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",ui]}],grow:[{grow:xe()}],shrink:[{shrink:xe()}],order:[{order:["first","last","none",tT,ui]}],"grid-cols":[{"grid-cols":[rT]}],"col-start-end":[{col:["auto",{span:["full",tT,ui]},ui]}],"col-start":[{"col-start":se()}],"col-end":[{"col-end":se()}],"grid-rows":[{"grid-rows":[rT]}],"row-start-end":[{row:["auto",{span:[tT,ui]},ui]}],"row-start":[{"row-start":se()}],"row-end":[{"row-end":se()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ui]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ui]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",...he()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...he(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...he(),"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",ui,t]}],"min-w":[{"min-w":[ui,t,"min","max","fit"]}],"max-w":[{"max-w":[ui,t,"none","full","min","max","fit","prose",{screen:[R0]},R0]}],h:[{h:[ui,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ui,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ui,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ui,t,"auto","min","max","fit"]}],"font-size":[{text:["base",R0,D0]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",fce]}],"font-family":[{font:[rT]}],"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",ui]}],"line-clamp":[{"line-clamp":["none",$4,fce]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Px,ui]}],"list-image":[{"list-image":["none",ui]}],"list-style-type":[{list:["none","disc","decimal",ui]}],"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:[...ne(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Px,D0]}],"underline-offset":[{"underline-offset":["auto",Px,ui]}],"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",ui]}],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",ui]}],"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:[...pe(),EQe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",AQe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},PQe]}],"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:[...ne(),"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:ne()}],"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:["",...ne()]}],"outline-offset":[{"outline-offset":[Px,ui]}],"outline-w":[{outline:[Px,D0]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:de()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[I]}],"ring-offset-w":[{"ring-offset":[Px,D0]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",R0,LQe]}],"shadow-color":[{shadow:[rT]}],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",R0,ui]}],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",ui]}],duration:[{duration:be()}],ease:[{ease:["linear","in","out","in-out",ui]}],delay:[{delay:be()}],animate:[{animate:["none","spin","ping","pulse","bounce",ui]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[F]}],"scale-x":[{"scale-x":[F]}],"scale-y":[{"scale-y":[F]}],rotate:[{rotate:[tT,ui]}],"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",ui]}],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",ui]}],"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",ui]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Px,D0,fce]}],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"]}}},zQe=_Qe(FQe);function Ut(...e){return zQe(hi(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 kje(e){const t=new Date(e);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(t)}function yse(e){return e?e.replace(/<[^>]*>/g,""):""}const BQe=sQe,DIe=A.forwardRef(({className:e,...t},n)=>r.jsx(bIe,{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}));DIe.displayName=bIe.displayName;const $Qe=y3("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"}}),RIe=A.forwardRef(({className:e,variant:t,...n},s)=>r.jsx(wIe,{ref:s,className:Ut($Qe({variant:t}),e),...n}));RIe.displayName=wIe.displayName;const UQe=A.forwardRef(({className:e,...t},n)=>r.jsx(NIe,{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}));UQe.displayName=NIe.displayName;const FIe=A.forwardRef(({className:e,...t},n)=>r.jsx(SIe,{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(us,{className:"h-4 w-4"})}));FIe.displayName=SIe.displayName;const zIe=A.forwardRef(({className:e,...t},n)=>r.jsx(jIe,{ref:n,className:Ut("text-sm font-semibold",e),...t}));zIe.displayName=jIe.displayName;const BIe=A.forwardRef(({className:e,...t},n)=>r.jsx(kIe,{ref:n,className:Ut("text-sm opacity-90",e),...t}));BIe.displayName=kIe.displayName;function qQe(){const{toasts:e}=pi();return r.jsxs(BQe,{children:[e.map(function({id:t,title:n,description:s,action:a,...o}){return r.jsxs(RIe,{...o,children:[r.jsxs("div",{className:"grid gap-1",children:[n&&r.jsx(zIe,{children:n}),s&&r.jsx(BIe,{children:s})]}),a,r.jsx(FIe,{})]},t)}),r.jsx(DIe,{})]})}var Nje=["light","dark"],VQe="(prefers-color-scheme: dark)",HQe=A.createContext(void 0),WQe={setTheme:e=>{},themes:[]},GQe=()=>{var e;return(e=A.useContext(HQe))!=null?e:WQe};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?Nje.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&&Nje.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='${VQe}',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 KQe=e=>{switch(e){case"success":return XQe;case"info":return JQe;case"warning":return QQe;case"error":return eJe;default:return null}},ZQe=Array(12).fill(0),YQe=({visible:e,className:t})=>dt.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},dt.createElement("div",{className:"sonner-spinner"},ZQe.map((n,s)=>dt.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),XQe=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"})),QQe=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"})),JQe=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"})),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-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"})),tJe=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"})),rJe=()=>{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},ghe=1,nJe=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:ghe++,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(aJe(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)||ghe++;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}},Nh=new nJe,sJe=(e,t)=>{let n=(t==null?void 0:t.id)||ghe++;return Nh.addToast({title:e,...t,id:n}),n},aJe=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",iJe=sJe,oJe=()=>Nh.toasts,lJe=()=>Nh.getActiveToasts(),Ae=Object.assign(iJe,{success:Nh.success,info:Nh.info,warning:Nh.warning,error:Nh.error,custom:Nh.custom,message:Nh.message,promise:Nh.promise,dismiss:Nh.dismiss,loading:Nh.loading},{getHistory:oJe,getToasts:lJe});function cJe(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))}cJe(`: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 WL(e){return e.label!==void 0}var dJe=3,uJe="32px",hJe="16px",Sje=4e3,mJe=356,fJe=14,pJe=20,gJe=200;function tp(...e){return e.filter(Boolean).join(" ")}function xJe(e){let[t,n]=e.split("-"),s=[];return t&&s.push(t),n&&s.push(n),s}var yJe=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:Q,actionButtonStyle:ae,className:oe="",descriptionClassName:de="",duration:se,position:pe,gap:ne,loadingIcon:me,expandByDefault:he,classNames:xe,icons:Te,closeButtonAriaLabel:be="Close toast",pauseWhenPageIsHidden:we}=e,[ve,et]=dt.useState(null),[Me,Ie]=dt.useState(null),[$e,Be]=dt.useState(!1),[Ve,ot]=dt.useState(!1),[At,Oe]=dt.useState(!1),[at,le]=dt.useState(!1),[qe,Qe]=dt.useState(!1),[rt,je]=dt.useState(0),[ut,Ce]=dt.useState(0),Ee=dt.useRef(b.duration||se||Sje),Ye=dt.useRef(null),Le=dt.useRef(null),Ke=P===0,tt=P+1<=I,ct=b.type,it=b.dismissible!==!1,zt=b.className||"",ir=b.descriptionClassName||"",Mr=dt.useMemo(()=>T.findIndex(fs=>fs.toastId===b.id)||0,[T,b.id]),Zr=dt.useMemo(()=>{var fs;return(fs=b.closeButton)!=null?fs:W},[b.closeButton,W]),Br=dt.useMemo(()=>b.duration||se||Sje,[b.duration,se]),rn=dt.useRef(0),Zn=dt.useRef(0),Ot=dt.useRef(0),Gr=dt.useRef(null),[An,zn]=pe.split("-"),ba=dt.useMemo(()=>T.reduce((fs,Ys,Bs)=>Bs>=Mr?fs:fs+Ys.height,0),[T,Mr]),gi=rJe(),Mo=b.invert||v,Wa=ct==="loading";Zn.current=dt.useMemo(()=>Mr*ne+ba,[Mr,ba]),dt.useEffect(()=>{Ee.current=Br},[Br]),dt.useEffect(()=>{Be(!0)},[]),dt.useEffect(()=>{let fs=Le.current;if(fs){let Ys=fs.getBoundingClientRect().height;return Ce(Ys),M(Bs=>[{toastId:b.id,height:Ys,position:b.position},...Bs]),()=>M(Bs=>Bs.filter(Ni=>Ni.toastId!==b.id))}},[M,b.id]),dt.useLayoutEffect(()=>{if(!$e)return;let fs=Le.current,Ys=fs.style.height;fs.style.height="auto";let Bs=fs.getBoundingClientRect().height;fs.style.height=Ys,Ce(Bs),M(Ni=>Ni.find(or=>or.toastId===b.id)?Ni.map(or=>or.toastId===b.id?{...or,height:Bs}:or):[{toastId:b.id,height:Bs,position:b.position},...Ni])},[$e,b.title,b.description,M,b.id]);let ms=dt.useCallback(()=>{ot(!0),je(Zn.current),M(fs=>fs.filter(Ys=>Ys.toastId!==b.id)),setTimeout(()=>{U(b)},gJe)},[b,U,M,Zn]);dt.useEffect(()=>{if(b.promise&&ct==="loading"||b.duration===1/0||b.type==="loading")return;let fs;return D||k||we&&gi?(()=>{if(Ot.current{var Ys;(Ys=b.onAutoClose)==null||Ys.call(b,b),ms()},Ee.current)),()=>clearTimeout(fs)},[D,k,b,ct,we,gi,ms]),dt.useEffect(()=>{b.delete&&ms()},[ms,b.delete]);function ra(){var fs,Ys,Bs;return Te!=null&&Te.loading?dt.createElement("div",{className:tp(xe==null?void 0:xe.loader,(fs=b==null?void 0:b.classNames)==null?void 0:fs.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(YQe,{className:tp(xe==null?void 0:xe.loader,(Bs=b==null?void 0:b.classNames)==null?void 0:Bs.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":An,"data-x-position":zn,"data-index":P,"data-front":Ke,"data-swiping":At,"data-dismissible":it,"data-type":ct,"data-invert":Mo,"data-swipe-out":at,"data-swipe-direction":Me,"data-expanded":!!(D||he&&$e),style:{"--index":P,"--toasts-before":P,"--z-index":F.length-P,"--offset":`${Ve?rt:Zn.current}px`,"--initial-height":he?"auto":`${ut}px`,...G,...b.style},onDragEnd:()=>{Oe(!1),et(null),Gr.current=null},onPointerDown:fs=>{Wa||!it||(Ye.current=new Date,je(Zn.current),fs.target.setPointerCapture(fs.pointerId),fs.target.tagName!=="BUTTON"&&(Oe(!0),Gr.current={x:fs.clientX,y:fs.clientY}))},onPointerUp:()=>{var fs,Ys,Bs,Ni;if(at||!it)return;Gr.current=null;let or=Number(((fs=Le.current)==null?void 0:fs.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),La=Number(((Ys=Le.current)==null?void 0:Ys.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),oo=new Date().getTime()-((Bs=Ye.current)==null?void 0:Bs.getTime()),ji=ve==="x"?or:La,Hn=Math.abs(ji)/oo;if(Math.abs(ji)>=pJe||Hn>.11){je(Zn.current),(Ni=b.onDismiss)==null||Ni.call(b,b),Ie(ve==="x"?or>0?"right":"left":La>0?"down":"up"),ms(),le(!0),Qe(!1);return}Oe(!1),et(null)},onPointerMove:fs=>{var Ys,Bs,Ni,or;if(!Gr.current||!it||((Ys=window.getSelection())==null?void 0:Ys.toString().length)>0)return;let La=fs.clientY-Gr.current.y,oo=fs.clientX-Gr.current.x,ji=(Bs=e.swipeDirections)!=null?Bs:xJe(pe);!ve&&(Math.abs(oo)>1||Math.abs(La)>1)&&et(Math.abs(oo)>Math.abs(La)?"x":"y");let Hn={x:0,y:0};ve==="y"?(ji.includes("top")||ji.includes("bottom"))&&(ji.includes("top")&&La<0||ji.includes("bottom")&&La>0)&&(Hn.y=La):ve==="x"&&(ji.includes("left")||ji.includes("right"))&&(ji.includes("left")&&oo<0||ji.includes("right")&&oo>0)&&(Hn.x=oo),(Math.abs(Hn.x)>0||Math.abs(Hn.y)>0)&&Qe(!0),(Ni=Le.current)==null||Ni.style.setProperty("--swipe-amount-x",`${Hn.x}px`),(or=Le.current)==null||or.style.setProperty("--swipe-amount-y",`${Hn.y}px`)}},Zr&&!b.jsx?dt.createElement("button",{"aria-label":be,"data-disabled":Wa,"data-close-button":!0,onClick:Wa||!it?()=>{}:()=>{var fs;ms(),(fs=b.onDismiss)==null||fs.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:tJe):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])||KQe(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(de,ir,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&&WL(b.cancel)?dt.createElement("button",{"data-button":!0,"data-cancel":!0,style:b.cancelButtonStyle||Q,onClick:fs=>{var Ys,Bs;WL(b.cancel)&&it&&((Bs=(Ys=b.cancel).onClick)==null||Bs.call(Ys,fs),ms())},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&&WL(b.action)?dt.createElement("button",{"data-button":!0,"data-action":!0,style:b.actionButtonStyle||ae,onClick:fs=>{var Ys,Bs;WL(b.action)&&((Bs=(Ys=b.action).onClick)==null||Bs.call(Ys,fs),!fs.defaultPrevented&&ms())},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 Cje(){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 vJe(e,t){let n={};return[e,t].forEach((s,a)=>{let o=a===1,l=o?"--mobile-offset":"--offset",i=o?hJe:uJe;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 _Je=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=dJe,toastOptions:k,dir:M=Cje(),gap:I=fJe,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,Q]=dt.useState([]),[ae,oe]=dt.useState(!1),[de,se]=dt.useState(!1),[pe,ne]=dt.useState(x!=="system"?x:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),me=dt.useRef(null),he=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),xe=dt.useRef(null),Te=dt.useRef(!1),be=dt.useCallback(we=>{V(ve=>{var et;return(et=ve.find(Me=>Me.id===we.id))!=null&&et.delete||Nh.dismiss(we.id),ve.filter(({id:Me})=>Me!==we.id)})},[]);return dt.useEffect(()=>Nh.subscribe(we=>{if(we.dismiss){V(ve=>ve.map(et=>et.id===we.id?{...et,delete:!0}:et));return}setTimeout(()=>{Qge.flushSync(()=>{V(ve=>{let et=ve.findIndex(Me=>Me.id===we.id);return et!==-1?[...ve.slice(0,et),{...ve[et],...we},...ve.slice(et+1)]:[we,...ve]})})})}),[]),dt.useEffect(()=>{if(x!=="system"){ne(x);return}if(x==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?ne("dark"):ne("light")),typeof window>"u")return;let we=window.matchMedia("(prefers-color-scheme: dark)");try{we.addEventListener("change",({matches:ve})=>{ne(ve?"dark":"light")})}catch{we.addListener(({matches:et})=>{try{ne(et?"dark":"light")}catch(Me){console.error(Me)}})}},[x]),dt.useEffect(()=>{U.length<=1&&oe(!1)},[U]),dt.useEffect(()=>{let we=ve=>{var et,Me;a.every(Ie=>ve[Ie]||ve.code===Ie)&&(oe(!0),(et=me.current)==null||et.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} ${he}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},W.map((we,ve)=>{var et;let[Me,Ie]=we.split("-");return U.length?dt.createElement("ol",{key:we,dir:M==="auto"?Cje():M,tabIndex:-1,ref:me,className:i,"data-sonner-toaster":!0,"data-theme":pe,"data-y-position":Me,"data-lifted":ae&&U.length>1&&!o,"data-x-position":Ie,style:{"--front-toast-height":`${((et=G[0])==null?void 0:et.height)||0}px`,"--width":`${mJe}px`,"--gap":`${I}px`,...b,...vJe(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:()=>{de||oe(!1)},onDragEnd:()=>oe(!1),onPointerDown:$e=>{$e.target instanceof HTMLElement&&$e.target.dataset.dismissible==="false"||se(!0)},onPointerUp:()=>se(!1)},U.filter($e=>!$e.position&&ve===0||$e.position===we).map(($e,Be)=>{var Ve,ot;return dt.createElement(yJe,{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:de,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:be,toasts:U.filter(At=>At.position==$e.position),heights:G.filter(At=>At.position==$e.position),setHeights:Q,expandByDefault:o,gap:I,loadingIcon:T,expanded:ae,pauseWhenPageIsHidden:D,swipeDirections:e.swipeDirections})})):null}))});const bJe=({...e})=>{const{theme:t="system"}=GQe();return r.jsx(_Je,{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 wJe=oge[" useId ".trim().toString()]||(()=>{}),jJe=0;function gd(e){const[t,n]=A.useState(wJe());return oc(()=>{n(s=>s??String(jJe++))},[e]),t?`radix-${t}`:""}const kJe=["top","right","bottom","left"],hv=Math.min,im=Math.max,Cte=Math.round,GL=Math.floor,Hg=e=>({x:e,y:e}),NJe={left:"right",right:"left",bottom:"top",top:"bottom"},SJe={start:"end",end:"start"};function xhe(e,t,n){return im(e,hv(t,n))}function Ay(e,t){return typeof e=="function"?e(t):e}function Ey(e){return e.split("-")[0]}function _3(e){return e.split("-")[1]}function axe(e){return e==="x"?"y":"x"}function ixe(e){return e==="y"?"height":"width"}const CJe=new Set(["top","bottom"]);function Mg(e){return CJe.has(Ey(e))?"y":"x"}function oxe(e){return axe(Mg(e))}function MJe(e,t,n){n===void 0&&(n=!1);const s=_3(e),a=oxe(e),o=ixe(a);let l=a==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(l=Mte(l)),[l,Mte(l)]}function TJe(e){const t=Mte(e);return[yhe(e),t,yhe(t)]}function yhe(e){return e.replace(/start|end/g,t=>SJe[t])}const Mje=["left","right"],Tje=["right","left"],AJe=["top","bottom"],EJe=["bottom","top"];function IJe(e,t,n){switch(e){case"top":case"bottom":return n?t?Tje:Mje:t?Mje:Tje;case"left":case"right":return t?AJe:EJe;default:return[]}}function PJe(e,t,n,s){const a=_3(e);let o=IJe(Ey(e),n==="start",s);return a&&(o=o.map(l=>l+"-"+a),t&&(o=o.concat(o.map(yhe)))),o}function Mte(e){return e.replace(/left|right|bottom|top/g,t=>NJe[t])}function LJe(e){return{top:0,right:0,bottom:0,left:0,...e}}function $Ie(e){return typeof e!="number"?LJe(e):{top:e,right:e,bottom:e,left:e}}function Tte(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 Aje(e,t,n){let{reference:s,floating:a}=e;const o=Mg(t),l=oxe(t),i=ixe(l),u=Ey(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(_3(t)){case"start":b[l]-=v*(n&&m?-1:1);break;case"end":b[l]+=v*(n&&m?-1:1);break}return b}const OJe=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}=Aje(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}=Ay(e,t)||{};if(m==null)return{};const y=$Ie(x),v={x:n,y:s},b=oxe(a),N=ixe(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,Q=hv(y[I],G),ae=hv(y[T],G),oe=Q,de=V-k[N]-ae,se=V/2-k[N]/2+W,pe=xhe(oe,se,de),ne=!u.arrow&&_3(a)!=null&&se!==pe&&o.reference[N]/2-(sese<=0)){var ae,oe;const se=(((ae=o.flip)==null?void 0:ae.index)||0)+1,pe=V[se];if(pe&&(!(y==="alignment"?T!==Mg(pe):!1)||Q.every(he=>he.overflows[0]>0&&Mg(he.placement)===T)))return{data:{index:se,overflows:Q},reset:{placement:pe}};let ne=(oe=Q.filter(me=>me.overflows[0]<=0).sort((me,he)=>me.overflows[1]-he.overflows[1])[0])==null?void 0:oe.placement;if(!ne)switch(b){case"bestFit":{var de;const me=(de=Q.filter(he=>{if(U){const xe=Mg(he.placement);return xe===T||xe==="y"}return!0}).map(he=>[he.placement,he.overflows.filter(xe=>xe>0).reduce((xe,Te)=>xe+Te,0)]).sort((he,xe)=>he[1]-xe[1])[0])==null?void 0:de[0];me&&(ne=me);break}case"initialPlacement":ne=i;break}if(a!==ne)return{reset:{placement:ne}}}return{}}}};function Eje(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ije(e){return kJe.some(t=>e[t]>=0)}const FJe=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:s="referenceHidden",...a}=Ay(e,t);switch(s){case"referenceHidden":{const o=await kE(t,{...a,elementContext:"reference"}),l=Eje(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Ije(l)}}}case"escaped":{const o=await kE(t,{...a,altBoundary:!0}),l=Eje(o,n.floating);return{data:{escapedOffsets:l,escaped:Ije(l)}}}default:return{}}}}},UIe=new Set(["left","top"]);async function zJe(e,t){const{placement:n,platform:s,elements:a}=e,o=await(s.isRTL==null?void 0:s.isRTL(a.floating)),l=Ey(n),i=_3(n),u=Mg(n)==="y",m=UIe.has(l)?-1:1,x=o&&u?-1:1,y=Ay(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 BJe=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 zJe(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}}}}},$Je=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}=Ay(e,t),m={x:n,y:s},x=await kE(t,u),y=Mg(Ey(a)),v=axe(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=xhe(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=xhe(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}}}}}},UJe=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}=Ay(e,t),x={x:n,y:s},y=Mg(a),v=axe(y);let b=x[v],N=x[y];const k=Ay(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=UIe.has(Ey(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}}}},qJe=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}=Ay(e,t),x=await kE(t,m),y=Ey(a),v=_3(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 Q=im(x.left,0),ae=im(x.right,0),oe=im(x.top,0),de=im(x.bottom,0);b?W=N-2*(Q!==0||ae!==0?Q+ae:im(x.left,x.right)):V=k-2*(oe!==0||de!==0?oe+de:im(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 vse(){return typeof window<"u"}function b3(e){return qIe(e)?(e.nodeName||"").toLowerCase():"#document"}function bm(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function sx(e){var t;return(t=(qIe(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function qIe(e){return vse()?e instanceof Node||e instanceof bm(e).Node:!1}function Rp(e){return vse()?e instanceof Element||e instanceof bm(e).Element:!1}function Xg(e){return vse()?e instanceof HTMLElement||e instanceof bm(e).HTMLElement:!1}function Pje(e){return!vse()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof bm(e).ShadowRoot}const VJe=new Set(["inline","contents"]);function ZI(e){const{overflow:t,overflowX:n,overflowY:s,display:a}=Fp(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!VJe.has(a)}const HJe=new Set(["table","td","th"]);function WJe(e){return HJe.has(b3(e))}const GJe=[":popover-open",":modal"];function _se(e){return GJe.some(t=>{try{return e.matches(t)}catch{return!1}})}const KJe=["transform","translate","scale","rotate","perspective"],ZJe=["transform","translate","scale","rotate","perspective","filter"],YJe=["paint","layout","strict","content"];function lxe(e){const t=cxe(),n=Rp(e)?Fp(e):e;return KJe.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)||ZJe.some(s=>(n.willChange||"").includes(s))||YJe.some(s=>(n.contain||"").includes(s))}function XJe(e){let t=mv(e);for(;Xg(t)&&!SC(t);){if(lxe(t))return t;if(_se(t))return null;t=mv(t)}return null}function cxe(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const QJe=new Set(["html","body","#document"]);function SC(e){return QJe.has(b3(e))}function Fp(e){return bm(e).getComputedStyle(e)}function bse(e){return Rp(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function mv(e){if(b3(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Pje(e)&&e.host||sx(e);return Pje(t)?t.host:t}function VIe(e){const t=mv(e);return SC(t)?e.ownerDocument?e.ownerDocument.body:e.body:Xg(t)&&ZI(t)?t:VIe(t)}function NE(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=VIe(e),o=a===((s=e.ownerDocument)==null?void 0:s.body),l=bm(a);if(o){const i=vhe(l);return t.concat(l,l.visualViewport||[],ZI(a)?a:[],i&&n?NE(i):[])}return t.concat(a,NE(a,[],n))}function vhe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function HIe(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=Cte(n)!==o||Cte(s)!==l;return i&&(n=o,s=l),{width:n,height:s,$:i}}function dxe(e){return Rp(e)?e:e.contextElement}function U4(e){const t=dxe(e);if(!Xg(t))return Hg(1);const n=t.getBoundingClientRect(),{width:s,height:a,$:o}=HIe(t);let l=(o?Cte(n.width):n.width)/s,i=(o?Cte(n.height):n.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!i||!Number.isFinite(i))&&(i=1),{x:l,y:i}}const JJe=Hg(0);function WIe(e){const t=bm(e);return!cxe()||!t.visualViewport?JJe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function eet(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==bm(e)?!1:t}function nk(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),o=dxe(e);let l=Hg(1);t&&(s?Rp(s)&&(l=U4(s)):l=U4(e));const i=eet(o,n,s)?WIe(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=bm(o),b=s&&Rp(s)?bm(s):s;let N=v,k=vhe(N);for(;k&&s&&b!==N;){const M=U4(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=bm(k),k=vhe(N)}}return Tte({width:x,height:y,x:u,y:m})}function uxe(e,t){const n=bse(e).scrollLeft;return t?t.left+n:nk(sx(e)).left+n}function GIe(e,t,n){n===void 0&&(n=!1);const s=e.getBoundingClientRect(),a=s.left+t.scrollLeft-(n?0:uxe(e,s)),o=s.top+t.scrollTop;return{x:a,y:o}}function tet(e){let{elements:t,rect:n,offsetParent:s,strategy:a}=e;const o=a==="fixed",l=sx(s),i=t?_se(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)&&((b3(s)!=="body"||ZI(l))&&(u=bse(s)),Xg(s))){const b=nk(s);m=U4(s),x.x=b.x+s.clientLeft,x.y=b.y+s.clientTop}const v=l&&!y&&!o?GIe(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 ret(e){return Array.from(e.getClientRects())}function net(e){const t=sx(e),n=bse(e),s=e.ownerDocument.body,a=im(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),o=im(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let l=-n.scrollLeft+uxe(e);const i=-n.scrollTop;return Fp(s).direction==="rtl"&&(l+=im(t.clientWidth,s.clientWidth)-a),{width:a,height:o,x:l,y:i}}function set(e,t){const n=bm(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=cxe();(!m||m&&t==="fixed")&&(i=a.offsetLeft,u=a.offsetTop)}return{width:o,height:l,x:i,y:u}}const aet=new Set(["absolute","fixed"]);function iet(e,t){const n=nk(e,!0,t==="fixed"),s=n.top+e.clientTop,a=n.left+e.clientLeft,o=Xg(e)?U4(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 Lje(e,t,n){let s;if(t==="viewport")s=set(e,n);else if(t==="document")s=net(sx(e));else if(Rp(t))s=iet(t,n);else{const a=WIe(e);s={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Tte(s)}function KIe(e,t){const n=mv(e);return n===t||!Rp(n)||SC(n)?!1:Fp(n).position==="fixed"||KIe(n,t)}function oet(e,t){const n=t.get(e);if(n)return n;let s=NE(e,[],!1).filter(i=>Rp(i)&&b3(i)!=="body"),a=null;const o=Fp(e).position==="fixed";let l=o?mv(e):e;for(;Rp(l)&&!SC(l);){const i=Fp(l),u=lxe(l);!u&&i.position==="fixed"&&(a=null),(o?!u&&!a:!u&&i.position==="static"&&!!a&&aet.has(a.position)||ZI(l)&&!u&&KIe(e,l))?s=s.filter(x=>x!==l):a=i,l=mv(l)}return t.set(e,s),s}function cet(e){let{element:t,boundary:n,rootBoundary:s,strategy:a}=e;const l=[...n==="clippingAncestors"?_se(t)?[]:oet(t,this._c):[].concat(n),s],i=l[0],u=l.reduce((m,x)=>{const y=Lje(t,x,a);return m.top=im(y.top,m.top),m.right=hv(y.right,m.right),m.bottom=hv(y.bottom,m.bottom),m.left=im(y.left,m.left),m},Lje(t,i,a));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function det(e){const{width:t,height:n}=HIe(e);return{width:t,height:n}}function uet(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=uxe(a)}if(s||!s&&!o)if((b3(t)!=="body"||ZI(a))&&(i=bse(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?GIe(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 pce(e){return Fp(e).position==="static"}function Oje(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 ZIe(e,t){const n=bm(e);if(_se(e))return n;if(!Xg(e)){let a=mv(e);for(;a&&!SC(a);){if(Rp(a)&&!pce(a))return a;a=mv(a)}return n}let s=Oje(e,t);for(;s&&WJe(s)&&pce(s);)s=Oje(s,t);return s&&SC(s)&&pce(s)&&!lxe(s)?n:s||XJe(e)||n}const het=async function(e){const t=this.getOffsetParent||ZIe,n=this.getDimensions,s=await n(e.floating);return{reference:uet(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function met(e){return Fp(e).direction==="rtl"}const fet={convertOffsetParentRelativeRectToViewportRelativeRect:tet,getDocumentElement:sx,getClippingRect:cet,getOffsetParent:ZIe,getElementRects:het,getClientRects:ret,getDimensions:det,getScale:U4,isElement:Rp,isRTL:met};function YIe(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function pet(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=GL(y),k=GL(a.clientWidth-(x+v)),M=GL(a.clientHeight-(y+b)),I=GL(x),P={rootMargin:-N+"px "+-k+"px "+-M+"px "+-I+"px",threshold:im(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&&!YIe(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 get(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=dxe(e),x=a||o?[...m?NE(m):[],...NE(t)]:[];x.forEach(I=>{a&&I.addEventListener("scroll",n,{passive:!0}),o&&I.addEventListener("resize",n)});const y=m&&i?pet(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&&!YIe(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 xet=BJe,yet=$Je,vet=RJe,_et=qJe,bet=FJe,Dje=DJe,wet=UJe,jet=(e,t,n)=>{const s=new Map,a={platform:fet,...n},o={...a.platform,_c:s};return OJe(e,t,{...a,platform:o})};var ket=typeof document<"u",Net=function(){},Ree=ket?A.useLayoutEffect:Net;function Ate(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(!Ate(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)&&!Ate(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function XIe(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Rje(e,t){const n=XIe(e);return Math.round(t*n)/n}function gce(e){const t=A.useRef(e);return Ree(()=>{t.current=e}),t}function Cet(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);Ate(v,s)||b(s);const[N,k]=A.useState(null),[M,I]=A.useState(null),T=A.useCallback(he=>{he!==U.current&&(U.current=he,k(he))},[]),P=A.useCallback(he=>{he!==V.current&&(V.current=he,I(he))},[]),F=o||N,D=l||M,U=A.useRef(null),V=A.useRef(null),W=A.useRef(x),G=u!=null,Q=gce(u),ae=gce(a),oe=gce(m),de=A.useCallback(()=>{if(!U.current||!V.current)return;const he={placement:t,strategy:n,middleware:v};ae.current&&(he.platform=ae.current),jet(U.current,V.current,he).then(xe=>{const Te={...xe,isPositioned:oe.current!==!1};se.current&&!Ate(W.current,Te)&&(W.current=Te,Ah.flushSync(()=>{y(Te)}))})},[v,t,n,ae,oe]);Ree(()=>{m===!1&&W.current.isPositioned&&(W.current.isPositioned=!1,y(he=>({...he,isPositioned:!1})))},[m]);const se=A.useRef(!1);Ree(()=>(se.current=!0,()=>{se.current=!1}),[]),Ree(()=>{if(F&&(U.current=F),D&&(V.current=D),F&&D){if(Q.current)return Q.current(F,D,de);de()}},[F,D,de,Q,G]);const pe=A.useMemo(()=>({reference:U,floating:V,setReference:T,setFloating:P}),[T,P]),ne=A.useMemo(()=>({reference:F,floating:D}),[F,D]),me=A.useMemo(()=>{const he={position:n,left:0,top:0};if(!ne.floating)return he;const xe=Rje(ne.floating,x.x),Te=Rje(ne.floating,x.y);return i?{...he,transform:"translate("+xe+"px, "+Te+"px)",...XIe(ne.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:xe,top:Te}},[n,i,ne.floating,x.x,x.y]);return A.useMemo(()=>({...x,update:de,refs:pe,elements:ne,floatingStyles:me}),[x,de,pe,ne,me])}const Met=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?Dje({element:s.current,padding:a}).fn(n):{}:s?Dje({element:s,padding:a}).fn(n):{}}}},Tet=(e,t)=>({...xet(e),options:[e,t]}),Aet=(e,t)=>({...yet(e),options:[e,t]}),Eet=(e,t)=>({...wet(e),options:[e,t]}),Iet=(e,t)=>({...vet(e),options:[e,t]}),Pet=(e,t)=>({..._et(e),options:[e,t]}),Let=(e,t)=>({...bet(e),options:[e,t]}),Oet=(e,t)=>({...Met(e),options:[e,t]});var Det="Arrow",QIe=A.forwardRef((e,t)=>{const{children:n,width:s=10,height:a=5,...o}=e;return r.jsx(Bn.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"})})});QIe.displayName=Det;var Ret=QIe;function YI(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 hxe="Popper",[JIe,ax]=cc(hxe),[Fet,ePe]=JIe(hxe),tPe=e=>{const{__scopePopper:t,children:n}=e,[s,a]=A.useState(null);return r.jsx(Fet,{scope:t,anchor:s,onAnchorChange:a,children:n})};tPe.displayName=hxe;var rPe="PopperAnchor",nPe=A.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...a}=e,o=ePe(rPe,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(Bn.div,{...a,ref:i})});nPe.displayName=rPe;var mxe="PopperContent",[zet,Bet]=JIe(mxe),sPe=A.forwardRef((e,t)=>{var $e,Be,Ve,ot,At,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=ePe(mxe,n),[I,T]=A.useState(null),P=ca(t,at=>T(at)),[F,D]=A.useState(null),U=YI(F),V=(U==null?void 0:U.width)??0,W=(U==null?void 0:U.height)??0,G=s+(o!=="center"?"-"+o:""),Q=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},ae=Array.isArray(m)?m:[m],oe=ae.length>0,de={padding:Q,boundary:ae.filter(Uet),altBoundary:oe},{refs:se,floatingStyles:pe,placement:ne,isPositioned:me,middlewareData:he}=Cet({strategy:"fixed",placement:G,whileElementsMounted:(...at)=>get(...at,{animationFrame:b==="always"}),elements:{reference:M.anchor},middleware:[Tet({mainAxis:a+W,alignmentAxis:l}),u&&Aet({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?Eet():void 0,...de}),u&&Iet({...de}),Pet({...de,apply:({elements:at,rects:le,availableWidth:qe,availableHeight:Qe})=>{const{width:rt,height:je}=le.reference,ut=at.floating.style;ut.setProperty("--radix-popper-available-width",`${qe}px`),ut.setProperty("--radix-popper-available-height",`${Qe}px`),ut.setProperty("--radix-popper-anchor-width",`${rt}px`),ut.setProperty("--radix-popper-anchor-height",`${je}px`)}}),F&&Oet({element:F,padding:i}),qet({arrowWidth:V,arrowHeight:W}),v&&Let({strategy:"referenceHidden",...de})]}),[xe,Te]=oPe(ne),be=sc(N);oc(()=>{me&&(be==null||be())},[me,be]);const we=($e=he.arrow)==null?void 0:$e.x,ve=(Be=he.arrow)==null?void 0:Be.y,et=((Ve=he.arrow)==null?void 0:Ve.centerOffset)!==0,[Me,Ie]=A.useState();return oc(()=>{I&&Ie(window.getComputedStyle(I).zIndex)},[I]),r.jsx("div",{ref:se.setFloating,"data-radix-popper-content-wrapper":"",style:{...pe,transform:me?pe.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Me,"--radix-popper-transform-origin":[(ot=he.transformOrigin)==null?void 0:ot.x,(At=he.transformOrigin)==null?void 0:At.y].join(" "),...((Oe=he.hide)==null?void 0:Oe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(zet,{scope:n,placedSide:xe,onArrowChange:D,arrowX:we,arrowY:ve,shouldHideArrow:et,children:r.jsx(Bn.div,{"data-side":xe,"data-align":Te,...k,ref:P,style:{...k.style,animation:me?void 0:"none"}})})})});sPe.displayName=mxe;var aPe="PopperArrow",$et={top:"bottom",right:"left",bottom:"top",left:"right"},iPe=A.forwardRef(function(t,n){const{__scopePopper:s,...a}=t,o=Bet(aPe,s),l=$et[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(Ret,{...a,ref:n,style:{...a.style,display:"block"}})})});iPe.displayName=aPe;function Uet(e){return e!==null}var qet=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]=oPe(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 oPe(e){const[t,n="center"]=e.split("-");return[t,n]}var XI=tPe,w3=nPe,QI=sPe,JI=iPe,[wse]=cc("Tooltip",[ax]),jse=ax(),lPe="TooltipProvider",Vet=700,_he="tooltip.open",[Het,fxe]=wse(lPe),cPe=e=>{const{__scopeTooltip:t,delayDuration:n=Vet,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(Het,{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})};cPe.displayName=lPe;var SE="Tooltip",[Wet,kse]=wse(SE),dPe=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:a,onOpenChange:o,disableHoverableContent:l,delayDuration:i}=e,u=fxe(SE,e.__scopeTooltip),m=jse(t),[x,y]=A.useState(null),v=gd(),b=A.useRef(0),N=l??u.disableHoverableContent,k=i??u.delayDuration,M=A.useRef(!1),[I,T]=sh({prop:s,defaultProp:a??!1,onChange:V=>{V?(u.onOpen(),document.dispatchEvent(new CustomEvent(_he))):u.onClose(),o==null||o(V)},caller:SE}),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(XI,{...m,children:r.jsx(Wet,{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})})};dPe.displayName=SE;var bhe="TooltipTrigger",uPe=A.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=kse(bhe,n),o=fxe(bhe,n),l=jse(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(w3,{asChild:!0,...l,children:r.jsx(Bn.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...s,ref:u,onPointerMove:xn(e.onPointerMove,v=>{v.pointerType!=="touch"&&!x.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),x.current=!0)}),onPointerLeave:xn(e.onPointerLeave,()=>{a.onTriggerLeave(),x.current=!1}),onPointerDown:xn(e.onPointerDown,()=>{a.open&&a.onClose(),m.current=!0,document.addEventListener("pointerup",y,{once:!0})}),onFocus:xn(e.onFocus,()=>{m.current||a.onOpen()}),onBlur:xn(e.onBlur,a.onClose),onClick:xn(e.onClick,a.onClose)})})});uPe.displayName=bhe;var Get="TooltipPortal",[Qer,Ket]=wse(Get,{forceMount:void 0}),CC="TooltipContent",hPe=A.forwardRef((e,t)=>{const n=Ket(CC,e.__scopeTooltip),{forceMount:s=n.forceMount,side:a="top",...o}=e,l=kse(CC,e.__scopeTooltip);return r.jsx(Ac,{present:s||l.open,children:l.disableHoverableContent?r.jsx(mPe,{side:a,...o,ref:t}):r.jsx(Zet,{side:a,...o,ref:t})})}),Zet=A.forwardRef((e,t)=>{const n=kse(CC,e.__scopeTooltip),s=fxe(CC,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=ett(I,M.getBoundingClientRect()),P=ttt(I,T),F=rtt(k.getBoundingClientRect()),D=stt([...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=!ntt(I,l);T?v():P&&(v(),m())};return document.addEventListener("pointermove",N),()=>document.removeEventListener("pointermove",N)}},[u,x,l,m,v]),r.jsx(mPe,{...e,ref:o})}),[Yet,Xet]=wse(SE,{isInside:!1}),Qet=nIe("TooltipContent"),mPe=A.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:l,...i}=e,u=kse(CC,n),m=jse(n),{onClose:x}=u;return A.useEffect(()=>(document.addEventListener(_he,x),()=>document.removeEventListener(_he,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(QI,{"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(Qet,{children:s}),r.jsx(Yet,{scope:n,isInside:!0,children:r.jsx(BXe,{id:u.contentId,role:"tooltip",children:a||s})})]})})});hPe.displayName=CC;var fPe="TooltipArrow",Jet=A.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=jse(n);return Xet(fPe,n).isInside?null:r.jsx(JI,{...a,...s,ref:t})});Jet.displayName=fPe;function ett(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 ttt(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 rtt(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 ntt(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 stt(e){const t=e.slice();return t.sort((n,s)=>n.xs.x?1:n.ys.y?1:0),att(t)}function att(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 itt=cPe,ott=dPe,ltt=uPe,pPe=hPe;const eP=itt,Wg=ott,Gg=ltt,Pp=A.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(pPe,{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=pPe.displayName;var j3=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 ctt(e,t){return typeof e=="function"?e(t):e}function whe(e){return typeof e=="number"&&e>=0&&e!==1/0}function gPe(e,t){return Math.max(e+(t||0)-Date.now(),0)}function J1(e,t){return typeof e=="function"?e(t):e}function Qm(e,t){return typeof e=="function"?e(t):e}function Fje(e,t){const{type:n="all",exact:s,fetchStatus:a,predicate:o,queryKey:l,stale:i}=e;if(l){if(s){if(t.queryHash!==pxe(l,t.options))return!1}else if(!CE(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 zje(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(!CE(t.options.mutationKey,o))return!1}return!(s&&t.state.status!==s||a&&!a(t))}function pxe(e,t){return((t==null?void 0:t.queryKeyHashFn)||ak)(e)}function ak(e){return JSON.stringify(e,(t,n)=>jhe(n)?Object.keys(n).sort().reduce((s,a)=>(s[a]=n[a],s),{}):n)}function CE(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>CE(e[n],t[n])):!1}function xPe(e,t){if(e===t)return e;const n=Bje(e)&&Bje(t);if(n||jhe(e)&&jhe(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 khe(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?xPe(e,t):t}function utt(e,t,n=0){const s=[...e,t];return n&&s.length>n?s.slice(1):s}function htt(e,t,n=0){const s=[t,...e];return n&&s.length>n?s.slice(0,-1):s}var gxe=Symbol();function yPe(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===gxe?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function vPe(e,t){return typeof e=="function"?e(...t):!!e}var gj,f1,oC,ITe,mtt=(ITe=class extends j3{constructor(){super();xa(this,gj);xa(this,f1);xa(this,oC);_s(this,oC,t=>{if(!sk&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){tr(this,f1)||this.setEventListener(tr(this,oC))}onUnsubscribe(){var t;this.hasListeners()||((t=tr(this,f1))==null||t.call(this),_s(this,f1,void 0))}setEventListener(t){var n;_s(this,oC,t),(n=tr(this,f1))==null||n.call(this),_s(this,f1,t(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(t){tr(this,gj)!==t&&(_s(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,f1=new WeakMap,oC=new WeakMap,ITe),xxe=new mtt,lC,p1,cC,PTe,ftt=(PTe=class extends j3{constructor(){super();xa(this,lC,!0);xa(this,p1);xa(this,cC);_s(this,cC,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,p1)||this.setEventListener(tr(this,cC))}onUnsubscribe(){var t;this.hasListeners()||((t=tr(this,p1))==null||t.call(this),_s(this,p1,void 0))}setEventListener(t){var n;_s(this,cC,t),(n=tr(this,p1))==null||n.call(this),_s(this,p1,t(this.setOnline.bind(this)))}setOnline(t){tr(this,lC)!==t&&(_s(this,lC,t),this.listeners.forEach(s=>{s(t)}))}isOnline(){return tr(this,lC)}},lC=new WeakMap,p1=new WeakMap,cC=new WeakMap,PTe),Ite=new ftt;function Nhe(){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 ptt(e){return Math.min(1e3*2**e,3e4)}function _Pe(e){return(e??"online")==="online"?Ite.isOnline():!0}var bPe=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function xce(e){return e instanceof bPe}function wPe(e){let t=!1,n=0,s=!1,a;const o=Nhe(),l=k=>{var M;s||(v(new bPe(k)),(M=e.abort)==null||M.call(e))},i=()=>{t=!0},u=()=>{t=!1},m=()=>xxe.isFocused()&&(e.networkMode==="always"||Ite.isOnline())&&e.canRun(),x=()=>_Pe(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??ptt,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 gtt=e=>setTimeout(e,0);function xtt(){let e=[],t=0,n=i=>{i()},s=i=>{i()},a=gtt;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=xtt(),xj,LTe,jPe=(LTe=class{constructor(){xa(this,xj)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),whe(this.gcTime)&&_s(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)),_s(this,xj,void 0))}},xj=new WeakMap,LTe),dC,yj,Xm,vj,fu,FI,_j,cp,Bx,OTe,ytt=(OTe=class extends jPe{constructor(t){super();xa(this,cp);xa(this,dC);xa(this,yj);xa(this,Xm);xa(this,vj);xa(this,fu);xa(this,FI);xa(this,_j);_s(this,_j,!1),_s(this,FI,t.defaultOptions),this.setOptions(t.options),this.observers=[],_s(this,vj,t.client),_s(this,Xm,tr(this,vj).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,_s(this,dC,vtt(this.options)),this.state=t.state??tr(this,dC),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,FI),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&tr(this,Xm).remove(this)}setData(t,n){const s=khe(this.state.data,t,this.options);return yi(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){yi(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,dC))}isActive(){return this.observers.some(t=>Qm(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===gxe||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:!gPe(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,Xm).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,Xm).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||yi(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:()=>(_s(this,_j,!0),s.signal)})},o=()=>{const v=yPe(this.options,n),N=(()=>{const k={client:tr(this,vj),queryKey:this.queryKey,meta:this.meta};return a(k),k})();return _s(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),_s(this,yj,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((x=i.fetchOptions)==null?void 0:x.meta))&&yi(this,cp,Bx).call(this,{type:"fetch",meta:(y=i.fetchOptions)==null?void 0:y.meta});const u=v=>{var b,N,k,M;xce(v)&&v.silent||yi(this,cp,Bx).call(this,{type:"error",error:v}),xce(v)||((N=(b=tr(this,Xm).config).onError)==null||N.call(b,v,this),(M=(k=tr(this,Xm).config).onSettled)==null||M.call(k,this.state.data,v,this)),this.scheduleGc()};return _s(this,fu,wPe({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,Xm).config).onSuccess)==null||N.call(b,v,this),(M=(k=tr(this,Xm).config).onSettled)==null||M.call(k,v,this.state.error,this),this.scheduleGc()},onError:u,onFail:(v,b)=>{yi(this,cp,Bx).call(this,{type:"failed",failureCount:v,error:b})},onPause:()=>{yi(this,cp,Bx).call(this,{type:"pause"})},onContinue:()=>{yi(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()}},dC=new WeakMap,yj=new WeakMap,Xm=new WeakMap,vj=new WeakMap,fu=new WeakMap,FI=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,...kPe(s.data,this.options),fetchMeta:t.meta??null};case"success":return _s(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 xce(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,Xm).notify({query:this,type:"updated",action:t})})},OTe);function kPe(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:_Pe(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function vtt(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,DTe,_tt=(DTe=class extends j3{constructor(t={}){super();xa(this,bg);this.config=t,_s(this,bg,new Map)}build(t,n,s){const a=n.queryKey,o=n.queryHash??pxe(a,n);let l=this.get(o);return l||(l=new ytt({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=>Fje(n,s))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(s=>Fje(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,DTe),wg,Uu,bj,jg,U0,RTe,btt=(RTe=class extends jPe{constructor(t){super();xa(this,jg);xa(this,wg);xa(this,Uu);xa(this,bj);this.mutationId=t.mutationId,_s(this,Uu,t.mutationCache),_s(this,wg,[]),this.state=t.state||NPe(),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){_s(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=()=>{yi(this,jg,U0).call(this,{type:"continue"})};_s(this,bj,wPe({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(G,Q)=>{yi(this,jg,U0).call(this,{type:"failed",failureCount:G,error:Q})},onPause:()=>{yi(this,jg,U0).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{yi(this,jg,U0).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 Q=await((u=(i=this.options).onMutate)==null?void 0:u.call(i,t));Q!==this.state.context&&yi(this,jg,U0).call(this,{type:"pending",context:Q,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)),yi(this,jg,U0).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{yi(this,jg,U0).call(this,{type:"error",error:G})}}finally{tr(this,Uu).runNext(this)}}},wg=new WeakMap,Uu=new WeakMap,bj=new WeakMap,jg=new WeakSet,U0=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})})},RTe);function NPe(){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,zI,FTe,wtt=(FTe=class extends j3{constructor(t={}){super();xa(this,Zx);xa(this,dp);xa(this,zI);this.config=t,_s(this,Zx,new Set),_s(this,dp,new Map),_s(this,zI,0)}build(t,n,s){const a=new btt({mutationCache:this,mutationId:++SL(this,zI)._,options:t.defaultMutationOptions(n),state:s});return this.add(a),a}add(t){tr(this,Zx).add(t);const n=KL(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=KL(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=KL(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=KL(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=>zje(n,s))}findAll(t={}){return this.getAll().filter(n=>zje(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,zI=new WeakMap,FTe);function KL(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Pte(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=yPe(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,Q=D?htt:utt;return{pages:Q(P.pages,W,G),pageParams:Q(P.pageParams,F,G)}};if(a&&o.length){const P=a==="backward",F=P?SPe:She,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:She(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 She(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 SPe(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 jtt(e,t){return t?She(e,t)!=null:!1}function ktt(e,t){return!t||!e.getPreviousPageParam?!1:SPe(e,t)!=null}var Yl,g1,x1,uC,hC,y1,mC,fC,zTe,Ntt=(zTe=class{constructor(e={}){xa(this,Yl);xa(this,g1);xa(this,x1);xa(this,uC);xa(this,hC);xa(this,y1);xa(this,mC);xa(this,fC);_s(this,Yl,e.queryCache||new _tt),_s(this,g1,e.mutationCache||new wtt),_s(this,x1,e.defaultOptions||{}),_s(this,uC,new Map),_s(this,hC,new Map),_s(this,y1,0)}mount(){SL(this,y1)._++,tr(this,y1)===1&&(_s(this,mC,xxe.subscribe(async e=>{e&&(await this.resumePausedMutations(),tr(this,Yl).onFocus())})),_s(this,fC,Ite.subscribe(async e=>{e&&(await this.resumePausedMutations(),tr(this,Yl).onOnline())})))}unmount(){var e,t;SL(this,y1)._--,tr(this,y1)===0&&((e=tr(this,mC))==null||e.call(this),_s(this,mC,void 0),(t=tr(this,fC))==null||t.call(this),_s(this,fC,void 0))}isFetching(e){return tr(this,Yl).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return tr(this,g1).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=ctt(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=Pte(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Hu).catch(Hu)}ensureInfiniteQueryData(e){return e.behavior=Pte(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Ite.isOnline()?tr(this,g1).resumePausedMutations():Promise.resolve()}getQueryCache(){return tr(this,Yl)}getMutationCache(){return tr(this,g1)}getDefaultOptions(){return tr(this,x1)}setDefaultOptions(e){_s(this,x1,e)}setQueryDefaults(e,t){tr(this,uC).set(ak(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...tr(this,uC).values()],n={};return t.forEach(s=>{CE(e,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(e,t){tr(this,hC).set(ak(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...tr(this,hC).values()],n={};return t.forEach(s=>{CE(e,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...tr(this,x1).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=pxe(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===gxe&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...tr(this,x1).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){tr(this,Yl).clear(),tr(this,g1).clear()}},Yl=new WeakMap,g1=new WeakMap,x1=new WeakMap,uC=new WeakMap,hC=new WeakMap,y1=new WeakMap,mC=new WeakMap,fC=new WeakMap,zTe),wh,Xi,BI,qu,wj,pC,v1,_1,$I,gC,xC,jj,kj,b1,yC,So,IT,Che,Mhe,The,Ahe,Ehe,Ihe,Phe,MPe,BTe,CPe=(BTe=class extends j3{constructor(t,n){super();xa(this,So);xa(this,wh);xa(this,Xi);xa(this,BI);xa(this,qu);xa(this,wj);xa(this,pC);xa(this,v1);xa(this,_1);xa(this,$I);xa(this,gC);xa(this,xC);xa(this,jj);xa(this,kj);xa(this,b1);xa(this,yC,new Set);this.options=n,_s(this,wh,t),_s(this,_1,null),_s(this,v1,Nhe()),this.options.experimental_prefetchInRender||tr(this,v1).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),Uje(tr(this,Xi),this.options)?yi(this,So,IT).call(this):this.updateResult(),yi(this,So,Ahe).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Lhe(tr(this,Xi),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Lhe(tr(this,Xi),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,yi(this,So,Ehe).call(this),yi(this,So,Ihe).call(this),tr(this,Xi).removeObserver(this)}setOptions(t){const n=this.options,s=tr(this,Xi);if(this.options=tr(this,wh).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Qm(this.options.enabled,tr(this,Xi))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");yi(this,So,Phe).call(this),tr(this,Xi).setOptions(this.options),n._defaulted&&!Ete(this.options,n)&&tr(this,wh).getQueryCache().notify({type:"observerOptionsUpdated",query:tr(this,Xi),observer:this});const a=this.hasListeners();a&&qje(tr(this,Xi),s,this.options,n)&&yi(this,So,IT).call(this),this.updateResult(),a&&(tr(this,Xi)!==s||Qm(this.options.enabled,tr(this,Xi))!==Qm(n.enabled,tr(this,Xi))||J1(this.options.staleTime,tr(this,Xi))!==J1(n.staleTime,tr(this,Xi)))&&yi(this,So,Che).call(this);const o=yi(this,So,Mhe).call(this);a&&(tr(this,Xi)!==s||Qm(this.options.enabled,tr(this,Xi))!==Qm(n.enabled,tr(this,Xi))||o!==tr(this,b1))&&yi(this,So,The).call(this,o)}getOptimisticResult(t){const n=tr(this,wh).getQueryCache().build(tr(this,wh),t),s=this.createResult(n,t);return Ctt(this,s)&&(_s(this,qu,s),_s(this,pC,this.options),_s(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,yC).add(t)}getCurrentQuery(){return tr(this,Xi)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=tr(this,wh).defaultQueryOptions(t),s=tr(this,wh).getQueryCache().build(tr(this,wh),n);return s.fetch().then(()=>this.createResult(s,n))}fetch(t){return yi(this,So,IT).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,pC),m=t!==s?t.state:tr(this,BI),{state:x}=t;let y={...x},v=!1,b;if(n._optimisticResults){const Q=this.hasListeners(),ae=!Q&&Uje(t,n),oe=Q&&qje(t,s,n,a);(ae||oe)&&(y={...y,...kPe(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 Q;o!=null&&o.isPlaceholderData&&n.placeholderData===(i==null?void 0:i.placeholderData)?(Q=o.data,I=!0):Q=typeof n.placeholderData=="function"?n.placeholderData((G=tr(this,xC))==null?void 0:G.state.data,tr(this,xC)):n.placeholderData,Q!==void 0&&(M="success",b=khe(o==null?void 0:o.data,Q,n),v=!0)}if(n.select&&b!==void 0&&!I)if(o&&b===(l==null?void 0:l.data)&&n.select===tr(this,$I))b=tr(this,gC);else try{_s(this,$I,n.select),b=n.select(b),b=khe(o==null?void 0:o.data,b,n),_s(this,gC,b),_s(this,_1,null)}catch(Q){_s(this,_1,Q)}tr(this,_1)&&(N=tr(this,_1),b=tr(this,gC),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:yxe(t,n),refetch:this.refetch,promise:tr(this,v1),isEnabled:Qm(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const Q=de=>{W.status==="error"?de.reject(W.error):W.data!==void 0&&de.resolve(W.data)},ae=()=>{const de=_s(this,v1,W.promise=Nhe());Q(de)},oe=tr(this,v1);switch(oe.status){case"pending":t.queryHash===s.queryHash&&Q(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(_s(this,wj,tr(this,Xi).state),_s(this,pC,this.options),tr(this,wj).data!==void 0&&_s(this,xC,tr(this,Xi)),Ete(n,t))return;_s(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,yC).size)return!0;const l=new Set(o??tr(this,yC));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)})};yi(this,So,MPe).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&yi(this,So,Ahe).call(this)}},wh=new WeakMap,Xi=new WeakMap,BI=new WeakMap,qu=new WeakMap,wj=new WeakMap,pC=new WeakMap,v1=new WeakMap,_1=new WeakMap,$I=new WeakMap,gC=new WeakMap,xC=new WeakMap,jj=new WeakMap,kj=new WeakMap,b1=new WeakMap,yC=new WeakMap,So=new WeakSet,IT=function(t){yi(this,So,Phe).call(this);let n=tr(this,Xi).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Hu)),n},Che=function(){yi(this,So,Ehe).call(this);const t=J1(this.options.staleTime,tr(this,Xi));if(sk||tr(this,qu).isStale||!whe(t))return;const s=gPe(tr(this,qu).dataUpdatedAt,t)+1;_s(this,jj,setTimeout(()=>{tr(this,qu).isStale||this.updateResult()},s))},Mhe=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(tr(this,Xi)):this.options.refetchInterval)??!1},The=function(t){yi(this,So,Ihe).call(this),_s(this,b1,t),!(sk||Qm(this.options.enabled,tr(this,Xi))===!1||!whe(tr(this,b1))||tr(this,b1)===0)&&_s(this,kj,setInterval(()=>{(this.options.refetchIntervalInBackground||xxe.isFocused())&&yi(this,So,IT).call(this)},tr(this,b1)))},Ahe=function(){yi(this,So,Che).call(this),yi(this,So,The).call(this,yi(this,So,Mhe).call(this))},Ehe=function(){tr(this,jj)&&(clearTimeout(tr(this,jj)),_s(this,jj,void 0))},Ihe=function(){tr(this,kj)&&(clearInterval(tr(this,kj)),_s(this,kj,void 0))},Phe=function(){const t=tr(this,wh).getQueryCache().build(tr(this,wh),this.options);if(t===tr(this,Xi))return;const n=tr(this,Xi);_s(this,Xi,t),_s(this,BI,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},MPe=function(t){id.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(tr(this,qu))}),tr(this,wh).getQueryCache().notify({query:tr(this,Xi),type:"observerResultsUpdated"})})},BTe);function Stt(e,t){return Qm(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Uje(e,t){return Stt(e,t)||e.state.data!==void 0&&Lhe(e,t,t.refetchOnMount)}function Lhe(e,t,n){if(Qm(t.enabled,e)!==!1&&J1(t.staleTime,e)!=="static"){const s=typeof n=="function"?n(e):n;return s==="always"||s!==!1&&yxe(e,t)}return!1}function qje(e,t,n,s){return(e!==t||Qm(s.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&yxe(e,n)}function yxe(e,t){return Qm(t.enabled,e)!==!1&&e.isStaleByTime(J1(t.staleTime,e))}function Ctt(e,t){return!Ete(e.getCurrentResult(),t)}var Mtt=class extends CPe{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:Pte()})}getOptimisticResult(e){return e.behavior=Pte(),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:jtt(t,n.data),hasPreviousPage:ktt(t,n.data),isFetchNextPageError:m,isFetchingNextPage:x,isFetchPreviousPageError:y,isFetchingPreviousPage:v,isRefetchError:i&&!m&&!y,isRefetching:o&&!x&&!v}}},w1,j1,jh,Yx,ky,Fee,Ohe,$Te,Ttt=($Te=class extends j3{constructor(n,s){super();xa(this,ky);xa(this,w1);xa(this,j1);xa(this,jh);xa(this,Yx);_s(this,w1,n),this.setOptions(s),this.bindMethods(),yi(this,ky,Fee).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,w1).defaultMutationOptions(n),Ete(this.options,s)||tr(this,w1).getMutationCache().notify({type:"observerOptionsUpdated",mutation:tr(this,jh),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&ak(s.mutationKey)!==ak(this.options.mutationKey)?this.reset():((a=tr(this,jh))==null?void 0:a.state.status)==="pending"&&tr(this,jh).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=tr(this,jh))==null||n.removeObserver(this)}onMutationUpdate(n){yi(this,ky,Fee).call(this),yi(this,ky,Ohe).call(this,n)}getCurrentResult(){return tr(this,j1)}reset(){var n;(n=tr(this,jh))==null||n.removeObserver(this),_s(this,jh,void 0),yi(this,ky,Fee).call(this),yi(this,ky,Ohe).call(this)}mutate(n,s){var a;return _s(this,Yx,s),(a=tr(this,jh))==null||a.removeObserver(this),_s(this,jh,tr(this,w1).getMutationCache().build(tr(this,w1),this.options)),tr(this,jh).addObserver(this),tr(this,jh).execute(n)}},w1=new WeakMap,j1=new WeakMap,jh=new WeakMap,Yx=new WeakMap,ky=new WeakSet,Fee=function(){var s;const n=((s=tr(this,jh))==null?void 0:s.state)??NPe();_s(this,j1,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Ohe=function(n){id.batch(()=>{var s,a,o,l,i,u,m,x;if(tr(this,Yx)&&this.hasListeners()){const y=tr(this,j1).variables,v=tr(this,j1).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,j1))})})},$Te),TPe=A.createContext(void 0),qr=e=>{const t=A.useContext(TPe);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Att=({client:e,children:t})=>(A.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),r.jsx(TPe.Provider,{value:e,children:t})),APe=A.createContext(!1),Ett=()=>A.useContext(APe);APe.Provider;function Itt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ptt=A.createContext(Itt()),Ltt=()=>A.useContext(Ptt),Ott=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Dtt=e=>{A.useEffect(()=>{e.clearReset()},[e])},Rtt=({result:e,errorResetBoundary:t,throwOnError:n,query:s,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(a&&e.data===void 0||vPe(n,[e.error,s])),Ftt=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))}},ztt=(e,t)=>e.isLoading&&e.isFetching&&!t,Btt=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Vje=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function EPe(e,t,n){var y,v,b,N,k;const s=Ett(),a=Ltt(),o=qr(),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",Ftt(l),Ott(l,a),Dtt(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]),Btt(l,m))throw Vje(l,u,a);if(Rtt({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&&ztt(m,s)){const M=i?Vje(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 EPe(e,CPe)}function ar(e,t){const n=qr(),[s]=A.useState(()=>new Ttt(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&&vPe(s.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:o,mutateAsync:a.mutate}}function $tt(e,t){return EPe(e,Mtt)}/** * @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 ME(){return ME=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function IPe(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function qtt(){return Math.random().toString(36).substr(2,8)}function Wje(e,t){return{usr:e.state,key:e.key,idx:t}}function Dhe(e,t,n,s){return n===void 0&&(n=null),ME({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?k3(t):t,{state:n,key:t&&t.key||s||qtt()})}function Lte(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 k3(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 Vtt(e,t,n,s){s===void 0&&(s={});let{window:a=document.defaultView,v5Compat:o=!1}=s,l=a.history,i=C1.Pop,u=null,m=x();m==null&&(m=0,l.replaceState(ME({},l.state,{idx:m}),""));function x(){return(l.state||{idx:null}).idx}function y(){i=C1.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=C1.Push;let T=Dhe(k.location,M,I);m=x()+1;let P=Wje(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=C1.Replace;let T=Dhe(k.location,M,I);m=x();let P=Wje(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:Lte(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(Hje,y),u=M,()=>{a.removeEventListener(Hje,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 Gje;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Gje||(Gje={}));function Htt(e,t,n){return n===void 0&&(n="/"),Wtt(e,t,n)}function Wtt(e,t,n,s){let a=typeof t=="string"?k3(t):t,o=vxe(a.pathname||"/",n);if(o==null)return null;let l=PPe(e);Gtt(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+'".')),PPe(o.children,t,x,m)),!(o.path==null&&!o.index)&&t.push({path:m,score:ert(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 LPe(o.path))a(o,l,u)}),t}function LPe(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=LPe(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 Gtt(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:trt(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const Ktt=/^:[\w-]+$/,Ztt=3,Ytt=2,Xtt=1,Qtt=10,Jtt=-2,Kje=e=>e==="*";function ert(e,t){let n=e.split("/"),s=n.length;return n.some(Kje)&&(s+=Jtt),t&&(s+=Ytt),n.filter(a=>!Kje(a)).reduce((a,o)=>a+(Ktt.test(o)?Ztt:o===""?Xtt:Qtt),s)}function trt(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 rrt(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 srt(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),IPe(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 art(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return IPe(!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 vxe(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 irt(e,t){t===void 0&&(t="/");let{pathname:n,search:s="",hash:a=""}=typeof e=="string"?k3(e):e;return{pathname:n?n.startsWith("/")?n:ort(n,t):t,search:drt(s),hash:urt(a)}}function ort(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 yce(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 lrt(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function _xe(e,t){let n=lrt(e);return t?n.map((s,a)=>a===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function bxe(e,t,n,s){s===void 0&&(s=!1);let a;typeof e=="string"?a=k3(e):(a=ME({},e),Sc(!a.pathname||!a.pathname.includes("?"),yce("?","pathname","search",a)),Sc(!a.pathname||!a.pathname.includes("#"),yce("#","pathname","hash",a)),Sc(!a.search||!a.search.includes("#"),yce("#","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=irt(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,"/"),crt=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),drt=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,urt=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function hrt(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const OPe=["post","put","patch","delete"];new Set(OPe);const mrt=["get",...OPe];new Set(mrt);/** * 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 TE(){return TE=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=bxe(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 xrt=A.createContext(null);function yrt(e){let t=A.useContext(ix).outlet;return t&&A.createElement(xrt.Provider,{value:e},t)}function Ec(){let{matches:e}=A.useContext(ix),t=e[e.length-1];return t?t.params:{}}function FPe(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(_xe(a,s.v7_relativeSplatPath));return A.useMemo(()=>bxe(e,JSON.parse(l),o,n==="path"),[e,l,o,n])}function vrt(e,t){return _rt(e,t)}function _rt(e,t,n,s){N3()||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"?k3(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=Htt(e,{pathname:b}),k=Nrt(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(Nse.Provider,{value:{location:TE({pathname:"/",search:"",hash:"",state:null,key:"default"},x),navigationType:C1.Pop}},k):k}function brt(){let e=Trt(),t=hrt(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 wrt=A.createElement(brt,null);class jrt 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(DPe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function krt(e){let{routeContext:t,match:n,children:s}=e,a=A.useContext(wxe);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 Nrt(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||wrt,u&&(m<0&&v===0?(Ert("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(krt,{match:y,routeContext:{outlet:x,matches:I,isDataRoute:n!=null},children:P})};return n&&(y.route.ErrorBoundary||y.route.errorElement||v===0)?A.createElement(jrt,{location:n.location,revalidation:n.revalidation,component:k,error:b,children:T(),routeContext:{outlet:null,matches:I,isDataRoute:!0}}):T()},null)}var zPe=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(zPe||{}),BPe=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}(BPe||{});function Srt(e){let t=A.useContext(wxe);return t||Sc(!1),t}function Crt(e){let t=A.useContext(frt);return t||Sc(!1),t}function Mrt(e){let t=A.useContext(ix);return t||Sc(!1),t}function $Pe(e){let t=Mrt(),n=t.matches[t.matches.length-1];return n.route.id||Sc(!1),n.route.id}function Trt(){var e;let t=A.useContext(DPe),n=Crt(),s=$Pe();return t!==void 0?t:(e=n.errors)==null?void 0:e[s]}function Art(){let{router:e}=Srt(zPe.UseNavigateStable),t=$Pe(BPe.UseNavigateStable),n=A.useRef(!1);return RPe(()=>{n.current=!0}),A.useCallback(function(a,o){o===void 0&&(o={}),n.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,TE({fromRouteId:t},o)))},[e,t])}const Zje={};function Ert(e,t,n){Zje[e]||(Zje[e]=!0)}function Irt(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function vce(e){let{to:t,replace:n,state:s,relative:a}=e;N3()||Sc(!1);let{future:o,static:l}=A.useContext(jv),{matches:i}=A.useContext(ix),{pathname:u}=wf(),m=Wn(),x=bxe(t,_xe(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 Prt(e){return yrt(e.context)}function nn(e){Sc(!1)}function Lrt(e){let{basename:t="/",children:n=null,location:s,navigationType:a=C1.Pop,navigator:o,static:l=!1,future:i}=e;N3()&&Sc(!1);let u=t.replace(/^\/*/,"/"),m=A.useMemo(()=>({basename:u,navigator:o,static:l,future:TE({v7_relativeSplatPath:!1},i)}),[u,i,o,l]);typeof s=="string"&&(s=k3(s));let{pathname:x="/",search:y="",hash:v="",state:b=null,key:N="default"}=s,k=A.useMemo(()=>{let M=vxe(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(Nse.Provider,{children:n,value:k}))}function Ort(e){let{children:t,location:n}=e;return vrt(Rhe(t),n)}new Promise(()=>{});function Rhe(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,Rhe(s.props.children,o));return}s.type!==nn&&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=Rhe(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 Fhe(){return Fhe=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[a]=e[a]);return n}function Rrt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Frt(e,t){return e.button===0&&(!t||t==="_self")&&!Rrt(e)}function zhe(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 zrt(e,t){let n=zhe(e);return t&&t.forEach((s,a)=>{n.has(a)||t.getAll(a).forEach(o=>{n.append(a,o)})}),n}const Brt=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],$rt="6";try{window.__reactRouterVersion=$rt}catch{}const Urt="startTransition",Yje=oge[Urt];function qrt(e){let{basename:t,children:n,future:s,window:a}=e,o=A.useRef();o.current==null&&(o.current=Utt({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&&Yje?Yje(()=>u(y)):u(y)},[u,m]);return A.useLayoutEffect(()=>l.listen(x),[l,x]),A.useEffect(()=>Irt(s),[s]),A.createElement(Lrt,{basename:t,children:n,location:i.location,navigationType:i.action,navigator:l,future:s})}const Vrt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Hrt=/^(?:[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=Drt(t,Brt),{basename:b}=A.useContext(jv),N,k=!1;if(typeof m=="string"&&Hrt.test(m)&&(N=m,Vrt))try{let P=new URL(window.location.href),F=m.startsWith("//")?new URL(P.protocol+m):new URL(m),D=vxe(F.pathname,b);F.origin===P.origin&&D!=null?m=D+F.search+F.hash:k=!0}catch{}let M=prt(m,{relative:a}),I=Wrt(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",Fhe({},v,{href:N||M,onClick:k||o?s:T,ref:n,target:u}))});var Xje;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Xje||(Xje={}));var Qje;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Qje||(Qje={}));function Wrt(e,t){let{target:n,replace:s,state:a,preventScrollReset:o,relative:l,viewTransition:i}=t===void 0?{}:t,u=Wn(),m=wf(),x=FPe(e,{relative:l});return A.useCallback(y=>{if(Frt(y,n)){y.preventDefault();let v=s!==void 0?s:Lte(m)===Lte(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(zhe(e)),n=A.useRef(!1),s=wf(),a=A.useMemo(()=>zrt(s.search,n.current?null:t.current),[s.search]),o=Wn(),l=A.useCallback((i,u)=>{const m=zhe(typeof i=="function"?i(a):i);n.current=!0,o("?"+m,u)},[o,a]);return[a,l]}var Grt=typeof Element<"u",Krt=typeof Map=="function",Zrt=typeof Set=="function",Yrt=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function zee(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(!zee(e[s],t[s]))return!1;return!0}var o;if(Krt&&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(!zee(s.value[1],t.get(s.value[0])))return!1;return!0}if(Zrt&&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(Yrt&&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(Grt&&e instanceof Element)return!1;for(s=n;s--!==0;)if(!((a[s]==="_owner"||a[s]==="__v"||a[s]==="__o")&&e.$$typeof)&&!zee(e[a[s]],t[a[s]]))return!1;return!0}return e!==e&&t!==t}var Xrt=function(t,n){try{return zee(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 Qrt=eo(Xrt);var Jrt=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}},ent=Jrt;const Jje=eo(ent);var tnt=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))(UPe||{}),_ce={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"]}},eke=Object.values(UPe),jxe={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},nnt=Object.entries(jxe).reduce((e,[t,n])=>(e[n]=t,e),{}),wp="data-rh",q4={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},V4=(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},snt=e=>{let t=V4(e,"title");const n=V4(e,q4.TITLE_TEMPLATE);if(Array.isArray(t)&&(t=t.join("")),n&&t)return n.replace(/%s/g,()=>t);const s=V4(e,q4.DEFAULT_TITLE);return t||s||void 0},ant=e=>V4(e,q4.ON_CHANGE_CLIENT_STATE)||(()=>{}),bce=(e,t)=>t.filter(n=>typeof n[e]<"u").map(n=>n[e]).reduce((n,s)=>({...n,...s}),{}),int=(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),nT=(e,t,n)=>{const s={};return n.filter(a=>Array.isArray(a[e])?!0:(typeof a[e]<"u"&&ont(`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:int(["href"],e),bodyAttributes:bce("bodyAttributes",e),defer:V4(e,q4.DEFER),encode:V4(e,q4.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:bce("htmlAttributes",e),linkTags:nT("link",["rel","href"],e),metaTags:nT("meta",["name","charset","http-equiv","property","itemprop"],e),noscriptTags:nT("noscript",["innerHTML"],e),onChangeClientState:ant(e),scriptTags:nT("script",["src","innerHTML"],e),styleTags:nT("style",["cssText"],e),title:snt(e),titleAttributes:bce("titleAttributes",e),prioritizeSeoTags:lnt(e,q4.PRIORITIZE_SEO_TAGS)}),qPe=e=>Array.isArray(e)?e.join(""):e,dnt=(e,t)=>{const n=Object.keys(e);for(let s=0;sArray.isArray(e)?e.reduce((n,s)=>(dnt(s,t)?n.priority.push(s):n.default.push(s),n),{priority:[],default:[]}):{default:e,priority:[]},tke=(e,t)=>({...e,[t]:void 0}),unt=["noscript","script","style"],Bhe=(e,t=!0)=>t===!1?String(e):String(e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),VPe=e=>Object.keys(e).reduce((t,n)=>{const s=typeof e[n]<"u"?`${n}="${e[n]}"`:`${n}`;return t?`${t} ${s}`:s},""),hnt=(e,t,n,s)=>{const a=VPe(n),o=qPe(t);return a?`<${e} ${wp}="true" ${a}>${Bhe(o,s)}`:`<${e} ${wp}="true">${Bhe(o,s)}`},mnt=(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}="${Bhe(o[x],n)}"`;return m?`${m} ${y}`:y},""),i=o.innerHTML||o.cssText||"",u=unt.indexOf(e)===-1;return`${s}<${e} ${wp}="true" ${l}${u?"/>":`>${i}`}`},""),HPe=(e,t={})=>Object.keys(e).reduce((n,s)=>{const a=jxe[s];return n[a||s]=e[s],n},t),fnt=(e,t,n)=>{const s={key:t,[wp]:!0},a=HPe(n,s);return[dt.createElement("title",a,t)]},Bee=(e,t)=>t.map((n,s)=>{const a={key:s,[wp]:!0};return Object.keys(n).forEach(o=>{const i=jxe[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)}),Ym=(e,t,n=!0)=>{switch(e){case"title":return{toComponent:()=>fnt(e,t.title,t.titleAttributes),toString:()=>hnt(e,t.title,t.titleAttributes,n)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>HPe(t),toString:()=>VPe(t)};default:return{toComponent:()=>Bee(e,t),toString:()=>mnt(e,t,n)}}},pnt=({metaTags:e,linkTags:t,scriptTags:n,encode:s})=>{const a=wce(e,_ce.meta),o=wce(t,_ce.link),l=wce(n,_ce.script);return{priorityMethods:{toComponent:()=>[...Bee("meta",a.priority),...Bee("link",o.priority),...Bee("script",l.priority)],toString:()=>`${Ym("meta",a.priority,s)} ${Ym("link",o.priority,s)} ${Ym("script",l.priority,s)}`},metaTags:a.default,linkTags:o.default,scriptTags:l.default}},gnt=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}=pnt(e)),{priority:b,base:Ym("base",t,s),bodyAttributes:Ym("bodyAttributes",n,s),htmlAttributes:Ym("htmlAttributes",a,s),link:Ym("link",x,s),meta:Ym("meta",y,s),noscript:Ym("noscript",o,s),script:Ym("script",v,s),style:Ym("style",l,s),title:Ym("title",{title:i,titleAttributes:u},s)}},$he=gnt,ZL=[],WPe=!!(typeof window<"u"&&window.document&&window.document.createElement),Uhe=class{constructor(e,t){ts(this,"instances",[]);ts(this,"canUseDOM",WPe);ts(this,"context");ts(this,"value",{setHelmet:e=>{this.context.helmet=e},helmetInstances:{get:()=>this.canUseDOM?ZL:this.instances,add:e=>{(this.canUseDOM?ZL:this.instances).push(e)},remove:e=>{const t=(this.canUseDOM?ZL:this.instances).indexOf(e);(this.canUseDOM?ZL:this.instances).splice(t,1)}}});this.context=e,this.canUseDOM=t||!1,t||(e.helmet=$he({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},xnt={},GPe=dt.createContext(xnt),Nj,KPe=(Nj=class extends A.Component{constructor(n){super(n);ts(this,"helmetData");this.helmetData=new Uhe(this.props.context||{},Nj.canUseDOM)}render(){return dt.createElement(GPe.Provider,{value:this.helmetData.value},this.props.children)}},ts(Nj,"canUseDOM",WPe),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}},qhe=(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(","))},ynt=(e,t)=>{typeof e<"u"&&document.title!==e&&(document.title=qPe(e)),qhe("title",t)},rke=(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;qhe("body",s),qhe("html",a),ynt(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)},sT=null,vnt=e=>{sT&&cancelAnimationFrame(sT),e.defer?sT=requestAnimationFrame(()=>{rke(e,()=>{sT=null})}):(rke(e),sT=null)},_nt=vnt,nke=class extends A.Component{constructor(){super(...arguments);ts(this,"rendered",!1)}shouldComponentUpdate(t){return!rnt(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=cnt(t.get().map(o=>{const l={...o.props};return delete l.context,l}));KPe.canUseDOM?_nt(a):$he&&(s=$he(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}},yue,$p=(yue=class extends A.Component{shouldComponentUpdate(e){return!Qrt(tke(this.props,"helmetData"),tke(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 Jje(eke.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 ${eke.join(", ")} are allowed. Helmet does not support rendering <${e.type}> elements. Refer to our API for more information.`),Jje(!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[nnt[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 Uhe)){const a=s;s=new Uhe(a.context,!0),delete n.helmetData}return s?dt.createElement(nke,{...n,context:s.value}):dt.createElement(GPe.Consumer,null,a=>dt.createElement(nke,{...n,context:a}))}},ts(yue,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),yue),Vhe=function(e,t){return Vhe=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])},Vhe(e,t)};function ZPe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Vhe(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var sf=function(){return sf=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 XPe(e,t){return function(n,s){t(n,s,e)}}function QPe(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 JPe(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 kxe(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 a6e(){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 MC?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 l6e(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:MC(e[a](l)),done:!1}:o?o(l):l}:o}}function c6e(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 Ote=="function"?Ote(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 d6e(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var bnt=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},Hhe=function(e){return Hhe=Object.getOwnPropertyNames||function(t){var n=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[n.length]=s);return n},Hhe(e)};function u6e(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=Hhe(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=Snt(u),u in ske)return;ske[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":Nnt,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)})},Cnt=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>S3(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 Sxe extends Error{constructor(t,n="FunctionsError",s){super(t),this.name=n,this.context=s}}class ake extends Sxe{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class ike extends Sxe{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class oke extends Sxe{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var Whe;(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"})(Whe||(Whe={}));class Mnt{constructor(t,{headers:n={},customFetch:s,region:a=Whe.Any}={}){this.url=t,this.headers=n,this.region=a,this.fetch=Cnt(s)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return Vs(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 ake(I)}),N=b.headers.get("x-relay-error");if(N&&N==="true")throw new ike(b);if(!b.ok)throw new oke(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 ake(o)}:{data:null,error:o,response:o instanceof oke||o instanceof ike?o.context:void 0}}})}}var Ch={};const C3=UTe(knt);var YL={},XL={},QL={},JL={},eO={},Tnt=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")},TC=Tnt();const Ant=TC.fetch,v6e=TC.fetch.bind(TC),_6e=TC.Headers,Ent=TC.Request,Int=TC.Response,Ck=Object.freeze(Object.defineProperty({__proto__:null,Headers:_6e,Request:Ent,Response:Int,default:v6e,fetch:Ant},Symbol.toStringTag,{value:"Module"})),Pnt=UTe(Ck);var tO={},lke;function b6e(){if(lke)return tO;lke=1,Object.defineProperty(tO,"__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 tO.default=e,tO}var cke;function w6e(){if(cke)return eO;cke=1,Object.defineProperty(eO,"__esModule",{value:!0});const e=C3,t=e.__importDefault(Pnt),n=e.__importDefault(b6e());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 eO.default=s,eO}var dke;function j6e(){if(dke)return JL;dke=1,Object.defineProperty(JL,"__esModule",{value:!0});const t=C3.__importDefault(w6e());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 JL.default=n,JL}var uke;function Cxe(){if(uke)return QL;uke=1,Object.defineProperty(QL,"__esModule",{value:!0});const t=C3.__importDefault(j6e()),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 QL.default=s,QL}var hke;function k6e(){if(hke)return XL;hke=1,Object.defineProperty(XL,"__esModule",{value:!0});const t=C3.__importDefault(Cxe());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 XL.default=n,XL}var mke;function Lnt(){if(mke)return YL;mke=1,Object.defineProperty(YL,"__esModule",{value:!0});const e=C3,t=e.__importDefault(k6e()),n=e.__importDefault(Cxe());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 YL.default=s,YL}Object.defineProperty(Ch,"__esModule",{value:!0});var N6e=Ch.PostgrestError=O6e=Ch.PostgrestBuilder=P6e=Ch.PostgrestTransformBuilder=E6e=Ch.PostgrestFilterBuilder=T6e=Ch.PostgrestQueryBuilder=C6e=Ch.PostgrestClient=void 0;const M3=C3,S6e=M3.__importDefault(Lnt());var C6e=Ch.PostgrestClient=S6e.default;const M6e=M3.__importDefault(k6e());var T6e=Ch.PostgrestQueryBuilder=M6e.default;const A6e=M3.__importDefault(Cxe());var E6e=Ch.PostgrestFilterBuilder=A6e.default;const I6e=M3.__importDefault(j6e());var P6e=Ch.PostgrestTransformBuilder=I6e.default;const L6e=M3.__importDefault(w6e());var O6e=Ch.PostgrestBuilder=L6e.default;const D6e=M3.__importDefault(b6e());N6e=Ch.PostgrestError=D6e.default;var R6e=Ch.default={PostgrestClient:S6e.default,PostgrestQueryBuilder:M6e.default,PostgrestFilterBuilder:A6e.default,PostgrestTransformBuilder:I6e.default,PostgrestBuilder:L6e.default,PostgrestError:D6e.default};const Ont=Object.freeze(Object.defineProperty({__proto__:null,get PostgrestBuilder(){return O6e},get PostgrestClient(){return C6e},get PostgrestError(){return N6e},get PostgrestFilterBuilder(){return E6e},get PostgrestQueryBuilder(){return T6e},get PostgrestTransformBuilder(){return P6e},default:R6e},Symbol.toStringTag,{value:"Module"})),{PostgrestClient:Dnt,PostgrestQueryBuilder:etr,PostgrestFilterBuilder:ttr,PostgrestTransformBuilder:rtr,PostgrestBuilder:ntr,PostgrestError:str}=R6e||Ont;class Rnt{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 Fnt="2.78.0",znt=`realtime-js/${Fnt}`,Bnt="1.0.0",Ghe=1e4,$nt=1e3,Unt=100;var LA;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(LA||(LA={}));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 Khe;(function(e){e.websocket="websocket"})(Khe||(Khe={}));var Xw;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"})(Xw||(Xw={}));class qnt{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 F6e{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 fke=(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]=Vnt(l,e,t,a),o),{}):{}},Vnt=(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)?z6e(o,l):Zhe(l)},z6e=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return Knt(t,n)}switch(e){case nl.bool:return Hnt(t);case nl.float4:case nl.float8:case nl.int2:case nl.int4:case nl.int8:case nl.numeric:case nl.oid:return Wnt(t);case nl.json:case nl.jsonb:return Gnt(t);case nl.timestamp:return Znt(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 Zhe(t);default:return Zhe(t)}},Zhe=e=>e,Hnt=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},Wnt=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Gnt=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch(t){return console.log(`JSON parse error: ${t}`),e}return e},Knt=(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=>z6e(t,i))}return e},Znt=e=>typeof e=="string"?e.replace(" ","T"):e,B6e=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 jce{constructor(t,n,s={},a=Ghe){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 pke;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(pke||(pke={}));class OA{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=OA.syncState(this.state,a,o,l),this.pendingDiffs.forEach(u=>{this.state=OA.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=OA.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 gke;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(gke||(gke={}));var DA;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(DA||(DA={}));var Vx;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Vx||(Vx={}));class Mxe{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 jce(this,hp.join,this.params,this.timeout),this.rejoinTimer=new F6e(()=>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 OA(this),this.broadcastEndpointURL=B6e(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[DA.PRESENCE]&&this.bindings[DA.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===DA.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 jce(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 jce(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>Unt){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&&Mxe.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=fke(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=fke(t.columns,t.old_record)),n}}const kce=()=>{},rO={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Ynt=[1e3,2e3,5e3,1e4],Xnt=1e4,Qnt=` addEventListener("message", (e) => { if (e.data.event === "start") { setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); } });`;class Jnt{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=Ghe,this.transport=null,this.heartbeatIntervalMs=rO.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=kce,this.ref=0,this.reconnectTimer=null,this.logger=kce,this.conn=null,this.sendBuffer=[],this.serializer=new qnt,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)=>S3(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}/${Khe.websocket}`,this.httpEndpoint=B6e(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=Rnt.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:Bnt}))}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 LA.connecting:return Xw.Connecting;case LA.open:return Xw.Open;case LA.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 Mxe(`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($nt,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},rO.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([Qnt],{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:znt};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 F6e(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},rO.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:Ghe,this.heartbeatIntervalMs=(a=t==null?void 0:t.heartbeatIntervalMs)!==null&&a!==void 0?a:rO.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:kce,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=>Ynt[y-1]||Xnt,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 Txe 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 est extends Txe{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 Yhe extends Txe{constructor(t,n){super(t),this.name="StorageUnknownError",this.originalError=n}}const Axe=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>S3(async()=>{const{default:s}=await Promise.resolve().then(()=>Ck);return{default:s}},void 0).then(({default:s})=>s(...n)):t=fetch,(...n)=>t(...n)},tst=()=>Vs(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield S3(()=>Promise.resolve().then(()=>Ck),void 0)).Response:Response}),Xhe=e=>{if(Array.isArray(e))return e.map(n=>Xhe(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]=Xhe(s)}),t},rst=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)},Nce=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)},nst=(e,t,n)=>Vs(void 0,void 0,void 0,function*(){const s=yield tst();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 est(Nce(a),o,l))}).catch(a=>{t(new Yhe(Nce(a),a))}):t(new Yhe(Nce(e),e))}),sst=(e,t,n,s)=>{const a={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"||!s?a:(rst(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 tP(e,t,n,s,a,o){return Vs(this,void 0,void 0,function*(){return new Promise((l,i)=>{e(n,sst(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=>nst(u,i,s))})})}function AE(e,t,n,s){return Vs(this,void 0,void 0,function*(){return tP(e,"GET",t,n,s)})}function lp(e,t,n,s,a){return Vs(this,void 0,void 0,function*(){return tP(e,"POST",t,s,a,n)})}function Qhe(e,t,n,s,a){return Vs(this,void 0,void 0,function*(){return tP(e,"PUT",t,s,a,n)})}function ast(e,t,n,s){return Vs(this,void 0,void 0,function*(){return tP(e,"HEAD",t,Object.assign(Object.assign({},n),{noResolveJson:!0}),s)})}function Exe(e,t,n,s,a){return Vs(this,void 0,void 0,function*(){return tP(e,"DELETE",t,s,a,n)})}class ist{constructor(t,n){this.downloadFn=t,this.shouldThrowOnError=n}then(t,n){return this.execute().then(t,n)}execute(){return Vs(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 $6e;class ost{constructor(t,n){this.downloadFn=t,this.shouldThrowOnError=n,this[$6e]="BlobDownloadBuilder",this.promise=null}asStream(){return new ist(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 Vs(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}})}}$6e=Symbol.toStringTag;const lst={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},xke={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class cst{constructor(t,n={},s,a){this.shouldThrowOnError=!1,this.url=t,this.headers=n,this.bucketId=s,this.fetch=Axe(a)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(t,n,s,a){return Vs(this,void 0,void 0,function*(){try{let o;const l=Object.assign(Object.assign({},xke),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"?Qhe: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 Vs(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",t,n,s)})}uploadToSignedUrl(t,n,s,a){return Vs(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:xke.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 Qhe(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 Vs(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 Txe("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 Vs(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",t,n,s)})}move(t,n,s){return Vs(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 Vs(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 Vs(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 Vs(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=()=>AE(this.fetch,`${this.url}/${a}/${i}${l}`,{headers:this.headers,noResolveJson:!0});return new ost(u,this.shouldThrowOnError)}info(t){return Vs(this,void 0,void 0,function*(){const n=this._getFinalPath(t);try{const s=yield AE(this.fetch,`${this.url}/object/info/${n}`,{headers:this.headers});return{data:Xhe(s),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Dl(s))return{data:null,error:s};throw s}})}exists(t){return Vs(this,void 0,void 0,function*(){const n=this._getFinalPath(t);try{return yield ast(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 Yhe){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 Vs(this,void 0,void 0,function*(){try{return{data:yield Exe(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 Vs(this,void 0,void 0,function*(){try{const a=Object.assign(Object.assign(Object.assign({},lst),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 Vs(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 U6e="2.78.0",q6e={"X-Client-Info":`storage-js/${U6e}`};class dst{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({},q6e),n),this.fetch=Axe(s)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(t){return Vs(this,void 0,void 0,function*(){try{const n=this.listBucketOptionsToQueryString(t);return{data:yield AE(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 Vs(this,void 0,void 0,function*(){try{return{data:yield AE(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 Vs(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 Vs(this,void 0,void 0,function*(){try{return{data:yield Qhe(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 Vs(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 Vs(this,void 0,void 0,function*(){try{return{data:yield Exe(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 ust{constructor(t,n={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},q6e),n),this.fetch=Axe(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(t){return Vs(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 Vs(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 AE(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 Vs(this,void 0,void 0,function*(){try{return{data:yield Exe(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 Ixe={"X-Client-Info":`storage-js/${U6e}`,"Content-Type":"application/json"};class V6e extends Error{constructor(t){super(t),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}}function om(e){return typeof e=="object"&&e!==null&&"__isStorageVectorsError"in e}class Sce extends V6e{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 hst extends V6e{constructor(t,n){super(t),this.name="StorageVectorsUnknownError",this.originalError=n}}var yke;(function(e){e.InternalError="InternalError",e.S3VectorConflictException="S3VectorConflictException",e.S3VectorNotFoundException="S3VectorNotFoundException",e.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",e.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",e.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(yke||(yke={}));const Pxe=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>S3(async()=>{const{default:s}=await Promise.resolve().then(()=>Ck);return{default:s}},void 0).then(({default:s})=>s(...n)):t=fetch,(...n)=>t(...n)},mst=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)},vke=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),fst=(e,t,n)=>Vs(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 Sce(vke(l),a,i))}).catch(()=>{const l=a+"",i=o.statusText||`HTTP ${a} error`;t(new Sce(i,a,l))});else{const l=a+"",i=o.statusText||`HTTP ${a} error`;t(new Sce(i,a,l))}}else t(new hst(vke(e),e))}),pst=(e,t,n,s)=>{const a={method:e,headers:(t==null?void 0:t.headers)||{}};return s?(mst(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 gst(e,t,n,s,a,o){return Vs(this,void 0,void 0,function*(){return new Promise((l,i)=>{e(n,pst(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=>fst(u,i,s))})})}function lm(e,t,n,s,a){return Vs(this,void 0,void 0,function*(){return gst(e,"POST",t,s,a,n)})}class xst{constructor(t,n={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Ixe),n),this.fetch=Pxe(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(t){return Vs(this,void 0,void 0,function*(){try{return{data:(yield lm(this.fetch,`${this.url}/CreateIndex`,t,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(om(n))return{data:null,error:n};throw n}})}getIndex(t,n){return Vs(this,void 0,void 0,function*(){try{return{data:yield lm(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:t,indexName:n},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(om(s))return{data:null,error:s};throw s}})}listIndexes(t){return Vs(this,void 0,void 0,function*(){try{return{data:yield lm(this.fetch,`${this.url}/ListIndexes`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(om(n))return{data:null,error:n};throw n}})}deleteIndex(t,n){return Vs(this,void 0,void 0,function*(){try{return{data:(yield lm(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:t,indexName:n},{headers:this.headers}))||{},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(om(s))return{data:null,error:s};throw s}})}}class yst{constructor(t,n={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Ixe),n),this.fetch=Pxe(s)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(t){return Vs(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 lm(this.fetch,`${this.url}/PutVectors`,t,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(om(n))return{data:null,error:n};throw n}})}getVectors(t){return Vs(this,void 0,void 0,function*(){try{return{data:yield lm(this.fetch,`${this.url}/GetVectors`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(om(n))return{data:null,error:n};throw n}})}listVectors(t){return Vs(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 lm(this.fetch,`${this.url}/ListVectors`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(om(n))return{data:null,error:n};throw n}})}queryVectors(t){return Vs(this,void 0,void 0,function*(){try{return{data:yield lm(this.fetch,`${this.url}/QueryVectors`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(om(n))return{data:null,error:n};throw n}})}deleteVectors(t){return Vs(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 lm(this.fetch,`${this.url}/DeleteVectors`,t,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(om(n))return{data:null,error:n};throw n}})}}class vst{constructor(t,n={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Ixe),n),this.fetch=Pxe(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(t){return Vs(this,void 0,void 0,function*(){try{return{data:(yield lm(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(om(n))return{data:null,error:n};throw n}})}getBucket(t){return Vs(this,void 0,void 0,function*(){try{return{data:yield lm(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:t},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(om(n))return{data:null,error:n};throw n}})}listBuckets(){return Vs(this,arguments,void 0,function*(t={}){try{return{data:yield lm(this.fetch,`${this.url}/ListVectorBuckets`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(om(n))return{data:null,error:n};throw n}})}deleteBucket(t){return Vs(this,void 0,void 0,function*(){try{return{data:(yield lm(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(om(n))return{data:null,error:n};throw n}})}}class _st extends vst{constructor(t,n={}){super(t,n.headers||{},n.fetch)}from(t){return new bst(this.url,this.headers,t,this.fetch)}}class bst extends xst{constructor(t,n,s,a){super(t,n,a),this.vectorBucketName=s}createIndex(t){const n=Object.create(null,{createIndex:{get:()=>super.createIndex}});return Vs(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 Vs(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 Vs(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 Vs(this,void 0,void 0,function*(){return n.deleteIndex.call(this,this.vectorBucketName,t)})}index(t){return new wst(this.url,this.headers,this.vectorBucketName,t,this.fetch)}}class wst extends yst{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 Vs(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 Vs(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 Vs(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 Vs(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 Vs(this,void 0,void 0,function*(){return n.deleteVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}}class jst extends dst{constructor(t,n={},s,a){super(t,n,s,a)}from(t){return new cst(this.url,this.headers,t,this.fetch)}get vectors(){return new _st(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new ust(this.url+"/iceberg",this.headers,this.fetch)}}const kst="2.78.0";let PT="";typeof Deno<"u"?PT="deno":typeof document<"u"?PT="web":typeof navigator<"u"&&navigator.product==="ReactNative"?PT="react-native":PT="node";const Nst={"X-Client-Info":`supabase-js-${PT}/${kst}`},Sst={headers:Nst},Cst={schema:"public"},Mst={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Tst={},Ast=e=>{let t;return e?t=e:typeof fetch>"u"?t=v6e:t=fetch,(...n)=>t(...n)},Est=()=>typeof Headers>"u"?_6e:Headers,Ist=(e,t,n)=>{const s=Ast(n),a=Est();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 Pst(e){return e.endsWith("/")?e:e+"/"}function Lst(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 Ost(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(Pst(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const H6e="2.78.0",FS=30*1e3,Jhe=3,Cce=Jhe*FS,Dst="http://localhost:9999",Rst="supabase.auth.token",Fst={"X-Client-Info":`gotrue-js/${H6e}`},eme="X-Supabase-Api-Version",W6e={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},zst=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Bst=10*60*1e3;class EE 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 $st extends EE{constructor(t,n,s){super(t,n,s),this.name="AuthApiError",this.status=n,this.code=s}}function Ust(e){return la(e)&&e.name==="AuthApiError"}class Qw extends EE{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class Nv extends EE{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 qst(e){return la(e)&&e.name==="AuthSessionMissingError"}class vS extends Nv{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class nO extends Nv{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class sO 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 Vst(e){return la(e)&&e.name==="AuthImplicitGrantRedirectError"}class _ke 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 tme extends Nv{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function Mce(e){return la(e)&&e.name==="AuthRetryableFetchError"}class bke extends Nv{constructor(t,n,s){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=s}}class rme extends Nv{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const Dte="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),wke=` \r=`.split(""),Hst=(()=>{const e=new Array(128);for(let t=0;t=6;){const s=t.queue>>t.queuedBits-6&63;n(Dte[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(Dte[s]),t.queuedBits-=6}}function G6e(e,t,n){const s=Hst[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 kke(e){const t=[],n=l=>{t.push(String.fromCodePoint(l))},s={utf8seq:0,codepoint:0},a={queue:0,queuedBits:0},o=l=>{Kst(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 Gst(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}Wst(s,t)}}function Kst(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 H4(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=>jke(a,n,s)),jke(null,n,s),t.join("")}function Yst(e){return Math.round(Date.now()/1e3)+e}function Xst(){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},K6e=()=>{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 Qst(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 Z6e=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>S3(async()=>{const{default:s}=await Promise.resolve().then(()=>Ck);return{default:s}},void 0).then(({default:s})=>s(...n)):t=fetch,(...n)=>t(...n)},Jst=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}},F0=async(e,t)=>{await e.removeItem(t)};class Cse{constructor(){this.promise=new Cse.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}Cse.promiseConstructor=Promise;function Tce(e){const t=e.split(".");if(t.length!==3)throw new rme("Invalid JWT structure");for(let s=0;s{setTimeout(()=>t(null),e)})}function tat(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 rat(e){return("0"+e.toString(16)).substr(-2)}function nat(){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,rat).join("")}async function sat(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 aat(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 sat(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function _S(e,t,n=!1){const s=nat();let a=s;n&&(a+="/PASSWORD_RECOVERY"),await zS(e,`${t}-code-verifier`,a);const o=await aat(s);return[o,s===o?"plain":"s256"]}const iat=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function oat(e){const t=e.headers.get(eme);if(!t||!t.match(iat))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function lat(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 cat(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 dat=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function bS(e){if(!dat.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Ace(){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 uat(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 Nke(e){return JSON.parse(JSON.stringify(e))}const Ww=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),hat=[502,503,504];async function Ske(e){var t;if(!Jst(e))throw new tme(Ww(e),0);if(hat.includes(e.status))throw new tme(Ww(e),e.status);let n;try{n=await e.json()}catch(o){throw new Qw(Ww(o),o)}let s;const a=oat(e);if(a&&a.getTime()>=W6e["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 bke(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 bke(Ww(n),e.status,n.weak_password.reasons);throw new $st(Ww(n),e.status||500,s)}const mat=(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 Ba(e,t,n,s){var a;const o=Object.assign({},s==null?void 0:s.headers);o[eme]||(o[eme]=W6e["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 fat(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 fat(e,t,n,s,a,o){const l=mat(t,s,a,o);let i;try{i=await e(n,Object.assign({},l))}catch(u){throw console.error(u),new tme(Ww(u),0)}if(i.ok||await Ske(i),s!=null&&s.noResolveJson)return i;try{return await i.json()}catch(u){await Ske(u)}}function sp(e){var t;let n=null;xat(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=Yst(e.expires_in)));const s=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:s},error:null}}function Cke(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 c1(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function pat(e){return{data:e,error:null}}function gat(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 Mke(e){return e}function xat(e){return e.access_token&&e.refresh_token&&e.expires_in}const Ece=["global","local","others"];class yat{constructor({url:t="",headers:n={},fetch:s}){this.url=t,this.headers=n,this.fetch=Z6e(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=Ece[0]){if(Ece.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Ece.join(", ")}`);try{return await Ba(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 Ba(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:c1})}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 Ba(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:a,headers:this.headers,xform:gat,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 Ba(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:c1})}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 Ba(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:Mke});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 Ba(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:c1})}catch(n){if(la(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){bS(t);try{return await Ba(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:c1})}catch(s){if(la(s))return{data:{user:null},error:s};throw s}}async deleteUser(t,n=!1){bS(t);try{return await Ba(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:c1})}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 Ba(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 Ba(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 Ba(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:Mke});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 Ba(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 Ba(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 Ba(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 Ba(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 Ba(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 Tke(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const wS={debug:!!(globalThis&&K6e()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Y6e extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class vat extends Y6e{}async function _at(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 vat(`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 bat(){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 X6e(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function wat(e){return parseInt(e,16)}function jat(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,s=>s.toString(16).padStart(2,"0")).join("")}function kat(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=X6e(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 Rte extends zc{constructor(t,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:t}),this.name="WebAuthnUnknownError",this.originalError=n}}function Nat({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(Q6e(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 Sat({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(Q6e(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 Cat{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 Mat=new Cat;function Tat(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=H4(t).buffer,l=Object.assign(Object.assign({},n),{id:H4(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]=Fte(i,l):s[o]=Fte(l)}else s[o]=l}return s}function Rat(e,t){return Fte(Oat,e,t||{})}function Fat(e,t){return Fte(Dat,e,t||{})}class zat{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??Mat.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=Rat(l.webauthn.credential_options.publicKey,o==null?void 0:o.create),{data:x,error:y}=await Pat({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=Fat(l.webauthn.credential_options.publicKey,o==null?void 0:o.request),{data:x,error:y}=await Lat(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 EE("rpId is required for WebAuthn authentication")};try{if(!Ake())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 EE("rpId is required for WebAuthn registration")};try{if(!Ake())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)}}}}bat();const Bat={url:Dst,storageKey:Rst,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Fst,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function Eke(e,t,n){return await n()}const jS={};class IE{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=IE.nextInstanceID,IE.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({},Bat),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 yat({url:a.url,headers:a.headers,fetch:a.fetch}),this.url=a.url,this.headers=a.headers,this.fetch=Z6e(a.fetch),this.lock=a.lock||Eke,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=_at:this.lock=Eke,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 zat(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:K6e()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Tke(this.memoryStorage)),a.userStorage&&(this.userStorage=a.userStorage)):(this.memoryStorage={},this.storage=Tke(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} (${H6e}) ${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=Qst(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),Vst(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 Ba(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 Ba(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 Ba(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 nO("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 Ba(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:Cke})}else if("phone"in t){const{phone:o,password:l,options:i}=t;n=await Ba(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:Cke})}else throw new nO("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=X6e(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=wat(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=kat(W),N=await P.request({method:"personal_sign",params:[jat(b),U]})}try{const{data:k,error:M}=await Ba(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 Ba(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 Ba(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:s},xform:sp});if(await F0(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 Ba(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 Ba(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 Ba(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 nO("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 Ba(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 Ba(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:pat})}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 Ba(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 Ba(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 Ba(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 nO("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 Ba(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:c1}):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 Ba(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:c1})})}catch(n){if(la(n))return qst(n)&&(await this._removeSession(),await F0(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 Ba(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:c1});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}=Tce(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 sO("No browser detected.");if(t.error||t.error_description||t.error_code)throw new sO(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 _ke("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new sO("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 _ke("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 sO("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&&!(Ust(i)&&(i.status===404||i.status===401||i.status===403)))return{error:i}}return t!=="others"&&(await this._removeSession(),await F0(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(t){const n=Xst(),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 Ba(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 Ba(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 Ba(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 Ba(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 tat(async a=>(a>0&&await eat(200*Math.pow(2,a-1)),this._debug(n,"refreshing attempt",a),await Ba(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&&Mce(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 ${Jhe} ticks`),a<=Jhe&&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 Y6e)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 Ba(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 Ba(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"?Eat(t.webauthn.credential_response):Iat(t.webauthn.credential_response)})}:{code:t.code}),{data:i,error:u}=await Ba(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 Ba(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:Tat(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:Aat(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}=Tce(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 Ba(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 Ba(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 Ba(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+Bst>a)return s;const{data:o,error:l}=await Ba(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}}=Tce(s);n!=null&&n.allowExpired||lat(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=cat(a.alg),y=await crypto.subtle.importKey("jwk",m,x,!0,["verify"]);if(!await crypto.subtle.verify(x,y,l,Zst(`${i}.${u}`)))throw new rme("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}}}IE.nextInstanceID=0;const $at=IE;class Uat extends $at{constructor(t){super(t)}}class qat{constructor(t,n,s){var a,o,l;this.supabaseUrl=t,this.supabaseKey=n;const i=Ost(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:Cst,realtime:Tst,auth:Object.assign(Object.assign({},Mst),{storageKey:u}),global:Sst},x=Lst(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=Ist(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 Dnt(new URL("rest/v1",i).href,{headers:this.headers,schema:x.db.schema,fetch:this.fetch}),this.storage=new jst(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),x.accessToken||this._listenForAuthEvents()}get functions(){return new Mnt(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 Uat({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 Jnt(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 Vat=(e,t,n)=>new qat(e,t,n);function Hat(){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}Hat()&&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 Wat="https://relzejiswnotikjgvjhz.supabase.co",Gat="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJlbHplamlzd25vdGlramd2amh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE5NTAzNDQsImV4cCI6MjA3NzUyNjM0NH0.dzIkIr_oFSbFE3oWS0ktIr83iKHHkZxt40Gc7SpC_mM",Y=Vat(Wat,Gat,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),J6e=A.createContext(void 0),Kat=({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=Wn(),T=async U=>{try{console.log("Checking roles via RPC for user:",U);const[{data:V,error:W},{data:G,error:Q}]=await Promise.all([Y.rpc("has_role",{_user_id:U,_role:"admin"}),Y.rpc("has_role",{_user_id:U,_role:"brokerage_manager"})]);if(W||Q)console.error("Role RPC errors:",{isAdminError:W,isBrokerError:Q}),u(!1),x(!1);else{const de=!!V,se=!!G;console.log("RPC roles result:",{adminValue:de,brokerValue:se}),u(de),x(se)}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:de,error:se}=await Y.from("brokerage_manager_assignments").select("brokerage_id").eq("user_id",U);if(console.log("Managed brokerage assignments result:",{assignments:de,assignmentsError:se}),se||!de){console.error("Error fetching managed brokerage assignments:",se),N([]);return}const pe=Array.from(new Set(de.map(xe=>xe.brokerage_id).filter(Boolean)));if(pe.length===0){N([]);return}const{data:ne,error:me}=await Y.from("brokerages").select("id, name").in("id",pe);if(console.log("Managed brokerages details result:",{brokeragesData:ne,brokeragesError:me}),me||!ne){console.error("Error fetching managed brokerages details:",me),N([]);return}const he=ne.map(xe=>({id:xe.id,name:xe.name})).sort((xe,Te)=>pe.indexOf(xe.id)-pe.indexOf(Te.id));console.log("Parsed managed brokerages:",he),N(he),he.length>0&&!k&&M(he[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:Q}=await Y.auth.signUp({email:U,password:V,options:{emailRedirectTo:G,data:{name:W}}});if(Q)throw Ae.error(Q.message),Q;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(J6e.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(J6e);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e},eLe=A.createContext(void 0),C_="levelup_admin_session",z0="levelup_impersonation",Zat=({children:e})=>{const[t,n]=A.useState(!1),[s,a]=A.useState(null),[o,l]=A.useState(!1);A.useEffect(()=>{const m=sessionStorage.getItem(z0);if(m)try{const x=JSON.parse(m);n(!0),a(x)}catch{sessionStorage.removeItem(z0)}},[]);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(z0,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(z0),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(z0),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(z0),!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(z0),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(z0),window.location.href="/auth"}finally{l(!1)}};return r.jsx(eLe.Provider,{value:{isImpersonating:t,impersonatedUser:s,startImpersonation:i,stopImpersonation:u,isLoading:o},children:e})},Lxe=()=>{const e=A.useContext(eLe);if(e===void 0)throw new Error("useImpersonation must be used within an ImpersonationProvider");return e},PE=y3("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"}}),X=A.forwardRef(({className:e,variant:t,size:n,asChild:s=!1,...a},o)=>{const l=s?Jge:"button";return r.jsx(l,{className:Ut(PE({variant:t,size:n,className:e})),ref:o,...a})});X.displayName="Button";const Yat=()=>{const{isImpersonating:e,impersonatedUser:t,stopImpersonation:n,isLoading:s}=Lxe();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(Gu,{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(X,{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(Wr,{className:"h-4 w-4 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(us,{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"})]})})]})})},tLe=A.createContext(void 0),aT="levelup_acting_as",Xat=({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(aT);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(aT,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(aT,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(aT,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(aT),m({}))},b=k=>n?u[k]===!0:!0,N=n&&l?l.id:(t==null?void 0:t.id)||null;return r.jsx(tLe.Provider,{value:{isAssistant:n,assignedAgents:a,actingAsAgent:l,setActingAsAgent:v,effectiveUserId:N,permissions:u,hasPermission:b,isLoading:x},children:e})},Oxe=()=>{const e=A.useContext(tLe);if(e===void 0)throw new Error("useActingAs must be used within an ActingAsProvider");return e},Yc=()=>{const{effectiveUserId:e}=Oxe();return e};var rLe={exports:{}},nLe={};/** * @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 AC=A;function Qat(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Jat=typeof Object.is=="function"?Object.is:Qat,eit=AC.useState,tit=AC.useEffect,rit=AC.useLayoutEffect,nit=AC.useDebugValue;function sit(e,t){var n=t(),s=eit({inst:{value:n,getSnapshot:t}}),a=s[0].inst,o=s[1];return rit(function(){a.value=n,a.getSnapshot=t,Ice(a)&&o({inst:a})},[e,n,t]),tit(function(){return Ice(a)&&o({inst:a}),e(function(){Ice(a)&&o({inst:a})})},[e]),nit(n),n}function Ice(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Jat(e,n)}catch{return!0}}function ait(e,t){return t()}var iit=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?ait:sit;nLe.useSyncExternalStore=AC.useSyncExternalStore!==void 0?AC.useSyncExternalStore:iit;rLe.exports=nLe;var oit=rLe.exports;function lit(){return oit.useSyncExternalStore(cit,()=>!0,()=>!1)}function cit(){return()=>{}}var Dxe="Avatar",[dit]=cc(Dxe),[uit,sLe]=dit(Dxe),aLe=A.forwardRef((e,t)=>{const{__scopeAvatar:n,...s}=e,[a,o]=A.useState("idle");return r.jsx(uit,{scope:n,imageLoadingStatus:a,onImageLoadingStatusChange:o,children:r.jsx(Bn.span,{...s,ref:t})})});aLe.displayName=Dxe;var iLe="AvatarImage",oLe=A.forwardRef((e,t)=>{const{__scopeAvatar:n,src:s,onLoadingStatusChange:a=()=>{},...o}=e,l=sLe(iLe,n),i=hit(s,o),u=sc(m=>{a(m),l.onImageLoadingStatusChange(m)});return oc(()=>{i!=="idle"&&u(i)},[i,u]),i==="loaded"?r.jsx(Bn.img,{...o,ref:t,src:s}):null});oLe.displayName=iLe;var lLe="AvatarFallback",cLe=A.forwardRef((e,t)=>{const{__scopeAvatar:n,delayMs:s,...a}=e,o=sLe(lLe,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(Bn.span,{...a,ref:t}):null});cLe.displayName=lLe;function Ike(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function hit(e,{referrerPolicy:t,crossOrigin:n}){const s=lit(),a=A.useRef(null),o=s?(a.current||(a.current=new window.Image),a.current):null,[l,i]=A.useState(()=>Ike(o,e));return oc(()=>{i(Ike(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 dLe=aLe,uLe=oLe,hLe=cLe;const ea=A.forwardRef(({className:e,...t},n)=>r.jsx(dLe,{ref:n,className:Ut("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));ea.displayName=dLe.displayName;const Ti=A.forwardRef(({className:e,...t},n)=>r.jsx(uLe,{ref:n,className:Ut("aspect-square h-full w-full",e),...t}));Ti.displayName=uLe.displayName;const ta=A.forwardRef(({className:e,...t},n)=>r.jsx(hLe,{ref:n,className:Ut("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));ta.displayName=hLe.displayName;const mit=y3("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 Tt({className:e,variant:t,...n}){return r.jsx("div",{className:Ut(mit({variant:t}),e),...n})}var fit=A.createContext(void 0);function Mk(e){const t=A.useContext(fit);return e||t||"ltr"}var Pce=0;function Mse(){A.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Pke()),document.body.insertAdjacentElement("beforeend",e[1]??Pke()),Pce++,()=>{Pce===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Pce--}},[])}function Pke(){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 Lce="focusScope.autoFocusOnMount",Oce="focusScope.autoFocusOnUnmount",Lke={bubbles:!1,cancelable:!0},pit="FocusScope",rP=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:q0(y.current,{select:!0})},M=function(P){if(b.paused||!i)return;const F=P.relatedTarget;F!==null&&(i.contains(F)||q0(y.current,{select:!0}))},I=function(P){if(document.activeElement===document.body)for(const D of P)D.removedNodes.length>0&&q0(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){Dke.add(b);const k=document.activeElement;if(!i.contains(k)){const I=new CustomEvent(Lce,Lke);i.addEventListener(Lce,m),i.dispatchEvent(I),I.defaultPrevented||(git(bit(mLe(i)),{select:!0}),document.activeElement===k&&q0(i))}return()=>{i.removeEventListener(Lce,m),setTimeout(()=>{const I=new CustomEvent(Oce,Lke);i.addEventListener(Oce,x),i.dispatchEvent(I),I.defaultPrevented||q0(k??document.body,{select:!0}),i.removeEventListener(Oce,x),Dke.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]=xit(T);P&&F?!k.shiftKey&&I===F?(k.preventDefault(),n&&q0(P,{select:!0})):k.shiftKey&&I===P&&(k.preventDefault(),n&&q0(F,{select:!0})):I===T&&k.preventDefault()}},[n,s,b.paused]);return r.jsx(Bn.div,{tabIndex:-1,...l,ref:v,onKeyDown:N})});rP.displayName=pit;function git(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(q0(s,{select:t}),document.activeElement!==n)return}function xit(e){const t=mLe(e),n=Oke(t,e),s=Oke(t.reverse(),e);return[n,s]}function mLe(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 Oke(e,t){for(const n of e)if(!yit(n,{upTo:t}))return n}function yit(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 vit(e){return e instanceof HTMLInputElement&&"select"in e}function q0(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&vit(e)&&t&&e.select()}}var Dke=_it();function _it(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Rke(e,t),e.unshift(t)},remove(t){var n;e=Rke(e,t),(n=e[0])==null||n.resume()}}}function Rke(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function bit(e){return e.filter(t=>t.tagName!=="A")}var Dce="rovingFocusGroup.onEntryFocus",wit={bubbles:!1,cancelable:!0},nP="RovingFocusGroup",[nme,fLe,jit]=GI(nP),[kit,T3]=cc(nP,[jit]),[Nit,Sit]=kit(nP),pLe=A.forwardRef((e,t)=>r.jsx(nme.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(nme.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Cit,{...e,ref:t})})}));pLe.displayName=nP;var Cit=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]=sh({prop:l,defaultProp:i??null,onChange:u,caller:nP}),[I,T]=A.useState(!1),P=sc(m),F=fLe(n),D=A.useRef(!1),[U,V]=A.useState(0);return A.useEffect(()=>{const W=v.current;if(W)return W.addEventListener(Dce,P),()=>W.removeEventListener(Dce,P)},[P]),r.jsx(Nit,{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(Bn.div,{tabIndex:I||U===0?-1:0,"data-orientation":s,...y,ref:b,style:{outline:"none",...e.style},onMouseDown:xn(e.onMouseDown,()=>{D.current=!0}),onFocus:xn(e.onFocus,W=>{const G=!D.current;if(W.target===W.currentTarget&&G&&!I){const Q=new CustomEvent(Dce,wit);if(W.currentTarget.dispatchEvent(Q),!Q.defaultPrevented){const ae=F().filter(ne=>ne.focusable),oe=ae.find(ne=>ne.active),de=ae.find(ne=>ne.id===k),pe=[oe,de,...ae].filter(Boolean).map(ne=>ne.ref.current);yLe(pe,x)}}D.current=!1}),onBlur:xn(e.onBlur,()=>T(!1))})})}),gLe="RovingFocusGroupItem",xLe=A.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:a=!1,tabStopId:o,children:l,...i}=e,u=gd(),m=o||u,x=Sit(gLe,n),y=x.currentTabStopId===m,v=fLe(n),{onFocusableItemAdd:b,onFocusableItemRemove:N,currentTabStopId:k}=x;return A.useEffect(()=>{if(s)return b(),()=>N()},[s,b,N]),r.jsx(nme.ItemSlot,{scope:n,id:m,focusable:s,active:a,children:r.jsx(Bn.span,{tabIndex:y?0:-1,"data-orientation":x.orientation,...i,ref:t,onMouseDown:xn(e.onMouseDown,M=>{s?x.onItemFocus(m):M.preventDefault()}),onFocus:xn(e.onFocus,()=>x.onItemFocus(m)),onKeyDown:xn(e.onKeyDown,M=>{if(M.key==="Tab"&&M.shiftKey){x.onItemShiftTab();return}if(M.target!==M.currentTarget)return;const I=Ait(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?Eit(P,F+1):P.slice(F+1)}setTimeout(()=>yLe(P))}}),children:typeof l=="function"?l({isCurrentTabStop:y,hasTabStop:k!=null}):l})})});xLe.displayName=gLe;var Mit={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Tit(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Ait(e,t,n){const s=Tit(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return Mit[s]}function yLe(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function Eit(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var Rxe=pLe,Fxe=xLe,Iit=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},kS=new WeakMap,aO=new WeakMap,iO={},Rce=0,vLe=function(e){return e&&(e.host||vLe(e.parentNode))},Pit=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=vLe(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})},Lit=function(e,t,n,s){var a=Pit(t,Array.isArray(e)?e:[e]);iO[n]||(iO[n]=new WeakMap);var o=iO[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&&aO.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(),Rce++,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||(aO.has(y)||y.removeAttribute(s),aO.delete(y)),b||y.removeAttribute(n)}),Rce--,Rce||(kS=new WeakMap,kS=new WeakMap,aO=new WeakMap,iO={})}},Tse=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),a=Iit(e);return a?(s.push.apply(s,Array.from(a.querySelectorAll("[aria-live]"))),Lit(s,a,n,"aria-hidden")):function(){return null}},$ee="right-scroll-bar-position",Uee="width-before-scroll-bar",Oit="with-scroll-bars-hidden",Dit="--removed-body-scroll-bar-size";function Fce(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Rit(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 Fit=typeof window<"u"?A.useLayoutEffect:A.useEffect,Fke=new WeakMap;function zit(e,t){var n=Rit(null,function(s){return e.forEach(function(a){return Fce(a,s)})});return Fit(function(){var s=Fke.get(n);if(s){var a=new Set(s),o=new Set(e),l=n.current;a.forEach(function(i){o.has(i)||Fce(i,null)}),o.forEach(function(i){a.has(i)||Fce(i,l)})}Fke.set(n,e)},[e]),n}function Bit(e){return e}function $it(e,t){t===void 0&&(t=Bit);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 Uit(e){e===void 0&&(e={});var t=$it(null);return t.options=sf({async:!0,ssr:!1},e),t}var _Le=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,sf({},n))};_Le.isSideCarExport=!0;function qit(e,t){return e.useMedium(t),_Le}var bLe=Uit(),zce=function(){},Ase=A.forwardRef(function(e,t){var n=A.useRef(null),s=A.useState({onScrollCapture:zce,onWheelCapture:zce,onTouchMoveCapture:zce}),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=zit([n,t]),V=sf(sf({},F),a);return A.createElement(A.Fragment,null,x&&A.createElement(D,{sideCar:bLe,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),sf(sf({},V),{ref:U})):A.createElement(T,sf({},V,{className:u,ref:U}),i))});Ase.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ase.classNames={fullWidth:Uee,zeroRight:$ee};var Vit=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Hit(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Vit();return t&&e.setAttribute("nonce",t),e}function Wit(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Git(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Kit=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Hit())&&(Wit(t,n),Git(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Zit=function(){var e=Kit();return function(t,n){A.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},wLe=function(){var e=Zit(),t=function(n){var s=n.styles,a=n.dynamic;return e(s,a),null};return t},Yit={left:0,top:0,right:0,gap:0},Bce=function(e){return parseInt(e||"",10)||0},Xit=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[Bce(n),Bce(s),Bce(a)]},Qit=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Yit;var t=Xit(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])}},Jit=wLe(),W4="data-scroll-locked",eot=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(Oit,` { overflow: hidden `).concat(s,`; padding-right: `).concat(i,"px ").concat(s,`; } body[`).concat(W4,`] { 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($ee,` { right: `).concat(i,"px ").concat(s,`; } .`).concat(Uee,` { margin-right: `).concat(i,"px ").concat(s,`; } .`).concat($ee," .").concat($ee,` { right: 0 `).concat(s,`; } .`).concat(Uee," .").concat(Uee,` { margin-right: 0 `).concat(s,`; } body[`).concat(W4,`] { `).concat(Dit,": ").concat(i,`px; } `)},zke=function(){var e=parseInt(document.body.getAttribute(W4)||"0",10);return isFinite(e)?e:0},tot=function(){A.useEffect(function(){return document.body.setAttribute(W4,(zke()+1).toString()),function(){var e=zke()-1;e<=0?document.body.removeAttribute(W4):document.body.setAttribute(W4,e.toString())}},[])},rot=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,a=s===void 0?"margin":s;tot();var o=A.useMemo(function(){return Qit(a)},[a]);return A.createElement(Jit,{styles:eot(o,!t,a,n?"":"!important")})},sme=!1;if(typeof window<"u")try{var oO=Object.defineProperty({},"passive",{get:function(){return sme=!0,!0}});window.addEventListener("test",oO,oO),window.removeEventListener("test",oO,oO)}catch{sme=!1}var NS=sme?{passive:!1}:!1,not=function(e){return e.tagName==="TEXTAREA"},jLe=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!not(e)&&n[t]==="visible")},sot=function(e){return jLe(e,"overflowY")},aot=function(e){return jLe(e,"overflowX")},Bke=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var a=kLe(e,s);if(a){var o=NLe(e,s),l=o[1],i=o[2];if(l>i)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},iot=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},oot=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},kLe=function(e,t){return e==="v"?sot(t):aot(t)},NLe=function(e,t){return e==="v"?iot(t):oot(t)},lot=function(e,t){return e==="h"&&t==="rtl"?-1:1},cot=function(e,t,n,s,a){var o=lot(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=NLe(e,i),N=b[0],k=b[1],M=b[2],I=k-M-o*N;(N||I)&&kLe(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},lO=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},$ke=function(e){return[e.deltaX,e.deltaY]},Uke=function(e){return e&&"current"in e?e.current:e},dot=function(e,t){return e[0]===t[0]&&e[1]===t[1]},uot=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},hot=0,SS=[];function mot(e){var t=A.useRef([]),n=A.useRef([0,0]),s=A.useRef(),a=A.useState(hot++)[0],o=A.useState(wLe)[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=Nxe([e.lockRef.current],(e.shards||[]).map(Uke),!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=lO(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=Bke(V,U);if(!W)return!0;if(W?D=V:(D=V==="v"?"h":"v",W=Bke(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 cot(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?$ke(M):lO(M),T=t.current.filter(function(D){return D.name===M.type&&(D.target===M.target||M.target===D.shadowParent)&&dot(D.delta,I)})[0];if(T&&T.should){M.cancelable&&M.preventDefault();return}if(!T){var P=(l.current.shards||[]).map(Uke).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:fot(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=lO(k),s.current=void 0},[]),y=A.useCallback(function(k){m(k.type,$ke(k),k.target,i(k,e.lockRef.current))},[]),v=A.useCallback(function(k){m(k.type,lO(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:uot(a)}):null,b?A.createElement(rot,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function fot(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const pot=qit(bLe,mot);var sP=A.forwardRef(function(e,t){return A.createElement(Ase,sf({},e,{ref:t,sideCar:pot}))});sP.classNames=Ase.classNames;var ame=["Enter"," "],got=["ArrowDown","PageUp","Home"],SLe=["ArrowUp","PageDown","End"],xot=[...got,...SLe],yot={ltr:[...ame,"ArrowRight"],rtl:[...ame,"ArrowLeft"]},vot={ltr:["ArrowLeft"],rtl:["ArrowRight"]},aP="Menu",[LE,_ot,bot]=GI(aP),[Tk,CLe]=cc(aP,[bot,ax,T3]),Ese=ax(),MLe=T3(),[wot,Ak]=Tk(aP),[jot,iP]=Tk(aP),TLe=e=>{const{__scopeMenu:t,open:n=!1,children:s,dir:a,onOpenChange:o,modal:l=!0}=e,i=Ese(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(XI,{...i,children:r.jsx(wot,{scope:t,open:n,onOpenChange:y,content:u,onContentChange:m,children:r.jsx(jot,{scope:t,onClose:A.useCallback(()=>y(!1),[y]),isUsingKeyboardRef:x,dir:v,modal:l,children:s})})})};TLe.displayName=aP;var kot="MenuAnchor",zxe=A.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,a=Ese(n);return r.jsx(w3,{...a,...s,ref:t})});zxe.displayName=kot;var Bxe="MenuPortal",[Not,ALe]=Tk(Bxe,{forceMount:void 0}),ELe=e=>{const{__scopeMenu:t,forceMount:n,children:s,container:a}=e,o=Ak(Bxe,t);return r.jsx(Not,{scope:t,forceMount:n,children:r.jsx(Ac,{present:n||o.open,children:r.jsx(x3,{asChild:!0,container:a,children:s})})})};ELe.displayName=Bxe;var pf="MenuContent",[Sot,$xe]=Tk(pf),ILe=A.forwardRef((e,t)=>{const n=ALe(pf,e.__scopeMenu),{forceMount:s=n.forceMount,...a}=e,o=Ak(pf,e.__scopeMenu),l=iP(pf,e.__scopeMenu);return r.jsx(LE.Provider,{scope:e.__scopeMenu,children:r.jsx(Ac,{present:s||o.open,children:r.jsx(LE.Slot,{scope:e.__scopeMenu,children:l.modal?r.jsx(Cot,{...a,ref:t}):r.jsx(Mot,{...a,ref:t})})})})}),Cot=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 Tse(o)},[]),r.jsx(Uxe,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:xn(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Mot=A.forwardRef((e,t)=>{const n=Ak(pf,e.__scopeMenu);return r.jsx(Uxe,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Tot=uv("MenuContent.ScrollLock"),Uxe=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=iP(pf,n),T=Ese(n),P=MLe(n),F=_ot(n),[D,U]=A.useState(null),V=A.useRef(null),W=ca(t,V,M.onContentChange),G=A.useRef(0),Q=A.useRef(""),ae=A.useRef(0),oe=A.useRef(null),de=A.useRef("right"),se=A.useRef(0),pe=N?sP:A.Fragment,ne=N?{as:Tot,allowPinchZoom:!0}:void 0,me=xe=>{var $e,Be;const Te=Q.current+xe,be=F().filter(Ve=>!Ve.disabled),we=document.activeElement,ve=($e=be.find(Ve=>Ve.ref.current===we))==null?void 0:$e.textValue,et=be.map(Ve=>Ve.textValue),Me=$ot(et,Te,ve),Ie=(Be=be.find(Ve=>Ve.textValue===Me))==null?void 0:Be.ref.current;(function Ve(ot){Q.current=ot,window.clearTimeout(G.current),ot!==""&&(G.current=window.setTimeout(()=>Ve(""),1e3))})(Te),Ie&&setTimeout(()=>Ie.focus())};A.useEffect(()=>()=>window.clearTimeout(G.current),[]),Mse();const he=A.useCallback(xe=>{var be,we;return de.current===((be=oe.current)==null?void 0:be.side)&&qot(xe,(we=oe.current)==null?void 0:we.area)},[]);return r.jsx(Sot,{scope:n,searchRef:Q,onItemEnter:A.useCallback(xe=>{he(xe)&&xe.preventDefault()},[he]),onItemLeave:A.useCallback(xe=>{var Te;he(xe)||((Te=V.current)==null||Te.focus(),U(null))},[he]),onTriggerLeave:A.useCallback(xe=>{he(xe)&&xe.preventDefault()},[he]),pointerGraceTimerRef:ae,onPointerGraceIntentChange:A.useCallback(xe=>{oe.current=xe},[]),children:r.jsx(pe,{...ne,children:r.jsx(rP,{asChild:!0,trapped:a,onMountAutoFocus:xn(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(Rxe,{asChild:!0,...P,dir:I.dir,orientation:"vertical",loop:s,currentTabStopId:D,onCurrentTabStopIdChange:U,onEntryFocus:xn(u,xe=>{I.isUsingKeyboardRef.current||xe.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(QI,{role:"menu","aria-orientation":"vertical","data-state":KLe(M.open),"data-radix-menu-content":"",dir:I.dir,...T,...k,ref:W,style:{outline:"none",...k.style},onKeyDown:xn(k.onKeyDown,xe=>{const be=xe.target.closest("[data-radix-menu-content]")===xe.currentTarget,we=xe.ctrlKey||xe.altKey||xe.metaKey,ve=xe.key.length===1;be&&(xe.key==="Tab"&&xe.preventDefault(),!we&&ve&&me(xe.key));const et=V.current;if(xe.target!==et||!xot.includes(xe.key))return;xe.preventDefault();const Ie=F().filter($e=>!$e.disabled).map($e=>$e.ref.current);SLe.includes(xe.key)&&Ie.reverse(),zot(Ie)}),onBlur:xn(e.onBlur,xe=>{xe.currentTarget.contains(xe.target)||(window.clearTimeout(G.current),Q.current="")}),onPointerMove:xn(e.onPointerMove,OE(xe=>{const Te=xe.target,be=se.current!==xe.clientX;if(xe.currentTarget.contains(Te)&&be){const we=xe.clientX>se.current?"right":"left";de.current=we,se.current=xe.clientX}}))})})})})})})});ILe.displayName=pf;var Aot="MenuGroup",qxe=A.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Bn.div,{role:"group",...s,ref:t})});qxe.displayName=Aot;var Eot="MenuLabel",PLe=A.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Bn.div,{...s,ref:t})});PLe.displayName=Eot;var zte="MenuItem",qke="menu.itemSelect",Ise=A.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:s,...a}=e,o=A.useRef(null),l=iP(zte,e.__scopeMenu),i=$xe(zte,e.__scopeMenu),u=ca(t,o),m=A.useRef(!1),x=()=>{const y=o.current;if(!n&&y){const v=new CustomEvent(qke,{bubbles:!0,cancelable:!0});y.addEventListener(qke,b=>s==null?void 0:s(b),{once:!0}),exe(y,v),v.defaultPrevented?m.current=!1:l.onClose()}};return r.jsx(LLe,{...a,ref:u,disabled:n,onClick:xn(e.onClick,x),onPointerDown:y=>{var v;(v=e.onPointerDown)==null||v.call(e,y),m.current=!0},onPointerUp:xn(e.onPointerUp,y=>{var v;m.current||(v=y.currentTarget)==null||v.click()}),onKeyDown:xn(e.onKeyDown,y=>{const v=i.searchRef.current!=="";n||v&&y.key===" "||ame.includes(y.key)&&(y.currentTarget.click(),y.preventDefault())})})});Ise.displayName=zte;var LLe=A.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:s=!1,textValue:a,...o}=e,l=$xe(zte,n),i=MLe(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(LE.ItemSlot,{scope:n,disabled:s,textValue:a??v,children:r.jsx(Fxe,{asChild:!0,...i,focusable:!s,children:r.jsx(Bn.div,{role:"menuitem","data-highlighted":x?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...o,ref:m,onPointerMove:xn(e.onPointerMove,OE(N=>{s?l.onItemLeave(N):(l.onItemEnter(N),N.defaultPrevented||N.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:xn(e.onPointerLeave,OE(N=>l.onItemLeave(N))),onFocus:xn(e.onFocus,()=>y(!0)),onBlur:xn(e.onBlur,()=>y(!1))})})})}),Iot="MenuCheckboxItem",OLe=A.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:s,...a}=e;return r.jsx(BLe,{scope:e.__scopeMenu,checked:n,children:r.jsx(Ise,{role:"menuitemcheckbox","aria-checked":Bte(n)?"mixed":n,...a,ref:t,"data-state":Hxe(n),onSelect:xn(a.onSelect,()=>s==null?void 0:s(Bte(n)?!0:!n),{checkForDefaultPrevented:!1})})})});OLe.displayName=Iot;var DLe="MenuRadioGroup",[Pot,Lot]=Tk(DLe,{value:void 0,onValueChange:()=>{}}),RLe=A.forwardRef((e,t)=>{const{value:n,onValueChange:s,...a}=e,o=sc(s);return r.jsx(Pot,{scope:e.__scopeMenu,value:n,onValueChange:o,children:r.jsx(qxe,{...a,ref:t})})});RLe.displayName=DLe;var FLe="MenuRadioItem",zLe=A.forwardRef((e,t)=>{const{value:n,...s}=e,a=Lot(FLe,e.__scopeMenu),o=n===a.value;return r.jsx(BLe,{scope:e.__scopeMenu,checked:o,children:r.jsx(Ise,{role:"menuitemradio","aria-checked":o,...s,ref:t,"data-state":Hxe(o),onSelect:xn(s.onSelect,()=>{var l;return(l=a.onValueChange)==null?void 0:l.call(a,n)},{checkForDefaultPrevented:!1})})})});zLe.displayName=FLe;var Vxe="MenuItemIndicator",[BLe,Oot]=Tk(Vxe,{checked:!1}),$Le=A.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:s,...a}=e,o=Oot(Vxe,n);return r.jsx(Ac,{present:s||Bte(o.checked)||o.checked===!0,children:r.jsx(Bn.span,{...a,ref:t,"data-state":Hxe(o.checked)})})});$Le.displayName=Vxe;var Dot="MenuSeparator",ULe=A.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Bn.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});ULe.displayName=Dot;var Rot="MenuArrow",qLe=A.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,a=Ese(n);return r.jsx(JI,{...a,...s,ref:t})});qLe.displayName=Rot;var Fot="MenuSub",[atr,VLe]=Tk(Fot),LT="MenuSubTrigger",HLe=A.forwardRef((e,t)=>{const n=Ak(LT,e.__scopeMenu),s=iP(LT,e.__scopeMenu),a=VLe(LT,e.__scopeMenu),o=$xe(LT,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(zxe,{asChild:!0,...m,children:r.jsx(LLe,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":KLe(n.open),...e,ref:Ty(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:xn(e.onPointerMove,OE(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:xn(e.onPointerLeave,OE(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:xn(e.onKeyDown,y=>{var b;const v=o.searchRef.current!=="";e.disabled||v&&y.key===" "||yot[s.dir].includes(y.key)&&(n.onOpenChange(!0),(b=n.content)==null||b.focus(),y.preventDefault())})})})});HLe.displayName=LT;var WLe="MenuSubContent",GLe=A.forwardRef((e,t)=>{const n=ALe(pf,e.__scopeMenu),{forceMount:s=n.forceMount,...a}=e,o=Ak(pf,e.__scopeMenu),l=iP(pf,e.__scopeMenu),i=VLe(WLe,e.__scopeMenu),u=A.useRef(null),m=ca(t,u);return r.jsx(LE.Provider,{scope:e.__scopeMenu,children:r.jsx(Ac,{present:s||o.open,children:r.jsx(LE.Slot,{scope:e.__scopeMenu,children:r.jsx(Uxe,{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:xn(e.onFocusOutside,x=>{x.target!==i.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:xn(e.onEscapeKeyDown,x=>{l.onClose(),x.preventDefault()}),onKeyDown:xn(e.onKeyDown,x=>{var b;const y=x.currentTarget.contains(x.target),v=vot[l.dir].includes(x.key);y&&v&&(o.onOpenChange(!1),(b=i.trigger)==null||b.focus(),x.preventDefault())})})})})})});GLe.displayName=WLe;function KLe(e){return e?"open":"closed"}function Bte(e){return e==="indeterminate"}function Hxe(e){return Bte(e)?"indeterminate":e?"checked":"unchecked"}function zot(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Bot(e,t){return e.map((n,s)=>e[(t+s)%e.length])}function $ot(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=Bot(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 Uot(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 qot(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Uot(n,t)}function OE(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Vot=TLe,Hot=zxe,Wot=ELe,Got=ILe,Kot=qxe,Zot=PLe,Yot=Ise,Xot=OLe,Qot=RLe,Jot=zLe,elt=$Le,tlt=ULe,rlt=qLe,nlt=HLe,slt=GLe,Pse="DropdownMenu",[alt]=cc(Pse,[CLe]),ch=CLe(),[ilt,ZLe]=alt(Pse),YLe=e=>{const{__scopeDropdownMenu:t,children:n,dir:s,open:a,defaultOpen:o,onOpenChange:l,modal:i=!0}=e,u=ch(t),m=A.useRef(null),[x,y]=sh({prop:a,defaultProp:o??!1,onChange:l,caller:Pse});return r.jsx(ilt,{scope:t,triggerId:gd(),triggerRef:m,contentId:gd(),open:x,onOpenChange:y,onOpenToggle:A.useCallback(()=>y(v=>!v),[y]),modal:i,children:r.jsx(Vot,{...u,open:x,onOpenChange:y,dir:s,modal:i,children:n})})};YLe.displayName=Pse;var XLe="DropdownMenuTrigger",QLe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...a}=e,o=ZLe(XLe,n),l=ch(n);return r.jsx(Hot,{asChild:!0,...l,children:r.jsx(Bn.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:Ty(t,o.triggerRef),onPointerDown:xn(e.onPointerDown,i=>{!s&&i.button===0&&i.ctrlKey===!1&&(o.onOpenToggle(),o.open||i.preventDefault())}),onKeyDown:xn(e.onKeyDown,i=>{s||(["Enter"," "].includes(i.key)&&o.onOpenToggle(),i.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});QLe.displayName=XLe;var olt="DropdownMenuPortal",JLe=e=>{const{__scopeDropdownMenu:t,...n}=e,s=ch(t);return r.jsx(Wot,{...s,...n})};JLe.displayName=olt;var eOe="DropdownMenuContent",tOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=ZLe(eOe,n),o=ch(n),l=A.useRef(!1);return r.jsx(Got,{id:a.contentId,"aria-labelledby":a.triggerId,...o,...s,ref:t,onCloseAutoFocus:xn(e.onCloseAutoFocus,i=>{var u;l.current||(u=a.triggerRef.current)==null||u.focus(),l.current=!1,i.preventDefault()}),onInteractOutside:xn(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)"}})});tOe.displayName=eOe;var llt="DropdownMenuGroup",clt=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=ch(n);return r.jsx(Kot,{...a,...s,ref:t})});clt.displayName=llt;var dlt="DropdownMenuLabel",rOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=ch(n);return r.jsx(Zot,{...a,...s,ref:t})});rOe.displayName=dlt;var ult="DropdownMenuItem",nOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=ch(n);return r.jsx(Yot,{...a,...s,ref:t})});nOe.displayName=ult;var hlt="DropdownMenuCheckboxItem",sOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=ch(n);return r.jsx(Xot,{...a,...s,ref:t})});sOe.displayName=hlt;var mlt="DropdownMenuRadioGroup",flt=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=ch(n);return r.jsx(Qot,{...a,...s,ref:t})});flt.displayName=mlt;var plt="DropdownMenuRadioItem",aOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=ch(n);return r.jsx(Jot,{...a,...s,ref:t})});aOe.displayName=plt;var glt="DropdownMenuItemIndicator",iOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=ch(n);return r.jsx(elt,{...a,...s,ref:t})});iOe.displayName=glt;var xlt="DropdownMenuSeparator",oOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=ch(n);return r.jsx(tlt,{...a,...s,ref:t})});oOe.displayName=xlt;var ylt="DropdownMenuArrow",vlt=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=ch(n);return r.jsx(rlt,{...a,...s,ref:t})});vlt.displayName=ylt;var _lt="DropdownMenuSubTrigger",lOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=ch(n);return r.jsx(nlt,{...a,...s,ref:t})});lOe.displayName=_lt;var blt="DropdownMenuSubContent",cOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=ch(n);return r.jsx(slt,{...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)"}})});cOe.displayName=blt;var wlt=YLe,jlt=QLe,klt=JLe,dOe=tOe,uOe=rOe,hOe=nOe,mOe=sOe,fOe=aOe,pOe=iOe,gOe=oOe,xOe=lOe,yOe=cOe;const dh=wlt,uh=jlt,Nlt=A.forwardRef(({className:e,inset:t,children:n,...s},a)=>r.jsxs(xOe,{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"})]}));Nlt.displayName=xOe.displayName;const Slt=A.forwardRef(({className:e,...t},n)=>r.jsx(yOe,{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}));Slt.displayName=yOe.displayName;const Nu=A.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(klt,{children:r.jsx(dOe,{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=dOe.displayName;const Ha=A.forwardRef(({className:e,inset:t,...n},s)=>r.jsx(hOe,{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}));Ha.displayName=hOe.displayName;const Clt=A.forwardRef(({className:e,children:t,checked:n,...s},a)=>r.jsxs(mOe,{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(pOe,{children:r.jsx(fi,{className:"h-4 w-4"})})}),t]}));Clt.displayName=mOe.displayName;const Mlt=A.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(fOe,{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(pOe,{children:r.jsx(eh,{className:"h-2 w-2 fill-current"})})}),t]}));Mlt.displayName=fOe.displayName;const ime=A.forwardRef(({className:e,inset:t,...n},s)=>r.jsx(uOe,{ref:s,className:Ut("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));ime.displayName=uOe.displayName;const ik=A.forwardRef(({className:e,...t},n)=>r.jsx(gOe,{ref:n,className:Ut("-mx-1 my-1 h-px bg-muted",e),...t}));ik.displayName=gOe.displayName;const Tlt=()=>{const{isAssistant:e,actingAsAgent:t,assignedAgents:n,setActingAsAgent:s}=Oxe();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(qn,{className:"h-4 w-4 flex-shrink-0"}),r.jsx("span",{className:"font-medium text-sm",children:"Acting as"}),n.length>1?r.jsxs(dh,{children:[r.jsx(uh,{asChild:!0,children:r.jsxs(X,{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(Ti,{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(Fd,{className:"h-3 w-3"})]})}),r.jsx(Nu,{align:"start",children:n.map(l=>r.jsxs(Ha,{onClick:()=>s(l),className:"gap-2",children:[r.jsxs(ea,{className:"h-6 w-6",children:[r.jsx(Ti,{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(Tt,{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(Ti,{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(Tt,{variant:"secondary",className:"bg-primary-foreground/20 text-primary-foreground border-0 text-xs",children:"Assistant Mode"})]})})},Sn=({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(vce,{to:"/dashboard",replace:!0}):n&&!l&&!o?r.jsx(vce,{to:"/dashboard",replace:!0}):r.jsx(r.Fragment,{children:e}):r.jsx(vce,{to:"/auth",replace:!0})};var Wxe={};(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),be=Te.getContext("2d");be.fillRect(0,0,1,1);var we=Te.transferToImageBitmap();be.createPattern(we,"no-repeat")}catch{return!1}return!0}();function u(){}function m(Te){var be=n.exports.Promise,we=be!==void 0?be:t.Promise;return typeof we=="function"?new we(Te):(Te(u,u),null)}var x=function(Te,be){return{transform:function(we){if(Te)return we;if(be.has(we))return be.get(we);var ve=new OffscreenCanvas(we.width,we.height),et=ve.getContext("2d");return et.drawImage(we,0,0),be.set(we,ve),ve},clear:function(){be.clear()}}}(i,new Map),y=function(){var Te=Math.floor(16.666666666666668),be,we,ve={},et=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(be=function(Me){var Ie=Math.random();return ve[Ie]=requestAnimationFrame(function $e(Be){et===Be||et+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 Elt(){const e=qr();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 Ilt(){const e=qr(),{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 Lse="Dialog",[vOe,_Oe]=cc(Lse),[Plt,Up]=vOe(Lse),bOe=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]=sh({prop:s,defaultProp:a??!1,onChange:o,caller:Lse});return r.jsx(Plt,{scope:t,triggerRef:i,contentRef:u,contentId:gd(),titleId:gd(),descriptionId:gd(),open:m,onOpenChange:x,onOpenToggle:A.useCallback(()=>x(y=>!y),[x]),modal:l,children:n})};bOe.displayName=Lse;var wOe="DialogTrigger",jOe=A.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Up(wOe,n),o=ca(t,a.triggerRef);return r.jsx(Bn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Zxe(a.open),...s,ref:o,onClick:xn(e.onClick,a.onOpenToggle)})});jOe.displayName=wOe;var Gxe="DialogPortal",[Llt,kOe]=vOe(Gxe,{forceMount:void 0}),NOe=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:a}=e,o=Up(Gxe,t);return r.jsx(Llt,{scope:t,forceMount:n,children:A.Children.map(s,l=>r.jsx(Ac,{present:n||o.open,children:r.jsx(x3,{asChild:!0,container:a,children:l})}))})};NOe.displayName=Gxe;var $te="DialogOverlay",SOe=A.forwardRef((e,t)=>{const n=kOe($te,e.__scopeDialog),{forceMount:s=n.forceMount,...a}=e,o=Up($te,e.__scopeDialog);return o.modal?r.jsx(Ac,{present:s||o.open,children:r.jsx(Dlt,{...a,ref:t})}):null});SOe.displayName=$te;var Olt=uv("DialogOverlay.RemoveScroll"),Dlt=A.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Up($te,n);return r.jsx(sP,{as:Olt,allowPinchZoom:!0,shards:[a.contentRef],children:r.jsx(Bn.div,{"data-state":Zxe(a.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),ok="DialogContent",COe=A.forwardRef((e,t)=>{const n=kOe(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(Rlt,{...a,ref:t}):r.jsx(Flt,{...a,ref:t})})});COe.displayName=ok;var Rlt=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 Tse(o)},[]),r.jsx(MOe,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:xn(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:xn(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,i=l.button===0&&l.ctrlKey===!0;(l.button===2||i)&&o.preventDefault()}),onFocusOutside:xn(e.onFocusOutside,o=>o.preventDefault())})}),Flt=A.forwardRef((e,t)=>{const n=Up(ok,e.__scopeDialog),s=A.useRef(!1),a=A.useRef(!1);return r.jsx(MOe,{...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()}})}),MOe=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 Mse(),r.jsxs(r.Fragment,{children:[r.jsx(rP,{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":Zxe(i.open),...l,ref:m,onDismiss:()=>i.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(Blt,{titleId:i.titleId}),r.jsx(Ult,{contentRef:u,descriptionId:i.descriptionId})]})]})}),Kxe="DialogTitle",TOe=A.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Up(Kxe,n);return r.jsx(Bn.h2,{id:a.titleId,...s,ref:t})});TOe.displayName=Kxe;var AOe="DialogDescription",EOe=A.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Up(AOe,n);return r.jsx(Bn.p,{id:a.descriptionId,...s,ref:t})});EOe.displayName=AOe;var IOe="DialogClose",POe=A.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Up(IOe,n);return r.jsx(Bn.button,{type:"button",...s,ref:t,onClick:xn(e.onClick,()=>a.onOpenChange(!1))})});POe.displayName=IOe;function Zxe(e){return e?"open":"closed"}var LOe="DialogTitleWarning",[zlt,OOe]=gXe(LOe,{contentName:ok,titleName:Kxe,docsSlug:"dialog"}),Blt=({titleId:e})=>{const t=OOe(LOe),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},$lt="DialogDescriptionWarning",Ult=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${OOe($lt).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},Ose=bOe,Yxe=jOe,Dse=NOe,A3=SOe,E3=COe,oP=TOe,lP=EOe,Rse=POe;const Or=Ose,Co=Yxe,qlt=Dse,DOe=A.forwardRef(({className:e,...t},n)=>r.jsx(A3,{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}));DOe.displayName=A3.displayName;const Lr=A.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(qlt,{children:[r.jsx(DOe,{}),r.jsxs(E3,{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(Rse,{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(us,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Lr.displayName=E3.displayName;const zr=({className:e,...t})=>r.jsx("div",{className:Ut("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});zr.displayName="DialogHeader";const Hs=({className:e,...t})=>r.jsx("div",{className:Ut("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Hs.displayName="DialogFooter";const Fr=A.forwardRef(({className:e,...t},n)=>r.jsx(oP,{ref:n,className:Ut("text-lg font-semibold leading-none tracking-tight",e),...t}));Fr.displayName=oP.displayName;const Qn=A.forwardRef(({className:e,...t},n)=>r.jsx(lP,{ref:n,className:Ut("text-sm text-muted-foreground",e),...t}));Qn.displayName=lP.displayName;const Vlt={points_earned:io,listing_created:ya,deal_closed:zd,custom:Ss},Hke={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 Hlt(){const{user:e}=tn(),t=qr(),{data:n}=Alt(),s=Elt(),[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);Vke({...N,particleCount:T,origin:{x:k(.1,.3),y:Math.random()-.2},colors:["#ff6b6b","#feca57","#48dbfb","#ff9ff3","#54a0ff","#5f27cd"]}),Vke({...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=Vlt[a.celebration_type]||Ss,y=Hke[a.celebration_type]||Hke.custom;return r.jsx(Or,{open:l,onOpenChange:v=>!v&&m(),children:r.jsxs(Lr,{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(Ds,{className:"w-5 h-5 text-yellow-500 animate-pulse"}),r.jsx(Ds,{className:"w-5 h-5 text-yellow-500 animate-pulse delay-75"}),r.jsx(Ds,{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(X,{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 ROe="/assets/levelup-logo-horizontal-DEFNc0ms.png",Xxe="/assets/levelup-logo-white-C2RAgAoG.png",Wlt="/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 FOe={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],ee=h[0],re=h[1],ie=h[2],ge=h[3],Se=h[4],Ne=h[5],Fe=h[6],Ue=h[7],Xe=h[8];return f[0]=ee*g+re*C+ie*$,f[1]=ee*_+re*L+ie*K,f[2]=ee*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+Xe*$,f[7]=Fe*_+Ue*L+Xe*K,f[8]=Fe*S+Ue*z+Xe*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],ee=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,Xe=h*$-S*C,xt=g*z-_*L,mt=g*$-S*L,wt=_*$-S*z,Ct=K*ge-Z*ie,Pt=K*Se-ee*ie,Qt=K*Ne-re*ie,Ft=Z*Se-ee*ge,nr=Z*Ne-re*ge,dr=ee*Ne-re*Se,ur=Fe*dr-Ue*nr+Xe*Ft+xt*Qt-mt*Pt+wt*Ct;return ur?(f[0]=(L*dr-z*nr+$*Ft)*(ur=1/ur),f[1]=(_*nr-g*dr-S*Ft)*ur,f[2]=(ge*wt-Se*mt+Ne*xt)*ur,f[3]=(ee*mt-Z*wt-re*xt)*ur,f[4]=(z*Qt-C*dr-$*Pt)*ur,f[5]=(h*dr-_*Qt+S*Pt)*ur,f[6]=(Se*Xe-ie*wt-Ne*Ue)*ur,f[7]=(K*wt-ee*Xe+re*Ue)*ur,f[8]=(C*nr-L*Qt+$*Ct)*ur,f[9]=(g*Qt-h*nr-S*Ct)*ur,f[10]=(ie*mt-ge*Xe+Ne*Fe)*ur,f[11]=(Z*Xe-K*mt-re*Fe)*ur,f[12]=(L*Pt-C*Ft-z*Ct)*ur,f[13]=(h*Ft-g*Pt+_*Ct)*ur,f[14]=(ge*Ue-ie*xt-Se*Fe)*ur,f[15]=(K*xt-Z*Ue+ee*Fe)*ur,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],ee=c[9],re=c[10],ie=c[11],ge=c[12],Se=c[13],Ne=c[14],Fe=c[15],Ue=h[0],Xe=h[1],xt=h[2],mt=h[3];return f[0]=Ue*g+Xe*L+xt*Z+mt*ge,f[1]=Ue*_+Xe*z+xt*ee+mt*Se,f[2]=Ue*S+Xe*$+xt*re+mt*Ne,f[3]=Ue*C+Xe*K+xt*ie+mt*Fe,f[4]=(Ue=h[4])*g+(Xe=h[5])*L+(xt=h[6])*Z+(mt=h[7])*ge,f[5]=Ue*_+Xe*z+xt*ee+mt*Se,f[6]=Ue*S+Xe*$+xt*re+mt*Ne,f[7]=Ue*C+Xe*K+xt*ie+mt*Fe,f[8]=(Ue=h[8])*g+(Xe=h[9])*L+(xt=h[10])*Z+(mt=h[11])*ge,f[9]=Ue*_+Xe*z+xt*ee+mt*Se,f[10]=Ue*S+Xe*$+xt*re+mt*Ne,f[11]=Ue*C+Xe*K+xt*ie+mt*Fe,f[12]=(Ue=h[12])*g+(Xe=h[13])*L+(xt=h[14])*Z+(mt=h[15])*ge,f[13]=Ue*_+Xe*z+xt*ee+mt*Se,f[14]=Ue*S+Xe*$+xt*re+mt*Ne,f[15]=Ue*C+Xe*K+xt*ie+mt*Fe,f}function P(f,c,h){var g,_,S,C,L,z,$,K,Z,ee,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],ee=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]=ee,f[10]=re,f[11]=ie,f[12]=g*ge+L*Se+Z*Ne+c[12],f[13]=_*ge+z*Se+ee*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],ee=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*_+ee*g,f[8]=$*_-S*g,f[9]=K*_-C*g,f[10]=Z*_-L*g,f[11]=ee*_-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],ee=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*_-ee*g,f[8]=S*g+$*_,f[9]=C*g+K*_,f[10]=L*g+Z*_,f[11]=z*g+ee*_,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],ee=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*_+ee*g,f[4]=$*_-S*g,f[5]=K*_-C*g,f[6]=Z*_-L*g,f[7]=ee*_-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 At(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*$,ee=g*z-_*L;return f[0]=L+C*(K+=K)+_*(ee+=ee)-S*(Z+=Z),f[1]=z+C*Z+S*K-g*ee,f[2]=$+C*ee+g*Z-_*K,f}function Qe(f){return f[0]=0,f[1]=0,f[2]=0,f}function rt(f,c){return f[0]===c[0]&&f[1]===c[1]&&f[2]===c[2]}var je=xe,ut=Te,Ce=pe;function Ee(){var f=new m(4);return m!=Float32Array&&(f[0]=0,f[1]=0,f[2]=0,f[3]=0),f}function Ye(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}de(),Ee();var ir,Mr,Zr,Br=Le,rn=(ir=de(),Mr=ne(1,0,0),Zr=ne(0,1,0),function(f,c,h){var g=ot(c,h);return g<-.999999?(At(ir,Mr,c),Ce(ir)<1e-6&&At(ir,Zr,c),Ve(ir,ir),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,ir,Math.PI),f):g>.999999?(f[0]=0,f[1]=0,f[2]=0,f[3]=1,f):(At(ir,c,h),f[0]=ir[0],f[1]=ir[1],f[2]=ir[2],f[3]=1+g,Br(f,f))});function Zn(){var f=new m(2);return m!=Float32Array&&(f[0]=0,f[1]=0),f}function Ot(f,c){var h=new m(2);return h[0]=f,h[1]=c,h}function Gr(f,c,h){return f[0]=c,f[1]=h,f}function An(f,c,h){return f[0]=c[0]+h[0],f[1]=c[1]+h[1],f}function zn(f,c,h){return f[0]=c[0]-h[0],f[1]=c[1]-h[1],f}function ba(f,c,h){return f[0]=c[0]*h,f[1]=c[1]*h,f}function gi(f){var c=f[0],h=f[1];return Math.sqrt(c*c+h*h)}function Mo(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 Wa(f,c){return f[0]*c[0]+f[1]*c[1]}tt(),tt(),y();var ms,ra,fs=zn;function Ys(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}Zn();var Bs=function(){if(ra)return ms;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,ms=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))}},ms}(),Ni=Ys(Bs);function or(f,c){this.x=f,this.y=c}function La(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 Ni(f,c,h,g);return function(S){return _.solve(S)}}const nt=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 Ze(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 Lt(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 fr(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 Mn={};function Kr(f){Mn[f]||(typeof console<"u"&&console.warn(f),Mn[f]=!0)}function cs(f,c,h){return(h.y-f.y)*(c.x-f.x)>(c.y-f.y)*(h.x-f.x)}function ds(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 wa(f,c){return[f[4*c],f[4*c+1],f[4*c+2],f[4*c+3]]}function To(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 Ga(f,c,h){return(f-c.min)*(h.max-h.min)/(c.max-c.min)+h.min}const Ps={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(!Ps.API_URL)return null;try{const f=new URL(Ps.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 Ps.API_URL_REGEX.test(f)}function bl(f){return Ps.API_SPRITE_REGEX.test(f)}let El,Xc,Am,Yo,Hd,hc;function hh(){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&&(Am==null&&(Am=window.matchMedia("(prefers-reduced-motion: reduce)")),Am.matches)},hasCanvasFingerprintNoise(){if(hc!==void 0)return hc;if(!hh())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 Yy="mapbox-tiles";let Xy=500,Qy=50;const qh=["language","worldview","jobid"];let Au,Qc;function lu(){try{return caches}catch{}}function mc(){const f=lu();f&&Au==null&&(Au=f.open(Yy))}let Jc=1/0;const Ho={supported:!1,testSupport:function(f){!Wd&&Vh&&(Tf?ux(f):Eu=f)}};let Eu,Vh,Wd=!1,Tf=!1;const Jy=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,Vh),f.isContextLost())return;Ho.supported=!0}catch{}f.deleteTexture(c),Wd=!0}Jy.document&&(Vh=Jy.document.createElement("img"),Vh.onload=function(){Eu&&ux(Eu),Eu=null,Tf=!0},Vh.onerror=function(){Wd=!0,Eu=null},Vh.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 vd 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 e0=Ws()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,Em=function(f,c){if(!(/^file:/.test(h=f.url)||/^file:/.test(e0())&&!/^\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:e0(),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 ee(ie);const Se=Date.now();fetch(C).then(Ne=>{if(Ne.ok){const Fe=$?Ne.clone():null;return ee(Ne,Fe,Se)}return _(new vd(Ne.statusText,Ne.status,g.url))}).catch(Ne=>{Ne.name!=="AbortError"&&_(new Error(`${Ne.message} ${g.url}`))})},ee=(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 Xe=$i(Fe.headers.get("Cache-Control")||"");if(Xe["no-store"])return;const xt={status:Fe.status,statusText:Fe.statusText,headers:new Headers};Fe.headers.forEach((Ct,Pt)=>xt.headers.set(Pt,Ct)),Xe["max-age"]&&xt.headers.set("Expires",new Date(Ue+1e3*Xe["max-age"]).toUTCString());const mt=xt.headers.get("Expires");if(!mt||new Date(mt).getTime()-Ue<42e4)return;let wt=Gp(Ne.url,{persistentParams:qh});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:qh});const Ne=re.headers.get("Range");Ne&&(Se=Mf(Se,{range:Ne})),ge.match(Se).then(Fe=>{const Ue=function(Xe){if(!Xe)return!1;const xt=new Date(Xe.headers.get("Expires")||0),mt=$i(Xe.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 vd(S.statusText,S.status,g.url))},S.send(g.body),{cancel:()=>S.abort()}}(f,c)},Iu=function(f,c){return Em(Object.assign(f,{type:"arrayBuffer"}),c)};function t5(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 t0=function(f,c){if(Ho.supported&&(f.headers||(f.headers={}),f.headers.accept="image/webp,*/*"),Xs>=Ps.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,Im={exports:{}},Kp={exports:{}},mx={exports:{}},kt=function(){if(zk)return Im.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 Im.exports=f,Im.exports.murmur3=f,Im.exports.murmur2=c,Im.exports}(),pr=Ys(kt);class Pr{constructor(c,...h){Object.assign(this,h[0]||{}),this.type=c}}class as extends Pr{constructor(c,h={}){super("error",Object.assign({error:c},h))}}function is(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 Ls{on(c,h){return this._listeners=this._listeners||{},is(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||{},is(c,h,this._oneTimeListeners),this):new Promise(g=>{this.once(c,g)})}fire(c,h){const g=typeof c=="string"?new Pr(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 as&&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 ja{constructor(c){typeof c=="string"?this.name=c:(this.name=c.name,this.iconsetId=c.iconsetId)}static from(c){return new ja(c)}static toString(c){return c.iconsetId?`${c.name}${c.iconsetId}`:c.name}static parse(c){const[h,g]=c.split("");return new ja({name:h,iconsetId:g})}static isEqual(c,h){return c.name===h.name&&c.iconsetId===h.iconsetId}toString(){return ja.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var Hh,cu={},Il=function(){if(Hh)return cu;Hh=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(","),ee=1;switch(K){case"rgba":if(Z.length!==4)return null;ee=g(Z.pop());case"rgb":return Z.length!==3?null:[h(Z[0]),h(Z[1]),h(Z[2]),ee];case"hsla":if(Z.length!==4)return null;ee=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)),ee];default:return null}}return null}}catch{}return cu}();class ka{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 ka)return c;if(typeof c!="string")return;const h=Il.parseCSSColor(c);return h?new ka(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 LP(c,h,g,_,S)}toPremultipliedRenderColor(c){const{r:h,g,b:_,a:S}=this;return new OP(c,h*S,g*S,_*S,S)}clone(){return new ka(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(_),ee=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),Xe=4*($+K*z+ie*L),xt=4*($+re*z+Z*L),mt=4*($+re*z+ie*L),wt=4*(ee+K*z+Z*L),Ct=4*(ee+K*z+ie*L),Pt=4*(ee+re*z+Z*L),Qt=4*(ee+re*z+ie*L);if(Ue<0||Qt>=Fe.length)throw new Error("out of range");this.r=$n($n($n(Fe[Ue],Fe[Xe],Ne),$n(Fe[xt],Fe[mt],Ne),Se),$n($n(Fe[wt],Fe[Ct],Ne),$n(Fe[Pt],Fe[Qt],Ne),Se),ge)/255*(this.premultiplied?S:1),this.g=$n($n($n(Fe[Ue+1],Fe[Xe+1],Ne),$n(Fe[xt+1],Fe[mt+1],Ne),Se),$n($n(Fe[wt+1],Fe[Ct+1],Ne),$n(Fe[Pt+1],Fe[Qt+1],Ne),Se),ge)/255*(this.premultiplied?S:1),this.b=$n($n($n(Fe[Ue+2],Fe[Xe+2],Ne),$n(Fe[xt+2],Fe[mt+2],Ne),Se),$n($n(Fe[wt+2],Fe[Ct+2],Ne),$n(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 ee=Z>.5?K/(2-$-z):K/($+z);let re;switch($){case S:re=60*((C-L)/K+(C$n(g,c[_],h))}ka.black=new ka(0,0,0,1),ka.white=new ka(1,1,1,1),ka.transparent=new ka(0,0,0,0),ka.red=new ka(1,0,0,1),ka.blue=new ka(0,0,1,1);var Fv=Object.freeze({__proto__:null,array:r5,color:function(f,c,h){return new ka($n(f.r,c.r,h),$n(f.g,c.g,h),$n(f.b,c.b,h),$n(f.a,c.a,h))},number:$n});class mh extends Error{constructor(c,h){super(h),this.message=h,this.key=c}}class r0{constructor(c,h=[]){this.parent=c,this.bindings={};for(const[g,_]of h)this.bindings[g]=_}concat(c){return new r0(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 Wh={kind:"null"},jn={kind:"number"},aa={kind:"string"},qa={kind:"boolean"},Gd={kind:"color"},Pm={kind:"object"},Oa={kind:"value"},$k={kind:"collator"},zv={kind:"formatted"},Bv={kind:"resolvedImage"};function Ic(f,c){return{kind:"array",itemType:f,N:c}}function $o(f){if(f.kind==="array"){const c=$o(f.itemType);return typeof f.N=="number"?`array<${c}, ${f.N}>`:f.itemType.kind==="value"?"array":`array<${c}>`}return f.kind}const Bie=[Wh,jn,aa,qa,Gd,zv,Pm,Ic(Oa),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 Bie)if(!Zp(h,c))return null}}return`Expected ${$o(f)} but found ${$o(c)} instead.`}function n5(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 s5{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 _d{constructor(c){this.sections=c}static fromString(c){return new _d([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 _d?c:_d.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=ja.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 bd{constructor(c,h,g,_,S=!1){this.primaryId=ja.from(c),this.primaryOptions=h,g&&(this.secondaryId=ja.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"?bd.build({name:c}):c}static build(c,h,g,_){return!c||typeof c=="object"&&!("name"in c)?null:new bd(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 n0(f){if(f===null||typeof f=="string"||typeof f=="boolean"||typeof f=="number"||f instanceof ka||f instanceof s5||f instanceof _d||f instanceof bd)return!0;if(Array.isArray(f)){for(const c of f)if(!n0(c))return!1;return!0}if(typeof f=="object"){for(const c in f)if(!n0(f[c]))return!1;return!0}return!1}function wl(f){if(f===null)return Wh;if(typeof f=="string")return aa;if(typeof f=="boolean")return qa;if(typeof f=="number")return jn;if(f instanceof ka)return Gd;if(f instanceof s5)return $k;if(f instanceof _d)return zv;if(f instanceof bd)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=Oa;break}h=_}return Ic(h||Oa,c)}return Pm}function fh(f){const c=typeof f;return f===null?"":c==="string"||c==="number"||c==="boolean"?String(f):f instanceof _d||f instanceof bd||f instanceof ka?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(!n0(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 ka?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof _d?this.value.serialize():this.value}}class dl{constructor(c){this.name="ExpressionEvaluationError",this.message=c}toJSON(){return this.message}}const a5={string:aa,number:jn,boolean:qa,object:Pm};class Gh{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 a5)||$==="object")return h.error('The item type argument of "array" must be one of string, number, boolean',1);L=a5[$],_++}else L=Oa;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=a5[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 Lm{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",jn),!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,Oa);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 Lm(_)}evaluate(c){return new _d(this.sections.map(h=>{const g=h.content.evaluate(c);return Uk(wl(g),Bv)?new qk("",g,null,null,null):new qk(fh(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 ps{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(gja.isEqual(C,S)),_.available){const C=_.getSecondary()?_.getSecondary().id:null;C&&(_.available=c.availableImages.some(L=>ja.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 vn(f){return Gn(f)?"string":s0(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 Gn(f){return typeof f=="string"||f instanceof String}function s0(f){return typeof f=="number"||f instanceof Number}function Hk(f){return typeof f=="boolean"||f instanceof Boolean}const Vn={"to-boolean":qa,"to-color":Gd,"to-number":jn,"to-string":aa};class Om{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=Wh;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&&n0(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 ka(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"?_d.fromString(fh(this.args[0].evaluate(c))):this.type.kind==="resolvedImage"?bd.build(fh(this.args[0].evaluate(c))):this.type.kind==="array"?this.args.map(h=>h.evaluate(c)):fh(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 Lm([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new ps(this.args[0]).serialize();const c=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(h=>{c.push(h.serialize())}),c}}const i5=["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"?i5[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]=ka.parse(c)),h}getConfig(c){return this.options?this.options.get(c):null}}class wd{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=wd.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],_=wd.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 ee=[];let re=!1;for(let ie=1;ieee)).map(Gk).join(" | "),Z=[];for(let ee=1;eeh;){if(g-h>600){const z=g-h+1,$=c-h+1,K=Math.log(z),Z=.5*Math.exp(2*K/3),ee=.5*Math.sqrt(K*Z*(z-Z)/z)*($-z/2<0?-1:1);Kk(f,c,Math.max(h,Math.floor(c-$*Z/z+ee)),Math.min(g,Math.floor(c+(z-$)*Z/z+ee)),_)}const S=f[c];let C=h,L=g;for(Kh(f,h,c),_(f[g],S)>0&&Kh(f,h,g);C0;)L--}_(f[h],S)===0?Kh(f,h,L):(L++,Kh(f,L,g)),L<=c&&(h=L+1),c<=L&&(g=L-1)}}function Kh(f,c,h){const g=f[c];f[c]=f[h],f[h]=g}function o5(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 $ie(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 a0(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 or(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),h=new or(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}ph(c,f)}function zP(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]];FP($,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]];ph(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)FP($,c,h,_)}var L;return C}class Jp{constructor(c,h){this.type=qa,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(n0(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+=ee/this.ky*re)),Z=Pu(h[0]-$)*this.kx,ee=(h[1]-K)*this.ky;const ie=Z*Z+ee*ee;ieS.index||_.index===S.index&&_.t>S.t){const $=_;_=S,S=$}const C=[_.point],L=_.index+1,z=S.index;!d5(g[L],C[0])&&L<=z&&C.push(g[L]);for(let $=L+1;$<=z;$++)C.push(g[$]);return d5(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 d5(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 Ar=8192;function u5(f,c){return c.dist-f.dist}const Qk=100,Jk=50;function h5(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(!Dm(c,f.length))return h;for(let g=c[0];g<=c[1];++g)ph(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(p5(f,c))return 0}else if(p5(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 ee=0,re=Z.length,ie=re-1;ee=S)continue;const K=$.range1;if(Wv(K)<=L){if(!Dm(K,f.length))return NaN;if(c){const Z=Gie(f,K,h,g);if((S=Math.min(S,Z))===0)return S}else for(let Z=K[0];Z<=K[1];++Z){const ee=Wie(f[Z],h,g);if((S=Math.min(S,ee))===0)return S}}else{const Z=m5(K,c);if(Z[0]!==null){const ee=eg(px(f,Z[0]),z,g);ee=C)continue;const Z=K.range1,ee=K.range2;if(Wv(Z)<=z&&Wv(ee)<=$){if(!Dm(Z,f.length)||!Dm(ee,h.length))return NaN;if(c&&g?C=Math.min(C,ia(f,Z,h,ee,_)):c||g?c&&!g?C=Math.min(C,f5(h,ee,f,Z,_)):!c&&g&&(C=Math.min(C,f5(f,Z,h,ee,_))):C=Math.min(C,Hie(f,Z,h,ee,_)),C===0)return C}else{const re=m5(Z,c),ie=m5(ee,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 g5(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,qP(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=Zie(f,c,L,g,S);if(isNaN(z))return z;if((S=Math.min(S,z))===0)return S}return S}function x5(f){return f==="Point"||f==="MultiPoint"||f==="LineString"||f==="MultiLineString"||f==="Polygon"||f==="MultiPolygon"}class xx{constructor(c,h){this.type=jn,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(n0(c[1])){const g=c[1];if(g.type==="FeatureCollection"){for(let _=0;_{c&&!l0(h)&&(c=!1)}),c}function Gv(f){if(f instanceof wd&&f.name==="feature-state")return!1;let c=!0;return f.eachChild(h=>{c&&!Gv(h)&&(c=!1)}),c}function c0(f,c){if(f instanceof wd&&c.indexOf(f.name)>=0)return!1;let h=!0;return f.eachChild(g=>{h&&!c0(g,c)&&(h=!1)}),h}function VP(f,c,h){return[f,c,h].filter(Boolean).join("")}function y5(f,c){switch(f){case"string":return fh(c);case"number":return+c;case"boolean":return!!c;case"color":return ka.parse(c);case"formatted":return _d.fromString(fh(c));case"resolvedImage":return bd.build(fh(c))}return c}function HP(f,c,h,g){return g!==void 0&&(f=g*Math.round(f/g)),c!==void 0&&fh&&(f=h),f}class d0{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=Oa),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=fh(_.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=fh(z.value)}if(h.options){const z=VP(L,S,h._scope),$=h.options.get(z);$&&(C=l0($.value||$.default))}return new d0(g,L,S,C)}evaluate(c){const h=VP(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 ee=c.scope;c.scope=(ee||"").split("").slice(1).join(""),Z=S.evaluate(c),c.scope=ee}return _&&(Z=y5(_,Z)),Z===void 0||L===void 0&&z===void 0&&$===void 0||(typeof Z=="number"?Z=HP(Z,L,z,$):Array.isArray(Z)&&(Z=Z.map(ee=>typeof ee=="number"?HP(ee,L,z,$):ee))),S!==void 0&&Z!==void 0&&C&&!C.includes(Z)&&(Z=K,_&&(Z=y5(_,Z))),(_&&_!==this.type||Z!==void 0&&!Uk(wl(Z),this.type))&&(Z=y5(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 r0,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 Gh(S,[_]):C==="coerce"?new Om(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"&&v5(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 Om.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 mh(g,c))}checkSubtype(c,h){const g=Zp(c,h);return g&&this.error(g),g}}function v5(f){if(f instanceof nN)return v5(f.boundExpression);if(f instanceof wd&&f.name==="error"||f instanceof Pl||f instanceof Jp||f instanceof xx||f instanceof d0)return!1;const c=f instanceof Om||f instanceof Gh;let h=!0;return f.eachChild(g=>{h=c?h&&v5(g):h&&g instanceof If}),!!h&&l0(f)&&c0(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,jn);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 WP=.95047,GP=1.08883,KP=4/29,u0=6/29,ZP=3*u0*u0,Yie=u0*u0*u0,Xie=Math.PI/180,Qie=180/Math.PI;function _5(f){return f>Yie?Math.pow(f,1/3):f/ZP+KP}function b5(f){return f>u0?f*f*f:ZP*(f-KP)}function w5(f){return 255*(f<=.0031308?12.92*f:1.055*Math.pow(f,1/2.4)-.055)}function j5(f){return(f/=255)<=.04045?f/12.92:Math.pow((f+.055)/1.055,2.4)}function YP(f){const c=j5(f.r),h=j5(f.g),g=j5(f.b),_=_5((.4124564*c+.3575761*h+.1804375*g)/WP),S=_5((.2126729*c+.7151522*h+.072175*g)/1);return{l:116*S-16,a:500*(_-S),b:200*(S-_5((.0193339*c+.119192*h+.9503041*g)/GP)),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*b5(c),h=WP*b5(h),g=GP*b5(g),new ka(w5(3.2404542*h-1.5371385*c-.4985314*g),w5(-.969266*h+1.8760108*c+.041556*g),w5(.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 h0={forward:YP,reverse:iN,interpolate:function(f,c,h){return{l:$n(f.l,c.l,h),a:$n(f.a,c.a,h),b:$n(f.b,c.b,h),alpha:$n(f.alpha,c.alpha,h)}}},Zv={forward:function(f){const{l:c,a:h,b:g}=YP(f),_=Math.atan2(g,h)*Qie;return{h:_<0?_+360:_,c:Math.sqrt(h*h+g*g),l:c,alpha:f.a}},reverse:function(f){const c=f.h*Xie,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:$n(f.c,c.c,h),l:$n(f.l,c.l,h),alpha:$n(f.alpha,c.alpha,h)}}};var XP=Object.freeze({__proto__:null,hcl:Zv,lab:h0});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 Ni(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,jn),!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.',ee);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 ${$o(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)):h0.reverse(h0.interpolate(h0.forward(z),h0.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?Oa:g,S)}evaluate(c){let h,g=null,_=0;for(const S of this.args){if(_++,g=S.evaluate(c),g&&g instanceof bd&&!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,jn),_=h.parse(c[2],2,Ic(h.expectedType||Oa));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 k5{constructor(c,h){this.type=qa,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,Oa),_=h.parse(c[2],2,Oa);return g&&_?n5(g.type,[qa,aa,jn,Wh,Oa])?new k5(g,_):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${$o(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 ${$o(wl(h))} instead.`);if(!$v(g,["string","array"]))throw new dl(`Expected second argument to be of type array or string, but found ${$o(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 m0{constructor(c,h,g){this.type=jn,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,Oa),_=h.parse(c[2],2,Oa);if(!g||!_)return null;if(!n5(g.type,[qa,aa,jn,Wh,Oa]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${$o(g.type)} instead`);if(c.length===4){const S=h.parse(c[3],3,jn);return S?new m0(g,_,S):null}return new m0(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 ${$o(wl(h))} instead.`);if(!$v(g,["string","array"]))throw new dl(`Expected second argument to be of type array or string, but found ${$o(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 ee.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof ie=="number"&&Math.floor(ie)!==ie)return ee.error("Numeric branch labels must be integer values.");if(g){if(ee.checkSubtype(g,wl(ie)))return null}else g=wl(ie);if(S[String(ie)]!==void 0)return ee.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,Oa);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,Oa),_=h.parse(c[2],2,jn);if(!g||!_)return null;if(!n5(g.type,[Ic(Oa),aa,Oa]))return h.error(`Expected first argument to be of type array or string, but found ${$o(g.type)} instead`);if(c.length===4){const S=h.parse(c[3],3,jn);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 ${$o(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 N5{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 N5(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 S5(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 C5(f,c,h,g){return g.compare(c,h)===0}function f0(f,c,h){const g=f!=="=="&&f!=="!=";return class zOe{constructor(S,C,L){this.type=qa,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,Oa);if(!z)return null;if(!S5(L,z.type))return C.concat(1).error(`"${L}" comparisons are not supported for type '${$o(z.type)}'.`);let $=C.parse(S[2],2,Oa);if(!$)return null;if(!S5(L,$.type))return C.concat(2).error(`"${L}" comparisons are not supported for type '${$o($.type)}'.`);if(z.type.kind!==$.type.kind&&z.type.kind!=="value"&&$.type.kind!=="value")return C.error(`Cannot compare types '${$o(z.type)}' and '${$o($.type)}'.`);g&&(z.type.kind==="value"&&$.type.kind!=="value"?z=new Gh($.type,[z]):z.type.kind!=="value"&&$.type.kind==="value"&&($=new Gh(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 zOe(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 Jie=f0("==",function(f,c,h){return c===h},C5),eoe=f0("!=",function(f,c,h){return c!==h},function(f,c,h,g){return!C5(0,c,h,g)}),QP=f0("<",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=f0("<=",function(f,c,h){return c<=h},function(f,c,h,g){return g.compare(c,h)<=0}),toe=f0(">=",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,jn);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",jn),!z))return null;let $=null;return _["max-fraction-digits"]&&($=h.parseObjectValue(_["max-fraction-digits"],2,"max-fraction-digits",jn),!$)?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 M5{constructor(c){this.type=jn,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 ${$o(g.type)} instead.`):new M5(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 ${$o(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 e6(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 p0={"==":Jie,"!=":eoe,">":JP,"<":QP,">=":toe,"<=":hN,array:Gh,at:cN,"at-interpolated":dN,boolean:Gh,case:Qv,coalesce:Yv,collator:Pl,format:Lm,image:ps,in:k5,"index-of":m0,interpolate:Lu,"interpolate-hcl":Lu,"interpolate-lab":Lu,length:M5,let:Lf,literal:If,match:Xv,number:Gh,"number-format":mN,object:Gh,slice:uN,step:Kv,string:Gh,"to-boolean":Om,"to-color":Om,"to-number":Om,"to-string":Om,var:nN,within:Jp,distance:xx,config:d0,split:N5};function T5(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 ka(c/255,h/255,g/255,S)}function A5(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,ee){return typeof $=="number"&&$>=0&&$<=360?typeof K=="number"&&K>=0&&K<=100&&typeof Z=="number"&&Z>=0&&Z<=100?ee===void 0||typeof ee=="number"&&ee>=0&&ee<=1?null:`Invalid hsla value [${[$,K,Z,ee].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof ee=="number"?[$,K,Z,ee]:[$,K,Z]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof ee=="number"?[$,K,Z,ee]:[$,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=ka.parse(L);if(!z)throw new dl(`Failed to parse HSLA color: ${L}`);return z}function t6(f,c){return f in c}function E5(f,c){const h=c[f];return h===void 0?null:h}function rg(f){return{type:f}}function yx(f){if(f instanceof d0)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 wd&&f.name==="is-active-floor")return!0;let c=!1;return f.eachChild(h=>{!c&&fN(h)&&(c=!0)}),c}function r6(f){return{result:"success",value:f}}function ng(f){return{result:"error",value:f}}function I5(f,c){return!!f&&!!f.parameters&&f.parameters.indexOf(c)>-1}function Jv(f){return f["property-type"]==="data-driven"}function n6(f){return I5(f.expression,"measure-light")}function s6(f){return I5(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 a6(f){return f}function i6(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],ka.parse($[1])])),f.default=ka.parse(f.default?f.default:c.default)),f.colorSpace&&f.colorSpace!=="rgb"&&!XP[f.colorSpace])throw new Error(`Unknown color space: ${f.colorSpace}`);let C,L,z;if(S==="exponential")C=o6;else if(S==="interval")C=noe;else if(S==="categorical"){C=roe,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=l6}if(g){const $={},K=[];for(let re=0;rere[0]),evaluate:({zoom:re},ie)=>o6({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?Rm(f.default,c.default):C(f,c,Z,L,z)}}}function Rm(f,c,h){return f!==void 0?f:c!==void 0?c:h!==void 0?h:void 0}function roe(f,c,h,g,_){return Rm(typeof h===_?g[h]:void 0,f.default,c.default)}function noe(f,c,h){if(!s0(h))return Rm(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 o6(f,c,h){const g=f.base!==void 0?f.base:1;if(!s0(h))return Rm(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,ee,re){const ie=re-ee,ge=K-ee;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]||a6;if(f.colorSpace&&f.colorSpace!=="rgb"){const K=XP[f.colorSpace];$=(Z,ee)=>K.reverse(K.interpolate(K.forward(Z),K.forward(ee),C))}return typeof L.evaluate=="function"?{evaluate(...K){const Z=L.evaluate.apply(void 0,K),ee=z.evaluate.apply(void 0,K);if(Z!==void 0&&ee!==void 0)return $(Z,ee,C)}}:$(L,z,C)}function l6(f,c,h){return c.type==="color"?h=ka.parse(h):c.type==="formatted"?h=_d.fromString(h.toString()):c.type==="resolvedImage"?h=bd.build(h.toString()):vn(h)===c.type||c.type==="enum"&&c.values[h]||(h=void 0),Rm(h,f.default,c.default)}wd.register(p0,{error:[{kind:"error"},[aa],(f,[c])=>{throw new dl(c.evaluate(f))}],typeof:[aa,[Oa],(f,[c])=>$o(wl(c.evaluate(f)))],"to-rgba":[Ic(jn,4),[Gd],(f,[c])=>c.evaluate(f).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[Ic(jn,4),[Gd],(f,[c])=>c.evaluate(f).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[Gd,[jn,jn,jn],T5],rgba:[Gd,[jn,jn,jn,jn],T5],hsl:[Gd,[jn,jn,jn],A5],hsla:[Gd,[jn,jn,jn,jn],A5],has:{type:qa,overloads:[[[aa],(f,[c])=>t6(c.evaluate(f),f.properties())],[[aa,Pm],(f,[c,h])=>t6(c.evaluate(f),h.evaluate(f))]]},get:{type:Oa,overloads:[[[aa],(f,[c])=>E5(c.evaluate(f),f.properties())],[[aa,Pm],(f,[c,h])=>E5(c.evaluate(f),h.evaluate(f))]]},"feature-state":[Oa,[aa],(f,[c])=>E5(c.evaluate(f),f.featureState||{})],properties:[Pm,[],f=>f.properties()],"geometry-type":[aa,[],f=>f.geometryType()],worldview:[aa,[],f=>f.globals.worldview||""],"is-active-floor":[qa,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:[Oa,[],f=>f.id()],zoom:[jn,[],f=>f.globals.zoom],pitch:[jn,[],f=>f.globals.pitch||0],"distance-from-center":[jn,[],f=>f.distanceFromCenter()],"measure-light":[jn,[aa],(f,[c])=>f.measureLight(c.evaluate(f))],"heatmap-density":[jn,[],f=>f.globals.heatmapDensity||0],"line-progress":[jn,[],f=>f.globals.lineProgress||0],"raster-value":[jn,[],f=>f.globals.rasterValue||0],"raster-particle-speed":[jn,[],f=>f.globals.rasterParticleSpeed||0],"sky-radial-progress":[jn,[],f=>f.globals.skyRadialProgress||0],accumulated:[Oa,[],f=>f.globals.accumulated===void 0?null:f.globals.accumulated],"+":[jn,rg(jn),(f,c)=>{let h=0;for(const g of c)h+=g.evaluate(f);return h}],"*":[jn,rg(jn),(f,c)=>{let h=1;for(const g of c)h*=g.evaluate(f);return h}],"-":{type:jn,overloads:[[[jn,jn],(f,[c,h])=>c.evaluate(f)-h.evaluate(f)],[[jn],(f,[c])=>-c.evaluate(f)]]},"/":[jn,[jn,jn],(f,[c,h])=>c.evaluate(f)/h.evaluate(f)],"%":[jn,[jn,jn],(f,[c,h])=>c.evaluate(f)%h.evaluate(f)],ln2:[jn,[],()=>Math.LN2],pi:[jn,[],()=>Math.PI],e:[jn,[],()=>Math.E],"^":[jn,[jn,jn],(f,[c,h])=>Math.pow(c.evaluate(f),h.evaluate(f))],sqrt:[jn,[jn],(f,[c])=>Math.sqrt(c.evaluate(f))],log10:[jn,[jn],(f,[c])=>Math.log(c.evaluate(f))/Math.LN10],ln:[jn,[jn],(f,[c])=>Math.log(c.evaluate(f))],log2:[jn,[jn],(f,[c])=>Math.log2(c.evaluate(f))],sin:[jn,[jn],(f,[c])=>Math.sin(c.evaluate(f))],cos:[jn,[jn],(f,[c])=>Math.cos(c.evaluate(f))],tan:[jn,[jn],(f,[c])=>Math.tan(c.evaluate(f))],asin:[jn,[jn],(f,[c])=>Math.asin(c.evaluate(f))],acos:[jn,[jn],(f,[c])=>Math.acos(c.evaluate(f))],atan:[jn,[jn],(f,[c])=>Math.atan(c.evaluate(f))],min:[jn,rg(jn),(f,c)=>Math.min(...c.map(h=>h.evaluate(f)))],max:[jn,rg(jn),(f,c)=>Math.max(...c.map(h=>h.evaluate(f)))],abs:[jn,[jn],(f,[c])=>Math.abs(c.evaluate(f))],round:[jn,[jn],(f,[c])=>{const h=c.evaluate(f);return h<0?-Math.round(-h):Math.round(h)}],floor:[jn,[jn],(f,[c])=>Math.floor(c.evaluate(f))],ceil:[jn,[jn],(f,[c])=>Math.ceil(c.evaluate(f))],"filter-==":[qa,[aa,Oa],(f,[c,h])=>f.properties()[c.value]===h.value],"filter-id-==":[qa,[Oa],(f,[c])=>f.id()===c.value],"filter-type-==":[qa,[aa],(f,[c])=>f.geometryType()===c.value],"filter-<":[qa,[aa,Oa],(f,[c,h])=>{const g=f.properties()[c.value],_=h.value;return typeof g==typeof _&&g<_}],"filter-id-<":[qa,[Oa],(f,[c])=>{const h=f.id(),g=c.value;return typeof h==typeof g&&h":[qa,[aa,Oa],(f,[c,h])=>{const g=f.properties()[c.value],_=h.value;return typeof g==typeof _&&g>_}],"filter-id->":[qa,[Oa],(f,[c])=>{const h=f.id(),g=c.value;return typeof h==typeof g&&h>g}],"filter-<=":[qa,[aa,Oa],(f,[c,h])=>{const g=f.properties()[c.value],_=h.value;return typeof g==typeof _&&g<=_}],"filter-id-<=":[qa,[Oa],(f,[c])=>{const h=f.id(),g=c.value;return typeof h==typeof g&&h<=g}],"filter->=":[qa,[aa,Oa],(f,[c,h])=>{const g=f.properties()[c.value],_=h.value;return typeof g==typeof _&&g>=_}],"filter-id->=":[qa,[Oa],(f,[c])=>{const h=f.id(),g=c.value;return typeof h==typeof g&&h>=g}],"filter-has":[qa,[Oa],(f,[c])=>c.value in f.properties()],"filter-has-id":[qa,[],f=>f.id()!==null&&f.id()!==void 0],"filter-type-in":[qa,[Ic(aa)],(f,[c])=>c.value.indexOf(f.geometryType())>=0],"filter-id-in":[qa,[Ic(Oa)],(f,[c])=>c.value.indexOf(f.id())>=0],"filter-in-small":[qa,[aa,Ic(Oa)],(f,[c,h])=>h.value.indexOf(f.properties()[c.value])>=0],"filter-in-large":[qa,[aa,Ic(Oa)],(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:qa,overloads:[[[qa,qa],(f,[c,h])=>c.evaluate(f)&&h.evaluate(f)],[rg(qa),(f,c)=>{for(const h of c)if(!h.evaluate(f))return!1;return!0}]]},any:{type:qa,overloads:[[[qa,qa],(f,[c,h])=>c.evaluate(f)||h.evaluate(f)],[rg(qa),(f,c)=>{for(const h of c)if(h.evaluate(f))return!0;return!1}]]},"!":[qa,[qa],(f,[c])=>!c.evaluate(f)],"is-supported-script":[qa,[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(Oa),(f,c)=>c.map(h=>fh(h.evaluate(f))).join("")],"resolved-locale":[aa,[$k],(f,[c])=>c.evaluate(f).resolvedLocale()],random:[jn,[jn,jn,Oa],(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 p0}function sg(f,c,h,g,_){const S=new sN(p0,[],c?function(L){const z={color:Gd,string:aa,number:jn,enum:aa,boolean:qa,formatted:zv,resolvedImage:Bv};return L.type==="array"?Ic(z[L.value]||Oa,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?r6(new xN(C,c,h,g,_)):ng(S.errors)}class g0{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 P5(f,c,h,g,_){if((f=sg(f,c,h,g,_)).result==="error")return f;const S=f.value.expression,C=l0(S);if(!C&&!Jv(c))return ng([new mh("","data expressions not supported")]);const L=c0(S,["zoom","pitch","distance-from-center"]);if(!L&&!s6(c))return ng([new mh("","zoom expressions not supported")]);const z=c0(S,["measure-light"]);if(!z&&!n6(c))return ng([new mh("","measure-light expression not supported")]);const $=c0(S,["line-progress"]);if(!$&&!function(ee){return I5(ee.expression,"line-progress")}(c))return ng([new mh("","line-progress expression not supported")]);const K=c.expression&&c.expression.relaxZoomRestriction,Z=Zh(S);return Z||L||K?Z instanceof mh?ng([Z]):Z instanceof Lu&&!pN(c)?ng([new mh("",'"interpolate" expressions cannot be used with this property')]):r6(Z?new vx(C&&$?"camera":"composite",f.value,Z.labels,Z instanceof Lu?Z.interpolation:void 0,z,$):new g0(C&&$?"constant":"source",f.value,z,$)):ng([new mh("",'"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,i6(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 Zh(f){let c=null;if(f instanceof Lf)c=Zh(f.result);else if(f instanceof Yv){for(const h of f.args)if(c=Zh(h),c)break}else(f instanceof Kv||f instanceof Lu)&&f.input instanceof wd&&f.input.name==="zoom"&&(c=f);return c instanceof mh||f.eachChild(h=>{const g=Zh(h);g instanceof mh?c=g:c&&g&&c!==g&&(c=new mh("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),c}var L5,c6,d6=function(){if(c6)return L5;c6=1,L5=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=ee[ge+0]&&S>=ee[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),ee=this._convertToCellCoord(_),re=this._convertToCellCoord(S),ie=K;ie<=ee;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 Pn={"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 O5(f){for(const c of f)if(!u6(c.charCodeAt(0)))return!1;return!0}function u6(f){return!(Pn.Arabic(f)||Pn["Arabic Supplement"](f)||Pn["Arabic Extended-A"](f)||Pn["Arabic Presentation Forms-A"](f)||Pn["Arabic Presentation Forms-B"](f))}function vN(f){return!(f!==746&&f!==747&&(f<4352||!(Pn["Bopomofo Extended"](f)||Pn.Bopomofo(f)||Pn["CJK Compatibility Forms"](f)&&!(f>=65097&&f<=65103)||Pn["CJK Compatibility Ideographs"](f)||Pn["CJK Compatibility"](f)||Pn["CJK Radicals Supplement"](f)||Pn["CJK Strokes"](f)||!(!Pn["CJK Symbols and Punctuation"](f)||f>=12296&&f<=12305||f>=12308&&f<=12319||f===12336)||Pn["CJK Unified Ideographs Extension A"](f)||Pn["CJK Unified Ideographs"](f)||Pn["Enclosed CJK Letters and Months"](f)||Pn["Hangul Compatibility Jamo"](f)||Pn["Hangul Jamo Extended-A"](f)||Pn["Hangul Jamo Extended-B"](f)||Pn["Hangul Jamo"](f)||Pn["Hangul Syllables"](f)||Pn.Hiragana(f)||Pn["Ideographic Description Characters"](f)||Pn.Kanbun(f)||Pn["Kangxi Radicals"](f)||Pn["Katakana Phonetic Extensions"](f)||Pn.Katakana(f)&&f!==12540||!(!Pn["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)||!(!Pn["Small Form Variants"](f)||f>=65112&&f<=65118||f>=65123&&f<=65126)||Pn["Unified Canadian Aboriginal Syllabics"](f)||Pn["Unified Canadian Aboriginal Syllabics Extended"](f)||Pn["Vertical Forms"](f)||Pn["Yijing Hexagram Symbols"](f)||Pn["Yi Syllables"](f)||Pn["Yi Radicals"](f))))}function _N(f){return!(vN(f)||function(c){return!!(Pn["Latin-1 Supplement"](c)&&(c===167||c===169||c===174||c===177||c===188||c===189||c===190||c===215||c===247)||Pn["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)||Pn["Letterlike Symbols"](c)||Pn["Number Forms"](c)||Pn["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)||Pn["Control Pictures"](c)&&c!==9251||Pn["Optical Character Recognition"](c)||Pn["Enclosed Alphanumerics"](c)||Pn["Geometric Shapes"](c)||Pn["Miscellaneous Symbols"](c)&&!(c>=9754&&c<=9759)||Pn["Miscellaneous Symbols and Arrows"](c)&&(c>=11026&&c<=11055||c>=11088&&c<=11097||c>=11192&&c<=11243)||Pn["CJK Symbols and Punctuation"](c)||Pn.Katakana(c)||Pn["Private Use Area"](c)||Pn["CJK Compatibility Forms"](c)||Pn["Small Form Variants"](c)||Pn["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 Pn.Arabic(f)||Pn["Arabic Supplement"](f)||Pn["Arabic Extended-A"](f)||Pn["Arabic Presentation Forms-A"](f)||Pn["Arabic Presentation Forms-B"](f)}function D5(f){return f>=1424&&f<=2303||Pn["Arabic Presentation Forms-A"](f)||Pn["Arabic Presentation Forms-B"](f)}function Df(f,c){return!(!c&&D5(f)||f>=2304&&f<=3583||f>=3840&&f<=4255||Pn.Khmer(f))}function soe(f){for(const c of f)if(D5(c.charCodeAt(0)))return!0;return!1}const du={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let R5=null,jd=du.unavailable,Rf=null;const n_=function(f){f&&typeof f=="string"&&f.indexOf("NetworkError")>-1&&(jd=du.error),R5&&R5(f)};function wN(){jN.fire(new Pr("pluginStateChange",{pluginStatus:jd,pluginURL:Rf}))}const jN=new Ls,s_=function(){return jd},h6=function(){if(jd!==du.deferred||!Rf)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");jd=du.loading,wN(),Rf&&Iu({url:Rf},f=>{f?n_(f):(jd=du.loaded,wN())})},Ff={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>jd===du.loaded||Ff.applyArabicShaping!=null,isLoading:()=>jd===du.loading,setState(f){jd=f.pluginStatus,Rf=f.pluginURL},isParsing:()=>jd===du.parsing,isParsed:()=>jd===du.parsed,getPluginURL:()=>Rf};class ci{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=P5(C,L,z,$,K);if(Z.result==="error")throw new Error(Z.value.map(ee=>`${ee.key}: ${ee.message}`).join(", "));return Z.value}{let Z=C;return typeof C=="string"&&L.type==="color"&&(Z=ka.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 F5{constructor(c,h,g,_){this.property=c,this.value=new kN(c,void 0,h,g,_)}transitioned(c,h){return new f6(this.property,this.value,h,Object.assign({},c.transition,this.transition),c.now)}untransitioned(){return new f6(this.property,this.value,null,{},0)}}class m6{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 F5(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 F5(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 p6(this._properties);for(const _ of Object.keys(this._values))g._values[_]=this._values[_].transitioned(c,h._values[_]);return g}untransitioned(){const c=new p6(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].untransitioned();return c}isIndoorDependent(){return this._isIndoorDependent}}class f6{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 x6(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 x6(f)}function Fm(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(!Fm(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};Fm(f)||(f=CN(f));const _=f;let S=!0;try{S=function(K){if(!y0(K))return K;let Z=NN(K);return y6(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,ee,re)=>K.value.evaluate(Z,ee,{},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,ee,re,ie,ge)=>K.value.evaluate(Z,ee,{},re,void 0,void 0,ie,ge),$=!l0(K.value.expression)}return{filter:C,dynamicFilter:z||void 0,needGeometry:v6(S),needFeature:!!$}}function kx(f){if(!Array.isArray(f))return f;const c=function(h){if(aoe.has(h[0])){for(let g=1;gkx(h))}function y6(f){let c=!1;const h=[];if(f[0]==="case"){for(let g=1;g",">=","<","<=","to-boolean"]);function ioe(f,c){return fc?1:0}function v6(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(ioe)]]:["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 Yh(f,c){return c?`${f}${Nx}${c}`:f}let _6;const b6=()=>_6||(_6=new to({"icon-size":new Rr(Bt.layout_symbol["icon-size"]),"icon-image":new Rr(Bt.layout_symbol["icon-image"]),"icon-rotate":new Rr(Bt.layout_symbol["icon-rotate"]),"icon-offset":new Rr(Bt.layout_symbol["icon-offset"]),"text-size":new Rr(Bt.layout_symbol["text-size"]),"text-rotate":new Rr(Bt.layout_symbol["text-rotate"]),"text-offset":new Rr(Bt.layout_symbol["text-offset"])}));class w6{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(b6()),this.unevaluatedLayout=new g6(b6(),_,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 j6="-transition",zm=new Set(["fill","line","background","hillshade","raster"]);class kd extends Ls{constructor(c,h,g,_,S,C){if(super(),this.id=c.id,this.fqid=Yh(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 g6(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 m6(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)&&zm.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 w6(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(j6)?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(j6)){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())),fr(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 k6={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 ooe=new ArrayBuffer(0);class Si{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=ooe),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 $s(f,c=1){let h=0,g=0;return{members:f.map(_=>{const S=k6[_.type].BYTES_PER_ELEMENT,C=h=N6(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:N6(h,Math.max(g,c)),alignment:c}}function N6(f,c){return Math.ceil(f/c)*c}class ig extends Si{_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,sn(ig,"StructArrayLayout2i4");class v0 extends Si{_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}}v0.prototype.bytesPerElement=6,sn(v0,"StructArrayLayout3i6");class _0 extends Si{_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}}_0.prototype.bytesPerElement=8,sn(_0,"StructArrayLayout4i8");class zf extends Si{_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,sn(zf,"StructArrayLayout1f4");class z5 extends Si{_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}}z5.prototype.bytesPerElement=8,sn(z5,"StructArrayLayout2i1f8");class B5 extends Si{_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}}B5.prototype.bytesPerElement=8,sn(B5,"StructArrayLayout3i8");class $5 extends Si{_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}}$5.prototype.bytesPerElement=10,sn($5,"StructArrayLayout5i10");class EN extends Si{_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,sn(EN,"StructArrayLayout2i4ub1f12");class Ou extends Si{_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,sn(Ou,"StructArrayLayout3f12");class Kd extends Si{_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,sn(Kd,"StructArrayLayout4ui1f12");class Sx extends Si{_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,sn(Sx,"StructArrayLayout4ui8");class IN extends Si{_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,sn(IN,"StructArrayLayout6i12");class U5 extends Si{_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,ee){const re=this.length;return this.resize(re+1),this.emplace(re,c,h,g,_,S,C,L,z,$,K,Z,ee)}emplace(c,h,g,_,S,C,L,z,$,K,Z,ee,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]=ee,this.int16[ie+11]=re,c}}U5.prototype.bytesPerElement=24,sn(U5,"StructArrayLayout4i4ui4i24");class q5 extends Si{_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}}q5.prototype.bytesPerElement=20,sn(q5,"StructArrayLayout3i3f20");class og extends Si{_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,sn(og,"StructArrayLayout4f16");class PN extends Si{_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,sn(PN,"StructArrayLayout1ul4");class Du extends Si{_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,sn(Du,"StructArrayLayout2ui4");class LN extends Si{_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,ee,re){const ie=this.length;return this.resize(ie+1),this.emplace(ie,c,h,g,_,S,C,L,z,$,K,Z,ee,re)}emplace(c,h,g,_,S,C,L,z,$,K,Z,ee,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]=ee,this.uint16[ge+18]=re,this.uint16[ge+19]=ie,c}}LN.prototype.bytesPerElement=40,sn(LN,"StructArrayLayout5i4f1i1ul2ui40");class ON extends Si{_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,sn(ON,"StructArrayLayout3i2i2i16");class DN extends Si{_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,sn(DN,"StructArrayLayout2f1f2i16");class V5 extends Si{_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}}V5.prototype.bytesPerElement=20,sn(V5,"StructArrayLayout2ub4f20");class Qo extends Si{_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,sn(Qo,"StructArrayLayout3ui6");class b0 extends Si{_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,ee,re,ie,ge,Se,Ne,Fe,Ue,Xe,xt){const mt=this.length;return this.resize(mt+1),this.emplace(mt,c,h,g,_,S,C,L,z,$,K,Z,ee,re,ie,ge,Se,Ne,Fe,Ue,Xe,xt)}emplace(c,h,g,_,S,C,L,z,$,K,Z,ee,re,ie,ge,Se,Ne,Fe,Ue,Xe,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]=ee,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]=Xe,this.int16[wt+28]=xt,this.uint8[Pt+58]=mt,c}}b0.prototype.bytesPerElement=60,sn(b0,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class H5 extends Si{_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,ee,re,ie,ge,Se,Ne,Fe,Ue,Xe,xt,mt,wt,Ct,Pt,Qt,Ft,nr,dr,ur,yr,_r,mr){const gr=this.length;return this.resize(gr+1),this.emplace(gr,c,h,g,_,S,C,L,z,$,K,Z,ee,re,ie,ge,Se,Ne,Fe,Ue,Xe,xt,mt,wt,Ct,Pt,Qt,Ft,nr,dr,ur,yr,_r,mr)}emplace(c,h,g,_,S,C,L,z,$,K,Z,ee,re,ie,ge,Se,Ne,Fe,Ue,Xe,xt,mt,wt,Ct,Pt,Qt,Ft,nr,dr,ur,yr,_r,mr,gr){const rr=20*c,Jt=40*c,xr=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]=ee,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]=Xe,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]=dr,this.float32[rr+16]=ur,this.float32[rr+17]=yr,this.float32[rr+18]=_r,this.uint8[xr+76]=mr,this.uint16[Jt+39]=gr,c}}H5.prototype.bytesPerElement=80,sn(H5,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class W5 extends Si{_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}}W5.prototype.bytesPerElement=24,sn(W5,"StructArrayLayout6f24");class Cx extends Si{_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,sn(Cx,"StructArrayLayout5f20");class G5 extends Si{_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}}G5.prototype.bytesPerElement=28,sn(G5,"StructArrayLayout7f28");class K5 extends Si{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,_,S,C,L,z,$,K,Z){const ee=this.length;return this.resize(ee+1),this.emplace(ee,c,h,g,_,S,C,L,z,$,K,Z)}emplace(c,h,g,_,S,C,L,z,$,K,Z,ee){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]=ee,c}}K5.prototype.bytesPerElement=44,sn(K5,"StructArrayLayout11f44");class w0 extends Si{_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}}w0.prototype.bytesPerElement=36,sn(w0,"StructArrayLayout9f36");class Bm extends Si{_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}}Bm.prototype.bytesPerElement=8,sn(Bm,"StructArrayLayout2f8");class Zd extends Si{_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,sn(Zd,"StructArrayLayout1ul3ui12");class lg extends Si{_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,sn(lg,"StructArrayLayout1ui2");class Z5 extends Si{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,_,S,C,L,z,$,K,Z,ee,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,ee,re,ie,ge,Se)}emplace(c,h,g,_,S,C,L,z,$,K,Z,ee,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]=ee,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}}Z5.prototype.bytesPerElement=64,sn(Z5,"StructArrayLayout16f64");class RN extends Si{_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,sn(RN,"StructArrayLayout4ui3f20");class Y5 extends Si{_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}}Y5.prototype.bytesPerElement=2,sn(Y5,"StructArrayLayout1i2");class FN extends Si{_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,sn(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 S6 extends LN{get(c){return new zN(this,c)}}sn(S6,"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 C6 extends b0{get(c){return new BN(this,c)}}sn(C6,"PlacedSymbolArray");class M6 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]}}M6.prototype.size=80;class X5 extends H5{get(c){return new M6(this,c)}}sn(X5,"SymbolInstanceArray");class $N extends zf{getoffsetX(c){return this.float32[1*c+0]}}sn($N,"GlyphOffsetArray");class T6 extends ig{getx(c){return this.int16[2*c+0]}gety(c){return this.int16[2*c+1]}}sn(T6,"SymbolLineVertexArray");class Q5 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]}}Q5.prototype.size=12;class J5 extends Zd{get(c){return new Q5(this,c)}}sn(J5,"FeatureIndexArray");class A6 extends Du{geta_centroid_pos0(c){return this.uint16[2*c+0]}geta_centroid_pos1(c){return this.uint16[2*c+1]}}sn(A6,"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 v0{get(c){return new UN(this,c)}}sn(o_,"FillExtrusionWallArray");const E6=$s([{name:"a_pos",components:2,type:"Int16"}],4),loe=$s([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),I6=$s([{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,sn(Ui,"SegmentVector");const coe=$s([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),doe=$s([{name:"a_pattern_b",components:4,type:"Uint16"}]),uoe=$s([{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(eM(c)),this.positions.push(h,g,_)}eachPosition(c,h){const g=eM(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 tM(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 eM(f){const c=+f;return Number.isSafeInteger(c)?c:pr(String(f))}function tM(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 ka?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 j0{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 ci(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=rM(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 ci(this.context.zoom,{brightness:C,worldview:z}),h,{},S,_,L),K=this.expression.evaluate(new ci(this.context.zoom+1,{brightness:C,worldview:z}),h,{},S,_,L),Z=h_(this.lutExpression,h,{},_,S,C,L,z),ee=this.paintVertexArray.length;this.paintVertexArray.resize(c),this._setPaintValue(ee,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=rM(g.toPremultipliedRenderColor(S)),L=rM(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=poe(S,c.type),z=C.value,$=C.property.specification.type,K=!!C.property.useIntegerZoom,Z=S==="line-dasharray"||S.endsWith("pattern"),ee=c.paint.get(`${S}-use-theme`),re=S==="line-dasharray"&&c.layout.get("line-cap").value.kind!=="constant"||ee&&ee.value.kind!=="constant";if(z.kind!=="constant"||re)if(z.kind==="source"||re||Z){const ie=nM(S,$,"source");this.binders[S]=Z?new qf(z,L,$,ie,c.id):new $f(z,L,$,ie),_.push(`/a_${S}`)}else{const ie=nM(S,$,"composite");this.binders[S]=new Uf(z,L,$,K,h,ie),_.push(`/z_${S}`)}else this.binders[S]=Z?new j0(z.value,L):new m_(z.value,L,$,h),_.push(`/u_${S}`);ee&&(this.binders[S].lutExpression=ee.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 j0&&_.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 ee=Object.keys(c),re=ee.length!==0&&!z,ie=re?ee: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,(Xe,xt,mt)=>{const wt=_.feature(Xe);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,(Xe,xt,mt)=>{const wt=_.feature(Xe);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 j0)&&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 j0||_ 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 Xh{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 foe={"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 poe(f,c){return foe[f]||[f.replace(`${c}-`,"").replace(/-/g,"_")]}const goe={"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}},xoe={color:{source:Bm,composite:og},number:{source:zf,composite:Bm}};function nM(f,c,h){const g=goe[f];return g&&g[h]||xoe[c][h]}sn(m_,"ConstantBinder"),sn(j0,"PatternConstantBinder"),sn($f,"SourceExpressionBinder"),sn(qf,"PatternCompositeBinder"),sn(Uf,"CompositeExpressionBinder"),sn(cg,"ProgramConfiguration",{omit:["_buffers"]}),sn(Xh,"ProgramConfigurationSet");const Pc=Ar/Math.PI/2,xh=5,ZN=6,yoe=16383,k0=64,sM=[k0,32,16],yh=-Pc,vh=Pc;function Mx(f,c,h,g=Pc){return h=Hn(h),[f*Math.sin(h)*g,-c*g,f*Math.cos(h)*g]}function N0(f,c,h){return Mx(Math.cos(Hn(f)),Math.sin(Hn(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(Ze(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 N0(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 J(f,c){return f/R(c)}function te(f){return 360*f-180}function ue(f){return 360/Math.PI*Math.atan(Math.exp((180-360*f)*Math.PI/180))-90}function ce(f,c){return f*R(ue(c))}const fe=85.051129;function ke(f){return Math.cos(Hn(ye(f,-fe,fe)))}function _e(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/Ar)/(1<=z?(st(f,c,h,$,K,S,Z,L,z),st(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=Ar/_;if(c&&h&&h.projection.isReprojectedInTileSpace){const C=1<{const re=te((c.x+ee.x/_)/C),ie=ue((c.y+ee.y/_)/C),ge=K.project(re,ie);ee.x=(ge.x*L-z)*_,ee.y=(ge.y*L-$)*_};for(let ee=0;ee=_||ie.y<0||ie.y>=_||(Z(ie),re.push(ie));g[ee]=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 or(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(ee){return[360*(ee.x+S)/_-180,360/Math.PI*Math.atan(Math.exp((1-2*(ee.y+C)/_)*Math.PI))-90]}function $(ee){return ee.map(z)}let K;if(this.type===1){const ee=[];for(const ie of L)ee.push(ie[0]);const re=$(ee);K=ee.length===1?{type:"Point",coordinates:re[0]}:{type:"MultiPoint",coordinates:re}}else if(this.type===2){const ee=L.map($);K=ee.length===1?{type:"LineString",coordinates:ee[0]}:{type:"MultiLineString",coordinates:ee}}else{if(this.type!==3)throw new Error("unknown feature type");{const ee=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 br(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 lr(h,h.readVarint()+h.pos);g.length&&(c[g.name]=g)}}const er="3d_elevation_id",Kt="level";class hr{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 Ir{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 Ir((f,c,h)=>f.reset(c).require(er,g=>{h.id=g}).optional("fixed_height_relative",g=>{h.constantHeight=g},wr.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},wr.decodeRelativeHeight).geometry(g=>{h.position=g},wr.getPoint).success()),Cr=new Ir((f,c,h)=>f.reset(c).require(er,g=>{h.id=g}).optional("fixed_height",g=>{h.constantHeight=g},wr.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},wr.decodeMetricHeight).geometry(g=>{h.position=g},wr.getPoint).success());class wr{static getPoint(c){return Ot(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"?Cr:void 0:Yr}static parse(c){const h=[],g=[],_=c.length,S=new hr;for(let C=0;C<_;C++){const L=c.feature(C),z=L.properties.version,$=wr.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 ee={};$.parseVertex(S,L,ee)&&h.push(ee)}else if(Z==="Polygon"&&K==="curve_meta"){const ee={};$.parseFeature(S,L,ee)&&g.push(ee)}}return{vertices:h,features:g}}}class pn{constructor(c,h){this.pos=c,this.dir=h}intersectsPlane(c,h,g){const _=Wa(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 on{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],Xe=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-Xe)<=u*Math.max(1,Math.abs(Ne),Math.abs(Xe))}(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),ee=Z*Z-4*K*(L*L+z*z+$*$-h*h);if(ee<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(ee))/(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 Vr{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 Vr(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 Tn(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 ss(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 Na{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=yn.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(ee=K)[0]=(re=K)[0]*(ie=[Z,Z,_?1/K[3]:Z,Z])[0],ee[1]=re[1]*ie[1],ee[2]=re[2]*ie[2],ee[3]=re[3]*ie[3],ee;var ee,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([],At([],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 yn{static fromPoints(c){const h=[1/0,1/0,1/0],g=[-1/0,-1/0,-1/0];for(const _ of c)be(h,h,_),we(g,g,_);return new yn(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])]}}sn(yn,"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 or(Math.trunc(c.position[0]+g*S),Math.trunc(c.position[1]+_*S)),new or(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;Gr(Z,c.x,c.y);const ee=new pn(Z,null);for(let re=0;re0?Wa(z,L)/Xe:0,mt=ye(xt,0,1),wt=Math.abs((xt-mt)*this.edgeProps[re].len);zn($,Z,Se),Gr(K,ge[1],-ge[0]);const Ct=wt+Math.abs(Wa($,K));Ct=0;--C){const L=this.edges[C].a,z=this.edges[C].b,{position:$,height:K,extent:Z}=this.vertices[L],{position:ee,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,ee[0]/c,ee[1]/c,re),me(_,ge[1],-ge[0],0),ve(_,_,Z),me(S,Se[1],-Se[0],0),ve(S,S,ie),this.distSqLines(ne(h[0]+.5*_[0],h[1]+.5*_[1],h[2]+.5*_[2]),ne(g[0]-.5*S[0],g[1]-.5*S[1],g[2]-.5*S[2]),ne(h[0]-.5*_[0],h[1]-.5*_[1],h[2]-.5*_[2]),ne(g[0]+.5*S[0],g[1]+.5*S[1],g[2]+.5*S[2]))<=.0025000000000000005)continue;const Ne=this.vertices.length,Fe=An(Zn(),$,ee);this.vertices.push({position:ba(Fe,Fe,.5),height:.5*(K+re),extent:.5*(Z+ie)});const Ue=An(Zn(),ge,Se);this.vertexProps.push({dir:Mo(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 Xe=zn(Zn(),this.vertices[Ne].position,$),xt=gi(Xe),mt={vec:Xe,dir:ba(Zn(),Xe,1/xt),len:xt};this.edgeProps.push(mt),this.edgeProps.push(mt)}}distSqLines(c,h,g,_){const S=xe(de(),h,c),C=xe(de(),_,g),L=xe(de(),c,g),z=ot(S,S),$=ot(S,C),K=ot(S,L),Z=ot(C,C),ee=ot(C,L),re=z*Z-$*$;if(re===0)return Ie(Oe(S,g,_,ot(L,C)/ot(C,C)),c);const ie=(z*ee-$*K)/re;return Ie(Oe(S,c,h,($*ee-K*Z)/re),Oe(C,g,_,ie))}}class Ta{static parseFrom(c,h){const g=wr.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,ee)=>Z===ee.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 es(K.id,K.bounds,K.constantHeight));continue}for(;z!==$&&_[z].id_.id===g)}}class Va{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)*Ar,this.yOffset=(c.y*this.zScale-h.y)*Ar)}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))}}sn(es,"ElevationFeature");class Ra{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 Xh(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:ee}of c){const re=this.layers[0]._featureFilter.needGeometry,ie=Rt($,re);if(!this.layers[0]._featureFilter.filter(new ci(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:ee,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:ee}=$,re=c[Z].feature;this.addFeature($,K,Z,h.availableImages,g,z,h.brightness,h.elevationFeatures),h.featureIndex.insert(re,K,Z,ee,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,E6.members),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=c.createVertexBuffer(this.globeExtVertexArray,I6.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=c.createVertexBuffer(this.elevatedLayoutVertexArray,loe.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"&&($=Ta.getElevationFeature(c,z));for(const K of h)for(const Z of K){const ee=Z.x,re=Z.y;if(ee<0||ee>=Ar||re<0||re>=Ar)continue;if(C){const Se=C.projectTilePoint(ee,re,S),Ne=C.upVector(S,ee,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(ee,re,-1,-1),this.addCircleVertex(ee,re,1,-1),this.addCircleVertex(ee,re,1,1),this.addCircleVertex(ee,re,-1,1),this.elevationMode!=="none"){const Se=$?$.pointElevation(new or(ee,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(Ci(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 ei(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 Nd(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 or(c,h),new or(c,_),new or(g,_),new or(g,h)];if(f.length>2){for(const C of S)if(ei(f,C))return!0}for(let C=0;C_.x&&c.x>_.x||f.y_.y&&c.y>_.y)return!1;const S=cs(f,c,h[0]);return S!==cs(f,c,h[1])||S!==cs(f,c,h[2])||S!==cs(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=or.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 Jh(f){if(f.z<=1)return Vf[f.z+2*f.y+f.x];const c=voe(P6(f));return yn.fromPoints(c)}function Wf(f,c,h){return ve(f,f,1-h),et(f,f,c,h)}function cve(f,c,h){for(const g of f)at(g,g,c),ve(g,g,h)}function dve(f,c,h,g){const _=c/f.worldSize,S=f.globeMatrix;if(h.z<=1){const Pt=Jh(h).getCorners();return cve(Pt,S,_),yn.fromPoints(Pt)}const C=P6(h,g),L=voe(C,Pc+Um(f._tileCoverLift));cve(L,S,_);const z=Number.MAX_VALUE,$=[-z,-z,-z],K=[z,z,z];if(C.contains(f.center)){for(const Ft of L)be(K,K,Ft),we($,$,Ft);$[2]=0;const Pt=f.point,Qt=[Pt.x*_,Pt.y*_,0];return be(K,K,Qt),we($,$,Qt),new yn(K,$)}if(f._tileCoverLift>0){for(const Pt of L)be(K,K,Pt),we($,$,Pt);return new yn(K,$)}const Z=[S[12]*_,S[13]*_,S[14]*_],ee=C.getCenter(),re=ye(f.center.lat,-fe,fe),ie=ye(ee.lat,-fe,fe),ge=B(f.center.lng),Se=H(re);let Ne=ge-B(ee.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,et(Z,Z,[S[4]*_,S[5]*_,S[6]*_],-Math.sin(Hn(Fe>=0?C.getSouth():C.getNorth()))*Pc));const Xe=L[Ue],xt=L[(Ue+1)%4],mt=new dg(Xe,xt,Z),wt=[Hf(mt,0)||Xe[0],Hf(mt,1)||Xe[1],Hf(mt,2)||Xe[2]],Ct=M0(f.zoom);if(Ct>0){const Pt=function({x:Ft,y:nr,z:dr},ur,yr,_r,mr){const gr=1/(1<.5?jr=-1:_n<-.5&&(jr=1),rr=((rr+jr)*ur-(_r*=ur))*yr+_r,Jt=((Jt+jr)*ur-_r)*yr+_r,xr=(xr*ur-(mr*=ur))*yr+mr,Er=(Er*ur-mr)*yr+mr,[[rr,Er,0],[Jt,Er,0],[Jt,xr,0],[rr,xr,0]]}(h,c,f._pixelsPerMercatorPixel,ge,Se);for(let Ft=0;FtMath.PI/2*1.01}const pve=Hn(85),eHe=Math.cos(pve),tHe=Math.sin(pve),rHe=N(),gve=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 xve(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 ee of Z){const re=ee.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:nHe(ge.x,ge.y,ge.z,g),Ne=S?f.tilespaceRays.map(Ue=>aHe(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=ue((ee.y/Ar+$.y)/(1<<$.z));z/=h.projection.pixelsPerMeter(Ue,1)/J(1,Ue)}if(gs(Ne,Se,z))return!0}return!1}function nHe(f,c,h,g){const _=Ke([],[f,c,h,1],g);return new or(_[0]/_[3],_[1]/_[3])}const yve=ne(0,0,0),sHe=ne(0,0,1);function aHe(f,c){const h=de();return yve[2]=c,f.intersectsPlane(yve,sHe,h),new or(h[0],h[1])}class vve extends Ra{}let _ve,bve,wve,jve;function kve(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 Nve(f,c,h){const{width:g,height:_}=c;g===f.width&&_===f.height||(joe(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 joe(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 ee=((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=ee+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=ee+ie*S,Se=re+ie*S,Ne=new ka(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[ee+ie]}return c}sn(vve,"HeatmapBucket",{omit:["layers"]});class T0{constructor(c,h){kve(this,c,1,h)}resize(c){Nve(this,new T0(c),1)}clone(){return new T0({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(c,h,g,_,S){joe(c,h,g,_,S,1,null)}}class Dc{constructor(c,h){kve(this,c,4,h)}resize(c){Nve(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){joe(c,h,g,_,S,4,C,L)}}class Sve{constructor(c,h){this.width=c.width,this.height=c.height,this.data=h instanceof Uint8Array?new Float32Array(h.buffer):h}}function iM(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 ee=h;ee<_;ee+=h){const re=f[ee],ie=f[ee+1];reK&&(K=re),ie>Z&&(Z=ie)}$=Math.max(K-L,Z-z),$=$!==0?32767/$:0}return oM(S,C,h,L,z,$,0),C}function Cve(f,c,h,g,_){let S;if(_===function(C,L,z,$){let K=0;for(let Z=L,ee=z-$;Z0)for(let C=c;C=c;C-=g)S=Eve(C/g|0,f[C],f[C+1],S);return S&&XN(S,S.next)&&(dM(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(dM(g),g=c=g.prev,g===g.next)break;h=!0}while(h||g!==c);return c}function oM(f,c,h,g,_,S,C){if(!f)return;!C&&S&&function(z,$,K,Z){let ee=z;do ee.z===0&&(ee.z=koe(ee.x,ee.y,$,K,Z)),ee.prevZ=ee.prev,ee.nextZ=ee.next,ee=ee.next;while(ee!==z);ee.prevZ.nextZ=null,ee.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,Xe=0;for(let mt=0;mt0||xt>0&&Ue;)Xe!==0&&(xt===0||!Ue||Ne.z<=Ue.z)?(Se=Ne,Ne=Ne.nextZ,Xe--):(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)}(ee)}(f,g,_,S);let L=f;for(;f.prev!==f.next;){const z=f.prev,$=f.next;if(S?uHe(f,g,_,S):dHe(f))c.push(z.i,f.i,$.i),dM(f),f=$.next,L=$.next;else if((f=$)===L){C?C===1?oM(f=hHe(g_(f),c),c,h,g,_,S,2):C===2&&mHe(f,c,h,g,_,S):oM(g_(f),c,h,g,_,S,1);break}}}function dHe(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,$),ee=Math.max(_,S,C),re=Math.max(L,z,$);let ie=g.next;for(;ie!==c;){if(ie.x>=K&&ie.x<=ee&&ie.y>=Z&&ie.y<=re&&lM(_,L,S,z,C,$,ie.x,ie.y)&&Ll(ie.prev,ie,ie.next)>=0)return!1;ie=ie.next}return!0}function uHe(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,ee=C.y,re=Math.min(L,z,$),ie=Math.min(K,Z,ee),ge=Math.max(L,z,$),Se=Math.max(K,Z,ee),Ne=koe(re,ie,c,h,g),Fe=koe(ge,Se,c,h,g);let Ue=f.prevZ,Xe=f.nextZ;for(;Ue&&Ue.z>=Ne&&Xe&&Xe.z<=Fe;){if(Ue.x>=re&&Ue.x<=ge&&Ue.y>=ie&&Ue.y<=Se&&Ue!==_&&Ue!==C&&lM(L,K,z,Z,$,ee,Ue.x,Ue.y)&&Ll(Ue.prev,Ue,Ue.next)>=0||(Ue=Ue.prevZ,Xe.x>=re&&Xe.x<=ge&&Xe.y>=ie&&Xe.y<=Se&&Xe!==_&&Xe!==C&&lM(L,K,z,Z,$,ee,Xe.x,Xe.y)&&Ll(Xe.prev,Xe,Xe.next)>=0))return!1;Xe=Xe.nextZ}for(;Ue&&Ue.z>=Ne;){if(Ue.x>=re&&Ue.x<=ge&&Ue.y>=ie&&Ue.y<=Se&&Ue!==_&&Ue!==C&&lM(L,K,z,Z,$,ee,Ue.x,Ue.y)&&Ll(Ue.prev,Ue,Ue.next)>=0)return!1;Ue=Ue.prevZ}for(;Xe&&Xe.z<=Fe;){if(Xe.x>=re&&Xe.x<=ge&&Xe.y>=ie&&Xe.y<=Se&&Xe!==_&&Xe!==C&&lM(L,K,z,Z,$,ee,Xe.x,Xe.y)&&Ll(Xe.prev,Xe,Xe.next)>=0)return!1;Xe=Xe.nextZ}return!0}function hHe(f,c){let h=f;do{const g=h.prev,_=h.next.next;!XN(g,_)&&Tve(g,h,h.next,_)&&cM(g,_)&&cM(_,g)&&(c.push(g.i,h.i,_.i),dM(h),dM(h.next),h=f=_),h=h.next}while(h!==f);return g_(h)}function mHe(f,c,h,g,_,S){let C=f;do{let L=C.next.next;for(;L!==C.prev;){if(C.i!==L.i&&yHe(C,L)){let z=Ave(C,L);return C=g_(C,C.next),z=g_(z,z.next),oM(C,c,h,g,_,S,0),void oM(z,c,h,g,_,S,0)}L=L.next}C=C.next}while(C!==f)}function fHe(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 pHe(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>=ee&&L!==C.x&&Mve(z$.x||C.x===$.x&&gHe($,C)))&&($=C,ie=ge)}C=C.next}while(C!==Z);return $}(f,c);if(!h)return c;const g=Ave(h,f);return g_(g,g.next),g_(h,h.next)}function gHe(f,c){return Ll(f.prev,f,c.prev)<0&&Ll(c.next,f,f.next)<0}function koe(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 xHe(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 lM(f,c,h,g,_,S,C,L){return!(f===C&&c===L)&&Mve(f,c,h,g,_,S,C,L)}function yHe(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&&Tve(_,_.next,h,g))return!0;_=_.next}while(_!==h);return!1}(f,c)&&(cM(f,c)&&cM(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 Tve(f,c,h,g){const _=R6(Ll(f,c,h)),S=R6(Ll(f,c,g)),C=R6(Ll(h,g,f)),L=R6(Ll(h,g,c));return _!==S&&C!==L||!(_!==0||!D6(f,h,c))||!(S!==0||!D6(f,g,c))||!(C!==0||!D6(h,f,g))||!(L!==0||!D6(h,c,g))}function D6(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 R6(f){return f>0?1:f<0?-1:0}function cM(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 Ave(f,c){const h=Noe(f.i,f.x,f.y),g=Noe(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 Eve(f,c,h,g){const _=Noe(f,c,h);return g?(_.next=g.next,_.prev=g,g.next.prev=_,g.next=_):(_.prev=_,_.next=_),_}function dM(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 Noe(f,c,h){return{i:f,x:c,y:h,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function uM(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=Ar&&h>=Ar}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}}}sn(Tx,"ElevationPortalGraph"),sn(Pve,"ElevationPolygons");class _He{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=de(),C=de();for(let L=0;LS!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new Xh(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||ee.x>=S.min.x&&ee.x<=S.max.x&&ee.y>=S.min.y&&ee.y<=S.max.y||fc(Z,ee,L))||this.isOnBorder(Z.x,ee.x)||this.isOnBorder(Z.y,ee.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(ee)),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=ee=>{ee.primitiveLength=this.indexArray.length-ee.primitiveOffset},_=new _He(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(c.portals,this.unevalEdges);const S=h(),C=h(),L=h(),z=(ee,re)=>{ee.sort((ge,Se)=>ge.type===re&&Se.type!==re?-1:ge.type!==re&&Se.type===re?1:0);const ie=ee.findIndex(ge=>ge.type!==re);return ie>=0?ie:ee.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 ee=this.unevalEdges.splice($),re=z(ee,"tunnel")+$;this.unevalEdges.push(...ee),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,lHe.members),this.vertexBufferNormal=c.createVertexBuffer(this.vertexNormals,cHe.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(yr,h[_r].x,h[_r].y,g[_r]*z),Z=de(),ee=de(),re=de(),ie=de(),ge=de(),Se=(yr,_r)=>{const mr=L.get(Fu.computePosHash(h[_r])),gr=mr.from,rr=mr.to;if(!gr||!rr)return;K(Z,gr),K(ee,_r),K(re,rr),Qe(ie),rt(Z,ee)||(je(ge,ee,Z),Ve(ie,ge)),rt(re,ee)||(je(ge,re,ee),he(ie,ie,Ve(ge,ge)));const Jt=Ce(ie);return Jt>0?ve(yr,ie,1/Jt):void 0};let Ne=Number.POSITIVE_INFINITY;this.sortSubarray(_,S.min,S.max,(yr,_r)=>yr.featureInfo.featureIndex-_r.featureInfo.featureIndex);const Fe=de(),Ue=de(),Xe=de(),xt=de(),mt=de(),wt=de(),Ct=de(),Pt=de(),Qt=de(),Ft=[de(),de(),de(),de()],nr=[de(),de(),de(),de()],dr=[{coord:new or(0,0),height:0},{coord:new or(0,0),height:0}],ur=(yr,_r)=>yr>_r;for(let yr=S.min;yrNe.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 or(0,0),height:0},{coord:new or(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>=Ar&&h>=Ar}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 Lve,Ove={exports:{}},Dve=(Lve||(Lve=1,function(f){function c(ft,vt){return ft>vt?1:ft0){var wn=vr+Math.floor(Ur/2),Nn={key:vt[wn],data:sr[wn],parent:ft};return Nn.left=_(Nn,vt,sr,vr,wn),Nn.right=_(Nn,vt,sr,wn+1,$r),Nn}return null}function S(ft,vt,sr,vr,$r){if(!(sr>=vr)){for(var Ur=ft[sr+vr>>1],wn=sr-1,Nn=vr+1;;){do wn++;while($r(ft[wn],Ur)<0);do Nn--;while($r(ft[Nn],Ur)>0);if(wn>=Nn)break;var ls=ft[wn];ft[wn]=ft[Nn],ft[Nn]=ls,ls=vt[wn],vt[wn]=vt[Nn],vt[Nn]=ls}S(ft,vt,sr,Nn,$r),S(ft,vt,Nn+1,vr,$r)}}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,vr,$r,Ur;ft.parent;)(sr=(vt=ft.parent).parent)&&sr.parent?((vr=sr.parent).left===sr?vr.left=ft:vr.right=ft,ft.parent=vr):(ft.parent=null,this._root=ft),$r=ft.left,Ur=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):($r?(sr.right=$r,$r.parent=sr):sr.right=null,ft.left=sr,sr.parent=ft)),Ur?(vt.left=Ur,Ur.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):(Ur?(sr.left=Ur,Ur.parent=sr):sr.left=null,ft.right=sr,sr.parent=ft)),$r?(vt.right=$r,$r.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,vr=null,$r=this._compare;if(this._noDuplicates)for(;sr;){if(vr=sr,$r(sr.key,ft)===0)return;sr=$r(sr.key,ft)<0?sr.right:sr.left}else for(;sr;)vr=sr,sr=$r(sr.key,ft)<0?sr.right:sr.left;return sr={key:ft,data:vt,left:null,right:null,parent:vr},vr?$r(vr.key,sr.key)<0?vr.right=sr:vr.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 vr=sr(vt.key,ft);if(vr<0)vt=vt.right;else{if(!(vr>0))return vt;vt=vt.left}}return null},h.prototype.contains=function(ft){for(var vt=this._root,sr=this._compare;vt;){var vr=sr(ft,vt.key);if(vr===0)return!0;vt=vr<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,vr=vt.right,$r=null;sr&&(sr.parent=null,$r=this.maxNode(sr),this.splay($r),this._root=$r),vr&&(sr?$r.right=vr:this._root=vr,vr.parent=$r),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=[],vr=!1,$r=0;!vr;)vt?(sr.push(vt),vt=vt.left):sr.length>0?(ft(vt=sr.pop(),$r++),vt=vt.right):vr=!0;return this},h.prototype.range=function(ft,vt,sr,vr){for(var $r=[],Ur=this._compare,wn=this._root;$r.length!==0||wn;)if(wn)$r.push(wn),wn=wn.left;else{if(Ur((wn=$r.pop()).key,vt)>0)break;if(Ur(wn.key,ft)>=0&&sr.call(vr,wn))return this;wn=wn.right}return this},h.prototype.keys=function(){for(var ft=this._root,vt=[],sr=[],vr=!1;!vr;)ft?(vt.push(ft),ft=ft.left):vt.length>0?(ft=vt.pop(),sr.push(ft.key),ft=ft.right):vr=!0;return sr},h.prototype.values=function(){for(var ft=this._root,vt=[],sr=[],vr=!1;!vr;)ft?(vt.push(ft),ft=ft.left):vt.length>0?(ft=vt.pop(),sr.push(ft.data),ft=ft.right):vr=!0;return sr},h.prototype.at=function(ft){for(var vt=this._root,sr=[],vr=!1,$r=0;!vr;)if(vt)sr.push(vt),vt=vt.left;else if(sr.length>0){if(vt=sr.pop(),$r===ft)return vt;$r++,vt=vt.right}else vr=!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 vr=ft.length;return sr&&S(ft,vt,0,vr-1,this._compare),this._root=_(null,ft,vt,0,vr),this._size=vr,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,vr,$r){return new h(sr,$r).load(ft,vt,vr)},Object.defineProperties(h.prototype,g);var C=0,L=1,z=2,$=3,K=0,Z=1,ee=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 vr=ge(ft,sr);ft.resultTransition=vr?function($r,Ur){var wn,Nn=!$r.inOut,ls=!$r.otherInOut;switch(Ur){case K:wn=Nn&&ls;break;case Z:wn=Nn||ls;break;case re:wn=Nn^ls;break;case ee:wn=$r.isSubject?Nn&&!ls:ls&&!Nn}return wn?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 ee:return ft.isSubject&&ft.otherInOut||!ft.isSubject&&!ft.otherInOut;case re:return!0}break;case z:return vt===K||vt===Z;case $:return vt===ee;case L:return!1}return!1}var Se=function(ft,vt,sr,vr,$r){this.left=vt,this.point=ft,this.otherEvent=sr,this.isSubject=vr,this.type=$r||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,Xe=134217729,xt=(3+8*Ue)*Ue;function mt(ft,vt,sr,vr,$r){var Ur,wn,Nn,ls,ys=vt[0],ws=vr[0],Us=0,Dn=0;ws>ys==ws>-ys?(Ur=ys,ys=vt[++Us]):(Ur=ws,ws=vr[++Dn]);var Kn=0;if(Usys==ws>-ys?(Nn=Ur-((wn=ys+Ur)-ys),ys=vt[++Us]):(Nn=Ur-((wn=ws+Ur)-ws),ws=vr[++Dn]),Ur=wn,Nn!==0&&($r[Kn++]=Nn);Usys==ws>-ys?(Nn=Ur-((wn=Ur+ys)-(ls=wn-Ur))+(ys-ls),ys=vt[++Us]):(Nn=Ur-((wn=Ur+ws)-(ls=wn-Ur))+(ws-ls),ws=vr[++Dn]),Ur=wn,Nn!==0&&($r[Kn++]=Nn);for(;Us0!=Us>0)return Dn;var Kn=Math.abs(ws+Us);return Math.abs(Dn)>=Ct*Kn?Dn:-function(da,pa,ga,Fa,ri,Za,Sa){var Ea,vs,Qs,Ri,Ln,qs,Xa,ai,di,yo,ii,On,Hi,za,Mi,tl,kl,Uo,qo=da-ri,hl=ga-ri,Xd=pa-Za,oi=Fa-Za;Ft[0]=(Mi=(ai=qo-(Xa=(qs=Xe*qo)-(qs-qo)))*(yo=oi-(di=(qs=Xe*oi)-(qs-oi)))-((za=qo*oi)-Xa*di-ai*di-Xa*yo))-((ii=Mi-(kl=(ai=Xd-(Xa=(qs=Xe*Xd)-(qs-Xd)))*(yo=hl-(di=(qs=Xe*hl)-(qs-hl)))-((tl=Xd*hl)-Xa*di-ai*di-Xa*yo)))+(Ln=Mi-ii))+(Ln-kl),Ft[1]=(Hi=za-((On=za+ii)-(Ln=On-za))+(ii-Ln))-((ii=Hi-tl)+(Ln=Hi-ii))+(Ln-tl),Ft[2]=On-((Uo=On+ii)-(Ln=Uo-On))+(ii-Ln),Ft[3]=Uo;var mo=function(mg,pc){for(var Sd=pc[0],Bu=1;Bu<4;Bu++)Sd+=pc[Bu];return Sd}(0,Ft),vo=Pt*Sa;if(mo>=vo||-mo>=vo||(Ea=da-(qo+(Ln=da-qo))+(Ln-ri),Qs=ga-(hl+(Ln=ga-hl))+(Ln-ri),vs=pa-(Xd+(Ln=pa-Xd))+(Ln-Za),Ri=Fa-(oi+(Ln=Fa-oi))+(Ln-Za),Ea===0&&vs===0&&Qs===0&&Ri===0)||(vo=Qt*Sa+xt*Math.abs(mo),(mo+=qo*Ri+oi*Ea-(Xd*Qs+hl*vs))>=vo||-mo>=vo))return mo;yr[0]=(Mi=(ai=Ea-(Xa=(qs=Xe*Ea)-(qs-Ea)))*(yo=oi-(di=(qs=Xe*oi)-(qs-oi)))-((za=Ea*oi)-Xa*di-ai*di-Xa*yo))-((ii=Mi-(kl=(ai=vs-(Xa=(qs=Xe*vs)-(qs-vs)))*(yo=hl-(di=(qs=Xe*hl)-(qs-hl)))-((tl=vs*hl)-Xa*di-ai*di-Xa*yo)))+(Ln=Mi-ii))+(Ln-kl),yr[1]=(Hi=za-((On=za+ii)-(Ln=On-za))+(ii-Ln))-((ii=Hi-tl)+(Ln=Hi-ii))+(Ln-tl),yr[2]=On-((Uo=On+ii)-(Ln=Uo-On))+(ii-Ln),yr[3]=Uo;var uu=mt(4,Ft,4,yr,nr);yr[0]=(Mi=(ai=qo-(Xa=(qs=Xe*qo)-(qs-qo)))*(yo=Ri-(di=(qs=Xe*Ri)-(qs-Ri)))-((za=qo*Ri)-Xa*di-ai*di-Xa*yo))-((ii=Mi-(kl=(ai=Xd-(Xa=(qs=Xe*Xd)-(qs-Xd)))*(yo=Qs-(di=(qs=Xe*Qs)-(qs-Qs)))-((tl=Xd*Qs)-Xa*di-ai*di-Xa*yo)))+(Ln=Mi-ii))+(Ln-kl),yr[1]=(Hi=za-((On=za+ii)-(Ln=On-za))+(ii-Ln))-((ii=Hi-tl)+(Ln=Hi-ii))+(Ln-tl),yr[2]=On-((Uo=On+ii)-(Ln=Uo-On))+(ii-Ln),yr[3]=Uo;var rl=mt(uu,nr,4,yr,dr);yr[0]=(Mi=(ai=Ea-(Xa=(qs=Xe*Ea)-(qs-Ea)))*(yo=Ri-(di=(qs=Xe*Ri)-(qs-Ri)))-((za=Ea*Ri)-Xa*di-ai*di-Xa*yo))-((ii=Mi-(kl=(ai=vs-(Xa=(qs=Xe*vs)-(qs-vs)))*(yo=Qs-(di=(qs=Xe*Qs)-(qs-Qs)))-((tl=vs*Qs)-Xa*di-ai*di-Xa*yo)))+(Ln=Mi-ii))+(Ln-kl),yr[1]=(Hi=za-((On=za+ii)-(Ln=On-za))+(ii-Ln))-((ii=Hi-tl)+(Ln=Hi-ii))+(Ln-tl),yr[2]=On-((Uo=On+ii)-(Ln=Uo-On))+(ii-Ln),yr[3]=Uo;var Vm=mt(rl,dr,4,yr,ur);return ur[Vm-1]}($r,Ur,wn,Nn,ls,ys,Kn)}(ft[0],ft[1],vt[0],vt[1],sr[0],sr[1]);return vr>0?-1:vr<0?1:0}function mr(ft,vt){var sr=ft.point,vr=vt.point;return sr[0]>vr[0]?1:sr[0]vr[1]?1:-1:function($r,Ur,wn,Nn){return $r.left!==Ur.left?$r.left?1:-1:_r(wn,$r.otherEvent.point,Ur.otherEvent.point)!==0?$r.isBelow(Ur.otherEvent.point)?-1:1:!$r.isSubject&&Ur.isSubject?1:-1}(ft,vt,sr)}function gr(ft,vt,sr){var vr=new Se(vt,!1,ft,ft.isSubject),$r=new Se(vt,!0,ft.otherEvent,ft.isSubject);return Fe(ft.point,ft.otherEvent.point)&&console.warn("what is that, a collapsed segment?",ft),vr.contourId=$r.contourId=ft.contourId,mr($r,ft.otherEvent)>0&&(ft.otherEvent.left=!0,$r.left=!1),ft.otherEvent.otherEvent=$r,ft.otherEvent=vr,sr.push($r),sr.push(vr),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 xr(ft,vt,sr){var vr=function(ls,ys,ws,Us,Dn){var Kn=[ys[0]-ls[0],ys[1]-ls[1]],da=[Us[0]-ws[0],Us[1]-ws[1]];function pa(qs,Xa,ai){return[qs[0]+Xa*ai[0],qs[1]+Xa*ai[1]]}var ga=[ws[0]-ls[0],ws[1]-ls[1]],Fa=rr(Kn,da),ri=Fa*Fa,Za=Jt(Kn,Kn);if(ri>0){var Sa=rr(ga,da)/Fa;if(Sa<0||Sa>1)return null;var Ea=rr(ga,Kn)/Fa;return Ea<0||Ea>1?null:Sa===0||Sa===1?[pa(ls,Sa,Kn)]:Ea===0||Ea===1?[pa(ws,Ea,da)]:[pa(ls,Sa,Kn)]}if((ri=(Fa=rr(ga,Kn))*Fa)>0)return null;var vs=Jt(Kn,ga)/Za,Qs=vs+Jt(Kn,da)/Za,Ri=Math.min(vs,Qs),Ln=Math.max(vs,Qs);return Ri<=1&&Ln>=0?Ri===1?[pa(ls,Ri>0?Ri:0,Kn)]:Ln===0?[pa(ls,Ln<1?Ln:1,Kn)]:[pa(ls,Ri>0?Ri:0,Kn),pa(ls,Ln<1?Ln:1,Kn)]:null}(ft.point,ft.otherEvent.point,vt.point,vt.otherEvent.point),$r=vr?vr.length:0;if($r===0||$r===1&&(Fe(ft.point,vt.point)||Fe(ft.otherEvent.point,vt.otherEvent.point))||$r===2&&ft.isSubject===vt.isSubject)return 0;if($r===1)return Fe(ft.point,vr[0])||Fe(ft.otherEvent.point,vr[0])||gr(ft,vr[0],sr),Fe(vt.point,vr[0])||Fe(vt.otherEvent.point,vr[0])||gr(vt,vr[0],sr),1;var Ur=[],wn=!1,Nn=!1;return Fe(ft.point,vt.point)?wn=!0:mr(ft,vt)===1?Ur.push(vt,ft):Ur.push(ft,vt),Fe(ft.otherEvent.point,vt.otherEvent.point)?Nn=!0:mr(ft.otherEvent,vt.otherEvent)===1?Ur.push(vt.otherEvent,ft.otherEvent):Ur.push(ft.otherEvent,vt.otherEvent),wn&&Nn||wn?(vt.type=L,ft.type=vt.inOut===ft.inOut?z:$,wn&&!Nn&&gr(Ur[1].otherEvent,Ur[0].point,sr),2):Nn?(gr(Ur[0],Ur[1].point,sr),3):Ur[0]!==Ur[3].otherEvent?(gr(Ur[0],Ur[1].point,sr),gr(Ur[1],Ur[2].point,sr),3):(gr(Ur[0],Ur[1].point,sr),gr(Ur[3].otherEvent,Ur[2].point,sr),3)}function Er(ft,vt){if(ft===vt)return 0;if(_r(ft.point,ft.otherEvent.point,vt.point)!==0||_r(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:mr(ft,vt)===1?1:-1}var jr=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function _n(ft,vt,sr,vr){var $r,Ur=ft+1,wn=vt[ft].point,Nn=vt.length;for(Urvr;)Ur--;return Ur}jr.prototype.isExterior=function(){return this.holeOf==null};var Hr=un,Jr=un;function un(ft,vt){if(!(this instanceof un))return new un(ft,vt);if(this.data=ft||[],this.length=this.data.length,this.compare=vt||js,this.length>0)for(var sr=(this.length>>1)-1;sr>=0;sr--)this._down(sr)}function js(ft,vt){return ftvt?1:0}un.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,vr=vt[ft];ft>0;){var $r=ft-1>>1,Ur=vt[$r];if(sr(vr,Ur)>=0)break;vt[ft]=Ur,ft=$r}vt[ft]=vr},_down:function(ft){for(var vt=this.data,sr=this.compare,vr=this.length>>1,$r=vt[ft];ft=0)break;vt[ft]=Nn,ft=Ur}vt[ft]=$r}},Hr.default=Jr;var kr=Math.max,mn=Math.min,Yn=0;function Ks(ft,vt,sr,vr,$r,Ur){var wn,Nn,ls,ys,ws,Us;for(wn=0,Nn=ft.length-1;wn0?Us.left=!0:ws.left=!0;var Dn=ls[0],Kn=ls[1];$r[0]=mn($r[0],Dn),$r[1]=mn($r[1],Kn),$r[2]=kr($r[2],Dn),$r[3]=kr($r[3],Kn),vr.push(ws),vr.push(Us)}}var Js=[];function hs(ft,vt,sr){typeof ft[0][0][0]=="number"&&(ft=[ft]),typeof vt[0][0][0]=="number"&&(vt=[vt]);var vr=function(Kn,da,pa){var ga=null;return Kn.length*da.length==0&&(pa===K?ga=Js:pa===ee?ga=Kn:pa!==Z&&pa!==re||(ga=Kn.length===0?da:Kn)),ga}(ft,vt,sr);if(vr)return vr===Js?null:vr;var $r=[1/0,1/0,-1/0,-1/0],Ur=[1/0,1/0,-1/0,-1/0],wn=function(Kn,da,pa,ga,Fa){var ri,Za,Sa,Ea,vs,Qs,Ri=new Hr(null,mr);for(Sa=0,Ea=Kn.length;Saga[2]||ga[0]>pa[2]||pa[1]>ga[3]||ga[1]>pa[3])&&(Fa===K?ri=Js:Fa===ee?ri=Kn:Fa!==Z&&Fa!==re||(ri=Kn.concat(da))),ri}(ft,vt,$r,Ur,sr))return vr===Js?null:vr;for(var Nn=function(Kn){var da,pa,ga=function(Sa){var Ea,vs,Qs,Ri,Ln=[];for(vs=0,Qs=Sa.length;vs0){var ii=qs[yo];if(ii.holeOf!=null){var On=ii.holeOf;qs[On].holeIds.push(Xa),ai.holeOf=On,ai.depth=qs[yo].depth}else qs[yo].holeIds.push(Xa),ai.holeOf=yo,ai.depth=qs[yo].depth+1}else ai.holeOf=null,ai.depth=qs[yo].depth}else ai.holeOf=null,ai.depth=0;return ai}(ga[da],ri,Sa),vs=function(Ln){Fa[Ln]=!0,Ln=ga.length)&&ga[Qs];);ri.push(Ea)}};for(da=0,pa=ga.length;daRi||ri===ee&&Ln.point[0]>ga[2])break;if(Ln.left){Sa=Za=vs.insert(Ln),Za=Za!==(Ea=vs.minNode())?vs.prev(Za):null,Sa=vs.next(Sa);var qs=Za?Za.key:null;if(ie(Ln,qs,ri),Sa&&xr(Ln,Sa.key,Kn)===2&&(ie(Ln,qs,ri),ie(Sa.key,Ln,ri)),Za&&xr(Za.key,Ln,Kn)===2){var Xa=Za;ie(qs,(Xa=Xa!==Ea?vs.prev(Xa):null)?Xa.key:null,ri),ie(Ln,qs,ri)}}else Sa=Za=vs.find(Ln=Ln.otherEvent),Za&&Sa&&(Za=Za!==Ea?vs.prev(Za):null,Sa=vs.next(Sa),vs.remove(Ln),Sa&&Za&&xr(Za.key,Sa.key,Kn))}return Qs}(wn,0,0,$r,Ur,sr)),ls=[],ys=0;ys * @license MIT * @preserve */function F6(f,c,h,g){const _=[],S=g===0?(C,L,z,$,K,Z)=>{C.push(new or(Z,z+(Z-L)/($-L)*(K-z)))}:(C,L,z,$,K,Z)=>{C.push(new or(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 ee=0;eec&&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 bHe(f,c){const h=Moe(f),g=Moe([c]),_=Dve.intersection(h,g);return _==null?[]:Rve(_)}function wHe(f,c){let g=Moe(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,ee=K-z,re=Math.hypot(Z,ee);if(re===0)continue;const ie=Math.trunc(ee/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=Dve.diff(g,_)),Rve(g,1/65536)}function Moe(f,c=1){return[f.map(h=>h.map(g=>[g.x*c,g.y*c]))]}function Rve(f,c=1){return f.map(h=>h.map((g,_)=>{const S=g.map(C=>new or(C[0]*c,C[1]*c).round());return _>0&&S.reverse(),S}))}class Toe{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 Xh(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,iHe.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,oHe.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 Aoe{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 Toe(c,!1),this.elevationBufferData=new Toe(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=Soe("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,ee=Rt(L,Z);if(!this.layers[0]._featureFilter.filter(new ci(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),ee,g))continue;const re=S?S.evaluate(ee,{},g,h.availableImages):void 0,ie={id:z,properties:L.properties,type:L.type,sourceLayerIndex:K,index:$,geometry:Z?ee.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=Coe("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 $=uM(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=Ta.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 ee=0;c.properties.hasOwnProperty(Kt)&&(ee=+c.properties[Kt]);for(const re of $.polygons)this.elevatedStructures.addPortalCandidates($.elevationFeature.id,re,Z,$.elevationFeature,ee)}$.elevationFeature.constantHeight==null&&($.polygons=this.prepareElevatedPolygons($.polygons,$.elevationFeature,$.elevationTileID));const K=new Va(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,ee=[],re=[],ie=[],ge=[],Se=[],Ne=h.layoutVertexArray.length;for(const Ue of z){if(Ue.length===0)continue;Ue!==z[0]&&re.push(ee.length/2);const Xe=h.lineSegments.prepareSegment(Ue.length,h.layoutVertexArray,h.lineIndexArray),xt=Xe.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),ee.push(Ue[0].x),ee.push(Ue[0].y);for(let mt=1;mt0&&g&&this.elevationMode==="hd-road-base"){const Ue=g.elevation.isTunnel(),Xe=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(ee)}if(z.length===c.length)return c;const K=[new or(g,_),new or(S,_),new or(S,C),new or(g,C),new or(g,_)],Z=z;for(const ee of $)Z.push(...bHe(ee,K));return Z}}let Fve,zve,Bve,$ve;sn(Aoe,"FillBucket",{omit:["layers","patternFeatures"]}),sn(Toe,"FillBufferData"),sn(Fu,"ElevatedStructures");class z6{constructor(c,h,g,_){if(this.triangleCount=h.length/3,this.min=new or(0,0),this.max=new or(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-ee.cellIdx||Z.triIdx-ee.triIdx);let K=0;for(;K<$.length;){const Z=$[K].cellIdx,ee={start:this.payload.length,len:0};for(;K<$.length&&$[K].cellIdx===Z;)++ee.len,this.payload.push($[K++].triIdx);this.cells[Z]=ee}}_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 ci(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),Z,g))continue;const ee={id:L,properties:C.properties,type:C.type,sourceLayerIndex:$,index:z,geometry:K?Z.geometry:St(C,g,_),patterns:{}};S.push(ee)}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 uM(h,2)){const $=[],K=[],Z=[],ee=new or(1/0,1/0),re=new or(-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 B6(f,c){return f.x-c.x||f.y-c.y}function Hve(f,c){return B6(f.min,c.min)===0&&B6(f.max,c.max)===0}function Eoe(f,c){return!(f.min.x>c.max.x||f.max.xc.max.y||f.max.ynew or((z.x+S.x*Ar)*L-C.x*Ar,(z.y+S.y*Ar)*L-C.y*Ar))}return Ioe(h,_,f.indices,0,f.indices.length,0,0)}function Kve(f,c,h,g){const _=Math.pow(2,g.z-h.z);return new or((f+h.x*Ar)*_-g.x*Ar,(c+h.y*Ar)*_-g.y*Ar)}function Zve(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 Loe=Dt.types,IHe=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],PHe=["fill-extrusion-flood-light-ground-radius"],LHe=Math.pow(2,13),OHe=Math.pow(2,15)-1,Xve=new or(0,1),Ax=2147483648,Qve=7,Jve=450;function mM(f,c,h,g,_,S,C,L){f.emplaceBack((c<<1)+C,(h<<1)+S,(Math.floor(g*LHe)<<1)+_,Math.round(L))}function fM(f,c,h){f.emplaceBack(c.x*Ar,c.y*Ar,h?1:0)}function U6(f,c,h,g,_,S){f.emplaceBack(c.x,c.y,(h.x<<1)+g,(h.y<<1)+_,S)}function pM(f,c,h){f.emplaceBack(c.x,c.y,c.z,h[0]*16384,h[1]*16384,h[2]*16384)}class e_e{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class t_e{constructor(){this.centroidXY=new or(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 or(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new or(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new or(this.max.x-this.min.x,this.max.y-this.min.y)}}class r_e{constructor(){this.acc=new or(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===Ar)&&h.x===g.x)!=((h.y===0||h.y===Ar)&&h.y===g.y)&&this.processBorderOverlap(h,g),_&&this.checkBorderIntersection(h,g)}checkBorderIntersection(c,h){h.x<0!=c.x<0&&this.addBorderIntersection(0,$n(h.y,c.y,(0-h.x)/(c.x-h.x))),h.x>Ar!=c.x>Ar&&this.addBorderIntersection(1,$n(h.y,c.y,(Ar-h.x)/(c.x-h.x))),h.y<0!=c.y<0&&this.addBorderIntersection(2,$n(h.x,c.x,(0-h.y)/(c.y-h.y))),h.y>Ar!=c.y>Ar&&this.addBorderIntersection(3,$n(h.x,c.x,(Ar-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 or(0,0):new or(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 n_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*OHe*((S=f).x*(C=c).y-S.y*C.x<0?-1:1)}const DHe=[f=>f.x<0,f=>f.x>Ar,f=>f.y<0,f=>f.y>Ar];function RHe(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(DHe[z]($)){_.push(z);break}return _}class Ooe{constructor(c){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new $5,this.indexArray=new Qo,this.programConfigurations=new Xh(c.layers,{zoom:c.zoom,lut:c.lut},h=>PHe.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=n_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,kHe.members),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.groundRadiusArray!=null&&(this.groundRadiusBuffer=c.createVertexBuffer(this.groundRadiusArray,NHe.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,MHe.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 q6{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 _0,this.centroidVertexArray=new A6,this.wallVertexArray=new o_,this.indexArray=new Qo,this.programConfigurations=new Xh(c.layers,{zoom:c.zoom,lut:c.lut},h=>IHe.includes(h)),this.segments=new Ui,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.groundEffect=new Ooe(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=Soe("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 ci(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:{}},ee=this.layoutVertexArray.length,re=Loe[Z.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:S.id,feature:Coe("fill-extrusion",this.layers,Z,this.zoom,this.pixelRatio,h)});else if(this.wallMode)for(const ie of Z.geometry)for(const ge of Yve(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,ee)}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 $=Loe[z.type]==="Polygon",{geometry:K}=z;if(this.wallMode)for(const Z of K)for(const ee of Yve(Z,$))this.addFeature(L,z,[ee],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,AHe),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.wallVertexBuffer=c.createVertexBuffer(this.wallVertexArray,CHe.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=c.createVertexBuffer(this.layoutVertexExtArray,THe.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,SHe.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 or(0,0),new or(Ar,Ar)],ee=z.projection,re=ee.name==="globe",ie=this.wallMode||Loe[h.type]==="Polygon",ge=new r_e;ge.centroidDataIndex=this.centroidData.length;const Se=new t_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 un=0;const js=Jr.length;for(let kr=0;kr=0})(Ft)||(Ft=Ft.reverse());const ur={geometry:[],joinNormals:[],indices:[]},yr=[],_r=[],mr=[];let gr=Ft.length;for(;gr>=2&&Ft[gr-1].equals(Ft[gr-2]);)gr--;if(gr<(nr?3:2))return ur;let rr,Jt,xr,Er,jr,_n=0;for(;_n0;let Yn="miter";const Ks=2;Yn==="miter"&&kr>Ks&&(Yn="bevel"),Yn==="bevel"&&(kr>100&&(Yn="flipbevel"),kr{const sr=new or(hs.x,hs.y),vr=new or(hs.x,hs.y);sr.x+=Ka.x*vt,sr.y+=Ka.y*vt,vr.x-=Ka.x*Math.max(ft,1),vr.y-=Ka.y*Math.max(ft,1),mr.push(Ka),yr.push(sr),_r.push(vr)};if(Yn==="miter")un._mult(kr),Js(rr,un,0,0);else if(Yn==="flipbevel")un=jr.mult(-1),Js(rr,un,0,0),Js(rr,un.mult(-1),0,0);else{const hs=-Math.sqrt(kr*kr-1),Ka=mn?hs:0,ft=mn?0:hs;Jt&&Js(rr,Er,Ka,ft),xr&&Js(rr,jr,Ka,ft)}}ur.geometry=[...yr,..._r.reverse(),yr[0]],ur.joinNormals=[...mr,...mr.reverse(),mr[mr.length-1]];const Hr=ur.geometry.length-1;for(let Jr=0;Jr
Ft<(nr.length-1)/2||Ft===nr.length-1,xt=this.wallMode?[g]:uM(g,500);for(let Ft=xt.length-1;Ft>=0;Ft--){const nr=xt[Ft];(nr.length===0||(mt=nr[0]).every(dr=>dr.x<=0)||mt.every(dr=>dr.x>=Ar)||mt.every(dr=>dr.y<=0)||mt.every(dr=>dr.y>=Ar))&&xt.splice(Ft,1)}var mt;let wt;if(re)wt=d_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 dr=Ft[Ft.length-1];return nr.x===dr.x&&nr.y===dr.y};for(const{polygon:Ft,bounds:nr}of wt){let dr=0,ur=0;for(const gr of Ft)ie&&!gr[0].equals(gr[gr.length-1])&&gr.push(gr[0]),ur+=ie?gr.length-1:gr.length;const yr=this.segments.prepareSegment((ie?5:4)*ur,this.layoutVertexArray,this.indexArray);Se.footprintSegIdx<0&&(Se.footprintSegIdx=this.footprintSegments.length),Se.polygonSegIdx<0&&(Se.polygonSegIdx=this.polygonSegments.length);const _r={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},mr=new e_e;if(mr.vertexOffset=this.footprintVertices.length,mr.indexOffset=3*this.footprintIndices.length,mr.ringIndices=[],ie){const gr=[],rr=[];dr=yr.vertexLength;for(let xr=0;xr4&&o_e(rr[rr.length-2],rr[0],rr[1]),xr=Ct?FHe(rr[rr.length-2],rr[0],rr[1],Ct):0;const Er=[];let jr,_n,Hr;_n=rr[1].sub(rr[0])._perp()._unit();let Jr=!0;for(let un=1,js=0;un0?1:0,Ka=kr.dist(mn);if(js+Ka>32768&&(js=0),Ct){Hr=Yn.sub(mn)._perp()._unit();let vr=a_e(kr,mn,Yn,s_e(_n,Hr),Ct);isNaN(vr)&&(vr=0);const $r=mn.sub(kr)._unit();kr=kr.add($r.mult(xr))._round(),mn=mn.add($r.mult(-vr))._round(),xr=vr,_n=Hr,Ne&&this.zoom>=17&&(Qt(Er,kr)||Er.push(kr),Qt(Er,mn)||Er.push(mn))}const ft=yr.vertexLength,vt=rr.length>4&&o_e(kr,mn,Yn);let sr=l_e(js,Jt,Jr);if(mM(this.layoutVertexArray,kr.x,kr.y,Js,hs,0,0,sr),mM(this.layoutVertexArray,kr.x,kr.y,Js,hs,0,1,sr),this.wallMode){const vr=Xe(un-1,rr),$r=Ue.joinNormals[un-1];fM(this.wallVertexArray,$r,vr),fM(this.wallVertexArray,$r,vr)}if(js+=Ka,sr=l_e(js,vt,!Jr),Jt=vt,mM(this.layoutVertexArray,mn.x,mn.y,Js,hs,0,0,sr),mM(this.layoutVertexArray,mn.x,mn.y,Js,hs,0,1,sr),this.wallMode){const vr=Xe(un,rr),$r=Ue.joinNormals[un];fM(this.wallVertexArray,$r,vr),fM(this.wallVertexArray,$r,vr)}if(yr.vertexLength+=4,this.indexArray.emplaceBack(ft+0,ft+1,ft+2),this.indexArray.emplaceBack(ft+1,ft+3,ft+2),yr.primitiveLength+=2,Ct){const vr=dr+(un===1?rr.length-2:un-2),$r=un===1?dr:vr+1;if(this.indexArray.emplaceBack(ft+1,vr,ft+3),this.indexArray.emplaceBack(vr,$r,ft+3),yr.primitiveLength+=2,jr===void 0&&(jr=ft),!Doe(Yn,rr[un],nr)){const Ur=un===rr.length-1?jr:yr.vertexLength;this.indexArray.emplaceBack(ft+2,ft+3,Ur),this.indexArray.emplaceBack(ft+3,Ur+1,Ur),this.indexArray.emplaceBack(ft+3,$r,Ur+1),yr.primitiveLength+=3}Jr=!Jr}if(re){const vr=this.layoutVertexExtArray,$r=ee.projectTilePoint(kr.x,kr.y,S),Ur=ee.projectTilePoint(mn.x,mn.y,S),wn=ee.upVector(S,kr.x,kr.y),Nn=ee.upVector(S,mn.x,mn.y);pM(vr,$r,wn),pM(vr,$r,wn),pM(vr,Ur,Nn),pM(vr,Ur,Nn)}}ie&&(dr+=rr.length-1),Ne&&Ct&&this.zoom>=17&&(Er.length!==0&&Qt(Er,Er[0])&&Er.pop(),this.groundEffect.addData(Er,nr,K,Ct>0))}this.footprintSegments.push(mr),_r.triangleCount=this.indexArray.length-_r.triangleArrayOffset,this.polygonSegments.push(_r),++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?Xve: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;LAr),K=2*$+(+(z.min.x+z.max.x>Ar)^$);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:ee}),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/Ar,re[1]=ge.min.y/Ar,ie[0]=ge.max.x/Ar,ie[1]=ge.max.y/Ar;const Se=ee(K,Z,re),Ne=ee(K,Z,ie);if(new yn([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 or(ye(g.x,1,Ar-1)<<3|S,ye(g.y,1,Ar-1)<<3|C)}encodeBorderCentroid(c){if(!c.borders)return new or(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 or(6|(h[0][0]!==g?0:65528),(h[_][0]+h[_][1])/2<<3|6)}{const _=h[2][0]!==g?2:3;return new or((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?Xve: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-ee)/(re-ee)+Z&&(_=!_)}L=z}}return _}getHeightAtTileCoord(c,h){let g=Number.NEGATIVE_INFINITY,_=!0;const S=4*(c+Ar)*Ar+(h+Ar);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 s_e(f,c){const h=f.add(c)._unit();return f.x*h.x+f.y*h.y}function FHe(f,c,h,g){const _=c.sub(f)._perp()._unit(),S=h.sub(c)._perp()._unit();return a_e(f,c,h,s_e(_,S),g)}function a_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 Doe(f,c,h){return f.xh[1].x&&c.x>h[1].x||f.yh[1].y&&c.y>h[1].y}function i_e(f,c){return f.xc[1].x||f.yc[1].y}function o_e(f,c,h){if(f.x<0||f.x>=Ar||c.x<0||c.x>=Ar||h.x<0||h.x>=Ar)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 l_e(f,c,h){const g=c?2|f:-3&f;return h?1|g:-2&g}function c_e(){const f=Math.PI/32,c=Math.tan(f),h=w;return h*Math.sqrt(1+2*c*c)-h}function d_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:ur,bounds:_r,depth:wt+1}):ge(ur,_r)}if(yr.length){const _r=[new or(Ct===0?dr:Pt.x,Ct===1?dr:Pt.y),Qt];Ue.length>wt+1?xt.push({polygons:yr,bounds:_r,depth:wt+1}):ge(yr,_r)}}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=ue((h.y+$/Ar)/g);return(H(.5*(ue((h.y+K/Ar)/g)+Z))*g-h.y)*Ar}})}function zHe(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]>_&&f_e(L,z,C,_),L[C]S&&f_e(z,L,C,S)}}function V6(f,c,h,g,_,S){const C=[];for(let L=0;L=g&&ie.x>=g||(re.x>=g?re=new or(g,re.y+(g-re.x)/(ie.x-re.x)*(ie.y-re.y))._round():ie.x>=g&&(ie=new or(g,re.y+(g-re.x)/(ie.x-re.x)*(ie.y-re.y))._round()),re.y>=_&&ie.y>=_||(re.y>=_?re=new or(re.x+(_-re.y)/(ie.y-re.y)*(ie.x-re.x),_)._round():ie.y>=_&&(ie=new or(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+g_e(Ne,Fe,re)*ge,max:1},parentIndex:L,prevPoint:Ne,nextPoint:Fe})),$.push(ie),S&&(S[S.length-1].progress.max=Se+g_e(Ne,Fe,ie)*ge,S[S.length-1].nextPoint=Fe)))))}if(S&&Z>0)for(let ee=K;ee$.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 g_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 gM(f,c){return f.x*c.x+f.y*c.y}function x_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{dr[0]=ur,dr[1]=yr,dr[2]=_r,dr[3]=1},nr=c_e();re>0&&(re+=nr),ie+=nr;for(const dr of ee){const ur=[],yr=[];for(const _r of dr){const mr=_r.x+ge.x,gr=_r.y+ge.y,rr=Z.projection.projectTilePoint(mr,gr,xt),Jt=Z.projection.upVector(xt,_r.x,_r.y);let xr=re,Er=ie;if(Ne){const jr=__e(mr,gr,re,ie,Ne,Fe,Ue,Xe);xr+=jr.base,Er+=jr.top}re!==0?Ft(Pt,rr.x+Jt[0]*Ct*xr,rr.y+Jt[1]*Ct*xr,rr.z+Jt[2]*Ct*xr):Ft(Pt,rr.x,rr.y,rr.z),Ft(Qt,rr.x+Jt[0]*Ct*Er,rr.y+Jt[1]*Ct*Er,rr.z+Jt[2]*Ct*Er),at(Pt,Pt,Se),at(Qt,Qt,Se),ur.push(new x_(Pt[0],Pt[1],Pt[2])),yr.push(new x_(Qt[0],Qt[1],Qt[2]))}mt.push(ur),wt.push(yr)}return[mt,wt]}(f,c,h,g,_,S,C,L,z,$,K):C?function(Z,ee,re,ie,ge,Se,Ne,Fe,Ue){const Xe=[],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,dr=__e(Ft,nr,ee,re,Se,Ne,Fe,Ue);mt[0]=Ft,mt[1]=nr,mt[2]=dr.base,mt[3]=1,Ke(mt,mt,ge),mt[3]=Math.max(mt[3],1e-5);const ur=new x_(mt[0]/mt[3],mt[1]/mt[3],mt[2]/mt[3]);mt[0]=Ft,mt[1]=nr,mt[2]=dr.top,mt[3]=1,Ke(mt,mt,ge),mt[3]=Math.max(mt[3],1e-5);const yr=new x_(mt[0]/mt[3],mt[1]/mt[3],mt[2]/mt[3]);Ct.push(ur),Pt.push(yr)}Xe.push(Ct),xt.push(Pt)}return[Xe,xt]}(c,h,g,_,S,C,L,z,$):function(Z,ee,re,ie,ge){const Se=[],Ne=[],Fe=ge[8]*ee,Ue=ge[9]*ee,Xe=ge[10]*ee,xt=ge[11]*ee,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 dr of Qt){const ur=dr.x+ie.x,yr=dr.y+ie.y,_r=ge[0]*ur+ge[4]*yr+ge[12],mr=ge[1]*ur+ge[5]*yr+ge[13],gr=ge[2]*ur+ge[6]*yr+ge[14],rr=ge[3]*ur+ge[7]*yr+ge[15],Jt=_r+Fe,xr=mr+Ue,Er=gr+Xe,jr=Math.max(rr+xt,1e-5),_n=_r+mt,Hr=mr+wt,Jr=gr+Ct,un=Math.max(rr+Pt,1e-5);Ft.push(new x_(Jt/jr,xr/jr,Er/jr)),nr.push(new x_(_n/un,Hr/un,Jr/un))}Se.push(Ft),Ne.push(nr)}return[Se,Ne]}(c,h,g,_,S)}function __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]/Qve-Jve):C*function(Z,ee,re){const ie=Math.floor(ee[0]/8),ge=Math.floor(ee[1]/8),Se=10*(ee[0]-8*ie),Ne=10*(ee[1]-8*ge),Fe=Z.getElevationAt(ie,ge,!0,!0),Ue=Z.getMeterToDEM(re),Xe=Math.floor(.5*(Se*Ue-1)),xt=Math.floor(.5*(Ne*Ue-1)),mt=Z.tileCoordToPixel(ie,ge),wt=2*Xe+1,Ct=2*xt+1,Pt=function(yr,_r,mr,gr,rr){return[yr.getElevationAtPixel(_r,mr,!0),yr.getElevationAtPixel(_r+rr,mr,!0),yr.getElevationAtPixel(_r,mr+rr,!0),yr.getElevationAtPixel(_r+gr,mr+rr,!0)]}(Z,mt.x-Xe,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]),dr=Math.min(.25,.5*Ue*(Qt+Ft)/wt),ur=Math.min(.25,.5*Ue*nr/Ct);return Fe+Math.max(dr*Se,ur*Ne)}(_,S,L):z;return{base:z+(h===0?-1:h),top:$?Math.max(K+g,z+h+2):z+g}}class $He{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 UHe{constructor(){this.tasks={},this.taskQueue=[],Lt(["process"],this),this.invoker=new $He(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 xM={workerUrl:"",workerClass:null,workerParams:void 0};const Roe="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[Roe]}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 yM,Foe;function H6(){return yM||(yM=new y_),yM}QN.Actor=b_e;const zoe=4096;class qHe{constructor(c){this.module=c,this.memoryStack=this.module.malloc(zoe),this.memoryStackNextFree=this.memoryStack}createIntArray(c){const h=this.memoryStackNextFree;return this.memoryStackNextFree+=c.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>zoe?-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>zoe?-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 T_e(f,c){const h=f.json.bufferViews[c];return new Uint8Array(f.buffers[h.buffer],h.byteOffset||0,h.byteLength)}function ZHe(f,c,h,g){if(f.uri){const _=M_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 _=T_e(c,f.bufferView),S=new Blob([_],{type:f.mimeType});return createImageBitmap(S).then(C=>{c.images[h]=C})}}function A_e(f,c=0,h){const g={json:null,images:[],buffers:[]};if(new Uint32Array(f,c,1)[0]===S_e){const K=new Uint32Array(f,c);let Z=2;const ee=(K[Z++]>>2)-3,re=K[Z++]>>2;if(Z++,g.json=JSON.parse(C_e.decode(K.subarray(Z,Z+re))),Z+=re,Z{const K=[],Z=L&&L.includes(Uoe),ee=L&&L.includes(K6);if(Z&&K.push(function(){if(!Gf)return vM??(vM=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,Xe,xt){return ie.copyWithin(Ue,Xe,Xe+xt)},c:function(Ue){const Xe=ie.length,xt=Math.max(Ue>>>0,Math.ceil(1.2*Xe)),mt=Math.ceil((xt-Xe)/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:Xe,Qb:xt,P:mt,T:wt,X:Ct,Ja:Pt,La:Qt,Qa:Ft,Va:nr,Wa:dr,eb:ur,jb:yr,f:_r,e:mr,yb:gr,zb:rr,Ab:Jt,Bb:xr,Db:Er,Gb:jr}=Ue.instance.exports;ge=mr;const _n=(()=>{let Hr=0,Jr=0,un=0,js=0;return kr=>{un&&(Xe(js),Xe(Hr),Jr+=un,un=Hr=0),Hr||(Jr+=128,Hr=xt(Jr));const mn=kr.length+7&-8;let Yn=Hr;mn>=Jr&&(un=mn,Yn=js=xt(mn));for(let Ks=0;Ks{Gf=re,vM=void 0}))}()),ee&&K.push(function(){if($oe)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,Xe,xt,mt,wt,Ct){(function(Pt,Qt,Ft,nr,dr,ur,yr){const _r=Pt.exports.sbrk,mr=nr+3&-4,gr=_r(mr*dr),rr=_r(ur.length),Jt=new Uint8Array(Pt.exports.memory.buffer);Jt.set(ur,rr);const xr=Qt(gr,nr,dr,rr,ur.length);if(xr===0&&yr&&yr(gr,mr,dr),Ft.set(Jt.subarray(gr,gr+nr*dr)),_r(gr-_r(0)),xr!==0)throw new Error(`Malformed buffer data: ${xr}`)})(ge,ge.exports[Fe[wt]],Ue,Xe,xt,mt,ge.exports[Ne[Ct]])}}}(fetch(k_e()));return re.ready.then(()=>{$oe=re})}()),S)for(let re=0;re{if(Z&&C)for(const{primitives:re}of C)for(const ie of re)WHe(ie,g);if(ee&&C&&z)for(const re of z)GHe(re,g);return g})})}function E_e(f){return fetch(f).then(c=>c.arrayBuffer()).then(c=>A_e(c,0,f))}function qoe(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 Voe(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 Hoe{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 ee=this.useMipmap?Math.floor(Math.log2(Math.max($,K)))+1:1;C.texStorage2D(C.TEXTURE_2D,ee,this.format,$,K),this.size=[$,K]}this.size&&(Z?C.texSubImage2D(C.TEXTURE_2D,0,L,z,qoe(this.format),Voe(this.format),c):"data"in c&&c.data&&C.texSubImage2D(C.TEXTURE_2D,0,L,z,g,_,qoe(this.format),Voe(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 bM{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 YHe=$s([{name:"a_pos_3f",components:3,type:"Float32"}]),XHe=$s([{name:"a_color_3f",components:3,type:"Float32"}]),QHe=$s([{name:"a_color_4f",components:4,type:"Float32"}]),JHe=$s([{name:"a_uv_2f",components:2,type:"Float32"}]),eWe=$s([{name:"a_normal_3f",components:3,type:"Float32"}]),tWe=$s([{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"}]),rWe=$s([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function I_e(f,c){const h=Z6(f.projection,f.zoom,f.width,f.height),g=function(S,C,L,z,$){const K=new p(L.lng-180*A0,L.lat),Z=new p(L.lng+180*A0,L.lat),ee=S.project(K.lng,K.lat),re=S.project(Z.lng,Z.lat),ie=-Math.atan2(re.y-ee.y,re.x-ee.x),ge=We.fromLngLat(L);ge.y=ye(ge.y,-1+A0,1-A0);const Se=ge.toLngLat(),Ne=S.project(Se.lng,Se.lat),Fe=We.fromLngLat(Se);Fe.x+=A0;const Ue=Fe.toLngLat(),Xe=S.project(Ue.lng,Ue.lat),xt=L_e(Xe.x-Ne.x,Xe.y-Ne.y,ie),mt=We.fromLngLat(Se);mt.y+=A0;const wt=mt.toLngLat(),Ct=S.project(wt.lng,wt.lat),Pt=L_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),_=P_e(f);return F(g,g,[_,_,1]),g}function P_e(f){const c=f.projection,h=Z6(f.projection,f.zoom,f.width,f.height),g=Woe(c,f.center),_=Woe(c,p.convert(c.center));return Math.pow(2,g*h+(1-h)*_)}function Z6(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 A0=1/4e4;function Woe(f,c){const h=ye(c.lat,-fe,fe),g=new p(c.lng-180*A0,h),_=new p(c.lng+180*A0,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,ee=z.y-L.y,re=Math.sqrt((Z*Z+ee*ee)/($*$+K*K));return Math.log2(re)}function L_e(f,c,h){const g=Math.cos(h),_=Math.sin(h);return{x:f*g-c*_,y:f*_+c*g}}function O_e(f,c,h){M(f),V(f,f,Hn(c[2])),D(f,f,Hn(c[0])),U(f,f,Hn(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 Y6(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(pe(z)<1e-12||pe($)<1e-12)return ct(f);const K=At([],z,$);Ve(K,K),xe($,g,c),z[2]=(S-_)*L,$[2]=(C-_)*L;const Z=z;return At(Z,z,$),Ve(Z,Z),rn(f,K,Z)}function X6(f,c,h=!1){const g=M0(c.zoom),_=function(S,C,L){const z=C.worldSize,$=[S[12],S[13],S[14]],K=ue($[1]/z),Z=te($[0]/z),ee=M([]),re=J(1,K)*z,ie=J(1,0)*z*_e(K,C.zoom),ge=1/boe(z);let Se=ie*ge;if(L){const Xe=Z6(C.projection,C.zoom,C.width,C.height,1024);Se=ge*C.projection.pixelSpaceConversion(C.center.lat,z,Xe)}const Ne=N0(K,Z);he(Ne,Ne,ve([],Ve([],Ne),re*Se*$[2]));const Fe=function(Xe){const xt=[Xe[0],Xe[1],Xe[2]];let mt=[0,1,0];const wt=At([],mt,xt);return At(mt,xt,wt),$e(mt)===0&&(mt=[0,1,0],At(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,Xe[0],Xe[1],Xe[2],1]}(Ne);F(ee,ee,[Se,Se,Se*re]),P(ee,ee,[-$[0],-$[1],-$[2]]);const Ue=T([],C.globeMatrix,Fe);return T(Ue,Ue,ee),T(Ue,Ue,S),Ue}(f,c,h);if(g>0){const S=function(C,L){const z=L.worldSize,$=J(1,0)*z*_e(L.center.lat,L.zoom)/boe(z),K=J(1,L.center.lat)*z,Z=M([]);U(Z,Z,Hn(L.center.lng)),D(Z,Z,Hn(L.center.lat)),P(Z,Z,[0,0,Pc]),F(Z,Z,[$,$,$*K]);const ee=L.point;return P(Z,Z,[-ee.x,-ee.y,0]),T(Z,Z,C),T(Z,L.globeMatrix,Z)}(f,c);return function(C,L,z){const $=(ie,ge,Se)=>{const Ne=pe(ie),Fe=pe(ge),Ue=Wf(ie,ge,Se);return ve(Ue,Ue,1/pe(Ue)*$n(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),ee=$([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,ee[0],ee[1],ee[2],0,re[0],re[1],re[2],1]}(_,S,g)}return _}function Goe(f,c,h,g){const _=yn.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 Q6(f,c,h,g,_,S,C,L,z,$=!1){const K=h.zoom,Z=h.project(g),ee=_e(g.lat,K),re=1/ee;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 Xe=0;h.elevation&&(Xe=h.elevation.getAtPointOrZero(new We(Z.x/Se,Z.y/Se),0));const xt=Ke([],[Z.x,Z.y,Xe,1],h.projMatrix)[3]/h.cameraToCenterDistance;ie=xt,ge=xt*_e(h.center.lat,K)}else if(h.projection.name==="globe"){const Xe=X6(f,h),xt=[0,0,0,1];Ke(xt,xt,T([],h.projMatrix,Xe));const mt=xt[3]/h.cameraToCenterDistance,wt=M0(K),Ct=h.projection.pixelsPerMeter(g.lat,Se)*_e(g.lat,K),Pt=h.projection.pixelsPerMeter(h.center.lat,Se)*_e(h.center.lat,K);ie=mt/$n(Ct,ke(h.center.lat),wt),ge=mt*ee/Ct,ie*=Pt,ge*=Pt}}else ie=re;F(f,f,[ie,ie,ge]);const Ne=[...f],Fe=c.orientation,Ue=[];if(O_e(Ue,[Fe[0]+(_?_[0]:0),Fe[1]+(_?_[1]:0),Fe[2]+(_?_[2]:0)],S),T(f,Ne,Ue),L&&h.elevation){let Xe=0;const xt=[];if(z&&h.elevation){Xe=function(wt,Ct,Pt,Qt,Ft){const nr=Ct.elevation;if(!nr)return 0;const dr=yn.projectAabbCorners(Pt,Qt),ur=J(1,Ft.lat)*Ct.worldSize,yr=function(Jr,un){const js=[0,0,1],kr=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const mn of kr){const Yn=Jr[mn.corners[0]],Ks=Jr[mn.corners[1]],Js=Jr[mn.corners[2]],hs=[Ks[0]-Yn[0],Ks[1]-Yn[1],un*(Ks[2]-Yn[2])],Ka=At(hs,hs,[Js[0]-Yn[0],Js[1]-Yn[1],un*(Js[2]-Yn[2])]);Ve(Ka,Ka),mn.dotProductWithUp=ot(Ka,js)}return kr.sort((mn,Yn)=>mn.dotProductWithUp-Yn.dotProductWithUp),kr[0].corners}(dr,ur),_r=dr[yr[0]],mr=dr[yr[1]],gr=dr[yr[2]],rr=dr[yr[3]],Jt=nr.getAtPointOrZero(new We(_r[0]/Ct.worldSize,_r[1]/Ct.worldSize),0),xr=nr.getAtPointOrZero(new We(mr[0]/Ct.worldSize,mr[1]/Ct.worldSize),0),Er=nr.getAtPointOrZero(new We(gr[0]/Ct.worldSize,gr[1]/Ct.worldSize),0),jr=nr.getAtPointOrZero(new We(rr[0]/Ct.worldSize,rr[1]/Ct.worldSize),0),_n=(Jt+jr)/2,Hr=(xr+Er)/2;return _n>Hr?xr=c.gl.NEAREST_MIPMAP_NEAREST}),f.uploaded=!0,f.image=null)}function nWe(f,c,h){f.indexBuffer=c.createIndexBuffer(f.indexArray,!1,!0),f.vertexBuffer=c.createVertexBuffer(f.vertexArray,YHe.members,!1,!0),f.normalArray&&(f.normalBuffer=c.createVertexBuffer(f.normalArray,eWe.members,!1,!0)),f.texcoordArray&&(f.texcoordBuffer=c.createVertexBuffer(f.texcoordArray,JHe.members,!1,!0)),f.colorArray&&(f.colorBuffer=c.createVertexBuffer(f.colorArray,(f.colorArray.bytesPerElement===12?XHe:QHe).members,!1,!0)),f.featureArray&&(f.pbrBuffer=c.createVertexBuffer(f.featureArray,rWe.members,!0)),f.segments=Ui.simpleSegment(0,0,f.vertexArray.length,f.indexArray.length);const g=f.material;g.pbrMetallicRoughness.baseColorTexture&&wM(g.pbrMetallicRoughness.baseColorTexture,c),g.pbrMetallicRoughness.metallicRoughnessTexture&&wM(g.pbrMetallicRoughness.metallicRoughnessTexture,c),g.normalTexture&&wM(g.normalTexture,c),g.occlusionTexture&&wM(g.occlusionTexture,c,h),g.emissionTexture&&wM(g.emissionTexture,c)}function Koe(f,c,h){if(f.meshes)for(const g of f.meshes)nWe(g,c,h);if(f.children)for(const g of f.children)Koe(g,c,h)}function J6(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)J6(c)}function Zoe(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)Zoe(h)}function __(f,c){const h=f.json.bufferViews[c.bufferView],g=G6[c.componentType];return new g(f.buffers[h.buffer],(c.byteOffset||0)+(h.byteOffset||0),c.count*(h.byteStride&&h.byteStride!==_M[c.type]*g.BYTES_PER_ELEMENT?h.byteStride/g.BYTES_PER_ELEMENT:_M[c.type]))}function Yoe(f,c,h,g){const _=G6[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:_M[c.type],z=h.float32,$=z.length/h.capacity;for(let K=0,Z=0;K0){for(let Se=0;Se0){S.texcoordArray=new Bm;const ee=c.json.accessors[_.TEXCOORD_0];S.texcoordArray.resize(ee.count);const re=__(c,ee);Yoe(c,ee,S.texcoordArray,re)}if(_._FEATURE_ID_RGBA4444!==void 0){const ee=c.json.accessors[_._FEATURE_ID_RGBA4444];c.json.extensionsUsed&&c.json.extensionsUsed.includes("EXT_meshopt_compression")&&(S.featureData=__(c,ee))}_._FEATURE_RGBA4444!==void 0&&(S.featureData=new Uint32Array(__(c,c.json.accessors[_._FEATURE_RGBA4444]).buffer));const Z=f.material;return S.material=function(ee,re){const{emissiveFactor:ie=[0,0,0],alphaMode:ge="OPAQUE",alphaCutoff:Se=.5,normalTexture:Ne,occlusionTexture:Fe,emissiveTexture:Ue,doubleSided:Xe,name:xt}=ee,{baseColorFactor:mt=[1,1,1,1],metallicFactor:wt=1,roughnessFactor:Ct=1,baseColorTexture:Pt,metallicRoughnessTexture:Qt}=ee.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 ka(...mt),metallicFactor:wt,roughnessFactor:Ct,baseColorTexture:Pt?re[Pt.index]:void 0,metallicRoughnessTexture:Qt?re[Qt.index]:void 0},doubleSided:Xe,emissiveFactor:new ka(...ie),alphaMode:ge,alphaCutoff:Se,normalTexture:Ne?re[Ne.index]:void 0,occlusionTexture:Ft,emissionTexture:Ue?re[Ue.index]:void 0,defined:ee.defined===void 0}}(Z!==void 0?c.json.materials[Z]:{defined:!1},h),S}function R_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(ee,re,ie,ge){var Se=re[0],Ne=re[1],Fe=re[2],Ue=re[3],Xe=Se+Se,xt=Ne+Ne,mt=Fe+Fe,wt=Se*Xe,Ct=Se*xt,Pt=Se*mt,Qt=Ne*xt,Ft=Ne*mt,nr=Fe*mt,dr=Ue*Xe,ur=Ue*xt,yr=Ue*mt,_r=ge[0],mr=ge[1],gr=ge[2];return ee[0]=(1-(Qt+nr))*_r,ee[1]=(Ct+yr)*_r,ee[2]=(Pt-ur)*_r,ee[3]=0,ee[4]=(Ct-yr)*mr,ee[5]=(1-(wt+nr))*mr,ee[6]=(Ft+dr)*mr,ee[7]=0,ee[8]=(Pt+ur)*gr,ee[9]=(Ft-dr)*gr,ee[10]=(1-(wt+Qt))*gr,ee[11]=0,ee[12]=ie[0],ee[13]=ie[1],ee[14]=ie[2],ee[15]=1,ee}([],_||[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 ee=Z.anchor=[0,0];for(const re of Z.meshes){const{min:ie,max:ge}=re.aabb;ee[0]+=ie[0]+ge[0],ee[1]+=ie[1]+ge[1]}ee[0]=Math.floor(ee[0]/Z.meshes.length/2),ee[1]=Math.floor(ee[1]/Z.meshes.length/2)}if(z&&(z.id&&(Z.id=z.id),z.lights&&(Z.lights=function(ee){if(!ee.length)return[];const re=function(Fe){const Ue=atob(Fe),Xe=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 oWe(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 Xoe(f){const c=function(z,$){const K=[],Z=WebGL2RenderingContext;if(z.json.textures)for(const ee of z.json.textures){const re={magFilter:Z.LINEAR,minFilter:Z.NEAREST,wrapS:Z.REPEAT,wrapT:Z.REPEAT};ee.sampler!==void 0&&Object.assign(re,z.json.samplers[ee.sampler]),K.push({image:$[ee.source],sampler:re,uploaded:!1})}return K}(f,f.images),h=function(z,$){const K=[];for(const Z of z.json.meshes){const ee=[];for(const re of Z.primitives)ee.push(sWe(re,z,$));K.push(ee)}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(R_e(S[z],f,h));return function(z,$,K){const Z={},ee=new Set;for(let re=0;re0){const re=Array.from(ee.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 lWe(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 F_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=et([],C.pos,z,K/2),ee=et([],C.pos,z,-K/2),re=[Z[0],Z[1],Z[2]+C.height],ie=[ee[0],ee[1],ee[2]+C.height],ge=et([],C.normal,z,$);ve(ge,ge,L);const Se=et([],C.normal,z,-$);ve(Se,Se,L),he(ge,Z,ge),he(Se,ee,Se),Z[2]+=.1,ee[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(ee[0],ee[1],ee[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(ee[0],ee[1],ee[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 cWe(f,c){const h={};h.indexArray=new Qo,h.vertexArray=new Ou,h.colorArray=new og,F_e(f,c,h.indexArray,h.vertexArray,h.colorArray);const g={defined:!0};g.emissiveFactor=ka.black;const _={};return _.baseColorFactor=ka.white,g.pbrMetallicRoughness=_,h.material=g,h.aabb=new yn([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),h}const z_e=$s([{name:"a_pos_3f",components:3,type:"Float32"}]),dWe=$s([{name:"a_normal_3",components:3,type:"Int16"}]),uWe=$s([{name:"a_centroid_3",components:3,type:"Int16"}]),B_e=$s([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),hWe=$s([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),mWe=$s([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),fWe=$s([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),pWe=$s([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),gWe=$s([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),$_e=Dt.types,eL=32767;function xWe(f,c){const h=Ar+c;for(const g of f)for(const _ of g)if(_.x<-c||_.x>h||_.y<-c||_.y>h)return!1;return!0}function yWe(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 Qoe{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 Joe{constructor(c){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new Ui,this.entranceBloom=new Qoe;const h=66560;this.layoutVertexArray=new Ou,this.layoutVertexArray.reserve(h),this.layoutNormalArray=new v0,this.layoutNormalArray.reserve(h),this.layoutCentroidArray=new v0,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 Qoe,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 U_e{constructor(c){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new Bm,this.footprintsIndices=new lg,this.footprintsMin=new or(1/0,1/0),this.footprintsMax=new or(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new Joe(!1),this.buildingWithFacade=new Joe(!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 Xh(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 Ooe(c),this.groundEffect.groundRadiusArray=new zf,this.hasAppearances=null}updateFootprints(c,h){const g=new z6([],[],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(W6!=null||w_e!=null)return null;if(tS!=null)return tS;const c=fetch(Ps.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(ee){const re=g.length,ie=Math.max(ee>>>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(ee=>ee.arrayBuffer()).then(ee=>WebAssembly.instantiate(ee,Z))).then(ee=>{const re=ee.instance.exports;return(0,re.g)(),L=re.f,z(),new qHe({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,W6=h,W6)).catch(h=>{Kr("Could not load building-gen"),tS=null,w_e=h}),tS}()}populate(c,h,g,_){const S=VHe();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($_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 ci(this.zoom),Ne,g))continue;const Ue=Rt(Ne,Fe);if(!Fe&&!this.layers[0]._featureFilter.filter(new ci(this.zoom),Ue,g))continue;const Xe=Fe?Ue.geometry:St(Ne,g,_),xt=[];for(const Pt of Xe)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,ee=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:Xe}of c){if($_e[Ne.type]==="LineString")continue;const xt=this.layers[0]._featureFilter.needGeometry;if(xt&&!this.layers[0]._featureFilter.filter(new ci(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 ci(this.zoom),wt,g))continue;const Ct=xt?wt.geometry:St(Ne,g,_),Pt=uM(Ct,500);let Qt=!1;for(const On of Pt)if(On.length!==1){Qt=!0;break}if(Qt){ee(mt);continue}if(!xWe(Ct,163)){ee(mt);continue}const Ft=this.layers[0],nr=yWe(Ft.layout.get("building-roof-shape").evaluate(Ne,{},g)),dr=Ft.layout.get("building-base").evaluate(Ne,{},g),ur=Ft.layout.get("building-height").evaluate(Ne,{},g),yr=Ft.layout.get("building-flood-light-ground-radius").evaluate(Ne,{},g),_r=Ft.paint.get("building-ambient-occlusion-intensity"),mr=yr/this.tileToMeter;Ne.properties["building-part"]="roof";const gr=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),xr=Ft.paint.get("building-emissive-strength").evaluate(Ne,{},this.canonical);Ne.properties["building-part"]="window";const Er=Ft.paint.get("building-color").evaluate(Ne,{},this.canonical).toPremultipliedRenderColor(this.lut),jr=Ft.paint.get("building-emissive-strength").evaluate(Ne,{},this.canonical);Ne.properties["building-part"]="door";const _n=Ft.paint.get("building-color").evaluate(Ne,{},this.canonical).toPremultipliedRenderColor(this.lut),Hr=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 un=Jr/2048*eL,js=L.get(Fe),kr=z.get(js)||[],mn=kr.length!==0&&Ft.layout.get("building-facade").evaluate(Ne,{},g);S.setFacadeOptions(4,!0),S.setFauxFacadeOptions(mn,!1,1);let Yn=0,Ks=0,Js=0,hs=0,Ka=0,ft=0,vt=0,sr=0,vr=0,$r=0,Ur=0;if(mn){let On=Math.round(Ft.layout.get("building-facade-floors").evaluate(Ne,{},g));if(dr===0){On=Math.max(1,On-(kr.length>0?1:0));let za=4;if(ur>100){const Mi=[10,13,15];za=Mi[Ne.id?Ne.id%Mi.length:0]}else ur<=10&&(za=3);S.setFacadeOptions(za,!0),Ka=(ur<15?1.3:1.61803)*za/C}else Ka=dr/C;ft=ur/C,Ka=Math.min(Ka,ft),Js=Ft.layout.get("building-facade-unit-width").evaluate(Ne,{},g)/C,hs=(ft-Ka)/On,S.setFauxFacadeOptions(!0,!0,Js);const Hi=Ft.layout.get("building-facade-window").evaluate(Ne,{},g);Yn=Hi[0],Ks=Hi[1],vt=Math.floor(65535*Math.min(1,Ka/Ar)),sr=Math.floor(65535*Math.min(1,ft/Ar)),vr=Math.floor(255*Yn)<<8|Math.floor(255*Ks),$r=Math.floor(65535*Math.min(1,Js/Ar)),Ur=Math.floor(65535*Math.min(1,hs/Ar))}const wn=Array(Pt.length),Nn={x:1/0,y:1/0},ls={x:-1/0,y:-1/0},ys={x:0,y:0};let ws=0;for(let On=0;On0){const za=[],Mi=Array(Hi.length+1);Mi[0]=0;for(let tl=0;tlAr||Nn.y<0||ls.y>Ar)&&this.featuresOnBorder.push({featureId:Ne.id,footprintIndex:this.footprints.length});{const On=YN(Xa,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+On.length),this.footprintsIndices.uint16.set(On,Ln),this.buildingIds.add(mt??Ne.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,ai.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,ai.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,di.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,di.y);const Hi={footprintVertexOffset:qs,footprintVertexLength:this.footprintsVertices.length-qs,footprintIndexOffset:Ln,footprintIndexLength:this.footprintsIndices.length-Ln,min:ai,max:di,hiddenFlags:0,indicesOffset:Ea,indicesLength:Ri,bloomIndicesOffset:Fa,bloomIndicesLength:ri,groundEffectVertexOffset:yo,groundEffectVertexLength:ii,hasFauxFacade:mn,height:vs,promoteId:Fe,feature:wt,parts:pa,buildingBloom:ga},za=this.footprints.length;Ne.id!==void 0&&this.featureFootprintLookup.set(Ne.id,za),re(mt,za),this.footprints.push(Hi)}this.programConfigurations.populatePaintArrays(Dn.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,Xe,this.index,Za)}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,z_e.members),g.layoutNormalBuffer=c.createVertexBuffer(g.layoutNormalArray,dWe.members),g.layoutCentroidBuffer=c.createVertexBuffer(g.layoutCentroidArray,uWe.members),g.layoutFloodLightDataBuffer=c.createVertexBuffer(g.layoutFloodLightDataArray,gWe.members),g.layoutFacadeDataArray&&g.layoutFacadeDataArray.length&&(g.layoutFacadeDataBuffer=c.createVertexBuffer(g.layoutFacadeDataArray,mWe.members)),g.layoutFacadeVerticalRangeArray&&g.layoutFacadeVerticalRangeArray.length&&(g.layoutFacadeVerticalRangeBuffer=c.createVertexBuffer(g.layoutFacadeVerticalRangeArray,fWe.members)),g.entranceBloom.layoutVertexArray.length&&(g.entranceBloom.layoutVertexBuffer=c.createVertexBuffer(g.entranceBloom.layoutVertexArray,z_e.members),g.entranceBloom.layoutAttenuationBuffer=c.createVertexBuffer(g.entranceBloom.layoutAttenuationArray,pWe.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,B_e.members,!0),g.layoutFacadePaintArray&&(g.layoutFacadePaintBuffer?g.layoutFacadePaintBuffer.updateData(g.layoutFacadePaintArray):g.layoutFacadePaintBuffer=c.createVertexBuffer(g.layoutFacadePaintArray,hWe.members,!0)),g.entranceBloom.layoutColorBuffer?g.entranceBloom.layoutColorBuffer.updateData(g.entranceBloom.layoutColorArray):g.entranceBloom.layoutColorBuffer=c.createVertexBuffer(g.entranceBloom.layoutColorArray,B_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),ee=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=ee):Ne.part===3&&(Ue=re,Fe=ie),Fe=ye(Fe,0,1);for(let Xe=0;XeC.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||vWe(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 vWe(f,c,h){for(let g=0;g1&&(z=c[++L]);const K=Math.abs($-z.left),Z=Math.abs($-z.right),ee=Math.min(K,Z);let re;const ie=S/g*(_+1);if(z.isDash){const ge=_-Math.abs(ie);re=Math.sqrt(ee*ee+ge*ge)}else re=_-Math.sqrt(ee*ee+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 Xh(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:Ar/64,this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,h){}updateAppearances(c,h,g,_){}populate(c,h,g,_){this.hasPattern=Soe("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 ee=this.layers[0].layout.get("line-z-offset"),re=ee.isConstant()&&!ee.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:ee,id:re,index:ie,sourceLayerIndex:ge}of c){const Se=this.layers[0]._featureFilter.needGeometry,Ne=Rt(ee,Se);if(!this.layers[0]._featureFilter.filter(new ci(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),Ne,g))continue;const Fe=S?S.evaluate(Ne,{},g):void 0,Ue={id:re,properties:ee.properties,type:ee.type,sourceLayerIndex:ge,index:ie,geometry:Se?Ne.geometry:St(ee,g,_),patterns:{},sortKey:Fe};z.push(Ue)}S&&z.sort((ee,re)=>ee.sortKey-re.sortKey);const{lineAtlas:$,featureIndex:K}=h,Z=this.addConstantDashes($);for(const ee of z){const{geometry:re,index:ie,sourceLayerIndex:ge}=ee;if(Z&&this.addFeatureDashes(ee,$),this.hasPattern){const Se=Coe("line",this.layers,ee,this.zoom,this.pixelRatio,h);this.patternFeatures.push(Se)}else this.addFeature(ee,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,NWe)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=c.createVertexBuffer(this.patternVertexArray,CWe)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=c.createVertexBuffer(this.zOffsetVertexArray,wWe.members,!0)),this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,jWe),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,{}),ee=$.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,ee,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 V6(c,-h,-h,Ar+h,Ar+h)}clipRuntimeLinesToTile(c,h){const g=[];return[V6(c,-h,-h,Ar+h,Ar+h,g),g]}addElevatedRoadFeature(c,h,g,_,S,C,L,z){const $=[],K=Ta.getElevationFeature(c,_);if(K){const Z=this.clipLinesToTile(h,1),ee=this.prepareElevatedLines(Z,K,g);for(const re of ee)$.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 ee=this.layoutVertexArray.length;this.addLine(Z.geometry,c,g,S,C,L,z);const re=new Va(g,Z.elevationTileID);if(Z.elevation)for(let ie=ee;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(ee)}return!0}prepareElevatedLines(c,h,g){if(h.constantHeight!=null)return c;const _=[],S=1/De(g);for(const C of c)BHe(C,new fa(h,S),0,_);return _}fillNonElevatedRoadSegment(c){for(let h=c;h0,ee=z&&z.progress.max<1;if(this.lineClips){let Pt={min:this.lineClips.start,max:this.lineClips.end},Qt=1;if(z){const dr=this.lineClips.end-this.lineClips.start;Pt=function(ur,yr,_r){return{min:Ga(ur.min,yr,_r),max:Ga(ur.max,yr,_r)}}(z.progress,{min:0,max:1},Pt),dr>0&&(Qt=(Pt.max-Pt.min)/dr)}const Ft=+h.properties.mapbox_clip_feature_len,nr=+h.properties.mapbox_clip_seg_len;if(Number.isNaN(Ft)||Number.isNaN(nr)){for(let ur=0;ur=2&&c[ie-1].equals(c[ie-2]);)ie--;let ge=0;for(;ge0,rr=this.overscaling<=16?15*Ar/(512*this.overscaling):0;if(Qt&&Ft==="round"){if(yrC&&(Ft="bevel"),Ft==="bevel"&&(yr>2&&(Ft="flipbevel"),yr2*rr){const Er=Ne.sub(Ne.sub(Fe)._mult(rr/Jt)._round());this.updateDistance(Fe,Er),this.addCurrentVertex(Er,Xe,0,0,Se,Ct),Fe=Er}this.updateDistance(Fe,Ne),dr._mult(yr),this.addCurrentVertex(Ne,dr,0,0,Se,Ct);const xr=Ne.dist(Ue);if(xr>2*rr){const Er=Ne.add(Ue.sub(Ne)._mult(rr/xr)._round());this.updateDistance(Ne,Er),this.addCurrentVertex(Er,xt,0,0,Se,Ct),Ne=Er}}else dr._mult(yr),this.addCurrentVertex(Ne,dr,0,0,Se,Ct);else if(Ft==="flipbevel"){if(yr>100)dr=xt.mult(-1);else{const Jt=yr*Xe.add(xt).mag()/Xe.sub(xt).mag();dr._perp()._mult(Jt*(gr?-1:1))}this.addCurrentVertex(Ne,dr,0,0,Se,Ct),this.addCurrentVertex(Ne,dr.mult(-1),0,0,Se,Ct)}else if(Ft==="bevel"||Ft==="fakeround"){Ct!=null&&Fe&&this.addCurrentVertex(Ne,wt||Xe,-1,-1,Se,Ct);const Jt=Ne.dist(Fe)<=2*rr&&Ft!=="bevel",xr=dr.mult(gr?1:-1);xr._mult(yr);const Er=xt.mult(gr?-1:1),jr=Xe.mult(gr?-1:1),_n=this.evaluateLineProgressFeatures(this.distance);if(Ct==null&&(this.addHalfVertex(Ne,xr.x,xr.y,!1,!gr,0,Se,_n),Jt||this.addHalfVertex(Ne,xr.x+2*jr.x,xr.y+2*jr.y,!1,gr,0,Se,_n)),Ft==="fakeround"){const Hr=Math.round(180*_r/Math.PI/20);this.addHalfVertex(Ne,jr.x,jr.y,!1,gr,0,Se,_n);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 tle(f,c,h){return f.xh||f.yh}let W_e,G_e;function K_e(f,c,h){return c*(Ar/(f.tileSize*Math.pow(2,h-f.tileID.overscaledZ)))}sn(ele,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const Z_e=(f,c,h)=>(1-h)*f+h*c;function Y_e(f,c){return 1/K_e(f,1,c.tileZoom)}function X_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 Q_e=f=>{const c=[];J_e(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 J_e(f){const c=f.paint.get("line-dasharray").value;return c.kind!=="constant"||c.value}let rle;const ebe=()=>rle||(rle={layout:W_e||(W_e=new to({"line-cap":new Rr(Bt.layout_line["line-cap"]),"line-join":new Rr(Bt.layout_line["line-join"]),"line-miter-limit":new Sr(Bt.layout_line["line-miter-limit"]),"line-round-limit":new Sr(Bt.layout_line["line-round-limit"]),"line-sort-key":new Rr(Bt.layout_line["line-sort-key"]),"line-z-offset":new Rr(Bt.layout_line["line-z-offset"]),"line-elevation-reference":new Sr(Bt.layout_line["line-elevation-reference"]),"line-cross-slope":new Sr(Bt.layout_line["line-cross-slope"]),visibility:new Sr(Bt.layout_line.visibility),"line-width-unit":new Sr(Bt.layout_line["line-width-unit"])})),paint:G_e||(G_e=new to({"line-opacity":new Rr(Bt.paint_line["line-opacity"]),"line-color":new Rr(Bt.paint_line["line-color"]),"line-translate":new Sr(Bt.paint_line["line-translate"]),"line-translate-anchor":new Sr(Bt.paint_line["line-translate-anchor"]),"line-width":new Rr(Bt.paint_line["line-width"]),"line-gap-width":new Rr(Bt.paint_line["line-gap-width"]),"line-offset":new Rr(Bt.paint_line["line-offset"]),"line-blur":new Rr(Bt.paint_line["line-blur"]),"line-dasharray":new Rr(Bt.paint_line["line-dasharray"]),"line-pattern":new Rr(Bt.paint_line["line-pattern"]),"line-pattern-cross-fade":new Sr(Bt.paint_line["line-pattern-cross-fade"]),"line-gradient":new jx(Bt.paint_line["line-gradient"]),"line-trim-offset":new Sr(Bt.paint_line["line-trim-offset"]),"line-trim-fade-range":new Sr(Bt.paint_line["line-trim-fade-range"]),"line-trim-color":new Sr(Bt.paint_line["line-trim-color"]),"line-emissive-strength":new Rr(Bt.paint_line["line-emissive-strength"]),"line-border-width":new Rr(Bt.paint_line["line-border-width"]),"line-border-color":new Rr(Bt.paint_line["line-border-color"]),"line-occlusion-opacity":new Sr(Bt.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Rr({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Rr({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Rr({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Rr({type:"string",default:"default","property-type":"data-driven"})}))},rle);class EWe extends Rr{possiblyEvaluate(c,h){return h=new ci(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 jM;function tbe(f,c){return c>0?c+2*f:f}const IWe=$s([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),PWe=$s([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),LWe=$s([{name:"a_projected_pos",components:4,type:"Float32"}],4);$s([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const OWe=$s([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),DWe=$s([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),RWe=$s([{name:"a_texb",components:2,type:"Uint16"}]),FWe=$s([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),zWe=$s([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);$s([{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 rbe=$s([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),BWe=$s([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);$s([{name:"triangle",components:3,type:"Uint16"}]),$s([{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"}]),$s([{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"}]),$s([{type:"Float32",name:"offsetX"}]),$s([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var jl=24;function $We(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 kM={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function UWe(f){return f==="︶"||f==="﹈"||f==="︸"||f==="﹄"||f==="﹂"||f==="︾"||f==="︼"||f==="︺"||f==="︘"||f==="﹀"||f==="︐"||f==="︓"||f==="︔"||f==="`"||f===" ̄"||f==="︑"||f==="︒"}function qWe(f){return f==="︵"||f==="﹇"||f==="︷"||f==="﹃"||f==="﹁"||f==="︽"||f==="︻"||f==="︹"||f==="︗"||f==="︿"}const nle=4294967296,nbe=1/nle,sbe=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let tL=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)*nle;return this.pos+=8,f}readSFixed64(){const f=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*nle;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&&sbe?sbe.decode(this.buf.subarray(c,f)):function(h,g,_){let S="",C=g;for(;C<_;){const L=h[C];let z,$,K,Z=null,ee=L>239?4:L>223?3:L>191?2:1;if(C+ee>_)break;ee===1?L<128&&(Z=L):ee===2?(z=h[C+1],(192&z)==128&&(Z=(31&L)<<6|63&z,Z<=127&&(Z=null))):ee===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))):ee===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,ee=1):Z>65535&&(Z-=65536,S+=String.fromCharCode(Z>>>10&1023|55296),Z=56320|1023&Z),S+=String.fromCharCode(Z),C+=ee}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&&abe(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&&abe(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,VWe,c)}writePackedSVarint(f,c){c.length&&this.writeMessage(f,HWe,c)}writePackedBoolean(f,c){c.length&&this.writeMessage(f,KWe,c)}writePackedFloat(f,c){c.length&&this.writeMessage(f,WWe,c)}writePackedDouble(f,c){c.length&&this.writeMessage(f,GWe,c)}writePackedFixed32(f,c){c.length&&this.writeMessage(f,ZWe,c)}writePackedSFixed32(f,c){c.length&&this.writeMessage(f,YWe,c)}writePackedFixed64(f,c){c.length&&this.writeMessage(f,XWe,c)}writePackedSFixed64(f,c){c.length&&this.writeMessage(f,QWe,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 abe(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 VWe(f,c){for(let h=0;h=0&&g>=c&&rL[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(NM.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 ale(f,c,h,g,_,S,C,L,z,$,K,Z,ee,re,ie,ge=1){const Se=sS.fromFeature(f,_,ge);Z===zu.vertical&&Se.verticalizePunctuation(ee);let Ne=[];const Fe=function(wt,Ct,Pt,Qt,Ft,nr){if(!wt)return[];const dr=[],ur=function(gr,rr,Jt,xr,Er,jr){let _n=0;for(let Hr=0;Hr=0;let _r=0;for(let gr=0;gr0&&ga>hs&&(hs=ga)}else{const da=Pt[vr.fontStack];if(!da)continue;da[Ur]&&(ls=da[Ur]);const pa=Ct[vr.fontStack];if(!pa)continue;const ga=pa.glyphs[Ur];if(!ga)continue;if(Nn=ga.metrics,ws=Ur!==8203?jl:0,jr){const Fa=pa.ascender!==void 0?Math.abs(pa.ascender):0,ri=pa.descender!==void 0?Math.abs(pa.descender):0,Za=(Fa+ri)*wn;Ka-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 gbe(f){let c=0;for(let h=0;h$){const ie=($-z)/re,ge=$n(Z.x,ee.x,ie),Se=$n(Z.y,ee.y,ie),Ne=new Ex(ge,Se,0,ee.angleTo(Z),K);return!C||pbe(f,Ne,L,C,c)?Ne:void 0}z+=re}}function aGe(f,c,h,g,_,S,C,L,z){const $=xbe(g,S,C),K=ybe(g,_),Z=K*C,ee=f[0].x===0||f[0].x===z||f[0].y===0||f[0].y===z;return c-Z=0&&Xe=0&&xt=0&&ee+$<=K){const mt=new Ex(Xe,xt,0,Fe,ie);g&&!pbe(f,mt,S,g,_)||re.push(mt)}}Z+=Ne}return L||re.length||C||(re=vbe(f,Z/2,h,g,_,S,C,!0,z)),re}function _be(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:$}=dle(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(ja.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(ja.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}})}}sn(SM,"ImagePosition"),sn(bbe,"ImageAtlas");const CM=1e20;function wbe(f,c,h,g,_,S,C,L,z){for(let $=c;$-1);z++,S[z]=L,C[z]=$,C[z+1]=CM}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,(ee,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(ee,re);delete z.requests[K]})),Z.push((ee,re)=>{ee?L(ee):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!==ule.none&&(this.localGlyphMode===ule.all?!!this.localFontFamily:!!this.localFontFamily&&(Pn["CJK Unified Ideographs"](c)||Pn["Hangul Syllables"](c)||Pn.Hiragana(c)||Pn.Katakana(c)||Pn["CJK Symbols and Punctuation"](c)||Pn["CJK Unified Ideographs Extension A"](c)||Pn["CJK Unified Ideographs Extension B"](c)||Pn.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:ee,glyphTop:re,glyphAdvance:ie}=S.draw(C);return this.localGlyphs[S.fontWeight][g]={id:g,bitmap:new T0({width:z,height:$},L),metrics:{width:K/Zf,height:Z/Zf,left:ee/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(ee){return new tL(ee).readFields(JWe,{})}($);for(const ee of Z.glyphs)K[ee.id]=ee;_(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),ee=new Uint8ClampedArray(Z),re={data:ee,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(CM,0,Z),Se.fill(0,0,Z);for(let Ue=0;Ue0?wt*wt:0,Se[mt]=wt<0?wt*wt:0}}wbe(Ne,0,0,$,K,$,this.f,this.v,this.z),wbe(Se,ge,ge,L,z,$,this.f,this.v,this.z);for(let Ue=0;Ue{const yr=aL(Ft.stretch-Fe,Ue,K,f.left*_),_r=iL(Ft.fixed-mt,wt,Ft.stretch,ie),mr=aL(nr.stretch-Xe,xt,Z,f.top*_),gr=iL(nr.fixed-Ct,Pt,nr.stretch,ge),rr=aL(dr.stretch-Fe,Ue,K,f.left*_),Jt=iL(dr.fixed-mt,wt,dr.stretch,ie),xr=aL(ur.stretch-Xe,xt,Z,f.top*_),Er=iL(ur.fixed-Ct,Pt,ur.stretch,ge),jr=new or(yr,mr),_n=new or(rr,mr),Hr=new or(rr,xr),Jr=new or(yr,xr),un=new or(_r/L,gr/L),js=new or(Jt/L,Er/L),kr=c*Math.PI/180;if(kr){const Ka=Math.sin(kr),ft=Math.cos(kr),vt=[ft,-Ka,Ka,ft];jr._matMult(vt),_n._matMult(vt),Jr._matMult(vt),Hr._matMult(vt)}const mn=Ft.stretch+Ft.fixed,Yn=dr.stretch+dr.fixed,Ks=nr.stretch+nr.fixed,Js=ur.stretch+ur.fixed,hs=f.imageSecondary;return{tl:jr,tr:_n,bl:Jr,br:Hr,texPrimary:{x:C.paddedRect.x+hg+mn,y:C.paddedRect.y+hg+Ks,w:Yn-mn,h:Js-Ks},texSecondary:hs?{x:hs.paddedRect.x+hg+mn,y:hs.paddedRect.y+hg+Ks,w:Yn-mn,h:Js-Ks}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:un,pixelOffsetBR:js,minFontScaleX:wt/L/K,minFontScaleY:Pt/L/Z,isSDF:h}};if(g&&(C.stretchX||C.stretchY)){const Ft=Nbe(ee,Se,ie),nr=Nbe(re,Ne,ge);for(let dr=0;drS)&&(S=ie.x),(!re||ie.y>C)&&(C=ie.y)}const z=Math.min(S-g,C-_);let $=z/2;const K=new Xk([],cGe);if(z===0)return new or(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,ee)),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)),ee+=4)}return h&&(console.log(`num probes: ${ee}`),console.log(`best distance: ${Z.d}`)),Z.p}function cGe(f,c){return c.max-f.max}class lS{constructor(c,h,g,_){this.p=new or(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 dGe=Object.keys,mle=Number.POSITIVE_INFINITY,uGe=Math.sqrt(2);function E0(f,c,h,g,_){const S=ole(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 $=Hn(z),K=new or(L.left,L.top),Z=new or(L.right,L.top),ee=new or(L.left,L.bottom),re=new or(L.right,L.bottom),ie=new or(0,0);K._rotateAround($,ie),Z._rotateAround($,ie),ee._rotateAround($,ie),re._rotateAround($,ie),L.left=Math.min(K.x,Z.x,ee.x,re.x),L.right=Math.max(K.x,Z.x,ee.x,re.x),L.top=Math.min(K.y,Z.y,ee.y,re.y),L.bottom=Math.max(K.y,Z.y,ee.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 Cbe(f,[c,h]){let g=0,_=0;if(h===mle){c<0&&(c=0);const S=c/uGe;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 hGe(f,c,h,g,_,S,C,L,z,$,K,Z,ee,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:Xe}=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=E0(c,Se.iconBBox,Fe,C),h)&&(Se.iconVerticalBBox=E0(h,Se.iconVerticalBBox,Fe+90,C));const xt=lL(Z.horizontal);xt&&(Ne.textBBox=E0(xt,Ne.textBBox,Ue,1,re)),Z.vertical&&(Ne.textVerticalBBox=E0(Z.vertical,Ne.textVerticalBBox,Ue+90,1,re));for(const mt of ge)mt.hasIconProperties()&&mGe(Se,f,ie,mt,_,S,L,Fe,C,z,c,$,Xe,K),mt.hasTextProperties()&&fGe(Ne,ie,mt,_,S,re,Ue,ee,xt,Z.vertical);return{iconBBox:Se.iconBBox,iconVerticalBBox:Se.iconVerticalBBox,textBBox:Ne.textBBox,textVerticalBBox:Ne.textVerticalBBox}}function mGe(f,c,h,g,_,S,C,L,z,$,K,Z,ee,re){const{appearanceIconOffset:ie,appearanceIconRotate:ge,appearanceIconSize:Se}=function(Xe,xt,mt,wt,Ct,Pt,Qt,Ft){const nr=Xe.hasProperty("icon-offset")?xt.getAppearanceValueAndResolveTokens(Xe,"icon-offset",mt,wt,[]):null,dr=nr&&Array.isArray(nr)?nr:Ct,ur=Xe.hasProperty("icon-rotate")?xt.getAppearanceValueAndResolveTokens(Xe,"icon-rotate",mt,wt,[]):null,yr=typeof ur=="number"?ur:Pt,_r=Xe.hasProperty("icon-size")?xt.getAppearanceValueAndResolveTokens(Xe,"icon-size",mt,wt,[]):null;return{appearanceIconOffset:dr,appearanceIconRotate:yr,appearanceIconSize:typeof _r=="number"?_r*Ft.iconScaleFactor:Qt}}(g,h,_,S,C,L,z,$);let Ne=null,Fe=null,Ue=null;g.hasProperty("icon-image")?Ue=function(Xe,xt,mt,wt,Ct,Pt,Qt){let Ft=null;const nr=xt.getAppearanceValueAndResolveTokens(mt,"icon-image",wt,Ct,[]);if(nr){const dr=Xe.getResolvedImageFromTokens(nr),ur=mt.getUnevaluatedProperty("icon-size"),yr=MM(dr,aS(Xe.zoom,ur,Xe.worldview),ur,Ct,Xe.zoom,wt,Xe.pixelRatio,Qt,Xe.worldview);Ft=Pt.get(yr.iconPrimary.toString())}return Ft}(c,h,g,_,S,Z,ee):K&&(Ue=K.imagePrimary),Ue&&(Ne=nL(Ue,null,ie,re),c.allowVerticalPlacement&&(Fe=nL(Ue,null,ie,re))),Ne&&(f.iconBBox=E0(Ne,f.iconBBox,ge,Se)),Fe&&(f.iconVerticalBBox=E0(Fe,f.iconVerticalBBox,ge+90,Se))}function fGe(f,c,h,g,_,S,C,L,z,$){const{appearanceTextOffset:K,appearanceTextRotate:Z,appearanceTextSize:ee}=function(ie,ge,Se,Ne,Fe,Ue,Xe){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:Xe}}(h,c,g,_,S,C,L),re=ee/L;z&&(f.textBBox=E0(z,f.textBBox,Z,re,K)),$&&(f.textVerticalBBox=E0($,f.textVerticalBBox,Z+90,re,K))}function oL(f,c,h,g,_,S,C,L,z){if(!c||!c.usvg)return;const $=fbe(g),K=fbe(_),Z=S!=="both"&&S!=="width"||!hbe(g)?1:K.width/$.width,ee=S!=="both"&&S!=="height"||!mbe(g)?1:K.height/$.height;h.scaleSelf(Z,ee);const re=h.toString();C.set(re,h),L.set(re,c);const{imagePosition:ie}=dle(re,c,b_);z.set(re,ie)}function Mbe(f,c,h,g,_,S,C,L,z){if(!f)return;const $=function(K,Z,ee,re,ie,ge){if(K.kind==="camera")return K.maxSize;if(K.kind==="composite"){const Se=Z.possiblyEvaluate(new ci(K.maxZoom,{worldview:ge}),ee).evaluate(ie,{},ee),Ne=Z.possiblyEvaluate(new ci(K.minZoom,{worldview:ge}),ee).evaluate(ie,{},ee);return Math.max(Se,Ne)}return Z.possiblyEvaluate(new ci(re,{worldview:ge})).evaluate(ie,{},ee)}(c,h,g,_,S,z);return f.scaleSelf($*L*C)}function MM(f,c,h,g,_,S,C,L,z){return{iconPrimary:Mbe(f.getPrimary(),c,h,g,_,S,C,L,z),iconSecondary:Mbe(f.getSecondary(),c,h,g,_,S,C,L,z)}}function pGe(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 Tbe(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 gGe(f,c){for(const h in f.horizontal)Abe(f.horizontal[h],c);Abe(f.vertical,c)}function Abe(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 fle(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 xGe(f,c,h,g,_,S,C,L,z){const $=lL(S.horizontal)||S.vertical,K=h.get("icon-text-fit-padding").evaluate(g,{},_);let Z,ee=c;return c&&z!=="none"&&(f.allowVerticalPlacement&&S.vertical&&(Z=lle(c,S.vertical,z,K,L,C)),$&&(ee=lle(c,$,z,K,L,C))),{defaultShapedIcon:ee,verticallyShapedIcon:Z}}function yGe(f,c,h,g,_,S,C,L,z,$,K,Z,ee,re,ie,ge,Se,Ne,Fe,Ue,Xe,xt,mt,wt){let Ct=C.textMaxSize.evaluate(c,{},ee);Ct===void 0?Ct=L*C.textScaleFactor:Ct*=C.textScaleFactor;const Pt=f.layers[0].layout,Qt=jl,Ft=L*C.textScaleFactor/Qt,nr=lL(h.horizontal)||h.vertical;if(Se!=="none"&&f.appearanceFeatureData&&c.index18&&xr>2&&(xr>>=1),Math.max(Ar/(512*xr),1)*Pt.get("symbol-spacing")),_r=Pt.get("text-padding")*f.tilePixelRatio,mr=Pt.get("icon-padding")*f.tilePixelRatio,gr=Hn(Pt.get("text-max-angle")),rr=Pt.get("icon-rotation-alignment")==="map"&&Ue!=="point",Jt=yr/2;var xr;f.hasAnyIconTextFit===!1&&Se!=="none"&&(f.hasAnyIconTextFit=!0);const Er=c.properties?+c.properties[er]:null,jr=Er&&f.elevationFeatureIdToIndex?f.elevationFeatureIdToIndex.get(Er):65535,_n=(Hr,Jr,un)=>{if(Jr.x<0||Jr.x>=Ar||Jr.y<0||Jr.y>=Ar)return;let js=null;if(dr){const{x:kr,y:mn,z:Yn}=re.projectTilePoint(Jr.x,Jr.y,un);js={anchor:new Ex(kr,mn,Yn,0,void 0),up:re.upVector(un,Jr.x,Jr.y)}}(function(kr,mn,Yn,Ks,Js,hs,Ka,ft,vt,sr,vr,$r,Ur,wn,Nn,ls,ys,ws,Us,Dn,Kn,da,pa,ga,Fa,ri,Za,Sa,Ea,vs,Qs,Ri,Ln){const qs=kr.addToLineVertexArray(mn,Ks);let Xa,ai,di,yo,ii,On,Hi,za=0,Mi=0,tl=0,kl=0,Uo=-1,qo=-1;const hl={};let Xd=pr("");const oi=Yn?Yn.anchor:mn,mo=Sa!=="none";let vo=0,uu=0;if(vt._unevaluatedLayout.getValue("text-radial-offset")===void 0){const pc=vt.layout.get("text-offset").evaluate(Kn,{},Fa);vo=pc[0]*jl,uu=pc[1]*jl}else vo=vt.layout.get("text-radial-offset").evaluate(Kn,{},Fa)*jl,uu=mle;if(kr.allowVerticalPlacement&&Js.vertical){const pc=Js.vertical;if(Nn)On=ple(pc),ft&&(Hi=ple(ft));else{const Sd=vt.layout.get("text-rotate").evaluate(Kn,{},Fa)+90;di=cL(sr,oi,mn,vr,$r,Ur,pc,wn,Sd,ls,Ri),ft&&(yo=cL(sr,oi,mn,vr,$r,Ur,ft,ws,Sd,null,Qs))}}if(hs){const pc=kr.iconSizeData,Sd=vt.layout.get("icon-rotate").evaluate(Kn,{},Fa),Bu=hle(hs,Sd,pa,mo,da.iconScaleFactor),L0=ft?hle(ft,Sd,pa,mo,da.iconScaleFactor):void 0;ai=cL(sr,oi,mn,vr,$r,Ur,hs,ws,Sd,null,vs);const pS=function(Jf,WM,Z2e,AKe,Y2e,X2e,EKe,IKe){const Q2e=Jf.layers[0],J2e=Q2e.appearances;let gS=WM.length;if(Z2e&&(gS=Math.max(gS,Z2e.length)),J2e.length===0)return gS;const[PKe,LKe]=AKe.get("icon-size-scale-range"),OKe=ye(1,PKe,LKe);for(const ewe of J2e){const twe=ewe.getUnevaluatedProperties();if(twe._values["icon-image"].value!==void 0){const rwe=Q2e.getAppearanceValueAndResolveTokens(ewe,"icon-image",Y2e,X2e,[]);if(rwe){const nwe=Jf.getResolvedImageFromTokens(rwe);if(nwe){const swe=twe._values["icon-size"],DKe=MM(nwe,aS(Jf.zoom,swe,Jf.worldview),swe,X2e,Jf.zoom,Y2e,Jf.pixelRatio,OKe,Jf.worldview),RKe=EKe.get(DKe.iconPrimary.toString());gS=Math.max(gS,iGe(RKe,IKe))}}}}return gS}(kr,Bu,L0,vt.layout,Kn,Fa,kr.iconAtlasPositions,mo);za=4*pS;let Qf=null;pc.kind==="source"?(Qf=[Kf*vt.layout.get("icon-size").evaluate(Kn,{},Fa)*da.iconScaleFactor],Qf[0]>Ix&&Kr(`${kr.layerIds[0]}: Value for "icon-size" is >= ${TM}. Reduce your "icon-size".`)):pc.kind==="composite"&&(Qf=[Kf*da.compositeIconSizes[0].evaluate(Kn,{},Fa)*da.iconScaleFactor,Kf*da.compositeIconSizes[1].evaluate(Kn,{},Fa)*da.iconScaleFactor],(Qf[0]>Ix||Qf[1]>Ix)&&Kr(`${kr.layerIds[0]}: Value for "icon-size" is >= ${TM}. Reduce your "icon-size".`)),kr.addSymbols(kr.icon,Bu,Qf,Dn,Us,Kn,void 0,Yn,mn,qs.lineStartIndex,qs.lineLength,-1,ga,Fa,ri,Za,kr.symbolInstances.length,pS),Uo=kr.icon.placedSymbolArray.length-1,L0&&(Mi=4*pS,kr.addSymbols(kr.icon,L0,Qf,Dn,Us,Kn,zu.vertical,Yn,mn,qs.lineStartIndex,qs.lineLength,-1,ga,Fa,ri,Za,kr.symbolInstances.length,pS),qo=kr.icon.placedSymbolArray.length-1)}for(const pc in Js.horizontal){const Sd=pc,Bu=Js.horizontal[Sd];Xa||(Xd=pr(Bu.text),Nn?ii=ple(Bu):Xa=cL(sr,oi,mn,vr,$r,Ur,Bu,wn,vt.layout.get("text-rotate").evaluate(Kn,{},Fa),ls,Ri));const L0=Bu.positionedLines.length===1;if(tl+=Ebe(kr,Yn,mn,Bu,Ka,vt,Nn,Kn,ls,qs,Js.vertical?zu.horizontal:zu.horizontalOnly,L0?dGe(Js.horizontal):[Sd],hl,Uo,da,ga,Fa,kr.symbolInstances.length,ri),L0)break}Js.vertical&&(kl+=Ebe(kr,Yn,mn,Js.vertical,Ka,vt,Nn,Kn,ls,qs,zu.vertical,["vertical"],hl,qo,da,ga,Fa,kr.symbolInstances.length,ri));let rl=-1;const Vm=(pc,Sd)=>pc?Math.max(pc,Sd):Sd;rl=Vm(ii,rl),rl=Vm(On,rl),rl=Vm(Hi,rl);const mg=rl>-1?1:0;kr.glyphOffsetArray.length>=65535&&Kr("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Kn.sortKey!==void 0&&kr.addToSortKeyRanges(kr.symbolInstances.length,Kn.sortKey),kr.symbolInstances.emplaceBack(mn.x,mn.y,oi.x,oi.y,oi.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,Uo,qo,Xd,Xa!==void 0?Xa:kr.collisionBoxArray.length,Xa!==void 0?Xa+1:kr.collisionBoxArray.length,di!==void 0?di:kr.collisionBoxArray.length,di!==void 0?di+1:kr.collisionBoxArray.length,ai!==void 0?ai:kr.collisionBoxArray.length,ai!==void 0?ai+1:kr.collisionBoxArray.length,yo||kr.collisionBoxArray.length,yo?yo+1:kr.collisionBoxArray.length,vr,tl,kl,za,Mi,mg,0,vo,uu,rl,0,mo?1:0,Ea)})(f,Jr,js,Hr,h,g,S,_,f.layers[0],f.collisionBoxArray,c.index,c.sourceLayerIndex,f.index,_r,Fe,$,0,mr,rr,Ne,c,C,K,Z,ee,ie,ge,Se,jr,Xe,xt,mt)};if(Ue==="line")for(const Hr of V6(c.geometry,0,0,Ar,Ar)){const Jr=aGe(Hr,yr,gr,h.vertical||nr,g,Qt,ur,f.overscaling,Ar);for(const un of Jr)nr&&vGe(f,nr.text,Jt,un)||_n(Hr,un,ee)}else if(Ue==="line-center"){for(const Hr of c.geometry)if(Hr.length>1){const Jr=sGe(Hr,gr,h.vertical||nr,g,Qt,ur);Jr&&_n(Hr,Jr,ee)}}else if(c.type==="Polygon")for(const Hr of uM(c.geometry,0)){const Jr=lGe(Hr,16);_n(Hr[0],new Ex(Jr.x,Jr.y,0,0,void 0),ee)}else if(c.type==="LineString")for(const Hr of c.geometry)_n(Hr,new Ex(Hr[0].x,Hr[0].y,0,0,void 0),ee);else if(c.type==="Point")for(const Hr of c.geometry)for(const Jr of Hr)_n([Jr],new Ex(Jr.x,Jr.y,0,0,void 0),ee)}const TM=255,Ix=TM*Kf;function Ebe(f,c,h,g,_,S,C,L,z,$,K,Z,ee,re,ie,ge,Se,Ne,Fe){const Ue=function(mt,wt,Ct,Pt,Qt,Ft,nr,dr){const ur=[];if(wt.positionedLines.length===0)return ur;const yr=Pt.layout.get("text-rotate").evaluate(Ft,{})*Math.PI/180,_r=function(xr){const Er=xr[0],jr=xr[1],_n=Er*jr;return _n>0?[Er,-jr]:_n<0?[-Er,jr]:Er===0?[jr,Er]:[jr,-Er]}(Ct);let mr=Math.abs(wt.top-wt.bottom);for(const xr of wt.positionedLines)mr-=xr.lineOffset;const gr=wt.positionedLines.length,rr=mr/gr;let Jt=wt.top-Ct[1];for(let xr=0;xrIx&&Kr(`${f.layerIds[0]}: Value for "text-size" is >= ${TM}. Reduce your "text-size".`)):Xe.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 >= ${TM}. 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)ee[mt]=f.text.placedSymbolArray.length-1;return 4*Ue.length}function lL(f){for(const c in f)return f[c];return null}function cL(f,c,h,g,_,S,C,L,z,$,K){let Z,ee,re,ie;if(Z=K?K.top:C.top,ee=K?K.bottom:C.bottom,re=K?K.left:C.left,ie=K?K.right:C.right,ole(C)&&C.collisionPadding){const ge=C.collisionPadding;re-=ge[0],Z-=ge[1],ie+=ge[2],ee+=ge[3]}if(z){const ge=new or(re,Z),Se=new or(ie,Z),Ne=new or(re,ee),Fe=new or(ie,ee),Ue=Hn(z);let Xe=new or(0,0);$&&(Xe=new or($[0],$[1])),ge._rotateAround(Ue,Xe),Se._rotateAround(Ue,Xe),Ne._rotateAround(Ue,Xe),Fe._rotateAround(Ue,Xe),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),ee=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,ee,L,g,_,S),f.length-1}function ple(f){ole(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 vGe(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&&(Xe(mt,ur,Ct,Pt,nr,dr),Xe(ur,wt,nr,dr,Qt,Ft))}Xe(Z,ee,g,S,_,S),Xe(ee,re,_,S,_,C),Xe(re,ie,_,C,g,C),Xe(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 Pbe(f,{x:c,y:h},g=0){return new or(((c-g)*f.scale-f.x)*Ar,(h*f.scale-f.y)*Ar)}const _Ge=M(new Float32Array(16));class I0{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 J(1,c)*h}pixelSpaceConversion(c,h,g){return 1}farthestPixelDistance(c){return Ibe(c,c.pixelsPerMeter)}pointCoordinate(c,h,g,_){const S=c.horizonLineFromTop(!1),C=new or(h,Math.max(S,g));return c.rayIntersectionCoordinate(c.pointRayIntersection(C,_))}pointCoordinate3D(c,h,g){const _=new or(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(uL(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),-fe,fe);return new p($,this.southernCenter?-K:K)}}class Lbe extends I0{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),_=ue(h);return new p(g,_)}}const Obe=Hn(fe);class NGe extends I0{project(c,h){const g=(h=Hn(h))*h,_=g*g;return{x:.5*((c=Hn(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,-Obe,Obe)}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 Dbe=Hn(fe);class SGe extends I0{project(c,h){h=Hn(h),c=Hn(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*$,ee=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,Xe=Fe?Math.acos($*ie)*Math.sqrt(1/Fe):0,xt=.5*(2*Xe*$*ge+2*g/Math.PI)-c,mt=.5*(Xe*K+_)-h,wt=.5*Ue*(re*Ne+Xe*$*ie*ee)+1/Math.PI,Ct=Ue*(Se*Z/4-Xe*K*ge),Pt=.125*Ue*(Z*ge-Xe*K*re*Se),Qt=.5*Ue*(ee*ie+Xe*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,-Dbe,Dbe)}while((Math.abs(L)>C||Math.abs(z)>C)&&--S>0);return new p(Ki(g),Ki(_))}}class Rbe extends I0{constructor(c){super(c),this.center=c.center||[0,0],this.parallels=c.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Hn(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:Hn(c)*_*g+.5,y:-Math.sin(Hn(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),-fe,fe);return new p(C,z)}}class CGe extends Lbe{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 _=aM(c,h,g);return at(_,_,O6(Jh(g))),{x:_[0],y:_[1],z:_[2]}}locationPoint(c,h,g){const _=N0(h.lat,h.lng),S=Ve([],_),C=g?c._centerAltitude+g:c.elevation?c.elevation.getAtPointOrZero(c.locationCoordinate(h),c._centerAltitude):c._centerAltitude;et(_,_,S,J(1,0)*Ar*C);const L=M(new Float64Array(16));return T(L,c.pixelMatrix,c.globeMatrix),at(_,_,L),new or(_[0],_[1])}pixelsPerMeter(c,h){return J(1,0)*h}pixelSpaceConversion(c,h,g){const _=J(1,c)*h,S=$n(J(1,45)*h,_,g);return this.pixelsPerMeter(c,h)/S}createTileMatrix(c,h,g){const _=_oe(Jh(g.canonical));return T(new Float64Array(16),c.globeMatrix,_)}createInversionMatrix(c,h){const{center:g}=c,_=O6(Jh(h));return U(_,_,Hn(g.lng)),D(_,_,Hn(g.lat)),F(_,_,[c._pixelsPerMercatorPixel,c._pixelsPerMercatorPixel,1]),Float32Array.from(_)}pointCoordinate(c,h,g,_){return C0(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!C0(c,h.x,h.y,!1)}farthestPixelDistance(c){const h=function(_,S){const C=_.cameraToCenterDistance,L=_._centerAltitude*S,z=_._camera,$=_._camera.forward(),K=he([],ve([],$,-C),[0,0,L]),Z=_.worldSize/(2*Math.PI),ee=[0,0,-Z],re=_.width/_.height,ie=Math.tan(_.fovAboveCenter),ge=ve([],z.up(),ie),Se=ve([],z.right(),ie*re),Ne=Ve([],he([],he([],$,ge),Se)),Fe=[];let Ue;if(new on(K,Ne).closestPointOnSphere(ee,Z,Fe)){const Xe=he([],Fe,ee),xt=je([],Xe,K);Ue=Math.cos(_.fovAboveCenter)*pe(xt)}else{const Xe=je([],K,ee),xt=je([],ee,K);Ve(xt,xt);const mt=pe(Xe)-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=M0(c.zoom);if(g>0){const _=Ibe(c,J(1,c.center.lat)*c.worldSize),S=c.worldSize/(2*Math.PI),C=Math.max(c.width,c.height)/c.worldSize*Math.PI;return $n(h,_+S*(1-Math.cos(C)),Math.pow(g,10))}return h}upVector(c,h,g){return aM(h,g,c,1)}upVectorScale(c){return{metersToTile:Um(L6(Jh(c)))}}}function Fbe(f){const c=f.parallels,h=!!c&&Math.abs(c[0]+c[1])<.01;switch(f.name){case"mercator":return new Lbe(f);case"equirectangular":return new jGe(f);case"naturalEarth":return new NGe(f);case"equalEarth":return new wGe(f);case"winkelTripel":return new SGe(f);case"albers":return h?new Rbe(f):new bGe(f);case"lambertConformalConic":return h?new Rbe(f):new kGe(f);case"globe":return new CGe(f)}throw new Error(`Invalid projection name: ${f.name}`)}const MGe=Dt.types,TGe=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function OM(f,c,h,g,_,S,C,L,z,$,K,Z,ee){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*ee)}function DM(f,c,h){f.emplaceBack(c,h)}function RM(f,c,h,g,_,S,C){f.emplaceBack(c,h,g,_,S,C)}const hL=(f,c,h,g)=>{for(let _=0;_0&&(this.iconTransitioningVertexBuffer=c.createVertexBuffer(this.iconTransitioningVertexArray,RWe.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=c.createVertexBuffer(this.globeExtVertexArray,PWe.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||S)&&(this.zOffsetVertexBuffer=c.createVertexBuffer(this.zOffsetVertexArray,OWe.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=c.createVertexBuffer(this.orientationVertexArray,DWe.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())}}sn(gle,"SymbolBuffers");class xle{constructor(c,h,g){this.layoutVertexArray=new c,this.layoutAttributes=h,this.indexArray=new g,this.segments=new Ui,this.collisionVertexArray=new V5,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,FWe.members,!0),this.collisionVertexBufferExt=c.createVertexBuffer(this.collisionVertexArrayExt,zWe.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}sn(xle,"CollisionBuffers");class mL{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 gle(new Xh(this.layers,{zoom:this.zoom,lut:this.lut},c=>c.startsWith("text")||c.startsWith("symbol"))),this.icon=new gle(new Xh(this.layers,{zoom:this.zoom,lut:this.lut},c=>c.startsWith("icon")||c.startsWith("symbol"))),this.glyphOffsetArray=new $N,this.lineVertexArray=new T6,this.symbolInstances=new X5}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=kM[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:ee}=$,re=z.possiblyEvaluate(new ci(Z,{worldview:this.worldview}),_),ie=z.possiblyEvaluate(new ci(ee,{worldview:this.worldview}),_),ge=re.evaluate(g,{},_,S);L=ge+(ie.evaluate(g,{},_,S)-ge)*K.uSizeT}return $.kind==="source"&&(L=z.possiblyEvaluate(new ci(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!$6(this.activeReplacements,g)&&(this.activeReplacements=g,!0)}getResolvedImageFromTokens(c){return typeof c=="string"?bd.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,ee]=C.get("icon-size-scale-range"),re=ye(h.scaleFactor||1,Z,ee),ie=($.value.kind!=="constant"||$.value.value instanceof _d&&!$.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,Xe=h.availableImages,xt=new ci(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,dr=Rt(Ct,nr);if(!S._featureFilter.filter(xt,dr,g))continue;if(nr||(dr.geometry=St(Ct,g,_)),L&&Ct.type!==1&&g.z<=5){const xr=dr.geometry,Er=.98078528056,jr=(_n,Hr)=>ot(aM(_n.x,_n.y,g,1),aM(Hr.x,Hr.y,g,1)){if(!xr.getProperty("icon-image"))return;const Er=this.getCombinedIconPrimary(xr,_r,dr,g,Xe,rr,re);Er&&mt(Er)}),ur){const xr=z.evaluate(dr,{},g).join(","),Er=C.get("text-rotation-alignment")==="map"&&C.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(zu.vertical)>=0;for(const jr of ur.sections)if(jr.image){const _n=jr.image.getPrimary().scaleSelf(this.pixelRatio),Hr=_n.id.toString(),Jr=Fe.get(Hr)||[];Jr.push(_n),Fe.set(Hr,Jr)}else{const _n=r_(ur.toString()),Hr=jr.fontStack||xr,Jr=Ue[Hr]=Ue[Hr]||{};this.calculateGlyphDependencies(jr.text,Jr,Er,this.allowVerticalPlacement,_n)}}}if(C.get("symbol-placement")==="line"&&(this.features=function(wt){const Ct={},Pt={},Qt=[];let Ft=0;function nr(_r){Qt.push(wt[_r]),Ft++}function dr(_r,mr,gr){const rr=Pt[_r];return delete Pt[_r],Pt[mr]=rr,Qt[rr].geometry[0].pop(),Qt[rr].geometry[0]=Qt[rr].geometry[0].concat(gr[0]),rr}function ur(_r,mr,gr){const rr=Ct[mr];return delete Ct[mr],Ct[_r]=rr,Qt[rr].geometry[0].shift(),Qt[rr].geometry[0]=gr[0].concat(Qt[rr].geometry[0]),rr}function yr(_r,mr,gr){const rr=gr?mr[0][mr[0].length-1]:mr[0][0];return`${_r}:${rr.x}:${rr.y}`}for(let _r=0;_r_r.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"];$=MM(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 ee=0;ee=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(Xe=>Xe.isActive({globals:_,feature:Fe,canonical:c,featureState:Ne}));if(ge.activeAppearance===Ue){L+=re.numIconVertices;continue}if(Ue){ge.activeAppearance=Ue;const Xe=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(!Xe)continue;const xt=Xe.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=nL(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,dr=S.layout.get("icon-text-fit").constantOr("none");dr!=="none"&&ge.textShaping&&ge.iconTextFitPadding&&ge.fontScale&&(Pt=lle(Pt,ge.textShaping,dr,ge.iconTextFitPadding,Ct,ge.fontScale));const ur=this.calculateEffectiveAppearanceIconSize(Ue,_.zoom,Fe,c,g,Z),yr=0,_r=1+(Math.min(Ix,Math.round(ur*Kf))<<1),mr=hle(Pt,Ft,nr,dr!=="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||ee>0,Se=re>0,Ne=this.elevationFeatures[z.elevationFeatureIndex];if(Ne){const Fe=new or(z.tileAnchorX,z.tileAnchorY),Ue=.075+Ne.pointElevation(Fe);z.zOffset!==Ue&&(h=!0,z.zOffset=Ue),Ue!==0&&(this.hasAnyZOffset=!0);const Xe=Ne.computeSlopeNormal(Fe,_),xt=rn(tt(),ne(0,0,1),Xe);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&&(hL(this.text.orientationVertexArray,Z,$,K),hL(this.text.orientationVertexArray,ee,$,K)),Se){const{placedIconSymbolIndex:Fe,verticalPlacedIconSymbolIndex:Ue}=z;Fe>=0&&hL(this.icon.orientationVertexArray,re,$,K),Ue>=0&&hL(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:ee,verticalPlacedIconSymbolIndex:re}=C;ee>=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=Fbe(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,ee,re,ie,ge,Se,Ne,Fe){const Ue=c.indexArray,Xe=c.layoutVertexArray,xt=c.globeExtVertexArray,mt=c.segments.prepareSegment(4*Fe,Xe,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 dr=0;dr=0?h.rightJustifiedTextSymbolIndex:h.centerJustifiedTextSymbolIndex>=0?h.centerJustifiedTextSymbolIndex:h.leftJustifiedTextSymbolIndex>=0?h.leftJustifiedTextSymbolIndex:h.verticalPlacedTextSymbolIndex>=0?h.verticalPlacedTextSymbolIndex:_),C=cle(this.textSizeData,c,S)/jl;return this.tilePixelRatio*C}getSymbolInstanceIconSize(c,h,g){const _=this.icon.placedSymbolArray.get(g),S=cle(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 Bbe,$be,yle;sn(mL,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),mL.addDynamicAttributes=dS;class Ube{constructor(c){this.type=c.property.overrides?c.property.overrides.runtimeType:Wh,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}}sn(Ube,"FormatSectionOverride",{omit:["defaultValue"]});const vle=()=>yle||(yle={layout:Bbe||(Bbe=new to({"symbol-placement":new Sr(Bt.layout_symbol["symbol-placement"]),"symbol-spacing":new Sr(Bt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Sr(Bt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Rr(Bt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Sr(Bt.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new Sr(Bt.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new Sr(Bt.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new Sr(Bt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Sr(Bt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Sr(Bt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Sr(Bt.layout_symbol["icon-rotation-alignment"]),"icon-size":new Rr(Bt.layout_symbol["icon-size"]),"icon-size-scale-range":new Sr(Bt.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Rr(Bt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Rr(Bt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Rr(Bt.layout_symbol["icon-image"]),"icon-image-use-theme":new Sr({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new Rr(Bt.layout_symbol["icon-rotate"]),"icon-padding":new Sr(Bt.layout_symbol["icon-padding"]),"icon-keep-upright":new Sr(Bt.layout_symbol["icon-keep-upright"]),"icon-offset":new Rr(Bt.layout_symbol["icon-offset"]),"icon-anchor":new Rr(Bt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Sr(Bt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Sr(Bt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Sr(Bt.layout_symbol["text-rotation-alignment"]),"text-field":new Rr(Bt.layout_symbol["text-field"]),"text-font":new Rr(Bt.layout_symbol["text-font"]),"text-size":new Rr(Bt.layout_symbol["text-size"]),"text-size-scale-range":new Sr(Bt.layout_symbol["text-size-scale-range"]),"text-max-width":new Rr(Bt.layout_symbol["text-max-width"]),"text-line-height":new Rr(Bt.layout_symbol["text-line-height"]),"text-letter-spacing":new Rr(Bt.layout_symbol["text-letter-spacing"]),"text-justify":new Rr(Bt.layout_symbol["text-justify"]),"text-radial-offset":new Rr(Bt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Sr(Bt.layout_symbol["text-variable-anchor"]),"text-anchor":new Rr(Bt.layout_symbol["text-anchor"]),"text-max-angle":new Sr(Bt.layout_symbol["text-max-angle"]),"text-writing-mode":new Sr(Bt.layout_symbol["text-writing-mode"]),"text-rotate":new Rr(Bt.layout_symbol["text-rotate"]),"text-padding":new Sr(Bt.layout_symbol["text-padding"]),"text-keep-upright":new Sr(Bt.layout_symbol["text-keep-upright"]),"text-transform":new Rr(Bt.layout_symbol["text-transform"]),"text-offset":new Rr(Bt.layout_symbol["text-offset"]),"text-allow-overlap":new Sr(Bt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Sr(Bt.layout_symbol["text-ignore-placement"]),"text-optional":new Sr(Bt.layout_symbol["text-optional"]),visibility:new Sr(Bt.layout_symbol.visibility)})),paint:$be||($be=new to({"icon-opacity":new Rr(Bt.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Rr(Bt.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Rr(Bt.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Rr(Bt.paint_symbol["text-emissive-strength"]),"icon-color":new Rr(Bt.paint_symbol["icon-color"]),"icon-halo-color":new Rr(Bt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Rr(Bt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Rr(Bt.paint_symbol["icon-halo-blur"]),"icon-translate":new Sr(Bt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Sr(Bt.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new Sr(Bt.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Rr(Bt.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Rr(Bt.paint_symbol["text-occlusion-opacity"]),"text-color":new Rr(Bt.paint_symbol["text-color"],{runtimeType:Gd,getOverride:f=>f.textColor,hasOverride:f=>!!f.textColor}),"text-halo-color":new Rr(Bt.paint_symbol["text-halo-color"]),"text-halo-width":new Rr(Bt.paint_symbol["text-halo-width"]),"text-halo-blur":new Rr(Bt.paint_symbol["text-halo-blur"]),"text-translate":new Sr(Bt.paint_symbol["text-translate"]),"text-translate-anchor":new Sr(Bt.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new Sr(Bt.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new Sr(Bt.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new Sr(Bt.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new Sr(Bt.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Rr(Bt.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Rr({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Rr({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Rr({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Rr({type:"string",default:"default","property-type":"data-driven"})}))},yle);class fL extends kd{constructor(c,h,g,_){super(c,vle(),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,ee=[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($,$,ee),$}(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:zbe(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:zbe(g.properties,L)}createBucket(c){return new mL(c)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const c of vle().paint.overridableProperties){if(!fL.hasPaintOverride(this.layout,c))continue;const h=this.paint.get(c),g=new Ube(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 g0("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())&&fL.hasPaintOverride(this.layout,c)}static hasPaintOverride(c,h){const g=c.get("text-field"),_=vle().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 _d)C(g.value.value.sections);else if(g.value.kind==="source"){const L=$=>{S||($ instanceof If&&wl($.value)===zv?C($.value.sections):$ instanceof Lm?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 qbe,Vbe,Hbe,Wbe;var _le=$s([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function pL(f,c,h,g,_,S,C,L){const z=[f,c,1,h,g,1,_,S,1],$=[C,L,1],K=v([],z),[Z,ee,re]=le($,$,K);return b(z,z,[Z,0,0,0,ee,0,0,0,re])}function Gbe(f,c,h,g,_,S,C,L){const z=function($,K,Z,ee,re,ie,ge,Se){const Ne=pL(0,0,1,0,1,1,0,1),Fe=pL($,K,Z,ee,re,ie,ge,Se);return b(Fe,Fe,v([],Ne))}(f,c,h,g,_,S,C,L);return[z[2]/z[8]/Ar,z[5]/z[8]/Ar]}function gL(f){return[f[0],Math.min(Math.max(f[1],-fe),fe)]}class Kbe extends Ls{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 Pr("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return c&&(this.coordinates=c),this._loaded=!0,void this._finishLoading();this._imageRequest=t0(this.map._requestManager.transformRequest(this.url,Af.Image),(g,_)=>{this._imageRequest=null,this._loaded=!0,g?this.fire(new as(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 bM(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 Pr("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 bM||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]fe?this.onNorthPole=!0:_<-fe&&(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),ee=Math.max(0,Math.floor(-Math.log2(Z))),re=Math.pow(2,ee);let ie=Math.floor((L+$)/2*re);return ie>1&&(ie-=1),new ti(ee,ie,Math.floor((z+K)/2*re))}(S),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Pr("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof bM||(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=AM(new ti(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,Xe=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-Xe*Ue,Ft=Xe*wt-mt*xt,nr=mt*Pt-Ct*wt,dr=Ct*Ue-Fe*Pt;return Qt>0&&Ft>0&&nr>0&&dr>0||Qt<0&&Ft<0&&nr<0&&dr<0}(g))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const _=AM(this.tileID,this.map.transform.projection),[S,C,L,z]=this.coordinates.map(Ne=>{const Fe=_.projection.project(Ne[0],Ne[1]);return Pbe(_,Fe)._round()});this.perspectiveTransform=Gbe(S.x,S.y,C.x,C.y,L.x,L.y,z.x,z.y);const $=this._boundsArray=new _0;$.emplaceBack(S.x,S.y,0,0),$.emplaceBack(C.x,C.y,Ar,0),$.emplaceBack(z.x,z.y,0,Ar),$.emplaceBack(L.x,L.y,Ar,Ar),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=c.createVertexBuffer($,_le.members),this.boundsSegments=Ui.simpleSegment(0,0,4,2);const K=[],Z=[gL((ee=this.coordinates)[0]),gL(ee[1]),gL(ee[2]),gL(ee[3])];var ee;const[re,ie,ge,Se]=function(Ne){let Fe=Ne[0][0],Ue=Fe,Xe=Ne[0][1],xt=Xe;for(let mt=1;mtUe&&(Ue=Ne[mt][0]),Ne[mt][1]xt&&(xt=Ne[mt][1]);return[Fe,Xe,Ue-Fe,xt-Xe]}(Z);{const Ne=new _0,[Fe,Ue,Xe,xt]=function(mr){let gr=mr[0].x,rr=gr,Jt=mr[0].y,xr=Jt;for(let Er=1;Errr&&(rr=mr[Er].x),mr[Er].yxr&&(xr=mr[Er].y);return[gr,Jt,rr-gr,xr-Jt]}(g),mt=mr=>[(mr.x-Fe)/Xe,(mr.y-Ue)/xt],[wt,Ct,Pt,Qt]=g.map(mt),Ft=function(mr,gr,rr,Jt,xr,Er,jr,_n){const Hr=pL(0,0,1,0,1,1,0,1);return b(Hr,Hr,v([],pL(mr,gr,rr,Jt,xr,Er,jr,_n)))}(wt[0],wt[1],Ct[0],Ct[1],Pt[0],Pt[1],Qt[0],Qt[1]);this.elevatedGlobePerspectiveTransform=Gbe(wt[0],wt[1],Ct[0],Ct[1],Pt[0],Pt[1],Qt[0],Qt[1]);const nr=(mr,gr)=>{K.push(mr.lng);const rr=Math.round((mr.lng-re)/ge*Ar),Jt=Math.round((mr.lat-ie)/Se*Ar),xr=mt(gr),Er=le([],[xr[0],xr[1],1],Ft),jr=Math.round(Er[0]/Er[2]*Ar),_n=Math.round(Er[1]/Er[2]*Ar);Ne.emplaceBack(rr,Jt,jr,_n)},dr=g[3].x-g[0].x,ur=g[3].y-g[0].y,yr=g[2].x-g[1].x,_r=g[2].y-g[1].y;for(let mr=0;mr<65;mr++){const gr=mr/64,rr=[g[0].x+gr*dr,g[0].y+gr*ur],Jt=[g[1].x+gr*yr,g[1].y+gr*_r],xr=Jt[0]-rr[0],Er=Jt[1]-rr[1];for(let jr=0;jr<65;jr++){const _n=jr/64,Hr={x:rr[0]+xr*_n,y:rr[1]+Er*_n};nr(h.projection.unproject(Hr.x,Hr.y),Hr)}}this.elevatedGlobeVertexBuffer=c.createVertexBuffer(Ne,_le.members)}{this.maxLongitudeTriangleSize=0;let Ne=[],Fe=new Qo;const Ue=(Xe,xt,mt)=>{Fe.emplaceBack(Xe,xt,mt);const wt=K[Xe],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 Xe=0;Xe<64;Xe++)for(let xt=0;xt<64;xt++){const mt=65*Xe+xt,wt=mt+1,Ct=mt+65,Pt=Ct+1;Ue(mt,Ct,wt),Ue(wt,Ct,Pt)}[Ne,Fe]=function(Xe,xt){const mt=Array.from({length:Xe.length},(Pt,Qt)=>Qt);mt.sort((Pt,Qt)=>Xe[Pt]-Xe[Qt]);const wt=[],Ct=new Qo;for(let Pt=0;Pt{C.segments.push({vertexOffset:0,primitiveOffset:Z,vertexLength:h.segments[0].vertexLength,primitiveLength:ee,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,To(g,Z+1,g.length,_+360-z)-Z),C}_Ar?_-Ar:_,new or(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 jle{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 ci(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),Z,g))continue;const ee={id:K,sourceLayerIndex:$,index:z,geometry:S?Z.geometry:St(C,g,_),properties:C.properties,type:C.type,patterns:{}},re=this.addFeature(ee,ee.geometry,Z);re&&h.featureIndex.insert(C,ee.geometry,z,$,this.index,this.instancesPerModel[re].instancedDataArray.length,Ar/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(Ar,Math.max(L/this.tileToMeter,Ar/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);rt(_.rotation,z)&&rt(_.scale,$)&&rt(_.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($6(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,ee=K.instancedDataCount;for(let re=0;reAr;ge=Se?ge-Ar:ge;const Ne=Math.floor(ge),Fe=Math.floor($.float32[ie+1]);let Ue=!1;for(const Xe of this.activeReplacements)if(!Vve(Xe,g,r2e.Model,_)&&!(Xe.min.x>Ne||Ne>Xe.max.x||Xe.min.y>Fe||Fe>Xe.max.y)&&(Ue=Zve(Kve(Ne,Fe,c.canonical,Xe.footprintTileId.canonical),Xe.footprint),Ue))break;$.float32[ie]=Ue?ge+Ar: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,tWe.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;(wle(S,!1)||this.styleDefinedModelURLs[S]!==void 0)&&(this.modelUris.includes(S)||this.modelUris.push(S)),this.instancesPerModel[S]||(this.instancesPerModel[S]=new s2e);const C=this.instancesPerModel[S],L=C.instancedDataArray,z=new n2e(g,L.length);for(const $ of h)for(const K of $){if(K.x<0||K.x>=Ar||K.y<0||K.y>=Ar)continue;if(this.lookupDim!==0){const ee=(this.lookupDim-1)/Ar,re=this.lookupDim*(K.y*ee|0)+K.x*ee|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 ee=[];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])),O_e(ee,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]+Xe,Ue[Fe+7]=ee[0],Ue[Fe+8]=ee[1],Ue[Fe+9]=ee[2],Ue[Fe+10]=ee[4],Ue[Fe+11]=ee[5],Ue[Fe+12]=ee[6],Ue[Fe+13]=ee[8],Ue[Fe+14]=ee[9],Ue[Fe+15]=ee[10],g.instancesEvaluatedElevation[Ne]=K[2]}}}let a2e,i2e;sn(jle,"ModelBucket",{omit:["layers"]}),sn(s2e,"PerModelAttributes"),sn(n2e,"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 d2e($)),l2e($,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(!La(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(_):Koe(_,c,!0)}for(const g of h)J6(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||FM(g.paint.get("model-color").value,C)||FM(g.paint.get("model-color-mix-intensity").value,C)||FM(g.paint.get("model-roughness").value,C)||FM(g.paint.get("model-emissive-strength").value,C)||FM(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(La(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 mr=kle[_r],gr=Math.abs(mr);gr>Ft&&(Qt=mr,Ft=gr,nr=yr,dr=ur)}if(Ft>.1){const ur=1-(mt+.5*Math.abs(nr*dr))/ie;let yr=h._dem.get(Ct,wt)+Qt*ur;const _r=h._dem.get(Ct+nr,wt+dr),mr=h._dem.get(Ct-nr,wt-dr,!0);(yr-_r)*(yr-mr)>0&&(yr=(_r+mr)/2),kle[Pt]=h._dem.set(Ct,wt,yr),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 ci(this.id.overscaledZ,{worldview:this.worldview}),c.feature,this.id.canonical)):this.nodesInfo}destroy(){const c=this.getNodesInfo();for(const h of c)J6(h.node),Zoe(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 or(c,h),new or(c,h),g),g.length>0)return{height:void 0,maxHeight:C.feature.properties.height,hidden:C.hiddenByReplacement,verticalScale:C.evaluatedScale[2]}}}}function FM(f,c){return f instanceof g0&&!f.isLightConstant&&c}function PGe(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=$n(z,255*h[0],h[3]),$=$n($,255*h[1],h[3]),K=$n(K,255*h[2],h[3]));const Z=z<<8|$,ee=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,Xe,xt;if(ie!==ge&&C!==S&&ge!==ie){const mt=C-S;Ue=1/(mt*(ge-ie)),Xe=-(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,Xe=1,xt=1;if(f.emplaceBack(Z,ee,re,Fe,Ue,Xe,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,ee=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)),PGe(C.featureArray,$,re,ee,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(),_++}}sn(yL,"Tiled3dModelBucket",{omit:["layers"]}),sn(d2e,"Tiled3dModelFeature");const OGe=["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 OGe)this[h]!==void 0&&(c[h]=this[h]);return c}}class k_ extends Ls{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=E_e(this.map._requestManager.transformRequest(g.uri,Af.Model).url).then(C=>{if(!C)return;const L=Xoe(C),z=new D_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 as(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 Pr("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(h=>{this._loaded=!0,this.fire(new as(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 ka(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=Yh(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 Nle(f,c,h,g){const _=1<Xe.polygon).flat());const Se=re?L:null,[Ne,Fe]=v_e(S,g,Z,K,$,C,Se,ee,ie,S.center.lat,f.tileID.canonical),Ue=f.queryGeometry;return y_e(Ne,Fe,Ue.isPointQuery()?Ue.screenBounds:Ue.screenGeometry)}},building:class extends kd{constructor(f,c,h,g){super(f,{layout:q_e||(q_e=new to({visibility:new Sr(Bt.layout_building.visibility),"building-facade":new Rr(Bt.layout_building["building-facade"]),"building-facade-floors":new Rr(Bt.layout_building["building-facade-floors"]),"building-facade-unit-width":new Rr(Bt.layout_building["building-facade-unit-width"]),"building-facade-window":new Rr(Bt.layout_building["building-facade-window"]),"building-roof-shape":new Rr(Bt.layout_building["building-roof-shape"]),"building-height":new Rr(Bt.layout_building["building-height"]),"building-base":new Rr(Bt.layout_building["building-base"]),"building-flood-light-wall-radius":new Rr(Bt.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new Rr(Bt.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new Rr(Bt.layout_building["building-flip-roof-orientation"])})),paint:V_e||(V_e=new to({"building-opacity":new Sr(Bt.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new Sr(Bt.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new Sr(Bt.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new Sr(Bt.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new Sr(Bt.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new Sr(Bt.paint_building["building-vertical-scale"]),"building-cast-shadows":new Sr(Bt.paint_building["building-cast-shadows"]),"building-color":new Rr(Bt.paint_building["building-color"]),"building-emissive-strength":new Rr(Bt.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new Sr(Bt.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new Sr(Bt.paint_building["building-cutoff-fade-range"]),"building-flood-light-color":new Sr(Bt.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new Sr(Bt.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new Sr(Bt.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new Rr({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new Rr({type:"string",default:"default","property-type":"data-driven"})}))},c,h,g),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(f){return new U_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[ee,re]=v_e(S,g,K,$,new or(0,0),C,null,[0,0],1,S.center.lat,f.tileID.canonical),ie=f.queryGeometry;return y_e(ee,re,ie.isPointQuery()?ie.screenBounds:ie.screenGeometry)}},line:class extends kd{constructor(f,c,h,g){const _=ebe();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(jM)return jM;const h=ebe();return jM=new EWe(h.paint.properties["line-width"].specification),jM.useIntegerZoom=!0,jM})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,f)}createBucket(f){return new ele(f)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(f,c,h){const g=Q_e(this);return{config:new cg(this,{zoom:c,lut:h}),defines:g,overrideFog:!1}}queryRadius(f){const c=f,h=tbe(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*tbe(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=[],ee=new or(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 YGe(f,c,h){f===1?(c.rgb_color=wL(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 XGe(f,c,h){f===1?c.transform=bL(h,h.readVarint()+h.pos):f===2?c.spread_method=h.readVarint():f===3?c.stops.push(f2e(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 f2e(f,c){return f.readFields(QGe,{offset:0,opacity:255,rgb_color:Sle},c)}function QGe(f,c,h){f===1?c.offset=h.readFloat():f===2?c.opacity=h.readVarint():f===3&&(c.rgb_color=wL(h.readVarint()))}function JGe(f,c,h){f===1?c.transform=bL(h,h.readVarint()+h.pos):f===2?c.spread_method=h.readVarint():f===3?c.stops.push(f2e(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 eKe(f,c,h){f===1?c.transform=bL(h,h.readVarint()+h.pos):f===2?c.clip_path_idx=h.readVarint():f===3&&c.children.push(_L(h,h.readVarint()+h.pos))}function tKe(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(_L(h,h.readVarint()+h.pos))}class rKe{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 ka(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 BM(f,c){if(!hh()){const h=document.createElement("canvas");return h.width=f,h.height=c,h}return new OffscreenCanvas(f,c)}let Tle,$M=null;function Ale(f,c,h,g,_){for(const S of g.children)p2e(f,c,h,S,_)}function p2e(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 Ale(S,C,L,z,$);const ee=BM(S.canvas.width,S.canvas.height),re=ee.getContext("2d");Ale(re,C,L,z,$),Z&&w2e(re,C,L,Z),K&&j2e(re,C,L,K,$),S.globalAlpha=z.opacity/255,S.drawImage(ee,0,0)}(f,c,h,g.group,_),f.restore()):g.path&&(f.save(),function(S,C,L,z,$){S.setTransform(C),z.paint_order===FGe.PAINT_ORDER_FILL_AND_STROKE?(g2e(S,L,z,$),y2e(S,L,z,$)):(y2e(S,L,z,$),g2e(S,L,z,$))}(f,c,h,g.path,_),f.restore())}function g2e(f,c,h,g){const _=h.fill;if(!_)return;const S=_.opacity/255;switch(f.save(),f.beginPath(),k2e(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=v2e(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=_2e(f,C,S,g)}}f.fill(x2e(h)),f.restore()}function x2e(f){return f.rule===Cle.PATH_RULE_NON_ZERO?"nonzero":f.rule===Cle.PATH_RULE_EVEN_ODD?"evenodd":void 0}function y2e(f,c,h,g){const _=h.stroke;if(!_)return;const S=N2e(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=v2e(f,c.linear_gradients[_.linear_gradient_idx],C,g,!0);break;case"radial_gradient_idx":f.strokeStyle=_2e(f,c.radial_gradients[_.radial_gradient_idx],C,g,!0)}switch(_.linejoin){case vL.LINE_JOIN_MITER_CLIP:case vL.LINE_JOIN_MITER:f.lineJoin="miter";break;case vL.LINE_JOIN_ROUND:f.lineJoin="round";break;case vL.LINE_JOIN_BEVEL:f.lineJoin="bevel"}switch(_.linecap){case Mle.LINE_CAP_BUTT:f.lineCap="butt";break;case Mle.LINE_CAP_ROUND:f.lineCap="round";break;case Mle.LINE_CAP_SQUARE:f.lineCap="square"}f.stroke(S)}function v2e(f,c,h,g,_=!1){if(c.stops.length===1){const ee=c.stops[0];return hS(ee.rgb_color,ee.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 ee=mS(c.transform);$=ee.transformPoint($),K=ee.transformPoint(K)}const Z=f.createLinearGradient($.x,$.y,K.x,K.y);for(const ee of c.stops)Z.addColorStop(ee.offset,hS(ee.rgb_color,ee.opacity*h,g));return Z}function _2e(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 ee=new DOMPoint(C,L),re=new DOMPoint($,K),ie=z,ge=Z;if(_){ee=S.transformPoint(ee),re=S.transformPoint(re);const Ne=(S.a+S.d)/2;ie=z*Ne,ge=c.r*Ne}const Se=f.createRadialGradient(ee.x,ee.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 b2e(f,c,h,g){const _=g.transform?mS(g.transform).preMultiplySelf(c):c,S=BM(f.canvas.width,f.canvas.height),C=S.getContext("2d");for(const z of g.children)if(z.group)b2e(C,_,h,z.group);else if(z.path){const $=z.path,K=new Path2D;K.addPath(N2e($),_),C.fill(K,x2e($))}const L=g.clip_path_idx!=null?h.clip_paths[g.clip_path_idx]:null;L&&w2e(C,_,h,L),f.globalCompositeOperation="source-over",f.drawImage(S,0,0)}function w2e(f,c,h,g){const _=BM(f.canvas.width,f.canvas.height);b2e(_.getContext("2d"),c,h,g),f.globalCompositeOperation="destination-in",f.drawImage(_,0,0)}function j2e(f,c,h,g,_){if(g.children.length===0)return;const S=g.mask_idx!=null?h.masks[g.mask_idx]:null;S&&j2e(f,c,h,S,_);const C=f.canvas.width,L=f.canvas.height,z=BM(C,L),$=z.getContext("2d"),K=g.width,Z=g.height,ee=g.left,re=g.top,ie=new Path2D,ge=new Path2D;ge.rect(ee,re,K,Z),ie.addPath(ge,c),$.clip(ie);for(const Fe of g.children)p2e($,c,h,Fe,_);const Se=$.getImageData(0,0,C,L),Ne=Se.data;if(g.mask_type===u2e.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 M2e(f,c,h,g,_,S,C,L,z,$,K){const Z=g-f,ee=_-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,Xe=Z*Ne+ee*Fe+re*Ue;if(Math.abs(Xe)<1e-15)return null;const xt=1/Xe,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*ee,Ft=Ct*Z-mt*re,nr=mt*ee-wt*Z,dr=(K[0]*Qt+K[1]*Ft+K[2]*nr)*xt;return dr<0||Pt+dr>1?null:(ie*Qt+ge*Ft+Se*nr)*xt}function T2e(f,c,h){return(f-c)/(h-c)}function A2e(f,c,h,g,_,S,C,L,z){const $=1<{const Fe=Se?1:0,Ue=(re+1)*ge-Fe,Xe=ie*ge,xt=(ie+1)*ge-Fe;Ne[0]=re*ge,Ne[1]=Xe,Ne[2]=Ue,Ne[3]=xt};let Z=new S2e(z);const ee=[];for(let re=0;re=1;z/=2){const re=L[L.length-1];Z=new S2e(z);for(let ie=0;ie0;){const{idx:ie,t:ge,nodex:Se,nodey:Ne,depth:Fe}=re.pop();if(this.leaves[ie]){A2e(Se,Ne,Fe,c,h,g,_,Z,ee);const Xe=1<=_r[2])return ge}continue}let Ue=0;for(let Xe=0;Xe=$[K[Ct]]&&(K.splice(Ct,0,Xe),wt=!0);wt||(K[Ue]=Xe),Ue++}}for(let Xe=0;Xe=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],_=kL.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 Sve({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 gKe(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}"`)}}sn(kL,"DEMData"),sn(E2e,"DemMinMaxQuadTree",{omit:["dem"]});var em=Uint8Array,UM=Uint16Array,xKe=Int32Array,P2e=new em([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]),L2e=new em([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]),yKe=new em([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),O2e=function(f,c){for(var h=new UM(31),g=0;g<31;++g)h[g]=c+=1<>1|(21845&ul)<<1;F2e[ul]=((65280&(fS=(61680&(fS=(52428&fS)>>2|(13107&fS)<<2))>>4|(3855&fS)<<4))>>8|(255&fS)<<8)>>1}var qM=function(f,c,h){for(var g=f.length,_=0,S=new UM(c);_>z]=$;return C},VM=new em(288);for(ul=0;ul<144;++ul)VM[ul]=8;for(ul=144;ul<256;++ul)VM[ul]=9;for(ul=256;ul<280;++ul)VM[ul]=7;for(ul=280;ul<288;++ul)VM[ul]=8;var z2e=new em(32);for(ul=0;ul<32;++ul)z2e[ul]=5;var bKe=qM(VM,9),wKe=qM(z2e,5),Ile=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},Ple=function(f,c){var h=c/8|0;return(f[h]|f[h+1]<<8|f[h+2]<<16)>>(7&c)},jKe=["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||jKe[f]);if(g.code=f,Error.captureStackTrace&&Error.captureStackTrace(g,Xf),!h)throw g;return g},kKe=new em(0),NKe=typeof TextDecoder<"u"&&new TextDecoder;try{NKe.decode(kKe,{stream:!0})}catch{}const SKe={gzip_data:"gzip"};class qm extends Error{constructor(c){super(c),this.name="MRTError"}}const CKe={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},B2e={uint32:1,uint16:2,uint8:4},MKe={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let Lle;class NL{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 qm(`Layer '${c}' not found`);return h}getHeaderLength(c){const h=new Uint8Array(c),g=new DataView(c);if(h[0]!==13)throw new qm("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 Lle(h.subarray(0,g)).readFields(iKe,{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 qm(`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 $2e(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 U2e(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 $2e{constructor({version:c,name:h,units:g,tileSize:_,pixelFormat:S,buffer:C,dataIndex:L},z){if(this.version=c,this.version!==1)throw new qm(`Cannot parse raster layer encoded with MRT version ${c}`);this.name=h,this.units=g,this.tileSize=_,this.buffer=C,this.pixelFormat=CKe[S],this.dataIndex=L,this.bandShape=[_+2*C,_+2*C,B2e[this.pixelFormat]],this._decodedBlocks=new jL(z?z.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return B2e[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 qm(`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 qm(`Band not found: ${JSON.stringify(c)}`);const _=this._decodedBlocks.get(h.toString());if(!_)throw new qm(`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}}}NL.setPbf=function(f){Lle=f};class U2e{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)}}NL.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,ee=h.subarray(S,C+1),re=new Uint32Array(z[0]*z[1]*z[2]);let ie;if(Z!=="gzip_data")throw new qm(`Unhandled codec: ${Z}`);return ie=function(ge,Se){if(!globalThis.DecompressionStream&&Se==="gzip_data")return Promise.resolve(((Xe=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 em(0);var nr=!Pt,dr=nr||Ct.i!=2,ur=Ct.i;nr&&(Pt=new em(3*Ft));var yr,_r,mr=function(Za){var Sa=Pt.length;if(Za>Sa){var Ea=new em(Math.max(2*Sa,Za));Ea.set(Pt),Pt=Ea}},gr=Ct.f||0,rr=Ct.p||0,Jt=Ct.b||0,xr=Ct.l,Er=Ct.d,jr=Ct.m,_n=Ct.n,Hr=8*Ft;do{if(!xr){gr=Yf(wt,rr,1);var Jr=Yf(wt,rr+1,3);if(rr+=3,!Jr){var un=wt[(sr=4+((rr+7)/8|0))-4]|wt[sr-3]<<8,js=sr+un;if(js>Ft){ur&&Xf(0);break}dr&&mr(Jt+un),Pt.set(wt.subarray(sr,js),Jt),Ct.b=Jt+=un,Ct.p=rr=8*js,Ct.f=gr;continue}if(Jr==1)xr=bKe,Er=wKe,jr=9,_n=5;else if(Jr==2){var kr=Yf(wt,rr,31)+257,mn=Yf(wt,rr+10,15)+4,Yn=kr+Yf(wt,rr+5,31)+1;rr+=14;for(var Ks=new em(Yn),Js=new em(19),hs=0;hs>4)<16)Ks[hs++]=sr;else{var $r=0,Ur=0;for(sr==16?(Ur=3+Yf(wt,rr,3),rr+=2,$r=Ks[hs-1]):sr==17?(Ur=3+Yf(wt,rr,7),rr+=3):sr==18&&(Ur=11+Yf(wt,rr,127),rr+=7);Ur--;)Ks[hs++]=$r}}var wn=Ks.subarray(0,kr),Nn=Ks.subarray(kr);jr=Ile(wn),_n=Ile(Nn),xr=qM(wn,jr),Er=qM(Nn,_n)}else Xf(1);if(rr>Hr){ur&&Xf(0);break}}dr&&mr(Jt+131072);for(var ls=(1<>4;if((rr+=15&$r)>Hr){ur&&Xf(0);break}if($r||Xf(2),Us<256)Pt[Jt++]=Us;else{if(Us==256){ws=rr,xr=null;break}var Dn=Us-254;Us>264&&(Dn=Yf(wt,rr,(1<<(pa=P2e[hs=Us-257]))-1)+R2e[hs],rr+=pa);var Kn=Er[Ple(wt,rr)&ys],da=Kn>>4;if(Kn||Xf(3),rr+=15&Kn,Nn=_Ke[da],da>3){var pa=L2e[da];Nn+=Ple(wt,rr)&(1<Hr){ur&&Xf(0);break}dr&&mr(Jt+131072);var ga=Jt+Dn;if(Jtyr.length)&&(_r=yr.length),new em(yr.subarray(0,_r))):Pt.subarray(0,Jt)}(Ue.subarray(Xe,-8),{i:2},new em(((Ne=Ue)[(Fe=Ne.length)-4]|Ne[Fe-3]<<8|Ne[Fe-2]<<16|Ne[Fe-1]<<24)>>>0))));var Ne,Fe,Ue,Xe;const xt=SKe[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))}(ee,Z).then(ge=>(function(Se,Ne){Se.readFields(hKe,Ne)}(new Lle(ge),re),new MKe[L](re.buffer))),ie.then(ge=>{for(let Se=K.length-1;Se>=0;Se--)switch(K[Se]){case"delta_filter":fKe(ge,z);break;case"zigzag_filter":pKe(ge);break;case"bitshuffle_filter":gKe(ge,L);break;default:throw new qm(`Unhandled filter "${K[Se]}"`)}return{layerName:_,blockIndex:$,data:ge}}).catch(ge=>{throw ge})}))},sn(U2e,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),sn(NL,"MapboxRasterTile"),sn($2e,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class q2e{constructor(c){this._stringToNumber={},this._numberToString=[];for(let h=0;h=0&&ee[3]>=0&&$.insert(z,ee[0],ee[1],ee[2],ee[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Vt(new tL(this.rawTileData)).layers,this.sourceLayerCoder=new q2e(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)=>Nd(g.bufferedTilespaceGeometry,ge-$,Se-$,Ne+$,Fe+$));Z.sort(TKe);let ee=null;_.elevation&&Z.length>0&&(ee=uS.create(_.elevation,this.tileID));const re={};let ie;for(let ge=0;ge(Fe||(Fe=St(Ue,this.tileID.canonical,S)),Xe.queryIntersectsFeature(g,Ue,xt,Fe,this.z,_,C,ee,mt)))}return re}loadMatchingFeature(c,h,g,_,S,C){const{featureIndex:L,bucketIndex:z,sourceLayerIndex:$,layoutVertexArrayOffset:K}=h,Z=this.bucketLayerIDs[z],ee=g.layers,re=Object.keys(ee);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 H2e(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 TKe(f,c){return c-f}sn(V2e,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const W2e=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Ole{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=W2e[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 Ole(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=W2e.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 Dle(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,ee=z.pop()||0;if(Z-ee<=L){for(let Se=ee;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=ee+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(ee),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,ee=L.pop()||0;if(Z-ee<=C){for(let Se=ee;Se<=Z;Se++)K2e(S[2*Se],S[2*Se+1],c,h)<=$&&z.push(_[Se]);continue}const re=ee+Z>>1,ie=S[2*re],ge=S[2*re+1];K2e(ie,ge,c,h)<=$&&z.push(_[re]),(K===0?c-g<=ie:h-g<=ge)&&(L.push(ee),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 Dle(f,c,h,g,_,S){if(_-g<=h)return;const C=g+_>>1;G2e(f,c,C,g,_,S),Dle(f,c,h,g,C-1,1-S),Dle(f,c,h,C+1,_,1-S)}function G2e(f,c,h,g,_,S){for(;_>g;){if(_-g>600){const $=_-g+1,K=h-g+1,Z=Math.log($),ee=.5*Math.exp(2*Z/3),re=.5*Math.sqrt(Z*ee*($-ee)/$)*(K-$/2<0?-1:1);G2e(f,c,h,Math.max(g,Math.floor(h-K*ee/$+re)),Math.min(_,Math.floor(h+($-K)*ee/$+re)),S)}const C=c[2*h+S];let L=g,z=_;for(HM(f,c,g,h),c[2*_+S]>C&&HM(f,c,g,_);LC;)z--}c[2*g+S]===C?HM(f,c,g,z):(z++,HM(f,c,z,_)),z<=h&&(g=z+1),h<=z&&(_=z-1)}}function HM(f,c,h,g){Rle(f,h,g),Rle(c,2*h,2*g),Rle(c,2*h+1,2*g+1)}function Rle(f,c,h){const g=f[c];f[c]=f[h],f[h]=g}function K2e(f,c,h,g){const _=f-h,S=c-g;return _*_+S*S}i.$=Hk,i.A=Ef,i.B=Yh,i.C=2,i.D=QN,i.E=Ls,i.F=SM,i.G=_be,i.H=Vk,i.I=ja,i.J=x6,i.K=vn,i.L=s0,i.M=pN,i.N=Jv,i.O=s6,i.P=or,i.Q=e_,i.R=Af,i.S=NN,i.T=Hoe,i.U=sg,i.V=xL,i.W=P5,i.X=c0,i.Y=l0,i.Z=Gv,i._=wd,i.a=function(f){return Ps.API_CDN_URL_REGEX.test(f)},i.a$=ue,i.a0=Gn,i.a1=Il,i.a2=Fm,i.a3=class extends xL{},i.a4=gN,i.a5=n6,i.a6=Bt,i.a7=function(f){const c=f.value;return c?Gn(c)?wle(c,!0)?[]:[new xL(f.key,c,`invalid url "${c}"`)]:[new xL(f.key,c,`string expected, "${vn(c)}" found`)]:[]},i.a8=m6,i.a9=to,i.aA=ye,i.aB=T,i.aC=Ke,i.aD=Pc,i.aE=ei,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 tL(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=vd,i.aO=function(f){Jc++,Jc>Qy&&(f.getActor().send("enforceCacheSizeLimit",Xy),Jc=0)},i.aP=function(f){return f<=1?1:Math.pow(2,Math.floor(Math.log2(f)))},i.aQ=Yi,i.aR=Zbe,i.aS=t2e,i.aT=p,i.aU=Kbe,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=bM,i.aX=k_,i.aY=Lt,i.aZ=AM,i.a_=te,i.aa=Sr,i.ab=class{constructor(f){this.specification=f}possiblyEvaluate(f,c){return ns(f.expression.evaluate(c))}interpolate(f,c,h){return{x:$n(f.x,c.x,h),y:$n(f.y,c.y,h),z:$n(f.z,c.z,h),azimuthal:$n(f.azimuthal,c.azimuthal,h),polar:$n(f.polar,c.polar,h)}}},i.ac=ci,i.ad=vx,i.ae=We,i.af=at,i.ag=pe,i.ah=Pe,i.ai=wx,i.aj=M0,i.ak=$n,i.al=Ar,i.am=r5,i.an=Hn,i.ao=ka,i.ap=class{constructor(f){this.specification=f}possiblyEvaluate(f,c){return function([h,g]){const _=ns([1,h,g]);return{x:_.x,y:_.y,z:_.z}}(f.expression.evaluate(c))}interpolate(f,c,h){return{x:$n(f.x,c.x,h),y:$n(f.y,c.y,h),z:$n(f.z,c.z,h)}}},i.aq=function(f,c,h=0,g=!0){const _=new or(h,h),S=f.sub(_),C=c.add(_),L=[S,new or(C.x,S.y),C,new or(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,ee=(L*Z-$.tileID.canonical.x)*K.dim,re=(f.y*Z-$.tileID.canonical.y)*K.dim,ie=Math.floor(ee),ge=Math.floor(re);return(h?this.exaggeration():1)*$n($n(K.get(ie,ge),K.get(ie,ge+1),re-ge),$n(K.get(ie+1,ge),K.get(ie+1,ge+1),re-ge),ee-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=Zve,i.c1=ile,i.c2=Cbe,i.c3=fle,i.c4=Ole,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=de,i.cB=Na,i.cC=P_e,i.cD=ti,i.cE=dve,i.cF=function(f,c,h,g,_,S,C,L,z){if(z.name==="globe")return dve(f,c,new ti(h,g,_),!1);const $=AM({z:h,x:g,y:_},z);return new yn([(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=fe,i.cK=Ye,i.cL=ZN,i.cM=function(f){const c=M(new Float64Array(16));T(c,f.pixelMatrix,f.globeMatrix);const h=[0,yh,0],g=[0,vh,0];return at(h,h,c),at(g,g,c),[h[0]>0&&h[0]<=f.width&&h[1]>0&&h[1]<=f.height&&!woe(f,new p(f.center.lat,90)),g[0]>0&&g[0]<=f.width&&g[1]>0&&g[1]<=f.height&&!woe(f,new p(f.center.lat,-90))]},i.cN=function(f,c){const{scale:h}=f.tileTransform,g=h*Ar/(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=Z6,i.cP=oe,i.cQ=I_e,i.cR=function(f){const c=I_e(f,!0);return x([],[c[0],c[1],c[4],c[5]])},i.cS=F,i.cT=Vr,i.cU=D,i.cV=function(f){const{x:c,y:h}=f.point,{lng:g,lat:_}=f._center;return mve(c,h,f.worldSize,g,_)},i.cW=Te,i.cX=Ki,i.cY=Vi,i.cZ=fc,i.c_=xh,i.ca=wa,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=J,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=$m,i.cl=u_,i.cm=Fbe,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=rt,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=Br,i.ct=qe,i.cu=Ao,i.cv=3,i.cw=2,i.cx=7,i.cy=6,i.cz=Oe,i.d=function(f){return Ps.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,qoe(this.format),Voe(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)*ji:0;let S=f!==0||c!==0?Math.atan2(-c,-f)*ji+90:0;return S<0&&(S+=360),[g,S,_]},i.d5=ne,i.d6=ns,i.d7=De,i.d8=he,i.d9=yn,i.dA=function(f){return f({pluginStatus:jd,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=M0(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/J(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=P6,i.dH=function(f){const c=fe-5;f=ye(f,-c,c)/c*90;const h=Math.pow(Math.abs(Math.sin(Hn(f))),3);return Math.round(h*(sM.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/ee,1])}return re[2]=z,re[5]=f.x,re[8]=f.y,re},i.dJ=Jh,i.dK=function(f,c,h){const g=M(new Float64Array(16)),_=(c/(1<({u_matrix:new u_(f),u_texsize:new $m(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 $m(f),u_tile_units_to_pixels:new Jo(f),u_alpha_discard_threshold:new Jo(f),u_trim_offset:new $m(f),u_trim_fade_range:new $m(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 $m(f),u_dash_image:new HN(f),u_gradient_image:new HN(f),u_image_height:new Jo(f),u_texsize:new $m(f),u_tile_units_to_pixels:new Jo(f),u_alpha_discard_threshold:new Jo(f),u_trim_offset:new $m(f),u_trim_fade_range:new $m(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 $m(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_=BWe,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=E_e,i.dd=Xoe,i.de=D_e,i.df=wle,i.dg=function(f,c){return f.readFields(zGe,{icons:[]},c)},i.dh=H6,i.di=oS,i.dj=ule,i.dk=e0,i.dl=n_,i.dm=Gp,i.dn=pr,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 IGe(f,c):new RGe[f.type](f,c,h,g)},i.dv=fr,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=Em,i.e=Ps,i.e$=me,i.e0=gve,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=hve(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:rHe,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?Z_e(.07,.7,ye((14-K.zoom)/5,0,1)):.07,ee=h.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:X_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:Y_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(ee?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),ee=h.paint.get("line-trim-color-use-theme").constantOr("default")==="none",re=K.pitch<15?Z_e(.07,.7,ye((14-K.zoom)/5,0,1)):.07;return{u_matrix:X_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:J_e(h)&&c.lineAtlasTexture?c.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Y_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(ee?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=iM,i.e8=ce,i.e9=bh,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=Nle,i.eC=Q6,i.eD=X6,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=Bm,i.eL=function(f,c,h,g,_,S,C,L,z,$,K,Z,ee,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]=ee,Se[13]=re,Se[14]=ie,Se[15]=ge,Se},i.eM=w,i.eN=w0,i.eO=K5,i.eP=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new or(1/0,1/0),max:new or(-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=Wve(new or(0,0),new or(Ar,Ar),f),g=[];if(c&&!Eoe(h,this._globalClipBounds))return g;for(const _ of this._activeRegions){if(_.hiddenByOverlap||!Eoe(h,_))continue;const S=EHe(_.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=Wve(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||B6(c.min,h.min)||B6(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||!Hve(h,g)||h.order!==g.order||h.clipMask!==g.clipMask||!La(h.clipScope,g.clipScope),this._activeRegions[c].hiddenByOverlap=g.hiddenByOverlap,++c}}if(f){++this._updateTime;for(const h of this._activeRegions)h.order!==hM&&(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=hM,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 ee=$===S-1?$-2:$===0?$:$-1;return ee+=Z?24575:0,[ee,K]};for(let $=0;$0?(Se=2*Math.sqrt(ge+1),f[3]=.25*Se,f[0]=(Z-re)/Se,f[1]=(ee-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]=(ee+z)/Se):K>ie?(Se=2*Math.sqrt(1+K-C-ie),f[3]=(ee-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]=(ee+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=Woe,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){Xy=f,Qy=c},i.f5=woe,i.f6=fve,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 or(c[0],c[1])},i.f8=function(){const f=yM;f&&(f.isPreloaded()&&f.numActive()===1?(f.release(Roe),yM=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(){H6().acquire(Roe)},i.fA=kL,i.fB=Dt,i.fC=function(f){let c=0;if(new Uint32Array(f,0,1)[0]!==S_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 A_e(f,c)},i.fD=function(f,c){const h=Xoe(f);for(const g of h){for(const _ of g.meshes)lWe(_);g.lights&&(g.lightMeshIndex=g.meshes.length,g.meshes.push(cWe(g.lights,c)))}return h},i.fE=yL,i.fF=Ws,i.fG=b_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(jd===du.deferred||jd===du.loading||jd===du.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");Rf=Xo.resolveURL(f),jd=du.deferred,R5=c,wN(),h||h6()},i.fc=function(f){JN=Xo.resolveURL(f),eS||(eS=new QN(H6(),new Ls)),eS.broadcast("setMeshoptUrl",JN)},i.fd=k_e,i.fe=function(f){Boe=Xo.resolveURL(f),eS||(eS=new QN(H6(),new Ls)),eS.broadcast("setDracoUrl",Boe)},i.ff=j_e,i.fg=xM,i.fh=function(f){const c=lu();if(!c)return;const h=c.delete(Yy);f&&h.then(()=>f()).catch(f)},i.fi=y_,i.fj=sn,i.fk=T0,i.fl=Zf,i.fm=q2e,i.fn=V2e,i.fo=H_e,i.fp=er,i.fq="hd_road_elevation",i.fr=Ta,i.fs=Wt,i.ft=Tx,i.fu=dle,i.fv=b_,i.fw=function(f,c,h,g,_,S,C,L=1,z,$,K){f.createArrays(),f.tilePixelRatio=Ar/(512*f.overscaling),f.compareText={},f.iconsNeedLinear=!1;const Z=f.layers[0].layout,ee=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=ee["text-size"],Ue=ee["icon-size"];if(f.textSizeData.kind==="composite"){const{minZoom:Pt,maxZoom:Qt}=f.textSizeData;re.compositeTextSizes=[Fe.possiblyEvaluate(new ci(Pt,{worldview:K}),S),Fe.possiblyEvaluate(new ci(Qt,{worldview:K}),S)]}if(f.iconSizeData.kind==="composite"){const{minZoom:Pt,maxZoom:Qt}=f.iconSizeData;re.compositeIconSizes=[Ue.possiblyEvaluate(new ci(Pt,{worldview:K}),S),Ue.possiblyEvaluate(new ci(Qt,{worldview:K}),S)]}re.layoutTextSize=Fe.possiblyEvaluate(new ci(C+1,{worldview:K}),S),re.layoutIconSize=Ue.possiblyEvaluate(new ci(C+1,{worldview:K}),S),re.textMaxSize=Fe.possiblyEvaluate(new ci(18,{worldview:K}),S);const Xe=Z.get("symbol-placement"),xt=Z.get("text-rotation-alignment")==="map"&&Xe!=="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,dr=re.layoutIconSize.evaluate(Pt,{},S)*re.iconScaleFactor,ur={horizontal:{},vertical:void 0},yr=Pt.text;let _r,mr=[0,0];if(yr){const hs=yr.toString(),Ka=Z.get("text-letter-spacing").evaluate(Pt,{},S)*jl,ft=Z.get("text-line-height").evaluate(Pt,{},S)*jl,vt=O5(hs)?Ka:0,sr=Z.get("text-anchor").evaluate(Pt,{},S),vr=Z.get("text-variable-anchor");if(!vr){const ls=Z.get("text-radial-offset").evaluate(Pt,{},S);if(ls)mr=Cbe(sr,[ls*jl,mle]);else{const ys=Z.get("text-offset").evaluate(Pt,{},S);mr=[ys[0]*jl,ys[1]*jl]}}let $r=xt?"center":Z.get("text-justify").evaluate(Pt,{},S);const Ur=Xe==="point",wn=Ur?Z.get("text-max-width").evaluate(Pt,{},S)*jl:1/0,Nn=ls=>{f.allowVerticalPlacement&&r_(hs)&&(ur.vertical=ale(yr,c,h,_,Qt,wn,ft,sr,ls,vt,mr,zu.vertical,!0,nr,Ft,z))};if(!xt&&vr){const ls=$r==="auto"?vr.map(ws=>fle(ws)):[$r];let ys=!1;for(let ws=0;ws=0||!r_(hs)){const ls=ale(yr,c,h,_,Qt,wn,ft,sr,$r,vt,mr,zu.horizontal,!1,nr,Ft,z);ls&&(ur.horizontal[$r]=ls)}Nn(Ur?"left":$r)}}let gr,rr,Jt,xr,Er,jr,_n=!1;const Hr=Z.get("icon-text-fit").evaluate(Pt,{},S);if(Pt.icon&&Pt.icon.hasPrimary()){const hs=MM(Pt.icon,f.iconSizeData,ee["icon-size"],S,f.zoom,Pt,z,re.iconScaleFactor,K);gr=hs.iconPrimary,Jt=hs.iconSecondary;const Ka=gr.toString();if(rr=g.get(Ka),rr&&(Er=Z.get("icon-offset").evaluate(Pt,{},S),jr=Z.get("icon-anchor").evaluate(Pt,{},S),_r=nL(_.get(Ka),Jt?_.get(Jt.toString()):void 0,Er,jr),_n=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();xr=g.get(ft)}}wt=wt||!(!Pt.icon||!Pt.icon.hasSecondary());const Jr=lL(ur.horizontal)||ur.vertical;f.iconsInText||(f.iconsInText=!!Jr&&Jr.iconsInText);const un=nr*re.textScaleFactor/jl,{defaultShapedIcon:js,verticallyShapedIcon:kr}=xGe(f,_r,Z,Pt,S,ur,un,Er,Hr);Hr!=="none"&&_r&&(hbe(_r)||mbe(_r))&&(oL(0,rr,gr,_r,js,Hr,$,g,_),oL(0,xr,Jt,_r,js,Hr,$,g,_),kr&&(oL(0,rr,gr,_r,kr,Hr,$,g,_),oL(0,xr,Jt,_r,kr,Hr,$,g,_))),_r=js;const{iconBBox:mn,iconVerticalBBox:Yn,textBBox:Ks,textVerticalBBox:Js}=hGe(f,_r,kr,Z,Pt,S,dr,Er,re,_,jr,ur,nr,mr);Ct.push({feature:Pt,shapedTextOrientations:ur,shapedText:Jr,shapedIcon:_r,iconPrimary:gr,iconSecondary:Jt,iconOffset:Er,iconAnchor:jr,verticallyShapedIcon:kr,layoutTextSize:nr,layoutIconSize:dr,textOffset:mr,isSDFIcon:_n,iconTextFit:Hr,iconCollisionBounds:mn,iconVerticalCollisionBounds:Yn,textCollisionBounds:Ks,textVerticalCollisionBounds:Js})}return{featureData:Ct,sizes:re,hasAnySecondaryIcon:wt,textAlongLine:xt,symbolPlacement:Xe}},i.fx=bbe,i.fy=function(f,c,h,g,_,S,C,L,z,$){f.iconAtlasPositions=$.iconPositions;const{featureData:K,hasAnySecondaryIcon:Z,sizes:ee,textAlongLine:re,symbolPlacement:ie}=c;for(const ge of K){const{shapedIcon:Se,verticallyShapedIcon:Ne,feature:Fe,shapedTextOrientations:Ue,shapedText:Xe,layoutTextSize:xt,textOffset:mt,isSDFIcon:wt,iconPrimary:Ct,iconSecondary:Pt,iconTextFit:Qt,iconOffset:Ft,iconCollisionBounds:nr,iconVerticalCollisionBounds:dr,textCollisionBounds:ur}=ge;Tbe(Se,$.iconPositions,Ct,Pt),Tbe(Ne,$.iconPositions,Ct,Pt),gGe(Ue,$.iconPositions),pGe(Ct,Pt,$.iconPositions),(Xe||Se)&&yGe(f,Fe,Ue,Se,Ne,z,ee,xt,0,mt,wt,g,_,C,L,Z,Qt,Ft,re,ie,nr,dr,ur)}h&&f.generateCollisionDebugBuffers(S,f.collisionBoxArray,ee.textScaleFactor)},i.fz=Vt,i.g=function(f,c){return Em(Object.assign(f,{method:"GET"}),c)},i.h=function(f){return f.indexOf("mapbox:")===0},i.i=function(f){return Ps.API_STYLE_REGEX.test(f)&&!bl(f)},i.j=Oi,i.k=Ho,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 Em(Object.assign(f,{type:"json"}),c)},i.n=t0,i.o=Xo,i.p=function(f,c){return Em(Object.assign(f,{method:"POST"}),c)},i.q=Dc,i.r=hh,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 Foe||(Foe=new y_("ImageRasterizer")),Foe},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=Ele,i.y=as,i.z=Pr}),o(["./shared"],function(i){function u(nt){const ye=nt?nt.url.toString():void 0;return ye?performance.getEntriesByName(ye):[]}function m(nt){if(typeof nt=="number"||typeof nt=="boolean"||typeof nt=="string"||nt==null)return JSON.stringify(nt);if(Array.isArray(nt)){let Pe="[";for(const Ze of nt)Pe+=`${m(Ze)},`;return`${Pe}]`}let ye="{";for(const Pe of Object.keys(nt).sort())ye+=`${Pe}:${m(nt[Pe])},`;return`${ye}}`}function x(nt){let ye="";for(const Pe of i.bx)ye+=`/${m(nt[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,Ze){this._options=Ze;for(const bt of ye)this._layerConfigs[bt.id]=bt,(this._layers[bt.id]=i.du(bt,this.scope,null,this._options)).compileFilter(Ze),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 Lt=qt.source||"";let Wt=this.familiesBySource[Lt];Wt||(Wt=this.familiesBySource[Lt]={});const fr=qt.sourceLayer||"_geojsonTileLayer";let cr=Wt[fr];cr||(cr=Wt[fr]=[]),cr.push(It)}}}const v=1*i.fl;class b{constructor(ye){const Pe={},Ze=[];for(const qt in ye){const Lt=ye[qt],Wt=Pe[qt]={};for(const fr in Lt.glyphs){const cr=Lt.glyphs[+fr];if(!cr||cr.bitmap.width===0||cr.bitmap.height===0)continue;const Xr=cr.metrics.localGlyph?v:1,Mn={x:0,y:0,w:cr.bitmap.width+2*Xr,h:cr.bitmap.height+2*Xr};Ze.push(Mn),Wt[fr]=Mn}}const{w:Nt,h:bt}=i.G(Ze),It=new i.fk({width:Nt||1,height:bt||1});for(const qt in ye){const Lt=ye[qt];for(const Wt in Lt.glyphs){const fr=Lt.glyphs[+Wt];if(!fr||fr.bitmap.width===0||fr.bitmap.height===0)continue;const cr=Pe[qt][Wt],Xr=fr.metrics.localGlyph?v:1;i.fk.copy(fr.bitmap,It,{x:0,y:0},{x:cr.x+Xr,y:cr.y+Xr},fr.bitmap)}}this.image=It,this.positions=Pe}}function N(nt,ye,Pe){nt[ye]?Pe&&(nt[ye].center=Pe):nt[ye]={floorIds:new Set,center:Pe||[0,0],floors:{}}}function k(nt,ye,Pe,Ze){for(const Nt of ye)N(nt,Nt),nt[Nt].floors[Pe]=Ze,nt[Nt].floorIds.add(Pe)}function M(nt){return{id:nt.properties.id.toString(),center:nt.properties.center.toString().split(";").map(Number)}}function I(nt){return{id:nt.properties.id.toString(),isDefault:!!nt.properties.is_default&&nt.properties.is_default,connections:nt.properties.connected_floor_ids?new Set(nt.properties.connected_floor_ids.toString().split(";")):new Set,conflicts:nt.properties.conflicted_floor_ids?new Set(nt.properties.conflicted_floor_ids.toString().split(";")):new Set,buildings:nt.properties.building_ids?new Set(nt.properties.building_ids.toString().split(";")):new Set,name:nt.properties.name.toString(),zIndex:nt.properties.z_index}}function T(nt,ye){return ye.every(Pe=>nt.properties&&nt.properties[Pe]!=null)}function P(nt){return T(nt,["type","id","name"])&&nt.properties.type==="building"}function F(nt){return T(nt,["type","id","name","z_index"])&&nt.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,Ze,Nt,bt,It){this.status="parsing",this.data=ye,this.collisionBoxArray=new i.b3;const qt=new i.fm(Object.keys(ye.layers).sort()),Lt=new i.fn(this.tileID,this.promoteId);Lt.bucketLayerIDs=[];const Wt={},fr=new i.fo(256,256),cr={featureIndex:Lt,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:fr,availableImages:Ze,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};if(this.indoor){const cs=this.indoor.indoorState.activeFloorsVisible,ds=function(ns,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 Ga of Li)i.w(`Missing source layer required in indoor specification: ${Ga}`);return na.intersection(na)}(Ws.sourceLayers,new Set(Object.keys(ns.layers))),wa=Ws.indoorState,To=function(Pi,na,Li,Ga){const Ps=new Set,Oi=new Set,bl=new Set,El=new Map,Xc={},Am=Yo=>{const Hd=El.get(Yo)||new Set;for(const hc of Ps)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,Ze,this.worldview);const Ga=Wt[Li.id]=Li.createBucket({index:Lt.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:To});Lt.bucketLayerIDs.push(na.map(Oi=>i.B(Oi.id,Oi.scope)));let Ps=Ga.prepare?Ga.prepare():null;Ps!=null?(Ps=Ps.then(()=>Ga.populate(wa,cr,this.tileID.canonical,this.tileTransform)),Xr.push(Ps)):Ga.populate(wa,cr,this.tileID.canonical,this.tileTransform)}}const Kr=()=>{let cs,ds,ns,Ws,$i,jo;fr.trim();const wa={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},To=()=>{if(cs)return this.status="done",It(cs);if(this.extraShadowCaster)this.status="done",It(null,{buckets:Object.values(Wt).filter(na=>!na.isEmpty()),featureIndex:Lt,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:cr.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(ds&&ns&&Ws){const na=new b(ds),Li=new Map;for(const[Oi,bl]of ns.entries()){const{imagePosition:El}=i.fu(Oi,bl,i.fv);Li.set(Oi,El)}const Ga={};for(const Oi in Wt){const bl=Wt[Oi];bl instanceof i.b4&&(U(bl.layers,this.zoom,cr.brightness,Ze,this.worldview),Ga[Oi]=i.fw(bl,ds,na.positions,ns,Li,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,$i,this.worldview))}const Ps={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(bt,ns,$i,()=>{Ps.iconsPending=!1,Pi(Ga,na,Ps)}),this.rasterizeIfNeeded(bt,Ws,jo,()=>{Ps.patternsPending=!1,Pi(Ga,na,Ps)})}},Pi=(na,Li,Ga,Ps)=>{if(Ga.iconsPending||Ga.patternsPending)return;const Oi=new i.fx(ns,Ws,this.lut);for(const bl in Wt){const El=Wt[bl];if(bl in na)i.fy(El,na[bl],this.showCollisionBoxes,Ze,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,ns,Oi);else if(El.hasPattern&&(El instanceof i.ba||El instanceof i.bb||El instanceof i.ea)){U(El.layers,this.zoom,cr.brightness,Ze,this.worldview);const Xc=Object.fromEntries(Oi.patternPositions);El.addFeatures(cr,this.tileID.canonical,Xc,Ze,this.tileTransform,this.brightness)}}this.status="done",It(null,{buckets:Object.values(Wt).filter(bl=>!bl.isEmpty()),featureIndex:Lt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Li.image,lineAtlas:fr,imageAtlas:Oi,brightness:cr.brightness})};if(!this.extraShadowCaster){const na=i.fs(cr.glyphDependencies,Ps=>Object.keys(Ps).map(Number));Object.keys(na).length?bt.send("getGlyphs",{uid:this.uid,stacks:na},(Ps,Oi)=>{cs||(cs=Ps,ds=Oi,To())},void 0,!1,wa):ds={};const Li=Array.from(cr.iconDependencies.keys()).map(Ps=>i.I.parse(Ps));Li.length?bt.send("getImages",{images:Li,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(Ps,Oi)=>{cs||(cs=Ps,ns=new Map,$i=this.updateImageMapAndGetImageTaskQueue(ns,Oi,cr.iconDependencies),To())},void 0,!1,wa):(ns=new Map,$i=new Map);const Ga=Array.from(cr.patternDependencies.keys()).map(Ps=>i.I.parse(Ps));Ga.length?bt.send("getImages",{images:Ga,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(Ps,Oi)=>{cs||(cs=Ps,Ws=new Map,jo=this.updateImageMapAndGetImageTaskQueue(Ws,Oi,cr.patternDependencies),To())},void 0,!1,wa):(Ws=new Map,jo=new Map)}if(cr.elevationFeatures&&cr.elevationFeatures.length>0){const na=[];for(const Ga of Object.values(Wt))if(Ga instanceof i.bb){const Ps=Ga.getUnevaluatedPortalGraph();Ps&&na.push(Ps)}const Li=i.ft.evaluate(na);for(const Ga of Object.values(Wt))if(Ga instanceof i.bb){const Ps=ye.layers[qt.decode(Ga.sourceLayerIndex)];Ga.setEvaluatedPortalGraph(Li,Ps,this.tileID.canonical,cr.availableImages,cr.brightness)}}To()};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,Ze,Nt){Array.from(Pe.values()).some(bt=>bt.usvg)?this.rasterize(ye,Pe,Ze,Nt):Nt()}updateImageMapAndGetImageTaskQueue(ye,Pe,Ze){const Nt=new Map;for(const bt of Pe.keys()){const It=Ze.get(bt)||[];for(const qt of It){const Lt=qt.toString(),Wt=Pe.get(qt.id.toString());Wt.usvg?Nt.has(Lt)||(Nt.set(Lt,qt),ye.set(Lt,Object.assign({},Wt))):ye.set(Lt,Wt)}}return Nt}rasterize(ye,Pe,Ze,Nt){this.rasterizeTask=ye.send("rasterizeImages",{scope:this.scope,tasks:Ze},(bt,It)=>{if(!bt)for(const[qt,Lt]of It.entries()){const Wt=Object.assign(Pe.get(qt),{data:Lt});Pe.set(qt,Wt)}Nt()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function U(nt,ye,Pe,Ze,Nt){const bt=new i.ac(ye,{brightness:Pe,worldview:Nt});for(const It of nt)It.recalculate(bt,Ze)}class V extends i.E{constructor(ye,Pe,Ze,Nt,bt,It,qt){super(),this.actor=ye,this.layerIndex=Pe,this.availableImages=Ze,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 Ze=ye.uid,Nt=ye&&ye.request,bt=Nt&&Nt.collectResourceTiming,It=this.loading[Ze]=new D(ye);It.abort=this.loadVectorData(ye,(qt,Lt)=>{const Wt=!this.loading[Ze];if(delete this.loading[Ze],It.cancelRasterize(),Wt||qt||!Lt)return It.status="done",Wt||(this.loaded[Ze]=It),Pe(qt);const fr=Lt.rawData,cr={},Xr=i.aM(Lt.responseHeaders);Xr&&Xr.expires&&(cr.expires=Xr.expires),Xr&&Xr.cacheControl&&(cr.cacheControl=Xr.cacheControl),It.vectorTile=Lt.vectorTile||new i.fz(new i.bt(fr));const Mn=()=>{It.parse(It.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(Kr,cs)=>{if(Kr||!cs)return Pe(Kr);const ds={};if(bt){const ns=u(Nt);ns.length>0&&(ds.resourceTiming=JSON.parse(JSON.stringify(ns)))}Pe(null,Object.assign({rawTileData:fr.slice(0),responseHeaders:Lt.responseHeaders},cs,cr,ds))})};this.isSpriteLoaded?Mn():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(Mn,{type:"parseTile",isSymbolTile:ye.isSymbolTile,zoom:ye.tileZoom}):Mn()}),this.loaded=this.loaded||{},this.loaded[Ze]=It})}reloadTile(ye,Pe){const Ze=this.loaded,Nt=ye.uid;if(Ze&&Ze[Nt]){const bt=Ze[Nt];bt.updateParameters(ye);const It=(qt,Lt)=>{const Wt=bt.reloadCallback;Wt&&(delete bt.reloadCallback,bt.parse(bt.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Wt)),Pe(qt,Lt)};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 Ze=ye.uid,Nt=this.loading[Ze];Nt&&(Nt.abort&&Nt.abort(),delete this.loading[Ze]),Pe()}removeTile(ye,Pe){const Ze=this.loaded,Nt=ye.uid;Ze&&Ze[Nt]&&delete Ze[Nt],Pe()}}class W{loadTile(ye,Pe){const{uid:Ze,encoding:Nt,rawImageData:bt,padding:It}=ye,qt=ImageBitmap&&bt instanceof ImageBitmap?this.getImageData(bt,It):bt;Pe(null,new i.fA(Ze,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 Ze=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),Ze}}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 Ze=this._mrt;this.status="parsing",this._entireBuffer=ye;try{Ze.parseHeader(ye),this._isHeaderLoaded=!0;const Nt=[];for(const bt in Ze.layers){const It=Ze.getLayer(bt),qt=It.getDataRange(It.getBandList()),Lt=Ze.createDecodingTask(qt),Wt=ye.slice(qt.firstByte,qt.lastByte+1),fr=i.bs.performDecoding(Wt,Lt).then(cr=>Lt.complete(null,cr)).catch(cr=>Lt.complete(cr,null));Nt.push(fr)}Promise.allSettled(Nt).then(()=>Pe(null,Ze)).catch(bt=>Pe(bt))}catch(Nt){Pe(Nt)}}}class Q{constructor(ye){this.actor=ye,this.loading={},this.loaded={}}loadTile(ye,Pe){const Ze=ye.uid,Nt=ye.request,bt=this.loading[Ze]=new G(ye),{cancel:It}=i.bu(Nt,(qt,Lt,Wt)=>{const fr=!this.loading[Ze];if(delete this.loading[Ze],fr||qt||!Lt)return bt.status="done",fr||(this.loaded[Ze]=bt),Pe(qt);bt.parse(Lt,(cr,Xr)=>{if(cr||!Xr)return Pe(cr);Pe(null,Xr,Wt)}),this.loaded[Ze]=bt});bt.abort=It}reloadTile(ye,Pe){Pe(null,void 0)}abortTile(ye,Pe){const Ze=ye.uid,Nt=this.loading[Ze];Nt&&(Nt.abort&&Nt.abort(),delete this.loading[Ze]),Pe()}removeTile(ye,Pe){const Ze=ye.uid;this.loaded[Ze]&&delete this.loaded[Ze],Pe()}decodeRasterArray(ye,Pe){i.bs.performDecoding(ye.buffer,ye.task).then(Ze=>Pe(null,Ze)).catch(Ze=>Pe(Ze))}}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 Ze=[];for(const Nt of Pe)Ze.push(new i.P(Nt[0],Nt[1]));ye.push(Ze)}return ye}}toGeoJSON(ye,Pe,Ze){return ae.call(this,ye,Pe,Ze)}}class de{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 se{constructor(ye){this.layers={},this.extent=i.al;for(const Pe of Object.keys(ye))this.layers[Pe]=new de(Pe,ye[Pe])}}const pe=64/4096,ne=128;class me{constructor(){this.features=new Map}clear(){this.features.clear()}load(ye=[],Pe){for(const Ze of ye){const Nt=Ze.id;if(Nt==null)continue;let bt=this.features.get(Nt);bt&&this.updateCache(bt,Pe),Ze.geometry?(bt=xe(Ze),this.updateCache(bt,Pe),this.features.set(Nt,bt)):this.features.delete(Nt),this.updateCache(bt,Pe)}}updateCache(ye,Pe){for(const{canonical:Ze,uid:Nt}of Object.values(Pe)){const{z:bt,x:It,y:qt}=Ze;he(ye,Math.pow(2,bt),It,qt)&&delete Pe[Nt]}}getTile(ye,Pe,Ze){const Nt=Math.pow(2,ye),bt=[];for(const It of this.features.values())he(It,Nt,Pe,Ze)&&bt.push(ve(It,Nt,Pe,Ze));return{features:bt}}getFeatures(){return[...this.features.values()]}}function he({minX:nt,minY:ye,maxX:Pe,maxY:Ze},Nt,bt,It){return nt<(bt+1+pe)/Nt&&ye<(It+1+pe)/Nt&&Pe>(bt-pe)/Nt&&Ze>(It-pe)/Nt}function xe(nt){const{id:ye,geometry:Pe,properties:Ze}=nt;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:Ze,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 Lt of bt)Te(Lt,qt,It);else if(Nt==="LineString")It.type=2,be(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 Lt of bt)we(Lt,qt,It,!0)}return It}function Te([nt,ye],Pe,Ze){const Nt=i.aF(nt);let bt=i.aJ(ye);bt=bt<0?0:bt>1?1:bt,Pe.push(Nt,bt),Ze.minX=Math.min(Ze.minX,Nt),Ze.minY=Math.min(Ze.minY,bt),Ze.maxX=Math.max(Ze.maxX,Nt),Ze.maxY=Math.max(Ze.maxY,bt)}function be(nt,ye,Pe,Ze=!1,Nt=!1){const bt=[];for(const It of nt)Te(It,bt,Pe);ye.push(bt),Ze&&function(It,qt){let Lt=0;for(let Wt=0,fr=It.length,cr=fr-2;Wt0===qt)for(let Wt=0,fr=It.length;Wt=It&&cr>=It||(Wt>=It?(fr+=Math.round(Kr*((It-Wt)/Mn)),Wt=It):cr>=It&&(Xr=fr+Math.round(Kr*((It-Wt)/Mn)),cr=It),fr>=It&&Xr>=It||(fr>=It?(Wt+=Math.round(Mn*((It-fr)/Kr)),fr=It):Xr>=It&&(cr=Wt+Math.round(Mn*((It-fr)/Kr)),Xr=It),qt&&Wt===qt[qt.length-1][0]&&fr===qt[qt.length-1][1]||(qt=[[Wt,fr]],Nt.push(qt)),qt.push([cr,Xr])))))}}function Me(nt,ye,Pe,Ze,Nt){const bt=(Pe-pe)/ye,It=(Ze-pe)/ye,qt=(Pe+1+pe)/ye,Lt=(Ze+1+pe)/ye;function Wt(Xr,Mn){let Kr=0;return Xrqt&&(Kr|=2),MnLt&&(Kr|=8),Kr}let fr=[];for(let Xr=1;Xr<=8;Xr*=2){let Mn=nt[nt.length-2],Kr=nt[nt.length-1],cs=!(Wt(Mn,Kr)&Xr);for(let ds=0;ds>31}function At(nt,ye){const{geometry:Pe,type:Ze}=nt;let Nt=0,bt=0;if(Ze===1){ye.writeVarint(Ve(1,Pe.length));for(const It of Pe){const qt=It[0]-Nt,Lt=It[1]-bt;ye.writeVarint(ot(qt)),ye.writeVarint(ot(Lt)),Nt+=qt,bt+=Lt}}else for(const It of Pe){ye.writeVarint(Ve(1,1));const qt=It.length-(Ze===3?1:0);for(let Lt=0;Ltnt},le=Math.fround||(qe=new Float32Array(1),nt=>(qe[0]=+nt,qe[0]));var qe;const Qe=3,rt=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:Ze,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 Lt=0;Lt=Ze;Lt--){const Wt=+Date.now();qt=this.trees[Lt]=this._createTree(this._cluster(qt,Lt)),Pe&&console.log("z%d: %d clusters in %dms",Lt,qt.numItems,+Date.now()-Wt)}return Pe&&console.timeEnd("total time"),this}getClusters(ye,Pe){let Ze=((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)Ze=-180,bt=180;else if(Ze>bt){const cr=this.getClusters([Ze,Nt,180,It],Pe),Xr=this.getClusters([-180,Nt,bt,It],Pe);return cr.concat(Xr)}const qt=this.trees[this._limitZoom(Pe)],Lt=qt.range(Ye(Ze),Le(It),Ye(bt),Le(Nt)),Wt=qt.data,fr=[];for(const cr of Lt){const Xr=this.stride*cr;fr.push(Wt[Xr+rt]>1?Ce(Wt,Xr,this.clusterProps):this.points[Wt[Xr+Qe]])}return fr}getChildren(ye){const Pe=this._getOriginId(ye),Ze=this._getOriginZoom(ye),Nt="No cluster with the specified id.",bt=this.trees[Ze];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,Ze-1)),Lt=bt.within(It[Pe*this.stride],It[Pe*this.stride+1],qt),Wt=[];for(const fr of Lt){const cr=fr*this.stride;It[cr+4]===ye&&Wt.push(It[cr+rt]>1?Ce(It,cr,this.clusterProps):this.points[It[cr+Qe]])}if(Wt.length===0)throw new Error(Nt);return Wt}getLeaves(ye,Pe,Ze){const Nt=[];return this._appendLeaves(Nt,ye,Pe=Pe||10,Ze=Ze||0,0),Nt}getTile(ye,Pe,Ze){const Nt=this.trees[this._limitZoom(ye)],bt=Math.pow(2,ye),{extent:It,radius:qt}=this.options,Lt=qt/It,Wt=(Ze-Lt)/bt,fr=(Ze+1+Lt)/bt,cr={features:[]};return this._addTileFeatures(Nt.range((Pe-Lt)/bt,Wt,(Pe+1+Lt)/bt,fr),Nt.data,Pe,Ze,bt,cr),Pe===0&&this._addTileFeatures(Nt.range(1-Lt/bt,Wt,1,fr),Nt.data,bt,Ze,bt,cr),Pe===bt-1&&this._addTileFeatures(Nt.range(0,Wt,Lt/bt,fr),Nt.data,-1,Ze,bt,cr),cr.features.length?cr:null}getClusterExpansionZoom(ye){let Pe=this._getOriginZoom(ye)-1;for(;Pe<=this.options.maxZoom;){const Ze=this.getChildren(ye);if(Pe++,Ze.length!==1)break;ye=Ze[0].properties.cluster_id}return Pe}_appendLeaves(ye,Pe,Ze,Nt,bt){const It=this.getChildren(Pe);for(const qt of It){const Lt=qt.properties;if(Lt&&Lt.cluster?bt+Lt.point_count<=Nt?bt+=Lt.point_count:bt=this._appendLeaves(ye,Lt.cluster_id,Ze,Nt,bt):bt1;let fr,cr,Xr;if(Wt)fr=Ee(Pe,Lt,this.clusterProps),cr=Pe[Lt],Xr=Pe[Lt+1];else{const cs=this.points[Pe[Lt+Qe]];fr=cs.properties;const[ds,ns]=cs.geometry.coordinates;cr=Ye(ds),Xr=Le(ns)}const Mn={type:1,geometry:[[Math.round(this.options.extent*(cr*bt-Ze)),Math.round(this.options.extent*(Xr*bt-Nt))]],tags:fr};let Kr;Kr=Wt||this.options.generateId?Pe[Lt+Qe]:this.points[Pe[Lt+Qe]].id,Kr!==void 0&&(Mn.id=Kr),It.features.push(Mn)}}_limitZoom(ye){return Math.max(this.options.minZoom,Math.min(Math.floor(+ye),this.options.maxZoom+1))}_cluster(ye,Pe){const{radius:Ze,extent:Nt,reduce:bt,minPoints:It}=this.options,qt=Ze/(Nt*Math.pow(2,Pe)),Lt=ye.data,Wt=[],fr=this.stride;for(let cr=0;crPe&&(ds+=Lt[Ws+rt])}if(ds>cs&&ds>=It){let ns,Ws=Xr*cs,$i=Mn*cs,jo=-1;const wa=(cr/fr<<5)+(Pe+1)+this.points.length;for(const To of Kr){const Pi=To*fr;if(Lt[Pi+2]<=Pe)continue;Lt[Pi+2]=Pe;const na=Lt[Pi+rt];Ws+=Lt[Pi]*na,$i+=Lt[Pi+1]*na,Lt[Pi+4]=wa,bt&&(ns||(ns=this._map(Lt,cr,!0),jo=this.clusterProps.length,this.clusterProps.push(ns)),bt(ns,this._map(Lt,Pi)))}Lt[cr+4]=wa,Wt.push(Ws/ds,$i/ds,1/0,wa,-1,ds),bt&&Wt.push(jo)}else{for(let ns=0;ns1)for(const ns of Kr){const Ws=ns*fr;if(!(Lt[Ws+2]<=Pe)){Lt[Ws+2]=Pe;for(let $i=0;$i>5}_getOriginZoom(ye){return(ye-this.points.length)%32}_map(ye,Pe,Ze){if(ye[Pe+rt]>1){const It=this.clusterProps[ye[Pe+je]];return Ze?Object.assign({},It):It}const Nt=this.points[ye[Pe+Qe]].properties,bt=this.options.map(Nt);return Ze&&bt===Nt?Object.assign({},bt):bt}}function Ce(nt,ye,Pe){return{type:"Feature",id:nt[ye+Qe],properties:Ee(nt,ye,Pe),geometry:{type:"Point",coordinates:[(Ze=nt[ye],360*(Ze-.5)),Ke(nt[ye+1])]}};var Ze}function Ee(nt,ye,Pe){const Ze=nt[ye+rt],Nt=Ze>=1e4?`${Math.round(Ze/1e3)}k`:Ze>=1e3?Math.round(Ze/100)/10+"k":Ze,bt=nt[ye+je],It=bt===-1?{}:Object.assign({},Pe[bt]);return Object.assign(It,{cluster:!0,cluster_id:nt[ye+Qe],point_count:Ze,point_count_abbreviated:Nt})}function Ye(nt){return nt/360+.5}function Le(nt){const ye=Math.sin(nt*Math.PI/180),Pe=.5-.25*Math.log((1+ye)/(1-ye))/Math.PI;return Pe<0?0:Pe>1?1:Pe}function Ke(nt){const ye=(180-360*nt)*Math.PI/180;return 360*Math.atan(Math.exp(ye))/Math.PI-90}function tt(nt,ye,Pe,Ze){let Nt=Ze;const bt=ye+(Pe-ye>>1);let It,qt=Pe-ye;const Lt=nt[ye],Wt=nt[ye+1],fr=nt[Pe],cr=nt[Pe+1];for(let Xr=ye+3;XrNt)It=Xr,Nt=Mn;else if(Mn===Nt){const Kr=Math.abs(Xr-bt);KrZe&&(It-ye>3&&tt(nt,ye,It,Ze),nt[It+2]=Nt,Pe-It>3&&tt(nt,It,Pe,Ze))}function ct(nt,ye,Pe,Ze,Nt,bt){let It=Nt-Pe,qt=bt-Ze;if(It!==0||qt!==0){const Lt=((nt-Pe)*It+(ye-Ze)*qt)/(It*It+qt*qt);Lt>1?(Pe=Nt,Ze=bt):Lt>0&&(Pe+=It*Lt,Ze+=qt*Lt)}return It=nt-Pe,qt=ye-Ze,It*It+qt*qt}function it(nt,ye,Pe,Ze){const Nt={id:nt??null,type:ye,geometry:Pe,tags:Ze,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(nt,ye){for(let Pe=0;Pe0&&(It+=Ze?(Nt*fr-Wt*bt)/2:Math.sqrt(Math.pow(Wt-Nt,2)+Math.pow(fr-bt,2))),Nt=Wt,bt=fr}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 Br(nt,ye,Pe,Ze){for(let Nt=0;Nt1?1:Pe}function Ot(nt,ye,Pe,Ze,Nt,bt,It,qt){if(Ze/=ye,bt>=(Pe/=ye)&&It=Ze)return null;const Lt=[];for(const Wt of nt){const fr=Wt.geometry;let cr=Wt.type;const Xr=Nt===0?Wt.minX:Wt.minY,Mn=Nt===0?Wt.maxX:Wt.maxY;if(Xr>=Pe&&Mn=Ze)continue;let Kr=[];if(cr==="Point"||cr==="MultiPoint")Gr(fr,Kr,Pe,Ze,Nt);else if(cr==="LineString")An(fr,Kr,Pe,Ze,Nt,!1,qt.lineMetrics);else if(cr==="MultiLineString")ba(fr,Kr,Pe,Ze,Nt,!1);else if(cr==="Polygon")ba(fr,Kr,Pe,Ze,Nt,!0);else if(cr==="MultiPolygon")for(const cs of fr){const ds=[];ba(cs,ds,Pe,Ze,Nt,!0),ds.length&&Kr.push(ds)}if(Kr.length){if(qt.lineMetrics&&cr==="LineString"){for(const cs of Kr)Lt.push(it(Wt.id,cr,cs,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"),Lt.push(it(Wt.id,cr,Kr,Wt.tags))}}return Lt.length?Lt:null}function Gr(nt,ye,Pe,Ze,Nt){for(let bt=0;bt=Pe&&It<=Ze&&gi(ye,nt[bt],nt[bt+1],nt[bt+2])}}function An(nt,ye,Pe,Ze,Nt,bt,It){let qt=zn(nt);const Lt=Nt===0?Mo:Wa;let Wt,fr,cr=nt.start;for(let ds=0;dsPe&&(fr=Lt(qt,ns,Ws,jo,wa,Pe),It&&(qt.start=cr+Wt*fr)):To>Ze?Pi=Pe&&(fr=Lt(qt,ns,Ws,jo,wa,Pe),na=!0),Pi>Ze&&To<=Ze&&(fr=Lt(qt,ns,Ws,jo,wa,Ze),na=!0),!bt&&na&&(It&&(qt.end=cr+Wt*fr),ye.push(qt),qt=zn(nt)),It&&(cr+=Wt)}let Xr=nt.length-3;const Mn=nt[Xr],Kr=nt[Xr+1],cs=Nt===0?Mn:Kr;cs>=Pe&&cs<=Ze&&gi(qt,Mn,Kr,nt[Xr+2]),Xr=qt.length-3,bt&&Xr>=3&&(qt[Xr]!==qt[0]||qt[Xr+1]!==qt[1])&&gi(qt,qt[0],qt[1],qt[2]),qt.length&&ye.push(qt)}function zn(nt){const ye=[];return ye.size=nt.size,ye.start=nt.start,ye.end=nt.end,ye}function ba(nt,ye,Pe,Ze,Nt,bt){for(const It of nt)An(It,ye,Pe,Ze,Nt,bt,!1)}function gi(nt,ye,Pe,Ze){nt.push(ye,Pe,Ze)}function Mo(nt,ye,Pe,Ze,Nt,bt){const It=(bt-ye)/(Ze-ye);return gi(nt,bt,Pe+(Nt-Pe)*It,1),It}function Wa(nt,ye,Pe,Ze,Nt,bt){const It=(bt-Pe)/(Nt-Pe);return gi(nt,ye+(Ze-ye)*It,bt,1),It}function ms(nt,ye){const Pe=[];for(let Ze=0;Ze0&&ye.size<(Nt?It:Ze))return void(Pe.numPoints+=ye.length/3);const qt=[];for(let Lt=0;LtIt)&&(Pe.numSimplified++,qt.push(ye[Lt],ye[Lt+1])),Pe.numPoints++;Nt&&function(Lt,Wt){let fr=0;for(let cr=0,Xr=Lt.length,Mn=Xr-2;cr0===Wt)for(let cr=0,Xr=Lt.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 Lt=0;Lt1&&console.time("creation"),Mn=this.tiles[Xr]=Bs(ye,Pe,Ze,Nt,Wt),this.tileCoords.push({z:Pe,x:Ze,y:Nt}),fr)){fr>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Pe,Ze,Nt,Mn.numFeatures,Mn.numPoints,Mn.numSimplified),console.timeEnd("creation"));const na=`z${Pe}`;this.stats[na]=(this.stats[na]||0)+1,this.total++}if(Mn.source=ye,bt==null){if(Pe===Wt.indexMaxZoom||Mn.numPoints<=Wt.indexMaxPoints)continue}else{if(Pe===Wt.maxZoom||Pe===bt)continue;if(bt!=null){const na=bt-Pe;if(Ze!==It>>na||Nt!==qt>>na)continue}}if(Mn.source=null,ye.length===0)continue;fr>1&&console.time("clipping");const Kr=.5*Wt.buffer/Wt.extent,cs=.5-Kr,ds=.5+Kr,ns=1+Kr;let Ws=null,$i=null,jo=null,wa=null,To=Ot(ye,cr,Ze-Kr,Ze+ds,0,Mn.minX,Mn.maxX,Wt),Pi=Ot(ye,cr,Ze+cs,Ze+ns,0,Mn.minX,Mn.maxX,Wt);ye=null,To&&(Ws=Ot(To,cr,Nt-Kr,Nt+ds,1,Mn.minY,Mn.maxY,Wt),$i=Ot(To,cr,Nt+cs,Nt+ns,1,Mn.minY,Mn.maxY,Wt),To=null),Pi&&(jo=Ot(Pi,cr,Nt-Kr,Nt+ds,1,Mn.minY,Mn.maxY,Wt),wa=Ot(Pi,cr,Nt+cs,Nt+ns,1,Mn.minY,Mn.maxY,Wt),Pi=null),fr>1&&console.timeEnd("clipping"),Lt.push(Ws||[],Pe+1,2*Ze,2*Nt),Lt.push($i||[],Pe+1,2*Ze,2*Nt+1),Lt.push(jo||[],Pe+1,2*Ze+1,2*Nt),Lt.push(wa||[],Pe+1,2*Ze+1,2*Nt+1)}}getTile(ye,Pe,Ze){ye=+ye,Pe=+Pe,Ze=+Ze;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,Ze);let Wt,fr=ye,cr=Pe,Xr=Ze;for(;!Wt&&fr>0;)fr--,cr>>=1,Xr>>=1,Wt=this.tiles[ji(fr,cr,Xr)];return Wt&&Wt.source?(It>1&&(console.log("found parent tile z%d-%d-%d",fr,cr,Xr),console.time("drilling down")),this.splitTile(Wt.source,fr,cr,Xr,ye,Pe,Ze),It>1&&console.timeEnd("drilling down"),this.tiles[Lt]?fs(this.tiles[Lt],bt):null):null}}function ji(nt,ye,Pe){return 32*((1<Wt.tags&&"3d_elevation_id"in Wt.tags&&"source"in Wt.tags&&Wt.tags.source==="elevation",bt=Ze.features.filter(Wt=>Nt(Wt));let It={_geojsonTileLayer:Ze.features};bt.length>0&&(It={_geojsonTileLayer:Ze.features.filter(Wt=>!Nt(Wt)),hd_road_elevation:bt});const qt=new se(It),Lt=function(Wt){const fr=new i.bt;for(const cr of Object.keys(Wt))fr.writeMessage(3,Ie,{name:cr,features:Wt[cr]});return fr.finish()}(It).buffer;ye(null,{vectorTile:qt,rawData:Lt})}class Ki extends V{constructor(ye,Pe,Ze,Nt,bt,It,qt){super(ye,Pe,Ze,Nt,bt,Hn,qt),It&&(this.loadGeoJSON=It),this._dynamicIndex=new me}loadData(ye,Pe){const Ze=ye&&ye.request,Nt=Ze&&Ze.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 Lt=i.U(ye.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Lt.result==="error")throw new Error(Lt.value.map(Wt=>`${Wt.key}: ${Wt.message}`).join(", "));It.features=It.features.filter(Wt=>Lt.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:Lt,clusterProperties:Wt}){if(!Wt||!Lt)return Lt;const fr={},cr={},Xr={accumulated:null,zoom:0},Mn={properties:null},Kr=Object.keys(Wt);for(const cs of Kr){const[ds,ns]=Wt[cs],Ws=i.U(ns),$i=i.U(typeof ds=="string"?[ds,["accumulated"],["get",cs]]:ds);fr[cs]=Ws.value,cr[cs]=$i.value}return Lt.map=cs=>{Mn.properties=cs;const ds={};for(const ns of Kr)ds[ns]=fr[ns].evaluate(Xr,Mn);return ds},Lt.reduce=(cs,ds)=>{Mn.properties=ds;for(const ns of Kr)Xr.accumulated=cs[ns],cs[ns]=cr[ns].evaluate(Xr,Mn)},Lt}(ye)).load(It.features):ye.dynamic?this._dynamicIndex:function(Lt,Wt){return new oo(Lt,Wt)}(It,ye.geojsonVtOptions)}catch(Lt){return Pe(Lt)}const qt={};if(Nt){const Lt=u(Ze);Lt&&(qt.resourceTiming={},qt.resourceTiming[ye.source]=JSON.parse(JSON.stringify(Lt)))}Pe(null,qt)}})}reloadTile(ye,Pe){const Ze=this.loaded;return Ze&&Ze[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(Ze){Pe(Ze)}}getClusterChildren(ye,Pe){try{Pe(null,this._geoJSONIndex.getChildren(ye.clusterId))}catch(Ze){Pe(Ze)}}getClusterLeaves(ye,Pe){try{Pe(null,this._geoJSONIndex.getLeaves(ye.clusterId,ye.limit,ye.offset))}catch(Ze){Pe(Ze)}}}class dc{constructor(ye,Pe,Ze){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=Ze}parse(ye,Pe,Ze,Nt){this.status="parsing";const bt=new i.aQ(Ze.tileID.overscaledZ,Ze.tileID.wrap,Ze.tileID.canonical.z,Ze.tileID.canonical.x,Ze.tileID.canonical.y),It=[],qt=Pe.familiesBySource[Ze.source],Lt=new i.fn(bt,Ze.promoteId);Lt.bucketLayerIDs=[],Lt.is3DTile=!0,i.fC(ye).then(Wt=>{if(!Wt)return Nt(new Error("Could not parse tile"));const fr=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 Mn in qt)for(const Kr of qt[Mn]){const cs=Kr[0];Lt.bucketLayerIDs.push(Kr.map(Ws=>i.B(Ws.id,Ws.scope))),cs.recalculate(Xr,[]);const ds=i.fD(Wt,1/i.d7(Ze.tileID.canonical)),ns=new i.fE(Kr,ds,bt,fr,cr,this.brightness,Lt,this.worldview);fr||(ns.needsUpload=!0),It.push(ns),ns.evaluate(cs)}this.status="done",Nt(null,{buckets:It,featureIndex:Lt,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(Wt=>Nt(new Error(Wt.message)))}}class go{constructor(ye,Pe,Ze,Nt,bt,It,qt,Lt){this.actor=ye,this.layerIndex=Pe,this.availableImages=Ze,this.availableModels=Nt,this.brightness=qt,this.loading={},this.loaded={},this.worldview=Lt}loadTile(ye,Pe){const Ze=ye.uid,Nt=this.loading[Ze]=new dc(ye,this.brightness,this.worldview);i.bu(ye.request,(bt,It)=>{const qt=!this.loading[Ze];return delete this.loading[Ze],qt||bt?(Nt.status="done",qt||(this.loaded[Ze]=Nt),Pe(bt)):It&&It.byteLength!==0?void Nt.parse(It,this.layerIndex,ye,(Lt,Wt)=>{Nt.status="done",this.loaded=this.loaded||{},this.loaded[Ze]=Nt,Lt||!Wt?Pe(Lt):Pe(null,Wt)}):(Nt.status="done",this.loaded[Ze]=Nt,Pe())})}reloadTile(ye,Pe){const Ze=this.loaded,Nt=ye.uid;if(Ze&&Ze[Nt]){const bt=Ze[Nt];bt.projection=ye.projection,bt.brightness=ye.brightness;const It=(qt,Lt)=>{bt.reloadCallback&&(delete bt.reloadCallback,this.loadTile(ye,Pe)),Pe(qt,Lt)};bt.status==="parsing"?bt.reloadCallback=It:bt.status==="done"&&this.loadTile(ye,Pe)}}abortTile(ye,Pe){const Ze=ye.uid;this.loading[Ze]&&delete this.loading[Ze],Pe()}removeTile(ye,Pe){const Ze=this.loaded,Nt=ye.uid;Ze&&Ze[Nt]&&delete Ze[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":Q,"batched-model":go},this.workerSources={},this.self.registerWorkerSource=(Pe,Ze)=>{if(this.workerSourceTypes[Pe])throw new Error(`Worker source with name "${Pe}" already registered.`);this.workerSourceTypes[Pe]=Ze},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 Ze of this.rtlPluginParsingListeners)Ze(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(ye,Pe,Ze){delete this.layerIndexes[ye],delete this.availableImages[ye],delete this.availableModels[ye],delete this.workerSources[ye],Ze()}checkIfReady(ye,Pe,Ze){Ze()}setReferrer(ye,Pe){this.referrer=Pe}spriteLoaded(ye,Pe){this.isSpriteLoaded[ye]||(this.isSpriteLoaded[ye]={});const{scope:Ze,isLoaded:Nt}=Pe;if(this.isSpriteLoaded[ye][Ze]=Nt,this.workerSources[ye]&&this.workerSources[ye][Ze])for(const bt in this.workerSources[ye][Ze]){const It=this.workerSources[ye][Ze][bt];for(const qt in It){const Lt=It[qt];Lt instanceof V&&(Lt.isSpriteLoaded=Nt,Lt.fire(new i.z("isSpriteLoaded")))}}}setImages(ye,Pe,Ze){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 Lt in qt)qt[Lt].availableImages=bt}Ze()}else Ze()}setModels(ye,{scope:Pe,models:Ze},Nt){if(this.availableModels[ye]||(this.availableModels[ye]={}),this.availableModels[ye][Pe]=Ze,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=Ze}Nt()}else Nt()}setProjection(ye,Pe){this.projections[ye]=i.cm(Pe)}setBrightness(ye,Pe,Ze){this.brightness=Pe,Ze()}setWorldview(ye,Pe,Ze){this.worldview=Pe,Ze()}setLayers(ye,Pe,Ze){this.getLayerIndex(ye,Pe.scope).replace(Pe.layers,Pe.options),Ze()}updateLayers(ye,Pe,Ze){this.getLayerIndex(ye,Pe.scope).update(Pe.layers,Pe.removedIds,Pe.options),Ze()}loadTile(ye,Pe,Ze){Pe.projection=this.projections[ye]||this.defaultProjection,this.getWorkerSource(ye,Pe.type,Pe.source,Pe.scope).loadTile(Pe,Ze)}decodeRasterArray(ye,Pe,Ze){this.getWorkerSource(ye,Pe.type,Pe.source,Pe.scope).decodeRasterArray(Pe,Ze)}reloadTile(ye,Pe,Ze){Pe.projection=this.projections[ye]||this.defaultProjection,this.getWorkerSource(ye,Pe.type,Pe.source,Pe.scope).reloadTile(Pe,Ze)}abortTile(ye,Pe,Ze){this.getWorkerSource(ye,Pe.type,Pe.source,Pe.scope).abortTile(Pe,Ze)}removeTile(ye,Pe,Ze){this.getWorkerSource(ye,Pe.type,Pe.source,Pe.scope).removeTile(Pe,Ze)}removeSource(ye,Pe,Ze){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,Ze):Ze()}loadWorkerSource(ye,Pe,Ze){try{this.self.importScripts(Pe.url),Ze()}catch(Nt){Ze(Nt)}}syncRTLPluginState(ye,Pe,Ze){if(i.fH.isParsed())Ze(null,!0);else if(i.fH.isParsing())this.rtlPluginParsingListeners.push(Ze);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()?Ze(null,!0):this.rtlPluginParsingListeners.push(Ze))}catch(Nt){Ze(Nt)}}setDracoUrl(ye,Pe){this.dracoUrl=Pe}getAvailableImages(ye,Pe){this.availableImages[ye]||(this.availableImages[ye]={});let Ze=this.availableImages[ye][Pe];return Ze||(Ze=[]),Ze}getAvailableModels(ye,Pe){this.availableModels[ye]||(this.availableModels[ye]={});let Ze=this.availableModels[ye][Pe];return Ze||(Ze={}),Ze}getLayerIndex(ye,Pe){this.layerIndexes[ye]||(this.layerIndexes[ye]={});let Ze=this.layerIndexes[ye][Pe];return Ze||(Ze=this.layerIndexes[ye][Pe]=new y,Ze.scope=Pe),Ze}getWorkerSource(ye,Pe,Ze,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][Ze]||(bt[ye][Nt][Pe][Ze]=new this.workerSourceTypes[Pe]({send:(It,qt,Lt,Wt,fr,cr)=>this.actor.send(It,qt,Lt,ye,fr,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][Ze]}rasterizeImagesWorker(ye,Pe,Ze){const Nt=new Map;for(const[bt,{image:It,imageVariant:qt}]of Pe.tasks.entries()){const Lt=this.imageRasterizer.rasterize(qt,It,Pe.scope,ye);Nt.set(bt,Lt)}Ze(void 0,Nt)}removeRasterizedImages(ye,Pe,Ze){this.imageRasterizer.removeImagesFromCacheByIds(Pe.imageIds,Pe.scope,ye),Ze()}enforceCacheSizeLimit(ye,Pe){i.fJ(Pe)}getWorkerPerformanceMetrics(ye,Pe,Ze){Ze(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 J=document.createElement("canvas"),te=Object.create(w.webGLContextAttributes);return te.failIfMajorPerformanceCaveat=H,J.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=ne(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=ne(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=ne(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=ne(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=ne(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=ne(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=ne(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=ne(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=ne(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 pe=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function ne(w){const d=w.match(pe);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 he="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?`${he}.${d}:${j}`:`${he}:${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=ne(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,J=>{this.pendingRequest=null,j(J),this.saveEventData(),this.processRequests(E)})}queueRequest(d,p){this.queue.push(d),this.processRequests(p)}}class be 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),et=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(de)))}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=et.postMapLoadEvent.bind(et),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 be({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),Ve=Be.postMetricsEvent.bind(Be),ot=new be({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),At=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(fe){const ke={};if(fe){for(const _e in fe)if(_e!=="other")for(const Re of fe[_e]){const De=`${_e}ResolveRangeMin`,We=`${_e}ResolveRangeMax`,st=`${_e}RequestCount`,Ge=`${_e}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(st)}}return ke}(function(fe,ke){const _e={};if(fe)for(const Re of fe){const De=ke(Re);_e[De]===void 0&&(_e[De]=[]),_e[De].push(Re)}return _e}(O,y)),H=window.devicePixelRatio,J=navigator.connection||navigator.mozConnection||navigator.webkitConnection,te=J?J.effectiveType:void 0,ue={counters:[],metadata:[],attributes:[]},ce=(fe,ke,_e)=>{_e!=null&&fe.push({name:ke,value:_e.toString()})};for(const fe in B)ce(ue.counters,fe,B[fe]);if(E.interactionRange[0]!==1/0&&E.interactionRange[1]!==-1/0&&(ce(ue.counters,"interactionRangeMin",E.interactionRange[0]),ce(ue.counters,"interactionRangeMax",E.interactionRange[1])),R)for(const fe of Object.values(m)){const ke=R.find(_e=>_e.name===fe);ke&&ce(ue.counters,fe,ke.startTime)}return ce(ue.counters,"visibilityHidden",E.visibilityHidden),ce(ue.attributes,"style",function(fe){if(fe)for(const ke of fe){const _e=ke.name.split("?")[0];if(i.i(_e)){const Re=_e.split("/").slice(-2);if(Re.length===2)return`mapbox://styles/${Re[0]}/${Re[1]}`}}}(O)),ce(ue.attributes,"terrainEnabled",E.terrainEnabled?"true":"false"),ce(ue.attributes,"fogEnabled",E.fogEnabled?"true":"false"),ce(ue.attributes,"projection",E.projection),ce(ue.attributes,"zoom",E.zoom),ce(ue.metadata,"devicePixelRatio",H),ce(ue.metadata,"connectionEffectiveType",te),ce(ue.metadata,"navigatorUserAgent",navigator.userAgent),ce(ue.metadata,"screenWidth",window.screen.width),ce(ue.metadata,"screenHeight",window.screen.height),ce(ue.metadata,"windowWidth",window.innerWidth),ce(ue.metadata,"windowHeight",window.innerHeight),ce(ue.metadata,"mapWidth",E.width/H),ce(ue.metadata,"mapHeight",E.height/H),ce(ue.metadata,"webglRenderer",E.renderer),ce(ue.metadata,"webglVendor",E.vendor),ce(ue.metadata,"sdkVersion",u),ce(ue.metadata,"sdkIdentifier","mapbox-gl-js"),ue}(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=ne(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(de)))}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),Qe=new Set;function rt(w,d){d?Qe.add(w):Qe.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 ue=R.get(te.iconsetId);ue&&(this.getImage(te,p)?O.push(te):ue.addPendingRequest(te))}if(E.length===0)return void this._notify(O,p,j);let B=!0;const H=!!this.loaded.get(p),J=this.images.get(p);if(!H)for(const te of E)J.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 J=new i.A(d).scaleSelf(i.o.devicePixelRatio),te=new Map([[J.toString(),{image:B,imageVariant:J}]]);return this._rasterizeImages(p,te,(ue,ce)=>this.storePatternImage(J,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:J})=>J),{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[J,{bin:te,position:ue}]of j.entries()){let ce=ue.padding;const fe=te.x+ce,ke=te.y+ce,_e=H.get(J).data,Re=_e.width,De=_e.height;ce=ce>1?ce-1:ce,i.q.copy(_e,B,{x:0,y:0},{x:fe,y:ke},{width:Re,height:De},p),i.q.copy(_e,B,{x:0,y:De-ce},{x:fe,y:ke-ce},{width:Re,height:ce},p),i.q.copy(_e,B,{x:0,y:0},{x:fe,y:ke+De},{width:Re,height:ce},p),i.q.copy(_e,B,{x:Re-ce,y:0},{x:fe-ce,y:ke},{width:ce,height:De},p),i.q.copy(_e,B,{x:0,y:0},{x:fe+Re,y:ke},{width:ce,height:De},p),i.q.copy(_e,B,{x:Re-ce,y:De-ce},{x:fe-ce,y:ke-ce},{width:ce,height:ce},p),i.q.copy(_e,B,{x:0,y:De-ce},{x:fe+Re,y:ke-ce},{width:ce,height:ce},p),i.q.copy(_e,B,{x:0,y:0},{x:fe+Re,y:ke+De},{width:ce,height:ce},p),i.q.copy(_e,B,{x:Re-ce,y:0},{x:fe-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||ms;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 J=E!=="categorical"&&p.property===void 0,te=!J,ue=function(_e){const Re=_e.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(_e){if(E==="identity")return[new i.V(_e.key,_e.value,'identity function may not have a "stops" property')];let Re=[];const De=_e.value;return Re=Re.concat(Ee({key:_e.key,value:De,valueSpec:_e.valueSpec,style:_e.style,styleSpec:_e.styleSpec,arrayElementValidator:fe})),Array.isArray(De)&&De.length===0&&Re.push(new i.V(_e.key,De,"array must have at least one stop")),Re},default:function(_e){return ms({key:_e.key,value:_e.value,valueSpec:j,style:_e.style,styleSpec:_e.styleSpec})}}});return E==="identity"&&J&&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")):J&&!i.O(j)&&ce.push(new i.V(w.key,w.value,"zoom functions not supported"))),E!=="categorical"&&!ue||p.property!==void 0||ce.push(new i.V(w.key,w.value,'"property" property is required')),ce;function fe(_e){let Re=[];const De=_e.value,We=_e.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(ue){if(!i.H(De[0]))return[new i.V(We,De,`object expected, ${i.K(De[0])} found`)];const st=De[0];if(st.zoom===void 0)return[new i.V(We,De,"object stop key must have zoom")];if(st.value===void 0)return[new i.V(We,De,"object stop key must have value")];const Ge=i.J(st.zoom);if(typeof Ge!="number")return[new i.V(We,st.zoom,"stop zoom values must be numbers")];if(B&&B>Ge)return[new i.V(We,st.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:_e.style,styleSpec:_e.styleSpec,objectElementValidators:{zoom:Ye,value:ke}}))}else Re=Re.concat(ke({key:`${We}[0]`,value:De[0],style:_e.style,styleSpec:_e.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(ms({key:`${We}[1]`,value:De[1],valueSpec:j,style:_e.style,styleSpec:_e.styleSpec}))}function ke(_e,Re){const De=i.K(_e.value),We=i.J(_e.value),st=_e.value!==null?_e.value:Re;if(O){if(De!==O)return[new i.V(_e.key,st,`${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(_e.key,st,"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(_e.key,st,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"}`]})):ir(w)}function ir(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{J in p&&d.push(new i.V(j,p[J],`"${J}" is prohibited for ref layers`))}),E.layers.forEach(J=>{i.J(J.id)===B&&(H=J)}),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],J=H&&i.J(H.type);H?J==="vector"&&R==="raster"?d.push(new i.V(j,p.source,`layer "${p.id}" requires a raster source`)):J==="raster"&&R!=="raster"?d.push(new i.V(j,p.source,`layer "${p.id}" requires a vector source`)):J!=="vector"||p["source-layer"]?J==="raster-dem"&&R!=="hillshade"?d.push(new i.V(j,p.source,"raster-dem source can only be used with layer type 'hillshade'.")):J!=="raster-array"||["raster","raster-particle"].includes(R)?R==="line"&&p.paint&&(p.paint["line-gradient"]||p.paint["line-trim-offset"])&&J==="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"&&J!=="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:()=>ms({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:{"*":J=>Br(Object.assign({layerType:R},J))}}),paint:H=>ra({layer:p,key:H.key,value:H.value,valueSpec:{},style:H.style,styleSpec:H.styleSpec,objectElementValidators:{"*":J=>Zr(Object.assign({layerType:R,layer:p},J))}}),appearances(H){const J=Ee({key:H.key,value:H.value,valueSpec:H.valueSpec,style:H.style,styleSpec:H.styleSpec,arrayElementValidator:ce=>function(fe){const{key:ke,layer:_e,layerType:Re}=fe,De=i.J(fe.value),We=i.J(De.name),st=i.J(De.condition),Ge=ra({key:ke,value:De,valueSpec:fe.styleSpec.appearance,style:fe.style,styleSpec:fe.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:_e,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 lr=Xt in Rt?"paint":Xt in Dt?"layout":void 0;if(!lr){_t.push(new i.V(gt.key,Xt,`unknown property "${Xt}" for layer type "${St}"`));continue}const br=Object.assign({},gt,{key:`${gt.key}.${Xt}`,object:Yt,objectKey:Xt,layer:ht,layerType:St,value:Yt[Xt],valueSpec:lr==="paint"?Rt[Xt]:Dt[Xt]});_t.push(...Mr(br,lr))}return _t}(Object.assign({layer:_e,layerType:Re},jt))}});return We!=="hidden"&&st===void 0&&Ge.push(new i.V(fe.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:[],ue=new Set;return te.forEach((ce,fe)=>{const ke=i.J(ce.name);if(ke)if(ue.has(ke)){const _e=i.J(p.id);J.push(new i.V(H.key,ke,`Duplicated appearance name "${ke}" for layer "${_e}"`))}else ue.add(ke)}),J}}})),d}function Zn({key:w,value:d}){return i.a0(d)?[]:[new i.V(w,d,`string expected, ${i.K(d)} found`)]}const Ot={promoteId:function w({key:d,value:p}){if(i.a0(p))return Zn({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 Gr(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:Ot})),R;case"geojson":if(R=ra({key:p,value:d,valueSpec:j.source_geojson,style:E,styleSpec:j,objectElementValidators:Ot}),"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[J,te]=H,ue=typeof J=="string"?[J,["accumulated"],["get",B]]:J;R.push(...Ke({key:`${p}.${B}.map`,value:te,expressionContext:"cluster-map"})),R.push(...Ke({key:`${p}.${B}.reduce`,value:ue,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:An(j)}})}}function An(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 zn(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]]?ms({key:R,value:d[R],valueSpec:{type:"string"},style:E,styleSpec:p}):B&&j[B[1]]&&j[B[1]].transition?ms({key:R,value:d[R],valueSpec:p.transition,style:E,styleSpec:p}):j[R]?ms({key:R,value:d[R],valueSpec:j[R],style:E,styleSpec:p}):[new i.V(R,d[R],`unknown property "${R}"`)])}return O}function ba(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:Ye,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:rn,object:ra,source:Gr,model:i.a7,light:zn,"light-3d":ba,terrain:gi,fog:Mo,string:Zn,formatted:function(w){return Zn(w).length===0?[]:Ke(w)},resolvedImage:function(w){return Zn(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(ms({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 ms(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&&Wa[j.type]){const O=Wa[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 J=H.split(".")[0];let te;E[J]?te=E[J]:j[J]?te=ms:E["*"]?te=E["*"]:j["*"]&&(te=ms),te?B=B.concat(te({key:(d&&`${d}.`)+H,value:p[H],valueSpec:j[J]||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 J=j[H];J.required&&J.default===void 0&&p[H]===void 0&&B.push(new i.V(d,p,`missing required property "${H}"`))}return B}function fs({key:w,value:d}){const p=Zn({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:fs}})}function Bs(w,d=i.a6){return Pe(Ys(w,d))}const Ni=w=>Pe(Gr(w)),or=w=>Pe(zn(w)),La=w=>Pe(ba(w)),oo=w=>Pe(gi(w)),ji=w=>Pe(Mo(w)),Hn=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?ms({key:B,value:p[B],valueSpec:E.transition,style:j,styleSpec:E}):O[B]?ms({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?ms({key:B,value:p[B],valueSpec:E.transition,style:j,styleSpec:E}):O[B]?ms({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(rn(w)),go=w=>Pe(zt(w)),uc=w=>Pe(Zr(w)),nt=w=>Pe(Br(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 Ze(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(or,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)&&Ze(this,d.call(Bs,Object.assign({value:p,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}}const qt=i.a6.terrain;let Lt=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,fr=65,cr=.05;function Xr(w,d,p,j){const E=i.ah(Wt,fr,p),[O,R]=Mn(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 Mn(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 cs(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,J=-Number.MAX_VALUE;for(const te of B){const ue=i.af([],te,d),ce=i.ag(ue);H=Math.min(H,ce),J=Math.max(J,ce)}return[Xr(w,H,R.pitch,R._fov),Xr(w,J,R.pitch,R._fov)]}const ds=i.a6.fog;class ns extends i.E{constructor(d,p,j,E){super();const O=new i.a9({range:new i.aa(ds.range),color:new i.aa(ds.color),"color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"high-color":new i.aa(ds["high-color"]),"high-color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"space-color":new i.aa(ds["space-color"]),"space-color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new i.aa(ds["horizon-blend"]),"star-intensity":new i.aa(ds["star-intensity"]),"vertical-range":new i.aa(ds["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(ji,d,j))return;const E=Object.assign({},d);for(const O of Object.keys(ds))E[O]===void 0&&(E[O]=ds[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,fr,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 cs(this.state,p,0,0,i.al,i.al,this._transform)}getOpacityForBounds(d,p,j,E,O){return this._transform.projection.supportsFog?cs(this.state,d,p,j,E,O,this._transform):[1,1]}getFovAdjustedRange(d){return this._transform.projection.supportsFog?Mn(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)&&Ze(this,d.call(Bs,Object.assign({value:p,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}}let Ws,$i,jo,wa,To=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(Hn,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)&&Ze(this,w.call(Bs,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)&&Ze(this,w.call(Bs,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 J=this.screenGeometryMercator.polygon.map(Re=>i.au(d.tileTransform,Re,B)),te=J.map(Re=>new i.P(Re[0],Re[1])),ue=p.getFreeCameraOptions().position||new i.ae(0,0,0),ce=i.au(d.tileTransform,ue,B),fe=J.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:fe,bufferedTilespaceGeometry:H,bufferedTilespaceBounds:(_e=i.az(H),_e.min.x=i.aA(_e.min.x,0,i.al),_e.min.y=i.aA(_e.min.y,0,i.al),_e.max.x=i.aA(_e.max.x,0,i.al),_e.max.y=i.aA(_e.max.y,0,i.al),_e),tile:d,tileID:d.tileID,pixelToTileUnitsFactor:ke};var _e}_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],J=[0,i.aD,0,1],te=[0,0,0,1];i.aC(H,H,B),i.aC(J,J,B),i.aC(te,te,B);const ue=new i.P(H[0]/H[3],H[1]/H[3]),ce=new i.P(J[0]/J[3],J[1]/J[3]),fe=i.aE(O,ue)&&H[3]1?Ga(O.slice(0,Re),R):[],st=Renew i.P(Ps(_t.x),_t.y)),st=st.map(_t=>new i.P(Ps(_t.x),_t.y));const Ge=[...We];Ge.length===0&&Ge.push(st[st.length-1]);const jt=i.ak(Ge[Ge.length-1].y,(st.length===0?We[0]:st[0]).y,De);let gt;return gt=fe?[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),st.length===0?Ge.push(We[0]):Ge.push(...st),{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,J=0;for(let ue=0;ueH&&(H=O[ue].x,J=ue);for(let ue=0;ue.5&&(fe.x{ue.x-=1}),{polygon:O,unwrapped:B}}(Ga(d,p).map(O=>new i.P(Ps(O.x),O.y)),p);return{polygon:E.polygon.map(O=>new i.ae(O.x,O.y)),unwrapped:E.unwrapped}}}function Ga(w,d){return i.aG(w,p=>{const j=d.pointCoordinate3D(p);p.x=j.x,p.y=j.y},1/256)}function Ps(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 J=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"]);J.tiles=d.canonicalizeTileset(J,w.url),E(null,J)}},R=function(B,H,J){if(!B)return null;if(!H&&!J)return B;J=J||B.worldview_default;const te=Object.values(B.language||{});if(te.length===0)return null;const ue=Object.values(B.worldview||{});if(ue.length===0)return null;const ce=te.every(ke=>ke===H),fe=ue.every(ke=>ke===J);return ce&&fe?B:H in(B.language_options||{})||J 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,J.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,J.bind(this),void 0,!0);else{const te=i.aL.call({deduped:this._deduped},H,(ue,ce)=>{if(ue||!ce)J.call(this,ue);else{const fe=i.aM(ce.responseHeaders);H.data={rawData:ce.rawData.slice(0),expires:fe.expires,cacheControl:fe.cacheControl},d.actor&&d.actor.send("loadTile",H,J.bind(this),void 0,!0)}},!0);d.request={cancel:te}}function J(te,ue){return delete d.request,d.aborted?p(null):te&&te instanceof i.aN&&te.status!==404?p(te):(ue&&ue.resourceTiming&&(d.resourceTiming=ue.resourceTiming),this.map._refreshExpiredTiles&&ue&&d.setExpiryData(ue),d.loadVectorData(ue,this.map.painter),i.aO(this.dispatcher),p(null,ue),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:J}=p;if(!isFinite(B)||!isFinite(H)||!isFinite(J))throw new Error("Invalid MRT header");const te=2**J,ue=te*i.aF(w),ce=te*i.aJ(d);return function([fe,ke],_e,{scaled:Re=!0}={}){if(!_e)throw new Error("bandView is undefined");const{data:De,tileSize:We,buffer:st,offset:Ge,scale:jt,dimension:gt}=_e;if(fe<-st||fe>We+st||ke<-st||ke>We+st)throw new Error(`Point (${fe}, ${ke}) out of bounds for tileSize=${We}, buffer=${st}`);const _t=(ke+st)*(We+2*st)+(fe+st);if(new Uint32Array(De.buffer)[_t]===4294967295)return null;let pt=[];pt=Re?[]:new _e.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(J);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:J,tileSize:te,buffer:ue}=H.getBandView(B),ce=te+2*ue,fe={data:new i.q({width:ce,height:ce},J),pixelRatio:2,sdf:!1,usvg:!1,version:0};j.set(O,fe)}return j}queryRasterArrayValueByBandId(d,p,j){const E=p._mrt;return new Promise(O=>{const R={},B=new Set;for(const[H,J]of Object.entries(E.layers)){if(j.layerName&&H!==j.layerName)continue;const te={};R[H]=te;for(const{bands:ue}of J.dataIndex)for(const ce of ue)j.bands&&!j.bands.includes(ce)||(B.add(i.B(H,ce)),p.fetchBand(H,null,ce,fe=>{i.o.frame(()=>{te[ce]=fe?null:Hd([d.lng,d.lat],E,J.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 hh[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 Yy(w,d,p,j,E=!1){const O=d.sourceCache.transform,R=d.sourceCache.tilesIn(w,d.has3DLayers,E);R.sort(qh);const B=[];for(const H of R){const J=H.tile.queryRenderedFeatures(d,H,p,j,O,E);Object.keys(J).length&&B.push({wrappedTileID:H.tile.tileID.wrapped().key,queryResults:J})}for(const H in d.layers){const J=d.layers[H];if(J.styleLayer){const te=J.styleLayer.queryRenderedFeatures(w,d.sourceCache,j);Object.keys(te).length&&B.push({wrappedTileID:0,queryResults:te})}}return B.length===0?{}:function(H){const J={},te={};for(const ue of H){const ce=ue.queryResults,fe=ue.wrappedTileID,ke=te[fe]=te[fe]||{};for(const _e in ce){const Re=ce[_e],De=ke[_e]=ke[_e]||{},We=J[_e]=J[_e]||[];for(const st of Re)De[st.featureIndex]||(De[st.featureIndex]=!0,We.push(st))}}return J}(B)}function Xy(w,d,p,j,E,O){const R={},B=j.queryRenderedSymbols(w),H=[];for(const J of Object.keys(B).map(Number))H.push(E[J]);H.sort(qh);for(const J of H){const te=J.featureIndex.lookupSymbolFeatures(B[J.bucketInstanceId],J.bucketIndex,J.sourceLayerIndex,d,p,O);for(const ue in te){const ce=R[ue]=R[ue]||[],fe=te[ue];fe.sort((ke,_e)=>{const Re=J.featureSortOrder;if(Re){const De=Re.indexOf(ke.featureIndex);return Re.indexOf(_e.featureIndex)-De}return _e.featureIndex-ke.featureIndex});for(const ke of fe)ce.push(ke)}}return R}function Qy(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 J=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=J,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),Ho=new Uint8Array(1089),Eu=new Uint16Array(1089);function Vh(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",J=d.style.getLayerSourceCache(B);let te={};J&&(te=J._state.getState(H,void 0));const ue=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},ce=Object.keys(te).length>0&&!p;R.hasAppearances=R.layers.some(_e=>_e.appearances&&_e.appearances.length>0);const fe=ce?R.stateDependentLayers:R.layers;if(ce&&R.stateDependentLayers.length!==0||p){const _e=this.latestFeatureIndex.loadVTLayers();R.update(te,_e[H],j,ue,fe,p,E)}if(ce&&R.stateDependentLayers.length!==0||p||R.hasAppearances){const _e={zoom:d.transform.zoom,pitch:d.transform.pitch,brightness:d.style.getBrightness()||0,worldview:d.worldview};R.updateAppearances(this.tileID.canonical,te,j,_e)}(R instanceof i.ba||R instanceof i.bb)&&d._terrain&&d._terrain.enabled&&J&&R.uploadPending()&&d._terrain._clearRenderCacheForTile(J.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],st=mc[De+1],Ge=mc[De+2],jt=mc[De+3],gt=We+Ge>>1,_t=st+jt>>1,pt=gt+_t-st,ht=_t+We-gt,St=st*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;Ho[Dt]=Ho[Dt]||(Yt?1:0),Re<1022&&(Ho[Dt]=Ho[Dt]||Ho[(st+ht>>1)*lu+(We+pt>>1)]||Ho[(jt+ht>>1)*lu+(Ge+pt>>1)])}const ue=new i.b1,ce=new i.b0;let fe=0;function ke(Re,De){const We=De*lu+Re;return Eu[We]===0&&(ue.emplaceBack(Jc[2*We+0],Jc[2*We+1],Re*i.al/Qc,De*i.al/Qc),Eu[We]=++fe),Eu[We]-1}function _e(Re,De,We,st,Ge,jt){const gt=Re+We>>1,_t=De+st>>1;if(Math.abs(Re-Ge)+Math.abs(De-jt)>1&&Ho[_t*lu+gt])_e(Ge,jt,Re,De,gt,_t),_e(We,st,Ge,jt,gt,_t);else{const pt=ke(Re,De),ht=ke(We,st),St=ke(Ge,jt);ce.emplaceBack(pt,ht,St)}}return _e(0,0,Qc,Qc,Qc,0),_e(Qc,Qc,0,0,0,Qc),{vertices:ue,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 J=1<.5?fe=-1:ce<-.5&&(fe=1);let ke=(d/i.al+j.x)/J+fe,_e=(p/i.al+j.y)/J;ke=(ke-te)*E._pixelsPerMercatorPixel+te,_e=(_e-ue)*E._pixelsPerMercatorPixel+ue;const Re=[ke*E.worldSize,_e*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,J=new i.bo,te=(ce,fe,ke,_e,Re)=>{const De=(ke-ce)/(Re-1),We=(_e-fe)/(Re-1),st=B.length;for(let Ge=0;Geue*fe+ke;for(let fe=0;fe{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 J=0;for(const te of Object.values(j.layers))J=Math.max(J,te.dataIndex[te.dataIndex.length-1].lastByte);R.byteLength>=J&&(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 J=i.B(String(j),i.B(this.tileID.key,d));let te=this._taskQueue.get(J);te?te.add(E):(te=new Set,te.add(E),this._taskQueue.set(J,te));const ue=(_e,Re)=>{H.complete(_e,Re),_e?E(_e):(te.forEach(De=>De(null,Re)),this._taskQueue.delete(J))},ce=(_e,Re)=>{if(_e)return E(_e);const De=B.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:Re,task:H},ue,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 fe;try{fe=R.getLayer(d)}catch(_e){if(this.state==="reloading")return;throw _e}if(!fe)return void E(new Error(`Unknown sourceLayer "${d}"`));if(fe.hasDataForBand(j))return te.forEach(_e=>_e(null,null)),void this._taskQueue.delete(J);const ke=fe.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 _e=Object.assign({},this.requestParams,{headers:{Range:`bytes=${ke.firstByte}-${ke.lastByte}`}}),Re=i.bu(_e,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:J}=E.getBandView(j),te=R+2*B,ue=new i.q({width:te,height:te},O),ce=this.texturePerLayer.get(p);ce&&ce instanceof i.T&&ce.update(ue,{premultiply:!1}),this.textureDescriptorPerLayer.set(p,{layer:d,band:j,img:ue,buffer:B,offset:H,tileSize:R,format:E.pixelFormat,mix:[J,256*J,65536*J,16777216*J]})}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 J=O[p];if(J===null)return{};for(const te in J)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 vd 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(e0).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),J=new i.P(B.canonical.x,B.canonical.y)._rotate(this.transform.angle);return R.overscaledZ-B.overscaledZ||J.y-H.y||J.x-H.x}).map(E=>E.tileID.key):j.map(E=>E.tileID).sort(e0).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[J]&&(E.neighboringTiles[J].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 J=R.tileID.scaledTo(R.tileID.overscaledZ-1);R=this._tiles[J.key],R&&R.hasData()&&(B=J)}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 J=this.map&&this.map.painter?this.map.painter._terrain:null;if(J&&J.sourceCache===this&&J.attenuationRange()){const ce=J.attenuationRange()[0],fe=Math.floor(ce)-Math.log2(J.getDemUpscale());H>fe&&(H=fe)}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(fe=>ce(fe))}}else B=[];if(B.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!Em(this._source.type)){const ce=d.coveringZoomLevel({tileSize:p||this._source.tileSize,roundZoom:this._source.roundZoom&&!j}),fe=Math.min(ce,this._source.maxzoom);if(R){const ke=d.extendTileCover(B,fe);for(const _e of ke)B.push(_e)}else if(O){const ke=d.extendTileCoverToNearPlane(B,this.transform.getFrustum(fe),fe);for(const _e of ke)B.push(_e)}else if(this.castsShadows&&E){const ke=d.extendTileCover(B,fe,E,16);for(const _e of ke)this._shadowCasterTiles[_e.key]=!0,B.push(_e)}}const te=this._updateRetainedTiles(B);if(Em(this._source.type)&&B.length!==0){const ce={},fe={},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 st=this.findLoadedParent(De,Math.max(De.overscaledZ-vd.maxOverzooming,this._source.minzoom));st&&(this._addTile(st.tileID),ce[st.tileID.key]=st.tileID),fe[Re]=De}const _e=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>_e;){We=We.scaledTo(We.overscaledZ-1);const st=this._tiles[We.key];if(st&&st.hasData()&&fe[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 ue=i.bv(this._tiles,te);for(const ce of ue){const fe=this._tiles[ce];fe.hasSymbolBuckets&&!fe.holdingForFade()?fe.setHoldDuration(this.map._fadeDuration):fe.hasSymbolBuckets&&!fe.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((J,te)=>Math.min(J,te.overscaledZ),1/0),O=d[0].overscaledZ,R=Math.max(O-vd.maxOverzooming,this._source.minzoom),B=Math.max(O+vd.maxUnderzooming,this._source.minzoom),H={};for(const J of d){const te=this._addTile(J);p[J.key]=J,te.hasData()||E=this._source.maxzoom){const ce=J.children(this._source.maxzoom)[0],fe=this.getTile(ce);if(fe&&fe.hasData()){p[ce.key]=ce;continue}}else{const ce=J.children(this._source.maxzoom);if(p[ce[0].key]&&p[ce[1].key]&&p[ce[2].key]&&p[ce[3].key])continue}let ue=te.wasRequested();for(let ce=J.overscaledZ-1;ce>=R;--ce){const fe=J.scaledTo(ce);if(j[fe.key]||(j[fe.key]=!0,te=this.getTile(fe),!te&&ue&&(te=this._addTile(fe)),te&&(p[fe.key]=fe,ue=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 Jy(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 J=this._tiles[H];if(j&&J.clearQueryDebugViz(),J.holdingForFade())continue;let te;if(R){const ue=J.tileID.canonical;if(ue.z===0){const ce=[Math.abs(i.aA(B,...Iu(ue,-1))-B),Math.abs(i.aA(B,...Iu(ue,1))-B)];te=[0,2*ce.indexOf(Math.min(...ce))-1]}else{const ce=[Math.abs(i.aA(B,...Iu(ue,-1))-B),Math.abs(i.aA(B,...Iu(ue,0))-B),Math.abs(i.aA(B,...Iu(ue,1))-B)];te=[ce.indexOf(Math.min(...ce))-1]}}else te=[0];for(const ue of te){const ce=d.containsTile(J,O,p,ue);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(Em(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 J=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 J)j.set(te.key,te);this.usedForTerrain&&H.updateElevation(!1)}const B=Array.from(j.values());i.bw(B,(H,J)=>{const te=new Tf(H,this._source.tileSize*H.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(te,ue=>{this._source.type==="raster-dem"&&te.dem&&this._backfillDEM(te),J(ue,te)})},p)}}function e0(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 Em(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 J in R._tiles){const te=R._tiles[J];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 is{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,J=p+j;if(B<0||R>this.width||J<0||H>this.height)return!E&&[];const te=[];return this._forEachCell(R,H,B,J,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 J=B.seenUids,te=this.boxCells[O];if(te!==null){const ce=this.bboxes;for(const fe of te)if(!J.box[fe]){J.box[fe]=!0;const ke=4*fe;if(d<=ce[ke+2]&&p<=ce[ke+3]&&j>=ce[ke+0]&&E>=ce[ke+1]&&(!H||H(this.boxKeys[fe]))){if(B.hitTest)return R.push(!0),!0;R.push({key:this.boxKeys[fe],x1:ce[ke],y1:ce[ke+1],x2:ce[ke+2],y2:ce[ke+3]})}}}const ue=this.circleCells[O];if(ue!==null){const ce=this.circles;for(const fe of ue)if(!J.circle[fe]){J.circle[fe]=!0;const ke=3*fe;if(this._circleAndRectCollide(ce[ke],ce[ke+1],ce[ke+2],d,p,j,E)&&(!H||H(this.circleKeys[fe]))){if(B.hitTest)return R.push(!0),!0;{const _e=ce[ke],Re=ce[ke+1],De=ce[ke+2];R.push({key:this.circleKeys[fe],x1:_e-De,y1:Re-De,x2:_e+De,y2:Re+De})}}}}}_queryCellCircle(d,p,j,E,O,R,B,H){const J=B.circle,te=B.seenUids,ue=this.boxCells[O];if(ue!==null){const fe=this.bboxes;for(const ke of ue)if(!te.box[ke]){te.box[ke]=!0;const _e=4*ke;if(this._circleAndRectCollide(J.x,J.y,J.radius,fe[_e+0],fe[_e+1],fe[_e+2],fe[_e+3])&&(!H||H(this.boxKeys[ke])))return R.push(!0),!0}}const ce=this.circleCells[O];if(ce!==null){const fe=this.circles;for(const ke of ce)if(!te.circle[ke]){te.circle[ke]=!0;const _e=3*ke;if(this._circlesCollide(fe[_e],fe[_e+1],fe[_e+2],J.x,J.y,J.radius)&&(!H||H(this.circleKeys[ke])))return R.push(!0),!0}}}_forEachCell(d,p,j,E,O,R,B,H){const J=this._convertToXCellCoord(d),te=this._convertToYCellCoord(p),ue=this._convertToXCellCoord(j),ce=this._convertToYCellCoord(E);for(let fe=J;fe<=ue;fe++)for(let ke=te;ke<=ce;ke++)if(O.call(this,d,p,j,E,this.xCellCount*ke+fe,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,J=j+R;return J*J>B*B+H*H}_circleAndRectCollide(d,p,j,E,O,R,B){const H=(R-E)/2,J=Math.abs(d-(E+H));if(J>H+j)return!1;const te=(B-O)/2,ue=Math.abs(p-(O+te));if(ue>te+j)return!1;if(J<=H||ue<=te)return!0;const ce=J-H,fe=ue-te;return ce*ce+fe*fe<=j*j}}const sa={unknown:0,flipRequired:1,flipNotRequired:2},Ls=Math.tan(85*Math.PI/180);function ja(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 Hh(w,d,p,j,E,O,R){const B=ja(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=ja(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):jn(E,E,j);const O=E[3];return E[0]/=O,E[1]/=O,E[2]/=O,E}function ka(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 LP(w,d,p,j,E,O,R,B,H,J,te=1){const ue=p.transform,ce=j?w.textSizeData:w.iconSizeData,fe=i.bK(ce,p.transform.zoom,te),ke=ue.projection.name==="globe",_e=[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,st=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)>Ls}(p,j)?d===sa.flipRequired?{needsFlipping:!0}:null:p<0?{needsFlipping:!0}:null}function r5(w,d,p,j,E,O,R,B,H,J,te,ue,ce,fe,ke,_e,Re,De,We,st){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=lr=>{if(te){const[er,Kt,hr]=lr.up,Ir=J.length;i.bN(te,Ir+0,er,Kt,hr),i.bN(te,Ir+1,er,Kt,hr),i.bN(te,Ir+2,er,Kt,hr),i.bN(te,Ir+3,er,Kt,hr)}const[br,Vt,Et]=lr.point;i.bO(J,br,Vt,Et,lr.angle)};if(ht>1){const lr=OP(Ge,B,jt,gt,p,ue,ce,w,H,O,fe,_e,!1,Re,De,We,st);if(!lr)return{notEnoughRoom:!0};if(j&&!p){let[br,Vt,Et]=lr.first.point,[er,Kt,hr]=lr.last.point;[br,Vt]=Il(br,Vt,Et,R),[er,Kt]=Il(er,Kt,hr,R);const Ir=$n(Rt,Dt,(er-br)*ke,Kt-Vt);if(w.flipState=Ir&&Ir.needsFlipping?sa.flipRequired:sa.flipNotRequired,Ir)return Ir}Xt(lr.first);for(let br=pt+1;br0?er:mh(ce,Et,br,1,E,void 0,Re,De.canonical),hr=$n(Rt,Dt,(Kt[0]-br[0])*ke,Kt[1]-br[1]);if(w.flipState=hr&&hr.needsFlipping?sa.flipRequired:sa.flipNotRequired,hr)return hr}const lr=r0(Ge*B.getoffsetX(pt),jt,gt,p,ue,ce,St,_t,Yt,H,O,fe,_e,!1,!1,Re,De,We,st);if(!lr)return{notEnoughRoom:!0};Xt(lr)}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,J,te]=E.getElevation(w,E.elevation,E.elevationFeature);return Il(O+H,R+J,B+te,p)}function mh(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 r0(w,d,p,j,E,O,R,B,H,J,te,ue,ce,fe,ke,_e,Re,De,We){const st=j?w-d:w+d;let Ge=st>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(st),Dt=[],Yt=[];let Xt=O,lr=Xt,br=i.bF([]);const Vt=()=>mh(lr,Xt,pt,Rt-ht+1,te,ce,_e,Re.canonical);for(;ht+St<=Rt;){if(gt+=Ge,gt=H)return null;if(pt=_t,lr=Xt,Dt.push(pt),fe&&Yt.push(lr),Xt=new i.P(J.getx(gt),J.gety(gt)),_t=ue[gt],!_t){const on=Fv(Xt,Re.canonical,te,_e,ce);_t=on[3]>0?ue[gt]=on:Vt()}ht+=St;const wr=i.av([],_t,pt),pn=i.bG(pt,_t);if(p&&pn>0&&St>0&&i.bJ(br,wr)/(St*pn)0,st),_t=J*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,ue)||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,J,te,ue,ce,fe,ke,_e,Re){const De=[],We=this.transform.elevation,st=d.getProjection(),Ge=d.elevationType==="road",jt=!!We||Ge,gt=i.bV.getAtTileOffsetFunc(Re,this.transform.center.lat,this.transform.worldSize,st),_t=new i.P(j.tileAnchorX,j.tileAnchorY),pt=new i.P(j.tileAnchorX,j.tileAnchorY);let{x:ht,y:St,z:Rt}=st.projectTilePoint(pt.x,pt.y,Re.canonical),Dt=null;if(jt){const pn=Ge?d.getElevationFeatureForText(E):null;Dt={getElevation:gt,elevation:We,elevationFeature:pn};const[on,Vr,Qr]=gt(_t,We,pn);ht+=on,St+=Vr,Rt+=Qr}const Yt=st.name==="globe",Xt=this.projectAndGetPerspectiveRatio(H,ht,St,Rt,Re,Yt||!!We||this.transform.pitch>0,st),{perspectiveRatio:lr}=Xt,br=(ce?B/lr:B*lr)/i.bY,Vt=Il(ht,St,Rt,J),Et=j.lineOffsetX*br,er=j.lineOffsetY*br,Kt=i.an(d.layers[0].layout.get("text-max-angle")),hr=Math.cos(Kt),Ir=Xt.signedDistanceFromCamera>0?OP(br,R,Et,er,Ge&&j.flipState===1,Vt,pt,j,O,J,{},jt&&!ce?Dt:null,ce&&jt,st,Re,ce,hr):null;let Yr=!1,Cr=!1,wr=!0;if(Ir&&!Xt.occluded){const pn=.5*ke*lr+_e,on=new i.P(-100,-100),Vr=new i.P(this.screenRightBoundary,this.screenBottomBoundary),Qr=new as,{first:Tn,last:ss}=Ir,Gs=Tn.path.length;let Na=[];for(let es=Gs-1;es>=1;es--)Na.push(Tn.path[es]);for(let es=1;es(jt&&!Yt&&(Va=gt(Raes[3]<=0)&&(Na=[]));let fa=[];if(Na.length>0){let es=1/0,Ta=-1/0,Va=1/0,Ra=-1/0;for(const ha of Na)es=Math.min(es,ha[0]),Va=Math.min(Va,ha[1]),Ta=Math.max(Ta,ha[0]),Ra=Math.max(Ra,ha[1]);Ta>=on.x&&es<=Vr.x&&Ra>=on.y&&Va<=Vr.y&&(fa=[Na.map(ha=>new i.P(ha[0],ha[1]))],(esVr.x||VaVr.y)&&(fa=i.bW(fa,on.x,on.y,Vr.x,Vr.y)))}for(const es of fa){Qr.reset(es,.25*pn);let Ta=0;Ta=Qr.length<=.5*pn?1:Math.ceil(Qr.paddedLength/yn)+1;for(let Va=0;Va0?(i.aC(H,H,d),this.fogState&&O&&B.name!=="globe"&&(J=function(ce,fe,ke,_e,Re,De){const We=De.calculateFogTileMatrix(Re),st=[fe,ke,_e];return i.af(st,st,We),Xr(ce,i.ag(st),De.pitch,De._fov)}(this.fogState,p,j,E,O.toUnwrapped(),this.transform)>.9)):jn(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||J}}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,J=i.c2(w,j);return new i.P(B+J[0]*E,H+J[1]*E)}function $o(w,d,p,j,E){const O=new i.P(w,d);return p&&O._rotate(j?E:-E),O}class Bie{constructor(d,p,j,E,O,R){this.transform=d.clone(),this.projection=d.projection.name,this.collisionIndex=new qa(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,J=R.layers[0].paint,te=j.collisionBoxArray,ue=Math.pow(2,this.transform.zoom-j.tileID.overscaledZ),ce=j.tileSize/i.al,fe=j.tileID.toUnwrapped();this.transform.setProjection(R.projection);const ke=(_e=j.tileID,Re=R.getProjection(),De=this.transform,Re.name===this.projection?De.calculateProjMatrix(_e.toUnwrapped()):kt(De,Re,_e));var _e,Re,De;const We=H.get("text-pitch-alignment")==="map",st=H.get("text-rotation-alignment")==="map";p.compileFilter(p.options);const Ge=p.dynamicFilter(),jt=p.dynamicFilterNeedsFeature(),gt=this.transform.calculatePixelsToTileUnitsMatrix(j),_t=Hh(ke,j.tileID.canonical,We,st,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,st,this.transform,R.getProjection(),gt);pt=i.aB([],this.transform.labelPlaneMatrix,Et)}let St=null;Ge&&j.latestFeatureIndex&&(St={unwrappedTileID:fe,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,lr]=H.get("icon-size-scale-range"),br=i.aA(O,Xt,lr),Vt={bucket:R,layout:H,paint:J,posMatrix:ke,invMatrix:ht,mercatorCenter:[i.aF(this.transform.center.lng),i.aJ(this.transform.center.lat)],textLabelPlaneMatrix:_t,labelToScreenMatrix:pt,clippingData:St,scale:ue,textPixelRatio:ce,holdingForFade:j.holdingForFade(),collisionBoxArray:te,partiallyEvaluatedTextSize:i.bK(R.textSizeData,this.transform.zoom,Yt),partiallyEvaluatedIconSize:i.bK(R.iconSizeData,this.transform.zoom,br),collisionGroup:this.collisionGroups.get(R.sourceID),latestFeatureIndex:j.latestFeatureIndex};if(E)for(const Et of R.sortKeyRanges){const{sortKey:er,symbolInstanceStart:Kt,symbolInstanceEnd:hr}=Et;d.push({sortKey:er,symbolInstanceStart:Kt,symbolInstanceEnd:hr,parameters:Vt})}else d.push({symbolInstanceStart:0,symbolInstanceEnd:R.symbolInstances.length,parameters:Vt})}attemptAnchorPlacement(d,p,j,E,O,R,B,H,J,te,ue,ce,fe,ke,_e,Re,De,We,st,Ge,jt){const{textOffset0:gt,textOffset1:_t,crossTileID:pt}=_e,ht=[gt,_t],St=Ic(d,R,B,ht,H),Rt=this.collisionIndex.placeCollisionBox(De,H,p,j,E,O,$o(St.x,St.y,J,te,this.transform.angle),ke,ue,ce,fe.predicate);if(st){const Dt=De.getSymbolInstanceIconSize(jt,this.transform.zoom,_e.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(De,Dt,st,j,E,O,$o(St.x,St.y,J,te,this.transform.angle),ke,ue,ce,fe.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,_e,We),De.allowVerticalPlacement&&(this.markUsedOrientation(De,We,_e),this.placedOrientations[pt]=We),{shift:St,placedGlyphBoxes:Rt}}}placeLayerBucketPart(d,p,j,E,O=1){const{bucket:R,layout:B,paint:H,posMatrix:J,textLabelPlaneMatrix:te,labelToScreenMatrix:ue,clippingData:ce,textPixelRatio:fe,mercatorCenter:ke,invMatrix:_e,holdingForFade:Re,collisionBoxArray:De,partiallyEvaluatedTextSize:We,partiallyEvaluatedIconSize:st,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",lr=B.get("symbol-placement"),[br,Vt]=B.get("text-size-scale-range"),[Et,er]=B.get("icon-size-scale-range"),Kt=i.aA(O,br,Vt),hr=i.aA(O,Et,er),Ir=B.get("text-variable-anchor"),Yr=St&&lr!=="point",Cr=Rt&&lr!=="point",wr=Ir&&R.hasTextData(),pn=R.hasIconTextFit()&&wr&&R.hasIconData();this.transform.setProjection(R.projection);const on=wr||Yr,Vr=Cr||pn;let Qr=pt&&(ht||!R.hasIconData()||_t),Tn=ht&&(pt||!R.hasTextData()||gt);const ss=!Yt.isConstant();!R.collisionArrays&&De&&R.deserializeCollisionBoxes(De),j&&E&&R.updateCollisionDebugBuffers(this.transform.zoom,De,Kt,hr);const Gs=(yn,fa,es)=>{const{crossTileID:Ta,numVerticalGlyphVertices:Va}=yn;let Ra=null;if(ce&&ce.dynamicFilterNeedsFeature||ss){const ro=this.retainedQueryData[R.bucketInstanceId];Ra=jt.loadFeature({featureIndex:yn.featureIndex,bucketIndex:ro.bucketIndex,sourceLayerIndex:ro.sourceLayerIndex,layoutVertexArrayOffset:0});const xo=Ra.properties?Ra.properties.worldview:null;if(R.localizable&&R.worldview&&typeof xo=="string")if(xo==="all")Ra.properties.$localized=!0;else{if(!xo.split(",").includes(R.worldview))return;Ra.properties.$localized=!0,Ra.properties.worldview=R.worldview}}if(ce&&!(0,ce.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:R.worldview},Ra,this.retainedQueryData[R.bucketInstanceId].tileID.canonical,new i.P(yn.tileAnchorX,yn.tileAnchorY),this.transform.calculateDistanceTileData(ce.unwrappedTileID)))return this.placements[Ta]=new Oa(!1,!1,!1,!0),void p.add(Ta);const ha=Yt.evaluate(Ra,{});if(p.has(Ta))return;if(Re)return void(this.placements[Ta]=new Oa(!1,!1,!1));let gs=!1,Ma=!1,Zi=!0,Ci=!1,Aa=!1,oa=null,xs={box:null,offscreen:null,occluded:null},xi={box:null},ho=null,qi=null,ei=null,Nd=0,fc=0,el=0;es.textFeatureIndex?Nd=es.textFeatureIndex:yn.useRuntimeCollisionCircles&&(Nd=yn.featureIndex),es.verticalTextFeatureIndex&&(fc=es.verticalTextFeatureIndex);const Lc=R.elevationFeatures?R.elevationFeatures[yn.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+=yn.zOffset},Gl=es.textBox;if(Gl){Oc(Gl);const ro=ti=>{let Ao=i.bL.horizontal;if(R.allowVerticalPlacement&&!ti&&this.prevPlacement){const Yi=this.prevPlacement.placedOrientations[Ta];Yi&&(this.placedOrientations[Ta]=Yi,Ao=Yi,this.markUsedOrientation(R,Ao,yn))}return Ao},xo=(ti,Ao)=>{if(R.allowVerticalPlacement&&Va>0&&es.verticalTextBox){for(const Yi of R.writingModes)if(Yi===i.bL.vertical?(xs=Ao(),xi=xs):xs=ti(),xs&&xs.box&&xs.box.length)break}else xs=ti()};if(Ir){let ti=Ir;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ta]){const Vi=this.prevPlacement.variableOffsets[Ta];ti.indexOf(Vi.anchor)>0&&(ti=ti.filter(bh=>bh!==Vi.anchor),ti.unshift(Vi.anchor))}const Ao=(Vi,bh,f_)=>{const Qh=R.getSymbolInstanceTextSize(We,yn,this.transform.zoom,fa),p_=(Vi.x2-Vi.x1)*Qh+2*Vi.padding,S0=(Vi.y2-Vi.y1)*Qh+2*Vi.padding,Um=yn.hasIconTextFit&&!ht?bh:null;Um&&Oc(Um);let Vf={box:[],offscreen:!1,occluded:!1};const C0=pt?2*ti.length:ti.length;for(let dg=0;dg=ti.length,yn,fa,R,f_,Um,We,st);if(Hf&&(Vf=Hf.placedGlyphBoxes,Vf&&Vf.box&&Vf.box.length)){gs=!0,oa=Hf.shift;break}}return Vf};xo(()=>Ao(Gl,es.iconBox,i.bL.horizontal),()=>{const Vi=es.verticalTextBox;return Vi&&Oc(Vi),R.allowVerticalPlacement&&!(xs&&xs.box&&xs.box.length)&&Va>0&&Vi?Ao(Vi,es.verticalIconBox,i.bL.vertical):{box:null,offscreen:null,occluded:null}}),xs&&(gs=xs.box,Zi=xs.offscreen,Ci=xs.occluded);const Yi=ro(!(!xs||!xs.box));if(!gs&&this.prevPlacement){const Vi=this.prevPlacement.variableOffsets[Ta];Vi&&(this.variableOffsets[Ta]=Vi,this.markUsedJustification(R,Vi.anchor,yn,Yi))}}else{const ti=(Ao,Yi)=>{const Vi=R.getSymbolInstanceTextSize(We,yn,this.transform.zoom,fa),bh=this.collisionIndex.placeCollisionBox(R,Vi,Ao,ke,_e,on,new i.P(0,0),pt,fe,J,Ge.predicate);return bh&&bh.box&&bh.box.length&&(this.markUsedOrientation(R,Yi,yn),this.placedOrientations[Ta]=Yi),bh};xo(()=>ti(Gl,i.bL.horizontal),()=>{const Ao=es.verticalTextBox;return R.allowVerticalPlacement&&Va>0&&Ao?(Oc(Ao),ti(Ao,i.bL.vertical)):{box:null,offscreen:null,occluded:null}}),ro(!!(xs&&xs.box&&xs.box.length))}}if(ho=xs,gs=ho&&ho.box&&ho.box.length>0,Zi=ho&&ho.offscreen,Ci=ho&&ho.occluded,yn.useRuntimeCollisionCircles){const ro=yn.centerJustifiedTextSymbolIndex>=0?yn.centerJustifiedTextSymbolIndex:yn.verticalPlacedTextSymbolIndex,xo=R.text.placedSymbolArray.get(ro),ti=i.bM(R.textSizeData,We,xo),Ao=B.get("text-padding");qi=this.collisionIndex.placeCollisionCircles(R,pt,xo,ro,R.lineVertexArray,R.glyphOffsetArray,ti,J,te,ue,j,Dt,Ge.predicate,yn.collisionCircleDiameter*ti/i.bY,Ao,this.retainedQueryData[R.bucketInstanceId].tileID),gs=pt||qi.circles.length>0&&!qi.collisionDetected,Zi=Zi&&qi.offscreen,Ci=qi.occluded}if(es.iconFeatureIndex&&(el=es.iconFeatureIndex),es.iconBox){const ro=xo=>{Oc(xo);const ti=yn.hasIconTextFit&&oa?$o(oa.x,oa.y,St,Dt,this.transform.angle):new i.P(0,0),Ao=R.getSymbolInstanceIconSize(st,this.transform.zoom,yn.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(R,Ao,xo,ke,_e,Vr,ti,ht,fe,J,Ge.predicate)};xi&&xi.box&&xi.box.length&&es.verticalIconBox?(ei=ro(es.verticalIconBox),Ma=ei.box.length>0):(ei=ro(es.iconBox),Ma=ei.box.length>0),Zi=Zi&&ei.offscreen,Aa=ei.occluded}const Ru=gt||yn.numHorizontalGlyphVertices===0&&Va===0,_h=_t||yn.numIconVertices===0;if(Ru||_h?_h?Ru||(Ma=Ma&&gs):gs=Ma&&gs:Ma=gs=Ma&&gs,gs&&ho&&ho.box&&this.collisionIndex.insertCollisionBox(ho.box,B.get("text-ignore-placement"),R.bucketInstanceId,xi&&xi.box&&fc?fc:Nd,Ge.ID),Ma&&ei&&this.collisionIndex.insertCollisionBox(ei.box,B.get("icon-ignore-placement"),R.bucketInstanceId,el,Ge.ID),qi&&(gs&&this.collisionIndex.insertCollisionCircles(qi.circles,B.get("text-ignore-placement"),R.bucketInstanceId,Nd,Ge.ID),j)){const ro=R.bucketInstanceId;let xo=this.collisionCircleArrays[ro];xo===void 0&&(xo=this.collisionCircleArrays[ro]=new $k);for(let ti=0;ti=0;--fa){const es=yn[fa];Gs(R.symbolInstances.get(es),es,R.collisionArrays[es])}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 yn=R.getSortedIndexesByZOffset();for(let fa=0;fa=0&&(d.text.placedSymbolArray.get(O).crossTileID=ue>=0&&O!==ue?0:J),R>=0&&(d.text.placedSymbolArray.get(R).crossTileID=ue>=0&&R!==ue?0:J),B>=0&&(d.text.placedSymbolArray.get(B).crossTileID=ue>=0&&B!==ue?0:J),H>=0&&(d.text.placedSymbolArray.get(H).crossTileID=ue>=0&&H!==ue?0:J)}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:J}=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),J>=0&&(te.get(J).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 J=this.placements[H],te=O[H];te?(this.opacities[H]=new Pm(te,E,J.text,J.icon,null,J.clipped),j=j||J.text!==te.text.placed||J.icon!==te.icon.placed):(this.opacities[H]=new Pm(null,E,J.text,J.icon,J.skipFade,J.clipped),j=j||J.text||J.icon)}for(const H in O){const J=O[H];if(!this.opacities[H]){const te=new Pm(J,E,!1,!1);te.isHidden()||(this.opacities[H]=te,j=j||J.text.placed||J.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 J=d.layers[0].layout,te=d.layers[0].paint,ue=!!d.layers[0].dynamicFilter(),ce=new Pm(null,0,!1,!1,!0),fe=J.get("text-allow-overlap"),ke=J.get("icon-allow-overlap"),_e=J.get("text-variable-anchor"),Re=J.get("text-rotation-alignment")==="map",De=J.get("text-pitch-alignment")==="map",We=te.get("symbol-z-offset"),st=J.get("symbol-elevation-reference")==="sea",Ge=!We.isConstant(),jt=new Pm(null,0,fe&&(ke||!d.hasIconData()||J.get("icon-optional")),ke&&(fe||!d.hasTextData()||J.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,Ir=Yt>0,Yr=this.placedOrientations[Dt],Cr=Yr===i.bL.vertical,wr=Yr===i.bL.horizontal||Yr===i.bL.horizontalOnly;!hr&&!Ir||Kt.isHidden()||_t++;let pn=!1;if((hr||Ir)&&R)for(const on of d.activeReplacements){if(i.bZ(on,O,i.b_.Symbol,H)||on.min.x>Xt||Xt>on.max.x||on.min.y>lr||lr>on.max.y)continue;const Vr=i.b$(Xt,lr,B.canonical,on.footprintTileId.canonical);if(pn=i.c0(Vr,on.footprint),pn)break}if(hr){const on=pn?fx:bd(Kt.text);gt(d.text,St,Cr?fx:on),gt(d.text,Rt,wr?fx:on);const Vr=Kt.text.isHidden(),{leftJustifiedTextSymbolIndex:Qr,centerJustifiedTextSymbolIndex:Tn,rightJustifiedTextSymbolIndex:ss,verticalPlacedTextSymbolIndex:Gs}=ht,Na=d.text.placedSymbolArray,yn=Vr||Cr?1:0;Qr>=0&&(Na.get(Qr).hidden=yn),Tn>=0&&(Na.get(Tn).hidden=yn),ss>=0&&(Na.get(ss).hidden=yn),Gs>=0&&(Na.get(Gs).hidden=Vr||wr?1:0);const fa=this.variableOffsets[Dt];fa&&this.markUsedJustification(d,fa.anchor,ht,Yr);const es=this.placedOrientations[Dt];es&&(this.markUsedJustification(d,"left",ht,es),this.markUsedOrientation(d,es,ht))}if(Ir){const on=pn?fx:bd(Kt.icon),{placedIconSymbolIndex:Vr,verticalPlacedIconSymbolIndex:Qr}=ht,Tn=d.icon.placedSymbolArray,ss=Kt.icon.isHidden()?1:0;Vr>=0&&(gt(d.icon,Yt,Cr?fx:on),Tn.get(Vr).hidden=ss),Qr>=0&&(gt(d.icon,ht.numVerticalIconVertices,wr?fx:on),Tn.get(Qr).hidden=ss)}if(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData()){const on=d.collisionArrays[pt];if(on){let Vr=new i.P(0,0),Qr=!0;if(on.textBox||on.verticalTextBox){if(_e){const ss=this.variableOffsets[Dt];ss?(Vr=Ic(ss.anchor,ss.width,ss.height,ss.textOffset,ss.textScale),Re&&Vr._rotate(De?this.transform.angle:-this.transform.angle)):Qr=!1}ue&&(Qr=!Kt.clipped),on.textBox&&Zp(d.textCollisionBox.collisionVertexArray,Kt.text.placed,!Qr||Cr,Et,st,Vr.x,Vr.y),on.verticalTextBox&&Zp(d.textCollisionBox.collisionVertexArray,Kt.text.placed,!Qr||wr,Et,st,Vr.x,Vr.y)}const Tn=Qr&&!!(!wr&&on.verticalIconBox);on.iconBox&&Zp(d.iconCollisionBox.collisionVertexArray,Kt.icon.placed,Tn,Et,st,ht.hasIconTextFit?Vr.x:0,ht.hasIconTextFit?Vr.y:0),on.verticalIconBox&&Zp(d.iconCollisionBox.collisionVertexArray,Kt.icon.placed,!Tn,Et,st,ht.hasIconTextFit?Vr.x:0,ht.hasIconTextFit?Vr.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 n5=Math.pow(2,25),$v=Math.pow(2,24),Uk=Math.pow(2,17),s5=Math.pow(2,16),qk=Math.pow(2,9),_d=Math.pow(2,8),Ef=Math.pow(2,1);function bd(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*n5+d*$v+p*Uk+d*s5+p*qk+d*_d+p*Ef+d}const fx=0;class n0{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-J.sortKey));this._currentPartIndex{const H=i.o.now()-R;return!this._forceFullPlacement&&H>2};for(;this._currentPlacementIndex>=0;){const H=p[d[this._currentPlacementIndex]],J=this.placement.collisionIndex.transform.zoom;if(H.type==="symbol"&&H.visibility!=="none"&&(!H.minzoom||H.minzoom<=J)&&(!H.maxzoom||H.maxzoom>J)){const te=H,ue=te.layout.get("symbol-z-elevate"),ce=te.layout.get("symbol-sort-key").constantOr(1)!==void 0,fe=te.layout.get("symbol-z-order"),ke=fe==="viewport-y"||fe==="auto"&&!(fe!=="viewport-y"&&ce),_e=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&&_e,De=this._inProgressLayer=this._inProgressLayer||new n0(te),We=i.B(H.source,H.scope);if(De.continuePlacement(ue||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 fh=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 _e){const De=this.crossTileIDs[Re];if(this.keys[Re]===te&&!j.has(De)){j.add(De),J.crossTileID=De;break}}}}}class dl{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class a5{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 Lm=771;class ps{constructor(d,p,j,E){this.blendFunction=d,this.blendColor=p.toNonPremultipliedRenderColor(null),this.mask=j,this.blendEquation=E}}ps.Replace=[1,0,1,0],ps.disabled=new ps(ps.Replace,i.ao.transparent,[!1,!1,!1,!1]),ps.unblended=new ps(ps.Replace,i.ao.transparent,[!0,!0,!0,!0]),ps.alphaBlended=new ps([1,Lm,1,Lm],i.ao.transparent,[!0,!0,!0,!0]),ps.alphaBlendedNonPremultiplied=new ps([770,Lm,770,Lm],i.ao.transparent,[!0,!0,!0,!0]),ps.multiply=new ps([774,0,774,0],i.ao.transparent,[!0,!0,!0,!0]),ps.additive=new ps([1,1,1,1],i.ao.transparent,[!0,!0,!0,!0]);class vn{constructor(d,p,j){this.func=d,this.mask=p,this.range=j}}vn.ReadOnly=!1,vn.ReadWrite=!0,vn.disabled=new vn(519,vn.ReadOnly,[0,1]);const Vk=7680;class Gn{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}}Gn.disabled=new Gn({func:519,mask:0},0,0,Vk,Vk,Vk);const s0=1029,Hk=2305;class Vn{constructor(d,p,j){this.enable=d,this.mode=p,this.frontFace=j}}function Om(w,d){const p=i.ca(w,3);i.cc(w,d),i.cg(w,3,p)}function i5(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 i5(Math.atan2(Math.sqrt(w[0]*w[0]+w[1]*w[1]),-w[2]),O)}Vn.disabled=new Vn(!1,s0,Hk),Vn.backCCW=new Vn(!0,s0,Hk),Vn.backCW=new Vn(!0,s0,2304),Vn.frontCW=new Vn(!0,1028,2304),Vn.frontCCW=new Vn(!0,1028,Hk);class wd{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=i5(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&&Om(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=i5(d,p),Om(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 Kh=15;class o5{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 o5(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,ue,fe,ke,_e);H.has(Re)||(O.push(new i.aQ(ue,ce,fe,ke,_e)),H.add(Re))};for(let ue=0;uece.canonical.z)continue;const fe=ce.canonical,ke=ce.overscaledZ,_e=ce.wrap,Re=1<0,st=fe.y+10,jt=ce.wrap-(We?0:1),gt=ce.wrap+(De?0:1),_t=We?fe.x-1:Re-1,pt=De?fe.x+1:0;if(R)j[0]<0?(J(ke,gt,fe.z,pt,fe.y),j[1]<0&&st&&(J(ke,_e,fe.z,fe.x,fe.y+1),J(ke,gt,fe.z,pt,fe.y+1)),j[1]>0&&Ge&&(J(ke,_e,fe.z,fe.x,fe.y-1),J(ke,gt,fe.z,pt,fe.y-1))):j[0]>0?(J(ke,jt,fe.z,_t,fe.y),j[1]<0&&st&&(J(ke,_e,fe.z,fe.x,fe.y+1),J(ke,jt,fe.z,_t,fe.y+1)),j[1]>0&&Ge&&(J(ke,_e,fe.z,fe.x,fe.y-1),J(ke,jt,fe.z,_t,fe.y-1))):j[1]<0&&st?J(ke,_e,fe.z,fe.x,fe.y+1):Ge&&J(ke,_e,fe.z,fe.x,fe.y-1);else{const ht=ce.visibleQuadrants;1&ht&&(J(ke,jt,fe.z,_t,fe.y),Ge&&(J(ke,_e,fe.z,fe.x,fe.y-1),J(ke,jt,fe.z,_t,fe.y-1))),2&ht&&(J(ke,gt,fe.z,pt,fe.y),Ge&&(J(ke,_e,fe.z,fe.x,fe.y-1),J(ke,gt,fe.z,pt,fe.y-1))),4&ht&&(J(ke,jt,fe.z,_t,fe.y),st&&(J(ke,_e,fe.z,fe.x,fe.y+1),J(ke,jt,fe.z,_t,fe.y+1))),8&ht&&(J(ke,gt,fe.z,pt,fe.y),st&&(J(ke,_e,fe.z,fe.x,fe.y+1),J(ke,gt,fe.z,pt,fe.y+1)))}}const te=[];for(const ue of O)O.some(ce=>ue.isChildOf(ce))||te.push(ue);if(O=te.filter(ue=>!d.some(ce=>!!(ue.overscaledZ{const De=Re.canonical.x+.5-fe[0],We=Re.canonical.y+.5-fe[1];return De*De+We*We<_e})}return O}extendTileCoverToNearPlane(d,p,j){const E=[],O=new Set;for(const We of d)O.add(We.key);const R=(We,st,Ge,jt,gt)=>{const _t=i.cY(st,We,Ge,jt,gt);O.has(_t)||(E.push(new i.aQ(We,st,Ge,jt,gt)),O.add(_t))},B=d.reduce((We,st)=>Math.max(We,st.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(st[0]),ht=Math.floor(st[1]),St=(st[0]-pt)*i.al,Rt=(st[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,ue.x=St-(Yt-pt)*i.al;for(let Xt=-1;Xt<=1;Xt++){const lr=jt+Xt;te.y=_t-Xt*i.al,ue.y=Rt-(lr-ht)*i.al,i.cZ(te,ue,J)&&R(B,0,j,Yt,lr)}}}},fe=p.points,ke=fe[i.cv],_e=fe[i.cw],Re=this._projectToGround(ke,fe[i.cx]),De=this._projectToGround(_e,fe[i.cy]);return ce(ke,Re),ce(_e,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,J=1<{const Kt=new i.ae(Et.x+25e-6,Et.y,Et.z),hr=new i.ae(Et.x,Et.y+25e-6,Et.z),Ir=Et.toLngLat(),Yr=Kt.toLngLat(),Cr=hr.toLngLat(),wr=this.locationCoordinate(Ir),pn=this.locationCoordinate(Yr),on=this.locationCoordinate(Cr),Vr=Math.hypot(pn.x-wr.x,pn.y-wr.y),Qr=Math.hypot(on.x-wr.x,on.y-wr.y);return Math.sqrt(Vr*Qr)*_t/25e-6},ht=Et=>{const er=jt,Kt=gt;return{aabb:i.cF(this,J,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)*_e,lr=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))},br=(Et,er)=>{if(.707*er{if(Et.zoom=.9)return!0}else if(O&&(hr=Et.aabb.distanceZ(De)*_e),this.projection.isReprojectedInTileSpace&&j<=5){const Qr=Math.pow(2,Et.zoom),Tn=pt(new i.ae((Et.x+.5)/Qr,(Et.y+.5)/Qr));Ir=Tn>.85?1:Tn}if(!R&&!ue){const Qr=Math.sqrt(er*er+Kt*Kt+hr*hr);let Tn=(1<0;){const Et=St.pop(),er=Et.x,Kt=Et.y;let hr=Et.fullyVisible;const Ir=()=>this.projection.name==="globe"&&(Et.y===0||Et.y===(1<>1),pn={aabb:R?Et.aabb.quadrant(Yr):i.cF(this,J,Et.zoom+1,Cr,wr,Et.wrap,Et.minZ,Et.maxZ,this.projection),zoom:Et.zoom+1,x:Cr,y:wr,wrap:Et.wrap,fullyVisible:hr,tileID:void 0,shouldSplit:void 0,minZ:Et.minZ,maxZ:Et.maxZ};O&&!ue&&(pn.tileID=new i.aQ(Et.zoom+1===Dt?Yt:Et.zoom+1,Et.wrap,Et.zoom+1,Cr,wr),lr(pn)),St.push(pn)}else{const Yr=Et.zoom===Dt?Yt:Et.zoom;if(d.minzoom&&d.minzoom>Yr)continue;let Cr=0;if(!hr){let Vr=We?Et.aabb.intersectsPrecise(fe):Et.aabb.intersectsPreciseFlat(fe);if(Vr===0&&Ir()){const Qr=new i.cD(Et.zoom,er,Kt);Vr=i.cE(this,J,Qr,!0).intersectsPrecise(fe)}if(Vr===0)continue;if(d.calculateQuadrantVisibility)if(fe.containsPoint(Et.aabb.center))Cr=15;else for(let Qr=0;Qr<4;Qr++)Et.aabb.quadrant(Qr).intersects(fe)!==0&&(Cr|=1<{const hr=[0,0,0,1],Ir=[i.al,i.al,0,1],Yr=this.calculateFogTileMatrix(Kt.tileID.toUnwrapped());i.aC(hr,hr,Yr),i.aC(Ir,Ir,Yr);const Cr=i.cG([],hr,Ir),wr=i.cH([],hr,Ir),pn=i.c$(Cr,wr);if(pn===0)return!0;let on=!1;const Vr=this._elevation;if(Vr&&pn>Et&&er!==0){const Qr=this.calculateProjMatrix(Kt.tileID.toUnwrapped());let Tn;d.isTerrainDEM||(Tn=Vr.getMinMaxForTile(Kt.tileID)),Tn||(Tn={min:gt,max:jt});const ss=i.cI(this.rotation),Gs=[ss[0]*i.al,ss[1]*i.al,Tn.max];i.af(Gs,Gs,Qr),on=(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 J=this.projection.pointCoordinate3D(this,B.x,B.y);J?(O=B.y,j=J):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 J=Math.min(O.lng,R.lng,B.lng,H.lng),te=Math.max(O.lng,R.lng,B.lng,H.lng),ue=Math.min(O.lat,R.lat,B.lat,H.lat),ce=Math.max(O.lat,R.lat,B.lat,H.lat);const fe=Math.pow(2,-this.zoom)/16*270,ke=this.projection.name==="globe"?1:4,_e=(Re,De,We,st,Ge)=>{const jt=(Re+We)/2,gt=(De+st)/2,_t=new i.P(jt,gt),{lng:pt,lat:ht}=this.pointLocation3D(_t),St=Math.max(0,J-pt,ue-ht,pt-te,ht-ce);J=Math.min(J,pt),te=Math.max(te,pt),ue=Math.min(ue,ht),ce=Math.max(ce,ht),(Gefe)&&(_e(Re,De,jt,gt,Ge+1),_e(jt,gt,We,st,Ge+1))};if(_e(p,d,E,d,1),_e(E,d,E,j,1),_e(E,j,p,j,1),_e(p,j,p,d,1),this.projection.name==="globe"){const[Re,De]=i.cM(this);Re?(ce=90,te=180,J=-180):De&&(ue=-90,te=180,J=-180)}return new i.aI(new i.aT(J,ue),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),J=new i.P(R,O),te=new i.P(E,O);let ue=this.pointCoordinate(B,d),ce=this.pointCoordinate(H,d);const fe=this.pointCoordinate(J,p),ke=this.pointCoordinate(te,p),_e=(Re,De)=>(De.y-Re.y)/(De.x-Re.x);return ue.y>1&&ce.y>=0?ue=new i.ae((1-ke.y)/_e(ke,ue)+ke.x,1):ue.y<0&&ce.y<=1&&(ue=new i.ae(-ke.y/_e(ke,ue)+ke.x,0)),ce.y>1&&ue.y>=0?ce=new i.ae((1-fe.y)/_e(fe,ce)+fe.x,1):ce.y<0&&ue.y<=1&&(ce=new i.ae(-fe.y/_e(fe,ce)+fe.x,0)),new i.aI().extend(this.coordinateLocation(ue)).extend(this.coordinateLocation(ce)).extend(this.coordinateLocation(ke)).extend(this.coordinateLocation(fe))}_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.maxLngue&&(B=ue-J),ue-tefe&&(R=fe-H),fe-ce{for(let Vt=0;Vt<16;Vt++)Yt[Vt]=i.ak(Xt[Vt],lr[Vt],br)})(B,B,H,i.d0(this.pitch>=Kh?1:this.pitch/Kh))}else B=H;const J=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(J,J,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 ue=i.bl([],B);this.frustumCorners=i.cT.fromInvProjectionMatrix(ue,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 fe=i.cd(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=i.bz(fe);const ke=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;fe[8]=2*-d.x/this.width,fe[9]=2*(d.y+ke)/this.height,this.skyboxMatrix=i.aB(ce,fe,ce);const _e=this.point,Re=_e.x,De=_e.y,We=this.width%2/2,st=this.height%2/2,Ge=Math.cos(this.angle),jt=Math.sin(this.angle),gt=Re-Math.round(Re)+Ge*We+jt*st,_t=De-Math.round(De)+Ge*st+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,J),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),J=this.scaleZoom(H/(Math.max(0,d)*this.tileSize)),te=Math.abs(R-J);teJ||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>=Kh?1:this.pitch/Kh))),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]}}},ph=2048;class Uv{constructor(d,p){this.aabb=d,this.lastCascade=p}}class $ie{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 J=0;J1||ce[1]<-1||ce[1]>1){te=!1;break}}if(B.lastCascade=J,O=Math.max(O,J),te)break}}return O+1}}class a0{constructor(d){this.painter=d,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new $ie,this._depthMode=new vn(d.context.gl.LEQUAL,vn.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,_e)=>{const Re=j.style._mergedLayers[_e];return ke+(Re.hasShadowPass()&&!Re.isHidden(d.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const O=j.context,R=ph,B=ph;if(this._cascades.length===0||ph!==this._cascades[0].texture.size[0]){this._cascades=[];for(let ke=0;ke<2;++ke){const _e=j._shadowMapDebug,Re=O.gl,De=O.createFramebuffer(R,B,_e?1:0,"texture"),We=new i.T(O,{width:R,height:B,data:null},Re.DEPTH_COMPONENT16);if(De.depthAttachment.set(We.texture),_e){const st=new i.T(O,{width:R,height:B,data:null},Re.RGBA8);De.colorAttachment0.set(st.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,_e=[1e4,-1e4];ke.visibleDemTiles.filter(Re=>Re.dem).forEach(Re=>{const De=Re.dem.tree;_e[0]=Math.min(_e[0],De.minimums[0]),_e[1]=Math.max(_e[1],De.maximums[0])}),_e[0]!==1e4&&(H=(_e[1]-_e[0])*ke.exaggeration())}const J=1.5*d.cameraToCenterDistance,te=3*J,ue=new Float64Array(16);for(let ke=0;ke=0)return{};const O=function(H,J,te){const ue=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",J=p.properties.get("color"),te=p.properties.get("intensity"),ue=Math.max(i.bJ([0,0,1],B),0),ce=[0,0,0];i.c5(ce,J.toPremultipliedRenderColor(H?null:w.getLut(d.scope)).toArray01Linear().slice(0,3),te);const fe=[0,0,0];return i.c5(fe,E.toPremultipliedRenderColor(j?null:w.getLut(p.scope)).toArray01Linear().slice(0,3),ue*O),i.db([ce[0]>0?ce[0]/(ce[0]+fe[0]):0,ce[1]>0?ce[1]/(ce[1]+fe[1]):0,ce[2]>0?ce[2]/(ce[2]+fe[2]):0])}function Xp(w,d,p,j,E,O){const R=w.zoom,B=w.scale,H=w.worldSize,J=1/H,te=w.aspect,ue=Math.sqrt(1+te*te)*Math.tan(.5*w.fovX),ce=ue*ue,fe=j-p,ke=j+p;let _e,Re;ce>fe/ke?(_e=j,Re=j*ue):(_e=.5*ke*(1+ce),Re=.5*Math.sqrt(fe*fe+2*(j*j+p*p)*ce+ke*ke*ce*ce));const De=w.projection.pixelsPerMeter(w.center.lat,H),We=w._camera.getCameraToWorldMercator(),st=[0,0,-_e*J];i.af(st,st,We);let Ge=Re*J;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 hr=w._camera.getWorldToCamera(w.worldSize,w.projection.zAxisUnit==="meters"?De:1),Ir=w._camera.getCameraToClipPerspective(w._fov,w.width/w.height,p,j);Ir[8]=2*-w.centerOffset.x/w.width,Ir[9]=2*w.centerOffset.y/w.height;const Yr=new Float64Array(16);i.cP(Yr,Ir,hr);const Cr=new Float64Array(16);i.bl(Cr,Yr);const wr=i.cB.fromInvProjectionMatrix(Cr,H,R,!0);for(const pn of wr.points){const on=((gt=pn)[0]/=B,gt[1]/=B,gt[2]=i.cf(gt[2],w._center.lat),gt);Ge=Math.max(Ge,i.c6(i.da([],st,on)))}}var gt;Ge*=E/(E-1);const _t=Math.acos(d[2]),pt=Math.atan2(-d[0],-d[1]),ht=new Gk;ht.position=st,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 lr=i.d5(Math.floor(1e6*st[0])/1e6*H,Math.floor(1e6*st[1])/1e6*H,0),br=.5*E,Vt=[0,0,0];i.af(Vt,lr,Xt),i.c5(Vt,Vt,br);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/br);const Kt=new Float64Array(16);return i.bA(Kt),i.br(Kt,Kt,er),i.aB(Xt,Kt,Xt),[Xt,Rt]}class Uie 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 l5=i.a6.colorTheme,qie=new i.a9({data:new i.aa(l5.data)});function DP(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 RP(w){if(w)return w.map(([d,p])=>[d*i.o.devicePixelRatio,p*i.o.devicePixelRatio])}class c5{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)=>Ze(w,d&&d.filter(p=>p.identifier!=="source.canvas")),FP=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"]),zP=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 gh 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 t5(this),this.crossTileSymbolIndex=new Gh,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 Uie(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=gh.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],J=H.getSource().type;J!=="vector"&&J!=="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 J={style:R,id:O.id,config:O.config};if(j){const te=this.fragments.findIndex(({id:ue})=>ue===j);this.fragments=this.fragments.slice(0,te).concat(J).concat(this.fragments.slice(te))}else this.fragments.push(J)}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 gh(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,Bs(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 J=i.du(H,this.scope,this._styleColorTheme.lut,this.options);J.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(J.fqid),J.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(J.fqid),this._hasAppearances=this._hasAppearances||J.getAppearances().length!==0,J.setEventedParent(this,{layer:{id:J.id}}),this._layers[J.id]=J;const te=this.getOwnLayerSourceCache(J),ue=!!this.directionalLight&&this.directionalLight.shadowsEnabled();te&&J.canCastShadows()&&ue&&(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,J,te;const ue={};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 fe of ce.stylesheet.lights)fe.type==="ambient"&&ce.ambientLight!=null&&(p=ce.ambientLight),fe.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&&(J=ce.stylesheet.transition),ue[ce.scope]=ce._styleColorTheme}}),this.light=d,this.ambientLight=p,this.directionalLight=j,this.fog=O,this.snow=R,this.rain=B,this._styleColorThemeForScope=ue,E===null?delete this.terrain:this.terrain=E,this.camera=te||{"camera-projection":"perspective"},this.projection=H||{name:"mercator"},this.transition=Object.assign({},Hv,J),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 J=i.dq(B);if(d[J])continue;d[J]=[]}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(l5))R[H]===void 0&&(R[H]=l5[H].default);const B=new i.a8(qie,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:J,height:te,data:ue}=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(J!==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:J,height:te},ue),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 J=i.m(j.transformRequest(j.normalizeSpriteURL(p,H,".json"),i.R.SpriteJSON),(ce,fe)=>{J=null,B||(B=ce,O=fe,ue())}),te=i.n(j.transformRequest(j.normalizeSpriteURL(p,H,".png"),i.R.SpriteImage),(ce,fe)=>{te=null,B||(B=ce,R=fe,ue())});function ue(){if(B)E(B);else if(O&&R){const ce=i.o.getImageData(R),fe={};for(const ke in O){const{width:_e,height:Re,x:De,y:We,sdf:st,pixelRatio:Ge,stretchX:jt,stretchY:gt,content:_t}=O[ke],pt=new i.q({width:_e,height:Re});i.q.copy(ce,pt,{x:De,y:We},{x:0,y:0},{width:_e,height:Re},null),fe[ke]={data:pt,pixelRatio:Ge!==void 0?Ge:1,sdf:st!==void 0&&st,stretchX:jt,stretchY:gt,content:_t,usvg:!1,version:0}}E(null,fe)}}return{cancel(){J&&(J.cancel(),J=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 c5(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 J of H.icons){const te={version:1,pixelRatio:i.o.devicePixelRatio,content:DP(J),stretchX:J.metadata?RP(J.metadata.stretch_x_areas):void 0,stretchY:J.metadata?RP(J.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:J};B[J.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:J,removedIds:te}=B[H];(J||te)&&(this._updateWorkerLayers(H,J,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 J=this.getLayerSourceCache(H);J&&(J.used=!0,J.tileCoverLift=Math.max(J.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,Bs(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(fe=[],ke=[],_e){ke=ke||[];const Re=(fe=fe||[]).map(Kp),De=ke.map(Kp),We=fe.reduce(mx,{}),st=ke.reduce(mx,{}),Ge=Re.slice();let jt,gt,_t,pt;for(jt=0,gt=0;jt{fe.source&&J[fe.source]?H.push({command:Xs.removeLayer,args:[fe.id]}):ue.push(fe)});let ce=R.terrain;ce&&J[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(fe,ke,_e){ke=ke||[];const Re=(fe=fe||[]).map(Kp),De=ke.map(Kp),We=fe.reduce(mx,{}),st=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 zP));if(j.length===0)return!1;const E=j.filter(R=>!(R.command in FP));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(Ni,`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),J=this._sourceCaches[B]=new vd(H,E,R);(R?this._symbolSourceCaches:this._otherSourceCaches)[E.id]=J,J.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(La,"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,wa||(wa=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,J=p.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),te=p.properties.get("intensity"),ue=j(J)*te;return Number(((H+ue)/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 J=j(H.source,H.sourceLayer);if(J in p&&p[J]!==R.featureNamespace){i.w(`"featureNamespace ${R.featureNamespace} of featureset ${E}'s selector is not associated to the same source, skip this selector`);continue}p[J]=R.featureNamespace}let B;if(R.properties)for(const H in R.properties){const J=i.U(R.properties[H]);J.result==="success"&&(B=B||{},B[H]=J.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),J=E.options.get(H);if(!J)return;let te;const{minValue:ue,maxValue:ce,stepValue:fe,type:ke,values:_e}=O[p],Re=i.U(O[p].default);Re.result==="success"&&(te=Re.value.expression),te?(this.options.set(H,Object.assign({},J,{value:B,default:te,minValue:ue,maxValue:ce,stepValue:fe,type:ke,values:_e})),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:J,type:te,values:ue}=p[j];if(E){const ce=i.B(j,this.scope);this.options.set(ce,{default:E,value:O,minValue:B,maxValue:H,stepValue:J,type:te,values:ue})}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 ue=this._order.indexOf(p);if(ue===-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=ue: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),J=!!this.directionalLight&&this.directionalLight.shadowsEnabled();H&&O.canCastShadows()&&J&&(H.castsShadows=!0);const te=this._changes.getRemovedLayer(O);if(te&&O.source&&H&&O.type!=="custom"){this._changes.discardLayerRemoval(O);const ue=i.B(O.source,O.scope);te.type!==O.type?this._changes.updateSourceCache(ue,"clear"):(this._changes.updateSourceCache(ue,"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,nt.call(Bs,{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(Bs,{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:J}=d.target,te=this.getFragmentStyle(J),ue=te.getFeaturesetLayers(H);for(const{source:ce,sourceLayer:fe}of ue)te.setFeatureState({id:d.id,source:ce,sourceLayer:fe},p)}else if("layerId"in d.target){const{layerId:H}=d.target,J=this.getLayer(H);this.setFeatureState({id:d.id,source:J.source,sourceLayer:J.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:J}=d.target,te=this.getFragmentStyle(J),ue=te.getFeaturesetLayers(H);for(const{source:ce,sourceLayer:fe}of ue)te.removeFeatureState({id:d.id,source:ce,sourceLayer:fe},p)}else if("layerId"in d.target){const{layerId:H}=d.target,J=this.getLayer(H);this.removeFeatureState({id:d.id,source:J.source,sourceLayer:J.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),J=H.getFeaturesetLayers(R);for(const{source:te,sourceLayer:ue}of J){const ce=H.getFeatureState({id:d.id,source:te,sourceLayer:ue});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 J of d){const te=J[H];if(te)for(const ue of te)O.push(ue)}}}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 J=O.length-1;J>=0;J--){const te=O[J].feature;if(te.layer&&E[te.layer.id]{if(Zk.has(te.type))return;const ue=this.getOwnLayerSourceCache(te),ce=O[ue.id]=O[ue.id]||{sourceCache:ue,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 ue=this._layers[te];if(!ue)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(ue)}}else for(const te in this._layers)R(this._layers[te]);const B=this._queryRenderedFeatures(d,O,j),H=this._flattenAndSortRenderedFeatures(B),J=[];for(const te of H)i.dw(te.layer.id)===this.scope&&J.push(te);return J}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 ue of te)R.push({targetId:O,filter:E,target:ue});for(const{style:ue}of this.fragments){const ce=ue.getFeaturesetDescriptors();for(const fe of ce)R.push({targetId:O,filter:E,target:fe})}}const B=this.queryRenderedTargets(d,R,j),H=[],J=new Set;for(const te of B)for(const ue of te.variants[O])Gp(ue,te,J)||H.push(new i.dx(te,ue));return H}queryRenderedTargets(d,p,j){const E={},O=(B,H,J,te)=>{const ue=E[H.id]=E[H.id]||{sourceCache:H,layers:{},has3DLayers:!1};if(ue.layers[B.fqid]=ue.layers[B.fqid]||{styleLayer:B,targets:[]},B.is3D(!!this.terrain)&&(ue.has3DLayers=!0),!te)return J.uniqueFeatureID=!1,void ue.layers[B.fqid].targets.push(J);ue.layers[B.fqid].targets.push(Object.assign({},J,{namespace:te.namespace,properties:te.properties,uniqueFeatureID:te.uniqueFeatureID}))};for(const B of p)if("featuresetId"in B.target){const{featuresetId:H,importId:J}=B.target,te=this.getFragmentStyle(J);if(!te||!te._featuresetSelectors)continue;const ue=te._featuresetSelectors[H];if(!ue){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 ue){const fe=te.getOwnLayer(ce.layerId);fe&&!Zk.has(fe.type)&&O(fe,te.getOwnLayerSourceCache(fe),B,ce)}}else if("layerId"in B.target){const{layerId:H}=B.target,J=this.getLayer(H);if(!J||Zk.has(J.type))continue;O(J,this.getLayerSourceCache(J),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=Yy(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=Xy(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(Qy(R,p));return E}addSourceType(d,p,j){return gh.getSourceType(d)?j(new Error(`A source type called "${d}" already exists.`)):(gh.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 ns(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 To(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 Lt(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(Bs,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,J=!1;const te={},ue={};for(const _e of this._mergedOrder){const Re=this._mergedLayers[_e];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));ue[De]=jt.slice(),We=te[De]=jt.sort((gt,_t)=>_t.tileID.overscaledZ-gt.tileID.overscaledZ||(gt.tileID.isLessThan(_t.tileID)?-1:1))}const st=this.crossTileSymbolIndex.addLayer(Re,We,p.center.lng,p.projection);H=H||st}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)),fe=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!R||this.placement.lastReplacementSourceUpdateTime!==R.updateTime)),ke=(ce||fe||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,ue,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(i.o.now()),J=!0),H&&this.pauseablePlacement.placement.setStale()),J||H){this._buildingIndex.onNewFrame(p.zoom);for(let _e=0;_eO===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)}}gh.getSourceType=function(w){return hh[w]},gh.setSourceType=function(w,d){hh[w]=d},gh.registerForPluginStateChange=i.dA;class BP 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 J=null,te=Number.MAX_SAFE_INTEGER;if(H<16)return null;for(const[ue,ce]of Object.entries(O)){const fe=ce.center;if(fe){const ke=R.distanceTo(i.aT.convert(fe));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 i0=` #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`,o0=` #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;}`,d5=` #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`,Ar=`#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`,u5=`#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`,h5=`#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,Dm=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,m5=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,px=new Set(["ifdef","ifndef","elif","if","defined"]),gx=new Set;tg(i0,gx),tg(d5,gx),tg(o0,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":Ar,"_prelude_shadow.fragment.glsl":h5,"_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":u5,"_prelude_raster_particle.glsl":Qk},eN={};ia("",Pu),ia(Ar,Xk),ia(h5,Jk),ia(u5,""),ia(Qk,"");const $P=ia(o0,d5),tN=i0,Vie=[` #if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING) #extension GL_EXT_blend_func_extended : require #endif`,"precision mediump float;",tN,$P.fragmentSource].join(` `),UP=["precision highp float;",tN,$P.vertexSource].join(` `);var f5={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(m5);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(Dm,(R,B,H,J,te)=>(p.add(te),B==="define"?` #ifndef HAS_UNIFORM_u_${te} in ${H} ${J} ${te}; #else uniform ${H} ${J} u_${te}; #endif `:B==="initialize"?` #ifdef HAS_UNIFORM_u_${te} ${H} ${J} ${te} = u_${te}; #endif `:B==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${te} in ${H} ${J} ${te}; #endif `:B==="initialize-attribute"?"":void 0)),vertexSource:d=d.replace(Dm,(R,B,H,J,te)=>{const ue=`MATERIAL_ATTRIBUTE_OFFSET_${te}`,ce=J==="float"?"vec2":J,fe=`GET_ATTRIBUTE_${ce}(a_${te}, materialInfo, ${ue})`,ke=te.match(/color/)?"color":ce;return B==="define-attribute-vertex-shader-only"?` #ifdef HAS_ATTRIBUTE_a_${te} in ${H} ${J} a_${te}; #endif `:p.has(te)?B==="define"?` #ifndef HAS_UNIFORM_u_${te} uniform lowp float u_${te}_t; #if !defined(${ue}) in ${H} ${ce} a_${te}; #endif out ${H} ${J} ${te}; #else uniform ${H} ${J} u_${te}; #endif `:B==="initialize"?ke==="vec4"?` #ifndef HAS_UNIFORM_u_${te} ${te} = a_${te}; #else ${H} ${J} ${te} = u_${te}; #endif `:` #if !defined(HAS_UNIFORM_u_${te}) #ifdef ${ue} ${te} = unpack_mix_${ke}(${fe}, u_${te}_t); #else ${te} = unpack_mix_${ke}(a_${te}, u_${te}_t); #endif #else ${H} ${J} ${te} = u_${te}; #endif `:B==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${te} in ${H} ${J} a_${te}; out ${H} ${J} ${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(${ue}) in ${H} ${ce} a_${te}; #endif #else uniform ${H} ${J} 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} ${J} u_${te}; #endif `:` #ifdef INSTANCED_ARRAYS in ${H} ${ce} a_${te}; #else uniform ${H} ${J} u_${te}; #endif `:B==="initialize-attribute-custom"?` #ifdef HAS_ATTRIBUTE_a_${te} ${H} ${J} ${te} = a_${te}; #endif `:ke==="vec4"?` #ifndef HAS_UNIFORM_u_${te} #ifdef ${ue} ${H} ${J} ${te} = ${fe}; #else ${H} ${J} ${te} = a_${te}; #endif #else ${H} ${J} ${te} = u_${te}; #endif `:` #ifndef HAS_UNIFORM_u_${te} #ifdef ${ue} ${H} ${J} ${te} = unpack_mix_${ke}(${fe}, u_${te}_t); #else ${H} ${J} ${te} = unpack_mix_${ke}(a_${te}, u_${te}_t); #endif #else ${H} ${J} ${te} = u_${te}; #endif `}),usedDefines:O,vertexIncludes:j,fragmentIncludes:E}}class Hie{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 J=this.boundPaintVertexBuffers.length!==E.length;for(let ue=0;!J&&ue{const jt=st.paint.get("hillshade-shadow-color"),gt=st.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",_t=st.paint.get("hillshade-highlight-color"),pt=st.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",ht=st.paint.get("hillshade-accent-color"),St=st.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",Rt=st.paint.get("hillshade-emissive-strength");let Dt=i.an(st.paint.get("hillshade-illumination-direction"));if(st.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"),lr=i.d4(Xt.x,Xt.y,Xt.z);Dt=i.an(lr[1])}const Yt=!De.options.moving;return{u_matrix:Ge||De.transform.calculateProjMatrix(We.tileID.toUnwrapped(),Yt),u_image:0,u_latrange:Wie(0,We.tileID),u_light:[st.paint.get("hillshade-exaggeration"),Dt],u_shadow:jt.toPremultipliedRenderColor(gt?null:st.lut),u_highlight:_t.toPremultipliedRenderColor(pt?null:st.lut),u_emissive_strength:Rt,u_accent:ht.toPremultipliedRenderColor(St?null:st.lut)}})(w,p,j,w.terrain?d.projMatrix:null);w.uploadCommonUniforms(B,ce,d.toUnwrapped());const{tileBoundsBuffer:ke,tileBoundsIndexBuffer:_e,tileBoundsSegments:Re}=w.getTileBoundsBuffers(p);ce.draw(w,H.TRIANGLES,E,O,R,Vn.disabled,fe,j.id,ke,_e,Re)}function p5(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 Kie(w,d,p){const j=w.context,E=j.gl;if(!d.dem)return;const O=d.dem;if(j.activeTexture.set(E.TEXTURE1),p5(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:J,tileBoundsSegments:te}=w.getMercatorTileBoundsBuffers(),ue=[];w.linearFloatFilteringSupported()&&ue.push("TERRAIN_DEM_FLOAT_FORMAT"),w.terrain&&w.terrain.renderingToTexture&&w.emissiveMode==="mrt-fallback"&&ue.push("USE_MRT1"),w.getOrCreateProgram("hillshadePrepare",{defines:ue}).draw(w,E.TRIANGLES,vn.disabled,Gn.disabled,ps.unblended,Vn.disabled,((ce,fe)=>{const ke=fe.stride,_e=i.bC();return i.ce(_e,0,i.al,-i.al,0,0,1),i.br(_e,_e,[0,-i.al,0]),{u_matrix:_e,u_image:1,u_dimension:[ke,ke],u_zoom:ce.overscaledZ}})(d.tileID,O),p.id,H,J,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 Zie 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 qP extends Di{getDefault(){return 1}set(d){(d!==this.current||this.dirty)&&(this.gl.clearDepth(d),this.current=d,this.dirty=!1)}}class g5 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 x5 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 l0 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 c0 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 VP 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 y5 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 HP 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 d0 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 v5 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 WP 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 GP=class extends Di{getDefault(){return null}set(w){(w!==this.current||this.dirty)&&(this.gl.useProgram(w),this.current=w,this.dirty=!1)}};class KP 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 u0 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 ZP 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 Yie 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 Xie 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 Qie 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 _5 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 b5 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 w5 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 j5 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 YP 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 h0 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 XP extends h0{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,J,te,ue,ce,fe,ke,_e,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:J,u_globe_pos:te,u_globe_radius:ue,u_viewport:ce,u_grid_matrix:Re?Float32Array.from(Re):new Float32Array(9),u_skirt_height:fe,u_far_z_cutoff:ke,u_emissive_texture_available:_e});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 k5(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(),J=j.coveringZoomLevel({tileSize:H.tileSize,roundZoom:H.roundZoom}),te=!d||Math.abs(d.tileID.overscaledZ-J)>Math.abs(w.tileID.overscaledZ-J),ue=te&&w.refreshedUponExpiration?1:i.aA(te?R:1-B,0,1);return d?{opacity:1,mix:1-ue,isFading:R<1}:{opacity:ue,mix:0,isFading:R<1}}return{opacity:1,mix:0,isFading:!1}}class uN extends vd{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 N5 extends vd{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 S5 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 C5 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 J=new i.bd,te=new i.b0,ue=131;J.reserve(17161),te.reserve(33800);const ce=i.al/128,fe=i.al+ce/2,ke=fe+ce;for(let Re=-ce;Refe||Re<0||Re>fe?24575:0,st=i.aA(Math.round(De),0,i.al),Ge=i.aA(Math.round(Re),0,i.al);J.emplaceBack(st+We,Ge)}const _e=(Re,De)=>{const We=De*ue+Re;te.emplaceBack(We+1,We,We+ue),te.emplaceBack(We+ue,We+ue+1,We+1)};for(let Re=1;Re<129;Re++)for(let De=1;De<129;De++)_e(De,Re);return[0,129].forEach(Re=>{for(let De=0;De<130;De++)_e(De,Re),_e(Re,De)}),[J,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 N5(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 Gn({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"),J=O?this._mockSourceCache:d.getSourceCache(H,B);if(!J)return void i.w(`Couldn't find terrain source "${H}".`);if(this.sourceCache=J,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 ue=this.getScaledDemTileSize();this.sourceCache.update(p,ue,!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 J=O;this._evaluationZoom!=null&&(J=this._evaluationZoom,Math.abs(O-J)>.5&&(B=.5*(O-J+B)),B*E<0&&(J+=B)),this._evaluationZoom=J;const te=R.getExaggeration(J),ue=te===R.getExaggeration(Math.max(0,J-.1));if(ue&&Math.abs(te-this._exaggeration)<.01)return te;let ce=Math.min(.1,.00375*(this._updateTimestamp-H));return(ue||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 J=p.getTileByID(H).tileID;return J.projMatrix=j.calculateProjMatrix(J.toUnwrapped()),J});(function(H,J){const te=J.transform.pointCoordinate(J.transform.getCameraPoint()),ue=new i.P(te.x,te.y);H.sort((ce,fe)=>{if(fe.overscaledZ-ce.overscaledZ)return fe.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 J=R[H];if(!J.used||(J!==this.sourceCache&&this.resetTileLookupCache(J.id),this._setupProxiedCoordsForOrtho(J,d[H],O),J.usedForTerrain))continue;const te=d[H];J.getSource().reparseOverscaled&&this._assignTerrainTiles(te)}this.proxiedCoords[p.id]=E.map(H=>new S5(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 J=this.terrainTileForTile[H.key];if(!J)continue;const te=J.tileID.key;te in B||(this._visibleDemTiles.push(J),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),p5(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,J=1;if(j&&j.morphing&&this._useVertexMorphing){const fe=j.morphing.srcDemTile,ke=j.morphing.dstDemTile;J=j.morphing.phase,fe&&ke&&(this._prepareDemTileUniforms(d,fe,R,"_prev")&&(H=fe),this._prepareDemTileUniforms(d,ke,R)&&(B=ke))}const te=fe=>fe&&fe.demTexture&&this.painter.linearFloatFilteringSupported()?O.LINEAR:O.NEAREST;let ue=null;var ce;if(this.enabled?H&&B?(ue=B.demTexture,E.activeTexture.set(O.TEXTURE4),H.demTexture.bind(te(H),O.CLAMP_TO_EDGE),R.u_dem_lerp=J):(B=this.terrainTileForTile[d.tileID.key],ue=this._prepareDemTileUniforms(d,B,R)?B.demTexture:this.emptyDEMTexture):ue=this.emptyDEMTexture,E.activeTexture.set(O.TEXTURE2),ue&&(R.u_dem_size=(ce=ue).size[0]===1?1:ce.size[0]-2,ue.bind(te(B),O.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(j&&j.useDepthForOcclusion,p,R),j&&j.useMeterToDem&&B){const fe=(1<{if(De===Xt)return;const lr=[cN[Xt],"PROJECTION_GLOBE_VIEW"];st&&lr.push("CUSTOM_ANTIALIASING");const br=J.isTileAffectedByFog(Yt);Re=J.getOrCreateProgram("globeRaster",{defines:lr,overrideFog:br}),De=Xt},jt=J.colorModeForRenderPass(),gt=new vn(_e.LEQUAL,vn.ReadWrite,J.depthRangeFor3D);Lf.update(fe);const _t=i.dF(We),pt=[i.aF(We.center.lng),i.aJ(We.center.lat)],ht=J.globeSharedBuffers,St=[We.width*i.o.devicePixelRatio,We.height*i.o.devicePixelRatio],Rt=Float32Array.from(We.globeMatrix),Dt={useDenormalizedUpVectorScale:!0};{const Yt=J.transform,Xt=dN(Yt.zoom,te.exaggeration(),te.sourceCache._source.tileSize);De=-1;const lr=_e.TRIANGLES;for(const br of ce){const Vt=ue.getTile(br),Et=Gn.disabled,er=te.prevTerrainTileForTile[br.key],Kt=te.terrainTileForTile[br.key];Yv(er,Kt)&&Lf.newMorphing(br.key,er,Kt,fe,250),m0(J,Vt.emissiveTexture),ke.activeTexture.set(_e.TEXTURE0),Vt.texture&&Vt.texture.bind(_e.LINEAR,_e.CLAMP_TO_EDGE);const hr=Lf.getMorphValuesForProxy(br.key),Ir=hr?1:0;hr&&Object.assign(Dt,{morphing:{srcDemTile:hr.from,dstDemTile:hr.to,phase:i.dD(hr.phase)}});const Yr=i.dG(br.canonical),Cr=i.dH(Yr.getCenter().lat),wr=i.dI(br.canonical,Yr,Cr,Yt.worldSize/Yt._pixelsPerMercatorPixel),pn=i.bk(i.dJ(br.canonical)),on=J.emissiveMode==="mrt-fallback"?1:0,Vr=lN(Yt.expandedFarZProjMatrix,Rt,_t,pn,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,on,wr);if(Ge(br,Ir),Re&&(te.setupElevationDraw(Vt,Re,Dt),J.uploadCommonUniforms(ke,Re,br.toUnwrapped()),ht)){const[Qr,Tn,ss]=ht.getGridBuffers(Cr,Xt!==0);Re.draw(J,lr,gt,Et,jt,Vn.backCCW,Vr,"globe_raster",Qr,Tn,ss)}}}if(ht&&(J.renderDefaultNorthPole||J.renderDefaultSouthPole)){const Yt=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];st&&Yt.push("CUSTOM_ANTIALIASING"),Re=J.getOrCreateProgram("globeRaster",{defines:Yt});for(const Xt of ce){const{x:lr,y:br,z:Vt}=Xt.canonical,Et=br===0,er=br===(1<Qr.draw(J,_e.TRIANGLES,gt,Gn.disabled,jt,Vn.disabled,lN(We.expandedFarZProjMatrix,wr,wr,pn,0,pt,We.frustumCorners.TL,We.frustumCorners.TR,We.frustumCorners.BR,We.frustumCorners.BL,We.globeCenterInViewSpace,We.globeRadius,St,0,We._farZ,on),"globe_pole_raster",Tn,Ir,Yr);te.setupElevationDraw(Cr,Re,Dt),J.uploadCommonUniforms(ke,Re,Xt.toUnwrapped()),Et&&J.renderDefaultNorthPole&&Vr(Re,Kt),er&&J.renderDefaultSouthPole&&(wr=i.cS(i.bC(),wr,[1,-1,1]),Vr(Re,hr))}}}})(E,O,R,B,H);else{const J=E.context,te=J.gl;let ue,ce;const fe=E.shadowRenderer,ke=Yp(E,E.longestCutoffRange),_e=jt=>{if(ce===jt)return;const gt=[];gt.push(cN[jt]),ke.shouldRenderCutoff&>.push("RENDER_CUTOFF"),fe&&(gt.push("RENDER_SHADOWS","DEPTH_TEXTURE"),fe.useNormalOffset&>.push("NORMAL_OFFSET")),ue=E.getOrCreateProgram("terrainRaster",{defines:gt}),ce=jt},Re=E.colorModeForRenderPass(),De=new vn(te.LEQUAL,vn.ReadWrite,E.depthRangeFor3D);Lf.update(H);const We=E.transform,st=dN(We.zoom,O.exaggeration(),O.sourceCache._source.tileSize);let Ge=[0,0,0];if(fe){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=Gn.disabled,Rt=O.prevTerrainTileForTile[pt.key],Dt=O.terrainTileForTile[pt.key];Yv(Rt,Dt)&&Lf.newMorphing(pt.key,Rt,Dt,H,250),m0(E,ht.emissiveTexture),J.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 lr;Yt&&(lr={morphing:{srcDemTile:Yt.from,dstDemTile:Yt.to,phase:i.dD(Yt.phase)}});const br=E.emissiveMode==="mrt-fallback"?1:0,Vt=Lu(pt.projMatrix,k5(pt.canonical,We.renderWorldCopies)?st/10:st,Ge,br);if(_e(Xt),!ue)continue;O.setupElevationDraw(ht,ue,lr);const Et=pt.toUnwrapped();fe&&fe.setupShadows(Et,ue),E.uploadCommonUniforms(J,ue,Et,null,ke),ue.draw(E,jt,De,St,Re,Vn.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 J=0;for(const te of O){const ue=E.getTileByID(te.proxyTileKey),ce=E.proxyCachedFBO[te.key]?E.proxyCachedFBO[te.key][d]:void 0,fe=ce!==void 0?E.renderCache[ce]:this.pool[J++],ke=ce!==void 0;if(ue.texture=fe.tex,ue.emissiveTexture=fe.emissiveTex,ke&&!fe.dirty){H.push(ue.tileID);continue}j.bindFramebuffer.set(fe.fb.framebuffer);const _e=j.gl;let Re;_e.drawBuffers(p.emissiveMode==="mrt-fallback"?[_e.COLOR_ATTACHMENT0,_e.COLOR_ATTACHMENT1]:[_e.COLOR_ATTACHMENT0]),this.renderedToTile=!1,fe.dirty&&(j.clear({color:i.ao.transparent,stencil:0}),fe.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 st=p.style.getLayerSourceCache(We),Ge=st?this.proxyToSource[te.key][st.id]:[te];if(!Ge)continue;const jt=Ge;j.viewport.set([0,0,fe.fb.width,fe.fb.height]),Re!==(st?st.id:null)&&(this._setupStencil(fe,Ge,We,st),Re=st?st.id:null),p.renderLayer(p,st,We,jt)}if(_e.drawBuffers([_e.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 st=p.style.getLayerSourceCache(We),Ge=st?this.proxyToSource[te.key][st.id]:[te];if(!Ge)continue;const jt=Ge;j.viewport.set([0,0,fe.fb.width,fe.fb.height]),Re!==(st?st.id:null)&&(this._setupStencil(fe,Ge,We,st),Re=st?st.id:null),p.renderLayer(p,st,We,jt)}this.renderedToTile?(fe.dirty=!0,H.push(ue.tileID)):ke||--J,J===5&&(J=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 XP(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 Am){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],J=this.proxyToSource[B.key];let te=0;for(const ue in J){const ce=J[ue],fe=H[ue];if(!fe||fe.length!==ce.length||ce.some((ke,_e)=>ke!==fe[_e]||E[ue]&&E[ue].hasOwnProperty(ke.key))){te=-1;break}++te}for(const ue in p.proxyCachedFBO[B.key])p.renderCache[p.proxyCachedFBO[B.key][ue]].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):Gn.disabled}_renderTileClippingMasks(d,p){const j=this.painter,E=this.painter.context,O=E.gl;j._tileClippingMaskIDs={},E.setColorMode(ps.disabled),E.setDepthMode(vn.disabled);const R=j.getOrCreateProgram("clippingMask");for(const B of d){const H=j._tileClippingMaskIDs[B.key]=--p;R.draw(j,O.TRIANGLES,vn.disabled,new Gn({func:O.ALWAYS,mask:0},H,255,O.KEEP,O.KEEP,O.REPLACE),ps.disabled,Vn.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-J.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<(ue.min.x=Math.min(ue.min.x,ce.x-H.x),ue.min.y=Math.min(ue.min.y,ce.y-H.y),ue.max.x=Math.max(ue.max.x,ce.x-H.x),ue.max.y=Math.max(ue.max.y,ce.y-H.y),ue),{min:new i.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new i.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),te=(ue,ce)=>{const fe=ue.wrap+ue.canonical.x/(1<Re+J.max.x||ke+_eDe+J.max.y};for(let ue=0;ueR.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 J=p.tileID.wrap-d.wrap<0?(R=i.al>>O,B=R*((p.tileID.canonical.x<=ue){const ce=d.canonical.z-ue;p.getSource().reparseOverscaled?(B=Math.max(d.canonical.z+2,p.transform.tileZoom),R=new i.aQ(B,d.wrap,ue,d.canonical.x>>ce,d.canonical.y>>ce)):ce!==0&&(B=ue,R=new i.aQ(B,d.wrap,ue,d.canonical.x>>ce,d.canonical.y>>ce))}R.key!==d.key&&(J.push(R.key),j=p.getTile(R))}const te=ue=>{J.forEach(ce=>{E[ce]=ue}),J.length=0};for(B-=1;B>=H&&(!j||!j.hasData());B--){j&&te(j.tileID.key);const ue=R.calculateScaledKey(B);if(j=p.getTileByID(ue),j&&j.hasData())break;const ce=E[ue];if(ce===null)break;ce===void 0?J.push(ue):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 f0(w,d,p){const j=function(B,H,J){const te=i.bJ(H,B),ue=i.bJ(J,[.2126,.7152,.0722]),ce=(ke,_e,Re)=>(1-Re)*ke+Re*_e,fe=ce(1-.3*Math.min(ue,1),1,Math.min(te+1,1));return ce(.92,1,Math.asin(i.aA(H[2],-1,1))/Math.PI+.5)*fe}(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 Jie=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],eoe=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class QP{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(_e=>`#define ${_e}`)).join(` `)}`,J=[H,Vie];for(const _e of j.fragmentIncludes)J.push(eg[_e]);J.push(j.fragmentSource);const te=J.join(` `),ue=[H,UP];for(const _e of j.vertexIncludes)ue.push(eg[_e]);this.forceManualRenderingForInstanceIDShaders=d.forceManualRenderingForInstanceIDShaders&&j.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&ue.push("uniform int u_instanceID;"),ue.push(j.vertexSource);let ce=ue.join(` `);this.forceManualRenderingForInstanceIDShaders&&(ce=ce.replaceAll("gl_InstanceID","u_instanceID"));const fe=B.createShader(B.FRAGMENT_SHADER);if(B.isContextLost())return void(this.failedToCreate=!0);B.shaderSource(fe,te),B.compileShader(fe),B.attachShader(this.program,fe);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(fe),this.fixedUniforms=O(d),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=E?E.getUniforms(d):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(_e=>({u_instanceID:new i.ch(_e)}))(d)),(R.includes("TERRAIN")||p.includes("symbol")||p.includes("circle"))&&(this.terrainUniforms=(_e=>({u_dem:new i.ch(_e),u_dem_prev:new i.ch(_e),u_dem_tl:new i.ck(_e),u_dem_scale:new i.cj(_e),u_dem_tl_prev:new i.ck(_e),u_dem_scale_prev:new i.cj(_e),u_dem_size:new i.cj(_e),u_dem_lerp:new i.cj(_e),u_exaggeration:new i.cj(_e),u_depth:new i.ch(_e),u_depth_size_inv:new i.ck(_e),u_depth_range_unpack:new i.ck(_e),u_occluder_half_size:new i.cj(_e),u_occlusion_depth_offset:new i.cj(_e),u_meter_to_dem:new i.cj(_e),u_label_plane_matrix_inv:new i.cl(_e)}))(d)),R.includes("GLOBE")&&(this.globeUniforms=(_e=>({u_tile_tl_up:new i.ci(_e),u_tile_tr_up:new i.ci(_e),u_tile_br_up:new i.ci(_e),u_tile_bl_up:new i.ci(_e),u_tile_up_scale:new i.cj(_e)}))(d)),R.includes("FOG")&&(this.fogUniforms=(_e=>({u_fog_matrix:new i.cl(_e),u_fog_range:new i.ck(_e),u_fog_color:new i.d3(_e),u_fog_horizon_blend:new i.cj(_e),u_fog_vertical_limit:new i.ck(_e),u_fog_temporal_offset:new i.cj(_e),u_frustum_tl:new i.ci(_e),u_frustum_tr:new i.ci(_e),u_frustum_br:new i.ci(_e),u_frustum_bl:new i.ci(_e),u_globe_pos:new i.ci(_e),u_globe_radius:new i.cj(_e),u_globe_transition:new i.cj(_e),u_is_globe:new i.ch(_e),u_viewport:new i.ck(_e)}))(d)),R.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(_e=>({u_cutoff_params:new i.d3(_e)}))(d)),R.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(_e=>({u_lighting_ambient_color:new i.ci(_e),u_lighting_directional_dir:new i.ci(_e),u_lighting_directional_color:new i.ci(_e),u_ground_radiance:new i.ci(_e)}))(d)),R.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(_e=>({u_light_matrix_0:new i.cl(_e),u_light_matrix_1:new i.cl(_e),u_fade_range:new i.ck(_e),u_shadow_normal_offset:new i.ci(_e),u_shadow_intensity:new i.cj(_e),u_shadow_texel_size:new i.cj(_e),u_shadow_map_resolution:new i.cj(_e),u_shadow_direction:new i.ci(_e),u_shadow_bias:new i.ci(_e),u_shadowmap_0:new i.ch(_e),u_shadowmap_1:new i.ch(_e)}))(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,J,te){const ue=d.options.wireframe;if(ue.terrain===!1&&ue.layers2D===!1&&ue.layers3D===!1)return;const ce=d.context;if(!(!(!ue.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!ue.layers2D||d._terrain&&d._terrain.renderingToTexture||!Jie.includes(this.name))||!(!ue.layers3D||!eoe.includes(this.name))))return;const fe=ce.gl,ke=d.wireframeDebugCache.getLinesFromTrianglesBuffer(d.frameCounter,O,ce);if(!ke)return;const _e=[...this.fixedDefines,"DEBUG_WIREFRAME"],Re=d.getOrCreateProgram(this.name,{config:this.configuration,defines:_e});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)};J&&J.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 ps([fe.ONE,fe.ONE_MINUS_SRC_ALPHA,fe.ZERO,fe.ONE],i.ao.transparent,[!0,!0,!0,!1])),ce.setDepthMode(new vn(p.func===fe.LESS?fe.LEQUAL:p.func,vn.ReadOnly,p.range)),ce.setStencilMode(Gn.disabled);const We=3*R.primitiveLength*2,st=3*R.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const Ge=te||1;for(let jt=0;jt1?fe.drawElementsInstanced(fe.LINES,We,fe.UNSIGNED_SHORT,st,te):fe.drawElements(fe.LINES,We,fe.UNSIGNED_SHORT,st);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,J,te,ue,ce,fe,ke,_e,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:fe});const st={[We.POINTS]:1,[We.LINES]:2,[We.TRIANGLES]:3,[We.LINE_STRIP]:1}[p];this.checkUniforms(H,"RENDER_SHADOWS",this.shadowUniforms);const Ge=_e||[],jt=ke?ke.getPaintVertexBuffers():[],gt=p===We.TRIANGLES&&te,_t=Re&&Re>0?1:void 0;for(const pt of ue.get()){const ht=pt.vaos||(pt.vaos={});if((ht[H]||(ht[H]=new Hie)).bind(De,this,J,jt,te,pt.vertexOffset,Ge,_t),this.forceManualRenderingForInstanceIDShaders){const St=Re||1;for(let Rt=0;Rt1?We.drawElementsInstanced(p,pt.primitiveLength*st,We.UNSIGNED_SHORT,pt.primitiveOffset*st*2,Re):te?We.drawElements(p,pt.primitiveLength*st,We.UNSIGNED_SHORT,pt.primitiveOffset*st*2):We.drawArrays(p,pt.vertexOffset,pt.vertexLength);gt&&this._drawDebugWireframe(d,j,E,O,te,pt,ce,fe,ke,Re)}}}function JP(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},toe=i.bC(),mN=(w,d,p,j,E,O,R,B,H,J,te,ue,ce,fe,ke,_e,Re,De)=>{const We=d.style.light,st=We.properties.get("position"),Ge=[st.x,st.y,st.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:toe,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:hN[J],u_base_type:hN[te],u_ao:E,u_edge_radius:O,u_width_scale:R,u_flood_light_color:ke,u_vertical_scale:_e,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]}),e6=(w,d,p,j,E,O,R,B,H,J,te,ue,ce,fe,ke,_e,Re,De)=>{const We=mN(w,d,p,j,E,O,R,B,J,te,ue,ce,fe,ke,_e,Re,1,[0,0,0]),st={u_height_factor:-Math.pow(2,B.overscaledZ)/H.tileSize/8};return Object.assign(We,JP(d,H,De),st)},p0=(w,d,p,j,E,O,R,B,H,J,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:J,u_fb:0,u_fb_size:te,u_dynamic_offset:1}),T5=(w,d,p)=>({u_matrix:w,u_emissive_strength:d,u_ground_shadow_factor:p}),A5=(w,d,p,j,E,O=0)=>Object.assign(T5(w,d,E),JP(p,j,O)),t6=(w,d,p,j)=>({u_matrix:w,u_world:p,u_emissive_strength:d,u_ground_shadow_factor:j}),E5=(w,d,p,j,E,O,R=0)=>Object.assign(A5(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}),r6=w=>({u_matrix:w}),ng=w=>({u_matrix:w}),I5=(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}),n6=i.bC(),s6=(w,d,p,j,E,O,R)=>{const B=w.transform,H=B.projection.name==="globe",J=H?i.dR(B.zoom,d.canonical)*B._pixelsPerMercatorPixel:i.ay(p,1,O),te={u_matrix:d.projMatrix,u_extrude_scale:J,u_intensity:R,u_inv_rot_matrix:n6,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:J,u_fade_t:te.mix,u_opacity:te.opacity*ue.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:ue.paint.get("raster-brightness-min"),u_brightness_high:ue.paint.get("raster-brightness-max"),u_saturation_factor:i.dT(ue.paint.get("raster-saturation")),u_contrast_factor:i.dS(ue.paint.get("raster-contrast")),u_spin_weights:i6(ue.paint.get("raster-hue-rotate")),u_perspective_transform:ce,u_raster_elevation:fe,u_zoom_transition:R,u_merc_center:B,u_cutoff_params:H,u_colorization_mix:pN(i.dU,_e,De),u_colorization_offset:gN(i.dU,Re,De),u_color_ramp:ke,u_texture_offset:[st/(We+2*st),We/(We+2*st)],u_texture_res:[We+2*st,We+2*st],u_emissive_strength:Ge});function i6(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 Rm=.05,roe=(w,d,p,j,E,O,R,B,H,J,te,ue)=>({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:J,u_fade_t:te.mix,u_opacity:te.opacity,u_image0:0,u_image1:1,u_raster_elevation:ue,u_zoom_transition:R,u_merc_center:B,u_cutoff_params:H}),noe=(w,d,p,j,E,O,R,B,H,J)=>({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:J,u_particle_pos_scale:1.1,u_particle_pos_offset:[Rm,Rm]}),o6=(w,d,p,j,E,O,R,B,H,J)=>({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:J,u_particle_pos_scale:1.1,u_particle_pos_offset:[Rm,Rm]}),l6=i.bC(),xN=(w,d,p,j,E,O,R,B,H,J,te,ue,ce,fe,ke,_e,Re,De,We,st,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:+J,u_elevation_from_sea:H?1:0,u_pitch_with_map:+j,u_texsize:te,u_texsize_icon:ue,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:l6,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:l6,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:st,u_inv_matrix:i.bl(i.bC(),R),u_normal_scale:Ge,u_lutTexture:Pl.LUT};return We.name==="globe"&&(ht.u_tile_id=[fe.canonical.x,fe.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(J,te,ue,ce,fe,ke){const{width:_e,height:Re}=ce.imageManager.getPixelSize(te),De=Math.pow(2,ke.tileID.overscaledZ),We=ke.tileSize*Math.pow(2,ce.transform.tileZoom)/De,st=We*(ke.tileID.canonical.x+ke.tileID.wrap*De),Ge=We*ke.tileID.canonical.y;return{u_image:0,u_pattern_tl:ue.tl,u_pattern_br:ue.br,u_texsize:[_e,Re],u_pattern_size:ue.displaySize,u_pattern_units_to_pixels:fe?[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:[st>>16,Ge>>16],u_pixel_coord_lower:[65535&st,65535&Ge]}}(0,O,R,j,B,H),{u_matrix:w,u_emissive_strength:d,u_opacity:p}),g0=new Float32Array(i.bA([])),vx=(w,d,p,j,E,O,R,B,H,J,te,ue,ce,fe=[0,0,0],ke,_e,Re)=>{const De=E.style.light,We=De.properties.get("position"),st=[-We.x,-We.y,We.z],Ge=i.dO();De.properties.get("anchor")==="viewport"&&(i.dP(Ge,-E.transform.angle),i.dQ(st,st,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]),_e&&(pt.r=_e.color.r,pt.g=_e.color.g,pt.b=_e.color.b,pt.a=_e.colorMix,ue=_e.emissionStrength,O*=_e.opacity),{u_matrix:w,u_lighting_matrix:d,u_normal_matrix:p,u_node_matrix:j||g0,u_lightpos:st,u_lightintensity:De.properties.get("intensity"),u_lightcolor:[gt.r,gt.g,gt.b],u_camera_pos:fe,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:J,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:ue,u_occlusionTextureTransform:ke||[0,0,0,0]}},P5=(w,d=g0,p=g0)=>({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 Zh{constructor(d,p,j,E){this.id=Zh.uniqueIdxCounter,Zh.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=Zh.uniqueIdxCounter,Zh.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)}}Zh.uniqueIdxCounter=0;const L5={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class c6{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 d6{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 h0(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 x0{constructor(d,p){this.gl=d,this.clearColor=new Zie(this),this.clearDepth=new qP(this),this.clearStencil=new g5(this),this.colorMask=new rN(this),this.depthMask=new x5(this),this.stencilMask=new xx(this),this.stencilFunc=new l0(this),this.stencilOp=new Gv(this),this.stencilTest=new c0(this),this.depthRange=new VP(this),this.depthTest=new y5(this),this.depthFunc=new HP(this),this.blend=new d0(this),this.blendFunc=new nN(this),this.blendColor=new sN(this),this.blendEquation=new v5(this),this.cullFace=new aN(this),this.cullFaceSide=new Kv(this),this.frontFace=new WP(this),this.program=new GP(this),this.activeTexture=new KP(this),this.viewport=new u0(this),this.bindFramebuffer=new ZP(this),this.bindRenderbuffer=new Yie(this),this.bindTexture=new Xie(this),this.bindVertexBuffer=new Qie(this),this.bindElementBuffer=new _5(this),this.bindVertexArrayOES=new b5(this),this.pixelStoreUnpack=new w5(this),this.pixelStoreUnpackPremultiplyAlpha=new j5(this),this.pixelStoreUnpackFlipY=new YP(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 Zh(this,d,p,j)}createVertexBuffer(d,p,j,E,O){return new c6(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 d6(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,ps.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 sn(w,d,p,j,E,O,R){const B=w.context,H=B.gl,J=w.transform,te=[i.aF(J.center.lng),i.aJ(J.center.lat)],ue=p.layout.get("symbol-placement"),ce=p.layout.get("text-variable-anchor"),fe=p.layout.get("icon-rotation-alignment")==="map",ke=p.layout.get("text-rotation-alignment")==="map",_e=ue!=="point",Re=[];let De=0,We=0;for(let ht=0;ht0){const Vr=i.bC(),Qr=Cr;i.cP(Vr,Dt.placementInvProjMatrix,J.glCoordMatrix),i.cP(Vr,Vr,Dt.placementViewportMatrix),Re.push({circleArray:pn,circleOffset:We,transform:Qr,invTransform:Vr,projection:Dt.getProjection()}),De+=pn.length/4,We=De}if(!wr)continue;w.terrain&&w.terrain.setupElevationDraw(Rt,Yr);const on=hr?[St.canonical.x,St.canonical.y,1<=0&&(fe[st.associatedIconIndex]={x:Dt,y:Yt,z:Xt,angle:er})}else Wh(gt,ue)}if(J){ce.clear();const We=w.icon.placedSymbolArray;for(let st=0;st{let oa=[0,0,0];if(Aa){const xs=w.style.directionalLight,xi=w.style.ambientLight;xs&&xi&&(oa=Pf(w.style,xs,xi))}return oa},fa=Aa=>{ht.depthOcclusionForSymbolsAndCircles&&(p.hasOcclusionOpacityProperties||w.terrain)&&(Aa.push("DEPTH_D24"),Aa.push("DEPTH_OCCLUSION"))},es=Aa=>{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),Aa.push("APPLY_LUT_ON_GPU"))},Ta=()=>{const Aa=St&&p.layout.get("symbol-placement")!=="point",oa=[];fa(oa),es(oa);const xs=Aa||ss,xi=wr.elevationType==="road",ho=w.shadowRenderer,qi=xi&&Dt&&!!ho&&ho.enabled,ei=yn(qi),Nd=xi&&Dt&&!w.terrain?Vt:br,fc=p.paint.get("icon-image-cross-fade");w.terrainRenderModeElevated()&&Dt&&oa.push("PITCH_WITH_MAP_TERRAIN"),pn&&(oa.push("PROJECTION_GLOBE_VIEW"),xs&&oa.push("PROJECTED_POS_ON_VIEWPORT")),fc>0&&wr.hasAnySecondaryIcon&&oa.push("ICON_TRANSITION"),!wr.icon.zOffsetVertexBuffer||xi&&w.terrain||oa.push("Z_OFFSET"),De===0&&We===0&&st===0&&Ge===1||oa.push("COLOR_ADJUSTMENT"),wr.sdfIcons&&oa.push("RENDER_SDF"),qi&&oa.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),xi&&Dt&&!w.terrain&&wr.icon.orientationVertexBuffer&&oa.push("ELEVATED_ROADS");const el=wr.icon.programConfigurations.get(p.id),Lc=w.getOrCreateProgram("symbol",{config:el,defines:oa}),Oc=Cr.imageAtlasTexture?Cr.imageAtlasTexture.size:[0,0],Gl=wr.iconSizeData,Ru=i.bK(Gl,ht.zoom),_h=Dt||!ht.isOrthographic,Yd=ja(Vr,Cr.tileID.canonical,Dt,St,ht,wr.getProjection(),Qr),ro=cu(Vr,Cr.tileID.canonical,Dt,St,ht,wr.getProjection(),Qr),xo=w.translatePosMatrix(ro,Cr,B,J,!0),ti=w.translatePosMatrix(Vr,Cr,B,J),Ao=xs?t_:Yd,Yi=St&&!Dt&&!Aa;let Vi=Ir;!Kt&&!ht.mercatorFromTransition||St||(Vi=Of(ht));const bh=pn?Vi:Ir,f_=p.getColorAdjustmentMatrix(De,We,st,Ge),Qh=xN(Gl.kind,Ru,Yi,Dt,w,ti,Ao,xo,jt,!1,Oc,[0,0],0,Yr,on,Et,Gs,bh,wr.getProjection(),ei,Na,f_,fc,null),p_=Cr.imageAtlasTexture?Cr.imageAtlasTexture:null,S0=p.layout.get("icon-size").constantOr(0)!==1||wr.iconsNeedLinear,Um=wr.sdfIcons||w.options.rotating||w.options.zooming||S0||_h?pt.LINEAR:pt.NEAREST,Vf=wr.sdfIcons&&p.paint.get("icon-halo-width").constantOr(1)!==0,C0=w.terrain&&Dt&&Aa?i.bl(i.bC(),Yd):t_;if(Aa&&wr.icon){const dg=i.bV.getAtTileOffsetFunc(Yr,ht.center.lat,ht.worldSize,wr.getProjection()),Hf=Hh(Vr,Cr.tileID.canonical,Dt,St,ht,wr.getProjection(),Qr),Jh=p.layout.get("icon-size-scale-range"),Wf=i.aA(w.scaleFactor,Jh[0],Jh[1]);LP(wr,Vr,w,!1,Hf,ro,Dt,_e,dg,Yr,Wf)}return{program:Lc,buffers:wr.icon,uniformValues:Qh,atlasTexture:p_,atlasTextureIcon:null,atlasInterpolation:Um,atlasInterpolationIcon:null,isSDF:wr.sdfIcons,hasHalo:Vf,depthMode:Nd,tile:Cr,renderWithShadows:qi,labelPlaneMatrixInv:C0}},Va=()=>{const Aa=Rt&&p.layout.get("symbol-placement")!=="point",oa=[],xs=Aa||er||ss,xi=wr.elevationType==="road",ho=w.shadowRenderer,qi=xi&&Yt&&!!ho&&ho.enabled,ei=yn(qi),Nd=xi&&Yt&&!w.terrain?Vt:br;w.terrainRenderModeElevated()&&Yt&&oa.push("PITCH_WITH_MAP_TERRAIN"),pn&&(oa.push("PROJECTION_GLOBE_VIEW"),xs&&oa.push("PROJECTED_POS_ON_VIEWPORT")),!wr.text.zOffsetVertexBuffer||xi&&w.terrain||oa.push("Z_OFFSET"),wr.iconsInText&&oa.push("RENDER_TEXT_AND_SYMBOL"),oa.push("RENDER_SDF"),qi&&oa.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),xi&&Yt&&!w.terrain&&wr.text.orientationVertexBuffer&&oa.push("ELEVATED_ROADS"),fa(oa);const fc=wr.text.programConfigurations.get(p.id),el=w.getOrCreateProgram("symbol",{config:fc,defines:oa});let Lc,Oc=[0,0],Gl=null;const Ru=wr.textSizeData;wr.iconsInText&&(Oc=Cr.imageAtlasTexture?Cr.imageAtlasTexture.size:[0,0],Gl=Cr.imageAtlasTexture?Cr.imageAtlasTexture:null,Lc=Yt||!ht.isOrthographic||w.options.rotating||w.options.zooming||Ru.kind==="composite"||Ru.kind==="camera"?pt.LINEAR:pt.NEAREST);const _h=Cr.glyphAtlasTexture?Cr.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),ti=ja(Vr,Cr.tileID.canonical,Yt,Rt,ht,wr.getProjection(),Qr),Ao=cu(Vr,Cr.tileID.canonical,Yt,Rt,ht,wr.getProjection(),Qr),Yi=w.translatePosMatrix(Ao,Cr,H,te,!0),Vi=w.translatePosMatrix(Vr,Cr,H,te),bh=xs?t_:ti,f_=Rt&&!Yt&&!Aa;let Qh=Ir;!Kt&&!ht.mercatorFromTransition||Rt||(Qh=Of(ht));const p_=xN(Ru.kind,xo,f_,Yt,w,Vi,bh,Yi,jt,!0,_h,Oc,0,Yr,on,Et,Gs,pn?Qh:Ir,wr.getProjection(),ei,Na,null,null,ro),S0=Cr.glyphAtlasTexture?Cr.glyphAtlasTexture:null,Um=pt.LINEAR,Vf=p.paint.get("text-halo-width").constantOr(1)!==0,C0=w.terrain&&Yt&&Aa?i.bl(i.bC(),ti):t_;if(Aa&&wr.text){const dg=i.bV.getAtTileOffsetFunc(Yr,ht.center.lat,ht.worldSize,wr.getProjection()),Hf=Hh(Vr,Cr.tileID.canonical,Yt,Rt,ht,wr.getProjection(),Qr);LP(wr,Vr,w,!0,Hf,Ao,Yt,Re,dg,Yr,ro)}return{program:el,buffers:wr.text,uniformValues:p_,atlasTexture:S0,atlasTextureIcon:Gl,atlasInterpolation:Um,atlasInterpolationIcon:Lc,isSDF:!0,hasHalo:Vf,depthMode:Nd,tile:Cr,renderWithShadows:qi,labelPlaneMatrixInv:C0}},Ra=wr.icon.segments.get().length,ha=wr.text.segments.get().length,gs=Ra&&!R.onlyText?Ta():null,Ma=ha&&!R.onlyIcons?Va():null,Zi=p.paint.get("icon-opacity").constantOr(1),Ci=p.paint.get("text-opacity").constantOr(1);if(Xt&&wr.canOverlap){lr=!0;const Aa=Zi&&!R.onlyText?wr.icon.segments.get():[],oa=Ci&&!R.onlyIcons?wr.text.segments.get():[];for(const xs of Aa)hr.push({segments:new i.bg([xs]),sortKey:xs.sortKey,state:gs});for(const xs of oa)hr.push({segments:new i.bg([xs]),sortKey:xs.sortKey,state:Ma})}else R.onlyText||hr.push({segments:Zi?wr.icon.segments:new i.bg([]),sortKey:0,state:gs}),R.onlyIcons||hr.push({segments:Ci?wr.text.segments:new i.bg([]),sortKey:0,state:Ma})}lr&&hr.sort((Yr,Cr)=>Yr.sortKey-Cr.sortKey);for(const Yr of hr){const Cr=Yr.state;if(Cr)if(w.terrain?w.terrain.setupElevationDraw(Cr.tile,Cr.program,{useDepthForOcclusion:ht.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Cr.labelPlaneMatrixInv}):w.setupDepthForOcclusion(ht.depthOcclusionForSymbolsAndCircles,Cr.program),_t.activeTexture.set(pt.TEXTURE0),Cr.atlasTexture&&Cr.atlasTexture.bind(Cr.atlasInterpolation,pt.CLAMP_TO_EDGE,!0),Cr.atlasTextureIcon&&(_t.activeTexture.set(pt.TEXTURE1),Cr.atlasTextureIcon&&Cr.atlasTextureIcon.bind(Cr.atlasInterpolationIcon,pt.CLAMP_TO_EDGE,!0)),Cr.renderWithShadows&&w.shadowRenderer.setupShadows(Cr.tile.tileID.toUnwrapped(),Cr.program,"vector-tile"),w.uploadCommonLightUniforms(w.context,Cr.program),Cr.hasHalo){const wr=Cr.uniformValues;wr.u_is_halo=1,O5(Cr.buffers,Yr.segments,p,w,Cr.program,Cr.depthMode,E,O,wr,2),wr.u_is_halo=0}else{if(Cr.isSDF){const wr=Cr.uniformValues;Cr.hasHalo&&(wr.u_is_halo=1,O5(Cr.buffers,Yr.segments,p,w,Cr.program,Cr.depthMode,E,O,wr,1)),wr.u_is_halo=0}O5(Cr.buffers,Yr.segments,p,w,Cr.program,Cr.depthMode,E,O,Cr.uniformValues,1)}}}function O5(w,d,p,j,E,O,R,B,H,J){const te=[w.dynamicLayoutVertexBuffer,w.opacityVertexBuffer,w.iconTransitioningVertexBuffer,w.globeExtVertexBuffer,w.zOffsetVertexBuffer,w.orientationVertexBuffer];E.draw(j,j.context.gl.TRIANGLES,O,R,B,Vn.disabled,H,p.id,w.layoutVertexBuffer,w.indexBuffer,d,p.paint,j.transform.zoom,w.programConfigurations.get(p.id),te,J)}function u6(w,d){const p=1<=Kh?1:fe.pitch/Kh))),2*ke}(w.transform),J=w.transform.getFreeCameraOptions().position,te="elevatedStructuresDepthReconstruct",ue=w.getOrCreateProgram(te,{defines:["DEPTH_RECONSTRUCTION"]}),ce=w.getOrCreateProgram(te);for(const fe of j){const ke=d.getTile(fe),_e=ke.getBucket(p);if(!_e)continue;const Re=_e.elevatedStructures;if(!Re)continue;const De=_e.elevationBufferData.heightRange,We=u6(fe.toUnwrapped(),J),st=w.translatePosMatrix(fe.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(st,We,H,1,0),jt=R,gt=Re.depthSegments,_t=ue}else if(E==="reset"){if(!De||De.min>=0||Re.maskSegments.segments[0].primitiveLength===0)continue;Ge=yx(st,We,0,0,1),jt=B,gt=Re.maskSegments,_t=ue}else if(E==="geometry"){if(Re.depthSegments.segments[0].primitiveLength===0)continue;Ge=yx(st,We,H,1,0),jt=R,gt=Re.depthSegments,_t=ce}_t.draw(w,O.TRIANGLES,jt,Gn.disabled,ps.disabled,Vn.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:J,terrainEnabled:te,pass:ue}=w,ce=E.context.gl,fe=R.paint.get("fill-pattern"),ke=R.paint.get("fill-pattern-cross-fade"),_e=fe.constantOr(null);let Re=J;J!=="road"||d&&!te||(Re="none");const De=Re==="road",We=w.painter.shadowRenderer,st=De&&!!We&&We.enabled,Ge=new vn(E.context.gl.LEQUAL,vn.ReadOnly,E.depthRangeFor3D);let jt=[0,0,0];if(st){const ht=E.style.directionalLight,St=E.style.ambientLight;ht&&St&&(jt=Pf(E.style,ht,St))}const gt=fe&&fe.constantOr(1),_t=E.terrain&&E.terrain.renderingToTexture,pt=(ht,St)=>{let Rt,Dt,Yt,Xt,lr;St?(Rt=gt&&!R.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Yt=ce.LINES):(Rt=gt?"fillPattern":"fill",Yt=ce.TRIANGLES);for(const br of B){const Vt=O.getTile(br);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),hr=E.isTileAffectedByFog(br),Ir=[],Yr=[];De&&(Ir.push("ELEVATED_ROADS"),Yr.push(er.elevatedLayoutVertexBuffer)),st&&Ir.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),_t&&p&&Ir.push("USE_MRT1"),gt&&(E.context.activeTexture.set(ce.TEXTURE0),Vt.imageAtlasTexture&&Vt.imageAtlasTexture.bind(ce.LINEAR,ce.CLAMP_TO_EDGE),Kt.updatePaintBuffers());let Cr=!1;if(_e&&Vt.imageAtlas){const Qr=Vt.imageAtlas,Tn=i.e3.from(_e),ss=Tn.getPrimary().scaleSelf(i.o.devicePixelRatio).toString(),Gs=Tn.getSecondary(),Na=Qr.patternPositions.get(ss),yn=Gs?Qr.patternPositions.get(Gs.scaleSelf(i.o.devicePixelRatio).toString()):null;Cr=!!Na&&!!yn,Na&&Kt.setConstantPatternPositions(Na,yn)}ke>0&&(Cr||Kt.getPatternTransitionVertexBuffer("fill-pattern"))&&Ir.push("FILL_PATTERN_TRANSITION");const wr=E.getOrCreateProgram(Rt,{config:Kt,overrideFog:hr,defines:Ir}),pn=E.translatePosMatrix(br.projMatrix,Vt,R.paint.get("fill-translate"),R.paint.get("fill-translate-anchor"));st&&We.setupShadows(Vt.tileID.toUnwrapped(),wr,"vector-tile");const on=R.paint.get("fill-emissive-strength");if(St){Xt=er.lineIndexBuffer,lr=er.lineSegments;const Qr=E.terrain&&E.terrain.renderingToTexture?E.terrain.drapeBufferSize:[ce.drawingBufferWidth,ce.drawingBufferHeight];Dt=Rt==="fillOutlinePattern"&>?E5(pn,on,E,Vt,Qr,jt,ke):t6(pn,on,Qr,jt)}else Xt=er.indexBuffer,lr=er.triangleSegments,Dt=gt?A5(pn,on,E,Vt,jt,ke):T5(pn,on,jt);E.uploadCommonUniforms(E.context,wr,br.toUnwrapped());let Vr=ht;(J==="road"&&!te||J==="offset")&&(Vr=Ge),wr.draw(E,Yt,Vr,j||E.stencilModeForClipping(br),H,Vn.disabled,Dt,R.id,er.layoutVertexBuffer,Xt,lr,R.paint,E.transform.zoom,Kt,Yr)}};E.renderPass===ue&&pt(E.depthModeForSublayer(1,E.renderPass==="opaque"?vn.ReadWrite:vn.ReadOnly),!1),Re==="none"&&E.renderPass==="translucent"&&R.paint.get("fill-antialias")&&pt(E.depthModeForSublayer(R.getPaintProperty("fill-outline-color")?2:0,vn.ReadOnly),!0)}function bN(w,d,p,j,E,O,R,B){p.resetLayerRenderingStats(w);const H=w.context,J=H.gl,te=w.transform,ue=p.paint.get("fill-extrusion-pattern"),ce=p.paint.get("fill-extrusion-pattern-cross-fade"),fe=ue.constantOr(null),ke=ue.constantOr(1),_e=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],st=p.layout.get("fill-extrusion-edge-radius"),Ge=st>0&&!p.paint.get("fill-extrusion-rounded-roof"),jt=Ge?0:st,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,lr=p.paint.get("fill-extrusion-height-alignment"),br=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",hr=w.shadowRenderer,Ir=Kt&&!!hr,Yr=Kt?Vn.disabled:Vn.backCCW;w.shadowRenderer&&(w.shadowRenderer.useNormalOffset=!0);let Cr=[0,0,0];if(hr){const on=w.style.directionalLight,Vr=w.style.ambientLight;on&&Vr&&(Cr=Pf(w.style,on,Vr)),Kt||(Et.push("RENDER_SHADOWS","DEPTH_TEXTURE"),hr.useNormalOffset&&Et.push("NORMAL_OFFSET")),er=Et.concat(["SHADOWS_SINGLE_CASCADE"])}const wr=Ir?"fillExtrusionDepth":ke?"fillExtrusionPattern":"fillExtrusion",pn=p.getLayerRenderingStats();for(const on of j){const Vr=d.getTile(on),Qr=Vr.getBucket(p);if(!Qr||Qr.projection.name!==te.projection.name)continue;let Tn=!1;hr&&(Tn=hr.getMaxCascadeForTile(on.toUnwrapped())===0);const ss=w.isTileAffectedByFog(on),Gs=Qr.programConfigurations.get(p.id);let Na=!1;if(fe&&Vr.imageAtlas){const ha=Vr.imageAtlas,gs=i.e3.from(fe),Ma=gs.getPrimary().scaleSelf(i.o.devicePixelRatio).toString(),Zi=gs.getSecondary(),Ci=ha.patternPositions.get(Ma),Aa=Zi?ha.patternPositions.get(Zi.scaleSelf(i.o.devicePixelRatio).toString()):null;Na=!!Ci&&!!Aa,Ci&&Gs.setConstantPatternPositions(Ci,Aa)}ce>0&&(Na||Gs.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&Et.push("FILL_EXTRUSION_PATTERN_TRANSITION");const yn=w.getOrCreateProgram(wr,{config:Gs,defines:Tn?er:Et,overrideFog:ss});if(w.terrain&&w.terrain.setupElevationDraw(Vr,yn,{useMeterToDem:!0}),!Qr.centroidVertexBuffer){const ha=yn.getAttributeLocation(J,"a_centroid_pos");ha!==-1&&J.vertexAttrib2f(ha,0,0)}!Kt&&hr&&hr.setupShadows(Vr.tileID.toUnwrapped(),yn,"vector-tile"),ke&&(w.context.activeTexture.set(J.TEXTURE0),Vr.imageAtlasTexture&&Vr.imageAtlasTexture.bind(J.LINEAR,J.CLAMP_TO_EDGE),Gs.updatePaintBuffers());const fa=p.paint.get("fill-extrusion-vertical-gradient"),es=1/Qr.tileToMeter;let Ta;if(Kt&&hr){if(Rf(Vr.tileID,Qr.maxHeight,w))continue;const ha=hr.calculateShadowPassMatrixFromTile(Vr.tileID.toUnwrapped());Ta=M5(ha,jt,es,Yt,lr,br)}else{const ha=w.translatePosMatrix(on.expandedProjMatrix,Vr,p.paint.get("fill-extrusion-translate"),p.paint.get("fill-extrusion-translate-anchor")),gs=te.projection.createInversionMatrix(te,on.canonical);Ta=ke?e6(ha,w,fa,_e,We,jt,es,on,Vr,gt,lr,br,pt,ht,gs,Rt,Yt,ce):mN(ha,w,fa,_e,We,jt,es,on,gt,lr,br,pt,ht,gs,Rt,Yt,Dt,Cr)}w.uploadCommonUniforms(H,yn,on.toUnwrapped(),null,Vt);let Va=Qr.segments;if(te.projection.name==="mercator"&&!Kt&&(Va=Qr.getVisibleSegments(Vr.tileID,w.terrain,w.transform.getFrustum(0)),!Va.get().length))continue;if(pn)if(Kt)for(const ha of Va.get())pn.numRenderedVerticesInShadowPass+=ha.primitiveLength;else for(const ha of Va.get())pn.numRenderedVerticesInTransparentPass+=ha.primitiveLength;const Ra=[];(w.terrain||B)&&Ra.push(Qr.centroidVertexBuffer),_t&&Ra.push(Qr.layoutVertexExtBuffer),Xt&&Ra.push(Qr.wallVertexBuffer),yn.draw(w,H.gl.TRIANGLES,E,O,R,Yr,Ta,p.id,Qr.layoutVertexBuffer,Qr.indexBuffer,Va,p.paint,w.transform.zoom,Gs,Ra)}w.shadowRenderer&&(w.shadowRenderer.useNormalOffset=!1)}class D5{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,J,te,ue,ce,fe,ke,_e,Re,De,We,st){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"),st&&(pt.push("CLEAR_FROM_TEXTURE"),Ge.activeTexture.set(jt.TEXTURE0),st.bind(jt.LINEAR,jt.CLAMP_TO_EDGE))):te==="sdf"?pt.push("SDF_SUBPASS"):te==="emissive"&&(pt.push("USE_MRT1"),Ge.activeTexture.set(jt.TEXTURE0),st.bind(jt.LINEAR,jt.CLAMP_TO_EDGE)),De&&pt.push("HAS_CENTROID"),Dt.shouldRenderCutoff&&pt.push("RENDER_CUTOFF");const Yt=(Xt,lr,br,Vt,Et)=>{let er=pt;lr.groundRadiusBuffer!=null&&(er=pt.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const Kt=lr.programConfigurations.get(j.id),hr=d.isTileAffectedByFog(Xt),Ir=d.getOrCreateProgram("fillExtrusionGroundEffect",{config:Kt,defines:er,overrideFog:hr}),Yr=p0(d,Vt,ue,J,Et,[ce,fe*Et],ke,_e,Re,_t>=17?0:Rt*Et,st?st.size[0]:0),Cr=[];De&&Cr.push(lr.hiddenByLandmarkVertexBuffer),lr.groundRadiusBuffer!=null&&Cr.push(lr.groundRadiusBuffer),d.uploadCommonUniforms(Ge,Ir,Xt.toUnwrapped(),null,Dt),Ir.draw(d,Ge.gl.TRIANGLES,O,R,B,H,Yr,j.id,lr.vertexBuffer,lr.indexBuffer,br,j.paint,_t,Kt,Cr)};for(const Xt of E){const lr=p.getTile(Xt),br=lr.getBucket(j);if(!br||br.projection.name!==gt.projection.name||!br.groundEffect||br.groundEffect&&!br.groundEffect.hasData())continue;const Vt=br.groundEffect,Et=1/br.tileToMeter;{const er=d.translatePosMatrix(Xt.projMatrix,lr,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),hr=p.getTile(Kt);if(!hr)continue;const Ir=hr.getBucket(j);if(!Ir||Ir.projection.name!==gt.projection.name||!Ir.groundEffect||Ir.groundEffect&&!Ir.groundEffect.hasData())continue;const Yr=Ir.groundEffect;let Cr,wr;er===0?(Cr=[-i.al,0,0],wr=1):er===1?(Cr=[i.al,0,0],wr=0):er===2?(Cr=[0,-i.al,0],wr=3):(Cr=[0,i.al,0],wr=2);const pn=Yr.regionSegments[wr];if(!pn)continue;const on=new Float32Array(16);i.br(on,Xt.projMatrix,Cr),Yt(Xt,Yr,pn,d.translatePosMatrix(on,lr,ht,St),Et)}}}function soe(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),J=De=>{const We=d.getSource().minzoom,st=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),fe=[(De,We)=>ue(De,We),(De,We)=>ue(We,De),(De,We)=>ce(De,We),(De,We)=>ce(We,De)],ke=(De,We,st,Ge,jt,gt,_t)=>{if(!O)return 0;const pt=[[gt?st:De,gt?De:st,0],[gt?st:We,gt?We:st,0]],ht=_t<0?i.al+_t:_t,St=[gt?ht:(De+We)/2,gt?(De+We)/2:ht,0];return st===0&&_t<0||st!==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 st=i.e9[De](p),Ge=J(st);if(!(Ge&&Ge instanceof i.ea))continue;const jt=O?O.findDEMTileFor(st):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||lr[0]>Yt[0]-3)break;Ge.showCentroid(Xt),ht++}if(Xt&&htYt[1]-3)&&(br++,++ht!==pt.length);)Xt=Ge.featuresOnBorder[pt[ht]];Xt=Ge.featuresOnBorder[pt[lr]];let Vt=!1;if(br>=1){const Kt=Xt.borders[gt];Math.abs(Yt[0]-Kt[0])<3&&Math.abs(Yt[1]-Kt[1])<3&&(br=1,Vt=!0,ht=lr+1)}else if(br===0){j.showCentroid(Rt);continue}const Et=Ge.centroidData[Xt.centroidDataIndex];R&&Vt&&(((_e=Dt).flags|(Re=Et).flags)&i.ec?(_e.flags|=i.ec,Re.flags|=i.ec):(_e.flags&=~i.ec,Re.flags&=~i.ec));const er=Rt.intersectsCount()>1||Xt.intersectsCount()>1;if(br>1)ht=lr,Dt.centroidXY=Et.centroidXY=new i.P(0,0);else if(jt&&jt.dem&&!er){const Kt=fe[De](Dt,Et),hr=De%2?i.al-1:0,Ir=ke(Kt[0],Math.min(i.al-1,Kt[1]),hr,jt,st,De<2,Kt[2]);Dt.centroidXY=Et.centroidXY=H(Ir)}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 _e,Re;(j.needsCentroidUpdate||!j.centroidVertexBuffer&&j.centroidVertexArray.length!==0)&&j.uploadCentroid(w)}const du=[1,0,0],R5=[0,1,0],jd=[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 _e=j.elevation.getMinMaxForTile(w);_e&&(B+=_e.max)}const H=[...E.shadowDirection];H[2]=-H[2];const J=E.computeSimplifiedTileShadowVolume(O,B,R,H);if(!J)return!1;const te=[du,R5,jd,H,[H[0],0,H[2]],[0,H[1],H[2]]],ue=j.projection.name==="globe",ce=j.scaleZoom(R),fe=i.cB.fromInvProjectionMatrix(j.invProjMatrix,j.worldSize,ce,!ue),ke=E.getCurrentCascadeFrustum();return fe.intersectsPrecise(J.vertices,J.planes,te)===0||ke.intersectsPrecise(J.vertices,J.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",J=d.shadowRenderer,te=i.ef(d.transform.center.lat,d.transform.zoom),ue=Yp(d,j.paint.get("building-cutoff-fade-range"));ue.shouldRenderCutoff&&(O=O.concat("RENDER_CUTOFF")),w.floodLightIntensity>0&&(O=O.concat("FLOOD_LIGHT"));for(const ce of E){const fe=p.getTile(ce),ke=fe.getBucket(j);if(!ke)continue;J&&J.getMaxCascadeForTile(ce.toUnwrapped())===0&&(O=O.concat("SHADOWS_SINGLE_CASCADE"));const _e=ke.programConfigurations.get(j.id);let Re,De,We,st=d.translatePosMatrix(ce.expandedProjMatrix,fe,[0,0],"map");if(st=i.cS(i.bC(),st,[1,1,w.verticalScale]),B&&J){if(Rf(fe.tileID,ke.maxHeight*te,d))continue;let jt=J.calculateShadowPassMatrixFromTile(fe.tileID.toUnwrapped());jt=i.cS(i.bC(),jt,[1,1,w.verticalScale]),We=ng(jt),Re=De=d.getOrCreateProgram("buildingDepth",{config:_e,defines:O,overrideFog:!1})}else if(H)Re=De=d.getOrCreateProgram("buildingBloom",{config:_e,defines:O,overrideFog:!1}),We=r6(st);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,Gn.disabled,w.blendMode,Vn.disabled,We,j.id,_t.layoutVertexBuffer,_t.indexBuffer,_t.segmentsBucket,j.paint,d.transform.zoom,_e,[_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,Gn.disabled,w.blendMode,B?Vn.disabled:Vn.backCW,We,j.id,jt.layoutVertexBuffer,jt.indexBuffer,_t,j.paint,d.transform.zoom,_e,pt)}};d.uploadCommonUniforms(R,De,ce.toUnwrapped(),null,ue),ke.buildingWithoutFacade&&Ge(ke.buildingWithoutFacade,De),ke.buildingWithFacade&&(Re!==De&&d.uploadCommonUniforms(R,Re,ce.toUnwrapped(),null,ue),Ge(ke.buildingWithFacade,Re))}}function wN(w,d,p,j,E,O,R,B,H,J,te,ue,ce){const fe=w.context.gl,ke=w.depthModeForSublayer(1,vn.ReadOnly,fe.LEQUAL,!0),_e=.1*(1-(Re=te))+3*Re;var Re;const De=w._showOverdrawInspector,We=ue,st=new D5;De||Df(st,w,d,p,j,ke,new Gn({func:fe.ALWAYS,mask:255},255,255,fe.KEEP,fe.KEEP,fe.REPLACE),new ps([fe.ONE,fe.ONE,fe.ONE,fe.ONE],i.ao.transparent,[!1,!1,!1,!0],fe.MIN),Vn.disabled,E,"sdf",O,R,B,H,J,_e,We,!1);{const Ge=De?Gn.disabled:new Gn({func:fe.EQUAL,mask:255},255,255,fe.KEEP,fe.DECR,fe.DECR),jt=De?w.colorModeForRenderPass():new ps([fe.ONE_MINUS_DST_ALPHA,fe.DST_ALPHA,fe.ONE,fe.ONE],i.ao.transparent,[!0,!0,!0,!0]);Df(st,w,d,p,j,ke,Ge,jt,Vn.disabled,E,"color",O,R,B,H,J,_e,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 J=j.getSource(),te=p.globeSharedBuffers;if(!te)return;let ue,ce,fe;if(d&&(ue=j.getTile(d)),J instanceof i.aU?(ce=J.texture,fe=i.dK(0,0,p.transform)):ue&&d&&(ce=ue.texture,fe=i.dK(d.canonical.z,d.canonical.x,p.transform)),!ce||!fe)return;w||(fe=i.cS(i.bC(),fe,[1,-1,1]));const ke=p.context,_e=ke.gl,Re=E.paint.get("raster-resampling")==="nearest"?_e.NEAREST:_e.LINEAR,De=p.colorModeForDrapableLayerRenderPass(O),We=R.defines;We.push("GLOBE_POLES");const st=new vn(_e.LEQUAL,vn.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(_e.TEXTURE0),ce.bind(Re,_e.CLAMP_TO_EDGE),ke.activeTexture.set(_e.TEXTURE1),ce.bind(Re,_e.CLAMP_TO_EDGE),"useMipmap"in ce&&ke.extTextureFilterAnisotropic&&p.transform.pitch>20&&_e.texParameterf(_e.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=((lr,br,Vt,Et,er,Kt,hr,Ir,Yr,Cr,wr,pn,on)=>a6(lr,br,Vt,new Float32Array(16),new Float32Array(9),[0,0],Et,[0,0],[0,0,0,0],1,{opacity:1,mix:0},Kt,[0,0],Ir,2,Cr,wr,pn,1,0,on))(Ge,jt,fe,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,_e.TRIANGLES,st,H,De,B,Yt,E.id,Rt,pt,ht)}function h6(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 Jy?d.getTextureDescriptor(w,p,!0):{texture:w.texture,mix:jN(j.mix),offset:j.offset,buffer:0,tileSize:1}}var ci=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 fe=i.bC();fe[12]+=2*E/(i.o.devicePixelRatio*H.width),fe[13]+=2*O/(i.o.devicePixelRatio*H.height),i.aB(ce,fe,ce);const ke=w.getOrCreateProgram("debug",{defines:ue}),_e=d.getTileByID(p.key);w.terrain&&w.terrain.setupElevationDraw(_e,ke);const Re=vn.disabled,De=Gn.disabled,We=w.colorModeForRenderPass(),st="$debug";B.activeTexture.set(J.TEXTURE0),w.emptyTexture.bind(J.LINEAR,J.CLAMP_TO_EDGE),te?_e._makeGlobeTileDebugBuffers(w.context,H):_e._makeDebugTileBoundsBuffers(w.context,H.projection);const Ge=_e._tileDebugBuffer||w.debugBuffer,jt=_e._tileDebugIndexBuffer||w.debugIndexBuffer,gt=_e._tileDebugSegments||w.debugSegments;if(ke.draw(w,J.LINE_STRIP,Re,De,We,Vn.disabled,Jv(ce,j.toPremultipliedRenderColor(null)),st,Ge,jt,gt,null,null,null,[_e._globeTileDebugBorderBuffer]),R){const Dt=_e.latestRawTileData,Yt=Math.floor((Dt&&Dt.byteLength||0)/1024);let Xt=p.canonical.toString();p.overscaledZ!==p.canonical.z&&(Xt+=` => ${p.overscaledZ}`),Xt+=` ${_e.state}`,Xt+=` ${Yt}kb`,function(lr,br){lr.initDebugOverlayCanvas();const Vt=lr.debugOverlayCanvas,Et=lr.context.gl,er=lr.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(br,5,5),er.strokeText(br,5,5),lr.debugOverlayTexture.update(Vt),lr.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=_e._tileDebugTextBuffer||w.debugBuffer,St=_e._tileDebugTextIndexBuffer||w.quadTriangleIndexBuffer,Rt=_e._tileDebugTextSegments||w.debugSegments;ke.draw(w,J.TRIANGLES,Re,De,ps.alphaBlended,Vn.disabled,Jv(ce,i.ao.transparent.toPremultipliedRenderColor(null),pt),st,ht,St,Rt,null,null,null,[_e._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 x6=i.ei([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:NN}=x6;function Fm(w,d,p,j){w.emplaceBack(d,p,j)}class SN{constructor(d){this.vertexArray=new i.em,this.indices=new i.b0,Fm(this.vertexArray,-1,-1,1),Fm(this.vertexArray,1,-1,1),Fm(this.vertexArray,-1,1,1),Fm(this.vertexArray,1,1,1),Fm(this.vertexArray,-1,-1,-1),Fm(this.vertexArray,1,-1,-1),Fm(this.vertexArray,-1,1,-1),Fm(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"),J=d.paint.get("sky-atmosphere-sun-intensity"),te=((ue,ce,fe,ke,_e)=>({u_matrix_3f:ue,u_sun_direction:ce,u_sun_intensity:fe,u_color_tint_r:[ke.r,ke.g,ke.b,ke.a],u_color_tint_m:[_e.r,_e.g,_e.b,_e.a],u_luminance:5e-5}))(i.eo(i.dO(),j),E,J,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,vn.disabled,Gn.disabled,ps.unblended,Vn.frontCW,te,"skyboxCapture",d.skyboxGeometry.vertexBuffer,d.skyboxGeometry.indexBuffer,d.skyboxGeometry.segment)}const y6=i.ei([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class y0{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,y6.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 aoe=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 ioe{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class v6{constructor(d){this.colorModeAlphaBlendedWriteRGB=new ps([1,Lm,1,Lm],i.ao.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new ps([1,0,1,0],i.ao.transparent,[!1,!1,!1,!0]),this.params=new ioe,this.updateNeeded=!0}update(d){const p=d.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new y0(p);const j=this.params.sizeRange,E=this.params.intensityRange,O=function(te){const ue=i.eq(30),ce=[];for(let fe=0;fe{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,lr,br,Vt,Et,er,Kt,hr,Ir,Yr)=>({u_frustum_tl:Dt,u_frustum_tr:Yt,u_frustum_br:Xt,u_frustum_bl:lr,u_horizon:br,u_transition:Vt,u_fadeout_range:Et,u_atmosphere_fog_color:er.toArray01(),u_high_color:Kt.toArray01(),u_space_color:hr.toArray01(),u_temporal_offset:Ir,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,Gn.disabled,_t?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,Vn.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 J=i.cc(new Float32Array(16),H),te=i.aB([],R.starsProjMatrix,J),ue=i.eo([],J),ce=i.eu([],ue),fe=[0,1,0];i.dQ(fe,fe,ce),i.c5(fe,fe,this.params.sizeMultiplier);const ke=[1,0,0];i.dQ(ke,ke,ce),i.c5(ke,ke,this.params.sizeMultiplier);const _e=(Re=fe,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,vn.disabled,Gn.disabled,this.colorModeAlphaBlendedWriteRGB,Vn.disabled,_e,"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 J=d.getTile(H);if(!J.hasData())continue;const te=J.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-J.tileID.z||H.tileID.x-J.tileID.x||H.tileID.y-J.tileID.y);for(const H of E){const J=new Array,te=new Array,ue=H.bucket;for(const ce of ue.featuresOnBorder)B.has(ce.featureId)?te.push(ce.footprintIndex):(B.add(ce.featureId),J.push(ce.footprintIndex));ue.updateFootprintHiddenFlags(J,i.ev,!1),ue.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:J,occlusionTexture:te,emissionTexture:ue}=O;function ce(ke,_e,Re){if(ke&&(w.push(_e),R.activeTexture.set(R.gl.TEXTURE0+Re),ke.gfxTexture)){const{minFilter:De,magFilter:We,wrapS:st,wrapT:Ge}=ke.sampler;ke.gfxTexture.bindExtraParam(De,We,st,Ge)}}ce(B,"HAS_TEXTURE_u_baseColorTexture",Pl.BaseColor),ce(H,"HAS_TEXTURE_u_metallicRoughnessTexture",Pl.MetallicRoughness),ce(J,"HAS_TEXTURE_u_normalTexture",Pl.Normal),ce(te,"HAS_TEXTURE_u_occlusionTexture",Pl.Occlusion),ce(ue,"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 fe=j.shadowRenderer;fe&&(w.push("RENDER_SHADOWS","DEPTH_TEXTURE"),fe.useNormalOffset&&w.push("NORMAL_OFFSET"))}function AN(w,d,p,j,E,O){const R=w.modelOpacity,B=d.context,H=new vn(d.context.gl.LEQUAL,w.isLightMesh?vn.ReadOnly:vn.ReadWrite,d.depthRangeFor3D),J=d.transform,te=w.mesh,ue=te.material,ce=ue.pbrMetallicRoughness,fe=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 _e=i.bl([],ke);i.eg(_e,_e);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(_e),null,d,R,ce.baseColorFactor,ue.emissiveFactor,ce.metallicFactor,ce.roughnessFactor,ue,De,p,void 0,void 0,w.materialOverride,w.modelColor),st={defines:[]},Ge=[],jt=d.shadowRenderer;jt&&(jt.useNormalOffset=!1),TN(st.defines,Ge,te,d,Re?null:p.lut);let gt=null;if(fe){const ht=MN(w.nodeModelMatrix,d.transform);if(gt=new Float32Array(ht),J.projection.name!=="globe"){const St=te.aabb.min,Rt=te.aabb.max,[Dt,Yt]=fe.getOpacityForBounds(ht,St[0],St[1],Rt[0],Rt[1]);st.overrideFog=Dt>=cr||Yt>=cr}}const _t=Yp(d,p.paint.get("model-cutoff-fade-range"));_t.shouldRenderCutoff&&st.defines.push("RENDER_CUTOFF");const pt=d.getOrCreateProgram("model",st);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?Vn.disabled:Vn.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,J){const te=w.transform,ue=!!d.isGeometryBloom&&d.isGeometryBloom;if(ue&&w.renderPass==="shadow")return;const ce=te.projection.name==="globe"?i.eD(p,te):[...p];i.aB(ce,ce,d.globalMatrix);const fe=i.aB([],j,ce);if(d.meshes)for(const ke of d.meshes){const _e=B.get(ke.material.name);if(_e&&_e.opacity<=0)continue;if(ke.material.alphaMode!=="BLEND"){R.push({mesh:ke,depth:0,modelIndex:E,worldViewProjection:fe,nodeModelMatrix:ce,isLightMesh:ue,materialOverride:_e,modelOpacity:H,modelColor:J});continue}const Re=i.af([],ke.centroid,fe);!te.isOrthographic&&Re[2]<=0||O.push({mesh:ke,depth:Re[2],modelIndex:E,worldViewProjection:fe,nodeModelMatrix:ce,isLightMesh:ue,materialOverride:_e,modelOpacity:H,modelColor:J})}if(d.children)for(const ke of d.children)Nx(w,ke,p,j,E,O,R,B,H,J)}function Yh(w,d,p,j){const E=p.shadowRenderer;if(!E)return;const O=E.getShadowPassDepthMode(),R=E.getShadowPassColorMode(),B=E.calculateShadowPassMatrixFromMatrix(d),H=P5(B);p.getOrCreateProgram("modelDepth",{defines:p._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(p,p.context.gl.TRIANGLES,O,Gn.disabled,R,Vn.disabled,H,j.id,w.vertexBuffer,w.indexBuffer,w.segments,j.paint,p.transform.zoom,void 0,void 0)}function _6(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},J={orientation:w.paint.get("model-rotation").evaluate(H,p)};O.set(R,J)}}function b6(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},J={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,J)}}function w6(w,d,p,j,E){let O=!1;for(const B of j)B.modelOpacity!==1&&(AN(B,w,d,E[B.modelIndex],Gn.disabled,ps.disabled),O=!0);for(const B of j)AN(B,w,d,E[B.modelIndex],B.modelOpacity!==1?w.stencilModeFor3D():Gn.disabled,w.colorModeForRenderPass());O&&w.resetStencilClippingMasks();const R=ps.additive;for(const B of p)AN(B,w,d,E[B.modelIndex],Gn.disabled,B.isLightMesh?R:w.colorModeForRenderPass())}function j6(w,d,p){const j=d.updateZoomBasedPaintProperties(),E=function(O,R,B){let H,J,te,ue=O.terrain?O.terrain.exaggeration():0;if(O.terrain&&ue>0){const ce=O.terrain,fe=ce.findDEMTileFor(B);fe&&fe.dem?H=i.eF.create(ce,B,fe):ue=0}if(ue===0&&(R.terrainElevationMin=0,R.terrainElevationMax=0),ue===R.validForExaggeration&&(ue===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 fe=R.instancesPerModel[ce];for(let ke=0;keJ&&(J=fe.max)}const te=i.aA(j.x,O,R)-j.x,ue=i.aA(j.y,B,H)-j.y,ce=i.cf(J,d.center.lat)-j.z;return d._zoomFromMercatorZ(Math.sqrt(te*te+ue*ue+ce*ce))}function k6(w,d,p,j,E,O,R){const B=w.context,H=w.renderPass==="shadow",J=w.shadowRenderer,te=H&&J?J.getShadowPassDepthMode():new vn(B.gl.LEQUAL,vn.ReadWrite,w.depthRangeFor3D),ue=w.isTileAffectedByFog(O),ce=w.transform.projection.name==="globe";if(p.meshes)for(const fe of p.meshes){const ke=ce?[]:["MODEL_POSITION_ON_GPU"],_e=[];let Re,De,We;const st=!ce&&j.instancedDataArray.length>20;st&&ke.push("INSTANCED_ARRAYS");const Ge=Yp(w,d.paint.get("model-cutoff-fade-range"));if(Ge.shouldRenderCutoff&&ke.push("RENDER_CUTOFF"),H&&J)Re=w.getOrCreateProgram("modelDepth",{defines:ke}),De=P5(R.shadowTileMatrix,R.shadowTileMatrix,Float32Array.from(p.globalMatrix)),We=J.getShadowPassColorMode();else{TN(ke,_e,fe,w,d.paint.get("model-color-use-theme").constantOr("default")==="none"?null:d.lut),Re=w.getOrCreateProgram("model",{defines:ke,overrideFog:ue});const gt=fe.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),J&&(R.shadowUniformsInitialized?Re.setShadowUniformValues(B,J.getShadowUniformValues()):(J.setupShadows(O.toUnwrapped(),Re,"model-tile"),R.shadowUniformsInitialized=!0)),We=Ge.shouldRenderCutoff||pt<1||gt.alphaMode!=="OPAQUE"?ps.alphaBlended:ps.unblended}w.uploadCommonUniforms(B,Re,O.toUnwrapped(),null,Ge);const jt=fe.material.doubleSided?Vn.disabled:Vn.backCCW;if(st)_e.push(j.instancedDataBuffer),Re.draw(w,B.gl.TRIANGLES,te,Gn.disabled,We,jt,De,d.id,fe.vertexBuffer,fe.indexBuffer,fe.segments,d.paint,w.transform.zoom,void 0,_e,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 J=i.aA(j[0],0,1),te=100*d.pixelsPerMeter*i.aA(j[1],0,1),ue=i.aA(j[2],0,1),ce=i.eH(i.eG(),B,H,J),fe=Math.tan(.5*d.fovX),ke=-ce[2]*fe;if(te===0)return ce[1]<-Math.abs(ke)?ue:1;const _e=(-Math.abs(ke)-ce[1])/te,Re=(We,st,Ge)=>(1-Ge)*We+Ge*st,De=i.aA(Re(1,ue,_e),ue,1);return Re(1,De,i.aA((d.pitch-20)/20,0,1))}class N6{}class ig{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(d,p,j){{const ue=this._storage.get(p.id);if(ue)return ue.lastUsedFrameIdx=d,ue.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 ue=0;ue30&&(j.buf.destroy(),this._storage.delete(p))}destroy(){for(const[d,p]of this._storage)p.buf.destroy(),this._storage.delete(d)}}class v0{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const _0=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 z5=i.ei([{type:"Float32",name:"a_pos_2f",components:2}]);class B5{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,z5.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,vn.disabled,Gn.disabled,ps.alphaBlended,Vn.disabled,R,"vignette",this.vignetteVx,this.vignetteIdx,E)}var O}}class $5{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,J=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 ue=-this._offsetYPrev+te,ce=-this._elevationPrev+E;this._accumulatedOffsetX+=(-this._offsetXPrev+J)*H,this._accumulatedOffsetY+=ue*H,this._accumulatedElevation+=ce*H,this._offsetXPrev=J,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),J=d.context,te=J.gl,ue=d.transform;this.screenTexture&&this.screenTexture.size[0]===d.width&&this.screenTexture.size[1]===d.height||(this.screenTexture=new i.T(J,{width:d.width,height:d.height,data:null},te.RGBA8)),O.distortionStrength>0&&(J.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(J,ce),J.activeTexture.set(te.TEXTURE0),this.screenTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE);const fe=[O.color.r,O.color.g,O.color.b,O.color.a],ke=(_e,Re)=>{const De=EN(this._movement.getPosition(),_e),We=O.dropletSizeX,st=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:_e,rainDropletSize:[We,st],distortionStrength:O.distortionStrength,rainDirection:R,color:fe,screenSize:[ue.width,ue.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,vn.disabled,Gn.disabled,ps.alphaBlended,Vn.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 U5=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 q5 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 J=d.context,te=J.gl,ue=d.transform,ce=d.getOrCreateProgram("snowParticle");d.uploadCommonUniforms(J,ce),((fe,ke,_e)=>{const Re=EN(this._movement.getPosition(),fe),De=ue.width/2,We=ue.height/2,st=Kd(0,_e.screenThinning.start,0,1,_e.screenThinning.intensity),Ge=Kd(.001,_e.screenThinning.range,0,1,_e.screenThinning.intensity),jt=Kd(0,_e.screenThinning.particleOffset,0,1,_e.screenThinning.intensity),gt=(_t={modelview:H.modelviewMatrix,projection:H.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:Re,velocityConeAperture:_e.velocityConeAperture,velocity:_e.velocity,horizontalOscillationRadius:_e.horizontalOscillationRadius,horizontalOscillationRate:_e.horizontalOscillationRate,boxSize:fe,billboardSize:1*_e.billboardSize,simpleShapeParameters:[_e.shapeFadeStart,_e.shapeFadePower],screenSize:[ue.width,ue.height],thinningCenterPos:[De,We],thinningShape:[st,Ge,Math.pow(10,_e.screenThinning.fadePower)],thinningAffectedRatio:_e.screenThinning.affectedRatio,thinningParticleOffset:jt,color:[_e.color.r,_e.color.g,_e.color.b,_e.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(_e.intensity*this.particlesCount),ht=i.bg.simpleSegment(0,0,4*pt,2*pt);this.particlesVx&&this.particlesIdx&&ce.draw(d,te.TRIANGLES,vn.disabled,Gn.disabled,ps.alphaBlended,Vn.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=Gn.disabled,R=w.colorModeForRenderPass(),B=p.layout.get("text-variable-anchor"),H=p.layout.get("text-size-scale-range"),J=i.aA(w.scaleFactor,H[0],H[1]);B&&function(ce,fe,ke,_e,Re,De,We,st){const Ge=fe.transform,jt=Re==="map",gt=De==="map";for(const _t of ce){const pt=_e.getTile(_t),ht=pt.getBucket(ke);if(!ht||!ht.text||!ht.text.segments.get().length)continue;const St=i.bK(ht.textSizeData,Ge.zoom,st),Rt=Pr(_t,ht.getProjection(),Ge),Dt=Ge.calculatePixelsToTileUnitsMatrix(pt),Yt=ja(Rt,pt.tileID.canonical,gt,jt,Ge,ht.getProjection(),Dt),Xt=ht.hasIconTextFit()&&ht.hasIconData();St&&Pn(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,J);const te=p.paint.get("icon-opacity").constantOr(1)!==0,ue=p.paint.get("text-opacity").constantOr(1)!==0;p.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(te||ue)?r_(w,d,p,j,O,R):(te&&r_(w,d,p,j,O,R,{onlyIcons:!0}),ue&&r_(w,d,p,j,O,R,{onlyText:!0})),d.map.showCollisionBoxes&&(sn(w,d,p,j,p.paint.get("text-translate"),p.paint.get("text-translate-anchor"),!0),sn(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 J=w.context,te=J.gl,ue=w.transform,ce=!(!w.terrain||!w.terrain.enabled),fe=p.layout.get("circle-elevation-reference"),ke=w.depthModeForSublayer(0,vn.ReadOnly),_e=new vn(w.context.gl.LEQUAL,vn.ReadOnly,w.depthRangeFor3D),Re=fe==="none"||ce?ke:_e,De=Gn.disabled,We=w.colorModeForDrapableLayerRenderPass(H),st=ue.projection.name==="globe",Ge=[i.aF(ue.center.lng),i.aJ(ue.center.lat)],jt=[];for(let _t=0;_t_t.sortKey-pt.sortKey);const gt={useDepthForOcclusion:ue.depthOcclusionForSymbolsAndCircles};for(const _t of jt){const{programConfiguration:pt,program:ht,layoutVertexBuffer:St,dynamicBuffers:Rt,indexBuffer:Dt,uniformValues:Yt,tile:Xt}=_t.state,lr=_t.segments;w.terrain&&w.terrain.setupElevationDraw(Xt,ht,gt),w.uploadCommonUniforms(J,ht,Xt.tileID.toUnwrapped()),ht.draw(w,te.TRIANGLES,Re,De,We,Vn.disabled,Yt,p.id,St,Dt,lr,p.paint,ue.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=Gn.disabled,B=new ps([O.ONE,O.ONE,O.ONE,O.ONE],i.ao.transparent,[!0,!0,!0,!0]);(function(fe,ke,_e,Re){const De=fe.gl,We=ke.width*Re,st=ke.height*Re;fe.activeTexture.set(De.TEXTURE1),fe.viewport.set([0,0,We,st]);let Ge=_e.heatmapFbo;if(!Ge||Ge&&(Ge.width!==We||Ge.height!==st)){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=_e.heatmapFbo=fe.createFramebuffer(We,st,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)}(fe,0,jt,Ge,We,st)}else De.bindTexture(De.TEXTURE_2D,Ge.colorAttachment0.get()),fe.bindFramebuffer.set(Ge.framebuffer)})(E,w,p,w.transform.projection.name==="globe"?.5:.25),E.clear({color:i.ao.transparent});const H=w.transform,J=H.projection.name==="globe",te=J?["PROJECTION_GLOBE_VIEW"]:[],ue=J?Vn.frontCCW:Vn.disabled,ce=[i.aF(H.center.lng),i.aJ(H.center.lat)];for(let fe=0;fe({u_image:0,u_color_ramp:1,u_opacity:ue.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"),J=p.layout.get("line-elevation-reference"),te=p.layout.get("line-width-unit")==="meters",ue=J==="sea",ce=!(!w.terrain||!w.terrain.enabled),fe=w.context,ke=fe.gl;if(p.hasElevatedBuckets&&w.transform.projection.name==="globe")return;const _e=p.layout.get("line-cross-slope"),Re=_e!==void 0,De=_e<1,We=w.colorModeForDrapableLayerRenderPass(R?B:null),st=w.terrain&&w.terrain.renderingToTexture,Ge=st?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 lr=!Rt&&Xt!==1||w.depthOcclusion&&H>0&&H<1;const br=p.paint.get("line-gradient"),Vt=Rt?"linePattern":"line",Et=i.e2(p);let er;if(st&&w.terrain&&w.terrain.clipOrMaskOverlapStencilType()&&(lr=!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"),st&&(w.emissiveMode!=="dual-source-blending"||R?w.emissiveMode==="mrt-fallback"&&Et.push("USE_MRT1"):Et.push("DUAL_SOURCE_BLENDING"));const Kt=(Yr,Cr,wr,pn,on,Vr)=>{for(const Qr of Yr){const Tn=d.getTile(Qr);if(Rt&&!Tn.patternsLoaded())continue;const ss=Tn.getBucket(p);if(!ss||ss.elevationType!=="none"&&!on||ss.elevationType==="none"&&on)continue;w.prepareDrawTile();const Gs=[...Cr],Na=w.shadowRenderer,yn=ss.elevationType==="road"&&!!Na&&Na.enabled;let fa=[0,0,0];if(yn){const xs=w.style.directionalLight,xi=w.style.ambientLight;xs&&xi&&(fa=Pf(w.style,xs,xi)),Gs.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const es=ss.programConfigurations.get(p.id);let Ta=!1;if(Yt&&Tn.imageAtlas){const xs=i.e3.from(Yt),xi=xs.getPrimary().scaleSelf(Ge).toString(),ho=Tn.imageAtlas.patternPositions.get(xi),qi=xs.getSecondary(),ei=qi?Tn.imageAtlas.patternPositions.get(qi.scaleSelf(Ge).toString()):null;Ta=!!ho&&!!ei,ho&&es.setConstantPatternPositions(ho,ei)}Dt>0&&(Ta||es.getPatternTransitionVertexBuffer("line-pattern"))&&Gs.push("LINE_PATTERN_TRANSITION");const Va=w.isTileAffectedByFog(Qr),Ra=w.getOrCreateProgram(Vt,{config:es,defines:Gs,overrideFog:Va});if(!Rt&&pt&&ht&&Tn.lineAtlas){const xs=Tn.lineAtlas.getDash(pt,ht);xs&&es.setConstantPatternPositions(xs)}yn&&Na.setupShadows(Tn.tileID.toUnwrapped(),Ra,"vector-tile");let[ha,gs]=p.paint.get("line-trim-offset");(ht==="round"||ht==="square")&&ha!==gs&&(ha===0&&(ha-=1),gs===1&&(gs+=1));const Ma=st?Qr.projMatrix:null,Zi=te?1/ss.tileToMeter/i.ay(Tn,1,w.transform.zoom):1,Ci=te?1/ss.tileToMeter/i.ay(Tn,1,Math.floor(w.transform.zoom)):1,Aa=Rt?i.e4(w,Tn,p,Ma,Ge,Zi,Ci,[ha,gs],fa,Dt):i.e5(w,Tn,p,Ma,ss.lineClipsArray.length,Ge,Zi,Ci,[ha,gs],fa);if(br){const xs=ss.gradients[p.id];let xi=xs.texture;if(p.gradientVersion!==xs.version){let ho=256;if(p.stepInterpolant){const qi=d.getSource().maxzoom,ei=Qr.canonical.z===qi?Math.ceil(1<{er!=null&&(er.value=Xt*H),Ra.draw(w,ke.TRIANGLES,wr,xs,We,Vn.disabled,Aa,p.id,ss.layoutVertexBuffer,ss.indexBuffer,ss.segments,p.paint,w.transform.zoom,es,[ss.layoutVertexBuffer2,ss.patternVertexBuffer,ss.zOffsetVertexBuffer]),er!=null&&(er.value=Xt)};if(lr&&!on){const xs=w.stencilModeForClipping(Qr).ref;xs===0&&st&&fe.clear({stencil:0});const xi={func:ke.EQUAL,mask:255};Aa.u_alpha_discard_threshold=.8,oa(new Gn(xi,xs,255,ke.KEEP,ke.KEEP,ke.INVERT)),Aa.u_alpha_discard_threshold=0,oa(new Gn(xi,xs,255,ke.KEEP,ke.KEEP,ke.KEEP))}else Aa.u_alpha_discard_threshold=lr&&on&&Vr?.8:0,oa(on?pn:w.stencilModeForClipping(Qr))}};let hr=w.depthModeForSublayer(0,vn.ReadOnly);const Ir=new vn(w.depthOcclusion?ke.GREATER:ke.LEQUAL,vn.ReadOnly,w.depthRangeFor3D);if(p.hasNonElevatedBuckets){const Yr=!st&&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,hr,Gn.disabled,!1,!0)}if(p.hasElevatedBuckets){J==="hd-road-markup"?ce||(hr=Ir,Et.push("ELEVATED_ROADS")):(Et.push("ELEVATED"),hr=Ir,Re&&Et.push(De?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),ue&&Et.push("ELEVATION_REFERENCE_SEA"));const Yr=lr?w.stencilModeFor3D():Gn.disabled;w.forceTerrainMode=!0,Kt(j,Et,hr,Yr,!0,!0),lr&&Kt(j,Et,hr,Yr,!0,!1),w.forceTerrainMode=!1}lr&&(w.resetStencilClippingMasks(),st&&fe.clear({stencil:0})),H===0||w.depthOcclusion||st||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"),J=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 ue=!(!w.terrain||!w.terrain.enabled),ce={painter:w,sourceCache:d,layer:p,coords:j,colorMode:B,elevationType:te,terrainEnabled:ue,pass:J};if(w.renderPass==="shadow")return void(w.shadowRenderer&&te==="road"&&!ue&&function(ke){const{painter:_e,sourceCache:Re,layer:De,coords:We}=ke,st=_e.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;_e.prepareDrawTile();const ht=_t.bufferData.programConfigurations.get(De.id),St=_e.isTileAffectedByFog(jt),Rt=_e.getOrCreateProgram("elevatedStructuresDepth",{config:ht,overrideFog:St}),Dt=Ge.calculateShadowPassMatrixFromTile(gt.tileID.toUnwrapped());_e.uploadCommonUniforms(_e.context,Rt,jt.toUnwrapped());const Yt={u_matrix:Dt,u_depth_bias:0};Rt.draw(_e,st.TRIANGLES,Ge.getShadowPassDepthMode(),Gn.disabled,Ge.getShadowPassColorMode(),Vn.disabled,Yt,De.id,pt.vertexBuffer,pt.indexBuffer,pt.shadowCasterSegments,De.paint,_e.transform.zoom,ht)}}(ce));const fe=w.emissiveMode==="mrt-fallback";if(te!=="offset"){if(_N(ce,!1,fe),te==="road"){const ke=!ue&&w.renderPass==="translucent";ke&&vN(w,d,p,j,"geometry"),_N(ce,!0,fe,Gn.disabled),ke&&function(_e){const{painter:Re,sourceCache:De,layer:We,coords:st,colorMode:Ge}=_e,jt=Re.context.gl,gt=_e.painter.shadowRenderer,_t=!!gt&>.enabled,pt=new vn(Re.context.gl.LEQUAL,vn.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 st){const Yt=De.getTile(Dt),Xt=Yt.getBucket(We);if(!Xt)continue;const lr=Xt.elevatedStructures;if(!lr)continue;let br,Vt;if(Rt?(br=lr.renderableBridgeSegments,Vt=lr.bridgeProgramConfigurations.get(We.id)):(br=lr.renderableTunnelSegments,Vt=lr.tunnelProgramConfigurations.get(We.id)),!br||br.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}),hr=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 Ir=rg(hr,ht);Re.uploadCommonUniforms(Re.context,Kt,Dt.toUnwrapped()),Kt.draw(Re,jt.TRIANGLES,pt,Gn.disabled,Ge,Vn.backCCW,Ir,We.id,lr.vertexBuffer,lr.indexBuffer,br,We.paint,Re.transform.zoom,Vt,[lr.vertexBufferNormal])}};St(!0),St(!1)}(ce)}}else _N(ce,!1,fe,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 J=w.emissiveMode==="mrt-fallback",te=w.conflationActive&&w.style.isLayerClipped(p,d.getSource()),ue=w.style.order.indexOf(p.fqid);if(te&&function(ce,fe,ke,_e,Re){for(const De of _e){const We=fe.getTile(De).getBucket(ke);We&&(We.updateReplacement(De,ce.replacementSource,Re),We.uploadCentroid(ce.context))}}(w,d,p,j,ue),B||te)for(const ce of j){const fe=d.getTile(ce).getBucket(p);fe&&soe(w.context,d,ce,fe,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 fe=ce.getShadowPassDepthMode(),ke=ce.getShadowPassColorMode();bN(w,d,p,j,fe,Gn.disabled,ke,te)}else if(w.renderPass==="translucent"){const ce=!p.paint.get("fill-extrusion-pattern").constantOr(1),fe=p.paint.get("fill-extrusion-color").constantOr(i.ao.white);if(!H&&fe.a!==0){const ke=new vn(w.context.gl.LEQUAL,vn.ReadWrite,w.depthRangeFor3D);E===1&&ce?bN(w,d,p,j,ke,Gn.disabled,ps.unblended,te):(bN(w,d,p,j,ke,Gn.disabled,ps.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"),_e=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",st=p.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(We?null:p.lut).toArray01().slice(0,3),Ge=_e>0&&Re>0,jt=De>0,gt=(ht,St,Rt)=>(1-Rt)*ht+Rt*St,_t=new D5;_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,vn.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 Gn({func:R.ALWAYS,mask:255},255,255,R.KEEP,R.KEEP,R.REPLACE),lr=new ps([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,lr,Vn.disabled,ht,"sdf",ke,_e,Re,De,st,Dt,te,!1)}{const Xt=Yt?Gn.disabled:new Gn({func:R.EQUAL,mask:255},255,255,R.KEEP,R.DECR,R.DECR),lr=Yt?w.colorModeForRenderPass():new ps([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,lr,Vn.disabled,ht,"color",ke,_e,Re,De,st,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,vn.ReadOnly,R.LEQUAL,!1),lr=p.paint.get(Rt?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),br=gt(.1,3,lr);{const Vt=new ps([R.ONE,R.ONE,R.ONE,R.ONE],i.ao.transparent,[!1,!1,!1,!0]);Df(_t,w,d,p,j,Xt,Gn.disabled,Vt,Vn.disabled,Rt,"clear",ke,_e,Re,De,st,br,te,Dt)}{const Vt=new Gn({func:R.ALWAYS,mask:255},255,255,R.KEEP,R.KEEP,R.REPLACE),Et=new ps([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,Vn.disabled,Rt,"sdf",ke,_e,Re,De,st,br,te,Dt)}J&&!Rt&&(Yt=ht());{const Vt=Rt?R.ZERO:R.ONE_MINUS_DST_ALPHA,Et=new Gn({func:R.EQUAL,mask:255},255,255,R.KEEP,R.DECR,R.DECR),er=new ps([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,Vn.disabled,Rt,"color",ke,_e,Re,De,st,br,te,Dt)}if(!J||Rt){const Vt=new ps([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,Gn.disabled,Vt,Vn.disabled,Rt,"clear",ke,_e,Re,De,st,br,te,Dt,Yt)}else{R.drawBuffers([R.NONE,R.COLOR_ATTACHMENT1]);const Vt=new Gn({func:R.EQUAL,mask:255},254,255,R.KEEP,R.DECR,R.DECR),Et=new ps([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,Vn.disabled,Rt,"emissive",ke,_e,Re,De,st,br,te,Dt,Yt),R.drawBuffers([R.COLOR_ATTACHMENT0])}};if(Ge||jt){let Rt;w.prepareDrawTile(),J&&!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,J=!0;const te=p.paint.get("building-vertical-scale");if(te<=0)return;w.shadowRenderer||(J=!1);const ue=w.conflationActive&&w.style.isLayerClipped(p,d.getSource()),ce=w.style.order.indexOf(p.fqid);if(function(fe,ke,_e,Re,De,We){for(const st of We){const Ge=ke.getTile(st).getBucket(_e);Ge&&(De&&Ge.updateReplacement(st,fe.replacementSource,Re),Ge.uploadUpdatedIndexBuffer(fe.context))}}(w,d,p,ce,ue,j),function(fe,ke,_e,Re){for(const De of Re){const We=ke.getTile(De).getBucket(_e);We&&We.needsEvaluation()&&We.uploadUpdatedColorBuffer(fe.context)}}(w,d,p,j),p.resetLayerRenderingStats(w),w.shadowRenderer&&(w.shadowRenderer.useNormalOffset=!0),w.renderPass==="shadow"&&w.shadowRenderer){const fe=w.shadowRenderer,ke=[],_e=fe.getShadowPassDepthMode();n_({painter:w,source:d,layer:p,coords:j,defines:ke,blendMode:fe.getShadowPassColorMode(),depthMode:_e,opacity:B,verticalScale:te,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(w.renderPass==="translucent"){let fe=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];J&&(fe=fe.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),w.shadowRenderer&&w.shadowRenderer.useNormalOffset&&(fe=fe.concat("NORMAL_OFFSET"));const ke=p.paint.get("building-facade-emissive-chance"),_e=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),st=p.paint.get("building-flood-light-ground-attenuation"),Ge=Re>0,jt=new vn(w.context.gl.LEQUAL,vn.ReadWrite,w.depthRangeFor3D);B<1&&n_({painter:w,source:d,layer:p,coords:j,defines:fe,blendMode:ps.disabled,depthMode:jt,opacity:B,verticalScale:te,facadeEmissiveChance:ke,facadeAOIntensity:_e,floodLightIntensity:Re,floodLightColor:We,depthOnly:!0});const gt=w.colorModeForRenderPass();n_({painter:w,source:d,layer:p,coords:j,defines:fe,blendMode:gt,depthMode:jt,opacity:B,verticalScale:te,facadeEmissiveChance:ke,facadeAOIntensity:_e,floodLightIntensity:Re,floodLightColor:We}),H&&wN(w,d,p,j,!0,B,E,O,Re,We,R,ue),Ge&&wN(w,d,p,j,!1,B,E,O,Re,We,st,ue)}else if(w.renderPass==="light-beam"){const fe=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],ke=new vn(w.context.gl.LEQUAL,vn.ReadOnly,w.depthRangeFor3D);n_({painter:w,source:d,layer:p,coords:j,defines:fe,blendMode:ps.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 J=d.getTile(H);if(J.needsHillshadePrepare&&w.renderPass==="offscreen")Kie(w,J,p);else if(w.renderPass==="translucent"){const te=w.depthModeForSublayer(0,vn.ReadOnly),ue=p.paint.get("hillshade-emissive-strength"),ce=w.colorModeForDrapableLayerRenderPass(ue),fe=O&&w.terrain?w.terrain.stencilModeForRTTOverlap(H):R[H.overscaledZ];Gie(w,H,J,p,te,fe,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 J=w.context,te=J.gl,ue=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"),lr=_t.paint.get("raster-color-mix");let br=_t.paint.get("raster-color-range");const Vt=[lr[0],lr[1],lr[2],0],Et=lr[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,!br&>.rasterLayers)){const Kt=gt.rasterLayers.find(({id:hr})=>hr===_t.sourceLayer);Kt&&Kt.fields&&Kt.fields.range&&(br=Kt.fields.range)}if(br=br||[0,1],Rt){Yt.push("RASTER_COLOR"),pt.activeTexture.set(ht.TEXTURE2),_t.updateColorRamp(br);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:br,offset:Et,defines:Yt,resampling:er}}(ue,p,J,te,w.terrain&&w.terrain.renderingToTexture&&w.emissiveMode==="mrt-fallback");if(ue instanceof i.aU&&!j.length&&!R)return;const fe=p.paint.get("raster-emissive-strength"),ke=w.colorModeForDrapableLayerRenderPass(fe),_e=w.terrain&&w.terrain.renderingToTexture,Re=!w.options.moving,De=p.paint.get("raster-resampling")==="nearest"?te.NEAREST:te.LINEAR;if(ue instanceof i.aU&&!j.length&&(ue.onNorthPole||ue.onSouthPole)){const gt=B?w.stencilModeFor3D():Gn.disabled;return void s_(!!ue.onNorthPole,null,w,d,p,fe,ce,Vn.disabled,gt)}if(!j.length)return;const[We,st]=ue instanceof i.aU||_e?[{},j]:w.stencilConfigForOverlap(j),Ge=st[st.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(_e&&(!Rt||!Rt.hasData()))continue;J.activeTexture.set(te.TEXTURE0);const Dt=Ff(Rt,ue,p,ce);if(!Dt||!Dt.texture)continue;const{texture:Yt,mix:Xt,offset:lr,tileSize:br,buffer:Vt}=Dt;let Et,er;_e?(Et=vn.disabled,er=ht.projMatrix):B?(Et=new vn(te.LEQUAL,vn.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?vn.ReadWrite:vn.ReadOnly,te.LESS),er=w.transform.calculateProjMatrix(St,Re));const Kt=w.terrain&&_e?w.terrain.stencilModeForRTTOverlap(ht):We[ht.overscaledZ],hr=O?0:p.paint.get("raster-fade-duration");Rt.registerFadeDuration(hr);const Ir=d.findLoadedParent(ht,0),Yr=Qv(Rt,Ir,d,w.transform,hr);let Cr,wr;!Yr.isFading&&Rt.refreshedUponExpiration&&(Rt.refreshedUponExpiration=!1),w.terrain&&w.terrain.prepareDrawTile(),J.activeTexture.set(te.TEXTURE0),Yt.bind(De,te.CLAMP_TO_EDGE),J.activeTexture.set(te.TEXTURE1),Ir?(Ir.texture&&Ir.texture.bind(De,te.CLAMP_TO_EDGE),Cr=Math.pow(2,Ir.tileID.overscaledZ-Rt.tileID.overscaledZ),wr=[Rt.tileID.canonical.x*Cr%1,Rt.tileID.canonical.y*Cr%1]):Yt.bind(De,te.CLAMP_TO_EDGE),"useMipmap"in Yt&&J.extTextureFilterAnisotropic&&w.transform.pitch>20&&te.texParameterf(te.TEXTURE_2D,J.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,J.extTextureFilterAnisotropicMax);const pn=w.transform;let on;const Vr=B?h6(pn):[0,0,0,0];let Qr,Tn,ss,Gs,Na,yn=0;if(H&&ue instanceof i.aU&&ue.coordinates.length>3)Qr=Float32Array.from(i.bk(i.dJ(new i.cD(0,0,0)))),Tn=Float32Array.from(pn.globeMatrix),ss=Float32Array.from(i.dF(pn)),Gs=[i.aF(pn.center.lng),i.aJ(pn.center.lat)],on=ue.elevatedGlobePerspectiveTransform,Na=ue.elevatedGlobeGridMatrix||new Float32Array(9);else if(H){const Va=i.dG(ht.canonical);yn=i.dH(Va.getCenter().lat),Qr=Float32Array.from(i.bk(i.dJ(ht.canonical))),Tn=Float32Array.from(pn.globeMatrix),ss=Float32Array.from(i.dF(pn)),Gs=[i.aF(pn.center.lng),i.aJ(pn.center.lat)],on=[0,0],Na=Float32Array.from(i.dI(ht.canonical,Va,yn,pn.worldSize/pn._pixelsPerMercatorPixel))}else on=ue instanceof i.aU?ue.perspectiveTransform:[0,0],Qr=new Float32Array(16),Tn=new Float32Array(9),ss=new Float32Array(16),Gs=[0,0],Na=new Float32Array(9);const fa=a6(er,Qr,Tn,ss,Na,wr||[0,0],i.aj(w.transform.zoom),Gs,Vr,Cr||1,Yr,p,on,B?p.paint.get("raster-elevation"):0,2,Xt,lr,ce.range,br,Vt,fe),es=w.isTileAffectedByFog(ht),Ta=w.getOrCreateProgram("raster",{defines:ce.defines,overrideFog:es});if(w.uploadCommonUniforms(J,Ta,St),ue instanceof i.aU){const Va=ue.elevatedGlobeVertexBuffer,Ra=ue.elevatedGlobeIndexBuffer;if(_e||!R)ue.boundsBuffer&&ue.boundsSegments&&Ta.draw(w,te.TRIANGLES,Et,Gn.disabled,ke,Vn.disabled,fa,p.id,ue.boundsBuffer,w.quadTriangleIndexBuffer,ue.boundsSegments);else if(Va&&Ra){const ha=pn.zoom<=i.c_?ue.elevatedGlobeSegments:ue.getSegmentsForLongitude(pn.center.lng);ha&&Ta.draw(w,te.TRIANGLES,Et,Gn.disabled,ke,_t,fa,p.id,Va,Ra,ha)}}else if(H){Et=new vn(te.LEQUAL,vn.ReadOnly,w.depthRangeFor3D);const Va=w.globeSharedBuffers;if(Va){const[Ra,ha,gs]=Va.getGridBuffers(yn,!1);Ta.draw(w,te.TRIANGLES,Et,pt||Kt,w.colorModeForRenderPass(),_t,fa,p.id,Ra,ha,gs)}}else{const{tileBoundsBuffer:Va,tileBoundsIndexBuffer:Ra,tileBoundsSegments:ha}=w.getTileBoundsBuffers(Rt);Ta.draw(w,te.TRIANGLES,Et,Kt,ke,Vn.disabled,fa,p.id,Va,Ra,ha)}}if(!(ue 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 hr=Ge.getTile(St?Kt.wrapped():Kt);if(!hr)continue;const Ir=hr.rasterParticleState;if(!Ir)continue;const Yr=Kt.canonical.x+(1<_t.tileID)),fe&&(J.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(st,{overrideFog:!1,overrideRtt:!0,defines:gt}),pt=new Float32Array(i.bA([])),ht=new i.aQ(0,0,0,0,0),St=fe?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,Vn.disabled,St,p.id,w.viewportBuffer,w.quadTriangleIndexBuffer,w.viewportSegments)}else for(const _t of jt){const pt=w.isTileAffectedByFog(_t),ht=w.getOrCreateProgram(st,{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,ue.zoom,w),Yt=fe?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(J,ht,St);const{tileBoundsBuffer:Xt,tileBoundsIndexBuffer:lr,tileBoundsSegments:br}=w.getTileBoundsBuffers(Dt);ht.draw(w,te.TRIANGLES,De,Re,We,Vn.disabled,Yt,p.id,Xt,lr,br)}},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 vn(O.gl.LEQUAL,vn.ReadOnly,[0,1]),H=w.frameCounter/1e3%1;R==="atmosphere"?w.renderPass==="offscreen"?p.needsSkyboxCapture(w)&&(function(J,te,ue,ce){const fe=J.context,ke=fe.gl;let _e=te.skyboxFbo;if(!_e){_e=te.skyboxFbo=fe.createFramebuffer(32,32,1,null),te.skyboxGeometry=new SN(fe),te.skyboxTexture=fe.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 st=0;st<6;++st)ke.texImage2D(ke.TEXTURE_CUBE_MAP_POSITIVE_X+st,0,ke.RGBA,32,32,0,ke.RGBA,ke.UNSIGNED_BYTE,null)}fe.bindFramebuffer.set(_e.framebuffer),fe.viewport.set([0,0,32,32]);const Re=te.getCenter(J,!0),De=J.getOrCreateProgram("skyboxCapture"),We=new Float64Array(16);i.bA(We),i.en(We,We,.5*-Math.PI),kx(J,te,De,We,Re,0),i.bA(We),i.en(We,We,.5*Math.PI),kx(J,te,De,We,Re,1),i.bA(We),i.cU(We,We,.5*-Math.PI),kx(J,te,De,We,Re,2),i.bA(We),i.cU(We,We,.5*Math.PI),kx(J,te,De,We,Re,3),i.bA(We),kx(J,te,De,We,Re,4),i.bA(We),i.en(We,We,Math.PI),kx(J,te,De,We,Re,5),fe.viewport.set([0,0,J.width,J.height])}(w,p),p.markSkyboxValid(w)):w.renderPass==="sky"&&function(J,te,ue,ce,fe){const ke=J.context,_e=ke.gl,Re=J.transform,De=J.getOrCreateProgram("skybox");ke.activeTexture.set(_e.TEXTURE0),_e.bindTexture(_e.TEXTURE_CUBE_MAP,te.skyboxTexture);const We=((st,Ge,jt,gt,_t)=>({u_matrix:st,u_sun_direction:Ge,u_cubemap:0,u_opacity:gt,u_temporal_offset:_t}))(Re.skyboxMatrix,te.getCenter(J,!1),0,ce,fe);J.uploadCommonUniforms(ke,De),De.draw(J,_e.TRIANGLES,ue,Gn.disabled,J.colorModeForRenderPass(),Vn.backCW,We,"skybox",te.skyboxGeometry.vertexBuffer,te.skyboxGeometry.indexBuffer,te.skyboxGeometry.segment)}(w,p,B,E,H):R==="gradient"&&w.renderPass==="sky"&&function(J,te,ue,ce,fe){const ke=J.context,_e=ke.gl,Re=J.transform,De=J.getOrCreateProgram("skyboxGradient");te.skyboxGeometry||(te.skyboxGeometry=new SN(ke)),ke.activeTexture.set(_e.TEXTURE0);let We=te.colorRampTexture;We||(We=te.colorRampTexture=new i.T(ke,te.colorRamp,_e.RGBA8)),We.bind(_e.LINEAR,_e.CLAMP_TO_EDGE);const st=((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(J,!1),te.paint.get("sky-gradient-radius"),ce,fe);J.uploadCommonUniforms(ke,De),De.draw(J,_e.TRIANGLES,ue,Gn.disabled,J.colorModeForRenderPass(),Vn.backCW,st,"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,J={x:H.x+j[0].wrap*(O.wrapTileId?0:1<{J&&(J.useNormalOffset=!0,te||(J.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"],lr=Object.assign({},gt.layout.get("model-id").parameters),br=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)lr.zoom=Et.overscaledZ;else{const Vr=kd(Et,ht);lr.zoom=Vr}const hr=Xt.possiblyEvaluate(lr);if(j6(Ge,er,Et),zm.shadowUniformsInitialized=!1,zm.useSingleShadowCascade=!!Yt&&Yt.getMaxCascadeForTile(Et.toUnwrapped())===0,Ge.renderPass==="shadow"&&Yt){if(Ge.currentShadowCascade===1&&er.isInsideFirstShadowMapFrustum)continue;const Vr=ht.calculatePosMatrix(Et.toUnwrapped(),ht.worldSize);if(zm.tileMatrix.set(Vr),zm.shadowTileMatrix=Float32Array.from(Yt.calculateShadowPassMatrixFromMatrix(Vr)),zm.aabb.min=[0,0,0],zm.aabb.max[0]=zm.aabb.max[1]=i.al,zm.aabb.max[2]=0,ooe(er,zm,Ge,gt.scope))continue}const Ir=1<0&&Ge.style.isLayerClipped(gt,jt.getSource())&&er.updateReplacement(Et,Ge.replacementSource,br,gt.scope)&&(er.uploaded=!1,er.upload(Ge.context));let Cr=0;const wr=new Array,pn=new Array,on=new Array;for(let Vr in er.instancesPerModel){const Qr=er.instancesPerModel[Vr];Qr.features.length>0&&!St&&(Vr=hr.evaluate(Qr.features[0].feature,{}));const Tn=Dt.getModel(Vr,pt);if(Tn||Dt.hasURLBeenRequested(Vr)||er.modelUris.includes(Vr)||(er.modelUris.push(Vr),er.modelsRequested=!1),Tn&&Tn.uploaded)if(St){const ss=i.c5([],[Rt.x,Rt.y,Rt.z],Ge.transform.worldSize);i.ew(ss,ss);for(let Gs=0;Gs0&&fa.elevationUpdate(Vr.terrain,Gs,yn,Tn.source),fa.needsReEvaluation(Vr,Na,Tn)&&fa.evaluate(Tn))}})(Ge,jt,gt,_t),function(){let Vr,Qr,Tn;wr?(Vr=_t.length-1,Qr=-1,Tn=-1):(Vr=0,Qr=_t.length,Tn=1);const ss=new Float64Array(16),Gs=i.cA(),Na=new i.P(0,0);for(let yn=Vr;yn!==Qr;yn+=Tn){const fa=_t[yn],es=jt.getTile(fa).getBucket(gt);if(!es||!es.uploaded)continue;let Ta=!1;Rt&&(Ta=Rt.getMaxCascadeForTile(fa.toUnwrapped())===0);const Va=ht.calculatePosMatrix(fa.toUnwrapped(),ht.worldSize),Ra=es.modelTraits;!Ir&&wr&&(i.bl(ss,Va),i.af(Gs,Yt,ss),Na.x=Gs[0],Na.y=Gs[1]);const ha=[];es.setFilter(gt.filter);for(const gs of es.getNodesInfo()){if(gs.hiddenByReplacement||!gs.node.meshes)continue;const Ma=gs.node;let Zi=0;Ge.terrain&&Ma.elevation&&(Zi=Ma.elevation*Ge.terrain.exaggeration());const Ci=(()=>{const Lc=gs.aabb;return hr.min=[...Lc.min],hr.max=[...Lc.max],hr.min[2]+=Zi,hr.max[2]+=Zi,i.af(hr.min,hr.min,Va),i.af(hr.max,hr.max,Va),hr})(),Aa=gs.evaluatedScale;if(Aa[0]<=1&&Aa[1]<=1&&Aa[2]<=1&&Ci.intersects(Yr)===0)continue;if(!Ir&&wr){const Lc=.16666666666666666;gs.cameraCollisionOpacity=Yt[0]>Ci.min[0]&&Yt[0]Ci.min[1]&&Yt[1]!wr||gs.opacity===1&&Ma.opacity===1?gs.depthMa.depth?-1:1);for(const gs of ha){const Ma=gs.nodeInfo,Zi=Ma.node;let Ci=i.aB([],Vt,gs.tileModelMatrix);i.aB(Ci,lr,Ci);const Aa=i.bl([],Ci);i.eg(Aa,Aa),i.cS(Aa,Aa,i_),Ci=i.aB(Ci,Ci,Zi.globalMatrix);const oa=Ge.renderPass==="light-beam",xs=gt.paint.get("model-color-use-theme").constantOr("default")==="none",xi=Ra&i.eI.HasMapboxMeshFeatures,ho=xi?0:Ma.evaluatedRMEA[0][2];for(let qi=0;qi=cr||Vi>=cr}}const Gl=ei.material;let Ru;Gl.occlusionTexture&&Gl.occlusionTexture.offsetScale&&(Ru=Gl.occlusionTexture.offsetScale,el.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const _h=Ge.getOrCreateProgram("model",el);!Ir&&Rt&&Rt.setupShadowsFromMatrix(gs.tileModelMatrix,_h,Rt.useNormalOffset),Ge.uploadCommonUniforms(pt,_h,null,Oc);const Yd=Gl.pbrMetallicRoughness;Yd.metallicFactor=.9,Yd.roughnessFactor=.5;const ro=vx(new Float32Array(fc),new Float32Array(Ci),new Float32Array(Aa),new Float32Array(Zi.globalMatrix),Ge,gs.opacity,Yd.baseColorFactor,Gl.emissiveFactor,Yd.metallicFactor,Yd.roughnessFactor,Gl,ho,gt,[0,0,0],Ru);!Nd&&(Ma.hasTranslucentParts||gs.opacity<1)&&_h.draw(Ge,pt.gl.TRIANGLES,er,Gn.disabled,ps.disabled,Vn.backCCW,ro,gt.id,ei.vertexBuffer,ei.indexBuffer,ei.segments,gt.paint,Ge.transform.zoom,void 0,Lc),_h.draw(Ge,pt.gl.TRIANGLES,Nd?Kt:er,Gn.disabled,Nd||gs.opacity<1||Ma.hasTranslucentParts?ps.alphaBlended:ps.unblended,Vn.backCCW,ro,gt.id,ei.vertexBuffer,ei.indexBuffer,ei.segments,gt.paint,Ge.transform.zoom,void 0,Lc)}}}}()}(w,d,p,j),void ue();if(ce.type!=="model")return;const fe=ce.getModels(),ke=[],_e=w.transform.getFreeCameraOptions().position,Re=i.c5([],[_e.x,_e.y,_e.z],w.transform.worldSize);i.ew(Re,Re);const De=[],We=[];let st=0;for(const Ge of fe){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);_6(p,Ge.id,jt,Ge.featureProperties,Ge.nodeOverrideNames,Ge.nodeOverrides),b6(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,st,De,We,Ge.materialOverrides,St);st++}if(De.sort((Ge,jt)=>jt.depth-Ge.depth),w.renderPass!=="shadow")w6(w,p,De,We,ke),ue();else{for(const Ge of We)Yh(Ge.mesh,Ge.nodeModelMatrix,w,p);for(const Ge of De)Yh(Ge.mesh,Ge.nodeModelMatrix,w,p);ue()}}},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 vn(E.LEQUAL,vn.ReadOnly,w.depthRangeFor3D),R=new Gn({func:E.ALWAYS,mask:255},255,255,E.KEEP,E.KEEP,E.REPLACE),B=w.transform.getFreeCameraOptions().position,H=w.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const J of j){const te=d.getTile(J),ue=te.getBucket(p);if(!ue)continue;const ce=ue.elevatedStructures;if(!ce||ce.depthSegments.segments[0].primitiveLength===0)continue;const fe=u6(J.toUnwrapped(),B),ke=w.translatePosMatrix(J.projMatrix,te,p.paint.get("fill-translate"),p.paint.get("fill-translate-anchor")),_e=yx(ke,fe,0,1,0);H.draw(w,E.TRIANGLES,O,R,ps.disabled,Vn.disabled,_e,p.id,ce.vertexBuffer,ce.indexBuffer,ce.depthSegments,p.paint,w.transform.zoom)}}};class ON{constructor(d,p,j,E,O){this.context=new x0(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 v0,this.setup(),this.numSublayers=vd.maxUnderzooming+vd.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 a0(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 C5(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 C5(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 J of[0,1,3,2,0])B.emplaceBack(J);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 Gn({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,vn.disabled,this.stencilClearMode,ps.disabled,Vn.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(ps.disabled),E.setDepthMode(vn.disabled);const R=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const B of j){const H=p.getTile(B),J=this._tileClippingMaskIDs[B.key]=this.nextStencilID++,{tileBoundsBuffer:te,tileBoundsIndexBuffer:ue,tileBoundsSegments:ce}=this.getTileBoundsBuffers(H);R.draw(this,O.TRIANGLES,vn.disabled,new Gn({func:O.ALWAYS,mask:0},J,255,O.KEEP,O.KEEP,O.REPLACE),ps.disabled,Vn.disabled,Xv(B.projMatrix),"$clipping",te,ue,ce)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const d=this.nextStencilID++,p=this.context.gl;return new Gn({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 Gn({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,J=!1,te=null,ue=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,++ue):Et.type==="symbol"&&(Et.hasOcclusionOpacityProperties?J=!0:H=!0))}this.updateEmissiveMode();let fe=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&&++ue)}let _e=!1;for(const Vt of fe)Vt.isHidden(this.transform.zoom)||(Vt.type==="clip"&&(_e=!0),this.prepareLayer(Vt));const Re={},De={},We={},st={},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(),st[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(ue||_e||this._clippingActiveLastFrame){const Vt=[],Et=[];let er=0;for(const Kt of fe)this.isSourceForClippingOrConflation(Kt,jt(Kt))&&(Vt.push(Kt),Et.push(er)),er++;if(Vt&&(_e||Vt.length>1)||this._clippingActiveLastFrame){_e=!1;const Kt=[];for(let hr=0;hr0){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(),fe=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 v6(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 q5(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(!Qe.has(this.context.gl))return;this.renderPass="offscreen";for(const Vt of fe){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-(fe.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,st)),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=fe[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 hr=fe[this.currentLayer],Ir=d.getLayerSourceCache(hr),Yr=Ir?De[Ir.id]:void 0;this.terrain||this._renderTileClippingMasks(hr,Ir,Ir?Re[Ir.id]:void 0),this.renderLayer(this,Ir,hr,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;fe.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=QP.cacheKey(f5[d],d,O,E);return this.cache[R]||(this.cache[R]=new QP(this.context,d,f5[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 J=R.properties.get("direction"),te=R.properties.get("color-use-theme")==="none",ue=R.properties.get("color").toNonPremultipliedRenderColor(te?null:H.getLut(R.scope)).toArray01(),ce=R.properties.get("intensity"),fe=B.properties.get("color-use-theme")==="none",ke=B.properties.get("color").toNonPremultipliedRenderColor(fe?null:H.getLut(B.scope)).toArray01(),_e=B.properties.get("intensity"),Re=[J.x,J.y,J.z],De=i.dN(ke,_e),We=i.dN(ue,ce);return{u_lighting_ambient_color:De,u_lighting_directional_dir:Re,u_lighting_directional_color:We,u_ground_radiance:f0(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=((J,te,ue,ce,fe,ke,_e,Re,De,We,st,Ge)=>{const jt=J.transform,gt=te.properties.get("color-use-theme")==="none",_t=te.properties.get("color").toNonPremultipliedRenderColor(gt?null:J.style.getLut(te.scope)).toArray01();_t[3]=ce;const pt=J.frameCounter/1e3%1,[ht,St]=te.properties.get("vertical-range");return{u_fog_matrix:ue?jt.calculateFogTileMatrix(ue):Ge||J.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:fe,u_frustum_tr:ke,u_frustum_br:_e,u_frustum_bl:Re,u_globe_pos:De,u_globe_radius:We,u_viewport:st,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 V5{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(),J=w.getPitch();let te=d?`/${R}/${B}/${j}`:`${j}/${B}/${R}`;return(H||J)&&(te+="/"+Math.round(10*H)/10),J&&(te+=`/${Math.round(J)}`),te}const b0={linearity:.3,easing:i.eT(0,0,.3,1)},H5=Object.assign({deceleration:2500,maxSpeed:1400},b0),W5=Object.assign({deceleration:20,maxSpeed:1400},b0),Cx=Object.assign({deceleration:1e3,maxSpeed:360},b0),G5=Object.assign({deceleration:1e3,maxSpeed:90},b0);class K5{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=Bm(p.pan.mag(),j,Object.assign({},H5,d||{}));E.offset=p.pan.mult(O.amount/p.pan.mag()),E.center=this._map.transform.center,w0(E,O)}if(p.zoom){const O=Bm(p.zoom,j,W5);E.zoom=this._map.transform.zoom+O.amount,w0(E,O)}if(p.bearing){const O=Bm(p.bearing,j,Cx);E.bearing=this._map.transform.bearing+i.aA(O.amount,-179,179),w0(E,O)}if(p.pitch){const O=Bm(p.pitch,j,G5);E.pitch=this._map.transform.pitch+O.amount,w0(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 w0(w,d){(!w.duration||w.durationp.unproject(H)),B=O.reduce((H,J,te,ue)=>H.add(J.div(ue.length)),new i.P(0,0));super(d,{points:O,point:B,lngLats:R,lngLat:p.unproject(B),originalEvent:j}),this._defaultPrevented=!1}}class Z5 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 Z5(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 Y5{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=J-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 S6(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 C6{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 M6={0:1,2:2},X5={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=Q(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=M6[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 J in E){const te=E[J],ue=this._touches[J];ue&&(O._add(te),R._add(te.sub(ue)),B++,E[J]=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 J=this._aroundCenter?null:B.add(H).div(2);return this._move([B,H],J,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 coe 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 doe={panStep:100,bearingStep:15,pitchStep:10};class uoe{constructor(){const d=doe;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 eM=4.000244140625,tM=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=tM,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%eM==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 J=this._type==="wheel"&&Math.abs(this._delta)>eM?this._wheelZoomRate:this._defaultZoomRate;let te=2/(1+Math.exp(-Math.abs(this._delta*J)));this._delta<0&&te!==0&&(te=1/te);const ue=p(),ce=Math.pow(2,ue),fe=typeof this._targetZoom=="number"?d.zoomScale(this._targetZoom):ce;this._targetZoom=Math.min(d.maxZoom,Math.max(d.minZoom,d.scaleZoom(fe*te))),this._type==="wheel"&&(this._startZoom=ue,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 J=Math.min((i.o.now()-this._lastWheelEventTime)/200,1),te=O(J);R=i.ak(E,j,te),J<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 $m{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 hoe 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 moe{constructor(d,p){this._map=d,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new K5(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 C6,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 coe(p);this._add("touchPitch",H);const J=new Q5(d),te=new J5(d);p.dragRotate=new c_(d,J,te),this._add("mouseRotate",J,["mousePitch"]),this._add("mousePitch",te,["mouseRotate"]);const ue=new T6(d),ce=new A6(p,d);p.dragPan=new $m(j,ue,ce),this._add("mousePan",ue),this._add("touchPan",ce,["touchZoom","touchRotate"]);const fe=new Ui,ke=new loe;p.touchZoomRotate=new WN(j,ke,fe,B),this._add("touchRotate",fe,["touchPan","touchZoom"]),this._add("touchZoom",ke,["touchPan","touchRotate"]),this._add("blockableMapEvent",new Y5(p));const _e=p.scrollZoom=new VN(p,this);this._add("scrollZoom",_e,["mousePan"]);const Re=p.keyboard=new uoe;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,J=H?G(this._el,H):j?void 0:W(this._el,d);for(const{handlerName:ce,handler:fe,allowed:ke}of this._handlers){if(!fe.isEnabled())continue;let _e;this._blockedByActive(B,ke,ce)?fe.reset():fe[p||d.type]&&(_e=fe[p||d.type](d,J,H),this.mergeHandlerResult(O,R,_e,ce,E),_e&&_e.needsRenderFrame&&this._triggerRenderFrame()),(_e||fe.isActive())&&(B[ce]=fe)}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:ue}=O;ue&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ue(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 st=this._eventsInProgress.drag;return st&&!this._handlersById[st.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:J,pitchDelta:te,around:ue,aroundCoord:ce,pinchAround:fe}=d;O._isCameraConstrained&&(H>0&&(H=0),O._isCameraConstrained=!1),fe!==void 0&&(ue=fe),(H||(We=>p[We]&&!this._eventsInProgress[We])("drag"))&&ue&&(this._dragOrigin=R(O.pointCoordinate3D(ue)),this._originalZoom=O.zoom,this._trackingEllipsoid.setup(O._camera.position,this._dragOrigin)),O.cameraElevationReference="sea",E._stop(!0),ue=ue||E.transform.centerPoint,J&&(O.bearing+=J),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(ue).dir),st=this._trackingEllipsoid.projectRay(O.screenPointToMercatorRay(ue.sub(B)).dir);ke[0]=st[0]-We[0],ke[1]=st[1]-We[1]}else{const We=O.pointCoordinate(ue);if(O.projection.name==="globe"){B=B.rotate(-O.angle);const st=O._pixelsPerMercatorPixel/O.worldSize;ke[0]=-B.x*i.eW(i.a$(We.y))*st,ke[1]=-B.y*i.eW(O.center.lat)*st}else{const st=O.pointCoordinate(ue.sub(B));We&&st&&(ke[0]=st.x-We.x,ke[1]=st.y-We.y)}}const _e=O.zoom,Re=[0,0,0];if(H){const We=R(ce||O.pointCoordinate3D(ue)),st={dir:i.aw([],i.av([],We,O._camera.position))};if(st.dir[2]<0){const Ge=O.zoomDeltaToMovement(We,H);i.c5(Re,st.dir,Ge)}}const De=i.d8(ke,ke,Re);O._translateCameraConstrained(De),H&&Math.abs(O.zoom-_e)>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:ue}=d[te];this._eventsInProgress[te]||(R[`${te}start`]=ue),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:ue}=d[te];this._fireEvent(te,ue)}const B={};let H;for(const te in this._eventsInProgress){const{handlerName:ue,originalEvent:ce}=this._eventsInProgress[te];this._handlersById[ue].isActive()||(delete this._eventsInProgress[te],H=p[ue]||ce,B[`${te}end`]=H)}for(const te in B)this._fireEvent(te,B[te]);const J=d_(this._eventsInProgress);if(j&&(E||O)&&!J){this._updatingCamera=!0;const te=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),ue=ce=>ce!==0&&-this._bearingSnap{this._frameId=void 0,this.handleEvent(new hoe("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 rM 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 J=i.aT.convert(p),te=i.aT.convert(j),ue=.5*(J.lat+te.lat),ce=.5*(J.lng+te.lng),fe=i.eZ(ue,ce),ke=i.aw([],fe),_e=i.aw([],i.bI([],ke,[0,1,0])),Re=i.bI([],_e,ke),De=[_e[0],_e[1],_e[2],0,Re[0],Re[1],Re[2],0,ke[0],ke[1],ke[2],0,0,0,0,1],We=[fe,i.eZ(J.lat,J.lng),i.eZ(te.lat,J.lng),i.eZ(te.lat,te.lng),i.eZ(J.lat,te.lng),i.eZ(ue,J.lng),i.eZ(ue,te.lng),i.eZ(J.lat,ce),i.eZ(te.lat,ce)];let st=i.d9.fromPoints(We.map(Kt=>[i.bJ(_e,Kt),i.bJ(Re,Kt),i.bJ(ke,Kt)]));const Ge=i.af([],st.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);st=i.d9.applyTransform(st,i.aB([],jt,De));const _t=this._extendAABB(st,B,H,E);if(!_t)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");st=_t,i.af(Ge,Ge,jt);const pt=.5*(st.max[2]-st.min[2]),ht=this._minimumAABBFrustumDistance(B,st),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 lr=i.d8([],Ge,Xt);i.af(lr,lr,gt);const br=i.eM/i.aD,Vt=i.ag(lr),Et=i.cf(Math.max(Vt*br-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,J=O,te=R,ue=p.width-(H+J),ce=p.height-(B+te),fe=i.av([],d.max,d.min),ke=Math.min(ue/fe[0],ce/fe[1]),_e=Math.min(p.scaleZoom(p.scale*ke),j.maxZoom);if(isNaN(_e))return null;const Re=p.scale/p.zoomScale(_e),De=new i.d9([d.min[0]-H*Re,d.min[1]-te*Re,d.min[2]],[d.max[0]+J*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 J=i.aT.convert(p),te=i.aT.convert(j),ue=new i.aT(J.lng,te.lat),ce=new i.aT(te.lng,J.lat),fe=B.project(J),ke=B.project(te),_e=this.queryTerrainElevation(J),Re=this.queryTerrainElevation(te),De=this.queryTerrainElevation(ue),We=this.queryTerrainElevation(ce),st=[[fe.x,fe.y,Math.min(_e||0,Re||0,De||0,We||0)],[ke.x,ke.y,Math.max(_e||0,Re||0,De||0,We||0)]];let Ge=i.d9.fromPoints(st);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),lr=Math.pow(2,Xt),br=Math.min(B._zoomFromMercatorZ(Dt[2]*B.pixelsPerMeter*lr/B.worldSize),H.maxZoom);return B.mercatorFromTransition&&br<.5*(i.c_+i.cL)?(B.setProjection({name:"globe"}),B.zoom=br,this._cameraForBounds(B,p,j,E,O,R)):{center:Yt,zoom:br,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)),J=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),ue=this.transform.pointLocation3D(J),ce=this.transform.pointLocation3D(new i.P(H.x,J.y)),fe=this.transform.pointLocation3D(new i.P(J.x,H.y)),ke=[Math.min(te.lng,ue.lng,ce.lng,fe.lng),Math.min(te.lat,ue.lat,ce.lat,fe.lat)],_e=[Math.max(te.lng,ue.lng,ce.lng,fe.lng),Math.max(te.lat,ue.lat,ce.lat,fe.lat)],Re=E&&E.pitch?E.pitch:this.getPitch(),De=this._cameraForBounds(this.transform,ke,_e,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,J=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)),J&&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,J="bearing"in d?this._normalizeBearing(d.bearing,O):O,te="pitch"in d?+d.pitch:R,ue=this._extendPadding(d.padding),ce=i.P.convert(d.offset);let fe,ke,_e;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),fe=j.centerPoint.add(Rt),ke=new i.P(St.x,St.y).mult(j.worldSize),_e=new i.P(i.aF(Yt.lng),i.aJ(Yt.lat)).mult(j.worldSize).sub(ke)}else{fe=j.centerPoint.add(ce);const St=j.pointLocation(fe),Rt=i.aT.convert(d.center||St);this._normalizeCenter(Rt),ke=j.project(St),_e=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 st=this._zooming||H!==E,Ge=this._rotating||O!==J,jt=this._pitching||te!==R,gt=!j.isPaddingEqual(ue),_t=d.retainPadding===!1?j.clone():j,pt=St=>Rt=>{if(st&&(St.zoom=i.ak(E,H,Rt)),Ge&&(St.bearing=i.ak(O,J,Rt)),jt&&(St.pitch=i.ak(R,te,Rt)),gt&&(_t.interpolatePadding(B,ue,Rt),fe=_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),lr=St.unproject(ke.add(_e.mult(Rt*Xt)).mult(Dt));St.setLocationAtPoint(St.renderWorldCopies?lr.wrap():lr,fe)}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=st,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,J="bearing"in d?this._normalizeBearing(d.bearing,O):O,te="pitch"in d?+d.pitch:R,ue=this._extendPadding(d.padding),ce=j.zoomScale(H-E),fe=i.P.convert(d.offset);let ke=j.centerPoint.add(fe);const _e=j.pointLocation(ke),Re=i.aT.convert(d.center||_e);this._normalizeCenter(Re);const De=j.project(_e),We=j.project(Re).sub(De);let st=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),hr=Ge/j.zoomScale(Kt-E);st=Math.sqrt(hr/gt*2)}const _t=st*st;function pt(Kt){const hr=(jt*jt-Ge*Ge+(Kt?-1:1)*_t*_t*gt*gt)/(2*(Kt?jt:Ge)*_t*gt);return Math.log(Math.sqrt(hr*hr+1)-hr)}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+st*Kt)},Yt=function(Kt){return Ge*((St(Rt)*(ht(hr=Rt+st*Kt)/St(hr))-ht(Rt))/_t)/gt;var hr},Xt=(pt(1)-Rt)/st;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 lr=O!==J,br=te!==R,Vt=!j.isPaddingEqual(ue),Et=d.retainPadding===!1?j.clone():j,er=Kt=>hr=>{const Ir=hr*Xt,Yr=1/Dt(Ir);Kt.zoom=hr===1?H:E+Kt.scaleZoom(Yr),lr&&(Kt.bearing=i.ak(O,J,hr)),br&&(Kt.pitch=i.ak(R,te,hr)),Vt&&(Et.interpolatePadding(B,ue,hr),ke=Et.centerPoint.add(fe));const Cr=hr===1?Re:Kt.unproject(De.add(We.mult(Yt(Ir))).mult(Yr));return Kt.setLocationAtPoint(Kt.renderWorldCopies?Cr.wrap():Cr,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=lr,this._pitching=br,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 J=B.getAttribute("href");if(!J||!/^(https?:|mailto:)/i.test(J))return void B.replaceWith(R.createTextNode(H));const te=R.createElement("a");te.href=J,te.textContent=H,te.rel="noopener nofollow";const ue=B.getAttribute("class");ue&&(te.className=ue),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 j0{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 Xh{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[J,te]of E){if(!te.target)continue;const ue=H.variants?H.variants[J]:null;if(ue){for(const ce of ue){if(Gp(ce,H,B,J))continue;const fe=new i.dx(H,ce),ke=Mf(ce,H,J);O&&fe.id!==void 0&&(fe.state=this.map.getFeatureState(fe));const _e=j?this.prevHoveredFeatures.get(ke):null,Re=new cg(d,J,te,fe),De=_e?_e.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,J]of E){const{handler:te,target:ue}=J;if(!ue&&te(new cg(d,H,J,null))!==!1)break}}}function foe(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 poe={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"},goe={showCompass:!0,showZoom:!0,visualizePitch:!1};class xoe{constructor(d,p,j=!1){this._clickTolerance=10,this.element=p,this.mouseRotate=new Q5({clickTolerance:d.dragRotate._mouseRotate._clickTolerance}),this.map=d,j&&(this.mousePitch=new J5({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%)"},xh={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=xh.rotation,rotationAlignment:J=xh.rotationAlignment,pitchAlignment:te=xh.pitchAlignment,occludedOpacity:ue=xh.occludedOpacity,altitude:ce=xh.altitude}=d||{};this._anchor=j,this._color=E,this._scale=O,this._draggable=R,this._clickTolerance=B,this._rotation=H,this._rotationAlignment=J,this._pitchAlignment=te,this._occludedOpacity=ue,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",_e=>{_e.preventDefault()}),this._element.addEventListener("mousedown",_e=>{_e.preventDefault()});const fe=this._element.classList;for(const _e in Pc)fe.remove(`mapboxgl-marker-anchor-${_e}`);fe.add(`mapboxgl-marker-anchor-${this._anchor}`);const ke=d&&d.className?d.className.trim().split(/\s+/):[];fe.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||xh.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=nM(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 o5(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 se(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 moe(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 V5(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 Xh(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 gh(this,p).load(w),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new gh(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:J,data:te}=i.o.getImageData(d);this.style.addImage(B,{data:new i.q({width:H,height:J},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:J}=d,te=d;this.style.addImage(B,{data:new i.q({width:H,height:J},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 J=!1;j.usvg?(j.data=new i.q({width:O,height:R},new Uint8Array(B)),j.usvg=!1,j.icon=void 0,J=!0):j.data.replace(B,H),this.style.updateImage(p,j,J)}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 j0),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 BP(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?(rt(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 J=this.transform.zoom,te=this.transform.pitch,ue=i.o.now(),ce=new i.ac(J,{now:ue,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 J=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:J,gpuTime:te}))},50)}if(this.listens("gpu-timing-layer")){const J=this.painter.collectGpuTimers();setTimeout(()=>{const te=this.painter.queryGpuTimers(J);this.fire(new i.z("gpu-timing-layer",{layerTimes:te}))},50)}if(this.listens("gpu-timing-deferred-render")){const J=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const te=this.painter.queryGpuTimeDeferredRender(J);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 J=this.idle();if(J&&(R=this._updateAverageElevation(j,!0)),R)this.triggerRepaint();else if(this._triggerFrame(!1),J&&(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===de||w.status===401)){const d=this.painter.context.gl;rt(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(){At(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({},goe,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 xoe(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},yoe,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({},k0,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 J=Math.pow(10,Math.ceil(-Math.log(H)/Math.LN10));return Math.round(H*J)/J}(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} ${sM[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:j0,Popup:class extends i.E{constructor(w){super(),this.options=Object.assign(Object.create(yh),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=nM(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(vh);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:gh,LngLat:i.aT,LngLatBounds:i.aI,Point:i.P,MercatorCoordinate:i.ae,FreeCameraOptions:wd,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})})(FOe);var Glt=FOe.exports;const rc=eo(Glt);function Tr({className:e,...t}){return r.jsx("div",{className:Ut("animate-pulse rounded-md bg-muted",e),...t})}const Wke={coming_soon:"#3B82F6",active:"#10B981",price_improvement:"#F97316",under_contract:"#8B5CF6",sold:"#6B7280"},Gke={coming_soon:"Coming Soon",active:"Active",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"};function Klt(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:`$${(e/1e3).toFixed(0)}K`}function Zlt({listings:e,isLoading:t}){const n=Wn(),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=Wke[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?``:""}
${Klt(v.price)}
${v.property_address||""}
${v.city}, ${v.state}
${Gke[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(Tr,{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(Wke).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:Gke[y]})]},y))}),r.jsx("div",{ref:s,className:"w-full h-[500px] rounded-lg shadow-lg border border-gray-200"})]})}function DE(e,[t,n]){return Math.min(n,Math.max(t,e))}function cP(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 Ylt=[" ","Enter","ArrowUp","ArrowDown"],Xlt=[" ","Enter"],lk="Select",[Fse,zse,Qlt]=GI(lk),[I3]=cc(lk,[Qlt,ax]),Bse=ax(),[Jlt,Sv]=I3(lk),[ect,tct]=I3(lk),BOe=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=Bse(t),[M,I]=A.useState(null),[T,P]=A.useState(null),[F,D]=A.useState(!1),U=Mk(m),[V,W]=sh({prop:s,defaultProp:a??!1,onChange:o,caller:lk}),[G,Q]=sh({prop:l,defaultProp:i,onChange:u,caller:lk}),ae=A.useRef(null),oe=M?N||!!M.closest("form"):!0,[de,se]=A.useState(new Set),pe=Array.from(de).map(ne=>ne.props.value).join(";");return r.jsx(XI,{...k,children:r.jsxs(Jlt,{required:b,scope:t,trigger:M,onTriggerChange:I,valueNode:T,onValueNodeChange:P,valueNodeHasChildren:F,onValueNodeHasChildrenChange:D,contentId:gd(),value:G,onValueChange:Q,open:V,onOpenChange:W,dir:U,triggerPointerDownPosRef:ae,disabled:v,children:[r.jsx(Fse.Provider,{scope:t,children:r.jsx(ect,{scope:e.__scopeSelect,onNativeOptionAdd:A.useCallback(ne=>{se(me=>new Set(me).add(ne))},[]),onNativeOptionRemove:A.useCallback(ne=>{se(me=>{const he=new Set(me);return he.delete(ne),he})},[]),children:n})}),oe?r.jsxs(dDe,{"aria-hidden":!0,required:b,tabIndex:-1,name:x,autoComplete:y,value:G,onChange:ne=>Q(ne.target.value),disabled:v,form:N,children:[G===void 0?r.jsx("option",{value:""}):null,Array.from(de)]},pe):null]})})};BOe.displayName=lk;var $Oe="SelectTrigger",UOe=A.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:s=!1,...a}=e,o=Bse(n),l=Sv($Oe,n),i=l.disabled||s,u=ca(t,l.onTriggerChange),m=zse(n),x=A.useRef("touch"),[y,v,b]=hDe(k=>{const M=m().filter(P=>!P.disabled),I=M.find(P=>P.value===l.value),T=mDe(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(w3,{asChild:!0,...o,children:r.jsx(Bn.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":uDe(l.value)?"":void 0,...a,ref:u,onClick:xn(a.onClick,k=>{k.currentTarget.focus(),x.current!=="mouse"&&N(k)}),onPointerDown:xn(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:xn(a.onKeyDown,k=>{const M=y.current!=="";!(k.ctrlKey||k.altKey||k.metaKey)&&k.key.length===1&&v(k.key),!(M&&k.key===" ")&&Ylt.includes(k.key)&&(N(),k.preventDefault())})})})});UOe.displayName=$Oe;var qOe="SelectValue",VOe=A.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:a,children:o,placeholder:l="",...i}=e,u=Sv(qOe,n),{onValueNodeHasChildrenChange:m}=u,x=o!==void 0,y=ca(t,u.onValueNodeChange);return oc(()=>{m(x)},[m,x]),r.jsx(Bn.span,{...i,ref:y,style:{pointerEvents:"none"},children:uDe(u.value)?r.jsx(r.Fragment,{children:l}):o})});VOe.displayName=qOe;var rct="SelectIcon",HOe=A.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...a}=e;return r.jsx(Bn.span,{"aria-hidden":!0,...a,ref:t,children:s||"▼"})});HOe.displayName=rct;var nct="SelectPortal",WOe=e=>r.jsx(x3,{asChild:!0,...e});WOe.displayName=nct;var ck="SelectContent",GOe=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?Ah.createPortal(r.jsx(KOe,{scope:e.__scopeSelect,children:r.jsx(Fse.Slot,{scope:e.__scopeSelect,children:r.jsx("div",{children:e.children})})}),o):null}return r.jsx(ZOe,{...e,ref:t})});GOe.displayName=ck;var ip=10,[KOe,Cv]=I3(ck),sct="SelectContentImpl",act=uv("SelectContent.RemoveScroll"),ZOe=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),[Q,ae]=A.useState(null),oe=zse(n),[de,se]=A.useState(!1),pe=A.useRef(!1);A.useEffect(()=>{if(P)return Tse(P)},[P]),Mse();const ne=A.useCallback($e=>{const[Be,...Ve]=oe().map(Oe=>Oe.ref.current),[ot]=Ve.slice(-1),At=document.activeElement;for(const Oe of $e)if(Oe===At||(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!==At))return},[oe,D]),me=A.useCallback(()=>ne([W,P]),[ne,W,P]);A.useEffect(()=>{de&&me()},[de,me]);const{onOpenChange:he,triggerPointerDownPosRef:xe}=T;A.useEffect(()=>{if(P){let $e={x:0,y:0};const Be=ot=>{var At,Oe;$e={x:Math.abs(Math.round(ot.pageX)-(((At=xe.current)==null?void 0:At.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)||he(!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,he,xe]),A.useEffect(()=>{const $e=()=>he(!1);return window.addEventListener("blur",$e),window.addEventListener("resize",$e),()=>{window.removeEventListener("blur",$e),window.removeEventListener("resize",$e)}},[he]);const[Te,be]=hDe($e=>{const Be=oe().filter(At=>!At.disabled),Ve=Be.find(At=>At.ref.current===document.activeElement),ot=mDe(Be,$e,Ve);ot&&setTimeout(()=>ot.ref.current.focus())}),we=A.useCallback(($e,Be,Ve)=>{const ot=!pe.current&&!Ve;(T.value!==void 0&&T.value===Be||ot)&&(G($e),ot&&(pe.current=!0))},[T.value]),ve=A.useCallback(()=>P==null?void 0:P.focus(),[P]),et=A.useCallback(($e,Be,Ve)=>{const ot=!pe.current&&!Ve;(T.value!==void 0&&T.value===Be||ot)&&ae($e)},[T.value]),Me=s==="popper"?ome:YOe,Ie=Me===ome?{side:i,sideOffset:u,align:m,alignOffset:x,arrowPadding:y,collisionBoundary:v,collisionPadding:b,sticky:N,hideWhenDetached:k,avoidCollisions:M}:{};return r.jsx(KOe,{scope:n,content:P,viewport:D,onViewportChange:U,itemRefCallback:we,selectedItem:W,onItemLeave:ve,itemTextRefCallback:et,focusSelectedItem:me,selectedItemText:Q,position:s,isPositioned:de,searchRef:Te,children:r.jsx(sP,{as:act,allowPinchZoom:!0,children:r.jsx(rP,{asChild:!0,trapped:T.open,onMountAutoFocus:$e=>{$e.preventDefault()},onUnmountAutoFocus:xn(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:()=>se(!0),ref:V,style:{display:"flex",flexDirection:"column",outline:"none",...I.style},onKeyDown:xn(I.onKeyDown,$e=>{const Be=$e.ctrlKey||$e.altKey||$e.metaKey;if($e.key==="Tab"&&$e.preventDefault(),!Be&&$e.key.length===1&&be($e.key),["ArrowUp","ArrowDown","Home","End"].includes($e.key)){let ot=oe().filter(At=>!At.disabled).map(At=>At.ref.current);if(["ArrowUp","End"].includes($e.key)&&(ot=ot.slice().reverse()),["ArrowUp","ArrowDown"].includes($e.key)){const At=$e.target,Oe=ot.indexOf(At);ot=ot.slice(Oe+1)}setTimeout(()=>ne(ot)),$e.preventDefault()}})})})})})})});ZOe.displayName=sct;var ict="SelectItemAlignedPosition",YOe=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=zse(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(),Q=I.getBoundingClientRect();if(o.dir!=="rtl"){const At=Q.left-W.left,Oe=G.left-At,at=V.left-Oe,le=V.width+at,qe=Math.max(le,W.width),Qe=window.innerWidth-ip,rt=DE(Oe,[ip,Math.max(ip,Qe-qe)]);i.style.minWidth=le+"px",i.style.left=rt+"px"}else{const At=W.right-Q.right,Oe=window.innerWidth-G.right-At,at=window.innerWidth-V.right-Oe,le=V.width+at,qe=Math.max(le,W.width),Qe=window.innerWidth-ip,rt=DE(Oe,[ip,Math.max(ip,Qe-qe)]);i.style.minWidth=le+"px",i.style.right=rt+"px"}const ae=v(),oe=window.innerHeight-ip*2,de=k.scrollHeight,se=window.getComputedStyle(m),pe=parseInt(se.borderTopWidth,10),ne=parseInt(se.paddingTop,10),me=parseInt(se.borderBottomWidth,10),he=parseInt(se.paddingBottom,10),xe=pe+ne+de+he+me,Te=Math.min(M.offsetHeight*5,xe),be=window.getComputedStyle(k),we=parseInt(be.paddingTop,10),ve=parseInt(be.paddingBottom,10),et=V.top+V.height/2-ip,Me=oe-et,Ie=M.offsetHeight/2,$e=M.offsetTop+Ie,Be=pe+ne+$e,Ve=xe-Be;if(Be<=et){const At=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+(At?ve:0)+Oe+me),le=Be+at;i.style.height=le+"px"}else{const At=ae.length>0&&M===ae[0].ref.current;i.style.top="0px";const at=Math.max(et,pe+k.offsetTop+(At?we:0)+Ie)+Ve;i.style.height=at+"px",k.scrollTop=Be-et+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(lct,{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(Bn.div,{...a,ref:y,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});YOe.displayName=ict;var oct="SelectPopperPosition",ome=A.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:a=ip,...o}=e,l=Bse(n);return r.jsx(QI,{...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)"}})});ome.displayName=oct;var[lct,Qxe]=I3(ck,{}),lme="SelectViewport",XOe=A.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...a}=e,o=Cv(lme,n),l=Qxe(lme,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(Fse.Slot,{scope:n,children:r.jsx(Bn.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:i,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:xn(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})})})]})});XOe.displayName=lme;var QOe="SelectGroup",[cct,dct]=I3(QOe),uct=A.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,a=gd();return r.jsx(cct,{scope:n,id:a,children:r.jsx(Bn.div,{role:"group","aria-labelledby":a,...s,ref:t})})});uct.displayName=QOe;var JOe="SelectLabel",eDe=A.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,a=dct(JOe,n);return r.jsx(Bn.div,{id:a.id,...s,ref:t})});eDe.displayName=JOe;var Ute="SelectItem",[hct,tDe]=I3(Ute),rDe=A.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:a=!1,textValue:o,...l}=e,i=Sv(Ute,n),u=Cv(Ute,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=gd(),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(hct,{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(Fse.ItemSlot,{scope:n,value:s,disabled:a,textValue:x,children:r.jsx(Bn.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:xn(l.onFocus,()=>b(!0)),onBlur:xn(l.onBlur,()=>b(!1)),onClick:xn(l.onClick,()=>{M.current!=="mouse"&&I()}),onPointerUp:xn(l.onPointerUp,()=>{M.current==="mouse"&&I()}),onPointerDown:xn(l.onPointerDown,T=>{M.current=T.pointerType}),onPointerMove:xn(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:xn(l.onPointerLeave,T=>{var P;T.currentTarget===document.activeElement&&((P=u.onItemLeave)==null||P.call(u))}),onKeyDown:xn(l.onKeyDown,T=>{var F;((F=u.searchRef)==null?void 0:F.current)!==""&&T.key===" "||(Xlt.includes(T.key)&&I(),T.key===" "&&T.preventDefault())})})})})});rDe.displayName=Ute;var OT="SelectItemText",nDe=A.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:a,...o}=e,l=Sv(OT,n),i=Cv(OT,n),u=tDe(OT,n),m=tct(OT,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(Bn.span,{id:u.textId,...o,ref:v}),u.isSelected&&l.valueNode&&!l.valueNodeHasChildren?Ah.createPortal(o.children,l.valueNode):null]})});nDe.displayName=OT;var sDe="SelectItemIndicator",aDe=A.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return tDe(sDe,n).isSelected?r.jsx(Bn.span,{"aria-hidden":!0,...s,ref:t}):null});aDe.displayName=sDe;var cme="SelectScrollUpButton",iDe=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.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(lDe,{...e,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:u}=n;i&&u&&(i.scrollTop=i.scrollTop-u.offsetHeight)}}):null});iDe.displayName=cme;var dme="SelectScrollDownButton",oDe=A.forwardRef((e,t)=>{const n=Cv(dme,e.__scopeSelect),s=Qxe(dme,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(lDe,{...e,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:u}=n;i&&u&&(i.scrollTop=i.scrollTop+u.offsetHeight)}}):null});oDe.displayName=dme;var lDe=A.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...a}=e,o=Cv("SelectScrollButton",n),l=A.useRef(null),i=zse(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(Bn.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:xn(a.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(s,50))}),onPointerMove:xn(a.onPointerMove,()=>{var m;(m=o.onItemLeave)==null||m.call(o),l.current===null&&(l.current=window.setInterval(s,50))}),onPointerLeave:xn(a.onPointerLeave,()=>{u()})})}),mct="SelectSeparator",cDe=A.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return r.jsx(Bn.div,{"aria-hidden":!0,...s,ref:t})});cDe.displayName=mct;var ume="SelectArrow",fct=A.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,a=Bse(n),o=Sv(ume,n),l=Cv(ume,n);return o.open&&l.position==="popper"?r.jsx(JI,{...a,...s,ref:t}):null});fct.displayName=ume;var pct="SelectBubbleInput",dDe=A.forwardRef(({__scopeSelect:e,value:t,...n},s)=>{const a=A.useRef(null),o=ca(s,a),l=cP(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(Bn.select,{...n,style:{...oIe,...n.style},ref:o,defaultValue:t})});dDe.displayName=pct;function uDe(e){return e===""||e===void 0}function hDe(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 mDe(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=gct(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 gct(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var xct=BOe,fDe=UOe,yct=VOe,vct=HOe,_ct=WOe,pDe=GOe,bct=XOe,gDe=eDe,xDe=rDe,wct=nDe,jct=aDe,yDe=iDe,vDe=oDe,_De=cDe;const hn=xct,fn=yct,cn=A.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(fDe,{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(vct,{asChild:!0,children:r.jsx(Fd,{className:"h-4 w-4 opacity-50"})})]}));cn.displayName=fDe.displayName;const bDe=A.forwardRef(({className:e,...t},n)=>r.jsx(yDe,{ref:n,className:Ut("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(ly,{className:"h-4 w-4"})}));bDe.displayName=yDe.displayName;const wDe=A.forwardRef(({className:e,...t},n)=>r.jsx(vDe,{ref:n,className:Ut("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(Fd,{className:"h-4 w-4"})}));wDe.displayName=vDe.displayName;const dn=A.forwardRef(({className:e,children:t,position:n="popper",...s},a)=>r.jsx(_ct,{children:r.jsxs(pDe,{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(bDe,{}),r.jsx(bct,{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(wDe,{})]})}));dn.displayName=pDe.displayName;const kct=A.forwardRef(({className:e,...t},n)=>r.jsx(gDe,{ref:n,className:Ut("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));kct.displayName=gDe.displayName;const $t=A.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(xDe,{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(jct,{children:r.jsx(fi,{className:"h-4 w-4"})})}),r.jsx(wct,{children:t})]}));$t.displayName=xDe.displayName;const Nct=A.forwardRef(({className:e,...t},n)=>r.jsx(_De,{ref:n,className:Ut("-mx-1 my-1 h-px bg-muted",e),...t}));Nct.displayName=_De.displayName;const Sct=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}}),jDe=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}),kDe=()=>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}}),Cct=()=>ar({mutationFn:async e=>{const{error:t}=await Y.rpc("increment_listing_share_click",{p_share_token:e});if(t)throw t}}),Mct={active:"bg-emerald-500",coming_soon:"bg-blue-600",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},Kke={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},Tct={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function NDe(){const[e,t]=A.useState(""),[n,s]=A.useState(!1),[a,o]=A.useState({status:"",propertyType:"",minPrice:"",maxPrice:""}),{data:l,isLoading:i}=Sct({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:ROe,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(${Wlt})`},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(X,{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(X,{variant:"secondary",size:"sm",onClick:()=>s(!n),className:"gap-2 bg-white/90 hover:bg-white text-gray-700 shadow-lg",children:[r.jsx(CA,{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(hn,{value:a.status||"all",onValueChange:y=>o({...a,status:y==="all"?"":y}),children:[r.jsx(cn,{className:"bg-white",children:r.jsx(fn,{placeholder:"Any status"})}),r.jsxs(dn,{children:[r.jsx($t,{value:"all",children:"Any status"}),Object.entries(Kke).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(hn,{value:a.propertyType||"all",onValueChange:y=>o({...a,propertyType:y==="all"?"":y}),children:[r.jsx(cn,{className:"bg-white",children:r.jsx(fn,{placeholder:"Any type"})}),r.jsxs(dn,{children:[r.jsx($t,{value:"all",children:"Any type"}),Object.entries(Tct).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(X,{variant:"ghost",size:"sm",onClick:m,className:"gap-1 text-gray-500",children:[r.jsx(us,{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(Zlt,{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(Tr,{className:"aspect-[4/3]"}),r.jsxs("div",{className:"p-4 space-y-3",children:[r.jsx(Tr,{className:"h-7 w-28"}),r.jsx(Tr,{className:"h-4 w-full"}),r.jsx(Tr,{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(Tt,{className:`absolute top-2 left-2 ${Mct[y.status]} text-white border-0 text-xs font-medium px-2 py-0.5`,children:Kke[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(bi,{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(X,{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 kn=A.forwardRef(({className:e,...t},n)=>r.jsx("p",{ref:n,className:Ut("text-sm text-muted-foreground",e),...t}));kn.displayName="CardDescription";const Je=A.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Ut("p-6 pt-0",e),...t}));Je.displayName="CardContent";const RA=A.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Ut("flex items-center p-6 pt-0",e),...t}));RA.displayName="CardFooter";var Act="Label",SDe=A.forwardRef((e,t)=>r.jsx(Bn.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())}}));SDe.displayName=Act;var CDe=SDe;const Ect=y3("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ze=A.forwardRef(({className:e,...t},n)=>r.jsx(CDe,{ref:n,className:Ut(Ect(),e),...t}));ze.displayName=CDe.displayName;const qte="/assets/levelup-logo-color-D3mY9gCJ.png";function Ict(){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(NDe,{}):s.startsWith("public/")?null:r.jsx(Pct,{slug:s})}function Pct({slug:e}){return r.jsx(Dct,{slug:e})}const Lct={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},Oct={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},Zke={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function Dct({slug:e}){var G,Q;const{data:t,isLoading:n}=jDe(e),s=kDe(),[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(Tr,{className:"h-8 w-32"})})}),r.jsxs("div",{className:"container mx-auto px-4 py-8",children:[r.jsx(Tr,{className:"h-10 w-48 mb-6"}),r.jsx(Tr,{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(Tr,{className:"h-12 w-48"}),r.jsx(Tr,{className:"h-6 w-full"}),r.jsx(Tr,{className:"h-6 w-3/4"})]}),r.jsx(Tr,{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:qte,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(X,{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":""} ${Zke[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:qte,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(Tt,{className:`${Lct[t.status]} text-white border-0`,children:Oct[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(Fo,{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(U1,{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($1,{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(Ts,{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(Tt,{variant:"secondary",children:[r.jsx(mi,{className:"h-3 w-3 mr-1"}),Zke[t.property_type]]}),t.lot_size&&r.jsxs(Tt,{variant:"secondary",children:["Lot: ",t.lot_size]}),t.has_hoa&&r.jsx(Tt,{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(X,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:t.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Ms,{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(Je,{children:[r.jsx("p",{className:"font-semibold text-lg",children:t.agent.name}),((Q=t.agent.brokerage)==null?void 0:Q.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(Je,{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(ks,{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(X,{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(Or,{open:M!==null,onOpenChange:()=>I(null),children:r.jsxs(Lr,{className:"max-w-5xl p-0 bg-black/95",children:[r.jsx(zr,{className:"sr-only",children:r.jsx(Fr,{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(us,{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 $se({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 MDe=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}),Rct=()=>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}}),Fct=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}),TDe=()=>{const e=qr();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)})},ADe=()=>{const e=qr();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:{}})},zct=async(e,t)=>{const{error:n}=await Y.from("agent_card_leads").insert({card_id:e,...t});if(n)throw n},EDe=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 Use({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 zct(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(Or,{open:e,onOpenChange:t,children:r.jsxs(Lr,{className:"sm:max-w-md rounded-2xl",children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:s==="booking"?"Book a Call":s==="connect"?"Connect with Me":"Refer a Friend"}),r.jsx(Qn,{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(hn,{value:y,onValueChange:v,children:[r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select one"})}),r.jsxs(dn,{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(X,{type:"submit",className:"w-full rounded-2xl",disabled:k,children:k?"Sending...":"Submit"})]})]})})}const Bct=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}),$ct=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}),Uct=()=>{const e=qr();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)})},qct=()=>{const e=qr();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)})},Vct=()=>{const e=qr();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 Hct(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 Wct(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 Gct={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 Kct({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=Wct(n.video_url),o=s||!!a,l=s?Hct(n.video_url):a||n.video_url;return r.jsx("div",{className:Gct[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 Zct={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 Yct({block:e,variant:t}){const s=e.config.testimonials||[],[a,o]=A.useState(0);if(s.length===0)return null;const l=Zct[t],i=s[a];return r.jsxs("div",{className:l.container,children:[r.jsxs("div",{className:l.card,children:[r.jsx(bA,{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 Xct={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 Qct({block:e,variant:t}){const s=e.config.tags||[];if(s.length===0)return null;const a=Xct[t];return r.jsx("div",{className:a.container,children:s.map((o,l)=>r.jsx("span",{className:a.tag,children:o},l))})}const Jct={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 edt({block:e,cardId:t,variant:n}){const a=e.config.links||[];if(a.length===0)return null;const o=Jct[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(Ms,{className:`h-4 w-4 ${o.icon}`})]},i))})}const hme={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 tdt({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 rdt={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 ndt({block:e,cardId:t,variant:n}){const a=e.config.platforms||[],o=rdt[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=hme[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(tdt,{path:u.icon,color:u.color})},i)})})]})}function qse({cardId:e,variant:t}){const{data:n}=Bct(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(Kct,{block:l,variant:t},l.id);case"testimonials":return r.jsx(Yct,{block:l,variant:t},l.id);case"specialties":return r.jsx(Qct,{block:l,variant:t},l.id);case"custom_links":return r.jsx(edt,{block:l,cardId:e,variant:t},l.id);default:return null}}),o&&r.jsx(ndt,{block:o,cardId:e,variant:t})]})}async function sdt(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 adt(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 Vse(e){const{first:t,last:n}=adt(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 sdt(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 idt({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"),Vse({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(Ti,{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(X,{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(Ii,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs font-medium",children:"Call"})]}),r.jsxs(X,{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(zo,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs font-medium",children:"Text"})]}),r.jsxs(X,{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(ks,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs font-medium",children:"Email"})]})]}),r.jsxs(X,{onClick:y,className:"w-full h-12 text-base font-semibold rounded-2xl shadow-sm mb-6",variant:"outline",children:[r.jsx(Ts,{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(Ss,{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($se,{card:e,variant:"standard"}),r.jsx(qse,{cardId:e.id,variant:"standard"}),r.jsxs("div",{className:"space-y-2 mb-6",children:[e.show_save_contact&&r.jsxs(X,{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(X,{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(Ss,{className:"h-4 w-4 mr-3 text-amber-500"}),"Leave a Review"]}),e.show_refer_friend&&r.jsxs(X,{variant:"ghost",onClick:N,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(qn,{className:"h-4 w-4 mr-3 text-primary"}),"Refer a Friend"]}),r.jsxs(X,{variant:"ghost",onClick:k,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(nh,{className:"h-4 w-4 mr-3 text-primary"}),"Connect with Me"]}),r.jsxs(X,{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(Use,{open:t,onOpenChange:n,cardId:e.id,type:s,agentName:o})]})}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"),Vse({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(Ti,{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:Ii,label:"Call",handler:u},{icon:zo,label:"Text",handler:m},{icon:ks,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(Ts,{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(Ss,{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($se,{card:e,variant:"luxury"}),r.jsx(qse,{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(Ss,{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(qn,{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(nh,{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(Use,{open:t,onOpenChange:n,cardId:e.id,type:s,agentName:o})]})}function ldt({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),Q=Math.max(0,(G>>16)-W),ae=Math.max(0,(G>>8&255)-W),oe=Math.max(0,(G&255)-W);return`#${(Q<<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"),Vse({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(Ti,{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:Ii,label:"Call",handler:x},{icon:zo,label:"Text",handler:y},{icon:ks,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(Ts,{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(Ss,{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($se,{card:e,variant:"bold"}),r.jsx(qse,{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(Ss,{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(qn,{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(nh,{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(Use,{open:t,onOpenChange:n,cardId:e.id,type:s,agentName:o})]})}function cdt({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"),Vse({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(Ti,{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:Ii,label:"Call",handler:u},{icon:zo,label:"Text",handler:m},{icon:ks,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(Ts,{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(Ss,{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($se,{card:e,variant:"classic"}),r.jsx(qse,{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(Ss,{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(qn,{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(nh,{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(Use,{open:t,onOpenChange:n,cardId:e.id,type:s,agentName:o})]})}function Jxe({card:e}){switch(e.theme){case"luxury":return r.jsx(odt,{card:e});case"bold":return r.jsx(ldt,{card:e});case"classic":return r.jsx(cdt,{card:e});case"standard":default:return r.jsx(idt,{card:e})}}function ddt(){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(udt,{slug:t})}function udt({slug:e}){return r.jsx(hdt,{slug:e})}function hdt({slug:e}){var o;const{data:t,isLoading:n,error:s}=MDe(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(Tr,{className:"h-28 w-28 rounded-full"}),r.jsx(Tr,{className:"h-6 w-48"}),r.jsx(Tr,{className:"h-4 w-36"})]}),r.jsx(Tr,{className:"h-12 w-full"}),r.jsx(Tr,{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 IDe({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(fi,{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(hn,{value:v,onValueChange:b,children:[r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select one"})}),r.jsxs(dn,{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(X,{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 mdt(){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(fdt,{shareToken:t})}function fdt({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(Tr,{className:"h-12 w-3/4 mx-auto"}),r.jsx(Tr,{className:"h-64 w-full"}),r.jsx(Tr,{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.jsx("div",{className:"max-w-5xl mx-auto px-4 py-3 flex items-center justify-end",children: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.jsx("h1",{className:"text-3xl md:text-4xl font-bold text-gray-900 mb-2",children:t.heading||(t.client_name?`Welcome, ${t.client_name}!`:t.title)}),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 prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html: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(X,{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(Ms,{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(IDe,{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 mme="levelup_affiliate_ref",pdt=30,gdt=()=>{const[e]=Zc();A.useEffect(()=>{const t=e.get("ref");if(t){const n={code:t.toUpperCase(),timestamp:Date.now()};localStorage.setItem(mme,JSON.stringify(n)),console.log("[Affiliate] Stored referral code:",t)}},[e])},xdt=()=>{try{const e=localStorage.getItem(mme);if(!e)return null;const t=JSON.parse(e),n=pdt*24*60*60*1e3;return Date.now()-t.timestamp>n?(localStorage.removeItem(mme),console.log("[Affiliate] Referral code expired"),null):t.code}catch{return null}},Vte="/assets/levelup-logo-header-_ZX7DvlA.png",ydt="/assets/scale-your-team-ku4MPatU.png";function vdt({open:e,onOpenChange:t}){return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Lr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(zr,{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(mi,{className:"h-5 w-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Fr,{children:"Schedule a Brokerage Interest Meeting"}),r.jsx(Qn,{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 Cd={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"]}},_dt=[{icon:nf,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:Ts,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."}],bdt=[{icon:qn,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:Ds,title:"Smart Touchpoint Plans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:Ii,title:"One-Tap Actions",description:"Call, text, or email contacts directly with pre-written scripts tailored to each relationship."},{icon:fm,title:"Birthday & Anniversary Alerts",description:"Never miss an important date—get reminders for birthdays and home anniversaries."},{icon:Fo,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:bi,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."}],wdt=[{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."}],jdt=()=>{const{user:e,loading:t}=tn(),n=Wn(),[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)};gdt(),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=xdt();try{const{data:Q,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(Q!=null&&Q.url)window.open(Q.url,"_blank","noopener,noreferrer"),Ae.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(Q){console.error("Checkout error:",Q),Ae.error(Q.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:Vte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[r.jsx(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(mi,{className:"mr-2 h-5 w-5"}),"Brokerage Partnership"]}),r.jsxs(X,{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:_dt.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(Je,{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(Ds,{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:bdt.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(Je,{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(X,{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(mi,{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(fi,{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(X,{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(X,{size:"lg",variant:"outline",onClick:()=>P(!0),className:"border-[#4a6b6d] text-[#4a6b6d] hover:bg-[#4a6b6d]/10",children:[r.jsx(Ts,{className:"mr-2 w-5 h-5"}),"Schedule Info Session"]})]})]}),r.jsx("div",{className:"relative hidden md:block",children:r.jsx("img",{src:ydt,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:wdt.map((V,W)=>r.jsx(He,{className:"bg-muted/30 border-0",children:r.jsxs(Je,{className:"pt-8",children:[r.jsx("div",{className:"flex gap-1 mb-4",children:[1,2,3,4,5].map(G=>r.jsx(Ss,{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(X,{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:Cd.individual_agent.name})]}),r.jsxs("div",{className:"flex items-baseline gap-1 mt-4",children:[r.jsx("span",{className:"text-5xl font-bold",children:Cd.individual_agent.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:Cd.individual_agent.period})]}),r.jsx(kn,{className:"text-base mt-2",children:Cd.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(Qa,{className:"w-4 h-4"}),Cd.individual_agent.trial]})]}),r.jsx(Je,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:Cd.individual_agent.features.map((V,W)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(fi,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:V})]},W))})}),r.jsxs(RA,{className:"flex flex-col gap-3 pt-4",children:[r.jsx(X,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>F("individual_agent"),children:"Start Free Trial"}),r.jsx(X,{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(mi,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Gt,{className:"text-xl font-sans",children:Cd.brokerage_under_25.name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:Cd.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:Cd.brokerage_under_25.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:Cd.brokerage_under_25.period})]}),r.jsx(kn,{className:"text-base mt-2",children:Cd.brokerage_under_25.description})]}),r.jsx(Je,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:Cd.brokerage_under_25.features.map((V,W)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(fi,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:V})]},W))})}),r.jsx(RA,{className:"pt-4",children:r.jsx(X,{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(mi,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Gt,{className:"text-xl font-sans",children:Cd.brokerage_over_25.name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:Cd.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:Cd.brokerage_over_25.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:Cd.brokerage_over_25.period})]}),r.jsx(kn,{className:"text-base mt-2",children:Cd.brokerage_over_25.description})]}),r.jsx(Je,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:Cd.brokerage_over_25.features.map((V,W)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(fi,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:V})]},W))})}),r.jsx(RA,{className:"pt-4",children:r.jsx(X,{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(X,{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(X,{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:Vte,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(vdt,{open:T,onOpenChange:P}),r.jsx(Or,{open:u,onOpenChange:m,children:r.jsxs(Lr,{className:"sm:max-w-md",children:[r.jsxs(zr,{children:[r.jsx(Fr,{className:"text-xl font-sans font-semibold",children:"Enter your details to get started"}),r.jsx(Qn,{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(X,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:U,disabled:M,children:M?"Loading...":"Continue to Checkout"})]})})]})},kdt=()=>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"})]})]})]})]})})]}),Ndt=()=>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"})]})]})]})]})})]}),Sdt=()=>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 Yke;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Yke||(Yke={}));const Os=fo.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Q0=e=>{switch(typeof e){case"undefined":return Os.undefined;case"string":return Os.string;case"number":return Number.isNaN(e)?Os.nan:Os.number;case"boolean":return Os.boolean;case"function":return Os.function;case"bigint":return Os.bigint;case"symbol":return Os.symbol;case"object":return Array.isArray(e)?Os.array:e===null?Os.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Os.promise:typeof Map<"u"&&e instanceof Map?Os.map:typeof Set<"u"&&e instanceof Set?Os.set:typeof Date<"u"&&e instanceof Date?Os.date:Os.object;default:return Os.unknown}},Rn=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 fme=(e,t)=>{let n;switch(e.code){case Rn.invalid_type:e.received===Os.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Rn.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,fo.jsonStringifyReplacer)}`;break;case Rn.unrecognized_keys:n=`Unrecognized key(s) in object: ${fo.joinValues(e.keys,", ")}`;break;case Rn.invalid_union:n="Invalid input";break;case Rn.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${fo.joinValues(e.options)}`;break;case Rn.invalid_enum_value:n=`Invalid enum value. Expected ${fo.joinValues(e.options)}, received '${e.received}'`;break;case Rn.invalid_arguments:n="Invalid function arguments";break;case Rn.invalid_return_type:n="Invalid function return type";break;case Rn.invalid_date:n="Invalid date";break;case Rn.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 Rn.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 Rn.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 Rn.custom:n="Invalid input";break;case Rn.invalid_intersection_types:n="Intersection results could not be merged";break;case Rn.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Rn.not_finite:n="Number must be finite";break;default:n=t.defaultError,fo.assertNever(e)}return{message:n}};let Cdt=fme;function Mdt(){return Cdt}const Tdt=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 bs(e,t){const n=Mdt(),s=Tdt({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===fme?void 0:fme].filter(a=>!!a)});e.common.issues.push(s)}class Nm{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 ni;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 Nm.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 ni;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 ni=Object.freeze({status:"aborted"}),DT=e=>({status:"dirty",value:e}),jf=e=>({status:"valid",value:e}),Xke=e=>e.status==="aborted",Qke=e=>e.status==="dirty",EC=e=>e.status==="valid",Hte=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 Jke=(e,t)=>{if(EC(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 Ai(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 Q0(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Q0(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Nm,ctx:{common:t.parent.common,data:t.data,parsedType:Q0(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Hte(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:Q0(t)},a=this._parseSync({data:t,path:s.path,parent:s});return Jke(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:Q0(t)};if(!this["~standard"].async)try{const o=this._parseSync({data:t,path:[],parent:n});return EC(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=>EC(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:Q0(t)},a=this._parse({data:t,path:s.path,parent:s}),o=await(Hte(a)?a:Promise.resolve(a));return Jke(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:Rn.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 LC({schema:this,typeName:si.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 OC.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Kg.create(this)}promise(){return Zte.create(this,this._def)}or(t){return Gte.create([this,t],this._def)}and(t){return Kte.create(this,t,this._def)}transform(t){return new LC({...Ai(this._def),schema:this,typeName:si.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new yme({...Ai(this._def),innerType:this,defaultValue:n,typeName:si.ZodDefault})}brand(){return new Qdt({typeName:si.ZodBranded,type:this,...Ai(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new vme({...Ai(this._def),innerType:this,catchValue:n,typeName:si.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return eye.create(this,t)}readonly(){return _me.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Adt=/^c[^\s-]{8,}$/i,Edt=/^[0-9a-z]+$/,Idt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Pdt=/^[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,Ldt=/^[a-z0-9_-]{21}$/i,Odt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ddt=/^[-+]?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)?)??$/,Rdt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Fdt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let $ce;const zdt=/^(?:(?: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])$/,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])\/(3[0-2]|[12]?[0-9])$/,$dt=/^(([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]))$/,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]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,qdt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Vdt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,PDe="((\\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])))",Hdt=new RegExp(`^${PDe}$`);function LDe(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 Wdt(e){return new RegExp(`^${LDe(e)}$`)}function Gdt(e){let t=`${PDe}T${LDe(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 Kdt(e,t){return!!((t==="v4"||!t)&&zdt.test(e)||(t==="v6"||!t)&&$dt.test(e))}function Zdt(e,t){if(!Odt.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 Ydt(e,t){return!!((t==="v4"||!t)&&Bdt.test(e)||(t==="v6"||!t)&&Udt.test(e))}class M1 extends uo{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Os.string){const o=this._getOrReturnCtx(t);return bs(o,{code:Rn.invalid_type,expected:Os.string,received:o.parsedType}),ni}const s=new Nm;let a;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(a=this._getOrReturnCtx(t,a),bs(a,{code:Rn.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:Rn.invalid_string,...Zs.errToObj(s)})}_addCheck(t){return new M1({...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 M1({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new M1({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new M1({...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 M1({checks:[],typeName:si.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Ai(e)});function Xdt(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 IC 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)!==Os.number){const o=this._getOrReturnCtx(t);return bs(o,{code:Rn.invalid_type,expected:Os.number,received:o.parsedType}),ni}let s;const a=new Nm;for(const o of this._def.checks)o.kind==="int"?fo.isInteger(t.data)||(s=this._getOrReturnCtx(t,s),bs(s,{code:Rn.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),bs(s,{code:Rn.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?Xdt(t.data,o.value)!==0&&(s=this._getOrReturnCtx(t,s),bs(s,{code:Rn.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(s=this._getOrReturnCtx(t,s),bs(s,{code:Rn.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 IC({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:s,message:Zs.toString(a)}]})}_addCheck(t){return new IC({...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 IC({checks:[],typeName:si.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Ai(e)});class RE 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)!==Os.bigint)return this._getInvalidInput(t);let s;const a=new Nm;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(s=this._getOrReturnCtx(t,s),bs(s,{code:Rn.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),bs(s,{code:Rn.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 bs(n,{code:Rn.invalid_type,expected:Os.bigint,received:n.parsedType}),ni}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 RE({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:s,message:Zs.toString(a)}]})}_addCheck(t){return new RE({...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 RE({checks:[],typeName:si.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Ai(e)});class pme extends uo{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Os.boolean){const s=this._getOrReturnCtx(t);return bs(s,{code:Rn.invalid_type,expected:Os.boolean,received:s.parsedType}),ni}return jf(t.data)}}pme.create=e=>new pme({typeName:si.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Ai(e)});class Wte extends uo{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Os.date){const o=this._getOrReturnCtx(t);return bs(o,{code:Rn.invalid_type,expected:Os.date,received:o.parsedType}),ni}if(Number.isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return bs(o,{code:Rn.invalid_date}),ni}const s=new Nm;let a;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(a=this._getOrReturnCtx(t,a),bs(a,{code:Rn.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 Wte({...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 Wte({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:si.ZodDate,...Ai(e)});class eNe extends uo{_parse(t){if(this._getType(t)!==Os.symbol){const s=this._getOrReturnCtx(t);return bs(s,{code:Rn.invalid_type,expected:Os.symbol,received:s.parsedType}),ni}return jf(t.data)}}eNe.create=e=>new eNe({typeName:si.ZodSymbol,...Ai(e)});class tNe extends uo{_parse(t){if(this._getType(t)!==Os.undefined){const s=this._getOrReturnCtx(t);return bs(s,{code:Rn.invalid_type,expected:Os.undefined,received:s.parsedType}),ni}return jf(t.data)}}tNe.create=e=>new tNe({typeName:si.ZodUndefined,...Ai(e)});class rNe extends uo{_parse(t){if(this._getType(t)!==Os.null){const s=this._getOrReturnCtx(t);return bs(s,{code:Rn.invalid_type,expected:Os.null,received:s.parsedType}),ni}return jf(t.data)}}rNe.create=e=>new rNe({typeName:si.ZodNull,...Ai(e)});class nNe extends uo{constructor(){super(...arguments),this._any=!0}_parse(t){return jf(t.data)}}nNe.create=e=>new nNe({typeName:si.ZodAny,...Ai(e)});class sNe extends uo{constructor(){super(...arguments),this._unknown=!0}_parse(t){return jf(t.data)}}sNe.create=e=>new sNe({typeName:si.ZodUnknown,...Ai(e)});class pv extends uo{_parse(t){const n=this._getOrReturnCtx(t);return bs(n,{code:Rn.invalid_type,expected:Os.never,received:n.parsedType}),ni}}pv.create=e=>new pv({typeName:si.ZodNever,...Ai(e)});class aNe extends uo{_parse(t){if(this._getType(t)!==Os.undefined){const s=this._getOrReturnCtx(t);return bs(s,{code:Rn.invalid_type,expected:Os.void,received:s.parsedType}),ni}return jf(t.data)}}aNe.create=e=>new aNe({typeName:si.ZodVoid,...Ai(e)});class Kg extends uo{_parse(t){const{ctx:n,status:s}=this._processInputParams(t),a=this._def;if(n.parsedType!==Os.array)return bs(n,{code:Rn.invalid_type,expected:Os.array,received:n.parsedType}),ni;if(a.exactLength!==null){const l=n.data.length>a.exactLength.value,i=n.data.lengtha.maxLength.value&&(bs(n,{code:Rn.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=>Nm.mergeArray(s,l));const o=[...n.data].map((l,i)=>a.type._parseSync(new fv(n,l,n.path,i)));return Nm.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:si.ZodArray,...Ai(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 OC?OC.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)!==Os.object){const m=this._getOrReturnCtx(t);return bs(m,{code:Rn.invalid_type,expected:Os.object,received:m.parsedType}),ni}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&&(bs(a,{code:Rn.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=>Nm.mergeObjectSync(s,m)):Nm.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:si.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 ODe(fo.objectKeys(this.shape))}}Bc.create=(e,t)=>new Bc({shape:()=>e,unknownKeys:"strip",catchall:pv.create(),typeName:si.ZodObject,...Ai(t)});Bc.strictCreate=(e,t)=>new Bc({shape:()=>e,unknownKeys:"strict",catchall:pv.create(),typeName:si.ZodObject,...Ai(t)});Bc.lazycreate=(e,t)=>new Bc({shape:e,unknownKeys:"strip",catchall:pv.create(),typeName:si.ZodObject,...Ai(t)});class Gte 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 bs(n,{code:Rn.invalid_union,unionErrors:l}),ni}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 bs(n,{code:Rn.invalid_union,unionErrors:i}),ni}}get options(){return this._def.options}}Gte.create=(e,t)=>new Gte({options:e,typeName:si.ZodUnion,...Ai(t)});function gme(e,t){const n=Q0(e),s=Q0(t);if(e===t)return{valid:!0,data:e};if(n===Os.object&&s===Os.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=gme(e[i],t[i]);if(!u.valid)return{valid:!1};l[i]=u.data}return{valid:!0,data:l}}else if(n===Os.array&&s===Os.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let o=0;o{if(Xke(o)||Xke(l))return ni;const i=gme(o.value,l.value);return i.valid?((Qke(o)||Qke(l))&&n.dirty(),{status:n.value,value:i.data}):(bs(s,{code:Rn.invalid_intersection_types}),ni)};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}))}}Kte.create=(e,t,n)=>new Kte({left:e,right:t,typeName:si.ZodIntersection,...Ai(n)});class dk extends uo{_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==Os.array)return bs(s,{code:Rn.invalid_type,expected:Os.array,received:s.parsedType}),ni;if(s.data.lengththis._def.items.length&&(bs(s,{code:Rn.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=>Nm.mergeArray(n,l)):Nm.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:si.ZodTuple,rest:null,...Ai(t)})};class iNe 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!==Os.map)return bs(s,{code:Rn.invalid_type,expected:Os.map,received:s.parsedType}),ni;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 ni;(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 ni;(m.status==="dirty"||x.status==="dirty")&&n.dirty(),i.set(m.value,x.value)}return{status:n.value,value:i}}}}iNe.create=(e,t,n)=>new iNe({valueType:t,keyType:e,typeName:si.ZodMap,...Ai(n)});class FE extends uo{_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==Os.set)return bs(s,{code:Rn.invalid_type,expected:Os.set,received:s.parsedType}),ni;const a=this._def;a.minSize!==null&&s.data.sizea.maxSize.value&&(bs(s,{code:Rn.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 ni;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 FE({...this._def,minSize:{value:t,message:Zs.toString(n)}})}max(t,n){return new FE({...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)}}FE.create=(e,t)=>new FE({valueType:e,minSize:null,maxSize:null,typeName:si.ZodSet,...Ai(t)});class oNe 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})}}oNe.create=(e,t)=>new oNe({getter:e,typeName:si.ZodLazy,...Ai(t)});class xme extends uo{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return bs(n,{received:n.data,code:Rn.invalid_literal,expected:this._def.value}),ni}return{status:"valid",value:t.data}}get value(){return this._def.value}}xme.create=(e,t)=>new xme({value:e,typeName:si.ZodLiteral,...Ai(t)});function ODe(e,t){return new PC({values:e,typeName:si.ZodEnum,...Ai(t)})}class PC extends uo{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),s=this._def.values;return bs(n,{expected:fo.joinValues(s),received:n.parsedType,code:Rn.invalid_type}),ni}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 bs(n,{received:n.data,code:Rn.invalid_enum_value,options:s}),ni}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 PC.create(t,{...this._def,...n})}exclude(t,n=this._def){return PC.create(this.options.filter(s=>!t.includes(s)),{...this._def,...n})}}PC.create=ODe;class lNe extends uo{_parse(t){const n=fo.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(t);if(s.parsedType!==Os.string&&s.parsedType!==Os.number){const a=fo.objectValues(n);return bs(s,{expected:fo.joinValues(a),received:s.parsedType,code:Rn.invalid_type}),ni}if(this._cache||(this._cache=new Set(fo.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const a=fo.objectValues(n);return bs(s,{received:s.data,code:Rn.invalid_enum_value,options:a}),ni}return jf(t.data)}get enum(){return this._def.values}}lNe.create=(e,t)=>new lNe({values:e,typeName:si.ZodNativeEnum,...Ai(t)});class Zte extends uo{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Os.promise&&n.common.async===!1)return bs(n,{code:Rn.invalid_type,expected:Os.promise,received:n.parsedType}),ni;const s=n.parsedType===Os.promise?n.data:Promise.resolve(n.data);return jf(s.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Zte.create=(e,t)=>new Zte({type:e,typeName:si.ZodPromise,...Ai(t)});class LC extends uo{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===si.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=>{bs(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 ni;const u=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return u.status==="aborted"?ni:u.status==="dirty"||n.value==="dirty"?DT(u.value):u});{if(n.value==="aborted")return ni;const i=this._def.schema._parseSync({data:l,path:s.path,parent:s});return i.status==="aborted"?ni:i.status==="dirty"||n.value==="dirty"?DT(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"?ni:(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"?ni:(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(!EC(l))return ni;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=>EC(l)?Promise.resolve(a.transform(l.value,o)).then(i=>({status:n.value,value:i})):ni);fo.assertNever(a)}}LC.create=(e,t,n)=>new LC({schema:e,typeName:si.ZodEffects,effect:t,...Ai(n)});LC.createWithPreprocess=(e,t,n)=>new LC({schema:t,effect:{type:"preprocess",transform:e},typeName:si.ZodEffects,...Ai(n)});class tv extends uo{_parse(t){return this._getType(t)===Os.undefined?jf(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}tv.create=(e,t)=>new tv({innerType:e,typeName:si.ZodOptional,...Ai(t)});class OC extends uo{_parse(t){return this._getType(t)===Os.null?jf(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}OC.create=(e,t)=>new OC({innerType:e,typeName:si.ZodNullable,...Ai(t)});class yme extends uo{_parse(t){const{ctx:n}=this._processInputParams(t);let s=n.data;return n.parsedType===Os.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}yme.create=(e,t)=>new yme({innerType:e,typeName:si.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ai(t)});class vme 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 Hte(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}}vme.create=(e,t)=>new vme({innerType:e,typeName:si.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ai(t)});class cNe extends uo{_parse(t){if(this._getType(t)!==Os.nan){const s=this._getOrReturnCtx(t);return bs(s,{code:Rn.invalid_type,expected:Os.nan,received:s.parsedType}),ni}return{status:"valid",value:t.data}}}cNe.create=e=>new cNe({typeName:si.ZodNaN,...Ai(e)});class Qdt 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"?ni:o.status==="dirty"?(n.dirty(),DT(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"?ni: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:si.ZodPipeline})}}class _me extends uo{_parse(t){const n=this._def.innerType._parse(t),s=a=>(EC(a)&&(a.value=Object.freeze(a.value)),a);return Hte(n)?n.then(a=>s(a)):s(n)}unwrap(){return this._def.innerType}}_me.create=(e,t)=>new _me({innerType:e,typeName:si.ZodReadonly,...Ai(t)});var si;(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"})(si||(si={}));const xc=M1.create,FA=IC.create,Jdt=pme.create;pv.create;Kg.create;const P3=Bc.create;Gte.create;Kte.create;dk.create;const dNe=xme.create,DDe=PC.create;Zte.create;tv.create;OC.create;const eut=P3({email:xc().email("Invalid email address"),password:xc().min(6,"Password must be at least 6 characters")}),tut=()=>{const{signIn:e,user:t}=tn(),n=Wn(),[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{eut.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:ROe,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(kn,{className:"text-gray-600",children:"Sign in to access your dashboard"})]}),r.jsx(Je,{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(X,{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(Or,{open:y,onOpenChange:v,children:[r.jsx(Co,{asChild:!0,children:r.jsx(X,{variant:"link",className:"w-full text-sm text-[#4a6b6d] hover:text-[#3d5a5c]",children:"Forgot password?"})}),r.jsxs(Lr,{className:"bg-white",children:[r.jsxs(zr,{children:[r.jsx(Fr,{className:"text-[#2a4347]",style:{fontFamily:"'Libre Baskerville', serif"},children:"Reset Password"}),r.jsx(Qn,{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(X,{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"})]})]})})]})]})},rut=()=>{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(li,{className:"w-10 h-10 text-green-500"})}),r.jsx(Gt,{className:"text-2xl",children:"Welcome to LevelUp!"}),r.jsx(kn,{className:"text-lg",children:"Your subscription has been activated successfully."})]}),r.jsxs(Je,{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(ks,{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."})})]})]})})},RDe=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)}}}},FDe=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},nut=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},zDe=()=>{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")}},uNe="community_last_seen_post_at";function sut(){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(`${uNe}_${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(`${uNe}_${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 aut(){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 Hse=Ose,tye=Yxe,iut=Dse,BDe=A.forwardRef(({className:e,...t},n)=>r.jsx(A3,{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}));BDe.displayName=A3.displayName;const out=y3("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"}}),dP=A.forwardRef(({side:e="right",className:t,children:n,...s},a)=>r.jsxs(iut,{children:[r.jsx(BDe,{}),r.jsxs(E3,{ref:a,className:Ut(out({side:e}),t),...s,children:[n,r.jsxs(Rse,{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(us,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));dP.displayName=E3.displayName;const Wse=({className:e,...t})=>r.jsx("div",{className:Ut("flex flex-col space-y-2 text-center sm:text-left",e),...t});Wse.displayName="SheetHeader";const Gse=A.forwardRef(({className:e,...t},n)=>r.jsx(oP,{ref:n,className:Ut("text-lg font-semibold text-foreground",e),...t}));Gse.displayName=oP.displayName;const lut=A.forwardRef(({className:e,...t},n)=>r.jsx(lP,{ref:n,className:Ut("text-sm text-muted-foreground",e),...t}));lut.displayName=lP.displayName;function cut(e,t){return A.useReducer((n,s)=>t[n][s]??n,e)}var rye="ScrollArea",[$De]=cc(rye),[dut,kf]=$De(rye),UDe=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)),Q=Mk(a);return r.jsx(dut,{scope:n,type:s,dir:Q,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(Bn.div,{dir:Q,...l,ref:G,style:{position:"relative","--radix-scroll-area-corner-width":I+"px","--radix-scroll-area-corner-height":P+"px",...e.style}})})});UDe.displayName=rye;var qDe="ScrollAreaViewport",VDe=A.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:s,nonce:a,...o}=e,l=kf(qDe,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(Bn.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})})]})});VDe.displayName=qDe;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(uut,{...s,ref:t,forceMount:n}):a.type==="scroll"?r.jsx(hut,{...s,ref:t,forceMount:n}):a.type==="auto"?r.jsx(HDe,{...s,ref:t,forceMount:n}):a.type==="always"?r.jsx(sye,{...s,ref:t}):null});nye.displayName=ox;var uut=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(HDe,{"data-state":o?"visible":"hidden",...s,ref:t})})}),hut=A.forwardRef((e,t)=>{const{forceMount:n,...s}=e,a=kf(ox,e.__scopeScrollArea),o=e.orientation==="horizontal",l=Zse(()=>u("SCROLL_END"),100),[i,u]=cut("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:xn(e.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:xn(e.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),HDe=A.forwardRef((e,t)=>{const n=kf(ox,e.__scopeScrollArea),{forceMount:s,...a}=e,[o,l]=A.useState(!1),i=e.orientation==="horizontal",u=Zse(()=>{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=YDe(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 yut(v,l.current,i,b)}return n==="horizontal"?r.jsx(mut,{...x,ref:t,onThumbPositionChange:()=>{if(a.viewport&&o.current){const v=a.viewport.scrollLeft,b=hNe(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(fut,{...x,ref:t,onThumbPositionChange:()=>{if(a.viewport&&o.current){const v=a.viewport.scrollTop,b=hNe(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}),mut=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(GDe,{"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":Kse(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),QDe(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:Xte(l.paddingLeft),paddingEnd:Xte(l.paddingRight)}})}})}),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.onScrollbarYChange);return A.useEffect(()=>{u.current&&i(getComputedStyle(u.current))},[u]),r.jsx(GDe,{"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":Kse(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),QDe(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:Xte(l.paddingTop),paddingEnd:Xte(l.paddingBottom)}})}})}),[put,WDe]=$De(ox),GDe=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=Zse(y,10);function W(G){if(I.current){const Q=G.clientX-I.current.left,ae=G.clientY-I.current.top;m({x:Q,y:ae})}}return A.useEffect(()=>{const G=Q=>{const ae=Q.target;(N==null?void 0:N.contains(ae))&&D(Q,F)};return document.addEventListener("wheel",G,{passive:!1}),()=>document.removeEventListener("wheel",G,{passive:!1})},[P,N,F,D]),A.useEffect(U,[s,U]),DC(N,V),DC(b.content,V),r.jsx(put,{scope:n,scrollbar:N,hasThumb:a,onThumbChange:sc(o),onThumbPointerUp:sc(l),onThumbPositionChange:U,onThumbPointerDown:sc(i),children:r.jsx(Bn.div,{...v,ref:M,style:{position:"absolute",...v.style},onPointerDown:xn(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:xn(e.onPointerMove,W),onPointerUp:xn(e.onPointerUp,G=>{const Q=G.target;Q.hasPointerCapture(G.pointerId)&&Q.releasePointerCapture(G.pointerId),document.body.style.webkitUserSelect=T.current,b.viewport&&(b.viewport.style.scrollBehavior=""),I.current=null})})})}),Yte="ScrollAreaThumb",KDe=A.forwardRef((e,t)=>{const{forceMount:n,...s}=e,a=WDe(Yte,e.__scopeScrollArea);return r.jsx(Ac,{present:n||a.hasThumb,children:r.jsx(gut,{ref:t,...s})})}),gut=A.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:s,...a}=e,o=kf(Yte,n),l=WDe(Yte,n),{onThumbPositionChange:i}=l,u=ca(t,y=>l.onThumbChange(y)),m=A.useRef(void 0),x=Zse(()=>{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=vut(y,i);m.current=b,i()}};return i(),y.addEventListener("scroll",v),()=>y.removeEventListener("scroll",v)}},[o.viewport,x,i]),r.jsx(Bn.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:xn(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:xn(e.onPointerUp,l.onThumbPointerUp)})});KDe.displayName=Yte;var aye="ScrollAreaCorner",ZDe=A.forwardRef((e,t)=>{const n=kf(aye,e.__scopeScrollArea),s=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&s?r.jsx(xut,{...e,ref:t}):null});ZDe.displayName=aye;var xut=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 DC(a.scrollbarX,()=>{var y;const x=((y=a.scrollbarX)==null?void 0:y.offsetHeight)||0;a.onCornerHeightChange(x),u(x)}),DC(a.scrollbarY,()=>{var y;const x=((y=a.scrollbarY)==null?void 0:y.offsetWidth)||0;a.onCornerWidthChange(x),l(x)}),m?r.jsx(Bn.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 Xte(e){return e?parseInt(e,10):0}function YDe(e,t){const n=e/t;return isNaN(n)?0:n}function Kse(e){const t=YDe(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=(e.scrollbar.size-n)*t;return Math.max(s,18)}function yut(e,t,n,s="ltr"){const a=Kse(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 XDe([u,m],y)(e)}function hNe(e,t,n="ltr"){const s=Kse(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=DE(e,u);return XDe([0,l],[0,i])(m)}function XDe(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 QDe(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 Zse(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 DC(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 JDe=UDe,_ut=VDe,but=ZDe;const Zo=A.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(JDe,{ref:s,className:Ut("relative overflow-hidden",e),...n,children:[r.jsx(_ut,{className:"h-full w-full rounded-[inherit]",children:t}),r.jsx(iye,{}),r.jsx(but,{})]}));Zo.displayName=JDe.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(KDe,{className:"relative flex-1 rounded-full bg-border"})}));iye.displayName=nye.displayName;var Yse="Collapsible",[wut]=cc(Yse),[jut,oye]=wut(Yse),e8e=A.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:s,defaultOpen:a,disabled:o,onOpenChange:l,...i}=e,[u,m]=sh({prop:s,defaultProp:a??!1,onChange:l,caller:Yse});return r.jsx(jut,{scope:n,disabled:o,contentId:gd(),open:u,onOpenToggle:A.useCallback(()=>m(x=>!x),[m]),children:r.jsx(Bn.div,{"data-state":cye(u),"data-disabled":o?"":void 0,...i,ref:t})})});e8e.displayName=Yse;var t8e="CollapsibleTrigger",r8e=A.forwardRef((e,t)=>{const{__scopeCollapsible:n,...s}=e,a=oye(t8e,n);return r.jsx(Bn.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:xn(e.onClick,a.onOpenToggle)})});r8e.displayName=t8e;var lye="CollapsibleContent",n8e=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(kut,{...s,ref:t,present:o})})});n8e.displayName=lye;var kut=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(Bn.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 Nut=e8e;const G4=Nut,K4=r8e,Z4=n8e,Sut="/assets/levelup-logo-Eif24dqY.png",Cut="/assets/levelup-logo-icon-C-7iromj.png",Mut="/assets/levelup-logo-mobile-B9skSjUG.png";var uP=e=>e.type==="checkbox",ij=e=>e instanceof Date,Wu=e=>e==null;const s8e=e=>typeof e=="object";var Cc=e=>!Wu(e)&&!Array.isArray(e)&&s8e(e)&&!ij(e),a8e=e=>Cc(e)&&e.target?uP(e.target)?e.target.checked:e.target.value:e,Tut=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,i8e=(e,t)=>e.has(Tut(t)),Aut=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&&!Aut(e))t=e;else for(const a in e)e.hasOwnProperty(a)&&(t[a]=nd(e[a]));else return e;return t}var Xse=e=>/^\w*$/.test(e),yc=e=>e===void 0,uye=e=>Array.isArray(e)?e.filter(Boolean):[],hye=e=>uye(e.replace(/["|']|\]/g,"").split(/\.|\[/)),rs=(e,t,n)=>{if(!t||!Cc(e))return n;const s=(Xse(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},am=e=>typeof e=="boolean",Eo=(e,t,n)=>{let s=-1;const a=Xse(t)?[t]:hye(t),o=a.length,l=o-1;for(;++sdt.useContext(mye),Eut=e=>{const{children:t,...n}=e;return dt.createElement(mye.Provider,{value:n},t)};var o8e=(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 Iut(e){const t=Qse(),{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(()=>o8e(l,n,u.current,!1),[l,n])}var Tg=e=>typeof e=="string",l8e=(e,t,n,s,a)=>Tg(e)?(s&&t.watch.add(e),rs(n,e,a)):Array.isArray(e)?e.map(o=>(s&&t.watch.add(o),rs(n,o))):(s&&(t.watchAll=!0),n),bme=e=>Wu(e)||!s8e(e);function Xx(e,t,n=new WeakSet){if(bme(e)||bme(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 Put(e){const t=Qse(),{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=l8e(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 Lut(e){const t=Qse(),{name:n,disabled:s,control:a=t.control,shouldUnregister:o,defaultValue:l}=e,i=i8e(a._names.array,n),u=dt.useMemo(()=>rs(a._formValues,n,rs(a._defaultValues,n,l)),[a,n,l]),m=Put({control:a,name:n,defaultValue:u,exact:!0}),x=Iut({control:a,name:n,exact:!0}),y=dt.useRef(e),v=dt.useRef(a.register(n,{...e.rules,value:m,...am(e.disabled)?{disabled:e.disabled}:{}}));y.current=e;const b=dt.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!rs(x.errors,n)},isDirty:{enumerable:!0,get:()=>!!rs(x.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!rs(x.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!rs(x.validatingFields,n)},error:{enumerable:!0,get:()=>rs(x.errors,n)}}),[x,n]),N=dt.useCallback(T=>v.current.onChange({target:{value:a8e(T),name:n},type:Qte.CHANGE}),[n]),k=dt.useCallback(()=>v.current.onBlur({target:{value:rs(a._formValues,n),name:n},type:Qte.BLUR}),[n,a._formValues]),M=dt.useCallback(T=>{const P=rs(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,...am(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,...am(y.current.disabled)?{disabled:y.current.disabled}:{}});const P=(F,D)=>{const U=rs(a._fields,F);U&&U._f&&(U._f.mount=D)};if(P(n,!0),T){const F=nd(rs(a._options.defaultValues,n));Eo(a._defaultValues,n,F),yc(rs(a._formValues,n))&&Eo(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 Out=e=>e.render(Lut(e));var c8e=(e,t,n,s,a)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[s]:a||!0}}:{},zA=e=>Array.isArray(e)?e:[e],mNe=()=>{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=[]}}},kh=e=>Cc(e)&&!Object.keys(e).length,pye=e=>e.type==="file",yp=e=>typeof e=="function",Jte=e=>{if(!dye)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},d8e=e=>e.type==="select-multiple",gye=e=>e.type==="radio",Dut=e=>gye(e)||uP(e),Uce=e=>Jte(e)&&e.isConnected;function Rut(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 ere(e,t={}){const n=Array.isArray(e);if(Cc(e)||n)for(const s in e)Array.isArray(e[s])||Cc(e[s])&&!u8e(e[s])?(t[s]=Array.isArray(e[s])?[]:{},ere(e[s],t[s])):Wu(e[s])||(t[s]=!0);return t}function h8e(e,t,n){const s=Array.isArray(e);if(Cc(e)||s)for(const a in e)Array.isArray(e[a])||Cc(e[a])&&!u8e(e[a])?yc(t)||bme(n[a])?n[a]=Array.isArray(e[a])?ere(e[a],[]):{...ere(e[a])}:h8e(e[a],Wu(t)?{}:t[a],n[a]):n[a]=!Xx(e[a],t[a]);return n}var iT=(e,t)=>h8e(e,t,ere(t));const fNe={value:!1,isValid:!1},pNe={value:!0,isValid:!0};var m8e=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===""?pNe:{value:e[0].value,isValid:!0}:pNe:fNe}return fNe},f8e=(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 gNe={isValid:!1,value:null};var p8e=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,gNe):gNe;function xNe(e){const t=e.ref;return pye(t)?t.files:gye(t)?p8e(e.refs).value:d8e(t)?[...t.selectedOptions].map(({value:n})=>n):uP(t)?m8e(e.refs).value:f8e(yc(t.value)?e.ref.value:t.value,e)}var zut=(e,t,n,s)=>{const a={};for(const o of e){const l=rs(t,o);l&&Eo(a,o,l._f)}return{criteriaMode:n,names:[...e],fields:a,shouldUseNativeValidation:s}},tre=e=>e instanceof RegExp,oT=e=>yc(e)?e:tre(e)?e.source:Cc(e)?tre(e.value)?e.value.source:e.value:e,yNe=e=>({isOnSubmit:!e||e===xp.onSubmit,isOnBlur:e===xp.onBlur,isOnChange:e===xp.onChange,isOnAll:e===xp.all,isOnTouch:e===xp.onTouched});const vNe="AsyncFunction";var But=e=>!!e&&!!e.validate&&!!(yp(e.validate)&&e.validate.constructor.name===vNe||Cc(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===vNe)),$ut=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),_Ne=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(s=>e.startsWith(s)&&/^\.\w+/.test(e.slice(s.length))));const BA=(e,t,n,s)=>{for(const a of n||Object.keys(e)){const o=rs(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(BA(i,t))break}else if(Cc(i)&&BA(i,t))break}}};function bNe(e,t,n){const s=rs(e,n);if(s||Xse(n))return{error:s,name:n};const a=n.split(".");for(;a.length;){const o=a.join("."),l=rs(t,o),i=rs(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 Uut=(e,t,n,s)=>{n(e);const{name:a,...o}=e;return kh(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(l=>t[l]===(!s||xp.all))},qut=(e,t,n)=>!e||!t||e===t||zA(e).some(s=>s&&(n?s===t:s.startsWith(t)||t.startsWith(s))),Vut=(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,Hut=(e,t)=>!uye(rs(e,t)).length&&Rc(e,t),Wut=(e,t,n)=>{const s=zA(rs(e,n));return Eo(s,"root",t[n]),Eo(e,n,s),e},qee=e=>Tg(e);function wNe(e,t,n="validate"){if(qee(e)||Array.isArray(e)&&e.every(qee)||am(e)&&!e)return{type:n,message:qee(e)?e:"",ref:t}}var CS=e=>Cc(e)&&!tre(e)?e:{value:e,message:""},jNe=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=rs(n,k);if(!I||t.has(k))return{};const P=i?i[0]:l,F=oe=>{a&&P.reportValidity&&(P.setCustomValidity(am(oe)?"":oe||""),P.reportValidity())},D={},U=gye(l),V=uP(l),W=U||V,G=(M||pye(l))&&yc(l.value)&&yc(T)||Jte(l)&&l.value===""||T===""||Array.isArray(T)&&!T.length,Q=c8e.bind(null,k,s,D),ae=(oe,de,se,pe=Lx.maxLength,ne=Lx.minLength)=>{const me=oe?de:se;D[k]={type:oe?pe:ne,message:me,ref:l,...Q(oe?pe:ne,me)}};if(o?!Array.isArray(T)||!T.length:u&&(!W&&(G||Wu(T))||am(T)&&!T||V&&!m8e(i).isValid||U&&!p8e(i).isValid)){const{value:oe,message:de}=qee(u)?{value:!!u,message:u}:CS(u);if(oe&&(D[k]={type:Lx.required,message:de,ref:P,...Q(Lx.required,de)},!s))return F(de),D}if(!G&&(!Wu(y)||!Wu(v))){let oe,de;const se=CS(v),pe=CS(y);if(!Wu(T)&&!isNaN(T)){const ne=l.valueAsNumber||T&&+T;Wu(se.value)||(oe=ne>se.value),Wu(pe.value)||(de=nenew Date(new Date().toDateString()+" "+Te),he=l.type=="time",xe=l.type=="week";Tg(se.value)&&T&&(oe=he?me(T)>me(se.value):xe?T>se.value:ne>new Date(se.value)),Tg(pe.value)&&T&&(de=he?me(T)+oe.value,pe=!Wu(de.value)&&T.length<+de.value;if((se||pe)&&(ae(se,oe.message,de.message),!s))return F(D[k].message),D}if(b&&!G&&Tg(T)){const{value:oe,message:de}=CS(b);if(tre(oe)&&!T.match(oe)&&(D[k]={type:Lx.pattern,message:de,ref:l,...Q(Lx.pattern,de)},!s))return F(de),D}if(N){if(yp(N)){const oe=await N(T,n),de=wNe(oe,P);if(de&&(D[k]={...de,...Q(Lx.validate,de.message)},!s))return F(de.message),D}else if(Cc(N)){let oe={};for(const de in N){if(!kh(oe)&&!s)break;const se=wNe(await N[de](T,n),P,de);se&&(oe={...se,...Q(de,se.message)},F(se.message),s&&(D[k]=oe))}if(!kh(oe)&&(D[k]={ref:P,...oe},!s))return D}}return F(!0),D};const Gut={mode:xp.onSubmit,reValidateMode:xp.onChange,shouldFocusError:!0};function Kut(e={}){let t={...Gut,...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:mNe(),state:mNe()},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?kh((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(Ye=>{Ye&&(Ee?Eo(n.validatingFields,Ye,Ee):Rc(n.validatingFields,Ye))}),v.state.next({validatingFields:n.validatingFields,isValidating:!kh(n.validatingFields)}))},I=(Ce,Ee=[],Ye,Le,Ke=!0,tt=!0)=>{if(Le&&Ye&&!t.disabled){if(l.action=!0,tt&&Array.isArray(rs(s,Ce))){const ct=Ye(rs(s,Ce),Le.argA,Le.argB);Ke&&Eo(s,Ce,ct)}if(tt&&Array.isArray(rs(n.errors,Ce))){const ct=Ye(rs(n.errors,Ce),Le.argA,Le.argB);Ke&&Eo(n.errors,Ce,ct),Hut(n.errors,Ce)}if((x.touchedFields||y.touchedFields)&&tt&&Array.isArray(rs(n.touchedFields,Ce))){const ct=Ye(rs(n.touchedFields,Ce),Le.argA,Le.argB);Ke&&Eo(n.touchedFields,Ce,ct)}(x.dirtyFields||y.dirtyFields)&&(n.dirtyFields=iT(a,o)),v.state.next({name:Ce,isDirty:ae(Ce,Ee),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Eo(o,Ce,Ee)},T=(Ce,Ee)=>{Eo(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,Ye,Le)=>{const Ke=rs(s,Ce);if(Ke){const tt=rs(o,Ce,yc(Ye)?rs(a,Ce):Ye);yc(tt)||Le&&Le.defaultChecked||Ee?Eo(o,Ce,Ee?tt:xNe(Ke._f)):se(Ce,tt),l.mount&&k()}},D=(Ce,Ee,Ye,Le,Ke)=>{let tt=!1,ct=!1;const it={name:Ce};if(!t.disabled){if(!Ye||Le){(x.isDirty||y.isDirty)&&(ct=n.isDirty,n.isDirty=it.isDirty=ae(),tt=ct!==it.isDirty);const zt=Xx(rs(a,Ce),Ee);ct=!!rs(n.dirtyFields,Ce),zt?Rc(n.dirtyFields,Ce):Eo(n.dirtyFields,Ce,!0),it.dirtyFields=n.dirtyFields,tt=tt||(x.dirtyFields||y.dirtyFields)&&ct!==!zt}if(Ye){const zt=rs(n.touchedFields,Ce);zt||(Eo(n.touchedFields,Ce,Ye),it.touchedFields=n.touchedFields,tt=tt||(x.touchedFields||y.touchedFields)&&zt!==Ye)}tt&&Ke&&v.state.next(it)}return tt?it:{}},U=(Ce,Ee,Ye,Le)=>{const Ke=rs(n.errors,Ce),tt=(x.isValid||y.isValid)&&am(Ee)&&n.isValid!==Ee;if(t.delayError&&Ye?(u=N(()=>T(Ce,Ye)),u(t.delayError)):(clearTimeout(m),u=null,Ye?Eo(n.errors,Ce,Ye):Rc(n.errors,Ce)),(Ye?!Xx(Ke,Ye):Ke)||!kh(Le)||tt){const ct={...Le,...tt&&am(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,zut(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 Ye of Ce){const Le=rs(Ee,Ye);Le?Eo(n.errors,Ye,Le):Rc(n.errors,Ye)}else n.errors=Ee;return Ee},G=async(Ce,Ee,Ye={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&&But(Ke._f);zt&&x.validatingFields&&M([Le],!0);const ir=await jNe(Ke,i.disabled,o,b,t.shouldUseNativeValidation&&!Ee,it);if(zt&&x.validatingFields&&M([Le]),ir[tt.name]&&(Ye.valid=!1,Ee))break;!Ee&&(rs(ir,tt.name)?it?Wut(n.errors,ir,tt.name):Eo(n.errors,tt.name,ir[tt.name]):Rc(n.errors,tt.name))}!kh(ct)&&await G(ct,Ee,Ye)}}return Ye.valid},Q=()=>{for(const Ce of i.unMount){const Ee=rs(s,Ce);Ee&&(Ee._f.refs?Ee._f.refs.every(Ye=>!Uce(Ye)):!Uce(Ee._f.ref))&&$e(Ce)}i.unMount=new Set},ae=(Ce,Ee)=>!t.disabled&&(Ce&&Ee&&Eo(o,Ce,Ee),!Xx(Te(),a)),oe=(Ce,Ee,Ye)=>l8e(Ce,i,{...l.mount?o:yc(Ee)?a:Tg(Ce)?{[Ce]:Ee}:Ee},Ye,Ee),de=Ce=>uye(rs(l.mount?o:a,Ce,t.shouldUnregister?rs(a,Ce,[]):[])),se=(Ce,Ee,Ye={})=>{const Le=rs(s,Ce);let Ke=Ee;if(Le){const tt=Le._f;tt&&(!tt.disabled&&Eo(o,Ce,f8e(Ee,tt)),Ke=Jte(tt.ref)&&Wu(Ee)?"":Ee,d8e(tt.ref)?[...tt.ref.options].forEach(ct=>ct.selected=Ke.includes(ct.value)):tt.refs?uP(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)})))}(Ye.shouldDirty||Ye.shouldTouch)&&D(Ce,Ke,Ye.shouldTouch,Ye.shouldDirty,!0),Ye.shouldValidate&&xe(Ce)},pe=(Ce,Ee,Ye)=>{for(const Le in Ee){if(!Ee.hasOwnProperty(Le))return;const Ke=Ee[Le],tt=Ce+"."+Le,ct=rs(s,tt);(i.array.has(Ce)||Cc(Ke)||ct&&!ct._f)&&!ij(Ke)?pe(tt,Ke,Ye):se(tt,Ke,Ye)}},ne=(Ce,Ee,Ye={})=>{const Le=rs(s,Ce),Ke=i.array.has(Ce),tt=nd(Ee);Eo(o,Ce,tt),Ke?(v.array.next({name:Ce,values:nd(o)}),(x.isDirty||x.dirtyFields||y.isDirty||y.dirtyFields)&&Ye.shouldDirty&&v.state.next({name:Ce,dirtyFields:iT(a,o),isDirty:ae(Ce,tt)})):Le&&!Le._f&&!Wu(tt)?pe(Ce,tt,Ye):se(Ce,tt,Ye),_Ne(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 Ye=Ee.name,Le=!0;const Ke=rs(s,Ye),tt=zt=>{Le=Number.isNaN(zt)||ij(zt)&&isNaN(zt.getTime())||Xx(zt,rs(o,Ye,zt))},ct=yNe(t.mode),it=yNe(t.reValidateMode);if(Ke){let zt,ir;const Mr=Ee.type?xNe(Ke._f):a8e(Ce),Zr=Ce.type===Qte.BLUR||Ce.type===Qte.FOCUS_OUT,Br=!$ut(Ke._f)&&!t.resolver&&!rs(n.errors,Ye)&&!Ke._f.deps||Vut(Zr,rs(n.touchedFields,Ye),n.isSubmitted,it,ct),rn=_Ne(Ye,i,Zr);Eo(o,Ye,Mr),Zr?(Ke._f.onBlur&&Ke._f.onBlur(Ce),u&&u(0)):Ke._f.onChange&&Ke._f.onChange(Ce);const Zn=D(Ye,Mr,Zr),Ot=!kh(Zn)||rn;if(!Zr&&v.state.next({name:Ye,type:Ce.type,values:nd(o)}),Br)return(x.isValid||y.isValid)&&(t.mode==="onBlur"?Zr&&k():Zr||k()),Ot&&v.state.next({name:Ye,...rn?{}:Zn});if(!Zr&&rn&&v.state.next({...n}),t.resolver){const{errors:Gr}=await V([Ye]);if(tt(Mr),Le){const An=bNe(n.errors,s,Ye),zn=bNe(Gr,s,An.name||Ye);zt=zn.error,Ye=zn.name,ir=kh(Gr)}}else M([Ye],!0),zt=(await jNe(Ke,i.disabled,o,b,t.shouldUseNativeValidation))[Ye],M([Ye]),tt(Mr),Le&&(zt?ir=!1:(x.isValid||y.isValid)&&(ir=await G(s,!0)));Le&&(Ke._f.deps&&xe(Ke._f.deps),U(Ye,ir,zt,Zn))}},he=(Ce,Ee)=>{if(rs(n.errors,Ee)&&Ce.focus)return Ce.focus(),1},xe=async(Ce,Ee={})=>{let Ye,Le;const Ke=zA(Ce);if(t.resolver){const tt=await W(yc(Ce)?Ce:Ke);Ye=kh(tt),Le=Ce?!Ke.some(ct=>rs(tt,ct)):Ye}else Ce?(Le=(await Promise.all(Ke.map(async tt=>{const ct=rs(s,tt);return await G(ct&&ct._f?{[tt]:ct}:ct)}))).every(Boolean),!(!Le&&!n.isValid)&&k()):Le=Ye=await G(s);return v.state.next({...!Tg(Ce)||(x.isValid||y.isValid)&&Ye!==n.isValid?{}:{name:Ce},...t.resolver||!Ce?{isValid:Ye}:{},errors:n.errors}),Ee.shouldFocus&&!Le&&BA(s,he,Ce?Ke:i.mount),Le},Te=Ce=>{const Ee={...l.mount?o:a};return yc(Ce)?Ee:Tg(Ce)?rs(Ee,Ce):Ce.map(Ye=>rs(Ee,Ye))},be=(Ce,Ee)=>({invalid:!!rs((Ee||n).errors,Ce),isDirty:!!rs((Ee||n).dirtyFields,Ce),error:rs((Ee||n).errors,Ce),isValidating:!!rs(n.validatingFields,Ce),isTouched:!!rs((Ee||n).touchedFields,Ce)}),we=Ce=>{Ce&&zA(Ce).forEach(Ee=>Rc(n.errors,Ee)),v.state.next({errors:Ce?n.errors:{}})},ve=(Ce,Ee,Ye)=>{const Le=(rs(s,Ce,{_f:{}})._f||{}).ref,Ke=rs(n.errors,Ce)||{},{ref:tt,message:ct,type:it,...zt}=Ke;Eo(n.errors,Ce,{...zt,...Ee,ref:Le}),v.state.next({name:Ce,errors:n.errors,isValid:!1}),Ye&&Ye.shouldFocus&&Le&&Le.focus&&Le.focus()},et=(Ce,Ee)=>yp(Ce)?v.state.subscribe({next:Ye=>"values"in Ye&&Ce(oe(void 0,Ee),Ye)}):oe(Ce,Ee,!0),Me=Ce=>v.state.subscribe({next:Ee=>{qut(Ce.name,Ee.name,Ce.exact)&&Uut(Ee,Ce.formState||x,rt,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 Ye of Ce?zA(Ce):i.mount)i.mount.delete(Ye),i.array.delete(Ye),Ee.keepValue||(Rc(s,Ye),Rc(o,Ye)),!Ee.keepError&&Rc(n.errors,Ye),!Ee.keepDirty&&Rc(n.dirtyFields,Ye),!Ee.keepTouched&&Rc(n.touchedFields,Ye),!Ee.keepIsValidating&&Rc(n.validatingFields,Ye),!t.shouldUnregister&&!Ee.keepDefaultValue&&Rc(a,Ye);v.state.next({values:nd(o)}),v.state.next({...n,...Ee.keepDirty?{isDirty:ae()}:{}}),!Ee.keepIsValid&&k()},Be=({disabled:Ce,name:Ee})=>{(am(Ce)&&l.mount||Ce||i.disabled.has(Ee))&&(Ce?i.disabled.add(Ee):i.disabled.delete(Ee))},Ve=(Ce,Ee={})=>{let Ye=rs(s,Ce);const Le=am(Ee.disabled)||am(t.disabled);return Eo(s,Ce,{...Ye||{},_f:{...Ye&&Ye._f?Ye._f:{ref:{name:Ce}},name:Ce,mount:!0,...Ee}}),i.mount.add(Ce),Ye?Be({disabled:am(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:oT(Ee.min),max:oT(Ee.max),minLength:oT(Ee.minLength),maxLength:oT(Ee.maxLength),pattern:oT(Ee.pattern)}:{},name:Ce,onChange:me,onBlur:me,ref:Ke=>{if(Ke){Ve(Ce,Ee),Ye=rs(s,Ce);const tt=yc(Ke.value)&&Ke.querySelectorAll&&Ke.querySelectorAll("input,select,textarea")[0]||Ke,ct=Dut(tt),it=Ye._f.refs||[];if(ct?it.find(zt=>zt===tt):tt===Ye._f.ref)return;Eo(s,Ce,{_f:{...Ye._f,...ct?{refs:[...it.filter(Uce),tt,...Array.isArray(rs(a,Ce))?[{}]:[]],ref:{type:tt.type,name:Ce}}:{ref:tt}}}),F(Ce,!1,void 0,tt)}else Ye=rs(s,Ce,{}),Ye._f&&(Ye._f.mount=!1),(t.shouldUnregister||Ee.shouldUnregister)&&!(i8e(i.array,Ce)&&l.action)&&i.unMount.add(Ce)}}},ot=()=>t.shouldFocusError&&BA(s,he,i.mount),At=Ce=>{am(Ce)&&(v.state.next({disabled:Ce}),BA(s,(Ee,Ye)=>{const Le=rs(s,Ye);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 Ye=>{let Le;Ye&&(Ye.preventDefault&&Ye.preventDefault(),Ye.persist&&Ye.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"),kh(n.errors)){v.state.next({errors:{}});try{await Ce(Ke,Ye)}catch(tt){Le=tt}}else Ee&&await Ee({...n.errors},Ye),ot(),setTimeout(ot);if(v.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:kh(n.errors)&&!Le,submitCount:n.submitCount+1,errors:n.errors}),Le)throw Le},at=(Ce,Ee={})=>{rs(s,Ce)&&(yc(Ee.defaultValue)?ne(Ce,nd(rs(a,Ce))):(ne(Ce,Ee.defaultValue),Eo(a,Ce,nd(Ee.defaultValue))),Ee.keepTouched||Rc(n.touchedFields,Ce),Ee.keepDirty||(Rc(n.dirtyFields,Ce),n.isDirty=Ee.defaultValue?ae(Ce,nd(rs(a,Ce))):ae()),Ee.keepError||(Rc(n.errors,Ce),x.isValid&&k()),v.state.next({...n}))},le=(Ce,Ee={})=>{const Ye=Ce?nd(Ce):a,Le=nd(Ye),Ke=kh(Ce),tt=Ke?a:Le;if(Ee.keepDefaultValues||(a=Ye),!Ee.keepValues){if(Ee.keepDirtyValues){const ct=new Set([...i.mount,...Object.keys(iT(a,o))]);for(const it of Array.from(ct))rs(n.dirtyFields,it)?Eo(tt,it,rs(o,it)):ne(it,rs(tt,it))}else{if(dye&&yc(Ce))for(const ct of i.mount){const it=rs(s,ct);if(it&&it._f){const zt=Array.isArray(it._f.refs)?it._f.refs[0]:it._f.ref;if(Jte(zt)){const ir=zt.closest("form");if(ir){ir.reset();break}}}}if(Ee.keepFieldsRef)for(const ct of i.mount)ne(ct,rs(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?iT(a,o):n.dirtyFields:Ee.keepDefaultValues&&Ce?iT(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),Qe=(Ce,Ee={})=>{const Ye=rs(s,Ce),Le=Ye&&Ye._f;if(Le){const Ke=Le.refs?Le.refs[0]:Le.ref;Ke.focus&&(Ke.focus(),Ee.shouldSelect&&yp(Ke.select)&&Ke.select())}},rt=Ce=>{n={...n,...Ce}},ut={control:{register:Ve,unregister:$e,getFieldState:be,handleSubmit:Oe,setError:ve,_subscribe:Me,_runSchema:V,_focusError:ot,_getWatch:oe,_getDirty:ae,_setValid:k,_setFieldArray:I,_setDisabledField:Be,_setErrors:P,_getFieldArray:de,_reset:le,_resetDefaultValues:()=>yp(t.defaultValues)&&t.defaultValues().then(Ce=>{qe(Ce,t.resetOptions),v.state.next({isLoading:!1})}),_removeUnmounted:Q,_disableForm:At,_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:et,setValue:ne,getValues:Te,reset:qe,resetField:at,clearErrors:we,unregister:$e,setError:ve,setFocus:Qe,getFieldState:be};return{...ut,formControl:ut}}function Jse(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}=Kut(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=o8e(s,o),t.current}const kNe=(e,t,n)=>{if(e&&"reportValidity"in e){const s=rs(n,t);e.setCustomValidity(s&&s.message||""),e.reportValidity()}},g8e=(e,t)=>{for(const n in t.fields){const s=t.fields[n];s&&s.ref&&"reportValidity"in s.ref?kNe(s.ref,n,e):s.refs&&s.refs.forEach(a=>kNe(a,n,e))}},Zut=(e,t)=>{t.shouldUseNativeValidation&&g8e(e,t);const n={};for(const s in e){const a=rs(t.fields,s),o=Object.assign(e[s]||{},{ref:a&&a.ref});if(Yut(t.names||Object.keys(e),s)){const l=Object.assign({},rs(n,s));Eo(l,"root",o),Eo(n,s,l)}else Eo(n,s,o)}return n},Yut=(e,t)=>e.some(n=>n.startsWith(t+"."));var Xut=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]=c8e(l,t,n,a,m?[].concat(m,s.message):s.message)}e.shift()}return n},eae=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&&g8e({},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:Zut(Xut(l.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw l}))}catch(l){return Promise.reject(l)}}};const tae=Eut,x8e=A.createContext({}),Ol=({...e})=>r.jsx(x8e.Provider,{value:{name:e.name},children:r.jsx(Out,{...e})}),rae=()=>{const e=A.useContext(x8e),t=A.useContext(y8e),{getFieldState:n,formState:s}=Qse(),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}},y8e=A.createContext({}),Sl=A.forwardRef(({className:e,...t},n)=>{const s=A.useId();return r.jsx(y8e.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}=rae();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}=rae();return r.jsx(Jge,{ref:t,id:s,"aria-describedby":n?`${a} ${o}`:`${a}`,"aria-invalid":!!n,...e})});Ml.displayName="FormControl";const Vee=A.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:s}=rae();return r.jsx("p",{ref:n,id:s,className:Ut("text-sm text-muted-foreground",e),...t})});Vee.displayName="FormDescription";const Ku=A.forwardRef(({className:e,children:t,...n},s)=>{const{error:a,formMessageId:o}=rae(),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});Ku.displayName="FormMessage";const Xn=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}));Xn.displayName="Textarea";const Qut=P3({category:DDe(["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)}),Jut={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function wme({trigger:e}){const[t,n]=A.useState(!1),[s,a]=A.useState(!1),{user:o}=tn(),l=Jse({resolver:eae(Qut),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:Jut[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(Or,{open:t,onOpenChange:n,children:[r.jsx(Co,{asChild:!0,children:e||r.jsxs(X,{variant:"ghost",size:"icon",className:"relative",children:[r.jsx(mA,{className:"h-5 w-5"}),r.jsx("span",{className:"sr-only",children:"Support"})]})}),r.jsxs(Lr,{className:"sm:max-w-[500px]",children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Need Help?"}),r.jsx(Qn,{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(Ii,{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(tae,{...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(hn,{onValueChange:u.onChange,defaultValue:u.value,children:[r.jsx(Ml,{children:r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select a category"})})}),r.jsxs(dn,{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(Ku,{})]})}),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(Ku,{})]})}),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(Xn,{placeholder:"Please describe your issue in detail...",className:"min-h-[120px]",...u})}),r.jsx(Ku,{})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(X,{type:"button",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),r.jsx(X,{type:"submit",disabled:s,children:s?"Submitting...":"Submit Ticket"})]})]})})]})]})}function Es(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 Po(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Ql(e,t){const n=Es(e);return isNaN(t)?Po(e,NaN):(t&&n.setDate(n.getDate()+t),n)}function zh(e,t){const n=Es(e);if(isNaN(t))return Po(e,NaN);if(!t)return n;const s=n.getDate(),a=Po(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 v8e(e,t){const n=+Es(e);return Po(e,n+t)}const xye=6048e5,eht=864e5,_8e=6e4,b8e=36e5,tht=1e3,cO=43200,NNe=1440;function SNe(e,t){return v8e(e,t*b8e)}let rht={};function Mv(){return rht}function Sm(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=Es(e),o=a.getDay(),l=(o=a.getTime()?n+1:t.getTime()>=l.getTime()?n:n-1}function Cm(e){const t=Es(e);return t.setHours(0,0,0,0),t}function gv(e){const t=Es(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=Cm(e),s=Cm(t),a=+n-gv(n),o=+s-gv(s);return Math.round((a-o)/eht)}function nht(e){const t=w8e(e),n=Po(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Iy(n)}function CNe(e,t){return v8e(e,t*_8e)}function oj(e,t){const n=t*7;return Ql(e,n)}function sht(e,t){return zh(e,t*12)}function aht(e){let t;return e.forEach(function(n){const s=Es(n);(t===void 0||t{const s=Es(n);(!t||t>s||isNaN(+s))&&(t=s)}),t||new Date(NaN)}function Hee(e,t){const n=Es(e),s=Es(t),a=n.getTime()-s.getTime();return a<0?-1:a>0?1:a}function oht(e){return Po(e,Date.now())}function ac(e,t){const n=Cm(e),s=Cm(t);return+n==+s}function yye(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function jme(e){if(!yye(e)&&typeof e!="number")return!1;const t=Es(e);return!isNaN(Number(t))}function RC(e,t){const n=Es(e),s=Es(t),a=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return a*12+o}function lht(e,t,n){const s=Sm(e,n),a=Sm(t,n),o=+s-gv(s),l=+a-gv(a);return Math.round((o-l)/xye)}function Py(e,t){const n=Es(e),s=Es(t),a=MNe(n,s),o=Math.abs(jp(n,s));n.setDate(n.getDate()-a*o);const l=+(MNe(n,s)===-a),i=a*(o-l);return i===0?0:i}function MNe(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 cht(e){return t=>{const s=(e?Math[e]:Math.trunc)(t);return s===0?0:s}}function dht(e,t){return+Es(e)-+Es(t)}function uht(e){const t=Es(e);return t.setHours(23,59,59,999),t}function nae(e){const t=Es(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function hht(e){const t=Es(e);return+uht(t)==+nae(t)}function mht(e,t){const n=Es(e),s=Es(t),a=Hee(n,s),o=Math.abs(RC(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=Hee(n,s)===-a;hht(Es(e))&&o===1&&Hee(e,s)===1&&(i=!1),l=a*(o-Number(i))}return l===0?0:l}function fht(e,t,n){const s=dht(e,t)/1e3;return cht(n==null?void 0:n.roundingMethod)(s)}function Rh(e){const t=Es(e);return t.setDate(1),t.setHours(0,0,0,0),t}function j8e(e){const t=Es(e),n=Po(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=Es(e),o=a.getDay(),l=(o{let s;const a=pht[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 qce(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const xht={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},yht={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},vht={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},_ht={date:qce({formats:xht,defaultWidth:"full"}),time:qce({formats:yht,defaultWidth:"full"}),dateTime:qce({formats:vht,defaultWidth:"full"})},bht={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},wht=(e,t,n,s)=>bht[e];function lT(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 jht={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},kht={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Nht={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"]},Sht={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"]},Cht={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"}},Mht={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"}},Tht=(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"},Aht={ordinalNumber:Tht,era:lT({values:jht,defaultWidth:"wide"}),quarter:lT({values:kht,defaultWidth:"wide",argumentCallback:e=>e-1}),month:lT({values:Nht,defaultWidth:"wide"}),day:lT({values:Sht,defaultWidth:"wide"}),dayPeriod:lT({values:Cht,defaultWidth:"wide",formattingValues:Mht,defaultFormattingWidth:"wide"})};function cT(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)?Iht(i,y=>y.test(l)):Eht(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 Eht(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Iht(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 Lht=/^(\d+)(th|st|nd|rd)?/i,Oht=/\d+/i,Dht={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},Rht={any:[/^b/i,/^(a|c)/i]},Fht={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},zht={any:[/1/i,/2/i,/3/i,/4/i]},Bht={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},$ht={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]},Uht={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},qht={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]},Vht={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},Hht={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}},Wht={ordinalNumber:Pht({matchPattern:Lht,parsePattern:Oht,valueCallback:e=>parseInt(e,10)}),era:cT({matchPatterns:Dht,defaultMatchWidth:"wide",parsePatterns:Rht,defaultParseWidth:"any"}),quarter:cT({matchPatterns:Fht,defaultMatchWidth:"wide",parsePatterns:zht,defaultParseWidth:"any",valueCallback:e=>e+1}),month:cT({matchPatterns:Bht,defaultMatchWidth:"wide",parsePatterns:$ht,defaultParseWidth:"any"}),day:cT({matchPatterns:Uht,defaultMatchWidth:"wide",parsePatterns:qht,defaultParseWidth:"any"}),dayPeriod:cT({matchPatterns:Vht,defaultMatchWidth:"any",parsePatterns:Hht,defaultParseWidth:"any"})},sae={code:"en-US",formatDistance:ght,formatLong:_ht,formatRelative:wht,localize:Aht,match:Wht,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ght(e){const t=Es(e);return jp(t,j8e(t))+1}function _ye(e){const t=Es(e),n=+Iy(t)-+nht(t);return Math.round(n/xye)+1}function bye(e,t){var x,y,v,b;const n=Es(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=Po(e,0);l.setFullYear(s+1,0,o),l.setHours(0,0,0,0);const i=Sm(l,t),u=Po(e,0);u.setFullYear(s,0,o),u.setHours(0,0,0,0);const m=Sm(u,t);return n.getTime()>=i.getTime()?s+1:n.getTime()>=m.getTime()?s:s-1}function Kht(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=Po(e,0);return o.setFullYear(a,0,s),o.setHours(0,0,0,0),Sm(o,t)}function wye(e,t){const n=Es(e),s=+Sm(n,t)-+Kht(n,t);return Math.round(s/xye)+1}function Io(e,t){const n=e<0?"-":"",s=Math.abs(e).toString().padStart(t,"0");return n+s}const B0={y(e,t){const n=e.getFullYear(),s=n>0?n:1-n;return Io(t==="yy"?s%100:s,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):Io(n+1,2)},d(e,t){return Io(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 Io(e.getHours()%12||12,t.length)},H(e,t){return Io(e.getHours(),t.length)},m(e,t){return Io(e.getMinutes(),t.length)},s(e,t){return Io(e.getSeconds(),t.length)},S(e,t){const n=t.length,s=e.getMilliseconds(),a=Math.trunc(s*Math.pow(10,n-3));return Io(a,t.length)}},MS={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},TNe={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 B0.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 Io(l,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):Io(o,t.length)},R:function(e,t){const n=w8e(e);return Io(n,t.length)},u:function(e,t){const n=e.getFullYear();return Io(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 Io(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 Io(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 B0.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 Io(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"}):Io(a,t.length)},I:function(e,t,n){const s=_ye(e);return t==="Io"?n.ordinalNumber(s,{unit:"week"}):Io(s,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):B0.d(e,t)},D:function(e,t,n){const s=Ght(e);return t==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):Io(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 Io(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 Io(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 Io(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 B0.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):B0.H(e,t)},K:function(e,t,n){const s=e.getHours()%12;return t==="Ko"?n.ordinalNumber(s,{unit:"hour"}):Io(s,t.length)},k:function(e,t,n){let s=e.getHours();return s===0&&(s=24),t==="ko"?n.ordinalNumber(s,{unit:"hour"}):Io(s,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):B0.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):B0.s(e,t)},S:function(e,t){return B0.S(e,t)},X:function(e,t,n){const s=e.getTimezoneOffset();if(s===0)return"Z";switch(t){case"X":return ENe(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 ENe(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"+ANe(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"+ANe(s,":");case"zzzz":default:return"GMT"+Gw(s,":")}},t:function(e,t,n){const s=Math.trunc(e.getTime()/1e3);return Io(s,t.length)},T:function(e,t,n){const s=e.getTime();return Io(s,t.length)}};function ANe(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+Io(o,2)}function ENe(e,t){return e%60===0?(e>0?"-":"+")+Io(Math.abs(e)/60,2):Gw(e,t)}function Gw(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),a=Io(Math.trunc(s/60),2),o=Io(s%60,2);return n+a+t+o}const INe=(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"})}},N8e=(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"})}},Zht=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],s=n[1],a=n[2];if(!a)return INe(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}}",INe(s,t)).replace("{{time}}",N8e(a,t))},kme={p:N8e,P:Zht},Yht=/^D+$/,Xht=/^Y+$/,Qht=["D","DD","YY","YYYY"];function S8e(e){return Yht.test(e)}function C8e(e){return Xht.test(e)}function Nme(e,t,n){const s=Jht(e,t,n);if(console.warn(s),Qht.includes(e))throw new RangeError(s)}function Jht(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 emt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,tmt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,rmt=/^'([^]*?)'?$/,nmt=/''/g,smt=/[a-zA-Z]/;function ln(e,t,n){var x,y,v,b,N,k,M,I;const s=Mv(),a=(n==null?void 0:n.locale)??s.locale??sae,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=Es(e);if(!jme(i))throw new RangeError("Invalid time value");let u=t.match(tmt).map(T=>{const P=T[0];if(P==="p"||P==="P"){const F=kme[P];return F(T,a.formatLong)}return T}).join("").match(emt).map(T=>{if(T==="''")return{isToken:!1,value:"'"};const P=T[0];if(P==="'")return{isToken:!1,value:amt(T)};if(TNe[P])return{isToken:!0,value:T};if(P.match(smt))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)&&C8e(P)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&S8e(P))&&Nme(P,t,String(e));const F=TNe[P[0]];return F(i,P,a.localize,m)}).join("")}function amt(e){const t=e.match(rmt);return t?t[1].replace(nmt,"'"):e}function imt(e,t,n){const s=Mv(),a=(n==null?void 0:n.locale)??s.locale??sae,o=2520,l=Hee(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=Es(t),m=Es(e)):(u=Es(e),m=Es(t));const x=fht(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 aae(e,t){const n=Es(e),s=Es(t);return+n<+s}function mmt(e){return+Es(e)>Date.now()}function fmt(e,t){const n=t instanceof Date?Po(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 pmt=10;class M8e{constructor(){ts(this,"subPriority",0)}validate(t,n){return!0}}class gmt extends M8e{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 xmt extends M8e{constructor(){super(...arguments);ts(this,"priority",pmt);ts(this,"subPriority",-1)}set(n,s){return s.timestampIsSet?n:Po(n,fmt(n,Date))}}class wo{run(t,n,s,a){const o=this.parse(t,n,s,a);return o?{setter:new gmt(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}validate(t,n,s){return!0}}class ymt extends wo{constructor(){super(...arguments);ts(this,"priority",140);ts(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*b8e+o*_8e+l*tht),rest:t.slice(n[0].length)}}function T8e(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 nre(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 A8e(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 E8e(e){return e%400===0||e%4===0&&e%100!==0}class vmt extends wo{constructor(){super(...arguments);ts(this,"priority",130);ts(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=A8e(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 _mt extends wo{constructor(){super(...arguments);ts(this,"priority",130);ts(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=A8e(a.year,l);return n.setFullYear(u,0,o.firstWeekContainsDate),n.setHours(0,0,0,0),Sm(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),Sm(n,o)}}class bmt extends wo{constructor(){super(...arguments);ts(this,"priority",130);ts(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(n,s){return nre(s==="R"?4:s.length,n)}set(n,s,a){const o=Po(n,0);return o.setFullYear(a,0,4),o.setHours(0,0,0,0),Iy(o)}}class wmt extends wo{constructor(){super(...arguments);ts(this,"priority",130);ts(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(n,s){return nre(s==="u"?4:s.length,n)}set(n,s,a){return n.setFullYear(a,0,1),n.setHours(0,0,0,0),n}}class jmt extends wo{constructor(){super(...arguments);ts(this,"priority",120);ts(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 kmt extends wo{constructor(){super(...arguments);ts(this,"priority",120);ts(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 Nmt extends wo{constructor(){super(...arguments);ts(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);ts(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 Smt extends wo{constructor(){super(...arguments);ts(this,"priority",110);ts(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 Cmt(e,t,n){const s=Es(e),a=wye(s,n)-t;return s.setDate(s.getDate()-a*7),s}class Mmt extends wo{constructor(){super(...arguments);ts(this,"priority",100);ts(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 Sm(Cmt(n,a,o),o)}}function Tmt(e,t){const n=Es(e),s=_ye(n)-t;return n.setDate(n.getDate()-s*7),n}class Amt extends wo{constructor(){super(...arguments);ts(this,"priority",100);ts(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 Iy(Tmt(n,a))}}const Emt=[31,28,31,30,31,30,31,31,30,31,30,31],Imt=[31,29,31,30,31,30,31,31,30,31,30,31];class Pmt extends wo{constructor(){super(...arguments);ts(this,"priority",90);ts(this,"subPriority",1);ts(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=E8e(a),l=n.getMonth();return o?s>=1&&s<=Imt[l]:s>=1&&s<=Emt[l]}set(n,s,a){return n.setDate(a),n.setHours(0,0,0,0),n}}class Lmt extends wo{constructor(){super(...arguments);ts(this,"priority",90);ts(this,"subpriority",1);ts(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 E8e(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=Es(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 Omt extends wo{constructor(){super(...arguments);ts(this,"priority",90);ts(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 Dmt extends wo{constructor(){super(...arguments);ts(this,"priority",90);ts(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 Rmt extends wo{constructor(){super(...arguments);ts(this,"priority",90);ts(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 Fmt(e,t){const n=Es(e),s=cmt(n),a=t-s;return Ql(n,a)}class zmt extends wo{constructor(){super(...arguments);ts(this,"priority",90);ts(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=Fmt(n,a),n.setHours(0,0,0,0),n}}class Bmt extends wo{constructor(){super(...arguments);ts(this,"priority",80);ts(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 $mt extends wo{constructor(){super(...arguments);ts(this,"priority",80);ts(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 Umt extends wo{constructor(){super(...arguments);ts(this,"priority",80);ts(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 qmt extends wo{constructor(){super(...arguments);ts(this,"priority",70);ts(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 Vmt extends wo{constructor(){super(...arguments);ts(this,"priority",70);ts(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 Hmt extends wo{constructor(){super(...arguments);ts(this,"priority",70);ts(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 Wmt extends wo{constructor(){super(...arguments);ts(this,"priority",70);ts(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 Gmt extends wo{constructor(){super(...arguments);ts(this,"priority",60);ts(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 Kmt extends wo{constructor(){super(...arguments);ts(this,"priority",50);ts(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 Zmt extends wo{constructor(){super(...arguments);ts(this,"priority",30);ts(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 Ymt extends wo{constructor(){super(...arguments);ts(this,"priority",10);ts(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:Po(n,n.getTime()-gv(n)-a)}}class Xmt extends wo{constructor(){super(...arguments);ts(this,"priority",10);ts(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:Po(n,n.getTime()-gv(n)-a)}}class Qmt extends wo{constructor(){super(...arguments);ts(this,"priority",40);ts(this,"incompatibleTokens","*")}parse(n){return T8e(n)}set(n,s,a){return[Po(n,a*1e3),{timestampIsSet:!0}]}}class Jmt extends wo{constructor(){super(...arguments);ts(this,"priority",20);ts(this,"incompatibleTokens","*")}parse(n){return T8e(n)}set(n,s,a){return[Po(n,a),{timestampIsSet:!0}]}}const eft={G:new ymt,y:new vmt,Y:new _mt,R:new bmt,u:new wmt,Q:new jmt,q:new kmt,M:new Nmt,L:new Smt,w:new Mmt,I:new Amt,d:new Pmt,D:new Lmt,E:new Omt,e:new Dmt,c:new Rmt,i:new zmt,a:new Bmt,b:new $mt,B:new Umt,h:new qmt,H:new Vmt,K:new Hmt,k:new Wmt,m:new Gmt,s:new Kmt,S:new Zmt,X:new Ymt,x:new Xmt,t:new Qmt,T:new Jmt},tft=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,rft=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,nft=/^'([^]*?)'?$/,sft=/''/g,aft=/\S/,ift=/[a-zA-Z]/;function Nye(e,t,n,s){var k,M,I,T;const a=lmt(),o=a.locale??sae,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===""?Es(n):Po(n,NaN);const u={firstWeekContainsDate:l,weekStartsOn:i,locale:o},m=[new xmt],x=t.match(rft).map(P=>{const F=P[0];if(F in kme){const D=kme[F];return D(P,o.formatLong)}return P}).join("").match(tft),y=[];for(let P of x){C8e(P)&&Nme(P,t,e),S8e(P)&&Nme(P,t,e);const F=P[0],D=eft[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 Po(n,NaN);m.push(V.setter),e=V.rest}else{if(F.match(ift))throw new RangeError("Format string contains an unescaped latin alphabet character `"+F+"`");if(P==="''"?P="'":F==="'"&&(P=oft(P)),e.indexOf(P)===0)e=e.slice(P.length);else return Po(n,NaN)}}if(e.length>0&&aft.test(e))return Po(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=Es(n);if(isNaN(b.getTime()))return Po(n,NaN);const N={};for(const P of v){if(!P.validate(b,u))return Po(n,NaN);const F=P.set(b,N,u);Array.isArray(F)?(b=F[0],Object.assign(N,F[1])):b=F}return Po(n,b)}function oft(e){return e.match(nft)[1].replace(sft,"'")}function lft(e){return+Es(e)o-l);return n>=s&&n<=a}function Vce(e,t){return Ql(e,-t)}function Hce(e,t){const n=Es(e),s=n.getFullYear(),a=n.getDate(),o=Po(e,0);o.setFullYear(s,t,15),o.setHours(0,0,0,0);const l=omt(o);return n.setMonth(t,Math.min(a,l)),n}function I8e(e,t){const n=Es(e);return n.setHours(t),n}function P8e(e,t){const n=Es(e);return n.setMinutes(t),n}function ONe(e,t){const n=Es(e);return isNaN(+n)?Po(e,NaN):(n.setFullYear(t),n)}function dft(e,t){return zh(e,-12)}const uft=()=>{const{user:e}=tn(),t=Wn(),[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")?zo:k.includes("academy")||k.includes("video")?Pa:k.includes("template")?Vc:k.includes("event")?Ts:k.includes("newsletter")?py:k.includes("brokerage")?Dh:k.includes("swag")||k.includes("social")?ao:k.includes("toolbox")||k.includes("tool")?vy:k.includes("brief")?Ds:zo},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(dh,{open:l,onOpenChange:b,children:[r.jsx(uh,{asChild:!0,children:r.jsxs(X,{variant:"ghost",size:"icon",className:"relative",children:[r.jsx(Dg,{className:"h-5 w-5"}),a>0&&r.jsx(Tt,{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(X,{variant:"ghost",size:"sm",className:"text-xs h-6",onClick:v,children:"Mark all read"})]}),r.jsx(Zo,{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(Ha,{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 DNe=1,hft=.9,mft=.8,fft=.17,Wce=.1,Gce=.999,pft=.9999,gft=.99,xft=/[\\\/_+.#"@\[\(\{&]/,yft=/[\\\/_+.#"@\[\(\{&]/g,vft=/[\s-]/,L8e=/[\s-]/g;function Sme(e,t,n,s,a,o,l){if(o===t.length)return a===e.length?DNe:gft;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=Sme(e,t,n,s,m+1,o+1,l),y>x&&(m===a?y*=DNe:xft.test(e.charAt(m-1))?(y*=mft,b=e.slice(a,m-1).match(yft),b&&a>0&&(y*=Math.pow(Gce,b.length))):vft.test(e.charAt(m-1))?(y*=hft,N=e.slice(a,m-1).match(L8e),N&&a>0&&(y*=Math.pow(Gce,N.length))):(y*=fft,a>0&&(y*=Math.pow(Gce,m-a))),e.charAt(m)!==t.charAt(o)&&(y*=pft)),(yy&&(y=v*Wce)),y>x&&(x=y),m=n.indexOf(u,m+1);return l[i]=x,x}function RNe(e){return e.toLowerCase().replace(L8e," ")}function _ft(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Sme(e,t,RNe(e),RNe(t),0,0,{})}var dT='[cmdk-group=""]',Kce='[cmdk-group-items=""]',bft='[cmdk-group-heading=""]',O8e='[cmdk-item=""]',FNe=`${O8e}:not([aria-disabled="true"])`,Cme="cmdk-item-select",$S="data-value",wft=(e,t,n)=>_ft(e,t,n),D8e=A.createContext(void 0),hP=()=>A.useContext(D8e),R8e=A.createContext(void 0),Cye=()=>A.useContext(R8e),F8e=A.createContext(void 0),z8e=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=B8e(e),{label:u,children:m,value:x,onValueChange:y,filter:v,shouldFilter:b,loop:N,disablePointerSelection:k=!1,vimBindings:M=!0,...I}=e,T=gd(),P=gd(),F=gd(),D=A.useRef(null),U=Pft();uk(()=>{if(x!==void 0){let we=x.trim();n.current.value=we,V.emit()}},[x]),uk(()=>{U(6,de)},[]);let V=A.useMemo(()=>({subscribe:we=>(l.current.add(we),()=>l.current.delete(we)),snapshot:()=>n.current,setState:(we,ve,et)=>{var Me,Ie,$e,Be;if(!Object.is(n.current[we],ve)){if(n.current[we]=ve,we==="search")oe(),Q(),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=se())==null?void 0:Ve.id,V.emit()}),et||U(5,de),((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,et)=>{var Me;ve!==((Me=o.current.get(we))==null?void 0:Me.value)&&(o.current.set(we,{value:ve,keywords:et}),n.current.filtered.items.set(we,G(ve,et)),U(2,()=>{Q(),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(),Q(),n.current.value||ae(),V.emit()}),()=>{o.current.delete(we),s.current.delete(we),n.current.filtered.items.delete(we);let et=se();U(4,()=>{oe(),(et==null?void 0:et.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 et,Me;let Ie=(Me=(et=i.current)==null?void 0:et.filter)!=null?Me:wft;return we?Ie(we,n.current.search,ve):0}function Q(){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 et=D.current;pe().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(Kce);Ie?Ie.appendChild(Me.parentElement===Ie?Me:Me.closest(`${Kce} > *`)):et.appendChild(Me.parentElement===et?Me:Me.closest(`${Kce} > *`))}),ve.sort((Me,Ie)=>Ie[1]-Me[1]).forEach(Me=>{var Ie;let $e=(Ie=D.current)==null?void 0:Ie.querySelector(`${dT}[${$S}="${encodeURIComponent(Me[0])}"]`);$e==null||$e.parentElement.appendChild($e)})}function ae(){let we=pe().find(et=>et.getAttribute("aria-disabled")!=="true"),ve=we==null?void 0:we.getAttribute($S);V.setState("value",ve||void 0)}function oe(){var we,ve,et,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=(et=o.current.get($e))==null?void 0:et.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 de(){var we,ve,et;let Me=se();Me&&(((we=Me.parentElement)==null?void 0:we.firstChild)===Me&&((et=(ve=Me.closest(dT))==null?void 0:ve.querySelector(bft))==null||et.scrollIntoView({block:"nearest"})),Me.scrollIntoView({block:"nearest"}))}function se(){var we;return(we=D.current)==null?void 0:we.querySelector(`${O8e}[aria-selected="true"]`)}function pe(){var we;return Array.from(((we=D.current)==null?void 0:we.querySelectorAll(FNe))||[])}function ne(we){let ve=pe()[we];ve&&V.setState("value",ve.getAttribute($S))}function me(we){var ve;let et=se(),Me=pe(),Ie=Me.findIndex(Be=>Be===et),$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 he(we){let ve=se(),et=ve==null?void 0:ve.closest(dT),Me;for(;et&&!Me;)et=we>0?Eft(et,dT):Ift(et,dT),Me=et==null?void 0:et.querySelector(FNe);Me?V.setState("value",Me.getAttribute($S)):me(we)}let xe=()=>ne(pe().length-1),Te=we=>{we.preventDefault(),we.metaKey?xe():we.altKey?he(1):me(1)},be=we=>{we.preventDefault(),we.metaKey?ne(0):we.altKey?he(-1):me(-1)};return A.createElement(Bn.div,{ref:t,tabIndex:-1,...I,"cmdk-root":"",onKeyDown:we=>{var ve;(ve=I.onKeyDown)==null||ve.call(I,we);let et=we.nativeEvent.isComposing||we.keyCode===229;if(!(we.defaultPrevented||et))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&&be(we);break}case"ArrowUp":{be(we);break}case"Home":{we.preventDefault(),ne(0);break}case"End":{we.preventDefault(),xe();break}case"Enter":{we.preventDefault();let Me=se();if(Me){let Ie=new Event(Cme);Me.dispatchEvent(Ie)}}}}},A.createElement("label",{"cmdk-label":"",htmlFor:W.inputId,id:W.labelId,style:Oft},u),iae(e,we=>A.createElement(R8e.Provider,{value:V},A.createElement(D8e.Provider,{value:W},we))))}),jft=A.forwardRef((e,t)=>{var n,s;let a=gd(),o=A.useRef(null),l=A.useContext(F8e),i=hP(),u=B8e(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=$8e(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(Cme,N),()=>U.removeEventListener(Cme,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(Bn.div,{ref:Ty(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)}),kft=A.forwardRef((e,t)=>{let{heading:n,children:s,forceMount:a,...o}=e,l=gd(),i=A.useRef(null),u=A.useRef(null),m=gd(),x=hP(),y=xv(b=>a||x.filter()===!1?!0:b.search?b.filtered.groups.has(l):!0);uk(()=>x.group(l),[]),$8e(l,i,[e.value,e.heading,u]);let v=A.useMemo(()=>({id:l,forceMount:a}),[a]);return A.createElement(Bn.div,{ref:Ty(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),iae(e,b=>A.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?m:void 0},A.createElement(F8e.Provider,{value:v},b))))}),Nft=A.forwardRef((e,t)=>{let{alwaysRender:n,...s}=e,a=A.useRef(null),o=xv(l=>!l.search);return!n&&!o?null:A.createElement(Bn.div,{ref:Ty(a,t),...s,"cmdk-separator":"",role:"separator"})}),Sft=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=hP();return A.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),A.createElement(Bn.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)}})}),Cft=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=hP();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(Bn.div,{ref:Ty(o,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":s,id:u.listId},iae(e,m=>A.createElement("div",{ref:Ty(l,u.listInnerRef),"cmdk-list-sizer":""},m)))}),Mft=A.forwardRef((e,t)=>{let{open:n,onOpenChange:s,overlayClassName:a,contentClassName:o,container:l,...i}=e;return A.createElement(Ose,{open:n,onOpenChange:s},A.createElement(Dse,{container:l},A.createElement(A3,{"cmdk-overlay":"",className:a}),A.createElement(E3,{"aria-label":e.label,"cmdk-dialog":"",className:o},A.createElement(z8e,{ref:t,...i}))))}),Tft=A.forwardRef((e,t)=>xv(n=>n.filtered.count===0)?A.createElement(Bn.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Aft=A.forwardRef((e,t)=>{let{progress:n,children:s,label:a="Loading...",...o}=e;return A.createElement(Bn.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},iae(e,l=>A.createElement("div",{"aria-hidden":!0},l)))}),Bh=Object.assign(z8e,{List:Cft,Item:jft,Input:Sft,Group:kft,Separator:Nft,Dialog:Mft,Empty:Tft,Loading:Aft});function Eft(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Ift(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function B8e(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 $8e(e,t,n,s=[]){let a=A.useRef(),o=hP();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 Pft=()=>{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 Lft(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function iae({asChild:e,children:t},n){return e&&A.isValidElement(t)?A.cloneElement(Lft(t),{ref:t.ref},n(t.props.children)):n(t)}var Oft={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Ly=A.forwardRef(({className:e,...t},n)=>r.jsx(Bh,{ref:n,className:Ut("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Ly.displayName=Bh.displayName;const Dft=({children:e,...t})=>r.jsx(Or,{...t,children:r.jsx(Lr,{className:"overflow-hidden p-0 shadow-lg",children:r.jsx(Ly,{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})})}),Oy=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(Bh.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})]}));Oy.displayName=Bh.Input.displayName;const Dy=A.forwardRef(({className:e,...t},n)=>r.jsx(Bh.List,{ref:n,className:Ut("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));Dy.displayName=Bh.List.displayName;const Ry=A.forwardRef((e,t)=>r.jsx(Bh.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));Ry.displayName=Bh.Empty.displayName;const Fy=A.forwardRef(({className:e,...t},n)=>r.jsx(Bh.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}));Fy.displayName=Bh.Group.displayName;const Rft=A.forwardRef(({className:e,...t},n)=>r.jsx(Bh.Separator,{ref:n,className:Ut("-mx-1 h-px bg-border",e),...t}));Rft.displayName=Bh.Separator.displayName;const zy=A.forwardRef(({className:e,...t},n)=>r.jsx(Bh.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}));zy.displayName=Bh.Item.displayName;const Fft={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:G1,color:"bg-amber-500/10 text-amber-600"},toolbox:{label:"Toolbox",icon:vy,color:"bg-green-500/10 text-green-600"},"social-swag":{label:"Social Swag",icon:Ds,color:"bg-fuchsia-500/10 text-fuchsia-600"}},zNe=()=>{const[e,t]=A.useState(!1),[n,s]=A.useState(""),[a,o]=A.useState([]),[l,i]=A.useState(!1),u=Wn();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(X,{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(Dft,{open:e,onOpenChange:t,children:[r.jsx(Oy,{placeholder:"Search events, templates, academy, toolbox, social swag...",value:n,onValueChange:s}),r.jsxs(Dy,{children:[l&&r.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Searching..."}),!l&&n&&a.length===0&&r.jsxs(Ry,{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=Fft[v],k=N.icon;return r.jsx(Fy,{heading:N.label,children:b.map(M=>r.jsxs(zy,{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(Tt,{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)})]})]})]})},zft=({expiresAt:e,className:t,showUpgradeButton:n=!0})=>{const[s,a]=A.useState(null),o=Wn();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(Gu,{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(X,{size:"sm",onClick:()=>o("/subscription"),className:"bg-primary hover:bg-primary/90 text-xs h-7 px-3",children:[r.jsx(Ds,{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(Qa,{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(X,{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(Ds,{className:"h-3 w-3 mr-1"}),"Upgrade"]})]})},Bft=()=>{const e=Wn();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(Gu,{className:"h-8 w-8 text-destructive"})}),r.jsx(Gt,{className:"text-2xl",children:"Your Free Trial Has Ended"}),r.jsx(kn,{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(Je,{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(Je,{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(qn,{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(X,{className:"w-full",onClick:t=>{t.stopPropagation(),e("/subscription")},children:[r.jsx(Ds,{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(Je,{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(mi,{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(X,{variant:"outline",className:"w-full border-amber-500 text-amber-600 hover:bg-amber-50",onClick:t=>{t.stopPropagation(),e("/subscription")},children:[r.jsx(mi,{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(Ii,{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(ks,{className:"h-4 w-4"}),r.jsx("span",{children:"support@relevelup.com"})]})]})]})]})]})})},$ft=({hasUnseenBrief:e,onClick:t,className:n})=>r.jsxs(Wg,{children:[r.jsx(Gg,{asChild:!0,children:r.jsxs(X,{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 oae="Checkbox",[Uft]=cc(oae),[qft,Mye]=Uft(oae);function Vft(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]=sh({prop:n,defaultProp:a??!1,onChange:u,caller:oae}),[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(qft,{scope:t,...F,children:Hft(y)?y(F):s})}var U8e="CheckboxTrigger",q8e=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(U8e,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(Bn.button,{type:"button",role:"checkbox","aria-checked":rv(u)?"mixed":u,"aria-required":m,"data-state":K8e(u),"data-disabled":i?"":void 0,disabled:i,value:l,...s,ref:k,onKeyDown:xn(t,I=>{I.key==="Enter"&&I.preventDefault()}),onClick:xn(n,I=>{y(T=>rv(T)?!0:!T),N&&b&&(v.current=I.isPropagationStopped(),v.current||I.stopPropagation())})})});q8e.displayName=U8e;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(Vft,{__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(q8e,{...y,ref:t,__scopeCheckbox:n}),v&&r.jsx(G8e,{__scopeCheckbox:n})]})})});Tye.displayName=oae;var V8e="CheckboxIndicator",H8e=A.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:s,...a}=e,o=Mye(V8e,n);return r.jsx(Ac,{present:s||rv(o.checked)||o.checked===!0,children:r.jsx(Bn.span,{"data-state":K8e(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});H8e.displayName=V8e;var W8e="CheckboxBubbleInput",G8e=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(W8e,e),N=ca(n,b),k=cP(o),M=YI(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(Bn.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%)"}})});G8e.displayName=W8e;function Hft(e){return typeof e=="function"}function rv(e){return e==="indeterminate"}function K8e(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(H8e,{className:Ut("flex items-center justify-center text-current"),children:r.jsx(fi,{className:"h-4 w-4"})})}));_l.displayName=Tye.displayName;var Aye="Radio",[Wft,Z8e]=cc(Aye),[Gft,Kft]=Wft(Aye),Y8e=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(Gft,{scope:n,checked:a,disabled:l,children:[r.jsx(Bn.button,{type:"button",role:"radio","aria-checked":a,"data-state":eRe(a),"data-disabled":l?"":void 0,disabled:l,value:i,...x,ref:b,onClick:xn(e.onClick,M=>{a||u==null||u(),k&&(N.current=M.isPropagationStopped(),N.current||M.stopPropagation())})}),k&&r.jsx(J8e,{control:y,bubbles:!N.current,name:s,value:i,checked:a,required:o,disabled:l,form:m,style:{transform:"translateX(-100%)"}})]})});Y8e.displayName=Aye;var X8e="RadioIndicator",Q8e=A.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:s,...a}=e,o=Kft(X8e,n);return r.jsx(Ac,{present:s||o.checked,children:r.jsx(Bn.span,{"data-state":eRe(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:t})})});Q8e.displayName=X8e;var Zft="RadioBubbleInput",J8e=A.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:s=!0,...a},o)=>{const l=A.useRef(null),i=ca(l,o),u=cP(n),m=YI(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(Bn.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}})});J8e.displayName=Zft;function eRe(e){return e?"checked":"unchecked"}var Yft=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],lae="RadioGroup",[Xft]=cc(lae,[T3,Z8e]),tRe=T3(),rRe=Z8e(),[Qft,Jft]=Xft(lae),nRe=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=tRe(n),N=Mk(m),[k,M]=sh({prop:o,defaultProp:a??null,onChange:y,caller:lae});return r.jsx(Qft,{scope:n,name:s,required:l,disabled:i,value:k,onValueChange:M,children:r.jsx(Rxe,{asChild:!0,...b,orientation:u,dir:N,loop:x,children:r.jsx(Bn.div,{role:"radiogroup","aria-required":l,"aria-orientation":u,"data-disabled":i?"":void 0,dir:N,...v,ref:t})})})});nRe.displayName=lae;var sRe="RadioGroupItem",aRe=A.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:s,...a}=e,o=Jft(sRe,n),l=o.disabled||s,i=tRe(n),u=rRe(n),m=A.useRef(null),x=ca(t,m),y=o.value===a.value,v=A.useRef(!1);return A.useEffect(()=>{const b=k=>{Yft.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(Fxe,{asChild:!0,...i,focusable:!l,active:y,children:r.jsx(Y8e,{disabled:l,required:o.required,checked:y,...u,...a,name:o.name,ref:x,onCheck:()=>o.onValueChange(a.value),onKeyDown:xn(b=>{b.key==="Enter"&&b.preventDefault()}),onFocus:xn(a.onFocus,()=>{var b;v.current&&((b=m.current)==null||b.click())})})})});aRe.displayName=sRe;var ept="RadioGroupIndicator",iRe=A.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...s}=e,a=rRe(n);return r.jsx(Q8e,{...a,...s,ref:t})});iRe.displayName=ept;var oRe=nRe,lRe=aRe,tpt=iRe;const cRe=A.forwardRef(({className:e,...t},n)=>r.jsx(oRe,{className:Ut("grid gap-2",e),...t,ref:n}));cRe.displayName=oRe.displayName;const dRe=A.forwardRef(({className:e,...t},n)=>r.jsx(lRe,{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(tpt,{className:"flex items-center justify-center",children:r.jsx(eh,{className:"h-2.5 w-2.5 fill-current text-current"})})}));dRe.displayName=lRe.displayName;const rpt=({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(Or,{open:t,onOpenChange:M=>!M&&n(),children:r.jsxs(Lr,{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(us,{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(Tt,{variant:"secondary",className:"mb-1 bg-white/20 text-white border-0",children:"The LevelUp Brief"}),r.jsx(Fr,{className:"text-xl font-bold text-white",children:e.brief.title})]})]})]}),r.jsx(Zo,{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(X,{variant:"outline",size:"sm",onClick:()=>window.open(M.url,"_blank"),className:"gap-2",children:[r.jsx(Ms,{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(Tt,{variant:"secondary",className:"gap-1",children:[r.jsx(no,{className:"h-3 w-3"}),"Responded"]})]}),M.poll_type==="single"?r.jsx(cRe,{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(dRe,{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(X,{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(X,{onClick:n,className:"w-full max-w-xs",children:"Got it!"}),r.jsx(X,{variant:"ghost",size:"sm",onClick:s,children:"Don't show again"})]})]})})},npt=()=>{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 spt(){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(NA,{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(X,{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(us,{className:"h-4 w-4"})})]})]})}):null}const apt=({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=qr(),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(Wo,{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})]})},uRe=()=>{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}},ipt="https://search.google.com/local/writereview?placeid=ChIJM73ERQD1QogRPxupMFObuck&source=g.page.m.ia._&laa=nmx-review-solicitation-ia2",opt=()=>{const{shouldShowPrompt:e,isLoading:t,dismissPrompt:n,submitReview:s,markPostedToGoogle:a}=uRe(),[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){Ca({title:"Please select a rating",variant:"destructive"});return}M(!0);const U=await s(m,b);M(!1),U.success?(T(!0),Ca({title:"Thank you for your feedback!",description:"Your review helps us improve."}),u("google")):Ca({title:"Error submitting review",description:U.error,variant:"destructive"})},F=async U=>{U&&(await navigator.clipboard.writeText(b||`${m} star rating for LevelUp!`),Ca({title:"Review copied!",description:"Paste it on Google Reviews."}),await a(),window.open(ipt,"_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(Ss,{className:"h-3.5 w-3.5 fill-current"}),r.jsx("span",{className:"hidden sm:inline",children:"Leave a Review"})]}),r.jsx(Or,{open:o,onOpenChange:D,children:r.jsx(Lr,{className:"sm:max-w-md",children:i==="review"?r.jsxs(r.Fragment,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{className:"text-center",children:"How are you enjoying LevelUp?"}),r.jsx(Qn,{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(Ss,{className:Ut("h-8 w-8 transition-colors",(y||m)>=U?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},U))}),r.jsx(Xn,{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(X,{variant:"outline",onClick:D,className:"flex-1",children:"Maybe Later"}),r.jsx(X,{onClick:P,disabled:k||m===0,className:"flex-1",children:k?"Submitting...":"Submit Review"})]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{className:"text-center",children:"🎉 Thank you!"}),r.jsx(Qn,{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(X,{variant:"outline",onClick:()=>F(!1),className:"flex-1",children:"No Thanks"}),r.jsx(X,{onClick:()=>F(!0),className:"flex-1",children:"Yes, Open Google"})]})]})]})})})]})};function lpt(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=lpt(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 BNe="push_notification_prompt_dismissed",cpt=()=>{const{user:e}=tn(),{isSupported:t,isSubscribed:n,isLoading:s,subscribe:a}=hRe(),[o,l]=A.useState(!1),[i,u]=A.useState(!1);A.useEffect(()=>{if(!e||!t||n||s||localStorage.getItem(`${BNe}_${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(`${BNe}_${e.id}`,"true"),l(!1)};return!t||n?null:r.jsx(Or,{open:o,onOpenChange:y=>!y&&x(),children:r.jsxs(Lr,{className:"sm:max-w-md",children:[r.jsxs(zr,{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(Fr,{className:"text-center",children:"Stay in the Loop!"}),r.jsx(Qn,{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(X,{onClick:m,disabled:i,className:"w-full",children:i?"Enabling...":"Enable Notifications"}),r.jsx(X,{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."})]})})},$Ne=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},dpt=e=>e?$Ne(e):$Ne,upt=e=>e;function hpt(e,t=upt){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 mpt=e=>{const t=dpt(e),n=s=>hpt(t,s);return Object.assign(n,t),n},fpt=e=>mpt;function ppt(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 Mme=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(s){return Mme(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return Mme(s)(n)}}}},gpt=(e,t)=>(n,s,a)=>{let o={storage:ppt(()=>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 Mme(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},xpt=gpt,cae=fpt()(xpt((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})})),mRe=A.createContext({onlineUsers:[],totalOnline:0}),ypt=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{}},vpt=({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 ypt(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(mRe.Provider,{value:{onlineUsers:u,totalOnline:a.length},children:e})},fRe=()=>A.useContext(mRe),UNe="dashboard-sidebar-collapsed",Dr=({children:e,title:t})=>{var et,Me,Ie;const{user:n,signOut:s,isAdmin:a,isBrokerageManager:o,brokerageId:l}=tn(),{isAssistant:i,actingAsAgent:u}=Oxe(),{isImpersonating:m}=Lxe(),y=(i&&!!u?40:0)+(m?40:0),{avatarUrl:v}=RDe(n==null?void 0:n.id),{isTrial:b,isExpired:N,expiresAt:k}=nut(n==null?void 0:n.id),{isMarketplaceEnabled:M}=zDe(),{currentBrief:I,shouldShowPopup:T,hasUnseenBrief:P,openBrief:F,closeBrief:D,dismissBrief:U}=npt(),{unreadCount:V}=sut(),{openCount:W}=aut(),Q=cae($e=>$e.cartItems).reduce(($e,Be)=>$e+Be.quantity,0),ae=Wn(),oe=wf(),[de,se]=A.useState(()=>typeof window<"u"?localStorage.getItem(UNe)==="true":!1);A.useEffect(()=>{localStorage.setItem(UNe,String(de))},[de]);const[pe,ne]=A.useState({agentos:!0,tools:!0,marketing:!0,learning:!0,community:!0,help:!1}),me=$e=>{ne(Be=>({...Be,[$e]:!Be[$e]}))},he=$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),be=({path:$e,icon:Be,label:Ve,badgeCount:ot})=>{const At=r.jsxs(X,{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",de?"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"}),de&&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"})]}),!de&&Ve,!de&&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 de?r.jsxs(Wg,{delayDuration:0,children:[r.jsx(Gg,{asChild:!0,children:At}),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})]})]}):At},we=({id:$e,label:Be,icon:Ve,children:ot,activePaths:At,showBetaBadge:Oe,defaultPath:at,badgeCount:le})=>{if(de){const qe=at||At[0];return r.jsxs(Wg,{delayDuration:0,children:[r.jsx(Gg,{asChild:!0,children:r.jsx(X,{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(At)&&"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(G4,{open:pe[$e],onOpenChange:()=>me($e),children:[r.jsx(K4,{asChild:!0,children:r.jsxs(X,{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(At)&&"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(Fd,{className:Ut("h-4 w-4 transition-transform duration-200",pe[$e]&&"rotate-180")})]})]})}),r.jsx(Z4,{className:"pl-4 space-y-1 mt-1",children:ot})]})},ve=({isMobile:$e=!1})=>{const Be=$e?!1:de;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:Sut,alt:"LevelUp",className:"h-8 w-auto"}),!$e&&r.jsxs(Wg,{delayDuration:0,children:[r.jsx(Gg,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",onClick:()=>se(!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(Zo,{className:"flex-1",children:r.jsxs("nav",{className:Ut("p-3 space-y-1",Be&&"flex flex-col items-center"),children:[r.jsx(be,{path:"/dashboard",icon:Fj,label:"Dashboard"}),r.jsx(be,{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(be,{path:"/mission-control",icon:bi,label:"Mission Control"}),r.jsx(be,{path:"/mission-control/contacts",icon:qn,label:"Contacts"}),r.jsx(be,{path:"/mission-control/plans",icon:Tp,label:"TouchPlans"}),r.jsx(be,{path:"/mission-control/pipeline",icon:hy,label:"Deal Pipeline"}),r.jsx(be,{path:"/mission-control/popbys",icon:ao,label:"Popbys"}),r.jsx(be,{path:"/mission-control/video-library",icon:Pa,label:"Video Library"}),r.jsx(be,{path:"/mission-control/scorecard",icon:_c,label:"Scorecard"}),r.jsx(be,{path:"/mission-control/listings",icon:mi,label:"Listing Exchange"})]}),r.jsxs(we,{id:"tools",label:"Tools",icon:rm,activePaths:["/apps","/ai-toolkit","/mission-control/my-card","/mission-control/presentations"],defaultPath:"/apps",children:[r.jsx(be,{path:"/apps",icon:rm,label:"Apps"}),!Be&&r.jsxs(X,{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(hf,{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(be,{path:"/mission-control/my-card",icon:hf,label:"Digital Card"}),!Be&&r.jsxs(X,{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(gy,{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"})]}),Be&&r.jsx(be,{path:"/mission-control/presentations",icon:gy,label:"Smart Presentations"})]}),r.jsxs(we,{id:"marketing",label:"Marketing",icon:Ep,activePaths:["/templates","/social-swag-2","/newsletters"],defaultPath:"/templates",children:[r.jsx(be,{path:"/templates",icon:Vc,label:"Templates"}),r.jsx(be,{path:"/social-swag-2",icon:xy,label:"Social Swag"}),r.jsx(be,{path:"/newsletters",icon:py,label:"Newsletters"})]}),r.jsxs(we,{id:"learning",label:"Learning",icon:tA,activePaths:["/academy","/toolbox"],defaultPath:"/academy",children:[r.jsx(be,{path:"/academy",icon:G1,label:"Academy"}),r.jsx(be,{path:"/toolbox",icon:vy,label:"Toolbox"})]}),r.jsxs(we,{id:"community",label:"Community",icon:zo,activePaths:["/community","/wishlist"],defaultPath:"/community",badgeCount:V,children:[r.jsx(be,{path:"/community",icon:qn,label:"Community",badgeCount:V}),r.jsx(be,{path:"/wishlist",icon:my,label:"Wishlist",badgeCount:W}),!Be&&r.jsxs(X,{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(Ms,{className:"h-4 w-4"}),"Facebook Group"]})]}),r.jsxs(we,{id:"goods",label:"The Goods",icon:Eh,activePaths:["/marketplace","/reward-store"],defaultPath:"/reward-store",children:[M&&!Be&&r.jsxs(X,{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(Eh,{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(be,{path:"/marketplace",icon:Eh,label:"Marketplace"}),r.jsx(be,{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(be,{path:"/support",icon:M4,label:"Support"}),r.jsx(be,{path:"/additional-services",icon:Ds,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(be,{path:"/admin",icon:th,label:"Admin Dashboard"})}):r.jsxs(X,{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(th,{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(be,{path:"/my-brokerage",icon:mi,label:"My Brokerage"}),o&&r.jsxs(r.Fragment,{children:[r.jsx(be,{path:"/brokerage/dashboard",icon:Bd,label:"Manage Brokerages"}),r.jsx(be,{path:"/brokerage-resources",icon:Dh,label:"Brokerage Resources"})]})]}):r.jsxs(r.Fragment,{children:[l&&r.jsxs(X,{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(mi,{className:"h-4 w-4"}),"My Brokerage"]}),o&&r.jsxs(r.Fragment,{children:[r.jsxs(X,{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(Bd,{className:"h-4 w-4"}),"Manage Brokerages"]}),r.jsxs(X,{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(Dh,{className:"h-4 w-4"}),"Brokerage Resources"]})]})]})]})]})}),r.jsxs("div",{className:"p-3 border-t border-sidebar-border md:hidden",children:[r.jsxs(X,{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(X,{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(vpt,{children:r.jsx(eP,{children:r.jsxs("div",{className:"min-h-screen bg-background flex",children:[b&&N&&r.jsx(Bft,{}),typeof document<"u"&&Ah.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",de?"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",de?"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(Hse,{children:[r.jsx(tye,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"md:hidden",children:r.jsx(hA,{className:"h-5 w-5"})})}),r.jsx(dP,{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:Mut,alt:"LevelUp",className:"h-8 w-auto"})}),r.jsx("div",{className:"hidden md:flex flex-1 justify-center",children:r.jsx(zNe,{})}),r.jsxs("div",{className:"flex items-center gap-3 ml-auto",children:[b&&!N&&k&&r.jsx(zft,{expiresAt:k,className:"hidden lg:flex"}),r.jsx("div",{className:"md:hidden",children:r.jsx(zNe,{})}),I&&r.jsx($ft,{hasUnseenBrief:P,onClick:F}),M&&r.jsxs(X,{variant:"ghost",size:"icon",className:"relative",onClick:()=>ae("/marketplace/cart"),children:[r.jsx(Eh,{className:"h-5 w-5"}),Q>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:Q>99?"99+":Q})]}),r.jsx(uft,{}),r.jsx(wme,{}),r.jsxs("span",{className:"hidden sm:block text-sm font-medium text-foreground",children:["Hello, ",((Me=(et=n==null?void 0:n.user_metadata)==null?void 0:et.name)==null?void 0:Me.split(" ")[0])||"User","!"]}),r.jsxs(dh,{children:[r.jsx(uh,{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(Ti,{src:v||void 0}),r.jsx(ta,{className:"bg-primary text-primary-foreground font-medium text-sm",children:he(((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(Ha,{onClick:()=>ae("/profile"),className:"cursor-pointer",children:[r.jsx(ic,{className:"h-4 w-4 mr-2"}),"Profile"]}),r.jsxs(Ha,{onClick:()=>ae("/mission-control/integrations"),className:"cursor-pointer",children:[r.jsx(vA,{className:"h-4 w-4 mr-2"}),"Integrations"]}),r.jsx(ik,{}),r.jsxs(Ha,{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(apt,{children:r.jsx("main",{className:"p-4 sm:p-6 lg:p-8 overflow-x-hidden",children:e})}),I&&r.jsx(rpt,{brief:I,open:T,onClose:D,onDismiss:U}),r.jsx(spt,{}),r.jsx(opt,{}),r.jsx(cpt,{})]})]})})})},_pt=()=>{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(Dr,{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(qn,{className:"h-7 w-7 text-primary"})}),r.jsx(Gt,{className:"text-xl",children:"Individual Agent"}),r.jsx(kn,{children:"Perfect for solo agents ready to level up"})]}),r.jsxs(Je,{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(fi,{className:"h-4 w-4 text-primary mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},v))}),r.jsxs(X,{className:"w-full",size:"lg",onClick:()=>i("individual_agent"),disabled:t,children:[t&&s==="individual_agent"?r.jsx(Wr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(Ds,{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(mi,{className:"h-7 w-7 text-amber-600"})}),r.jsx(Gt,{className:"text-xl",children:"Brokerage"}),r.jsx(kn,{children:"For teams and brokerages up to 25 agents"})]}),r.jsxs(Je,{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(fi,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},v))}),r.jsxs(X,{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(Wr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(mi,{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(mi,{className:"h-7 w-7 text-purple-600"})}),r.jsx(Gt,{className:"text-xl",children:"Brokerage 25+"}),r.jsx(kn,{children:"For larger brokerages with 25+ agents"})]}),r.jsxs(Je,{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(fi,{className:"h-4 w-4 text-purple-600 mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},v))}),r.jsxs(X,{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(Wr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(mi,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]})]}),r.jsx(He,{className:"bg-muted/50",children:r.jsxs(Je,{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(Ii,{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(ks,{className:"h-4 w-4"}),r.jsx("span",{children:"support@relevelup.com"})]})]})]})})]})})},bpt=()=>{const{user:e,loading:t,isBrokerageManager:n,brokerageId:s}=tn(),a=Wn(),[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(Wr,{className:"w-10 h-10 text-primary animate-spin"})}),r.jsx(Gt,{className:"text-2xl",children:"Setting Up Your Brokerage"}),r.jsx(kn,{className:"text-lg",children:"We're assigning you as the brokerage manager and preparing your dashboard..."})]}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[r.jsx(li,{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(Wr,{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(mi,{className:"w-10 h-10 text-primary"})}),r.jsx(Gt,{className:"text-2xl",children:"Set Up Your Brokerage"}),r.jsx(kn,{className:"text-lg",children:"Create your brokerage to start managing your team"})]}),r.jsxs(Je,{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(qn,{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(li,{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(li,{className:"w-4 h-4 text-green-500"}),"Access exclusive brokerage resources"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(li,{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(li,{className:"w-4 h-4 text-green-500"}),"Share resources with your agents"]})]})]}),r.jsxs(X,{onClick:y,className:"w-full",disabled:i||!o.trim(),children:[i?"Creating...":"Create Brokerage",r.jsx(No,{className:"w-4 h-4 ml-2"})]})]})]})})},qNe=()=>{const e=Wn(),[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(kn,{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(Je,{children:r.jsx(X,{onClick:o,className:"w-full",children:"Go to Login"})})]})})},wpt=()=>{const e=Wn(),[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 de=t.get("code");de&&(s(de),Q(de))},[t]);const Q=async de=>{k(!0);const{data:se,error:pe}=await Y.from("invite_codes").select("id, code, max_uses, uses_count, expires_at, is_active, brokerage_id, trial_days").eq("code",de.toUpperCase().trim()).single();if(pe||!se){Ae.error("Invalid invite code"),k(!1);return}if(!se.is_active){Ae.error("This invite code is no longer active"),k(!1);return}if(se.max_uses&&se.uses_count>=se.max_uses){Ae.error("This invite code has reached its maximum uses"),k(!1);return}if(se.expires_at&&new Date(se.expires_at){de.preventDefault(),Q(n)},oe=async de=>{var se;if(de.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 pe=`${window.location.origin}/`,{data:ne,error:me}=await Y.auth.signUp({email:a.trim(),password:l,options:{emailRedirectTo:pe,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}ne.user&&(await Y.rpc("add_default_signup_tag",{user_id:ne.user.id}),F?await Y.functions.invoke("assign-brokerage",{body:{userId:ne.user.id,brokerageId:F}}):W?await Y.functions.invoke("assign-brokerage",{body:{userId:ne.user.id,trialDays:W}}):await Y.functions.invoke("assign-brokerage",{body:{userId:ne.user.id,grandfathered:!0}}),T&&await Y.from("invite_codes").update({uses_count:((se=(await Y.from("invite_codes").select("uses_count").eq("id",T).single()).data)==null?void 0:se.uses_count)+1}).eq("id",T),Ae.success("Account created! You can now access the dashboard."),e("/dashboard"))}catch(pe){console.error("Signup error:",pe),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(kn,{children:M?U?`Create your account to join ${U}`:"Create your account to get started":"Enter your invite code to continue"})]}),r.jsx(Je,{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:de=>m(de.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:de=>o(de.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:de=>i(de.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(X,{type:"submit",className:"w-full",disabled:v,children:v?r.jsxs(r.Fragment,{children:[r.jsx(Wr,{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:de=>s(de.target.value),required:!0,autoFocus:!0})]}),r.jsx(X,{type:"submit",className:"w-full",disabled:N,children:N?r.jsxs(r.Fragment,{children:[r.jsx(Wr,{className:"mr-2 h-4 w-4 animate-spin"}),"Verifying..."]}):"Verify Code"})]})})]})})},jpt="/assets/testimonial-avatar-1-BsCQFauB.jpg",kpt="/assets/testimonial-avatar-2-B6VPVc2t.jpg",Npt="/assets/testimonial-avatar-3-GuEFwYUE.jpg",Spt="/assets/testimonial-avatar-4-98iKMtkB.jpg",Cpt="/assets/testimonial-avatar-5-ZsZfyxMX.jpg",Mpt=[jpt,kpt,Npt,Spt,Cpt],Tpt=P3({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(dNe("")),brokerage:xc().trim().max(200).optional().or(dNe(""))}),Apt=[{icon:nf,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:Ts,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."}],Ept=[{icon:qn,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:Ds,title:"Smart TouchPlans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:Ii,title:"One-Tap Actions",description:"Call, text, or email contacts directly with pre-written scripts tailored to each relationship."},{icon:fm,title:"Birthday Alerts",description:"Never miss an important date—get reminders for birthdays and home anniversaries."},{icon:Fo,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:bi,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."}],Ipt=[{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."}],Ppt=()=>{const e=Wn(),[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=Tpt.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:Vte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[r.jsx(X,{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(X,{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(Ds,{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:Mpt.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(Ss,{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(Je,{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(X,{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(Wr,{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:Apt.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(Je,{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(Ds,{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:Ept.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(Je,{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:Ipt.map((u,m)=>r.jsx(He,{className:"border hover:shadow-lg transition-shadow",children:r.jsxs(Je,{className:"p-6",children:[r.jsx("div",{className:"flex gap-1 mb-4",children:[1,2,3,4,5].map(x=>r.jsx(Ss,{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(_m,{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(qn,{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(Je,{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(X,{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."})]})})})]})]})},Lpt=()=>{const e=Wn();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:Vte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsx(X,{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(Je,{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(ks,{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(X,{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."]})]})})})]})]})},Opt=P3({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 Dpt({shareToken:e,agentName:t,hasContact:n}){const[s,a]=A.useState(!1),[o,l]=A.useState(!1),[i,u]=A.useState(null),m=Jse({resolver:eae(Opt),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(Je,{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(kn,{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(Je,{children:r.jsx(tae,{...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(Ku,{})]})}),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(Ku,{})]})})]}),!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(Ku,{})]})}),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(Xn,{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(Ku,{})]})}),i&&r.jsx("p",{className:"text-sm text-destructive",children:i}),r.jsx(X,{type:"submit",className:"w-full gap-2",disabled:s,children:s?r.jsxs(r.Fragment,{children:[r.jsx(Wr,{className:"h-4 w-4 animate-spin"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Ji,{className:"h-4 w-4"}),"Send Message"]})})]})})})]})}const Rpt=()=>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(Ss,{className:"absolute top-[5%] left-[8%] w-6 h-6 text-blue-600/30 fill-blue-600/20"}),r.jsx(Ss,{className:"absolute top-[15%] left-[20%] w-4 h-4 text-blue-600/25 fill-blue-600/15"}),r.jsx(Ss,{className:"absolute top-[8%] left-[28%] w-5 h-5 text-blue-600/30 fill-blue-600/20"}),r.jsx(Ss,{className:"absolute top-[25%] left-[12%] w-4 h-4 text-blue-600/20 fill-blue-600/10"}),r.jsx(Ss,{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"})]}),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-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(Ds,{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(Ss,{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(Ds,{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(Ss,{className:"absolute bottom-[25%] left-[10%] w-6 h-6 text-blue-500/25 fill-blue-500/15 animate-pulse"}),r.jsx(Ss,{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"})]}),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-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(bi,{className:"absolute top-[15%] left-[30%] w-5 h-5 text-rose-300/40 fill-rose-300/20 animate-pulse"}),r.jsx(bi,{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(bi,{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"})]}),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-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(Ss,{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(Ss,{className:"absolute bottom-[25%] left-[15%] w-6 h-6 text-blue-500/20 fill-blue-500/10 animate-pulse"}),r.jsx(Ss,{className:"absolute top-[20%] right-[22%] w-5 h-5 text-indigo-400/20 fill-indigo-400/10 animate-pulse",style:{animationDelay:"0.5s"}})]}),$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-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"})]}),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-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(Ds,{className:"absolute top-[8%] left-[55%] w-6 h-6 text-purple-400/35 animate-pulse"}),r.jsx(Ds,{className:"absolute bottom-[28%] right-[25%] w-5 h-5 text-orange-400/30 animate-pulse",style:{animationDelay:"0.5s"}})]}),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-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(S1,{className:"absolute top-[5%] left-[15%] w-10 h-10 text-sky-300/30 animate-pulse"}),r.jsx(S1,{className:"absolute top-[10%] right-[20%] w-8 h-8 text-blue-300/25 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(S1,{className:"absolute top-[18%] left-[45%] w-6 h-6 text-sky-200/25 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx(S1,{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(Ss,{className:"absolute top-[3%] left-[50%] -translate-x-1/2 w-10 h-10 text-amber-400/35 fill-amber-400/25"})]}),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-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(bi,{className:"absolute top-[8%] left-[55%] w-6 h-6 text-red-400/22 fill-red-400/12"}),r.jsx(bi,{className:"absolute top-[20%] right-[25%] w-5 h-5 text-orange-400/22 fill-orange-400/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-yellow-900/8 via-amber-900/4 to-purple-900/8"}),r.jsx(Ss,{className:"absolute top-[5%] left-[15%] w-12 h-12 text-yellow-400/35 fill-yellow-400/25 animate-pulse"}),r.jsx(Ss,{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(Ss,{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(Ss,{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(Ds,{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"})]}),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-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(Ss,{className:"absolute top-[8%] left-[50%] -translate-x-1/2 w-14 h-14 text-yellow-400/28 fill-yellow-400/18"}),r.jsx(Ds,{className:"absolute top-[5%] left-[20%] w-7 h-7 text-blue-400/35"}),r.jsx(Ds,{className:"absolute top-[10%] right-[18%] w-6 h-6 text-sky-400/30"})]}),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-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"})]})]})]}),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-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(Ss,{className:"absolute top-[5%] left-[42%] w-10 h-10 text-amber-400/30 fill-amber-400/20"}),r.jsx(Ss,{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"})]}),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-amber-900/6 via-rose-900/6 to-purple-900/6"}),r.jsx(fm,{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"})]}),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-rose-900/12 via-pink-900/8 to-red-900/12"}),r.jsx(bi,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-rose-400/28 fill-rose-400/18"}),r.jsx(bi,{className:"absolute top-[8%] right-[12%] w-14 h-14 text-pink-400/25 fill-pink-400/15"}),r.jsx(bi,{className:"absolute bottom-[15%] left-[12%] w-12 h-12 text-red-400/22 fill-red-400/12"}),r.jsx(bi,{className:"absolute bottom-[18%] right-[10%] w-13 h-13 text-rose-300/25 fill-rose-300/15"}),r.jsx(bi,{className:"absolute top-[15%] left-[30%] w-6 h-6 text-pink-300/35 fill-pink-300/20 animate-pulse"}),r.jsx(bi,{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(bi,{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(bi,{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"})]}),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-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(Ds,{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"})]}),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-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(gm,{className:"absolute top-[12%] right-[18%] w-10 h-10 text-amber-400/25"}),r.jsx(gm,{className:"absolute bottom-[22%] left-[22%] w-8 h-8 text-yellow-400/22"}),r.jsx(bi,{className:"absolute top-[18%] left-[40%] w-6 h-6 text-rose-400/22 fill-rose-400/12"}),r.jsx(bi,{className:"absolute top-[22%] right-[35%] w-5 h-5 text-teal-400/20 fill-teal-400/10"}),r.jsx(Ds,{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"})]}),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-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(gm,{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(Ds,{className:"absolute top-[15%] left-[42%] w-10 h-10 text-emerald-400/35"}),r.jsx(Ds,{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"})]}),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-amber-900/10 via-yellow-900/6 to-orange-900/10"}),r.jsx(gm,{className:"absolute bottom-[12%] left-[50%] -translate-x-1/2 w-24 h-24 text-amber-400/25 rotate-45"}),r.jsx(gm,{className:"absolute top-[10%] left-[12%] w-10 h-10 text-yellow-400/30"}),r.jsx(gm,{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(Ds,{className:"absolute top-[5%] right-[35%] w-8 h-8 text-yellow-400/35"}),r.jsx(Ss,{className:"absolute top-[18%] left-[28%] w-6 h-6 text-amber-400/25 fill-amber-400/15"})]}),tgt=()=>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(gm,{className:"absolute top-[10%] right-[12%] w-10 h-10 text-amber-400/28"}),r.jsx(bi,{className:"absolute top-[8%] left-[18%] w-8 h-8 text-rose-400/25 fill-rose-400/15"}),r.jsx(Ds,{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"})]}),VNe=()=>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"})]}),rgt=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(bi,{className:"absolute top-6 left-[12%] w-4 h-4 text-rose-300/50 fill-rose-300/30 animate-pulse"}),r.jsx(bi,{className:"absolute top-10 right-[18%] w-3 h-3 text-pink-300/50 fill-pink-300/30 animate-pulse delay-150"}),r.jsx(bi,{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(bi,{className:"absolute top-14 right-[35%] w-3.5 h-3.5 text-pink-300/40 fill-pink-300/20 animate-pulse delay-200"})]}),ngt=()=>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(Ds,{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"})]}),sgt=()=>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"})]}),uT=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(Ds,{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(Ds,{className:"absolute top-8 left-[45%] w-3 h-3 text-sky-400/40 animate-pulse delay-300"})]}),HNe=()=>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(Ds,{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"})]}),Tme=[{id:"default",name:"Classic",description:"Clean, professional look for any occasion",icon:r.jsx(Ds,{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(bi,{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(rgt,{})},{id:"thinking_of_you",name:"Thinking of You",description:"Let them know they're on your mind",icon:r.jsx(nA,{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(uT,{})},{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(sgt,{})},{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(qn,{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(uT,{})},{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(VNe,{})},{id:"welcome_neighborhood",name:"Welcome to the Neighborhood",description:"Greet new neighbors",icon:r.jsx(Fo,{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(HNe,{})},{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(uT,{})},{id:"birthday",name:"Birthday",description:"Celebrate their special day",icon:r.jsx(fm,{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(Zpt,{})},{id:"valentines_day",name:"Valentine's Day",description:"Show appreciation on this special day",icon:r.jsx(bi,{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(Ypt,{})},{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(Xpt,{})},{id:"new_years",name:"New Year's Day",description:"Ring in the new year",icon:r.jsx(Ss,{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(Hpt,{})},{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($pt,{})},{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(zpt,{})},{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(Bpt,{})},{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(Rpt,{})},{id:"independence_day",name:"4th of July",description:"Celebrate Independence Day",icon:r.jsx(pm,{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(Fpt,{})},{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(Kpt,{})},{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(Upt,{})},{id:"thanksgiving",name:"Thanksgiving",description:"Express gratitude this season",icon:r.jsx(bi,{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(Vpt,{})},{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(qpt,{})},{id:"hanukkah",name:"Hanukkah",description:"Celebrate the Festival of Lights",icon:r.jsx(Ds,{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(Wpt,{})},{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(Gpt,{})},{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(Qpt,{})},{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(Jpt,{})},{id:"just_listed",name:"Just Listed",description:"Announce a new listing",icon:r.jsx(Ts,{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(HNe,{})},{id:"just_sold",name:"Just Sold",description:"Celebrate a successful sale",icon:r.jsx(zd,{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(uT,{})},{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(ngt,{})},{id:"closing_day",name:"Closing Day",description:"Celebrate their closing day",icon:r.jsx(gm,{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(egt,{})},{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(tgt,{})},{id:"offer_accepted",name:"Offer Accepted",description:"Celebrate their accepted offer",icon:r.jsx(pd,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Amazing News, ${e}!`:"Offer Accepted!",subText:"Your offer has been accepted – congratulations!",gradientClasses:"from-green-50/70 via-emerald-50/50 to-teal-50/40 dark:from-green-950/30 dark:via-emerald-950/20 dark:to-teal-950/20",accentColor:"green",decorativeElement:r.jsx(uT,{})},{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(VNe,{})}],agt=[{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 igt(e){return Tme.filter(t=>t.category===e)}function Y4(e){return Tme.find(t=>t.id===e)||Tme[0]}function ogt(){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(Q=>{document.querySelectorAll(Q).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:Q}=await Y.storage.from("avatars").list(`${V.owner_user_id}`);if(Q&&Q.length>0){const{data:ae}=Y.storage.from("avatars").getPublicUrl(`${V.owner_user_id}/${Q[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=Y4((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(Wr,{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(Je,{className:"py-12 text-center",children:[r.jsx(Pa,{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(Ti,{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(X,{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(Ii,{className:"h-4 w-4"})})}),s.email&&r.jsx(X,{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(ks,{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(Pa,{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(X,{size:"lg",onClick:()=>v(!0),className:"gap-2",children:[r.jsx(Vl,{className:"h-5 w-5"}),"Watch Video"]})}),r.jsx(Dpt,{shareToken:e,agentName:(s==null?void 0:s.name)||null,hasContact:!!t.contact_id})]})]})]})}function lgt(){return A.useEffect(()=>(document.body.classList.add("video-landing-page"),()=>{document.body.classList.remove("video-landing-page")}),[]),r.jsx(Prt,{})}function cgt(){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(Wr,{className:"h-5 w-5 animate-spin"}),r.jsx("span",{children:"Loading video preview…"})]})})}const dgt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},ugt={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 hgt(){var se,pe,ne,me;const{slugOrId:e}=Ec(),[t]=Zc(),{data:n,isLoading:s}=jDe(e||""),a=kDe(),o=Cct(),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=he=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(he),W=async he=>{if(he.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)||[],Q=G.find(he=>he.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(Tr,{className:"h-8 w-32"})})}),r.jsxs("div",{className:"container mx-auto px-4 py-8",children:[r.jsx(Tr,{className:"h-10 w-48 mb-6"}),r.jsx(Tr,{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(Tr,{className:"h-12 w-48"}),r.jsx(Tr,{className:"h-6 w-full"}),r.jsx(Tr,{className:"h-6 w-3/4"})]}),r.jsx(Tr,{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:qte,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(X,{asChild:!0,children:r.jsx(co,{to:"/public/listings",children:"Browse All Listings"})})]})]});const de=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:[de," | 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}. ${((se=n.description)==null?void 0:se.slice(0,150))||""}`}),r.jsx("link",{rel:"canonical",href:`https://listings.relevelup.com/${n.slug||n.id}`}),r.jsx("meta",{property:"og:title",content:de}),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}`}),Q&&r.jsx("meta",{property:"og:image",content:Q.photo_url}),Q&&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:de}),r.jsx("meta",{name:"twitter:description",content:`${V(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA in ${n.city}, ${n.state}`}),Q&&r.jsx("meta",{name:"twitter:image",content:Q.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(he=>he.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:(pe=n.agent.brokerage)!=null&&pe.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:qte,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:Q==null?void 0:Q.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((he,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:he.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"]})]},he.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(Tt,{className:`${dgt[n.status]} text-white border-0`,children:ugt[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(Fo,{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(U1,{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($1,{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(Ts,{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(Tt,{variant:"secondary",children:[r.jsx(mi,{className:"h-3 w-3 mr-1"}),TS[n.property_type]]}),n.lot_size&&r.jsxs(Tt,{variant:"secondary",children:["Lot: ",n.lot_size]}),n.has_hoa&&r.jsx(Tt,{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(X,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:n.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Ms,{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(Je,{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(Pa,{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(X,{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(Je,{children:[r.jsx("p",{className:"font-semibold text-lg",children:n.agent.name}),((ne=n.agent.brokerage)==null?void 0:ne.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(Je,{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(ks,{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:he=>u(he.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:he=>x(he.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:he=>v(he.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:he=>N(he.target.value)})]}),r.jsx(X,{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(Or,{open:P!==null,onOpenChange:()=>F(null),children:r.jsxs(Lr,{className:"max-w-5xl p-0 bg-black/95",children:[r.jsx(zr,{className:"sr-only",children:r.jsx(Fr,{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(us,{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(Or,{open:D,onOpenChange:U,children:r.jsxs(Lr,{className:"max-w-4xl p-0 bg-black overflow-hidden",children:[r.jsx(zr,{className:"sr-only",children:r.jsx(Fr,{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(us,{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 mgt(){var o;const{slug:e}=Ec(),{data:t,isLoading:n,error:s}=MDe(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(Tr,{className:"h-28 w-28 rounded-full"}),r.jsx(Tr,{className:"h-6 w-48"}),r.jsx(Tr,{className:"h-4 w-36"})]}),r.jsx(Tr,{className:"h-12 w-full"}),r.jsx(Tr,{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 hT({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(X,{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(X,{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(X,{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 fgt(e){return"EST"}function zE(e){const n=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0,timeZone:"America/New_York"}).format(e),s=fgt();return`${n} ${s}`}function X4(e){const t=new Date,n=new Date(e),s=CNe(n,-15),a=CNe(n,30);return t>a?"ended":LNe(t,{start:n,end:a})?"live":LNe(t,{start:s,end:n})?"starting_soon":"upcoming"}function Eye(e){const t=X4(e);return t==="starting_soon"||t==="live"}const WNe=Eye,pgt=({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=X4(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(Qa,{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 ${zE(new Date(l.event_date))}`:`Starts at ${zE(new Date(l.event_date))}`})]}),r.jsx("div",{className:"flex items-center gap-2",children:x?r.jsxs(X,{onClick:()=>window.open(m,"_blank"),className:`${v.button} text-white gap-2`,children:[r.jsx(Ms,{className:"h-4 w-4"}),y?"Join Now":"Join When Live"]}):r.jsxs(X,{variant:"outline",onClick:n,className:`${v.outlineButton} gap-2`,children:[r.jsx(qn,{className:"h-4 w-4"}),"Register & Join"]})})]})})]})};var Iye="Progress",Pye=100,[ggt]=cc(Iye),[xgt,ygt]=ggt(Iye),pRe=A.forwardRef((e,t)=>{const{__scopeProgress:n,value:s=null,max:a,getValueLabel:o=vgt,...l}=e;(a||a===0)&&!GNe(a)&&console.error(_gt(`${a}`,"Progress"));const i=GNe(a)?a:Pye;s!==null&&!KNe(s,i)&&console.error(bgt(`${s}`,"Progress"));const u=KNe(s,i)?s:null,m=sre(u)?o(u,i):void 0;return r.jsx(xgt,{scope:n,value:u,max:i,children:r.jsx(Bn.div,{"aria-valuemax":i,"aria-valuemin":0,"aria-valuenow":sre(u)?u:void 0,"aria-valuetext":m,role:"progressbar","data-state":yRe(u,i),"data-value":u??void 0,"data-max":i,...l,ref:t})})});pRe.displayName=Iye;var gRe="ProgressIndicator",xRe=A.forwardRef((e,t)=>{const{__scopeProgress:n,...s}=e,a=ygt(gRe,n);return r.jsx(Bn.div,{"data-state":yRe(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...s,ref:t})});xRe.displayName=gRe;function vgt(e,t){return`${Math.round(e/t*100)}%`}function yRe(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function sre(e){return typeof e=="number"}function GNe(e){return sre(e)&&!isNaN(e)&&e>0}function KNe(e,t){return sre(e)&&!isNaN(e)&&e<=t&&e>=0}function _gt(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 bgt(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 vRe=pRe,wgt=xRe;const Mc=A.forwardRef(({className:e,value:t,...n},s)=>r.jsx(vRe,{ref:s,className:Ut("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:r.jsx(wgt,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Mc.displayName=vRe.displayName;function jgt(){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,Q,ae,oe,de,se,pe,ne,me,he,xe,Te,be,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={},et=(Be=W.data)==null?void 0:Be.brokerage_id;ve.share_resource=(G.count||0)>0,ve.post_community=(Q.count||0)>0,ve.register_event=(ae.count||0)>0,ve.view_template=(oe.count||0)>0,ve.watch_academy=(de.count||0)>0,ve.use_toolbox=(se.count||0)>0,ve.launch_app=(pe.count||0)>0,ve.add_contact=(ne.count||0)>0,ve.create_video=(me.count||0)>0,ve.complete_touch=(he.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=be.data)==null?void 0:Ve.map(ot=>ot.id))||[],Ie=[];et?Ie.push(Y.from("profiles").select("id").eq("brokerage_id",et).neq("id",e.id).then(ot=>{var At;ve.add_agent=(((At=ot.data)==null?void 0:At.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:At}=await Y.from("onboarding_checklist_progress").upsert(ot,{onConflict:"user_id,item_id",ignoreDuplicates:!0});if(!At){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 kgt={add_agent:r.jsx(qn,{className:"h-4 w-4"}),share_resource:r.jsx(Nc,{className:"h-4 w-4"}),post_community:r.jsx(zo,{className:"h-4 w-4"}),register_event:r.jsx(Ts,{className:"h-4 w-4"}),view_template:r.jsx(K0,{className:"h-4 w-4"}),watch_academy:r.jsx(G1,{className:"h-4 w-4"}),use_toolbox:r.jsx(vy,{className:"h-4 w-4"}),launch_app:r.jsx(JT,{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"})},Ngt={add_deal:"/mission-control/pipeline",add_listing:"/mission-control/listings/new",post_community:"/community",add_contact:"/mission-control/contacts"};function Sgt(){const{items:e,isDismissed:t,loading:n,completedCount:s,totalCount:a,isComplete:o,progressPercentage:l,isItemComplete:i,markComplete:u,dismiss:m}=jgt(),x=Wn(),[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(X,{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(Fd,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"sm",onClick:m,className:"h-8 w-8 p-0 text-muted-foreground hover:text-foreground",children:r.jsx(us,{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(Je,{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=Ngt[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(eh,{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:kgt[b.action_type]||r.jsx(eh,{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})},Cgt=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}),_Re=()=>{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=qr(),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"]}),Ca({title:"Contact created successfully"})},onError:n=>{Ca({title:"Error creating contact",description:n.message,variant:"destructive"})}})},bRe=()=>{const e=qr();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"]}),Ca({title:"Contact updated successfully"})},onError:t=>{Ca({title:"Error updating contact",description:t.message,variant:"destructive"})}})},Oye=()=>{const e=qr();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"]}),Ca({title:"Contact deleted successfully"})},onError:t=>{Ca({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}}),Mgt=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}}),Tgt=()=>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}}),Agt=()=>{const e=qr(),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"]}),Ca({title:"Plan created successfully"})},onError:n=>{Ca({title:"Error creating plan",description:n.message,variant:"destructive"})}})},Egt=()=>{const e=qr(),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"]}),Ca({title:"Plan duplicated successfully",description:"You can now edit your copy of this plan."})},onError:n=>{Ca({title:"Error duplicating plan",description:n.message,variant:"destructive"})}})},Igt=()=>{const e=qr();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"]}),Ca({title:"Plan updated successfully"})}})},Pgt=()=>{const e=qr();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"]}),Ca({title:"Plan deleted successfully"})}})},Lgt=()=>{const e=qr();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"]}),Ca({title:"Plan schedule updated"})}})},Ogt=()=>{const e=qr();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"]}),Ca({title:"Script created successfully"})},onError:t=>{Ca({title:"Error creating script",description:t.message,variant:"destructive"})}})},Dgt=()=>{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})},Rgt=()=>{const e=qr(),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"]}),Ca({title:"Plan enrollment updated"})}})},dae=(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})},wRe=()=>{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})},Fgt=(e=90)=>{const{data:t}=Nf(),{data:n}=wRe();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=qr(),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"]}),Ca({title:"Action completed!"})}})},kRe="agentos_weekly_touch_goal",ZNe=20,are=()=>{if(typeof window>"u")return ZNe;const e=localStorage.getItem(kRe);if(e){const t=parseInt(e,10);if(!isNaN(t)&&t>0)return t}return ZNe},NRe=e=>{localStorage.setItem(kRe,e.toString())},SRe=()=>{const{data:e}=dae(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=are();return{actionsThisWeek:s,weeklyGoal:o,streak:a,progress:Math.min(s/o*100,100)}},zgt=()=>{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})},Bgt=()=>{const e=qr();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&&Ca({title:`${t} contact(s) enrolled in plans`})}})},CRe=()=>{const e=Yc(),{data:t}=zgt(),{data:n}=dae(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 $gt(){const e=Wn(),{data:t,isLoading:n}=CRe(),{data:s}=Nf(),a=SRe(),[o,l]=A.useState(are()),[i,u]=A.useState(""),[m,x]=A.useState(!1);A.useEffect(()=>{l(are())},[]);const y=()=>{const U=parseInt(i,10);if(isNaN(U)||U<1){Ca({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}l(U),NRe(U),x(!1),Ca({title:"Goal updated",description:`Weekly touch goal set to ${U}`})},v=()=>{u(o.toString()),x(!0)},b=Cm(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(Je,{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(qn,{className:"h-5 w-5 text-primary"}),"Agent OS"]}),r.jsx("div",{className:"flex items-center gap-2",children:D>0&&r.jsxs(Tt,{variant:"secondary",className:"gap-1 bg-orange-500/10 text-orange-600 border-orange-200",children:[r.jsx(pm,{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(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(X,{size:"sm",variant:"outline",className:"gap-1.5",onClick:U=>{U.stopPropagation(),e("/mission-control/contacts?new=true")},children:[r.jsx(nh,{className:"h-3.5 w-3.5"}),"Add Contact"]}),r.jsxs(X,{size:"sm",variant:"outline",className:"gap-1.5",onClick:U=>{U.stopPropagation(),e("/mission-control")},children:[r.jsx(Ii,{className:"h-3.5 w-3.5"}),"Log Touch"]}),r.jsxs(X,{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(Pa,{className:"h-3.5 w-3.5"}),"Quick Video"]}),r.jsxs(X,{size:"sm",variant:"outline",className:"gap-1.5",onClick:U=>{U.stopPropagation(),e("/mission-control/popbys")},children:[r.jsx(Fo,{className:"h-3.5 w-3.5"}),"Pop-by Map"]}),r.jsxs(X,{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(yy,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm font-medium",children:"Weekly Goal"}),r.jsxs(Or,{open:m,onOpenChange:x,children:[r.jsx(Co,{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(Bd,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-primary"})})}),r.jsxs(Lr,{className:"sm:max-w-[360px]",children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Set Weekly Goal"}),r.jsx(Qn,{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(X,{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(fm,{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(fm,{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(Tt,{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"?"🎂":"🏠":ln(U.date,"EEE, MMM d")}),r.jsx(Gi,{className:"h-3 w-3"})]})]},`${U.contact.id}-${U.type}-${V}`))})]}),r.jsxs(X,{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 MRe=()=>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}}),TRe=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}})},ARe=()=>{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})},ERe=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})},Ugt=()=>{const e=qr(),{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"]})}})},qgt=()=>{const e=qr();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"]})}})},Vgt=()=>{const e=qr();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]})}})},IRe=()=>{const e=qr();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"]})}})},Hgt=()=>{const e=qr();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"]})}})},Wgt=()=>{const e=qr();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"]})}})},Ggt=()=>{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})},PRe=()=>{const e=qr(),{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"]})}})},LRe=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})},Kgt=()=>{const e=qr(),{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"]})}})},Zgt=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})},Ygt=()=>{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}})},Xgt=()=>{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})},Qgt=()=>{const e=qr(),{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"]})}})},Jgt=()=>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}}}),ext=()=>{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})},ORe=({className:e,variant:t="default"})=>r.jsx(Tt,{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"}),txt={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"},rxt={coming_soon:"Coming Soon",active:"Active",under_contract:"Under Contract",sold:"Sold",withdrawn:"Withdrawn"};function nxt(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:`$${(e/1e3).toFixed(0)}K`}function sxt(){const e=Wn(),{data:t,isLoading:n}=MRe(),{data:s,isLoading:a}=TRe({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(Je,{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(ORe,{})]}),r.jsxs(X,{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(Je,{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(X,{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(Tt,{className:"gap-1 bg-amber-500 text-white border-0 text-[10px] px-1.5 py-0.5",children:[r.jsx(Ss,{className:"h-2.5 w-2.5 fill-current"}),"Featured"]})}),r.jsx("div",{className:"absolute top-1.5 right-1.5",children:r.jsx(Tt,{className:`text-[10px] px-1.5 py-0.5 ${txt[x.status]}`,children:rxt[x.status]})})]}),r.jsxs("div",{className:"p-2",children:[r.jsx("p",{className:"font-bold text-sm text-foreground",children:nxt(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 DRe(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 RRe(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 FRe(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 zRe(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 axt(){const{user:e,brokerageId:t,isAdmin:n}=tn();Wn();const s=!!t,[a,o]=A.useState("brokerage"),l=()=>{if(n)return null;if(s)return a==="global"?null:t},{data:i,isLoading:u}=DRe(5,l()),{data:m}=RRe(e==null?void 0:e.id),{data:x}=zRe(e==null?void 0:e.id,l()),{data:y}=FRe(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(Je,{children:r.jsx("div",{className:"space-y-2",children:[...Array(v?5:3)].map((k,M)=>r.jsx(Tr,{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(X,{variant:a==="brokerage"?"default":"outline",size:"sm",className:"text-xs h-7 flex-1",onClick:()=>o("brokerage"),children:"My Brokerage"}),r.jsx(X,{variant:a==="global"?"default":"outline",size:"sm",className:"text-xs h-7 flex-1",onClick:()=>o("global"),children:"All LevelUp"})]})]}),r.jsxs(Je,{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(Je,{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(pm,{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(Ss,{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 uae=()=>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}}),ixt=()=>{const e=qr(),{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})},BRe=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})},hae=()=>{const e=qr(),{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)}})},oxt=()=>{const e=qr();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)}})},lxt=()=>{const e=qr();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)}})},$Re=(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})},cxt=()=>{const e=qr(),{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)}})},mae=()=>{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)})},dxt=()=>{const e=qr(),{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)}})},URe=(e,t)=>{const{data:n,isLoading:s}=Rye(e,t),{data:a,isLoading:o}=BRe(t),{data:l}=mae(),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}},uxt=()=>{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})},J0={recency:40,touchpoints:30,transactions:20},YNe={warm:70,cooling:40};function hxt(e){return e===null?0:e<=14?J0.recency:e<=30?J0.recency*.85:e<=60?J0.recency*.65:e<=90?J0.recency*.4:e<=180?J0.recency*.2:J0.recency*.05}function mxt(e){const t=Math.min(e/12,1);return Math.round(J0.touchpoints*t)}function fxt(e){return e?J0.transactions:0}function pxt(){return 0}function gxt(e){return e>=YNe.warm?"warm":e>=YNe.cooling?"cooling":"at-risk"}function Fye(){const{data:e,isLoading:t}=Nf(),{data:n}=wRe(),{data:s}=dae(365),{data:a}=BRe(),o=A.useMemo(()=>{if(!e)return[];const i=new Date,u=dft(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?Py(i,new Date(v)):null,N=m[y.id]||0,k=x.has(y.id),M=hxt(b),I=mxt(N),T=fxt(k),P=pxt(),F=Math.round(M+I+T+P),D={score:F,status:gxt(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 qRe(){const e=Wn(),{stats:t,contactsWithScores:n,isLoading:s}=Fye();if(s)return r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Tr,{className:"h-5 w-40"})}),r.jsxs(Je,{className:"space-y-4",children:[r.jsx(Tr,{className:"h-20 w-full"}),r.jsx(Tr,{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(qn,{className:"h-5 w-5"}),"Relationship Health"]})}),r.jsxs(Je,{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Add contacts to see your relationship health scores."}),r.jsx(X,{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(rh,{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(Je,{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(X,{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 xxt=()=>{var se,pe;const{user:e,isAdmin:t}=tn(),n=Wn(),[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 ne,me,he,xe;try{const[Te,be,we,ve,et,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=((ne=Te.data)==null?void 0:ne.map(Qe=>Qe.tag))||[],At=new Set(((me=we.data)==null?void 0:me.map(Qe=>Qe.app_id))||[]);M(At);const at=(((he=be.data)==null?void 0:he.filter(Qe=>!Qe.required_tags||Qe.required_tags.length===0?!0:Qe.required_tags.some(rt=>ot.includes(rt))))||[]).sort((Qe,rt)=>Qe.name==="LevelUp Members Portal"?-1:rt.name==="LevelUp Members Portal"?1:0);a(at.slice(0,6));const le=((xe=ve.data)==null?void 0:xe.filter(Qe=>X4(Qe.event_date)!=="ended"))||[];l(le.slice(0,4)),T(et.data||[]),u(Me.data||[]),x(Ie.data||[]),v($e.data||[]),N(Be.data||[]);const qe=Ve.data||[];F(qe.filter(Qe=>Qe.placement==="top")),U(qe.filter(Qe=>Qe.placement==="between"))}catch(Te){console.error("Error loading dashboard:",Te),Ae.error("Failed to load dashboard data")}finally{W(!1)}},Q=async ne=>{var he;const me=window.open("about:blank","_blank");try{await Y.from("activity_logs").insert({user_id:e==null?void 0:e.id,app_id:ne.app_id,app_name:ne.name,user_agent:navigator.userAgent});const{data:xe,error:Te}=await Y.functions.invoke("sso-launch",{body:{app_id:ne.app_id}});if(Te)throw Te;xe!=null&&xe.redirect_url?me&&!me.closed?(me.location.href=xe.redirect_url,(he=me.focus)==null||he.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=ne=>I==null?void 0:I.some(me=>me.event_id===ne),oe=ne=>{const me=I==null?void 0:I.find(he=>he.event_id===ne);return me==null?void 0:me.zoom_join_url};if(V)return r.jsx(Dr,{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 de=ne=>D.filter(me=>me.section_after===ne);return r.jsxs(Dr,{title:"Dashboard",children:[r.jsx(pgt,{events:o,registrations:I,onNavigateToEvents:()=>n("/events")}),P.length>0&&r.jsx("div",{className:"mb-8",children:r.jsx(hT,{banners:P})}),r.jsx(Sgt,{}),r.jsxs("div",{className:"mb-6",children:[r.jsxs("h2",{className:"text-2xl font-bold text-foreground",children:["Welcome back, ",((pe=(se=e==null?void 0:e.user_metadata)==null?void 0:se.name)==null?void 0:pe.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($gt,{}),r.jsx(qRe,{}),r.jsx(axt,{})]}),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(X,{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(Je,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Ts,{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(ne=>{const me=ae(ne.id),he=oe(ne.id)||ne.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 ${WNe(ne.event_date)?"bg-red-500/5 border-l-2 border-l-red-500":""}`,onClick:()=>n("/events"),children:[WNe(ne.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(ne.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(ne.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:ne.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(ne.event_date))," at ",zE(new Date(ne.event_date))]})]}),r.jsx("div",{className:"hidden sm:flex flex-shrink-0",children:me?r.jsxs(X,{size:"sm",variant:"default",className:"gap-1",onClick:xe=>{xe.stopPropagation(),window.open(he,"_blank")},children:[r.jsx(Ms,{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"})]})})]},ne.id)})})]}),de("events").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(hT,{banners:de("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(X,{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(Je,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(nf,{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(ne=>r.jsxs("div",{onClick:()=>n(`/academy/${ne.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:[ne.thumbnail_url?r.jsx("img",{src:ne.thumbnail_url,alt:ne.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(nf,{className:"h-8 w-8 text-muted-foreground/50"})}),ne.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:ne.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:ne.title})})]},ne.id))})]}),de("academy").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(hT,{banners:de("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(X,{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(Je,{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(ne=>r.jsxs("div",{onClick:()=>n(`/toolbox/${ne.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:ne.featured_image_url?r.jsx("img",{src:ne.featured_image_url,alt:ne.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:ne.name})})]},ne.id))})]}),de("toolbox").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(hT,{banners:de("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(X,{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(Je,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(V1,{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(ne=>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:ne.preview_image_url?r.jsx("img",{src:ne.preview_image_url,alt:ne.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(V1,{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:ne.name})})]},ne.id))})]}),de("templates").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(hT,{banners:de("templates")})}),r.jsx("div",{className:"mb-10",children:r.jsx(sxt,{})}),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(X,{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(Je,{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(ne=>{const me=k.has(ne.id);return r.jsxs("div",{onClick:()=>Q(ne),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:ne.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:ne.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:ne.description})]}),me&&r.jsx(Mp,{className:"h-5 w-5 text-primary fill-current flex-shrink-0"})]},ne.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(X,{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(Je,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Ds,{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(ne=>r.jsxs("div",{onClick:()=>window.open(ne.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:ne.preview_image_url?r.jsx("img",{src:ne.preview_image_url,alt:ne.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(Ds,{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:ne.name}),ne.description&&r.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:ne.description})]})]},ne.id))})]})]})};var fae="Switch",[yxt]=cc(fae),[vxt,_xt]=yxt(fae),VRe=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]=sh({prop:a,defaultProp:o??!1,onChange:m,caller:fae});return r.jsxs(vxt,{scope:n,checked:I,disabled:i,children:[r.jsx(Bn.button,{type:"button",role:"switch","aria-checked":I,"aria-required":l,"data-state":KRe(I),"data-disabled":i?"":void 0,disabled:i,value:u,...y,ref:N,onClick:xn(e.onClick,P=>{T(F=>!F),M&&(k.current=P.isPropagationStopped(),k.current||P.stopPropagation())})}),M&&r.jsx(GRe,{control:v,bubbles:!k.current,name:s,value:u,checked:I,required:l,disabled:i,form:x,style:{transform:"translateX(-100%)"}})]})});VRe.displayName=fae;var HRe="SwitchThumb",WRe=A.forwardRef((e,t)=>{const{__scopeSwitch:n,...s}=e,a=_xt(HRe,n);return r.jsx(Bn.span,{"data-state":KRe(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:t})});WRe.displayName=HRe;var bxt="SwitchBubbleInput",GRe=A.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:s=!0,...a},o)=>{const l=A.useRef(null),i=ca(l,o),u=cP(n),m=YI(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}})});GRe.displayName=bxt;function KRe(e){return e?"checked":"unchecked"}var ZRe=VRe,wxt=WRe;const Is=A.forwardRef(({className:e,...t},n)=>r.jsx(ZRe,{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(wxt,{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")})}));Is.displayName=ZRe.displayName;var YRe="AlertDialog",[jxt]=cc(YRe,[_Oe]),Hy=_Oe(),XRe=e=>{const{__scopeAlertDialog:t,...n}=e,s=Hy(t);return r.jsx(Ose,{...s,...n,modal:!0})};XRe.displayName=YRe;var kxt="AlertDialogTrigger",QRe=A.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Hy(n);return r.jsx(Yxe,{...a,...s,ref:t})});QRe.displayName=kxt;var Nxt="AlertDialogPortal",JRe=e=>{const{__scopeAlertDialog:t,...n}=e,s=Hy(t);return r.jsx(Dse,{...s,...n})};JRe.displayName=Nxt;var Sxt="AlertDialogOverlay",eFe=A.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Hy(n);return r.jsx(A3,{...a,...s,ref:t})});eFe.displayName=Sxt;var Q4="AlertDialogContent",[Cxt,Mxt]=jxt(Q4),Txt=nIe("AlertDialogContent"),tFe=A.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...a}=e,o=Hy(n),l=A.useRef(null),i=ca(t,l),u=A.useRef(null);return r.jsx(zlt,{contentName:Q4,titleName:rFe,docsSlug:"alert-dialog",children:r.jsx(Cxt,{scope:n,cancelRef:u,children:r.jsxs(E3,{role:"alertdialog",...o,...a,ref:i,onOpenAutoFocus:xn(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(Txt,{children:s}),r.jsx(Ext,{contentRef:l})]})})})});tFe.displayName=Q4;var rFe="AlertDialogTitle",nFe=A.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Hy(n);return r.jsx(oP,{...a,...s,ref:t})});nFe.displayName=rFe;var sFe="AlertDialogDescription",aFe=A.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Hy(n);return r.jsx(lP,{...a,...s,ref:t})});aFe.displayName=sFe;var Axt="AlertDialogAction",iFe=A.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Hy(n);return r.jsx(Rse,{...a,...s,ref:t})});iFe.displayName=Axt;var oFe="AlertDialogCancel",lFe=A.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:a}=Mxt(oFe,n),o=Hy(n),l=ca(t,a);return r.jsx(Rse,{...o,...s,ref:l})});lFe.displayName=oFe;var Ext=({contentRef:e})=>{const t=`\`${Q4}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${Q4}\` by passing a \`${sFe}\` 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 \`${Q4}\`. 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},Ixt=XRe,Pxt=QRe,Lxt=JRe,cFe=eFe,dFe=tFe,uFe=iFe,hFe=lFe,mFe=nFe,fFe=aFe;const Ld=Ixt,kp=Pxt,Oxt=Lxt,pFe=A.forwardRef(({className:e,...t},n)=>r.jsx(cFe,{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}));pFe.displayName=cFe.displayName;const ld=A.forwardRef(({className:e,...t},n)=>r.jsxs(Oxt,{children:[r.jsx(pFe,{}),r.jsx(dFe,{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=dFe.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(mFe,{ref:n,className:Ut("text-lg font-semibold",e),...t}));ud.displayName=mFe.displayName;const hd=A.forwardRef(({className:e,...t},n)=>r.jsx(fFe,{ref:n,className:Ut("text-sm text-muted-foreground",e),...t}));hd.displayName=fFe.displayName;const Uc=A.forwardRef(({className:e,...t},n)=>r.jsx(uFe,{ref:n,className:Ut(PE(),e),...t}));Uc.displayName=uFe.displayName;const md=A.forwardRef(({className:e,...t},n)=>r.jsx(hFe,{ref:n,className:Ut(PE({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));md.displayName=hFe.displayName;const Dxt=[{key:"contacts",label:"Contacts",icon:Ii,description:"View, add, and edit contacts"},{key:"pipeline",label:"Deal Pipeline",icon:Fj,description:"View, add, and move deals"},{key:"videos",label:"Videos",icon:Pa,description:"View and upload videos"},{key:"listings",label:"Listings",icon:ya,description:"View, create, and edit listings"},{key:"scorecard",label:"Scorecard",icon:iA,description:"View and add transactions"},{key:"popbys",label:"Pop-bys",icon:Fo,description:"View and log pop-bys"}];function Rxt(){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),Q=U.map(ae=>{const oe=G==null?void 0:G.find(de=>de.id===ae.assistant_id);return{...ae,permissions:ae.permissions,assistant_profile:oe?{name:oe.name||"",email:oe.email||""}:void 0}});n(Q)}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 Q=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 Q.json();if(!Q.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 Q={...G.permissions,[V]:W},{error:ae}=await Y.from("agent_assistant_assignments").update({permissions:Q}).eq("id",U);if(ae)throw ae;n(oe=>oe.map(de=>de.id===U?{...de,permissions:Q}:de))}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(qn,{className:"h-5 w-5"}),"My Assistant"]})}),r.jsx(Je,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(Wr,{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(qn,{className:"h-5 w-5"}),"My Assistant"]}),r.jsx(kn,{children:"Add an assistant to help manage your Agent OS"})]}),t.length===0&&r.jsxs(X,{size:"sm",onClick:()=>l(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Assistant"]})]})}),r.jsx(Je,{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,Q;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:((Q=U.assistant_profile)==null?void 0:Q.email)||""})]}),r.jsxs(Tt,{variant:"secondary",className:"ml-2",children:[r.jsx(_m,{className:"h-3 w-3 mr-1"}),"Assistant"]})]}),r.jsx(X,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>{x(U),u(!0)},children:r.jsx(Un,{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:Dxt.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(Is,{checked:U.permissions[ae.key]||!1,onCheckedChange:de=>F(U.id,ae.key,de),disabled:k===U.id})]},ae.key)})})]})]},U.id)})})})]}),r.jsx(Or,{open:o,onOpenChange:l,children:r.jsxs(Lr,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Add Assistant"}),r.jsx(Qn,{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(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsxs(X,{onClick:T,disabled:b,children:[b&&r.jsx(Wr,{className:"h-4 w-4 mr-2 animate-spin"}),"Create Assistant"]})]})]})}),r.jsx(Ld,{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 gFe(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=gFe(a.content,o.content,n+1);if(l!=null)return l}n+=a.nodeSize}}function xFe(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 gn(s,a)}cutByIndex(t,n){return t==n?gn.empty:t==0&&n==this.content.length?this:new gn(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 gn(a,o)}addToStart(t){return new gn([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new gn(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?dO(n+1,o):dO(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 gn.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new gn(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return gn.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}};Go.none=[];class ore extends Error{}class Jn{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=vFe(this.content,t+this.openStart,n);return s&&new Jn(s,this.openStart,this.openEnd)}removeBetween(t,n){return new Jn(yFe(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 Jn.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 Jn(gn.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 Jn(t,s,a)}}Jn.empty=new Jn(gn.empty,0,0);function yFe(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(yFe(o.content,t-a-1,n-a-1)))}function vFe(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=vFe(l.content,t-o-1,n,l);return i&&e.replaceChild(a,l.copy(i))}function Fxt(e,t,n){if(n.openStart>e.depth)throw new ore("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new ore("Inconsistent open depths");return _Fe(e,t,n,0)}function _Fe(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 $A(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&&Eme(e,t,a+1),l=s.depth>a&&Eme(n,s,a+1),i=[];return $A(null,e,a,i),o&&l&&t.index(a)==n.index(a)?(bFe(o,l),Hj(Wj(o,wFe(e,t,n,s,a+1)),i)):(o&&Hj(Wj(o,lre(e,t,a+1)),i),$A(t,n,a,i),l&&Hj(Wj(l,lre(n,s,a+1)),i)),$A(s,null,a,i),new gn(i)}function lre(e,t,n){let s=[];if($A(null,e,n,s),e.depth>n){let a=Eme(e,t,n+1);Hj(Wj(a,lre(e,t,n+1)),s)}return $A(t,null,n,s),new gn(s)}function zxt(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(gn.from(a));return{start:a.resolveNoCache(e.openStart+n),end:a.resolveNoCache(a.content.size-e.openEnd-n)}}class BE{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 cre(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 BE(n,s,o)}static resolveCached(t,n){let s=XNe.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()+")"),jFe(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=gn.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=gn.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 dre 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):jFe(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 dre(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new dre(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 jFe(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 qxt(t,n);if(s.next==null)return hk.empty;let a=kFe(s);s.next&&s.err("Unexpected trailing text");let o=Yxt(Zxt(a));return Xxt(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 qxt{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 kFe(e){let t=[];do t.push(Vxt(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function Vxt(e){let t=[];do t.push(Hxt(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function Hxt(e){let t=Kxt(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=Wxt(e,t);else break;return t}function QNe(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function Wxt(e,t){let n=QNe(e),s=n;return e.eat(",")&&(e.next!="}"?s=QNe(e):s=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:s,expr:t}}function Gxt(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 Kxt(e){if(e.eat("(")){let t=kFe(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=Gxt(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 Zxt(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:CFe(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),gn.from(n),Go.setFrom(s))}createChecked(t=null,n,s){return n=gn.from(n),this.checkContent(n),new nv(this,this.computeAttrs(t),n,Go.setFrom(s))}createAndFill(t=null,n,s){if(t=this.computeAttrs(t),n=gn.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(gn.empty,!0);return o?new nv(this,t,n.append(o),Go.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 AFe(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 Qxt(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 Jxt{constructor(t,n,s){this.hasDefault=Object.prototype.hasOwnProperty.call(s,"default"),this.default=s.default,this.validate=typeof s.validate=="string"?Qxt(t,n,s.validate):s.validate}get isRequired(){return!this.hasDefault}}class pae{constructor(t,n,s,a){this.name=t,this.rank=n,this.schema=s,this.spec=a,this.attrs=TFe(t,a.attrs),this.excluded=null;let o=SFe(this.attrs);this.instance=o?new Go(this,o):null}create(t=null){return!t&&this.instance?this.instance:new Go(this,CFe(this.attrs,t))}static compile(t,n){let s=Object.create(null),a=0;return t.forEach((o,l)=>s[o]=new pae(o,a++,n,l)),s}removeFromSet(t){for(var n=0;n-1}}class EFe{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=eSe.compile(this.spec.nodes,this),this.marks=pae.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?tSe(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==""?[]:tSe(this,l.split(" "))}this.nodeFromJSON=a=>nv.fromJSON(this,a),this.markFromJSON=a=>Go.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 eSe){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 dre(s,s.defaultAttrs,t,Go.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 tSe(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 eyt(e){return e.tag!=null}function tyt(e){return e.style!=null}let UA=class Pme{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let s=this.matchedStyles=[];n.forEach(a=>{if(eyt(a))this.tags.push(a);else if(tyt(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 nSe(this,n,!1);return s.addAll(t,Go.none,n.from,n.to),s.finish()}parseSlice(t,n={}){let s=new nSe(this,n,!0);return s.addAll(t,Go.none,n.from,n.to),Jn.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=sSe(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=sSe(l)),l.node||l.ignore||l.mark||(l.node=a)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new Pme(t,Pme.schemaRules(t)))}};const IFe={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},ryt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},PFe={ol:!0,ul:!0},$E=1,Lme=2,qA=4;function rSe(e,t,n){return t!=null?(t?$E:0)|(t==="full"?Lme:0):e&&e.whitespace=="pre"?$E|Lme:n&~qA}class uO{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=Go.none,this.match=o||(l&qA?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(gn.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&$E)){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=gn.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(gn.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&&!IFe.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class nSe{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=rSe(null,n.preserveWhitespace,0)|(s?qA:0);a?o=new uO(a.type,a.attrs,Go.none,!0,n.topMatch||a.type.contentMatch,l):s?o=new uO(null,null,Go.none,!0,null,l):o=new uO(t.schema.topNodeType,null,Go.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&Lme?"full":this.localPreserveWS||(a.options&$E)>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):aSe(m.type,t))?(u=m.addToSet(u),!1):!0),this.nodes.push(new uO(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|=$E)}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 nyt(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let s=t.nodeType==1?t.nodeName.toLowerCase():null;s&&PFe.hasOwnProperty(s)&&n?(n.appendChild(t),t=n):s=="li"?n=t:s&&(n=null)}}function syt(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function sSe(e){let t={};for(let n in e)t[n]=e[n];return t}function aSe(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&&Wee(Yce(s),a(t,n),null,t.attrs)}static renderSpec(t,n,s=null,a){return Wee(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=iSe(t.nodes);return n.text||(n.text=s=>s.text),n}static marksFromSchema(t){return iSe(t.marks)}}function iSe(e){let t={};for(let n in e){let s=e[n].spec.toDOM;s&&(t[n]=s)}return t}function Yce(e){return e.document||window.document}const oSe=new WeakMap;function ayt(e){let t=oSe.get(e);return t===void 0&&oSe.set(e,t=iyt(e)),t}function iyt(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}=Wee(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 LFe=65535,OFe=Math.pow(2,16);function oyt(e,t){return e+t*OFe}function lSe(e){return e&LFe}function lyt(e){return(e-(e&LFe))/OFe}const DFe=1,RFe=2,Gee=4,FFe=8;class Ome{constructor(t,n,s){this.pos=t,this.delInfo=n,this.recover=s}get deleted(){return(this.delInfo&FFe)>0}get deletedBefore(){return(this.delInfo&(DFe|Gee))>0}get deletedAfter(){return(this.delInfo&(RFe|Gee))>0}get deletedAcross(){return(this.delInfo&Gee)>0}}class cm{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&cm.empty)return cm.empty}recover(t){let n=0,s=lSe(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:oyt(i/3,t-u),k=t==u?RFe:t==y?DFe:Gee;return(n<0?t!=u:t!=y)&&(k|=FFe),new Ome(b,k,N)}a+=x-m}return s?t+a:new Ome(t+a,0,null)}touches(t,n){let s=0,a=lSe(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 UE;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 T1(n.pos,s.pos,this.mark)}merge(t){return t instanceof T1&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new T1(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 T1(n.from,n.to,t.markFromJSON(n.mark))}}Su.jsonID("addMark",T1);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 Jn(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 T1(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 A1 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 Jn(gn.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,Jn.fromJSON(t,n.slice),n.insert,!!n.structure)}}Su.jsonID("replaceAround",$d);function Dme(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 cyt(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 dyt(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 pae){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 uyt(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function L3(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=gn.from(s.node(N).copy(x)),y++):u--;let v=gn.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=gn.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 Jn(s,0,0),n.length,!0))}function gyt(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)&&xyt(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&&BFe(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 Jn(gn.from(s.create(u,null,l.marks)),0,0),1,!0)),m===!0&&zFe(e,l,i,o),!1}})}function zFe(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 BFe(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 xyt(e,t,n){let s=e.resolve(t),a=s.index();return s.parent.canReplaceWith(a,a+1,n)}function yyt(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 Jn(gn.from(l),0,0),1,!0))}function _y(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 vyt(e,t,n=1,s){let a=e.doc.resolve(t),o=gn.empty,l=gn.empty;for(let i=a.depth,u=a.depth-n,m=n-1;i>u;i--,m--){o=gn.from(a.node(i).copy(o));let x=s&&s[m];l=gn.from(x?x.type.create(x.attrs,l):a.node(i).copy(l))}e.step(new Id(t,t,new Jn(o.append(l),n,n),!0))}function Tv(e,t){let n=e.resolve(t),s=n.index();return $Fe(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(s,s+1)}function _yt(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&&$Fe(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 byt(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);BFe(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 Id(m,u.map(t+n,-1),Jn.empty,!0)),s===!0){let x=e.doc.resolve(m);zFe(e,x.node(),x.before(),e.steps.length)}return e}function wyt(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 xae(e,t,n=t,s=Jn.empty){if(t==n&&!s.size)return null;let a=e.resolve(t),o=e.resolve(n);return qFe(a,o,s)?new Id(t,n,s):new jyt(a,o,s).fit()}function qFe(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class jyt{constructor(t,n,s){this.$from=t,this.$to=n,this.unplaced=s,this.frontier=[],this.placed=gn.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=gn.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 Jn(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 Id(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=Qce(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(gn.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=Qce(t,n);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new Jn(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=Qce(t,n);if(a.childCount<=1&&n>0){let o=t.size-n<=n+a.size;this.unplaced=new Jn(RT(t,n-1,1),n-1,o?n-1:s)}else this.unplaced=new Jn(RT(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(VFe(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=FT(this.placed,n,gn.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=Jce(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=FT(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=FT(this.placed,this.depth,gn.from(t.create(n,s))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(gn.empty,!0);n.childCount&&(this.placed=FT(this.placed,this.frontier.length,n))}}function RT(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(RT(e.firstChild.content,t-1,n)))}function FT(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(FT(e.lastChild.content,t-1,n)))}function Qce(e,t){for(let n=0;n1&&(s=s.replaceChild(0,VFe(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(gn.empty,!0)))),e.copy(s)}function Jce(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&&!kyt(n,o.content,l)?i:null}function kyt(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=Nyt(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 HFe(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(gn.empty,!0))}return e}function Cyt(e,t,n,s){if(!s.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let a=wyt(e.doc,t,s.type);a!=null&&(t=n=a)}e.replaceRange(t,n,new Jn(gn.from(s),0,0))}function Myt(e,t,n){let s=e.doc.resolve(t),a=e.doc.resolve(n),o=WFe(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 WFe(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 J4 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 Jn(gn.from(a),0,n.isLeaf?0:1))}getMap(){return cm.empty}invert(t){return new J4(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 J4(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 J4(n.pos,n.attr,n.value)}}Su.jsonID("attr",J4);class qE 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 cm.empty}invert(t){return new qE(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 qE(n.attr,n.value)}}Su.jsonID("docAttr",qE);let FC=class extends Error{};FC=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};FC.prototype=Object.create(Error.prototype);FC.prototype.constructor=FC;FC.prototype.name="TransformError";class Uye{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new UE}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new FC(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=Jn.empty){let a=xae(this.doc,t,n,s);return a&&this.step(a),this}replaceWith(t,n,s){return this.replace(t,n,new Jn(gn.from(s),0,0))}delete(t,n){return this.replace(t,n,Jn.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,s){return Syt(this,t,n,s),this}replaceRangeWith(t,n,s){return Cyt(this,t,n,s),this}deleteRange(t,n){return Myt(this,t,n),this}lift(t,n){return hyt(this,t,n),this}join(t,n=1){return byt(this,t,n),this}wrap(t,n){return pyt(this,t,n),this}setBlockType(t,n=t,s,a=null){return gyt(this,t,n,s,a),this}setNodeMarkup(t,n,s=null,a){return yyt(this,t,n,s,a),this}setNodeAttribute(t,n,s){return this.step(new J4(t,n,s)),this}setDocAttribute(t,n){return this.step(new qE(t,n)),this}addNodeMark(t,n){return this.step(new A1(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 Go)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 vyt(this,t,n,s),this}addMark(t,n,s){return cyt(this,t,n,s),this}removeMark(t,n,s){return dyt(this,t,n,s),this}clearIncompatible(t,n,s){return Bye(this,t,n,s),this}}const ede=Object.create(null);class Da{constructor(t,n,s){this.$anchor=t,this.$head=n,this.ranges=s||[new GFe(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 wm(t.node(0))}static atStart(t){return qS(t,t,0,0,1)||new wm(t)}static atEnd(t){return qS(t,t,t.content.size,t.childCount,-1)||new wm(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let s=ede[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 ede)throw new RangeError("Duplicate use of selection JSON ID "+t);return ede[t]=n,n.prototype.jsonID=t,n}getBookmark(){return va.between(this.$anchor,this.$head).getBookmark()}}Da.prototype.visible=!0;class GFe{constructor(t,n){this.$from=t,this.$to=n}}let dSe=!1;function uSe(e){!dSe&&!e.parent.inlineContent&&(dSe=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class va extends Da{constructor(t,n=t){uSe(t),uSe(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 Da.near(s);let a=t.resolve(n.map(this.anchor));return new va(a.parent.inlineContent?a:s,s)}replace(t,n=Jn.empty){if(super.replace(t,n),n==Jn.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 yae(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=Da.findFrom(n,s,!0)||Da.findFrom(n,-s,!0);if(o)n=o.$head;else return Da.near(n,s)}return t.parent.inlineContent||(a==0?t=n:(t=(Da.findFrom(t,-s,!0)||Da.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 hSe(e,t,n){let s=e.steps.length-1;if(s{l==null&&(l=x)}),e.setSelection(Da.near(e.doc.resolve(l),n))}const mSe=1,hO=2,fSe=4;class Ayt 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|=hO,this}ensureMarks(t){return Go.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&hO)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~hO,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)||Go.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(Da.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|=fSe,this}get scrolledIntoView(){return(this.updated&fSe)>0}}function pSe(e,t){return!t||!e?e:e.bind(t)}class zT{constructor(t,n,s){this.name=t,this.init=pSe(n.init,s),this.apply=pSe(n.apply,s)}}const Eyt=[new zT("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new zT("selection",{init(e,t){return e.selection||Da.atStart(t.doc)},apply(e){return e.selection}}),new zT("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,s){return s.selection.$cursor?e.storedMarks:null}}),new zT("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class tde{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Eyt.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 zT(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 tde(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=Da.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 KFe(e,t,n){for(let s in e){let a=e[s];a instanceof Function?a=a.bind(t):s=="handleDOMEvents"&&(a=KFe(a,t,{})),n[s]=a}return n}class xd{constructor(t){this.spec=t,this.props={},t.props&&KFe(t.props,this,this.props),this.key=t.key?t.key.key:ZFe("plugin")}getState(t){return t[this.key]}}const rde=Object.create(null);function ZFe(e){return e in rde?e+"$"+ ++rde[e]:(rde[e]=0,e+"$")}class Cu{constructor(t="key"){this.key=ZFe(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},zC=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let Rme=null;const Hx=function(e,t,n){let s=Rme||(Rme=document.createRange());return s.setEnd(e,n??e.nodeValue.length),s.setStart(e,t||0),s},Iyt=function(){Rme=null},fk=function(e,t,n,s){return n&&(gSe(e,t,n,s,-1)||gSe(e,t,n,s,1))},Pyt=/^(img|br|input|textarea|hr)$/i;function gSe(e,t,n,s,a){for(var o;;){if(e==n&&t==s)return!0;if(t==(a<0?0:af(e))){let l=e.parentNode;if(!l||l.nodeType!=1||mP(e)||Pyt.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?af(e):0}else return!1}}function af(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Lyt(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=af(e)}else if(e.parentNode&&!mP(e))t=ru(e),e=e.parentNode;else return null}}function Oyt(e,t){for(;;){if(e.nodeType==3&&t2),Jm=BC||(Jg?/Mac/.test(Jg.platform):!1),QFe=Jg?/Win/.test(Jg.platform):!1,ry=/Android \d/.test(Av),fP=!!xSe&&"webkitFontSmoothing"in xSe.documentElement.style,zyt=fP?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Byt(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 $yt(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 ySe(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=zC(l);continue}let i=l,u=i==o.body,m=u?Byt(o):$yt(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:zC(l)}}function Uyt(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:JFe(e.dom)}}function JFe(e){let t=[],n=e.ownerDocument;for(let s=e;s&&(t.push({dom:s,top:s.scrollTop,left:s.scrollLeft}),e!=n);s=zC(s));return t}function qyt({refDOM:e,refTop:t,stack:n}){let s=e?e.getBoundingClientRect().top:0;eze(n,s==0?0:s-t)}function eze(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?Hyt(n,a):!n||s&&n.nodeType==1?{node:e,offset:o}:tze(n,a)}function Hyt(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 Wyt(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 Kyt(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 rze(e,t,n){let s=e.childNodes.length;if(s&&n.topt.top&&a++}let m;fP&&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=Kyt(e,s,a,t))}i==null&&(i=Gyt(e,l,t));let u=e.docView.nearestDesc(l,!0);return{pos:i,inside:u?u.posAtStart-u.border:-1}}function vSe(e){return e.top=0&&a==s.nodeValue.length?(u--,x=1):n<0?u--:m++,mT(V0(Hx(s,u,m),x),x<0)}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(o==null&&a&&(n<0||a==af(s))){let u=s.childNodes[a-1];if(u.nodeType==1)return nde(u.getBoundingClientRect(),!1)}if(o==null&&a=0)}if(o==null&&a&&(n<0||a==af(s))){let u=s.childNodes[a-1],m=u.nodeType==3?Hx(u,af(u)-(l?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(m)return mT(V0(m,1),!1)}if(o==null&&a=0)}function mT(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 nde(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 sze(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 Xyt(e,t,n){let s=t.selection,a=n=="up"?s.$from:s.$to;return sze(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=nze(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 Qyt=/[\u0590-\u08ac]/;function Jyt(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?!Qyt.test(s.parent.textContent)||!i.modify?n=="left"||n=="backward"?o:l:sze(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 _Se=null,bSe=null,wSe=!1;function e0t(e,t,n){return _Se==t&&bSe==n?wSe:(_Se=t,bSe=n,wSe=n=="up"||n=="down"?Xyt(e,t,n):Jyt(e,t,n))}const xf=0,jSe=1,lj=2,ex=3;class pP{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 ize){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 aze&&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:jSe,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:jSe;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 t0t extends pP{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 pP{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=Ume(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=cze(x,s,n),m?u=new r0t(t,n,s,a,x,y||null,v,m,o,l+1):n.isText?new _ae(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=()=>gn.empty)}return t}matchesNode(t,n,s){return this.dirty==xf&&t.eq(this.node)&&ure(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 s0t(this,l&&l.node,t);o0t(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?Go.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),oze(this.contentDOM,this.children,t),BC&&l0t(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=c0t(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 t0t(this,o,n,a);t.input.compositionNodes.push(l),this.children=Ume(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(ure(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,s=this.dom;this.dom=lze(this.dom,this.nodeDOM,$me(this.outerDeco,this.node,n),$me(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 kSe(e,t,n,s,a){cze(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 _ae 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 _ae(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 ize extends pP{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 r0t 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 oze(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 i0t(e,t){return e.type.side-t.type.side}function o0t(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 l0t(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 c0t(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 Ume(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(vae(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&&Dyt(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(()=>{(!dze(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function u0t(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&&Fh&&sv<=11&&(n.disabled=!0,n.disabled=!1)}function uze(e,t){if(t instanceof ua){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(TSe(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else TSe(e)}function TSe(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 ASe(e){return e.editable&&!e.hasFocus()?!1:hze(e)}function hze(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 h0t(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 qme(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&&Da.findFrom(o,t)}function e1(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function ESe(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 e1(e,new va(s.$anchor,l))}else if(s.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let a=qme(e.state,t);return a&&a instanceof ua?e1(e,a):!1}else if(!(Jm&&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)?e1(e,new ua(t<0?e.state.doc.resolve(a.pos-o.nodeSize):a)):fP?e1(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 e1(e,new va(t>0?s.$to:s.$from));{let a=qme(e.state,t);return a?e1(e,a):!1}}}function hre(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function HA(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?m0t(e):f0t(e)}function m0t(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(HA(i,-1))a=n,o=--s;else if(i.nodeType==3)n=i,s=n.nodeValue.length;else break}}else{if(mze(n))break;{let i=n.previousSibling;for(;i&&HA(i,-1);)a=n.parentNode,o=ru(i),i=i.previousSibling;if(i)n=i,s=hre(n);else{if(n=n.parentNode,n==e.dom)break;s=0}}}l?Vme(e,n,s):a&&Vme(e,a,o)}function f0t(e){let t=e.domSelectionRange(),n=t.focusNode,s=t.focusOffset;if(!n)return;let a=hre(n),o,l;for(;;)if(s{e.state==a&&by(e)},50)}function ISe(e,t){let n=e.state.doc.resolve(t);if(!(Od||QFe)&&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 PSe(e,t,n){let s=e.state.selection;if(s instanceof va&&!s.empty||n.indexOf("s")>-1||Jm&&n.indexOf("m")>-1)return!1;let{$from:a,$to:o}=s;if(!a.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let l=qme(e.state,t);if(l&&l instanceof ua)return e1(e,l)}if(!a.parent.inlineContent){let l=t<0?a:o,i=s instanceof wm?Da.near(l,t):Da.findFrom(l,t);return i?e1(e,i):!1}return!1}function LSe(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 OSe(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function x0t(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;OSe(e,s,"true"),setTimeout(()=>OSe(e,s,"false"),20)}return!1}function y0t(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function v0t(e,t){let n=t.keyCode,s=y0t(t);if(n==8||Jm&&n==72&&s=="c")return LSe(e,-1)||ES(e,-1);if(n==46&&!t.shiftKey||Jm&&n==68&&s=="c")return LSe(e,1)||ES(e,1);if(n==13||n==27)return!0;if(n==37||Jm&&n==66&&s=="c"){let a=n==37?ISe(e,e.state.selection.from)=="ltr"?-1:1:-1;return ESe(e,a,s)||ES(e,a)}else if(n==39||Jm&&n==70&&s=="c"){let a=n==39?ISe(e,e.state.selection.from)=="ltr"?1:-1:1;return ESe(e,a,s)||ES(e,a)}else{if(n==38||Jm&&n==80&&s=="c")return PSe(e,-1,s)||ES(e,-1);if(n==40||Jm&&n==78&&s=="c")return x0t(e)||PSe(e,1,s)||ES(e,1);if(s==(Jm?"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=vze(),u=i.createElement("div");u.appendChild(l.serializeFragment(s,{document:i}));let m=u.firstChild,x,y=0;for(;m&&m.nodeType==1&&(x=yze[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 fze(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 Jn(gn.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=j0t(n),fP&&k0t(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")||UA.fromSchema(e.state.schema)).parseSlice(l,{preserveWhitespace:!!(u||x),context:a,ruleFromNode(v){return v.nodeName=="BR"&&!v.nextSibling&&v.parentNode&&!_0t.test(v.parentNode.nodeName)?{ignore:!0}:null}})),x)i=N0t(DSe(i,+x[1],+x[2]),x[4]);else if(i=Jn.maxOpen(b0t(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 _0t=/^(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 b0t(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&&gze(u,o,i,l[l.length-1],0))l[l.length-1]=m;else{l.length&&(l[l.length-1]=xze(l[l.length-1],o.length));let x=pze(i,u);l.push(x),a=a.matchType(x.type),o=u}}),l)return gn.from(l)}return e}function pze(e,t,n=0){for(let s=t.length-1;s>=n;s--)e=t[s].create(null,gn.from(e));return e}function gze(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(gn.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,l.copy(i))}function DSe(e,t,n){return tn})),ade.createHTML(e)):e}function j0t(e){let t=/^(\s*]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=vze().createElement("div"),s=/<([a-z][^>\s]+)/i.exec(e),a;if((a=s&&yze[s[1].toLowerCase()])&&(e=a.map(o=>"<"+o+">").join("")+e+a.map(o=>"").reverse().join("")),n.innerHTML=w0t(e),a)for(let o=0;o=0;i-=2){let u=n.nodes[s[i]];if(!u||u.hasRequiredAttrs())break;a=gn.from(u.create(s[i+1],a)),o++,l++}return new Jn(a,o,l)}const ah={},ih={},S0t={touchstart:!0,touchmove:!0};class C0t{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 M0t(e){for(let t in ah){let n=ah[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=s=>{A0t(e,s)&&!Kye(e,s)&&(e.editable||!(s.type in ih))&&n(e,s)},S0t[t]?{passive:!0}:void 0)}ju&&e.dom.addEventListener("input",()=>null),Wme(e)}function E1(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function T0t(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 Wme(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 A0t(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 E0t(e,t){!Kye(e,t)&&ah[t.type]&&(e.editable||!(t.type in ih))&&ah[t.type](e,t)}ih.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!bze(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(ry&&Od&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),BC&&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))||v0t(e,n)?n.preventDefault():E1(e,"key")};ih.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};ih.keypress=(e,t)=>{let n=t;if(bze(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||Jm&&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 bae(e){return{left:e.clientX,top:e.clientY}}function I0t(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 eC(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 P0t(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),s=n.nodeAfter;return s&&s.isAtom&&ua.isSelectable(s)?(eC(e,new ua(n)),!0):!1}function L0t(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?(eC(e,ua.create(e.state.doc,a)),!0):!1}function O0t(e,t,n,s,a){return Zye(e,"handleClickOn",t,n,s)||e.someProp("handleClick",o=>o(e,t,s))||(a?L0t(e,n):P0t(e,n))}function D0t(e,t,n,s){return Zye(e,"handleDoubleClickOn",t,n,s)||e.someProp("handleDoubleClick",a=>a(e,t,s))}function R0t(e,t,n,s){return Zye(e,"handleTripleClickOn",t,n,s)||e.someProp("handleTripleClick",a=>a(e,t,s))||F0t(e,n,s)}function F0t(e,t,n){if(n.button!=0)return!1;let s=e.state.doc;if(t==-1)return s.inlineContent?(eC(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)eC(e,va.create(s,i+1,i+1+l.content.size));else if(ua.isSelectable(l))eC(e,ua.create(s,i));else continue;return!0}}function Yye(e){return mre(e)}const _ze=Jm?"metaKey":"ctrlKey";ah.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&&I0t(n,e.input.lastClick)&&!n[_ze]&&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(bae(n));l&&(o=="singleClick"?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new z0t(e,l,n,!!s)):(o=="doubleClick"?D0t:R0t)(e,l.pos,l.inside,n)?n.preventDefault():E1(e,"pointer"))};class z0t{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[_ze],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)),E1(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(()=>by(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(bae(t))),this.updateAllowDefault(t),this.allowDefault||!n?E1(this.view,"pointer"):O0t(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||ju&&this.mightDrag&&!this.mightDrag.node.isAtom||Od&&!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)?(eC(this.view,Da.near(this.view.state.doc.resolve(n.pos))),t.preventDefault()):E1(this.view,"pointer")}move(t){this.updateAllowDefault(t),E1(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)}}ah.touchstart=e=>{e.input.lastTouch=Date.now(),Yye(e),E1(e,"pointer")};ah.touchmove=e=>{e.input.lastTouch=Date.now(),E1(e,"pointer")};ah.contextmenu=e=>Yye(e);function bze(e,t){return e.composing?!0:ju&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const B0t=ry?5e3:-1;ih.compositionstart=ih.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)||Od&&QFe&&$0t(e)))e.markCursor=e.state.storedMarks||n.marks(),mre(e,!0),e.markCursor=null;else if(mre(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}wze(e,B0t)};function $0t(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"}ih.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++,wze(e,20))};function wze(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>mre(e),t))}function jze(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=q0t());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function U0t(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=Lyt(t.focusNode,t.focusOffset),s=Oyt(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 q0t(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function mre(e,t=!1){if(!(ry&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),jze(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 V0t(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 VE=Fh&&sv<15||BC&&zyt<604;ah.copy=ih.cut=(e,t)=>{let n=t,s=e.state.selection,a=n.type=="cut";if(s.empty)return;let o=VE?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)):V0t(e,i),a&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function H0t(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function W0t(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?HE(e,s.value,null,a,t):HE(e,s.textContent,s.innerHTML,a,t)},50)}function HE(e,t,n,s,a){let o=fze(e,t,n,s,e.state.selection.$from);if(e.someProp("handlePaste",u=>u(e,a,o||Jn.empty)))return!0;if(!o)return!1;let l=H0t(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 kze(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," "):""}ih.paste=(e,t)=>{let n=t;if(e.composing&&!ry)return;let s=VE?null:n.clipboardData,a=e.input.shiftKey&&e.input.lastKeyCode!=45;s&&HE(e,kze(s),s.getData("text/html"),a,n)?n.preventDefault():W0t(e,n)};class Nze{constructor(t,n,s){this.slice=t,this.move=n,this.node=s}}const G0t=Jm?"altKey":"ctrlKey";function Sze(e,t){let n=e.someProp("dragCopies",s=>!s(t));return n??!t[G0t]}ah.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(bae(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||!Od||XFe>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(VE?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",VE||n.dataTransfer.setData("text/plain",m),e.dragging=new Nze(x,Sze(e,n),l)};ah.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};ih.dragover=ih.dragenter=(e,t)=>t.preventDefault();ih.drop=(e,t)=>{try{K0t(e,t,e.dragging)}finally{e.dragging=null}};function K0t(e,t,n){if(!t.dataTransfer)return;let s=e.posAtCoords(bae(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=fze(e,kze(t.dataTransfer),VE?null:t.dataTransfer.getData("text/html"),!1,a);let l=!!(n&&Sze(e,t));if(e.someProp("handleDrop",b=>b(e,t,o||Jn.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let i=o?UFe(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"))}ah.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())&&by(e)},20))};ah.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)};ah.beforeinput=(e,t)=>{if(Od&&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 ih)ah[e]=ih[e];function WE(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 fre{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 Zu(o-s,o-s,this)}valid(){return!0}eq(t){return this==t||t instanceof fre&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&WE(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 Zu(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=Mze(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 d1.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=Y0t(i,e,t,n,a,o,l),x=pre(m,s,0,l);t=x.local;for(let y=0;yn&&l.to{let m=Mze(e,i,u+n);if(m){o=!0;let x=pre(m,i,n+u+1,s);x!=pu&&a.push(u,u+i.nodeSize,x)}});let l=Cze(o?Tze(e):e,-n).sort(Kj);for(let i=0;i0;)t++;e.splice(t,0,n)}function ide(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])),d1.from(t)}const X0t={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Q0t=Fh&&sv<=11;class J0t{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 e1t{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new J0t,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()}),Q0t&&(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,X0t)),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(ASe(this.view)){if(this.suppressingSelectionUpdates)return by(this.view);if(Fh&&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=zC(o))n.add(o);for(let o=t.anchorNode;o;o=zC(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)&&ASe(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||n1t(t,y)!=b)&&v.remove()}}}else if((Od||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),t1t(t)),this.handleDOMChange(o,l,i,u),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(s)||by(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")||UA.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:a1t,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 a1t(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 i1t=/^(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 o1t(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(Od&&ry&&e.input.lastKeyCode===13&&Date.now()-100Q(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=s1t(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&&!i1t.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=USe(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)),Fh&&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((BC&&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&&c1t(x,N.start,N.endA,k,M)&&e.someProp("handleKeyDown",V=>V(e,Jw(8,"Backspace")))){ry&&Od&&e.domObserver.suppressSelectionUpdates();return}Od&&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=USe(e,W.doc,m.sel);G&&!(Od&&e.composing&&G.empty&&(N.start!=N.endB||e.input.lastChromeDeleteby(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=l1t(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 USe(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 l1t(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||ode(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 d1t(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 Aze{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 C0t,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(KSe),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=WSe(this),HSe(this),this.nodeViews=GSe(this),this.docView=kSe(this.state.doc,VSe(this),ide(this),this.dom,this),this.domObserver=new e1t(this,(s,a,o,l)=>o1t(this,s,a,o,l)),this.domObserver.start(),M0t(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&&Wme(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(KSe),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&&(jze(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=GSe(this);h1t(b,this.nodeViews)&&(this.nodeViews=b,o=!0)}(i||n.handleDOMEvents!=this._props.handleDOMEvents)&&Wme(this),this.editable=WSe(this),HSe(this);let u=ide(this),m=VSe(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&&Uyt(this);if(l){this.domObserver.stop();let b=y&&(Fh||Od)&&!this.composing&&!a.selection.empty&&!t.selection.empty&&u1t(a.selection,t.selection);if(y){let N=Od?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=U0t(this)),(o||!this.docView.update(t.doc,m,u,this))&&(this.docView.updateOuterDeco(m),this.docView.destroy(),this.docView=kSe(t.doc,m,u,this.dom,this)),N&&!this.trackWrites&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&h0t(this))?by(this,b):(uze(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&&qyt(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&&ySe(this,n.getBoundingClientRect(),t)}else ySe(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 Nze(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 Zyt(this,t)}coordsAtPos(t,n=1){return nze(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 e0t(this,n||this.state,t)}pasteHTML(t,n){return HE(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return HE(this,t,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(t){return Gye(this,t)}destroy(){this.docView&&(T0t(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ide(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Iyt())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return E0t(this,t)}domSelectionRange(){let t=this.domSelection();return t?ju&&this.root.nodeType===11&&Ryt(this.dom.ownerDocument)==this.dom&&r1t(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Aze.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function VSe(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"),[Zu.node(0,e.state.doc.content.size,t)]}function HSe(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:Zu.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function WSe(e){return!e.someProp("editable",t=>t(e.state)===!1)}function u1t(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 GSe(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 h1t(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 KSe(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:"'"},gre={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},m1t=typeof navigator<"u"&&/Mac/.test(navigator.platform),f1t=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),gre[nu]=String.fromCharCode(nu);for(var lde in yv)gre.hasOwnProperty(lde)||(gre[lde]=yv[lde]);function p1t(e){var t=m1t&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||f1t&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?gre: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 g1t=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),x1t=typeof navigator<"u"&&/Win/.test(navigator.platform);function y1t(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 Eze(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const Ize=(e,t,n)=>{let s=Eze(e,n);if(!s)return!1;let a=t0e(s);if(!a){let l=s.blockRange(),i=l&&L3(l);return i==null?!1:(t&&t(e.tr.lift(l,i).scrollIntoView()),!0)}let o=a.nodeBefore;if($ze(e,a,t,-1))return!0;if(s.parent.content.size==0&&($C(o,"end")||ua.isSelectable(o)))for(let l=s.depth;;l--){let i=xae(e.doc,s.before(l),s.after(l),Jn.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},b1t=(e,t,n)=>{let s=Eze(e,n);if(!s)return!1;let a=t0e(s);return a?Pze(e,a,t):!1},w1t=(e,t,n)=>{let s=Oze(e,n);if(!s)return!1;let a=r0e(s);return a?Pze(e,a,t):!1};function Pze(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=xae(e.doc,o,u,Jn.empty);if(!m||m.from!=o||m instanceof Id&&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 $C(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 Lze=(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 Oze(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset{let s=Oze(e,n);if(!s)return!1;let a=r0e(s);if(!a)return!1;let o=a.nodeAfter;if($ze(e,a,t,1))return!0;if(s.parent.content.size==0&&($C(o,"start")||ua.isSelectable(o))){let l=xae(e.doc,s.before(),s.after(),Jn.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=gae(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},k1t=(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=gae(e.doc,n.to,1),s==null)return!1;return t&&t(e.tr.join(s).scrollIntoView()),!0},N1t=(e,t)=>{let{$from:n,$to:s}=e.selection,a=n.blockRange(s),o=a&&L3(a);return o==null?!1:(t&&t(e.tr.lift(a,o).scrollIntoView()),!0)},Fze=(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(Da.near(u.doc.resolve(i),1)),t(u.scrollIntoView())}return!0},zze=(e,t)=>{let n=e.selection,{$from:s,$to:a}=n;if(n instanceof wm||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(_y(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}let s=n.blockRange(),a=s&&L3(s);return a==null?!1:(t&&t(e.tr.lift(s,a).scrollIntoView()),!0)};function C1t(e){return(t,n)=>{let{$from:s,$to:a}=t.selection;if(t.selection instanceof ua&&t.selection.node.isBlock)return!s.parentOffset||!_y(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 wm)&&x.deleteSelection();let y=x.mapping.map(s.pos),v=_y(x.doc,y,o.length,o);if(v||(o[0]=i?{type:i}:null,v=_y(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 M1t=C1t(),T1t=(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 A1t(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 $ze(e,t,n,s){let a=t.nodeBefore,o=t.nodeAfter,l,i,u=a.type.spec.isolating||o.type.spec.isolating;if(!u&&A1t(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=gn.empty;for(let I=l.length-1;I>=0;I--)N=gn.from(l[I].create(null,N));N=gn.from(a.copy(N));let k=e.tr.step(new $d(t.pos-1,b,t.pos,b,new Jn(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:Da.findFrom(t,1),y=x&&x.$from.blockRange(x.$to),v=y&&L3(y);if(v!=null&&v>=t.depth)return n&&n(e.tr.lift(y,v).scrollIntoView()),!0;if(m&&$C(o,"start",!0)&&$C(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=gn.empty;for(let P=N.length-1;P>=0;P--)I=gn.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 Jn(I,N.length,0),0,!0));n(T.scrollIntoView())}return!0}}return!1}function Uze(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 E1t=Uze(-1),I1t=Uze(1);function P1t(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 ZSe(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 cre(u,u,t.depth),t.endIndex=0;x--)o=gn.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 Jn(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?F1t(t,n,e,o):z1t(t,n,o):!0:!1}}function F1t(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?gn.empty:gn.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 Jn((i?gn.empty:gn.from(a.copy(gn.empty))).append(u?gn.empty:gn.from(a.copy(gn.empty))),i?0:1,u?0:1),i?0:1)),t(s.scrollIntoView()),!0}function B1t(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=gn.from(m?e.create():null),y=new Jn(gn.from(e.create(null,gn.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 wae(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 jae{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:wae({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 $1t=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 As(e,t,n){return e.config[t]===void 0&&e.parent?As(e.parent,t,n):typeof e.config[t]=="function"?e.config[t].bind({...n,parent:e.parent?As(e.parent,t,n):null}):e.config[t]}function kae(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 qze(e){const t=[],{nodeExtensions:n,markExtensions:s}=kae(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=As(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=As(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 Gme(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 Vze(e){return typeof e=="function"}function _i(e,t=void 0,...n){return Vze(e)?t?e.bind(t)(...n):e(...n):e}function U1t(e={}){return Object.keys(e).length===0&&e.constructor===Object}function q1t(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function YSe(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):q1t(n.getAttribute(l.name));return i==null?o:{...o,[l.name]:i}},{});return{...s,...a}}}}function XSe(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>t==="attrs"&&U1t(n)?!1:n!=null))}function V1t(e,t){var n;const s=qze(e),{nodeExtensions:a,markExtensions:o}=kae(e),l=(n=a.find(m=>As(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=As(T,"extendNodeSchema",y);return{...I,...P?P(m):{}}},{}),b=XSe({...v,content:_i(As(m,"content",y)),marks:_i(As(m,"marks",y)),group:_i(As(m,"group",y)),inline:_i(As(m,"inline",y)),atom:_i(As(m,"atom",y)),selectable:_i(As(m,"selectable",y)),draggable:_i(As(m,"draggable",y)),code:_i(As(m,"code",y)),whitespace:_i(As(m,"whitespace",y)),linebreakReplacement:_i(As(m,"linebreakReplacement",y)),defining:_i(As(m,"defining",y)),isolating:_i(As(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=_i(As(m,"parseHTML",y));N&&(b.parseDOM=N.map(I=>YSe(I,x)));const k=As(m,"renderHTML",y);k&&(b.toDOM=I=>k({node:I,HTMLAttributes:Gme(I,x)}));const M=As(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=As(I,"extendMarkSchema",y);return{...M,...T?T(m):{}}},{}),b=XSe({...v,inclusive:_i(As(m,"inclusive",y)),excludes:_i(As(m,"excludes",y)),group:_i(As(m,"group",y)),spanning:_i(As(m,"spanning",y)),code:_i(As(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=_i(As(m,"parseHTML",y));N&&(b.parseDOM=N.map(M=>YSe(M,x)));const k=As(m,"renderHTML",y);return k&&(b.toDOM=M=>k({mark:M,HTMLAttributes:Gme(M,x)})),[m.name,b]}));return new EFe({topNode:l,nodes:i,marks:u})}function dde(e,t){return t.nodes[e]||t.marks[e]||null}function QSe(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 H1t=(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 Nae{constructor(t){this.find=t.find,this.handler=t.handler}}const W1t=(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 mO(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=H1t(m)+o;return l.forEach(v=>{if(x)return;const b=W1t(y,v.find);if(!b)return;const N=u.state.tr,k=wae({state:u.state,transaction:N}),M={from:s-(b[0].length-o.length),to:a},{commands:I,chain:T,can:P}=new jae({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 G1t(e){const{editor:t,rules:n}=e,s=new xd({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(gn.from(x),l.schema);const{from:y}=u,v=y+x.length;mO({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 mO({editor:t,from:o,to:l,text:i,rules:n,plugin:s})},handleDOMEvents:{compositionend:a=>(setTimeout(()=>{const{$cursor:o}=a.state.selection;o&&mO({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?mO({editor:t,from:l.pos,to:l.pos,text:` `,rules:n,plugin:s}):!1}},isInputRules:!0});return s}function K1t(e){return Object.prototype.toString.call(e).slice(8,-1)}function fO(e){return K1t(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function Sae(e,t){const n={...e};return fO(e)&&fO(t)&&Object.keys(t).forEach(s=>{fO(t[s])&&fO(e[s])?n[s]=Sae(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=_i(As(this,"addOptions",{name:this.name}))),this.storage=_i(As(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new tx(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>Sae(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=_i(As(n,"addOptions",{name:n.name})),n.storage=_i(As(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 Z1t(e){return typeof e=="number"}class Y1t{constructor(t){this.find=t.find,this.handler=t.handler}}const X1t=(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 Q1t(e){const{editor:t,state:n,from:s,to:a,rule:o,pasteEvent:l,dropEvent:i}=e,{commands:u,chain:m,can:x}=new jae({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,"");X1t(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 pO=null;const J1t=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 evt(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=wae({state:x,transaction:k});if(!(!Q1t({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 xd({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&&(pO=t)},b=()=>{pO&&(pO=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=pO;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(gn.from(D),b.schema);const{from:U}=I,V=U+D.length,W=J1t(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(!(!Z1t(P)||!F||P===F.b))return u({rule:x,state:b,from:P,to:F,pasteEvt:l})}}))}function tvt(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=V1t(this.extensions,n),this.setupExtensions()}static resolve(t){const n=a4.sort(a4.flatten(t)),s=tvt(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=As(n,"addExtensions",s);return a?[n,...this.flatten(a())]:n}).flat(10)}static sort(t){return t.sort((s,a)=>{const o=As(s,"priority")||100,l=As(a,"priority")||100;return o>l?-1:o{const s={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:dde(n.name,this.schema)},a=As(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:dde(l.name,this.schema)},u=[],m=As(l,"addKeyboardShortcuts",i);let x={};if(l.type==="mark"&&As(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=_1t(x);u.push(y);const v=As(l,"addInputRules",i);QSe(l,t.options.enableInputRules)&&v&&s.push(...v());const b=As(l,"addPasteRules",i);QSe(l,t.options.enablePasteRules)&&b&&a.push(...b());const N=As(l,"addProseMirrorPlugins",i);if(N){const k=N();u.push(...k)}return u}).flat();return[G1t({editor:t,rules:s}),...evt({editor:t,rules:a}),...o]}get attributes(){return qze(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:n}=kae(this.extensions);return Object.fromEntries(n.filter(s=>!!As(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=As(s,"addNodeView",o);if(!l)return[];const i=(u,m,x,y,v)=>{const b=Gme(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:dde(t.name,this.schema)};t.type==="mark"&&(!((n=_i(As(t,"keepOnSplit",s)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(t.name);const a=As(t,"onBeforeCreate",s),o=As(t,"onCreate",s),l=As(t,"onUpdate",s),i=As(t,"onSelectionUpdate",s),u=As(t,"onTransaction",s),m=As(t,"onFocus",s),x=As(t,"onBlur",s),y=As(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=_i(As(this,"addOptions",{name:this.name}))),this.storage=_i(As(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new ou(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>Sae(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=_i(As(n,"addOptions",{name:n.name})),n.storage=_i(As(n,"addStorage",{name:n.name,options:n.options})),n}}function Hze(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 Wze(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,n])=>[t,n.spec.toText]))}const rvt=ou.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new xd({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=Wze(n);return Hze(s,{from:l,to:i},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),nvt=()=>({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),svt=(e=!1)=>({commands:t})=>t.setContent("",e),avt=()=>({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=L3(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},ivt=e=>t=>e(t),ovt=()=>({state:e,dispatch:t})=>zze(e,t),lvt=(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},cvt=()=>({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},dvt=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},uvt=e=>({tr:t,dispatch:n})=>{const{from:s,to:a}=e;return n&&t.delete(s,a),!0},hvt=()=>({state:e,dispatch:t})=>e0e(e,t),mvt=()=>({commands:e})=>e.keyboardShortcut("Enter"),fvt=()=>({state:e,dispatch:t})=>S1t(e,t);function xre(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 Gze(e,t,n={}){return e.find(s=>s.type===t&&xre(Object.fromEntries(Object.keys(n).map(a=>[a,s.attrs[a]])),n))}function JSe(e,t,n={}){return!!Gze(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),!Gze([...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&&JSe([...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},gvt=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()||xvt())&&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&&!Kze(n.state.selection))return l(),!0;const i=Zze(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},vvt=(e,t)=>n=>e.every((s,a)=>t(s,{...n,index:a})),_vt=(e,t)=>({tr:n,commands:s})=>s.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),Yze=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&&Yze(s)}return e};function gO(e){const t=`${e}`,n=new window.DOMParser().parseFromString(t,"text/html").body;return Yze(n)}function GE(e,t,n){if(e instanceof nv||e instanceof gn)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 gn.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),GE("",t,n)}if(a){if(n.errorOnInvalidContent){let l=!1,i="";const u=new EFe({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?UA.fromSchema(u).parseSlice(gO(e),n.parseOptions):UA.fromSchema(u).parse(gO(e),n.parseOptions),n.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${i}`)})}const o=UA.fromSchema(t);return n.slice?o.parseSlice(gO(e),n.parseOptions).content:o.parse(gO(e),n.parseOptions)}return GE("",t,n)}function bvt(e,t,n){const s=e.steps.length-1;if(s{l===0&&(l=x)}),e.setSelection(Da.near(e.doc.resolve(l),n))}const wvt=e=>!("type"in e),jvt=(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{GE(t,o.schema,{parseOptions:m,errorOnInvalidContent:!0})}catch(M){u(M)}try{i=GE(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((wvt(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 gn){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&&bvt(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},kvt=()=>({state:e,dispatch:t})=>j1t(e,t),Nvt=()=>({state:e,dispatch:t})=>k1t(e,t),Svt=()=>({state:e,dispatch:t})=>Ize(e,t),Cvt=()=>({state:e,dispatch:t})=>Dze(e,t),Mvt=()=>({state:e,dispatch:t,tr:n})=>{try{const s=gae(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,tr:n})=>{try{const s=gae(e.doc,e.selection.$from.pos,1);return s==null?!1:(n.join(s,2),t&&t(n),!0)}catch{return!1}},Avt=()=>({state:e,dispatch:t})=>b1t(e,t),Evt=()=>({state:e,dispatch:t})=>w1t(e,t);function Xze(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Ivt(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=Ivt(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 KE(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=>xre(y.node.attrs,n,{strict:!1}));return o?!!m.length:m.reduce((y,v)=>y+v.to-v.from,0)>=u}const Lvt=(e,t={})=>({state:n,dispatch:s})=>{const a=qd(e,n.schema);return KE(n,a,t)?N1t(n,s):!1},Ovt=()=>({state:e,dispatch:t})=>Bze(e,t),Dvt=e=>({state:t,dispatch:n})=>{const s=qd(e,t.schema);return R1t(s)(t,n)},Rvt=()=>({state:e,dispatch:t})=>Fze(e,t);function Cae(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function e4e(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 Fvt=(e,t)=>({tr:n,state:s,dispatch:a})=>{let o=null,l=null;const i=Cae(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,e4e(m.attrs,t)),l&&m.marks.length&&m.marks.forEach(y=>{l===y.type&&n.addMark(x,x+m.nodeSize,l.create(e4e(y.attrs,t)))})})}),!0):!1},zvt=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),Bvt=()=>({tr:e,dispatch:t})=>{if(t){const n=new wm(e.doc);e.setSelection(n)}return!0},$vt=()=>({state:e,dispatch:t})=>Lze(e,t),Uvt=()=>({state:e,dispatch:t})=>Rze(e,t),qvt=()=>({state:e,dispatch:t})=>T1t(e,t),Vvt=()=>({state:e,dispatch:t})=>I1t(e,t),Hvt=()=>({state:e,dispatch:t})=>E1t(e,t);function Kme(e,t,n={},s={}){return GE(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:s.errorOnInvalidContent})}const Wvt=(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=Kme(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 Qze(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 Gvt(e,t){const n=new Uye(e);return t.forEach(s=>{s.steps.forEach(a=>{n.step(a)})}),n}function Kvt(e){for(let t=0;t{n(a)&&s.push({node:a,pos:o})}),s}function Jze(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=>Jze(t.$from,e)}function Yvt(e,t){const n={from:0,to:e.content.size};return Hze(e,n,t)}function Xvt(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 e7e(e,t){const n=Cae(typeof t=="string"?t:t.name,e.schema);return n==="node"?Xvt(e,t):n==="mark"?Qze(e,t):{}}function Qvt(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 Jvt(e){const t=Qvt(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 e_t(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}})})}),Jvt(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 Kee(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 Zme(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=>xre(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=>xre(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 t_t(e,t,n={}){if(!t)return KE(e,null,n)||Zme(e,null,n);const s=Cae(t,e.schema);return s==="node"?KE(e,t,n):s==="mark"?Zme(e,t,n):!1}function t4e(e,t){const{nodeExtensions:n}=kae(t),s=n.find(l=>l.name===e);if(!s)return!1;const a={name:s.name,options:s.options,storage:s.storage},o=_i(As(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 r_t(e){return e instanceof ua}function n_t(e,t,n){var s;const{selection:a}=t;let o=null;if(Kze(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 s_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=Qze(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 n_t(s,n,u)},a_t=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),i_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})=>ZSe(o,{...l,...t})(n)?!0:i.clearNodes()).command(({state:i})=>ZSe(o,{...l,...t})(i,s)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},o_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},l_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},c_t=e=>({state:t,dispatch:n})=>{const s=qd(e,t.schema);return B1t(s)(t,n)};function r4e(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 d_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=Kee(m,i.node().type.name,i.node().attrs);if(o instanceof ua&&o.node.isBlock)return!i.parentOffset||!_y(l,i.pos)?!1:(s&&(e&&r4e(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:Kvt(i.node(-1).contentMatchAt(i.indexAfter(-1)));let b=y&&v?[{type:v,attrs:x}]:void 0,N=_y(t.doc,t.mapping.map(i.pos),1,b);if(!b&&!N&&_y(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&&r4e(n,a.extensionManager.splittableMarks),t.scrollIntoView()}return N},u_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=gn.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=gn.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={...Kee(v,y.type.name,y.attrs),...t},k={...Kee(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(!_y(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},ude=(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},hde=(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},h_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=>t4e(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(t4e(D.node.type.name,y)&&b.validContent(D.node.content)&&i)return u().command(()=>(o.setNodeMarkup(D.pos,b),!0)).command(()=>ude(o,b)).command(()=>hde(o,b)).run()}return!n||!F||!i?u().command(()=>x().wrapInList(b,s)?!0:m.clearNodes()).wrapInList(b,s).command(()=>ude(o,b)).command(()=>hde(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(()=>ude(o,b)).command(()=>hde(o,b)).run()},m_t=(e,t={},n={})=>({state:s,commands:a})=>{const{extendEmptyMarkRange:o=!1}=n,l=Ev(e,s.schema);return Zme(s,l,t)?a.unsetMark(l,{extendEmptyMarkRange:o}):a.setMark(l,t)},f_t=(e,t,n={})=>({state:s,commands:a})=>{const o=qd(e,s.schema),l=qd(t,s.schema),i=KE(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})},p_t=(e,t={})=>({state:n,commands:s})=>{const a=qd(e,n.schema);return KE(n,a,t)?s.lift(a):s.wrapIn(a,t)},g_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},x_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},y_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},v_t=(e,t={})=>({tr:n,state:s,dispatch:a})=>{let o=null,l=null;const i=Cae(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},__t=(e,t={})=>({state:n,dispatch:s})=>{const a=qd(e,n.schema);return P1t(a,t)(n,s)},b_t=(e,t={})=>({state:n,dispatch:s})=>{const a=qd(e,n.schema);return L1t(a,t)(n,s)};var w_t=Object.freeze({__proto__:null,blur:nvt,clearContent:svt,clearNodes:avt,command:ivt,createParagraphNear:ovt,cut:lvt,deleteCurrentNode:cvt,deleteNode:dvt,deleteRange:uvt,deleteSelection:hvt,enter:mvt,exitCode:fvt,extendMarkRange:pvt,first:gvt,focus:yvt,forEach:vvt,insertContent:_vt,insertContentAt:jvt,joinBackward:Svt,joinDown:Nvt,joinForward:Cvt,joinItemBackward:Mvt,joinItemForward:Tvt,joinTextblockBackward:Avt,joinTextblockForward:Evt,joinUp:kvt,keyboardShortcut:Pvt,lift:Lvt,liftEmptyBlock:Ovt,liftListItem:Dvt,newlineInCode:Rvt,resetAttributes:Fvt,scrollIntoView:zvt,selectAll:Bvt,selectNodeBackward:$vt,selectNodeForward:Uvt,selectParentNode:qvt,selectTextblockEnd:Vvt,selectTextblockStart:Hvt,setContent:Wvt,setMark:s_t,setMeta:a_t,setNode:i_t,setNodeSelection:o_t,setTextSelection:l_t,sinkListItem:c_t,splitBlock:d_t,splitListItem:u_t,toggleList:h_t,toggleMark:m_t,toggleNode:f_t,toggleWrap:p_t,undoInputRule:g_t,unsetAllMarks:x_t,unsetMark:y_t,updateAttributes:v_t,wrapIn:__t,wrapInList:b_t});const j_t=ou.create({name:"commands",addCommands(){return{...w_t}}}),k_t=ou.create({name:"drop",addProseMirrorPlugins(){return[new xd({key:new Cu("tiptapDrop"),props:{handleDrop:(e,t,n,s)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:s})}}})]}}),N_t=ou.create({name:"editable",addProseMirrorPlugins(){return[new xd({key:new Cu("editable"),props:{editable:()=>this.editor.options.editable}})]}}),S_t=new Cu("focusEvents"),C_t=ou.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new xd({key:S_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}}}})]}}),M_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:Da.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()||Xze()?o:a},addProseMirrorPlugins(){return[new xd({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=Da.atStart(t.doc).from,m=Da.atEnd(t.doc).to;if(o||!(l===u&&i===m)||!u0e(n.doc))return;const v=n.tr,b=wae({state:n,transaction:v}),{commands:N}=new jae({editor:this.editor,state:b});if(N.clearNodes(),!!v.steps.length)return v}})]}}),T_t=ou.create({name:"paste",addProseMirrorPlugins(){return[new xd({key:new Cu("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),A_t=ou.create({name:"tabindex",addProseMirrorPlugins(){return[new xd({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 E_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 I_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 P_t extends $1t{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=I_t(E_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=Vze(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?[N_t,rvt.configure({blockSeparator:(n=(t=this.options.coreExtensionOptions)===null||t===void 0?void 0:t.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),j_t,C_t,M_t,A_t,k_t,T_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 jae({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var t;let n;try{n=Kme(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=Kme(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const s=Zze(n,this.options.autofocus);this.view=new Aze(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 e7e(this.state,t)}isActive(t,n){const s=typeof t=="string"?t:null,a=typeof t=="string"?n:t;return t_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 Yvt(this.state.doc,{blockSeparator:n,textSerializers:{...Wze(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 UC(e){return new Nae({find:e.find,handler:({state:t,range:n,match:s})=>{const a=_i(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 t7e(e){return new Nae({find:e.find,handler:({state:t,range:n,match:s})=>{const a=_i(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 Yme(e){return new Nae({find:e.find,handler:({state:t,range:n,match:s})=>{const a=t.doc.resolve(n.from),o=_i(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 ZE(e){return new Nae({find:e.find,handler:({state:t,range:n,match:s,chain:a})=>{const o=_i(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 Xme{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=_i(As(this,"addOptions",{name:this.name}))),this.storage=_i(As(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Xme(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>Sae(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new Xme(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=_i(As(n,"addOptions",{name:n.name})),n.storage=_i(As(n,"addStorage",{name:n.name,options:n.options})),n}};function gk(e){return new Y1t({find:e.find,handler:({state:t,range:n,match:s,pasteEvent:a})=>{const o=_i(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 L_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 O_t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r7e={exports:{}},mde={};/** * @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 n4e;function D_t(){if(n4e)return mde;n4e=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 mde.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:x,mde}r7e.exports=D_t();var h0e=r7e.exports;const R_t=(...e)=>t=>{e.forEach(n=>{typeof n=="function"?n(t):n&&(n.current=t)})},F_t=({contentComponent:e})=>{const t=h0e.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return dt.createElement(dt.Fragment,null,Object.values(t))};function z_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]:Qge.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 B_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=z_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:R_t(n,this.editorContentRef),...s}),(t==null?void 0:t.contentComponent)&&dt.createElement(F_t,{contentComponent:t.contentComponent}))}}const $_t=A.forwardRef((e,t)=>{const n=dt.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return dt.createElement(B_t,{key:n,innerRef:t,...e})}),n7e=dt.memo($_t);var U_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},q_t=O_t(U_t),s7e={exports:{}},fde={};/** * @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 s4e;function V_t(){if(s4e)return fde;s4e=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 fde.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},fde}s7e.exports=V_t();var H_t=s7e.exports;const W_t=typeof window<"u"?A.useLayoutEffect:A.useEffect;class G_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 K_t(e){var t;const[n]=A.useState(()=>new G_t(e.editor)),s=H_t.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,(t=e.equalityFn)!==null&&t!==void 0?t:q_t);return W_t(()=>n.watch(e.editor),[e.editor,n]),A.useDebugValue(s),s}const Z_t=!1,Qme=typeof window>"u",Y_t=Qme||!!(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?Qme||Y_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 P_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 a7e(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)),K_t({editor:a,selector:({transactionNumber:o})=>e.shouldRerenderOnTransaction===!1?null:e.immediatelyRender&&o===0?0:o+1}),a}const X_t=A.createContext({editor:null});X_t.Consumer;const Q_t=A.createContext({onDragStart:void 0}),J_t=()=>A.useContext(Q_t);dt.forwardRef((e,t)=>{const{onDragStart:n}=J_t(),s=e.as||"div";return dt.createElement(s,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});const ebt=/^\s*>\s$/,tbt=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[ZE({find:ebt,type:this.type})]}}),rbt=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,nbt=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,sbt=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,abt=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,ibt=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[UC({find:rbt,type:this.type}),UC({find:sbt,type:this.type})]},addPasteRules(){return[gk({find:nbt,type:this.type}),gk({find:abt,type:this.type})]}}),obt="listItem",a4e="textStyle",i4e=/^\s*([-+*])\s$/,lbt=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(obt,this.editor.getAttributes(a4e)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=ZE({find:i4e,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=ZE({find:i4e,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(a4e),editor:this.editor})),[e]}}),cbt=/(^|[^`])`([^`]+)`(?!`)/,dbt=/(^|[^`])`([^`]+)`(?!`)/g,ubt=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[UC({find:cbt,type:this.type})]},addPasteRules(){return[gk({find:dbt,type:this.type})]}}),hbt=/^```([a-z]+)?[\s\n]$/,mbt=/^~~~([a-z]+)?[\s\n]$/,fbt=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(Da.near(s.resolve(i))),!0)):e.commands.exitCode()}}},addInputRules(){return[Yme({find:hbt,type:this.type,getAttributes:e=>({language:e[1]})}),Yme({find:mbt,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new xd({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}}})]}}),pbt=Mu.create({name:"doc",topNode:!0,content:"block+"});function gbt(e={}){return new xd({view(t){return new xbt(t,e)}})}class xbt{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=UFe(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 ybt=ou.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[gbt(this.options)]}});class tc extends Da{constructor(t){super(t,t)}map(t,n){let s=t.resolve(n.map(this.head));return tc.valid(s)?new tc(s):Da.near(s)}content(){return Jn.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||!vbt(t)||!_bt(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;Da.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):Da.near(n)}}function i7e(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function vbt(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||i7e(a.type))return!0;if(a.inlineContent)return!1}}return!0}function _bt(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||i7e(a.type))return!0;if(a.inlineContent)return!1}}return!0}function bbt(){return new xd({props:{decorations:Nbt,createSelectionBetween(e,t,n){return t.pos==n.pos&&tc.valid(n)?new tc(n):null},handleClick:jbt,handleKeyDown:wbt,handleDOMEvents:{beforeinput:kbt}}})}const wbt=Jye({ArrowLeft:xO("horiz",-1),ArrowRight:xO("horiz",1),ArrowUp:xO("vert",-1),ArrowDown:xO("vert",1)});function xO(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 jbt(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 kbt(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=gn.empty;for(let l=s.length-1;l>=0;l--)a=gn.from(s[l].createAndFill(null,a));let o=e.state.tr.replace(n.pos,n.pos,new Jn(a,0,0));return o.setSelection(va.near(o.doc.resolve(n.pos+1))),e.dispatch(o),!1}function Nbt(e){if(!(e.selection instanceof tc))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",ec.create(e.doc,[Zu.widget(e.selection.head,t,{key:"gapcursor"})])}const Sbt=ou.create({name:"gapCursor",addProseMirrorPlugins(){return[bbt()]},extendNodeSchema(e){var t;const n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:(t=_i(As(e,"allowGapCursor",n)))!==null&&t!==void 0?t:null}}}),Cbt=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()}}}),Mbt=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=>Yme({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}});var yre=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 o7e(t):Ud.empty};var o7e=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<=yre)return new t(this.values.concat(a.flatten()))},t.prototype.leafPrepend=function(a){if(this.length+a.length<=yre)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 o7e([]);var Tbt=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 Abt=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;xIbt&&(i=Ebt(i,m),l-=m),new vp(i.append(o),l)}remapping(t,n){let s=new UE;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;vAbt&&(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 Ebt(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 t1{constructor(t,n,s,a,o){this.done=t,this.undone=n,this.prevRanges=s,this.prevTime=a,this.prevComposition=o}}const Ibt=20;function Pbt(e,t,n,s){let a=n.getMeta(Zj),o;if(a)return a.historyState;n.getMeta(Dbt)&&(e=new t1(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 t1(e.done.addTransform(n,void 0,s,Zee(t)),e.undone,o4e(n.mapping.maps),e.prevTime,e.prevComposition):new t1(e.done,e.undone.addTransform(n,void 0,s,Zee(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||!Lbt(n,e.prevRanges)),m=l?pde(e.prevRanges,n.mapping):o4e(n.mapping.maps);return new t1(e.done.addTransform(n,u?t.selection.getBookmark():void 0,s,Zee(t)),vp.empty,m,n.time,i??e.prevComposition)}else return(o=n.getMeta("rebased"))?new t1(e.done.rebased(n,o),e.undone.rebased(n,o),pde(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new t1(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),pde(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function Lbt(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 o4e(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 pde(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=Obt(a,n,e);o&&s(t?o.scrollIntoView():o)}return!0}}const c7e=l7e(!1,!0),d7e=l7e(!0,!0),Fbt=ou.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>c7e(e,t),redo:()=>({state:e,dispatch:t})=>d7e(e,t)}},addProseMirrorPlugins(){return[Rbt(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()}}}),zbt=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(!L_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}):r_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[t7e({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Bbt=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,$bt=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Ubt=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,qbt=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Vbt=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[UC({find:Bbt,type:this.type}),UC({find:Ubt,type:this.type})]},addPasteRules(){return[gk({find:$bt,type:this.type}),gk({find:qbt,type:this.type})]}}),Hbt=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)}}}),Wbt="listItem",c4e="textStyle",d4e=/^(\d+)\.\s$/,Gbt=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(Wbt,this.editor.getAttributes(c4e)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=ZE({find:d4e,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=ZE({find:d4e,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(c4e)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[e]}}),Kbt=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()}}}),Zbt=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ybt=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Xbt=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[UC({find:Zbt,type:this.type})]},addPasteRules(){return[gk({find:Ybt,type:this.type})]}}),Qbt=Mu.create({name:"text",group:"inline"}),u7e=ou.create({name:"starterKit",addExtensions(){const e=[];return this.options.bold!==!1&&e.push(ibt.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(tbt.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(lbt.configure(this.options.bulletList)),this.options.code!==!1&&e.push(ubt.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(fbt.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(pbt.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(ybt.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(Sbt.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(Cbt.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(Mbt.configure(this.options.heading)),this.options.history!==!1&&e.push(Fbt.configure(this.options.history)),this.options.horizontalRule!==!1&&e.push(zbt.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(Vbt.configure(this.options.italic)),this.options.listItem!==!1&&e.push(Hbt.configure(this.options.listItem)),this.options.orderedList!==!1&&e.push(Gbt.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(Kbt.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(Xbt.configure(this.options.strike)),this.options.text!==!1&&e.push(Qbt.configure(this.options.text)),e}}),Jbt="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",e2t="ελ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",Jme="numeric",efe="ascii",tfe="alpha",WA="asciinumeric",BT="alphanumeric",rfe="domain",h7e="emoji",t2t="scheme",r2t="slashscheme",xde="whitespace";function n2t(e,t){return e in t||(t[e]=[]),t[e]}function uj(e,t,n){t[Jme]&&(t[WA]=!0,t[BT]=!0),t[efe]&&(t[WA]=!0,t[tfe]=!0),t[WA]&&(t[BT]=!0),t[tfe]&&(t[BT]=!0),t[BT]&&(t[rfe]=!0),t[h7e]&&(t[rfe]=!0);for(const s in t){const a=n2t(s,n);a.indexOf(e)<0&&a.push(e)}}function s2t(e,t){const n={};for(const s in t)t[s].indexOf(e)>=0&&(n[s]=!0);return n}function Mh(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}Mh.groups={};Mh.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),u4e=(e,t,n,s,a)=>e.ts(t,n,s,a),En=(e,t,n,s,a)=>e.tt(t,n,s,a),$x="WORD",nfe="UWORD",m7e="ASCIINUMERICAL",f7e="ALPHANUMERICAL",YE="LOCALHOST",sfe="TLD",afe="UTLD",Yee="SCHEME",HS="SLASH_SCHEME",p0e="NUM",ife="WS",g0e="NL",GA="OPENBRACE",KA="CLOSEBRACE",vre="OPENBRACKET",_re="CLOSEBRACKET",bre="OPENPAREN",wre="CLOSEPAREN",jre="OPENANGLEBRACKET",kre="CLOSEANGLEBRACKET",Nre="FULLWIDTHLEFTPAREN",Sre="FULLWIDTHRIGHTPAREN",Cre="LEFTCORNERBRACKET",Mre="RIGHTCORNERBRACKET",Tre="LEFTWHITECORNERBRACKET",Are="RIGHTWHITECORNERBRACKET",Ere="FULLWIDTHLESSTHAN",Ire="FULLWIDTHGREATERTHAN",Pre="AMPERSAND",Lre="APOSTROPHE",Ore="ASTERISK",r1="AT",Dre="BACKSLASH",Rre="BACKTICK",Fre="CARET",u1="COLON",x0e="COMMA",zre="DOLLAR",yg="DOT",Bre="EQUALS",y0e="EXCLAMATION",Zm="HYPHEN",ZA="PERCENT",$re="PIPE",Ure="PLUS",qre="POUND",YA="QUERY",v0e="QUOTE",p7e="FULLWIDTHMIDDLEDOT",_0e="SEMI",vg="SLASH",XA="TILDE",Vre="UNDERSCORE",g7e="EMOJI",Hre="SYM";var x7e=Object.freeze({__proto__:null,ALPHANUMERICAL:f7e,AMPERSAND:Pre,APOSTROPHE:Lre,ASCIINUMERICAL:m7e,ASTERISK:Ore,AT:r1,BACKSLASH:Dre,BACKTICK:Rre,CARET:Fre,CLOSEANGLEBRACKET:kre,CLOSEBRACE:KA,CLOSEBRACKET:_re,CLOSEPAREN:wre,COLON:u1,COMMA:x0e,DOLLAR:zre,DOT:yg,EMOJI:g7e,EQUALS:Bre,EXCLAMATION:y0e,FULLWIDTHGREATERTHAN:Ire,FULLWIDTHLEFTPAREN:Nre,FULLWIDTHLESSTHAN:Ere,FULLWIDTHMIDDLEDOT:p7e,FULLWIDTHRIGHTPAREN:Sre,HYPHEN:Zm,LEFTCORNERBRACKET:Cre,LEFTWHITECORNERBRACKET:Tre,LOCALHOST:YE,NL:g0e,NUM:p0e,OPENANGLEBRACKET:jre,OPENBRACE:GA,OPENBRACKET:vre,OPENPAREN:bre,PERCENT:ZA,PIPE:$re,PLUS:Ure,POUND:qre,QUERY:YA,QUOTE:v0e,RIGHTCORNERBRACKET:Mre,RIGHTWHITECORNERBRACKET:Are,SCHEME:Yee,SEMI:_0e,SLASH:vg,SLASH_SCHEME:HS,SYM:Hre,TILDE:XA,TLD:sfe,UNDERSCORE:Vre,UTLD:afe,UWORD:nfe,WORD:$x,WS:ife});const Dx=/[a-z]/,fT=new RegExp("\\p{L}","u"),yde=new RegExp("\\p{Emoji}","u"),Rx=/\d/,vde=/\s/,h4e="\r",_de=` `,a2t="️",i2t="‍",bde="";let yO=null,vO=null;function o2t(e=[]){const t={};Mh.groups=t;const n=new Mh;yO==null&&(yO=m4e(Jbt)),vO==null&&(vO=m4e(e2t)),En(n,"'",Lre),En(n,"{",GA),En(n,"}",KA),En(n,"[",vre),En(n,"]",_re),En(n,"(",bre),En(n,")",wre),En(n,"<",jre),En(n,">",kre),En(n,"(",Nre),En(n,")",Sre),En(n,"「",Cre),En(n,"」",Mre),En(n,"『",Tre),En(n,"』",Are),En(n,"<",Ere),En(n,">",Ire),En(n,"&",Pre),En(n,"*",Ore),En(n,"@",r1),En(n,"`",Rre),En(n,"^",Fre),En(n,":",u1),En(n,",",x0e),En(n,"$",zre),En(n,".",yg),En(n,"=",Bre),En(n,"!",y0e),En(n,"-",Zm),En(n,"%",ZA),En(n,"|",$re),En(n,"+",Ure),En(n,"#",qre),En(n,"?",YA),En(n,'"',v0e),En(n,"/",vg),En(n,";",_0e),En(n,"~",XA),En(n,"_",Vre),En(n,"\\",Dre),En(n,"・",p7e);const s=Kl(n,Rx,p0e,{[Jme]:!0});Kl(s,Rx,s);const a=Kl(s,Dx,m7e,{[WA]:!0}),o=Kl(s,fT,f7e,{[BT]:!0}),l=Kl(n,Dx,$x,{[efe]:!0});Kl(l,Rx,a),Kl(l,Dx,l),Kl(a,Rx,a),Kl(a,Dx,a);const i=Kl(n,fT,nfe,{[tfe]:!0});Kl(i,Dx),Kl(i,Rx,o),Kl(i,fT,i),Kl(o,Rx,o),Kl(o,Dx),Kl(o,fT,o);const u=En(n,_de,g0e,{[xde]:!0}),m=En(n,h4e,ife,{[xde]:!0}),x=Kl(n,vde,ife,{[xde]:!0});En(n,bde,x),En(m,_de,u),En(m,bde,x),Kl(m,vde,x),En(x,h4e),En(x,_de),Kl(x,vde,x),En(x,bde,x);const y=Kl(n,yde,g7e,{[h7e]:!0});En(y,"#"),Kl(y,yde,y),En(y,a2t,y);const v=En(y,i2t);En(v,"#"),Kl(v,yde,y);const b=[[Dx,l],[Rx,a]],N=[[Dx,null],[fT,i],[Rx,o]];for(let k=0;kk[0]>M[0]?1:-1);for(let k=0;k=0?T[rfe]=!0:Dx.test(M)?Rx.test(M)?T[WA]=!0:T[efe]=!0:T[Jme]=!0,u4e(n,M,M,T)}return u4e(n,"localhost",YE,{ascii:!0}),n.jd=new Mh(Hre),{start:n,tokens:Object.assign({groups:t},x7e)}}function y7e(e,t){const n=l2t(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 l2t(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 $0(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 XE={defaultProtocol:"http",events:null,format:f4e,formatHref:f4e,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({},XE);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=XE.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 Mae(e,t){class n extends v7e{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 p4e=Mae("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),g4e=Mae("text"),c2t=Mae("nl"),_O=Mae("url",{isLink:!0,toHref(e=XE.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==YE&&e[1].t===u1}}),Hm=e=>new Mh(e);function d2t({groups:e}){const t=e.domain.concat([Pre,Ore,r1,Dre,Rre,Fre,zre,Bre,Zm,p0e,ZA,$re,Ure,qre,vg,Hre,XA,Vre]),n=[Lre,u1,x0e,yg,y0e,ZA,YA,v0e,_0e,jre,kre,GA,KA,_re,vre,bre,wre,Nre,Sre,Cre,Mre,Tre,Are,Ere,Ire],s=[Pre,Lre,Ore,Dre,Rre,Fre,zre,Bre,Zm,GA,KA,ZA,$re,Ure,qre,YA,vg,Hre,XA,Vre],a=Hm(),o=En(a,XA);vi(o,s,o),vi(o,e.domain,o);const l=Hm(),i=Hm(),u=Hm();vi(a,e.domain,l),vi(a,e.scheme,i),vi(a,e.slashscheme,u),vi(l,s,o),vi(l,e.domain,l);const m=En(l,r1);En(o,r1,m),En(i,r1,m),En(u,r1,m);const x=En(o,yg);vi(x,s,o),vi(x,e.domain,o);const y=Hm();vi(m,e.domain,y),vi(y,e.domain,y);const v=En(y,yg);vi(v,e.domain,y);const b=Hm(p4e);vi(v,e.tld,b),vi(v,e.utld,b),En(m,YE,b);const N=En(y,Zm);En(N,Zm,N),vi(N,e.domain,y),vi(b,e.domain,y),En(b,yg,v),En(b,Zm,N);const k=En(b,u1);vi(k,e.numeric,p4e);const M=En(l,Zm),I=En(l,yg);En(M,Zm,M),vi(M,e.domain,l),vi(I,s,o),vi(I,e.domain,l);const T=Hm(_O);vi(I,e.tld,T),vi(I,e.utld,T),vi(T,e.domain,l),vi(T,s,o),En(T,yg,I),En(T,Zm,M),En(T,r1,m);const P=En(T,u1),F=Hm(_O);vi(P,e.numeric,F);const D=Hm(_O),U=Hm();vi(D,t,D),vi(D,n,U),vi(U,t,D),vi(U,n,U),En(T,vg,D),En(F,vg,D);const V=En(i,u1),W=En(u,u1),G=En(W,vg),Q=En(G,vg);vi(i,e.domain,l),En(i,yg,I),En(i,Zm,M),vi(u,e.domain,l),En(u,yg,I),En(u,Zm,M),vi(V,e.domain,D),En(V,vg,D),En(V,YA,D),vi(Q,e.domain,D),vi(Q,t,D),En(Q,vg,D);const ae=[[GA,KA],[vre,_re],[bre,wre],[jre,kre],[Nre,Sre],[Cre,Mre],[Tre,Are],[Ere,Ire]];for(let oe=0;oe=0&&v++,a++,x++;if(v<0)a-=x,a0&&(o.push(wde(g4e,t,l)),l=[]),a-=v,x-=v;const b=y.t,N=n.slice(a-x,a);o.push(wde(b,t,N))}}return l.length>0&&o.push(wde(g4e,t,l)),o}function wde(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 h2t=typeof console<"u"&&console&&console.warn||(()=>{}),m2t="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 f2t(){return Mh.groups={},gl.scanner=null,gl.parser=null,gl.tokenQueue=[],gl.pluginQueue=[],gl.customSchemes=[],gl.initialized=!1,gl}function x4e(e,t=!1){if(gl.initialized&&h2t(`linkifyjs: already initialized - will not register custom scheme "${e}" ${m2t}`),!/^[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 p2t(){gl.scanner=o2t(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=Gvt(n.doc,[...t]);if(e_t(i).forEach(({newRange:m})=>{const x=Zvt(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(!x2t.test(b))return;y=x[0],v=s.doc.textBetween(y.pos,m.to,void 0," ")}if(y&&v){const b=v.split(g2t).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(!v2t(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 b2t(e){return new xd({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=e7e(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 w2t(e){return new xd({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=_7e(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(y2t,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const b7e=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"){x4e(e);return}x4e(e.scheme,e.optionalSlashes)})},onDestroy(){f2t()},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=_7e(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(_2t({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(b2t({type:this.type})),this.options.linkOnPaste&&e.push(w2t({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),e}}),w7e=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")}}}),j2t=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}`)})},j7e=tx.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:e=>e.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&j2t(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}}}}),k2t=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,N2t=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[t7e({find:k2t,type:this.type,getAttributes:e=>{const[,,t,n,s]=e;return{src:n,alt:t,title:s}}})]}});let ofe,lfe;if(typeof WeakMap<"u"){let e=new WeakMap;ofe=t=>e.get(t),lfe=(t,n)=>(e.set(t,n),n)}else{const e=[];let n=0;ofe=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 M2t(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 A2t(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 Tae(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=O3(t.$head)||E2t(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function E2t(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 cfe(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function I2t(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 k7e(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 N7e(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 GFe(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(cfe(s)&&cfe(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(Zu.node(s,s+n.nodeSize,{class:"selectedCell"}))}),ec.create(e.doc,t)}function D2t({$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 R2t({$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 F2t(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&&D2t(s)?o=va.create(a,s.from):s instanceof va&&R2t(s)&&(o=va.create(a,s.$from.start(),s.$from.end()));return o&&(t||(t=e.tr)).setSelection(o),t}const z2t=new Cu("fix-tables");function C7e(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=B2t(e,a,o,n))};return t?t.doc!=e.doc&&C7e(t.doc,e.doc,0,s):e.doc.descendants(s),n}function B2t(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;P2t(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;H2t(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=y4e(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 _4e(e,t){const n=ku(e.schema);return X2t(({node:s})=>n[s.type.spec.tableRole])(e,t)}function X2t(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=A2t(s.$from),!a)return!1;o=(l=O3(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 J2t(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}}QE("row",{useDeprecatedLogic:!0});QE("column",{useDeprecatedLogic:!0});const ewt=QE("cell",{useDeprecatedLogic:!0});function twt(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 bO(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 Jn(a,0,0))}),s.docChanged&&t(s)}return!0}function nwt(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(gn.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(gn.from(u))}n=o,t=a}return{width:e,height:t,rows:n}}function iwt(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,gn.from(y)),b=[];for(let N=t.height;N{if(!a)return!1;const o=n.selection;if(o instanceof ll)return Xee(n,s,Da.near(o.$headCell,t));if(e!="horiz"&&!o.empty)return!1;const l=E7e(a,e,t);if(l==null)return!1;if(e=="horiz")return Xee(n,s,Da.near(n.doc.resolve(o.head+t),t));{const i=n.doc.resolve(l),u=k7e(i,e,t);let m;return u?m=Da.near(u,1):t<0?m=Da.near(n.doc.resolve(i.before(-1)),-1):m=Da.near(n.doc.resolve(i.after(-1)),1),Xee(n,s,m)}}}function jO(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=E7e(a,e,t);if(u==null)return!1;l=new ll(n.doc.resolve(u))}const i=k7e(l.$headCell,e,t);return i?Xee(n,s,new ll(l.$anchorCell,i)):!1}}function lwt(e,t){const n=e.state.doc,s=O3(n.resolve(t));return s?(e.dispatch(e.state.tr.setSelection(new ll(s))),!0):!1}function cwt(e,t,n){if(!Vp(e.state))return!1;let s=nwt(n);const a=e.state.selection;if(a instanceof ll){s||(s={width:1,height:1,rows:[gn.from(dfe(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=awt(s,i.right-i.left,i.bottom-i.top),N4e(e.state,e.dispatch,l,i,s),!0}else if(s){const o=Tae(e.state),l=o.start(-1);return N4e(e.state,e.dispatch,l,nc.get(o.node(-1)).findCell(o.pos-l),s),!0}else return!1}function dwt(e,t){var n;if(t.ctrlKey||t.metaKey)return;const s=S4e(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=O3(e.state.selection.$anchor))!=null&&((n=jde(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=jde(e,m);const y=h1.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(h1,u.pos),e.dispatch(b)}}function l(){e.root.removeEventListener("mouseup",l),e.root.removeEventListener("dragstart",l),e.root.removeEventListener("mousemove",i),h1.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(h1,-1))}function i(u){const m=u,x=h1.getState(e.state);let y;if(x!=null)y=e.state.doc.resolve(x);else if(S4e(e,m.target)!=s&&(y=jde(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 E7e(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 S4e(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function jde(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 O3(e.state.doc.resolve(s))}var uwt=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")),ufe(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,ufe(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function ufe(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 mwt(-1,!1)},apply(l,i){return i.apply(l)}},props:{attributes:l=>{const i=dm.getState(l);return i&&i.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,i)=>{fwt(l,i,e,a)},mouseleave:l=>{pwt(l)},mousedown:(l,i)=>{gwt(l,i,t,n)}},decorations:l=>{const i=dm.getState(l);if(i&&i.activeHandle>-1)return bwt(l,i.activeHandle)},nodeViews:{}}});return o}var mwt=class Qee{constructor(t,n){this.activeHandle=t,this.dragging=n}apply(t){const n=this,s=t.getMeta(dm);if(s&&s.setHandle!=null)return new Qee(s.setHandle,!1);if(s&&s.setDragging!==void 0)return new Qee(n.activeHandle,s.setDragging);if(n.activeHandle>-1&&t.docChanged){let a=t.mapping.map(n.activeHandle,-1);return cfe(t.doc.resolve(a))||(a=-1),new Qee(a,n.dragging)}return n}};function fwt(e,t,n,s){if(!e.editable)return;const a=dm.getState(e.state);if(a&&!a.dragging){const o=ywt(t.target);let l=-1;if(o){const{left:i,right:u}=o.getBoundingClientRect();t.clientX-i<=n?l=C4e(e,t,"left",n):u-t.clientX<=n&&(l=C4e(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}I7e(e,l)}}}function pwt(e){if(!e.editable)return;const t=dm.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&I7e(e,-1)}function gwt(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=dm.getState(e.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const i=e.state.doc.nodeAt(l.activeHandle),u=xwt(e,l.activeHandle,i.attrs);e.dispatch(e.state.tr.setMeta(dm,{setDragging:{startX:t.clientX,startWidth:u}}));function m(y){o.removeEventListener("mouseup",m),o.removeEventListener("mousemove",x);const v=dm.getState(e.state);v!=null&&v.dragging&&(vwt(e,v.activeHandle,M4e(v.dragging,y,n)),e.dispatch(e.state.tr.setMeta(dm,{setDragging:null})))}function x(y){if(!y.which)return m(y);const v=dm.getState(e.state);if(v&&v.dragging){const b=M4e(v.dragging,y,n);T4e(e,v.activeHandle,b,s)}}return T4e(e,l.activeHandle,u,s),o.addEventListener("mouseup",m),o.addEventListener("mousemove",x),t.preventDefault(),!0}function xwt(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 Swt(e,t,n,s,a){const o=Nwt(e),l=[],i=[];for(let m=0;m{const{selection:t}=e.state;if(!Cwt(t))return!1;let n=0;const s=Jze(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},Mwt=Mu.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:jwt,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}=kwt(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=Swt(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})=>$2t(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>U2t(e,t),deleteColumn:()=>({state:e,dispatch:t})=>V2t(e,t),addRowBefore:()=>({state:e,dispatch:t})=>W2t(e,t),addRowAfter:()=>({state:e,dispatch:t})=>G2t(e,t),deleteRow:()=>({state:e,dispatch:t})=>Z2t(e,t),deleteTable:()=>({state:e,dispatch:t})=>rwt(e,t),mergeCells:()=>({state:e,dispatch:t})=>v4e(e,t),splitCell:()=>({state:e,dispatch:t})=>_4e(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>QE("column")(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>QE("row")(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>ewt(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>v4e(e,t)?!0:_4e(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:s})=>Q2t(e,t)(n,s),goToNextCell:()=>({state:e,dispatch:t})=>w4e(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>w4e(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&M7e(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:kO,"Mod-Backspace":kO,Delete:kO,"Mod-Delete":kO}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[hwt({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],wwt({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(e){const t={name:e.name,options:e.options,storage:e.storage};return{tableRole:_i(As(e,"tableRole",t))}}}),Twt=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]}}),Awt=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]}}),Ewt=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=a7e({extensions:[u7e,b7e.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),w7e.configure({types:["heading","paragraph"]}),j7e,N2t.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}),Mwt.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}),Twt.extend({addAttributes(){var k;return{...(k=this.parent)==null?void 0:k.call(this),style:{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},valign:{default:null}}}}),Ewt.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(X,{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(lA,{className:"h-4 w-4"})}),r.jsx(X,{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(cA,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(X,{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(X,{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(X,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleBulletList().run(),className:y.isActive("bulletList")?"bg-muted":"",title:"Bullet List",children:r.jsx(ff,{className:"h-4 w-4"})}),r.jsx(X,{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(X,{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(X,{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(X,{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(X,{type:"button",variant:"ghost",size:"sm",onClick:v,className:y.isActive("link")?"bg-muted":"",title:"Add Link",children:r.jsx(Ro,{className:"h-4 w-4"})}),y.isActive("link")&&r.jsx(X,{type:"button",variant:"ghost",size:"sm",onClick:N,title:"Remove Link",children:r.jsx(Ro,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(X,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().undo().run(),disabled:!y.can().undo(),title:"Undo",children:r.jsx(F4,{className:"h-4 w-4"})}),r.jsx(X,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().redo().run(),disabled:!y.can().redo(),title:"Redo",children:r.jsx(O4,{className:"h-4 w-4"})})]}),r.jsx(n7e,{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(Or,{open:o,onOpenChange:l,children:r.jsxs(Lr,{className:"sm:max-w-md",children:[r.jsx(zr,{children:r.jsx(Fr,{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(Is,{id:"link-new-tab",checked:m,onCheckedChange:x}),r.jsx(ze,{htmlFor:"link-new-tab",children:"Open in new tab"})]})]}),r.jsxs(Hs,{children:[r.jsx(X,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsx(X,{type:"button",onClick:b,children:i?"Apply Link":"Remove Link"})]})]})})]}):null}var Iwt=Object.defineProperty,Pwt=(e,t,n)=>t in e?Iwt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nl=(e,t,n)=>Pwt(e,typeof t!="symbol"?t+"":t,n);const Wre={x:0,y:0,width:0,height:0,unit:"px"},IS=(e,t,n)=>Math.min(Math.max(e,t),n),Lwt=(...e)=>e.filter(t=>t&&typeof t=="string").join(" "),I4e=(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 Owt(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==="%"?n1(a,n,s):a}function Dwt(e,t,n){const s=_g(e,t,n);return s.x=(t-s.width)/2,s.y=(n-s.height)/2,e.unit==="%"?n1(s,t,n):s}function n1(e,t,n){return e.unit==="%"?{...Wre,...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"?{...Wre,...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}:{...Wre,...e,unit:"px"}}function P4e(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 Rwt(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 Fwt=0;const H0=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-${Fwt++}`),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),n1(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(),I4e(n,u)||a(_g(u,l.width,l.height),n1(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=n1(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=Rwt(N,t.key,b,n),M=P4e(k,s,n,v.width,v.height,l,i,u,m);if(!I4e(a,M)){const I=n1(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),n1(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),n1(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=P4e(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={...Wre,...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=Lwt("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(H0,"xOrds",["e","w"]),Nl(H0,"yOrds",["n","s"]),Nl(H0,"xyOrds",["nw","ne","se","sw"]),Nl(H0,"nudgeStep",1),Nl(H0,"nudgeStepMedium",10),Nl(H0,"nudgeStepLarge",100),Nl(H0,"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 zwt=H0;var P7e=["PageUp","PageDown"],L7e=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],O7e={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},D3="Slider",[mfe,Bwt,$wt]=GI(D3),[D7e]=cc(D3,[$wt]),[Uwt,Aae]=D7e(D3),R7e=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"?qwt:Vwt,[F=[],D]=sh({prop:x,defaultProp:m,onChange:ae=>{var de;(de=[...M.current][I.current])==null||de.focus(),y(ae)}}),U=A.useRef(F);function V(ae){const oe=Zwt(F,ae);Q(ae,oe)}function W(ae){Q(ae,I.current)}function G(){const ae=U.current[I.current];F[I.current]!==ae&&v(F)}function Q(ae,oe,{commit:de}={commit:!1}){const se=Jwt(o),pe=ejt(Math.round((ae-s)/o)*o+s,se),ne=DE(pe,[s,a]);D((me=[])=>{const he=Gwt(me,ne,oe);if(Qwt(he,u*o)){I.current=he.indexOf(ne);const xe=String(he)!==String(me);return xe&&de&&v(he),xe?he:me}else return me})}return r.jsx(Uwt,{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(mfe.Provider,{scope:e.__scopeSlider,children:r.jsx(mfe.Slot,{scope:e.__scopeSlider,children:r.jsx(P,{"aria-disabled":i,"data-disabled":i?"":void 0,...k,ref:t,onPointerDown:xn(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&&Q(s,0,{commit:!0}),onEndKeyDown:()=>!i&&Q(a,F.length-1,{commit:!0}),onStepKeyDown:({event:ae,direction:oe})=>{if(!i){const pe=P7e.includes(ae.key)||ae.shiftKey&&L7e.includes(ae.key)?10:1,ne=I.current,me=F[ne],he=o*pe*oe;Q(me+he,ne,{commit:!0})}}})})})})});R7e.displayName=D3;var[F7e,z7e]=D7e(D3,{startEdge:"left",endEdge:"right",size:"width",direction:1}),qwt=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(F7e,{scope:e.__scopeSlider,startEdge:I?"left":"right",endEdge:I?"right":"left",direction:I?1:-1,size:"width",children:r.jsx(B7e,{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=O7e[I?"from-left":"from-right"].includes(P.key);m==null||m({event:P,direction:D?-1:1})}})})}),Vwt=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(F7e,{scope:e.__scopeSlider,startEdge:b?"bottom":"top",endEdge:b?"top":"bottom",size:"height",direction:b?1:-1,children:r.jsx(B7e,{"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=O7e[b?"from-bottom":"from-top"].includes(k.key);u==null||u({event:k,direction:I?-1:1})}})})}),B7e=A.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:s,onSlideMove:a,onSlideEnd:o,onHomeKeyDown:l,onEndKeyDown:i,onStepKeyDown:u,...m}=e,x=Aae(D3,n);return r.jsx(Bn.span,{...m,ref:t,onKeyDown:xn(e.onKeyDown,y=>{y.key==="Home"?(l(y),y.preventDefault()):y.key==="End"?(i(y),y.preventDefault()):P7e.concat(L7e).includes(y.key)&&(u(y),y.preventDefault())}),onPointerDown:xn(e.onPointerDown,y=>{const v=y.target;v.setPointerCapture(y.pointerId),y.preventDefault(),x.thumbs.has(v)?v.focus():s(y)}),onPointerMove:xn(e.onPointerMove,y=>{y.target.hasPointerCapture(y.pointerId)&&a(y)}),onPointerUp:xn(e.onPointerUp,y=>{const v=y.target;v.hasPointerCapture(y.pointerId)&&(v.releasePointerCapture(y.pointerId),o(y))})})}),$7e="SliderTrack",U7e=A.forwardRef((e,t)=>{const{__scopeSlider:n,...s}=e,a=Aae($7e,n);return r.jsx(Bn.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...s,ref:t})});U7e.displayName=$7e;var ffe="SliderRange",q7e=A.forwardRef((e,t)=>{const{__scopeSlider:n,...s}=e,a=Aae(ffe,n),o=z7e(ffe,n),l=A.useRef(null),i=ca(t,l),u=a.values.length,m=a.values.map(v=>W7e(v,a.min,a.max)),x=u>1?Math.min(...m):0,y=100-Math.max(...m);return r.jsx(Bn.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...s,ref:i,style:{...e.style,[o.startEdge]:x+"%",[o.endEdge]:y+"%"}})});q7e.displayName=ffe;var pfe="SliderThumb",V7e=A.forwardRef((e,t)=>{const n=Bwt(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(Hwt,{...e,ref:o,index:l})}),Hwt=A.forwardRef((e,t)=>{const{__scopeSlider:n,index:s,name:a,...o}=e,l=Aae(pfe,n),i=z7e(pfe,n),[u,m]=A.useState(null),x=ca(t,T=>m(T)),y=u?l.form||!!u.closest("form"):!0,v=YI(u),b=l.values[s],N=b===void 0?0:W7e(b,l.min,l.max),k=Kwt(s,l.values.length),M=v==null?void 0:v[i.size],I=M?Ywt(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(mfe.ItemSlot,{scope:e.__scopeSlider,children:r.jsx(Bn.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:xn(e.onFocus,()=>{l.valueIndexToChangeRef.current=s})})}),y&&r.jsx(H7e,{name:a??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:b},s)]})});V7e.displayName=pfe;var Wwt="RadioBubbleInput",H7e=A.forwardRef(({__scopeSlider:e,value:t,...n},s)=>{const a=A.useRef(null),o=ca(a,s),l=cP(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(Bn.input,{style:{display:"none"},...n,ref:o,defaultValue:t})});H7e.displayName=Wwt;function Gwt(e=[],t,n){const s=[...e];return s[n]=t,s.sort((a,o)=>a-o)}function W7e(e,t,n){const o=100/(n-t)*(e-t);return DE(o,[0,100])}function Kwt(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function Zwt(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 Ywt(e,t,n){const s=e/2,o=N0e([0,50],[0,s]);return(s-o(t)*n)*n}function Xwt(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Qwt(e,t){if(t>0){const n=Xwt(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 Jwt(e){return(String(e).split(".")[1]||"").length}function ejt(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var G7e=R7e,tjt=U7e,rjt=q7e,njt=V7e;const Np=A.forwardRef(({className:e,...t},n)=>r.jsxs(G7e,{ref:n,className:Ut("relative flex w-full touch-none select-none items-center",e),...t,children:[r.jsx(tjt,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:r.jsx(rjt,{className:"absolute h-full bg-primary"})}),r.jsx(njt,{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=G7e.displayName;function sjt(e,t,n){return Dwt(Owt({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(sjt(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,Q=u.height*D,ae=v*Math.PI/180,oe=T.width/2,de=T.height/2;return P.save(),P.translate(oe,de),P.rotate(ae),P.scale(x,x),P.translate(-oe,-de),P.drawImage(I,V,W,G,Q,0,0,U,U),P.restore(),new Promise((se,pe)=>{T.toBlob(ne=>{ne?se(ne):pe(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(Or,{open:e,onOpenChange:t,children:r.jsxs(Lr,{className:"max-w-lg",children:[r.jsx(zr,{children:r.jsx(Fr,{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(zwt,{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(B4,{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(z4,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(kA,{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(Hs,{children:[r.jsx(X,{variant:"outline",onClick:t,children:"Cancel"}),r.jsx(X,{onClick:M,children:"Save Photo"})]})]})})},ajt=()=>{const{user:e}=tn(),{toast:t}=pi(),[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(Tt,{className:"bg-amber-500",children:"Grandfathered"});switch(l==null?void 0:l.status){case"active":return r.jsx(Tt,{className:"bg-green-500",children:"Active"});case"trialing":return r.jsx(Tt,{className:"bg-blue-500",children:"Trial"});case"past_due":return r.jsx(Tt,{variant:"destructive",children:"Past Due"});case"canceled":return r.jsx(Tt,{variant:"secondary",children:"Canceled"});default:return r.jsx(Tt,{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(hf,{className:"h-5 w-5"}),"Subscription"]})}),r.jsx(Je,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(Wr,{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(hf,{className:"h-5 w-5"}),"Subscription"]}),r.jsx(kn,{children:"Manage your subscription and billing"})]}),r.jsxs(Je,{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(X,{onClick:m,variant:"outline",disabled:a,children:[a?r.jsx(Wr,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(Ms,{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."})]})]})},ijt=()=>{const{user:e}=tn(),t=Wn(),{toast:n}=pi(),[s]=Zc(),a=s.get("setup")==="true",o=s.get("reset")==="true",{isSupported:l,isSubscribed:i,isLoading:u,subscribe:m,unsubscribe:x}=hRe(),[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,Q]=A.useState(!1),[ae,oe]=A.useState({newPassword:"",confirmPassword:""});A.useEffect(()=>{e&&de()},[e]),A.useEffect(()=>{o&&e&&setTimeout(()=>{var he;(he=document.getElementById("change-password-section"))==null||he.scrollIntoView({behavior:"smooth",block:"center"})},500)},[o,e]);const de=async()=>{var he,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:be,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;be?(console.log("Profile loaded successfully:",be),U({name:be.name||"",email:be.email||"",title:be.title||"",bio:be.bio||"",areas_served:be.areas_served||"",years_experience:((he=be.years_experience)==null?void 0:he.toString())||"",instagram_url:be.instagram_url||"",facebook_url:be.facebook_url||"",linkedin_url:be.linkedin_url||"",email_signature:be.email_signature||"",use_email_signature:be.use_email_signature||!1}),W(be.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:et}=Y.storage.from("avatars").getPublicUrl(`${e.id}/${ve[0].name}`);N(et.publicUrl)}}catch(be){console.error("Error loading profile:",be),n({title:"Error",description:be.message||"Failed to load profile",variant:"destructive"})}},se=he=>{var be;const xe=(be=he.target.files)==null?void 0:be[0];if(!xe)return;const Te=new FileReader;Te.onloadend=()=>{F(Te.result),T(!0)},Te.readAsDataURL(xe),he.target.value=""},pe=async he=>{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(et=>`${e.id}/${et.name}`));const be=`${e.id}/avatar.jpg`,{error:we}=await Y.storage.from("avatars").upload(be,he,{upsert:!0,contentType:"image/jpeg"});if(we)throw we;const{data:ve}=Y.storage.from("avatars").getPublicUrl(be);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)}}},ne=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:he}=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(he)throw he;n({title:"Success",description:"Profile updated successfully"})}catch(he){console.error("Error updating profile:",he),n({title:"Error",description:he.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:he}=await Y.auth.updateUser({password:ae.newPassword});if(he)throw he;n({title:"Success",description:"Password updated successfully"}),oe({newPassword:"",confirmPassword:""}),a&&setTimeout(()=>t("/dashboard"),1e3)}catch(he){console.error("Error updating password:",he),n({title:"Error",description:he.message||"Failed to update password",variant:"destructive"})}finally{v(!1)}};return r.jsx(Dr,{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(X,{variant:"outline",onClick:()=>{var he;(he=document.getElementById("change-password-section"))==null||he.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(kn,{children:"Upload a professional photo for your profile"})]}),r.jsxs(Je,{className:"flex items-center gap-6",children:[r.jsxs(ea,{className:"h-24 w-24",children:[r.jsx(Ti,{src:b}),r.jsx(ta,{className:"text-2xl",children:D.name.split(" ").map(he=>he[0]).join("").toUpperCase()||"U"})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("input",{type:"file",id:"avatar-upload",accept:"image/*",className:"hidden",onChange:se,disabled:k}),r.jsxs(X,{variant:"outline",onClick:()=>{var he;return(he=document.getElementById("avatar-upload"))==null?void 0:he.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(kn,{children:"Update your profile details"})]}),r.jsxs(Je,{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:he=>U({...D,name:he.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:he=>U({...D,email:he.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:he=>U({...D,title:he.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(Xn,{id:"bio",value:D.bio,onChange:he=>U({...D,bio:he.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:he=>U({...D,areas_served:he.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:he=>U({...D,years_experience:he.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:he=>U({...D,linkedin_url:he.target.value}),placeholder:"LinkedIn URL"}),r.jsx(lt,{value:D.instagram_url,onChange:he=>U({...D,instagram_url:he.target.value}),placeholder:"Instagram URL"}),r.jsx(lt,{value:D.facebook_url,onChange:he=>U({...D,facebook_url:he.target.value}),placeholder:"Facebook URL"})]})]}),r.jsxs(X,{onClick:ne,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(Z0,{className:"h-5 w-5"}),"Email Signature"]}),r.jsx(kn,{children:"Add a signature that will be appended to emails sent via Gmail"})]}),r.jsxs(Je,{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(Is,{checked:D.use_email_signature,onCheckedChange:he=>U({...D,use_email_signature:he})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Signature"}),r.jsx(Hp,{content:D.email_signature,onChange:he=>U({...D,email_signature:he}),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(X,{onClick:ne,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(kn,{children:a?"Create a secure password for your account":"Update your password to keep your account secure"})]}),r.jsxs(Je,{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:he=>oe({...ae,newPassword:he.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:he=>oe({...ae,confirmPassword:he.target.value}),placeholder:"Re-enter your new password"})]}),r.jsxs(X,{onClick:me,disabled:y,children:[r.jsx(Ip,{className:"mr-2 h-4 w-4"}),a?"Complete Setup":"Update Password"]}),a&&r.jsx(X,{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(kn,{children:"Receive browser notifications when new content is added"})]}),r.jsx(Je,{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(Is,{checked:i,onCheckedChange:he=>{he?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(uA,{className:"h-5 w-5"}):r.jsx(ks,{className:"h-5 w-5"}),"Email Preferences"]}),r.jsx(kn,{children:"Manage your email subscription settings"})]}),r.jsx(Je,{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(Is,{checked:!V,onCheckedChange:async he=>{Q(!0);try{const{error:xe}=await Y.from("profiles").update({digest_opt_out:!he}).eq("id",e==null?void 0:e.id);if(xe)throw xe;W(!he),n({title:he?"Subscribed":"Unsubscribed",description:he?"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{Q(!1)}},disabled:G})]})})]}),r.jsx(Rxt,{}),r.jsx(ajt,{})]}),r.jsx(S0e,{open:I,onClose:()=>T(!1),imageSrc:P,onCropComplete:pe,aspectRatio:1})]})})};var ojt="AspectRatio",K7e=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(Bn.div,{...a,ref:t,style:{...s,position:"absolute",top:0,right:0,bottom:0,left:0}})})});K7e.displayName=ojt;var ljt=K7e;const cjt=ljt;function djt(){const{user:e}=tn(),t=qr(),[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(Or,{open:a,onOpenChange:o,children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{variant:"outline",className:"gap-2",children:[r.jsx(Ts,{className:"h-4 w-4"}),"Subscribe to Calendar"]})}),r.jsxs(Lr,{className:"sm:max-w-md",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(Ts,{className:"h-5 w-5 text-primary"}),"Subscribe to Events Calendar"]}),r.jsx(Qn,{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(Wr,{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(X,{variant:"outline",size:"icon",onClick:x,children:n?r.jsx(fi,{className:"h-4 w-4 text-green-500"}):r.jsx(Oo,{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(X,{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(Ms,{className:"h-3 w-3 ml-auto opacity-50"})]}),r.jsxs(X,{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(Ms,{className:"h-3 w-3 ml-auto opacity-50"})]}),r.jsxs(X,{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(Ms,{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(X,{onClick:()=>u.mutate(),disabled:u.isPending,className:"w-full",children:u.isPending?r.jsxs(r.Fragment,{children:[r.jsx(Wr,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Ts,{className:"h-4 w-4 mr-2"}),"Generate Calendar URL"]})})]})})]})]})}var Eae="Tabs",[ujt]=cc(Eae,[T3]),Z7e=T3(),[hjt,C0e]=ujt(Eae),Y7e=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]=sh({prop:s,onChange:a,defaultProp:o??"",caller:Eae});return r.jsx(hjt,{scope:n,baseId:gd(),value:y,onValueChange:v,orientation:l,dir:x,activationMode:u,children:r.jsx(Bn.div,{dir:x,"data-orientation":l,...m,ref:t})})});Y7e.displayName=Eae;var X7e="TabsList",Q7e=A.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...a}=e,o=C0e(X7e,n),l=Z7e(n);return r.jsx(Rxe,{asChild:!0,...l,orientation:o.orientation,dir:o.dir,loop:s,children:r.jsx(Bn.div,{role:"tablist","aria-orientation":o.orientation,...a,ref:t})})});Q7e.displayName=X7e;var J7e="TabsTrigger",e9e=A.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:a=!1,...o}=e,l=C0e(J7e,n),i=Z7e(n),u=n9e(l.baseId,s),m=s9e(l.baseId,s),x=s===l.value;return r.jsx(Fxe,{asChild:!0,...i,focusable:!a,active:x,children:r.jsx(Bn.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:xn(e.onMouseDown,y=>{!a&&y.button===0&&y.ctrlKey===!1?l.onValueChange(s):y.preventDefault()}),onKeyDown:xn(e.onKeyDown,y=>{[" ","Enter"].includes(y.key)&&l.onValueChange(s)}),onFocus:xn(e.onFocus,()=>{const y=l.activationMode!=="manual";!x&&!a&&y&&l.onValueChange(s)})})})});e9e.displayName=J7e;var t9e="TabsContent",r9e=A.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:a,children:o,...l}=e,i=C0e(t9e,n),u=n9e(i.baseId,s),m=s9e(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(Bn.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})})});r9e.displayName=t9e;function n9e(e,t){return`${e}-trigger-${t}`}function s9e(e,t){return`${e}-content-${t}`}var mjt=Y7e,a9e=Q7e,i9e=e9e,o9e=r9e;const ki=mjt,wi=A.forwardRef(({className:e,...t},n)=>r.jsx(a9e,{ref:n,className:Ut("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));wi.displayName=a9e.displayName;const an=A.forwardRef(({className:e,...t},n)=>r.jsx(i9e,{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}));an.displayName=i9e.displayName;const Cn=A.forwardRef(({className:e,...t},n)=>r.jsx(o9e,{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}));Cn.displayName=o9e.displayName;const fjt={first_timer:Ss,regular:fy,dedicated:Bl,veteran:io,streak_master:pm,century:io},pjt={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 L4e(e){return e===1?r.jsx(io,{className:"h-5 w-5 text-yellow-500"}):e===2?r.jsx(fy,{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 l9e({showUserStats:e=!0,compact:t=!1,brokerageId:n,title:s="Event Leaderboard"}){const{user:a}=tn(),{data:o,isLoading:l}=DRe(t?5:10,n),{data:i}=RRe(a==null?void 0:a.id),{data:u}=zRe(a==null?void 0:a.id),{data:m}=FRe(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(Je,{children:r.jsx("div",{className:"space-y-3",children:[...Array(5)].map((x,y)=>r.jsx(Tr,{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(Je,{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(Tt,{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(pm,{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=fjt[x.badge_type]||Ss;return r.jsxs(Tt,{variant:"outline",className:`text-xs ${pjt[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(Tt,{variant:"outline",className:"text-xs",children:["+",m.length-4," more"]})]})]}),r.jsxs(ki,{defaultValue:"points",className:"w-full",children:[r.jsxs(wi,{className:"w-full mb-3",children:[r.jsx(an,{value:"points",className:"flex-1",children:"By Points"}),r.jsx(an,{value:"events",className:"flex-1",children:"By Events"})]}),r.jsx(Cn,{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:L4e(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(Cn,{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:L4e(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 gjt(){const e=Wn(),{user:t,isAdmin:n}=tn(),s=qr(),{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=>X4(k.event_date)!=="ended"))||[],N=(a==null?void 0:a.filter(k=>X4(k.event_date)==="ended"))||[];return r.jsx(Dr,{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(djt,{}),n&&r.jsx(X,{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(Je,{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=X4(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(Qa,{className:"h-3.5 w-3.5"}),"STARTING SOON"]})]}),k.image_url&&r.jsx(cjt,{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(kn,{className:"line-clamp-2",children:k.description.replace(/<[^>]*>/g,"")})]}),r.jsxs(Je,{className:"flex-1 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Ts,{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(Qa,{className:"h-4 w-4"}),zE(new Date(k.event_date))]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(qn,{className:"h-4 w-4"}),(i==null?void 0:i[k.id])||0," registered",k.capacity&&` / ${k.capacity} spots`]})]}),r.jsx(RA,{className:"flex gap-2",onClick:F=>F.stopPropagation(),children:x(k.id)?r.jsxs(r.Fragment,{children:[r.jsxs(X,{variant:"outline",className:"flex-1",onClick:()=>m.mutate(k.id),disabled:m.isPending,children:[r.jsx(us,{className:"h-4 w-4 mr-2"}),"Cancel"]}),r.jsxs(X,{className:"flex-1",onClick:()=>window.open(y(k.id)||k.zoom_link,"_blank"),children:[r.jsx(Ms,{className:"h-4 w-4 mr-2"}),"Join Zoom"]})]}):r.jsx(X,{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(fi,{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(kn,{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(l9e,{showUserStats:!0})})]})]})})}const kde=[{value:"all",label:"All Roles",icon:qn},{value:"brokerage_manager",label:"Brokerage Managers",icon:IA},{value:"admin",label:"Admins",icon:_m}];function xjt({open:e,onOpenChange:t,resourceType:n,resourceId:s,resourceTitle:a}){var ot,At;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),[Q,ae]=A.useState("agents"),[oe,de]=A.useState("all"),[se,pe]=A.useState({}),ne=l||i;A.useEffect(()=>{e&&o&&(l?me():he())},[e,o,l]),A.useEffect(()=>{e||(b([]),k([]),I(""),P(""),D(""),ae("agents"),de("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 Qe=0,rt=!0;for(;rt;){const{data:Ce,error:Ee}=await Y.from("profiles").select("brokerage_id").range(Qe*le,(Qe+1)*le-1);if(Ee)throw Ee;Ce==null||Ce.forEach(Ye=>{Ye.brokerage_id&&(qe[Ye.brokerage_id]=(qe[Ye.brokerage_id]||0)+1)}),rt=(Ce==null?void 0:Ce.length)===le,Qe++}y((Oe==null?void 0:Oe.map(Ce=>({...Ce,agent_count:qe[Ce.id]||0})))||[]);const je=[];for(Qe=0,rt=!0;rt;){const{data:Ce,error:Ee}=await Y.from("profiles").select("id, name, email, brokerage_id, brokerages(name)").neq("id",o.id).order("name").range(Qe*le,(Qe+1)*le-1);if(Ee)throw Ee;Ce&&je.push(...Ce),rt=(Ce==null?void 0:Ce.length)===le,Qe++}const ut={};for(Qe=0,rt=!0;rt;){const{data:Ce,error:Ee}=await Y.from("user_roles").select("user_id, role").range(Qe*le,(Qe+1)*le-1);if(Ee)throw Ee;Ce==null||Ce.forEach(Ye=>{ut[Ye.user_id]||(ut[Ye.user_id]=[]),ut[Ye.user_id].push(Ye.role)}),rt=(Ce==null?void 0:Ce.length)===le,Qe++}pe(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)}}},he=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=se[Oe.id]||[];return at&&qe.includes(oe)}return at}),Te=x.filter(Oe=>Oe.name.toLowerCase().includes(T.toLowerCase())),be=()=>{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(!ne){b([Oe]);return}b(at=>at.includes(Oe)?at.filter(le=>le!==Oe):[...at,Oe])},et=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=se[Oe]||[];return at.includes("admin")?r.jsx(Tt,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:"Admin"}):at.includes("brokerage_manager")?r.jsx(Tt,{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(Or,{open:e,onOpenChange:t,children:r.jsxs(Lr,{className:"sm:max-w-lg max-h-[90vh] overflow-hidden flex flex-col",children:[r.jsxs(zr,{className:"flex-shrink-0",children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(Ji,{className:"h-5 w-5 text-primary"}),"Share Resource"]}),r.jsxs(Qn,{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(ki,{value:Q,onValueChange:ae,className:"flex-1 flex flex-col overflow-hidden",children:[r.jsxs(wi,{className:"grid w-full grid-cols-2 flex-shrink-0",children:[r.jsxs(an,{value:"agents",className:"flex items-center gap-2",children:[r.jsx(qn,{className:"h-4 w-4"}),r.jsx("span",{children:"Agents"}),v.length>0&&r.jsx(Tt,{variant:"default",className:"h-5 min-w-5 px-1.5 text-xs",children:v.length})]}),r.jsxs(an,{value:"brokerages",className:"flex items-center gap-2",children:[r.jsx(mi,{className:"h-4 w-4"}),r.jsx("span",{children:"Brokerages"}),N.length>0&&r.jsx(Tt,{variant:"default",className:"h-5 min-w-5 px-1.5 text-xs",children:N.length})]})]}),r.jsxs(Cn,{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(hn,{value:oe,onValueChange:de,children:[r.jsxs(cn,{className:"w-[180px]",children:[r.jsx(W1,{className:"h-4 w-4 mr-2 text-muted-foreground"}),r.jsx(fn,{placeholder:"Filter by role"})]}),r.jsx(dn,{children:kde.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(X,{variant:"ghost",size:"sm",onClick:be,className:"text-xs h-8",disabled:xe.length===0,children:[r.jsx(qn,{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=kde.find(Oe=>Oe.value===oe))==null?void 0:ot.label]}),r.jsxs("span",{className:"font-medium",children:[v.length," selected"]})]})]}),r.jsx(Zo,{className:"h-[300px] border rounded-lg",children:U?r.jsx("div",{className:"flex items-center justify-center h-[200px]",children:r.jsx(Wr,{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(qn,{className:"h-8 w-8 mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:oe!=="all"?`No ${(At=kde.find(Oe=>Oe.value===oe))==null?void 0:At.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(Cn,{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(X,{variant:"ghost",size:"sm",onClick:we,className:"text-xs h-8",disabled:Te.length===0,children:[r.jsx(mi,{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(Zo,{className:"h-[250px] border rounded-lg",children:U?r.jsx("div",{className:"flex items-center justify-center h-[180px]",children:r.jsx(Wr,{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(mi,{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:()=>et(Oe.id),children:[r.jsx(_l,{checked:N.includes(Oe.id),onCheckedChange:()=>et(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(mi,{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"})]}),ne&&r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(X,{variant:"ghost",size:"sm",onClick:be,className:"text-xs h-8",disabled:xe.length===0,children:[r.jsx(qn,{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(Zo,{className:"h-[300px] border rounded-lg",children:U?r.jsx("div",{className:"flex items-center justify-center h-[200px]",children:r.jsx(Wr,{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(qn,{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(Xn,{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(X,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(X,{onClick:Me,disabled:Be===0||W,children:W?r.jsxs(r.Fragment,{children:[r.jsx(Wr,{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 R3({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(X,{variant:s,size:a,onClick:()=>i(!0),className:o,children:[r.jsx(Nc,{className:"h-4 w-4 mr-2"}),"Share"]}),r.jsx(xjt,{open:l,onOpenChange:i,resourceType:e,resourceId:t,resourceTitle:n})]}):null}function yjt(){const{eventId:e}=Ec(),t=Wn(),{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(Dr,{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(Dr,{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(X,{onClick:()=>t("/events"),className:"mt-4",children:"Back to Events"})]})});const M=lft(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(Dr,{title:s.title,children:r.jsxs("div",{className:"max-w-4xl mx-auto",children:[r.jsxs(X,{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(Tt,{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(R3,{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(nf,{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(Je,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(Ts,{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:zE(new Date(s.event_date))})]})]}),s.capacity&&r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(qn,{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(li,{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(X,{className:"w-full gap-2",onClick:()=>window.open(T,"_blank"),children:[r.jsx(Ms,{className:"h-4 w-4"}),"Join Event"]}),r.jsxs(X,{variant:"outline",className:"w-full",onClick:N,disabled:y,children:[y?r.jsx(Wr,{className:"h-4 w-4 animate-spin mr-2"}):null,"Cancel Registration"]})]}):r.jsx(X,{className:"w-full gap-2",onClick:N,disabled:y||(I??!1),children:y?r.jsx(Wr,{className:"h-4 w-4 animate-spin"}):I?"Event Full":"Register Now"})}),M&&o&&r.jsxs(X,{variant:"outline",className:"w-full gap-2",onClick:()=>window.open(s.zoom_link,"_blank"),children:[r.jsx(Ms,{className:"h-4 w-4"}),"View Recording"]})]})]})})})]})]})})}const vjt=()=>{const{user:e,isAdmin:t}=tn(),n=Wn(),[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(Q=>Q.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(Q=>Q.app_id))||[]);v(V);const G=((F==null?void 0:F.filter(Q=>!Q.required_tags||Q.required_tags.length===0?!0:Q.required_tags.some(ae=>P.includes(ae))))||[]).sort((Q,ae)=>Q.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(Dr,{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(Dr,{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(th,{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(X,{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)})})]})},_jt=()=>{const e=Wn(),[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(Q=>{V.set(Q.template_id,(V.get(Q.template_id)||0)+1)});const W=new Map;return U==null||U.forEach(Q=>{W.set(Q.template_id,(W.get(Q.template_id)||0)+1)}),(I||[]).map(Q=>({...Q,links:(P||[]).filter(ae=>ae.template_id===Q.id)||[],likesCount:V.get(Q.id)||0,commentsCount:W.get(Q.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(Dr,{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(hn,{value:s,onValueChange:a,children:[r.jsx(cn,{className:"w-full sm:w-48",children:r.jsx(fn,{placeholder:"All Categories"})}),r.jsxs(dn,{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(hn,{value:o,onValueChange:l,children:[r.jsx(cn,{className:"w-full sm:w-48",children:r.jsx(fn,{placeholder:"All Types"})}),r.jsxs(dn,{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(X,{variant:"outline",size:"sm",onClick:N,children:"Clear Filters"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(X,{variant:i==="grid"?"secondary":"outline",size:"icon",onClick:()=>u("grid"),className:"rounded-full",children:r.jsx(mf,{className:"h-4 w-4"})}),r.jsx(X,{variant:i==="list"?"secondary":"outline",size:"icon",onClick:()=>u("list"),className:"rounded-full",children:r.jsx(ff,{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(Je,{className:"p-4",children:[r.jsx(Tr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Tr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Tr,{className:"h-4 w-full mb-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Tr,{className:"h-5 w-16"}),r.jsx(Tr,{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(X,{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(Tt,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm !text-secondary",children:[r.jsx(Ro,{className:"h-3 w-3"}),I.links.length]})})]}),r.jsxs(Je,{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:yse(I.description)}),r.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[I.category&&r.jsx(Tt,{variant:"secondary",className:"text-xs",children:I.category.name}),I.type&&r.jsx(Tt,{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(pd,{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(X,{size:"sm",className:"w-full gap-2",onClick:T=>{T.stopPropagation(),M(I.id)},children:[r.jsx(Ms,{className:"h-4 w-4"}),"View Template"]})]})]},I.id))})]})})};var bjt="Separator",O4e="horizontal",wjt=["horizontal","vertical"],c9e=A.forwardRef((e,t)=>{const{decorative:n,orientation:s=O4e,...a}=e,o=jjt(s)?s:O4e,i=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return r.jsx(Bn.div,{"data-orientation":o,...i,...a,ref:t})});c9e.displayName=bjt;function jjt(e){return wjt.includes(e)}var d9e=c9e;const Dd=A.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...s},a)=>r.jsx(d9e,{ref:a,decorative:n,orientation:t,className:Ut("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...s}));Dd.displayName=d9e.displayName;const gP=()=>({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)}},[])}),kjt=()=>{const{templateId:e}=Ec(),{user:t,isAdmin:n}=tn(),{toast:s}=pi(),a=qr(),{trackEngagement:o}=gP(),[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(Dr,{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(Dr,{title:u.name,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(X,{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(Tt,{variant:"secondary",children:u.category.name}),u.type&&r.jsx(Tt,{variant:"outline",children:u.type.name})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[n&&r.jsx(X,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(co,{to:`/admin/templates?edit=${u.id}`,children:[r.jsx(Ja,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(R3,{resourceType:"template",resourceId:u.id,resourceTitle:u.name,size:"default",className:"rounded-full"}),r.jsxs(X,{variant:k?"default":"outline",className:"gap-2 rounded-full",onClick:()=>N.mutate(),disabled:!t||N.isPending,children:[r.jsx(pd,{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(Je,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Ro,{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(X,{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(Ms,{className:"h-4 w-4 text-muted-foreground"})]},T.id))})]})}),u.video_url&&r.jsx(He,{children:r.jsx(Je,{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(Je,{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(X,{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(Dd,{}),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(Xn,{placeholder:"Add a comment...",value:l,onChange:T=>i(T.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(X,{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(Je,{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(Je,{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(X,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>b.mutate(T.id),children:r.jsx(Un,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:T.content})]})]})})},T.id))})]})]})}):r.jsx(Dr,{title:"Templates",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Ro,{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(X,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/templates",children:"Back to Templates"})})]})})},Njt=()=>{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(Dr,{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(ki,{value:s,onValueChange:a,children:r.jsxs(wi,{className:"w-full justify-start flex-wrap h-auto gap-2 bg-transparent p-0",children:[r.jsx(an,{value:"all",className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:"All Videos"}),o.map(v=>r.jsx(an,{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(Je,{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Pa,{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(Pa,{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(Qa,{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(Tt,{variant:"secondary",className:"w-fit",children:v.category.name})]}),r.jsxs(Je,{className:"pt-0",children:[v.description&&r.jsx(kn,{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(pd,{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 u9e({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(Tt,{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 Sjt=(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},Cjt=()=>{const{videoId:e}=Ec();Wn();const{user:t,isAdmin:n}=tn(),{toast:s}=pi(),a=qr(),{trackEngagement:o}=gP(),[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(Dr,{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(Dr,{title:u.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(X,{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:Sjt(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(Pa,{className:"h-16 w-16 opacity-50"}),r.jsx(X,{variant:"secondary",asChild:!0,children:r.jsxs("a",{href:u.video_url,target:"_blank",rel:"noopener noreferrer",className:"gap-2",children:[r.jsx(Ms,{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(Tt,{variant:"secondary",children:u.category.name})]}),r.jsxs("div",{className:"flex gap-2",children:[n&&r.jsx(X,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(co,{to:`/admin/academy?edit=${u.id}`,children:[r.jsx(Ja,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(R3,{resourceType:"academy_video",resourceId:u.id,resourceTitle:u.title}),r.jsxs(X,{variant:k?"default":"outline",className:"gap-2 w-fit",onClick:()=>N.mutate(),disabled:!t||N.isPending,children:[r.jsx(pd,{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(Je,{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(u9e,{resourceType:"academy_video",resourceId:u.id}),r.jsx(Dd,{}),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(Xn,{placeholder:"Add a comment...",value:l,onChange:P=>i(P.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(X,{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(Je,{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(Je,{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(X,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>b.mutate(P.id),children:r.jsx(Un,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:P.content})]})]})})},P.id))})]})]})}):r.jsx(Dr,{title:"Academy",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Pa,{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(X,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/academy",children:"Back to Academy"})})]})})};function Mjt(){const e=Wn(),[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(Dr,{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(Je,{className:"p-4",children:[r.jsx(Tr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Tr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Tr,{className:"h-4 w-full mb-4"}),r.jsx(Tr,{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(Je,{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:yse(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(pd,{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 Tjt=()=>{const{kitId:e}=Ec(),{user:t,isAdmin:n}=tn(),{toast:s}=pi(),a=qr(),{trackEngagement:o}=gP(),[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(Dr,{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(Dr,{title:u.name,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(X,{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(X,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(co,{to:`/admin/toolbox?edit=${u.id}`,children:[r.jsx(Ja,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(R3,{resourceType:"resource_kit",resourceId:u.id,resourceTitle:u.name,size:"default",className:"rounded-full"}),r.jsxs(X,{variant:k?"default":"outline",className:"gap-2 rounded-full",onClick:()=>N.mutate(),disabled:!t||N.isPending,children:[r.jsx(pd,{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(Je,{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(Je,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Ms,{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(Ms,{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(u9e,{resourceType:"resource_kit",resourceId:u.id}),r.jsx(Dd,{}),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(Xn,{placeholder:"Add a comment...",value:l,onChange:P=>i(P.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(X,{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(Je,{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(Je,{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(X,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>b.mutate(P.id),children:r.jsx(Un,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:P.content})]})]})})},P.id))})]})]})}):r.jsx(Dr,{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(X,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/toolbox",children:"Back to Toolbox"})})]})})},Ajt=()=>{const e=Wn(),[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(Dr,{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(X,{variant:"outline",size:"sm",onClick:()=>n(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(X,{variant:s==="grid"?"secondary":"outline",size:"icon",onClick:()=>a("grid"),className:"rounded-full",children:r.jsx(mf,{className:"h-4 w-4"})}),r.jsx(X,{variant:s==="list"?"secondary":"outline",size:"icon",onClick:()=>a("list"),className:"rounded-full",children:r.jsx(ff,{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(Je,{className:"p-4",children:[r.jsx(Tr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Tr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Tr,{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(X,{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(Tt,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm",children:[r.jsx(Ro,{className:"h-3 w-3"}),m.links.length]})})]}),r.jsxs(Je,{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(pd,{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(X,{size:"sm",className:"w-full gap-2",onClick:x=>{x.stopPropagation(),u(m.id)},children:[r.jsx(Ms,{className:"h-4 w-4"}),"View Details"]})]})]},m.id))})]})})};var $a=function(){return $a=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(ckt,{displayMonth:e.displayMonth,hideNext:x,hidePrevious:y,nextMonth:a,previousMonth:s,onPreviousClick:v,onNextClick:b})}function dkt(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:f9e,m;return a?m=r.jsx(u,{id:e.id,displayMonth:e.displayMonth}):l==="dropdown"?m=r.jsx(D4e,{displayMonth:e.displayMonth,id:e.id}):l==="dropdown-buttons"?m=r.jsxs(r.Fragment,{children:[r.jsx(D4e,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),r.jsx(R4e,{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(R4e,{displayMonth:e.displayMonth,id:e.id})]}),r.jsx("div",{className:s.caption,style:o.caption,children:m})}function ukt(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 hkt(e,t,n){for(var s=n?Iy(new Date):Sm(new Date,{locale:e,weekStartsOn:t}),a=[],o=0;o<7;o++){var l=Ql(s,o);a.push(l)}return a}function mkt(){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=hkt(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 fkt(){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:mkt;return r.jsx("thead",{style:s.head,className:n.head,children:r.jsx(o,{})})}function pkt(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 gkt(e){if(!xP(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return r.jsx(M0e.Provider,{value:t,children:e.children})}return r.jsx(xkt,{initialProps:e.initialProps,children:e.children})}function xkt(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?h9e([],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 ykt(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:rre(s,e)?{from:e,to:a}:{from:s,to:e}:a?rre(e,a)?{from:a,to:e}:{from:e,to:a}:s?aae(e,s)?{from:e,to:s}:{from:s,to:e}:{from:e,to:void 0}}var A0e=A.createContext(void 0);function vkt(e){if(!yP(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(_kt,{initialProps:e.initialProps,children:e.children})}function _kt(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=ykt(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:Vce(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:Vce(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:Vce(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 Jee(e){return Array.isArray(e)?h9e([],e):e!==void 0?[e]:[]}function bkt(e){var t={};return Object.entries(e).forEach(function(n){var s=n[0],a=n[1];t[s]=Jee(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 wkt=zp.Selected,Fx=zp.Disabled,jkt=zp.Hidden,kkt=zp.Today,Nde=zp.RangeEnd,Sde=zp.RangeMiddle,Cde=zp.RangeStart,Nkt=zp.Outside;function Skt(e,t,n){var s,a=(s={},s[wkt]=Jee(e.selected),s[Fx]=Jee(e.disabled),s[jkt]=Jee(e.hidden),s[kkt]=[e.today],s[Nde]=[],s[Sde]=[],s[Cde]=[],s[Nkt]=[],s);return e.fromDate&&a[Fx].push({before:e.fromDate}),e.toDate&&a[Fx].push({after:e.toDate}),xP(e)?a[Fx]=a[Fx].concat(t.modifiers[Fx]):yP(e)&&(a[Fx]=a[Fx].concat(n.modifiers[Fx]),a[Cde]=n.modifiers[Cde],a[Sde]=n.modifiers[Sde],a[Nde]=n.modifiers[Nde]),a}var x9e=A.createContext(void 0);function Ckt(e){var t=cl(),n=T0e(),s=E0e(),a=Skt(t,n,s),o=bkt(t.modifiers),l=$a($a({},a),o);return r.jsx(x9e.Provider,{value:l,children:e.children})}function y9e(){var e=A.useContext(x9e);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function Mkt(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function Tkt(e){return!!(e&&typeof e=="object"&&"from"in e)}function Akt(e){return!!(e&&typeof e=="object"&&"after"in e)}function Ekt(e){return!!(e&&typeof e=="object"&&"before"in e)}function Ikt(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function Pkt(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 Lkt(e){return yye(e)}function Okt(e){return Array.isArray(e)&&e.every(yye)}function Dkt(e,t){return t.some(function(n){if(typeof n=="boolean")return n;if(Lkt(n))return ac(e,n);if(Okt(n))return n.includes(e);if(Tkt(n))return Pkt(e,n);if(Ikt(n))return n.dayOfWeek.includes(e.getDay());if(Mkt(n)){var s=jp(n.before,e),a=jp(n.after,e),o=s>0,l=a<0,i=rre(n.before,n.after);return i?l&&o:o||l}return Akt(n)?jp(e,n.after)>0:Ekt(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 Dkt(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 Rkt(e,t){for(var n=Rh(e[0]),s=nae(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 Fkt=365;function v9e(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:zh,year:sht,startOfWeek:function(M){return a.ISOWeek?Iy(M):Sm(M,{locale:y,weekStartsOn:u})},endOfWeek:function(M){return a.ISOWeek?k8e(M):vye(M,{locale:y,weekStartsOn:u})}},b=v[n](e,s==="after"?1:-1);s==="before"&&m?b=aht([m,b]):s==="after"&&x&&(b=iht([x,b]));var N=!0;if(o){var k=I0e(b,o);N=!k.disabled&&!k.hidden}return N?b:i.count>Fkt?i.lastFocused:v9e(b,{moveBy:n,direction:s,context:a,modifiers:o,retry:$a($a({},i),{count:i.count+1})})}var _9e=A.createContext(void 0);function zkt(e){var t=vP(),n=y9e(),s=A.useState(),a=s[0],o=s[1],l=A.useState(),i=l[0],u=l[1],m=Rkt(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=v9e(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(_9e.Provider,{value:k,children:e.children})}function P0e(){var e=A.useContext(_9e);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function Bkt(e,t){var n=y9e(),s=I0e(e,n,t);return s}var L0e=A.createContext(void 0);function $kt(e){if(!Iae(e.initialProps)){var t={selected:void 0};return r.jsx(L0e.Provider,{value:t,children:e.children})}return r.jsx(Ukt,{initialProps:e.initialProps,children:e.children})}function Ukt(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 b9e(){var e=A.useContext(L0e);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function qkt(e,t){var n=cl(),s=b9e(),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 he,xe,Te,be;Iae(n)?(he=s.onDayClick)===null||he===void 0||he.call(s,e,t,me):xP(n)?(xe=a.onDayClick)===null||xe===void 0||xe.call(a,e,t,me):yP(n)?(Te=o.onDayClick)===null||Te===void 0||Te.call(o,e,t,me):(be=n.onDayClick)===null||be===void 0||be.call(n,e,t,me)},F=function(me){var he;v(e),(he=n.onDayFocus)===null||he===void 0||he.call(n,e,t,me)},D=function(me){var he;y(),(he=n.onDayBlur)===null||he===void 0||he.call(n,e,t,me)},U=function(me){var he;(he=n.onDayMouseEnter)===null||he===void 0||he.call(n,e,t,me)},V=function(me){var he;(he=n.onDayMouseLeave)===null||he===void 0||he.call(n,e,t,me)},W=function(me){var he;(he=n.onDayPointerEnter)===null||he===void 0||he.call(n,e,t,me)},G=function(me){var he;(he=n.onDayPointerLeave)===null||he===void 0||he.call(n,e,t,me)},Q=function(me){var he;(he=n.onDayTouchCancel)===null||he===void 0||he.call(n,e,t,me)},ae=function(me){var he;(he=n.onDayTouchEnd)===null||he===void 0||he.call(n,e,t,me)},oe=function(me){var he;(he=n.onDayTouchMove)===null||he===void 0||he.call(n,e,t,me)},de=function(me){var he;(he=n.onDayTouchStart)===null||he===void 0||he.call(n,e,t,me)},se=function(me){var he;(he=n.onDayKeyUp)===null||he===void 0||he.call(n,e,t,me)},pe=function(me){var he;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}(he=n.onDayKeyDown)===null||he===void 0||he.call(n,e,t,me)},ne={onClick:P,onFocus:F,onBlur:D,onKeyDown:pe,onKeyUp:se,onMouseEnter:U,onMouseLeave:V,onPointerEnter:W,onPointerLeave:G,onTouchCancel:Q,onTouchEnd:ae,onTouchMove:oe,onTouchStart:de};return ne}function Vkt(){var e=cl(),t=b9e(),n=T0e(),s=E0e(),a=Iae(e)?t.selected:xP(e)?n.selected:yP(e)?s.selected:void 0;return a}function Hkt(e){return Object.values(zp).includes(e)}function Wkt(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(Hkt(s)){var o=e.classNames["day_".concat(s)];o&&n.push(o)}}),n}function Gkt(e,t){var n=$a({},e.styles.day);return Object.keys(t).forEach(function(s){var a;n=$a($a({},n),(a=e.modifiersStyles)===null||a===void 0?void 0:a[s])}),n}function Kkt(e,t,n){var s,a,o,l=cl(),i=P0e(),u=Bkt(e,t),m=qkt(e,u),x=Vkt(),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=Wkt(l,u).join(" "),b=Gkt(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:pkt,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=$a($a($a({},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 Zkt(e){var t=A.useRef(null),n=Kkt(e.date,e.displayMonth,t);return n.isHidden?r.jsx("div",{role:"gridcell"}):n.isButton?r.jsx(Gre,$a({name:"day",ref:t},n.buttonProps)):r.jsx("div",$a({},n.divProps))}function Ykt(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(Gre,{name:"week-number","aria-label":y,className:l.weeknumber,style:o.weeknumber,onClick:v,children:x})}function Xkt(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:Zkt,m=(n=i==null?void 0:i.WeekNumber)!==null&&n!==void 0?n:Ykt,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})},dmt(y))})]})}function F4e(e,t,n){for(var s=n!=null&&n.ISOWeek?k8e(t):vye(t,n),a=n!=null&&n.ISOWeek?Iy(e):Sm(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 Qkt(e,t){var n=F4e(Rh(e),nae(e),t);if(t!=null&&t.useFixedWeeks){var s=hmt(e,t);if(s<6){var a=n[n.length-1],o=a.dates[a.dates.length-1],l=oj(o,6-s),i=F4e(oj(o,1),l,t);n.push.apply(n,i)}}return n}function Jkt(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=Qkt(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:fkt,M=(n=x==null?void 0:x.Row)!==null&&n!==void 0?n:Xkt,I=(s=x==null?void 0:x.Footer)!==null&&s!==void 0?s:ukt;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 eNt(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var tNt=eNt()?A.useLayoutEffect:A.useEffect,Mde=!1,rNt=0;function z4e(){return"react-day-picker-".concat(++rNt)}function nNt(e){var t,n=e??(Mde?z4e():null),s=A.useState(n),a=s[0],o=s[1];return tNt(function(){a===null&&o(z4e())},[]),A.useEffect(function(){Mde===!1&&(Mde=!0)},[]),(t=e??a)!==null&&t!==void 0?t:void 0}function sNt(e){var t,n,s=cl(),a=s.dir,o=s.classNames,l=s.styles,i=s.components,u=vP().displayMonths,m=nNt(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=$a($a({},v),l.caption_start)),N&&(y.push(o.caption_end),v=$a($a({},v),l.caption_end)),k&&(y.push(o.caption_between),v=$a($a({},v),l.caption_between));var M=(n=i==null?void 0:i.Caption)!==null&&n!==void 0?n:dkt;return r.jsxs("div",{className:y.join(" "),style:v,children:[r.jsx(M,{id:m,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),r.jsx(Jkt,{id:x,"aria-labelledby":m,displayMonth:e.displayMonth})]},e.displayIndex)}function aNt(e){var t=cl(),n=t.classNames,s=t.styles;return r.jsx("div",{className:n.months,style:s.months,children:e.children})}function iNt(e){var t,n,s=e.initialProps,a=cl(),o=P0e(),l=vP(),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=$a($a({},a.styles.root),a.style),v=Object.keys(s).filter(function(N){return N.startsWith("data-")}).reduce(function(N,k){var M;return $a($a({},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:aNt;return r.jsx("div",$a({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(sNt,{displayIndex:k,displayMonth:N},k)})})}))}function oNt(e){var t=e.children,n=Ejt(e,["children"]);return r.jsx(Yjt,{initialProps:n,children:r.jsx(ikt,{children:r.jsx($kt,{initialProps:n,children:r.jsx(gkt,{initialProps:n,children:r.jsx(vkt,{initialProps:n,children:r.jsx(Ckt,{children:r.jsx(zkt,{children:t})})})})})})})}function lNt(e){return r.jsx(oNt,$a({},e,{children:r.jsx(iNt,{initialProps:e})}))}function Lp({className:e,classNames:t,showOutsideDays:n=!0,...s}){return r.jsx(lNt,{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(PE({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(PE({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 Pae="Popover",[w9e]=cc(Pae,[ax]),_P=ax(),[cNt,Iv]=w9e(Pae),j9e=e=>{const{__scopePopover:t,children:n,open:s,defaultOpen:a,onOpenChange:o,modal:l=!1}=e,i=_P(t),u=A.useRef(null),[m,x]=A.useState(!1),[y,v]=sh({prop:s,defaultProp:a??!1,onChange:o,caller:Pae});return r.jsx(XI,{...i,children:r.jsx(cNt,{scope:t,contentId:gd(),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})})};j9e.displayName=Pae;var k9e="PopoverAnchor",dNt=A.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,a=Iv(k9e,n),o=_P(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:i}=a;return A.useEffect(()=>(l(),()=>i()),[l,i]),r.jsx(w3,{...o,...s,ref:t})});dNt.displayName=k9e;var N9e="PopoverTrigger",S9e=A.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,a=Iv(N9e,n),o=_P(n),l=ca(t,a.triggerRef),i=r.jsx(Bn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":E9e(a.open),...s,ref:l,onClick:xn(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?i:r.jsx(w3,{asChild:!0,...o,children:i})});S9e.displayName=N9e;var O0e="PopoverPortal",[uNt,hNt]=w9e(O0e,{forceMount:void 0}),C9e=e=>{const{__scopePopover:t,forceMount:n,children:s,container:a}=e,o=Iv(O0e,t);return r.jsx(uNt,{scope:t,forceMount:n,children:r.jsx(Ac,{present:n||o.open,children:r.jsx(x3,{asChild:!0,container:a,children:s})})})};C9e.displayName=O0e;var qC="PopoverContent",M9e=A.forwardRef((e,t)=>{const n=hNt(qC,e.__scopePopover),{forceMount:s=n.forceMount,...a}=e,o=Iv(qC,e.__scopePopover);return r.jsx(Ac,{present:s||o.open,children:o.modal?r.jsx(fNt,{...a,ref:t}):r.jsx(pNt,{...a,ref:t})})});M9e.displayName=qC;var mNt=uv("PopoverContent.RemoveScroll"),fNt=A.forwardRef((e,t)=>{const n=Iv(qC,e.__scopePopover),s=A.useRef(null),a=ca(t,s),o=A.useRef(!1);return A.useEffect(()=>{const l=s.current;if(l)return Tse(l)},[]),r.jsx(sP,{as:mNt,allowPinchZoom:!0,children:r.jsx(T9e,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:xn(e.onCloseAutoFocus,l=>{var i;l.preventDefault(),o.current||(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:xn(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:xn(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),pNt=A.forwardRef((e,t)=>{const n=Iv(qC,e.__scopePopover),s=A.useRef(!1),a=A.useRef(!1);return r.jsx(T9e,{...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()}})}),T9e=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(qC,n),b=_P(n);return Mse(),r.jsx(rP,{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(QI,{"data-state":E9e(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)"}})})})}),A9e="PopoverClose",gNt=A.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,a=Iv(A9e,n);return r.jsx(Bn.button,{type:"button",...s,ref:t,onClick:xn(e.onClick,()=>a.onOpenChange(!1))})});gNt.displayName=A9e;var xNt="PopoverArrow",yNt=A.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,a=_P(n);return r.jsx(JI,{...a,...s,ref:t})});yNt.displayName=xNt;function E9e(e){return e?"open":"closed"}var vNt=j9e,_Nt=S9e,bNt=C9e,I9e=M9e;const Wc=vNt,Gc=_Nt,Tc=A.forwardRef(({className:e,align:t="center",sideOffset:n=4,...s},a)=>r.jsx(bNt,{children:r.jsx(I9e,{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=I9e.displayName;const wNt=y3("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(wNt({variant:t}),e),...n}));D0e.displayName="Alert";const jNt=A.forwardRef(({className:e,...t},n)=>r.jsx("h5",{ref:n,className:Ut("mb-1 font-medium leading-none tracking-tight",e),...t}));jNt.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 kNt({open:e,onOpenChange:t,imageUrl:n,imageId:s,defaultCaption:a="",swagItemId:o,reelId:l}){const i=qr(),[u,m]=A.useState(a),[x,y]=A.useState([]),[v,b]=A.useState(null),[N,k]=A.useState("now"),[M,I]=A.useState(SNe(PNe(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=SNe(PNe(new Date),1);I(ve);const et=ve.getHours();P(String(et>12?et-12:et===0?12:et)),D("00"),V(et>=12?"PM":"AM")}},[e,a]);const W=()=>{if(!M)return null;let ve=parseInt(T);const et=parseInt(F);return U==="PM"&&ve!==12&&(ve+=12),U==="AM"&&ve===12&&(ve=0),P8e(I8e(M,ve),et)},{data:G,isLoading:Q}=Zt({queryKey:["social-accounts-for-post"],queryFn:async()=>{const{data:{user:ve}}=await Y.auth.getUser();if(!ve)return[];const{data:et,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:",et),et},enabled:e,staleTime:0}),ae=ar({mutationFn:async({accountId:ve,platform:et})=>{b(ve);const{data:Me,error:Ie}=await Y.functions.invoke("social-post",{body:{platform:et,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 et=ve.platform==="facebook"?"Facebook":ve.platform==="instagram"?"Instagram":ve.platform==="linkedin"?"LinkedIn":"Google Business";Ae.success(`Posted to ${et}!`)},onError:ve=>{Ae.error(`Failed to post: ${ve.message}`)},onSettled:()=>{b(null)}}),oe=ar({mutationFn:async({accountId:ve,platform:et,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:et,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:et}},onSuccess:ve=>{const et=ve.platform==="facebook"?"Facebook":ve.platform==="instagram"?"Instagram":"LinkedIn";Ae.success(`Post scheduled for ${et}!`)},onError:ve=>{Ae.error(`Failed to schedule: ${ve.message}`)}}),de=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 et of x){const Me=G==null?void 0:G.find(Ie=>Ie.id===et);Me&&await oe.mutateAsync({accountId:et,platform:Me.platform,scheduledFor:ve})}i.invalidateQueries({queryKey:["scheduled-posts"]}),Ae.success(`${x.length} post(s) scheduled for ${ln(ve,"PPp")}`)}else for(const ve of x){const et=G==null?void 0:G.find(Me=>Me.id===ve);et&&await ae.mutateAsync({accountId:ve,platform:et.platform})}i.invalidateQueries({queryKey:["scheduled-posts"]}),m(""),y([]),t(!1)},se=ve=>{y(et=>et.includes(ve)?et.filter(Me=>Me!==ve):[...et,ve])},pe=(G==null?void 0:G.filter(ve=>ve.platform==="facebook"))||[],ne=(G==null?void 0:G.filter(ve=>ve.platform==="instagram"))||[],me=(G==null?void 0:G.filter(ve=>ve.platform==="linkedin"))||[],he=(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,be=Array.from({length:12},(ve,et)=>String(et+1)),we=["00","15","30","45"];return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Lr,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Create Social Post"}),r.jsx(Qn,{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(Xn,{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(Qa,{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(X,{variant:"outline",className:Ut("justify-start text-left font-normal flex-1",!M&&"text-muted-foreground"),children:[r.jsx(Ts,{className:"mr-2 h-4 w-4"}),M?ln(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(hn,{value:F,onValueChange:D,children:[r.jsx(cn,{className:"w-[70px]",children:r.jsx(fn,{})}),r.jsx(dn,{children:we.map(ve=>r.jsx($t,{value:ve,children:ve},ve))})]}),r.jsxs(hn,{value:U,onValueChange:ve=>V(ve),children:[r.jsx(cn,{className:"w-[70px]",children:r.jsx(fn,{})}),r.jsxs(dn,{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 ",ln(W()||new Date,"PPP 'at' p")]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(ze,{children:"Post to"}),Q&&r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(Wr,{className:"h-6 w-6 animate-spin"})}),!Q&&!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(Bd,{className:"h-3.5 w-3.5"}),"Connect your Facebook, Instagram & LinkedIn"]})]})]}),pe.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"]}),pe.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:()=>se(ve.id),disabled:v===ve.id}),r.jsxs(ea,{className:"h-8 w-8",children:[r.jsx(Ti,{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(Wr,{className:"h-4 w-4 animate-spin"})]},ve.id))]}),ne.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"]}),ne.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:()=>se(ve.id),disabled:v===ve.id}),r.jsxs(ea,{className:"h-8 w-8",children:[r.jsx(Ti,{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(Wr,{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(ym,{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:()=>se(ve.id),disabled:v===ve.id}),r.jsxs(ea,{className:"h-8 w-8",children:[r.jsx(Ti,{src:ve.profile_picture_url||""}),r.jsx(ta,{children:r.jsx(ym,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:ve.platform_username}),v===ve.id&&r.jsx(Wr,{className:"h-4 w-4 animate-spin"})]},ve.id))]}),he.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(Fo,{className:"h-4 w-4 text-red-600"})," Google Business"]}),he.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:()=>se(ve.id),disabled:v===ve.id}),r.jsxs(ea,{className:"h-8 w-8",children:[r.jsx(Ti,{src:ve.profile_picture_url||""}),r.jsx(ta,{children:r.jsx(Fo,{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(Wr,{className:"h-4 w-4 animate-spin"})]},ve.id))]})]})]}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsxs(X,{onClick:de,disabled:x.length===0||Te,className:"gap-2",children:[Te?r.jsx(Wr,{className:"h-4 w-4 animate-spin"}):N==="schedule"?r.jsx(Ts,{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 NNt(){const e=qr(),[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:he,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 he}}),P=I.filter(he=>{if(s!=="all"&&he.status!==s)return!1;if(t&&he.scheduled_for){const xe=new Date(he.scheduled_for);if(!ac(xe,t))return!1}return!0}),F=I.filter(he=>he.scheduled_for).map(he=>Cm(new Date(he.scheduled_for))),D=ar({mutationFn:async he=>{const{error:xe}=await Y.from("scheduled_posts").update({caption:he.caption,scheduled_for:he.scheduled_for}).eq("id",he.id);if(xe)throw xe},onSuccess:()=>{Ae.success("Post updated!"),e.invalidateQueries({queryKey:["scheduled-posts"]}),l(null)},onError:he=>{Ae.error(`Failed to update: ${he.message}`)}}),U=ar({mutationFn:async he=>{const{error:xe}=await Y.from("scheduled_posts").update({status:"cancelled"}).eq("id",he);if(xe)throw xe},onSuccess:()=>{Ae.success("Post cancelled"),e.invalidateQueries({queryKey:["scheduled-posts"]})},onError:he=>{Ae.error(`Failed to cancel: ${he.message}`)}}),V=ar({mutationFn:async he=>{const{error:xe}=await Y.from("scheduled_posts").delete().eq("id",he);if(xe)throw xe},onSuccess:()=>{Ae.success("Post deleted"),e.invalidateQueries({queryKey:["scheduled-posts"]})},onError:he=>{Ae.error(`Failed to delete: ${he.message}`)}}),W=ar({mutationFn:async he=>{const{data:xe,error:Te}=await Y.functions.invoke("social-post",{body:{platform:he.platform,accountId:he.social_account_id,imageUrl:he.image_url,caption:he.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",he.id),xe},onSuccess:he=>{const xe=he.platform==="facebook"?"Facebook":he.platform==="instagram"?"Instagram":"LinkedIn";Ae.success(`Posted to ${xe}!`),e.invalidateQueries({queryKey:["scheduled-posts"]})},onError:he=>{Ae.error(`Failed to post: ${he.message}`)}}),G=he=>{if(l(he),u(he.caption||""),he.scheduled_for){const xe=new Date(he.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")}},Q=()=>{if(!o||!m)return;let he=parseInt(y);const xe=parseInt(b);k==="PM"&&he!==12&&(he+=12),k==="AM"&&he===12&&(he=0);const Te=P8e(I8e(m,he),xe);D.mutate({id:o.id,caption:i,scheduled_for:Te.toISOString()})},ae=he=>{switch(he){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(ym,{className:"h-4 w-4 text-blue-700"});default:return null}},oe=he=>{switch(he){case"scheduled":return r.jsxs(Tt,{variant:"secondary",className:"gap-1",children:[r.jsx(Qa,{className:"h-3 w-3"}),"Scheduled"]});case"posted":return r.jsxs(Tt,{variant:"default",className:"gap-1 bg-green-600",children:[r.jsx(li,{className:"h-3 w-3"}),"Posted"]});case"failed":return r.jsxs(Tt,{variant:"destructive",className:"gap-1",children:[r.jsx(bc,{className:"h-3 w-3"}),"Failed"]});case"cancelled":return r.jsxs(Tt,{variant:"outline",className:"gap-1 text-muted-foreground",children:[r.jsx(yl,{className:"h-3 w-3"}),"Cancelled"]});default:return r.jsx(Tt,{variant:"outline",children:he})}},de=Array.from({length:12},(he,xe)=>String(xe+1)),se=["00","15","30","45"],pe=I.filter(he=>he.status==="scheduled").length,ne=I.filter(he=>he.status==="posted").length,me=I.filter(he=>he.status==="scheduled"&&he.scheduled_for&&mmt(new Date(he.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:pe}),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:ne}),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(X,{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(W1,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:["all","scheduled","posted","failed","cancelled"].map(he=>r.jsx(X,{variant:s===he?"default":"outline",size:"sm",onClick:()=>a(he),className:"capitalize",children:he},he))})]}),T&&r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(Wr,{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(Ts,{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 ${ln(t,"PPP")}`:"Schedule a post from Social Swag to get started!"})]}),r.jsx("div",{className:"space-y-4",children:P.map(he=>{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:he.image_url,alt:"Post preview",className:"w-full h-full object-cover"})}),r.jsxs(Je,{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(he.platform),r.jsx("span",{className:"font-medium",children:((xe=he.social_accounts)==null?void 0:xe.page_name)||((Te=he.social_accounts)==null?void 0:Te.platform_username)||"Unknown"}),oe(he.status)]}),r.jsxs("div",{className:"flex items-center gap-1",children:[he.status==="scheduled"&&r.jsxs(eP,{children:[r.jsxs(Wg,{children:[r.jsx(Gg,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>G(he),children:r.jsx(Ja,{className:"h-4 w-4"})})}),r.jsx(Pp,{children:"Edit post"})]}),r.jsxs(Wg,{children:[r.jsx(Gg,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>W.mutate(he),disabled:W.isPending,children:W.isPending?r.jsx(Wr,{className:"h-4 w-4 animate-spin"}):r.jsx(Ji,{className:"h-4 w-4"})})}),r.jsx(Pp,{children:"Post now"})]}),r.jsxs(Ld,{children:[r.jsx(kp,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive",children:r.jsx(Un,{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(he.id),className:"bg-amber-600 hover:bg-amber-700",children:"Cancel Post"}),r.jsx(Uc,{onClick:()=>V.mutate(he.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]}),(he.status==="posted"||he.status==="cancelled"||he.status==="failed")&&r.jsxs(Ld,{children:[r.jsx(kp,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive",children:r.jsx(Un,{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(he.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]})]}),he.caption&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-2",children:he.caption}),r.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(Qa,{className:"h-3 w-3"}),he.status==="posted"&&he.posted_at?`Posted ${ln(new Date(he.posted_at),"PPp")}`:he.scheduled_for?`Scheduled for ${ln(new Date(he.scheduled_for),"PPp")}`:"Not scheduled"]}),he.status==="failed"&&he.error_message&&r.jsxs("p",{className:"text-xs text-destructive mt-2",children:["Error: ",he.error_message]})]})]})},he.id)})})]})]}),r.jsx(Or,{open:!!o,onOpenChange:he=>!he&&l(null),children:r.jsxs(Lr,{className:"max-w-lg",children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Edit Scheduled Post"}),r.jsx(Qn,{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(Xn,{value:i,onChange:he=>u(he.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(X,{variant:"outline",className:Ut("justify-start text-left font-normal flex-1",!m&&"text-muted-foreground"),children:[r.jsx(Ts,{className:"mr-2 h-4 w-4"}),m?ln(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:he=>her.jsx($t,{value:he,children:he},he))})]}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsxs(hn,{value:b,onValueChange:N,children:[r.jsx(cn,{className:"w-[70px]",children:r.jsx(fn,{})}),r.jsx(dn,{children:se.map(he=>r.jsx($t,{value:he,children:he},he))})]}),r.jsxs(hn,{value:k,onValueChange:he=>M(he),children:[r.jsx(cn,{className:"w-[70px]",children:r.jsx(fn,{})}),r.jsxs(dn,{children:[r.jsx($t,{value:"AM",children:"AM"}),r.jsx($t,{value:"PM",children:"PM"})]})]})]})]})]})]}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>l(null),children:"Cancel"}),r.jsxs(X,{onClick:Q,disabled:D.isPending,children:[D.isPending?r.jsx(Wr,{className:"h-4 w-4 animate-spin mr-2"}):null,"Save Changes"]})]})]})})]})}function NO(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 P9e={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 NO=="function"&&NO;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 NO=="function"&&NO,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)),Q=D.comment,ae=i.transformTo("string",T(Q)),oe=i.transformTo("string",m.utf8encode(Q)),de=G.length!==D.name.length,se=oe.length!==Q.length,pe="",ne="",me="",he=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 be=0;N&&(be|=8),V||!de&&!se||(be|=2048);var we=0,ve=0;he&&(we|=16),I==="UNIX"?(ve=798,we|=function(Me,Ie){var $e=Me;return Me||($e=Ie?16893:33204),(65535&$e)<<16}(D.unixPermissions,he)):(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(),de&&(ne=o(1,1)+o(x(W),4)+G,pe+="up"+o(ne.length,2)+ne),se&&(me=o(1,1)+o(x(ae),4)+oe,pe+="uc"+o(me.length,2)+me);var et="";return et+=` \0`,et+=o(be,2),et+=U.magic,et+=o(P,2),et+=o(F,2),et+=o(Te.crc32,4),et+=o(Te.compressedSize,4),et+=o(Te.uncompressedSize,4),et+=o(W.length,2),et+=o(pe.length,2),{fileRecord:y.LOCAL_FILE_HEADER+et+W+pe,dirRecord:y.CENTRAL_FILE_HEADER+o(ve,2)+et+o(ae.length,2)+"\0\0\0\0"+o(we,4)+o(M,4)+W+pe+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,Q=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,Q=258,ae=Q+G+1,oe=42,de=113,se=1,pe=2,ne=3,me=4;function he(le,qe){return le.msg=x[qe],qe}function xe(le){return(le<<1)-(4le.avail_out&&(Qe=le.avail_out),Qe!==0&&(l.arraySet(le.output,qe.pending_buf,qe.pending_out,Qe,le.next_out),le.next_out+=Qe,qe.pending_out+=Qe,le.total_out+=Qe,le.avail_out-=Qe,qe.pending-=Qe,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,be(le.strm)}function ve(le,qe){le.pending_buf[le.pending++]=qe}function et(le,qe){le.pending_buf[le.pending++]=qe>>>8&255,le.pending_buf[le.pending++]=255&qe}function Me(le,qe){var Qe,rt,je=le.max_chain_length,ut=le.strstart,Ce=le.prev_length,Ee=le.nice_match,Ye=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+Q,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[(Qe=qe)+Ce]===zt&&Le[Qe+Ce-1]===it&&Le[Qe]===Le[ut]&&Le[++Qe]===Le[ut+1]){ut+=2,Qe++;do;while(Le[++ut]===Le[++Qe]&&Le[++ut]===Le[++Qe]&&Le[++ut]===Le[++Qe]&&Le[++ut]===Le[++Qe]&&Le[++ut]===Le[++Qe]&&Le[++ut]===Le[++Qe]&&Le[++ut]===Le[++Qe]&&Le[++ut]===Le[++Qe]&&utYe&&--je!=0);return Ce<=le.lookahead?Ce:le.lookahead}function Ie(le){var qe,Qe,rt,je,ut,Ce,Ee,Ye,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=Qe=le.hash_size;rt=le.head[--qe],le.head[qe]=tt<=rt?rt-tt:0,--Qe;);for(qe=Qe=tt;rt=le.prev[--qe],le.prev[qe]=tt<=rt?rt-tt:0,--Qe;);je+=tt}if(le.strm.avail_in===0)break;if(Ce=le.strm,Ee=le.window,Ye=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(rt=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,rt=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&&(Qe=le.pending_buf_size-5);;){if(le.lookahead<=1){if(Ie(le),le.lookahead===0&&qe===y)return se;if(le.lookahead===0)break}le.strstart+=le.lookahead,le.lookahead=0;var rt=le.block_start+Qe;if((le.strstart===0||le.strstart>=rt)&&(le.lookahead=le.strstart-rt,le.strstart=rt,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 se}return le.insert=0,qe===v?(we(le,!0),le.strm.avail_out===0?ne:me):(le.strstart>le.block_start&&(we(le,!1),le.strm.avail_out),se)}),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=At,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 Qe,rt,je,ut;if(!le||!le.state||5>8&255),ve(rt,rt.gzhead.time>>16&255),ve(rt,rt.gzhead.time>>24&255),ve(rt,rt.level===9?2:2<=rt.strategy||rt.level<2?4:0),ve(rt,255&rt.gzhead.os),rt.gzhead.extra&&rt.gzhead.extra.length&&(ve(rt,255&rt.gzhead.extra.length),ve(rt,rt.gzhead.extra.length>>8&255)),rt.gzhead.hcrc&&(le.adler=m(le.adler,rt.pending_buf,rt.pending,0)),rt.gzindex=0,rt.status=69):(ve(rt,0),ve(rt,0),ve(rt,0),ve(rt,0),ve(rt,0),ve(rt,rt.level===9?2:2<=rt.strategy||rt.level<2?4:0),ve(rt,3),rt.status=de);else{var Ce=T+(rt.w_bits-8<<4)<<8;Ce|=(2<=rt.strategy||rt.level<2?0:rt.level<6?1:rt.level===6?2:3)<<6,rt.strstart!==0&&(Ce|=32),Ce+=31-Ce%31,rt.status=de,et(rt,Ce),rt.strstart!==0&&(et(rt,le.adler>>>16),et(rt,65535&le.adler)),le.adler=1}if(rt.status===69)if(rt.gzhead.extra){for(je=rt.pending;rt.gzindex<(65535&rt.gzhead.extra.length)&&(rt.pending!==rt.pending_buf_size||(rt.gzhead.hcrc&&rt.pending>je&&(le.adler=m(le.adler,rt.pending_buf,rt.pending-je,je)),be(le),je=rt.pending,rt.pending!==rt.pending_buf_size));)ve(rt,255&rt.gzhead.extra[rt.gzindex]),rt.gzindex++;rt.gzhead.hcrc&&rt.pending>je&&(le.adler=m(le.adler,rt.pending_buf,rt.pending-je,je)),rt.gzindex===rt.gzhead.extra.length&&(rt.gzindex=0,rt.status=73)}else rt.status=73;if(rt.status===73)if(rt.gzhead.name){je=rt.pending;do{if(rt.pending===rt.pending_buf_size&&(rt.gzhead.hcrc&&rt.pending>je&&(le.adler=m(le.adler,rt.pending_buf,rt.pending-je,je)),be(le),je=rt.pending,rt.pending===rt.pending_buf_size)){ut=1;break}ut=rt.gzindexje&&(le.adler=m(le.adler,rt.pending_buf,rt.pending-je,je)),ut===0&&(rt.gzindex=0,rt.status=91)}else rt.status=91;if(rt.status===91)if(rt.gzhead.comment){je=rt.pending;do{if(rt.pending===rt.pending_buf_size&&(rt.gzhead.hcrc&&rt.pending>je&&(le.adler=m(le.adler,rt.pending_buf,rt.pending-je,je)),be(le),je=rt.pending,rt.pending===rt.pending_buf_size)){ut=1;break}ut=rt.gzindexje&&(le.adler=m(le.adler,rt.pending_buf,rt.pending-je,je)),ut===0&&(rt.status=103)}else rt.status=103;if(rt.status===103&&(rt.gzhead.hcrc?(rt.pending+2>rt.pending_buf_size&&be(le),rt.pending+2<=rt.pending_buf_size&&(ve(rt,255&le.adler),ve(rt,le.adler>>8&255),le.adler=0,rt.status=de)):rt.status=de),rt.pending!==0){if(be(le),le.avail_out===0)return rt.last_flush=-1,b}else if(le.avail_in===0&&xe(qe)<=xe(Qe)&&qe!==v)return he(le,-5);if(rt.status===666&&le.avail_in!==0)return he(le,-5);if(le.avail_in!==0||rt.lookahead!==0||qe!==y&&rt.status!==666){var Ee=rt.strategy===2?function(Ye,Le){for(var Ke;;){if(Ye.lookahead===0&&(Ie(Ye),Ye.lookahead===0)){if(Le===y)return se;break}if(Ye.match_length=0,Ke=i._tr_tally(Ye,0,Ye.window[Ye.strstart]),Ye.lookahead--,Ye.strstart++,Ke&&(we(Ye,!1),Ye.strm.avail_out===0))return se}return Ye.insert=0,Le===v?(we(Ye,!0),Ye.strm.avail_out===0?ne:me):Ye.last_lit&&(we(Ye,!1),Ye.strm.avail_out===0)?se:pe}(rt,qe):rt.strategy===3?function(Ye,Le){for(var Ke,tt,ct,it,zt=Ye.window;;){if(Ye.lookahead<=Q){if(Ie(Ye),Ye.lookahead<=Q&&Le===y)return se;if(Ye.lookahead===0)break}if(Ye.match_length=0,Ye.lookahead>=G&&0Ye.lookahead&&(Ye.match_length=Ye.lookahead)}if(Ye.match_length>=G?(Ke=i._tr_tally(Ye,1,Ye.match_length-G),Ye.lookahead-=Ye.match_length,Ye.strstart+=Ye.match_length,Ye.match_length=0):(Ke=i._tr_tally(Ye,0,Ye.window[Ye.strstart]),Ye.lookahead--,Ye.strstart++),Ke&&(we(Ye,!1),Ye.strm.avail_out===0))return se}return Ye.insert=0,Le===v?(we(Ye,!0),Ye.strm.avail_out===0?ne:me):Ye.last_lit&&(we(Ye,!1),Ye.strm.avail_out===0)?se:pe}(rt,qe):o[rt.level].func(rt,qe);if(Ee!==ne&&Ee!==me||(rt.status=666),Ee===se||Ee===ne)return le.avail_out===0&&(rt.last_flush=-1),b;if(Ee===pe&&(qe===1?i._tr_align(rt):qe!==5&&(i._tr_stored_block(rt,0,0,!1),qe===3&&(Te(rt.head),rt.lookahead===0&&(rt.strstart=0,rt.block_start=0,rt.insert=0))),be(le),le.avail_out===0))return rt.last_flush=-1,b}return qe!==v?b:rt.wrap<=0?1:(rt.wrap===2?(ve(rt,255&le.adler),ve(rt,le.adler>>8&255),ve(rt,le.adler>>16&255),ve(rt,le.adler>>24&255),ve(rt,255&le.total_in),ve(rt,le.total_in>>8&255),ve(rt,le.total_in>>16&255),ve(rt,le.total_in>>24&255)):(et(rt,le.adler>>>16),et(rt,65535&le.adler)),be(le),0=Qe.w_size&&(ut===0&&(Te(Qe.head),Qe.strstart=0,Qe.block_start=0,Qe.insert=0),Le=new l.Buf8(Qe.w_size),l.arraySet(Le,qe,Ke-Qe.w_size,Qe.w_size,0),qe=Le,Ke=Qe.w_size),Ce=le.avail_in,Ee=le.next_in,Ye=le.input,le.avail_in=Ke,le.next_in=0,le.input=qe,Ie(Qe);Qe.lookahead>=G;){for(rt=Qe.strstart,je=Qe.lookahead-(G-1);Qe.ins_h=(Qe.ins_h<>>=G=W>>>24,P-=G,(G=W>>>16&255)===0)pe[x++]=65535&W;else{if(!(16&G)){if(!(64&G)){W=F[(65535&W)+(T&(1<>>=G,P-=G),P<15&&(T+=se[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-=Q<<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 de;return oe&&oe.state?(de=oe.state,oe.total_in=oe.total_out=de.total=0,oe.msg="",de.wrap&&(oe.adler=1&de.wrap),de.mode=N,de.last=0,de.havedict=0,de.dmax=32768,de.head=null,de.hold=0,de.bits=0,de.lencode=de.lendyn=new o.Buf32(k),de.distcode=de.distdyn=new o.Buf32(M),de.sane=1,de.back=-1,v):b}function F(oe){var de;return oe&&oe.state?((de=oe.state).wsize=0,de.whave=0,de.wnext=0,P(oe)):b}function D(oe,de){var se,pe;return oe&&oe.state?(pe=oe.state,de<0?(se=0,de=-de):(se=1+(de>>4),de<48&&(de&=15)),de&&(de<8||15=me.wsize?(o.arraySet(me.window,de,se-me.wsize,me.wsize,0),me.wnext=0,me.whave=me.wsize):(pe<(ne=me.wsize-me.wnext)&&(ne=pe),o.arraySet(me.window,de,se-pe,ne,me.wnext),(pe-=ne)?(o.arraySet(me.window,de,se-pe,pe,0),me.wnext=pe,me.whave=me.wsize):(me.wnext+=ne,me.wnext===me.wsize&&(me.wnext=0),me.whave>>8&255,se.check=i(se.check,ut,2,0),we=be=0,se.mode=2;break}if(se.flags=0,se.head&&(se.head.done=!1),!(1&se.wrap)||(((255&be)<<8)+(be>>8))%31){oe.msg="incorrect header check",se.mode=30;break}if((15&be)!=8){oe.msg="unknown compression method",se.mode=30;break}if(we-=4,le=8+(15&(be>>>=4)),se.wbits===0)se.wbits=le;else if(le>se.wbits){oe.msg="invalid window size",se.mode=30;break}se.dmax=1<>8&1),512&se.flags&&(ut[0]=255&be,ut[1]=be>>>8&255,se.check=i(se.check,ut,2,0)),we=be=0,se.mode=3;case 3:for(;we<32;){if(xe===0)break e;xe--,be+=pe[me++]<>>8&255,ut[2]=be>>>16&255,ut[3]=be>>>24&255,se.check=i(se.check,ut,4,0)),we=be=0,se.mode=4;case 4:for(;we<16;){if(xe===0)break e;xe--,be+=pe[me++]<>8),512&se.flags&&(ut[0]=255&be,ut[1]=be>>>8&255,se.check=i(se.check,ut,2,0)),we=be=0,se.mode=5;case 5:if(1024&se.flags){for(;we<16;){if(xe===0)break e;xe--,be+=pe[me++]<>>8&255,se.check=i(se.check,ut,2,0)),we=be=0}else se.head&&(se.head.extra=null);se.mode=6;case 6:if(1024&se.flags&&(xe<(Me=se.length)&&(Me=xe),Me&&(se.head&&(le=se.head.extra_len-se.length,se.head.extra||(se.head.extra=new Array(se.head.extra_len)),o.arraySet(se.head.extra,pe,me,Me,le)),512&se.flags&&(se.check=i(se.check,pe,Me,me)),xe-=Me,me+=Me,se.length-=Me),se.length))break e;se.length=0,se.mode=7;case 7:if(2048&se.flags){if(xe===0)break e;for(Me=0;le=pe[me+Me++],se.head&&le&&se.length<65536&&(se.head.name+=String.fromCharCode(le)),le&&Me>9&1,se.head.done=!0),oe.adler=se.check=0,se.mode=12;break;case 10:for(;we<32;){if(xe===0)break e;xe--,be+=pe[me++]<>>=7&we,we-=7&we,se.mode=27;break}for(;we<3;){if(xe===0)break e;xe--,be+=pe[me++]<>>=1)){case 0:se.mode=14;break;case 1:if(Q(se),se.mode=20,de!==6)break;be>>>=2,we-=2;break e;case 2:se.mode=17;break;case 3:oe.msg="invalid block type",se.mode=30}be>>>=2,we-=2;break;case 14:for(be>>>=7&we,we-=7&we;we<32;){if(xe===0)break e;xe--,be+=pe[me++]<>>16^65535)){oe.msg="invalid stored block lengths",se.mode=30;break}if(se.length=65535&be,we=be=0,se.mode=15,de===6)break e;case 15:se.mode=16;case 16:if(Me=se.length){if(xe>>=5,we-=5,se.ndist=1+(31&be),be>>>=5,we-=5,se.ncode=4+(15&be),be>>>=4,we-=4,286>>=3,we-=3}for(;se.have<19;)se.lens[Ce[se.have++]]=0;if(se.lencode=se.lendyn,se.lenbits=7,Qe={bits:se.lenbits},qe=m(0,se.lens,0,19,se.lencode,0,se.work,Qe),se.lenbits=Qe.bits,qe){oe.msg="invalid code lengths set",se.mode=30;break}se.have=0,se.mode=19;case 19:for(;se.have>>16&255,ot=65535&je,!((Be=je>>>24)<=we);){if(xe===0)break e;xe--,be+=pe[me++]<>>=Be,we-=Be,se.lens[se.have++]=ot;else{if(ot===16){for(rt=Be+2;we>>=Be,we-=Be,se.have===0){oe.msg="invalid bit length repeat",se.mode=30;break}le=se.lens[se.have-1],Me=3+(3&be),be>>>=2,we-=2}else if(ot===17){for(rt=Be+3;we>>=Be)),be>>>=3,we-=3}else{for(rt=Be+7;we>>=Be)),be>>>=7,we-=7}if(se.have+Me>se.nlen+se.ndist){oe.msg="invalid bit length repeat",se.mode=30;break}for(;Me--;)se.lens[se.have++]=le}}if(se.mode===30)break;if(se.lens[256]===0){oe.msg="invalid code -- missing end-of-block",se.mode=30;break}if(se.lenbits=9,Qe={bits:se.lenbits},qe=m(x,se.lens,0,se.nlen,se.lencode,0,se.work,Qe),se.lenbits=Qe.bits,qe){oe.msg="invalid literal/lengths set",se.mode=30;break}if(se.distbits=6,se.distcode=se.distdyn,Qe={bits:se.distbits},qe=m(y,se.lens,se.nlen,se.ndist,se.distcode,0,se.work,Qe),se.distbits=Qe.bits,qe){oe.msg="invalid distances set",se.mode=30;break}if(se.mode=20,de===6)break e;case 20:se.mode=21;case 21:if(6<=xe&&258<=Te){oe.next_out=he,oe.avail_out=Te,oe.next_in=me,oe.avail_in=xe,se.hold=be,se.bits=we,u(oe,et),he=oe.next_out,ne=oe.output,Te=oe.avail_out,me=oe.next_in,pe=oe.input,xe=oe.avail_in,be=se.hold,we=se.bits,se.mode===12&&(se.back=-1);break}for(se.back=0;Ve=(je=se.lencode[be&(1<>>16&255,ot=65535&je,!((Be=je>>>24)<=we);){if(xe===0)break e;xe--,be+=pe[me++]<>At)])>>>16&255,ot=65535&je,!(At+(Be=je>>>24)<=we);){if(xe===0)break e;xe--,be+=pe[me++]<>>=At,we-=At,se.back+=At}if(be>>>=Be,we-=Be,se.back+=Be,se.length=ot,Ve===0){se.mode=26;break}if(32&Ve){se.back=-1,se.mode=12;break}if(64&Ve){oe.msg="invalid literal/length code",se.mode=30;break}se.extra=15&Ve,se.mode=22;case 22:if(se.extra){for(rt=se.extra;we>>=se.extra,we-=se.extra,se.back+=se.extra}se.was=se.length,se.mode=23;case 23:for(;Ve=(je=se.distcode[be&(1<>>16&255,ot=65535&je,!((Be=je>>>24)<=we);){if(xe===0)break e;xe--,be+=pe[me++]<>At)])>>>16&255,ot=65535&je,!(At+(Be=je>>>24)<=we);){if(xe===0)break e;xe--,be+=pe[me++]<>>=At,we-=At,se.back+=At}if(be>>>=Be,we-=Be,se.back+=Be,64&Ve){oe.msg="invalid distance code",se.mode=30;break}se.offset=ot,se.extra=15&Ve,se.mode=24;case 24:if(se.extra){for(rt=se.extra;we>>=se.extra,we-=se.extra,se.back+=se.extra}if(se.offset>se.dmax){oe.msg="invalid distance too far back",se.mode=30;break}se.mode=25;case 25:if(Te===0)break e;if(Me=et-Te,se.offset>Me){if((Me=se.offset-Me)>se.whave&&se.sane){oe.msg="invalid distance too far back",se.mode=30;break}Ie=Me>se.wnext?(Me-=se.wnext,se.wsize-Me):se.wnext-Me,Me>se.length&&(Me=se.length),$e=se.window}else $e=ne,Ie=he-se.offset,Me=se.length;for(TeV?(G=Ie[$e+M[de]],we[ve+M[de]]):(G=96,0),T=1<>he)+(P-=T)]=W<<24|G<<16|Q|0,P!==0;);for(T=1<>=1;if(T!==0?(be&=T-1,be+=T):be=0,de++,--et[oe]==0){if(oe===pe)break;oe=y[v+M[de]]}if(ne>>7)]}function ve(je,ut){je.pending_buf[je.pending++]=255&ut,je.pending_buf[je.pending++]=ut>>>8&255}function et(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,Ye,Le=new Array(M+1),Ke=0;for(Ee=1;Ee<=M;Ee++)Le[Ee]=Ke=Ke+Ce[Ee-1]<<1;for(Ye=0;Ye<=ut;Ye++){var tt=je[2*Ye+1];tt!==0&&(je[2*Ye]=Ie(Le[tt]++,tt))}}function Be(je){var ut;for(ut=0;ut>1;1<=Ce;Ce--)At(je,Le,Ce);for(Ye=ct;Ce=je.heap[1],je.heap[1]=je.heap[je.heap_len--],At(je,Le,1),Ee=je.heap[1],je.heap[--je.heap_max]=Ce,je.heap[--je.heap_max]=Ee,Le[2*Ye]=Le[2*Ce]+Le[2*Ee],je.depth[Ye]=(je.depth[Ce]>=je.depth[Ee]?je.depth[Ce]:je.depth[Ee])+1,Le[2*Ce+1]=Le[2*Ee+1]=Ye,je.heap[1]=Ye++,At(je,Le,1),2<=je.heap_len;);je.heap[--je.heap_max]=je.heap[1],function(zt,ir){var Mr,Zr,Br,rn,Zn,Ot,Gr=ir.dyn_tree,An=ir.max_code,zn=ir.stat_desc.static_tree,ba=ir.stat_desc.has_stree,gi=ir.stat_desc.extra_bits,Mo=ir.stat_desc.extra_base,Wa=ir.stat_desc.max_length,ms=0;for(rn=0;rn<=M;rn++)zt.bl_count[rn]=0;for(Gr[2*zt.heap[zt.heap_max]+1]=0,Mr=zt.heap_max+1;Mr>=7;Ye>>=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)<=Ye&&(Ye=Le)):Ye=Le=Ce+5,Ce+4<=Ye&&ut!==-1?rt(je,ut,Ce,Ee):je.strategy===4||Le===Ye?(et(je,2+(Ee?1:0),3),Oe(je,ae,oe)):(et(je,4+(Ee?1:0),3),function(tt,ct,it,zt){var ir;for(et(tt,ct-257,5),et(tt,it-1,5),et(tt,zt-4,4),ir=0;ir>>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*(se[Ce]+y+1)]++,je.dyn_dtree[2*we(ut)]++),je.last_lit===je.lit_bufsize-1},a._tr_align=function(je){et(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)})})(P9e);var SNt=P9e.exports;const CNt=eo(SNt);function Tde(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 MNt=()=>{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,be)=>be.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 ln(Te,"MMMM yyyy")}catch{return xe}},Q=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")}},de=async(xe,Te)=>{try{const we=await(await fetch(xe)).blob(),ve=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),et=navigator.canShare&&navigator.canShare({files:[new File([we],"test.jpg",{type:"image/jpeg"})]});if(ve&&et){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(be){be.name!=="AbortError"&&Ae.error("Failed to download image")}},se=xe=>{u(Te=>{const be=new Set(Te);return be.has(xe)?be.delete(xe):be.add(xe),be})},pe=()=>{u(new Set(Q.map(xe=>xe.id)))},ne=()=>{u(new Set),x(!1)},me=async()=>{const xe=Q.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 CNt,be=[...xe].sort((Ie,$e)=>Ie.sort_order-$e.sort_order);for(let Ie=0;Ie{m?se(xe.id):n(xe)};return r.jsx(Dr,{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(Tt,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Ds,{className:"h-3 w-3 mr-1"}),"New content monthly"]}),r.jsxs(Tt,{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(ki,{defaultValue:"gallery",className:"space-y-6",children:[r.jsxs(wi,{className:"grid w-full max-w-md grid-cols-2",children:[r.jsxs(an,{value:"gallery",className:"gap-2",children:[r.jsx(Fl,{className:"h-4 w-4"}),"Gallery"]}),r.jsxs(an,{value:"scheduled",className:"gap-2",children:[r.jsx(Tp,{className:"h-4 w-4"}),"Scheduled"]})]}),r.jsxs(Cn,{value:"gallery",className:"space-y-6",children:[e?U?r.jsx(He,{className:"border rounded-xl",children:r.jsx(Je,{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(X,{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(Je,{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(X,{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(xm,{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(Je,{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(Qa,{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(Tt,{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"),ne()},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"),ne()},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(Ad,{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(X,{variant:"outline",size:"sm",onClick:pe,className:"gap-2",children:["Select All (",Q.length,")"]}),r.jsxs(X,{variant:"outline",size:"sm",onClick:ne,className:"gap-2",children:[r.jsx(us,{className:"h-4 w-4"}),"Cancel"]}),i.size>0&&r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(X,{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(X,{variant:"outline",size:"sm",onClick:()=>x(!0),className:"gap-2",children:[r.jsx(fi,{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:Q.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:()=>he(xe),children:r.jsxs("div",{className:"relative aspect-[4/5] overflow-hidden",children:[r.jsx("img",{src:Tde(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:ln(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(fi,{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)})}),Q.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:Tde(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(Tt,{variant:"secondary",className:"bg-black/50 text-white border-0 backdrop-blur-sm text-xs",children:[r.jsx(Ad,{className:"h-3 w-3 mr-1"}),"Reel"]})}),r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})})}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Ad,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No reel available for this month yet."})]})})]}),r.jsx(Or,{open:!!t,onOpenChange:()=>n(null),children:r.jsx(Lr,{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:Tde(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(Ts,{className:"h-4 w-4"}),ln(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(Ts,{className:"h-3.5 w-3.5"}),"Post on ",ln(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(X,{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(X,{variant:"outline",onClick:()=>oe(t.caption),className:"flex-1 gap-2",children:[r.jsx(Oo,{className:"h-4 w-4"}),"Copy Caption"]}),r.jsxs(X,{variant:"outline",onClick:()=>de(t.image_url,t.id),className:"flex-1 gap-2",children:[r.jsx(so,{className:"h-4 w-4"}),"Download"]})]})]})]})]})})})}),r.jsx(Or,{open:!!s,onOpenChange:()=>a(null),children:r.jsx(Lr,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:r.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:s&&r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-1/2 bg-black flex items-center justify-center",children:r.jsx("div",{className:"aspect-[9/16] max-h-[70vh]",children:r.jsx("img",{src:s.image_url,alt:"Reel preview",className:"w-full h-full object-contain"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[r.jsx(Ad,{className:"h-4 w-4"}),"Monthly Reel"]}),s.caption&&r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:s.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[s.caption&&r.jsxs(X,{onClick:()=>oe(s.caption||""),className:"flex-1 gap-2",children:[r.jsx(Oo,{className:"h-4 w-4"}),"Copy Caption"]}),s.canva_link&&r.jsxs(X,{variant:"outline",onClick:()=>window.open(s.canva_link,"_blank"),className:"flex-1 gap-2",children:[r.jsx(Ms,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})}),r.jsx(kNt,{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(Cn,{value:"scheduled",children:r.jsx(NNt,{})})]}):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(Je,{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(Qa,{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(Tt,{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"),ne()},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"),ne()},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(Ad,{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(X,{variant:"outline",size:"sm",onClick:pe,className:"gap-2",children:["Select All (",Q.length,")"]}),r.jsxs(X,{variant:"outline",size:"sm",onClick:ne,className:"gap-2",children:[r.jsx(us,{className:"h-4 w-4"}),"Cancel"]}),i.size>0&&r.jsxs(X,{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(X,{variant:"outline",size:"sm",onClick:()=>x(!0),className:"gap-2",children:[r.jsx(fi,{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:Q.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:()=>he(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(fi,{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)})}),Q.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(Tt,{variant:"secondary",className:"bg-black/50 text-white border-0 backdrop-blur-sm text-xs",children:[r.jsx(Ad,{className:"h-3 w-3 mr-1"}),"Reel"]})}),r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})})}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Ad,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No reel available for this month yet."})]})})]}),r.jsx(Or,{open:!!t,onOpenChange:()=>n(null),children:r.jsx(Lr,{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(Ts,{className:"h-4 w-4"}),ln(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(X,{variant:"outline",onClick:()=>oe(t.caption),className:"flex-1 gap-2",children:[r.jsx(Oo,{className:"h-4 w-4"}),"Copy Caption"]}),r.jsxs(X,{variant:"outline",onClick:()=>de(t.image_url,t.id),className:"flex-1 gap-2",children:[r.jsx(so,{className:"h-4 w-4"}),"Download"]})]})]})]})})})}),r.jsx(Or,{open:!!s,onOpenChange:()=>a(null),children:r.jsx(Lr,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:r.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:s&&r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-1/2 bg-black flex items-center justify-center",children:r.jsx("div",{className:"aspect-[9/16] max-h-[70vh]",children:r.jsx("img",{src:s.image_url,alt:"Reel preview",className:"w-full h-full object-contain"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[r.jsx(Ad,{className:"h-4 w-4"}),"Monthly Reel"]}),s.caption&&r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:s.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[s.caption&&r.jsxs(X,{onClick:()=>oe(s.caption||""),className:"flex-1 gap-2",children:[r.jsx(Oo,{className:"h-4 w-4"}),"Copy Caption"]}),s.canva_link&&r.jsxs(X,{variant:"outline",onClick:()=>window.open(s.canva_link,"_blank"),className:"flex-1 gap-2",children:[r.jsx(Ms,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})})]})]})})},TNt=()=>{const{swagId:e}=Ec(),{user:t}=tn(),{toast:n}=pi(),s=qr(),{trackEngagement:a}=gP(),[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(Dr,{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(Dr,{title:i.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(X,{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(R3,{resourceType:"social_swag",resourceId:i.id,resourceTitle:i.title}),r.jsxs(X,{variant:N?"default":"outline",className:"gap-2 w-fit",onClick:()=>b.mutate(),disabled:!t||b.isPending,children:[r.jsx(pd,{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(Je,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Ro,{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(X,{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(Ms,{className:"h-4 w-4 text-muted-foreground"})]},I.id))})]})}),r.jsx(Dd,{}),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(Xn,{placeholder:"Add a comment...",value:o,onChange:I=>l(I.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(X,{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(Je,{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(Je,{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(X,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>v.mutate(I.id),children:r.jsx(Un,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:I.content})]})]})})},I.id))})]})]})}):r.jsx(Dr,{title:"Social Swag",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Ro,{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(X,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/social-swag",children:"Back to Social Swag"})})]})})},ANt=({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(X,{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(G4,{open:o,onOpenChange:l,children:[r.jsx(K4,{asChild:!0,children:r.jsxs(X,{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(Fd,{className:"h-4 w-4"}):r.jsx(Gi,{className:"h-4 w-4"})]})}),r.jsx(Z4,{className:"space-y-1 pl-2",children:e.map(v=>r.jsxs(X,{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(G4,{open:i,onOpenChange:u,children:[r.jsx(K4,{asChild:!0,children:r.jsxs(X,{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(th,{className:"h-3 w-3"}),"Your Groups"]}),i?r.jsx(Fd,{className:"h-4 w-4"}):r.jsx(Gi,{className:"h-4 w-4"})]})}),r.jsx(Z4,{className:"space-y-1 pl-2",children:t.map(v=>r.jsxs(X,{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(G4,{open:m,onOpenChange:x,children:[r.jsx(K4,{asChild:!0,children:r.jsxs(X,{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(qn,{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(Fd,{className:"h-4 w-4"}):r.jsx(Gi,{className:"h-4 w-4"})]})}),r.jsx(Z4,{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(Ti,{src:v.avatarUrl}),r.jsx(ta,{className:"text-xs",children:y(v.name)})]}),r.jsx(eh,{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))})]})]})})})},ENt=({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(dh,{children:[r.jsx(uh,{asChild:!0,children:r.jsxs(X,{variant:"outline",className:"flex-1 justify-between",children:[r.jsx("span",{className:"truncate",children:u()}),r.jsx(Fd,{className:"h-4 w-4 ml-2 shrink-0"})]})}),r.jsxs(Nu,{className:"w-56 bg-background border",children:[r.jsxs(Ha,{onClick:()=>s("all"),children:[r.jsx(k4,{className:"h-4 w-4 mr-2"}),"All Posts"]}),r.jsx(ik,{}),r.jsx(ime,{className:"text-xs text-muted-foreground",children:"Categories"}),e.map(m=>r.jsxs(Ha,{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(ime,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(th,{className:"h-3 w-3"}),"Your Groups"]}),t.map(m=>r.jsxs(Ha,{onClick:()=>s(`group:${m.id}`),children:[r.jsx("span",{className:"mr-2",children:m.icon||"🔒"}),m.name]},m.id))]})]})]}),r.jsxs(Hse,{open:o,onOpenChange:l,children:[r.jsx(tye,{asChild:!0,children:r.jsxs(X,{variant:"outline",size:"icon",className:"relative",children:[r.jsx(qn,{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(dP,{children:[r.jsx(Wse,{children:r.jsxs(Gse,{className:"flex items-center gap-2",children:[r.jsx(qn,{className:"h-5 w-5"}),"Online Now (",a.length,")"]})}),r.jsx(Zo,{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(Ti,{src:m.avatarUrl}),r.jsx(ta,{children:i(m.name)})]}),r.jsx(eh,{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 Ade,Lae="HoverCard",[L9e]=cc(Lae,[ax]),Oae=ax(),[INt,F0e]=L9e(Lae),O9e=e=>{const{__scopeHoverCard:t,children:n,open:s,defaultOpen:a,onOpenChange:o,openDelay:l=700,closeDelay:i=300}=e,u=Oae(t),m=A.useRef(0),x=A.useRef(0),y=A.useRef(!1),v=A.useRef(!1),[b,N]=sh({prop:s,defaultProp:a??!1,onChange:o,caller:Lae}),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(INt,{scope:t,open:b,onOpenChange:N,onOpen:k,onClose:M,onDismiss:I,hasSelectionRef:y,isPointerDownOnContentRef:v,children:r.jsx(XI,{...u,children:n})})};O9e.displayName=Lae;var D9e="HoverCardTrigger",R9e=A.forwardRef((e,t)=>{const{__scopeHoverCard:n,...s}=e,a=F0e(D9e,n),o=Oae(n);return r.jsx(w3,{asChild:!0,...o,children:r.jsx(Bn.a,{"data-state":a.open?"open":"closed",...s,ref:t,onPointerEnter:xn(e.onPointerEnter,Zre(a.onOpen)),onPointerLeave:xn(e.onPointerLeave,Zre(a.onClose)),onFocus:xn(e.onFocus,a.onOpen),onBlur:xn(e.onBlur,a.onClose),onTouchStart:xn(e.onTouchStart,l=>l.preventDefault())})})});R9e.displayName=D9e;var PNt="HoverCardPortal",[ctr,LNt]=L9e(PNt,{forceMount:void 0}),Kre="HoverCardContent",F9e=A.forwardRef((e,t)=>{const n=LNt(Kre,e.__scopeHoverCard),{forceMount:s=n.forceMount,...a}=e,o=F0e(Kre,e.__scopeHoverCard);return r.jsx(Ac,{present:s||o.open,children:r.jsx(ONt,{"data-state":o.open?"open":"closed",...a,onPointerEnter:xn(e.onPointerEnter,Zre(o.onOpen)),onPointerLeave:xn(e.onPointerLeave,Zre(o.onClose)),ref:t})})});F9e.displayName=Kre;var ONt=A.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:l,...i}=e,u=F0e(Kre,n),m=Oae(n),x=A.useRef(null),y=ca(t,x),[v,b]=A.useState(!1);return A.useEffect(()=>{if(v){const N=document.body;return Ade=N.style.userSelect||N.style.webkitUserSelect,N.style.userSelect="none",N.style.webkitUserSelect="none",()=>{N.style.userSelect=Ade,N.style.webkitUserSelect=Ade}}},[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&&FNt(x.current).forEach(k=>k.setAttribute("tabindex","-1"))}),r.jsx(wv,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:xn(o,N=>{N.preventDefault()}),onDismiss:u.onDismiss,children:r.jsx(QI,{...m,...i,onPointerDown:xn(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)"}})})}),DNt="HoverCardArrow",RNt=A.forwardRef((e,t)=>{const{__scopeHoverCard:n,...s}=e,a=Oae(n);return r.jsx(JI,{...a,...s,ref:t})});RNt.displayName=DNt;function Zre(e){return t=>t.pointerType==="touch"?void 0:e()}function FNt(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 zNt=O9e,BNt=R9e,z9e=F9e;const $Nt=zNt,UNt=BNt,B9e=A.forwardRef(({className:e,align:t="center",sideOffset:n=4,...s},a)=>r.jsx(z9e,{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}));B9e.displayName=z9e.displayName;const qNt=[{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"}],VNt=e=>e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2),$9e=({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($Nt,{openDelay:200,closeDelay:100,children:[r.jsx(UNt,{asChild:!0,children:r.jsx("div",{className:"cursor-pointer",children:t})}),r.jsx(B9e,{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=qNt.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(Ti,{src:l.user_avatar||void 0}),r.jsx(ta,{className:"text-[10px]",children:VNt(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 HNt({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(Or,{open:n,onOpenChange:s,children:r.jsxs(Lr,{className:"max-w-[95vw] max-h-[95vh] w-auto h-auto p-0 border-none bg-black/95 overflow-hidden",children:[r.jsx(X,{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(us,{className:"h-6 w-6"})}),e.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(X,{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(X,{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(X,{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(B4,{className:"h-5 w-5"}):r.jsx(z4,{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 SO=[{type:"like",emoji:"👍",label:"Like"},{type:"love",emoji:"❤️",label:"Love"}],WNt=({commentId:e,reactions:t,currentUserId:n})=>{var m,x;const s=qr(),[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($9e,{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=SO.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=SO.find(y=>y.type===l.reaction_type))==null?void 0:m.emoji," ",(x=SO.find(y=>y.type===l.reaction_type))==null?void 0:x.label]}):r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(bi,{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:SO.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 Yre({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),Q=we=>{if(u==="plain"){const Ie=[];return W.current.forEach((Be,Ve)=>{we.includes(`@${Ve}`)&&Ie.push(Be)}),[...new Set(Ie)]}const ve=/@\[([^\]]+)\]\(([^)]+)\)/g,et=[];let Me;for(;(Me=ve.exec(we))!==null;)et.push(Me[2]);return[...new Set(et)]},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,et=[];let Me;for(;(Me=ve.exec(we))!==null;)et.push(Me[2]);return[...new Set(et)]};A.useEffect(()=>{if(o){const we=Q(e);o(we)}if(l){const we=ae(e);l(we)}},[e,o,l,u]);const{data:oe=[],isLoading:de}=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:et,error:Me}=await ve;if(Me)throw Me;const Ie=et.map(Be=>Be.id),$e=await FDe(Ie);return et.map(Be=>({id:Be.id,name:Be.name||"Unknown",avatar_url:$e.get(Be.id)}))},enabled:v&&N==="user",staleTime:3e4}),{data:se=[],isLoading:pe}=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:et}=await we;if(et)throw et;return ve||[]},enabled:v&&N==="template"&&m,staleTime:3e4}),ne=N==="user"?de:pe,me=N==="user"?oe:se,he=we=>we.split(" ").map(ve=>ve[0]).join("").toUpperCase().slice(0,2),xe=we=>{const ve=we.target.value,et=we.target.selectionStart;t(ve);const Me=ve.substring(0,et),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),At=ot.includes(" "),Oe=ot.includes(` `);if(!At&&!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),et=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+et;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)},be=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 et=ve.getBoundingClientRect();V({top:et.bottom+4,left:et.left,width:et.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(Xn,{ref:x,value:e,onChange:xe,onKeyDown:we=>{be(we),we.defaultPrevented||i==null||i(we)},placeholder:n,className:Ut("resize-none",s),style:{minHeight:a}}),v&&Ah.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"}),ne?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(Ti,{src:we.avatar_url}),r.jsx(ta,{className:"text-xs",children:he(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 GNt(e){const t=/#\[([^\]]+)\]\(([^)]+)\)/g,n=[];let s;for(;(s=t.exec(e))!==null;)n.push(s[2]);return[...new Set(n)]}const B4e=e=>e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2);function U9e({comment:e,postId:t,currentUserId:n,currentUserAvatar:s,currentUserEmail:a,canModerate:o,depth:l=0}){const i=qr(),[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(Ti,{src:e.user_avatar||void 0}),r.jsx(ta,{className:"text-xs",children:B4e(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(WNt,{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(jA,{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(Ti,{src:s||void 0}),r.jsx(ta,{className:"text-xs",children:B4e((a==null?void 0:a.split("@")[0])||"U")})]}),r.jsxs("div",{className:"flex-1 flex gap-2 items-start",children:[r.jsx(Yre,{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(X,{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(U9e,{comment:T,postId:t,currentUserId:n,currentUserAvatar:s,currentUserEmail:a,canModerate:o,depth:l+1},T.id))})]})}const CO=[{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"}],KNt=()=>{const{user:e,isBrokerageManager:t,managedBrokerages:n,isAdmin:s}=tn(),{avatarUrl:a}=RDe(e==null?void 0:e.id),{onlineUsers:o}=fRe(),{toast:l}=pi(),i=qr(),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,Q]=A.useState(null),[ae,oe]=A.useState(""),[de,se]=A.useState(new Set),[pe,ne]=A.useState({}),[me,he]=A.useState({}),[xe,Te]=A.useState([]),[be,we]=A.useState([]),[ve,et]=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:At,isFetchingNextPage:Oe}=$tt({queryKey:["community-posts",m],initialPageParam:0,queryFn:async({pageParam:it})=>{var Pe;const zt=it*$e,ir=zt+$e;let Mr=Y.from("community_posts").select("*").order("is_pinned",{ascending:!1}).order("pinned_at",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1}).range(zt,ir);if(m.startsWith("group:")){const Ze=m.replace("group:","");Mr=Mr.eq("private_group_id",Ze)}else m==="all"||(Mr=Mr.eq("category_id",m).is("private_group_id",null));const{data:Zr,error:Br}=await Mr;if(Br)throw Br;const rn=((Zr==null?void 0:Zr.length)||0)>$e,Zn=(Zr||[]).slice(0,$e);if(Zn.length===0)return{posts:[],hasMore:!1,nextPage:it+1};const Ot=Zn.map(Ze=>Ze.id),Gr=[...new Set(Zn.filter(Ze=>Ze.category_id).map(Ze=>Ze.category_id))].filter(Boolean),[An,zn,ba,gi,Mo]=await Promise.all([Gr.length?Y.from("community_categories").select("*").in("id",Gr):Promise.resolve({data:[]}),Y.from("community_post_media").select("*").in("post_id",Ot).order("sort_order"),Y.from("community_reactions").select("*").in("post_id",Ot),Y.from("community_comments").select("*").in("post_id",Ot).order("created_at",{ascending:!0}),Y.from("community_post_resources").select("*").in("post_id",Ot)]),Wa=An==null?void 0:An.data,ms=zn==null?void 0:zn.data,ra=ba==null?void 0:ba.data,fs=gi==null?void 0:gi.data,Ys=Mo==null?void 0:Mo.data,Bs=(fs||[]).map(Ze=>Ze.id),[Ni,or]=await Promise.all([Bs.length?Y.from("community_comment_reactions").select("*").in("comment_id",Bs):Promise.resolve({data:[]}),(()=>{const Ze=(Ys||[]).filter(Nt=>Nt.resource_type==="template").map(Nt=>Nt.resource_id);return Ze.length===0?Promise.resolve({data:[]}):Y.from("canva_templates").select("id, name, preview_image_url").in("id",Ze)})()]),La=(Ni==null?void 0:Ni.data)||[],oo=(or==null?void 0:or.data)||[],ji=new Map(oo.map(Ze=>[Ze.id,{name:Ze.name,preview_image_url:Ze.preview_image_url}])),Hn=Array.from(new Set([...Zn.map(Ze=>Ze.user_id),...(ra||[]).map(Ze=>Ze.user_id),...(fs||[]).map(Ze=>Ze.user_id),...La.map(Ze=>Ze.user_id)])),[Ki,dc]=await Promise.all([Hn.length?Y.from("profiles").select("id, name").in("id",Hn):Promise.resolve({data:[]}),FDe(Hn)]),go=new Map(((Pe=Ki==null?void 0:Ki.data)==null?void 0:Pe.map(Ze=>[Ze.id,Ze.name]))||[]),uc=new Map((Wa||[]).map(Ze=>[Ze.id,Ze])),nt=Ze=>{const Nt=new Map,bt=[];return Ze.forEach(It=>{Nt.set(It.id,{...It,user_name:go.get(It.user_id)||"Unknown User",user_avatar:dc.get(It.user_id),reactions:La.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:[]})}),Ze.forEach(It=>{const qt=Nt.get(It.id);if(It.parent_comment_id&&Nt.has(It.parent_comment_id)){const Lt=Nt.get(It.parent_comment_id);Lt.replies=Lt.replies||[],Lt.replies.push(qt)}else bt.push(qt)}),bt};return{posts:Zn.map(Ze=>{const Nt=(Ys||[]).filter(bt=>bt.post_id===Ze.id).map(bt=>{let It="",qt=null;if(bt.resource_type==="template"){const Lt=ji.get(bt.resource_id);It=(Lt==null?void 0:Lt.name)||"Unknown Template",qt=(Lt==null?void 0:Lt.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{...Ze,user_name:go.get(Ze.user_id)||"Unknown User",user_avatar:dc.get(Ze.user_id),category:Ze.category_id?uc.get(Ze.category_id):null,media:(ms||[]).filter(bt=>bt.post_id===Ze.id),reactions:((ra||[]).filter(bt=>bt.post_id===Ze.id)||[]).map(bt=>({...bt,user_name:go.get(bt.user_id)||"Unknown User",user_avatar:dc.get(bt.user_id)})),comments:nt((fs||[]).filter(bt=>bt.post_id===Ze.id)),resources:Nt}}),hasMore:rn,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 Mr=0;Mr0){const Mr=xe.filter(Zr=>Zr!==e.id).map(Zr=>({post_id:it.id,mentioned_user_id:Zr,mentioned_by_user_id:e.id}));Mr.length>0&&await Y.from("community_post_mentions").insert(Mr)}const ir=GNt(y);if(ir.length>0){const Mr=ir.map(Zr=>({post_id:it.id,resource_type:"template",resource_id:Zr}));await Y.from("community_post_resources").insert(Mr)}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 ir=((zt=e==null?void 0:e.user_metadata)==null?void 0:zt.name)||"Someone",Mr=y.length>50?y.substring(0,50)+"...":y;await Y.functions.invoke("send-push-notification",{body:{title:"New Community Post",body:`${ir}: ${Mr}`,url:"/community"}})}catch(ir){console.error("Failed to send push notification:",ir)}},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:ir}=await Y.from("community_posts").update({content:zt}).eq("id",it);if(ir)throw ir},onSuccess:()=>{i.invalidateQueries({queryKey:["community-posts"]}),Q(null),oe(""),l({title:"Post updated!"})}}),Qe=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"})}}),rt=ar({mutationFn:async({postId:it,isPinned:zt})=>{const{error:ir}=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(ir)throw ir},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 Mr;const ir=(Mr=at.find(Zr=>Zr.id===it))==null?void 0:Mr.reactions.find(Zr=>Zr.user_id===(e==null?void 0:e.id));ir?ir.reaction_type===zt?await Y.from("community_reactions").delete().eq("id",ir.id):await Y.from("community_reactions").update({reaction_type:zt}).eq("id",ir.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:ir,error:Mr}=await Y.from("community_comments").insert({post_id:it,user_id:e.id,content:zt}).select("id").single();if(Mr)throw Mr;const Zr=me[it]||[];if(Zr.length>0&&ir){const Br=Zr.filter(rn=>rn!==e.id).map(rn=>({comment_id:ir.id,mentioned_user_id:rn,mentioned_by_user_id:e.id}));Br.length>0&&await Y.from("community_comment_mentions").insert(Br)}},onSuccess:(it,{postId:zt})=>{i.invalidateQueries({queryKey:["community-posts"]}),ne(ir=>({...ir,[zt]:""})),he(ir=>({...ir,[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(ir=>[...ir,...zt]),zt.forEach(ir=>{const Mr=new FileReader;Mr.onloadend=()=>{F(Zr=>[...Zr,Mr.result])},Mr.readAsDataURL(ir)})},Ee=it=>{T(zt=>zt.filter((ir,Mr)=>Mr!==it)),F(zt=>zt.filter((ir,Mr)=>Mr!==it))},Ye=it=>it.split(" ").map(zt=>zt[0]).join("").toUpperCase().slice(0,2),Le=it=>{const zt={};return it.forEach(ir=>{zt[ir.reaction_type]=(zt[ir.reaction_type]||0)+1}),zt},Ke=it=>{var zt;return(zt=it.find(ir=>ir.user_id===(e==null?void 0:e.id)))==null?void 0:zt.reaction_type},tt=it=>it.reduce((zt,ir)=>zt+1+(ir.replies?tt(ir.replies):0),0),ct=it=>{if(s)return!0;if(!t||!it.private_group_id)return!1;const zt=Ie.find(ir=>ir.id===it.private_group_id);return zt!=null&&zt.brokerage_id?n.some(ir=>ir.id===zt.brokerage_id):!1};return r.jsx(Dr,{title:"Community",children:r.jsxs("div",{className:"flex gap-6 w-full isolate z-0",children:[r.jsx(ANt,{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(ENt,{categories:Me,privateGroups:Ie,selectedFilter:m,onFilterChange:x,onlineUsers:o}),r.jsx(He,{children:r.jsx(Je,{className:"pt-6",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsxs(ea,{className:"h-10 w-10",children:[r.jsx(Ti,{src:a||void 0}),r.jsx(ta,{children:e!=null&&e.email?Ye(e.email.split("@")[0]):"U"})]}),r.jsxs("div",{className:"flex-1 space-y-3",children:[r.jsx(Yre,{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 ir;return r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[(ir=I[zt])!=null&&ir.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(X,{variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>Ee(zt),children:r.jsx(us,{className:"h-3 w-3"})})]},zt)})}),D&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ro,{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(X,{variant:"ghost",size:"icon",onClick:()=>U(""),children:r.jsx(us,{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(X,{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(X,{variant:"ghost",size:"sm",onClick:()=>{var it;return(it=u.current)==null?void 0:it.click()},children:[r.jsx(Pa,{className:"h-4 w-4 mr-1"}),"Video"]}),r.jsxs(X,{variant:"ghost",size:"sm",onClick:()=>U("https://"),children:[r.jsx(Ro,{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(hn,{value:k||b||"none",onValueChange:it=>{it==="none"?(N(""),M("")):it.startsWith("group:")?(M(it.replace("group:","")),N("")):(N(it),M(""))},children:[r.jsx(cn,{className:"w-[130px] sm:w-[160px] h-8 text-xs sm:text-sm",children:r.jsx(fn,{placeholder:"Select..."})}),r.jsxs(dn,{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(hn,{value:b,onValueChange:N,children:[r.jsx(cn,{className:"w-[110px] sm:w-[140px] h-8 text-xs sm:text-sm",children:r.jsx(fn,{placeholder:"Category"})}),r.jsx(dn,{children:Me.map(it=>r.jsxs($t,{value:it.id,children:[it.icon," ",it.name]},it.id))})]}),r.jsxs(X,{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(Je,{className:"pt-6",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Tr,{className:"h-10 w-10 rounded-full"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx(Tr,{className:"h-4 w-32"}),r.jsx(Tr,{className:"h-4 w-full"}),r.jsx(Tr,{className:"h-4 w-3/4"})]})]})})},zt))}):at.length===0?r.jsx(He,{children:r.jsxs(Je,{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,ir,Mr,Zr;return r.jsx(He,{children:r.jsxs(Je,{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(Ti,{src:it.user_avatar||void 0}),r.jsx(ta,{children:Ye(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(Tt,{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(dh,{children:[r.jsx(uh,{asChild:!0,children:r.jsx(X,{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(Ha,{onClick:()=>rt.mutate({postId:it.id,isPinned:it.is_pinned}),children:it.is_pinned?r.jsxs(r.Fragment,{children:[r.jsx(yA,{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(Ha,{onClick:()=>{Q(it),oe(it.content)},children:[r.jsx(Ja,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(Ha,{className:"text-destructive",onClick:()=>Qe.mutate(it.id),children:[r.jsx(Un,{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((Br,rn)=>{const Zn=rn===3&&it.media.length>4,Ot=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:()=>et({open:!0,images:it.media.map(Gr=>({url:Gr.media_url,type:Gr.media_type==="video"?"video":"image"})),index:rn}),children:[Br.media_type==="video"?r.jsx("video",{src:Br.media_url,className:"w-full h-full object-cover transition-transform group-hover:scale-105"}):r.jsx("img",{src:Br.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"})})})}),Zn&&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:["+",Ot]})})]},Br.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:Br=>{Br.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(Ro,{className:"h-4 w-4 flex-shrink-0"}),r.jsx("span",{className:"truncate",children:it.link_url})]})})]}),it.reactions.length>0&&r.jsx($9e,{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(([Br])=>{var rn;return r.jsx("span",{className:"text-base",children:(rn=CO.find(Zn=>Zn.type===Br))==null?void 0:rn.emoji},Br)})}),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(X,{variant:"ghost",size:"sm",className:"flex-1",children:[Ke(it.reactions)?r.jsx("span",{className:"mr-1",children:(zt=CO.find(Br=>Br.type===Ke(it.reactions)))==null?void 0:zt.emoji}):r.jsx(pd,{className:"h-4 w-4 mr-1"}),Ke(it.reactions)?(ir=CO.find(Br=>Br.type===Ke(it.reactions)))==null?void 0:ir.label:"Like"]})}),r.jsx(Tc,{className:"w-auto p-2",side:"top",children:r.jsx("div",{className:"flex gap-1",children:CO.map(Br=>r.jsx("button",{onClick:()=>je.mutate({postId:it.id,reactionType:Br.type}),className:"text-2xl hover:scale-125 transition-transform p-1",title:Br.label,children:Br.emoji},Br.type))})})]}),r.jsxs(X,{variant:"ghost",size:"sm",className:"flex-1",onClick:()=>se(Br=>{const rn=new Set(Br);return rn.has(it.id)?rn.delete(it.id):rn.add(it.id),rn}),children:[r.jsx(Ul,{className:"h-4 w-4 mr-1"}),(()=>{const Br=tt(it.comments);return Br>0?`Comment (${Br})`:"Comment"})()]})]}),de.has(it.id)&&r.jsxs("div",{className:"space-y-3 mt-3",children:[it.comments.map(Br=>r.jsx(U9e,{comment:Br,postId:it.id,currentUserId:e==null?void 0:e.id,currentUserAvatar:a,currentUserEmail:e==null?void 0:e.email,canModerate:ct(it)},Br.id)),e&&r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ea,{className:"h-8 w-8",children:[r.jsx(Ti,{src:a||void 0}),r.jsx(ta,{className:"text-xs",children:Ye(((Mr=e.email)==null?void 0:Mr.split("@")[0])||"U")})]}),r.jsxs("div",{className:"flex-1 flex gap-2",children:[r.jsx(Yre,{placeholder:"Write a comment... (use @ to mention)",value:pe[it.id]||"",onChange:Br=>ne(rn=>({...rn,[it.id]:Br})),onMentionsChange:Br=>he(rn=>({...rn,[it.id]:Br})),mentionFormat:"plain",onKeyDown:Br=>{var rn;Br.defaultPrevented||Br.key==="Enter"&&!Br.shiftKey&&((rn=pe[it.id])!=null&&rn.trim())&&(Br.preventDefault(),ut.mutate({postId:it.id,content:pe[it.id]}))},className:"text-sm min-h-0 py-1.5",minHeight:"32px"}),r.jsx(X,{size:"sm",variant:"ghost",onClick:()=>{var Br;(Br=pe[it.id])!=null&&Br.trim()&&ut.mutate({postId:it.id,content:pe[it.id]})},disabled:!((Zr=pe[it.id])!=null&&Zr.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(X,{variant:"outline",onClick:()=>At(),disabled:Oe,children:Oe?"Loading…":"Load more posts"})})]}),r.jsx(Or,{open:!!G,onOpenChange:()=>Q(null),children:r.jsxs(Lr,{children:[r.jsx(zr,{children:r.jsx(Fr,{children:"Edit Post"})}),r.jsx(Xn,{value:ae,onChange:it=>oe(it.target.value),className:"min-h-[120px]"}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(X,{variant:"outline",onClick:()=>Q(null),children:"Cancel"}),r.jsx(X,{onClick:()=>{G&&qe.mutate({postId:G.id,content:ae})},disabled:!ae.trim(),children:"Save Changes"})]})]})}),r.jsx(HNt,{images:ve.images,initialIndex:ve.index,open:ve.open,onOpenChange:it=>et(zt=>({...zt,open:it}))})]})]})})},LS={open:{label:"Open",icon:Qa,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:Ul,color:"bg-blue-500"},resolved:{label:"Resolved",icon:li,color:"bg-green-500"},closed:{label:"Closed",icon:bc,color:"bg-muted-foreground"}},$4e={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function ZNt(){const{user:e}=tn(),t=qr(),[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(Dr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(X,{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(Tt,{variant:"secondary",children:$4e[n.category]}),r.jsxs(Tt,{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(kn,{children:["Created on ",ln(new Date(n.created_at),"MMM d, yyyy 'at' h:mm a")]})}),r.jsx(Je,{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(Je,{children:[r.jsx(Zo,{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:ln(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(Dd,{className:"my-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Xn,{placeholder:"Type your reply...",value:a,onChange:v=>o(v.target.value),className:"min-h-[80px]"}),r.jsx(X,{onClick:x,disabled:!a.trim()||m.isPending,className:"self-end",children:r.jsx(Ji,{className:"h-4 w-4"})})]})]})]})]})]})})}return r.jsx(Dr,{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(Je,{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(wme,{trigger:r.jsxs(X,{size:"lg",className:"gap-2",children:[r.jsx(bn,{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(Ii,{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(wme,{trigger:r.jsxs(X,{variant:"outline",size:"sm",className:"gap-2",children:[r.jsx(bn,{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(Je,{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(Je,{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(Tt,{variant:"outline",className:"text-xs",children:$4e[y.category]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:ln(new Date(y.created_at),"MMM d, yyyy")})]})]}),r.jsxs(Tt,{className:LS[y.status].color,children:[r.jsx(v,{className:"h-3 w-3 mr-1"}),LS[y.status].label]})]})})},y.id)})})]})})}function YNt({open:e,onOpenChange:t}){return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Lr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(zr,{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(Ts,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Fr,{children:"Schedule Agent Onboarding"}),r.jsx(Qn,{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 XNt({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(Or,{open:e,onOpenChange:N,children:r.jsxs(Lr,{className:"max-w-md",children:[r.jsx(zr,{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(Fr,{children:"Send Onboarding Link"}),r.jsx(Qn,{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(Wr,{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(qn,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No agents found"})]}):r.jsx(Zo,{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(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>N(!1),children:"Cancel"}),r.jsx(X,{onClick:b,disabled:o.length===0||i,children:i?r.jsxs(r.Fragment,{children:[r.jsx(Wr,{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 QNt(){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(qn,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx(Gt,{children:"Agent Onboarding"}),r.jsx(kn,{children:"Schedule onboarding sessions for yourself or your agents"})]})]})}),r.jsx(Je,{children:r.jsxs("div",{className:"flex flex-wrap gap-4",children:[r.jsxs(X,{onClick:()=>t(!0),className:"flex items-center gap-2",children:[r.jsx(Ts,{className:"h-4 w-4"}),"Schedule Agent Onboarding"]}),r.jsxs(X,{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(YNt,{open:e,onOpenChange:t}),r.jsx(XNt,{open:n,onOpenChange:s})]})}function JNt({open:e,onOpenChange:t}){return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Lr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(zr,{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(Fr,{children:"Schedule Launch Meeting"}),r.jsx(Qn,{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 eSt(){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(kn,{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(Je,{children:r.jsxs(X,{onClick:()=>t(!0),className:"flex items-center gap-2",children:[r.jsx(Bg,{className:"h-4 w-4"}),"Schedule Launch Meeting"]})})]}),r.jsx(JNt,{open:e,onOpenChange:t})]})}function tSt(){const e=Wn(),[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(Dr,{title:"Brokerage Resources",description:"Access exclusive resources for brokerage managers",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(QNt,{}),r.jsx(eSt,{}),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(Tt,{variant:s===null?"default":"outline",className:"cursor-pointer",onClick:()=>a(null),children:"All"}),v.map(k=>r.jsx(Tt,{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(Tr,{className:"h-40 w-full"}),r.jsx(Ht,{children:r.jsx(Tr,{className:"h-5 w-3/4"})}),r.jsxs(Je,{children:[r.jsx(Tr,{className:"h-4 w-full mb-2"}),r.jsx(Tr,{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(Dh,{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(Dh,{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(Tt,{variant:"secondary",className:"shrink-0 text-xs",children:P.name})]})}),r.jsxs(Je,{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(Pa,{className:"h-4 w-4"}),I]}),T>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ro,{className:"h-4 w-4"}),T]})]})]})]},k.id)})})]})})}const rSt=()=>{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(Dr,{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(Dr,{title:t.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(X,{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(Je,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Pa,{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(Je,{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(Je,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Ms,{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(Ms,{className:"h-4 w-4 text-primary"})}),r.jsx("div",{className:"font-medium text-sm",children:a.title})]}),r.jsx(Ms,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},a.id))})]})})]})}):r.jsx(Dr,{title:"Brokerage Resources",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Dh,{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(X,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/brokerage-resources",children:"Back to Resources"})})]})})};function nSt(){const{onlineUsers:e,totalOnline:t}=fRe();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(qn,{className:"h-4 w-4"}),"Online Now"]}),r.jsxs(Tt,{variant:"secondary",className:"bg-green-100 text-green-700",children:[r.jsx(eh,{className:"h-2 w-2 fill-green-500 text-green-500 mr-1"}),t," online"]})]})}),r.jsx(Je,{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(Zo,{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(Ti,{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 U4e={users:{label:"Users & Access",sections:[{title:"Members",description:"Manage users, roles, and brokerage assignments",icon:qn,path:"/admin/members",color:"bg-blue-500/10 text-blue-600"},{title:"Invite Codes",description:"Create and manage signup invite codes",icon:TA,path:"/admin/invite-codes",color:"bg-amber-500/10 text-amber-600"},{title:"Subscriptions",description:"Track and manage user subscriptions",icon:hf,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:G1,path:"/admin/academy",color:"bg-indigo-500/10 text-indigo-600"},{title:"Manage Toolbox",description:"Create and manage resource kits",icon:vy,path:"/admin/toolbox",color:"bg-orange-500/10 text-orange-600"},{title:"Social Swag",description:"Manage social media content and links",icon:Ds,path:"/admin/social-swag",color:"bg-fuchsia-500/10 text-fuchsia-600"},{title:"Social Swag 2.0",description:"New monthly social media images",icon:Ds,path:"/admin/social-swag-2",color:"bg-cyan-500/10 text-cyan-600"},{title:"Newsletters",description:"Manage monthly newsletter templates",icon:py,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:Dh,path:"/admin/additional-services",color:"bg-lime-500/10 text-lime-600"},{title:"Brokerage Resources",description:"Manage resources for brokerage managers",icon:Dh,path:"/admin/brokerage-resources",color:"bg-slate-500/10 text-slate-600"},{title:"Agent Email Templates",description:"Manage curated email templates for agents",icon:ks,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:rm,path:"/admin/apps",color:"bg-purple-500/10 text-purple-600"},{title:"Email Templates",description:"Customize system email templates",icon:ks,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:aA,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:xm,path:"/admin/integrations",color:"bg-blue-500/10 text-blue-600"},{title:"Agent Cards",description:"Manage digital business cards for agents",icon:qn,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:zo,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:my,path:"/admin/wishlist",color:"bg-yellow-500/10 text-yellow-600"},{title:"Membership Reviews",description:"View member feedback and ratings",icon:Ss,path:"/admin/membership-reviews",color:"bg-amber-500/10 text-amber-600"},{title:"Weekly Digest",description:"Configure automated weekly email digests",icon:ks,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:bi,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:gy,path:"/admin/presentation-analytics",color:"bg-gradient-to-br from-violet-500/20 to-indigo-500/10 text-violet-600"}]}};function sSt(){const e=Wn();return r.jsx(Dr,{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(nSt,{})})]}),r.jsxs(ki,{defaultValue:"users",className:"w-full",children:[r.jsx(wi,{className:"w-full justify-start flex-wrap h-auto gap-1 bg-muted/50 p-1",children:Object.entries(U4e).map(([t,n])=>r.jsx(an,{value:t,className:"data-[state=active]:bg-background",children:n.label},t))}),Object.entries(U4e).map(([t,n])=>r.jsx(Cn,{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(Je,{className:"pt-0",children:r.jsx(kn,{className:"text-sm",children:s.description})})]},s.path))})},t))]})]})})}const Rs=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})}));Rs.displayName="Table";const Fs=A.forwardRef(({className:e,...t},n)=>r.jsx("thead",{ref:n,className:Ut("[&_tr]:border-b",e),...t}));Fs.displayName="TableHeader";const zs=A.forwardRef(({className:e,...t},n)=>r.jsx("tbody",{ref:n,className:Ut("[&_tr:last-child]:border-0",e),...t}));zs.displayName="TableBody";const aSt=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}));aSt.displayName="TableFooter";const Nr=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}));Nr.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 iSt=A.forwardRef(({className:e,...t},n)=>r.jsx("caption",{ref:n,className:Ut("mt-4 text-sm text-muted-foreground",e),...t}));iSt.displayName="TableCaption";const oSt=()=>{const{isAdmin:e}=tn(),t=Wn(),[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(X,{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(Or,{open:l,onOpenChange:i,children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{onClick:N,children:[r.jsx(bn,{className:"mr-2 h-4 w-4"}),"Add App"]})}),r.jsxs(Lr,{className:"max-w-2xl",children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:u?"Edit App":"Create New App"}),r.jsx(Qn,{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(Xn,{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(X,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(X,{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(kn,{children:"Manage the apps that appear on the member dashboard"})]}),r.jsx(Je,{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(X,{onClick:N,children:[r.jsx(bn,{className:"mr-2 h-4 w-4"}),"Create First App"]})]}):r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:n.map(k=>r.jsxs(Nr,{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(X,{size:"sm",variant:"ghost",onClick:()=>b(k),children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{size:"sm",variant:"ghost",onClick:()=>v(k.id),children:r.jsx(Un,{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(X,{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 q4e=({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(Tt,{variant:"destructive",className:Ut("gap-1",t),children:[r.jsx(Gu,{className:"h-3 w-3"}),"Trial Expired"]}):a<=1?r.jsxs(Tt,{variant:"destructive",className:Ut("gap-1",t),children:[r.jsx(Qa,{className:"h-3 w-3"}),"Trial: <1 day left"]}):a<=3?r.jsxs(Tt,{className:Ut("gap-1 bg-amber-500 hover:bg-amber-600",t),children:[r.jsx(Qa,{className:"h-3 w-3"}),"Trial: ",a," days left"]}):r.jsxs(Tt,{variant:"secondary",className:Ut("gap-1",t),children:[r.jsx(Qa,{className:"h-3 w-3"}),"Trial: ",a," days left"]})},q9e=({open:e,onOpenChange:t,brokerages:n,fixedBrokerageId:s,onSuccess:a})=>{const{toast:o}=pi(),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(se=>se.trim()).filter(se=>se);if(G.length===0)return[];const Q=G[0].toLowerCase(),oe=Q.includes("first")||Q.includes("last")||Q.includes("email")||Q.includes("name")||Q.includes("phone")||Q.includes("sms")||Q.includes("consent")?G.slice(1):G,de=[];for(const se of oe){const ne=(se.includes(" ")?se.split(" "):se.split(",")).map(me=>me.trim().replace(/^["']|["']$/g,""));if(ne.length>=2){let me="",he="",xe="",Te="",be;if(ne.length===2){const et=ne[0].split(" ");me=et[0]||"",he=et.slice(1).join(" ")||"",xe=ne[1]}else if(ne.length===3)me=ne[0],he=ne[1],xe=ne[2];else if(ne.length===4)me=ne[0],he=ne[1],xe=ne[2],Te=ne[3];else if(ne.length>=5){me=ne[0],he=ne[1],xe=ne[2],Te=ne[3];const et=ne[4].toLowerCase();be=et==="true"||et==="yes"||et==="1"||et==="y"}const ve=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(xe);de.push({firstName:me.trim(),lastName:he.trim(),email:xe.trim().toLowerCase(),phone:Te.trim()||void 0,smsConsent:be,isValid:ve&&me.trim().length>0,error:ve?me.trim()?void 0:"Missing name":"Invalid email"})}}return de},F=W=>{var ae;const G=(ae=W.target.files)==null?void 0:ae[0];if(!G)return;const Q=new FileReader;Q.onload=oe=>{var pe;const de=(pe=oe.target)==null?void 0:pe.result,se=P(de);if(se.length===0){o({title:"No data found",description:"The CSV file appears to be empty or in an unsupported format.",variant:"destructive"});return}u(se),N("preview")},Q.readAsText(G)},D=async()=>{const W=i.filter(Q=>Q.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:Q}}=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 ${Q==null?void 0:Q.access_token}`},body:JSON.stringify({users:W.map(de=>({firstName:de.firstName,lastName:de.lastName,email:de.email,phone:de.phone,smsConsent:de.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(Q){console.error("Import error:",Q),o({title:"Import Failed",description:Q.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(Or,{open:e,onOpenChange:T,children:r.jsxs(Lr,{className:"max-w-2xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(H1,{className:"h-5 w-5"}),"Import Agents from CSV"]}),r.jsx(Qn,{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(X,{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(hn,{value:m||"none",onValueChange:W=>x(W==="none"?"":W),children:[r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select a brokerage..."})}),r.jsxs(dn,{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(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:i.slice(0,100).map((W,G)=>r.jsxs(Nr,{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(Tt,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):r.jsx(Tt,{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(Hs,{children:[b==="upload"&&r.jsx(X,{variant:"outline",onClick:T,children:"Cancel"}),b==="preview"&&r.jsxs(r.Fragment,{children:[r.jsx(X,{variant:"outline",onClick:I,children:"Back"}),r.jsx(X,{onClick:D,disabled:y||U===0,children:y?r.jsxs(r.Fragment,{children:[r.jsx(Wr,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${U} Agent${U!==1?"s":""}`})]}),b==="result"&&r.jsx(X,{onClick:T,children:"Done"})]})]})})},lSt=[{type:"custom",title:"Great job!",message:"Keep up the amazing work!",icon:Ss},{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 V9e({open:e,onOpenChange:t,userId:n,userName:s}){const[a,o]=A.useState("custom"),[l,i]=A.useState(""),[u,m]=A.useState(""),x=Ilt(),y=b=>{o(b.type),i(b.title),m(b.message)},v=async b=>{if(b.preventDefault(),!l.trim()){Ca({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}),Ca({title:"Celebration sent! 🎉",description:`${s} will see confetti on their next visit!`}),t(!1),i(""),m(""),o("custom")}catch{Ca({title:"Error",description:"Failed to send celebration",variant:"destructive"})}};return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Lr,{className:"sm:max-w-md",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(Hc,{className:"h-5 w-5 text-primary"}),"Send Celebration to ",s]}),r.jsx(Qn,{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:lSt.map((b,N)=>r.jsxs(X,{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(hn,{value:a,onValueChange:b=>o(b),children:[r.jsx(cn,{children:r.jsx(fn,{})}),r.jsxs(dn,{children:[r.jsx($t,{value:"custom",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ss,{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(zd,{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(Xn,{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(X,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsxs(X,{type:"submit",disabled:x.isPending,children:[r.jsx(Hc,{className:"h-4 w-4 mr-2"}),x.isPending?"Sending...":"Send Celebration"]})]})]})]})})}const Ede={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:zd,color:"bg-green-500"},custom:{label:"Custom",icon:Ds,color:"bg-purple-500"}};function cSt(){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(Ede).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(Wr,{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(Je,{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(Je,{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(Je,{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(Je,{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(kn,{children:"View all celebrations awarded to agents"})]}),r.jsxs(Je,{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(hn,{value:n,onValueChange:s,children:[r.jsx(cn,{className:"w-[180px]",children:r.jsx(fn,{placeholder:"Filter by type"})}),r.jsxs(dn,{children:[r.jsx($t,{value:"all",children:"All Types"}),Object.entries(Ede).map(([x,y])=>r.jsx($t,{value:x,children:y.label},x))]})]}),r.jsxs(hn,{value:a,onValueChange:o,children:[r.jsx(cn,{className:"w-[140px]",children:r.jsx(fn,{placeholder:"Status"})}),r.jsxs(dn,{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(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:u.length===0?r.jsx(Nr,{children:r.jsx(yt,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"No celebrations found"})}):u.map(x=>{const y=Ede[x.celebration_type],v=y.icon;return r.jsxs(Nr,{children:[r.jsx(yt,{children:r.jsxs(Tt,{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(Tt,{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:ln(new Date(x.created_at),"MMM d, yyyy h:mm a")})}),r.jsx(yt,{children:x.seen_at?r.jsx(Tt,{variant:"outline",className:"bg-green-50 text-green-700 border-green-200",children:"Seen"}):r.jsx(Tt,{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 dSt=()=>{const{user:e}=tn(),{toast:t}=pi(),[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:de,error:se}=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(se)throw se;const{data:pe,error:ne}=await Y.from("trial_email_exports").select("user_id");if(ne)throw ne;const me=new Set((pe||[]).map(xe=>xe.user_id)),he=(de||[]).map(xe=>({...xe,converted_from_trial_at:xe.converted_from_trial_at??null,already_exported:me.has(xe.id)}));he.sort((xe,Te)=>new Date(Te.created_at).getTime()-new Date(xe.created_at).getTime()),s(he)}catch(de){console.error("Error loading trial users:",de),t({title:"Error",description:"Failed to load trial users",variant:"destructive"})}finally{o(!1)}},[t]);A.useEffect(()=>{M()},[M]);const I=de=>de.trial_started_at?"ghl":"stripe",T=de=>de.trial_expires_at?de.trial_expires_at:de.subscription_end_date?de.subscription_end_date:null,P=de=>de.converted_from_trial_at!==null,F=de=>{if(P(de))return!1;const se=T(de);return se?new Date(se).getTime()<=Date.now():!1},D=n.filter(de=>!(u!=="all"&&I(de)!==u||x==="active"&&(F(de)||P(de))||x==="expired"&&!F(de)||x==="converted"&&!P(de)||v==="new"&&de.already_exported||v==="exported"&&!de.already_exported)),U=()=>{N.size===D.length?k(new Set):k(new Set(D.map(de=>de.id)))},V=de=>{const se=new Set(N);se.has(de)?se.delete(de):se.add(de),k(se)},W=async()=>{if(N.size===0){t({title:"No users selected",description:"Select users to export",variant:"destructive"});return}i(!0);try{const de=n.filter(be=>N.has(be.id)),se="First Name,Last Name,Email,Phone,Trial Type,Status,Signup Date,Expiry Date",pe=de.map(be=>{const we=(be.name||"").split(" "),ve=we[0]||"",et=we.slice(1).join(" ")||"",Me=I(be)==="stripe"?"Credit Card Trial":"Free Trial (No CC)",Ie=P(be)?"Converted":F(be)?"Expired":"Active",$e=be.created_at?new Date(be.created_at).toLocaleDateString():"",Be=T(be)?new Date(T(be)).toLocaleDateString():"";return`"${ve}","${et}","${be.email}","${be.phone||""}","${Me}","${Ie}","${$e}","${Be}"`}),ne=[se,...pe].join(` `),me=new Blob([ne],{type:"text/csv"}),he=URL.createObjectURL(me),xe=document.createElement("a");xe.href=he,xe.download=`trial-users-${new Date().toISOString().split("T")[0]}.csv`,xe.click(),URL.revokeObjectURL(he);const Te=de.filter(be=>!be.already_exported).map(be=>({user_id:be.id,exported_by:e.id}));if(Te.length>0){const{error:be}=await Y.from("trial_email_exports").upsert(Te,{onConflict:"user_id"});be&&console.error("Error marking exports:",be)}t({title:"Export complete",description:`Downloaded ${de.length} trial user(s). ${Te.length} newly marked as exported.`}),k(new Set),M()}catch(de){console.error("Export error:",de),t({title:"Error",description:"Failed to export",variant:"destructive"})}finally{i(!1)}},G=n.filter(de=>!de.already_exported).length,Q=n.filter(de=>de.already_exported).length,ae=n.filter(de=>P(de)).length,oe=n.filter(de=>!F(de)&&!P(de)).length;return a?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(Wr,{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(kn,{children:"Total"}),r.jsx(Gt,{className:"text-2xl",children:n.length})]})}),r.jsx(He,{children:r.jsxs(Ht,{className:"pb-2",children:[r.jsx(kn,{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(kn,{children:"Active Trials"}),r.jsx(Gt,{className:"text-2xl",children:oe})]})}),r.jsx(He,{children:r.jsxs(Ht,{className:"pb-2",children:[r.jsx(kn,{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(kn,{children:"Already Exported"}),r.jsx(Gt,{className:"text-2xl text-muted-foreground",children:Q})]})})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsxs(hn,{value:v,onValueChange:de=>b(de),children:[r.jsx(cn,{className:"w-[160px]",children:r.jsx(fn,{})}),r.jsxs(dn,{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(hn,{value:u,onValueChange:de=>m(de),children:[r.jsx(cn,{className:"w-[180px]",children:r.jsx(fn,{})}),r.jsxs(dn,{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(hn,{value:x,onValueChange:de=>y(de),children:[r.jsx(cn,{className:"w-[160px]",children:r.jsx(fn,{})}),r.jsxs(dn,{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(X,{onClick:W,disabled:l||N.size===0,children:[l?r.jsx(Wr,{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(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:D.length===0?r.jsx(Nr,{children:r.jsx(yt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"No trial users match the current filters"})}):D.map(de=>{const se=I(de),pe=P(de),ne=F(de),me=T(de);return r.jsxs(Nr,{className:`hover:bg-muted/30 ${pe?"bg-primary/5":""}`,children:[r.jsx(yt,{children:r.jsx(_l,{checked:N.has(de.id),onCheckedChange:()=>V(de.id)})}),r.jsx(yt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[de.name,pe&&r.jsx(rh,{className:"h-3.5 w-3.5 text-primary"})]})}),r.jsx(yt,{className:"text-muted-foreground",children:de.email}),r.jsx(yt,{children:se==="stripe"?r.jsxs(Tt,{variant:"outline",className:"gap-1",children:[r.jsx(hf,{className:"h-3 w-3"}),"Credit Card"]}):r.jsxs(Tt,{variant:"secondary",className:"gap-1",children:[r.jsx(ks,{className:"h-3 w-3"}),"Free (No CC)"]})}),r.jsx(yt,{children:pe?r.jsxs(Tt,{className:"bg-primary/10 text-primary hover:bg-primary/20 gap-1",children:[r.jsx(rh,{className:"h-3 w-3"}),"Converted"]}):ne?r.jsx(Tt,{variant:"destructive",children:"Expired"}):r.jsx(Tt,{className:"bg-green-500/10 text-green-600 hover:bg-green-500/20",children:"Active Trial"})}),r.jsx(yt,{className:"text-sm",children:de.created_at?new Date(de.created_at).toLocaleDateString():"—"}),r.jsx(yt,{className:"text-sm",children:pe&&me?r.jsxs("span",{className:"text-muted-foreground",children:["Renews ",new Date(me).toLocaleDateString()]}):me?new Date(me).toLocaleDateString():"—"}),r.jsx(yt,{children:de.already_exported?r.jsx(no,{className:"h-4 w-4 text-muted-foreground"}):r.jsx(Tt,{variant:"outline",className:"text-green-600 border-green-300",children:"New"})})]},de.id)})})]})}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",D.length," of ",n.length," trial users · ",ae," converted to paid"]})]})},uSt=()=>{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(Wr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):e.length===0?r.jsx(He,{children:r.jsxs(Je,{className:"py-12 text-center text-muted-foreground",children:[r.jsx(Un,{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(Je,{children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:e.map(a=>r.jsxs(Nr,{children:[r.jsx(yt,{className:"whitespace-nowrap text-sm",children:ln(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(Tt,{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))})]})})]})},hSt=()=>{const e=Wn(),{user:t,isAdmin:n}=tn(),{startImpersonation:s,isLoading:a}=Lxe(),{toast:o}=pi(),[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(""),[Q,ae]=A.useState(1),[oe,de]=A.useState(50),[se,pe]=A.useState("all"),[ne,me]=A.useState("all"),[he,xe]=A.useState("all"),[Te,be]=A.useState("all"),[we,ve]=A.useState(!1),[et,Me]=A.useState(!1),[Ie,$e]=A.useState(null),[Be,Ve]=A.useState(null),[ot,At]=A.useState(!1),[Oe,at]=A.useState({name:"",email:"",brokerage_id:"",phone:""}),[le,qe]=A.useState(null),[Qe,rt]=A.useState(!1),[je,ut]=A.useState(""),[Ce,Ee]=A.useState(!1),[Ye,Le]=A.useState(!1),[Ke,tt]=A.useState(null),[ct,it]=A.useState(""),[zt,ir]=A.useState(!1),[Mr,Zr]=A.useState(!1),[Br,rn]=A.useState(null),[Zn,Ot]=A.useState(!1),[Gr,An]=A.useState(!1),[zn,ba]=A.useState(null),[gi,Mo]=A.useState(""),[Wa,ms]=A.useState(!1),[ra,fs]=A.useState({email:"",name:"",password:"",phone:""}),[Ys,Bs]=A.useState(!1),[Ni,or]=A.useState(!1),[La,oo]=A.useState(""),[ji,Hn]=A.useState(!1),[Ki,dc]=A.useState(!1),[go,uc]=A.useState(""),[nt,ye]=A.useState(new Set),[Pe,Ze]=A.useState(!1),[Nt,bt]=A.useState(!1),[It,qt]=A.useState(null),[Lt,Wt]=A.useState(!1),[fr,cr]=A.useState(null),[Xr,Mn]=A.useState([]),[Kr,cs]=A.useState([]),[ds,ns]=A.useState(!1),[Ws,$i]=A.useState({});A.useEffect(()=>{!t||!n||(wa(),To())},[t,n]);const jo=async()=>{try{const{data:kt,error:pr}=await Y.from("brokerage_manager_assignments").select("user_id, brokerage_id");if(pr)throw pr;const Pr={};for(const as of kt??[])Pr[as.brokerage_id]||(Pr[as.brokerage_id]=[]),Pr[as.brokerage_id].push(as.user_id);b(Pr)}catch(kt){console.error("Error loading brokerage manager assignments:",kt)}},wa=async()=>{try{k(!0);const{data:kt,error:pr}=await Y.functions.invoke("get-user-details");if(pr)throw pr;const Pr=kt.users||[];i(Pr),y(kt.brokerages||[]),await jo();const as=Pr.filter(is=>is.roles.includes("assistant"));if(as.length>0){const is=as.map(Ls=>Ls.id),{data:sa}=await Y.from("agent_assistant_assignments").select("agent_id, assistant_id").in("assistant_id",is);if(sa&&sa.length>0){const Ls=[...new Set(sa.map(cu=>cu.agent_id))],{data:ja}=await Y.from("profiles").select("id, name, email").in("id",Ls),Hh={};for(const cu of sa){const Il=ja==null?void 0:ja.find(ka=>ka.id===cu.agent_id);Il&&(Hh[cu.assistant_id]={agent_name:Il.name||"",agent_email:Il.email||""})}$i(Hh)}}}catch(kt){console.error("Error loading members:",kt),o({title:"Error",description:"Failed to load members",variant:"destructive"})}finally{k(!1)}},To=async()=>{try{const{data:kt,error:pr}=await Y.from("app_tiles").select("id, name, icon, app_id, required_tags").order("name");if(pr)throw pr;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:Pr}=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(Pr)throw Pr;o({title:"Success",description:"Member details updated successfully"}),$e(null),wa()}catch(Pr){console.error("Error updating member:",Pr),o({title:"Error",description:Pr.message||"Failed to update member",variant:"destructive"})}},na=async kt=>{try{const{data:{session:pr}}=await Y.auth.getSession(),Pr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${pr==null?void 0:pr.access_token}`},body:JSON.stringify({userId:kt})}),as=await Pr.json();if(!Pr.ok)throw new Error(as.error||"Failed to resend welcome email");o({title:"Success",description:"Welcome email sent successfully"})}catch(pr){console.error("Error resending welcome email:",pr),o({title:"Error",description:pr.message||"Failed to resend welcome email",variant:"destructive"})}},Li=async(kt,pr)=>{try{const{error:Pr}=await Y.functions.invoke("send-password-reset",{body:{email:kt,redirectTo:window.location.origin}});if(Pr)throw Pr;o({title:"Password Reset Sent",description:`Password reset email sent to ${pr}`})}catch(Pr){console.error("Error sending password reset:",Pr),o({title:"Error",description:Pr.message||"Failed to send password reset email",variant:"destructive"})}},Ga=async(kt,pr)=>{if(confirm(`Are you sure you want to delete ${pr}? This action cannot be undone.`))try{const{data:{session:Pr}}=await Y.auth.getSession(),as=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Pr==null?void 0:Pr.access_token}`},body:JSON.stringify({userId:kt})}),is=await as.json();if(!as.ok)throw new Error(is.error||"Failed to delete user");o({title:"Success",description:"User deleted successfully"}),wa()}catch(Pr){console.error("Error deleting user:",Pr),o({title:"Error",description:Pr.message||"Failed to delete user",variant:"destructive"})}},Ps=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(),pr=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)}),Pr=await pr.json();if(!pr.ok)throw new Error(Pr.error||"Failed to create user");if(F.role&&F.role!=="user"&&Pr.userId){const as=F.role==="brokerage_manager"?F.brokerage_id:void 0;await Oi(Pr.userId,F.role,"add",as)}o({title:"Success",description:`User ${F.email} created successfully`}),D({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),V(!1),wa()}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,pr,Pr,as)=>{try{const{data:{session:is}}=await Y.auth.getSession(),sa={userId:kt,role:pr,action:Pr};if(pr==="brokerage_manager"){if(!as){o({title:"Error",description:"Please choose a brokerage for this manager assignment",variant:"destructive"});return}sa.brokerageId=as}const Ls=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${is==null?void 0:is.access_token}`},body:JSON.stringify(sa)}),ja=await Ls.json();if(!Ls.ok)throw new Error(ja.error||"Failed to manage user role");o({title:"Success",description:`Role ${Pr==="add"?"added":"removed"} successfully`}),wa()}catch(is){console.error("Error managing user role:",is),o({title:"Error",description:is.message||"Failed to manage user role",variant:"destructive"})}},bl=(kt,pr)=>pr.length===0?!0:pr.some(Pr=>kt.includes(Pr)),El=async(kt,pr,Pr)=>{const as=`${kt}-${pr.id}`;qe(as);try{if(Pr){const is=l.find(Ls=>Ls.id===kt),sa=pr.required_tags.filter(Ls=>is==null?void 0:is.tags.includes(Ls));for(const Ls of sa){const{error:ja}=await Y.from("user_tags").delete().eq("user_id",kt).eq("tag",Ls);if(ja)throw ja}o({title:"Access Removed",description:`Removed access to ${pr.name}`})}else if(pr.required_tags.length>0){const{error:is}=await Y.from("user_tags").insert({user_id:kt,tag:pr.required_tags[0]});if(is)throw is;o({title:"Access Granted",description:`Granted access to ${pr.name}`})}await wa()}catch(is){console.error("Error toggling access:",is),o({title:"Error",description:is.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(Pr=>Pr.name.toLowerCase()===kt.toLowerCase())){o({title:"Error",description:"A brokerage with this name already exists",variant:"destructive"});return}Ee(!0);try{const{error:Pr}=await Y.from("brokerages").insert({name:kt});if(Pr)throw Pr;o({title:"Success",description:`Brokerage "${kt}" created successfully`}),ut(""),rt(!1),wa()}catch(Pr){console.error("Error creating brokerage:",Pr),o({title:"Error",description:Pr.message||"Failed to create brokerage",variant:"destructive"})}finally{Ee(!1)}},Am=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}ir(!0);try{const{error:pr}=await Y.from("brokerages").update({name:kt}).eq("id",Ke.id);if(pr)throw pr;o({title:"Success",description:"Brokerage updated successfully"}),Yo(),wa()}catch(pr){console.error("Error updating brokerage:",pr),o({title:"Error",description:pr.message||"Failed to update brokerage",variant:"destructive"})}finally{ir(!1)}},hc=async(kt,pr)=>{var Pr;if(!pr||typeof pr!="string"){o({title:"Error",description:"Please select a brokerage first",variant:"destructive"});return}try{const as={userId:kt,role:"brokerage_manager",action:"add",brokerageId:pr};console.debug("[assignManagerToBrokerage] payload",as);const{data:{session:is}}=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 ${is==null?void 0:is.access_token}`},body:JSON.stringify(as)}),Ls=await sa.json();if(!sa.ok&&!((Pr=Ls.error)!=null&&Pr.includes("duplicate")))throw new Error(Ls.error||"Failed to add role");o({title:"Success",description:"Manager assigned to brokerage"}),await wa()}catch(as){console.error("Error assigning manager:",as),o({title:"Error",description:as.message||"Failed to assign manager",variant:"destructive"})}},hh=kt=>{rn(kt),Zr(!0)},Xo=async()=>{if(Br){Ot(!0);try{const kt=l.filter(as=>as.brokerage_id===Br.id),{data:{session:pr}}=await Y.auth.getSession();for(const as of kt){const is=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${pr==null?void 0:pr.access_token}`},body:JSON.stringify({userId:as.id})});if(!is.ok){const sa=await is.json();console.error(`Failed to delete user ${as.email}:`,sa.error)}}const{error:Pr}=await Y.from("brokerages").delete().eq("id",Br.id);if(Pr)throw Pr;o({title:"Success",description:`Brokerage "${Br.name}" and ${kt.length} member(s) deleted`}),Zr(!1),rn(null),wa()}catch(kt){console.error("Error deleting brokerage:",kt),o({title:"Error",description:kt.message||"Failed to delete brokerage",variant:"destructive"})}finally{Ot(!1)}}},Mf=kt=>{ba(kt),Mo(""),An(!0)},Gp=()=>{ba(null),Mo(""),An(!1)},Yy=async kt=>{try{const{error:pr}=await Y.from("profiles").update({brokerage_id:null}).eq("id",kt);if(pr)throw pr;o({title:"Success",description:"User removed from brokerage"}),wa()}catch(pr){console.error("Error removing user from brokerage:",pr),o({title:"Error",description:pr.message||"Failed to remove user",variant:"destructive"})}},Xy=async(kt,pr)=>{try{const{error:Pr}=await Y.from("profiles").update({brokerage_id:pr}).eq("id",kt);if(Pr)throw Pr;o({title:"Success",description:"User added to brokerage"}),wa()}catch(Pr){console.error("Error adding user to brokerage:",Pr),o({title:"Error",description:Pr.message||"Failed to add user",variant:"destructive"})}},Qy=async()=>{if(!zn||!ra.email||!ra.name||!ra.password){o({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}Bs(!0);try{const{data:{session:kt}}=await Y.auth.getSession(),pr=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:zn.id,role:"user"})}),Pr=await pr.json();if(!pr.ok)throw new Error(Pr.error||"Failed to create agent");o({title:"Success",description:`Agent ${ra.email} created successfully`}),fs({email:"",name:"",password:"",phone:""}),ms(!1),wa()}catch(kt){console.error("Error creating agent:",kt),o({title:"Error",description:kt.message||"Failed to create agent",variant:"destructive"})}finally{Bs(!1)}},qh=kt=>l.filter(pr=>pr.brokerage_id===kt),Au=kt=>{const pr=qh(kt);if(!gi)return pr;const Pr=gi.toLowerCase();return pr.filter(as=>as.name.toLowerCase().includes(Pr)||as.email.toLowerCase().includes(Pr))},Qc=kt=>l.filter(pr=>pr.brokerage_id!==kt),lu=l.filter(kt=>{var pr;if(W){const Pr=W.toLowerCase();if(!(kt.name.toLowerCase().includes(Pr)||kt.email.toLowerCase().includes(Pr)||((pr=kt.brokerage_name)==null?void 0:pr.toLowerCase().includes(Pr))))return!1}return!(se==="claimed"&&!kt.claimed||se==="unclaimed"&&kt.claimed||ne!=="all"&&!kt.roles.includes(ne)||he==="trial"&&!kt.is_trial||he==="non-trial"&&kt.is_trial||Te==="none"&&kt.brokerage_id||Te!=="all"&&Te!=="none"&&kt.brokerage_id!==Te)}),mc=lu.length,Jc=oe===0,Ho=Jc?1:Math.ceil(mc/oe),Eu=Jc?0:(Q-1)*oe,Vh=Jc?mc:Eu+oe,Wd=lu.slice(Eu,Vh),Tf=kt=>{G(kt),ae(1)},Jy=kt=>{de(kt),ae(1)},ux=(kt,pr)=>{kt(pr),ae(1)},Af=async(kt,pr)=>{ve(!0);try{const Pr=l.find(Ls=>Ls.id===kt);if(!Pr)return;const as=Pr.trial_expires_at?new Date(Pr.trial_expires_at):new Date,is=new Date(as.getTime()+pr*24*60*60*1e3),{error:sa}=await Y.from("profiles").update({trial_expires_at:is.toISOString()}).eq("id",kt);if(sa)throw sa;o({title:"Trial Extended",description:`Trial extended by ${pr} days`}),wa()}catch(Pr){console.error("Error extending trial:",Pr),o({title:"Error",description:Pr.message||"Failed to extend trial",variant:"destructive"})}finally{ve(!1)}},vd=async kt=>{Me(!0);try{const{error:pr}=await Y.from("profiles").update({is_trial:!1,trial_expires_at:null,trial_started_at:null,trial_claimed_at:null}).eq("id",kt);if(pr)throw pr;o({title:"Account Converted",description:"User has been converted to a full account"}),wa(),Iu()}catch(pr){console.error("Error converting trial:",pr),o({title:"Error",description:pr.message||"Failed to convert account",variant:"destructive"})}finally{Me(!1)}},e0=async kt=>{ns(!0);try{const{data:pr}=await Y.from("agent_assistant_assignments").select("id, assistant_id, permissions").eq("agent_id",kt);if(pr&&pr.length>0){const as=pr.map(sa=>sa.assistant_id),{data:is}=await Y.from("profiles").select("id, name, email").in("id",as);Mn(pr.map(sa=>{const Ls=is==null?void 0:is.find(ja=>ja.id===sa.assistant_id);return{id:sa.id,assistant_id:sa.assistant_id,assistant_name:(Ls==null?void 0:Ls.name)||"Unknown",assistant_email:(Ls==null?void 0:Ls.email)||"",permissions:sa.permissions||{}}}))}else Mn([]);const{data:Pr}=await Y.from("agent_assistant_assignments").select("id, agent_id, permissions").eq("assistant_id",kt);if(Pr&&Pr.length>0){const as=Pr.map(sa=>sa.agent_id),{data:is}=await Y.from("profiles").select("id, name, email").in("id",as);cs(Pr.map(sa=>{const Ls=is==null?void 0:is.find(ja=>ja.id===sa.agent_id);return{id:sa.id,agent_id:sa.agent_id,agent_name:(Ls==null?void 0:Ls.name)||"Unknown",agent_email:(Ls==null?void 0:Ls.email)||"",permissions:sa.permissions||{}}}))}else cs([])}catch(pr){console.error("Error loading assistant data:",pr)}finally{ns(!1)}},Em=kt=>{Ve(kt),at({name:kt.name,email:kt.email,brokerage_id:kt.brokerage_id||"",phone:kt.phone||""}),At(!0),e0(kt.id)},Iu=()=>{Ve(null),At(!1),at({name:"",email:"",brokerage_id:"",phone:""})},t5=async()=>{Be&&(await Pi(Be.id),Iu())},Rk=kt=>{ye(pr=>{const Pr=new Set(pr);return Pr.has(kt)?Pr.delete(kt):Pr.add(kt),Pr})},hx=()=>{if(nt.size===Wd.length&&Wd.every(kt=>nt.has(kt.id))){const kt=new Set(nt);Wd.forEach(pr=>kt.delete(pr.id)),ye(kt)}else{const kt=new Set(nt);Wd.forEach(pr=>kt.add(pr.id)),ye(kt)}},Xs=()=>{ye(new Set)},t0=async()=>{if(nt.size===0)return;Ze(!0);let kt=0,pr=0;try{const{data:{session:Pr}}=await Y.auth.getSession();for(const as of nt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Pr==null?void 0:Pr.access_token}`},body:JSON.stringify({userId:as})})).ok?kt++:pr++}catch{pr++}o({title:"Bulk Email Complete",description:`Sent ${kt} emails${pr>0?`, ${pr} failed`:""}`}),Xs()}catch(Pr){o({title:"Error",description:Pr.message||"Failed to send emails",variant:"destructive"})}finally{Ze(!1)}},Rv=async()=>{if(nt.size===0)return;Ze(!0);let kt=0,pr=0;try{const{data:{session:Pr}}=await Y.auth.getSession();for(const as of nt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/send-password-reset",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Pr==null?void 0:Pr.access_token}`},body:JSON.stringify({userId:as})})).ok?kt++:pr++}catch{pr++}o({title:"Bulk Password Reset Complete",description:`Sent ${kt} reset emails${pr>0?`, ${pr} failed`:""}`}),Xs()}catch(Pr){o({title:"Error",description:Pr.message||"Failed to send password reset emails",variant:"destructive"})}finally{Ze(!1)}},Fk=async()=>{if(nt.size===0)return;const kt=l.filter(is=>nt.has(is.id)).map(is=>is.name).slice(0,5).join(", "),pr=nt.size>5?` and ${nt.size-5} more`:"";if(!confirm(`Are you sure you want to delete ${nt.size} users (${kt}${pr})? This action cannot be undone.`))return;Ze(!0);let Pr=0,as=0;try{const{data:{session:is}}=await Y.auth.getSession();for(const sa of nt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${is==null?void 0:is.access_token}`},body:JSON.stringify({userId:sa})})).ok?Pr++:as++}catch{as++}o({title:"Bulk Delete Complete",description:`Deleted ${Pr} users${as>0?`, ${as} failed`:""}`}),Xs(),wa()}catch(is){o({title:"Error",description:is.message||"Failed to delete users",variant:"destructive"})}finally{Ze(!1)}},zk=async()=>{bt(!0);try{const{data:{session:kt}}=await Y.auth.getSession(),pr=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(!pr.ok){const as=await pr.json();throw new Error(as.error||"Failed to sync phones")}const Pr=await pr.json();o({title:"Phone Sync Complete",description:`Pulled ${Pr.summary.pulledFromGHL} from GHL, pushed ${Pr.summary.pushedToGHL} to GHL, ${Pr.summary.alreadySynced} already synced`}),wa()}catch(kt){o({title:"Error",description:kt.message||"Failed to sync phones with GHL",variant:"destructive"})}finally{bt(!1)}},Im=async(kt,pr)=>{qt(kt);try{const{data:{session:Pr}}=await Y.auth.getSession(),{data:as}=await Y.from("profiles").select("phone").eq("id",kt).single(),is=(as==null?void 0:as.phone)||"",sa=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/ghl-tag-sync",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Pr==null?void 0:Pr.access_token}`},body:JSON.stringify({email:pr,action:"update",phone:is||void 0})});if(!sa.ok){const ja=await sa.json();throw new Error(ja.error||"Failed to sync with GHL")}const Ls=await fetch(`https://services.leadconnectorhq.com/contacts/lookup?locationId=&email=${encodeURIComponent(pr)}`,{method:"GET",headers:{"Content-Type":"application/json"}});o({title:"Phone Synced",description:is?`Phone ${is} synced to GHL`:"Sync attempted - run bulk sync to pull phone from GHL"}),wa()}catch(Pr){o({title:"Error",description:Pr.message||"Failed to sync phone",variant:"destructive"})}finally{qt(null)}},Kp=async kt=>{await s(kt)},mx=()=>{if(nt.size===0){o({title:"No members selected",description:"Please select members to export",variant:"destructive"});return}const kt=l.filter(ja=>nt.has(ja.id)),pr=["Name","Email","Phone","Brokerage","Roles","Status","Created At"],Pr=kt.map(ja=>[ja.name,ja.email,ja.phone||"",ja.brokerage_name||"",ja.roles.join("; "),ja.claimed?"Claimed":"Unclaimed",new Date(ja.created_at).toLocaleDateString()]),as=[pr.join(","),...Pr.map(ja=>ja.map(Hh=>`"${(Hh||"").replace(/"/g,'""')}"`).join(","))].join(` `),is=new Blob([as],{type:"text/csv"}),sa=URL.createObjectURL(is),Ls=document.createElement("a");Ls.href=sa,Ls.download=`members-export-${new Date().toISOString().split("T")[0]}.csv`,Ls.click(),URL.revokeObjectURL(sa),o({title:"Export complete",description:`Exported ${kt.length} member(s)`})};return N?r.jsx(Dr,{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(Dr,{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(X,{size:"sm",variant:"outline",onClick:zk,disabled:Nt,children:[Nt?r.jsx(Wr,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(Ii,{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(X,{size:"sm",variant:"outline",onClick:()=>or(!0),children:[r.jsx(H1,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Import CSV"}),r.jsx("span",{className:"sm:hidden",children:"Import"})]}),r.jsxs(Or,{open:U,onOpenChange:V,children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{size:"sm",children:[r.jsx(nh,{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(Lr,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Create New User"}),r.jsx(Qn,{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(hn,{value:F.brokerage_id||"none",onValueChange:kt=>D({...F,brokerage_id:kt==="none"?"":kt}),children:[r.jsx(cn,{id:"brokerage",children:r.jsx(fn,{placeholder:F.role==="brokerage_manager"?"Select brokerage":"Select brokerage (optional)"})}),r.jsxs(dn,{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(hn,{value:F.role,onValueChange:kt=>D({...F,role:kt}),children:[r.jsx(cn,{id:"role",children:r.jsx(fn,{placeholder:"Select role"})}),r.jsxs(dn,{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(hn,{value:F.trial_days||"none",onValueChange:kt=>D({...F,trial_days:kt==="none"?"":kt}),children:[r.jsx(cn,{id:"trial_days",children:r.jsx(fn,{placeholder:"No trial (full access)"})}),r.jsxs(dn,{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(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>V(!1),children:"Cancel"}),r.jsx(X,{onClick:Ps,disabled:T,children:T?"Creating...":"Create User"})]})]})]})]})]}),r.jsxs(ki,{defaultValue:"members",className:"space-y-6",children:[r.jsxs(wi,{children:[r.jsx(an,{value:"members",children:"Members"}),r.jsx(an,{value:"brokerages",children:"Brokerages"}),r.jsx(an,{value:"trials",children:"Trial Users"}),r.jsx(an,{value:"access",children:"Access Matrix"}),r.jsx(an,{value:"celebrations",children:"Celebrations"}),r.jsx(an,{value:"deletions",children:"Deletion Log"})]}),r.jsxs(Cn,{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(hn,{value:se,onValueChange:kt=>ux(pe,kt),children:[r.jsx(cn,{className:"w-[130px] h-9",children:r.jsx(fn,{})}),r.jsxs(dn,{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(hn,{value:ne,onValueChange:kt=>ux(me,kt),children:[r.jsx(cn,{className:"w-[130px] h-9",children:r.jsx(fn,{})}),r.jsxs(dn,{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(hn,{value:he,onValueChange:kt=>ux(xe,kt),children:[r.jsx(cn,{className:"w-[130px] h-9",children:r.jsx(fn,{})}),r.jsxs(dn,{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(hn,{value:Te,onValueChange:kt=>ux(be,kt),children:[r.jsx(cn,{className:"w-[150px] h-9",children:r.jsx(fn,{})}),r.jsxs(dn,{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||se!=="all"||ne!=="all"||he!=="all"||Te!=="all")&&r.jsxs(X,{variant:"ghost",size:"sm",className:"h-9",onClick:()=>{G(""),pe("all"),me("all"),xe("all"),be("all"),ae(1)},children:[r.jsx(us,{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(Vh,mc)} of ${mc} members`}),r.jsxs(hn,{value:oe.toString(),onValueChange:kt=>Jy(Number(kt)),children:[r.jsx(cn,{className:"h-9 w-[110px]",children:r.jsx(fn,{})}),r.jsxs(dn,{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"})]})]})]})]}),nt.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(X0,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"text-sm font-medium",children:[nt.size," selected"]})]}),r.jsx("div",{className:"flex-1"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs(X,{size:"sm",variant:"outline",onClick:t0,disabled:Pe,children:[Pe?r.jsx(Wr,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(ks,{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(X,{size:"sm",variant:"outline",onClick:Rv,disabled:Pe,children:[Pe?r.jsx(Wr,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(gm,{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(X,{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(X,{size:"sm",variant:"destructive",onClick:Fk,disabled:Pe,children:[Pe?r.jsx(Wr,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(Un,{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(X,{size:"sm",variant:"ghost",onClick:Xs,disabled:Pe,children:r.jsx(us,{className:"h-4 w-4"})})]})]}),r.jsx("div",{className:"border rounded-lg bg-card overflow-hidden",children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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=>nt.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(zs,{children:Wd.length===0?r.jsx(Nr,{children:r.jsx(yt,{colSpan:7,className:"text-center py-12 text-muted-foreground",children:"No members found"})}):Wd.map(kt=>r.jsxs(Nr,{className:`hover:bg-muted/30 ${nt.has(kt.id)?"bg-primary/5":""}`,children:[r.jsx(yt,{children:r.jsx(_l,{checked:nt.has(kt.id),onCheckedChange:()=>Rk(kt.id),"aria-label":`Select ${kt.name}`})}),r.jsx(yt,{children:r.jsxs("div",{children:[r.jsx("button",{onClick:()=>Em(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(Tt,{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(q4e,{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(Tt,{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(X,{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(X,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Em(kt),title:"Edit member",children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Im(kt.id,kt.email),disabled:It===kt.id,title:"Sync phone with GHL",children:It===kt.id?r.jsx(Wr,{className:"h-4 w-4 animate-spin"}):r.jsx(Ii,{className:"h-4 w-4"})}),r.jsx(X,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>na(kt.id),title:"Resend welcome email",children:r.jsx(ks,{className:"h-4 w-4"})}),r.jsx(X,{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(X,{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(Wr,{className:"h-4 w-4 animate-spin"}):r.jsx(A4,{className:"h-4 w-4"})}),r.jsx(X,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>Ga(kt.id,kt.name),title:"Delete user",children:r.jsx(Un,{className:"h-4 w-4"})})]})})]},kt.id))})]})}),Ho>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 ",Q," of ",Ho]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(X,{variant:"outline",size:"sm",onClick:()=>ae(1),disabled:Q===1,children:"First"}),r.jsx(X,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ae(kt=>Math.max(1,kt-1)),disabled:Q===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,Ho)},(kt,pr)=>{let Pr;return Ho<=5||Q<=3?Pr=pr+1:Q>=Ho-2?Pr=Ho-4+pr:Pr=Q-2+pr,r.jsx(X,{variant:Q===Pr?"default":"outline",size:"sm",className:"h-8 w-8 p-0",onClick:()=>ae(Pr),children:Pr},Pr)})}),r.jsx(X,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ae(kt=>Math.min(Ho,kt+1)),disabled:Q===Ho,children:r.jsx(Gi,{className:"h-4 w-4"})}),r.jsx(X,{variant:"outline",size:"sm",onClick:()=>ae(Ho),disabled:Q===Ho,children:"Last"})]})]})]}),r.jsx(Or,{open:ot,onOpenChange:At,children:r.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Edit Member"}),r.jsx(Qn,{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(hn,{value:Oe.brokerage_id||"none",onValueChange:kt=>at({...Oe,brokerage_id:kt==="none"?"":kt}),children:[r.jsx(cn,{id:"edit-brokerage",children:r.jsx(fn,{placeholder:"Select brokerage"})}),r.jsxs(dn,{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(Tt,{variant:"default",className:"gap-1",children:[r.jsx(_m,{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(us,{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(hn,{onValueChange:kt=>Oi(Be.id,kt,"add"),children:[r.jsx(cn,{className:"w-[200px]",children:r.jsx(fn,{placeholder:"Add role..."})}),r.jsxs(dn,{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(qn,{className:"h-4 w-4"}),"Assistant Relationships"]}),ds?r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Wr,{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(Tt,{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(([,pr])=>pr).map(([pr])=>r.jsx(Tt,{variant:"secondary",className:"text-[10px] capitalize",children:pr},pr))})]},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(Tt,{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(([,pr])=>pr).map(([pr])=>r.jsx(Tt,{variant:"secondary",className:"text-[10px] capitalize",children:pr},pr))})]},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 pr=bl(Be.tags,kt.required_tags),Pr=`${Be.id}-${kt.id}`,as=le===Pr,is=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}),is&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Available to all members"})]})]}),r.jsx("div",{className:"flex items-center gap-2",children:as?r.jsx(Wr,{className:"h-4 w-4 animate-spin text-muted-foreground"}):is?r.jsx(Tt,{variant:"secondary",className:"text-xs",children:"Always On"}):r.jsx(Is,{checked:pr,onCheckedChange:()=>El(Be.id,kt,pr)})})]},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(Qa,{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(q4e,{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(X,{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(X,{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(X,{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(X,{size:"sm",variant:"default",onClick:()=>vd(Be.id),disabled:et,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(Hs,{children:[r.jsx(X,{variant:"outline",onClick:Iu,children:"Cancel"}),r.jsx(X,{onClick:t5,children:"Save Changes"})]})]})}),r.jsxs(Cn,{value:"access",children:[u.length===0?r.jsx(He,{children:r.jsxs(Je,{className:"py-12 text-center",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"No apps configured yet"}),r.jsx(X,{onClick:()=>e("/admin/apps"),children:"Configure Apps"})]})}):r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsx(Gt,{children:"Member Access Matrix"}),r.jsx(kn,{children:"Toggle switches to grant or revoke app access for each member"})]}),r.jsxs(Je,{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(pr=>{const Pr=bl(kt.tags,pr.required_tags),as=`${kt.id}-${pr.id}`,is=le===as;return r.jsx("td",{className:"p-4 text-center",children:r.jsx("div",{className:"flex items-center justify-center",children:is?r.jsx(Wr,{className:"h-5 w-5 animate-spin text-muted-foreground"}):r.jsx(Is,{checked:Pr,onCheckedChange:()=>El(kt.id,pr,Pr),disabled:pr.required_tags.length===0})})},pr.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"})})]})]})}),Ho>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(Vh,mc)," of ",mc," • Page ",Q," of ",Ho]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(X,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ae(kt=>Math.max(1,kt-1)),disabled:Q===1,children:r.jsx(kc,{className:"h-4 w-4"})}),r.jsx(X,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ae(kt=>Math.min(Ho,kt+1)),disabled:Q===Ho,children:r.jsx(Gi,{className:"h-4 w-4"})})]})]})]})]}),r.jsx("div",{className:"mt-6",children:r.jsx(X,{variant:"outline",onClick:()=>e("/admin/apps"),children:"Manage Apps"})})]}),r.jsxs(Cn,{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:La,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(La.toLowerCase())).length," of ",x.length," brokerages"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(X,{size:"sm",variant:"outline",onClick:()=>{const kt=[];for(const Ls of x){const ja=v[Ls.id]??[];for(const Hh of ja){const cu=l.find(Il=>Il.id===Hh);if(cu){const Il=(cu.name||"").trim().split(/\s+/),ka=Il[0]||"",Bk=Il.slice(1).join(" ")||"";kt.push({firstName:ka,lastName:Bk,email:cu.email,brokerageName:Ls.name})}}}if(kt.length===0){o({title:"No managers found to export"});return}const Pr=[["First Name","Last Name","Email","Brokerage Name"].join(","),...kt.map(Ls=>[Ls.firstName,Ls.lastName,Ls.email,Ls.brokerageName].map(ja=>`"${(ja||"").replace(/"/g,'""')}"`).join(","))].join(` `),as=new Blob([Pr],{type:"text/csv"}),is=URL.createObjectURL(as),sa=document.createElement("a");sa.href=is,sa.download=`brokerage-managers-${new Date().toISOString().slice(0,10)}.csv`,sa.click(),URL.revokeObjectURL(is),o({title:`Exported ${kt.length} managers`})},children:[r.jsx(so,{className:"mr-2 h-4 w-4"}),"Export Managers"]}),r.jsxs(Or,{open:Qe,onOpenChange:rt,children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{size:"sm",children:[r.jsx(mi,{className:"mr-2 h-4 w-4"}),"Add Brokerage"]})}),r.jsxs(Lr,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Create New Brokerage"}),r.jsx(Qn,{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(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>rt(!1),children:"Cancel"}),r.jsx(X,{onClick:Xc,disabled:Ce,children:Ce?"Creating...":"Create Brokerage"})]})]})]})]})]}),r.jsx("div",{className:"border rounded-lg bg-card overflow-hidden",children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:(()=>{const kt=x.filter(pr=>pr.name.toLowerCase().includes(La.toLowerCase()));return kt.length===0?r.jsx(Nr,{children:r.jsx(yt,{colSpan:4,className:"text-center py-12 text-muted-foreground",children:La?"No brokerages match your search":"No brokerages found"})}):kt.map(pr=>{const Pr=l.filter(Ls=>Ls.brokerage_id===pr.id),is=(v[pr.id]??[]).map(Ls=>l.find(ja=>ja.id===Ls)).filter(Boolean),sa=Pr.length;return r.jsxs(Nr,{className:"hover:bg-muted/30",children:[r.jsx(yt,{children:r.jsx("button",{onClick:()=>Am(pr),className:"text-primary hover:underline font-medium",children:pr.name})}),r.jsx(yt,{children:is.length>0?r.jsx("div",{className:"flex flex-wrap gap-1",children:is.map(Ls=>r.jsx(Tt,{variant:"secondary",className:"text-xs",children:Ls.name},Ls.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(X,{size:"sm",variant:"outline",className:"h-8",onClick:()=>Mf(pr),children:[r.jsx(qn,{className:"h-4 w-4 mr-1"}),"Manage"]}),r.jsx(X,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Am(pr),title:"Edit brokerage",children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>hh(pr),title:"Delete brokerage",children:r.jsx(Un,{className:"h-4 w-4"})})]})})]},pr.id)})})()})]})}),r.jsx(Or,{open:Ye,onOpenChange:Le,children:r.jsxs(Lr,{className:"max-w-lg",children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Edit Brokerage"}),r.jsx(Qn,{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 pr=(v[Ke.id]??[]).map(Pr=>l.find(as=>as.id===Pr)).filter(Boolean);return pr.length===0?r.jsx("span",{className:"text-sm text-muted-foreground",children:"No managers assigned"}):pr.map(Pr=>r.jsxs(Tt,{variant:"default",className:"gap-1",children:[r.jsx(_m,{className:"h-3 w-3"}),Pr.name,r.jsx("button",{onClick:()=>Oi(Pr.id,"brokerage_manager","remove",Ke.id),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove manager from this brokerage",children:r.jsx(us,{className:"h-3 w-3"})})]},Pr.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:ji,onOpenChange:Hn,children:[r.jsx(Gc,{asChild:!0,children:r.jsxs(X,{variant:"outline",role:"combobox","aria-expanded":ji,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(Ly,{children:[r.jsx(Oy,{placeholder:"Search by name or email..."}),r.jsxs(Dy,{className:"max-h-[200px]",children:[r.jsx(Ry,{children:"No members found."}),r.jsx(Fy,{children:(()=>{const kt=new Set(v[Ke.id]??[]);return l.filter(pr=>!kt.has(pr.id)&&(n||pr.brokerage_id===Ke.id)).map(pr=>r.jsxs(zy,{value:`${pr.name} ${pr.email}`,onSelect:()=>{hc(pr.id,Ke.id),Hn(!1)},children:[pr.name," (",pr.email,")"]},pr.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(Tt,{variant:"outline",className:"text-xs",children:"Manager"})]},kt.id))})]})]}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:Yo,children:"Cancel"}),r.jsx(X,{onClick:Hd,disabled:zt,children:zt?"Saving...":"Save Changes"})]})]})}),r.jsx(Or,{open:Mr,onOpenChange:Zr,children:r.jsxs(Lr,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{className:"text-destructive",children:"Delete Brokerage"}),r.jsxs(Qn,{children:['Are you sure you want to delete "',Br==null?void 0:Br.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 "',Br==null?void 0:Br.name,'"']}),r.jsxs("li",{children:["All ",l.filter(kt=>kt.brokerage_id===(Br==null?void 0:Br.id)).length," member(s) assigned to this brokerage"]}),r.jsx("li",{children:"All their data, roles, and access"})]})]})}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>Zr(!1),children:"Cancel"}),r.jsx(X,{variant:"destructive",onClick:Xo,disabled:Zn,children:Zn?"Deleting...":"Yes, Delete Brokerage"})]})]})}),r.jsx(Or,{open:Gr,onOpenChange:An,children:r.jsxs(Lr,{className:"max-w-4xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(mi,{className:"h-5 w-5"}),"Manage ",zn==null?void 0:zn.name]}),r.jsx(Qn,{children:"Add, remove, or manage users in this brokerage"})]}),zn&&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:gi,onChange:kt=>Mo(kt.target.value),className:"pl-10 h-9"})]}),r.jsxs(Or,{open:Wa,onOpenChange:ms,children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{size:"sm",children:[r.jsx(nh,{className:"h-4 w-4 mr-1"}),"Add New Agent"]})}),r.jsxs(Lr,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Add New Agent"}),r.jsxs(Qn,{children:["Create a new agent for ",zn.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=>fs({...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=>fs({...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=>fs({...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=>fs({...ra,phone:kt.target.value})})]})]}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>ms(!1),children:"Cancel"}),r.jsx(X,{onClick:Qy,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(X,{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(Ly,{children:[r.jsx(Oy,{placeholder:"Search users...",value:go,onValueChange:uc}),r.jsxs(Dy,{children:[r.jsx(Ry,{children:"No users found."}),r.jsx(Fy,{children:Qc(zn.id).filter(kt=>go===""||kt.name.toLowerCase().includes(go.toLowerCase())||kt.email.toLowerCase().includes(go.toLowerCase())).map(kt=>r.jsxs(zy,{value:`${kt.name} ${kt.email}`,onSelect:()=>{Xy(kt.id,zn.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(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:Au(zn.id).length===0?r.jsx(Nr,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:gi?"No matching members found":"No members in this brokerage"})}):Au(zn.id).map(kt=>r.jsxs(Nr,{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(Tt,{variant:"default",className:"bg-green-500/10 text-green-600 hover:bg-green-500/20",children:"Active"}):r.jsx(Tt,{variant:"secondary",children:"Pending"})}),r.jsx(yt,{children:kt.roles.includes("brokerage_manager")?r.jsxs(Tt,{variant:"outline",className:"gap-1",children:[r.jsx(_m,{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(X,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>na(kt.id),title:"Resend welcome email",children:r.jsx(ks,{className:"h-4 w-4"})}),r.jsx(X,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Yy(kt.id),title:"Remove from brokerage",children:r.jsx(us,{className:"h-4 w-4"})}),r.jsx(X,{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(Wr,{className:"h-4 w-4 animate-spin"}):r.jsx(A4,{className:"h-4 w-4"})}),r.jsx(X,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>Ga(kt.id,kt.name),title:"Delete user",children:r.jsx(Un,{className:"h-4 w-4"})})]})})]},kt.id))})]})}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[qh(zn.id).length," total member",qh(zn.id).length!==1?"s":""," •",qh(zn.id).filter(kt=>kt.roles.includes("brokerage_manager")).length," manager",qh(zn.id).filter(kt=>kt.roles.includes("brokerage_manager")).length!==1?"s":""]})]}),r.jsx(Hs,{children:r.jsx(X,{variant:"outline",onClick:Gp,children:"Close"})})]})})]}),r.jsx(Cn,{value:"trials",children:r.jsx(dSt,{})}),r.jsx(Cn,{value:"celebrations",children:r.jsx(cSt,{})}),r.jsx(Cn,{value:"deletions",children:r.jsx(uSt,{})})]})]}),r.jsx(q9e,{open:Ni,onOpenChange:or,brokerages:x,onSuccess:wa}),fr&&r.jsx(V9e,{open:Lt,onOpenChange:kt=>{Wt(kt),kt||cr(null)},userId:fr.id,userName:fr.name})]})},mSt=()=>{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(Dr,{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(kn,{children:["Share link: ",r.jsx("code",{className:"bg-muted px-2 py-1 rounded text-sm",children:F})]})]}),r.jsx(Je,{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(X,{type:"submit",disabled:a,children:[a?r.jsx(Wr,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Create"]})]})})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{children:"Active Codes"})}),r.jsx(Je,{children:n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Wr,{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(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:e.map(D=>r.jsxs(Nr,{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:ln(new Date(D.created_at),"MMM d, yyyy")}),r.jsx(yt,{children:r.jsx(Is,{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(X,{variant:"ghost",size:"icon",onClick:()=>P(D.code),title:"Copy invite link",children:r.jsx(Oo,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>I(D.id),className:"text-destructive hover:text-destructive",title:"Delete code",children:r.jsx(Un,{className:"h-4 w-4"})})]})})]},D.id))})]})})]})]})})},Dae=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}},bP=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}}},fSt=async(e,t)=>await Dae("new_templates")?bP({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}),pSt=async(e,t)=>bP({title:"New Academy Video",body:`New video added: ${e}`,url:`/academy/${t}`}),gSt=async(e,t)=>await Dae("new_events")?bP({title:"New Event",body:`New event: ${e}`,url:`/events/${t}`}):(console.log("New event notifications are disabled"),{success:!1,skipped:!0}),xSt=async(e,t)=>await Dae("new_toolbox")?bP({title:"New Resource Kit",body:`New resource kit available: ${e}`,url:`/toolbox/${t}`}):(console.log("New toolbox notifications are disabled"),{success:!1,skipped:!0}),gfe=async(e,t)=>await Dae("new_social_swag")?bP({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}),MO={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 ySt(){const e=Wn(),t=qr(),[n,s]=A.useState(!1),[a,o]=A.useState(null),[l,i]=A.useState(MO),[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,Q]=A.useState(!0),[ae,oe]=A.useState(""),{data:de,isLoading:se}=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:pe}=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:ne,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 Ye=new Map((Ee==null?void 0:Ee.map(Le=>[Le.id,Le]))||[]);return je.map(Le=>({...Le,profiles:Le.user_id&&Ye.get(Le.user_id)||null}))},enabled:!!I}),{data:he,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:Ye}=await Y.from("agent_points").select("user_id").eq("event_id",I.id),Le=new Set((Ye==null?void 0:Ye.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)},be=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})}),Ye=await Ee.json();if(!Ee.ok)throw new Error(Ye.error||"Failed to send reminders");return Ye},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:et}=Zt({queryKey:["all-profiles-for-linking"],queryFn:async()=>{let je=[],ut=0;const Ce=1e3;for(;;){const{data:Ee,error:Ye}=await Y.from("profiles").select("id, name, email").order("name",{ascending:!0}).range(ut,ut+Ce-1);if(Ye)throw Ye;if(!Ee||Ee.length===0||(je=[...je,...Ee],Ee.length{const{error:Ye}=await Y.from("event_attendees").update({user_id:ut}).eq("id",je);if(Ye)throw Ye;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),Q(!0),oe(""),F(!0)},$e=()=>{!D||!V||Me.mutate({attendeeId:D.id,userId:V,zoomEmail:D.zoom_email,shouldSaveAlias:G})},Be=(et==null?void 0:et.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:Ye}=await Y.storage.from("event-images").upload(Ee,je);if(Ye)throw Ye;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))}},At=()=>{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,Ye]=je.event_time.split(":");Ce.setHours(parseInt(Ee),parseInt(Ye));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=zh(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&&gSt(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(MO),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),[Ye,Le]=ut.event_time.split(":");Ee.setHours(parseInt(Ye),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(MO),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:ln(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)},Qe=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)},rt=()=>{s(!1),o(null),i(MO),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(X,{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(Or,{open:n,onOpenChange:je=>!je&&rt(),children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{onClick:()=>s(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Event"]})}),r.jsxs(Lr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Fr,{children:a?"Edit Event":"Create New Event"})}),r.jsxs("form",{onSubmit:Qe,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(X,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:At,children:r.jsx(us,{className:"h-4 w-4"})})]}):r.jsxs(X,{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(X,{variant:"outline",className:Ut("w-full justify-start text-left font-normal",!l.event_date&&"text-muted-foreground"),children:[r.jsx(Ts,{className:"mr-2 h-4 w-4"}),l.event_date?ln(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(wA,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ze,{htmlFor:"is_recurring",children:"Recurring Event"})]}),r.jsx(Is,{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(hn,{value:l.recurrence_pattern,onValueChange:je=>i({...l,recurrence_pattern:je}),children:[r.jsx(cn,{children:r.jsx(fn,{})}),r.jsxs(dn,{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(X,{variant:"outline",className:Ut("w-full justify-start text-left font-normal",!l.recurrence_end_date&&"text-muted-foreground"),children:[r.jsx(Ts,{className:"mr-2 h-4 w-4"}),l.recurrence_end_date?ln(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):zh(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(Is,{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(X,{type:"button",variant:"outline",onClick:rt,className:"flex-1",children:"Cancel"}),r.jsx(X,{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(Je,{children:se?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading events..."}):(de==null?void 0:de.length)===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No events yet. Create your first event!"}):r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:de==null?void 0:de.map(je=>r.jsxs(Nr,{children:[r.jsx(yt,{className:"font-medium",children:je.title}),r.jsx(yt,{children:ln(new Date(je.event_date),"PPP p")}),r.jsx(yt,{children:r.jsxs(X,{variant:"ghost",size:"sm",className:"gap-1",onClick:()=>Te(je),children:[r.jsx(qn,{className:"h-4 w-4"}),(pe==null?void 0:pe[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(X,{variant:"ghost",size:"icon",onClick:()=>window.open(je.zoom_link,"_blank"),title:"Open Zoom Link",children:r.jsx(Ms,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>qe(je),children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this event?")&&le.mutate(je.id)},children:r.jsx(Un,{className:"h-4 w-4 text-destructive"})})]})})]},je.id))})]})})]}),r.jsx(Or,{open:k,onOpenChange:M,children:r.jsxs(Lr,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(qn,{className:"h-5 w-5"}),I==null?void 0:I.title]}),r.jsx(Qn,{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(X,{variant:"ghost",size:"sm",onClick:()=>ve.mutate({eventId:I.id,testMode:!0}),disabled:ve.isPending,children:[r.jsx(ks,{className:Ut("h-4 w-4 mr-2",ve.isPending&&"animate-spin")}),"Send Test to Me"]}),r.jsxs(X,{variant:"outline",size:"sm",onClick:()=>ve.mutate({eventId:I.id}),disabled:ve.isPending||!(ne!=null&&ne.length),children:[r.jsx(ks,{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(X,{variant:"outline",size:"sm",onClick:()=>be.mutate(I.id),disabled:be.isPending,children:[r.jsx(Wo,{className:Ut("h-4 w-4 mr-2",be.isPending&&"animate-spin")}),be.isPending?"Syncing...":"Sync Registrations"]}),r.jsxs(X,{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(ki,{defaultValue:"registrations",className:"w-full",children:[r.jsxs(wi,{className:"grid w-full grid-cols-2",children:[r.jsxs(an,{value:"registrations",className:"gap-2",children:[r.jsx(qn,{className:"h-4 w-4"}),"Registrations (",(ne==null?void 0:ne.length)||0,")"]}),r.jsxs(an,{value:"attendees",className:"gap-2",children:[r.jsx(no,{className:"h-4 w-4"}),"Attendees (",(he==null?void 0:he.length)||0,")"]})]}),r.jsx(Cn,{value:"registrations",className:"mt-4",children:me?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading registrations..."}):(ne==null?void 0:ne.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(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{children:[r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{children:"Registered"}),r.jsx(Mt,{children:"Status"})]})}),r.jsx(zs,{children:ne==null?void 0:ne.map(je=>{var Ye,Le;const ut=((Ye=je.profiles)==null?void 0:Ye.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(Nr,{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(ks,{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:ln(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(Cn,{value:"attendees",className:"mt-4",children:xe?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading attendees..."}):(he==null?void 0:he.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:[(he==null?void 0:he.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 (",he==null?void 0:he.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:he==null?void 0:he.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(X,{variant:"outline",size:"sm",onClick:()=>Ie(je),className:"gap-1",children:[r.jsx(xm,{className:"h-3 w-3"}),"Link to Profile"]})]},je.id))})]}),r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{children:[r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{children:"Duration"}),r.jsx(Mt,{children:"Points"})]})}),r.jsx(zs,{children:he==null?void 0:he.filter(je=>je.user_id).map(je=>{var Ee,Ye;const ut=((Ee=je.profiles)==null?void 0:Ee.name)||je.zoom_name||"Unknown",Ce=((Ye=je.profiles)==null?void 0:Ye.email)||je.zoom_email||null;return r.jsxs(Nr,{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(ks,{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(Qa,{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(Or,{open:P,onOpenChange:F,children:r.jsxs(Lr,{className:"max-w-md",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(xm,{className:"h-5 w-5"}),"Link Attendee to Profile"]}),r.jsx(Qn,{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=>Q(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(X,{variant:"outline",onClick:()=>F(!1),children:"Cancel"}),r.jsx(X,{onClick:$e,disabled:!V||Me.isPending,children:Me.isPending?"Linking...":"Link & Award Points"})]})]})]})})]})})}const vSt=()=>{const{user:e}=tn(),{toast:t}=pi(),n=qr(),[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,Q]=A.useState(!1),[ae,oe]=A.useState(!1),{data:de=[]}=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:se=[]}=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:pe=[],isLoading:ne}=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:Qe}=await Y.from("template_links").select("*").order("sort_order");if(Qe)throw Qe;const{data:rt,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:(rt==null?void 0:rt.filter(Ee=>Ee.template_id===Ce.id))||[]}))}});A.useEffect(()=>{const at=s.get("edit");if(at&&pe.length>0){const le=pe.find(qe=>qe.id===at);le&&(we(le),a({},{replace:!0}))}},[pe,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(""),Q(!1),t({title:"Category added"})},onError:at=>{t({title:"Error adding category",description:at.message,variant:"destructive"})}}),he=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:Ye}=Y.storage.from("template-previews").getPublicUrl(Ce);le=Ye.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 Qe=at.templateId;if(Qe){const{error:ut}=await Y.from("canva_templates").update(qe).eq("id",Qe);if(ut)throw ut;const{error:Ce}=await Y.from("template_links").delete().eq("template_id",Qe);if(Ce)throw Ce;const Ee=((je=at.existingGuides)==null?void 0:je.map(Ke=>Ke.id).filter(Boolean))||[],Ye=at.template.guides.map(Ke=>Ke.id).filter(Boolean),Le=Ee.filter(Ke=>!Ye.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;Qe=ut.id,fSt(at.template.name,ut.id)}const rt=at.template.links.filter(ut=>ut.title.trim()&&ut.canva_share_link.trim());if(rt.length>0){const ut=rt.map((Ee,Ye)=>({template_id:Qe,title:Ee.title.trim(),canva_share_link:Ee.canva_share_link.trim(),sort_order:Ye})),{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"]}),be(),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"})}}),be=()=>{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),Q(!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)))},et=()=>{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,Qe)=>Qe!==at);x({...m,links:le})},Ie=(at,le,qe)=>{const Qe=[...m.links];Qe[at]={...Qe[at],[le]:qe},x({...m,links:Qe})},$e=at=>{const le=at.target.files;if(!le)return;const qe=Array.from(le).map((Qe,rt)=>({name:Qe.name.replace(/\.[^/.]+$/,""),file_url:"",file_type:Qe.type,file_size:Qe.size,sort_order:m.guides.length+rt,file:Qe}));x({...m,guides:[...m.guides,...qe]}),at.target.value=""},Be=at=>{const le=m.guides.filter((qe,Qe)=>Qe!==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:Qe}=at,{data:rt,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,Ye)=>{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():Ye(new Error(`Upload failed with status ${ut.status}`))}),ut.addEventListener("error",()=>Ye(new Error("Upload failed"))),ut.open("PUT",rt.uploadUrl),ut.setRequestHeader("AccessKey",rt.apiKey),ut.send(y)}),`https://player.mediadelivery.net/embed/${Qe}/${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)}},At=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(Qe=>Qe.title.trim()&&Qe.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 Qe=await ot();if(!Qe)return;qe=Qe}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(Dr,{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(Je,{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:"Categories"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:de.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(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:se.length})})]})]}),r.jsxs(Or,{open:o,onOpenChange:at=>{l(at),at||be()},children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"Add Template"]})}),r.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Fr,{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(X,{type:"button",variant:"outline",size:"sm",onClick:et,className:"gap-1",children:[r.jsx(bn,{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(X,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>Me(le),children:r.jsx(us,{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(X,{type:"button",size:"sm",onClick:()=>D.trim()&&me.mutate(D.trim()),disabled:me.isPending,children:"Add"}),r.jsx(X,{type:"button",size:"sm",variant:"ghost",onClick:()=>{Q(!1),U("")},children:r.jsx(us,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(hn,{value:m.category_id,onValueChange:at=>x({...m,category_id:at}),children:[r.jsx(cn,{className:"flex-1",children:r.jsx(fn,{placeholder:"Select category"})}),r.jsx(dn,{children:de.map(at=>r.jsx($t,{value:at.id,children:at.name},at.id))})]}),r.jsx(X,{type:"button",variant:"outline",size:"icon",onClick:()=>Q(!0),children:r.jsx(bn,{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(X,{type:"button",size:"sm",onClick:()=>V.trim()&&he.mutate(V.trim()),disabled:he.isPending,children:"Add"}),r.jsx(X,{type:"button",size:"sm",variant:"ghost",onClick:()=>{oe(!1),W("")},children:r.jsx(us,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(hn,{value:m.type_id,onValueChange:at=>x({...m,type_id:at}),children:[r.jsx(cn,{className:"flex-1",children:r.jsx(fn,{placeholder:"Select type"})}),r.jsx(dn,{children:se.map(at=>r.jsx($t,{value:at.id,children:at.name},at.id))})]}),r.jsx(X,{type:"button",variant:"outline",size:"icon",onClick:()=>oe(!0),children:r.jsx(bn,{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(X,{type:"button",size:"icon",variant:"destructive",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>{T(null),F("")},children:r.jsx(us,{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(Pa,{className:"h-5 w-5 text-primary shrink-0"}),r.jsx("span",{className:"text-sm flex-1 truncate",children:"Video uploaded"}),r.jsx(X,{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(Wr,{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(Pa,{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(X,{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(us,{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:At,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(Pa,{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(X,{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(X,{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(us,{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(X,{type:"button",variant:"outline",onClick:()=>{l(!1),be()},children:"Cancel"}),r.jsx(X,{type:"submit",disabled:xe.isPending,children:xe.isPending?"Saving...":i?"Update":"Create"})]})]})]})]})]}),r.jsx(He,{children:r.jsx(Je,{className:"p-0",children:ne?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading..."}):pe.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No templates yet. Add your first template!"}):r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:pe.map(at=>{var le,qe,Qe,rt,je;return r.jsxs(Nr,{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(Tt,{variant:"secondary",children:[((le=at.links)==null?void 0:le.length)||0," link",(((qe=at.links)==null?void 0:qe.length)||0)!==1?"s":""]}),(((Qe=at.guides)==null?void 0:Qe.length)||0)>0&&r.jsxs(Tt,{variant:"outline",className:"gap-1",children:[r.jsx(_a,{className:"h-3 w-3"}),(rt=at.guides)==null?void 0:rt.length," guide",(((je=at.guides)==null?void 0:je.length)||0)!==1?"s":""]})]})}),r.jsx(yt,{children:at.category?r.jsx(Tt,{variant:"secondary",children:at.category.name}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(yt,{children:at.type?r.jsx(Tt,{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(X,{size:"icon",variant:"ghost",onClick:()=>we(at),children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{size:"icon",variant:"ghost",className:"text-destructive hover:text-destructive",onClick:()=>{confirm("Delete this template?")&&Te.mutate(at.id)},children:r.jsx(Un,{className:"h-4 w-4"})})]})})]},at.id)})})]})})})]})})};function H9e({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(Tt,{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(us,{className:"h-3 w-3"})})]},y.id))}),r.jsxs(Wc,{open:a,onOpenChange:o,children:[r.jsx(Gc,{asChild:!0,children:r.jsxs(X,{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 _St=[{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"}],bSt=()=>{const{user:e}=tn(),[t,n]=Zc(),{toast:s}=pi(),a=qr(),[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,Q]=A.useState(!1),[ae,oe]=A.useState(null),[de,se]=A.useState(0),[pe,ne]=A.useState(!1),[me,he]=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:be}=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:Qe,error:rt}=await Y.from("academy_resources").select("*").order("sort_order");if(rt)throw rt;return le.map(ut=>({...ut,resources:(Qe==null?void 0:Qe.filter(Ce=>Ce.video_id===ut.id))||[]}))}});A.useEffect(()=>{const le=t.get("edit");if(le&&Te.length>0){const qe=Te.find(Qe=>Qe.id===le);qe&&($e(qe),n({},{replace:!0}))}},[Te,t]);const we=ar({mutationFn:async le=>{const{data:qe,error:Qe}=await Y.from("academy_categories").insert({name:le,sort_order:xe.length}).select().single();if(Qe)throw Qe;return qe},onSuccess:le=>{a.invalidateQueries({queryKey:["academy-categories"]}),x({...m,category_id:le.id}),W(""),Q(!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 Qe={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 rt=le.videoId;if(rt){const{error:je}=await Y.from("academy_videos").update(Qe).eq("id",rt);if(je)throw je}else{const{data:je,error:ut}=await Y.from("academy_videos").insert(Qe).select().single();if(ut)throw ut;rt=je.id,pSt(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:rt,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"})}}),et=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:Qe}=await Y.from("academy_videos").update({is_published:qe}).eq("id",le);if(Qe)throw Qe},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),se(0),ne(!1),he(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(Qe=>Qe.template_id)),l(!0)},Be=le=>{var Qe;const qe=(Qe=le.target.files)==null?void 0:Qe[0];qe&&(v(qe),N(URL.createObjectURL(qe)))},Ve=le=>{const qe=le.target.files;if(qe){const Qe=Array.from(qe).map(rt=>({file:rt,title:rt.name.replace(/\.[^/.]+$/,"")}));M([...k,...Qe])}le.target.value=""},ot=le=>{M(k.filter((qe,Qe)=>Qe!==le))},At=le=>{F([...P,le]),T(I.filter(qe=>qe.id!==le))},Oe=async()=>{if(!ae)return null;ne(!0),se(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:Qe,libraryId:rt}=le;he(Qe);const{data:je,error:ut}=await Y.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:Qe}});if(ut)throw new Error(ut.message);const Ce=new XMLHttpRequest;return await new Promise((Ye,Le)=>{Ce.upload.addEventListener("progress",Ke=>{if(Ke.lengthComputable){const tt=Math.round(Ke.loaded/Ke.total*100);se(tt)}}),Ce.addEventListener("load",()=>{Ce.status>=200&&Ce.status<300?Ye():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/${rt}/${Qe}`}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{ne(!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 Qe=await Oe();if(!Qe)return;qe=Qe}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(Dr,{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(Je,{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(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:Te.filter(le=>le.is_published).length})})]})]}),r.jsxs(Or,{open:o,onOpenChange:le=>{l(le),le||Ie()},children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"Add Video"]})}),r.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Fr,{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(hn,{value:m.video_type,onValueChange:le=>{x({...m,video_type:le,video_url:""}),oe(null)},disabled:pe,children:[r.jsx(cn,{children:r.jsx(fn,{})}),r.jsx(dn,{children:_St.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 Qe;const qe=(Qe=le.target.files)==null?void 0:Qe[0];qe&&oe(qe)},disabled:pe}),ae&&r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Pa,{className:"h-4 w-4"}),ae.name," (",(ae.size/(1024*1024)).toFixed(1)," MB)"]}),pe&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Wr,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{className:"text-sm",children:"Uploading to Bunny.net..."})]}),r.jsx(Mc,{value:de,className:"h-2"}),r.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[de,"%"]})]})]})]}):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(X,{type:"button",size:"sm",onClick:()=>V.trim()&&we.mutate(V.trim()),disabled:we.isPending,children:"Add"}),r.jsx(X,{type:"button",size:"sm",variant:"ghost",onClick:()=>{Q(!1),W("")},children:r.jsx(us,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(hn,{value:m.category_id,onValueChange:le=>x({...m,category_id:le}),children:[r.jsx(cn,{className:"flex-1",children:r.jsx(fn,{placeholder:"Select category"})}),r.jsx(dn,{children:xe.map(le=>r.jsx($t,{value:le.id,children:le.name},le.id))})]}),r.jsx(X,{type:"button",variant:"outline",size:"sm",onClick:()=>Q(!0),children:r.jsx(bn,{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(X,{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(Tt,{variant:"outline",className:"text-xs",children:le.file_type}),r.jsx(X,{type:"button",variant:"ghost",size:"sm",onClick:()=>At(le.id),className:"text-destructive hover:text-destructive",children:r.jsx(us,{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:Qe=>{const rt=[...k];rt[qe].title=Qe.target.value,M(rt)},className:"flex-1 h-8",placeholder:"Resource title"}),r.jsx(Tt,{variant:"secondary",className:"text-xs",children:"New"}),r.jsx(X,{type:"button",variant:"ghost",size:"sm",onClick:()=>ot(qe),className:"text-destructive hover:text-destructive",children:r.jsx(us,{className:"h-4 w-4"})})]},qe))]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Supported: PDF, PowerPoint, Excel, Word, ZIP"})]}),r.jsx(H9e,{selectedTemplateIds:D,onChange:U}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Is,{id:"is_published",checked:m.is_published,onCheckedChange:le=>x({...m,is_published:le})}),r.jsx(ze,{htmlFor:"is_published",children:"Published"})]}),r.jsxs(Hs,{children:[r.jsx(X,{type:"button",variant:"outline",onClick:()=>l(!1),disabled:pe,children:"Cancel"}),r.jsx(X,{type:"submit",disabled:ve.isPending||pe,children:pe?r.jsxs(r.Fragment,{children:[r.jsx(Wr,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):ve.isPending?"Saving...":i?"Update Video":"Add Video"})]})]})]})]})]}),r.jsx(He,{children:r.jsx(Je,{className:"p-0",children:be?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(Pa,{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(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:Te.map(le=>r.jsxs(Nr,{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(Pa,{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(Tt,{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(Tt,{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(Is,{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(X,{variant:"ghost",size:"sm",onClick:()=>$e(le),children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>et.mutate(le.id),className:"text-destructive hover:text-destructive",children:r.jsx(Un,{className:"h-4 w-4"})})]})})]},le.id))})]})})})]})})};function wSt(){var ve,et,Me;const e=qr(),[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&&(Q($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)},Q=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}])},de=Ie=>{N(b.filter(($e,Be)=>Be!==Ie))},se=(Ie,$e,Be)=>{const Ve=[...b];Ve[Ie]={...Ve[Ie],[$e]:Be},N(Ve)},pe=()=>{M([...k,{title:"",canva_share_link:"",sort_order:k.length}])},ne=Ie=>{M(k.filter(($e,Be)=>Be!==Ie))},me=(Ie,$e,Be)=>{const Ve=[...k];Ve[Ie]={...Ve[Ie],[$e]:Be},M(Ve)},he=(Ie,$e)=>{var Ve;const Be=(Ve=$e.target.files)==null?void 0:Ve[0];if(Be){const ot=[...b],At=Be.name.replace(/\.[^/.]+$/,"");ot[Ie]={...ot[Ie],file:Be,file_type:Be.type,file_size:Be.size,name:ot[Ie].name||At},N(ot)}},xe=ar({mutationFn:async()=>{let Ie=(o==null?void 0:o.featured_image_url)||null;if(m){const At=m.name.split(".").pop(),Oe=`${Date.now()}.${At}`,{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:At}=await Y.from("resource_kits").update($e).eq("id",o.id);if(At)throw At;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))||[],Qe=k.filter(je=>je.id).map(je=>je.id),rt=qe.filter(je=>!Qe.includes(je));rt.length>0&&await Y.from("resource_kit_links").delete().in("id",rt)}else{const{data:At,error:Oe}=await Y.from("resource_kits").insert($e).select().single();if(Oe)throw Oe;Be=At.id}for(let At=0;At0){const{error:At}=await Y.from("resource_kit_templates").insert(I.map(Oe=>({kit_id:Be,template_id:Oe})));if(At)throw At}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)&&xSt(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)}}),be=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(Dr,{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(Je,{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(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:(D==null?void 0:D.filter(Ie=>Ie.is_published).length)||0})})]})]}),r.jsxs(X,{onClick:()=>{G(),a(!0)},children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Resource Kit"]})]}),r.jsx(He,{children:r.jsx(Je,{className:"p-0",children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:U?r.jsx(Nr,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):(D==null?void 0:D.length)===0?r.jsx(Nr,{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(Nr,{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:ln(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(X,{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(X,{variant:"ghost",size:"icon",onClick:()=>Q(Ie),children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource kit?")&&Te.mutate(Ie.id)},children:r.jsx(Un,{className:"h-4 w-4 text-destructive"})})]})})]},Ie.id))})]})})}),r.jsx(Or,{open:s,onOpenChange:a,children:r.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Fr,{children:o?"Edit Resource Kit":"Add Resource Kit"})}),r.jsxs("form",{onSubmit:be,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(Is,{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(X,{type:"button",variant:"outline",size:"sm",onClick:oe,children:[r.jsx(bn,{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(X,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>de($e),children:r.jsx(us,{className:"h-4 w-4"})})]}),r.jsx(lt,{placeholder:"File name (e.g., Getting Started Guide)",value:Ie.name,onChange:Be=>se($e,"name",Be.target.value)}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(lt,{type:"file",onChange:Be=>he($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(X,{type:"button",variant:"outline",size:"sm",onClick:pe,children:[r.jsx(bn,{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(X,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>ne($e),children:r.jsx(us,{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(H9e,{selectedTemplateIds:I,onChange:T}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(X,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(X,{type:"submit",disabled:xe.isPending,children:xe.isPending?"Saving...":o?"Update":"Create"})]})]})]})}),r.jsx(Or,{open:!!P,onOpenChange:()=>F(null),children:r.jsxs(Lr,{className:"max-w-lg",children:[r.jsx(zr,{children:r.jsx(Fr,{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,")"]}),((et=P==null?void 0:P.files)==null?void 0:et.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(Ro,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm",children:Ie.title})]},Ie.id))})]})]})]})})]})})}const jSt=()=>{const{user:e}=tn(),{toast:t}=pi(),n=qr(),[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:Q,error:ae}=await Y.from("social_swag_links").select("*").order("sort_order");if(ae)throw ae;return W.map(de=>({...de,links:(Q==null?void 0:Q.filter(se=>se.swag_id===de.id))||[]}))}}),k=ar({mutationFn:async W=>{let G=W.existingImageUrl;if(W.image){const pe=W.image.name.split(".").pop(),ne=`${Date.now()}-${Math.random().toString(36).substring(7)}.${pe}`,{error:me}=await Y.storage.from("template-previews").upload(ne,W.image);if(me)throw me;const{data:he}=Y.storage.from("template-previews").getPublicUrl(ne);G=he.publicUrl}const Q={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,de=(o==null?void 0:o.is_published)||!1;if(ae){const{error:pe}=await Y.from("social_swag").update(Q).eq("id",ae);if(pe)throw pe;await Y.from("social_swag_links").delete().eq("swag_id",ae)}else{const{data:pe,error:ne}=await Y.from("social_swag").insert(Q).select().single();if(ne)throw ne;ae=pe.id}const se=W.item.links.filter(pe=>pe.title.trim()&&pe.canva_share_link.trim());if(se.length>0){const pe=se.map((me,he)=>({swag_id:ae,title:me.title.trim(),canva_share_link:me.canva_share_link.trim(),sort_order:he})),{error:ne}=await Y.from("social_swag_links").insert(pe);if(ne)throw ne}return{itemId:ae,itemTitle:W.item.title,isNewItem:oe,wasPublished:de,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)&&gfe(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 Q;const G=(Q=W.target.files)==null?void 0:Q[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((Q,ae)=>ae!==W);u({...i,links:G})},U=(W,G,Q)=>{const ae=[...i.links];ae[W]={...ae[W],[G]:Q},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(Dr,{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(Je,{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(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:b.filter(W=>W.is_published).length})})]})]}),r.jsxs(Or,{open:s,onOpenChange:W=>{a(W),W||I()},children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"Add Item"]})}),r.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Fr,{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(Is,{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(X,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{x(null),v("")},children:r.jsx(us,{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(X,{type:"button",variant:"outline",size:"sm",onClick:F,children:[r.jsx(bn,{className:"h-3 w-3 mr-1"}),"Add Link"]})]}),i.links.map((W,G)=>r.jsx(He,{children:r.jsxs(Je,{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(X,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>D(G),children:r.jsx(us,{className:"h-3 w-3"})})]}),r.jsx(lt,{placeholder:"Link title (e.g., Instagram Post)",value:W.title,onChange:Q=>U(G,"title",Q.target.value)}),r.jsx(lt,{placeholder:"Canva share link",value:W.canva_share_link,onChange:Q=>U(G,"canva_share_link",Q.target.value)})]})},G))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(X,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(X,{type:"submit",disabled:k.isPending,children:k.isPending?"Saving...":o?"Update":"Create"})]})]})]})]})]}),r.jsx(He,{children:r.jsx(Je,{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(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:b.map(W=>{var G;return r.jsxs(Nr,{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(Tt,{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(X,{variant:"ghost",size:"icon",onClick:()=>window.open(`/social-swag/${W.id}`,"_blank"),children:r.jsx(_o,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>T(W),children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this item?")&&M.mutate(W.id)},children:r.jsx(Un,{className:"h-4 w-4"})})]})})]},W.id)})})]})})})]})})};function kSt(){for(var e=arguments.length,t=new Array(e),n=0;ns=>{t.forEach(a=>a(s))},t)}const Rae=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function F3(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function B0e(e){return"nodeType"in e}function $h(e){var t,n;return e?F3(e)?e:B0e(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function $0e(e){const{Document:t}=$h(e);return e instanceof t}function wP(e){return F3(e)?!1:e instanceof $h(e).HTMLElement}function W9e(e){return e instanceof $h(e).SVGElement}function z3(e){return e?F3(e)?e.document:B0e(e)?$0e(e)?e:wP(e)||W9e(e)?e.ownerDocument:document:document:document}const rx=Rae?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 JE(e,t){t===void 0&&(t=[e]);const n=A.useRef(e);return rx(()=>{n.current!==e&&(n.current=e)},t),n}function jP(e,t){const n=A.useRef();return A.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function Xre(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 xfe(e){const t=A.useRef();return A.useEffect(()=>{t.current=e},[e]),t.current}let Ide={};function kP(e,t){return A.useMemo(()=>{if(t)return t;const n=Ide[e]==null?0:Ide[e]+1;return Ide[e]=n,e+"-"+n},[e,t])}function G9e(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 tC=G9e(1),eI=G9e(-1);function SSt(e){return"clientX"in e&&"clientY"in e}function q0e(e){if(!e)return!1;const{KeyboardEvent:t}=$h(e.target);return t&&e instanceof t}function CSt(e){if(!e)return!1;const{TouchEvent:t}=$h(e.target);return t&&e instanceof t}function yfe(e){if(CSt(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 SSt(e)?{x:e.clientX,y:e.clientY}:null}const tI=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[tI.Translate.toString(e),tI.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),V4e="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function MSt(e){return e.matches(V4e)?e:e.querySelector(V4e)}const TSt={display:"none"};function ASt(e){let{id:t,value:n}=e;return dt.createElement("div",{id:t,style:TSt},n)}function ESt(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 ISt(){const[e,t]=A.useState("");return{announce:A.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const K9e=A.createContext(null);function PSt(e){const t=A.useContext(K9e);A.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function LSt(){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 OSt={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. `},DSt={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 RSt(e){let{announcements:t=DSt,container:n,hiddenTextDescribedById:s,screenReaderInstructions:a=OSt}=e;const{announce:o,announcement:l}=ISt(),i=kP("DndLiveRegion"),[u,m]=A.useState(!1);if(A.useEffect(()=>{m(!0)},[]),PSt(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(ASt,{id:s,value:a.draggable}),dt.createElement(ESt,{id:i,announcement:l}));return n?Ah.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 Qre(){}function H4e(e,t){return A.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function FSt(){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 Z9e(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Y9e(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return n-s}function zSt(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function W4e(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 X9e(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function G4e(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 BSt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=G4e(t,t.left,t.top),o=[];for(const l of s){const{id:i}=l,u=n.get(i);if(u){const m=Z9e(G4e(u),a);o.push({id:i,data:{droppableContainer:l,value:m}})}}return o.sort(Y9e)},$St=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=W4e(t),o=[];for(const l of s){const{id:i}=l,u=n.get(i);if(u){const m=W4e(u),x=a.reduce((v,b,N)=>v+Z9e(m[N],b),0),y=Number((x/4).toFixed(4));o.push({id:i,data:{droppableContainer:l,value:y}})}}return o.sort(Y9e)};function USt(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=USt(i,t);u>0&&a.push({id:l,data:{droppableContainer:o,value:u}})}}return a.sort(zSt)};function VSt(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Q9e(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Bp}function HSt(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 WSt=HSt(1);function GSt(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 KSt(e,t,n){const s=GSt(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 ZSt={ignoreTransform:!1};function B3(e,t){t===void 0&&(t=ZSt);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:x}=$h(e).getComputedStyle(e);m&&(n=KSt(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 K4e(e){return B3(e,{ignoreTransform:!0})}function YSt(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function XSt(e,t){return t===void 0&&(t=$h(e).getComputedStyle(e)),t.position==="fixed"}function QSt(e,t){t===void 0&&(t=$h(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 Fae(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(!wP(a)||W9e(a)||n.includes(a))return n;const o=$h(e).getComputedStyle(a);return a!==e&&QSt(a,o)&&n.push(a),XSt(a,o)?n:s(a.parentNode)}return e?s(e):n}function J9e(e){const[t]=Fae(e,1);return t??null}function Pde(e){return!Rae||!e?null:F3(e)?e:B0e(e)?$0e(e)||e===z3(e).scrollingElement?window:wP(e)?e:null:null}function eBe(e){return F3(e)?e.scrollX:e.scrollLeft}function tBe(e){return F3(e)?e.scrollY:e.scrollTop}function vfe(e){return{x:eBe(e),y:tBe(e)}}var Ed;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Ed||(Ed={}));function rBe(e){return!Rae||!e?!1:e===document.scrollingElement}function nBe(e){const t={x:0,y:0},n=rBe(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 JSt={x:.2,y:.2};function e4t(e,t,n,s,a){let{top:o,left:l,right:i,bottom:u}=n;s===void 0&&(s=10),a===void 0&&(a=JSt);const{isTop:m,isBottom:x,isLeft:y,isRight:v}=nBe(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=Ed.Backward,N.y=s*Math.abs((t.top+k.height-o)/k.height)):!x&&u>=t.bottom-k.height&&(b.y=Ed.Forward,N.y=s*Math.abs((t.bottom-k.height-u)/k.height)),!v&&i>=t.right-k.width?(b.x=Ed.Forward,N.x=s*Math.abs((t.right-k.width-i)/k.width)):!y&&l<=t.left+k.width&&(b.x=Ed.Backward,N.x=s*Math.abs((t.left+k.width-l)/k.width)),{direction:b,speed:N}}function t4t(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 sBe(e){return e.reduce((t,n)=>tC(t,vfe(n)),Bp)}function r4t(e){return e.reduce((t,n)=>t+eBe(n),0)}function n4t(e){return e.reduce((t,n)=>t+tBe(n),0)}function s4t(e,t){if(t===void 0&&(t=B3),!e)return;const{top:n,left:s,bottom:a,right:o}=t(e);J9e(e)&&(a<=0||o<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const a4t=[["x",["left","right"],r4t],["y",["top","bottom"],n4t]];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=Fae(n),a=sBe(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,l,i]of a4t)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 QA{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 i4t(e){const{EventTarget:t}=$h(e);return e instanceof t?e:z3(e)}function Lde(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 ef;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ef||(ef={}));function Z4e(e){e.preventDefault()}function o4t(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 aBe={start:[Qi.Space,Qi.Enter],cancel:[Qi.Esc],end:[Qi.Space,Qi.Enter,Qi.Tab]},l4t=(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 QA(z3(n)),this.windowListeners=new QA($h(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ef.Resize,this.handleCancel),this.windowListeners.add(ef.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ef.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,s=t.node.current;s&&s4t(s),n(Bp)}handleKeyDown(t){if(q0e(t)){const{active:n,context:s,options:a}=this.props,{keyboardCodes:o=aBe,coordinateGetter:l=l4t,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=eI(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}=nBe(k),V=t4t(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,Q=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(Q&&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,tC(eI(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=aBe,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 Y4e(e){return!!(e&&"distance"in e)}function X4e(e){return!!(e&&"delay"in e)}class W0e{constructor(t,n,s){var a;s===void 0&&(s=i4t(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=z3(l),this.documentListeners=new QA(this.document),this.listeners=new QA(s),this.windowListeners=new QA($h(l)),this.initialCoordinates=(a=yfe(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(ef.Resize,this.handleCancel),this.windowListeners.add(ef.DragStart,Z4e),this.windowListeners.add(ef.VisibilityChange,this.handleCancel),this.windowListeners.add(ef.ContextMenu,Z4e),this.documentListeners.add(ef.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(X4e(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Y4e(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(ef.Click,o4t,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ef.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=yfe(t))!=null?n:Bp,m=eI(a,u);if(!s&&i){if(Y4e(i)){if(i.tolerance!=null&&Lde(m,i.tolerance))return this.handleCancel();if(Lde(m,i.distance))return this.handleStart()}if(X4e(i)&&Lde(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 c4t={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class G0e extends W0e{constructor(t){const{event:n}=t,s=z3(n.target);super(t,c4t,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 d4t={move:{name:"mousemove"},end:{name:"mouseup"}};var _fe;(function(e){e[e.RightClick=2]="RightClick"})(_fe||(_fe={}));class u4t extends W0e{constructor(t){super(t,d4t,z3(t.event.target))}}u4t.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===_fe.RightClick?!1:(s==null||s({event:n}),!0)}}];const Ode={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class h4t extends W0e{constructor(t){super(t,Ode)}static setup(){return window.addEventListener(Ode.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Ode.move.name,t)};function t(){}}}h4t.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 JA;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(JA||(JA={}));var Jre;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Jre||(Jre={}));function m4t(e){let{acceleration:t,activator:n=JA.Pointer,canScroll:s,draggingRect:a,enabled:o,interval:l=5,order:i=Jre.TreeOrder,pointerCoordinates:u,scrollableAncestors:m,scrollableAncestorRects:x,delta:y,threshold:v}=e;const b=p4t({delta:y,disabled:!o}),[N,k]=NSt(),M=A.useRef({x:0,y:0}),I=A.useRef({x:0,y:0}),T=A.useMemo(()=>{switch(n){case JA.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case JA.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===Jre.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:Q}=e4t(U,W,T,t,v);for(const ae of["x","y"])b[ae][G[ae]]||(Q[ae]=0,G[ae]=0);if(Q.x>0||Q.y>0){k(),P.current=U,N(F,l),M.current=Q,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 f4t={x:{[Ed.Backward]:!1,[Ed.Forward]:!1},y:{[Ed.Backward]:!1,[Ed.Forward]:!1}};function p4t(e){let{delta:t,disabled:n}=e;const s=xfe(t);return jP(a=>{if(n||!s||!a)return f4t;const o={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[Ed.Backward]:a.x[Ed.Backward]||o.x===-1,[Ed.Forward]:a.x[Ed.Forward]||o.x===1},y:{[Ed.Backward]:a.y[Ed.Backward]||o.y===-1,[Ed.Forward]:a.y[Ed.Forward]||o.y===1}}},[n,t,s])}function g4t(e,t){const n=t!=null?e.get(t):void 0,s=n?n.node.current:null;return jP(a=>{var o;return t==null?null:(o=s??a)!=null?o:null},[s,t])}function x4t(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 rI;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(rI||(rI={}));var bfe;(function(e){e.Optimized="optimized"})(bfe||(bfe={}));const Q4e=new Map;function y4t(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=JE(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=jP(I=>{if(y&&!n)return Q4e;if(!I||I===Q4e||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 rI.Always:return!1;case rI.BeforeDragging:return n;default:return!n}}}function iBe(e,t){return jP(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function v4t(e,t){return iBe(e,t)}function _4t(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 zae(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 b4t(e){return new V0e(B3(e),e)}function J4e(e,t,n){t===void 0&&(t=b4t);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=_4t({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=zae({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 w4t(e){const t=iBe(e);return Q9e(e,t)}const eCe=[];function j4t(e){const t=A.useRef(e),n=jP(s=>e?s&&s!==eCe&&e&&t.current&&e.parentNode===t.current.parentNode?s:Fae(e):eCe,[e]);return A.useEffect(()=>{t.current=e},[e]),n}function k4t(e){const[t,n]=A.useState(null),s=A.useRef(e),a=A.useCallback(o=>{const l=Pde(o.target);l&&n(i=>i?(i.set(l,vfe(l)),new Map(i)):null)},[]);return A.useEffect(()=>{const o=s.current;if(e!==o){l(o);const i=e.map(u=>{const m=Pde(u);return m?(m.addEventListener("scroll",a,{passive:!0}),[m,vfe(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=Pde(u);m==null||m.removeEventListener("scroll",a)})}},[a,e]),A.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,l)=>tC(o,l),Bp):sBe(e):Bp,[e,t])}function tCe(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?eI(e,n.current):Bp}function N4t(e){A.useEffect(()=>{if(!Rae)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 S4t(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 oBe(e){return A.useMemo(()=>e?YSt(e):null,[e])}const rCe=[];function C4t(e,t){t===void 0&&(t=B3);const[n]=e,s=oBe(n?$h(n):null),[a,o]=A.useState(rCe);function l(){o(()=>e.length?e.map(u=>rBe(u)?s:new V0e(t(u),u)):rCe)}const i=zae({callback:l});return rx(()=>{i==null||i.disconnect(),l(),e.forEach(u=>i==null?void 0:i.observe(u))},[e]),a}function M4t(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return wP(t)?t:e}function T4t(e){let{measure:t}=e;const[n,s]=A.useState(null),a=A.useCallback(m=>{for(const{target:x}of m)if(wP(x)){s(y=>{const v=t(x);return y?{...y,width:v.width,height:v.height}:v});break}},[t]),o=zae({callback:a}),l=A.useCallback(m=>{const x=M4t(m);o==null||o.disconnect(),x&&(o==null||o.observe(x)),s(x?t(x):null)},[t,o]),[i,u]=Xre(l);return A.useMemo(()=>({nodeRef:i,rect:n,setRef:u}),[n,i,u])}const A4t=[{sensor:G0e,options:{}},{sensor:H0e,options:{}}],E4t={current:{}},ete={draggable:{measure:K4e},droppable:{measure:K4e,strategy:rI.WhileDragging,frequency:bfe.Optimized},dragOverlay:{measure:B3}};class eE 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 I4t={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new eE,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Qre},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ete,measureDroppableContainers:Qre,windowRect:null,measuringScheduled:!1},P4t={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Qre,draggableNodes:new Map,over:null,measureDroppableContainers:Qre},Bae=A.createContext(P4t),lBe=A.createContext(I4t);function L4t(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new eE}}}function O4t(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 eE(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 eE(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 eE(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function D4t(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:a}=A.useContext(Bae),o=xfe(s),l=xfe(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=MSt(x);if(y){y.focus();break}}})}},[s,t,a,l,o]),null}function R4t(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((a,o)=>o({transform:a,...s}),n):n}function F4t(e){return A.useMemo(()=>({draggable:{...ete.draggable,...e==null?void 0:e.draggable},droppable:{...ete.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ete.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 z4t(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=Q9e(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=J9e(m);v&&v.scrollBy({top:y.y,left:y.x})}},[t,l,i,s,n])}const cBe=A.createContext({...Bp,scaleX:1,scaleY:1});var s1;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(s1||(s1={}));const B4t=A.memo(function(t){var n,s,a,o;let{id:l,accessibility:i,autoScroll:u=!0,children:m,sensors:x=A4t,collisionDetection:y=qSt,measuring:v,modifiers:b,...N}=t;const k=A.useReducer(O4t,void 0,L4t),[M,I]=k,[T,P]=LSt(),[F,D]=A.useState(s1.Uninitialized),U=F===s1.Initialized,{draggable:{active:V,nodes:W,translate:G},droppable:{containers:Q}}=M,ae=V!=null?W.get(V):null,oe=A.useRef({initial:null,translated:null}),de=A.useMemo(()=>{var Wa;return V!=null?{id:V,data:(Wa=ae==null?void 0:ae.data)!=null?Wa:E4t,rect:oe}:null},[V,ae]),se=A.useRef(null),[pe,ne]=A.useState(null),[me,he]=A.useState(null),xe=JE(N,Object.values(N)),Te=kP("DndDescribedBy",l),be=A.useMemo(()=>Q.getEnabled(),[Q]),we=F4t(v),{droppableRects:ve,measureDroppableContainers:et,measuringScheduled:Me}=y4t(be,{dragging:U,dependencies:[G.x,G.y],config:we.droppable}),Ie=g4t(W,V),$e=A.useMemo(()=>me?yfe(me):null,[me]),Be=Mo(),Ve=v4t(Ie,we.draggable.measure);z4t({activeNode:V!=null?W.get(V):null,config:Be.layoutShiftCompensation,initialRect:Ve,measure:we.draggable.measure});const ot=J4e(Ie,we.draggable.measure,Ve),At=J4e(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:Q,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),at=Q.getNodeFor((n=Oe.current.over)==null?void 0:n.id),le=T4t({measure:we.dragOverlay.measure}),qe=(s=le.nodeRef.current)!=null?s:Ie,Qe=U?(a=le.rect)!=null?a:ot:null,rt=!!(le.nodeRef.current&&le.rect),je=w4t(rt?null:ot),ut=oBe(qe?$h(qe):null),Ce=j4t(U?at??Ie:null),Ee=C4t(Ce),Ye=R4t(b,{transform:{x:G.x-je.x,y:G.y-je.y,scaleX:1,scaleY:1},activatorEvent:me,active:de,activeNodeRect:ot,containerNodeRect:At,draggingNodeRect:Qe,over:Oe.current.over,overlayNodeRect:le.rect,scrollableAncestors:Ce,scrollableAncestorRects:Ee,windowRect:ut}),Le=$e?tC($e,G):null,Ke=k4t(Ce),tt=tCe(Ke),ct=tCe(Ke,[ot]),it=tC(Ye,tt),zt=Qe?WSt(Qe,Ye):null,ir=de&&zt?y({active:de,collisionRect:zt,droppableRects:ve,droppableContainers:be,pointerCoordinates:Le}):null,Mr=X9e(ir,"id"),[Zr,Br]=A.useState(null),rn=rt?Ye:tC(Ye,ct),Zn=VSt(rn,(o=Zr==null?void 0:Zr.rect)!=null?o:null,ot),Ot=A.useRef(null),Gr=A.useCallback((Wa,ms)=>{let{sensor:ra,options:fs}=ms;if(se.current==null)return;const Ys=W.get(se.current);if(!Ys)return;const Bs=Wa.nativeEvent,Ni=new ra({active:se.current,activeNode:Ys,event:Bs,options:fs,context:Oe,onAbort(La){if(!W.get(La))return;const{onDragAbort:ji}=xe.current,Hn={id:La};ji==null||ji(Hn),T({type:"onDragAbort",event:Hn})},onPending(La,oo,ji,Hn){if(!W.get(La))return;const{onDragPending:dc}=xe.current,go={id:La,constraint:oo,initialCoordinates:ji,offset:Hn};dc==null||dc(go),T({type:"onDragPending",event:go})},onStart(La){const oo=se.current;if(oo==null)return;const ji=W.get(oo);if(!ji)return;const{onDragStart:Hn}=xe.current,Ki={activatorEvent:Bs,active:{id:oo,data:ji.data,rect:oe}};Ah.unstable_batchedUpdates(()=>{Hn==null||Hn(Ki),D(s1.Initializing),I({type:ad.DragStart,initialCoordinates:La,active:oo}),T({type:"onDragStart",event:Ki}),ne(Ot.current),he(Bs)})},onMove(La){I({type:ad.DragMove,coordinates:La})},onEnd:or(ad.DragEnd),onCancel:or(ad.DragCancel)});Ot.current=Ni;function or(La){return async function(){const{active:ji,collisions:Hn,over:Ki,scrollAdjustedTranslate:dc}=Oe.current;let go=null;if(ji&&dc){const{cancelDrop:uc}=xe.current;go={activatorEvent:Bs,active:ji,collisions:Hn,delta:dc,over:Ki},La===ad.DragEnd&&typeof uc=="function"&&await Promise.resolve(uc(go))&&(La=ad.DragCancel)}se.current=null,Ah.unstable_batchedUpdates(()=>{I({type:La}),D(s1.Uninitialized),Br(null),ne(null),he(null),Ot.current=null;const uc=La===ad.DragEnd?"onDragEnd":"onDragCancel";if(go){const nt=xe.current[uc];nt==null||nt(go),T({type:uc,event:go})}})}}},[W]),An=A.useCallback((Wa,ms)=>(ra,fs)=>{const Ys=ra.nativeEvent,Bs=W.get(fs);if(se.current!==null||!Bs||Ys.dndKit||Ys.defaultPrevented)return;const Ni={active:Bs};Wa(ra,ms.options,Ni)===!0&&(Ys.dndKit={capturedBy:ms.sensor},se.current=fs,Gr(ra,ms))},[W,Gr]),zn=x4t(x,An);N4t(x),rx(()=>{ot&&F===s1.Initializing&&D(s1.Initialized)},[ot,F]),A.useEffect(()=>{const{onDragMove:Wa}=xe.current,{active:ms,activatorEvent:ra,collisions:fs,over:Ys}=Oe.current;if(!ms||!ra)return;const Bs={active:ms,activatorEvent:ra,collisions:fs,delta:{x:it.x,y:it.y},over:Ys};Ah.unstable_batchedUpdates(()=>{Wa==null||Wa(Bs),T({type:"onDragMove",event:Bs})})},[it.x,it.y]),A.useEffect(()=>{const{active:Wa,activatorEvent:ms,collisions:ra,droppableContainers:fs,scrollAdjustedTranslate:Ys}=Oe.current;if(!Wa||se.current==null||!ms||!Ys)return;const{onDragOver:Bs}=xe.current,Ni=fs.get(Mr),or=Ni&&Ni.rect.current?{id:Ni.id,rect:Ni.rect.current,data:Ni.data,disabled:Ni.disabled}:null,La={active:Wa,activatorEvent:ms,collisions:ra,delta:{x:Ys.x,y:Ys.y},over:or};Ah.unstable_batchedUpdates(()=>{Br(or),Bs==null||Bs(La),T({type:"onDragOver",event:La})})},[Mr]),rx(()=>{Oe.current={activatorEvent:me,active:de,activeNode:Ie,collisionRect:zt,collisions:ir,droppableRects:ve,draggableNodes:W,draggingNode:qe,draggingNodeRect:Qe,droppableContainers:Q,over:Zr,scrollableAncestors:Ce,scrollAdjustedTranslate:it},oe.current={initial:Qe,translated:zt}},[de,Ie,ir,zt,W,qe,Qe,ve,Q,Zr,Ce,it]),m4t({...Be,delta:G,draggingRect:zt,pointerCoordinates:Le,scrollableAncestors:Ce,scrollableAncestorRects:Ee});const ba=A.useMemo(()=>({active:de,activeNode:Ie,activeNodeRect:ot,activatorEvent:me,collisions:ir,containerNodeRect:At,dragOverlay:le,draggableNodes:W,droppableContainers:Q,droppableRects:ve,over:Zr,measureDroppableContainers:et,scrollableAncestors:Ce,scrollableAncestorRects:Ee,measuringConfiguration:we,measuringScheduled:Me,windowRect:ut}),[de,Ie,ot,me,ir,At,le,W,Q,ve,Zr,et,Ce,Ee,we,Me,ut]),gi=A.useMemo(()=>({activatorEvent:me,activators:zn,active:de,activeNodeRect:ot,ariaDescribedById:{draggable:Te},dispatch:I,draggableNodes:W,over:Zr,measureDroppableContainers:et}),[me,zn,de,ot,I,Te,W,Zr,et]);return dt.createElement(K9e.Provider,{value:P},dt.createElement(Bae.Provider,{value:gi},dt.createElement(lBe.Provider,{value:ba},dt.createElement(cBe.Provider,{value:Zn},m)),dt.createElement(D4t,{disabled:(i==null?void 0:i.restoreFocus)===!1})),dt.createElement(RSt,{...i,hiddenTextDescribedById:Te}));function Mo(){const Wa=(pe==null?void 0:pe.autoScrollEnabled)===!1,ms=typeof u=="object"?u.enabled===!1:u===!1,ra=U&&!Wa&&!ms;return typeof u=="object"?{...u,enabled:ra}:{enabled:ra}}}),$4t=A.createContext(null),nCe="button",U4t="Draggable";function q4t(e){let{id:t,data:n,disabled:s=!1,attributes:a}=e;const o=kP(U4t),{activators:l,activatorEvent:i,active:u,activeNodeRect:m,ariaDescribedById:x,draggableNodes:y,over:v}=A.useContext(Bae),{role:b=nCe,roleDescription:N="draggable",tabIndex:k=0}=a??{},M=(u==null?void 0:u.id)===t,I=A.useContext(M?cBe:$4t),[T,P]=Xre(),[F,D]=Xre(),U=S4t(l,t),V=JE(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===nCe?!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 V4t(){return A.useContext(lBe)}const H4t="Droppable",W4t={timeout:25};function G4t(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:a}=e;const o=kP(H4t),{active:l,dispatch:i,over:u,measureDroppableContainers:m}=A.useContext(Bae),x=A.useRef({disabled:n}),y=A.useRef(!1),v=A.useRef(null),b=A.useRef(null),{disabled:N,updateMeasurementsFor:k,timeout:M}={...W4t,...a},I=JE(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=zae({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]=Xre(F),V=JE(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 K4t(e,t){return e.reduce((n,s,a)=>{const o=t.get(s);return o&&(n[a]=o),n},Array(e.length))}function TO(e){return e!==null&&e>=0}function Z4t(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}},dBe="Sortable",uBe=dt.createContext({activeIndex:-1,containerId:dBe,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Z0e,disabled:{draggable:!1,droppable:!1}});function X4t(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}=V4t(),y=kP(dBe,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=!Z4t(b,I.current),P=M!==-1&&k===-1||T,F=Y4t(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:K4t(b,u),strategy:a}),[k,y,F.draggable,F.droppable,P,b,M,u,v,a]);return dt.createElement(uBe.Provider,{value:D},t)}const Q4t=e=>{let{id:t,items:n,activeIndex:s,overIndex:a}=e;return K0e(n,s,a).indexOf(t)},J4t=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},eCt={duration:200,easing:"ease"},hBe="transform",tCt=tI.Transition.toString({property:hBe,duration:0,easing:"linear"}),rCt={roleDescription:"sortable"};function nCt(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=B3(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 sCt(e){let{animateLayoutChanges:t=J4t,attributes:n,disabled:s,data:a,getNewIndex:o=Q4t,id:l,strategy:i,resizeObserverConfig:u,transition:m=eCt}=e;const{items:x,containerId:y,activeIndex:v,disabled:b,disableTransforms:N,sortedRects:k,overIndex:M,useDragOverlay:I,strategy:T}=A.useContext(uBe),P=aCt(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:Q}=G4t({id:l,data:D,disabled:P.droppable,resizeObserverConfig:{updateMeasurementsFor:U,...u}}),{active:ae,activatorEvent:oe,activeNodeRect:de,attributes:se,setNodeRef:pe,listeners:ne,isDragging:me,over:he,setActivatorNodeRef:xe,transform:Te}=q4t({id:l,data:D,attributes:{...rCt,...n},disabled:P.draggable}),be=kSt(Q,pe),we=!!ae,ve=we&&!N&&TO(v)&&TO(M),et=!I&&me,Me=et&&ve?Te:null,$e=ve?Me??(i??T)({rects:k,activeNodeRect:de,activeIndex:v,overIndex:M,index:F}):null,Be=TO(v)&&TO(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}),At=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=nCt({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:se,data:D,rect:V,index:F,newIndex:Be,items:x,isOver:G,isSorting:we,isDragging:me,listeners:ne,node:W,overIndex:M,over:he,setNodeRef:be,setActivatorNodeRef:xe,setDroppableNodeRef:Q,setDraggableNodeRef:pe,transform:at??$e,transition:le()};function le(){if(at||At&&ot.current.newIndex===F)return tCt;if(!(et&&!q0e(oe)||!m)&&(we||Oe))return tI.Transition.toString({...m,property:hBe})}}function aCt(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 ene(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 iCt=[Qi.Down,Qi.Right,Qi.Up,Qi.Left],oCt=(e,t)=>{let{context:{active:n,collisionRect:s,droppableRects:a,droppableContainers:o,over:l,scrollableAncestors:i}}=t;if(iCt.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=Fae(N).some((U,V)=>i[V]!==U),I=mBe(y,v),T=lCt(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:eI(F,P)}}}};function mBe(e,t){return!ene(e)||!ene(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function lCt(e,t){return!ene(e)||!ene(t)||!mBe(e,t)?!1:e.data.current.sortable.indext(e),children:r.jsx(Ja,{className:"h-3.5 w-3.5"})}),r.jsx(X,{variant:"destructive",size:"icon",className:"h-7 w-7",onClick:()=>n(e),children:r.jsx(Un,{className:"h-3.5 w-3.5"})})]}),e.post_date&&r.jsx("div",{className:"absolute bottom-2 left-2",children:r.jsxs(Tt,{className:"bg-primary/90 text-primary-foreground text-[10px] gap-1 backdrop-blur-sm px-1.5 py-0.5",children:[r.jsx(Ts,{className:"h-2.5 w-2.5"}),ln(new Date(e.post_date+"T00:00:00"),"MMM d")]})})]}),r.jsxs(Je,{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(X,{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(Ts,{className:"h-3 w-3"}),e.post_date?ln(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?ln(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(X,{variant:"ghost",size:"sm",className:"w-full text-xs text-muted-foreground",onClick:()=>s(e.id,null),children:"Clear date"})})]})]})]})]})})}const dCt=()=>{const e=qr(),[t,n]=A.useState("all"),[s,a]=A.useState(!1),[o,l]=A.useState(ln(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(ln(new Date,"yyyy-MM")),[G,Q]=A.useState(null),[ae,oe]=A.useState(""),[de,se]=A.useState(""),[pe,ne]=A.useState(""),[me,he]=A.useState(!1),xe=FSt(H4e(G0e,{activationConstraint:{distance:5}}),H4e(H0e,{coordinateGetter:oCt})),{data:Te=[],isLoading:be}=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}}),et=[...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 ln(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(Mr=>Mr.id===Ke.id),zt=ct.findIndex(Mr=>Mr.id===tt.id);if(it===-1||zt===-1)return;const ir=K0e(ct,it,zt);e.setQueryData(["admin-social-swag-2"],Mr=>{if(!Mr)return Mr;const Zr={};return ir.forEach((Br,rn)=>{Zr[Br.id]=rn}),Mr.map(Br=>Zr[Br.id]!==void 0?{...Br,sort_order:Zr[Br.id]}:Br).sort((Br,rn)=>Br.month!==rn.month?rn.month.localeCompare(Br.month):Br.sort_order-rn.sort_order)});try{await Promise.all(ir.map((Mr,Zr)=>Y.from("social_swag_2").update({sort_order:Zr}).eq("id",Mr.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))},At=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")}),Qe=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")}),rt=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&&(Q(Ke),oe(URL.createObjectURL(Ke)))},Ce=()=>{ae&&URL.revokeObjectURL(ae),Q(null),oe(""),se(""),ne("")},Ee=async()=>{if(!G){Ae.error("Please select an image");return}he(!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:pe||null,caption:de||null},{onConflict:"month"});if(it)throw it;Ae.success("Reel uploaded successfully!"),gfe(`${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{he(!1)}},Ye=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(Dr,{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(Or,{open:s,onOpenChange:a,children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"Upload Images"]})}),r.jsxs(Lr,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Fr,{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(X,{variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>At(Ke),children:r.jsx(us,{className:"h-3 w-3"})})]}),r.jsx(Xn,{placeholder:"Caption...",value:Le.caption,onChange:tt=>Oe(Ke,tt.target.value),className:"text-xs h-20"})]},Ke))}),r.jsx(X,{onClick:at,disabled:m||i.length===0,className:"w-full gap-2",children:m?r.jsxs(r.Fragment,{children:[r.jsx(Wr,{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(Or,{open:D,onOpenChange:Le=>{U(Le),Le||Ce()},children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{variant:"outline",className:"gap-2",children:[r.jsx(Ad,{className:"h-4 w-4"}),"Upload Reel"]})}),r.jsxs(Lr,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Fr,{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(X,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{URL.revokeObjectURL(ae),Q(null),oe("")},children:r.jsx(us,{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(Ad,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to select reel preview image"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Canva Download Link"}),r.jsx(lt,{value:pe,onChange:Le=>ne(Le.target.value),placeholder:"https://www.canva.com/..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Caption"}),r.jsx(Xn,{value:de,onChange:Le=>se(Le.target.value),placeholder:"Enter caption for this reel...",className:"h-24"})]}),r.jsx(X,{onClick:Ee,disabled:me||!G,className:"w-full gap-2",children:me?r.jsxs(r.Fragment,{children:[r.jsx(Wr,{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(Je,{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(Je,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:et.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Months"})]})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(ki,{value:t,onValueChange:n,children:r.jsxs(wi,{children:[r.jsx(an,{value:"all",children:"All"}),et.map(Le=>r.jsx(an,{value:Le,children:Ie(Le)},Le))]})}),t!=="all"&&r.jsx(He,{children:r.jsx(Je,{className:"p-4",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(Ro,{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(X,{size:"sm",onClick:()=>Qe.mutate(y),children:"Save"}),r.jsx(X,{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:rt(t)||"No link set"}),r.jsx(X,{size:"sm",variant:"outline",onClick:()=>v({month:t,link:rt(t)}),children:"Edit"})]})]})]})})}),t!=="all"&&r.jsx(He,{children:r.jsx(Je,{className:"p-4",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx(Ad,{className:"h-4 w-4 text-muted-foreground mt-1"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs(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(X,{variant:"destructive",size:"sm",onClick:()=>Ye.mutate(Le),children:r.jsx(Un,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"No reel uploaded for this month"})})()]})]})})})]}),be?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(B4t,{sensors:xe,collisionDetection:BSt,onDragEnd:Ve,children:r.jsx(X4t,{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(cCt,{item:Le,onEdit:$e,onDelete:Ke=>le.mutate(Ke),onDateChange:(Ke,tt)=>qe.mutate({id:Ke,postDate:tt})},Le.id))})})})]}),r.jsx(Or,{open:!!b,onOpenChange:Le=>{Le||N(null)},children:r.jsxs(Lr,{className:"max-w-md",children:[r.jsx(zr,{children:r.jsx(Fr,{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(Xn,{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(X,{variant:"outline",className:Ut("flex-1 justify-start gap-2 font-normal",!I&&"text-muted-foreground"),children:[r.jsx(Ts,{className:"h-4 w-4"}),I?ln(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?ln(Le,"yyyy-MM-dd"):null),className:"p-3 pointer-events-auto"})})]}),I&&r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>T(null),children:r.jsx(us,{className:"h-4 w-4"})})]})]})]}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>N(null),children:"Cancel"}),r.jsx(X,{onClick:Be,disabled:P,className:"gap-2",children:P?r.jsxs(r.Fragment,{children:[r.jsx(Wr,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})})]})},uCt=()=>{const{toast:e}=pi(),t=qr(),[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:Q=[]}=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=[],At=0,Oe=!0;for(;Oe;){const{data:at,error:le}=await Y.from("profiles").select("id, name, email, brokerage_id").order("name").range(At,At+1e3-1);if(le)throw le;at&&at.length>0?(ot=[...ot,...at],At+=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}}),de=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:At}=await Y.from("community_categories").insert({name:Ve.name,description:Ve.description||null,icon:Ve.icon||null,sort_order:ot+1});if(At)throw At}},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"})}}),se=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"})}}),pe=ar({mutationFn:async({id:Ve,direction:ot})=>{const At=U.findIndex(Oe=>Oe.id===Ve);if(ot==="up"&&At>0){const Oe=U[At-1],at=U[At];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"&&Att.invalidateQueries({queryKey:["admin-community-categories"]})}),ne=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:At}=await Y.from("community_private_groups").insert({name:Ve.name,description:Ve.description||null,icon:Ve.icon||null,sort_order:ot+1});if(At)throw At}},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"})}}),he=ar({mutationFn:async({id:Ve,direction:ot})=>{const At=W.findIndex(Oe=>Oe.id===Ve);if(ot==="up"&&At>0){const Oe=W[At-1],at=W[At];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"&&Att.invalidateQueries({queryKey:["admin-private-groups"]})}),xe=ar({mutationFn:async({groupId:Ve,userId:ot,isMember:At})=>{if(At){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:At})=>{if(At){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]})}}),be=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)},et=()=>{b(null),k({name:"",description:"",icon:""}),y(!0)},Me=Ve=>{P(Ve),D(""),I(!0)},Ie=Ve=>Q.some(ot=>ot.user_id===Ve),$e=Ve=>Q.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(Dr,{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(ki,{value:n,onValueChange:s,children:[r.jsxs(wi,{children:[r.jsx(an,{value:"categories",children:"Public Categories"}),r.jsxs(an,{value:"private-groups",children:[r.jsx(th,{className:"h-4 w-4 mr-1"}),"Private Groups"]})]}),r.jsxs(Cn,{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(X,{onClick:we,children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),r.jsx(He,{children:r.jsx(Je,{className:"pt-6",children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:V?r.jsx(Nr,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):U.length===0?r.jsx(Nr,{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(Nr,{children:[r.jsx(yt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(X,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:ot===0,onClick:()=>pe.mutate({id:Ve.id,direction:"up"}),children:"↑"}),r.jsx(X,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:ot===U.length-1,onClick:()=>pe.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(X,{variant:"ghost",size:"icon",onClick:()=>be(Ve),children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{confirm("Delete this category? Posts will be uncategorized.")&&se.mutate(Ve.id)},children:r.jsx(Un,{className:"h-4 w-4"})})]})})]},Ve.id))})]})})})]}),r.jsxs(Cn,{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(mi,{className:"h-3 w-3"}),"Brokerage groups are created automatically and sync with brokerage names"]})]}),r.jsxs(X,{onClick:et,children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Private Group"]})]}),r.jsx(He,{children:r.jsx(Je,{className:"pt-6",children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:G?r.jsx(Nr,{children:r.jsx(yt,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):W.length===0?r.jsx(Nr,{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(Nr,{children:[r.jsx(yt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(X,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:ot===0,onClick:()=>he.mutate({id:Ve.id,direction:"up"}),children:"↑"}),r.jsx(X,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:ot===W.length-1,onClick:()=>he.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(Tt,{variant:"outline",className:"text-xs bg-blue-50 text-blue-700 border-blue-200",children:[r.jsx(mi,{className:"h-3 w-3 mr-1"}),"Auto-managed"]}):r.jsxs(Tt,{variant:"secondary",className:"text-xs",children:[r.jsx(th,{className:"h-3 w-3 mr-1"}),"Private"]})]})}),r.jsx(yt,{className:"text-muted-foreground",children:Ve.description||"—"}),r.jsx(yt,{children:r.jsxs(X,{variant:"outline",size:"sm",onClick:()=>Me(Ve),children:[r.jsx(qn,{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(X,{variant:"ghost",size:"icon",onClick:()=>ve(Ve),children:r.jsx(Ja,{className:"h-4 w-4"})}),!Ve.brokerage_id&&r.jsx(X,{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(Un,{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(Or,{open:a,onOpenChange:o,children:r.jsxs(Lr,{children:[r.jsx(zr,{children:r.jsx(Fr,{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(Xn,{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(X,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(X,{onClick:()=>de.mutate({...u,id:l==null?void 0:l.id}),disabled:!u.name.trim(),children:l?"Save Changes":"Create Category"})]})]})]})}),r.jsx(Or,{open:x,onOpenChange:y,children:r.jsxs(Lr,{children:[r.jsx(zr,{children:r.jsx(Fr,{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(Xn,{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(X,{variant:"outline",onClick:()=>y(!1),children:"Cancel"}),r.jsx(X,{onClick:()=>ne.mutate({...N,id:v==null?void 0:v.id}),disabled:!N.name.trim(),children:v?"Save Changes":"Create Private Group"})]})]})]})}),r.jsx(Or,{open:M,onOpenChange:I,children:r.jsxs(Lr,{className:"max-w-2xl",children:[r.jsx(zr,{children:r.jsxs(Fr,{children:["Manage Members: ",T==null?void 0:T.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs(ki,{defaultValue:"brokerages",children:[r.jsxs(wi,{className:"w-full",children:[r.jsx(an,{value:"brokerages",className:"flex-1",children:"By Brokerage"}),r.jsx(an,{value:"users",className:"flex-1",children:"Individual Users"})]}),r.jsxs(Cn,{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(Zo,{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(Tt,{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(Cn,{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(Zo,{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(X,{onClick:()=>I(!1),children:"Done"})})]})]})})]})})},sCe=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(py,{className:"h-3 w-3"});case"social_swag":return r.jsx(Ds,{className:"h-3 w-3"});default:return r.jsx(Ms,{className:"h-3 w-3"})}},hCt=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}},mCt=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}},fCt=()=>{const{toast:e}=pi(),[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(ne=>ne.user_id))||[])],{data:Q}=await Y.from("profiles").select(` id, name, email, brokerages ( name ) `).in("id",G),ae=new Map((Q==null?void 0:Q.map(ne=>[ne.id,ne]))||[]),oe=(D==null?void 0:D.map(ne=>{var me,he,xe,Te;return{id:ne.id,user_id:ne.user_id,app_name:ne.app_name,launched_at:ne.launched_at,user_name:((me=ne.profiles)==null?void 0:me.name)||"Unknown",user_email:((he=ne.profiles)==null?void 0:he.email)||"Unknown",brokerage_name:((Te=(xe=ne.profiles)==null?void 0:xe.brokerages)==null?void 0:Te.name)||null}}))||[],de=(V==null?void 0:V.map(ne=>{var he;const me=ae.get(ne.user_id);return{id:ne.id,user_id:ne.user_id,resource_type:ne.resource_type,resource_id:ne.resource_id,resource_title:ne.resource_title,action_type:ne.action_type,created_at:ne.created_at,user_name:(me==null?void 0:me.name)||"Unknown",user_email:(me==null?void 0:me.email)||"Unknown",brokerage_name:((he=me==null?void 0:me.brokerages)==null?void 0:he.name)||null}}))||[];n(oe),a(de);const se=new Map;oe.forEach(ne=>{if(!se.has(ne.user_id))se.set(ne.user_id,{user_id:ne.user_id,user_name:ne.user_name,user_email:ne.user_email,brokerage_name:ne.brokerage_name,last_activity_type:"app",last_activity_name:ne.app_name,last_activity_at:ne.launched_at,total_app_launches:1,total_content_views:0});else{const me=se.get(ne.user_id);me.total_app_launches++,new Date(ne.launched_at)>new Date(me.last_activity_at)&&(me.last_activity_type="app",me.last_activity_name=ne.app_name,me.last_activity_at=ne.launched_at)}}),de.forEach(ne=>{if(!se.has(ne.user_id))se.set(ne.user_id,{user_id:ne.user_id,user_name:ne.user_name,user_email:ne.user_email,brokerage_name:ne.brokerage_name,last_activity_type:ne.resource_type,last_activity_name:ne.resource_title,last_activity_at:ne.created_at,total_app_launches:0,total_content_views:1});else{const me=se.get(ne.user_id);me.total_content_views++,new Date(ne.created_at)>new Date(me.last_activity_at)&&(me.last_activity_type=ne.resource_type,me.last_activity_name=ne.resource_title,me.last_activity_at=ne.created_at)}});const pe=Array.from(se.values()).sort((ne,me)=>new Date(me.last_activity_at).getTime()-new Date(ne.last_activity_at).getTime());l(pe)}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(Je,{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(kn,{children:"App launches and content engagement - click to see full history"})]}),r.jsxs(Je,{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(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:F.length===0?r.jsx(Nr,{children:r.jsx(yt,{colSpan:6,className:"text-center text-muted-foreground",children:"No activity found"})}):F.map(D=>r.jsxs(Nr,{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(Tt,{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(Tt,{variant:"secondary",children:[r.jsx(Ms,{className:"h-3 w-3 mr-1"}),D.last_activity_name]}):r.jsxs(Tt,{variant:"outline",className:"flex items-center gap-1",children:[sCe(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(Tt,{variant:"outline",children:D.total_app_launches})}),r.jsx(yt,{className:"text-right",children:r.jsx(Tt,{variant:"outline",children:D.total_content_views})})]},D.user_id))})]})})]})]}),r.jsx(Or,{open:!!y,onOpenChange:D=>!D&&P(),children:r.jsxs(Lr,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{children:[y==null?void 0:y.name,"'s Activity"]}),r.jsx(Qn,{children:y==null?void 0:y.email})]}),r.jsxs(ki,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[r.jsxs(wi,{className:"grid w-full grid-cols-2",children:[r.jsxs(an,{value:"content",children:["Content (",k.length,")"]}),r.jsxs(an,{value:"apps",children:["App Launches (",b.length,")"]})]}),r.jsx(Cn,{value:"content",className:"flex-1 overflow-auto mt-4",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{children:[r.jsx(Mt,{children:"Type"}),r.jsx(Mt,{children:"Resource"}),r.jsx(Mt,{children:"Action"}),r.jsx(Mt,{children:"Time"})]})}),r.jsx(zs,{children:k.length===0?r.jsx(Nr,{children:r.jsx(yt,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement"})}):k.map(D=>r.jsxs(Nr,{children:[r.jsx(yt,{children:r.jsxs(Tt,{variant:"outline",className:"flex items-center gap-1 w-fit",children:[sCe(D.resource_type),hCt(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(Tt,{variant:"secondary",children:mCt(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(Cn,{value:"apps",className:"flex-1 overflow-auto mt-4",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{children:[r.jsx(Mt,{children:"App"}),r.jsx(Mt,{children:"Time"})]})}),r.jsx(zs,{children:b.length===0?r.jsx(Nr,{children:r.jsx(yt,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches"})}):b.map(D=>r.jsxs(Nr,{children:[r.jsx(yt,{children:r.jsx(Tt,{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))})]})})})]})]})})]})},pCt=()=>{const{toast:e}=pi(),[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(Je,{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(qn,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Je,{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(li,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Je,{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(Qa,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Je,{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(mi,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Je,{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(Je,{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(Je,{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(Je,{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(rh,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Je,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.uniqueActiveThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Unique users"})]})]})]})},aCe={event:"Event",template:"Template",academy_video:"Academy Video",resource_kit:"Resource Kit",newsletter:"Newsletter",social_swag:"Social Swag"},iCe={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 fBe({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(Q=>Q.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(Tr,{className:"h-4 w-20"})}),r.jsx(Je,{children:r.jsx(Tr,{className:"h-8 w-16"})})]},T))}),r.jsx(He,{children:r.jsx(Je,{className:"p-6",children:r.jsx(Tr,{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(Je,{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(qn,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Je,{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(rh,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Je,{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(Je,{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(Je,{children:r.jsxs("div",{className:"flex flex-wrap gap-2",children:[Object.entries(M).map(([I,T])=>r.jsxs(Tt,{variant:"secondary",className:iCe[I],children:[aCe[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(kn,{children:["All resource shares ",e?"in your brokerage":"across the platform"]})]}),r.jsxs(Je,{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(hn,{value:u,onValueChange:m,children:[r.jsx(cn,{className:"w-[180px]",children:r.jsx(fn,{placeholder:"Resource type"})}),r.jsxs(dn,{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(Zo,{className:"h-[400px]",children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:y.length===0?r.jsx(Nr,{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(Nr,{children:[r.jsx(yt,{className:"font-medium max-w-[200px] truncate",children:I.resource_title}),r.jsx(yt,{children:r.jsx(Tt,{variant:"secondary",className:iCe[I.resource_type],children:aCe[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(Tt,{variant:I.is_read?"default":"outline",children:I.is_read?"Read":"Unread"})}),r.jsx(yt,{className:"text-muted-foreground",children:ln(new Date(I.created_at),"MMM d, yyyy")})]},I.id)})})]})})]})]})]})}const gCt=()=>r.jsx(Dr,{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(ki,{defaultValue:"analytics",className:"space-y-4",children:[r.jsxs(wi,{children:[r.jsx(an,{value:"analytics",children:"Analytics"}),r.jsx(an,{value:"activity",children:"Activity"}),r.jsx(an,{value:"shares",children:"Shares"})]}),r.jsx(Cn,{value:"analytics",className:"space-y-4",children:r.jsx(pCt,{})}),r.jsx(Cn,{value:"activity",className:"space-y-4",children:r.jsx(fCt,{})}),r.jsx(Cn,{value:"shares",className:"space-y-4",children:r.jsx(fBe,{})})]})]})});function xCt(){const e=qr(),[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:Q}=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:de}=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}}),se=()=>{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("")},pe=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(Qe=>Qe.resource_id===Oe.id))||[];v(at.map(Qe=>({id:Qe.id,name:Qe.name,file_url:Qe.file_url,file_size:Qe.file_size,sort_order:Qe.sort_order})));const le=(Q==null?void 0:Q.filter(Qe=>Qe.resource_id===Oe.id))||[];N(le.map(Qe=>({id:Qe.id,title:Qe.title,video_url:Qe.video_url,sort_order:Qe.sort_order})));const qe=(ae==null?void 0:ae.filter(Qe=>Qe.resource_id===Oe.id))||[];M(qe.map(Qe=>({id:Qe.id,title:Qe.title,canva_share_link:Qe.canva_share_link,sort_order:Qe.sort_order}))),n(!0)},ne=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}])},he=Oe=>{v(y.filter((at,le)=>le!==Oe))},xe=(Oe,at,le)=>{const qe=[...y];if(at==="file"&&le instanceof File){const Qe=le.name.replace(/\.[^/.]+$/,"");qe[Oe]={...qe[Oe],file:le,file_size:le.size,name:qe[Oe].name||Qe}}else qe[Oe]={...qe[Oe],[at]:le};v(qe)},Te=()=>{N([...b,{title:"",video_url:"",sort_order:b.length}])},be=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}])},et=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:Qe,libraryId:rt}=le.data,je=await Y.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:qe,libraryId:rt}});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=Ye=>{if(Ye.lengthComputable){const Le=Math.round(Ye.loaded/Ye.total*100),Ke=[...b];Ke[at]={...Ke[at],uploadProgress:Le},N(Ke)}},await new Promise((Ye,Le)=>{Ee.onload=()=>Ee.status>=200&&Ee.status<300?Ye():Le(new Error("Upload failed")),Ee.onerror=()=>Le(new Error("Upload failed")),Ee.send(Oe)}),`https://iframe.mediadelivery.net/embed/${rt}/${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(),Qe=`${Date.now()}.${qe}`,{error:rt}=await Y.storage.from("brokerage-resources").upload(`previews/${Qe}`,i);if(rt)throw rt;const{data:je}=Y.storage.from("brokerage-resources").getPublicUrl(`previews/${Qe}`);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 Qe=(G==null?void 0:G.filter(tt=>tt.resource_id===s.id).map(tt=>tt.id))||[],rt=y.filter(tt=>tt.id).map(tt=>tt.id),je=Qe.filter(tt=>!rt.includes(tt));je.length>0&&await Y.from("brokerage_resource_pdfs").delete().in("id",je);const ut=(Q==null?void 0:Q.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 Ye=(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=Ye.filter(tt=>!Le.includes(tt));Ke.length>0&&await Y.from("brokerage_resource_links").delete().in("id",Ke)}else{const{data:qe,error:Qe}=await Y.from("brokerage_resources").insert(at).select().single();if(Qe)throw Qe;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),se(),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()},At=Oe=>{const at=(G==null?void 0:G.filter(Qe=>Qe.resource_id===Oe).length)||0,le=(Q==null?void 0:Q.filter(Qe=>Qe.resource_id===Oe).length)||0,qe=(ae==null?void 0:ae.filter(Qe=>Qe.resource_id===Oe).length)||0;return{pdfCount:at,videoCount:le,linkCount:qe}};return r.jsx(Dr,{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(Je,{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(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:(V==null?void 0:V.filter(Oe=>Oe.is_published).length)||0})})]})]}),r.jsxs(X,{onClick:()=>{se(),n(!0)},children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Resource"]})]}),r.jsx(He,{children:r.jsx(Je,{className:"p-0",children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:W?r.jsx(Nr,{children:r.jsx(yt,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):(V==null?void 0:V.length)===0?r.jsx(Nr,{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}=At(Oe.id),Qe=oe==null?void 0:oe.find(rt=>rt.id===Oe.category_id);return r.jsxs(Nr,{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(Dh,{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:Qe?r.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-muted",children:Qe.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(Pa,{className:"h-3.5 w-3.5"}),le]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ro,{className:"h-3.5 w-3.5"}),qe]})]})}),r.jsx(yt,{children:ln(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(X,{variant:"ghost",size:"icon",onClick:()=>{const rt=(G==null?void 0:G.filter(Ce=>Ce.resource_id===Oe.id))||[],je=(Q==null?void 0:Q.filter(Ce=>Ce.resource_id===Oe.id))||[],ut=(ae==null?void 0:ae.filter(Ce=>Ce.resource_id===Oe.id))||[];F({...Oe,pdfs:rt,videos:je,links:ut})},children:r.jsx(_o,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>pe(Oe),children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource?")&&Ve.mutate(Oe.id)},children:r.jsx(Un,{className:"h-4 w-4 text-destructive"})})]})})]},Oe.id)})})]})})}),r.jsx(Or,{open:t,onOpenChange:n,children:r.jsxs(Lr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Fr,{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(Dh,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx(lt,{type:"file",accept:"image/*",onChange:ne})]})]}),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(hn,{value:o.category_id,onValueChange:Oe=>l({...o,category_id:Oe}),children:[r.jsx(cn,{className:"flex-1",children:r.jsx(fn,{placeholder:"Select a category"})}),r.jsx(dn,{children:oe==null?void 0:oe.map(Oe=>r.jsx($t,{value:Oe.id,children:Oe.name},Oe.id))})]}),o.category_id&&r.jsx(X,{type:"button",variant:"ghost",size:"icon",onClick:()=>l({...o,category_id:""}),children:r.jsx(us,{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(X,{type:"button",variant:"outline",size:"sm",disabled:!D.trim()||$e.isPending,onClick:()=>$e.mutate(D.trim()),children:[r.jsx(bn,{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(Is,{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(X,{type:"button",variant:"outline",size:"sm",onClick:me,children:[r.jsx(bn,{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 Qe;const qe=(Qe=le.target.files)==null?void 0:Qe[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(X,{type:"button",variant:"ghost",size:"icon",onClick:()=>he(at),children:r.jsx(us,{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(Pa,{className:"h-4 w-4"}),"Videos (",b.length,")"]}),r.jsxs(X,{type:"button",variant:"outline",size:"sm",onClick:Te,children:[r.jsx(bn,{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(X,{type:"button",variant:"ghost",size:"icon",onClick:()=>be(at),children:r.jsx(us,{className:"h-4 w-4"})})]}),r.jsx(lt,{type:"file",accept:"video/*",onChange:le=>{var Qe;const qe=(Qe=le.target.files)==null?void 0:Qe[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(Ro,{className:"h-4 w-4"}),"Canva Links (",k.length,")"]}),r.jsxs(X,{type:"button",variant:"outline",size:"sm",onClick:ve,children:[r.jsx(bn,{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(X,{type:"button",variant:"ghost",size:"icon",onClick:()=>et(at),children:r.jsx(us,{className:"h-4 w-4"})})]},at))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(X,{type:"button",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),r.jsx(X,{type:"submit",disabled:Be.isPending||I,children:Be.isPending||I?"Saving...":s?"Update":"Create"})]})]})]})}),r.jsx(Or,{open:!!P,onOpenChange:()=>F(null),children:r.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Fr,{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(Pa,{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(Ro,{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 pBe=[{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 yCt(){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"),[Q,ae]=A.useState(""),[oe,de]=A.useState(!0),[se,pe]=A.useState(""),[ne,me]=A.useState("");A.useEffect(()=>{he()},[]);const he=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(""),de(!0),pe(""),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||""),de($e.is_active),pe($e.start_date?ln(new Date($e.start_date),"yyyy-MM-dd'T'HH:mm"):""),me($e.end_date?ln(new Date($e.end_date),"yyyy-MM-dd'T'HH:mm"):""),o(!0)},be=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(),At=`${Date.now()}.${ot}`,{error:Oe}=await Y.storage.from("banner-images").upload(At,Be);if(Oe)throw Oe;const{data:{publicUrl:at}}=Y.storage.from("banner-images").getPublicUrl(At);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"?Q:null,is_active:oe,start_date:se?new Date(se).toISOString():null,end_date:ne?new Date(ne).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(),he()}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),he()}catch($e){Ae.error("Failed to delete banner: "+$e.message)}},et=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"),he()}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(Dr,{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(Dr,{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(kn,{children:"These banners appear in a rotating carousel at the top of the dashboard"})]}),r.jsxs(Or,{open:a&&W==="top",onOpenChange:$e=>{$e||xe(),o($e),$e&&G("top")},children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{onClick:()=>{xe(),G("top")},children:[r.jsx(bn,{className:"mr-2 h-4 w-4"}),"Add Hero Banner"]})}),r.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{children:[u?"Edit":"Create"," Banner"]}),r.jsx(Qn,{children:"Configure the banner's content and display settings"})]}),r.jsx(oCe,{title:N,setTitle:k,description:M,setDescription:I,imageUrl:T,linkUrl:F,setLinkUrl:D,linkText:U,setLinkText:V,placement:W,setPlacement:G,sectionAfter:Q,setSectionAfter:ae,isActive:oe,setIsActive:de,startDate:se,setStartDate:pe,endDate:ne,setEndDate:me,handleImageUpload:be,uploading:x,showPlacementOptions:!1}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>{o(!1),xe()},children:"Cancel"}),r.jsx(X,{onClick:we,disabled:v,children:v?"Saving...":u?"Update Banner":"Create Banner"})]})]})]})]}),r.jsx(Je,{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(lCe,{banner:$e,onEdit:()=>Te($e),onDelete:()=>{m($e),i(!0)},onToggleActive:()=>et($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(kn,{children:"These banners appear between dashboard content sections"})]}),r.jsxs(Or,{open:a&&W==="between",onOpenChange:$e=>{$e||xe(),o($e),$e&&G("between")},children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{onClick:()=>{xe(),G("between")},children:[r.jsx(bn,{className:"mr-2 h-4 w-4"}),"Add Section Banner"]})}),r.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{children:[u?"Edit":"Create"," Section Banner"]}),r.jsx(Qn,{children:"Configure where this banner appears between sections"})]}),r.jsx(oCe,{title:N,setTitle:k,description:M,setDescription:I,imageUrl:T,linkUrl:F,setLinkUrl:D,linkText:U,setLinkText:V,placement:W,setPlacement:G,sectionAfter:Q,setSectionAfter:ae,isActive:oe,setIsActive:de,startDate:se,setStartDate:pe,endDate:ne,setEndDate:me,handleImageUpload:be,uploading:x,showPlacementOptions:!0}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>{o(!1),xe()},children:"Cancel"}),r.jsx(X,{onClick:we,disabled:v,children:v?"Saving...":u?"Update Banner":"Create Banner"})]})]})]})]}),r.jsx(Je,{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(lCe,{banner:$e,onEdit:()=>Te($e),onDelete:()=>{m($e),i(!0)},onToggleActive:()=>et($e),showSection:!0},$e.id))})})]})]}),r.jsx(Or,{open:l,onOpenChange:i,children:r.jsxs(Lr,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Delete Banner"}),r.jsxs(Qn,{children:['Are you sure you want to delete "',u==null?void 0:u.title,'"? This action cannot be undone.']})]}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(X,{variant:"destructive",onClick:ve,children:"Delete"})]})]})})]})}function oCe({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(Xn,{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(hn,{value:y,onValueChange:v,children:[r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select section placement..."})}),r.jsx(dn,{children:pBe.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(Ts,{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(Ts,{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(Is,{id:"isActive",checked:b,onCheckedChange:N}),r.jsx(ze,{htmlFor:"isActive",children:"Active"})]})})]})}function lCe({banner:e,onEdit:t,onDelete:n,onToggleActive:s,showSection:a=!1}){var l;const o=(l=pBe.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(Tt,{variant:"secondary",children:"Inactive"}),e.start_date&&new Date(e.start_date)>new Date&&r.jsx(Tt,{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(X,{variant:"ghost",size:"icon",children:r.jsx(Ms,{className:"h-4 w-4"})})}),r.jsx(X,{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(X,{variant:"ghost",size:"icon",onClick:t,children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:n,children:r.jsx(Un,{className:"h-4 w-4 text-destructive"})})]})]})}const AO={open:{label:"Open",icon:Qa,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:Ul,color:"bg-blue-500"},resolved:{label:"Resolved",icon:li,color:"bg-green-500"},closed:{label:"Closed",icon:bc,color:"bg-muted-foreground"}},cCe={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function vCt(){var U,V;const{user:e}=tn(),t=qr(),[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:Q}=await W;if(Q)throw Q;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 Q=W.map(ne=>ne.user_id),{data:ae,error:oe}=await Y.from("profiles").select("id, name, email").in("id",Q);if(oe)throw oe;const{data:de,error:se}=await Y.from("support_notification_settings").select("user_id, receive_notifications");if(se)throw se;const pe=new Map((de==null?void 0:de.map(ne=>[ne.user_id,ne.receive_notifications]))||[]);return ae.map(ne=>({...ne,receives_notifications:pe.get(ne.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:Q}=await Y.from("support_notification_settings").select("id").eq("user_id",W).maybeSingle();if(Q){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:Q}=await Y.from("support_tickets").update({status:G}).eq("id",W);if(Q)throw Q},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:Q}=await Y.from("support_tickets").update({assigned_to:G}).eq("id",W);if(Q)throw Q},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-support-tickets"]}),Ae.success("Ticket assigned")},onError:()=>{Ae.error("Failed to assign ticket")}}),P=ar({mutationFn:async W=>{var Q,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:(Q=n.profiles)==null?void 0:Q.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?(AO[n.status].icon,r.jsx(Dr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(X,{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(Tt,{variant:"secondary",children:cCe[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(Je,{children:r.jsxs(hn,{value:n.status,onValueChange:W=>{I.mutate({ticketId:n.id,status:W}),s({...n,status:W})},children:[r.jsx(cn,{children:r.jsx(fn,{})}),r.jsxs(dn,{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(Je,{children:r.jsxs(hn,{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(cn,{children:r.jsx(fn,{placeholder:"Unassigned"})}),r.jsxs(dn,{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(kn,{children:["Created on ",ln(new Date(n.created_at),"MMM d, yyyy 'at' h:mm a")]})}),r.jsx(Je,{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(Je,{children:[r.jsx(Zo,{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,Q;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)`:((Q=W.profiles)==null?void 0:Q.name)||"User"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:ln(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(Dd,{className:"my-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Xn,{placeholder:"Type your reply...",value:a,onChange:W=>o(W.target.value),className:"min-h-[80px]"}),r.jsx(X,{onClick:F,disabled:!a.trim()||P.isPending,className:"self-end",children:r.jsx(Ji,{className:"h-4 w-4"})})]})]})]})]})})):r.jsx(Dr,{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(Tt,{variant:"destructive",className:"ml-2",children:[D," open"]})]})]}),r.jsxs(Or,{open:x,onOpenChange:y,children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{variant:"outline",children:[r.jsx(Bd,{className:"h-4 w-4 mr-2"}),"Notification Settings"]})}),r.jsxs(Lr,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Email Notification Settings"}),r.jsx(Qn,{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(Is,{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(ki,{value:l,onValueChange:i,className:"w-auto",children:r.jsxs(wi,{children:[r.jsx(an,{value:"all",children:"All"}),r.jsx(an,{value:"open",children:"Open"}),r.jsx(an,{value:"in_progress",children:"In Progress"}),r.jsx(an,{value:"resolved",children:"Resolved"}),r.jsx(an,{value:"closed",children:"Closed"})]})}),r.jsxs(hn,{value:u,onValueChange:m,children:[r.jsx(cn,{className:"w-[180px]",children:r.jsx(fn,{placeholder:"All Categories"})}),r.jsxs(dn,{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(Je,{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 Q,ae;const G=AO[W.status].icon;return r.jsx(He,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>s(W),children:r.jsx(Je,{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(Tt,{variant:"outline",className:"text-xs",children:cCe[W.category]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[(Q=W.profiles)==null?void 0:Q.name," • ",ln(new Date(W.created_at),"MMM d, yyyy")]}),W.assigned_to&&r.jsxs(Tt,{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(Tt,{className:AO[W.status].color,children:[r.jsx(G,{className:"h-3 w-3 mr-1"}),AO[W.status].label]})]})})},W.id)})})})]})]})})}const _Ct=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 bCt({content:e,onChange:t,variables:n}){const s=a7e({extensions:[u7e,b7e.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),w7e.configure({types:["heading","paragraph"]}),j7e,_Ct],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(X,{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(X,{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(X,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleBulletList().run(),className:s.isActive("bulletList")?"bg-muted":"",children:r.jsx(ff,{className:"h-4 w-4"})}),r.jsx(X,{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(X,{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(X,{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(X,{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(X,{type:"button",variant:"ghost",size:"sm",onClick:o,className:s.isActive("link")?"bg-muted":"",children:r.jsx(Ro,{className:"h-4 w-4"})}),r.jsx(X,{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(X,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().undo().run(),disabled:!s.can().undo(),children:r.jsx(F4,{className:"h-4 w-4"})}),r.jsx(X,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().redo().run(),disabled:!s.can().redo(),children:r.jsx(O4,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex-1"}),n.length>0&&r.jsxs(dh,{children:[r.jsx(uh,{asChild:!0,children:r.jsxs(X,{type:"button",variant:"outline",size:"sm",className:"gap-2",children:[r.jsx(PA,{className:"h-4 w-4"}),"Insert Variable"]})}),r.jsx(Nu,{align:"end",className:"w-64",children:n.map(l=>r.jsxs(Ha,{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(n7e,{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(Tt,{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 wCt(){const e=qr(),[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}}}`,Q=`[${W.label}]`;V=V.replace(new RegExp(G.replace(/[{}]/g,"\\$&"),"g"),Q)}),V};return t?r.jsxs(Dr,{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(X,{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(X,{variant:"outline",onClick:()=>a(t),children:[r.jsx(_o,{className:"h-4 w-4 mr-2"}),"Preview"]}),r.jsxs(X,{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(ks,{className:"h-5 w-5"}),t.name]}),r.jsxs(kn,{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(Is,{id:"active-toggle",checked:y,onCheckedChange:v})]})]})}),r.jsxs(Je,{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"description",children:"Description"}),r.jsx(Xn,{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(ki,{value:b,onValueChange:D=>N(D),children:r.jsxs(wi,{className:"h-8",children:[r.jsxs(an,{value:"visual",className:"text-xs px-3 h-6",children:[r.jsx(Bj,{className:"h-3 w-3 mr-1"}),"Visual"]}),r.jsxs(an,{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(bCt,{content:i,onChange:u,variables:t.available_variables}):r.jsx(Xn,{value:i,onChange:D=>u(D.target.value),className:"font-mono text-sm min-h-[400px]",placeholder:"HTML email body"})]})]})]})]}),r.jsx(Or,{open:!!s,onOpenChange:()=>a(null),children:r.jsxs(Lr,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Email Preview"}),r.jsxs(Qn,{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(Dr,{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(Tr,{className:"h-5 w-48"}),r.jsx(Tr,{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(ks,{className:"h-5 w-5 text-muted-foreground"}),D.name,!D.is_active&&r.jsx(Tt,{variant:"secondary",children:"Inactive"})]}),r.jsx(kn,{children:D.description})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(X,{variant:"outline",size:"sm",onClick:()=>a(D),children:[r.jsx(_o,{className:"h-4 w-4 mr-2"}),"Preview"]}),r.jsxs(X,{size:"sm",onClick:()=>T(D),children:[r.jsx(gc,{className:"h-4 w-4 mr-2"}),"Edit"]})]})]})}),r.jsx(Je,{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(Tt,{variant:"outline",className:"font-mono text-xs",children:`{{${U.key}}}`},U.key))})]})]})})]},D.id))}),r.jsx(Or,{open:!!s&&!t,onOpenChange:()=>a(null),children:r.jsxs(Lr,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{children:["Email Preview: ",s==null?void 0:s.name]}),r.jsxs(Qn,{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 jCt(){const e=qr(),[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:Q,error:ae}=await Y.from("email_template_categories").select("*").order("sort_order");if(ae)throw ae;return Q}}),{data:M=[],isLoading:I}=Zt({queryKey:["agent-email-templates-admin"],queryFn:async()=>{const{data:Q,error:ae}=await Y.from("agent_email_templates").select("*, category:email_template_categories(*)").order("sort_order");if(ae)throw ae;return Q}}),T=ar({mutationFn:async Q=>{const ae={title:Q.title,subject:Q.subject,body:Q.body,description:Q.description||null,tone:Q.tone||null,category_id:Q.category_id||null,is_active:Q.is_active};if(Q.id){const{error:oe}=await Y.from("agent_email_templates").update(ae).eq("id",Q.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 Q=>{const{error:ae}=await Y.from("agent_email_templates").delete().eq("id",Q);if(ae)throw ae},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-email-templates-admin"]}),Ae.success("Template deleted")}}),F=ar({mutationFn:async Q=>{const ae={name:Q.name,description:Q.description||null,icon:Q.icon};if(Q.id){const{error:oe}=await Y.from("email_template_categories").update(ae).eq("id",Q.id);if(oe)throw oe}else{const oe=k.length>0?Math.max(...k.map(se=>se.sort_order))+1:0,{error:de}=await Y.from("email_template_categories").insert({...ae,sort_order:oe});if(de)throw de}},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 Q=>{const{error:ae}=await Y.from("email_template_categories").delete().eq("id",Q);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=Q=>{a(Q),v({title:Q.title,subject:Q.subject,body:Q.body,description:Q.description||"",tone:Q.tone||"",category_id:Q.category_id||"",is_active:Q.is_active}),u(!0)},W=()=>{l(null),N({name:"",description:"",icon:"📧"}),x(!0)},G=Q=>{l(Q),N({name:Q.name,description:Q.description||"",icon:Q.icon}),x(!0)};return r.jsx(Dr,{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(ki,{value:t,onValueChange:n,children:[r.jsxs(wi,{children:[r.jsxs(an,{value:"templates",className:"gap-2",children:[r.jsx(ks,{className:"h-4 w-4"})," Templates"]}),r.jsxs(an,{value:"categories",className:"gap-2",children:[r.jsx(Ap,{className:"h-4 w-4"})," Categories"]})]}),r.jsxs(Cn,{value:"templates",className:"space-y-4",children:[r.jsx("div",{className:"flex justify-end",children:r.jsxs(X,{onClick:U,className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"})," Add Template"]})}),r.jsx(He,{children:r.jsx(Je,{className:"p-0",children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:I?r.jsx(Nr,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8",children:r.jsx(Wr,{className:"h-6 w-6 animate-spin mx-auto"})})}):M.length===0?r.jsx(Nr,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No templates yet. Create your first one!"})}):M.map(Q=>r.jsxs(Nr,{children:[r.jsx(yt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:Q.title}),r.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[300px]",children:Q.subject})]})}),r.jsx(yt,{className:"hidden md:table-cell",children:Q.category?r.jsxs(Tt,{variant:"outline",className:"gap-1",children:[Q.category.icon," ",Q.category.name]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(yt,{className:"hidden md:table-cell",children:Q.tone?r.jsx(Tt,{variant:"secondary",children:Q.tone}):"—"}),r.jsx(yt,{children:r.jsx(Tt,{variant:Q.is_active?"default":"secondary",children:Q.is_active?"Active":"Inactive"})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-1",children:[r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>V(Q),children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",onClick:()=>{confirm("Delete this template?")&&P.mutate(Q.id)},children:r.jsx(Un,{className:"h-4 w-4"})})]})})]},Q.id))})]})})})]}),r.jsxs(Cn,{value:"categories",className:"space-y-4",children:[r.jsx("div",{className:"flex justify-end",children:r.jsxs(X,{onClick:W,className:"gap-2",children:[r.jsx(bn,{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(Q=>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:Q.icon})," ",Q.name]}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(X,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>G(Q),children:r.jsx(Ja,{className:"h-3.5 w-3.5"})}),r.jsx(X,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive",onClick:()=>{confirm("Delete this category?")&&D.mutate(Q.id)},children:r.jsx(Un,{className:"h-3.5 w-3.5"})})]})]})}),r.jsxs(Je,{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:Q.description||"No description"}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:[M.filter(ae=>ae.category_id===Q.id).length," templates"]})]})]},Q.id))})]})]}),r.jsx(Or,{open:i,onOpenChange:u,children:r.jsxs(Lr,{className:"sm:max-w-[700px] max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Fr,{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:Q=>v(ae=>({...ae,title:Q.target.value})),placeholder:"e.g. Quick Check-in"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{children:"Category"}),r.jsxs(hn,{value:y.category_id,onValueChange:Q=>v(ae=>({...ae,category_id:Q})),children:[r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select category"})}),r.jsx(dn,{children:k.map(Q=>r.jsxs($t,{value:Q.id,children:[Q.icon," ",Q.name]},Q.id))})]})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{children:"Subject Line"}),r.jsx(lt,{value:y.subject,onChange:Q=>v(ae=>({...ae,subject:Q.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(Xn,{value:y.body,onChange:Q=>v(ae=>({...ae,body:Q.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:Q=>v(ae=>({...ae,description:Q.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:Q=>v(ae=>({...ae,tone:Q.target.value})),placeholder:"e.g. Warm & Casual"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Is,{checked:y.is_active,onCheckedChange:Q=>v(ae=>({...ae,is_active:Q}))}),r.jsx(ze,{children:"Active"})]})]}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsxs(X,{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(Wr,{className:"h-4 w-4 mr-2 animate-spin"}),s?"Save Changes":"Create Template"]})]})]})}),r.jsx(Or,{open:m,onOpenChange:x,children:r.jsxs(Lr,{className:"sm:max-w-[450px]",children:[r.jsx(zr,{children:r.jsx(Fr,{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:Q=>N(ae=>({...ae,icon:Q.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:Q=>N(ae=>({...ae,name:Q.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:Q=>N(ae=>({...ae,description:Q.target.value})),placeholder:"Brief description of this category"})]})]}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>x(!1),children:"Cancel"}),r.jsxs(X,{onClick:()=>F.mutate({...b,id:o==null?void 0:o.id}),disabled:F.isPending||!b.name,children:[F.isPending&&r.jsx(Wr,{className:"h-4 w-4 mr-2 animate-spin"}),o?"Save Changes":"Create Category"]})]})]})})]})})}const kCt=({brokerageId:e})=>{var go,uc;const{toast:t}=pi(),[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),[Q,ae]=A.useState(!1),[oe,de]=A.useState(!1),[se,pe]=A.useState(!1),[ne,me]=A.useState(""),[he,xe]=A.useState(!1),[Te,be]=A.useState([]),[we,ve]=A.useState(!1),[et,Me]=A.useState(!1),[Ie,$e]=A.useState(null),[Be,Ve]=A.useState({name:"",phone:"",email:""}),[ot,At]=A.useState(!1),[Oe,at]=A.useState(!1),[le,qe]=A.useState(null),[Qe,rt]=A.useState("asc"),[je,ut]=A.useState(!1),[Ce,Ee]=A.useState(null),[Ye,Le]=A.useState(!1),[Ke,tt]=A.useState(null),[ct,it]=A.useState(""),[zt,ir]=A.useState(!1),[Mr,Zr]=A.useState(null);A.useEffect(()=>{rn(),Br()},[e]);const Br=async()=>{try{const{data:nt,error:ye}=await Y.from("brokerage_manager_assignments").select("user_id").eq("brokerage_id",e);if(ye)throw ye;be((nt==null?void 0:nt.map(Pe=>Pe.user_id))||[])}catch(nt){console.error("Error loading brokerage managers:",nt)}},rn=async()=>{try{o(!0);const{data:nt,error:ye}=await Y.functions.invoke("get-brokerage-agents",{body:{brokerageId:e}});if(ye)throw ye;const Pe=nt.agents||[];if(s(Pe),Pe.length>0){const Ze=Pe.map(bt=>bt.id),{data:Nt}=await Y.from("agent_assistant_assignments").select("agent_id, assistant_id").in("agent_id",Ze);if(Nt&&Nt.length>0){const bt=Nt.map(Lt=>Lt.assistant_id),{data:It}=await Y.from("profiles").select("id, name, email").in("id",bt),qt={};for(const Lt of Nt){const Wt=It==null?void 0:It.find(fr=>fr.id===Lt.assistant_id);Wt&&(qt[Lt.agent_id]={name:Wt.name||"",email:Wt.email||""})}k(qt)}else k({})}}catch(nt){console.error("Error loading agents:",nt),t({title:"Error",description:"Failed to load agents",variant:"destructive"})}finally{o(!1)}},Zn=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:nt}}=await Y.auth.getSession(),ye=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${nt==null?void 0:nt.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),rn()}catch(nt){console.error("Error creating agent:",nt),t({title:"Error",description:nt.message||"Failed to create agent",variant:"destructive"})}finally{P(!1)}},Ot=async nt=>{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:nt})}),Ze=await Pe.json();if(!Pe.ok)throw new Error(Ze.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"})}},Gr=async(nt,ye)=>{try{const{error:Pe}=await Y.functions.invoke("send-password-reset",{body:{email:nt,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"})}},An=nt=>{G(nt),V(!0)},zn=nt=>{$e(nt),Ve({name:nt.name,phone:nt.phone||"",email:nt.email}),Me(!0)},ba=async()=>{if(!Ie)return;if(!Be.name.trim()){t({title:"Error",description:"Name is required",variant:"destructive"});return}const nt=Be.email.trim().toLowerCase()!==Ie.email.toLowerCase();At(!0);try{if(nt){if(!Be.email.trim())throw new Error("Email is required");at(!0);const{data:{session:Pe}}=await Y.auth.getSession(),Ze=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 Ze.json();if(at(!1),!Ze.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),rn()}catch(ye){console.error("Error updating agent:",ye),t({title:"Error",description:ye.message||"Failed to update agent",variant:"destructive"})}finally{At(!1),at(!1)}},gi=async()=>{if(!ne){t({title:"Error",description:"Please select an agent to promote",variant:"destructive"});return}xe(!0);try{const{data:{session:nt}}=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 ${nt==null?void 0:nt.access_token}`},body:JSON.stringify({userId:ne,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"}),pe(!1),me(""),Br()}catch(nt){console.error("Error adding brokerage manager:",nt),t({title:"Error",description:nt.message||"Failed to add brokerage manager",variant:"destructive"})}finally{xe(!1)}},Mo=async nt=>{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:nt,role:"brokerage_manager",action:"remove",brokerageId:e})}),Ze=await Pe.json();if(!Pe.ok)throw new Error(Ze.error||"Failed to remove brokerage manager");t({title:"Success",description:"Brokerage manager role removed"}),Br()}catch(ye){console.error("Error removing brokerage manager:",ye),t({title:"Error",description:ye.message||"Failed to remove brokerage manager",variant:"destructive"})}},Wa=nt=>Te.includes(nt),ms=nt=>{tt(nt),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}ir(!0);try{const{data:{session:nt}}=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 ${nt==null?void 0:nt.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(nt){console.error("Error setting password:",nt),t({title:"Error",description:nt.message||"Failed to set password",variant:"destructive"})}finally{ir(!1)}}},fs=async nt=>{Zr(nt.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:nt.id,brokerageId:e,action:"claim_account"})}),Ze=await Pe.json();if(!Pe.ok)throw new Error(Ze.error||"Failed to claim account");t({title:"Success",description:`Account claimed for ${nt.name}`}),rn()}catch(ye){console.error("Error claiming account:",ye),t({title:"Error",description:ye.message||"Failed to claim account",variant:"destructive"})}finally{Zr(null)}},Ys=async()=>{if(W){ae(!0);try{const{data:{session:nt}}=await Y.auth.getSession(),ye=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/remove-agent",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${nt==null?void 0:nt.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),rn()}catch(nt){console.error("Error removing agent:",nt),t({title:"Error",description:nt.message||"Failed to remove agent",variant:"destructive"})}finally{ae(!1)}}},Bs=nt=>{const ye=nt.trim().split(" ");return ye.length>1?ye[ye.length-1].toLowerCase():nt.toLowerCase()},Ni=nt=>{le===nt?rt(Qe==="asc"?"desc":"asc"):(qe(nt),rt("asc"))},or=nt=>le!==nt?r.jsx(Og,{className:"ml-1 h-4 w-4"}):Qe==="asc"?r.jsx(uf,{className:"ml-1 h-4 w-4"}):r.jsx(oy,{className:"ml-1 h-4 w-4"}),La=n.filter(nt=>{if(u==="active"&&!nt.claimed||u==="pending"&&nt.claimed)return!1;if(!l)return!0;const ye=l.toLowerCase();return nt.name.toLowerCase().includes(ye)||nt.email.toLowerCase().includes(ye)}),oo=[...La].sort((nt,ye)=>{if(!le)return 0;let Pe=0;return le==="name"?Pe=Bs(nt.name).localeCompare(Bs(ye.name)):le==="status"&&(Pe=nt.claimed===ye.claimed?0:nt.claimed?-1:1),Qe==="asc"?Pe:-Pe});La.filter(nt=>nt.claimed&&!Wa(nt.id));const ji=nt=>{y(ye=>{const Pe=new Set(ye);return Pe.has(nt)?Pe.delete(nt):Pe.add(nt),Pe})},Hn=()=>{x.size===oo.length?y(new Set):y(new Set(oo.map(nt=>nt.id)))},Ki=()=>{y(new Set)},dc=async()=>{const nt=Array.from(x);if(nt.length===0)return;b(!0);let ye=0,Pe=0;try{const{data:{session:Ze}}=await Y.auth.getSession();for(const Nt of nt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ze==null?void 0:Ze.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(Ze){console.error("Error bulk sending welcome emails:",Ze),t({title:"Error",description:Ze.message||"Failed to send welcome emails",variant:"destructive"})}finally{b(!1)}};return a?r.jsx(He,{children:r.jsx(Je,{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(kn,{children:"Manage your brokerage's agents"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(X,{variant:"outline",onClick:()=>pe(!0),children:[r.jsx(_m,{className:"mr-2 h-4 w-4"}),"Add Brokerage Manager"]}),r.jsxs(X,{variant:"outline",onClick:()=>de(!0),children:[r.jsx(H1,{className:"mr-2 h-4 w-4"}),"Import CSV"]}),r.jsxs(X,{onClick:()=>I(!0),children:[r.jsx(nh,{className:"mr-2 h-4 w-4"}),"Add Agent"]})]})]})}),r.jsxs(Je,{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:nt=>i(nt.target.value),className:"pl-9"})]}),r.jsxs(hn,{value:u,onValueChange:nt=>m(nt),children:[r.jsx(cn,{className:"w-[160px]",children:r.jsx(fn,{placeholder:"Filter by status"})}),r.jsxs(dn,{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(X,{size:"sm",variant:"outline",onClick:dc,disabled:v,children:[r.jsx(ks,{className:"mr-2 h-4 w-4"}),v?"Sending...":"Resend Welcome Email"]}),r.jsx(X,{size:"sm",variant:"ghost",onClick:Ki,children:"Clear"})]}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{children:[r.jsx(Mt,{className:"w-[40px]",children:r.jsx(_l,{checked:oo.length>0&&x.size===oo.length,onCheckedChange:Hn,"aria-label":"Select all"})}),r.jsx(Mt,{children:r.jsxs(X,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-transparent",onClick:()=>Ni("name"),children:["Name (Last)",or("name")]})}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{children:r.jsxs(X,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-transparent",onClick:()=>Ni("status"),children:["Status",or("status")]})}),r.jsx(Mt,{children:"Actions"})]})}),r.jsx(zs,{children:oo.length===0?r.jsx(Nr,{children:r.jsx(yt,{colSpan:5,className:"text-center text-muted-foreground",children:"No agents found"})}):oo.map(nt=>r.jsxs(Nr,{children:[r.jsx(yt,{children:r.jsx(_l,{checked:x.has(nt.id),onCheckedChange:()=>ji(nt.id),"aria-label":`Select ${nt.name}`})}),r.jsx(yt,{className:"font-medium",children:nt.name}),r.jsx(yt,{children:nt.email}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[nt.claimed?r.jsx(Tt,{variant:"default",children:"Active"}):r.jsx(Tt,{variant:"secondary",children:"Pending"}),Wa(nt.id)&&r.jsxs(Tt,{variant:"outline",className:"border-primary text-primary",children:[r.jsx(SA,{className:"mr-1 h-3 w-3"}),"Manager"]}),N[nt.id]&&r.jsxs(Tt,{variant:"outline",className:"text-xs",children:[r.jsx(qn,{className:"mr-1 h-3 w-3"}),"Asst: ",N[nt.id].name||N[nt.id].email]})]})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.jsx(X,{size:"sm",variant:"ghost",onClick:()=>{Ee(nt),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(X,{size:"sm",variant:"ghost",onClick:()=>zn(nt),title:"Edit agent",children:r.jsx(Ja,{className:"h-4 w-4"})}),!nt.claimed&&r.jsxs(r.Fragment,{children:[r.jsx(X,{size:"sm",variant:"ghost",onClick:()=>Ot(nt.id),title:"Resend welcome email",children:r.jsx(ks,{className:"h-4 w-4"})}),r.jsx(X,{size:"sm",variant:"ghost",onClick:()=>fs(nt),title:"Claim account for agent",disabled:Mr===nt.id,className:"text-green-600 hover:text-green-700 hover:bg-green-50",children:r.jsx(Vj,{className:"h-4 w-4"})})]}),r.jsx(X,{size:"sm",variant:"ghost",onClick:()=>ms(nt),title:"Set password",className:"text-blue-600 hover:text-blue-700 hover:bg-blue-50",children:r.jsx(th,{className:"h-4 w-4"})}),r.jsx(X,{size:"sm",variant:"ghost",onClick:()=>Gr(nt.email,nt.name),title:"Send password reset email",children:r.jsx(Rj,{className:"h-4 w-4"})}),Wa(nt.id)&&r.jsx(X,{size:"sm",variant:"ghost",onClick:()=>Mo(nt.id),title:"Remove manager role",className:"text-orange-500 hover:text-orange-600",children:r.jsx(_m,{className:"h-4 w-4"})}),r.jsx(X,{size:"sm",variant:"ghost",onClick:()=>An(nt),className:"text-destructive hover:text-destructive",title:"Remove agent",children:r.jsx(Un,{className:"h-4 w-4"})})]})})]},nt.id))})]})})]})]}),r.jsx(Or,{open:M,onOpenChange:I,children:r.jsxs(Lr,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Add New Agent"}),r.jsx(Qn,{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:nt=>D({...F,name:nt.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:nt=>D({...F,email:nt.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:nt=>D({...F,phone:nt.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:nt=>D({...F,password:nt.target.value}),placeholder:"Temporary password"})]})]}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>I(!1),children:"Cancel"}),r.jsx(X,{onClick:Zn,disabled:T,children:T?"Creating...":"Create Agent"})]})]})}),r.jsx(Or,{open:U,onOpenChange:V,children:r.jsxs(Lr,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Remove Agent"}),r.jsxs(Qn,{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(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>V(!1),children:"Cancel"}),r.jsx(X,{variant:"destructive",onClick:Ys,disabled:Q,children:Q?"Removing...":"Remove Agent"})]})]})}),r.jsx(q9e,{open:oe,onOpenChange:de,fixedBrokerageId:e,onSuccess:rn}),r.jsx(Or,{open:se,onOpenChange:pe,children:r.jsxs(Lr,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Add Brokerage Manager"}),r.jsx(Qn,{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(X,{variant:"outline",role:"combobox","aria-expanded":we,className:"w-full justify-between",children:[ne?((go=n.find(nt=>nt.id===ne))==null?void 0:go.name)+" ("+((uc=n.find(nt=>nt.id===ne))==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(Ly,{children:[r.jsx(Oy,{placeholder:"Search by name or email..."}),r.jsxs(Dy,{className:"max-h-[200px]",children:[r.jsx(Ry,{children:"No eligible agents found."}),r.jsx(Fy,{children:n.filter(nt=>!Wa(nt.id)).map(nt=>r.jsxs(zy,{value:`${nt.name} ${nt.email}`,onSelect:()=>{me(nt.id),ve(!1)},children:[r.jsx(fi,{className:`mr-2 h-4 w-4 ${ne===nt.id?"opacity-100":"opacity-0"}`}),nt.name," (",nt.email,")"]},nt.id))})]})]})})]}),n.filter(nt=>!Wa(nt.id)).length===0&&r.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"All agents are already brokerage managers."})]})}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>pe(!1),children:"Cancel"}),r.jsx(X,{onClick:gi,disabled:he||!ne,children:he?"Adding...":"Add as Manager"})]})]})}),r.jsx(Or,{open:et,onOpenChange:Me,children:r.jsxs(Lr,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Edit Agent"}),r.jsxs(Qn,{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:nt=>Ve({...Be,name:nt.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:nt=>Ve({...Be,email:nt.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:nt=>Ve({...Be,phone:nt.target.value}),placeholder:"555-123-4567"})]})]}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>Me(!1),children:"Cancel"}),r.jsx(X,{onClick:ba,disabled:ot||Oe,children:Oe?"Updating email...":ot?"Saving...":"Save Changes"})]})]})}),Ce&&r.jsx(V9e,{open:je,onOpenChange:nt=>{ut(nt),nt||Ee(null)},userId:Ce.id,userName:Ce.name}),r.jsx(Or,{open:Ye,onOpenChange:Le,children:r.jsxs(Lr,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Set Password"}),r.jsxs(Qn,{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:nt=>it(nt.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(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>Le(!1),children:"Cancel"}),r.jsx(X,{onClick:ra,disabled:zt||!ct||ct.length<6,children:zt?"Setting...":"Set Password"})]})]})})]})},NCt={academy_video:"Academy Video",template:"Template",toolbox:"Toolbox Resource",newsletter:"Newsletter",social_swag:"Social Swag",event:"Event"},SCt={view:"Viewed",click_canva:"Opened Canva",click_pdf:"Downloaded PDF",click_video:"Watched Video",click_link:"Clicked Link",register:"Registered"},CCt=e=>{switch(e){case"academy_video":return r.jsx(Pa,{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(py,{className:"h-4 w-4"});case"social_swag":return r.jsx(Ds,{className:"h-4 w-4"});case"event":return r.jsx(Ts,{className:"h-4 w-4"});default:return r.jsx(Ms,{className:"h-4 w-4"})}},MCt=({brokerageId:e})=>{const{toast:t}=pi(),[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,de;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:((de=T.get(ae.user_id))==null?void 0:de.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,de;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:((de=T.get(ae.user_id))==null?void 0:de.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 Q=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(Q)}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(Je,{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(kn,{children:"Track app usage and content engagement - click an agent for details"})]}),r.jsx(Je,{children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:l.length===0?r.jsx(Nr,{children:r.jsx(yt,{colSpan:4,className:"text-center text-muted-foreground",children:"No activity yet"})}):l.map(k=>r.jsxs(Nr,{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(Tt,{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(Tt,{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(Or,{open:!!x,onOpenChange:k=>!k&&y(null),children:r.jsxs(Lr,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{children:[x==null?void 0:x.name,"'s Activity"]}),r.jsx(Qn,{children:x==null?void 0:x.email})]}),r.jsxs(ki,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[r.jsxs(wi,{className:"grid w-full grid-cols-2",children:[r.jsx(an,{value:"content",children:"Content Engagement"}),r.jsx(an,{value:"apps",children:"App Launches"})]}),r.jsx(Cn,{value:"content",className:"flex-1 overflow-auto",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{children:[r.jsx(Mt,{children:"Resource"}),r.jsx(Mt,{children:"Type"}),r.jsx(Mt,{children:"Action"}),r.jsx(Mt,{children:"Time"})]})}),r.jsx(zs,{children:x&&N(x.id).length===0?r.jsx(Nr,{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(Nr,{children:[r.jsx(yt,{className:"max-w-[200px] truncate font-medium",children:k.resource_title}),r.jsx(yt,{children:r.jsxs(Tt,{variant:"outline",className:"gap-1",children:[CCt(k.resource_type),NCt[k.resource_type]||k.resource_type]})}),r.jsx(yt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:SCt[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(Cn,{value:"apps",className:"flex-1 overflow-auto",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{children:[r.jsx(Mt,{children:"App"}),r.jsx(Mt,{children:"Time"})]})}),r.jsx(zs,{children:x&&b(x.id).length===0?r.jsx(Nr,{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(Nr,{children:[r.jsx(yt,{children:r.jsx(Tt,{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))})]})})})]})]})})]})},TCt=({brokerageId:e})=>{const{toast:t}=pi(),[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(Je,{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(qn,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Je,{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(li,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Je,{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(Qa,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Je,{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(Je,{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(Je,{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(Je,{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"})]})]})]})},ACt=({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(Je,{className:"flex items-center justify-center py-8",children:r.jsx(Wr,{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(Ro,{className:"h-5 w-5"}),"Agent Invite Links"]}),r.jsx(kn,{children:"Create shareable links for agents to join your brokerage"})]}),r.jsxs(Or,{open:i,onOpenChange:u,children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{size:"sm",children:[r.jsx(bn,{className:"mr-2 h-4 w-4"}),"Create Link"]})}),r.jsxs(Lr,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Create Invite Link"}),r.jsx(Qn,{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(X,{onClick:b,disabled:o,className:"w-full",children:o?r.jsxs(r.Fragment,{children:[r.jsx(Wr,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Invite Link"})]})]})]})]}),r.jsx(Je,{children:t.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Ro,{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(Tt,{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(X,{variant:"ghost",size:"sm",onClick:()=>M(I.code),title:"Copy link",children:r.jsx(Oo,{className:"h-4 w-4"})}),r.jsx(X,{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(X,{variant:"ghost",size:"sm",onClick:()=>N(I.id),className:"text-destructive hover:text-destructive",title:"Delete",children:r.jsx(Un,{className:"h-4 w-4"})})]})]},I.id))})})]})},ECt=({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(Or,{open:e,onOpenChange:t,children:r.jsxs(Lr,{className:"sm:max-w-[550px]",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(ks,{className:"h-5 w-5 text-primary"}),"Invite Broker Friends"]}),r.jsx(Qn,{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(X,{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(Tt,{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(us,{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(Xn,{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(Ds,{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(X,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(X,{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":""]})})]})]})})},ICt=({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(Tt,{className:"bg-green-100 text-green-800 gap-1",children:[r.jsx(li,{className:"h-3 w-3"}),"Signed Up"]});case"expired":return r.jsxs(Tt,{variant:"outline",className:"text-muted-foreground gap-1",children:[r.jsx(bc,{className:"h-3 w-3"}),"Expired"]});default:return r.jsxs(Tt,{variant:"secondary",className:"gap-1",children:[r.jsx(Qa,{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(ks,{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 ",ln(new Date(u.sent_at),"MMM d, yyyy")]})]}),i(u.status)]},u.id))]})},PCt=()=>{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 Q=`REF${e==null?void 0:e.slice(0,8).toUpperCase()}`;await Y.from("referral_codes").insert({brokerage_id:e,code:Q}),s(Q)}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(li,{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(Ds,{className:"h-5 w-5"}),r.jsx("span",{className:"font-bold",children:"FREE Membership Unlocked!"})]})]})})]})}),r.jsxs(Je,{className:"pt-6 space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[r.jsxs(X,{onClick:()=>b(!0),className:"w-full",size:"lg",children:[r.jsx(ks,{className:"h-4 w-4 mr-2"}),"Invite Broker Friends"]}),r.jsxs(X,{onClick:I,variant:"outline",className:"w-full",size:"lg",children:[r.jsx(Oo,{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(zd,{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(qn,{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(Qa,{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(ICt,{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(Tt,{variant:U.status==="qualified"?"default":U.status==="pending"?"secondary":"destructive",className:U.status==="qualified"?"bg-green-600":"",children:[U.status==="qualified"&&r.jsx(li,{className:"h-3 w-3 mr-1"}),U.status]})]},U.id)})]})]})]}),r.jsx(ECt,{open:v,onOpenChange:b,referralCode:n||"",brokerageId:e||"",senderName:l||"A LevelUp Member",brokerageName:a,onInvitesSent:()=>k(U=>U+1)})]})},LCt=()=>{const{user:e,isBrokerageManager:t,brokerageId:n,isAdmin:s,managedBrokerages:a,selectedBrokerageId:o,setSelectedBrokerageId:l}=tn(),i=Wn(),{toast:u}=pi(),[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(Dr,{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(Dr,{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(hn,{value:o||"",onValueChange:l,children:[r.jsxs(cn,{className:"w-[280px]",children:[r.jsx(mi,{className:"mr-2 h-4 w-4"}),r.jsx(fn,{placeholder:"Select brokerage"})]}),r.jsx(dn,{children:a.map(k=>r.jsx($t,{value:k.id,children:k.name},k.id))})]})]}),r.jsxs(ki,{defaultValue:"agents",className:"space-y-4",children:[r.jsxs(wi,{className:"grid w-full grid-cols-3 md:grid-cols-7",children:[r.jsx(an,{value:"agents",children:"Agents"}),r.jsx(an,{value:"invite",children:"Invite Links"}),r.jsx(an,{value:"referrals",children:"Referrals"}),r.jsx(an,{value:"leaderboard",children:"Leaderboard"}),r.jsx(an,{value:"activity",children:"Activity"}),r.jsx(an,{value:"analytics",children:"Analytics"}),r.jsx(an,{value:"shares",children:"Shares"})]}),r.jsx(Cn,{value:"agents",className:"space-y-4",children:r.jsx(kCt,{brokerageId:b})}),r.jsx(Cn,{value:"invite",className:"space-y-4",children:r.jsx(ACt,{brokerageId:b})}),r.jsx(Cn,{value:"referrals",className:"space-y-4",children:r.jsx(PCt,{})}),r.jsx(Cn,{value:"leaderboard",className:"space-y-4",children:r.jsx(l9e,{brokerageId:b,title:`${m} Event Leaderboard`,showUserStats:!1})}),r.jsx(Cn,{value:"activity",className:"space-y-4",children:r.jsx(MCt,{brokerageId:b})}),r.jsx(Cn,{value:"analytics",className:"space-y-4",children:r.jsx(TCt,{brokerageId:b})}),r.jsx(Cn,{value:"shares",className:"space-y-4",children:r.jsx(fBe,{brokerageOnly:!0,brokerageId:b})})]})]})}):r.jsx(Dr,{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(mi,{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 OCt({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:Q,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=Q;if(oe&&oe.length>0){const de=[...new Set(oe.map(me=>me.created_by))],{data:se}=await Y.from("profiles").select("id, name, avatar_url").in("id",de),pe=new Map((se==null?void 0:se.map(me=>[me.id,me]))||[]),ne=oe.map(me=>({...me,author:pe.get(me.created_by)||{name:"Unknown",avatar_url:null}}));a(ne)}else a([])}catch(Q){console.error("Error fetching announcements:",Q)}finally{l(!1)}};A.useEffect(()=>{D()},[e]);const U=()=>{M(""),T(""),F(!1),x(null)},V=Q=>{Q?(x(Q),M(Q.title),T(Q.content),F(Q.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:Q}=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(Q)throw Q;Ae.success("Announcement updated")}else{const{error:Q}=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(Q)throw Q;Ae.success("Announcement created")}u(!1),U(),D()}catch(Q){console.error("Error saving announcement:",Q),Ae.error("Failed to save announcement")}finally{N(!1)}},G=async()=>{if(y)try{const{error:Q}=await Y.from("brokerage_announcements").delete().eq("id",y);if(Q)throw Q;Ae.success("Announcement deleted"),D()}catch(Q){console.error("Error deleting announcement:",Q),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(Je,{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(X,{size:"sm",onClick:()=>V(),className:"gap-1",children:[r.jsx(bn,{className:"h-4 w-4"}),"New"]})]}),r.jsx(Je,{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(Q=>{var ae,oe,de,se;return r.jsx("div",{className:`p-4 rounded-lg border ${Q.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:[Q.is_pinned&&r.jsx(Y1,{className:"h-3.5 w-3.5 text-primary shrink-0"}),r.jsx("h4",{className:"font-semibold truncate",children:Q.title})]}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:Q.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(Ti,{src:((ae=Q.author)==null?void 0:ae.avatar_url)||void 0}),r.jsx(ta,{className:"text-[10px]",children:((de=(oe=Q.author)==null?void 0:oe.name)==null?void 0:de.charAt(0))||"?"})]}),r.jsx("span",{children:(se=Q.author)==null?void 0:se.name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:ln(new Date(Q.created_at),"MMM d, yyyy")})]})]}),t&&r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.jsx(X,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>V(Q),children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>v(Q.id),children:r.jsx(Un,{className:"h-4 w-4"})})]})]})},Q.id)})})})]}),r.jsx(Or,{open:i,onOpenChange:u,children:r.jsxs(Lr,{children:[r.jsx(zr,{children:r.jsx(Fr,{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:Q=>M(Q.target.value),placeholder:"Announcement title..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"content",children:"Content"}),r.jsx(Xn,{id:"content",value:I,onChange:Q=>T(Q.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(Is,{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(X,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsx(X,{onClick:W,disabled:b,children:b?"Saving...":m?"Update":"Create"})]})]})]})}),r.jsx(Ld,{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 DCt({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(qn,{className:"h-5 w-5"}),"Agent Roster"]})}),r.jsx(Je,{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(qn,{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(Je,{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(RCt,{agent:x,hasAssistant:i.has(x.id)},x.id))})})]})}function RCt({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(Ti,{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(Tt,{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(Fo,{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(X,{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(Ii,{className:"h-4 w-4"})})}),r.jsx(X,{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(ks,{className:"h-4 w-4"})})}),e.linkedin_url&&r.jsx(X,{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(ym,{className:"h-4 w-4"})})}),e.instagram_url&&r.jsx(X,{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 FCt({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(Je,{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(fy,{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(Je,{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(Ti,{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 zCt({brokerageId:e}){const t=Wn(),[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(Je,{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(X,{size:"sm",variant:"outline",onClick:()=>t("/mission-control/listings"),className:"gap-1",children:[r.jsx(bn,{className:"h-4 w-4"}),"Add Listing"]})]}),r.jsxs(Je,{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(X,{size:"sm",onClick:()=>t("/mission-control/listings/new"),className:"gap-1",children:[r.jsx(bn,{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(X,{variant:"ghost",size:"sm",className:"w-full mt-3",onClick:()=>t("/mission-control/listings"),children:["View All Listings",r.jsx(Ms,{className:"h-3 w-3 ml-1"})]})]})]})}function BCt(){const{user:e,isAdmin:t,isBrokerageManager:n}=tn(),s=Wn(),[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(Dr,{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(Dr,{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(qn,{className:"h-5 w-5 text-primary"}),r.jsxs("span",{className:"font-medium",children:[x," ",x===1?"Agent":"Agents"]})]}),N&&r.jsxs(X,{onClick:()=>s(`/mission-control/listings/new?brokerage=${l}`),children:[r.jsx(ya,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]}),r.jsx(OCt,{brokerageId:l,canManage:v}),r.jsx(DCt,{brokerageId:l}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[r.jsx(FCt,{brokerageId:l}),r.jsx(zCt,{brokerageId:l})]})]})}):r.jsx(Dr,{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(mi,{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 $Ct(){const e=Wn(),[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(Dr,{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(X,{variant:"outline",size:"sm",onClick:()=>n(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(X,{variant:s==="grid"?"secondary":"outline",size:"icon",onClick:()=>a("grid"),className:"rounded-full",children:r.jsx(mf,{className:"h-4 w-4"})}),r.jsx(X,{variant:s==="list"?"secondary":"outline",size:"icon",onClick:()=>a("list"),className:"rounded-full",children:r.jsx(ff,{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(Je,{className:"p-0",children:[r.jsx(Tr,{className:"aspect-[3/2] w-full"}),r.jsxs("div",{className:"p-4 space-y-2",children:[r.jsx(Tr,{className:"h-5 w-3/4"}),r.jsx(Tr,{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(X,{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(Je,{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(Ts,{className:"h-3 w-3"}),ln(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(Tt,{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(Tt,{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(Tt,{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(pd,{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(Je,{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(Ts,{className:"h-3 w-3"}),ln(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(pd,{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 UCt({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(Je,{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 qCt(){const{id:e}=Ec(),t=Wn(),{user:n}=tn(),{toast:s}=pi(),a=qr(),{trackEngagement:o}=gP(),[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(Dr,{title:"",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tr,{className:"h-8 w-32"}),r.jsx(Tr,{className:"h-64 w-full"}),r.jsx(Tr,{className:"h-32 w-full"})]})}):u?r.jsx(Dr,{title:"",description:"",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs(X,{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:ln(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(UCt,{rows:u.content_blocks||[]}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(R3,{resourceType:"newsletter",resourceId:u.id,resourceTitle:u.title}),r.jsxs(X,{variant:M?"default":"outline",size:"sm",onClick:()=>I.mutate(),children:[r.jsx(bi,{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(Je,{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(Ms,{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(Je,{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(Ms,{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(Je,{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(Je,{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(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Xn,{placeholder:"Write a comment...",value:l,onChange:D=>i(D.target.value),className:"flex-1"}),r.jsx(X,{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:ln(new Date(D.created_at),"MMM d, yyyy")}),D.user_id===(n==null?void 0:n.id)&&r.jsx(X,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>P.mutate(D.id),children:r.jsx(Un,{className:"h-3 w-3"})})]})]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:D.content})]})]},D.id)})})]})]})]})}):r.jsx(Dr,{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(X,{variant:"link",onClick:()=>t("/newsletters"),children:"Back to Newsletters"})]})})}function VCt({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(X,{type:"button",variant:"outline",size:"sm",onClick:a,children:[r.jsx(bn,{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(X,{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(us,{className:"h-4 w-4"})}),r.jsxs(Je,{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(X,{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(us,{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(X,{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(Xn,{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 HCt(){const{toast:e}=pi(),t=qr(),[n,s]=A.useState(!1),[a,o]=A.useState(null),[l,i]=A.useState({title:"",description:"",publish_date:ln(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:Q,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 pe(Me.id),t.invalidateQueries({queryKey:["admin-newsletters"]}),e({title:"Newsletter created successfully"}),he()},onError:Me=>{e({title:"Error creating newsletter",description:Me.message,variant:"destructive"})}}),de=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 pe(Me),t.invalidateQueries({queryKey:["admin-newsletters"]}),e({title:"Newsletter updated successfully"}),he()},onError:Me=>{e({title:"Error updating newsletter",description:Me.message,variant:"destructive"})}}),se=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"})}}),pe=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})))},ne=async Me=>{o(Me),i({title:Me.title,description:Me.description||"",publish_date:ln(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:ln(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,...At})=>At)),k(($e.data||[]).map(({id:ot,...At})=>At)),I((Be.data||[]).map(({id:ot,...At})=>At)),P((Ve.data||[]).map(({id:ot,...At})=>At)),V([]),s(!0)},he=()=>{s(!1),o(null),i({title:"",description:"",publish_date:ln(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?de.mutate({id:a.id,...l,preview_image_url:Me,content_blocks:F}):oe.mutate({...l,preview_image_url:Me,content_blocks:F}),G(!1)},be=()=>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}]),et=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(Dr,{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(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:(Q==null?void 0:Q.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(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:(Q==null?void 0:Q.filter(Me=>Me.is_published).length)||0})})]})]}),r.jsxs(Or,{open:n,onOpenChange:Me=>!Me&&he(),children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{onClick:()=>s(!0),children:[r.jsx(bn,{className:"mr-2 h-4 w-4"})," Add Newsletter"]})}),r.jsxs(Lr,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Fr,{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(X,{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(us,{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(X,{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(Is,{checked:l.is_published,onCheckedChange:Me=>i({...l,is_published:Me})}),r.jsx(ze,{children:"Published"})]}),r.jsx(VCt,{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(X,{type:"button",variant:"outline",size:"sm",onClick:ve,children:[r.jsx(bn,{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(X,{type:"button",variant:"ghost",size:"icon",onClick:()=>P(T.filter(($e,Be)=>Be!==Ie)),children:r.jsx(us,{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(X,{type:"button",variant:"outline",size:"sm",onClick:be,children:[r.jsx(bn,{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(X,{type:"button",variant:"ghost",size:"icon",onClick:()=>b(v.filter(($e,Be)=>Be!==Ie)),children:r.jsx(us,{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:et,className:"hidden",id:"pdf-upload"}),r.jsx(X,{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(X,{type:"button",variant:"ghost",size:"icon",onClick:()=>k(N.filter(($e,Be)=>Be!==Ie)),children:r.jsx(us,{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(X,{type:"button",variant:"ghost",size:"icon",onClick:()=>V(U.filter(($e,Be)=>Be!==Ie)),children:r.jsx(us,{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(X,{type:"button",variant:"outline",size:"sm",onClick:we,children:[r.jsx(bn,{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(X,{type:"button",variant:"ghost",size:"icon",onClick:()=>I(M.filter(($e,Be)=>Be!==Ie)),children:r.jsx(us,{className:"h-4 w-4"})})]},Ie))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[r.jsx(X,{variant:"outline",onClick:he,children:"Cancel"}),r.jsx(X,{onClick:Te,disabled:W||oe.isPending||de.isPending,children:W?"Uploading...":a?"Update":"Create"})]})]})]})]})]}),r.jsx(He,{children:r.jsx(Je,{className:"p-0",children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:ae?r.jsx(Nr,{children:r.jsx(yt,{colSpan:4,className:"text-center py-8",children:"Loading..."})}):(Q==null?void 0:Q.length)===0?r.jsx(Nr,{children:r.jsx(yt,{colSpan:4,className:"text-center py-8 text-muted-foreground",children:"No newsletters yet. Create your first one!"})}):Q==null?void 0:Q.map(Me=>r.jsxs(Nr,{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:ln(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(X,{variant:"ghost",size:"icon",onClick:()=>ne(Me),title:"Edit",children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>me(Me),title:"Duplicate",children:r.jsx(Oo,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",title:"Delete",onClick:()=>{confirm("Are you sure you want to delete this newsletter?")&&se.mutate(Me.id)},children:r.jsx(Un,{className:"h-4 w-4"})})]})})]},Me.id))})]})})})]})})}const dCe={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{user:e}=tn(),{toast:t}=pi(),n=Wn(),s=qr(),[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(ne=>ne.user_id))||[])],{data:Q}=await Y.from("profiles").select("id, name").in("id",G),ae=new Map((Q==null?void 0:Q.map(ne=>[ne.id,ne]))||[]);let oe=[];if(e){const{data:ne}=await Y.from("wishlist_votes").select("item_id").eq("user_id",e.id);oe=(ne==null?void 0:ne.map(me=>me.item_id))||[]}const de=(V==null?void 0:V.map(ne=>ne.id))||[],{data:se}=await Y.from("wishlist_comments").select("item_id").in("item_id",de),pe=new Map;return se==null||se.forEach(ne=>{pe.set(ne.item_id,(pe.get(ne.item_id)||0)+1)}),V==null?void 0:V.map(ne=>{const me=ae.get(ne.user_id),he=(me==null?void 0:me.name)||"Unknown";return{...ne,user_name:he,user_initials:he.split(" ").map(xe=>xe[0]).join("").toUpperCase().slice(0,2),has_voted:oe.includes(ne.id),comment_count:pe.get(ne.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(Dr,{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(my,{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(Or,{open:u,onOpenChange:m,children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"Add Idea"]})}),r.jsxs(Lr,{children:[r.jsx(zr,{children:r.jsx(Fr,{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(Xn,{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(X,{onClick:D,className:"w-full",disabled:T.isPending,children:T.isPending?r.jsxs(r.Fragment,{children:[r.jsx(Wr,{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(ki,{value:l,onValueChange:U=>i(U),children:r.jsxs(wi,{children:[r.jsx(an,{value:"popular",children:"Most Popular"}),r.jsx(an,{value:"latest",children:"Latest"}),r.jsx(an,{value:"trending",children:"Trending"})]})})})]}),r.jsx("div",{className:"flex items-center gap-2 mb-4",children:r.jsx(X,{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(Wr,{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(my,{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(X,{onClick:()=>m(!0),children:[r.jsx(bn,{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(uf,{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(Tt,{className:Ut("text-xs",dCe[U.status].color),children:dCe[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(zo,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:U.comment_count})]})]})},U.id))})]})})}const uCe={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 GCt(){const{itemId:e}=Ec(),t=Wn(),{user:n}=tn(),{toast:s}=pi(),a=qr(),[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(Dr,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsx(Tr,{className:"h-8 w-32 mb-6"}),r.jsx(Tr,{className:"h-48 w-full mb-6"}),r.jsx(Tr,{className:"h-32 w-full"})]})}):u?r.jsx(Dr,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsxs(X,{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(uf,{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(Tt,{className:Ut("text-xs",uCe[u.status].color),children:uCe[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(Yre,{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(X,{onClick:k,disabled:!o.trim()||b.isPending,size:"icon",className:"h-auto",children:b.isPending?r.jsx(Wr,{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(Tr,{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(X,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>N.mutate(M.id),children:r.jsx(Un,{className:"h-4 w-4"})})]},M.id))})]})]})}):r.jsx(Dr,{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(X,{variant:"link",onClick:()=>t("/wishlist"),children:"Go back to Wishlist"})]})})}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"}},mCe=["open","under_review","planned","in_progress","launched","declined"];function KCt(){const{toast:e}=pi(),t=Wn(),n=qr(),[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 Q=D.get(G.user_id);return{...G,user_name:(Q==null?void 0:Q.name)||"Unknown",user_email:(Q==null?void 0:Q.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(Dr,{title:"Admin - Wishlist",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(X,{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(hn,{value:o,onValueChange:I=>l(I),children:[r.jsx(cn,{className:"w-[180px]",children:r.jsx(fn,{placeholder:"Filter by status"})}),r.jsxs(dn,{children:[r.jsx($t,{value:"all",children:"All Statuses"}),mCe.map(I=>r.jsx($t,{value:I,children:hCe[I].label},I))]})]})]}),v?r.jsx("div",{className:"space-y-2",children:[1,2,3,4,5].map(I=>r.jsx(Tr,{className:"h-16 w-full"},I))}):r.jsx("div",{className:"bg-card border rounded-lg overflow-hidden",children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:k.length===0?r.jsx(Nr,{children:r.jsx(yt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No items found"})}):k.map(I=>r.jsxs(Nr,{className:Ut(I.vote_count>=10&&"bg-primary/5"),children:[r.jsx(yt,{children:r.jsx(Tt,{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(hn,{value:I.status,onValueChange:T=>b.mutate({itemId:I.id,status:T}),children:[r.jsx(cn,{className:"w-[140px] h-8",children:r.jsx(fn,{})}),r.jsx(dn,{children:mCe.map(T=>r.jsx($t,{value:T,children:hCe[T].label},T))})]})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>window.open(`/wishlist/${I.id}`,"_blank"),children:r.jsx(Ms,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{x(I.id),u(!0)},children:r.jsx(Un,{className:"h-4 w-4"})})]})})]},I.id))})]})}),r.jsx(Or,{open:i,onOpenChange:u,children:r.jsxs(Lr,{children:[r.jsx(zr,{children:r.jsx(Fr,{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(X,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsx(X,{variant:"destructive",onClick:()=>m&&N.mutate(m),disabled:N.isPending,children:N.isPending?r.jsxs(r.Fragment,{children:[r.jsx(Wr,{className:"h-4 w-4 mr-2 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})})}function ZCt(){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,Q]=A.useState(""),[ae,oe]=A.useState("once"),[de,se]=A.useState([]),[pe,ne]=A.useState([]),[me,he]=A.useState(!1),[xe,Te]=A.useState(!1),[be,we]=A.useState([]),[ve,et]=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),Q(new Date().toISOString().slice(0,16)),oe("once"),se([]),ne([]),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),Q(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");se((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(ir=>ir.option_text))||[]})}ne(ct)}l(!0)},Ve=async Le=>{var tt;const Ke=(tt=Le.target.files)==null?void 0:tt[0];if(Ke){he(!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,ir=await Y.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:it}});if(ir.error)throw ir.error;const{uploadUrl:Mr,apiKey:Zr}=ir.data,Br=new XMLHttpRequest;await new Promise((Zn,Ot)=>{Br.upload.addEventListener("progress",Gr=>{if(Gr.lengthComputable){const An=Math.round(Gr.loaded/Gr.total*100);console.log("Upload progress:",An)}}),Br.addEventListener("load",()=>{Br.status>=200&&Br.status<300?Zn():Ot(new Error(`Upload failed with status ${Br.status}`))}),Br.addEventListener("error",()=>Ot(new Error("Upload failed"))),Br.open("PUT",Mr),Br.setRequestHeader("AccessKey",Zr),Br.send(Ke)});const rn=`https://player.mediadelivery.net/embed/${zt}/${it}`;T(rn),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{he(!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(de.length>0){const Ke=de.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((ir,Mr)=>({poll_id:ct.id,option_text:ir,sort_order:Mr}));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")}},At=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);et({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:ir}=await Y.from("levelup_brief_poll_options").select("*").eq("poll_id",zt.id).order("sort_order"),{data:Mr}=await Y.from("levelup_brief_poll_responses").select("option_id, user_id").eq("poll_id",zt.id),Zr=[...new Set((Mr==null?void 0:Mr.map(Gr=>Gr.user_id))||[])];let Br={};if(Zr.length>0){const{data:Gr}=await Y.from("profiles").select("id, name, email").in("id",Zr);Gr&&Gr.forEach(An=>{Br[An.id]=An.name||An.email||"Unknown"})}const rn=(Mr||[]).map(Gr=>({optionId:Gr.option_id,userName:Br[Gr.user_id]||"Unknown",userId:Gr.user_id})),Zn={};let Ot=0;ir&&ir.forEach(Gr=>{const An=(Mr==null?void 0:Mr.filter(zn=>zn.option_id===Gr.id).length)||0;Zn[Gr.id]=An,Ot+=An}),it.push({...zt,options:ir||[],results:Zn,respondents:rn,totalResponses:zt.poll_type==="single"?new Set(Mr==null?void 0:Mr.map(Gr=>Gr.user_id)).size:Ot})}we(it)}x(!0)},at=()=>{se([...de,{title:"",url:""}])},le=(Le,Ke,tt)=>{const ct=[...de];ct[Le][Ke]=tt,se(ct)},qe=Le=>{se(de.filter((Ke,tt)=>tt!==Le))},Qe=()=>{ne([...pe,{question:"",poll_type:"single",options:["",""]}])},rt=(Le,Ke)=>{const tt=[...pe];tt[Le].question=Ke,ne(tt)},je=(Le,Ke)=>{const tt=[...pe];tt[Le].poll_type=Ke,ne(tt)},ut=Le=>{const Ke=[...pe];Ke[Le].options.push(""),ne(Ke)},Ce=(Le,Ke,tt)=>{const ct=[...pe];ct[Le].options[Ke]=tt,ne(ct)},Ee=(Le,Ke)=>{const tt=[...pe];tt[Le].options=tt[Le].options.filter((ct,it)=>it!==Ke),ne(tt)},Ye=Le=>{ne(pe.filter((Ke,tt)=>tt!==Le))};return r.jsxs(Dr,{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(X,{onClick:$e,children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Create Brief"]})}),r.jsx(He,{children:r.jsx(Je,{className:"p-0",children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:s?r.jsx(Nr,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):t.length===0?r.jsx(Nr,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No briefs created yet"})}):t.map(Le=>r.jsxs(Nr,{children:[r.jsx(yt,{className:"font-medium",children:Le.title}),r.jsx(yt,{children:r.jsx(Tt,{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:ln(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(X,{variant:"ghost",size:"icon",onClick:()=>Oe(Le),children:r.jsx(_c,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>Be(Le),children:r.jsx(gc,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>At(Le.id),children:r.jsx(Un,{className:"h-4 w-4 text-destructive"})})]})})]},Le.id))})]})})})]}),r.jsx(Or,{open:o,onOpenChange:l,children:r.jsxs(Lr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Fr,{children:i?"Edit Brief":"Create New Brief"})}),r.jsxs(ki,{defaultValue:"content",className:"w-full",children:[r.jsxs(wi,{className:"grid w-full grid-cols-4",children:[r.jsx(an,{value:"content",children:"Content"}),r.jsx(an,{value:"media",children:"Media"}),r.jsx(an,{value:"links",children:"Links"}),r.jsx(an,{value:"polls",children:"Polls"})]}),r.jsxs(Cn,{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=>Q(Le.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Show Frequency"}),r.jsxs(hn,{value:ae,onValueChange:oe,children:[r.jsx(cn,{children:r.jsx(fn,{})}),r.jsxs(dn,{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(Is,{checked:V,onCheckedChange:W}),r.jsx(ze,{children:"Publish immediately"})]})]}),r.jsxs(Cn,{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:ir}=Y.storage.from("banner-images").getPublicUrl(it);F(ir.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(Cn,{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(X,{variant:"outline",size:"sm",onClick:at,children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),de.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(X,{variant:"ghost",size:"icon",onClick:()=>qe(Ke),children:r.jsx(Un,{className:"h-4 w-4 text-destructive"})})]},Ke)),de.length===0&&r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No links added yet"})]}),r.jsxs(Cn,{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(X,{variant:"outline",size:"sm",onClick:Qe,children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Poll"]})]}),pe.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=>rt(Ke,tt.target.value),placeholder:"Poll question...",className:"flex-1 mr-2"}),r.jsxs(hn,{value:Le.poll_type,onValueChange:tt=>je(Ke,tt),children:[r.jsx(cn,{className:"w-32",children:r.jsx(fn,{})}),r.jsxs(dn,{children:[r.jsx($t,{value:"single",children:"Single"}),r.jsx($t,{value:"multi",children:"Multi-select"})]})]}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>Ye(Ke),children:r.jsx(Un,{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(X,{variant:"ghost",size:"icon",onClick:()=>Ee(Ke,ct),children:r.jsx(Un,{className:"h-4 w-4 text-muted-foreground"})})]},ct)),r.jsxs(X,{variant:"ghost",size:"sm",onClick:()=>ut(Ke),children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Option"]})]})]})},Ke)),pe.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(X,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsx(X,{onClick:ot,children:i?"Update Brief":"Create Brief"})]})]})}),r.jsx(Or,{open:m,onOpenChange:x,children:r.jsxs(Lr,{className:"max-w-2xl",children:[r.jsx(zr,{children:r.jsxs(Fr,{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(Je,{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(Je,{children:r.jsx("p",{className:"text-2xl font-bold",children:ve.dismissed})})]})]}),be.length>0?r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold",children:"Poll Results"}),be.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(Tt,{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 YCt=()=>{const{user:e}=tn(),{toast:t}=pi(),n=qr(),[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:Q}=await Y.storage.from("service-images").upload(G,D.image);if(Q)throw Q;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(Dr,{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(Je,{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(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:b.filter(D=>D.is_published).length})})]})]}),r.jsxs(Or,{open:s,onOpenChange:D=>{a(D),D||I()},children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"Add Service"]})}),r.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Fr,{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(Is,{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(X,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{x(null),v("")},children:r.jsx(us,{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(X,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(X,{type:"submit",disabled:k.isPending,children:k.isPending?"Saving...":o?"Update":"Create"})]})]})]})]})]}),r.jsx(He,{children:r.jsx(Je,{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(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:b.map(D=>r.jsxs(Nr,{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(Ms,{className:"h-3 w-3"}),"Link"]})}),r.jsx(yt,{children:new Date(D.publish_date).toLocaleDateString()}),r.jsx(yt,{children:r.jsx(Tt,{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(X,{variant:"ghost",size:"icon",onClick:()=>T(D),children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this service?")&&M.mutate(D.id)},children:r.jsx(Un,{className:"h-4 w-4 text-destructive"})})]})})]},D.id))})]})})})]})})};function XCt(){const{toast:e}=pi(),[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(Dr,{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(Or,{open:i,onOpenChange:u,children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{children:[r.jsx(bn,{className:"mr-2 h-4 w-4"}),"Create Coupon"]})}),r.jsxs(Lr,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Create New Coupon"}),r.jsx(Qn,{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(hn,{value:m.discountType,onValueChange:M=>{const I=M==="amount"&&m.duration==="forever"?"once":m.duration;x({...m,discountType:M,duration:I})},children:[r.jsx(cn,{children:r.jsx(fn,{})}),r.jsxs(dn,{children:[r.jsx($t,{value:"percent",children:r.jsxs("span",{className:"flex items-center",children:[r.jsx(L4,{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(zd,{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(hn,{value:m.duration,onValueChange:M=>x({...m,duration:M}),children:[r.jsx(cn,{children:r.jsx(fn,{})}),r.jsxs(dn,{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(X,{onClick:v,disabled:o,className:"w-full",children:o?r.jsxs(r.Fragment,{children:[r.jsx(Wr,{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(kn,{children:"Share coupon codes with users to give them discounts on subscriptions"})]}),r.jsx(Je,{children:s?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Wr,{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(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:t.map(M=>{var I;return r.jsxs(Nr,{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(Tt,{variant:M.valid?"default":"secondary",children:M.valid?"Active":"Inactive"})}),r.jsx(yt,{className:"text-right",children:r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>b(M.id),children:r.jsx(Un,{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(Je,{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 Dde={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 QCt(){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=Dde[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(Dr,{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(X,{onClick:()=>u(),variant:"outline",size:"sm",children:[r.jsx(Wo,{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(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(qn,{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(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hf,{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(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Qa,{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(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(q1,{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(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(mi,{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(Je,{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(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(mi,{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(ki,{defaultValue:"users",className:"space-y-4",children:[r.jsxs(wi,{children:[r.jsx(an,{value:"users",children:"All Users"}),r.jsx(an,{value:"brokerages",children:"Brokerages"})]}),r.jsxs(Cn,{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(hn,{value:n,onValueChange:N=>s(N),children:[r.jsx(cn,{className:"w-[200px]",children:r.jsx(fn,{placeholder:"Filter by status"})}),r.jsxs(dn,{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(Je,{className:"p-0",children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:i?r.jsx(Nr,{children:r.jsx(yt,{colSpan:6,className:"text-center py-8",children:"Loading subscriptions..."})}):(y==null?void 0:y.length)===0?r.jsx(Nr,{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=Dde[N.subscription_product_id];return r.jsxs(Nr,{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(Tt,{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:ln(new Date(N.subscription_end_date),"MMM d, yyyy")}):N.trial_expires_at?r.jsxs("span",{className:"text-sm text-blue-600",children:["Trial: ",ln(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(X,{variant:"ghost",size:"sm",onClick:()=>b(N.stripe_customer_id),children:r.jsx(Ms,{className:"h-4 w-4"})}),r.jsxs(Or,{children:[r.jsx(Co,{asChild:!0,children:r.jsx(X,{variant:"outline",size:"sm",onClick:()=>o(N),children:"Details"})}),r.jsxs(Lr,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Subscription Details"}),r.jsxs(Qn,{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(Tt,{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:ln(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:ln(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(X,{className:"w-full",onClick:()=>b(N.stripe_customer_id),children:[r.jsx(Ms,{className:"h-4 w-4 mr-2"}),"View in Stripe Dashboard"]})]})]})]})]})})]},N.id)})})]})})})]}),r.jsx(Cn,{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(mi,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Gt,{className:"text-lg",children:N.name}),r.jsxs(kn,{children:[N.agentCount," agents"]})]})]}),r.jsx(Tt,{variant:k?"default":"outline",children:k?"Active Subscription":"No Active Subscription"})]})}),r.jsx(Je,{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=Dde[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(Tt,{variant:"default",children:P.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:P.price})]}):r.jsx(Tt,{variant:"outline",children:"No Subscription"})})]},T.id)})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No managers assigned"})})]},N.id)})})})]})]})})}function JCt(){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(Tt,{className:"bg-green-100 text-green-800",children:[r.jsx(li,{className:"h-3 w-3 mr-1"}),"Qualified"]});case"pending":return r.jsxs(Tt,{variant:"secondary",children:[r.jsx(Qa,{className:"h-3 w-3 mr-1"}),"Pending"]});case"cancelled":return r.jsxs(Tt,{variant:"destructive",children:[r.jsx(bc,{className:"h-3 w-3 mr-1"}),"Cancelled"]});default:return r.jsx(Tt,{children:N})}};return r.jsx(Dr,{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(X,{onClick:y,variant:"outline",children:[r.jsx(Wo,{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(Je,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(qn,{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(Je,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(li,{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(Je,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Qa,{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(Je,{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(Je,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(zd,{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(kn,{children:"View and manage all referral relationships"})]}),r.jsxs(Je,{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(hn,{value:l,onValueChange:i,children:[r.jsx(cn,{className:"w-[180px]",children:r.jsx(fn,{placeholder:"Filter by status"})}),r.jsxs(dn,{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(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:v.length===0?r.jsx(Nr,{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(Nr,{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:ln(new Date(N.signup_date),"MMM d, yyyy")}),r.jsx(yt,{children:b(N.status)}),r.jsx(yt,{children:N.qualified_date?ln(new Date(N.qualified_date),"MMM d, yyyy"):"-"}),r.jsx(yt,{children:N.discount_applied?r.jsx(Tt,{variant:"outline",className:"text-green-600",children:"$25/mo applied"}):r.jsx("span",{className:"text-muted-foreground",children:"-"})})]},N.id)})})]})]})]})]})})}const Rde=[{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"}],e3t=[{value:"brokerage_manager",label:"Brokerage Manager"},{value:"agent",label:"Agent"}];function t3t(){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(Dr,{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(X,{onClick:y,className:"gap-2",children:[r.jsx(bn,{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(Tt,{variant:"secondary",children:"Brokerage Manager"}),"Checklist Items"]})}),r.jsx(Je,{children:M.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No checklist items for brokerage managers"}):r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:M.map((T,P)=>{var F;return r.jsxs(Nr,{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(Tt,{variant:"outline",children:((F=Rde.find(D=>D.value===T.action_type))==null?void 0:F.label)||T.action_type})}),r.jsx(yt,{children:r.jsx(Is,{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(X,{variant:"ghost",size:"icon",onClick:()=>v(T),children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>N(T.id),children:r.jsx(Un,{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(Tt,{variant:"secondary",children:"Agent"}),"Checklist Items"]})}),r.jsx(Je,{children:I.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No checklist items for agents"}):r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:I.map((T,P)=>{var F;return r.jsxs(Nr,{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(Tt,{variant:"outline",children:((F=Rde.find(D=>D.value===T.action_type))==null?void 0:F.label)||T.action_type})}),r.jsx(yt,{children:r.jsx(Is,{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(X,{variant:"ghost",size:"icon",onClick:()=>v(T),children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>N(T.id),children:r.jsx(Un,{className:"h-4 w-4 text-destructive"})})]})})]},T.id)})})]})})]})]}),r.jsx(Or,{open:a,onOpenChange:o,children:r.jsxs(Lr,{children:[r.jsx(zr,{children:r.jsx(Fr,{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(Xn,{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(hn,{value:u.target_role,onValueChange:T=>m({...u,target_role:T}),children:[r.jsx(cn,{children:r.jsx(fn,{})}),r.jsx(dn,{children:e3t.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(hn,{value:u.action_type,onValueChange:T=>m({...u,action_type:T}),children:[r.jsx(cn,{children:r.jsx(fn,{})}),r.jsx(dn,{children:Rde.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(Is,{id:"is_active",checked:u.is_active,onCheckedChange:T=>m({...u,is_active:T})}),r.jsx(ze,{htmlFor:"is_active",children:"Active"})]})]}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(X,{onClick:b,children:l?"Save Changes":"Create Item"})]})]})})]})}function r3t(){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:Q}=await Y.from("brokerages").select("id, name").order("name");if(Q)throw Q;return G}}),I=async G=>{let ae=[],oe=0,de=!0;for(;de;){const{data:se,error:pe}=await G(oe,oe+1e3-1);if(pe)throw pe;se&&se.length>0?(ae=[...ae,...se],oe+=1e3,de=se.length===1e3):de=!1}return ae},{data:T,isLoading:P}=Zt({queryKey:["admin-agent-os-user-stats"],queryFn:async()=>{const G=await I((ve,et)=>Y.from("profiles").select("id, name, email, brokerage_id, created_at").range(ve,et)),{data:Q}=await Y.from("brokerages").select("id, name"),ae=new Map((Q==null?void 0:Q.map(ve=>[ve.id,ve.name]))||[]),{data:oe}=await Y.rpc("get_admin_contact_counts"),de=new Map;oe==null||oe.forEach(ve=>{de.set(ve.owner_user_id,ve.contact_count)});const{data:se}=await Y.rpc("get_admin_video_counts"),pe=new Map;se==null||se.forEach(ve=>{pe.set(ve.owner_user_id,ve.video_count)});const{data:ne}=await Y.rpc("get_admin_popby_counts"),me=new Map;ne==null||ne.forEach(ve=>{me.set(ve.owner_user_id,ve.popby_count)});const{data:he}=await Y.rpc("get_admin_listing_counts"),xe=new Map;he==null||he.forEach(ve=>{xe.set(ve.agent_id,ve.listing_count)});const{data:Te}=await Y.rpc("get_admin_deal_counts"),be=new Map;return Te==null||Te.forEach(ve=>{be.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:de.get(ve.id)||0,video_count:pe.get(ve.id)||0,popby_count:me.get(ve.id)||0,listing_count:xe.get(ve.id)||0,deal_count:be.get(ve.id)||0,created_at:ve.created_at}))}}),F=A.useMemo(()=>{if(!T)return[];let G=T.filter(Q=>{const ae=e.toLowerCase(),oe=!e||Q.name.toLowerCase().includes(ae)||Q.email.toLowerCase().includes(ae),de=n==="all"||n==="none"&&!Q.brokerage_id||Q.brokerage_id===n,se=parseInt(u)||0,pe=parseInt(x)||0,ne=parseInt(v)||0,me=parseInt(N)||0,he=Q.contact_count>=se&&Q.video_count>=pe&&Q.popby_count>=ne&&Q.listing_count>=me;return oe&&de&&he});return G.sort((Q,ae)=>{let oe=0;return a==="name"?oe=Q.name.localeCompare(ae.name):oe=Q[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"],Q=F.map(pe=>[pe.name,pe.email,pe.brokerage_name||"None",pe.contact_count,pe.video_count,pe.popby_count,pe.listing_count,pe.deal_count]),ae=[G.join(","),...Q.map(pe=>pe.map(ne=>`"${ne}"`).join(","))].join(` `),oe=new Blob([ae],{type:"text/csv"}),de=URL.createObjectURL(oe),se=document.createElement("a");se.href=de,se.download=`agent-os-user-stats-${new Date().toISOString().split("T")[0]}.csv`,se.click(),URL.revokeObjectURL(de)},V=A.useMemo(()=>F.length?F.reduce((G,Q)=>({contacts:G.contacts+Q.contact_count,videos:G.videos+Q.video_count,popbys:G.popbys+Q.popby_count,listings:G.listings+Q.listing_count,deals:G.deals+Q.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:Q})=>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:[Q,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(qn,{className:"h-5 w-5"}),"User Activity Analytics"]}),r.jsx(kn,{children:"View all users and their Agent OS usage metrics"})]}),r.jsxs(X,{variant:"outline",size:"sm",onClick:U,children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Export CSV"]})]})}),r.jsxs(Je,{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(hn,{value:n,onValueChange:s,children:[r.jsxs(cn,{children:[r.jsx(mi,{className:"h-4 w-4 mr-2 text-muted-foreground"}),r.jsx(fn,{placeholder:"Brokerage"})]}),r.jsxs(dn,{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(Wr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsx("div",{className:"rounded-md border",children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:F.length===0?r.jsx(Nr,{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(Nr,{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(Tt,{variant:"secondary",children:G.brokerage_name}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(yt,{children:r.jsx(Tt,{variant:G.contact_count>0?"default":"outline",children:G.contact_count})}),r.jsx(yt,{children:r.jsx(Tt,{variant:G.video_count>0?"default":"outline",children:G.video_count})}),r.jsx(yt,{children:r.jsx(Tt,{variant:G.popby_count>0?"default":"outline",children:G.popby_count})}),r.jsx(yt,{children:r.jsx(Tt,{variant:G.listing_count>0?"default":"outline",children:G.listing_count})}),r.jsx(yt,{children:r.jsx(Tt,{variant:G.deal_count>0?"default":"outline",children:G.deal_count})})]},G.id))})]})})]})]})}function n3t(){pi(),qr();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(Dr,{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(ki,{value:e,onValueChange:t,children:[r.jsxs(wi,{className:"grid w-full grid-cols-9",children:[r.jsxs(an,{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(an,{value:"relationship-types",className:"gap-2",children:[r.jsx(qn,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Relationships"})]}),r.jsxs(an,{value:"action-types",className:"gap-2",children:[r.jsx(Ii,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Actions"})]}),r.jsxs(an,{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(an,{value:"video-scripts",className:"gap-2",children:[r.jsx(Ad,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Video Scripts"})]}),r.jsxs(an,{value:"plans",className:"gap-2",children:[r.jsx(Ts,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Plans"})]}),r.jsxs(an,{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(an,{value:"settings",className:"gap-2",children:[r.jsx(Bd,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Settings"})]}),r.jsxs(an,{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(Cn,{value:"user-analytics",className:"mt-6",children:r.jsx(r3t,{})}),r.jsx(Cn,{value:"relationship-types",className:"mt-6",children:r.jsx(s3t,{types:s||[],isLoading:a})}),r.jsx(Cn,{value:"action-types",className:"mt-6",children:r.jsx(a3t,{types:o||[],isLoading:l})}),r.jsx(Cn,{value:"scripts",className:"mt-6",children:r.jsx(i3t,{scripts:i||[],actionTypes:o||[],isLoading:u})}),r.jsx(Cn,{value:"video-scripts",className:"mt-6",children:r.jsx(d3t,{})}),r.jsx(Cn,{value:"plans",className:"mt-6",children:r.jsx(o3t,{plans:m||[],actionTypes:o||[],scripts:i||[],isLoading:x})}),r.jsx(Cn,{value:"popbys",className:"mt-6",children:r.jsx(c3t,{items:y||[],isLoading:v})}),r.jsx(Cn,{value:"settings",className:"mt-6",children:r.jsx(u3t,{})}),r.jsx(Cn,{value:"feature-flags",className:"mt-6",children:r.jsx(l3t,{flags:n||[]})})]})]})})}function s3t({types:e,isLoading:t}){const{toast:n}=pi(),s=qr(),[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(kn,{children:"Define the relationship categories for InnerCircle contacts"})]}),r.jsxs(X,{onClick:()=>{o(null),i(!0)},children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Type"]})]}),r.jsx(Je,{children:t?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Wr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:e.map(x=>r.jsxs(Nr,{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(Is,{checked:x.active,onCheckedChange:()=>m(x)})}),r.jsx(yt,{children:r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>{o(x),i(!0)},children:r.jsx(Ja,{className:"h-4 w-4"})})})]},x.id))})]})}),r.jsx(Or,{open:l,onOpenChange:i,children:r.jsxs(Lr,{children:[r.jsx(zr,{children:r.jsxs(Fr,{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(Xn,{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(Hs,{className:"mt-4",children:[r.jsx(X,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsxs(X,{type:"submit",disabled:u.isPending,children:[u.isPending&&r.jsx(Wr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function a3t({types:e,isLoading:t}){const{toast:n}=pi(),s=qr(),[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(kn,{children:"Define the types of touchpoint actions agents can take"})]}),r.jsxs(X,{onClick:()=>{o(null),i(!0)},children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Action"]})]}),r.jsx(Je,{children:t?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Wr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:e.map(x=>r.jsxs(Nr,{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(Is,{checked:x.active,onCheckedChange:()=>m(x)})}),r.jsx(yt,{children:r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>{o(x),i(!0)},children:r.jsx(Ja,{className:"h-4 w-4"})})})]},x.id))})]})}),r.jsx(Or,{open:l,onOpenChange:i,children:r.jsxs(Lr,{children:[r.jsx(zr,{children:r.jsxs(Fr,{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(Xn,{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(Hs,{className:"mt-4",children:[r.jsx(X,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsxs(X,{type:"submit",disabled:u.isPending,children:[u.isPending&&r.jsx(Wr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function i3t({scripts:e,actionTypes:t,isLoading:n}){const{toast:s}=pi(),a=qr(),[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(kn,{children:"Create and manage scripts for each action type"})]}),r.jsxs(X,{onClick:()=>{l(null),u(!0)},children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Script"]})]}),r.jsx(Je,{children:n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Wr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:e.map(y=>{var v;return r.jsxs(Nr,{children:[r.jsx(yt,{className:"font-medium",children:y.title}),r.jsx(yt,{children:r.jsx(Tt,{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(Tt,{variant:y.active?"default":"secondary",children:y.active?"Active":"Inactive"})}),r.jsxs(yt,{className:"flex gap-1",children:[r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>{l(y),u(!0)},children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>x.mutate(y.id),children:r.jsx(Un,{className:"h-4 w-4 text-destructive"})})]})]},y.id)})})]})}),r.jsx(Or,{open:i,onOpenChange:u,children:r.jsxs(Lr,{className:"max-w-2xl",children:[r.jsx(zr,{children:r.jsxs(Fr,{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(hn,{name:"action_type_id",defaultValue:o==null?void 0:o.action_type_id,children:[r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select action type"})}),r.jsx(dn,{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(Xn,{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(Hs,{className:"mt-4",children:[r.jsx(X,{type:"button",variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsxs(X,{type:"submit",disabled:m.isPending,children:[m.isPending&&r.jsx(Wr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function o3t({plans:e,actionTypes:t,scripts:n,isLoading:s}){const{toast:a}=pi(),o=qr(),[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:Q}=await Y.from("touchpoint_plan_items").select("*").eq("plan_id",x).order("month_number");if(Q)throw Q;return G},enabled:!!x}),P=ar({mutationFn:async G=>{if(G.id){const{error:Q}=await Y.from("touchpoint_plans").update({name:G.name,description:G.description,active:G.active}).eq("id",G.id);if(Q)throw Q}else{const{error:Q}=await Y.from("touchpoint_plans").insert([{name:G.name,description:G.description,active:!0}]);if(Q)throw Q}},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:Q}=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(Q)throw Q}else{const{error:Q}=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(Q)throw Q}},onSuccess:()=>{o.invalidateQueries({queryKey:["plan-items",x]}),a({title:"Item saved"})}}),D=ar({mutationFn:async G=>{const{error:Q}=await Y.from("touchpoint_plan_items").delete().eq("id",G);if(Q)throw Q},onSuccess:()=>{o.invalidateQueries({queryKey:["plan-items",x]})}}),U=ar({mutationFn:async G=>{const{data:Q,error:ae}=await Y.from("action_scripts").insert([{...G,active:!0}]).select().single();if(ae)throw ae;return Q},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,Q,ae)=>{k({month:G,actionTypeId:Q,itemId:ae}),b(!0)},W=G=>n.find(Q=>Q.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(kn,{children:"Create annual touchpoint plans that agents can apply to their contacts"})]}),r.jsxs(X,{onClick:()=>{i(null),m(!0)},children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Plan"]})]}),r.jsx(Je,{children:s?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Wr,{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(X,{variant:"ghost",size:"icon",onClick:Q=>{Q.stopPropagation(),i(G),m(!0)},children:r.jsx(Ja,{className:"h-4 w-4"})})]})}),r.jsxs(Je,{children:[r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:G.description}),r.jsx(Tt,{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(kn,{children:"Configure the monthly touchpoint schedule. Select an action type for each month, then assign or create a script."})]}),r.jsx(Je,{children:r.jsx("div",{className:"grid gap-3",children:Array.from({length:12},(G,Q)=>Q+1).map(G=>{const Q=T==null?void 0:T.find(de=>de.month_number===G),ae=Q!=null&&Q.default_script_id?W(Q.default_script_id):null,oe=n.filter(de=>de.action_type_id===(Q==null?void 0:Q.action_type_id)&&de.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(hn,{value:(Q==null?void 0:Q.action_type_id)||"none",onValueChange:de=>{de==="none"&&Q?D.mutate(Q.id):de!=="none"&&F.mutate({id:Q==null?void 0:Q.id,plan_id:x,month_number:G,action_type_id:de,default_script_id:null})},children:[r.jsx(cn,{className:"w-40",children:r.jsx(fn,{placeholder:"No action"})}),r.jsxs(dn,{children:[r.jsx($t,{value:"none",children:"No action"}),t.filter(de=>de.active).map(de=>r.jsx($t,{value:de.id,children:r.jsxs("span",{className:"flex items-center gap-2",children:[de.color&&r.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:de.color}}),de.name]})},de.id))]})]}),Q&&r.jsxs(r.Fragment,{children:[r.jsxs(hn,{value:Q.default_script_id||"none",onValueChange:de=>{I(null),F.mutate({id:Q.id,default_script_id:de==="none"?null:de})},children:[r.jsx(cn,{className:"w-56",children:r.jsx(fn,{placeholder:"Select script"})}),r.jsxs(dn,{children:[r.jsx($t,{value:"none",children:"No default script"}),oe.map(de=>r.jsxs($t,{value:de.id,children:[de.title," ",de.tone&&`(${de.tone})`]},de.id))]})]}),r.jsxs(X,{variant:"outline",size:"sm",onClick:()=>V(G,Q.action_type_id,Q.id),children:[r.jsx(bn,{className:"h-3 w-3 mr-1"}),"New Script"]}),ae&&r.jsx(X,{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&&(Q==null?void 0:Q.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(Tt,{variant:"outline",children:M.title}),M.tone&&r.jsx(Tt,{variant:"secondary",children:M.tone})]}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:M.script_body})]})]},G)})})})]}),r.jsx(Or,{open:u,onOpenChange:m,children:r.jsxs(Lr,{children:[r.jsx(zr,{children:r.jsxs(Fr,{children:[l?"Edit":"Add"," Touchpoint Plan"]})}),r.jsxs("form",{onSubmit:G=>{G.preventDefault();const Q=new FormData(G.currentTarget);P.mutate({id:l==null?void 0:l.id,name:Q.get("name"),description:Q.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(Xn,{id:"description",name:"description",defaultValue:(l==null?void 0:l.description)||"",rows:3})]})]}),r.jsxs(Hs,{className:"mt-4",children:[r.jsx(X,{type:"button",variant:"outline",onClick:()=>m(!1),children:"Cancel"}),r.jsxs(X,{type:"submit",disabled:P.isPending,children:[P.isPending&&r.jsx(Wr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})}),r.jsx(Or,{open:v,onOpenChange:b,children:r.jsxs(Lr,{className:"max-w-2xl",children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Create New Script"}),r.jsxs(Qn,{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 Q=new FormData(G.currentTarget);U.mutate({title:Q.get("title"),action_type_id:N.actionTypeId,tone:Q.get("tone"),script_body:Q.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(Xn,{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(Hs,{className:"mt-4",children:[r.jsx(X,{type:"button",variant:"outline",onClick:()=>b(!1),children:"Cancel"}),r.jsxs(X,{type:"submit",disabled:U.isPending,children:[U.isPending&&r.jsx(Wr,{className:"h-4 w-4 mr-2 animate-spin"}),"Create & Assign"]})]})]})]})})]})}function l3t({flags:e}){const{toast:t}=pi(),n=qr(),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(kn,{children:"Control which features are enabled for members"})]}),r.jsx(Je,{children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{children:[r.jsx(Mt,{children:"Flag"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{children:"Notes"}),r.jsx(Mt,{children:"Last Updated"})]})}),r.jsx(zs,{children:e.map(a=>r.jsxs(Nr,{children:[r.jsx(yt,{className:"font-mono text-sm",children:a.key}),r.jsx(yt,{children:r.jsx(Is,{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 c3t({items:e,isLoading:t}){const{toast:n}=pi(),s=qr(),[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(kn,{children:"Manage global popby ideas that all agents can see"})]}),r.jsxs(X,{onClick:()=>{o(null),i(!0)},children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Popby Idea"]})]}),r.jsx(Je,{children:t?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Wr,{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(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:e.map(y=>r.jsxs(Nr,{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(Is,{checked:y.is_active,onCheckedChange:()=>m(y)})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>{o(y),i(!0)},children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>x(y.id),children:r.jsx(Un,{className:"h-4 w-4 text-destructive"})})]})})]},y.id))})]})}),r.jsx(Or,{open:l,onOpenChange:i,children:r.jsxs(Lr,{children:[r.jsx(zr,{children:r.jsxs(Fr,{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(Xn,{id:"description",name:"description",defaultValue:(a==null?void 0:a.description)||"",placeholder:"Brief description of the popby idea..."})]})]}),r.jsxs(Hs,{className:"mt-4",children:[r.jsx(X,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsxs(X,{type:"submit",disabled:u.isPending,children:[u.isPending&&r.jsx(Wr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function d3t(){var b;const{toast:e}=pi(),t=qr(),[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(kn,{children:"Manage teleprompter scripts for Quick Video Touch"})]}),r.jsxs(X,{onClick:()=>{s(null),o(!0)},children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Script"]})]}),r.jsx(Je,{children:m?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Wr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:u==null?void 0:u.map(N=>{var k;return r.jsxs(Nr,{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(Is,{checked:N.is_active,onCheckedChange:()=>y(N)})}),r.jsxs(yt,{className:"flex gap-1",children:[r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>{s(N),o(!0)},children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>v(N.id),children:r.jsx(Un,{className:"h-4 w-4"})})]})]},N.id)})})]})}),r.jsx(Or,{open:a,onOpenChange:o,children:r.jsxs(Lr,{className:"max-w-2xl",children:[r.jsx(zr,{children:r.jsxs(Fr,{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(hn,{name:"category_id",defaultValue:(n==null?void 0:n.category_id)||"",children:[r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select category"})}),r.jsx(dn,{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(Xn,{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(Hs,{className:"mt-4",children:[r.jsx(X,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsxs(X,{type:"submit",disabled:x.isPending,children:[x.isPending&&r.jsx(Wr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function u3t(){const{toast:e}=pi(),[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(Je,{className:"flex justify-center py-8",children:r.jsx(Wr,{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(Fo,{className:"h-5 w-5"}),"Popby Map Settings"]}),r.jsx(kn,{children:"Configure the map feature for popbys"})]}),r.jsxs(Je,{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(X,{onClick:i,disabled:o,children:[o&&r.jsx(Wr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Token"]}),t&&r.jsx(Tt,{variant:"secondary",className:"ml-2",children:"Token configured"})]})]})})}const h3t=()=>{const[e,t]=A.useState(""),[n,s]=A.useState("grid"),a=Wn(),{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(Dr,{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(X,{variant:"outline",size:"sm",onClick:()=>t(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(X,{variant:n==="grid"?"secondary":"outline",size:"icon",onClick:()=>s("grid"),className:"rounded-full",children:r.jsx(mf,{className:"h-4 w-4"})}),r.jsx(X,{variant:n==="list"?"secondary":"outline",size:"icon",onClick:()=>s("list"),className:"rounded-full",children:r.jsx(ff,{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(Je,{className:"p-4",children:[r.jsx(Tr,{className:"aspect-[3/2] w-full rounded-lg mb-4"}),r.jsx(Tr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Tr,{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(X,{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(Ds,{className:"h-8 w-8"})})}),r.jsxs(Je,{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:yse(u.description)})]})]},u.id))})]})})},m3t=()=>{const{serviceId:e}=Ec(),t=Wn(),{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(Dr,{title:"Loading...",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsx(Tr,{className:"h-8 w-48"}),r.jsx(Tr,{className:"h-64 w-full rounded-lg"}),r.jsx(Tr,{className:"h-24 w-full"})]})}):n?r.jsx(Dr,{title:n.name,children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs(X,{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(Ds,{className:"h-16 w-16"})})})}),r.jsx(He,{children:r.jsxs(Je,{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(Ts,{className:"h-4 w-4 mr-1"}),"Published ",ln(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(X,{size:"lg",className:"gap-2",onClick:()=>window.open(n.signup_link_url,"_blank"),children:[r.jsx(Ms,{className:"h-5 w-5"}),"Sign Up Now"]})})]})})]})}):r.jsx(Dr,{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(X,{onClick:()=>t("/additional-services"),children:[r.jsx(Wi,{className:"h-4 w-4 mr-2"}),"Back to Services"]})]})})},pT=[{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 f3t(){const[e,t]=A.useState(pT[0].id),n=pT.find(s=>s.id===e)||pT[0];return r.jsx(Dr,{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(hn,{value:e,onValueChange:t,children:[r.jsx(cn,{className:"w-full",children:r.jsx(fn,{placeholder:"Select a tool"})}),r.jsx(dn,{children:pT.map(s=>r.jsx($t,{value:s.id,children:s.name},s.id))})]})}),r.jsx("div",{className:"hidden md:block",children:r.jsx(ki,{value:e,onValueChange:t,className:"w-full",children:r.jsx(wi,{className:"w-full flex-wrap h-auto gap-1 bg-muted p-1",children:pT.map(s=>r.jsx(an,{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 fCe="agent-os-onboarding-completed",EO=[{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:qn,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"]}],p3t=()=>{const[e,t]=A.useState(!1),[n,s]=A.useState(0),[a,o]=A.useState(!1);A.useEffect(()=>{if(!localStorage.getItem(fCe)){const N=setTimeout(()=>t(!0),500);return()=>clearTimeout(N)}},[]);const l=()=>{n{s(n+1),o(!1)},150)):u()},i=()=>{u()},u=()=>{localStorage.setItem(fCe,"true"),t(!1)},m=EO[n],x=m.icon,y=n===EO.length-1,v=b=>{b||u(),t(b)};return r.jsx(Or,{open:e,onOpenChange:v,children:r.jsxs(Lr,{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(Ds,{className:"h-3 w-3"}),"Beta"]})]}),r.jsxs("div",{className:"p-6 pt-4",children:[r.jsxs(zr,{className:"text-center sm:text-center pb-2",children:[r.jsx(Fr,{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(Qn,{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(fi,{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:EO.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})},x3t=()=>{const e=qr(),{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"]}),Ca({title:"Touch snoozed!",description:"Contact has been snoozed."})},onError:n=>{Ca({title:"Error snoozing contact",description:n.message,variant:"destructive"})}})},y3t=()=>{const e=qr();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"]}),Ca({title:"Snooze cancelled"})},onError:t=>{Ca({title:"Error cancelling snooze",description:t.message,variant:"destructive"})}})},v3t=[{label:"1 week",days:7},{label:"2 weeks",days:14},{label:"1 month",days:30}];function $ae({open:e,onOpenChange:t,contactId:n,contactName:s}){const[a,o]=A.useState(null),l=x3t(),i=async()=>{a&&(await l.mutateAsync({contactId:n,days:a}),o(null),t(!1))},u=m=>ln(Ql(new Date,m),"MMM d, yyyy");return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Lr,{className:"sm:max-w-md",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(Qa,{className:"h-5 w-5"}),"Snooze Touch"]}),r.jsxs(Qn,{children:["Postpone the next scheduled touch for ",s,". Select how long to snooze."]})]}),r.jsx("div",{className:"space-y-3 py-4",children:v3t.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(Ts,{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(X,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(X,{onClick:i,disabled:!a||l.isPending,children:l.isPending?"Snoozing...":"Snooze Touch"})]})]})})}const _3t={Crown:q1,FileText:_a,Users:qn,Globe:uy,Star:Ss,Phone:Ii,MessageSquare:zo,PenTool:$j,Video:Pa,Gift:ao};function b3t({actions:e,onMarkComplete:t,onViewScript:n,isLoading:s,buildSmsLink:a,buildEmailLink:o,onGmailCompose:l}){const i=Wn(),[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 Q=`${D.contact.first_name} ${D.contact.last_name||""}`.toLowerCase(),ae=`${U.contact.first_name} ${U.contact.last_name||""}`.toLowerCase();V=Q.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=>_3t[D||"Phone"]||Ii,P=({field:D,children:U})=>r.jsxs(X,{variant:"ghost",size:"sm",className:"h-8 -ml-3 font-medium",onClick:()=>M(D),children:[U,u===D?x==="asc"?r.jsx(uf,{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(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:I.map((D,U)=>{var oe,de,se,pe,ne,me;const V=D.isSpecialDate,W=D.specialDateType,G=V?W==="birthday"?fm:ya:T(((oe=D.actionType)==null?void 0:oe.icon)||null),Q=D.contact.phone,ae=D.contact.email;return r.jsxs(Nr,{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(Tt,{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(Tt,{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(fm,{className:"h-3 w-3"})," Birthday"]}):r.jsxs(r.Fragment,{children:[r.jsx(ya,{className:"h-3 w-3"})," Anniversary"]})}):r.jsxs(Tt,{variant:"outline",className:"gap-1",children:[r.jsx(G,{className:"h-3 w-3"}),(de=D.actionType)==null?void 0:de.name]})})}),r.jsx(yt,{children:Q?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:[Q&&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(Ii,{className:"h-3.5 w-3.5"})}),Q&&r.jsx("a",{href:a(D.contact.phone,(se=D.script)==null?void 0:se.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(zo,{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(ks,{className:"h-3.5 w-3.5"})}):r.jsx("a",{href:o(D.contact.email,(pe=D.script)==null?void 0:pe.script_body,(ne=D.script)==null?void 0:ne.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(ks,{className:"h-3.5 w-3.5"})})),r.jsx(X,{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(vm,{className:"h-3.5 w-3.5"})}),r.jsxs(X,{variant:"default",size:"sm",className:"h-7 px-2 text-xs ml-1",onClick:()=>{var he;return t(D.contact.id,D.actionType.id,(he=D.script)==null?void 0:he.id)},disabled:s,children:[r.jsx(no,{className:"h-3.5 w-3.5 mr-1"}),"Done"]})]})})]},`${D.contact.id}-${U}`)})})]})}),r.jsx($ae,{open:!!v,onOpenChange:D=>!D&&b(null),contactId:v||"",contactName:N})]})}function NP(){const{data:e,isLoading:t}=Zt({queryKey:["gmail-integration"],queryFn:async()=>{const{data:a,error:o}=await Y.from("gmail_integrations").select("*").maybeSingle();if(o)throw o;return a}}),n=!!(e!=null&&e.is_active),s=(e==null?void 0:e.gmail_email)||null;return{isGmailConnected:n,gmailEmail:s,isLoading:t}}function w3t({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(Wr,{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(Wr,{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(Zo,{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(Tt,{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("div",{className:"max-h-[200px] overflow-y-auto space-y-1 pr-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))})]})}const j3t=5*1024*1024,k3t=["application/pdf","image/jpeg","image/png","image/gif","image/webp","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","text/csv"];function N3t(e){return e<1024?e+" B":e<1024*1024?(e/1024).toFixed(1)+" KB":(e/(1024*1024)).toFixed(1)+" MB"}function S3t(e){return new Promise((t,n)=>{const s=new FileReader;s.onload=()=>{const a=s.result;t(a.split(",")[1])},s.onerror=n,s.readAsDataURL(e)})}function gT(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 Uae({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),[D,U]=A.useState([]);A.useEffect(()=>{e&&(v((x==null?void 0:x.email)||""),N(gT(a,x||{first_name:""})),M(gT(o,x||{first_name:""})),F(!a&&!o),U([]))},[e,x,a,o]);const V=async de=>{const se=de.target.files;if(!se)return;const pe=D.reduce((me,he)=>me+he.size,0),ne=[];for(const me of Array.from(se)){if(!k3t.includes(me.type)){Ae.error(`${me.name}: Unsupported file type`);continue}if(pe+me.size>j3t){Ae.error("Total attachments exceed 20MB limit");break}try{const he=await S3t(me);ne.push({name:me.name,type:me.type,size:me.size,data:he})}catch{Ae.error(`Failed to read ${me.name}`)}}U(me=>[...me,...ne]),de.target.value=""},W=de=>{U(se=>se.filter((pe,ne)=>ne!==de))},G=de=>{N(gT(de.subject,x||{first_name:""})),M(gT(de.body,x||{first_name:""})),F(!1)},Q=de=>de.split(/\n\n+/).map(se=>`

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

`).join(""),ae=async de=>{if(!b||!k)return Ae.error("Please fill in subject and message"),!1;const se=gT(k,de),pe=Q(se);try{const{data:ne,error:me}=await Y.functions.invoke("gmail-send",{body:{to:de.email,subject:b,body:pe,contactId:de.id,attachments:D.map(({name:he,type:xe,data:Te})=>({name:he,type:xe,data:Te}))}});if(me)throw me;if(!(ne!=null&&ne.success))throw new Error((ne==null?void 0:ne.error)||"Failed to send");return!0}catch(ne){return console.error("Gmail send error:",ne),Ae.error("Failed to send to "+de.first_name+": "+(ne instanceof Error?ne.message:"Unknown error")),!1}},oe=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 de=0;for(const se of m)await ae(se)&&de++,await new Promise(ne=>setTimeout(ne,100));Ae.success(`Sent ${de} of ${m.length} emails`)}else await ae(x)&&Ae.success("Email sent successfully!");t(!1),i==null||i()}catch(de){console.error("Bulk send error:",de),Ae.error("Error sending emails")}finally{T(!1)}};return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Lr,{className:"sm:max-w-[600px] max-h-[90vh] overflow-y-auto",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(ks,{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 max-h-[50vh] overflow-y-auto",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(X,{variant:"ghost",size:"sm",onClick:()=>F(!1),className:"h-7 px-2 text-xs",children:[r.jsx(us,{className:"h-3 w-3 mr-1"})," Write from scratch"]})]}),r.jsx(w3t,{onSelect:G})]}):r.jsxs(X,{variant:"outline",size:"sm",className:"gap-2",onClick:()=>F(!0),children:[r.jsx(_a,{className:"h-4 w-4"}),"Browse Templates"]}),r.jsx(Dd,{}),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(de=>r.jsxs("div",{className:"text-sm",children:[de.first_name," ",de.last_name," — ",de.email]},de.id))})]}):r.jsxs(r.Fragment,{children:[r.jsx(ze,{htmlFor:"gmail-to",children:"To"}),r.jsx(lt,{id:"gmail-to",value:y,onChange:de=>v(de.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:de=>N(de.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(Tt,{variant:"outline",className:"text-[10px] cursor-pointer hover:bg-accent",onClick:()=>M(de=>de+"{{first_name}}"),children:"{{first_name}}"}),r.jsx(Tt,{variant:"outline",className:"text-[10px] cursor-pointer hover:bg-accent",onClick:()=>M(de=>de+"{{last_name}}"),children:"{{last_name}}"})]})]}),r.jsx(Xn,{id:"gmail-body",value:k,onChange:de=>M(de.target.value),placeholder:"Write your message...",rows:10,className:"resize-y"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(X,{type:"button",variant:"outline",size:"sm",className:"gap-2",onClick:()=>{var de;return(de=document.getElementById("gmail-attachments"))==null?void 0:de.click()},disabled:I,children:[r.jsx(P4,{className:"h-4 w-4"}),"Attach Files"]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"PDF, images, Word, Excel (max 5MB total)"}),r.jsx("input",{id:"gmail-attachments",type:"file",multiple:!0,accept:".pdf,.jpg,.jpeg,.png,.gif,.webp,.doc,.docx,.xls,.xlsx,.csv",className:"hidden",onChange:V})]}),D.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2",children:D.map((de,se)=>r.jsxs(Tt,{variant:"secondary",className:"gap-1.5 pl-2 pr-1 py-1",children:[r.jsx(P4,{className:"h-3 w-3"}),r.jsx("span",{className:"max-w-[140px] truncate text-xs",children:de.name}),r.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["(",N3t(de.size),")"]}),r.jsx("button",{type:"button",onClick:()=>W(se),className:"ml-0.5 rounded-full p-0.5 hover:bg-muted",children:r.jsx(us,{className:"h-3 w-3"})})]},se))})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(X,{variant:"outline",onClick:()=>t(!1),disabled:I,children:"Cancel"}),r.jsxs(X,{onClick:oe,disabled:I||!b||!k,className:"gap-2",children:[I?r.jsx(Wr,{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 pCe={Crown:q1,FileText:_a,Users:qn,Globe:uy,Star:Ss,Phone:Ii,MessageSquare:zo,PenTool:$j,Video:Pa,Gift:ao},C3t={"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 M3t(){const e=Wn(),{user:t}=tn(),{data:n}=qp(),{data:s}=_Re(),{data:a}=Nf(),{data:o}=Dye(),{data:l}=CRe(),i=Bgt(),u=SRe(),m=Fgt(90),x=jRe(),[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(are()),[G,Q]=A.useState("cards"),[ae,oe]=A.useState(!1),[de,se]=A.useState(null),[pe,ne]=A.useState(null),[me,he]=A.useState(""),{isGmailConnected:xe,gmailEmail:Te}=NP(),be=()=>{const Ce=parseInt(D,10);if(isNaN(Ce)||Ce<1){Ca({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}W(Ce),NRe(Ce),F(!1),Ca({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=Cm(new Date),et=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),Ye=Me(Ce.home_anniversary);return Ee&&ac(Ee,ve)||Ye&&ac(Ye,ve)}))||[],$e=(a==null?void 0:a.filter(Ce=>{if(!Ce.birthday&&!Ce.home_anniversary)return!1;const Ee=Ye=>{if(!Ye)return!1;const Le=Me(Ye);return Le?rre(Le,ve)&&aae(Le,et):!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),Ye=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:Ye?"Birthday Call":"Anniversary Call",icon:Ye?"Cake":"Home",color:Ye?"#EC4899":"#8B5CF6",description:Ye?"Wish them happy birthday!":"Celebrate their home anniversary!",active:!0,sort_order:0,created_at:"",updated_at:""},planName:Ye?"🎂 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:Ye?"birthday":"anniversary"}}),ot=l!==void 0?l||[]:(a==null?void 0:a.slice(0,5).map((Ce,Ee)=>{var Le,Ke,tt;const Ye=o==null?void 0:o[Ee%((o==null?void 0:o.length)||1)];return Ye?{contact:Ce,actionType:Ye,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))||[],At=[...Be,...ot],Oe=async(Ce,Ee,Ye)=>{await x.mutateAsync({contactId:Ce,actionTypeId:Ee,scriptUsedId:Ye}),M(!1),N(null)},at=Ce=>{Ce.script?(N(Ce),M(!0)):Oe(Ce.contact.id,Ce.actionType.id)},le=Ce=>pCe[Ce||"Phone"]||Ii,qe=Ce=>pCe[Ce||"Users"]||qn,Qe=(Ce,Ee)=>Ce.replace(/\{\{FirstName\}\}/g,Ee.first_name).replace(/\{\{LastName\}\}/g,Ee.last_name||"").replace(/\{\{AgentName\}\}/g,I||"there"),rt=(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,Ye)=>{const Le=`sms:${Ce}`;if(Ee&&Ye){const Ke=Qe(Ee,Ye);return`${Le}?body=${encodeURIComponent(Ke)}`}return Le},ut=(Ce,Ee,Ye,Le,Ke)=>{const tt=`mailto:${Ce}`,ct=[];if(Ke){const it=Ye||rt(Le||"Email",Ke.first_name);if(ct.push(`subject=${encodeURIComponent(it)}`),Ee){const zt=Qe(Ee,Ke);ct.push(`body=${encodeURIComponent(zt)}`)}}return ct.length>0?`${tt}?${ct.join("&")}`:tt};return r.jsxs(r.Fragment,{children:[r.jsxs(Dr,{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),Ye=(s==null?void 0:s[Ce.id])||0,Le=y===Ce.id,Ke=C3t[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:[Ye," Contacts"]})]})]},Ce.id)})})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[r.jsxs(X,{onClick:()=>e("/mission-control/video/record"),className:"w-full bg-gradient-to-r from-primary to-primary/80",children:[r.jsx(Ad,{className:"h-4 w-4 mr-1"}),"Quick Video"]}),r.jsxs(X,{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(X,{variant:"outline",onClick:()=>e("/mission-control/video-library"),className:"w-full",children:"Video Library"}),r.jsx(X,{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(Tt,{variant:"outline",className:"gap-1",children:[r.jsx(Ds,{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(X,{variant:G==="cards"?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>Q("cards"),title:"Card view",children:r.jsx(mf,{className:"h-4 w-4"})}),r.jsx(X,{variant:G==="table"?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>Q("table"),title:"Table view",children:r.jsx(ff,{className:"h-4 w-4"})})]})]}),r.jsx(He,{children:r.jsx(Je,{className:"p-4",children:At.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(X,{variant:"outline",className:"mt-4",onClick:()=>e("/mission-control/plans"),children:"Manage Plans"})]}):G==="table"?r.jsx(b3t,{actions:At,onMarkComplete:Oe,onViewScript:at,isLoading:x.isPending,buildSmsLink:je,buildEmailLink:ut,onGmailCompose:xe?Ce=>{se(Ce),oe(!0)}:void 0}):r.jsxs("div",{className:"flex gap-3 overflow-x-auto pb-2",children:[At.map((Ce,Ee)=>{var ir,Mr,Zr,Br,rn,Zn,Ot;const Ye=Ce.isSpecialDate,Le=Ce.specialDateType,Ke=Ye?Le==="birthday"?fm:ya:le(((ir=Ce.actionType)==null?void 0:ir.icon)||null),tt=Ce.contact.phone,ct=Ce.contact.email,it=Ye?Le==="birthday"?"#EC4899":"#8B5CF6":((Mr=Ce.actionType)==null?void 0:Mr.color)||"#3B82F6",zt=Ye?Le==="birthday"?"🎂 Birthday Today!":"🏠 Home Anniversary!":(Zr=Ce.actionType)==null?void 0:Zr.name;return r.jsxs("div",{className:`flex-shrink-0 w-[260px] border rounded-lg overflow-hidden ${Ye?"ring-2 ring-offset-2":""}`,style:Ye?{"--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(Ii,{className:"h-3 w-3"}),"Call"]}),r.jsxs("a",{href:je(Ce.contact.phone,(Br=Ce.script)==null?void 0:Br.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(zo,{className:"h-3 w-3"}),"Text"]})]}),ct&&(xe?r.jsxs("button",{onClick:()=>{se({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(ks,{className:"h-3 w-3"}),"Email"]}):r.jsxs("a",{href:ut(Ce.contact.email,(rn=Ce.script)==null?void 0:rn.script_body,(Zn=Ce.script)==null?void 0:Zn.email_subject,(Ot=Ce.actionType)==null?void 0:Ot.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(ks,{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(Tt,{variant:"secondary",className:"text-xs",children:Ce.relationshipTypeName}),Ce.monthNumber>0&&r.jsxs(Tt,{variant:"outline",className:"text-xs",children:["Month ",Ce.monthNumber]})]}),Ce.script&&r.jsx(X,{size:"sm",variant:"outline",className:"w-full",onClick:()=>at(Ce),children:"View Script"}),r.jsxs("div",{className:"flex gap-1.5",children:[r.jsxs(X,{size:"sm",variant:"outline",className:"flex-1 gap-1",onClick:()=>{ne(Ce.contact.id),he(`${Ce.contact.first_name} ${Ce.contact.last_name||""}`.trim())},children:[r.jsx(vm,{className:"h-3.5 w-3.5"}),"Snooze"]}),r.jsx(X,{size:"sm",className:"flex-1",onClick:()=>{var Gr;return Oe(Ce.contact.id,Ce.actionType.id,(Gr=Ce.script)==null?void 0:Gr.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(dh,{children:[r.jsx(uh,{asChild:!0,children:r.jsxs(X,{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(Ha,{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(Or,{open:P,onOpenChange:F,children:[r.jsx(Co,{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(Bd,{className:"h-4 w-4 text-muted-foreground hover:text-primary"})})}),r.jsxs(Lr,{className:"sm:max-w-[360px]",children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Set Weekly Goal"}),r.jsx(Qn,{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"&&be()}})]}),r.jsx(X,{onClick:be,className:"w-full",children:"Save Goal"})]})]})]})]})}),r.jsxs(Je,{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(pm,{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(Je,{className:"space-y-3",children:[$e.length>0?$e.map(Ce=>{const Ee=Ce.birthday,Ye=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 ln(new Date(new Date().getFullYear(),parseInt(Le[1],10)-1,parseInt(Le[2],10)),"MMM d")})(),Ee&&Ye&&" · ",Ye&&Ce.home_anniversary&&(()=>{const Le=Ce.home_anniversary.split(/[-/T]/);return ln(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(Qa,{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(qRe,{})]})]}),r.jsx(Or,{open:k,onOpenChange:M,children:r.jsxs(Lr,{className:"max-w-md",children:[r.jsx(zr,{children:r.jsx(Fr,{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:Qe(b.script.script_body,b.contact)})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(X,{variant:"outline",className:"flex-1",onClick:()=>M(!1),children:"Close"}),r.jsx(X,{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(p3t,{})]}),xe&&de&&r.jsx(Uae,{open:ae,onOpenChange:oe,contact:de,gmailEmail:Te}),r.jsx($ae,{open:!!pe,onOpenChange:Ce=>!Ce&&ne(null),contactId:pe||"",contactName:me})]})}const gBe=()=>{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})},qae=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})},Y0e=()=>{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})},xBe=()=>{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})},yBe=()=>{const{data:e}=Nf(),{data:t}=qp(),{data:n}=qae(),{data:s}=xBe(),{data:a}=Y0e(),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=Cm(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?Py(u,Cm(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)},vBe=()=>yBe().filter(t=>t.isDue),T3t=()=>{const e=qr(),{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"]}),Ca({title:"Popby item created!"})},onError:n=>{Ca({title:"Error creating popby item",description:n.message,variant:"destructive"})}})},_Be=()=>{const e=qr(),{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"]}),Ca({title:"Popby logged!"})},onError:n=>{Ca({title:"Error logging popby",description:n.message,variant:"destructive"})}})},A3t=()=>{const e=qr(),{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"]}),Ca({title:"Frequency updated!"})},onError:n=>{Ca({title:"Error updating frequency",description:n.message,variant:"destructive"})}})},E3t=()=>{const{data:e}=qae(30),t=vBe(),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 I3t(){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 bBe(e){const{data:t}=I3t(),{data:n}=xBe(),{data:s}=Y0e(),{data:a}=g3t();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=Cm(new Date);if(l&&!aae(l,i))return{nextTouchDate:l,daysUntil:Py(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(Cm(x),y),N=Py(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 wfe({contact:e}){const t=bBe(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:Qa,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:vm,text:`Snoozed until ${ln(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:Ts,text:"Never touched",className:"border-dashed"}}})(),a=s.icon;return r.jsxs(Tt,{variant:s.variant,className:Ut("gap-1",s.className),children:[r.jsx(a,{className:"h-3 w-3"}),s.text]})}function P3t({contact:e,onLogTouch:t,onSnooze:n}){const s=bBe(e),a=y3t(),[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(Qa,{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(vm,{className:"h-5 w-5 text-slate-600 dark:text-slate-400"});case"never-touched":return r.jsx(Ts,{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(Ts,{className:"h-4 w-4"}),"Next Touch"]})}),r.jsxs(Je,{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:"})," ",ln(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:"})," ",ln(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:"})," ",ln(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(X,{size:"sm",variant:"outline",className:"flex-1",onClick:x,disabled:a.isPending,children:[r.jsx(us,{className:"h-4 w-4 mr-1"}),"Cancel Snooze"]}),t&&r.jsx(X,{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(X,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>l(!0),children:[r.jsx(vm,{className:"h-4 w-4 mr-1"}),"Snooze"]}),(s.status==="overdue"||s.status==="due-soon"||s.status==="never-touched")&&t&&r.jsx(X,{size:"sm",className:"flex-1",variant:s.status==="overdue"?"default":"outline",onClick:t,children:"Log Touch"})]})]})]}),r.jsx($ae,{open:o,onOpenChange:l,contactId:e.id,contactName:`${e.first_name} ${e.last_name||""}`.trim()})]})}const Fde=768;function $3(){const[e,t]=A.useState(void 0);return A.useEffect(()=>{const n=window.matchMedia(`(max-width: ${Fde-1}px)`),s=()=>{t(window.innerWidthn.removeEventListener("change",s)},[]),!!e}const L3t={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"}},O3t={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 zde({score:e,showScore:t=!1,showTooltip:n=!0,size:s="sm",className:a}){const o=L3t[e.status],l=O3t[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(eP,{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 D3t=[{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}],R3t=({open:e,onOpenChange:t,relationshipTypes:n,onSuccess:s})=>{const{user:a}=tn(),{toast:o}=pi(),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 he=me.split(` `).map(we=>we.trim()).filter(we=>we);if(he.length===0)return{headers:[],data:[]};const xe=we=>{const ve=[];let et="",Me=!1;for(let Ie=0;Ie{var Te;const he=(Te=me.target.files)==null?void 0:Te[0];if(!he)return;const xe=new FileReader;xe.onload=be=>{var Ie;const we=(Ie=be.target)==null?void 0:Ie.result,{headers:ve,data:et}=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(et);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(he)},ae=(me,he)=>{N(xe=>{if(he==="none"){const{[me]:Te,...be}=xe;return be}return{...xe,[me]:he}})},oe=me=>{M(he=>he.includes(me)?he.filter(xe=>xe!==me):[...he,me])},de=()=>{const me=y.map(he=>{const xe=we=>{const ve=b[we];if(!ve)return"";const et=m.indexOf(ve);return et>=0?(he[et]||"").trim():""},Te=xe("first_name"),be=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:be,error:be?void 0:"First name is required"}});T(me),u("preview")},se=async()=>{if(!(a!=null&&a.id))return;const me=I.filter(be=>be.isValid);if(me.length===0){o({title:"No valid contacts",description:"There are no valid contacts to import.",variant:"destructive"});return}F(!0);let he=0,xe=0,Te=0;try{for(const be of me)try{let we=null;if(be.email){const{data:et}=await Y.from("innercircle_contacts").select("id").eq("owner_user_id",a.id).eq("email",be.email).maybeSingle();we=et}if(!we&&be.phone){const{data:et}=await Y.from("innercircle_contacts").select("id").eq("owner_user_id",a.id).eq("phone",be.phone).maybeSingle();we=et}const ve={owner_user_id:a.id,first_name:be.first_name,last_name:be.last_name||null,email:be.email||null,phone:be.phone||null,address:be.address||null,city:be.city||null,state:be.state||null,zip:be.zip||null,spouse_name:be.spouse_name||null,spouse_email:be.spouse_email||null,company_name:be.company_name||null,job_title:be.job_title||null,birthday:be.birthday||null,home_anniversary:be.home_anniversary||null,notes:be.notes||null};if(we)await Y.from("innercircle_contacts").update(ve).eq("id",we.id),xe++;else{const{data:et}=await Y.from("innercircle_contacts").insert(ve).select("id").single();et&&k.length>0&&await Y.from("innercircle_contact_tags").insert(k.map(Me=>({contact_id:et.id,relationship_type_id:Me}))),he++}}catch(we){console.error("Error importing contact:",we),Te++}U({created:he,updated:xe,failed:Te}),u("result"),(he>0||xe>0)&&s(),o({title:"Import Complete",description:`${he} created, ${xe} updated${Te>0?`, ${Te} failed`:""}.`})}catch(be){console.error("Import error:",be),o({title:"Import Failed",description:be.message||"Failed to import contacts",variant:"destructive"})}finally{F(!1)}},pe=I.filter(me=>me.isValid).length,ne=I.filter(me=>!me.isValid).length;return r.jsx(Or,{open:e,onOpenChange:W,children:r.jsxs(Lr,{className:"max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(H1,{className:"h-5 w-5"}),"Import Contacts from CSV"]}),r.jsx(Qn,{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:Q,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(X,{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(X,{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`,he=new Blob([me],{type:"text/csv"}),xe=URL.createObjectURL(he),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:D3t.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(hn,{value:b[me.key]||"none",onValueChange:he=>ae(me.key,he),children:[r.jsx(cn,{className:"w-48",children:r.jsx(fn,{placeholder:"Select column..."})}),r.jsxs(dn,{children:[r.jsx($t,{value:"none",children:"-- Not mapped --"}),m.map(he=>r.jsx($t,{value:he,children:he},he))]})]})]},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(Tt,{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:[pe," valid"]})]}),ne>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:[ne," invalid"]})]})]}),r.jsxs("div",{className:"flex-1 overflow-auto border rounded-lg",children:[r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:I.slice(0,100).map((me,he)=>r.jsxs(Nr,{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(Tt,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):r.jsx(Tt,{variant:"destructive",children:me.error||"Invalid"})})]},he))})]}),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(Hs,{children:[i==="upload"&&r.jsx(X,{variant:"outline",onClick:W,children:"Cancel"}),i==="mapping"&&r.jsxs(r.Fragment,{children:[r.jsx(X,{variant:"outline",onClick:V,children:"Back"}),r.jsx(X,{onClick:de,disabled:!b.first_name,children:"Continue"})]}),i==="preview"&&r.jsxs(r.Fragment,{children:[r.jsx(X,{variant:"outline",onClick:()=>u("mapping"),children:"Back"}),r.jsx(X,{onClick:se,disabled:P||pe===0,children:P?r.jsxs(r.Fragment,{children:[r.jsx(Wr,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${pe} Contact${pe!==1?"s":""}`})]}),i==="result"&&r.jsx(X,{onClick:W,children:"Done"})]})]})})};function F3t(){return"contacts"in navigator&&"ContactsManager"in window}function z3t(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 B3t({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=F3t(),T=A.useCallback(ae=>{if(!a)return ae;const oe=new Set(a.filter(se=>se.email).map(se=>se.email.toLowerCase())),de=new Set(a.filter(se=>se.phone).map(se=>se.phone.replace(/\D/g,"")));return ae.map(se=>{var me,he;const pe=(me=se.email)==null?void 0:me.toLowerCase(),ne=(he=se.phone)==null?void 0:he.replace(/\D/g,"");return pe&&oe.has(pe)?{...se,isDuplicate:!0,duplicateField:"email"}:ne&&ne.length>=7&&de.has(ne)?{...se,isDuplicate:!0,duplicateField:"phone"}:se})},[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 de=oe.map(ne=>{var xe,Te,be,we;const he=(((xe=ne.name)==null?void 0:xe[0])||"").split(" ");return{first_name:he[0]||"",last_name:he.slice(1).join(" "),email:((Te=ne.email)==null?void 0:Te[0])||"",phone:((be=ne.tel)==null?void 0:be[0])||"",address:(we=ne.address)!=null&&we[0]?[ne.address[0].streetAddress,ne.address[0].city,ne.address[0].region,ne.address[0].postalCode].filter(Boolean).join(", "):""}}),se=T(de);x(se);const pe=new Set;se.forEach((ne,me)=>{ne.isDuplicate||pe.add(me)}),v(pe),u("preview")}catch(ae){console.error("Contact Picker error:",ae),Ca({title:"Could not access contacts",description:"Please try the file upload option instead.",variant:"destructive"})}},F=ae=>{var se;const oe=(se=ae.target.files)==null?void 0:se[0];if(!oe)return;const de=new FileReader;de.onload=pe=>{var Te;const ne=(Te=pe.target)==null?void 0:Te.result,me=z3t(ne);if(me.length===0){Ca({title:"No contacts found",description:"The file didn't contain any valid contacts.",variant:"destructive"});return}const he=T(me);x(he);const xe=new Set;he.forEach((be,we)=>{be.isDuplicate||xe.add(we)}),v(xe),u("preview")},de.readAsText(oe),l.current&&(l.current.value="")},D=async()=>{const ae=m.filter((de,se)=>y.has(se));if(ae.length===0)return;u("importing");let oe=0;for(const de of ae)try{await o.mutateAsync({first_name:de.first_name,last_name:de.last_name||void 0,email:de.email||void 0,phone:de.phone||void 0,address:de.address||void 0}),oe++,M(Math.round(oe/ae.length*100))}catch(se){console.error(`Failed to import ${de.first_name} ${de.last_name}:`,se)}N(oe),u("done")},U=ae=>{v(oe=>{const de=new Set(oe);return de.has(ae)?de.delete(ae):de.add(ae),de})},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,Q=y.size;return r.jsx(Or,{open:e,onOpenChange:W,children:r.jsxs(Lr,{className:"sm:max-w-lg max-h-[90vh]",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(xy,{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(Qn,{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(X,{onClick:P,className:"w-full h-auto py-4 flex flex-col items-center gap-2",children:[r.jsx(xy,{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(X,{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(X,{variant:"ghost",size:"sm",onClick:V,children:y.size===m.length?"Deselect All":"Select All"})]}),r.jsx(Zo,{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(Tt,{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(X,{variant:"ghost",size:"sm",onClick:()=>u("choose"),children:"Back"}),r.jsxs(X,{onClick:D,disabled:Q===0,children:["Import ",Q," Contact",Q!==1?"s":""]})]})]}),i==="importing"&&r.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[r.jsx(Wr,{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(fi,{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(X,{onClick:()=>W(!1),className:"mt-2",children:"Done"})]})]})})}function $3t({selectedIds:e,contacts:t,onClearSelection:n}){const{data:s}=qp(),a=Oye(),o=qr(),{isGmailConnected:l}=NP(),[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"]}),Ca({title:`Assigned type to ${y} contacts`}),n()}catch(M){Ca({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),Ca({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){Ca({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(Tt,{variant:"secondary",className:"font-semibold",children:[y," selected"]}),r.jsxs(hn,{onValueChange:v,disabled:i,children:[r.jsx(cn,{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(dn,{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(X,{variant:"outline",size:"sm",onClick:()=>x(!0),disabled:i,children:[r.jsx(ks,{className:"h-3.5 w-3.5 mr-1"}),"Email"]}),r.jsxs(X,{variant:"outline",size:"sm",onClick:b,disabled:i,children:[r.jsx(so,{className:"h-3.5 w-3.5 mr-1"}),"Export"]}),r.jsxs(X,{variant:"outline",size:"sm",onClick:N,disabled:i,className:"text-destructive hover:text-destructive",children:[r.jsx(Un,{className:"h-3.5 w-3.5 mr-1"}),"Delete"]}),r.jsxs(X,{variant:"ghost",size:"sm",onClick:n,className:"ml-auto",children:[r.jsx(us,{className:"h-3.5 w-3.5 mr-1"}),"Clear"]})]}),r.jsx(Uae,{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 gCe({contact:e,onEdit:t,onDelete:n,onSnooze:s}){const a=Wn(),o=`${e.first_name} ${e.last_name||""}`.trim();return r.jsxs(dh,{children:[r.jsx(uh,{asChild:!0,children:r.jsx(X,{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(Ha,{onClick:()=>a(`/mission-control/contacts/${e.id}?tab=activity&action=log`),children:[r.jsx(Ii,{className:"h-4 w-4 mr-2"}),"Log Touch"]}),r.jsxs(Ha,{onClick:()=>a(`/mission-control/video?contactId=${e.id}`),children:[r.jsx(Pa,{className:"h-4 w-4 mr-2"}),"Send Video"]}),r.jsxs(Ha,{onClick:()=>a(`/mission-control/popbys?contactId=${e.id}`),children:[r.jsx(Fo,{className:"h-4 w-4 mr-2"}),"Schedule Pop-by"]}),r.jsxs(Ha,{onClick:()=>s(e.id,o),children:[r.jsx(vm,{className:"h-4 w-4 mr-2"}),"Snooze"]}),r.jsxs(Ha,{onClick:()=>t(e),children:[r.jsx(Ja,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(Ha,{onClick:()=>n(e.id),className:"text-destructive focus:text-destructive",children:[r.jsx(Un,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})}function U3t(){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 q3t(){const e=qr(),{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"]}),Ca({title:"Smart list saved"})},onError:n=>{Ca({title:"Error saving smart list",description:n.message,variant:"destructive"})}})}function V3t(){const e=qr();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"]}),Ca({title:"Smart list deleted"})}})}function H3t({currentFilters:e,currentSortBy:t,onApplySmartList:n}){const{data:s}=U3t(),a=q3t(),o=V3t(),[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(dh,{children:[r.jsx(uh,{asChild:!0,children:r.jsxs(X,{variant:"outline",size:"sm",className:"gap-1.5",children:[r.jsx(W1,{className:"h-3.5 w-3.5"}),"Smart Lists",s&&s.length>0&&r.jsx(Tt,{variant:"secondary",className:"h-5 px-1.5 text-[10px]",children:s.length}),r.jsx(Fd,{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(Ha,{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(X,{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(Un,{className:"h-3 w-3 text-destructive"})})]},v.id)),r.jsx(ik,{})]}):r.jsx(Ha,{disabled:!0,className:"text-muted-foreground text-xs",children:"No saved lists yet"}),x&&r.jsxs(Ha,{onClick:()=>i(!0),children:[r.jsx(rA,{className:"h-4 w-4 mr-2"}),"Save Current Filters"]})]})]}),r.jsx(Or,{open:l,onOpenChange:i,children:r.jsxs(Lr,{className:"max-w-sm",children:[r.jsx(zr,{children:r.jsx(Fr,{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(X,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(X,{onClick:y,disabled:!u.trim()||a.isPending,children:"Save"})]})]})]})})]})}function $T(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 yCe({birthday:e,homeAnniversary:t,className:n}){const s=xCe(e,"birthday",7),a=xCe(t,"anniversary",7);return!s&&!a?null:r.jsxs("div",{className:Ut("flex flex-wrap gap-1",n),children:[s&&r.jsx(Tt,{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(Tt,{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 vCe({deal:e}){if(!e||!e.stage)return null;const{stage:t}=e;return r.jsxs(Tt,{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 W3t(){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 G3t(){const e=Wn(),[t]=Zc(),{user:n}=tn(),s=$3(),a=qr(),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}=W3t(),v=Lye(),b=bRe(),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,Q]=A.useState(null),[ae,oe]=A.useState(!1),[de,se]=A.useState(!1),[pe,ne]=A.useState(null),[me,he]=A.useState(""),[xe,Te]=A.useState(new Set),[be,we]=A.useState(!1),[ve,et]=A.useState(1),[Me,Ie]=A.useState(50),$e=A.useCallback(Ee=>{we(!1),Te(Ye=>{const Le=new Set(Ye);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(Ye=>Ye.relationship_type_id))||[]})},[G]);const ot=A.useMemo(()=>{if(!u)return[];let Ee=u.filter(Ye=>{var tt,ct,it;const Le=k===""||`${Ye.first_name} ${Ye.last_name}`.toLowerCase().includes(k.toLowerCase())||((tt=Ye.email)==null?void 0:tt.toLowerCase().includes(k.toLowerCase()))||((ct=Ye.phone)==null?void 0:ct.includes(k)),Ke=I==="all"||((it=Ye.tags)==null?void 0:it.some(zt=>zt.relationship_type_id===I));return Le&&Ke});return P==="not-touched-90"?Ee=Ee.filter(Ye=>{const Le=Ye.relationshipScore.daysSinceTouch;return Le===null||Le>90}):P==="at-risk"?Ee=Ee.filter(Ye=>Ye.relationshipScore.status==="at-risk"):P==="cooling"?Ee=Ee.filter(Ye=>Ye.relationshipScore.status==="cooling"):P==="warm"&&(Ee=Ee.filter(Ye=>Ye.relationshipScore.status==="warm")),Ee=[...Ee].sort((Ye,Le)=>{switch(D){case"important-dates":{const Ke=$T(Ye.birthday),tt=$T(Le.birthday),ct=$T(Ye.home_anniversary),it=$T(Le.home_anniversary),zt=[Ke,ct].filter(Mr=>Mr!==null).sort((Mr,Zr)=>(Mr??1/0)-(Zr??1/0))[0]??1/0,ir=[tt,it].filter(Mr=>Mr!==null).sort((Mr,Zr)=>(Mr??1/0)-(Zr??1/0))[0]??1/0;return zt-ir}case"last-touched":{const Ke=Ye.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=Ye.relationshipScore.daysSinceTouch,tt=Le.relationshipScore.daysSinceTouch;return Ke===null&&tt===null?0:Ke===null?-1:tt===null?1:tt-Ke}case"score":return Ye.relationshipScore.score-Le.relationshipScore.score;case"date-added":{const Ke=Ye.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=`${Ye.first_name||""} ${Ye.last_name||""}`.toLowerCase(),tt=`${Le.first_name||""} ${Le.last_name||""}`.toLowerCase();return Ke.localeCompare(tt)}}}),Ee},[u,k,I,P,D]),At=ot.length,Oe=Math.max(1,Math.ceil(At/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(()=>{et(1)},[k,I,P,D]);const qe=A.useCallback(()=>{we(!1),Te(Ee=>Ee.size>0?new Set:new Set(le.map(Ye=>Ye.id)))},[le]),Qe=A.useCallback(()=>{we(!0),Te(new Set(ot.map(Ee=>Ee.id)))},[ot]),rt=A.useCallback((Ee,Ye)=>{M(Ee.search||""),T(Ee.type||"all"),F(Ee.status||"all"),U(Ye||"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}),Q(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(Dr,{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(X,{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(Je,{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(hn,{value:I,onValueChange:T,children:[r.jsx(cn,{className:"w-[160px]",children:r.jsx(fn,{placeholder:"Filter by type"})}),r.jsxs(dn,{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(hn,{value:P,onValueChange:F,children:[r.jsx(cn,{className:"w-[160px]",children:r.jsx(fn,{placeholder:"Filter by status"})}),r.jsxs(dn,{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(hn,{value:D,onValueChange:U,children:[r.jsx(cn,{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(fn,{placeholder:"Sort by"})]})}),r.jsxs(dn,{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(H3t,{currentFilters:{search:k,type:I,status:P},currentSortBy:D,onApplySmartList:rt}),r.jsxs(X,{onClick:()=>W(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Contact"]}),r.jsxs(X,{variant:"outline",onClick:()=>oe(!0),children:[r.jsx(bo,{className:"h-4 w-4 mr-1"}),"Import CSV"]}),r.jsxs(X,{variant:"outline",onClick:()=>se(!0),children:[r.jsx(xy,{className:"h-4 w-4 mr-1"}),"Import from Phone"]})]})})}),r.jsx($3t,{selectedIds:xe,contacts:ot,onClearSelection:()=>{Te(new Set),we(!1)}}),xe.size>0&&xe.size===le.length&&!be&&At>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(X,{variant:"link",size:"sm",className:"h-auto p-0 font-semibold",onClick:Qe,children:["Select all ",At.toLocaleString()," matching contacts"]})]}),be&&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 ",At.toLocaleString()," matching contacts are selected.",r.jsx(X,{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:Ye}=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(Je,{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(ks,{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(Ii,{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(zde,{score:Ye,size:"sm"}),r.jsx(wfe,{contact:Ee}),(Le=Ee.tags)==null?void 0:Le.map(Ke=>{var tt;return r.jsx(Tt,{variant:"secondary",className:"text-xs",children:(tt=Ke.relationship_type)==null?void 0:tt.name},Ke.id)}),r.jsx(vCe,{deal:y==null?void 0:y[Ee.id]})]}),r.jsx(yCe,{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:[Ye.lastTouchDate?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Qa,{className:"h-3 w-3"}),ln(new Date(Ye.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(Ts,{className:"h-3 w-3"}),ln(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"}),ln(new Date(Ee.home_anniversary),"MMM d")]})]})]}),r.jsx("div",{className:"ml-2",onClick:Ke=>Ke.stopPropagation(),children:r.jsx(gCe,{contact:Ee,onEdit:Q,onDelete:Ce,onSnooze:(Ke,tt)=>{ne(Ke),he(tt)}})})]})})},Ee.id)})}):r.jsx(He,{children:r.jsx(Je,{className:"p-0 overflow-x-auto",children:r.jsxs(Rs,{className:"min-w-[800px]",children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:m?r.jsx(Nr,{children:r.jsx(yt,{colSpan:9,className:"text-center py-8",children:"Loading contacts..."})}):ot.length===0?r.jsx(Nr,{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:Ye}=Ee,Le=y==null?void 0:y[Ee.id];return r.jsxs(Nr,{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(zde,{score:Ye,size:"sm"}),r.jsx(wfe,{contact:Ee})]})}),r.jsx(yt,{children:r.jsx(zde,{score:Ye,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(ks,{className:"h-3 w-3"}),Ee.email]}),Ee.phone&&r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Ii,{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(Tt,{variant:"secondary",className:"text-xs",children:(ct=tt.relationship_type)==null?void 0:ct.name},tt.id)}),r.jsx(vCe,{deal:Le})]})}),r.jsx(yt,{children:r.jsx("div",{className:"text-sm",children:Ye.lastTouchDate?r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Qa,{className:"h-3 w-3"}),ln(new Date(Ye.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(yCe,{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(Ts,{className:"h-3 w-3"}),ln(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"}),ln(new Date(Ee.home_anniversary),"MMM d")]})]})]})}),r.jsx(yt,{children:r.jsx(gCe,{contact:Ee,onEdit:Q,onDelete:Ce,onSnooze:(tt,ct)=>{ne(tt),he(ct)}})})]},Ee.id)})})]})})}),At>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,At)," of ",At.toLocaleString()," contacts"]}),r.jsxs(hn,{value:String(Me),onValueChange:Ee=>{Ie(Number(Ee)),et(1)},children:[r.jsx(cn,{className:"w-[80px] h-8",children:r.jsx(fn,{})}),r.jsxs(dn,{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(X,{variant:"outline",size:"sm",disabled:at<=1,onClick:()=>et(1),children:"First"}),r.jsx(X,{variant:"outline",size:"sm",disabled:at<=1,onClick:()=>et(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(X,{variant:"outline",size:"sm",disabled:at>=Oe,onClick:()=>et(Ee=>Ee+1),children:r.jsx(Gi,{className:"h-4 w-4"})}),r.jsx(X,{variant:"outline",size:"sm",disabled:at>=Oe,onClick:()=>et(Oe),children:"Last"})]})]}),r.jsx(Or,{open:V||!!G,onOpenChange:Ee=>{Ee||(W(!1),Q(null),je())},children:r.jsxs(Lr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Fr,{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:Ye=>{Ve(Ye?{...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(Xn,{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(X,{type:"button",variant:"outline",onClick:()=>{W(!1),Q(null),je()},children:"Cancel"}),r.jsxs(X,{type:"submit",disabled:v.isPending||b.isPending,children:[G?"Update":"Create"," Contact"]})]})]})]})}),r.jsx(R3t,{open:ae,onOpenChange:oe,relationshipTypes:(x==null?void 0:x.filter(Ee=>Ee.active))||[],onSuccess:()=>{oe(!1)}}),r.jsx(B3t,{open:de,onOpenChange:se,onComplete:()=>se(!1)}),r.jsx($ae,{open:!!pe,onOpenChange:Ee=>{Ee||ne(null)},contactId:pe||"",contactName:me})]})})}function K3t(){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 Z3t(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 Y3t(){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 X3t(){const{user:e}=tn(),t=qr();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 Q3t(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 J3t(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 X0e(){const{user:e}=tn(),t=qr();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 e5t(){const e=qr();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 t5t(){const e=qr();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 Q0e(){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 wBe(){const{data:e,isLoading:t}=Q0e(),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 jBe(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 kBe(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 NBe(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 r5t(){const{user:e}=tn(),t=qr();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 n5t(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 s5t({videoId:e}){var l;const{data:t,isLoading:n,error:s}=J3t(e);if(n)return r.jsxs("div",{className:"space-y-4",children:[r.jsx(Tr,{className:"w-full aspect-video rounded-lg"}),r.jsx(Tr,{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(Gu,{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 a5t(){var at,le;const{contactId:e}=Ec(),t=Wn(),[n]=Zc(),s=n.get("search")||"",a=n.get("type")||"all",o=n.get("status")||"all",{data:l,isLoading:i}=Cgt(e||""),{data:u}=qp(),{data:m}=Dye(),{data:x}=dae(365),{data:y}=qae(365),{data:v}=n5t(e),{contactsWithScores:b}=Fye(),N=bRe(),k=Oye(),M=jRe(),[I,T]=A.useState(!1),[P,F]=A.useState({}),[D,U]=A.useState(!1),[V,W]=A.useState(null),[G,Q]=A.useState(""),[ae,oe]=A.useState(null),[de,se]=A.useState(!1),[pe,ne]=A.useState(null),{isGmailConnected:me,gmailEmail:he}=NP(),{data:xe}=Zt({queryKey:["gmail-sent-emails",e],queryFn:async()=>{const{data:qe,error:Qe}=await Y.from("gmail_sent_emails").select("*").eq("contact_id",e).order("sent_at",{ascending:!1});if(Qe)throw Qe;return qe},enabled:!!e}),Te=qe=>{if(!qe)return null;const Qe=qe.match(/Video ID:\s*([a-f0-9-]+)/i);return Qe?Qe[1]:null},be=A.useMemo(()=>{if(!b)return[];let qe=b.filter(Qe=>{var ut,Ce,Ee;const rt=s===""||`${Qe.first_name} ${Qe.last_name}`.toLowerCase().includes(s.toLowerCase())||((ut=Qe.email)==null?void 0:ut.toLowerCase().includes(s.toLowerCase()))||((Ce=Qe.phone)==null?void 0:Ce.includes(s)),je=a==="all"||((Ee=Qe.tags)==null?void 0:Ee.some(Ye=>Ye.relationship_type_id===a));return rt&&je});return o==="not-touched-90"?qe=qe.filter(Qe=>{const rt=Qe.relationshipScore.daysSinceTouch;return rt===null||rt>90}):o==="at-risk"?qe=qe.filter(Qe=>Qe.relationshipScore.status==="at-risk"):o==="cooling"?qe=qe.filter(Qe=>Qe.relationshipScore.status==="cooling"):o==="warm"&&(qe=qe.filter(Qe=>Qe.relationshipScore.status==="warm")),qe.map(Qe=>Qe.id)},[b,s,a,o]),we=be.indexOf(e||""),ve=we>0?be[we-1]:null,et=we1&&we!==-1,Ie=qe=>{const Qe=new URLSearchParams;s&&Qe.set("search",s),a!=="all"&&Qe.set("type",a),o!=="all"&&Qe.set("status",o);const rt=Qe.toString();return`/mission-control/contacts/${qe}${rt?`?${rt}`:""}`},$e=A.useMemo(()=>{const qe=((x==null?void 0:x.filter(rt=>rt.contact_id===e))||[]).map(rt=>{var ut,Ce;const je=Te(rt.notes);return{id:rt.id,type:"touch",completed_at:rt.completed_at,name:((ut=rt.action_type)==null?void 0:ut.name)||"Touch",color:((Ce=rt.action_type)==null?void 0:Ce.color)||"#3B82F6",notes:rt.notes,videoId:je}}),Qe=((y==null?void 0:y.filter(rt=>rt.contact_id===e))||[]).map(rt=>({id:rt.id,type:"popby",completed_at:rt.completed_at,name:"Pop-by",color:"#F97316",notes:rt.notes,videoId:null}));return[...qe,...Qe].sort((rt,je)=>new Date(je.completed_at).getTime()-new Date(rt.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(Qe=>Qe.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"))},At=async()=>{V&&(await M.mutateAsync({contactId:e,actionTypeId:V,notes:G}),U(!1),W(null),Q(""))},Oe=(qe,Qe)=>{me&&l?(ne({email:qe,name:Qe||`${l.first_name} ${l.last_name||""}`.trim()}),se(!0)):window.location.href=`mailto:${qe}`};return i?r.jsx(Dr,{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(Dr,{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(X,{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(X,{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 ",be.length]}),r.jsxs(X,{variant:"ghost",size:"sm",onClick:()=>et&&t(Ie(et)),disabled:!et,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(X,{variant:"outline",onClick:()=>Oe(l.email,`${l.first_name} ${l.last_name||""}`.trim()),children:[r.jsx(ks,{className:"h-4 w-4 mr-1"}),"Email"]}),r.jsxs(X,{variant:"default",onClick:()=>t(`/mission-control/video/record?contact_id=${e}`),className:"bg-gradient-to-r from-primary to-primary/80",children:[r.jsx(Pa,{className:"h-4 w-4 mr-1"}),"Quick Video Touch"]}),r.jsxs(Or,{open:D,onOpenChange:U,children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{variant:"outline",children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Log Action"]})}),r.jsxs(Lr,{children:[r.jsx(zr,{children:r.jsx(Fr,{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(Xn,{id:"action-notes",value:G,onChange:qe=>Q(qe.target.value),placeholder:"Add any notes about this interaction...",rows:3})]}),r.jsxs(X,{onClick:At,disabled:!V||M.isPending,className:"w-full",children:[r.jsx(fi,{className:"h-4 w-4 mr-1"}),"Complete Action"]})]})]})]}),r.jsxs(X,{variant:"outline",onClick:Be,children:[r.jsx(gc,{className:"h-4 w-4 mr-1"}),"Edit"]}),r.jsx(X,{variant:"destructive",size:"icon",onClick:ot,children:r.jsx(Un,{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(ks,{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(Ii,{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(wfe,{contact:l}),(at=l.tags)==null?void 0:at.map(qe=>{const Qe=u==null?void 0:u.find(rt=>rt.id===qe.relationship_type_id);return Qe?r.jsx(Tt,{variant:"secondary",className:"text-xs",children:Qe.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(Je,{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(Dd,{}),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 Qe;return r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx(_l,{checked:(Qe=P.tagIds)==null?void 0:Qe.includes(qe.id),onCheckedChange:rt=>{var je;F(rt?{...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(Xn,{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(X,{onClick:Ve,disabled:N.isPending,children:"Save Changes"}),r.jsx(X,{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(Ts,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"text-sm",children:[r.jsx("span",{className:"font-medium",children:"Last Contacted:"})," ",ln(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(ks,{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(Ii,{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(Fo,{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(Ts,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Birthday: ",ln(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: ",ln(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(Dd,{}),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(ks,{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(mi,{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(Dd,{}),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 Qe;return r.jsx(Tt,{variant:"secondary",children:(Qe=qe.relationship_type)==null?void 0:Qe.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(Dd,{}),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(P3t,{contact:l,onLogTouch:()=>U(!0)}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{children:"Activity Log"})}),r.jsx(Je,{children:$e.length>0?r.jsx("div",{className:"space-y-4",children:$e.map(qe=>{var Qe;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"}):(Qe=qe.name)==null?void 0:Qe.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(X,{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:ln(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(zo,{className:"h-5 w-5 text-primary"}),"Video Replies"]})}),r.jsx(Je,{children:r.jsx("div",{className:"space-y-4",children:v.map(qe=>{var Qe,rt;return r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0",children:[(Qe=qe.video)!=null&&Qe.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(Pa,{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: ",((rt=qe.video)==null?void 0:rt.title)||"Untitled Video"]}),r.jsxs(X,{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:ln(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(Je,{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(ks,{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," · ",ln(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(Or,{open:!!ae,onOpenChange:qe=>!qe&&oe(null),children:r.jsxs(Lr,{className:"max-w-2xl",children:[r.jsx(zr,{children:r.jsx(Fr,{children:"Video Preview"})}),ae&&r.jsx(s5t,{videoId:ae})]})})]})]})}),me&&l&&pe&&r.jsx(Uae,{open:de,onOpenChange:se,contact:{id:l.id,first_name:l.first_name,last_name:l.last_name,email:pe.email},gmailEmail:he})]}):r.jsx(Dr,{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(X,{onClick:()=>t("/mission-control/contacts"),children:"Back to Contacts"})]})})}const _Ce={Crown:q1,FileText:_a,Users:qn,Globe:uy,Star:Ss,Phone:Ii,MessageSquare:zo,PenTool:$j,Video:Pa,Gift:ao},Bde=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function i5t(){var Ke,tt;const e=Wn(),{user:t}=tn(),{data:n}=qp(),{data:s}=Tgt(),{data:a}=Dgt(),{data:o}=_Re(),{data:l}=Dye(),{data:i}=Mgt(),u=Rgt(),m=Agt(),x=Igt(),y=Pgt(),v=Lgt(),b=Ogt(),N=Egt(),[k,M]=A.useState(null),[I,T]=A.useState(!1),[P,F]=A.useState(null),[D,U]=A.useState(""),[V,W]=A.useState(""),[G,Q]=A.useState([]),[ae,oe]=A.useState(null),[de,se]=A.useState(null),[pe,ne]=A.useState(!1),[me,he]=A.useState(""),[xe,Te]=A.useState(""),[be,we]=A.useState(""),[ve,et]=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),At=k?Ie(k):null,Oe=s==null?void 0:s.find(ct=>ct.id===(At==null?void 0:At.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}),Qe()},le=async()=>{!D.trim()||!P||(await x.mutateAsync({id:P,name:D,description:V}),await v.mutateAsync({planId:P,items:G}),Qe())},qe=ct=>{var it;F(ct.id),U(ct.name),W(ct.description||""),Q(((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)},Qe=()=>{T(!1),F(null),U(""),W(""),Q([])},rt=(ct,it)=>{se(it)},je=(ct,it,zt)=>{Q(ir=>[...ir.filter(Zr=>Zr.month_number!==ct),{month_number:ct,action_type_id:it,default_script_id:zt}]),oe(null),se(null)},ut=ct=>{Q(it=>it.filter(zt=>zt.month_number!==ct))},Ce=async()=>{if(!me.trim()||!xe.trim()||!de)return;const ct=await b.mutateAsync({actionTypeId:de,title:me,scriptBody:xe,emailSubject:be||void 0,tone:ve||void 0});ct&&ae!==null&&je(ae,de,ct.id),ne(!1),he(""),Te(""),we(""),et("")},Ee=de?i==null?void 0:i.filter(ct=>ct.action_type_id===de&&ct.active):[],Ye=ct=>_Ce[ct||"Phone"]||Ii,Le=ct=>_Ce[ct||"Users"]||qn;return r.jsxs(Dr,{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(X,{variant:"ghost",size:"sm",onClick:()=>e("/mission-control"),children:[r.jsx(kc,{className:"h-4 w-4 mr-1"}),"Back"]}),r.jsxs(X,{onClick:()=>T(!0),className:"w-full sm:w-auto",children:[r.jsx(bn,{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,ir=Ie(ct.id),Mr=s==null?void 0:s.find(Br=>Br.id===(ir==null?void 0:ir.plan_id)),Zr=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 ${Zr?"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"]})]}),Mr?r.jsxs(Tt,{variant:"secondary",className:"text-xs",children:[r.jsx(li,{className:"h-3 w-3 mr-1"}),Mr.name.split(" ")[0]]}):r.jsx(Tt,{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(kn,{children:["Choose a plan for your ",ot.name," contacts"]})]}),r.jsxs(Je,{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(li,{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(X,{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(Ts,{className:"h-4 w-4"}),"12-Month Schedule"]}),r.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-6 gap-2",children:Bde.map((ct,it)=>{var Zr,Br;const zt=((Zr=Oe.items)==null?void 0:Zr.filter(rn=>rn.month_number===it+1))||[],ir=(Br=zt[0])==null?void 0:Br.action_type,Mr=ir?Ye(ir.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}),Mr&&r.jsx(Mr,{className:"h-4 w-4 mx-auto mt-1",style:{color:(ir==null?void 0:ir.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(X,{size:"sm",variant:"ghost",title:"Duplicate as my own plan",disabled:N.isPending,onClick:()=>{const ir=`${ct.name} (Copy)`;N.mutate({sourcePlanId:ct.id,newName:ir})},children:r.jsx(Oo,{className:"h-4 w-4"})}),r.jsx(X,{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(X,{size:"sm",variant:"ghost",title:"Edit plan",onClick:()=>qe(ct),children:r.jsx(Y0,{className:"h-4 w-4"})}),r.jsx(X,{size:"sm",variant:"ghost",title:"Delete plan",onClick:()=>y.mutate(ct.id),children:r.jsx(Un,{className:"h-4 w-4 text-destructive"})}),r.jsx(X,{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(Je,{className:"py-12 text-center text-muted-foreground",children:[r.jsx(Ts,{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(Je,{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(Or,{open:I,onOpenChange:ct=>{ct?T(!0):Qe()},children:r.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Fr,{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(Xn,{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:Bde.map((ct,it)=>{const zt=it+1,ir=G.find(Br=>Br.month_number===zt),Mr=ir?l==null?void 0:l.find(Br=>Br.id===ir.action_type_id):null,Zr=Mr?Ye(Mr.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 ${ir?"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}),Zr?r.jsx(Zr,{className:"h-5 w-5 mx-auto mt-1",style:{color:(Mr==null?void 0:Mr.color)||"#3B82F6"}}):r.jsx(bn,{className:"h-5 w-5 mx-auto mt-1 text-muted-foreground/50"})]}),ir&&r.jsx("button",{type:"button",onClick:Br=>{Br.stopPropagation(),ut(zt)},className:"absolute -top-1 -right-1 p-1 bg-destructive text-destructive-foreground rounded-full",children:r.jsx(us,{className:"h-3 w-3"})})]},it)})}),ae!==null&&!de&&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 ",Bde[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=Ye(ct.icon);return r.jsxs("button",{type:"button",onClick:()=>rt(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&&de&&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(X,{variant:"ghost",size:"sm",onClick:()=>se(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,de),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,de,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(Tt,{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:()=>ne(!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(bn,{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(Hs,{children:[r.jsx(X,{variant:"outline",onClick:Qe,children:"Cancel"}),r.jsxs(X,{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(Or,{open:pe,onOpenChange:ne,children:r.jsxs(Lr,{className:"max-w-lg",children:[r.jsx(zr,{children:r.jsx(Fr,{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=>he(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(hn,{value:ve,onValueChange:et,children:[r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select tone..."})}),r.jsxs(dn,{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===de))==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:be,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(Xn,{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(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>ne(!1),children:"Cancel"}),r.jsxs(X,{onClick:Ce,disabled:!me.trim()||!xe.trim()||b.isPending,children:[r.jsx(Ip,{className:"h-4 w-4 mr-2"}),"Create & Use Script"]})]})]})})]})}const o5t="0dde5abb-0005-4c8c-a471-30d0cbc9e280",l5t=[{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 c5t(){const e=Wn(),t=vBe(),{data:n}=gBe(),{data:s}=qp(),{data:a}=Y0e(),{data:o}=qae(90),{data:l}=Nf(),i=E3t(),u=_Be(),m=T3t(),x=A3t(),{data:y=[],isLoading:v}=Zt({queryKey:["popby-templates"],queryFn:async()=>{const{data:pe,error:ne}=await Y.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).eq("category_id",o5t).order("publish_date",{ascending:!1});if(ne)throw ne;const{data:me}=await Y.from("template_likes").select("template_id"),{data:he}=await Y.from("template_comments").select("template_id"),xe=new Map;me==null||me.forEach(be=>{xe.set(be.template_id,(xe.get(be.template_id)||0)+1)});const Te=new Map;return he==null||he.forEach(be=>{Te.set(be.template_id,(Te.get(be.template_id)||0)+1)}),(pe||[]).map(be=>({...be,likesCount:xe.get(be.id)||0,commentsCount:Te.get(be.id)||0}))}}),b=pe=>{const ne=l==null?void 0:l.find(me=>me.id===pe);return ne?`${ne.first_name} ${ne.last_name||""}`.trim():"Unknown"},N=pe=>{if(!pe)return null;const ne=n==null?void 0:n.find(me=>me.id===pe);return(ne==null?void 0:ne.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,Q]=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),Q({name:"",description:""}))},de=async(pe,ne)=>{await x.mutateAsync({relationship_type_id:pe,frequency_days:parseInt(ne)})},se=pe=>{var me;const ne=a==null?void 0:a.find(he=>he.relationship_type_id===pe);return((me=ne==null?void 0:ne.frequency_days)==null?void 0:me.toString())||"90"};return r.jsx(Dr,{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(Je,{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(Je,{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(Je,{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(X,{onClick:()=>e("/mission-control/popbys/map"),children:[r.jsx(Fo,{className:"h-4 w-4 mr-2"}),"View Map"]}),r.jsxs(X,{variant:"outline",onClick:()=>F(!0),children:[r.jsx(Bd,{className:"h-4 w-4 mr-2"}),"Frequency Settings"]}),r.jsxs(X,{variant:"outline",onClick:()=>U(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Popby Idea"]})]}),r.jsxs(ki,{defaultValue:"due",children:[r.jsxs(wi,{children:[r.jsx(an,{value:"due",children:"Due for Popby"}),r.jsx(an,{value:"activity",children:"Recent Activity"}),r.jsx(an,{value:"library",children:"Popby Library"}),r.jsx(an,{value:"templates",children:"Popby Templates"})]}),r.jsx(Cn,{value:"due",className:"space-y-4 mt-4",children:!t||t.length===0?r.jsx(He,{children:r.jsxs(Je,{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(pe=>r.jsx(He,{className:"hover:shadow-md transition-shadow",children:r.jsx(Je,{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:[pe.first_name," ",pe.last_name]}),pe.daysOverdue>0&&r.jsxs(Tt,{variant:"destructive",className:"text-xs",children:[pe.daysOverdue,"+ days overdue"]}),pe.daysSinceLastPopby===null&&r.jsx(Tt,{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:[pe.address&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Fo,{className:"h-3 w-3"}),pe.city||pe.address]}),pe.tags&&pe.tags.length>0&&r.jsx("span",{children:pe.tags.map(ne=>{var me;return(me=ne.relationship_type)==null?void 0:me.name}).join(", ")})]}),pe.lastPopby&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Last popby: ",ln(new Date(pe.lastPopby),"MMM d, yyyy")]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[pe.phone&&r.jsx(X,{size:"sm",variant:"ghost",asChild:!0,children:r.jsx("a",{href:`tel:${pe.phone}`,children:r.jsx(Ii,{className:"h-4 w-4"})})}),r.jsxs(X,{size:"sm",onClick:()=>{M(pe),T(!0)},children:[r.jsx(li,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})})},pe.id))})}),r.jsx(Cn,{value:"activity",className:"space-y-4 mt-4",children:!o||o.length===0?r.jsx(He,{children:r.jsxs(Je,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(Qa,{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(Je,{className:"space-y-3",children:o.map(pe=>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(pe.contact_id)}),N(pe.popby_item_id)&&r.jsx(Tt,{variant:"secondary",className:"text-xs",children:N(pe.popby_item_id)})]}),r.jsx("div",{className:"text-sm text-muted-foreground",children:ln(new Date(pe.completed_at),"MMM d, yyyy h:mm a")}),pe.notes&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:pe.notes})]})]},pe.id))})]})}),r.jsx(Cn,{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(pe=>r.jsx(He,{children:r.jsx(Je,{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:pe.name}),pe.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:pe.description}),!pe.owner_user_id&&r.jsx(Tt,{variant:"secondary",className:"mt-2 text-xs",children:"Shared"})]})]})})},pe.id)),r.jsx(He,{className:"border-dashed cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>U(!0),children:r.jsx(Je,{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(bn,{className:"h-8 w-8 mx-auto mb-2"}),r.jsx("p",{children:"Add New Popby Idea"})]})})})]})}),r.jsxs(Cn,{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((pe,ne)=>r.jsx(He,{children:r.jsxs(Je,{className:"p-4",children:[r.jsx(Tr,{className:"aspect-[3/2] w-full rounded-lg mb-4"}),r.jsx(Tr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Tr,{className:"h-4 w-full mb-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Tr,{className:"h-5 w-16"}),r.jsx(Tr,{className:"h-5 w-20"})]})]})},ne))}),!v&&y.length===0&&r.jsx(He,{children:r.jsxs(Je,{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(pe=>r.jsxs(He,{className:"group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer",onClick:()=>e(`/templates/${pe.id}`),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:pe.preview_image_url?r.jsx("img",{src:pe.preview_image_url,alt:pe.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(Je,{className:"p-4 flex flex-col",children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:pe.name}),pe.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:yse(pe.description)}),r.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:r.jsx(Tt,{variant:"secondary",className:"text-xs",children:"PopBys"})}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(pd,{className:"h-3.5 w-3.5"}),pe.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ul,{className:"h-3.5 w-3.5"}),pe.commentsCount]})]}),r.jsxs(X,{size:"sm",className:"w-full gap-2",onClick:ne=>{ne.stopPropagation(),e(`/templates/${pe.id}`)},children:[r.jsx(Ms,{className:"h-4 w-4"}),"View Template"]})]})]},pe.id))})]})]}),r.jsx(Or,{open:I,onOpenChange:T,children:r.jsxs(Lr,{children:[r.jsx(zr,{children:r.jsxs(Fr,{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(hn,{value:V.popby_item_id,onValueChange:pe=>W(ne=>({...ne,popby_item_id:pe})),children:[r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select a popby item..."})}),r.jsx(dn,{children:n==null?void 0:n.map(pe=>r.jsx($t,{value:pe.id,children:pe.name},pe.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Notes (optional)"}),r.jsx(Xn,{placeholder:"Any notes about this popby...",value:V.notes,onChange:pe=>W(ne=>({...ne,notes:pe.target.value}))})]})]}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>T(!1),children:"Cancel"}),r.jsx(X,{onClick:ae,disabled:u.isPending,children:"Log Popby"})]})]})}),r.jsx(Or,{open:P,onOpenChange:F,children:r.jsxs(Lr,{className:"max-w-md",children:[r.jsx(zr,{children:r.jsx(Fr,{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(pe=>r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsx(ze,{className:"font-medium",children:pe.name}),r.jsxs(hn,{value:se(pe.id),onValueChange:ne=>de(pe.id,ne),children:[r.jsx(cn,{className:"w-[180px]",children:r.jsx(fn,{})}),r.jsx(dn,{children:l5t.map(ne=>r.jsx($t,{value:ne.value,children:ne.label},ne.value))})]})]},pe.id))]}),r.jsx(Hs,{children:r.jsx(X,{onClick:()=>F(!1),children:"Done"})})]})}),r.jsx(Or,{open:D,onOpenChange:U,children:r.jsxs(Lr,{children:[r.jsx(zr,{children:r.jsx(Fr,{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:pe=>Q(ne=>({...ne,name:pe.target.value}))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Description"}),r.jsx(Xn,{placeholder:"Optional description...",value:G.description,onChange:pe=>Q(ne=>({...ne,description:pe.target.value}))})]})]}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>U(!1),children:"Cancel"}),r.jsx(X,{onClick:oe,disabled:!G.name.trim()||m.isPending,children:"Add Item"})]})]})})]})})}function d5t(){const e=Wn(),{isAdmin:t}=tn(),n=A.useRef(null),s=A.useRef(null),a=A.useRef([]),o=yBe(),{data:l}=gBe(),i=_Be(),[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(Q=>Q.address||Q.city&&Q.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(Q=>{k([Q.coords.longitude,Q.coords.latitude])},Q=>{console.log("Could not get location:",Q)})},[]),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 Q;(Q=s.current)==null||Q.remove(),s.current=null}},[u,N]),A.useEffect(()=>{!s.current||!u||(a.current.forEach(Q=>Q.remove()),a.current=[],U.forEach(async Q=>{var oe;const ae=[Q.address,Q.city,Q.state,Q.zip].filter(Boolean).join(", ");if(ae)try{const se=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(ae)}.json?access_token=${u}`)).json();if(se.features&&se.features.length>0){const[pe,ne]=se.features[0].center,me=document.createElement("div");me.className="cursor-pointer",me.innerHTML=`
${Q.first_name[0]}${((oe=Q.last_name)==null?void 0:oe[0])||""}
${Q.isDue?'
':""}
`;const he=new rc.Marker(me).setLngLat([pe,ne]).addTo(s.current);me.addEventListener("click",()=>{I(Q)}),a.current.push(he)}}catch(de){console.error("Geocoding error for",Q.first_name,de)}}))},[U,u]);const V=()=>{N&&s.current?s.current.flyTo({center:N,zoom:13}):Ca({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()),Ca({title:"Mapbox token saved!"})}catch{Ca({title:"Error saving token",variant:"destructive"})}};return v?r.jsx(Dr,{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(Dr,{title:"Popby Map",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(X,{variant:"ghost",onClick:()=>e("/mission-control/popbys"),children:[r.jsx(Wi,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]}),r.jsxs(X,{onClick:V,children:[r.jsx(dA,{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(Je,{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(X,{size:"sm",variant:"ghost",onClick:()=>I(null),children:"×"})]}),r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[M.isDue?r.jsxs(Tt,{variant:"destructive",children:[M.daysOverdue,"+ days overdue"]}):r.jsx(Tt,{variant:"secondary",children:"Up to date"}),M.lastPopby&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last: ",ln(new Date(M.lastPopby),"MMM d")]})]}),r.jsxs("div",{className:"flex gap-2",children:[M.phone&&r.jsx(X,{size:"sm",variant:"outline",asChild:!0,className:"flex-1",children:r.jsxs("a",{href:`tel:${M.phone}`,children:[r.jsx(Ii,{className:"h-4 w-4 mr-1"}),"Call"]})}),M.address&&r.jsxs(X,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>{const Q=[M.address,M.city,M.state,M.zip].filter(Boolean).join(", ");window.open(`https://maps.google.com/maps?daddr=${encodeURIComponent(Q)}`,"_blank")},children:[r.jsx(xA,{className:"h-4 w-4 mr-1"}),"Navigate"]}),r.jsxs(X,{size:"sm",className:"flex-1",onClick:()=>P(!0),children:[r.jsx(ao,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})}),r.jsx(Or,{open:T,onOpenChange:P,children:r.jsxs(Lr,{children:[r.jsx(zr,{children:r.jsxs(Fr,{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(hn,{value:F.popby_item_id,onValueChange:Q=>D(ae=>({...ae,popby_item_id:Q})),children:[r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select a popby item..."})}),r.jsx(dn,{children:l==null?void 0:l.map(Q=>r.jsx($t,{value:Q.id,children:Q.name},Q.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Notes (optional)"}),r.jsx(Xn,{placeholder:"Any notes about this popby...",value:F.notes,onChange:Q=>D(ae=>({...ae,notes:Q.target.value}))})]}),N&&r.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(Fo,{className:"h-3 w-3"}),"Your current location will be recorded"]})]}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>P(!1),children:"Cancel"}),r.jsxs(X,{onClick:W,disabled:i.isPending,children:[r.jsx(li,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})})]})}):t?r.jsx(Dr,{title:"Popby Map",children:r.jsx("div",{className:"max-w-md mx-auto mt-8",children:r.jsx(He,{children:r.jsxs(Je,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"text-center mb-4",children:[r.jsx(Fo,{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:Q=>y(Q.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(X,{onClick:G,className:"w-full",children:"Save Token"}),r.jsxs(X,{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(Dr,{title:"Popby Map",children:r.jsx("div",{className:"max-w-md mx-auto mt-8",children:r.jsx(He,{children:r.jsxs(Je,{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(X,{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 u5t=P3({property_address:xc().min(1,"Property address is required"),city:xc().optional(),state:xc().optional(),zip:xc().optional(),transaction_type:DDe(["buyer","seller"]),close_date:xc().min(1,"Close date is required"),sale_price:FA().min(0,"Sale price must be positive"),commission_amount:FA().optional(),lead_source_id:xc().optional(),client_type_id:xc().optional(),contact_id:xc().optional(),notes:xc().optional(),is_win:Jdt()});function SBe({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=hae(),v=oxt(),{data:b}=uae(),{data:N}=qp(),{data:k}=Nf(),M=Lye(),I=ixt(),{data:T}=mae(),P=(T==null?void 0:T.show_commission)??!0,F=Jse({resolver:eae(u5t),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 Q={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,...Q}):await y.mutateAsync(Q),t(!1)},U=async()=>{if(!o.trim())return;const[G,...Q]=o.trim().split(" "),ae=Q.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(Or,{open:e,onOpenChange:t,children:r.jsxs(Lr,{className:"max-w-lg max-h-[90vh]",children:[r.jsx(zr,{children:r.jsx(Fr,{children:n?"Edit Transaction":"Add Transaction"})}),r.jsx(Zo,{className:"max-h-[70vh] pr-4",children:r.jsx(tae,{...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(Ku,{})]})}),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(hn,{onValueChange:G.onChange,value:G.value,children:[r.jsx(Ml,{children:r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select type"})})}),r.jsxs(dn,{children:[r.jsx($t,{value:"buyer",children:"Buyer"}),r.jsx($t,{value:"seller",children:"Seller"})]})]}),r.jsx(Ku,{})]})}),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(Ku,{})]})}),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:Q=>G.onChange(Number(Q.target.value))})}),r.jsx(Ku,{})]})})]}),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:Q=>G.onChange(Q.target.value?Number(Q.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(hn,{onValueChange:G.onChange,value:G.value||"",children:[r.jsx(Ml,{children:r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select source"})})}),r.jsx(dn,{children:b==null?void 0:b.map(Q=>r.jsx($t,{value:Q.id,children:Q.name},Q.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(X,{type:"button",variant:"outline",size:"icon",onClick:V,disabled:!m.trim(),children:r.jsx(bn,{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(hn,{onValueChange:G.onChange,value:G.value||"",children:[r.jsx(Ml,{children:r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select client type"})})}),r.jsx(dn,{children:N==null?void 0:N.map(Q=>r.jsx($t,{value:Q.id,children:Q.name},Q.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(X,{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(Ly,{children:[r.jsx(Oy,{placeholder:"Search contacts..."}),r.jsxs(Dy,{children:[r.jsx(Ry,{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(X,{variant:"outline",size:"sm",className:"w-full",onClick:()=>u(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add New Contact"]})]})}),r.jsx(Fy,{children:k==null?void 0:k.map(Q=>r.jsxs(zy,{value:`${Q.first_name} ${Q.last_name||""}`,onSelect:()=>{G.onChange(Q.id),a(!1)},children:[r.jsx(fi,{className:Ut("mr-2 h-4 w-4",Q.id===G.value?"opacity-100":"opacity-0")}),Q.first_name," ",Q.last_name||""]},Q.id))})]})]}),i&&r.jsxs("div",{className:"p-2 border-t space-y-2",children:[r.jsx(lt,{placeholder:"Enter contact name...",value:o,onChange:Q=>l(Q.target.value)}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(X,{size:"sm",onClick:U,disabled:!o.trim()||M.isPending,children:"Add Contact"}),r.jsx(X,{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(Xn,{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(Is,{checked:G.value,onCheckedChange:G.onChange})})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(X,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsxs(X,{type:"submit",disabled:y.isPending||v.isPending,children:[n?"Update":"Add"," Transaction"]})]})]})})})]})})}function CBe({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=lxt(),T=hae(),{data:P}=uae(),{data:F}=qp(),D=$3(),U=G=>{const{id:Q,created_at:ae,updated_at:oe,lead_source:de,client_type:se,contact:pe,...ne}=G;T.mutate(ne)},V=()=>{o&&(I.mutate(o),l(null))},W=e.filter(G=>{var pe,ne,me,he;const Q=i===""||G.property_address.toLowerCase().includes(i.toLowerCase())||((ne=(pe=G.contact)==null?void 0:pe.first_name)==null?void 0:ne.toLowerCase().includes(i.toLowerCase()))||((he=(me=G.contact)==null?void 0:me.last_name)==null?void 0:he.toLowerCase().includes(i.toLowerCase())),ae=m==="all"||G.transaction_type===m,oe=y==="all"||G.lead_source_id===y,de=b==="all"||G.client_type_id===b,se=!k||G.is_win;return Q&&ae&&oe&&de&&se});return n?r.jsx(He,{children:r.jsx(Je,{className:"p-6 space-y-4",children:[1,2,3].map(G=>r.jsx(Tr,{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(hn,{value:m,onValueChange:x,children:[r.jsx(cn,{className:"w-[100px]",children:r.jsx(fn,{placeholder:"Type"})}),r.jsxs(dn,{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(hn,{value:y,onValueChange:v,children:[r.jsx(cn,{className:"w-[130px]",children:r.jsx(fn,{placeholder:"Lead Source"})}),r.jsxs(dn,{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(X,{variant:k?"default":"outline",size:"sm",onClick:()=>M(!k),children:[r.jsx(Bl,{className:"h-4 w-4 mr-1"}),"Wins"]})]})]})}),r.jsx(Je,{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(Tt,{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: "}),kje(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(X,{variant:"ghost",size:"sm",onClick:()=>a(G),children:r.jsx(gc,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>U(G),children:r.jsx(Oo,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>l(G.id),children:r.jsx(Un,{className:"h-4 w-4 text-destructive"})})]})]},G.id))}):r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:W.map(G=>{var Q;return r.jsxs(Nr,{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(Tt,{variant:G.transaction_type==="buyer"?"default":"secondary",children:G.transaction_type})}),r.jsx(yt,{children:kje(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:((Q=G.lead_source)==null?void 0:Q.name)||"-"}),r.jsx(yt,{children:G.contact?`${G.contact.first_name} ${G.contact.last_name||""}`.trim():"-"}),r.jsx(yt,{children:r.jsxs(dh,{children:[r.jsx(uh,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",children:r.jsx(kg,{className:"h-4 w-4"})})}),r.jsxs(Nu,{align:"end",children:[r.jsxs(Ha,{onClick:()=>a(G),children:[r.jsx(gc,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(Ha,{onClick:()=>U(G),children:[r.jsx(Oo,{className:"h-4 w-4 mr-2"}),"Duplicate"]}),r.jsxs(Ha,{onClick:()=>l(G.id),className:"text-destructive",children:[r.jsx(Un,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},G.id)})})]})})})]}),r.jsx(SBe,{open:!!s,onOpenChange:G=>!G&&a(null),transaction:s||void 0}),r.jsx(Ld,{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 MBe({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(Tt,{className:"bg-green-500 text-white",children:[r.jsx(rh,{className:"h-3 w-3 mr-1"}),"Ahead"]});case"on-track":return r.jsxs(Tt,{variant:"secondary",children:[r.jsx(K1,{className:"h-3 w-3 mr-1"}),"On Track"]});case"behind":return r.jsxs(Tt,{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(yy,{className:"h-5 w-5 text-primary"}),r.jsxs(Gt,{children:[n," Goals Progress"]})]})}),r.jsx(Je,{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 h5t=Array.isArray,Uh=h5t,m5t=typeof Qx=="object"&&Qx&&Qx.Object===Object&&Qx,TBe=m5t,f5t=TBe,p5t=typeof self=="object"&&self&&self.Object===Object&&self,g5t=f5t||p5t||Function("return this")(),cx=g5t,x5t=cx,y5t=x5t.Symbol,SP=y5t,bCe=SP,ABe=Object.prototype,v5t=ABe.hasOwnProperty,_5t=ABe.toString,xT=bCe?bCe.toStringTag:void 0;function b5t(e){var t=v5t.call(e,xT),n=e[xT];try{e[xT]=void 0;var s=!0}catch{}var a=_5t.call(e);return s&&(t?e[xT]=n:delete e[xT]),a}var w5t=b5t,j5t=Object.prototype,k5t=j5t.toString;function N5t(e){return k5t.call(e)}var S5t=N5t,wCe=SP,C5t=w5t,M5t=S5t,T5t="[object Null]",A5t="[object Undefined]",jCe=wCe?wCe.toStringTag:void 0;function E5t(e){return e==null?e===void 0?A5t:T5t:jCe&&jCe in Object(e)?C5t(e):M5t(e)}var Wy=E5t;function I5t(e){return e!=null&&typeof e=="object"}var Gy=I5t,P5t=Wy,L5t=Gy,O5t="[object Symbol]";function D5t(e){return typeof e=="symbol"||L5t(e)&&P5t(e)==O5t}var U3=D5t,R5t=Uh,F5t=U3,z5t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,B5t=/^\w*$/;function $5t(e,t){if(R5t(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||F5t(e)?!0:B5t.test(e)||!z5t.test(e)||t!=null&&e in Object(t)}var J0e=$5t;function U5t(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Pv=U5t;const q3=eo(Pv);var q5t=Wy,V5t=Pv,H5t="[object AsyncFunction]",W5t="[object Function]",G5t="[object GeneratorFunction]",K5t="[object Proxy]";function Z5t(e){if(!V5t(e))return!1;var t=q5t(e);return t==W5t||t==G5t||t==H5t||t==K5t}var e1e=Z5t;const Ya=eo(e1e);var Y5t=cx,X5t=Y5t["__core-js_shared__"],Q5t=X5t,$de=Q5t,kCe=function(){var e=/[^.]+$/.exec($de&&$de.keys&&$de.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function J5t(e){return!!kCe&&kCe in e}var eMt=J5t,tMt=Function.prototype,rMt=tMt.toString;function nMt(e){if(e!=null){try{return rMt.call(e)}catch{}try{return e+""}catch{}}return""}var EBe=nMt,sMt=e1e,aMt=eMt,iMt=Pv,oMt=EBe,lMt=/[\\^$.*+?()[\]{}|]/g,cMt=/^\[object .+?Constructor\]$/,dMt=Function.prototype,uMt=Object.prototype,hMt=dMt.toString,mMt=uMt.hasOwnProperty,fMt=RegExp("^"+hMt.call(mMt).replace(lMt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function pMt(e){if(!iMt(e)||aMt(e))return!1;var t=sMt(e)?fMt:cMt;return t.test(oMt(e))}var gMt=pMt;function xMt(e,t){return e==null?void 0:e[t]}var yMt=xMt,vMt=gMt,_Mt=yMt;function bMt(e,t){var n=_Mt(e,t);return vMt(n)?n:void 0}var Ik=bMt,wMt=Ik,jMt=wMt(Object,"create"),Vae=jMt,NCe=Vae;function kMt(){this.__data__=NCe?NCe(null):{},this.size=0}var NMt=kMt;function SMt(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var CMt=SMt,MMt=Vae,TMt="__lodash_hash_undefined__",AMt=Object.prototype,EMt=AMt.hasOwnProperty;function IMt(e){var t=this.__data__;if(MMt){var n=t[e];return n===TMt?void 0:n}return EMt.call(t,e)?t[e]:void 0}var PMt=IMt,LMt=Vae,OMt=Object.prototype,DMt=OMt.hasOwnProperty;function RMt(e){var t=this.__data__;return LMt?t[e]!==void 0:DMt.call(t,e)}var FMt=RMt,zMt=Vae,BMt="__lodash_hash_undefined__";function $Mt(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=zMt&&t===void 0?BMt:t,this}var UMt=$Mt,qMt=NMt,VMt=CMt,HMt=PMt,WMt=FMt,GMt=UMt;function V3(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t-1}var dTt=cTt,uTt=Hae;function hTt(e,t){var n=this.__data__,s=uTt(n,e);return s<0?(++this.size,n.push([e,t])):n[s][1]=t,this}var mTt=hTt,fTt=YMt,pTt=sTt,gTt=oTt,xTt=dTt,yTt=mTt;function H3(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},Fn=function(t){return FAt(t)&&!CP(t)},UAt=function(t){return Ei(t)},fd=function(t){return Fn(t)||yk(t)},qAt=0,MP=function(t){var n=++qAt;return"".concat(t||"").concat(n)},Xu=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(!Fn(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 CP(o)&&(o=s),a&&o>n&&(o=n),o},m1=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},VAt=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 XAt(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 ICe={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"},wy=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},PCe=null,qde=null,d1e=function e(t){if(t===PCe&&Array.isArray(qde))return qde;var n=[];return A.Children.forEach(t,function(s){Ei(s)||(PAt.isFragment(s)?n=n.concat(e(s.props.children)):n.push(s))}),qde=n,PCe=t,n};function yf(e,t){var n=[],s=[];return Array.isArray(t)?s=t.map(function(a){return wy(a)}):s=[wy(t)],d1e(e).forEach(function(a){var o=jm(a,"type.displayName")||jm(a,"type.name");s.indexOf(o)!==-1&&n.push(a)}),n}function sm(e,t){var n=yf(e,t);return n&&n[0]}var LCe=function(t){if(!t||!t.props)return!1;var n=t.props,s=n.width,a=n.height;return!(!Fn(s)||s<=0||!Fn(a)||a<=0)},QAt=["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"],JAt=function(t){return t&&t.type&&yk(t.type)&&QAt.indexOf(t.type)>=0},eEt=function(t,n,s,a){var o,l=(o=Ude==null?void 0:Ude[a])!==null&&o!==void 0?o:[];return n.startsWith("data-")||!Ya(t)&&(a&&l.includes(n)||GAt.includes(n))||s&&c1e.includes(n)},Ua=function(t,n,s){if(!t||typeof t=="function"||typeof t=="boolean")return null;var a=t;if(A.isValidElement(t)&&(a=t.props),!q3(a))return null;var o={};return Object.keys(a).forEach(function(l){var i;eEt((i=a)===null||i===void 0?void 0:i[l],l,n,s)&&(o[l]=a[l])}),o},Nfe=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 OCe(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 aEt(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 Cfe(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=sEt(e,nEt),x=a||{width:n,height:s,x:0,y:0},y=hi("recharts-surface",o);return dt.createElement("svg",Sfe({},Ua(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 iEt=["children","className"];function Mfe(){return Mfe=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 lEt(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 Lo=dt.forwardRef(function(e,t){var n=e.children,s=e.className,a=oEt(e,iEt),o=hi("recharts-layer",s);return dt.createElement("g",Mfe({className:o},Ua(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:uEt(e,t,n)}var mEt=hEt,fEt="\\ud800-\\udfff",pEt="\\u0300-\\u036f",gEt="\\ufe20-\\ufe2f",xEt="\\u20d0-\\u20ff",yEt=pEt+gEt+xEt,vEt="\\ufe0e\\ufe0f",_Et="\\u200d",bEt=RegExp("["+_Et+fEt+yEt+vEt+"]");function wEt(e){return bEt.test(e)}var $Be=wEt;function jEt(e){return e.split("")}var kEt=jEt,UBe="\\ud800-\\udfff",NEt="\\u0300-\\u036f",SEt="\\ufe20-\\ufe2f",CEt="\\u20d0-\\u20ff",MEt=NEt+SEt+CEt,TEt="\\ufe0e\\ufe0f",AEt="["+UBe+"]",Tfe="["+MEt+"]",Afe="\\ud83c[\\udffb-\\udfff]",EEt="(?:"+Tfe+"|"+Afe+")",qBe="[^"+UBe+"]",VBe="(?:\\ud83c[\\udde6-\\uddff]){2}",HBe="[\\ud800-\\udbff][\\udc00-\\udfff]",IEt="\\u200d",WBe=EEt+"?",GBe="["+TEt+"]?",PEt="(?:"+IEt+"(?:"+[qBe,VBe,HBe].join("|")+")"+GBe+WBe+")*",LEt=GBe+WBe+PEt,OEt="(?:"+[qBe+Tfe+"?",Tfe,VBe,HBe,AEt].join("|")+")",DEt=RegExp(Afe+"(?="+Afe+")|"+OEt+LEt,"g");function REt(e){return e.match(DEt)||[]}var FEt=REt,zEt=kEt,BEt=$Be,$Et=FEt;function UEt(e){return BEt(e)?$Et(e):zEt(e)}var qEt=UEt,VEt=mEt,HEt=$Be,WEt=qEt,GEt=OBe;function KEt(e){return function(t){t=GEt(t);var n=HEt(t)?WEt(t):void 0,s=n?n[0]:t.charAt(0),a=n?VEt(n,1).join(""):t.slice(1);return s[e]()+a}}var ZEt=KEt,YEt=ZEt,XEt=YEt("toUpperCase"),QEt=XEt;const aie=eo(QEt);function al(e){return function(){return e}}const KBe=Math.cos,rne=Math.sin,Wp=Math.sqrt,nne=Math.PI,iie=2*nne,Efe=Math.PI,Ife=2*Efe,Kw=1e-6,JEt=Ife-Kw;function ZBe(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return ZBe;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((Efe-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%Ife+Ife),v>JEt?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>=Efe)},${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 u1e(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 tIt(t)}function h1e(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function YBe(e){this._context=e}YBe.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 oie(e){return new YBe(e)}function XBe(e){return e[0]}function QBe(e){return e[1]}function JBe(e,t){var n=al(!0),s=null,a=oie,o=null,l=u1e(i);e=typeof e=="function"?e:e===void 0?XBe:al(e),t=typeof t=="function"?t:t===void 0?QBe:al(t);function i(u){var m,x=(u=h1e(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 JBe().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 e$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 rIt(e){return new e$e(e,!0)}function nIt(e){return new e$e(e,!1)}const m1e={draw(e,t){const n=Wp(t/nne);e.moveTo(n,0),e.arc(0,0,n,0,iie)}},sIt={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()}},t$e=Wp(1/3),aIt=t$e*2,iIt={draw(e,t){const n=Wp(t/aIt),s=n*t$e;e.moveTo(0,-n),e.lineTo(s,0),e.lineTo(0,n),e.lineTo(-s,0),e.closePath()}},oIt={draw(e,t){const n=Wp(t),s=-n/2;e.rect(s,s,n,n)}},lIt=.8908130915292852,r$e=rne(nne/10)/rne(7*nne/10),cIt=rne(iie/10)*r$e,dIt=-KBe(iie/10)*r$e,uIt={draw(e,t){const n=Wp(t*lIt),s=cIt*n,a=dIt*n;e.moveTo(0,-n),e.lineTo(s,a);for(let o=1;o<5;++o){const l=iie*o/5,i=KBe(l),u=rne(l);e.lineTo(u*n,-i*n),e.lineTo(i*s-u*a,u*s+i*a)}e.closePath()}},Vde=Wp(3),hIt={draw(e,t){const n=-Wp(t/(Vde*3));e.moveTo(0,n*2),e.lineTo(-Vde*n,-n),e.lineTo(Vde*n,-n),e.closePath()}},Wm=-.5,Gm=Wp(3)/2,Pfe=1/Wp(12),mIt=(Pfe/2+1)*3,fIt={draw(e,t){const n=Wp(t/mIt),s=n/2,a=n*Pfe,o=s,l=n*Pfe+n,i=-o,u=l;e.moveTo(s,a),e.lineTo(o,l),e.lineTo(i,u),e.lineTo(Wm*s-Gm*a,Gm*s+Wm*a),e.lineTo(Wm*o-Gm*l,Gm*o+Wm*l),e.lineTo(Wm*i-Gm*u,Gm*i+Wm*u),e.lineTo(Wm*s+Gm*a,Wm*a-Gm*s),e.lineTo(Wm*o+Gm*l,Wm*l-Gm*o),e.lineTo(Wm*i+Gm*u,Wm*u-Gm*i),e.closePath()}};function pIt(e,t){let n=null,s=u1e(a);e=typeof e=="function"?e:al(e||m1e),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 sne(){}function ane(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 n$e(e){this._context=e}n$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:ane(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:ane(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function gIt(e){return new n$e(e)}function s$e(e){this._context=e}s$e.prototype={areaStart:sne,areaEnd:sne,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:ane(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function xIt(e){return new s$e(e)}function a$e(e){this._context=e}a$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:ane(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function yIt(e){return new a$e(e)}function i$e(e){this._context=e}i$e.prototype={areaStart:sne,areaEnd:sne,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 vIt(e){return new i$e(e)}function RCe(e){return e<0?-1:1}function FCe(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(RCe(o)+RCe(l))*Math.min(Math.abs(o),Math.abs(l),.5*Math.abs(i))||0}function zCe(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Hde(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 ine(e){this._context=e}ine.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:Hde(this,this._t0,zCe(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,Hde(this,zCe(this,n=FCe(this,e,t)),n);break;default:Hde(this,this._t0,n=FCe(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function o$e(e){this._context=new l$e(e)}(o$e.prototype=Object.create(ine.prototype)).point=function(e,t){ine.prototype.point.call(this,t,e)};function l$e(e){this._context=e}l$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 _It(e){return new ine(e)}function bIt(e){return new o$e(e)}function c$e(e){this._context=e}c$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=BCe(e),a=BCe(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 jIt(e){return new lie(e,.5)}function kIt(e){return new lie(e,0)}function NIt(e){return new lie(e,1)}function VC(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 SIt(e,t){return e[t]}function CIt(e){const t=[];return t.key=e,t}function MIt(){var e=al([]),t=Lfe,n=VC,s=SIt;function a(o){var l=Array.from(e.apply(this,arguments),CIt),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 RIt(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 d$e={symbolCircle:m1e,symbolCross:sIt,symbolDiamond:iIt,symbolSquare:oIt,symbolStar:uIt,symbolTriangle:hIt,symbolWye:fIt},FIt=Math.PI/180,zIt=function(t){var n="symbol".concat(aie(t));return d$e[n]||m1e},BIt=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*FIt;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}},$It=function(t,n){d$e["symbol".concat(aie(t))]=n},f1e=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=DIt(t,IIt),m=UCe(UCe({},u),{},{type:s,size:o,sizeType:i}),x=function(){var M=zIt(s),I=pIt().type(M).size(BIt(o,i,s));return I()},y=m.className,v=m.cx,b=m.cy,N=Ua(m,!0);return v===+v&&b===+b&&o===+o?dt.createElement("path",Ofe({},N,{className:hi("recharts-symbols",y),transform:"translate(".concat(v,", ").concat(b,")"),d:x()})):null};f1e.registerSymbol=$It;function HC(e){"@babel/helpers - typeof";return HC=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},HC(e)}function Dfe(){return Dfe=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var T=b.inactive?m:b.color;return dt.createElement("li",Dfe({className:M,style:y,key:"legend-item-".concat(N)},vk(s.props,b,N)),dt.createElement(Cfe,{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);sI(p1e,"displayName","Legend");sI(p1e,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var XIt=Wae;function QIt(){this.__data__=new XIt,this.size=0}var JIt=QIt;function ePt(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var tPt=ePt;function rPt(e){return this.__data__.get(e)}var nPt=rPt;function sPt(e){return this.__data__.has(e)}var aPt=sPt,iPt=Wae,oPt=r1e,lPt=n1e,cPt=200;function dPt(e,t){var n=this.__data__;if(n instanceof iPt){var s=n.__data__;if(!oPt||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&IPt?new MPt:void 0;for(o.set(e,t),o.set(t,e);++y-1&&e%1==0&&e-1&&e%1==0&&e<=D6t}var v1e=R6t,F6t=Wy,z6t=v1e,B6t=Gy,$6t="[object Arguments]",U6t="[object Array]",q6t="[object Boolean]",V6t="[object Date]",H6t="[object Error]",W6t="[object Function]",G6t="[object Map]",K6t="[object Number]",Z6t="[object Object]",Y6t="[object RegExp]",X6t="[object Set]",Q6t="[object String]",J6t="[object WeakMap]",eLt="[object ArrayBuffer]",tLt="[object DataView]",rLt="[object Float32Array]",nLt="[object Float64Array]",sLt="[object Int8Array]",aLt="[object Int16Array]",iLt="[object Int32Array]",oLt="[object Uint8Array]",lLt="[object Uint8ClampedArray]",cLt="[object Uint16Array]",dLt="[object Uint32Array]",pl={};pl[rLt]=pl[nLt]=pl[sLt]=pl[aLt]=pl[iLt]=pl[oLt]=pl[lLt]=pl[cLt]=pl[dLt]=!0;pl[$6t]=pl[U6t]=pl[eLt]=pl[q6t]=pl[tLt]=pl[V6t]=pl[H6t]=pl[W6t]=pl[G6t]=pl[K6t]=pl[Z6t]=pl[Y6t]=pl[X6t]=pl[Q6t]=pl[J6t]=!1;function uLt(e){return B6t(e)&&z6t(e.length)&&!!pl[F6t(e)]}var hLt=uLt;function mLt(e){return function(t){return e(t)}}var b$e=mLt,dne={exports:{}};dne.exports;(function(e,t){var n=TBe,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})(dne,dne.exports);var fLt=dne.exports,pLt=hLt,gLt=b$e,ZCe=fLt,YCe=ZCe&&ZCe.isTypedArray,xLt=YCe?gLt(YCe):pLt,w$e=xLt,yLt=b6t,vLt=x1e,_Lt=Uh,bLt=_$e,wLt=y1e,jLt=w$e,kLt=Object.prototype,NLt=kLt.hasOwnProperty;function SLt(e,t){var n=_Lt(e),s=!n&&vLt(e),a=!n&&!s&&bLt(e),o=!n&&!s&&!a&&jLt(e),l=n||s||a||o,i=l?yLt(e.length,String):[],u=i.length;for(var m in e)(t||NLt.call(e,m))&&!(l&&(m=="length"||a&&(m=="offset"||m=="parent")||o&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||wLt(m,u)))&&i.push(m);return i}var CLt=SLt,MLt=Object.prototype;function TLt(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||MLt;return e===n}var ALt=TLt;function ELt(e,t){return function(n){return e(t(n))}}var j$e=ELt,ILt=j$e,PLt=ILt(Object.keys,Object),LLt=PLt,OLt=ALt,DLt=LLt,RLt=Object.prototype,FLt=RLt.hasOwnProperty;function zLt(e){if(!OLt(e))return DLt(e);var t=[];for(var n in Object(e))FLt.call(e,n)&&n!="constructor"&&t.push(n);return t}var BLt=zLt,$Lt=e1e,ULt=v1e;function qLt(e){return e!=null&&ULt(e.length)&&!$Lt(e)}var TP=qLt,VLt=CLt,HLt=BLt,WLt=TP;function GLt(e){return WLt(e)?VLt(e):HLt(e)}var cie=GLt,KLt=c6t,ZLt=v6t,YLt=cie;function XLt(e){return KLt(e,YLt,ZLt)}var QLt=XLt,XCe=QLt,JLt=1,eOt=Object.prototype,tOt=eOt.hasOwnProperty;function rOt(e,t,n,s,a,o){var l=n&JLt,i=XCe(e),u=i.length,m=XCe(t),x=m.length;if(u!=x&&!l)return!1;for(var y=u;y--;){var v=i[y];if(!(l?v in t:tOt.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 e8t=JDt;function t8t(e,t,n){for(var s=-1,a=e==null?0:e.length;++s=g8t){var m=t?null:f8t(e);if(m)return p8t(m);l=!1,a=m8t,u=new d8t}else u=t?[]:i;e:for(;++s=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function I8t(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 P8t(e){return e.value}function L8t(e,t){if(dt.isValidElement(e))return dt.cloneElement(e,t);if(typeof e=="function")return dt.createElement(e,t);t.ref;var n=E8t(t,j8t);return dt.createElement(p1e,n)}var m3e=1,nC=function(e){function t(){var n;k8t(this,t);for(var s=arguments.length,a=new Array(s),o=0;om3e||Math.abs(a.height-this.lastBoundingBox.height)>m3e)&&(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}},L8t(o,zx(zx({},this.props),{},{payload:A$e(x,m,P8t)})))}}],[{key:"getWithHeight",value:function(s,a){var o=zx(zx({},this.defaultProps),s.props),l=o.layout;return l==="vertical"&&Fn(s.props.height)?{height:s.props.height}:l==="horizontal"?{width:s.props.width||a}:null}}])}(A.PureComponent);die(nC,"displayName","Legend");die(nC,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var f3e=SP,O8t=x1e,D8t=Uh,p3e=f3e?f3e.isConcatSpreadable:void 0;function R8t(e){return D8t(e)||O8t(e)||!!(p3e&&e&&e[p3e])}var F8t=R8t,z8t=y$e,B8t=F8t;function P$e(e,t,n,s,a){var o=-1,l=e.length;for(n||(n=B8t),a||(a=[]);++o0&&n(i)?t>1?P$e(i,t-1,n,s,a):z8t(a,i):s||(a[a.length]=i)}return a}var L$e=P$e;function $8t(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 U8t=$8t,q8t=U8t,V8t=q8t(),H8t=V8t,W8t=H8t,G8t=cie;function K8t(e,t){return e&&W8t(e,t,G8t)}var O$e=K8t,Z8t=TP;function Y8t(e,t){return function(n,s){if(n==null)return n;if(!Z8t(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 dRt=cRt,Zde=a1e,uRt=i1e,hRt=dx,mRt=D$e,fRt=aRt,pRt=b$e,gRt=dRt,xRt=Z3,yRt=Uh;function vRt(e,t,n){t.length?t=Zde(t,function(o){return yRt(o)?function(l){return uRt(l,o.length===1?o[0]:o)}:o}):t=[xRt];var s=-1;t=Zde(t,pRt(hRt));var a=mRt(e,function(o,l,i){var u=Zde(t,function(m){return m(o)});return{criteria:u,index:++s,value:o}});return fRt(a,function(o,l){return gRt(o,l,n)})}var _Rt=vRt;function bRt(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 wRt=bRt,jRt=wRt,x3e=Math.max;function kRt(e,t,n){return t=x3e(t===void 0?e.length-1:t,0),function(){for(var s=arguments,a=-1,o=x3e(s.length-t,0),l=Array(o);++a0){if(++t>=LRt)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var FRt=RRt,zRt=PRt,BRt=FRt,$Rt=BRt(zRt),URt=$Rt,qRt=Z3,VRt=NRt,HRt=URt;function WRt(e,t){return HRt(VRt(e,t,qRt),e+"")}var GRt=WRt,KRt=t1e,ZRt=TP,YRt=y1e,XRt=Pv;function QRt(e,t,n){if(!XRt(n))return!1;var s=typeof t;return(s=="number"?ZRt(n)&&YRt(t,n.length):s=="string"&&t in n)?KRt(n[t],e):!1}var uie=QRt,JRt=L$e,eFt=_Rt,tFt=GRt,v3e=uie,rFt=tFt(function(e,t){if(e==null)return[];var n=t.length;return n>1&&v3e(e,t[0],t[1])?t=[]:n>2&&v3e(t[0],t[1],t[2])&&(t=[t[0]]),eFt(e,JRt(t,1),[])}),nFt=rFt;const w1e=eo(nFt);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 Vfe(){return Vfe=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(yT,"-left"),Fn(n)&&t&&Fn(t.x)&&n=t.y),"".concat(yT,"-top"),Fn(s)&&t&&Fn(t.y)&&sk?Math.max(x,u[s]):Math.max(y,u[s])}function yFt(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 vFt(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=w3e({allowEscapeViewBox:t,coordinate:n,key:"x",offsetTopLeft:s,position:a,reverseDirection:o,tooltipDimension:l.width,viewBox:u,viewBoxDimension:u.width}),y=w3e({allowEscapeViewBox:t,coordinate:n,key:"y",offsetTopLeft:s,position:a,reverseDirection:o,tooltipDimension:l.height,viewBox:u,viewBoxDimension:u.height}),m=yFt({translateX:x,translateY:y,useTranslate3d:i})):m=gFt,{cssProperties:m,cssClasses:xFt({translateX:x,translateY:y,coordinate:n})}}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 j3e(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 k3e(e){for(var t=1;tN3e||Math.abs(s.height-this.state.lastBoundingBox.height)>N3e)&&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=vFt({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=k3e(k3e({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),TFt=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Y3={isSsr:TFt()};function KC(e){"@babel/helpers - typeof";return KC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},KC(e)}function S3e(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 C3e(e){for(var t=1;t0;return dt.createElement(MFt,{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},zFt(m,C3e(C3e({},this.props),{},{payload:D})))}}])}(A.PureComponent);j1e(mp,"displayName","Tooltip");j1e(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:!Y3.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 BFt=cx,$Ft=function(){return BFt.Date.now()},UFt=$Ft,qFt=/\s/;function VFt(e){for(var t=e.length;t--&&qFt.test(e.charAt(t)););return t}var HFt=VFt,WFt=HFt,GFt=/^\s+/;function KFt(e){return e&&e.slice(0,WFt(e)+1).replace(GFt,"")}var ZFt=KFt,YFt=ZFt,M3e=Pv,XFt=U3,T3e=NaN,QFt=/^[-+]0x[0-9a-f]+$/i,JFt=/^0b[01]+$/i,ezt=/^0o[0-7]+$/i,tzt=parseInt;function rzt(e){if(typeof e=="number")return e;if(XFt(e))return T3e;if(M3e(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=M3e(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=YFt(e);var n=JFt.test(e);return n||ezt.test(e)?tzt(e.slice(2),n?2:8):QFt.test(e)?T3e:+e}var U$e=rzt,nzt=Pv,Xde=UFt,A3e=U$e,szt="Expected a function",azt=Math.max,izt=Math.min;function ozt(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(szt);t=A3e(t)||0,nzt(n)&&(x=!!n.leading,y="maxWait"in n,o=y?azt(A3e(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?izt(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=Xde();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(Xde())}function D(){var U=Xde(),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 lzt=ozt,czt=lzt,dzt=Pv,uzt="Expected a function";function hzt(e,t,n){var s=!0,a=!0;if(typeof e!="function")throw new TypeError(uzt);return dzt(n)&&(s="leading"in n?!!n.leading:s,a="trailing"in n?!!n.trailing:a),czt(e,t,{leading:s,maxWait:t,trailing:a})}var mzt=hzt;const q$e=eo(mzt);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 E3e(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 OO(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,s=new Array(t);n0&&(de=q$e(de,k,{trailing:!0,leading:!1}));var se=new ResizeObserver(de),pe=D.current.getBoundingClientRect(),ne=pe.width,me=pe.height;return ae(ne,me),se.observe(D.current),function(){se.disconnect()}},[ae,k]);var oe=A.useMemo(function(){var de=G.containerWidth,se=G.containerHeight;if(de<0||se<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 pe=hj(l)?de:l,ne=hj(u)?se:u;n&&n>0&&(pe?ne=pe/n:ne&&(pe=ne*n),v&&ne>v&&(ne=v)),Op(pe>0||ne>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.`,pe,ne,l,u,x,y,n);var me=!Array.isArray(b)&&wy(b.type).endsWith("Chart");return dt.Children.map(b,function(he){return dt.isValidElement(he)?A.cloneElement(he,OO({width:pe,height:ne},me?{style:OO({height:"100%",width:"100%",maxHeight:ne,maxWidth:pe},he.props.style)}:{})):he})},[n,b,u,v,y,x,G,l]);return dt.createElement("div",{id:M?"".concat(M):void 0,className:hi("recharts-responsive-container",I),style:OO(OO({},F),{},{width:l,height:u,minWidth:x,minHeight:y,maxHeight:v}),ref:D},oe)}),hie=function(t){return null};hie.displayName="Cell";function lI(e){"@babel/helpers - typeof";return lI=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},lI(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 Zfe(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Y3.isSsr)return{width:0,height:0};var s=Czt(n),a=JSON.stringify({text:t,copyStyle:s});if(OS.widthCache[a])return OS.widthCache[a];try{var o=document.getElementById(L3e);o||(o=document.createElement("span"),o.setAttribute("id",L3e),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var l=Zfe(Zfe({},Szt),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>Nzt&&(OS.cacheCount=0,OS.widthCache={}),u}catch{return{width:0,height:0}}},Mzt=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};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 fne(e,t){return Izt(e)||Ezt(e,t)||Azt(e,t)||Tzt()}function Tzt(){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 Azt(e,t){if(e){if(typeof e=="string")return O3e(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return O3e(e,t)}}function O3e(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n=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 $3e(e,t){return Yzt(e)||Zzt(e,t)||Kzt(e,t)||Gzt()}function Gzt(){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 Kzt(e,t){if(e){if(typeof e=="string")return U3e(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 U3e(e,t)}}function U3e(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 pe.reduce(function(ne,me){var he=me.word,xe=me.width,Te=ne[ne.length-1];if(Te&&(a==null||o||Te.width+xe+sme.width?ne:me})};if(!x)return b;for(var k="…",M=function(pe){var ne=y.slice(0,pe),me=G$e({breakAll:m,style:u,children:ne+k}).wordsWithComputedWidth,he=v(me),xe=he.length>l||N(he).width>Number(a);return[xe,he]},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=$3e(V,2),G=W[0],Q=W[1],ae=M(D),oe=$3e(ae,1),de=oe[0];if(!G&&!de&&(I=D+1),G&&de&&(T=D-1),!G&&de){F=Q;break}P++}return F||b},q3e=function(t){var n=Ei(t)?[]:t.toString().split(W$e);return[{words:n}]},Qzt=function(t){var n=t.width,s=t.scaleToFit,a=t.children,o=t.style,l=t.breakAll,i=t.maxLines;if((n||s)&&!Y3.isSsr){var u,m,x=G$e({breakAll:l,children:a,style:o});if(x){var y=x.wordsWithComputedWidth,v=x.spaceWidth;u=y,m=v}else return q3e(a);return Xzt({breakAll:l,children:a,maxLines:i,style:o},u,m,n,s)}return q3e(a)},V3e="#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?V3e:M,T=B3e(t,Vzt),P=A.useMemo(function(){return Qzt({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=B3e(T,Hzt);if(!fd(s)||!fd(o))return null;var Q=s+(Fn(F)?F:0),ae=o+(Fn(D)?D:0),oe;switch(k){case"start":oe=Qde("calc(".concat(m,")"));break;case"middle":oe=Qde("calc(".concat((P.length-1)/2," * -").concat(i," + (").concat(m," / 2))"));break;default:oe=Qde("calc(".concat(P.length-1," * -").concat(i,")"));break}var de=[];if(y){var se=P[0].width,pe=T.width;de.push("scale(".concat((Fn(pe)?pe/se:1)/se,")"))}return U&&de.push("rotate(".concat(U,", ").concat(Q,", ").concat(ae,")")),de.length&&(G.transform=de.join(" ")),dt.createElement("text",Yfe({},Ua(G,!0),{x:Q,y:ae,className:hi("recharts-text",V),textAnchor:b,fill:I.includes("url")?V3e:I}),P.map(function(ne,me){var he=ne.words.join(W?"":" ");return dt.createElement("tspan",{x:Q,dy:me===0?oe:i,key:"".concat(he,"-").concat(me)},he)}))};function ov(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function Jzt(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function k1e(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===Jzt?e:e7t,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 e7t(){return 0}function K$e(e){return e===null?NaN:+e}function*t7t(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const r7t=k1e(ov),AP=r7t.right;k1e(K$e).center;class H3e extends Map{constructor(t,n=a7t){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(W3e(this,t))}has(t){return super.has(W3e(this,t))}set(t,n){return super.set(n7t(this,t),n)}delete(t){return super.delete(s7t(this,t))}}function W3e({_intern:e,_key:t},n){const s=t(n);return e.has(s)?e.get(s):n}function n7t({_intern:e,_key:t},n){const s=t(n);return e.has(s)?e.get(s):(e.set(s,n),n)}function s7t({_intern:e,_key:t},n){const s=t(n);return e.has(s)&&(n=e.get(s),e.delete(s)),n}function a7t(e){return e!==null&&typeof e=="object"?e.valueOf():e}function i7t(e=ov){if(e===ov)return Z$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 Z$e(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const o7t=Math.sqrt(50),l7t=Math.sqrt(10),c7t=Math.sqrt(2);function pne(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>=o7t?10:o>=l7t?5:o>=c7t?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 K3e(e,t){let n;for(const s of e)s!=null&&(n>s||n===void 0&&s>=s)&&(n=s);return n}function Y$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?Z$e:i7t(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));Y$e(e,t,b,N,a)}const o=e[t];let l=n,i=s;for(vT(e,n,t),a(e[s],o)>0&&vT(e,n,s);l0;)--i}a(e[n],o)===0?vT(e,n,i):(++i,vT(e,i,s)),i<=t&&(n=i+1),t<=i&&(s=i-1)}return e}function vT(e,t,n){const s=e[t];e[t]=e[n],e[n]=s}function d7t(e,t,n){if(e=Float64Array.from(t7t(e)),!(!(s=e.length)||isNaN(t=+t))){if(t<=0||s<2)return K3e(e);if(t>=1)return G3e(e);var s,a=(s-1)*t,o=Math.floor(a),l=G3e(Y$e(e,o).subarray(0,o+1)),i=K3e(e.subarray(o+1));return l+(i-l)*(a-o)}}function u7t(e,t,n=K$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 h7t(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?RO(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?RO(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=f7t.exec(e))?new Ih(t[1],t[2],t[3],1):(t=p7t.exec(e))?new Ih(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=g7t.exec(e))?RO(t[1],t[2],t[3],t[4]):(t=x7t.exec(e))?RO(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=y7t.exec(e))?t5e(t[1],t[2]/100,t[3]/100,1):(t=v7t.exec(e))?t5e(t[1],t[2]/100,t[3]/100,t[4]):Z3e.hasOwnProperty(e)?Q3e(Z3e[e]):e==="transparent"?new Ih(NaN,NaN,NaN,0):null}function Q3e(e){return new Ih(e>>16&255,e>>8&255,e&255,1)}function RO(e,t,n,s){return s<=0&&(e=t=n=NaN),new Ih(e,t,n,s)}function w7t(e){return e instanceof EP||(e=mI(e)),e?(e=e.rgb(),new Ih(e.r,e.g,e.b,e.opacity)):new Ih}function tpe(e,t,n,s){return arguments.length===1?w7t(e):new Ih(e,t,n,s??1)}function Ih(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}S1e(Ih,tpe,Q$e(EP,{brighter(e){return e=e==null?gne:Math.pow(gne,e),new Ih(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?uI:Math.pow(uI,e),new Ih(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ih(Yj(this.r),Yj(this.g),Yj(this.b),xne(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:J3e,formatHex:J3e,formatHex8:j7t,formatRgb:e5e,toString:e5e}));function J3e(){return`#${mj(this.r)}${mj(this.g)}${mj(this.b)}`}function j7t(){return`#${mj(this.r)}${mj(this.g)}${mj(this.b)}${mj((isNaN(this.opacity)?1:this.opacity)*255)}`}function e5e(){const e=xne(this.opacity);return`${e===1?"rgb(":"rgba("}${Yj(this.r)}, ${Yj(this.g)}, ${Yj(this.b)}${e===1?")":`, ${e})`}`}function xne(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 t5e(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 J$e(e){if(e instanceof _p)return new _p(e.h,e.s,e.l,e.opacity);if(e instanceof EP||(e=mI(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 k7t(e,t,n,s){return arguments.length===1?J$e(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}S1e(_p,k7t,Q$e(EP,{brighter(e){return e=e==null?gne:Math.pow(gne,e),new _p(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?uI:Math.pow(uI,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 Ih(Jde(e>=240?e-240:e+120,a,s),Jde(e,a,s),Jde(e<120?e+240:e-120,a,s),this.opacity)},clamp(){return new _p(r5e(this.h),FO(this.s),FO(this.l),xne(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=xne(this.opacity);return`${e===1?"hsl(":"hsla("}${r5e(this.h)}, ${FO(this.s)*100}%, ${FO(this.l)*100}%${e===1?")":`, ${e})`}`}}));function r5e(e){return e=(e||0)%360,e<0?e+360:e}function FO(e){return Math.max(0,Math.min(1,e||0))}function Jde(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 C1e=e=>()=>e;function N7t(e,t){return function(n){return e+n*t}}function S7t(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 C7t(e){return(e=+e)==1?eUe:function(t,n){return n-t?S7t(t,n,e):C1e(isNaN(t)?n:t)}}function eUe(e,t){var n=t-e;return n?N7t(e,n):C1e(isNaN(e)?t:e)}const n5e=function e(t){var n=C7t(t);function s(a,o){var l=n((a=tpe(a)).r,(o=tpe(o)).r),i=n(a.g,o.g),u=n(a.b,o.b),m=eUe(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 M7t(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:yne(s,a)})),n=eue.lastIndex;return nt&&(n=e,e=t,t=n),function(s){return Math.max(e,Math.min(t,s))}}function z7t(e,t,n){var s=e[0],a=e[1],o=t[0],l=t[1];return a2?B7t:z7t,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),yne)))(v)))},y.domain=function(v){return arguments.length?(e=Array.from(v,vne),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=M1e,x()},y.clamp=function(v){return arguments.length?(l=v?!0:Qu,x()):l!==Qu},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 T1e(){return mie()(Qu,Qu)}function $7t(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function _ne(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 ZC(e){return e=_ne(Math.abs(e)),e?e[1]:NaN}function U7t(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 q7t(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var V7t=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function fI(e){if(!(t=V7t.exec(e)))throw new Error("invalid format: "+e);var t;return new A1e({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]})}fI.prototype=A1e.prototype;function A1e(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+""}A1e.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 H7t(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 tUe;function W7t(e,t){var n=_ne(e,t);if(!n)return e+"";var s=n[0],a=n[1],o=a-(tUe=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")+_ne(e,Math.max(0,t+o-1))[0]}function a5e(e,t){var n=_ne(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 i5e={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:$7t,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)=>a5e(e*100,t),r:a5e,s:W7t,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function o5e(e){return e}var l5e=Array.prototype.map,c5e=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function G7t(e){var t=e.grouping===void 0||e.thousands===void 0?o5e:U7t(l5e.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?o5e:q7t(l5e.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=fI(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"):i5e[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=i5e[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 Q(ae){var oe=U,de=V,se,pe,ne;if(D==="c")de=W(ae)+de,ae="";else{ae=+ae;var me=ae<0||1/ae<0;if(ae=isNaN(ae)?u:W(Math.abs(ae),P),F&&(ae=H7t(ae)),me&&+ae==0&&N!=="+"&&(me=!1),oe=(me?N==="("?N:i:N==="-"||N==="("?"":N)+oe,de=(D==="s"?c5e[8+tUe/3]:"")+de+(me&&N==="("?")":""),G){for(se=-1,pe=ae.length;++sene||ne>57){de=(ne===46?a+ae.slice(se+1):ae.slice(se))+de,ae=ae.slice(0,se);break}}}T&&!M&&(ae=t(ae,1/0));var he=oe.length+ae.length+de.length,xe=he>1)+oe+ae+de+xe.slice(he);break;default:ae=xe+oe+ae+de;break}return o(ae)}return Q.toString=function(){return y+""},Q}function x(y,v){var b=m((y=fI(y),y.type="f",y)),N=Math.max(-8,Math.min(8,Math.floor(ZC(v)/3)))*3,k=Math.pow(10,-N),M=c5e[8+N/3];return function(I){return b(k*I)+M}}return{format:m,formatPrefix:x}}var zO,E1e,rUe;K7t({thousands:",",grouping:[3],currency:["$",""]});function K7t(e){return zO=G7t(e),E1e=zO.format,rUe=zO.formatPrefix,zO}function Z7t(e){return Math.max(0,-ZC(Math.abs(e)))}function Y7t(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ZC(t)/3)))*3-ZC(Math.abs(e)))}function X7t(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,ZC(t)-ZC(e))+1}function nUe(e,t,n,s){var a=Jfe(e,t,n),o;switch(s=fI(s??",f"),s.type){case"s":{var l=Math.max(Math.abs(e),Math.abs(t));return s.precision==null&&!isNaN(o=Y7t(a,l))&&(s.precision=o),rUe(s,l)}case"":case"e":case"g":case"p":case"r":{s.precision==null&&!isNaN(o=X7t(a,Math.max(Math.abs(e),Math.abs(t))))&&(s.precision=o-(s.type==="e"));break}case"f":case"%":{s.precision==null&&!isNaN(o=Z7t(a))&&(s.precision=o-(s.type==="%")*2);break}}return E1e(s)}function Lv(e){var t=e.domain;return e.ticks=function(n){var s=t();return Xfe(s[0],s[s.length-1],n??10)},e.tickFormat=function(n,s){var a=t();return nUe(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=Qfe(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 bne(){var e=T1e();return e.copy=function(){return IP(e,bne())},Cf.apply(e,arguments),Lv(e)}function sUe(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,vne),n):e.slice()},n.unknown=function(s){return arguments.length?(t=s,n):t},n.copy=function(){return sUe(e).unknown(t)},e=arguments.length?Array.from(e,vne):[0,1],Lv(n)}function aUe(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 r9t(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 h5e(e){return(t,n)=>-e(-t,n)}function I1e(e){const t=e(d5e,u5e),n=t.domain;let s=10,a,o;function l(){return a=r9t(s),o=t9t(s),n()[0]<0?(a=h5e(a),o=h5e(o),e(Q7t,J7t)):e(d5e,u5e),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=fI(u)).precision==null&&(u.trim=!0),u=E1e(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(aUe(n(),{floor:i=>o(Math.floor(a(i))),ceil:i=>o(Math.ceil(a(i)))})),t}function iUe(){const e=I1e(mie()).domain([1,10]);return e.copy=()=>IP(e,iUe()).base(e.base()),Cf.apply(e,arguments),e}function m5e(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function f5e(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function P1e(e){var t=1,n=e(m5e(t),f5e(t));return n.constant=function(s){return arguments.length?e(m5e(t=+s),f5e(t)):t},Lv(n)}function oUe(){var e=P1e(mie());return e.copy=function(){return IP(e,oUe()).constant(e.constant())},Cf.apply(e,arguments)}function p5e(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function n9t(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function s9t(e){return e<0?-e*e:e*e}function L1e(e){var t=e(Qu,Qu),n=1;function s(){return n===1?e(Qu,Qu):n===.5?e(n9t,s9t):e(p5e(n),p5e(1/n))}return t.exponent=function(a){return arguments.length?(n=+a,s()):n},Lv(t)}function O1e(){var e=L1e(mie());return e.copy=function(){return IP(e,O1e()).exponent(e.exponent())},Cf.apply(e,arguments),e}function a9t(){return O1e.apply(null,arguments).exponent(.5)}function g5e(e){return Math.sign(e)*e*e}function i9t(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function lUe(){var e=T1e(),t=[0,1],n=!1,s;function a(o){var l=i9t(e(o));return isNaN(l)?s:n?Math.round(l):l}return a.invert=function(o){return e.invert(g5e(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,vne)).map(g5e)),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 lUe(e.domain(),t).round(n).clamp(e.clamp()).unknown(s)},Cf.apply(a,arguments),Lv(a)}function cUe(){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 dUe().domain([e,t]).range(a).unknown(o)},Cf.apply(Lv(l),arguments)}function uUe(){var e=[.5],t=[0,1],n,s=1;function a(o){return o!=null&&o<=o?t[AP(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 uUe().domain(e).range(t).unknown(n)},Cf.apply(a,arguments)}const tue=new Date,rue=new Date;function yd(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(myd(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)=>(tue.setTime(+o),rue.setTime(+l),e(tue),e(rue),Math.floor(n(tue,rue))),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 wne=yd(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);wne.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?yd(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):wne);wne.range;const ny=1e3,cf=ny*60,sy=cf*60,By=sy*24,D1e=By*7,x5e=By*30,nue=By*365,fj=yd(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*ny)},(e,t)=>(t-e)/ny,e=>e.getUTCSeconds());fj.range;const R1e=yd(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ny)},(e,t)=>{e.setTime(+e+t*cf)},(e,t)=>(t-e)/cf,e=>e.getMinutes());R1e.range;const F1e=yd(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*cf)},(e,t)=>(t-e)/cf,e=>e.getUTCMinutes());F1e.range;const z1e=yd(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ny-e.getMinutes()*cf)},(e,t)=>{e.setTime(+e+t*sy)},(e,t)=>(t-e)/sy,e=>e.getHours());z1e.range;const B1e=yd(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*sy)},(e,t)=>(t-e)/sy,e=>e.getUTCHours());B1e.range;const PP=yd(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*cf)/By,e=>e.getDate()-1);PP.range;const fie=yd(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/By,e=>e.getUTCDate()-1);fie.range;const hUe=yd(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/By,e=>Math.floor(e/By));hUe.range;function Pk(e){return yd(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())*cf)/D1e)}const pie=Pk(0),jne=Pk(1),o9t=Pk(2),l9t=Pk(3),YC=Pk(4),c9t=Pk(5),d9t=Pk(6);pie.range;jne.range;o9t.range;l9t.range;YC.range;c9t.range;d9t.range;function Lk(e){return yd(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)/D1e)}const gie=Lk(0),kne=Lk(1),u9t=Lk(2),h9t=Lk(3),XC=Lk(4),m9t=Lk(5),f9t=Lk(6);gie.range;kne.range;u9t.range;h9t.range;XC.range;m9t.range;f9t.range;const $1e=yd(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());$1e.range;const U1e=yd(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());U1e.range;const $y=yd(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());$y.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:yd(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)});$y.range;const Uy=yd(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Uy.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:yd(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});Uy.range;function mUe(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,cf],[o,5,5*cf],[o,15,15*cf],[o,30,30*cf],[a,1,sy],[a,3,3*sy],[a,6,6*sy],[a,12,12*sy],[s,1,By],[s,2,2*By],[n,1,D1e],[t,1,x5e],[t,3,3*x5e],[e,1,nue]];function i(m,x,y){const v=xM).right(l,v);if(b===l.length)return e.every(Jfe(m/nue,x/nue,y));if(b===0)return wne.every(Math.max(Jfe(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=aue(_T(Oe.y,0,1)),qe=le.getUTCDay(),le=qe>4||qe===0?kne.ceil(le):kne(le),le=fie.offset(le,(Oe.V-1)*7),Oe.y=le.getUTCFullYear(),Oe.m=le.getUTCMonth(),Oe.d=le.getUTCDate()+(Oe.w+6)%7):(le=sue(_T(Oe.y,0,1)),qe=le.getDay(),le=qe>4||qe===0?jne.ceil(le):jne(le),le=PP.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?aue(_T(Oe.y,0,1)).getUTCDay():sue(_T(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,aue(Oe)):sue(Oe)}}function W(Ve,ot,At,Oe){for(var at=0,le=ot.length,qe=At.length,Qe,rt;at=qe)return-1;if(Qe=ot.charCodeAt(at++),Qe===37){if(Qe=ot.charAt(at++),rt=D[Qe in y5e?ot.charAt(at++):Qe],!rt||(Oe=rt(Ve,At,Oe))<0)return-1}else if(Qe!=At.charCodeAt(Oe++))return-1}return Oe}function G(Ve,ot,At){var Oe=m.exec(ot.slice(At));return Oe?(Ve.p=x.get(Oe[0].toLowerCase()),At+Oe[0].length):-1}function Q(Ve,ot,At){var Oe=b.exec(ot.slice(At));return Oe?(Ve.w=N.get(Oe[0].toLowerCase()),At+Oe[0].length):-1}function ae(Ve,ot,At){var Oe=y.exec(ot.slice(At));return Oe?(Ve.w=v.get(Oe[0].toLowerCase()),At+Oe[0].length):-1}function oe(Ve,ot,At){var Oe=I.exec(ot.slice(At));return Oe?(Ve.m=T.get(Oe[0].toLowerCase()),At+Oe[0].length):-1}function de(Ve,ot,At){var Oe=k.exec(ot.slice(At));return Oe?(Ve.m=M.get(Oe[0].toLowerCase()),At+Oe[0].length):-1}function se(Ve,ot,At){return W(Ve,t,ot,At)}function pe(Ve,ot,At){return W(Ve,n,ot,At)}function ne(Ve,ot,At){return W(Ve,s,ot,At)}function me(Ve){return l[Ve.getDay()]}function he(Ve){return o[Ve.getDay()]}function xe(Ve){return u[Ve.getMonth()]}function Te(Ve){return i[Ve.getMonth()]}function be(Ve){return a[+(Ve.getHours()>=12)]}function we(Ve){return 1+~~(Ve.getMonth()/3)}function ve(Ve){return l[Ve.getUTCDay()]}function et(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 y5e={"-":"",_:" ",0:"0"},Vd=/^\s*\d+/,_9t=/^%/,b9t=/[\\^$*+?|[\]().{}]/g;function po(e,t,n){var s=e<0?"-":"",a=(s?-e:e)+"",o=a.length;return s+(o[t.toLowerCase(),n]))}function j9t(e,t,n){var s=Vd.exec(t.slice(n,n+1));return s?(e.w=+s[0],n+s[0].length):-1}function k9t(e,t,n){var s=Vd.exec(t.slice(n,n+1));return s?(e.u=+s[0],n+s[0].length):-1}function N9t(e,t,n){var s=Vd.exec(t.slice(n,n+2));return s?(e.U=+s[0],n+s[0].length):-1}function S9t(e,t,n){var s=Vd.exec(t.slice(n,n+2));return s?(e.V=+s[0],n+s[0].length):-1}function C9t(e,t,n){var s=Vd.exec(t.slice(n,n+2));return s?(e.W=+s[0],n+s[0].length):-1}function v5e(e,t,n){var s=Vd.exec(t.slice(n,n+4));return s?(e.y=+s[0],n+s[0].length):-1}function _5e(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 M9t(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 T9t(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 A9t(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 b5e(e,t,n){var s=Vd.exec(t.slice(n,n+2));return s?(e.d=+s[0],n+s[0].length):-1}function E9t(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 w5e(e,t,n){var s=Vd.exec(t.slice(n,n+2));return s?(e.H=+s[0],n+s[0].length):-1}function I9t(e,t,n){var s=Vd.exec(t.slice(n,n+2));return s?(e.M=+s[0],n+s[0].length):-1}function P9t(e,t,n){var s=Vd.exec(t.slice(n,n+2));return s?(e.S=+s[0],n+s[0].length):-1}function L9t(e,t,n){var s=Vd.exec(t.slice(n,n+3));return s?(e.L=+s[0],n+s[0].length):-1}function O9t(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 D9t(e,t,n){var s=_9t.exec(t.slice(n,n+1));return s?n+s[0].length:-1}function R9t(e,t,n){var s=Vd.exec(t.slice(n));return s?(e.Q=+s[0],n+s[0].length):-1}function F9t(e,t,n){var s=Vd.exec(t.slice(n));return s?(e.s=+s[0],n+s[0].length):-1}function j5e(e,t){return po(e.getDate(),t,2)}function z9t(e,t){return po(e.getHours(),t,2)}function B9t(e,t){return po(e.getHours()%12||12,t,2)}function $9t(e,t){return po(1+PP.count($y(e),e),t,3)}function fUe(e,t){return po(e.getMilliseconds(),t,3)}function U9t(e,t){return fUe(e,t)+"000"}function q9t(e,t){return po(e.getMonth()+1,t,2)}function V9t(e,t){return po(e.getMinutes(),t,2)}function H9t(e,t){return po(e.getSeconds(),t,2)}function W9t(e){var t=e.getDay();return t===0?7:t}function G9t(e,t){return po(pie.count($y(e)-1,e),t,2)}function pUe(e){var t=e.getDay();return t>=4||t===0?YC(e):YC.ceil(e)}function K9t(e,t){return e=pUe(e),po(YC.count($y(e),e)+($y(e).getDay()===4),t,2)}function Z9t(e){return e.getDay()}function Y9t(e,t){return po(jne.count($y(e)-1,e),t,2)}function X9t(e,t){return po(e.getFullYear()%100,t,2)}function Q9t(e,t){return e=pUe(e),po(e.getFullYear()%100,t,2)}function J9t(e,t){return po(e.getFullYear()%1e4,t,4)}function eBt(e,t){var n=e.getDay();return e=n>=4||n===0?YC(e):YC.ceil(e),po(e.getFullYear()%1e4,t,4)}function tBt(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+po(t/60|0,"0",2)+po(t%60,"0",2)}function k5e(e,t){return po(e.getUTCDate(),t,2)}function rBt(e,t){return po(e.getUTCHours(),t,2)}function nBt(e,t){return po(e.getUTCHours()%12||12,t,2)}function sBt(e,t){return po(1+fie.count(Uy(e),e),t,3)}function gUe(e,t){return po(e.getUTCMilliseconds(),t,3)}function aBt(e,t){return gUe(e,t)+"000"}function iBt(e,t){return po(e.getUTCMonth()+1,t,2)}function oBt(e,t){return po(e.getUTCMinutes(),t,2)}function lBt(e,t){return po(e.getUTCSeconds(),t,2)}function cBt(e){var t=e.getUTCDay();return t===0?7:t}function dBt(e,t){return po(gie.count(Uy(e)-1,e),t,2)}function xUe(e){var t=e.getUTCDay();return t>=4||t===0?XC(e):XC.ceil(e)}function uBt(e,t){return e=xUe(e),po(XC.count(Uy(e),e)+(Uy(e).getUTCDay()===4),t,2)}function hBt(e){return e.getUTCDay()}function mBt(e,t){return po(kne.count(Uy(e)-1,e),t,2)}function fBt(e,t){return po(e.getUTCFullYear()%100,t,2)}function pBt(e,t){return e=xUe(e),po(e.getUTCFullYear()%100,t,2)}function gBt(e,t){return po(e.getUTCFullYear()%1e4,t,4)}function xBt(e,t){var n=e.getUTCDay();return e=n>=4||n===0?XC(e):XC.ceil(e),po(e.getUTCFullYear()%1e4,t,4)}function yBt(){return"+0000"}function N5e(){return"%"}function S5e(e){return+e}function C5e(e){return Math.floor(+e/1e3)}var DS,yUe,vUe;vBt({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 vBt(e){return DS=v9t(e),yUe=DS.format,DS.parse,vUe=DS.utcFormat,DS.utcParse,DS}function _Bt(e){return new Date(e)}function bBt(e){return e instanceof Date?+e:+new Date(+e)}function q1e(e,t,n,s,a,o,l,i,u,m){var x=T1e(),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)=>d7t(e,o/s))},n.copy=function(){return jUe(t).domain(e)},Ky.apply(n,arguments)}function yie(){var e=0,t=.5,n=1,s=1,a,o,l,i,u,m=Qu,x,y=!1,v;function b(k){return isNaN(k=+k)?v:(k=.5+((k=+x(k))-o)*(s*kt}var CUe=MBt,TBt=vie,ABt=CUe,EBt=Z3;function IBt(e){return e&&e.length?TBt(e,EBt,ABt):void 0}var PBt=IBt;const _ie=eo(PBt);function LBt(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};Cs.decimalPlaces=Cs.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};Cs.dividedBy=Cs.div=function(e){return jy(this,new this.constructor(e))};Cs.dividedToIntegerBy=Cs.idiv=function(e){var t=this,n=t.constructor;return Ko(jy(t,new n(e),0,1),n.precision)};Cs.equals=Cs.eq=function(e){return!this.cmp(e)};Cs.exponent=function(){return Kc(this)};Cs.greaterThan=Cs.gt=function(e){return this.cmp(e)>0};Cs.greaterThanOrEqualTo=Cs.gte=function(e){return this.cmp(e)>=0};Cs.isInteger=Cs.isint=function(){return this.e>this.d.length-2};Cs.isNegative=Cs.isneg=function(){return this.s<0};Cs.isPositive=Cs.ispos=function(){return this.s>0};Cs.isZero=function(){return this.s===0};Cs.lessThan=Cs.lt=function(e){return this.cmp(e)<0};Cs.lessThanOrEqualTo=Cs.lte=function(e){return this.cmp(e)<1};Cs.logarithm=Cs.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(um))throw Error(bf+"NaN");if(n.s<1)throw Error(bf+(n.s?"NaN":"-Infinity"));return n.eq(um)?new s(0):(Al=!1,t=jy(pI(n,o),pI(e,o),o),Al=!0,Ko(t,a))};Cs.minus=Cs.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?IUe(t,e):AUe(t,(e.s=-e.s,e))};Cs.modulo=Cs.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=jy(n,e,0,1).times(e),Al=!0,n.minus(t)):Ko(new s(n),a)};Cs.naturalExponential=Cs.exp=function(){return EUe(this)};Cs.naturalLogarithm=Cs.ln=function(){return pI(this)};Cs.negated=Cs.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Cs.plus=Cs.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?AUe(t,e):IUe(t,(e.s=-e.s,e))};Cs.precision=Cs.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};Cs.squareRoot=Cs.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=J3((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(jy(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(Ko(o,n+1,0),o.times(o).eq(i)){s=o;break}}else if(t!="9999")break;l+=4}return Al=!0,Ko(s,n)};Cs.times=Cs.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%Md|0,t=i/Md|0;o[a]=(o[a]+t)%Md|0}for(;!o[--l];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,Al?Ko(e,y.precision):e};Cs.toDecimalPlaces=Cs.todp=function(e,t){var n=this,s=n.constructor;return n=new s(n),e===void 0?n:(nx(e,0,Q3),t===void 0?t=s.rounding:nx(t,0,8),Ko(n,e+Kc(n)+1,t))};Cs.toExponential=function(e,t){var n,s=this,a=s.constructor;return e===void 0?n=bk(s,!0):(nx(e,0,Q3),t===void 0?t=a.rounding:nx(t,0,8),s=Ko(new a(s),e+1,t),n=bk(s,!0,e+1)),n};Cs.toFixed=function(e,t){var n,s,a=this,o=a.constructor;return e===void 0?bk(a):(nx(e,0,Q3),t===void 0?t=o.rounding:nx(t,0,8),s=Ko(new o(a),e+Kc(a)+1,t),n=bk(s.abs(),!1,e+Kc(s)+1),a.isneg()&&!a.isZero()?"-"+n:n)};Cs.toInteger=Cs.toint=function(){var e=this,t=e.constructor;return Ko(new t(e),Kc(e)+1,t.rounding)};Cs.toNumber=function(){return+this};Cs.toPower=Cs.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(um);if(i=new u(i),!i.s){if(e.s<1)throw Error(bf+"Infinity");return i}if(i.eq(um))return i;if(s=u.precision,e.eq(um))return Ko(i,s);if(t=e.e,n=e.d.length-1,l=t>=n,o=i.s,l){if((n=x<0?-x:x)<=TUe){for(a=new u(um),t=Math.ceil(s/xl+4),Al=!1;n%2&&(a=a.times(i),A5e(a.d,t)),n=J3(n/2),n!==0;)i=i.times(i),A5e(i.d,t);return Al=!0,e.s<0?new u(um).div(a):Ko(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(pI(i,s+m)),Al=!0,a=EUe(a),a.s=o,a};Cs.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,Q3),t===void 0?t=o.rounding:nx(t,0,8),a=Ko(new o(a),e,t),n=Kc(a),s=bk(a,e<=n||n<=o.toExpNeg,e)),s};Cs.toSignificantDigits=Cs.tosd=function(e,t){var n=this,s=n.constructor;return e===void 0?(e=s.precision,t=s.rounding):(nx(e,1,Q3),t===void 0?t=s.rounding:nx(t,0,8)),Ko(new s(n),e,t)};Cs.toString=Cs.valueOf=Cs.val=Cs.toJSON=Cs[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 AUe(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?Ko(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)/Md|0,u[o]%=Md;for(n&&(u.unshift(n),++a),i=u.length;u[--i]==0;)u.pop();return t.d=u,t.e=a,Al?Ko(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,Q=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(Q),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=Md/2&&++U;do x=0,i=t(oe,k,V,M),i<0?(I=k[0],V!=M&&(I=I*Md+(k[1]||0)),x=I/U|0,x>1?(x>=Md&&(x=Md-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(W1e+Kc(e));if(!e.s)return new x(um);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(um),x.precision=i;;){if(a=Ko(a.times(e),i),n=n.times(++u),l=o.plus(jy(a,n,i)),Eg(l.d).slice(0,i)===Eg(o.d).slice(0,i)){for(;m--;)o=Ko(o.times(o),i);return x.precision=y,t==null?(Al=!0,Ko(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 iue(e,t,n){if(t>e.LN10.sd())throw Al=!0,n&&(e.precision=n),Error(bf+"LN10 precision limit exceeded");return Ko(new e(e.LN10),t)}function i1(e){for(var t="";e--;)t+="0";return t}function pI(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(um))return new k(0);if(t==null?(Al=!1,m=M):m=t,b.eq(10))return t==null&&(Al=!0),iue(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=iue(k,m+2,M).times(o+""),b=pI(new k(s+"."+n.slice(1)),m-v).plus(u),k.precision=M,t==null?(Al=!0,Ko(b,M)):b;for(i=l=b=jy(b.minus(um),b.plus(um),m),x=Ko(b.times(b),m),a=3;;){if(l=Ko(l.times(x),m),u=i.plus(jy(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(iue(k,m+2,M).times(o+""))),i=jy(i,new k(y),m),k.precision=M,t==null?(Al=!0,Ko(i,M)):i;i=u,a+=2}}function T5e(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=J3(n/xl),e.d=[],s=(n+1)%xl,n<0&&(s+=xl),sNne||e.e<-Nne))throw Error(W1e+n)}else e.s=0,e.e=0,e.d=[0];return e}function Ko(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=J3(-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)==Md&&(y[0]=1,++e.e);break}else{if(y[x]+=o,y[x]!=Md)break;y[x--]=0,o=1}for(s=y.length;y[--s]===0;)y.pop();if(Al&&(e.e>Nne||e.e<-Nne))throw Error(W1e+Kc(e));return e}function IUe(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?Ko(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)+i1(s):l>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(a<0?"e":"e+")+a):a<0?(o="0."+i1(-a-1)+o,n&&(s=n-l)>0&&(o+=i1(s))):a>=l?(o+=i1(a+1-l),n&&(s=n-a-1)>0&&(o=o+"."+i1(s))):((s=a+1)0&&(a+1===l&&(o+="."),o+=i1(s))),e.s<0?"-"+o:o}function A5e(e,t){if(e.length>t)return e.length=t,!0}function PUe(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 T5e(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,t$t.test(o))T5e(l,o);else throw Error(Xj+o)}if(a.prototype=Cs,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=PUe,a.config=a.set=r$t,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 G1e=PUe(e$t);um=new G1e(1);const Vo=G1e;function n$t(e){return o$t(e)||i$t(e)||a$t(e)||s$t()}function s$t(){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 a$t(e,t){if(e){if(typeof e=="string")return spe(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 spe(e,t)}}function i$t(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function o$t(e){if(Array.isArray(e))return spe(e)}function spe(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,E5e(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 w$t(e){if(Array.isArray(e))return e}function FUe(e){var t=gI(e,2),n=t[0],s=t[1],a=n,o=s;return n>s&&(a=s,o=n),[a,o]}function zUe(e,t,n){if(e.lte(0))return new Vo(0);var s=kie.getDigitCount(e.toNumber()),a=new Vo(10).pow(s),o=e.div(a),l=s!==1?.05:.1,i=new Vo(Math.ceil(o.div(l).toNumber())).add(n).mul(l),u=i.mul(a);return t?u:new Vo(Math.ceil(u))}function j$t(e,t,n){var s=1,a=new Vo(e);if(!a.isint()&&n){var o=Math.abs(e);o<1?(s=new Vo(10).pow(kie.getDigitCount(e)-1),a=new Vo(Math.floor(a.div(s).toNumber())).mul(s)):o>1&&(a=new Vo(Math.floor(e)))}else e===0?a=new Vo(Math.floor((t-1)/2)):n||(a=new Vo(Math.floor(e)));var l=Math.floor((t-1)/2),i=u$t(d$t(function(u){return a.add(new Vo(u-l).mul(s)).toNumber()}),ape);return i(0,t)}function BUe(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 Vo(0),tickMin:new Vo(0),tickMax:new Vo(0)};var o=zUe(new Vo(t).sub(e).div(n-1),s,a),l;e<=0&&t>=0?l=new Vo(0):(l=new Vo(e).add(t).div(2),l=l.sub(new Vo(l).mod(o)));var i=Math.ceil(l.sub(e).div(o).toNumber()),u=Math.ceil(new Vo(t).sub(l).div(o).toNumber()),m=i+u+1;return m>n?BUe(e,t,n,s,a+1):(m0?u+(n-m):u,i=t>0?i:i+(n-m)),{step:o,tickMin:l.sub(new Vo(i).mul(o)),tickMax:l.add(new Vo(u).mul(o))})}function k$t(e){var t=gI(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=FUe([n,s]),u=gI(i,2),m=u[0],x=u[1];if(m===-1/0||x===1/0){var y=x===1/0?[m].concat(ope(ape(0,a-1).map(function(){return 1/0}))):[].concat(ope(ape(0,a-1).map(function(){return-1/0})),[x]);return n>s?ipe(y):y}if(m===x)return j$t(m,a,o);var v=BUe(m,x,l,o),b=v.step,N=v.tickMin,k=v.tickMax,M=kie.rangeStep(N,k.add(new Vo(.1).mul(b)),b);return n>s?ipe(M):M}function N$t(e,t){var n=gI(e,2),s=n[0],a=n[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=FUe([s,a]),i=gI(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=zUe(new Vo(m).sub(u).div(x-1),o,0),v=[].concat(ope(kie.rangeStep(new Vo(u),new Vo(m).sub(new Vo(.99).mul(y)),y)),[m]);return s>a?ipe(v):v}var S$t=DUe(k$t),C$t=DUe(N$t),M$t="Invariant failed";function wk(e,t){throw new Error(M$t)}var T$t=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function QC(e){"@babel/helpers - typeof";return QC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},QC(e)}function Sne(){return Sne=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 D$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 R$t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F$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(Yu(y-x)!==Yu(v-y)){var N=[];if(Yu(v-y)===Yu(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},K1e=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},tUt=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=Ei(F)?n:F;l[D].push({item:I[0],stackList:I.slice(1),barSize:Ei(U)?void 0:Xu(U,s,0)})}}return l},rUt=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=Xu(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(L5e(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=Xu(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(L5e(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},nUt=function(t,n,s,a){var o=s.children,l=s.width,i=s.margin,u=l-(i.left||0)-(i.right||0),m=VUe({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"&&Fn(t[b]))return Jl(Jl({},t),{},aC({},b,t[b]+(y||0)));if((k==="horizontal"||k==="vertical"&&b==="center")&&N!=="middle"&&Fn(t[N]))return Jl(Jl({},t),{},aC({},N,t[N]+(v||0)))}return t},sUt=function(t,n,s){return Ei(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||s==="x"?n==="xAxis":s==="y"?n==="yAxis":!0},HUe=function(t,n,s,a,o){var l=n.props.children,i=yf(l,Nie).filter(function(m){return sUt(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(Ei(y))return m;var v=Array.isArray(y)?[bie(y),_ie(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},aUt=function(t,n,s,a,o){var l=n.map(function(i){return HUe(t,i,s,o,a)}).filter(function(i){return!Ei(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},WUe=function(t,n,s,a,o){var l=n.map(function(u){var m=u.props.dataKey;return s==="number"&&m&&HUe(t,u,m,a)||nE(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?Yu(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!CP(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}})},oue=new WeakMap,BO=function(t,n){if(typeof n!="function")return t;oue.has(t)||oue.set(t,new WeakMap);var s=oue.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},ZUe=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:dI(),realScaleType:"band"}:l==="radial"&&i==="angleAxis"?{scale:bne(),realScaleType:"linear"}:o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!s)?{scale:rE(),realScaleType:"point"}:o==="category"?{scale:dI(),realScaleType:"band"}:{scale:bne(),realScaleType:"linear"};if(yk(a)){var u="scale".concat(aie(a));return{scale:(M5e[u]||rE)(),realScaleType:M5e[u]?u:"point"}}return Ya(a)?{scale:a}:{scale:rE(),realScaleType:"point"}},D5e=1e-4,YUe=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])-D5e,l=Math.max(a[0],a[1])+D5e,i=t(n[0]),u=t(n[s-1]);(il||ul)&&t.domain([n[0],n[s-1]])}},iUt=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])}},cUt=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)}},dUt={sign:lUt,expand:TIt,none:VC,silhouette:AIt,wiggle:EIt,positive:cUt},uUt=function(t,n,s){var a=n.map(function(i){return i.props.dataKey}),o=dUt[s],l=MIt().keys(a).value(function(i,u){return+vu(i,u,0)}).order(Lfe).offset(o);return l(t)},hUt=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[MP("_stackId_")]={numericAxisId:s,cateAxisId:a,items:[v]};return Jl(Jl({},y),{},aC({},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),{},aC({},M,{numericAxisId:s,cateAxisId:a,items:I.items,stackedData:uUt(t,I.items,o)}))},N)}return Jl(Jl({},y),{},aC({},v,b))},x)},XUe=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=S$t(m,o,i);return t.domain([bie(x),_ie(x)]),{niceTicks:x}}if(o&&a==="number"){var y=t.domain(),v=C$t(y,o,i);return{niceTicks:v}}return null},R5e=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 Ei(u)?null:n.scale(u)-o/2+a},mUt=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]},fUt=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},pUt=function(t){return t.reduce(function(n,s){return[bie(s.concat([n[0]]).filter(Fn)),_ie(s.concat([n[1]]).filter(Fn))]},[1/0,-1/0])},QUe=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=pUt(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})},F5e=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,z5e=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,upe=function(t,n,s){if(Ya(t))return t(n,s);if(!Array.isArray(t))return n;var a=[];if(Fn(t[0]))a[0]=s?t[0]:Math.min(t[0],n[0]);else if(F5e.test(t[0])){var o=+F5e.exec(t[0])[1];a[0]=n[0]-o}else Ya(t[0])?a[0]=t[0](n[0]):a[0]=n[0];if(Fn(t[1]))a[1]=s?t[1]:Math.max(t[1],n[1]);else if(z5e.test(t[1])){var l=+z5e.exec(t[1])[1];a[1]=n[1]+l}else Ya(t[1])?a[1]=t[1](n[1]):a[1]=n[1];return a},Mne=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=w1e(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},kUt=function(t,n,s,a,o){var l=t.width,i=t.height,u=t.startAngle,m=t.endAngle,x=Xu(t.cx,l,l/2),y=Xu(t.cy,i,i/2),v=tqe(l,i,s),b=Xu(t.innerRadius,v,0),N=Xu(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(Ei(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=yUt(U,2);u=V[0],m=V[1]}var W=ZUe(T,o),G=W.realScaleType,Q=W.scale;Q.domain(P).range(D),YUe(Q);var ae=XUe(Q,Wx(Wx({},T),{},{realScaleType:G})),oe=Wx(Wx(Wx({},T),ae),{},{range:D,radius:N,realScaleType:G,scale:Q,cx:x,cy:y,innerRadius:b,outerRadius:N,startAngle:u,endAngle:m});return Wx(Wx({},M),{},eqe({},I,oe))},{})},NUt=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))},SUt=function(t,n){var s=t.x,a=t.y,o=n.cx,l=n.cy,i=NUt({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:jUt(m),angleInRadian:m}},CUt=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}},MUt=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},q5e=function(t,n){var s=t.x,a=t.y,o=SUt({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=CUt(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:MUt(b,n)}):null},rqe=function(t){return!A.isValidElement(t)&&!Ya(t)&&typeof t!="boolean"?t.className:""};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 TUt=["offset"];function AUt(e){return LUt(e)||PUt(e)||IUt(e)||EUt()}function EUt(){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 IUt(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 PUt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function LUt(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 DUt(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 V5e(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=Ei(t.id)?MP("recharts-radial-line-"):t.id;return dt.createElement("text",bI({},s,{dominantBaseline:"central",className:hi("recharts-radial-bar-label",i)}),dt.createElement("defs",null,dt.createElement("path",{id:W,d:V})),dt.createElement("textPath",{xlinkHref:"#".concat(W)},n))},qUt=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"}},VUt=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):q3(o)&&(Fn(o.x)||hj(o.x))&&(Fn(o.y)||hj(o.y))?td({x:i+Xu(o.x,m),y:u+Xu(o.y,x),textAnchor:"end",verticalAnchor:"end"},V):td({x:i+m/2,y:u+x/2,textAnchor:"middle",verticalAnchor:"middle"},V)},HUt=function(t){return"cx"in t&&Fn(t.cx)};function Pd(e){var t=e.offset,n=t===void 0?5:t,s=OUt(e,TUt),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||Ei(i)&&Ei(u)&&!A.isValidElement(m)&&!Ya(m))return null;if(A.isValidElement(m))return A.cloneElement(m,a);var b;if(Ya(m)){if(b=A.createElement(m,a),A.isValidElement(b))return b}else b=BUt(a);var N=HUt(o),k=Ua(a,!0);if(N&&(l==="insideStart"||l==="insideEnd"||l==="end"))return UUt(a,b,k);var M=N?qUt(a):VUt(a);return dt.createElement(_k,bI({className:hi("recharts-label",y)},k,M,{breakAll:v}),b)}Pd.displayName="Label";var nqe=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(Fn(k)&&Fn(M)){if(Fn(y)&&Fn(v))return{x:y,y:v,width:k,height:M};if(Fn(b)&&Fn(N))return{x:b,y:N,width:k,height:M}}return Fn(y)&&Fn(v)?{x:y,y:v,width:0,height:0}:Fn(n)&&Fn(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:{}},WUt=function(t,n){return t?t===!0?dt.createElement(Pd,{key:"label-implicit",viewBox:n}):fd(t)?dt.createElement(Pd,{key:"label-implicit",viewBox:n,value:t}):A.isValidElement(t)?t.type===Pd?A.cloneElement(t,{key:"label-implicit",viewBox:n}):dt.createElement(Pd,{key:"label-implicit",content:t,viewBox:n}):Ya(t)?dt.createElement(Pd,{key:"label-implicit",content:t,viewBox:n}):q3(t)?dt.createElement(Pd,bI({viewBox:n},t,{key:"label-implicit"})):null:null},GUt=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=nqe(t),l=yf(a,Pd).map(function(u,m){return A.cloneElement(u,{viewBox:n||o,key:"label-".concat(m)})});if(!s)return l;var i=WUt(t.label,n||o);return[i].concat(AUt(l))};Pd.parseViewBox=nqe;Pd.renderCallByParent=GUt;function KUt(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var ZUt=KUt;const YUt=eo(ZUt);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)}var XUt=["valueAccessor"],QUt=["data","dataKey","clockWise","id","textBreakAll"];function JUt(e){return nqt(e)||rqt(e)||tqt(e)||eqt()}function eqt(){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 tqt(e,t){if(e){if(typeof e=="string")return mpe(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 mpe(e,t)}}function rqt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function nqt(e){if(Array.isArray(e))return mpe(e)}function mpe(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 oqt(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 lqt=function(t){return Array.isArray(t.value)?YUt(t.value):t.value};function lv(e){var t=e.valueAccessor,n=t===void 0?lqt:t,s=G5e(e,XUt),a=s.data,o=s.dataKey,l=s.clockWise,i=s.id,u=s.textBreakAll,m=G5e(s,QUt);return!a||!a.length?null:dt.createElement(Lo,{className:"recharts-label-list"},a.map(function(x,y){var v=Ei(o)?n(x,y):vu(x&&x.payload,o),b=Ei(i)?{}:{id:"".concat(i,"-").concat(y)};return dt.createElement(Pd,Ane({},Ua(x,!0),m,b,{parentViewBox:x.parentViewBox,value:v,textBreakAll:u,viewBox:Pd.parseViewBox(Ei(l)?x:W5e(W5e({},x),{},{clockWise:l})),key:"label-".concat(y),index:y}))}))}lv.displayName="LabelList";function cqt(e,t){return e?e===!0?dt.createElement(lv,{key:"labelList-implicit",data:t}):dt.isValidElement(e)||Ya(e)?dt.createElement(lv,{key:"labelList-implicit",data:t,content:e}):q3(e)?dt.createElement(lv,Ane({data:t},e,{key:"labelList-implicit"})):null:null}function dqt(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=cqt(e.label,t);return[o].concat(JUt(a))}lv.renderCallByParent=dqt;function jI(e){"@babel/helpers - typeof";return jI=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},jI(e)}function fpe(){return fpe=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},pqt=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=Yu(x-m),v=$O({cx:n,cy:s,radius:o,angle:m,sign:y,cornerRadius:l,cornerIsExternal:u}),b=v.circleTangency,N=v.lineTangency,k=v.theta,M=$O({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 `):sqe({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=$O({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,Q=$O({cx:n,cy:s,radius:a,angle:x,sign:-y,isExternal:!0,cornerRadius:l,cornerIsExternal:u}),ae=Q.circleTangency,oe=Q.lineTangency,de=Q.theta,se=u?Math.abs(m-x):Math.abs(m-x)-G-de;if(se<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(+(se>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},gqt={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},aqe=function(t){var n=Z5e(Z5e({},gqt),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=pqt({cx:s,cy:a,innerRadius:o,outerRadius:l,cornerRadius:Math.min(k,N/2),forceCornerRadius:u,cornerIsExternal:m,startAngle:x,endAngle:y}):M=sqe({cx:s,cy:a,innerRadius:o,outerRadius:l,startAngle:x,endAngle:y}),dt.createElement("path",fpe({},Ua(n,!0),{className:b,d:M,role:"img"}))};function kI(e){"@babel/helpers - typeof";return kI=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},kI(e)}function ppe(){return ppe=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 Oqt(e,t){return Ok(e.getTime(),t.getTime())}function Dqt(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Rqt(e,t){return e===t}function nMe(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 Fqt=Ok;function zqt(e,t,n){var s=rMe(e),a=s.length;if(rMe(t).length!==a)return!1;for(;a-- >0;)if(!cqe(e,t,n,s[a]))return!1;return!0}function NT(e,t,n){var s=eMe(e),a=s.length;if(eMe(t).length!==a)return!1;for(var o,l,i;a-- >0;)if(o=s[a],!cqe(e,t,n,o)||(l=tMe(e,o),i=tMe(t,o),(l||i)&&(!l||!i||l.configurable!==i.configurable||l.enumerable!==i.enumerable||l.writable!==i.writable)))return!1;return!0}function Bqt(e,t){return Ok(e.valueOf(),t.valueOf())}function $qt(e,t){return e.source===t.source&&e.flags===t.flags}function sMe(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 Uqt(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 qqt(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 cqe(e,t,n,s){return(s===Pqt||s===Iqt||s===Eqt)&&(e.$$typeof||t.$$typeof)?!0:Aqt(t,s)&&n.equals(e[s],t[s],s,s,e,t,n)}var Vqt="[object Arguments]",Hqt="[object Boolean]",Wqt="[object Date]",Gqt="[object Error]",Kqt="[object Map]",Zqt="[object Number]",Yqt="[object Object]",Xqt="[object RegExp]",Qqt="[object Set]",Jqt="[object String]",eVt="[object URL]",tVt=Array.isArray,aMe=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,iMe=Object.assign,rVt=Object.prototype.toString.call.bind(Object.prototype.toString);function nVt(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(tVt(N))return t(N,k,M);if(aMe!=null&&aMe(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=rVt(N);return P===Wqt?n(N,k,M):P===Xqt?m(N,k,M):P===Kqt?o(N,k,M):P===Qqt?x(N,k,M):P===Yqt?typeof N.then!="function"&&typeof k.then!="function"&&i(N,k,M):P===eVt?v(N,k,M):P===Gqt?s(N,k,M):P===Vqt?i(N,k,M):P===Hqt||P===Zqt||P===Jqt?u(N,k,M):!1}}function sVt(e){var t=e.circular,n=e.createCustomConfig,s=e.strict,a={areArraysEqual:s?NT:Lqt,areDatesEqual:Oqt,areErrorsEqual:Dqt,areFunctionsEqual:Rqt,areMapsEqual:s?J5e(nMe,NT):nMe,areNumbersEqual:Fqt,areObjectsEqual:s?NT:zqt,arePrimitiveWrappersEqual:Bqt,areRegExpsEqual:$qt,areSetsEqual:s?J5e(sMe,NT):sMe,areTypedArraysEqual:s?NT:Uqt,areUrlsEqual:qqt};if(n&&(a=iMe({},a,n(a))),t){var o=qO(a.areArraysEqual),l=qO(a.areMapsEqual),i=qO(a.areObjectsEqual),u=qO(a.areSetsEqual);a=iMe({},a,{areArraysEqual:o,areMapsEqual:l,areObjectsEqual:i,areSetsEqual:u})}return a}function aVt(e){return function(t,n,s,a,o,l,i){return e(t,n,i)}}function iVt(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 oVt=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=sVt(e),u=nVt(i),m=s?s(u):aVt(u);return iVt({circular:n,comparator:u,createState:a,equals:m,strict:l})}function lVt(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function oMe(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):lVt(a)};requestAnimationFrame(s)}function xpe(e){"@babel/helpers - typeof";return xpe=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},xpe(e)}function cVt(e){return mVt(e)||hVt(e)||uVt(e)||dVt()}function dVt(){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 uVt(e,t){if(e){if(typeof e=="string")return lMe(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 lMe(e,t)}}function lMe(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 VVt(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 lue(e){return KVt(e)||GVt(e)||WVt(e)||HVt()}function HVt(){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 WVt(e,t){if(e){if(typeof e=="string")return wpe(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 wpe(e,t)}}function GVt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function KVt(e){if(Array.isArray(e))return wpe(e)}function wpe(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 Pne(e){return Pne=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Pne(e)}var qy=function(e){JVt(n,e);var t=eHt(n);function n(s,a){var o;ZVt(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(Npe(o)),o.changeStyle=o.changeStyle.bind(Npe(o)),!i||b<=0)return o.state={style:{}},typeof v=="function"&&(o.state={style:x}),kpe(o);if(y&&y.length)o.state={style:y[0].style};else if(m){if(typeof v=="function")return o.state={style:m},kpe(o);o.state={style:u?UT({},u,m):m}}else o.state={style:{}};return o}return XVt(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?UT({},u,x):x};this.state&&v&&(u&&v[u]!==x||!u&&v!==x)&&this.setState(b);return}if(!(oVt(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?UT({},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=$Vt(l,i,AVt(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(lue(k),[o.runJSAnimation.bind(o,{from:W.style,to:D,duration:T,easing:F}),T]);var Q=uMe(G,T,F),ae=rp(rp(rp({},W.style),D),{},{transition:Q});return[].concat(lue(k),[ae,T,V]).filter(yVt)};return this.manager.start([u].concat(lue(l.reduce(b,[x,Math.max(v,i)])),[a.onAnimationEnd]))}},{key:"runAnimation",value:function(a){this.manager||(this.manager=fVt());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?UT({},i,u):u,M=uMe(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=qVt(a,UVt),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);qy.displayName="Animate";qy.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};qy.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 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 Lne(){return Lne=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},dHt=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},uHt={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Z1e=function(t){var n=vMe(vMe({},uHt),t),s=A.useRef(),a=A.useState(-1),o=rHt(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=hi("recharts-rectangle",b);return T?dt.createElement(qy,{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(qy,{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",Lne({},Ua(n,!0),{className:P,d:_Me(V,W,D,U,v),ref:s})))}):dt.createElement("path",Lne({},Ua(n,!0),{className:P,d:_Me(u,m,x,y,v)}))},hHt=["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 fHt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function bMe(e){return yHt(e)||xHt(e)||gHt(e)||pHt()}function pHt(){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 gHt(e,t){if(e){if(typeof e=="string")return Spe(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 Spe(e,t)}}function xHt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function yHt(e){if(Array.isArray(e))return Spe(e)}function Spe(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){wMe(s)?n[n.length-1].push(s):n[n.length-1].length>0&&n.push([])}),wMe(t[0])&&n[n.length-1].push(t[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},aE=function(t,n){var s=vHt(t);n&&(s=[s.reduce(function(o,l){return[].concat(bMe(o),bMe(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},_Ht=function(t,n,s){var a=aE(t,s);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(aE(n.reverse(),s).slice(1))},bHt=function(t){var n=t.points,s=t.className,a=t.baseLinePoints,o=t.connectNulls,l=mHt(t,hHt);if(!n||!n.length)return null;var i=hi("recharts-polygon",s);if(a&&a.length){var u=l.stroke&&l.stroke!=="none",m=_Ht(n,a,o);return dt.createElement("g",{className:i},dt.createElement("path",o4({},Ua(l,!0),{fill:m.slice(-1)==="Z"?l.fill:"none",stroke:"none",d:m})),u?dt.createElement("path",o4({},Ua(l,!0),{fill:"none",d:aE(n,o)})):null,u?dt.createElement("path",o4({},Ua(l,!0),{fill:"none",d:aE(a,o)})):null)}var x=aE(n,o);return dt.createElement("path",o4({},Ua(l,!0),{fill:x.slice(-1)==="Z"?l.fill:"none",className:i,d:x}))};function Cpe(){return Cpe=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 MHt(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 THt=function(t,n,s,a,o,l){return"M".concat(t,",").concat(o,"v").concat(a,"M").concat(l,",").concat(n,"h").concat(s)},AHt=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=CHt(t,wHt),M=jHt({x:s,y:o,top:i,left:m,width:y,height:b},k);return!Fn(s)||!Fn(o)||!Fn(y)||!Fn(b)||!Fn(i)||!Fn(m)?null:dt.createElement("path",Mpe({},Ua(M,!0),{className:hi("recharts-cross",N),d:THt(s,o,y,b,i,m)}))},EHt=vie,IHt=CUe,PHt=dx;function LHt(e,t){return e&&e.length?EHt(e,PHt(t),IHt):void 0}var OHt=LHt;const DHt=eo(OHt);var RHt=vie,FHt=dx,zHt=MUe;function BHt(e,t){return e&&e.length?RHt(e,FHt(t),zHt):void 0}var $Ht=BHt;const UHt=eo($Ht);var qHt=["cx","cy","angle","ticks","axisLine"],VHt=["ticks","tick","angle","tickFormatter","stroke"];function e3(e){"@babel/helpers - typeof";return e3=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},e3(e)}function iE(){return iE=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 HHt(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 WHt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function SMe(e,t){for(var n=0;nTMe?l=a==="outer"?"start":"end":o<-TMe?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_({},Ua(this.props,!1)),{},{fill:"none"},Ua(i,!1));if(u==="circle")return dt.createElement(Y1e,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(bHt,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=Ua(this.props,!1),y=Ua(l,!1),v=E_(E_({},x),{},{fill:"none"},Ua(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(Lo,tj({className:hi("recharts-polar-angle-axis-tick",rqe(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(Lo,{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(Lo,{className:hi("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):Ya(s)?l=s(a):l=dt.createElement(_k,tj({},a,{className:"recharts-polar-angle-axis-tick-value"}),o),l}}])}(A.PureComponent);Mie(Tie,"displayName","PolarAngleAxis");Mie(Tie,"axisType","angleAxis");Mie(Tie,"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 oWt=j$e,lWt=oWt(Object.getPrototypeOf,Object),cWt=lWt,dWt=Wy,uWt=cWt,hWt=Gy,mWt="[object Object]",fWt=Function.prototype,pWt=Object.prototype,_qe=fWt.toString,gWt=pWt.hasOwnProperty,xWt=_qe.call(Object);function yWt(e){if(!hWt(e)||dWt(e)!=mWt)return!1;var t=uWt(e);if(t===null)return!0;var n=gWt.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&_qe.call(n)==xWt}var vWt=yWt;const _Wt=eo(vWt);var bWt=Wy,wWt=Gy,jWt="[object Boolean]";function kWt(e){return e===!0||e===!1||wWt(e)&&bWt(e)==jWt}var NWt=kWt;const SWt=eo(NWt);function TI(e){"@babel/helpers - typeof";return TI=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},TI(e)}function Rne(){return Rne=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(qy,{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",Rne({},Ua(n,!0),{className:T,d:PMe(V,W,F,D,U),ref:s})))}):dt.createElement("g",null,dt.createElement("path",Rne({},Ua(n,!0),{className:T,d:PMe(u,m,x,y,v)})))},RWt=["option","shapeType","propTransformer","activeClassName","isActive"];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 FWt(e,t){if(e==null)return{};var n=zWt(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 zWt(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 LMe(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 Fne(e){for(var t=1;t0?jm(P,"paddingAngle",0):0;if(D){var V=a1(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,Q=P.startAngle,ae=a1(0,G-Q),oe=ae(k),de=sl(sl({},P),{},{startAngle:T+U,endAngle:T+oe+U});M.push(de),T=de.endAngle}}),dt.createElement(Lo,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||!wie(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||!Fn(m)||!Fn(x)||!Fn(y)||!Fn(v))return null;var k=hi("recharts-pie",i);return dt.createElement(Lo,{tabIndex:this.props.rootTabIndex,className:k,ref:function(I){s.pieRef=I}},this.renderSectors(),u&&this.renderLabels(l),Pd.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 Q=vu(G,I,0);return W+(Fn(Q)?Q:0)},0),U;if(D>0){var V;U=a.map(function(W,G){var Q=vu(W,I,0),ae=vu(W,x,G),oe=(Fn(Q)?Q:0)/D,de;G?de=V.endAngle+Yu(k)*u*(Q!==0?1:0):de=l;var se=de+Yu(k)*((Q!==0?b:0)+oe*F),pe=(de+se)/2,ne=(N.innerRadius+N.outerRadius)/2,me=[{name:ae,value:Q,payload:W,dataKey:I,type:v}],he=ol(N.cx,N.cy,ne,pe);return V=sl(sl(sl({percent:oe,cornerRadius:o,name:ae,tooltipPayload:me,midAngle:pe,middleRadius:ne,tooltipPosition:he},W),N),{},{value:vu(W,I),startAngle:de,endAngle:se,payload:W,paddingAngle:Yu(k)*u}),V})}return sl(sl({},N),{},{sectors:U,data:a})});var iGt=Math.ceil,oGt=Math.max;function lGt(e,t,n,s){for(var a=-1,o=oGt(iGt((t-e)/(n||1)),0),l=Array(o);o--;)l[s?o:++a]=e,e+=n;return l}var cGt=lGt,dGt=U$e,FMe=1/0,uGt=17976931348623157e292;function hGt(e){if(!e)return e===0?e:0;if(e=dGt(e),e===FMe||e===-FMe){var t=e<0?-1:1;return t*uGt}return e===e?e:0}var kqe=hGt,mGt=cGt,fGt=uie,cue=kqe;function pGt(e){return function(t,n,s){return s&&typeof s!="number"&&fGt(t,n,s)&&(n=s=void 0),t=cue(t),n===void 0?(n=t,t=0):n=cue(n),s=s===void 0?t0&&s.handleDrag(a.changedTouches[0])}),tm(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()}),tm(s,"handleLeaveWrapper",function(){(s.state.isTravellerMoving||s.state.isSlideMoving)&&(s.leaveTimer=window.setTimeout(s.handleDragEnd,s.props.leaveTimeOut))}),tm(s,"handleEnterSlideOrTraveller",function(){s.setState({isTextActive:!0})}),tm(s,"handleLeaveSlideOrTraveller",function(){s.setState({isTextActive:!1})}),tm(s,"handleSlideDragStart",function(a){var o=qMe(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 TGt(t,e),NGt(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 Ya(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=qMe(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(tm(tm({},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(tm({},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=due(due({},Ua(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(Lo,{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(Lo,{className:"recharts-brush-texts"},dt.createElement(_k,$ne({textAnchor:"end",verticalAnchor:"middle",x:Math.min(y,v)-b,y:l+i/2},N),this.getTextOfTick(a)),dt.createElement(_k,$ne({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||!Fn(i)||!Fn(u)||!Fn(m)||!Fn(x)||m<=0||x<=0)return null;var P=hi("recharts-brush",o),F=dt.Children.count(l)===1,D=jGt("userSelect","none");return dt.createElement(Lo,{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):Ya(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 due({prevData:o,prevTravellerWidth:u,prevUpdateId:m,prevX:i,prevWidth:l},o&&o.length?EGt({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);tm(s3,"displayName","Brush");tm(s3,"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 IGt=b1e;function PGt(e,t){var n;return IGt(e,function(s,a,o){return n=t(s,a,o),!n}),!!n}var LGt=PGt,OGt=p$e,DGt=dx,RGt=LGt,FGt=Uh,zGt=uie;function BGt(e,t,n){var s=FGt(e)?OGt:RGt;return n&&zGt(e,t,n)&&(t=void 0),s(e,DGt(t))}var $Gt=BGt;const UGt=eo($Gt);var Yg=function(t,n){var s=t.alwaysShow,a=t.ifOverflow;return s&&(a="extendDomain"),a===n},VMe=R$e;function qGt(e,t,n){t=="__proto__"&&VMe?VMe(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var VGt=qGt,HGt=VGt,WGt=O$e,GGt=dx;function KGt(e,t){var n={};return t=GGt(t),WGt(e,function(s,a,o){HGt(n,a,t(s,a,o))}),n}var ZGt=KGt;const YGt=eo(ZGt);function XGt(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 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 pKt(e,t){var n=e.x,s=e.y,a=mKt(e,cKt),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 ST(ST(ST(ST(ST({},t),a),l?{x:l}:{}),u?{y:u}:{}),{},{height:x,width:v,name:t.name,radius:t.radius})}function WMe(e){return dt.createElement(bqe,Ppe({shapeType:"rectangle",propTransformer:pKt,activeClassName:"recharts-active-bar"},e))}var gKt=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=Fn(s)||UAt(s);return o?t(s,a):(o||wk(),n)}},xKt=["value","background"],Tqe;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 yKt(e,t){if(e==null)return{};var n=vKt(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 vKt(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 qne(){return qne=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(pe)0&&Math.abs(se)0&&(de=Math.min((et||0)-(se[Me-1]||0),de))}),Number.isFinite(de)){var pe=de/oe,ne=k.layout==="vertical"?s.height:s.width;if(k.padding==="gap"&&(V=pe*ne/2),k.padding==="no-gap"){var me=Xu(t.barCategoryGap,pe*ne),he=pe*ne/2;V=he-me-(he-me)/ne*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=ZUe(k,o,v),Te=xe.scale,be=xe.realScaleType;Te.domain(I).range(W),YUe(Te);var we=XUe(Te,fp(fp({},k),{},{realScaleType:be}));a==="xAxis"?(ae=M==="top"&&!F||M==="bottom"&&F,G=s.left,Q=y[U]-ae*k.height):a==="yAxis"&&(ae=M==="left"&&!F||M==="right"&&F,G=y[U]-ae*k.width,Q=s.top);var ve=fp(fp(fp({},k),we),{},{realScaleType:be,x:G,y:Q,scale:Te,width:a==="xAxis"?s.width:k.width,height:a==="yAxis"?s.height:k.height});return ve.bandSize=Mne(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),{},Iie({},N,ve))},{})},Pqe=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)}},EKt=function(t){var n=t.x1,s=t.y1,a=t.x2,o=t.y2;return Pqe({x:n,y:s},{x:a,y:o})},Lqe=function(){function e(t){CKt(this,e),this.scale=t}return MKt(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)}}])}();Iie(Lqe,"EPS",1e-4);var X1e=function(t){var n=Object.keys(t).reduce(function(s,a){return fp(fp({},s),{},Iie({},a,Lqe.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 YGt(a,function(u,m){return n[m].apply(u,{bandAware:l,position:i})})},isInRange:function(a){return Mqe(a,function(o,l){return n[l].isInRange(o)})}})};function IKt(e){return(e%180+180)%180}var PKt=function(t){var n=t.width,s=t.height,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=IKt(a),l=o*Math.PI/180,i=Math.atan(s/n),u=l>i&&l-1?a[o?t[l]:l]:void 0}}var FKt=RKt,zKt=kqe;function BKt(e){var t=zKt(e),n=t%1;return t===t?n?t-n:t:0}var $Kt=BKt,UKt=T$e,qKt=dx,VKt=$Kt,HKt=Math.max;function WKt(e,t,n){var s=e==null?0:e.length;if(!s)return-1;var a=n==null?0:VKt(n);return a<0&&(a=HKt(s+a,0)),UKt(e,qKt(t),a)}var GKt=WKt,KKt=FKt,ZKt=GKt,YKt=KKt(ZKt),XKt=YKt;const QKt=eo(XKt);var JKt=KTt(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("")}),Q1e=A.createContext(void 0),J1e=A.createContext(void 0),Oqe=A.createContext(void 0),Dqe=A.createContext({}),Rqe=A.createContext(void 0),Fqe=A.createContext(0),zqe=A.createContext(0),XMe=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=JKt(o);return dt.createElement(Q1e.Provider,{value:s},dt.createElement(J1e.Provider,{value:a},dt.createElement(Dqe.Provider,{value:o},dt.createElement(Oqe.Provider,{value:x},dt.createElement(Rqe.Provider,{value:l},dt.createElement(Fqe.Provider,{value:m},dt.createElement(zqe.Provider,{value:u},i)))))))},eZt=function(){return A.useContext(Rqe)},Bqe=function(t){var n=A.useContext(Q1e);n==null&&wk();var s=n[t];return s==null&&wk(),s},tZt=function(){var t=A.useContext(Q1e);return m1(t)},rZt=function(){var t=A.useContext(J1e),n=QKt(t,function(s){return Mqe(s.domain,Number.isFinite)});return n||m1(t)},$qe=function(t){var n=A.useContext(J1e);n==null&&wk();var s=n[t];return s==null&&wk(),s},nZt=function(){var t=A.useContext(Oqe);return t},sZt=function(){return A.useContext(Dqe)},eve=function(){return A.useContext(zqe)},tve=function(){return A.useContext(Fqe)};function i3(e){"@babel/helpers - typeof";return i3=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},i3(e)}function aZt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function iZt(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 $Zt(e,t){return Kqe(e,t+1)}function UZt(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:Kqe(s,m)};var k=u,M,I=function(){return M===void 0&&(M=n(N,k)),M},T=N.coordinate,P=u===0||Kne(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 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 aTe(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=Kne(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 GZt(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=Kne(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=Kne(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?Yu(a[1].coordinate-a[0].coordinate):1,I=BZt(o,M,b);return u==="equidistantPreserveStart"?UZt(M,I,k,a,l):(u==="preserveStart"||u==="preserveStartEnd"?v=GZt(M,I,k,a,l,u==="preserveStartEnd"):v=WZt(M,I,k,a,l),v.filter(function(T){return T.isShow}))}var KZt=["viewBox"],ZZt=["viewBox"],YZt=["ticks"];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 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 XZt(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 QZt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oTe(e,t){for(var n=0;n0?u(this.props):u(b)),l<=0||i<=0||!N||!N.length?null:dt.createElement(Lo,{className:hi("recharts-cartesian-axis",m),ref:function(M){s.layerReference=M}},o&&this.renderAxisLine(),this.renderTicks(N,this.state.fontSize,this.state.letterSpacing),Pd.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(s,a,o){var l,i=hi(a.className,"recharts-cartesian-axis-tick-value");return dt.isValidElement(s)?l=dt.cloneElement(s,ed(ed({},a),{},{className:i})):Ya(s)?l=s(ed(ed({},a),{},{className:i})):l=dt.createElement(_k,c4({},a,{className:"recharts-cartesian-axis-tick-value"}),o),l}}])}(A.Component);ave(e5,"displayName","CartesianAxis");ave(e5,"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 aYt=["x1","y1","x2","y2","key"],iYt=["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 lTe(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 dYt(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 uYt=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 Xqe(e,t){var n;if(dt.isValidElement(e))n=dt.cloneElement(e,t);else if(Ya(e))n=e(t);else{var s=t.x1,a=t.y1,o=t.x2,l=t.y2,i=t.key,u=cTe(t,aYt),m=Ua(u,!1);m.offset;var x=cTe(m,iYt);n=dt.createElement("line",pj({},x,{x1:s,y1:a,x2:o,y2:l,fill:"none",key:i}))}return n}function hYt(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 Xqe(a,m)});return dt.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function mYt(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 Xqe(a,m)});return dt.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function fYt(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 pYt(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 gYt=function(t,n){var s=t.xAxis,a=t.width,o=t.height,l=t.offset;return KUe(sve(yu(yu(yu({},e5.defaultProps),s),{},{ticks:ay(s,!0),viewBox:{x:0,y:0,width:a,height:o}})),l.left,l.left+l.width,n)},xYt=function(t,n){var s=t.yAxis,a=t.width,o=t.height,l=t.offset;return KUe(sve(yu(yu(yu({},e5.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 Qqe(e){var t,n,s,a,o,l,i=eve(),u=tve(),m=sZt(),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:Fn(e.x)?e.x:m.left,y:Fn(e.y)?e.y:m.top,width:Fn(e.width)?e.width:m.width,height:Fn(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=tZt(),P=rZt();if(!Fn(b)||b<=0||!Fn(N)||N<=0||!Fn(y)||y!==+y||!Fn(v)||v!==+v)return null;var F=x.verticalCoordinatesGenerator||gYt,D=x.horizontalCoordinatesGenerator||xYt,U=x.horizontalPoints,V=x.verticalPoints;if((!U||!U.length)&&Ya(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)&&Ya(F)){var Q=I&&I.length,ae=F({xAxis:T?yu(yu({},T),{},{ticks:Q?I:T.ticks}):void 0,width:i,height:u,offset:m},Q?!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(uYt,{fill:x.fill,fillOpacity:x.fillOpacity,x:x.x,y:x.y,width:x.width,height:x.height,ry:x.ry}),dt.createElement(hYt,pj({},x,{offset:m,horizontalPoints:U,xAxis:T,yAxis:P})),dt.createElement(mYt,pj({},x,{offset:m,verticalPoints:V,xAxis:T,yAxis:P})),dt.createElement(fYt,pj({},x,{horizontalPoints:U})),dt.createElement(pYt,pj({},x,{verticalPoints:V})))}Qqe.displayName="CartesianGrid";function d3(e){"@babel/helpers - typeof";return d3=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},d3(e)}function yYt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vYt(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 aXt(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 iXt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oXt(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,s=new Array(t);n0?l:t&&t.length&&Fn(a)&&Fn(o)?t.slice(a,o+1):[]};function hVe(e){return e==="number"?[0,"auto"]:void 0}var Ype=function(t,n,s,a){var o=t.graphicalItems,l=t.tooltipAxis,i=zie(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=jfe(b,l.dataKey,a)}else v=y&&y[s]||i[s];return v?[].concat(m3(u),[JUe(m,v)]):u},[])},pTe=function(t,n,s,a){var o=a||{x:t.chartX,y:t.chartY},l=vXt(o,s),i=t.orderedTooltipTicks,u=t.tooltipAxis,m=t.tooltipTicks,x=eUt(l,i,m,u);if(x>=0&&m){var y=m[x]&&m[x].value,v=Ype(t,n,x,y),b=_Xt(s,i,x,o);return{activeTooltipIndex:x,activeLabel:y,activePayload:v,activeCoordinate:b}}return null},bXt=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=GUe(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 Q=zie(t.data,{graphicalItems:a.filter(function(we){var ve,et=l in we.props?we.props[l]:(ve=we.type.defaultProps)===null||ve===void 0?void 0:ve[l];return et===G}),dataStartIndex:u,dataEndIndex:m}),ae=Q.length,oe,de,se;GYt(I.domain,F,T)&&(oe=upe(I.domain,null,F),b&&(T==="number"||U!=="auto")&&(se=nE(Q,P,"category")));var pe=hVe(T);if(!oe||oe.length===0){var ne,me=(ne=I.domain)!==null&&ne!==void 0?ne:pe;if(P){if(oe=nE(Q,P,T),T==="category"&&b){var he=VAt(oe);D&&he?(de=oe,oe=Bne(0,ae)):D||(oe=B5e(me,oe,k).reduce(function(we,ve){return we.indexOf(ve)>=0?we:[].concat(m3(we),[ve])},[]))}else if(T==="category")D?oe=oe.filter(function(we){return we!==""&&!Ei(we)}):oe=B5e(me,oe,k).reduce(function(we,ve){return we.indexOf(ve)>=0||ve===""||Ei(ve)?we:[].concat(m3(we),[ve])},[]);else if(T==="number"){var xe=aUt(Q,a.filter(function(we){var ve,et,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:(et=we.type.defaultProps)===null||et===void 0?void 0:et.hide;return Me===G&&(W||!Ie)}),P,o,x);xe&&(oe=xe)}b&&(T==="number"||U!=="auto")&&(se=nE(Q,P,"category"))}else b?oe=Bne(0,ae):i&&i[G]&&i[G].hasStack&&T==="number"?oe=v==="expand"?[0,1]:QUe(i[G].stackGroups,u,m):oe=WUe(Q,a.filter(function(we){var ve=l in we.props?we.props[l]:we.type.defaultProps[l],et="hide"in we.props?we.props.hide:we.type.defaultProps.hide;return ve===G&&(W||!et)}),T,x,!0);if(T==="number")oe=Gpe(y,oe,G,o,V),me&&(oe=upe(me,oe,F));else if(T==="category"&&me){var Te=me,be=oe.every(function(we){return Te.indexOf(we)>=0});be&&(oe=Te)}}return en(en({},N),{},Ia({},G,en(en({},I),{},{axisType:o,domain:oe,categoricalDomain:se,duplicateDomain:de,originalDomain:(M=I.domain)!==null&&M!==void 0?M:pe,isCategorical:b,layout:x})))},{})},wXt=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=zie(t.data,{graphicalItems:s,dataStartIndex:u,dataEndIndex:m}),b=v.length,N=GUe(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=hVe("number");if(!M[P]){k++;var D;return N?D=Bne(0,b):i&&i[P]&&i[P].hasStack?(D=QUe(i[P].stackGroups,u,m),D=Gpe(y,D,P,o)):(D=upe(F,WUe(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],Q="hide"in U.props?U.props.hide:(W=U.type.defaultProps)===null||W===void 0?void 0:W.hide;return G===P&&!Q}),"number",x),a.defaultProps.allowDataOverflow),D=Gpe(y,D,P,o)),en(en({},M),{},Ia({},P,en(en({axisType:o},a.defaultProps),{},{hide:!0,orientation:jm(xXt,"".concat(o,".").concat(k%2),null),domain:D,originalDomain:F,isCategorical:N,layout:x})))}return M},{})},jXt=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=bXt(t,{axes:v,graphicalItems:l,axisType:a,axisIdKey:y,stackGroups:i,dataStartIndex:u,dataEndIndex:m}):l&&l.length&&(b=wXt(t,{Axis:o,graphicalItems:l,axisType:a,axisIdKey:y,stackGroups:i,dataStartIndex:u,dataEndIndex:m})),b},kXt=function(t){var n=m1(t),s=ay(n,!1,!0);return{tooltipTicks:s,orderedTooltipTicks:w1e(s,function(a){return a.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Mne(n,s)}},gTe=function(t){var n=t.children,s=t.defaultShowTooltip,a=sm(n,s3),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}},NXt=function(t){return!t||!t.length?!1:t.some(function(n){var s=wy(n&&n.type);return s&&s.indexOf("Bar")>=0})},xTe=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"}},SXt=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=sm(y,s3),N=sm(y,nC),k=Object.keys(u).reduce(function(D,U){var V=u[U],W=V.orientation;return!V.mirror&&!V.hide?en(en({},D),{},Ia({},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),{},Ia({},W,jm(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||s3.defaultProps.height),N&&n&&(I=nUt(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)})},CXt=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},mVe=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,Q=I.layout,ae=I.barGap,oe=I.barCategoryGap,de=I.maxBarSize,se=xTe(Q),pe=se.numericAxisName,ne=se.cateAxisName,me=NXt(P),he=[];return P.forEach(function(xe,Te){var be=zie(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,et=we.maxBarSize,Me=we["".concat(pe,"Id")],Ie=we["".concat(ne,"Id")],$e={},Be=u.reduce(function(Ee,Ye){var Le=T["".concat(Ye.axisType,"Map")],Ke=we["".concat(Ye.axisType,"Id")];Le&&Le[Ke]||Ye.axisType==="zAxis"||wk();var tt=Le[Ke];return en(en({},Ee),{},Ia(Ia({},Ye.axisType,tt),"".concat(Ye.axisType,"Ticks"),ay(tt)))},$e),Ve=Be[ne],ot=Be["".concat(ne,"Ticks")],At=F&&F[Me]&&F[Me].hasStack&&fUt(xe,F[Me].stackGroups),Oe=wy(xe.type).indexOf("Bar")>=0,at=Mne(Ve,ot),le=[],qe=me&&tUt({barSize:G,stackGroups:F,totalSize:CXt(Be,ne)});if(Oe){var Qe,rt,je=Ei(et)?de:et,ut=(Qe=(rt=Mne(Ve,ot,!0))!==null&&rt!==void 0?rt:je)!==null&&Qe!==void 0?Qe:0;le=rUt({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&&he.push({props:en(en({},Ce(en(en({},Be),{},{displayedData:be,props:I,dataKey:ve,item:xe,bandSize:at,barPosition:le,offset:D,stackedData:At,layout:Q,dataStartIndex:V,dataEndIndex:W}))),{},Ia(Ia(Ia({key:xe.key||"item-".concat(Te)},pe,Be[pe]),ne,Be[ne]),"animationId",U)),childIndex:rEt(xe,I.children),item:xe})}),he},b=function(I,T){var P=I.props,F=I.dataStartIndex,D=I.dataEndIndex,U=I.updateId;if(!LCe({props:P}))return null;var V=P.children,W=P.layout,G=P.stackOffset,Q=P.data,ae=P.reverseStackOrder,oe=xTe(W),de=oe.numericAxisName,se=oe.cateAxisName,pe=yf(V,s),ne=hUt(Q,pe,"".concat(de,"Id"),"".concat(se,"Id"),G,ae),me=u.reduce(function(we,ve){var et="".concat(ve.axisType,"Map");return en(en({},we),{},Ia({},et,jXt(P,en(en({},ve),{},{graphicalItems:pe,stackGroups:ve.axisType===de&&ne,dataStartIndex:F,dataEndIndex:D}))))},{}),he=SXt(en(en({},me),{},{props:P,graphicalItems:pe}),T==null?void 0:T.legendBBox);Object.keys(me).forEach(function(we){me[we]=x(P,me[we],he,we.replace("Map",""),n)});var xe=me["".concat(se,"Map")],Te=kXt(xe),be=v(P,en(en({},me),{},{dataStartIndex:F,dataEndIndex:D,updateId:U,graphicalItems:pe,stackGroups:ne,offset:he}));return en(en({formattedGraphicalItems:be,graphicalItems:pe,offset:he,stackGroups:ne},Te),me)},N=function(M){function I(T){var P,F,D;return iXt(this,I),D=cXt(this,I,[T]),Ia(D,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Ia(D,"accessibilityManager",new WYt),Ia(D,"handleLegendBBoxUpdate",function(U){if(U){var V=D.state,W=V.dataStartIndex,G=V.dataEndIndex,Q=V.updateId;D.setState(en({legendBBox:U},b({props:D.props,dataStartIndex:W,dataEndIndex:G,updateId:Q},en(en({},D.state),{},{legendBBox:U}))))}}),Ia(D,"handleReceiveSyncEvent",function(U,V,W){if(D.props.syncId===U){if(W===D.eventEmitterSymbol&&typeof D.props.syncMethod!="function")return;D.applySyncEvent(V)}}),Ia(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})}}),Ia(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;Ya(G)&&G(W,U)}}),Ia(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;Ya(G)&&G(W,U)}),Ia(D,"handleItemMouseEnter",function(U){D.setState(function(){return{isTooltipActive:!0,activeItem:U,activePayload:U.tooltipPayload,activeCoordinate:U.tooltipPosition||{x:U.cx,y:U.cy}}})}),Ia(D,"handleItemMouseLeave",function(){D.setState(function(){return{isTooltipActive:!1}})}),Ia(D,"handleMouseMove",function(U){U.persist(),D.throttleTriggeredAfterMouseMove(U)}),Ia(D,"handleMouseLeave",function(U){D.throttleTriggeredAfterMouseMove.cancel();var V={isTooltipActive:!1};D.setState(V),D.triggerSyncEvent(V);var W=D.props.onMouseLeave;Ya(W)&&W(V,U)}),Ia(D,"handleOuterEvent",function(U){var V=tEt(U),W=jm(D.props,"".concat(V));if(V&&Ya(W)){var G,Q;/.*touch.*/i.test(V)?Q=D.getMouseInfo(U.changedTouches[0]):Q=D.getMouseInfo(U),W((G=Q)!==null&&G!==void 0?G:{},U)}}),Ia(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;Ya(G)&&G(W,U)}}),Ia(D,"handleMouseDown",function(U){var V=D.props.onMouseDown;if(Ya(V)){var W=D.getMouseInfo(U);V(W,U)}}),Ia(D,"handleMouseUp",function(U){var V=D.props.onMouseUp;if(Ya(V)){var W=D.getMouseInfo(U);V(W,U)}}),Ia(D,"handleTouchMove",function(U){U.changedTouches!=null&&U.changedTouches.length>0&&D.throttleTriggeredAfterMouseMove(U.changedTouches[0])}),Ia(D,"handleTouchStart",function(U){U.changedTouches!=null&&U.changedTouches.length>0&&D.handleMouseDown(U.changedTouches[0])}),Ia(D,"handleTouchEnd",function(U){U.changedTouches!=null&&U.changedTouches.length>0&&D.handleMouseUp(U.changedTouches[0])}),Ia(D,"handleDoubleClick",function(U){var V=D.props.onDoubleClick;if(Ya(V)){var W=D.getMouseInfo(U);V(W,U)}}),Ia(D,"handleContextMenu",function(U){var V=D.props.onContextMenu;if(Ya(V)){var W=D.getMouseInfo(U);V(W,U)}}),Ia(D,"triggerSyncEvent",function(U){D.props.syncId!==void 0&&hue.emit(mue,D.props.syncId,U,D.eventEmitterSymbol)}),Ia(D,"applySyncEvent",function(U){var V=D.props,W=V.layout,G=V.syncMethod,Q=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:Q},D.state)));else if(U.activeTooltipIndex!==void 0){var de=U.chartX,se=U.chartY,pe=U.activeTooltipIndex,ne=D.state,me=ne.offset,he=ne.tooltipTicks;if(!me)return;if(typeof G=="function")pe=G(he,U);else if(G==="value"){pe=-1;for(var xe=0;xe=0){var At,Oe;if(de.dataKey&&!de.allowDuplicatedCategory){var at=typeof de.dataKey=="function"?ot:"payload.".concat(de.dataKey.toString());At=jfe(xe,at,pe),Oe=Te&&be&&jfe(be,at,pe)}else At=xe==null?void 0:xe[se],Oe=Te&&be&&be[se];if(Ie||Me){var le=U.props.activeIndex!==void 0?U.props.activeIndex:se;return[A.cloneElement(U,en(en(en({},G.props),Be),{},{activeIndex:le})),null,null]}if(!Ei(At))return[Ve].concat(m3(D.renderActivePoints({item:G,activePoint:At,basePoint:Oe,childIndex:se,isRange:Te})))}else{var qe,Qe=(qe=D.getItemByXY(D.state.activeCoordinate))!==null&&qe!==void 0?qe:{graphicalItem:Ve},rt=Qe.graphicalItem,je=rt.item,ut=je===void 0?U:je,Ce=rt.childIndex,Ee=en(en(en({},G.props),Be),{},{activeIndex:Ce});return[A.cloneElement(ut,Ee),null,null]}return Te?[Ve,null,null]:[Ve,null]}),Ia(D,"renderCustomized",function(U,V,W){return A.cloneElement(U,en(en({key:"recharts-customized-".concat(W)},D.props),D.state))}),Ia(D,"renderMap",{CartesianGrid:{handler:HO,once:!0},ReferenceArea:{handler:D.renderReferenceElement},ReferenceLine:{handler:HO},ReferenceDot:{handler:D.renderReferenceElement},XAxis:{handler:HO},YAxis:{handler:HO},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:MP("recharts"),"-clip"),D.throttleTriggeredAfterMouseMove=q$e(D.triggeredAfterMouseMove,(F=T.throttleDelay)!==null&&F!==void 0?F:1e3/60),D.state={},D}return hXt(I,M),lXt(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=sm(F,mp);if(W){var G=W.props.defaultIndex;if(!(typeof G!="number"||G<0||G>this.state.tooltipTicks.length-1)){var Q=this.state.tooltipTicks[G]&&this.state.tooltipTicks[G].value,ae=Ype(this.state,D,G,Q),oe=this.state.tooltipTicks[G].coordinate,de=(this.state.offset.top+U)/2,se=V==="horizontal",pe=se?{x:oe,y:de}:{y:oe,x:de},ne=this.state.formattedGraphicalItems.find(function(he){var xe=he.item;return xe.type.name==="Scatter"});ne&&(pe=en(en({},pe),ne.props.points[G].tooltipPosition),ae=ne.props.points[G].tooltipPayload);var me={activeTooltipIndex:G,isTooltipActive:!0,activeLabel:Q,activePayload:ae,activeCoordinate:pe};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){Nfe([sm(P.children,mp)],[sm(this.props.children,mp)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var P=sm(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=Mzt(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 Q=this.state,ae=Q.xAxisMap,oe=Q.yAxisMap,de=this.getTooltipEventType(),se=pTe(this.state,this.props.data,this.props.layout,G);if(de!=="axis"&&ae&&oe){var pe=m1(ae).scale,ne=m1(oe).scale,me=pe&&pe.invert?pe.invert(V.chartX):null,he=ne&&ne.invert?ne.invert(V.chartY):null;return en(en({},V),{},{xValue:me,yValue:he},se)}return se?en(en({},V),se):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,Q=V>=G.left&&V<=G.left+G.width&&W>=G.top&&W<=G.top+G.height;return Q?{x:V,y:W}:null}var ae=this.state,oe=ae.angleAxisMap,de=ae.radiusAxisMap;if(oe&&de){var se=m1(oe);return q5e({x:V,y:W},se)}return null}},{key:"parseEventsOfWrapper",value:function(){var P=this.props.children,F=this.getTooltipEventType(),D=sm(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=tne(this.props,this.handleOuterEvent);return en(en({},V),U)}},{key:"addListener",value:function(){hue.on(mue,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){hue.removeListener(mue,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(P,F,D){for(var U=this.state.formattedGraphicalItems,V=0,W=U.length;V");return e}const gVe=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(fVe.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(EXt,{id:i,config:s}),r.jsx(Kfe,{children:n})]})})});gVe.displayName="Chart";const EXt=({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(AXt).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},xVe=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}=pVe(),k=A.useMemo(()=>{var D;if(a||!(t!=null&&t.length))return null;const[I]=t,T=`${v||I.dataKey||I.name||"value"}`,P=Xpe(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=Xpe(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)})})]})});xVe.displayName="ChartTooltip";const IXt=A.forwardRef(({className:e,hideIcon:t=!1,payload:n,verticalAlign:s="bottom",nameKey:a},o)=>{const{config:l}=pVe();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=Xpe(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});IXt.displayName="ChartLegend";function Xpe(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 WO=["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 yVe({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(Je,{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(Je,{className:"overflow-hidden",children:r.jsx(gVe,{config:{count:{label:"Transactions",color:"hsl(var(--primary))"}},className:"h-[250px]",children:r.jsx(Kfe,{width:"100%",height:"100%",children:r.jsxs(MXt,{data:e.transactionsByMonth,margin:{top:5,right:10,left:0,bottom:5},children:[r.jsx(Qqe,{strokeDasharray:"3 3",className:"stroke-muted"}),r.jsx(Rie,{dataKey:"month",tick:{fontSize:11},className:"fill-muted-foreground",interval:0}),r.jsx(Fie,{allowDecimals:!1,tick:{fontSize:12},className:"fill-muted-foreground",width:30}),r.jsx(mp,{content:r.jsx(xVe,{})}),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(Je,{children:[r.jsx("div",{className:"h-[250px]",children:r.jsx(Kfe,{width:"100%",height:"100%",children:r.jsxs(TXt,{children:[r.jsx(Zy,{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(hie,{fill:WO[o%WO.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:WO[o%WO.length]}}),r.jsx("span",{className:"text-muted-foreground",children:a.name})]},a.name))})]})]})]})}function PXt(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(jme(a))return ln(a,"yyyy-MM-dd")}catch{}try{const s=new Date(t);if(jme(s))return ln(s,"yyyy-MM-dd")}catch{}return null}const LXt=["property_address","city","state","zip","transaction_type","close_date","sale_price","commission_amount","lead_source","client_type","is_win","notes"];function OXt({open:e,onOpenChange:t}){const[n,s]=A.useState([]),[a,o]=A.useState(!1),[l,i]=A.useState(0),{data:u}=uae(),{data:m}=qp(),x=hae(),y=()=>{const I=LXt.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,he,xe,Te;const U=[];let V="",W=!1;for(const be of F)be==='"'?W=!W:be===","&&!W?(U.push(V.trim()),V=""):V+=be;U.push(V.trim());const G=be=>{var ve;const we=P.indexOf(be);return we>=0?(ve=U[we])==null?void 0:ve.replace(/^["']|["']$/g,"").trim():""},Q=(me=G("transaction_type"))==null?void 0:me.toLowerCase(),ae=(he=G("sale_price"))==null?void 0:he.replace(/[$,]/g,""),oe=(xe=G("commission_amount"))==null?void 0:xe.replace(/[$,]/g,""),de=(Te=G("is_win"))==null?void 0:Te.toLowerCase(),se=G("close_date"),pe=PXt(se);let ne;return G("property_address")?["buyer","seller"].includes(Q)?pe?(!ae||isNaN(Number(ae)))&&(ne="Invalid sale price"):ne=`Invalid date format: "${se}" - use MM/DD/YYYY or YYYY-MM-DD`:ne='Transaction type must be "buyer" or "seller"':ne="Missing property address",{property_address:G("property_address"),city:G("city"),state:G("state"),zip:G("zip"),transaction_type:Q==="seller"?"seller":"buyer",close_date:pe||"",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(de),notes:G("notes"),error:ne}})},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(Or,{open:e,onOpenChange:t,children:r.jsxs(Lr,{className:"max-w-2xl max-h-[90vh]",children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Import Transactions"}),r.jsx(Qn,{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(X,{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(Tt,{variant:"outline",children:[n.length," rows found"]}),k>0&&r.jsxs(Tt,{className:"bg-green-500 text-white",children:[r.jsx(fi,{className:"h-3 w-3 mr-1"}),k," valid"]}),M>0&&r.jsxs(Tt,{variant:"destructive",children:[r.jsx(yl,{className:"h-3 w-3 mr-1"}),M," errors"]})]}),r.jsx(Zo,{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(Tt,{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(X,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsxs(X,{onClick:N,disabled:k===0||a,children:[r.jsx(bo,{className:"h-4 w-4 mr-2"}),"Import ",k," Transaction",k!==1?"s":""]})]})]})]})})}const DXt=P3({transactions_goal:FA().min(0).optional(),volume_goal:FA().min(0).optional(),gci_goal:FA().min(0).optional()});function RXt({open:e,onOpenChange:t,year:n,existingGoals:s}){const a=cxt(),{data:o}=mae(),l=(o==null?void 0:o.show_commission)??!0,i=Jse({resolver:eae(DXt),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(Or,{open:e,onOpenChange:t,children:r.jsxs(Lr,{className:"max-w-md",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{children:[n," Goals"]}),r.jsx(Qn,{children:"Set your annual targets to track your progress throughout the year."})]}),r.jsx(tae,{...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(Vee,{children:"Total number of deals you want to close"}),r.jsx(Ku,{})]})}),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(Vee,{children:"Total sales volume you want to achieve"}),r.jsx(Ku,{})]})}),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(Vee,{children:"Gross commission income target"}),r.jsx(Ku,{})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(X,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(X,{type:"submit",disabled:a.isPending,children:"Save Goals"})]})]})})]})})}function vVe({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(Je,{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(Je,{className:"flex flex-col items-center justify-center h-[50vh] text-center gap-3",children:[r.jsx(Fo,{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(Je,{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 _Ve=new Date().getFullYear(),FXt=Array.from({length:10},(e,t)=>_Ve-t);function zXt(){var D;const[e,t]=A.useState(_Ve),[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}=URe(e),{data:k,isLoading:M}=$Re(e),{data:I}=mae(),T=dxt(),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 de,se;return[oe.property_address,oe.city||"",oe.state||"",oe.zip||"",oe.transaction_type,oe.close_date,oe.sale_price,...N?[oe.commission_amount||""]:[],((de=oe.lead_source)==null?void 0:de.name)||"",((se=oe.client_type)==null?void 0:se.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(de=>`"${String(de).replace(/"/g,'""')}"`).join(",")).join(` `),G=new Blob([W],{type:"text/csv"}),Q=URL.createObjectURL(G),ae=document.createElement("a");ae.href=Q,ae.download=`transactions-${e}.csv`,ae.click(),URL.revokeObjectURL(Q)},F=!x||x.length===0;return r.jsxs(Dr,{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(hn,{value:String(e),onValueChange:U=>t(Number(U)),children:[r.jsx(cn,{className:"w-[120px]",children:r.jsx(fn,{})}),r.jsx(dn,{children:FXt.map(U=>r.jsx($t,{value:String(U),children:U},U))})]}),r.jsx(X,{variant:"outline",size:"icon",onClick:()=>m(!u),children:r.jsx(Bd,{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(Je,{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(Is,{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(Je,{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(X,{onClick:()=>s(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Your First Transaction"]}),r.jsxs(X,{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(X,{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(X,{onClick:()=>s(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Transaction"]}),r.jsxs(X,{variant:"outline",onClick:()=>i(!0),children:[r.jsx(yy,{className:"h-4 w-4 mr-2"}),"Set Goals"]}),r.jsxs(X,{variant:"outline",onClick:()=>o(!0),children:[r.jsx(bo,{className:"h-4 w-4 mr-2"}),"Import"]}),r.jsxs(X,{variant:"outline",onClick:P,disabled:F,children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Export"]}),r.jsx(X,{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(Je,{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(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(qn,{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(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(zd,{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(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(rh,{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(Je,{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(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(zd,{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(MBe,{goals:k,stats:v,year:e,showCommission:N}),r.jsxs(ki,{defaultValue:"transactions",className:"space-y-4",children:[r.jsxs(wi,{children:[r.jsx(an,{value:"transactions",children:"Transactions"}),r.jsx(an,{value:"charts",children:"Charts"}),r.jsxs(an,{value:"map",children:[r.jsx(Fo,{className:"h-4 w-4 mr-1"}),"Map"]})]}),r.jsx(Cn,{value:"transactions",children:r.jsx(CBe,{transactions:x||[],showCommission:N,isLoading:y})}),r.jsx(Cn,{value:"charts",children:r.jsx(yVe,{stats:v,year:e})}),r.jsx(Cn,{value:"map",children:r.jsx(vVe,{transactions:x||[],isLoading:y})})]})]})]}),r.jsx(SBe,{open:n,onOpenChange:s}),r.jsx(OXt,{open:a,onOpenChange:o}),r.jsx(RXt,{open:l,onOpenChange:i,year:e,existingGoals:k})]})}function bVe({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(Or,{open:e,onOpenChange:t,children:r.jsxs(Lr,{className:"sm:max-w-md",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(Ds,{className:"h-5 w-5 text-amber-500"}),"Share & Earn Leads"]}),r.jsx(Qn,{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(X,{onClick:b,disabled:u||!v,variant:x?"default":"outline",children:x?r.jsx(fi,{className:"h-4 w-4"}):r.jsx(Oo,{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(X,{variant:"outline",className:"flex-1",onClick:()=>N("email"),disabled:u,children:[r.jsx(ks,{className:"h-4 w-4 mr-2"}),"Email"]}),r.jsxs(X,{variant:"outline",className:"flex-1",onClick:()=>N("text"),disabled:u,children:[r.jsx(zo,{className:"h-4 w-4 mr-2"}),"Text"]}),r.jsxs(X,{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(qn,{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 BXt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},$Xt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},UXt={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function GO({listing:e,onClick:t,onEdit:n,onDelete:s,showActions:a}){var k,M;const{user:o}=tn(),{data:l}=LRe(e.id),i=PRe(),[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(Tt,{className:`absolute top-2 left-2 ${BXt[e.status]} text-white border-0`,children:$Xt[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(Ss,{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(X,{size:"icon",variant:"secondary",className:"h-8 w-8",onClick:b,children:r.jsx(bi,{className:`h-4 w-4 ${l?"fill-pink-500 text-pink-500":""}`})}),r.jsx(X,{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(Ds,{className:"h-4 w-4 text-amber-500"})})]})]}),r.jsx(bVe,{open:u,onOpenChange:m,listingId:e.id,listingSlug:e.slug||null,listingTitle:e.property_address||`${e.city}, ${e.state}`}),r.jsxs(Je,{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(Tt,{variant:"outline",className:"text-xs",children:[r.jsx(qn,{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(Fo,{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(U1,{className:"h-4 w-4"}),e.bedrooms," bd"]}),e.bathrooms&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx($1,{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(Tt,{variant:"secondary",className:"text-xs",children:UXt[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(bi,{className:"h-3 w-3"}),e.save_count]})]}),a&&(n||s)&&r.jsxs("div",{className:"flex gap-2",children:[n&&r.jsxs(X,{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(X,{variant:"destructive",size:"sm",onClick:I=>{I.stopPropagation(),s()},children:r.jsx(Un,{className:"h-4 w-4"})})]})]})]})}const qXt=[{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"}],VXt=[{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 HXt({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(X,{variant:"ghost",size:"sm",onClick:s,children:"Clear All"}),r.jsx(X,{variant:"ghost",size:"icon",onClick:n,children:r.jsx(us,{className:"h-4 w-4"})})]})]}),r.jsxs(Je,{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(hn,{value:e.status||"all",onValueChange:a=>t({...e,status:a==="all"?void 0:a}),children:[r.jsx(cn,{children:r.jsx(fn,{placeholder:"All statuses"})}),r.jsxs(dn,{children:[r.jsx($t,{value:"all",children:"All Statuses"}),qXt.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(hn,{value:e.propertyType||"all",onValueChange:a=>t({...e,propertyType:a==="all"?void 0:a}),children:[r.jsx(cn,{children:r.jsx(fn,{placeholder:"All types"})}),r.jsxs(dn,{children:[r.jsx($t,{value:"all",children:"All Types"}),VXt.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(Is,{checked:e.openToReferrals||!1,onCheckedChange:a=>t({...e,openToReferrals:a||void 0})})]})]})]})}function WXt({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(fy,{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(Tt,{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(Je,{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(fy,{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(Je,{children:r.jsxs(ki,{defaultValue:"sharers",children:[r.jsxs(wi,{className:"w-full",children:[r.jsxs(an,{value:"sharers",className:"flex-1",children:[r.jsx(Nc,{className:"h-4 w-4 mr-2"}),"Top Sharers"]}),r.jsxs(an,{value:"listers",className:"flex-1",children:[r.jsx(ya,{className:"h-4 w-4 mr-2"}),"Top Contributors"]})]}),r.jsx(Cn,{value:"sharers",className:"mt-4",children:n(e==null?void 0:e.topSharers,"shares")}),r.jsx(Cn,{value:"listers",className:"mt-4",children:n(e==null?void 0:e.topListers,"listings")})]})})]})]})}const yTe={coming_soon:"#F59E0B",active:"#10B981",price_improvement:"#8B5CF6",under_contract:"#3B82F6",sold:"#A855F7"},vTe={coming_soon:"Coming Soon",active:"Active",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"};function GXt(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:`$${(e/1e3).toFixed(0)}K`}function KXt({listings:e,isLoading:t}){const n=Wn(),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=yTe[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?``:""}
${GXt(M.price)}
${M.property_address||""}
${M.city}, ${M.state}
${vTe[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(Je,{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(Je,{className:"flex flex-col items-center justify-center h-[60vh] text-center gap-3",children:[r.jsx(Fo,{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(yTe).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:vTe[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(Je,{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 ZXt(){var G,Q,ae,oe,de,se,pe,ne;const e=Wn(),{brokerageId:t}=tn(),{data:n,isLoading:s}=MRe(),[a,o]=A.useState("feed"),[l,i]=A.useState(!1),[u,m]=A.useState(""),[x,y]=A.useState({sortBy:"newest"}),{data:v,isLoading:b}=TRe({...x,city:u||x.city}),{data:N,isLoading:k}=Ggt(),{data:M,isLoading:I}=ARe(),{data:T,isLoading:P}=Xgt(),{data:F,isLoading:D}=ext(),{data:U}=Jgt(),V=IRe(),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(Dr,{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(Dr,{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(X,{onClick:()=>e("/mission-control/listings/new"),children:[r.jsx(bn,{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(Je,{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(Je,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-pink-500/10 rounded-lg",children:r.jsx(bi,{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(Je,{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(Je,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-sky-500/10 rounded-lg",children:r.jsx(qn,{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)+(((Q=T==null?void 0:T.received)==null?void 0:Q.length)||0)}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Referrals"})]})]})})]}),r.jsxs(ki,{value:a,onValueChange:o,children:[r.jsxs(wi,{className:"w-full justify-start overflow-x-auto",children:[r.jsx(an,{value:"feed",children:"Community Feed"}),t&&r.jsx(an,{value:"brokerage",children:"Brokerage"}),r.jsx(an,{value:"my-listings",children:"My Listings"}),r.jsx(an,{value:"saved",children:"Saved"}),r.jsx(an,{value:"referrals",children:"Referrals"}),r.jsx(an,{value:"map",children:"Map"}),r.jsx(an,{value:"leaderboard",children:"Leaderboard"})]}),r.jsxs(Cn,{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(hn,{value:x.sortBy,onValueChange:me=>y({...x,sortBy:me}),children:[r.jsx(cn,{className:"w-[180px]",children:r.jsx(fn,{placeholder:"Sort by"})}),r.jsxs(dn,{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(X,{variant:"outline",onClick:()=>i(!l),children:[r.jsx(W1,{className:"h-4 w-4 mr-2"}),"Filters"]})]}),l&&r.jsx(HXt,{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,he)=>r.jsxs(He,{children:[r.jsx(Tr,{className:"h-48 w-full"}),r.jsxs(Je,{className:"p-4 space-y-2",children:[r.jsx(Tr,{className:"h-5 w-3/4"}),r.jsx(Tr,{className:"h-4 w-1/2"}),r.jsx(Tr,{className:"h-4 w-1/4"})]})]},he))}):(v==null?void 0:v.length)===0?r.jsx(He,{children:r.jsxs(Je,{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(X,{onClick:()=>e("/mission-control/listings/new"),children:[r.jsx(bn,{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(GO,{listing:me,onClick:()=>e(`/mission-control/listings/${me.id}`)},me.id))})]}),r.jsx(Cn,{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,he)=>r.jsxs(He,{children:[r.jsx(Tr,{className:"h-48 w-full"}),r.jsxs(Je,{className:"p-4 space-y-2",children:[r.jsx(Tr,{className:"h-5 w-3/4"}),r.jsx(Tr,{className:"h-4 w-1/2"})]})]},he))}):(M==null?void 0:M.length)===0?r.jsx(He,{children:r.jsxs(Je,{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(X,{onClick:()=>e("/mission-control/listings/new"),children:[r.jsx(bn,{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(GO,{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(Cn,{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,he)=>r.jsxs(He,{children:[r.jsx(Tr,{className:"h-48 w-full"}),r.jsxs(Je,{className:"p-4 space-y-2",children:[r.jsx(Tr,{className:"h-5 w-3/4"}),r.jsx(Tr,{className:"h-4 w-1/2"})]})]},he))}):(N==null?void 0:N.length)===0?r.jsx(He,{children:r.jsxs(Je,{className:"py-12 text-center",children:[r.jsx(bi,{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(GO,{listing:me.listing,onClick:()=>e(`/mission-control/listings/${me.listing.id}`)},me.id))})}),r.jsx(Cn,{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(Je,{className:"py-8 text-center text-muted-foreground",children:"No referrals sent yet"})}):r.jsx("div",{className:"space-y-3",children:(de=T==null?void 0:T.sent)==null?void 0:de.map(me=>{var he,xe;return r.jsx(He,{children:r.jsx(Je,{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:((he=me.listing)==null?void 0:he.property_address)||((xe=me.listing)==null?void 0:xe.city)})]}),r.jsx(Tt,{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(qn,{className:"h-4 w-4"}),"Referrals Received (",((se=T==null?void 0:T.received)==null?void 0:se.length)||0,")"]}),((pe=T==null?void 0:T.received)==null?void 0:pe.length)===0?r.jsx(He,{children:r.jsx(Je,{className:"py-8 text-center text-muted-foreground",children:"No referrals received yet"})}):r.jsx("div",{className:"space-y-3",children:(ne=T==null?void 0:T.received)==null?void 0:ne.map(me=>{var he;return r.jsx(He,{children:r.jsxs(Je,{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: ",(he=me.sender)==null?void 0:he.name]})]}),r.jsx(Tt,{variant:me.status==="closed"?"default":"secondary",children:me.status.replace("_"," ")})]}),r.jsx(X,{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(Cn,{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,he)=>r.jsxs(He,{children:[r.jsx(Tr,{className:"h-48 w-full"}),r.jsxs(Je,{className:"p-4 space-y-2",children:[r.jsx(Tr,{className:"h-5 w-3/4"}),r.jsx(Tr,{className:"h-4 w-1/2"})]})]},he))}):(F==null?void 0:F.length)===0?r.jsx(He,{children:r.jsxs(Je,{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(X,{onClick:()=>e("/mission-control/listings/new"),children:[r.jsx(bn,{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(GO,{listing:me,onClick:()=>e(`/mission-control/listings/${me.id}`)},me.id))})}),r.jsx(Cn,{value:"map",children:r.jsx(KXt,{listings:v||[],isLoading:b})}),r.jsx(Cn,{value:"leaderboard",children:r.jsx(WXt,{leaderboard:U})})]})]})}):r.jsx(Dr,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:r.jsx(He,{children:r.jsxs(Je,{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 ive(){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 wVe(){const e=Yc(),t=qr();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 jVe(){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 kVe(){const e=Yc(),t=qr();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 NVe(){const e=qr();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 YXt(){const e=qr();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 XXt(){const e=qr();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 QXt(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 JXt(){const e=qr();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 eQt(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 tQt(){const e=qr();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 rQt(){const e=qr();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 nQt(){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 sQt(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 aQt(){const e=qr();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 iQt(){const e=qr();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 oQt({listing:e}){const t=Wn(),[n,s]=A.useState(""),[a,o]=A.useState(!1),{data:l,isLoading:i}=sQt(e.id),{data:u,isLoading:m}=ive(),{data:x,isLoading:y}=jVe(),v=wVe(),b=aQt(),N=iQt(),k=kVe(),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(Je,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(Wr,{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(xm,{className:"h-4 w-4 text-primary"}),"Linked to Pipeline"]})}),r.jsxs(Je,{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(Tt,{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(X,{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(X,{variant:"ghost",size:"sm",onClick:F,disabled:N.isPending,children:N.isPending?r.jsx(Wr,{className:"h-4 w-4 animate-spin"}):r.jsx(EA,{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(Je,{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(X,{onClick:T,disabled:a||k.isPending,className:"w-full",size:"sm",children:[a||k.isPending?r.jsx(Wr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(bn,{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(hn,{value:n,onValueChange:s,children:[r.jsx(cn,{className:"flex-1 text-sm",children:r.jsx(fn,{placeholder:"Link to existing deal..."})}),r.jsx(dn,{children:M.map(D=>r.jsx($t,{value:D.id,children:D.deal_name},D.id))})]}),r.jsx(X,{variant:"secondary",size:"icon",onClick:P,disabled:!n||b.isPending,children:b.isPending?r.jsx(Wr,{className:"h-4 w-4 animate-spin"}):r.jsx(xm,{className:"h-4 w-4"})})]})]})]})]})}const lQt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},cQt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},_Te={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function dQt(){var de,se,pe,ne,me,he,xe,Te,be;const{listingId:e}=Ec(),t=Wn(),{user:n}=tn(),{data:s,isLoading:a}=ERe(e||""),{data:o}=LRe(e||""),{data:l}=Zgt(e||""),i=PRe(),u=Kgt(),m=Ygt(),x=IRe(),y=Qgt(),[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)}`,et=`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(`${et} ${ve}`)}`);break;case"email":window.open(`mailto:?subject=${encodeURIComponent(et)}&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")}},Q=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}`,et=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} ${et} ${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 ${et}! ${Be} Don't miss this opportunity! #PriceReduced #RealEstate #HomeForSale`;case"teaser":return`Looking for a ${_Te[(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(Dr,{title:"Listing",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tr,{className:"h-10 w-32"}),r.jsx(Tr,{className:"h-[400px] w-full"}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsx(Tr,{className:"h-48"}),r.jsx(Tr,{className:"h-48"}),r.jsx(Tr,{className:"h-48"})]})]})});if(!s)return r.jsx(Dr,{title:"Listing Not Found",description:"",children:r.jsx(He,{children:r.jsxs(Je,{className:"py-12 text-center",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing could not be found."}),r.jsx(X,{onClick:()=>t("/mission-control/listings"),children:"Back to Listings"})]})})});const oe=((de=s.photos)==null?void 0:de.find(we=>we.is_primary))||((se=s.photos)==null?void 0:se[0]);return r.jsxs(Dr,{title:"",description:"",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs(X,{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:(pe=s.photos)==null?void 0:pe.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(Je,{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(Tt,{className:`${lQt[s.status]} text-white border-0`,children:cQt[s.status]}),s.is_featured&&r.jsxs(Tt,{variant:"outline",className:"border-amber-500 text-amber-500",children:[r.jsx(Ss,{className:"h-3 w-3 mr-1 fill-amber-500"}),"Featured"]}),s.open_to_referrals&&r.jsxs(Tt,{variant:"outline",children:[r.jsx(qn,{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(Fo,{className:"h-4 w-4"}),s.city,", ",s.state,s.neighborhood&&` • ${s.neighborhood}`]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(X,{variant:"outline",size:"icon",onClick:()=>i.mutate(s.id),children:r.jsx(bi,{className:`h-4 w-4 ${o?"fill-pink-500 text-pink-500":""}`})}),r.jsx(X,{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(X,{variant:"outline",className:"border-amber-500 text-amber-600 hover:bg-amber-50",onClick:()=>I(!0),children:[r.jsx(Ds,{className:"h-4 w-4 mr-2"}),"Share & Earn Leads"]}),r.jsxs(dh,{children:[r.jsx(uh,{asChild:!0,children:r.jsxs(X,{variant:"outline",children:[r.jsx(Nc,{className:"h-4 w-4 mr-2"}),"Share"]})}),r.jsxs(Nu,{children:[r.jsxs(Ha,{onClick:()=>W("copy"),children:[r.jsx(Oo,{className:"h-4 w-4 mr-2"}),"Copy Link"]}),r.jsxs(Ha,{onClick:()=>W("facebook"),children:[r.jsx(au,{className:"h-4 w-4 mr-2"}),"Facebook"]}),r.jsxs(Ha,{onClick:()=>W("text"),children:[r.jsx(zo,{className:"h-4 w-4 mr-2"}),"Text"]}),r.jsxs(Ha,{onClick:()=>W("email"),children:[r.jsx(ks,{className:"h-4 w-4 mr-2"}),"Email"]})]})]}),U&&r.jsxs(r.Fragment,{children:[r.jsxs(X,{variant:"outline",onClick:()=>t(`/mission-control/listings/${s.id}/edit`),children:[r.jsx(gc,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsx(X,{variant:"destructive",size:"icon",onClick:()=>b(!0),children:r.jsx(Un,{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(U1,{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($1,{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(Ts,{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(Tt,{variant:"secondary",children:[r.jsx(mi,{className:"h-3 w-3 mr-1"}),_Te[s.property_type]]}),s.lot_size&&r.jsxs(Tt,{variant:"secondary",children:["Lot: ",s.lot_size]}),s.has_hoa&&r.jsx(Tt,{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(X,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:s.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Ms,{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(bi,{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(Je,{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(X,{size:"sm",variant:"ghost",onClick:()=>{navigator.clipboard.writeText(ae(we)),Ae.success("Caption copied!")},children:r.jsx(Oo,{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(Je,{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=(ne=s.agent)==null?void 0:ne.name)==null?void 0:me.charAt(0))||"?"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((he=s.agent)==null?void 0:he.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:((be=s.agent)==null?void 0:be.email)&&r.jsx(X,{variant:"outline",className:"w-full",asChild:!0,children:r.jsxs("a",{href:`mailto:${s.agent.email}`,children:[r.jsx(ks,{className:"h-4 w-4 mr-2"}),"Email Agent"]})})})]})]}),U&&r.jsx(oQt,{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(qn,{className:"h-5 w-5"}),"Send a Buyer"]})}),r.jsxs(Je,{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(X,{className:"w-full",onClick:()=>k(!0),children:"Send Referral"})]})]})]})]})]}),r.jsx(Or,{open:!!T,onOpenChange:()=>P(null),children:r.jsx(Lr,{className:"max-w-4xl",children:r.jsx("img",{src:T||"",alt:"Full size",className:"w-full h-auto"})})}),r.jsx(Or,{open:v,onOpenChange:b,children:r.jsxs(Lr,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Delete Listing"}),r.jsx(Qn,{children:"Are you sure you want to delete this listing? This action cannot be undone."})]}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>b(!1),children:"Cancel"}),r.jsx(X,{variant:"destructive",onClick:G,disabled:x.isPending,children:x.isPending?"Deleting...":"Delete"})]})]})}),r.jsx(Or,{open:N,onOpenChange:k,children:r.jsxs(Lr,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Send Buyer Referral"}),r.jsx(Qn,{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(hn,{value:F.buyerType,onValueChange:we=>D({...F,buyerType:we}),children:[r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select type"})}),r.jsxs(dn,{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(Xn,{value:F.notes,onChange:we=>D({...F,notes:we.target.value}),placeholder:"Any additional information..."})]})]}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>k(!1),children:"Cancel"}),r.jsx(X,{onClick:Q,disabled:y.isPending,children:y.isPending?"Sending...":"Send Referral"})]})]})}),r.jsx(bVe,{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 uQt({selectedVideoId:e,onVideoSelect:t,listingId:n}){const s=Wn(),{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:Q}=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();!Q&&G&&(v(G),M(G))},M=async G=>{try{const{data:Q,error:ae}=await Y.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:G.bunny_video_id,isAgentVideo:!0}});!ae&&(Q!=null&&Q.thumbnailUrl)&&N(oe=>({...oe,[G.id]:{thumbnailUrl:Q.thumbnailUrl}}))}catch(Q){console.warn("Failed to get signed URL",Q)}},I=async()=>{if(a){x(!0);try{const{data:G,error:Q}=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(Q)throw Q;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 Q;try{const ae=G.map(ne=>ne.bunny_video_id),{data:oe,error:de}=await Y.functions.invoke("bunny-upload",{body:{action:"bulk-asset-urls",videoIds:ae,isAgentVideo:!0}});if(de)throw de;const se=(oe==null?void 0:oe.assets)||{},pe={};for(const ne of G)(Q=se[ne.bunny_video_id])!=null&&Q.thumbnailUrl&&(pe[ne.id]={thumbnailUrl:se[ne.bunny_video_id].thumbnailUrl});N(ne=>({...ne,...pe}))}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 Q=Math.floor(G/60),ae=G%60;return`${Q}:${ae.toString().padStart(2,"0")}`},W=G=>{var Q;return((Q=b[G.id])==null?void 0:Q.thumbnailUrl)||G.thumbnail_url};return r.jsxs("div",{className:"space-y-3",children:[y?r.jsx(He,{className:"overflow-hidden",children:r.jsx(Je,{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(Pa,{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(X,{type:"button",variant:"outline",size:"sm",onClick:P,children:"Change"}),r.jsx(X,{type:"button",variant:"ghost",size:"sm",onClick:D,className:"text-destructive hover:text-destructive",children:r.jsx(us,{className:"h-4 w-4"})})]})]})})}):r.jsx(He,{className:"border-dashed",children:r.jsx(Je,{className:"p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Pa,{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(X,{type:"button",variant:"outline",onClick:P,className:"gap-2",children:[r.jsx(C4,{className:"h-4 w-4"}),"Select from Library"]}),r.jsxs(X,{type:"button",variant:"outline",onClick:U,className:"gap-2",children:[r.jsx(Rg,{className:"h-4 w-4"}),"Record New Video"]})]})]})})}),r.jsx(Or,{open:o,onOpenChange:l,children:r.jsxs(Lr,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsx(zr,{children:r.jsxs(Fr,{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(Wr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):i.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Pa,{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(X,{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(Pa,{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(X,{type:"button",variant:"ghost",onClick:U,className:"gap-2",children:[r.jsx(Rg,{className:"h-4 w-4"}),"Record New Video"]}),r.jsx(X,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"})]})]})})]})}const hQt=[{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"}],mQt=[{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 bTe(){var pe;const{listingId:e}=Ec(),[t]=Zc(),n=t.get("brokerage"),s=Wn(),{user:a}=tn(),o=!!e&&e!=="new",l=!!n&&!o,{data:i,isLoading:u}=ERe(o?e:""),m=Ugt(),x=qgt(),y=Vgt(),v=Hgt(),b=Wgt(),{data:N=[]}=Zt({queryKey:["brokerage-agents",n],queryFn:async()=>{if(!n)return[];const{data:ne,error:me}=await Y.from("profiles").select("id, name, email").eq("brokerage_id",n).order("name");if(me)throw me;return ne||[]},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 ne,me,he,xe,Te;i&&o&&W({property_address:i.property_address||"",city:i.city||"",state:i.state||"",neighborhood:i.neighborhood||"",price:((ne=i.price)==null?void 0:ne.toString())||"",property_type:i.property_type,status:i.status,bedrooms:((me=i.bedrooms)==null?void 0:me.toString())||"",bathrooms:((he=i.bathrooms)==null?void 0:he.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=ne=>{if(!ne)return;const me=Array.from(ne);F(xe=>[...xe,...me]);const he=me.map(xe=>URL.createObjectURL(xe));U(xe=>[...xe,...he])},Q=ne=>{URL.revokeObjectURL(D[ne]),F(me=>me.filter((he,xe)=>xe!==ne)),U(me=>me.filter((he,xe)=>xe!==ne))},ae=async ne=>{var me;if(!(!ne||!i)){T(!0);try{for(const he of Array.from(ne)){const xe=he.name.split(".").pop(),Te=`${a==null?void 0:a.id}/${i.id}/${Date.now()}.${xe}`,{error:be}=await Y.storage.from("listing-photos").upload(Te,he);if(be)throw be;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(he){console.error("Upload error:",he),Ae.error("Failed to upload photos")}finally{T(!1)}}},oe=async ne=>{for(let me=0;me{if(i)try{await b.mutateAsync({photoId:ne,listingId:i.id}),Ae.success("Photo removed")}catch{Ae.error("Failed to remove photo")}},se=async ne=>{if(ne.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 he;if(l&&k?he=await x.mutateAsync({agentId:k,...me}):he=await m.mutateAsync(me),P.length>0)try{await oe(he.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/${he.id}`)}}catch(me){console.error("Save error:",me),Ae.error("Failed to save listing"),T(!1)}};return o&&u?r.jsx(Dr,{title:"Loading...",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tr,{className:"h-10 w-32"}),r.jsx(Tr,{className:"h-[600px] w-full"})]})}):r.jsx(Dr,{title:o?"Edit Listing":l?"Add Listing for Agent":"Add Listing",description:"",children:r.jsxs("form",{onSubmit:se,className:"space-y-6",children:[r.jsxs(X,{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(Je,{children:[r.jsxs(hn,{value:k,onValueChange:M,children:[r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select an agent..."})}),r.jsx(dn,{children:N.map(ne=>r.jsx($t,{value:ne.id,children:ne.name||ne.email},ne.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(Je,{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:ne=>W({...V,property_address:ne.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:ne=>W({...V,city:ne.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:ne=>W({...V,state:ne.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:ne=>W({...V,neighborhood:ne.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:ne=>W({...V,price:ne.target.value}),placeholder:"500000",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Property Type"}),r.jsxs(hn,{value:V.property_type,onValueChange:ne=>W({...V,property_type:ne}),children:[r.jsx(cn,{children:r.jsx(fn,{})}),r.jsx(dn,{children:mQt.map(ne=>r.jsx($t,{value:ne.value,children:ne.label},ne.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Status"}),r.jsxs(hn,{value:V.status,onValueChange:ne=>W({...V,status:ne}),children:[r.jsx(cn,{children:r.jsx(fn,{})}),r.jsx(dn,{children:hQt.map(ne=>r.jsx($t,{value:ne.value,children:ne.label},ne.value))})]})]})]})})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{children:"Property Specs (Optional)"})}),r.jsx(Je,{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:ne=>W({...V,bedrooms:ne.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:ne=>W({...V,bathrooms:ne.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:ne=>W({...V,square_footage:ne.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:ne=>W({...V,lot_size:ne.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:ne=>W({...V,year_built:ne.target.value}),placeholder:"2005"})]}),r.jsxs("div",{className:"flex items-center gap-2 pt-6",children:[r.jsx(Is,{checked:V.has_hoa,onCheckedChange:ne=>W({...V,has_hoa:ne})}),r.jsx(ze,{children:"Has HOA"})]})]})})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{children:"Description & Links"})}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Description"}),r.jsx(Xn,{value:V.description,onChange:ne=>W({...V,description:ne.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(Xn,{value:V.agent_notes,onChange:ne=>W({...V,agent_notes:ne.target.value}),placeholder:"Notes for other agents...",rows:2}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Is,{checked:V.agent_notes_public,onCheckedChange:ne=>W({...V,agent_notes_public:ne})}),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:ne=>W({...V,mls_link:ne.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:ne=>W({...V,video_link:ne.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(Pa,{className:"h-5 w-5"}),"Property Video"]})}),r.jsx(Je,{children:r.jsx(uQt,{selectedVideoId:V.video_id,onVideoSelect:ne=>W({...V,video_id:ne}),listingId:o?e:void 0})})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{children:"Photos"})}),r.jsxs(Je,{children:[r.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-4",children:[o&&((pe=i==null?void 0:i.photos)==null?void 0:pe.map(ne=>r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:ne.photo_url,alt:"",className:"w-full h-full object-cover"}),r.jsx("button",{type:"button",onClick:()=>de(ne.id),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:r.jsx(us,{className:"h-3 w-3"})}),ne.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"})]},ne.id))),!o&&D.map((ne,me)=>r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:ne,alt:"",className:"w-full h-full object-cover"}),r.jsx("button",{type:"button",onClick:()=>Q(me),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:r.jsx(us,{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(Wr,{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:ne=>o?ae(ne.target.files):G(ne.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(Je,{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(Is,{checked:V.allow_sharing,onCheckedChange:ne=>W({...V,allow_sharing:ne})})]}),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(Is,{checked:V.open_to_referrals,onCheckedChange:ne=>W({...V,open_to_referrals:ne})})]}),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(Is,{checked:V.open_to_social_promotion,onCheckedChange:ne=>W({...V,open_to_social_promotion:ne})})]}),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(Is,{checked:V.share_with_brokerage,onCheckedChange:ne=>W({...V,share_with_brokerage:ne})})]}),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(Is,{checked:V.is_public,onCheckedChange:ne=>W({...V,is_public:ne})})]})]})]}),r.jsx(X,{type:"submit",className:"w-full",size:"lg",disabled:m.isPending||y.isPending,children:m.isPending||y.isPending?r.jsxs(r.Fragment,{children:[r.jsx(Wr,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):o?"Update Listing":"Create Listing"})]})]})]})})}function SVe({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=$3(),[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,Q]=A.useState(null),[ae,oe]=A.useState(null),[de,se]=A.useState(0),[pe,ne]=A.useState("user"),[me,he]=A.useState(0),[xe,Te]=A.useState(!1),[be,we]=A.useState(!0),[ve,et]=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 At=A.useCallback(ct=>{M(ct)},[]),Oe=A.useRef(k),at=A.useCallback(async()=>{var it,zt;T(!0),et(null);const ct=N&&k;console.log("[VideoRecorder] initCamera start",{isMobile:N,usePortraitMode:k,shouldBePortrait:ct,facingMode:pe});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(rn=>rn.stop()));const ir=N&&ct?{facingMode:{ideal:pe},width:{ideal:720},height:{ideal:1280}}:{facingMode:{ideal:pe},width:{ideal:1280},height:{ideal:720}};console.log("[VideoRecorder] requesting getUserMedia",ir);const Mr=await navigator.mediaDevices.getUserMedia({video:ir,audio:{echoCancellation:!0,noiseSuppression:!0}});if(console.log("[VideoRecorder] getUserMedia success"),Mr.getVideoTracks().length===0)throw new Error("Camera stream started but no video track was provided.");u.current=Mr,F(!0);const Br=Mr.getVideoTracks()[0].getSettings();if(console.log("[VideoRecorder] Camera initialized with dimensions:",Br.width,"x",Br.height),l.current){const rn=l.current;rn.srcObject=Mr,rn.muted=!0,rn.playsInline=!0,rn.autoplay=!0,rn.setAttribute("muted",""),rn.setAttribute("playsinline",""),rn.setAttribute("autoplay","");try{(it=rn.load)==null||it.call(rn)}catch(Ot){console.warn("[VideoRecorder] videoEl.load failed",Ot)}const Zn=async()=>{try{return await rn.play(),console.log("[VideoRecorder] preview play ok"),Ie(!1),setTimeout(()=>{console.debug("[VideoRecorder] preview metrics",{readyState:rn.readyState,videoWidth:rn.videoWidth,videoHeight:rn.videoHeight})},300),!0}catch(Ot){return console.warn("[VideoRecorder] preview play blocked",Ot),Ie(!0),!1}};await new Promise(Ot=>{let Gr=!1;const An=()=>{Gr||(Gr=!0,Ot())},zn=()=>{Zn().finally(An)};rn.onloadedmetadata=zn,rn.onloadeddata=zn,setTimeout(An,1500)})}try{y.current=new AudioContext;const rn=y.current.createMediaStreamSource(Mr);v.current=y.current.createAnalyser(),v.current.fftSize=256,rn.connect(v.current);const Zn=()=>{if(v.current){const Ot=new Uint8Array(v.current.frequencyBinCount);v.current.getByteFrequencyData(Ot);const Gr=Ot.reduce((An,zn)=>An+zn)/Ot.length;he(Math.min(100,Gr/128*100))}b.current=requestAnimationFrame(Zn)};Zn()}catch(rn){console.warn("Audio context not available:",rn)}}catch(ir){console.error("Camera initialization error:",ir),F(!1);let Mr="Failed to access camera or microphone.";ir.name==="NotAllowedError"?Mr="Camera permission denied. Please allow camera access in your browser settings.":ir.name==="NotFoundError"?Mr="No camera found. Please connect a camera and try again.":ir.name==="NotReadableError"?Mr="Camera is in use by another application. Please close other apps using the camera.":ir.message&&(Mr=ir.message),et(Mr),(zt=ot.current)==null||zt.call(ot,Mr)}finally{T(!1)}},[pe,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)},[]),Qe=A.useCallback(()=>{if(!u.current)return;le(),m.current=[],se(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(ir=>MediaRecorder.isTypeSupported(ir)),zt=new MediaRecorder(u.current,it?{mimeType:it,videoBitsPerSecond:25e5}:{videoBitsPerSecond:25e5});zt.ondataavailable=ir=>{ir.data.size>0&&m.current.push(ir.data)},zt.onstop=()=>{var Br;const ir=zt.mimeType||it||((Br=m.current[0])==null?void 0:Br.type)||"video/webm",Mr=new Blob(m.current,{type:ir});Q(Mr);const Zr=URL.createObjectURL(Mr);oe(Zr)},i.current=zt,zt.start(100),U(!0),x.current=setInterval(()=>{se(ir=>ir>=e-1?(qe(),e):ir+1)},1e3)},[le,e,qe]),rt=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),Qe()):Be(ct)},1e3)},[$e,Qe]),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(()=>{se(ct=>ct>=e-1?(qe(),e):ct+1)},1e3))},[e,qe]),Ce=A.useCallback(()=>{ae&&URL.revokeObjectURL(ae),Q(null),oe(null),se(0),Te(!1),we(!0),l.current&&u.current&&(l.current.srcObject=u.current,l.current.muted=!0,le())},[le,ae]),Ee=A.useCallback(()=>{ne(ct=>ct==="user"?"environment":"user")},[]),Ye=A.useCallback(()=>{G&&t(G,de)},[G,de,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 Mr;const zt=ct.error,ir=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),(Mr=ot.current)==null||Mr.call(ot,ir)};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(Wr,{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(X,{onClick:()=>at(),variant:"secondary",className:"w-full",children:[r.jsx(Wo,{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(Is,{id:"orientation-toggle",checked:k,onCheckedChange:At}),r.jsx(ze,{htmlFor:"orientation-toggle",className:"text-sm text-muted-foreground",children:"Portrait"}),r.jsx(xy,{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,pe==="user"&&!ae&&"scale-x-[-1]"),playsInline:!0,controls:!!ae,muted:ae?be:!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(X,{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(de)," / ",Ke(e)]})]}),D&&r.jsx("div",{className:"absolute top-0 left-0 right-0",children:r.jsx(Mc,{value:de/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(gA,{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(X,{variant:"secondary",size:"lg",className:"bg-white/20 hover:bg-white/30 text-white",onClick:Ce,children:[r.jsx(Wo,{className:"h-5 w-5 mr-2"}),"Re-record"]}),r.jsx(X,{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(vm,{className:"h-5 w-5"}):r.jsx(Vl,{className:"h-5 w-5"})}),r.jsxs(X,{size:"lg",className:"bg-green-500 hover:bg-green-600 text-white",onClick:Ye,children:[r.jsx(fi,{className:"h-5 w-5 mr-2"}),"Use This Video"]})]}):r.jsxs(r.Fragment,{children:[r.jsx(X,{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(D4,{className:"h-5 w-5"})}),!D&&$e===null?r.jsx(X,{size:"icon",className:"h-16 w-16 rounded-full bg-red-500 hover:bg-red-600 text-white",onClick:rt,children:r.jsx(Pa,{className:"h-6 w-6"})}):r.jsxs(r.Fragment,{children:[r.jsx(X,{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(vm,{className:"h-5 w-5"})}),r.jsx(X,{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 CVe="teleprompter_settings",pue={scrollSpeed:30,fontSize:24,lineHeight:1.6,opacity:.85,position:"top",isMirrored:!1};function fQt(){try{const e=localStorage.getItem(CVe);return e?{...pue,...JSON.parse(e)}:pue}catch{return pue}}function pQt(e){try{localStorage.setItem(CVe,JSON.stringify(e))}catch{}}function MVe({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(fQt),{scrollSpeed:b,fontSize:N,lineHeight:k,opacity:M,position:I,isMirrored:T}=y,P=A.useCallback((oe,de)=>{v(se=>{const pe={...se,[oe]:de};return pQt(pe),pe})},[]),[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 de=oe-m.current;m.current=oe,x.current+=b*de/1e3;const se=Math.floor(x.current);se>0&&(i.current.scrollTop+=se,x.current-=se);const{scrollTop:pe,scrollHeight:ne,clientHeight:me}=i.current;if(pe+me>=ne){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 de=setInterval(()=>{oe-=1,oe<=0?(clearInterval(de),V(null),o==null||o(),D(!0)):V(oe)},1e3);return()=>clearInterval(de)}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)},[]),Q=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(X,{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(X,{variant:"secondary",size:"icon",className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:r.jsx(Bd,{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(X,{variant:I==="top"?"default":"outline",size:"sm",onClick:()=>P("position","top"),children:r.jsx(ly,{className:"h-4 w-4"})}),r.jsx(X,{variant:I==="center"?"default":"outline",size:"sm",onClick:()=>P("position","center"),children:r.jsx(K1,{className:"h-4 w-4"})}),r.jsx(X,{variant:I==="bottom"?"default":"outline",size:"sm",onClick:()=>P("position","bottom"),children:r.jsx(Fd,{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(Is,{checked:T,onCheckedChange:oe=>P("isMirrored",oe)})]})]})})]}),r.jsx(X,{variant:"secondary",size:"icon",onClick:Q,className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:F?r.jsx(vm,{className:"h-4 w-4"}):r.jsx(Vl,{className:"h-4 w-4"})}),r.jsx(X,{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(D4,{className:"h-4 w-4"})}),r.jsxs(X,{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 gQt({onSelectScript:e,onCreateNew:t,selectedScriptId:n,className:s}){const{toast:a}=pi(),[o,l]=A.useState(""),[i,u]=A.useState(null),[m,x]=A.useState("levelup"),{data:y,isLoading:v}=K3t(),{data:b,isLoading:N}=Z3t(),{data:k,isLoading:M}=Y3t(),I=X3t(),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(Q=>Q.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(ki,{value:m,onValueChange:V=>x(V),className:"flex-1 flex flex-col",children:[r.jsxs(wi,{className:"mx-4 mt-4 grid grid-cols-2",children:[r.jsxs(an,{value:"levelup",children:[r.jsx(_a,{className:"h-4 w-4 mr-2"}),"LevelUp Scripts"]}),r.jsxs(an,{value:"my-scripts",children:[r.jsx(Mp,{className:"h-4 w-4 mr-2"}),"My Scripts"]})]}),r.jsxs(Cn,{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(Tt,{variant:i?"outline":"default",className:"cursor-pointer",onClick:()=>u(null),children:"All"}),y==null?void 0:y.map(V=>r.jsx(Tt,{variant:i===V.id?"default":"outline",className:"cursor-pointer",onClick:()=>u(V.id),children:V.name},V.id))]}),r.jsx(Zo,{className:"flex-1 max-h-[50vh]",children:U?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Wr,{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(Tt,{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(X,{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(Je,{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(Cn,{value:"my-scripts",className:"flex-1 flex flex-col mt-0 p-4",children:[t&&r.jsxs(X,{variant:"outline",className:"mb-4",onClick:t,children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Create New Script"]}),r.jsx(Zo,{className:"flex-1 max-h-[50vh]",children:M?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Wr,{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(Tt,{variant:"outline",className:"text-xs",children:"Custom"}):r.jsx(Tt,{variant:"secondary",className:"text-xs",children:"Saved"})})]}),r.jsx(Gi,{className:"h-4 w-4 text-muted-foreground ml-2"})]})}),r.jsx(Je,{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 xQt({selectedTemplate:e,onSelect:t,contactName:n,saving:s=!1}){const[a,o]=A.useState(()=>{const i=Y4(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(Wr,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),r.jsx("div",{className:"space-y-3",children:agt.map(i=>{const u=igt(i.id),m=a.has(i.id),x=u.some(y=>y.id===e);return r.jsxs(G4,{open:m,onOpenChange:()=>l(i.id),children:[r.jsxs(K4,{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(Fd,{className:Ut("h-4 w-4 text-muted-foreground transition-transform",m&&"rotate-180")})]}),r.jsx(Z4,{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(fi,{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: "',Y4(e).headerText(n),'"']})]})}function TVe({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:pe,error:ne}=await Y.from("innercircle_contacts").select("id, first_name, last_name, email").order("first_name",{ascending:!0}).limit(500);if(ne)throw ne;const me=(pe||[]).map(he=>({id:he.id,name:[he.first_name,he.last_name].filter(Boolean).join(" ")||"Unnamed",email:he.email||null}));N(me)}catch(pe){console.error("Failed to fetch contacts:",pe)}finally{F(!1)}},V=async pe=>{M(pe),T(!1),u(!0);try{const{error:ne}=await Y.from("agent_videos").update({contact_id:(pe==null?void 0:pe.id)||null,recipient_name:(pe==null?void 0:pe.name)||null}).eq("id",n.id);if(ne)throw ne;Ae.success(pe?`Assigned to ${pe.name}`:"Contact removed"),a==null||a()}catch(ne){console.error("Failed to update contact:",ne),Ae.error("Failed to update contact")}finally{u(!1)}},W=async pe=>{l(pe),u(!0);try{const{error:ne}=await Y.from("agent_videos").update({page_template:pe}).eq("id",n.id);if(ne)throw ne;v(pe),Ae.success("Template saved!"),a==null||a()}catch(ne){console.error("Failed to save template:",ne),Ae.error("Failed to save template"),l(y)}finally{u(!1)}},G=(k==null?void 0:k.name)||null,Q=()=>{const pe=n.title||"Video Message",ne=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 pe=Q(),ne=`Watch: ${n.title||"Video Message"} ${D}`;try{const me=new Blob([pe],{type:"text/html"}),he=new Blob([ne],{type:"text/plain"}),xe=new ClipboardItem({"text/html":me,"text/plain":he});await navigator.clipboard.write([xe]),Ae.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(ne+` `+pe),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)},de=()=>{const ne=Y4(o).headerText(G),me=o==="default"?`Check out this video: ${D}`:`${ne} Check out this special video: ${D}`;window.open(`sms:?body=${encodeURIComponent(me)}`,"_self")},se=()=>{const pe=Y4(o),ne=pe.headerText(G),me=o==="default"?n.title||"Video Message":ne,he=`${pe.subText} Watch the video: ${D}`,xe=k!=null&&k.email?encodeURIComponent(k.email):"";window.open(`mailto:${xe}?subject=${encodeURIComponent(me)}&body=${encodeURIComponent(he)}`,"_self")};return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Lr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(Ro,{className:"h-5 w-5"}),"Share Video"]}),r.jsx(Qn,{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(X,{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(Ly,{children:[r.jsx(Oy,{placeholder:"Search contacts..."}),r.jsxs(Dy,{children:[r.jsx(Ry,{children:P?"Loading...":"No contacts found."}),r.jsx(Fy,{children:b.map(pe=>r.jsxs(zy,{value:pe.name,onSelect:()=>V(pe),children:[r.jsx(fi,{className:Ut("mr-2 h-4 w-4",(k==null?void 0:k.id)===pe.id?"opacity-100":"opacity-0")}),pe.name]},pe.id))})]})]})})]}),k&&r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>V(null),disabled:i,className:"shrink-0",children:r.jsx(us,{className:"h-4 w-4"})})]}),k&&o!=="default"&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Page will show: "',Y4(o).headerText(k.name),'"']})]}),r.jsx(xQt,{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(X,{onClick:oe,variant:m?"default":"outline",className:"shrink-0 gap-2",children:m?r.jsxs(r.Fragment,{children:[r.jsx(fi,{className:"h-4 w-4"}),"Copied"]}):r.jsxs(r.Fragment,{children:[r.jsx(Oo,{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(X,{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(X,{variant:"outline",className:"flex-1 gap-2",onClick:de,children:[r.jsx(zo,{className:"h-4 w-4"}),"Text"]}),r.jsxs(X,{variant:"outline",className:"flex-1 gap-2",onClick:se,children:[r.jsx(ks,{className:"h-4 w-4"}),"Email"]})]})]})]}),r.jsx(Hs,{children:r.jsx(X,{variant:"outline",onClick:()=>t(!1),children:"Done"})})]})})}function yQt(){var rt;const e=Wn(),[t]=Zc(),{toast:n}=pi(),s=t.get("contact_id"),a=t.get("task_id"),{canRecord:o,remainingMb:l,usagePercent:i,isNearLimit:u}=wBe(),{data:m}=Nf(),x=X0e(),y=r5t(),[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),[Q,ae]=A.useState(0),[oe,de]=A.useState(null),[se,pe]=A.useState(null),[ne,me]=A.useState(s||""),[he,xe]=A.useState(""),[Te,be]=A.useState(""),[we,ve]=A.useState(null),[et,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 jBe(he||"Quick Video Touch");de(Ce);const{apiKey:Ye}=await kBe(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",Ye),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,ir=`https://iframe.mediadelivery.net/play/${Ce}/${Ce}`;await x.mutateAsync({bunny_video_id:Ce,playback_url:ir,file_size_mb:zt,title:he||"Quick Video Touch",notes:Te||void 0,contact_id:ne&&ne!=="none"?ne: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 NBe(Ce);if(Ke=it.status,ae(it.encodeProgress||0),Ke===4)pe({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")}},[he,n]),At=async()=>{if(!(!oe||!se))try{const je=ne&&ne!=="none"?ne:null,ut=await x.mutateAsync({bunny_video_id:oe,contact_id:je,playback_url:se.playbackUrl,thumbnail_url:se.thumbnailUrl,preview_url:se.previewUrl,duration_seconds:se.duration,file_size_mb:se.fileSizeMb,title:he||"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=()=>et?`https://video.relevelup.com/${et}`:(se==null?void 0:se.playbackUrl)||"",le=()=>{const je=m==null?void 0:m.find(Le=>Le.id===ne),ut=je?`${je.first_name}`:"",Ce=(je==null?void 0:je.phone)||"",Ee=(je==null?void 0:je.email)||"",Ye=at();return{text:`Hey${ut?` ${ut}`:""}! I recorded a quick video for you: ${Ye}`,link:Ye,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")},Qe=()=>{const{link:je,contactEmail:ut}=le(),Ce="Check out this video",Ee=`I recorded a quick video for you: ${je}`,Ye=ut?`mailto:${ut}?subject=${encodeURIComponent(Ce)}&body=${encodeURIComponent(Ee)}`:`mailto:?subject=${encodeURIComponent(Ce)}&body=${encodeURIComponent(Ee)}`;window.open(Ye,"_self")};return o?r.jsx(Dr,{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(X,{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(SVe,{maxDurationSeconds:60,onRecordingComplete:ot,onRecordingStateChange:D,className:"w-full",teleprompterContent:M&&N&&r.jsx(MVe,{text:N,isVisible:M,onToggleVisibility:()=>I(!1),isRecording:F,startCountdown:!0})}),!M&&N&&r.jsxs(X,{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(Je,{className:"space-y-4",children:[r.jsx(Xn,{placeholder:"Type or paste your script here...",value:N,onChange:je=>k(je.target.value),rows:6}),r.jsxs(Hse,{open:T,onOpenChange:P,children:[r.jsx(tye,{asChild:!0,children:r.jsxs(X,{variant:"outline",className:"w-full",children:[r.jsx(_a,{className:"h-4 w-4 mr-2"}),"Browse Scripts"]})}),r.jsxs(dP,{side:"right",className:"w-[400px] sm:w-[540px] p-0",children:[r.jsx(Wse,{className:"p-4 border-b",children:r.jsx(Gse,{children:"Select a Script"})}),r.jsx(gQt,{onSelectScript:je=>{k(je.text),P(!1),I(!0)},className:"h-[calc(100vh-80px)]"})]})]}),N&&r.jsx(X,{className:"w-full",onClick:()=>I(!0),children:"Use Script"})]})]})]}),v==="uploading"&&r.jsx(He,{className:"max-w-md mx-auto",children:r.jsxs(Je,{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(Je,{className:"pt-6 text-center space-y-4",children:[r.jsx(Wr,{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:Q,className:"mb-2"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[Q.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(Je,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"Title"}),r.jsx(lt,{value:he,onChange:je=>xe(je.target.value),placeholder:"Quick Video Touch"})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Attach to Contact (Optional)"}),r.jsxs(hn,{value:ne,onValueChange:me,children:[r.jsx(cn,{children:r.jsx(fn,{placeholder:"No contact - use anywhere"})}),r.jsxs(dn,{children:[r.jsx($t,{value:"none",children:r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(Ro,{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(Xn,{value:Te,onChange:je=>be(je.target.value),placeholder:"Add notes about this video...",rows:3})]}),r.jsxs(X,{className:"w-full",onClick:At,disabled:x.isPending,children:[x.isPending&&r.jsx(Wr,{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(fi,{className:"h-5 w-5 text-green-500"}),"Video Saved!"]})}),r.jsxs(Je,{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(X,{variant:"outline",className:"justify-start",onClick:qe,children:[r.jsx(zo,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),r.jsxs(X,{variant:"outline",className:"justify-start",onClick:Qe,children:[r.jsx(ks,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),r.jsxs(X,{variant:"outline",className:"justify-start",onClick:()=>Oe("link",le().link),children:[r.jsx(Ro,{className:"h-4 w-4 mr-2"}),"Copy Video Link",Ie==="link"&&r.jsx(fi,{className:"h-4 w-4 ml-auto text-green-500"})]}),r.jsxs(X,{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(X,{variant:"outline",onClick:()=>e("/mission-control/video-library"),children:"View Library"}),r.jsx(X,{onClick:()=>{b("record"),V(null),de(null),pe(null)},children:"Record Another"})]})]})]}),we&&et&&r.jsx(TVe,{open:Be,onOpenChange:Ve,video:{id:we,share_token:et,title:he||null,contact_id:ne||null,thumbnail_url:(se==null?void 0:se.thumbnailUrl)||null},contactName:((rt=m==null?void 0:m.find(je=>je.id===ne))==null?void 0:rt.first_name)||null})]})}):r.jsx(Dr,{title:"Quick Video Touch",children:r.jsxs("div",{className:"max-w-2xl mx-auto text-center py-12",children:[r.jsx(Gu,{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(X,{onClick:()=>e("/mission-control/video-library"),children:"Open Video Library"})]})})}function vQt({open:e,onOpenChange:t}){const{data:n}=Nf(),{data:s}=Q0e(),a=X0e(),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 se;const oe=(se=ae.target.files)==null?void 0:se[0];if(!oe)return;if(!oe.type.startsWith("video/")){Ae.error("Please select a video file");return}const de=oe.size/(1024*1024);if(de>500){Ae.error("Video file must be less than 500MB");return}if(de>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:de,libraryId:se}=ae;P("uploading");const{data:pe,error:ne}=await Y.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:de,isAgentVideo:!0}});if(ne)throw new Error(ne.message);await new Promise((xe,Te)=>{const be=new XMLHttpRequest;be.upload.addEventListener("progress",we=>{if(we.lengthComputable){const ve=Math.round(we.loaded/we.total*100);I(ve)}}),be.addEventListener("load",()=>{be.status>=200&&be.status<300?xe():Te(new Error(`Upload failed with status ${be.status}`))}),be.addEventListener("error",()=>Te(new Error("Upload failed"))),be.open("PUT",pe.uploadUrl),be.setRequestHeader("AccessKey",pe.apiKey),be.send(l)}),P("processing");const me=l.size/(1024*1024),he=`https://iframe.mediadelivery.net/embed/${se}/${de}`;await a.mutateAsync({bunny_video_id:de,playback_url:he,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))},Q=()=>{switch(T){case"creating":return"Preparing upload...";case"uploading":return`Uploading... ${M}%`;case"processing":return"Saving video...";default:return""}};return r.jsx(Or,{open:e,onOpenChange:G,children:r.jsxs(Lr,{className:"sm:max-w-md",children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Upload Video"}),r.jsx(Qn,{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(Pa,{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(X,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:ae=>{ae.stopPropagation(),i(null)},children:r.jsx(us,{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(hn,{value:v||"__none__",onValueChange:ae=>b(ae==="__none__"?"":ae),disabled:N,children:[r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select a contact"})}),r.jsxs(dn,{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(Xn,{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(Wr,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{children:Q()})]}),r.jsx(Mc,{value:T==="uploading"?M:T==="processing"?100:10})]})]}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:G,disabled:N,children:"Cancel"}),r.jsx(X,{onClick:W,disabled:!l||N,children:N?r.jsxs(r.Fragment,{children:[r.jsx(Wr,{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 _Qt({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 pe=l.find(ne=>ne.id===n.contact_id);pe&&(m(pe),k(pe.email||""))}},[e,n.contact_id,l]);const G=async()=>{b(!0);try{const{data:pe,error:ne}=await Y.from("innercircle_contacts").select("id, first_name, last_name, email").order("first_name",{ascending:!0}).limit(500);if(ne)throw ne;i(pe||[])}catch{console.error("Failed to fetch contacts")}finally{b(!1)}},Q=pe=>{m(pe),y(!1),k(pe.email||""),P(`Hey ${pe.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=pe=>`${pe.first_name} ${pe.last_name||""}`.trim(),de=()=>`
${T.split(/\n\n+/).map(ne=>`

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

`).join("")}

▶ Watch Video

`,se=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 pe=de(),{data:ne,error:me}=await Y.functions.invoke("gmail-send",{body:{to:N,subject:M,body:pe,contactId:(u==null?void 0:u.id)||null}});if(me)throw me;if(!(ne!=null&&ne.success))throw new Error((ne==null?void 0:ne.error)||"Failed to send");Ae.success("Video email sent!"),t(!1),o==null||o()}catch(pe){console.error("Gmail send error:",pe),Ae.error("Failed to send: "+(pe instanceof Error?pe.message:"Unknown error"))}finally{D(!1)}};return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Lr,{className:"sm:max-w-[560px] max-h-[90vh] overflow-y-auto",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(ks,{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(X,{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(Ly,{children:[r.jsx(Oy,{placeholder:"Search contacts..."}),r.jsxs(Dy,{children:[r.jsx(Ry,{children:v?"Loading...":"No contacts found."}),r.jsx(Fy,{children:l.filter(pe=>pe.email).map(pe=>r.jsxs(zy,{value:`${pe.first_name} ${pe.last_name||""} ${pe.email||""}`,onSelect:()=>Q(pe),children:[r.jsx(fi,{className:Ut("mr-2 h-4 w-4",(u==null?void 0:u.id)===pe.id?"opacity-100":"opacity-0")}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:oe(pe)}),r.jsx("div",{className:"text-xs text-muted-foreground",children:pe.email})]})]},pe.id))})]})]})})]}),u&&r.jsx(X,{variant:"ghost",size:"icon",onClick:ae,className:"shrink-0",children:r.jsx(us,{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:pe=>k(pe.target.value),placeholder:"recipient@example.com",type:"email"})]}),r.jsx(Dd,{}),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:pe=>I(pe.target.value)})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{htmlFor:"video-message",children:"Personal Message"}),r.jsx(Xn,{id:"video-message",value:T,onChange:pe=>P(pe.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(X,{variant:"outline",onClick:()=>t(!1),disabled:F,children:"Cancel"}),r.jsxs(X,{onClick:se,disabled:F||!N||!M,className:"gap-2",children:[F?r.jsx(Wr,{className:"h-4 w-4 animate-spin"}):r.jsx(Ji,{className:"h-4 w-4"}),F?"Sending...":"Send Video Email"]})]})]})]})})}function bQt({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(Pa,{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 wQt({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(bQt,{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(Tt,{variant:e.status==="processing"?"secondary":"destructive",className:"absolute top-2 left-2",children:e.status})]}),r.jsx(Je,{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(Qa,{className:"h-3 w-3"}),r.jsx("span",{children:ln(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(X,{variant:"outline",size:"sm",className:"mt-2 gap-1.5 text-xs h-7",onClick:P=>{P.stopPropagation(),y==null||y()},children:[r.jsx(ks,{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(Qa,{className:"h-3 w-3"}),r.jsx("span",{children:ln(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(dh,{children:[r.jsx(uh,{asChild:!0,children:r.jsx(X,{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(Ha,{onClick:P=>{P.stopPropagation(),s()},children:[r.jsx(_o,{className:"h-4 w-4 mr-2"}),"Watch"]}),r.jsx(ik,{}),r.jsxs(Ha,{onClick:P=>{P.stopPropagation(),x()},children:[r.jsx(Vc,{className:"h-4 w-4 mr-2"}),"Share with Template"]}),r.jsxs(Ha,{onClick:P=>{P.stopPropagation(),k(N(e),"Share link")},children:[r.jsx(Ro,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),r.jsxs(Ha,{onClick:P=>{P.stopPropagation(),i()},children:[r.jsx(Ej,{className:"h-4 w-4 mr-2"}),"Get Embed Code"]}),r.jsxs(Ha,{onClick:P=>{P.stopPropagation(),u()},children:[r.jsx(ks,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),r.jsxs(Ha,{onClick:P=>{P.stopPropagation(),m()},children:[r.jsx(Ms,{className:"h-4 w-4 mr-2"}),"Embed to CRM"]}),v&&e.share_token&&r.jsxs(Ha,{onClick:P=>{P.stopPropagation(),y==null||y()},children:[r.jsx(Ji,{className:"h-4 w-4 mr-2"}),"Send via Gmail"]}),r.jsxs(Ha,{onClick:P=>{P.stopPropagation(),o()},children:[r.jsx(Ja,{className:"h-4 w-4 mr-2"}),"Rename"]}),r.jsx(ik,{}),e.contact_id&&r.jsxs(Ha,{onClick:P=>{P.stopPropagation(),l()},children:[r.jsx(ic,{className:"h-4 w-4 mr-2"}),"View Contact"]}),r.jsxs(Ha,{onClick:P=>{P.stopPropagation(),a()},className:"text-destructive",children:[r.jsx(Un,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})})]})}function jQt(){var Ye;const e=Wn(),{data:t,isLoading:n,refetch:s}=Q3t(),{data:a}=Q0e(),{data:o}=Nf(),l=t5t(),i=e5t(),{isGmailConnected:u,gmailEmail:m}=NP(),[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(""),[Q,ae]=A.useState(!1),[oe,de]=A.useState(!1),[se,pe]=A.useState(!1),[ne,me]=A.useState(!1),[he,xe]=A.useState(""),[Te,be]=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")}`},et=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(ir=>(ir==null?void 0:ir.bunny_video_id)&&!Te[ir.id]);if(!Ke.length)return;const tt=Ke.map(ir=>ir.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)||{};be(ir=>{const Mr={...ir};for(const Zr of Ke)zt[Zr.bunny_video_id]&&(Mr[Zr.id]={previewUrl:zt[Zr.bunny_video_id].previewUrl,thumbnailUrl:zt[Zr.bunny_video_id].thumbnailUrl});return Mr})})().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,At=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(Zr=>Zr.id===Le.contact_id),ct=we(Le.contact_id),it=ct!=="Unassigned"?ct.split(" ")[0]:"",zt=(tt==null?void 0:tt.phone)||"",ir=`Hey${it?` ${it}`:""}! I recorded a quick video message for you. Check it out: ${Ke}`,Mr=zt?`sms:${zt}?body=${encodeURIComponent(ir)}`:`sms:?body=${encodeURIComponent(ir)}`;window.open(Mr,"_self")},qe=Le=>{const Ke=o==null?void 0:o.find(Mr=>Mr.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}`,ir=tt?`mailto:${tt}?subject=${encodeURIComponent(it)}&body=${encodeURIComponent(zt)}`:`mailto:?subject=${encodeURIComponent(it)}&body=${encodeURIComponent(zt)}`;window.open(ir,"_self")},Qe=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``},rt=async Le=>{if(!Le.thumbnail_url&&!Le.share_token){Ae.error("Video thumbnail not available yet");return}const Ke=Qe(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"}),ir=new ClipboardItem({"text/html":it,"text/plain":zt});await navigator.clipboard.write([ir]),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 ir=await zt.blob(),Mr=URL.createObjectURL(ir),Zr=document.createElement("a");Zr.href=Mr,Zr.download=it,Zr.rel="noreferrer",document.body.appendChild(Zr),Zr.click(),Zr.remove(),URL.revokeObjectURL(Mr),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(Dr,{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(X,{variant:"outline",onClick:()=>P(!0),children:[r.jsx(bo,{className:"h-4 w-4 mr-2"}),"Upload Video"]}),r.jsxs(X,{onClick:()=>e("/mission-control/video/record"),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Record New Video"]})]})]}),r.jsx(He,{className:ot?"border-amber-500":At?"border-destructive":"",children:r.jsxs(Je,{className:"py-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(oA,{className:`h-5 w-5 ${At?"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 ${At?"[&>div]:bg-destructive":ot?"[&>div]:bg-amber-500":""}`})]}),ot&&!At&&r.jsxs(Tt,{variant:"outline",className:"border-amber-500 text-amber-600",children:[r.jsx(yl,{className:"h-3 w-3 mr-1"}),"Near Limit"]}),At&&r.jsxs(Tt,{variant:"destructive",children:[r.jsx(yl,{className:"h-3 w-3 mr-1"}),"At Limit"]})]}),At&&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"})}):(et==null?void 0:et.length)===0?r.jsx(He,{children:r.jsxs(Je,{className:"py-12 text-center",children:[r.jsx(Pa,{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(X,{onClick:()=>e("/mission-control/video/record"),children:[r.jsx(bn,{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:et==null?void 0:et.map(Le=>{var Ke,tt;return r.jsx(wQt,{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:()=>rt(Le),onEmbedToCrm:()=>ut(Le),onShareWithTemplate:()=>{b(Le),de(!0)},onSendViaGmail:()=>{b(Le),pe(!0)},isGmailConnected:u,getContactName:we,getShareUrl:at,copyToClipboard:Oe,formatDuration:ve},Le.id)})}),r.jsx(Or,{open:N,onOpenChange:k,children:r.jsxs(Lr,{className:"max-w-2xl",children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:(v==null?void 0:v.title)||"Video Preview"}),r.jsx(Qn,{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(Wr,{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(X,{variant:"outline",size:"sm",onClick:()=>{k(!1),s()},children:[r.jsx(Wo,{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(Pa,{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(X,{variant:"outline",onClick:()=>le(v),children:[r.jsx(zo,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),!u&&r.jsxs(X,{variant:"outline",onClick:()=>qe(v),children:[r.jsx(ks,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),r.jsxs(X,{variant:"outline",onClick:()=>Oe(at(v),"Share link"),children:[r.jsx(Oo,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),r.jsxs(X,{variant:"outline",onClick:()=>rt(v),children:[r.jsx(ks,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),r.jsxs(X,{variant:"outline",onClick:()=>je(v),children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Download Video"]}),r.jsxs(X,{variant:"outline",onClick:()=>{k(!1),ut(v)},children:[r.jsx(Ms,{className:"h-4 w-4 mr-2"}),"Embed to CRM"]}),r.jsxs(X,{variant:"outline",onClick:()=>{k(!1),de(!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(X,{variant:"outline",onClick:()=>{k(!1),pe(!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(X,{variant:"destructive",onClick:()=>{k(!1),I(!0)},children:[r.jsx(Un,{className:"h-4 w-4 mr-2"}),"Delete Video"]})})]})]})}),r.jsx(Or,{open:M,onOpenChange:I,children:r.jsxs(Lr,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Delete Video"}),r.jsx(Qn,{children:"Are you sure you want to delete this video? This action cannot be undone."})]}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>I(!1),children:"Cancel"}),r.jsx(X,{variant:"destructive",onClick:Ee,disabled:l.isPending,children:l.isPending?"Deleting...":"Delete"})]})]})}),r.jsx(vQt,{open:T,onOpenChange:P}),r.jsx(Or,{open:F,onOpenChange:D,children:r.jsxs(Lr,{className:"sm:max-w-lg",children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Embed Video"}),r.jsx(Qn,{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(Xn,{readOnly:!0,rows:5,value:``,className:"font-mono text-xs"})]}),r.jsx("div",{className:"flex gap-2",children:r.jsxs(X,{className:"flex-1",onClick:()=>{const Le=``;Oe(Le,"Embed code")},children:[r.jsx(Oo,{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(TVe,{open:oe,onOpenChange:de,video:v,contactName:we(v.contact_id)}),v&&r.jsx(_Qt,{open:se,onOpenChange:pe,video:v,gmailEmail:m,signedThumbnailUrl:(Ye=Te[v.id])==null?void 0:Ye.thumbnailUrl}),r.jsx(Or,{open:ne,onOpenChange:me,children:r.jsxs(Lr,{className:"max-w-sm",children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Rename Video"}),r.jsx(Qn,{children:"Enter a new title for this video."})]}),r.jsx(lt,{value:he,onChange:Le=>xe(Le.target.value),placeholder:"Video title",autoFocus:!0,onKeyDown:Le=>{Le.key==="Enter"&&he.trim()&&i.mutate({id:v.id,title:he.trim()},{onSuccess:()=>{Ae.success("Video renamed"),me(!1)}})}}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>me(!1),children:"Cancel"}),r.jsx(X,{disabled:!he.trim()||i.isPending,onClick:()=>{i.mutate({id:v.id,title:he.trim()},{onSuccess:()=>{Ae.success("Video renamed"),me(!1)}})},children:i.isPending?"Saving...":"Save"})]})]})}),r.jsx(Or,{open:U,onOpenChange:V,children:r.jsxs(Lr,{className:"sm:max-w-lg",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(Ms,{className:"h-5 w-5"}),"Embed to CRM"]}),r.jsx(Qn,{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."})]}),Q?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Wr,{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(Xn,{readOnly:!0,rows:12,value:W,className:"font-mono text-xs"})]}),r.jsxs(X,{className:"w-full",onClick:()=>{Oe(W,"CRM embed code")},children:[r.jsx(Oo,{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 AVe({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(dh,{open:a,onOpenChange:o,children:[r.jsx(uh,{asChild:!0,children:r.jsxs(X,{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&&AIe[u.icon]||eh,x=u.id===t;return r.jsxs(Ha,{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(fi,{className:"h-4 w-4 text-primary"})]},u.id)})})]})}const kQt={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"}},NQt={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 EVe({deal:e,onClick:t,isDragging:n,stages:s,onStageChange:a,showStagePicker:o=!1,isWonStage:l=!1}){var I,T;const i=$3(),u=kQt[e.deal_type],m=NQt[e.priority],x=A.useMemo(()=>e.target_close_date?Py(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 Py(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(Je,{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(Tt,{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(xm,{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(sA,{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(zd,{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(AVe,{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(Ts,{className:"h-3 w-3"}),r.jsx("span",{children:y?`${Math.abs(x)}d overdue`:v?`${x}d left`:ln(new Date(e.target_close_date),"MMM d")})]}):null]})]})})}function SQt({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&&AIe[e.icon]||eh;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(Tt,{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(Zo,{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(EVe,{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(X,{variant:"ghost",size:"sm",className:"w-full justify-start text-muted-foreground hover:text-foreground",onClick:()=>s(e.id),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Deal"]})})]})}function CQt({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:yy,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:zd,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(Je,{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(Je,{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 MQt=[{value:"buyer",label:"Buyer"},{value:"seller",label:"Seller"},{value:"dual",label:"Dual Agency"},{value:"referral",label:"Referral"},{value:"lease",label:"Lease"}],TQt=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"urgent",label:"Urgent"}];function AQt({open:e,onOpenChange:t,deal:n,defaultStageId:s}){const{data:a}=ive(),{data:o}=Nf(),{data:l}=ARe(),i=kVe(),u=NVe(),[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(Or,{open:e,onOpenChange:t,children:r.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:n?"Edit Deal":"Add New Deal"}),r.jsx(Qn,{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(hn,{value:N.deal_type,onValueChange:F=>k(D=>({...D,deal_type:F})),children:[r.jsx(cn,{children:r.jsx(fn,{})}),r.jsx(dn,{children:MQt.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(hn,{value:N.stage_id||"none",onValueChange:F=>k(D=>({...D,stage_id:F==="none"?"":F})),children:[r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select stage"})}),r.jsxs(dn,{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(xm,{className:"h-4 w-4"}),"Link to Listing Exchange"]}),r.jsxs(hn,{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(cn,{children:r.jsx(fn,{placeholder:"Select a listing to sync status..."})}),r.jsxs(dn,{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(X,{variant:"outline",className:Ut("w-full justify-start text-left font-normal",!N.target_close_date&&"text-muted-foreground"),children:[r.jsx(Ts,{className:"mr-2 h-4 w-4"}),N.target_close_date?ln(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(X,{variant:"outline",className:Ut("w-full justify-start text-left font-normal",!N.contract_date&&"text-muted-foreground"),children:[r.jsx(Ts,{className:"mr-2 h-4 w-4"}),N.contract_date?ln(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(X,{variant:"outline",className:Ut("w-full justify-start text-left font-normal",!N.listing_date&&"text-muted-foreground"),children:[r.jsx(Ts,{className:"mr-2 h-4 w-4"}),N.listing_date?ln(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(hn,{value:N.priority,onValueChange:F=>k(D=>({...D,priority:F})),children:[r.jsx(cn,{children:r.jsx(fn,{})}),r.jsx(dn,{children:TQt.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(Xn,{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(X,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsxs(X,{type:"submit",disabled:P,children:[P&&r.jsx(Wr,{className:"h-4 w-4 mr-2 animate-spin"}),n?"Update Deal":"Create Deal"]})]})]})]})})}const EQt={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"}},IQt={note:zo,call:Ii,email:ks,meeting:Ts,stage_change:Ms,task_completed:no,document:ya,system:Qa};function PQt({deal:e,open:t,onOpenChange:n,onEdit:s,onAddToScorecard:a,isWonStage:o}){var de,se;const{data:l,isLoading:i}=QXt((e==null?void 0:e.id)||""),{data:u,isLoading:m}=eQt((e==null?void 0:e.id)||""),x=JXt(),y=rQt(),v=tQt(),b=XXt(),[N,k]=A.useState(""),[M,I]=A.useState(""),[T,P]=A.useState(!1);if(!e)return null;const F=EQt[e.deal_type],D=(()=>{var me;if(e.deal_type!=="seller"&&e.deal_type!=="dual")return null;const pe=((me=e.listing)==null?void 0:me.created_at)||e.listing_date;if(!pe)return null;const ne=e.contract_date?new Date(e.contract_date):new Date;return Py(ne,new Date(pe))})(),U=pe=>pe?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(pe):"-",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(pe,ne)=>{try{await v.mutateAsync({id:pe,is_completed:ne,deal_id:e.id})}catch{Ae.error("Failed to update task")}},Q=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(pe=>pe.is_completed).length)||0,oe=(u==null?void 0:u.length)||0;return r.jsxs(r.Fragment,{children:[r.jsx(Hse,{open:t,onOpenChange:n,children:r.jsxs(dP,{className:"w-full sm:max-w-xl p-0 flex flex-col",children:[r.jsx(Wse,{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(Tt,{variant:"outline",className:Ut("text-xs",F.color),children:F.label}),r.jsxs(Tt,{variant:"secondary",className:"text-xs capitalize",children:[e.priority," priority"]})]}),r.jsx(Gse,{className:"text-xl",children:e.deal_name})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(X,{variant:"outline",size:"icon",onClick:()=>s(e),children:r.jsx(gc,{className:"h-4 w-4"})}),r.jsx(X,{variant:"outline",size:"icon",className:"text-destructive hover:bg-destructive/10",onClick:()=>P(!0),children:r.jsx(Un,{className:"h-4 w-4"})})]})]})}),r.jsx(Zo,{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:[(de=e.contact.first_name)==null?void 0:de[0],(se=e.contact.last_name)==null?void 0:se[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(X,{variant:"outline",size:"icon",asChild:!0,children:r.jsx("a",{href:`tel:${e.contact.phone}`,children:r.jsx(Ii,{className:"h-4 w-4"})})}),e.contact.email&&r.jsx(X,{variant:"outline",size:"icon",asChild:!0,children:r.jsx("a",{href:`mailto:${e.contact.email}`,children:r.jsx(ks,{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(X,{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(Ts,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Close: ",ln(new Date(e.target_close_date),"MMM d, yyyy")]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(zd,{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(ki,{defaultValue:"tasks",className:"w-full",children:[r.jsxs(wi,{className:"w-full grid grid-cols-2",children:[r.jsxs(an,{value:"tasks",className:"gap-1",children:[r.jsx(no,{className:"h-4 w-4"}),"Tasks ",oe>0&&`(${ae}/${oe})`]}),r.jsxs(an,{value:"activity",className:"gap-1",children:[r.jsx(Qa,{className:"h-4 w-4"}),"Activity"]})]}),r.jsxs(Cn,{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:pe=>I(pe.target.value),onKeyDown:pe=>pe.key==="Enter"&&W()}),r.jsx(X,{onClick:W,disabled:!M.trim(),children:r.jsx(bn,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"space-y-2",children:[u==null?void 0:u.map(pe=>r.jsxs("div",{className:Ut("flex items-center gap-3 p-3 rounded-lg border transition-colors",pe.is_completed?"bg-muted/50 border-border":"bg-background"),children:[r.jsx(_l,{checked:pe.is_completed,onCheckedChange:ne=>G(pe.id,!!ne)}),r.jsx("span",{className:Ut("flex-1 text-sm",pe.is_completed&&"line-through text-muted-foreground"),children:pe.title}),pe.due_date&&r.jsx("span",{className:"text-xs text-muted-foreground",children:ln(new Date(pe.due_date),"MMM d")})]},pe.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(Cn,{value:"activity",className:"mt-4 space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xn,{placeholder:"Add a note...",value:N,onChange:pe=>k(pe.target.value),rows:2}),r.jsxs(X,{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(pe=>{const ne=IQt[pe.activity_type]||Qa;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(ne,{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:pe.title}),pe.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:pe.description}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:bu(new Date(pe.created_at),{addSuffix:!0})})]})]},pe.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(Ld,{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:Q,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function LQt({open:e,onOpenChange:t,deal:n,onComplete:s}){const a=hae(),o=NVe(),{data:l}=uae(),{data:i}=qp(),[u,m]=A.useState({property_address:"",city:"",state:"",zip:"",transaction_type:"buyer",close_date:ln(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||ln(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(Or,{open:e,onOpenChange:t,children:r.jsxs(Lr,{className:"sm:max-w-[550px] max-h-[90vh] overflow-y-auto",children:[r.jsxs(zr,{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(Fr,{className:"text-center text-xl",children:"Congratulations on Closing! 🎉"}),r.jsx(Qn,{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(hn,{value:u.transaction_type,onValueChange:v=>m(b=>({...b,transaction_type:v})),children:[r.jsx(cn,{children:r.jsx(fn,{})}),r.jsxs(dn,{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(Ts,{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(zd,{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(L4,{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(hn,{value:u.lead_source_id,onValueChange:v=>m(b=>({...b,lead_source_id:v})),children:[r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select source"})}),r.jsx(dn,{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(hn,{value:u.client_type_id,onValueChange:v=>m(b=>({...b,client_type_id:v})),children:[r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select type"})}),r.jsx(dn,{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(Xn,{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(Hs,{className:"gap-2 sm:gap-0 pt-4",children:[r.jsx(X,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Skip for now"}),r.jsx(X,{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 OQt={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"}},wTe={urgent:0,high:1,medium:2,low:3};function DQt({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=wTe[b.priority]-wTe[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(X,{variant:"ghost",size:"sm",className:"h-8 -ml-3 font-medium",onClick:()=>u(b),children:[N,a===b?l==="asc"?r.jsx(uf,{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(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:m.map(b=>{y(b.stage_id);const N=OQt[b.deal_type],k=b.target_close_date?Py(new Date(b.target_close_date),new Date):null,M=k!==null&&k<0,I=k!==null&&k<=7&&k>=0;return r.jsxs(Nr,{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(AVe,{stages:t,currentStageId:b.stage_id||"",onStageSelect:(T,P)=>s(b.id,T,P)})}),r.jsx(yt,{children:r.jsx(Tt,{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:ln(new Date(b.target_close_date),"MMM d, yyyy")})]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(yt,{children:r.jsx(Tt,{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 RQt 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(Dr,{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 FQt(){var we;const e=$3(),{data:t,isLoading:n}=ive(),{data:s,isLoading:a,refetch:o}=jVe(),{data:l,isLoading:i}=nQt(),u=wVe(),m=YXt(),[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),[Q,ae]=A.useState(null);A.useEffect(()=>{!n&&t&&t.length===0&&u.mutate()},[n,t]);const oe=ve=>{I(ve),k(!0)},de=ve=>{P(ve||null),I(null),b(!0)},se=ve=>{I(ve),k(!1),b(!0)},pe=(ve,et)=>{D(ve)},ne=(ve,et)=>{ve.preventDefault(),ve.dataTransfer.dropEffect="move",V(et)},me=async(ve,et)=>{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===et);if(!Me||!Ie||Me.stage_id===et){D(null);return}try{if(await m.mutateAsync({dealId:F,stageId:et,stageName:Ie.name}),Ae.success(`Moved to ${Ie.name}`),Ie.is_won_stage&&!Me.scorecard_transaction_id){const $e={...Me,stage_id:et};ae($e),G(!0)}}catch{Ae.error("Failed to move deal")}D(null)},he=A.useCallback(async(ve,et,Me)=>{const Ie=s==null?void 0:s.find(Be=>Be.id===ve),$e=t==null?void 0:t.find(Be=>Be.id===et);if(!(!Ie||!$e||Ie.stage_id===et))try{if(await m.mutateAsync({dealId:ve,stageId:et,stageName:Me}),Ae.success(`Moved to ${Me}`),$e.is_won_stage&&!Ie.scorecard_transaction_id){const Be={...Ie,stage_id:et};ae(Be),G(!0)}}catch{Ae.error("Failed to move deal")}},[s,t,m]),xe=ve=>(s==null?void 0:s.filter(et=>et.stage_id===ve))||[],Te=n||a,be=e?"list":x;return r.jsxs(Dr,{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(X,{variant:"outline",size:"icon",onClick:()=>o(),className:"shrink-0",children:r.jsx(Wo,{className:"h-4 w-4"})}),!e&&r.jsx(eP,{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(X,{variant:x==="board"?"secondary":"ghost",size:"sm",onClick:()=>y("board"),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:"Board"})]})}),r.jsx(Pp,{children:"Kanban board view"})]}),r.jsxs(Wg,{children:[r.jsx(Gg,{asChild:!0,children:r.jsxs(X,{variant:x==="list"?"secondary":"ghost",size:"sm",onClick:()=>y("list"),className:"px-3 gap-1.5",children:[r.jsx(ff,{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(X,{variant:x==="table"?"secondary":"ghost",size:"sm",onClick:()=>y("table"),className:"px-3 gap-1.5",children:[r.jsx(R4,{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(X,{onClick:()=>de(),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Deal"]})]})]}),r.jsx(CQt,{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(Tr,{className:"h-full rounded-xl"})},ve))}):be==="board"?r.jsxs(Zo,{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(SQt,{stage:ve,deals:xe(ve.id),onDealClick:oe,onAddDeal:de,onDragStart:pe,onDragOver:ne,onDrop:me,isDragOver:U===ve.id,isWonStage:ve.is_won_stage},ve.id))}),r.jsx(iye,{orientation:"horizontal"})]}):be==="table"?r.jsx(Zo,{className:"h-full",children:r.jsx(DQt,{deals:s||[],stages:t||[],onDealClick:oe,onStageChange:he})}):r.jsx(Zo,{className:"h-full",children:r.jsxs("div",{className:"space-y-6",children:[t==null?void 0:t.map(ve=>{const et=xe(ve.id);return et.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:["(",et.length,")"]})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:et.map(Me=>r.jsx(EVe,{deal:Me,onClick:()=>oe(Me),stages:t,onStageChange:he,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(mf,{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(X,{onClick:()=>de(),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Your First Deal"]})]})]})})})]}),r.jsx(AQt,{open:v,onOpenChange:b,deal:M,defaultStageId:T}),r.jsx(PQt,{deal:M,open:N,onOpenChange:k,onEdit:se,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(LQt,{open:W,onOpenChange:G,deal:Q,onComplete:()=>{o(),ae(null)}})]})}function zQt(){return r.jsx(RQt,{children:r.jsx(FQt,{})})}const Qpe=[{value:"video_intro",label:"Video Intro",icon:Pa,description:"Add an intro video"},{value:"testimonials",label:"Testimonials",icon:pA,description:"Client testimonials carousel"},{value:"specialties",label:"Specialties",icon:qg,description:"Tags for your specialties"},{value:"custom_links",label:"Custom Links",icon:xm,description:"Custom CTA buttons"},{value:"social_media",label:"Social Media",icon:Nc,description:"Links to your social profiles"}],BQt=["First-Time Buyers","Luxury Homes","Investment Properties","Relocation","New Construction","Condos & Townhomes","Waterfront","Commercial","Land & Lots","Senior Living","Military/VA","Short Sales & Foreclosures"],$Qt={video_intro:{video_url:""},testimonials:{testimonials:[{name:"",quote:"",role:""}]},specialties:{tags:[]},custom_links:{links:[{label:"",url:""}]},social_media:{platforms:[]}};function IVe({cardId:e}){const{data:t,isLoading:n}=$ct(e),s=Uct(),a=qct(),o=Vct(),[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(Tr,{className:"h-16 w-full"}),r.jsx(Tr,{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:$Qt[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=>Qpe.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(X,{size:"sm",onClick:()=>i(!0),children:[r.jsx(bn,{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(Je,{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:UQt(T)})]}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx(X,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>N(T,"up"),disabled:P===0,children:r.jsx(uf,{className:"h-3 w-3"})}),r.jsx(X,{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(X,{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(X,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>y(T),children:"Edit"}),r.jsx(X,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive",onClick:()=>k(T),children:r.jsx(Un,{className:"h-3 w-3"})})]})]})})},T.id)}),r.jsxs(X,{variant:"outline",size:"sm",className:"w-full",onClick:()=>i(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-1"})," Add Block"]})]}),r.jsx(Or,{open:l,onOpenChange:i,children:r.jsxs(Lr,{children:[r.jsx(zr,{children:r.jsx(Fr,{children:"Add Block"})}),r.jsx("div",{className:"grid gap-3",children:Qpe.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(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(X,{onClick:v,disabled:!u||s.isPending,children:"Add Block"})]})]})}),x&&r.jsx(qQt,{block:x,onSave:T=>M(x,T),onClose:()=>y(null)})]})}function UQt(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 qQt({block:e,onSave:t,onClose:n}){const[s,a]=A.useState(e.config),o=Qpe.find(l=>l.value===e.block_type);return r.jsx(Or,{open:!0,onOpenChange:n,children:r.jsxs(Lr,{className:"max-w-lg max-h-[80vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsxs(Fr,{children:["Edit ",o==null?void 0:o.label]})}),e.block_type==="video_intro"&&r.jsx(VQt,{config:s,onChange:a,cardId:e.card_id}),e.block_type==="testimonials"&&r.jsx(HQt,{config:s,onChange:a}),e.block_type==="specialties"&&r.jsx(WQt,{config:s,onChange:a}),e.block_type==="custom_links"&&r.jsx(GQt,{config:s,onChange:a}),e.block_type==="social_media"&&r.jsx(KQt,{config:s,onChange:a}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:n,children:"Cancel"}),r.jsx(X,{onClick:()=>t(s),children:"Save"})]})]})})}function VQt({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(ki,{value:o,onValueChange:l,children:[r.jsxs(wi,{className:"w-full",children:[r.jsx(an,{value:"library",className:"flex-1",children:"Video Library"}),r.jsx(an,{value:"youtube",className:"flex-1",children:"YouTube URL"})]}),r.jsxs(Cn,{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(Zo,{className:"h-[240px]",children:m?r.jsxs("div",{className:"space-y-2",children:[r.jsx(Tr,{className:"h-14 w-full"}),r.jsx(Tr,{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(Pa,{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(fi,{className:"h-4 w-4 text-primary flex-shrink-0"})]},k.id))})})]}),r.jsx(Cn,{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 HQt({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(Je,{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(X,{variant:"ghost",size:"icon",className:"h-6 w-6 text-destructive",onClick:()=>o(i),children:r.jsx(Un,{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(X,{variant:"outline",size:"sm",onClick:a,className:"w-full",children:[r.jsx(bn,{className:"h-4 w-4 mr-1"})," Add Testimonial"]})]})}function WQt({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:BQt.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(X,{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 GQt({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(X,{variant:"ghost",size:"icon",className:"h-8 w-8 mt-1 text-destructive",onClick:()=>o(i),children:r.jsx(Un,{className:"h-3 w-3"})})]},i)),r.jsxs(X,{variant:"outline",size:"sm",onClick:a,className:"w-full",children:[r.jsx(bn,{className:"h-4 w-4 mr-1"})," Add Link"]})]})}const jTe=[{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 KQt({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=jTe.filter(u=>!n.find(m=>m.platform===u.value)),i=u=>{const m=hme[u],x=jTe.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(X,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive flex-shrink-0",onClick:()=>o(m),children:r.jsx(Un,{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=hme[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 ZQt=Object.defineProperty,Jne=Object.getOwnPropertySymbols,PVe=Object.prototype.hasOwnProperty,LVe=Object.prototype.propertyIsEnumerable,kTe=(e,t,n)=>t in e?ZQt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jpe=(e,t)=>{for(var n in t||(t={}))PVe.call(t,n)&&kTe(e,n,t[n]);if(Jne)for(var n of Jne(t))LVe.call(t,n)&&kTe(e,n,t[n]);return e},ege=(e,t)=>{var n={};for(var s in e)PVe.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&Jne)for(var s of Jne(e))t.indexOf(s)<0&&LVe.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 YQt={L:u4.QrCode.Ecc.LOW,M:u4.QrCode.Ecc.MEDIUM,Q:u4.QrCode.Ecc.QUARTILE,H:u4.QrCode.Ecc.HIGH},OVe=128,DVe="L",RVe="#FFFFFF",FVe="#000000",zVe=!1,BVe=1,XQt=4,QQt=0,JQt=.1;function $Ve(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 UVe(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 eJt(e,t,n,s){if(s==null)return null;const a=e.length+n*2,o=Math.floor(t*JQt),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 tJt(e,t){return t!=null?Math.max(Math.floor(t),0):e?XQt:QQt}function qVe({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,YQt[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=tJt(s,a),k=b.length+N*2,M=eJt(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 rJt=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),nJt=dt.forwardRef(function(t,n){const s=t,{value:a,size:o=OVe,level:l=DVe,bgColor:i=RVe,fgColor:u=FVe,includeMargin:m=zVe,minVersion:x=BVe,boostLevel:y,marginSize:v,imageSettings:b}=s,k=ege(s,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:M}=k,I=ege(k,["style"]),T=b==null?void 0:b.src,P=dt.useRef(null),F=dt.useRef(null),D=dt.useCallback(se=>{P.current=se,typeof n=="function"?n(se):n&&(n.current=se)},[n]),[U,V]=dt.useState(!1),{margin:W,cells:G,numCells:Q,calculatedImageSettings:ae}=qVe({value:a,level:l,minVersion:x,boostLevel:y,includeMargin:m,marginSize:v,imageSettings:b,size:o});dt.useEffect(()=>{if(P.current!=null){const se=P.current,pe=se.getContext("2d");if(!pe)return;let ne=G;const me=F.current,he=ae!=null&&me!==null&&me.complete&&me.naturalHeight!==0&&me.naturalWidth!==0;he&&ae.excavation!=null&&(ne=UVe(G,ae.excavation));const xe=window.devicePixelRatio||1;se.height=se.width=o*xe;const Te=o/Q*xe;pe.scale(Te,Te),pe.fillStyle=i,pe.fillRect(0,0,Q,Q),pe.fillStyle=u,rJt?pe.fill(new Path2D($Ve(ne,W))):G.forEach(function(be,we){be.forEach(function(ve,et){ve&&pe.fillRect(et+W,we+W,1,1)})}),ae&&(pe.globalAlpha=ae.opacity),he&&pe.drawImage(me,ae.x+W,ae.y+W,ae.w,ae.h)}}),dt.useEffect(()=>{V(!1)},[T]);const oe=Jpe({height:o,width:o},M);let de=null;return T!=null&&(de=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",Jpe({style:oe,height:o,width:o,ref:D,role:"img"},I)),de)});nJt.displayName="QRCodeCanvas";var VVe=dt.forwardRef(function(t,n){const s=t,{value:a,size:o=OVe,level:l=DVe,bgColor:i=RVe,fgColor:u=FVe,includeMargin:m=zVe,minVersion:x=BVe,boostLevel:y,title:v,marginSize:b,imageSettings:N}=s,k=ege(s,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:M,cells:I,numCells:T,calculatedImageSettings:P}=qVe({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=UVe(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=$Ve(F,M);return dt.createElement("svg",Jpe({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)});VVe.displayName="QRCodeSVG";function sJt({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(VVe,{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(X,{variant:"outline",size:"sm",onClick:a,className:"gap-1.5",children:[r.jsx(so,{className:"h-3.5 w-3.5"}),"Download PNG"]})]})]})]})}function gue(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 aJt(){const{user:e}=tn(),{data:t,isLoading:n}=Fct(e==null?void 0:e.id),s=$3(),[a,o]=A.useState(null),l=A.useMemo(()=>a||(t?gue(t):null),[a,t]);if(n)return r.jsx(Dr,{children:r.jsxs("div",{className:"max-w-2xl mx-auto p-4 space-y-4",children:[r.jsx(Tr,{className:"h-8 w-48"}),r.jsx(Tr,{className:"h-32 w-full"}),r.jsx(Tr,{className:"h-32 w-full"})]})});if(!t)return r.jsx(Dr,{children:r.jsx(oJt,{userId:e==null?void 0:e.id})});const i=l||gue(t),u=m=>{o(x=>{const y=x||gue(t);return typeof m=="function"?m(y):m})};return r.jsx(Dr,{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(lJt,{card:t}),r.jsx(hJt,{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(iJt,{card:t,form:i})})]})})]})})}function iJt({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 oJt({userId:e}){var u;const[t,n]=A.useState(""),s=TDe(),{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:_m,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(Ds,{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(kn,{children:"Choose a URL slug — this is the link you'll share with clients"})]}),r.jsxs(Je,{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(X,{onClick:l,disabled:s.isPending,className:"w-full h-11 text-base font-semibold",size:"lg",children:[r.jsx(Ds,{className:"h-4 w-4 mr-2"}),s.isPending?"Creating...":"Create My Card"]})]})]})]})}function lJt({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(Tt,{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(X,{variant:"outline",size:"sm",onClick:s,className:"gap-1.5",children:[r.jsx(Oo,{className:"h-3.5 w-3.5"})," Copy Link"]}),r.jsx(X,{size:"sm",asChild:!0,className:"gap-1.5",children:r.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Ms,{className:"h-3.5 w-3.5"})," Preview"]})})]})]})})}function cJt({userId:e}){const t=qr(),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:de}=await Y.storage.from("avatars").list(`${e}`);if(de&&de.length>0){const{data:se}=Y.storage.from("avatars").getPublicUrl(`${e}/${de[0].name}`);oe=`${se.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 se;const oe=(se=ae.target.files)==null?void 0:se[0];if(!oe)return;if(!oe.type.startsWith("image/")){Ae.error("Please select an image file");return}const de=new FileReader;de.onloadend=()=>{l(de.result),a(!0)},de.readAsDataURL(oe),ae.target.value=""},Q=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 de=`${e}/avatar.jpg`,{error:se}=await Y.storage.from("avatars").upload(de,ae,{upsert:!0,contentType:"image/jpeg"});if(se)throw se;const{data:pe}=Y.storage.from("avatars").getPublicUrl(de),ne=pe.publicUrl+"?t="+Date.now();await Y.from("profiles").update({avatar_url:ne}).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(Tr,{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(Je,{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(Ti,{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(X,{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:Q,aspectRatio:1})]})}function dJt({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(Je,{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(X,{type:"button",variant:o==="name"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>m("name"),children:"Use Name"}),r.jsx(X,{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(X,{type:"button",variant:i==="name"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>x("name"),children:"Use Name"}),r.jsx(X,{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 uJt({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(X,{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 hJt({card:e,form:t,setForm:n}){var v;const s=ADe(),a=qr(),{data:o}=EDe(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(ki,{defaultValue:"content",children:[r.jsxs(wi,{className:"w-full h-11 p-1",children:[r.jsxs(an,{value:"content",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(hf,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Content"]}),r.jsxs(an,{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(an,{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(an,{value:"qrcode",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(_A,{className:"h-3.5 w-3.5 hidden sm:inline"}),"QR Code"]}),r.jsxs(an,{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(Cn,{value:"content",className:"mt-4 space-y-4",children:[r.jsx(cJt,{userId:e.user_id}),r.jsx(dJt,{form:t,setForm:n,userId:e.user_id}),r.jsx(He,{children:r.jsxs(Je,{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(Is,{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(X,{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(hn,{value:t.theme,onValueChange:b=>n(N=>({...N,theme:b})),children:[r.jsx(cn,{className:"h-11",children:r.jsx(fn,{})}),r.jsxs(dn,{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(uJt,{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(Xn,{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(Cn,{value:"sections",className:"mt-4",children:r.jsx(He,{children:r.jsx(Je,{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(Is,{checked:t[b],onCheckedChange:M=>n(I=>({...I,[b]:M}))})]},b))})})}),r.jsx(Cn,{value:"blocks",className:"mt-4",children:r.jsx(IVe,{cardId:e.id})}),r.jsx(Cn,{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:nh,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(Je,{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(Je,{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(Tt,{variant:"secondary",className:"text-xs",children:b.intent})]},b.id))})]}),(!o||o.leads.length===0)&&r.jsx(He,{children:r.jsxs(Je,{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(Cn,{value:"qrcode",className:"mt-4 space-y-4",children:r.jsx(He,{children:r.jsx(Je,{className:"p-6",children:r.jsx(sJt,{slug:e.slug})})})})]}),r.jsx(X,{onClick:y,disabled:s.isPending,className:"w-full h-11 text-base font-semibold",size:"lg",children:s.isPending?"Saving...":"Save Changes"})]})}function mJt(){const{isAdmin:e}=tn(),t=qr(),[n,s]=A.useState(!1),[a,o]=A.useState(!1),[l,i]=A.useState(!1),{data:u,isLoading:m}=Zt({queryKey:["gmail-integration"],queryFn:async()=>{const{data:F,error:D}=await Y.from("gmail_integrations").select("*").maybeSingle();if(D)throw D;return F}}),{data:x}=Zt({queryKey:["social-accounts"],queryFn:async()=>{const{data:{user:F}}=await Y.auth.getUser();if(!F)return[];const{data:D,error:U}=await Y.from("social_accounts").select("*").eq("user_id",F.id).order("created_at",{ascending:!1});if(U)throw U;return D}}),y=async()=>{s(!0);try{const{data:F,error:D}=await Y.functions.invoke("gmail-oauth",{body:{action:"get_auth_url"}});if(D)throw D;if(F!=null&&F.authUrl)window.location.href=F.authUrl;else throw new Error("Failed to get authorization URL")}catch(F){console.error("Gmail OAuth error:",F),Ae.error("Failed to start Gmail connection"),s(!1)}},v=async()=>{o(!0);try{const{data:F,error:D}=await Y.functions.invoke("meta-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/callback"}});if(D)throw D;if(F!=null&&F.authUrl)window.location.href=F.authUrl;else throw new Error("Failed to get authorization URL")}catch(F){console.error("Meta OAuth error:",F),Ae.error("Failed to start connection. Make sure Meta App credentials are configured."),o(!1)}},b=async()=>{i(!0);try{const{data:F,error:D}=await Y.functions.invoke("linkedin-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/linkedin-callback"}});if(D)throw D;if(F!=null&&F.authUrl)window.location.href=F.authUrl;else throw new Error("Failed to get LinkedIn authorization URL")}catch(F){console.error("LinkedIn OAuth error:",F),Ae.error("Failed to start LinkedIn connection. Please try again."),i(!1)}},N=ar({mutationFn:async F=>{const{error:D}=await Y.from("gmail_integrations").delete().eq("id",F);if(D)throw D},onSuccess:()=>{t.invalidateQueries({queryKey:["gmail-integration"]}),Ae.success("Gmail disconnected")},onError:()=>{Ae.error("Failed to disconnect Gmail")}}),k=ar({mutationFn:async F=>{const{error:D}=await Y.from("social_accounts").delete().eq("id",F);if(D)throw D},onSuccess:()=>{t.invalidateQueries({queryKey:["social-accounts"]}),Ae.success("Account disconnected")},onError:()=>{Ae.error("Failed to disconnect account")}}),M=!!(u!=null&&u.is_active),I=(x==null?void 0:x.filter(F=>F.platform==="facebook"))||[],T=(x==null?void 0:x.filter(F=>F.platform==="instagram"))||[],P=(x==null?void 0:x.filter(F=>F.platform==="linkedin"))||[];return r.jsx(Dr,{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(ks,{className:"h-5 w-5 text-destructive"})}),r.jsxs("div",{children:[r.jsxs(Gt,{className:"text-lg flex items-center gap-2",children:["Gmail",M&&r.jsx(Tt,{variant:"default",className:"text-xs bg-green-600",children:"Connected"})]}),r.jsx(kn,{children:"Send emails directly from your contact pages and auto-log them as touchpoints."})]})]})}),r.jsx(Je,{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(li,{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(li,{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(li,{className:"h-4 w-4 mt-0.5 text-green-500 shrink-0"}),r.jsx("span",{children:"Quick compose from any contact detail page"})]}),M?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:u.gmail_email}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected Gmail account"})]}),r.jsxs(Ld,{children:[r.jsx(kp,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Un,{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:()=>N.mutate(u.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]}):r.jsxs(X,{className:"mt-4",onClick:y,disabled:n||m,children:[n?r.jsx(Wo,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(ks,{className:"h-4 w-4 mr-2"}),"Connect Gmail",r.jsx(No,{className:"h-4 w-4 ml-2"})]})]})})]}),r.jsxs(He,{className:e?"":"opacity-70",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",e?I.length>0?r.jsx(Tt,{variant:"default",className:"text-xs bg-green-600",children:"Connected"}):null:r.jsxs(Tt,{variant:"secondary",className:"text-xs gap-1",children:[r.jsx(th,{className:"h-3 w-3"}),"Coming Soon"]})]}),r.jsx(kn,{children:"Connect Facebook Pages to post content and reach your audience."})]})]})}),e&&r.jsxs(Je,{className:"space-y-3",children:[I.length>0&&r.jsx("div",{className:"space-y-2",children:I.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(ea,{className:"h-8 w-8",children:[r.jsx(Ti,{src:F.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:F.page_name||F.platform_username||"Facebook Page"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected Facebook Page"})]})]}),r.jsxs(Ld,{children:[r.jsx(kp,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Un,{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:()=>k.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}),r.jsxs(X,{onClick:v,disabled:a,variant:"outline",className:"gap-2",children:[a?r.jsx(Wo,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{className:"h-4 w-4"}),"Connect Facebook Page"]})]})]}),r.jsxs(He,{className:e?"":"opacity-70",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",e?T.length>0?r.jsx(Tt,{variant:"default",className:"text-xs bg-green-600",children:"Connected"}):null:r.jsxs(Tt,{variant:"secondary",className:"text-xs gap-1",children:[r.jsx(th,{className:"h-3 w-3"}),"Coming Soon"]})]}),r.jsx(kn,{children:"Connect Instagram Business accounts to schedule and publish posts."})]})]})}),e&&r.jsxs(Je,{className:"space-y-3",children:[T.length>0&&r.jsx("div",{className:"space-y-2",children:T.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(ea,{className:"h-8 w-8",children:[r.jsx(Ti,{src:F.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:["@",F.platform_username||"Instagram Account"]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected Instagram account"})]})]}),r.jsxs(Ld,{children:[r.jsx(kp,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Un,{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:()=>k.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}),r.jsxs(X,{onClick:v,disabled:a,variant:"outline",className:"gap-2",children:[a?r.jsx(Wo,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{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,{className:e?"":"opacity-70",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(ym,{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",e?P.length>0?r.jsx(Tt,{variant:"default",className:"text-xs bg-green-600",children:"Connected"}):null:r.jsxs(Tt,{variant:"secondary",className:"text-xs gap-1",children:[r.jsx(th,{className:"h-3 w-3"}),"Coming Soon"]})]}),r.jsx(kn,{children:"Connect your LinkedIn profile to share content and grow your professional network."})]})]})}),e&&r.jsxs(Je,{className:"space-y-3",children:[P.length>0&&r.jsx("div",{className:"space-y-2",children:P.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(ea,{className:"h-8 w-8",children:[r.jsx(Ti,{src:F.profile_picture_url||""}),r.jsx(ta,{children:r.jsx(ym,{className:"h-4 w-4"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:F.platform_username||"LinkedIn Account"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected LinkedIn profile"})]})]}),r.jsxs(Ld,{children:[r.jsx(kp,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Un,{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:()=>k.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}),r.jsxs(X,{onClick:b,disabled:l,variant:"outline",className:"gap-2",children:[l?r.jsx(Wo,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{className:"h-4 w-4"}),"Connect LinkedIn"]})]})]})]})})}function fJt(){const[e]=Zc(),t=Wn(),[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(Wr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(li,{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(kn,{children:a})]}),r.jsx(Je,{className:"flex justify-center",children:n!=="loading"&&r.jsx(X,{onClick:()=>t("/mission-control/integrations"),children:n==="success"?"Back to Integrations":"Try Again"})})]})})}function pJt(){const e=Wn();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 gJt(){const[e]=Zc(),t=Wn(),[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(Wr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(li,{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(kn,{children:a})]}),r.jsx(Je,{className:"flex justify-center",children:n!=="loading"&&r.jsx(X,{onClick:()=>t("/mission-control/integrations"),children:n==="success"?"View Integrations":"Try Again"})})]})})}const HVe=new Date().getFullYear(),xJt=Array.from({length:5},(e,t)=>HVe-t);function yJt(){const[e,t]=A.useState(HVe),n=Wn(),{data:s,isLoading:a}=uxt();return a?r.jsx(Dr,{title:"Scorecard Admin",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tr,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4].map(o=>r.jsx(Tr,{className:"h-24"},o))}),r.jsx(Tr,{className:"h-96"})]})}):r.jsx(Dr,{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(hn,{value:String(e),onValueChange:o=>t(Number(o)),children:[r.jsx(cn,{className:"w-[120px]",children:r.jsx(fn,{})}),r.jsx(dn,{children:xJt.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(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(qn,{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(Je,{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(kn,{children:"Click to view individual agent scorecards"})]}),r.jsx(Je,{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(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{children:[r.jsx(Mt,{children:"Agent"}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(zs,{children:s.map(o=>r.jsxs(Nr,{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(X,{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 WVe=new Date().getFullYear(),vJt=Array.from({length:10},(e,t)=>WVe-t);function _Jt(){var v;const{userId:e}=Ec(),t=Wn(),[n,s]=A.useState(WVe),{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}=URe(n,e),{data:y}=$Re(n,e);return o?r.jsx(Dr,{title:"Agent Scorecard",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tr,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4].map(b=>r.jsx(Tr,{className:"h-24"},b))})]})}):r.jsx(Dr,{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(X,{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(hn,{value:String(n),onValueChange:b=>s(Number(b)),children:[r.jsx(cn,{className:"w-[120px]",children:r.jsx(fn,{})}),r.jsx(dn,{children:vJt.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(Je,{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(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(qn,{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(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(zd,{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(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(rh,{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(Je,{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(MBe,{goals:y,stats:u,year:n,showCommission:x}),r.jsxs(ki,{defaultValue:"transactions",className:"space-y-4",children:[r.jsxs(wi,{children:[r.jsx(an,{value:"transactions",children:"Transactions"}),r.jsx(an,{value:"charts",children:"Charts"}),r.jsxs(an,{value:"map",children:[r.jsx(Fo,{className:"h-4 w-4 mr-1"}),"Map"]})]}),r.jsx(Cn,{value:"transactions",children:r.jsx(CBe,{transactions:l||[],showCommission:x,isLoading:i})}),r.jsx(Cn,{value:"charts",children:r.jsx(yVe,{stats:u,year:n})}),r.jsx(Cn,{value:"map",children:r.jsx(vVe,{transactions:l||[],isLoading:i})})]})]})})}function bJt(){const e=qr(),[t,n]=A.useState(""),[s,a]=A.useState("all");zDe();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(Dr,{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(Is,{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(Je,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(mi,{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(Je,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(rh,{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(Je,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(qn,{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(Je,{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(Je,{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(Je,{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(ki,{value:s,onValueChange:T=>a(T),children:r.jsxs(wi,{children:[r.jsx(an,{value:"all",children:"All"}),r.jsx(an,{value:"pending",children:"Pending"}),r.jsx(an,{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(Je,{children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:u?r.jsx(Nr,{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(Nr,{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(Nr,{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(mi,{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(Tt,{variant:"outline",className:I(T.status),children:(V=T.status)==null?void 0:V.replace("_"," ")})}),r.jsx(yt,{className:"text-center",children:r.jsx(Is,{checked:T.is_approved??!1,onCheckedChange:W=>x.mutate({id:T.id,approved:W})})}),r.jsx(yt,{className:"text-center",children:r.jsx(Is,{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:ln(new Date(T.created_at),"MMM d, yyyy")}),r.jsx(yt,{children:r.jsxs(dh,{children:[r.jsx(uh,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",children:r.jsx(gp,{className:"h-4 w-4"})})}),r.jsxs(Nu,{align:"end",children:[r.jsxs(Ha,{onClick:()=>window.open(`/mission-control/listings/${T.id}`,"_blank"),children:[r.jsx(_o,{className:"h-4 w-4 mr-2"}),"View Listing"]}),r.jsxs(Ha,{onClick:()=>y.mutate({id:T.id,featured:!T.is_featured}),children:[r.jsx(Ss,{className:"h-4 w-4 mr-2"}),T.is_featured?"Unfeature":"Feature"]}),r.jsxs(Ha,{className:"text-destructive",onClick:()=>{confirm("Are you sure you want to delete this listing?")&&v.mutate(T.id)},children:[r.jsx(us,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},T.id)})})]})})})]})]})})}const wJt=()=>{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(Ss,{className:Ut("h-4 w-4",b>=N?"fill-yellow-400 text-yellow-400":"text-muted-foreground")},N))});return r.jsx(Dr,{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(kn,{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(kn,{children:"Average Rating"}),r.jsxs(Gt,{className:"flex items-center gap-2 text-3xl",children:[i,r.jsx(Ss,{className:"h-6 w-6 fill-yellow-400 text-yellow-400"})]})]})}),r.jsx(He,{children:r.jsxs(Ht,{className:"pb-2",children:[r.jsx(kn,{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(kn,{children:"Posted to Google"}),r.jsxs(Gt,{className:"flex items-center gap-2 text-3xl",children:[m,r.jsx(Ms,{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(Je,{className:"p-0",children:r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:o?r.jsx(Nr,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8",children:"Loading reviews..."})}):(l==null?void 0:l.length)===0?r.jsx(Nr,{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(Nr,{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(Tt,{variant:"secondary",className:"bg-green-100 text-green-800",children:"Posted"}):r.jsx(Tt,{variant:"outline",children:"No"})}),r.jsx(yt,{className:"text-sm text-muted-foreground",children:ln(new Date(b.created_at),"MMM d, yyyy")})]},b.id)})})]})})}),r.jsx(Or,{open:!!n,onOpenChange:()=>s(null),children:r.jsxs(Lr,{className:"max-w-lg",children:[r.jsx(zr,{children:r.jsx(Fr,{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(ks,{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(Ts,{className:"h-4 w-4"}),ln(new Date(n.created_at),"MMMM d, yyyy 'at' h:mm a")]}),n.posted_to_google?r.jsxs(Tt,{variant:"secondary",className:"bg-green-100 text-green-800",children:[r.jsx(Ms,{className:"h-3 w-3 mr-1"}),"Posted to Google"]}):r.jsx(Tt,{variant:"outline",children:"Not posted to Google"})]})]})]})})]})})},jJt=[{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"}],kJt=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 NJt(){const e=qr(),{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,Q,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:Q.count||0,sent:ae.count||0,failed:oe.count||0,total:(G.count||0)+(Q.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:Q}=await Y.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","failed").gte("sent_at",W.toISOString());if(Q)throw Q;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,Q,ae,oe,de;if(!(t!=null&&t.email)){Ae.error("No email found for your account");return}o(!0);try{const{data:se,error:pe}=await Y.functions.invoke("send-weekly-digest",{body:{preview:!0,previewEmail:t.email}});if(pe)throw pe;const ne=se==null?void 0:se.resendId,me=se==null?void 0:se.resendDetails,he=me==null?void 0:me.status,xe=((W=me==null?void 0:me.body)==null?void 0:W.status)||((Q=(G=me==null?void 0:me.body)==null?void 0:G.data)==null?void 0:Q.status),Te=((oe=(ae=me==null?void 0:me.body)==null?void 0:ae.error)==null?void 0:oe.message)||((de=me==null?void 0:me.body)==null?void 0:de.message);Ae.success(ne?`Preview accepted by email provider (id: ${ne})${he?`, status check: ${he}`:""}${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(se){Ae.error("Failed to send preview: "+se.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 de,se;const W=new Date;W.setUTCHours(0,0,0,0);const[G,Q,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:Q.count||0,agentOsEngaged:ae.count||0,lastSent:((se=(de=oe.data)==null?void 0:de[0])==null?void 0:se.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(Dr,{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(Dr,{title:"Weekly Digest",description:"Configure and manage automated weekly email digests for members",children:r.jsxs(ki,{defaultValue:"settings",className:"space-y-6",children:[r.jsxs(wi,{children:[r.jsxs(an,{value:"settings",className:"flex items-center gap-2",children:[r.jsx(Bd,{className:"h-4 w-4"}),"Settings"]}),r.jsxs(an,{value:"stats",className:"flex items-center gap-2",children:[r.jsx(_c,{className:"h-4 w-4"}),"Delivery Stats"]})]}),r.jsxs(Cn,{value:"settings",className:"space-y-6",children:[D&&b&&r.jsx(He,{className:"border-primary/50 bg-primary/5",children:r.jsxs(Je,{className:"pt-6",children:[r.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[r.jsx(Wr,{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(Je,{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(qn,{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(Je,{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(Je,{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(Je,{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(Qa,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:V.lastSent?ln(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(Qa,{className:"h-5 w-5"}),"Schedule"]}),r.jsx(kn,{children:"Configure when the digest is sent"})]}),r.jsxs(Je,{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(Is,{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(hn,{value:(u==null?void 0:u.cron_frequency)||"daily",onValueChange:W=>M.mutate({cron_frequency:W}),children:[r.jsx(cn,{children:r.jsx(fn,{})}),r.jsxs(dn,{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(hn,{value:String(u==null?void 0:u.send_day),onValueChange:W=>M.mutate({send_day:parseInt(W)}),children:[r.jsx(cn,{children:r.jsx(fn,{})}),r.jsx(dn,{children:jJt.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(hn,{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(cn,{children:r.jsx(fn,{})}),r.jsx(dn,{children:kJt.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(X,{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(X,{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(X,{onClick:P,disabled:l,variant:"outline",className:"w-full",children:[r.jsx(Wo,{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(kn,{children:"Choose what to include in the digest"})]}),r.jsxs(Je,{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(Is,{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(qn,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ze,{children:"Community Highlights"})]}),r.jsx(Is,{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(Is,{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(Ts,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ze,{children:"Upcoming Events"})]}),r.jsx(Is,{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(yy,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ze,{children:"Goals Progress"})]}),r.jsx(Is,{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(kn,{children:"Personalize the intro message (optional)"})]}),r.jsx(Je,{children:r.jsx(Xn,{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(Cn,{value:"stats",children:r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(ks,{className:"h-5 w-5"}),"Delivery History"]}),r.jsx(kn,{children:"Recent digest emails sent to members"})]}),r.jsx(Je,{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(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:x.map(W=>r.jsxs(Nr,{children:[r.jsx(yt,{className:"font-medium",children:W.email_sent_to}),r.jsx(yt,{children:ln(new Date(W.sent_at),"MMM d, yyyy h:mm a")}),r.jsx(yt,{children:r.jsx(Tt,{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(Tt,{variant:"secondary",children:"Active"}):r.jsx(Tt,{variant:"outline",children:"Not Started"})})]},W.id))})]}):r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(ks,{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 SJt={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 CJt(){var we,ve,et;const e=qr(),[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:Q,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)}),de=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,At=((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,At),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")}}),se=()=>{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}de.mutate({userId:s.user_id,points:b?Me:-Me,reason:y})},pe=()=>{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}de.mutate({userId:P.id,points:Me,reason:y},{onSuccess:()=>{M(!1),F(null),T("")}})},ne=(Me,Ie)=>{a(Me),N(Ie),l(!0)},me=Me=>{a(Me),u(!0)},he=D==null?void 0:D.filter(Me=>{var Ve,ot,At,Oe;const Ie=((ot=(Ve=Me.profile)==null?void 0:Ve.name)==null?void 0:ot.toLowerCase())||"",$e=((Oe=(At=Me.profile)==null?void 0:At.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,be=Te>0?Math.round(xe/Te):0;return U?r.jsx(Dr,{title:"Agent Points",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tr,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-3 gap-4",children:[1,2,3].map(Me=>r.jsx(Tr,{className:"h-24"},Me))}),r.jsx(Tr,{className:"h-96"})]})}):r.jsx(Dr,{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(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(qn,{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(Je,{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(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(rh,{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:be}),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(X,{onClick:()=>M(!0),children:[r.jsx(bn,{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(kn,{children:"All agents with their points, events, and streaks"})]}),r.jsx(Je,{children:!he||he.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(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:he.map((Me,Ie)=>{var $e,Be,Ve,ot;return r.jsxs(Nr,{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(Tt,{variant:"secondary",className:"font-bold",children:[r.jsx(Ss,{className:"h-3 w-3 mr-1"}),Me.total_points]})}),r.jsx(yt,{className:"text-center",children:r.jsxs(Tt,{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(Ts,{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(pm,{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(X,{variant:"ghost",size:"sm",onClick:()=>ne(Me,!0),title:"Award points",children:r.jsx(bn,{className:"h-4 w-4 text-green-600"})}),r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>ne(Me,!1),title:"Deduct points",children:r.jsx(K1,{className:"h-4 w-4 text-red-600"})}),r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>me(Me),title:"View history",children:r.jsx(N4,{className:"h-4 w-4"})})]})})]},Me.user_id)})})]})})]}),r.jsx(Or,{open:o,onOpenChange:l,children:r.jsxs(Lr,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:b?"Award Points":"Deduct Points"}),r.jsxs(Qn,{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(Xn,{id:"reason",placeholder:"Enter reason for this adjustment...",value:y,onChange:Me=>v(Me.target.value)})]})]}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsx(X,{onClick:se,disabled:de.isPending,className:b?"bg-green-600 hover:bg-green-700":"bg-red-600 hover:bg-red-700",children:de.isPending?"Saving...":b?"Award Points":"Deduct Points"})]})]})}),r.jsx(Or,{open:i,onOpenChange:u,children:r.jsxs(Lr,{className:"max-w-2xl",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{children:["Point History: ",(ve=s==null?void 0:s.profile)==null?void 0:ve.name]}),r.jsx(Qn,{children:"View all point transactions and badges for this agent"})]}),r.jsxs(ki,{defaultValue:"history",className:"w-full",children:[r.jsxs(wi,{className:"grid w-full grid-cols-2",children:[r.jsx(an,{value:"history",children:"Point History"}),r.jsx(an,{value:"badges",children:"Badges"})]}),r.jsx(Cn,{value:"history",className:"mt-4",children:ae?r.jsx("div",{className:"space-y-2",children:[1,2,3].map(Me=>r.jsx(Tr,{className:"h-12"},Me))}):!Q||Q.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:Q.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:ln(new Date(Me.created_at),"MMM d, yyyy h:mm a")})]}),r.jsxs(Tt,{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(Cn,{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 ${SJt[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 ",ln(new Date(Me.earned_at),"MMM d, yyyy")]})]},Me.id))})})]})]})}),r.jsx(Or,{open:k,onOpenChange:Me=>{M(Me),Me||(F(null),T(""),x(""),v(""))},children:r.jsxs(Lr,{className:"max-w-md",children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Award Points to New Agent"}),r.jsx(Qn,{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:((et=P.name)==null?void 0:et.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(X,{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(Xn,{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(qn,{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(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),P&&r.jsxs(X,{onClick:pe,disabled:de.isPending,className:"bg-green-600 hover:bg-green-700",children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Award Points"]})]})]})})]})})}function MJt(){const{data:e,isLoading:t}=Rct(),[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(Dr,{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(X,{onClick:()=>o(!0),children:[r.jsx(bn,{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(hn,{value:u,onValueChange:m,children:[r.jsx(cn,{className:"w-full sm:w-36",children:r.jsx(fn,{placeholder:"Status"})}),r.jsxs(dn,{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(hn,{value:x,onValueChange:y,children:[r.jsx(cn,{className:"w-full sm:w-44",children:r.jsx(fn,{placeholder:"Sort by"})}),r.jsxs(dn,{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(X,{variant:v==="table"?"default":"ghost",size:"sm",onClick:()=>b("table"),className:"rounded-r-none",children:r.jsx(R4,{className:"h-4 w-4"})}),r.jsx(X,{variant:v==="grid"?"default":"ghost",size:"sm",onClick:()=>b("grid"),className:"rounded-l-none",children:r.jsx(mf,{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(Tr,{className:"h-48"},P))}):T.length>0?v==="table"?r.jsx(TJt,{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(AJt,{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(Je,{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(Je,{className:"flex flex-col items-center justify-center py-12",children:[r.jsx(qn,{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(X,{onClick:()=>o(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Create Card"]})]})})]}),r.jsx(EJt,{open:a,onOpenChange:o}),n&&r.jsx(IJt,{card:n,open:!!n,onOpenChange:P=>!P&&s(null)})]})}function TJt({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(uf,{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(uf,{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(Tt,{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(X,{variant:"ghost",size:"sm",onClick:()=>s(u),className:"h-8 w-8 p-0",children:r.jsx(Ja,{className:"h-3.5 w-3.5"})}),r.jsx(X,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{navigator.clipboard.writeText(y),Ae.success("Link copied!")},children:r.jsx(Oo,{className:"h-3.5 w-3.5"})}),r.jsx(X,{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(Ms,{className:"h-3.5 w-3.5"})})})]})})]},u.id)})})]})})})}function AJt({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(Je,{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(Ti,{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(Tt,{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(qn,{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(X,{variant:"outline",size:"sm",onClick:t,className:"flex-1",children:[r.jsx(Ja,{className:"h-3 w-3 mr-1"}),"Edit"]}),r.jsx(X,{variant:"outline",size:"sm",onClick:l,children:r.jsx(Oo,{className:"h-3 w-3"})}),r.jsx(X,{variant:"outline",size:"sm",asChild:!0,children:r.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",children:r.jsx(Ms,{className:"h-3 w-3"})})})]})]})})}function EJt({open:e,onOpenChange:t}){const[n,s]=A.useState(""),[a,o]=A.useState(""),[l,i]=A.useState(""),[u,m]=A.useState(!1),x=TDe(),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(Or,{open:e,onOpenChange:t,children:r.jsxs(Lr,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Create Agent Card"}),r.jsx(Qn,{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(X,{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(Ly,{shouldFilter:!1,children:[r.jsx(Oy,{placeholder:"Search by name or email...",value:l,onValueChange:i}),r.jsxs(Dy,{children:[r.jsx(Ry,{children:"No agents found."}),r.jsx(Fy,{children:(v||[]).map(T=>r.jsxs(zy,{value:T.id,onSelect:I,children:[r.jsx(fi,{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(X,{onClick:M,disabled:x.isPending,className:"w-full",children:x.isPending?"Creating...":"Create Card"})]})]})})}function IJt({card:e,open:t,onOpenChange:n}){const s=ADe(),{data:a}=EDe(e.id),o=qr(),[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:Q}=await Y.storage.from("avatars").list(`${e.user_id}`);if(Q&&Q.length>0){const{data:ae}=Y.storage.from("avatars").getPublicUrl(`${e.user_id}/${Q[0].name}`);i(`${ae.publicUrl}?t=${Date.now()}`)}}catch{}})()},[e.user_id,t]);const F=G=>{var oe;const Q=(oe=G.target.files)==null?void 0:oe[0];if(!Q)return;if(!Q.type.startsWith("image/")){Ae.error("Please select an image file");return}if(Q.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(Q),G.target.value=""},D=async G=>{m(!0);try{const{data:Q}=await Y.storage.from("avatars").list(`${e.user_id}`);Q&&Q.length>0&&await Y.storage.from("avatars").remove(Q.map(pe=>`${e.user_id}/${pe.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:de}=Y.storage.from("avatars").getPublicUrl(ae),se=`${de.publicUrl}?t=${Date.now()}`;i(se),await Y.from("profiles").update({avatar_url:se}).eq("id",e.user_id),o.invalidateQueries({queryKey:["agent-card-public"]}),Ae.success("Photo updated!")}catch(Q){Ae.error(Q.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:Q}=await Y.from("agent_cards").select("id").eq("slug",G).neq("id",e.id).maybeSingle();if(Q){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,Q)=>{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 de=ae.name.split(".").pop()||"png",se=Q==="brokerage_logo_url"?"brokerage-logo":"team-logo",pe=`${e.user_id}/${se}.${de}`,{error:ne}=await Y.storage.from("card-logos").upload(pe,ae,{upsert:!0});if(ne)throw ne;const{data:me}=Y.storage.from("card-logos").getPublicUrl(pe),he=me.publicUrl+"?t="+Date.now();P(Q==="brokerage_logo_url"?xe=>({...xe,[Q]:he,brokerage_display_name:""}):xe=>({...xe,[Q]:he,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(Or,{open:t,onOpenChange:n,children:r.jsxs(Lr,{className:"max-w-2xl max-h-[85vh] overflow-y-auto",children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Edit Agent Card"}),r.jsxs(Qn,{children:["/card/",e.slug]})]}),r.jsxs(ki,{defaultValue:"content",children:[r.jsxs(wi,{className:"w-full",children:[r.jsx(an,{value:"content",className:"flex-1",children:"Content"}),r.jsx(an,{value:"sections",className:"flex-1",children:"Sections"}),r.jsx(an,{value:"blocks",className:"flex-1",children:"Blocks"}),r.jsx(an,{value:"analytics",className:"flex-1",children:"Analytics"})]}),r.jsxs(Cn,{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(Is,{checked:T.is_published,onCheckedChange:G=>P(Q=>({...Q,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(Ti,{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(X,{variant:"outline",size:"sm",asChild:!0,disabled:u,children:r.jsx("span",{children:u?r.jsxs(r.Fragment,{children:[r.jsx(Wr,{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(X,{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(hn,{value:T.theme,onValueChange:G=>P(Q=>({...Q,theme:G})),children:[r.jsx(cn,{children:r.jsx(fn,{})}),r.jsxs(dn,{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(Q=>({...Q,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(Q=>({...Q,positioning_statement:G.target.value})),placeholder:"Your home journey, handled with care."})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Bio"}),r.jsx(Xn,{value:T.bio,onChange:G=>P(Q=>({...Q,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(Q=>({...Q,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(Q=>({...Q,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(Q=>({...Q,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(Q=>({...Q,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(Q=>({...Q,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(Q=>({...Q,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(Q=>({...Q,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(Q=>({...Q,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(Q=>({...Q,team_logo_size:G})),min:24,max:120,step:4})]})]})]})]}),r.jsx(Cn,{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:Q,hint:ae})=>r.jsxs("div",{className:"flex items-center justify-between py-2",children:[r.jsxs("div",{children:[r.jsx(ze,{children:Q}),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(Is,{checked:T[G],onCheckedChange:oe=>P(de=>({...de,[G]:oe}))})]},G))}),r.jsx(Cn,{value:"blocks",className:"mt-4",children:r.jsx(IVe,{cardId:e.id})}),r.jsx(Cn,{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(Je,{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(Je,{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(Je,{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(Tt,{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(X,{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 iC={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"},ove={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 lve(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 PJt(){const e=qr();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 LJt(){const e=qr();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 OJt(){const e=qr();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 GVe(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 DJt(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 RJt(){const e=qr();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 FJt(){const e=qr();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 zJt(){const e=qr();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 BJt(){const e=qr();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 $Jt(){const e=qr();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 UJt(){const e=qr();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 qJt(){const e=qr();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 VJt(){const e=qr();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 HJt(){const e=qr();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 WJt(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 GJt(){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 KJt(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 ZJt(){const e=qr(),{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 YJt(){const e=qr();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 XJt(){const e=qr();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 QJt(){const e=qr();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 JJt(){const{data:e,isLoading:t}=lve(!1),n=PJt(),s=LJt(),a=OJt(),[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(Tr,{className:"h-8 w-48"})}),r.jsx(Je,{children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(k=>r.jsx(Tr,{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(Or,{open:o,onOpenChange:k=>{l(k),k||y()},children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Category"]})}),r.jsxs(Lr,{children:[r.jsx(zr,{children:r.jsx(Fr,{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(Xn,{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(Is,{id:"is_active",checked:m.is_active,onCheckedChange:k=>x({...m,is_active:k})}),r.jsx(ze,{htmlFor:"is_active",children:"Active"})]}),r.jsx(X,{type:"submit",className:"w-full",disabled:n.isPending||s.isPending,children:i?"Update Category":"Create Category"})]})]})]})]}),r.jsx(Je,{children:e&&e.length>0?r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:e.map(k=>r.jsxs(Nr,{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(X,{variant:"ghost",size:"icon",onClick:()=>v(k),children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>N(k.id),disabled:a.isPending,children:r.jsx(Un,{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 eer(){var be,we;const{data:e,isLoading:t}=GVe(void 0,!1),{data:n}=lve(!1),s=RJt(),a=FJt(),o=zJt(),l=BJt(),i=$Jt(),u=UJt(),m=qJt(),x=VJt(),y=HJt(),[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}),[Q,ae]=A.useState({name:"",price_adjustment:0}),[oe,de]=A.useState(""),se=()=>{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)},pe=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)},ne=async ve=>{ve.preventDefault();const et={...W,category_id:W.category_id||null};T?await a.mutateAsync({id:T.id,...et}):await s.mutateAsync(et),b(!1),se()},me=async ve=>{confirm("Are you sure you want to delete this product?")&&await o.mutateAsync(ve)},he=async ve=>{if(!F||!ve.target.files||ve.target.files.length===0)return;V(!0);const et=ve.target.files[0],Me=et.name.split(".").pop(),Ie=`products/${F.id}/${Date.now()}.${Me}`;try{const{error:$e}=await Y.storage.from("marketplace").upload(Ie,et);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:Q.name,price_adjustment:Q.price_adjustment}),ae({name:"",price_adjustment:0}))},Te=async()=>{!F||!oe||(await y.mutateAsync({productId:F.id,videoUrl:oe}),de(""))};return t?r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Tr,{className:"h-8 w-48"})}),r.jsx(Je,{children:r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(ve=>r.jsx(Tr,{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(Or,{open:v,onOpenChange:ve=>{b(ve),ve||se()},children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Product"]})}),r.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Fr,{children:T?"Edit Product":"Add Product"})}),r.jsxs("form",{onSubmit:ne,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(hn,{value:W.category_id,onValueChange:ve=>G({...W,category_id:ve}),children:[r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select category"})}),r.jsx(dn,{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(Xn,{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(Is,{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(Is,{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(Is,{id:"is_active",checked:W.is_active,onCheckedChange:ve=>G({...W,is_active:ve})}),r.jsx(ze,{htmlFor:"is_active",children:"Active"})]})]}),r.jsx(X,{type:"submit",className:"w-full",disabled:s.isPending||a.isPending,children:T?"Update Product":"Create Product"})]})]})]})]}),r.jsx(Je,{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 et,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:((et=ve.images.find(Ie=>Ie.is_primary))==null?void 0:et.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(Tt,{variant:"secondary",className:"absolute top-2 right-2",children:"Inactive"})]}),r.jsxs(Je,{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(Tt,{variant:"outline",className:"text-xs",children:"Artwork Upload"}),ve.requires_proof_approval&&r.jsx(Tt,{variant:"outline",className:"text-xs",children:"Proof Required"}),ve.variants&&ve.variants.length>0&&r.jsxs(Tt,{variant:"outline",className:"text-xs",children:[ve.variants.length," Variants"]})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(X,{variant:"outline",size:"sm",onClick:()=>pe(ve),children:[r.jsx(Ja,{className:"h-3 w-3 mr-1"}),"Edit"]}),r.jsxs(X,{variant:"outline",size:"sm",onClick:()=>{D(ve),k(!0)},children:[r.jsx(Dj,{className:"h-3 w-3 mr-1"}),"Images"]}),r.jsxs(X,{variant:"outline",size:"sm",onClick:()=>{D(ve),I(!0)},children:[r.jsx(qg,{className:"h-3 w-3 mr-1"}),"Variants"]}),r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>me(ve.id),children:r.jsx(Un,{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(Or,{open:N,onOpenChange:k,children:r.jsxs(Lr,{className:"max-w-2xl",children:[r.jsx(zr,{children:r.jsxs(Fr,{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:(be=F==null?void 0:F.images)==null?void 0:be.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(Tt,{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(X,{variant:"secondary",size:"icon",onClick:async()=>{var et;await u.mutateAsync({imageId:ve.id,productId:F.id}),D({...F,images:(et=F.images)==null?void 0:et.map(Me=>({...Me,is_primary:Me.id===ve.id}))})},disabled:u.isPending,title:"Set as primary",children:r.jsx(Ss,{className:"h-4 w-4"})}),r.jsx(X,{variant:"destructive",size:"icon",onClick:async()=>{var Me;await i.mutateAsync({id:ve.id,productId:F.id});const et=e==null?void 0:e.find(Ie=>Ie.id===F.id);et&&D({...et,images:(Me=et.images)==null?void 0:Me.filter(Ie=>Ie.id!==ve.id)})},disabled:i.isPending,children:r.jsx(Un,{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:he,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=>de(ve.target.value)}),r.jsxs(X,{onClick:Te,disabled:!oe,children:[r.jsx(Pa,{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(Or,{open:M,onOpenChange:I,children:r.jsxs(Lr,{children:[r.jsx(zr,{children:r.jsxs(Fr,{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:Q.name,onChange:ve=>ae({...Q,name:ve.target.value}),required:!0}),r.jsx(lt,{type:"number",step:"0.01",placeholder:"Price adj.",value:Q.price_adjustment,onChange:ve=>ae({...Q,price_adjustment:parseFloat(ve.target.value)||0}),className:"w-32"}),r.jsx(X,{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(X,{variant:"ghost",size:"icon",onClick:()=>x.mutateAsync({id:ve.id,productId:F.id}),children:r.jsx(Un,{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 ter=["pending_payment","order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed","cancelled","refunded"];function rer(){var k,M,I;const{data:e,isLoading:t}=WJt(),n=ZJt(),s=YJt(),[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(Tr,{className:"h-8 w-48"})}),r.jsx(Je,{children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(T=>r.jsx(Tr,{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(Je,{children:e&&e.length>0?r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:e.map(T=>{var P,F;return r.jsxs(Nr,{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:ln(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(Tt,{className:ove[T.status],children:iC[T.status]})}),r.jsx(yt,{className:"text-right",children:r.jsxs(X,{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(Or,{open:l,onOpenChange:i,children:r.jsxs(Lr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsxs(Fr,{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(Tt,{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(X,{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(hn,{value:u.status,onValueChange:T=>m({...u,status:T}),children:[r.jsx(cn,{children:r.jsx(fn,{})}),r.jsx(dn,{children:ter.map(T=>r.jsx($t,{value:T,children:iC[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(Xn,{value:u.notes,onChange:T=>m({...u,notes:T.target.value}),placeholder:"Add a note about this status change..."})]}),r.jsxs(X,{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(Tt,{variant:"outline",children:iC[T.status]}),T.notes&&r.jsx("p",{className:"text-muted-foreground mt-1",children:T.notes})]}),r.jsx("span",{className:"text-muted-foreground",children:ln(new Date(T.created_at),"MMM d, h:mm a")})]},T.id))})]})]})]})})]})}function ner(){const[e,t]=A.useState("products"),n=Wn();return r.jsx(Dr,{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(X,{variant:"outline",onClick:()=>n("/marketplace"),children:[r.jsx(Ms,{className:"h-4 w-4 mr-2"}),"View Store"]})]}),r.jsxs(ki,{value:e,onValueChange:t,children:[r.jsxs(wi,{className:"grid w-full grid-cols-3",children:[r.jsxs(an,{value:"products",className:"flex items-center gap-2",children:[r.jsx(ql,{className:"h-4 w-4"}),"Products"]}),r.jsxs(an,{value:"categories",className:"flex items-center gap-2",children:[r.jsx(Ap,{className:"h-4 w-4"}),"Categories"]}),r.jsxs(an,{value:"orders",className:"flex items-center gap-2",children:[r.jsx(Eh,{className:"h-4 w-4"}),"Orders"]})]}),r.jsx(Cn,{value:"products",children:r.jsx(eer,{})}),r.jsx(Cn,{value:"categories",children:r.jsx(JJt,{})}),r.jsx(Cn,{value:"orders",children:r.jsx(rer,{})})]})]})})}function KVe(){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 ser(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 aer(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 ier(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 oer(){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 ler(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 cer(){const e=qr();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 der(){const e=qr();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 uer(){const e=qr();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 her(){const e=qr();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 mer(){const e=qr();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 fer(){const e=qr();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 per(){const e=qr();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 ger(e){const t=e.match(/\/storage\/v1\/object\/public\/([^/]+)\/(.+)$/);return t?{bucket:t[1],path:t[2]}:null}async function xue(e,t){const n=ger(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 ZVe(){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 xer(){const e=qr();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 yer(){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,Q]=A.useState(""),[ae,oe]=A.useState("file"),[de,se]=A.useState(""),[pe,ne]=A.useState(""),[me,he]=A.useState(""),[xe,Te]=A.useState(!0),[be,we]=A.useState(null),[ve,et]=A.useState(!1),[Me,Ie]=A.useState(!1),$e=A.useRef(null),Be=A.useRef(null),{data:Ve,isLoading:ot}=KVe(),{data:At,isLoading:Oe}=ser(),{data:at,isLoading:le}=oer(),{data:qe,isLoading:Qe}=ZVe(),rt=der(),je=uer(),ut=her(),Ce=mer(),Ee=fer(),Ye=per(),Le=xer(),[Ke,tt]=A.useState({}),ct=Ot=>{Ot?(l(Ot),u(Ot.name),x(Ot.description||""),v(Ot.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 rt.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(Ot){console.error("Error saving category:",Ot),Ae.error("Failed to save category")}},zt=async()=>{if(b)try{await ut.mutateAsync(b),Ae.success("Category deleted successfully"),N(null)}catch(Ot){console.error("Error deleting category:",Ot),Ae.error("Failed to delete category")}},ir=Ot=>{var Gr;Ot?(T(Ot),F(Ot.name),U(Ot.description||""),W(Ot.category_id),Q(Ot.points_cost.toString()),oe(Ot.item_type),se(Ot.file_url||""),ne(Ot.preview_image_url||""),he(((Gr=Ot.max_quantity)==null?void 0:Gr.toString())||""),Te(Ot.is_active)):(T(null),F(""),U(""),W(null),Q(""),oe("file"),se(""),ne(""),he(""),Te(!0)),M(!0)},Mr=async(Ot,Gr)=>{Gr==="file"?et(!0):Ie(!0);try{const An=Ot.name.split(".").pop(),zn=`${Date.now()}-${Math.random().toString(36).substring(7)}.${An}`,ba=`${Gr==="file"?"items":"previews"}/${zn}`,{error:gi}=await Y.storage.from("reward-store").upload(ba,Ot);if(gi)throw gi;const{data:{publicUrl:Mo}}=Y.storage.from("reward-store").getPublicUrl(ba);Gr==="file"?se(Mo):ne(Mo),Ae.success("File uploaded successfully")}catch(An){console.error("Error uploading file:",An),Ae.error("Failed to upload file")}finally{Gr==="file"?et(!1):Ie(!1)}},Zr=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 Ot={name:P,description:D||null,category_id:V,points_cost:parseInt(G),item_type:ae,file_url:de||null,preview_image_url:pe||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,...Ot,current_quantity:I.max_quantity!==(me?parseInt(me):null)?me?parseInt(me):null:I.current_quantity}),Ae.success("Item updated successfully")):(await Ce.mutateAsync(Ot),Ae.success("Item created successfully")),M(!1)}catch(Ot){console.error("Error saving item:",Ot),Ae.error("Failed to save item")}},Br=async()=>{if(be)try{await Ye.mutateAsync(be),Ae.success("Item deleted successfully"),we(null)}catch(Ot){console.error("Error deleting item:",Ot),Ae.error("Failed to delete item")}},rn=async(Ot,Gr)=>{const An=Ke[Ot];if(An===void 0||An===Gr.toString())return;const zn=parseInt(An);if(isNaN(zn)||zn<0){Ae.error("Please enter a valid positive number");return}try{await Le.mutateAsync({id:Ot,points:zn}),Ae.success("Points updated successfully"),tt(ba=>{const gi={...ba};return delete gi[Ot],gi})}catch(ba){console.error("Error updating points:",ba),Ae.error("Failed to update points")}};return ot||Oe||le||Qe?r.jsx(Dr,{title:"Reward Store",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tr,{className:"h-8 w-64"}),r.jsx(Tr,{className:"h-96"})]})}):r.jsxs(Dr,{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(Je,{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:(At==null?void 0:At.length)||0}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(At==null?void 0:At.filter(Ot=>Ot.is_active).length)||0," active"]})]})}),r.jsx(He,{children:r.jsxs(Je,{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(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Ss,{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:[At&&At.length>0?Math.round(At.reduce((Ot,Gr)=>Ot+Gr.points_cost,0)/At.length):0," pts"]})]})})]}),r.jsxs(ki,{value:t,onValueChange:n,children:[r.jsxs(wi,{children:[r.jsx(an,{value:"items",children:"Items"}),r.jsx(an,{value:"categories",children:"Categories"}),r.jsx(an,{value:"purchases",children:"Purchases"}),r.jsx(an,{value:"point-settings",children:"Point Settings"})]}),r.jsx(Cn,{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(kn,{children:"Manage rewards that agents can purchase"})]}),r.jsxs(X,{onClick:()=>ir(),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Item"]})]}),r.jsx(Je,{children:!At||At.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(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:At.map(Ot=>r.jsxs(Nr,{children:[r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Ot.preview_image_url?r.jsx("img",{src:Ot.preview_image_url,alt:Ot.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:Ot.name}),r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:Ot.description||"No description"})]})]})}),r.jsx(yt,{children:Ot.category?r.jsx(Tt,{variant:"outline",children:Ot.category.name}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(yt,{className:"text-center",children:r.jsxs(Tt,{variant:"secondary",className:"font-bold",children:[r.jsx(Ss,{className:"h-3 w-3 mr-1"}),Ot.points_cost]})}),r.jsx(yt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[Ot.item_type==="file"?r.jsx(_a,{className:"h-4 w-4 text-muted-foreground"}):r.jsx(Ro,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-xs capitalize",children:Ot.item_type})]})}),r.jsx(yt,{className:"text-center",children:Ot.max_quantity!==null?r.jsxs("span",{className:Ot.current_quantity===0?"text-red-500":"",children:[Ot.current_quantity,"/",Ot.max_quantity]}):r.jsx("span",{className:"text-muted-foreground",children:"Unlimited"})}),r.jsx(yt,{className:"text-center",children:r.jsx(Tt,{variant:Ot.is_active?"default":"secondary",children:Ot.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(X,{variant:"ghost",size:"sm",onClick:()=>ir(Ot),children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>we(Ot.id),children:r.jsx(Un,{className:"h-4 w-4 text-destructive"})})]})})]},Ot.id))})]})})]})}),r.jsx(Cn,{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(kn,{children:"Organize your store items into categories"})]}),r.jsxs(X,{onClick:()=>ct(),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),r.jsx(Je,{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(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:Ve.map(Ot=>r.jsxs(Nr,{children:[r.jsxs(yt,{className:"font-medium",children:[Ot.icon&&r.jsx("span",{className:"mr-2",children:Ot.icon}),Ot.name]}),r.jsx(yt,{className:"text-muted-foreground",children:Ot.description||"—"}),r.jsx(yt,{className:"text-center",children:(At==null?void 0:At.filter(Gr=>Gr.category_id===Ot.id).length)||0}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>ct(Ot),children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>N(Ot.id),children:r.jsx(Un,{className:"h-4 w-4 text-destructive"})})]})})]},Ot.id))})]})})]})}),r.jsx(Cn,{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(Eh,{className:"h-5 w-5"}),"Purchase History"]}),r.jsx(kn,{children:"View all reward redemptions by agents"})]}),r.jsx(Je,{children:!at||at.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Eh,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No purchases yet."})]}):r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:at.map(Ot=>{var Gr,An,zn,ba;return r.jsxs(Nr,{children:[r.jsx(yt,{className:"text-muted-foreground",children:ln(new Date(Ot.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:((Gr=Ot.user)==null?void 0:Gr.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:((An=Ot.user)==null?void 0:An.email)||"—"})]})]})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[(zn=Ot.item)!=null&&zn.preview_image_url?r.jsx("img",{src:Ot.item.preview_image_url,alt:Ot.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:((ba=Ot.item)==null?void 0:ba.name)||"Deleted item"})]})}),r.jsx(yt,{className:"text-center",children:r.jsxs(Tt,{variant:"secondary",className:"font-bold",children:[r.jsx(Ss,{className:"h-3 w-3 mr-1"}),Ot.points_spent]})})]},Ot.id)})})]})})]})})]})]}),r.jsx(Or,{open:s,onOpenChange:a,children:r.jsxs(Lr,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:o?"Edit Category":"Add Category"}),r.jsx(Qn,{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:Ot=>u(Ot.target.value),placeholder:"e.g., Templates, Resources"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"categoryDescription",children:"Description"}),r.jsx(Xn,{id:"categoryDescription",value:m,onChange:Ot=>x(Ot.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:Ot=>v(Ot.target.value),placeholder:"e.g., 📄, 🎁"})]})]}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(X,{onClick:it,disabled:rt.isPending||je.isPending,children:rt.isPending||je.isPending?"Saving...":"Save"})]})]})}),r.jsx(Or,{open:k,onOpenChange:M,children:r.jsxs(Lr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:I?"Edit Item":"Add Item"}),r.jsx(Qn,{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:Ot=>F(Ot.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(Xn,{id:"itemDescription",value:D,onChange:Ot=>U(Ot.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(hn,{value:V||"none",onValueChange:Ot=>W(Ot==="none"?null:Ot),children:[r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select category"})}),r.jsxs(dn,{children:[r.jsx($t,{value:"none",children:"No category"}),Ve==null?void 0:Ve.map(Ot=>r.jsxs($t,{value:Ot.id,children:[Ot.icon&&`${Ot.icon} `,Ot.name]},Ot.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:Ot=>Q(Ot.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(hn,{value:ae,onValueChange:oe,children:[r.jsx(cn,{children:r.jsx(fn,{})}),r.jsxs(dn,{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:Ot=>he(Ot.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:de,onChange:Ot=>se(Ot.target.value),placeholder:ae==="file"?"Upload a file or paste URL":"Paste external link"}),ae==="file"&&r.jsxs(r.Fragment,{children:[r.jsx(X,{type:"button",variant:"outline",size:"icon",onClick:()=>{var Ot;return(Ot=$e.current)==null?void 0:Ot.click()},disabled:ve,children:r.jsx(bo,{className:"h-4 w-4"})}),r.jsx("input",{ref:$e,type:"file",className:"hidden",onChange:Ot=>{var An;const Gr=(An=Ot.target.files)==null?void 0:An[0];Gr&&Mr(Gr,"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:pe,onChange:Ot=>ne(Ot.target.value),placeholder:"Upload an image or paste URL"}),r.jsx(X,{type:"button",variant:"outline",size:"icon",onClick:()=>{var Ot;return(Ot=Be.current)==null?void 0:Ot.click()},disabled:Me,children:r.jsx(Fl,{className:"h-4 w-4"})}),r.jsx("input",{ref:Be,type:"file",accept:"image/*",className:"hidden",onChange:Ot=>{var An;const Gr=(An=Ot.target.files)==null?void 0:An[0];Gr&&Mr(Gr,"preview")}})]}),pe&&r.jsx("img",{src:pe,alt:"Preview",className:"mt-2 h-24 rounded object-cover"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Is,{id:"itemIsActive",checked:xe,onCheckedChange:Te}),r.jsx(ze,{htmlFor:"itemIsActive",children:"Active (visible to agents)"})]})]}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),r.jsx(X,{onClick:Zr,disabled:Ce.isPending||Ee.isPending,children:Ce.isPending||Ee.isPending?"Saving...":"Save"})]})]})}),r.jsx(Ld,{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(Ld,{open:!!be,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:Br,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(Bd,{className:"h-5 w-5"}),r.jsxs("div",{children:[r.jsx(Gt,{children:"Point Reward Settings"}),r.jsx(kn,{children:"Configure how many points agents earn for various actions. Adjust these values to run double-points promotions."})]})]})}),r.jsx(Je,{children:!qe||qe.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Bd,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No point settings configured."})]}):r.jsxs(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{children:qe.map(Ot=>r.jsxs(Nr,{children:[r.jsx(yt,{children:r.jsx("p",{className:"font-medium",children:Ot.action_name})}),r.jsx(yt,{children:r.jsx("p",{className:"text-sm text-muted-foreground",children:Ot.description})}),r.jsx(yt,{className:"text-center",children:r.jsx(lt,{type:"number",min:"0",className:"w-20 mx-auto text-center",value:Ke[Ot.id]??Ot.points.toString(),onChange:Gr=>tt(An=>({...An,[Ot.id]:Gr.target.value}))})}),r.jsx(yt,{className:"text-right",children:r.jsx(X,{size:"sm",variant:"outline",disabled:Ke[Ot.id]===void 0||Ke[Ot.id]===Ot.points.toString()||Le.isPending,onClick:()=>rn(Ot.id,Ot.points),children:r.jsx(Ip,{className:"h-4 w-4"})})})]},Ot.id))})]})})]})]})}const NTe=()=>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"})]}),STe=[{value:"template",label:"Templates"},{value:"brand",label:"Brand Assets"},{value:"listing",label:"Listing Assets"},{value:"social",label:"Social Media"},{value:"general",label:"General"}];function ver(){const e=qr(),[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 Q=oe=>{var de,se;oe.origin===window.location.origin&&(((de=oe.data)==null?void 0:de.type)==="canva-oauth-success"?(window.removeEventListener("message",Q),Ae.success("Canva connected successfully!"),e.invalidateQueries({queryKey:["canva-integration"]}),n(!1)):((se=oe.data)==null?void 0:se.type)==="canva-oauth-error"&&(window.removeEventListener("message",Q),Ae.error("Canva connection failed: "+(oe.data.error||"Unknown error")),n(!1)))};window.addEventListener("message",Q);const ae=setInterval(()=>{G.closed&&(clearInterval(ae),window.removeEventListener("message",Q),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(NTe,{})}),r.jsxs("div",{children:[r.jsxs(Gt,{className:"text-lg flex items-center gap-2",children:["Canva Connect",I&&r.jsx(Tt,{variant:"default",className:"text-xs",children:"Connected"}),r.jsx(Tt,{variant:"outline",className:"text-xs",children:"Admin Only"})]}),r.jsx(kn,{children:"Auto-share brokerage asset folders with agents when they connect their Canva accounts."})]})]})})}),r.jsx(Je,{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(li,{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(li,{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(li,{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(Ld,{children:[r.jsx(kp,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Un,{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(Tt,{variant:"secondary",className:"text-xs",children:v.length})]}),s?r.jsx(ly,{className:"h-4 w-4"}):r.jsx(Fd,{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(Tt,{variant:"outline",className:"text-xs shrink-0",children:((P=STe.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(X,{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(us,{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(X,{variant:"outline",size:"sm",className:"w-full gap-1.5 mt-1",onClick:()=>l(!0),children:[r.jsx(bn,{className:"h-3.5 w-3.5"}),"Add Folder Mapping"]})]})]})]}):r.jsxs(X,{className:"mt-4",onClick:b,disabled:t||x,children:[t?r.jsx(Wo,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx("div",{className:"mr-2",children:r.jsx(NTe,{})}),"Connect Canva",r.jsx(No,{className:"h-4 w-4 ml-2"})]})]})})]}),r.jsx(Or,{open:o,onOpenChange:l,children:r.jsxs(Lr,{children:[r.jsx(zr,{children:r.jsx(Fr,{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(hn,{value:i.brokerage_id,onValueChange:T=>u(P=>({...P,brokerage_id:T})),children:[r.jsx(cn,{children:r.jsx(fn,{placeholder:"Select a brokerage…"})}),r.jsx(dn,{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(hn,{value:i.folder_type,onValueChange:T=>u(P=>({...P,folder_type:T})),children:[r.jsx(cn,{children:r.jsx(fn,{})}),r.jsx(dn,{children:STe.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(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsxs(X,{onClick:()=>k.mutate(i),disabled:!i.brokerage_id||!i.folder_id||!i.folder_name||k.isPending,children:[k.isPending?r.jsx(Wo,{className:"h-4 w-4 mr-2 animate-spin"}):null,"Add Folder"]})]})]})})]})}function _er(){return r.jsx(Dr,{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(ver,{})]})})}const ber={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 CT(e,t=18,n=10){return e.length<=t+n+3?e:`${e.slice(0,t)}…${e.slice(-n)}`}function wer(){var ae,oe,de,se,pe;const e=qr(),[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:ne,error:me}=await Y.from("push_notification_settings").select("*").order("setting_key");if(me)throw me;return ne}}),{data:P,isLoading:F}=Zt({queryKey:["push-subscription-stats"],queryFn:async()=>{const{count:ne,error:me}=await Y.from("push_subscriptions").select("*",{count:"exact",head:!0});if(me)throw me;return{totalSubscriptions:ne||0}}}),D=ar({mutationFn:async({settingKey:ne,isEnabled:me})=>{const{error:he}=await Y.from("push_notification_settings").update({is_enabled:me}).eq("setting_key",ne);if(he)throw he},onSuccess:()=>{e.invalidateQueries({queryKey:["push-notification-settings"]}),Ae.success("Notification setting updated")},onError:ne=>{Ae.error("Failed to update setting: "+ne.message)}}),U=A.useMemo(()=>{var ne,me;return y.isSupported?`perm=${y.permission??"unknown"} · controller=${y.controllerPresent?"yes":"no"} · sw=${((ne=y.serviceWorker)==null?void 0:ne.activeState)??"unknown"} · sub=${(me=y.subscription)!=null&&me.endpoint?"yes":"no"}`:"Push not supported in this browser."},[y]);A.useEffect(()=>{let ne=!0;const me=async()=>{var be,we,ve,et,Me,Ie,$e;const xe="serviceWorker"in navigator&&"PushManager"in window,Te={isSupported:xe,permission:typeof Notification<"u"?Notification.permission:void 0,controllerPresent:!!((be=navigator.serviceWorker)!=null&&be.controller)};if(!xe){ne&&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 At=(await navigator.serviceWorker.getRegistrations()).find(Oe=>{var le,qe,Qe;return(((le=Oe.active)==null?void 0:le.scriptURL)||((qe=Oe.waiting)==null?void 0:qe.scriptURL)||((Qe=Oe.installing)==null?void 0:Qe.scriptURL)||"").includes("/sw.js")});if(At){Te.pushWorkerScriptUrl=((we=At.active)==null?void 0:we.scriptURL)||((ve=At.waiting)==null?void 0:ve.scriptURL)||((et=At.installing)==null?void 0:et.scriptURL),Te.serviceWorker={scope:At.scope,activeState:(Me=At.active)==null?void 0:Me.state};const Oe=await At.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)}ne&&v(Te)};me();const he=window.setInterval(me,4e3);return()=>{ne=!1,window.clearInterval(he)}},[]);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(ne){Ae.error(`Local notification failed: ${(ne==null?void 0:ne.message)||String(ne)}`)}},W=async()=>{u(!0),N(null);try{const{data:ne,error:me}=await Y.functions.invoke("send-push-notification",{body:{title:t,body:s,url:o}});if(me)throw me;N({sent:ne==null?void 0:ne.sent,failed:ne==null?void 0:ne.failed,expiredCleaned:ne==null?void 0:ne.expiredCleaned,vapidPublicKey:ne==null?void 0:ne.vapidPublicKey}),(ne==null?void 0:ne.sent)>0?Ae.success(`Test notification sent to ${ne.sent} subscriber(s)`):(ne==null?void 0:ne.failed)>0?Ae.warning(`Notification failed for ${ne.failed} subscriber(s). ${ne.expired||0} expired subscriptions cleaned up.`):Ae.info("No active subscriptions to send to")}catch(ne){console.error("Error sending test notification:",ne),N({error:(ne==null?void 0:ne.message)||String(ne)}),Ae.error("Failed to send test notification: "+(ne.message||"Unknown error"))}finally{u(!1)}},G=async()=>{x(!0),M(null);try{const{data:ne,error:me}=await Y.functions.invoke("generate-vapid-keys",{body:{}});if(me)throw me;const he=ne==null?void 0:ne.publicKey,xe=ne==null?void 0:ne.privateKey;if(!he||!xe)throw new Error("generate-vapid-keys did not return keys");M({publicKey:he,privateKey:xe}),Ae.success("Generated new VAPID keys. Update backend secrets, then clear + re-subscribe.")}catch(ne){console.error("Error generating VAPID keys:",ne),Ae.error("Failed to generate VAPID keys: "+((ne==null?void 0:ne.message)||"Unknown error"))}finally{x(!1)}},Q=ar({mutationFn:async()=>{const{error:ne}=await Y.from("push_subscriptions").delete().neq("id","00000000-0000-0000-0000-000000000000");if(ne)throw ne},onSuccess:()=>{Ae.success("All subscriptions cleared. Users will need to re-enable notifications."),e.invalidateQueries({queryKey:["push-subscription-stats"]})},onError:ne=>{Ae.error("Failed to clear subscriptions: "+ne.message)}});return r.jsx(Dr,{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(qn,{className:"h-5 w-5"}),"Push Notification Subscribers"]}),r.jsx(kn,{children:"Current active push notification subscriptions"})]}),r.jsx(Je,{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(Bd,{className:"h-5 w-5"}),"Notification Types"]}),r.jsx(kn,{children:"Control which types of push notifications are sent to users"})]}),r.jsx(Je,{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(ne=>{const me=ber[ne.setting_key]||{label:ne.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:ne.description})]})]}),r.jsx(Is,{checked:ne.is_enabled,onCheckedChange:he=>D.mutate({settingKey:ne.setting_key,isEnabled:he}),disabled:D.isPending})]},ne.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(kn,{children:"Send a test push notification to all subscribed users"})]}),r.jsxs(Je,{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?CT(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?CT(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: ",(de=y.subscription)!=null&&de.endpoint?CT(y.subscription.endpoint,40,12):"none"]}),r.jsxs("div",{children:["p256dh: ",(se=y.subscription)!=null&&se.p256dh?CT(y.subscription.p256dh,22,10):"none"]}),r.jsxs("div",{children:["auth: ",(pe=y.subscription)!=null&&pe.auth?CT(y.subscription.auth,22,10):"none"]})]})]})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[r.jsx(X,{variant:"outline",onClick:V,children:"Local notification test"}),r.jsx(X,{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:ne=>n(ne.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(Xn,{id:"test-body",value:s,onChange:ne=>a(ne.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:ne=>l(ne.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(X,{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(Un,{className:"h-5 w-5"}),"Subscription Maintenance"]}),r.jsx(kn,{children:"Clear all push subscriptions if VAPID keys were changed or subscriptions are invalid"})]}),r.jsxs(Je,{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(X,{variant:"destructive",onClick:()=>Q.mutate(),disabled:Q.isPending,children:[r.jsx(Un,{className:"h-4 w-4 mr-2"}),Q.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(X,{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 jer(){const{toast:e}=pi(),[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:qn,color:"text-blue-600"},{label:"Total Presentations",value:s.totalPresentations,icon:gy,color:"text-violet-600"},{label:"Total Views",value:s.totalViews,icon:_o,color:"text-emerald-600"},{label:"Total Leads",value:s.totalLeads,icon:nh,color:"text-amber-600"},{label:"CTA Clicks",value:s.totalCtaClicks,icon:Z1,color:"text-rose-600"}];return r.jsx(Dr,{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(Je,{children:o?r.jsx(Tr,{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(rh,{className:"h-5 w-5"}),"Agent Breakdown"]})}),r.jsx(Je,{children:o?r.jsx("div",{className:"space-y-3",children:[...Array(5)].map((m,x)=>r.jsx(Tr,{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(Rs,{children:[r.jsx(Fs,{children:r.jsxs(Nr,{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(zs,{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(Nr,{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(Tt,{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 ker(){const[e]=Zc(),t=Wn(),[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(Wr,{className:"h-12 w-12 animate-spin text-primary"}),n==="success"&&r.jsx(li,{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(kn,{children:a})]}),r.jsx(Je,{className:"flex justify-center",children:r.jsx(X,{onClick:()=>t("/admin/integrations"),children:n==="success"?"View Integrations":"Back to Integrations"})})]})})}function Ner(){const e=Wn(),t=qr(),{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(Dr,{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(Tt,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Ds,{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(X,{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(Je,{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(Qa,{className:"h-10 w-10 text-amber-600 dark:text-amber-400"})}),r.jsx(Tt,{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(Je,{className:"flex items-center gap-4 p-4",children:[r.jsx("div",{className:"rounded-full bg-green-500 p-2",children:r.jsx(li,{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(kn,{children:"Connect your Facebook Pages"})]})]})}),r.jsxs(Je,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Wo,{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(Ti,{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(Tt,{variant:D.is_active?"default":"secondary",className:"text-xs",children:D.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Ld,{children:[r.jsx(kp,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Un,{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(X,{onClick:v,disabled:s,className:"w-full gap-2",variant:k.length>0?"outline":"default",children:[s?r.jsx(Wo,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{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(kn,{children:"Connect Instagram Business accounts"})]})]})}),r.jsxs(Je,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Wo,{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(Ti,{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(Tt,{variant:D.is_active?"default":"secondary",className:"text-xs",children:D.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Ld,{children:[r.jsx(kp,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Un,{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(X,{onClick:v,disabled:s,className:"w-full gap-2",variant:M.length>0?"outline":"default",children:[s?r.jsx(Wo,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{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(ym,{className:"h-6 w-6 text-blue-700"})}),r.jsxs("div",{children:[r.jsx(Gt,{className:"text-lg",children:"LinkedIn"}),r.jsx(kn,{children:"Connect your LinkedIn profile"})]})]})}),r.jsxs(Je,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Wo,{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(Ti,{src:D.profile_picture_url||""}),r.jsx(ta,{children:r.jsx(ym,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:D.platform_username||"LinkedIn Account"}),r.jsx(Tt,{variant:D.is_active?"default":"secondary",className:"text-xs",children:D.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Ld,{children:[r.jsx(kp,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Un,{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(X,{onClick:b,disabled:s,className:"w-full gap-2",variant:I.length>0?"outline":"default",children:[s?r.jsx(Wo,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{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(Tt,{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(Tt,{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(Fo,{className:"h-6 w-6 text-red-600"})}),r.jsxs("div",{children:[r.jsx(Gt,{className:"text-lg",children:"Google Business"}),r.jsx(kn,{children:"Connect your Google Business Profile"})]})]})}),r.jsxs(Je,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Wo,{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(Ti,{src:D.profile_picture_url||""}),r.jsx(ta,{children:r.jsx(Fo,{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(Tt,{variant:D.is_active?"default":"secondary",className:"text-xs",children:D.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Ld,{children:[r.jsx(kp,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Un,{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(X,{onClick:n?N:void 0,disabled:!n||s,className:"w-full gap-2",variant:T.length>0?"outline":"default",children:[s?r.jsx(Wo,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{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(kn,{children:"Run API tests to trigger all required permissions for Meta App Review"})]})]})}),r.jsxs(Je,{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(X,{size:"sm",variant:"outline",onClick:()=>F(D.id),disabled:o===D.id,children:o===D.id?r.jsxs(r.Fragment,{children:[r.jsx(Wr,{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(X,{size:"sm",variant:"outline",onClick:()=>F(D.id),disabled:o===D.id,children:o===D.id?r.jsxs(r.Fragment,{children:[r.jsx(Wr,{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(Wr,{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(Je,{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 Ser(){const[e]=Zc(),t=Wn(),[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(Wr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(li,{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(kn,{children:a})]}),r.jsx(Je,{className:"flex justify-center",children:n!=="loading"&&r.jsx(X,{onClick:()=>t("/mission-control/integrations"),children:n==="success"?"View Connected Accounts":"Try Again"})})]})})}function Cer(){const[e]=Zc(),t=Wn(),[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(Wr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(li,{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(kn,{children:a})]}),r.jsx(Je,{className:"flex justify-center",children:n!=="loading"&&r.jsx(X,{onClick:()=>t("/social-connections"),children:n==="success"?"View Connected Accounts":"Try Again"})})]})})}function Mer(){const[e]=Zc(),t=Wn(),[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(Wr,{className:"h-8 w-8 animate-spin text-blue-600"}),n==="success"&&r.jsx(li,{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(ym,{className:"h-5 w-5 text-blue-600"}),n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(kn,{children:a})]}),r.jsx(Je,{className:"flex justify-center",children:r.jsx(X,{onClick:()=>t("/social-connections"),disabled:n==="loading",children:n==="success"?"Continue":"Back to Connections"})})]})})}function Ter(){const e=Wn(),[t,n]=A.useState(null),{data:s,isLoading:a}=GVe(t||void 0,!0),{data:o,isLoading:l}=lve(!0),{cartItems:i}=cae(),u=i.reduce((x,y)=>x+y.quantity,0),m=x=>{e(`/marketplace/${x.id}`)};return a||l?r.jsx(Dr,{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(Tr,{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(Tr,{className:"h-72 w-full"},x))})]})}):r.jsx(Dr,{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(X,{variant:"outline",onClick:()=>e("/marketplace/cart"),className:"relative",children:[r.jsx(Eh,{className:"h-4 w-4 mr-2"}),"Cart",u>0&&r.jsx(Tt,{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(X,{variant:t===null?"default":"outline",size:"sm",onClick:()=>n(null),children:"All"}),o.map(x=>r.jsx(X,{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(Tt,{className:"absolute top-2 left-2",variant:"secondary",children:x.category.name})]}),r.jsxs(Je,{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 YVe=A.forwardRef(({...e},t)=>r.jsx("nav",{ref:t,"aria-label":"breadcrumb",...e}));YVe.displayName="Breadcrumb";const XVe=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}));XVe.displayName="BreadcrumbList";const rte=A.forwardRef(({className:e,...t},n)=>r.jsx("li",{ref:n,className:Ut("inline-flex items-center gap-1.5",e),...t}));rte.displayName="BreadcrumbItem";const tge=A.forwardRef(({asChild:e,className:t,...n},s)=>{const a=e?Jge:"a";return r.jsx(a,{ref:s,className:Ut("transition-colors hover:text-foreground",t),...n})});tge.displayName="BreadcrumbLink";const QVe=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}));QVe.displayName="BreadcrumbPage";const rge=({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,{})});rge.displayName="BreadcrumbSeparator";function Aer(){var de,se;const{productId:e}=Ec(),t=Wn(),{data:n,isLoading:s}=DJt(e||""),{addToCart:a,cartItems:o}=cae(),[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=(de=n==null?void 0:n.variants)==null?void 0:de.find(pe=>pe.id===l),P=((se=n==null?void 0:n.variants)==null?void 0:se.filter(pe=>pe.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((pe,ne)=>pe+ne.quantity,0),G=async pe=>{if(!pe.target.files||pe.target.files.length===0)return;k(!0);const ne=pe.target.files[0],me=ne.name.split(".").pop(),he=`artwork/${Date.now()}-${Math.random().toString(36).substring(7)}.${me}`;try{const{error:xe}=await Y.storage.from("marketplace").upload(he,ne);if(xe)throw xe;const{data:{publicUrl:Te}}=Y.storage.from("marketplace").getPublicUrl(he);b(Te),Ae.success("Artwork uploaded successfully")}catch(xe){Ae.error("Failed to upload artwork: "+xe.message)}finally{k(!1)}},Q=()=>{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(pe=>(pe+1)%n.images.length)},oe=()=>{n!=null&&n.images&&y(pe=>(pe-1+n.images.length)%n.images.length)};return s?r.jsx(Dr,{title:"Product",children:r.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[r.jsx(Tr,{className:"aspect-square w-full"}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(Tr,{className:"h-8 w-3/4"}),r.jsx(Tr,{className:"h-6 w-1/4"}),r.jsx(Tr,{className:"h-24 w-full"}),r.jsx(Tr,{className:"h-12 w-full"})]})]})}):n?r.jsxs(Dr,{title:n.name,children:[r.jsx(YVe,{className:"mb-6",children:r.jsxs(XVe,{children:[r.jsx(rte,{children:r.jsx(tge,{asChild:!0,children:r.jsx(co,{to:"/marketplace",children:"Marketplace"})})}),n.category&&r.jsxs(r.Fragment,{children:[r.jsx(rge,{}),r.jsx(rte,{children:r.jsx(tge,{asChild:!0,children:r.jsx(co,{to:`/marketplace?category=${n.category.id}`,children:n.category.name})})})]}),r.jsx(rge,{}),r.jsx(rte,{children:r.jsx(QVe,{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(X,{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(X,{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((pe,ne)=>r.jsx("button",{onClick:()=>y(ne),className:`w-16 h-16 flex-shrink-0 rounded-md overflow-hidden border-2 ${ne===x?"border-primary":"border-transparent"}`,children:r.jsx("img",{src:pe.image_url,alt:"",className:"w-full h-full object-cover"})},pe.id))}),n.video&&r.jsx(He,{children:r.jsxs(Je,{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(Tt,{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(pe=>r.jsxs(X,{variant:l===pe.id?"default":"outline",onClick:()=>i(pe.id),children:[pe.name,Number(pe.price_adjustment)!==0&&r.jsxs("span",{className:"ml-1 opacity-70",children:["(",Number(pe.price_adjustment)>0?"+":"","$",Number(pe.price_adjustment).toFixed(2),")"]})]},pe.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(X,{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(X,{variant:"outline",size:"icon",onClick:()=>m(pe=>Math.max(1,pe-1)),children:"-"}),r.jsx(lt,{type:"number",value:u,onChange:pe=>m(Math.max(1,parseInt(pe.target.value)||1)),className:"w-20 text-center",min:"1"}),r.jsx(X,{variant:"outline",size:"icon",onClick:()=>m(pe=>pe+1),children:"+"})]})]}),r.jsxs("div",{className:"flex gap-4",children:[r.jsx(X,{size:"lg",className:"flex-1",onClick:Q,disabled:M,children:M?r.jsxs(r.Fragment,{children:[r.jsx(fi,{className:"h-5 w-5 mr-2"}),"Added!"]}):r.jsxs(r.Fragment,{children:[r.jsx(Eh,{className:"h-5 w-5 mr-2"}),"Add to Cart"]})}),r.jsxs(X,{variant:"outline",size:"lg",onClick:()=>t("/marketplace/cart"),className:"relative",children:[r.jsx(Eh,{className:"h-5 w-5"}),W>0&&r.jsx(Tt,{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(Dr,{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(X,{onClick:()=>t("/marketplace"),children:"Back to Marketplace"})]})})}function Eer(){const e=Wn(),{cartItems:t,removeFromCart:n,updateQuantity:s,getItemPrice:a,getSubtotal:o,getShippingTotal:l,getTotal:i,clearCart:u}=cae(),[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(Dr,{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(X,{onClick:()=>e("/marketplace"),children:"Browse Marketplace"})]})}):r.jsx(Dr,{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(Je,{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(X,{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(Un,{className:"h-4 w-4 text-destructive"})}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(X,{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(X,{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(bn,{className:"h-3 w-3"})})]})]})]})})},`${N.product.id}-${((M=N.variant)==null?void 0:M.id)||"base"}`)}),r.jsx(X,{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(Je,{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(Dd,{}),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(Dd,{}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"orderNotes",children:"Order Notes (Optional)"}),r.jsx(Xn,{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(X,{className:"w-full",size:"lg",onClick:b,disabled:m,children:m?r.jsxs(r.Fragment,{children:[r.jsx(Wr,{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 Ier(){const e=Wn(),{data:t,isLoading:n}=GJt();return n?r.jsx(Dr,{title:"My Orders",children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(s=>r.jsx(Tr,{className:"h-32 w-full"},s))})}):!t||t.length===0?r.jsx(Dr,{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(X,{onClick:()=>e("/marketplace"),children:"Browse Marketplace"})]})}):r.jsx(Dr,{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(Je,{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:ln(new Date(s.created_at),"MMM d, yyyy")})]}),r.jsx(Tt,{className:ove[s.status],children:iC[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(X,{variant:"outline",size:"sm",onClick:i=>{i.stopPropagation(),window.open(s.tracking_url,"_blank")},children:[r.jsx(Ms,{className:"h-4 w-4 mr-1"}),"Track"]}),r.jsx(Gi,{className:"h-5 w-5 text-muted-foreground"})]})]})]})},s.id)})})})}const CTe=["order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed"];function Per({currentStatus:e,statusHistory:t}){const n=CTe.indexOf(e);return r.jsx("div",{className:"space-y-3",children:CTe.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(Qa,{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:iC[s]}),o&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[ln(new Date(o.created_at),"MMM d, yyyy h:mm a"),o.notes&&` — ${o.notes}`]})]})]},s)})})}function Ler(){var I;const{orderId:e}=Ec(),t=Wn(),{data:n,isLoading:s,refetch:a}=KJt(e||""),o=XJt(),l=QJt(),[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(Dr,{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(Tr,{className:"h-64 w-full"}),r.jsx(Tr,{className:"h-48 w-full"})]}),r.jsx(Tr,{className:"h-96 w-full"})]})}):n?r.jsxs(Dr,{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(Tt,{className:ove[n.status],children:iC[n.status]})]}),r.jsx(Je,{children:r.jsx(Per,{currentStatus:n.status,statusHistory:n.status_history})})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{children:"Items"})}),r.jsx(Je,{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(V1,{className:"h-4 w-4"}),"View Artwork",r.jsx(Ms,{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(V1,{className:"h-4 w-4"}),"View Proof",r.jsx(Ms,{className:"h-3 w-3"})]}),T.proof_status==="pending"&&r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsxs(X,{size:"sm",onClick:()=>k(T.id),disabled:b===T.id,children:[b===T.id?r.jsx(Wr,{className:"h-4 w-4 mr-1 animate-spin"}):r.jsx(pd,{className:"h-4 w-4 mr-1"}),"Approve"]}),r.jsxs(X,{size:"sm",variant:"outline",onClick:()=>{x(T.id),u(!0)},disabled:b===T.id,children:[r.jsx(MA,{className:"h-4 w-4 mr-1"}),"Request Changes"]})]}),T.proof_status==="approved"&&r.jsxs(Tt,{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(Tt,{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(AA,{className:"h-5 w-5"}),"Shipping"]})}),r.jsxs(Je,{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(X,{variant:"link",className:"p-0 h-auto mt-1",onClick:()=>window.open(n.tracking_url,"_blank"),children:["Track Package",r.jsx(Ms,{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(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Placed on ",ln(new Date(n.created_at),"MMMM d, yyyy")]}),r.jsx(Dd,{}),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(Dd,{}),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(Dd,{}),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(Or,{open:i,onOpenChange:u,children:r.jsxs(Lr,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Request Changes"}),r.jsx(Qn,{children:"Please describe what changes you'd like made to the proof."})]}),r.jsx(Xn,{placeholder:"Describe the changes needed...",value:y,onChange:T=>v(T.target.value),rows:4}),r.jsxs(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsxs(X,{onClick:M,disabled:!y.trim()||b!==null,children:[b?r.jsx(Wr,{className:"h-4 w-4 mr-2 animate-spin"}):null,"Submit Request"]})]})]})})]}):r.jsx(Dr,{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(X,{onClick:()=>t("/marketplace/orders"),children:"View All Orders"})]})})}function Oer(){const e=Wn(),[t]=Zc();return t.get("session_id"),A.useEffect(()=>{localStorage.removeItem("marketplace-cart")},[]),r.jsx(Dr,{title:"Order Confirmed",children:r.jsx("div",{className:"max-w-lg mx-auto text-center py-8",children:r.jsx(He,{children:r.jsxs(Je,{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(X,{className:"flex-1",onClick:()=>e("/marketplace/orders"),children:["View My Orders",r.jsx(No,{className:"h-4 w-4 ml-2"})]}),r.jsx(X,{variant:"outline",className:"flex-1",onClick:()=>e("/marketplace"),children:"Continue Shopping"})]})]})})})})}function Der(){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}=uRe(),{data:Q}=ZVe(),{data:ae,isLoading:oe}=KVe(),{data:de,isLoading:se}=aer(s),{data:pe,isLoading:ne}=ier(e==null?void 0:e.id),{data:me=0}=ler(e==null?void 0:e.id),he=cer(),xe=new Set((pe==null?void 0:pe.map(Ie=>Ie.item_id))||[]),Te=async()=>{if(o)try{await he.mutateAsync(o.id),Ae.success(`Successfully purchased "${o.name}"!`),l(null)}catch(Ie){Ae.error(Ie.message||"Failed to purchase item")}},be=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")},et=()=>{M(!1),u(!1),T("")};return oe||se||ne?r.jsx(Dr,{title:"Reward Store",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tr,{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(Tr,{className:"h-64"},Ie))})]})}):r.jsxs(Dr,{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(Je,{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(Ss,{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(pm,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{children:"Streak bonuses add extra points!"})]})]})]})})}),r.jsx(G4,{open:D,onOpenChange:U,children:r.jsxs(He,{className:"border-primary/20",children:[r.jsx(K4,{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(kn,{children:"See all the ways you can earn spendable points"})]})]}),D?r.jsx(ly,{className:"h-5 w-5 text-muted-foreground"}):r.jsx(Fd,{className:"h-5 w-5 text-muted-foreground"})]})})}),r.jsx(Z4,{children:r.jsx(Je,{className:"pt-0",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:[Q==null?void 0:Q.filter(Ie=>Ie.is_active).map(Ie=>{const $e=Be=>{switch(Be){case"event_attendance":return r.jsx(Ts,{className:"h-5 w-5"});case"leave_review":return r.jsx(Ss,{className:"h-5 w-5"});case"add_listing":return r.jsx(ya,{className:"h-5 w-5"});case"first_contact":return r.jsx(qn,{className:"h-5 w-5"});case"first_video":return r.jsx(Pa,{className:"h-5 w-5"});case"first_community_post":return r.jsx(zo,{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(Tt,{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(pm,{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(Tt,{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(Je,{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(zo,{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(X,{onClick:()=>u(!0),className:"bg-yellow-600 hover:bg-yellow-700",children:[r.jsx(Ss,{className:"h-4 w-4 mr-2"}),"Leave Review"]})]})})}),r.jsxs(ki,{value:t,onValueChange:n,children:[r.jsxs(wi,{children:[r.jsxs(an,{value:"store",className:"flex items-center gap-2",children:[r.jsx($g,{className:"h-4 w-4"}),"Store"]}),r.jsxs(an,{value:"my-rewards",className:"flex items-center gap-2",children:[r.jsx(ql,{className:"h-4 w-4"}),"My Rewards",pe&&pe.length>0&&r.jsx(Tt,{variant:"secondary",className:"ml-1",children:pe.length})]})]}),r.jsxs(Cn,{value:"store",className:"mt-6",children:[ae&&ae.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[r.jsx(X,{variant:s===null?"default":"outline",size:"sm",onClick:()=>a(null),children:"All"}),ae.map(Ie=>r.jsxs(X,{variant:s===Ie.id?"default":"outline",size:"sm",onClick:()=>a(Ie.id),children:[Ie.icon&&`${Ie.icon} `,Ie.name]},Ie.id))]}),!de||de.length===0?r.jsx(He,{children:r.jsx(Je,{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:de.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(Tt,{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(Tt,{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(Tt,{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(Tt,{variant:"secondary",className:"font-bold shrink-0",children:[r.jsx(Ss,{className:"h-3 w-3 mr-1"}),Ie.points_cost]})]}),Ie.category&&r.jsxs(Tt,{variant:"outline",className:"w-fit",children:[Ie.category.icon&&`${Ie.category.icon} `,Ie.category.name]})]}),r.jsxs(Je,{children:[r.jsx(kn,{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(X,{className:"w-full",onClick:ot=>{ot.stopPropagation(),Ie.file_url&&xue(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(Ms,{className:"h-4 w-4 mr-2"}),"Access"]})}):r.jsx(X,{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(Cn,{value:"my-rewards",className:"mt-6",children:!pe||pe.length===0?r.jsx(He,{children:r.jsx(Je,{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:pe.map(Ie=>{var $e,Be,Ve,ot,At;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(kn,{className:"text-xs",children:["Purchased for ",Ie.points_spent," points • ",new Date(Ie.purchased_at).toLocaleDateString()]})]}),r.jsx(Je,{children:r.jsx(X,{className:"w-full",onClick:()=>{var Oe,at;(Oe=Ie.item)!=null&&Oe.file_url&&xue(Ie.item.file_url,(at=Ie.item)==null?void 0:at.name)},disabled:!((ot=Ie.item)!=null&&ot.file_url),children:((At=Ie.item)==null?void 0:At.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(Ms,{className:"h-4 w-4 mr-2"}),"Access"]})})})]},Ie.id)})})})]})]}),r.jsx(Ld,{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:he.isPending,children:he.isPending?"Purchasing...":"Confirm Purchase"})]})]})}),r.jsx(Or,{open:i,onOpenChange:Ie=>{!Ie&&k?et():u(Ie)},children:r.jsx(Lr,{children:k?r.jsxs(r.Fragment,{children:[r.jsxs(zr,{children:[r.jsxs(Fr,{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(Qn,{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(X,{variant:"outline",className:"w-full",onClick:we,children:[r.jsx(Oo,{className:"h-4 w-4 mr-2"}),"Copy Review to Clipboard"]})]}),r.jsxs(Hs,{className:"flex-col sm:flex-row gap-2",children:[r.jsx(X,{variant:"outline",onClick:et,children:"Maybe Later"}),r.jsxs(X,{onClick:ve,className:"bg-blue-600 hover:bg-blue-700",children:[r.jsx(Ms,{className:"h-4 w-4 mr-2"}),"Leave Google Review"]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Leave a Review"}),r.jsx(Qn,{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(Ss,{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(Xn,{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(Hs,{children:[r.jsx(X,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsx(X,{onClick:be,disabled:b,className:"bg-yellow-600 hover:bg-yellow-700",children:b?"Submitting...":"Submit & Earn 25 Points"})]})]})})}),r.jsx(Or,{open:!!P,onOpenChange:()=>F(null),children:r.jsxs(Lr,{className:"max-w-lg",children:[r.jsxs(zr,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[P==null?void 0:P.name,r.jsxs(Tt,{variant:"secondary",className:"font-bold",children:[r.jsx(Ss,{className:"h-3 w-3 mr-1"}),P==null?void 0:P.points_cost]})]}),(P==null?void 0:P.category)&&r.jsxs(Tt,{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(Hs,{children:P&&xe.has(P.id)?r.jsx(X,{className:"w-full",onClick:()=>{P.file_url&&xue(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(Ms,{className:"h-4 w-4 mr-2"}),"Access"]})}):P&&r.jsx(X,{className:"w-full",onClick:()=>{F(null),l(P)},disabled:P.max_quantity!==null&&P.current_quantity===0||me{const{user:e}=tn(),t=qr(),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}},Rer=[{value:"positive",label:"Love it",icon:pd,color:"bg-emerald-100 text-emerald-700 border-emerald-300"},{value:"suggestion",label:"Suggestion",icon:my,color:"bg-amber-100 text-amber-700 border-amber-300"},{value:"issue",label:"Issue",icon:Gu,color:"bg-red-100 text-red-700 border-red-300"}],Fer=({feature:e,children:t})=>{const{user:n}=tn(),[s,a]=A.useState(!1),[o,l]=A.useState(null),[i,u]=A.useState(""),[m,x]=A.useState(!1),y=async()=>{var v;if(!o||!i.trim()){Ae.error("Please select a type and add your feedback");return}x(!0);try{const{error:b}=await Y.functions.invoke("send-beta-feedback",{body:{feature:e,sentiment:o,message:i.trim(),userName:((v=n==null?void 0:n.user_metadata)==null?void 0:v.name)||(n==null?void 0:n.email)||"Unknown",userEmail:(n==null?void 0:n.email)||"unknown"}});if(b)throw b;Ae.success("Thank you for your feedback!"),a(!1),l(null),u("")}catch(b){console.error("Feedback error:",b),Ae.error("Failed to send feedback. Please try again.")}finally{x(!1)}};return r.jsxs(Or,{open:s,onOpenChange:a,children:[r.jsx(Co,{asChild:!0,children:t||r.jsxs(X,{variant:"outline",size:"sm",className:"gap-1.5 text-xs border-amber-200 bg-amber-50 text-amber-700 hover:bg-amber-100 hover:text-amber-800 dark:bg-amber-900/20 dark:border-amber-800 dark:text-amber-400 dark:hover:bg-amber-900/30 transition-colors",children:[r.jsx(fA,{className:"h-3.5 w-3.5"}),"Feedback"]})}),r.jsxs(Lr,{className:"sm:max-w-md",children:[r.jsxs(zr,{children:[r.jsx(Fr,{children:"Share Your Feedback"}),r.jsx(Qn,{children:"This feature is in beta — your thoughts help us make it better!"})]}),r.jsxs("div",{className:"space-y-4 pt-2",children:[r.jsx("div",{className:"flex gap-2",children:Rer.map(v=>{const b=v.icon;return r.jsxs("button",{type:"button",onClick:()=>l(v.value),className:Ut("flex-1 flex flex-col items-center gap-1.5 rounded-lg border-2 p-3 text-xs font-medium transition-all",o===v.value?v.color:"border-border bg-background text-muted-foreground hover:bg-accent"),children:[r.jsx(b,{className:"h-5 w-5"}),v.label]},v.value)})}),r.jsx(Xn,{placeholder:"Tell us what you think...",value:i,onChange:v=>u(v.target.value),rows:4,className:"resize-none"}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx(X,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(X,{onClick:y,disabled:m||!o||!i.trim(),children:m?"Sending...":"Send Feedback"})]})]})]})]})},zer=()=>{const e=Wn(),{presentations:t,isLoading:n,archivePresentation:s,saveAsTemplate:a}=JVe(),o=i=>i.status==="draft"?r.jsx(Tt,{variant:"outline",className:"text-xs",children:"Draft"}):i.view_count>1?r.jsx(Tt,{className:"text-xs bg-emerald-100 text-emerald-700 border-emerald-200",children:"Revisited"}):i.view_count===1?r.jsx(Tt,{className:"text-xs bg-blue-100 text-blue-700 border-blue-200",children:"Opened"}):r.jsx(Tt,{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(Dr,{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(ORe,{}),r.jsx(Fer,{feature:"Smart Presentations"})]}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Create personalized, video-first presentations for your clients"})]}),r.jsxs(X,{onClick:()=>e("/mission-control/presentations/new"),className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"Create Presentation"]})]}),n?r.jsx("div",{className:"space-y-3",children:[1,2,3].map(i=>r.jsx(Tr,{className:"h-20 w-full rounded-lg"},i))}):t.length===0?r.jsx(He,{children:r.jsxs(Je,{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(gy,{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(X,{onClick:()=>e("/mission-control/presentations/new"),className:"gap-2",children:[r.jsx(bn,{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(Je,{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 ",ln(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(X,{variant:"outline",size:"sm",onClick:()=>l(i.share_token),children:[r.jsx(Oo,{className:"h-3.5 w-3.5 mr-1"}),"Copy Link"]}),i.status==="published"&&r.jsx(X,{variant:"outline",size:"sm",onClick:()=>e(`/mission-control/presentations/${i.id}?edit=true`),children:"Edit"}),r.jsx(X,{variant:"outline",size:"sm",onClick:()=>e(`/mission-control/presentations/${i.id}`),children:i.status==="draft"?"Edit":"View"}),r.jsxs(dh,{children:[r.jsx(uh,{asChild:!0,children:r.jsx(X,{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(Ha,{onClick:()=>window.open(`https://presentations.relevelup.com/${i.share_token}`,"_blank"),children:[r.jsx(Ms,{className:"h-4 w-4 mr-2"}),"Preview Link"]}),r.jsxs(Ha,{onClick:()=>a.mutate(i),children:[r.jsx(_a,{className:"h-4 w-4 mr-2"}),"Save as Template"]}),r.jsxs(Ha,{onClick:()=>s.mutate(i.id),className:"text-destructive",children:[r.jsx(eA,{className:"h-4 w-4 mr-2"}),"Archive"]})]})]})]})]})},i.id))})]})})},MTe={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."}]},Ber=[{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 $er(e){const t=MTe[e];if(t)return t;const n=e.toLowerCase();for(const[s,a]of Object.entries(MTe))if(n.includes(s.toLowerCase())||s.toLowerCase().includes(n))return a;return Ber}function Uer({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}=wBe(),v=X0e(),[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=$er(e),W=()=>{l("script"),u(0),x(0),N(""),M(!1),T(!0),F(!1),U(null)},G=se=>{!se&&(o==="uploading"||o==="processing")||(a(se),se||W())},Q=se=>{U(se),N(V[se].text),M(!1)},ae=()=>{l("record"),T(b.trim().length>0)},oe=()=>{N(""),T(!1),l("record")},de=A.useCallback(async(se,pe)=>{l("uploading");try{const ne=e||"Presentation Video",{videoId:me,uploadUrl:he,libraryId:xe}=await jBe(ne),{apiKey:Te}=await kBe(me),be=new XMLHttpRequest;be.upload.onprogress=Ie=>{Ie.lengthComputable&&u(Ie.loaded/Ie.total*100)},await new Promise((Ie,$e)=>{be.onload=()=>be.status>=200&&be.status<300?Ie():$e(new Error("Upload failed")),be.onerror=()=>$e(new Error("Upload failed")),be.open("PUT",he),be.setRequestHeader("AccessKey",Te),be.send(se)}),l("processing");let we=0;const ve=Date.now(),et=9e4;let Me=null;for(;we<4;){if(await new Promise($e=>setTimeout($e,3e3)),Date.now()-ve>et){const $e=se.size/1048576,Be=`https://iframe.mediadelivery.net/embed/${xe}/${me}?responsive=true`;await v.mutateAsync({bunny_video_id:me,playback_url:Be,file_size_mb:$e,title:ne,contact_id:t||void 0,status:"processing",touch_type:"presentation"}),n(Be),Ae.success("Video saved — still encoding. It will be ready shortly."),l("done"),setTimeout(()=>a(!1),1500);return}const Ie=await NBe(me);if(we=Ie.status,x(Ie.encodeProgress||0),we===4)Me={playbackUrl:Ie.directPlayUrl,thumbnailUrl:Ie.thumbnailUrl,previewUrl:Ie.previewUrl||null,duration:Ie.length||pe,fileSizeMb:(Ie.storageSize||se.size)/(1024*1024)};else if(we===5||we===6)throw new Error("Video processing failed")}if(!Me)throw new Error("No video data");await v.mutateAsync({bunny_video_id:me,contact_id:t||void 0,playback_url:Me.playbackUrl,thumbnail_url:Me.thumbnailUrl,preview_url:Me.previewUrl,duration_seconds:Me.duration,file_size_mb:Me.fileSizeMb,title:ne,status:"ready",touch_type:"presentation"}),n(Me.playbackUrl),Ae.success("Video recorded, saved to library & attached!"),l("done"),setTimeout(()=>a(!1),1500)}catch(ne){console.error("Recording upload error:",ne),Ae.error("Failed to process video. Please try again."),l("record")}},[e,t,n,v]);return r.jsxs(Or,{open:s,onOpenChange:G,children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{variant:"outline",size:"sm",className:"gap-1.5 shrink-0",title:"Record a video",children:[r.jsx(Pa,{className:"h-3.5 w-3.5"}),"Record"]})}),r.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsxs(Fr,{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((se,pe)=>r.jsxs("button",{onClick:()=>Q(pe),className:Ut("text-left p-3 rounded-lg border transition-all hover:bg-accent/50",D===pe?"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:se.label})]}),r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 ml-5.5",children:se.text})]},pe))})]}),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(X,{variant:"ghost",size:"sm",onClick:()=>M(!0),className:"h-7 text-xs gap-1",children:[r.jsx(Ja,{className:"h-3 w-3"}),"Edit"]})]}),k?r.jsx(Xn,{value:b,onChange:se=>N(se.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(Xn,{value:b,onChange:se=>{N(se.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(X,{variant:"ghost",size:"sm",onClick:oe,className:"text-muted-foreground",children:"Skip — no teleprompter"}),r.jsx(X,{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(Gu,{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(X,{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(SVe,{maxDurationSeconds:60,onRecordingComplete:de,onRecordingStateChange:F,onError:se=>Ae.error(se),teleprompterContent:b.trim()?r.jsx(MVe,{text:b,isVisible:I,onToggleVisibility:()=>T(!I),isRecording:P,startCountdown:!1}):void 0}),r.jsx(X,{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(Wr,{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(Wr,{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(li,{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 TTe=[{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"}],ATe=()=>{const e=Wn(),{id:t}=Ec(),{user:n}=tn(),{templates:s,templatesLoading:a,createPresentation:o,updatePresentation:l,publishPresentation:i}=JVe(),{isGmailConnected:u,gmailEmail:m}=NP(),[x,y]=A.useState(!1),[v,b]=A.useState("client"),[N,k]=A.useState(!1),[M,I]=A.useState(""),[T,P]=A.useState([]),[F,D]=A.useState(!1),[U,V]=A.useState(null),[W,G]=A.useState(!1),[Q,ae]=A.useState(""),[oe,de]=A.useState(""),[se,pe]=A.useState(""),[ne,me]=A.useState("buyer"),[he,xe]=A.useState(""),[Te,be]=A.useState(null),[we,ve]=A.useState(""),[et,Me]=A.useState([]),[Ie,$e]=A.useState("schedule_call"),[Be,Ve]=A.useState("Schedule a Call"),[ot,At]=A.useState(""),[Oe,at]=A.useState(""),[le,qe]=A.useState(null),[Qe,rt]=A.useState(t||null),[je,ut]=A.useState(null),[Ce,Ee]=A.useState(!1),Ye=async(Ot,Gr)=>{if(!n)return;const An=5*1024*1024;if(Ot.size>An){Ae.error("Image must be under 5MB");return}if(!Ot.type.startsWith("image/")){Ae.error("Please upload an image file");return}qe(Gr);try{const zn=Ot.name.split(".").pop()||"jpg",ba=`${n.id}/${Date.now()}.${zn}`,{error:gi}=await Y.storage.from("listing-photos").upload(ba,Ot);if(gi)throw gi;const{data:{publicUrl:Mo}}=Y.storage.from("listing-photos").getPublicUrl(ba);zt(Gr,{image_url:Mo}),Ae.success("Image uploaded")}catch{Ae.error("Failed to upload image")}finally{qe(null)}};A.useEffect(()=>{t&&Le(t)},[t]);const Le=async Ot=>{const{data:Gr,error:An}=await Y.from("smart_presentations").select("*").eq("id",Ot).single();if(An||!Gr)return;const zn=Gr;if(k(!0),ve(zn.title),ae(zn.client_name||""),xe(zn.property_address||""),Me(zn.sections||[]),$e(zn.cta_type||"schedule_call"),Ve(zn.cta_label||"Schedule a Call"),At(zn.cta_url||""),at(zn.heading||""),ut(zn.share_token),Ee(zn.status==="published"),rt(zn.id),b("builder"),zn.contact_id){const{data:ba}=await Y.from("innercircle_contacts").select("id, first_name, last_name, email, phone").eq("id",zn.contact_id).maybeSingle();ba&&(V(ba),de(ba.email||""),pe(ba.phone||""))}};A.useEffect(()=>{if(!n||M.length<1){P([]);return}const Ot=setTimeout(async()=>{D(!0);const{data:Gr}=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.%${M}%,last_name.ilike.%${M}%,email.ilike.%${M}%`).limit(10);P(Gr||[]),D(!1)},300);return()=>clearTimeout(Ot)},[M,n]);const Ke=Ot=>{V(Ot),ae(`${Ot.first_name} ${Ot.last_name||""}`.trim()),de(Ot.email||""),pe(Ot.phone||""),G(!1)},tt=async()=>{if(!Q.trim()){Ae.error("Client name is required");return}const Ot=Q.trim().split(" "),Gr=Ot[0],An=Ot.slice(1).join(" ")||null,{data:zn,error:ba}=await Y.from("innercircle_contacts").insert({owner_user_id:n.id,first_name:Gr,last_name:An,email:oe||null,phone:se||null,lead_source:"Smart Presentation"}).select().single();if(ba){Ae.error("Failed to create client");return}V(zn),Ae.success("Client created & saved to Agent OS"),b("template")},ct=Ot=>{be(Ot);const Gr=(Ot.sections||[]).map(An=>({...An,is_visible:!0,video_url:"",text:""}));if(Me(Gr),ve(Ot.name+(Q?` for ${Q}`:"")),Ot.cta_config){const An=Ot.cta_config;$e(An.type||"schedule_call"),Ve(An.label||"Schedule a Call")}b("builder")},it=()=>{Me([{title:"Welcome",description:"A personal welcome",type:"video",icon:"👋",is_visible:!0}]),ve(Q?`Presentation for ${Q}`:"New Presentation"),b("builder")},zt=(Ot,Gr)=>{Me(An=>An.map((zn,ba)=>ba===Ot?{...zn,...Gr}:zn))},ir=Ot=>{zt(Ot,{is_visible:!et[Ot].is_visible})},Mr=()=>{Me(Ot=>[...Ot,{title:"New Section",description:"",type:"video",icon:"📝",is_visible:!0}])},Zr=Ot=>{Me(Gr=>Gr.filter((An,zn)=>zn!==Ot))},Br=async()=>{if(!we.trim()){Ae.error("Title is required");return}try{if(Qe){const Ot=await l.mutateAsync({id:Qe,title:we,sections:et,client_name:Q,property_address:he||null,cta_type:Ie,cta_label:Be,cta_url:ot||null,heading:Oe||null});Ae.success("Saved")}else{const Ot=await o.mutateAsync({title:we,contact_id:(U==null?void 0:U.id)||void 0,client_name:Q,property_address:he||void 0,template_id:(Te==null?void 0:Te.id)||void 0,sections:et,cta_type:Ie,cta_label:Be,cta_url:ot||void 0,heading:Oe||void 0});rt(Ot.id),ut(Ot.share_token),Ae.success("Presentation created!")}}catch{Ae.error("Failed to save")}},rn=async()=>{await Br();const Ot=Qe;if(Ot){const Gr=await i.mutateAsync(Ot);ut(Gr.share_token),Ee(!0),b("share")}},Zn=je?`https://presentations.relevelup.com/${je}`:"";return r.jsx(Dr,{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(X,{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:N?"Edit Presentation":"Create Smart Presentation"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[v==="client"&&"Who is this presentation for?",v==="template"&&"Choose a starting template",v==="builder"&&"Customize your presentation",v==="share"&&"Share with your client"]})]})]}),!N&&r.jsx("div",{className:"flex items-center gap-2",children:["client","template","builder","share"].map((Ot,Gr)=>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",v===Ot?"bg-primary text-primary-foreground":Gr<["client","template","builder","share"].indexOf(v)?"bg-emerald-100 text-emerald-700":"bg-muted text-muted-foreground"),children:Gr<["client","template","builder","share"].indexOf(v)?r.jsx(fi,{className:"h-4 w-4"}):Gr+1}),r.jsx("span",{className:"text-sm font-medium capitalize hidden sm:inline",children:Ot}),Gr<3&&r.jsx("div",{className:"w-8 h-px bg-border"})]},Ot))}),v==="client"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("button",{onClick:()=>{V(null),ae(""),de(""),pe(""),G(!1),b("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(Je,{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:M,onChange:Ot=>I(Ot.target.value),className:"pl-10"})]}),r.jsxs("div",{className:"space-y-2 max-h-56 overflow-y-auto",children:[F&&r.jsx(Tr,{className:"h-12 w-full"}),T.map(Ot=>r.jsxs("button",{onClick:()=>Ke(Ot),className:Ut("w-full text-left p-3 rounded-lg border transition-colors",(U==null?void 0:U.id)===Ot.id?"border-primary bg-primary/5":"border-border hover:border-primary/50"),children:[r.jsxs("p",{className:"font-medium text-sm",children:[Ot.first_name," ",Ot.last_name]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:Ot.email||Ot.phone||"No contact info"})]},Ot.id)),!M&&r.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:"Start typing to search your contacts"}),M&&T.length===0&&!F&&r.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:"No clients found"})]}),U&&r.jsxs(X,{onClick:()=>b("template"),className:"w-full gap-2",children:["Continue with ",U.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(nh,{className:"h-4 w-4 text-muted-foreground"}),"Add New Client"]})}),r.jsxs(Je,{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:Q,onChange:Ot=>{ae(Ot.target.value),G(!0),V(null)},placeholder:"Sarah & Mike Johnson"})]}),r.jsxs("div",{children:[r.jsx(ze,{className:"text-xs",children:"Email"}),r.jsx(lt,{value:oe,onChange:Ot=>de(Ot.target.value),placeholder:"Optional",type:"email"})]}),r.jsxs("div",{children:[r.jsx(ze,{className:"text-xs",children:"Phone"}),r.jsx(lt,{value:se,onChange:Ot=>pe(Ot.target.value),placeholder:"Optional"})]}),r.jsxs("div",{children:[r.jsx(ze,{className:"text-xs",children:"Client Type"}),r.jsxs(hn,{value:ne,onValueChange:me,children:[r.jsx(cn,{children:r.jsx(fn,{})}),r.jsxs(dn,{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:he,onChange:Ot=>xe(Ot.target.value),placeholder:"Optional"})]})]}),W&&Q&&r.jsxs(X,{onClick:tt,className:"w-full gap-2",children:["Create Client & Continue",r.jsx(No,{className:"h-4 w-4"})]})]})]})]})]}),v==="template"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs(ki,{defaultValue:"system",children:[r.jsxs(wi,{children:[r.jsx(an,{value:"mine",children:"My Core Templates"}),r.jsx(an,{value:"system",children:"LevelUp Smart Templates"}),r.jsx(an,{value:"blank",children:"+ Start Blank"})]}),r.jsx(Cn,{value:"mine",className:"mt-4",children:a?r.jsx("div",{className:"grid grid-cols-2 gap-4",children:[1,2].map(Ot=>r.jsx(Tr,{className:"h-32"},Ot))}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:s.filter(Ot=>!Ot.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(Ot=>!Ot.is_system).map(Ot=>r.jsx(ETe,{template:Ot,onSelect:ct},Ot.id))})}),r.jsx(Cn,{value:"system",className:"mt-4",children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:s.filter(Ot=>Ot.is_system).map(Ot=>r.jsx(ETe,{template:Ot,onSelect:ct},Ot.id))})}),r.jsx(Cn,{value:"blank",className:"mt-4",children:r.jsx(He,{children:r.jsxs(Je,{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(X,{onClick:it,children:"Start from Scratch"})]})})})]}),r.jsxs(X,{variant:"outline",onClick:()=>b("client"),className:"gap-2",children:[r.jsx(Wi,{className:"h-4 w-4"}),"Back"]})]}),v==="builder"&&r.jsxs("div",{className:"space-y-6",children:[r.jsx(He,{children:r.jsxs(Je,{className:"pt-6 space-y-4",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"Presentation Title"}),r.jsx(lt,{value:we,onChange:Ot=>ve(Ot.target.value)})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Page Heading"}),r.jsx(lt,{value:Oe,onChange:Ot=>at(Ot.target.value),placeholder:Q?`Welcome, ${Q}!`:"e.g. Welcome! or Your Custom Listing Plan"}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:['The main heading visitors see. Leave blank for "Welcome, ',"",'!"']})]}),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:Q,onChange:Ot=>ae(Ot.target.value)})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Property Address"}),r.jsx(lt,{value:he,onChange:Ot=>xe(Ot.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(X,{variant:"outline",size:"sm",onClick:Mr,children:"+ Add Section"})]}),r.jsx("div",{className:"space-y-3",children:et.map((Ot,Gr)=>r.jsx(He,{className:Ut(!Ot.is_visible&&"opacity-50"),children:r.jsx(Je,{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:Ot.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:Ot.title,onChange:An=>zt(Gr,{title:An.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(X,{variant:"ghost",size:"icon",onClick:()=>ir(Gr),children:Ot.is_visible?r.jsx(_o,{className:"h-4 w-4"}):r.jsx(Fg,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>Zr(Gr),className:"text-destructive hover:text-destructive",children:r.jsx(Un,{className:"h-4 w-4"})})]})]}),r.jsx(lt,{value:Ot.description||"",onChange:An=>zt(Gr,{description:An.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:Ot.video_url||"",onChange:An=>zt(Gr,{video_url:An.target.value}),placeholder:"Paste a YouTube or video URL...",className:"text-sm"})]}),r.jsx(Uer,{sectionTitle:Ot.title,contactId:U==null?void 0:U.id,onVideoReady:An=>zt(Gr,{video_url:An})}),r.jsx(qer,{userId:n==null?void 0:n.id,onSelect:An=>zt(Gr,{video_url:An})})]}),r.jsxs("div",{children:[r.jsx(ze,{className:"text-xs",children:"Image (optional — shown if no video is set)"}),Ot.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:Ot.image_url,alt:"",className:"w-full max-h-40 object-cover"}),r.jsx(X,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>zt(Gr,{image_url:""}),children:r.jsx(us,{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:[le===Gr?r.jsx(Wr,{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:le===Gr?"Uploading...":"Click to upload an image"}),r.jsx("input",{type:"file",accept:"image/*",className:"hidden",disabled:le===Gr,onChange:An=>{var ba;const zn=(ba=An.target.files)==null?void 0:ba[0];zn&&Ye(zn,Gr),An.target.value=""}})]})]}),r.jsxs("div",{children:[r.jsx(ze,{className:"text-xs",children:"Text (optional)"}),r.jsx(Hp,{content:Ot.text||"",onChange:An=>zt(Gr,{text:An}),placeholder:"Add supporting text...",minHeight:"80px",compact:!0})]})]})]})})},Gr))})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{className:"text-base",children:"Call to Action"})}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"CTA Type"}),r.jsxs(hn,{value:Ie,onValueChange:Ot=>{$e(Ot);const Gr=TTe.find(An=>An.value===Ot);Gr&&Ve(Gr.label)},children:[r.jsx(cn,{children:r.jsx(fn,{})}),r.jsx(dn,{children:TTe.map(Ot=>r.jsx($t,{value:Ot.value,children:Ot.label},Ot.value))})]})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Button Label"}),r.jsx(lt,{value:Be,onChange:Ot=>Ve(Ot.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:ot,onChange:Ot=>At(Ot.target.value),placeholder:"https://calendly.com/..."}),!ot&&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:[!N&&r.jsxs(X,{variant:"outline",onClick:()=>b("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(X,{variant:"outline",onClick:Br,disabled:o.isPending||l.isPending,children:"Save Draft"}),r.jsxs(X,{onClick:rn,disabled:i.isPending,className:"gap-2",children:[r.jsx(Ji,{className:"h-4 w-4"}),Ce?"Update & Reshare":"Publish & Share"]})]})]})]}),v==="share"&&je&&r.jsxs("div",{className:"space-y-6",children:[r.jsx(He,{children:r.jsxs(Je,{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(fi,{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 ",Q||"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:Zn,readOnly:!0,className:"text-center font-mono text-sm"}),r.jsx(X,{onClick:()=>{navigator.clipboard.writeText(Zn),Ae.success("Link copied!")},children:r.jsx(Oo,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex gap-3 mt-6",children:[r.jsxs(X,{variant:"outline",className:"gap-2",onClick:()=>{const Ot=`Hi ${Q||""}! I put together something for you — check it out: ${Zn}`;navigator.clipboard.writeText(Ot),Ae.success("Message copied!")},children:[r.jsx(zo,{className:"h-4 w-4"}),"Copy Text Message"]}),r.jsxs(X,{variant:"outline",className:"gap-2",onClick:()=>{u?y(!0):window.open(`mailto:${oe||""}?subject=${encodeURIComponent(we)}&body=${encodeURIComponent(`Hi ${(U==null?void 0:U.first_name)||(Q==null?void 0:Q.split(" ")[0])||""}, I put together a personalized presentation for you: ${Zn} Looking forward to connecting!`)}`)},children:[r.jsx(ks,{className:"h-4 w-4"}),"Send Email"]})]}),u&&r.jsx(Uae,{open:x,onOpenChange:y,contact:U?{id:U.id,first_name:U.first_name,last_name:U.last_name,email:oe||U.email||""}:oe?{id:"",first_name:(Q==null?void 0:Q.split(" ")[0])||"",last_name:(Q==null?void 0:Q.split(" ").slice(1).join(" "))||"",email:oe}:void 0,defaultSubject:we,defaultBody:`Hi ${(U==null?void 0:U.first_name)||(Q==null?void 0:Q.split(" ")[0])||""}, I put together a personalized presentation for you: ${Zn} Looking forward to connecting!`,gmailEmail:m})]})}),r.jsxs("div",{className:"flex justify-between",children:[r.jsxs(X,{variant:"outline",onClick:()=>b("builder"),children:[r.jsx(Wi,{className:"h-4 w-4 mr-2"}),"Edit Presentation"]}),r.jsx(X,{onClick:()=>e("/mission-control/presentations"),children:"Done"})]})]})]})})},ETe=({template:e,onSelect:t})=>r.jsx(He,{className:"hover:shadow-sm transition-shadow",children:r.jsxs(Je,{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(Tt,{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(X,{className:"w-full mt-4",size:"sm",onClick:()=>t(e),children:"Use Template"})]})}),qer=({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(Or,{open:n,onOpenChange:s,children:[r.jsx(Co,{asChild:!0,children:r.jsxs(X,{variant:"outline",size:"sm",className:"gap-1.5 shrink-0",children:[r.jsx(Ad,{className:"h-3.5 w-3.5"}),"Library"]})}),r.jsxs(Lr,{className:"max-w-lg max-h-[70vh] flex flex-col",children:[r.jsxs(zr,{children:[r.jsx(Fr,{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(Tr,{className:"h-16 w-full"}),r.jsx(Tr,{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(Pa,{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))})]})]})},Ver=()=>{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(Tr,{className:"h-12 w-3/4 mx-auto"}),r.jsx(Tr,{className:"h-64 w-full"}),r.jsx(Tr,{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")){if(M.match(/\/embed\/(\d+)\/([a-f0-9-]+)/)){const D=M.includes("?")?"&":"?";return`${M}${D}responsive=true`}return""}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.jsx("h1",{className:"text-3xl md:text-4xl font-bold text-gray-900 mb-2",children:t.heading||(t.client_name?`Welcome, ${t.client_name}!`:t.title)}),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&&b(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(X,{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(Ms,{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(IDe,{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"})]})},Her=()=>{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"})]})})},Wer=new Ntt,Ger=()=>{const e=window.location.hostname;return e==="listings.relevelup.com"||e.startsWith("listings.")},Ker=()=>{const e=window.location.hostname;return e==="cards.relevelup.com"||e.startsWith("cards.")},Zer=()=>{const e=window.location.hostname;return e==="presentations.relevelup.com"||e.startsWith("presentations.")},Yer=()=>r.jsx(Att,{client:Wer,children:r.jsx(KPe,{children:r.jsxs(eP,{children:[r.jsx(qQe,{}),r.jsx(bJe,{}),r.jsx(qrt,{children:r.jsx(Kat,{children:r.jsx(Zat,{children:r.jsxs(Xat,{children:[r.jsx(Yat,{}),r.jsx(Tlt,{}),r.jsx(Hlt,{}),Ker()?r.jsx(ddt,{}):Ger()?r.jsx(Ict,{}):Zer()?r.jsx(mdt,{}):r.jsxs(Ort,{children:[r.jsx(nn,{path:"/",element:r.jsx(jdt,{})}),r.jsx(nn,{path:"/privacy-policy",element:r.jsx(kdt,{})}),r.jsx(nn,{path:"/terms-of-service",element:r.jsx(Ndt,{})}),r.jsx(nn,{path:"/data-deletion",element:r.jsx(Sdt,{})}),r.jsx(nn,{path:"/public/listings",element:r.jsx(NDe,{})}),r.jsx(nn,{path:"/public/listing/:slugOrId",element:r.jsx(hgt,{})}),r.jsx(nn,{path:"/card/:slug",element:r.jsx(mgt,{})}),r.jsx(nn,{path:"/auth",element:r.jsx(tut,{})}),r.jsx(nn,{path:"/subscription-success",element:r.jsx(rut,{})}),r.jsx(nn,{path:"/subscription",element:r.jsx(Sn,{children:r.jsx(_pt,{})})}),r.jsx(nn,{path:"/share/video",element:r.jsx(lgt,{}),children:r.jsx(nn,{path:":shareToken",element:r.jsx(ogt,{})})}),r.jsx(nn,{path:"/p/:shareToken",element:r.jsx(Ver,{})}),r.jsx(nn,{path:"/og/video/:token",element:r.jsx(cgt,{})}),r.jsx(nn,{path:"/setup-brokerage",element:r.jsx(Sn,{children:r.jsx(bpt,{})})}),r.jsx(nn,{path:"/claim-account",element:r.jsx(qNe,{})}),r.jsx(nn,{path:"/claim",element:r.jsx(qNe,{})}),r.jsx(nn,{path:"/join",element:r.jsx(wpt,{})}),r.jsx(nn,{path:"/trial",element:r.jsx(Ppt,{})}),r.jsx(nn,{path:"/trial/success",element:r.jsx(Lpt,{})}),r.jsx(nn,{path:"/dashboard",element:r.jsx(Sn,{children:r.jsx(xxt,{})})}),r.jsx(nn,{path:"/profile",element:r.jsx(Sn,{children:r.jsx(ijt,{})})}),r.jsx(nn,{path:"/apps",element:r.jsx(Sn,{children:r.jsx(vjt,{})})}),r.jsx(nn,{path:"/admin",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(sSt,{})})}),r.jsx(nn,{path:"/admin/apps",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(oSt,{})})}),r.jsx(nn,{path:"/admin/members",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(hSt,{})})}),r.jsx(nn,{path:"/admin/invite-codes",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(mSt,{})})}),r.jsx(nn,{path:"/admin/events",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(ySt,{})})}),r.jsx(nn,{path:"/events",element:r.jsx(Sn,{children:r.jsx(gjt,{})})}),r.jsx(nn,{path:"/events/:eventId",element:r.jsx(Sn,{children:r.jsx(yjt,{})})}),r.jsx(nn,{path:"/templates",element:r.jsx(Sn,{children:r.jsx(_jt,{})})}),r.jsx(nn,{path:"/templates/:templateId",element:r.jsx(Sn,{children:r.jsx(kjt,{})})}),r.jsx(nn,{path:"/admin/templates",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(vSt,{})})}),r.jsx(nn,{path:"/academy",element:r.jsx(Sn,{children:r.jsx(Njt,{})})}),r.jsx(nn,{path:"/academy/:videoId",element:r.jsx(Sn,{children:r.jsx(Cjt,{})})}),r.jsx(nn,{path:"/admin/academy",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(bSt,{})})}),r.jsx(nn,{path:"/toolbox",element:r.jsx(Sn,{children:r.jsx(Mjt,{})})}),r.jsx(nn,{path:"/toolbox/:kitId",element:r.jsx(Sn,{children:r.jsx(Tjt,{})})}),r.jsx(nn,{path:"/admin/toolbox",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(wSt,{})})}),r.jsx(nn,{path:"/social-swag",element:r.jsx(Sn,{children:r.jsx(Ajt,{})})}),r.jsx(nn,{path:"/social-swag-2",element:r.jsx(Sn,{children:r.jsx(MNt,{})})}),r.jsx(nn,{path:"/social-swag/:swagId",element:r.jsx(Sn,{children:r.jsx(TNt,{})})}),r.jsx(nn,{path:"/social-connections",element:r.jsx(Sn,{children:r.jsx(Ner,{})})}),r.jsx(nn,{path:"/social-connections/callback",element:r.jsx(Sn,{children:r.jsx(Ser,{})})}),r.jsx(nn,{path:"/social-connections/linkedin-callback",element:r.jsx(Sn,{children:r.jsx(Mer,{})})}),r.jsx(nn,{path:"/social-connections/google-callback",element:r.jsx(Sn,{children:r.jsx(Cer,{})})}),r.jsx(nn,{path:"/admin/social-swag",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(jSt,{})})}),r.jsx(nn,{path:"/admin/social-swag-2",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(dCt,{})})}),r.jsx(nn,{path:"/community",element:r.jsx(Sn,{children:r.jsx(KNt,{})})}),r.jsx(nn,{path:"/support",element:r.jsx(Sn,{children:r.jsx(ZNt,{})})}),r.jsx(nn,{path:"/admin/community",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(uCt,{})})}),r.jsx(nn,{path:"/admin/support-tickets",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(vCt,{})})}),r.jsx(nn,{path:"/admin/email-templates",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(wCt,{})})}),r.jsx(nn,{path:"/admin/agent-email-templates",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(jCt,{})})}),r.jsx(nn,{path:"/admin/analytics",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(gCt,{})})}),r.jsx(nn,{path:"/admin/brokerage-resources",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(xCt,{})})}),r.jsx(nn,{path:"/admin/dashboard-management",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(yCt,{})})}),r.jsx(nn,{path:"/brokerage/dashboard",element:r.jsx(Sn,{requireBrokerageManager:!0,children:r.jsx(LCt,{})})}),r.jsx(nn,{path:"/my-brokerage",element:r.jsx(Sn,{children:r.jsx(BCt,{})})}),r.jsx(nn,{path:"/brokerage-resources",element:r.jsx(Sn,{requireBrokerageManager:!0,children:r.jsx(tSt,{})})}),r.jsx(nn,{path:"/brokerage-resources/:resourceId",element:r.jsx(Sn,{requireBrokerageManager:!0,children:r.jsx(rSt,{})})}),r.jsx(nn,{path:"/newsletters",element:r.jsx(Sn,{children:r.jsx($Ct,{})})}),r.jsx(nn,{path:"/newsletters/:id",element:r.jsx(Sn,{children:r.jsx(qCt,{})})}),r.jsx(nn,{path:"/wishlist",element:r.jsx(Sn,{children:r.jsx(WCt,{})})}),r.jsx(nn,{path:"/wishlist/:itemId",element:r.jsx(Sn,{children:r.jsx(GCt,{})})}),r.jsx(nn,{path:"/admin/wishlist",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(KCt,{})})}),r.jsx(nn,{path:"/admin/levelup-brief",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(ZCt,{})})}),r.jsx(nn,{path:"/admin/newsletters",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(HCt,{})})}),r.jsx(nn,{path:"/admin/additional-services",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(YCt,{})})}),r.jsx(nn,{path:"/admin/discounts",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(XCt,{})})}),r.jsx(nn,{path:"/admin/subscriptions",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(QCt,{})})}),r.jsx(nn,{path:"/admin/referrals",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(JCt,{})})}),r.jsx(nn,{path:"/admin/onboarding-checklist",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(t3t,{})})}),r.jsx(nn,{path:"/admin/marketplace",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(ner,{})})}),r.jsx(nn,{path:"/admin/agent-points",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(CJt,{})})}),r.jsx(nn,{path:"/admin/reward-store",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(yer,{})})}),r.jsx(nn,{path:"/admin/integrations",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(_er,{})})}),r.jsx(nn,{path:"/admin/integrations/callback",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(ker,{})})}),r.jsx(nn,{path:"/reward-store",element:r.jsx(Sn,{children:r.jsx(Der,{})})}),r.jsx(nn,{path:"/additional-services",element:r.jsx(Sn,{children:r.jsx(h3t,{})})}),r.jsx(nn,{path:"/additional-services/:serviceId",element:r.jsx(Sn,{children:r.jsx(m3t,{})})}),r.jsx(nn,{path:"/ai-toolkit",element:r.jsx(Sn,{children:r.jsx(f3t,{})})}),r.jsx(nn,{path:"/mission-control",element:r.jsx(Sn,{children:r.jsx(M3t,{})})}),r.jsx(nn,{path:"/mission-control/contacts",element:r.jsx(Sn,{children:r.jsx(G3t,{})})}),r.jsx(nn,{path:"/mission-control/contacts/:contactId",element:r.jsx(Sn,{children:r.jsx(a5t,{})})}),r.jsx(nn,{path:"/mission-control/plans",element:r.jsx(Sn,{children:r.jsx(i5t,{})})}),r.jsx(nn,{path:"/mission-control/popbys",element:r.jsx(Sn,{children:r.jsx(c5t,{})})}),r.jsx(nn,{path:"/mission-control/popbys/map",element:r.jsx(Sn,{children:r.jsx(d5t,{})})}),r.jsx(nn,{path:"/admin/notification-settings",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(wer,{})})}),r.jsx(nn,{path:"/admin/agent-os",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(n3t,{})})}),r.jsx(nn,{path:"/mission-control/listings",element:r.jsx(Sn,{children:r.jsx(ZXt,{})})}),r.jsx(nn,{path:"/mission-control/listings/new",element:r.jsx(Sn,{children:r.jsx(bTe,{})})}),r.jsx(nn,{path:"/mission-control/listings/:listingId",element:r.jsx(Sn,{children:r.jsx(dQt,{})})}),r.jsx(nn,{path:"/mission-control/listings/:listingId/edit",element:r.jsx(Sn,{children:r.jsx(bTe,{})})}),r.jsx(nn,{path:"/admin/listing-exchange",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(bJt,{})})}),r.jsx(nn,{path:"/mission-control/pipeline",element:r.jsx(Sn,{children:r.jsx(zQt,{})})}),r.jsx(nn,{path:"/mission-control/my-card",element:r.jsx(Sn,{children:r.jsx(aJt,{})})}),r.jsx(nn,{path:"/mission-control/integrations",element:r.jsx(Sn,{children:r.jsx(mJt,{})})}),r.jsx(nn,{path:"/mission-control/integrations/gmail/callback",element:r.jsx(Sn,{children:r.jsx(fJt,{})})}),r.jsx(nn,{path:"/mission-control/integrations/canva/callback",element:r.jsx(pJt,{})}),r.jsx(nn,{path:"/mission-control/integrations/meta/callback",element:r.jsx(Sn,{children:r.jsx(gJt,{})})}),r.jsx(nn,{path:"/mission-control/scorecard",element:r.jsx(Sn,{children:r.jsx(zXt,{})})}),r.jsx(nn,{path:"/admin/scorecard",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(yJt,{})})}),r.jsx(nn,{path:"/admin/scorecard/:userId",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(_Jt,{})})}),r.jsx(nn,{path:"/admin/membership-reviews",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(wJt,{})})}),r.jsx(nn,{path:"/admin/weekly-digest",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(NJt,{})})}),r.jsx(nn,{path:"/mission-control/video/record",element:r.jsx(Sn,{children:r.jsx(yQt,{})})}),r.jsx(nn,{path:"/mission-control/video-library",element:r.jsx(Sn,{children:r.jsx(jQt,{})})}),r.jsx(nn,{path:"/marketplace",element:r.jsx(Sn,{children:r.jsx(Ter,{})})}),r.jsx(nn,{path:"/marketplace/:productId",element:r.jsx(Sn,{children:r.jsx(Aer,{})})}),r.jsx(nn,{path:"/marketplace/cart",element:r.jsx(Sn,{children:r.jsx(Eer,{})})}),r.jsx(nn,{path:"/marketplace/orders",element:r.jsx(Sn,{children:r.jsx(Ier,{})})}),r.jsx(nn,{path:"/marketplace/orders/:orderId",element:r.jsx(Sn,{children:r.jsx(Ler,{})})}),r.jsx(nn,{path:"/marketplace/success",element:r.jsx(Sn,{children:r.jsx(Oer,{})})}),r.jsx(nn,{path:"/admin/agent-cards",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(MJt,{})})}),r.jsx(nn,{path:"/admin/presentation-analytics",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(jer,{})})}),r.jsx(nn,{path:"/mission-control/presentations",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(zer,{})})}),r.jsx(nn,{path:"/mission-control/presentations/new",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(ATe,{})})}),r.jsx(nn,{path:"/mission-control/presentations/:id",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(ATe,{})})}),r.jsx(nn,{path:"*",element:r.jsx(Her,{})})]}),")"]})})})})]})})});tIe(document.getElementById("root")).render(r.jsx(Yer,{}));