var $Ke=Object.defineProperty;var lwe=e=>{throw TypeError(e)};var UKe=(e,t,s)=>t in e?$Ke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var rn=(e,t,s)=>UKe(e,typeof t!="symbol"?t+"":t,s),$le=(e,t,s)=>t.has(e)||lwe("Cannot "+s);var tr=(e,t,s)=>($le(e,t,"read from private field"),s?s.call(e):t.get(e)),_a=(e,t,s)=>t.has(e)?lwe("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),_n=(e,t,s,n)=>($le(e,t,"write to private field"),n?n.call(e,s):t.set(e,s),s),yi=(e,t,s)=>($le(e,t,"access private method"),s);var TL=(e,t,s,n)=>({set _(a){_n(e,t,a,s)},get _(){return tr(e,t,n)}});function qKe(e,t){for(var s=0;sn[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"]'))n(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"&&n(l)}).observe(document,{childList:!0,subtree:!0});function s(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 n(a){if(a.ep)return;a.ep=!0;const o=s(a);fetch(a.href,o)}})();var Jx=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function no(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function VTe(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var s=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};s.prototype=t.prototype}else s={};return Object.defineProperty(s,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(s,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}),s}var HTe={exports:{}},tne={},WTe={exports:{}},Ui={};/** * @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 HI=Symbol.for("react.element"),VKe=Symbol.for("react.portal"),HKe=Symbol.for("react.fragment"),WKe=Symbol.for("react.strict_mode"),GKe=Symbol.for("react.profiler"),KKe=Symbol.for("react.provider"),ZKe=Symbol.for("react.context"),YKe=Symbol.for("react.forward_ref"),XKe=Symbol.for("react.suspense"),QKe=Symbol.for("react.memo"),JKe=Symbol.for("react.lazy"),cwe=Symbol.iterator;function eZe(e){return e===null||typeof e!="object"?null:(e=cwe&&e[cwe]||e["@@iterator"],typeof e=="function"?e:null)}var GTe={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},KTe=Object.assign,ZTe={};function v3(e,t,s){this.props=e,this.context=t,this.refs=ZTe,this.updater=s||GTe}v3.prototype.isReactComponent={};v3.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")};v3.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function YTe(){}YTe.prototype=v3.prototype;function oge(e,t,s){this.props=e,this.context=t,this.refs=ZTe,this.updater=s||GTe}var lge=oge.prototype=new YTe;lge.constructor=oge;KTe(lge,v3.prototype);lge.isPureReactComponent=!0;var dwe=Array.isArray,XTe=Object.prototype.hasOwnProperty,cge={current:null},QTe={key:!0,ref:!0,__self:!0,__source:!0};function JTe(e,t,s){var n,a={},o=null,l=null;if(t!=null)for(n in t.ref!==void 0&&(l=t.ref),t.key!==void 0&&(o=""+t.key),t)XTe.call(t,n)&&!QTe.hasOwnProperty(n)&&(a[n]=t[n]);var i=arguments.length-2;if(i===1)a.children=s;else if(1>>1,be=de[ve];if(0>>1;vea(Ae,Me))Lea(Ue,Ae)?(de[ve]=Ue,de[Le]=Me,ve=Le):(de[ve]=Ae,de[tt]=Me,ve=tt);else if(Lea(Ue,Me))de[ve]=Ue,de[Le]=Me,ve=Le;else break e}}return xe}function a(de,xe){var Me=de.sortIndex-xe.sortIndex;return Me!==0?Me:de.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,E=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function P(de){for(var xe=s(m);xe!==null;){if(xe.callback===null)n(m);else if(xe.startTime<=de)n(m),xe.sortIndex=xe.expirationTime,t(u,xe);else break;xe=s(m)}}function R(de){if(k=!1,P(de),!N)if(s(u)!==null)N=!0,oe(D);else{var xe=s(m);xe!==null&&ce(R,xe.startTime-de)}}function D(de,xe){N=!1,k&&(k=!1,E(H),H=-1),b=!0;var Me=v;try{for(P(xe),y=s(u);y!==null&&(!(y.expirationTime>xe)||de&&!ne());){var ve=y.callback;if(typeof ve=="function"){y.callback=null,v=y.priorityLevel;var be=ve(y.expirationTime<=xe);xe=e.unstable_now(),typeof be=="function"?y.callback=be:y===s(u)&&n(u),P(xe)}else n(u);y=s(u)}if(y!==null)var we=!0;else{var tt=s(m);tt!==null&&ce(R,tt.startTime-xe),we=!1}return we}finally{y=null,v=Me,b=!1}}var U=!1,q=null,H=-1,G=5,Q=-1;function ne(){return!(e.unstable_now()-Qde||125ve?(de.sortIndex=Me,t(m,de),s(u)===null&&de===s(m)&&(k?(E(H),H=-1):k=!0,ce(R,Me-ve))):(de.sortIndex=be,t(u,de),N||b||(N=!0,oe(D))),de},e.unstable_shouldYield=ne,e.unstable_wrapCallback=function(de){var xe=v;return function(){var Me=v;v=xe;try{return de.apply(this,arguments)}finally{v=Me}}}})(nAe);sAe.exports=nAe;var uZe=sAe.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 hZe=A,Nm=uZe;function Is(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,s=1;s"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),wue=Object.prototype.hasOwnProperty,mZe=/^[: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]*$/,hwe={},mwe={};function pZe(e){return wue.call(mwe,e)?!0:wue.call(hwe,e)?!1:mZe.test(e)?mwe[e]=!0:(hwe[e]=!0,!1)}function fZe(e,t,s,n){if(s!==null&&s.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function gZe(e,t,s,n){if(t===null||typeof t>"u"||fZe(e,t,s,n))return!0;if(n)return!1;if(s!==null)switch(s.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 ch(e,t,s,n,a,o,l){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=a,this.mustUseProperty=s,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 ch(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 ch(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){iu[e]=new ch(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){iu[e]=new ch(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 ch(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){iu[e]=new ch(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){iu[e]=new ch(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){iu[e]=new ch(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){iu[e]=new ch(e,5,!1,e.toLowerCase(),null,!1,!1)});var hge=/[\-:]([a-z])/g;function mge(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(hge,mge);iu[t]=new ch(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(hge,mge);iu[t]=new ch(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(hge,mge);iu[t]=new ch(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){iu[e]=new ch(e,1,!1,e.toLowerCase(),null,!1,!1)});iu.xlinkHref=new ch("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){iu[e]=new ch(e,1,!1,e.toLowerCase(),null,!0,!0)});function pge(e,t,s,n){var a=iu.hasOwnProperty(t)?iu[t]:null;(a!==null?a.type!==0:n||!(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{Vle=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?IT(e):""}function xZe(e){switch(e.tag){case 5:return IT(e.type);case 16:return IT("Lazy");case 13:return IT("Suspense");case 19:return IT("SuspenseList");case 0:case 2:case 15:return e=Hle(e.type,!1),e;case 11:return e=Hle(e.type.render,!1),e;case 1:return e=Hle(e.type,!0),e;default:return""}}function Sue(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 X4:return"Fragment";case Y4:return"Portal";case jue:return"Profiler";case fge:return"StrictMode";case kue:return"Suspense";case Nue:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case oAe:return(e.displayName||"Context")+".Consumer";case iAe:return(e._context.displayName||"Context")+".Provider";case gge:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case xge:return t=e.displayName||null,t!==null?t:Sue(e.type)||"Memo";case W0:t=e._payload,e=e._init;try{return Sue(e(t))}catch{}}return null}function yZe(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 Sue(t);case 8:return t===fge?"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 uv(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function cAe(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function vZe(e){var t=cAe(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var a=s.get,o=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(l){n=""+l,o.call(this,l)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return n},setValue:function(l){n=""+l},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function IL(e){e._valueTracker||(e._valueTracker=vZe(e))}function dAe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),n="";return e&&(n=cAe(e)?e.checked?"true":"false":e.value),e=n,e!==s?(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 Cue(e,t){var s=t.checked;return Wl({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function fwe(e,t){var s=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;s=uv(t.value!=null?t.value:s),e._wrapperState={initialChecked:n,initialValue:s,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function uAe(e,t){t=t.checked,t!=null&&pge(e,"checked",t,!1)}function Mue(e,t){uAe(e,t);var s=uv(t.value),n=t.type;if(s!=null)n==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Tue(e,t.type,s):t.hasOwnProperty("defaultValue")&&Tue(e,t.type,uv(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function gwe(e,t,s){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,s||t===e.value||(e.value=t),e.defaultValue=t}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function Tue(e,t,s){(t!=="number"||nte(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var PT=Array.isArray;function gS(e,t,s,n){if(e=e.options,t){t={};for(var a=0;a"+t.valueOf().toString()+"",t=PL.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function uE(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var GT={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},_Ze=["Webkit","ms","Moz","O"];Object.keys(GT).forEach(function(e){_Ze.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),GT[t]=GT[e]})});function fAe(e,t,s){return t==null||typeof t=="boolean"||t===""?"":s||typeof t!="number"||t===0||GT.hasOwnProperty(e)&>[e]?(""+t).trim():t+"px"}function gAe(e,t){e=e.style;for(var s in t)if(t.hasOwnProperty(s)){var n=s.indexOf("--")===0,a=fAe(s,t[s],n);s==="float"&&(s="cssFloat"),n?e.setProperty(s,a):e[s]=a}}var bZe=Wl({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 Iue(e,t){if(t){if(bZe[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Is(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Is(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Is(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Is(62))}}function Pue(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 Lue=null;function yge(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Oue=null,xS=null,yS=null;function vwe(e){if(e=KI(e)){if(typeof Oue!="function")throw Error(Is(280));var t=e.stateNode;t&&(t=ine(t),Oue(e.stateNode,e.type,t))}}function xAe(e){xS?yS?yS.push(e):yS=[e]:xS=e}function yAe(){if(xS){var e=xS,t=yS;if(yS=xS=null,vwe(e),t)for(e=0;e>>=0,e===0?32:31-(IZe(e)/PZe|0)|0}var LL=64,OL=4194304;function LT(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 lte(e,t){var s=e.pendingLanes;if(s===0)return 0;var n=0,a=e.suspendedLanes,o=e.pingedLanes,l=s&268435455;if(l!==0){var i=l&~a;i!==0?n=LT(i):(o&=l,o!==0&&(n=LT(o)))}else l=s&~a,l!==0?n=LT(l):o!==0&&(n=LT(o));if(n===0)return 0;if(t!==0&&t!==n&&!(t&a)&&(a=n&-n,o=t&-t,a>=o||a===16&&(o&4194240)!==0))return t;if(n&4&&(n|=s&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0s;s++)t.push(e);return t}function WI(e,t,s){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Cf(t),e[t]=s}function RZe(e,t){var s=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 n=e.eventTimes;for(e=e.expirationTimes;0=ZT),Mwe=" ",Twe=!1;function FAe(e,t){switch(e){case"keyup":return uYe.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zAe(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Q4=!1;function mYe(e,t){switch(e){case"compositionend":return zAe(t);case"keypress":return t.which!==32?null:(Twe=!0,Mwe);case"textInput":return e=t.data,e===Mwe&&Twe?null:e;default:return null}}function pYe(e,t){if(Q4)return e==="compositionend"||!Sge&&FAe(e,t)?(e=DAe(),e8=jge=k1=null,Q4=!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:s,offset:t-e};e=n}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Pwe(s)}}function qAe(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?qAe(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function VAe(){for(var e=window,t=nte();t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=nte(e.document)}return t}function Cge(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 jYe(e){var t=VAe(),s=e.focusedElem,n=e.selectionRange;if(t!==s&&s&&s.ownerDocument&&qAe(s.ownerDocument.documentElement,s)){if(n!==null&&Cge(s)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in s)s.selectionStart=t,s.selectionEnd=Math.min(e,s.value.length);else if(e=(t=s.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=s.textContent.length,o=Math.min(n.start,a);n=n.end===void 0?o:Math.min(n.end,a),!e.extend&&o>n&&(a=n,n=o,o=a),a=Lwe(s,o);var l=Lwe(s,n);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>n?(e.addRange(t),e.extend(l.node,l.offset)):(t.setEnd(l.node,l.offset),e.addRange(t)))}}for(t=[],e=s;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s=document.documentMode,J4=null,$ue=null,XT=null,Uue=!1;function Owe(e,t,s){var n=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Uue||J4==null||J4!==nte(n)||(n=J4,"selectionStart"in n&&Cge(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),XT&&xE(XT,n)||(XT=n,n=ute($ue,"onSelect"),0rS||(e.current=Kue[rS],Kue[rS]=null,rS--)}function ol(e,t){rS++,Kue[rS]=e.current,e.current=t}var hv={},ku=wv(hv),Lh=wv(!1),rk=hv;function kC(e,t){var s=e.type.contextTypes;if(!s)return hv;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var a={},o;for(o in s)a[o]=t[o];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function Oh(e){return e=e.childContextTypes,e!=null}function mte(){_l(Lh),_l(ku)}function Uwe(e,t,s){if(ku.current!==hv)throw Error(Is(168));ol(ku,t),ol(Lh,s)}function JAe(e,t,s){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return s;n=n.getChildContext();for(var a in n)if(!(a in t))throw Error(Is(108,yZe(e)||"Unknown",a));return Wl({},s,n)}function pte(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||hv,rk=ku.current,ol(ku,e),ol(Lh,Lh.current),!0}function qwe(e,t,s){var n=e.stateNode;if(!n)throw Error(Is(169));s?(e=JAe(e,t,rk),n.__reactInternalMemoizedMergedChildContext=e,_l(Lh),_l(ku),ol(ku,e)):_l(Lh),ol(Lh,s)}var Kx=null,one=!1,ace=!1;function eEe(e){Kx===null?Kx=[e]:Kx.push(e)}function OYe(e){one=!0,eEe(e)}function jv(){if(!ace&&Kx!==null){ace=!0;var e=0,t=Fo;try{var s=Kx;for(Fo=1;e>=l,a-=l,ey=1<<32-Cf(t)+a|s<H?(G=q,q=null):G=q.sibling;var Q=v(E,q,P[H],R);if(Q===null){q===null&&(q=G);break}e&&q&&Q.alternate===null&&t(E,q),T=o(Q,T,H),U===null?D=Q:U.sibling=Q,U=Q,q=G}if(H===P.length)return s(E,q),Al&&O_(E,H),D;if(q===null){for(;HH?(G=q,q=null):G=q.sibling;var ne=v(E,q,Q.value,R);if(ne===null){q===null&&(q=G);break}e&&q&&ne.alternate===null&&t(E,q),T=o(ne,T,H),U===null?D=ne:U.sibling=ne,U=ne,q=G}if(Q.done)return s(E,q),Al&&O_(E,H),D;if(q===null){for(;!Q.done;H++,Q=P.next())Q=y(E,Q.value,R),Q!==null&&(T=o(Q,T,H),U===null?D=Q:U.sibling=Q,U=Q);return Al&&O_(E,H),D}for(q=n(E,q);!Q.done;H++,Q=P.next())Q=b(q,E,H,Q.value,R),Q!==null&&(e&&Q.alternate!==null&&q.delete(Q.key===null?H:Q.key),T=o(Q,T,H),U===null?D=Q:U.sibling=Q,U=Q);return e&&q.forEach(function(ie){return t(E,ie)}),Al&&O_(E,H),D}function M(E,T,P,R){if(typeof P=="object"&&P!==null&&P.type===X4&&P.key===null&&(P=P.props.children),typeof P=="object"&&P!==null){switch(P.$$typeof){case EL:e:{for(var D=P.key,U=T;U!==null;){if(U.key===D){if(D=P.type,D===X4){if(U.tag===7){s(E,U.sibling),T=a(U,P.props.children),T.return=E,E=T;break e}}else if(U.elementType===D||typeof D=="object"&&D!==null&&D.$$typeof===W0&&Wwe(D)===U.type){s(E,U.sibling),T=a(U,P.props),T.ref=rT(E,U,P),T.return=E,E=T;break e}s(E,U);break}else t(E,U);U=U.sibling}P.type===X4?(T=Aj(P.props.children,E.mode,R,P.key),T.return=E,E=T):(R=l8(P.type,P.key,P.props,null,E.mode,R),R.ref=rT(E,T,P),R.return=E,E=R)}return l(E);case Y4: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){s(E,T.sibling),T=a(T,P.children||[]),T.return=E,E=T;break e}else{s(E,T);break}else t(E,T);T=T.sibling}T=mce(P,E.mode,R),T.return=E,E=T}return l(E);case W0:return U=P._init,M(E,T,U(P._payload),R)}if(PT(P))return N(E,T,P,R);if(XM(P))return k(E,T,P,R);UL(E,P)}return typeof P=="string"&&P!==""||typeof P=="number"?(P=""+P,T!==null&&T.tag===6?(s(E,T.sibling),T=a(T,P),T.return=E,E=T):(s(E,T),T=hce(P,E.mode,R),T.return=E,E=T),l(E)):s(E,T)}return M}var SC=nEe(!0),aEe=nEe(!1),xte=wv(null),yte=null,aS=null,Ege=null;function Ige(){Ege=aS=yte=null}function Pge(e){var t=xte.current;_l(xte),e._currentValue=t}function Xue(e,t,s){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===s)break;e=e.return}}function _S(e,t){yte=e,Ege=aS=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ah=!0),e.firstContext=null)}function _p(e){var t=e._currentValue;if(Ege!==e)if(e={context:e,memoizedValue:t,next:null},aS===null){if(yte===null)throw Error(Is(308));aS=e,yte.dependencies={lanes:0,firstContext:e}}else aS=aS.next=e;return t}var ij=null;function Lge(e){ij===null?ij=[e]:ij.push(e)}function iEe(e,t,s,n){var a=t.interleaved;return a===null?(s.next=s,Lge(t)):(s.next=a.next,a.next=s),t.interleaved=s,Cy(e,n)}function Cy(e,t){e.lanes|=t;var s=e.alternate;for(s!==null&&(s.lanes|=t),s=e,e=e.return;e!==null;)e.childLanes|=t,s=e.alternate,s!==null&&(s.childLanes|=t),s=e,e=e.return;return s.tag===3?s.stateNode:null}var G0=!1;function Oge(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function oEe(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function oy(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function R1(e,t,s){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,uo&2){var a=n.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),n.pending=t,Cy(e,s)}return a=n.interleaved,a===null?(t.next=t,Lge(n)):(t.next=a.next,a.next=t),n.interleaved=t,Cy(e,s)}function r8(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,s|=n,t.lanes=s,_ge(e,s)}}function Gwe(e,t){var s=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,s===n)){var a=null,o=null;if(s=s.firstBaseUpdate,s!==null){do{var l={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};o===null?a=o=l:o=o.next=l,s=s.next}while(s!==null);o===null?a=o=t:o=o.next=t}else a=o=t;s={baseState:n.baseState,firstBaseUpdate:a,lastBaseUpdate:o,shared:n.shared,effects:n.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}function vte(e,t,s,n){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((n&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=s,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=Wl({},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);ak|=l,e.lanes=l,e.memoizedState=y}}function Kwe(e,t,s){if(e=t.effects,t.effects=null,e!==null)for(t=0;ts?s:4,e(!0);var n=oce.transition;oce.transition={};try{e(!1),t()}finally{Fo=s,oce.transition=n}}function kEe(){return bp().memoizedState}function zYe(e,t,s){var n=z1(e);if(s={lane:n,action:s,hasEagerState:!1,eagerState:null,next:null},NEe(e))SEe(t,s);else if(s=iEe(e,t,s,n),s!==null){var a=th();Mf(s,e,n,a),CEe(s,t,n)}}function BYe(e,t,s){var n=z1(e),a={lane:n,action:s,hasEagerState:!1,eagerState:null,next:null};if(NEe(e))SEe(t,a);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var l=t.lastRenderedState,i=o(l,s);if(a.hasEagerState=!0,a.eagerState=i,Ff(i,l)){var u=t.interleaved;u===null?(a.next=a,Lge(t)):(a.next=u.next,u.next=a),t.interleaved=a;return}}catch{}finally{}s=iEe(e,t,a,n),s!==null&&(a=th(),Mf(s,e,n,a),CEe(s,t,n))}}function NEe(e){var t=e.alternate;return e===Ul||t!==null&&t===Ul}function SEe(e,t){QT=bte=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function CEe(e,t,s){if(s&4194240){var n=t.lanes;n&=e.pendingLanes,s|=n,t.lanes=s,_ge(e,s)}}var wte={readContext:_p,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},$Ye={readContext:_p,useCallback:function(e,t){return xg().memoizedState=[e,t===void 0?null:t],e},useContext:_p,useEffect:Ywe,useImperativeHandle:function(e,t,s){return s=s!=null?s.concat([e]):null,n8(4194308,4,vEe.bind(null,t,e),s)},useLayoutEffect:function(e,t){return n8(4194308,4,e,t)},useInsertionEffect:function(e,t){return n8(4,2,e,t)},useMemo:function(e,t){var s=xg();return t=t===void 0?null:t,e=e(),s.memoizedState=[e,t],e},useReducer:function(e,t,s){var n=xg();return t=s!==void 0?s(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=zYe.bind(null,Ul,e),[n.memoizedState,e]},useRef:function(e){var t=xg();return e={current:e},t.memoizedState=e},useState:Zwe,useDebugValue:qge,useDeferredValue:function(e){return xg().memoizedState=e},useTransition:function(){var e=Zwe(!1),t=e[0];return e=FYe.bind(null,e[1]),xg().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,s){var n=Ul,a=xg();if(Al){if(s===void 0)throw Error(Is(407));s=s()}else{if(s=t(),Fd===null)throw Error(Is(349));nk&30||uEe(n,t,s)}a.memoizedState=s;var o={value:s,getSnapshot:t};return a.queue=o,Ywe(mEe.bind(null,n,o,e),[e]),n.flags|=2048,NE(9,hEe.bind(null,n,o,s,t),void 0,null),s},useId:function(){var e=xg(),t=Fd.identifierPrefix;if(Al){var s=ty,n=ey;s=(n&~(1<<32-Cf(n)-1)).toString(32)+s,t=":"+t+"R"+s,s=jE++,0<\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=l.createElement(s,{is:n.is}):(e=l.createElement(s),s==="select"&&(l=e,n.multiple?l.multiple=!0:n.size&&(l.size=n.size))):e=l.createElementNS(e,s),e[Sg]=t,e[_E]=n,REe(e,t,!1,!1),t.stateNode=e;e:{switch(l=Pue(s,n),s){case"dialog":fl("cancel",e),fl("close",e),a=n;break;case"iframe":case"object":case"embed":fl("load",e),a=n;break;case"video":case"audio":for(a=0;aTC&&(t.flags|=128,n=!0,sT(o,!1),t.lanes=4194304)}else{if(!n)if(e=_te(l),e!==null){if(t.flags|=128,n=!0,s=e.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),sT(o,!0),o.tail===null&&o.tailMode==="hidden"&&!l.alternate&&!Al)return mu(t),null}else 2*bc()-o.renderingStartTime>TC&&s!==1073741824&&(t.flags|=128,n=!0,sT(o,!1),t.lanes=4194304);o.isBackwards?(l.sibling=t.child,t.child=l):(s=o.last,s!==null?s.sibling=l:t.child=l,o.last=l)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=bc(),t.sibling=null,s=zl.current,ol(zl,n?s&1|2:s&1),t):(mu(t),null);case 22:case 23:return Zge(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&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(Is(156,t.tag))}function ZYe(e,t){switch(Tge(t),t.tag){case 1:return Oh(t.type)&&mte(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return CC(),_l(Lh),_l(ku),Fge(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Rge(t),null;case 13:if(_l(zl),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Is(340));NC()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _l(zl),null;case 4:return CC(),null;case 10:return Pge(t.type._context),null;case 22:case 23:return Zge(),null;case 24:return null;default:return null}}var VL=!1,xu=!1,YYe=typeof WeakSet=="function"?WeakSet:Set,Cn=null;function iS(e,t){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(n){Ql(e,t,n)}else s.current=null}function ihe(e,t,s){try{s()}catch(n){Ql(e,t,n)}}var oje=!1;function XYe(e,t){if(que=cte,e=VAe(),Cge(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var n=s.getSelection&&s.getSelection();if(n&&n.rangeCount!==0){s=n.anchorNode;var a=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{s.nodeType,o.nodeType}catch{s=null;break e}var l=0,i=-1,u=-1,m=0,x=0,y=e,v=null;t:for(;;){for(var b;y!==s||a!==0&&y.nodeType!==3||(i=l+a),y!==o||n!==0&&y.nodeType!==3||(u=l+n),y.nodeType===3&&(l+=y.nodeValue.length),(b=y.firstChild)!==null;)v=y,y=b;for(;;){if(y===e)break t;if(v===s&&++m===a&&(i=l),v===o&&++x===n&&(u=l),(b=y.nextSibling)!==null)break;y=v,v=y.parentNode}y=b}s=i===-1||u===-1?null:{start:i,end:u}}else s=null}s=s||{start:0,end:0}}else s=null;for(Vue={focusedElem:e,selectionRange:s},cte=!1,Cn=t;Cn!==null;)if(t=Cn,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Cn=e;else for(;Cn!==null;){t=Cn;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,E=t.stateNode,T=E.getSnapshotBeforeUpdate(t.elementType===t.type?k:lf(t.type,k),M);E.__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(Is(163))}}catch(R){Ql(t,t.return,R)}if(e=t.sibling,e!==null){e.return=t.return,Cn=e;break}Cn=t.return}return N=oje,oje=!1,N}function JT(e,t,s){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var a=n=n.next;do{if((a.tag&e)===e){var o=a.destroy;a.destroy=void 0,o!==void 0&&ihe(t,s,o)}a=a.next}while(a!==n)}}function dne(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var s=t=t.next;do{if((s.tag&e)===e){var n=s.create;s.destroy=n()}s=s.next}while(s!==t)}}function ohe(e){var t=e.ref;if(t!==null){var s=e.stateNode;switch(e.tag){case 5:e=s;break;default:e=s}typeof t=="function"?t(e):t.current=e}}function BEe(e){var t=e.alternate;t!==null&&(e.alternate=null,BEe(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Sg],delete t[_E],delete t[Gue],delete t[PYe],delete t[LYe])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function $Ee(e){return e.tag===5||e.tag===3||e.tag===4}function lje(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||$Ee(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function lhe(e,t,s){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?s.nodeType===8?s.parentNode.insertBefore(e,t):s.insertBefore(e,t):(s.nodeType===8?(t=s.parentNode,t.insertBefore(e,s)):(t=s,t.appendChild(e)),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=hte));else if(n!==4&&(e=e.child,e!==null))for(lhe(e,t,s),e=e.sibling;e!==null;)lhe(e,t,s),e=e.sibling}function che(e,t,s){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?s.insertBefore(e,t):s.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(che(e,t,s),e=e.sibling;e!==null;)che(e,t,s),e=e.sibling}var Jd=null,hf=!1;function O0(e,t,s){for(s=s.child;s!==null;)UEe(e,t,s),s=s.sibling}function UEe(e,t,s){if(Pg&&typeof Pg.onCommitFiberUnmount=="function")try{Pg.onCommitFiberUnmount(rne,s)}catch{}switch(s.tag){case 5:xu||iS(s,t);case 6:var n=Jd,a=hf;Jd=null,O0(e,t,s),Jd=n,hf=a,Jd!==null&&(hf?(e=Jd,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):Jd.removeChild(s.stateNode));break;case 18:Jd!==null&&(hf?(e=Jd,s=s.stateNode,e.nodeType===8?nce(e.parentNode,s):e.nodeType===1&&nce(e,s),fE(e)):nce(Jd,s.stateNode));break;case 4:n=Jd,a=hf,Jd=s.stateNode.containerInfo,hf=!0,O0(e,t,s),Jd=n,hf=a;break;case 0:case 11:case 14:case 15:if(!xu&&(n=s.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){a=n=n.next;do{var o=a,l=o.destroy;o=o.tag,l!==void 0&&(o&2||o&4)&&ihe(s,t,l),a=a.next}while(a!==n)}O0(e,t,s);break;case 1:if(!xu&&(iS(s,t),n=s.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=s.memoizedProps,n.state=s.memoizedState,n.componentWillUnmount()}catch(i){Ql(s,t,i)}O0(e,t,s);break;case 21:O0(e,t,s);break;case 22:s.mode&1?(xu=(n=xu)||s.memoizedState!==null,O0(e,t,s),xu=n):O0(e,t,s);break;default:O0(e,t,s)}}function cje(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new YYe),t.forEach(function(n){var a=iXe.bind(null,e,n);s.has(n)||(s.add(n),n.then(a,a))})}}function ef(e,t){var s=t.deletions;if(s!==null)for(var n=0;na&&(a=l),n&=~o}if(n=a,n=bc()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*JYe(n/1960))-n,10e?16:e,N1===null)var n=!1;else{if(e=N1,N1=null,Nte=0,uo&6)throw Error(Is(331));var a=uo;for(uo|=4,Cn=e.current;Cn!==null;){var o=Cn,l=o.child;if(Cn.flags&16){var i=o.deletions;if(i!==null){for(var u=0;ubc()-Gge?Tj(e,0):Wge|=s),Dh(e,t)}function YEe(e,t){t===0&&(e.mode&1?(t=OL,OL<<=1,!(OL&130023424)&&(OL=4194304)):t=1);var s=th();e=Cy(e,t),e!==null&&(WI(e,t,s),Dh(e,s))}function aXe(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),YEe(e,s)}function iXe(e,t){var s=0;switch(e.tag){case 13:var n=e.stateNode,a=e.memoizedState;a!==null&&(s=a.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(Is(314))}n!==null&&n.delete(t),YEe(e,s)}var XEe;XEe=function(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps||Lh.current)Ah=!0;else{if(!(e.lanes&s)&&!(t.flags&128))return Ah=!1,GYe(e,t,s);Ah=!!(e.flags&131072)}else Ah=!1,Al&&t.flags&1048576&&tEe(t,gte,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;a8(e,t),e=t.pendingProps;var a=kC(t,ku.current);_S(t,s),a=Bge(null,t,n,e,a,s);var o=$ge();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,Oh(n)?(o=!0,pte(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Oge(t),a.updater=cne,t.stateNode=a,a._reactInternals=t,Jue(t,n,e,s),t=rhe(null,t,n,!0,o,s)):(t.tag=0,Al&&o&&Mge(t),Wu(null,t,a,s),t=t.child),t;case 16:n=t.elementType;e:{switch(a8(e,t),e=t.pendingProps,a=n._init,n=a(n._payload),t.type=n,a=t.tag=lXe(n),e=lf(n,e),a){case 0:t=the(null,t,n,e,s);break e;case 1:t=nje(null,t,n,e,s);break e;case 11:t=rje(null,t,n,e,s);break e;case 14:t=sje(null,t,n,lf(n.type,e),s);break e}throw Error(Is(306,n,""))}return t;case 0:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:lf(n,a),the(e,t,n,a,s);case 1:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:lf(n,a),nje(e,t,n,a,s);case 3:e:{if(LEe(t),e===null)throw Error(Is(387));n=t.pendingProps,o=t.memoizedState,a=o.element,oEe(e,t),vte(t,n,null,s);var l=t.memoizedState;if(n=l.element,o.isDehydrated)if(o={element:n,isDehydrated:!1,cache:l.cache,pendingSuspenseBoundaries:l.pendingSuspenseBoundaries,transitions:l.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=MC(Error(Is(423)),t),t=aje(e,t,n,s,a);break e}else if(n!==a){a=MC(Error(Is(424)),t),t=aje(e,t,n,s,a);break e}else for(mm=D1(t.stateNode.containerInfo.firstChild),pm=t,Al=!0,gf=null,s=aEe(t,null,n,s),t.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(NC(),n===a){t=My(e,t,s);break e}Wu(e,t,n,s)}t=t.child}return t;case 5:return lEe(t),e===null&&Yue(t),n=t.type,a=t.pendingProps,o=e!==null?e.memoizedProps:null,l=a.children,Hue(n,a)?l=null:o!==null&&Hue(n,o)&&(t.flags|=32),PEe(e,t),Wu(e,t,l,s),t.child;case 6:return e===null&&Yue(t),null;case 13:return OEe(e,t,s);case 4:return Dge(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=SC(t,null,n,s):Wu(e,t,n,s),t.child;case 11:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:lf(n,a),rje(e,t,n,a,s);case 7:return Wu(e,t,t.pendingProps,s),t.child;case 8:return Wu(e,t,t.pendingProps.children,s),t.child;case 12:return Wu(e,t,t.pendingProps.children,s),t.child;case 10:e:{if(n=t.type._context,a=t.pendingProps,o=t.memoizedProps,l=a.value,ol(xte,n._currentValue),n._currentValue=l,o!==null)if(Ff(o.value,l)){if(o.children===a.children&&!Lh.current){t=My(e,t,s);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===n){if(o.tag===1){u=oy(-1,s&-s),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|=s,u=o.alternate,u!==null&&(u.lanes|=s),Xue(o.return,s,t),i.lanes|=s;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(Is(341));l.lanes|=s,i=l.alternate,i!==null&&(i.lanes|=s),Xue(l,s,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}Wu(e,t,a.children,s),t=t.child}return t;case 9:return a=t.type,n=t.pendingProps.children,_S(t,s),a=_p(a),n=n(a),t.flags|=1,Wu(e,t,n,s),t.child;case 14:return n=t.type,a=lf(n,t.pendingProps),a=lf(n.type,a),sje(e,t,n,a,s);case 15:return EEe(e,t,t.type,t.pendingProps,s);case 17:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:lf(n,a),a8(e,t),t.tag=1,Oh(n)?(e=!0,pte(t)):e=!1,_S(t,s),MEe(t,n,a),Jue(t,n,a,s),rhe(null,t,n,!0,e,s);case 19:return DEe(e,t,s);case 22:return IEe(e,t,s)}throw Error(Is(156,t.tag))};function QEe(e,t){return NAe(e,t)}function oXe(e,t,s,n){this.tag=e,this.key=s,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=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function cp(e,t,s,n){return new oXe(e,t,s,n)}function Xge(e){return e=e.prototype,!(!e||!e.isReactComponent)}function lXe(e){if(typeof e=="function")return Xge(e)?1:0;if(e!=null){if(e=e.$$typeof,e===gge)return 11;if(e===xge)return 14}return 2}function B1(e,t){var s=e.alternate;return s===null?(s=cp(e.tag,t,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&14680064,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function l8(e,t,s,n,a,o){var l=2;if(n=e,typeof e=="function")Xge(e)&&(l=1);else if(typeof e=="string")l=5;else e:switch(e){case X4:return Aj(s.children,a,o,t);case fge:l=8,a|=8;break;case jue:return e=cp(12,s,t,a|2),e.elementType=jue,e.lanes=o,e;case kue:return e=cp(13,s,t,a),e.elementType=kue,e.lanes=o,e;case Nue:return e=cp(19,s,t,a),e.elementType=Nue,e.lanes=o,e;case lAe:return hne(s,a,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case iAe:l=10;break e;case oAe:l=9;break e;case gge:l=11;break e;case xge:l=14;break e;case W0:l=16,n=null;break e}throw Error(Is(130,e==null?e:typeof e,""))}return t=cp(l,s,t,a),t.elementType=e,t.type=n,t.lanes=o,t}function Aj(e,t,s,n){return e=cp(7,e,n,t),e.lanes=s,e}function hne(e,t,s,n){return e=cp(22,e,n,t),e.elementType=lAe,e.lanes=s,e.stateNode={isHidden:!1},e}function hce(e,t,s){return e=cp(6,e,null,t),e.lanes=s,e}function mce(e,t,s){return t=cp(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function cXe(e,t,s,n,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=Gle(0),this.expirationTimes=Gle(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gle(0),this.identifierPrefix=n,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function Qge(e,t,s,n,a,o,l,i,u){return e=new cXe(e,t,s,i,u),t===1?(t=1,o===!0&&(t|=8)):t=0,o=cp(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:n,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},Oge(o),e}function dXe(e,t,s){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(rIe)}catch(e){console.error(e)}}rIe(),rAe.exports=Tm;var Eh=rAe.exports;const rxe=no(Eh);var sIe,xje=Eh;sIe=xje.createRoot,xje.hydrateRoot;const fXe=1,gXe=1e6;let pce=0;function xXe(){return pce=(pce+1)%Number.MAX_SAFE_INTEGER,pce.toString()}const fce=new Map,yje=e=>{if(fce.has(e))return;const t=setTimeout(()=>{fce.delete(e),rA({type:"REMOVE_TOAST",toastId:e})},gXe);fce.set(e,t)},yXe=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,fXe)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(s=>s.id===t.toast.id?{...s,...t.toast}:s)};case"DISMISS_TOAST":{const{toastId:s}=t;return s?yje(s):e.toasts.forEach(n=>{yje(n.id)}),{...e,toasts:e.toasts.map(n=>n.id===s||s===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(s=>s.id!==t.toastId)}}},c8=[];let d8={toasts:[]};function rA(e){d8=yXe(d8,e),c8.forEach(t=>{t(d8)})}function Wn({...e}){const t=xXe(),s=a=>rA({type:"UPDATE_TOAST",toast:{...a,id:t}}),n=()=>rA({type:"DISMISS_TOAST",toastId:t});return rA({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:a=>{a||n()}}}),{id:t,dismiss:n,update:s}}function ci(){const[e,t]=A.useState(d8);return A.useEffect(()=>(c8.push(t),()=>{const s=c8.indexOf(t);s>-1&&c8.splice(s,1)}),[e]),{...e,toast:Wn,dismiss:s=>rA({type:"DISMISS_TOAST",toastId:s})}}function xs(e,t,{checkForDefaultPrevented:s=!0}={}){return function(a){if(e==null||e(a),s===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function vje(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ty(...e){return t=>{let s=!1;const n=e.map(a=>{const o=vje(a,t);return!s&&typeof o=="function"&&(s=!0),o});if(s)return()=>{for(let a=0;a{const{children:l,...i}=o,u=A.useMemo(()=>i,Object.values(i));return r.jsx(s.Provider,{value:u,children:l})};n.displayName=e+"Provider";function a(o){const l=A.useContext(s);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[n,a]}function uc(e,t=[]){let s=[];function n(o,l){const i=A.createContext(l),u=s.length;s=[...s,l];const m=y=>{var E;const{scope:v,children:b,...N}=y,k=((E=v==null?void 0:v[e])==null?void 0:E[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=s.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,[n,_Xe(a,...t)]}function _Xe(...e){const t=e[0];if(e.length===1)return t;const s=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(o){const l=n.reduce((i,{useScope:u,scopeName:m})=>{const y=u(o)[`__scope${m}`];return{...i,...y}},{});return A.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return s.scopeName=t.scopeName,s}function mv(e){const t=bXe(e),s=A.forwardRef((n,a)=>{const{children:o,...l}=n,i=A.Children.toArray(o),u=i.find(wXe);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 s.displayName=`${e}.Slot`,s}var sxe=mv("Slot");function bXe(e){const t=A.forwardRef((s,n)=>{const{children:a,...o}=s;if(A.isValidElement(a)){const l=kXe(a),i=jXe(o,a.props);return a.type!==A.Fragment&&(i.ref=n?Ty(n,l):l),A.cloneElement(a,i)}return A.Children.count(a)>1?A.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var nIe=Symbol("radix.slottable");function aIe(e){const t=({children:s})=>r.jsx(r.Fragment,{children:s});return t.displayName=`${e}.Slottable`,t.__radixId=nIe,t}function wXe(e){return A.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===nIe}function jXe(e,t){const s={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?s[n]=(...i)=>{const u=o(...i);return a(...i),u}:a&&(s[n]=a):n==="style"?s[n]={...a,...o}:n==="className"&&(s[n]=[a,o].filter(Boolean).join(" "))}return{...e,...s}}function kXe(e){var n,a;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,s=t&&"isReactWarning"in t&&t.isReactWarning;return s?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,s=t&&"isReactWarning"in t&&t.isReactWarning,s?e.props.ref:e.props.ref||e.ref)}function YI(e){const t=e+"CollectionProvider",[s,n]=uc(t),[a,o]=s(t,{collectionRef:{current:null},itemMap:new Map}),l=k=>{const{scope:M,children:E}=k,T=ut.useRef(null),P=ut.useRef(new Map).current;return r.jsx(a,{scope:M,itemMap:P,collectionRef:T,children:E})};l.displayName=t;const i=e+"CollectionSlot",u=mv(i),m=ut.forwardRef((k,M)=>{const{scope:E,children:T}=k,P=o(i,E),R=ha(M,P.collectionRef);return r.jsx(u,{ref:R,children:T})});m.displayName=i;const x=e+"CollectionItemSlot",y="data-radix-collection-item",v=mv(x),b=ut.forwardRef((k,M)=>{const{scope:E,children:T,...P}=k,R=ut.useRef(null),D=ha(M,R),U=o(x,E);return ut.useEffect(()=>(U.itemMap.set(R,{ref:R,...P}),()=>void U.itemMap.delete(R))),r.jsx(v,{[y]:"",ref:D,children:T})});b.displayName=x;function N(k){const M=o(e+"CollectionConsumer",k);return ut.useCallback(()=>{const T=M.collectionRef.current;if(!T)return[];const P=Array.from(T.querySelectorAll(`[${y}]`));return Array.from(M.itemMap.values()).sort((U,q)=>P.indexOf(U.ref.current)-P.indexOf(q.ref.current))},[M.collectionRef,M.itemMap])}return[{Provider:l,Slot:m,ItemSlot:b},N,n]}var NXe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$s=NXe.reduce((e,t)=>{const s=mv(`Primitive.${t}`),n=A.forwardRef((a,o)=>{const{asChild:l,...i}=a,u=l?s:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(u,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function nxe(e,t){e&&Eh.flushSync(()=>e.dispatchEvent(t))}function ac(e){const t=A.useRef(e);return A.useEffect(()=>{t.current=e}),A.useMemo(()=>(...s)=>{var n;return(n=t.current)==null?void 0:n.call(t,...s)},[])}function SXe(e,t=globalThis==null?void 0:globalThis.document){const s=ac(e);A.useEffect(()=>{const n=a=>{a.key==="Escape"&&s(a)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[s,t])}var CXe="DismissableLayer",phe="dismissableLayer.update",MXe="dismissableLayer.pointerDownOutside",TXe="dismissableLayer.focusOutside",_je,iIe=A.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),kv=A.forwardRef((e,t)=>{const{disableOutsidePointerEvents:s=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:l,onDismiss:i,...u}=e,m=A.useContext(iIe),[x,y]=A.useState(null),v=(x==null?void 0:x.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=A.useState({}),N=ha(t,q=>y(q)),k=Array.from(m.layers),[M]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),E=k.indexOf(M),T=x?k.indexOf(x):-1,P=m.layersWithOutsidePointerEventsDisabled.size>0,R=T>=E,D=EXe(q=>{const H=q.target,G=[...m.branches].some(Q=>Q.contains(H));!R||G||(a==null||a(q),l==null||l(q),q.defaultPrevented||i==null||i())},v),U=IXe(q=>{const H=q.target;[...m.branches].some(Q=>Q.contains(H))||(o==null||o(q),l==null||l(q),q.defaultPrevented||i==null||i())},v);return SXe(q=>{T===m.layers.size-1&&(n==null||n(q),!q.defaultPrevented&&i&&(q.preventDefault(),i()))},v),A.useEffect(()=>{if(x)return s&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(_je=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(x)),m.layers.add(x),bje(),()=>{s&&m.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=_je)}},[x,v,s,m]),A.useEffect(()=>()=>{x&&(m.layers.delete(x),m.layersWithOutsidePointerEventsDisabled.delete(x),bje())},[x,m]),A.useEffect(()=>{const q=()=>b({});return document.addEventListener(phe,q),()=>document.removeEventListener(phe,q)},[]),r.jsx($s.div,{...u,ref:N,style:{pointerEvents:P?R?"auto":"none":void 0,...e.style},onFocusCapture:xs(e.onFocusCapture,U.onFocusCapture),onBlurCapture:xs(e.onBlurCapture,U.onBlurCapture),onPointerDownCapture:xs(e.onPointerDownCapture,D.onPointerDownCapture)})});kv.displayName=CXe;var AXe="DismissableLayerBranch",oIe=A.forwardRef((e,t)=>{const s=A.useContext(iIe),n=A.useRef(null),a=ha(t,n);return A.useEffect(()=>{const o=n.current;if(o)return s.branches.add(o),()=>{s.branches.delete(o)}},[s.branches]),r.jsx($s.div,{...e,ref:a})});oIe.displayName=AXe;function EXe(e,t=globalThis==null?void 0:globalThis.document){const s=ac(e),n=A.useRef(!1),a=A.useRef(()=>{});return A.useEffect(()=>{const o=i=>{if(i.target&&!n.current){let u=function(){lIe(MXe,s,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);n.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",o),t.removeEventListener("click",a.current)}},[t,s]),{onPointerDownCapture:()=>n.current=!0}}function IXe(e,t=globalThis==null?void 0:globalThis.document){const s=ac(e),n=A.useRef(!1);return A.useEffect(()=>{const a=o=>{o.target&&!n.current&&lIe(TXe,s,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,s]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function bje(){const e=new CustomEvent(phe);document.dispatchEvent(e)}function lIe(e,t,s,{discrete:n}){const a=s.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:s});t&&a.addEventListener(e,t,{once:!0}),n?nxe(a,o):a.dispatchEvent(o)}var PXe=kv,LXe=oIe,cc=globalThis!=null&&globalThis.document?A.useLayoutEffect:()=>{},OXe="Portal",w3=A.forwardRef((e,t)=>{var i;const{container:s,...n}=e,[a,o]=A.useState(!1);cc(()=>o(!0),[]);const l=s||a&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return l?rxe.createPortal(r.jsx($s.div,{...n,ref:t}),l):null});w3.displayName=OXe;function DXe(e,t){return A.useReducer((s,n)=>t[s][n]??s,e)}var Ec=e=>{const{present:t,children:s}=e,n=RXe(t),a=typeof s=="function"?s({present:n.isPresent}):A.Children.only(s),o=ha(n.ref,FXe(a));return typeof s=="function"||n.isPresent?A.cloneElement(a,{ref:o}):null};Ec.displayName="Presence";function RXe(e){const[t,s]=A.useState(),n=A.useRef(null),a=A.useRef(e),o=A.useRef("none"),l=e?"mounted":"unmounted",[i,u]=DXe(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return A.useEffect(()=>{const m=GL(n.current);o.current=i==="mounted"?m:"none"},[i]),cc(()=>{const m=n.current,x=a.current;if(x!==e){const v=o.current,b=GL(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]),cc(()=>{if(t){let m;const x=t.ownerDocument.defaultView??window,y=b=>{const k=GL(n.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=GL(n.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=>{n.current=m?getComputedStyle(m):null,s(m)},[])}}function GL(e){return(e==null?void 0:e.animationName)||"none"}function FXe(e){var n,a;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,s=t&&"isReactWarning"in t&&t.isReactWarning;return s?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,s=t&&"isReactWarning"in t&&t.isReactWarning,s?e.props.ref:e.props.ref||e.ref)}var zXe=uge[" useInsertionEffect ".trim().toString()]||cc;function ah({prop:e,defaultProp:t,onChange:s=()=>{},caller:n}){const[a,o,l]=BXe({defaultProp:t,onChange:s}),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(`${n} 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,n])}const m=A.useCallback(x=>{var y;if(i){const v=$Xe(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 BXe({defaultProp:e,onChange:t}){const[s,n]=A.useState(e),a=A.useRef(s),o=A.useRef(t);return zXe(()=>{o.current=t},[t]),A.useEffect(()=>{var l;a.current!==s&&((l=o.current)==null||l.call(o,s),a.current=s)},[s,a]),[s,n,o]}function $Xe(e){return typeof e=="function"}var cIe=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),UXe="VisuallyHidden",xne=A.forwardRef((e,t)=>r.jsx($s.span,{...e,ref:t,style:{...cIe,...e.style}}));xne.displayName=UXe;var qXe=xne,axe="ToastProvider",[ixe,VXe,HXe]=YI("Toast"),[dIe]=uc("Toast",[HXe]),[WXe,yne]=dIe(axe),uIe=e=>{const{__scopeToast:t,label:s="Notification",duration:n=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 s.trim()||console.error(`Invalid prop \`label\` supplied to \`${axe}\`. Expected non-empty \`string\`.`),r.jsx(ixe.Provider,{scope:t,children:r.jsx(WXe,{scope:t,label:s,duration:n,swipeDirection:a,swipeThreshold:o,toastCount:m,viewport:i,onViewportChange:u,onToastAdd:A.useCallback(()=>x(b=>b+1),[]),onToastRemove:A.useCallback(()=>x(b=>b-1),[]),isFocusedToastEscapeKeyDownRef:y,isClosePausedRef:v,children:l})})};uIe.displayName=axe;var hIe="ToastViewport",GXe=["F8"],fhe="toast.viewportPause",ghe="toast.viewportResume",mIe=A.forwardRef((e,t)=>{const{__scopeToast:s,hotkey:n=GXe,label:a="Notifications ({hotkey})",...o}=e,l=yne(hIe,s),i=VXe(s),u=A.useRef(null),m=A.useRef(null),x=A.useRef(null),y=A.useRef(null),v=ha(t,y,l.onViewportChange),b=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),N=l.toastCount>0;A.useEffect(()=>{const M=E=>{var P;n.length!==0&&n.every(R=>E[R]||E.code===R)&&((P=y.current)==null||P.focus())};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[n]),A.useEffect(()=>{const M=u.current,E=y.current;if(N&&M&&E){const T=()=>{if(!l.isClosePausedRef.current){const U=new CustomEvent(fhe);E.dispatchEvent(U),l.isClosePausedRef.current=!0}},P=()=>{if(l.isClosePausedRef.current){const U=new CustomEvent(ghe);E.dispatchEvent(U),l.isClosePausedRef.current=!1}},R=U=>{!M.contains(U.relatedTarget)&&P()},D=()=>{M.contains(document.activeElement)||P()};return M.addEventListener("focusin",T),M.addEventListener("focusout",R),M.addEventListener("pointermove",T),M.addEventListener("pointerleave",D),window.addEventListener("blur",T),window.addEventListener("focus",P),()=>{M.removeEventListener("focusin",T),M.removeEventListener("focusout",R),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 R=P.ref.current,D=[R,...iQe(R)];return M==="forwards"?D:D.reverse()});return(M==="forwards"?T.reverse():T).flat()},[i]);return A.useEffect(()=>{const M=y.current;if(M){const E=T=>{var D,U,q;const P=T.altKey||T.ctrlKey||T.metaKey;if(T.key==="Tab"&&!P){const H=document.activeElement,G=T.shiftKey;if(T.target===M&&G){(D=m.current)==null||D.focus();return}const ie=k({tabbingDirection:G?"backwards":"forwards"}),he=ie.findIndex(se=>se===H);gce(ie.slice(he+1))?T.preventDefault():G?(U=m.current)==null||U.focus():(q=x.current)==null||q.focus()}};return M.addEventListener("keydown",E),()=>M.removeEventListener("keydown",E)}},[i,k]),r.jsxs(LXe,{ref:u,role:"region","aria-label":a.replace("{hotkey}",b),tabIndex:-1,style:{pointerEvents:N?void 0:"none"},children:[N&&r.jsx(xhe,{ref:m,onFocusFromOutsideViewport:()=>{const M=k({tabbingDirection:"forwards"});gce(M)}}),r.jsx(ixe.Slot,{scope:s,children:r.jsx($s.ol,{tabIndex:-1,...o,ref:v})}),N&&r.jsx(xhe,{ref:x,onFocusFromOutsideViewport:()=>{const M=k({tabbingDirection:"backwards"});gce(M)}})]})});mIe.displayName=hIe;var pIe="ToastFocusProxy",xhe=A.forwardRef((e,t)=>{const{__scopeToast:s,onFocusFromOutsideViewport:n,...a}=e,o=yne(pIe,s);return r.jsx(xne,{"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))&&n()}})});xhe.displayName=pIe;var XI="Toast",KXe="toast.swipeStart",ZXe="toast.swipeMove",YXe="toast.swipeCancel",XXe="toast.swipeEnd",fIe=A.forwardRef((e,t)=>{const{forceMount:s,open:n,defaultOpen:a,onOpenChange:o,...l}=e,[i,u]=ah({prop:n,defaultProp:a??!0,onChange:o,caller:XI});return r.jsx(Ec,{present:s||i,children:r.jsx(eQe,{open:i,...l,ref:t,onClose:()=>u(!1),onPause:ac(e.onPause),onResume:ac(e.onResume),onSwipeStart:xs(e.onSwipeStart,m=>{m.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:xs(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:xs(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:xs(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)})})})});fIe.displayName=XI;var[QXe,JXe]=dIe(XI,{onClose(){}}),eQe=A.forwardRef((e,t)=>{const{__scopeToast:s,type:n="foreground",duration:a,open:o,onClose:l,onEscapeKeyDown:i,onPause:u,onResume:m,onSwipeStart:x,onSwipeMove:y,onSwipeCancel:v,onSwipeEnd:b,...N}=e,k=yne(XI,s),[M,E]=A.useState(null),T=ha(t,se=>E(se)),P=A.useRef(null),R=A.useRef(null),D=a||k.duration,U=A.useRef(0),q=A.useRef(D),H=A.useRef(0),{onToastAdd:G,onToastRemove:Q}=k,ne=ac(()=>{var fe;(M==null?void 0:M.contains(document.activeElement))&&((fe=k.viewport)==null||fe.focus()),l()}),ie=A.useCallback(se=>{!se||se===1/0||(window.clearTimeout(H.current),U.current=new Date().getTime(),H.current=window.setTimeout(ne,se))},[ne]);A.useEffect(()=>{const se=k.viewport;if(se){const fe=()=>{ie(q.current),m==null||m()},oe=()=>{const ce=new Date().getTime()-U.current;q.current=q.current-ce,window.clearTimeout(H.current),u==null||u()};return se.addEventListener(fhe,oe),se.addEventListener(ghe,fe),()=>{se.removeEventListener(fhe,oe),se.removeEventListener(ghe,fe)}}},[k.viewport,D,u,m,ie]),A.useEffect(()=>{o&&!k.isClosePausedRef.current&&ie(D)},[o,D,k.isClosePausedRef,ie]),A.useEffect(()=>(G(),()=>Q()),[G,Q]);const he=A.useMemo(()=>M?wIe(M):null,[M]);return k.viewport?r.jsxs(r.Fragment,{children:[he&&r.jsx(tQe,{__scopeToast:s,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:he}),r.jsx(QXe,{scope:s,onClose:ne,children:Eh.createPortal(r.jsx(ixe.ItemSlot,{scope:s,children:r.jsx(PXe,{asChild:!0,onEscapeKeyDown:xs(i,()=>{k.isFocusedToastEscapeKeyDownRef.current||ne(),k.isFocusedToastEscapeKeyDownRef.current=!1}),children:r.jsx($s.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:xs(e.onKeyDown,se=>{se.key==="Escape"&&(i==null||i(se.nativeEvent),se.nativeEvent.defaultPrevented||(k.isFocusedToastEscapeKeyDownRef.current=!0,ne()))}),onPointerDown:xs(e.onPointerDown,se=>{se.button===0&&(P.current={x:se.clientX,y:se.clientY})}),onPointerMove:xs(e.onPointerMove,se=>{if(!P.current)return;const fe=se.clientX-P.current.x,oe=se.clientY-P.current.y,ce=!!R.current,de=["left","right"].includes(k.swipeDirection),xe=["left","up"].includes(k.swipeDirection)?Math.min:Math.max,Me=de?xe(0,fe):0,ve=de?0:xe(0,oe),be=se.pointerType==="touch"?10:2,we={x:Me,y:ve},tt={originalEvent:se,delta:we};ce?(R.current=we,KL(ZXe,y,tt,{discrete:!1})):wje(we,k.swipeDirection,be)?(R.current=we,KL(KXe,x,tt,{discrete:!1}),se.target.setPointerCapture(se.pointerId)):(Math.abs(fe)>be||Math.abs(oe)>be)&&(P.current=null)}),onPointerUp:xs(e.onPointerUp,se=>{const fe=R.current,oe=se.target;if(oe.hasPointerCapture(se.pointerId)&&oe.releasePointerCapture(se.pointerId),R.current=null,P.current=null,fe){const ce=se.currentTarget,de={originalEvent:se,delta:fe};wje(fe,k.swipeDirection,k.swipeThreshold)?KL(XXe,b,de,{discrete:!0}):KL(YXe,v,de,{discrete:!0}),ce.addEventListener("click",xe=>xe.preventDefault(),{once:!0})}})})})}),k.viewport)})]}):null}),tQe=e=>{const{__scopeToast:t,children:s,...n}=e,a=yne(XI,t),[o,l]=A.useState(!1),[i,u]=A.useState(!1);return nQe(()=>l(!0)),A.useEffect(()=>{const m=window.setTimeout(()=>u(!0),1e3);return()=>window.clearTimeout(m)},[]),i?null:r.jsx(w3,{asChild:!0,children:r.jsx(xne,{...n,children:o&&r.jsxs(r.Fragment,{children:[a.label," ",s]})})})},rQe="ToastTitle",gIe=A.forwardRef((e,t)=>{const{__scopeToast:s,...n}=e;return r.jsx($s.div,{...n,ref:t})});gIe.displayName=rQe;var sQe="ToastDescription",xIe=A.forwardRef((e,t)=>{const{__scopeToast:s,...n}=e;return r.jsx($s.div,{...n,ref:t})});xIe.displayName=sQe;var yIe="ToastAction",vIe=A.forwardRef((e,t)=>{const{altText:s,...n}=e;return s.trim()?r.jsx(bIe,{altText:s,asChild:!0,children:r.jsx(oxe,{...n,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${yIe}\`. Expected non-empty \`string\`.`),null)});vIe.displayName=yIe;var _Ie="ToastClose",oxe=A.forwardRef((e,t)=>{const{__scopeToast:s,...n}=e,a=JXe(_Ie,s);return r.jsx(bIe,{asChild:!0,children:r.jsx($s.button,{type:"button",...n,ref:t,onClick:xs(e.onClick,a.onClose)})})});oxe.displayName=_Ie;var bIe=A.forwardRef((e,t)=>{const{__scopeToast:s,altText:n,...a}=e;return r.jsx($s.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...a,ref:t})});function wIe(e){const t=[];return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),aQe(n)){const a=n.ariaHidden||n.hidden||n.style.display==="none",o=n.dataset.radixToastAnnounceExclude==="";if(!a)if(o){const l=n.dataset.radixToastAnnounceAlt;l&&t.push(l)}else t.push(...wIe(n))}}),t}function KL(e,t,s,{discrete:n}){const a=s.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:s});t&&a.addEventListener(e,t,{once:!0}),n?nxe(a,o):a.dispatchEvent(o)}var wje=(e,t,s=0)=>{const n=Math.abs(e.x),a=Math.abs(e.y),o=n>a;return t==="left"||t==="right"?o&&n>s:!o&&a>s};function nQe(e=()=>{}){const t=ac(e);cc(()=>{let s=0,n=0;return s=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(s),window.cancelAnimationFrame(n)}},[t])}function aQe(e){return e.nodeType===e.ELEMENT_NODE}function iQe(e){const t=[],s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;s.nextNode();)t.push(s.currentNode);return t}function gce(e){const t=document.activeElement;return e.some(s=>s===t?!0:(s.focus(),document.activeElement!==t))}var oQe=uIe,jIe=mIe,kIe=fIe,NIe=gIe,SIe=xIe,CIe=vIe,MIe=oxe;function TIe(e){var t,s,n="";if(typeof e=="string"||typeof e=="number")n+=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,kje=mi,j3=(e,t)=>s=>{var n;if((t==null?void 0:t.variants)==null)return kje(e,s==null?void 0:s.class,s==null?void 0:s.className);const{variants:a,defaultVariants:o}=t,l=Object.keys(a).map(m=>{const x=s==null?void 0:s[m],y=o==null?void 0:o[m];if(x===null)return null;const v=jje(x)||jje(y);return a[m][v]}),i=s&&Object.entries(s).reduce((m,x)=>{let[y,v]=x;return v===void 0||(m[y]=v),m},{}),u=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.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 kje(e,l,u,s==null?void 0:s.class,s==null?void 0:s.className)};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lQe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),AIe=(...e)=>e.filter((t,s,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===s).join(" ").trim();/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var cQe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EIe=A.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:n,className:a="",children:o,iconNode:l,...i},u)=>A.createElement("svg",{ref:u,...cQe,width:t,height:t,stroke:e,strokeWidth:n?Number(s)*24/Number(t):s,className:AIe("lucide",a),...i},[...l.map(([m,x])=>A.createElement(m,x)),...Array.isArray(o)?o:[o]]));/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V=(e,t)=>{const s=A.forwardRef(({className:n,...a},o)=>A.createElement(EIe,{ref:o,iconNode:t,className:AIe(`lucide-${lQe(e)}`,n),...a}));return s.displayName=`${e}`,s};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u8=V("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 h8=V("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 m8=V("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 p8=V("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 Og=V("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 f8=V("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 g8=V("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 R_=V("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 F_=V("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 x8=V("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 z_=V("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 y8=V("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 v8=V("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 _8=V("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 b8=V("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 w8=V("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 wS=V("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 j8=V("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 k8=V("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 N8=V("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 S8=V("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 C8=V("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 M8=V("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 T8=V("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 A8=V("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 E8=V("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 I8=V("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 P8=V("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 jS=V("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 kS=V("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 L8=V("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 O8=V("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 D8=V("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 R8=V("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 F8=V("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 z8=V("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 B8=V("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 $8=V("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 U8=V("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 q8=V("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 V8=V("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 H8=V("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 W8=V("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 G8=V("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 K8=V("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 Z8=V("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 Y8=V("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 X8=V("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 Q8=V("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 J8=V("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 eD=V("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 sA=V("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 tD=V("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 rD=V("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 sD=V("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 nA=V("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 nD=V("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 aD=V("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 iD=V("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 oD=V("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 lD=V("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 cD=V("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 dD=V("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 uD=V("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 hD=V("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 mD=V("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 pD=V("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 B_=V("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 fD=V("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 gD=V("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 xD=V("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 yD=V("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 vD=V("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 _D=V("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 bD=V("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 $_=V("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 U_=V("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 ly=V("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 wD=V("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 jD=V("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 kD=V("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=V("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 ND=V("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 SD=V("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 CD=V("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 to=V("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 MD=V("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 TD=V("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 q_=V("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 Dg=V("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 AD=V("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 ED=V("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 ID=V("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 V_=V("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 PD=V("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 LD=V("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 OD=V("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 H_=V("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 hp=V("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 DD=V("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 RD=V("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 FD=V("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 zD=V("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 BD=V("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 $D=V("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 $l=V("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 UD=V("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 W_=V("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 qD=V("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 VD=V("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 HD=V("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 WD=V("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 G_=V("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 GD=V("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 KD=V("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 ZD=V("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 YD=V("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 XD=V("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 QD=V("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 JD=V("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 eR=V("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 tR=V("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 rR=V("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 sR=V("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 nR=V("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 aR=V("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 iR=V("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 oR=V("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 lR=V("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 cR=V("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 dR=V("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 uR=V("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 hR=V("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 mR=V("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=V("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 pR=V("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 fR=V("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 gR=V("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 xR=V("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 yR=V("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 vR=V("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 _R=V("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 bR=V("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 wR=V("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 jR=V("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 kR=V("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=V("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 NR=V("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 SR=V("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 CR=V("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 MR=V("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 TR=V("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 AR=V("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 Ej=V("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 ER=V("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 IR=V("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 Rg=V("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 K_=V("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 Z_=V("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 PR=V("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 LR=V("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 OR=V("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 DR=V("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 RR=V("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 FR=V("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 zR=V("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 BR=V("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 $R=V("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 UR=V("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 qR=V("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 VR=V("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 HR=V("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 WR=V("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 GR=V("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 KR=V("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 NS=V("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 ZR=V("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 YR=V("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 XR=V("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 QR=V("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 JR=V("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 eF=V("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 tF=V("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 Y_=V("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 rF=V("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 sF=V("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 nF=V("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 aF=V("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 iF=V("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 oF=V("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 lF=V("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 cF=V("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 dF=V("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 uF=V("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 q1=V("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 hF=V("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 mF=V("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 pF=V("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 fF=V("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 gF=V("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 xF=V("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 yF=V("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 vF=V("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 _F=V("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 bF=V("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 aA=V("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 wF=V("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 Tf=V("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 jF=V("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 kF=V("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 NF=V("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 SS=V("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 SF=V("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 CF=V("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 X_=V("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 MF=V("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 TF=V("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 AF=V("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 iA=V("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 EF=V("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 IF=V("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 PF=V("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 LF=V("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 rh=V("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 OF=V("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 DF=V("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 RF=V("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 FF=V("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 zF=V("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 pi=V("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 Ij=V("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 BF=V("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 $F=V("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 UF=V("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 qF=V("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 VF=V("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=V("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 HF=V("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 WF=V("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 GF=V("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 KF=V("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 ZF=V("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 YF=V("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 oA=V("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 XF=V("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 Af=V("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 QF=V("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 JF=V("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 ez=V("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 tz=V("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 rz=V("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 sz=V("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 Pj=V("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 nz=V("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 az=V("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 iz=V("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 oz=V("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 lz=V("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 jn=V("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 cz=V("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 Fg=V("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 dz=V("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 uz=V("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 hz=V("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 mz=V("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 pz=V("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 Q_=V("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 fz=V("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 gz=V("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 xz=V("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 yz=V("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 vz=V("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 _z=V("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 bz=V("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 wz=V("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 jz=V("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 kz=V("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 Nz=V("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 Sz=V("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 Cz=V("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 J_=V("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 eb=V("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 Mz=V("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 Tz=V("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 Az=V("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 tb=V("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 rb=V("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 sb=V("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 Ez=V("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 nb=V("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 Iz=V("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 wc=V("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 Pz=V("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 ab=V("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 Lz=V("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 Oz=V("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 ib=V("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 ob=V("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 Dz=V("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 lb=V("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 cb=V("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 db=V("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 Rz=V("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 Fz=V("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=V("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 zz=V("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 Bz=V("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 gd=V("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 $z=V("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 Uz=V("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 Sc=V("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 Zi=V("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 zg=V("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 qz=V("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 Vz=V("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 Hz=V("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 Wz=V("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 Gz=V("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 Kz=V("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 Zz=V("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=V("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 Yz=V("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 Xz=V("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 Qz=V("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 Jz=V("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 e7=V("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 vl=V("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 ub=V("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 hb=V("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 mb=V("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 pb=V("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 fb=V("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 gb=V("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 xb=V("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 yb=V("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 ii=V("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 Ki=V("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 vb=V("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 _b=V("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 bb=V("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 wb=V("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 t7=V("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 jb=V("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 r7=V("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 s7=V("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 n7=V("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 a7=V("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 i7=V("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 o7=V("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 l7=V("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 kb=V("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 Zx=V("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 Nb=V("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 c7=V("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 Sb=V("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 Cb=V("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 Mb=V("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 Tb=V("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 ap=V("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 Ab=V("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 Eb=V("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 Ib=V("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 d7=V("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 Pb=V("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 Lb=V("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 Ob=V("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 jc=V("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 sh=V("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 u7=V("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 h7=V("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 m7=V("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 lA=V("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 p7=V("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 cA=V("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 f7=V("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 g7=V("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 Db=V("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 Rb=V("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 x7=V("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 y7=V("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 v7=V("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 _7=V("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 b7=V("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 w7=V("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 j7=V("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 k7=V("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 N7=V("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 S7=V("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 C7=V("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 M7=V("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 T7=V("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 A7=V("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 E7=V("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 I7=V("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 P7=V("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 L7=V("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 O7=V("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 Ra=V("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 D7=V("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 R7=V("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 Fb=V("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 F7=V("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 z7=V("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 B7=V("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 $7=V("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 U7=V("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 q7=V("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 V7=V("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 H7=V("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 W7=V("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 G7=V("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 K7=V("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 Z7=V("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 zb=V("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 Y7=V("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 X7=V("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 ry=V("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 Q7=V("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 Bb=V("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 Lj=V("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 J7=V("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 e9=V("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 Oj=V("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 t9=V("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 r9=V("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 $b=V("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 Ub=V("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 s9=V("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 n9=V("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 a9=V("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 i9=V("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 o9=V("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 l9=V("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 c9=V("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 d9=V("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 u9=V("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 qb=V("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 h9=V("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 m9=V("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 p9=V("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 f9=V("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 g9=V("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 x9=V("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 y9=V("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 v9=V("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 _9=V("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 b9=V("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 Mo=V("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 w9=V("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 j9=V("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 k9=V("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 N9=V("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 S9=V("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 C9=V("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 M9=V("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 T9=V("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 A9=V("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 E9=V("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 I9=V("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 P9=V("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 mp=V("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 L9=V("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 O9=V("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 D9=V("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 R9=V("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 V1=V("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 F9=V("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 z9=V("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 B9=V("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 $9=V("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 U9=V("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 q9=V("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 V9=V("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 H9=V("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 W9=V("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 G9=V("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 K9=V("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 Z9=V("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 Vb=V("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 Y9=V("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 X9=V("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 Q9=V("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 J9=V("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 eB=V("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 tB=V("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 rB=V("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 sB=V("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 nB=V("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 aB=V("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 iB=V("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 oB=V("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 lB=V("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 cB=V("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 dB=V("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 uB=V("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 hB=V("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 mB=V("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 pB=V("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=V("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 fB=V("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 gB=V("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 Dj=V("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 xB=V("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 $i=V("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 yB=V("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 vB=V("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 _B=V("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 bB=V("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 wB=V("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 jB=V("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 kB=V("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 NB=V("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 SB=V("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 CB=V("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 MB=V("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 TB=V("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 Hb=V("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 AB=V("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 EB=V("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 IB=V("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 CS=V("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 Ng=V("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 xf=V("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 PB=V("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 LB=V("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 OB=V("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 DB=V("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 RB=V("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 FB=V("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 zB=V("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 Sn=V("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 BB=V("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 Ef=V("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 mo=V("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=V("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 $B=V("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 UB=V("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 qB=V("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 VB=V("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 HB=V("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 WB=V("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 GB=V("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 KB=V("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 ZB=V("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 YB=V("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 Wb=V("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 XB=V("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 QB=V("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 JB=V("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 Gb=V("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 Kb=V("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 Zb=V("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 Yb=V("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 e$=V("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 t$=V("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 r$=V("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 s$=V("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 n$=V("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 Xb=V("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 a$=V("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 i$=V("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 o$=V("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 l$=V("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 H1=V("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 c$=V("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 d$=V("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 u$=V("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 h$=V("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 m$=V("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 p$=V("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 f$=V("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 g$=V("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 x$=V("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 y$=V("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 v$=V("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 Qb=V("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 Jb=V("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 _$=V("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 b$=V("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 w$=V("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 j$=V("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 k$=V("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 N$=V("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 S$=V("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 W1=V("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 C$=V("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 M$=V("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 T$=V("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 ga=V("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 A$=V("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 E$=V("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 I$=V("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 P$=V("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 L$=V("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 O$=V("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 D$=V("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 R$=V("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 F$=V("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 z$=V("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 B$=V("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 MS=V("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 $$=V("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 Id=V("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 U$=V("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 G1=V("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$=V("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 V$=V("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 H$=V("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 W$=V("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 G$=V("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 K$=V("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 Z$=V("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 Y$=V("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=V("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 X$=V("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 gm=V("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 Q$=V("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 J$=V("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 eU=V("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 Rj=V("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 tU=V("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 rU=V("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 sU=V("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 nU=V("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 aU=V("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 wf=V("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 iU=V("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 oU=V("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 lU=V("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 cU=V("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 dU=V("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 uU=V("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 hU=V("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 mU=V("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 pU=V("FolderCode",[["path",{d:"M10 10.5 8 13l2 2.5",key:"m4t9c1"}],["path",{d:"m14 10.5 2 2.5-2 2.5",key:"14w2eb"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2z",key:"1u1bxd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e2=V("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 fU=V("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 gU=V("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 xU=V("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 yU=V("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 vU=V("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 _U=V("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 bU=V("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 wU=V("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 jU=V("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 kU=V("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 NU=V("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 If=V("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 SU=V("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 t2=V("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 CU=V("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 MU=V("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 TU=V("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 AU=V("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 EU=V("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 IU=V("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 PU=V("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 LU=V("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 OU=V("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 DU=V("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 RU=V("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 FU=V("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 zU=V("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 BU=V("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 $U=V("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 UU=V("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 qU=V("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 VU=V("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 HU=V("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 WU=V("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 GU=V("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 KU=V("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 ZU=V("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 YU=V("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 XU=V("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 QU=V("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 JU=V("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 eq=V("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 tq=V("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 Fj=V("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 oo=V("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 rq=V("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 sq=V("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 r2=V("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 nq=V("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 aq=V("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 iq=V("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 oq=V("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 lq=V("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 cq=V("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 dq=V("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 uq=V("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 hq=V("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 mq=V("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 pq=V("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 fq=V("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 gq=V("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 xq=V("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 yq=V("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 vq=V("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 _q=V("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=V("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 bq=V("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 wq=V("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 K1=V("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 jq=V("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 kq=V("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 s2=V("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 Nq=V("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 n2=V("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 sm=V("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 Sq=V("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 Bg=V("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 Cq=V("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 Mq=V("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 Tq=V("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 Aq=V("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 Eq=V("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 Iq=V("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 Pq=V("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 a2=V("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 Lq=V("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 Oq=V("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 Dq=V("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 Rq=V("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 Fq=V("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 zq=V("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 dA=V("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 Bq=V("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 TS=V("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 $q=V("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 Uq=V("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 uA=V("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 hA=V("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 qq=V("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 Vq=V("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 Hq=V("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 Wq=V("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 Gq=V("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 Kq=V("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 Zq=V("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 Yq=V("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 Xq=V("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 Qq=V("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 Jq=V("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 eV=V("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=V("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 tV=V("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 rV=V("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 sV=V("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 AS=V("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 nV=V("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 aV=V("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 iV=V("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 oV=V("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 lV=V("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 cV=V("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 dV=V("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 sa=V("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 i2=V("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 o2=V("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 uV=V("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 hV=V("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 mV=V("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 pV=V("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 fV=V("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 Z1=V("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 gV=V("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 xV=V("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 El=V("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 yV=V("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 vV=V("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 _V=V("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 l2=V("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 c2=V("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 bV=V("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 wV=V("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 jV=V("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 kV=V("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=V("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 ES=V("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 NV=V("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 SV=V("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 CV=V("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 MV=V("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=V("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 zj=V("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 TV=V("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 xm=V("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 AV=V("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 EV=V("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 IV=V("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 PV=V("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 LV=V("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 OV=V("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 DV=V("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 RV=V("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 FV=V("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 zV=V("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 BV=V("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 $V=V("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 UV=V("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 d2=V("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 qV=V("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 VV=V("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 HV=V("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 WV=V("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 GV=V("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 KV=V("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 ZV=V("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 Bj=V("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 pp=V("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 YV=V("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 XV=V("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 QV=V("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 $j=V("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 JV=V("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 eH=V("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 tH=V("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 rH=V("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 sH=V("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 IS=V("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 PS=V("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 nH=V("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 aH=V("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=V("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 iH=V("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 ym=V("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 zo=V("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 vm=V("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 oH=V("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 lH=V("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 cH=V("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 dH=V("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 uH=V("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 hH=V("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 mH=V("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 LS=V("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 pH=V("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 fH=V("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 gH=V("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 xH=V("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 yH=V("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 vH=V("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 _H=V("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 fp=V("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 Vr=V("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 bH=V("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 wH=V("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 jH=V("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 kH=V("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 mA=V("Locate",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u2=V("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 NH=V("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 h2=V("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 nh=V("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 OS=V("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 DS=V("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 SH=V("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 CH=V("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 MH=V("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 TH=V("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 AH=V("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 EH=V("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 IH=V("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 PH=V("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 LH=V("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 OH=V("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 DH=V("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 pA=V("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 Nn=V("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 RH=V("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 FH=V("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 zH=V("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 BH=V("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 $H=V("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 UH=V("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 qH=V("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 VH=V("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 HH=V("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 WH=V("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 GH=V("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 KH=V("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 po=V("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 ZH=V("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 YH=V("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 XH=V("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 QH=V("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 JH=V("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 py=V("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 eW=V("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 Pf=V("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 tW=V("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 rW=V("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 fA=V("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 sW=V("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 nW=V("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 aW=V("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 RS=V("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 iW=V("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 oW=V("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 lW=V("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 gA=V("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 cW=V("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 dW=V("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 uW=V("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 ql=V("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 hW=V("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 mW=V("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 pW=V("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 fW=V("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 xA=V("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 gW=V("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 xW=V("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 yW=V("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 vW=V("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 yA=V("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 _W=V("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 bW=V("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 wW=V("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 jW=V("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 kW=V("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 Bo=V("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 NW=V("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 SW=V("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 m2=V("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 vA=V("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 CW=V("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 MW=V("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 TW=V("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 AW=V("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 EW=V("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 IW=V("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 PW=V("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 LW=V("Minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y1=V("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 OW=V("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 DW=V("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 RW=V("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 FW=V("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 zW=V("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 BW=V("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 $W=V("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 UW=V("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 qW=V("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 VW=V("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 HW=V("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 WW=V("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 Uj=V("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 GW=V("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 KW=V("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 ZW=V("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 YW=V("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 XW=V("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 QW=V("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 JW=V("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 X1=V("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 eG=V("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 tG=V("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 p2=V("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 rG=V("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 sG=V("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 nG=V("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 aG=V("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 iG=V("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 oG=V("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 lG=V("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 cG=V("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 dG=V("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 uG=V("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 hG=V("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 mG=V("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 pG=V("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 fG=V("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 gG=V("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 xG=V("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 yG=V("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 vG=V("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 _G=V("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 bG=V("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 _A=V("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 wG=V("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fy=V("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 jG=V("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 kG=V("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 NG=V("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 SG=V("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 CG=V("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 MG=V("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 TG=V("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 AG=V("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 EG=V("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 f2=V("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 IG=V("OctagonMinus",[["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g2=V("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 x2=V("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 PG=V("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 LG=V("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 OG=V("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 DG=V("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 RG=V("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 FG=V("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 zG=V("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 BG=V("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 $G=V("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 UG=V("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 qG=V("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 VG=V("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 Vl=V("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 HG=V("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 WG=V("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 y2=V("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 GG=V("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 Wc=V("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 KG=V("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 v2=V("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 ZG=V("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 YG=V("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 _2=V("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 b2=V("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 w2=V("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 j2=V("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 XG=V("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 k2=V("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 QG=V("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 JG=V("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 eK=V("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 N2=V("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 tK=V("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 rK=V("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 sK=V("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 nK=V("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=V("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 qj=V("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 aK=V("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 iK=V("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 Gc=V("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 _m=V("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 oK=V("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 lK=V("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=V("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 cK=V("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 Vj=V("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=V("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 dK=V("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 uK=V("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 hK=V("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=V("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 mK=V("Pentagon",[["path",{d:"M10.83 2.38a2 2 0 0 1 2.34 0l8 5.74a2 2 0 0 1 .73 2.25l-3.04 9.26a2 2 0 0 1-1.9 1.37H7.04a2 2 0 0 1-1.9-1.37L2.1 10.37a2 2 0 0 1 .73-2.25z",key:"2hea0t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FS=V("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 pK=V("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 fK=V("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 gK=V("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 xK=V("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 yK=V("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 vK=V("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 _K=V("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 bK=V("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 Pi=V("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 wK=V("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 jK=V("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 kK=V("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 NK=V("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 SK=V("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 CK=V("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 MK=V("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 TK=V("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 AK=V("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 EK=V("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 IK=V("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 bA=V("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 Q1=V("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 PK=V("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 LK=V("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 OK=V("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 DK=V("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 RK=V("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 Hl=V("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 FK=V("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 S2=V("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 wA=V("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 vs=V("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 zK=V("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 BK=V("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 $K=V("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 UK=V("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 qK=V("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 VK=V("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 HK=V("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 WK=V("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 GK=V("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 KK=V("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=V("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 ZK=V("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 jA=V("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 YK=V("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 XK=V("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 QK=V("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 JK=V("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 Hj=V("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 kA=V("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 eZ=V("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 tZ=V("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 rZ=V("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 sZ=V("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=V("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 aZ=V("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 Wj=V("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 iZ=V("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 oZ=V("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 lZ=V("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 cZ=V("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 dZ=V("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 uZ=V("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 hZ=V("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 mZ=V("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 pZ=V("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=V("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 gZ=V("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 xZ=V("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 yZ=V("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 vZ=V("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 C2=V("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 _Z=V("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 bZ=V("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 wZ=V("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 jZ=V("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 kZ=V("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 zS=V("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 NZ=V("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 SZ=V("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 CZ=V("RefreshCwOff",[["path",{d:"M21 8L18.74 5.74A9.75 9.75 0 0 0 12 3C11 3 10.03 3.16 9.13 3.47",key:"1krf6h"}],["path",{d:"M8 16H3v5",key:"1cv678"}],["path",{d:"M3 12C3 9.51 4 7.26 5.64 5.64",key:"ruvoct"}],["path",{d:"m3 16 2.26 2.26A9.75 9.75 0 0 0 12 21c2.49 0 4.74-1 6.36-2.64",key:"19q130"}],["path",{d:"M21 12c0 1-.16 1.97-.47 2.87",key:"4w8emr"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Go=V("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 MZ=V("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 TZ=V("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 AZ=V("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 EZ=V("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 IZ=V("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 NA=V("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 PZ=V("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 LZ=V("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 OZ=V("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 SA=V("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 DZ=V("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 RZ=V("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 $g=V("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 FZ=V("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 zZ=V("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 M2=V("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 BZ=V("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 BS=V("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 $Z=V("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 CA=V("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 UZ=V("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 qZ=V("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 VZ=V("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 T2=V("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 A2=V("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 HZ=V("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 WZ=V("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 GZ=V("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 KZ=V("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 ZZ=V("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 YZ=V("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 XZ=V("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 QZ=V("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 JZ=V("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 eY=V("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 tY=V("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 Lf=V("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 E2=V("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 rY=V("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 sY=V("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=V("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 aY=V("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 iY=V("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 oY=V("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 lY=V("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 cY=V("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 dY=V("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 uY=V("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 hY=V("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 mY=V("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 pY=V("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=V("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 gY=V("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 xY=V("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 yY=V("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 vY=V("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 _Y=V("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 bY=V("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 wY=V("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 ua=V("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 jY=V("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 I2=V("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 kY=V("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 ro=V("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 NY=V("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 SY=V("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 CY=V("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 MY=V("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 TY=V("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 AY=V("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 EY=V("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=V("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 IY=V("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 Cc=V("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 MA=V("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 PY=V("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 LY=V("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 OY=V("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 DY=V("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 TA=V("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 RY=V("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 FY=V("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 zY=V("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 BY=V("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 $Y=V("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 UY=V("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 P2=V("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 bm=V("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 qY=V("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 VY=V("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 HY=V("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 Ug=V("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 WY=V("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 Ih=V("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 GY=V("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 KY=V("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 ZY=V("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 YY=V("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 XY=V("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 QY=V("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 JY=V("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 eX=V("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 tX=V("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 rX=V("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 sX=V("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=V("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 aX=V("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 iX=V("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 oX=V("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 lX=V("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 cX=V("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 dX=V("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 uX=V("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 hX=V("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 mX=V("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 AA=V("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 L2=V("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 pX=V("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=V("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=V("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 gX=V("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 xX=V("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 yX=V("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=V("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 vX=V("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 _X=V("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 bX=V("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 wX=V("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 jX=V("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 Bn=V("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 kX=V("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 NX=V("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 SX=V("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 CX=V("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 MX=V("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 TX=V("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 AX=V("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 EX=V("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 O2=V("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 D2=V("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 R2=V("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 F2=V("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 z2=V("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 B2=V("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 $2=V("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 U2=V("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 q2=V("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 V2=V("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 H2=V("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 W2=V("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 G2=V("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 K2=V("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 Z2=V("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 gg=V("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=V("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 Y2=V("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 X2=V("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 Q2=V("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 J2=V("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 ew=V("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 tw=V("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 IX=V("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 PX=V("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 rw=V("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 sw=V("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 nw=V("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 aw=V("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 iw=V("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 ow=V("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 lw=V("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 cw=V("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 dw=V("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 uw=V("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 hw=V("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 mw=V("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 pw=V("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 fw=V("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 gw=V("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 vc=V("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 xw=V("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 yw=V("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 vw=V("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 _w=V("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 bw=V("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 ww=V("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 LX=V("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 jw=V("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 kw=V("SquareSigma",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M16 8.9V7H8l4 5-4 5h8v-1.9",key:"9nih0i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nw=V("SquareSlash",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sw=V("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 Cw=V("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 OX=V("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 DX=V("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 Mw=V("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 Tw=V("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 Aw=V("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 Ew=V("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 qg=V("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 RX=V("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 FX=V("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 zX=V("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 BX=V("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 $X=V("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 Mn=V("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 UX=V("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 qX=V("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 VX=V("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 HX=V("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 WX=V("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 GX=V("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 KX=V("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 ZX=V("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 YX=V("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 XX=V("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 QX=V("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 JX=V("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 eQ=V("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 tQ=V("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 J1=V("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 rQ=V("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 sQ=V("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=V("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 aQ=V("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 iQ=V("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 oQ=V("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 lQ=V("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 cQ=V("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 dQ=V("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 $S=V("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 uQ=V("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 hQ=V("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 mQ=V("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 pQ=V("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=V("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 gQ=V("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 xQ=V("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 yQ=V("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 vQ=V("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 _Q=V("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 Vg=V("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 bQ=V("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 wQ=V("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 jQ=V("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 kQ=V("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 NQ=V("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 SQ=V("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 CQ=V("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=V("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 MQ=V("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 TQ=V("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 AQ=V("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 EQ=V("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 Iw=V("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 IQ=V("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 PQ=V("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 LQ=V("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 OQ=V("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 DQ=V("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 RQ=V("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 Pw=V("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 FQ=V("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 zQ=V("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 BQ=V("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 $Q=V("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 UQ=V("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 EA=V("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 xd=V("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 qQ=V("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 VQ=V("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 HQ=V("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 WQ=V("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 GQ=V("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 KQ=V("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 IA=V("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 ZQ=V("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 YQ=V("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 XQ=V("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 QQ=V("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 JQ=V("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 eJ=V("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 tJ=V("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 rJ=V("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 sJ=V("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=V("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 aJ=V("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 iJ=V("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 oJ=V("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 lJ=V("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 cJ=V("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 dJ=V("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 uJ=V("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 hJ=V("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 mJ=V("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 Lw=V("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 Bs=V("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 pJ=V("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=V("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 Ow=V("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 ev=V("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 gJ=V("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 xJ=V("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 Gj=V("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 yJ=V("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 bu=V("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 Zu=V("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 vJ=V("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 _J=V("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 lo=V("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 PA=V("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 bJ=V("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 wJ=V("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 Dw=V("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 jJ=V("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 kJ=V("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 NJ=V("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 SJ=V("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 CJ=V("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 MJ=V("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 TJ=V("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 AJ=V("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 EJ=V("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 IJ=V("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 US=V("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 PJ=V("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 LJ=V("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 OJ=V("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 Rw=V("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 DJ=V("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 LA=V("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 RJ=V("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 so=V("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 FJ=V("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 Kj=V("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 OA=V("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 zJ=V("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 BJ=V("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 wu=V("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 Fw=V("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 zw=V("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 Bw=V("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 $J=V("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 $w=V("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 UJ=V("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 Uw=V("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 qw=V("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 qJ=V("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 VJ=V("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 oc=V("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 Vw=V("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 qs=V("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 Hw=V("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 Ww=V("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 HJ=V("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 DA=V("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 WJ=V("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 GJ=V("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 KJ=V("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 ZJ=V("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 YJ=V("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 XJ=V("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 Ta=V("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 QJ=V("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 JJ=V("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 eee=V("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 tee=V("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 ree=V("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 see=V("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=V("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 aee=V("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 iee=V("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 oee=V("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 lee=V("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 Gw=V("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 cee=V("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 dee=V("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 Kw=V("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 uee=V("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 hee=V("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 mee=V("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 pee=V("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=V("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 gee=V("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 xee=V("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 yee=V("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 vee=V("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 _ee=V("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 bee=V("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 wee=V("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 jee=V("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 kee=V("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 Nee=V("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 See=V("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 Cee=V("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 Mee=V("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 Tee=V("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 Aee=V("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 Eee=V("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 Iee=V("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 Pee=V("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 Lee=V("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 Oee=V("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=V("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 en=V("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 Dee=V("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 Ree=V("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 Hg=V("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 qS=V("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 VS=V("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 dQe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:u8,AArrowUp:h8,ALargeSmall:m8,Accessibility:p8,Activity:Og,AirVent:f8,Airplay:g8,AlarmClock:y8,AlarmClockCheck:R_,AlarmClockMinus:F_,AlarmClockOff:x8,AlarmClockPlus:z_,AlarmSmoke:v8,Album:_8,AlignCenter:wS,AlignCenterHorizontal:b8,AlignCenterVertical:w8,AlignEndHorizontal:j8,AlignEndVertical:k8,AlignHorizontalDistributeCenter:N8,AlignHorizontalDistributeEnd:S8,AlignHorizontalDistributeStart:C8,AlignHorizontalJustifyCenter:M8,AlignHorizontalJustifyEnd:T8,AlignHorizontalJustifyStart:A8,AlignHorizontalSpaceAround:E8,AlignHorizontalSpaceBetween:I8,AlignJustify:P8,AlignLeft:jS,AlignRight:kS,AlignStartHorizontal:L8,AlignStartVertical:O8,AlignVerticalDistributeCenter:D8,AlignVerticalDistributeEnd:R8,AlignVerticalDistributeStart:F8,AlignVerticalJustifyCenter:z8,AlignVerticalJustifyEnd:B8,AlignVerticalJustifyStart:$8,AlignVerticalSpaceAround:U8,AlignVerticalSpaceBetween:q8,Ambulance:V8,Ampersand:H8,Ampersands:W8,Amphora:G8,Anchor:K8,Angry:Z8,Annoyed:Y8,Antenna:X8,Anvil:Q8,Aperture:J8,AppWindow:sA,AppWindowMac:eD,Apple:tD,Archive:nA,ArchiveRestore:rD,ArchiveX:sD,Armchair:nD,ArrowBigDown:iD,ArrowBigDownDash:aD,ArrowBigLeft:lD,ArrowBigLeftDash:oD,ArrowBigRight:dD,ArrowBigRightDash:cD,ArrowBigUp:hD,ArrowBigUpDash:uD,ArrowDown:ly,ArrowDown01:mD,ArrowDown10:pD,ArrowDownAZ:B_,ArrowDownFromLine:fD,ArrowDownLeft:gD,ArrowDownNarrowWide:xD,ArrowDownRight:yD,ArrowDownToDot:vD,ArrowDownToLine:_D,ArrowDownUp:bD,ArrowDownWideNarrow:$_,ArrowDownZA:U_,ArrowLeft:wi,ArrowLeftFromLine:wD,ArrowLeftRight:jD,ArrowLeftToLine:kD,ArrowRight:to,ArrowRightFromLine:ND,ArrowRightLeft:SD,ArrowRightToLine:CD,ArrowUp:hp,ArrowUp01:MD,ArrowUp10:TD,ArrowUpAZ:q_,ArrowUpDown:Dg,ArrowUpFromDot:AD,ArrowUpFromLine:ED,ArrowUpLeft:ID,ArrowUpNarrowWide:V_,ArrowUpRight:PD,ArrowUpToLine:LD,ArrowUpWideNarrow:OD,ArrowUpZA:H_,ArrowsUpFromLine:DD,Asterisk:RD,AtSign:FD,Atom:zD,AudioLines:BD,AudioWaveform:$D,Award:$l,Axe:UD,Axis3d:W_,Baby:qD,Backpack:VD,Badge:iR,BadgeAlert:HD,BadgeCent:WD,BadgeCheck:G_,BadgeDollarSign:GD,BadgeEuro:KD,BadgeHelp:ZD,BadgeIndianRupee:YD,BadgeInfo:XD,BadgeJapaneseYen:QD,BadgeMinus:JD,BadgePercent:eR,BadgePlus:tR,BadgePoundSterling:rR,BadgeRussianRuble:sR,BadgeSwissFranc:nR,BadgeX:aR,BaggageClaim:oR,Ban:lR,Banana:cR,Bandage:dR,Banknote:uR,Barcode:hR,Baseline:mR,Bath:$1,Battery:vR,BatteryCharging:pR,BatteryFull:fR,BatteryLow:gR,BatteryMedium:xR,BatteryWarning:yR,Beaker:_R,Bean:wR,BeanOff:bR,Bed:U1,BedDouble:jR,BedSingle:kR,Beef:NR,Beer:CR,BeerOff:SR,Bell:Rg,BellDot:MR,BellElectric:TR,BellMinus:AR,BellOff:Ej,BellPlus:ER,BellRing:IR,BetweenHorizontalEnd:K_,BetweenHorizontalStart:Z_,BetweenVerticalEnd:PR,BetweenVerticalStart:LR,BicepsFlexed:OR,Bike:DR,Binary:RR,Binoculars:FR,Biohazard:zR,Bird:BR,Bitcoin:$R,Blend:UR,Blinds:qR,Blocks:VR,Bluetooth:KR,BluetoothConnected:HR,BluetoothOff:WR,BluetoothSearching:GR,Bold:NS,Bolt:ZR,Bomb:YR,Bone:XR,Book:vF,BookA:QR,BookAudio:JR,BookCheck:eF,BookCopy:tF,BookDashed:Y_,BookDown:rF,BookHeadphones:sF,BookHeart:nF,BookImage:aF,BookKey:iF,BookLock:oF,BookMarked:lF,BookMinus:cF,BookOpen:q1,BookOpenCheck:dF,BookOpenText:uF,BookPlus:hF,BookText:mF,BookType:pF,BookUp:gF,BookUp2:fF,BookUser:xF,BookX:yF,Bookmark:Tf,BookmarkCheck:_F,BookmarkMinus:bF,BookmarkPlus:aA,BookmarkX:wF,BoomBox:jF,Bot:SS,BotMessageSquare:kF,BotOff:NF,Box:SF,Boxes:CF,Braces:X_,Brackets:MF,Brain:iA,BrainCircuit:TF,BrainCog:AF,BrickWall:EF,Briefcase:rh,BriefcaseBusiness:IF,BriefcaseConveyorBelt:PF,BriefcaseMedical:LF,BringToFront:OF,Brush:DF,Bug:zF,BugOff:RF,BugPlay:FF,Building:Ij,Building2:pi,Bus:$F,BusFront:BF,Cable:qF,CableCar:UF,Cake:fm,CakeSlice:VF,Calculator:HF,Calendar:jn,Calendar1:WF,CalendarArrowDown:GF,CalendarArrowUp:KF,CalendarCheck:YF,CalendarCheck2:ZF,CalendarClock:oA,CalendarCog:XF,CalendarDays:Af,CalendarFold:QF,CalendarHeart:JF,CalendarMinus:tz,CalendarMinus2:ez,CalendarOff:rz,CalendarPlus:Pj,CalendarPlus2:sz,CalendarRange:nz,CalendarSearch:az,CalendarSync:iz,CalendarX:lz,CalendarX2:oz,Camera:Fg,CameraOff:cz,Candy:hz,CandyCane:dz,CandyOff:uz,Cannabis:mz,Captions:Q_,CaptionsOff:pz,Car:xz,CarFront:fz,CarTaxiFront:gz,Caravan:yz,Carrot:vz,CaseLower:_z,CaseSensitive:bz,CaseUpper:wz,CassetteTape:jz,Cast:kz,Castle:Nz,Cat:Sz,Cctv:Cz,ChartArea:J_,ChartBar:tb,ChartBarBig:eb,ChartBarDecreasing:Mz,ChartBarIncreasing:Tz,ChartBarStacked:Az,ChartCandlestick:rb,ChartColumn:wc,ChartColumnBig:sb,ChartColumnDecreasing:Ez,ChartColumnIncreasing:nb,ChartColumnStacked:Iz,ChartGantt:Pz,ChartLine:ab,ChartNetwork:Lz,ChartNoAxesColumn:ob,ChartNoAxesColumnDecreasing:Oz,ChartNoAxesColumnIncreasing:ib,ChartNoAxesCombined:Dz,ChartNoAxesGantt:lb,ChartPie:cb,ChartScatter:db,ChartSpline:Rz,Check:fi,CheckCheck:Fz,ChefHat:zz,Cherry:Bz,ChevronDown:gd,ChevronFirst:$z,ChevronLast:Uz,ChevronLeft:Sc,ChevronRight:Zi,ChevronUp:zg,ChevronsDown:Vz,ChevronsDownUp:qz,ChevronsLeft:Gz,ChevronsLeftRight:Wz,ChevronsLeftRightEllipsis:Hz,ChevronsRight:Zz,ChevronsRightLeft:Kz,ChevronsUp:Yz,ChevronsUpDown:cy,Chrome:Xz,Church:Qz,Cigarette:e7,CigaretteOff:Jz,Circle:sh,CircleAlert:vl,CircleArrowDown:ub,CircleArrowLeft:hb,CircleArrowOutDownLeft:mb,CircleArrowOutDownRight:pb,CircleArrowOutUpLeft:fb,CircleArrowOutUpRight:gb,CircleArrowRight:xb,CircleArrowUp:yb,CircleCheck:Ki,CircleCheckBig:ii,CircleChevronDown:vb,CircleChevronLeft:_b,CircleChevronRight:bb,CircleChevronUp:wb,CircleDashed:t7,CircleDivide:jb,CircleDollarSign:r7,CircleDot:n7,CircleDotDashed:s7,CircleEllipsis:a7,CircleEqual:i7,CircleFadingArrowUp:o7,CircleFadingPlus:l7,CircleGauge:kb,CircleHelp:Zx,CircleMinus:Nb,CircleOff:c7,CircleParking:Cb,CircleParkingOff:Sb,CirclePause:Mb,CirclePercent:Tb,CirclePlay:ap,CirclePlus:Ab,CirclePower:Eb,CircleSlash:d7,CircleSlash2:Ib,CircleStop:Pb,CircleUser:Ob,CircleUserRound:Lb,CircleX:jc,CircuitBoard:u7,Citrus:h7,Clapperboard:m7,Clipboard:_7,ClipboardCheck:lA,ClipboardCopy:p7,ClipboardList:cA,ClipboardMinus:f7,ClipboardPaste:g7,ClipboardPen:Rb,ClipboardPenLine:Db,ClipboardPlus:x7,ClipboardType:y7,ClipboardX:v7,Clock:Ra,Clock1:b7,Clock10:w7,Clock11:j7,Clock12:k7,Clock2:N7,Clock3:S7,Clock4:C7,Clock5:M7,Clock6:T7,Clock7:A7,Clock8:E7,Clock9:I7,ClockAlert:P7,ClockArrowDown:L7,ClockArrowUp:O7,Cloud:Y7,CloudAlert:D7,CloudCog:R7,CloudDownload:Fb,CloudDrizzle:F7,CloudFog:z7,CloudHail:B7,CloudLightning:$7,CloudMoon:q7,CloudMoonRain:U7,CloudOff:V7,CloudRain:W7,CloudRainWind:H7,CloudSnow:G7,CloudSun:Z7,CloudSunRain:K7,CloudUpload:zb,Cloudy:X7,Clover:ry,Club:Q7,Code:Lj,CodeXml:Bb,Codepen:J7,Codesandbox:e9,Coffee:Oj,Cog:t9,Coins:r9,Columns2:$b,Columns3:Ub,Columns4:s9,Combine:n9,Command:a9,Compass:i9,Component:o9,Computer:l9,ConciergeBell:c9,Cone:d9,Construction:u9,Contact:h9,ContactRound:qb,Container:m9,Contrast:p9,Cookie:f9,CookingPot:g9,Copy:Mo,CopyCheck:x9,CopyMinus:y9,CopyPlus:v9,CopySlash:_9,CopyX:b9,Copyleft:w9,Copyright:j9,CornerDownLeft:k9,CornerDownRight:N9,CornerLeftDown:S9,CornerLeftUp:C9,CornerRightDown:M9,CornerRightUp:T9,CornerUpLeft:A9,CornerUpRight:E9,Cpu:I9,CreativeCommons:P9,CreditCard:mp,Croissant:L9,Crop:O9,Cross:D9,Crosshair:R9,Crown:V1,Cuboid:F9,CupSoda:z9,Currency:B9,Cylinder:$9,Dam:U9,Database:H9,DatabaseBackup:q9,DatabaseZap:V9,Delete:W9,Dessert:G9,Diameter:K9,Diamond:X9,DiamondMinus:Z9,DiamondPercent:Vb,DiamondPlus:Y9,Dice1:Q9,Dice2:J9,Dice3:eB,Dice4:tB,Dice5:rB,Dice6:sB,Dices:nB,Diff:aB,Disc:cB,Disc2:iB,Disc3:oB,DiscAlbum:lB,Divide:dB,Dna:hB,DnaOff:uB,Dock:mB,Dog:pB,DollarSign:zd,Donut:fB,DoorClosed:gB,DoorOpen:Dj,Dot:xB,Download:$i,DraftingCompass:yB,Drama:vB,Dribbble:_B,Drill:bB,Droplet:wB,Droplets:jB,Drum:kB,Drumstick:NB,Dumbbell:SB,Ear:MB,EarOff:CB,Earth:Hb,EarthLock:TB,Eclipse:AB,Egg:CS,EggFried:EB,EggOff:IB,Ellipsis:xf,EllipsisVertical:Ng,Equal:OB,EqualApproximately:PB,EqualNot:LB,Eraser:DB,EthernetPort:RB,Euro:FB,Expand:zB,ExternalLink:Sn,Eye:mo,EyeClosed:BB,EyeOff:Ef,Facebook:au,Factory:$B,Fan:UB,FastForward:qB,Feather:VB,Fence:HB,FerrisWheel:WB,Figma:GB,File:MS,FileArchive:KB,FileAudio:YB,FileAudio2:ZB,FileAxis3d:Wb,FileBadge:QB,FileBadge2:XB,FileBox:JB,FileChartColumn:Kb,FileChartColumnIncreasing:Gb,FileChartLine:Zb,FileChartPie:Yb,FileCheck:t$,FileCheck2:e$,FileClock:r$,FileCode:n$,FileCode2:s$,FileCog:Xb,FileDiff:a$,FileDigit:i$,FileDown:o$,FileHeart:l$,FileImage:H1,FileInput:c$,FileJson:u$,FileJson2:d$,FileKey:m$,FileKey2:h$,FileLock:f$,FileLock2:p$,FileMinus:x$,FileMinus2:g$,FileMusic:y$,FileOutput:v$,FilePen:Jb,FilePenLine:Qb,FilePlus:b$,FilePlus2:_$,FileQuestion:w$,FileScan:j$,FileSearch:N$,FileSearch2:k$,FileSliders:S$,FileSpreadsheet:W1,FileStack:C$,FileSymlink:M$,FileTerminal:T$,FileText:ga,FileType:E$,FileType2:A$,FileUp:I$,FileUser:P$,FileVideo:O$,FileVideo2:L$,FileVolume:R$,FileVolume2:D$,FileWarning:F$,FileX:B$,FileX2:z$,Files:$$,Film:Id,Filter:G1,FilterX:U$,Fingerprint:q$,FireExtinguisher:V$,Fish:G$,FishOff:H$,FishSymbol:W$,Flag:dy,FlagOff:K$,FlagTriangleLeft:Z$,FlagTriangleRight:Y$,Flame:gm,FlameKindling:X$,Flashlight:J$,FlashlightOff:Q$,FlaskConical:Rj,FlaskConicalOff:eU,FlaskRound:tU,FlipHorizontal:sU,FlipHorizontal2:rU,FlipVertical:aU,FlipVertical2:nU,Flower:iU,Flower2:wf,Focus:oU,FoldHorizontal:lU,FoldVertical:cU,Folder:DU,FolderArchive:dU,FolderCheck:uU,FolderClock:hU,FolderClosed:mU,FolderCode:pU,FolderCog:e2,FolderDot:fU,FolderDown:gU,FolderGit:yU,FolderGit2:xU,FolderHeart:vU,FolderInput:_U,FolderKanban:bU,FolderKey:wU,FolderLock:jU,FolderMinus:kU,FolderOpen:If,FolderOpenDot:NU,FolderOutput:SU,FolderPen:t2,FolderPlus:CU,FolderRoot:MU,FolderSearch:AU,FolderSearch2:TU,FolderSymlink:EU,FolderSync:IU,FolderTree:PU,FolderUp:LU,FolderX:OU,Folders:RU,Footprints:FU,Forklift:zU,Forward:BU,Frame:$U,Framer:UU,Frown:qU,Fuel:VU,Fullscreen:HU,GalleryHorizontal:GU,GalleryHorizontalEnd:WU,GalleryThumbnails:KU,GalleryVertical:YU,GalleryVerticalEnd:ZU,Gamepad:QU,Gamepad2:XU,Gauge:JU,Gavel:eq,Gem:tq,Ghost:Fj,Gift:oo,GitBranch:sq,GitBranchPlus:rq,GitCommitHorizontal:r2,GitCommitVertical:nq,GitCompare:iq,GitCompareArrows:aq,GitFork:oq,GitGraph:lq,GitMerge:cq,GitPullRequest:fq,GitPullRequestArrow:dq,GitPullRequestClosed:uq,GitPullRequestCreate:mq,GitPullRequestCreateArrow:hq,GitPullRequestDraft:pq,Github:gq,Gitlab:xq,GlassWater:yq,Glasses:vq,Globe:uy,GlobeLock:_q,Goal:bq,Grab:wq,GraduationCap:K1,Grape:jq,Grid2x2:n2,Grid2x2Check:kq,Grid2x2Plus:s2,Grid2x2X:Nq,Grid3x3:sm,Grip:Cq,GripHorizontal:Sq,GripVertical:Bg,Group:Mq,Guitar:Tq,Ham:Aq,Hammer:Eq,Hand:Dq,HandCoins:Iq,HandHeart:Pq,HandHelping:a2,HandMetal:Lq,HandPlatter:Oq,Handshake:Rq,HardDrive:dA,HardDriveDownload:Fq,HardDriveUpload:zq,HardHat:Bq,Hash:TS,Haze:$q,HdmiPort:Uq,Heading:Gq,Heading1:uA,Heading2:hA,Heading3:qq,Heading4:Vq,Heading5:Hq,Heading6:Wq,HeadphoneOff:Kq,Headphones:Zq,Headset:Yq,Heart:bi,HeartCrack:Xq,HeartHandshake:Qq,HeartOff:Jq,HeartPulse:eV,Heater:tV,Hexagon:rV,Highlighter:sV,History:AS,Hop:aV,HopOff:nV,Hospital:iV,Hotel:oV,Hourglass:lV,House:sa,HousePlug:cV,HousePlus:dV,IceCreamBowl:i2,IceCreamCone:o2,IdCard:uV,Image:El,ImageDown:hV,ImageMinus:mV,ImageOff:pV,ImagePlay:fV,ImagePlus:Z1,ImageUp:gV,ImageUpscale:xV,Images:yV,Import:vV,Inbox:_V,IndentDecrease:l2,IndentIncrease:c2,IndianRupee:bV,Infinity:wV,Info:jV,InspectionPanel:kV,Instagram:_u,Italic:ES,IterationCcw:NV,IterationCw:SV,JapaneseYen:CV,Joystick:MV,Kanban:hy,Key:xm,KeyRound:zj,KeySquare:TV,Keyboard:IV,KeyboardMusic:AV,KeyboardOff:EV,Lamp:FV,LampCeiling:PV,LampDesk:LV,LampFloor:OV,LampWallDown:DV,LampWallUp:RV,LandPlot:zV,Landmark:BV,Languages:$V,Laptop:qV,LaptopMinimal:d2,LaptopMinimalCheck:UV,Lasso:HV,LassoSelect:VV,Laugh:WV,Layers:ZV,Layers2:GV,Layers3:KV,LayoutDashboard:Bj,LayoutGrid:pp,LayoutList:YV,LayoutPanelLeft:XV,LayoutPanelTop:QV,LayoutTemplate:$j,Leaf:JV,LeafyGreen:eH,Lectern:tH,LetterText:rH,Library:IS,LibraryBig:sH,LifeBuoy:PS,Ligature:nH,Lightbulb:my,LightbulbOff:aH,Link:zo,Link2:ym,Link2Off:iH,Linkedin:vm,List:fp,ListCheck:oH,ListChecks:lH,ListCollapse:cH,ListEnd:dH,ListFilter:uH,ListMinus:hH,ListMusic:mH,ListOrdered:LS,ListPlus:pH,ListRestart:fH,ListStart:gH,ListTodo:xH,ListTree:yH,ListVideo:vH,ListX:_H,Loader:wH,LoaderCircle:Vr,LoaderPinwheel:bH,Locate:mA,LocateFixed:jH,LocateOff:kH,Lock:nh,LockKeyhole:NH,LockKeyholeOpen:u2,LockOpen:h2,LogIn:OS,LogOut:DS,Logs:SH,Lollipop:CH,Luggage:MH,Magnet:TH,Mail:Nn,MailCheck:AH,MailMinus:EH,MailOpen:IH,MailPlus:PH,MailQuestion:LH,MailSearch:OH,MailWarning:DH,MailX:pA,Mailbox:RH,Mails:FH,Map:YH,MapPin:po,MapPinCheck:BH,MapPinCheckInside:zH,MapPinHouse:$H,MapPinMinus:qH,MapPinMinusInside:UH,MapPinOff:VH,MapPinPlus:WH,MapPinPlusInside:HH,MapPinX:KH,MapPinXInside:GH,MapPinned:ZH,Martini:XH,Maximize:JH,Maximize2:QH,Medal:py,Megaphone:Pf,MegaphoneOff:eW,Meh:tW,MemoryStick:rW,Menu:fA,Merge:sW,MessageCircle:ql,MessageCircleCode:nW,MessageCircleDashed:aW,MessageCircleHeart:RS,MessageCircleMore:iW,MessageCircleOff:oW,MessageCirclePlus:lW,MessageCircleQuestion:gA,MessageCircleReply:cW,MessageCircleWarning:dW,MessageCircleX:uW,MessageSquare:Bo,MessageSquareCode:hW,MessageSquareDashed:mW,MessageSquareDiff:pW,MessageSquareDot:fW,MessageSquareHeart:xA,MessageSquareLock:gW,MessageSquareMore:xW,MessageSquareOff:yW,MessageSquarePlus:vW,MessageSquareQuote:yA,MessageSquareReply:_W,MessageSquareShare:bW,MessageSquareText:wW,MessageSquareWarning:jW,MessageSquareX:kW,MessagesSquare:NW,Mic:vA,MicOff:SW,MicVocal:m2,Microchip:CW,Microscope:MW,Microwave:TW,Milestone:AW,Milk:IW,MilkOff:EW,Minimize:LW,Minimize2:PW,Minus:Y1,Monitor:Uj,MonitorCheck:OW,MonitorCog:DW,MonitorDot:RW,MonitorDown:FW,MonitorOff:zW,MonitorPause:BW,MonitorPlay:$W,MonitorSmartphone:UW,MonitorSpeaker:qW,MonitorStop:VW,MonitorUp:HW,MonitorX:WW,Moon:KW,MoonStar:GW,Mountain:YW,MountainSnow:ZW,Mouse:tG,MouseOff:XW,MousePointer:eG,MousePointer2:QW,MousePointerBan:JW,MousePointerClick:X1,Move:pG,Move3d:p2,MoveDiagonal:sG,MoveDiagonal2:rG,MoveDown:iG,MoveDownLeft:nG,MoveDownRight:aG,MoveHorizontal:oG,MoveLeft:lG,MoveRight:cG,MoveUp:hG,MoveUpLeft:dG,MoveUpRight:uG,MoveVertical:mG,Music:yG,Music2:fG,Music3:gG,Music4:xG,Navigation:_A,Navigation2:_G,Navigation2Off:vG,NavigationOff:bG,Network:wG,Newspaper:fy,Nfc:jG,Notebook:CG,NotebookPen:kG,NotebookTabs:NG,NotebookText:SG,NotepadText:TG,NotepadTextDashed:MG,Nut:EG,NutOff:AG,Octagon:PG,OctagonAlert:f2,OctagonMinus:IG,OctagonPause:g2,OctagonX:x2,Omega:LG,Option:OG,Orbit:DG,Origami:RG,Package:Vl,Package2:FG,PackageCheck:zG,PackageMinus:BG,PackageOpen:$G,PackagePlus:UG,PackageSearch:qG,PackageX:VG,PaintBucket:HG,PaintRoller:WG,Paintbrush:GG,PaintbrushVertical:y2,Palette:Wc,PanelBottom:YG,PanelBottomClose:KG,PanelBottomDashed:v2,PanelBottomOpen:ZG,PanelLeft:j2,PanelLeftClose:_2,PanelLeftDashed:b2,PanelLeftOpen:w2,PanelRight:JG,PanelRightClose:XG,PanelRightDashed:k2,PanelRightOpen:QG,PanelTop:rK,PanelTopClose:eK,PanelTopDashed:N2,PanelTopOpen:tK,PanelsLeftBottom:sK,PanelsRightBottom:nK,PanelsTopLeft:K0,Paperclip:qj,Parentheses:aK,ParkingMeter:iK,PartyPopper:Gc,Pause:_m,PawPrint:oK,PcCase:lK,Pen:Y0,PenLine:Z0,PenOff:cK,PenTool:Vj,Pencil:Ja,PencilLine:dK,PencilOff:uK,PencilRuler:hK,Pentagon:mK,Percent:FS,PersonStanding:pK,PhilippinePeso:fK,Phone:Pi,PhoneCall:gK,PhoneForwarded:xK,PhoneIncoming:yK,PhoneMissed:vK,PhoneOff:_K,PhoneOutgoing:bK,Pi:wK,Piano:jK,Pickaxe:kK,PictureInPicture:SK,PictureInPicture2:NK,PiggyBank:CK,Pilcrow:AK,PilcrowLeft:MK,PilcrowRight:TK,Pill:IK,PillBottle:EK,Pin:Q1,PinOff:bA,Pipette:PK,Pizza:LK,Plane:RK,PlaneLanding:OK,PlaneTakeoff:DK,Play:Hl,Plug:wA,Plug2:FK,PlugZap:S2,Plus:vs,Pocket:BK,PocketKnife:zK,Podcast:$K,Pointer:qK,PointerOff:UK,Popcorn:VK,Popsicle:HK,PoundSterling:WK,Power:KK,PowerOff:GK,Presentation:gy,Printer:jA,PrinterCheck:ZK,Projector:YK,Proportions:XK,Puzzle:QK,Pyramid:JK,QrCode:Hj,Quote:kA,Rabbit:eZ,Radar:tZ,Radiation:rZ,Radical:sZ,Radio:Wj,RadioReceiver:nZ,RadioTower:aZ,Radius:iZ,RailSymbol:oZ,Rainbow:lZ,Rat:cZ,Ratio:dZ,Receipt:vZ,ReceiptCent:uZ,ReceiptEuro:hZ,ReceiptIndianRupee:mZ,ReceiptJapaneseYen:pZ,ReceiptPoundSterling:fZ,ReceiptRussianRuble:gZ,ReceiptSwissFranc:xZ,ReceiptText:yZ,RectangleEllipsis:C2,RectangleHorizontal:_Z,RectangleVertical:bZ,Recycle:wZ,Redo:zS,Redo2:jZ,RedoDot:kZ,RefreshCcw:SZ,RefreshCcwDot:NZ,RefreshCw:Go,RefreshCwOff:CZ,Refrigerator:MZ,Regex:TZ,RemoveFormatting:AZ,Repeat:NA,Repeat1:EZ,Repeat2:IZ,Replace:LZ,ReplaceAll:PZ,Reply:SA,ReplyAll:OZ,Rewind:DZ,Ribbon:RZ,Rocket:$g,RockingChair:FZ,RollerCoaster:zZ,Rotate3d:M2,RotateCcw:BS,RotateCcwSquare:BZ,RotateCw:CA,RotateCwSquare:$Z,Route:qZ,RouteOff:UZ,Router:VZ,Rows2:T2,Rows3:A2,Rows4:HZ,Rss:WZ,Ruler:GZ,RussianRuble:KZ,Sailboat:ZZ,Salad:YZ,Sandwich:XZ,Satellite:JZ,SatelliteDish:QZ,Save:Lf,SaveAll:eY,SaveOff:tY,Scale:rY,Scale3d:E2,Scaling:sY,Scan:uY,ScanBarcode:nY,ScanEye:aY,ScanFace:iY,ScanLine:oY,ScanQrCode:lY,ScanSearch:cY,ScanText:dY,School:hY,Scissors:pY,ScissorsLineDashed:mY,ScreenShare:gY,ScreenShareOff:fY,Scroll:yY,ScrollText:xY,Search:ua,SearchCheck:vY,SearchCode:_Y,SearchSlash:bY,SearchX:wY,Section:jY,Send:ro,SendHorizontal:I2,SendToBack:kY,SeparatorHorizontal:NY,SeparatorVertical:SY,Server:AY,ServerCog:CY,ServerCrash:MY,ServerOff:TY,Settings:Bd,Settings2:EY,Shapes:IY,Share:MA,Share2:Cc,Sheet:PY,Shell:LY,Shield:bm,ShieldAlert:OY,ShieldBan:DY,ShieldCheck:TA,ShieldEllipsis:RY,ShieldHalf:FY,ShieldMinus:zY,ShieldOff:BY,ShieldPlus:$Y,ShieldQuestion:UY,ShieldX:P2,Ship:VY,ShipWheel:qY,Shirt:HY,ShoppingBag:Ug,ShoppingBasket:WY,ShoppingCart:Ih,Shovel:GY,ShowerHead:KY,Shrink:ZY,Shrub:YY,Shuffle:XY,Sigma:QY,Signal:sX,SignalHigh:JY,SignalLow:eX,SignalMedium:tX,SignalZero:rX,Signature:nX,Signpost:iX,SignpostBig:aX,Siren:oX,SkipBack:lX,SkipForward:cX,Skull:dX,Slack:uX,Slash:hX,Slice:mX,SlidersHorizontal:AA,SlidersVertical:L2,Smartphone:xy,SmartphoneCharging:pX,SmartphoneNfc:fX,Smile:xX,SmilePlus:gX,Snail:yX,Snowflake:S1,Sofa:vX,Soup:_X,Space:bX,Spade:wX,Sparkle:jX,Sparkles:Bn,Speaker:kX,Speech:NX,SpellCheck:CX,SpellCheck2:SX,Spline:MX,Split:TX,SprayCan:AX,Sprout:EX,Square:qg,SquareActivity:O2,SquareArrowDown:F2,SquareArrowDownLeft:D2,SquareArrowDownRight:R2,SquareArrowLeft:z2,SquareArrowOutDownLeft:B2,SquareArrowOutDownRight:$2,SquareArrowOutUpLeft:U2,SquareArrowOutUpRight:q2,SquareArrowRight:V2,SquareArrowUp:G2,SquareArrowUpLeft:H2,SquareArrowUpRight:W2,SquareAsterisk:K2,SquareBottomDashedScissors:Z2,SquareChartGantt:gg,SquareCheck:Y2,SquareCheckBig:X0,SquareChevronDown:X2,SquareChevronLeft:Q2,SquareChevronRight:J2,SquareChevronUp:ew,SquareCode:tw,SquareDashed:nw,SquareDashedBottom:PX,SquareDashedBottomCode:IX,SquareDashedKanban:rw,SquareDashedMousePointer:sw,SquareDivide:aw,SquareDot:iw,SquareEqual:ow,SquareFunction:lw,SquareKanban:cw,SquareLibrary:dw,SquareM:uw,SquareMenu:hw,SquareMinus:mw,SquareMousePointer:pw,SquareParking:gw,SquareParkingOff:fw,SquarePen:vc,SquarePercent:xw,SquarePi:yw,SquarePilcrow:vw,SquarePlay:_w,SquarePlus:bw,SquarePower:ww,SquareRadical:LX,SquareScissors:jw,SquareSigma:kw,SquareSlash:Nw,SquareSplitHorizontal:Sw,SquareSplitVertical:Cw,SquareSquare:OX,SquareStack:DX,SquareTerminal:Mw,SquareUser:Aw,SquareUserRound:Tw,SquareX:Ew,Squircle:RX,Squirrel:FX,Stamp:zX,Star:Mn,StarHalf:BX,StarOff:$X,StepBack:UX,StepForward:qX,Stethoscope:VX,Sticker:HX,StickyNote:WX,Store:GX,StretchHorizontal:KX,StretchVertical:ZX,Strikethrough:YX,Subscript:XX,Sun:J1,SunDim:QX,SunMedium:JX,SunMoon:eQ,SunSnow:tQ,Sunrise:rQ,Sunset:sQ,Superscript:nQ,SwatchBook:aQ,SwissFranc:iQ,SwitchCamera:oQ,Sword:lQ,Swords:cQ,Syringe:dQ,Table:xQ,Table2:$S,TableCellsMerge:uQ,TableCellsSplit:hQ,TableColumnsSplit:mQ,TableOfContents:pQ,TableProperties:fQ,TableRowsSplit:gQ,Tablet:vQ,TabletSmartphone:yQ,Tablets:_Q,Tag:Vg,Tags:bQ,Tally1:wQ,Tally2:jQ,Tally3:kQ,Tally4:NQ,Tally5:SQ,Tangent:CQ,Target:yy,Telescope:MQ,Tent:AQ,TentTree:TQ,Terminal:EQ,TestTube:IQ,TestTubeDiagonal:Iw,TestTubes:PQ,Text:FQ,TextCursor:OQ,TextCursorInput:LQ,TextQuote:DQ,TextSearch:RQ,TextSelect:Pw,Theater:zQ,Thermometer:UQ,ThermometerSnowflake:BQ,ThermometerSun:$Q,ThumbsDown:EA,ThumbsUp:xd,Ticket:IA,TicketCheck:qQ,TicketMinus:VQ,TicketPercent:HQ,TicketPlus:WQ,TicketSlash:GQ,TicketX:KQ,Tickets:YQ,TicketsPlane:ZQ,Timer:JQ,TimerOff:XQ,TimerReset:QQ,ToggleLeft:eJ,ToggleRight:tJ,Toilet:rJ,Tornado:sJ,Torus:nJ,Touchpad:iJ,TouchpadOff:aJ,TowerControl:oJ,ToyBrick:lJ,Tractor:cJ,TrafficCone:dJ,TrainFront:hJ,TrainFrontTunnel:uJ,TrainTrack:mJ,TramFront:Lw,Trash:pJ,Trash2:Bs,TreeDeciduous:fJ,TreePalm:Ow,TreePine:ev,Trees:gJ,Trello:xJ,TrendingDown:Gj,TrendingUp:bu,TrendingUpDown:yJ,Triangle:_J,TriangleAlert:Zu,TriangleRight:vJ,Trophy:lo,Truck:PA,Turtle:bJ,Tv:jJ,TvMinimal:Dw,TvMinimalPlay:wJ,Twitch:kJ,Twitter:NJ,Type:CJ,TypeOutline:SJ,Umbrella:TJ,UmbrellaOff:MJ,Underline:AJ,Undo:US,Undo2:EJ,UndoDot:IJ,UnfoldHorizontal:PJ,UnfoldVertical:LJ,Ungroup:OJ,University:Rw,Unlink:LA,Unlink2:DJ,Unplug:RJ,Upload:so,Usb:FJ,User:oc,UserCheck:Kj,UserCog:OA,UserMinus:zJ,UserPen:BJ,UserPlus:wu,UserRound:qw,UserRoundCheck:Fw,UserRoundCog:zw,UserRoundMinus:Bw,UserRoundPen:$J,UserRoundPlus:$w,UserRoundSearch:UJ,UserRoundX:Uw,UserSearch:qJ,UserX:VJ,Users:qs,UsersRound:Vw,Utensils:Ww,UtensilsCrossed:Hw,UtilityPole:HJ,Variable:DA,Vault:WJ,Vegan:GJ,VenetianMask:KJ,Vibrate:YJ,VibrateOff:ZJ,Video:Ta,VideoOff:XJ,Videotape:QJ,View:JJ,Voicemail:eee,Volleyball:tee,Volume:iee,Volume1:ree,Volume2:see,VolumeOff:nee,VolumeX:aee,Vote:oee,Wallet:cee,WalletCards:lee,WalletMinimal:Gw,Wallpaper:dee,Wand:uee,WandSparkles:Kw,Warehouse:hee,WashingMachine:mee,Watch:pee,Waves:fee,Waypoints:gee,Webcam:xee,Webhook:vee,WebhookOff:yee,Weight:_ee,Wheat:wee,WheatOff:bee,WholeWord:jee,Wifi:Mee,WifiHigh:kee,WifiLow:Nee,WifiOff:See,WifiZero:Cee,Wind:Aee,WindArrowDown:Tee,Wine:Iee,WineOff:Eee,Workflow:Pee,Worm:Lee,WrapText:Oee,Wrench:vy,X:en,Youtube:Dee,Zap:Hg,ZapOff:Ree,ZoomIn:qS,ZoomOut:VS},Symbol.toStringTag,{value:"Module"}));/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IIe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:u8,AArrowDownIcon:u8,AArrowUp:h8,AArrowUpIcon:h8,ALargeSmall:m8,ALargeSmallIcon:m8,Accessibility:p8,AccessibilityIcon:p8,Activity:Og,ActivityIcon:Og,ActivitySquare:O2,ActivitySquareIcon:O2,AirVent:f8,AirVentIcon:f8,Airplay:g8,AirplayIcon:g8,AlarmCheck:R_,AlarmCheckIcon:R_,AlarmClock:y8,AlarmClockCheck:R_,AlarmClockCheckIcon:R_,AlarmClockIcon:y8,AlarmClockMinus:F_,AlarmClockMinusIcon:F_,AlarmClockOff:x8,AlarmClockOffIcon:x8,AlarmClockPlus:z_,AlarmClockPlusIcon:z_,AlarmMinus:F_,AlarmMinusIcon:F_,AlarmPlus:z_,AlarmPlusIcon:z_,AlarmSmoke:v8,AlarmSmokeIcon:v8,Album:_8,AlbumIcon:_8,AlertCircle:vl,AlertCircleIcon:vl,AlertOctagon:f2,AlertOctagonIcon:f2,AlertTriangle:Zu,AlertTriangleIcon:Zu,AlignCenter:wS,AlignCenterHorizontal:b8,AlignCenterHorizontalIcon:b8,AlignCenterIcon:wS,AlignCenterVertical:w8,AlignCenterVerticalIcon:w8,AlignEndHorizontal:j8,AlignEndHorizontalIcon:j8,AlignEndVertical:k8,AlignEndVerticalIcon:k8,AlignHorizontalDistributeCenter:N8,AlignHorizontalDistributeCenterIcon:N8,AlignHorizontalDistributeEnd:S8,AlignHorizontalDistributeEndIcon:S8,AlignHorizontalDistributeStart:C8,AlignHorizontalDistributeStartIcon:C8,AlignHorizontalJustifyCenter:M8,AlignHorizontalJustifyCenterIcon:M8,AlignHorizontalJustifyEnd:T8,AlignHorizontalJustifyEndIcon:T8,AlignHorizontalJustifyStart:A8,AlignHorizontalJustifyStartIcon:A8,AlignHorizontalSpaceAround:E8,AlignHorizontalSpaceAroundIcon:E8,AlignHorizontalSpaceBetween:I8,AlignHorizontalSpaceBetweenIcon:I8,AlignJustify:P8,AlignJustifyIcon:P8,AlignLeft:jS,AlignLeftIcon:jS,AlignRight:kS,AlignRightIcon:kS,AlignStartHorizontal:L8,AlignStartHorizontalIcon:L8,AlignStartVertical:O8,AlignStartVerticalIcon:O8,AlignVerticalDistributeCenter:D8,AlignVerticalDistributeCenterIcon:D8,AlignVerticalDistributeEnd:R8,AlignVerticalDistributeEndIcon:R8,AlignVerticalDistributeStart:F8,AlignVerticalDistributeStartIcon:F8,AlignVerticalJustifyCenter:z8,AlignVerticalJustifyCenterIcon:z8,AlignVerticalJustifyEnd:B8,AlignVerticalJustifyEndIcon:B8,AlignVerticalJustifyStart:$8,AlignVerticalJustifyStartIcon:$8,AlignVerticalSpaceAround:U8,AlignVerticalSpaceAroundIcon:U8,AlignVerticalSpaceBetween:q8,AlignVerticalSpaceBetweenIcon:q8,Ambulance:V8,AmbulanceIcon:V8,Ampersand:H8,AmpersandIcon:H8,Ampersands:W8,AmpersandsIcon:W8,Amphora:G8,AmphoraIcon:G8,Anchor:K8,AnchorIcon:K8,Angry:Z8,AngryIcon:Z8,Annoyed:Y8,AnnoyedIcon:Y8,Antenna:X8,AntennaIcon:X8,Anvil:Q8,AnvilIcon:Q8,Aperture:J8,ApertureIcon:J8,AppWindow:sA,AppWindowIcon:sA,AppWindowMac:eD,AppWindowMacIcon:eD,Apple:tD,AppleIcon:tD,Archive:nA,ArchiveIcon:nA,ArchiveRestore:rD,ArchiveRestoreIcon:rD,ArchiveX:sD,ArchiveXIcon:sD,AreaChart:J_,AreaChartIcon:J_,Armchair:nD,ArmchairIcon:nD,ArrowBigDown:iD,ArrowBigDownDash:aD,ArrowBigDownDashIcon:aD,ArrowBigDownIcon:iD,ArrowBigLeft:lD,ArrowBigLeftDash:oD,ArrowBigLeftDashIcon:oD,ArrowBigLeftIcon:lD,ArrowBigRight:dD,ArrowBigRightDash:cD,ArrowBigRightDashIcon:cD,ArrowBigRightIcon:dD,ArrowBigUp:hD,ArrowBigUpDash:uD,ArrowBigUpDashIcon:uD,ArrowBigUpIcon:hD,ArrowDown:ly,ArrowDown01:mD,ArrowDown01Icon:mD,ArrowDown10:pD,ArrowDown10Icon:pD,ArrowDownAZ:B_,ArrowDownAZIcon:B_,ArrowDownAz:B_,ArrowDownAzIcon:B_,ArrowDownCircle:ub,ArrowDownCircleIcon:ub,ArrowDownFromLine:fD,ArrowDownFromLineIcon:fD,ArrowDownIcon:ly,ArrowDownLeft:gD,ArrowDownLeftFromCircle:mb,ArrowDownLeftFromCircleIcon:mb,ArrowDownLeftFromSquare:B2,ArrowDownLeftFromSquareIcon:B2,ArrowDownLeftIcon:gD,ArrowDownLeftSquare:D2,ArrowDownLeftSquareIcon:D2,ArrowDownNarrowWide:xD,ArrowDownNarrowWideIcon:xD,ArrowDownRight:yD,ArrowDownRightFromCircle:pb,ArrowDownRightFromCircleIcon:pb,ArrowDownRightFromSquare:$2,ArrowDownRightFromSquareIcon:$2,ArrowDownRightIcon:yD,ArrowDownRightSquare:R2,ArrowDownRightSquareIcon:R2,ArrowDownSquare:F2,ArrowDownSquareIcon:F2,ArrowDownToDot:vD,ArrowDownToDotIcon:vD,ArrowDownToLine:_D,ArrowDownToLineIcon:_D,ArrowDownUp:bD,ArrowDownUpIcon:bD,ArrowDownWideNarrow:$_,ArrowDownWideNarrowIcon:$_,ArrowDownZA:U_,ArrowDownZAIcon:U_,ArrowDownZa:U_,ArrowDownZaIcon:U_,ArrowLeft:wi,ArrowLeftCircle:hb,ArrowLeftCircleIcon:hb,ArrowLeftFromLine:wD,ArrowLeftFromLineIcon:wD,ArrowLeftIcon:wi,ArrowLeftRight:jD,ArrowLeftRightIcon:jD,ArrowLeftSquare:z2,ArrowLeftSquareIcon:z2,ArrowLeftToLine:kD,ArrowLeftToLineIcon:kD,ArrowRight:to,ArrowRightCircle:xb,ArrowRightCircleIcon:xb,ArrowRightFromLine:ND,ArrowRightFromLineIcon:ND,ArrowRightIcon:to,ArrowRightLeft:SD,ArrowRightLeftIcon:SD,ArrowRightSquare:V2,ArrowRightSquareIcon:V2,ArrowRightToLine:CD,ArrowRightToLineIcon:CD,ArrowUp:hp,ArrowUp01:MD,ArrowUp01Icon:MD,ArrowUp10:TD,ArrowUp10Icon:TD,ArrowUpAZ:q_,ArrowUpAZIcon:q_,ArrowUpAz:q_,ArrowUpAzIcon:q_,ArrowUpCircle:yb,ArrowUpCircleIcon:yb,ArrowUpDown:Dg,ArrowUpDownIcon:Dg,ArrowUpFromDot:AD,ArrowUpFromDotIcon:AD,ArrowUpFromLine:ED,ArrowUpFromLineIcon:ED,ArrowUpIcon:hp,ArrowUpLeft:ID,ArrowUpLeftFromCircle:fb,ArrowUpLeftFromCircleIcon:fb,ArrowUpLeftFromSquare:U2,ArrowUpLeftFromSquareIcon:U2,ArrowUpLeftIcon:ID,ArrowUpLeftSquare:H2,ArrowUpLeftSquareIcon:H2,ArrowUpNarrowWide:V_,ArrowUpNarrowWideIcon:V_,ArrowUpRight:PD,ArrowUpRightFromCircle:gb,ArrowUpRightFromCircleIcon:gb,ArrowUpRightFromSquare:q2,ArrowUpRightFromSquareIcon:q2,ArrowUpRightIcon:PD,ArrowUpRightSquare:W2,ArrowUpRightSquareIcon:W2,ArrowUpSquare:G2,ArrowUpSquareIcon:G2,ArrowUpToLine:LD,ArrowUpToLineIcon:LD,ArrowUpWideNarrow:OD,ArrowUpWideNarrowIcon:OD,ArrowUpZA:H_,ArrowUpZAIcon:H_,ArrowUpZa:H_,ArrowUpZaIcon:H_,ArrowsUpFromLine:DD,ArrowsUpFromLineIcon:DD,Asterisk:RD,AsteriskIcon:RD,AsteriskSquare:K2,AsteriskSquareIcon:K2,AtSign:FD,AtSignIcon:FD,Atom:zD,AtomIcon:zD,AudioLines:BD,AudioLinesIcon:BD,AudioWaveform:$D,AudioWaveformIcon:$D,Award:$l,AwardIcon:$l,Axe:UD,AxeIcon:UD,Axis3D:W_,Axis3DIcon:W_,Axis3d:W_,Axis3dIcon:W_,Baby:qD,BabyIcon:qD,Backpack:VD,BackpackIcon:VD,Badge:iR,BadgeAlert:HD,BadgeAlertIcon:HD,BadgeCent:WD,BadgeCentIcon:WD,BadgeCheck:G_,BadgeCheckIcon:G_,BadgeDollarSign:GD,BadgeDollarSignIcon:GD,BadgeEuro:KD,BadgeEuroIcon:KD,BadgeHelp:ZD,BadgeHelpIcon:ZD,BadgeIcon:iR,BadgeIndianRupee:YD,BadgeIndianRupeeIcon:YD,BadgeInfo:XD,BadgeInfoIcon:XD,BadgeJapaneseYen:QD,BadgeJapaneseYenIcon:QD,BadgeMinus:JD,BadgeMinusIcon:JD,BadgePercent:eR,BadgePercentIcon:eR,BadgePlus:tR,BadgePlusIcon:tR,BadgePoundSterling:rR,BadgePoundSterlingIcon:rR,BadgeRussianRuble:sR,BadgeRussianRubleIcon:sR,BadgeSwissFranc:nR,BadgeSwissFrancIcon:nR,BadgeX:aR,BadgeXIcon:aR,BaggageClaim:oR,BaggageClaimIcon:oR,Ban:lR,BanIcon:lR,Banana:cR,BananaIcon:cR,Bandage:dR,BandageIcon:dR,Banknote:uR,BanknoteIcon:uR,BarChart:ib,BarChart2:ob,BarChart2Icon:ob,BarChart3:wc,BarChart3Icon:wc,BarChart4:nb,BarChart4Icon:nb,BarChartBig:sb,BarChartBigIcon:sb,BarChartHorizontal:tb,BarChartHorizontalBig:eb,BarChartHorizontalBigIcon:eb,BarChartHorizontalIcon:tb,BarChartIcon:ib,Barcode:hR,BarcodeIcon:hR,Baseline:mR,BaselineIcon:mR,Bath:$1,BathIcon:$1,Battery:vR,BatteryCharging:pR,BatteryChargingIcon:pR,BatteryFull:fR,BatteryFullIcon:fR,BatteryIcon:vR,BatteryLow:gR,BatteryLowIcon:gR,BatteryMedium:xR,BatteryMediumIcon:xR,BatteryWarning:yR,BatteryWarningIcon:yR,Beaker:_R,BeakerIcon:_R,Bean:wR,BeanIcon:wR,BeanOff:bR,BeanOffIcon:bR,Bed:U1,BedDouble:jR,BedDoubleIcon:jR,BedIcon:U1,BedSingle:kR,BedSingleIcon:kR,Beef:NR,BeefIcon:NR,Beer:CR,BeerIcon:CR,BeerOff:SR,BeerOffIcon:SR,Bell:Rg,BellDot:MR,BellDotIcon:MR,BellElectric:TR,BellElectricIcon:TR,BellIcon:Rg,BellMinus:AR,BellMinusIcon:AR,BellOff:Ej,BellOffIcon:Ej,BellPlus:ER,BellPlusIcon:ER,BellRing:IR,BellRingIcon:IR,BetweenHorizonalEnd:K_,BetweenHorizonalEndIcon:K_,BetweenHorizonalStart:Z_,BetweenHorizonalStartIcon:Z_,BetweenHorizontalEnd:K_,BetweenHorizontalEndIcon:K_,BetweenHorizontalStart:Z_,BetweenHorizontalStartIcon:Z_,BetweenVerticalEnd:PR,BetweenVerticalEndIcon:PR,BetweenVerticalStart:LR,BetweenVerticalStartIcon:LR,BicepsFlexed:OR,BicepsFlexedIcon:OR,Bike:DR,BikeIcon:DR,Binary:RR,BinaryIcon:RR,Binoculars:FR,BinocularsIcon:FR,Biohazard:zR,BiohazardIcon:zR,Bird:BR,BirdIcon:BR,Bitcoin:$R,BitcoinIcon:$R,Blend:UR,BlendIcon:UR,Blinds:qR,BlindsIcon:qR,Blocks:VR,BlocksIcon:VR,Bluetooth:KR,BluetoothConnected:HR,BluetoothConnectedIcon:HR,BluetoothIcon:KR,BluetoothOff:WR,BluetoothOffIcon:WR,BluetoothSearching:GR,BluetoothSearchingIcon:GR,Bold:NS,BoldIcon:NS,Bolt:ZR,BoltIcon:ZR,Bomb:YR,BombIcon:YR,Bone:XR,BoneIcon:XR,Book:vF,BookA:QR,BookAIcon:QR,BookAudio:JR,BookAudioIcon:JR,BookCheck:eF,BookCheckIcon:eF,BookCopy:tF,BookCopyIcon:tF,BookDashed:Y_,BookDashedIcon:Y_,BookDown:rF,BookDownIcon:rF,BookHeadphones:sF,BookHeadphonesIcon:sF,BookHeart:nF,BookHeartIcon:nF,BookIcon:vF,BookImage:aF,BookImageIcon:aF,BookKey:iF,BookKeyIcon:iF,BookLock:oF,BookLockIcon:oF,BookMarked:lF,BookMarkedIcon:lF,BookMinus:cF,BookMinusIcon:cF,BookOpen:q1,BookOpenCheck:dF,BookOpenCheckIcon:dF,BookOpenIcon:q1,BookOpenText:uF,BookOpenTextIcon:uF,BookPlus:hF,BookPlusIcon:hF,BookTemplate:Y_,BookTemplateIcon:Y_,BookText:mF,BookTextIcon:mF,BookType:pF,BookTypeIcon:pF,BookUp:gF,BookUp2:fF,BookUp2Icon:fF,BookUpIcon:gF,BookUser:xF,BookUserIcon:xF,BookX:yF,BookXIcon:yF,Bookmark:Tf,BookmarkCheck:_F,BookmarkCheckIcon:_F,BookmarkIcon:Tf,BookmarkMinus:bF,BookmarkMinusIcon:bF,BookmarkPlus:aA,BookmarkPlusIcon:aA,BookmarkX:wF,BookmarkXIcon:wF,BoomBox:jF,BoomBoxIcon:jF,Bot:SS,BotIcon:SS,BotMessageSquare:kF,BotMessageSquareIcon:kF,BotOff:NF,BotOffIcon:NF,Box:SF,BoxIcon:SF,BoxSelect:nw,BoxSelectIcon:nw,Boxes:CF,BoxesIcon:CF,Braces:X_,BracesIcon:X_,Brackets:MF,BracketsIcon:MF,Brain:iA,BrainCircuit:TF,BrainCircuitIcon:TF,BrainCog:AF,BrainCogIcon:AF,BrainIcon:iA,BrickWall:EF,BrickWallIcon:EF,Briefcase:rh,BriefcaseBusiness:IF,BriefcaseBusinessIcon:IF,BriefcaseConveyorBelt:PF,BriefcaseConveyorBeltIcon:PF,BriefcaseIcon:rh,BriefcaseMedical:LF,BriefcaseMedicalIcon:LF,BringToFront:OF,BringToFrontIcon:OF,Brush:DF,BrushIcon:DF,Bug:zF,BugIcon:zF,BugOff:RF,BugOffIcon:RF,BugPlay:FF,BugPlayIcon:FF,Building:Ij,Building2:pi,Building2Icon:pi,BuildingIcon:Ij,Bus:$F,BusFront:BF,BusFrontIcon:BF,BusIcon:$F,Cable:qF,CableCar:UF,CableCarIcon:UF,CableIcon:qF,Cake:fm,CakeIcon:fm,CakeSlice:VF,CakeSliceIcon:VF,Calculator:HF,CalculatorIcon:HF,Calendar:jn,Calendar1:WF,Calendar1Icon:WF,CalendarArrowDown:GF,CalendarArrowDownIcon:GF,CalendarArrowUp:KF,CalendarArrowUpIcon:KF,CalendarCheck:YF,CalendarCheck2:ZF,CalendarCheck2Icon:ZF,CalendarCheckIcon:YF,CalendarClock:oA,CalendarClockIcon:oA,CalendarCog:XF,CalendarCogIcon:XF,CalendarDays:Af,CalendarDaysIcon:Af,CalendarFold:QF,CalendarFoldIcon:QF,CalendarHeart:JF,CalendarHeartIcon:JF,CalendarIcon:jn,CalendarMinus:tz,CalendarMinus2:ez,CalendarMinus2Icon:ez,CalendarMinusIcon:tz,CalendarOff:rz,CalendarOffIcon:rz,CalendarPlus:Pj,CalendarPlus2:sz,CalendarPlus2Icon:sz,CalendarPlusIcon:Pj,CalendarRange:nz,CalendarRangeIcon:nz,CalendarSearch:az,CalendarSearchIcon:az,CalendarSync:iz,CalendarSyncIcon:iz,CalendarX:lz,CalendarX2:oz,CalendarX2Icon:oz,CalendarXIcon:lz,Camera:Fg,CameraIcon:Fg,CameraOff:cz,CameraOffIcon:cz,CandlestickChart:rb,CandlestickChartIcon:rb,Candy:hz,CandyCane:dz,CandyCaneIcon:dz,CandyIcon:hz,CandyOff:uz,CandyOffIcon:uz,Cannabis:mz,CannabisIcon:mz,Captions:Q_,CaptionsIcon:Q_,CaptionsOff:pz,CaptionsOffIcon:pz,Car:xz,CarFront:fz,CarFrontIcon:fz,CarIcon:xz,CarTaxiFront:gz,CarTaxiFrontIcon:gz,Caravan:yz,CaravanIcon:yz,Carrot:vz,CarrotIcon:vz,CaseLower:_z,CaseLowerIcon:_z,CaseSensitive:bz,CaseSensitiveIcon:bz,CaseUpper:wz,CaseUpperIcon:wz,CassetteTape:jz,CassetteTapeIcon:jz,Cast:kz,CastIcon:kz,Castle:Nz,CastleIcon:Nz,Cat:Sz,CatIcon:Sz,Cctv:Cz,CctvIcon:Cz,ChartArea:J_,ChartAreaIcon:J_,ChartBar:tb,ChartBarBig:eb,ChartBarBigIcon:eb,ChartBarDecreasing:Mz,ChartBarDecreasingIcon:Mz,ChartBarIcon:tb,ChartBarIncreasing:Tz,ChartBarIncreasingIcon:Tz,ChartBarStacked:Az,ChartBarStackedIcon:Az,ChartCandlestick:rb,ChartCandlestickIcon:rb,ChartColumn:wc,ChartColumnBig:sb,ChartColumnBigIcon:sb,ChartColumnDecreasing:Ez,ChartColumnDecreasingIcon:Ez,ChartColumnIcon:wc,ChartColumnIncreasing:nb,ChartColumnIncreasingIcon:nb,ChartColumnStacked:Iz,ChartColumnStackedIcon:Iz,ChartGantt:Pz,ChartGanttIcon:Pz,ChartLine:ab,ChartLineIcon:ab,ChartNetwork:Lz,ChartNetworkIcon:Lz,ChartNoAxesColumn:ob,ChartNoAxesColumnDecreasing:Oz,ChartNoAxesColumnDecreasingIcon:Oz,ChartNoAxesColumnIcon:ob,ChartNoAxesColumnIncreasing:ib,ChartNoAxesColumnIncreasingIcon:ib,ChartNoAxesCombined:Dz,ChartNoAxesCombinedIcon:Dz,ChartNoAxesGantt:lb,ChartNoAxesGanttIcon:lb,ChartPie:cb,ChartPieIcon:cb,ChartScatter:db,ChartScatterIcon:db,ChartSpline:Rz,ChartSplineIcon:Rz,Check:fi,CheckCheck:Fz,CheckCheckIcon:Fz,CheckCircle:ii,CheckCircle2:Ki,CheckCircle2Icon:Ki,CheckCircleIcon:ii,CheckIcon:fi,CheckSquare:X0,CheckSquare2:Y2,CheckSquare2Icon:Y2,CheckSquareIcon:X0,ChefHat:zz,ChefHatIcon:zz,Cherry:Bz,CherryIcon:Bz,ChevronDown:gd,ChevronDownCircle:vb,ChevronDownCircleIcon:vb,ChevronDownIcon:gd,ChevronDownSquare:X2,ChevronDownSquareIcon:X2,ChevronFirst:$z,ChevronFirstIcon:$z,ChevronLast:Uz,ChevronLastIcon:Uz,ChevronLeft:Sc,ChevronLeftCircle:_b,ChevronLeftCircleIcon:_b,ChevronLeftIcon:Sc,ChevronLeftSquare:Q2,ChevronLeftSquareIcon:Q2,ChevronRight:Zi,ChevronRightCircle:bb,ChevronRightCircleIcon:bb,ChevronRightIcon:Zi,ChevronRightSquare:J2,ChevronRightSquareIcon:J2,ChevronUp:zg,ChevronUpCircle:wb,ChevronUpCircleIcon:wb,ChevronUpIcon:zg,ChevronUpSquare:ew,ChevronUpSquareIcon:ew,ChevronsDown:Vz,ChevronsDownIcon:Vz,ChevronsDownUp:qz,ChevronsDownUpIcon:qz,ChevronsLeft:Gz,ChevronsLeftIcon:Gz,ChevronsLeftRight:Wz,ChevronsLeftRightEllipsis:Hz,ChevronsLeftRightEllipsisIcon:Hz,ChevronsLeftRightIcon:Wz,ChevronsRight:Zz,ChevronsRightIcon:Zz,ChevronsRightLeft:Kz,ChevronsRightLeftIcon:Kz,ChevronsUp:Yz,ChevronsUpDown:cy,ChevronsUpDownIcon:cy,ChevronsUpIcon:Yz,Chrome:Xz,ChromeIcon:Xz,Church:Qz,ChurchIcon:Qz,Cigarette:e7,CigaretteIcon:e7,CigaretteOff:Jz,CigaretteOffIcon:Jz,Circle:sh,CircleAlert:vl,CircleAlertIcon:vl,CircleArrowDown:ub,CircleArrowDownIcon:ub,CircleArrowLeft:hb,CircleArrowLeftIcon:hb,CircleArrowOutDownLeft:mb,CircleArrowOutDownLeftIcon:mb,CircleArrowOutDownRight:pb,CircleArrowOutDownRightIcon:pb,CircleArrowOutUpLeft:fb,CircleArrowOutUpLeftIcon:fb,CircleArrowOutUpRight:gb,CircleArrowOutUpRightIcon:gb,CircleArrowRight:xb,CircleArrowRightIcon:xb,CircleArrowUp:yb,CircleArrowUpIcon:yb,CircleCheck:Ki,CircleCheckBig:ii,CircleCheckBigIcon:ii,CircleCheckIcon:Ki,CircleChevronDown:vb,CircleChevronDownIcon:vb,CircleChevronLeft:_b,CircleChevronLeftIcon:_b,CircleChevronRight:bb,CircleChevronRightIcon:bb,CircleChevronUp:wb,CircleChevronUpIcon:wb,CircleDashed:t7,CircleDashedIcon:t7,CircleDivide:jb,CircleDivideIcon:jb,CircleDollarSign:r7,CircleDollarSignIcon:r7,CircleDot:n7,CircleDotDashed:s7,CircleDotDashedIcon:s7,CircleDotIcon:n7,CircleEllipsis:a7,CircleEllipsisIcon:a7,CircleEqual:i7,CircleEqualIcon:i7,CircleFadingArrowUp:o7,CircleFadingArrowUpIcon:o7,CircleFadingPlus:l7,CircleFadingPlusIcon:l7,CircleGauge:kb,CircleGaugeIcon:kb,CircleHelp:Zx,CircleHelpIcon:Zx,CircleIcon:sh,CircleMinus:Nb,CircleMinusIcon:Nb,CircleOff:c7,CircleOffIcon:c7,CircleParking:Cb,CircleParkingIcon:Cb,CircleParkingOff:Sb,CircleParkingOffIcon:Sb,CirclePause:Mb,CirclePauseIcon:Mb,CirclePercent:Tb,CirclePercentIcon:Tb,CirclePlay:ap,CirclePlayIcon:ap,CirclePlus:Ab,CirclePlusIcon:Ab,CirclePower:Eb,CirclePowerIcon:Eb,CircleSlash:d7,CircleSlash2:Ib,CircleSlash2Icon:Ib,CircleSlashIcon:d7,CircleSlashed:Ib,CircleSlashedIcon:Ib,CircleStop:Pb,CircleStopIcon:Pb,CircleUser:Ob,CircleUserIcon:Ob,CircleUserRound:Lb,CircleUserRoundIcon:Lb,CircleX:jc,CircleXIcon:jc,CircuitBoard:u7,CircuitBoardIcon:u7,Citrus:h7,CitrusIcon:h7,Clapperboard:m7,ClapperboardIcon:m7,Clipboard:_7,ClipboardCheck:lA,ClipboardCheckIcon:lA,ClipboardCopy:p7,ClipboardCopyIcon:p7,ClipboardEdit:Rb,ClipboardEditIcon:Rb,ClipboardIcon:_7,ClipboardList:cA,ClipboardListIcon:cA,ClipboardMinus:f7,ClipboardMinusIcon:f7,ClipboardPaste:g7,ClipboardPasteIcon:g7,ClipboardPen:Rb,ClipboardPenIcon:Rb,ClipboardPenLine:Db,ClipboardPenLineIcon:Db,ClipboardPlus:x7,ClipboardPlusIcon:x7,ClipboardSignature:Db,ClipboardSignatureIcon:Db,ClipboardType:y7,ClipboardTypeIcon:y7,ClipboardX:v7,ClipboardXIcon:v7,Clock:Ra,Clock1:b7,Clock10:w7,Clock10Icon:w7,Clock11:j7,Clock11Icon:j7,Clock12:k7,Clock12Icon:k7,Clock1Icon:b7,Clock2:N7,Clock2Icon:N7,Clock3:S7,Clock3Icon:S7,Clock4:C7,Clock4Icon:C7,Clock5:M7,Clock5Icon:M7,Clock6:T7,Clock6Icon:T7,Clock7:A7,Clock7Icon:A7,Clock8:E7,Clock8Icon:E7,Clock9:I7,Clock9Icon:I7,ClockAlert:P7,ClockAlertIcon:P7,ClockArrowDown:L7,ClockArrowDownIcon:L7,ClockArrowUp:O7,ClockArrowUpIcon:O7,ClockIcon:Ra,Cloud:Y7,CloudAlert:D7,CloudAlertIcon:D7,CloudCog:R7,CloudCogIcon:R7,CloudDownload:Fb,CloudDownloadIcon:Fb,CloudDrizzle:F7,CloudDrizzleIcon:F7,CloudFog:z7,CloudFogIcon:z7,CloudHail:B7,CloudHailIcon:B7,CloudIcon:Y7,CloudLightning:$7,CloudLightningIcon:$7,CloudMoon:q7,CloudMoonIcon:q7,CloudMoonRain:U7,CloudMoonRainIcon:U7,CloudOff:V7,CloudOffIcon:V7,CloudRain:W7,CloudRainIcon:W7,CloudRainWind:H7,CloudRainWindIcon:H7,CloudSnow:G7,CloudSnowIcon:G7,CloudSun:Z7,CloudSunIcon:Z7,CloudSunRain:K7,CloudSunRainIcon:K7,CloudUpload:zb,CloudUploadIcon:zb,Cloudy:X7,CloudyIcon:X7,Clover:ry,CloverIcon:ry,Club:Q7,ClubIcon:Q7,Code:Lj,Code2:Bb,Code2Icon:Bb,CodeIcon:Lj,CodeSquare:tw,CodeSquareIcon:tw,CodeXml:Bb,CodeXmlIcon:Bb,Codepen:J7,CodepenIcon:J7,Codesandbox:e9,CodesandboxIcon:e9,Coffee:Oj,CoffeeIcon:Oj,Cog:t9,CogIcon:t9,Coins:r9,CoinsIcon:r9,Columns:$b,Columns2:$b,Columns2Icon:$b,Columns3:Ub,Columns3Icon:Ub,Columns4:s9,Columns4Icon:s9,ColumnsIcon:$b,Combine:n9,CombineIcon:n9,Command:a9,CommandIcon:a9,Compass:i9,CompassIcon:i9,Component:o9,ComponentIcon:o9,Computer:l9,ComputerIcon:l9,ConciergeBell:c9,ConciergeBellIcon:c9,Cone:d9,ConeIcon:d9,Construction:u9,ConstructionIcon:u9,Contact:h9,Contact2:qb,Contact2Icon:qb,ContactIcon:h9,ContactRound:qb,ContactRoundIcon:qb,Container:m9,ContainerIcon:m9,Contrast:p9,ContrastIcon:p9,Cookie:f9,CookieIcon:f9,CookingPot:g9,CookingPotIcon:g9,Copy:Mo,CopyCheck:x9,CopyCheckIcon:x9,CopyIcon:Mo,CopyMinus:y9,CopyMinusIcon:y9,CopyPlus:v9,CopyPlusIcon:v9,CopySlash:_9,CopySlashIcon:_9,CopyX:b9,CopyXIcon:b9,Copyleft:w9,CopyleftIcon:w9,Copyright:j9,CopyrightIcon:j9,CornerDownLeft:k9,CornerDownLeftIcon:k9,CornerDownRight:N9,CornerDownRightIcon:N9,CornerLeftDown:S9,CornerLeftDownIcon:S9,CornerLeftUp:C9,CornerLeftUpIcon:C9,CornerRightDown:M9,CornerRightDownIcon:M9,CornerRightUp:T9,CornerRightUpIcon:T9,CornerUpLeft:A9,CornerUpLeftIcon:A9,CornerUpRight:E9,CornerUpRightIcon:E9,Cpu:I9,CpuIcon:I9,CreativeCommons:P9,CreativeCommonsIcon:P9,CreditCard:mp,CreditCardIcon:mp,Croissant:L9,CroissantIcon:L9,Crop:O9,CropIcon:O9,Cross:D9,CrossIcon:D9,Crosshair:R9,CrosshairIcon:R9,Crown:V1,CrownIcon:V1,Cuboid:F9,CuboidIcon:F9,CupSoda:z9,CupSodaIcon:z9,CurlyBraces:X_,CurlyBracesIcon:X_,Currency:B9,CurrencyIcon:B9,Cylinder:$9,CylinderIcon:$9,Dam:U9,DamIcon:U9,Database:H9,DatabaseBackup:q9,DatabaseBackupIcon:q9,DatabaseIcon:H9,DatabaseZap:V9,DatabaseZapIcon:V9,Delete:W9,DeleteIcon:W9,Dessert:G9,DessertIcon:G9,Diameter:K9,DiameterIcon:K9,Diamond:X9,DiamondIcon:X9,DiamondMinus:Z9,DiamondMinusIcon:Z9,DiamondPercent:Vb,DiamondPercentIcon:Vb,DiamondPlus:Y9,DiamondPlusIcon:Y9,Dice1:Q9,Dice1Icon:Q9,Dice2:J9,Dice2Icon:J9,Dice3:eB,Dice3Icon:eB,Dice4:tB,Dice4Icon:tB,Dice5:rB,Dice5Icon:rB,Dice6:sB,Dice6Icon:sB,Dices:nB,DicesIcon:nB,Diff:aB,DiffIcon:aB,Disc:cB,Disc2:iB,Disc2Icon:iB,Disc3:oB,Disc3Icon:oB,DiscAlbum:lB,DiscAlbumIcon:lB,DiscIcon:cB,Divide:dB,DivideCircle:jb,DivideCircleIcon:jb,DivideIcon:dB,DivideSquare:aw,DivideSquareIcon:aw,Dna:hB,DnaIcon:hB,DnaOff:uB,DnaOffIcon:uB,Dock:mB,DockIcon:mB,Dog:pB,DogIcon:pB,DollarSign:zd,DollarSignIcon:zd,Donut:fB,DonutIcon:fB,DoorClosed:gB,DoorClosedIcon:gB,DoorOpen:Dj,DoorOpenIcon:Dj,Dot:xB,DotIcon:xB,DotSquare:iw,DotSquareIcon:iw,Download:$i,DownloadCloud:Fb,DownloadCloudIcon:Fb,DownloadIcon:$i,DraftingCompass:yB,DraftingCompassIcon:yB,Drama:vB,DramaIcon:vB,Dribbble:_B,DribbbleIcon:_B,Drill:bB,DrillIcon:bB,Droplet:wB,DropletIcon:wB,Droplets:jB,DropletsIcon:jB,Drum:kB,DrumIcon:kB,Drumstick:NB,DrumstickIcon:NB,Dumbbell:SB,DumbbellIcon:SB,Ear:MB,EarIcon:MB,EarOff:CB,EarOffIcon:CB,Earth:Hb,EarthIcon:Hb,EarthLock:TB,EarthLockIcon:TB,Eclipse:AB,EclipseIcon:AB,Edit:vc,Edit2:Y0,Edit2Icon:Y0,Edit3:Z0,Edit3Icon:Z0,EditIcon:vc,Egg:CS,EggFried:EB,EggFriedIcon:EB,EggIcon:CS,EggOff:IB,EggOffIcon:IB,Ellipsis:xf,EllipsisIcon:xf,EllipsisVertical:Ng,EllipsisVerticalIcon:Ng,Equal:OB,EqualApproximately:PB,EqualApproximatelyIcon:PB,EqualIcon:OB,EqualNot:LB,EqualNotIcon:LB,EqualSquare:ow,EqualSquareIcon:ow,Eraser:DB,EraserIcon:DB,EthernetPort:RB,EthernetPortIcon:RB,Euro:FB,EuroIcon:FB,Expand:zB,ExpandIcon:zB,ExternalLink:Sn,ExternalLinkIcon:Sn,Eye:mo,EyeClosed:BB,EyeClosedIcon:BB,EyeIcon:mo,EyeOff:Ef,EyeOffIcon:Ef,Facebook:au,FacebookIcon:au,Factory:$B,FactoryIcon:$B,Fan:UB,FanIcon:UB,FastForward:qB,FastForwardIcon:qB,Feather:VB,FeatherIcon:VB,Fence:HB,FenceIcon:HB,FerrisWheel:WB,FerrisWheelIcon:WB,Figma:GB,FigmaIcon:GB,File:MS,FileArchive:KB,FileArchiveIcon:KB,FileAudio:YB,FileAudio2:ZB,FileAudio2Icon:ZB,FileAudioIcon:YB,FileAxis3D:Wb,FileAxis3DIcon:Wb,FileAxis3d:Wb,FileAxis3dIcon:Wb,FileBadge:QB,FileBadge2:XB,FileBadge2Icon:XB,FileBadgeIcon:QB,FileBarChart:Gb,FileBarChart2:Kb,FileBarChart2Icon:Kb,FileBarChartIcon:Gb,FileBox:JB,FileBoxIcon:JB,FileChartColumn:Kb,FileChartColumnIcon:Kb,FileChartColumnIncreasing:Gb,FileChartColumnIncreasingIcon:Gb,FileChartLine:Zb,FileChartLineIcon:Zb,FileChartPie:Yb,FileChartPieIcon:Yb,FileCheck:t$,FileCheck2:e$,FileCheck2Icon:e$,FileCheckIcon:t$,FileClock:r$,FileClockIcon:r$,FileCode:n$,FileCode2:s$,FileCode2Icon:s$,FileCodeIcon:n$,FileCog:Xb,FileCog2:Xb,FileCog2Icon:Xb,FileCogIcon:Xb,FileDiff:a$,FileDiffIcon:a$,FileDigit:i$,FileDigitIcon:i$,FileDown:o$,FileDownIcon:o$,FileEdit:Jb,FileEditIcon:Jb,FileHeart:l$,FileHeartIcon:l$,FileIcon:MS,FileImage:H1,FileImageIcon:H1,FileInput:c$,FileInputIcon:c$,FileJson:u$,FileJson2:d$,FileJson2Icon:d$,FileJsonIcon:u$,FileKey:m$,FileKey2:h$,FileKey2Icon:h$,FileKeyIcon:m$,FileLineChart:Zb,FileLineChartIcon:Zb,FileLock:f$,FileLock2:p$,FileLock2Icon:p$,FileLockIcon:f$,FileMinus:x$,FileMinus2:g$,FileMinus2Icon:g$,FileMinusIcon:x$,FileMusic:y$,FileMusicIcon:y$,FileOutput:v$,FileOutputIcon:v$,FilePen:Jb,FilePenIcon:Jb,FilePenLine:Qb,FilePenLineIcon:Qb,FilePieChart:Yb,FilePieChartIcon:Yb,FilePlus:b$,FilePlus2:_$,FilePlus2Icon:_$,FilePlusIcon:b$,FileQuestion:w$,FileQuestionIcon:w$,FileScan:j$,FileScanIcon:j$,FileSearch:N$,FileSearch2:k$,FileSearch2Icon:k$,FileSearchIcon:N$,FileSignature:Qb,FileSignatureIcon:Qb,FileSliders:S$,FileSlidersIcon:S$,FileSpreadsheet:W1,FileSpreadsheetIcon:W1,FileStack:C$,FileStackIcon:C$,FileSymlink:M$,FileSymlinkIcon:M$,FileTerminal:T$,FileTerminalIcon:T$,FileText:ga,FileTextIcon:ga,FileType:E$,FileType2:A$,FileType2Icon:A$,FileTypeIcon:E$,FileUp:I$,FileUpIcon:I$,FileUser:P$,FileUserIcon:P$,FileVideo:O$,FileVideo2:L$,FileVideo2Icon:L$,FileVideoIcon:O$,FileVolume:R$,FileVolume2:D$,FileVolume2Icon:D$,FileVolumeIcon:R$,FileWarning:F$,FileWarningIcon:F$,FileX:B$,FileX2:z$,FileX2Icon:z$,FileXIcon:B$,Files:$$,FilesIcon:$$,Film:Id,FilmIcon:Id,Filter:G1,FilterIcon:G1,FilterX:U$,FilterXIcon:U$,Fingerprint:q$,FingerprintIcon:q$,FireExtinguisher:V$,FireExtinguisherIcon:V$,Fish:G$,FishIcon:G$,FishOff:H$,FishOffIcon:H$,FishSymbol:W$,FishSymbolIcon:W$,Flag:dy,FlagIcon:dy,FlagOff:K$,FlagOffIcon:K$,FlagTriangleLeft:Z$,FlagTriangleLeftIcon:Z$,FlagTriangleRight:Y$,FlagTriangleRightIcon:Y$,Flame:gm,FlameIcon:gm,FlameKindling:X$,FlameKindlingIcon:X$,Flashlight:J$,FlashlightIcon:J$,FlashlightOff:Q$,FlashlightOffIcon:Q$,FlaskConical:Rj,FlaskConicalIcon:Rj,FlaskConicalOff:eU,FlaskConicalOffIcon:eU,FlaskRound:tU,FlaskRoundIcon:tU,FlipHorizontal:sU,FlipHorizontal2:rU,FlipHorizontal2Icon:rU,FlipHorizontalIcon:sU,FlipVertical:aU,FlipVertical2:nU,FlipVertical2Icon:nU,FlipVerticalIcon:aU,Flower:iU,Flower2:wf,Flower2Icon:wf,FlowerIcon:iU,Focus:oU,FocusIcon:oU,FoldHorizontal:lU,FoldHorizontalIcon:lU,FoldVertical:cU,FoldVerticalIcon:cU,Folder:DU,FolderArchive:dU,FolderArchiveIcon:dU,FolderCheck:uU,FolderCheckIcon:uU,FolderClock:hU,FolderClockIcon:hU,FolderClosed:mU,FolderClosedIcon:mU,FolderCode:pU,FolderCodeIcon:pU,FolderCog:e2,FolderCog2:e2,FolderCog2Icon:e2,FolderCogIcon:e2,FolderDot:fU,FolderDotIcon:fU,FolderDown:gU,FolderDownIcon:gU,FolderEdit:t2,FolderEditIcon:t2,FolderGit:yU,FolderGit2:xU,FolderGit2Icon:xU,FolderGitIcon:yU,FolderHeart:vU,FolderHeartIcon:vU,FolderIcon:DU,FolderInput:_U,FolderInputIcon:_U,FolderKanban:bU,FolderKanbanIcon:bU,FolderKey:wU,FolderKeyIcon:wU,FolderLock:jU,FolderLockIcon:jU,FolderMinus:kU,FolderMinusIcon:kU,FolderOpen:If,FolderOpenDot:NU,FolderOpenDotIcon:NU,FolderOpenIcon:If,FolderOutput:SU,FolderOutputIcon:SU,FolderPen:t2,FolderPenIcon:t2,FolderPlus:CU,FolderPlusIcon:CU,FolderRoot:MU,FolderRootIcon:MU,FolderSearch:AU,FolderSearch2:TU,FolderSearch2Icon:TU,FolderSearchIcon:AU,FolderSymlink:EU,FolderSymlinkIcon:EU,FolderSync:IU,FolderSyncIcon:IU,FolderTree:PU,FolderTreeIcon:PU,FolderUp:LU,FolderUpIcon:LU,FolderX:OU,FolderXIcon:OU,Folders:RU,FoldersIcon:RU,Footprints:FU,FootprintsIcon:FU,ForkKnife:Ww,ForkKnifeCrossed:Hw,ForkKnifeCrossedIcon:Hw,ForkKnifeIcon:Ww,Forklift:zU,ForkliftIcon:zU,FormInput:C2,FormInputIcon:C2,Forward:BU,ForwardIcon:BU,Frame:$U,FrameIcon:$U,Framer:UU,FramerIcon:UU,Frown:qU,FrownIcon:qU,Fuel:VU,FuelIcon:VU,Fullscreen:HU,FullscreenIcon:HU,FunctionSquare:lw,FunctionSquareIcon:lw,GalleryHorizontal:GU,GalleryHorizontalEnd:WU,GalleryHorizontalEndIcon:WU,GalleryHorizontalIcon:GU,GalleryThumbnails:KU,GalleryThumbnailsIcon:KU,GalleryVertical:YU,GalleryVerticalEnd:ZU,GalleryVerticalEndIcon:ZU,GalleryVerticalIcon:YU,Gamepad:QU,Gamepad2:XU,Gamepad2Icon:XU,GamepadIcon:QU,GanttChart:lb,GanttChartIcon:lb,GanttChartSquare:gg,GanttChartSquareIcon:gg,Gauge:JU,GaugeCircle:kb,GaugeCircleIcon:kb,GaugeIcon:JU,Gavel:eq,GavelIcon:eq,Gem:tq,GemIcon:tq,Ghost:Fj,GhostIcon:Fj,Gift:oo,GiftIcon:oo,GitBranch:sq,GitBranchIcon:sq,GitBranchPlus:rq,GitBranchPlusIcon:rq,GitCommit:r2,GitCommitHorizontal:r2,GitCommitHorizontalIcon:r2,GitCommitIcon:r2,GitCommitVertical:nq,GitCommitVerticalIcon:nq,GitCompare:iq,GitCompareArrows:aq,GitCompareArrowsIcon:aq,GitCompareIcon:iq,GitFork:oq,GitForkIcon:oq,GitGraph:lq,GitGraphIcon:lq,GitMerge:cq,GitMergeIcon:cq,GitPullRequest:fq,GitPullRequestArrow:dq,GitPullRequestArrowIcon:dq,GitPullRequestClosed:uq,GitPullRequestClosedIcon:uq,GitPullRequestCreate:mq,GitPullRequestCreateArrow:hq,GitPullRequestCreateArrowIcon:hq,GitPullRequestCreateIcon:mq,GitPullRequestDraft:pq,GitPullRequestDraftIcon:pq,GitPullRequestIcon:fq,Github:gq,GithubIcon:gq,Gitlab:xq,GitlabIcon:xq,GlassWater:yq,GlassWaterIcon:yq,Glasses:vq,GlassesIcon:vq,Globe:uy,Globe2:Hb,Globe2Icon:Hb,GlobeIcon:uy,GlobeLock:_q,GlobeLockIcon:_q,Goal:bq,GoalIcon:bq,Grab:wq,GrabIcon:wq,GraduationCap:K1,GraduationCapIcon:K1,Grape:jq,GrapeIcon:jq,Grid:sm,Grid2X2:n2,Grid2X2Icon:n2,Grid2X2Plus:s2,Grid2X2PlusIcon:s2,Grid2x2:n2,Grid2x2Check:kq,Grid2x2CheckIcon:kq,Grid2x2Icon:n2,Grid2x2Plus:s2,Grid2x2PlusIcon:s2,Grid2x2X:Nq,Grid2x2XIcon:Nq,Grid3X3:sm,Grid3X3Icon:sm,Grid3x3:sm,Grid3x3Icon:sm,GridIcon:sm,Grip:Cq,GripHorizontal:Sq,GripHorizontalIcon:Sq,GripIcon:Cq,GripVertical:Bg,GripVerticalIcon:Bg,Group:Mq,GroupIcon:Mq,Guitar:Tq,GuitarIcon:Tq,Ham:Aq,HamIcon:Aq,Hammer:Eq,HammerIcon:Eq,Hand:Dq,HandCoins:Iq,HandCoinsIcon:Iq,HandHeart:Pq,HandHeartIcon:Pq,HandHelping:a2,HandHelpingIcon:a2,HandIcon:Dq,HandMetal:Lq,HandMetalIcon:Lq,HandPlatter:Oq,HandPlatterIcon:Oq,Handshake:Rq,HandshakeIcon:Rq,HardDrive:dA,HardDriveDownload:Fq,HardDriveDownloadIcon:Fq,HardDriveIcon:dA,HardDriveUpload:zq,HardDriveUploadIcon:zq,HardHat:Bq,HardHatIcon:Bq,Hash:TS,HashIcon:TS,Haze:$q,HazeIcon:$q,HdmiPort:Uq,HdmiPortIcon:Uq,Heading:Gq,Heading1:uA,Heading1Icon:uA,Heading2:hA,Heading2Icon:hA,Heading3:qq,Heading3Icon:qq,Heading4:Vq,Heading4Icon:Vq,Heading5:Hq,Heading5Icon:Hq,Heading6:Wq,Heading6Icon:Wq,HeadingIcon:Gq,HeadphoneOff:Kq,HeadphoneOffIcon:Kq,Headphones:Zq,HeadphonesIcon:Zq,Headset:Yq,HeadsetIcon:Yq,Heart:bi,HeartCrack:Xq,HeartCrackIcon:Xq,HeartHandshake:Qq,HeartHandshakeIcon:Qq,HeartIcon:bi,HeartOff:Jq,HeartOffIcon:Jq,HeartPulse:eV,HeartPulseIcon:eV,Heater:tV,HeaterIcon:tV,HelpCircle:Zx,HelpCircleIcon:Zx,HelpingHand:a2,HelpingHandIcon:a2,Hexagon:rV,HexagonIcon:rV,Highlighter:sV,HighlighterIcon:sV,History:AS,HistoryIcon:AS,Home:sa,HomeIcon:sa,Hop:aV,HopIcon:aV,HopOff:nV,HopOffIcon:nV,Hospital:iV,HospitalIcon:iV,Hotel:oV,HotelIcon:oV,Hourglass:lV,HourglassIcon:lV,House:sa,HouseIcon:sa,HousePlug:cV,HousePlugIcon:cV,HousePlus:dV,HousePlusIcon:dV,IceCream:o2,IceCream2:i2,IceCream2Icon:i2,IceCreamBowl:i2,IceCreamBowlIcon:i2,IceCreamCone:o2,IceCreamConeIcon:o2,IceCreamIcon:o2,Icon:EIe,IdCard:uV,IdCardIcon:uV,Image:El,ImageDown:hV,ImageDownIcon:hV,ImageIcon:El,ImageMinus:mV,ImageMinusIcon:mV,ImageOff:pV,ImageOffIcon:pV,ImagePlay:fV,ImagePlayIcon:fV,ImagePlus:Z1,ImagePlusIcon:Z1,ImageUp:gV,ImageUpIcon:gV,ImageUpscale:xV,ImageUpscaleIcon:xV,Images:yV,ImagesIcon:yV,Import:vV,ImportIcon:vV,Inbox:_V,InboxIcon:_V,Indent:c2,IndentDecrease:l2,IndentDecreaseIcon:l2,IndentIcon:c2,IndentIncrease:c2,IndentIncreaseIcon:c2,IndianRupee:bV,IndianRupeeIcon:bV,Infinity:wV,InfinityIcon:wV,Info:jV,InfoIcon:jV,Inspect:pw,InspectIcon:pw,InspectionPanel:kV,InspectionPanelIcon:kV,Instagram:_u,InstagramIcon:_u,Italic:ES,ItalicIcon:ES,IterationCcw:NV,IterationCcwIcon:NV,IterationCw:SV,IterationCwIcon:SV,JapaneseYen:CV,JapaneseYenIcon:CV,Joystick:MV,JoystickIcon:MV,Kanban:hy,KanbanIcon:hy,KanbanSquare:cw,KanbanSquareDashed:rw,KanbanSquareDashedIcon:rw,KanbanSquareIcon:cw,Key:xm,KeyIcon:xm,KeyRound:zj,KeyRoundIcon:zj,KeySquare:TV,KeySquareIcon:TV,Keyboard:IV,KeyboardIcon:IV,KeyboardMusic:AV,KeyboardMusicIcon:AV,KeyboardOff:EV,KeyboardOffIcon:EV,Lamp:FV,LampCeiling:PV,LampCeilingIcon:PV,LampDesk:LV,LampDeskIcon:LV,LampFloor:OV,LampFloorIcon:OV,LampIcon:FV,LampWallDown:DV,LampWallDownIcon:DV,LampWallUp:RV,LampWallUpIcon:RV,LandPlot:zV,LandPlotIcon:zV,Landmark:BV,LandmarkIcon:BV,Languages:$V,LanguagesIcon:$V,Laptop:qV,Laptop2:d2,Laptop2Icon:d2,LaptopIcon:qV,LaptopMinimal:d2,LaptopMinimalCheck:UV,LaptopMinimalCheckIcon:UV,LaptopMinimalIcon:d2,Lasso:HV,LassoIcon:HV,LassoSelect:VV,LassoSelectIcon:VV,Laugh:WV,LaughIcon:WV,Layers:ZV,Layers2:GV,Layers2Icon:GV,Layers3:KV,Layers3Icon:KV,LayersIcon:ZV,Layout:K0,LayoutDashboard:Bj,LayoutDashboardIcon:Bj,LayoutGrid:pp,LayoutGridIcon:pp,LayoutIcon:K0,LayoutList:YV,LayoutListIcon:YV,LayoutPanelLeft:XV,LayoutPanelLeftIcon:XV,LayoutPanelTop:QV,LayoutPanelTopIcon:QV,LayoutTemplate:$j,LayoutTemplateIcon:$j,Leaf:JV,LeafIcon:JV,LeafyGreen:eH,LeafyGreenIcon:eH,Lectern:tH,LecternIcon:tH,LetterText:rH,LetterTextIcon:rH,Library:IS,LibraryBig:sH,LibraryBigIcon:sH,LibraryIcon:IS,LibrarySquare:dw,LibrarySquareIcon:dw,LifeBuoy:PS,LifeBuoyIcon:PS,Ligature:nH,LigatureIcon:nH,Lightbulb:my,LightbulbIcon:my,LightbulbOff:aH,LightbulbOffIcon:aH,LineChart:ab,LineChartIcon:ab,Link:zo,Link2:ym,Link2Icon:ym,Link2Off:iH,Link2OffIcon:iH,LinkIcon:zo,Linkedin:vm,LinkedinIcon:vm,List:fp,ListCheck:oH,ListCheckIcon:oH,ListChecks:lH,ListChecksIcon:lH,ListCollapse:cH,ListCollapseIcon:cH,ListEnd:dH,ListEndIcon:dH,ListFilter:uH,ListFilterIcon:uH,ListIcon:fp,ListMinus:hH,ListMinusIcon:hH,ListMusic:mH,ListMusicIcon:mH,ListOrdered:LS,ListOrderedIcon:LS,ListPlus:pH,ListPlusIcon:pH,ListRestart:fH,ListRestartIcon:fH,ListStart:gH,ListStartIcon:gH,ListTodo:xH,ListTodoIcon:xH,ListTree:yH,ListTreeIcon:yH,ListVideo:vH,ListVideoIcon:vH,ListX:_H,ListXIcon:_H,Loader:wH,Loader2:Vr,Loader2Icon:Vr,LoaderCircle:Vr,LoaderCircleIcon:Vr,LoaderIcon:wH,LoaderPinwheel:bH,LoaderPinwheelIcon:bH,Locate:mA,LocateFixed:jH,LocateFixedIcon:jH,LocateIcon:mA,LocateOff:kH,LocateOffIcon:kH,Lock:nh,LockIcon:nh,LockKeyhole:NH,LockKeyholeIcon:NH,LockKeyholeOpen:u2,LockKeyholeOpenIcon:u2,LockOpen:h2,LockOpenIcon:h2,LogIn:OS,LogInIcon:OS,LogOut:DS,LogOutIcon:DS,Logs:SH,LogsIcon:SH,Lollipop:CH,LollipopIcon:CH,LucideAArrowDown:u8,LucideAArrowUp:h8,LucideALargeSmall:m8,LucideAccessibility:p8,LucideActivity:Og,LucideActivitySquare:O2,LucideAirVent:f8,LucideAirplay:g8,LucideAlarmCheck:R_,LucideAlarmClock:y8,LucideAlarmClockCheck:R_,LucideAlarmClockMinus:F_,LucideAlarmClockOff:x8,LucideAlarmClockPlus:z_,LucideAlarmMinus:F_,LucideAlarmPlus:z_,LucideAlarmSmoke:v8,LucideAlbum:_8,LucideAlertCircle:vl,LucideAlertOctagon:f2,LucideAlertTriangle:Zu,LucideAlignCenter:wS,LucideAlignCenterHorizontal:b8,LucideAlignCenterVertical:w8,LucideAlignEndHorizontal:j8,LucideAlignEndVertical:k8,LucideAlignHorizontalDistributeCenter:N8,LucideAlignHorizontalDistributeEnd:S8,LucideAlignHorizontalDistributeStart:C8,LucideAlignHorizontalJustifyCenter:M8,LucideAlignHorizontalJustifyEnd:T8,LucideAlignHorizontalJustifyStart:A8,LucideAlignHorizontalSpaceAround:E8,LucideAlignHorizontalSpaceBetween:I8,LucideAlignJustify:P8,LucideAlignLeft:jS,LucideAlignRight:kS,LucideAlignStartHorizontal:L8,LucideAlignStartVertical:O8,LucideAlignVerticalDistributeCenter:D8,LucideAlignVerticalDistributeEnd:R8,LucideAlignVerticalDistributeStart:F8,LucideAlignVerticalJustifyCenter:z8,LucideAlignVerticalJustifyEnd:B8,LucideAlignVerticalJustifyStart:$8,LucideAlignVerticalSpaceAround:U8,LucideAlignVerticalSpaceBetween:q8,LucideAmbulance:V8,LucideAmpersand:H8,LucideAmpersands:W8,LucideAmphora:G8,LucideAnchor:K8,LucideAngry:Z8,LucideAnnoyed:Y8,LucideAntenna:X8,LucideAnvil:Q8,LucideAperture:J8,LucideAppWindow:sA,LucideAppWindowMac:eD,LucideApple:tD,LucideArchive:nA,LucideArchiveRestore:rD,LucideArchiveX:sD,LucideAreaChart:J_,LucideArmchair:nD,LucideArrowBigDown:iD,LucideArrowBigDownDash:aD,LucideArrowBigLeft:lD,LucideArrowBigLeftDash:oD,LucideArrowBigRight:dD,LucideArrowBigRightDash:cD,LucideArrowBigUp:hD,LucideArrowBigUpDash:uD,LucideArrowDown:ly,LucideArrowDown01:mD,LucideArrowDown10:pD,LucideArrowDownAZ:B_,LucideArrowDownAz:B_,LucideArrowDownCircle:ub,LucideArrowDownFromLine:fD,LucideArrowDownLeft:gD,LucideArrowDownLeftFromCircle:mb,LucideArrowDownLeftFromSquare:B2,LucideArrowDownLeftSquare:D2,LucideArrowDownNarrowWide:xD,LucideArrowDownRight:yD,LucideArrowDownRightFromCircle:pb,LucideArrowDownRightFromSquare:$2,LucideArrowDownRightSquare:R2,LucideArrowDownSquare:F2,LucideArrowDownToDot:vD,LucideArrowDownToLine:_D,LucideArrowDownUp:bD,LucideArrowDownWideNarrow:$_,LucideArrowDownZA:U_,LucideArrowDownZa:U_,LucideArrowLeft:wi,LucideArrowLeftCircle:hb,LucideArrowLeftFromLine:wD,LucideArrowLeftRight:jD,LucideArrowLeftSquare:z2,LucideArrowLeftToLine:kD,LucideArrowRight:to,LucideArrowRightCircle:xb,LucideArrowRightFromLine:ND,LucideArrowRightLeft:SD,LucideArrowRightSquare:V2,LucideArrowRightToLine:CD,LucideArrowUp:hp,LucideArrowUp01:MD,LucideArrowUp10:TD,LucideArrowUpAZ:q_,LucideArrowUpAz:q_,LucideArrowUpCircle:yb,LucideArrowUpDown:Dg,LucideArrowUpFromDot:AD,LucideArrowUpFromLine:ED,LucideArrowUpLeft:ID,LucideArrowUpLeftFromCircle:fb,LucideArrowUpLeftFromSquare:U2,LucideArrowUpLeftSquare:H2,LucideArrowUpNarrowWide:V_,LucideArrowUpRight:PD,LucideArrowUpRightFromCircle:gb,LucideArrowUpRightFromSquare:q2,LucideArrowUpRightSquare:W2,LucideArrowUpSquare:G2,LucideArrowUpToLine:LD,LucideArrowUpWideNarrow:OD,LucideArrowUpZA:H_,LucideArrowUpZa:H_,LucideArrowsUpFromLine:DD,LucideAsterisk:RD,LucideAsteriskSquare:K2,LucideAtSign:FD,LucideAtom:zD,LucideAudioLines:BD,LucideAudioWaveform:$D,LucideAward:$l,LucideAxe:UD,LucideAxis3D:W_,LucideAxis3d:W_,LucideBaby:qD,LucideBackpack:VD,LucideBadge:iR,LucideBadgeAlert:HD,LucideBadgeCent:WD,LucideBadgeCheck:G_,LucideBadgeDollarSign:GD,LucideBadgeEuro:KD,LucideBadgeHelp:ZD,LucideBadgeIndianRupee:YD,LucideBadgeInfo:XD,LucideBadgeJapaneseYen:QD,LucideBadgeMinus:JD,LucideBadgePercent:eR,LucideBadgePlus:tR,LucideBadgePoundSterling:rR,LucideBadgeRussianRuble:sR,LucideBadgeSwissFranc:nR,LucideBadgeX:aR,LucideBaggageClaim:oR,LucideBan:lR,LucideBanana:cR,LucideBandage:dR,LucideBanknote:uR,LucideBarChart:ib,LucideBarChart2:ob,LucideBarChart3:wc,LucideBarChart4:nb,LucideBarChartBig:sb,LucideBarChartHorizontal:tb,LucideBarChartHorizontalBig:eb,LucideBarcode:hR,LucideBaseline:mR,LucideBath:$1,LucideBattery:vR,LucideBatteryCharging:pR,LucideBatteryFull:fR,LucideBatteryLow:gR,LucideBatteryMedium:xR,LucideBatteryWarning:yR,LucideBeaker:_R,LucideBean:wR,LucideBeanOff:bR,LucideBed:U1,LucideBedDouble:jR,LucideBedSingle:kR,LucideBeef:NR,LucideBeer:CR,LucideBeerOff:SR,LucideBell:Rg,LucideBellDot:MR,LucideBellElectric:TR,LucideBellMinus:AR,LucideBellOff:Ej,LucideBellPlus:ER,LucideBellRing:IR,LucideBetweenHorizonalEnd:K_,LucideBetweenHorizonalStart:Z_,LucideBetweenHorizontalEnd:K_,LucideBetweenHorizontalStart:Z_,LucideBetweenVerticalEnd:PR,LucideBetweenVerticalStart:LR,LucideBicepsFlexed:OR,LucideBike:DR,LucideBinary:RR,LucideBinoculars:FR,LucideBiohazard:zR,LucideBird:BR,LucideBitcoin:$R,LucideBlend:UR,LucideBlinds:qR,LucideBlocks:VR,LucideBluetooth:KR,LucideBluetoothConnected:HR,LucideBluetoothOff:WR,LucideBluetoothSearching:GR,LucideBold:NS,LucideBolt:ZR,LucideBomb:YR,LucideBone:XR,LucideBook:vF,LucideBookA:QR,LucideBookAudio:JR,LucideBookCheck:eF,LucideBookCopy:tF,LucideBookDashed:Y_,LucideBookDown:rF,LucideBookHeadphones:sF,LucideBookHeart:nF,LucideBookImage:aF,LucideBookKey:iF,LucideBookLock:oF,LucideBookMarked:lF,LucideBookMinus:cF,LucideBookOpen:q1,LucideBookOpenCheck:dF,LucideBookOpenText:uF,LucideBookPlus:hF,LucideBookTemplate:Y_,LucideBookText:mF,LucideBookType:pF,LucideBookUp:gF,LucideBookUp2:fF,LucideBookUser:xF,LucideBookX:yF,LucideBookmark:Tf,LucideBookmarkCheck:_F,LucideBookmarkMinus:bF,LucideBookmarkPlus:aA,LucideBookmarkX:wF,LucideBoomBox:jF,LucideBot:SS,LucideBotMessageSquare:kF,LucideBotOff:NF,LucideBox:SF,LucideBoxSelect:nw,LucideBoxes:CF,LucideBraces:X_,LucideBrackets:MF,LucideBrain:iA,LucideBrainCircuit:TF,LucideBrainCog:AF,LucideBrickWall:EF,LucideBriefcase:rh,LucideBriefcaseBusiness:IF,LucideBriefcaseConveyorBelt:PF,LucideBriefcaseMedical:LF,LucideBringToFront:OF,LucideBrush:DF,LucideBug:zF,LucideBugOff:RF,LucideBugPlay:FF,LucideBuilding:Ij,LucideBuilding2:pi,LucideBus:$F,LucideBusFront:BF,LucideCable:qF,LucideCableCar:UF,LucideCake:fm,LucideCakeSlice:VF,LucideCalculator:HF,LucideCalendar:jn,LucideCalendar1:WF,LucideCalendarArrowDown:GF,LucideCalendarArrowUp:KF,LucideCalendarCheck:YF,LucideCalendarCheck2:ZF,LucideCalendarClock:oA,LucideCalendarCog:XF,LucideCalendarDays:Af,LucideCalendarFold:QF,LucideCalendarHeart:JF,LucideCalendarMinus:tz,LucideCalendarMinus2:ez,LucideCalendarOff:rz,LucideCalendarPlus:Pj,LucideCalendarPlus2:sz,LucideCalendarRange:nz,LucideCalendarSearch:az,LucideCalendarSync:iz,LucideCalendarX:lz,LucideCalendarX2:oz,LucideCamera:Fg,LucideCameraOff:cz,LucideCandlestickChart:rb,LucideCandy:hz,LucideCandyCane:dz,LucideCandyOff:uz,LucideCannabis:mz,LucideCaptions:Q_,LucideCaptionsOff:pz,LucideCar:xz,LucideCarFront:fz,LucideCarTaxiFront:gz,LucideCaravan:yz,LucideCarrot:vz,LucideCaseLower:_z,LucideCaseSensitive:bz,LucideCaseUpper:wz,LucideCassetteTape:jz,LucideCast:kz,LucideCastle:Nz,LucideCat:Sz,LucideCctv:Cz,LucideChartArea:J_,LucideChartBar:tb,LucideChartBarBig:eb,LucideChartBarDecreasing:Mz,LucideChartBarIncreasing:Tz,LucideChartBarStacked:Az,LucideChartCandlestick:rb,LucideChartColumn:wc,LucideChartColumnBig:sb,LucideChartColumnDecreasing:Ez,LucideChartColumnIncreasing:nb,LucideChartColumnStacked:Iz,LucideChartGantt:Pz,LucideChartLine:ab,LucideChartNetwork:Lz,LucideChartNoAxesColumn:ob,LucideChartNoAxesColumnDecreasing:Oz,LucideChartNoAxesColumnIncreasing:ib,LucideChartNoAxesCombined:Dz,LucideChartNoAxesGantt:lb,LucideChartPie:cb,LucideChartScatter:db,LucideChartSpline:Rz,LucideCheck:fi,LucideCheckCheck:Fz,LucideCheckCircle:ii,LucideCheckCircle2:Ki,LucideCheckSquare:X0,LucideCheckSquare2:Y2,LucideChefHat:zz,LucideCherry:Bz,LucideChevronDown:gd,LucideChevronDownCircle:vb,LucideChevronDownSquare:X2,LucideChevronFirst:$z,LucideChevronLast:Uz,LucideChevronLeft:Sc,LucideChevronLeftCircle:_b,LucideChevronLeftSquare:Q2,LucideChevronRight:Zi,LucideChevronRightCircle:bb,LucideChevronRightSquare:J2,LucideChevronUp:zg,LucideChevronUpCircle:wb,LucideChevronUpSquare:ew,LucideChevronsDown:Vz,LucideChevronsDownUp:qz,LucideChevronsLeft:Gz,LucideChevronsLeftRight:Wz,LucideChevronsLeftRightEllipsis:Hz,LucideChevronsRight:Zz,LucideChevronsRightLeft:Kz,LucideChevronsUp:Yz,LucideChevronsUpDown:cy,LucideChrome:Xz,LucideChurch:Qz,LucideCigarette:e7,LucideCigaretteOff:Jz,LucideCircle:sh,LucideCircleAlert:vl,LucideCircleArrowDown:ub,LucideCircleArrowLeft:hb,LucideCircleArrowOutDownLeft:mb,LucideCircleArrowOutDownRight:pb,LucideCircleArrowOutUpLeft:fb,LucideCircleArrowOutUpRight:gb,LucideCircleArrowRight:xb,LucideCircleArrowUp:yb,LucideCircleCheck:Ki,LucideCircleCheckBig:ii,LucideCircleChevronDown:vb,LucideCircleChevronLeft:_b,LucideCircleChevronRight:bb,LucideCircleChevronUp:wb,LucideCircleDashed:t7,LucideCircleDivide:jb,LucideCircleDollarSign:r7,LucideCircleDot:n7,LucideCircleDotDashed:s7,LucideCircleEllipsis:a7,LucideCircleEqual:i7,LucideCircleFadingArrowUp:o7,LucideCircleFadingPlus:l7,LucideCircleGauge:kb,LucideCircleHelp:Zx,LucideCircleMinus:Nb,LucideCircleOff:c7,LucideCircleParking:Cb,LucideCircleParkingOff:Sb,LucideCirclePause:Mb,LucideCirclePercent:Tb,LucideCirclePlay:ap,LucideCirclePlus:Ab,LucideCirclePower:Eb,LucideCircleSlash:d7,LucideCircleSlash2:Ib,LucideCircleSlashed:Ib,LucideCircleStop:Pb,LucideCircleUser:Ob,LucideCircleUserRound:Lb,LucideCircleX:jc,LucideCircuitBoard:u7,LucideCitrus:h7,LucideClapperboard:m7,LucideClipboard:_7,LucideClipboardCheck:lA,LucideClipboardCopy:p7,LucideClipboardEdit:Rb,LucideClipboardList:cA,LucideClipboardMinus:f7,LucideClipboardPaste:g7,LucideClipboardPen:Rb,LucideClipboardPenLine:Db,LucideClipboardPlus:x7,LucideClipboardSignature:Db,LucideClipboardType:y7,LucideClipboardX:v7,LucideClock:Ra,LucideClock1:b7,LucideClock10:w7,LucideClock11:j7,LucideClock12:k7,LucideClock2:N7,LucideClock3:S7,LucideClock4:C7,LucideClock5:M7,LucideClock6:T7,LucideClock7:A7,LucideClock8:E7,LucideClock9:I7,LucideClockAlert:P7,LucideClockArrowDown:L7,LucideClockArrowUp:O7,LucideCloud:Y7,LucideCloudAlert:D7,LucideCloudCog:R7,LucideCloudDownload:Fb,LucideCloudDrizzle:F7,LucideCloudFog:z7,LucideCloudHail:B7,LucideCloudLightning:$7,LucideCloudMoon:q7,LucideCloudMoonRain:U7,LucideCloudOff:V7,LucideCloudRain:W7,LucideCloudRainWind:H7,LucideCloudSnow:G7,LucideCloudSun:Z7,LucideCloudSunRain:K7,LucideCloudUpload:zb,LucideCloudy:X7,LucideClover:ry,LucideClub:Q7,LucideCode:Lj,LucideCode2:Bb,LucideCodeSquare:tw,LucideCodeXml:Bb,LucideCodepen:J7,LucideCodesandbox:e9,LucideCoffee:Oj,LucideCog:t9,LucideCoins:r9,LucideColumns:$b,LucideColumns2:$b,LucideColumns3:Ub,LucideColumns4:s9,LucideCombine:n9,LucideCommand:a9,LucideCompass:i9,LucideComponent:o9,LucideComputer:l9,LucideConciergeBell:c9,LucideCone:d9,LucideConstruction:u9,LucideContact:h9,LucideContact2:qb,LucideContactRound:qb,LucideContainer:m9,LucideContrast:p9,LucideCookie:f9,LucideCookingPot:g9,LucideCopy:Mo,LucideCopyCheck:x9,LucideCopyMinus:y9,LucideCopyPlus:v9,LucideCopySlash:_9,LucideCopyX:b9,LucideCopyleft:w9,LucideCopyright:j9,LucideCornerDownLeft:k9,LucideCornerDownRight:N9,LucideCornerLeftDown:S9,LucideCornerLeftUp:C9,LucideCornerRightDown:M9,LucideCornerRightUp:T9,LucideCornerUpLeft:A9,LucideCornerUpRight:E9,LucideCpu:I9,LucideCreativeCommons:P9,LucideCreditCard:mp,LucideCroissant:L9,LucideCrop:O9,LucideCross:D9,LucideCrosshair:R9,LucideCrown:V1,LucideCuboid:F9,LucideCupSoda:z9,LucideCurlyBraces:X_,LucideCurrency:B9,LucideCylinder:$9,LucideDam:U9,LucideDatabase:H9,LucideDatabaseBackup:q9,LucideDatabaseZap:V9,LucideDelete:W9,LucideDessert:G9,LucideDiameter:K9,LucideDiamond:X9,LucideDiamondMinus:Z9,LucideDiamondPercent:Vb,LucideDiamondPlus:Y9,LucideDice1:Q9,LucideDice2:J9,LucideDice3:eB,LucideDice4:tB,LucideDice5:rB,LucideDice6:sB,LucideDices:nB,LucideDiff:aB,LucideDisc:cB,LucideDisc2:iB,LucideDisc3:oB,LucideDiscAlbum:lB,LucideDivide:dB,LucideDivideCircle:jb,LucideDivideSquare:aw,LucideDna:hB,LucideDnaOff:uB,LucideDock:mB,LucideDog:pB,LucideDollarSign:zd,LucideDonut:fB,LucideDoorClosed:gB,LucideDoorOpen:Dj,LucideDot:xB,LucideDotSquare:iw,LucideDownload:$i,LucideDownloadCloud:Fb,LucideDraftingCompass:yB,LucideDrama:vB,LucideDribbble:_B,LucideDrill:bB,LucideDroplet:wB,LucideDroplets:jB,LucideDrum:kB,LucideDrumstick:NB,LucideDumbbell:SB,LucideEar:MB,LucideEarOff:CB,LucideEarth:Hb,LucideEarthLock:TB,LucideEclipse:AB,LucideEdit:vc,LucideEdit2:Y0,LucideEdit3:Z0,LucideEgg:CS,LucideEggFried:EB,LucideEggOff:IB,LucideEllipsis:xf,LucideEllipsisVertical:Ng,LucideEqual:OB,LucideEqualApproximately:PB,LucideEqualNot:LB,LucideEqualSquare:ow,LucideEraser:DB,LucideEthernetPort:RB,LucideEuro:FB,LucideExpand:zB,LucideExternalLink:Sn,LucideEye:mo,LucideEyeClosed:BB,LucideEyeOff:Ef,LucideFacebook:au,LucideFactory:$B,LucideFan:UB,LucideFastForward:qB,LucideFeather:VB,LucideFence:HB,LucideFerrisWheel:WB,LucideFigma:GB,LucideFile:MS,LucideFileArchive:KB,LucideFileAudio:YB,LucideFileAudio2:ZB,LucideFileAxis3D:Wb,LucideFileAxis3d:Wb,LucideFileBadge:QB,LucideFileBadge2:XB,LucideFileBarChart:Gb,LucideFileBarChart2:Kb,LucideFileBox:JB,LucideFileChartColumn:Kb,LucideFileChartColumnIncreasing:Gb,LucideFileChartLine:Zb,LucideFileChartPie:Yb,LucideFileCheck:t$,LucideFileCheck2:e$,LucideFileClock:r$,LucideFileCode:n$,LucideFileCode2:s$,LucideFileCog:Xb,LucideFileCog2:Xb,LucideFileDiff:a$,LucideFileDigit:i$,LucideFileDown:o$,LucideFileEdit:Jb,LucideFileHeart:l$,LucideFileImage:H1,LucideFileInput:c$,LucideFileJson:u$,LucideFileJson2:d$,LucideFileKey:m$,LucideFileKey2:h$,LucideFileLineChart:Zb,LucideFileLock:f$,LucideFileLock2:p$,LucideFileMinus:x$,LucideFileMinus2:g$,LucideFileMusic:y$,LucideFileOutput:v$,LucideFilePen:Jb,LucideFilePenLine:Qb,LucideFilePieChart:Yb,LucideFilePlus:b$,LucideFilePlus2:_$,LucideFileQuestion:w$,LucideFileScan:j$,LucideFileSearch:N$,LucideFileSearch2:k$,LucideFileSignature:Qb,LucideFileSliders:S$,LucideFileSpreadsheet:W1,LucideFileStack:C$,LucideFileSymlink:M$,LucideFileTerminal:T$,LucideFileText:ga,LucideFileType:E$,LucideFileType2:A$,LucideFileUp:I$,LucideFileUser:P$,LucideFileVideo:O$,LucideFileVideo2:L$,LucideFileVolume:R$,LucideFileVolume2:D$,LucideFileWarning:F$,LucideFileX:B$,LucideFileX2:z$,LucideFiles:$$,LucideFilm:Id,LucideFilter:G1,LucideFilterX:U$,LucideFingerprint:q$,LucideFireExtinguisher:V$,LucideFish:G$,LucideFishOff:H$,LucideFishSymbol:W$,LucideFlag:dy,LucideFlagOff:K$,LucideFlagTriangleLeft:Z$,LucideFlagTriangleRight:Y$,LucideFlame:gm,LucideFlameKindling:X$,LucideFlashlight:J$,LucideFlashlightOff:Q$,LucideFlaskConical:Rj,LucideFlaskConicalOff:eU,LucideFlaskRound:tU,LucideFlipHorizontal:sU,LucideFlipHorizontal2:rU,LucideFlipVertical:aU,LucideFlipVertical2:nU,LucideFlower:iU,LucideFlower2:wf,LucideFocus:oU,LucideFoldHorizontal:lU,LucideFoldVertical:cU,LucideFolder:DU,LucideFolderArchive:dU,LucideFolderCheck:uU,LucideFolderClock:hU,LucideFolderClosed:mU,LucideFolderCode:pU,LucideFolderCog:e2,LucideFolderCog2:e2,LucideFolderDot:fU,LucideFolderDown:gU,LucideFolderEdit:t2,LucideFolderGit:yU,LucideFolderGit2:xU,LucideFolderHeart:vU,LucideFolderInput:_U,LucideFolderKanban:bU,LucideFolderKey:wU,LucideFolderLock:jU,LucideFolderMinus:kU,LucideFolderOpen:If,LucideFolderOpenDot:NU,LucideFolderOutput:SU,LucideFolderPen:t2,LucideFolderPlus:CU,LucideFolderRoot:MU,LucideFolderSearch:AU,LucideFolderSearch2:TU,LucideFolderSymlink:EU,LucideFolderSync:IU,LucideFolderTree:PU,LucideFolderUp:LU,LucideFolderX:OU,LucideFolders:RU,LucideFootprints:FU,LucideForkKnife:Ww,LucideForkKnifeCrossed:Hw,LucideForklift:zU,LucideFormInput:C2,LucideForward:BU,LucideFrame:$U,LucideFramer:UU,LucideFrown:qU,LucideFuel:VU,LucideFullscreen:HU,LucideFunctionSquare:lw,LucideGalleryHorizontal:GU,LucideGalleryHorizontalEnd:WU,LucideGalleryThumbnails:KU,LucideGalleryVertical:YU,LucideGalleryVerticalEnd:ZU,LucideGamepad:QU,LucideGamepad2:XU,LucideGanttChart:lb,LucideGanttChartSquare:gg,LucideGauge:JU,LucideGaugeCircle:kb,LucideGavel:eq,LucideGem:tq,LucideGhost:Fj,LucideGift:oo,LucideGitBranch:sq,LucideGitBranchPlus:rq,LucideGitCommit:r2,LucideGitCommitHorizontal:r2,LucideGitCommitVertical:nq,LucideGitCompare:iq,LucideGitCompareArrows:aq,LucideGitFork:oq,LucideGitGraph:lq,LucideGitMerge:cq,LucideGitPullRequest:fq,LucideGitPullRequestArrow:dq,LucideGitPullRequestClosed:uq,LucideGitPullRequestCreate:mq,LucideGitPullRequestCreateArrow:hq,LucideGitPullRequestDraft:pq,LucideGithub:gq,LucideGitlab:xq,LucideGlassWater:yq,LucideGlasses:vq,LucideGlobe:uy,LucideGlobe2:Hb,LucideGlobeLock:_q,LucideGoal:bq,LucideGrab:wq,LucideGraduationCap:K1,LucideGrape:jq,LucideGrid:sm,LucideGrid2X2:n2,LucideGrid2X2Plus:s2,LucideGrid2x2:n2,LucideGrid2x2Check:kq,LucideGrid2x2Plus:s2,LucideGrid2x2X:Nq,LucideGrid3X3:sm,LucideGrid3x3:sm,LucideGrip:Cq,LucideGripHorizontal:Sq,LucideGripVertical:Bg,LucideGroup:Mq,LucideGuitar:Tq,LucideHam:Aq,LucideHammer:Eq,LucideHand:Dq,LucideHandCoins:Iq,LucideHandHeart:Pq,LucideHandHelping:a2,LucideHandMetal:Lq,LucideHandPlatter:Oq,LucideHandshake:Rq,LucideHardDrive:dA,LucideHardDriveDownload:Fq,LucideHardDriveUpload:zq,LucideHardHat:Bq,LucideHash:TS,LucideHaze:$q,LucideHdmiPort:Uq,LucideHeading:Gq,LucideHeading1:uA,LucideHeading2:hA,LucideHeading3:qq,LucideHeading4:Vq,LucideHeading5:Hq,LucideHeading6:Wq,LucideHeadphoneOff:Kq,LucideHeadphones:Zq,LucideHeadset:Yq,LucideHeart:bi,LucideHeartCrack:Xq,LucideHeartHandshake:Qq,LucideHeartOff:Jq,LucideHeartPulse:eV,LucideHeater:tV,LucideHelpCircle:Zx,LucideHelpingHand:a2,LucideHexagon:rV,LucideHighlighter:sV,LucideHistory:AS,LucideHome:sa,LucideHop:aV,LucideHopOff:nV,LucideHospital:iV,LucideHotel:oV,LucideHourglass:lV,LucideHouse:sa,LucideHousePlug:cV,LucideHousePlus:dV,LucideIceCream:o2,LucideIceCream2:i2,LucideIceCreamBowl:i2,LucideIceCreamCone:o2,LucideIdCard:uV,LucideImage:El,LucideImageDown:hV,LucideImageMinus:mV,LucideImageOff:pV,LucideImagePlay:fV,LucideImagePlus:Z1,LucideImageUp:gV,LucideImageUpscale:xV,LucideImages:yV,LucideImport:vV,LucideInbox:_V,LucideIndent:c2,LucideIndentDecrease:l2,LucideIndentIncrease:c2,LucideIndianRupee:bV,LucideInfinity:wV,LucideInfo:jV,LucideInspect:pw,LucideInspectionPanel:kV,LucideInstagram:_u,LucideItalic:ES,LucideIterationCcw:NV,LucideIterationCw:SV,LucideJapaneseYen:CV,LucideJoystick:MV,LucideKanban:hy,LucideKanbanSquare:cw,LucideKanbanSquareDashed:rw,LucideKey:xm,LucideKeyRound:zj,LucideKeySquare:TV,LucideKeyboard:IV,LucideKeyboardMusic:AV,LucideKeyboardOff:EV,LucideLamp:FV,LucideLampCeiling:PV,LucideLampDesk:LV,LucideLampFloor:OV,LucideLampWallDown:DV,LucideLampWallUp:RV,LucideLandPlot:zV,LucideLandmark:BV,LucideLanguages:$V,LucideLaptop:qV,LucideLaptop2:d2,LucideLaptopMinimal:d2,LucideLaptopMinimalCheck:UV,LucideLasso:HV,LucideLassoSelect:VV,LucideLaugh:WV,LucideLayers:ZV,LucideLayers2:GV,LucideLayers3:KV,LucideLayout:K0,LucideLayoutDashboard:Bj,LucideLayoutGrid:pp,LucideLayoutList:YV,LucideLayoutPanelLeft:XV,LucideLayoutPanelTop:QV,LucideLayoutTemplate:$j,LucideLeaf:JV,LucideLeafyGreen:eH,LucideLectern:tH,LucideLetterText:rH,LucideLibrary:IS,LucideLibraryBig:sH,LucideLibrarySquare:dw,LucideLifeBuoy:PS,LucideLigature:nH,LucideLightbulb:my,LucideLightbulbOff:aH,LucideLineChart:ab,LucideLink:zo,LucideLink2:ym,LucideLink2Off:iH,LucideLinkedin:vm,LucideList:fp,LucideListCheck:oH,LucideListChecks:lH,LucideListCollapse:cH,LucideListEnd:dH,LucideListFilter:uH,LucideListMinus:hH,LucideListMusic:mH,LucideListOrdered:LS,LucideListPlus:pH,LucideListRestart:fH,LucideListStart:gH,LucideListTodo:xH,LucideListTree:yH,LucideListVideo:vH,LucideListX:_H,LucideLoader:wH,LucideLoader2:Vr,LucideLoaderCircle:Vr,LucideLoaderPinwheel:bH,LucideLocate:mA,LucideLocateFixed:jH,LucideLocateOff:kH,LucideLock:nh,LucideLockKeyhole:NH,LucideLockKeyholeOpen:u2,LucideLockOpen:h2,LucideLogIn:OS,LucideLogOut:DS,LucideLogs:SH,LucideLollipop:CH,LucideLuggage:MH,LucideMSquare:uw,LucideMagnet:TH,LucideMail:Nn,LucideMailCheck:AH,LucideMailMinus:EH,LucideMailOpen:IH,LucideMailPlus:PH,LucideMailQuestion:LH,LucideMailSearch:OH,LucideMailWarning:DH,LucideMailX:pA,LucideMailbox:RH,LucideMails:FH,LucideMap:YH,LucideMapPin:po,LucideMapPinCheck:BH,LucideMapPinCheckInside:zH,LucideMapPinHouse:$H,LucideMapPinMinus:qH,LucideMapPinMinusInside:UH,LucideMapPinOff:VH,LucideMapPinPlus:WH,LucideMapPinPlusInside:HH,LucideMapPinX:KH,LucideMapPinXInside:GH,LucideMapPinned:ZH,LucideMartini:XH,LucideMaximize:JH,LucideMaximize2:QH,LucideMedal:py,LucideMegaphone:Pf,LucideMegaphoneOff:eW,LucideMeh:tW,LucideMemoryStick:rW,LucideMenu:fA,LucideMenuSquare:hw,LucideMerge:sW,LucideMessageCircle:ql,LucideMessageCircleCode:nW,LucideMessageCircleDashed:aW,LucideMessageCircleHeart:RS,LucideMessageCircleMore:iW,LucideMessageCircleOff:oW,LucideMessageCirclePlus:lW,LucideMessageCircleQuestion:gA,LucideMessageCircleReply:cW,LucideMessageCircleWarning:dW,LucideMessageCircleX:uW,LucideMessageSquare:Bo,LucideMessageSquareCode:hW,LucideMessageSquareDashed:mW,LucideMessageSquareDiff:pW,LucideMessageSquareDot:fW,LucideMessageSquareHeart:xA,LucideMessageSquareLock:gW,LucideMessageSquareMore:xW,LucideMessageSquareOff:yW,LucideMessageSquarePlus:vW,LucideMessageSquareQuote:yA,LucideMessageSquareReply:_W,LucideMessageSquareShare:bW,LucideMessageSquareText:wW,LucideMessageSquareWarning:jW,LucideMessageSquareX:kW,LucideMessagesSquare:NW,LucideMic:vA,LucideMic2:m2,LucideMicOff:SW,LucideMicVocal:m2,LucideMicrochip:CW,LucideMicroscope:MW,LucideMicrowave:TW,LucideMilestone:AW,LucideMilk:IW,LucideMilkOff:EW,LucideMinimize:LW,LucideMinimize2:PW,LucideMinus:Y1,LucideMinusCircle:Nb,LucideMinusSquare:mw,LucideMonitor:Uj,LucideMonitorCheck:OW,LucideMonitorCog:DW,LucideMonitorDot:RW,LucideMonitorDown:FW,LucideMonitorOff:zW,LucideMonitorPause:BW,LucideMonitorPlay:$W,LucideMonitorSmartphone:UW,LucideMonitorSpeaker:qW,LucideMonitorStop:VW,LucideMonitorUp:HW,LucideMonitorX:WW,LucideMoon:KW,LucideMoonStar:GW,LucideMoreHorizontal:xf,LucideMoreVertical:Ng,LucideMountain:YW,LucideMountainSnow:ZW,LucideMouse:tG,LucideMouseOff:XW,LucideMousePointer:eG,LucideMousePointer2:QW,LucideMousePointerBan:JW,LucideMousePointerClick:X1,LucideMousePointerSquareDashed:sw,LucideMove:pG,LucideMove3D:p2,LucideMove3d:p2,LucideMoveDiagonal:sG,LucideMoveDiagonal2:rG,LucideMoveDown:iG,LucideMoveDownLeft:nG,LucideMoveDownRight:aG,LucideMoveHorizontal:oG,LucideMoveLeft:lG,LucideMoveRight:cG,LucideMoveUp:hG,LucideMoveUpLeft:dG,LucideMoveUpRight:uG,LucideMoveVertical:mG,LucideMusic:yG,LucideMusic2:fG,LucideMusic3:gG,LucideMusic4:xG,LucideNavigation:_A,LucideNavigation2:_G,LucideNavigation2Off:vG,LucideNavigationOff:bG,LucideNetwork:wG,LucideNewspaper:fy,LucideNfc:jG,LucideNotebook:CG,LucideNotebookPen:kG,LucideNotebookTabs:NG,LucideNotebookText:SG,LucideNotepadText:TG,LucideNotepadTextDashed:MG,LucideNut:EG,LucideNutOff:AG,LucideOctagon:PG,LucideOctagonAlert:f2,LucideOctagonMinus:IG,LucideOctagonPause:g2,LucideOctagonX:x2,LucideOmega:LG,LucideOption:OG,LucideOrbit:DG,LucideOrigami:RG,LucideOutdent:l2,LucidePackage:Vl,LucidePackage2:FG,LucidePackageCheck:zG,LucidePackageMinus:BG,LucidePackageOpen:$G,LucidePackagePlus:UG,LucidePackageSearch:qG,LucidePackageX:VG,LucidePaintBucket:HG,LucidePaintRoller:WG,LucidePaintbrush:GG,LucidePaintbrush2:y2,LucidePaintbrushVertical:y2,LucidePalette:Wc,LucidePalmtree:Ow,LucidePanelBottom:YG,LucidePanelBottomClose:KG,LucidePanelBottomDashed:v2,LucidePanelBottomInactive:v2,LucidePanelBottomOpen:ZG,LucidePanelLeft:j2,LucidePanelLeftClose:_2,LucidePanelLeftDashed:b2,LucidePanelLeftInactive:b2,LucidePanelLeftOpen:w2,LucidePanelRight:JG,LucidePanelRightClose:XG,LucidePanelRightDashed:k2,LucidePanelRightInactive:k2,LucidePanelRightOpen:QG,LucidePanelTop:rK,LucidePanelTopClose:eK,LucidePanelTopDashed:N2,LucidePanelTopInactive:N2,LucidePanelTopOpen:tK,LucidePanelsLeftBottom:sK,LucidePanelsLeftRight:Ub,LucidePanelsRightBottom:nK,LucidePanelsTopBottom:A2,LucidePanelsTopLeft:K0,LucidePaperclip:qj,LucideParentheses:aK,LucideParkingCircle:Cb,LucideParkingCircleOff:Sb,LucideParkingMeter:iK,LucideParkingSquare:gw,LucideParkingSquareOff:fw,LucidePartyPopper:Gc,LucidePause:_m,LucidePauseCircle:Mb,LucidePauseOctagon:g2,LucidePawPrint:oK,LucidePcCase:lK,LucidePen:Y0,LucidePenBox:vc,LucidePenLine:Z0,LucidePenOff:cK,LucidePenSquare:vc,LucidePenTool:Vj,LucidePencil:Ja,LucidePencilLine:dK,LucidePencilOff:uK,LucidePencilRuler:hK,LucidePentagon:mK,LucidePercent:FS,LucidePercentCircle:Tb,LucidePercentDiamond:Vb,LucidePercentSquare:xw,LucidePersonStanding:pK,LucidePhilippinePeso:fK,LucidePhone:Pi,LucidePhoneCall:gK,LucidePhoneForwarded:xK,LucidePhoneIncoming:yK,LucidePhoneMissed:vK,LucidePhoneOff:_K,LucidePhoneOutgoing:bK,LucidePi:wK,LucidePiSquare:yw,LucidePiano:jK,LucidePickaxe:kK,LucidePictureInPicture:SK,LucidePictureInPicture2:NK,LucidePieChart:cb,LucidePiggyBank:CK,LucidePilcrow:AK,LucidePilcrowLeft:MK,LucidePilcrowRight:TK,LucidePilcrowSquare:vw,LucidePill:IK,LucidePillBottle:EK,LucidePin:Q1,LucidePinOff:bA,LucidePipette:PK,LucidePizza:LK,LucidePlane:RK,LucidePlaneLanding:OK,LucidePlaneTakeoff:DK,LucidePlay:Hl,LucidePlayCircle:ap,LucidePlaySquare:_w,LucidePlug:wA,LucidePlug2:FK,LucidePlugZap:S2,LucidePlugZap2:S2,LucidePlus:vs,LucidePlusCircle:Ab,LucidePlusSquare:bw,LucidePocket:BK,LucidePocketKnife:zK,LucidePodcast:$K,LucidePointer:qK,LucidePointerOff:UK,LucidePopcorn:VK,LucidePopsicle:HK,LucidePoundSterling:WK,LucidePower:KK,LucidePowerCircle:Eb,LucidePowerOff:GK,LucidePowerSquare:ww,LucidePresentation:gy,LucidePrinter:jA,LucidePrinterCheck:ZK,LucideProjector:YK,LucideProportions:XK,LucidePuzzle:QK,LucidePyramid:JK,LucideQrCode:Hj,LucideQuote:kA,LucideRabbit:eZ,LucideRadar:tZ,LucideRadiation:rZ,LucideRadical:sZ,LucideRadio:Wj,LucideRadioReceiver:nZ,LucideRadioTower:aZ,LucideRadius:iZ,LucideRailSymbol:oZ,LucideRainbow:lZ,LucideRat:cZ,LucideRatio:dZ,LucideReceipt:vZ,LucideReceiptCent:uZ,LucideReceiptEuro:hZ,LucideReceiptIndianRupee:mZ,LucideReceiptJapaneseYen:pZ,LucideReceiptPoundSterling:fZ,LucideReceiptRussianRuble:gZ,LucideReceiptSwissFranc:xZ,LucideReceiptText:yZ,LucideRectangleEllipsis:C2,LucideRectangleHorizontal:_Z,LucideRectangleVertical:bZ,LucideRecycle:wZ,LucideRedo:zS,LucideRedo2:jZ,LucideRedoDot:kZ,LucideRefreshCcw:SZ,LucideRefreshCcwDot:NZ,LucideRefreshCw:Go,LucideRefreshCwOff:CZ,LucideRefrigerator:MZ,LucideRegex:TZ,LucideRemoveFormatting:AZ,LucideRepeat:NA,LucideRepeat1:EZ,LucideRepeat2:IZ,LucideReplace:LZ,LucideReplaceAll:PZ,LucideReply:SA,LucideReplyAll:OZ,LucideRewind:DZ,LucideRibbon:RZ,LucideRocket:$g,LucideRockingChair:FZ,LucideRollerCoaster:zZ,LucideRotate3D:M2,LucideRotate3d:M2,LucideRotateCcw:BS,LucideRotateCcwSquare:BZ,LucideRotateCw:CA,LucideRotateCwSquare:$Z,LucideRoute:qZ,LucideRouteOff:UZ,LucideRouter:VZ,LucideRows:T2,LucideRows2:T2,LucideRows3:A2,LucideRows4:HZ,LucideRss:WZ,LucideRuler:GZ,LucideRussianRuble:KZ,LucideSailboat:ZZ,LucideSalad:YZ,LucideSandwich:XZ,LucideSatellite:JZ,LucideSatelliteDish:QZ,LucideSave:Lf,LucideSaveAll:eY,LucideSaveOff:tY,LucideScale:rY,LucideScale3D:E2,LucideScale3d:E2,LucideScaling:sY,LucideScan:uY,LucideScanBarcode:nY,LucideScanEye:aY,LucideScanFace:iY,LucideScanLine:oY,LucideScanQrCode:lY,LucideScanSearch:cY,LucideScanText:dY,LucideScatterChart:db,LucideSchool:hY,LucideSchool2:Rw,LucideScissors:pY,LucideScissorsLineDashed:mY,LucideScissorsSquare:jw,LucideScissorsSquareDashedBottom:Z2,LucideScreenShare:gY,LucideScreenShareOff:fY,LucideScroll:yY,LucideScrollText:xY,LucideSearch:ua,LucideSearchCheck:vY,LucideSearchCode:_Y,LucideSearchSlash:bY,LucideSearchX:wY,LucideSection:jY,LucideSend:ro,LucideSendHorizonal:I2,LucideSendHorizontal:I2,LucideSendToBack:kY,LucideSeparatorHorizontal:NY,LucideSeparatorVertical:SY,LucideServer:AY,LucideServerCog:CY,LucideServerCrash:MY,LucideServerOff:TY,LucideSettings:Bd,LucideSettings2:EY,LucideShapes:IY,LucideShare:MA,LucideShare2:Cc,LucideSheet:PY,LucideShell:LY,LucideShield:bm,LucideShieldAlert:OY,LucideShieldBan:DY,LucideShieldCheck:TA,LucideShieldClose:P2,LucideShieldEllipsis:RY,LucideShieldHalf:FY,LucideShieldMinus:zY,LucideShieldOff:BY,LucideShieldPlus:$Y,LucideShieldQuestion:UY,LucideShieldX:P2,LucideShip:VY,LucideShipWheel:qY,LucideShirt:HY,LucideShoppingBag:Ug,LucideShoppingBasket:WY,LucideShoppingCart:Ih,LucideShovel:GY,LucideShowerHead:KY,LucideShrink:ZY,LucideShrub:YY,LucideShuffle:XY,LucideSidebar:j2,LucideSidebarClose:_2,LucideSidebarOpen:w2,LucideSigma:QY,LucideSigmaSquare:kw,LucideSignal:sX,LucideSignalHigh:JY,LucideSignalLow:eX,LucideSignalMedium:tX,LucideSignalZero:rX,LucideSignature:nX,LucideSignpost:iX,LucideSignpostBig:aX,LucideSiren:oX,LucideSkipBack:lX,LucideSkipForward:cX,LucideSkull:dX,LucideSlack:uX,LucideSlash:hX,LucideSlashSquare:Nw,LucideSlice:mX,LucideSliders:L2,LucideSlidersHorizontal:AA,LucideSlidersVertical:L2,LucideSmartphone:xy,LucideSmartphoneCharging:pX,LucideSmartphoneNfc:fX,LucideSmile:xX,LucideSmilePlus:gX,LucideSnail:yX,LucideSnowflake:S1,LucideSofa:vX,LucideSortAsc:V_,LucideSortDesc:$_,LucideSoup:_X,LucideSpace:bX,LucideSpade:wX,LucideSparkle:jX,LucideSparkles:Bn,LucideSpeaker:kX,LucideSpeech:NX,LucideSpellCheck:CX,LucideSpellCheck2:SX,LucideSpline:MX,LucideSplit:TX,LucideSplitSquareHorizontal:Sw,LucideSplitSquareVertical:Cw,LucideSprayCan:AX,LucideSprout:EX,LucideSquare:qg,LucideSquareActivity:O2,LucideSquareArrowDown:F2,LucideSquareArrowDownLeft:D2,LucideSquareArrowDownRight:R2,LucideSquareArrowLeft:z2,LucideSquareArrowOutDownLeft:B2,LucideSquareArrowOutDownRight:$2,LucideSquareArrowOutUpLeft:U2,LucideSquareArrowOutUpRight:q2,LucideSquareArrowRight:V2,LucideSquareArrowUp:G2,LucideSquareArrowUpLeft:H2,LucideSquareArrowUpRight:W2,LucideSquareAsterisk:K2,LucideSquareBottomDashedScissors:Z2,LucideSquareChartGantt:gg,LucideSquareCheck:Y2,LucideSquareCheckBig:X0,LucideSquareChevronDown:X2,LucideSquareChevronLeft:Q2,LucideSquareChevronRight:J2,LucideSquareChevronUp:ew,LucideSquareCode:tw,LucideSquareDashed:nw,LucideSquareDashedBottom:PX,LucideSquareDashedBottomCode:IX,LucideSquareDashedKanban:rw,LucideSquareDashedMousePointer:sw,LucideSquareDivide:aw,LucideSquareDot:iw,LucideSquareEqual:ow,LucideSquareFunction:lw,LucideSquareGanttChart:gg,LucideSquareKanban:cw,LucideSquareLibrary:dw,LucideSquareM:uw,LucideSquareMenu:hw,LucideSquareMinus:mw,LucideSquareMousePointer:pw,LucideSquareParking:gw,LucideSquareParkingOff:fw,LucideSquarePen:vc,LucideSquarePercent:xw,LucideSquarePi:yw,LucideSquarePilcrow:vw,LucideSquarePlay:_w,LucideSquarePlus:bw,LucideSquarePower:ww,LucideSquareRadical:LX,LucideSquareScissors:jw,LucideSquareSigma:kw,LucideSquareSlash:Nw,LucideSquareSplitHorizontal:Sw,LucideSquareSplitVertical:Cw,LucideSquareSquare:OX,LucideSquareStack:DX,LucideSquareTerminal:Mw,LucideSquareUser:Aw,LucideSquareUserRound:Tw,LucideSquareX:Ew,LucideSquircle:RX,LucideSquirrel:FX,LucideStamp:zX,LucideStar:Mn,LucideStarHalf:BX,LucideStarOff:$X,LucideStars:Bn,LucideStepBack:UX,LucideStepForward:qX,LucideStethoscope:VX,LucideSticker:HX,LucideStickyNote:WX,LucideStopCircle:Pb,LucideStore:GX,LucideStretchHorizontal:KX,LucideStretchVertical:ZX,LucideStrikethrough:YX,LucideSubscript:XX,LucideSubtitles:Q_,LucideSun:J1,LucideSunDim:QX,LucideSunMedium:JX,LucideSunMoon:eQ,LucideSunSnow:tQ,LucideSunrise:rQ,LucideSunset:sQ,LucideSuperscript:nQ,LucideSwatchBook:aQ,LucideSwissFranc:iQ,LucideSwitchCamera:oQ,LucideSword:lQ,LucideSwords:cQ,LucideSyringe:dQ,LucideTable:xQ,LucideTable2:$S,LucideTableCellsMerge:uQ,LucideTableCellsSplit:hQ,LucideTableColumnsSplit:mQ,LucideTableOfContents:pQ,LucideTableProperties:fQ,LucideTableRowsSplit:gQ,LucideTablet:vQ,LucideTabletSmartphone:yQ,LucideTablets:_Q,LucideTag:Vg,LucideTags:bQ,LucideTally1:wQ,LucideTally2:jQ,LucideTally3:kQ,LucideTally4:NQ,LucideTally5:SQ,LucideTangent:CQ,LucideTarget:yy,LucideTelescope:MQ,LucideTent:AQ,LucideTentTree:TQ,LucideTerminal:EQ,LucideTerminalSquare:Mw,LucideTestTube:IQ,LucideTestTube2:Iw,LucideTestTubeDiagonal:Iw,LucideTestTubes:PQ,LucideText:FQ,LucideTextCursor:OQ,LucideTextCursorInput:LQ,LucideTextQuote:DQ,LucideTextSearch:RQ,LucideTextSelect:Pw,LucideTextSelection:Pw,LucideTheater:zQ,LucideThermometer:UQ,LucideThermometerSnowflake:BQ,LucideThermometerSun:$Q,LucideThumbsDown:EA,LucideThumbsUp:xd,LucideTicket:IA,LucideTicketCheck:qQ,LucideTicketMinus:VQ,LucideTicketPercent:HQ,LucideTicketPlus:WQ,LucideTicketSlash:GQ,LucideTicketX:KQ,LucideTickets:YQ,LucideTicketsPlane:ZQ,LucideTimer:JQ,LucideTimerOff:XQ,LucideTimerReset:QQ,LucideToggleLeft:eJ,LucideToggleRight:tJ,LucideToilet:rJ,LucideTornado:sJ,LucideTorus:nJ,LucideTouchpad:iJ,LucideTouchpadOff:aJ,LucideTowerControl:oJ,LucideToyBrick:lJ,LucideTractor:cJ,LucideTrafficCone:dJ,LucideTrain:Lw,LucideTrainFront:hJ,LucideTrainFrontTunnel:uJ,LucideTrainTrack:mJ,LucideTramFront:Lw,LucideTrash:pJ,LucideTrash2:Bs,LucideTreeDeciduous:fJ,LucideTreePalm:Ow,LucideTreePine:ev,LucideTrees:gJ,LucideTrello:xJ,LucideTrendingDown:Gj,LucideTrendingUp:bu,LucideTrendingUpDown:yJ,LucideTriangle:_J,LucideTriangleAlert:Zu,LucideTriangleRight:vJ,LucideTrophy:lo,LucideTruck:PA,LucideTurtle:bJ,LucideTv:jJ,LucideTv2:Dw,LucideTvMinimal:Dw,LucideTvMinimalPlay:wJ,LucideTwitch:kJ,LucideTwitter:NJ,LucideType:CJ,LucideTypeOutline:SJ,LucideUmbrella:TJ,LucideUmbrellaOff:MJ,LucideUnderline:AJ,LucideUndo:US,LucideUndo2:EJ,LucideUndoDot:IJ,LucideUnfoldHorizontal:PJ,LucideUnfoldVertical:LJ,LucideUngroup:OJ,LucideUniversity:Rw,LucideUnlink:LA,LucideUnlink2:DJ,LucideUnlock:h2,LucideUnlockKeyhole:u2,LucideUnplug:RJ,LucideUpload:so,LucideUploadCloud:zb,LucideUsb:FJ,LucideUser:oc,LucideUser2:qw,LucideUserCheck:Kj,LucideUserCheck2:Fw,LucideUserCircle:Ob,LucideUserCircle2:Lb,LucideUserCog:OA,LucideUserCog2:zw,LucideUserMinus:zJ,LucideUserMinus2:Bw,LucideUserPen:BJ,LucideUserPlus:wu,LucideUserPlus2:$w,LucideUserRound:qw,LucideUserRoundCheck:Fw,LucideUserRoundCog:zw,LucideUserRoundMinus:Bw,LucideUserRoundPen:$J,LucideUserRoundPlus:$w,LucideUserRoundSearch:UJ,LucideUserRoundX:Uw,LucideUserSearch:qJ,LucideUserSquare:Aw,LucideUserSquare2:Tw,LucideUserX:VJ,LucideUserX2:Uw,LucideUsers:qs,LucideUsers2:Vw,LucideUsersRound:Vw,LucideUtensils:Ww,LucideUtensilsCrossed:Hw,LucideUtilityPole:HJ,LucideVariable:DA,LucideVault:WJ,LucideVegan:GJ,LucideVenetianMask:KJ,LucideVerified:G_,LucideVibrate:YJ,LucideVibrateOff:ZJ,LucideVideo:Ta,LucideVideoOff:XJ,LucideVideotape:QJ,LucideView:JJ,LucideVoicemail:eee,LucideVolleyball:tee,LucideVolume:iee,LucideVolume1:ree,LucideVolume2:see,LucideVolumeOff:nee,LucideVolumeX:aee,LucideVote:oee,LucideWallet:cee,LucideWallet2:Gw,LucideWalletCards:lee,LucideWalletMinimal:Gw,LucideWallpaper:dee,LucideWand:uee,LucideWand2:Kw,LucideWandSparkles:Kw,LucideWarehouse:hee,LucideWashingMachine:mee,LucideWatch:pee,LucideWaves:fee,LucideWaypoints:gee,LucideWebcam:xee,LucideWebhook:vee,LucideWebhookOff:yee,LucideWeight:_ee,LucideWheat:wee,LucideWheatOff:bee,LucideWholeWord:jee,LucideWifi:Mee,LucideWifiHigh:kee,LucideWifiLow:Nee,LucideWifiOff:See,LucideWifiZero:Cee,LucideWind:Aee,LucideWindArrowDown:Tee,LucideWine:Iee,LucideWineOff:Eee,LucideWorkflow:Pee,LucideWorm:Lee,LucideWrapText:Oee,LucideWrench:vy,LucideX:en,LucideXCircle:jc,LucideXOctagon:x2,LucideXSquare:Ew,LucideYoutube:Dee,LucideZap:Hg,LucideZapOff:Ree,LucideZoomIn:qS,LucideZoomOut:VS,Luggage:MH,LuggageIcon:MH,MSquare:uw,MSquareIcon:uw,Magnet:TH,MagnetIcon:TH,Mail:Nn,MailCheck:AH,MailCheckIcon:AH,MailIcon:Nn,MailMinus:EH,MailMinusIcon:EH,MailOpen:IH,MailOpenIcon:IH,MailPlus:PH,MailPlusIcon:PH,MailQuestion:LH,MailQuestionIcon:LH,MailSearch:OH,MailSearchIcon:OH,MailWarning:DH,MailWarningIcon:DH,MailX:pA,MailXIcon:pA,Mailbox:RH,MailboxIcon:RH,Mails:FH,MailsIcon:FH,Map:YH,MapIcon:YH,MapPin:po,MapPinCheck:BH,MapPinCheckIcon:BH,MapPinCheckInside:zH,MapPinCheckInsideIcon:zH,MapPinHouse:$H,MapPinHouseIcon:$H,MapPinIcon:po,MapPinMinus:qH,MapPinMinusIcon:qH,MapPinMinusInside:UH,MapPinMinusInsideIcon:UH,MapPinOff:VH,MapPinOffIcon:VH,MapPinPlus:WH,MapPinPlusIcon:WH,MapPinPlusInside:HH,MapPinPlusInsideIcon:HH,MapPinX:KH,MapPinXIcon:KH,MapPinXInside:GH,MapPinXInsideIcon:GH,MapPinned:ZH,MapPinnedIcon:ZH,Martini:XH,MartiniIcon:XH,Maximize:JH,Maximize2:QH,Maximize2Icon:QH,MaximizeIcon:JH,Medal:py,MedalIcon:py,Megaphone:Pf,MegaphoneIcon:Pf,MegaphoneOff:eW,MegaphoneOffIcon:eW,Meh:tW,MehIcon:tW,MemoryStick:rW,MemoryStickIcon:rW,Menu:fA,MenuIcon:fA,MenuSquare:hw,MenuSquareIcon:hw,Merge:sW,MergeIcon:sW,MessageCircle:ql,MessageCircleCode:nW,MessageCircleCodeIcon:nW,MessageCircleDashed:aW,MessageCircleDashedIcon:aW,MessageCircleHeart:RS,MessageCircleHeartIcon:RS,MessageCircleIcon:ql,MessageCircleMore:iW,MessageCircleMoreIcon:iW,MessageCircleOff:oW,MessageCircleOffIcon:oW,MessageCirclePlus:lW,MessageCirclePlusIcon:lW,MessageCircleQuestion:gA,MessageCircleQuestionIcon:gA,MessageCircleReply:cW,MessageCircleReplyIcon:cW,MessageCircleWarning:dW,MessageCircleWarningIcon:dW,MessageCircleX:uW,MessageCircleXIcon:uW,MessageSquare:Bo,MessageSquareCode:hW,MessageSquareCodeIcon:hW,MessageSquareDashed:mW,MessageSquareDashedIcon:mW,MessageSquareDiff:pW,MessageSquareDiffIcon:pW,MessageSquareDot:fW,MessageSquareDotIcon:fW,MessageSquareHeart:xA,MessageSquareHeartIcon:xA,MessageSquareIcon:Bo,MessageSquareLock:gW,MessageSquareLockIcon:gW,MessageSquareMore:xW,MessageSquareMoreIcon:xW,MessageSquareOff:yW,MessageSquareOffIcon:yW,MessageSquarePlus:vW,MessageSquarePlusIcon:vW,MessageSquareQuote:yA,MessageSquareQuoteIcon:yA,MessageSquareReply:_W,MessageSquareReplyIcon:_W,MessageSquareShare:bW,MessageSquareShareIcon:bW,MessageSquareText:wW,MessageSquareTextIcon:wW,MessageSquareWarning:jW,MessageSquareWarningIcon:jW,MessageSquareX:kW,MessageSquareXIcon:kW,MessagesSquare:NW,MessagesSquareIcon:NW,Mic:vA,Mic2:m2,Mic2Icon:m2,MicIcon:vA,MicOff:SW,MicOffIcon:SW,MicVocal:m2,MicVocalIcon:m2,Microchip:CW,MicrochipIcon:CW,Microscope:MW,MicroscopeIcon:MW,Microwave:TW,MicrowaveIcon:TW,Milestone:AW,MilestoneIcon:AW,Milk:IW,MilkIcon:IW,MilkOff:EW,MilkOffIcon:EW,Minimize:LW,Minimize2:PW,Minimize2Icon:PW,MinimizeIcon:LW,Minus:Y1,MinusCircle:Nb,MinusCircleIcon:Nb,MinusIcon:Y1,MinusSquare:mw,MinusSquareIcon:mw,Monitor:Uj,MonitorCheck:OW,MonitorCheckIcon:OW,MonitorCog:DW,MonitorCogIcon:DW,MonitorDot:RW,MonitorDotIcon:RW,MonitorDown:FW,MonitorDownIcon:FW,MonitorIcon:Uj,MonitorOff:zW,MonitorOffIcon:zW,MonitorPause:BW,MonitorPauseIcon:BW,MonitorPlay:$W,MonitorPlayIcon:$W,MonitorSmartphone:UW,MonitorSmartphoneIcon:UW,MonitorSpeaker:qW,MonitorSpeakerIcon:qW,MonitorStop:VW,MonitorStopIcon:VW,MonitorUp:HW,MonitorUpIcon:HW,MonitorX:WW,MonitorXIcon:WW,Moon:KW,MoonIcon:KW,MoonStar:GW,MoonStarIcon:GW,MoreHorizontal:xf,MoreHorizontalIcon:xf,MoreVertical:Ng,MoreVerticalIcon:Ng,Mountain:YW,MountainIcon:YW,MountainSnow:ZW,MountainSnowIcon:ZW,Mouse:tG,MouseIcon:tG,MouseOff:XW,MouseOffIcon:XW,MousePointer:eG,MousePointer2:QW,MousePointer2Icon:QW,MousePointerBan:JW,MousePointerBanIcon:JW,MousePointerClick:X1,MousePointerClickIcon:X1,MousePointerIcon:eG,MousePointerSquareDashed:sw,MousePointerSquareDashedIcon:sw,Move:pG,Move3D:p2,Move3DIcon:p2,Move3d:p2,Move3dIcon:p2,MoveDiagonal:sG,MoveDiagonal2:rG,MoveDiagonal2Icon:rG,MoveDiagonalIcon:sG,MoveDown:iG,MoveDownIcon:iG,MoveDownLeft:nG,MoveDownLeftIcon:nG,MoveDownRight:aG,MoveDownRightIcon:aG,MoveHorizontal:oG,MoveHorizontalIcon:oG,MoveIcon:pG,MoveLeft:lG,MoveLeftIcon:lG,MoveRight:cG,MoveRightIcon:cG,MoveUp:hG,MoveUpIcon:hG,MoveUpLeft:dG,MoveUpLeftIcon:dG,MoveUpRight:uG,MoveUpRightIcon:uG,MoveVertical:mG,MoveVerticalIcon:mG,Music:yG,Music2:fG,Music2Icon:fG,Music3:gG,Music3Icon:gG,Music4:xG,Music4Icon:xG,MusicIcon:yG,Navigation:_A,Navigation2:_G,Navigation2Icon:_G,Navigation2Off:vG,Navigation2OffIcon:vG,NavigationIcon:_A,NavigationOff:bG,NavigationOffIcon:bG,Network:wG,NetworkIcon:wG,Newspaper:fy,NewspaperIcon:fy,Nfc:jG,NfcIcon:jG,Notebook:CG,NotebookIcon:CG,NotebookPen:kG,NotebookPenIcon:kG,NotebookTabs:NG,NotebookTabsIcon:NG,NotebookText:SG,NotebookTextIcon:SG,NotepadText:TG,NotepadTextDashed:MG,NotepadTextDashedIcon:MG,NotepadTextIcon:TG,Nut:EG,NutIcon:EG,NutOff:AG,NutOffIcon:AG,Octagon:PG,OctagonAlert:f2,OctagonAlertIcon:f2,OctagonIcon:PG,OctagonMinus:IG,OctagonMinusIcon:IG,OctagonPause:g2,OctagonPauseIcon:g2,OctagonX:x2,OctagonXIcon:x2,Omega:LG,OmegaIcon:LG,Option:OG,OptionIcon:OG,Orbit:DG,OrbitIcon:DG,Origami:RG,OrigamiIcon:RG,Outdent:l2,OutdentIcon:l2,Package:Vl,Package2:FG,Package2Icon:FG,PackageCheck:zG,PackageCheckIcon:zG,PackageIcon:Vl,PackageMinus:BG,PackageMinusIcon:BG,PackageOpen:$G,PackageOpenIcon:$G,PackagePlus:UG,PackagePlusIcon:UG,PackageSearch:qG,PackageSearchIcon:qG,PackageX:VG,PackageXIcon:VG,PaintBucket:HG,PaintBucketIcon:HG,PaintRoller:WG,PaintRollerIcon:WG,Paintbrush:GG,Paintbrush2:y2,Paintbrush2Icon:y2,PaintbrushIcon:GG,PaintbrushVertical:y2,PaintbrushVerticalIcon:y2,Palette:Wc,PaletteIcon:Wc,Palmtree:Ow,PalmtreeIcon:Ow,PanelBottom:YG,PanelBottomClose:KG,PanelBottomCloseIcon:KG,PanelBottomDashed:v2,PanelBottomDashedIcon:v2,PanelBottomIcon:YG,PanelBottomInactive:v2,PanelBottomInactiveIcon:v2,PanelBottomOpen:ZG,PanelBottomOpenIcon:ZG,PanelLeft:j2,PanelLeftClose:_2,PanelLeftCloseIcon:_2,PanelLeftDashed:b2,PanelLeftDashedIcon:b2,PanelLeftIcon:j2,PanelLeftInactive:b2,PanelLeftInactiveIcon:b2,PanelLeftOpen:w2,PanelLeftOpenIcon:w2,PanelRight:JG,PanelRightClose:XG,PanelRightCloseIcon:XG,PanelRightDashed:k2,PanelRightDashedIcon:k2,PanelRightIcon:JG,PanelRightInactive:k2,PanelRightInactiveIcon:k2,PanelRightOpen:QG,PanelRightOpenIcon:QG,PanelTop:rK,PanelTopClose:eK,PanelTopCloseIcon:eK,PanelTopDashed:N2,PanelTopDashedIcon:N2,PanelTopIcon:rK,PanelTopInactive:N2,PanelTopInactiveIcon:N2,PanelTopOpen:tK,PanelTopOpenIcon:tK,PanelsLeftBottom:sK,PanelsLeftBottomIcon:sK,PanelsLeftRight:Ub,PanelsLeftRightIcon:Ub,PanelsRightBottom:nK,PanelsRightBottomIcon:nK,PanelsTopBottom:A2,PanelsTopBottomIcon:A2,PanelsTopLeft:K0,PanelsTopLeftIcon:K0,Paperclip:qj,PaperclipIcon:qj,Parentheses:aK,ParenthesesIcon:aK,ParkingCircle:Cb,ParkingCircleIcon:Cb,ParkingCircleOff:Sb,ParkingCircleOffIcon:Sb,ParkingMeter:iK,ParkingMeterIcon:iK,ParkingSquare:gw,ParkingSquareIcon:gw,ParkingSquareOff:fw,ParkingSquareOffIcon:fw,PartyPopper:Gc,PartyPopperIcon:Gc,Pause:_m,PauseCircle:Mb,PauseCircleIcon:Mb,PauseIcon:_m,PauseOctagon:g2,PauseOctagonIcon:g2,PawPrint:oK,PawPrintIcon:oK,PcCase:lK,PcCaseIcon:lK,Pen:Y0,PenBox:vc,PenBoxIcon:vc,PenIcon:Y0,PenLine:Z0,PenLineIcon:Z0,PenOff:cK,PenOffIcon:cK,PenSquare:vc,PenSquareIcon:vc,PenTool:Vj,PenToolIcon:Vj,Pencil:Ja,PencilIcon:Ja,PencilLine:dK,PencilLineIcon:dK,PencilOff:uK,PencilOffIcon:uK,PencilRuler:hK,PencilRulerIcon:hK,Pentagon:mK,PentagonIcon:mK,Percent:FS,PercentCircle:Tb,PercentCircleIcon:Tb,PercentDiamond:Vb,PercentDiamondIcon:Vb,PercentIcon:FS,PercentSquare:xw,PercentSquareIcon:xw,PersonStanding:pK,PersonStandingIcon:pK,PhilippinePeso:fK,PhilippinePesoIcon:fK,Phone:Pi,PhoneCall:gK,PhoneCallIcon:gK,PhoneForwarded:xK,PhoneForwardedIcon:xK,PhoneIcon:Pi,PhoneIncoming:yK,PhoneIncomingIcon:yK,PhoneMissed:vK,PhoneMissedIcon:vK,PhoneOff:_K,PhoneOffIcon:_K,PhoneOutgoing:bK,PhoneOutgoingIcon:bK,Pi:wK,PiIcon:wK,PiSquare:yw,PiSquareIcon:yw,Piano:jK,PianoIcon:jK,Pickaxe:kK,PickaxeIcon:kK,PictureInPicture:SK,PictureInPicture2:NK,PictureInPicture2Icon:NK,PictureInPictureIcon:SK,PieChart:cb,PieChartIcon:cb,PiggyBank:CK,PiggyBankIcon:CK,Pilcrow:AK,PilcrowIcon:AK,PilcrowLeft:MK,PilcrowLeftIcon:MK,PilcrowRight:TK,PilcrowRightIcon:TK,PilcrowSquare:vw,PilcrowSquareIcon:vw,Pill:IK,PillBottle:EK,PillBottleIcon:EK,PillIcon:IK,Pin:Q1,PinIcon:Q1,PinOff:bA,PinOffIcon:bA,Pipette:PK,PipetteIcon:PK,Pizza:LK,PizzaIcon:LK,Plane:RK,PlaneIcon:RK,PlaneLanding:OK,PlaneLandingIcon:OK,PlaneTakeoff:DK,PlaneTakeoffIcon:DK,Play:Hl,PlayCircle:ap,PlayCircleIcon:ap,PlayIcon:Hl,PlaySquare:_w,PlaySquareIcon:_w,Plug:wA,Plug2:FK,Plug2Icon:FK,PlugIcon:wA,PlugZap:S2,PlugZap2:S2,PlugZap2Icon:S2,PlugZapIcon:S2,Plus:vs,PlusCircle:Ab,PlusCircleIcon:Ab,PlusIcon:vs,PlusSquare:bw,PlusSquareIcon:bw,Pocket:BK,PocketIcon:BK,PocketKnife:zK,PocketKnifeIcon:zK,Podcast:$K,PodcastIcon:$K,Pointer:qK,PointerIcon:qK,PointerOff:UK,PointerOffIcon:UK,Popcorn:VK,PopcornIcon:VK,Popsicle:HK,PopsicleIcon:HK,PoundSterling:WK,PoundSterlingIcon:WK,Power:KK,PowerCircle:Eb,PowerCircleIcon:Eb,PowerIcon:KK,PowerOff:GK,PowerOffIcon:GK,PowerSquare:ww,PowerSquareIcon:ww,Presentation:gy,PresentationIcon:gy,Printer:jA,PrinterCheck:ZK,PrinterCheckIcon:ZK,PrinterIcon:jA,Projector:YK,ProjectorIcon:YK,Proportions:XK,ProportionsIcon:XK,Puzzle:QK,PuzzleIcon:QK,Pyramid:JK,PyramidIcon:JK,QrCode:Hj,QrCodeIcon:Hj,Quote:kA,QuoteIcon:kA,Rabbit:eZ,RabbitIcon:eZ,Radar:tZ,RadarIcon:tZ,Radiation:rZ,RadiationIcon:rZ,Radical:sZ,RadicalIcon:sZ,Radio:Wj,RadioIcon:Wj,RadioReceiver:nZ,RadioReceiverIcon:nZ,RadioTower:aZ,RadioTowerIcon:aZ,Radius:iZ,RadiusIcon:iZ,RailSymbol:oZ,RailSymbolIcon:oZ,Rainbow:lZ,RainbowIcon:lZ,Rat:cZ,RatIcon:cZ,Ratio:dZ,RatioIcon:dZ,Receipt:vZ,ReceiptCent:uZ,ReceiptCentIcon:uZ,ReceiptEuro:hZ,ReceiptEuroIcon:hZ,ReceiptIcon:vZ,ReceiptIndianRupee:mZ,ReceiptIndianRupeeIcon:mZ,ReceiptJapaneseYen:pZ,ReceiptJapaneseYenIcon:pZ,ReceiptPoundSterling:fZ,ReceiptPoundSterlingIcon:fZ,ReceiptRussianRuble:gZ,ReceiptRussianRubleIcon:gZ,ReceiptSwissFranc:xZ,ReceiptSwissFrancIcon:xZ,ReceiptText:yZ,ReceiptTextIcon:yZ,RectangleEllipsis:C2,RectangleEllipsisIcon:C2,RectangleHorizontal:_Z,RectangleHorizontalIcon:_Z,RectangleVertical:bZ,RectangleVerticalIcon:bZ,Recycle:wZ,RecycleIcon:wZ,Redo:zS,Redo2:jZ,Redo2Icon:jZ,RedoDot:kZ,RedoDotIcon:kZ,RedoIcon:zS,RefreshCcw:SZ,RefreshCcwDot:NZ,RefreshCcwDotIcon:NZ,RefreshCcwIcon:SZ,RefreshCw:Go,RefreshCwIcon:Go,RefreshCwOff:CZ,RefreshCwOffIcon:CZ,Refrigerator:MZ,RefrigeratorIcon:MZ,Regex:TZ,RegexIcon:TZ,RemoveFormatting:AZ,RemoveFormattingIcon:AZ,Repeat:NA,Repeat1:EZ,Repeat1Icon:EZ,Repeat2:IZ,Repeat2Icon:IZ,RepeatIcon:NA,Replace:LZ,ReplaceAll:PZ,ReplaceAllIcon:PZ,ReplaceIcon:LZ,Reply:SA,ReplyAll:OZ,ReplyAllIcon:OZ,ReplyIcon:SA,Rewind:DZ,RewindIcon:DZ,Ribbon:RZ,RibbonIcon:RZ,Rocket:$g,RocketIcon:$g,RockingChair:FZ,RockingChairIcon:FZ,RollerCoaster:zZ,RollerCoasterIcon:zZ,Rotate3D:M2,Rotate3DIcon:M2,Rotate3d:M2,Rotate3dIcon:M2,RotateCcw:BS,RotateCcwIcon:BS,RotateCcwSquare:BZ,RotateCcwSquareIcon:BZ,RotateCw:CA,RotateCwIcon:CA,RotateCwSquare:$Z,RotateCwSquareIcon:$Z,Route:qZ,RouteIcon:qZ,RouteOff:UZ,RouteOffIcon:UZ,Router:VZ,RouterIcon:VZ,Rows:T2,Rows2:T2,Rows2Icon:T2,Rows3:A2,Rows3Icon:A2,Rows4:HZ,Rows4Icon:HZ,RowsIcon:T2,Rss:WZ,RssIcon:WZ,Ruler:GZ,RulerIcon:GZ,RussianRuble:KZ,RussianRubleIcon:KZ,Sailboat:ZZ,SailboatIcon:ZZ,Salad:YZ,SaladIcon:YZ,Sandwich:XZ,SandwichIcon:XZ,Satellite:JZ,SatelliteDish:QZ,SatelliteDishIcon:QZ,SatelliteIcon:JZ,Save:Lf,SaveAll:eY,SaveAllIcon:eY,SaveIcon:Lf,SaveOff:tY,SaveOffIcon:tY,Scale:rY,Scale3D:E2,Scale3DIcon:E2,Scale3d:E2,Scale3dIcon:E2,ScaleIcon:rY,Scaling:sY,ScalingIcon:sY,Scan:uY,ScanBarcode:nY,ScanBarcodeIcon:nY,ScanEye:aY,ScanEyeIcon:aY,ScanFace:iY,ScanFaceIcon:iY,ScanIcon:uY,ScanLine:oY,ScanLineIcon:oY,ScanQrCode:lY,ScanQrCodeIcon:lY,ScanSearch:cY,ScanSearchIcon:cY,ScanText:dY,ScanTextIcon:dY,ScatterChart:db,ScatterChartIcon:db,School:hY,School2:Rw,School2Icon:Rw,SchoolIcon:hY,Scissors:pY,ScissorsIcon:pY,ScissorsLineDashed:mY,ScissorsLineDashedIcon:mY,ScissorsSquare:jw,ScissorsSquareDashedBottom:Z2,ScissorsSquareDashedBottomIcon:Z2,ScissorsSquareIcon:jw,ScreenShare:gY,ScreenShareIcon:gY,ScreenShareOff:fY,ScreenShareOffIcon:fY,Scroll:yY,ScrollIcon:yY,ScrollText:xY,ScrollTextIcon:xY,Search:ua,SearchCheck:vY,SearchCheckIcon:vY,SearchCode:_Y,SearchCodeIcon:_Y,SearchIcon:ua,SearchSlash:bY,SearchSlashIcon:bY,SearchX:wY,SearchXIcon:wY,Section:jY,SectionIcon:jY,Send:ro,SendHorizonal:I2,SendHorizonalIcon:I2,SendHorizontal:I2,SendHorizontalIcon:I2,SendIcon:ro,SendToBack:kY,SendToBackIcon:kY,SeparatorHorizontal:NY,SeparatorHorizontalIcon:NY,SeparatorVertical:SY,SeparatorVerticalIcon:SY,Server:AY,ServerCog:CY,ServerCogIcon:CY,ServerCrash:MY,ServerCrashIcon:MY,ServerIcon:AY,ServerOff:TY,ServerOffIcon:TY,Settings:Bd,Settings2:EY,Settings2Icon:EY,SettingsIcon:Bd,Shapes:IY,ShapesIcon:IY,Share:MA,Share2:Cc,Share2Icon:Cc,ShareIcon:MA,Sheet:PY,SheetIcon:PY,Shell:LY,ShellIcon:LY,Shield:bm,ShieldAlert:OY,ShieldAlertIcon:OY,ShieldBan:DY,ShieldBanIcon:DY,ShieldCheck:TA,ShieldCheckIcon:TA,ShieldClose:P2,ShieldCloseIcon:P2,ShieldEllipsis:RY,ShieldEllipsisIcon:RY,ShieldHalf:FY,ShieldHalfIcon:FY,ShieldIcon:bm,ShieldMinus:zY,ShieldMinusIcon:zY,ShieldOff:BY,ShieldOffIcon:BY,ShieldPlus:$Y,ShieldPlusIcon:$Y,ShieldQuestion:UY,ShieldQuestionIcon:UY,ShieldX:P2,ShieldXIcon:P2,Ship:VY,ShipIcon:VY,ShipWheel:qY,ShipWheelIcon:qY,Shirt:HY,ShirtIcon:HY,ShoppingBag:Ug,ShoppingBagIcon:Ug,ShoppingBasket:WY,ShoppingBasketIcon:WY,ShoppingCart:Ih,ShoppingCartIcon:Ih,Shovel:GY,ShovelIcon:GY,ShowerHead:KY,ShowerHeadIcon:KY,Shrink:ZY,ShrinkIcon:ZY,Shrub:YY,ShrubIcon:YY,Shuffle:XY,ShuffleIcon:XY,Sidebar:j2,SidebarClose:_2,SidebarCloseIcon:_2,SidebarIcon:j2,SidebarOpen:w2,SidebarOpenIcon:w2,Sigma:QY,SigmaIcon:QY,SigmaSquare:kw,SigmaSquareIcon:kw,Signal:sX,SignalHigh:JY,SignalHighIcon:JY,SignalIcon:sX,SignalLow:eX,SignalLowIcon:eX,SignalMedium:tX,SignalMediumIcon:tX,SignalZero:rX,SignalZeroIcon:rX,Signature:nX,SignatureIcon:nX,Signpost:iX,SignpostBig:aX,SignpostBigIcon:aX,SignpostIcon:iX,Siren:oX,SirenIcon:oX,SkipBack:lX,SkipBackIcon:lX,SkipForward:cX,SkipForwardIcon:cX,Skull:dX,SkullIcon:dX,Slack:uX,SlackIcon:uX,Slash:hX,SlashIcon:hX,SlashSquare:Nw,SlashSquareIcon:Nw,Slice:mX,SliceIcon:mX,Sliders:L2,SlidersHorizontal:AA,SlidersHorizontalIcon:AA,SlidersIcon:L2,SlidersVertical:L2,SlidersVerticalIcon:L2,Smartphone:xy,SmartphoneCharging:pX,SmartphoneChargingIcon:pX,SmartphoneIcon:xy,SmartphoneNfc:fX,SmartphoneNfcIcon:fX,Smile:xX,SmileIcon:xX,SmilePlus:gX,SmilePlusIcon:gX,Snail:yX,SnailIcon:yX,Snowflake:S1,SnowflakeIcon:S1,Sofa:vX,SofaIcon:vX,SortAsc:V_,SortAscIcon:V_,SortDesc:$_,SortDescIcon:$_,Soup:_X,SoupIcon:_X,Space:bX,SpaceIcon:bX,Spade:wX,SpadeIcon:wX,Sparkle:jX,SparkleIcon:jX,Sparkles:Bn,SparklesIcon:Bn,Speaker:kX,SpeakerIcon:kX,Speech:NX,SpeechIcon:NX,SpellCheck:CX,SpellCheck2:SX,SpellCheck2Icon:SX,SpellCheckIcon:CX,Spline:MX,SplineIcon:MX,Split:TX,SplitIcon:TX,SplitSquareHorizontal:Sw,SplitSquareHorizontalIcon:Sw,SplitSquareVertical:Cw,SplitSquareVerticalIcon:Cw,SprayCan:AX,SprayCanIcon:AX,Sprout:EX,SproutIcon:EX,Square:qg,SquareActivity:O2,SquareActivityIcon:O2,SquareArrowDown:F2,SquareArrowDownIcon:F2,SquareArrowDownLeft:D2,SquareArrowDownLeftIcon:D2,SquareArrowDownRight:R2,SquareArrowDownRightIcon:R2,SquareArrowLeft:z2,SquareArrowLeftIcon:z2,SquareArrowOutDownLeft:B2,SquareArrowOutDownLeftIcon:B2,SquareArrowOutDownRight:$2,SquareArrowOutDownRightIcon:$2,SquareArrowOutUpLeft:U2,SquareArrowOutUpLeftIcon:U2,SquareArrowOutUpRight:q2,SquareArrowOutUpRightIcon:q2,SquareArrowRight:V2,SquareArrowRightIcon:V2,SquareArrowUp:G2,SquareArrowUpIcon:G2,SquareArrowUpLeft:H2,SquareArrowUpLeftIcon:H2,SquareArrowUpRight:W2,SquareArrowUpRightIcon:W2,SquareAsterisk:K2,SquareAsteriskIcon:K2,SquareBottomDashedScissors:Z2,SquareBottomDashedScissorsIcon:Z2,SquareChartGantt:gg,SquareChartGanttIcon:gg,SquareCheck:Y2,SquareCheckBig:X0,SquareCheckBigIcon:X0,SquareCheckIcon:Y2,SquareChevronDown:X2,SquareChevronDownIcon:X2,SquareChevronLeft:Q2,SquareChevronLeftIcon:Q2,SquareChevronRight:J2,SquareChevronRightIcon:J2,SquareChevronUp:ew,SquareChevronUpIcon:ew,SquareCode:tw,SquareCodeIcon:tw,SquareDashed:nw,SquareDashedBottom:PX,SquareDashedBottomCode:IX,SquareDashedBottomCodeIcon:IX,SquareDashedBottomIcon:PX,SquareDashedIcon:nw,SquareDashedKanban:rw,SquareDashedKanbanIcon:rw,SquareDashedMousePointer:sw,SquareDashedMousePointerIcon:sw,SquareDivide:aw,SquareDivideIcon:aw,SquareDot:iw,SquareDotIcon:iw,SquareEqual:ow,SquareEqualIcon:ow,SquareFunction:lw,SquareFunctionIcon:lw,SquareGanttChart:gg,SquareGanttChartIcon:gg,SquareIcon:qg,SquareKanban:cw,SquareKanbanIcon:cw,SquareLibrary:dw,SquareLibraryIcon:dw,SquareM:uw,SquareMIcon:uw,SquareMenu:hw,SquareMenuIcon:hw,SquareMinus:mw,SquareMinusIcon:mw,SquareMousePointer:pw,SquareMousePointerIcon:pw,SquareParking:gw,SquareParkingIcon:gw,SquareParkingOff:fw,SquareParkingOffIcon:fw,SquarePen:vc,SquarePenIcon:vc,SquarePercent:xw,SquarePercentIcon:xw,SquarePi:yw,SquarePiIcon:yw,SquarePilcrow:vw,SquarePilcrowIcon:vw,SquarePlay:_w,SquarePlayIcon:_w,SquarePlus:bw,SquarePlusIcon:bw,SquarePower:ww,SquarePowerIcon:ww,SquareRadical:LX,SquareRadicalIcon:LX,SquareScissors:jw,SquareScissorsIcon:jw,SquareSigma:kw,SquareSigmaIcon:kw,SquareSlash:Nw,SquareSlashIcon:Nw,SquareSplitHorizontal:Sw,SquareSplitHorizontalIcon:Sw,SquareSplitVertical:Cw,SquareSplitVerticalIcon:Cw,SquareSquare:OX,SquareSquareIcon:OX,SquareStack:DX,SquareStackIcon:DX,SquareTerminal:Mw,SquareTerminalIcon:Mw,SquareUser:Aw,SquareUserIcon:Aw,SquareUserRound:Tw,SquareUserRoundIcon:Tw,SquareX:Ew,SquareXIcon:Ew,Squircle:RX,SquircleIcon:RX,Squirrel:FX,SquirrelIcon:FX,Stamp:zX,StampIcon:zX,Star:Mn,StarHalf:BX,StarHalfIcon:BX,StarIcon:Mn,StarOff:$X,StarOffIcon:$X,Stars:Bn,StarsIcon:Bn,StepBack:UX,StepBackIcon:UX,StepForward:qX,StepForwardIcon:qX,Stethoscope:VX,StethoscopeIcon:VX,Sticker:HX,StickerIcon:HX,StickyNote:WX,StickyNoteIcon:WX,StopCircle:Pb,StopCircleIcon:Pb,Store:GX,StoreIcon:GX,StretchHorizontal:KX,StretchHorizontalIcon:KX,StretchVertical:ZX,StretchVerticalIcon:ZX,Strikethrough:YX,StrikethroughIcon:YX,Subscript:XX,SubscriptIcon:XX,Subtitles:Q_,SubtitlesIcon:Q_,Sun:J1,SunDim:QX,SunDimIcon:QX,SunIcon:J1,SunMedium:JX,SunMediumIcon:JX,SunMoon:eQ,SunMoonIcon:eQ,SunSnow:tQ,SunSnowIcon:tQ,Sunrise:rQ,SunriseIcon:rQ,Sunset:sQ,SunsetIcon:sQ,Superscript:nQ,SuperscriptIcon:nQ,SwatchBook:aQ,SwatchBookIcon:aQ,SwissFranc:iQ,SwissFrancIcon:iQ,SwitchCamera:oQ,SwitchCameraIcon:oQ,Sword:lQ,SwordIcon:lQ,Swords:cQ,SwordsIcon:cQ,Syringe:dQ,SyringeIcon:dQ,Table:xQ,Table2:$S,Table2Icon:$S,TableCellsMerge:uQ,TableCellsMergeIcon:uQ,TableCellsSplit:hQ,TableCellsSplitIcon:hQ,TableColumnsSplit:mQ,TableColumnsSplitIcon:mQ,TableIcon:xQ,TableOfContents:pQ,TableOfContentsIcon:pQ,TableProperties:fQ,TablePropertiesIcon:fQ,TableRowsSplit:gQ,TableRowsSplitIcon:gQ,Tablet:vQ,TabletIcon:vQ,TabletSmartphone:yQ,TabletSmartphoneIcon:yQ,Tablets:_Q,TabletsIcon:_Q,Tag:Vg,TagIcon:Vg,Tags:bQ,TagsIcon:bQ,Tally1:wQ,Tally1Icon:wQ,Tally2:jQ,Tally2Icon:jQ,Tally3:kQ,Tally3Icon:kQ,Tally4:NQ,Tally4Icon:NQ,Tally5:SQ,Tally5Icon:SQ,Tangent:CQ,TangentIcon:CQ,Target:yy,TargetIcon:yy,Telescope:MQ,TelescopeIcon:MQ,Tent:AQ,TentIcon:AQ,TentTree:TQ,TentTreeIcon:TQ,Terminal:EQ,TerminalIcon:EQ,TerminalSquare:Mw,TerminalSquareIcon:Mw,TestTube:IQ,TestTube2:Iw,TestTube2Icon:Iw,TestTubeDiagonal:Iw,TestTubeDiagonalIcon:Iw,TestTubeIcon:IQ,TestTubes:PQ,TestTubesIcon:PQ,Text:FQ,TextCursor:OQ,TextCursorIcon:OQ,TextCursorInput:LQ,TextCursorInputIcon:LQ,TextIcon:FQ,TextQuote:DQ,TextQuoteIcon:DQ,TextSearch:RQ,TextSearchIcon:RQ,TextSelect:Pw,TextSelectIcon:Pw,TextSelection:Pw,TextSelectionIcon:Pw,Theater:zQ,TheaterIcon:zQ,Thermometer:UQ,ThermometerIcon:UQ,ThermometerSnowflake:BQ,ThermometerSnowflakeIcon:BQ,ThermometerSun:$Q,ThermometerSunIcon:$Q,ThumbsDown:EA,ThumbsDownIcon:EA,ThumbsUp:xd,ThumbsUpIcon:xd,Ticket:IA,TicketCheck:qQ,TicketCheckIcon:qQ,TicketIcon:IA,TicketMinus:VQ,TicketMinusIcon:VQ,TicketPercent:HQ,TicketPercentIcon:HQ,TicketPlus:WQ,TicketPlusIcon:WQ,TicketSlash:GQ,TicketSlashIcon:GQ,TicketX:KQ,TicketXIcon:KQ,Tickets:YQ,TicketsIcon:YQ,TicketsPlane:ZQ,TicketsPlaneIcon:ZQ,Timer:JQ,TimerIcon:JQ,TimerOff:XQ,TimerOffIcon:XQ,TimerReset:QQ,TimerResetIcon:QQ,ToggleLeft:eJ,ToggleLeftIcon:eJ,ToggleRight:tJ,ToggleRightIcon:tJ,Toilet:rJ,ToiletIcon:rJ,Tornado:sJ,TornadoIcon:sJ,Torus:nJ,TorusIcon:nJ,Touchpad:iJ,TouchpadIcon:iJ,TouchpadOff:aJ,TouchpadOffIcon:aJ,TowerControl:oJ,TowerControlIcon:oJ,ToyBrick:lJ,ToyBrickIcon:lJ,Tractor:cJ,TractorIcon:cJ,TrafficCone:dJ,TrafficConeIcon:dJ,Train:Lw,TrainFront:hJ,TrainFrontIcon:hJ,TrainFrontTunnel:uJ,TrainFrontTunnelIcon:uJ,TrainIcon:Lw,TrainTrack:mJ,TrainTrackIcon:mJ,TramFront:Lw,TramFrontIcon:Lw,Trash:pJ,Trash2:Bs,Trash2Icon:Bs,TrashIcon:pJ,TreeDeciduous:fJ,TreeDeciduousIcon:fJ,TreePalm:Ow,TreePalmIcon:Ow,TreePine:ev,TreePineIcon:ev,Trees:gJ,TreesIcon:gJ,Trello:xJ,TrelloIcon:xJ,TrendingDown:Gj,TrendingDownIcon:Gj,TrendingUp:bu,TrendingUpDown:yJ,TrendingUpDownIcon:yJ,TrendingUpIcon:bu,Triangle:_J,TriangleAlert:Zu,TriangleAlertIcon:Zu,TriangleIcon:_J,TriangleRight:vJ,TriangleRightIcon:vJ,Trophy:lo,TrophyIcon:lo,Truck:PA,TruckIcon:PA,Turtle:bJ,TurtleIcon:bJ,Tv:jJ,Tv2:Dw,Tv2Icon:Dw,TvIcon:jJ,TvMinimal:Dw,TvMinimalIcon:Dw,TvMinimalPlay:wJ,TvMinimalPlayIcon:wJ,Twitch:kJ,TwitchIcon:kJ,Twitter:NJ,TwitterIcon:NJ,Type:CJ,TypeIcon:CJ,TypeOutline:SJ,TypeOutlineIcon:SJ,Umbrella:TJ,UmbrellaIcon:TJ,UmbrellaOff:MJ,UmbrellaOffIcon:MJ,Underline:AJ,UnderlineIcon:AJ,Undo:US,Undo2:EJ,Undo2Icon:EJ,UndoDot:IJ,UndoDotIcon:IJ,UndoIcon:US,UnfoldHorizontal:PJ,UnfoldHorizontalIcon:PJ,UnfoldVertical:LJ,UnfoldVerticalIcon:LJ,Ungroup:OJ,UngroupIcon:OJ,University:Rw,UniversityIcon:Rw,Unlink:LA,Unlink2:DJ,Unlink2Icon:DJ,UnlinkIcon:LA,Unlock:h2,UnlockIcon:h2,UnlockKeyhole:u2,UnlockKeyholeIcon:u2,Unplug:RJ,UnplugIcon:RJ,Upload:so,UploadCloud:zb,UploadCloudIcon:zb,UploadIcon:so,Usb:FJ,UsbIcon:FJ,User:oc,User2:qw,User2Icon:qw,UserCheck:Kj,UserCheck2:Fw,UserCheck2Icon:Fw,UserCheckIcon:Kj,UserCircle:Ob,UserCircle2:Lb,UserCircle2Icon:Lb,UserCircleIcon:Ob,UserCog:OA,UserCog2:zw,UserCog2Icon:zw,UserCogIcon:OA,UserIcon:oc,UserMinus:zJ,UserMinus2:Bw,UserMinus2Icon:Bw,UserMinusIcon:zJ,UserPen:BJ,UserPenIcon:BJ,UserPlus:wu,UserPlus2:$w,UserPlus2Icon:$w,UserPlusIcon:wu,UserRound:qw,UserRoundCheck:Fw,UserRoundCheckIcon:Fw,UserRoundCog:zw,UserRoundCogIcon:zw,UserRoundIcon:qw,UserRoundMinus:Bw,UserRoundMinusIcon:Bw,UserRoundPen:$J,UserRoundPenIcon:$J,UserRoundPlus:$w,UserRoundPlusIcon:$w,UserRoundSearch:UJ,UserRoundSearchIcon:UJ,UserRoundX:Uw,UserRoundXIcon:Uw,UserSearch:qJ,UserSearchIcon:qJ,UserSquare:Aw,UserSquare2:Tw,UserSquare2Icon:Tw,UserSquareIcon:Aw,UserX:VJ,UserX2:Uw,UserX2Icon:Uw,UserXIcon:VJ,Users:qs,Users2:Vw,Users2Icon:Vw,UsersIcon:qs,UsersRound:Vw,UsersRoundIcon:Vw,Utensils:Ww,UtensilsCrossed:Hw,UtensilsCrossedIcon:Hw,UtensilsIcon:Ww,UtilityPole:HJ,UtilityPoleIcon:HJ,Variable:DA,VariableIcon:DA,Vault:WJ,VaultIcon:WJ,Vegan:GJ,VeganIcon:GJ,VenetianMask:KJ,VenetianMaskIcon:KJ,Verified:G_,VerifiedIcon:G_,Vibrate:YJ,VibrateIcon:YJ,VibrateOff:ZJ,VibrateOffIcon:ZJ,Video:Ta,VideoIcon:Ta,VideoOff:XJ,VideoOffIcon:XJ,Videotape:QJ,VideotapeIcon:QJ,View:JJ,ViewIcon:JJ,Voicemail:eee,VoicemailIcon:eee,Volleyball:tee,VolleyballIcon:tee,Volume:iee,Volume1:ree,Volume1Icon:ree,Volume2:see,Volume2Icon:see,VolumeIcon:iee,VolumeOff:nee,VolumeOffIcon:nee,VolumeX:aee,VolumeXIcon:aee,Vote:oee,VoteIcon:oee,Wallet:cee,Wallet2:Gw,Wallet2Icon:Gw,WalletCards:lee,WalletCardsIcon:lee,WalletIcon:cee,WalletMinimal:Gw,WalletMinimalIcon:Gw,Wallpaper:dee,WallpaperIcon:dee,Wand:uee,Wand2:Kw,Wand2Icon:Kw,WandIcon:uee,WandSparkles:Kw,WandSparklesIcon:Kw,Warehouse:hee,WarehouseIcon:hee,WashingMachine:mee,WashingMachineIcon:mee,Watch:pee,WatchIcon:pee,Waves:fee,WavesIcon:fee,Waypoints:gee,WaypointsIcon:gee,Webcam:xee,WebcamIcon:xee,Webhook:vee,WebhookIcon:vee,WebhookOff:yee,WebhookOffIcon:yee,Weight:_ee,WeightIcon:_ee,Wheat:wee,WheatIcon:wee,WheatOff:bee,WheatOffIcon:bee,WholeWord:jee,WholeWordIcon:jee,Wifi:Mee,WifiHigh:kee,WifiHighIcon:kee,WifiIcon:Mee,WifiLow:Nee,WifiLowIcon:Nee,WifiOff:See,WifiOffIcon:See,WifiZero:Cee,WifiZeroIcon:Cee,Wind:Aee,WindArrowDown:Tee,WindArrowDownIcon:Tee,WindIcon:Aee,Wine:Iee,WineIcon:Iee,WineOff:Eee,WineOffIcon:Eee,Workflow:Pee,WorkflowIcon:Pee,Worm:Lee,WormIcon:Lee,WrapText:Oee,WrapTextIcon:Oee,Wrench:vy,WrenchIcon:vy,X:en,XCircle:jc,XCircleIcon:jc,XIcon:en,XOctagon:x2,XOctagonIcon:x2,XSquare:Ew,XSquareIcon:Ew,Youtube:Dee,YoutubeIcon:Dee,Zap:Hg,ZapIcon:Hg,ZapOff:Ree,ZapOffIcon:Ree,ZoomIn:qS,ZoomInIcon:qS,ZoomOut:VS,ZoomOutIcon:VS,createLucideIcon:V,icons:dQe},Symbol.toStringTag,{value:"Module"})),lxe="-",uQe=e=>{const t=mQe(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:l=>{const i=l.split(lxe);return i[0]===""&&i.length!==1&&i.shift(),PIe(i,t)||hQe(l)},getConflictingClassGroupIds:(l,i)=>{const u=s[l]||[];return i&&n[l]?[...u,...n[l]]:u}}},PIe=(e,t)=>{var l;if(e.length===0)return t.classGroupId;const s=e[0],n=t.nextPart.get(s),a=n?PIe(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const o=e.join(lxe);return(l=t.validators.find(({validator:i})=>i(o)))==null?void 0:l.classGroupId},Nje=/^\[(.+)\]$/,hQe=e=>{if(Nje.test(e)){const t=Nje.exec(e)[1],s=t==null?void 0:t.substring(0,t.indexOf(":"));if(s)return"arbitrary.."+s}},mQe=e=>{const{theme:t,prefix:s}=e,n={nextPart:new Map,validators:[]};return fQe(Object.entries(e.classGroups),s).forEach(([o,l])=>{yhe(l,n,o,t)}),n},yhe=(e,t,s,n)=>{e.forEach(a=>{if(typeof a=="string"){const o=a===""?t:Sje(t,a);o.classGroupId=s;return}if(typeof a=="function"){if(pQe(a)){yhe(a(n),t,s,n);return}t.validators.push({validator:a,classGroupId:s});return}Object.entries(a).forEach(([o,l])=>{yhe(l,Sje(t,o),s,n)})})},Sje=(e,t)=>{let s=e;return t.split(lxe).forEach(n=>{s.nextPart.has(n)||s.nextPart.set(n,{nextPart:new Map,validators:[]}),s=s.nextPart.get(n)}),s},pQe=e=>e.isThemeGetter,fQe=(e,t)=>t?e.map(([s,n])=>{const a=n.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([l,i])=>[t+l,i])):o);return[s,a]}):e,gQe=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,s=new Map,n=new Map;const a=(o,l)=>{s.set(o,l),t++,t>e&&(t=0,n=s,s=new Map)};return{get(o){let l=s.get(o);if(l!==void 0)return l;if((l=n.get(o))!==void 0)return a(o,l),l},set(o,l){s.has(o)?s.set(o,l):a(o,l)}}},LIe="!",xQe=e=>{const{separator:t,experimentalParseClassName:s}=e,n=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 s?i=>s({className:i,parseClassName:l}):l},yQe=e=>{if(e.length<=1)return e;const t=[];let s=[];return e.forEach(n=>{n[0]==="["?(t.push(...s.sort(),n),s=[]):s.push(n)}),t.push(...s.sort()),t},vQe=e=>({cache:gQe(e.cacheSize),parseClassName:xQe(e),...uQe(e)}),_Qe=/\s+/,bQe=(e,t)=>{const{parseClassName:s,getClassGroupId:n,getConflictingClassGroupIds:a}=t,o=[],l=e.trim().split(_Qe);let i="";for(let u=l.length-1;u>=0;u-=1){const m=l[u],{modifiers:x,hasImportantModifier:y,baseClassName:v,maybePostfixModifierPosition:b}=s(m);let N=!!b,k=n(N?v.substring(0,b):v);if(!k){if(!N){i=m+(i.length>0?" "+i:i);continue}if(k=n(v),!k){i=m+(i.length>0?" "+i:i);continue}N=!1}const M=yQe(x).join(":"),E=y?M+LIe:M,T=E+k;if(o.includes(T))continue;o.push(T);const P=a(k,N);for(let R=0;R0?" "+i:i)}return i};function wQe(){let e=0,t,s,n="";for(;e{if(typeof e=="string")return e;let t,s="";for(let n=0;ny(x),e());return s=vQe(m),n=s.cache.get,a=s.cache.set,o=i,i(u)}function i(u){const m=n(u);if(m)return m;const x=bQe(u,s);return a(u,x),x}return function(){return o(wQe.apply(null,arguments))}}const pl=e=>{const t=s=>s[e]||[];return t.isThemeGetter=!0,t},DIe=/^\[(?:([a-z-]+):)?(.+)\]$/i,kQe=/^\d+\/\d+$/,NQe=new Set(["px","full","screen"]),SQe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,CQe=/\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$/,MQe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,TQe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,AQe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Lx=e=>HS(e)||NQe.has(e)||kQe.test(e),D0=e=>k3(e,"length",FQe),HS=e=>!!e&&!Number.isNaN(Number(e)),xce=e=>k3(e,"number",HS),aT=e=>!!e&&Number.isInteger(Number(e)),EQe=e=>e.endsWith("%")&&HS(e.slice(0,-1)),hi=e=>DIe.test(e),R0=e=>SQe.test(e),IQe=new Set(["length","size","percentage"]),PQe=e=>k3(e,IQe,RIe),LQe=e=>k3(e,"position",RIe),OQe=new Set(["image","url"]),DQe=e=>k3(e,OQe,BQe),RQe=e=>k3(e,"",zQe),iT=()=>!0,k3=(e,t,s)=>{const n=DIe.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):s(n[2]):!1},FQe=e=>CQe.test(e)&&!MQe.test(e),RIe=()=>!1,zQe=e=>TQe.test(e),BQe=e=>AQe.test(e),$Qe=()=>{const e=pl("colors"),t=pl("spacing"),s=pl("blur"),n=pl("brightness"),a=pl("borderColor"),o=pl("borderRadius"),l=pl("borderSpacing"),i=pl("borderWidth"),u=pl("contrast"),m=pl("grayscale"),x=pl("hueRotate"),y=pl("invert"),v=pl("gap"),b=pl("gradientColorStops"),N=pl("gradientColorStopPositions"),k=pl("inset"),M=pl("margin"),E=pl("opacity"),T=pl("padding"),P=pl("saturate"),R=pl("scale"),D=pl("sepia"),U=pl("skew"),q=pl("space"),H=pl("translate"),G=()=>["auto","contain","none"],Q=()=>["auto","hidden","clip","visible","scroll"],ne=()=>["auto",hi,t],ie=()=>[hi,t],he=()=>["",Lx,D0],se=()=>["auto",HS,hi],fe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],oe=()=>["solid","dashed","dotted","double","none"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>["start","end","center","between","around","evenly","stretch"],xe=()=>["","0",hi],Me=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ve=()=>[HS,hi];return{cacheSize:500,separator:":",theme:{colors:[iT],spacing:[Lx,D0],blur:["none","",R0,hi],brightness:ve(),borderColor:[e],borderRadius:["none","","full",R0,hi],borderSpacing:ie(),borderWidth:he(),contrast:ve(),grayscale:xe(),hueRotate:ve(),invert:xe(),gap:ie(),gradientColorStops:[e],gradientColorStopPositions:[EQe,D0],inset:ne(),margin:ne(),opacity:ve(),padding:ie(),saturate:ve(),scale:ve(),sepia:xe(),skew:ve(),space:ie(),translate:ie()},classGroups:{aspect:[{aspect:["auto","square","video",hi]}],container:["container"],columns:[{columns:[R0]}],"break-after":[{"break-after":Me()}],"break-before":[{"break-before":Me()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...fe(),hi]}],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",aT,hi]}],basis:[{basis:ne()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",hi]}],grow:[{grow:xe()}],shrink:[{shrink:xe()}],order:[{order:["first","last","none",aT,hi]}],"grid-cols":[{"grid-cols":[iT]}],"col-start-end":[{col:["auto",{span:["full",aT,hi]},hi]}],"col-start":[{"col-start":se()}],"col-end":[{"col-end":se()}],"grid-rows":[{"grid-rows":[iT]}],"row-start-end":[{row:["auto",{span:[aT,hi]},hi]}],"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",hi]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",hi]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",...de()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...de(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...de(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[T]}],px:[{px:[T]}],py:[{py:[T]}],ps:[{ps:[T]}],pe:[{pe:[T]}],pt:[{pt:[T]}],pr:[{pr:[T]}],pb:[{pb:[T]}],pl:[{pl:[T]}],m:[{m:[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":[q]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[q]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",hi,t]}],"min-w":[{"min-w":[hi,t,"min","max","fit"]}],"max-w":[{"max-w":[hi,t,"none","full","min","max","fit","prose",{screen:[R0]},R0]}],h:[{h:[hi,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[hi,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[hi,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[hi,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",xce]}],"font-family":[{font:[iT]}],"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",hi]}],"line-clamp":[{"line-clamp":["none",HS,xce]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Lx,hi]}],"list-image":[{"list-image":["none",hi]}],"list-style-type":[{list:["none","disc","decimal",hi]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[E]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[E]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Lx,D0]}],"underline-offset":[{"underline-offset":["auto",Lx,hi]}],"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:ie()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",hi]}],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",hi]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[E]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...fe(),LQe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",PQe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},DQe]}],"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":[E]}],"border-style":[{border:[...oe(),"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":[E]}],"divide-style":[{divide:oe()}],"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:["",...oe()]}],"outline-offset":[{"outline-offset":[Lx,hi]}],"outline-w":[{outline:[Lx,D0]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:he()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[E]}],"ring-offset-w":[{"ring-offset":[Lx,D0]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",R0,RQe]}],"shadow-color":[{shadow:[iT]}],opacity:[{opacity:[E]}],"mix-blend":[{"mix-blend":[...ce(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ce()}],filter:[{filter:["","none"]}],blur:[{blur:[s]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",R0,hi]}],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":[s]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"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":[E]}],"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",hi]}],duration:[{duration:ve()}],ease:[{ease:["linear","in","out","in-out",hi]}],delay:[{delay:ve()}],animate:[{animate:["none","spin","ping","pulse","bounce",hi]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[R]}],"scale-x":[{"scale-x":[R]}],"scale-y":[{"scale-y":[R]}],rotate:[{rotate:[aT,hi]}],"translate-x":[{"translate-x":[H]}],"translate-y":[{"translate-y":[H]}],"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",hi]}],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",hi]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ie()}],"scroll-mx":[{"scroll-mx":ie()}],"scroll-my":[{"scroll-my":ie()}],"scroll-ms":[{"scroll-ms":ie()}],"scroll-me":[{"scroll-me":ie()}],"scroll-mt":[{"scroll-mt":ie()}],"scroll-mr":[{"scroll-mr":ie()}],"scroll-mb":[{"scroll-mb":ie()}],"scroll-ml":[{"scroll-ml":ie()}],"scroll-p":[{"scroll-p":ie()}],"scroll-px":[{"scroll-px":ie()}],"scroll-py":[{"scroll-py":ie()}],"scroll-ps":[{"scroll-ps":ie()}],"scroll-pe":[{"scroll-pe":ie()}],"scroll-pt":[{"scroll-pt":ie()}],"scroll-pr":[{"scroll-pr":ie()}],"scroll-pb":[{"scroll-pb":ie()}],"scroll-pl":[{"scroll-pl":ie()}],"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",hi]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Lx,D0,xce]}],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"]}}},UQe=jQe($Qe);function Ut(...e){return UQe(mi(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 Cje(e){const t=new Date(e);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(t)}function vne(e){return e?e.replace(/<[^>]*>/g,""):""}const qQe=oQe,FIe=A.forwardRef(({className:e,...t},s)=>r.jsx(jIe,{ref:s,className:Ut("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));FIe.displayName=jIe.displayName;const VQe=j3("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),zIe=A.forwardRef(({className:e,variant:t,...s},n)=>r.jsx(kIe,{ref:n,className:Ut(VQe({variant:t}),e),...s}));zIe.displayName=kIe.displayName;const HQe=A.forwardRef(({className:e,...t},s)=>r.jsx(CIe,{ref:s,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}));HQe.displayName=CIe.displayName;const BIe=A.forwardRef(({className:e,...t},s)=>r.jsx(MIe,{ref:s,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(en,{className:"h-4 w-4"})}));BIe.displayName=MIe.displayName;const $Ie=A.forwardRef(({className:e,...t},s)=>r.jsx(NIe,{ref:s,className:Ut("text-sm font-semibold",e),...t}));$Ie.displayName=NIe.displayName;const UIe=A.forwardRef(({className:e,...t},s)=>r.jsx(SIe,{ref:s,className:Ut("text-sm opacity-90",e),...t}));UIe.displayName=SIe.displayName;function WQe(){const{toasts:e}=ci();return r.jsxs(qQe,{children:[e.map(function({id:t,title:s,description:n,action:a,...o}){return r.jsxs(zIe,{...o,children:[r.jsxs("div",{className:"grid gap-1",children:[s&&r.jsx($Ie,{children:s}),n&&r.jsx(UIe,{children:n})]}),a,r.jsx(BIe,{})]},t)}),r.jsx(FIe,{})]})}var Mje=["light","dark"],GQe="(prefers-color-scheme: dark)",KQe=A.createContext(void 0),ZQe={setTheme:e=>{},themes:[]},YQe=()=>{var e;return(e=A.useContext(KQe))!=null?e:ZQe};A.memo(({forcedTheme:e,storageKey:t,attribute:s,enableSystem:n,enableColorScheme:a,defaultTheme:o,value:l,attrs:i,nonce:u})=>{let m=o==="system",x=s==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${i.map(N=>`'${N}'`).join(",")})`};`:`var d=document.documentElement,n='${s}',s='setAttribute';`,y=a?Mje.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 E=l?l[N]:N,T=k?N+"|| ''":`'${E}'`,P="";return a&&M&&!k&&Mje.includes(N)&&(P+=`d.style.colorScheme = '${N}';`),s==="class"?k||E?P+=`c.add(${T})`:P+="null":E&&(P+=`d[s](n,${T})`),P},b=e?`!function(){${x}${v(e)}}()`:n?`!function(){try{${x}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${m})){var t='${GQe}',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 XQe=e=>{switch(e){case"success":return eJe;case"info":return rJe;case"warning":return tJe;case"error":return sJe;default:return null}},QQe=Array(12).fill(0),JQe=({visible:e,className:t})=>ut.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ut.createElement("div",{className:"sonner-spinner"},QQe.map((s,n)=>ut.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),eJe=ut.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ut.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"})),tJe=ut.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ut.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"})),rJe=ut.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ut.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"})),sJe=ut.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ut.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"})),nJe=ut.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"},ut.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ut.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),aJe=()=>{let[e,t]=ut.useState(document.hidden);return ut.useEffect(()=>{let s=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",s),()=>window.removeEventListener("visibilitychange",s)},[]),e},vhe=1,iJe=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:s,...n}=e,a=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:vhe++,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:s}),{...i,...e,id:a,dismissible:l,title:s}):i):this.addToast({title:s,...n,dismissible:l,id:a}),a},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(s=>s({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 s;t.loading!==void 0&&(s=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let n=e instanceof Promise?e:e(),a=s!==void 0,o,l=n.then(async u=>{if(o=["resolve",u],ut.isValidElement(u))a=!1,this.create({id:s,type:"default",message:u});else if(lJe(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:s,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:s,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:s,type:"error",message:m,description:x})}}).finally(()=>{var u;a&&(this.dismiss(s),s=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 s!="string"&&typeof s!="number"?{unwrap:i}:Object.assign(s,{unwrap:i})},this.custom=(e,t)=>{let s=(t==null?void 0:t.id)||vhe++;return this.create({jsx:e(s),id:s,...t}),s},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Sh=new iJe,oJe=(e,t)=>{let s=(t==null?void 0:t.id)||vhe++;return Sh.addToast({title:e,...t,id:s}),s},lJe=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",cJe=oJe,dJe=()=>Sh.toasts,uJe=()=>Sh.getActiveToasts(),Te=Object.assign(cJe,{success:Sh.success,info:Sh.info,warning:Sh.warning,error:Sh.error,custom:Sh.custom,message:Sh.message,promise:Sh.promise,dismiss:Sh.dismiss,loading:Sh.loading},{getHistory:dJe,getToasts:uJe});function hJe(e,{insertAt:t}={}){if(typeof document>"u")return;let s=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t==="top"&&s.firstChild?s.insertBefore(n,s.firstChild):s.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}hJe(`: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 ZL(e){return e.label!==void 0}var mJe=3,pJe="32px",fJe="16px",Tje=4e3,gJe=356,xJe=14,yJe=20,vJe=200;function tf(...e){return e.filter(Boolean).join(" ")}function _Je(e){let[t,s]=e.split("-"),n=[];return t&&n.push(t),s&&n.push(s),n}var bJe=e=>{var t,s,n,a,o,l,i,u,m,x,y;let{invert:v,toast:b,unstyled:N,interacting:k,setHeights:M,visibleToasts:E,heights:T,index:P,toasts:R,expanded:D,removeToast:U,defaultRichColors:q,closeButton:H,style:G,cancelButtonStyle:Q,actionButtonStyle:ne,className:ie="",descriptionClassName:he="",duration:se,position:fe,gap:oe,loadingIcon:ce,expandByDefault:de,classNames:xe,icons:Me,closeButtonAriaLabel:ve="Close toast",pauseWhenPageIsHidden:be}=e,[we,tt]=ut.useState(null),[Ae,Le]=ut.useState(null),[Ue,Pe]=ut.useState(!1),[$e,it]=ut.useState(!1),[xt,Ee]=ut.useState(!1),[et,le]=ut.useState(!1),[Ve,Je]=ut.useState(!1),[rt,je]=ut.useState(0),[lt,Ce]=ut.useState(0),Ie=ut.useRef(b.duration||se||Tje),Ze=ut.useRef(null),De=ut.useRef(null),Ke=P===0,st=P+1<=E,dt=b.type,ct=b.dismissible!==!1,zt=b.className||"",ir=b.descriptionClassName||"",Tr=ut.useMemo(()=>T.findIndex(pn=>pn.toastId===b.id)||0,[T,b.id]),Zr=ut.useMemo(()=>{var pn;return(pn=b.closeButton)!=null?pn:H},[b.closeButton,H]),$r=ut.useMemo(()=>b.duration||se||Tje,[b.duration,se]),ns=ut.useRef(0),Xs=ut.useRef(0),Ot=ut.useRef(0),Hr=ut.useRef(null),[Ts,zs]=fe.split("-"),wa=ut.useMemo(()=>T.reduce((pn,Jn,$n)=>$n>=Tr?pn:pn+Jn.height,0),[T,Tr]),gi=aJe(),Ao=b.invert||v,Ga=dt==="loading";Xs.current=ut.useMemo(()=>Tr*oe+wa,[Tr,wa]),ut.useEffect(()=>{Ie.current=$r},[$r]),ut.useEffect(()=>{Pe(!0)},[]),ut.useEffect(()=>{let pn=De.current;if(pn){let Jn=pn.getBoundingClientRect().height;return Ce(Jn),M($n=>[{toastId:b.id,height:Jn,position:b.position},...$n]),()=>M($n=>$n.filter(Ci=>Ci.toastId!==b.id))}},[M,b.id]),ut.useLayoutEffect(()=>{if(!Ue)return;let pn=De.current,Jn=pn.style.height;pn.style.height="auto";let $n=pn.getBoundingClientRect().height;pn.style.height=Jn,Ce($n),M(Ci=>Ci.find(or=>or.toastId===b.id)?Ci.map(or=>or.toastId===b.id?{...or,height:$n}:or):[{toastId:b.id,height:$n,position:b.position},...Ci])},[Ue,b.title,b.description,M,b.id]);let mn=ut.useCallback(()=>{it(!0),je(Xs.current),M(pn=>pn.filter(Jn=>Jn.toastId!==b.id)),setTimeout(()=>{U(b)},vJe)},[b,U,M,Xs]);ut.useEffect(()=>{if(b.promise&&dt==="loading"||b.duration===1/0||b.type==="loading")return;let pn;return D||k||be&&gi?(()=>{if(Ot.current{var Jn;(Jn=b.onAutoClose)==null||Jn.call(b,b),mn()},Ie.current)),()=>clearTimeout(pn)},[D,k,b,dt,be,gi,mn]),ut.useEffect(()=>{b.delete&&mn()},[mn,b.delete]);function na(){var pn,Jn,$n;return Me!=null&&Me.loading?ut.createElement("div",{className:tf(xe==null?void 0:xe.loader,(pn=b==null?void 0:b.classNames)==null?void 0:pn.loader,"sonner-loader"),"data-visible":dt==="loading"},Me.loading):ce?ut.createElement("div",{className:tf(xe==null?void 0:xe.loader,(Jn=b==null?void 0:b.classNames)==null?void 0:Jn.loader,"sonner-loader"),"data-visible":dt==="loading"},ce):ut.createElement(JQe,{className:tf(xe==null?void 0:xe.loader,($n=b==null?void 0:b.classNames)==null?void 0:$n.loader),visible:dt==="loading"})}return ut.createElement("li",{tabIndex:0,ref:De,className:tf(ie,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[dt],(s=b==null?void 0:b.classNames)==null?void 0:s[dt]),"data-sonner-toast":"","data-rich-colors":(n=b.richColors)!=null?n:q,"data-styled":!(b.jsx||b.unstyled||N),"data-mounted":Ue,"data-promise":!!b.promise,"data-swiped":Ve,"data-removed":$e,"data-visible":st,"data-y-position":Ts,"data-x-position":zs,"data-index":P,"data-front":Ke,"data-swiping":xt,"data-dismissible":ct,"data-type":dt,"data-invert":Ao,"data-swipe-out":et,"data-swipe-direction":Ae,"data-expanded":!!(D||de&&Ue),style:{"--index":P,"--toasts-before":P,"--z-index":R.length-P,"--offset":`${$e?rt:Xs.current}px`,"--initial-height":de?"auto":`${lt}px`,...G,...b.style},onDragEnd:()=>{Ee(!1),tt(null),Hr.current=null},onPointerDown:pn=>{Ga||!ct||(Ze.current=new Date,je(Xs.current),pn.target.setPointerCapture(pn.pointerId),pn.target.tagName!=="BUTTON"&&(Ee(!0),Hr.current={x:pn.clientX,y:pn.clientY}))},onPointerUp:()=>{var pn,Jn,$n,Ci;if(et||!ct)return;Hr.current=null;let or=Number(((pn=De.current)==null?void 0:pn.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),La=Number(((Jn=De.current)==null?void 0:Jn.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),co=new Date().getTime()-(($n=Ze.current)==null?void 0:$n.getTime()),Ni=we==="x"?or:La,Ws=Math.abs(Ni)/co;if(Math.abs(Ni)>=yJe||Ws>.11){je(Xs.current),(Ci=b.onDismiss)==null||Ci.call(b,b),Le(we==="x"?or>0?"right":"left":La>0?"down":"up"),mn(),le(!0),Je(!1);return}Ee(!1),tt(null)},onPointerMove:pn=>{var Jn,$n,Ci,or;if(!Hr.current||!ct||((Jn=window.getSelection())==null?void 0:Jn.toString().length)>0)return;let La=pn.clientY-Hr.current.y,co=pn.clientX-Hr.current.x,Ni=($n=e.swipeDirections)!=null?$n:_Je(fe);!we&&(Math.abs(co)>1||Math.abs(La)>1)&&tt(Math.abs(co)>Math.abs(La)?"x":"y");let Ws={x:0,y:0};we==="y"?(Ni.includes("top")||Ni.includes("bottom"))&&(Ni.includes("top")&&La<0||Ni.includes("bottom")&&La>0)&&(Ws.y=La):we==="x"&&(Ni.includes("left")||Ni.includes("right"))&&(Ni.includes("left")&&co<0||Ni.includes("right")&&co>0)&&(Ws.x=co),(Math.abs(Ws.x)>0||Math.abs(Ws.y)>0)&&Je(!0),(Ci=De.current)==null||Ci.style.setProperty("--swipe-amount-x",`${Ws.x}px`),(or=De.current)==null||or.style.setProperty("--swipe-amount-y",`${Ws.y}px`)}},Zr&&!b.jsx?ut.createElement("button",{"aria-label":ve,"data-disabled":Ga,"data-close-button":!0,onClick:Ga||!ct?()=>{}:()=>{var pn;mn(),(pn=b.onDismiss)==null||pn.call(b,b)},className:tf(xe==null?void 0:xe.closeButton,(a=b==null?void 0:b.classNames)==null?void 0:a.closeButton)},(o=Me==null?void 0:Me.close)!=null?o:nJe):null,b.jsx||A.isValidElement(b.title)?b.jsx?b.jsx:typeof b.title=="function"?b.title():b.title:ut.createElement(ut.Fragment,null,dt||b.icon||b.promise?ut.createElement("div",{"data-icon":"",className:tf(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||na():null,b.type!=="loading"?b.icon||(Me==null?void 0:Me[dt])||XQe(dt):null):null,ut.createElement("div",{"data-content":"",className:tf(xe==null?void 0:xe.content,(i=b==null?void 0:b.classNames)==null?void 0:i.content)},ut.createElement("div",{"data-title":"",className:tf(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?ut.createElement("div",{"data-description":"",className:tf(he,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&&ZL(b.cancel)?ut.createElement("button",{"data-button":!0,"data-cancel":!0,style:b.cancelButtonStyle||Q,onClick:pn=>{var Jn,$n;ZL(b.cancel)&&ct&&(($n=(Jn=b.cancel).onClick)==null||$n.call(Jn,pn),mn())},className:tf(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&&ZL(b.action)?ut.createElement("button",{"data-button":!0,"data-action":!0,style:b.actionButtonStyle||ne,onClick:pn=>{var Jn,$n;ZL(b.action)&&(($n=(Jn=b.action).onClick)==null||$n.call(Jn,pn),!pn.defaultPrevented&&mn())},className:tf(xe==null?void 0:xe.actionButton,(y=b==null?void 0:b.classNames)==null?void 0:y.actionButton)},b.action.label):null))};function Aje(){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 wJe(e,t){let s={};return[e,t].forEach((n,a)=>{let o=a===1,l=o?"--mobile-offset":"--offset",i=o?fJe:pJe;function u(m){["top","right","bottom","left"].forEach(x=>{s[`${l}-${x}`]=typeof m=="number"?`${m}px`:m})}typeof n=="number"||typeof n=="string"?u(n):typeof n=="object"?["top","right","bottom","left"].forEach(m=>{n[m]===void 0?s[`${l}-${m}`]=i:s[`${l}-${m}`]=typeof n[m]=="number"?`${n[m]}px`:n[m]}):u(i)}),s}var jJe=A.forwardRef(function(e,t){let{invert:s,position:n="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=mJe,toastOptions:k,dir:M=Aje(),gap:E=xJe,loadingIcon:T,icons:P,containerAriaLabel:R="Notifications",pauseWhenPageIsHidden:D}=e,[U,q]=ut.useState([]),H=ut.useMemo(()=>Array.from(new Set([n].concat(U.filter(be=>be.position).map(be=>be.position)))),[U,n]),[G,Q]=ut.useState([]),[ne,ie]=ut.useState(!1),[he,se]=ut.useState(!1),[fe,oe]=ut.useState(x!=="system"?x:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),ce=ut.useRef(null),de=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),xe=ut.useRef(null),Me=ut.useRef(!1),ve=ut.useCallback(be=>{q(we=>{var tt;return(tt=we.find(Ae=>Ae.id===be.id))!=null&&tt.delete||Sh.dismiss(be.id),we.filter(({id:Ae})=>Ae!==be.id)})},[]);return ut.useEffect(()=>Sh.subscribe(be=>{if(be.dismiss){q(we=>we.map(tt=>tt.id===be.id?{...tt,delete:!0}:tt));return}setTimeout(()=>{rxe.flushSync(()=>{q(we=>{let tt=we.findIndex(Ae=>Ae.id===be.id);return tt!==-1?[...we.slice(0,tt),{...we[tt],...be},...we.slice(tt+1)]:[be,...we]})})})}),[]),ut.useEffect(()=>{if(x!=="system"){oe(x);return}if(x==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?oe("dark"):oe("light")),typeof window>"u")return;let be=window.matchMedia("(prefers-color-scheme: dark)");try{be.addEventListener("change",({matches:we})=>{oe(we?"dark":"light")})}catch{be.addListener(({matches:tt})=>{try{oe(tt?"dark":"light")}catch(Ae){console.error(Ae)}})}},[x]),ut.useEffect(()=>{U.length<=1&&ie(!1)},[U]),ut.useEffect(()=>{let be=we=>{var tt,Ae;a.every(Le=>we[Le]||we.code===Le)&&(ie(!0),(tt=ce.current)==null||tt.focus()),we.code==="Escape"&&(document.activeElement===ce.current||(Ae=ce.current)!=null&&Ae.contains(document.activeElement))&&ie(!1)};return document.addEventListener("keydown",be),()=>document.removeEventListener("keydown",be)},[a]),ut.useEffect(()=>{if(ce.current)return()=>{xe.current&&(xe.current.focus({preventScroll:!0}),xe.current=null,Me.current=!1)}},[ce.current]),ut.createElement("section",{ref:t,"aria-label":`${R} ${de}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},H.map((be,we)=>{var tt;let[Ae,Le]=be.split("-");return U.length?ut.createElement("ol",{key:be,dir:M==="auto"?Aje():M,tabIndex:-1,ref:ce,className:i,"data-sonner-toaster":!0,"data-theme":fe,"data-y-position":Ae,"data-lifted":ne&&U.length>1&&!o,"data-x-position":Le,style:{"--front-toast-height":`${((tt=G[0])==null?void 0:tt.height)||0}px`,"--width":`${gJe}px`,"--gap":`${E}px`,...b,...wJe(u,m)},onBlur:Ue=>{Me.current&&!Ue.currentTarget.contains(Ue.relatedTarget)&&(Me.current=!1,xe.current&&(xe.current.focus({preventScroll:!0}),xe.current=null))},onFocus:Ue=>{Ue.target instanceof HTMLElement&&Ue.target.dataset.dismissible==="false"||Me.current||(Me.current=!0,xe.current=Ue.relatedTarget)},onMouseEnter:()=>ie(!0),onMouseMove:()=>ie(!0),onMouseLeave:()=>{he||ie(!1)},onDragEnd:()=>ie(!1),onPointerDown:Ue=>{Ue.target instanceof HTMLElement&&Ue.target.dataset.dismissible==="false"||se(!0)},onPointerUp:()=>se(!1)},U.filter(Ue=>!Ue.position&&we===0||Ue.position===be).map((Ue,Pe)=>{var $e,it;return ut.createElement(bJe,{key:Ue.id,icons:P,index:Pe,toast:Ue,defaultRichColors:y,duration:($e=k==null?void 0:k.duration)!=null?$e:v,className:k==null?void 0:k.className,descriptionClassName:k==null?void 0:k.descriptionClassName,invert:s,visibleToasts:N,closeButton:(it=k==null?void 0:k.closeButton)!=null?it:l,interacting:he,position:be,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:ve,toasts:U.filter(xt=>xt.position==Ue.position),heights:G.filter(xt=>xt.position==Ue.position),setHeights:Q,expandByDefault:o,gap:E,loadingIcon:T,expanded:ne,pauseWhenPageIsHidden:D,swipeDirections:e.swipeDirections})})):null}))});const kJe=({...e})=>{const{theme:t="system"}=YQe();return r.jsx(jJe,{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 NJe=uge[" useId ".trim().toString()]||(()=>{}),SJe=0;function yd(e){const[t,s]=A.useState(NJe());return cc(()=>{s(n=>n??String(SJe++))},[e]),t?`radix-${t}`:""}const CJe=["top","right","bottom","left"],pv=Math.min,om=Math.max,Mte=Math.round,YL=Math.floor,Wg=e=>({x:e,y:e}),MJe={left:"right",right:"left",bottom:"top",top:"bottom"},TJe={start:"end",end:"start"};function _he(e,t,s){return om(e,pv(t,s))}function Ay(e,t){return typeof e=="function"?e(t):e}function Ey(e){return e.split("-")[0]}function N3(e){return e.split("-")[1]}function cxe(e){return e==="x"?"y":"x"}function dxe(e){return e==="y"?"height":"width"}const AJe=new Set(["top","bottom"]);function Tg(e){return AJe.has(Ey(e))?"y":"x"}function uxe(e){return cxe(Tg(e))}function EJe(e,t,s){s===void 0&&(s=!1);const n=N3(e),a=uxe(e),o=dxe(a);let l=a==="x"?n===(s?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(l=Tte(l)),[l,Tte(l)]}function IJe(e){const t=Tte(e);return[bhe(e),t,bhe(t)]}function bhe(e){return e.replace(/start|end/g,t=>TJe[t])}const Eje=["left","right"],Ije=["right","left"],PJe=["top","bottom"],LJe=["bottom","top"];function OJe(e,t,s){switch(e){case"top":case"bottom":return s?t?Ije:Eje:t?Eje:Ije;case"left":case"right":return t?PJe:LJe;default:return[]}}function DJe(e,t,s,n){const a=N3(e);let o=OJe(Ey(e),s==="start",n);return a&&(o=o.map(l=>l+"-"+a),t&&(o=o.concat(o.map(bhe)))),o}function Tte(e){return e.replace(/left|right|bottom|top/g,t=>MJe[t])}function RJe(e){return{top:0,right:0,bottom:0,left:0,...e}}function qIe(e){return typeof e!="number"?RJe(e):{top:e,right:e,bottom:e,left:e}}function Ate(e){const{x:t,y:s,width:n,height:a}=e;return{width:n,height:a,top:s,left:t,right:t+n,bottom:s+a,x:t,y:s}}function Pje(e,t,s){let{reference:n,floating:a}=e;const o=Tg(t),l=uxe(t),i=dxe(l),u=Ey(t),m=o==="y",x=n.x+n.width/2-a.width/2,y=n.y+n.height/2-a.height/2,v=n[i]/2-a[i]/2;let b;switch(u){case"top":b={x,y:n.y-a.height};break;case"bottom":b={x,y:n.y+n.height};break;case"right":b={x:n.x+n.width,y};break;case"left":b={x:n.x-a.width,y};break;default:b={x:n.x,y:n.y}}switch(N3(t)){case"start":b[l]-=v*(s&&m?-1:1);break;case"end":b[l]+=v*(s&&m?-1:1);break}return b}const FJe=async(e,t,s)=>{const{placement:n="bottom",strategy:a="absolute",middleware:o=[],platform:l}=s,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}=Pje(m,n,u),v=n,b={},N=0;for(let k=0;k({name:"arrow",options:e,async fn(t){const{x:s,y:n,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=qIe(x),v={x:s,y:n},b=uxe(a),N=dxe(b),k=await l.getDimensions(m),M=b==="y",E=M?"top":"left",T=M?"bottom":"right",P=M?"clientHeight":"clientWidth",R=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 q=U?U[P]:0;(!q||!await(l.isElement==null?void 0:l.isElement(U)))&&(q=i.floating[P]||o.floating[N]);const H=R/2-D/2,G=q/2-k[N]/2-1,Q=pv(y[E],G),ne=pv(y[T],G),ie=Q,he=q-k[N]-ne,se=q/2-k[N]/2+H,fe=_he(ie,se,he),oe=!u.arrow&&N3(a)!=null&&se!==fe&&o.reference[N]/2-(sese<=0)){var ne,ie;const se=(((ne=o.flip)==null?void 0:ne.index)||0)+1,fe=q[se];if(fe&&(!(y==="alignment"?T!==Tg(fe):!1)||Q.every(de=>de.overflows[0]>0&&Tg(de.placement)===T)))return{data:{index:se,overflows:Q},reset:{placement:fe}};let oe=(ie=Q.filter(ce=>ce.overflows[0]<=0).sort((ce,de)=>ce.overflows[1]-de.overflows[1])[0])==null?void 0:ie.placement;if(!oe)switch(b){case"bestFit":{var he;const ce=(he=Q.filter(de=>{if(U){const xe=Tg(de.placement);return xe===T||xe==="y"}return!0}).map(de=>[de.placement,de.overflows.filter(xe=>xe>0).reduce((xe,Me)=>xe+Me,0)]).sort((de,xe)=>de[1]-xe[1])[0])==null?void 0:he[0];ce&&(oe=ce);break}case"initialPlacement":oe=i;break}if(a!==oe)return{reset:{placement:oe}}}return{}}}};function Lje(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Oje(e){return CJe.some(t=>e[t]>=0)}const $Je=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:s}=t,{strategy:n="referenceHidden",...a}=Ay(e,t);switch(n){case"referenceHidden":{const o=await CE(t,{...a,elementContext:"reference"}),l=Lje(o,s.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Oje(l)}}}case"escaped":{const o=await CE(t,{...a,altBoundary:!0}),l=Lje(o,s.floating);return{data:{escapedOffsets:l,escaped:Oje(l)}}}default:return{}}}}},VIe=new Set(["left","top"]);async function UJe(e,t){const{placement:s,platform:n,elements:a}=e,o=await(n.isRTL==null?void 0:n.isRTL(a.floating)),l=Ey(s),i=N3(s),u=Tg(s)==="y",m=VIe.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 qJe=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var s,n;const{x:a,y:o,placement:l,middlewareData:i}=t,u=await UJe(t,e);return l===((s=i.offset)==null?void 0:s.placement)&&(n=i.arrow)!=null&&n.alignmentOffset?{}:{x:a+u.x,y:o+u.y,data:{...u,placement:l}}}}},VJe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:s,y:n,placement:a}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:i={fn:M=>{let{x:E,y:T}=M;return{x:E,y:T}}},...u}=Ay(e,t),m={x:s,y:n},x=await CE(t,u),y=Tg(Ey(a)),v=cxe(y);let b=m[v],N=m[y];if(o){const M=v==="y"?"top":"left",E=v==="y"?"bottom":"right",T=b+x[M],P=b-x[E];b=_he(T,b,P)}if(l){const M=y==="y"?"top":"left",E=y==="y"?"bottom":"right",T=N+x[M],P=N-x[E];N=_he(T,N,P)}const k=i.fn({...t,[v]:b,[y]:N});return{...k,data:{x:k.x-s,y:k.y-n,enabled:{[v]:o,[y]:l}}}}}},HJe=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:s,y:n,placement:a,rects:o,middlewareData:l}=t,{offset:i=0,mainAxis:u=!0,crossAxis:m=!0}=Ay(e,t),x={x:s,y:n},y=Tg(a),v=cxe(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",R=o.reference[v]-o.floating[P]+M.mainAxis,D=o.reference[v]+o.reference[P]-M.mainAxis;bD&&(b=D)}if(m){var E,T;const P=v==="y"?"width":"height",R=VIe.has(Ey(a)),D=o.reference[y]-o.floating[P]+(R&&((E=l.offset)==null?void 0:E[y])||0)+(R?0:M.crossAxis),U=o.reference[y]+o.reference[P]+(R?0:((T=l.offset)==null?void 0:T[y])||0)-(R?M.crossAxis:0);NU&&(N=U)}return{[v]:b,[y]:N}}}},WJe=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var s,n;const{placement:a,rects:o,platform:l,elements:i}=t,{apply:u=()=>{},...m}=Ay(e,t),x=await CE(t,m),y=Ey(a),v=N3(a),b=Tg(a)==="y",{width:N,height:k}=o.floating;let M,E;y==="top"||y==="bottom"?(M=y,E=v===(await(l.isRTL==null?void 0:l.isRTL(i.floating))?"start":"end")?"left":"right"):(E=y,M=v==="end"?"top":"bottom");const T=k-x.top-x.bottom,P=N-x.left-x.right,R=pv(k-x[M],T),D=pv(N-x[E],P),U=!t.middlewareData.shift;let q=R,H=D;if((s=t.middlewareData.shift)!=null&&s.enabled.x&&(H=P),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(q=T),U&&!v){const Q=om(x.left,0),ne=om(x.right,0),ie=om(x.top,0),he=om(x.bottom,0);b?H=N-2*(Q!==0||ne!==0?Q+ne:om(x.left,x.right)):q=k-2*(ie!==0||he!==0?ie+he:om(x.top,x.bottom))}await u({...t,availableWidth:H,availableHeight:q});const G=await l.getDimensions(i.floating);return N!==G.width||k!==G.height?{reset:{rects:!0}}:{}}}};function _ne(){return typeof window<"u"}function S3(e){return HIe(e)?(e.nodeName||"").toLowerCase():"#document"}function wm(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ax(e){var t;return(t=(HIe(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function HIe(e){return _ne()?e instanceof Node||e instanceof wm(e).Node:!1}function zf(e){return _ne()?e instanceof Element||e instanceof wm(e).Element:!1}function Qg(e){return _ne()?e instanceof HTMLElement||e instanceof wm(e).HTMLElement:!1}function Dje(e){return!_ne()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof wm(e).ShadowRoot}const GJe=new Set(["inline","contents"]);function QI(e){const{overflow:t,overflowX:s,overflowY:n,display:a}=Bf(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+s)&&!GJe.has(a)}const KJe=new Set(["table","td","th"]);function ZJe(e){return KJe.has(S3(e))}const YJe=[":popover-open",":modal"];function bne(e){return YJe.some(t=>{try{return e.matches(t)}catch{return!1}})}const XJe=["transform","translate","scale","rotate","perspective"],QJe=["transform","translate","scale","rotate","perspective","filter"],JJe=["paint","layout","strict","content"];function hxe(e){const t=mxe(),s=zf(e)?Bf(e):e;return XJe.some(n=>s[n]?s[n]!=="none":!1)||(s.containerType?s.containerType!=="normal":!1)||!t&&(s.backdropFilter?s.backdropFilter!=="none":!1)||!t&&(s.filter?s.filter!=="none":!1)||QJe.some(n=>(s.willChange||"").includes(n))||JJe.some(n=>(s.contain||"").includes(n))}function eet(e){let t=fv(e);for(;Qg(t)&&!AC(t);){if(hxe(t))return t;if(bne(t))return null;t=fv(t)}return null}function mxe(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const tet=new Set(["html","body","#document"]);function AC(e){return tet.has(S3(e))}function Bf(e){return wm(e).getComputedStyle(e)}function wne(e){return zf(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function fv(e){if(S3(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Dje(e)&&e.host||ax(e);return Dje(t)?t.host:t}function WIe(e){const t=fv(e);return AC(t)?e.ownerDocument?e.ownerDocument.body:e.body:Qg(t)&&QI(t)?t:WIe(t)}function ME(e,t,s){var n;t===void 0&&(t=[]),s===void 0&&(s=!0);const a=WIe(e),o=a===((n=e.ownerDocument)==null?void 0:n.body),l=wm(a);if(o){const i=whe(l);return t.concat(l,l.visualViewport||[],QI(a)?a:[],i&&s?ME(i):[])}return t.concat(a,ME(a,[],s))}function whe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function GIe(e){const t=Bf(e);let s=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=Qg(e),o=a?e.offsetWidth:s,l=a?e.offsetHeight:n,i=Mte(s)!==o||Mte(n)!==l;return i&&(s=o,n=l),{width:s,height:n,$:i}}function pxe(e){return zf(e)?e:e.contextElement}function WS(e){const t=pxe(e);if(!Qg(t))return Wg(1);const s=t.getBoundingClientRect(),{width:n,height:a,$:o}=GIe(t);let l=(o?Mte(s.width):s.width)/n,i=(o?Mte(s.height):s.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!i||!Number.isFinite(i))&&(i=1),{x:l,y:i}}const ret=Wg(0);function KIe(e){const t=wm(e);return!mxe()||!t.visualViewport?ret:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function set(e,t,s){return t===void 0&&(t=!1),!s||t&&s!==wm(e)?!1:t}function ok(e,t,s,n){t===void 0&&(t=!1),s===void 0&&(s=!1);const a=e.getBoundingClientRect(),o=pxe(e);let l=Wg(1);t&&(n?zf(n)&&(l=WS(n)):l=WS(e));const i=set(o,s,n)?KIe(o):Wg(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=wm(o),b=n&&zf(n)?wm(n):n;let N=v,k=whe(N);for(;k&&n&&b!==N;){const M=WS(k),E=k.getBoundingClientRect(),T=Bf(k),P=E.left+(k.clientLeft+parseFloat(T.paddingLeft))*M.x,R=E.top+(k.clientTop+parseFloat(T.paddingTop))*M.y;u*=M.x,m*=M.y,x*=M.x,y*=M.y,u+=P,m+=R,N=wm(k),k=whe(N)}}return Ate({width:x,height:y,x:u,y:m})}function fxe(e,t){const s=wne(e).scrollLeft;return t?t.left+s:ok(ax(e)).left+s}function ZIe(e,t,s){s===void 0&&(s=!1);const n=e.getBoundingClientRect(),a=n.left+t.scrollLeft-(s?0:fxe(e,n)),o=n.top+t.scrollTop;return{x:a,y:o}}function net(e){let{elements:t,rect:s,offsetParent:n,strategy:a}=e;const o=a==="fixed",l=ax(n),i=t?bne(t.floating):!1;if(n===l||i&&o)return s;let u={scrollLeft:0,scrollTop:0},m=Wg(1);const x=Wg(0),y=Qg(n);if((y||!y&&!o)&&((S3(n)!=="body"||QI(l))&&(u=wne(n)),Qg(n))){const b=ok(n);m=WS(n),x.x=b.x+n.clientLeft,x.y=b.y+n.clientTop}const v=l&&!y&&!o?ZIe(l,u,!0):Wg(0);return{width:s.width*m.x,height:s.height*m.y,x:s.x*m.x-u.scrollLeft*m.x+x.x+v.x,y:s.y*m.y-u.scrollTop*m.y+x.y+v.y}}function aet(e){return Array.from(e.getClientRects())}function iet(e){const t=ax(e),s=wne(e),n=e.ownerDocument.body,a=om(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=om(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let l=-s.scrollLeft+fxe(e);const i=-s.scrollTop;return Bf(n).direction==="rtl"&&(l+=om(t.clientWidth,n.clientWidth)-a),{width:a,height:o,x:l,y:i}}function oet(e,t){const s=wm(e),n=ax(e),a=s.visualViewport;let o=n.clientWidth,l=n.clientHeight,i=0,u=0;if(a){o=a.width,l=a.height;const m=mxe();(!m||m&&t==="fixed")&&(i=a.offsetLeft,u=a.offsetTop)}return{width:o,height:l,x:i,y:u}}const cet=new Set(["absolute","fixed"]);function det(e,t){const s=ok(e,!0,t==="fixed"),n=s.top+e.clientTop,a=s.left+e.clientLeft,o=Qg(e)?WS(e):Wg(1),l=e.clientWidth*o.x,i=e.clientHeight*o.y,u=a*o.x,m=n*o.y;return{width:l,height:i,x:u,y:m}}function Rje(e,t,s){let n;if(t==="viewport")n=oet(e,s);else if(t==="document")n=iet(ax(e));else if(zf(t))n=det(t,s);else{const a=KIe(e);n={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Ate(n)}function YIe(e,t){const s=fv(e);return s===t||!zf(s)||AC(s)?!1:Bf(s).position==="fixed"||YIe(s,t)}function uet(e,t){const s=t.get(e);if(s)return s;let n=ME(e,[],!1).filter(i=>zf(i)&&S3(i)!=="body"),a=null;const o=Bf(e).position==="fixed";let l=o?fv(e):e;for(;zf(l)&&!AC(l);){const i=Bf(l),u=hxe(l);!u&&i.position==="fixed"&&(a=null),(o?!u&&!a:!u&&i.position==="static"&&!!a&&cet.has(a.position)||QI(l)&&!u&&YIe(e,l))?n=n.filter(x=>x!==l):a=i,l=fv(l)}return t.set(e,n),n}function het(e){let{element:t,boundary:s,rootBoundary:n,strategy:a}=e;const l=[...s==="clippingAncestors"?bne(t)?[]:uet(t,this._c):[].concat(s),n],i=l[0],u=l.reduce((m,x)=>{const y=Rje(t,x,a);return m.top=om(y.top,m.top),m.right=pv(y.right,m.right),m.bottom=pv(y.bottom,m.bottom),m.left=om(y.left,m.left),m},Rje(t,i,a));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function met(e){const{width:t,height:s}=GIe(e);return{width:t,height:s}}function pet(e,t,s){const n=Qg(t),a=ax(t),o=s==="fixed",l=ok(e,!0,o,t);let i={scrollLeft:0,scrollTop:0};const u=Wg(0);function m(){u.x=fxe(a)}if(n||!n&&!o)if((S3(t)!=="body"||QI(a))&&(i=wne(t)),n){const b=ok(t,!0,o,t);u.x=b.x+t.clientLeft,u.y=b.y+t.clientTop}else a&&m();o&&!n&&a&&m();const x=a&&!n&&!o?ZIe(a,i):Wg(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 yce(e){return Bf(e).position==="static"}function Fje(e,t){if(!Qg(e)||Bf(e).position==="fixed")return null;if(t)return t(e);let s=e.offsetParent;return ax(e)===s&&(s=s.ownerDocument.body),s}function XIe(e,t){const s=wm(e);if(bne(e))return s;if(!Qg(e)){let a=fv(e);for(;a&&!AC(a);){if(zf(a)&&!yce(a))return a;a=fv(a)}return s}let n=Fje(e,t);for(;n&&ZJe(n)&&yce(n);)n=Fje(n,t);return n&&AC(n)&&yce(n)&&!hxe(n)?s:n||eet(e)||s}const fet=async function(e){const t=this.getOffsetParent||XIe,s=this.getDimensions,n=await s(e.floating);return{reference:pet(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function get(e){return Bf(e).direction==="rtl"}const xet={convertOffsetParentRelativeRectToViewportRelativeRect:net,getDocumentElement:ax,getClippingRect:het,getOffsetParent:XIe,getElementRects:fet,getClientRects:aet,getDimensions:met,getScale:WS,isElement:zf,isRTL:get};function QIe(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function yet(e,t){let s=null,n;const a=ax(e);function o(){var i;clearTimeout(n),(i=s)==null||i.disconnect(),s=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=YL(y),k=YL(a.clientWidth-(x+v)),M=YL(a.clientHeight-(y+b)),E=YL(x),P={rootMargin:-N+"px "+-k+"px "+-M+"px "+-E+"px",threshold:om(0,pv(1,u))||1};let R=!0;function D(U){const q=U[0].intersectionRatio;if(q!==u){if(!R)return l();q?l(!1,q):n=setTimeout(()=>{l(!1,1e-7)},1e3)}q===1&&!QIe(m,e.getBoundingClientRect())&&l(),R=!1}try{s=new IntersectionObserver(D,{...P,root:a.ownerDocument})}catch{s=new IntersectionObserver(D,P)}s.observe(e)}return l(!0),o}function vet(e,t,s,n){n===void 0&&(n={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:u=!1}=n,m=pxe(e),x=a||o?[...m?ME(m):[],...ME(t)]:[];x.forEach(E=>{a&&E.addEventListener("scroll",s,{passive:!0}),o&&E.addEventListener("resize",s)});const y=m&&i?yet(m,s):null;let v=-1,b=null;l&&(b=new ResizeObserver(E=>{let[T]=E;T&&T.target===m&&b&&(b.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var P;(P=b)==null||P.observe(t)})),s()}),m&&!u&&b.observe(m),b.observe(t));let N,k=u?ok(e):null;u&&M();function M(){const E=ok(e);k&&!QIe(k,E)&&s(),k=E,N=requestAnimationFrame(M)}return s(),()=>{var E;x.forEach(T=>{a&&T.removeEventListener("scroll",s),o&&T.removeEventListener("resize",s)}),y==null||y(),(E=b)==null||E.disconnect(),b=null,u&&cancelAnimationFrame(N)}}const _et=qJe,bet=VJe,wet=BJe,jet=WJe,ket=$Je,zje=zJe,Net=HJe,Cet=(e,t,s)=>{const n=new Map,a={platform:xet,...s},o={...a.platform,_c:n};return FJe(e,t,{...a,platform:o})};var Met=typeof document<"u",Tet=function(){},Fee=Met?A.useLayoutEffect:Tet;function Ete(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 s,n,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(s=e.length,s!==t.length)return!1;for(n=s;n--!==0;)if(!Ete(e[n],t[n]))return!1;return!0}if(a=Object.keys(e),s=a.length,s!==Object.keys(t).length)return!1;for(n=s;n--!==0;)if(!{}.hasOwnProperty.call(t,a[n]))return!1;for(n=s;n--!==0;){const o=a[n];if(!(o==="_owner"&&e.$$typeof)&&!Ete(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function JIe(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Bje(e,t){const s=JIe(e);return Math.round(t*s)/s}function vce(e){const t=A.useRef(e);return Fee(()=>{t.current=e}),t}function Aet(e){e===void 0&&(e={});const{placement:t="bottom",strategy:s="absolute",middleware:n=[],platform:a,elements:{reference:o,floating:l}={},transform:i=!0,whileElementsMounted:u,open:m}=e,[x,y]=A.useState({x:0,y:0,strategy:s,placement:t,middlewareData:{},isPositioned:!1}),[v,b]=A.useState(n);Ete(v,n)||b(n);const[N,k]=A.useState(null),[M,E]=A.useState(null),T=A.useCallback(de=>{de!==U.current&&(U.current=de,k(de))},[]),P=A.useCallback(de=>{de!==q.current&&(q.current=de,E(de))},[]),R=o||N,D=l||M,U=A.useRef(null),q=A.useRef(null),H=A.useRef(x),G=u!=null,Q=vce(u),ne=vce(a),ie=vce(m),he=A.useCallback(()=>{if(!U.current||!q.current)return;const de={placement:t,strategy:s,middleware:v};ne.current&&(de.platform=ne.current),Cet(U.current,q.current,de).then(xe=>{const Me={...xe,isPositioned:ie.current!==!1};se.current&&!Ete(H.current,Me)&&(H.current=Me,Eh.flushSync(()=>{y(Me)}))})},[v,t,s,ne,ie]);Fee(()=>{m===!1&&H.current.isPositioned&&(H.current.isPositioned=!1,y(de=>({...de,isPositioned:!1})))},[m]);const se=A.useRef(!1);Fee(()=>(se.current=!0,()=>{se.current=!1}),[]),Fee(()=>{if(R&&(U.current=R),D&&(q.current=D),R&&D){if(Q.current)return Q.current(R,D,he);he()}},[R,D,he,Q,G]);const fe=A.useMemo(()=>({reference:U,floating:q,setReference:T,setFloating:P}),[T,P]),oe=A.useMemo(()=>({reference:R,floating:D}),[R,D]),ce=A.useMemo(()=>{const de={position:s,left:0,top:0};if(!oe.floating)return de;const xe=Bje(oe.floating,x.x),Me=Bje(oe.floating,x.y);return i?{...de,transform:"translate("+xe+"px, "+Me+"px)",...JIe(oe.floating)>=1.5&&{willChange:"transform"}}:{position:s,left:xe,top:Me}},[s,i,oe.floating,x.x,x.y]);return A.useMemo(()=>({...x,update:he,refs:fe,elements:oe,floatingStyles:ce}),[x,he,fe,oe,ce])}const Eet=e=>{function t(s){return{}.hasOwnProperty.call(s,"current")}return{name:"arrow",options:e,fn(s){const{element:n,padding:a}=typeof e=="function"?e(s):e;return n&&t(n)?n.current!=null?zje({element:n.current,padding:a}).fn(s):{}:n?zje({element:n,padding:a}).fn(s):{}}}},Iet=(e,t)=>({..._et(e),options:[e,t]}),Pet=(e,t)=>({...bet(e),options:[e,t]}),Let=(e,t)=>({...Net(e),options:[e,t]}),Oet=(e,t)=>({...wet(e),options:[e,t]}),Det=(e,t)=>({...jet(e),options:[e,t]}),Ret=(e,t)=>({...ket(e),options:[e,t]}),Fet=(e,t)=>({...Eet(e),options:[e,t]});var zet="Arrow",ePe=A.forwardRef((e,t)=>{const{children:s,width:n=10,height:a=5,...o}=e;return r.jsx($s.svg,{...o,ref:t,width:n,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?s:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});ePe.displayName=zet;var Bet=ePe;function JI(e){const[t,s]=A.useState(void 0);return cc(()=>{if(e){s({width:e.offsetWidth,height:e.offsetHeight});const n=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;s({width:l,height:i})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else s(void 0)},[e]),t}var gxe="Popper",[tPe,ix]=uc(gxe),[$et,rPe]=tPe(gxe),sPe=e=>{const{__scopePopper:t,children:s}=e,[n,a]=A.useState(null);return r.jsx($et,{scope:t,anchor:n,onAnchorChange:a,children:s})};sPe.displayName=gxe;var nPe="PopperAnchor",aPe=A.forwardRef((e,t)=>{const{__scopePopper:s,virtualRef:n,...a}=e,o=rPe(nPe,s),l=A.useRef(null),i=ha(t,l);return A.useEffect(()=>{o.onAnchorChange((n==null?void 0:n.current)||l.current)}),n?null:r.jsx($s.div,{...a,ref:i})});aPe.displayName=nPe;var xxe="PopperContent",[Uet,qet]=tPe(xxe),iPe=A.forwardRef((e,t)=>{var Ue,Pe,$e,it,xt,Ee;const{__scopePopper:s,side:n="bottom",sideOffset:a=0,align:o="center",alignOffset:l=0,arrowPadding:i=0,avoidCollisions:u=!0,collisionBoundary:m=[],collisionPadding:x=0,sticky:y="partial",hideWhenDetached:v=!1,updatePositionStrategy:b="optimized",onPlaced:N,...k}=e,M=rPe(xxe,s),[E,T]=A.useState(null),P=ha(t,et=>T(et)),[R,D]=A.useState(null),U=JI(R),q=(U==null?void 0:U.width)??0,H=(U==null?void 0:U.height)??0,G=n+(o!=="center"?"-"+o:""),Q=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},ne=Array.isArray(m)?m:[m],ie=ne.length>0,he={padding:Q,boundary:ne.filter(Het),altBoundary:ie},{refs:se,floatingStyles:fe,placement:oe,isPositioned:ce,middlewareData:de}=Aet({strategy:"fixed",placement:G,whileElementsMounted:(...et)=>vet(...et,{animationFrame:b==="always"}),elements:{reference:M.anchor},middleware:[Iet({mainAxis:a+H,alignmentAxis:l}),u&&Pet({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?Let():void 0,...he}),u&&Oet({...he}),Det({...he,apply:({elements:et,rects:le,availableWidth:Ve,availableHeight:Je})=>{const{width:rt,height:je}=le.reference,lt=et.floating.style;lt.setProperty("--radix-popper-available-width",`${Ve}px`),lt.setProperty("--radix-popper-available-height",`${Je}px`),lt.setProperty("--radix-popper-anchor-width",`${rt}px`),lt.setProperty("--radix-popper-anchor-height",`${je}px`)}}),R&&Fet({element:R,padding:i}),Wet({arrowWidth:q,arrowHeight:H}),v&&Ret({strategy:"referenceHidden",...he})]}),[xe,Me]=cPe(oe),ve=ac(N);cc(()=>{ce&&(ve==null||ve())},[ce,ve]);const be=(Ue=de.arrow)==null?void 0:Ue.x,we=(Pe=de.arrow)==null?void 0:Pe.y,tt=(($e=de.arrow)==null?void 0:$e.centerOffset)!==0,[Ae,Le]=A.useState();return cc(()=>{E&&Le(window.getComputedStyle(E).zIndex)},[E]),r.jsx("div",{ref:se.setFloating,"data-radix-popper-content-wrapper":"",style:{...fe,transform:ce?fe.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ae,"--radix-popper-transform-origin":[(it=de.transformOrigin)==null?void 0:it.x,(xt=de.transformOrigin)==null?void 0:xt.y].join(" "),...((Ee=de.hide)==null?void 0:Ee.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(Uet,{scope:s,placedSide:xe,onArrowChange:D,arrowX:be,arrowY:we,shouldHideArrow:tt,children:r.jsx($s.div,{"data-side":xe,"data-align":Me,...k,ref:P,style:{...k.style,animation:ce?void 0:"none"}})})})});iPe.displayName=xxe;var oPe="PopperArrow",Vet={top:"bottom",right:"left",bottom:"top",left:"right"},lPe=A.forwardRef(function(t,s){const{__scopePopper:n,...a}=t,o=qet(oPe,n),l=Vet[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(Bet,{...a,ref:s,style:{...a.style,display:"block"}})})});lPe.displayName=oPe;function Het(e){return e!==null}var Wet=e=>({name:"transformOrigin",options:e,fn(t){var M,E,T;const{placement:s,rects:n,middlewareData:a}=t,l=((M=a.arrow)==null?void 0:M.centerOffset)!==0,i=l?0:e.arrowWidth,u=l?0:e.arrowHeight,[m,x]=cPe(s),y={start:"0%",center:"50%",end:"100%"}[x],v=(((E=a.arrow)==null?void 0:E.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=`${n.floating.height+u}px`):m==="right"?(N=`${-u}px`,k=l?y:`${b}px`):m==="left"&&(N=`${n.floating.width+u}px`,k=l?y:`${b}px`),{data:{x:N,y:k}}}});function cPe(e){const[t,s="center"]=e.split("-");return[t,s]}var eP=sPe,C3=aPe,tP=iPe,rP=lPe,[jne]=uc("Tooltip",[ix]),kne=ix(),dPe="TooltipProvider",Get=700,jhe="tooltip.open",[Ket,yxe]=jne(dPe),uPe=e=>{const{__scopeTooltip:t,delayDuration:s=Get,skipDelayDuration:n=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(Ket,{scope:t,isOpenDelayedRef:l,delayDuration:s,onOpen:A.useCallback(()=>{window.clearTimeout(u.current),l.current=!1},[]),onClose:A.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>l.current=!0,n)},[n]),isPointerInTransitRef:i,onPointerInTransitChange:A.useCallback(m=>{i.current=m},[]),disableHoverableContent:a,children:o})};uPe.displayName=dPe;var TE="Tooltip",[Zet,Nne]=jne(TE),hPe=e=>{const{__scopeTooltip:t,children:s,open:n,defaultOpen:a,onOpenChange:o,disableHoverableContent:l,delayDuration:i}=e,u=yxe(TE,e.__scopeTooltip),m=kne(t),[x,y]=A.useState(null),v=yd(),b=A.useRef(0),N=l??u.disableHoverableContent,k=i??u.delayDuration,M=A.useRef(!1),[E,T]=ah({prop:n,defaultProp:a??!1,onChange:q=>{q?(u.onOpen(),document.dispatchEvent(new CustomEvent(jhe))):u.onClose(),o==null||o(q)},caller:TE}),P=A.useMemo(()=>E?M.current?"delayed-open":"instant-open":"closed",[E]),R=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(eP,{...m,children:r.jsx(Zet,{scope:t,contentId:v,open:E,stateAttribute:P,trigger:x,onTriggerChange:y,onTriggerEnter:A.useCallback(()=>{u.isOpenDelayedRef.current?U():R()},[u.isOpenDelayedRef,U,R]),onTriggerLeave:A.useCallback(()=>{N?D():(window.clearTimeout(b.current),b.current=0)},[D,N]),onOpen:R,onClose:D,disableHoverableContent:N,children:s})})};hPe.displayName=TE;var khe="TooltipTrigger",mPe=A.forwardRef((e,t)=>{const{__scopeTooltip:s,...n}=e,a=Nne(khe,s),o=yxe(khe,s),l=kne(s),i=A.useRef(null),u=ha(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(C3,{asChild:!0,...l,children:r.jsx($s.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:u,onPointerMove:xs(e.onPointerMove,v=>{v.pointerType!=="touch"&&!x.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),x.current=!0)}),onPointerLeave:xs(e.onPointerLeave,()=>{a.onTriggerLeave(),x.current=!1}),onPointerDown:xs(e.onPointerDown,()=>{a.open&&a.onClose(),m.current=!0,document.addEventListener("pointerup",y,{once:!0})}),onFocus:xs(e.onFocus,()=>{m.current||a.onOpen()}),onBlur:xs(e.onBlur,a.onClose),onClick:xs(e.onClick,a.onClose)})})});mPe.displayName=khe;var Yet="TooltipPortal",[Ntr,Xet]=jne(Yet,{forceMount:void 0}),EC="TooltipContent",pPe=A.forwardRef((e,t)=>{const s=Xet(EC,e.__scopeTooltip),{forceMount:n=s.forceMount,side:a="top",...o}=e,l=Nne(EC,e.__scopeTooltip);return r.jsx(Ec,{present:n||l.open,children:l.disableHoverableContent?r.jsx(fPe,{side:a,...o,ref:t}):r.jsx(Qet,{side:a,...o,ref:t})})}),Qet=A.forwardRef((e,t)=>{const s=Nne(EC,e.__scopeTooltip),n=yxe(EC,e.__scopeTooltip),a=A.useRef(null),o=ha(t,a),[l,i]=A.useState(null),{trigger:u,onClose:m}=s,x=a.current,{onPointerInTransitChange:y}=n,v=A.useCallback(()=>{i(null),y(!1)},[y]),b=A.useCallback((N,k)=>{const M=N.currentTarget,E={x:N.clientX,y:N.clientY},T=stt(E,M.getBoundingClientRect()),P=ntt(E,T),R=att(k.getBoundingClientRect()),D=ott([...P,...R]);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,E={x:k.clientX,y:k.clientY},T=(u==null?void 0:u.contains(M))||(x==null?void 0:x.contains(M)),P=!itt(E,l);T?v():P&&(v(),m())};return document.addEventListener("pointermove",N),()=>document.removeEventListener("pointermove",N)}},[u,x,l,m,v]),r.jsx(fPe,{...e,ref:o})}),[Jet,ett]=jne(TE,{isInside:!1}),ttt=aIe("TooltipContent"),fPe=A.forwardRef((e,t)=>{const{__scopeTooltip:s,children:n,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:l,...i}=e,u=Nne(EC,s),m=kne(s),{onClose:x}=u;return A.useEffect(()=>(document.addEventListener(jhe,x),()=>document.removeEventListener(jhe,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(kv,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:y=>y.preventDefault(),onDismiss:x,children:r.jsxs(tP,{"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(ttt,{children:n}),r.jsx(Jet,{scope:s,isInside:!0,children:r.jsx(qXe,{id:u.contentId,role:"tooltip",children:a||n})})]})})});pPe.displayName=EC;var gPe="TooltipArrow",rtt=A.forwardRef((e,t)=>{const{__scopeTooltip:s,...n}=e,a=kne(s);return ett(gPe,s).isInside?null:r.jsx(rP,{...a,...n,ref:t})});rtt.displayName=gPe;function stt(e,t){const s=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(s,n,a,o)){case o:return"left";case a:return"right";case s:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function ntt(e,t,s=5){const n=[];switch(t){case"top":n.push({x:e.x-s,y:e.y+s},{x:e.x+s,y:e.y+s});break;case"bottom":n.push({x:e.x-s,y:e.y-s},{x:e.x+s,y:e.y-s});break;case"left":n.push({x:e.x+s,y:e.y-s},{x:e.x+s,y:e.y+s});break;case"right":n.push({x:e.x-s,y:e.y-s},{x:e.x-s,y:e.y+s});break}return n}function att(e){const{top:t,right:s,bottom:n,left:a}=e;return[{x:a,y:t},{x:s,y:t},{x:s,y:n},{x:a,y:n}]}function itt(e,t){const{x:s,y:n}=e;let a=!1;for(let o=0,l=t.length-1;on!=v>n&&s<(y-m)*(n-x)/(v-x)+m&&(a=!a)}return a}function ott(e){const t=e.slice();return t.sort((s,n)=>s.xn.x?1:s.yn.y?1:0),ltt(t)}function ltt(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n=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 s=[];for(let n=e.length-1;n>=0;n--){const a=e[n];for(;s.length>=2;){const o=s[s.length-1],l=s[s.length-2];if((o.x-l.x)*(a.y-l.y)>=(o.y-l.y)*(a.x-l.x))s.pop();else break}s.push(a)}return s.pop(),t.length===1&&s.length===1&&t[0].x===s[0].x&&t[0].y===s[0].y?t:t.concat(s)}var ctt=uPe,dtt=hPe,utt=mPe,xPe=pPe;const sP=ctt,Gg=dtt,Kg=utt,Of=A.forwardRef(({className:e,sideOffset:t=4,...s},n)=>r.jsx(xPe,{ref:n,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),...s}));Of.displayName=xPe.displayName;var M3=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(){}},lk=typeof window>"u"||"Deno"in globalThis;function Gu(){}function htt(e,t){return typeof e=="function"?e(t):e}function Nhe(e){return typeof e=="number"&&e>=0&&e!==1/0}function yPe(e,t){return Math.max(e+(t||0)-Date.now(),0)}function tv(e,t){return typeof e=="function"?e(t):e}function ep(e,t){return typeof e=="function"?e(t):e}function $je(e,t){const{type:s="all",exact:n,fetchStatus:a,predicate:o,queryKey:l,stale:i}=e;if(l){if(n){if(t.queryHash!==vxe(l,t.options))return!1}else if(!AE(t.queryKey,l))return!1}if(s!=="all"){const u=t.isActive();if(s==="active"&&!u||s==="inactive"&&u)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||a&&a!==t.state.fetchStatus||o&&!o(t))}function Uje(e,t){const{exact:s,status:n,predicate:a,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(s){if(ck(t.options.mutationKey)!==ck(o))return!1}else if(!AE(t.options.mutationKey,o))return!1}return!(n&&t.state.status!==n||a&&!a(t))}function vxe(e,t){return((t==null?void 0:t.queryKeyHashFn)||ck)(e)}function ck(e){return JSON.stringify(e,(t,s)=>She(s)?Object.keys(s).sort().reduce((n,a)=>(n[a]=s[a],n),{}):s)}function AE(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(s=>AE(e[s],t[s])):!1}function vPe(e,t){if(e===t)return e;const s=qje(e)&&qje(t);if(s||She(e)&&She(t)){const n=s?e:Object.keys(e),a=n.length,o=s?t:Object.keys(t),l=o.length,i=s?[]:{},u=new Set(n);let m=0;for(let x=0;x{setTimeout(t,e)})}function Che(e,t,s){return typeof s.structuralSharing=="function"?s.structuralSharing(e,t):s.structuralSharing!==!1?vPe(e,t):t}function ptt(e,t,s=0){const n=[...e,t];return s&&n.length>s?n.slice(1):n}function ftt(e,t,s=0){const n=[t,...e];return s&&n.length>s?n.slice(0,-1):n}var _xe=Symbol();function _Pe(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===_xe?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function bPe(e,t){return typeof e=="function"?e(...t):!!e}var vj,p1,uC,LTe,gtt=(LTe=class extends M3{constructor(){super();_a(this,vj);_a(this,p1);_a(this,uC);_n(this,uC,t=>{if(!lk&&window.addEventListener){const s=()=>t();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){tr(this,p1)||this.setEventListener(tr(this,uC))}onUnsubscribe(){var t;this.hasListeners()||((t=tr(this,p1))==null||t.call(this),_n(this,p1,void 0))}setEventListener(t){var s;_n(this,uC,t),(s=tr(this,p1))==null||s.call(this),_n(this,p1,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){tr(this,vj)!==t&&(_n(this,vj,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(s=>{s(t)})}isFocused(){var t;return typeof tr(this,vj)=="boolean"?tr(this,vj):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},vj=new WeakMap,p1=new WeakMap,uC=new WeakMap,LTe),bxe=new gtt,hC,f1,mC,OTe,xtt=(OTe=class extends M3{constructor(){super();_a(this,hC,!0);_a(this,f1);_a(this,mC);_n(this,mC,t=>{if(!lk&&window.addEventListener){const s=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",s,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",n)}}})}onSubscribe(){tr(this,f1)||this.setEventListener(tr(this,mC))}onUnsubscribe(){var t;this.hasListeners()||((t=tr(this,f1))==null||t.call(this),_n(this,f1,void 0))}setEventListener(t){var s;_n(this,mC,t),(s=tr(this,f1))==null||s.call(this),_n(this,f1,t(this.setOnline.bind(this)))}setOnline(t){tr(this,hC)!==t&&(_n(this,hC,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return tr(this,hC)}},hC=new WeakMap,f1=new WeakMap,mC=new WeakMap,OTe),Pte=new xtt;function Mhe(){let e,t;const s=new Promise((a,o)=>{e=a,t=o});s.status="pending",s.catch(()=>{});function n(a){Object.assign(s,a),delete s.resolve,delete s.reject}return s.resolve=a=>{n({status:"fulfilled",value:a}),e(a)},s.reject=a=>{n({status:"rejected",reason:a}),t(a)},s}function ytt(e){return Math.min(1e3*2**e,3e4)}function wPe(e){return(e??"online")==="online"?Pte.isOnline():!0}var jPe=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function _ce(e){return e instanceof jPe}function kPe(e){let t=!1,s=0,n=!1,a;const o=Mhe(),l=k=>{var M;n||(v(new jPe(k)),(M=e.abort)==null||M.call(e))},i=()=>{t=!0},u=()=>{t=!1},m=()=>bxe.isFocused()&&(e.networkMode==="always"||Pte.isOnline())&&e.canRun(),x=()=>wPe(e.networkMode)&&e.canRun(),y=k=>{var M;n||(n=!0,(M=e.onSuccess)==null||M.call(e,k),a==null||a(),o.resolve(k))},v=k=>{var M;n||(n=!0,(M=e.onError)==null||M.call(e,k),a==null||a(),o.reject(k))},b=()=>new Promise(k=>{var M;a=E=>{(n||m())&&k(E)},(M=e.onPause)==null||M.call(e)}).then(()=>{var k;a=void 0,n||(k=e.onContinue)==null||k.call(e)}),N=()=>{if(n)return;let k;const M=s===0?e.initialPromise:void 0;try{k=M??e.fn()}catch(E){k=Promise.reject(E)}Promise.resolve(k).then(y).catch(E=>{var U;if(n)return;const T=e.retry??(lk?0:3),P=e.retryDelay??ytt,R=typeof P=="function"?P(s,E):P,D=T===!0||typeof T=="number"&&sm()?void 0:b()).then(()=>{t?v(E):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 vtt=e=>setTimeout(e,0);function _tt(){let e=[],t=0,s=i=>{i()},n=i=>{i()},a=vtt;const o=i=>{t?e.push(i):a(()=>{s(i)})},l=()=>{const i=e;e=[],i.length&&a(()=>{n(()=>{i.forEach(u=>{s(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=>{s=i},setBatchNotifyFunction:i=>{n=i},setScheduler:i=>{a=i}}}var id=_tt(),_j,DTe,NPe=(DTe=class{constructor(){_a(this,_j)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Nhe(this.gcTime)&&_n(this,_j,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(lk?1/0:5*60*1e3))}clearGcTimeout(){tr(this,_j)&&(clearTimeout(tr(this,_j)),_n(this,_j,void 0))}},_j=new WeakMap,DTe),pC,bj,Jm,wj,pu,$I,jj,df,$x,RTe,btt=(RTe=class extends NPe{constructor(t){super();_a(this,df);_a(this,pC);_a(this,bj);_a(this,Jm);_a(this,wj);_a(this,pu);_a(this,$I);_a(this,jj);_n(this,jj,!1),_n(this,$I,t.defaultOptions),this.setOptions(t.options),this.observers=[],_n(this,wj,t.client),_n(this,Jm,tr(this,wj).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,_n(this,pC,wtt(this.options)),this.state=t.state??tr(this,pC),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=tr(this,pu))==null?void 0:t.promise}setOptions(t){this.options={...tr(this,$I),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&tr(this,Jm).remove(this)}setData(t,s){const n=Che(this.state.data,t,this.options);return yi(this,df,$x).call(this,{data:n,type:"success",dataUpdatedAt:s==null?void 0:s.updatedAt,manual:s==null?void 0:s.manual}),n}setState(t,s){yi(this,df,$x).call(this,{type:"setState",state:t,setStateOptions:s})}cancel(t){var n,a;const s=(n=tr(this,pu))==null?void 0:n.promise;return(a=tr(this,pu))==null||a.cancel(t),s?s.then(Gu).catch(Gu):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(tr(this,pC))}isActive(){return this.observers.some(t=>ep(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===_xe||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>tv(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!yPe(this.state.dataUpdatedAt,t)}onFocus(){var s;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(s=tr(this,pu))==null||s.continue()}onOnline(){var s;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(s=tr(this,pu))==null||s.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),tr(this,Jm).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(s=>s!==t),this.observers.length||(tr(this,pu)&&(tr(this,jj)?tr(this,pu).cancel({revert:!0}):tr(this,pu).cancelRetry()),this.scheduleGc()),tr(this,Jm).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||yi(this,df,$x).call(this,{type:"invalidate"})}fetch(t,s){var m,x,y;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(tr(this,pu))return tr(this,pu).continueRetry(),tr(this,pu).promise}if(t&&this.setOptions(t),!this.options.queryFn){const v=this.observers.find(b=>b.options.queryFn);v&&this.setOptions(v.options)}const n=new AbortController,a=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(_n(this,jj,!0),n.signal)})},o=()=>{const v=_Pe(this.options,s),N=(()=>{const k={client:tr(this,wj),queryKey:this.queryKey,meta:this.meta};return a(k),k})();return _n(this,jj,!1),this.options.persister?this.options.persister(v,N,this):v(N)},i=(()=>{const v={fetchOptions:s,options:this.options,queryKey:this.queryKey,client:tr(this,wj),state:this.state,fetchFn:o};return a(v),v})();(m=this.options.behavior)==null||m.onFetch(i,this),_n(this,bj,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((x=i.fetchOptions)==null?void 0:x.meta))&&yi(this,df,$x).call(this,{type:"fetch",meta:(y=i.fetchOptions)==null?void 0:y.meta});const u=v=>{var b,N,k,M;_ce(v)&&v.silent||yi(this,df,$x).call(this,{type:"error",error:v}),_ce(v)||((N=(b=tr(this,Jm).config).onError)==null||N.call(b,v,this),(M=(k=tr(this,Jm).config).onSettled)==null||M.call(k,this.state.data,v,this)),this.scheduleGc()};return _n(this,pu,kPe({initialPromise:s==null?void 0:s.initialPromise,fn:i.fetchFn,abort:n.abort.bind(n),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(E){u(E);return}(N=(b=tr(this,Jm).config).onSuccess)==null||N.call(b,v,this),(M=(k=tr(this,Jm).config).onSettled)==null||M.call(k,v,this.state.error,this),this.scheduleGc()},onError:u,onFail:(v,b)=>{yi(this,df,$x).call(this,{type:"failed",failureCount:v,error:b})},onPause:()=>{yi(this,df,$x).call(this,{type:"pause"})},onContinue:()=>{yi(this,df,$x).call(this,{type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0})),tr(this,pu).start()}},pC=new WeakMap,bj=new WeakMap,Jm=new WeakMap,wj=new WeakMap,pu=new WeakMap,$I=new WeakMap,jj=new WeakMap,df=new WeakSet,$x=function(t){const s=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...SPe(n.data,this.options),fetchMeta:t.meta??null};case"success":return _n(this,bj,void 0),{...n,data:t.data,dataUpdateCount:n.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 _ce(a)&&a.revert&&tr(this,bj)?{...tr(this,bj),fetchStatus:"idle"}:{...n,error:a,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=s(this.state),id.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),tr(this,Jm).notify({query:this,type:"updated",action:t})})},RTe);function SPe(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:wPe(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function wtt(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,s=t!==void 0,n=s?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:s?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var wg,FTe,jtt=(FTe=class extends M3{constructor(t={}){super();_a(this,wg);this.config=t,_n(this,wg,new Map)}build(t,s,n){const a=s.queryKey,o=s.queryHash??vxe(a,s);let l=this.get(o);return l||(l=new btt({client:t,queryKey:a,queryHash:o,options:t.defaultQueryOptions(s),state:n,defaultOptions:t.getQueryDefaults(a)}),this.add(l)),l}add(t){tr(this,wg).has(t.queryHash)||(tr(this,wg).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const s=tr(this,wg).get(t.queryHash);s&&(t.destroy(),s===t&&tr(this,wg).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){id.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return tr(this,wg).get(t)}getAll(){return[...tr(this,wg).values()]}find(t){const s={exact:!0,...t};return this.getAll().find(n=>$je(s,n))}findAll(t={}){const s=this.getAll();return Object.keys(t).length>0?s.filter(n=>$je(t,n)):s}notify(t){id.batch(()=>{this.listeners.forEach(s=>{s(t)})})}onFocus(){id.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){id.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},wg=new WeakMap,FTe),jg,Vu,kj,kg,U0,zTe,ktt=(zTe=class extends NPe{constructor(t){super();_a(this,kg);_a(this,jg);_a(this,Vu);_a(this,kj);this.mutationId=t.mutationId,_n(this,Vu,t.mutationCache),_n(this,jg,[]),this.state=t.state||CPe(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){tr(this,jg).includes(t)||(tr(this,jg).push(t),this.clearGcTimeout(),tr(this,Vu).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){_n(this,jg,tr(this,jg).filter(s=>s!==t)),this.scheduleGc(),tr(this,Vu).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){tr(this,jg).length||(this.state.status==="pending"?this.scheduleGc():tr(this,Vu).remove(this))}continue(){var t;return((t=tr(this,kj))==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,E,T,P,R,D,U,q,H;const s=()=>{yi(this,kg,U0).call(this,{type:"continue"})};_n(this,kj,kPe({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(G,Q)=>{yi(this,kg,U0).call(this,{type:"failed",failureCount:G,error:Q})},onPause:()=>{yi(this,kg,U0).call(this,{type:"pause"})},onContinue:s,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>tr(this,Vu).canRun(this)}));const n=this.state.status==="pending",a=!tr(this,kj).canStart();try{if(n)s();else{yi(this,kg,U0).call(this,{type:"pending",variables:t,isPaused:a}),await((l=(o=tr(this,Vu).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,kg,U0).call(this,{type:"pending",context:Q,variables:t,isPaused:a})}const G=await tr(this,kj).start();return await((x=(m=tr(this,Vu).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,Vu).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,kg,U0).call(this,{type:"success",data:G}),G}catch(G){try{throw await((T=(E=tr(this,Vu).config).onError)==null?void 0:T.call(E,G,t,this.state.context,this)),await((R=(P=this.options).onError)==null?void 0:R.call(P,G,t,this.state.context)),await((U=(D=tr(this,Vu).config).onSettled)==null?void 0:U.call(D,void 0,G,this.state.variables,this.state.context,this)),await((H=(q=this.options).onSettled)==null?void 0:H.call(q,void 0,G,t,this.state.context)),G}finally{yi(this,kg,U0).call(this,{type:"error",error:G})}}finally{tr(this,Vu).runNext(this)}}},jg=new WeakMap,Vu=new WeakMap,kj=new WeakMap,kg=new WeakSet,U0=function(t){const s=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,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{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=s(this.state),id.batch(()=>{tr(this,jg).forEach(n=>{n.onMutationUpdate(t)}),tr(this,Vu).notify({mutation:this,type:"updated",action:t})})},zTe);function CPe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Yx,uf,UI,BTe,Ntt=(BTe=class extends M3{constructor(t={}){super();_a(this,Yx);_a(this,uf);_a(this,UI);this.config=t,_n(this,Yx,new Set),_n(this,uf,new Map),_n(this,UI,0)}build(t,s,n){const a=new ktt({mutationCache:this,mutationId:++TL(this,UI)._,options:t.defaultMutationOptions(s),state:n});return this.add(a),a}add(t){tr(this,Yx).add(t);const s=XL(t);if(typeof s=="string"){const n=tr(this,uf).get(s);n?n.push(t):tr(this,uf).set(s,[t])}this.notify({type:"added",mutation:t})}remove(t){if(tr(this,Yx).delete(t)){const s=XL(t);if(typeof s=="string"){const n=tr(this,uf).get(s);if(n)if(n.length>1){const a=n.indexOf(t);a!==-1&&n.splice(a,1)}else n[0]===t&&tr(this,uf).delete(s)}}this.notify({type:"removed",mutation:t})}canRun(t){const s=XL(t);if(typeof s=="string"){const n=tr(this,uf).get(s),a=n==null?void 0:n.find(o=>o.state.status==="pending");return!a||a===t}else return!0}runNext(t){var n;const s=XL(t);if(typeof s=="string"){const a=(n=tr(this,uf).get(s))==null?void 0:n.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,Yx).forEach(t=>{this.notify({type:"removed",mutation:t})}),tr(this,Yx).clear(),tr(this,uf).clear()})}getAll(){return Array.from(tr(this,Yx))}find(t){const s={exact:!0,...t};return this.getAll().find(n=>Uje(s,n))}findAll(t={}){return this.getAll().filter(s=>Uje(t,s))}notify(t){id.batch(()=>{this.listeners.forEach(s=>{s(t)})})}resumePausedMutations(){const t=this.getAll().filter(s=>s.state.isPaused);return id.batch(()=>Promise.all(t.map(s=>s.continue().catch(Gu))))}},Yx=new WeakMap,uf=new WeakMap,UI=new WeakMap,BTe);function XL(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Lte(e){return{onFetch:(t,s)=>{var x,y,v,b,N;const n=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)})},E=_Pe(t.options,t.fetchOptions),T=async(P,R,D)=>{if(k)return Promise.reject();if(R==null&&P.pages.length)return Promise.resolve(P);const q=(()=>{const ne={client:t.client,queryKey:t.queryKey,pageParam:R,direction:D?"backward":"forward",meta:t.options.meta};return M(ne),ne})(),H=await E(q),{maxPages:G}=t.options,Q=D?ftt:ptt;return{pages:Q(P.pages,H,G),pageParams:Q(P.pageParams,R,G)}};if(a&&o.length){const P=a==="backward",R=P?MPe:The,D={pages:o,pageParams:l},U=R(n,D);i=await T(D,U,P)}else{const P=e??o.length;do{const R=u===0?l[0]??n.initialPageParam:The(n,i);if(u>0&&R==null)break;i=await T(i,R),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},s)}:t.fetchFn=m}}}function The(e,{pages:t,pageParams:s}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,s[n],s):void 0}function MPe(e,{pages:t,pageParams:s}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,s[0],s):void 0}function Stt(e,t){return t?The(e,t)!=null:!1}function Ctt(e,t){return!t||!e.getPreviousPageParam?!1:MPe(e,t)!=null}var Xl,g1,x1,fC,gC,y1,xC,yC,$Te,Mtt=($Te=class{constructor(e={}){_a(this,Xl);_a(this,g1);_a(this,x1);_a(this,fC);_a(this,gC);_a(this,y1);_a(this,xC);_a(this,yC);_n(this,Xl,e.queryCache||new jtt),_n(this,g1,e.mutationCache||new Ntt),_n(this,x1,e.defaultOptions||{}),_n(this,fC,new Map),_n(this,gC,new Map),_n(this,y1,0)}mount(){TL(this,y1)._++,tr(this,y1)===1&&(_n(this,xC,bxe.subscribe(async e=>{e&&(await this.resumePausedMutations(),tr(this,Xl).onFocus())})),_n(this,yC,Pte.subscribe(async e=>{e&&(await this.resumePausedMutations(),tr(this,Xl).onOnline())})))}unmount(){var e,t;TL(this,y1)._--,tr(this,y1)===0&&((e=tr(this,xC))==null||e.call(this),_n(this,xC,void 0),(t=tr(this,yC))==null||t.call(this),_n(this,yC,void 0))}isFetching(e){return tr(this,Xl).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return tr(this,g1).findAll({...e,status:"pending"}).length}getQueryData(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=tr(this,Xl).get(t.queryHash))==null?void 0:s.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),s=tr(this,Xl).build(this,t),n=s.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime(tv(t.staleTime,s))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return tr(this,Xl).findAll(e).map(({queryKey:t,state:s})=>{const n=s.data;return[t,n]})}setQueryData(e,t,s){const n=this.defaultQueryOptions({queryKey:e}),a=tr(this,Xl).get(n.queryHash),o=a==null?void 0:a.state.data,l=htt(t,o);if(l!==void 0)return tr(this,Xl).build(this,n).setData(l,{...s,manual:!0})}setQueriesData(e,t,s){return id.batch(()=>tr(this,Xl).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,s)]))}getQueryState(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=tr(this,Xl).get(t.queryHash))==null?void 0:s.state}removeQueries(e){const t=tr(this,Xl);id.batch(()=>{t.findAll(e).forEach(s=>{t.remove(s)})})}resetQueries(e,t){const s=tr(this,Xl);return id.batch(()=>(s.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const s={revert:!0,...t},n=id.batch(()=>tr(this,Xl).findAll(e).map(a=>a.cancel(s)));return Promise.all(n).then(Gu).catch(Gu)}invalidateQueries(e,t={}){return id.batch(()=>(tr(this,Xl).findAll(e).forEach(s=>{s.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 s={...t,cancelRefetch:t.cancelRefetch??!0},n=id.batch(()=>tr(this,Xl).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let o=a.fetch(void 0,s);return s.throwOnError||(o=o.catch(Gu)),a.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(n).then(Gu)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const s=tr(this,Xl).build(this,t);return s.isStaleByTime(tv(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Gu).catch(Gu)}fetchInfiniteQuery(e){return e.behavior=Lte(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Gu).catch(Gu)}ensureInfiniteQueryData(e){return e.behavior=Lte(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Pte.isOnline()?tr(this,g1).resumePausedMutations():Promise.resolve()}getQueryCache(){return tr(this,Xl)}getMutationCache(){return tr(this,g1)}getDefaultOptions(){return tr(this,x1)}setDefaultOptions(e){_n(this,x1,e)}setQueryDefaults(e,t){tr(this,fC).set(ck(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...tr(this,fC).values()],s={};return t.forEach(n=>{AE(e,n.queryKey)&&Object.assign(s,n.defaultOptions)}),s}setMutationDefaults(e,t){tr(this,gC).set(ck(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...tr(this,gC).values()],s={};return t.forEach(n=>{AE(e,n.mutationKey)&&Object.assign(s,n.defaultOptions)}),s}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=vxe(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===_xe&&(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,Xl).clear(),tr(this,g1).clear()}},Xl=new WeakMap,g1=new WeakMap,x1=new WeakMap,fC=new WeakMap,gC=new WeakMap,y1=new WeakMap,xC=new WeakMap,yC=new WeakMap,$Te),jh,Ji,qI,Hu,Nj,vC,v1,_1,VI,_C,bC,Sj,Cj,b1,wC,To,DT,Ahe,Ehe,Ihe,Phe,Lhe,Ohe,Dhe,APe,UTe,TPe=(UTe=class extends M3{constructor(t,s){super();_a(this,To);_a(this,jh);_a(this,Ji);_a(this,qI);_a(this,Hu);_a(this,Nj);_a(this,vC);_a(this,v1);_a(this,_1);_a(this,VI);_a(this,_C);_a(this,bC);_a(this,Sj);_a(this,Cj);_a(this,b1);_a(this,wC,new Set);this.options=s,_n(this,jh,t),_n(this,_1,null),_n(this,v1,Mhe()),this.options.experimental_prefetchInRender||tr(this,v1).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(tr(this,Ji).addObserver(this),Hje(tr(this,Ji),this.options)?yi(this,To,DT).call(this):this.updateResult(),yi(this,To,Phe).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Rhe(tr(this,Ji),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Rhe(tr(this,Ji),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,yi(this,To,Lhe).call(this),yi(this,To,Ohe).call(this),tr(this,Ji).removeObserver(this)}setOptions(t){const s=this.options,n=tr(this,Ji);if(this.options=tr(this,jh).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ep(this.options.enabled,tr(this,Ji))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");yi(this,To,Dhe).call(this),tr(this,Ji).setOptions(this.options),s._defaulted&&!Ite(this.options,s)&&tr(this,jh).getQueryCache().notify({type:"observerOptionsUpdated",query:tr(this,Ji),observer:this});const a=this.hasListeners();a&&Wje(tr(this,Ji),n,this.options,s)&&yi(this,To,DT).call(this),this.updateResult(),a&&(tr(this,Ji)!==n||ep(this.options.enabled,tr(this,Ji))!==ep(s.enabled,tr(this,Ji))||tv(this.options.staleTime,tr(this,Ji))!==tv(s.staleTime,tr(this,Ji)))&&yi(this,To,Ahe).call(this);const o=yi(this,To,Ehe).call(this);a&&(tr(this,Ji)!==n||ep(this.options.enabled,tr(this,Ji))!==ep(s.enabled,tr(this,Ji))||o!==tr(this,b1))&&yi(this,To,Ihe).call(this,o)}getOptimisticResult(t){const s=tr(this,jh).getQueryCache().build(tr(this,jh),t),n=this.createResult(s,t);return Att(this,n)&&(_n(this,Hu,n),_n(this,vC,this.options),_n(this,Nj,tr(this,Ji).state)),n}getCurrentResult(){return tr(this,Hu)}trackResult(t,s){return new Proxy(t,{get:(n,a)=>(this.trackProp(a),s==null||s(a),Reflect.get(n,a))})}trackProp(t){tr(this,wC).add(t)}getCurrentQuery(){return tr(this,Ji)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const s=tr(this,jh).defaultQueryOptions(t),n=tr(this,jh).getQueryCache().build(tr(this,jh),s);return n.fetch().then(()=>this.createResult(n,s))}fetch(t){return yi(this,To,DT).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),tr(this,Hu)))}createResult(t,s){var G;const n=tr(this,Ji),a=this.options,o=tr(this,Hu),l=tr(this,Nj),i=tr(this,vC),m=t!==n?t.state:tr(this,qI),{state:x}=t;let y={...x},v=!1,b;if(s._optimisticResults){const Q=this.hasListeners(),ne=!Q&&Hje(t,s),ie=Q&&Wje(t,n,s,a);(ne||ie)&&(y={...y,...SPe(x.data,t.options)}),s._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:N,errorUpdatedAt:k,status:M}=y;b=y.data;let E=!1;if(s.placeholderData!==void 0&&b===void 0&&M==="pending"){let Q;o!=null&&o.isPlaceholderData&&s.placeholderData===(i==null?void 0:i.placeholderData)?(Q=o.data,E=!0):Q=typeof s.placeholderData=="function"?s.placeholderData((G=tr(this,bC))==null?void 0:G.state.data,tr(this,bC)):s.placeholderData,Q!==void 0&&(M="success",b=Che(o==null?void 0:o.data,Q,s),v=!0)}if(s.select&&b!==void 0&&!E)if(o&&b===(l==null?void 0:l.data)&&s.select===tr(this,VI))b=tr(this,_C);else try{_n(this,VI,s.select),b=s.select(b),b=Che(o==null?void 0:o.data,b,s),_n(this,_C,b),_n(this,_1,null)}catch(Q){_n(this,_1,Q)}tr(this,_1)&&(N=tr(this,_1),b=tr(this,_C),k=Date.now(),M="error");const T=y.fetchStatus==="fetching",P=M==="pending",R=M==="error",D=P&&T,U=b!==void 0,H={status:M,fetchStatus:y.fetchStatus,isPending:P,isSuccess:M==="success",isError:R,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:R&&!U,isPaused:y.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:R&&U,isStale:wxe(t,s),refetch:this.refetch,promise:tr(this,v1),isEnabled:ep(s.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const Q=he=>{H.status==="error"?he.reject(H.error):H.data!==void 0&&he.resolve(H.data)},ne=()=>{const he=_n(this,v1,H.promise=Mhe());Q(he)},ie=tr(this,v1);switch(ie.status){case"pending":t.queryHash===n.queryHash&&Q(ie);break;case"fulfilled":(H.status==="error"||H.data!==ie.value)&&ne();break;case"rejected":(H.status!=="error"||H.error!==ie.reason)&&ne();break}}return H}updateResult(){const t=tr(this,Hu),s=this.createResult(tr(this,Ji),this.options);if(_n(this,Nj,tr(this,Ji).state),_n(this,vC,this.options),tr(this,Nj).data!==void 0&&_n(this,bC,tr(this,Ji)),Ite(s,t))return;_n(this,Hu,s);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,o=typeof a=="function"?a():a;if(o==="all"||!o&&!tr(this,wC).size)return!0;const l=new Set(o??tr(this,wC));return this.options.throwOnError&&l.add("error"),Object.keys(tr(this,Hu)).some(i=>{const u=i;return tr(this,Hu)[u]!==t[u]&&l.has(u)})};yi(this,To,APe).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&yi(this,To,Phe).call(this)}},jh=new WeakMap,Ji=new WeakMap,qI=new WeakMap,Hu=new WeakMap,Nj=new WeakMap,vC=new WeakMap,v1=new WeakMap,_1=new WeakMap,VI=new WeakMap,_C=new WeakMap,bC=new WeakMap,Sj=new WeakMap,Cj=new WeakMap,b1=new WeakMap,wC=new WeakMap,To=new WeakSet,DT=function(t){yi(this,To,Dhe).call(this);let s=tr(this,Ji).fetch(this.options,t);return t!=null&&t.throwOnError||(s=s.catch(Gu)),s},Ahe=function(){yi(this,To,Lhe).call(this);const t=tv(this.options.staleTime,tr(this,Ji));if(lk||tr(this,Hu).isStale||!Nhe(t))return;const n=yPe(tr(this,Hu).dataUpdatedAt,t)+1;_n(this,Sj,setTimeout(()=>{tr(this,Hu).isStale||this.updateResult()},n))},Ehe=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(tr(this,Ji)):this.options.refetchInterval)??!1},Ihe=function(t){yi(this,To,Ohe).call(this),_n(this,b1,t),!(lk||ep(this.options.enabled,tr(this,Ji))===!1||!Nhe(tr(this,b1))||tr(this,b1)===0)&&_n(this,Cj,setInterval(()=>{(this.options.refetchIntervalInBackground||bxe.isFocused())&&yi(this,To,DT).call(this)},tr(this,b1)))},Phe=function(){yi(this,To,Ahe).call(this),yi(this,To,Ihe).call(this,yi(this,To,Ehe).call(this))},Lhe=function(){tr(this,Sj)&&(clearTimeout(tr(this,Sj)),_n(this,Sj,void 0))},Ohe=function(){tr(this,Cj)&&(clearInterval(tr(this,Cj)),_n(this,Cj,void 0))},Dhe=function(){const t=tr(this,jh).getQueryCache().build(tr(this,jh),this.options);if(t===tr(this,Ji))return;const s=tr(this,Ji);_n(this,Ji,t),_n(this,qI,t.state),this.hasListeners()&&(s==null||s.removeObserver(this),t.addObserver(this))},APe=function(t){id.batch(()=>{t.listeners&&this.listeners.forEach(s=>{s(tr(this,Hu))}),tr(this,jh).getQueryCache().notify({query:tr(this,Ji),type:"observerResultsUpdated"})})},UTe);function Ttt(e,t){return ep(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Hje(e,t){return Ttt(e,t)||e.state.data!==void 0&&Rhe(e,t,t.refetchOnMount)}function Rhe(e,t,s){if(ep(t.enabled,e)!==!1&&tv(t.staleTime,e)!=="static"){const n=typeof s=="function"?s(e):s;return n==="always"||n!==!1&&wxe(e,t)}return!1}function Wje(e,t,s,n){return(e!==t||ep(n.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&wxe(e,s)}function wxe(e,t){return ep(t.enabled,e)!==!1&&e.isStaleByTime(tv(t.staleTime,e))}function Att(e,t){return!Ite(e.getCurrentResult(),t)}var Ett=class extends TPe{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:Lte()})}getOptimisticResult(e){return e.behavior=Lte(),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:s}=e,n=super.createResult(e,t),{isFetching:a,isRefetching:o,isError:l,isRefetchError:i}=n,u=(k=(N=s.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{...n,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Stt(t,s.data),hasPreviousPage:Ctt(t,s.data),isFetchNextPageError:m,isFetchingNextPage:x,isFetchPreviousPageError:y,isFetchingPreviousPage:v,isRefetchError:i&&!m&&!y,isRefetching:o&&!x&&!v}}},w1,j1,kh,Xx,ky,zee,Fhe,qTe,Itt=(qTe=class extends M3{constructor(s,n){super();_a(this,ky);_a(this,w1);_a(this,j1);_a(this,kh);_a(this,Xx);_n(this,w1,s),this.setOptions(n),this.bindMethods(),yi(this,ky,zee).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(s){var a;const n=this.options;this.options=tr(this,w1).defaultMutationOptions(s),Ite(this.options,n)||tr(this,w1).getMutationCache().notify({type:"observerOptionsUpdated",mutation:tr(this,kh),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&ck(n.mutationKey)!==ck(this.options.mutationKey)?this.reset():((a=tr(this,kh))==null?void 0:a.state.status)==="pending"&&tr(this,kh).setOptions(this.options)}onUnsubscribe(){var s;this.hasListeners()||(s=tr(this,kh))==null||s.removeObserver(this)}onMutationUpdate(s){yi(this,ky,zee).call(this),yi(this,ky,Fhe).call(this,s)}getCurrentResult(){return tr(this,j1)}reset(){var s;(s=tr(this,kh))==null||s.removeObserver(this),_n(this,kh,void 0),yi(this,ky,zee).call(this),yi(this,ky,Fhe).call(this)}mutate(s,n){var a;return _n(this,Xx,n),(a=tr(this,kh))==null||a.removeObserver(this),_n(this,kh,tr(this,w1).getMutationCache().build(tr(this,w1),this.options)),tr(this,kh).addObserver(this),tr(this,kh).execute(s)}},w1=new WeakMap,j1=new WeakMap,kh=new WeakMap,Xx=new WeakMap,ky=new WeakSet,zee=function(){var n;const s=((n=tr(this,kh))==null?void 0:n.state)??CPe();_n(this,j1,{...s,isPending:s.status==="pending",isSuccess:s.status==="success",isError:s.status==="error",isIdle:s.status==="idle",mutate:this.mutate,reset:this.reset})},Fhe=function(s){id.batch(()=>{var n,a,o,l,i,u,m,x;if(tr(this,Xx)&&this.hasListeners()){const y=tr(this,j1).variables,v=tr(this,j1).context;(s==null?void 0:s.type)==="success"?((a=(n=tr(this,Xx)).onSuccess)==null||a.call(n,s.data,y,v),(l=(o=tr(this,Xx)).onSettled)==null||l.call(o,s.data,null,y,v)):(s==null?void 0:s.type)==="error"&&((u=(i=tr(this,Xx)).onError)==null||u.call(i,s.error,y,v),(x=(m=tr(this,Xx)).onSettled)==null||x.call(m,void 0,s.error,y,v))}this.listeners.forEach(y=>{y(tr(this,j1))})})},qTe),EPe=A.createContext(void 0),Br=e=>{const t=A.useContext(EPe);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Ptt=({client:e,children:t})=>(A.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),r.jsx(EPe.Provider,{value:e,children:t})),IPe=A.createContext(!1),Ltt=()=>A.useContext(IPe);IPe.Provider;function Ott(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Dtt=A.createContext(Ott()),Rtt=()=>A.useContext(Dtt),Ftt=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},ztt=e=>{A.useEffect(()=>{e.clearReset()},[e])},Btt=({result:e,errorResetBoundary:t,throwOnError:s,query:n,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(a&&e.data===void 0||bPe(s,[e.error,n])),$tt=e=>{if(e.suspense){const t=n=>n==="static"?n:Math.max(n??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...n)=>t(s(...n)):t(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Utt=(e,t)=>e.isLoading&&e.isFetching&&!t,qtt=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Gje=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function PPe(e,t,s){var y,v,b,N,k;const n=Ltt(),a=Rtt(),o=Br(),l=o.defaultQueryOptions(e);(v=(y=o.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||v.call(y,l),l._optimisticResults=n?"isRestoring":"optimistic",$tt(l),Ftt(l,a),ztt(a);const i=!o.getQueryCache().get(l.queryHash),[u]=A.useState(()=>new t(o,l)),m=u.getOptimisticResult(l),x=!n&&e.subscribed!==!1;if(A.useSyncExternalStore(A.useCallback(M=>{const E=x?u.subscribe(id.batchCalls(M)):Gu;return u.updateResult(),E},[u,x]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),A.useEffect(()=>{u.setOptions(l)},[l,u]),qtt(l,m))throw Gje(l,u,a);if(Btt({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&&!lk&&Utt(m,n)){const M=i?Gje(l,u,a):(k=o.getQueryCache().get(l.queryHash))==null?void 0:k.promise;M==null||M.catch(Gu).finally(()=>{u.updateResult()})}return l.notifyOnChangeProps?m:u.trackResult(m)}function Kt(e,t){return PPe(e,TPe)}function ar(e,t){const s=Br(),[n]=A.useState(()=>new Itt(s,e));A.useEffect(()=>{n.setOptions(e)},[n,e]);const a=A.useSyncExternalStore(A.useCallback(l=>n.subscribe(id.batchCalls(l)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),o=A.useCallback((l,i)=>{n.mutate(l,i).catch(Gu)},[n]);if(a.error&&bPe(n.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:o,mutateAsync:a.mutate}}function Vtt(e,t){return PPe(e,Ett)}/** * @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 EE(){return EE=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function LPe(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Wtt(){return Math.random().toString(36).substr(2,8)}function Zje(e,t){return{usr:e.state,key:e.key,idx:t}}function zhe(e,t,s,n){return s===void 0&&(s=null),EE({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?T3(t):t,{state:s,key:t&&t.key||n||Wtt()})}function Ote(e){let{pathname:t="/",search:s="",hash:n=""}=e;return s&&s!=="?"&&(t+=s.charAt(0)==="?"?s:"?"+s),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function T3(e){let t={};if(e){let s=e.indexOf("#");s>=0&&(t.hash=e.substr(s),e=e.substr(0,s));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function Gtt(e,t,s,n){n===void 0&&(n={});let{window:a=document.defaultView,v5Compat:o=!1}=n,l=a.history,i=C1.Pop,u=null,m=x();m==null&&(m=0,l.replaceState(EE({},l.state,{idx:m}),""));function x(){return(l.state||{idx:null}).idx}function y(){i=C1.Pop;let M=x(),E=M==null?null:M-m;m=M,u&&u({action:i,location:k.location,delta:E})}function v(M,E){i=C1.Push;let T=zhe(k.location,M,E);m=x()+1;let P=Zje(T,m),R=k.createHref(T);try{l.pushState(P,"",R)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;a.location.assign(R)}o&&u&&u({action:i,location:k.location,delta:1})}function b(M,E){i=C1.Replace;let T=zhe(k.location,M,E);m=x();let P=Zje(T,m),R=k.createHref(T);l.replaceState(P,"",R),o&&u&&u({action:i,location:k.location,delta:0})}function N(M){let E=a.location.origin!=="null"?a.location.origin:a.location.href,T=typeof M=="string"?M:Ote(M);return T=T.replace(/ $/,"%20"),Mc(E,"No window.location.(origin|href) available to create URL for href: "+T),new URL(T,E)}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(Kje,y),u=M,()=>{a.removeEventListener(Kje,y),u=null}},createHref(M){return t(a,M)},createURL:N,encodeLocation(M){let E=N(M);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:v,replace:b,go(M){return l.go(M)}};return k}var Yje;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Yje||(Yje={}));function Ktt(e,t,s){return s===void 0&&(s="/"),Ztt(e,t,s)}function Ztt(e,t,s,n){let a=typeof t=="string"?T3(t):t,o=jxe(a.pathname||"/",s);if(o==null)return null;let l=OPe(e);Ytt(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("/")&&(Mc(u.relativePath.startsWith(n),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(n.length));let m=rv([n,u.relativePath]),x=s.concat(u);o.children&&o.children.length>0&&(Mc(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+m+'".')),OPe(o.children,t,x,m)),!(o.path==null&&!o.index)&&t.push({path:m,score:srt(m,o.index),routesMeta:x})};return e.forEach((o,l)=>{var i;if(o.path===""||!((i=o.path)!=null&&i.includes("?")))a(o,l);else for(let u of DPe(o.path))a(o,l,u)}),t}function DPe(e){let t=e.split("/");if(t.length===0)return[];let[s,...n]=t,a=s.endsWith("?"),o=s.replace(/\?$/,"");if(n.length===0)return a?[o,""]:[o];let l=DPe(n.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 Ytt(e){e.sort((t,s)=>t.score!==s.score?s.score-t.score:nrt(t.routesMeta.map(n=>n.childrenIndex),s.routesMeta.map(n=>n.childrenIndex)))}const Xtt=/^:[\w-]+$/,Qtt=3,Jtt=2,ert=1,trt=10,rrt=-2,Xje=e=>e==="*";function srt(e,t){let s=e.split("/"),n=s.length;return s.some(Xje)&&(n+=rrt),t&&(n+=Jtt),s.filter(a=>!Xje(a)).reduce((a,o)=>a+(Xtt.test(o)?Qtt:o===""?ert:trt),n)}function nrt(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}function art(e,t,s){let{routesMeta:n}=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 ort(e,t,s){t===void 0&&(t=!1),s===void 0&&(s=!0),LPe(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,i,u)=>(n.push({paramName:i,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}function lrt(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return LPe(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function jxe(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let s=t.endsWith("/")?t.length-1:t.length,n=e.charAt(s);return n&&n!=="/"?null:e.slice(s)||"/"}function crt(e,t){t===void 0&&(t="/");let{pathname:s,search:n="",hash:a=""}=typeof e=="string"?T3(e):e;return{pathname:s?s.startsWith("/")?s:drt(s,t):t,search:mrt(n),hash:prt(a)}}function drt(e,t){let s=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?s.length>1&&s.pop():a!=="."&&s.push(a)}),s.length>1?s.join("/"):"/"}function bce(e,t,s,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+s+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function urt(e){return e.filter((t,s)=>s===0||t.route.path&&t.route.path.length>0)}function kxe(e,t){let s=urt(e);return t?s.map((n,a)=>a===s.length-1?n.pathname:n.pathnameBase):s.map(n=>n.pathnameBase)}function Nxe(e,t,s,n){n===void 0&&(n=!1);let a;typeof e=="string"?a=T3(e):(a=EE({},e),Mc(!a.pathname||!a.pathname.includes("?"),bce("?","pathname","search",a)),Mc(!a.pathname||!a.pathname.includes("#"),bce("#","pathname","hash",a)),Mc(!a.search||!a.search.includes("#"),bce("#","search","hash",a)));let o=e===""||a.pathname==="",l=o?"/":a.pathname,i;if(l==null)i=s;else{let y=t.length-1;if(!n&&l.startsWith("..")){let v=l.split("/");for(;v[0]==="..";)v.shift(),y-=1;a.pathname=v.join("/")}i=y>=0?t[y]:"/"}let u=crt(a,i),m=l&&l!=="/"&&l.endsWith("/"),x=(o||l===".")&&s.endsWith("/");return!u.pathname.endsWith("/")&&(m||x)&&(u.pathname+="/"),u}const rv=e=>e.join("/").replace(/\/\/+/g,"/"),hrt=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),mrt=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,prt=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function frt(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const RPe=["post","put","patch","delete"];new Set(RPe);const grt=["get",...RPe];new Set(grt);/** * 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 IE(){return IE=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"){n.go(m);return}let y=Nxe(m,JSON.parse(l),o,x.relative==="path");e==null&&t!=="/"&&(y.pathname=y.pathname==="/"?t:rv([t,y.pathname])),(x.replace?n.replace:n.push)(y,x.state,x)},[t,n,l,o,e])}const _rt=A.createContext(null);function brt(e){let t=A.useContext(ox).outlet;return t&&A.createElement(_rt.Provider,{value:e},t)}function hc(){let{matches:e}=A.useContext(ox),t=e[e.length-1];return t?t.params:{}}function BPe(e,t){let{relative:s}=t===void 0?{}:t,{future:n}=A.useContext(Nv),{matches:a}=A.useContext(ox),{pathname:o}=Em(),l=JSON.stringify(kxe(a,n.v7_relativeSplatPath));return A.useMemo(()=>Nxe(e,JSON.parse(l),o,s==="path"),[e,l,o,s])}function wrt(e,t){return jrt(e,t)}function jrt(e,t,s,n){A3()||Mc(!1);let{navigator:a}=A.useContext(Nv),{matches:o}=A.useContext(ox),l=o[o.length-1],i=l?l.params:{};l&&l.pathname;let u=l?l.pathnameBase:"/";l&&l.route;let m=Em(),x;if(t){var y;let M=typeof t=="string"?T3(t):t;u==="/"||(y=M.pathname)!=null&&y.startsWith(u)||Mc(!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=Ktt(e,{pathname:b}),k=Mrt(N&&N.map(M=>Object.assign({},M,{params:Object.assign({},i,M.params),pathname:rv([u,a.encodeLocation?a.encodeLocation(M.pathname).pathname:M.pathname]),pathnameBase:M.pathnameBase==="/"?u:rv([u,a.encodeLocation?a.encodeLocation(M.pathnameBase).pathname:M.pathnameBase])})),o,s,n);return t&&k?A.createElement(Sne.Provider,{value:{location:IE({pathname:"/",search:"",hash:"",state:null,key:"default"},x),navigationType:C1.Pop}},k):k}function krt(){let e=Irt(),t=frt(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),s=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),s?A.createElement("pre",{style:a},s):null,null)}const Nrt=A.createElement(krt,null);class Srt 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,s){return s.location!==t.location||s.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:s.error,location:s.location,revalidation:t.revalidation||s.revalidation}}componentDidCatch(t,s){console.error("React Router caught the following error during render",t,s)}render(){return this.state.error!==void 0?A.createElement(ox.Provider,{value:this.props.routeContext},A.createElement(FPe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Crt(e){let{routeContext:t,match:s,children:n}=e,a=A.useContext(Sxe);return a&&a.static&&a.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=s.route.id),A.createElement(ox.Provider,{value:t},n)}function Mrt(e,t,s,n){var a;if(t===void 0&&(t=[]),s===void 0&&(s=null),n===void 0&&(n=null),e==null){var o;if(!s)return null;if(s.errors)e=s.matches;else if((o=n)!=null&&o.v7_partialHydration&&t.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let l=e,i=(a=s)==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||Mc(!1),l=l.slice(0,Math.min(l.length,x+1))}let u=!1,m=-1;if(s&&n&&n.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;s&&(b=i&&y.route.id?i[y.route.id]:void 0,k=y.route.errorElement||Nrt,u&&(m<0&&v===0?(Lrt("route-fallback"),N=!0,M=null):m===v&&(N=!0,M=y.route.hydrateFallbackElement||null)));let E=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(Crt,{match:y,routeContext:{outlet:x,matches:E,isDataRoute:s!=null},children:P})};return s&&(y.route.ErrorBoundary||y.route.errorElement||v===0)?A.createElement(Srt,{location:s.location,revalidation:s.revalidation,component:k,error:b,children:T(),routeContext:{outlet:null,matches:E,isDataRoute:!0}}):T()},null)}var $Pe=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}($Pe||{}),UPe=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(UPe||{});function Trt(e){let t=A.useContext(Sxe);return t||Mc(!1),t}function Art(e){let t=A.useContext(xrt);return t||Mc(!1),t}function Ert(e){let t=A.useContext(ox);return t||Mc(!1),t}function qPe(e){let t=Ert(),s=t.matches[t.matches.length-1];return s.route.id||Mc(!1),s.route.id}function Irt(){var e;let t=A.useContext(FPe),s=Art(),n=qPe();return t!==void 0?t:(e=s.errors)==null?void 0:e[n]}function Prt(){let{router:e}=Trt($Pe.UseNavigateStable),t=qPe(UPe.UseNavigateStable),s=A.useRef(!1);return zPe(()=>{s.current=!0}),A.useCallback(function(a,o){o===void 0&&(o={}),s.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,IE({fromRouteId:t},o)))},[e,t])}const Qje={};function Lrt(e,t,s){Qje[e]||(Qje[e]=!0)}function Ort(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function wce(e){let{to:t,replace:s,state:n,relative:a}=e;A3()||Mc(!1);let{future:o,static:l}=A.useContext(Nv),{matches:i}=A.useContext(ox),{pathname:u}=Em(),m=Hs(),x=Nxe(t,kxe(i,o.v7_relativeSplatPath),u,a==="path"),y=JSON.stringify(x);return A.useEffect(()=>m(JSON.parse(y),{replace:s,state:n,relative:a}),[m,y,a,s,n]),null}function Drt(e){return brt(e.context)}function ss(e){Mc(!1)}function Rrt(e){let{basename:t="/",children:s=null,location:n,navigationType:a=C1.Pop,navigator:o,static:l=!1,future:i}=e;A3()&&Mc(!1);let u=t.replace(/^\/*/,"/"),m=A.useMemo(()=>({basename:u,navigator:o,static:l,future:IE({v7_relativeSplatPath:!1},i)}),[u,i,o,l]);typeof n=="string"&&(n=T3(n));let{pathname:x="/",search:y="",hash:v="",state:b=null,key:N="default"}=n,k=A.useMemo(()=>{let M=jxe(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(Nv.Provider,{value:m},A.createElement(Sne.Provider,{children:s,value:k}))}function Frt(e){let{children:t,location:s}=e;return wrt(Bhe(t),s)}new Promise(()=>{});function Bhe(e,t){t===void 0&&(t=[]);let s=[];return A.Children.forEach(e,(n,a)=>{if(!A.isValidElement(n))return;let o=[...t,a];if(n.type===A.Fragment){s.push.apply(s,Bhe(n.props.children,o));return}n.type!==ss&&Mc(!1),!n.props.index||!n.props.children||Mc(!1);let l={id:n.props.id||o.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(l.children=Bhe(n.props.children,o)),s.push(l)}),s}/** * React Router DOM v6.30.1 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function $he(){return $he=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(s[a]=e[a]);return s}function Brt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function $rt(e,t){return e.button===0&&(!t||t==="_self")&&!Brt(e)}function Uhe(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,s)=>{let n=e[s];return t.concat(Array.isArray(n)?n.map(a=>[s,a]):[[s,n]])},[]))}function Urt(e,t){let s=Uhe(e);return t&&t.forEach((n,a)=>{s.has(a)||t.getAll(a).forEach(o=>{s.append(a,o)})}),s}const qrt=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Vrt="6";try{window.__reactRouterVersion=Vrt}catch{}const Hrt="startTransition",Jje=uge[Hrt];function Wrt(e){let{basename:t,children:s,future:n,window:a}=e,o=A.useRef();o.current==null&&(o.current=Htt({window:a,v5Compat:!0}));let l=o.current,[i,u]=A.useState({action:l.action,location:l.location}),{v7_startTransition:m}=n||{},x=A.useCallback(y=>{m&&Jje?Jje(()=>u(y)):u(y)},[u,m]);return A.useLayoutEffect(()=>l.listen(x),[l,x]),A.useEffect(()=>Ort(n),[n]),A.createElement(Rrt,{basename:t,children:s,location:i.location,navigationType:i.action,navigator:l,future:n})}const Grt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Krt=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ho=A.forwardRef(function(t,s){let{onClick:n,relative:a,reloadDocument:o,replace:l,state:i,target:u,to:m,preventScrollReset:x,viewTransition:y}=t,v=zrt(t,qrt),{basename:b}=A.useContext(Nv),N,k=!1;if(typeof m=="string"&&Krt.test(m)&&(N=m,Grt))try{let P=new URL(window.location.href),R=m.startsWith("//")?new URL(P.protocol+m):new URL(m),D=jxe(R.pathname,b);R.origin===P.origin&&D!=null?m=D+R.search+R.hash:k=!0}catch{}let M=yrt(m,{relative:a}),E=Zrt(m,{replace:l,state:i,target:u,preventScrollReset:x,relative:a,viewTransition:y});function T(P){n&&n(P),P.defaultPrevented||E(P)}return A.createElement("a",$he({},v,{href:N||M,onClick:k||o?n:T,ref:s,target:u}))});var eke;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(eke||(eke={}));var tke;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(tke||(tke={}));function Zrt(e,t){let{target:s,replace:n,state:a,preventScrollReset:o,relative:l,viewTransition:i}=t===void 0?{}:t,u=Hs(),m=Em(),x=BPe(e,{relative:l});return A.useCallback(y=>{if($rt(y,s)){y.preventDefault();let v=n!==void 0?n:Ote(m)===Ote(x);u(e,{replace:v,state:a,preventScrollReset:o,relative:l,viewTransition:i})}},[m,u,x,n,a,s,e,o,l,i])}function Ic(e){let t=A.useRef(Uhe(e)),s=A.useRef(!1),n=Em(),a=A.useMemo(()=>Urt(n.search,s.current?null:t.current),[n.search]),o=Hs(),l=A.useCallback((i,u)=>{const m=Uhe(typeof i=="function"?i(a):i);s.current=!0,o("?"+m,u)},[o,a]);return[a,l]}var Yrt=typeof Element<"u",Xrt=typeof Map=="function",Qrt=typeof Set=="function",Jrt=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Bee(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var s,n,a;if(Array.isArray(e)){if(s=e.length,s!=t.length)return!1;for(n=s;n--!==0;)if(!Bee(e[n],t[n]))return!1;return!0}var o;if(Xrt&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(n=o.next()).done;)if(!t.has(n.value[0]))return!1;for(o=e.entries();!(n=o.next()).done;)if(!Bee(n.value[1],t.get(n.value[0])))return!1;return!0}if(Qrt&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(n=o.next()).done;)if(!t.has(n.value[0]))return!1;return!0}if(Jrt&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(s=e.length,s!=t.length)return!1;for(n=s;n--!==0;)if(e[n]!==t[n])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),s=a.length,s!==Object.keys(t).length)return!1;for(n=s;n--!==0;)if(!Object.prototype.hasOwnProperty.call(t,a[n]))return!1;if(Yrt&&e instanceof Element)return!1;for(n=s;n--!==0;)if(!((a[n]==="_owner"||a[n]==="__v"||a[n]==="__o")&&e.$$typeof)&&!Bee(e[a[n]],t[a[n]]))return!1;return!0}return e!==e&&t!==t}var est=function(t,s){try{return Bee(t,s)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}};const tst=no(est);var rst=function(e,t,s,n,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=[s,n,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}},sst=rst;const rke=no(sst);var nst=function(t,s,n,a){var o=n?n.call(a,t,s):void 0;if(o!==void 0)return!!o;if(t===s)return!0;if(typeof t!="object"||!t||typeof s!="object"||!s)return!1;var l=Object.keys(t),i=Object.keys(s);if(l.length!==i.length)return!1;for(var u=Object.prototype.hasOwnProperty.bind(s),m=0;m(e.BASE="base",e.BODY="body",e.HEAD="head",e.HTML="html",e.LINK="link",e.META="meta",e.NOSCRIPT="noscript",e.SCRIPT="script",e.STYLE="style",e.TITLE="title",e.FRAGMENT="Symbol(react.fragment)",e))(VPe||{}),jce={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"]}},ske=Object.values(VPe),Cxe={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},ist=Object.entries(Cxe).reduce((e,[t,s])=>(e[s]=t,e),{}),jf="data-rh",GS={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},KS=(e,t)=>{for(let s=e.length-1;s>=0;s-=1){const n=e[s];if(Object.prototype.hasOwnProperty.call(n,t))return n[t]}return null},ost=e=>{let t=KS(e,"title");const s=KS(e,GS.TITLE_TEMPLATE);if(Array.isArray(t)&&(t=t.join("")),s&&t)return s.replace(/%s/g,()=>t);const n=KS(e,GS.DEFAULT_TITLE);return t||n||void 0},lst=e=>KS(e,GS.ON_CHANGE_CLIENT_STATE)||(()=>{}),kce=(e,t)=>t.filter(s=>typeof s[e]<"u").map(s=>s[e]).reduce((s,n)=>({...s,...n}),{}),cst=(e,t)=>t.filter(s=>typeof s.base<"u").map(s=>s.base).reverse().reduce((s,n)=>{if(!s.length){const a=Object.keys(n);for(let o=0;oconsole&&typeof console.warn=="function"&&console.warn(e),oT=(e,t,s)=>{const n={};return s.filter(a=>Array.isArray(a[e])?!0:(typeof a[e]<"u"&&dst(`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 s=0;s({baseTag:cst(["href"],e),bodyAttributes:kce("bodyAttributes",e),defer:KS(e,GS.DEFER),encode:KS(e,GS.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:kce("htmlAttributes",e),linkTags:oT("link",["rel","href"],e),metaTags:oT("meta",["name","charset","http-equiv","property","itemprop"],e),noscriptTags:oT("noscript",["innerHTML"],e),onChangeClientState:lst(e),scriptTags:oT("script",["src","innerHTML"],e),styleTags:oT("style",["cssText"],e),title:ost(e),titleAttributes:kce("titleAttributes",e),prioritizeSeoTags:ust(e,GS.PRIORITIZE_SEO_TAGS)}),HPe=e=>Array.isArray(e)?e.join(""):e,mst=(e,t)=>{const s=Object.keys(e);for(let n=0;nArray.isArray(e)?e.reduce((s,n)=>(mst(n,t)?s.priority.push(n):s.default.push(n),s),{priority:[],default:[]}):{default:e,priority:[]},nke=(e,t)=>({...e,[t]:void 0}),pst=["noscript","script","style"],qhe=(e,t=!0)=>t===!1?String(e):String(e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),WPe=e=>Object.keys(e).reduce((t,s)=>{const n=typeof e[s]<"u"?`${s}="${e[s]}"`:`${s}`;return t?`${t} ${n}`:n},""),fst=(e,t,s,n)=>{const a=WPe(s),o=HPe(t);return a?`<${e} ${jf}="true" ${a}>${qhe(o,n)}`:`<${e} ${jf}="true">${qhe(o,n)}`},gst=(e,t,s=!0)=>t.reduce((n,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}="${qhe(o[x],s)}"`;return m?`${m} ${y}`:y},""),i=o.innerHTML||o.cssText||"",u=pst.indexOf(e)===-1;return`${n}<${e} ${jf}="true" ${l}${u?"/>":`>${i}`}`},""),GPe=(e,t={})=>Object.keys(e).reduce((s,n)=>{const a=Cxe[n];return s[a||n]=e[n],s},t),xst=(e,t,s)=>{const n={key:t,[jf]:!0},a=GPe(s,n);return[ut.createElement("title",a,t)]},$ee=(e,t)=>t.map((s,n)=>{const a={key:n,[jf]:!0};return Object.keys(s).forEach(o=>{const i=Cxe[o]||o;if(i==="innerHTML"||i==="cssText"){const u=s.innerHTML||s.cssText;a.dangerouslySetInnerHTML={__html:u}}else a[i]=s[o]}),ut.createElement(e,a)}),Qm=(e,t,s=!0)=>{switch(e){case"title":return{toComponent:()=>xst(e,t.title,t.titleAttributes),toString:()=>fst(e,t.title,t.titleAttributes,s)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>GPe(t),toString:()=>WPe(t)};default:return{toComponent:()=>$ee(e,t),toString:()=>gst(e,t,s)}}},yst=({metaTags:e,linkTags:t,scriptTags:s,encode:n})=>{const a=Nce(e,jce.meta),o=Nce(t,jce.link),l=Nce(s,jce.script);return{priorityMethods:{toComponent:()=>[...$ee("meta",a.priority),...$ee("link",o.priority),...$ee("script",l.priority)],toString:()=>`${Qm("meta",a.priority,n)} ${Qm("link",o.priority,n)} ${Qm("script",l.priority,n)}`},metaTags:a.default,linkTags:o.default,scriptTags:l.default}},vst=e=>{const{baseTag:t,bodyAttributes:s,encode:n=!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}=yst(e)),{priority:b,base:Qm("base",t,n),bodyAttributes:Qm("bodyAttributes",s,n),htmlAttributes:Qm("htmlAttributes",a,n),link:Qm("link",x,n),meta:Qm("meta",y,n),noscript:Qm("noscript",o,n),script:Qm("script",v,n),style:Qm("style",l,n),title:Qm("title",{title:i,titleAttributes:u},n)}},Vhe=vst,QL=[],KPe=!!(typeof window<"u"&&window.document&&window.document.createElement),Hhe=class{constructor(e,t){rn(this,"instances",[]);rn(this,"canUseDOM",KPe);rn(this,"context");rn(this,"value",{setHelmet:e=>{this.context.helmet=e},helmetInstances:{get:()=>this.canUseDOM?QL:this.instances,add:e=>{(this.canUseDOM?QL:this.instances).push(e)},remove:e=>{const t=(this.canUseDOM?QL:this.instances).indexOf(e);(this.canUseDOM?QL:this.instances).splice(t,1)}}});this.context=e,this.canUseDOM=t||!1,t||(e.helmet=Vhe({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},_st={},ZPe=ut.createContext(_st),Mj,YPe=(Mj=class extends A.Component{constructor(s){super(s);rn(this,"helmetData");this.helmetData=new Hhe(this.props.context||{},Mj.canUseDOM)}render(){return ut.createElement(ZPe.Provider,{value:this.helmetData.value},this.props.children)}},rn(Mj,"canUseDOM",KPe),Mj),w4=(e,t)=>{const s=document.head||document.querySelector("head"),n=s.querySelectorAll(`${e}[${jf}]`),a=[].slice.call(n),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(jf,"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=>s.appendChild(i)),{oldTags:a,newTags:o}},Whe=(e,t)=>{const s=document.getElementsByTagName(e)[0];if(!s)return;const n=s.getAttribute(jf),a=n?n.split(","):[],o=[...a],l=Object.keys(t);for(const i of l){const u=t[i]||"";s.getAttribute(i)!==u&&s.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)s.removeAttribute(o[i]);a.length===o.length?s.removeAttribute(jf):s.getAttribute(jf)!==l.join(",")&&s.setAttribute(jf,l.join(","))},bst=(e,t)=>{typeof e<"u"&&document.title!==e&&(document.title=HPe(e)),Whe("title",t)},ake=(e,t)=>{const{baseTag:s,bodyAttributes:n,htmlAttributes:a,linkTags:o,metaTags:l,noscriptTags:i,onChangeClientState:u,scriptTags:m,styleTags:x,title:y,titleAttributes:v}=e;Whe("body",n),Whe("html",a),bst(y,v);const b={baseTag:w4("base",s),linkTags:w4("link",o),metaTags:w4("meta",l),noscriptTags:w4("noscript",i),scriptTags:w4("script",m),styleTags:w4("style",x)},N={},k={};Object.keys(b).forEach(M=>{const{newTags:E,oldTags:T}=b[M];E.length&&(N[M]=E),T.length&&(k[M]=b[M].oldTags)}),t&&t(),u(e,N,k)},lT=null,wst=e=>{lT&&cancelAnimationFrame(lT),e.defer?lT=requestAnimationFrame(()=>{ake(e,()=>{lT=null})}):(ake(e),lT=null)},jst=wst,ike=class extends A.Component{constructor(){super(...arguments);rn(this,"rendered",!1)}shouldComponentUpdate(t){return!ast(t,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:t}=this.props.context;t.remove(this),this.emitChange()}emitChange(){const{helmetInstances:t,setHelmet:s}=this.props.context;let n=null;const a=hst(t.get().map(o=>{const l={...o.props};return delete l.context,l}));YPe.canUseDOM?jst(a):Vhe&&(n=Vhe(a)),s(n)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:t}=this.props.context;t.add(this),this.emitChange()}render(){return this.init(),null}},bue,Bh=(bue=class extends A.Component{shouldComponentUpdate(e){return!tst(nke(this.props,"helmetData"),nke(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,s,n){return{...t,[e.type]:[...t[e.type]||[],{...s,...this.mapNestedChildrenToProps(e,n)}]}}mapObjectTypeChildren(e,t,s,n){switch(e.type){case"title":return{...t,[e.type]:n,titleAttributes:{...s}};case"body":return{...t,bodyAttributes:{...s}};case"html":return{...t,htmlAttributes:{...s}};default:return{...t,[e.type]:{...s}}}}mapArrayTypeChildrenToProps(e,t){let s={...t};return Object.keys(e).forEach(n=>{s={...s,[n]:e[n]}}),s}warnOnInvalidChildren(e,t){return rke(ske.some(s=>e.type===s),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 ${ske.join(", ")} are allowed. Helmet does not support rendering <${e.type}> elements. Refer to our API for more information.`),rke(!t||typeof t=="string"||Array.isArray(t)&&!t.some(s=>typeof s!="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 s={};return ut.Children.forEach(e,n=>{if(!n||!n.props)return;const{children:a,...o}=n.props,l=Object.keys(o).reduce((u,m)=>(u[ist[m]||m]=o[m],u),{});let{type:i}=n;switch(typeof i=="symbol"?i=i.toString():this.warnOnInvalidChildren(n,a),i){case"Symbol(react.fragment)":t=this.mapChildrenToProps(a,t);break;case"link":case"meta":case"noscript":case"script":case"style":s=this.flattenArrayTypeChildren(n,s,l,a);break;default:t=this.mapObjectTypeChildren(n,t,l,a);break}}),this.mapArrayTypeChildrenToProps(s,t)}render(){const{children:e,...t}=this.props;let s={...t},{helmetData:n}=t;if(e&&(s=this.mapChildrenToProps(e,s)),n&&!(n instanceof Hhe)){const a=n;n=new Hhe(a.context,!0),delete s.helmetData}return n?ut.createElement(ike,{...s,context:n.value}):ut.createElement(ZPe.Consumer,null,a=>ut.createElement(ike,{...s,context:a}))}},rn(bue,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),bue),Ghe=function(e,t){return Ghe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,n){s.__proto__=n}||function(s,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(s[a]=n[a])},Ghe(e,t)};function XPe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Ghe(e,t);function s(){this.constructor=e}e.prototype=t===null?Object.create(t):(s.prototype=t.prototype,new s)}var ip=function(){return ip=Object.assign||function(t){for(var s,n=1,a=arguments.length;n=0;i--)(l=e[i])&&(o=(a<3?l(o):a>3?l(t,s,o):l(t,s))||o);return a>3&&o&&Object.defineProperty(t,s,o),o}function JPe(e,t){return function(s,n){t(s,n,e)}}function e6e(e,t,s,n,a,o){function l(E){if(E!==void 0&&typeof E!="function")throw new TypeError("Function expected");return E}for(var i=n.kind,u=i==="getter"?"get":i==="setter"?"set":"value",m=!t&&e?n.static?e:e.prototype:null,x=t||(m?Object.getOwnPropertyDescriptor(m,n.name):{}),y,v=!1,b=s.length-1;b>=0;b--){var N={};for(var k in n)N[k]=k==="access"?{}:n[k];for(var k in n.access)N.access[k]=n.access[k];N.addInitializer=function(E){if(v)throw new TypeError("Cannot add initializers after decoration has completed");o.push(l(E||null))};var M=(0,s[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,n.name,x),v=!0}function t6e(e,t,s){for(var n=arguments.length>2,a=0;a0&&o[o.length-1])&&(m[0]===6||m[0]===2)){s=0;continue}if(m[0]===3&&(!o||m[1]>o[0]&&m[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Mxe(e,t){var s=typeof Symbol=="function"&&e[Symbol.iterator];if(!s)return e;var n=s.call(e),a,o=[],l;try{for(;(t===void 0||t-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(i){l={error:i}}finally{try{a&&!a.done&&(s=n.return)&&s.call(n)}finally{if(l)throw l.error}}return o}function o6e(){for(var e=[],t=0;t1||u(b,k)})},N&&(a[b]=N(a[b])))}function u(b,N){try{m(n[b](N))}catch(k){v(o[0][3],k)}}function m(b){b.value instanceof IC?Promise.resolve(b.value.v).then(x,y):v(o[0][2],b)}function x(b){u("next",b)}function y(b){u("throw",b)}function v(b,N){b(N),o.shift(),o.length&&u(o[0][0],o[0][1])}}function d6e(e){var t,s;return t={},n("next"),n("throw",function(a){throw a}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(a,o){t[a]=e[a]?function(l){return(s=!s)?{value:IC(e[a](l)),done:!1}:o?o(l):l}:o}}function u6e(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],s;return t?t.call(e):(e=typeof Dte=="function"?Dte(e):e[Symbol.iterator](),s={},n("next"),n("throw"),n("return"),s[Symbol.asyncIterator]=function(){return this},s);function n(o){s[o]=e[o]&&function(l){return new Promise(function(i,u){l=e[o](l),a(i,u,l.done,l.value)})}}function a(o,l,i,u){Promise.resolve(u).then(function(m){o({value:m,done:i})},l)}}function h6e(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var kst=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},Khe=function(e){return Khe=Object.getOwnPropertyNames||function(t){var s=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(s[s.length]=n);return s},Khe(e)};function m6e(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var s=Khe(e),n=0;n0){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(s.map(u=>{if(u=Tst(u),u in oke)return;oke[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":Mst,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)})},Ast=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...s)=>E3(async()=>{const{default:n}=await Promise.resolve().then(()=>Ek);return{default:n}},void 0).then(({default:n})=>n(...s)):t=fetch,(...s)=>t(...s)};class Axe extends Error{constructor(t,s="FunctionsError",n){super(t),this.name=s,this.context=n}}class lke extends Axe{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class cke extends Axe{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class dke extends Axe{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var Zhe;(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"})(Zhe||(Zhe={}));class Est{constructor(t,{headers:s={},customFetch:n,region:a=Zhe.Any}={}){this.url=t,this.headers=s,this.region=a,this.fetch=Ast(n)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return Hn(this,arguments,void 0,function*(s,n={}){var a;try{const{headers:o,method:l,body:i,signal:u}=n;let m={},{region:x}=n;x||(x=this.region);const y=new URL(`${this.url}/${s}`);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(E=>{throw E.name==="AbortError"?E:new lke(E)}),N=b.headers.get("x-relay-error");if(N&&N==="true")throw new cke(b);if(!b.ok)throw new dke(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 lke(o)}:{data:null,error:o,response:o instanceof dke||o instanceof cke?o.context:void 0}}})}}var Mh={};const I3=VTe(Cst);var JL={},eO={},tO={},rO={},sO={},Ist=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")},PC=Ist();const Pst=PC.fetch,b6e=PC.fetch.bind(PC),w6e=PC.Headers,Lst=PC.Request,Ost=PC.Response,Ek=Object.freeze(Object.defineProperty({__proto__:null,Headers:w6e,Request:Lst,Response:Ost,default:b6e,fetch:Pst},Symbol.toStringTag,{value:"Module"})),Dst=VTe(Ek);var nO={},uke;function j6e(){if(uke)return nO;uke=1,Object.defineProperty(nO,"__esModule",{value:!0});class e extends Error{constructor(s){super(s.message),this.name="PostgrestError",this.details=s.details,this.hint=s.hint,this.code=s.code}}return nO.default=e,nO}var hke;function k6e(){if(hke)return sO;hke=1,Object.defineProperty(sO,"__esModule",{value:!0});const e=I3,t=e.__importDefault(Dst),s=e.__importDefault(j6e());class n{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,E=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 R=(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("/");R&&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,E=406,T="Not Acceptable"):k.length===1?k=k[0]:k=null)}else{const R=await m.text();try{N=JSON.parse(R),Array.isArray(N)&&m.status===404&&(k=[],N=null,E=200,T="OK")}catch{m.status===404&&R===""?(E=204,T="No Content"):N={message:R}}if(N&&this.isMaybeSingle&&(!((b=N==null?void 0:N.details)===null||b===void 0)&&b.includes("0 rows"))&&(N=null,E=200,T="OK"),N&&this.shouldThrowOnError)throw new s.default(N)}return{error:N,data:k,count:M,status:E,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 sO.default=n,sO}var mke;function N6e(){if(mke)return rO;mke=1,Object.defineProperty(rO,"__esModule",{value:!0});const t=I3.__importDefault(k6e());class s 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 rO.default=s,rO}var pke;function Exe(){if(pke)return tO;pke=1,Object.defineProperty(tO,"__esModule",{value:!0});const t=I3.__importDefault(N6e()),s=new RegExp("[,()]");class n 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"&&s.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 tO.default=n,tO}var fke;function S6e(){if(fke)return eO;fke=1,Object.defineProperty(eO,"__esModule",{value:!0});const t=I3.__importDefault(Exe());class s{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 eO.default=s,eO}var gke;function Rst(){if(gke)return JL;gke=1,Object.defineProperty(JL,"__esModule",{value:!0});const e=I3,t=e.__importDefault(S6e()),s=e.__importDefault(Exe());class n{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 n(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 s.default({method:y,url:v,headers:N,schema:this.schemaName,body:b,fetch:(x=this.fetch)!==null&&x!==void 0?x:fetch})}}return JL.default=n,JL}Object.defineProperty(Mh,"__esModule",{value:!0});var C6e=Mh.PostgrestError=R6e=Mh.PostgrestBuilder=O6e=Mh.PostgrestTransformBuilder=P6e=Mh.PostgrestFilterBuilder=E6e=Mh.PostgrestQueryBuilder=T6e=Mh.PostgrestClient=void 0;const P3=I3,M6e=P3.__importDefault(Rst());var T6e=Mh.PostgrestClient=M6e.default;const A6e=P3.__importDefault(S6e());var E6e=Mh.PostgrestQueryBuilder=A6e.default;const I6e=P3.__importDefault(Exe());var P6e=Mh.PostgrestFilterBuilder=I6e.default;const L6e=P3.__importDefault(N6e());var O6e=Mh.PostgrestTransformBuilder=L6e.default;const D6e=P3.__importDefault(k6e());var R6e=Mh.PostgrestBuilder=D6e.default;const F6e=P3.__importDefault(j6e());C6e=Mh.PostgrestError=F6e.default;var z6e=Mh.default={PostgrestClient:M6e.default,PostgrestQueryBuilder:A6e.default,PostgrestFilterBuilder:I6e.default,PostgrestTransformBuilder:L6e.default,PostgrestBuilder:D6e.default,PostgrestError:F6e.default};const Fst=Object.freeze(Object.defineProperty({__proto__:null,get PostgrestBuilder(){return R6e},get PostgrestClient(){return T6e},get PostgrestError(){return C6e},get PostgrestFilterBuilder(){return P6e},get PostgrestQueryBuilder(){return E6e},get PostgrestTransformBuilder(){return O6e},default:z6e},Symbol.toStringTag,{value:"Module"})),{PostgrestClient:zst,PostgrestQueryBuilder:Ctr,PostgrestFilterBuilder:Mtr,PostgrestTransformBuilder:Ttr,PostgrestBuilder:Atr,PostgrestError:Etr}=z6e||Fst;class Bst{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 s=process.versions;if(s&&s.node){const n=s.node,a=parseInt(n.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 s=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(s+=` Suggested solution: ${t.workaround}`),new Error(s)}static createWebSocket(t,s){const n=this.getWebSocketConstructor();return new n(t,s)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const $st="2.78.0",Ust=`realtime-js/${$st}`,qst="1.0.0",Yhe=1e4,Vst=1e3,Hst=100;var RA;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(RA||(RA={}));var rd;(function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"})(rd||(rd={}));var mf;(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"})(mf||(mf={}));var Xhe;(function(e){e.websocket="websocket"})(Xhe||(Xhe={}));var ej;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"})(ej||(ej={}));class Wst{constructor(){this.HEADER_LENGTH=1}decode(t,s){return t.constructor===ArrayBuffer?s(this._binaryDecode(t)):s(typeof t=="string"?JSON.parse(t):{})}_binaryDecode(t){const s=new DataView(t),n=new TextDecoder;return this._decodeBroadcast(t,s,n)}_decodeBroadcast(t,s,n){const a=s.getUint8(1),o=s.getUint8(2);let l=this.HEADER_LENGTH+2;const i=n.decode(t.slice(l,l+a));l=l+a;const u=n.decode(t.slice(l,l+o));l=l+o;const m=JSON.parse(n.decode(t.slice(l,t.byteLength)));return{ref:null,topic:i,event:u,payload:m}}}class B6e{constructor(t,s){this.callback=t,this.timerCalc=s,this.timer=void 0,this.tries=0,this.callback=t,this.timerCalc=s}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var 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 xke=(e,t,s={})=>{var n;const a=(n=s.skipTypes)!==null&&n!==void 0?n:[];return t?Object.keys(t).reduce((o,l)=>(o[l]=Gst(l,e,t,a),o),{}):{}},Gst=(e,t,s,n)=>{const a=t.find(i=>i.name===e),o=a==null?void 0:a.type,l=s[e];return o&&!n.includes(o)?$6e(o,l):Qhe(l)},$6e=(e,t)=>{if(e.charAt(0)==="_"){const s=e.slice(1,e.length);return Xst(t,s)}switch(e){case nl.bool:return Kst(t);case nl.float4:case nl.float8:case nl.int2:case nl.int4:case nl.int8:case nl.numeric:case nl.oid:return Zst(t);case nl.json:case nl.jsonb:return Yst(t);case nl.timestamp:return Qst(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 Qhe(t);default:return Qhe(t)}},Qhe=e=>e,Kst=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},Zst=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Yst=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch(t){return console.log(`JSON parse error: ${t}`),e}return e},Xst=(e,t)=>{if(typeof e!="string")return e;const s=e.length-1,n=e[s];if(e[0]==="{"&&n==="}"){let o;const l=e.slice(1,s);try{o=JSON.parse("["+l+"]")}catch{o=l?l.split(","):[]}return o.map(i=>$6e(t,i))}return e},Qst=e=>typeof e=="string"?e.replace(" ","T"):e,U6e=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};class Sce{constructor(t,s,n={},a=Yhe){this.channel=t,this.event=s,this.payload=n,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,s){var n;return this._hasReceived(t)&&s((n=this.receivedResp)===null||n===void 0?void 0:n.response),this.recHooks.push({status:t,callback:s}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const t=s=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=s,this._matchReceive(s)};this.channel._on(this.refEvent,{},t),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(t,s){this.refEvent&&this.channel._trigger(this.refEvent,{status:t,response:s})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:t,response:s}){this.recHooks.filter(n=>n.status===t).forEach(n=>n.callback(s))}_hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}}var yke;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(yke||(yke={}));class FA{constructor(t,s){this.channel=t,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const n=(s==null?void 0:s.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(n.state,{},a=>{const{onJoin:o,onLeave:l,onSync:i}=this.caller;this.joinRef=this.channel._joinRef(),this.state=FA.syncState(this.state,a,o,l),this.pendingDiffs.forEach(u=>{this.state=FA.syncDiff(this.state,u,o,l)}),this.pendingDiffs=[],i()}),this.channel._on(n.diff,{},a=>{const{onJoin:o,onLeave:l,onSync:i}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(a):(this.state=FA.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,s,n,a){const o=this.cloneDeep(t),l=this.transformState(s),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},n,a)}static syncDiff(t,s,n,a){const{joins:o,leaves:l}={joins:this.transformState(s.joins),leaves:this.transformState(s.leaves)};return n||(n=()=>{}),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)}n(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,s){return Object.getOwnPropertyNames(t).map(n=>s(n,t[n]))}static transformState(t){return t=this.cloneDeep(t),Object.getOwnPropertyNames(t).reduce((s,n)=>{const a=t[n];return"metas"in a?s[n]=a.metas.map(o=>(o.presence_ref=o.phx_ref,delete o.phx_ref,delete o.phx_ref_prev,o)):s[n]=a,s},{})}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 vke;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(vke||(vke={}));var zA;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(zA||(zA={}));var Hx;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Hx||(Hx={}));class Ixe{constructor(t,s={config:{}},n){var a,o;if(this.topic=t,this.params=s,this.socket=n,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},s.config),this.timeout=this.socket.timeout,this.joinPush=new Sce(this,mf.join,this.params,this.timeout),this.rejoinTimer=new B6e(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=rd.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(l=>l.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=rd.closed,this.socket._remove(this)}),this._onError(l=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,l),this.state=rd.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=rd.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",l=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,l),this.state=rd.errored,this.rejoinTimer.scheduleTimeout())}),this._on(mf.reply,{},(l,i)=>{this._trigger(this._replyEventName(i),l)}),this.presence=new FA(this),this.broadcastEndpointURL=U6e(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((o=(a=this.params.config)===null||a===void 0?void 0:a.broadcast)===null||o===void 0)&&o.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(t,s=this.timeout){var n,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=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(b=>b.filter))!==null&&a!==void 0?a:[],x=!!this.bindings[zA.PRESENCE]&&this.bindings[zA.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(Hx.CHANNEL_ERROR,b)),this._onClose(()=>t==null?void 0:t(Hx.CLOSED)),this.updateJoinPayload(Object.assign({config:v},y)),this.joinedOnce=!0,this._rejoin(s),this.joinPush.receive("ok",async({postgres_changes:b})=>{var N;if(this.socket.setAuth(),b===void 0){t==null||t(Hx.SUBSCRIBED);return}else{const k=this.bindings.postgres_changes,M=(N=k==null?void 0:k.length)!==null&&N!==void 0?N:0,E=[];for(let T=0;T{this.state=rd.errored,t==null||t(Hx.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(b).join(", ")||"error")))}).receive("timeout",()=>{t==null||t(Hx.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(t,s={}){return await this.send({type:"presence",event:"track",payload:t},s.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,s,n){return this.state===rd.joined&&t===zA.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,s,n)}async httpSend(t,s,n={}){var a;const o=this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"";if(s==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:s,private:this.private}]})},i=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(a=n.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,s={}){var n,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,(n=s.timeout)!==null&&n!==void 0?n: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,s.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 s=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(mf.close,"leave",this._joinRef())};this.joinPush.destroy();let n=null;return new Promise(a=>{n=new Sce(this,mf.leave,{},t),n.receive("ok",()=>{s(),a("ok")}).receive("timeout",()=>{s(),a("timed out")}).receive("error",()=>{a("error")}),n.send(),this._canPush()||n.trigger("ok",{})}).finally(()=>{n==null||n.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,s,n){const a=new AbortController,o=setTimeout(()=>a.abort(),n),l=await this.socket.fetch(t,Object.assign(Object.assign({},s),{signal:a.signal}));return clearTimeout(o),l}_push(t,s,n=this.timeout){if(!this.joinedOnce)throw`tried to push '${t}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let a=new Sce(this,t,s,n);return this._canPush()?a.send():this._addToPushBuffer(a),a}_addToPushBuffer(t){if(t.startTimeout(),this.pushBuffer.push(t),this.pushBuffer.length>Hst){const s=this.pushBuffer.shift();s&&(s.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${s.event}`,s.payload))}}_onMessage(t,s,n){return s}_isMember(t){return this.topic===t}_joinRef(){return this.joinPush.ref}_trigger(t,s,n){var a,o;const l=t.toLocaleLowerCase(),{close:i,error:u,leave:m,join:x}=mf;if(n&&[i,u,m,x].indexOf(l)>=0&&n!==this._joinRef())return;let v=this._onMessage(l,s,n);if(s&&!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,n)):(o=this.bindings[l])===null||o===void 0||o.filter(b=>{var N,k,M,E,T,P;if(["broadcast","presence","postgres_changes"].includes(l))if("id"in b){const R=b.id,D=(N=b.filter)===null||N===void 0?void 0:N.event;return R&&((k=s.ids)===null||k===void 0?void 0:k.includes(R))&&(D==="*"||(D==null?void 0:D.toLocaleLowerCase())===((M=s.data)===null||M===void 0?void 0:M.type.toLocaleLowerCase()))}else{const R=(T=(E=b==null?void 0:b.filter)===null||E===void 0?void 0:E.event)===null||T===void 0?void 0:T.toLocaleLowerCase();return R==="*"||R===((P=s==null?void 0:s.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:E,type:T,errors:P}=N;v=Object.assign(Object.assign({},{schema:k,table:M,commit_timestamp:E,eventType:T,new:{},old:{},errors:P}),this._getPayloadRecords(N))}b.callback(v,n)})}_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,s,n){const a=t.toLocaleLowerCase(),o={type:a,filter:s,callback:n};return this.bindings[a]?this.bindings[a].push(o):this.bindings[a]=[o],this}_off(t,s){const n=t.toLocaleLowerCase();return this.bindings[n]&&(this.bindings[n]=this.bindings[n].filter(a=>{var o;return!(((o=a.type)===null||o===void 0?void 0:o.toLocaleLowerCase())===n&&Ixe.isEqual(a.filter,s))})),this}static isEqual(t,s){if(Object.keys(t).length!==Object.keys(s).length)return!1;for(const n in t)if(t[n]!==s[n])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(t){this._on(mf.close,{},t)}_onError(t){this._on(mf.error,{},s=>t(s))}_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 s={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(s.new=xke(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(s.old=xke(t.columns,t.old_record)),s}}const Cce=()=>{},aO={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Jst=[1e3,2e3,5e3,1e4],ent=1e4,tnt=` addEventListener("message", (e) => { if (e.data.event === "start") { setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); } });`;class rnt{constructor(t,s){var n;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Yhe,this.transport=null,this.heartbeatIntervalMs=aO.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=Cce,this.ref=0,this.reconnectTimer=null,this.logger=Cce,this.conn=null,this.sendBuffer=[],this.serializer=new Wst,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)=>E3(async()=>{const{default:i}=await Promise.resolve().then(()=>Ek);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)},!(!((n=s==null?void 0:s.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=s.params.apikey,this.endPoint=`${t}/${Xhe.websocket}`,this.httpEndpoint=U6e(t),this._initializeOptions(s),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(s==null?void 0:s.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=Bst.createWebSocket(this.endpointURL())}catch(t){this._setConnectionState("disconnected");const s=t.message;throw s.includes("Node.js")?new Error(`${s} To use Realtime in Node.js, you need to provide a WebSocket implementation: Option 1: Use Node.js 22+ which has native WebSocket support Option 2: Install and provide the "ws" package: npm install ws import ws from "ws" const client = new RealtimeClient(url, { ...options, transport: ws })`):new Error(`WebSocket not available: ${s}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:qst}))}disconnect(t,s){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const n=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(n),this._setConnectionState("disconnected")},t?this.conn.close(t,s??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(t){const s=await t.unsubscribe();return this.channels.length===0&&this.disconnect(),s}async removeAllChannels(){const t=await Promise.all(this.channels.map(s=>s.unsubscribe()));return this.channels=[],this.disconnect(),t}log(t,s,n){this.logger(t,s,n)}connectionState(){switch(this.conn&&this.conn.readyState){case RA.connecting:return ej.Connecting;case RA.open:return ej.Open;case RA.closing:return ej.Closing;default:return ej.Closed}}isConnected(){return this.connectionState()===ej.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(t,s={config:{}}){const n=`realtime:${t}`,a=this.getChannels().find(o=>o.topic===n);if(a)return a;{const o=new Ixe(`realtime:${t}`,s,this);return this.channels.push(o),o}}push(t){const{topic:s,event:n,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",`${s} ${n} (${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(s){this.log("error","error in heartbeat callback",s)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(s){this.log("error","error in heartbeat callback",s)}this._wasManualDisconnect=!1,(t=this.conn)===null||t===void 0||t.close(Vst,"heartbeat timeout"),setTimeout(()=>{var s;this.isConnected()||(s=this.reconnectTimer)===null||s===void 0||s.scheduleTimeout()},aO.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(s){this.log("error","error in heartbeat callback",s)}this._setAuthSafely("heartbeat")}onHeartbeat(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 s=this.channels.find(n=>n.topic===t&&(n._isJoined()||n._isJoining()));s&&(this.log("transport",`leaving duplicate topic "${t}"`),s.unsubscribe())}_remove(t){this.channels=this.channels.filter(s=>s.topic!==t.topic)}_onConnMessage(t){this.decode(t.data,s=>{if(s.topic==="phoenix"&&s.event==="phx_reply")try{this.heartbeatCallback(s.payload.status==="ok"?"ok":"error")}catch(m){this.log("error","error in heartbeat callback",m)}s.ref&&s.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:n,event:a,payload:o,ref:l}=s,i=l?`(${l})`:"",u=o.status||"";this.log("receive",`${u} ${n} ${a} ${i}`.trim(),o),this.channels.filter(m=>m._isMember(n)).forEach(m=>m._trigger(a,o,l)),this._triggerStateCallbacks("message",s)})}_clearTimer(t){var s;t==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):t==="reconnect"&&((s=this.reconnectTimer)===null||s===void 0||s.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=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=s=>{this.log("worker","worker error",s.message),this.workerRef.terminate()},this.workerRef.onmessage=s=>{s.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(t){var s;this._setConnectionState("disconnected"),this.log("transport","close",t),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(s=this.reconnectTimer)===null||s===void 0||s.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(mf.error))}_appendParams(t,s){if(Object.keys(s).length===0)return t;const n=t.match(/\?/)?"&":"?",a=new URLSearchParams(s);return`${t}${n}${a}`}_workerObjectUrl(t){let s;if(t)s=t;else{const n=new Blob([tnt],{type:"application/javascript"});s=URL.createObjectURL(n)}return s}_setConnectionState(t,s=!1){this._connectionState=t,t==="connecting"?this._wasManualDisconnect=!1:t==="disconnecting"&&(this._wasManualDisconnect=s)}async _performAuth(t=null){let s;t?s=t:this.accessToken?s=await this.accessToken():s=this.accessTokenValue,this.accessTokenValue!=s&&(this.accessTokenValue=s,this.channels.forEach(n=>{const a={access_token:s,version:Ust};s&&n.updateJoinPayload(a),n.joinedOnce&&n._isJoined()&&n._push(mf.access_token,{access_token:s})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this.setAuth().catch(s=>{this.log("error",`error setting auth in ${t}`,s)})}_triggerStateCallbacks(t,s){try{this.stateChangeCallbacks[t].forEach(n=>{try{n(s)}catch(a){this.log("error",`error in ${t} callback`,a)}})}catch(n){this.log("error",`error triggering ${t} callbacks`,n)}}_setupReconnectionTimer(){this.reconnectTimer=new B6e(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},aO.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(t){var s,n,a,o,l,i,u,m,x;if(this.transport=(s=t==null?void 0:t.transport)!==null&&s!==void 0?s:null,this.timeout=(n=t==null?void 0:t.timeout)!==null&&n!==void 0?n:Yhe,this.heartbeatIntervalMs=(a=t==null?void 0:t.heartbeatIntervalMs)!==null&&a!==void 0?a:aO.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:Cce,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=>Jst[y-1]||ent,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 Pxe extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}}function Fl(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}class snt extends Pxe{constructor(t,s,n){super(t),this.name="StorageApiError",this.status=s,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class Jhe extends Pxe{constructor(t,s){super(t),this.name="StorageUnknownError",this.originalError=s}}const Lxe=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...s)=>E3(async()=>{const{default:n}=await Promise.resolve().then(()=>Ek);return{default:n}},void 0).then(({default:n})=>n(...s)):t=fetch,(...s)=>t(...s)},nnt=()=>Hn(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield E3(()=>Promise.resolve().then(()=>Ek),void 0)).Response:Response}),eme=e=>{if(Array.isArray(e))return e.map(s=>eme(s));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([s,n])=>{const a=s.replace(/([-_][a-z])/gi,o=>o.toUpperCase().replace(/[-_]/g,""));t[a]=eme(n)}),t},ant=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)},Mce=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)},int=(e,t,s)=>Hn(void 0,void 0,void 0,function*(){const n=yield nnt();e instanceof n&&!(s!=null&&s.noResolveJson)?e.json().then(a=>{const o=e.status||500,l=(a==null?void 0:a.statusCode)||o+"";t(new snt(Mce(a),o,l))}).catch(a=>{t(new Jhe(Mce(a),a))}):t(new Jhe(Mce(e),e))}),ont=(e,t,s,n)=>{const a={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"||!n?a:(ant(n)?(a.headers=Object.assign({"Content-Type":"application/json"},t==null?void 0:t.headers),a.body=JSON.stringify(n)):a.body=n,t!=null&&t.duplex&&(a.duplex=t.duplex),Object.assign(Object.assign({},a),s))};function nP(e,t,s,n,a,o){return Hn(this,void 0,void 0,function*(){return new Promise((l,i)=>{e(s,ont(t,n,a,o)).then(u=>{if(!u.ok)throw u;return n!=null&&n.noResolveJson?u:u.json()}).then(u=>l(u)).catch(u=>int(u,i,n))})})}function PE(e,t,s,n){return Hn(this,void 0,void 0,function*(){return nP(e,"GET",t,s,n)})}function cf(e,t,s,n,a){return Hn(this,void 0,void 0,function*(){return nP(e,"POST",t,n,a,s)})}function tme(e,t,s,n,a){return Hn(this,void 0,void 0,function*(){return nP(e,"PUT",t,n,a,s)})}function lnt(e,t,s,n){return Hn(this,void 0,void 0,function*(){return nP(e,"HEAD",t,Object.assign(Object.assign({},s),{noResolveJson:!0}),n)})}function Oxe(e,t,s,n,a){return Hn(this,void 0,void 0,function*(){return nP(e,"DELETE",t,n,a,s)})}class cnt{constructor(t,s){this.downloadFn=t,this.shouldThrowOnError=s}then(t,s){return this.execute().then(t,s)}execute(){return Hn(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(Fl(t))return{data:null,error:t};throw t}})}}var q6e;class dnt{constructor(t,s){this.downloadFn=t,this.shouldThrowOnError=s,this[q6e]="BlobDownloadBuilder",this.promise=null}asStream(){return new cnt(this.downloadFn,this.shouldThrowOnError)}then(t,s){return this.getPromise().then(t,s)}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 Hn(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(Fl(t))return{data:null,error:t};throw t}})}}q6e=Symbol.toStringTag;const unt={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},_ke={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class hnt{constructor(t,s={},n,a){this.shouldThrowOnError=!1,this.url=t,this.headers=s,this.bucketId=n,this.fetch=Lxe(a)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(t,s,n,a){return Hn(this,void 0,void 0,function*(){try{let o;const l=Object.assign(Object.assign({},_ke),a);let i=Object.assign(Object.assign({},this.headers),t==="POST"&&{"x-upsert":String(l.upsert)});const u=l.metadata;typeof Blob<"u"&&n instanceof Blob?(o=new FormData,o.append("cacheControl",l.cacheControl),u&&o.append("metadata",this.encodeMetadata(u)),o.append("",n)):typeof FormData<"u"&&n instanceof FormData?(o=n,o.append("cacheControl",l.cacheControl),u&&o.append("metadata",this.encodeMetadata(u))):(o=n,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(s),x=this._getFinalPath(m),y=yield(t=="PUT"?tme:cf)(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(Fl(o))return{data:null,error:o};throw o}})}upload(t,s,n){return Hn(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",t,s,n)})}uploadToSignedUrl(t,s,n,a){return Hn(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",s);try{let u;const m=Object.assign({upsert:_ke.upsert},a),x=Object.assign(Object.assign({},this.headers),{"x-upsert":String(m.upsert)});typeof Blob<"u"&&n instanceof Blob?(u=new FormData,u.append("cacheControl",m.cacheControl),u.append("",n)):typeof FormData<"u"&&n instanceof FormData?(u=n,u.append("cacheControl",m.cacheControl)):(u=n,x["cache-control"]=`max-age=${m.cacheControl}`,x["content-type"]=m.contentType);const y=yield tme(this.fetch,i.toString(),u,{headers:x});return{data:{path:o,fullPath:y.Key},error:null}}catch(u){if(this.shouldThrowOnError)throw u;if(Fl(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(t,s){return Hn(this,void 0,void 0,function*(){try{let n=this._getFinalPath(t);const a=Object.assign({},this.headers);s!=null&&s.upsert&&(a["x-upsert"]="true");const o=yield cf(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:a}),l=new URL(this.url+o.url),i=l.searchParams.get("token");if(!i)throw new Pxe("No token returned by API");return{data:{signedUrl:l.toString(),path:t,token:i},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Fl(n))return{data:null,error:n};throw n}})}update(t,s,n){return Hn(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",t,s,n)})}move(t,s,n){return Hn(this,void 0,void 0,function*(){try{return{data:yield cf(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:t,destinationKey:s,destinationBucket:n==null?void 0:n.destinationBucket},{headers:this.headers}),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Fl(a))return{data:null,error:a};throw a}})}copy(t,s,n){return Hn(this,void 0,void 0,function*(){try{return{data:{path:(yield cf(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:t,destinationKey:s,destinationBucket:n==null?void 0:n.destinationBucket},{headers:this.headers})).Key},error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Fl(a))return{data:null,error:a};throw a}})}createSignedUrl(t,s,n){return Hn(this,void 0,void 0,function*(){try{let a=this._getFinalPath(t),o=yield cf(this.fetch,`${this.url}/object/sign/${a}`,Object.assign({expiresIn:s},n!=null&&n.transform?{transform:n.transform}:{}),{headers:this.headers});const l=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return o={signedUrl:encodeURI(`${this.url}${o.signedURL}${l}`)},{data:o,error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Fl(a))return{data:null,error:a};throw a}})}createSignedUrls(t,s,n){return Hn(this,void 0,void 0,function*(){try{const a=yield cf(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:s,paths:t},{headers:this.headers}),o=n!=null&&n.download?`&download=${n.download===!0?"":n.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(Fl(a))return{data:null,error:a};throw a}})}download(t,s){const a=typeof(s==null?void 0:s.transform)<"u"?"render/image/authenticated":"object",o=this.transformOptsToQueryString((s==null?void 0:s.transform)||{}),l=o?`?${o}`:"",i=this._getFinalPath(t),u=()=>PE(this.fetch,`${this.url}/${a}/${i}${l}`,{headers:this.headers,noResolveJson:!0});return new dnt(u,this.shouldThrowOnError)}info(t){return Hn(this,void 0,void 0,function*(){const s=this._getFinalPath(t);try{const n=yield PE(this.fetch,`${this.url}/object/info/${s}`,{headers:this.headers});return{data:eme(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Fl(n))return{data:null,error:n};throw n}})}exists(t){return Hn(this,void 0,void 0,function*(){const s=this._getFinalPath(t);try{return yield lnt(this.fetch,`${this.url}/object/${s}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Fl(n)&&n instanceof Jhe){const a=n.originalError;if([400,404].includes(a==null?void 0:a.status))return{data:!1,error:n}}throw n}})}getPublicUrl(t,s){const n=this._getFinalPath(t),a=[],o=s!=null&&s.download?`download=${s.download===!0?"":s.download}`:"";o!==""&&a.push(o);const i=typeof(s==null?void 0:s.transform)<"u"?"render/image":"object",u=this.transformOptsToQueryString((s==null?void 0:s.transform)||{});u!==""&&a.push(u);let m=a.join("&");return m!==""&&(m=`?${m}`),{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${n}${m}`)}}}remove(t){return Hn(this,void 0,void 0,function*(){try{return{data:yield Oxe(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:t},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Fl(s))return{data:null,error:s};throw s}})}list(t,s,n){return Hn(this,void 0,void 0,function*(){try{const a=Object.assign(Object.assign(Object.assign({},unt),s),{prefix:t||""});return{data:yield cf(this.fetch,`${this.url}/object/list/${this.bucketId}`,a,{headers:this.headers},n),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Fl(a))return{data:null,error:a};throw a}})}listV2(t,s){return Hn(this,void 0,void 0,function*(){try{const n=Object.assign({},t);return{data:yield cf(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,n,{headers:this.headers},s),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Fl(n))return{data:null,error:n};throw n}})}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 s=[];return t.width&&s.push(`width=${t.width}`),t.height&&s.push(`height=${t.height}`),t.resize&&s.push(`resize=${t.resize}`),t.format&&s.push(`format=${t.format}`),t.quality&&s.push(`quality=${t.quality}`),s.join("&")}}const V6e="2.78.0",H6e={"X-Client-Info":`storage-js/${V6e}`};class mnt{constructor(t,s={},n,a){this.shouldThrowOnError=!1;const o=new URL(t);a!=null&&a.useNewHostname&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase.")),this.url=o.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},H6e),s),this.fetch=Lxe(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(t){return Hn(this,void 0,void 0,function*(){try{const s=this.listBucketOptionsToQueryString(t);return{data:yield PE(this.fetch,`${this.url}/bucket${s}`,{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Fl(s))return{data:null,error:s};throw s}})}getBucket(t){return Hn(this,void 0,void 0,function*(){try{return{data:yield PE(this.fetch,`${this.url}/bucket/${t}`,{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Fl(s))return{data:null,error:s};throw s}})}createBucket(t){return Hn(this,arguments,void 0,function*(s,n={public:!1}){try{return{data:yield cf(this.fetch,`${this.url}/bucket`,{id:s,name:s,type:n.type,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Fl(a))return{data:null,error:a};throw a}})}updateBucket(t,s){return Hn(this,void 0,void 0,function*(){try{return{data:yield tme(this.fetch,`${this.url}/bucket/${t}`,{id:t,name:t,public:s.public,file_size_limit:s.fileSizeLimit,allowed_mime_types:s.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Fl(n))return{data:null,error:n};throw n}})}emptyBucket(t){return Hn(this,void 0,void 0,function*(){try{return{data:yield cf(this.fetch,`${this.url}/bucket/${t}/empty`,{},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Fl(s))return{data:null,error:s};throw s}})}deleteBucket(t){return Hn(this,void 0,void 0,function*(){try{return{data:yield Oxe(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Fl(s))return{data:null,error:s};throw s}})}listBucketOptionsToQueryString(t){const s={};return t&&("limit"in t&&(s.limit=String(t.limit)),"offset"in t&&(s.offset=String(t.offset)),t.search&&(s.search=t.search),t.sortColumn&&(s.sortColumn=t.sortColumn),t.sortOrder&&(s.sortOrder=t.sortOrder)),Object.keys(s).length>0?"?"+new URLSearchParams(s).toString():""}}class pnt{constructor(t,s={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},H6e),s),this.fetch=Lxe(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(t){return Hn(this,void 0,void 0,function*(){try{return{data:yield cf(this.fetch,`${this.url}/bucket`,{name:t},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Fl(s))return{data:null,error:s};throw s}})}listBuckets(t){return Hn(this,void 0,void 0,function*(){try{const s=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&s.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&s.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&s.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&s.set("sortOrder",t.sortOrder),t!=null&&t.search&&s.set("search",t.search);const n=s.toString(),a=n?`${this.url}/bucket?${n}`:`${this.url}/bucket`;return{data:yield PE(this.fetch,a,{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Fl(s))return{data:null,error:s};throw s}})}deleteBucket(t){return Hn(this,void 0,void 0,function*(){try{return{data:yield Oxe(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Fl(s))return{data:null,error:s};throw s}})}}const Dxe={"X-Client-Info":`storage-js/${V6e}`,"Content-Type":"application/json"};class W6e extends Error{constructor(t){super(t),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}}function lm(e){return typeof e=="object"&&e!==null&&"__isStorageVectorsError"in e}class Tce extends W6e{constructor(t,s,n){super(t),this.name="StorageVectorsApiError",this.status=s,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class fnt extends W6e{constructor(t,s){super(t),this.name="StorageVectorsUnknownError",this.originalError=s}}var bke;(function(e){e.InternalError="InternalError",e.S3VectorConflictException="S3VectorConflictException",e.S3VectorNotFoundException="S3VectorNotFoundException",e.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",e.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",e.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(bke||(bke={}));const Rxe=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...s)=>E3(async()=>{const{default:n}=await Promise.resolve().then(()=>Ek);return{default:n}},void 0).then(({default:n})=>n(...s)):t=fetch,(...s)=>t(...s)},gnt=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)},wke=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),xnt=(e,t,s)=>Hn(void 0,void 0,void 0,function*(){if(e&&typeof e=="object"&&"status"in e&&"ok"in e&&typeof e.status=="number"&&!(s!=null&&s.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 Tce(wke(l),a,i))}).catch(()=>{const l=a+"",i=o.statusText||`HTTP ${a} error`;t(new Tce(i,a,l))});else{const l=a+"",i=o.statusText||`HTTP ${a} error`;t(new Tce(i,a,l))}}else t(new fnt(wke(e),e))}),ynt=(e,t,s,n)=>{const a={method:e,headers:(t==null?void 0:t.headers)||{}};return n?(gnt(n)?(a.headers=Object.assign({"Content-Type":"application/json"},t==null?void 0:t.headers),a.body=JSON.stringify(n)):a.body=n,Object.assign(Object.assign({},a),s)):a};function vnt(e,t,s,n,a,o){return Hn(this,void 0,void 0,function*(){return new Promise((l,i)=>{e(s,ynt(t,n,a,o)).then(u=>{if(!u.ok)throw u;if(n!=null&&n.noResolveJson)return u;const m=u.headers.get("content-type");return!m||!m.includes("application/json")?{}:u.json()}).then(u=>l(u)).catch(u=>xnt(u,i,n))})})}function cm(e,t,s,n,a){return Hn(this,void 0,void 0,function*(){return vnt(e,"POST",t,n,a,s)})}class _nt{constructor(t,s={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Dxe),s),this.fetch=Rxe(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(t){return Hn(this,void 0,void 0,function*(){try{return{data:(yield cm(this.fetch,`${this.url}/CreateIndex`,t,{headers:this.headers}))||{},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(lm(s))return{data:null,error:s};throw s}})}getIndex(t,s){return Hn(this,void 0,void 0,function*(){try{return{data:yield cm(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:t,indexName:s},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(lm(n))return{data:null,error:n};throw n}})}listIndexes(t){return Hn(this,void 0,void 0,function*(){try{return{data:yield cm(this.fetch,`${this.url}/ListIndexes`,t,{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(lm(s))return{data:null,error:s};throw s}})}deleteIndex(t,s){return Hn(this,void 0,void 0,function*(){try{return{data:(yield cm(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:t,indexName:s},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(lm(n))return{data:null,error:n};throw n}})}}class bnt{constructor(t,s={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Dxe),s),this.fetch=Rxe(n)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(t){return Hn(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 cm(this.fetch,`${this.url}/PutVectors`,t,{headers:this.headers}))||{},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(lm(s))return{data:null,error:s};throw s}})}getVectors(t){return Hn(this,void 0,void 0,function*(){try{return{data:yield cm(this.fetch,`${this.url}/GetVectors`,t,{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(lm(s))return{data:null,error:s};throw s}})}listVectors(t){return Hn(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 cm(this.fetch,`${this.url}/ListVectors`,t,{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(lm(s))return{data:null,error:s};throw s}})}queryVectors(t){return Hn(this,void 0,void 0,function*(){try{return{data:yield cm(this.fetch,`${this.url}/QueryVectors`,t,{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(lm(s))return{data:null,error:s};throw s}})}deleteVectors(t){return Hn(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 cm(this.fetch,`${this.url}/DeleteVectors`,t,{headers:this.headers}))||{},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(lm(s))return{data:null,error:s};throw s}})}}class wnt{constructor(t,s={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Dxe),s),this.fetch=Rxe(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(t){return Hn(this,void 0,void 0,function*(){try{return{data:(yield cm(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:this.headers}))||{},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(lm(s))return{data:null,error:s};throw s}})}getBucket(t){return Hn(this,void 0,void 0,function*(){try{return{data:yield cm(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:t},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(lm(s))return{data:null,error:s};throw s}})}listBuckets(){return Hn(this,arguments,void 0,function*(t={}){try{return{data:yield cm(this.fetch,`${this.url}/ListVectorBuckets`,t,{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(lm(s))return{data:null,error:s};throw s}})}deleteBucket(t){return Hn(this,void 0,void 0,function*(){try{return{data:(yield cm(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:this.headers}))||{},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(lm(s))return{data:null,error:s};throw s}})}}class jnt extends wnt{constructor(t,s={}){super(t,s.headers||{},s.fetch)}from(t){return new knt(this.url,this.headers,t,this.fetch)}}class knt extends _nt{constructor(t,s,n,a){super(t,s,a),this.vectorBucketName=n}createIndex(t){const s=Object.create(null,{createIndex:{get:()=>super.createIndex}});return Hn(this,void 0,void 0,function*(){return s.createIndex.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName}))})}listIndexes(){const t=Object.create(null,{listIndexes:{get:()=>super.listIndexes}});return Hn(this,arguments,void 0,function*(s={}){return t.listIndexes.call(this,Object.assign(Object.assign({},s),{vectorBucketName:this.vectorBucketName}))})}getIndex(t){const s=Object.create(null,{getIndex:{get:()=>super.getIndex}});return Hn(this,void 0,void 0,function*(){return s.getIndex.call(this,this.vectorBucketName,t)})}deleteIndex(t){const s=Object.create(null,{deleteIndex:{get:()=>super.deleteIndex}});return Hn(this,void 0,void 0,function*(){return s.deleteIndex.call(this,this.vectorBucketName,t)})}index(t){return new Nnt(this.url,this.headers,this.vectorBucketName,t,this.fetch)}}class Nnt extends bnt{constructor(t,s,n,a,o){super(t,s,o),this.vectorBucketName=n,this.indexName=a}putVectors(t){const s=Object.create(null,{putVectors:{get:()=>super.putVectors}});return Hn(this,void 0,void 0,function*(){return s.putVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}getVectors(t){const s=Object.create(null,{getVectors:{get:()=>super.getVectors}});return Hn(this,void 0,void 0,function*(){return s.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 Hn(this,arguments,void 0,function*(s={}){return t.listVectors.call(this,Object.assign(Object.assign({},s),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}queryVectors(t){const s=Object.create(null,{queryVectors:{get:()=>super.queryVectors}});return Hn(this,void 0,void 0,function*(){return s.queryVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}deleteVectors(t){const s=Object.create(null,{deleteVectors:{get:()=>super.deleteVectors}});return Hn(this,void 0,void 0,function*(){return s.deleteVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}}class Snt extends mnt{constructor(t,s={},n,a){super(t,s,n,a)}from(t){return new hnt(this.url,this.headers,t,this.fetch)}get vectors(){return new jnt(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new pnt(this.url+"/iceberg",this.headers,this.fetch)}}const Cnt="2.78.0";let RT="";typeof Deno<"u"?RT="deno":typeof document<"u"?RT="web":typeof navigator<"u"&&navigator.product==="ReactNative"?RT="react-native":RT="node";const Mnt={"X-Client-Info":`supabase-js-${RT}/${Cnt}`},Tnt={headers:Mnt},Ant={schema:"public"},Ent={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Int={},Pnt=e=>{let t;return e?t=e:typeof fetch>"u"?t=b6e:t=fetch,(...s)=>t(...s)},Lnt=()=>typeof Headers>"u"?w6e:Headers,Ont=(e,t,s)=>{const n=Pnt(s),a=Lnt();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}`),n(o,Object.assign(Object.assign({},l),{headers:m}))}};function Dnt(e){return e.endsWith("/")?e:e+"/"}function Rnt(e,t){var s,n;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({},(s=y==null?void 0:y.headers)!==null&&s!==void 0?s:{}),(n=i==null?void 0:i.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return e.accessToken?v.accessToken=e.accessToken:delete v.accessToken,v}function Fnt(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(Dnt(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const G6e="2.78.0",U4=30*1e3,rme=3,Ace=rme*U4,znt="http://localhost:9999",Bnt="supabase.auth.token",$nt={"X-Client-Info":`gotrue-js/${G6e}`},sme="X-Supabase-Api-Version",K6e={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Unt=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,qnt=10*60*1e3;class LE extends Error{constructor(t,s,n){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=s,this.code=n}}function da(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class Vnt extends LE{constructor(t,s,n){super(t,s,n),this.name="AuthApiError",this.status=s,this.code=n}}function Hnt(e){return da(e)&&e.name==="AuthApiError"}class tj extends LE{constructor(t,s){super(t),this.name="AuthUnknownError",this.originalError=s}}class Cv extends LE{constructor(t,s,n,a){super(t,n,a),this.name=s,this.status=n}}class sf extends Cv{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Wnt(e){return da(e)&&e.name==="AuthSessionMissingError"}class j4 extends Cv{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class iO extends Cv{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class oO extends Cv{constructor(t,s=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=s}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function Gnt(e){return da(e)&&e.name==="AuthImplicitGrantRedirectError"}class jke extends Cv{constructor(t,s=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=s}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class nme extends Cv{constructor(t,s){super(t,"AuthRetryableFetchError",s,void 0)}}function Ece(e){return da(e)&&e.name==="AuthRetryableFetchError"}class kke extends Cv{constructor(t,s,n){super(t,"AuthWeakPasswordError",s,"weak_password"),this.reasons=n}}class ame extends Cv{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const Rte="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Nke=` \r=`.split(""),Knt=(()=>{const e=new Array(128);for(let t=0;t=6;){const n=t.queue>>t.queuedBits-6&63;s(Rte[n]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const n=t.queue>>t.queuedBits-6&63;s(Rte[n]),t.queuedBits-=6}}function Z6e(e,t,s){const n=Knt[e];if(n>-1)for(t.queue=t.queue<<6|n,t.queuedBits+=6;t.queuedBits>=8;)s(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function Cke(e){const t=[],s=l=>{t.push(String.fromCodePoint(l))},n={utf8seq:0,codepoint:0},a={queue:0,queuedBits:0},o=l=>{Xnt(l,n,s)};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 Ynt(e,t){for(let s=0;s55295&&n<=56319){const a=(n-55296)*1024&65535;n=(e.charCodeAt(s+1)-56320&65535|a)+65536,s+=1}Znt(n,t)}}function Xnt(e,t,s){if(t.utf8seq===0){if(e<=127){s(e);return}for(let n=1;n<6;n+=1)if(!(e>>7-n&1)){t.utf8seq=n;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&&s(t.codepoint)}}function ZS(e){const t=[],s={queue:0,queuedBits:0},n=a=>{t.push(a)};for(let a=0;at.push(s)),new Uint8Array(t)}function lj(e){const t=[],s={queue:0,queuedBits:0},n=a=>{t.push(a)};return e.forEach(a=>Ske(a,s,n)),Ske(null,s,n),t.join("")}function Jnt(e){return Math.round(Date.now()/1e3)+e}function eat(){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 qu=()=>typeof window<"u"&&typeof document<"u",M_={tested:!1,writable:!1},Y6e=()=>{if(!qu())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(M_.tested)return M_.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),M_.tested=!0,M_.writable=!0}catch{M_.tested=!0,M_.writable=!1}return M_.writable};function tat(e){const t={},s=new URL(e);if(s.hash&&s.hash[0]==="#")try{new URLSearchParams(s.hash.substring(1)).forEach((a,o)=>{t[o]=a})}catch{}return s.searchParams.forEach((n,a)=>{t[a]=n}),t}const X6e=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...s)=>E3(async()=>{const{default:n}=await Promise.resolve().then(()=>Ek);return{default:n}},void 0).then(({default:n})=>n(...s)):t=fetch,(...s)=>t(...s)},rat=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",q4=async(e,t,s)=>{await e.setItem(t,JSON.stringify(s))},T_=async(e,t)=>{const s=await e.getItem(t);if(!s)return null;try{return JSON.parse(s)}catch{return s}},F0=async(e,t)=>{await e.removeItem(t)};class Mne{constructor(){this.promise=new Mne.promiseConstructor((t,s)=>{this.resolve=t,this.reject=s})}}Mne.promiseConstructor=Promise;function Ice(e){const t=e.split(".");if(t.length!==3)throw new ame("Invalid JWT structure");for(let n=0;n{setTimeout(()=>t(null),e)})}function nat(e,t){return new Promise((n,a)=>{(async()=>{for(let o=0;o<1/0;o++)try{const l=await e(o);if(!t(o,null,l)){n(l);return}}catch(l){if(!t(o,l)){a(l);return}}})()})}function aat(e){return("0"+e.toString(16)).substr(-2)}function iat(){const t=new Uint32Array(56);if(typeof crypto>"u"){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=s.length;let a="";for(let o=0;o<56;o++)a+=s.charAt(Math.floor(Math.random()*n));return a}return crypto.getRandomValues(t),Array.from(t,aat).join("")}async function oat(e){const s=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",s),a=new Uint8Array(n);return Array.from(a).map(o=>String.fromCharCode(o)).join("")}async function lat(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 s=await oat(e);return btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function k4(e,t,s=!1){const n=iat();let a=n;s&&(a+="/PASSWORD_RECOVERY"),await q4(e,`${t}-code-verifier`,a);const o=await lat(n);return[o,n===o?"plain":"s256"]}const cat=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function dat(e){const t=e.headers.get(sme);if(!t||!t.match(cat))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function uat(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 hat(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 mat=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function N4(e){if(!mat.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Pce(){const e={};return new Proxy(e,{get:(t,s)=>{if(s==="__isUserNotAvailableProxy")return!0;if(typeof s=="symbol"){const n=s.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${s}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,s)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${s}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,s)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${s}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function pat(e,t){return new Proxy(e,{get:(s,n,a)=>{if(n==="__isInsecureUserWarningProxy")return!0;if(typeof n=="symbol"){const o=n.toString();if(o==="Symbol(Symbol.toPrimitive)"||o==="Symbol(Symbol.toStringTag)"||o==="Symbol(util.inspect.custom)"||o==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(s,n,a)}return!t.value&&typeof n=="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(s,n,a)}})}function Mke(e){return JSON.parse(JSON.stringify(e))}const Zw=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),fat=[502,503,504];async function Tke(e){var t;if(!rat(e))throw new nme(Zw(e),0);if(fat.includes(e.status))throw new nme(Zw(e),e.status);let s;try{s=await e.json()}catch(o){throw new tj(Zw(o),o)}let n;const a=dat(e);if(a&&a.getTime()>=K6e["2024-01-01"].timestamp&&typeof s=="object"&&s&&typeof s.code=="string"?n=s.code:typeof s=="object"&&s&&typeof s.error_code=="string"&&(n=s.error_code),n){if(n==="weak_password")throw new kke(Zw(s),e.status,((t=s.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(n==="session_not_found")throw new sf}else if(typeof s=="object"&&s&&typeof s.weak_password=="object"&&s.weak_password&&Array.isArray(s.weak_password.reasons)&&s.weak_password.reasons.length&&s.weak_password.reasons.reduce((o,l)=>o&&typeof l=="string",!0))throw new kke(Zw(s),e.status,s.weak_password.reasons);throw new Vnt(Zw(s),e.status||500,n)}const gat=(e,t,s,n)=>{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(n),Object.assign(Object.assign({},a),s))};async function $a(e,t,s,n){var a;const o=Object.assign({},n==null?void 0:n.headers);o[sme]||(o[sme]=K6e["2024-01-01"].name),n!=null&&n.jwt&&(o.Authorization=`Bearer ${n.jwt}`);const l=(a=n==null?void 0:n.query)!==null&&a!==void 0?a:{};n!=null&&n.redirectTo&&(l.redirect_to=n.redirectTo);const i=Object.keys(l).length?"?"+new URLSearchParams(l).toString():"",u=await xat(e,t,s+i,{headers:o,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(u):{data:Object.assign({},u),error:null}}async function xat(e,t,s,n,a,o){const l=gat(t,n,a,o);let i;try{i=await e(s,Object.assign({},l))}catch(u){throw console.error(u),new nme(Zw(u),0)}if(i.ok||await Tke(i),n!=null&&n.noResolveJson)return i;try{return await i.json()}catch(u){await Tke(u)}}function nf(e){var t;let s=null;_at(e)&&(s=Object.assign({},e),e.expires_at||(s.expires_at=Jnt(e.expires_in)));const n=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:s,user:n},error:null}}function Ake(e){const t=nf(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((s,n)=>s&&typeof n=="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 yat(e){return{data:e,error:null}}function vat(e){const{action_link:t,email_otp:s,hashed_token:n,redirect_to:a,verification_type:o}=e,l=Sv(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),i={action_link:t,email_otp:s,hashed_token:n,redirect_to:a,verification_type:o},u=Object.assign({},l);return{data:{properties:i,user:u},error:null}}function Eke(e){return e}function _at(e){return e.access_token&&e.refresh_token&&e.expires_in}const Lce=["global","local","others"];class bat{constructor({url:t="",headers:s={},fetch:n}){this.url=t,this.headers=s,this.fetch=X6e(n),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,s=Lce[0]){if(Lce.indexOf(s)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Lce.join(", ")}`);try{return await $a(this.fetch,"POST",`${this.url}/logout?scope=${s}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(n){if(da(n))return{data:null,error:n};throw n}}async inviteUserByEmail(t,s={}){try{return await $a(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:s.data},headers:this.headers,redirectTo:s.redirectTo,xform:c1})}catch(n){if(da(n))return{data:{user:null},error:n};throw n}}async generateLink(t){try{const{options:s}=t,n=Sv(t,["options"]),a=Object.assign(Object.assign({},n),s);return"newEmail"in n&&(a.new_email=n==null?void 0:n.newEmail,delete a.newEmail),await $a(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:a,headers:this.headers,xform:vat,redirectTo:s==null?void 0:s.redirectTo})}catch(s){if(da(s))return{data:{properties:null,user:null},error:s};throw s}}async createUser(t){try{return await $a(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:c1})}catch(s){if(da(s))return{data:{user:null},error:s};throw s}}async listUsers(t){var s,n,a,o,l,i,u;try{const m={nextPage:null,lastPage:0,total:0},x=await $a(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(s=t==null?void 0:t.page)===null||s===void 0?void 0:s.toString())!==null&&n!==void 0?n:"",per_page:(o=(a=t==null?void 0:t.perPage)===null||a===void 0?void 0:a.toString())!==null&&o!==void 0?o:""},xform:Eke});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(da(m))return{data:{users:[]},error:m};throw m}}async getUserById(t){N4(t);try{return await $a(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:c1})}catch(s){if(da(s))return{data:{user:null},error:s};throw s}}async updateUserById(t,s){N4(t);try{return await $a(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:s,headers:this.headers,xform:c1})}catch(n){if(da(n))return{data:{user:null},error:n};throw n}}async deleteUser(t,s=!1){N4(t);try{return await $a(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:s},xform:c1})}catch(n){if(da(n))return{data:{user:null},error:n};throw n}}async _listFactors(t){N4(t.userId);try{const{data:s,error:n}=await $a(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:a=>({data:{factors:a},error:null})});return{data:s,error:n}}catch(s){if(da(s))return{data:null,error:s};throw s}}async _deleteFactor(t){N4(t.userId),N4(t.id);try{return{data:await $a(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(s){if(da(s))return{data:null,error:s};throw s}}async _listOAuthClients(t){var s,n,a,o,l,i,u;try{const m={nextPage:null,lastPage:0,total:0},x=await $a(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(s=t==null?void 0:t.page)===null||s===void 0?void 0:s.toString())!==null&&n!==void 0?n:"",per_page:(o=(a=t==null?void 0:t.perPage)===null||a===void 0?void 0:a.toString())!==null&&o!==void 0?o:""},xform:Eke});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(da(m))return{data:{clients:[]},error:m};throw m}}async _createOAuthClient(t){try{return await $a(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(da(s))return{data:null,error:s};throw s}}async _getOAuthClient(t){try{return await $a(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(da(s))return{data:null,error:s};throw s}}async _updateOAuthClient(t,s){try{return await $a(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:s,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(da(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(t){try{return await $a(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(da(s))return{data:null,error:s};throw s}}async _regenerateOAuthClientSecret(t){try{return await $a(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(da(s))return{data:null,error:s};throw s}}}function Ike(e={}){return{getItem:t=>e[t]||null,setItem:(t,s)=>{e[t]=s},removeItem:t=>{delete e[t]}}}const S4={debug:!!(globalThis&&Y6e()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Q6e extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class wat extends Q6e{}async function jat(e,t,s){S4.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const n=new globalThis.AbortController;return t>0&&setTimeout(()=>{n.abort(),S4.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:n.signal},async a=>{if(a){S4.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,a.name);try{return await s()}finally{S4.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,a.name)}}else{if(t===0)throw S4.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new wat(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(S4.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 s()}}))}function kat(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function J6e(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function Nat(e){return parseInt(e,16)}function Sat(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}function Cat(e){var t;const{chainId:s,domain:n,expirationTime:a,issuedAt:o=new Date,nonce:l,notBefore:i,requestId:u,resources:m,scheme:x,uri:y,version:v}=e;{if(!Number.isInteger(s))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${s}`);if(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(l&&l.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${l}`);if(!y)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(v!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${v}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(` `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const b=J6e(e.address),N=x?`${x}://${n}`:n,k=e.statement?`${e.statement} `:"",M=`${N} wants you to sign in with your Ethereum account: ${b} ${k}`;let E=`URI: ${y} Version: ${v} Chain ID: ${s}${l?` Nonce: ${l}`:""} Issued At: ${o.toISOString()}`;if(a&&(E+=` Expiration Time: ${a.toISOString()}`),i&&(E+=` Not Before: ${i.toISOString()}`),u&&(E+=` 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}`}E+=T}return`${M} ${E}`}class $c extends Error{constructor({message:t,code:s,cause:n,name:a}){var o;super(t,{cause:n}),this.__isWebAuthnError=!0,this.name=(o=a??(n instanceof Error?n.name:void 0))!==null&&o!==void 0?o:"Unknown Error",this.code=s}}class Fte extends $c{constructor(t,s){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s,message:t}),this.name="WebAuthnUnknownError",this.originalError=s}}function Mat({error:e,options:t}){var s,n,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 $c({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((s=o.authenticatorSelection)===null||s===void 0?void 0:s.requireResidentKey)===!0)return new $c({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((n=o.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new $c({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 $c({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 $c({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new $c({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 $c({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new $c({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const l=window.location.hostname;if(eLe(l)){if(o.rp.id!==l)return new $c({message:`The RP ID "${o.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new $c({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 $c({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 $c({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 $c({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function Tat({error:e,options:t}){const{publicKey:s}=t;if(!s)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new $c({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new $c({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const n=window.location.hostname;if(eLe(n)){if(s.rpId!==n)return new $c({message:`The RP ID "${s.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new $c({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new $c({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 $c({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class Aat{createNewAbortSignal(){if(this.controller){const s=new Error("Cancelling existing WebAuthn API call for new one");s.name="AbortError",this.controller.abort(s)}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 Eat=new Aat;function Iat(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:s,excludeCredentials:n}=e,a=Sv(e,["challenge","user","excludeCredentials"]),o=ZS(t).buffer,l=Object.assign(Object.assign({},s),{id:ZS(s.id).buffer}),i=Object.assign(Object.assign({},a),{challenge:o,user:l});if(n&&n.length>0){i.excludeCredentials=new Array(n.length);for(let u=0;u0){o.allowCredentials=new Array(s.length);for(let l=0;la!==null&&typeof a=="object"&&!Array.isArray(a),s=a=>a instanceof ArrayBuffer||ArrayBuffer.isView(a),n={};for(const a of e)if(a)for(const o in a){const l=a[o];if(l!==void 0)if(Array.isArray(l))n[o]=l;else if(s(l))n[o]=l;else if(t(l)){const i=n[o];t(i)?n[o]=zte(i,l):n[o]=zte(l)}else n[o]=l}return n}function Bat(e,t){return zte(Fat,e,t||{})}function $at(e,t){return zte(zat,e,t||{})}class Uat{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:s,friendlyName:n,signal:a},o){try{const{data:l,error:i}=await this.client.mfa.challenge({factorId:t,webauthn:s});if(!l)return{data:null,error:i};const u=a??Eat.createNewAbortSignal();if(l.webauthn.type==="create"){const{user:m}=l.webauthn.credential_options.publicKey;m.name||(m.name=`${m.id}:${n}`),m.displayName||(m.displayName=m.name)}switch(l.webauthn.type){case"create":{const m=Bat(l.webauthn.credential_options.publicKey,o==null?void 0:o.create),{data:x,error:y}=await Dat({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=$at(l.webauthn.credential_options.publicKey,o==null?void 0:o.request),{data:x,error:y}=await Rat(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 da(l)?{data:null,error:l}:{data:null,error:new tj("Unexpected error in challenge",l)}}}async _verify({challengeId:t,factorId:s,webauthn:n}){return this.client.mfa.verify({factorId:s,challengeId:t,webauthn:n})}async _authenticate({factorId:t,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:a}},o){if(!s)return{data:null,error:new LE("rpId is required for WebAuthn authentication")};try{if(!Pke())return{data:null,error:new tj("Browser does not support WebAuthn",null)};const{data:l,error:i}=await this.challenge({factorId:t,webauthn:{rpId:s,rpOrigins:n},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:s,rpOrigins:n,credential_response:u.credential_response}})}catch(l){return da(l)?{data:null,error:l}:{data:null,error:new tj("Unexpected error in authenticate",l)}}}async _register({friendlyName:t,rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:a},o){if(!s)return{data:null,error:new LE("rpId is required for WebAuthn registration")};try{if(!Pke())return{data:null,error:new tj("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:s,rpOrigins:n},signal:a},{create:o});return u?this._verify({factorId:l.id,challengeId:u.challengeId,webauthn:{rpId:s,rpOrigins:n,type:u.webauthn.type,credential_response:u.webauthn.credential_response}}):{data:null,error:m}}catch(l){return da(l)?{data:null,error:l}:{data:null,error:new tj("Unexpected error in register",l)}}}}kat();const qat={url:znt,storageKey:Bnt,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:$nt,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function Lke(e,t,s){return await s()}const C4={};class OE{get jwks(){var t,s;return(s=(t=C4[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&s!==void 0?s:{keys:[]}}set jwks(t){C4[this.storageKey]=Object.assign(Object.assign({},C4[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,s;return(s=(t=C4[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&s!==void 0?s:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){C4[this.storageKey]=Object.assign(Object.assign({},C4[this.storageKey]),{cachedAt:t})}constructor(t){var s,n;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=OE.nextInstanceID,OE.nextInstanceID+=1,this.instanceID>0&&qu()&&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({},qat),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 bat({url:a.url,headers:a.headers,fetch:a.fetch}),this.url=a.url,this.headers=a.headers,this.fetch=X6e(a.fetch),this.lock=a.lock||Lke,this.detectSessionInUrl=a.detectSessionInUrl,this.flowType=a.flowType,this.hasCustomAuthorizationHeader=a.hasCustomAuthorizationHeader,a.lock?this.lock=a.lock:qu()&&(!((s=globalThis==null?void 0:globalThis.navigator)===null||s===void 0)&&s.locks)?this.lock=jat:this.lock=Lke,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 Uat(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this)},this.persistSession?(a.storage?this.storage=a.storage:Y6e()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Ike(this.memoryStorage)),a.userStorage&&(this.userStorage=a.userStorage)):(this.memoryStorage={},this.storage=Ike(this.memoryStorage)),qu()&&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)}(n=this.broadcastChannel)===null||n===void 0||n.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o),await this._notifyAllSubscribers(o.data.event,o.data.session,!1)})}this.initialize()}_debug(...t){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${G6e}) ${new Date().toISOString()}`,...t),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var t;try{const s=tat(window.location.href);let n="none";if(this._isImplicitGrantCallback(s)?n="implicit":await this._isPKCECallback(s)&&(n="pkce"),qu()&&this.detectSessionInUrl&&n!=="none"){const{data:a,error:o}=await this._getSessionFromURL(s,n);if(o){if(this._debug("#_initialize()","error detecting session from URL",o),Gnt(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(s){return da(s)?{error:s}:{error:new tj("Unexpected error during initialization",s)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var s,n,a;try{const o=await $a(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(a=t==null?void 0:t.options)===null||a===void 0?void 0:a.captchaToken}},xform:nf}),{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(da(o))return{data:{user:null,session:null},error:o};throw o}}async signUp(t){var s,n,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 k4(this.storage,this.storageKey)),o=await $a(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:v==null?void 0:v.emailRedirectTo,body:{email:x,password:y,data:(s=v==null?void 0:v.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:v==null?void 0:v.captchaToken},code_challenge:b,code_challenge_method:N},xform:nf})}else if("phone"in t){const{phone:x,password:y,options:v}=t;o=await $a(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:x,password:y,data:(n=v==null?void 0:v.data)!==null&&n!==void 0?n:{},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:nf})}else throw new iO("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(da(o))return{data:{user:null,session:null},error:o};throw o}}async signInWithPassword(t){try{let s;if("email"in t){const{email:o,password:l,options:i}=t;s=await $a(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:Ake})}else if("phone"in t){const{phone:o,password:l,options:i}=t;s=await $a(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:Ake})}else throw new iO("You must provide either an email or phone number and a password");const{data:n,error:a}=s;return a?{data:{user:null,session:null},error:a}:!n||!n.session||!n.user?{data:{user:null,session:null},error:new j4}:(n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),{data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:a})}catch(s){if(da(s))return{data:{user:null,session:null},error:s};throw s}}async signInWithOAuth(t){var s,n,a,o;return await this._handleProviderSignIn(t.provider,{redirectTo:(s=t.options)===null||s===void 0?void 0:s.redirectTo,scopes:(n=t.options)===null||n===void 0?void 0:n.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:s}=t;switch(s){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${s}"`)}}async signInWithEthereum(t){var s,n,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:E,options:T}=t;let P;if(qu())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 R=new URL((s=T==null?void 0:T.url)!==null&&s!==void 0?s:window.location.href),D=await P.request({method:"eth_requestAccounts"}).then(G=>G).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!D||D.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const U=J6e(D[0]);let q=(n=T==null?void 0:T.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!q){const G=await P.request({method:"eth_chainId"});q=Nat(G)}const H={domain:R.host,address:U,statement:E,uri:R.href,version:"1",chainId:q,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=Cat(H),N=await P.request({method:"personal_sign",params:[Sat(b),U]})}try{const{data:k,error:M}=await $a(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:nf});if(M)throw M;return!k||!k.session||!k.user?{data:{user:null,session:null},error:new j4}:(k.session&&(await this._saveSession(k.session),await this._notifyAllSubscribers("SIGNED_IN",k.session)),{data:Object.assign({},k),error:M})}catch(k){if(da(k))return{data:{user:null,session:null},error:k};throw k}}async signInWithSolana(t){var s,n,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:E,statement:T,options:P}=t;let R;if(qu())if(typeof E=="object")R=E;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"))R=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 E!="object"||!(P!=null&&P.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");R=E}const D=new URL((s=P==null?void 0:P.url)!==null&&s!==void 0?s:window.location.href);if("signIn"in R&&R.signIn){const U=await R.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 q;if(Array.isArray(U)&&U[0]&&typeof U[0]=="object")q=U[0];else if(U&&typeof U=="object"&&"signedMessage"in U&&"signature"in U)q=U;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in q&&"signature"in q&&(typeof q.signedMessage=="string"||q.signedMessage instanceof Uint8Array)&&q.signature instanceof Uint8Array)N=typeof q.signedMessage=="string"?q.signedMessage:new TextDecoder().decode(q.signedMessage),k=q.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in R)||typeof R.signMessage!="function"||!("publicKey"in R)||typeof R!="object"||!R.publicKey||!("toBase58"in R.publicKey)||typeof R.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:`,R.publicKey.toBase58(),...T?["",T,""]:[""],"Version: 1",`URI: ${D.href}`,`Issued At: ${(a=(n=P==null?void 0:P.signInWithSolana)===null||n===void 0?void 0:n.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(q=>`- ${q}`)]:[]].join(` `);const U=await R.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:E}=await $a(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:N,signature:lj(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:nf});if(E)throw E;return!M||!M.session||!M.user?{data:{user:null,session:null},error:new j4}:(M.session&&(await this._saveSession(M.session),await this._notifyAllSubscribers("SIGNED_IN",M.session)),{data:Object.assign({},M),error:E})}catch(M){if(da(M))return{data:{user:null,session:null},error:M};throw M}}async _exchangeCodeForSession(t){const s=await T_(this.storage,`${this.storageKey}-code-verifier`),[n,a]=(s??"").split("/");try{const{data:o,error:l}=await $a(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:n},xform:nf});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 j4}:(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(da(o))return{data:{user:null,session:null,redirectType:null},error:o};throw o}}async signInWithIdToken(t){try{const{options:s,provider:n,token:a,access_token:o,nonce:l}=t,i=await $a(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:a,access_token:o,nonce:l,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}},xform:nf}),{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 j4}:(u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),{data:u,error:m})}catch(s){if(da(s))return{data:{user:null,session:null},error:s};throw s}}async signInWithOtp(t){var s,n,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 k4(this.storage,this.storageKey));const{error:y}=await $a(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:i,data:(s=u==null?void 0:u.data)!==null&&s!==void 0?s:{},create_user:(n=u==null?void 0:u.shouldCreateUser)!==null&&n!==void 0?n:!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 $a(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 iO("You must provide either an email or phone number.")}catch(i){if(da(i))return{data:{user:null,session:null},error:i};throw i}}async verifyOtp(t){var s,n;try{let a,o;"options"in t&&(a=(s=t.options)===null||s===void 0?void 0:s.redirectTo,o=(n=t.options)===null||n===void 0?void 0:n.captchaToken);const{data:l,error:i}=await $a(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:o}}),redirectTo:a,xform:nf});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(da(a))return{data:{user:null,session:null},error:a};throw a}}async signInWithSSO(t){var s,n,a;try{let o=null,l=null;return this.flowType==="pkce"&&([o,l]=await k4(this.storage,this.storageKey)),await $a(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:(n=(s=t.options)===null||s===void 0?void 0:s.redirectTo)!==null&&n!==void 0?n: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:yat})}catch(o){if(da(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:s},error:n}=t;if(n)throw n;if(!s)throw new sf;const{error:a}=await $a(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:s.access_token});return{data:{user:null,session:null},error:a}})}catch(t){if(da(t))return{data:{user:null,session:null},error:t};throw t}}async resend(t){try{const s=`${this.url}/resend`;if("email"in t){const{email:n,type:a,options:o}=t,{error:l}=await $a(this.fetch,"POST",s,{headers:this.headers,body:{email:n,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:n,type:a,options:o}=t,{data:l,error:i}=await $a(this.fetch,"POST",s,{headers:this.headers,body:{phone:n,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 iO("You must provide either an email or phone number and a type")}catch(s){if(da(s))return{data:{user:null,session:null},error:s};throw s}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async s=>s))}async _acquireLock(t,s){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),a=(async()=>(await n,await s()))();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 n=s();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const a=[...this.pendingInLock];await Promise.all(a),this.pendingInLock.splice(0,a.length)}return await n}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 s=await this.__loadSession();return await t(s)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null;const s=await T_(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",s),s!==null&&(this._isValidSession(s)?t=s:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const n=t.expires_at?t.expires_at*1e3-Date.now()await this._getUser()))}async _getUser(t){try{return t?await $a(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:c1}):await this._useSession(async s=>{var n,a,o;const{data:l,error:i}=s;if(i)throw i;return!(!((n=l.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new sf}:await $a(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(s){if(da(s))return Wnt(s)&&(await this._removeSession(),await F0(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:s};throw s}}async updateUser(t,s={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(t,s))}async _updateUser(t,s={}){try{return await this._useSession(async n=>{const{data:a,error:o}=n;if(o)throw o;if(!a.session)throw new sf;const l=a.session;let i=null,u=null;this.flowType==="pkce"&&t.email!=null&&([i,u]=await k4(this.storage,this.storageKey));const{data:m,error:x}=await $a(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:s==null?void 0:s.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(n){if(da(n))return{data:{user:null},error:n};throw n}}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 sf;const s=Date.now()/1e3;let n=s,a=!0,o=null;const{payload:l}=Ice(t.access_token);if(l.exp&&(n=l.exp,a=n<=s),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:n-s,expires_at:n},await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)}return{data:{user:o.user,session:o},error:null}}catch(s){if(da(s))return{data:{session:null,user:null},error:s};throw s}}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 s=>{var n;if(!t){const{data:l,error:i}=s;if(i)throw i;t=(n=l.session)!==null&&n!==void 0?n:void 0}if(!(t!=null&&t.refresh_token))throw new sf;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(s){if(da(s))return{data:{user:null,session:null},error:s};throw s}}async _getSessionFromURL(t,s){try{if(!qu())throw new oO("No browser detected.");if(t.error||t.error_description||t.error_code)throw new oO(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(s){case"implicit":if(this.flowType==="pkce")throw new jke("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new oO("Not a valid implicit grant flow url.");break;default:}if(s==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new jke("No code detected.");const{data:T,error:P}=await this._exchangeCodeForSession(t.code);if(P)throw P;const R=new URL(window.location.href);return R.searchParams.delete("code"),window.history.replaceState(window.history.state,"",R.toString()),{data:{session:T.session,redirectType:null},error:null}}const{provider_token:n,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 oO("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<=U4&&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 E={provider_token:n,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:E,redirectType:t.type},error:null}}catch(n){if(da(n))return{data:{session:null,redirectType:null},error:n};throw n}}_isImplicitGrantCallback(t){return!!(t.access_token||t.error_description)}async _isPKCECallback(t){const s=await T_(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&s)}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 s=>{var n;const{data:a,error:o}=s;if(o)return{error:o};const l=(n=a.session)===null||n===void 0?void 0:n.access_token;if(l){const{error:i}=await this.admin.signOut(l,t);if(i&&!(Hnt(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 s=eat(),n={id:s,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",s),this.stateChangeEmitters.delete(s)}};return this._debug("#onAuthStateChange()","registered callback with id",s),this.stateChangeEmitters.set(s,n),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(s)})))(),{data:{subscription:n}}}async _emitInitialSession(t){return await this._useSession(async s=>{var n,a;try{const{data:{session:o},error:l}=s;if(l)throw l;await((n=this.stateChangeEmitters.get(t))===null||n===void 0?void 0:n.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,s={}){let n=null,a=null;this.flowType==="pkce"&&([n,a]=await k4(this.storage,this.storageKey,!0));try{return await $a(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:n,code_challenge_method:a,gotrue_meta_security:{captcha_token:s.captchaToken}},headers:this.headers,redirectTo:s.redirectTo})}catch(o){if(da(o))return{data:null,error:o};throw o}}async getUserIdentities(){var t;try{const{data:s,error:n}=await this.getUser();if(n)throw n;return{data:{identities:(t=s.user.identities)!==null&&t!==void 0?t:[]},error:null}}catch(s){if(da(s))return{data:null,error:s};throw s}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var s;try{const{data:n,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 $a(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 qu()&&!(!((s=t.options)===null||s===void 0)&&s.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),{data:{provider:t.provider,url:n==null?void 0:n.url},error:null}}catch(n){if(da(n))return{data:{provider:t.provider,url:null},error:n};throw n}}async linkIdentityIdToken(t){return await this._useSession(async s=>{var n;try{const{error:a,data:{session:o}}=s;if(a)throw a;const{options:l,provider:i,token:u,access_token:m,nonce:x}=t,y=await $a(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=o==null?void 0:o.access_token)!==null&&n!==void 0?n: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:nf}),{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 j4}:(v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("USER_UPDATED",v.session)),{data:v,error:b})}catch(a){if(da(a))return{data:{user:null,session:null},error:a};throw a}})}async unlinkIdentity(t){try{return await this._useSession(async s=>{var n,a;const{data:o,error:l}=s;if(l)throw l;return await $a(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(a=(n=o.session)===null||n===void 0?void 0:n.access_token)!==null&&a!==void 0?a:void 0})})}catch(s){if(da(s))return{data:null,error:s};throw s}}async _refreshAccessToken(t){const s=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(s,"begin");try{const n=Date.now();return await nat(async a=>(a>0&&await sat(200*Math.pow(2,a-1)),this._debug(s,"refreshing attempt",a),await $a(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:nf})),(a,o)=>{const l=200*Math.pow(2,a);return o&&Ece(o)&&Date.now()+l-n{try{await i.callback(t,s)}catch(u){o.push(u)}});if(await Promise.all(l),o.length>0){for(let i=0;ithis._autoRefreshTokenTick(),U4);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 s=>{const{data:{session:n}}=s;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const a=Math.floor((n.expires_at*1e3-t)/U4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${a} ticks, a tick lasts ${U4}ms, refresh threshold is ${rme} ticks`),a<=rme&&await this._callRefreshToken(n.refresh_token)})}catch(s){console.error("Auto refresh tick failed with error. This is likely a transient error.",s)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t.isAcquireTimeout||t instanceof Q6e)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!qu()||!(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 s=`#_onVisibilityChanged(${t})`;this._debug(s,"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(s,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(t,s,n){const a=[`provider=${encodeURIComponent(s)}`];if(n!=null&&n.redirectTo&&a.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&a.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[o,l]=await k4(this.storage,this.storageKey),i=new URLSearchParams({code_challenge:`${encodeURIComponent(o)}`,code_challenge_method:`${encodeURIComponent(l)}`});a.push(i.toString())}if(n!=null&&n.queryParams){const o=new URLSearchParams(n.queryParams);a.push(o.toString())}return n!=null&&n.skipBrowserRedirect&&a.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${t}?${a.join("&")}`}async _unenroll(t){try{return await this._useSession(async s=>{var n;const{data:a,error:o}=s;return o?{data:null,error:o}:await $a(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(n=a==null?void 0:a.session)===null||n===void 0?void 0:n.access_token})})}catch(s){if(da(s))return{data:null,error:s};throw s}}async _enroll(t){try{return await this._useSession(async s=>{var n,a;const{data:o,error:l}=s;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 $a(this.fetch,"POST",`${this.url}/factors`,{body:i,headers:this.headers,jwt:(n=o==null?void 0:o.session)===null||n===void 0?void 0:n.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(s){if(da(s))return{data:null,error:s};throw s}}async _verify(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async s=>{var n;const{data:a,error:o}=s;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"?Lat(t.webauthn.credential_response):Oat(t.webauthn.credential_response)})}:{code:t.code}),{data:i,error:u}=await $a(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:l,headers:this.headers,jwt:(n=a==null?void 0:a.session)===null||n===void 0?void 0:n.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(s){if(da(s))return{data:null,error:s};throw s}})}async _challenge(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async s=>{var n;const{data:a,error:o}=s;if(o)return{data:null,error:o};const l=await $a(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(n=a==null?void 0:a.session)===null||n===void 0?void 0:n.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:Iat(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:Pat(i.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(s){if(da(s))return{data:null,error:s};throw s}})}async _challengeAndVerify(t){const{data:s,error:n}=await this._challenge({factorId:t.factorId});return n?{data:null,error:n}:await this._verify({factorId:t.factorId,challengeId:s.id,code:t.code})}async _listFactors(){var t;const{data:{user:s},error:n}=await this.getUser();if(n)return{data:null,error:n};const a={all:[],phone:[],totp:[],webauthn:[]};for(const o of(t=s==null?void 0:s.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,s;const{data:{session:n},error:a}=await this.getSession();if(a)return{data:null,error:a};if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=Ice(n.access_token);let l=null;o.aal&&(l=o.aal);let i=l;((s=(t=n.user.factors)===null||t===void 0?void 0:t.filter(x=>x.status==="verified"))!==null&&s!==void 0?s:[]).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 s=>{const{data:{session:n},error:a}=s;return a?{data:null,error:a}:n?await $a(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:n.access_token,xform:o=>({data:o,error:null})}):{data:null,error:new sf}})}catch(s){if(da(s))return{data:null,error:s};throw s}}async _approveAuthorization(t,s){try{return await this._useSession(async n=>{const{data:{session:a},error:o}=n;if(o)return{data:null,error:o};if(!a)return{data:null,error:new sf};const l=await $a(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&&qu()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(l.data.redirect_url),l})}catch(n){if(da(n))return{data:null,error:n};throw n}}async _denyAuthorization(t,s){try{return await this._useSession(async n=>{const{data:{session:a},error:o}=n;if(o)return{data:null,error:o};if(!a)return{data:null,error:new sf};const l=await $a(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&&qu()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(l.data.redirect_url),l})}catch(n){if(da(n))return{data:null,error:n};throw n}}async fetchJwk(t,s={keys:[]}){let n=s.keys.find(i=>i.kid===t);if(n)return n;const a=Date.now();if(n=this.jwks.keys.find(i=>i.kid===t),n&&this.jwks_cached_at+qnt>a)return n;const{data:o,error:l}=await $a(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,n=o.keys.find(i=>i.kid===t),!n)?null:n}async getClaims(t,s={}){try{let n=t;if(!n){const{data:b,error:N}=await this.getSession();if(N||!b.session)return{data:null,error:N};n=b.session.access_token}const{header:a,payload:o,signature:l,raw:{header:i,payload:u}}=Ice(n);s!=null&&s.allowExpired||uat(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,s!=null&&s.keys?{keys:s.keys}:s==null?void 0:s.jwks);if(!m){const{error:b}=await this.getUser(n);if(b)throw b;return{data:{claims:o,header:a,signature:l},error:null}}const x=hat(a.alg),y=await crypto.subtle.importKey("jwk",m,x,!0,["verify"]);if(!await crypto.subtle.verify(x,y,l,Qnt(`${i}.${u}`)))throw new ame("Invalid JWT signature");return{data:{claims:o,header:a,signature:l},error:null}}catch(n){if(da(n))return{data:null,error:n};throw n}}}OE.nextInstanceID=0;const Vat=OE;class Hat extends Vat{constructor(t){super(t)}}class Wat{constructor(t,s,n){var a,o,l;this.supabaseUrl=t,this.supabaseKey=s;const i=Fnt(t);if(!s)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:Ant,realtime:Int,auth:Object.assign(Object.assign({},Ent),{storageKey:u}),global:Tnt},x=Rnt(n??{},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=Ont(s,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 zst(new URL("rest/v1",i).href,{headers:this.headers,schema:x.db.schema,fetch:this.fetch}),this.storage=new Snt(this.storageUrl.href,this.headers,this.fetch,n==null?void 0:n.storage),x.accessToken||this._listenForAuthEvents()}get functions(){return new Est(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,s={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,s,n)}channel(t,s={config:{}}){return this.realtime.channel(t,s)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t,s;if(this.accessToken)return await this.accessToken();const{data:n}=await this.auth.getSession();return(s=(t=n.session)===null||t===void 0?void 0:t.access_token)!==null&&s!==void 0?s:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:s,detectSessionInUrl:n,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 Hat({url:this.authUrl.href,headers:Object.assign(Object.assign({},v),x),storageKey:l,autoRefreshToken:t,persistSession:s,detectSessionInUrl:n,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 rnt(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((s,n)=>{this._handleTokenChanged(s,"CLIENT",n==null?void 0:n.access_token)})}_handleTokenChanged(t,s,n){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),s=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const Gat=(e,t,s)=>new Wat(e,t,s);function Kat(){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}Kat()&&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 Zat="https://relzejiswnotikjgvjhz.supabase.co",Yat="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJlbHplamlzd25vdGlramd2amh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE5NTAzNDQsImV4cCI6MjA3NzUyNjM0NH0.dzIkIr_oFSbFE3oWS0ktIr83iKHHkZxt40Gc7SpC_mM",Y=Gat(Zat,Yat,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),tLe=A.createContext(void 0),Xat=({children:e})=>{const[t,s]=A.useState(null),[n,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),E=Hs(),T=async U=>{try{console.log("Checking roles via RPC for user:",U);const[{data:q,error:H},{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(H||Q)console.error("Role RPC errors:",{isAdminError:H,isBrokerError:Q}),u(!1),x(!1);else{const he=!!q,se=!!G;console.log("RPC roles result:",{adminValue:he,brokerValue:se}),u(he),x(se)}const{data:ne,error:ie}=await Y.from("profiles").select("brokerage_id").eq("id",U).single();if(v(!ie&&ne?ne.brokerage_id:null),G){console.log("Fetching managed brokerages for user:",U);const{data:he,error:se}=await Y.from("brokerage_manager_assignments").select("brokerage_id").eq("user_id",U);if(console.log("Managed brokerage assignments result:",{assignments:he,assignmentsError:se}),se||!he){console.error("Error fetching managed brokerage assignments:",se),N([]);return}const fe=Array.from(new Set(he.map(xe=>xe.brokerage_id).filter(Boolean)));if(fe.length===0){N([]);return}const{data:oe,error:ce}=await Y.from("brokerages").select("id, name").in("id",fe);if(console.log("Managed brokerages details result:",{brokeragesData:oe,brokeragesError:ce}),ce||!oe){console.error("Error fetching managed brokerages details:",ce),N([]);return}const de=oe.map(xe=>({id:xe.id,name:xe.name})).sort((xe,Me)=>fe.indexOf(xe.id)-fe.indexOf(Me.id));console.log("Parsed managed brokerages:",de),N(de),de.length>0&&!k&&M(de[0].id)}else console.log("User is not a brokerage manager, skipping managed brokerages fetch"),N([])}catch(q){console.error("Unexpected error in checkRoles:",q),u(!1),x(!1),v(null),N([])}};A.useEffect(()=>{const{data:{subscription:U}}=Y.auth.onAuthStateChange((q,H)=>{console.log("Auth event:",q),a(H),s((H==null?void 0:H.user)??null),q==="PASSWORD_RECOVERY"&&(console.log("Password recovery detected, redirecting to profile"),setTimeout(()=>{E("/profile?reset=true")},100)),H!=null&&H.user?setTimeout(()=>{T(H.user.id)},0):(u(!1),x(!1),v(null),N([]),M(null))});return Y.auth.getSession().then(({data:{session:q}})=>{a(q),s((q==null?void 0:q.user)??null),q!=null&&q.user?T(q.user.id).finally(()=>{l(!1)}):l(!1)}),()=>U.unsubscribe()},[]);const P=async(U,q)=>{const{error:H}=await Y.auth.signInWithPassword({email:U,password:q});if(H)throw Te.error(H.message),H;Te.success("Welcome back!"),E("/dashboard")},R=async(U,q,H)=>{const G=`${window.location.origin}/dashboard`,{error:Q}=await Y.auth.signUp({email:U,password:q,options:{emailRedirectTo:G,data:{name:H}}});if(Q)throw Te.error(Q.message),Q;Te.success("Account created! Welcome to LevelUp."),E("/dashboard")},D=async()=>{try{const{data:{session:U}}=await Y.auth.getSession();if(U){const{error:q}=await Y.auth.signOut();q?q.message==="Auth session missing!"?console.warn("Sign out warning (ignored):",q.message):(console.error("Sign out error:",q),Te.error(q.message)):Te.success("Signed out successfully")}else console.log("No active session found, redirecting to auth");s(null),a(null),u(!1),x(!1),v(null),N([]),M(null),E("/auth")}catch(U){console.error("Unexpected sign out error:",U),E("/auth")}};return r.jsx(tLe.Provider,{value:{user:t,session:n,loading:o,signIn:P,signUp:R,signOut:D,isAdmin:i,isBrokerageManager:m,brokerageId:y,managedBrokerages:b,selectedBrokerageId:k,setSelectedBrokerageId:M},children:e})},Yr=()=>{const e=A.useContext(tLe);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e},rLe=A.createContext(void 0),A_="levelup_admin_session",z0="levelup_impersonation",Qat=({children:e})=>{const[t,s]=A.useState(!1),[n,a]=A.useState(null),[o,l]=A.useState(!1);A.useEffect(()=>{const m=sessionStorage.getItem(z0);if(m)try{const x=JSON.parse(m);s(!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 Te.error("No active session found"),!1;const y={access_token:x.access_token,refresh_token:x.refresh_token};sessionStorage.setItem(A_,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(A_),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(A_),sessionStorage.removeItem(z0),new Error("Failed to establish impersonation session")}return s(!0),a(N),Te.success(`Now viewing as ${N.name}`),window.location.href="/dashboard",!0}catch(x){return console.error("Impersonation error:",x),Te.error(x.message||"Failed to impersonate user"),sessionStorage.removeItem(A_),sessionStorage.removeItem(z0),!1}finally{l(!1)}},u=async()=>{l(!0);try{const m=sessionStorage.getItem(A_);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(A_),sessionStorage.removeItem(z0),y){console.error("Failed to restore admin session:",y),Te.error("Admin session expired, please sign in again"),window.location.href="/auth";return}s(!1),a(null),Te.success("Returned to admin account"),window.location.href="/admin/members"}catch(m){console.error("Stop impersonation error:",m),Te.error("Failed to restore admin session"),sessionStorage.removeItem(A_),sessionStorage.removeItem(z0),window.location.href="/auth"}finally{l(!1)}};return r.jsx(rLe.Provider,{value:{isImpersonating:t,impersonatedUser:n,startImpersonation:i,stopImpersonation:u,isLoading:o},children:e})},Fxe=()=>{const e=A.useContext(rLe);if(e===void 0)throw new Error("useImpersonation must be used within an ImpersonationProvider");return e},DE=j3("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:s,asChild:n=!1,...a},o)=>{const l=n?sxe:"button";return r.jsx(l,{className:Ut(DE({variant:t,size:s,className:e})),ref:o,...a})});X.displayName="Button";const Jat=()=>{const{isImpersonating:e,impersonatedUser:t,stopImpersonation:s,isLoading:n}=Fxe();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(Zu,{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:s,disabled:n,className:"bg-amber-100 hover:bg-amber-200 text-amber-950 border-0",children:n?r.jsx(Vr,{className:"h-4 w-4 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(en,{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"})]})})]})})},sLe=A.createContext(void 0),cT="levelup_acting_as",eit=({children:e})=>{const{user:t}=Yr(),[s,n]=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)){n(!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){n(!1),o([]),i(null),m({}),y(!1);return}n(!0);const{data:E,error:T}=await Y.from("agent_assistant_assignments").select("agent_id, permissions").eq("assistant_id",t.id);if(T||!E||E.length===0){o([]),y(!1);return}const P=E.map(q=>q.agent_id),{data:R}=await Y.from("profiles").select("id, name, email, avatar_url").in("id",P),D=(R||[]).map(q=>({id:q.id,name:q.name||q.email||"Unknown",email:q.email||"",avatar_url:q.avatar_url}));o(D);const U=sessionStorage.getItem(cT);if(U){const q=D.find(H=>H.id===U);if(q){i(q);const H=E.find(G=>G.agent_id===U);m((H==null?void 0:H.permissions)||{})}else if(D.length>0){i(D[0]);const H=E.find(G=>G.agent_id===D[0].id);m((H==null?void 0:H.permissions)||{}),sessionStorage.setItem(cT,D[0].id)}}else if(D.length>0){i(D[0]);const q=E.find(H=>H.agent_id===D[0].id);m((q==null?void 0:q.permissions)||{}),sessionStorage.setItem(cT,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(cT,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(cT),m({}))},b=k=>s?u[k]===!0:!0,N=s&&l?l.id:(t==null?void 0:t.id)||null;return r.jsx(sLe.Provider,{value:{isAssistant:s,assignedAgents:a,actingAsAgent:l,setActingAsAgent:v,effectiveUserId:N,permissions:u,hasPermission:b,isLoading:x},children:e})},zxe=()=>{const e=A.useContext(sLe);if(e===void 0)throw new Error("useActingAs must be used within an ActingAsProvider");return e},Pc=()=>{const{effectiveUserId:e}=zxe();return e};var nLe={exports:{}},aLe={};/** * @license React * use-sync-external-store-shim.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var LC=A;function tit(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var rit=typeof Object.is=="function"?Object.is:tit,sit=LC.useState,nit=LC.useEffect,ait=LC.useLayoutEffect,iit=LC.useDebugValue;function oit(e,t){var s=t(),n=sit({inst:{value:s,getSnapshot:t}}),a=n[0].inst,o=n[1];return ait(function(){a.value=s,a.getSnapshot=t,Oce(a)&&o({inst:a})},[e,s,t]),nit(function(){return Oce(a)&&o({inst:a}),e(function(){Oce(a)&&o({inst:a})})},[e]),iit(s),s}function Oce(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!rit(e,s)}catch{return!0}}function lit(e,t){return t()}var cit=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?lit:oit;aLe.useSyncExternalStore=LC.useSyncExternalStore!==void 0?LC.useSyncExternalStore:cit;nLe.exports=aLe;var dit=nLe.exports;function uit(){return dit.useSyncExternalStore(hit,()=>!0,()=>!1)}function hit(){return()=>{}}var Bxe="Avatar",[mit]=uc(Bxe),[pit,iLe]=mit(Bxe),oLe=A.forwardRef((e,t)=>{const{__scopeAvatar:s,...n}=e,[a,o]=A.useState("idle");return r.jsx(pit,{scope:s,imageLoadingStatus:a,onImageLoadingStatusChange:o,children:r.jsx($s.span,{...n,ref:t})})});oLe.displayName=Bxe;var lLe="AvatarImage",cLe=A.forwardRef((e,t)=>{const{__scopeAvatar:s,src:n,onLoadingStatusChange:a=()=>{},...o}=e,l=iLe(lLe,s),i=fit(n,o),u=ac(m=>{a(m),l.onImageLoadingStatusChange(m)});return cc(()=>{i!=="idle"&&u(i)},[i,u]),i==="loaded"?r.jsx($s.img,{...o,ref:t,src:n}):null});cLe.displayName=lLe;var dLe="AvatarFallback",uLe=A.forwardRef((e,t)=>{const{__scopeAvatar:s,delayMs:n,...a}=e,o=iLe(dLe,s),[l,i]=A.useState(n===void 0);return A.useEffect(()=>{if(n!==void 0){const u=window.setTimeout(()=>i(!0),n);return()=>window.clearTimeout(u)}},[n]),l&&o.imageLoadingStatus!=="loaded"?r.jsx($s.span,{...a,ref:t}):null});uLe.displayName=dLe;function Oke(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function fit(e,{referrerPolicy:t,crossOrigin:s}){const n=uit(),a=A.useRef(null),o=n?(a.current||(a.current=new window.Image),a.current):null,[l,i]=A.useState(()=>Oke(o,e));return cc(()=>{i(Oke(o,e))},[o,e]),cc(()=>{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 s=="string"&&(o.crossOrigin=s),()=>{o.removeEventListener("load",m),o.removeEventListener("error",x)}},[o,s,t]),l}var hLe=oLe,mLe=cLe,pLe=uLe;const Xn=A.forwardRef(({className:e,...t},s)=>r.jsx(hLe,{ref:s,className:Ut("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));Xn.displayName=hLe.displayName;const ji=A.forwardRef(({className:e,...t},s)=>r.jsx(mLe,{ref:s,className:Ut("aspect-square h-full w-full",e),...t}));ji.displayName=mLe.displayName;const Qn=A.forwardRef(({className:e,...t},s)=>r.jsx(pLe,{ref:s,className:Ut("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));Qn.displayName=pLe.displayName;const git=j3("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,...s}){return r.jsx("div",{className:Ut(git({variant:t}),e),...s})}var xit=A.createContext(void 0);function Ik(e){const t=A.useContext(xit);return e||t||"ltr"}var Dce=0;function Tne(){A.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Dke()),document.body.insertAdjacentElement("beforeend",e[1]??Dke()),Dce++,()=>{Dce===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Dce--}},[])}function Dke(){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 Rce="focusScope.autoFocusOnMount",Fce="focusScope.autoFocusOnUnmount",Rke={bubbles:!1,cancelable:!0},yit="FocusScope",aP=A.forwardRef((e,t)=>{const{loop:s=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...l}=e,[i,u]=A.useState(null),m=ac(a),x=ac(o),y=A.useRef(null),v=ha(t,k=>u(k)),b=A.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;A.useEffect(()=>{if(n){let k=function(P){if(b.paused||!i)return;const R=P.target;i.contains(R)?y.current=R:q0(y.current,{select:!0})},M=function(P){if(b.paused||!i)return;const R=P.relatedTarget;R!==null&&(i.contains(R)||q0(y.current,{select:!0}))},E=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(E);return i&&T.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",k),document.removeEventListener("focusout",M),T.disconnect()}}},[n,i,b.paused]),A.useEffect(()=>{if(i){zke.add(b);const k=document.activeElement;if(!i.contains(k)){const E=new CustomEvent(Rce,Rke);i.addEventListener(Rce,m),i.dispatchEvent(E),E.defaultPrevented||(vit(kit(fLe(i)),{select:!0}),document.activeElement===k&&q0(i))}return()=>{i.removeEventListener(Rce,m),setTimeout(()=>{const E=new CustomEvent(Fce,Rke);i.addEventListener(Fce,x),i.dispatchEvent(E),E.defaultPrevented||q0(k??document.body,{select:!0}),i.removeEventListener(Fce,x),zke.remove(b)},0)}}},[i,m,x,b]);const N=A.useCallback(k=>{if(!s&&!n||b.paused)return;const M=k.key==="Tab"&&!k.altKey&&!k.ctrlKey&&!k.metaKey,E=document.activeElement;if(M&&E){const T=k.currentTarget,[P,R]=_it(T);P&&R?!k.shiftKey&&E===R?(k.preventDefault(),s&&q0(P,{select:!0})):k.shiftKey&&E===P&&(k.preventDefault(),s&&q0(R,{select:!0})):E===T&&k.preventDefault()}},[s,n,b.paused]);return r.jsx($s.div,{tabIndex:-1,...l,ref:v,onKeyDown:N})});aP.displayName=yit;function vit(e,{select:t=!1}={}){const s=document.activeElement;for(const n of e)if(q0(n,{select:t}),document.activeElement!==s)return}function _it(e){const t=fLe(e),s=Fke(t,e),n=Fke(t.reverse(),e);return[s,n]}function fLe(e){const t=[],s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;s.nextNode();)t.push(s.currentNode);return t}function Fke(e,t){for(const s of e)if(!bit(s,{upTo:t}))return s}function bit(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 wit(e){return e instanceof HTMLInputElement&&"select"in e}function q0(e,{select:t=!1}={}){if(e&&e.focus){const s=document.activeElement;e.focus({preventScroll:!0}),e!==s&&wit(e)&&t&&e.select()}}var zke=jit();function jit(){let e=[];return{add(t){const s=e[0];t!==s&&(s==null||s.pause()),e=Bke(e,t),e.unshift(t)},remove(t){var s;e=Bke(e,t),(s=e[0])==null||s.resume()}}}function Bke(e,t){const s=[...e],n=s.indexOf(t);return n!==-1&&s.splice(n,1),s}function kit(e){return e.filter(t=>t.tagName!=="A")}var zce="rovingFocusGroup.onEntryFocus",Nit={bubbles:!1,cancelable:!0},iP="RovingFocusGroup",[ime,gLe,Sit]=YI(iP),[Cit,L3]=uc(iP,[Sit]),[Mit,Tit]=Cit(iP),xLe=A.forwardRef((e,t)=>r.jsx(ime.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(ime.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Ait,{...e,ref:t})})}));xLe.displayName=iP;var Ait=A.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:s,orientation:n,loop:a=!1,dir:o,currentTabStopId:l,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:u,onEntryFocus:m,preventScrollOnEntryFocus:x=!1,...y}=e,v=A.useRef(null),b=ha(t,v),N=Ik(o),[k,M]=ah({prop:l,defaultProp:i??null,onChange:u,caller:iP}),[E,T]=A.useState(!1),P=ac(m),R=gLe(s),D=A.useRef(!1),[U,q]=A.useState(0);return A.useEffect(()=>{const H=v.current;if(H)return H.addEventListener(zce,P),()=>H.removeEventListener(zce,P)},[P]),r.jsx(Mit,{scope:s,orientation:n,dir:N,loop:a,currentTabStopId:k,onItemFocus:A.useCallback(H=>M(H),[M]),onItemShiftTab:A.useCallback(()=>T(!0),[]),onFocusableItemAdd:A.useCallback(()=>q(H=>H+1),[]),onFocusableItemRemove:A.useCallback(()=>q(H=>H-1),[]),children:r.jsx($s.div,{tabIndex:E||U===0?-1:0,"data-orientation":n,...y,ref:b,style:{outline:"none",...e.style},onMouseDown:xs(e.onMouseDown,()=>{D.current=!0}),onFocus:xs(e.onFocus,H=>{const G=!D.current;if(H.target===H.currentTarget&&G&&!E){const Q=new CustomEvent(zce,Nit);if(H.currentTarget.dispatchEvent(Q),!Q.defaultPrevented){const ne=R().filter(oe=>oe.focusable),ie=ne.find(oe=>oe.active),he=ne.find(oe=>oe.id===k),fe=[ie,he,...ne].filter(Boolean).map(oe=>oe.ref.current);_Le(fe,x)}}D.current=!1}),onBlur:xs(e.onBlur,()=>T(!1))})})}),yLe="RovingFocusGroupItem",vLe=A.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:s,focusable:n=!0,active:a=!1,tabStopId:o,children:l,...i}=e,u=yd(),m=o||u,x=Tit(yLe,s),y=x.currentTabStopId===m,v=gLe(s),{onFocusableItemAdd:b,onFocusableItemRemove:N,currentTabStopId:k}=x;return A.useEffect(()=>{if(n)return b(),()=>N()},[n,b,N]),r.jsx(ime.ItemSlot,{scope:s,id:m,focusable:n,active:a,children:r.jsx($s.span,{tabIndex:y?0:-1,"data-orientation":x.orientation,...i,ref:t,onMouseDown:xs(e.onMouseDown,M=>{n?x.onItemFocus(m):M.preventDefault()}),onFocus:xs(e.onFocus,()=>x.onItemFocus(m)),onKeyDown:xs(e.onKeyDown,M=>{if(M.key==="Tab"&&M.shiftKey){x.onItemShiftTab();return}if(M.target!==M.currentTarget)return;const E=Pit(M,x.orientation,x.dir);if(E!==void 0){if(M.metaKey||M.ctrlKey||M.altKey||M.shiftKey)return;M.preventDefault();let P=v().filter(R=>R.focusable).map(R=>R.ref.current);if(E==="last")P.reverse();else if(E==="prev"||E==="next"){E==="prev"&&P.reverse();const R=P.indexOf(M.currentTarget);P=x.loop?Lit(P,R+1):P.slice(R+1)}setTimeout(()=>_Le(P))}}),children:typeof l=="function"?l({isCurrentTabStop:y,hasTabStop:k!=null}):l})})});vLe.displayName=yLe;var Eit={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Iit(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Pit(e,t,s){const n=Iit(e.key,s);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return Eit[n]}function _Le(e,t=!1){const s=document.activeElement;for(const n of e)if(n===s||(n.focus({preventScroll:t}),document.activeElement!==s))return}function Lit(e,t){return e.map((s,n)=>e[(t+n)%e.length])}var $xe=xLe,Uxe=vLe,Oit=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},M4=new WeakMap,lO=new WeakMap,cO={},Bce=0,bLe=function(e){return e&&(e.host||bLe(e.parentNode))},Dit=function(e,t){return t.map(function(s){if(e.contains(s))return s;var n=bLe(s);return n&&e.contains(n)?n:(console.error("aria-hidden",s,"in not contained inside",e,". Doing nothing"),null)}).filter(function(s){return!!s})},Rit=function(e,t,s,n){var a=Dit(t,Array.isArray(e)?e:[e]);cO[s]||(cO[s]=new WeakMap);var o=cO[s],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(n),N=b!==null&&b!=="false",k=(M4.get(v)||0)+1,M=(o.get(v)||0)+1;M4.set(v,k),o.set(v,M),l.push(v),k===1&&N&&lO.set(v,!0),M===1&&v.setAttribute(s,"true"),N||v.setAttribute(n,"true")}catch(E){console.error("aria-hidden: cannot operate on ",v,E)}})};return x(t),i.clear(),Bce++,function(){l.forEach(function(y){var v=M4.get(y)-1,b=o.get(y)-1;M4.set(y,v),o.set(y,b),v||(lO.has(y)||y.removeAttribute(n),lO.delete(y)),b||y.removeAttribute(s)}),Bce--,Bce||(M4=new WeakMap,M4=new WeakMap,lO=new WeakMap,cO={})}},Ane=function(e,t,s){s===void 0&&(s="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=Oit(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live]"))),Rit(n,a,s,"aria-hidden")):function(){return null}},Uee="right-scroll-bar-position",qee="width-before-scroll-bar",Fit="with-scroll-bars-hidden",zit="--removed-body-scroll-bar-size";function $ce(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Bit(e,t){var s=A.useState(function(){return{value:e,callback:t,facade:{get current(){return s.value},set current(n){var a=s.value;a!==n&&(s.value=n,s.callback(n,a))}}}})[0];return s.callback=t,s.facade}var $it=typeof window<"u"?A.useLayoutEffect:A.useEffect,$ke=new WeakMap;function Uit(e,t){var s=Bit(null,function(n){return e.forEach(function(a){return $ce(a,n)})});return $it(function(){var n=$ke.get(s);if(n){var a=new Set(n),o=new Set(e),l=s.current;a.forEach(function(i){o.has(i)||$ce(i,null)}),o.forEach(function(i){a.has(i)||$ce(i,l)})}$ke.set(s,e)},[e]),s}function qit(e){return e}function Vit(e,t){t===void 0&&(t=qit);var s=[],n=!1,a={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return s.length?s[s.length-1]:e},useMedium:function(o){var l=t(o,n);return s.push(l),function(){s=s.filter(function(i){return i!==l})}},assignSyncMedium:function(o){for(n=!0;s.length;){var l=s;s=[],l.forEach(o)}s={push:function(i){return o(i)},filter:function(){return s}}},assignMedium:function(o){n=!0;var l=[];if(s.length){var i=s;s=[],i.forEach(o),l=s}var u=function(){var x=l;l=[],x.forEach(o)},m=function(){return Promise.resolve().then(u)};m(),s={push:function(x){l.push(x),m()},filter:function(x){return l=l.filter(x),s}}}};return a}function Hit(e){e===void 0&&(e={});var t=Vit(null);return t.options=ip({async:!0,ssr:!1},e),t}var wLe=function(e){var t=e.sideCar,s=Sv(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return A.createElement(n,ip({},s))};wLe.isSideCarExport=!0;function Wit(e,t){return e.useMedium(t),wLe}var jLe=Hit(),Uce=function(){},Ene=A.forwardRef(function(e,t){var s=A.useRef(null),n=A.useState({onScrollCapture:Uce,onWheelCapture:Uce,onTouchMoveCapture:Uce}),a=n[0],o=n[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,E=e.as,T=E===void 0?"div":E,P=e.gapMode,R=Sv(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),D=v,U=Uit([s,t]),q=ip(ip({},R),a);return A.createElement(A.Fragment,null,x&&A.createElement(D,{sideCar:jLe,removeScrollBar:m,shards:y,noRelative:b,noIsolation:N,inert:k,setCallbacks:o,allowPinchZoom:!!M,lockRef:s,gapMode:P}),l?A.cloneElement(A.Children.only(i),ip(ip({},q),{ref:U})):A.createElement(T,ip({},q,{className:u,ref:U}),i))});Ene.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ene.classNames={fullWidth:qee,zeroRight:Uee};var Git=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Kit(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Git();return t&&e.setAttribute("nonce",t),e}function Zit(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Yit(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Xit=function(){var e=0,t=null;return{add:function(s){e==0&&(t=Kit())&&(Zit(t,s),Yit(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Qit=function(){var e=Xit();return function(t,s){A.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&s])}},kLe=function(){var e=Qit(),t=function(s){var n=s.styles,a=s.dynamic;return e(n,a),null};return t},Jit={left:0,top:0,right:0,gap:0},qce=function(e){return parseInt(e||"",10)||0},eot=function(e){var t=window.getComputedStyle(document.body),s=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[qce(s),qce(n),qce(a)]},tot=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Jit;var t=eot(e),s=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-s+t[2]-t[0])}},rot=kLe(),YS="data-scroll-locked",sot=function(e,t,s,n){var a=e.left,o=e.top,l=e.right,i=e.gap;return s===void 0&&(s="margin"),` .`.concat(Fit,` { overflow: hidden `).concat(n,`; padding-right: `).concat(i,"px ").concat(n,`; } body[`).concat(YS,`] { overflow: hidden `).concat(n,`; overscroll-behavior: contain; `).concat([t&&"position: relative ".concat(n,";"),s==="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(n,`; `),s==="padding"&&"padding-right: ".concat(i,"px ").concat(n,";")].filter(Boolean).join(""),` } .`).concat(Uee,` { right: `).concat(i,"px ").concat(n,`; } .`).concat(qee,` { margin-right: `).concat(i,"px ").concat(n,`; } .`).concat(Uee," .").concat(Uee,` { right: 0 `).concat(n,`; } .`).concat(qee," .").concat(qee,` { margin-right: 0 `).concat(n,`; } body[`).concat(YS,`] { `).concat(zit,": ").concat(i,`px; } `)},Uke=function(){var e=parseInt(document.body.getAttribute(YS)||"0",10);return isFinite(e)?e:0},not=function(){A.useEffect(function(){return document.body.setAttribute(YS,(Uke()+1).toString()),function(){var e=Uke()-1;e<=0?document.body.removeAttribute(YS):document.body.setAttribute(YS,e.toString())}},[])},aot=function(e){var t=e.noRelative,s=e.noImportant,n=e.gapMode,a=n===void 0?"margin":n;not();var o=A.useMemo(function(){return tot(a)},[a]);return A.createElement(rot,{styles:sot(o,!t,a,s?"":"!important")})},ome=!1;if(typeof window<"u")try{var dO=Object.defineProperty({},"passive",{get:function(){return ome=!0,!0}});window.addEventListener("test",dO,dO),window.removeEventListener("test",dO,dO)}catch{ome=!1}var T4=ome?{passive:!1}:!1,iot=function(e){return e.tagName==="TEXTAREA"},NLe=function(e,t){if(!(e instanceof Element))return!1;var s=window.getComputedStyle(e);return s[t]!=="hidden"&&!(s.overflowY===s.overflowX&&!iot(e)&&s[t]==="visible")},oot=function(e){return NLe(e,"overflowY")},lot=function(e){return NLe(e,"overflowX")},qke=function(e,t){var s=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var a=SLe(e,n);if(a){var o=CLe(e,n),l=o[1],i=o[2];if(l>i)return!0}n=n.parentNode}while(n&&n!==s.body);return!1},cot=function(e){var t=e.scrollTop,s=e.scrollHeight,n=e.clientHeight;return[t,s,n]},dot=function(e){var t=e.scrollLeft,s=e.scrollWidth,n=e.clientWidth;return[t,s,n]},SLe=function(e,t){return e==="v"?oot(t):lot(t)},CLe=function(e,t){return e==="v"?cot(t):dot(t)},uot=function(e,t){return e==="h"&&t==="rtl"?-1:1},hot=function(e,t,s,n,a){var o=uot(e,window.getComputedStyle(t).direction),l=o*n,i=s.target,u=t.contains(i),m=!1,x=l>0,y=0,v=0;do{if(!i)break;var b=CLe(e,i),N=b[0],k=b[1],M=b[2],E=k-M-o*N;(N||E)&&SLe(e,i)&&(y+=E,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},uO=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Vke=function(e){return[e.deltaX,e.deltaY]},Hke=function(e){return e&&"current"in e?e.current:e},mot=function(e,t){return e[0]===t[0]&&e[1]===t[1]},pot=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},fot=0,A4=[];function got(e){var t=A.useRef([]),s=A.useRef([0,0]),n=A.useRef(),a=A.useState(fot++)[0],o=A.useState(kLe)[0],l=A.useRef(e);A.useEffect(function(){l.current=e},[e]),A.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var k=Txe([e.lockRef.current],(e.shards||[]).map(Hke),!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 E=uO(k),T=s.current,P="deltaX"in k?k.deltaX:T[0]-E[0],R="deltaY"in k?k.deltaY:T[1]-E[1],D,U=k.target,q=Math.abs(P)>Math.abs(R)?"h":"v";if("touches"in k&&q==="h"&&U.type==="range")return!1;var H=qke(q,U);if(!H)return!0;if(H?D=q:(D=q==="v"?"h":"v",H=qke(q,U)),!H)return!1;if(!n.current&&"changedTouches"in k&&(P||R)&&(n.current=D),!D)return!0;var G=n.current||D;return hot(G,M,k,G==="h"?P:R)},[]),u=A.useCallback(function(k){var M=k;if(!(!A4.length||A4[A4.length-1]!==o)){var E="deltaY"in M?Vke(M):uO(M),T=t.current.filter(function(D){return D.name===M.type&&(D.target===M.target||M.target===D.shadowParent)&&mot(D.delta,E)})[0];if(T&&T.should){M.cancelable&&M.preventDefault();return}if(!T){var P=(l.current.shards||[]).map(Hke).filter(Boolean).filter(function(D){return D.contains(M.target)}),R=P.length>0?i(M,P[0]):!l.current.noIsolation;R&&M.cancelable&&M.preventDefault()}}},[]),m=A.useCallback(function(k,M,E,T){var P={name:k,delta:M,target:E,should:T,shadowParent:xot(E)};t.current.push(P),setTimeout(function(){t.current=t.current.filter(function(R){return R!==P})},1)},[]),x=A.useCallback(function(k){s.current=uO(k),n.current=void 0},[]),y=A.useCallback(function(k){m(k.type,Vke(k),k.target,i(k,e.lockRef.current))},[]),v=A.useCallback(function(k){m(k.type,uO(k),k.target,i(k,e.lockRef.current))},[]);A.useEffect(function(){return A4.push(o),e.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:v}),document.addEventListener("wheel",u,T4),document.addEventListener("touchmove",u,T4),document.addEventListener("touchstart",x,T4),function(){A4=A4.filter(function(k){return k!==o}),document.removeEventListener("wheel",u,T4),document.removeEventListener("touchmove",u,T4),document.removeEventListener("touchstart",x,T4)}},[]);var b=e.removeScrollBar,N=e.inert;return A.createElement(A.Fragment,null,N?A.createElement(o,{styles:pot(a)}):null,b?A.createElement(aot,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function xot(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const yot=Wit(jLe,got);var oP=A.forwardRef(function(e,t){return A.createElement(Ene,ip({},e,{ref:t,sideCar:yot}))});oP.classNames=Ene.classNames;var lme=["Enter"," "],vot=["ArrowDown","PageUp","Home"],MLe=["ArrowUp","PageDown","End"],_ot=[...vot,...MLe],bot={ltr:[...lme,"ArrowRight"],rtl:[...lme,"ArrowLeft"]},wot={ltr:["ArrowLeft"],rtl:["ArrowRight"]},lP="Menu",[RE,jot,kot]=YI(lP),[Pk,TLe]=uc(lP,[kot,ix,L3]),Ine=ix(),ALe=L3(),[Not,Lk]=Pk(lP),[Sot,cP]=Pk(lP),ELe=e=>{const{__scopeMenu:t,open:s=!1,children:n,dir:a,onOpenChange:o,modal:l=!0}=e,i=Ine(t),[u,m]=A.useState(null),x=A.useRef(!1),y=ac(o),v=Ik(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(eP,{...i,children:r.jsx(Not,{scope:t,open:s,onOpenChange:y,content:u,onContentChange:m,children:r.jsx(Sot,{scope:t,onClose:A.useCallback(()=>y(!1),[y]),isUsingKeyboardRef:x,dir:v,modal:l,children:n})})})};ELe.displayName=lP;var Cot="MenuAnchor",qxe=A.forwardRef((e,t)=>{const{__scopeMenu:s,...n}=e,a=Ine(s);return r.jsx(C3,{...a,...n,ref:t})});qxe.displayName=Cot;var Vxe="MenuPortal",[Mot,ILe]=Pk(Vxe,{forceMount:void 0}),PLe=e=>{const{__scopeMenu:t,forceMount:s,children:n,container:a}=e,o=Lk(Vxe,t);return r.jsx(Mot,{scope:t,forceMount:s,children:r.jsx(Ec,{present:s||o.open,children:r.jsx(w3,{asChild:!0,container:a,children:n})})})};PLe.displayName=Vxe;var gp="MenuContent",[Tot,Hxe]=Pk(gp),LLe=A.forwardRef((e,t)=>{const s=ILe(gp,e.__scopeMenu),{forceMount:n=s.forceMount,...a}=e,o=Lk(gp,e.__scopeMenu),l=cP(gp,e.__scopeMenu);return r.jsx(RE.Provider,{scope:e.__scopeMenu,children:r.jsx(Ec,{present:n||o.open,children:r.jsx(RE.Slot,{scope:e.__scopeMenu,children:l.modal?r.jsx(Aot,{...a,ref:t}):r.jsx(Eot,{...a,ref:t})})})})}),Aot=A.forwardRef((e,t)=>{const s=Lk(gp,e.__scopeMenu),n=A.useRef(null),a=ha(t,n);return A.useEffect(()=>{const o=n.current;if(o)return Ane(o)},[]),r.jsx(Wxe,{...e,ref:a,trapFocus:s.open,disableOutsidePointerEvents:s.open,disableOutsideScroll:!0,onFocusOutside:xs(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>s.onOpenChange(!1)})}),Eot=A.forwardRef((e,t)=>{const s=Lk(gp,e.__scopeMenu);return r.jsx(Wxe,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>s.onOpenChange(!1)})}),Iot=mv("MenuContent.ScrollLock"),Wxe=A.forwardRef((e,t)=>{const{__scopeMenu:s,loop:n=!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=Lk(gp,s),E=cP(gp,s),T=Ine(s),P=ALe(s),R=jot(s),[D,U]=A.useState(null),q=A.useRef(null),H=ha(t,q,M.onContentChange),G=A.useRef(0),Q=A.useRef(""),ne=A.useRef(0),ie=A.useRef(null),he=A.useRef("right"),se=A.useRef(0),fe=N?oP:A.Fragment,oe=N?{as:Iot,allowPinchZoom:!0}:void 0,ce=xe=>{var Ue,Pe;const Me=Q.current+xe,ve=R().filter($e=>!$e.disabled),be=document.activeElement,we=(Ue=ve.find($e=>$e.ref.current===be))==null?void 0:Ue.textValue,tt=ve.map($e=>$e.textValue),Ae=Vot(tt,Me,we),Le=(Pe=ve.find($e=>$e.textValue===Ae))==null?void 0:Pe.ref.current;(function $e(it){Q.current=it,window.clearTimeout(G.current),it!==""&&(G.current=window.setTimeout(()=>$e(""),1e3))})(Me),Le&&setTimeout(()=>Le.focus())};A.useEffect(()=>()=>window.clearTimeout(G.current),[]),Tne();const de=A.useCallback(xe=>{var ve,be;return he.current===((ve=ie.current)==null?void 0:ve.side)&&Wot(xe,(be=ie.current)==null?void 0:be.area)},[]);return r.jsx(Tot,{scope:s,searchRef:Q,onItemEnter:A.useCallback(xe=>{de(xe)&&xe.preventDefault()},[de]),onItemLeave:A.useCallback(xe=>{var Me;de(xe)||((Me=q.current)==null||Me.focus(),U(null))},[de]),onTriggerLeave:A.useCallback(xe=>{de(xe)&&xe.preventDefault()},[de]),pointerGraceTimerRef:ne,onPointerGraceIntentChange:A.useCallback(xe=>{ie.current=xe},[]),children:r.jsx(fe,{...oe,children:r.jsx(aP,{asChild:!0,trapped:a,onMountAutoFocus:xs(o,xe=>{var Me;xe.preventDefault(),(Me=q.current)==null||Me.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:r.jsx(kv,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:m,onPointerDownOutside:x,onFocusOutside:y,onInteractOutside:v,onDismiss:b,children:r.jsx($xe,{asChild:!0,...P,dir:E.dir,orientation:"vertical",loop:n,currentTabStopId:D,onCurrentTabStopIdChange:U,onEntryFocus:xs(u,xe=>{E.isUsingKeyboardRef.current||xe.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(tP,{role:"menu","aria-orientation":"vertical","data-state":YLe(M.open),"data-radix-menu-content":"",dir:E.dir,...T,...k,ref:H,style:{outline:"none",...k.style},onKeyDown:xs(k.onKeyDown,xe=>{const ve=xe.target.closest("[data-radix-menu-content]")===xe.currentTarget,be=xe.ctrlKey||xe.altKey||xe.metaKey,we=xe.key.length===1;ve&&(xe.key==="Tab"&&xe.preventDefault(),!be&&we&&ce(xe.key));const tt=q.current;if(xe.target!==tt||!_ot.includes(xe.key))return;xe.preventDefault();const Le=R().filter(Ue=>!Ue.disabled).map(Ue=>Ue.ref.current);MLe.includes(xe.key)&&Le.reverse(),Uot(Le)}),onBlur:xs(e.onBlur,xe=>{xe.currentTarget.contains(xe.target)||(window.clearTimeout(G.current),Q.current="")}),onPointerMove:xs(e.onPointerMove,FE(xe=>{const Me=xe.target,ve=se.current!==xe.clientX;if(xe.currentTarget.contains(Me)&&ve){const be=xe.clientX>se.current?"right":"left";he.current=be,se.current=xe.clientX}}))})})})})})})});LLe.displayName=gp;var Pot="MenuGroup",Gxe=A.forwardRef((e,t)=>{const{__scopeMenu:s,...n}=e;return r.jsx($s.div,{role:"group",...n,ref:t})});Gxe.displayName=Pot;var Lot="MenuLabel",OLe=A.forwardRef((e,t)=>{const{__scopeMenu:s,...n}=e;return r.jsx($s.div,{...n,ref:t})});OLe.displayName=Lot;var Bte="MenuItem",Wke="menu.itemSelect",Pne=A.forwardRef((e,t)=>{const{disabled:s=!1,onSelect:n,...a}=e,o=A.useRef(null),l=cP(Bte,e.__scopeMenu),i=Hxe(Bte,e.__scopeMenu),u=ha(t,o),m=A.useRef(!1),x=()=>{const y=o.current;if(!s&&y){const v=new CustomEvent(Wke,{bubbles:!0,cancelable:!0});y.addEventListener(Wke,b=>n==null?void 0:n(b),{once:!0}),nxe(y,v),v.defaultPrevented?m.current=!1:l.onClose()}};return r.jsx(DLe,{...a,ref:u,disabled:s,onClick:xs(e.onClick,x),onPointerDown:y=>{var v;(v=e.onPointerDown)==null||v.call(e,y),m.current=!0},onPointerUp:xs(e.onPointerUp,y=>{var v;m.current||(v=y.currentTarget)==null||v.click()}),onKeyDown:xs(e.onKeyDown,y=>{const v=i.searchRef.current!=="";s||v&&y.key===" "||lme.includes(y.key)&&(y.currentTarget.click(),y.preventDefault())})})});Pne.displayName=Bte;var DLe=A.forwardRef((e,t)=>{const{__scopeMenu:s,disabled:n=!1,textValue:a,...o}=e,l=Hxe(Bte,s),i=ALe(s),u=A.useRef(null),m=ha(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(RE.ItemSlot,{scope:s,disabled:n,textValue:a??v,children:r.jsx(Uxe,{asChild:!0,...i,focusable:!n,children:r.jsx($s.div,{role:"menuitem","data-highlighted":x?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:m,onPointerMove:xs(e.onPointerMove,FE(N=>{n?l.onItemLeave(N):(l.onItemEnter(N),N.defaultPrevented||N.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:xs(e.onPointerLeave,FE(N=>l.onItemLeave(N))),onFocus:xs(e.onFocus,()=>y(!0)),onBlur:xs(e.onBlur,()=>y(!1))})})})}),Oot="MenuCheckboxItem",RLe=A.forwardRef((e,t)=>{const{checked:s=!1,onCheckedChange:n,...a}=e;return r.jsx(ULe,{scope:e.__scopeMenu,checked:s,children:r.jsx(Pne,{role:"menuitemcheckbox","aria-checked":$te(s)?"mixed":s,...a,ref:t,"data-state":Zxe(s),onSelect:xs(a.onSelect,()=>n==null?void 0:n($te(s)?!0:!s),{checkForDefaultPrevented:!1})})})});RLe.displayName=Oot;var FLe="MenuRadioGroup",[Dot,Rot]=Pk(FLe,{value:void 0,onValueChange:()=>{}}),zLe=A.forwardRef((e,t)=>{const{value:s,onValueChange:n,...a}=e,o=ac(n);return r.jsx(Dot,{scope:e.__scopeMenu,value:s,onValueChange:o,children:r.jsx(Gxe,{...a,ref:t})})});zLe.displayName=FLe;var BLe="MenuRadioItem",$Le=A.forwardRef((e,t)=>{const{value:s,...n}=e,a=Rot(BLe,e.__scopeMenu),o=s===a.value;return r.jsx(ULe,{scope:e.__scopeMenu,checked:o,children:r.jsx(Pne,{role:"menuitemradio","aria-checked":o,...n,ref:t,"data-state":Zxe(o),onSelect:xs(n.onSelect,()=>{var l;return(l=a.onValueChange)==null?void 0:l.call(a,s)},{checkForDefaultPrevented:!1})})})});$Le.displayName=BLe;var Kxe="MenuItemIndicator",[ULe,Fot]=Pk(Kxe,{checked:!1}),qLe=A.forwardRef((e,t)=>{const{__scopeMenu:s,forceMount:n,...a}=e,o=Fot(Kxe,s);return r.jsx(Ec,{present:n||$te(o.checked)||o.checked===!0,children:r.jsx($s.span,{...a,ref:t,"data-state":Zxe(o.checked)})})});qLe.displayName=Kxe;var zot="MenuSeparator",VLe=A.forwardRef((e,t)=>{const{__scopeMenu:s,...n}=e;return r.jsx($s.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});VLe.displayName=zot;var Bot="MenuArrow",HLe=A.forwardRef((e,t)=>{const{__scopeMenu:s,...n}=e,a=Ine(s);return r.jsx(rP,{...a,...n,ref:t})});HLe.displayName=Bot;var $ot="MenuSub",[Itr,WLe]=Pk($ot),FT="MenuSubTrigger",GLe=A.forwardRef((e,t)=>{const s=Lk(FT,e.__scopeMenu),n=cP(FT,e.__scopeMenu),a=WLe(FT,e.__scopeMenu),o=Hxe(FT,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(qxe,{asChild:!0,...m,children:r.jsx(DLe,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":a.contentId,"data-state":YLe(s.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(),s.open||s.onOpenChange(!0))},onPointerMove:xs(e.onPointerMove,FE(y=>{o.onItemEnter(y),!y.defaultPrevented&&!e.disabled&&!s.open&&!l.current&&(o.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{s.onOpenChange(!0),x()},100))})),onPointerLeave:xs(e.onPointerLeave,FE(y=>{var b,N;x();const v=(b=s.content)==null?void 0:b.getBoundingClientRect();if(v){const k=(N=s.content)==null?void 0:N.dataset.side,M=k==="right",E=M?-5:5,T=v[M?"left":"right"],P=v[M?"right":"left"];o.onPointerGraceIntentChange({area:[{x:y.clientX+E,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:xs(e.onKeyDown,y=>{var b;const v=o.searchRef.current!=="";e.disabled||v&&y.key===" "||bot[n.dir].includes(y.key)&&(s.onOpenChange(!0),(b=s.content)==null||b.focus(),y.preventDefault())})})})});GLe.displayName=FT;var KLe="MenuSubContent",ZLe=A.forwardRef((e,t)=>{const s=ILe(gp,e.__scopeMenu),{forceMount:n=s.forceMount,...a}=e,o=Lk(gp,e.__scopeMenu),l=cP(gp,e.__scopeMenu),i=WLe(KLe,e.__scopeMenu),u=A.useRef(null),m=ha(t,u);return r.jsx(RE.Provider,{scope:e.__scopeMenu,children:r.jsx(Ec,{present:n||o.open,children:r.jsx(RE.Slot,{scope:e.__scopeMenu,children:r.jsx(Wxe,{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:xs(e.onFocusOutside,x=>{x.target!==i.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:xs(e.onEscapeKeyDown,x=>{l.onClose(),x.preventDefault()}),onKeyDown:xs(e.onKeyDown,x=>{var b;const y=x.currentTarget.contains(x.target),v=wot[l.dir].includes(x.key);y&&v&&(o.onOpenChange(!1),(b=i.trigger)==null||b.focus(),x.preventDefault())})})})})})});ZLe.displayName=KLe;function YLe(e){return e?"open":"closed"}function $te(e){return e==="indeterminate"}function Zxe(e){return $te(e)?"indeterminate":e?"checked":"unchecked"}function Uot(e){const t=document.activeElement;for(const s of e)if(s===t||(s.focus(),document.activeElement!==t))return}function qot(e,t){return e.map((s,n)=>e[(t+n)%e.length])}function Vot(e,t,s){const a=t.length>1&&Array.from(t).every(m=>m===t[0])?t[0]:t,o=s?e.indexOf(s):-1;let l=qot(e,Math.max(o,0));a.length===1&&(l=l.filter(m=>m!==s));const u=l.find(m=>m.toLowerCase().startsWith(a.toLowerCase()));return u!==s?u:void 0}function Hot(e,t){const{x:s,y:n}=e;let a=!1;for(let o=0,l=t.length-1;on!=v>n&&s<(y-m)*(n-x)/(v-x)+m&&(a=!a)}return a}function Wot(e,t){if(!t)return!1;const s={x:e.clientX,y:e.clientY};return Hot(s,t)}function FE(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Got=ELe,Kot=qxe,Zot=PLe,Yot=LLe,Xot=Gxe,Qot=OLe,Jot=Pne,elt=RLe,tlt=zLe,rlt=$Le,slt=qLe,nlt=VLe,alt=HLe,ilt=GLe,olt=ZLe,Lne="DropdownMenu",[llt]=uc(Lne,[TLe]),dh=TLe(),[clt,XLe]=llt(Lne),QLe=e=>{const{__scopeDropdownMenu:t,children:s,dir:n,open:a,defaultOpen:o,onOpenChange:l,modal:i=!0}=e,u=dh(t),m=A.useRef(null),[x,y]=ah({prop:a,defaultProp:o??!1,onChange:l,caller:Lne});return r.jsx(clt,{scope:t,triggerId:yd(),triggerRef:m,contentId:yd(),open:x,onOpenChange:y,onOpenToggle:A.useCallback(()=>y(v=>!v),[y]),modal:i,children:r.jsx(Got,{...u,open:x,onOpenChange:y,dir:n,modal:i,children:s})})};QLe.displayName=Lne;var JLe="DropdownMenuTrigger",eOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,disabled:n=!1,...a}=e,o=XLe(JLe,s),l=dh(s);return r.jsx(Kot,{asChild:!0,...l,children:r.jsx($s.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":n?"":void 0,disabled:n,...a,ref:Ty(t,o.triggerRef),onPointerDown:xs(e.onPointerDown,i=>{!n&&i.button===0&&i.ctrlKey===!1&&(o.onOpenToggle(),o.open||i.preventDefault())}),onKeyDown:xs(e.onKeyDown,i=>{n||(["Enter"," "].includes(i.key)&&o.onOpenToggle(),i.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});eOe.displayName=JLe;var dlt="DropdownMenuPortal",tOe=e=>{const{__scopeDropdownMenu:t,...s}=e,n=dh(t);return r.jsx(Zot,{...n,...s})};tOe.displayName=dlt;var rOe="DropdownMenuContent",sOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=XLe(rOe,s),o=dh(s),l=A.useRef(!1);return r.jsx(Yot,{id:a.contentId,"aria-labelledby":a.triggerId,...o,...n,ref:t,onCloseAutoFocus:xs(e.onCloseAutoFocus,i=>{var u;l.current||(u=a.triggerRef.current)==null||u.focus(),l.current=!1,i.preventDefault()}),onInteractOutside:xs(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)"}})});sOe.displayName=rOe;var ult="DropdownMenuGroup",hlt=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=dh(s);return r.jsx(Xot,{...a,...n,ref:t})});hlt.displayName=ult;var mlt="DropdownMenuLabel",nOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=dh(s);return r.jsx(Qot,{...a,...n,ref:t})});nOe.displayName=mlt;var plt="DropdownMenuItem",aOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=dh(s);return r.jsx(Jot,{...a,...n,ref:t})});aOe.displayName=plt;var flt="DropdownMenuCheckboxItem",iOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=dh(s);return r.jsx(elt,{...a,...n,ref:t})});iOe.displayName=flt;var glt="DropdownMenuRadioGroup",xlt=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=dh(s);return r.jsx(tlt,{...a,...n,ref:t})});xlt.displayName=glt;var ylt="DropdownMenuRadioItem",oOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=dh(s);return r.jsx(rlt,{...a,...n,ref:t})});oOe.displayName=ylt;var vlt="DropdownMenuItemIndicator",lOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=dh(s);return r.jsx(slt,{...a,...n,ref:t})});lOe.displayName=vlt;var _lt="DropdownMenuSeparator",cOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=dh(s);return r.jsx(nlt,{...a,...n,ref:t})});cOe.displayName=_lt;var blt="DropdownMenuArrow",wlt=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=dh(s);return r.jsx(alt,{...a,...n,ref:t})});wlt.displayName=blt;var jlt="DropdownMenuSubTrigger",dOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=dh(s);return r.jsx(ilt,{...a,...n,ref:t})});dOe.displayName=jlt;var klt="DropdownMenuSubContent",uOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=dh(s);return r.jsx(olt,{...a,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});uOe.displayName=klt;var Nlt=QLe,Slt=eOe,Clt=tOe,hOe=sOe,mOe=nOe,pOe=aOe,fOe=iOe,gOe=oOe,xOe=lOe,yOe=cOe,vOe=dOe,_Oe=uOe;const uh=Nlt,hh=Slt,Mlt=A.forwardRef(({className:e,inset:t,children:s,...n},a)=>r.jsxs(vOe,{ref:a,className:Ut("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent",t&&"pl-8",e),...n,children:[s,r.jsx(Zi,{className:"ml-auto h-4 w-4"})]}));Mlt.displayName=vOe.displayName;const Tlt=A.forwardRef(({className:e,...t},s)=>r.jsx(_Oe,{ref:s,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}));Tlt.displayName=_Oe.displayName;const Cu=A.forwardRef(({className:e,sideOffset:t=4,...s},n)=>r.jsx(Clt,{children:r.jsx(hOe,{ref:n,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),...s})}));Cu.displayName=hOe.displayName;const Wa=A.forwardRef(({className:e,inset:t,...s},n)=>r.jsx(pOe,{ref:n,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),...s}));Wa.displayName=pOe.displayName;const Alt=A.forwardRef(({className:e,children:t,checked:s,...n},a)=>r.jsxs(fOe,{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:s,...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(xOe,{children:r.jsx(fi,{className:"h-4 w-4"})})}),t]}));Alt.displayName=fOe.displayName;const Elt=A.forwardRef(({className:e,children:t,...s},n)=>r.jsxs(gOe,{ref:n,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),...s,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(xOe,{children:r.jsx(sh,{className:"h-2 w-2 fill-current"})})}),t]}));Elt.displayName=gOe.displayName;const cme=A.forwardRef(({className:e,inset:t,...s},n)=>r.jsx(mOe,{ref:n,className:Ut("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...s}));cme.displayName=mOe.displayName;const dk=A.forwardRef(({className:e,...t},s)=>r.jsx(yOe,{ref:s,className:Ut("-mx-1 my-1 h-px bg-muted",e),...t}));dk.displayName=yOe.displayName;const Ilt=()=>{const{isAssistant:e,actingAsAgent:t,assignedAgents:s,setActingAsAgent:n}=zxe();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(qs,{className:"h-4 w-4 flex-shrink-0"}),r.jsx("span",{className:"font-medium text-sm",children:"Acting as"}),s.length>1?r.jsxs(uh,{children:[r.jsx(hh,{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(Xn,{className:"h-5 w-5",children:[r.jsx(ji,{src:t.avatar_url||void 0}),r.jsx(Qn,{className:"text-[10px] bg-primary-foreground/30",children:o(t.name)})]}),r.jsx("strong",{children:t.name}),r.jsx(gd,{className:"h-3 w-3"})]})}),r.jsx(Cu,{align:"start",children:s.map(l=>r.jsxs(Wa,{onClick:()=>n(l),className:"gap-2",children:[r.jsxs(Xn,{className:"h-6 w-6",children:[r.jsx(ji,{src:l.avatar_url||void 0}),r.jsx(Qn,{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(Xn,{className:"h-5 w-5",children:[r.jsx(ji,{src:t.avatar_url||void 0}),r.jsx(Qn,{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"})]})})},ks=({children:e,requireAdmin:t=!1,requireBrokerageManager:s=!1})=>{const{user:n,loading:a,isAdmin:o,isBrokerageManager:l}=Yr();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..."})]})}):n?t&&!o?r.jsx(wce,{to:"/dashboard",replace:!0}):s&&!l&&!o?r.jsx(wce,{to:"/dashboard",replace:!0}):r.jsx(r.Fragment,{children:e}):r.jsx(wce,{to:"/auth",replace:!0})};var Yxe={};(function e(t,s,n,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 Me=new OffscreenCanvas(1,1),ve=Me.getContext("2d");ve.fillRect(0,0,1,1);var be=Me.transferToImageBitmap();ve.createPattern(be,"no-repeat")}catch{return!1}return!0}();function u(){}function m(Me){var ve=s.exports.Promise,be=ve!==void 0?ve:t.Promise;return typeof be=="function"?new be(Me):(Me(u,u),null)}var x=function(Me,ve){return{transform:function(be){if(Me)return be;if(ve.has(be))return ve.get(be);var we=new OffscreenCanvas(be.width,be.height),tt=we.getContext("2d");return tt.drawImage(be,0,0),ve.set(be,we),we},clear:function(){ve.clear()}}}(i,new Map),y=function(){var Me=Math.floor(16.666666666666668),ve,be,we={},tt=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(ve=function(Ae){var Le=Math.random();return we[Le]=requestAnimationFrame(function Ue(Pe){tt===Pe||tt+Me-1{const{data:t,error:s}=await Y.from("celebration_queue").select("*").eq("user_id",e.id).is("seen_at",null).order("created_at",{ascending:!0});if(s)throw s;return t},enabled:!!(e!=null&&e.id),refetchOnWindowFocus:!0,staleTime:0})}function Llt(){const e=Br();return ar({mutationFn:async t=>{const{error:s}=await Y.from("celebration_queue").update({seen_at:new Date().toISOString()}).eq("id",t);if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["celebrations"]})}})}function Olt(){const e=Br(),{user:t}=Yr();return ar({mutationFn:async s=>{const{error:n}=await Y.from("celebration_queue").insert({user_id:s.user_id,celebration_type:s.celebration_type,title:s.title,message:s.message||null,points_amount:s.points_amount||null,created_by:t==null?void 0:t.id});if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["celebrations"]})}})}var One="Dialog",[bOe,wOe]=uc(One),[Dlt,qf]=bOe(One),jOe=e=>{const{__scopeDialog:t,children:s,open:n,defaultOpen:a,onOpenChange:o,modal:l=!0}=e,i=A.useRef(null),u=A.useRef(null),[m,x]=ah({prop:n,defaultProp:a??!1,onChange:o,caller:One});return r.jsx(Dlt,{scope:t,triggerRef:i,contentRef:u,contentId:yd(),titleId:yd(),descriptionId:yd(),open:m,onOpenChange:x,onOpenToggle:A.useCallback(()=>x(y=>!y),[x]),modal:l,children:s})};jOe.displayName=One;var kOe="DialogTrigger",NOe=A.forwardRef((e,t)=>{const{__scopeDialog:s,...n}=e,a=qf(kOe,s),o=ha(t,a.triggerRef);return r.jsx($s.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Jxe(a.open),...n,ref:o,onClick:xs(e.onClick,a.onOpenToggle)})});NOe.displayName=kOe;var Xxe="DialogPortal",[Rlt,SOe]=bOe(Xxe,{forceMount:void 0}),COe=e=>{const{__scopeDialog:t,forceMount:s,children:n,container:a}=e,o=qf(Xxe,t);return r.jsx(Rlt,{scope:t,forceMount:s,children:A.Children.map(n,l=>r.jsx(Ec,{present:s||o.open,children:r.jsx(w3,{asChild:!0,container:a,children:l})}))})};COe.displayName=Xxe;var Ute="DialogOverlay",MOe=A.forwardRef((e,t)=>{const s=SOe(Ute,e.__scopeDialog),{forceMount:n=s.forceMount,...a}=e,o=qf(Ute,e.__scopeDialog);return o.modal?r.jsx(Ec,{present:n||o.open,children:r.jsx(zlt,{...a,ref:t})}):null});MOe.displayName=Ute;var Flt=mv("DialogOverlay.RemoveScroll"),zlt=A.forwardRef((e,t)=>{const{__scopeDialog:s,...n}=e,a=qf(Ute,s);return r.jsx(oP,{as:Flt,allowPinchZoom:!0,shards:[a.contentRef],children:r.jsx($s.div,{"data-state":Jxe(a.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),uk="DialogContent",TOe=A.forwardRef((e,t)=>{const s=SOe(uk,e.__scopeDialog),{forceMount:n=s.forceMount,...a}=e,o=qf(uk,e.__scopeDialog);return r.jsx(Ec,{present:n||o.open,children:o.modal?r.jsx(Blt,{...a,ref:t}):r.jsx($lt,{...a,ref:t})})});TOe.displayName=uk;var Blt=A.forwardRef((e,t)=>{const s=qf(uk,e.__scopeDialog),n=A.useRef(null),a=ha(t,s.contentRef,n);return A.useEffect(()=>{const o=n.current;if(o)return Ane(o)},[]),r.jsx(AOe,{...e,ref:a,trapFocus:s.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:xs(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),(l=s.triggerRef.current)==null||l.focus()}),onPointerDownOutside:xs(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,i=l.button===0&&l.ctrlKey===!0;(l.button===2||i)&&o.preventDefault()}),onFocusOutside:xs(e.onFocusOutside,o=>o.preventDefault())})}),$lt=A.forwardRef((e,t)=>{const s=qf(uk,e.__scopeDialog),n=A.useRef(!1),a=A.useRef(!1);return r.jsx(AOe,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,i;(l=e.onCloseAutoFocus)==null||l.call(e,o),o.defaultPrevented||(n.current||(i=s.triggerRef.current)==null||i.focus(),o.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:o=>{var u,m;(u=e.onInteractOutside)==null||u.call(e,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=o.target;((m=s.triggerRef.current)==null?void 0:m.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}})}),AOe=A.forwardRef((e,t)=>{const{__scopeDialog:s,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:o,...l}=e,i=qf(uk,s),u=A.useRef(null),m=ha(t,u);return Tne(),r.jsxs(r.Fragment,{children:[r.jsx(aP,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:o,children:r.jsx(kv,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Jxe(i.open),...l,ref:m,onDismiss:()=>i.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(qlt,{titleId:i.titleId}),r.jsx(Hlt,{contentRef:u,descriptionId:i.descriptionId})]})]})}),Qxe="DialogTitle",EOe=A.forwardRef((e,t)=>{const{__scopeDialog:s,...n}=e,a=qf(Qxe,s);return r.jsx($s.h2,{id:a.titleId,...n,ref:t})});EOe.displayName=Qxe;var IOe="DialogDescription",POe=A.forwardRef((e,t)=>{const{__scopeDialog:s,...n}=e,a=qf(IOe,s);return r.jsx($s.p,{id:a.descriptionId,...n,ref:t})});POe.displayName=IOe;var LOe="DialogClose",OOe=A.forwardRef((e,t)=>{const{__scopeDialog:s,...n}=e,a=qf(LOe,s);return r.jsx($s.button,{type:"button",...n,ref:t,onClick:xs(e.onClick,()=>a.onOpenChange(!1))})});OOe.displayName=LOe;function Jxe(e){return e?"open":"closed"}var DOe="DialogTitleWarning",[Ult,ROe]=vXe(DOe,{contentName:uk,titleName:Qxe,docsSlug:"dialog"}),qlt=({titleId:e})=>{const t=ROe(DOe),s=`\`${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(s))},[s,e]),null},Vlt="DialogDescriptionWarning",Hlt=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ROe(Vlt).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(n))},[n,e,t]),null},Dne=jOe,eye=NOe,Rne=COe,O3=MOe,D3=TOe,dP=EOe,uP=POe,Fne=OOe;const Or=Dne,vo=eye,Wlt=Rne,FOe=A.forwardRef(({className:e,...t},s)=>r.jsx(O3,{ref:s,className:Ut("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));FOe.displayName=O3.displayName;const Pr=A.forwardRef(({className:e,children:t,...s},n)=>r.jsxs(Wlt,{children:[r.jsx(FOe,{}),r.jsxs(D3,{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),...s,children:[t,r.jsxs(Fne,{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(en,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Pr.displayName=D3.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 zn=({className:e,...t})=>r.jsx("div",{className:Ut("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});zn.displayName="DialogFooter";const Rr=A.forwardRef(({className:e,...t},s)=>r.jsx(dP,{ref:s,className:Ut("text-lg font-semibold leading-none tracking-tight",e),...t}));Rr.displayName=dP.displayName;const Zs=A.forwardRef(({className:e,...t},s)=>r.jsx(uP,{ref:s,className:Ut("text-sm text-muted-foreground",e),...t}));Zs.displayName=uP.displayName;const Glt={points_earned:lo,listing_created:sa,deal_closed:zd,custom:Mn},Kke={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 Klt(){const{user:e}=Yr(),t=Br(),{data:s}=Plt(),n=Llt(),[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=(E,T)=>Math.random()*(T-E)+E,M=setInterval(()=>{const E=b-Date.now();if(E<=0){clearInterval(M);return}const T=50*(E/3e3);Gke({...N,particleCount:T,origin:{x:k(.1,.3),y:Math.random()-.2},colors:["#ff6b6b","#feca57","#48dbfb","#ff9ff3","#54a0ff","#5f27cd"]}),Gke({...N,particleCount:T,origin:{x:k(.7,.9),y:Math.random()-.2},colors:["#ff6b6b","#feca57","#48dbfb","#ff9ff3","#54a0ff","#5f27cd"]})},250)},[]);A.useEffect(()=>{s&&s.length>0&&!a&&(o(s[0]),i(!0),setTimeout(u,100))},[s,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 n.mutateAsync(v)}};if(!a)return null;const x=Glt[a.celebration_type]||Mn,y=Kke[a.celebration_type]||Kke.custom;return r.jsx(Or,{open:l,onOpenChange:v=>!v&&m(),children:r.jsxs(Pr,{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(Bn,{className:"w-5 h-5 text-yellow-500 animate-pulse"}),r.jsx(Bn,{className:"w-5 h-5 text-yellow-500 animate-pulse delay-75"}),r.jsx(Bn,{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! 🙌"}),s&&s.length>1&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-3",children:["+",s.length-1," more celebration",s.length>2?"s":""," waiting"]})]})]})})}const zOe="/assets/levelup-logo-horizontal-DEFNc0ms.png",tye="/assets/levelup-logo-white-C2RAgAoG.png",Zlt="/assets/listings-hero-BI9Ki9Dq.jpg",ot=A.forwardRef(({className:e,type:t,...s},n)=>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:n,...s}));ot.displayName="Input";var BOe={exports:{}};(function(e,t){(function(s,n){e.exports=n()})(Jx,function(){var s,n,a;function o(i,u){if(!s)s=u;else if(!n)n=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 = {}; ("+s+")(sharedChunk); ("+n+")(sharedChunk); self.onerror = null;",x={};s(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(p,c){var h=c[0],g=c[1],_=c[2],S=c[3],C=h*S-_*g;return C?(p[0]=S*(C=1/C),p[1]=-g*C,p[2]=-_*C,p[3]=h*C,p):null}function y(){var p=new m(9);return m!=Float32Array&&(p[1]=0,p[2]=0,p[3]=0,p[5]=0,p[6]=0,p[7]=0),p[0]=1,p[4]=1,p[8]=1,p}function v(p,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 p[0]=C*K-L*$,p[1]=_*$-g*K,p[2]=g*L-_*C,p[3]=L*z-S*K,p[4]=h*K-_*z,p[5]=_*S-h*L,p[6]=S*$-C*z,p[7]=g*z-h*$,p[8]=h*C-g*S,p}function b(p,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],ae=h[2],ge=h[3],Se=h[4],Ne=h[5],Be=h[6],qe=h[7],Qe=h[8];return p[0]=ee*g+re*C+ae*$,p[1]=ee*_+re*L+ae*K,p[2]=ee*S+re*z+ae*Z,p[3]=ge*g+Se*C+Ne*$,p[4]=ge*_+Se*L+Ne*K,p[5]=ge*S+Se*z+Ne*Z,p[6]=Be*g+qe*C+Qe*$,p[7]=Be*_+qe*L+Qe*K,p[8]=Be*S+qe*z+Qe*Z,p}function N(){var p=new m(16);return m!=Float32Array&&(p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[11]=0,p[12]=0,p[13]=0,p[14]=0),p[0]=1,p[5]=1,p[10]=1,p[15]=1,p}function k(p){var c=new m(16);return c[0]=p[0],c[1]=p[1],c[2]=p[2],c[3]=p[3],c[4]=p[4],c[5]=p[5],c[6]=p[6],c[7]=p[7],c[8]=p[8],c[9]=p[9],c[10]=p[10],c[11]=p[11],c[12]=p[12],c[13]=p[13],c[14]=p[14],c[15]=p[15],c}function M(p){return p[0]=1,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=1,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[10]=1,p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,p}function E(p,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],ae=c[12],ge=c[13],Se=c[14],Ne=c[15],Be=h*L-g*C,qe=h*z-_*C,Qe=h*$-S*C,vt=g*z-_*L,mt=g*$-S*L,jt=_*$-S*z,At=K*ge-Z*ae,Pt=K*Se-ee*ae,Qt=K*Ne-re*ae,Ft=Z*Se-ee*ge,sr=Z*Ne-re*ge,dr=ee*Ne-re*Se,ur=Be*dr-qe*sr+Qe*Ft+vt*Qt-mt*Pt+jt*At;return ur?(p[0]=(L*dr-z*sr+$*Ft)*(ur=1/ur),p[1]=(_*sr-g*dr-S*Ft)*ur,p[2]=(ge*jt-Se*mt+Ne*vt)*ur,p[3]=(ee*mt-Z*jt-re*vt)*ur,p[4]=(z*Qt-C*dr-$*Pt)*ur,p[5]=(h*dr-_*Qt+S*Pt)*ur,p[6]=(Se*Qe-ae*jt-Ne*qe)*ur,p[7]=(K*jt-ee*Qe+re*qe)*ur,p[8]=(C*sr-L*Qt+$*At)*ur,p[9]=(g*Qt-h*sr-S*At)*ur,p[10]=(ae*mt-ge*Qe+Ne*Be)*ur,p[11]=(Z*Qe-K*mt-re*Be)*ur,p[12]=(L*Pt-C*Ft-z*At)*ur,p[13]=(h*Ft-g*Pt+_*At)*ur,p[14]=(ge*qe-ae*vt-Se*Be)*ur,p[15]=(K*vt-Z*qe+ee*Be)*ur,p):null}function T(p,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],ae=c[11],ge=c[12],Se=c[13],Ne=c[14],Be=c[15],qe=h[0],Qe=h[1],vt=h[2],mt=h[3];return p[0]=qe*g+Qe*L+vt*Z+mt*ge,p[1]=qe*_+Qe*z+vt*ee+mt*Se,p[2]=qe*S+Qe*$+vt*re+mt*Ne,p[3]=qe*C+Qe*K+vt*ae+mt*Be,p[4]=(qe=h[4])*g+(Qe=h[5])*L+(vt=h[6])*Z+(mt=h[7])*ge,p[5]=qe*_+Qe*z+vt*ee+mt*Se,p[6]=qe*S+Qe*$+vt*re+mt*Ne,p[7]=qe*C+Qe*K+vt*ae+mt*Be,p[8]=(qe=h[8])*g+(Qe=h[9])*L+(vt=h[10])*Z+(mt=h[11])*ge,p[9]=qe*_+Qe*z+vt*ee+mt*Se,p[10]=qe*S+Qe*$+vt*re+mt*Ne,p[11]=qe*C+Qe*K+vt*ae+mt*Be,p[12]=(qe=h[12])*g+(Qe=h[13])*L+(vt=h[14])*Z+(mt=h[15])*ge,p[13]=qe*_+Qe*z+vt*ee+mt*Se,p[14]=qe*S+Qe*$+vt*re+mt*Ne,p[15]=qe*C+Qe*K+vt*ae+mt*Be,p}function P(p,c,h){var g,_,S,C,L,z,$,K,Z,ee,re,ae,ge=h[0],Se=h[1],Ne=h[2];return c===p?(p[12]=c[0]*ge+c[4]*Se+c[8]*Ne+c[12],p[13]=c[1]*ge+c[5]*Se+c[9]*Ne+c[13],p[14]=c[2]*ge+c[6]*Se+c[10]*Ne+c[14],p[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],ae=c[11],p[0]=g=c[0],p[1]=_,p[2]=S,p[3]=C,p[4]=L,p[5]=z,p[6]=$,p[7]=K,p[8]=Z,p[9]=ee,p[10]=re,p[11]=ae,p[12]=g*ge+L*Se+Z*Ne+c[12],p[13]=_*ge+z*Se+ee*Ne+c[13],p[14]=S*ge+$*Se+re*Ne+c[14],p[15]=C*ge+K*Se+ae*Ne+c[15]),p}function R(p,c,h){var g=h[0],_=h[1],S=h[2];return p[0]=c[0]*g,p[1]=c[1]*g,p[2]=c[2]*g,p[3]=c[3]*g,p[4]=c[4]*_,p[5]=c[5]*_,p[6]=c[6]*_,p[7]=c[7]*_,p[8]=c[8]*S,p[9]=c[9]*S,p[10]=c[10]*S,p[11]=c[11]*S,p[12]=c[12],p[13]=c[13],p[14]=c[14],p[15]=c[15],p}function D(p,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!==p&&(p[0]=c[0],p[1]=c[1],p[2]=c[2],p[3]=c[3],p[12]=c[12],p[13]=c[13],p[14]=c[14],p[15]=c[15]),p[4]=S*_+$*g,p[5]=C*_+K*g,p[6]=L*_+Z*g,p[7]=z*_+ee*g,p[8]=$*_-S*g,p[9]=K*_-C*g,p[10]=Z*_-L*g,p[11]=ee*_-z*g,p}function U(p,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!==p&&(p[4]=c[4],p[5]=c[5],p[6]=c[6],p[7]=c[7],p[12]=c[12],p[13]=c[13],p[14]=c[14],p[15]=c[15]),p[0]=S*_-$*g,p[1]=C*_-K*g,p[2]=L*_-Z*g,p[3]=z*_-ee*g,p[8]=S*g+$*_,p[9]=C*g+K*_,p[10]=L*g+Z*_,p[11]=z*g+ee*_,p}function q(p,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!==p&&(p[8]=c[8],p[9]=c[9],p[10]=c[10],p[11]=c[11],p[12]=c[12],p[13]=c[13],p[14]=c[14],p[15]=c[15]),p[0]=S*_+$*g,p[1]=C*_+K*g,p[2]=L*_+Z*g,p[3]=z*_+ee*g,p[4]=$*_-S*g,p[5]=K*_-C*g,p[6]=Z*_-L*g,p[7]=ee*_-z*g,p}function H(p,c){return p[0]=c[0],p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=c[1],p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[10]=c[2],p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,p}function G(p,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)),p[0]=c[0]*S,p[1]=c[1]*S,p[2]=c[2]*S,p}function it(p,c){return p[0]*c[0]+p[1]*c[1]+p[2]*c[2]}function xt(p,c,h){var g=c[0],_=c[1],S=c[2],C=h[0],L=h[1],z=h[2];return p[0]=_*z-S*L,p[1]=S*C-g*z,p[2]=g*L-_*C,p}function Ee(p,c,h,g){var _=c[0],S=c[1],C=c[2];return p[0]=_+g*(h[0]-_),p[1]=S+g*(h[1]-S),p[2]=C+g*(h[2]-C),p}function et(p,c,h){var g=c[0],_=c[1],S=c[2],C=h[3]*g+h[7]*_+h[11]*S+h[15];return p[0]=(h[0]*g+h[4]*_+h[8]*S+h[12])/(C=C||1),p[1]=(h[1]*g+h[5]*_+h[9]*S+h[13])/C,p[2]=(h[2]*g+h[6]*_+h[10]*S+h[14])/C,p}function le(p,c,h){var g=c[0],_=c[1],S=c[2];return p[0]=g*h[0]+_*h[3]+S*h[6],p[1]=g*h[1]+_*h[4]+S*h[7],p[2]=g*h[2]+_*h[5]+S*h[8],p}function Ve(p,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 p[0]=L+C*(K+=K)+_*(ee+=ee)-S*(Z+=Z),p[1]=z+C*Z+S*K-g*ee,p[2]=$+C*ee+g*Z-_*K,p}function Je(p){return p[0]=0,p[1]=0,p[2]=0,p}function rt(p,c){return p[0]===c[0]&&p[1]===c[1]&&p[2]===c[2]}var je=xe,lt=Me,Ce=fe;function Ie(){var p=new m(4);return m!=Float32Array&&(p[0]=0,p[1]=0,p[2]=0,p[3]=0),p}function Ze(p,c,h){return p[0]=c[0]*h,p[1]=c[1]*h,p[2]=c[2]*h,p[3]=c[3]*h,p}function De(p,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)),p[0]=h*C,p[1]=g*C,p[2]=_*C,p[3]=S*C,p}function Ke(p,c,h){var g=c[0],_=c[1],S=c[2],C=c[3];return p[0]=h[0]*g+h[4]*_+h[8]*S+h[12]*C,p[1]=h[1]*g+h[5]*_+h[9]*S+h[13]*C,p[2]=h[2]*g+h[6]*_+h[10]*S+h[14]*C,p[3]=h[3]*g+h[7]*_+h[11]*S+h[15]*C,p}function st(){var p=new m(4);return m!=Float32Array&&(p[0]=0,p[1]=0,p[2]=0),p[3]=1,p}function dt(p){return p[0]=0,p[1]=0,p[2]=0,p[3]=1,p}function ct(p,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 p[0]=g*z+C*L,p[1]=_*z+S*L,p[2]=S*z-_*L,p[3]=C*z-g*L,p}function zt(p,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 p[0]=g*z-S*L,p[1]=_*z+C*L,p[2]=S*z+g*L,p[3]=C*z-_*L,p}he(),Ie();var ir,Tr,Zr,$r=De,ns=(ir=he(),Tr=oe(1,0,0),Zr=oe(0,1,0),function(p,c,h){var g=it(c,h);return g<-.999999?(xt(ir,Tr,c),Ce(ir)<1e-6&&xt(ir,Zr,c),$e(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)}(p,ir,Math.PI),p):g>.999999?(p[0]=0,p[1]=0,p[2]=0,p[3]=1,p):(xt(ir,c,h),p[0]=ir[0],p[1]=ir[1],p[2]=ir[2],p[3]=1+g,$r(p,p))});function Xs(){var p=new m(2);return m!=Float32Array&&(p[0]=0,p[1]=0),p}function Ot(p,c){var h=new m(2);return h[0]=p,h[1]=c,h}function Hr(p,c,h){return p[0]=c,p[1]=h,p}function Ts(p,c,h){return p[0]=c[0]+h[0],p[1]=c[1]+h[1],p}function zs(p,c,h){return p[0]=c[0]-h[0],p[1]=c[1]-h[1],p}function wa(p,c,h){return p[0]=c[0]*h,p[1]=c[1]*h,p}function gi(p){var c=p[0],h=p[1];return Math.sqrt(c*c+h*h)}function Ao(p,c){var h=c[0],g=c[1],_=h*h+g*g;return _>0&&(_=1/Math.sqrt(_)),p[0]=c[0]*_,p[1]=c[1]*_,p}function Ga(p,c){return p[0]*c[0]+p[1]*c[1]}st(),st(),y();var mn,na,pn=zs;function Jn(p){return p&&p.__esModule&&Object.prototype.hasOwnProperty.call(p,"default")?p.default:p}Xs();var $n=function(){if(na)return mn;function p(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 na=1,mn=p,p.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))}},mn}(),Ci=Jn($n);function or(p,c){this.x=p,this.y=c}function La(p,c){if(Array.isArray(p)){if(!Array.isArray(c)||p.length!==c.length)return!1;for(let h=0;h=1)return 1;const c=p*p,h=c*p;return 4*(p<.5?h:3*(p-c)+h-.75)}function pc(p,c,h,g){const _=new Ci(p,c,h,g);return function(S){return _.solve(S)}}const nt=pc(.25,.1,.25,1);function ye(p,c,h){return Math.min(h,Math.max(c,p))}function Oe(p,c,h){return(h=ye((h-p)/(c-p),0,1))*h*(3-2*h)}function Ye(p,c,h){const g=h-c,_=((p-c)%g+g)%g+c;return _===c?h:_}function St(p,c,h){if(!p.length)return h(null,[]);let g=p.length;const _=new Array(p.length);let S=null;p.forEach((C,L)=>{c(C,(z,$)=>{z&&(S=z),_[L]=$,--g==0&&h(S,_)})})}let wt=1;function It(){return wt++}function qt(p){return p<=1?1:Math.pow(2,Math.ceil(Math.log2(p)))}function Lt(p,c){p.forEach(h=>{c[h]&&(c[h]=c[h].bind(c))})}function Wt(p,c,h){const g={};for(const _ in p)g[_]=c.call(this,p[_],_,p);return g}function pr(p,c,h){const g={};for(const _ in p)c.call(this,p[_],_,p)&&(g[_]=p[_]);return g}function cr(p){return Array.isArray(p)?p.map(cr):typeof p=="object"&&p?Wt(p,cr):p}function Qr(p,c){for(let h=0;h=0)return!0;return!1}const Ms={};function Kr(p){Ms[p]||(typeof console<"u"&&console.warn(p),Ms[p]=!0)}function dn(p,c,h){return(h.y-p.y)*(c.x-p.x)>(c.y-p.y)*(h.x-p.x)}function un(p){let c=0;for(let h,g,_=0,S=p.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 So=null;function ja(p,c){return[p[4*c],p[4*c+1],p[4*c+2],p[4*c+3]]}function Eo(p,c,h,g){for(;c>1;p[_]>1;p[_]<=g?c=_+1:h=_}return c}function aa(p){return p>0?1/(1.001-p):1+p}function Oi(p){return p>0?1-1/(1.001-p):-p}function Ka(p,c,h){return(p-c.min)*(h.max-h.min)/(c.max-c.min)+h.min}const Dn={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(!Dn.API_URL)return null;try{const p=new URL(Dn.API_URL);return p.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":p.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 Di(p){return Dn.API_URL_REGEX.test(p)}function wl(p){return Dn.API_SPRITE_REGEX.test(p)}let Pl,Xc,Im,Xo,Hd,fc;function mh(){return Pl==null&&(Pl=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),Pl}const Qo={now:()=>Xo!==void 0?Xo:performance.now(),setNow(p){Xo=p},restoreNow(){Xo=void 0},frame(p){const c=requestAnimationFrame(p);return{cancel:()=>cancelAnimationFrame(c)}},getImageData(p,c=0){const{width:h,height:g}=p;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(p,0,0,h,g),_.getImageData(-c,-c,h+2*c,g+2*c)},resolveURL:p=>(Xc||(Xc=document.createElement("a")),Xc.href=p,Xc.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(Im==null&&(Im=window.matchMedia("(prefers-reduced-motion: reduce)")),Im.matches)},hasCanvasFingerprintNoise(){if(fc!==void 0)return fc;if(!mh())return fc=!1,!1;const p=new OffscreenCanvas(85,1),c=p.getContext("2d",{willReadFrequently:!0});let h=0;for(let _=0;_0?`?${S}`:""}`}const Yy="mapbox-tiles";let Xy=500,Qy=50;const Vh=["language","worldview","jobid"];let Iu,Qc;function lu(){try{return caches}catch{}}function gc(){const p=lu();p&&Iu==null&&(Iu=p.open(Yy))}let Jc=1/0;const Wo={supported:!1,testSupport:function(p){!Wd&&Hh&&(Tp?hx(p):Pu=p)}};let Pu,Hh,Wd=!1,Tp=!1;const Jy=typeof self<"u"?self:{};function hx(p){const c=p.createTexture();p.bindTexture(p.TEXTURE_2D,c);try{if(p.texImage2D(p.TEXTURE_2D,0,p.RGBA,p.RGBA,p.UNSIGNED_BYTE,Hh),p.isContextLost())return;Wo.supported=!0}catch{}p.deleteTexture(c),Wd=!0}Jy.document&&(Hh=Jy.document.createElement("img"),Hh.onload=function(){Pu&&hx(Pu),Pu=null,Tp=!0},Hh.onerror=function(){Wd=!0,Pu=null},Hh.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Ap={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(Ap);class bd extends Error{constructor(c,h,g){h===401&&Di(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=Gn()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,Pm=function(p,c){if(!(/^file:/.test(h=p.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&&Di(K);var K;g.type==="json"&&C.headers.set("Accept","application/json");const Z=(re,ae,ge)=>{if(z)return;if(re&&re.message!=="SecurityError"&&Kr(re.toString()),ae&&ge)return ee(ae);const Se=Date.now();fetch(C).then(Ne=>{if(Ne.ok){const Be=$?Ne.clone():null;return ee(Ne,Be,Se)}return _(new bd(Ne.statusText,Ne.status,g.url))}).catch(Ne=>{Ne.name!=="AbortError"&&_(new Error(`${Ne.message} ${g.url}`))})},ee=(re,ae,ge)=>{(g.type==="arrayBuffer"?re.arrayBuffer():g.type==="json"?re.json():re.text()).then(Se=>{z||(ae&&ge&&function(Ne,Be,qe){if(gc(),Iu==null)return;const Qe=qi(Be.headers.get("Cache-Control")||"");if(Qe["no-store"])return;const vt={status:Be.status,statusText:Be.statusText,headers:new Headers};Be.headers.forEach((At,Pt)=>vt.headers.set(Pt,At)),Qe["max-age"]&&vt.headers.set("Expires",new Date(qe+1e3*Qe["max-age"]).toUTCString());const mt=vt.headers.get("Expires");if(!mt||new Date(mt).getTime()-qe<42e4)return;let jt=Kf(Ne.url,{persistentParams:Vh});if(Be.status===206){const At=Ne.headers.get("Range");if(!At)return;vt.status=200,jt=Mp(jt,{range:At})}(function(At,Pt){if(Qc===void 0)try{new Response(new ReadableStream),Qc=!0}catch{Qc=!1}Qc?Pt(At.body):At.blob().then(Pt).catch(Qt=>Kr(Qt.message))})(Be,At=>{const Pt=new Response((Qt=Be.status)!==200&&Qt!==404&&[101,103,204,205,304].includes(Qt)?null:At,vt);var Qt;gc(),Iu!=null&&Iu.then(Ft=>Ft.put(jt,Pt)).catch(Ft=>Kr(Ft.message))})}(C,ae,ge),L=!0,_(null,Se,re.headers))}).catch(Se=>{z||_(new Error(Se.message))})};return $?function(re,ae){if(gc(),Iu==null)return ae(null);Iu.then(ge=>{let Se=Kf(re.url,{persistentParams:Vh});const Ne=re.headers.get("Range");Ne&&(Se=Mp(Se,{range:Ne})),ge.match(Se).then(Be=>{const qe=function(Qe){if(!Qe)return!1;const vt=new Date(Qe.headers.get("Expires")||0),mt=qi(Qe.headers.get("Cache-Control")||"");return Number(vt)>Date.now()&&!mt["no-cache"]}(Be);ge.delete(Se).catch(ae),qe&&ge.put(Se,Be.clone()).catch(ae),ae(null,Be,qe)}).catch(ae)}).catch(ae)}(C,Z):Z(null,null),{cancel:()=>{z=!0,L||S.abort()}}}(p,c);if(Gn(self)&&self.worker.actor)return self.worker.actor.send("getResource",p,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 bd(S.statusText,S.status,g.url))},S.send(g.body),{cancel:()=>S.abort()}}(p,c)},Lu=function(p,c){return Pm(Object.assign(p,{type:"arrayBuffer"}),c)};function a5(p){const c=document.createElement("a");return c.href=p,c.protocol===location.protocol&&c.host===location.host}const $k="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let mx,ea;mx=[],ea=0;const t0=function(p,c){if(Wo.supported&&(p.headers||(p.headers={}),p.headers.accept="image/webp,*/*"),ea>=Dn.MAX_PARALLEL_IMAGE_REQUESTS){const S={requestParameters:p,callback:c,cancelled:!1,cancel(){this.cancelled=!0}};return mx.push(S),S}ea++;let h=!1;const g=()=>{if(!h)for(h=!0,ea--;mx.length&&ea{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=$k})},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):$k}(C,(z,$)=>c(z,$,L)))});return{cancel:()=>{_.cancel(),g()}}};var Bv,Uk,qk,Lm={exports:{}},Zf={exports:{}},px={exports:{}},Nt=function(){if(qk)return Lm.exports;qk=1;var p=(Bv||(Bv=1,Zf.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}),Zf.exports),c=(Uk||(Uk=1,px.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}),px.exports);return Lm.exports=p,Lm.exports.murmur3=p,Lm.exports.murmur2=c,Lm.exports}(),fr=Jn(Nt);class Lr{constructor(c,...h){Object.assign(this,h[0]||{}),this.type=c}}class on extends Lr{constructor(c,h={}){super("error",Object.assign({error:c},h))}}function ln(p,c,h){h[p]&&h[p].indexOf(c)!==-1||(h[p]=h[p]||[],h[p].push(c))}function ia(p,c,h){if(h&&h[p]){const g=h[p].indexOf(c);g!==-1&&h[p].splice(g,1)}}class Rn{on(c,h){return this._listeners=this._listeners||{},ln(c,h,this._listeners),this}off(c,h){return ia(c,h,this._listeners),ia(c,h,this._oneTimeListeners),this}once(c,h){return h?(this._oneTimeListeners=this._oneTimeListeners||{},ln(c,h,this._oneTimeListeners),this):new Promise(g=>{this.once(c,g)})}fire(c,h){const g=typeof c=="string"?new Lr(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)ia(_,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 on&&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 ka{constructor(c){typeof c=="string"?this.name=c:(this.name=c.name,this.iconsetId=c.iconsetId)}static from(c){return new ka(c)}static toString(c){return c.iconsetId?`${c.name}${c.iconsetId}`:c.name}static parse(c){const[h,g]=c.split("");return new ka({name:h,iconsetId:g})}static isEqual(c,h){return c.name===h.name&&c.iconsetId===h.iconsetId}toString(){return ka.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var Wh,cu={},Ll=function(){if(Wh)return cu;Wh=1;var p={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 p)return p[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,ae=g(Z[1]),ge=g(Z[2]),Se=ge<=.5?ge*(ae+1):ge+ae-ge*ae,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 Na{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 Na)return c;if(typeof c!="string")return;const h=Ll.parseCSSColor(c);return h?new Na(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 RP(c,h,g,_,S)}toPremultipliedRenderColor(c){const{r:h,g,b:_,a:S}=this;return new FP(c,h*S,g*S,_*S,S)}clone(){return new Na(this.r,this.g,this.b,this.a)}}class Vk{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),ae=Math.ceil(_),ge=h-$,Se=g-K,Ne=_-Z,Be=c.image.data,qe=4*($+K*z+Z*L),Qe=4*($+K*z+ae*L),vt=4*($+re*z+Z*L),mt=4*($+re*z+ae*L),jt=4*(ee+K*z+Z*L),At=4*(ee+K*z+ae*L),Pt=4*(ee+re*z+Z*L),Qt=4*(ee+re*z+ae*L);if(qe<0||Qt>=Be.length)throw new Error("out of range");this.r=Us(Us(Us(Be[qe],Be[Qe],Ne),Us(Be[vt],Be[mt],Ne),Se),Us(Us(Be[jt],Be[At],Ne),Us(Be[Pt],Be[Qt],Ne),Se),ge)/255*(this.premultiplied?S:1),this.g=Us(Us(Us(Be[qe+1],Be[Qe+1],Ne),Us(Be[vt+1],Be[mt+1],Ne),Se),Us(Us(Be[jt+1],Be[At+1],Ne),Us(Be[Pt+1],Be[Qt+1],Ne),Se),ge)/255*(this.premultiplied?S:1),this.b=Us(Us(Us(Be[qe+2],Be[Qe+2],Ne),Us(Be[vt+2],Be[mt+2],Ne),Se),Us(Us(Be[jt+2],Be[At+2],Ne),Us(Be[Pt+2],Be[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 ae=1/_;c*=ae,h*=ae,g*=ae}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+(CUs(g,c[_],h))}Na.black=new Na(0,0,0,1),Na.white=new Na(1,1,1,1),Na.transparent=new Na(0,0,0,0),Na.red=new Na(1,0,0,1),Na.blue=new Na(0,0,1,1);var $v=Object.freeze({__proto__:null,array:i5,color:function(p,c,h){return new Na(Us(p.r,c.r,h),Us(p.g,c.g,h),Us(p.b,c.b,h),Us(p.a,c.a,h))},number:Us});class ph 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 Gh={kind:"null"},js={kind:"number"},oa={kind:"string"},Va={kind:"boolean"},Gd={kind:"color"},Om={kind:"object"},Oa={kind:"value"},Hk={kind:"collator"},Uv={kind:"formatted"},qv={kind:"resolvedImage"};function Lc(p,c){return{kind:"array",itemType:p,N:c}}function Uo(p){if(p.kind==="array"){const c=Uo(p.itemType);return typeof p.N=="number"?`array<${c}, ${p.N}>`:p.itemType.kind==="value"?"array":`array<${c}>`}return p.kind}const qie=[Gh,js,oa,Va,Gd,Uv,Om,Lc(Oa),qv];function Yf(p,c){if(c.kind==="error")return null;if(p.kind==="array"){if(c.kind==="array"&&(c.N===0&&c.itemType.kind==="value"||!Yf(p.itemType,c.itemType))&&(typeof p.N!="number"||p.N===c.N))return null}else{if(p.kind===c.kind)return null;if(p.kind==="value"){for(const h of qie)if(!Yf(h,c))return null}}return`Expected ${Uo(p)} but found ${Uo(c)} instead.`}function o5(p,c){return c.some(h=>h.kind===p.kind)}function Vv(p,c){return c.some(h=>h==="null"?p===null:h==="array"?Array.isArray(p):h==="object"?p&&!Array.isArray(p)&&typeof p=="object":h===typeof p)}function Wk(p,c){return p.kind==="array"&&c.kind==="array"?p.N===c.N&&Wk(p.itemType,c.itemType):p.kind===c.kind}class l5{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 Gk{constructor(c,h,g,_,S){this.text=c.normalize?c.normalize():c,this.image=h,this.scale=g,this.fontStack=_,this.textColor=S}}class wd{constructor(c){this.sections=c}static fromString(c){return new wd([new Gk(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 wd?c:wd.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 Ep{constructor(c,h={}){this.id=ka.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 Ep(h,{params:g,sx:_,sy:S}):null}scaleSelf(c,h=c){return this.sx*=c,this.sy*=h,this}}class jd{constructor(c,h,g,_,S=!1){this.primaryId=ka.from(c),this.primaryOptions=h,g&&(this.secondaryId=ka.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 Ep(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new Ep(this.secondaryId,this.secondaryOptions):null}static from(c){return typeof c=="string"?jd.build({name:c}):c}static build(c,h,g,_){return!c||typeof c=="object"&&!("name"in c)?null:new jd(c,g,h,_)}}function fx(p,c,h,g){return typeof p=="number"&&p>=0&&p<=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 [${[p,c,h,g].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof g=="number"?[p,c,h,g]:[p,c,h]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function s0(p){if(p===null||typeof p=="string"||typeof p=="boolean"||typeof p=="number"||p instanceof Na||p instanceof l5||p instanceof wd||p instanceof jd)return!0;if(Array.isArray(p)){for(const c of p)if(!s0(c))return!1;return!0}if(typeof p=="object"){for(const c in p)if(!s0(p[c]))return!1;return!0}return!1}function jl(p){if(p===null)return Gh;if(typeof p=="string")return oa;if(typeof p=="boolean")return Va;if(typeof p=="number")return js;if(p instanceof Na)return Gd;if(p instanceof l5)return Hk;if(p instanceof wd)return Uv;if(p instanceof jd)return qv;if(Array.isArray(p)){const c=p.length;let h;for(const g of p){const _=jl(g);if(h){if(h===_)continue;h=Oa;break}h=_}return Lc(h||Oa,c)}return Om}function fh(p){const c=typeof p;return p===null?"":c==="string"||c==="number"||c==="boolean"?String(p):p instanceof wd||p instanceof jd||p instanceof Na?p.toString():JSON.stringify(p)}class Ip{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(!s0(c[1]))return h.error("invalid value");const g=c[1];let _=jl(g);const S=h.expectedType;return _.kind!=="array"||_.N!==0||!S||S.kind!=="array"||typeof S.N=="number"&&S.N!==0||(_=S),new Ip(_,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 Na?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof wd?this.value.serialize():this.value}}class ul{constructor(c){this.name="ExpressionEvaluationError",this.message=c}toJSON(){return this.message}}const c5={string:oa,number:js,boolean:Va,object:Om};class Kh{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 c5)||$==="object")return h.error('The item type argument of "array" must be one of string, number, boolean',1);L=c5[$],_++}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=Lc(L,z)}else g=c5[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 Dm{constructor(c){this.type=Uv,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",js),!z))return null;let $=null;if(L["text-font"]&&($=h.parseObjectValue(L["text-font"],C,"text-font",Lc(oa)),!$))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 Dm(_)}evaluate(c){return new wd(this.sections.map(h=>{const g=h.content.evaluate(c);return Wk(jl(g),qv)?new Gk("",g,null,null,null):new Gk(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 fn{constructor(c,h,g,_){this._imageWarnHistory={},this.type=qv,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(gka.isEqual(C,S)),_.available){const C=_.getSecondary()?_.getSecondary().id:null;C&&(_.available=c.availableImages.some(L=>ka.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 _s(p){return Gs(p)?"string":n0(p)?"number":Zk(p)?"boolean":Array.isArray(p)?"array":p===null?"null":Kk(p)?"object":typeof p}function Kk(p){return p!=null&&!Array.isArray(p)&&typeof p!="function"&&!(p instanceof String||p instanceof Number||p instanceof Boolean)&&typeof p=="object"}function Gs(p){return typeof p=="string"||p instanceof String}function n0(p){return typeof p=="number"||p instanceof Number}function Zk(p){return typeof p=="boolean"||p instanceof Boolean}const Vs={"to-boolean":Va,"to-color":Gd,"to-number":js,"to-string":oa};class Rm{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=Gh;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=Lc(h.expectedType.itemType,C)}else{if(!(C>0&&s0(c[1][0])))return null;S=Lc(jl(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 Na(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new ul(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 ul(`Could not convert ${JSON.stringify(h)} to number.`)}return this.type.kind==="formatted"?wd.fromString(fh(this.args[0].evaluate(c))):this.type.kind==="resolvedImage"?jd.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 Dm([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new fn(this.args[0]).serialize();const c=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(h=>{c.push(h.serialize())}),c}}const d5=["Unknown","Point","LineString","Polygon"];class Yk{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"?d5[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]=Na.parse(c)),h}getConfig(c){return this.options?this.options.get(c):null}}class kd{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=kd.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],_=kd.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 lN(h.registry,h.path,null,h.scope,void 0,h._scope,h.options,h.iconImageUseTheme);const ee=[];let re=!1;for(let ae=1;aeee)).map(Xk).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);Qk(p,c,Math.max(h,Math.floor(c-$*Z/z+ee)),Math.min(g,Math.floor(c+(z-$)*Z/z+ee)),_)}const S=p[c];let C=h,L=g;for(Zh(p,h,c),_(p[g],S)>0&&Zh(p,h,g);C0;)L--}_(p[h],S)===0?Zh(p,h,L):(L++,Zh(p,L,g)),L<=c&&(h=L+1),c<=L&&(g=L-1)}}function Zh(p,c,h){const g=p[c];p[c]=p[h],p[h]=g}function u5(p,c){return pc?1:0}function Xf(p){let c=0;for(let h,g,_=0,S=p.length,C=S-1;_=c[2]||p[1]<=c[1]||p[3]>=c[3])}function Vie(p,c,h){const g=p[0]-c[0],_=p[1]-c[1],S=p[0]-h[0],C=p[1]-h[1];return g*C-S*_==0&&g*S<=0&&_*C<=0}function a0(p,c,h=!1){let g=!1;for(let L=0,z=c.length;L(_=p)[1]!=(C=ae)[1]>_[1]&&_[0]<(C[0]-S[0])*(_[1]-S[1])/(C[1]-S[1])+S[0]&&(g=!g)}}var _,S,C;return g}function Wv(p,c,h,g){const _=g[0]-h[0],S=g[1]-h[1],C=(p[0]-h[0])*S-_*(p[1]-h[1]),L=(c[0]-h[0])*S-_*(c[1]-h[1]);return C>0&&L<0||C<0&&L>0}function Gv(p,c,h,g){return(_=[g[0]-h[0],g[1]-h[1]])[0]*(S=[c[0]-p[0],c[1]-p[1]])[1]-_[1]*S[0]!=0&&!(!Wv(p,c,h,g)||!Wv(h,g,p,c));var _,S}function Pp(p){const c=new or(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),h=new or(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const g of p[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=p[0]-h[0]>_?-g:h[0]-p[0]>_?g:0;S===0&&(S=p[0]-h[2]>_?-g:h[2]-p[0]>_?g:0),p[0]+=S}gh(c,p)}function UP(p,c,h,g){const _=Math.pow(2,g.z)*Qf,S=[g.x*Qf,g.y*Qf],C=[];if(!p)return C;for(const L of p)for(const z of L){const $=[z.x+S[0],z.y+S[1]];$P($,c,h,_),C.push($)}return C}function Jk(p,c,h,g){const _=Math.pow(2,g.z)*Qf,S=[g.x*Qf,g.y*Qf],C=[];if(!p)return C;for(const z of p){const $=[];for(const K of z){const Z=[K.x+S[0],K.y+S[1]];gh(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)$P($,c,h,_)}var L;return C}class eg{constructor(c,h){this.type=Va,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(s0(c[1])){const g=c[1];if(g.type==="FeatureCollection")for(let _=0;_h)return eN(S,C,(h-(g-L))/L)}return c[c.length-1]}pointToSegmentDistance(c,h,g){let[_,S]=h,C=Ou(g[0]-_)*this.kx,L=(g[1]-S)*this.ky;if(C!==0||L!==0){const z=(Ou(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=Ou(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=Ou(h[0]-$)*this.kx,ee=(h[1]-K)*this.ky;const ae=Z*Z+ee*ee;aeS.index||_.index===S.index&&_.t>S.t){const $=_;_=S,S=$}const C=[_.point],L=_.index+1,z=S.index;!p5(g[L],C[0])&&L<=z&&C.push(g[L]);for(let $=L+1;$<=z;$++)C.push(g[$]);return p5(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(eN(L,z,(c-(_-$))/$)),_>=h)return S.push(eN(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 Ou(c[0]-h[0])>=0&&Ou(c[0]-h[2])<=0&&c[1]>=h[1]&&c[1]<=h[3]}}function p5(p,c){return p[0]===c[0]&&p[1]===c[1]}function eN(p,c,h){const g=Ou(c[0]-p[0]);return[p[0]+g*h,p[1]+(c[1]-p[1])*h]}function Ou(p){for(;p<-180;)p+=360;for(;p>180;)p-=360;return p}class tN{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 f5(p,c){return c.dist-p.dist}const rN=100,sN=50;function g5(p){const c=[1/0,1/0,-1/0,-1/0];if(c.length!==p.length)return!1;for(let h=0;h=p[0]&&p[1]p[1])return[null,null];const h=Zv(p);if(c){if(h===2)return[p,null];const g=Math.floor(h/2);return[[p[0],p[0]+g],[p[0]+g,p[1]]]}{if(h===1)return[p,null];const g=Math.floor(h/2)-1;return[[p[0],p[0]+g],[p[0]+g+1,p[1]]]}}function gx(p,c){const h=[1/0,1/0,-1/0,-1/0];if(!Fm(c,p.length))return h;for(let g=c[0];g<=c[1];++g)gh(h,p[g]);return h}function xx(p){const c=[1/0,1/0,-1/0,-1/0];for(let h=0;hc[2]&&(g=p[0]-c[2]),p[1]>c[3]&&(_=p[1]-c[3]),p[3]=g)return g;if(Hv(_,S)){if(v5(p,c))return 0}else if(v5(c,p))return 0;let C=g;for(const L of p)for(let z=0,$=L.length,K=$-1;z<$;K=z++)for(const Z of c)for(let ee=0,re=Z.length,ae=re-1;ee=S)continue;const K=$.range1;if(Zv(K)<=L){if(!Fm(K,p.length))return NaN;if(c){const Z=Yie(p,K,h,g);if((S=Math.min(S,Z))===0)return S}else for(let Z=K[0];Z<=K[1];++Z){const ee=Zie(p[Z],h,g);if((S=Math.min(S,ee))===0)return S}}else{const Z=x5(K,c);if(Z[0]!==null){const ee=tg(gx(p,Z[0]),z,g);ee=C)continue;const Z=K.range1,ee=K.range2;if(Zv(Z)<=z&&Zv(ee)<=$){if(!Fm(Z,p.length)||!Fm(ee,h.length))return NaN;if(c&&g?C=Math.min(C,la(p,Z,h,ee,_)):c||g?c&&!g?C=Math.min(C,y5(h,ee,p,Z,_)):!c&&g&&(C=Math.min(C,y5(p,Z,h,ee,_))):C=Math.min(C,Kie(p,Z,h,ee,_)),C===0)return C}else{const re=x5(Z,c),ae=x5(ee,g);Ri(L,C,_,p,h,re[0],ae[0]),Ri(L,C,_,p,h,re[0],ae[1]),Ri(L,C,_,p,h,re[1],ae[0]),Ri(L,C,_,p,h,re[1],ae[1])}}return C}function _5(p,c,h,g,_=1/0){let S=_;const C=gx(p,[0,p.length-1]);for(const L of h)if(!(S!==1/0&&tg(C,gx(L,[0,L.length-1]),g)>=S)&&(S=Math.min(S,WP(p,c,L,!0,g,S)),S===0))return S;return S}function iN(p,c,h,g,_=1/0){let S=_;const C=gx(p,[0,p.length-1]);for(const L of h){if(S!==1/0&&tg(C,xx(L),g)>=S)continue;const z=Qie(p,c,L,g,S);if(isNaN(z))return z;if((S=Math.min(S,z))===0)return S}return S}function b5(p){return p==="Point"||p==="MultiPoint"||p==="LineString"||p==="MultiLineString"||p==="Polygon"||p==="MultiPolygon"}class yx{constructor(c,h){this.type=js,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(s0(c[1])){const g=c[1];if(g.type==="FeatureCollection"){for(let _=0;_{c&&!l0(h)&&(c=!1)}),c}function Yv(p){if(p instanceof kd&&p.name==="feature-state")return!1;let c=!0;return p.eachChild(h=>{c&&!Yv(h)&&(c=!1)}),c}function c0(p,c){if(p instanceof kd&&c.indexOf(p.name)>=0)return!1;let h=!0;return p.eachChild(g=>{h&&!c0(g,c)&&(h=!1)}),h}function GP(p,c,h){return[p,c,h].filter(Boolean).join("")}function w5(p,c){switch(p){case"string":return fh(c);case"number":return+c;case"boolean":return!!c;case"color":return Na.parse(c);case"formatted":return wd.fromString(fh(c));case"resolvedImage":return jd.build(fh(c))}return c}function KP(p,c,h,g){return g!==void 0&&(p=g*Math.round(p/g)),c!==void 0&&ph&&(p=h),p}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 Ip))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 Ip))return h.error("Scope of 'config' expression must be a string literal.");S=fh(z.value)}if(h.options){const z=GP(L,S,h._scope),$=h.options.get(z);$&&(C=l0($.value||$.default))}return new d0(g,L,S,C)}evaluate(c){const h=GP(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=w5(_,Z)),Z===void 0||L===void 0&&z===void 0&&$===void 0||(typeof Z=="number"?Z=KP(Z,L,z,$):Array.isArray(Z)&&(Z=Z.map(ee=>typeof ee=="number"?KP(ee,L,z,$):ee))),S!==void 0&&Z!==void 0&&C&&!C.includes(Z)&&(Z=K,_&&(Z=w5(_,Z))),(_&&_!==this.type||Z!==void 0&&!Wk(jl(Z),this.type))&&(Z=w5(this.type.kind,Z)),Z}eachChild(){}outputDefined(){return!1}serialize(){const c=["config",this.key];return this.scope&&c.concat(this.scope),c}}class oN{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 oN(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 lN{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 Kh(S,[_]):C==="coerce"?new Rm(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 Ip)&&S.type.kind!=="resolvedImage"&&j5(S)){const C=new Yk(this._scope,this.options,this.iconImageUseTheme);try{S=new Ip(S.type,S.evaluate(C))}catch(L){return this.error(L.message),null}}return S}return Rm.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 lN(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 ph(g,c))}checkSubtype(c,h){const g=Yf(c,h);return g&&this.error(g),g}}function j5(p){if(p instanceof oN)return j5(p.boundExpression);if(p instanceof kd&&p.name==="error"||p instanceof Ol||p instanceof eg||p instanceof yx||p instanceof d0)return!1;const c=p instanceof Rm||p instanceof Kh;let h=!0;return p.eachChild(g=>{h=c?h&&j5(g):h&&g instanceof Ip}),!!h&&l0(p)&&c0(p,["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 cN(p,c){const h=p.length-1;let g,_,S=0,C=h,L=0;for(;S<=C;)if(L=Math.floor((S+C)/2),g=p[L],_=p[L+1],g<=c){if(L===h||c<_)return L;S=L+1}else{if(!(g>c))throw new ul("Input is not a number.");C=L-1}return 0}class Xv{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,js);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 Xv(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[cN(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 ZP=.95047,YP=1.08883,XP=4/29,u0=6/29,QP=3*u0*u0,Jie=u0*u0*u0,eoe=Math.PI/180,toe=180/Math.PI;function k5(p){return p>Jie?Math.pow(p,1/3):p/QP+XP}function N5(p){return p>u0?p*p*p:QP*(p-XP)}function S5(p){return 255*(p<=.0031308?12.92*p:1.055*Math.pow(p,1/2.4)-.055)}function C5(p){return(p/=255)<=.04045?p/12.92:Math.pow((p+.055)/1.055,2.4)}function JP(p){const c=C5(p.r),h=C5(p.g),g=C5(p.b),_=k5((.4124564*c+.3575761*h+.1804375*g)/ZP),S=k5((.2126729*c+.7151522*h+.072175*g)/1);return{l:116*S-16,a:500*(_-S),b:200*(S-k5((.0193339*c+.119192*h+.9503041*g)/YP)),alpha:p.a}}function dN(p){let c=(p.l+16)/116,h=isNaN(p.a)?c:c+p.a/500,g=isNaN(p.b)?c:c-p.b/200;return c=1*N5(c),h=ZP*N5(h),g=YP*N5(g),new Na(S5(3.2404542*h-1.5371385*c-.4985314*g),S5(-.969266*h+1.8760108*c+.041556*g),S5(.0556434*h-.2040259*c+1.0572252*g),p.alpha)}function uN(p,c,h){const g=c-p;return p+h*(g>180||g<-180?g-360*Math.round(g/360):g)}const h0={forward:JP,reverse:dN,interpolate:function(p,c,h){return{l:Us(p.l,c.l,h),a:Us(p.a,c.a,h),b:Us(p.b,c.b,h),alpha:Us(p.alpha,c.alpha,h)}}},Qv={forward:function(p){const{l:c,a:h,b:g}=JP(p),_=Math.atan2(g,h)*toe;return{h:_<0?_+360:_,c:Math.sqrt(h*h+g*g),l:c,alpha:p.a}},reverse:function(p){const c=p.h*eoe,h=p.c;return dN({l:p.l,a:Math.cos(c)*h,b:Math.sin(c)*h,alpha:p.alpha})},interpolate:function(p,c,h){return{h:uN(p.h,c.h,h),c:Us(p.c,c.c,h),l:Us(p.l,c.l,h),alpha:Us(p.alpha,c.alpha,h)}}};var e6=Object.freeze({__proto__:null,hcl:Qv,lab:h0});class Du{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=hN(h,c.base,g,_);else if(c.name==="linear")S=hN(h,1,g,_);else if(c.name==="cubic-bezier"){const C=c.controlPoints;S=new Ci(C[0],C[1],C[2],C[3]).solve(hN(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,js),!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 ae=h.parse(Z,re,z);if(!ae)return null;z=z||ae.type,L.push([K,ae])}return z.kind==="number"||z.kind==="color"||z.kind==="array"&&z.itemType.kind==="number"&&typeof z.N=="number"?new Du(z,g,_,S,L):h.error(`Type ${Uo(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=cN(h,_),L=Du.interpolationFactor(this.interpolation,_,h[C],h[C+1]),z=g[C].evaluate(c),$=g[C+1].evaluate(c);return this.operator==="interpolate"?$v[this.type.kind.toLowerCase()](z,$,L):this.operator==="interpolate-hcl"?Qv.reverse(Qv.interpolate(Qv.forward(z),Qv.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;gYf(_,L.type));return new Jv(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 jd&&!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 Lp{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 ul("Array index out of bounds: index exceeds array size");if(h!==Math.floor(h))throw new ul("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 pN{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,js),_=h.parse(c[2],2,Lc(h.expectedType||Oa));return g&&_?new pN(_.type.itemType,g,_):null}evaluate(c){const h=this.index.evaluate(c),g=this.input.evaluate(c);if(h<0)throw new ul(`Array index out of bounds: ${h} < 0.`);if(h>g.length-1)throw new ul(`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 ul(`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 M5{constructor(c,h){this.type=Va,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&&_?o5(g.type,[Va,oa,js,Gh,Oa])?new M5(g,_):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${Uo(g.type)} instead`):null}evaluate(c){const h=this.needle.evaluate(c),g=this.haystack.evaluate(c);if(g==null)return!1;if(!Vv(h,["boolean","string","number","null"]))throw new ul(`Expected first argument to be of type boolean, string, number or null, but found ${Uo(jl(h))} instead.`);if(!Vv(g,["string","array"]))throw new ul(`Expected second argument to be of type array or string, but found ${Uo(jl(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=js,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(!o5(g.type,[Va,oa,js,Gh,Oa]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${Uo(g.type)} instead`);if(c.length===4){const S=h.parse(c[3],3,js);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(!Vv(h,["boolean","string","number","null"]))throw new ul(`Expected first argument to be of type boolean, string, number or null, but found ${Uo(jl(h))} instead.`);if(!Vv(g,["string","array"]))throw new ul(`Expected second argument to be of type array or string, but found ${Uo(jl(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 e_{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 ae=="number"&&Math.floor(ae)!==ae)return ee.error("Numeric branch labels must be integer values.");if(g){if(ee.checkSubtype(g,jl(ae)))return null}else g=jl(ae);if(S[String(ae)]!==void 0)return ee.error("Branch labels must be unique.");S[String(ae)]=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 e_(g,_,L,S,C,z):null}evaluate(c){const h=this.input.evaluate(c);return(Wk(jl(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 t_{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 fN{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,js);if(!g||!_)return null;if(!o5(g.type,[Lc(Oa),oa,Oa]))return h.error(`Expected first argument to be of type array or string, but found ${Uo(g.type)} instead`);if(c.length===4){const S=h.parse(c[3],3,js);return S?new fN(g.type,g,_,S):null}return new fN(g.type,g,_)}evaluate(c){const h=this.input.evaluate(c),g=this.beginIndex.evaluate(c);if(!Vv(h,["string","array"]))throw new ul(`Expected first argument to be of type array or string, but found ${Uo(jl(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 T5{constructor(c,h){this.type=Lc(oa),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,oa),_=h.parse(c[2],2,oa);return g&&_?new T5(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 A5(p,c){return p==="=="||p==="!="?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 E5(p,c,h,g){return g.compare(c,h)===0}function p0(p,c,h){const g=p!=="=="&&p!=="!=";return class $Oe{constructor(S,C,L){this.type=Va,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(!A5(L,z.type))return C.concat(1).error(`"${L}" comparisons are not supported for type '${Uo(z.type)}'.`);let $=C.parse(S[2],2,Oa);if(!$)return null;if(!A5(L,$.type))return C.concat(2).error(`"${L}" comparisons are not supported for type '${Uo($.type)}'.`);if(z.type.kind!==$.type.kind&&z.type.kind!=="value"&&$.type.kind!=="value")return C.error(`Cannot compare types '${Uo(z.type)}' and '${Uo($.type)}'.`);g&&(z.type.kind==="value"&&$.type.kind!=="value"?z=new Kh($.type,[z]):z.type.kind!=="value"&&$.type.kind==="value"&&($=new Kh(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,Hk),!K)return null}return new $Oe(z,$,K)}evaluate(S){const C=this.lhs.evaluate(S),L=this.rhs.evaluate(S);if(g&&this.hasUntypedArgument){const z=jl(C),$=jl(L);if(z.kind!==$.kind||z.kind!=="string"&&z.kind!=="number")throw new ul(`Expected arguments for "${p}" to be (string, string) or (number, number), but found (${z.kind}, ${$.kind}) instead.`)}if(this.collator&&!g&&this.hasUntypedArgument){const z=jl(C),$=jl(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=[p];return this.eachChild(C=>{S.push(C.serialize())}),S}}}const roe=p0("==",function(p,c,h){return c===h},E5),soe=p0("!=",function(p,c,h){return c!==h},function(p,c,h,g){return!E5(0,c,h,g)}),t6=p0("<",function(p,c,h){return c",function(p,c,h){return c>h},function(p,c,h,g){return g.compare(c,h)>0}),gN=p0("<=",function(p,c,h){return c<=h},function(p,c,h,g){return g.compare(c,h)<=0}),noe=p0(">=",function(p,c,h){return c>=h},function(p,c,h,g){return g.compare(c,h)>=0});class xN{constructor(c,h,g,_,S,C){this.type=oa,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,js);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",oa),!S))return null;let C=null;if(_.currency&&(C=h.parseObjectValue(_.currency,2,"currency",oa),!C))return null;let L=null;if(_.unit&&(L=h.parseObjectValue(_.unit,2,"unit",oa),!L))return null;let z=null;if(_["min-fraction-digits"]&&(z=h.parseObjectValue(_["min-fraction-digits"],2,"min-fraction-digits",js),!z))return null;let $=null;return _["max-fraction-digits"]&&($=h.parseObjectValue(_["max-fraction-digits"],2,"max-fraction-digits",js),!$)?null:new xN(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 I5{constructor(c){this.type=js,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 ${Uo(g.type)} instead.`):new I5(g):null}evaluate(c){const h=this.input.evaluate(c);if(typeof h=="string"||Array.isArray(h))return h.length;throw new ul(`Expected value to be of type string or array, but found ${Uo(jl(h))} instead.`)}eachChild(c){c(this.input)}outputDefined(){return!1}serialize(){const c=["length"];return this.eachChild(h=>{c.push(h.serialize())}),c}}function s6(p){return function(){p=1831565813+(p|=0)|0;let c=Math.imul(p^p>>>15,1|p);return c=c+Math.imul(c^c>>>7,61|c)^c,((c^c>>>14)>>>0)/4294967296}}const f0={"==":roe,"!=":soe,">":r6,"<":t6,">=":noe,"<=":gN,array:Kh,at:mN,"at-interpolated":pN,boolean:Kh,case:t_,coalesce:Jv,collator:Ol,format:Dm,image:fn,in:M5,"index-of":m0,interpolate:Du,"interpolate-hcl":Du,"interpolate-lab":Du,length:I5,let:Lp,literal:Ip,match:e_,number:Kh,"number-format":xN,object:Kh,slice:fN,step:Xv,string:Kh,"to-boolean":Rm,"to-color":Rm,"to-number":Rm,"to-string":Rm,var:oN,within:eg,distance:yx,config:d0,split:T5};function P5(p,[c,h,g,_]){c=c.evaluate(p),h=h.evaluate(p),g=g.evaluate(p);const S=_?_.evaluate(p):1,C=fx(c,h,g,S);if(C)throw new ul(C);return new Na(c/255,h/255,g/255,S)}function L5(p,[c,h,g,_]){c=c.evaluate(p),h=h.evaluate(p),g=g.evaluate(p);const S=_?_.evaluate(p):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 ul(C);const L=`hsla(${c}, ${h}%, ${g}%, ${S})`,z=Na.parse(L);if(!z)throw new ul(`Failed to parse HSLA color: ${L}`);return z}function n6(p,c){return p in c}function O5(p,c){const h=c[p];return h===void 0?null:h}function sg(p){return{type:p}}function vx(p){if(p instanceof d0)return new Set([p.key]);let c=new Set;return p.eachChild(h=>{c=new Set([...c,...vx(h)])}),c}function yN(p){if(p instanceof kd&&p.name==="is-active-floor")return!0;let c=!1;return p.eachChild(h=>{!c&&yN(h)&&(c=!0)}),c}function a6(p){return{result:"success",value:p}}function ng(p){return{result:"error",value:p}}function D5(p,c){return!!p&&!!p.parameters&&p.parameters.indexOf(c)>-1}function r_(p){return p["property-type"]==="data-driven"}function i6(p){return D5(p.expression,"measure-light")}function o6(p){return D5(p.expression,"zoom")}function vN(p){return!!p.expression&&p.expression.interpolated}function _N(p){return typeof p=="object"&&p!==null&&!Array.isArray(p)}function l6(p){return p}function c6(p,c){const h=c.type==="color",g=p.stops&&typeof p.stops[0][0]=="object",_=g||!(g||p.property!==void 0),S=p.type||(vN(c)?"exponential":"interval");if(h&&((p=Object.assign({},p)).stops&&(p.stops=p.stops.map($=>[$[0],Na.parse($[1])])),p.default=Na.parse(p.default?p.default:c.default)),p.colorSpace&&p.colorSpace!=="rgb"&&!e6[p.colorSpace])throw new Error(`Unknown color space: ${p.colorSpace}`);let C,L,z;if(S==="exponential")C=d6;else if(S==="interval")C=ioe;else if(S==="categorical"){C=aoe,L=Object.create(null);for(const $ of p.stops)L[$[0]]=$[1];z=typeof p.stops[0][0]}else{if(S!=="identity")throw new Error(`Unknown function type "${S}"`);C=u6}if(g){const $={},K=[];for(let re=0;rere[0]),evaluate:({zoom:re},ae)=>d6({stops:Z,base:p.base},c,re).evaluate(re,ae)}}if(_){const $=S==="exponential"?{name:"exponential",base:p.base!==void 0?p.base:1}:null;return{kind:"camera",interpolationType:$,interpolationFactor:Du.interpolationFactor.bind(void 0,$),zoomStops:p.stops.map(K=>K[0]),evaluate:({zoom:K})=>C(p,c,K,L,z)}}return{kind:"source",evaluate($,K){const Z=K&&K.properties?K.properties[p.property]:void 0;return Z===void 0?zm(p.default,c.default):C(p,c,Z,L,z)}}}function zm(p,c,h){return p!==void 0?p:c!==void 0?c:h!==void 0?h:void 0}function aoe(p,c,h,g,_){return zm(typeof h===_?g[h]:void 0,p.default,c.default)}function ioe(p,c,h){if(!n0(h))return zm(p.default,c.default);const g=p.stops.length;if(g===1||h<=p.stops[0][0])return p.stops[0][1];if(h>=p.stops[g-1][0])return p.stops[g-1][1];const _=cN(p.stops.map(S=>S[0]),h);return p.stops[_][1]}function d6(p,c,h){const g=p.base!==void 0?p.base:1;if(!n0(h))return zm(p.default,c.default);const _=p.stops.length;if(_===1||h<=p.stops[0][0])return p.stops[0][1];if(h>=p.stops[_-1][0])return p.stops[_-1][1];const S=cN(p.stops.map(K=>K[0]),h),C=function(K,Z,ee,re){const ae=re-ee,ge=K-ee;return ae===0?0:Z===1?ge/ae:(Math.pow(Z,ge)-1)/(Math.pow(Z,ae)-1)}(h,g,p.stops[S][0],p.stops[S+1][0]),L=p.stops[S][1],z=p.stops[S+1][1];let $=$v[c.type]||l6;if(p.colorSpace&&p.colorSpace!=="rgb"){const K=e6[p.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 u6(p,c,h){return c.type==="color"?h=Na.parse(h):c.type==="formatted"?h=wd.fromString(h.toString()):c.type==="resolvedImage"?h=jd.build(h.toString()):_s(h)===c.type||c.type==="enum"&&c.values[h]||(h=void 0),zm(h,p.default,c.default)}kd.register(f0,{error:[{kind:"error"},[oa],(p,[c])=>{throw new ul(c.evaluate(p))}],typeof:[oa,[Oa],(p,[c])=>Uo(jl(c.evaluate(p)))],"to-rgba":[Lc(js,4),[Gd],(p,[c])=>c.evaluate(p).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[Lc(js,4),[Gd],(p,[c])=>c.evaluate(p).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[Gd,[js,js,js],P5],rgba:[Gd,[js,js,js,js],P5],hsl:[Gd,[js,js,js],L5],hsla:[Gd,[js,js,js,js],L5],has:{type:Va,overloads:[[[oa],(p,[c])=>n6(c.evaluate(p),p.properties())],[[oa,Om],(p,[c,h])=>n6(c.evaluate(p),h.evaluate(p))]]},get:{type:Oa,overloads:[[[oa],(p,[c])=>O5(c.evaluate(p),p.properties())],[[oa,Om],(p,[c,h])=>O5(c.evaluate(p),h.evaluate(p))]]},"feature-state":[Oa,[oa],(p,[c])=>O5(c.evaluate(p),p.featureState||{})],properties:[Om,[],p=>p.properties()],"geometry-type":[oa,[],p=>p.geometryType()],worldview:[oa,[],p=>p.globals.worldview||""],"is-active-floor":[Va,sg(oa),(p,c)=>{if(!(p.globals.activeFloors&&p.globals.activeFloors.size>0))return!1;const h=p.globals.activeFloors;return c.some(g=>{const _=g.evaluate(p);return h.has(_)})}],id:[Oa,[],p=>p.id()],zoom:[js,[],p=>p.globals.zoom],pitch:[js,[],p=>p.globals.pitch||0],"distance-from-center":[js,[],p=>p.distanceFromCenter()],"measure-light":[js,[oa],(p,[c])=>p.measureLight(c.evaluate(p))],"heatmap-density":[js,[],p=>p.globals.heatmapDensity||0],"line-progress":[js,[],p=>p.globals.lineProgress||0],"raster-value":[js,[],p=>p.globals.rasterValue||0],"raster-particle-speed":[js,[],p=>p.globals.rasterParticleSpeed||0],"sky-radial-progress":[js,[],p=>p.globals.skyRadialProgress||0],accumulated:[Oa,[],p=>p.globals.accumulated===void 0?null:p.globals.accumulated],"+":[js,sg(js),(p,c)=>{let h=0;for(const g of c)h+=g.evaluate(p);return h}],"*":[js,sg(js),(p,c)=>{let h=1;for(const g of c)h*=g.evaluate(p);return h}],"-":{type:js,overloads:[[[js,js],(p,[c,h])=>c.evaluate(p)-h.evaluate(p)],[[js],(p,[c])=>-c.evaluate(p)]]},"/":[js,[js,js],(p,[c,h])=>c.evaluate(p)/h.evaluate(p)],"%":[js,[js,js],(p,[c,h])=>c.evaluate(p)%h.evaluate(p)],ln2:[js,[],()=>Math.LN2],pi:[js,[],()=>Math.PI],e:[js,[],()=>Math.E],"^":[js,[js,js],(p,[c,h])=>Math.pow(c.evaluate(p),h.evaluate(p))],sqrt:[js,[js],(p,[c])=>Math.sqrt(c.evaluate(p))],log10:[js,[js],(p,[c])=>Math.log(c.evaluate(p))/Math.LN10],ln:[js,[js],(p,[c])=>Math.log(c.evaluate(p))],log2:[js,[js],(p,[c])=>Math.log2(c.evaluate(p))],sin:[js,[js],(p,[c])=>Math.sin(c.evaluate(p))],cos:[js,[js],(p,[c])=>Math.cos(c.evaluate(p))],tan:[js,[js],(p,[c])=>Math.tan(c.evaluate(p))],asin:[js,[js],(p,[c])=>Math.asin(c.evaluate(p))],acos:[js,[js],(p,[c])=>Math.acos(c.evaluate(p))],atan:[js,[js],(p,[c])=>Math.atan(c.evaluate(p))],min:[js,sg(js),(p,c)=>Math.min(...c.map(h=>h.evaluate(p)))],max:[js,sg(js),(p,c)=>Math.max(...c.map(h=>h.evaluate(p)))],abs:[js,[js],(p,[c])=>Math.abs(c.evaluate(p))],round:[js,[js],(p,[c])=>{const h=c.evaluate(p);return h<0?-Math.round(-h):Math.round(h)}],floor:[js,[js],(p,[c])=>Math.floor(c.evaluate(p))],ceil:[js,[js],(p,[c])=>Math.ceil(c.evaluate(p))],"filter-==":[Va,[oa,Oa],(p,[c,h])=>p.properties()[c.value]===h.value],"filter-id-==":[Va,[Oa],(p,[c])=>p.id()===c.value],"filter-type-==":[Va,[oa],(p,[c])=>p.geometryType()===c.value],"filter-<":[Va,[oa,Oa],(p,[c,h])=>{const g=p.properties()[c.value],_=h.value;return typeof g==typeof _&&g<_}],"filter-id-<":[Va,[Oa],(p,[c])=>{const h=p.id(),g=c.value;return typeof h==typeof g&&h":[Va,[oa,Oa],(p,[c,h])=>{const g=p.properties()[c.value],_=h.value;return typeof g==typeof _&&g>_}],"filter-id->":[Va,[Oa],(p,[c])=>{const h=p.id(),g=c.value;return typeof h==typeof g&&h>g}],"filter-<=":[Va,[oa,Oa],(p,[c,h])=>{const g=p.properties()[c.value],_=h.value;return typeof g==typeof _&&g<=_}],"filter-id-<=":[Va,[Oa],(p,[c])=>{const h=p.id(),g=c.value;return typeof h==typeof g&&h<=g}],"filter->=":[Va,[oa,Oa],(p,[c,h])=>{const g=p.properties()[c.value],_=h.value;return typeof g==typeof _&&g>=_}],"filter-id->=":[Va,[Oa],(p,[c])=>{const h=p.id(),g=c.value;return typeof h==typeof g&&h>=g}],"filter-has":[Va,[Oa],(p,[c])=>c.value in p.properties()],"filter-has-id":[Va,[],p=>p.id()!==null&&p.id()!==void 0],"filter-type-in":[Va,[Lc(oa)],(p,[c])=>c.value.indexOf(p.geometryType())>=0],"filter-id-in":[Va,[Lc(Oa)],(p,[c])=>c.value.indexOf(p.id())>=0],"filter-in-small":[Va,[oa,Lc(Oa)],(p,[c,h])=>h.value.indexOf(p.properties()[c.value])>=0],"filter-in-large":[Va,[oa,Lc(Oa)],(p,[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}(p.properties()[c.value],h.value,0,h.value.length-1)],all:{type:Va,overloads:[[[Va,Va],(p,[c,h])=>c.evaluate(p)&&h.evaluate(p)],[sg(Va),(p,c)=>{for(const h of c)if(!h.evaluate(p))return!1;return!0}]]},any:{type:Va,overloads:[[[Va,Va],(p,[c,h])=>c.evaluate(p)||h.evaluate(p)],[sg(Va),(p,c)=>{for(const h of c)if(h.evaluate(p))return!0;return!1}]]},"!":[Va,[Va],(p,[c])=>!c.evaluate(p)],"is-supported-script":[Va,[oa],(p,[c])=>{const h=p.globals&&p.globals.isSupportedScript;return!h||h(c.evaluate(p))}],upcase:[oa,[oa],(p,[c])=>c.evaluate(p).toUpperCase()],downcase:[oa,[oa],(p,[c])=>c.evaluate(p).toLowerCase()],concat:[oa,sg(Oa),(p,c)=>c.map(h=>fh(h.evaluate(p))).join("")],"resolved-locale":[oa,[Hk],(p,[c])=>c.evaluate(p).resolvedLocale()],random:[js,[js,js,Oa],(p,c)=>{const[h,g,_]=c.map(C=>C.evaluate(p));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 s_(p){return Array.isArray(p)&&p.length>0&&typeof p[0]=="string"&&p[0]in f0}function ag(p,c,h,g,_){const S=new lN(f0,[],c?function(L){const z={color:Gd,string:oa,number:js,enum:oa,boolean:Va,formatted:Uv,resolvedImage:qv};return L.type==="array"?Lc(z[L.value]||Oa,L.length):z[L.type]}(c):void 0,void 0,void 0,h,g,_),C=S.parse(p,void 0,void 0,void 0,c&&c.type==="string"?{typeAnnotation:"coerce"}:void 0);return C?a6(new bN(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"&&!Yv(h.expression),this.configDependencies=vx(h.expression),this.isIndoorDependent=yN(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 _x{constructor(c,h,g,_,S,C){this.kind=c,this.zoomStops=g,this._styleExpression=h,this.isStateDependent=c!=="camera"&&!Yv(h.expression),this.isIndoorDependent=yN(h.expression),this.isLightConstant=S,this.isLineProgressConstant=C,this.configDependencies=vx(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?Du.interpolationFactor(this.interpolationType,c,h,g):0}}function R5(p,c,h,g,_){if((p=ag(p,c,h,g,_)).result==="error")return p;const S=p.value.expression,C=l0(S);if(!C&&!r_(c))return ng([new ph("","data expressions not supported")]);const L=c0(S,["zoom","pitch","distance-from-center"]);if(!L&&!o6(c))return ng([new ph("","zoom expressions not supported")]);const z=c0(S,["measure-light"]);if(!z&&!i6(c))return ng([new ph("","measure-light expression not supported")]);const $=c0(S,["line-progress"]);if(!$&&!function(ee){return D5(ee.expression,"line-progress")}(c))return ng([new ph("","line-progress expression not supported")]);const K=c.expression&&c.expression.relaxZoomRestriction,Z=Yh(S);return Z||L||K?Z instanceof ph?ng([Z]):Z instanceof Du&&!vN(c)?ng([new ph("",'"interpolate" expressions cannot be used with this property')]):a6(Z?new _x(C&&$?"camera":"composite",p.value,Z.labels,Z instanceof Du?Z.interpolation:void 0,z,$):new g0(C&&$?"constant":"source",p.value,z,$)):ng([new ph("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class wN{constructor(c,h){this._parameters=c,this._specification=h,Object.assign(this,c6(this._parameters,this._specification))}static deserialize(c){return new wN(c._parameters,c._specification)}static serialize(c){return{_parameters:c._parameters,_specification:c._specification}}}function Yh(p){let c=null;if(p instanceof Lp)c=Yh(p.result);else if(p instanceof Jv){for(const h of p.args)if(c=Yh(h),c)break}else(p instanceof Xv||p instanceof Du)&&p.input instanceof kd&&p.input.name==="zoom"&&(c=p);return c instanceof ph||p.eachChild(h=>{const g=Yh(h);g instanceof ph?c=g:c&&g&&c!==g&&(c=new ph("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),c}var F5,h6,m6=function(){if(h6)return F5;h6=1,F5=c;var p=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[ae]=!0,L.push(Z[ae])):z[ae]=!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),ae=K;ae<=ee;ae++)for(var ge=Z;ge<=re;ge++){var Se=this.d*ge+ae;if((!$||$(this._convertFromCellCoord(ae),this._convertFromCellCoord(ge),this._convertFromCellCoord(ae+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=p+this.cells.length+1+1,_=0,S=0;S=0||(_[S]=Op(p[S],c)));p instanceof Error&&(_.message=p.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 p)}function ig(p){if(p==null||typeof p=="boolean"||typeof p=="number"||typeof p=="string"||p instanceof Boolean||p instanceof Number||p instanceof String||p instanceof Date||p instanceof RegExp||n_(p)||p instanceof ImageBitmap||ArrayBuffer.isView(p)||p instanceof ImageData)return p;if(Array.isArray(p))return p.map(ig);if(typeof p=="object"){const c=p.$name||"Object";if(c==="Map"){const _=p.entries||[],S=new Map;for(let C=0;C<_.length;C+=2)S.set(ig(_[C]),ig(_[C+1]));return S}if(c==="Set"){const _=new Set;for(const S of Object.keys(p))S!=="$name"&&_.add(ig(p[S]));return _}if(c==="BigInt")return BigInt(p.value);const{klass:h}=bx[c];if(!h)throw new Error(`Can't deserialize unregistered class "${c}".`);if(h.deserialize)return h.deserialize(p);const g=Object.create(h.prototype);for(const _ of Object.keys(p))_!=="$name"&&(g[_]=ig(p[_]));return g}throw new Error("can't deserialize object of type "+typeof p)}const Ps={"Latin-1 Supplement":p=>p>=128&&p<=255,Arabic:p=>p>=1536&&p<=1791,"Arabic Supplement":p=>p>=1872&&p<=1919,"Arabic Extended-A":p=>p>=2208&&p<=2303,"Hangul Jamo":p=>p>=4352&&p<=4607,"Unified Canadian Aboriginal Syllabics":p=>p>=5120&&p<=5759,Khmer:p=>p>=6016&&p<=6143,"Unified Canadian Aboriginal Syllabics Extended":p=>p>=6320&&p<=6399,"General Punctuation":p=>p>=8192&&p<=8303,"Letterlike Symbols":p=>p>=8448&&p<=8527,"Number Forms":p=>p>=8528&&p<=8591,"Miscellaneous Technical":p=>p>=8960&&p<=9215,"Control Pictures":p=>p>=9216&&p<=9279,"Optical Character Recognition":p=>p>=9280&&p<=9311,"Enclosed Alphanumerics":p=>p>=9312&&p<=9471,"Geometric Shapes":p=>p>=9632&&p<=9727,"Miscellaneous Symbols":p=>p>=9728&&p<=9983,"Miscellaneous Symbols and Arrows":p=>p>=11008&&p<=11263,"CJK Radicals Supplement":p=>p>=11904&&p<=12031,"Kangxi Radicals":p=>p>=12032&&p<=12255,"Ideographic Description Characters":p=>p>=12272&&p<=12287,"CJK Symbols and Punctuation":p=>p>=12288&&p<=12351,Hiragana:p=>p>=12352&&p<=12447,Katakana:p=>p>=12448&&p<=12543,Bopomofo:p=>p>=12544&&p<=12591,"Hangul Compatibility Jamo":p=>p>=12592&&p<=12687,Kanbun:p=>p>=12688&&p<=12703,"Bopomofo Extended":p=>p>=12704&&p<=12735,"CJK Strokes":p=>p>=12736&&p<=12783,"Katakana Phonetic Extensions":p=>p>=12784&&p<=12799,"Enclosed CJK Letters and Months":p=>p>=12800&&p<=13055,"CJK Compatibility":p=>p>=13056&&p<=13311,"CJK Unified Ideographs Extension A":p=>p>=13312&&p<=19903,"Yijing Hexagram Symbols":p=>p>=19904&&p<=19967,"CJK Unified Ideographs":p=>p>=19968&&p<=40959,"Yi Syllables":p=>p>=40960&&p<=42127,"Yi Radicals":p=>p>=42128&&p<=42191,"Hangul Jamo Extended-A":p=>p>=43360&&p<=43391,"Hangul Syllables":p=>p>=44032&&p<=55215,"Hangul Jamo Extended-B":p=>p>=55216&&p<=55295,"Private Use Area":p=>p>=57344&&p<=63743,"CJK Compatibility Ideographs":p=>p>=63744&&p<=64255,"Arabic Presentation Forms-A":p=>p>=64336&&p<=65023,"Vertical Forms":p=>p>=65040&&p<=65055,"CJK Compatibility Forms":p=>p>=65072&&p<=65103,"Small Form Variants":p=>p>=65104&&p<=65135,"Arabic Presentation Forms-B":p=>p>=65136&&p<=65279,"Halfwidth and Fullwidth Forms":p=>p>=65280&&p<=65519,Osage:p=>p>=66736&&p<=66815,"CJK Unified Ideographs Extension B":p=>p>=131072&&p<=173791};function a_(p){for(const c of p)if(jN(c.charCodeAt(0)))return!0;return!1}function z5(p){for(const c of p)if(!p6(c.charCodeAt(0)))return!1;return!0}function p6(p){return!(Ps.Arabic(p)||Ps["Arabic Supplement"](p)||Ps["Arabic Extended-A"](p)||Ps["Arabic Presentation Forms-A"](p)||Ps["Arabic Presentation Forms-B"](p))}function jN(p){return!(p!==746&&p!==747&&(p<4352||!(Ps["Bopomofo Extended"](p)||Ps.Bopomofo(p)||Ps["CJK Compatibility Forms"](p)&&!(p>=65097&&p<=65103)||Ps["CJK Compatibility Ideographs"](p)||Ps["CJK Compatibility"](p)||Ps["CJK Radicals Supplement"](p)||Ps["CJK Strokes"](p)||!(!Ps["CJK Symbols and Punctuation"](p)||p>=12296&&p<=12305||p>=12308&&p<=12319||p===12336)||Ps["CJK Unified Ideographs Extension A"](p)||Ps["CJK Unified Ideographs"](p)||Ps["Enclosed CJK Letters and Months"](p)||Ps["Hangul Compatibility Jamo"](p)||Ps["Hangul Jamo Extended-A"](p)||Ps["Hangul Jamo Extended-B"](p)||Ps["Hangul Jamo"](p)||Ps["Hangul Syllables"](p)||Ps.Hiragana(p)||Ps["Ideographic Description Characters"](p)||Ps.Kanbun(p)||Ps["Kangxi Radicals"](p)||Ps["Katakana Phonetic Extensions"](p)||Ps.Katakana(p)&&p!==12540||!(!Ps["Halfwidth and Fullwidth Forms"](p)||p===65288||p===65289||p===65293||p>=65306&&p<=65310||p===65339||p===65341||p===65343||p>=65371&&p<=65503||p===65507||p>=65512&&p<=65519)||!(!Ps["Small Form Variants"](p)||p>=65112&&p<=65118||p>=65123&&p<=65126)||Ps["Unified Canadian Aboriginal Syllabics"](p)||Ps["Unified Canadian Aboriginal Syllabics Extended"](p)||Ps["Vertical Forms"](p)||Ps["Yijing Hexagram Symbols"](p)||Ps["Yi Syllables"](p)||Ps["Yi Radicals"](p))))}function kN(p){return!(jN(p)||function(c){return!!(Ps["Latin-1 Supplement"](c)&&(c===167||c===169||c===174||c===177||c===188||c===189||c===190||c===215||c===247)||Ps["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)||Ps["Letterlike Symbols"](c)||Ps["Number Forms"](c)||Ps["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)||Ps["Control Pictures"](c)&&c!==9251||Ps["Optical Character Recognition"](c)||Ps["Enclosed Alphanumerics"](c)||Ps["Geometric Shapes"](c)||Ps["Miscellaneous Symbols"](c)&&!(c>=9754&&c<=9759)||Ps["Miscellaneous Symbols and Arrows"](c)&&(c>=11026&&c<=11055||c>=11088&&c<=11097||c>=11192&&c<=11243)||Ps["CJK Symbols and Punctuation"](c)||Ps.Katakana(c)||Ps["Private Use Area"](c)||Ps["CJK Compatibility Forms"](c)||Ps["Small Form Variants"](c)||Ps["Halfwidth and Fullwidth Forms"](c)||c===8734||c===8756||c===8757||c>=9984&&c<=10087||c>=10102&&c<=10131||c===65532||c===65533)}(p))}function NN(p){return Ps.Arabic(p)||Ps["Arabic Supplement"](p)||Ps["Arabic Extended-A"](p)||Ps["Arabic Presentation Forms-A"](p)||Ps["Arabic Presentation Forms-B"](p)}function B5(p){return p>=1424&&p<=2303||Ps["Arabic Presentation Forms-A"](p)||Ps["Arabic Presentation Forms-B"](p)}function Dp(p,c){return!(!c&&B5(p)||p>=2304&&p<=3583||p>=3840&&p<=4255||Ps.Khmer(p))}function ooe(p){for(const c of p)if(B5(c.charCodeAt(0)))return!0;return!1}const du={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let $5=null,Nd=du.unavailable,Rp=null;const i_=function(p){p&&typeof p=="string"&&p.indexOf("NetworkError")>-1&&(Nd=du.error),$5&&$5(p)};function SN(){CN.fire(new Lr("pluginStateChange",{pluginStatus:Nd,pluginURL:Rp}))}const CN=new Rn,o_=function(){return Nd},f6=function(){if(Nd!==du.deferred||!Rp)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Nd=du.loading,SN(),Rp&&Lu({url:Rp},p=>{p?i_(p):(Nd=du.loaded,SN())})},Fp={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Nd===du.loaded||Fp.applyArabicShaping!=null,isLoading:()=>Nd===du.loading,setState(p){Nd=p.pluginStatus,Rp=p.pluginURL},isParsing:()=>Nd===du.parsing,isParsed:()=>Nd===du.parsed,getPluginURL:()=>Rp};class di{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(!Dp(_.charCodeAt(0),g))return!1;return!0}(c,Fp.isLoaded())}}class MN{constructor(c,h,g,_,S){this.property=c,this.value=h,this.expression=function(C,L,z,$,K){if(_N(C))return new wN(C,L);if(s_(C)||Array.isArray(C)&&C.length>0){const Z=R5(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=Na.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 U5{constructor(c,h,g,_){this.property=c,this.value=new MN(c,void 0,h,g,_)}transitioned(c,h){return new x6(this.property,this.value,h,Object.assign({},c.transition,this.transition),c.now)}untransitioned(){return new x6(this.property,this.value,null,{},0)}}class g6{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 U5(this._values[c].property,this._scope,this._options,this._iconImageUseTheme)),this._values[c].value=new MN(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 U5(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 y6(this._properties);for(const _ of Object.keys(this._values))g._values[_]=this._values[_].transitioned(c,h._values[_]);return g}untransitioned(){const c=new y6(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].untransitioned();return c}isIndoorDependent(){return this._isIndoorDependent}}class x6{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 _6(p){return p instanceof Number||p instanceof String||p instanceof Boolean?p.valueOf():p}function TN(p){if(Array.isArray(p))return p.map(TN);if(p instanceof Object&&!(p instanceof Number||p instanceof String||p instanceof Boolean)){const c={};for(const h in p)c[h]=TN(p[h]);return c}return _6(p)}function Bm(p){if(p===!0||p===!1)return!0;if(!Array.isArray(p)||p.length===0)return!1;switch(p[0]){case"has":return p.length>=2&&p[1]!=="$id"&&p[1]!=="$type";case"in":return p.length>=3&&(typeof p[1]!="string"||Array.isArray(p[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return p.length!==3||Array.isArray(p[1])||Array.isArray(p[2]);case"any":case"all":for(const c of p.slice(1))if(!Bm(c)&&typeof c!="boolean")return!1;return!0;default:return!0}}function AN(p,c="",h=null,g="fill"){if(p==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Bm(p)||(p=EN(p));const _=p;let S=!0;try{S=function(K){if(!y0(K))return K;let Z=TN(K);return b6(Z),Z=Nx(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=ag(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=ag(_,L,c,h);if(K.result==="error")throw new Error(K.value.map(Z=>`${Z.key}: ${Z.message}`).join(", "));z=(Z,ee,re,ae,ge)=>K.value.evaluate(Z,ee,{},re,void 0,void 0,ae,ge),$=!l0(K.value.expression)}return{filter:C,dynamicFilter:z||void 0,needGeometry:w6(S),needFeature:!!$}}function Nx(p){if(!Array.isArray(p))return p;const c=function(h){if(loe.has(h[0])){for(let g=1;gNx(h))}function b6(p){let c=!1;const h=[];if(p[0]==="case"){for(let g=1;g",">=","<","<=","to-boolean"]);function coe(p,c){return pc?1:0}function w6(p){if(!Array.isArray(p))return!1;if(p[0]==="within"||p[0]==="distance")return!0;for(let c=1;c"||c==="<="||c===">="?IN(p[1],p[2],c):c==="any"?(h=p.slice(1),["any"].concat(h.map(EN))):c==="all"?["all"].concat(p.slice(1).map(EN)):c==="none"?["all"].concat(p.slice(1).map(EN).map(l_)):c==="in"?PN(p[1],p.slice(2)):c==="!in"?l_(PN(p[1],p.slice(2))):c==="has"?LN(p[1]):c!=="!has"||l_(LN(p[1]));var h}function IN(p,c,h){switch(p){case"$type":return[`filter-type-${h}`,c];case"$id":return[`filter-id-${h}`,c];default:return[`filter-${h}`,p,c]}}function PN(p,c){if(c.length===0)return!1;switch(p){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",p,["literal",c.sort(coe)]]:["filter-in-small",p,["literal",c]]}}function LN(p){switch(p){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",p]}}function l_(p){return["!",p]}const Sx="";function Xh(p,c){return c?`${p}${Sx}${c}`:p}let j6;const k6=()=>j6||(j6=new ao({"icon-size":new Fr(Bt.layout_symbol["icon-size"]),"icon-image":new Fr(Bt.layout_symbol["icon-image"]),"icon-rotate":new Fr(Bt.layout_symbol["icon-rotate"]),"icon-offset":new Fr(Bt.layout_symbol["icon-offset"]),"text-size":new Fr(Bt.layout_symbol["text-size"]),"text-rotate":new Fr(Bt.layout_symbol["text-rotate"]),"text-offset":new Fr(Bt.layout_symbol["text-offset"])}));class N6{constructor(c,h,g,_,S,C){const L=ag(c,Bt.appearance.condition);if(L.result==="success"&&(this.condition=L.value),this.name=h,g){this.properties=new jx(k6()),this.unevaluatedLayout=new v6(k6(),_,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 S6="-transition",$m=new Set(["fill","line","background","hillshade","raster"]);class Sd extends Rn{constructor(c,h,g,_,S,C){if(super(),this.id=c.id,this.fqid=Xh(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=ag(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 v6(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 g6(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 jx(h.paint)}}}onAdd(c){}onRemove(c){}isDraped(c){return!this.is3D(!0)&&$m.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 N6(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(S6)?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(S6)){const Z=c.slice(0,-11);return _[Z]&&g.setTransition(Z,h||void 0),!1}if(!_[c])return!1;const S=g._values[c],C=S.value.isDataDriven(),L=S.value;g.setValue(c,h),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...g.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||g.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(c);const z=g._values[c].value,$=z.isDataDriven(),K=c.endsWith("pattern")||c==="line-dasharray";return $||C||K||this._handleOverridablePaintPropertyUpdate(c,L,z)}_handleSpecialPaintPropertyUpdate(c){}getProgramIds(){return null}getDefaultProgramParams(c,h,g){return null}_handleOverridablePaintPropertyUpdate(c,h,g){return!1}isHidden(c){return!!(this.minzoom&&c=this.maxzoom)||this.visibility==="none"}updateTransitions(c){this._transitioningPaint=this._transitionablePaint.transitioned(c,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(c,h){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(c,void 0,h,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(c,void 0,h)}serialize(){const c={id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.appearances.length!==0&&(c.appearances=this.appearances.map(h=>h.serialize())),pr(c,(h,g)=>!(h===void 0||g==="layout"&&!Object.keys(h).length||g==="paint"&&!Object.keys(h).length))}is3D(c){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(const c in this.paint._values){const h=this.paint.get(c);if(h instanceof wx&&r_(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}for(const c of this.appearances)if(!Yv(c.condition.expression))return!0;return!1}compileFilter(c){this._filterCompiled||(this._featureFilter=AN(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 C6={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class c_{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 doe=new ArrayBuffer(0);class Mi{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=doe),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 Un(p,c=1){let h=0,g=0;return{members:p.map(_=>{const S=C6[_.type].BYTES_PER_ELEMENT,C=h=M6(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:M6(h,Math.max(g,c)),alignment:c}}function M6(p,c){return Math.ceil(p/c)*c}class og extends Mi{_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}}og.prototype.bytesPerElement=4,as(og,"StructArrayLayout2i4");class v0 extends Mi{_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,as(v0,"StructArrayLayout3i6");class _0 extends Mi{_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,as(_0,"StructArrayLayout4i8");class zp extends Mi{_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}}zp.prototype.bytesPerElement=4,as(zp,"StructArrayLayout1f4");class q5 extends Mi{_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}}q5.prototype.bytesPerElement=8,as(q5,"StructArrayLayout2i1f8");class V5 extends Mi{_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}}V5.prototype.bytesPerElement=8,as(V5,"StructArrayLayout3i8");class H5 extends Mi{_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}}H5.prototype.bytesPerElement=10,as(H5,"StructArrayLayout5i10");class ON extends Mi{_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}}ON.prototype.bytesPerElement=12,as(ON,"StructArrayLayout2i4ub1f12");class Ru extends Mi{_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}}Ru.prototype.bytesPerElement=12,as(Ru,"StructArrayLayout3f12");class Kd extends Mi{_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,as(Kd,"StructArrayLayout4ui1f12");class Cx extends Mi{_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}}Cx.prototype.bytesPerElement=8,as(Cx,"StructArrayLayout4ui8");class DN extends Mi{_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}}DN.prototype.bytesPerElement=12,as(DN,"StructArrayLayout6i12");class W5 extends Mi{_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 ae=12*c;return this.int16[ae+0]=h,this.int16[ae+1]=g,this.int16[ae+2]=_,this.int16[ae+3]=S,this.uint16[ae+4]=C,this.uint16[ae+5]=L,this.uint16[ae+6]=z,this.uint16[ae+7]=$,this.int16[ae+8]=K,this.int16[ae+9]=Z,this.int16[ae+10]=ee,this.int16[ae+11]=re,c}}W5.prototype.bytesPerElement=24,as(W5,"StructArrayLayout4i4ui4i24");class G5 extends Mi{_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}}G5.prototype.bytesPerElement=20,as(G5,"StructArrayLayout3i3f20");class lg extends Mi{_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}}lg.prototype.bytesPerElement=16,as(lg,"StructArrayLayout4f16");class RN extends Mi{_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}}RN.prototype.bytesPerElement=4,as(RN,"StructArrayLayout1ul4");class Fu extends Mi{_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}}Fu.prototype.bytesPerElement=4,as(Fu,"StructArrayLayout2ui4");class FN extends Mi{_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 ae=this.length;return this.resize(ae+1),this.emplace(ae,c,h,g,_,S,C,L,z,$,K,Z,ee,re)}emplace(c,h,g,_,S,C,L,z,$,K,Z,ee,re,ae){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]=ae,c}}FN.prototype.bytesPerElement=40,as(FN,"StructArrayLayout5i4f1i1ul2ui40");class zN extends Mi{_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}}zN.prototype.bytesPerElement=16,as(zN,"StructArrayLayout3i2i2i16");class BN extends Mi{_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}}BN.prototype.bytesPerElement=16,as(BN,"StructArrayLayout2f1f2i16");class K5 extends Mi{_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}}K5.prototype.bytesPerElement=20,as(K5,"StructArrayLayout2ub4f20");class Jo extends Mi{_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}}Jo.prototype.bytesPerElement=6,as(Jo,"StructArrayLayout3ui6");class b0 extends Mi{_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,ae,ge,Se,Ne,Be,qe,Qe,vt){const mt=this.length;return this.resize(mt+1),this.emplace(mt,c,h,g,_,S,C,L,z,$,K,Z,ee,re,ae,ge,Se,Ne,Be,qe,Qe,vt)}emplace(c,h,g,_,S,C,L,z,$,K,Z,ee,re,ae,ge,Se,Ne,Be,qe,Qe,vt,mt){const jt=30*c,At=15*c,Pt=60*c;return this.int16[jt+0]=h,this.int16[jt+1]=g,this.int16[jt+2]=_,this.float32[At+2]=S,this.float32[At+3]=C,this.uint16[jt+8]=L,this.uint16[jt+9]=z,this.uint32[At+5]=$,this.uint32[At+6]=K,this.uint32[At+7]=Z,this.uint16[jt+16]=ee,this.uint16[jt+17]=re,this.uint16[jt+18]=ae,this.float32[At+10]=ge,this.float32[At+11]=Se,this.uint8[Pt+48]=Ne,this.uint8[Pt+49]=Be,this.uint8[Pt+50]=qe,this.uint32[At+13]=Qe,this.int16[jt+28]=vt,this.uint8[Pt+58]=mt,c}}b0.prototype.bytesPerElement=60,as(b0,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class Z5 extends Mi{_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,ae,ge,Se,Ne,Be,qe,Qe,vt,mt,jt,At,Pt,Qt,Ft,sr,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,ae,ge,Se,Ne,Be,qe,Qe,vt,mt,jt,At,Pt,Qt,Ft,sr,dr,ur,yr,_r,mr)}emplace(c,h,g,_,S,C,L,z,$,K,Z,ee,re,ae,ge,Se,Ne,Be,qe,Qe,vt,mt,jt,At,Pt,Qt,Ft,sr,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]=ae,this.uint16[Jt+15]=ge,this.uint16[Jt+16]=Se,this.uint16[Jt+17]=Ne,this.uint16[Jt+18]=Be,this.uint16[Jt+19]=qe,this.uint16[Jt+20]=Qe,this.uint16[Jt+21]=vt,this.uint16[Jt+22]=mt,this.uint16[Jt+23]=jt,this.uint16[Jt+24]=At,this.uint16[Jt+25]=Pt,this.uint16[Jt+26]=Qt,this.uint16[Jt+27]=Ft,this.uint32[rr+14]=sr,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}}Z5.prototype.bytesPerElement=80,as(Z5,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class Y5 extends Mi{_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}}Y5.prototype.bytesPerElement=24,as(Y5,"StructArrayLayout6f24");class Mx extends Mi{_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}}Mx.prototype.bytesPerElement=20,as(Mx,"StructArrayLayout5f20");class X5 extends Mi{_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}}X5.prototype.bytesPerElement=28,as(X5,"StructArrayLayout7f28");class Q5 extends Mi{_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}}Q5.prototype.bytesPerElement=44,as(Q5,"StructArrayLayout11f44");class w0 extends Mi{_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,as(w0,"StructArrayLayout9f36");class Um extends Mi{_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}}Um.prototype.bytesPerElement=8,as(Um,"StructArrayLayout2f8");class Zd extends Mi{_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,as(Zd,"StructArrayLayout1ul3ui12");class cg extends Mi{_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}}cg.prototype.bytesPerElement=2,as(cg,"StructArrayLayout1ui2");class J5 extends Mi{_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,ae,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,ae,ge,Se)}emplace(c,h,g,_,S,C,L,z,$,K,Z,ee,re,ae,ge,Se,Ne){const Be=16*c;return this.float32[Be+0]=h,this.float32[Be+1]=g,this.float32[Be+2]=_,this.float32[Be+3]=S,this.float32[Be+4]=C,this.float32[Be+5]=L,this.float32[Be+6]=z,this.float32[Be+7]=$,this.float32[Be+8]=K,this.float32[Be+9]=Z,this.float32[Be+10]=ee,this.float32[Be+11]=re,this.float32[Be+12]=ae,this.float32[Be+13]=ge,this.float32[Be+14]=Se,this.float32[Be+15]=Ne,c}}J5.prototype.bytesPerElement=64,as(J5,"StructArrayLayout16f64");class $N extends Mi{_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}}$N.prototype.bytesPerElement=20,as($N,"StructArrayLayout4ui3f20");class eM extends Mi{_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}}eM.prototype.bytesPerElement=2,as(eM,"StructArrayLayout1i2");class UN extends Mi{_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}}UN.prototype.bytesPerElement=1,as(UN,"StructArrayLayout1ub1");class qN extends c_{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]}}qN.prototype.size=40;class T6 extends FN{get(c){return new qN(this,c)}}as(T6,"CollisionBoxArray");class VN extends c_{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}}VN.prototype.size=60;class A6 extends b0{get(c){return new VN(this,c)}}as(A6,"PlacedSymbolArray");class E6 extends c_{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]}}E6.prototype.size=80;class tM extends Z5{get(c){return new E6(this,c)}}as(tM,"SymbolInstanceArray");class HN extends zp{getoffsetX(c){return this.float32[1*c+0]}}as(HN,"GlyphOffsetArray");class I6 extends og{getx(c){return this.int16[2*c+0]}gety(c){return this.int16[2*c+1]}}as(I6,"SymbolLineVertexArray");class rM extends c_{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]}}rM.prototype.size=12;class sM extends Zd{get(c){return new rM(this,c)}}as(sM,"FeatureIndexArray");class P6 extends Fu{geta_centroid_pos0(c){return this.uint16[2*c+0]}geta_centroid_pos1(c){return this.uint16[2*c+1]}}as(P6,"FillExtrusionCentroidArray");class WN extends c_{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]}}WN.prototype.size=6;class d_ extends v0{get(c){return new WN(this,c)}}as(d_,"FillExtrusionWallArray");const L6=Un([{name:"a_pos",components:2,type:"Int16"}],4),uoe=Un([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),O6=Un([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Vi{constructor(c=[]){this.segments=c}_prepareSegment(c,h,g,_){let S=this.segments[this.segments.length-1];return c>Vi.MAX_VERTEX_ARRAY_LENGTH&&Kr(`Max vertices per segment is ${Vi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${c}`),(!S||S.vertexLength+c>Vi.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 Vi([{vertexOffset:c,primitiveOffset:h,vertexLength:g,primitiveLength:_,vaos:{},sortKey:0}])}}function GN(p,c){return 256*(p=ye(Math.floor(p),0,255))+ye(Math.floor(c),0,255)}Vi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,as(Vi,"SegmentVector");const hoe=Un([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),moe=Un([{name:"a_pattern_b",components:4,type:"Uint16"}]),poe=Un([{name:"a_dash",components:4,type:"Uint16"}]);class u_{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(c,h,g,_){this.ids.push(nM(c)),this.positions.push(h,g,_)}eachPosition(c,h){const g=nM(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 aM(g,_,0,g.length-1),h&&(h.add(g.buffer),h.add(_.buffer)),{ids:g,positions:_}}static deserialize(c){const h=new u_;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 nM(p){const c=+p;return Number.isSafeInteger(c)?c:fr(String(p))}function aM(p,c,h,g){for(;h>1];let S=h-1,C=g+1;for(;;){do S++;while(p[S]<_);do C--;while(p[C]>_);if(S>=C)break;KN(p,S,C),KN(c,3*S,3*C),KN(c,3*S+1,3*C+1),KN(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 Na?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 m_(c):new el(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 YN(c):new el(c)}}class $p{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 di(0,{brightness:C,worldview:z}),h,{},S,_,L):this.expression.kind==="constant"&&this.expression.value,Z=f_(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=f_(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=iM(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 di(this.context.zoom,{brightness:C,worldview:z}),h,{},S,_,L),K=this.expression.evaluate(new di(this.context.zoom+1,{brightness:C,worldview:z}),h,{},S,_,L),Z=f_(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=f_(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=iM(g.toPremultipliedRenderColor(S)),L=iM(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 wx&&r_(C.property.specification)))continue;const L=yoe(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 ae=oM(S,$,"source");this.binders[S]=Z?new qp(z,L,$,ae,c.id):new $p(z,L,$,ae),_.push(`/a_${S}`)}else{const ae=oM(S,$,"composite");this.binders[S]=new Up(z,L,$,K,h,ae),_.push(`/z_${S}`)}else this.binders[S]=Z?new j0(z.value,L):new g_(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 $p||h instanceof Up?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 $p||K instanceof Up||K instanceof qp)&&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 qp?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,ae=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 $p||Se instanceof Up||Se instanceof qp)&&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 Be of ae){const qe=c[Be.toString()];h.eachPosition(Be,(Qe,vt,mt)=>{const jt=_.feature(Qe);Se.updatePaintArray(vt,mt,jt,qe,C,L,$,K)})}if(!re)for(const Be of g.uniqueIds){const qe=c[Be.toString()];g.eachPosition(Be,(Qe,vt,mt)=>{const jt=_.feature(Qe);Se.updatePaintArray(vt,mt,jt,qe,C,L,$,K)})}Z=!0}}return Z}defines(){const c=[];for(const h in this.binders){const g=this.binders[h];(g instanceof g_||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 g_||_ instanceof j0||_ instanceof Up)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 $p||h instanceof Up||h instanceof qp)&&h.paintVertexBuffer&&this._buffers.push(h.paintVertexBuffer),h instanceof qp&&h.paintTransitionVertexBuffer&&this._buffers.push(h.paintTransitionVertexBuffer)}}upload(c){for(const h in this.binders){const g=this.binders[h];(g instanceof $p||g instanceof Up||g instanceof qp)&&g.upload(c)}this.updatePaintBuffers()}destroy(){for(const c in this.binders){const h=this.binders[c];(h instanceof $p||h instanceof Up||h instanceof qp)&&h.destroy()}}}class Qh{constructor(c,h,g=()=>!0){this.programConfigurations={};for(const _ of c)this.programConfigurations[_.id]=new dg(_,h,g);this.needsUpload=!1,this._featureMap=new u_,this._featureMapWithoutIds=new u_,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 xoe={"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 yoe(p,c){return xoe[p]||[p.replace(`${c}-`,"").replace(/-/g,"_")]}const voe={"line-pattern":{source:Kd,composite:Kd},"fill-pattern":{source:Kd,composite:Kd},"fill-extrusion-pattern":{source:Kd,composite:Kd},"line-dasharray":{source:Cx,composite:Cx}},_oe={color:{source:Um,composite:lg},number:{source:zp,composite:Um}};function oM(p,c,h){const g=voe[p];return g&&g[h]||_oe[c][h]}as(g_,"ConstantBinder"),as(j0,"PatternConstantBinder"),as($p,"SourceExpressionBinder"),as(qp,"PatternCompositeBinder"),as(Up,"CompositeExpressionBinder"),as(dg,"ProgramConfiguration",{omit:["_buffers"]}),as(Qh,"ProgramConfigurationSet");const Oc=Ar/Math.PI/2,yh=5,JN=6,boe=16383,k0=64,lM=[k0,32,16],vh=-Oc,_h=Oc;function Tx(p,c,h,g=Oc){return h=Ws(h),[p*Math.sin(h)*g,-c*g,p*Math.cos(h)*g]}function N0(p,c,h){return Tx(Math.cos(Ws(p)),Math.sin(Ws(p)),c,h)}const w=63710088e-1,d=2*Math.PI*w;class f{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 f(Ye(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(c){const h=Math.PI/180,g=this.lat*h,_=c.lat*h,S=Math.sin(g)*Math.sin(_)+Math.cos(g)*Math.cos(_)*Math.cos((c.lng-this.lng)*h);return w*Math.acos(Math.min(S,1))}toBounds(c=0){const h=360*c/40075017,g=h/Math.cos(Math.PI/180*this.lat);return new j({lng:this.lng-g,lat:this.lat-h},{lng:this.lng+g,lat:this.lat+h})}toEcef(c){return N0(this.lat,this.lng,Oc+c*Oc/w)}static convert(c){if(c instanceof f)return c;if(Array.isArray(c)&&(c.length===2||c.length===3))return new f(Number(c[0]),Number(c[1]));if(!Array.isArray(c)&&typeof c=="object"&&c!==null)return new f(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 f?new f(c.lng,c.lat):f.convert(c),this}setSouthWest(c){return this._sw=c instanceof f?new f(c.lng,c.lat):f.convert(c),this}extend(c){const h=this._sw,g=this._ne;let _,S;if(c instanceof f)_=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(f.convert(c)):typeof c=="object"&&c!==null&&c.hasOwnProperty("lat")&&(c.hasOwnProperty("lon")||c.hasOwnProperty("lng"))?this.extend(f.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 f(_.lng,_.lat),this._ne=new f(S.lng,S.lat)),this}getCenter(){return new f((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 f(this.getWest(),this.getNorth())}getSouthEast(){return new f(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}=f.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 I=0,O=25.5;function F(p){return d*Math.cos(p*Math.PI/180)}function B(p){return(180+p)/360}function W(p){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+p*Math.PI/360)))/360}function J(p,c){return p/F(c)}function te(p){return 360*p-180}function me(p){return 360/Math.PI*Math.atan(Math.exp((180-360*p)*Math.PI/180))-90}function ue(p,c){return p*F(me(c))}const pe=85.051129;function ke(p){return Math.cos(Ws(ye(p,-pe,pe)))}function _e(p,c){const h=ye(c,I,O),g=Math.pow(2,h);return ke(p)*d/(512*g)}function Fe(p){return 1/Math.cos(p*Math.PI/180)}function Re(p,c=0){const h=Math.exp(Math.PI*(1-(p.y+c/Ar)/(1<=z?(at(p,c,h,$,K,S,Z,L,z),at(p,$,K,g,_,Z,C,L,z)):p.push(C)}function Ge(p,c,h){let g=p[0],_=g.x,S=g.y;c(g);const C=[g];for(let L=1;Lp.x+1||gp.y+1)&&Kr("Geometry exceeds allowed extent, reduce your vector tile buffer size"),p}function Ct(p,c,h){const g=p.loadGeometry(),_=p.extent,S=Ar/_;if(c&&h&&h.projection.isReprojectedInTileSpace){const C=1<{const re=te((c.x+ee.x/_)/C),ae=me((c.y+ee.y/_)/C),ge=K.project(re,ae);ee.x=(ge.x*L-z)*_,ee.y=(ge.y*L-$)*_};for(let ee=0;ee=_||ae.y<0||ae.y>=_||(Z(ae),re.push(ae));g[ee]=re}}for(const C of g)for(const L of C)ht(L,S);return g}function Rt(p,c){return{type:p.type,id:p.id,properties:p.properties,geometry:c?Ct(p):[]}}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 ae of L)ee.push(ae[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(ae){const ge=ae.length;if(ge<=1)return[ae];const Se=[];let Ne,Be;for(let qe=0;qe=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(p,c,h){p===15?c.version=h.readVarint():p===1?c.name=h.readString():p===5?c.extent=h.readVarint():p===2?c._features.push(h.pos):p===3?c._keys.push(h.readString()):p===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 Ht{constructor(c,h){this.layers=c.readFields(Et,{},h)}}function Et(p,c,h){if(p===3){const g=new lr(h,h.readVarint()+h.pos);g.length&&(c[g.name]=g)}}const er="3d_elevation_id",Zt="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 Xr=new Ir((p,c,h)=>p.reset(c).require(er,g=>{h.id=g}).optional("fixed_height_relative",g=>{h.constantHeight=g},wr.decodeRelativeHeight).geometry(g=>{h.bounds=g},Pp).success(),(p,c,h)=>p.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()),Mr=new Ir((p,c,h)=>p.reset(c).require(er,g=>{h.id=g}).optional("fixed_height",g=>{h.constantHeight=g},wr.decodeMetricHeight).geometry(g=>{h.bounds=g},Pp).success(),(p,c,h)=>p.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"?Mr:void 0:Xr}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 fs{constructor(c,h){this.pos=c,this.dir=h}intersectsPlane(c,h,g){const _=Ga(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 ls{constructor(c,h){this.pos=c,this.dir=h}intersectsPlane(c,h,g){const _=it(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,ae){var ge=re[0],Se=re[1],Ne=re[2],Be=ae[0],qe=ae[1],Qe=ae[2];return Math.abs(ge-Be)<=u*Math.max(1,Math.abs(ge),Math.abs(Be))&&Math.abs(Se-qe)<=u*Math.max(1,Math.abs(Se),Math.abs(qe))&&Math.abs(Ne-Qe)<=u*Math.max(1,Math.abs(Ne),Math.abs(Qe))}(this.pos,c)||h===0)return g[0]=g[1]=g[2]=0,!1;const[_,S,C]=this.dir,L=this.pos[0]-c[0],z=this.pos[1]-c[1],$=this.pos[2]-c[2],K=_*_+S*S+C*C,Z=2*(L*_+z*S+$*C),ee=Z*Z-4*K*(L*L+z*z+$*$-h*h);if(ee<0){const re=Math.max(-Z/2,0),ae=L+_*re,ge=z+S*re,Se=$+C*re,Ne=Math.hypot(ae,ge,Se);return g[0]=ae*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 ae=Math.hypot(L,z,$);return g[0]=L*h/ae,g[1]=z*h/ae,g[2]=$*h/ae,!1}return g[0]=L+_*re,g[1]=z+S*re,g[2]=$+C*re,!0}}}class Wr{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=et(_,_,c),$=et(S,S,c),K=et(C,C,c),Z=et(L,L,c);return new Wr(z,$,K,Z,h/g)}}function Jr(p,c,h){let g=1/0,_=-1/0;const S=[];for(const C of p){je(S,C,c);const L=it(S,h);g=Math.min(g,L),_=Math.max(_,L)}return[g,_]}function As(p,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 an(p,c){for(const h of p.projections){const g=Jr(c,p.points[0],h.axis);if(h.projection[1]g[1])return 0}return 1}function Kn(p,c){let h=0;const g=[0,0,0,0];for(let C=0;C=0&&h++;var _,S;return h}class Sa{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=ys.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:Jr(this.points,this.points[0],_)}),this.projections.push({axis:S,projection:Jr(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]*(ae=[Z,Z,_?1/K[3]:Z,Z])[0],ee[1]=re[1]*ae[1],ee[2]=re[2]*ae[2],ee[3]=re[3]*ae[3],ee;var ee,re,ae}),L=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map($=>{const K=$e([],xt([],je([],C[$[0]],C[$[1]]),je([],C[$[2]],C[$[1]]))),Z=-it(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(it([h[0],h[1],h[2]],c)+g<0)return!1}return!0}}class ys{static fromPoints(c){const h=[1/0,1/0,1/0],g=[-1/0,-1/0,-1/0];for(const _ of c)ve(h,h,_),be(g,g,_);return new ys(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])]}}as(ys,"Aabb");class xa{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?we(z,z,1/$):ce(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;Hr(Z,c.x,c.y);const ee=new fs(Z,null);for(let re=0;re0?Ga(z,L)/Qe:0,mt=ye(vt,0,1),jt=Math.abs((vt-mt)*this.edgeProps[re].len);zs($,Z,Se),Hr(K,ge[1],-ge[0]);const At=jt+Math.abs(Ga($,K));At=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:ae}=this.vertices[z],ge=this.vertexProps[L].dir,Se=this.vertexProps[z].dir;if(ce(h,$[0]/c,$[1]/c,K),ce(g,ee[0]/c,ee[1]/c,re),ce(_,ge[1],-ge[0],0),we(_,_,Z),ce(S,Se[1],-Se[0],0),we(S,S,ae),this.distSqLines(oe(h[0]+.5*_[0],h[1]+.5*_[1],h[2]+.5*_[2]),oe(g[0]-.5*S[0],g[1]-.5*S[1],g[2]-.5*S[2]),oe(h[0]-.5*_[0],h[1]-.5*_[1],h[2]-.5*_[2]),oe(g[0]+.5*S[0],g[1]+.5*S[1],g[2]+.5*S[2]))<=.0025000000000000005)continue;const Ne=this.vertices.length,Be=Ts(Xs(),$,ee);this.vertices.push({position:wa(Be,Be,.5),height:.5*(K+re),extent:.5*(Z+ae)});const qe=Ts(Xs(),ge,Se);this.vertexProps.push({dir:Ao(qe,qe)}),this.edges.splice(C,1),this.edgeProps.splice(C,1),this.edges.push({a:L,b:Ne}),this.edges.push({a:Ne,b:z});const Qe=zs(Xs(),this.vertices[Ne].position,$),vt=gi(Qe),mt={vec:Qe,dir:wa(Xs(),Qe,1/vt),len:vt};this.edgeProps.push(mt),this.edgeProps.push(mt)}}distSqLines(c,h,g,_){const S=xe(he(),h,c),C=xe(he(),_,g),L=xe(he(),c,g),z=it(S,S),$=it(S,C),K=it(S,L),Z=it(C,C),ee=it(C,L),re=z*Z-$*$;if(re===0)return Le(Ee(S,g,_,it(L,C)/it(C,C)),c);const ae=(z*ee-$*K)/re;return Le(Ee(S,c,h,($*ee-K*Z)/re),Ee(C,g,_,ae))}}class Aa{static parseFrom(c,h){const g=wr.parse(c);if(!g)return[];let{vertices:_,features:S}=g;const C=1/Re(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 tn(K.id,K.bounds,K.constantHeight));continue}for(;z!==$&&_[z].id_.id===g)}}class Ha{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*Oe(0,h,c>=0?c:Math.abs(.5*c))}}as(tn,"ElevationFeature");class Fa{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 og,this.indexArray=new Jo,this.segments=new Vi,this.programConfigurations=new Qh(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 zp),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,ae=Rt($,re);if(!this.layers[0]._featureFilter.filter(new di(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),ae,g))continue;const ge=L?L.evaluate(ae,{},g):void 0,Se={id:K,properties:$.properties,type:$.type,sourceLayerIndex:ee,index:Z,geometry:re?ae.geometry:Ct($,g,_),patterns:{},sortKey:ge};C.push(Se)}L&&C.sort(($,K)=>$.sortKey-K.sortKey);let z=null;_.projection.name==="globe"&&(this.globeExtVertexArray=new DN,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,L6.members),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=c.createVertexBuffer(this.globeExtVertexArray,O6.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=c.createVertexBuffer(this.elevatedLayoutVertexArray,uoe.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"&&($=Aa.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 ae=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,c.sortKey),ge=ae.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),ae.vertexLength+=4,ae.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 fa(p,c){for(let h=0;h1){if(Ti(p,c))return!0;for(let g=0;g1?h:h.sub(c)._mult(_)._add(c))}function Hi(p,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(p,c){let h=!1;for(let g=0,_=p.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 Cd(p,c,h,g,_){for(const C of p)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(p.length>2){for(const C of S)if(ei(p,C))return!0}for(let C=0;C_.x&&c.x>_.x||p.y_.y&&c.y>_.y)return!1;const S=dn(p,c,h[0]);return S!==dn(p,c,h[1])||S!==dn(p,c,h[2])||S!==dn(p,c,h[3])}function tl(p,c,h,g,_,S){let C=c.y-p.y,L=p.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-p.x)*C+(h.y-p.y)*L-S<0||(g.x-p.x)*C+(g.y-p.y)*L-S<0||(_.x-p.x)*C+(_.y-p.y)*L-S<0)}function Dc(p,c,h,g,_,S,C){return!(tl(p,c,g,_,S,C)||tl(c,h,g,_,S,C)||tl(h,p,g,_,S,C)||tl(g,_,p,c,h,C)||tl(_,S,p,c,h,C)||tl(S,g,p,c,h,C))}function Rc(p,c,h){const g=c.paint.get(p).value;return g.kind==="constant"?g.value:h.programConfigurations.get(c.id).getMaxValue(p)}function Kl(p){return Math.sqrt(p[0]*p[0]+p[1]*p[1])}function zu(p,c,h,g,_){if(!c[0]&&!c[1])return p;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=wo(256*S,256*(C=Math.pow(2,L)-C-1),L),$=wo(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 Qi(c,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Qi(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 Wi(this.wrap*+h,c,this.canonical.z,this.canonical.x,this.canonical.y);{const g=this.canonical.z-c;return Wi(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 Qi(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 Qi(h,this.wrap,h,g,_),new Qi(h,this.wrap,h,g+1,_),new Qi(h,this.wrap,h,g,_+1),new Qi(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=p.canonical.x-1,h=p.wrap;return c<0&&(c=(1<{let c=p.canonical.x+1,h=p.wrap;return c===1<new Qi(p.overscaledZ,p.wrap,p.canonical.z,p.canonical.x,(p.canonical.y===0?1<new Qi(p.overscaledZ,p.wrap,p.canonical.z,p.canonical.x,p.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)}(p.a[c],p.b[c],p.angle,ye(h,0,1))+p.center[c]}function em(p){if(p.z<=1)return Vp[p.z+2*p.y+p.x];const c=woe(D6(p));return ys.fromPoints(c)}function Wp(p,c,h){return we(p,p,1-h),tt(p,p,c,h)}function hve(p,c,h){for(const g of p)et(g,g,c),we(g,g,h)}function mve(p,c,h,g){const _=c/p.worldSize,S=p.globeMatrix;if(h.z<=1){const Pt=em(h).getCorners();return hve(Pt,S,_),ys.fromPoints(Pt)}const C=D6(h,g),L=woe(C,Oc+Vm(p._tileCoverLift));hve(L,S,_);const z=Number.MAX_VALUE,$=[-z,-z,-z],K=[z,z,z];if(C.contains(p.center)){for(const Ft of L)ve(K,K,Ft),be($,$,Ft);$[2]=0;const Pt=p.point,Qt=[Pt.x*_,Pt.y*_,0];return ve(K,K,Qt),be($,$,Qt),new ys(K,$)}if(p._tileCoverLift>0){for(const Pt of L)ve(K,K,Pt),be($,$,Pt);return new ys(K,$)}const Z=[S[12]*_,S[13]*_,S[14]*_],ee=C.getCenter(),re=ye(p.center.lat,-pe,pe),ae=ye(ee.lat,-pe,pe),ge=B(p.center.lng),Se=W(re);let Ne=ge-B(ee.lng);const Be=Se-W(ae);Ne>.5?Ne-=1:Ne<-.5&&(Ne+=1);let qe=0;Math.abs(Ne)>Math.abs(Be)?qe=Ne>=0?1:3:(qe=Be>=0?0:2,tt(Z,Z,[S[4]*_,S[5]*_,S[6]*_],-Math.sin(Ws(Be>=0?C.getSouth():C.getNorth()))*Oc));const Qe=L[qe],vt=L[(qe+1)%4],mt=new ug(Qe,vt,Z),jt=[Hp(mt,0)||Qe[0],Hp(mt,1)||Qe[1],Hp(mt,2)||Qe[2]],At=M0(p.zoom);if(At>0){const Pt=function({x:Ft,y:sr,z:dr},ur,yr,_r,mr){const gr=1/(1<.5?jr=-1:bs<-.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,p._pixelsPerMercatorPixel,ge,Se);for(let Ft=0;FtMath.PI/2*1.01}const yve=Ws(85),sHe=Math.cos(yve),nHe=Math.sin(yve),aHe=N(),vve=p=>{const c=[];return p.paint.get("circle-pitch-alignment")==="map"&&c.push("PITCH_WITH_MAP"),p.paint.get("circle-pitch-scale")==="map"&&c.push("SCALE_WITH_MAP"),c};function _ve(p,c,h,g,_,S,C,L,z){if(S&&p.queryGeometry.isAboveHorizon)return!1;S&&(z*=p.pixelToTileUnitsFactor);const $=p.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),ae=_&&h.elevation?h.elevation.exaggeration()*_.getElevationAt(re.x,re.y,!0):0,ge=h.projection.projectTilePoint(re.x,re.y,$);if(ae>0){const qe=h.projection.upVector($,re.x,re.y);ge.x+=qe[0]*K*ae,ge.y+=qe[1]*K*ae,ge.z+=qe[2]*K*ae}const Se=S?re:iHe(ge.x,ge.y,ge.z,g),Ne=S?p.tilespaceRays.map(qe=>lHe(qe,ae)):p.queryGeometry.screenGeometry,Be=Ke([],[ge.x,ge.y,ge.z,1],g);if(!C&&S?z*=Be[3]/h.cameraToCenterDistance:C&&!S&&(z*=h.cameraToCenterDistance/Be[3]),S){const qe=me((ee.y/Ar+$.y)/(1<<$.z));z/=h.projection.pixelsPerMeter(qe,1)/J(1,qe)}if(gn(Ne,Se,z))return!0}return!1}function iHe(p,c,h,g){const _=Ke([],[p,c,h,1],g);return new or(_[0]/_[3],_[1]/_[3])}const bve=oe(0,0,0),oHe=oe(0,0,1);function lHe(p,c){const h=he();return bve[2]=c,p.intersectsPlane(bve,oHe,h),new or(h[0],h[1])}class wve extends Fa{}let jve,kve,Nve,Sve;function Cve(p,{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 p.width=c,p.height=h,p.data=_,p}function Mve(p,c,h){const{width:g,height:_}=c;g===p.width&&_===p.height||(Soe(p,c,{x:0,y:0},{x:0,y:0},{width:Math.min(p.width,g),height:Math.min(p.height,_)},h,null),p.width=g,p.height=_,p.data=c.data)}function Soe(p,c,h,g,_,S,C,L){if(_.width===0||_.height===0)return c;if(_.width>p.width||_.height>p.height||h.x>p.width-_.width||h.y>p.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=p.data,$=c.data,K=S===4&&L;for(let Z=0;Z<_.height;Z++){const ee=((h.y+Z)*p.width+h.x)*S,re=((g.y+Z)*c.width+g.x)*S;if(K)for(let ae=0;ae<_.width;ae++){const ge=ee+ae*S+3,Se=re+ae*S;$[Se+0]=255,$[Se+1]=255,$[Se+2]=255,$[Se+3]=z[ge]}else if(C)for(let ae=0;ae<_.width;ae++){const ge=ee+ae*S,Se=re+ae*S,Ne=new Na(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 ae=0;ae<_.width*S;ae++)$[re+ae]=z[ee+ae]}return c}as(wve,"HeatmapBucket",{omit:["layers"]});class T0{constructor(c,h){Cve(this,c,1,h)}resize(c){Mve(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){Soe(c,h,g,_,S,1,null)}}class Fc{constructor(c,h){Cve(this,c,4,h)}resize(c){Mve(this,new Fc(c),4)}replace(c,h){h?this.data.set(c):this.data=c instanceof Uint8ClampedArray?new Uint8Array(c.buffer):c}clone(){return new Fc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(c,h,g,_,S,C,L){Soe(c,h,g,_,S,4,C,L)}}class Tve{constructor(c,h){this.width=c.width,this.height=c.height,this.data=h instanceof Uint8Array?new Float32Array(h.buffer):h}}function dM(p){const c={},h=p.resolution||256,g=p.clips?p.clips.length:1,_=p.image||new Fc({width:h,height:g}),S=(C,L,z)=>{c[p.evaluationKey]=z;const $=p.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(p.clips)for(let C=0,L=0;C80*h){L=p[0],z=p[1];let K=L,Z=z;for(let ee=h;ee<_;ee+=h){const re=p[ee],ae=p[ee+1];reK&&(K=re),ae>Z&&(Z=ae)}$=Math.max(K-L,Z-z),$=$!==0?32767/$:0}return uM(S,C,h,L,z,$,0),C}function Ave(p,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=Lve(C/g|0,p[C],p[C+1],S);return S&&t4(S,S.next)&&(pM(S),S=S.next),S}function v_(p,c){if(!p)return p;c||(c=p);let h,g=p;do if(h=!1,g.steiner||!t4(g,g.next)&&Dl(g.prev,g,g.next)!==0)g=g.next;else{if(pM(g),g=c=g.prev,g===g.next)break;h=!0}while(h||g!==c);return c}function uM(p,c,h,g,_,S,C){if(!p)return;!C&&S&&function(z,$,K,Z){let ee=z;do ee.z===0&&(ee.z=Coe(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 ae,ge=1;do{let Se,Ne=re;re=null;let Be=null;for(ae=0;Ne;){ae++;let qe=Ne,Qe=0;for(let mt=0;mt0||vt>0&&qe;)Qe!==0&&(vt===0||!qe||Ne.z<=qe.z)?(Se=Ne,Ne=Ne.nextZ,Qe--):(Se=qe,qe=qe.nextZ,vt--),Be?Be.nextZ=Se:re=Se,Se.prevZ=Be,Be=Se;Ne=qe}Be.nextZ=null,ge*=2}while(ae>1)}(ee)}(p,g,_,S);let L=p;for(;p.prev!==p.next;){const z=p.prev,$=p.next;if(S?pHe(p,g,_,S):mHe(p))c.push(z.i,p.i,$.i),pM(p),p=$.next,L=$.next;else if((p=$)===L){C?C===1?uM(p=fHe(v_(p),c),c,h,g,_,S,2):C===2&&gHe(p,c,h,g,_,S):uM(v_(p),c,h,g,_,S,1);break}}}function mHe(p){const c=p.prev,h=p,g=p.next;if(Dl(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 ae=g.next;for(;ae!==c;){if(ae.x>=K&&ae.x<=ee&&ae.y>=Z&&ae.y<=re&&hM(_,L,S,z,C,$,ae.x,ae.y)&&Dl(ae.prev,ae,ae.next)>=0)return!1;ae=ae.next}return!0}function pHe(p,c,h,g){const _=p.prev,S=p,C=p.next;if(Dl(_,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,$),ae=Math.min(K,Z,ee),ge=Math.max(L,z,$),Se=Math.max(K,Z,ee),Ne=Coe(re,ae,c,h,g),Be=Coe(ge,Se,c,h,g);let qe=p.prevZ,Qe=p.nextZ;for(;qe&&qe.z>=Ne&&Qe&&Qe.z<=Be;){if(qe.x>=re&&qe.x<=ge&&qe.y>=ae&&qe.y<=Se&&qe!==_&&qe!==C&&hM(L,K,z,Z,$,ee,qe.x,qe.y)&&Dl(qe.prev,qe,qe.next)>=0||(qe=qe.prevZ,Qe.x>=re&&Qe.x<=ge&&Qe.y>=ae&&Qe.y<=Se&&Qe!==_&&Qe!==C&&hM(L,K,z,Z,$,ee,Qe.x,Qe.y)&&Dl(Qe.prev,Qe,Qe.next)>=0))return!1;Qe=Qe.nextZ}for(;qe&&qe.z>=Ne;){if(qe.x>=re&&qe.x<=ge&&qe.y>=ae&&qe.y<=Se&&qe!==_&&qe!==C&&hM(L,K,z,Z,$,ee,qe.x,qe.y)&&Dl(qe.prev,qe,qe.next)>=0)return!1;qe=qe.prevZ}for(;Qe&&Qe.z<=Be;){if(Qe.x>=re&&Qe.x<=ge&&Qe.y>=ae&&Qe.y<=Se&&Qe!==_&&Qe!==C&&hM(L,K,z,Z,$,ee,Qe.x,Qe.y)&&Dl(Qe.prev,Qe,Qe.next)>=0)return!1;Qe=Qe.nextZ}return!0}function fHe(p,c){let h=p;do{const g=h.prev,_=h.next.next;!t4(g,_)&&Ive(g,h,h.next,_)&&mM(g,_)&&mM(_,g)&&(c.push(g.i,h.i,_.i),pM(h),pM(h.next),h=p=_),h=h.next}while(h!==p);return v_(h)}function gHe(p,c,h,g,_,S){let C=p;do{let L=C.next.next;for(;L!==C.prev;){if(C.i!==L.i&&bHe(C,L)){let z=Pve(C,L);return C=v_(C,C.next),z=v_(z,z.next),uM(C,c,h,g,_,S,0),void uM(z,c,h,g,_,S,0)}L=L.next}C=C.next}while(C!==p)}function xHe(p,c){let h=p.x-c.x;return h===0&&(h=p.y-c.y,h===0)&&(h=(p.next.y-p.y)/(p.next.x-p.x)-(c.next.y-c.y)/(c.next.x-c.x)),h}function yHe(p,c){const h=function(_,S){let C=S;const L=_.x,z=_.y;let $,K=-1/0;if(t4(_,C))return C;do{if(t4(_,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&&Eve(z$.x||C.x===$.x&&vHe($,C)))&&($=C,ae=ge)}C=C.next}while(C!==Z);return $}(p,c);if(!h)return c;const g=Pve(h,p);return v_(g,g.next),v_(h,h.next)}function vHe(p,c){return Dl(p.prev,p,c.prev)<0&&Dl(c.next,p,p.next)<0}function Coe(p,c,h,g,_){return(p=1431655765&((p=858993459&((p=252645135&((p=16711935&((p=(p-h)*_|0)|p<<8))|p<<4))|p<<2))|p<<1))|(c=1431655765&((c=858993459&((c=252645135&((c=16711935&((c=(c-g)*_|0)|c<<8))|c<<4))|c<<2))|c<<1))<<1}function _He(p){let c=p,h=p;do(c.x=(p-C)*(S-L)&&(p-C)*(g-L)>=(h-C)*(c-L)&&(h-C)*(S-L)>=(_-C)*(g-L)}function hM(p,c,h,g,_,S,C,L){return!(p===C&&c===L)&&Eve(p,c,h,g,_,S,C,L)}function bHe(p,c){return p.next.i!==c.i&&p.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&&Ive(_,_.next,h,g))return!0;_=_.next}while(_!==h);return!1}(p,c)&&(mM(p,c)&&mM(c,p)&&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}(p,c)&&(Dl(p.prev,p,c.prev)||Dl(p,c.prev,c))||t4(p,c)&&Dl(p.prev,p,p.next)>0&&Dl(c.prev,c,c.next)>0)}function Dl(p,c,h){return(c.y-p.y)*(h.x-c.x)-(c.x-p.x)*(h.y-c.y)}function t4(p,c){return p.x===c.x&&p.y===c.y}function Ive(p,c,h,g){const _=B6(Dl(p,c,h)),S=B6(Dl(p,c,g)),C=B6(Dl(h,g,p)),L=B6(Dl(h,g,c));return _!==S&&C!==L||!(_!==0||!z6(p,h,c))||!(S!==0||!z6(p,g,c))||!(C!==0||!z6(h,p,g))||!(L!==0||!z6(h,c,g))}function z6(p,c,h){return c.x<=Math.max(p.x,h.x)&&c.x>=Math.min(p.x,h.x)&&c.y<=Math.max(p.y,h.y)&&c.y>=Math.min(p.y,h.y)}function B6(p){return p>0?1:p<0?-1:0}function mM(p,c){return Dl(p.prev,p,p.next)<0?Dl(p,c,p.next)>=0&&Dl(p,p.prev,c)>=0:Dl(p,c,p.prev)<0||Dl(p,p.next,c)<0}function Pve(p,c){const h=Moe(p.i,p.x,p.y),g=Moe(c.i,c.x,c.y),_=p.next,S=c.prev;return p.next=c,c.prev=p,h.next=_,_.prev=h,g.next=h,h.prev=g,S.next=g,g.prev=S,g}function Lve(p,c,h,g){const _=Moe(p,c,h);return g?(_.next=g.next,_.prev=g,g.next.prev=_,g.next=_):(_.prev=_,_.next=_),_}function pM(p){p.next.prev=p.prev,p.prev.next=p.next,p.prevZ&&(p.prevZ.nextZ=p.nextZ),p.nextZ&&(p.nextZ.prevZ=p.prevZ)}function Moe(p,c,h){return{i:p,x:c,y:h,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function fM(p,c){const h=p.length;if(h<=1)return[p];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 Ax;let h=[];for(const z of c)h.push(...z.portals);if(h.length===0)return new Ax;for(const z of h){const $=z.va,K=z.vb;(Ax.isOnBorder($.x,K.x)||Ax.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 Ax;_.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}}}as(Ax,"ElevationPortalGraph"),as(Dve,"ElevationPolygons");class jHe{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=he(),C=he();for(let L=0;LS!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new Qh(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||xc(Z,ee,L))||this.isOnBorder(Z.x,ee.x)||this.isOnBorder(Z.y,ee.y))continue;const re=Bu.computeEdgeHash(this.unevalVertices[$],this.unevalVertices[K]);let ae,ge=this.vertexHashLookup.get(Bu.computePosHash(Z));ge!=null?ae=ge.next:(ge=this.vertexHashLookup.get(Bu.computePosHash(ee)),ae=ge!=null?ge.prev:re),this.unevalEdges.push({polygonIdx:c,a:$,b:K,hash:re,portalHash:ae,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=Bu.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 jHe(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 ae=ee.findIndex(ge=>ge.type!==re);return ae>=0?ae: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=Vi.simpleSegment(0,Z.primitiveOffset,0,Z.primitiveLength),this.depthSegments=Vi.simpleSegment(0,C.primitiveOffset,0,C.primitiveLength),this.renderableBridgeSegments=Vi.simpleSegment(0,L.primitiveOffset,0,L.primitiveLength),this.renderableTunnelSegments=Vi.simpleSegment(0,K.primitiveOffset,0,K.primitiveLength),this.shadowCasterSegments=Vi.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,uHe.members),this.vertexBufferNormal=c.createVertexBuffer(this.vertexNormals,hHe.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;$ce(yr,h[_r].x,h[_r].y,g[_r]*z),Z=he(),ee=he(),re=he(),ae=he(),ge=he(),Se=(yr,_r)=>{const mr=L.get(Bu.computePosHash(h[_r])),gr=mr.from,rr=mr.to;if(!gr||!rr)return;K(Z,gr),K(ee,_r),K(re,rr),Je(ae),rt(Z,ee)||(je(ge,ee,Z),$e(ae,ge)),rt(re,ee)||(je(ge,re,ee),de(ae,ae,$e(ge,ge)));const Jt=Ce(ae);return Jt>0?we(yr,ae,1/Jt):void 0};let Ne=Number.POSITIVE_INFINITY;this.sortSubarray(_,S.min,S.max,(yr,_r)=>yr.featureInfo.featureIndex-_r.featureInfo.featureIndex);const Be=he(),qe=he(),Qe=he(),vt=he(),mt=he(),jt=he(),At=he(),Pt=he(),Qt=he(),Ft=[he(),he(),he(),he()],sr=[he(),he(),he(),he()],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-Be.featureInfo.featureIndex;this.sortSubarray(_,S.min,S.max,z),this.sortSubarray(_,C.min,C.max,z);const $=Ne=>$e(Ne,Ne),K=[{coord:new or(0,0),height:0},{coord:new or(0,0),height:0}],Z=(Ne,Be)=>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(Bu.computePosHash(c))<<32n|BigInt(Bu.computePosHash(h))}static computePosHash(c){return((65535&c.x)<<16|65535&c.y)>>>0}}var Rve,Fve={exports:{}},zve=(Rve||(Rve=1,function(p){function c(pt,_t){return pt>_t?1:pt<_t?-1:0}var h=function(pt,_t){pt===void 0&&(pt=c),_t===void 0&&(_t=!1),this._compare=pt,this._root=null,this._size=0,this._noDuplicates=!!_t},g={size:{configurable:!0}};function _(pt,_t,nr,vr,Ur){var qr=Ur-vr;if(qr>0){var ws=vr+Math.floor(qr/2),Cs={key:_t[ws],data:nr[ws],parent:pt};return Cs.left=_(Cs,_t,nr,vr,ws),Cs.right=_(Cs,_t,nr,ws+1,Ur),Cs}return null}function S(pt,_t,nr,vr,Ur){if(!(nr>=vr)){for(var qr=pt[nr+vr>>1],ws=nr-1,Cs=vr+1;;){do ws++;while(Ur(pt[ws],qr)<0);do Cs--;while(Ur(pt[Cs],qr)>0);if(ws>=Cs)break;var cn=pt[ws];pt[ws]=pt[Cs],pt[Cs]=cn,cn=_t[ws],_t[ws]=_t[Cs],_t[Cs]=cn}S(pt,_t,nr,Cs,Ur),S(pt,_t,Cs+1,vr,Ur)}}h.prototype.rotateLeft=function(pt){var _t=pt.right;_t&&(pt.right=_t.left,_t.left&&(_t.left.parent=pt),_t.parent=pt.parent),pt.parent?pt===pt.parent.left?pt.parent.left=_t:pt.parent.right=_t:this._root=_t,_t&&(_t.left=pt),pt.parent=_t},h.prototype.rotateRight=function(pt){var _t=pt.left;_t&&(pt.left=_t.right,_t.right&&(_t.right.parent=pt),_t.parent=pt.parent),pt.parent?pt===pt.parent.left?pt.parent.left=_t:pt.parent.right=_t:this._root=_t,_t&&(_t.right=pt),pt.parent=_t},h.prototype._splay=function(pt){for(;pt.parent;){var _t=pt.parent;_t.parent?_t.left===pt&&_t.parent.left===_t?(this.rotateRight(_t.parent),this.rotateRight(_t)):_t.right===pt&&_t.parent.right===_t?(this.rotateLeft(_t.parent),this.rotateLeft(_t)):_t.left===pt&&_t.parent.right===_t?(this.rotateRight(_t),this.rotateLeft(_t)):(this.rotateLeft(_t),this.rotateRight(_t)):_t.left===pt?this.rotateRight(_t):this.rotateLeft(_t)}},h.prototype.splay=function(pt){for(var _t,nr,vr,Ur,qr;pt.parent;)(nr=(_t=pt.parent).parent)&&nr.parent?((vr=nr.parent).left===nr?vr.left=pt:vr.right=pt,pt.parent=vr):(pt.parent=null,this._root=pt),Ur=pt.left,qr=pt.right,pt===_t.left?(nr&&(nr.left===_t?(_t.right?(nr.left=_t.right,nr.left.parent=nr):nr.left=null,_t.right=nr,nr.parent=_t):(Ur?(nr.right=Ur,Ur.parent=nr):nr.right=null,pt.left=nr,nr.parent=pt)),qr?(_t.left=qr,qr.parent=_t):_t.left=null,pt.right=_t,_t.parent=pt):(nr&&(nr.right===_t?(_t.left?(nr.right=_t.left,nr.right.parent=nr):nr.right=null,_t.left=nr,nr.parent=_t):(qr?(nr.left=qr,qr.parent=nr):nr.left=null,pt.right=nr,nr.parent=pt)),Ur?(_t.right=Ur,Ur.parent=_t):_t.right=null,pt.left=_t,_t.parent=pt)},h.prototype.replace=function(pt,_t){pt.parent?pt===pt.parent.left?pt.parent.left=_t:pt.parent.right=_t:this._root=_t,_t&&(_t.parent=pt.parent)},h.prototype.minNode=function(pt){if(pt===void 0&&(pt=this._root),pt)for(;pt.left;)pt=pt.left;return pt},h.prototype.maxNode=function(pt){if(pt===void 0&&(pt=this._root),pt)for(;pt.right;)pt=pt.right;return pt},h.prototype.insert=function(pt,_t){var nr=this._root,vr=null,Ur=this._compare;if(this._noDuplicates)for(;nr;){if(vr=nr,Ur(nr.key,pt)===0)return;nr=Ur(nr.key,pt)<0?nr.right:nr.left}else for(;nr;)vr=nr,nr=Ur(nr.key,pt)<0?nr.right:nr.left;return nr={key:pt,data:_t,left:null,right:null,parent:vr},vr?Ur(vr.key,nr.key)<0?vr.right=nr:vr.left=nr:this._root=nr,this.splay(nr),this._size++,nr},h.prototype.find=function(pt){for(var _t=this._root,nr=this._compare;_t;){var vr=nr(_t.key,pt);if(vr<0)_t=_t.right;else{if(!(vr>0))return _t;_t=_t.left}}return null},h.prototype.contains=function(pt){for(var _t=this._root,nr=this._compare;_t;){var vr=nr(pt,_t.key);if(vr===0)return!0;_t=vr<0?_t.left:_t.right}return!1},h.prototype.remove=function(pt){var _t=this.find(pt);if(!_t)return!1;if(this.splay(_t),_t.left)if(_t.right){var nr=this.minNode(_t.right);nr.parent!==_t&&(this.replace(nr,nr.right),nr.right=_t.right,nr.right.parent=nr),this.replace(_t,nr),nr.left=_t.left,nr.left.parent=nr}else this.replace(_t,_t.left);else this.replace(_t,_t.right);return this._size--,!0},h.prototype.removeNode=function(pt){if(!pt)return!1;if(this.splay(pt),pt.left)if(pt.right){var _t=this.minNode(pt.right);_t.parent!==pt&&(this.replace(_t,_t.right),_t.right=pt.right,_t.right.parent=_t),this.replace(pt,_t),_t.left=pt.left,_t.left.parent=_t}else this.replace(pt,pt.left);else this.replace(pt,pt.right);return this._size--,!0},h.prototype.erase=function(pt){var _t=this.find(pt);if(_t){this.splay(_t);var nr=_t.left,vr=_t.right,Ur=null;nr&&(nr.parent=null,Ur=this.maxNode(nr),this.splay(Ur),this._root=Ur),vr&&(nr?Ur.right=vr:this._root=vr,vr.parent=Ur),this._size--}},h.prototype.pop=function(){var pt=this._root,_t=null;if(pt){for(;pt.left;)pt=pt.left;_t={key:pt.key,data:pt.data},this.remove(pt.key)}return _t},h.prototype.next=function(pt){var _t=pt;if(_t)if(_t.right)for(_t=_t.right;_t&&_t.left;)_t=_t.left;else for(_t=pt.parent;_t&&_t.right===pt;)pt=_t,_t=_t.parent;return _t},h.prototype.prev=function(pt){var _t=pt;if(_t)if(_t.left)for(_t=_t.left;_t&&_t.right;)_t=_t.right;else for(_t=pt.parent;_t&&_t.left===pt;)pt=_t,_t=_t.parent;return _t},h.prototype.forEach=function(pt){for(var _t=this._root,nr=[],vr=!1,Ur=0;!vr;)_t?(nr.push(_t),_t=_t.left):nr.length>0?(pt(_t=nr.pop(),Ur++),_t=_t.right):vr=!0;return this},h.prototype.range=function(pt,_t,nr,vr){for(var Ur=[],qr=this._compare,ws=this._root;Ur.length!==0||ws;)if(ws)Ur.push(ws),ws=ws.left;else{if(qr((ws=Ur.pop()).key,_t)>0)break;if(qr(ws.key,pt)>=0&&nr.call(vr,ws))return this;ws=ws.right}return this},h.prototype.keys=function(){for(var pt=this._root,_t=[],nr=[],vr=!1;!vr;)pt?(_t.push(pt),pt=pt.left):_t.length>0?(pt=_t.pop(),nr.push(pt.key),pt=pt.right):vr=!0;return nr},h.prototype.values=function(){for(var pt=this._root,_t=[],nr=[],vr=!1;!vr;)pt?(_t.push(pt),pt=pt.left):_t.length>0?(pt=_t.pop(),nr.push(pt.data),pt=pt.right):vr=!0;return nr},h.prototype.at=function(pt){for(var _t=this._root,nr=[],vr=!1,Ur=0;!vr;)if(_t)nr.push(_t),_t=_t.left;else if(nr.length>0){if(_t=nr.pop(),Ur===pt)return _t;Ur++,_t=_t.right}else vr=!0;return null},h.prototype.load=function(pt,_t,nr){if(pt===void 0&&(pt=[]),_t===void 0&&(_t=[]),nr===void 0&&(nr=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var vr=pt.length;return nr&&S(pt,_t,0,vr-1,this._compare),this._root=_(null,pt,_t,0,vr),this._size=vr,this},h.prototype.min=function(){var pt=this.minNode(this._root);return pt?pt.key:null},h.prototype.max=function(){var pt=this.maxNode(this._root);return pt?pt.key:null},h.prototype.isEmpty=function(){return this._root===null},g.size.get=function(){return this._size},h.createTree=function(pt,_t,nr,vr,Ur){return new h(nr,Ur).load(pt,_t,vr)},Object.defineProperties(h.prototype,g);var C=0,L=1,z=2,$=3,K=0,Z=1,ee=2,re=3;function ae(pt,_t,nr){_t===null?(pt.inOut=!1,pt.otherInOut=!0):(pt.isSubject===_t.isSubject?(pt.inOut=!_t.inOut,pt.otherInOut=_t.otherInOut):(pt.inOut=!_t.otherInOut,pt.otherInOut=_t.isVertical()?!_t.inOut:_t.inOut),_t&&(pt.prevInResult=!ge(_t,nr)||_t.isVertical()?_t.prevInResult:_t));var vr=ge(pt,nr);pt.resultTransition=vr?function(Ur,qr){var ws,Cs=!Ur.inOut,cn=!Ur.otherInOut;switch(qr){case K:ws=Cs&&cn;break;case Z:ws=Cs||cn;break;case re:ws=Cs^cn;break;case ee:ws=Ur.isSubject?Cs&&!cn:cn&&!Cs}return ws?1:-1}(pt,nr):0}function ge(pt,_t){switch(pt.type){case C:switch(_t){case K:return!pt.otherInOut;case Z:return pt.otherInOut;case ee:return pt.isSubject&&pt.otherInOut||!pt.isSubject&&!pt.otherInOut;case re:return!0}break;case z:return _t===K||_t===Z;case $:return _t===ee;case L:return!1}return!1}var Se=function(pt,_t,nr,vr,Ur){this.left=_t,this.point=pt,this.otherEvent=nr,this.isSubject=vr,this.type=Ur||C,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},Ne={inResult:{configurable:!0}};function Be(pt,_t){return pt[0]===_t[0]&&pt[1]===_t[1]}Se.prototype.isBelow=function(pt){var _t=this.point,nr=this.otherEvent.point;return this.left?(_t[0]-pt[0])*(nr[1]-pt[1])-(nr[0]-pt[0])*(_t[1]-pt[1])>0:(nr[0]-pt[0])*(_t[1]-pt[1])-(_t[0]-pt[0])*(nr[1]-pt[1])>0},Se.prototype.isAbove=function(pt){return!this.isBelow(pt)},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 pt=new Se(this.point,this.left,this.otherEvent,this.isSubject,this.type);return pt.contourId=this.contourId,pt.resultTransition=this.resultTransition,pt.prevInResult=this.prevInResult,pt.isExteriorRing=this.isExteriorRing,pt.inOut=this.inOut,pt.otherInOut=this.otherInOut,pt},Object.defineProperties(Se.prototype,Ne);var qe=11102230246251565e-32,Qe=134217729,vt=(3+8*qe)*qe;function mt(pt,_t,nr,vr,Ur){var qr,ws,Cs,cn,yn=_t[0],wn=vr[0],qn=0,Ds=0;wn>yn==wn>-yn?(qr=yn,yn=_t[++qn]):(qr=wn,wn=vr[++Ds]);var Ks=0;if(qnyn==wn>-yn?(Cs=qr-((ws=yn+qr)-yn),yn=_t[++qn]):(Cs=qr-((ws=wn+qr)-wn),wn=vr[++Ds]),qr=ws,Cs!==0&&(Ur[Ks++]=Cs);qnyn==wn>-yn?(Cs=qr-((ws=qr+yn)-(cn=ws-qr))+(yn-cn),yn=_t[++qn]):(Cs=qr-((ws=qr+wn)-(cn=ws-qr))+(wn-cn),wn=vr[++Ds]),qr=ws,Cs!==0&&(Ur[Ks++]=Cs);for(;qn0!=qn>0)return Ds;var Ks=Math.abs(wn+qn);return Math.abs(Ds)>=At*Ks?Ds:-function(ma,ya,va,za,ri,Ya,Ca){var Ia,vn,ta,Fi,Ls,Vn,Qa,ai,ui,jo,oi,Os,Gi,Ba,Ai,rl,Nl,qo,Vo=ma-ri,ml=va-ri,Xd=ya-Ya,li=za-Ya;Ft[0]=(Ai=(ai=Vo-(Qa=(Vn=Qe*Vo)-(Vn-Vo)))*(jo=li-(ui=(Vn=Qe*li)-(Vn-li)))-((Ba=Vo*li)-Qa*ui-ai*ui-Qa*jo))-((oi=Ai-(Nl=(ai=Xd-(Qa=(Vn=Qe*Xd)-(Vn-Xd)))*(jo=ml-(ui=(Vn=Qe*ml)-(Vn-ml)))-((rl=Xd*ml)-Qa*ui-ai*ui-Qa*jo)))+(Ls=Ai-oi))+(Ls-Nl),Ft[1]=(Gi=Ba-((Os=Ba+oi)-(Ls=Os-Ba))+(oi-Ls))-((oi=Gi-rl)+(Ls=Gi-oi))+(Ls-rl),Ft[2]=Os-((qo=Os+oi)-(Ls=qo-Os))+(oi-Ls),Ft[3]=qo;var xo=function(pg,yc){for(var Md=yc[0],Uu=1;Uu<4;Uu++)Md+=yc[Uu];return Md}(0,Ft),ko=Pt*Ca;if(xo>=ko||-xo>=ko||(Ia=ma-(Vo+(Ls=ma-Vo))+(Ls-ri),ta=va-(ml+(Ls=va-ml))+(Ls-ri),vn=ya-(Xd+(Ls=ya-Xd))+(Ls-Ya),Fi=za-(li+(Ls=za-li))+(Ls-Ya),Ia===0&&vn===0&&ta===0&&Fi===0)||(ko=Qt*Ca+vt*Math.abs(xo),(xo+=Vo*Fi+li*Ia-(Xd*ta+ml*vn))>=ko||-xo>=ko))return xo;yr[0]=(Ai=(ai=Ia-(Qa=(Vn=Qe*Ia)-(Vn-Ia)))*(jo=li-(ui=(Vn=Qe*li)-(Vn-li)))-((Ba=Ia*li)-Qa*ui-ai*ui-Qa*jo))-((oi=Ai-(Nl=(ai=vn-(Qa=(Vn=Qe*vn)-(Vn-vn)))*(jo=ml-(ui=(Vn=Qe*ml)-(Vn-ml)))-((rl=vn*ml)-Qa*ui-ai*ui-Qa*jo)))+(Ls=Ai-oi))+(Ls-Nl),yr[1]=(Gi=Ba-((Os=Ba+oi)-(Ls=Os-Ba))+(oi-Ls))-((oi=Gi-rl)+(Ls=Gi-oi))+(Ls-rl),yr[2]=Os-((qo=Os+oi)-(Ls=qo-Os))+(oi-Ls),yr[3]=qo;var uu=mt(4,Ft,4,yr,sr);yr[0]=(Ai=(ai=Vo-(Qa=(Vn=Qe*Vo)-(Vn-Vo)))*(jo=Fi-(ui=(Vn=Qe*Fi)-(Vn-Fi)))-((Ba=Vo*Fi)-Qa*ui-ai*ui-Qa*jo))-((oi=Ai-(Nl=(ai=Xd-(Qa=(Vn=Qe*Xd)-(Vn-Xd)))*(jo=ta-(ui=(Vn=Qe*ta)-(Vn-ta)))-((rl=Xd*ta)-Qa*ui-ai*ui-Qa*jo)))+(Ls=Ai-oi))+(Ls-Nl),yr[1]=(Gi=Ba-((Os=Ba+oi)-(Ls=Os-Ba))+(oi-Ls))-((oi=Gi-rl)+(Ls=Gi-oi))+(Ls-rl),yr[2]=Os-((qo=Os+oi)-(Ls=qo-Os))+(oi-Ls),yr[3]=qo;var sl=mt(uu,sr,4,yr,dr);yr[0]=(Ai=(ai=Ia-(Qa=(Vn=Qe*Ia)-(Vn-Ia)))*(jo=Fi-(ui=(Vn=Qe*Fi)-(Vn-Fi)))-((Ba=Ia*Fi)-Qa*ui-ai*ui-Qa*jo))-((oi=Ai-(Nl=(ai=vn-(Qa=(Vn=Qe*vn)-(Vn-vn)))*(jo=ta-(ui=(Vn=Qe*ta)-(Vn-ta)))-((rl=vn*ta)-Qa*ui-ai*ui-Qa*jo)))+(Ls=Ai-oi))+(Ls-Nl),yr[1]=(Gi=Ba-((Os=Ba+oi)-(Ls=Os-Ba))+(oi-Ls))-((oi=Gi-rl)+(Ls=Gi-oi))+(Ls-rl),yr[2]=Os-((qo=Os+oi)-(Ls=qo-Os))+(oi-Ls),yr[3]=qo;var Wm=mt(sl,dr,4,yr,ur);return ur[Wm-1]}(Ur,qr,ws,Cs,cn,yn,Ks)}(pt[0],pt[1],_t[0],_t[1],nr[0],nr[1]);return vr>0?-1:vr<0?1:0}function mr(pt,_t){var nr=pt.point,vr=_t.point;return nr[0]>vr[0]?1:nr[0]vr[1]?1:-1:function(Ur,qr,ws,Cs){return Ur.left!==qr.left?Ur.left?1:-1:_r(ws,Ur.otherEvent.point,qr.otherEvent.point)!==0?Ur.isBelow(qr.otherEvent.point)?-1:1:!Ur.isSubject&&qr.isSubject?1:-1}(pt,_t,nr)}function gr(pt,_t,nr){var vr=new Se(_t,!1,pt,pt.isSubject),Ur=new Se(_t,!0,pt.otherEvent,pt.isSubject);return Be(pt.point,pt.otherEvent.point)&&console.warn("what is that, a collapsed segment?",pt),vr.contourId=Ur.contourId=pt.contourId,mr(Ur,pt.otherEvent)>0&&(pt.otherEvent.left=!0,Ur.left=!1),pt.otherEvent.otherEvent=Ur,pt.otherEvent=vr,nr.push(Ur),nr.push(vr),nr}function rr(pt,_t){return pt[0]*_t[1]-pt[1]*_t[0]}function Jt(pt,_t){return pt[0]*_t[0]+pt[1]*_t[1]}function xr(pt,_t,nr){var vr=function(cn,yn,wn,qn,Ds){var Ks=[yn[0]-cn[0],yn[1]-cn[1]],ma=[qn[0]-wn[0],qn[1]-wn[1]];function ya(Vn,Qa,ai){return[Vn[0]+Qa*ai[0],Vn[1]+Qa*ai[1]]}var va=[wn[0]-cn[0],wn[1]-cn[1]],za=rr(Ks,ma),ri=za*za,Ya=Jt(Ks,Ks);if(ri>0){var Ca=rr(va,ma)/za;if(Ca<0||Ca>1)return null;var Ia=rr(va,Ks)/za;return Ia<0||Ia>1?null:Ca===0||Ca===1?[ya(cn,Ca,Ks)]:Ia===0||Ia===1?[ya(wn,Ia,ma)]:[ya(cn,Ca,Ks)]}if((ri=(za=rr(va,Ks))*za)>0)return null;var vn=Jt(Ks,va)/Ya,ta=vn+Jt(Ks,ma)/Ya,Fi=Math.min(vn,ta),Ls=Math.max(vn,ta);return Fi<=1&&Ls>=0?Fi===1?[ya(cn,Fi>0?Fi:0,Ks)]:Ls===0?[ya(cn,Ls<1?Ls:1,Ks)]:[ya(cn,Fi>0?Fi:0,Ks),ya(cn,Ls<1?Ls:1,Ks)]:null}(pt.point,pt.otherEvent.point,_t.point,_t.otherEvent.point),Ur=vr?vr.length:0;if(Ur===0||Ur===1&&(Be(pt.point,_t.point)||Be(pt.otherEvent.point,_t.otherEvent.point))||Ur===2&&pt.isSubject===_t.isSubject)return 0;if(Ur===1)return Be(pt.point,vr[0])||Be(pt.otherEvent.point,vr[0])||gr(pt,vr[0],nr),Be(_t.point,vr[0])||Be(_t.otherEvent.point,vr[0])||gr(_t,vr[0],nr),1;var qr=[],ws=!1,Cs=!1;return Be(pt.point,_t.point)?ws=!0:mr(pt,_t)===1?qr.push(_t,pt):qr.push(pt,_t),Be(pt.otherEvent.point,_t.otherEvent.point)?Cs=!0:mr(pt.otherEvent,_t.otherEvent)===1?qr.push(_t.otherEvent,pt.otherEvent):qr.push(pt.otherEvent,_t.otherEvent),ws&&Cs||ws?(_t.type=L,pt.type=_t.inOut===pt.inOut?z:$,ws&&!Cs&&gr(qr[1].otherEvent,qr[0].point,nr),2):Cs?(gr(qr[0],qr[1].point,nr),3):qr[0]!==qr[3].otherEvent?(gr(qr[0],qr[1].point,nr),gr(qr[1],qr[2].point,nr),3):(gr(qr[0],qr[1].point,nr),gr(qr[3].otherEvent,qr[2].point,nr),3)}function Er(pt,_t){if(pt===_t)return 0;if(_r(pt.point,pt.otherEvent.point,_t.point)!==0||_r(pt.point,pt.otherEvent.point,_t.otherEvent.point)!==0)return Be(pt.point,_t.point)?pt.isBelow(_t.otherEvent.point)?-1:1:pt.point[0]===_t.point[0]?pt.point[1]<_t.point[1]?-1:1:mr(pt,_t)===1?_t.isAbove(pt.point)?-1:1:pt.isBelow(_t.point)?-1:1;if(pt.isSubject!==_t.isSubject)return pt.isSubject?-1:1;var nr=pt.point,vr=_t.point;return nr[0]===vr[0]&&nr[1]===vr[1]?(nr=pt.otherEvent.point)[0]===(vr=_t.otherEvent.point)[0]&&nr[1]===vr[1]?0:pt.contourId>_t.contourId?1:-1:mr(pt,_t)===1?1:-1}var jr=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function bs(pt,_t,nr,vr){var Ur,qr=pt+1,ws=_t[pt].point,Cs=_t.length;for(qrvr;)qr--;return qr}jr.prototype.isExterior=function(){return this.holeOf==null};var Gr=hs,es=hs;function hs(pt,_t){if(!(this instanceof hs))return new hs(pt,_t);if(this.data=pt||[],this.length=this.data.length,this.compare=_t||kn,this.length>0)for(var nr=(this.length>>1)-1;nr>=0;nr--)this._down(nr)}function kn(pt,_t){return pt<_t?-1:pt>_t?1:0}hs.prototype={push:function(pt){this.data.push(pt),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var pt=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),pt}},peek:function(){return this.data[0]},_up:function(pt){for(var _t=this.data,nr=this.compare,vr=_t[pt];pt>0;){var Ur=pt-1>>1,qr=_t[Ur];if(nr(vr,qr)>=0)break;_t[pt]=qr,pt=Ur}_t[pt]=vr},_down:function(pt){for(var _t=this.data,nr=this.compare,vr=this.length>>1,Ur=_t[pt];pt=0)break;_t[pt]=Cs,pt=qr}_t[pt]=Ur}},Gr.default=es;var Nr=Math.max,ps=Math.min,Qs=0;function Zn(pt,_t,nr,vr,Ur,qr){var ws,Cs,cn,yn,wn,qn;for(ws=0,Cs=pt.length-1;ws0?qn.left=!0:wn.left=!0;var Ds=cn[0],Ks=cn[1];Ur[0]=ps(Ur[0],Ds),Ur[1]=ps(Ur[1],Ks),Ur[2]=Nr(Ur[2],Ds),Ur[3]=Nr(Ur[3],Ks),vr.push(wn),vr.push(qn)}}var ra=[];function hn(pt,_t,nr){typeof pt[0][0][0]=="number"&&(pt=[pt]),typeof _t[0][0][0]=="number"&&(_t=[_t]);var vr=function(Ks,ma,ya){var va=null;return Ks.length*ma.length==0&&(ya===K?va=ra:ya===ee?va=Ks:ya!==Z&&ya!==re||(va=Ks.length===0?ma:Ks)),va}(pt,_t,nr);if(vr)return vr===ra?null:vr;var Ur=[1/0,1/0,-1/0,-1/0],qr=[1/0,1/0,-1/0,-1/0],ws=function(Ks,ma,ya,va,za){var ri,Ya,Ca,Ia,vn,ta,Fi=new Gr(null,mr);for(Ca=0,Ia=Ks.length;Cava[2]||va[0]>ya[2]||ya[1]>va[3]||va[1]>ya[3])&&(za===K?ri=ra:za===ee?ri=Ks:za!==Z&&za!==re||(ri=Ks.concat(ma))),ri}(pt,_t,Ur,qr,nr))return vr===ra?null:vr;for(var Cs=function(Ks){var ma,ya,va=function(Ca){var Ia,vn,ta,Fi,Ls=[];for(vn=0,ta=Ca.length;vn0){var oi=Vn[jo];if(oi.holeOf!=null){var Os=oi.holeOf;Vn[Os].holeIds.push(Qa),ai.holeOf=Os,ai.depth=Vn[jo].depth}else Vn[jo].holeIds.push(Qa),ai.holeOf=jo,ai.depth=Vn[jo].depth+1}else ai.holeOf=null,ai.depth=Vn[jo].depth}else ai.holeOf=null,ai.depth=0;return ai}(va[ma],ri,Ca),vn=function(Ls){za[Ls]=!0,Ls=va.length)&&va[ta];);ri.push(Ia)}};for(ma=0,ya=va.length;maFi||ri===ee&&Ls.point[0]>va[2])break;if(Ls.left){Ca=Ya=vn.insert(Ls),Ya=Ya!==(Ia=vn.minNode())?vn.prev(Ya):null,Ca=vn.next(Ca);var Vn=Ya?Ya.key:null;if(ae(Ls,Vn,ri),Ca&&xr(Ls,Ca.key,Ks)===2&&(ae(Ls,Vn,ri),ae(Ca.key,Ls,ri)),Ya&&xr(Ya.key,Ls,Ks)===2){var Qa=Ya;ae(Vn,(Qa=Qa!==Ia?vn.prev(Qa):null)?Qa.key:null,ri),ae(Ls,Vn,ri)}}else Ca=Ya=vn.find(Ls=Ls.otherEvent),Ya&&Ca&&(Ya=Ya!==Ia?vn.prev(Ya):null,Ca=vn.next(Ca),vn.remove(Ls),Ca&&Ya&&xr(Ya.key,Ca.key,Ks))}return ta}(ws,0,0,Ur,qr,nr)),cn=[],yn=0;yn * @license MIT * @preserve */function $6(p,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 p){const L=[];for(const z of C){if(z.length<=2)continue;const $=[];for(let ee=0;eec&&S($,re,ae,ge,Se,c):Ne>h?Be=c&&S($,re,ae,ge,Se,c),Be>h&&Ne<=h&&S($,re,ae,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 kHe(p,c){const h=Eoe(p),g=Eoe([c]),_=zve.intersection(h,g);return _==null?[]:Bve(_)}function NHe(p,c){let g=Eoe(p,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 ae=Math.trunc(ee/re*3),ge=-Math.trunc(Z/re*3);_.push([[[L,z],[$,K],[$+ae,K+ge],[L+ae,z+ge],[L,z]]])}return _.length>0&&(g=zve.diff(g,_)),Bve(g,1/65536)}function Eoe(p,c=1){return[p.map(h=>h.map(g=>[g.x*c,g.y*c]))]}function Bve(p,c=1){return p.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 Ioe{constructor(c,h){this.layoutVertexArray=new og,this.indexArray=new Jo,this.lineIndexArray=new Fu,this.triangleSegments=new Vi,this.lineSegments=new Vi,this.programConfigurations=new Qh(c.layers,{zoom:c.zoom,lut:c.lut}),this.uploaded=!1,h&&(this.elevatedLayoutVertexArray=new zp)}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,cHe.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,dHe.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 Poe{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 Ioe(c,!1),this.elevationBufferData=new Ioe(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=Toe("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 di(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),ee,g))continue;const re=S?S.evaluate(ee,{},g,h.availableImages):void 0,ae={id:z,properties:L.properties,type:L.type,sourceLayerIndex:K,index:$,geometry:Z?ee.geometry:Ct(L,g,_),patterns:{},sortKey:re};C.push(ae)}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=Aoe("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 $=fM(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=Aa.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 Bu($.elevationTileID,this.layers,this.zoom,this.lut));const Z=$.elevationFeature.isTunnel();let ee=0;c.properties.hasOwnProperty(Zt)&&(ee=+c.properties[Zt]);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 Ha(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 qe of z)$+=qe.length;const K=h.triangleSegments.prepareSegment($,h.layoutVertexArray,h.indexArray),Z=K.vertexLength,ee=[],re=[],ae=[],ge=[],Se=[],Ne=h.layoutVertexArray.length;for(const qe of z){if(qe.length===0)continue;qe!==z[0]&&re.push(ee.length/2);const Qe=h.lineSegments.prepareSegment(qe.length,h.layoutVertexArray,h.lineIndexArray),vt=Qe.vertexLength;g&&Se.push(h.layoutVertexArray.length-Ne),L(qe[0],ae,ge),h.layoutVertexArray.emplaceBack(qe[0].x,qe[0].y),h.lineIndexArray.emplaceBack(vt+qe.length-1,vt),ee.push(qe[0].x),ee.push(qe[0].y);for(let mt=1;mt0&&g&&this.elevationMode==="hd-road-base"){const qe=g.elevation.isTunnel(),Qe=g.elevation.safeArea,vt=this.elevatedStructures.addVertices(ae,ge);this.elevatedStructures.addTriangles(Be,vt,qe);const mt=Se.length;if(mt>0){for(let jt=0;jt=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(...kHe(ee,K));return Z}}let $ve,Uve,qve,Vve;as(Poe,"FillBucket",{omit:["layers","patternFeatures"]}),as(Ioe,"FillBufferData"),as(Bu,"ElevatedStructures");class U6{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=hg(c.x-this.min.x,this.xScale,this.cellsX),_=hg(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 _=hg(c.x-this.min.x,this.xScale,this.cellsX),S=hg(h.x-this.min.x,this.xScale,this.cellsX),C=hg(c.y-this.min.y,this.yScale,this.cellsY),L=hg(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 di(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:Ct(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 fM(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,p.clipScope)}function q6(p,c){return p.x-c.x||p.y-c.y}function Kve(p,c){return q6(p.min,c.min)===0&&q6(p.max,c.max)===0}function Loe(p,c){return!(p.min.x>c.max.x||p.max.xc.max.y||p.max.ynew or((z.x+S.x*Ar)*L-C.x*Ar,(z.y+S.y*Ar)*L-C.y*Ar))}return Ooe(h,_,p.indices,0,p.indices.length,0,0)}function Xve(p,c,h,g){const _=Math.pow(2,g.z-h.z);return new or((p+h.x*Ar)*_-g.x*Ar,(c+h.y*Ar)*_-g.y*Ar)}function Qve(p,c){const h=[];c.grid.queryPoint(p,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 Roe=Dt.types,OHe=["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"],DHe=["fill-extrusion-flood-light-ground-radius"],RHe=Math.pow(2,13),FHe=Math.pow(2,15)-1,e_e=new or(0,1),Ex=2147483648,t_e=7,r_e=450;function xM(p,c,h,g,_,S,C,L){p.emplaceBack((c<<1)+C,(h<<1)+S,(Math.floor(g*RHe)<<1)+_,Math.round(L))}function yM(p,c,h){p.emplaceBack(c.x*Ar,c.y*Ar,h?1:0)}function H6(p,c,h,g,_,S){p.emplaceBack(c.x,c.y,(h.x<<1)+g,(h.y<<1)+_,S)}function vM(p,c,h){p.emplaceBack(c.x,c.y,c.z,h[0]*16384,h[1]*16384,h[2]*16384)}class s_e{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class n_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 a_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,Us(h.y,c.y,(0-h.x)/(c.x-h.x))),h.x>Ar!=c.x>Ar&&this.addBorderIntersection(1,Us(h.y,c.y,(Ar-h.x)/(c.x-h.x))),h.y<0!=c.y<0&&this.addBorderIntersection(2,Us(h.x,c.x,(0-h.y)/(c.y-h.y))),h.y>Ar!=c.y>Ar&&this.addBorderIntersection(3,Us(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 i_e(p,c){const h=p.add(c)._unit(),g=ye(p.x*h.x+p.y*h.y,-1,1);var _,S,C;return _=Math.acos(g),Math.min(4,Math.max(-4,Math.tan(_)))/4*FHe*((S=p).x*(C=c).y-S.y*C.x<0?-1:1)}const zHe=[p=>p.x<0,p=>p.x>Ar,p=>p.y<0,p=>p.y>Ar];function BHe(p,c,h,g){const _=[4];if(g===0)return _;h._mult(g);const S=p.sub(h),C=c.sub(h),L=[p,c,S,C];for(let z=0;z<4;z++)for(const $ of L)if(zHe[z]($)){_.push(z);break}return _}class Foe{constructor(c){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new H5,this.indexArray=new Jo,this.programConfigurations=new Qh(c.layers,{zoom:c.zoom,lut:c.lut},h=>DHe.includes(h)),this._segments=new Vi,this.hiddenByLandmarkVertexArray=new UN,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Vi}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=i_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 Vi);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,CHe.members),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.groundRadiusArray!=null&&(this.groundRadiusBuffer=c.createVertexBuffer(this.groundRadiusArray,MHe.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&Ex))}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,EHe.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 W6{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 Jo,this.footprintVertices=new og,this.footprintSegments=[],this.layoutVertexArray=new _0,this.centroidVertexArray=new P6,this.wallVertexArray=new d_,this.indexArray=new Jo,this.programConfigurations=new Qh(c.layers,{zoom:c.zoom,lut:c.lut},h=>OHe.includes(h)),this.segments=new Vi,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.groundEffect=new Foe(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=Toe("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=Re(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 di(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),K,g))continue;const Z={id:C,sourceLayerIndex:z,index:L,geometry:$?K.geometry:Ct(S,g,_),properties:S.properties,type:S.type,patterns:{}},ee=this.layoutVertexArray.length,re=Roe[Z.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:S.id,feature:Aoe("fill-extrusion",this.layers,Z,this.zoom,this.pixelRatio,h)});else if(this.wallMode)for(const ae of Z.geometry)for(const ge of Jve(ae,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 $=Roe[z.type]==="Polygon",{geometry:K}=z;if(this.wallMode)for(const Z of K)for(const ee of Jve(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,PHe),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.wallVertexBuffer=c.createVertexBuffer(this.wallVertexArray,AHe.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=c.createVertexBuffer(this.layoutVertexExtArray,IHe.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,THe.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",ae=this.wallMode||Roe[h.type]==="Polygon",ge=new a_e;ge.centroidDataIndex=this.centroidData.length;const Se=new n_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,Be=this.layers[0].paint.get("fill-extrusion-height").evaluate(h,{},S);let qe;if(Se.height=Be,Se.vertexArrayOffset=this.layoutVertexArray.length,Se.groundVertexArrayOffset=this.groundEffect.vertexArray.length,re&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new DN),this.wallMode){if(re)return void Kr("Non zero fill-extrusion-line-width is not yet supported on globe.");if(g.length!==1)return;qe=function(Ft){const sr=Ft[0].x===Ft[Ft.length-1].x&&Ft[0].y===Ft[Ft.length-1].y;(function(es){let hs=0;const kn=es.length;for(let Nr=0;Nr=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<(sr?3:2))return ur;let rr,Jt,xr,Er,jr,bs=0;for(;bs0;let Qs="miter";const Zn=2;Qs==="miter"&&Nr>Zn&&(Qs="bevel"),Qs==="bevel"&&(Nr>100&&(Qs="flipbevel"),Nr{const nr=new or(hn.x,hn.y),vr=new or(hn.x,hn.y);nr.x+=Za.x*_t,nr.y+=Za.y*_t,vr.x-=Za.x*Math.max(pt,1),vr.y-=Za.y*Math.max(pt,1),mr.push(Za),yr.push(nr),_r.push(vr)};if(Qs==="miter")hs._mult(Nr),ra(rr,hs,0,0);else if(Qs==="flipbevel")hs=jr.mult(-1),ra(rr,hs,0,0),ra(rr,hs.mult(-1),0,0);else{const hn=-Math.sqrt(Nr*Nr-1),Za=ps?hn:0,pt=ps?0:hn;Jt&&ra(rr,Er,Za,pt),xr&&ra(rr,jr,Za,pt)}}ur.geometry=[...yr,..._r.reverse(),yr[0]],ur.joinNormals=[...mr,...mr.reverse(),mr[mr.length-1]];const Gr=ur.geometry.length-1;for(let es=0;esFt<(sr.length-1)/2||Ft===sr.length-1,vt=this.wallMode?[g]:fM(g,500);for(let Ft=vt.length-1;Ft>=0;Ft--){const sr=vt[Ft];(sr.length===0||(mt=sr[0]).every(dr=>dr.x<=0)||mt.every(dr=>dr.x>=Ar)||mt.every(dr=>dr.y<=0)||mt.every(dr=>dr.y>=Ar))&&vt.splice(Ft,1)}var mt;let jt;if(re)jt=m_e(vt,Z,S);else{jt=[];for(const Ft of vt)jt.push({polygon:Ft,bounds:Z})}const At=ae?this.edgeRadius:0,Pt=At>0&&this.zoom<17,Qt=(Ft,sr)=>{if(Ft.length===0)return!1;const dr=Ft[Ft.length-1];return sr.x===dr.x&&sr.y===dr.y};for(const{polygon:Ft,bounds:sr}of jt){let dr=0,ur=0;for(const gr of Ft)ae&&!gr[0].equals(gr[gr.length-1])&&gr.push(gr[0]),ur+=ae?gr.length-1:gr.length;const yr=this.segments.prepareSegment((ae?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 s_e;if(mr.vertexOffset=this.footprintVertices.length,mr.indexOffset=3*this.footprintIndices.length,mr.ringIndices=[],ae){const gr=[],rr=[];dr=yr.vertexLength;for(let xr=0;xr4&&d_e(rr[rr.length-2],rr[0],rr[1]),xr=At?$He(rr[rr.length-2],rr[0],rr[1],At):0;const Er=[];let jr,bs,Gr;bs=rr[1].sub(rr[0])._perp()._unit();let es=!0;for(let hs=1,kn=0;hs0?1:0,Za=Nr.dist(ps);if(kn+Za>32768&&(kn=0),At){Gr=Qs.sub(ps)._perp()._unit();let vr=l_e(Nr,ps,Qs,o_e(bs,Gr),At);isNaN(vr)&&(vr=0);const Ur=ps.sub(Nr)._unit();Nr=Nr.add(Ur.mult(xr))._round(),ps=ps.add(Ur.mult(-vr))._round(),xr=vr,bs=Gr,Ne&&this.zoom>=17&&(Qt(Er,Nr)||Er.push(Nr),Qt(Er,ps)||Er.push(ps))}const pt=yr.vertexLength,_t=rr.length>4&&d_e(Nr,ps,Qs);let nr=u_e(kn,Jt,es);if(xM(this.layoutVertexArray,Nr.x,Nr.y,ra,hn,0,0,nr),xM(this.layoutVertexArray,Nr.x,Nr.y,ra,hn,0,1,nr),this.wallMode){const vr=Qe(hs-1,rr),Ur=qe.joinNormals[hs-1];yM(this.wallVertexArray,Ur,vr),yM(this.wallVertexArray,Ur,vr)}if(kn+=Za,nr=u_e(kn,_t,!es),Jt=_t,xM(this.layoutVertexArray,ps.x,ps.y,ra,hn,0,0,nr),xM(this.layoutVertexArray,ps.x,ps.y,ra,hn,0,1,nr),this.wallMode){const vr=Qe(hs,rr),Ur=qe.joinNormals[hs];yM(this.wallVertexArray,Ur,vr),yM(this.wallVertexArray,Ur,vr)}if(yr.vertexLength+=4,this.indexArray.emplaceBack(pt+0,pt+1,pt+2),this.indexArray.emplaceBack(pt+1,pt+3,pt+2),yr.primitiveLength+=2,At){const vr=dr+(hs===1?rr.length-2:hs-2),Ur=hs===1?dr:vr+1;if(this.indexArray.emplaceBack(pt+1,vr,pt+3),this.indexArray.emplaceBack(vr,Ur,pt+3),yr.primitiveLength+=2,jr===void 0&&(jr=pt),!zoe(Qs,rr[hs],sr)){const qr=hs===rr.length-1?jr:yr.vertexLength;this.indexArray.emplaceBack(pt+2,pt+3,qr),this.indexArray.emplaceBack(pt+3,qr+1,qr),this.indexArray.emplaceBack(pt+3,Ur,qr+1),yr.primitiveLength+=3}es=!es}if(re){const vr=this.layoutVertexExtArray,Ur=ee.projectTilePoint(Nr.x,Nr.y,S),qr=ee.projectTilePoint(ps.x,ps.y,S),ws=ee.upVector(S,Nr.x,Nr.y),Cs=ee.upVector(S,ps.x,ps.y);vM(vr,Ur,ws),vM(vr,Ur,ws),vM(vr,qr,Cs),vM(vr,qr,Cs)}}ae&&(dr+=rr.length-1),Ne&&At&&this.zoom>=17&&(Er.length!==0&&Qt(Er,Er[0])&&Er.pop(),this.groundEffect.addData(Er,sr,K,At>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?e_e:this.encodeCentroid(ge,Se),this.centroidData.push(Se),ge.borders){this.featuresOnBorder.push(ge);const Ft=this.featuresOnBorder.length-1;for(let sr=0;srthis.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 ae=z;ae[ge[0]*(1-Ne[0])+Se[0]*Ne[0],ge[1]*(1-Ne[1])+Se[1]*Ne[1]],re=[],ae=[];for(const ge of this.triangleSubSegments){re[0]=ge.min.x/Ar,re[1]=ge.min.y/Ar,ae[0]=ge.max.x/Ar,ae[1]=ge.max.y/Ar;const Se=ee(K,Z,re),Ne=ee(K,Z,ae);if(new ys([Se[0],Se[1],S],[Ne[0],Ne[1],C]).intersectsPrecise(g)===0){$&&(_.segments.push($),$=void 0);continue}const Be=ge.segment;$&&$.vertexOffset!==Be.vertexOffset&&(_.segments.push($),$=void 0),$?($.vertexLength+=Be.vertexLength,$.primitiveLength+=Be.primitiveLength):$={vertexOffset:Be.vertexOffset,primitiveLength:Be.primitiveLength,vertexLength:Be.vertexLength,primitiveOffset:Be.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&Ex?e_e: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|=Ex);else for(const z of this.centroidData)if(!(z.flags&Ex||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&Ex)}: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&Ex));if(g!==Number.NEGATIVE_INFINITY)return{height:g,hidden:_};this.partLookup[S]=void 0}}function o_e(p,c){const h=p.add(c)._unit();return p.x*h.x+p.y*h.y}function $He(p,c,h,g){const _=c.sub(p)._perp()._unit(),S=h.sub(c)._perp()._unit();return l_e(p,c,h,o_e(_,S),g)}function l_e(p,c,h,g,_){const S=Math.sqrt(1-g*g);return Math.min(p.dist(c)/3,c.dist(h)/3,_*S/g)}function zoe(p,c,h){return p.xh[1].x&&c.x>h[1].x||p.yh[1].y&&c.y>h[1].y}function c_e(p,c){return p.xc[1].x||p.yc[1].y}function d_e(p,c,h){if(p.x<0||p.x>=Ar||c.x<0||c.x>=Ar||h.x<0||h.x>=Ar)return!1;const g=h.sub(c),_=g.perp(),S=p.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 u_e(p,c,h){const g=c?2|p:-3&p;return h?1|g:-2&g}function h_e(){const p=Math.PI/32,c=Math.tan(p),h=w;return h*Math.sqrt(1+2*c*c)-h}function m_e(p,c,h){const g=1<{for(const At of mt)ae.push({polygon:At,bounds:jt})},Se=Math.ceil(Math.log2(K)),Ne=Math.ceil(Math.log2(Z)),Be=Se-Ne,qe=[];for(let mt=0;mt0?0:1);for(let mt=0;mtjt+1?vt.push({polygons:ur,bounds:_r,depth:jt+1}):ge(ur,_r)}if(yr.length){const _r=[new or(At===0?dr:Pt.x,At===1?dr:Pt.y),Qt];qe.length>jt+1?vt.push({polygons:yr,bounds:_r,depth:jt+1}):ge(yr,_r)}}return ae}(p,c,Math.ceil((S-_)/11.25),Math.ceil((C-L)/11.25),1,(z,$,K)=>{if(z===0)return .5*($+K);{const Z=me((h.y+$/Ar)/g);return(W(.5*(me((h.y+K/Ar)/g)+Z))*g-h.y)*Ar}})}function UHe(p,c,h,g,_,S){const C=Math.pow(2,g.z-_.z);for(let L=0;L=z[C]&&(L=c,z=p),L[C]<_&&z[C]>_&&x_e(L,z,C,_),L[C]S&&x_e(z,L,C,S)}}function G6(p,c,h,g,_,S){const C=[];for(let L=0;L=g&&ae.x>=g||(re.x>=g?re=new or(g,re.y+(g-re.x)/(ae.x-re.x)*(ae.y-re.y))._round():ae.x>=g&&(ae=new or(g,re.y+(g-re.x)/(ae.x-re.x)*(ae.y-re.y))._round()),re.y>=_&&ae.y>=_||(re.y>=_?re=new or(re.x+(_-re.y)/(ae.y-re.y)*(ae.x-re.x),_)._round():ae.y>=_&&(ae=new or(re.x+(_-re.y)/(ae.y-re.y)*(ae.x-re.x),_)._round()),$&&re.equals($[$.length-1])||($=[re],C.push($),S&&S.push({progress:{min:Se+v_e(Ne,Be,re)*ge,max:1},parentIndex:L,prevPoint:Ne,nextPoint:Be})),$.push(ae),S&&(S[S.length-1].progress.max=Se+v_e(Ne,Be,ae)*ge,S[S.length-1].nextPoint=Be)))))}if(S&&Z>0)for(let ee=K;ee$.t-K.t);let C=0,L=0,z=[];for(g.push(z);C!==p.length;){if(L===S.length){for(;C!==p.length;)z.length!==0&&z[z.length-1].equals(p[C])||z.push(p[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(p[C])||z.push(p[C]),C++)}}function v_e(p,c,h){return p.x!==c.x?(h.x-p.x)/(c.x-p.x):p.y!==c.y?(h.y-p.y)/(c.y-p.y):0}function _M(p,c){return p.x*c.x+p.y*c.y}function __e(p,c){if(p.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},sr=h_e();re>0&&(re+=sr),ae+=sr;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,vt),Jt=Z.projection.upVector(vt,_r.x,_r.y);let xr=re,Er=ae;if(Ne){const jr=j_e(mr,gr,re,ae,Ne,Be,qe,Qe);xr+=jr.base,Er+=jr.top}re!==0?Ft(Pt,rr.x+Jt[0]*At*xr,rr.y+Jt[1]*At*xr,rr.z+Jt[2]*At*xr):Ft(Pt,rr.x,rr.y,rr.z),Ft(Qt,rr.x+Jt[0]*At*Er,rr.y+Jt[1]*At*Er,rr.z+Jt[2]*At*Er),et(Pt,Pt,Se),et(Qt,Qt,Se),ur.push(new __(Pt[0],Pt[1],Pt[2])),yr.push(new __(Qt[0],Qt[1],Qt[2]))}mt.push(ur),jt.push(yr)}return[mt,jt]}(p,c,h,g,_,S,C,L,z,$,K):C?function(Z,ee,re,ae,ge,Se,Ne,Be,qe){const Qe=[],vt=[],mt=[0,0,0,1];for(const jt of Z){const At=[],Pt=[];for(const Qt of jt){const Ft=Qt.x+ae.x,sr=Qt.y+ae.y,dr=j_e(Ft,sr,ee,re,Se,Ne,Be,qe);mt[0]=Ft,mt[1]=sr,mt[2]=dr.base,mt[3]=1,Ke(mt,mt,ge),mt[3]=Math.max(mt[3],1e-5);const ur=new __(mt[0]/mt[3],mt[1]/mt[3],mt[2]/mt[3]);mt[0]=Ft,mt[1]=sr,mt[2]=dr.top,mt[3]=1,Ke(mt,mt,ge),mt[3]=Math.max(mt[3],1e-5);const yr=new __(mt[0]/mt[3],mt[1]/mt[3],mt[2]/mt[3]);At.push(ur),Pt.push(yr)}Qe.push(At),vt.push(Pt)}return[Qe,vt]}(c,h,g,_,S,C,L,z,$):function(Z,ee,re,ae,ge){const Se=[],Ne=[],Be=ge[8]*ee,qe=ge[9]*ee,Qe=ge[10]*ee,vt=ge[11]*ee,mt=ge[8]*re,jt=ge[9]*re,At=ge[10]*re,Pt=ge[11]*re;for(const Qt of Z){const Ft=[],sr=[];for(const dr of Qt){const ur=dr.x+ae.x,yr=dr.y+ae.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+Be,xr=mr+qe,Er=gr+Qe,jr=Math.max(rr+vt,1e-5),bs=_r+mt,Gr=mr+jt,es=gr+At,hs=Math.max(rr+Pt,1e-5);Ft.push(new __(Jt/jr,xr/jr,Er/jr)),sr.push(new __(bs/hs,Gr/hs,es/hs))}Se.push(Ft),Ne.push(sr)}return[Se,Ne]}(c,h,g,_,S)}function j_e(p,c,h,g,_,S,C,L){const z=C*_.getElevationAt(p,c,!0,!0),$=S[0]!==0,K=$?S[1]===0?C*(S[0]/t_e-r_e):C*function(Z,ee,re){const ae=Math.floor(ee[0]/8),ge=Math.floor(ee[1]/8),Se=10*(ee[0]-8*ae),Ne=10*(ee[1]-8*ge),Be=Z.getElevationAt(ae,ge,!0,!0),qe=Z.getMeterToDEM(re),Qe=Math.floor(.5*(Se*qe-1)),vt=Math.floor(.5*(Ne*qe-1)),mt=Z.tileCoordToPixel(ae,ge),jt=2*Qe+1,At=2*vt+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-Qe,mt.y-vt,jt,At),Qt=Math.abs(Pt[0]-Pt[1]),Ft=Math.abs(Pt[2]-Pt[3]),sr=Math.abs(Pt[0]-Pt[2])+Math.abs(Pt[1]-Pt[3]),dr=Math.min(.25,.5*qe*(Qt+Ft)/jt),ur=Math.min(.25,.5*qe*sr/At);return Be+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 VHe{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 HHe{constructor(){this.tasks={},this.taskQueue=[],Lt(["process"],this),this.invoker=new VHe(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||Gn(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(ig(h.error)):g(null,ig(h.data)))}else{const g=new Set,_=h.hasCallback?(C,L)=>{this.target.postMessage({id:c,type:"",sourceMapId:this.mapId,error:C?Op(C):null,data:Op(L,g)},g)}:()=>{},S=ig(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 bM={workerUrl:"",workerClass:null,workerParams:void 0};const Boe="mapboxgl_preloaded_worker_pool";class b_{constructor(c){this.active={},this.name=c}acquire(c,h=b_.workerCount){if(!this.workers)for(this.workers=[];this.workers.length{h.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Boe]}numActive(){return Object.keys(this.active).length}}b_.workerCount=2;class r4{constructor(c,h,g="Worker",_=b_.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){St(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 wM,$oe;function K6(){return wM||(wM=new b_),wM}r4.Actor=k_e;const Uoe=4096;class WHe{constructor(c){this.module=c,this.memoryStack=this.module.malloc(Uoe),this.memoryStackNextFree=this.memoryStack}createIntArray(c){const h=this.memoryStackNextFree;return this.memoryStackNextFree+=c.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Uoe?-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>Uoe?-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 I_e(p,c){const h=p.json.bufferViews[c];return new Uint8Array(p.buffers[h.buffer],h.byteOffset||0,h.byteLength)}function QHe(p,c,h,g){if(p.uri){const _=E_e(p.uri,g);return fetch(_).then(S=>S.blob()).then(S=>createImageBitmap(S)).then(S=>{c.images[h]=S})}if(p.bufferView!==void 0){const _=I_e(c,p.bufferView),S=new Blob([_],{type:p.mimeType});return createImageBitmap(S).then(C=>{c.images[h]=C})}}function P_e(p,c=0,h){const g={json:null,images:[],buffers:[]};if(new Uint32Array(p,c,1)[0]===T_e){const K=new Uint32Array(p,c);let Z=2;const ee=(K[Z++]>>2)-3,re=K[Z++]>>2;if(Z++,g.json=JSON.parse(A_e.decode(K.subarray(Z,Z+re))),Z+=re,Z{const K=[],Z=L&&L.includes(Hoe),ee=L&&L.includes(X6);if(Z&&K.push(function(){if(!Gp)return jM??(jM=function(re){let ae,ge=null;function Se(){ae=new Uint8Array(ge.buffer)}function Ne(){throw new Error("Unexpected Draco error.")}const Be={a:{a:Ne,d:function(qe,Qe,vt){return ae.copyWithin(qe,Qe,Qe+vt)},c:function(qe){const Qe=ae.length,vt=Math.max(qe>>>0,Math.ceil(1.2*Qe)),mt=Math.ceil((vt-Qe)/65536);try{return ge.grow(mt),Se(),!0}catch{return!1}},b:Ne}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(re,Be):re.then(qe=>qe.arrayBuffer()).then(qe=>WebAssembly.instantiate(qe,Be))).then(qe=>{const{Rb:Qe,Qb:vt,P:mt,T:jt,X:At,Ja:Pt,La:Qt,Qa:Ft,Va:sr,Wa:dr,eb:ur,jb:yr,f:_r,e:mr,yb:gr,zb:rr,Ab:Jt,Bb:xr,Db:Er,Gb:jr}=qe.instance.exports;ge=mr;const bs=(()=>{let Gr=0,es=0,hs=0,kn=0;return Nr=>{hs&&(Qe(kn),Qe(Gr),es+=hs,hs=Gr=0),Gr||(es+=128,Gr=vt(es));const ps=Nr.length+7&-8;let Qs=Gr;ps>=es&&(hs=ps,Qs=kn=vt(ps));for(let Zn=0;Zn{Gp=re,jM=void 0}))}()),ee&&K.push(function(){if(Voe)return;const re=function(ae){let ge;const Se=WebAssembly.instantiateStreaming(ae,{}).then(qe=>{ge=qe.instance,ge.exports.__wasm_call_ctors()}),Ne={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},Be={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:Se,supported:!0,decodeGltfBuffer(qe,Qe,vt,mt,jt,At){(function(Pt,Qt,Ft,sr,dr,ur,yr){const _r=Pt.exports.sbrk,mr=sr+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,sr,dr,rr,ur.length);if(xr===0&&yr&&yr(gr,mr,dr),Ft.set(Jt.subarray(gr,gr+sr*dr)),_r(gr-_r(0)),xr!==0)throw new Error(`Malformed buffer data: ${xr}`)})(ge,ge.exports[Be[jt]],qe,Qe,vt,mt,ge.exports[Ne[At]])}}}(fetch(C_e()));return re.ready.then(()=>{Voe=re})}()),S)for(let re=0;re{if(Z&&C)for(const{primitives:re}of C)for(const ae of re)ZHe(ae,g);if(ee&&C&&z)for(const re of z)YHe(re,g);return g})})}function L_e(p){return fetch(p).then(c=>c.arrayBuffer()).then(c=>P_e(c,0,p))}function Woe(p){switch(p){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 Goe(p){switch(p){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 Koe{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,Woe(this.format),Goe(this.format),c):"data"in c&&c.data&&C.texSubImage2D(C.TEXTURE_2D,0,L,z,g,_,Woe(this.format),Goe(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 NM{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 JHe=Un([{name:"a_pos_3f",components:3,type:"Float32"}]),eWe=Un([{name:"a_color_3f",components:3,type:"Float32"}]),tWe=Un([{name:"a_color_4f",components:4,type:"Float32"}]),rWe=Un([{name:"a_uv_2f",components:2,type:"Float32"}]),sWe=Un([{name:"a_normal_3f",components:3,type:"Float32"}]),nWe=Un([{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"}]),aWe=Un([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function O_e(p,c){const h=Q6(p.projection,p.zoom,p.width,p.height),g=function(S,C,L,z,$){const K=new f(L.lng-180*A0,L.lat),Z=new f(L.lng+180*A0,L.lat),ee=S.project(K.lng,K.lat),re=S.project(Z.lng,Z.lat),ae=-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),Be=We.fromLngLat(Se);Be.x+=A0;const qe=Be.toLngLat(),Qe=S.project(qe.lng,qe.lat),vt=R_e(Qe.x-Ne.x,Qe.y-Ne.y,ae),mt=We.fromLngLat(Se);mt.y+=A0;const jt=mt.toLngLat(),At=S.project(jt.lng,jt.lat),Pt=R_e(At.x-Ne.x,At.y-Ne.y,ae),Qt=Math.abs(vt.x)/Math.abs(Pt.y),Ft=M([]);q(Ft,Ft,-ae*(1-($?0:z)));const sr=M([]);return R(sr,sr,[1,1-(1-Qt)*z,1]),sr[4]=-Pt.x/Pt.y*z,q(sr,sr,ae),T(sr,Ft,sr),sr}(p.projection,0,p.center,h,c),_=D_e(p);return R(g,g,[_,_,1]),g}function D_e(p){const c=p.projection,h=Q6(p.projection,p.zoom,p.width,p.height),g=Zoe(c,p.center),_=Zoe(c,f.convert(c.center));return Math.pow(2,g*h+(1-h)*_)}function Q6(p,c,h,g,_=1/0){const S=p.range;if(!S)return 0;const C=Math.min(_,Math.max(h,g)),L=Math.log2(C/1024);return Oe(S[0]+L,S[1]+L,c)}const A0=1/4e4;function Zoe(p,c){const h=ye(c.lat,-pe,pe),g=new f(c.lng-180*A0,h),_=new f(c.lng+180*A0,h),S=p.project(g.lng,h),C=p.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 R_e(p,c,h){const g=Math.cos(h),_=Math.sin(h);return{x:p*g-c*_,y:p*_+c*g}}function F_e(p,c,h){M(p),q(p,p,Ws(c[2])),D(p,p,Ws(c[0])),U(p,p,Ws(c[1])),R(p,p,h),T(p,p,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function J6(p,c,h,g,_,S,C,L){const z=[h[0]-c[0],h[1]-c[1],0],$=[g[0]-c[0],g[1]-c[1],0];if(fe(z)<1e-12||fe($)<1e-12)return dt(p);const K=xt([],z,$);$e(K,K),xe($,g,c),z[2]=(S-_)*L,$[2]=(C-_)*L;const Z=z;return xt(Z,z,$),$e(Z,Z),ns(p,K,Z)}function eL(p,c,h=!1){const g=M0(c.zoom),_=function(S,C,L){const z=C.worldSize,$=[S[12],S[13],S[14]],K=me($[1]/z),Z=te($[0]/z),ee=M([]),re=J(1,K)*z,ae=J(1,0)*z*_e(K,C.zoom),ge=1/koe(z);let Se=ae*ge;if(L){const Qe=Q6(C.projection,C.zoom,C.width,C.height,1024);Se=ge*C.projection.pixelSpaceConversion(C.center.lat,z,Qe)}const Ne=N0(K,Z);de(Ne,Ne,we([],$e([],Ne),re*Se*$[2]));const Be=function(Qe){const vt=[Qe[0],Qe[1],Qe[2]];let mt=[0,1,0];const jt=xt([],mt,vt);return xt(mt,vt,jt),Ue(mt)===0&&(mt=[0,1,0],xt(jt,vt,mt)),$e(jt,jt),$e(mt,mt),$e(vt,vt),[jt[0],jt[1],jt[2],0,mt[0],mt[1],mt[2],0,vt[0],vt[1],vt[2],0,Qe[0],Qe[1],Qe[2],1]}(Ne);R(ee,ee,[Se,Se,Se*re]),P(ee,ee,[-$[0],-$[1],-$[2]]);const qe=T([],C.globeMatrix,Be);return T(qe,qe,ee),T(qe,qe,S),qe}(p,c,h);if(g>0){const S=function(C,L){const z=L.worldSize,$=J(1,0)*z*_e(L.center.lat,L.zoom)/koe(z),K=J(1,L.center.lat)*z,Z=M([]);U(Z,Z,Ws(L.center.lng)),D(Z,Z,Ws(L.center.lat)),P(Z,Z,[0,0,Oc]),R(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)}(p,c);return function(C,L,z){const $=(ae,ge,Se)=>{const Ne=fe(ae),Be=fe(ge),qe=Wp(ae,ge,Se);return we(qe,qe,1/fe(qe)*Us(Ne,Be,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=Wp([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 Yoe(p,c,h,g){const _=ys.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&&ae[0]*ge[0]+ae[1]*ge[1]>=0&&ae[0]*ae[0]+ae[1]*ae[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(fa(p,C))return S}const w_=64,i4={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function tL(p,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(p),P(p,p,[Z.x+C[0]*re,Z.y+C[1]*re,C[2]]);let ae=1,ge=1;const Se=h.worldSize;if($){if(h.projection.name==="mercator"){let Qe=0;h.elevation&&(Qe=h.elevation.getAtPointOrZero(new We(Z.x/Se,Z.y/Se),0));const vt=Ke([],[Z.x,Z.y,Qe,1],h.projMatrix)[3]/h.cameraToCenterDistance;ae=vt,ge=vt*_e(h.center.lat,K)}else if(h.projection.name==="globe"){const Qe=eL(p,h),vt=[0,0,0,1];Ke(vt,vt,T([],h.projMatrix,Qe));const mt=vt[3]/h.cameraToCenterDistance,jt=M0(K),At=h.projection.pixelsPerMeter(g.lat,Se)*_e(g.lat,K),Pt=h.projection.pixelsPerMeter(h.center.lat,Se)*_e(h.center.lat,K);ae=mt/Us(At,ke(h.center.lat),jt),ge=mt*ee/At,ae*=Pt,ge*=Pt}}else ae=re;R(p,p,[ae,ae,ge]);const Ne=[...p],Be=c.orientation,qe=[];if(F_e(qe,[Be[0]+(_?_[0]:0),Be[1]+(_?_[1]:0),Be[2]+(_?_[2]:0)],S),T(p,Ne,qe),L&&h.elevation){let Qe=0;const vt=[];if(z&&h.elevation){Qe=function(jt,At,Pt,Qt,Ft){const sr=At.elevation;if(!sr)return 0;const dr=ys.projectAabbCorners(Pt,Qt),ur=J(1,Ft.lat)*At.worldSize,yr=function(es,hs){const kn=[0,0,1],Nr=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const ps of Nr){const Qs=es[ps.corners[0]],Zn=es[ps.corners[1]],ra=es[ps.corners[2]],hn=[Zn[0]-Qs[0],Zn[1]-Qs[1],hs*(Zn[2]-Qs[2])],Za=xt(hn,hn,[ra[0]-Qs[0],ra[1]-Qs[1],hs*(ra[2]-Qs[2])]);$e(Za,Za),ps.dotProductWithUp=it(Za,kn)}return Nr.sort((ps,Qs)=>ps.dotProductWithUp-Qs.dotProductWithUp),Nr[0].corners}(dr,ur),_r=dr[yr[0]],mr=dr[yr[1]],gr=dr[yr[2]],rr=dr[yr[3]],Jt=sr.getAtPointOrZero(new We(_r[0]/At.worldSize,_r[1]/At.worldSize),0),xr=sr.getAtPointOrZero(new We(mr[0]/At.worldSize,mr[1]/At.worldSize),0),Er=sr.getAtPointOrZero(new We(gr[0]/At.worldSize,gr[1]/At.worldSize),0),jr=sr.getAtPointOrZero(new We(rr[0]/At.worldSize,rr[1]/At.worldSize),0),bs=(Jt+jr)/2,Gr=(xr+Er)/2;return bs>Gr?xr=c.gl.NEAREST_MIPMAP_NEAREST}),p.uploaded=!0,p.image=null)}function iWe(p,c,h){p.indexBuffer=c.createIndexBuffer(p.indexArray,!1,!0),p.vertexBuffer=c.createVertexBuffer(p.vertexArray,JHe.members,!1,!0),p.normalArray&&(p.normalBuffer=c.createVertexBuffer(p.normalArray,sWe.members,!1,!0)),p.texcoordArray&&(p.texcoordBuffer=c.createVertexBuffer(p.texcoordArray,rWe.members,!1,!0)),p.colorArray&&(p.colorBuffer=c.createVertexBuffer(p.colorArray,(p.colorArray.bytesPerElement===12?eWe:tWe).members,!1,!0)),p.featureArray&&(p.pbrBuffer=c.createVertexBuffer(p.featureArray,aWe.members,!0)),p.segments=Vi.simpleSegment(0,0,p.vertexArray.length,p.indexArray.length);const g=p.material;g.pbrMetallicRoughness.baseColorTexture&&SM(g.pbrMetallicRoughness.baseColorTexture,c),g.pbrMetallicRoughness.metallicRoughnessTexture&&SM(g.pbrMetallicRoughness.metallicRoughnessTexture,c),g.normalTexture&&SM(g.normalTexture,c),g.occlusionTexture&&SM(g.occlusionTexture,c,h),g.emissionTexture&&SM(g.emissionTexture,c)}function Xoe(p,c,h){if(p.meshes)for(const g of p.meshes)iWe(g,c,h);if(p.children)for(const g of p.children)Xoe(g,c,h)}function rL(p){if(p.meshes)for(const c of p.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(p.children)for(const c of p.children)rL(c)}function Qoe(p){if(p.meshes)for(const h of p.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(p.children)for(const h of p.children)Qoe(h)}function j_(p,c){const h=p.json.bufferViews[c.bufferView],g=Y6[c.componentType];return new g(p.buffers[h.buffer],(c.byteOffset||0)+(h.byteOffset||0),c.count*(h.byteStride&&h.byteStride!==kM[c.type]*g.BYTES_PER_ELEMENT?h.byteStride/g.BYTES_PER_ELEMENT:kM[c.type]))}function Joe(p,c,h,g){const _=Y6[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=p.json.bufferViews[c.bufferView],L=C.byteStride?C.byteStride/_.BYTES_PER_ELEMENT:kM[c.type],z=h.float32,$=z.length/h.capacity;for(let K=0,Z=0;K0){for(let Se=0;Se0){S.texcoordArray=new Um;const ee=c.json.accessors[_.TEXCOORD_0];S.texcoordArray.resize(ee.count);const re=j_(c,ee);Joe(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=j_(c,ee))}_._FEATURE_RGBA4444!==void 0&&(S.featureData=new Uint32Array(j_(c,c.json.accessors[_._FEATURE_RGBA4444]).buffer));const Z=p.material;return S.material=function(ee,re){const{emissiveFactor:ae=[0,0,0],alphaMode:ge="OPAQUE",alphaCutoff:Se=.5,normalTexture:Ne,occlusionTexture:Be,emissiveTexture:qe,doubleSided:Qe,name:vt}=ee,{baseColorFactor:mt=[1,1,1,1],metallicFactor:jt=1,roughnessFactor:At=1,baseColorTexture:Pt,metallicRoughnessTexture:Qt}=ee.pbrMetallicRoughness||{},Ft=Be?re[Be.index]:void 0;if(Be&&Be.extensions&&Be.extensions.KHR_texture_transform&&Ft){const sr=Be.extensions.KHR_texture_transform;Ft.offsetScale=[sr.offset[0],sr.offset[1],sr.scale[0],sr.scale[1]]}return{name:vt,pbrMetallicRoughness:{baseColorFactor:new Na(...mt),metallicFactor:jt,roughnessFactor:At,baseColorTexture:Pt?re[Pt.index]:void 0,metallicRoughnessTexture:Qt?re[Qt.index]:void 0},doubleSided:Qe,emissiveFactor:new Na(...ae),alphaMode:ge,alphaCutoff:Se,normalTexture:Ne?re[Ne.index]:void 0,occlusionTexture:Ft,emissionTexture:qe?re[qe.index]:void 0,defined:ee.defined===void 0}}(Z!==void 0?c.json.materials[Z]:{defined:!1},h),S}function B_e(p,c,h){const{matrix:g,rotation:_,translation:S,scale:C,mesh:L,extras:z,children:$,name:K}=p,Z={};if(Z.name=K,Z.localMatrix=g||function(ee,re,ae,ge){var Se=re[0],Ne=re[1],Be=re[2],qe=re[3],Qe=Se+Se,vt=Ne+Ne,mt=Be+Be,jt=Se*Qe,At=Se*vt,Pt=Se*mt,Qt=Ne*vt,Ft=Ne*mt,sr=Be*mt,dr=qe*Qe,ur=qe*vt,yr=qe*mt,_r=ge[0],mr=ge[1],gr=ge[2];return ee[0]=(1-(Qt+sr))*_r,ee[1]=(At+yr)*_r,ee[2]=(Pt-ur)*_r,ee[3]=0,ee[4]=(At-yr)*mr,ee[5]=(1-(jt+sr))*mr,ee[6]=(Ft+dr)*mr,ee[7]=0,ee[8]=(Pt+ur)*gr,ee[9]=(Ft-dr)*gr,ee[10]=(1-(jt+Qt))*gr,ee[11]=0,ee[12]=ae[0],ee[13]=ae[1],ee[14]=ae[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:ae,max:ge}=re.aabb;ee[0]+=ae[0]+ge[0],ee[1]+=ae[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(Be){const qe=atob(Be),Qe=new Uint8Array(qe.length);for(let vt=0;vt1&&g[g.length-1].equals(g[0])&&g.pop();let _=0;for(let C=0;C0&&g.reverse();const S=e4(g.flatMap(C=>[C.x,C.y]),[]);return S.length===0?null:{vertices:g,indices:S}}function dWe(p,c){const h=[],g=[];let _=0;const S=[];for(const C of p){_=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 ele(p){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}(p,p.images),h=function(z,$){const K=[];for(const Z of z.json.meshes){const ee=[];for(const re of Z.primitives)ee.push(oWe(re,z,$));K.push(ee)}return K}(p,c),{scenes:g,scene:_,nodes:S}=p.json,C=g?g[_||0].nodes:[...S.keys()],L=[];for(const z of C)L.push(B_e(S[z],p,h));return function(z,$,K){const Z={},ee=new Set;for(let re=0;re0){const re=Array.from(ee.values()).sort((ae,ge)=>ae-ge);for(let ae=re.length-1;ae>=0;ae--)z.splice(re[ae],1)}}(L,C,p.json.nodes),L}function uWe(p){p.heightmap=new Float32Array(4096),p.heightmap.fill(-1);const c=p.vertexArray.float32,h=p.aabb.min[0]-1,g=p.aabb.min[1]-1,_=w_/(p.aabb.max[0]-h+2),S=w_/(p.aabb.max[1]-g+2);for(let C=0;Cp.heightmap[$*w_+z]&&(p.heightmap[$*w_+z]=L)}}function $_e(p,c,h,g,_){h.reserve(h.length+4*p.length),g.reserve(g.length+10*p.length),_.reserve(_.length+10*p.length);let S=g.length;for(const C of p){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=tt([],C.pos,z,K/2),ee=tt([],C.pos,z,-K/2),re=[Z[0],Z[1],Z[2]+C.height],ae=[ee[0],ee[1],ee[2]+C.height],ge=tt([],C.normal,z,$);we(ge,ge,L);const Se=tt([],C.normal,z,-$);we(Se,Se,L),de(ge,Z,ge),de(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(ae[0],ae[1],ae[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 hWe(p,c){const h={};h.indexArray=new Jo,h.vertexArray=new Ru,h.colorArray=new lg,$_e(p,c,h.indexArray,h.vertexArray,h.colorArray);const g={defined:!0};g.emissiveFactor=Na.black;const _={};return _.baseColorFactor=Na.white,g.pbrMetallicRoughness=_,h.material=g,h.aabb=new ys([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),h}const U_e=Un([{name:"a_pos_3f",components:3,type:"Float32"}]),mWe=Un([{name:"a_normal_3",components:3,type:"Int16"}]),pWe=Un([{name:"a_centroid_3",components:3,type:"Int16"}]),q_e=Un([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),fWe=Un([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),gWe=Un([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),xWe=Un([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),yWe=Un([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),vWe=Un([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),V_e=Dt.types,sL=32767;function _We(p,c){const h=Ar+c;for(const g of p)for(const _ of g)if(_.x<-c||_.x>h||_.y<-c||_.y>h)return!1;return!0}function bWe(p){switch(p){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: ${p}`)}}class tle{constructor(){this.layoutVertexArray=new Ru,this.layoutAttenuationArray=new lg,this.layoutColorArray=new Fu,this.indexArray=new Jo,this.indexArrayForConflation=new Jo,this.segmentsBucket=new Vi}}class rle{constructor(c){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new Vi,this.entranceBloom=new tle;const h=66560;this.layoutVertexArray=new Ru,this.layoutVertexArray.reserve(h),this.layoutNormalArray=new v0,this.layoutNormalArray.reserve(h),this.layoutCentroidArray=new v0,this.layoutCentroidArray.reserve(h),this.layoutColorArray=new Fu,this.layoutColorArray.reserve(h),this.layoutFloodLightDataArray=new cg,this.layoutFloodLightDataArray.reserve(h),this.layoutAOArray=new UN,this.layoutAOArray.reserve(h),this.indexArray=new Jo,this.indexArray.reserve(66560),this.indexArrayForConflation=new Jo,this.segmentsBucket=new Vi,this.entranceBloom=new tle,c&&(this.layoutFacadePaintArray=new Fu,this.layoutFacadeDataArray=new Cx,this.layoutFacadeVerticalRangeArray=new Fu)}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 H_e{constructor(c){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new Um,this.footprintsIndices=new cg,this.footprintsMin=new or(1/0,1/0),this.footprintsMax=new or(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new rle(!1),this.buildingWithFacade=new rle(!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 Qh(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 Foe(c),this.groundEffect.groundRadiusArray=new zp,this.hasAppearances=null}updateFootprints(c,h){const g=new U6([],[],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(Z6!=null||N_e!=null)return null;if(a4!=null)return a4;const c=fetch(Dn.BUILDING_GEN_URL);return a4=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,ae=Math.max(ee>>>0,Math.ceil(1.2*re)),ge=Math.ceil((ae-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 WHe({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=>(a4=null,Z6=h,Z6)).catch(h=>{Kr("Could not load building-gen"),a4=null,N_e=h}),a4}()}populate(c,h,g,_){const S=GHe();if(!S)return;const C=Re(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(V_e[Ne.type]!=="LineString"){L.set(Ne.id,Ne.properties.source_id);continue}const Be=this.layers[0]._featureFilter.needGeometry;if(Be&&!this.layers[0]._featureFilter.filter(new di(this.zoom),Ne,g))continue;const qe=Rt(Ne,Be);if(!Be&&!this.layers[0]._featureFilter.filter(new di(this.zoom),qe,g))continue;const Qe=Be?qe.geometry:Ct(Ne,g,_),vt=[];for(const Pt of Qe)for(const Qt of Pt)vt.push(Qt.x),vt.push(Qt.y);const mt={coordinates:vt,crossPerc:Ne.properties.cross_perc,distanceToRoad:Ne.properties.distance_to_road,entrances:Ne.properties.entrances,sourceId:0},jt=Ne.properties.source_id;let At=z.get(jt);At||(At=[],z.set(jt,At)),At.push(mt),++$}this.maxHeight=0;const K=new Array,Z=new Set,ee=Ne=>{Ne!=null&&Z.add(Ne)},re=(Ne,Be)=>{Ne!=null&&K.push({buildingId:Ne,footprintIndex:Be})},ae=64*(c.length-$),ge=ae/2;this.buildingWithFacade.reserve(ae,ge,!0),this.buildingWithoutFacade.reserve(2*ae,2*ge,!1),this.footprintsIndices.reserve(16*(c.length-$)),this.footprintsVertices.reserve(8*(c.length-$));for(const{feature:Ne,id:Be,index:qe,sourceLayerIndex:Qe}of c){if(V_e[Ne.type]==="LineString")continue;const vt=this.layers[0]._featureFilter.needGeometry;if(vt&&!this.layers[0]._featureFilter.filter(new di(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 jt=Rt(Ne,vt);if(!vt&&!this.layers[0]._featureFilter.filter(new di(this.zoom),jt,g))continue;const At=vt?jt.geometry:Ct(Ne,g,_),Pt=fM(At,500);let Qt=!1;for(const Os of Pt)if(Os.length!==1){Qt=!0;break}if(Qt){ee(mt);continue}if(!_We(At,163)){ee(mt);continue}const Ft=this.layers[0],sr=bWe(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 bs=Ft.paint.get("building-color").evaluate(Ne,{},this.canonical).toPremultipliedRenderColor(this.lut),Gr=Ft.paint.get("building-emissive-strength").evaluate(Ne,{},this.canonical);let es=Ft.layout.get("building-flood-light-wall-radius").evaluate(Ne,{},g);es=ye(es,0,2048);const hs=es/2048*sL,kn=L.get(Be),Nr=z.get(kn)||[],ps=Nr.length!==0&&Ft.layout.get("building-facade").evaluate(Ne,{},g);S.setFacadeOptions(4,!0),S.setFauxFacadeOptions(ps,!1,1);let Qs=0,Zn=0,ra=0,hn=0,Za=0,pt=0,_t=0,nr=0,vr=0,Ur=0,qr=0;if(ps){let Os=Math.round(Ft.layout.get("building-facade-floors").evaluate(Ne,{},g));if(dr===0){Os=Math.max(1,Os-(Nr.length>0?1:0));let Ba=4;if(ur>100){const Ai=[10,13,15];Ba=Ai[Ne.id?Ne.id%Ai.length:0]}else ur<=10&&(Ba=3);S.setFacadeOptions(Ba,!0),Za=(ur<15?1.3:1.61803)*Ba/C}else Za=dr/C;pt=ur/C,Za=Math.min(Za,pt),ra=Ft.layout.get("building-facade-unit-width").evaluate(Ne,{},g)/C,hn=(pt-Za)/Os,S.setFauxFacadeOptions(!0,!0,ra);const Gi=Ft.layout.get("building-facade-window").evaluate(Ne,{},g);Qs=Gi[0],Zn=Gi[1],_t=Math.floor(65535*Math.min(1,Za/Ar)),nr=Math.floor(65535*Math.min(1,pt/Ar)),vr=Math.floor(255*Qs)<<8|Math.floor(255*Zn),Ur=Math.floor(65535*Math.min(1,ra/Ar)),qr=Math.floor(65535*Math.min(1,hn/Ar))}const ws=Array(Pt.length),Cs={x:1/0,y:1/0},cn={x:-1/0,y:-1/0},yn={x:0,y:0};let wn=0;for(let Os=0;Os0){const Ba=[],Ai=Array(Gi.length+1);Ai[0]=0;for(let rl=0;rlAr||Cs.y<0||cn.y>Ar)&&this.featuresOnBorder.push({featureId:Ne.id,footprintIndex:this.footprints.length});{const Os=e4(Qa,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+Os.length),this.footprintsIndices.uint16.set(Os,Ls),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,ui.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,ui.y);const Gi={footprintVertexOffset:Vn,footprintVertexLength:this.footprintsVertices.length-Vn,footprintIndexOffset:Ls,footprintIndexLength:this.footprintsIndices.length-Ls,min:ai,max:ui,hiddenFlags:0,indicesOffset:Ia,indicesLength:Fi,bloomIndicesOffset:za,bloomIndicesLength:ri,groundEffectVertexOffset:jo,groundEffectVertexLength:oi,hasFauxFacade:ps,height:vn,promoteId:Be,feature:jt,parts:ya,buildingBloom:va},Ba=this.footprints.length;Ne.id!==void 0&&this.featureFootprintLookup.set(Ne.id,Ba),re(mt,Ba),this.footprints.push(Gi)}this.programConfigurations.populatePaintArrays(Ds.layoutVertexArray.length,Ne,qe,{},h.availableImages,g,h.brightness),this.groundEffect.addPaintPropertiesData(Ne,qe,{},h.availableImages,g,h.brightness),h.featureIndex.insert(Ne,At,qe,Qe,this.index,Ya)}K.forEach(({buildingId:Ne,footprintIndex:Be})=>{Z.has(Ne)&&(this.footprints[Be].hiddenFlags|=4)});const Se=new Set;this.buildingIds.forEach((Ne,Be,qe)=>{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,U_e.members),g.layoutNormalBuffer=c.createVertexBuffer(g.layoutNormalArray,mWe.members),g.layoutCentroidBuffer=c.createVertexBuffer(g.layoutCentroidArray,pWe.members),g.layoutFloodLightDataBuffer=c.createVertexBuffer(g.layoutFloodLightDataArray,vWe.members),g.layoutFacadeDataArray&&g.layoutFacadeDataArray.length&&(g.layoutFacadeDataBuffer=c.createVertexBuffer(g.layoutFacadeDataArray,gWe.members)),g.layoutFacadeVerticalRangeArray&&g.layoutFacadeVerticalRangeArray.length&&(g.layoutFacadeVerticalRangeBuffer=c.createVertexBuffer(g.layoutFacadeVerticalRangeArray,xWe.members)),g.entranceBloom.layoutVertexArray.length&&(g.entranceBloom.layoutVertexBuffer=c.createVertexBuffer(g.entranceBloom.layoutVertexArray,U_e.members),g.entranceBloom.layoutAttenuationBuffer=c.createVertexBuffer(g.entranceBloom.layoutAttenuationArray,yWe.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,q_e.members,!0),g.layoutFacadePaintArray&&(g.layoutFacadePaintBuffer?g.layoutFacadePaintBuffer.updateData(g.layoutFacadePaintArray):g.layoutFacadePaintBuffer=c.createVertexBuffer(g.layoutFacadePaintArray,fWe.members,!0)),g.entranceBloom.layoutColorBuffer?g.entranceBloom.layoutColorBuffer.updateData(g.entranceBloom.layoutColorArray):g.entranceBloom.layoutColorBuffer=c.createVertexBuffer(g.entranceBloom.layoutColorArray,q_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),ae=c.paint.get("building-emissive-strength").evaluate(C,S,this.canonical),ge=_.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const Ne of _.parts){let Be,qe=L;Ne.part===1?(qe=L,Be=z):Ne.part===0?(qe=$,Be=K):Ne.part===2?(qe=Z,Be=ee):Ne.part===3&&(qe=re,Be=ae),Be=ye(Be,0,1);for(let Qe=0;QeC.max.x||z.max.xC.max.y||z.max.yL.max.x||L.min.x>c||h>L.max.y||L.min.y>h||L.height<=g||wWe(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 wWe(p,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 ae=S/g*(_+1);if(z.isDash){const ge=_-Math.abs(ae);re=Math.sqrt(ee*ee+ge*ge)}else re=_-Math.sqrt(ee*ee+ae*ae);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 ON,this.layoutVertexArray2=new Ru,this.patternVertexArray=new Ru,this.indexArray=new Jo,this.programConfigurations=new Qh(c.layers,{zoom:c.zoom,lut:c.lut}),this.segments=new Vi,this.maxLineLength=0,this.zOffsetVertexArray=new Ru,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=Toe("line",this.layers,this.pixelRatio,h);const S=this.layers[0].layout.get("line-sort-key");this.tileToMeter=Re(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:ae,sourceLayerIndex:ge}of c){const Se=this.layers[0]._featureFilter.needGeometry,Ne=Rt(ee,Se);if(!this.layers[0]._featureFilter.filter(new di(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),Ne,g))continue;const Be=S?S.evaluate(Ne,{},g):void 0,qe={id:re,properties:ee.properties,type:ee.type,sourceLayerIndex:ge,index:ae,geometry:Se?Ne.geometry:Ct(ee,g,_),patterns:{},sortKey:Be};z.push(qe)}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:ae,sourceLayerIndex:ge}=ee;if(Z&&this.addFeatureDashes(ee,$),this.hasPattern){const Se=Aoe("line",this.layers,ee,this.zoom,this.pixelRatio,h);this.patternFeatures.push(Se)}else this.addFeature(ee,re,ae,g,$.positions,h.availableImages,h.brightness,h.elevationFeatures);K.insert(c[ae].feature,re,ae,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,MWe)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=c.createVertexBuffer(this.patternVertexArray,AWe)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=c.createVertexBuffer(this.zOffsetVertexArray,NWe.members,!0)),this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,SWe),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 ae=!(!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,Be]=this.clipRuntimeLinesToTile(h,1);for(let qe=0;qe0?vt.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 G6(c,-h,-h,Ar+h,Ar+h)}clipRuntimeLinesToTile(c,h){const g=[];return[G6(c,-h,-h,Ar+h,Ar+h,g),g]}addElevatedRoadFeature(c,h,g,_,S,C,L,z){const $=[],K=Aa.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 Ha(g,Z.elevationTileID);if(Z.elevation)for(let ae=ee;ae>1,this.layoutVertexArray.int16[6*ae+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/Re(g);for(const C of c)qHe(C,new xa(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:Ka(ur.min,yr,_r),max:Ka(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,sr=+h.properties.mapbox_clip_seg_len;if(Number.isNaN(Ft)||Number.isNaN(sr)){for(let ur=0;ur=2&&c[ae-1].equals(c[ae-2]);)ae--;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(Be)._mult(rr/Jt)._round());this.updateDistance(Be,Er),this.addCurrentVertex(Er,Qe,0,0,Se,At),Be=Er}this.updateDistance(Be,Ne),dr._mult(yr),this.addCurrentVertex(Ne,dr,0,0,Se,At);const xr=Ne.dist(qe);if(xr>2*rr){const Er=Ne.add(qe.sub(Ne)._mult(rr/xr)._round());this.updateDistance(Ne,Er),this.addCurrentVertex(Er,vt,0,0,Se,At),Ne=Er}}else dr._mult(yr),this.addCurrentVertex(Ne,dr,0,0,Se,At);else if(Ft==="flipbevel"){if(yr>100)dr=vt.mult(-1);else{const Jt=yr*Qe.add(vt).mag()/Qe.sub(vt).mag();dr._perp()._mult(Jt*(gr?-1:1))}this.addCurrentVertex(Ne,dr,0,0,Se,At),this.addCurrentVertex(Ne,dr.mult(-1),0,0,Se,At)}else if(Ft==="bevel"||Ft==="fakeround"){At!=null&&Be&&this.addCurrentVertex(Ne,jt||Qe,-1,-1,Se,At);const Jt=Ne.dist(Be)<=2*rr&&Ft!=="bevel",xr=dr.mult(gr?1:-1);xr._mult(yr);const Er=vt.mult(gr?-1:1),jr=Qe.mult(gr?-1:1),bs=this.evaluateLineProgressFeatures(this.distance);if(At==null&&(this.addHalfVertex(Ne,xr.x,xr.y,!1,!gr,0,Se,bs),Jt||this.addHalfVertex(Ne,xr.x+2*jr.x,xr.y+2*jr.y,!1,gr,0,Se,bs)),Ft==="fakeround"){const Gr=Math.round(180*_r/Math.PI/20);this.addHalfVertex(Ne,jr.x,jr.y,!1,gr,0,Se,bs);for(let es=0;es1){this.lineSoFar=c.w;const ge=(h.x-c.x)/Z,Se=(h.y-c.y)/Z,Ne=(h.z-c.z)/Z,Be=(h.w-c.w)/Z;for(let qe=1;qe=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 nle(p,c,h){return p.xh||p.yh}let Z_e,Y_e;function X_e(p,c,h){return c*(Ar/(p.tileSize*Math.pow(2,h-p.tileID.overscaledZ)))}as(sle,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const Q_e=(p,c,h)=>(1-h)*p+h*c;function J_e(p,c){return 1/X_e(p,1,c.tileZoom)}function ebe(p,c,h,g){return p.translatePosMatrix(g||c.tileID.projMatrix,c,h.paint.get("line-translate"),h.paint.get("line-translate-anchor"))}const tbe=p=>{const c=[];rbe(p)&&c.push("RENDER_LINE_DASH"),p.paint.get("line-gradient")&&c.push("RENDER_LINE_GRADIENT");const h=p.paint.get("line-trim-offset");h[0]===0&&h[1]===0||c.push("RENDER_LINE_TRIM_OFFSET"),p.paint.get("line-border-width").constantOr(1)!==0&&c.push("RENDER_LINE_BORDER");const g=p.layout.get("line-join").constantOr("miter")==="none",_=!!p.paint.get("line-pattern").constantOr(1);return g&&_&&c.push("LINE_JOIN_NONE"),c};function rbe(p){const c=p.paint.get("line-dasharray").value;return c.kind!=="constant"||c.value}let ale;const sbe=()=>ale||(ale={layout:Z_e||(Z_e=new ao({"line-cap":new Fr(Bt.layout_line["line-cap"]),"line-join":new Fr(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 Fr(Bt.layout_line["line-sort-key"]),"line-z-offset":new Fr(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:Y_e||(Y_e=new ao({"line-opacity":new Fr(Bt.paint_line["line-opacity"]),"line-color":new Fr(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 Fr(Bt.paint_line["line-width"]),"line-gap-width":new Fr(Bt.paint_line["line-gap-width"]),"line-offset":new Fr(Bt.paint_line["line-offset"]),"line-blur":new Fr(Bt.paint_line["line-blur"]),"line-dasharray":new Fr(Bt.paint_line["line-dasharray"]),"line-pattern":new Fr(Bt.paint_line["line-pattern"]),"line-pattern-cross-fade":new Sr(Bt.paint_line["line-pattern-cross-fade"]),"line-gradient":new kx(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 Fr(Bt.paint_line["line-emissive-strength"]),"line-border-width":new Fr(Bt.paint_line["line-border-width"]),"line-border-color":new Fr(Bt.paint_line["line-border-color"]),"line-occlusion-opacity":new Sr(Bt.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Fr({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Fr({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Fr({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Fr({type:"string",default:"default","property-type":"data-driven"})}))},ale);class LWe extends Fr{possiblyEvaluate(c,h){return h=new di(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 CM;function nbe(p,c){return c>0?c+2*p:p}const OWe=Un([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),DWe=Un([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),RWe=Un([{name:"a_projected_pos",components:4,type:"Float32"}],4);Un([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const FWe=Un([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),zWe=Un([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),BWe=Un([{name:"a_texb",components:2,type:"Uint16"}]),$We=Un([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),UWe=Un([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);Un([{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 abe=Un([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),qWe=Un([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Un([{name:"triangle",components:3,type:"Uint16"}]),Un([{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"}]),Un([{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"}]),Un([{type:"Float32",name:"offsetX"}]),Un([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var kl=24;function VWe(p,c,h){return p.sections.forEach(g=>{g.text=function(_,S,C){const L=S.layout.get("text-transform").evaluate(C,{});return L==="uppercase"?_=_.toLocaleUpperCase():L==="lowercase"&&(_=_.toLocaleLowerCase()),Fp.applyArabicShaping&&(_=Fp.applyArabicShaping(_)),_}(g.text,c,h)}),p}const MM={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function HWe(p){return p==="︶"||p==="﹈"||p==="︸"||p==="﹄"||p==="﹂"||p==="︾"||p==="︼"||p==="︺"||p==="︘"||p==="﹀"||p==="︐"||p==="︓"||p==="︔"||p==="`"||p===" ̄"||p==="︑"||p==="︒"}function WWe(p){return p==="︵"||p==="﹇"||p==="︷"||p==="﹃"||p==="﹁"||p==="︽"||p==="︻"||p==="︹"||p==="︗"||p==="︿"}const ile=4294967296,ibe=1/ile,obe=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let nL=class{constructor(p=new Uint8Array(16)){this.buf=ArrayBuffer.isView(p)?p:new Uint8Array(p),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(p,c,h=this.length){for(;this.pos>3,S=this.pos;this.type=7&g,p(_,c,this),this.pos===S&&this.skip(g)}return c}readMessage(p,c){return this.readFields(p,c,this.readVarint()+this.pos)}readFixed32(){const p=this.dataView.getUint32(this.pos,!0);return this.pos+=4,p}readSFixed32(){const p=this.dataView.getInt32(this.pos,!0);return this.pos+=4,p}readFixed64(){const p=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*ile;return this.pos+=8,p}readSFixed64(){const p=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*ile;return this.pos+=8,p}readFloat(){const p=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,p}readDouble(){const p=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,p}readVarint(p){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 o4(_,z,S);throw new Error("Expected varint not more than 10 bytes")}(h,p,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const p=this.readVarint();return p%2==1?(p+1)/-2:p/2}readBoolean(){return!!this.readVarint()}readString(){const p=this.readVarint()+this.pos,c=this.pos;return this.pos=p,p-c>=12&&obe?obe.decode(this.buf.subarray(c,p)):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,p)}readBytes(){const p=this.readVarint()+this.pos,c=this.buf.subarray(this.pos,p);return this.pos=p,c}readPackedVarint(p=[],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(p,c){this.writeVarint(p<<3|c)}realloc(p){let c=this.length||16;for(;c268435455||p<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)}(p,this):(this.realloc(4),this.buf[this.pos++]=127&p|(p>127?128:0),p<=127||(this.buf[this.pos++]=127&(p>>>=7)|(p>127?128:0),p<=127||(this.buf[this.pos++]=127&(p>>>=7)|(p>127?128:0),p<=127||(this.buf[this.pos++]=p>>>7&127))))}writeSVarint(p){this.writeVarint(p<0?2*-p-1:2*p)}writeBoolean(p){this.writeVarint(+p)}writeString(p){p=String(p),this.realloc(4*p.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,p,this.pos);const h=this.pos-c;h>=128&&lbe(c,h,this),this.pos=c-1,this.writeVarint(h),this.pos+=h}writeFloat(p){this.realloc(4),this.dataView.setFloat32(this.pos,p,!0),this.pos+=4}writeDouble(p){this.realloc(8),this.dataView.setFloat64(this.pos,p,!0),this.pos+=8}writeBytes(p){const c=p.length;this.writeVarint(c),this.realloc(c);for(let h=0;h=128&&lbe(h,g,this),this.pos=h-1,this.writeVarint(g),this.pos+=g}writeMessage(p,c,h){this.writeTag(p,2),this.writeRawMessage(c,h)}writePackedVarint(p,c){c.length&&this.writeMessage(p,GWe,c)}writePackedSVarint(p,c){c.length&&this.writeMessage(p,KWe,c)}writePackedBoolean(p,c){c.length&&this.writeMessage(p,XWe,c)}writePackedFloat(p,c){c.length&&this.writeMessage(p,ZWe,c)}writePackedDouble(p,c){c.length&&this.writeMessage(p,YWe,c)}writePackedFixed32(p,c){c.length&&this.writeMessage(p,QWe,c)}writePackedSFixed32(p,c){c.length&&this.writeMessage(p,JWe,c)}writePackedFixed64(p,c){c.length&&this.writeMessage(p,eGe,c)}writePackedSFixed64(p,c){c.length&&this.writeMessage(p,tGe,c)}writeBytesField(p,c){this.writeTag(p,2),this.writeBytes(c)}writeFixed32Field(p,c){this.writeTag(p,5),this.writeFixed32(c)}writeSFixed32Field(p,c){this.writeTag(p,5),this.writeSFixed32(c)}writeFixed64Field(p,c){this.writeTag(p,1),this.writeFixed64(c)}writeSFixed64Field(p,c){this.writeTag(p,1),this.writeSFixed64(c)}writeVarintField(p,c){this.writeTag(p,0),this.writeVarint(c)}writeSVarintField(p,c){this.writeTag(p,0),this.writeSVarint(c)}writeStringField(p,c){this.writeTag(p,2),this.writeString(c)}writeFloatField(p,c){this.writeTag(p,5),this.writeFloat(c)}writeDoubleField(p,c){this.writeTag(p,1),this.writeDouble(c)}writeBooleanField(p,c){this.writeVarintField(p,+c)}};function o4(p,c,h){return h?4294967296*c+(p>>>0):4294967296*(c>>>0)+(p>>>0)}function lbe(p,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;_>=p;_--)h.buf[_+g]=h.buf[_]}function GWe(p,c){for(let h=0;h=0&&g>=c&&aL[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 l4;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(TM.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 lle(p,c,h,g,_,S,C,L,z,$,K,Z,ee,re,ae,ge=1){const Se=l4.fromFeature(p,_,ge);Z===$u.vertical&&Se.verticalizePunctuation(ee);let Ne=[];const Be=function(jt,At,Pt,Qt,Ft,sr){if(!jt)return[];const dr=[],ur=function(gr,rr,Jt,xr,Er,jr){let bs=0;for(let Gr=0;Gr=0;let _r=0;for(let gr=0;gr0&&va>hn&&(hn=va)}else{const ma=Pt[vr.fontStack];if(!ma)continue;ma[qr]&&(cn=ma[qr]);const ya=At[vr.fontStack];if(!ya)continue;const va=ya.glyphs[qr];if(!va)continue;if(Cs=va.metrics,wn=qr!==8203?kl:0,jr){const za=ya.ascender!==void 0?Math.abs(ya.ascender):0,ri=ya.descender!==void 0?Math.abs(ya.descender):0,Ya=(za+ri)*ws;Za-h/2;){if(C--,C<0)return!1;L-=p[C].dist(S),S=p[C]}L+=p[C].dist(p[C+1]),C++;const z=[];let $=0;for(;Lg;)$-=z.shift().angleDelta;if($>_)return!1;C++,L+=K.dist(Z)}return!0}function vbe(p){let c=0;for(let h=0;h$){const ae=($-z)/re,ge=Us(Z.x,ee.x,ae),Se=Us(Z.y,ee.y,ae),Ne=new Ix(ge,Se,0,ee.angleTo(Z),K);return!C||ybe(p,Ne,L,C,c)?Ne:void 0}z+=re}}function lGe(p,c,h,g,_,S,C,L,z){const $=_be(g,S,C),K=bbe(g,_),Z=K*C,ee=p[0].x===0||p[0].x===z||p[0].y===0||p[0].y===z;return c-Z=0&&Qe=0&&vt=0&&ee+$<=K){const mt=new Ix(Qe,vt,0,Be,ae);g&&!ybe(p,mt,S,g,_)||re.push(mt)}}Z+=Ne}return L||re.length||C||(re=wbe(p,Z/2,h,g,_,S,C,!0,z)),re}function jbe(p){let c=0,h=0;for(const C of p)c+=C.w*C.h,h=Math.max(h,C.w);p.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 p)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?ae-1:ae,Fc.copy(Z.data,$,{x:0,y:0},{x:ge,y:Se},Z.data,g),Fc.copy(Z.data,$,{x:0,y:Be-ae},{x:ge,y:Se-ae},{width:Ne,height:ae},g),Fc.copy(Z.data,$,{x:0,y:0},{x:ge,y:Se+Be},{width:Ne,height:ae},g),Fc.copy(Z.data,$,{x:Ne-ae,y:0},{x:ge-ae,y:Se},{width:ae,height:Be},g),Fc.copy(Z.data,$,{x:0,y:0},{x:ge+Ne,y:Se},{width:ae,height:Be},g),Fc.copy(Z.data,$,{x:Ne-ae,y:Be-ae},{x:ge-ae,y:Se-ae},{width:ae,height:ae},g),Fc.copy(Z.data,$,{x:0,y:Be-ae},{x:ge+Ne,y:Se-ae},{width:ae,height:ae},g),Fc.copy(Z.data,$,{x:0,y:0},{x:ge+Ne,y:Se+Be},{width:ae,height:ae},g),Fc.copy(Z.data,$,{x:Ne-ae,y:0},{x:ge-ae,y:Se+Be},{width:ae,height:ae},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:$}=mle(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=Ep.parse(S);if(ka.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=Ep.parse(S);if(ka.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 Fc(z);Fc.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}})}}as(AM,"ImagePosition"),as(kbe,"ImageAtlas");const EM=1e20;function Nbe(p,c,h,g,_,S,C,L,z){for(let $=c;$-1);z++,S[z]=L,C[z]=$,C[z+1]=EM}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]=[],u4.loadGlyphRange(S,K,_,this.requestManager,(ee,re)=>{if(re){z.ascender=re.ascender,z.descender=re.descender;for(const ae in re.glyphs)this._doesCharSupportLocalGlyph(+ae)||(z.glyphs[+ae]=re.glyphs[+ae]);z.ranges[K]=!0}for(const ae of Z)ae(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!==ple.none&&(this.localGlyphMode===ple.all?!!this.localFontFamily:!!this.localFontFamily&&(Ps["CJK Unified Ideographs"](c)||Ps["Hangul Syllables"](c)||Ps.Hiragana(c)||Ps.Katakana(c)||Ps["CJK Symbols and Punctuation"](c)||Ps["CJK Unified Ideographs Extension A"](c)||Ps["CJK Unified Ideographs Extension B"](c)||Ps.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 u4.TinySDF({fontFamily:_,fontWeight:ge,fontSize:24*Zp,buffer:3*Zp,radius:8*Zp}),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:ae}=S.draw(C);return this.localGlyphs[S.fontWeight][g]={id:g,bitmap:new T0({width:z,height:$},L),metrics:{width:K/Zp,height:Z/Zp,left:ee/Zp,top:re/Zp-27,advance:ae/Zp,localGlyph:!0}}}}u4.loadGlyphRange=function(p,c,h,g,_){const S=256*c,C=S+255,L=g.transformRequest(g.normalizeGlyphsURL(h).replace("{fontstack}",p).replace("{range}",`${S}-${C}`),Ap.Glyphs);Lu(L,(z,$)=>{if(z)_(z);else if($){const K={},Z=function(ee){return new nL(ee).readFields(rGe,{})}($);for(const ee of Z.glyphs)K[ee.id]=ee;_(null,{glyphs:K,ascender:Z.ascender,descender:Z.descender})}})},u4.TinySDF=class{constructor({fontSize:p=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=p+4*c,$=this._createCanvas(z),K=this.ctx=$.getContext("2d",{willReadFrequently:!0});K.font=`${C} ${S} ${p}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(p){const c=document.createElement("canvas");return c.width=c.height=p,c}draw(p){const{width:c,actualBoundingBoxAscent:h,actualBoundingBoxDescent:g,actualBoundingBoxLeft:_,actualBoundingBoxRight:S}=this.ctx.measureText(p),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:ae,buffer:ge,gridInner:Se,gridOuter:Ne}=this;this.lang&&(ae.lang=this.lang),ae.clearRect(ge,ge,L,z),ae.fillText(p,ge,ge+C);const Be=ae.getImageData(ge,ge,L,z);Ne.fill(EM,0,Z),Se.fill(0,0,Z);for(let qe=0;qe0?jt*jt:0,Se[mt]=jt<0?jt*jt:0}}Nbe(Ne,0,0,$,K,$,this.f,this.v,this.z),Nbe(Se,ge,ge,L,z,$,this.f,this.v,this.z);for(let qe=0;qe{const yr=lL(Ft.stretch-Be,qe,K,p.left*_),_r=cL(Ft.fixed-mt,jt,Ft.stretch,ae),mr=lL(sr.stretch-Qe,vt,Z,p.top*_),gr=cL(sr.fixed-At,Pt,sr.stretch,ge),rr=lL(dr.stretch-Be,qe,K,p.left*_),Jt=cL(dr.fixed-mt,jt,dr.stretch,ae),xr=lL(ur.stretch-Qe,vt,Z,p.top*_),Er=cL(ur.fixed-At,Pt,ur.stretch,ge),jr=new or(yr,mr),bs=new or(rr,mr),Gr=new or(rr,xr),es=new or(yr,xr),hs=new or(_r/L,gr/L),kn=new or(Jt/L,Er/L),Nr=c*Math.PI/180;if(Nr){const Za=Math.sin(Nr),pt=Math.cos(Nr),_t=[pt,-Za,Za,pt];jr._matMult(_t),bs._matMult(_t),es._matMult(_t),Gr._matMult(_t)}const ps=Ft.stretch+Ft.fixed,Qs=dr.stretch+dr.fixed,Zn=sr.stretch+sr.fixed,ra=ur.stretch+ur.fixed,hn=p.imageSecondary;return{tl:jr,tr:bs,bl:es,br:Gr,texPrimary:{x:C.paddedRect.x+mg+ps,y:C.paddedRect.y+mg+Zn,w:Qs-ps,h:ra-Zn},texSecondary:hn?{x:hn.paddedRect.x+mg+ps,y:hn.paddedRect.y+mg+Zn,w:Qs-ps,h:ra-Zn}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:hs,pixelOffsetBR:kn,minFontScaleX:jt/L/K,minFontScaleY:Pt/L/Z,isSDF:h}};if(g&&(C.stretchX||C.stretchY)){const Ft=Mbe(ee,Se,ae),sr=Mbe(re,Ne,ge);for(let dr=0;drS)&&(S=ae.x),(!re||ae.y>C)&&(C=ae.y)}const z=Math.min(S-g,C-_);let $=z/2;const K=new tN([],hGe);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 h4(re.p.x-$,re.p.y-$,$,p)),K.push(new h4(re.p.x+$,re.p.y-$,$,p)),K.push(new h4(re.p.x-$,re.p.y+$,$,p)),K.push(new h4(re.p.x+$,re.p.y+$,$,p)),ee+=4)}return h&&(console.log(`num probes: ${ee}`),console.log(`best distance: ${Z.d}`)),Z.p}function hGe(p,c){return c.max-p.max}class h4{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-ae.x)*(S.y-ae.y)/(ge.y-ae.y)+ae.x&&(L=!L),z=Math.min(z,go(S,ae,ge))}}return(L?1:-1)*Math.sqrt(z)}(this.p,_),this.max=this.d+this.h*Math.SQRT2}}const mGe=Object.keys,gle=Number.POSITIVE_INFINITY,pGe=Math.sqrt(2);function E0(p,c,h,g,_){const S=dle(p)&&p.collisionPadding?p.collisionPadding:[0,0,0,0],C={top:p.top-S[1],bottom:p.bottom+S[3],left:p.left-S[0],right:p.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 $=Ws(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),ae=new or(0,0);K._rotateAround($,ae),Z._rotateAround($,ae),ee._rotateAround($,ae),re._rotateAround($,ae),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 Abe(p,[c,h]){let g=0,_=0;if(h===gle){c<0&&(c=0);const S=c/pGe;switch(p){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(p){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),p){case"top-right":case"top-left":case"top":_=h-7;break;case"bottom-right":case"bottom-left":case"bottom":_=7-h}switch(p){case"top-right":case"bottom-right":case"right":g=-c;break;case"top-left":case"bottom-left":case"left":g=c}}return[g,_]}function fGe(p,c,h,g,_,S,C,L,z,$,K,Z,ee,re){const ae=p.layers[0],ge=ae.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:Be,baseTextRotate:qe,iconScaleFactor:Qe}=function(mt,jt,At){const Pt=mt.get("icon-rotate").evaluate(jt,{},At),Qt=mt.get("text-rotate").evaluate(jt,{},At),[Ft,sr]=mt.get("icon-size-scale-range");return{baseIconRotate:Pt,baseTextRotate:Qt,iconScaleFactor:ye(1,Ft,sr)}}(g,_,S);c&&(Se.iconBBox=E0(c,Se.iconBBox,Be,C),h)&&(Se.iconVerticalBBox=E0(h,Se.iconVerticalBBox,Be+90,C));const vt=uL(Z.horizontal);vt&&(Ne.textBBox=E0(vt,Ne.textBBox,qe,1,re)),Z.vertical&&(Ne.textVerticalBBox=E0(Z.vertical,Ne.textVerticalBBox,qe+90,1,re));for(const mt of ge)mt.hasIconProperties()&&gGe(Se,p,ae,mt,_,S,L,Be,C,z,c,$,Qe,K),mt.hasTextProperties()&&xGe(Ne,ae,mt,_,S,re,qe,ee,vt,Z.vertical);return{iconBBox:Se.iconBBox,iconVerticalBBox:Se.iconVerticalBBox,textBBox:Ne.textBBox,textVerticalBBox:Ne.textVerticalBBox}}function gGe(p,c,h,g,_,S,C,L,z,$,K,Z,ee,re){const{appearanceIconOffset:ae,appearanceIconRotate:ge,appearanceIconSize:Se}=function(Qe,vt,mt,jt,At,Pt,Qt,Ft){const sr=Qe.hasProperty("icon-offset")?vt.getAppearanceValueAndResolveTokens(Qe,"icon-offset",mt,jt,[]):null,dr=sr&&Array.isArray(sr)?sr:At,ur=Qe.hasProperty("icon-rotate")?vt.getAppearanceValueAndResolveTokens(Qe,"icon-rotate",mt,jt,[]):null,yr=typeof ur=="number"?ur:Pt,_r=Qe.hasProperty("icon-size")?vt.getAppearanceValueAndResolveTokens(Qe,"icon-size",mt,jt,[]):null;return{appearanceIconOffset:dr,appearanceIconRotate:yr,appearanceIconSize:typeof _r=="number"?_r*Ft.iconScaleFactor:Qt}}(g,h,_,S,C,L,z,$);let Ne=null,Be=null,qe=null;g.hasProperty("icon-image")?qe=function(Qe,vt,mt,jt,At,Pt,Qt){let Ft=null;const sr=vt.getAppearanceValueAndResolveTokens(mt,"icon-image",jt,At,[]);if(sr){const dr=Qe.getResolvedImageFromTokens(sr),ur=mt.getUnevaluatedProperty("icon-size"),yr=IM(dr,c4(Qe.zoom,ur,Qe.worldview),ur,At,Qe.zoom,jt,Qe.pixelRatio,Qt,Qe.worldview);Ft=Pt.get(yr.iconPrimary.toString())}return Ft}(c,h,g,_,S,Z,ee):K&&(qe=K.imagePrimary),qe&&(Ne=iL(qe,null,ae,re),c.allowVerticalPlacement&&(Be=iL(qe,null,ae,re))),Ne&&(p.iconBBox=E0(Ne,p.iconBBox,ge,Se)),Be&&(p.iconVerticalBBox=E0(Be,p.iconVerticalBBox,ge+90,Se))}function xGe(p,c,h,g,_,S,C,L,z,$){const{appearanceTextOffset:K,appearanceTextRotate:Z,appearanceTextSize:ee}=function(ae,ge,Se,Ne,Be,qe,Qe){const vt=ae.hasProperty("text-offset")?ge.getAppearanceValueAndResolveTokens(ae,"text-offset",Se,Ne,[]):null,mt=vt&&Array.isArray(vt)?[vt[0]*kl,vt[1]*kl]:Be,jt=ae.hasProperty("text-rotate")?ge.getAppearanceValueAndResolveTokens(ae,"text-rotate",Se,Ne,[]):null,At=typeof jt=="number"?jt:qe,Pt=ae.hasProperty("text-size")?ge.getAppearanceValueAndResolveTokens(ae,"text-size",Se,Ne,[]):null;return{appearanceTextOffset:mt,appearanceTextRotate:At,appearanceTextSize:typeof Pt=="number"?Pt:Qe}}(h,c,g,_,S,C,L),re=ee/L;z&&(p.textBBox=E0(z,p.textBBox,Z,re,K)),$&&(p.textVerticalBBox=E0($,p.textVerticalBBox,Z+90,re,K))}function dL(p,c,h,g,_,S,C,L,z){if(!c||!c.usvg)return;const $=xbe(g),K=xbe(_),Z=S!=="both"&&S!=="width"||!fbe(g)?1:K.width/$.width,ee=S!=="both"&&S!=="height"||!gbe(g)?1:K.height/$.height;h.scaleSelf(Z,ee);const re=h.toString();C.set(re,h),L.set(re,c);const{imagePosition:ae}=mle(re,c,k_);z.set(re,ae)}function Ebe(p,c,h,g,_,S,C,L,z){if(!p)return;const $=function(K,Z,ee,re,ae,ge){if(K.kind==="camera")return K.maxSize;if(K.kind==="composite"){const Se=Z.possiblyEvaluate(new di(K.maxZoom,{worldview:ge}),ee).evaluate(ae,{},ee),Ne=Z.possiblyEvaluate(new di(K.minZoom,{worldview:ge}),ee).evaluate(ae,{},ee);return Math.max(Se,Ne)}return Z.possiblyEvaluate(new di(re,{worldview:ge})).evaluate(ae,{},ee)}(c,h,g,_,S,z);return p.scaleSelf($*L*C)}function IM(p,c,h,g,_,S,C,L,z){return{iconPrimary:Ebe(p.getPrimary(),c,h,g,_,S,C,L,z),iconSecondary:Ebe(p.getSecondary(),c,h,g,_,S,C,L,z)}}function yGe(p,c,h){if(!c)return;const g=h.get(p.toString()),_=h.get(c.toString());g&&_&&(g.paddedRect.w===_.paddedRect.w&&g.paddedRect.h===_.paddedRect.h||Kr(`Mismatch in icon variant sizes: ${p.toString()} and ${c.toString()}`),g.usvg!==_.usvg&&Kr(`Mismatch in icon variant image types: ${p.id} and ${c.id}`))}function Ibe(p,c,h,g){if(!p)return;const _=c.get(h.toString());if(p.imagePrimary=_,g){const S=c.get(g.toString());p.imageSecondary=S}}function vGe(p,c){for(const h in p.horizontal)Pbe(p.horizontal[h],c);Pbe(p.vertical,c)}function Pbe(p,c){if(p){for(const h of p.positionedLines)for(const g of h.positionedGlyphs)if(g.image!==null){const _=g.image.toString();g.rect=c.get(_).paddedRect}}}function xle(p){switch(p){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function _Ge(p,c,h,g,_,S,C,L,z){const $=uL(S.horizontal)||S.vertical,K=h.get("icon-text-fit-padding").evaluate(g,{},_);let Z,ee=c;return c&&z!=="none"&&(p.allowVerticalPlacement&&S.vertical&&(Z=ule(c,S.vertical,z,K,L,C)),$&&(ee=ule(c,$,z,K,L,C))),{defaultShapedIcon:ee,verticallyShapedIcon:Z}}function bGe(p,c,h,g,_,S,C,L,z,$,K,Z,ee,re,ae,ge,Se,Ne,Be,qe,Qe,vt,mt,jt){let At=C.textMaxSize.evaluate(c,{},ee);At===void 0?At=L*C.textScaleFactor:At*=C.textScaleFactor;const Pt=p.layers[0].layout,Qt=kl,Ft=L*C.textScaleFactor/Qt,sr=uL(h.horizontal)||h.vertical;if(Se!=="none"&&p.appearanceFeatureData&&c.index18&&xr>2&&(xr>>=1),Math.max(Ar/(512*xr),1)*Pt.get("symbol-spacing")),_r=Pt.get("text-padding")*p.tilePixelRatio,mr=Pt.get("icon-padding")*p.tilePixelRatio,gr=Ws(Pt.get("text-max-angle")),rr=Pt.get("icon-rotation-alignment")==="map"&&qe!=="point",Jt=yr/2;var xr;p.hasAnyIconTextFit===!1&&Se!=="none"&&(p.hasAnyIconTextFit=!0);const Er=c.properties?+c.properties[er]:null,jr=Er&&p.elevationFeatureIdToIndex?p.elevationFeatureIdToIndex.get(Er):65535,bs=(Gr,es,hs)=>{if(es.x<0||es.x>=Ar||es.y<0||es.y>=Ar)return;let kn=null;if(dr){const{x:Nr,y:ps,z:Qs}=re.projectTilePoint(es.x,es.y,hs);kn={anchor:new Ix(Nr,ps,Qs,0,void 0),up:re.upVector(hs,es.x,es.y)}}(function(Nr,ps,Qs,Zn,ra,hn,Za,pt,_t,nr,vr,Ur,qr,ws,Cs,cn,yn,wn,qn,Ds,Ks,ma,ya,va,za,ri,Ya,Ca,Ia,vn,ta,Fi,Ls){const Vn=Nr.addToLineVertexArray(ps,Zn);let Qa,ai,ui,jo,oi,Os,Gi,Ba=0,Ai=0,rl=0,Nl=0,qo=-1,Vo=-1;const ml={};let Xd=fr("");const li=Qs?Qs.anchor:ps,xo=Ca!=="none";let ko=0,uu=0;if(_t._unevaluatedLayout.getValue("text-radial-offset")===void 0){const yc=_t.layout.get("text-offset").evaluate(Ks,{},za);ko=yc[0]*kl,uu=yc[1]*kl}else ko=_t.layout.get("text-radial-offset").evaluate(Ks,{},za)*kl,uu=gle;if(Nr.allowVerticalPlacement&&ra.vertical){const yc=ra.vertical;if(Cs)Os=yle(yc),pt&&(Gi=yle(pt));else{const Md=_t.layout.get("text-rotate").evaluate(Ks,{},za)+90;ui=hL(nr,li,ps,vr,Ur,qr,yc,ws,Md,cn,Fi),pt&&(jo=hL(nr,li,ps,vr,Ur,qr,pt,wn,Md,null,ta))}}if(hn){const yc=Nr.iconSizeData,Md=_t.layout.get("icon-rotate").evaluate(Ks,{},za),Uu=fle(hn,Md,ya,xo,ma.iconScaleFactor),L0=pt?fle(pt,Md,ya,xo,ma.iconScaleFactor):void 0;ai=hL(nr,li,ps,vr,Ur,qr,hn,wn,Md,null,vn);const v4=function(Jp,YM,Q2e,PKe,J2e,ewe,LKe,OKe){const twe=Jp.layers[0],rwe=twe.appearances;let _4=YM.length;if(Q2e&&(_4=Math.max(_4,Q2e.length)),rwe.length===0)return _4;const[DKe,RKe]=PKe.get("icon-size-scale-range"),FKe=ye(1,DKe,RKe);for(const swe of rwe){const nwe=swe.getUnevaluatedProperties();if(nwe._values["icon-image"].value!==void 0){const awe=twe.getAppearanceValueAndResolveTokens(swe,"icon-image",J2e,ewe,[]);if(awe){const iwe=Jp.getResolvedImageFromTokens(awe);if(iwe){const owe=nwe._values["icon-size"],zKe=IM(iwe,c4(Jp.zoom,owe,Jp.worldview),owe,ewe,Jp.zoom,J2e,Jp.pixelRatio,FKe,Jp.worldview),BKe=LKe.get(zKe.iconPrimary.toString());_4=Math.max(_4,cGe(BKe,OKe))}}}}return _4}(Nr,Uu,L0,_t.layout,Ks,za,Nr.iconAtlasPositions,xo);Ba=4*v4;let Qp=null;yc.kind==="source"?(Qp=[Kp*_t.layout.get("icon-size").evaluate(Ks,{},za)*ma.iconScaleFactor],Qp[0]>Px&&Kr(`${Nr.layerIds[0]}: Value for "icon-size" is >= ${PM}. Reduce your "icon-size".`)):yc.kind==="composite"&&(Qp=[Kp*ma.compositeIconSizes[0].evaluate(Ks,{},za)*ma.iconScaleFactor,Kp*ma.compositeIconSizes[1].evaluate(Ks,{},za)*ma.iconScaleFactor],(Qp[0]>Px||Qp[1]>Px)&&Kr(`${Nr.layerIds[0]}: Value for "icon-size" is >= ${PM}. Reduce your "icon-size".`)),Nr.addSymbols(Nr.icon,Uu,Qp,Ds,qn,Ks,void 0,Qs,ps,Vn.lineStartIndex,Vn.lineLength,-1,va,za,ri,Ya,Nr.symbolInstances.length,v4),qo=Nr.icon.placedSymbolArray.length-1,L0&&(Ai=4*v4,Nr.addSymbols(Nr.icon,L0,Qp,Ds,qn,Ks,$u.vertical,Qs,ps,Vn.lineStartIndex,Vn.lineLength,-1,va,za,ri,Ya,Nr.symbolInstances.length,v4),Vo=Nr.icon.placedSymbolArray.length-1)}for(const yc in ra.horizontal){const Md=yc,Uu=ra.horizontal[Md];Qa||(Xd=fr(Uu.text),Cs?oi=yle(Uu):Qa=hL(nr,li,ps,vr,Ur,qr,Uu,ws,_t.layout.get("text-rotate").evaluate(Ks,{},za),cn,Fi));const L0=Uu.positionedLines.length===1;if(rl+=Lbe(Nr,Qs,ps,Uu,Za,_t,Cs,Ks,cn,Vn,ra.vertical?$u.horizontal:$u.horizontalOnly,L0?mGe(ra.horizontal):[Md],ml,qo,ma,va,za,Nr.symbolInstances.length,ri),L0)break}ra.vertical&&(Nl+=Lbe(Nr,Qs,ps,ra.vertical,Za,_t,Cs,Ks,cn,Vn,$u.vertical,["vertical"],ml,Vo,ma,va,za,Nr.symbolInstances.length,ri));let sl=-1;const Wm=(yc,Md)=>yc?Math.max(yc,Md):Md;sl=Wm(oi,sl),sl=Wm(Os,sl),sl=Wm(Gi,sl);const pg=sl>-1?1:0;Nr.glyphOffsetArray.length>=65535&&Kr("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Ks.sortKey!==void 0&&Nr.addToSortKeyRanges(Nr.symbolInstances.length,Ks.sortKey),Nr.symbolInstances.emplaceBack(ps.x,ps.y,li.x,li.y,li.z,ml.right>=0?ml.right:-1,ml.center>=0?ml.center:-1,ml.left>=0?ml.left:-1,ml.vertical>=0?ml.vertical:-1,qo,Vo,Xd,Qa!==void 0?Qa:Nr.collisionBoxArray.length,Qa!==void 0?Qa+1:Nr.collisionBoxArray.length,ui!==void 0?ui:Nr.collisionBoxArray.length,ui!==void 0?ui+1:Nr.collisionBoxArray.length,ai!==void 0?ai:Nr.collisionBoxArray.length,ai!==void 0?ai+1:Nr.collisionBoxArray.length,jo||Nr.collisionBoxArray.length,jo?jo+1:Nr.collisionBoxArray.length,vr,rl,Nl,Ba,Ai,pg,0,ko,uu,sl,0,xo?1:0,Ia)})(p,es,kn,Gr,h,g,S,_,p.layers[0],p.collisionBoxArray,c.index,c.sourceLayerIndex,p.index,_r,Be,$,0,mr,rr,Ne,c,C,K,Z,ee,ae,ge,Se,jr,Qe,vt,mt)};if(qe==="line")for(const Gr of G6(c.geometry,0,0,Ar,Ar)){const es=lGe(Gr,yr,gr,h.vertical||sr,g,Qt,ur,p.overscaling,Ar);for(const hs of es)sr&&wGe(p,sr.text,Jt,hs)||bs(Gr,hs,ee)}else if(qe==="line-center"){for(const Gr of c.geometry)if(Gr.length>1){const es=oGe(Gr,gr,h.vertical||sr,g,Qt,ur);es&&bs(Gr,es,ee)}}else if(c.type==="Polygon")for(const Gr of fM(c.geometry,0)){const es=uGe(Gr,16);bs(Gr[0],new Ix(es.x,es.y,0,0,void 0),ee)}else if(c.type==="LineString")for(const Gr of c.geometry)bs(Gr,new Ix(Gr[0].x,Gr[0].y,0,0,void 0),ee);else if(c.type==="Point")for(const Gr of c.geometry)for(const es of Gr)bs([es],new Ix(es.x,es.y,0,0,void 0),ee)}const PM=255,Px=PM*Kp;function Lbe(p,c,h,g,_,S,C,L,z,$,K,Z,ee,re,ae,ge,Se,Ne,Be){const qe=function(mt,jt,At,Pt,Qt,Ft,sr,dr){const ur=[];if(jt.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],bs=Er*jr;return bs>0?[Er,-jr]:bs<0?[-Er,jr]:Er===0?[jr,Er]:[jr,-Er]}(At);let mr=Math.abs(jt.top-jt.bottom);for(const xr of jt.positionedLines)mr-=xr.lineOffset;const gr=jt.positionedLines.length,rr=mr/gr;let Jt=jt.top-At[1];for(let xr=0;xrPx&&Kr(`${p.layerIds[0]}: Value for "text-size" is >= ${PM}. Reduce your "text-size".`)):Qe.kind==="composite"&&(vt=[Kp*ae.compositeTextSizes[0].evaluate(L,{},Se)*ae.textScaleFactor,Kp*ae.compositeTextSizes[1].evaluate(L,{},Se)*ae.textScaleFactor],(vt[0]>Px||vt[1]>Px)&&Kr(`${p.layerIds[0]}: Value for "text-size" is >= ${PM}. Reduce your "text-size".`)),p.addSymbols(p.text,qe,vt,z,C,L,K,c,h,$.lineStartIndex,$.lineLength,re,ge,Se,Be,!1,Ne,qe.length);for(const mt of Z)ee[mt]=p.text.placedSymbolArray.length-1;return 4*qe.length}function uL(p){for(const c in p)return p[c];return null}function hL(p,c,h,g,_,S,C,L,z,$,K){let Z,ee,re,ae;if(Z=K?K.top:C.top,ee=K?K.bottom:C.bottom,re=K?K.left:C.left,ae=K?K.right:C.right,dle(C)&&C.collisionPadding){const ge=C.collisionPadding;re-=ge[0],Z-=ge[1],ae+=ge[2],ee+=ge[3]}if(z){const ge=new or(re,Z),Se=new or(ae,Z),Ne=new or(re,ee),Be=new or(ae,ee),qe=Ws(z);let Qe=new or(0,0);$&&(Qe=new or($[0],$[1])),ge._rotateAround(qe,Qe),Se._rotateAround(qe,Qe),Ne._rotateAround(qe,Qe),Be._rotateAround(qe,Qe),re=Math.min(ge.x,Se.x,Ne.x,Be.x),ae=Math.max(ge.x,Se.x,Ne.x,Be.x),Z=Math.min(ge.y,Se.y,Ne.y,Be.y),ee=Math.max(ge.y,Se.y,Ne.y,Be.y)}return p.emplaceBack(c.x,c.y,c.z,h.x,h.y,re,Z,ae,ee,L,g,_,S),p.length-1}function yle(p){dle(p)&&p.collisionPadding&&(p.top-=p.collisionPadding[1],p.bottom+=p.collisionPadding[3]);const c=p.bottom-p.top;return c>0?Math.max(10,c):null}function wGe(p,c,h,g){const _=p.compareText;if(c in _){const S=_[c];for(let C=S.length-1;C>=0;C--)if(g.dist(S[C])qe&&(Qe(mt,ur,At,Pt,sr,dr),Qe(ur,jt,sr,dr,Qt,Ft))}Qe(Z,ee,g,S,_,S),Qe(ee,re,_,S,_,C),Qe(re,ae,_,C,g,C),Qe(ae,Z,g,C,g,S),ge-=qe,Se-=qe,Ne+=qe,Be+=qe;const vt=1/Math.max(Ne-ge,Be-Se);return{scale:vt,x:ge*vt,y:Se*vt,x2:Ne*vt,y2:Be*vt,projection:c}}function Dbe(p,{x:c,y:h},g=0){return new or(((c-g)*p.scale-p.x)*Ar,(h*p.scale-p.y)*Ar)}const jGe=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 f(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 Obe(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<-m4+g&&(h=-m4+g):h>m4-g&&(h=m4-g);const C=S/Math.pow(pL(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(Yi(z/g)+this.center[0],-180,180),K=ye(Yi(2*Math.atan(Math.pow(_/L,1/g))-m4),-pe,pe);return new f($,this.southernCenter?-K:K)}}class Rbe 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:W(h),z:0}}unproject(c,h){const g=te(c),_=me(h);return new f(g,_)}}const Fbe=Ws(pe);class MGe extends I0{project(c,h){const g=(h=Ws(h))*h,_=g*g;return{x:.5*((c=Ws(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,-Fbe,Fbe)}while(Math.abs(S)>1e-6&&--_>0);C=g*g;const L=ye(Yi(c/(.8707+C*(C*(C*C*C*(.003971-.001529*C)-.013791)-.131979))),-180,180),z=Yi(g);return new f(L,z)}}const zbe=Ws(pe);class TGe extends I0{project(c,h){h=Ws(h),c=Ws(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=$*$,ae=Math.cos(g/2),ge=Math.sin(g/2),Se=2*ae*ge,Ne=ge*ge,Be=1-re*ae*ae,qe=Be?1/Be:0,Qe=Be?Math.acos($*ae)*Math.sqrt(1/Be):0,vt=.5*(2*Qe*$*ge+2*g/Math.PI)-c,mt=.5*(Qe*K+_)-h,jt=.5*qe*(re*Ne+Qe*$*ae*ee)+1/Math.PI,At=qe*(Se*Z/4-Qe*K*ge),Pt=.125*qe*(Z*ge-Qe*K*re*Se),Qt=.5*qe*(ee*ae+Qe*Ne*$)+.5,Ft=At*Pt-Qt*jt;L=(mt*At-vt*Qt)/Ft,z=(vt*Pt-mt*jt)/Ft,g=ye(g-L,-Math.PI,Math.PI),_=ye(_-z,-zbe,zbe)}while((Math.abs(L)>C||Math.abs(z)>C)&&--S>0);return new f(Yi(g),Yi(_))}}class Bbe 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(Ws(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:Ws(c)*_*g+.5,y:-Math.sin(Ws(h))/_*g+.5,z:0}}unproject(c,h){const{scale:g,cosPhi:_}=this,S=-(h-.5)/g,C=ye(Yi((c-.5)/g)/_,-180,180),L=Math.asin(ye(S*_,-1,1)),z=ye(Yi(L),-pe,pe);return new f(C,z)}}class AGe extends Rbe{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 _=cM(c,h,g);return et(_,_,F6(em(g))),{x:_[0],y:_[1],z:_[2]}}locationPoint(c,h,g){const _=N0(h.lat,h.lng),S=$e([],_),C=g?c._centerAltitude+g:c.elevation?c.elevation.getAtPointOrZero(c.locationCoordinate(h),c._centerAltitude):c._centerAltitude;tt(_,_,S,J(1,0)*Ar*C);const L=M(new Float64Array(16));return T(L,c.pixelMatrix,c.globeMatrix),et(_,_,L),new or(_[0],_[1])}pixelsPerMeter(c,h){return J(1,0)*h}pixelSpaceConversion(c,h,g){const _=J(1,c)*h,S=Us(J(1,45)*h,_,g);return this.pixelsPerMeter(c,h)/S}createTileMatrix(c,h,g){const _=joe(em(g.canonical));return T(new Float64Array(16),c.globeMatrix,_)}createInversionMatrix(c,h){const{center:g}=c,_=F6(em(h));return U(_,_,Ws(g.lng)),D(_,_,Ws(g.lat)),R(_,_,[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=de([],we([],$,-C),[0,0,L]),Z=_.worldSize/(2*Math.PI),ee=[0,0,-Z],re=_.width/_.height,ae=Math.tan(_.fovAboveCenter),ge=we([],z.up(),ae),Se=we([],z.right(),ae*re),Ne=$e([],de([],de([],$,ge),Se)),Be=[];let qe;if(new ls(K,Ne).closestPointOnSphere(ee,Z,Be)){const Qe=de([],Be,ee),vt=je([],Qe,K);qe=Math.cos(_.fovAboveCenter)*fe(vt)}else{const Qe=je([],K,ee),vt=je([],ee,K);$e(vt,vt);const mt=fe(Qe)-Z;qe=Math.sqrt(mt*(mt+2*Z));const jt=Math.acos(qe/(Z+mt))-Math.acos(it($,vt));qe*=Math.cos(jt)}return 1.01*qe}(c,this.pixelsPerMeter(c.center.lat,c.worldSize)),g=M0(c.zoom);if(g>0){const _=Obe(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 Us(h,_+S*(1-Math.cos(C)),Math.pow(g,10))}return h}upVector(c,h,g){return cM(h,g,c,1)}upVectorScale(c){return{metersToTile:Vm(R6(em(c)))}}}function $be(p){const c=p.parallels,h=!!c&&Math.abs(c[0]+c[1])<.01;switch(p.name){case"mercator":return new Rbe(p);case"equirectangular":return new SGe(p);case"naturalEarth":return new MGe(p);case"equalEarth":return new NGe(p);case"winkelTripel":return new TGe(p);case"albers":return h?new Bbe(p):new kGe(p);case"lambertConformalConic":return h?new Bbe(p):new CGe(p);case"globe":return new AGe(p)}throw new Error(`Invalid projection name: ${p.name}`)}const EGe=Dt.types,IGe=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function zM(p,c,h,g,_,S,C,L,z,$,K,Z,ee){const re=L?Math.min(Px,Math.round(L[0])):0,ae=L?Math.min(Px,Math.round(L[1])):0;p.emplaceBack(c,h,Math.round(32*g),Math.round(32*_),S,C,(re<<1)+(z?1:0),0+(ae<<1),16*$,16*K,256*Z,256*ee)}function BM(p,c,h){p.emplaceBack(c,h)}function $M(p,c,h,g,_,S,C){p.emplaceBack(c,h,g,_,S,C)}const fL=(p,c,h,g)=>{for(let _=0;_0&&(this.iconTransitioningVertexBuffer=c.createVertexBuffer(this.iconTransitioningVertexArray,BWe.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=c.createVertexBuffer(this.globeExtVertexArray,DWe.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||S)&&(this.zOffsetVertexBuffer=c.createVertexBuffer(this.zOffsetVertexArray,FWe.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=c.createVertexBuffer(this.orientationVertexArray,zWe.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())}}as(vle,"SymbolBuffers");class _le{constructor(c,h,g){this.layoutVertexArray=new c,this.layoutAttributes=h,this.indexArray=new g,this.segments=new Vi,this.collisionVertexArray=new K5,this.collisionVertexArrayExt=new lg}upload(c){this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=c.createVertexBuffer(this.collisionVertexArray,$We.members,!0),this.collisionVertexBufferExt=c.createVertexBuffer(this.collisionVertexArrayExt,UWe.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}as(_le,"CollisionBuffers");class gL{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=c4(this.zoom,h["text-size"],this.worldview),this.iconSizeData=c4(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=>$u[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 vle(new Qh(this.layers,{zoom:this.zoom,lut:this.lut},c=>c.startsWith("text")||c.startsWith("symbol"))),this.icon=new vle(new Qh(this.layers,{zoom:this.zoom,lut:this.lut},c=>c.startsWith("icon")||c.startsWith("symbol"))),this.glyphOffsetArray=new HN,this.lineVertexArray=new I6,this.symbolInstances=new tM}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=MM[C];z&&(h[z.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(c,h,g,_,S,C){let L=1;const z=c.getUnevaluatedProperties()._values["icon-size"],$=c4(this.zoom,z,this.worldview),K=d4($,h);if($.kind!=="constant"&&$.kind!=="camera"||(L=K.uSize),$.kind==="composite"){const{minZoom:Z,maxZoom:ee}=$,re=z.possiblyEvaluate(new di(Z,{worldview:this.worldview}),_),ae=z.possiblyEvaluate(new di(ee,{worldview:this.worldview}),_),ge=re.evaluate(g,{},_,S);L=ge+(ae.evaluate(g,{},_,S)-ge)*K.uSizeT}return $.kind==="source"&&(L=z.possiblyEvaluate(new di(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!V6(this.activeReplacements,g)&&(this.activeReplacements=g,!0)}getResolvedImageFromTokens(c){return typeof c=="string"?jd.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),ae=($.value.kind!=="constant"||$.value.value instanceof wd&&!$.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=[],!ae&&!ge&&!Se)return;const Be=h.iconDependencies,qe=h.glyphDependencies,Qe=h.availableImages,vt=new di(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),mt=jt=>{const At=jt.id.toString();Be.has(At)?Be.get(At).push(jt):Be.set(At,[jt])};for(const jt of c){const{feature:At,id:Pt,index:Qt,sourceLayerIndex:Ft}=jt,sr=S._featureFilter.needGeometry,dr=Rt(At,sr);if(!S._featureFilter.filter(vt,dr,g))continue;if(sr||(dr.geometry=Ct(At,g,_)),L&&At.type!==1&&g.z<=5){const xr=dr.geometry,Er=.98078528056,jr=(bs,Gr)=>it(cM(bs.x,bs.y,g,1),cM(Gr.x,Gr.y,g,1)){if(!xr.getProperty("icon-image"))return;const Er=this.getCombinedIconPrimary(xr,_r,dr,g,Qe,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($u.vertical)>=0;for(const jr of ur.sections)if(jr.image){const bs=jr.image.getPrimary().scaleSelf(this.pixelRatio),Gr=bs.id.toString(),es=Be.get(Gr)||[];es.push(bs),Be.set(Gr,es)}else{const bs=a_(ur.toString()),Gr=jr.fontStack||xr,es=qe[Gr]=qe[Gr]||{};this.calculateGlyphDependencies(jr.text,es,Er,this.allowVerticalPlacement,bs)}}}if(C.get("symbol-placement")==="line"&&(this.features=function(jt){const At={},Pt={},Qt=[];let Ft=0;function sr(_r){Qt.push(jt[_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=At[mr];return delete At[mr],At[_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 jt of h.elevationFeatures)this.elevationFeatureIdToIndex.set(jt.id,this.elevationFeatures.length),this.elevationFeatures.push(jt)}}else C.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((jt,At)=>jt.sortKey-At.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"];$=IM(z,c4(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,Be={type:"Point",id:ge.id,properties:ge.properties,geometry:[]},qe=this.layers[0].appearances&&this.layers[0].appearances.find(Qe=>Qe.isActive({globals:_,feature:Be,canonical:c,featureState:Ne}));if(ge.activeAppearance===qe){L+=re.numIconVertices;continue}if(qe){ge.activeAppearance=qe;const Qe=this.getCombinedIconPrimary(qe,S,Be,c,g,{sortKey:void 0,text:void 0,icon:null,index:re.featureIndex,sourceLayerIndex:re.featureIndex,geometry:[],properties:ge.properties,type:"Point",id:ge.id},Z);if(!Qe)continue;const vt=Qe.toString(),mt=this.iconAtlasPositions&&this.iconAtlasPositions.get(vt);if(mt){const jt=S.getAppearanceValueAndResolveTokens(qe,"icon-offset",Be,c,g),At=jt&&Array.isArray(jt)?jt:[0,0];let Pt=iL(mt,void 0,At,S.layout.get("icon-anchor").evaluate(Be,{},c));const Qt=S.getAppearanceValueAndResolveTokens(qe,"icon-rotate",Be,c,g),Ft=typeof Qt=="number"?Qt:0,sr=mt.sdf,dr=S.layout.get("icon-text-fit").constantOr("none");dr!=="none"&&ge.textShaping&&ge.iconTextFitPadding&&ge.fontScale&&(Pt=ule(Pt,ge.textShaping,dr,ge.iconTextFitPadding,At,ge.fontScale));const ur=this.calculateEffectiveAppearanceIconSize(qe,_.zoom,Be,c,g,Z),yr=0,_r=1+(Math.min(Px,Math.round(ur*Kp))<<1),mr=fle(Pt,Ft,sr,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 vt=ge.layoutBasedVertexData.length/12;for(let mt=0;mt0||ee>0,Se=re>0,Ne=this.elevationFeatures[z.elevationFeatureIndex];if(Ne){const Be=new or(z.tileAnchorX,z.tileAnchorY),qe=.075+Ne.pointElevation(Be);z.zOffset!==qe&&(h=!0,z.zOffset=qe),qe!==0&&(this.hasAnyZOffset=!0);const Qe=Ne.computeSlopeNormal(Be,_),vt=ns(st(),oe(0,0,1),Qe);Ve($,$,vt),Ve(K,K,vt),$[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&&(fL(this.text.orientationVertexArray,Z,$,K),fL(this.text.orientationVertexArray,ee,$,K)),Se){const{placedIconSymbolIndex:Be,verticalPlacedIconSymbolIndex:qe}=z;Be>=0&&fL(this.icon.orientationVertexArray,re,$,K),qe>=0&&fL(this.icon.orientationVertexArray,ae,$,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=$be(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,ae,ge,Se,Ne,Be){const qe=c.indexArray,Qe=c.layoutVertexArray,vt=c.globeExtVertexArray,mt=c.segments.prepareSegment(4*Be,Qe,qe,this.canOverlap?C.sortKey:void 0),jt=this.glyphOffsetArray.length,At=mt.vertexLength,Pt=this.allowVerticalPlacement&&L===$u.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=hle(this.textSizeData,c,S)/kl;return this.tilePixelRatio*C}getSymbolInstanceIconSize(c,h,g){const _=this.icon.placedSymbolArray.get(g),S=hle(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 p?String(p[g]):"")}let qbe,Vbe,ble;as(gL,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),gL.addDynamicAttributes=p4;class Hbe{constructor(c){this.type=c.property.overrides?c.property.overrides.runtimeType:Gh,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}}as(Hbe,"FormatSectionOverride",{omit:["defaultValue"]});const wle=()=>ble||(ble={layout:qbe||(qbe=new ao({"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 Fr(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 Fr(Bt.layout_symbol["icon-size"]),"icon-size-scale-range":new Sr(Bt.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Fr(Bt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Fr(Bt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Fr(Bt.layout_symbol["icon-image"]),"icon-image-use-theme":new Sr({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new Fr(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 Fr(Bt.layout_symbol["icon-offset"]),"icon-anchor":new Fr(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 Fr(Bt.layout_symbol["text-field"]),"text-font":new Fr(Bt.layout_symbol["text-font"]),"text-size":new Fr(Bt.layout_symbol["text-size"]),"text-size-scale-range":new Sr(Bt.layout_symbol["text-size-scale-range"]),"text-max-width":new Fr(Bt.layout_symbol["text-max-width"]),"text-line-height":new Fr(Bt.layout_symbol["text-line-height"]),"text-letter-spacing":new Fr(Bt.layout_symbol["text-letter-spacing"]),"text-justify":new Fr(Bt.layout_symbol["text-justify"]),"text-radial-offset":new Fr(Bt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Sr(Bt.layout_symbol["text-variable-anchor"]),"text-anchor":new Fr(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 Fr(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 Fr(Bt.layout_symbol["text-transform"]),"text-offset":new Fr(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:Vbe||(Vbe=new ao({"icon-opacity":new Fr(Bt.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Fr(Bt.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Fr(Bt.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Fr(Bt.paint_symbol["text-emissive-strength"]),"icon-color":new Fr(Bt.paint_symbol["icon-color"]),"icon-halo-color":new Fr(Bt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Fr(Bt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Fr(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 Fr(Bt.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Fr(Bt.paint_symbol["text-occlusion-opacity"]),"text-color":new Fr(Bt.paint_symbol["text-color"],{runtimeType:Gd,getOverride:p=>p.textColor,hasOverride:p=>!!p.textColor}),"text-halo-color":new Fr(Bt.paint_symbol["text-halo-color"]),"text-halo-width":new Fr(Bt.paint_symbol["text-halo-width"]),"text-halo-blur":new Fr(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 Fr(Bt.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Fr({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Fr({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Fr({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Fr({type:"string",default:"default","property-type":"data-driven"})}))},ble);class xL extends Sd{constructor(c,h,g,_){super(c,wle(),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=Oi(S),C=aa(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,ae=z-L;return T($,[ae,0,0,0,0,ae,0,0,0,0,ae,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()||s_(C.value)||!S?S:Ube(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()||s_(z.value)||!L||typeof L!="string"?L:Ube(g.properties,L)}createBucket(c){return new gL(c)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const c of wle().paint.overridableProperties){if(!xL.hasPaintOverride(this.layout,c))continue;const h=this.paint.get(c),g=new Hbe(h),_=new bN(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 _x("composite",_,h.value.zoomStops,h.value.interpolationType),this.paint._values[c]=new wx(h.property,S,h.parameters)}}_handleOverridablePaintPropertyUpdate(c,h,g){return!(!this.layout||h.isDataDriven()||g.isDataDriven())&&xL.hasPaintOverride(this.layout,c)}static hasPaintOverride(c,h){const g=c.get("text-field"),_=wle().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 wd)C(g.value.value.sections);else if(g.value.kind==="source"){const L=$=>{S||($ instanceof Ip&&jl($.value)===Uv?C($.value.sections):$ instanceof Dm?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 dg(this,{zoom:h,lut:g}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let Wbe,Gbe,Kbe,Zbe;var jle=Un([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function yL(p,c,h,g,_,S,C,L){const z=[p,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 Ybe(p,c,h,g,_,S,C,L){const z=function($,K,Z,ee,re,ae,ge,Se){const Ne=yL(0,0,1,0,1,1,0,1),Be=yL($,K,Z,ee,re,ae,ge,Se);return b(Be,Be,v([],Ne))}(p,c,h,g,_,S,C,L);return[z[2]/z[8]/Ar,z[5]/z[8]/Ar]}function vL(p){return[p[0],Math.min(Math.max(p[1],-pe),pe)]}class Xbe extends Rn{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 Lr("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,Ap.Image),(g,_)=>{this._imageRequest=null,this._loaded=!0,g?this.fire(new on(g)):_&&(this.image=_ instanceof HTMLImageElement?Qo.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 NM(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 Lr("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 NM||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]pe?this.onNorthPole=!0:_<-pe&&(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 ae=Math.floor((L+$)/2*re);return ae>1&&(ae-=1),new ti(ee,ae,Math.floor((z+K)/2*re))}(S),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Lr("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof NM||(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 Be=this.tiles[Ne];Be.state!=="loaded"&&(Be.state="loaded",Be.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const h=LM(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 Be=Ne[1].x-Ne[0].x,qe=Ne[1].y-Ne[0].y,Qe=Ne[2].x-Ne[1].x,vt=Ne[2].y-Ne[1].y,mt=Ne[3].x-Ne[2].x,jt=Ne[3].y-Ne[2].y,At=Ne[0].x-Ne[3].x,Pt=Ne[0].y-Ne[3].y,Qt=Be*vt-Qe*qe,Ft=Qe*jt-mt*vt,sr=mt*Pt-At*jt,dr=At*qe-Be*Pt;return Qt>0&&Ft>0&&sr>0&&dr>0||Qt<0&&Ft<0&&sr<0&&dr<0}(g))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const _=LM(this.tileID,this.map.transform.projection),[S,C,L,z]=this.coordinates.map(Ne=>{const Be=_.projection.project(Ne[0],Ne[1]);return Dbe(_,Be)._round()});this.perspectiveTransform=Ybe(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($,jle.members),this.boundsSegments=Vi.simpleSegment(0,0,4,2);const K=[],Z=[vL((ee=this.coordinates)[0]),vL(ee[1]),vL(ee[2]),vL(ee[3])];var ee;const[re,ae,ge,Se]=function(Ne){let Be=Ne[0][0],qe=Be,Qe=Ne[0][1],vt=Qe;for(let mt=1;mtqe&&(qe=Ne[mt][0]),Ne[mt][1]vt&&(vt=Ne[mt][1]);return[Be,Qe,qe-Be,vt-Qe]}(Z);{const Ne=new _0,[Be,qe,Qe,vt]=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-Be)/Qe,(mr.y-qe)/vt],[jt,At,Pt,Qt]=g.map(mt),Ft=function(mr,gr,rr,Jt,xr,Er,jr,bs){const Gr=yL(0,0,1,0,1,1,0,1);return b(Gr,Gr,v([],yL(mr,gr,rr,Jt,xr,Er,jr,bs)))}(jt[0],jt[1],At[0],At[1],Pt[0],Pt[1],Qt[0],Qt[1]);this.elevatedGlobePerspectiveTransform=Ybe(jt[0],jt[1],At[0],At[1],Pt[0],Pt[1],Qt[0],Qt[1]);const sr=(mr,gr)=>{K.push(mr.lng);const rr=Math.round((mr.lng-re)/ge*Ar),Jt=Math.round((mr.lat-ae)/Se*Ar),xr=mt(gr),Er=le([],[xr[0],xr[1],1],Ft),jr=Math.round(Er[0]/Er[2]*Ar),bs=Math.round(Er[1]/Er[2]*Ar);Ne.emplaceBack(rr,Jt,jr,bs)},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 bs=jr/64,Gr={x:rr[0]+xr*bs,y:rr[1]+Er*bs};sr(h.projection.unproject(Gr.x,Gr.y),Gr)}}this.elevatedGlobeVertexBuffer=c.createVertexBuffer(Ne,jle.members)}{this.maxLongitudeTriangleSize=0;let Ne=[],Be=new Jo;const qe=(Qe,vt,mt)=>{Be.emplaceBack(Qe,vt,mt);const jt=K[Qe],At=K[vt],Pt=K[mt],Qt=Math.min(Math.min(jt,At),Pt),Ft=Math.max(Math.max(jt,At),Pt)-Qt;Ft>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=Ft),Ne.push(Qt+Ft/2)};for(let Qe=0;Qe<64;Qe++)for(let vt=0;vt<64;vt++){const mt=65*Qe+vt,jt=mt+1,At=mt+65,Pt=At+1;qe(mt,At,jt),qe(jt,At,Pt)}[Ne,Be]=function(Qe,vt){const mt=Array.from({length:Qe.length},(Pt,Qt)=>Qt);mt.sort((Pt,Qt)=>Qe[Pt]-Qe[Qt]);const jt=[],At=new Jo;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=Li(g,0,g.length,_+z);return Z===g.length||L(Z,Eo(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 Sle{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=Re(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 di(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),Z,g))continue;const ee={id:K,sourceLayerIndex:$,index:z,geometry:S?Z.geometry:Ct(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*Ae(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(V6(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),Be=Math.floor($.float32[ae+1]);let qe=!1;for(const Qe of this.activeReplacements)if(!Gve(Qe,g,a2e.Model,_)&&!(Qe.min.x>Ne||Ne>Qe.max.x||Qe.min.y>Be||Be>Qe.max.y)&&(qe=Qve(Xve(Ne,Be,c.canonical,Qe.footprintTileId.canonical),Qe.footprint),qe))break;$.float32[ae]=qe?ge+Ar:ge,C=C||qe!==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,nWe.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;(Nle(S,!1)||this.styleDefinedModelURLs[S]!==void 0)&&(this.modelUris.includes(S)||this.modelUris.push(S)),this.instancesPerModel[S]||(this.instancesPerModel[S]=new o2e);const C=this.instancesPerModel[S],L=C.instancedDataArray,z=new i2e(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,ae),this.maxScale=Math.max(Math.max(this.maxScale,$[0]),Math.max($[1],$[2])),F_e(ee,z,$);const ge=Math.round(100*Z.a)+Z.b/1.05;for(let Se=0;Se10?this.tileToMeter:Re(L,vt)),qe[Be+4]=K[0],qe[Be+5]=K[1],qe[Be+6]=K[2]+Qe,qe[Be+7]=ee[0],qe[Be+8]=ee[1],qe[Be+9]=ee[2],qe[Be+10]=ee[4],qe[Be+11]=ee[5],qe[Be+12]=ee[6],qe[Be+13]=ee[8],qe[Be+14]=ee[9],qe[Be+15]=ee[10],g.instancesEvaluatedElevation[Ne]=K[2]}}}let l2e,c2e;as(Sle,"ModelBucket",{omit:["layers"]}),as(o2e,"PerModelAttributes"),as(i2e,"ModelFeature");class f4{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|=i4.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,_&&(this.modelTraits|=i4.HasMapboxMeshFeatures),S&&(this.modelTraits|=i4.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 m2e($)),u2e($,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(_):Xoe(_,c,!0)}for(const g of h)rL(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||UM(g.paint.get("model-color").value,C)||UM(g.paint.get("model-color-mix-intensity").value,C)||UM(g.paint.get("model-roughness").value,C)||UM(g.paint.get("model-emissive-strength").value,C)||UM(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=Cle[_r],gr=Math.abs(mr);gr>Ft&&(Qt=mr,Ft=gr,sr=yr,dr=ur)}if(Ft>.1){const ur=1-(mt+.5*Math.abs(sr*dr))/ae;let yr=h._dem.get(At,jt)+Qt*ur;const _r=h._dem.get(At+sr,jt+dr),mr=h._dem.get(At-sr,jt-dr,!0);(yr-_r)*(yr-mr)>0&&(yr=(_r+mr)/2),Cle[Pt]=h._dem.set(At,jt,yr),N_[Pt]=mt}}}}}L&&(h._demTile.needsDEMTextureUpload=!0,h._dem._timestamp=Qo.now())}setFilter(c){this.filter=c?AN(c):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(c=>this.filter.filter(new di(this.id.overscaledZ,{worldview:this.worldview}),c.feature,this.id.canonical)):this.nodesInfo}destroy(){const c=this.getNodesInfo();for(const h of c)rL(h.node),Qoe(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]};E(S,C.node.globalMatrix),_[0]=c,_[1]=h,et(_,_,S);const $=(_[0]-L.aabb.min[0])/(L.aabb.max[0]-L.aabb.min[0])*w_|0,K=Math.min(63,(_[1]-L.aabb.min[1])/(L.aabb.max[1]-L.aabb.min[1])*w_|0)*w_+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 UM(p,c){return p instanceof g0&&!p.isLightConstant&&c}function DGe(p,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=Us(z,255*h[0],h[3]),$=Us($,255*h[1],h[3]),K=Us(K,255*h[2],h[3]));const Z=z<<8|$,ee=K<<8|Math.floor(255*g[3]),re=function(mt){const jt=ye(mt,0,2);return Math.min(Math.round(.5*jt*255),255)}(g[2])<<8|15*g[0]<<4|15*g[1],ae=ye(_[0],0,1),ge=ye(_[1],0,1),Se=ye(_[2],0,1),Ne=ye(_[3],0,1);let Be,qe,Qe,vt;if(ae!==ge&&C!==S&&ge!==ae){const mt=C-S;qe=1/(mt*(ge-ae)),Qe=-(S+mt*ae)/(mt*(ge-ae));const jt=ye(_[4],-1,1);vt=Math.pow(10,jt),Be=255*Se<<8|255*Ne}else Be=65535,qe=0,Qe=1,vt=1;if(p.emplaceBack(Z,ee,re,Be,qe,Qe,vt),L){const mt=L.length;L.clear();for(let jt=0;jt>16&65535,K=S?z>>16&65535:65535&z,Z=(15&K)<8?15&K:0,ee=p.evaluatedRMEA[Z],re=p.evaluatedColor[Z],ae=p.emissionHeightBasedParams[Z];let ge;if(L&&Z===2&&g.lights&&(ge=new $N,ge.resize(10*g.lights.length)),DGe(C.featureArray,$,re,ee,ae,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(),_++}}as(bL,"Tiled3dModelBucket",{omit:["layers"]}),as(m2e,"Tiled3dModelFeature");const FGe=["id","tile","layer","source","sourceLayer","state"];class S_{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 S_(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 FGe)this[h]!==void 0&&(c[h]=this[h]);return c}}class C_ extends Rn{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 f(g.position[0],g.position[1]):new f(0,0),S.orientation=g.orientation!=null?g.orientation:[0,0,0],_.modelSpec=g,C_.applyModelSpecification(S,g),S.computeBoundsAndApplyParent(),this.models.push(S)}else{const S=L_e(this.map._requestManager.transformRequest(g.uri,Ap.Model).url).then(C=>{if(!C)return;const L=ele(C),z=new z_e(h,g.uri,g.position,g.orientation,L);C_.applyModelSpecification(z,g),z.computeBoundsAndApplyParent(),this.models.push(z),this._modelsInfo.set(h,{modelSpec:g,model:z})}).catch(C=>{this.fire(new on(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 Lr("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(h=>{this._loaded=!0,this.fire(new on(new Error(`Could not load models: ${h.message}`)))})}static applyModelSpecification(c,h){h.nodeOverrides&&C_.convertNodeOverrides(c,h.nodeOverrides),h.materialOverrides&&C_.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 Na(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=Xh(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 Mle(p,c,h,g){const _=1<Qe.polygon).flat());const Se=re?L:null,[Ne,Be]=w_e(S,g,Z,K,$,C,Se,ee,ae,S.center.lat,p.tileID.canonical),qe=p.queryGeometry;return b_e(Ne,Be,qe.isPointQuery()?qe.screenBounds:qe.screenGeometry)}},building:class extends Sd{constructor(p,c,h,g){super(p,{layout:W_e||(W_e=new ao({visibility:new Sr(Bt.layout_building.visibility),"building-facade":new Fr(Bt.layout_building["building-facade"]),"building-facade-floors":new Fr(Bt.layout_building["building-facade-floors"]),"building-facade-unit-width":new Fr(Bt.layout_building["building-facade-unit-width"]),"building-facade-window":new Fr(Bt.layout_building["building-facade-window"]),"building-roof-shape":new Fr(Bt.layout_building["building-roof-shape"]),"building-height":new Fr(Bt.layout_building["building-height"]),"building-base":new Fr(Bt.layout_building["building-base"]),"building-flood-light-wall-radius":new Fr(Bt.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new Fr(Bt.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new Fr(Bt.layout_building["building-flip-roof-orientation"])})),paint:G_e||(G_e=new ao({"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 Fr(Bt.paint_building["building-color"]),"building-emissive-strength":new Fr(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 Fr({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new Fr({type:"string",default:"default","property-type":"data-driven"})}))},c,h,g),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(p){return new H_e(p)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(p){return!0}queryRadius(p){return 0}queryIntersectsFeature(p,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=p.tile.getBucket(this).getFootprint(c);if(Z){if(Z.hiddenFlags!==0)return!1;$=Z.height}const[ee,re]=w_e(S,g,K,$,new or(0,0),C,null,[0,0],1,S.center.lat,p.tileID.canonical),ae=p.queryGeometry;return b_e(ee,re,ae.isPointQuery()?ae.screenBounds:ae.screenGeometry)}},line:class extends Sd{constructor(p,c,h,g){const _=sbe();super(p,_,c,h,g),_.layout&&(this.layout=new jx(_.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(p){if(p==="line-gradient"){const c=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=c._styleExpression&&c._styleExpression.expression instanceof Xv,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(p,c){super.recalculate(p,c),this.paint._values["line-floorwidth"]=(()=>{if(CM)return CM;const h=sbe();return CM=new LWe(h.paint.properties["line-width"].specification),CM.useIntegerZoom=!0,CM})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,p)}createBucket(p){return new sle(p)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(p,c,h){const g=tbe(this);return{config:new dg(this,{zoom:c,lut:h}),defines:g,overrideFog:!1}}queryRadius(p){const c=p,h=nbe(Rc("line-width",this,c),Rc("line-gap-width",this,c)),g=Rc("line-offset",this,c);return h/2+Math.abs(g)+Kl(this.paint.get("line-translate"))}queryIntersectsFeature(p,c,h,g,_,S){if(p.queryGeometry.isAboveHorizon)return!1;const C=zu(p.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),S.angle,p.pixelToTileUnitsFactor),L=p.pixelToTileUnitsFactor/2*nbe(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 ae=$[re],ge=[];for(let Se=0;Se=3){for(let ae=0;ae>16&255)/255,(p>>8&255)/255,(255&p)/255,1)}function JGe(p,c,h){p===1?(c.rgb_color=NL(h.readVarint()),c.paint="rgb_color"):p===2?(c.linear_gradient_idx=h.readVarint(),c.paint="linear_gradient_idx"):p===3?(c.radial_gradient_idx=h.readVarint(),c.paint="radial_gradient_idx"):p===5?h.readPackedFloat(c.dasharray):p===6?c.dashoffset=h.readFloat():p===7?c.miterlimit=h.readFloat():p===8?c.opacity=h.readVarint():p===9?c.width=h.readFloat():p===10?c.linecap=h.readVarint():p===11&&(c.linejoin=h.readVarint())}function eKe(p,c,h){p===1?c.transform=kL(h,h.readVarint()+h.pos):p===2?c.spread_method=h.readVarint():p===3?c.stops.push(x2e(h,h.readVarint()+h.pos)):p===4?c.x1=h.readFloat():p===5?c.y1=h.readFloat():p===6?c.x2=h.readFloat():p===7&&(c.y2=h.readFloat())}function x2e(p,c){return p.readFields(tKe,{offset:0,opacity:255,rgb_color:Tle},c)}function tKe(p,c,h){p===1?c.offset=h.readFloat():p===2?c.opacity=h.readVarint():p===3&&(c.rgb_color=NL(h.readVarint()))}function rKe(p,c,h){p===1?c.transform=kL(h,h.readVarint()+h.pos):p===2?c.spread_method=h.readVarint():p===3?c.stops.push(x2e(h,h.readVarint()+h.pos)):p===4?c.cx=h.readFloat():p===5?c.cy=h.readFloat():p===6?c.r=h.readFloat():p===7?c.fx=h.readFloat():p===8?c.fy=h.readFloat():p===9&&(c.fr=h.readFloat())}function sKe(p,c,h){p===1?c.transform=kL(h,h.readVarint()+h.pos):p===2?c.clip_path_idx=h.readVarint():p===3&&c.children.push(jL(h,h.readVarint()+h.pos))}function nKe(p,c,h){p===1?c.left=c.top=h.readFloat():p===2?c.width=c.height=h.readFloat():p===3?c.top=h.readFloat():p===4?c.height=h.readFloat():p===5?c.mask_type=h.readVarint():p===6?c.mask_idx=h.readVarint():p===7&&c.children.push(jL(h,h.readVarint()+h.pos))}class aKe{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 Na(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 g4(p,c=255,h){const g=c/255,_=p.toString(),S=h.has(_)?h.get(_).clone():p.clone();return S.a*=g,S.toString()}function VM(p,c){if(!mh()){const h=document.createElement("canvas");return h.width=p,h.height=c,h}return new OffscreenCanvas(p,c)}let Ile,HM=null;function Ple(p,c,h,g,_){for(const S of g.children)y2e(p,c,h,S,_)}function y2e(p,c,h,g,_){g.group?(p.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=x4(z.transform).preMultiplySelf(C)),!function(ae,ge,Se){return ae.opacity!==255||ge||Se}(z,Z!=null,K!=null))return void Ple(S,C,L,z,$);const ee=VM(S.canvas.width,S.canvas.height),re=ee.getContext("2d");Ple(re,C,L,z,$),Z&&N2e(re,C,L,Z),K&&S2e(re,C,L,K,$),S.globalAlpha=z.opacity/255,S.drawImage(ee,0,0)}(p,c,h,g.group,_),p.restore()):g.path&&(p.save(),function(S,C,L,z,$){S.setTransform(C),z.paint_order===$Ge.PAINT_ORDER_FILL_AND_STROKE?(v2e(S,L,z,$),b2e(S,L,z,$)):(b2e(S,L,z,$),v2e(S,L,z,$))}(p,c,h,g.path,_),p.restore())}function v2e(p,c,h,g){const _=h.fill;if(!_)return;const S=_.opacity/255;switch(p.save(),p.beginPath(),C2e(h,p),_.paint){case"rgb_color":p.fillStyle=g4(_.rgb_color,_.opacity,g);break;case"linear_gradient_idx":{const C=c.linear_gradients[_.linear_gradient_idx];C.transform&&p.setTransform(x4(C.transform).preMultiplySelf(p.getTransform())),p.fillStyle=w2e(p,C,S,g);break}case"radial_gradient_idx":{const C=c.radial_gradients[_.radial_gradient_idx];C.transform&&p.setTransform(x4(C.transform).preMultiplySelf(p.getTransform())),p.fillStyle=j2e(p,C,S,g)}}p.fill(_2e(h)),p.restore()}function _2e(p){return p.rule===Ale.PATH_RULE_NON_ZERO?"nonzero":p.rule===Ale.PATH_RULE_EVEN_ODD?"evenodd":void 0}function b2e(p,c,h,g){const _=h.stroke;if(!_)return;const S=M2e(h);p.lineWidth=_.width,p.miterLimit=_.miterlimit,p.setLineDash(_.dasharray),p.lineDashOffset=_.dashoffset;const C=_.opacity/255;switch(_.paint){case"rgb_color":p.strokeStyle=g4(_.rgb_color,_.opacity,g);break;case"linear_gradient_idx":p.strokeStyle=w2e(p,c.linear_gradients[_.linear_gradient_idx],C,g,!0);break;case"radial_gradient_idx":p.strokeStyle=j2e(p,c.radial_gradients[_.radial_gradient_idx],C,g,!0)}switch(_.linejoin){case wL.LINE_JOIN_MITER_CLIP:case wL.LINE_JOIN_MITER:p.lineJoin="miter";break;case wL.LINE_JOIN_ROUND:p.lineJoin="round";break;case wL.LINE_JOIN_BEVEL:p.lineJoin="bevel"}switch(_.linecap){case Ele.LINE_CAP_BUTT:p.lineCap="butt";break;case Ele.LINE_CAP_ROUND:p.lineCap="round";break;case Ele.LINE_CAP_SQUARE:p.lineCap="square"}p.stroke(S)}function w2e(p,c,h,g,_=!1){if(c.stops.length===1){const ee=c.stops[0];return g4(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=x4(c.transform);$=ee.transformPoint($),K=ee.transformPoint(K)}const Z=p.createLinearGradient($.x,$.y,K.x,K.y);for(const ee of c.stops)Z.addColorStop(ee.offset,g4(ee.rgb_color,ee.opacity*h,g));return Z}function j2e(p,c,h,g,_=!1){if(c.stops.length===1){const Ne=c.stops[0];return g4(Ne.rgb_color,Ne.opacity*h,g)}const S=x4(c.transform),{fx:C,fy:L,fr:z,cx:$,cy:K,r:Z}=c;let ee=new DOMPoint(C,L),re=new DOMPoint($,K),ae=z,ge=Z;if(_){ee=S.transformPoint(ee),re=S.transformPoint(re);const Ne=(S.a+S.d)/2;ae=z*Ne,ge=c.r*Ne}const Se=p.createRadialGradient(ee.x,ee.y,ae,re.x,re.y,ge);for(const Ne of c.stops)Se.addColorStop(Ne.offset,g4(Ne.rgb_color,Ne.opacity*h,g));return Se}function k2e(p,c,h,g){const _=g.transform?x4(g.transform).preMultiplySelf(c):c,S=VM(p.canvas.width,p.canvas.height),C=S.getContext("2d");for(const z of g.children)if(z.group)k2e(C,_,h,z.group);else if(z.path){const $=z.path,K=new Path2D;K.addPath(M2e($),_),C.fill(K,_2e($))}const L=g.clip_path_idx!=null?h.clip_paths[g.clip_path_idx]:null;L&&N2e(C,_,h,L),p.globalCompositeOperation="source-over",p.drawImage(S,0,0)}function N2e(p,c,h,g){const _=VM(p.canvas.width,p.canvas.height);k2e(_.getContext("2d"),c,h,g),p.globalCompositeOperation="destination-in",p.drawImage(_,0,0)}function S2e(p,c,h,g,_){if(g.children.length===0)return;const S=g.mask_idx!=null?h.masks[g.mask_idx]:null;S&&S2e(p,c,h,S,_);const C=p.canvas.width,L=p.canvas.height,z=VM(C,L),$=z.getContext("2d"),K=g.width,Z=g.height,ee=g.left,re=g.top,ae=new Path2D,ge=new Path2D;ge.rect(ee,re,K,Z),ae.addPath(ge,c),$.clip(ae);for(const Be of g.children)y2e($,c,h,Be,_);const Se=$.getImageData(0,0,C,L),Ne=Se.data;if(g.mask_type===p2e.MASK_TYPE_LUMINANCE)for(let Be=0;Bec[C])return null}else{const L=1/g[C];let z=(p[C]-h[C])*L,$=(c[C]-h[C])*L;if(z>$){const K=z;z=$,$=K}if(z>_&&(_=z),$S)return null}return _}function E2e(p,c,h,g,_,S,C,L,z,$,K){const Z=g-p,ee=_-c,re=S-h,ae=C-p,ge=L-c,Se=z-h,Ne=K[1]*Se-K[2]*ge,Be=K[2]*ae-K[0]*Se,qe=K[0]*ge-K[1]*ae,Qe=Z*Ne+ee*Be+re*qe;if(Math.abs(Qe)<1e-15)return null;const vt=1/Qe,mt=$[0]-p,jt=$[1]-c,At=$[2]-h,Pt=(mt*Ne+jt*Be+At*qe)*vt;if(Pt<0||Pt>1)return null;const Qt=jt*re-At*ee,Ft=At*Z-mt*re,sr=mt*ee-jt*Z,dr=(K[0]*Qt+K[1]*Ft+K[2]*sr)*vt;return dr<0||Pt+dr>1?null:(ae*Qt+ge*Ft+Se*sr)*vt}function I2e(p,c,h){return(p-c)/(h-c)}function P2e(p,c,h,g,_,S,C,L,z){const $=1<{const Be=Se?1:0,qe=(re+1)*ge-Be,Qe=ae*ge,vt=(ae+1)*ge-Be;Ne[0]=re*ge,Ne[1]=Qe,Ne[2]=qe,Ne[3]=vt};let Z=new T2e(z);const ee=[];for(let re=0;re=1;z/=2){const re=L[L.length-1];Z=new T2e(z);for(let ae=0;ae0;){const{idx:ae,t:ge,nodex:Se,nodey:Ne,depth:Be}=re.pop();if(this.leaves[ae]){P2e(Se,Ne,Be,c,h,g,_,Z,ee);const Qe=1<=_r[2])return ge}continue}let qe=0;for(let Qe=0;Qe=$[K[At]]&&(K.splice(At,0,Qe),jt=!0);jt||(K[qe]=Qe),qe++}}for(let Qe=0;Qe=this.dim+1||h<-1||h>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(h+1)*this.stride+(c+1)}static pack(c,h){const g=[0,0,0,0],_=CL.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 Tve({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&p[c]);return p}function vKe(p,c){switch(c){case"uint32":return p;case"uint16":for(let h=0;h>4|(61440&g)>>8|(240&_)<<4|61440&_,p[h+1]=15&g|(3840&g)>>4|(15&_)<<8|(3840&_)<<4}return p;case"uint8":for(let h=0;h>6|(192&_)>>4|(192&S)>>2|192&C,p[h+1]=(48&g)>>4|(48&_)>>2|48&S|(48&C)<<2,p[h+2]=(12&g)>>2|12&_|(12&S)<<2|(12&C)<<4,p[h+3]=3&g|(3&_)<<2|(3&S)<<4|(3&C)<<6}return p;default:throw new Error(`Invalid pixel format, "${c}"`)}}as(CL,"DEMData"),as(L2e,"DemMinMaxQuadTree",{omit:["dem"]});var tm=Uint8Array,WM=Uint16Array,_Ke=Int32Array,D2e=new tm([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]),R2e=new tm([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]),bKe=new tm([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),F2e=function(p,c){for(var h=new WM(31),g=0;g<31;++g)h[g]=c+=1<>1|(21845&hl)<<1;$2e[hl]=((65280&(y4=(61680&(y4=(52428&y4)>>2|(13107&y4)<<2))>>4|(3855&y4)<<4))>>8|(255&y4)<<8)>>1}var GM=function(p,c,h){for(var g=p.length,_=0,S=new WM(c);_>z]=$;return C},KM=new tm(288);for(hl=0;hl<144;++hl)KM[hl]=8;for(hl=144;hl<256;++hl)KM[hl]=9;for(hl=256;hl<280;++hl)KM[hl]=7;for(hl=280;hl<288;++hl)KM[hl]=8;var U2e=new tm(32);for(hl=0;hl<32;++hl)U2e[hl]=5;var kKe=GM(KM,9),NKe=GM(U2e,5),Ole=function(p){for(var c=p[0],h=1;hc&&(c=p[h]);return c},Yp=function(p,c,h){var g=c/8|0;return(p[g]|p[g+1]<<8)>>(7&c)&h},Dle=function(p,c){var h=c/8|0;return(p[h]|p[h+1]<<8|p[h+2]<<16)>>(7&c)},SKe=["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"],Xp=function(p,c,h){var g=new Error(c||SKe[p]);if(g.code=p,Error.captureStackTrace&&Error.captureStackTrace(g,Xp),!h)throw g;return g},CKe=new tm(0),MKe=typeof TextDecoder<"u"&&new TextDecoder;try{MKe.decode(CKe,{stream:!0})}catch{}const TKe={gzip_data:"gzip"};class Hm extends Error{constructor(c){super(c),this.name="MRTError"}}const AKe={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},q2e={uint32:1,uint16:2,uint8:4},EKe={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let Rle;class ML{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 Hm(`Layer '${c}' not found`);return h}getHeaderLength(c){const h=new Uint8Array(c),g=new DataView(c);if(h[0]!==13)throw new Hm("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 Rle(h.subarray(0,g)).readFields(cKe,{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 Hm(`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 V2e(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 H2e(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 V2e{constructor({version:c,name:h,units:g,tileSize:_,pixelFormat:S,buffer:C,dataIndex:L},z){if(this.version=c,this.version!==1)throw new Hm(`Cannot parse raster layer encoded with MRT version ${c}`);this.name=h,this.units=g,this.tileSize=_,this.buffer=C,this.pixelFormat=AKe[S],this.dataIndex=L,this.bandShape=[_+2*C,_+2*C,q2e[this.pixelFormat]],this._decodedBlocks=new SL(z?z.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return q2e[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 Hm(`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 Hm(`Band not found: ${JSON.stringify(c)}`);const _=this._decodedBlocks.get(h.toString());if(!_)throw new Hm(`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}}}ML.setPbf=function(p){Rle=p};class H2e{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)}}ML.performDecoding=function(p,c){const h=new Uint8Array(p);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 ae;if(Z!=="gzip_data")throw new Hm(`Unhandled codec: ${Z}`);return ae=function(ge,Se){if(!globalThis.DecompressionStream&&Se==="gzip_data")return Promise.resolve(((Qe=function(jt){jt[0]==31&&jt[1]==139&&jt[2]==8||Xp(6,"invalid gzip data");var At=jt[3],Pt=10;4&At&&(Pt+=2+(jt[10]|jt[11]<<8));for(var Qt=(At>>3&1)+(At>>4&1);Qt>0;Qt-=!jt[Pt++]);return Pt+(2&At)}(qe=ge))+8>qe.length&&Xp(6,"invalid gzip data"),function(jt,At,Pt,Qt){var Ft=jt.length;if(!Ft||At.f&&!At.l)return Pt||new tm(0);var sr=!Pt,dr=sr||At.i!=2,ur=At.i;sr&&(Pt=new tm(3*Ft));var yr,_r,mr=function(Ya){var Ca=Pt.length;if(Ya>Ca){var Ia=new tm(Math.max(2*Ca,Ya));Ia.set(Pt),Pt=Ia}},gr=At.f||0,rr=At.p||0,Jt=At.b||0,xr=At.l,Er=At.d,jr=At.m,bs=At.n,Gr=8*Ft;do{if(!xr){gr=Yp(jt,rr,1);var es=Yp(jt,rr+1,3);if(rr+=3,!es){var hs=jt[(nr=4+((rr+7)/8|0))-4]|jt[nr-3]<<8,kn=nr+hs;if(kn>Ft){ur&&Xp(0);break}dr&&mr(Jt+hs),Pt.set(jt.subarray(nr,kn),Jt),At.b=Jt+=hs,At.p=rr=8*kn,At.f=gr;continue}if(es==1)xr=kKe,Er=NKe,jr=9,bs=5;else if(es==2){var Nr=Yp(jt,rr,31)+257,ps=Yp(jt,rr+10,15)+4,Qs=Nr+Yp(jt,rr+5,31)+1;rr+=14;for(var Zn=new tm(Qs),ra=new tm(19),hn=0;hn>4)<16)Zn[hn++]=nr;else{var Ur=0,qr=0;for(nr==16?(qr=3+Yp(jt,rr,3),rr+=2,Ur=Zn[hn-1]):nr==17?(qr=3+Yp(jt,rr,7),rr+=3):nr==18&&(qr=11+Yp(jt,rr,127),rr+=7);qr--;)Zn[hn++]=Ur}}var ws=Zn.subarray(0,Nr),Cs=Zn.subarray(Nr);jr=Ole(ws),bs=Ole(Cs),xr=GM(ws,jr),Er=GM(Cs,bs)}else Xp(1);if(rr>Gr){ur&&Xp(0);break}}dr&&mr(Jt+131072);for(var cn=(1<>4;if((rr+=15&Ur)>Gr){ur&&Xp(0);break}if(Ur||Xp(2),qn<256)Pt[Jt++]=qn;else{if(qn==256){wn=rr,xr=null;break}var Ds=qn-254;qn>264&&(Ds=Yp(jt,rr,(1<<(ya=D2e[hn=qn-257]))-1)+B2e[hn],rr+=ya);var Ks=Er[Dle(jt,rr)&yn],ma=Ks>>4;if(Ks||Xp(3),rr+=15&Ks,Cs=jKe[ma],ma>3){var ya=R2e[ma];Cs+=Dle(jt,rr)&(1<Gr){ur&&Xp(0);break}dr&&mr(Jt+131072);var va=Jt+Ds;if(Jtyr.length)&&(_r=yr.length),new tm(yr.subarray(0,_r))):Pt.subarray(0,Jt)}(qe.subarray(Qe,-8),{i:2},new tm(((Ne=qe)[(Be=Ne.length)-4]|Ne[Be-3]<<8|Ne[Be-2]<<16|Ne[Be-1]<<24)>>>0))));var Ne,Be,qe,Qe;const vt=TKe[Se];if(!vt)throw new Error(`Unhandled codec: ${Se}`);const mt=new globalThis.DecompressionStream(vt);return new Response(new Blob([ge]).stream().pipeThrough(mt)).arrayBuffer().then(jt=>new Uint8Array(jt))}(ee,Z).then(ge=>(function(Se,Ne){Se.readFields(fKe,Ne)}(new Rle(ge),re),new EKe[L](re.buffer))),ae.then(ge=>{for(let Se=K.length-1;Se>=0;Se--)switch(K[Se]){case"delta_filter":xKe(ge,z);break;case"zigzag_filter":yKe(ge);break;case"bitshuffle_filter":vKe(ge,L);break;default:throw new Hm(`Unhandled filter "${K[Se]}"`)}return{layerName:_,blockIndex:$,data:ge}}).catch(ge=>{throw ge})}))},as(H2e,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),as(ML,"MapboxRasterTile"),as(V2e,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class W2e{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 Ht(new nL(this.rawTileData)).layers,this.sourceLayerCoder=new W2e(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,Be)=>Cd(g.bufferedTilespaceGeometry,ge-$,Se-$,Ne+$,Be+$));Z.sort(IKe);let ee=null;_.elevation&&Z.length>0&&(ee=f4.create(_.elevation,this.tileID));const re={};let ae;for(let ge=0;ge(Be||(Be=Ct(qe,this.tileID.canonical,S)),Qe.queryIntersectsFeature(g,qe,vt,Be,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&&!Qr(re,Z))return;const ae=g.sourceCache,ge=this.sourceLayerCoder.decode($),Se=this.vtLayers[ge].feature(L),Ne=this.getId(Se,ge);for(let Be=0;Be`${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 K2e(p,c,h,g,_){return Wt(p,(S,C)=>{const L=c instanceof jx?c.get(C):null;return L&&L.evaluate?L.evaluate(h,g,void 0,_):L})}function IKe(p,c){return c-p}as(G2e,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const Z2e=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Fle{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=Z2e[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 Fle(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=Z2e.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 zle(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],Be=C[2*Se+1];Ne>=c&&Ne<=g&&Be>=h&&Be<=_&&$.push(S[Se])}continue}const re=ee+Z>>1,ae=C[2*re],ge=C[2*re+1];ae>=c&&ae<=g&&ge>=h&&ge<=_&&$.push(S[re]),(K===0?c<=ae:h<=ge)&&(z.push(ee),z.push(re-1),z.push(1-K)),(K===0?g>=ae:_>=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++)X2e(S[2*Se],S[2*Se+1],c,h)<=$&&z.push(_[Se]);continue}const re=ee+Z>>1,ae=S[2*re],ge=S[2*re+1];X2e(ae,ge,c,h)<=$&&z.push(_[re]),(K===0?c-g<=ae:h-g<=ge)&&(L.push(ee),L.push(re-1),L.push(1-K)),(K===0?c+g>=ae:h+g>=ge)&&(L.push(re+1),L.push(Z),L.push(1-K))}return z}}function zle(p,c,h,g,_,S){if(_-g<=h)return;const C=g+_>>1;Y2e(p,c,C,g,_,S),zle(p,c,h,g,C-1,1-S),zle(p,c,h,C+1,_,1-S)}function Y2e(p,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);Y2e(p,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(ZM(p,c,g,h),c[2*_+S]>C&&ZM(p,c,g,_);LC;)z--}c[2*g+S]===C?ZM(p,c,g,z):(z++,ZM(p,c,z,_)),z<=h&&(g=z+1),h<=z&&(_=z-1)}}function ZM(p,c,h,g){Ble(p,h,g),Ble(c,2*h,2*g),Ble(c,2*h+1,2*g+1)}function Ble(p,c,h){const g=p[c];p[c]=p[h],p[h]=g}function X2e(p,c,h,g){const _=p-h,S=c-g;return _*_+S*S}i.$=Zk,i.A=Ep,i.B=Xh,i.C=2,i.D=r4,i.E=Rn,i.F=AM,i.G=jbe,i.H=Kk,i.I=ka,i.J=_6,i.K=_s,i.L=n0,i.M=vN,i.N=r_,i.O=o6,i.P=or,i.Q=s_,i.R=Ap,i.S=TN,i.T=Koe,i.U=ag,i.V=_L,i.W=R5,i.X=c0,i.Y=l0,i.Z=Yv,i._=kd,i.a=function(p){return Dn.API_CDN_URL_REGEX.test(p)},i.a$=me,i.a0=Gs,i.a1=Ll,i.a2=Bm,i.a3=class extends _L{},i.a4=_N,i.a5=i6,i.a6=Bt,i.a7=function(p){const c=p.value;return c?Gs(c)?Nle(c,!0)?[]:[new _L(p.key,c,`invalid url "${c}"`)]:[new _L(p.key,c,`string expected, "${_s(c)}" found`)]:[]},i.a8=g6,i.a9=ao,i.aA=ye,i.aB=T,i.aC=Ke,i.aD=Oc,i.aE=ei,i.aF=B,i.aG=Ge,i.aH=function(p,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[p],3e3)})),()=>{_.result||(_.callbacks=_.callbacks.filter(S=>S!==g),_.callbacks.length||(_.cancel(),delete this.entries[p]))}}},i.aL=function(p,c,h){const g=JSON.stringify(p.request);return p.data&&(this.deduped.entries[g]={result:[null,p.data]}),this.deduped.request(g,{type:"parseTile",isSymbolTile:p.isSymbolTile,zoom:p.tileZoom},_=>{const S=Lu(p.request,(C,L,z)=>{C?_(C):L&&_(null,{rawData:L,vectorTile:h?void 0:new Ht(new nL(L)),responseHeaders:new Map(z.entries())})});return()=>{S.cancel(),_()}},c)},i.aM=function(p){return p?{cacheControl:p.get("Cache-Control"),expires:p.get("Expires")}:{cacheControl:void 0,expires:void 0}},i.aN=bd,i.aO=function(p){Jc++,Jc>Qy&&(p.getActor().send("enforceCacheSizeLimit",Xy),Jc=0)},i.aP=function(p){return p<=1?1:Math.pow(2,Math.floor(Math.log2(p)))},i.aQ=Qi,i.aR=Qbe,i.aS=n2e,i.aT=f,i.aU=Xbe,i.aV=function(p,c){const h=document.createElement("video");h.muted=!0,h.onloadstart=function(){c(null,h)};for(let g=0;g{}}},i.aW=NM,i.aX=C_,i.aY=Lt,i.aZ=LM,i.a_=te,i.aa=Sr,i.ab=class{constructor(p){this.specification=p}possiblyEvaluate(p,c){return nn(p.expression.evaluate(c))}interpolate(p,c,h){return{x:Us(p.x,c.x,h),y:Us(p.y,c.y,h),z:Us(p.z,c.z,h),azimuthal:Us(p.azimuthal,c.azimuthal,h),polar:Us(p.polar,c.polar,h)}}},i.ac=di,i.ad=_x,i.ae=We,i.af=et,i.ag=fe,i.ah=Oe,i.ai=jx,i.aj=M0,i.ak=Us,i.al=Ar,i.am=i5,i.an=Ws,i.ao=Na,i.ap=class{constructor(p){this.specification=p}possiblyEvaluate(p,c){return function([h,g]){const _=nn([1,h,g]);return{x:_.x,y:_.y,z:_.z}}(p.expression.evaluate(c))}interpolate(p,c,h){return{x:Us(p.x,c.x,h),y:Us(p.y,c.y,h),z:Us(p.z,c.z,h)}}},i.aq=function(p,c,h=0,g=!0){const _=new or(h,h),S=p.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(p,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(p.x),L=p.x-C,z=new Qi(_,C,_,Math.floor(L*S),Math.floor(p.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=(p.y*Z-$.tileID.canonical.y)*K.dim,ae=Math.floor(ee),ge=Math.floor(re);return(h?this.exaggeration():1)*Us(Us(K.get(ae,ge),K.get(ae,ge+1),re-ge),Us(K.get(ae+1,ge),K.get(ae+1,ge+1),re-ge),ee-ae)}static getAtTileOffset(p,c,h,g){const _=1<{const L=this.getAtTileOffset(p,_,S,C),z=g.upVector(p.canonical,_.x,_.y);return we(z,z,L*g.upVectorScale(p.canonical,c,h).metersToTile),z}}getForTilePoints(p,c,h,g){if(this.isUsingMockSource())return!1;const _=f4.create(this,p,g);return!!_&&(c.forEach(S=>{S[2]=this.exaggeration()*_.getElevationAt(S[0],S[1],h)}),!0)}getMinMaxForTile(p){if(this.isUsingMockSource())return null;const c=this.findDEMTileFor(p);if(!c||!c.dem)return null;const h=c.dem.tree,g=c.tileID,_=1<0&&(g+=(p[_]-0)*(p[_]-0)),c[_]<0&&(g+=(0-c[_])*(0-c[_]));return g},i.c0=Qve,i.c1=cle,i.c2=Abe,i.c3=xle,i.c4=Fle,i.c5=we,i.c6=Ce,i.c7=dt,i.c8=function(p,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 p[0]=g*z+_*L,p[1]=_*z-g*L,p[2]=S*z+C*L,p[3]=C*z-S*L,p},i.c9=ct,i.cA=he,i.cB=Sa,i.cC=D_e,i.cD=ti,i.cE=mve,i.cF=function(p,c,h,g,_,S,C,L,z){if(z.name==="globe")return mve(p,c,new ti(h,g,_),!1);const $=LM({z:h,x:g,y:_},z);return new ys([(S+$.x/$.scale)*c,c*($.y/$.scale),C],[(S+$.x2/$.scale)*c,c*($.y2/$.scale),L])},i.cG=function(p,c,h){return p[0]=Math.min(c[0],h[0]),p[1]=Math.min(c[1],h[1]),p[2]=Math.min(c[2],h[2]),p[3]=Math.min(c[3],h[3]),p},i.cH=function(p,c,h){return p[0]=Math.max(c[0],h[0]),p[1]=Math.max(c[1],h[1]),p[2]=Math.max(c[2],h[2]),p[3]=Math.max(c[3],h[3]),p},i.cI=function(p){const c=Math.round((p+45+360)%360/90)%4;return mc[c]},i.cJ=pe,i.cK=Ze,i.cL=JN,i.cM=function(p){const c=M(new Float64Array(16));T(c,p.pixelMatrix,p.globeMatrix);const h=[0,vh,0],g=[0,_h,0];return et(h,h,c),et(g,g,c),[h[0]>0&&h[0]<=p.width&&h[1]>0&&h[1]<=p.height&&!Noe(p,new f(p.center.lat,90)),g[0]>0&&g[0]<=p.width&&g[1]>0&&g[1]<=p.height&&!Noe(p,new f(p.center.lat,-90))]},i.cN=function(p,c){const{scale:h}=p.tileTransform,g=h*Ar/(p.tileSize*Math.pow(2,c.zoom-p.tileID.overscaledZ+p.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=Q6,i.cP=ie,i.cQ=O_e,i.cR=function(p){const c=O_e(p,!0);return x([],[c[0],c[1],c[4],c[5]])},i.cS=R,i.cT=Wr,i.cU=D,i.cV=function(p){const{x:c,y:h}=p.point,{lng:g,lat:_}=p._center;return gve(c,h,p.worldSize,g,_)},i.cW=Me,i.cX=Yi,i.cY=Wi,i.cZ=xc,i.c_=yh,i.ca=ja,i.cb=function(p,c){return p[0]=-c[0],p[1]=-c[1],p[2]=-c[2],p[3]=c[3],p},i.cc=ne,i.cd=function(p,c,h,g,_){var S=1/Math.tan(c/2);if(p[0]=S/h,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=S,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[11]=-1,p[12]=0,p[13]=0,p[15]=0,_!=null&&_!==1/0){var C=1/(g-_);p[10]=(_+g)*C,p[14]=2*_*g*C}else p[10]=-1,p[14]=-2*g;return p},i.ce=function(p,c,h,g,_,S,C){var L=1/(c-h),z=1/(g-_),$=1/(S-C);return p[0]=-2*L,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=-2*z,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[10]=2*$,p[11]=0,p[12]=(c+h)*L,p[13]=(_+g)*z,p[14]=(C+S)*$,p[15]=1,p},i.cf=J,i.cg=function(p,c,h){p[4*c+0]=h[0],p[4*c+1]=h[1],p[4*c+2]=h[2],p[4*c+3]=h[3]},i.ch=ZN,i.ci=h_,i.cj=el,i.ck=qm,i.cl=p_,i.cm=$be,i.cn=function(){var p=new m(4);return m!=Float32Array&&(p[1]=0,p[2]=0),p[0]=1,p[3]=1,p},i.co=function(p,c,h){var g=c[0],_=c[1],S=c[2],C=c[3],L=Math.sin(h),z=Math.cos(h);return p[0]=g*z+S*L,p[1]=_*z+C*L,p[2]=g*-L+S*z,p[3]=_*-L+C*z,p},i.cp=function(p,c){return p[0]===c[0]&&p[1]===c[1]&&p[2]===c[2]&&p[3]===c[3]},i.cq=rt,i.cr=function(p){var c=p[0],h=p[1],g=p[2],_=p[3];return Math.sqrt(c*c+h*h+g*g+_*_)},i.cs=$r,i.ct=Ve,i.cu=Io,i.cv=3,i.cw=2,i.cx=7,i.cy=6,i.cz=Ee,i.d=function(p){return Dn.API_TILEJSON_REGEX.test(p)},i.d$=class{constructor(p,c,h,g){this.context=p,this.format=g,this.size=h,this.texture=p.gl.createTexture();const[_,S,C]=this.size,{gl:L}=p;L.bindTexture(L.TEXTURE_3D,this.texture),p.pixelStoreUnpackFlipY.set(!1),p.pixelStoreUnpack.set(1),p.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in c&&c.data&&L.texImage3D(L.TEXTURE_3D,0,this.format,_,S,C,0,Woe(this.format),Goe(this.format),c.data)}bind(p,c){const{context:h}=this,{gl:g}=h;g.bindTexture(g.TEXTURE_3D,this.texture),p!==this.minFilter&&(g.texParameteri(g.TEXTURE_3D,g.TEXTURE_MAG_FILTER,p),g.texParameteri(g.TEXTURE_3D,g.TEXTURE_MIN_FILTER,p),this.minFilter=p),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:p}=this.context;p.deleteTexture(this.texture),this.texture=null}},i.d0=function(p){return p*p*p*p*p},i.d1=F,i.d2=45,i.d3=YN,i.d4=function(p,c,h){const g=Math.sqrt(p*p+c*c+h*h),_=g>0?Math.acos(h/g)*Ni:0;let S=p!==0||c!==0?Math.atan2(-c,-p)*Ni+90:0;return S<0&&(S+=360),[g,S,_]},i.d5=oe,i.d6=nn,i.d7=Re,i.d8=de,i.d9=ys,i.dA=function(p){return p({pluginStatus:Nd,pluginURL:Rp}),CN.on("pluginStateChange",p),p},i.dB=m_,i.dC=class extends Bp{constructor(p){super(p),this.current=XN}set(p,c,h){if(this.fetchUniformLocation(p,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=bo,i.dE=function(p,c,h){const g=M0(h.zoom),_=p.style.map._antialias,S=p.terrain&&p.terrain.exaggeration()>0;return g===0&&!_&&!S},i.dF=function(p){const c=p.pixelsPerMeter,h=c/J(1,p.center.lat),g=M(new Float64Array(16));return P(g,g,[p.point.x,p.point.y,0]),R(g,g,[h,h,c]),Float32Array.from(g)},i.dG=D6,i.dH=function(p){const c=pe-5;p=ye(p,-c,c)/c*90;const h=Math.pow(Math.abs(Math.sin(Ws(p))),3);return Math.round(h*(lM.length-1))},i.dI=function(p,c,h,g){const _=c.getNorth(),S=c.getSouth(),C=c.getWest(),L=c.getEast(),z=1<0){const ae=180/g;b(re,re,[ae/$+1,0,0,0,ae/K+1,0,-.5*ae/Z,.5*ae/ee,1])}return re[2]=z,re[5]=p.x,re[8]=p.y,re},i.dJ=em,i.dK=function(p,c,h){const g=M(new Float64Array(16)),_=(c/(1<({u_matrix:new p_(p),u_texsize:new qm(p),u_pixels_to_tile_units:new QN(p),u_device_pixel_ratio:new el(p),u_width_scale:new el(p),u_floor_width_scale:new el(p),u_image:new ZN(p),u_units_to_pixels:new qm(p),u_tile_units_to_pixels:new el(p),u_alpha_discard_threshold:new el(p),u_trim_offset:new qm(p),u_trim_fade_range:new qm(p),u_trim_color:new YN(p),u_zbias_factor:new el(p),u_tile_to_meter:new el(p),u_ground_shadow_factor:new h_(p),u_pattern_transition:new el(p)}),i.dX=p=>({u_matrix:new p_(p),u_pixels_to_tile_units:new QN(p),u_device_pixel_ratio:new el(p),u_width_scale:new el(p),u_floor_width_scale:new el(p),u_units_to_pixels:new qm(p),u_dash_image:new ZN(p),u_gradient_image:new ZN(p),u_image_height:new el(p),u_texsize:new qm(p),u_tile_units_to_pixels:new el(p),u_alpha_discard_threshold:new el(p),u_trim_offset:new qm(p),u_trim_fade_range:new qm(p),u_trim_color:new YN(p),u_zbias_factor:new el(p),u_tile_to_meter:new el(p),u_ground_shadow_factor:new h_(p)}),i.dY=p=>({u_camera_to_center_distance:new el(p),u_extrude_scale:new QN(p),u_device_pixel_ratio:new el(p),u_matrix:new p_(p),u_inv_rot_matrix:new p_(p),u_merc_center:new qm(p),u_tile_id:new h_(p),u_zoom_transition:new el(p),u_up_dir:new h_(p),u_emissive_strength:new el(p)}),i.dZ=BN,i.d_=qWe,i.da=xe,i.db=function(p){return[Math.pow(p[0],1/2.2),Math.pow(p[1],1/2.2),Math.pow(p[2],1/2.2)]},i.dc=L_e,i.dd=ele,i.de=z_e,i.df=Nle,i.dg=function(p,c){return p.readFields(UGe,{icons:[]},c)},i.dh=K6,i.di=u4,i.dj=ple,i.dk=e0,i.dl=i_,i.dm=Kf,i.dn=fr,i.dp=cr,i.dq=function(p){const c=p.indexOf(Sx);return c>=0?p.slice(0,c):p},i.dr=function(p){return p.indexOf(Sx)>=0},i.ds=function(p){const c=p.lastIndexOf(Sx);return c>=0?p.slice(c+1):""},i.dt=function(p){const c=[],h=p.id;return h===void 0&&c.push({message:`layers.${h}: missing required property "id"`}),p.render===void 0&&c.push({message:`layers.${h}: missing required method "render"`}),p.renderingMode&&p.renderingMode!=="2d"&&p.renderingMode!=="3d"&&c.push({message:`layers.${h}: property "renderingMode" must be either "2d" or "3d"`}),c},i.du=function(p,c,h,g){return p.type==="custom"?new OGe(p,c):new BGe[p.type](p,c,h,g)},i.dv=pr,i.dw=function(p){const c=p.indexOf(Sx);return c>=0?p.slice(c+1):""},i.dx=class extends S_{constructor(p,c){super(p._vectorTileFeature,p._z,p._x,p._y,p.id),p.state&&(this.state=Object.assign({},p.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=p.source,this.sourceLayer=p.sourceLayer,this.layer=p.layer)}toJSON(){const p=super.toJSON();return p.target=this.target,p.namespace=this.namespace,p}},i.dy=CN,i.dz=Pm,i.e=Dn,i.e$=ce,i.e0=vve,i.e1=(p,c,h,g,_,S)=>{const C=p.transform,L=C.projection.name==="globe";let z;if(S.paint.get("circle-pitch-alignment")==="map")if(L){const K=fve(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:p.transform.getCameraToCenterDistance(C.projection),u_matrix:p.translatePosMatrix(c.projMatrix,h,S.paint.get("circle-translate"),S.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Qo.devicePixelRatio,u_extrude_scale:z,u_inv_rot_matrix:aHe,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=p.transform,Z=K.pitch<15?Q_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:ebe(p,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:J_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:Re(c.tileID.canonical,0),u_ground_shadow_factor:z,u_pattern_transition:$}},i.e5=(p,c,h,g,_,S,C,L,z,$)=>{const K=p.transform,Z=K.calculatePixelsToTileUnitsMatrix(c),ee=h.paint.get("line-trim-color-use-theme").constantOr("default")==="none",re=K.pitch<15?Q_e(.07,.7,ye((14-K.zoom)/5,0,1)):.07;return{u_matrix:ebe(p,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:rbe(h)&&c.lineAtlasTexture?c.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:J_e(c,p.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:Re(c.tileID.canonical,0),u_ground_shadow_factor:$}},i.e6=qt,i.e7=dM,i.e8=ue,i.e9=wh,i.eA=function(p,c){var h=2*Math.acos(c[3]),g=Math.sin(h/2);return g>u?(p[0]=c[0]/g,p[1]=c[1]/g,p[2]=c[2]/g):(p[0]=1,p[1]=0,p[2]=0),h},i.eB=Mle,i.eC=tL,i.eD=eL,i.eE=[1,1,1],i.eF=f4,i.eG=Ie,i.eH=function(p,c,h,g){var _=c[0],S=c[1],C=c[2],L=c[3];return p[0]=_+g*(h[0]-_),p[1]=S+g*(h[1]-S),p[2]=C+g*(h[2]-C),p[3]=L+g*(h[3]-L),p},i.eI=i4,i.eJ=Fu,i.eK=Um,i.eL=function(p,c,h,g,_,S,C,L,z,$,K,Z,ee,re,ae,ge){var Se=new m(16);return Se[0]=p,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]=ae,Se[15]=ge,Se},i.eM=w,i.eN=w0,i.eO=Q5,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(p,c=!1){const h=Zve(new or(0,0),new or(Ar,Ar),p),g=[];if(c&&!Loe(h,this._globalClipBounds))return g;for(const _ of this._activeRegions){if(_.hiddenByOverlap||!Loe(h,_))continue;const S=LHe(_.min,_.max,p);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(p){this._setSources(p.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(p){const c=p.getFootprints();if(c.length===0)return;const h=p.getOrder(),g=p.getClipMask(),_=p.getClipScope();for(const S of c){if(!S.footprint)continue;const C=Zve(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(p.getSourceId())}_computeReplacement(){this._activeRegions.sort((c,h)=>c.priority-h.priority||q6(c.min,h.min)||q6(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 p=this._activeRegions.length!==this._prevRegions.length;if(!p){let c=0;for(;!p&&c!==this._activeRegions.length;){const h=this._activeRegions[c],g=this._prevRegions[c];p=h.priority!==g.priority||!Kve(h,g)||h.order!==g.order||h.clipMask!==g.clipMask||!La(h.clipScope,g.clipScope),this._activeRegions[c].hiddenByOverlap=g.hiddenByOverlap,++c}}if(p){++this._updateTime;for(const h of this._activeRegions)h.order!==gM&&(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(p[c]);this._computeReplacement()}},i.eQ=gM,i.eR=class{constructor(p){this._createGrid(p),this._createPoles(p)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const p of this._poleSegments)p.destroy();for(const p of this._gridSegments)p.withSkirts.destroy(),p.withoutSkirts.destroy()}_fillGridMeshWithLods(p,c){const h=new og,g=new Jo,_=[],S=p+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),p[3]=.25*Se,p[0]=(Z-re)/Se,p[1]=(ee-z)/Se,p[2]=(L-$)/Se):C>K&&C>ae?(Se=2*Math.sqrt(1+C-K-ae),p[3]=(Z-re)/Se,p[0]=.25*Se,p[1]=(L+$)/Se,p[2]=(ee+z)/Se):K>ae?(Se=2*Math.sqrt(1+K-C-ae),p[3]=(ee-z)/Se,p[0]=(L+$)/Se,p[1]=.25*Se,p[2]=(Z+re)/Se):(Se=2*Math.sqrt(1+ae-C-K),p[3]=(L-$)/Se,p[0]=(ee+z)/Se,p[1]=(Z+re)/Se,p[2]=.25*Se),p},i.f=function(p){return btoa(encodeURIComponent(p).replace(/%([0-9A-F]{2})/g,(c,h)=>String.fromCharCode(+("0x"+h))))},i.f0=function([p,c,h]){const g=Math.hypot(p,c,h),_=Math.atan2(p,h),S=.5*Math.PI-Math.acos(-c/g);return new f(Yi(_),Yi(S))},i.f1=De,i.f2=Zoe,i.f3=function(p){const c=p.navigator?p.navigator.userAgent:null;return!!function(h){if(So==null){const g=h.navigator?h.navigator.userAgent:null;So=!!h.safari||!(!g||!(/\b(iPad|iPhone|iPod)\b/.test(g)||g.match("Safari")&&!g.match("Chrome")))}return So}(p)&&!(!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(p,c){Xy=p,Qy=c},i.f5=Noe,i.f6=xve,i.f7=function(p){const c=[0,0,0],h=M(new Float64Array(16));return T(h,p.pixelMatrix,p.globeMatrix),et(c,c,h),new or(c[0],c[1])},i.f8=function(){const p=wM;p&&(p.isPreloaded()&&p.numActive()===1?(p.release(Boe),wM=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(){K6().acquire(Boe)},i.fA=CL,i.fB=Dt,i.fC=function(p){let c=0;if(new Uint32Array(p,0,1)[0]!==T_e){const h=new Uint32Array(p,0,7),[,,g,_,S,C]=h;c=h.byteLength+_+S+C+S,(g!==p.byteLength||c>=p.byteLength)&&Kr("Invalid b3dm header information.")}return P_e(p,c)},i.fD=function(p,c){const h=ele(p);for(const g of h){for(const _ of g.meshes)uWe(_);g.lights&&(g.lightMeshIndex=g.meshes.length,g.meshes.push(hWe(g.lights,c)))}return h},i.fE=bL,i.fF=Gn,i.fG=k_e,i.fH=Fp,i.fI=du,i.fJ=function(p){gc(),Iu!=null&&Iu.then(c=>{c.keys().then(h=>{for(let g=0;gKr(_.message))}).catch(h=>Kr(h.message))}).catch(c=>Kr(c.message))},i.fa=o_,i.fb=function(p,c,h=!1){if(Nd===du.deferred||Nd===du.loading||Nd===du.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");Rp=Qo.resolveURL(p),Nd=du.deferred,$5=c,SN(),h||f6()},i.fc=function(p){s4=Qo.resolveURL(p),n4||(n4=new r4(K6(),new Rn)),n4.broadcast("setMeshoptUrl",s4)},i.fd=C_e,i.fe=function(p){qoe=Qo.resolveURL(p),n4||(n4=new r4(K6(),new Rn)),n4.broadcast("setDracoUrl",qoe)},i.ff=S_e,i.fg=bM,i.fh=function(p){const c=lu();if(!c)return;const h=c.delete(Yy);p&&h.then(()=>p()).catch(p)},i.fi=b_,i.fj=as,i.fk=T0,i.fl=Zp,i.fm=W2e,i.fn=G2e,i.fo=K_e,i.fp=er,i.fq="hd_road_elevation",i.fr=Aa,i.fs=Wt,i.ft=Ax,i.fu=mle,i.fv=k_,i.fw=function(p,c,h,g,_,S,C,L=1,z,$,K){p.createArrays(),p.tilePixelRatio=Ar/(512*p.overscaling),p.compareText={},p.iconsNeedLinear=!1;const Z=p.layers[0].layout,ee=p.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[ae,ge]=re.textSizeScaleRange,[Se,Ne]=re.iconSizeScaleRange;re.textScaleFactor=ye(re.scaleFactor,ae,ge),re.iconScaleFactor=ye(re.scaleFactor,Se,Ne);const Be=ee["text-size"],qe=ee["icon-size"];if(p.textSizeData.kind==="composite"){const{minZoom:Pt,maxZoom:Qt}=p.textSizeData;re.compositeTextSizes=[Be.possiblyEvaluate(new di(Pt,{worldview:K}),S),Be.possiblyEvaluate(new di(Qt,{worldview:K}),S)]}if(p.iconSizeData.kind==="composite"){const{minZoom:Pt,maxZoom:Qt}=p.iconSizeData;re.compositeIconSizes=[qe.possiblyEvaluate(new di(Pt,{worldview:K}),S),qe.possiblyEvaluate(new di(Qt,{worldview:K}),S)]}re.layoutTextSize=Be.possiblyEvaluate(new di(C+1,{worldview:K}),S),re.layoutIconSize=qe.possiblyEvaluate(new di(C+1,{worldview:K}),S),re.textMaxSize=Be.possiblyEvaluate(new di(18,{worldview:K}),S);const Qe=Z.get("symbol-placement"),vt=Z.get("text-rotation-alignment")==="map"&&Qe!=="point",mt=Z.get("text-size");let jt=!1;const At=[];for(const Pt of p.features){const Qt=Z.get("text-font").evaluate(Pt,{},S).join(","),Ft=mt.evaluate(Pt,{},S)*re.textScaleFactor,sr=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 hn=yr.toString(),Za=Z.get("text-letter-spacing").evaluate(Pt,{},S)*kl,pt=Z.get("text-line-height").evaluate(Pt,{},S)*kl,_t=z5(hn)?Za:0,nr=Z.get("text-anchor").evaluate(Pt,{},S),vr=Z.get("text-variable-anchor");if(!vr){const cn=Z.get("text-radial-offset").evaluate(Pt,{},S);if(cn)mr=Abe(nr,[cn*kl,gle]);else{const yn=Z.get("text-offset").evaluate(Pt,{},S);mr=[yn[0]*kl,yn[1]*kl]}}let Ur=vt?"center":Z.get("text-justify").evaluate(Pt,{},S);const qr=Qe==="point",ws=qr?Z.get("text-max-width").evaluate(Pt,{},S)*kl:1/0,Cs=cn=>{p.allowVerticalPlacement&&a_(hn)&&(ur.vertical=lle(yr,c,h,_,Qt,ws,pt,nr,cn,_t,mr,$u.vertical,!0,sr,Ft,z))};if(!vt&&vr){const cn=Ur==="auto"?vr.map(wn=>xle(wn)):[Ur];let yn=!1;for(let wn=0;wn=0||!a_(hn)){const cn=lle(yr,c,h,_,Qt,ws,pt,nr,Ur,_t,mr,$u.horizontal,!1,sr,Ft,z);cn&&(ur.horizontal[Ur]=cn)}Cs(qr?"left":Ur)}}let gr,rr,Jt,xr,Er,jr,bs=!1;const Gr=Z.get("icon-text-fit").evaluate(Pt,{},S);if(Pt.icon&&Pt.icon.hasPrimary()){const hn=IM(Pt.icon,p.iconSizeData,ee["icon-size"],S,p.zoom,Pt,z,re.iconScaleFactor,K);gr=hn.iconPrimary,Jt=hn.iconSecondary;const Za=gr.toString();if(rr=g.get(Za),rr&&(Er=Z.get("icon-offset").evaluate(Pt,{},S),jr=Z.get("icon-anchor").evaluate(Pt,{},S),_r=iL(_.get(Za),Jt?_.get(Jt.toString()):void 0,Er,jr),bs=rr.sdf,p.sdfIcons===void 0?p.sdfIcons=rr.sdf:p.sdfIcons!==rr.sdf&&Kr("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(rr.pixelRatio!==p.pixelRatio||Z.get("icon-rotate").constantOr(1)!==0)&&(p.iconsNeedLinear=!0)),Jt){const pt=Jt.toString();xr=g.get(pt)}}jt=jt||!(!Pt.icon||!Pt.icon.hasSecondary());const es=uL(ur.horizontal)||ur.vertical;p.iconsInText||(p.iconsInText=!!es&&es.iconsInText);const hs=sr*re.textScaleFactor/kl,{defaultShapedIcon:kn,verticallyShapedIcon:Nr}=_Ge(p,_r,Z,Pt,S,ur,hs,Er,Gr);Gr!=="none"&&_r&&(fbe(_r)||gbe(_r))&&(dL(0,rr,gr,_r,kn,Gr,$,g,_),dL(0,xr,Jt,_r,kn,Gr,$,g,_),Nr&&(dL(0,rr,gr,_r,Nr,Gr,$,g,_),dL(0,xr,Jt,_r,Nr,Gr,$,g,_))),_r=kn;const{iconBBox:ps,iconVerticalBBox:Qs,textBBox:Zn,textVerticalBBox:ra}=fGe(p,_r,Nr,Z,Pt,S,dr,Er,re,_,jr,ur,sr,mr);At.push({feature:Pt,shapedTextOrientations:ur,shapedText:es,shapedIcon:_r,iconPrimary:gr,iconSecondary:Jt,iconOffset:Er,iconAnchor:jr,verticallyShapedIcon:Nr,layoutTextSize:sr,layoutIconSize:dr,textOffset:mr,isSDFIcon:bs,iconTextFit:Gr,iconCollisionBounds:ps,iconVerticalCollisionBounds:Qs,textCollisionBounds:Zn,textVerticalCollisionBounds:ra})}return{featureData:At,sizes:re,hasAnySecondaryIcon:jt,textAlongLine:vt,symbolPlacement:Qe}},i.fx=kbe,i.fy=function(p,c,h,g,_,S,C,L,z,$){p.iconAtlasPositions=$.iconPositions;const{featureData:K,hasAnySecondaryIcon:Z,sizes:ee,textAlongLine:re,symbolPlacement:ae}=c;for(const ge of K){const{shapedIcon:Se,verticallyShapedIcon:Ne,feature:Be,shapedTextOrientations:qe,shapedText:Qe,layoutTextSize:vt,textOffset:mt,isSDFIcon:jt,iconPrimary:At,iconSecondary:Pt,iconTextFit:Qt,iconOffset:Ft,iconCollisionBounds:sr,iconVerticalCollisionBounds:dr,textCollisionBounds:ur}=ge;Ibe(Se,$.iconPositions,At,Pt),Ibe(Ne,$.iconPositions,At,Pt),vGe(qe,$.iconPositions),yGe(At,Pt,$.iconPositions),(Qe||Se)&&bGe(p,Be,qe,Se,Ne,z,ee,vt,0,mt,jt,g,_,C,L,Z,Qt,Ft,re,ae,sr,dr,ur)}h&&p.generateCollisionDebugBuffers(S,p.collisionBoxArray,ee.textScaleFactor)},i.fz=Ht,i.g=function(p,c){return Pm(Object.assign(p,{method:"GET"}),c)},i.h=function(p){return p.indexOf("mapbox:")===0},i.i=function(p){return Dn.API_STYLE_REGEX.test(p)&&!wl(p)},i.j=Di,i.k=Wo,i.l=function(p){return decodeURIComponent(atob(p).split("").map(c=>"%"+("00"+c.charCodeAt(0).toString(16)).slice(-2)).join(""))},i.m=function(p,c){return Pm(Object.assign(p,{type:"json"}),c)},i.n=t0,i.o=Qo,i.p=function(p,c){return Pm(Object.assign(p,{method:"POST"}),c)},i.q=Fc,i.r=mh,i.s=function(p){try{const c=self[p];return c.setItem("_mapbox_test_",1),c.removeItem("_mapbox_test_"),!0}catch{return!1}},i.t=function(){return $oe||($oe=new b_("ImageRasterizer")),$oe},i.u=function(){return function p(c){return c?(c^Math.random()*(16>>c/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,p)}()},i.v=function(p){return!!p&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(p)},i.w=Kr,i.x=Lle,i.y=on,i.z=Lr}),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 Oe="[";for(const Ye of nt)Oe+=`${m(Ye)},`;return`${Oe}]`}let ye="{";for(const Oe of Object.keys(nt).sort())ye+=`${Oe}:${m(nt[Oe])},`;return`${ye}}`}function x(nt){let ye="";for(const Oe of i.bx)ye+=`/${m(nt[Oe])}`;return ye}class y{constructor(ye){this.keyCache={},this._layers={},this._layerConfigs={},ye&&this.replace(ye)}replace(ye,Oe){this._layerConfigs={},this._layers={},this.update(ye,[],Oe)}update(ye,Oe,Ye){this._options=Ye;for(const wt of ye)this._layerConfigs[wt.id]=wt,(this._layers[wt.id]=i.du(wt,this.scope,null,this._options)).compileFilter(Ye),this.keyCache[wt.id]&&delete this.keyCache[wt.id];for(const wt of Oe)delete this.keyCache[wt],delete this._layerConfigs[wt],delete this._layers[wt];this.familiesBySource={};const St=function(wt,It){const qt={};for(let Wt=0;Wtthis._layers[Qr.id]),qt=It[0];if(qt.visibility==="none")continue;const Lt=qt.source||"";let Wt=this.familiesBySource[Lt];Wt||(Wt=this.familiesBySource[Lt]={});const pr=qt.sourceLayer||"_geojsonTileLayer";let cr=Wt[pr];cr||(cr=Wt[pr]=[]),cr.push(It)}}}const v=1*i.fl;class b{constructor(ye){const Oe={},Ye=[];for(const qt in ye){const Lt=ye[qt],Wt=Oe[qt]={};for(const pr in Lt.glyphs){const cr=Lt.glyphs[+pr];if(!cr||cr.bitmap.width===0||cr.bitmap.height===0)continue;const Qr=cr.metrics.localGlyph?v:1,Ms={x:0,y:0,w:cr.bitmap.width+2*Qr,h:cr.bitmap.height+2*Qr};Ye.push(Ms),Wt[pr]=Ms}}const{w:St,h:wt}=i.G(Ye),It=new i.fk({width:St||1,height:wt||1});for(const qt in ye){const Lt=ye[qt];for(const Wt in Lt.glyphs){const pr=Lt.glyphs[+Wt];if(!pr||pr.bitmap.width===0||pr.bitmap.height===0)continue;const cr=Oe[qt][Wt],Qr=pr.metrics.localGlyph?v:1;i.fk.copy(pr.bitmap,It,{x:0,y:0},{x:cr.x+Qr,y:cr.y+Qr},pr.bitmap)}}this.image=It,this.positions=Oe}}function N(nt,ye,Oe){nt[ye]?Oe&&(nt[ye].center=Oe):nt[ye]={floorIds:new Set,center:Oe||[0,0],floors:{}}}function k(nt,ye,Oe,Ye){for(const St of ye)N(nt,St),nt[St].floors[Oe]=Ye,nt[St].floorIds.add(Oe)}function M(nt){return{id:nt.properties.id.toString(),center:nt.properties.center.toString().split(";").map(Number)}}function E(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(Oe=>nt.properties&&nt.properties[Oe]!=null)}function P(nt){return T(nt,["type","id","name"])&&nt.properties.type==="building"}function R(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,Oe,Ye,St,wt,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={},pr=new i.fo(256,256),cr={featureIndex:Lt,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:pr,availableImages:Ye,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};if(this.indoor){const dn=this.indoor.indoorState.activeFloorsVisible,un=function(nn,Gn,qi){const So=function(Li,aa){if(!Li)return i.w("No source layers defined in indoor specification"),aa;if(Li.size===0)return aa;const Oi=Li.difference(aa);for(const Ka of Oi)i.w(`Missing source layer required in indoor specification: ${Ka}`);return aa.intersection(aa)}(Gn.sourceLayers,new Set(Object.keys(nn.layers))),ja=Gn.indoorState,Eo=function(Li,aa,Oi,Ka){const Dn=new Set,Di=new Set,wl=new Set,Pl=new Map,Xc={},Im=Xo=>{const Hd=Pl.get(Xo)||new Set;for(const fc of Dn)if((Pl.get(fc)||new Set).has(Xo)||Hd.has(fc))return!0;return!1};for(const Xo of aa){const Hd=Li.layers[Xo];if(Hd)for(let fc=0;fc=Oi.maxzoom||Oi.visibility==="none")continue;U(aa,this.zoom,cr.brightness,Ye,this.worldview);const Ka=Wt[Oi.id]=Oi.createBucket({index:Lt.bucketLayerIDs.length,layers:aa,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:So,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:St,worldview:this.worldview,localizable:Eo});Lt.bucketLayerIDs.push(aa.map(Di=>i.B(Di.id,Di.scope)));let Dn=Ka.prepare?Ka.prepare():null;Dn!=null?(Dn=Dn.then(()=>Ka.populate(ja,cr,this.tileID.canonical,this.tileTransform)),Qr.push(Dn)):Ka.populate(ja,cr,this.tileID.canonical,this.tileTransform)}}const Kr=()=>{let dn,un,nn,Gn,qi,So;pr.trim();const ja={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},Eo=()=>{if(dn)return this.status="done",It(dn);if(this.extraShadowCaster)this.status="done",It(null,{buckets:Object.values(Wt).filter(aa=>!aa.isEmpty()),featureIndex:Lt,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:cr.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(un&&nn&&Gn){const aa=new b(un),Oi=new Map;for(const[Di,wl]of nn.entries()){const{imagePosition:Pl}=i.fu(Di,wl,i.fv);Oi.set(Di,Pl)}const Ka={};for(const Di in Wt){const wl=Wt[Di];wl instanceof i.b4&&(U(wl.layers,this.zoom,cr.brightness,Ye,this.worldview),Ka[Di]=i.fw(wl,un,aa.positions,nn,Oi,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,qi,this.worldview))}const Dn={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(wt,nn,qi,()=>{Dn.iconsPending=!1,Li(Ka,aa,Dn)}),this.rasterizeIfNeeded(wt,Gn,So,()=>{Dn.patternsPending=!1,Li(Ka,aa,Dn)})}},Li=(aa,Oi,Ka,Dn)=>{if(Ka.iconsPending||Ka.patternsPending)return;const Di=new i.fx(nn,Gn,this.lut);for(const wl in Wt){const Pl=Wt[wl];if(wl in aa)i.fy(Pl,aa[wl],this.showCollisionBoxes,Ye,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,nn,Di);else if(Pl.hasPattern&&(Pl instanceof i.ba||Pl instanceof i.bb||Pl instanceof i.ea)){U(Pl.layers,this.zoom,cr.brightness,Ye,this.worldview);const Xc=Object.fromEntries(Di.patternPositions);Pl.addFeatures(cr,this.tileID.canonical,Xc,Ye,this.tileTransform,this.brightness)}}this.status="done",It(null,{buckets:Object.values(Wt).filter(wl=>!wl.isEmpty()),featureIndex:Lt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Oi.image,lineAtlas:pr,imageAtlas:Di,brightness:cr.brightness})};if(!this.extraShadowCaster){const aa=i.fs(cr.glyphDependencies,Dn=>Object.keys(Dn).map(Number));Object.keys(aa).length?wt.send("getGlyphs",{uid:this.uid,stacks:aa},(Dn,Di)=>{dn||(dn=Dn,un=Di,Eo())},void 0,!1,ja):un={};const Oi=Array.from(cr.iconDependencies.keys()).map(Dn=>i.I.parse(Dn));Oi.length?wt.send("getImages",{images:Oi,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(Dn,Di)=>{dn||(dn=Dn,nn=new Map,qi=this.updateImageMapAndGetImageTaskQueue(nn,Di,cr.iconDependencies),Eo())},void 0,!1,ja):(nn=new Map,qi=new Map);const Ka=Array.from(cr.patternDependencies.keys()).map(Dn=>i.I.parse(Dn));Ka.length?wt.send("getImages",{images:Ka,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(Dn,Di)=>{dn||(dn=Dn,Gn=new Map,So=this.updateImageMapAndGetImageTaskQueue(Gn,Di,cr.patternDependencies),Eo())},void 0,!1,ja):(Gn=new Map,So=new Map)}if(cr.elevationFeatures&&cr.elevationFeatures.length>0){const aa=[];for(const Ka of Object.values(Wt))if(Ka instanceof i.bb){const Dn=Ka.getUnevaluatedPortalGraph();Dn&&aa.push(Dn)}const Oi=i.ft.evaluate(aa);for(const Ka of Object.values(Wt))if(Ka instanceof i.bb){const Dn=ye.layers[qt.decode(Ka.sourceLayerIndex)];Ka.setEvaluatedPortalGraph(Oi,Dn,this.tileID.canonical,cr.availableImages,cr.brightness)}}Eo()};Qr.length>0?Promise.allSettled(Qr).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,Oe,Ye,St){Array.from(Oe.values()).some(wt=>wt.usvg)?this.rasterize(ye,Oe,Ye,St):St()}updateImageMapAndGetImageTaskQueue(ye,Oe,Ye){const St=new Map;for(const wt of Oe.keys()){const It=Ye.get(wt)||[];for(const qt of It){const Lt=qt.toString(),Wt=Oe.get(qt.id.toString());Wt.usvg?St.has(Lt)||(St.set(Lt,qt),ye.set(Lt,Object.assign({},Wt))):ye.set(Lt,Wt)}}return St}rasterize(ye,Oe,Ye,St){this.rasterizeTask=ye.send("rasterizeImages",{scope:this.scope,tasks:Ye},(wt,It)=>{if(!wt)for(const[qt,Lt]of It.entries()){const Wt=Object.assign(Oe.get(qt),{data:Lt});Oe.set(qt,Wt)}St()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function U(nt,ye,Oe,Ye,St){const wt=new i.ac(ye,{brightness:Oe,worldview:St});for(const It of nt)It.recalculate(wt,Ye)}class q extends i.E{constructor(ye,Oe,Ye,St,wt,It,qt){super(),this.actor=ye,this.layerIndex=Oe,this.availableImages=Ye,this.availableModels=St,this.loadVectorData=It||i.aL,this.loading={},this.loaded={},this.deduped=new i.aK(ye.scheduler),this.isSpriteLoaded=wt,this.scheduler=ye.scheduler,this.brightness=qt}loadTile(ye,Oe){const Ye=ye.uid,St=ye&&ye.request,wt=St&&St.collectResourceTiming,It=this.loading[Ye]=new D(ye);It.abort=this.loadVectorData(ye,(qt,Lt)=>{const Wt=!this.loading[Ye];if(delete this.loading[Ye],It.cancelRasterize(),Wt||qt||!Lt)return It.status="done",Wt||(this.loaded[Ye]=It),Oe(qt);const pr=Lt.rawData,cr={},Qr=i.aM(Lt.responseHeaders);Qr&&Qr.expires&&(cr.expires=Qr.expires),Qr&&Qr.cacheControl&&(cr.cacheControl=Qr.cacheControl),It.vectorTile=Lt.vectorTile||new i.fz(new i.bt(pr));const Ms=()=>{It.parse(It.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(Kr,dn)=>{if(Kr||!dn)return Oe(Kr);const un={};if(wt){const nn=u(St);nn.length>0&&(un.resourceTiming=JSON.parse(JSON.stringify(nn)))}Oe(null,Object.assign({rawTileData:pr.slice(0),responseHeaders:Lt.responseHeaders},dn,cr,un))})};this.isSpriteLoaded?Ms():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(Ms,{type:"parseTile",isSymbolTile:ye.isSymbolTile,zoom:ye.tileZoom}):Ms()}),this.loaded=this.loaded||{},this.loaded[Ye]=It})}reloadTile(ye,Oe){const Ye=this.loaded,St=ye.uid;if(Ye&&Ye[St]){const wt=Ye[St];wt.updateParameters(ye);const It=(qt,Lt)=>{const Wt=wt.reloadCallback;Wt&&(delete wt.reloadCallback,wt.parse(wt.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Wt)),Oe(qt,Lt)};wt.status==="parsing"?wt.reloadCallback=It:wt.status==="done"&&(wt.vectorTile?wt.parse(wt.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,It):It())}else Oe(null,void 0)}abortTile(ye,Oe){const Ye=ye.uid,St=this.loading[Ye];St&&(St.abort&&St.abort(),delete this.loading[Ye]),Oe()}removeTile(ye,Oe){const Ye=this.loaded,St=ye.uid;Ye&&Ye[St]&&delete Ye[St],Oe()}}class H{loadTile(ye,Oe){const{uid:Ye,encoding:St,rawImageData:wt,padding:It}=ye,qt=ImageBitmap&&wt instanceof ImageBitmap?this.getImageData(wt,It):wt;Oe(null,new i.fA(Ye,qt,St,It<1))}reloadTile(ye,Oe){Oe(null,null)}abortTile(ye,Oe){Oe()}removeTile(ye,Oe){Oe()}getImageData(ye,Oe){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(ye.width,ye.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=ye.width,this.offscreenCanvas.height=ye.height,this.offscreenCanvasContext.drawImage(ye,0,0,ye.width,ye.height);const Ye=this.offscreenCanvasContext.getImageData(-Oe,-Oe,ye.width+2*Oe,ye.height+2*Oe);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),Ye}}i.bs.setPbf(i.bt);class G{constructor(ye){this._mrt=new i.bs(ye.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=ye.uid,this.tileID=ye.tileID,this.source=ye.source}parse(ye,Oe){const Ye=this._mrt;this.status="parsing",this._entireBuffer=ye;try{Ye.parseHeader(ye),this._isHeaderLoaded=!0;const St=[];for(const wt in Ye.layers){const It=Ye.getLayer(wt),qt=It.getDataRange(It.getBandList()),Lt=Ye.createDecodingTask(qt),Wt=ye.slice(qt.firstByte,qt.lastByte+1),pr=i.bs.performDecoding(Wt,Lt).then(cr=>Lt.complete(null,cr)).catch(cr=>Lt.complete(cr,null));St.push(pr)}Promise.allSettled(St).then(()=>Oe(null,Ye)).catch(wt=>Oe(wt))}catch(St){Oe(St)}}}class Q{constructor(ye){this.actor=ye,this.loading={},this.loaded={}}loadTile(ye,Oe){const Ye=ye.uid,St=ye.request,wt=this.loading[Ye]=new G(ye),{cancel:It}=i.bu(St,(qt,Lt,Wt)=>{const pr=!this.loading[Ye];if(delete this.loading[Ye],pr||qt||!Lt)return wt.status="done",pr||(this.loaded[Ye]=wt),Oe(qt);wt.parse(Lt,(cr,Qr)=>{if(cr||!Qr)return Oe(cr);Oe(null,Qr,Wt)}),this.loaded[Ye]=wt});wt.abort=It}reloadTile(ye,Oe){Oe(null,void 0)}abortTile(ye,Oe){const Ye=ye.uid,St=this.loading[Ye];St&&(St.abort&&St.abort(),delete this.loading[Ye]),Oe()}removeTile(ye,Oe){const Ye=ye.uid;this.loaded[Ye]&&delete this.loaded[Ye],Oe()}decodeRasterArray(ye,Oe){i.bs.performDecoding(ye.buffer,ye.task).then(Ye=>Oe(null,Ye)).catch(Ye=>Oe(Ye))}}const ne=i.fB.prototype.toGeoJSON;class ie{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 Oe of this._feature.geometry)ye.push([new i.P(Oe[0],Oe[1])]);return ye}{const ye=[];for(const Oe of this._feature.geometry){const Ye=[];for(const St of Oe)Ye.push(new i.P(St[0],St[1]));ye.push(Ye)}return ye}}toGeoJSON(ye,Oe,Ye){return ne.call(this,ye,Oe,Ye)}}class he{constructor(ye,Oe){this.name=ye,this.extent=i.al,this.length=Oe.length,this._jsonFeatures=Oe}feature(ye){return new ie(this._jsonFeatures[ye])}}class se{constructor(ye){this.layers={},this.extent=i.al;for(const Oe of Object.keys(ye))this.layers[Oe]=new he(Oe,ye[Oe])}}const fe=64/4096,oe=128;class ce{constructor(){this.features=new Map}clear(){this.features.clear()}load(ye=[],Oe){for(const Ye of ye){const St=Ye.id;if(St==null)continue;let wt=this.features.get(St);wt&&this.updateCache(wt,Oe),Ye.geometry?(wt=xe(Ye),this.updateCache(wt,Oe),this.features.set(St,wt)):this.features.delete(St),this.updateCache(wt,Oe)}}updateCache(ye,Oe){for(const{canonical:Ye,uid:St}of Object.values(Oe)){const{z:wt,x:It,y:qt}=Ye;de(ye,Math.pow(2,wt),It,qt)&&delete Oe[St]}}getTile(ye,Oe,Ye){const St=Math.pow(2,ye),wt=[];for(const It of this.features.values())de(It,St,Oe,Ye)&&wt.push(we(It,St,Oe,Ye));return{features:wt}}getFeatures(){return[...this.features.values()]}}function de({minX:nt,minY:ye,maxX:Oe,maxY:Ye},St,wt,It){return nt<(wt+1+fe)/St&&ye<(It+1+fe)/St&&Oe>(wt-fe)/St&&Ye>(It-fe)/St}function xe(nt){const{id:ye,geometry:Oe,properties:Ye}=nt;if(!Oe)return;if(Oe.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:St,coordinates:wt}=Oe,It={id:ye,type:1,geometry:[],tags:Ye,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},qt=It.geometry;if(St==="Point")Me(wt,qt,It);else if(St==="MultiPoint")for(const Lt of wt)Me(Lt,qt,It);else if(St==="LineString")It.type=2,ve(wt,qt,It);else if(St==="MultiLineString")It.type=2,be(wt,qt,It);else if(St==="Polygon")It.type=3,be(wt,qt,It,!0);else{if(St!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");It.type=3;for(const Lt of wt)be(Lt,qt,It,!0)}return It}function Me([nt,ye],Oe,Ye){const St=i.aF(nt);let wt=i.aJ(ye);wt=wt<0?0:wt>1?1:wt,Oe.push(St,wt),Ye.minX=Math.min(Ye.minX,St),Ye.minY=Math.min(Ye.minY,wt),Ye.maxX=Math.max(Ye.maxX,St),Ye.maxY=Math.max(Ye.maxY,wt)}function ve(nt,ye,Oe,Ye=!1,St=!1){const wt=[];for(const It of nt)Me(It,wt,Oe);ye.push(wt),Ye&&function(It,qt){let Lt=0;for(let Wt=0,pr=It.length,cr=pr-2;Wt0===qt)for(let Wt=0,pr=It.length;Wt=It&&cr>=It||(Wt>=It?(pr+=Math.round(Kr*((It-Wt)/Ms)),Wt=It):cr>=It&&(Qr=pr+Math.round(Kr*((It-Wt)/Ms)),cr=It),pr>=It&&Qr>=It||(pr>=It?(Wt+=Math.round(Ms*((It-pr)/Kr)),pr=It):Qr>=It&&(cr=Wt+Math.round(Ms*((It-pr)/Kr)),Qr=It),qt&&Wt===qt[qt.length-1][0]&&pr===qt[qt.length-1][1]||(qt=[[Wt,pr]],St.push(qt)),qt.push([cr,Qr])))))}}function Ae(nt,ye,Oe,Ye,St){const wt=(Oe-fe)/ye,It=(Ye-fe)/ye,qt=(Oe+1+fe)/ye,Lt=(Ye+1+fe)/ye;function Wt(Qr,Ms){let Kr=0;return Qrqt&&(Kr|=2),MsLt&&(Kr|=8),Kr}let pr=[];for(let Qr=1;Qr<=8;Qr*=2){let Ms=nt[nt.length-2],Kr=nt[nt.length-1],dn=!(Wt(Ms,Kr)&Qr);for(let un=0;un>31}function xt(nt,ye){const{geometry:Oe,type:Ye}=nt;let St=0,wt=0;if(Ye===1){ye.writeVarint($e(1,Oe.length));for(const It of Oe){const qt=It[0]-St,Lt=It[1]-wt;ye.writeVarint(it(qt)),ye.writeVarint(it(Lt)),St+=qt,wt+=Lt}}else for(const It of Oe){ye.writeVarint($e(1,1));const qt=It.length-(Ye===3?1:0);for(let Lt=0;Ltnt},le=Math.fround||(Ve=new Float32Array(1),nt=>(Ve[0]=+nt,Ve[0]));var Ve;const Je=3,rt=5,je=6;class lt{constructor(ye){this.options=Object.assign(Object.create(et),ye),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(ye){const{log:Oe,minZoom:Ye,maxZoom:St}=this.options;Oe&&console.time("total time");const wt=`prepare ${ye.length} points`;Oe&&console.time(wt),this.points=ye;const It=[];for(let Lt=0;Lt=Ye;Lt--){const Wt=+Date.now();qt=this.trees[Lt]=this._createTree(this._cluster(qt,Lt)),Oe&&console.log("z%d: %d clusters in %dms",Lt,qt.numItems,+Date.now()-Wt)}return Oe&&console.timeEnd("total time"),this}getClusters(ye,Oe){let Ye=((ye[0]+180)%360+360)%360-180;const St=Math.max(-90,Math.min(90,ye[1]));let wt=ye[2]===180?180:((ye[2]+180)%360+360)%360-180;const It=Math.max(-90,Math.min(90,ye[3]));if(ye[2]-ye[0]>=360)Ye=-180,wt=180;else if(Ye>wt){const cr=this.getClusters([Ye,St,180,It],Oe),Qr=this.getClusters([-180,St,wt,It],Oe);return cr.concat(Qr)}const qt=this.trees[this._limitZoom(Oe)],Lt=qt.range(Ze(Ye),De(It),Ze(wt),De(St)),Wt=qt.data,pr=[];for(const cr of Lt){const Qr=this.stride*cr;pr.push(Wt[Qr+rt]>1?Ce(Wt,Qr,this.clusterProps):this.points[Wt[Qr+Je]])}return pr}getChildren(ye){const Oe=this._getOriginId(ye),Ye=this._getOriginZoom(ye),St="No cluster with the specified id.",wt=this.trees[Ye];if(!wt)throw new Error(St);const It=wt.data;if(Oe*this.stride>=It.length)throw new Error(St);const qt=this.options.radius/(this.options.extent*Math.pow(2,Ye-1)),Lt=wt.within(It[Oe*this.stride],It[Oe*this.stride+1],qt),Wt=[];for(const pr of Lt){const cr=pr*this.stride;It[cr+4]===ye&&Wt.push(It[cr+rt]>1?Ce(It,cr,this.clusterProps):this.points[It[cr+Je]])}if(Wt.length===0)throw new Error(St);return Wt}getLeaves(ye,Oe,Ye){const St=[];return this._appendLeaves(St,ye,Oe=Oe||10,Ye=Ye||0,0),St}getTile(ye,Oe,Ye){const St=this.trees[this._limitZoom(ye)],wt=Math.pow(2,ye),{extent:It,radius:qt}=this.options,Lt=qt/It,Wt=(Ye-Lt)/wt,pr=(Ye+1+Lt)/wt,cr={features:[]};return this._addTileFeatures(St.range((Oe-Lt)/wt,Wt,(Oe+1+Lt)/wt,pr),St.data,Oe,Ye,wt,cr),Oe===0&&this._addTileFeatures(St.range(1-Lt/wt,Wt,1,pr),St.data,wt,Ye,wt,cr),Oe===wt-1&&this._addTileFeatures(St.range(0,Wt,Lt/wt,pr),St.data,-1,Ye,wt,cr),cr.features.length?cr:null}getClusterExpansionZoom(ye){let Oe=this._getOriginZoom(ye)-1;for(;Oe<=this.options.maxZoom;){const Ye=this.getChildren(ye);if(Oe++,Ye.length!==1)break;ye=Ye[0].properties.cluster_id}return Oe}_appendLeaves(ye,Oe,Ye,St,wt){const It=this.getChildren(Oe);for(const qt of It){const Lt=qt.properties;if(Lt&&Lt.cluster?wt+Lt.point_count<=St?wt+=Lt.point_count:wt=this._appendLeaves(ye,Lt.cluster_id,Ye,St,wt):wt1;let pr,cr,Qr;if(Wt)pr=Ie(Oe,Lt,this.clusterProps),cr=Oe[Lt],Qr=Oe[Lt+1];else{const dn=this.points[Oe[Lt+Je]];pr=dn.properties;const[un,nn]=dn.geometry.coordinates;cr=Ze(un),Qr=De(nn)}const Ms={type:1,geometry:[[Math.round(this.options.extent*(cr*wt-Ye)),Math.round(this.options.extent*(Qr*wt-St))]],tags:pr};let Kr;Kr=Wt||this.options.generateId?Oe[Lt+Je]:this.points[Oe[Lt+Je]].id,Kr!==void 0&&(Ms.id=Kr),It.features.push(Ms)}}_limitZoom(ye){return Math.max(this.options.minZoom,Math.min(Math.floor(+ye),this.options.maxZoom+1))}_cluster(ye,Oe){const{radius:Ye,extent:St,reduce:wt,minPoints:It}=this.options,qt=Ye/(St*Math.pow(2,Oe)),Lt=ye.data,Wt=[],pr=this.stride;for(let cr=0;crOe&&(un+=Lt[Gn+rt])}if(un>dn&&un>=It){let nn,Gn=Qr*dn,qi=Ms*dn,So=-1;const ja=(cr/pr<<5)+(Oe+1)+this.points.length;for(const Eo of Kr){const Li=Eo*pr;if(Lt[Li+2]<=Oe)continue;Lt[Li+2]=Oe;const aa=Lt[Li+rt];Gn+=Lt[Li]*aa,qi+=Lt[Li+1]*aa,Lt[Li+4]=ja,wt&&(nn||(nn=this._map(Lt,cr,!0),So=this.clusterProps.length,this.clusterProps.push(nn)),wt(nn,this._map(Lt,Li)))}Lt[cr+4]=ja,Wt.push(Gn/un,qi/un,1/0,ja,-1,un),wt&&Wt.push(So)}else{for(let nn=0;nn1)for(const nn of Kr){const Gn=nn*pr;if(!(Lt[Gn+2]<=Oe)){Lt[Gn+2]=Oe;for(let qi=0;qi>5}_getOriginZoom(ye){return(ye-this.points.length)%32}_map(ye,Oe,Ye){if(ye[Oe+rt]>1){const It=this.clusterProps[ye[Oe+je]];return Ye?Object.assign({},It):It}const St=this.points[ye[Oe+Je]].properties,wt=this.options.map(St);return Ye&&wt===St?Object.assign({},wt):wt}}function Ce(nt,ye,Oe){return{type:"Feature",id:nt[ye+Je],properties:Ie(nt,ye,Oe),geometry:{type:"Point",coordinates:[(Ye=nt[ye],360*(Ye-.5)),Ke(nt[ye+1])]}};var Ye}function Ie(nt,ye,Oe){const Ye=nt[ye+rt],St=Ye>=1e4?`${Math.round(Ye/1e3)}k`:Ye>=1e3?Math.round(Ye/100)/10+"k":Ye,wt=nt[ye+je],It=wt===-1?{}:Object.assign({},Oe[wt]);return Object.assign(It,{cluster:!0,cluster_id:nt[ye+Je],point_count:Ye,point_count_abbreviated:St})}function Ze(nt){return nt/360+.5}function De(nt){const ye=Math.sin(nt*Math.PI/180),Oe=.5-.25*Math.log((1+ye)/(1-ye))/Math.PI;return Oe<0?0:Oe>1?1:Oe}function Ke(nt){const ye=(180-360*nt)*Math.PI/180;return 360*Math.atan(Math.exp(ye))/Math.PI-90}function st(nt,ye,Oe,Ye){let St=Ye;const wt=ye+(Oe-ye>>1);let It,qt=Oe-ye;const Lt=nt[ye],Wt=nt[ye+1],pr=nt[Oe],cr=nt[Oe+1];for(let Qr=ye+3;QrSt)It=Qr,St=Ms;else if(Ms===St){const Kr=Math.abs(Qr-wt);KrYe&&(It-ye>3&&st(nt,ye,It,Ye),nt[It+2]=St,Oe-It>3&&st(nt,It,Oe,Ye))}function dt(nt,ye,Oe,Ye,St,wt){let It=St-Oe,qt=wt-Ye;if(It!==0||qt!==0){const Lt=((nt-Oe)*It+(ye-Ye)*qt)/(It*It+qt*qt);Lt>1?(Oe=St,Ye=wt):Lt>0&&(Oe+=It*Lt,Ye+=qt*Lt)}return It=nt-Oe,qt=ye-Ye,It*It+qt*qt}function ct(nt,ye,Oe,Ye){const St={id:nt??null,type:ye,geometry:Oe,tags:Ye,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(ye==="Point"||ye==="MultiPoint"||ye==="LineString")zt(St,Oe);else if(ye==="Polygon")zt(St,Oe[0]);else if(ye==="MultiLineString")for(const wt of Oe)zt(St,wt);else if(ye==="MultiPolygon")for(const wt of Oe)zt(St,wt[0]);return St}function zt(nt,ye){for(let Oe=0;Oe0&&(It+=Ye?(St*pr-Wt*wt)/2:Math.sqrt(Math.pow(Wt-St,2)+Math.pow(pr-wt,2))),St=Wt,wt=pr}const qt=ye.length-3;ye[2]=1,st(ye,0,qt,Oe),ye[qt+2]=1,ye.size=Math.abs(It),ye.start=0,ye.end=ye.size}function $r(nt,ye,Oe,Ye){for(let St=0;St1?1:Oe}function Ot(nt,ye,Oe,Ye,St,wt,It,qt){if(Ye/=ye,wt>=(Oe/=ye)&&It=Ye)return null;const Lt=[];for(const Wt of nt){const pr=Wt.geometry;let cr=Wt.type;const Qr=St===0?Wt.minX:Wt.minY,Ms=St===0?Wt.maxX:Wt.maxY;if(Qr>=Oe&&Ms=Ye)continue;let Kr=[];if(cr==="Point"||cr==="MultiPoint")Hr(pr,Kr,Oe,Ye,St);else if(cr==="LineString")Ts(pr,Kr,Oe,Ye,St,!1,qt.lineMetrics);else if(cr==="MultiLineString")wa(pr,Kr,Oe,Ye,St,!1);else if(cr==="Polygon")wa(pr,Kr,Oe,Ye,St,!0);else if(cr==="MultiPolygon")for(const dn of pr){const un=[];wa(dn,un,Oe,Ye,St,!0),un.length&&Kr.push(un)}if(Kr.length){if(qt.lineMetrics&&cr==="LineString"){for(const dn of Kr)Lt.push(ct(Wt.id,cr,dn,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(ct(Wt.id,cr,Kr,Wt.tags))}}return Lt.length?Lt:null}function Hr(nt,ye,Oe,Ye,St){for(let wt=0;wt=Oe&&It<=Ye&&gi(ye,nt[wt],nt[wt+1],nt[wt+2])}}function Ts(nt,ye,Oe,Ye,St,wt,It){let qt=zs(nt);const Lt=St===0?Ao:Ga;let Wt,pr,cr=nt.start;for(let un=0;unOe&&(pr=Lt(qt,nn,Gn,So,ja,Oe),It&&(qt.start=cr+Wt*pr)):Eo>Ye?Li=Oe&&(pr=Lt(qt,nn,Gn,So,ja,Oe),aa=!0),Li>Ye&&Eo<=Ye&&(pr=Lt(qt,nn,Gn,So,ja,Ye),aa=!0),!wt&&aa&&(It&&(qt.end=cr+Wt*pr),ye.push(qt),qt=zs(nt)),It&&(cr+=Wt)}let Qr=nt.length-3;const Ms=nt[Qr],Kr=nt[Qr+1],dn=St===0?Ms:Kr;dn>=Oe&&dn<=Ye&&gi(qt,Ms,Kr,nt[Qr+2]),Qr=qt.length-3,wt&&Qr>=3&&(qt[Qr]!==qt[0]||qt[Qr+1]!==qt[1])&&gi(qt,qt[0],qt[1],qt[2]),qt.length&&ye.push(qt)}function zs(nt){const ye=[];return ye.size=nt.size,ye.start=nt.start,ye.end=nt.end,ye}function wa(nt,ye,Oe,Ye,St,wt){for(const It of nt)Ts(It,ye,Oe,Ye,St,wt,!1)}function gi(nt,ye,Oe,Ye){nt.push(ye,Oe,Ye)}function Ao(nt,ye,Oe,Ye,St,wt){const It=(wt-ye)/(Ye-ye);return gi(nt,wt,Oe+(St-Oe)*It,1),It}function Ga(nt,ye,Oe,Ye,St,wt){const It=(wt-Oe)/(St-Oe);return gi(nt,ye+(Ye-ye)*It,wt,1),It}function mn(nt,ye){const Oe=[];for(let Ye=0;Ye0&&ye.size<(St?It:Ye))return void(Oe.numPoints+=ye.length/3);const qt=[];for(let Lt=0;LtIt)&&(Oe.numSimplified++,qt.push(ye[Lt],ye[Lt+1])),Oe.numPoints++;St&&function(Lt,Wt){let pr=0;for(let cr=0,Qr=Lt.length,Ms=Qr-2;cr0===Wt)for(let cr=0,Qr=Lt.length;cr24)throw new Error("maxZoom should be in the 0-24 range");if(Oe.promoteId&&Oe.generateId)throw new Error("promoteId and generateId cannot be used together.");let St=function(wt,It){const qt=[];if(wt.type==="FeatureCollection")for(let Lt=0;Lt1&&console.time("creation"),Ms=this.tiles[Qr]=$n(ye,Oe,Ye,St,Wt),this.tileCoords.push({z:Oe,x:Ye,y:St}),pr)){pr>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Oe,Ye,St,Ms.numFeatures,Ms.numPoints,Ms.numSimplified),console.timeEnd("creation"));const aa=`z${Oe}`;this.stats[aa]=(this.stats[aa]||0)+1,this.total++}if(Ms.source=ye,wt==null){if(Oe===Wt.indexMaxZoom||Ms.numPoints<=Wt.indexMaxPoints)continue}else{if(Oe===Wt.maxZoom||Oe===wt)continue;if(wt!=null){const aa=wt-Oe;if(Ye!==It>>aa||St!==qt>>aa)continue}}if(Ms.source=null,ye.length===0)continue;pr>1&&console.time("clipping");const Kr=.5*Wt.buffer/Wt.extent,dn=.5-Kr,un=.5+Kr,nn=1+Kr;let Gn=null,qi=null,So=null,ja=null,Eo=Ot(ye,cr,Ye-Kr,Ye+un,0,Ms.minX,Ms.maxX,Wt),Li=Ot(ye,cr,Ye+dn,Ye+nn,0,Ms.minX,Ms.maxX,Wt);ye=null,Eo&&(Gn=Ot(Eo,cr,St-Kr,St+un,1,Ms.minY,Ms.maxY,Wt),qi=Ot(Eo,cr,St+dn,St+nn,1,Ms.minY,Ms.maxY,Wt),Eo=null),Li&&(So=Ot(Li,cr,St-Kr,St+un,1,Ms.minY,Ms.maxY,Wt),ja=Ot(Li,cr,St+dn,St+nn,1,Ms.minY,Ms.maxY,Wt),Li=null),pr>1&&console.timeEnd("clipping"),Lt.push(Gn||[],Oe+1,2*Ye,2*St),Lt.push(qi||[],Oe+1,2*Ye,2*St+1),Lt.push(So||[],Oe+1,2*Ye+1,2*St),Lt.push(ja||[],Oe+1,2*Ye+1,2*St+1)}}getTile(ye,Oe,Ye){ye=+ye,Oe=+Oe,Ye=+Ye;const St=this.options,{extent:wt,debug:It}=St;if(ye<0||ye>24)return null;const qt=1<1&&console.log("drilling down to z%d-%d-%d",ye,Oe,Ye);let Wt,pr=ye,cr=Oe,Qr=Ye;for(;!Wt&&pr>0;)pr--,cr>>=1,Qr>>=1,Wt=this.tiles[Ni(pr,cr,Qr)];return Wt&&Wt.source?(It>1&&(console.log("found parent tile z%d-%d-%d",pr,cr,Qr),console.time("drilling down")),this.splitTile(Wt.source,pr,cr,Qr,ye,Oe,Ye),It>1&&console.timeEnd("drilling down"),this.tiles[Lt]?pn(this.tiles[Lt],wt):null):null}}function Ni(nt,ye,Oe){return 32*((1<Wt.tags&&"3d_elevation_id"in Wt.tags&&"source"in Wt.tags&&Wt.tags.source==="elevation",wt=Ye.features.filter(Wt=>St(Wt));let It={_geojsonTileLayer:Ye.features};wt.length>0&&(It={_geojsonTileLayer:Ye.features.filter(Wt=>!St(Wt)),hd_road_elevation:wt});const qt=new se(It),Lt=function(Wt){const pr=new i.bt;for(const cr of Object.keys(Wt))pr.writeMessage(3,Le,{name:cr,features:Wt[cr]});return pr.finish()}(It).buffer;ye(null,{vectorTile:qt,rawData:Lt})}class Yi extends q{constructor(ye,Oe,Ye,St,wt,It,qt){super(ye,Oe,Ye,St,wt,Ws,qt),It&&(this.loadGeoJSON=It),this._dynamicIndex=new ce}loadData(ye,Oe){const Ye=ye&&ye.request,St=Ye&&Ye.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(ye,(wt,It)=>{if(wt||!It)return Oe(wt);if(typeof It!="object")return Oe(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 lt(function({superclusterOptions:Lt,clusterProperties:Wt}){if(!Wt||!Lt)return Lt;const pr={},cr={},Qr={accumulated:null,zoom:0},Ms={properties:null},Kr=Object.keys(Wt);for(const dn of Kr){const[un,nn]=Wt[dn],Gn=i.U(nn),qi=i.U(typeof un=="string"?[un,["accumulated"],["get",dn]]:un);pr[dn]=Gn.value,cr[dn]=qi.value}return Lt.map=dn=>{Ms.properties=dn;const un={};for(const nn of Kr)un[nn]=pr[nn].evaluate(Qr,Ms);return un},Lt.reduce=(dn,un)=>{Ms.properties=un;for(const nn of Kr)Qr.accumulated=dn[nn],dn[nn]=cr[nn].evaluate(Qr,Ms)},Lt}(ye)).load(It.features):ye.dynamic?this._dynamicIndex:function(Lt,Wt){return new co(Lt,Wt)}(It,ye.geojsonVtOptions)}catch(Lt){return Oe(Lt)}const qt={};if(St){const Lt=u(Ye);Lt&&(qt.resourceTiming={},qt.resourceTiming[ye.source]=JSON.parse(JSON.stringify(Lt)))}Oe(null,qt)}})}reloadTile(ye,Oe){const Ye=this.loaded;return Ye&&Ye[ye.uid]?ye.partial?Oe(null,void 0):super.reloadTile(ye,Oe):this.loadTile(ye,Oe)}loadGeoJSON(ye,Oe){if(ye.request)i.m(ye.request,Oe);else{if(typeof ye.data!="string")return Oe(new Error(`Input data given to '${ye.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return Oe(null,JSON.parse(ye.data))}catch{return Oe(new Error(`Input data given to '${ye.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(ye,Oe){try{Oe(null,this._geoJSONIndex.getClusterExpansionZoom(ye.clusterId))}catch(Ye){Oe(Ye)}}getClusterChildren(ye,Oe){try{Oe(null,this._geoJSONIndex.getChildren(ye.clusterId))}catch(Ye){Oe(Ye)}}getClusterLeaves(ye,Oe){try{Oe(null,this._geoJSONIndex.getLeaves(ye.clusterId,ye.limit,ye.offset))}catch(Ye){Oe(Ye)}}}class mc{constructor(ye,Oe,Ye){this.tileID=new i.aQ(ye.tileID.overscaledZ,ye.tileID.wrap,ye.tileID.canonical.z,ye.tileID.canonical.x,ye.tileID.canonical.y),this.tileZoom=ye.tileZoom,this.uid=ye.uid,this.zoom=ye.zoom,this.canonical=ye.tileID.canonical,this.pixelRatio=ye.pixelRatio,this.tileSize=ye.tileSize,this.source=ye.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=ye.projection,this.brightness=Oe,this.worldview=Ye}parse(ye,Oe,Ye,St){this.status="parsing";const wt=new i.aQ(Ye.tileID.overscaledZ,Ye.tileID.wrap,Ye.tileID.canonical.z,Ye.tileID.canonical.x,Ye.tileID.canonical.y),It=[],qt=Oe.familiesBySource[Ye.source],Lt=new i.fn(wt,Ye.promoteId);Lt.bucketLayerIDs=[],Lt.is3DTile=!0,i.fC(ye).then(Wt=>{if(!Wt)return St(new Error("Could not parse tile"));const pr=Wt.json.extensionsUsed&&Wt.json.extensionsUsed.includes("MAPBOX_mesh_features")||Wt.json.asset.extras&&Wt.json.asset.extras.MAPBOX_mesh_features,cr=Wt.json.extensionsUsed&&Wt.json.extensionsUsed.includes("EXT_meshopt_compression"),Qr=new i.ac(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const Ms in qt)for(const Kr of qt[Ms]){const dn=Kr[0];Lt.bucketLayerIDs.push(Kr.map(Gn=>i.B(Gn.id,Gn.scope))),dn.recalculate(Qr,[]);const un=i.fD(Wt,1/i.d7(Ye.tileID.canonical)),nn=new i.fE(Kr,un,wt,pr,cr,this.brightness,Lt,this.worldview);pr||(nn.needsUpload=!0),It.push(nn),nn.evaluate(dn)}this.status="done",St(null,{buckets:It,featureIndex:Lt,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(Wt=>St(new Error(Wt.message)))}}class bo{constructor(ye,Oe,Ye,St,wt,It,qt,Lt){this.actor=ye,this.layerIndex=Oe,this.availableImages=Ye,this.availableModels=St,this.brightness=qt,this.loading={},this.loaded={},this.worldview=Lt}loadTile(ye,Oe){const Ye=ye.uid,St=this.loading[Ye]=new mc(ye,this.brightness,this.worldview);i.bu(ye.request,(wt,It)=>{const qt=!this.loading[Ye];return delete this.loading[Ye],qt||wt?(St.status="done",qt||(this.loaded[Ye]=St),Oe(wt)):It&&It.byteLength!==0?void St.parse(It,this.layerIndex,ye,(Lt,Wt)=>{St.status="done",this.loaded=this.loaded||{},this.loaded[Ye]=St,Lt||!Wt?Oe(Lt):Oe(null,Wt)}):(St.status="done",this.loaded[Ye]=St,Oe())})}reloadTile(ye,Oe){const Ye=this.loaded,St=ye.uid;if(Ye&&Ye[St]){const wt=Ye[St];wt.projection=ye.projection,wt.brightness=ye.brightness;const It=(qt,Lt)=>{wt.reloadCallback&&(delete wt.reloadCallback,this.loadTile(ye,Oe)),Oe(qt,Lt)};wt.status==="parsing"?wt.reloadCallback=It:wt.status==="done"&&this.loadTile(ye,Oe)}}abortTile(ye,Oe){const Ye=ye.uid;this.loading[Ye]&&delete this.loading[Ye],Oe()}removeTile(ye,Oe){const Ye=this.loaded,St=ye.uid;Ye&&Ye[St]&&delete Ye[St],Oe()}}class pc{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:q,geojson:Yi,"raster-dem":H,"raster-array":Q,"batched-model":bo},this.workerSources={},this.self.registerWorkerSource=(Oe,Ye)=>{if(this.workerSourceTypes[Oe])throw new Error(`Worker source with name "${Oe}" already registered.`);this.workerSourceTypes[Oe]=Ye},this.self.registerRTLTextPlugin=Oe=>{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=Oe.applyArabicShaping,i.fH.processBidirectionalText=Oe.processBidirectionalText,i.fH.processStyledBidirectionalText=Oe.processStyledBidirectionalText;for(const Ye of this.rtlPluginParsingListeners)Ye(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(ye,Oe,Ye){delete this.layerIndexes[ye],delete this.availableImages[ye],delete this.availableModels[ye],delete this.workerSources[ye],Ye()}checkIfReady(ye,Oe,Ye){Ye()}setReferrer(ye,Oe){this.referrer=Oe}spriteLoaded(ye,Oe){this.isSpriteLoaded[ye]||(this.isSpriteLoaded[ye]={});const{scope:Ye,isLoaded:St}=Oe;if(this.isSpriteLoaded[ye][Ye]=St,this.workerSources[ye]&&this.workerSources[ye][Ye])for(const wt in this.workerSources[ye][Ye]){const It=this.workerSources[ye][Ye][wt];for(const qt in It){const Lt=It[qt];Lt instanceof q&&(Lt.isSpriteLoaded=St,Lt.fire(new i.z("isSpriteLoaded")))}}}setImages(ye,Oe,Ye){this.availableImages[ye]||(this.availableImages[ye]={});const{scope:St,images:wt}=Oe;if(this.availableImages[ye][St]=wt,this.workerSources[ye]&&this.workerSources[ye][St]){for(const It in this.workerSources[ye][St]){const qt=this.workerSources[ye][St][It];for(const Lt in qt)qt[Lt].availableImages=wt}Ye()}else Ye()}setModels(ye,{scope:Oe,models:Ye},St){if(this.availableModels[ye]||(this.availableModels[ye]={}),this.availableModels[ye][Oe]=Ye,this.workerSources[ye]&&this.workerSources[ye][Oe]){for(const wt in this.workerSources[ye][Oe]){const It=this.workerSources[ye][Oe][wt];for(const qt in It)It[qt].availableModels=Ye}St()}else St()}setProjection(ye,Oe){this.projections[ye]=i.cm(Oe)}setBrightness(ye,Oe,Ye){this.brightness=Oe,Ye()}setWorldview(ye,Oe,Ye){this.worldview=Oe,Ye()}setLayers(ye,Oe,Ye){this.getLayerIndex(ye,Oe.scope).replace(Oe.layers,Oe.options),Ye()}updateLayers(ye,Oe,Ye){this.getLayerIndex(ye,Oe.scope).update(Oe.layers,Oe.removedIds,Oe.options),Ye()}loadTile(ye,Oe,Ye){Oe.projection=this.projections[ye]||this.defaultProjection,this.getWorkerSource(ye,Oe.type,Oe.source,Oe.scope).loadTile(Oe,Ye)}decodeRasterArray(ye,Oe,Ye){this.getWorkerSource(ye,Oe.type,Oe.source,Oe.scope).decodeRasterArray(Oe,Ye)}reloadTile(ye,Oe,Ye){Oe.projection=this.projections[ye]||this.defaultProjection,this.getWorkerSource(ye,Oe.type,Oe.source,Oe.scope).reloadTile(Oe,Ye)}abortTile(ye,Oe,Ye){this.getWorkerSource(ye,Oe.type,Oe.source,Oe.scope).abortTile(Oe,Ye)}removeTile(ye,Oe,Ye){this.getWorkerSource(ye,Oe.type,Oe.source,Oe.scope).removeTile(Oe,Ye)}removeSource(ye,Oe,Ye){if(!(this.workerSources[ye]&&this.workerSources[ye][Oe.scope]&&this.workerSources[ye][Oe.scope][Oe.type]&&this.workerSources[ye][Oe.scope][Oe.type][Oe.source]))return;const St=this.workerSources[ye][Oe.scope][Oe.type][Oe.source];delete this.workerSources[ye][Oe.scope][Oe.type][Oe.source],St.removeSource!==void 0?St.removeSource(Oe,Ye):Ye()}loadWorkerSource(ye,Oe,Ye){try{this.self.importScripts(Oe.url),Ye()}catch(St){Ye(St)}}syncRTLPluginState(ye,Oe,Ye){if(i.fH.isParsed())Ye(null,!0);else if(i.fH.isParsing())this.rtlPluginParsingListeners.push(Ye);else try{i.fH.setState(Oe);const St=i.fH.getPluginURL();!i.fH.isLoaded()||i.fH.isParsed()||i.fH.isParsing()||St==null||(i.fH.setState({pluginStatus:i.fI.parsing,pluginURL:i.fH.getPluginURL()}),this.self.importScripts(St),i.fH.isParsed()?Ye(null,!0):this.rtlPluginParsingListeners.push(Ye))}catch(St){Ye(St)}}setDracoUrl(ye,Oe){this.dracoUrl=Oe}getAvailableImages(ye,Oe){this.availableImages[ye]||(this.availableImages[ye]={});let Ye=this.availableImages[ye][Oe];return Ye||(Ye=[]),Ye}getAvailableModels(ye,Oe){this.availableModels[ye]||(this.availableModels[ye]={});let Ye=this.availableModels[ye][Oe];return Ye||(Ye={}),Ye}getLayerIndex(ye,Oe){this.layerIndexes[ye]||(this.layerIndexes[ye]={});let Ye=this.layerIndexes[ye][Oe];return Ye||(Ye=this.layerIndexes[ye][Oe]=new y,Ye.scope=Oe),Ye}getWorkerSource(ye,Oe,Ye,St){const wt=this.workerSources;return wt[ye]||(wt[ye]={}),wt[ye][St]||(wt[ye][St]={}),wt[ye][St][Oe]||(wt[ye][St][Oe]={}),this.isSpriteLoaded[ye]||(this.isSpriteLoaded[ye]={}),wt[ye][St][Oe][Ye]||(wt[ye][St][Oe][Ye]=new this.workerSourceTypes[Oe]({send:(It,qt,Lt,Wt,pr,cr)=>this.actor.send(It,qt,Lt,ye,pr,cr),scheduler:this.actor.scheduler},this.getLayerIndex(ye,St),this.getAvailableImages(ye,St),this.getAvailableModels(ye,St),this.isSpriteLoaded[ye][St],void 0,this.brightness,this.worldview)),wt[ye][St][Oe][Ye]}rasterizeImagesWorker(ye,Oe,Ye){const St=new Map;for(const[wt,{image:It,imageVariant:qt}]of Oe.tasks.entries()){const Lt=this.imageRasterizer.rasterize(qt,It,Oe.scope,ye);St.set(wt,Lt)}Ye(void 0,St)}removeRasterizedImages(ye,Oe,Ye){this.imageRasterizer.removeImagesFromCacheByIds(Oe.imageIds,Oe.scope,ye),Ye()}enforceCacheSizeLimit(ye,Oe){i.fJ(Oe)}getWorkerPerformanceMetrics(ye,Oe,Ye){Ye(void 0,void 0)}}return i.fF(self)&&(self.worker=new pc(self)),pc}),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,f){performance.measure(w,d,f)}};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,F,B=new Blob([""],{type:"text/javascript"}),W=URL.createObjectURL(B);try{F=new Worker(W),O=!0}catch{O=!1}return F&&F.terminate(),URL.revokeObjectURL(W),O}()?function(){var O=document.createElement("canvas");O.width=O.height=1;var F=O.getContext("2d");if(!F)return!1;var B=F.getImageData(0,0,1,1);return B&&B.width===O.width}()?(f[I=j&&j.failIfMajorPerformanceCaveat]===void 0&&(f[I]=function(O){var F,B=function(W){var J=document.createElement("canvas"),te=Object.create(w.webGLContextAttributes);return te.failIfMajorPerformanceCaveat=W,J.getContext("webgl2",te)}(O);if(!B)return!1;try{F=B.createShader(B.VERTEX_SHADER)}catch{return!1}return!(!F||B.isContextLost())&&(B.shaderSource(F,"void main() {}"),B.compileShader(F),B.getShaderParameter(F,B.COMPILE_STATUS)===!0)}(I)),f[I]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var I}v=1,b.supported=w,b.notSupportedReason=d;var f={};return w.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},b}();function k(w,d,f){const j=document.createElement(w);return d!=null&&(j.className=d),f&&f.appendChild(j),j}function M(w,d,f){const j=document.createElementNS("http://www.w3.org/2000/svg",w);for(const I of Object.keys(d))j.setAttributeNS(null,I,String(d[I]));return f&&f.appendChild(j),j}const E=typeof document<"u"?document.documentElement&&document.documentElement.style:null,T=E&&E.userSelect!==void 0?"userSelect":"WebkitUserSelect";let P;function R(){E&&T&&(P=E[T],E[T]="none")}function D(){E&&T&&(E[T]=P)}function U(w){w.preventDefault(),w.stopPropagation(),window.removeEventListener("click",U,!0)}function q(){window.addEventListener("click",U,!0),window.setTimeout(()=>{window.removeEventListener("click",U,!0)},0)}function H(w,d){const f=w.getBoundingClientRect();return ne(w,f,d)}function G(w,d){const f=w.getBoundingClientRect(),j=[];for(let I=0;Ithis._skuTokenExpiresAt}transformRequest(d,f){return this._transformRequestFn&&this._transformRequestFn(d,f)||{url:d}}normalizeStyleURL(d,f){if(!i.h(d))return d;const j=oe(d);return j.params.push(`sdk=js-${u}`),j.path=`/styles/v1${j.path}`,this._makeAPIURL(j,this._customAccessToken||f)}normalizeGlyphsURL(d,f){if(!i.h(d))return d;const j=oe(d);return j.path=`/fonts/v1${j.path}`,this._makeAPIURL(j,this._customAccessToken||f)}normalizeModelURL(d,f){if(!i.h(d))return d;const j=oe(d);return j.path=`/models/v1${j.path}`,this._makeAPIURL(j,this._customAccessToken||f)}normalizeSourceURL(d,f,j,I){if(!i.h(d))return d;const O=oe(d);return O.path=`/v4/${O.authority}.json`,O.params.push("secure"),j&&O.params.push(`language=${j}`),I&&O.params.push(`worldview=${I}`),this._makeAPIURL(O,this._customAccessToken||f)}normalizeIconsetURL(d,f){const j=oe(d);return i.h(d)?(j.path=`/styles/v1${j.path}/iconset.pbf`,this._makeAPIURL(j,this._customAccessToken||f)):ce(j)}normalizeSpriteURL(d,f,j,I){const O=oe(d);return i.h(d)?(O.path=`/styles/v1${O.path}/sprite${f}${j}`,this._makeAPIURL(O,this._customAccessToken||I)):(O.path+=`${f}${j}`,ce(O))}normalizeTileURL(d,f,j){if(this._isSkuTokenExpired()&&this._createSkuToken(),d&&!i.h(d))return d;const I=oe(d);I.path=I.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${f||j&&I.authority!=="raster"&&j===512?"@2x":""}${i.k.supported?".webp":"$1"}`),I.authority==="raster"?I.path=`/${i.e.RASTER_URL_PREFIX}${I.path}`:I.authority==="rasterarrays"?I.path=`/${i.e.RASTERARRAYS_URL_PREFIX}${I.path}`:I.authority==="3dtiles"?I.path=`/${i.e.TILES3D_URL_PREFIX}${I.path}`:(I.path=I.path.replace(/^.+\/v4\//,"/"),I.path=`/${i.e.TILE_URL_VERSION}${I.path}`);const O=this._customAccessToken||function(F){for(const B of F){const W=B.match(/^access_token=(.*)$/);if(W)return W[1]}return null}(I.params)||i.e.ACCESS_TOKEN;return i.e.REQUIRE_ACCESS_TOKEN&&O&&this._skuToken&&I.params.push(`sku=${this._skuToken}`),this._makeAPIURL(I,O)}canonicalizeTileURL(d,f){const j=oe(d);if(!j.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!j.path.match(/\.[\w]+$/))return d;let I="mapbox://";j.path.match(/^\/raster\/v1\//)?I+=`raster/${j.path.replace(`/${i.e.RASTER_URL_PREFIX}/`,"")}`:j.path.match(/^\/rasterarrays\/v1\//)?I+=`rasterarrays/${j.path.replace(`/${i.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:I+=`tiles/${j.path.replace(`/${i.e.TILE_URL_VERSION}/`,"")}`;let O=j.params;return f&&(O=O.filter(F=>!F.match(/^access_token=/))),O.length&&(I+=`?${O.join("&")}`),I}canonicalizeTileset(d,f){const j=!!f&&i.h(f),I=[];for(const O of d.tiles||[])i.j(O)?I.push(this.canonicalizeTileURL(O,j)):I.push(O);return I}_makeAPIURL(d,f){const j="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",I=oe(i.e.API_URL);if(d.protocol=I.protocol,d.authority=I.authority,d.protocol==="http"){const O=d.params.indexOf("secure");O>=0&&d.params.splice(O,1)}if(I.path!=="/"&&(d.path=`${I.path}${d.path}`),!i.e.REQUIRE_ACCESS_TOKEN)return ce(d);if(f=f||i.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!f)throw new Error(`An API access token is required to use Mapbox GL. ${j}`);if(f[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=${f||""}`),ce(d)}}const fe=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function oe(w){const d=w.match(fe);if(!d)throw new Error("Unable to parse URL object");return{protocol:d[1],authority:d[2],path:d[3]||"/",params:d[4]?d[4].split("&"):[]}}function ce(w){const d=w.params.length?`?${w.params.join("&")}`:"";return`${w.protocol}://${w.authority}${w.path}${d}`}const de="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 Me{constructor(d){this.type=d,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(d){const f=xe(i.e.ACCESS_TOKEN);let j="";return j=f&&f.u?i.f(f.u):i.e.ACCESS_TOKEN||"",d?`${de}.${d}:${j}`:`${de}:${j}`}fetchEventData(){const d=i.s("localStorage"),f=this.getStorageKey(),j=this.getStorageKey("uuid"),I=this.getStorageKey("uuidTimestamp");if(d)try{const O=localStorage.getItem(f);O&&(this.eventData=JSON.parse(O));const F=localStorage.getItem(j);F&&(this.anonId=F);const B=localStorage.getItem(I);B&&(this.anonIdTimestamp=Number(B));const W=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp=1&&localStorage.setItem(f,JSON.stringify(this.eventData)),F&&localStorage.setItem(I,F.toString())}catch{i.w("Unable to write to LocalStorage")}}processRequests(d){}postEvent(d,f,j,I){if(!i.e.EVENTS_URL)return;const O=oe(i.e.EVENTS_URL);O.params.push(`access_token=${I||i.e.ACCESS_TOKEN||""}`);const F={event:this.type,created:new Date(d).toISOString()},B=f?Object.assign(F,f):F,W={url:ce(O),headers:{"Content-Type":"text/plain"},body:JSON.stringify([B])};this.pendingRequest=i.p(W,J=>{this.pendingRequest=null,j(J),this.saveEventData(),this.processRequests(I)})}queueRequest(d,f){this.queue.push(d),this.processRequests(f)}}class ve extends Me{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 f=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:f},d)}processRequests(d){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:f,payload:j}=this.queue.shift();this.postEvent(f,j,()=>{},d)}}const be=new class extends Me{constructor(w){super("appUserTurnstile"),this._customAccessToken=w}postTurnstileEvent(w,d){i.e.EVENTS_URL&&i.e.ACCESS_TOKEN&&Array.isArray(w)&&w.some(f=>i.h(f)||i.j(f))&&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),f=d?d.u:i.e.ACCESS_TOKEN;let j=f!==this.eventData.tokenU;i.v(this.anonId)||(this.refreshUUID(),j=!0);const I=this.queue.shift();if(this.eventData.lastSuccess){const O=new Date(this.eventData.lastSuccess),F=new Date(I),B=(I-this.eventData.lastSuccess)/864e5;j=j||B>=1||B<-1||O.getDate()!==F.getDate()}else j=!0;j?this.postEvent(I,{sdkIdentifier:"mapbox-gl-js",sdkVersion:u,skuId:ie,"enabled.telemetry":!1,userId:this.anonId},O=>{O||(this.eventData.lastSuccess=I,this.eventData.tokenU=f)},w):this.processRequests()}},we=be.postTurnstileEvent.bind(be),tt=new class extends Me{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(w,d,f,j){this.skuToken=d,this.errorCb=j,i.e.EVENTS_URL&&(f||i.e.ACCESS_TOKEN?this.queueRequest({id:w,timestamp:Date.now()},f):this.errorCb(new Error(he)))}processRequests(w){if(this.pendingRequest||this.queue.length===0)return;const{id:d,timestamp:f}=this.queue.shift();d&&this.success[d]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),i.v(this.anonId)||this.refreshUUID(),this.postEvent(f,{sdkIdentifier:"mapbox-gl-js",sdkVersion:u,skuId:ie,skuToken:this.skuToken,userId:this.anonId},j=>{j?this.errorCb(j):d&&(this.success[d]=!0)},w))}remove(){this.errorCb=null}},Ae=tt.postMapLoadEvent.bind(tt),Le=new class extends Me{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:f,style:j,importedStyles:I}=d;if(!i.e.EVENTS_URL||!w&&!i.e.ACCESS_TOKEN)return;const O=this.getMapInstanceId(f),F={mapInstanceId:O,eventId:this.getEventId(O),style:j};I.length&&(F.importedStyles=I),this.queueRequest({timestamp:Date.now(),payload:F},w)}processRequests(w){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:d,payload:f}=this.queue.shift();this.postEvent(d,f,()=>{},w)}},Ue=Le.postStyleLoadEvent.bind(Le),Pe=new ve({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),$e=Pe.postMetricsEvent.bind(Pe),it=new ve({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),xt=it.postMetricsEvent.bind(it),Ee=new class extends Me{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:f}=this.queue.shift(),j=function(I){const O=performance.getEntriesByType("resource"),F=performance.getEntriesByType("mark"),B=function(pe){const ke={};if(pe){for(const _e in pe)if(_e!=="other")for(const Fe of pe[_e]){const Re=`${_e}ResolveRangeMin`,We=`${_e}ResolveRangeMax`,at=`${_e}RequestCount`,Ge=`${_e}RequestCachedCount`;ke[Re]=Math.min(ke[Re]||1/0,Fe.startTime),ke[We]=Math.max(ke[We]||-1/0,Fe.responseEnd);const kt=yt=>{ke[yt]===void 0&&(ke[yt]=0),++ke[yt]};Fe.transferSize!==void 0&&Fe.transferSize===0&&kt(Ge),kt(at)}}return ke}(function(pe,ke){const _e={};if(pe)for(const Fe of pe){const Re=ke(Fe);_e[Re]===void 0&&(_e[Re]=[]),_e[Re].push(Fe)}return _e}(O,y)),W=window.devicePixelRatio,J=navigator.connection||navigator.mozConnection||navigator.webkitConnection,te=J?J.effectiveType:void 0,me={counters:[],metadata:[],attributes:[]},ue=(pe,ke,_e)=>{_e!=null&&pe.push({name:ke,value:_e.toString()})};for(const pe in B)ue(me.counters,pe,B[pe]);if(I.interactionRange[0]!==1/0&&I.interactionRange[1]!==-1/0&&(ue(me.counters,"interactionRangeMin",I.interactionRange[0]),ue(me.counters,"interactionRangeMax",I.interactionRange[1])),F)for(const pe of Object.values(m)){const ke=F.find(_e=>_e.name===pe);ke&&ue(me.counters,pe,ke.startTime)}return ue(me.counters,"visibilityHidden",I.visibilityHidden),ue(me.attributes,"style",function(pe){if(pe)for(const ke of pe){const _e=ke.name.split("?")[0];if(i.i(_e)){const Fe=_e.split("/").slice(-2);if(Fe.length===2)return`mapbox://styles/${Fe[0]}/${Fe[1]}`}}}(O)),ue(me.attributes,"terrainEnabled",I.terrainEnabled?"true":"false"),ue(me.attributes,"fogEnabled",I.fogEnabled?"true":"false"),ue(me.attributes,"projection",I.projection),ue(me.attributes,"zoom",I.zoom),ue(me.metadata,"devicePixelRatio",W),ue(me.metadata,"connectionEffectiveType",te),ue(me.metadata,"navigatorUserAgent",navigator.userAgent),ue(me.metadata,"screenWidth",window.screen.width),ue(me.metadata,"screenHeight",window.screen.height),ue(me.metadata,"windowWidth",window.innerWidth),ue(me.metadata,"windowHeight",window.innerHeight),ue(me.metadata,"mapWidth",I.width/W),ue(me.metadata,"mapHeight",I.height/W),ue(me.metadata,"webglRenderer",I.renderer),ue(me.metadata,"webglVendor",I.vendor),ue(me.metadata,"sdkVersion",u),ue(me.metadata,"sdkIdentifier","mapbox-gl-js"),me}(f);for(const I of j.metadata);for(const I of j.counters);for(const I of j.attributes);this.postEvent(d,j,()=>{},w)}},et=Ee.postPerformanceEvent.bind(Ee),le=new class extends Me{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(w,d,f,j){if(!i.e.API_URL||!i.e.SESSION_PATH)return;const I=oe(i.e.API_URL+i.e.SESSION_PATH);I.params.push(`sku=${d||""}`),I.params.push(`access_token=${j||i.e.ACCESS_TOKEN||""}`);const O={url:ce(I),headers:{"Content-Type":"text/plain"}};this.pendingRequest=i.g(O,F=>{this.pendingRequest=null,f(F),this.saveEventData(),this.processRequests(j)})}getSessionAPI(w,d,f,j){this.skuToken=d,this.errorCb=j,i.e.SESSION_PATH&&i.e.API_URL&&(f||i.e.ACCESS_TOKEN?this.queueRequest({id:w,timestamp:Date.now()},f):this.errorCb(new Error(he)))}processRequests(w){if(this.pendingRequest||this.queue.length===0)return;const{id:d,timestamp:f}=this.queue.shift();d&&this.success[d]||this.getSession(f,this.skuToken,j=>{j?this.errorCb(j):d&&(this.success[d]=!0)},w)}remove(){this.errorCb=null}},Ve=le.getSessionAPI.bind(le),Je=new Set;function rt(w,d){d?Je.add(w):Je.delete(w)}class je{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(d,f){this._updatedSourceCaches[d]=f,this.setDirty()}discardSourceCacheUpdate(d){delete this._updatedSourceCaches[d]}updateLayer(d){const f=d.scope;this._updatedLayers[f]=this._updatedLayers[f]||new Set,this._updatedLayers[f].add(d.id),this.setDirty()}removeLayer(d){const f=d.scope;this._removedLayers[f]=this._removedLayers[f]||{},this._updatedLayers[f]=this._updatedLayers[f]||new Set,this._removedLayers[f][d.id]=d,this._updatedLayers[f].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 f in this._updatedLayers)d[f]=d[f]||{},d[f].updatedIds=Array.from(this._updatedLayers[f].values());for(const f in this._removedLayers)d[f]=d[f]||{},d[f].removedIds=Object.keys(this._removedLayers[f]);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,f){this._updatedImages[f]=this._updatedImages[f]||new Set,this._updatedImages[f].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 lt(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 f=this.atlasTexture.get(d);f&&(f.destroy(),this.atlasTexture.delete(d))}addImageProvider(d,f){this.imageProviders.has(f)||this.imageProviders.set(f,new Map),this.imageProviders.get(f).set(d.id,d)}removeImageProvider(d,f){this.imageProviders.has(f)&&this.imageProviders.get(f).delete(d)}getPendingImageProviders(){const d=[];for(const f of this.imageProviders.values())for(const j of f.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,f){if(this.loaded.get(f)!==d&&(this.loaded.set(f,d),d)){for(const{ids:j,callback:I}of this.requestors)this._notify(j,f,I);this.requestors=[]}}hasImage(d,f){return!!this.getImage(d,f)}getImage(d,f){return this.images.get(f).get(d.toString())}addImage(d,f,j){this._validate(d,j)&&this.images.get(f).set(d.toString(),j)}_validate(d,f){let j=!0;return this._validateStretch(f.stretchX,f.data&&f.data.width)||(this.fire(new i.y(new Error(`Image "${d.name}" has invalid "stretchX" value`))),j=!1),this._validateStretch(f.stretchY,f.data&&f.data.height)||(this.fire(new i.y(new Error(`Image "${d.name}" has invalid "stretchY" value`))),j=!1),this._validateContent(f.content,f)||(this.fire(new i.y(new Error(`Image "${d.name}" has invalid "content" value`))),j=!1),j}_validateStretch(d,f){if(!d)return!0;let j=0;for(const I of d){if(I[0]i.I.from(f))}getImages(d,f,j){const I=[],O=[],F=this.imageProviders.get(f);for(const te of d){if(!te.iconsetId){I.push(te);continue}const me=F.get(te.iconsetId);me&&(this.getImage(te,f)?O.push(te):me.addPendingRequest(te))}if(I.length===0)return void this._notify(O,f,j);let B=!0;const W=!!this.loaded.get(f),J=this.images.get(f);if(!W)for(const te of I)J.has(te.toString())||(B=!1);W||B?this._notify(I,f,j):this.requestors.push({ids:I,scope:f,callback:j})}rasterizeImages(d,f){const j=new Map,{tasks:I,scope:O}=d;for(const[F,B]of I.entries()){const W=this.getImage(B.id,O);W&&j.set(F,{image:W,imageVariant:B})}this._rasterizeImages(O,j,f)}_rasterizeImages(d,f,j){if(i.r())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:f,scope:d},j);else{const I=new Map;for(const[O,{image:F,imageVariant:B}]of f.entries())I.set(O,this.imageRasterizer.rasterize(B,F,d,0));j(void 0,I)}}getUpdatedImages(d){return this.updatedImages.get(d)||new Set}_notify(d,f,j){const I=this.images.get(f),O=new Map;for(const F of d){if(!I.get(F.toString())){if(F.iconsetId)continue;this.fire(new i.z("styleimagemissing",{id:F.name}))}const B=I.get(F.toString());if(!B){i.w(`Image "${F.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 W={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(W,{width:B.icon.usvg_tree.width,height:B.icon.usvg_tree.height}),O.set(i.I.toString(F),W)}j(null,O)}getPixelSize(d){const{width:f,height:j}=this.atlasImage.get(d);return{width:f,height:j}}getPattern(d,f,j){const I=d.toString(),O=this.patterns.get(f),F=O.get(I),B=this.getImage(d,f);if(!B)return null;if(F){if(F.position.version===B.version)return F.position;F.position.version=B.version}else{if(B.usvg&&!B.data){const W=this.getPatternInFlightId(I,f);if(this.patternsInFlight.has(W))return null;this.patternsInFlight.add(W);const J=new i.A(d).scaleSelf(i.o.devicePixelRatio),te=new Map([[J.toString(),{image:B,imageVariant:J}]]);return this._rasterizeImages(f,te,(me,ue)=>this.storePatternImage(J,f,B,j,ue)),null}this.storePattern(d,f,B)}return this._updatePatternAtlas(f,j),O.get(I).position}getPatternInFlightId(d,f){return i.B(d,f)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(d,f,j,I,O){const F=d.toString(),B=O?O.get(F):void 0;B&&(j.data=B,this.storePattern(d.id,f,j),this._updatePatternAtlas(f,I),this.patternsInFlight.delete(this.getPatternInFlightId(d.id.toString(),f)))}storePattern(d,f,j){const I={w:j.data.width+2*i.C,h:j.data.height+2*i.C,x:0,y:0},O=new i.F(I,j,i.C);this.patterns.get(f).set(d.toString(),{bin:I,position:O})}destroyAtlasTextures(){for(const d of this.atlasTexture.values())d&&d.destroy();this.atlasTexture.clear()}bind(d,f){const j=d.gl;let I=this.atlasTexture.get(f);I?this.dirty&&(I.update(this.atlasImage.get(f)),this.dirty=!1):(I=new i.T(d,this.atlasImage.get(f),j.RGBA8),this.atlasTexture.set(f,I)),I.bind(j.LINEAR,j.CLAMP_TO_EDGE)}_updatePatternAtlas(d,f){const j=this.patterns.get(d),I=Array.from(j.values()).map(({bin:J})=>J),{w:O,h:F}=i.G(I),B=this.atlasImage.get(d);B.resize({width:O||1,height:F||1});const W=this.images.get(d);for(const[J,{bin:te,position:me}]of j.entries()){let ue=me.padding;const pe=te.x+ue,ke=te.y+ue,_e=W.get(J).data,Fe=_e.width,Re=_e.height;ue=ue>1?ue-1:ue,i.q.copy(_e,B,{x:0,y:0},{x:pe,y:ke},{width:Fe,height:Re},f),i.q.copy(_e,B,{x:0,y:Re-ue},{x:pe,y:ke-ue},{width:Fe,height:ue},f),i.q.copy(_e,B,{x:0,y:0},{x:pe,y:ke+Re},{width:Fe,height:ue},f),i.q.copy(_e,B,{x:Fe-ue,y:0},{x:pe-ue,y:ke},{width:ue,height:Re},f),i.q.copy(_e,B,{x:0,y:0},{x:pe+Fe,y:ke},{width:ue,height:Re},f),i.q.copy(_e,B,{x:Fe-ue,y:Re-ue},{x:pe-ue,y:ke-ue},{width:ue,height:ue},f),i.q.copy(_e,B,{x:0,y:Re-ue},{x:pe+Fe,y:ke-ue},{width:ue,height:ue},f),i.q.copy(_e,B,{x:0,y:0},{x:pe+Fe,y:ke+Re},{width:ue,height:ue},f),i.q.copy(_e,B,{x:Fe-ue,y:0},{x:pe-ue,y:ke+Re},{width:ue,height:ue},f)}this.dirty=!0}beginFrame(){for(const d of this.images.keys())this.callbackDispatchedThisFrame.set(d,new Set)}dispatchRenderCallbacks(d,f){const j=this.images.get(f);for(const I of d){if(this.callbackDispatchedThisFrame.get(f).has(I.toString()))continue;this.callbackDispatchedThisFrame.get(f).add(I.toString());const O=j.get(I.toString());lt(O)&&this.updateImage(I,f,O)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function Ie(w){const d=w.value,f=w.valueSpec,j=w.style,I=w.styleSpec,O=w.key,F=w.arrayElementValidator||mn;if(!Array.isArray(d))return[new i.V(O,d,`array expected, ${i.K(d)} found`)];if(f.length&&d.length!==f.length)return[new i.V(O,d,`array length ${f.length} expected, length ${d.length} found`)];if(f["min-length"]&&d.lengthI)return[new i.V(d,f,`${f} is greater than the maximum value ${I}`)]}return[]}function De(w){const d=w.key,f=w.value;if(!i.H(f))return[new i.V(d,f,`object expected, ${i.K(f)} found`)];const j=w.valueSpec,I=i.J(f.type);let O,F,B,W={};const J=I!=="categorical"&&f.property===void 0,te=!J,me=function(_e){const Fe=_e.stops;return Array.isArray(Fe)&&Array.isArray(Fe[0])&&i.H(Fe[0][0])}(f),ue=na({key:w.key,value:w.value,valueSpec:w.styleSpec.function,style:w.style,styleSpec:w.styleSpec,objectElementValidators:{stops:function(_e){if(I==="identity")return[new i.V(_e.key,_e.value,'identity function may not have a "stops" property')];let Fe=[];const Re=_e.value;return Fe=Fe.concat(Ie({key:_e.key,value:Re,valueSpec:_e.valueSpec,style:_e.style,styleSpec:_e.styleSpec,arrayElementValidator:pe})),Array.isArray(Re)&&Re.length===0&&Fe.push(new i.V(_e.key,Re,"array must have at least one stop")),Fe},default:function(_e){return mn({key:_e.key,value:_e.value,valueSpec:j,style:_e.style,styleSpec:_e.styleSpec})}}});return I==="identity"&&J&&ue.push(new i.V(w.key,w.value,'missing required property "property"')),I==="identity"||f.stops||ue.push(new i.V(w.key,w.value,'missing required property "stops"')),I==="exponential"&&j.expression&&!i.M(j)&&ue.push(new i.V(w.key,w.value,"exponential functions not supported")),w.styleSpec.$version>=8&&(te&&!i.N(j)?ue.push(new i.V(w.key,w.value,"property functions not supported")):J&&!i.O(j)&&ue.push(new i.V(w.key,w.value,"zoom functions not supported"))),I!=="categorical"&&!me||f.property!==void 0||ue.push(new i.V(w.key,w.value,'"property" property is required')),ue;function pe(_e){let Fe=[];const Re=_e.value,We=_e.key;if(!Array.isArray(Re))return[new i.V(We,Re,`array expected, ${i.K(Re)} found`)];if(Re.length!==2)return[new i.V(We,Re,`array length 2 expected, length ${Re.length} found`)];if(me){if(!i.H(Re[0]))return[new i.V(We,Re,`object expected, ${i.K(Re[0])} found`)];const at=Re[0];if(at.zoom===void 0)return[new i.V(We,Re,"object stop key must have zoom")];if(at.value===void 0)return[new i.V(We,Re,"object stop key must have value")];const Ge=i.J(at.zoom);if(typeof Ge!="number")return[new i.V(We,at.zoom,"stop zoom values must be numbers")];if(B&&B>Ge)return[new i.V(We,at.zoom,"stop zoom values must appear in ascending order")];Ge!==B&&(B=Ge,F=void 0,W={}),Fe=Fe.concat(na({key:`${We}[0]`,value:Re[0],valueSpec:{zoom:{}},style:_e.style,styleSpec:_e.styleSpec,objectElementValidators:{zoom:Ze,value:ke}}))}else Fe=Fe.concat(ke({key:`${We}[0]`,value:Re[0],style:_e.style,styleSpec:_e.styleSpec},Re));return i.Q(i.S(Re[1]))?Fe.concat([new i.V(`${We}[1]`,Re[1],"expressions are not allowed in function stops.")]):Fe.concat(mn({key:`${We}[1]`,value:Re[1],valueSpec:j,style:_e.style,styleSpec:_e.styleSpec}))}function ke(_e,Fe){const Re=i.K(_e.value),We=i.J(_e.value),at=_e.value!==null?_e.value:Fe;if(O){if(Re!==O)return[new i.V(_e.key,at,`${Re} stop domain type must match previous stop domain type ${O}`)]}else O=Re;if(Re!=="number"&&Re!=="string"&&Re!=="boolean"&&typeof We!="number"&&typeof We!="string"&&typeof We!="boolean")return[new i.V(_e.key,at,"stop domain value must be a number, string, or boolean")];if(Re!=="number"&&I!=="categorical"){let Ge=`number expected, ${Re} found`;return i.N(j)&&I===void 0&&(Ge+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new i.V(_e.key,at,Ge)]}return I!=="categorical"||Re!=="number"||typeof We=="number"&&isFinite(We)&&Math.floor(We)===We?I!=="categorical"&&Re==="number"&&typeof We=="number"&&typeof F=="number"&&F!==void 0&&Wenew i.V(`${w.key}${j.key}`,w.value,j.message));const f=d.value.expression||d.value._styleExpression.expression;if(w.expressionContext==="property"&&w.propertyKey==="text-font"&&!f.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(f))return[new i.V(w.key,w.value,'"feature-state" data expressions are not supported with layout properties.')];if(w.expressionContext==="filter")return st(f,w);if(w.expressionContext==="appearance")return dt(f,w);if(w.expressionContext&&w.expressionContext.indexOf("cluster")===0){if(!i.X(f,["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(f))return[new i.V(w.key,w.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function st(w,d){const f=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(d.valueSpec&&d.valueSpec.expression)for(const I of d.valueSpec.expression.parameters)f.delete(I);if(f.size===0)return[];const j=[];return w instanceof i._&&f.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(I=>{j.push(...st(I,d))}),j)}function dt(w,d){const f=new Set;if(d.valueSpec&&d.valueSpec.expression)for(const I of d.valueSpec.expression.parameters)f.add(I);if(f.size===0)return[];const j=[];return w instanceof i._&&!f.has(w.name)?[new i.V(d.key,d.value,`["${w.name}"] is not an allowed parameter`)]:(w.eachChild(I=>{j.push(...dt(I,d))}),j)}function ct(w){const d=w.key,f=w.value,j=w.valueSpec,I=[];return Array.isArray(j.values)?j.values.indexOf(i.J(f))===-1&&I.push(new i.V(d,f,`expected one of [${j.values.join(", ")}], ${JSON.stringify(f)} found`)):Object.keys(j.values).indexOf(i.J(f))===-1&&I.push(new i.V(d,f,`expected one of [${Object.keys(j.values).join(", ")}], ${JSON.stringify(f)} found`)),I}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,f=w.key;if(!Array.isArray(d))return[new i.V(f,d,`array expected, ${i.K(d)} found`)];if(d.length<1)return[new i.V(f,d,"filter array must have at least 1 element")];const j=w.styleSpec;let I=ct({key:`${f}[0]`,value:d[0],valueSpec:j.filter_operator});const O=()=>{d.length>=2&&(i.a0(d[1])||I.push(new i.V(`${f}[1]`,d[1],`string expected, ${i.K(d[1])} found`)));for(let F=2;F":case">=":d.length>=2&&i.J(d[1])==="$type"&&I.push(new i.V(f,d,`"$type" cannot be use with operator "${d[0]}"`)),d.length!==3&&I.push(new i.V(f,d,`filter array for operator "${d[0]}" must have 3 elements`)),O();break;case"==":case"!=":d.length!==3&&I.push(new i.V(f,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 F=1;F{J in f&&d.push(new i.V(j,f[J],`"${J}" is prohibited for ref layers`))}),I.layers.forEach(J=>{i.J(J.id)===B&&(W=J)}),W?W.ref?d.push(new i.V(j,f.ref,"ref cannot reference another ref layer")):F=i.J(W.type):typeof B=="string"&&d.push(new i.V(j,f.ref,`ref layer "${B}" not found`))}else if(F!=="background"&&F!=="sky"&&F!=="slot")if(f.source)if(i.a0(f.source)){const W=I.sources&&I.sources[f.source],J=W&&i.J(W.type);W?J==="vector"&&F==="raster"?d.push(new i.V(j,f.source,`layer "${f.id}" requires a raster source`)):J==="raster"&&F!=="raster"?d.push(new i.V(j,f.source,`layer "${f.id}" requires a vector source`)):J!=="vector"||f["source-layer"]?J==="raster-dem"&&F!=="hillshade"?d.push(new i.V(j,f.source,"raster-dem source can only be used with layer type 'hillshade'.")):J!=="raster-array"||["raster","raster-particle"].includes(F)?F==="line"&&f.paint&&(f.paint["line-gradient"]||f.paint["line-trim-offset"])&&J==="geojson"&&!W.lineMetrics?d.push(new i.V(j,f,`layer "${f.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):F==="raster-particle"&&J!=="raster-array"&&d.push(new i.V(j,f.source,`layer "${f.id}" requires a 'raster-array' source.`)):d.push(new i.V(j,f.source,"raster-array source can only be used with layer type 'raster'.")):d.push(new i.V(j,f,`layer "${f.id}" must specify a "source-layer"`)):d.push(new i.V(j,f.source,`source "${f.source}" not found`))}else d.push(new i.V(`${j}.source`,f.source,'"source" must be a string'));else d.push(new i.V(j,f,'missing required property "source"'));return d=d.concat(na({key:j,value:f,valueSpec:O.layer,style:w.style,styleSpec:w.styleSpec,objectElementValidators:{"*":()=>[],type:()=>mn({key:`${j}.type`,value:f.type,valueSpec:O.layer.type,style:w.style,styleSpec:w.styleSpec,object:f,objectKey:"type"}),filter:W=>zt(Object.assign({layerType:F},W)),layout:W=>na({layer:f,key:W.key,value:W.value,valueSpec:{},style:W.style,styleSpec:W.styleSpec,objectElementValidators:{"*":J=>$r(Object.assign({layerType:F},J))}}),paint:W=>na({layer:f,key:W.key,value:W.value,valueSpec:{},style:W.style,styleSpec:W.styleSpec,objectElementValidators:{"*":J=>Zr(Object.assign({layerType:F,layer:f},J))}}),appearances(W){const J=Ie({key:W.key,value:W.value,valueSpec:W.valueSpec,style:W.style,styleSpec:W.styleSpec,arrayElementValidator:ue=>function(pe){const{key:ke,layer:_e,layerType:Fe}=pe,Re=i.J(pe.value),We=i.J(Re.name),at=i.J(Re.condition),Ge=na({key:ke,value:Re,valueSpec:pe.styleSpec.appearance,style:pe.style,styleSpec:pe.styleSpec,objectElementValidators:{condition:kt=>function(yt){const bt=[];return bt.push(...Ke({key:yt.key,value:yt.object.condition,valueSpec:i.a6.appearance.condition,expressionContext:"appearance"})),bt}(Object.assign({layer:_e,layerType:Fe},kt)),properties:kt=>function(yt){const bt=[],{styleSpec:ft,layer:ht,layerType:Ct}=yt,Rt=ft[`paint_${Ct}`],Dt=ft[`layout_${Ct}`],Yt=yt.object[yt.objectKey];for(const Xt in Yt){const lr=Xt in Rt?"paint":Xt in Dt?"layout":void 0;if(!lr){bt.push(new i.V(yt.key,Xt,`unknown property "${Xt}" for layer type "${Ct}"`));continue}const br=Object.assign({},yt,{key:`${yt.key}.${Xt}`,object:Yt,objectKey:Xt,layer:ht,layerType:Ct,value:Yt[Xt],valueSpec:lr==="paint"?Rt[Xt]:Dt[Xt]});bt.push(...Tr(br,lr))}return bt}(Object.assign({layer:_e,layerType:Fe},kt))}});return We!=="hidden"&&at===void 0&&Ge.push(new i.V(pe.key,"name",'Appearance with name different than "hidden" must have a condition')),Ge}(Object.assign({layerType:F,layer:f},ue))}),te=Array.isArray(W.value)?W.value:[],me=new Set;return te.forEach((ue,pe)=>{const ke=i.J(ue.name);if(ke)if(me.has(ke)){const _e=i.J(f.id);J.push(new i.V(W.key,ke,`Duplicated appearance name "${ke}" for layer "${_e}"`))}else me.add(ke)}),J}}})),d}function Xs({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:f}){if(i.a0(f))return Xs({key:d,value:f});if(Array.isArray(f)){const I=[],O=i.S(f),F=i.U(O);return F.result==="error"&&F.value.forEach(B=>{I.push(new i.V(`${d}${B.key}`,null,`${B.message}`))}),i.X(F.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"])||I.push(new i.V(`${d}`,null,"promoteId expression should be only feature dependent")),I}if(!i.H(f))return[new i.V(d,f,`string, expression or object expected, "${i.K(f)}" found`)];const j=[];for(const I in f)j.push(...w({key:`${d}.${I}`,value:f[I]}));return j}};function Hr(w){const d=w.value,f=w.key,j=w.styleSpec,I=w.style;if(!i.H(d))return[new i.V(f,d,`object expected, ${i.K(d)} found`)];if(!("type"in d))return[new i.V(f,d,'"type" is required')];const O=i.J(d.type);let F=[];switch(["vector","raster","raster-dem","raster-array"].includes(O)&&("url"in d||"tiles"in d||F.push(new i.a3(f,d,'Either "url" or "tiles" is required.'))),O){case"vector":case"raster":case"raster-dem":case"raster-array":return F=F.concat(na({key:f,value:d,valueSpec:j[`source_${O.replace("-","_")}`],style:w.style,styleSpec:j,objectElementValidators:Ot})),F;case"geojson":if(F=na({key:f,value:d,valueSpec:j.source_geojson,style:I,styleSpec:j,objectElementValidators:Ot}),"cluster"in d&&"clusterProperties"in d){if(!i.H(d.clusterProperties))return[new i.V(`${f}.clusterProperties`,d,`object expected, ${i.K(d)} found`)];for(const B in d.clusterProperties){const W=d.clusterProperties[B];if(!Array.isArray(W))return[new i.V(`${f}.clusterProperties.${B}`,W,"array expected")];const[J,te]=W,me=typeof J=="string"?[J,["accumulated"],["get",B]]:J;F.push(...Ke({key:`${f}.${B}.map`,value:te,expressionContext:"cluster-map"})),F.push(...Ke({key:`${f}.${B}.reduce`,value:me,expressionContext:"cluster-reduce"}))}}return F;case"video":return na({key:f,value:d,valueSpec:j.source_video,style:I,styleSpec:j});case"image":return na({key:f,value:d,valueSpec:j.source_image,style:I,styleSpec:j});case"canvas":return[new i.V(f,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ct({key:`${f}.type`,value:d.type,valueSpec:{values:Ts(j)}})}}function Ts(w){return w.source.reduce((d,f)=>{const j=w[f];return j.type.type==="enum"&&(d=d.concat(Object.keys(j.type.values||{}))),d},[])}function zs(w){const d=w.value,f=w.styleSpec,j=f.light,I=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 F in d){const B=F.match(/^(.*)-transition$/),W=F.match(/^(.*)-use-theme$/);O=O.concat(W&&j[W[1]]?mn({key:F,value:d[F],valueSpec:{type:"string"},style:I,styleSpec:f}):B&&j[B[1]]&&j[B[1]].transition?mn({key:F,value:d[F],valueSpec:f.transition,style:I,styleSpec:f}):j[F]?mn({key:F,value:d[F],valueSpec:j[F],style:I,styleSpec:f}):[new i.V(F,d[F],`unknown property "${F}"`)])}return O}function wa(w){const d=w.value;if(!d)return[];const f=w.key;if(!i.H(d))return[new i.V(f,d,`object expected, ${i.K(d)} found`)];let j=[];const I=w.styleSpec,O=I["light-3d"],F=w.style,B=w.style.lights;for(const te of["type","id"])if(!(te in d))return j=j.concat([new i.V(f,d,`missing property "${te}"`)]),j;if(!i.a0(d.type))return j=j.concat([new i.V(`${f}.type`,d.type,"string expected")]),j;if(B)for(let te=0;te[],array:Ie,boolean:function(w){const d=w.value,f=w.key;return i.$(d)?[]:[new i.V(f,d,`boolean expected, ${i.K(d)} found`)]},number:Ze,color:function({key:w,value:d}){return i.a0(d)?i.a1.parseCSSColor(d)===null?[new i.V(w,d,`color expected, "${d}" found`)]:[]:[new i.V(w,d,`color expected, ${i.K(d)} found`)]},enum:ct,filter:zt,function:De,layer:ns,object:na,source:Hr,model:i.a7,light:zs,"light-3d":wa,terrain:gi,fog:Ao,string:Xs,formatted:function(w){return Xs(w).length===0?[]:Ke(w)},resolvedImage:function(w){return Xs(w).length===0?[]:Ke(w)},projection:function(w){const d=w.value,f=w.styleSpec,j=f.projection,I=w.style;if(i.H(d)){let O=[];for(const F in d)O=O.concat(mn({key:F,value:d[F],valueSpec:j[F],style:I,styleSpec:f}));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:f,styleSpec:j}=w;if(!i.H(f))return[new i.V(d,f,"import must be an object")];const{data:I,...O}=f;Object.defineProperty(O,"__line__",{value:f.__line__,enumerable:!1});let F=na(Object.assign({},w,{value:O,valueSpec:j.import}));return i.J(O.id)===""&&F.push(new i.V(`${w.key}.id`,O,"import id can't be an empty string")),I&&(F=F.concat(Jn(I,j,{key:`${w.key}.data`}))),F},iconset:function(w){const d=w.value,f=w.key,j=w.styleSpec,I=w.style;if(!i.H(d))return[new i.V(f,d,"object expected")];if(!d.type)return[new i.V(f,d,'"type" is required')];const O=i.J(d.type);let F=[];if(F=F.concat(na({key:f,value:d,valueSpec:j[`iconset_${O}`],style:I,styleSpec:j})),function(B,W){return!(B!=="source"||!W.source)}(O,d)){const B=I.sources&&I.sources[d.source],W=B&&i.J(B.type);B?W!=="raster-array"&&F.push(new i.V(f,d.source,`iconset cannot be used with a source of type ${String(W)}, it only be used with a "raster-array" source type`)):F.push(new i.V(f,d.source,`source "${d.source}" not found`))}return F}};function mn(w,d=!1){const f=w.value,j=w.valueSpec,I=w.styleSpec;if(j.expression){if(i.a4(i.J(f)))return De(w);if(i.Q(i.S(f)))return Ke(w)}if(j.type&&Ga[j.type]){const O=Ga[j.type](w);return d===!0&&O.length>0&&Array.isArray(w.value)?Ke(w):O}return na(Object.assign({},w,{valueSpec:j.type?I[j.type]:j}))}function na(w){const d=w.key,f=w.value,j=w.valueSpec||{},I=w.objectElementValidators||{},O=w.style,F=w.styleSpec;if(!i.H(f))return[new i.V(d,f,`object expected, ${i.K(f)} found`)];let B=[];for(const W in f){const J=W.split(".")[0];let te;I[J]?te=I[J]:j[J]?te=mn:I["*"]?te=I["*"]:j["*"]&&(te=mn),te?B=B.concat(te({key:(d&&`${d}.`)+W,value:f[W],valueSpec:j[J]||j["*"],style:O,styleSpec:F,object:f,objectKey:W},f)):B.push(new i.a3(d,f[W],`unknown property "${W}"`))}for(const W in j){if(I[W])continue;const J=j[W];J.required&&J.default===void 0&&f[W]===void 0&&B.push(new i.V(d,f,`missing required property "${W}"`))}return B}function pn({key:w,value:d}){const f=Xs({key:w,value:d});if(f.length)return f;const j=d;return j.indexOf("{fontstack}")===-1&&f.push(new i.V(w,d,'"glyphs" url must include a "{fontstack}" token')),j.indexOf("{range}")===-1&&f.push(new i.V(w,d,'"glyphs" url must include a "{range}" token')),f}function Jn(w,d=i.a6,f={}){return na({key:f.key||"",value:w,valueSpec:Object.assign(d.$root,{"*":{type:"*"}}),styleSpec:d,style:w,objectElementValidators:{glyphs:pn}})}function $n(w,d=i.a6){return Oe(Jn(w,d))}const Ci=w=>Oe(Hr(w)),or=w=>Oe(zs(w)),La=w=>Oe(wa(w)),co=w=>Oe(gi(w)),Ni=w=>Oe(Ao(w)),Ws=w=>Oe(function(d){const f=d.value,j=d.style,I=d.styleSpec,O=I.snow;if(f===void 0)return[];if(!i.H(f))return[new i.V("snow",f,`object expected, ${i.K(f)} found`)];let F=[];for(const B in f){const W=B.match(/^(.*)-transition$/);F=F.concat(W&&O[W[1]]&&O[W[1]].transition?mn({key:B,value:f[B],valueSpec:I.transition,style:j,styleSpec:I}):O[B]?mn({key:B,value:f[B],valueSpec:O[B],style:j,styleSpec:I}):[new i.a3(B,f[B],`unknown property "${B}"`)])}return F}(w)),Yi=w=>Oe(function(d){const f=d.value,j=d.style,I=d.styleSpec,O=I.rain;if(f===void 0)return[];if(!i.H(f))return[new i.V("rain",f,`object expected, ${i.K(f)} found`)];let F=[];for(const B in f){const W=B.match(/^(.*)-transition$/);F=F.concat(W&&O[W[1]]&&O[W[1]].transition?mn({key:B,value:f[B],valueSpec:I.transition,style:j,styleSpec:I}):O[B]?mn({key:B,value:f[B],valueSpec:O[B],style:j,styleSpec:I}):[new i.a3(B,f[B],`unknown property "${B}"`)])}return F}(w)),mc=w=>Oe(ns(w)),bo=w=>Oe(zt(w)),pc=w=>Oe(Zr(w)),nt=w=>Oe($r(w)),ye=w=>Oe(i.a7(w));function Oe(w){return w.slice().sort((d,f)=>d.line&&f.line?d.line-f.line:0)}function Ye(w,d){let f=!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))),f=!0);return f}const St=i.a6.light;let wt;class It extends i.E{constructor(d,f="flat"){super(),this._transitionable=new i.a8(wt||(wt=new i.a9({anchor:new i.aa(St.anchor),position:new i.ab(St.position),color:new i.aa(St.color),intensity:new i.aa(St.intensity)}))),this.setLight(d,f),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(d,f,j={}){this._validate(or,d,j)||(this._transitionable.setTransitionOrValue(d),this.id=f)}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,f,j){return(!j||j.validate!==!1)&&Ye(this,d.call($n,Object.assign({value:f,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}}const qt=i.a6.terrain;let Lt=class extends i.E{constructor(w,d,f,j,I){super(),this.scope=f,this._transitionable=new i.a8(new i.a9({source:new i.aa(qt.source),exaggeration:new i.aa(qt.exaggeration)}),f,j),this._transitionable.setTransitionOrValue(w,j),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=d,this.worldview=I}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 f=-1,j=-1,I=1;for(const O of d.zoomStops)I=d.evaluate(new i.ac(O,{worldview:this.worldview})),I>.01?(f=O,j=-1):j=O;return I<.01&&f>0&&j>f?[f,j]:null}isZoomDependent(){const w=this._transitionable._values.exaggeration;return w!=null&&w.value!=null&&w.value.expression!=null&&w.value.expression instanceof i.ad}};const Wt=45,pr=65,cr=.05;function Qr(w,d,f,j){const I=i.ah(Wt,pr,f),[O,F]=Ms(w,j);let B=1-Math.min(1,Math.exp((d-O)/(F-O)*-6));return B*=B*B,B=Math.min(1,1.00747*B),B*I*w.alpha}function Ms(w,d){const f=.5/Math.tan(.5*d);return[w.range[0]+f,w.range[1]+f]}function Kr(w,d,f,j,I){const O=i.af([],[d,f,j],I.mercatorFogMatrix);return Qr(w,i.ag(O),I.pitch,I._fov)}function dn(w,d,f,j,I,O,F){const B=[[f,j,0],[I,j,0],[I,O,0],[f,O,0]];let W=Number.MAX_VALUE,J=-Number.MAX_VALUE;for(const te of B){const me=i.af([],te,d),ue=i.ag(me);W=Math.min(W,ue),J=Math.max(J,ue)}return[Qr(w,W,F.pitch,F._fov),Qr(w,J,F.pitch,F._fov)]}const un=i.a6.fog;class nn extends i.E{constructor(d,f,j,I){super();const O=new i.a9({range:new i.aa(un.range),color:new i.aa(un.color),"color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"high-color":new i.aa(un["high-color"]),"high-color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"space-color":new i.aa(un["space-color"]),"space-color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new i.aa(un["horizon-blend"]),"star-intensity":new i.aa(un["star-intensity"]),"vertical-range":new i.aa(un["vertical-range"])});this._transitionable=new i.a8(O,j,new Map(I)),this.set(d,I),this._transitioning=this._transitionable.untransitioned(),this._transform=f,this.properties=new i.ai(O),this.scope=j}get state(){const d=this._transform,f=d.projection.name==="globe",j=i.aj(d.zoom),I=this.properties.get("range"),O=[.5,3];return{range:f?[i.ak(O[0],I[0],j),i.ak(O[1],I[1],j)]:I,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(d,f,j={}){if(this._validate(Ni,d,j))return;const I=Object.assign({},d);for(const O of Object.keys(un))I[O]===void 0&&(I[O]=un[O].default);this._options=I,this._transitionable.setTransitionOrValue(this._options,f)}getOpacity(d){if(!this._transform.projection.supportsFog)return 0;const f=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:i.ah(Wt,pr,d))*f.a}getOpacityAtLatLng(d,f){return this._transform.projection.supportsFog?function(j,I,O){const F=i.ae.fromLngLat(I),B=O.elevation?O.elevation.getAtPointOrZero(F):0;return Kr(j,F.x,F.y,B,O)}(this.state,d,f):0}getOpacityForTile(d){if(!this._transform.projection.supportsFog)return[1,1];const f=this._transform.calculateFogTileMatrix(d.toUnwrapped());return dn(this.state,f,0,0,i.al,i.al,this._transform)}getOpacityForBounds(d,f,j,I,O){return this._transform.projection.supportsFog?dn(this.state,d,f,j,I,O,this._transform):[1,1]}getFovAdjustedRange(d){return this._transform.projection.supportsFog?Ms(this.state,d):[0,1]}isVisibleOnFrustum(d){if(!this._transform.projection.supportsFog)return!1;const f=[4,5,6,7];for(const j of f){const I=d.points[j];let O;if(I[2]>=0)O=I;else{const F=d.points[j-4];O=i.am(F,I,F[2]/(F[2]-I[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,f,j){return(!j||j.validate!==!1)&&Ye(this,d.call($n,Object.assign({value:f,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}}let Gn,qi,So,ja,Eo=class extends i.E{constructor(w,d,f,j){super();const I=Gn||(Gn=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(I,f,new Map(j)),this.set(w,j),this._transitioning=this._transitionable.untransitioned(),this.properties=new i.ai(I),this.scope=f}get state(){const w=this.properties.get("opacity"),d=this.properties.get("color"),f=this.properties.get("direction"),j=i.an(f[0]),I=-Math.max(i.an(f[1]),.01),O=[Math.cos(j)*Math.cos(I),Math.sin(j)*Math.cos(I),Math.sin(I)],F=this.properties.get("vignette"),B=this.properties.get("vignette-color");return B.a=F,{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,f={}){if(this._validate(Ws,w,f))return;const j=Object.assign({},w),I=i.a6.snow;for(const O of Object.keys(I))j[O]===void 0&&(j[O]=I[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,f){return(!f||f.validate!==!1)&&Ye(this,w.call($n,Object.assign({value:d,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}},Li=class extends i.E{constructor(w,d,f,j){super();const I=qi||(qi=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(I,f,new Map(j)),this.set(w,j),this._transitioning=this._transitionable.untransitioned(),this.properties=new i.ai(I),this.scope=f}get state(){const w=this.properties.get("opacity"),d=this.properties.get("color"),f=this.properties.get("direction"),j=i.an(f[0]),I=-Math.max(i.an(f[1]),.01),O=[Math.cos(j)*Math.cos(I),Math.sin(j)*Math.cos(I),Math.sin(I)],F=this.properties.get("vignette-color");return F.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:F}}get(){return this._transitionable.serialize()}set(w,d,f={}){if(this._validate(Yi,w,f))return;const j=Object.assign({},w),I=i.a6.rain;for(const O of Object.keys(I))j[O]===void 0&&(j[O]=I[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,f){return(!f||f.validate!==!1)&&Ye(this,w.call($n,Object.assign({value:d,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}};class aa extends i.E{constructor(d,f,j,I){super(),this.scope=j,this._options=d,this.properties=new i.ai(f),this._transitionable=new i.a8(f,j,new Map(I)),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,f){this._options=d,this._transitionable.setTransitionOrValue(d.properties,f)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}class Oi{constructor(d,f,j){this.screenBounds=d,this.cameraPoint=j.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=f,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,j)}static createFromScreenPoints(d,f){let j,I;if(d instanceof i.P||typeof d[0]=="number"){const O=i.P.convert(d);j=[O],I=f.isPointAboveHorizon(O)}else{const O=i.P.convert(d[0]),F=i.P.convert(d[1]),B=O.add(F)._div(2);j=[O,F],I=i.aq(O,F).every(W=>f.isPointAboveHorizon(W))&&f.isPointAboveHorizon(B)}return new Oi(j,I,f)}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 f=this.screenBounds[0],j=this.screenBounds.length===1?this.screenBounds[0].add(new i.P(1,1)):this.screenBounds[1],I=i.aq(f,j,0,!1);return this.cameraPoint.y>j.y&&(this.cameraPoint.x>f.x&&this.cameraPoint.x=j.x?I[2]=this.cameraPoint:this.cameraPoint.x<=f.x&&(I[3]=this.cameraPoint)),i.ar(I,d)}bufferedCameraGeometryGlobe(d){const f=this.screenBounds[0],j=this.screenBounds.length===1?this.screenBounds[0].add(new i.P(1,1)):this.screenBounds[1],I=i.aq(f,j,d),O=this.cameraPoint.clone();switch(3*((O.y>f.y)+(O.y>j.y))+((O.x>f.x)+(O.x>j.x))){case 0:I[0]=O,I[4]=O.clone();break;case 1:I.splice(1,0,O);break;case 2:I[1]=O;break;case 3:I.splice(4,0,O);break;case 5:I.splice(2,0,O);break;case 6:I[3]=O;break;case 7:I.splice(3,0,O);break;case 8:I[2]=O}return I}containsTile(d,f,j,I=0){const O=Math.max(d.queryPadding,d.evaluateQueryRenderedFeaturePadding())/f._pixelsPerMercatorPixel+1,F=j?this._bufferedCameraMercator(O,f):this._bufferedScreenMercator(O,f);let B=d.tileID.wrap+(F.unwrapped?I:0);const W=F.polygon.map(Fe=>i.as(d.tileTransform,Fe,B));if(!i.at(W,0,0,i.al,i.al))return;B=d.tileID.wrap+(this.screenGeometryMercator.unwrapped?I:0);const J=this.screenGeometryMercator.polygon.map(Fe=>i.au(d.tileTransform,Fe,B)),te=J.map(Fe=>new i.P(Fe[0],Fe[1])),me=f.getFreeCameraOptions().position||new i.ae(0,0,0),ue=i.au(d.tileTransform,me,B),pe=J.map(Fe=>{const Re=i.av(Fe,Fe,ue);return i.aw(Re,Re),new i.ax(ue,Re)}),ke=i.ay(d,1,f.zoom)*f._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:te,tilespaceRays:pe,bufferedTilespaceGeometry:W,bufferedTilespaceBounds:(_e=i.az(W),_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,f){const j=Di(d);if(this._screenRaycastCache[j])return this._screenRaycastCache[j];{let I;return I=f.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(d),f):{polygon:this.bufferedScreenGeometry(d).map(O=>f.pointCoordinate3D(O)),unwrapped:!0},this._screenRaycastCache[j]=I,I}}_bufferedCameraMercator(d,f){const j=Di(d);if(this._cameraRaycastCache[j])return this._cameraRaycastCache[j];{let I;return I=f.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(d),f):{polygon:this.bufferedCameraGeometry(d).map(O=>f.pointCoordinate3D(O)),unwrapped:!0},this._cameraRaycastCache[j]=I,I}}_projectAndResample(d,f){const j=function(O,F){const B=i.aB([],F.pixelMatrix,F.globeMatrix),W=[0,-i.aD,0,1],J=[0,i.aD,0,1],te=[0,0,0,1];i.aC(W,W,B),i.aC(J,J,B),i.aC(te,te,B);const me=new i.P(W[0]/W[3],W[1]/W[3]),ue=new i.P(J[0]/J[3],J[1]/J[3]),pe=i.aE(O,me)&&W[3]1?Ka(O.slice(0,Fe),F):[],at=Fenew i.P(Dn(bt.x),bt.y)),at=at.map(bt=>new i.P(Dn(bt.x),bt.y));const Ge=[...We];Ge.length===0&&Ge.push(at[at.length-1]);const kt=i.ak(Ge[Ge.length-1].y,(at.length===0?We[0]:at[0]).y,Re);let yt;return yt=pe?[new i.P(0,kt),new i.P(0,0),new i.P(1,0),new i.P(1,kt)]:[new i.P(1,kt),new i.P(1,1),new i.P(0,1),new i.P(0,kt)],Ge.push(...yt),at.length===0?Ge.push(We[0]):Ge.push(...at),{polygon:Ge.map(bt=>new i.ae(bt.x,bt.y)),unwrapped:!1}}(d,f);if(j)return j;const I=function(O,F){let B=!1,W=-1/0,J=0;for(let me=0;meW&&(W=O[me].x,J=me);for(let me=0;me.5&&(pe.x{me.x-=1}),{polygon:O,unwrapped:B}}(Ka(d,f).map(O=>new i.P(Dn(O.x),O.y)),f);return{polygon:I.polygon.map(O=>new i.ae(O.x,O.y)),unwrapped:I.unwrapped}}}function Ka(w,d){return i.aG(w,f=>{const j=d.pointCoordinate3D(f);f.x=j.x,f.y=j.y},1/256)}function Dn(w){return w<0?1+w%1:w%1}function Di(w){return 100*w|0}function wl(w,d,f,j,I){const O=function(B,W){if(B)return I(B);if(W){if(w.url&&W.tiles&&w.tiles&&delete w.tiles,W.variants){if(!Array.isArray(W.variants))return I(new Error("variants must be an array"));for(const te of W.variants){if(te==null||typeof te!="object"||te.constructor!==Object)return I(new Error("variant must be an object"));if(!Array.isArray(te.capabilities))return I(new Error("capabilities must be an array"));if(te.capabilities.length===1&&te.capabilities[0]==="meshopt"){W=Object.assign(W,te);break}}}const J=i.aH(Object.assign({},W,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),I(null,J)}},F=function(B,W,J){if(!B)return null;if(!W&&!J)return B;J=J||B.worldview_default;const te=Object.values(B.language||{});if(te.length===0)return null;const me=Object.values(B.worldview||{});if(me.length===0)return null;const ue=te.every(ke=>ke===W),pe=me.every(ke=>ke===J);return ue&&pe?B:W in(B.language_options||{})||J in(B.worldview_options||{})?null:B.language_options&&B.worldview_options?B:null}(w.data,f,j);return F?i.o.frame(()=>O(null,F)):w.url?i.m(d.transformRequest(d.normalizeSourceURL(w.url,null,f,j),i.R.Source),O):i.o.frame(()=>{const{data:B,...W}=w;O(null,W)})}function Pl(w,d){const f=Math.pow(2,d.z),j=Math.floor(i.aF(w.getWest())*f),I=Math.floor(i.aJ(w.getNorth())*f),O=Math.ceil(i.aF(w.getEast())*f),F=Math.ceil(i.aJ(w.getSouth())*f);return d.x>=j&&d.x=I&&d.ythis.maxzoom||d.z{if(this._tileJSONRequest=null,this._loaded=!0,I)f&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${f}`),j&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${j}`),this.fire(new i.y(I));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 F of O.vector_layers)this.vectorLayerIds.push(F.id),O.worldview&&O.worldview[F.source]&&this.localizableLayerIds.add(F.id)}this.tileBounds=Xc.fromTileJSON(O),we(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(I)})}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,f){const j=d.tileID.canonical.url(this.tiles,this.scheme),I=this.map._requestManager.normalizeTileURL(j),O=this.map._requestManager.transformRequest(I,i.R.Tile),F=this.map.style?this.map.style.getLut(this.scope):null,B=F?{image:F.image.clone()}:null,W={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)&&(W.localizableLayerIds=this.localizableLayerIds),W.request.collectResourceTiming=this._collectResourceTiming,d.actor&&d.state!=="expired")d.state==="loading"?d.reloadCallback=f:d.request=d.actor.send("reloadTile",W,J.bind(this));else if(d.actor=this._tileWorkers[I]=this._tileWorkers[I]||this.dispatcher.getActor(),this.dispatcher.ready)d.request=d.actor.send("loadTile",W,J.bind(this),void 0,!0);else{const te=i.aL.call({deduped:this._deduped},W,(me,ue)=>{if(me||!ue)J.call(this,me);else{const pe=i.aM(ue.responseHeaders);W.data={rawData:ue.rawData.slice(0),expires:pe.expires,cacheControl:pe.cacheControl},d.actor&&d.actor.send("loadTile",W,J.bind(this),void 0,!0)}},!0);d.request={cancel:te}}function J(te,me){return delete d.request,d.aborted?f(null):te&&te instanceof i.aN&&te.status!==404?f(te):(me&&me.resourceTiming&&(d.resourceTiming=me.resourceTiming),this.map._refreshExpiredTiles&&me&&d.setExpiryData(me),d.loadVectorData(me,this.map.painter),i.aO(this.dispatcher),f(null,me),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,f){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 Xo extends i.E{constructor(d,f,j,I){super(),this.id=d,this.dispatcher=j,this.setEventedParent(I),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"},f),Object.assign(this,i.aH(f,["url","scheme","tileSize"]))}load(d){this._loaded=!1,this.fire(new i.z("dataloading",{dataType:"source"}));const f=this.map.getWorldview();this._tileJSONRequest=wl(this._options,this.map._requestManager,null,f,(j,I)=>{this._tileJSONRequest=null,this._loaded=!0,j?this.fire(new i.y(j)):I&&(Object.assign(this,I),I.raster_layers&&(this.rasterLayers=I.raster_layers,this.rasterLayerIds=this.rasterLayers.map(O=>O.id)),this.tileBounds=Xc.fromTileJSON(I),we(I.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,f){const j=i.o.devicePixelRatio>=2,I=this.map._requestManager.normalizeTileURL(d.tileID.canonical.url(this.tiles,this.scheme),j,this.tileSize);d.request=i.n(this.map._requestManager.transformRequest(I,i.R.Tile),(O,F,B)=>{if(delete d.request,d.aborted)return d.state="unloaded",f(null);if(O)return d.state="errored",f(O);if(!F)return f(null);const W=i.aM(B);this.map._refreshExpiredTiles&&d.setExpiryData(W),d.setTexture(F,this.map.painter),d.state="loaded",i.aO(this.dispatcher),f(null)})}abortTile(d,f){d.request&&(d.request.cancel(),delete d.request),f&&f()}unloadTile(d,f){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(),f&&f()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function Hd([w,d],f,j,{scaled:I=!0}={}){const{tileSize:O,buffer:F}=j,{x:B,y:W,z:J}=f;if(!isFinite(B)||!isFinite(W)||!isFinite(J))throw new Error("Invalid MRT header");const te=2**J,me=te*i.aF(w),ue=te*i.aJ(d);return function([pe,ke],_e,{scaled:Fe=!0}={}){if(!_e)throw new Error("bandView is undefined");const{data:Re,tileSize:We,buffer:at,offset:Ge,scale:kt,dimension:yt}=_e;if(pe<-at||pe>We+at||ke<-at||ke>We+at)throw new Error(`Point (${pe}, ${ke}) out of bounds for tileSize=${We}, buffer=${at}`);const bt=(ke+at)*(We+2*at)+(pe+at);if(new Uint32Array(Re.buffer)[bt]===4294967295)return null;let ft=[];ft=Fe?[]:new _e.data.constructor(yt);for(let ht=0;ht{if(delete d.request,d.aborted)return d.state="unloaded",f(null);if(B)return B.name==="AbortError"?void 0:(d.state="errored",f(B));if(this.map._refreshExpiredTiles&&W){const te=i.aM(J);d.setExpiryData(te)}if(this.partial&&d.state!=="expired")d.state="empty";else if(!this.partial){if(!W)return f(null);d.state="loaded",d._isHeaderLoaded=!0,d._mrt=W}f(null)};d.request=this.partial?d.fetchHeader(void 0,F.bind(this)):d.actor.send("loadTile",O,F.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,f){const j=d.texturePerLayer;if(d.flushAllQueues(),j.size){d.destroy(!1);for(const I of j.values())this.map.painter.saveTileTexture(I)}else d.destroy()}prepareTile(d,f,j,I){d._isHeaderLoaded&&(d.state!=="empty"&&(d.state="reloading"),d.fetchBandForRender(f,j,I,(O,F)=>{if(O)return d.state="errored",this.fire(new i.y(O)),void this.triggerRepaint(d);F&&(d._isHeaderLoaded=!0,d.setTexturePerLayer(j,F,this.map.painter),d.state="loaded",this.triggerRepaint(d))}))}getInitialBand(d){if(!this.rasterLayers)return 0;const f=this.rasterLayers.find(({id:O})=>O===d),j=f&&f.fields,I=j&&j.bands&&j.bands;return I?I[0]:0}getTextureDescriptor(d,f,j){if(!d)return;const I=f.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!I)return;let O=null;f instanceof i.aR?O=f.paint.get("raster-array-band"):f instanceof i.aS&&(O=f.paint.get("raster-particle-array-band"));const F=O||this.getInitialBand(I);if(F==null)return;if(!d.textureDescriptorPerLayer.get(f.id))return void this.prepareTile(d,I,f.id,F);if(d.updateNeeded(f.id,F)&&!j)return;const B=d.textureDescriptorPerLayer.get(f.id);return Object.assign({},B,{texture:d.texturePerLayer.get(f.id)})}getImages(d,f){const j=new Map;for(const I of d)for(const O of f){const[F,B]=O.split("/"),W=I.getLayer(F);if(!W||!W.hasBand(B)||!W.hasDataForBand(B))continue;const{bytes:J,tileSize:te,buffer:me}=W.getBandView(B),ue=te+2*me,pe={data:new i.q({width:ue,height:ue},J),pixelRatio:2,sdf:!1,usvg:!1,version:0};j.set(O,pe)}return j}queryRasterArrayValueByBandId(d,f,j){const I=f._mrt;return new Promise(O=>{const F={},B=new Set;for(const[W,J]of Object.entries(I.layers)){if(j.layerName&&W!==j.layerName)continue;const te={};F[W]=te;for(const{bands:me}of J.dataIndex)for(const ue of me)j.bands&&!j.bands.includes(ue)||(B.add(i.B(W,ue)),f.fetchBand(W,null,ue,pe=>{i.o.frame(()=>{te[ue]=pe?null:Hd([d.lng,d.lat],I,J.getBandView(ue)),B.delete(i.B(W,ue)),B.size===0&&O(F)})},!1))}B.size===0&&O(F)})}_loadTileForQuery(d,f){if(this._loadTileLoaded[d.uid])return void f(null,d._mrt);if(this._loadTilePending[d.uid])return void this._loadTilePending[d.uid].push(f);this._loadTilePending[d.uid]=[f];const j=this.map._requestManager.normalizeTileURL(d.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),I=this.map._requestManager.transformRequest(j,i.R.Tile);d.actor.send("loadTile",{request:I,uid:d.uid,tileID:d.tileID,type:this.type,source:this.id,scope:this.scope,partial:!1},(O,F,B)=>{if(O)return this._loadTilePending[d.uid].forEach(W=>W(O,null)),void delete this._loadTilePending[d.uid];if(!F)return this._loadTilePending[d.uid].forEach(W=>W(null,null)),void delete this._loadTilePending[d.uid];if(this.map._refreshExpiredTiles&&F){const W=i.aM(B);d.setExpiryData(W)}d._mrt=F,d._isHeaderLoaded=!0,d.state="loaded",this._loadTilePending[d.uid].forEach(W=>W(null,F)),this._loadTileLoaded[d.uid]=!0,delete this._loadTilePending[d.uid]},void 0,!0)}queryRasterArrayValueByAllBands(d,f,j){return new Promise((I,O)=>{this._loadTileForQuery(f,(F,B)=>{F?O(F):I(B?this.queryRasterArrayValueByBandId(d,f,j):null)})})}queryRasterArrayValue(d,f){const j=i.aT.convert(d),I=this.findLoadedParent(j);return I&&I._mrt?f.bands||!this.partial?this.queryRasterArrayValueByBandId(j,I,f):this.queryRasterArrayValueByAllBands(j,I,f):Promise.resolve(null)}findLoadedParent(d){const f=i.ae.fromLngLat(d,this.map.transform.tileSize),j=this.maxzoom+1,I=1<0&&(B[new i.aQ(w.overscaledZ,I,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,F,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&&I&&I.resourceTiming&&I.resourceTiming[this.id]&&(O.resourceTiming=I.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 f=w.actor?"reloadTile":"loadTile";w.actor=this.actor;const j=this.map.style?this.map.style.getLut(this.scope):null,I=j?{image:j.image.clone()}:null,O=this._partialReload,F={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:I,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(f,F,(B,W)=>O&&!W?(w.state="loaded",d(null)):(delete w.request,w.destroy(!1),w.aborted?d(null):B?d(B):(w.loadVectorData(W,this.map.painter,f==="reloadTile"),d(null))),void 0,f==="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,f,j){super(w,d,f,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,f)=>{this._loaded=!0,d?this.fire(new i.y(d)):f&&(this.video=f,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,f,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=f,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,f=this.map.getWorldview();this._tileJSONRequest=wl(this._options,this.map._requestManager,d,f,(j,I)=>{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}`),f&&f.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${f}`),this.fire(new i.y(j))):I&&(Object.assign(this,I),I.bounds&&(this.tileBounds=new Xc(I.bounds,this.minzoom,this.maxzoom)),we(I.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 f=this.map._requestManager.normalizeTileURL(w.tileID.canonical.url(this.tiles,this.scheme)),j={request:this.map._requestManager.transformRequest(f,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 F of O)F.dirty=!0;return void(w.state="loaded")}w.request=w.actor.send("reloadTile",j,I.bind(this))}else w.actor=this.dispatcher.getActor(),w.request=w.actor.send("loadTile",j,I.bind(this),void 0,!0);function I(O,F){return w.aborted?d(null):O&&O.status!==404?d(O):(this.map._refreshExpiredTiles&&F&&w.setExpiryData(F),w.loadModelData(F,this.map.painter),w.state="loaded",void d(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends i.aU{constructor(w,d,f,j){super(w,d,f,j),d.coordinates?Array.isArray(d.coordinates)&&d.coordinates.length===4&&!d.coordinates.some(I=>!Array.isArray(I)||I.length!==2||I.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,f,j){super(),this.id=w,this.type="custom",this._dataType="raster",this._dispatcher=f,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:f,z:j}=w.canonical;return this._implementation.hasTile({x:d,y:f,z:j})}return!this.tileBounds||this.tileBounds.contains(w.canonical)}loadTile(w,d){const{x:f,y:j,z:I}=w.tileID.canonical,O=new AbortController;w.request=Promise.resolve(this._implementation.loadTile({x:f,y:j,z:I},{signal:O.signal})).then((function(F){return delete w.request,w.aborted?(w.state="unloaded",d(null)):F===void 0?(w.state="errored",d(null)):F===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}(F)?(this.loadTileData(w,F),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(F=>{F.name!=="AbortError"&&(w.state="errored",d(F))}),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:f,y:j,z:I}=w.tileID.canonical;this._implementation.unloadTile({x:f,y:j,z:I})}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"}))}}},Qo=function(w,d,f,j){const I=new mh[d.type](w,d,f,j);if(I.id!==w)throw new Error(`Expected Source id to be ${w} instead of ${I.id}`);return i.aY(["load","abort","unload","serialize","prepare"],I),I};function Mp(w,d,f=""){return`${f}:${d.id||""}:${d.layer.id}:${function(j){if("layerId"in j)return`layer:${j.layerId}`;{const{featuresetId:I,importId:O}=j;return`featureset:${I}${O?`:import:${O}`:""}`}}(w.target)}`}function Kf(w,d,f,j=""){if(w.uniqueFeatureID){const I=Mp(w,d,j);if(f.has(I))return!0;f.add(I)}return!1}function Yy(w,d,f,j,I=!1){const O=d.sourceCache.transform,F=d.sourceCache.tilesIn(w,d.has3DLayers,I);F.sort(Vh);const B=[];for(const W of F){const J=W.tile.queryRenderedFeatures(d,W,f,j,O,I);Object.keys(J).length&&B.push({wrappedTileID:W.tile.tileID.wrapped().key,queryResults:J})}for(const W in d.layers){const J=d.layers[W];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(W){const J={},te={};for(const me of W){const ue=me.queryResults,pe=me.wrappedTileID,ke=te[pe]=te[pe]||{};for(const _e in ue){const Fe=ue[_e],Re=ke[_e]=ke[_e]||{},We=J[_e]=J[_e]||[];for(const at of Fe)Re[at.featureIndex]||(Re[at.featureIndex]=!0,We.push(at))}}return J}(B)}function Xy(w,d,f,j,I,O){const F={},B=j.queryRenderedSymbols(w),W=[];for(const J of Object.keys(B).map(Number))W.push(I[J]);W.sort(Vh);for(const J of W){const te=J.featureIndex.lookupSymbolFeatures(B[J.bucketInstanceId],J.bucketIndex,J.sourceLayerIndex,d,f,O);for(const me in te){const ue=F[me]=F[me]||[],pe=te[me];pe.sort((ke,_e)=>{const Fe=J.featureSortOrder;if(Fe){const Re=Fe.indexOf(ke.featureIndex);return Fe.indexOf(_e.featureIndex)-Re}return _e.featureIndex-ke.featureIndex});for(const ke of pe)ue.push(ke)}}return F}function Qy(w,d){const f=w.getRenderableIds().map(O=>w.getTileByID(O)),j=[],I={};for(let O=0;Od.getLayer(O)).filter(Boolean);if(I.length!==0){j.layers=I,j.stateDependentLayerIds&&(j.stateDependentLayers=j.stateDependentLayerIds.map(O=>I.filter(F=>F.id===O)[0]));for(const O of I)f[O.fqid]=j}}return f}const Qc=32,lu=33,gc=new Uint16Array(8184);for(let w=0;w<2046;w++){let d=w+2,f=0,j=0,I=0,O=0,F=0,B=0;for(1&d?I=O=F=Qc:f=j=B=Qc;(d>>=1)>1;){const J=f+I>>1,te=j+O>>1;1&d?(I=f,O=j,f=F,j=B):(f=I,j=O,I=F,O=B),F=J,B=te}const W=4*w;gc[W+0]=f,gc[W+1]=j,gc[W+2]=I,gc[W+3]=O}const Jc=new Uint16Array(2178),Wo=new Uint8Array(1089),Pu=new Uint16Array(1089);function Hh(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 Tp{constructor(d,f,j,I,O,F){this.tileID=d,this.uid=i.b2(),this.uses=0,this.tileSize=f,this.tileZoom=j,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=O,I&&I.style&&(this._lastUpdatedBrightness=I.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",I&&I.transform&&(this.projection=I.transform.projection),this.worldview=F,this._hasAppearances=null}registerFadeDuration(d){const f=d+this.timeAdded;fj)I=!1;else if(f)if(this.expirationTimej.appearances&&j.appearances.length>0))return!0;return!1}updateBuckets(d,f){if(!this.latestFeatureIndex||!d.style)return;const j=d.style.listImages(),I=d.style.getBrightness();for(const O in this.buckets){if(!d.style.hasLayer(O))continue;const F=this.buckets[O],B=F.layers[0],W=B.sourceLayer||"_geojsonTileLayer",J=d.style.getLayerSourceCache(B);let te={};J&&(te=J._state.getState(W,void 0));const me=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},ue=Object.keys(te).length>0&&!f;F.hasAppearances=F.layers.some(_e=>_e.appearances&&_e.appearances.length>0);const pe=ue?F.stateDependentLayers:F.layers;if(ue&&F.stateDependentLayers.length!==0||f){const _e=this.latestFeatureIndex.loadVTLayers();F.update(te,_e[W],j,me,pe,f,I)}if(ue&&F.stateDependentLayers.length!==0||f||F.hasAppearances){const _e={zoom:d.transform.zoom,pitch:d.transform.pitch,brightness:d.style.getBrightness()||0,worldview:d.worldview};F.updateAppearances(this.tileID.canonical,te,j,_e)}(F instanceof i.ba||F instanceof i.bb)&&d._terrain&&d._terrain.enabled&&J&&F.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(F)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil=0;Fe--){const Re=4*Fe,We=gc[Re+0],at=gc[Re+1],Ge=gc[Re+2],kt=gc[Re+3],yt=We+Ge>>1,bt=at+kt>>1,ft=yt+bt-at,ht=bt+We-yt,Ct=at*lu+We,Rt=kt*lu+Ge,Dt=bt*lu+yt,Yt=Math.hypot((Jc[2*Ct+0]+Jc[2*Rt+0])/2-Jc[2*Dt+0],(Jc[2*Ct+1]+Jc[2*Rt+1])/2-Jc[2*Dt+1])>=16;Wo[Dt]=Wo[Dt]||(Yt?1:0),Fe<1022&&(Wo[Dt]=Wo[Dt]||Wo[(at+ht>>1)*lu+(We+ft>>1)]||Wo[(kt+ht>>1)*lu+(Ge+ft>>1)])}const me=new i.b1,ue=new i.b0;let pe=0;function ke(Fe,Re){const We=Re*lu+Fe;return Pu[We]===0&&(me.emplaceBack(Jc[2*We+0],Jc[2*We+1],Fe*i.al/Qc,Re*i.al/Qc),Pu[We]=++pe),Pu[We]-1}function _e(Fe,Re,We,at,Ge,kt){const yt=Fe+We>>1,bt=Re+at>>1;if(Math.abs(Fe-Ge)+Math.abs(Re-kt)>1&&Wo[bt*lu+yt])_e(Ge,kt,Fe,Re,yt,bt),_e(We,at,Ge,kt,yt,bt);else{const ft=ke(Fe,Re),ht=ke(We,at),Ct=ke(Ge,kt);ue.emplaceBack(ft,ht,Ct)}}return _e(0,0,Qc,Qc,Qc,0),_e(Qc,Qc,0,0,0,Qc),{vertices:me,indices:ue}}(this.tileID.canonical,f);I=F.vertices,O=F.indices}else{I=new i.b1,O=new i.b0;for(const{x:B,y:W}of j)I.emplaceBack(B,W,0,0);const F=i.bh(I.int16.subarray(0,4*I.length),void 0,4);for(let B=0;B0&&(W=i.bl(new Float64Array(16),f.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(d,I,f,F,W,B),this._makeGlobeTileDebugTextBuffer(d,I,f,F,W,B)}_globePoint(d,f,j,I,O,F,B){let W=i.bm(d,f,j);if(F){const J=1<.5?pe=-1:ue<-.5&&(pe=1);let ke=(d/i.al+j.x)/J+pe,_e=(f/i.al+j.y)/J;ke=(ke-te)*I._pixelsPerMercatorPixel+te,_e=(_e-me)*I._pixelsPerMercatorPixel+me;const Fe=[ke*I.worldSize,_e*I.worldSize,0];i.af(Fe,Fe,F),W=i.bn(W,Fe,B)}return i.af(W,W,O)}_makeGlobeTileDebugBorderBuffer(d,f,j,I,O,F){const B=new i.bd,W=new i.be,J=new i.bo,te=(ue,pe,ke,_e,Fe)=>{const Re=(ke-ue)/(Fe-1),We=(_e-pe)/(Fe-1),at=B.length;for(let Ge=0;Geme*pe+ke;for(let pe=0;pe{if(O)f(O);else try{const W=j.getHeaderLength(F);if(W>d)return void(this.request=this.fetchHeader(W,f));j.parseHeader(F),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);F.byteLength>=J&&(this.entireBuffer=F),f(null,this.entireBuffer||F,B)}catch(W){f(W)}}),this.request}fetchBandForRender(d,f,j,I){this.fetchBand(d,f,j,O=>{if(O)return void I(O);this.updateTextureDescriptor(d,f,j);const F=this.textureDescriptorPerLayer.get(f);I(null,F?F.img:null)})}fetchBand(d,f,j,I,O=!0){const F=this._mrt;if(!this._isHeaderLoaded||!F)return void I(new Error("Tile header is not ready"));const B=this.actor;if(!B)return void I(new Error("Can't fetch tile band without an actor"));let W;const J=i.B(String(j),i.B(this.tileID.key,d));let te=this._taskQueue.get(J);te?te.add(I):(te=new Set,te.add(I),this._taskQueue.set(J,te));const me=(_e,Fe)=>{W.complete(_e,Fe),_e?I(_e):(te.forEach(Re=>Re(null,Fe)),this._taskQueue.delete(J))},ue=(_e,Fe)=>{if(_e)return I(_e);const Re=B.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:Fe,task:W},me,void 0,!0);if(f!==null){const We=this._workQueuePerLayer.get(f)||[];We.push(()=>{Re&&Re.cancel(),W.cancel()}),this._workQueuePerLayer.has(f)||this._workQueuePerLayer.set(f,We)}};let pe;try{pe=F.getLayer(d)}catch(_e){if(this.state==="reloading")return;throw _e}if(!pe)return void I(new Error(`Unknown sourceLayer "${d}"`));if(pe.hasDataForBand(j))return te.forEach(_e=>_e(null,null)),void this._taskQueue.delete(J);const ke=pe.getDataRange([j]);if(W=F.createDecodingTask(ke),!W||W.tasks.length)if(f!==null&&this.flushQueues(f),this.entireBuffer)ue(null,this.entireBuffer.slice(ke.firstByte,ke.lastByte+1));else{const _e=Object.assign({},this.requestParams,{headers:{Range:`bytes=${ke.firstByte}-${ke.lastByte}`}}),Fe=i.bu(_e,ue);if(f!==null){const Re=this._fetchQueuePerLayer.get(f)||[];Re.push(()=>{Fe.cancel(),W.cancel()}),this._fetchQueuePerLayer.has(f)||this._fetchQueuePerLayer.set(f,Re)}}}updateNeeded(d,f){return(!this.textureDescriptorPerLayer.get(d)||this.textureDescriptorPerLayer.get(d).band!==f||this.refreshedUponExpiration)&&this.state!=="errored"}updateTextureDescriptor(d,f,j){if(!this._mrt)return;const I=this._mrt.getLayer(d);if(!I||!I.hasBand(j)||!I.hasDataForBand(j))return;const{bytes:O,tileSize:F,buffer:B,offset:W,scale:J}=I.getBandView(j),te=F+2*B,me=new i.q({width:te,height:te},O),ue=this.texturePerLayer.get(f);ue&&ue instanceof i.T&&ue.update(me,{premultiply:!1}),this.textureDescriptorPerLayer.set(f,{layer:d,band:j,img:me,buffer:B,offset:W,tileSize:F,format:I.pixelFormat,mix:[J,256*J,65536*J,16777216*J]})}destroy(d=!1){if(super.destroy(d),delete this._mrt,!d)for(const f of this.texturePerLayer.values())f&&f instanceof i.T&&f.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 hx{constructor(d,f){this.max=d,this.onRemove=f,this.reset()}reset(){for(const d in this.data)for(const f of this.data[d])f.timeout&&clearTimeout(f.timeout),this.onRemove(f.value);return this.data={},this.order=[],this}add(d,f,j){const I=d.wrapped().key;this.data[I]===void 0&&(this.data[I]=[]);const O={value:f,timeout:void 0};if(j!==void 0&&(O.timeout=setTimeout(()=>{this.remove(d,O)},j)),this.data[I].push(O),this.order.push(I),this.order.length>this.max){const F=this._getAndRemoveByKey(this.order[0]);F&&this.onRemove(F)}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 f=this.data[d].shift();return f.timeout&&clearTimeout(f.timeout),this.data[d].length===0&&delete this.data[d],this.order.splice(this.order.indexOf(d),1),f.value}getByKey(d){const f=this.data[d];return f?f[0].value:null}get(d){return this.has(d)?this.data[d.wrapped().key][0].value:null}remove(d,f){if(!this.has(d))return this;const j=d.wrapped().key,I=f===void 0?0:this.data[j].indexOf(f),O=this.data[j][I];return this.data[j].splice(I,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 f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}filter(d){const f=[];for(const j in this.data)for(const I of this.data[j])d(I.value)||f.push(I);for(const j of f)this.remove(j.value.tileID,j)}}class Ap{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(d,f,j){const I=String(f);if(this.stateChanges[d]=this.stateChanges[d]||{},this.stateChanges[d][I]=this.stateChanges[d][I]||{},Object.assign(this.stateChanges[d][I],j),this.deletedStates[d]===null){this.deletedStates[d]={};for(const O in this.state[d])O!==I&&(this.deletedStates[d][O]=null)}else if(this.deletedStates[d]&&this.deletedStates[d][I]===null){this.deletedStates[d][I]={};for(const O in this.state[d][I])j[O]||(this.deletedStates[d][I][O]=null)}else for(const O in j)this.deletedStates[d]&&this.deletedStates[d][I]&&this.deletedStates[d][I][O]===null&&delete this.deletedStates[d][I][O]}removeFeatureState(d,f,j){if(this.deletedStates[d]===null)return;const I=String(f);if(this.deletedStates[d]=this.deletedStates[d]||{},j&&f!==void 0)this.deletedStates[d][I]!==null&&(this.deletedStates[d][I]=this.deletedStates[d][I]||{},this.deletedStates[d][I][j]=null);else if(f!==void 0)if(this.stateChanges[d]&&this.stateChanges[d][I])for(j in this.deletedStates[d][I]={},this.stateChanges[d][I])this.deletedStates[d][I][j]=null;else this.deletedStates[d][I]=null;else this.deletedStates[d]=null}getState(d,f){const j=this.state[d]||{},I=this.stateChanges[d]||{},O=this.deletedStates[d];if(O===null)return{};if(f!==void 0){const B=String(f),W=Object.assign({},j[B],I[B]);if(O){const J=O[f];if(J===null)return{};for(const te in J)delete W[te]}return W}const F=Object.assign({},j,I);if(O)for(const B in O)delete F[B];return F}initializeTileState(d,f){d.refreshFeatureState(f)}coalesceChanges(d,f){const j={};for(const I in this.stateChanges){this.state[I]=this.state[I]||{};const O={};for(const F in this.stateChanges[I])this.state[I][F]||(this.state[I][F]={}),Object.assign(this.state[I][F],this.stateChanges[I][F]),O[F]=this.state[I][F];j[I]=O}for(const I in this.deletedStates){this.state[I]=this.state[I]||{};const O={};if(this.deletedStates[I]===null)for(const F in this.state[I])O[F]={},this.state[I][F]={};else for(const F in this.deletedStates[I]){if(this.deletedStates[I][F]===null)this.state[I][F]={};else if(this.state[I][F])for(const B of Object.keys(this.deletedStates[I][F]))delete this.state[I][F][B];O[F]=this.state[I][F]}j[I]=j[I]||{},Object.assign(j[I],O)}if(this.stateChanges={},this.deletedStates={},Object.keys(j).length!==0)for(const I in d)d[I].refreshFeatureState(f)}}class bd extends i.E{constructor(d,f,j){super(),this.id=d,this._onlySymbols=j,f.on("data",I=>{I.dataType==="source"&&I.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&I.dataType==="source"&&I.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),f.on("error",()=>{this._sourceErrored=!0}),this._source=f,this._tiles={},this._cache=new hx(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=f.minTileCacheSize,this._maxTileCacheSize=f.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Ap,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,f){return d.isSymbolTile=this._onlySymbols,d.isExtraShadowCaster=this._shadowCasterTiles[d.tileID.key],this._source.loadTile(d,f)}_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 f in this._tiles){const j=this._tiles[f];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,f){const j=[];for(const I in this._tiles)this._isIdRenderable(+I,d,f)&&j.push(this._tiles[I]);return d?j.sort((I,O)=>{const F=I.tileID,B=O.tileID,W=new i.P(F.canonical.x,F.canonical.y)._rotate(this.transform.angle),J=new i.P(B.canonical.x,B.canonical.y)._rotate(this.transform.angle);return F.overscaledZ-B.overscaledZ||J.y-W.y||J.x-W.x}).map(I=>I.tileID.key):j.map(I=>I.tileID).sort(e0).map(I=>I.key)}hasRenderableParent(d){const f=this.findLoadedParent(d,0);return!!f&&this._isIdRenderable(f.tileID.key)}_isIdRenderable(d,f,j){return this._tiles[d]&&this._tiles[d].hasData()&&!this._coveredTiles[d]&&(f||!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,f){const j=this._tiles[d];j&&(j.state!=="loading"&&(j.state=f),this._loadTile(j,this._tileLoaded.bind(this,j,d,f)))}_tileLoaded(d,f,j,I,O){if(I){if(d.state="errored",I.status!==404)this._source.fire(new i.y(I,{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(f,d),this._source.type==="raster-dem"&&d.dem&&this._backfillDEM(d),this._state.initializeTileState(d,this.map?this.map.painter:null);let F=new Map;O&&O.responseHeaders&&(F=O.responseHeaders),this._source.fire(new i.z("data",{dataType:"source",tile:d,coord:d.tileID,sourceCacheId:this.id,responseHeaders:F}))}_backfillDEM(d){const f=this.getRenderableIds();for(let I=0;I1||(Math.abs(F)>1&&(Math.abs(F+W)===1?F+=W:Math.abs(F-W)===1&&(F-=W)),O.dem&&I.dem&&(I.dem.backfillBorder(O.dem,F,B),I.neighboringTiles&&I.neighboringTiles[J]&&(I.neighboringTiles[J].backfilled=!0)))}}getTile(d){return this.getTileByID(d.key)}getTileByID(d){return this._tiles[d]}_retainLoadedChildren(d,f,j,I){for(const O in this._tiles){let F=this._tiles[O];if(I[O]||!F.hasData()||F.tileID.overscaledZ<=f||F.tileID.overscaledZ>j)continue;let B=F.tileID;for(;F&&F.tileID.overscaledZ>f+1;){const J=F.tileID.scaledTo(F.tileID.overscaledZ-1);F=this._tiles[J.key],F&&F.hasData()&&(B=J)}let W=B;for(;W.overscaledZ>f;)if(W=W.scaledTo(W.overscaledZ-1),d[W.key]){I[B.key]=B;break}}}findLoadedParent(d,f){if(d.key in this._loadedParentTiles){const j=this._loadedParentTiles[d.key];return j&&j.tileID.overscaledZ>=f?j:null}for(let j=d.overscaledZ-1;j>=f;j--){const I=d.scaledTo(j),O=this._getLoadedTile(I);if(O)return O}}_getLoadedTile(d){const f=this._tiles[d.key];return f&&f.hasData()?f:this._cache.getByKey(this._source.reparseOverscaled?d.wrapped().key:d.canonical.key)}updateCacheSize(d,f){f=f||this._source.tileSize;const j=Math.ceil(d.width/f)+1,I=Math.ceil(d.height/f)+1,O=Math.floor(j*I*5),F=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,O):O,B=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,F):F;this._cache.setMaxSize(B)}handleWrapJump(d){const f=Math.round((d-(this._prevLng===void 0?d:this._prevLng))/360);if(this._prevLng=d,f){const j={};for(const I in this._tiles){const O=this._tiles[I];O.tileID=O.tileID.unwrapTo(O.tileID.wrap+f),j[O.tileID.key]=O}this._tiles=j;for(const I in this._timers)clearTimeout(this._timers[I]),delete this._timers[I];for(const I in this._tiles)this._setTileReloadTimer(+I,this._tiles[I])}}update(d,f,j,I,O){if(this.transform=d,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!j)return;this.updateCacheSize(d,f),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const F=this._source.type==="batched-model";let B,W=this._source.maxzoom;const J=this.map&&this.map.painter?this.map.painter._terrain:null;if(J&&J.sourceCache===this&&J.attenuationRange()){const ue=J.attenuationRange()[0],pe=Math.floor(ue)-Math.log2(J.getDemUpscale());W>pe&&(W=pe)}if(this.used||this.usedForTerrain){if(this._source.tileID)B=d.getVisibleUnwrappedCoordinates(this._source.tileID).map(ue=>new i.aQ(ue.canonical.z,ue.wrap,ue.canonical.z,ue.canonical.x,ue.canonical.y));else if(this.tileCoverLift!==0){const ue=d.clone();ue.tileCoverLift=this.tileCoverLift,B=ue.coveringTiles({tileSize:f||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:W,roundZoom:this._source.roundZoom&&!j,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:F}),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:f||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:W,roundZoom:this._source.roundZoom&&!j,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:F}),this._source.hasTile){const ue=this._source.hasTile.bind(this._source);B=B.filter(pe=>ue(pe))}}else B=[];if(B.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!Pm(this._source.type)){const ue=d.coveringZoomLevel({tileSize:f||this._source.tileSize,roundZoom:this._source.roundZoom&&!j}),pe=Math.min(ue,this._source.maxzoom);if(F){const ke=d.extendTileCover(B,pe);for(const _e of ke)B.push(_e)}else if(O){const ke=d.extendTileCoverToNearPlane(B,this.transform.getFrustum(pe),pe);for(const _e of ke)B.push(_e)}else if(this.castsShadows&&I){const ke=d.extendTileCover(B,pe,I,16);for(const _e of ke)this._shadowCasterTiles[_e.key]=!0,B.push(_e)}}const te=this._updateRetainedTiles(B);if(Pm(this._source.type)&&B.length!==0){const ue={},pe={},ke=Object.keys(te);for(const Fe of ke){const Re=te[Fe],We=this._tiles[Fe];if(!We||We.fadeEndTime&&We.fadeEndTime<=i.o.now())continue;const at=this.findLoadedParent(Re,Math.max(Re.overscaledZ-bd.maxOverzooming,this._source.minzoom));at&&(this._addTile(at.tileID),ue[at.tileID.key]=at.tileID),pe[Fe]=Re}const _e=B[B.length-1].overscaledZ;for(const Fe in this._tiles){const Re=this._tiles[Fe];if(te[Fe]||!Re.hasData())continue;let We=Re.tileID;for(;We.overscaledZ>_e;){We=We.scaledTo(We.overscaledZ-1);const at=this._tiles[We.key];if(at&&at.hasData()&&pe[We.key]){te[Fe]=Re.tileID;break}}}for(const Fe in ue)te[Fe]||(this._coveredTiles[Fe]=!0,te[Fe]=ue[Fe])}for(const ue in te)this._tiles[ue].clearFadeHold();const me=i.bv(this._tiles,te);for(const ue of me){const pe=this._tiles[ue];pe.hasSymbolBuckets&&!pe.holdingForFade()?pe.setHoldDuration(this.map._fadeDuration):pe.hasSymbolBuckets&&!pe.symbolFadeFinished()||this._removeTile(+ue)}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 f={};if(d.length===0)return f;const j={},I=d.reduce((J,te)=>Math.min(J,te.overscaledZ),1/0),O=d[0].overscaledZ,F=Math.max(O-bd.maxOverzooming,this._source.minzoom),B=Math.max(O+bd.maxUnderzooming,this._source.minzoom),W={};for(const J of d){const te=this._addTile(J);f[J.key]=J,te.hasData()||I=this._source.maxzoom){const ue=J.children(this._source.maxzoom)[0],pe=this.getTile(ue);if(pe&&pe.hasData()){f[ue.key]=ue;continue}}else{const ue=J.children(this._source.maxzoom);if(f[ue[0].key]&&f[ue[1].key]&&f[ue[2].key]&&f[ue[3].key])continue}let me=te.wasRequested();for(let ue=J.overscaledZ-1;ue>=F;--ue){const pe=J.scaledTo(ue);if(j[pe.key]||(j[pe.key]=!0,te=this.getTile(pe),!te&&me&&(te=this._addTile(pe)),te&&(f[pe.key]=pe,me=te.wasRequested(),te.hasData())))break}}return f}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const d in this._tiles){const f=[];let j,I=this._tiles[d].tileID;for(;I.overscaledZ>0;){if(I.key in this._loadedParentTiles){j=this._loadedParentTiles[I.key];break}f.push(I.key);const O=I.scaledTo(I.overscaledZ-1);if(j=this._getLoadedTile(O),j)break;I=O}for(const O of f)this._loadedParentTiles[O]=j}}_addTile(d){let f=this._tiles[d.key];if(f)return f.isExtraShadowCaster!==!0||this._shadowCasterTiles[d.key]||this._reloadTile(d.key,"reloading"),f;f=this._cache.getAndRemove(d),f&&(this._setTileReloadTimer(d.key,f),f.tileID=d,this._state.initializeTileState(f,this.map?this.map.painter:null),this._cacheTimers[d.key]&&(clearTimeout(this._cacheTimers[d.key]),delete this._cacheTimers[d.key],this._setTileReloadTimer(d.key,f)));const j=!!f;if(!j){const I=this.map?this.map.painter:null,O=this._source.tileSize*d.overscaleFactor();f=this._source.type==="raster-array"?new Jy(d,O,this.transform.tileZoom,I,this._isRaster):new Tp(d,O,this.transform.tileZoom,I,this._isRaster,this._source.worldview),this._loadTile(f,this._tileLoaded.bind(this,f,d.key,f.state))}return f.uses++,this._tiles[d.key]=f,j||this._source.fire(new i.z("dataloading",{tile:f,coord:f.tileID,dataType:"source"})),f}_setTileReloadTimer(d,f){d in this._timers&&(clearTimeout(this._timers[d]),delete this._timers[d]);const j=f.getExpiryTimeout();j&&(this._timers[d]=setTimeout(()=>{this._reloadTile(d,"expired"),delete this._timers[d]},j))}_removeTile(d){const f=this._tiles[d];f&&(f.uses--,delete this._tiles[d],this._timers[d]&&(clearTimeout(this._timers[d]),delete this._timers[d]),f.uses>0||(f.hasData()&&f.state!=="reloading"||f.state==="empty"?this._cache.add(f.tileID,f,f.getExpiryTimeout()):(f.aborted=!0,this._abortTile(f),this._unloadTile(f))))}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,f,j){const I=[],O=this.transform;if(!O)return I;const F=O.projection.name==="globe",B=i.aF(O.center.lng);for(const W in this._tiles){const J=this._tiles[W];if(j&&J.clearQueryDebugViz(),J.holdingForFade())continue;let te;if(F){const me=J.tileID.canonical;if(me.z===0){const ue=[Math.abs(i.aA(B,...Lu(me,-1))-B),Math.abs(i.aA(B,...Lu(me,1))-B)];te=[0,2*ue.indexOf(Math.min(...ue))-1]}else{const ue=[Math.abs(i.aA(B,...Lu(me,-1))-B),Math.abs(i.aA(B,...Lu(me,0))-B),Math.abs(i.aA(B,...Lu(me,1))-B)];te=[ue.indexOf(Math.min(...ue))-1]}}else te=[0];for(const me of te){const ue=d.containsTile(J,O,f,me);ue&&I.push(ue)}}return I}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(d){return this._getRenderableCoordinates(d)}_getRenderableCoordinates(d,f){const j=this.getRenderableIds(d,f).map(O=>this._tiles[O].tileID),I=this.transform.projection.name==="globe";for(const O of j)O.projMatrix=this.transform.calculateProjMatrix(O.toUnwrapped()),O.expandedProjMatrix=I?this.transform.calculateProjMatrix(O.toUnwrapped(),!1,!0):O.projMatrix;return j}sortCoordinatesByDistance(d){const f=d.slice(),j=this.transform._camera.position,I=this.transform._camera.forward(),O={};for(const F of f){const B=1/(1<O[F.key]-O[B.key]),f}hasTransition(){if(this._source.hasTransition())return!0;if(Pm(this._source.type))for(const d in this._tiles){const f=this._tiles[d];if(f.fadeEndTime!==void 0&&f.fadeEndTime>=i.o.now())return!0}return!1}setFeatureState(d,f,j){this._state.updateState(d=d||"_geojsonTileLayer",f,j)}removeFeatureState(d,f,j){this._state.removeFeatureState(d=d||"_geojsonTileLayer",f,j)}getFeatureState(d,f){return this._state.getState(d=d||"_geojsonTileLayer",f)}setDependencies(d,f,j){const I=this._tiles[d];I&&I.setDependencies(f,j)}reloadTilesForDependencies(d,f){for(const j in this._tiles)this._tiles[j].hasDependency(d,f)&&this._reloadTile(+j,"reloading");this._cache.filter(j=>!j.hasDependency(d,f))}_preloadTiles(d,f){if(!this._sourceLoaded){const W=()=>{this._sourceLoaded&&(this._source.off("data",W),this._preloadTiles(d,f))};return void this._source.on("data",W)}const j=new Map,I=Array.isArray(d)?d:[d],O=this.map.painter.terrain,F=this.usedForTerrain&&O?O.getScaledDemTileSize():this._source.tileSize;for(const W of I){const J=W.coveringTiles({tileSize:F,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&&W.updateElevation(!1)}const B=Array.from(j.values());i.bw(B,(W,J)=>{const te=new Tp(W,this._source.tileSize*W.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(te,me=>{this._source.type==="raster-dem"&&te.dem&&this._backfillDEM(te),J(me,te)})},f)}}function e0(w,d){const f=Math.abs(2*w.wrap)-+(w.wrap<0),j=Math.abs(2*d.wrap)-+(d.wrap<0);return w.overscaledZ-d.overscaledZ||j-f||d.canonical.y-w.canonical.y||d.canonical.x-w.canonical.x}function Pm(w){return w==="raster"||w==="image"||w==="video"||w==="custom"}function Lu(w,d){const f=1<0:j.type==="building"?I=!j.isHidden(d)&&j.paint.get("building-opacity")>0:j.type==="model"&&(I=!j.isHidden(d)&&j.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!I&&f.visible,f.visible=I}}updateZOffset(d,f){this.currentBuildingBuckets=[];for(const I of this.layers){const O=I.layer,F=this.style.getLayerSourceCache(O);let B=1;O.type==="fill-extrusion"?B=I.visible?O.paint.get("fill-extrusion-vertical-scale"):0:O.type==="building"&&(B=I.visible?O.paint.get("building-vertical-scale"):0);let W=F?F.getTile(f):null;if(!W&&F)for(const J in F._tiles){const te=F._tiles[J];if(f.canonical.isChildOf(te.tileID.canonical)){W=te;break}}this.currentBuildingBuckets.push({bucket:W?W.getBucket(O):null,tileID:W?W.tileID:f,verticalScale:B})}d.hasAnyZOffset=!1;let j=!1;for(let I=0;I{j in d&&(f[j]=d[j])}),f}function mx(w){w=w.slice();const d=Object.create(null);for(let f=0;f0?(I-F)/B:0;return this.points[O].mult(1-W).add(this.points[f].mult(W))}}class ln{constructor(d,f,j){const I=this.boxCells=[],O=this.circleCells=[];this.xCellCount=Math.ceil(d/j),this.yCellCount=Math.ceil(f/j);for(let F=0;Fthis.width||I<0||f>this.height)return!O&&[];const B=[];if(d<=0&&f<=0&&this.width<=j&&this.height<=I){if(O)return!0;for(let W=0;W0:B}_queryCircle(d,f,j,I,O){const F=d-j,B=d+j,W=f-j,J=f+j;if(B<0||F>this.width||J<0||W>this.height)return!I&&[];const te=[];return this._forEachCell(F,W,B,J,this._queryCellCircle,te,{hitTest:I,circle:{x:d,y:f,radius:j},seenUids:{box:{},circle:{}}},O),I?te.length>0:te}query(d,f,j,I,O){return this._query(d,f,j,I,!1,O)}hitTest(d,f,j,I,O){return this._query(d,f,j,I,!0,O)}hitTestCircle(d,f,j,I){return this._queryCircle(d,f,j,!0,I)}_queryCell(d,f,j,I,O,F,B,W){const J=B.seenUids,te=this.boxCells[O];if(te!==null){const ue=this.bboxes;for(const pe of te)if(!J.box[pe]){J.box[pe]=!0;const ke=4*pe;if(d<=ue[ke+2]&&f<=ue[ke+3]&&j>=ue[ke+0]&&I>=ue[ke+1]&&(!W||W(this.boxKeys[pe]))){if(B.hitTest)return F.push(!0),!0;F.push({key:this.boxKeys[pe],x1:ue[ke],y1:ue[ke+1],x2:ue[ke+2],y2:ue[ke+3]})}}}const me=this.circleCells[O];if(me!==null){const ue=this.circles;for(const pe of me)if(!J.circle[pe]){J.circle[pe]=!0;const ke=3*pe;if(this._circleAndRectCollide(ue[ke],ue[ke+1],ue[ke+2],d,f,j,I)&&(!W||W(this.circleKeys[pe]))){if(B.hitTest)return F.push(!0),!0;{const _e=ue[ke],Fe=ue[ke+1],Re=ue[ke+2];F.push({key:this.circleKeys[pe],x1:_e-Re,y1:Fe-Re,x2:_e+Re,y2:Fe+Re})}}}}}_queryCellCircle(d,f,j,I,O,F,B,W){const J=B.circle,te=B.seenUids,me=this.boxCells[O];if(me!==null){const pe=this.bboxes;for(const ke of me)if(!te.box[ke]){te.box[ke]=!0;const _e=4*ke;if(this._circleAndRectCollide(J.x,J.y,J.radius,pe[_e+0],pe[_e+1],pe[_e+2],pe[_e+3])&&(!W||W(this.boxKeys[ke])))return F.push(!0),!0}}const ue=this.circleCells[O];if(ue!==null){const pe=this.circles;for(const ke of ue)if(!te.circle[ke]){te.circle[ke]=!0;const _e=3*ke;if(this._circlesCollide(pe[_e],pe[_e+1],pe[_e+2],J.x,J.y,J.radius)&&(!W||W(this.circleKeys[ke])))return F.push(!0),!0}}}_forEachCell(d,f,j,I,O,F,B,W){const J=this._convertToXCellCoord(d),te=this._convertToYCellCoord(f),me=this._convertToXCellCoord(j),ue=this._convertToYCellCoord(I);for(let pe=J;pe<=me;pe++)for(let ke=te;ke<=ue;ke++)if(O.call(this,d,f,j,I,this.xCellCount*ke+pe,F,B,W))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,f,j,I,O,F){const B=I-d,W=O-f,J=j+F;return J*J>B*B+W*W}_circleAndRectCollide(d,f,j,I,O,F,B){const W=(F-I)/2,J=Math.abs(d-(I+W));if(J>W+j)return!1;const te=(B-O)/2,me=Math.abs(f-(O+te));if(me>te+j)return!1;if(J<=W||me<=te)return!0;const ue=J-W,pe=me-te;return ue*ue+pe*pe<=j*j}}const ia={unknown:0,flipRequired:1,flipNotRequired:2},Rn=Math.tan(85*Math.PI/180);function ka(w,d,f,j,I,O,F){const B=i.bC();if(f)if(O.name==="globe"){const W=i.bD(I,d);i.aB(B,B,W)}else{const W=i.bE([],F);B[0]=W[0],B[1]=W[1],B[4]=W[2],B[5]=W[3],j||i.bB(B,B,I.angle)}else i.aB(B,I.labelPlaneMatrix,w);return B}function Wh(w,d,f,j,I,O,F){const B=ka(w,d,f,j,I,O,F);return O.name==="globe"&&f||(B[2]=B[6]=B[10]=B[14]=0),B}function cu(w,d,f,j,I,O,F){if(f){if(O.name==="globe"){const B=ka(w,d,f,j,I,O,F);return i.bl(B,B),i.aB(B,w,B),B}{const B=i.bz(w),W=i.bA([]);return W[0]=F[0],W[1]=F[1],W[4]=F[2],W[5]=F[3],i.aB(B,B,W),j||i.bB(B,B,-I.angle),B}}return I.glCoordMatrix}function Ll(w,d,f,j){const I=[w,d,f,1];f?i.aC(I,I,j):js(I,I,j);const O=I[3];return I[0]/=O,I[1]/=O,I[2]/=O,I}function Na(w,d){return Math.min(.5+w/d*.5,1.5)}function Vk(w,d){const f=w[0]/w[3],j=w[1]/w[3];return f>=-d[0]&&f<=d[0]&&j>=-d[1]&&j<=d[1]}function RP(w,d,f,j,I,O,F,B,W,J,te=1){const me=f.transform,ue=j?w.textSizeData:w.iconSizeData,pe=i.bK(ue,f.transform.zoom,te),ke=me.projection.name==="globe",_e=[256/f.width*2+1,256/f.height*2+1],Fe=j?w.text.dynamicLayoutVertexArray:w.icon.dynamicLayoutVertexArray;Fe.clear();let Re=null;ke&&(Re=j?w.text.globeExtVertexArray:w.icon.globeExtVertexArray);const We=w.lineVertexArray,at=j?w.text.placedSymbolArray:w.icon.placedSymbolArray,Ge=f.transform.width/f.transform.height;let kt,yt=!1;for(let bt=0;btMath.abs(f)?{useVertical:!0}:w===i.bL.vertical?j>0?{needsFlipping:!0}:null:d!==ia.unknown&&function(I,O){return I===0||Math.abs(O/I)>Rn}(f,j)?d===ia.flipRequired?{needsFlipping:!0}:null:f<0?{needsFlipping:!0}:null}function i5(w,d,f,j,I,O,F,B,W,J,te,me,ue,pe,ke,_e,Fe,Re,We,at){const Ge=d/24,kt=w.lineOffsetX*Ge,yt=w.lineOffsetY*Ge,{lineStartIndex:bt,glyphStartIndex:ft,numGlyphs:ht,segment:Ct,writingMode:Rt,flipState:Dt}=w,Yt=bt+w.lineLength,Xt=lr=>{if(te){const[er,Zt,hr]=lr.up,Ir=J.length;i.bN(te,Ir+0,er,Zt,hr),i.bN(te,Ir+1,er,Zt,hr),i.bN(te,Ir+2,er,Zt,hr),i.bN(te,Ir+3,er,Zt,hr)}const[br,Ht,Et]=lr.point;i.bO(J,br,Ht,Et,lr.angle)};if(ht>1){const lr=FP(Ge,B,kt,yt,f,me,ue,w,W,O,pe,_e,!1,Fe,Re,We,at);if(!lr)return{notEnoughRoom:!0};if(j&&!f){let[br,Ht,Et]=lr.first.point,[er,Zt,hr]=lr.last.point;[br,Ht]=Ll(br,Ht,Et,F),[er,Zt]=Ll(er,Zt,hr,F);const Ir=Us(Rt,Dt,(er-br)*ke,Zt-Ht);if(w.flipState=Ir&&Ir.needsFlipping?ia.flipRequired:ia.flipNotRequired,Ir)return Ir}Xt(lr.first);for(let br=ft+1;br0?er:ph(ue,Et,br,1,I,void 0,Fe,Re.canonical),hr=Us(Rt,Dt,(Zt[0]-br[0])*ke,Zt[1]-br[1]);if(w.flipState=hr&&hr.needsFlipping?ia.flipRequired:ia.flipNotRequired,hr)return hr}const lr=r0(Ge*B.getoffsetX(ft),kt,yt,f,me,ue,Ct,bt,Yt,W,O,pe,_e,!1,!1,Fe,Re,We,at);if(!lr)return{notEnoughRoom:!0};Xt(lr)}return{}}function $v(w,d,f,j,I){const{x:O,y:F,z:B}=j.projectTilePoint(w.x,w.y,d);if(!I)return Ll(O,F,B,f);const[W,J,te]=I.getElevation(w,I.elevation,I.elevationFeature);return Ll(O+W,F+J,B+te,f)}function ph(w,d,f,j,I,O,F,B){const W=$v(w.sub(d)._unit()._add(w),B,I,F,O);return i.av(W,f,W),i.aw(W,W),i.bH(W,f,W,j)}function r0(w,d,f,j,I,O,F,B,W,J,te,me,ue,pe,ke,_e,Fe,Re,We){const at=j?w-d:w+d;let Ge=at>0?1:-1,kt=0;j&&(Ge*=-1,kt=Math.PI),Ge<0&&(kt+=Math.PI);let yt=B+F+(Ge>0?0:1)|0,bt=I,ft=I,ht=0,Ct=0;const Rt=Math.abs(at),Dt=[],Yt=[];let Xt=O,lr=Xt,br=i.bF([]);const Ht=()=>ph(lr,Xt,ft,Rt-ht+1,te,ue,_e,Fe.canonical);for(;ht+Ct<=Rt;){if(yt+=Ge,yt=W)return null;if(ft=bt,lr=Xt,Dt.push(ft),pe&&Yt.push(lr),Xt=new i.P(J.getx(yt),J.gety(yt)),bt=me[yt],!bt){const ls=$v(Xt,Fe.canonical,te,_e,ue);bt=ls[3]>0?me[yt]=ls:Ht()}ht+=Ct;const wr=i.av([],bt,ft),fs=i.bG(ft,bt);if(f&&fs>0&&Ct>0&&i.bJ(br,wr)/(Ct*fs)0,at),bt=J*yt.perspectiveRatio,ft=(j.x1*f+B.x-j.padding)*bt+yt.point.x,ht=(j.y1*f+B.y-j.padding)*bt+yt.point.y,Ct=(j.x2*f+B.x+j.padding)*bt+yt.point.x,Rt=(j.y2*f+B.y+j.padding)*bt+yt.point.y,Dt=yt.perspectiveRatio<=.55||yt.occluded;return!this.isInsideGrid(ft,ht,Ct,Rt)||!W&&this.grid.hitTest(ft,ht,Ct,Rt,me)||Dt?{box:[],offscreen:!1,occluded:yt.occluded}:{box:[ft,ht,Ct,Rt],offscreen:this.isOffscreen(ft,ht,Ct,Rt),occluded:!1}}placeCollisionCircles(d,f,j,I,O,F,B,W,J,te,me,ue,pe,ke,_e,Fe){const Re=[],We=this.transform.elevation,at=d.getProjection(),Ge=d.elevationType==="road",kt=!!We||Ge,yt=i.bV.getAtTileOffsetFunc(Fe,this.transform.center.lat,this.transform.worldSize,at),bt=new i.P(j.tileAnchorX,j.tileAnchorY),ft=new i.P(j.tileAnchorX,j.tileAnchorY);let{x:ht,y:Ct,z:Rt}=at.projectTilePoint(ft.x,ft.y,Fe.canonical),Dt=null;if(kt){const fs=Ge?d.getElevationFeatureForText(I):null;Dt={getElevation:yt,elevation:We,elevationFeature:fs};const[ls,Wr,Jr]=yt(bt,We,fs);ht+=ls,Ct+=Wr,Rt+=Jr}const Yt=at.name==="globe",Xt=this.projectAndGetPerspectiveRatio(W,ht,Ct,Rt,Fe,Yt||!!We||this.transform.pitch>0,at),{perspectiveRatio:lr}=Xt,br=(ue?B/lr:B*lr)/i.bY,Ht=Ll(ht,Ct,Rt,J),Et=j.lineOffsetX*br,er=j.lineOffsetY*br,Zt=i.an(d.layers[0].layout.get("text-max-angle")),hr=Math.cos(Zt),Ir=Xt.signedDistanceFromCamera>0?FP(br,F,Et,er,Ge&&j.flipState===1,Ht,ft,j,O,J,{},kt&&!ue?Dt:null,ue&&kt,at,Fe,ue,hr):null;let Xr=!1,Mr=!1,wr=!0;if(Ir&&!Xt.occluded){const fs=.5*ke*lr+_e,ls=new i.P(-100,-100),Wr=new i.P(this.screenRightBoundary,this.screenBottomBoundary),Jr=new on,{first:As,last:an}=Ir,Kn=As.path.length;let Sa=[];for(let tn=Kn-1;tn>=1;tn--)Sa.push(As.path[tn]);for(let tn=1;tn(kt&&!Yt&&(Ha=yt(Fatn[3]<=0)&&(Sa=[]));let xa=[];if(Sa.length>0){let tn=1/0,Aa=-1/0,Ha=1/0,Fa=-1/0;for(const fa of Sa)tn=Math.min(tn,fa[0]),Ha=Math.min(Ha,fa[1]),Aa=Math.max(Aa,fa[0]),Fa=Math.max(Fa,fa[1]);Aa>=ls.x&&tn<=Wr.x&&Fa>=ls.y&&Ha<=Wr.y&&(xa=[Sa.map(fa=>new i.P(fa[0],fa[1]))],(tnWr.x||HaWr.y)&&(xa=i.bW(xa,ls.x,ls.y,Wr.x,Wr.y)))}for(const tn of xa){Jr.reset(tn,.25*fs);let Aa=0;Aa=Jr.length<=.5*fs?1:Math.ceil(Jr.paddedLength/ys)+1;for(let Ha=0;Ha0?(i.aC(W,W,d),this.fogState&&O&&B.name!=="globe"&&(J=function(ue,pe,ke,_e,Fe,Re){const We=Re.calculateFogTileMatrix(Fe),at=[pe,ke,_e];return i.af(at,at,We),Qr(ue,i.ag(at),Re.pitch,Re._fov)}(this.fogState,f,j,I,O.toUnwrapped(),this.transform)>.9)):js(W,W,d);const te=W[3];return{point:new i.P((W[0]/te+1)/2*this.transform.width+oa,(-W[1]/te+1)/2*this.transform.height+oa),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(B)/te*.5,1.5),signedDistanceFromCamera:te,occluded:F&&W[2]>te||J}}isOffscreen(d,f,j,I){return j=this.screenRightBoundary||Ithis.screenBottomBoundary}isInsideGrid(d,f,j,I){return j>=0&&d=0&&fj.collisionGroupID===f}}return this.collisionGroups[d]}}function Lc(w,d,f,j,I){const{horizontalAlign:O,verticalAlign:F}=i.c1(w),B=-(O-.5)*d,W=-(F-.5)*f,J=i.c2(w,j);return new i.P(B+J[0]*I,W+J[1]*I)}function Uo(w,d,f,j,I){const O=new i.P(w,d);return f&&O._rotate(j?I:-I),O}class qie{constructor(d,f,j,I,O,F){this.transform=d.clone(),this.projection=d.projection.name,this.collisionIndex=new Va(this.transform,O),this.buildingIndex=F,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=f,this.retainedQueryData={},this.collisionGroups=new qv(j),this.collisionCircleArrays={},this.prevPlacement=I,I&&(I.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(d,f,j,I,O=1){const F=j.getBucket(f),B=j.latestFeatureIndex;if(!F||!B||f.fqid!==F.layerIds[0])return;const W=F.layers[0].layout,J=F.layers[0].paint,te=j.collisionBoxArray,me=Math.pow(2,this.transform.zoom-j.tileID.overscaledZ),ue=j.tileSize/i.al,pe=j.tileID.toUnwrapped();this.transform.setProjection(F.projection);const ke=(_e=j.tileID,Fe=F.getProjection(),Re=this.transform,Fe.name===this.projection?Re.calculateProjMatrix(_e.toUnwrapped()):Nt(Re,Fe,_e));var _e,Fe,Re;const We=W.get("text-pitch-alignment")==="map",at=W.get("text-rotation-alignment")==="map";f.compileFilter(f.options);const Ge=f.dynamicFilter(),kt=f.dynamicFilterNeedsFeature(),yt=this.transform.calculatePixelsToTileUnitsMatrix(j),bt=Wh(ke,j.tileID.canonical,We,at,this.transform,F.getProjection(),yt);let ft=null;const ht=F.getProjection().createInversionMatrix(this.transform,j.tileID.canonical);if(We){const Et=cu(ke,j.tileID.canonical,We,at,this.transform,F.getProjection(),yt);ft=i.aB([],this.transform.labelPlaneMatrix,Et)}let Ct=null;Ge&&j.latestFeatureIndex&&(Ct={unwrappedTileID:pe,dynamicFilter:Ge,dynamicFilterNeedsFeature:kt}),this.retainedQueryData[F.bucketInstanceId]=new Uv(F.bucketInstanceId,B,F.sourceLayerIndex,F.index,j.tileID);const[Rt,Dt]=F.layers[0].layout.get("text-size-scale-range"),Yt=i.aA(O,Rt,Dt),[Xt,lr]=W.get("icon-size-scale-range"),br=i.aA(O,Xt,lr),Ht={bucket:F,layout:W,paint:J,posMatrix:ke,invMatrix:ht,mercatorCenter:[i.aF(this.transform.center.lng),i.aJ(this.transform.center.lat)],textLabelPlaneMatrix:bt,labelToScreenMatrix:ft,clippingData:Ct,scale:me,textPixelRatio:ue,holdingForFade:j.holdingForFade(),collisionBoxArray:te,partiallyEvaluatedTextSize:i.bK(F.textSizeData,this.transform.zoom,Yt),partiallyEvaluatedIconSize:i.bK(F.iconSizeData,this.transform.zoom,br),collisionGroup:this.collisionGroups.get(F.sourceID),latestFeatureIndex:j.latestFeatureIndex};if(I)for(const Et of F.sortKeyRanges){const{sortKey:er,symbolInstanceStart:Zt,symbolInstanceEnd:hr}=Et;d.push({sortKey:er,symbolInstanceStart:Zt,symbolInstanceEnd:hr,parameters:Ht})}else d.push({symbolInstanceStart:0,symbolInstanceEnd:F.symbolInstances.length,parameters:Ht})}attemptAnchorPlacement(d,f,j,I,O,F,B,W,J,te,me,ue,pe,ke,_e,Fe,Re,We,at,Ge,kt){const{textOffset0:yt,textOffset1:bt,crossTileID:ft}=_e,ht=[yt,bt],Ct=Lc(d,F,B,ht,W),Rt=this.collisionIndex.placeCollisionBox(Re,W,f,j,I,O,Uo(Ct.x,Ct.y,J,te,this.transform.angle),ke,me,ue,pe.predicate);if(at){const Dt=Re.getSymbolInstanceIconSize(kt,this.transform.zoom,_e.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(Re,Dt,at,j,I,O,Uo(Ct.x,Ct.y,J,te,this.transform.angle),ke,me,ue,pe.predicate).box.length===0)return}if(Rt.box.length>0){let Dt;return this.prevPlacement&&this.prevPlacement.variableOffsets[ft]&&this.prevPlacement.placements[ft]&&this.prevPlacement.placements[ft].text&&(Dt=this.prevPlacement.variableOffsets[ft].anchor),this.variableOffsets[ft]={textOffset:ht,width:F,height:B,anchor:d,textScale:W,prevAnchor:Dt},this.markUsedJustification(Re,d,_e,We),Re.allowVerticalPlacement&&(this.markUsedOrientation(Re,We,_e),this.placedOrientations[ft]=We),{shift:Ct,placedGlyphBoxes:Rt}}}placeLayerBucketPart(d,f,j,I,O=1){const{bucket:F,layout:B,paint:W,posMatrix:J,textLabelPlaneMatrix:te,labelToScreenMatrix:me,clippingData:ue,textPixelRatio:pe,mercatorCenter:ke,invMatrix:_e,holdingForFade:Fe,collisionBoxArray:Re,partiallyEvaluatedTextSize:We,partiallyEvaluatedIconSize:at,collisionGroup:Ge,latestFeatureIndex:kt}=d.parameters,yt=B.get("text-optional"),bt=B.get("icon-optional"),ft=B.get("text-allow-overlap"),ht=B.get("icon-allow-overlap"),Ct=B.get("text-rotation-alignment")==="map",Rt=B.get("icon-rotation-alignment")==="map",Dt=B.get("text-pitch-alignment")==="map",Yt=W.get("symbol-z-offset"),Xt=B.get("symbol-elevation-reference")==="sea",lr=B.get("symbol-placement"),[br,Ht]=B.get("text-size-scale-range"),[Et,er]=B.get("icon-size-scale-range"),Zt=i.aA(O,br,Ht),hr=i.aA(O,Et,er),Ir=B.get("text-variable-anchor"),Xr=Ct&&lr!=="point",Mr=Rt&&lr!=="point",wr=Ir&&F.hasTextData(),fs=F.hasIconTextFit()&&wr&&F.hasIconData();this.transform.setProjection(F.projection);const ls=wr||Xr,Wr=Mr||fs;let Jr=ft&&(ht||!F.hasIconData()||bt),As=ht&&(ft||!F.hasTextData()||yt);const an=!Yt.isConstant();!F.collisionArrays&&Re&&F.deserializeCollisionBoxes(Re),j&&I&&F.updateCollisionDebugBuffers(this.transform.zoom,Re,Zt,hr);const Kn=(ys,xa,tn)=>{const{crossTileID:Aa,numVerticalGlyphVertices:Ha}=ys;let Fa=null;if(ue&&ue.dynamicFilterNeedsFeature||an){const io=this.retainedQueryData[F.bucketInstanceId];Fa=kt.loadFeature({featureIndex:ys.featureIndex,bucketIndex:io.bucketIndex,sourceLayerIndex:io.sourceLayerIndex,layoutVertexArrayOffset:0});const wo=Fa.properties?Fa.properties.worldview:null;if(F.localizable&&F.worldview&&typeof wo=="string")if(wo==="all")Fa.properties.$localized=!0;else{if(!wo.split(",").includes(F.worldview))return;Fa.properties.$localized=!0,Fa.properties.worldview=F.worldview}}if(ue&&!(0,ue.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:F.worldview},Fa,this.retainedQueryData[F.bucketInstanceId].tileID.canonical,new i.P(ys.tileAnchorX,ys.tileAnchorY),this.transform.calculateDistanceTileData(ue.unwrappedTileID)))return this.placements[Aa]=new Oa(!1,!1,!1,!0),void f.add(Aa);const fa=Yt.evaluate(Fa,{});if(f.has(Aa))return;if(Fe)return void(this.placements[Aa]=new Oa(!1,!1,!1));let gn=!1,Ma=!1,Xi=!0,Ti=!1,Ea=!1,ca=null,xn={box:null,offscreen:null,occluded:null},xi={box:null},go=null,Hi=null,ei=null,Cd=0,xc=0,tl=0;tn.textFeatureIndex?Cd=tn.textFeatureIndex:ys.useRuntimeCollisionCircles&&(Cd=ys.featureIndex),tn.verticalTextFeatureIndex&&(xc=tn.verticalTextFeatureIndex);const Dc=F.elevationFeatures?F.elevationFeatures[ys.elevationFeatureIndex]:void 0,Rc=io=>{io.tileID=this.retainedQueryData[F.bucketInstanceId].tileID;const wo=this.transform.elevation;io.elevation=Xt?fa:fa+i.bV.getAtTileOffset(io.tileID,new i.P(io.tileAnchorX,io.tileAnchorY),wo,Dc),io.elevation+=ys.zOffset},Kl=tn.textBox;if(Kl){Rc(Kl);const io=ti=>{let Io=i.bL.horizontal;if(F.allowVerticalPlacement&&!ti&&this.prevPlacement){const Qi=this.prevPlacement.placedOrientations[Aa];Qi&&(this.placedOrientations[Aa]=Qi,Io=Qi,this.markUsedOrientation(F,Io,ys))}return Io},wo=(ti,Io)=>{if(F.allowVerticalPlacement&&Ha>0&&tn.verticalTextBox){for(const Qi of F.writingModes)if(Qi===i.bL.vertical?(xn=Io(),xi=xn):xn=ti(),xn&&xn.box&&xn.box.length)break}else xn=ti()};if(Ir){let ti=Ir;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Aa]){const Wi=this.prevPlacement.variableOffsets[Aa];ti.indexOf(Wi.anchor)>0&&(ti=ti.filter(wh=>wh!==Wi.anchor),ti.unshift(Wi.anchor))}const Io=(Wi,wh,x_)=>{const Jh=F.getSymbolInstanceTextSize(We,ys,this.transform.zoom,xa),y_=(Wi.x2-Wi.x1)*Jh+2*Wi.padding,S0=(Wi.y2-Wi.y1)*Jh+2*Wi.padding,Vm=ys.hasIconTextFit&&!ht?wh:null;Vm&&Rc(Vm);let Vp={box:[],offscreen:!1,occluded:!1};const C0=ft?2*ti.length:ti.length;for(let ug=0;ug=ti.length,ys,xa,F,x_,Vm,We,at);if(Hp&&(Vp=Hp.placedGlyphBoxes,Vp&&Vp.box&&Vp.box.length)){gn=!0,ca=Hp.shift;break}}return Vp};wo(()=>Io(Kl,tn.iconBox,i.bL.horizontal),()=>{const Wi=tn.verticalTextBox;return Wi&&Rc(Wi),F.allowVerticalPlacement&&!(xn&&xn.box&&xn.box.length)&&Ha>0&&Wi?Io(Wi,tn.verticalIconBox,i.bL.vertical):{box:null,offscreen:null,occluded:null}}),xn&&(gn=xn.box,Xi=xn.offscreen,Ti=xn.occluded);const Qi=io(!(!xn||!xn.box));if(!gn&&this.prevPlacement){const Wi=this.prevPlacement.variableOffsets[Aa];Wi&&(this.variableOffsets[Aa]=Wi,this.markUsedJustification(F,Wi.anchor,ys,Qi))}}else{const ti=(Io,Qi)=>{const Wi=F.getSymbolInstanceTextSize(We,ys,this.transform.zoom,xa),wh=this.collisionIndex.placeCollisionBox(F,Wi,Io,ke,_e,ls,new i.P(0,0),ft,pe,J,Ge.predicate);return wh&&wh.box&&wh.box.length&&(this.markUsedOrientation(F,Qi,ys),this.placedOrientations[Aa]=Qi),wh};wo(()=>ti(Kl,i.bL.horizontal),()=>{const Io=tn.verticalTextBox;return F.allowVerticalPlacement&&Ha>0&&Io?(Rc(Io),ti(Io,i.bL.vertical)):{box:null,offscreen:null,occluded:null}}),io(!!(xn&&xn.box&&xn.box.length))}}if(go=xn,gn=go&&go.box&&go.box.length>0,Xi=go&&go.offscreen,Ti=go&&go.occluded,ys.useRuntimeCollisionCircles){const io=ys.centerJustifiedTextSymbolIndex>=0?ys.centerJustifiedTextSymbolIndex:ys.verticalPlacedTextSymbolIndex,wo=F.text.placedSymbolArray.get(io),ti=i.bM(F.textSizeData,We,wo),Io=B.get("text-padding");Hi=this.collisionIndex.placeCollisionCircles(F,ft,wo,io,F.lineVertexArray,F.glyphOffsetArray,ti,J,te,me,j,Dt,Ge.predicate,ys.collisionCircleDiameter*ti/i.bY,Io,this.retainedQueryData[F.bucketInstanceId].tileID),gn=ft||Hi.circles.length>0&&!Hi.collisionDetected,Xi=Xi&&Hi.offscreen,Ti=Hi.occluded}if(tn.iconFeatureIndex&&(tl=tn.iconFeatureIndex),tn.iconBox){const io=wo=>{Rc(wo);const ti=ys.hasIconTextFit&&ca?Uo(ca.x,ca.y,Ct,Dt,this.transform.angle):new i.P(0,0),Io=F.getSymbolInstanceIconSize(at,this.transform.zoom,ys.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(F,Io,wo,ke,_e,Wr,ti,ht,pe,J,Ge.predicate)};xi&&xi.box&&xi.box.length&&tn.verticalIconBox?(ei=io(tn.verticalIconBox),Ma=ei.box.length>0):(ei=io(tn.iconBox),Ma=ei.box.length>0),Xi=Xi&&ei.offscreen,Ea=ei.occluded}const zu=yt||ys.numHorizontalGlyphVertices===0&&Ha===0,bh=bt||ys.numIconVertices===0;if(zu||bh?bh?zu||(Ma=Ma&&gn):gn=Ma&&gn:Ma=gn=Ma&&gn,gn&&go&&go.box&&this.collisionIndex.insertCollisionBox(go.box,B.get("text-ignore-placement"),F.bucketInstanceId,xi&&xi.box&&xc?xc:Cd,Ge.ID),Ma&&ei&&this.collisionIndex.insertCollisionBox(ei.box,B.get("icon-ignore-placement"),F.bucketInstanceId,tl,Ge.ID),Hi&&(gn&&this.collisionIndex.insertCollisionCircles(Hi.circles,B.get("text-ignore-placement"),F.bucketInstanceId,Cd,Ge.ID),j)){const io=F.bucketInstanceId;let wo=this.collisionCircleArrays[io];wo===void 0&&(wo=this.collisionCircleArrays[io]=new Hk);for(let ti=0;ti=0;--xa){const tn=ys[xa];Kn(F.symbolInstances.get(tn),tn,F.collisionArrays[tn])}F.hasAnyZOffset&&i.w(`${F.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(F.hasAnyZOffset){const ys=F.getSortedIndexesByZOffset();for(let xa=0;xa=0&&(d.text.placedSymbolArray.get(O).crossTileID=me>=0&&O!==me?0:J),F>=0&&(d.text.placedSymbolArray.get(F).crossTileID=me>=0&&F!==me?0:J),B>=0&&(d.text.placedSymbolArray.get(B).crossTileID=me>=0&&B!==me?0:J),W>=0&&(d.text.placedSymbolArray.get(W).crossTileID=me>=0&&W!==me?0:J)}markUsedOrientation(d,f,j){const I=f===i.bL.horizontal||f===i.bL.horizontalOnly?f:0,O=f===i.bL.vertical?f:0,{leftJustifiedTextSymbolIndex:F,centerJustifiedTextSymbolIndex:B,rightJustifiedTextSymbolIndex:W,verticalPlacedTextSymbolIndex:J}=j,te=d.text.placedSymbolArray;F>=0&&(te.get(F).placedOrientation=I),B>=0&&(te.get(B).placedOrientation=I),W>=0&&(te.get(W).placedOrientation=I),J>=0&&(te.get(J).placedOrientation=O)}commit(d){this.commitTime=d,this.zoomAtLastRecencyCheck=this.transform.zoom;const f=this.prevPlacement;let j=!1;this.prevZoomAdjustment=f?f.zoomAdjustment(this.transform.zoom):0;const I=f?f.symbolFadeChange(d):1,O=f?f.opacities:{},F=f?f.variableOffsets:{},B=f?f.placedOrientations:{};for(const W in this.placements){const J=this.placements[W],te=O[W];te?(this.opacities[W]=new Om(te,I,J.text,J.icon,null,J.clipped),j=j||J.text!==te.text.placed||J.icon!==te.icon.placed):(this.opacities[W]=new Om(null,I,J.text,J.icon,J.skipFade,J.clipped),j=j||J.text||J.icon)}for(const W in O){const J=O[W];if(!this.opacities[W]){const te=new Om(J,I,!1,!1);te.isHidden()||(this.opacities[W]=te,j=j||J.text.placed||J.icon.placed)}}for(const W in F)this.variableOffsets[W]||!this.opacities[W]||this.opacities[W].isHidden()||(this.variableOffsets[W]=F[W]);for(const W in B)this.placedOrientations[W]||!this.opacities[W]||this.opacities[W].isHidden()||(this.placedOrientations[W]=B[W]);j?this.lastPlacementChangeTime=d:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=f?f.lastPlacementChangeTime:d)}updateLayerOpacities(d,f,j,I){I&&(this.lastReplacementSourceUpdateTime=I.updateTime);const O=new Set;for(const F of f){const B=F.getBucket(d);B&&F.latestFeatureIndex&&d.fqid===B.layerIds[0]&&(this.updateBucketOpacities(B,O,F,F.collisionBoxArray,j,I,F.tileID,d.scope),B.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(B,F.tileID),B.elevationType==="road"&&B.updateRoadElevation(F.tileID.canonical),B.updateZOffset())}}updateBucketOpacities(d,f,j,I,O,F,B,W){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,me=!!d.layers[0].dynamicFilter(),ue=new Om(null,0,!1,!1,!0),pe=J.get("text-allow-overlap"),ke=J.get("icon-allow-overlap"),_e=J.get("text-variable-anchor"),Fe=J.get("text-rotation-alignment")==="map",Re=J.get("text-pitch-alignment")==="map",We=te.get("symbol-z-offset"),at=J.get("symbol-elevation-reference")==="sea",Ge=!We.isConstant(),kt=new Om(null,0,pe&&(ke||!d.hasIconData()||J.get("icon-optional")),ke&&(pe||!d.hasTextData()||J.get("text-optional")),!0);!d.collisionArrays&&I&&(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData())&&d.deserializeCollisionBoxes(I);const yt=(ft,ht,Ct)=>{for(let Rt=0;Rt0||Rt>0,Ir=Yt>0,Xr=this.placedOrientations[Dt],Mr=Xr===i.bL.vertical,wr=Xr===i.bL.horizontal||Xr===i.bL.horizontalOnly;!hr&&!Ir||Zt.isHidden()||bt++;let fs=!1;if((hr||Ir)&&F)for(const ls of d.activeReplacements){if(i.bZ(ls,O,i.b_.Symbol,W)||ls.min.x>Xt||Xt>ls.max.x||ls.min.y>lr||lr>ls.max.y)continue;const Wr=i.b$(Xt,lr,B.canonical,ls.footprintTileId.canonical);if(fs=i.c0(Wr,ls.footprint),fs)break}if(hr){const ls=fs?fx:jd(Zt.text);yt(d.text,Ct,Mr?fx:ls),yt(d.text,Rt,wr?fx:ls);const Wr=Zt.text.isHidden(),{leftJustifiedTextSymbolIndex:Jr,centerJustifiedTextSymbolIndex:As,rightJustifiedTextSymbolIndex:an,verticalPlacedTextSymbolIndex:Kn}=ht,Sa=d.text.placedSymbolArray,ys=Wr||Mr?1:0;Jr>=0&&(Sa.get(Jr).hidden=ys),As>=0&&(Sa.get(As).hidden=ys),an>=0&&(Sa.get(an).hidden=ys),Kn>=0&&(Sa.get(Kn).hidden=Wr||wr?1:0);const xa=this.variableOffsets[Dt];xa&&this.markUsedJustification(d,xa.anchor,ht,Xr);const tn=this.placedOrientations[Dt];tn&&(this.markUsedJustification(d,"left",ht,tn),this.markUsedOrientation(d,tn,ht))}if(Ir){const ls=fs?fx:jd(Zt.icon),{placedIconSymbolIndex:Wr,verticalPlacedIconSymbolIndex:Jr}=ht,As=d.icon.placedSymbolArray,an=Zt.icon.isHidden()?1:0;Wr>=0&&(yt(d.icon,Yt,Mr?fx:ls),As.get(Wr).hidden=an),Jr>=0&&(yt(d.icon,ht.numVerticalIconVertices,wr?fx:ls),As.get(Jr).hidden=an)}if(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData()){const ls=d.collisionArrays[ft];if(ls){let Wr=new i.P(0,0),Jr=!0;if(ls.textBox||ls.verticalTextBox){if(_e){const an=this.variableOffsets[Dt];an?(Wr=Lc(an.anchor,an.width,an.height,an.textOffset,an.textScale),Fe&&Wr._rotate(Re?this.transform.angle:-this.transform.angle)):Jr=!1}me&&(Jr=!Zt.clipped),ls.textBox&&Yf(d.textCollisionBox.collisionVertexArray,Zt.text.placed,!Jr||Mr,Et,at,Wr.x,Wr.y),ls.verticalTextBox&&Yf(d.textCollisionBox.collisionVertexArray,Zt.text.placed,!Jr||wr,Et,at,Wr.x,Wr.y)}const As=Jr&&!!(!wr&&ls.verticalIconBox);ls.iconBox&&Yf(d.iconCollisionBox.collisionVertexArray,Zt.icon.placed,As,Et,at,ht.hasIconTextFit?Wr.x:0,ht.hasIconTextFit?Wr.y:0),ls.verticalIconBox&&Yf(d.iconCollisionBox.collisionVertexArray,Zt.icon.placed,!As,Et,at,ht.hasIconTextFit?Wr.x:0,ht.hasIconTextFit?Wr.y:0)}}}if(d.fullyClipped=bt===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 ft=this.collisionCircleArrays[d.bucketInstanceId];d.placementInvProjMatrix=ft.invProjMatrix,d.placementViewportMatrix=ft.viewportMatrix,d.collisionCircleArray=ft.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 Yf(w,d,f,j,I,O,F){w.emplaceBack(d?1:0,f?1:0,O||0,F||0,j,I?1:0),w.emplaceBack(d?1:0,f?1:0,O||0,F||0,j,I?1:0),w.emplaceBack(d?1:0,f?1:0,O||0,F||0,j,I?1:0),w.emplaceBack(d?1:0,f?1:0,O||0,F||0,j,I?1:0)}const o5=Math.pow(2,25),Vv=Math.pow(2,24),Wk=Math.pow(2,17),l5=Math.pow(2,16),Gk=Math.pow(2,9),wd=Math.pow(2,8),Ep=Math.pow(2,1);function jd(w){if(w.opacity===0&&!w.placed)return 0;if(w.opacity===1&&w.placed)return 4294967295;const d=w.placed?1:0,f=Math.floor(127*w.opacity);return f*o5+d*Vv+f*Wk+d*l5+f*Gk+d*wd+f*Ep+d}const fx=0;class s0{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,f,j,I,O,F){const B=this._bucketParts;for(;this._currentTileIndexW.sortKey-J.sortKey));this._currentPartIndex{const W=i.o.now()-F;return!this._forceFullPlacement&&W>2};for(;this._currentPlacementIndex>=0;){const W=f[d[this._currentPlacementIndex]],J=this.placement.collisionIndex.transform.zoom;if(W.type==="symbol"&&W.visibility!=="none"&&(!W.minzoom||W.minzoom<=J)&&(!W.maxzoom||W.maxzoom>J)){const te=W,me=te.layout.get("symbol-z-elevate"),ue=te.layout.get("symbol-sort-key").constantOr(1)!==void 0,pe=te.layout.get("symbol-z-order"),ke=pe==="viewport-y"||pe==="auto"&&!(pe!=="viewport-y"&&ue),_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"),Fe=ke&&_e,Re=this._inProgressLayer=this._inProgressLayer||new s0(te),We=i.B(W.source,W.scope);if(Re.continuePlacement(me||Fe?I[We]:j[We],this.placement,this._showCollisionBoxes,W,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 Ip{constructor(d,f,j){this.tileID=d,this.bucketInstanceId=j,this.index=new i.c4(f.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const I=d.canonical.x*i.al,O=d.canonical.y*i.al;for(let F=0;FFe-Re);for(const Fe of _e){const Re=this.crossTileIDs[Fe];if(this.keys[Fe]===te&&!j.has(Re)){j.add(Re),J.crossTileID=Re;break}}}}}class ul{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class c5{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(d){const f=Math.round((d-this.lng)/360);if(f!==0)for(const j in this.indexes){const I=this.indexes[j],O={};for(const F in I){const B=I[F];B.tileID=B.tileID.unwrapTo(B.tileID.wrap+f),O[B.tileID.key]=B}this.indexes[j]=O}this.lng=d}addBucket(d,f,j){if(this.indexes[d.overscaledZ]&&this.indexes[d.overscaledZ][d.key]){if(this.indexes[d.overscaledZ][d.key].bucketInstanceId===f.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(d.overscaledZ,this.indexes[d.overscaledZ][d.key])}for(let O=0;Od.overscaledZ)for(const B in F){const W=F[B];W.tileID.isChildOf(d)&&W.findMatches(f.symbolInstances,d,I)}else{const B=F[d.scaledTo(Number(O)).key];B&&B.findMatches(f.symbolInstances,d,I)}}for(let O=0;O{f[j]=!0});for(const j in this.layerIndexes)f[j]||delete this.layerIndexes[j]}}const Dm=771;class fn{constructor(d,f,j,I){this.blendFunction=d,this.blendColor=f.toNonPremultipliedRenderColor(null),this.mask=j,this.blendEquation=I}}fn.Replace=[1,0,1,0],fn.disabled=new fn(fn.Replace,i.ao.transparent,[!1,!1,!1,!1]),fn.unblended=new fn(fn.Replace,i.ao.transparent,[!0,!0,!0,!0]),fn.alphaBlended=new fn([1,Dm,1,Dm],i.ao.transparent,[!0,!0,!0,!0]),fn.alphaBlendedNonPremultiplied=new fn([770,Dm,770,Dm],i.ao.transparent,[!0,!0,!0,!0]),fn.multiply=new fn([774,0,774,0],i.ao.transparent,[!0,!0,!0,!0]),fn.additive=new fn([1,1,1,1],i.ao.transparent,[!0,!0,!0,!0]);class _s{constructor(d,f,j){this.func=d,this.mask=f,this.range=j}}_s.ReadOnly=!1,_s.ReadWrite=!0,_s.disabled=new _s(519,_s.ReadOnly,[0,1]);const Kk=7680;class Gs{constructor(d,f,j,I,O,F){this.test=d,this.ref=f,this.mask=j,this.fail=I,this.depthFail=O,this.pass=F}}Gs.disabled=new Gs({func:519,mask:0},0,0,Kk,Kk,Kk);const n0=1029,Zk=2305;class Vs{constructor(d,f,j){this.enable=d,this.mode=f,this.frontFace=j}}function Rm(w,d){const f=i.ca(w,3);i.cc(w,d),i.cg(w,3,f)}function d5(w,d){const f=i.c7([]);return i.c8(f,f,-d),i.c9(f,f,-w),f}function Yk(w,d){const f=[w[0],w[1],0],j=[d[0],d[1],0];if(i.ag(f)>=1e-15){const F=i.aw([],f);i.c5(j,F,i.bJ(j,F)),d[0]=j[0],d[1]=j[1]}const I=i.bI([],d,w);if(i.c6(I)<1e-15)return null;const O=Math.atan2(-I[1],I[0]);return d5(Math.atan2(Math.sqrt(w[0]*w[0]+w[1]*w[1]),-w[2]),O)}Vs.disabled=new Vs(!1,n0,Zk),Vs.backCCW=new Vs(!0,n0,Zk),Vs.backCW=new Vs(!0,n0,2304),Vs.frontCW=new Vs(!0,1028,2304),Vs.frontCCW=new Vs(!0,1028,Zk);class kd{constructor(d,f){this.position=d,this.orientation=f}get position(){return this._position}set position(d){if(d){const f=d instanceof i.ae?d:new i.ae(d[0],d[1],d[2]);this._renderWorldCopies&&(f.x=i.bT(f.x,0,1)),this._position=f}else this._position=null}lookAtPoint(d,f,j){if(this.orientation=null,!this.position)return;const I=this.position,O=j||(this._elevation?this._elevation.getAtPointOrZero(i.ae.fromLngLat(d)):0),F=i.ae.fromLngLat(d,O),B=[F.x-I.x,F.y-I.y,F.z-I.z];f||(f=[0,0,1]),f[2]=Math.abs(f[2]),this.orientation=Yk(B,f)}setPitchBearing(d,f){this.orientation=d5(i.an(d),i.an(-f))}}class Xk{constructor(d,f){this._transform=i.bA([]),this.orientation=f,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 f;d&&i.cg(this._transform,3,[(f=d)[0],f[1],f[2],1])}get orientation(){return this._orientation}set orientation(d){this._orientation=d||i.c7([]),d&&Rm(this._transform,this._orientation)}getPitchBearing(){const d=this.forward(),f=this.right();return{bearing:Math.atan2(-f[1],f[0]),pitch:Math.atan2(Math.sqrt(d[0]*d[0]+d[1]*d[1]),-d[2])}}setPitchBearing(d,f){this._orientation=d5(d,f),Rm(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,f){const j=new Float64Array(16);return i.bl(j,this.getWorldToCamera(d,f)),j}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(d,f,j){const I=this.position;i.c5(I,I,-d);const O=new Float64Array(16);return i.bq(O,[j,j,j]),i.br(O,O,I),O[10]*=f,O}getWorldToCamera(d,f){const j=new Float64Array(16),I=new Float64Array(4),O=this.position;return i.cb(I,this._orientation),i.c5(O,O,-d),i.cc(j,I),i.br(j,j,O),j[1]*=-1,j[5]*=-1,j[9]*=-1,j[13]*=-1,j[8]*=f,j[9]*=f,j[10]*=f,j[11]*=f,j}getCameraToClipPerspective(d,f,j,I){const O=new Float64Array(16);return i.cd(O,d,f,j,I),O}getCameraToClipOrthographic(d,f,j,I,O,F){const B=new Float64Array(16);return i.ce(B,d,f,j,I,O,F),B}getDistanceToElevation(d,f=!1){const j=d===0?0:i.cf(d,f?i.a$(this.position[1]):this.position[1]),I=this.forward();return(j-this.position[2])/I[2]}clone(){return new Xk([...this.position],[...this.orientation])}}const Ol={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class Qk{constructor(d=0,f=0,j=0,I=0){if(isNaN(d)||d<0||isNaN(f)||f<0||isNaN(j)||j<0||isNaN(I)||I<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=d,this.bottom=f,this.left=j,this.right=I}interpolate(d,f,j){return f.top!=null&&d.top!=null&&(this.top=i.ak(d.top,f.top,j)),f.bottom!=null&&d.bottom!=null&&(this.bottom=i.ak(d.bottom,f.bottom,j)),f.left!=null&&d.left!=null&&(this.left=i.ak(d.left,f.left,j)),f.right!=null&&d.right!=null&&(this.right=i.ak(d.right,f.right,j)),this}getCenter(d,f){const j=i.aA((this.left+d-this.right)/2,0,d),I=i.aA((this.top+f-this.bottom)/2,0,f);return new i.P(j,I)}equals(d){return this.top===d.top&&this.bottom===d.bottom&&this.left===d.left&&this.right===d.right}clone(){return new Qk(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Zh=15;class u5{constructor(d,f,j,I,O,F,B){this.tileSize=512,this._renderWorldCopies=O===void 0||O,this._minZoom=d||0,this._maxZoom=f||22,this._minPitch=j??0,this._maxPitch=I??60,this.setProjection(F),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 Qk,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Xk,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 u5(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&&(!f||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const j=this._elevation;f||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,f=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],j=this.horizonLineFromTop();let I=0,O=0;for(let F=0;F{const Fe=i.cY(ue,me,pe,ke,_e);W.has(Fe)||(O.push(new i.aQ(me,ue,pe,ke,_e)),W.add(Fe))};for(let me=0;meue.canonical.z)continue;const pe=ue.canonical,ke=ue.overscaledZ,_e=ue.wrap,Fe=1<0,at=pe.y+10,kt=ue.wrap-(We?0:1),yt=ue.wrap+(Re?0:1),bt=We?pe.x-1:Fe-1,ft=Re?pe.x+1:0;if(F)j[0]<0?(J(ke,yt,pe.z,ft,pe.y),j[1]<0&&at&&(J(ke,_e,pe.z,pe.x,pe.y+1),J(ke,yt,pe.z,ft,pe.y+1)),j[1]>0&&Ge&&(J(ke,_e,pe.z,pe.x,pe.y-1),J(ke,yt,pe.z,ft,pe.y-1))):j[0]>0?(J(ke,kt,pe.z,bt,pe.y),j[1]<0&&at&&(J(ke,_e,pe.z,pe.x,pe.y+1),J(ke,kt,pe.z,bt,pe.y+1)),j[1]>0&&Ge&&(J(ke,_e,pe.z,pe.x,pe.y-1),J(ke,kt,pe.z,bt,pe.y-1))):j[1]<0&&at?J(ke,_e,pe.z,pe.x,pe.y+1):Ge&&J(ke,_e,pe.z,pe.x,pe.y-1);else{const ht=ue.visibleQuadrants;1&ht&&(J(ke,kt,pe.z,bt,pe.y),Ge&&(J(ke,_e,pe.z,pe.x,pe.y-1),J(ke,kt,pe.z,bt,pe.y-1))),2&ht&&(J(ke,yt,pe.z,ft,pe.y),Ge&&(J(ke,_e,pe.z,pe.x,pe.y-1),J(ke,yt,pe.z,ft,pe.y-1))),4&ht&&(J(ke,kt,pe.z,bt,pe.y),at&&(J(ke,_e,pe.z,pe.x,pe.y+1),J(ke,kt,pe.z,bt,pe.y+1))),8&ht&&(J(ke,yt,pe.z,ft,pe.y),at&&(J(ke,_e,pe.z,pe.x,pe.y+1),J(ke,yt,pe.z,ft,pe.y+1)))}}const te=[];for(const me of O)O.some(ue=>me.isChildOf(ue))||te.push(me);if(O=te.filter(me=>!d.some(ue=>!!(me.overscaledZ{const Re=Fe.canonical.x+.5-pe[0],We=Fe.canonical.y+.5-pe[1];return Re*Re+We*We<_e})}return O}extendTileCoverToNearPlane(d,f,j){const I=[],O=new Set;for(const We of d)O.add(We.key);const F=(We,at,Ge,kt,yt)=>{const bt=i.cY(at,We,Ge,kt,yt);O.has(bt)||(I.push(new i.aQ(We,at,Ge,kt,yt)),O.add(bt))},B=d.reduce((We,at)=>Math.max(We,at.overscaledZ),j),W=1<{const Ge=Math.floor(We[0]),kt=Math.floor(We[1]),yt=(We[0]-Ge)*i.al,bt=(We[1]-kt)*i.al,ft=Math.floor(at[0]),ht=Math.floor(at[1]),Ct=(at[0]-ft)*i.al,Rt=(at[1]-ht)*i.al;for(let Dt=-1;Dt<=1;Dt++){const Yt=Ge+Dt;if(!(Yt<0||Yt>=W)){te.x=yt-Dt*i.al,me.x=Ct-(Yt-ft)*i.al;for(let Xt=-1;Xt<=1;Xt++){const lr=kt+Xt;te.y=bt-Xt*i.al,me.y=Rt-(lr-ht)*i.al,i.cZ(te,me,J)&&F(B,0,j,Yt,lr)}}}},pe=f.points,ke=pe[i.cv],_e=pe[i.cw],Fe=this._projectToGround(ke,pe[i.cx]),Re=this._projectToGround(_e,pe[i.cy]);return ue(ke,Fe),ue(_e,Re),I}_projectToGround(d,f){return i.cz(i.cA(),d,f,d[2]/(d[2]-f[2]))}coveringTiles(d){let f=this.coveringZoomLevel(d);const j=f,I=this.elevation&&this.elevation.exaggeration(),O=I&&!d.isTerrainDEM,F=this.projection.name==="mercator";if(d.minzoom!==void 0&&fd.maxzoom&&(f=d.maxzoom);const B=this.locationCoordinate(this.center),W=this.center.lat,J=1<{const Zt=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(),Xr=Zt.toLngLat(),Mr=hr.toLngLat(),wr=this.locationCoordinate(Ir),fs=this.locationCoordinate(Xr),ls=this.locationCoordinate(Mr),Wr=Math.hypot(fs.x-wr.x,fs.y-wr.y),Jr=Math.hypot(ls.x-wr.x,ls.y-wr.y);return Math.sqrt(Wr*Jr)*bt/25e-6},ht=Et=>{const er=kt,Zt=yt;return{aabb:i.cF(this,J,0,0,0,Et,Zt,er,this.projection),zoom:0,x:0,y:0,minZ:Zt,maxZ:er,wrap:Et,fullyVisible:!1}},Ct=[];let Rt=[];const Dt=f,Yt=d.reparseOverscaled?j:f,Xt=(Fe-this._centerAltitude)*_e,lr=Et=>{if(!this._elevation||!Et.tileID||!F)return;const er=this._elevation.getMinMaxForTile(Et.tileID),Zt=Et.aabb;er?(Zt.min[2]=er.min,Zt.max[2]=er.max,Zt.center[2]=(Zt.min[2]+Zt.max[2])/2):(Et.shouldSplit=Ht(Et),Et.shouldSplit||(Zt.min[2]=Zt.max[2]=Zt.center[2]=this._centerAltitude))},br=(Et,er)=>{if(.707*er{if(Et.zoom=.9)return!0}else if(O&&(hr=Et.aabb.distanceZ(Re)*_e),this.projection.isReprojectedInTileSpace&&j<=5){const Jr=Math.pow(2,Et.zoom),As=ft(new i.ae((Et.x+.5)/Jr,(Et.y+.5)/Jr));Ir=As>.85?1:As}if(!F&&!me){const Jr=Math.sqrt(er*er+Zt*Zt+hr*hr);let As=(1<0;){const Et=Ct.pop(),er=Et.x,Zt=Et.y;let hr=Et.fullyVisible;const Ir=()=>this.projection.name==="globe"&&(Et.y===0||Et.y===(1<>1),fs={aabb:F?Et.aabb.quadrant(Xr):i.cF(this,J,Et.zoom+1,Mr,wr,Et.wrap,Et.minZ,Et.maxZ,this.projection),zoom:Et.zoom+1,x:Mr,y:wr,wrap:Et.wrap,fullyVisible:hr,tileID:void 0,shouldSplit:void 0,minZ:Et.minZ,maxZ:Et.maxZ};O&&!me&&(fs.tileID=new i.aQ(Et.zoom+1===Dt?Yt:Et.zoom+1,Et.wrap,Et.zoom+1,Mr,wr),lr(fs)),Ct.push(fs)}else{const Xr=Et.zoom===Dt?Yt:Et.zoom;if(d.minzoom&&d.minzoom>Xr)continue;let Mr=0;if(!hr){let Wr=We?Et.aabb.intersectsPrecise(pe):Et.aabb.intersectsPreciseFlat(pe);if(Wr===0&&Ir()){const Jr=new i.cD(Et.zoom,er,Zt);Wr=i.cE(this,J,Jr,!0).intersectsPrecise(pe)}if(Wr===0)continue;if(d.calculateQuadrantVisibility)if(pe.containsPoint(Et.aabb.center))Mr=15;else for(let Jr=0;Jr<4;Jr++)Et.aabb.quadrant(Jr).intersects(pe)!==0&&(Mr|=1<{const hr=[0,0,0,1],Ir=[i.al,i.al,0,1],Xr=this.calculateFogTileMatrix(Zt.tileID.toUnwrapped());i.aC(hr,hr,Xr),i.aC(Ir,Ir,Xr);const Mr=i.cG([],hr,Ir),wr=i.cH([],hr,Ir),fs=i.c$(Mr,wr);if(fs===0)return!0;let ls=!1;const Wr=this._elevation;if(Wr&&fs>Et&&er!==0){const Jr=this.calculateProjMatrix(Zt.tileID.toUnwrapped());let As;d.isTerrainDEM||(As=Wr.getMinMaxForTile(Zt.tileID)),As||(As={min:yt,max:kt});const an=i.cI(this.rotation),Kn=[an[0]*i.al,an[1]*i.al,As.max];i.af(Kn,Kn,Jr),ls=(1-Kn[1])*this.height*.5Et.distanceSq-er.distanceSq).map(Et=>Et.tileID)}resize(d,f){this.width=d,this.height=f,this.pixelsToGLUnits=[2/d,-2/f],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 f=i.aA(d.lat,-i.cJ,i.cJ),j=this.projection.project(d.lng,f);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,f){let j,I;const O=this.centerPoint;if(this.projection.name==="globe"){const B=this.worldSize;j=(f.x-O.x)/B,I=(f.y-O.y)/B}else{const B=this.pointCoordinate(f),W=this.pointCoordinate(O);j=B.x-W.x,I=B.y-W.y}const F=this.locationCoordinate(d);this.setLocation(new i.ae(F.x-j,F.y-I))}setLocation(d){this.center=this.coordinateLocation(d),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(d,f){return this.projection.locationPoint(this,d,f)}locationPoint3D(d,f){return this.projection.locationPoint(this,d,f,!0)}pointLocation(d){return this.coordinateLocation(this.pointCoordinate(d))}pointLocation3D(d,f){return this.coordinateLocation(this.pointCoordinate3D(d,f))}locationCoordinate(d,f){const j=f?i.cf(f,d.lat):void 0,I=this.projection.project(d.lng,d.lat);return new i.ae(I.x,I.y,j)}coordinateLocation(d){return this.projection.unproject(d.x,d.y)}pointRayIntersection(d,f){const j=f??this._centerAltitude,I=[d.x,d.y,0,1],O=[d.x,d.y,1,1];i.aC(I,I,this.pixelMatrixInverse),i.aC(O,O,this.pixelMatrixInverse);const F=O[3];i.cK(I,I,1/I[3]),i.cK(O,O,1/F);const B=I[2],W=O[2];return{p0:I,p1:O,t:B===W?0:(j-B)/(W-B)}}screenPointToMercatorRay(d){const f=[d.x,d.y,0,1],j=[d.x,d.y,1,1];return i.aC(f,f,this.pixelMatrixInverse),i.aC(j,j,this.pixelMatrixInverse),i.cK(f,f,1/f[3]),i.cK(j,j,1/j[3]),f[2]=i.cf(f[2],this._center.lat)*this.worldSize,j[2]=i.cf(j[2],this._center.lat)*this.worldSize,i.cK(f,f,1/this.worldSize),i.cK(j,j,1/this.worldSize),new i.ax([f[0],f[1],f[2]],i.aw([],i.av([],j,f)))}rayIntersectionCoordinate(d){const{p0:f,p1:j,t:I}=d,O=i.cf(f[2],this._center.lat),F=i.cf(j[2],this._center.lat);return new i.ae(i.ak(f[0],j[0],I)/this.worldSize,i.ak(f[1],j[1],I)/this.worldSize,i.ak(O,F,I))}pointCoordinate(d,f=this._centerAltitude){return this.projection.pointCoordinate(this,d.x,d.y,f)}pointCoordinate3D(d,f){if(!this.elevation)return this.pointCoordinate(d,f);let j=this.projection.pointCoordinate3D(this,d.x,d.y);if(j)return new i.ae(j[0],j[1],j[2]);let I=0,O=this.horizonLineFromTop();if(d.y>O)return this.pointCoordinate(d,f);const F=.02*O,B=d.clone();for(let W=0;W<10&&O-I>F;W++){B.y=i.ak(I,O,.66);const J=this.projection.pointCoordinate3D(this,B.x,B.y);J?(O=B.y,j=J):I=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 f=this.pointCoordinate(d);return f.y>=0&&f.y<=1}_coordinatePoint(d,f){const j=f&&this.elevation?this.elevation.getAtPointOrZero(d,this._centerAltitude):this._centerAltitude,I=[d.x*this.worldSize,d.y*this.worldSize,j+d.toAltitude(),1];return i.aC(I,I,this.pixelMatrix),I[3]>0?new i.P(I[0]/I[3],I[1]/I[3]):new i.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:d,left:f}=this._edgeInsets,j=this.height-this._edgeInsets.bottom,I=this.width-this._edgeInsets.right,O=this.pointLocation3D(new i.P(f,d)),F=this.pointLocation3D(new i.P(I,d)),B=this.pointLocation3D(new i.P(I,j)),W=this.pointLocation3D(new i.P(f,j));let J=Math.min(O.lng,F.lng,B.lng,W.lng),te=Math.max(O.lng,F.lng,B.lng,W.lng),me=Math.min(O.lat,F.lat,B.lat,W.lat),ue=Math.max(O.lat,F.lat,B.lat,W.lat);const pe=Math.pow(2,-this.zoom)/16*270,ke=this.projection.name==="globe"?1:4,_e=(Fe,Re,We,at,Ge)=>{const kt=(Fe+We)/2,yt=(Re+at)/2,bt=new i.P(kt,yt),{lng:ft,lat:ht}=this.pointLocation3D(bt),Ct=Math.max(0,J-ft,me-ht,ft-te,ht-ue);J=Math.min(J,ft),te=Math.max(te,ft),me=Math.min(me,ht),ue=Math.max(ue,ht),(Gepe)&&(_e(Fe,Re,kt,yt,Ge+1),_e(kt,yt,We,at,Ge+1))};if(_e(f,d,I,d,1),_e(I,d,I,j,1),_e(I,j,f,j,1),_e(f,j,f,d,1),this.projection.name==="globe"){const[Fe,Re]=i.cM(this);Fe?(ue=90,te=180,J=-180):Re&&(me=-90,te=180,J=-180)}return new i.aI(new i.aT(J,me),new i.aT(te,ue))}_getBoundsRectangular(d,f){const{top:j,left:I}=this._edgeInsets,O=this.height-this._edgeInsets.bottom,F=this.width-this._edgeInsets.right,B=new i.P(I,j),W=new i.P(F,j),J=new i.P(F,O),te=new i.P(I,O);let me=this.pointCoordinate(B,d),ue=this.pointCoordinate(W,d);const pe=this.pointCoordinate(J,f),ke=this.pointCoordinate(te,f),_e=(Fe,Re)=>(Re.y-Fe.y)/(Re.x-Fe.x);return me.y>1&&ue.y>=0?me=new i.ae((1-ke.y)/_e(ke,me)+ke.x,1):me.y<0&&ue.y<=1&&(me=new i.ae(-ke.y/_e(ke,me)+ke.x,0)),ue.y>1&&me.y>=0?ue=new i.ae((1-pe.y)/_e(pe,ue)+pe.x,1):ue.y<0&&me.y<=1&&(ue=new i.ae(-pe.y/_e(pe,ue)+pe.x,0)),new i.aI().extend(this.coordinateLocation(me)).extend(this.coordinateLocation(ue)).extend(this.coordinateLocation(ke)).extend(this.coordinateLocation(pe))}_getBoundsRectangularTerrain(){const d=this.elevation;if(!d.visibleDemTiles.length||d.isUsingMockSource())return this._getBoundsRectangular(0,0);const f=d.visibleDemTiles.reduce((j,I)=>{if(I.dem){const O=I.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(f.min*d.exaggeration(),f.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 f=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,j=this.height/2-f*(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.maxLngme&&(B=me-J),me-tepe&&(F=pe-W),pe-ue{for(let Ht=0;Ht<16;Ht++)Yt[Ht]=i.ak(Xt[Ht],lr[Ht],br)})(B,B,W,i.d0(this.pitch>=Zh?1:this.pitch/Zh))}else B=W;const J=i.cP([],W,F);let te=i.cP([],B,F);if(this.projection.isReprojectedInTileSpace){const ht=this.locationCoordinate(this.center),Ct=i.bA([]);i.br(Ct,Ct,[ht.x*this.worldSize,ht.y*this.worldSize,0]),i.aB(Ct,Ct,i.cQ(this)),i.br(Ct,Ct,[-ht.x*this.worldSize,-ht.y*this.worldSize,0]),i.aB(te,te,Ct),i.aB(J,J,Ct),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),f){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,F)}else this.expandedFarZProjMatrix=this.projMatrix;const me=i.bl([],B);this.frustumCorners=i.cT.fromInvProjectionMatrix(me,this.horizonLineFromTop(),this.height),this.cameraFrustum=i.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!f);const ue=new Float32Array(16);i.bA(ue),i.cS(ue,ue,[1,-1,1]),i.cU(ue,ue,this._pitch),i.bB(ue,ue,this.angle);const pe=i.cd(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=i.bz(pe);const ke=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;pe[8]=2*-d.x/this.width,pe[9]=2*(d.y+ke)/this.height,this.skyboxMatrix=i.aB(ue,pe,ue);const _e=this.point,Fe=_e.x,Re=_e.y,We=this.width%2/2,at=this.height%2/2,Ge=Math.cos(this.angle),kt=Math.sin(this.angle),yt=Fe-Math.round(Fe)+Ge*We+kt*at,bt=Re-Math.round(Re)+Ge*at+kt*We,ft=new Float64Array(te);if(i.br(ft,ft,[yt>.5?yt-1:yt,bt>.5?bt-1:bt,0]),this.alignedProjMatrix=ft,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,F),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,f=this.cameraPixelsPerMeter,j=this._camera.position,I=1/this.height/this._pixelsPerMercatorPixel,O=[d,d,f];i.c5(O,O,I),i.c5(j,j,-1),i.cW(j,j,O);const F=i.bC();i.br(F,F,j),i.cS(F,F,O),this.mercatorFogMatrix=F,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(d,f,I)}_computeCameraPosition(d){const f=(d=d||this.pixelsPerMeter)/this.pixelsPerMeter,j=this._camera.forward(),I=this.point,O=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*f-d/this.worldSize*this._centerAltitude;return[I.x/this.worldSize-j[0]*O,I.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 f=this._maxCameraBoundsDistance()*Math.cos(this._pitch),j=this._camera.position[2],I=d[2];let O=1;this.projection.wrap&&(this.center=this.center.wrap()),I>0&&(O=Math.min((f-j)/I,1)),this._camera.position=i.bH([],this._camera.position,d,O),this._updateStateFromCamera()}_updateStateFromCamera(){const d=this._camera.position,f=this._camera.forward(),{pitch:j,bearing:I}=this._camera.getPitchBearing(),O=i.cf(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,F=this._mercatorZfromZoom(this._maxZoom)*Math.cos(i.an(this._maxPitch)),B=Math.max((d[2]-O)/Math.cos(j),F),W=this._zoomFromMercatorZ(B);i.bH(d,d,f,B),this._pitch=i.aA(j,i.an(this.minPitch),i.an(this.maxPitch)),this.angle=i.bT(I,-Math.PI,Math.PI),this._setZoom(i.aA(W,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 f=0,j=i.cL,I=0,O=1/0;for(;j-f>1e-6&&j>f;){const F=f+.5*(j-f),B=this.tileSize*Math.pow(2,F),W=this.getCameraToCenterDistance(this.projection,F,B),J=this.scaleZoom(W/(Math.max(0,d)*this.tileSize)),te=Math.abs(F-J);teJ||ue.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,f){const j=i.ag(i.av([],this._camera.position,d)),I=this._zoomFromMercatorZ(j)+f;return j-this._mercatorZfromZoom(I)}getCameraPoint(){if(this.projection.name==="globe"){const d=function([f,j,I],O){const F=[f,j,I,1];i.aC(F,F,O);const B=F[3]=Math.max(F[3],1e-6);return F[0]/=B,F[1]/=B,F[2]/=B,F}([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,f=this.zoom,j=this.worldSize){const I=i.cO(d,f,this.width,this.height,1024),O=d.pixelSpaceConversion(this.center.lat,j,I);let F=.5/Math.tan(.5*this._fov)*this.height*O;return this.isOrthographic&&(F=i.ak(1,F,i.d0(this.pitch>=Zh?1:this.pitch/Zh))),F}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 Xf=(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 f=w.transform,j=Math.max(Math.abs(f._zoom-(w.minCutoffZoom-1)),1),I=f.isLODDisabled(!1)?i.ah(60,45,f.pitch):i.ah(30,15,f.pitch),O=f._farZ-f._nearZ,F=d*f.height,B=((1-(W=I))*f.cameraToCenterDistance+W*(f._farZ+F))*j;var W;return{shouldRenderCutoff:I<1,uniformValues:{u_cutoff_params:[f._nearZ,f._farZ,(B-f._nearZ)/O,(B-F-f._nearZ)/O]}}},gh=2048;class Hv{constructor(d,f){this.aabb=d,this.lastCascade=f}}class Vie{add(d,f){const j=this.receivers[d.key];j!==void 0?(j.aabb.min[0]=Math.min(j.aabb.min[0],f.min[0]),j.aabb.min[1]=Math.min(j.aabb.min[1],f.min[1]),j.aabb.min[2]=Math.min(j.aabb.min[2],f.min[2]),j.aabb.max[0]=Math.max(j.aabb.max[0],f.max[0]),j.aabb.max[1]=Math.max(j.aabb.max[1],f.max[1]),j.aabb.max[2]=Math.max(j.aabb.max[2],f.max[2])):this.receivers[d.key]=new Hv(f,null)}clear(){this.receivers={}}get(d){return this.receivers[d.key]}computeRequiredCascades(d,f,j){const I=i.d9.fromPoints(d.points);let O=0;for(const F in this.receivers){const B=this.receivers[F];if(!B||!I.intersectsAabb(B.aabb))continue;B.aabb.min=I.closestPoint(B.aabb.min),B.aabb.max=I.closestPoint(B.aabb.max);const W=B.aabb.getCorners();for(let J=0;J1||ue[1]<-1||ue[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 Vie,this._depthMode=new _s(d.context.gl.LEQUAL,_s.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,f){const j=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!f||!f.properties)return;const I=f.properties.get("shadow-intensity");if(!f.shadowsEnabled()||I<=0||(this._shadowLayerCount=j.style.order.reduce((ke,_e)=>{const Fe=j.style._mergedLayers[_e];return ke+(Fe.hasShadowPass()&&!Fe.isHidden(d.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const O=j.context,F=gh,B=gh;if(this._cascades.length===0||gh!==this._cascades[0].texture.size[0]){this._cascades=[];for(let ke=0;ke<2;++ke){const _e=j._shadowMapDebug,Fe=O.gl,Re=O.createFramebuffer(F,B,_e?1:0,"texture"),We=new i.T(O,{width:F,height:B,data:null},Fe.DEPTH_COMPONENT16);if(Re.depthAttachment.set(We.texture),_e){const at=new i.T(O,{width:F,height:B,data:null},Fe.RGBA8);Re.colorAttachment0.set(at.texture)}this._cascades.push({framebuffer:Re,texture:We,matrix:[],far:0,boundingSphereRadius:0,frustum:new i.cB,scale:0})}}this.shadowDirection=Gv(f);let W=0;if(d.elevation){const ke=d.elevation,_e=[1e4,-1e4];ke.visibleDemTiles.filter(Fe=>Fe.dem).forEach(Fe=>{const Re=Fe.dem.tree;_e[0]=Math.min(_e[0],Re.minimums[0]),_e[1]=Math.max(_e[1],Re.maximums[0])}),_e[0]!==1e4&&(W=(_e[1]-_e[0])*ke.exaggeration())}const J=1.5*d.cameraToCenterDistance,te=3*J,me=new Float64Array(16);for(let ke=0;ke=0)return{};const O=function(W,J,te){const me=te/(1<0&&(i.d8(O[1],O[1],[I[0]*F,0,0]),i.d8(O[2],O[2],[I[0]*F,0,0])),I[1]<0?(i.d8(O[0],O[0],[0,I[1]*F,0]),i.d8(O[1],O[1],[0,I[1]*F,0])):I[1]>0&&(i.d8(O[2],O[2],[0,I[1]*F,0]),i.d8(O[3],O[3],[0,I[1]*F,0]));const B={};return B.vertices=O,B.planes=[Wv(O[1],O[0],O[4]),Wv(O[2],O[1],O[5]),Wv(O[3],O[2],O[6]),Wv(O[0],O[3],O[7])],B}addShadowReceiver(d,f,j){this._receivers.add(d,i.d9.fromTileIdAndHeight(d,f,j))}getMaxCascadeForTile(d){const f=this._receivers.get(d);return f&&f.lastCascade?f.lastCascade:0}}function Wv(w,d,f){const j=i.av([],f,d),I=i.av([],w,d),O=i.bI([],j,I),F=i.ag(O);return F===0?[0,0,1,0]:(i.c5(O,O,1/F),[O[0],O[1],O[2],-i.bJ(O,d)])}function Gv(w){const d=w.properties.get("direction"),f=i.d4(d.x,d.y,d.z);f[2]=i.aA(f[2],0,75);const j=i.d6([f[0],f[1],f[2]]);return i.d5(j.x,j.y,j.z)}function Pp(w,d,f){const j=d.properties.get("color-use-theme")==="none",I=d.properties.get("color"),O=d.properties.get("intensity"),F=d.properties.get("direction"),B=[F.x,F.y,F.z],W=f.properties.get("color-use-theme")==="none",J=f.properties.get("color"),te=f.properties.get("intensity"),me=Math.max(i.bJ([0,0,1],B),0),ue=[0,0,0];i.c5(ue,J.toPremultipliedRenderColor(W?null:w.getLut(d.scope)).toArray01Linear().slice(0,3),te);const pe=[0,0,0];return i.c5(pe,I.toPremultipliedRenderColor(j?null:w.getLut(f.scope)).toArray01Linear().slice(0,3),me*O),i.db([ue[0]>0?ue[0]/(ue[0]+pe[0]):0,ue[1]>0?ue[1]/(ue[1]+pe[1]):0,ue[2]>0?ue[2]/(ue[2]+pe[2]):0])}function Qf(w,d,f,j,I,O){const F=w.zoom,B=w.scale,W=w.worldSize,J=1/W,te=w.aspect,me=Math.sqrt(1+te*te)*Math.tan(.5*w.fovX),ue=me*me,pe=j-f,ke=j+f;let _e,Fe;ue>pe/ke?(_e=j,Fe=j*me):(_e=.5*ke*(1+ue),Fe=.5*Math.sqrt(pe*pe+2*(j*j+f*f)*ue+ke*ke*ue*ue));const Re=w.projection.pixelsPerMeter(w.center.lat,W),We=w._camera.getCameraToWorldMercator(),at=[0,0,-_e*J];i.af(at,at,We);let Ge=Fe*J;const kt=w._edgeInsets;if(!(kt.left===0&&kt.top===0&&kt.right===0&&kt.bottom===0||kt.left===kt.right&&kt.top===kt.bottom)){const hr=w._camera.getWorldToCamera(w.worldSize,w.projection.zAxisUnit==="meters"?Re:1),Ir=w._camera.getCameraToClipPerspective(w._fov,w.width/w.height,f,j);Ir[8]=2*-w.centerOffset.x/w.width,Ir[9]=2*w.centerOffset.y/w.height;const Xr=new Float64Array(16);i.cP(Xr,Ir,hr);const Mr=new Float64Array(16);i.bl(Mr,Xr);const wr=i.cB.fromInvProjectionMatrix(Mr,W,F,!0);for(const fs of wr.points){const ls=((yt=fs)[0]/=B,yt[1]/=B,yt[2]=i.cf(yt[2],w._center.lat),yt);Ge=Math.max(Ge,i.c6(i.da([],at,ls)))}}var yt;Ge*=I/(I-1);const bt=Math.acos(d[2]),ft=Math.atan2(-d[0],-d[1]),ht=new Xk;ht.position=at,ht.setPitchBearing(bt,ft);const Ct=ht.getWorldToCamera(W,Re),Rt=Ge*W,Dt=Math.min(w._mercatorZfromZoom(17)*W*-2,-2*Rt),Yt=ht.getCameraToClipOrthographic(-Rt,Rt,-Rt,Rt,Dt,(Rt+O*Re)/d[2]),Xt=new Float64Array(16);i.aB(Xt,Yt,Ct);const lr=i.d5(Math.floor(1e6*at[0])/1e6*W,Math.floor(1e6*at[1])/1e6*W,0),br=.5*I,Ht=[0,0,0];i.af(Ht,lr,Xt),i.c5(Ht,Ht,br);const Et=[Math.floor(Ht[0]),Math.floor(Ht[1]),Math.floor(Ht[2])],er=[0,0,0];i.av(er,Ht,Et),i.c5(er,er,-1/br);const Zt=new Float64Array(16);return i.bA(Zt),i.br(Zt,Zt,er),i.aB(Xt,Zt,Xt),[Xt,Rt]}class Hie extends i.E{constructor(d){super(),this.requestManager=d,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(d,f){return i.dc(this.requestManager.transformRequest(f,i.R.Model).url).then(j=>{if(!j)return;const I=i.dd(j),O=new i.de(d,f,void 0,void 0,I);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 ${f}: ${j.message}`)))})}load(d,f,j={forceReload:!1}){this.models[f]||(this.models[f]={});const I=Object.keys(d),O=[],F=[];for(const B of I){const W=d[B];this.hasURLBeenRequested(W)&&!j.forceReload||(this.modelByURL[W]={modelId:B,scope:f},O.push(this.loadModel(B,W)),F.push(B)),this.models[f][B]||(this.models[f][B]={model:null,numReferences:1})}this.numModelsLoading[f]=(this.numModelsLoading[f]||0)+F.length,Promise.allSettled(O).then(B=>{for(let W=0;W{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,f,j={exactIdMatch:!1}){return!!(j.exactIdMatch?this.getModel(d,f):this.getModelByURL(this.modelUris[f][d]))}getModel(d,f){return this.models[f]||(this.models[f]={}),this.models[f][d]?this.models[f][d].model:void 0}getModelByURL(d){if(!d)return null;const f=this.modelByURL[d];return f?this.models[f.scope][f.modelId].model:null}hasModelBeenAdded(d,f){return this.models[f]&&this.models[f][d]!==void 0}getModelURIs(d){return this.modelUris[d]||{}}addModel(d,f,j){this.models[j]||(this.models[j]={}),this.modelUris[j]||(this.modelUris[j]={});const I=this.requestManager.normalizeModelURL(f);if((this.hasModel(d,j,{exactIdMatch:!0})||this.hasModelBeenAdded(d,j))&&this.modelUris[j][d]===I)this.models[j][d].numReferences++;else if(this.hasURLBeenRequested(I)){const{scope:O,modelId:F}=this.modelByURL[I];this.models[O][F].numReferences++}else this.modelUris[j][d]=I,this.load({[d]:this.modelUris[j][d]},j)}addModelURLs(d,f){this.models[f]||(this.models[f]={}),this.modelUris[f]||(this.modelUris[f]={});const j=this.modelUris[f];for(const I in d)j[I]=this.requestManager.normalizeModelURL(d[I])}reloadModels(d){this.load(this.modelUris[d],d,{forceReload:!0})}addModelsFromBucket(d,f){this.models[f]||(this.models[f]={}),this.modelUris[f]||(this.modelUris[f]={});const j={};for(const I of d)this.hasModel(I,f,{exactIdMatch:!0})||this.hasURLBeenRequested(I)?this.models[f][I].numReferences++:this.modelUris[f][I]&&!this.hasURLBeenRequested(I)?j[I]=this.modelUris[f][I]:!this.hasURLBeenRequested(I)&&i.df(I,!1)&&(this.modelUris[f][I]=this.requestManager.normalizeModelURL(I),j[I]=this.modelUris[f][I]);this.load(j,f)}hasURLBeenRequested(d){return this.modelByURL[d]!==void 0}removeModel(d,f,j=!1,I=!1){if(this.models[f]&&this.models[f][d]&&(this.models[f][d].numReferences--,this.models[f][d].numReferences===0||I)){const O=this.modelUris[f][d];j||delete this.modelUris[f][d],delete this.modelByURL[O];const F=this.models[f][d].model;if(!F)return;delete this.models[f][d],F.destroy()}}destroy(){for(const d of Object.keys(this.models))for(const f of Object.keys(this.models[d])){const j=this.models[d][f].model;delete this.models[d][f],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,f){this.models[f]||(this.models[f]={});for(const j in this.models[f])this.models[f][j].model&&this.models[f][j].model.upload(d.context)}}const h5=i.a6.colorTheme,Wie=new i.a9({data:new i.aa(h5.data)});function zP(w){if(!w.metadata||!w.metadata.content_area)return;const d=i.o.devicePixelRatio,{left:f,top:j,width:I,height:O}=w.metadata.content_area,F=f*d,B=j*d;return[F,B,F+I*d,B+O*d]}function BP(w){if(w)return w.map(([d,f])=>[d*i.o.devicePixelRatio,f*i.o.devicePixelRatio])}class m5{constructor(d,f,j){this.id=d,this.scope=f,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 f=this.sourceCache.getVisibleCoordinates();if(f.length===0)return d;const j=this.sourceCache.getSource();if(!(j instanceof fc))return d;const I=f.map(F=>this.sourceCache.getTile(F)),O=j.getImages(I,Array.from(this.pendingRequests));for(const[F,B]of O)d.set(i.I.from({name:F,iconsetId:this.id}),B),this.pendingRequests.delete(F);for(const F of this.pendingRequests)this.missingRequests.add(F);return this.pendingRequests.clear(),d}}const Jf=(w,d)=>Ye(w,d&&d.filter(f=>f.identifier!=="source.canvas")),$P=i.aH(ea,["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"]),UP=i.aH(ea,["setCenter","setZoom","setBearing","setPitch"]),Jk=new Set(["background","sky","slot","custom"]),eg={version:8,layers:[],sources:{}},Kv={duration:300,delay:0};class xh extends i.E{constructor(d,f={}){super(),this.map=d,this.scope=f.scope||"",this.globalId=null,this.fragments=[],this.importDepth=f.importDepth||0,this.importsCache=f.importsCache||new Map,this.resolvedImports=f.resolvedImports||new Set,this.transition=Object.assign({},Kv),this._buildingIndex=new a5(this),this.crossTileSymbolIndex=new Kh,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=f.styleChanges||new je,this._hasDataDrivenEmissive=!1,this.dispatcher=f.dispatcher?f.dispatcher:new i.D(i.dh(),this),f.imageManager?this.imageManager=f.imageManager:(this.imageManager=new Ce(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=f.glyphManager?f.glyphManager:new i.di(d._requestManager,f.localFontFamily?i.dj.all:f.localIdeographFontFamily?i.dj.ideographs:i.dj.none,f.localFontFamily||f.localIdeographFontFamily),f.modelManager?this.modelManager=f.modelManager:(this.modelManager=new Hie(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=f.configOptions?f.configOptions:new Map,this._configDependentLayers=f.configDependentLayers?f.configDependentLayers:new Set,this._indoorDependentLayers=f.indoorDependentLayers?f.indoorDependentLayers:new Set,this._config=f.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:f.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=f.initialConfig,this.dispatcher.broadcast("setReferrer",i.dk());const j=this;this._rtlTextPluginCallback=xh.registerForPluginStateChange(I=>{j.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:I.pluginStatus,pluginURL:I.pluginURL},(O,F)=>{if(i.dl(O),F&&F.every(B=>B))for(const B in j._sourceCaches){const W=j._sourceCaches[B],J=W.getSource().type;J!=="vector"&&J!=="geojson"||W.reload()}})}),this.on("data",I=>{if(I.dataType!=="source"||I.sourceDataType!=="metadata")return;const O=this.getOwnSource(I.sourceId);if(O&&O.vectorLayerIds)for(const F in this._layers){const B=this._layers[F];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 f=i.dm(d);if(!f.startsWith("http"))try{return new URL(f,location.href).toString()}catch{return f}return f}return`json://${i.dn(JSON.stringify(d))}`}_diffStyle(d,f,j){this.globalId=this._getGlobalId(d);const I=(O,F)=>{try{F(null,this.setState(O,j))}catch(B){F(B,!1)}};if(typeof d=="string"){const O=this.map._requestManager.normalizeStyleURL(d),F=this.map._requestManager.transformRequest(O,i.R.Style);i.m(F,(B,W)=>{B?this.fire(new i.y(B)):W&&I(W,f)})}else typeof d=="object"&&I(d,f)}loadURL(d,f={}){this.fire(new i.z("dataloading",{dataType:"style"}));const j=typeof f.validate=="boolean"?f.validate:!i.h(d);this.globalId=this._getGlobalId(d),d=this.map._requestManager.normalizeStyleURL(d,f.accessToken),this.resolvedImports.add(d);const I=this.importsCache.get(d);if(I)return this._load(I,j);const O=this.map._requestManager.transformRequest(d,i.R.Style);this._request=i.m(O,(F,B)=>{if(this._request=null,F)this.fire(new i.y(F));else if(B)return this.importsCache.set(d,B),this._load(B,j)})}loadJSON(d,f={}){this.fire(new i.z("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(d),this._request=i.o.frame(()=>{this._request=null,this._load(d,f.validate!==!1)})}loadEmpty(){this.fire(new i.z("dataloading",{dataType:"style"})),this._load(eg,!1)}_loadImports(d,f,j){if(this.importDepth>=4)return i.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const I=[];for(const O of d){const F=this._createFragmentStyle(O),B=new Promise(te=>{F.once("style.import.load",te),F.once("error",te)}).then(()=>this.mergeAll());if(I.push(B),this.resolvedImports.has(O.url)){F.loadEmpty();continue}const W=O.data||this.importsCache.get(O.url);W?(F.loadJSON(W,{validate:f}),this._isInternalStyle(W)&&(F.globalId=null)):O.url?F.loadURL(O.url,{validate:f}):F.loadEmpty();const J={style:F,id:O.id,config:O.config};if(j){const te=this.fragments.findIndex(({id:me})=>me===j);this.fragments=this.fragments.slice(0,te).concat(J).concat(this.fragments.slice(te))}else this.fragments.push(J)}return Promise.allSettled(I)}getImportGlobalIds(d=this,f=new Set){for(const j of d.fragments)j.style.globalId&&f.add(j.style.globalId),this.getImportGlobalIds(j.style,f);return[...f.values()]}_createFragmentStyle(d){const f=this.scope?i.B(d.id,this.scope):d.id;let j;const I=this._initialConfig&&this._initialConfig[f];(d.config||I)&&(j=Object.assign({},d.config,I));const O=new xh(this.map,{scope:f,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,f){if(this._isInternalStyle(d)){const O=Object.assign({},eg,{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,f)}if(this.updateConfig(this._config,d.schema),f&&Jf(this,$n(d)))return;this._loaded=!0,this.stylesheet=i.dp(d);const j=()=>{for(const W in d.sources)this.addSource(W,d.sources[W],{validate:!1,isInitialLoad:!0});if(d.iconsets)for(const W in d.iconsets)this.addIconset(W,d.iconsets[W]);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=mx(this.stylesheet.layers);if(this._order=O.map(W=>W.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 W=this.stylesheet.lights[0];this.light=new It(W.properties,W.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new It(this.stylesheet.light)),this._layers={};for(const W of O){const J=i.du(W,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),me=!!this.directionalLight&&this.directionalLight.shadowsEnabled();te&&J.canCastShadows()&&me&&(te.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const F=this.stylesheet.terrain;F&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(F,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,f).then(()=>{this._reloadImports(),this.fire(new i.z(B?"style.load":"style.import.load"))}).catch(W=>{this.fire(new i.y(new Error("Failed to load imports",W))),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 I=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(I){const O=this._evaluateColorThemeData(I);this._loadColorTheme(O).then(()=>{j()}).catch(F=>{i.w(`Couldn't load color theme from the stylesheet: ${F}`),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,f,j,I,O,F,B,W,J,te;const me={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(ue=>{if(ue.stylesheet){if(ue.light!=null&&(d=ue.light),ue.stylesheet.lights)for(const pe of ue.stylesheet.lights)pe.type==="ambient"&&ue.ambientLight!=null&&(f=ue.ambientLight),pe.type==="directional"&&ue.directionalLight!=null&&(j=ue.directionalLight);I=this._prioritizeTerrain(I,ue.terrain,ue.stylesheet.terrain),ue.stylesheet.fog&&ue.fog!=null&&(O=ue.fog),ue.stylesheet.snow&&ue.snow!=null&&(F=ue.snow),ue.stylesheet.rain&&ue.rain!=null&&(B=ue.rain),ue.stylesheet.camera!=null&&(te=ue.stylesheet.camera),ue.stylesheet.projection!=null&&(W=ue.stylesheet.projection),ue.stylesheet.transition!=null&&(J=ue.stylesheet.transition),me[ue.scope]=ue._styleColorTheme}}),this.light=d,this.ambientLight=f,this.directionalLight=j,this.fog=O,this.snow=F,this.rain=B,this._styleColorThemeForScope=me,I===null?delete this.terrain:this.terrain=I,this.camera=te||{"camera-projection":"perspective"},this.projection=W||{name:"mercator"},this.transition=Object.assign({},Kv,J),this.mergeSources(),this.mergeLayers(),this.mergeIndoor()}forEachFragmentStyle(d){const f=j=>{for(const I of j.fragments)f(I.style);d(j)};f(this)}_prioritizeTerrain(d,f,j){const I=d&&d.drapeRenderMode===0;return j===null?f&&f.drapeRenderMode===0?f:I?d:null:f!=null&&(!d||I||f&&f.drapeRenderMode===1)?f:d}mergeTerrain(){let d;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(f=>{d=this._prioritizeTerrain(d,f.terrain,f.stylesheet.terrain)}),d===null?delete this.terrain:this.terrain=d}mergeProjection(){let d;this.forEachFragmentStyle(f=>{f.stylesheet.projection!=null&&(d=f.stylesheet.projection)}),this.projection=d||{name:"mercator"}}mergeSources(){const d={},f={},j={};this.forEachFragmentStyle(I=>{for(const O in I._sourceCaches){const F=i.B(O,I.scope);d[F]=I._sourceCaches[O]}for(const O in I._otherSourceCaches){const F=i.B(O,I.scope);f[F]=I._otherSourceCaches[O]}for(const O in I._symbolSourceCaches){const F=i.B(O,I.scope);j[F]=I._symbolSourceCaches[O]}}),this._mergedSourceCaches=d,this._mergedOtherSourceCaches=f,this._mergedSymbolSourceCaches=j}mergeIndoor(){this.forEachFragmentStyle(d=>{if(d.stylesheet&&d.stylesheet.indoor)for(const f of Object.values(d.stylesheet.indoor)){const j=f,I=i.B(j.sourceId,d.scope);this._mergedIndoor[I]=new Set(j.sourceLayers||[])}})}mergeLayers(){const d={},f=[],j={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(F=>{for(const B of F._order){const W=F._layers[B];if(W.type==="slot"){const J=i.dq(B);if(d[J])continue;d[J]=[]}W.slot&&d[W.slot]?d[W.slot].push(W):f.push(W)}}),this._mergedOrder=[];let I=-1;const O=(F=[])=>{for(const B of F)if(B.type==="slot"){const W=i.dq(B.id);d[W]&&O(d[W]),this._mergedSlots.push(W)}else{const W=i.B(B.id,B.scope);this._mergedOrder.push(W),j[W]=B,B.is3D(!!this.terrain)&&(this._has3DLayers=!0,I=this._mergedOrder.length-1),B.type==="circle"&&(this._hasCircleLayers=!0),B.type==="symbol"&&(this._hasSymbolLayers=!0),B.type==="clip"&&(this._clipLayerPresent=!0)}};if(O(f),this._has3DLayers){const F={};for(let B=0;BF[B]-F[W])}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(f,j,I,O){const F=Object.assign({},j);for(const W of Object.keys(h5))F[W]===void 0&&(F[W]=h5[W].default);const B=new i.a8(Wie,f,new Map(I));return B.setTransitionOrValue(F,I),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 f=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((j,I)=>{const O="data:image/png;base64,";if(!d||d.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void j();let F=d;F.startsWith(O)||(F=O+F);const B=i.I.from("mapbox-reserved-lut"),W=new Image;W.src=F,W.onerror=()=>{this._styleColorTheme.lutLoading=!1,I(new Error("Failed to load image data"))},W.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==f)return void j();this._styleColorTheme.lutLoading=!1;const{width:J,height:te,data:me}=i.o.getImageData(W);if(te>32)return void I(new Error("The height of the image must be less than or equal to 32 pixels."));if(J!==te*te)return void I(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},me),pixelRatio:1,sdf:!1,usvg:!1,version:0});const ue=this.imageManager.getImage(B,this.scope);ue?(this._styleColorTheme.lut={image:ue.data,data:d},j()):I(new Error("Missing LUT image."))}})}getLut(d){const f=this._styleColorThemeForScope[d];return f?f.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(f,j,I){let O,F,B;const W=i.o.devicePixelRatio>1?"@2x":"";let J=i.m(j.transformRequest(j.normalizeSpriteURL(f,W,".json"),i.R.SpriteJSON),(ue,pe)=>{J=null,B||(B=ue,O=pe,me())}),te=i.n(j.transformRequest(j.normalizeSpriteURL(f,W,".png"),i.R.SpriteImage),(ue,pe)=>{te=null,B||(B=ue,F=pe,me())});function me(){if(B)I(B);else if(O&&F){const ue=i.o.getImageData(F),pe={};for(const ke in O){const{width:_e,height:Fe,x:Re,y:We,sdf:at,pixelRatio:Ge,stretchX:kt,stretchY:yt,content:bt}=O[ke],ft=new i.q({width:_e,height:Fe});i.q.copy(ue,ft,{x:Re,y:We},{x:0,y:0},{width:_e,height:Fe},null),pe[ke]={data:ft,pixelRatio:Ge!==void 0?Ge:1,sdf:at!==void 0&&at,stretchX:kt,stretchY:yt,content:bt,usvg:!1,version:0}}I(null,pe)}}return{cancel(){J&&(J.cancel(),J=null),te&&(te.cancel(),te=null)}}}(d,this.map._requestManager,(f,j)=>{if(this._spriteRequest=null,f)this.fire(new i.y(f));else if(j){const I=new Map;for(const O in j)I.set(i.I.from(O),j[O]);this.addImages(I)}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,f){if(f.type==="sprite")return void this._loadSprite(f.url);const j=this.getOwnSourceCache(f.source);if(!j)return void this.fire(new i.y(new Error(`Source "${f.source}" as specified by iconset "${d}" does not exist and cannot be used as an iconset source`)));const I=j.getSource();if(I.type!=="raster-array")return void this.fire(new i.y(new Error(`Source "${f.source}" as specified by iconset "${d}" is not a "raster-array" source and cannot be used as an iconset source`)));I.partial=!1;const O=new m5(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 f=this.map._spriteFormat==="auto";var j,I;this._spriteRequest=(I=(O,F)=>{if(this._spriteRequest=null,O)f?this._loadSprite(d):this.fire(new i.y(O));else if(F){const B=new Map;for(const W in F)B.set(i.I.from(W),F[W]);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,F)=>{if(O)return void I(O);const B={},W=i.dg(new i.bt(F));for(const J of W.icons){const te={version:1,pixelRatio:i.o.devicePixelRatio,content:zP(J),stretchX:J.metadata?BP(J.metadata.stretch_x_areas):void 0,stretchY:J.metadata?BP(J.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:J};B[J.name]=te}I(null,B)}))}_validateLayer(d){const f=this.getOwnSource(d.source);if(!f)return;const j=d.sourceLayer;j&&(f.type==="geojson"||f.vectorLayerIds&&f.vectorLayerIds.indexOf(j)===-1)&&this.fire(new i.y(new Error(`Source layer "${j}" does not exist on source "${f.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,f)=>{const j=this.fragments[f];return j&&j.style&&(d.data=j.style.serialize()),d})}_serializeSources(){const d={};for(const f in this._sourceCaches){const j=this._sourceCaches[f].getSource();d[j.id]||(d[j.id]=j.serialize())}return d}_serializeLayers(d){const f=[];for(const j of d){const I=this._layers[j];I&&I.type!=="custom"&&f.push(I.serialize())}return f}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 f=this._mergedLayers[d];if(f._transitionablePaint&&f._transitionablePaint._values){const j=f._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 f=this.getOwnLayer(d);if(f)return f;this.fire(new i.y(new Error(`The layer '${d}' does not exist in the map's style.`)))}_checkSource(d){const f=this.getOwnSource(d);if(f)return f;this.fire(new i.y(new Error(`The source '${d}' does not exist in the map's style.`)))}precompilePrograms(d,f){const j=this.map.painter;if(j)for(let I=d.minzoom||0;I<(d.maxzoom||25.5);I++){const O=d.getProgramIds();if(O)for(const F of O){const B=d.getDefaultProgramParams(F,f.zoom,this._styleColorTheme.lut);B&&(j.style=this,this.fog&&(j._fogVisible=!0,B.overrideFog=!0,j.getOrCreateProgram(F,B)),j._fogVisible=!1,B.overrideFog=!1,j.getOrCreateProgram(F,B),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(B.overrideRtt=!0,j.getOrCreateProgram(F,B)))}}}update(d){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(d),this.directionalLight&&this.directionalLight.recalculate(d);const f=this.calculateLightsBrightness();d.brightness=f||0,f!==this._brightness&&(this._brightness=f,this.dispatcher.broadcast("setBrightness",f)),d.worldview!==this._worldview&&(this._worldview=d.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const j=this._changes.isDirty();let I=!1;if(this._changes.isDirty()){const B=this._changes.getLayerUpdatesByScope();for(const W in B){const{updatedIds:J,removedIds:te}=B[W];(J||te)&&(this._updateWorkerLayers(W,J,te),I=!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 W=this._mergedSourceCaches[B];O[B]=W.used,W.used=!1,W.tileCoverLift=0}for(const B of this._mergedOrder){const W=this._mergedLayers[B];if(W.visibility!=="none"&&W.recalculate(d,this._availableImages),!W.isHidden(d.zoom)){const J=this.getLayerSourceCache(W);J&&(J.used=!0,J.tileCoverLift=Math.max(J.tileCoverLift,W.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>{this.precompilePrograms(W,d)}):this.precompilePrograms(W,d))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&I&&this.mergeLayers();const F=this.imageManager.getPendingImageProviders();for(const B of F)B.sourceCache.used=!0;for(const B in O){const W=this._mergedSourceCaches[B];O[B]!==W.used&&W.getSource().fire(new i.z("data",{sourceDataType:"visibility",dataType:"source",sourceId:W.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 f of d){const j=f.resolvePendingRequests(),I=this.getFragmentStyle(f.scope);I&&I.addImages(j)}}_updateTilesForChangedImages(){const d={};for(const f in this._mergedSourceCaches){const j=this._mergedSourceCaches[f].getSource().scope;d[j]=d[j]||this._changes.getUpdatedImages(j),d[j].length!==0&&this._mergedSourceCaches[f].reloadTilesForDependencies(["icons","patterns"],d[j])}for(const f in d)this._changes.resetUpdatedImages(f)}_updateWorkerLayers(d,f,j){const I=this.getFragmentStyle(d);I&&this.dispatcher.broadcast("updateLayers",{layers:f?I._serializeLayers(f):[],scope:d,removedIds:j||[],options:I.options})}setState(d,f){if(this._checkLoaded(),Jf(this,$n(d)))return!1;(d=i.dp(d)).layers=mx(d.layers);const j=function(F,B){if(!F)return[{command:ea.setStyle,args:[B]}];let W=[];try{if(!i.by(F.version,B.version))return[{command:ea.setStyle,args:[B]}];if(i.by(F.center,B.center)||W.push({command:ea.setCenter,args:[B.center]}),i.by(F.zoom,B.zoom)||W.push({command:ea.setZoom,args:[B.zoom]}),i.by(F.bearing,B.bearing)||W.push({command:ea.setBearing,args:[B.bearing]}),i.by(F.pitch,B.pitch)||W.push({command:ea.setPitch,args:[B.pitch]}),i.by(F.sprite,B.sprite)||W.push({command:ea.setSprite,args:[B.sprite]}),i.by(F.glyphs,B.glyphs)||W.push({command:ea.setGlyphs,args:[B.glyphs]}),i.by(F.imports,B.imports)||function(pe=[],ke=[],_e){ke=ke||[];const Fe=(pe=pe||[]).map(Zf),Re=ke.map(Zf),We=pe.reduce(px,{}),at=ke.reduce(px,{}),Ge=Fe.slice();let kt,yt,bt,ft;for(kt=0,yt=0;kt{pe.source&&J[pe.source]?W.push({command:ea.removeLayer,args:[pe.id]}):me.push(pe)});let ue=F.terrain;ue&&J[ue.source]&&(W.push({command:ea.setTerrain,args:[void 0]}),ue=void 0),W=W.concat(te),i.by(ue,B.terrain)||W.push({command:ea.setTerrain,args:[B.terrain]}),function(pe,ke,_e){ke=ke||[];const Fe=(pe=pe||[]).map(Zf),Re=ke.map(Zf),We=pe.reduce(px,{}),at=ke.reduce(px,{}),Ge=Fe.slice(),kt=Object.create(null);let yt,bt,ft,ht,Ct,Rt,Dt;for(yt=0,bt=0;yt!(F.command in UP));if(j.length===0)return!1;const I=j.filter(F=>!(F.command in $P));if(I.length>0)throw new Error(`Unimplemented: ${I.map(F=>F.command).join(", ")}.`);const O=[];return j.forEach(F=>{O.push(this[F.command](...F.args))}),f&&Promise.all(O).then(f).catch(f),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[f,j]of d.entries()){if(this.getImage(f))return this.fire(new i.y(new Error(`An image with the name "${f.name}" already exists.`)));this.imageManager.addImage(f,this.scope,j),this._changes.updateImage(f,this.scope)}return this._updateWorkerImages(),this.fire(new i.z("data",{dataType:"style"})),this}addImage(d,f){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,f),this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new i.z("data",{dataType:"style"})),this)}updateImage(d,f,j=!1){this.imageManager.updateImage(d,this.scope,f),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,f,j={}){return this._checkLoaded(),this._validate(ye,`models.${d}`,f,null,j)||(this.modelManager.addModel(d,f,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,f,j={}){if(this._checkLoaded(),this.getOwnSource(d)!==void 0)throw new Error(`There is already a source with ID "${d}".`);if(!f.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(f).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(f.type)>=0&&this._validate(Ci,`sources.${d}`,f,null,j))return;this.map&&this.map._collectResourceTiming&&(f.collectResourceTiming=!0);const I=Qo(d,f,this.dispatcher,this);I.scope=this.scope,I.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(I.id),source:I.serialize(),sourceId:I.id}));const O=F=>{const B=(F?"symbol:":"other:")+I.id,W=i.B(B,this.scope),J=this._sourceCaches[B]=new bd(W,I,F);(F?this._symbolSourceCaches:this._otherSourceCaches)[I.id]=J,J.onAdd(this.map)};O(!1),f.type!=="vector"&&f.type!=="geojson"||O(!0),I.onAdd&&I.onAdd(this.map),j.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(d){this._checkLoaded();const f=this.getOwnSource(d);if(!f)throw new Error("There is no source with this ID");for(const I in this._layers)if(this._layers[I].source===d)return this.fire(new i.y(new Error(`Source "${d}" cannot be removed while layer "${I}" 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 I=Object.entries(this.stylesheet.iconsets).find(([O,F])=>F.type==="source"&&F.source===d);if(I)return this.fire(new i.y(new Error(`Source "${d}" cannot be removed while iconset "${I[0]}" is using it.`)))}const j=this.getOwnSourceCaches(d);for(const I of j){const O=i.dq(I.id);delete this._sourceCaches[O],this._changes.discardSourceCacheUpdate(I.id),I.fire(new i.z("data",{sourceDataType:"metadata",dataType:"source",sourceId:I.getSource().id})),I.setEventedParent(null),I.clearTiles()}return delete this._otherSourceCaches[d],delete this._symbolSourceCaches[d],this.mergeSources(),f.setEventedParent(null),f.onRemove&&f.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(d,f){this._checkLoaded(),this.getOwnSource(d).setData(f),this._changes.setDirty()}getOwnSource(d){const f=this.getOwnSourceCache(d);return f&&f.getSource()}getOwnSources(){const d=[];for(const f in this._otherSourceCaches){const j=this.getOwnSourceCache(f);j&&d.push(j.getSource())}return d}areTilesLoaded(){const d=this._mergedSourceCaches;for(const f in d){const j=d[f]._tiles;for(const I in j){const O=j[I];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 f=this._getTransitionParameters();for(const O of d){if(this._validate(La,"lights",O))return;switch(O.type){case"ambient":if(this.ambientLight){const F=this.ambientLight;F.set(O),F.updateTransitions(f)}else this.ambientLight=new aa(O,So||(So=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 F=this.directionalLight;F.set(O),F.updateTransitions(f)}else this.directionalLight=new aa(O,ja||(ja=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(f,{worldview:this.map.getWorldview()}),I=new i.ac(this.z||0,j);this.ambientLight&&this.ambientLight.recalculate(I),this.directionalLight&&this.directionalLight.recalculate(I),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const d=this.directionalLight,f=this.ambientLight;if(!d||!f)return;const j=ue=>.2126*(ue[0]<=.03928?ue[0]/12.92:Math.pow((ue[0]+.055)/1.055,2.4))+.7152*(ue[1]<=.03928?ue[1]/12.92:Math.pow((ue[1]+.055)/1.055,2.4))+.0722*(ue[2]<=.03928?ue[2]/12.92:Math.pow((ue[2]+.055)/1.055,2.4)),I=d.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),O=d.properties.get("intensity"),F=d.properties.get("direction"),B=1-i.d4(F.x,F.y,F.z)[2]/90,W=j(I)*O*B,J=f.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),te=f.properties.get("intensity"),me=j(J)*te;return Number(((W+me)/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 f=i.ds(d),j=this.fragments.find(({id:O})=>O===f);if(!j)return;const I=i.dq(d);return j.style.getFragmentStyle(I)}{const f=this.fragments.find(({id:j})=>j===d);return f?f.style:void 0}}setFeaturesetSelectors(d){if(!d)return;const f={},j=(I,O="")=>`${I}::${O}`;this._featuresetSelectors={};for(const I in d){const O=this._featuresetSelectors[I]=[];for(const F of d[I].selectors){if(F.featureNamespace){const W=this.getOwnLayer(F.layer);if(!W){i.w(`Layer is undefined for selector: ${F.layer}`);continue}const J=j(W.source,W.sourceLayer);if(J in f&&f[J]!==F.featureNamespace){i.w(`"featureNamespace ${F.featureNamespace} of featureset ${I}'s selector is not associated to the same source, skip this selector`);continue}f[J]=F.featureNamespace}let B;if(F.properties)for(const W in F.properties){const J=i.U(F.properties[W]);J.result==="success"&&(B=B||{},B[W]=J.value)}O.push({layerId:F.layer,namespace:F.featureNamespace,properties:B,uniqueFeatureID:F._uniqueFeatureID})}}}getFeaturesetDescriptors(d){const f=this.getFragmentStyle(d);if(!f||!f.stylesheet.featuresets)return[];const j=[];for(const I in f.stylesheet.featuresets)j.push({featuresetId:I,importId:f.scope?f.scope:void 0});return j}getFeaturesetLayers(d,f){const j=this.getFragmentStyle(f),I=j.stylesheet.featuresets;if(!I||!I[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 F of I[d].selectors){const B=j.getOwnLayer(F.layer);B&&O.push(B)}return O}getConfigProperty(d,f){const j=this.getFragmentStyle(d);if(!j)return null;const I=i.B(f,j.scope),O=j.options.get(I),F=O?O.value||O.default:null;return F?F.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(d,f){const j=i.B(d,f);return this._mergedIndoor[j]}setIndoorData(d,f){this.map.indoor.setIndoorData(f)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(d,f,j){const I=this.getFragmentStyle(d);if(!I)return;const O=I.stylesheet.schema;if(!O||!O[f])return;const F=i.U(j);if(F.result!=="success")return void Jf(this,F.value);const B=F.value.expression,W=i.B(f,I.scope),J=I.options.get(W);if(!J)return;let te;const{minValue:me,maxValue:ue,stepValue:pe,type:ke,values:_e}=O[f],Fe=i.U(O[f].default);Fe.result==="success"&&(te=Fe.value.expression),te?(this.options.set(W,Object.assign({},J,{value:B,default:te,minValue:me,maxValue:ue,stepValue:pe,type:ke,values:_e})),this.updateConfigDependencies(f)):this.fire(new i.y(new Error(`No schema defined for the config option "${f}" in the "${d}" fragment.`)))}getConfig(d){const f=this.getFragmentStyle(d);if(!f)return null;const j=f.stylesheet.schema;if(!j)return null;const I={};for(const O in j){const F=i.B(O,f.scope),B=f.options.get(F),W=B?B.value||B.default:null;I[O]=W?W.serialize():null}return I}setConfig(d,f){const j=this.getFragmentStyle(d);j&&(j.updateConfig(f,j.stylesheet.schema),this.updateConfigDependencies())}getSchema(d){const f=this.getFragmentStyle(d);return f?f.stylesheet.schema:null}setSchema(d,f){const j=this.getFragmentStyle(d);j&&(j.stylesheet.schema=f,j.updateConfig(j._config,f),this.updateConfigDependencies())}updateConfig(d,f){if(this._config=d,d||f)if(f)for(const j in f){let I,O;const F=i.U(f[j].default);if(F.result==="success"&&(I=F.value.expression),d&&d[j]!==void 0){const ue=i.U(d[j]);ue.result==="success"&&(O=ue.value.expression)}const{minValue:B,maxValue:W,stepValue:J,type:te,values:me}=f[j];if(I){const ue=i.B(j,this.scope);this.options.set(ue,{default:I,value:O,minValue:B,maxValue:W,stepValue:J,type:te,values:me})}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,f=()=>!0){for(const j of d){const I=this.getLayer(j);I&&f(I)&&(I.possiblyEvaluateVisibility(),this._updateLayer(I),this._changes.setDirty())}}updateConfigDependencies(d){this._updateLayers(this._configDependentLayers,f=>!d||f.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(f=>{const j=f._styleColorTheme.colorThemeOverride?f._styleColorTheme.colorThemeOverride:f._styleColorTheme.colorTheme;if(j){const I=f._evaluateColorThemeData(j);(!f._styleColorTheme.lut&&I!==""||f._styleColorTheme.lut&&I!==f._styleColorTheme.lut.data)&&f.setColorTheme(j)}}),this._changes.setDirty()}addLayer(d,f,j={}){this._checkLoaded();const I=d.id;if(this._layers[I])return void this.fire(new i.y(new Error(`Layer with id "${I}" already exists on this map`)));let O;if(d.type==="custom"){if(Jf(this,i.dt(d)))return;O=i.du(d,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof d.source=="object"&&(this.addSource(I,d.source),d=i.dp(d),d=Object.assign(d,{source:I})),this._validate(mc,`layers.${I}`,d,{arrayIndex:-1},j))return;O=i.du(d,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(O),O.setEventedParent(this,{layer:{id:I}})}const F=i.B(O.source,O.scope);O.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(F),O.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(F);let B=this._order.length;if(f){const me=this._order.indexOf(f);if(me===-1)return void this.fire(new i.y(new Error(`Layer with id "${f}" does not exist on this map.`)));O.slot===this._layers[f].slot?B=me:i.w(`Layer with id "${f}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(B,0,I),this._layerOrderChanged=!0,this._layers[I]=O;const W=this.getOwnLayerSourceCache(O),J=!!this.directionalLight&&this.directionalLight.shadowsEnabled();W&&O.canCastShadows()&&J&&(W.castsShadows=!0);const te=this._changes.getRemovedLayer(O);if(te&&O.source&&W&&O.type!=="custom"){this._changes.discardLayerRemoval(O);const me=i.B(O.source,O.scope);te.type!==O.type?this._changes.updateSourceCache(me,"clear"):(this._changes.updateSourceCache(me,"reload"),W.pause())}this._updateLayer(O),O.onAdd&&O.onAdd(this.map),O.scope=this.scope,this.mergeLayers()}moveLayer(d,f){this._checkLoaded();const j=this._checkLayer(d);if(!j||d===f)return;const I=this._order.indexOf(d);this._order.splice(I,1);let O=this._order.length;if(f){const F=this._order.indexOf(f);if(F===-1)return void this.fire(new i.y(new Error(`Layer with id "${f}" does not exist on this map.`)));j.slot===this._layers[f].slot?O=F:i.w(`Layer with id "${f}" 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 f=this._checkLayer(d);if(!f)return;f.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(f.fqid),this._indoorDependentLayers.delete(f.fqid),this._changes.removeLayer(f);const I=this.getOwnLayerSourceCache(f);if(I&&I.castsShadows){let O=!1;for(const F in this._layers)if(this._layers[F].source===f.source&&this._layers[F].canCastShadows()){O=!0;break}I.castsShadows=O}f.onRemove&&f.onRemove(this.map),this.mergeLayers()}getOwnLayer(d){return this._layers[d]}hasLayer(d){return d in this._mergedLayers}hasLayerType(d){for(const f in this._layers)if(this._layers[f].type===d)return!0;return!1}setLayerZoomRange(d,f,j){this._checkLoaded();const I=this._checkLayer(d);I&&(I.minzoom===f&&I.maxzoom===j||(f!=null&&(I.minzoom=f),j!=null&&(I.maxzoom=j),this._updateLayer(I)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(d,f){this._checkLoaded();const j=this._checkLayer(d);j&&j.slot!==f&&(j.slot=f,this._updateLayer(j))}setFilter(d,f,j={}){this._checkLoaded();const I=this._checkLayer(d);if(I&&!i.by(I.filter,f))return f==null?(I.filter=void 0,void this._updateLayer(I)):void(this._validate(bo,`layers.${I.id}.filter`,f,{layerType:I.type},j)||(I.filter=i.dp(f),this._updateLayer(I)))}getFilter(d){const f=this._checkLayer(d);if(f)return i.dp(f.filter)}setLayoutProperty(d,f,j,I={}){this._checkLoaded();const O=this._checkLayer(d);if(O&&!i.by(O.getLayoutProperty(f),j)){if(j!=null&&(!I||I.validate!==!1)&&Jf(O,nt.call($n,{key:`layers.${d}.layout.${f}`,layerType:O.type,objectKey:f,value:j,styleSpec:i.a6,style:{glyphs:!0,sprite:!0}})))return;O.setLayoutProperty(f,j),O.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(O.fqid),O.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(O.fqid),this._updateLayer(O)}}setLayerProperty(d,f,j,I={}){this._checkLoaded();const O=this._checkLayer(d);O&&(f==="appearances"?(O.setAppearances(j),this._changes.setDirty()):O.isPaintProperty(f)?this.setPaintProperty(d,f,j,I):this.setLayoutProperty(d,f,j,I))}getLayoutProperty(d,f){const j=this._checkLayer(d);if(j)return j.getLayoutProperty(f)}setPaintProperty(d,f,j,I={}){this._checkLoaded();const O=this._checkLayer(d);if(!O||i.by(O.getPaintProperty(f),j)||j!=null&&(!I||I.validate!==!1)&&Jf(O,pc.call($n,{key:`layers.${d}.paint.${f}`,layerType:O.type,objectKey:f,value:j,styleSpec:i.a6})))return;const F=O.setPaintProperty(f,j);O.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(O.fqid),O.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(O.fqid),F&&this._updateLayer(O),this._changes.updatePaintProperties(O)}getPaintProperty(d,f){const j=this._checkLayer(d);if(j)return j.getPaintProperty(f)}setFeatureState(d,f){if(this._checkLoaded(),"target"in d){if("featuresetId"in d.target){const{featuresetId:W,importId:J}=d.target,te=this.getFragmentStyle(J),me=te.getFeaturesetLayers(W);for(const{source:ue,sourceLayer:pe}of me)te.setFeatureState({id:d.id,source:ue,sourceLayer:pe},f)}else if("layerId"in d.target){const{layerId:W}=d.target,J=this.getLayer(W);this.setFeatureState({id:d.id,source:J.source,sourceLayer:J.sourceLayer},f)}return}const j=d.source,I=d.sourceLayer,O=this._checkSource(j);if(!O)return;const F=O.type;if(F==="geojson"&&I)return void this.fire(new i.y(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(F==="vector"&&!I)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 W of B)W.setFeatureState(I,d.id,f)}removeFeatureState(d,f){if(this._checkLoaded(),"target"in d){if("featuresetId"in d.target){const{featuresetId:W,importId:J}=d.target,te=this.getFragmentStyle(J),me=te.getFeaturesetLayers(W);for(const{source:ue,sourceLayer:pe}of me)te.removeFeatureState({id:d.id,source:ue,sourceLayer:pe},f)}else if("layerId"in d.target){const{layerId:W}=d.target,J=this.getLayer(W);this.removeFeatureState({id:d.id,source:J.source,sourceLayer:J.sourceLayer},f)}return}const j=d.source,I=this._checkSource(j);if(!I)return;const O=I.type,F=O==="vector"?d.sourceLayer:void 0;if(O==="vector"&&!F)return void this.fire(new i.y(new Error("The sourceLayer parameter must be provided for vector source types.")));if(f&&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 W of B)W.removeFeatureState(F,d.id,f)}getFeatureState(d){if(this._checkLoaded(),"target"in d){let O;if("featuresetId"in d.target){const{featuresetId:F,importId:B}=d.target,W=this.getFragmentStyle(B),J=W.getFeaturesetLayers(F);for(const{source:te,sourceLayer:me}of J){const ue=W.getFeatureState({id:d.id,source:te,sourceLayer:me});if(ue&&!O)O=ue;else if(!i.by(O,ue))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:F}=d.target,B=this.getLayer(F);O=this.getFeatureState({id:d.id,source:B.source,sourceLayer:B.sourceLayer})}return O}const f=d.source,j=d.sourceLayer,I=this._checkSource(f);if(I){if(I.type!=="vector"||j)return d.id===void 0&&this.fire(new i.y(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(f)[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(),f=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:f,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 f of Object.values(this._mergedLayers))d(f)&&this._updateLayer(f)}_updateLayer(d){this._changes.updateLayer(d);const f=this.getLayerSourceCache(d),j=i.B(d.source,d.scope),I=this._changes.getUpdatedSourceCaches();d.source&&!I[j]&&f&&f.getSource().type!=="raster"&&(this._changes.updateSourceCache(j,"reload"),f.pause()),d.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(d){const f=B=>this._mergedLayers[B].is3D(!!this.terrain),j=this.order,I={},O=[];for(let B=j.length-1;B>=0;B--){const W=j[B];if(f(W)){I[W]=B;for(const J of d){const te=J[W];if(te)for(const me of te)O.push(me)}}}O.sort((B,W)=>W.intersectionZ-B.intersectionZ);const F=[];for(let B=j.length-1;B>=0;B--){const W=j[B];if(f(W))for(let J=O.length-1;J>=0;J--){const te=O[J].feature;if(te.layer&&I[te.layer.id]{if(Jk.has(te.type))return;const me=this.getOwnLayerSourceCache(te),ue=O[me.id]=O[me.id]||{sourceCache:me,layers:{},has3DLayers:!1};te.is3D(!!this.terrain)&&(ue.has3DLayers=!0),ue.layers[te.fqid]=ue.layers[te.fqid]||{styleLayer:te,targets:[]},ue.layers[te.fqid].targets.push({filter:I})};if(f&&f.layers){if(!Array.isArray(f.layers))return this.fire(new i.y(new Error("parameters.layers must be an Array."))),[];for(const te of f.layers){const me=this._layers[te];if(!me)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.`))),[];F(me)}}else for(const te in this._layers)F(this._layers[te]);const B=this._queryRenderedFeatures(d,O,j),W=this._flattenAndSortRenderedFeatures(B),J=[];for(const te of W)i.dw(te.layer.id)===this.scope&&J.push(te);return J}queryRenderedFeatureset(d,f,j){let I;f&&!Array.isArray(f)&&f.filter&&(this._validate(bo,"queryRenderedFeatures.filter",f.filter,null,f),I=i.b6(f.filter));const O="mock",F=[];if(f&&f.target)F.push(Object.assign({},f,{targetId:O,filter:I}));else{const te=this.getFeaturesetDescriptors();for(const me of te)F.push({targetId:O,filter:I,target:me});for(const{style:me}of this.fragments){const ue=me.getFeaturesetDescriptors();for(const pe of ue)F.push({targetId:O,filter:I,target:pe})}}const B=this.queryRenderedTargets(d,F,j),W=[],J=new Set;for(const te of B)for(const me of te.variants[O])Kf(me,te,J)||W.push(new i.dx(te,me));return W}queryRenderedTargets(d,f,j){const I={},O=(B,W,J,te)=>{const me=I[W.id]=I[W.id]||{sourceCache:W,layers:{},has3DLayers:!1};if(me.layers[B.fqid]=me.layers[B.fqid]||{styleLayer:B,targets:[]},B.is3D(!!this.terrain)&&(me.has3DLayers=!0),!te)return J.uniqueFeatureID=!1,void me.layers[B.fqid].targets.push(J);me.layers[B.fqid].targets.push(Object.assign({},J,{namespace:te.namespace,properties:te.properties,uniqueFeatureID:te.uniqueFeatureID}))};for(const B of f)if("featuresetId"in B.target){const{featuresetId:W,importId:J}=B.target,te=this.getFragmentStyle(J);if(!te||!te._featuresetSelectors)continue;const me=te._featuresetSelectors[W];if(!me){this.fire(new i.y(new Error(`The featureset '${W}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const ue of me){const pe=te.getOwnLayer(ue.layerId);pe&&!Jk.has(pe.type)&&O(pe,te.getOwnLayerSourceCache(pe),B,ue)}}else if("layerId"in B.target){const{layerId:W}=B.target,J=this.getLayer(W);if(!J||Jk.has(J.type))continue;O(J,this.getLayerSourceCache(J),B)}const F=this._queryRenderedFeatures(d,I,j);return this._flattenAndSortRenderedFeatures(F)}_queryRenderedFeatures(d,f,j){const I=[],O=!!this.map._showQueryGeometry,F=Oi.createFromScreenPoints(d,j);for(const B in f){const W=Yy(F,f[B],this._availableImages,j,O);Object.keys(W).length&&I.push(W)}if(this.placement)for(const B in f){if(!f[B].sourceCache._onlySymbols)continue;const W=Xy(F.screenGeometry,f[B],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(W).length&&I.push(W)}return I}querySourceFeatures(d,f){const j=f&&f.filter;j&&this._validate(bo,"querySourceFeatures.filter",j,null,f);let I=[];const O=this.getOwnSourceCaches(d);for(const F of O)I=I.concat(Qy(F,f));return I}addSourceType(d,f,j){return xh.getSourceType(d)?j(new Error(`A source type called "${d}" already exists.`)):(xh.setSourceType(d,f),f.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:d,url:f.workerSourceURL},j):j(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(d,f,j={}){this._checkLoaded();const I=this.light.getLight();let O=!1;for(const B in d)if(!i.by(d[B],I[B])){O=!0;break}if(!O)return;const F=this._getTransitionParameters();this.light.setLight(d,f,j),this.light.updateTransitions(F)}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,f=1){if(this._checkLoaded(),!d)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),f===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 I=!("source"in d)||d.source==null;if(f===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),F={};if(this.terrain&&I){O.source=this.terrain.get().source;const B=this.terrain?this.getFragmentStyle(this.terrain.scope):null;B&&(F.style=B.serialize())}if(this._validate(co,"terrain",O,F))return}if(!this.terrain||this.terrain.scope!==this.scope&&!I||this.terrain&&f!==this.terrain.drapeRenderMode){if(!j)return;this._createTerrain(j,f),this.fire(new i.z("data",{dataType:"style"}))}else{const O=this.terrain,F=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],F[B])){O.set(d,this.options),this.stylesheet.terrain=d;const W=this._getTransitionParameters({duration:0});O.updateTransitions(W),this.fire(new i.z("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(d){const f=this.fog=new nn(d,this.map.transform,this.scope,this.options);this.stylesheet.fog=f.get();const j=this._getTransitionParameters({duration:0});f.updateTransitions(j)}_createSnow(d){const f=this.snow=new Eo(d,this.map.transform,this.scope,this.options);this.stylesheet.snow=f.get();const j=this._getTransitionParameters({duration:0});f.updateTransitions(j)}_createRain(d){const f=this.rain=new Li(d,this.map.transform,this.scope,this.options);this.stylesheet.rain=f.get();const j=this._getTransitionParameters({duration:0});f.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 f=this.fog;if(!i.by(f.get(),d)){f.set(d,this.options),this.stylesheet.fog=f.get();const j=this._getTransitionParameters({duration:0});f.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 f=this.snow;if(!i.by(f.get(),d)){f.set(d,this.options),this.stylesheet.snow=f.get();const j=this._getTransitionParameters({duration:0});f.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 f=this.rain;if(!i.by(f.get(),d)){f.set(d,this.options),this.stylesheet.rain=f.get();const j=this._getTransitionParameters({duration:0});f.updateTransitions(j)}}else this._createRain(d);this._markersNeedUpdate=!0}_reloadColorTheme(){const d=()=>{for(const I in this._layers)this._layers[I].lut=this._styleColorTheme.lut;for(const I in this._sourceCaches)this._sourceCaches[I].clearTiles()},f=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!f)return this._styleColorTheme.lut=null,void d();const j=this._evaluateColorThemeData(f);this._loadColorTheme(j).then(()=>{this.fire(new i.z("colorthemeset")),d()}).catch(I=>{i.w(`Couldn't set color theme: ${I}`)})}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,f){const j=this.getFragmentStyle(d);j&&(j._styleColorTheme.colorThemeOverride=f,j._reloadColorTheme())}_getTransitionParameters(d){return{now:i.o.now(),transition:Object.assign(this.transition,d)}}updateDrapeFirstLayers(){if(!this.terrain)return;const d=[],f=[];for(const j of this._mergedOrder)this.isLayerDraped(this._mergedLayers[j])?d.push(j):f.push(j);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...d),this._drapedFirstOrder.push(...f)}_createTerrain(d,f){const j=this.terrain=new Lt(d,f,this.scope,this.options,this.map.getWorldview());f===1&&(this.stylesheet.terrain=d),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const I=this._getTransitionParameters({duration:0});j.updateTransitions(I)}_force3DLayerUpdate(){for(const d in this._layers){const f=this._layers[d];f.type==="fill-extrusion"&&this._updateLayer(f)}}_forceSymbolLayerUpdate(){for(const d in this._layers){const f=this._layers[d];f.type==="symbol"&&this._updateLayer(f)}}_validate(d,f,j,I,O={}){if(O&&O.validate===!1)return!1;const F=Object.assign({},this.serialize());return Jf(this,d.call($n,Object.assign({key:f,style:F,value:j,styleSpec:i.a6},I)))}_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 f=this.getSourceCaches(d);for(const j of f)j.clearTiles()}clearSources(){for(const d in this._mergedSourceCaches)this._mergedSourceCaches[d].clearTiles()}clearLayers(){for(const d in this._mergedLayers){const f=this._mergedLayers[d];f._clear&&f._clear()}}reloadSource(d){const f=this.getSourceCaches(d);for(const j of f)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 f;this.directionalLight&&(f=Gv(this.directionalLight));const j=new Set,I=new Set;for(const O in this._mergedLayers){const F=this._mergedLayers[O];F.type==="building"&&j.add(F.source),F.hasElevation()&&!I.has(F.source)&&I.add(F.source)}for(const O in this._mergedSourceCaches){const F=this._mergedSourceCaches[O],B=I.has(F._source.id);j.has(F._source.id)&&(F._source.reparseOverscaled=!1),F.update(d,void 0,void 0,f,B)}}_generateCollisionBoxes(){for(const d in this._sourceCaches){const f=this._sourceCaches[d];f.resume(),f.reload()}}_updatePlacement(d,f,j,I,O,F,B=!1){let W=!1,J=!1;const te={},me={};for(const _e of this._mergedOrder){const Fe=this._mergedLayers[_e];if(Fe.type!=="symbol")continue;const Re=i.B(Fe.source,Fe.scope);let We=te[Re];if(!We){const Ge=this.getLayerSourceCache(Fe);if(!Ge)continue;const kt=Ge.getRenderableIds(!0).map(yt=>Ge.getTileByID(yt));me[Re]=kt.slice(),We=te[Re]=kt.sort((yt,bt)=>bt.tileID.overscaledZ-yt.tileID.overscaledZ||(yt.tileID.isLessThan(bt.tileID)?-1:1))}const at=this.crossTileSymbolIndex.addLayer(Fe,We,f.center.lng,f.projection);W=W||at}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),B=B||this._layerOrderChanged,this._layerOrderChanged&&this.fire(new i.z("neworder"));const ue=!!(this.placement&&!f.equals(this.placement.transform)),pe=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!F||this.placement.lastReplacementSourceUpdateTime!==F.updateTime)),ke=(ue||pe||W||this.placement&&this.placement.isStale())&&I===0;if((B||!this.pauseablePlacement||ke||I!==0&&this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.o.now(),f.zoom))&&(this.pauseablePlacement=new jl(f,this._mergedOrder,B||I===0,j,I,O,this.placement,this.fog&&f.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,me,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(i.o.now()),J=!0),W&&this.pauseablePlacement.placement.setStale()),J||W){this._buildingIndex.onNewFrame(f.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(!f)return j.push(d),this._loadImports([d],!0);const I=j.findIndex(({id:O})=>O===f);return I===-1&&this.fire(new i.y(new Error(`Import with id "${f}" does not exist on this map.`))),this.stylesheet.imports=j.slice(0,I).concat(d).concat(j.slice(I)),this._loadImports([d],!0,f)}updateImport(d,f){this._checkLoaded();const j=this.stylesheet.imports||[],I=this.getImportIndex(d);return I===-1?this:typeof f=="string"?(this.setImportUrl(d,f),this):(f.url&&f.url!==j[I].url&&this.setImportUrl(d,f.url),i.by(f.config,j[I].config)||this.setImportConfig(d,f.config,f.data.schema),i.by(f.data,j[I].data)||this.setImportData(d,f.data),this)}moveImport(d,f){this._checkLoaded();let j=this.stylesheet.imports||[];const I=this.getImportIndex(d);if(I===-1)return this;const O=this.getImportIndex(f);if(O===-1)return this;const F=j[I],B=this.fragments[I];return j=j.filter(({id:W})=>W!==d),this.fragments=this.fragments.filter(({id:W})=>W!==d),this.stylesheet.imports=j.slice(0,O).concat(F).concat(j.slice(O)),this.fragments=this.fragments.slice(0,O).concat(B).concat(this.fragments.slice(O)),this.mergeLayers(),this}setImportUrl(d,f){this._checkLoaded();const j=this.stylesheet.imports||[],I=this.getImportIndex(d);if(I===-1)return this;j[I].url=f;const O=this.fragments[I];return O.style=this._createFragmentStyle(j[I]),O.style.on("style.import.load",()=>this.mergeAll()),O.style.loadURL(f),this}setImportData(d,f){this._checkLoaded();const j=this.getImportIndex(d),I=this.stylesheet.imports||[];return j===-1?this:f?(this.fragments[j].style.setState(f),this._reloadImports(),this):(delete I[j].data,this.setImportUrl(d,I[j].url))}setImportConfig(d,f,j){this._checkLoaded();const I=this.getImportIndex(d),O=this.stylesheet.imports||[];if(I===-1)return this;f?O[I].config=f:delete O[I].config;const F=this.fragments[I];j&&F.style.stylesheet&&(F.style.stylesheet.schema=j);const B=F.style.stylesheet&&F.style.stylesheet.schema;return F.config=f,F.style.updateConfig(f,B),this.updateConfigDependencies(),this}removeImport(d){this._checkLoaded();const f=this.stylesheet.imports||[],j=this.getImportIndex(d);j!==-1&&(f.splice(j,1),this.fragments[j].style._remove(),this.fragments.splice(j,1),this._reloadImports())}getImportIndex(d){const f=(this.stylesheet.imports||[]).findIndex(j=>j.id===d);return f===-1&&this.fire(new i.y(new Error(`Import '${d}' does not exist in the map's style and cannot be updated.`))),f}getLayer(d){return this._mergedLayers[d]}getSources(){const d=[];for(const f in this._mergedOtherSourceCaches){const j=this._mergedOtherSourceCaches[f];j&&d.push(j.getSource())}return d}getSource(d,f){const j=this.getSourceCache(d,f);return j&&j.getSource()}getLayerSource(d){const f=this.getLayerSourceCache(d);return f&&f.getSource()}getSourceCache(d,f){const j=i.B(d,f);return this._mergedOtherSourceCaches[j]}getLayerSourceCache(d){const f=i.B(d.source,d.scope);return d.type==="symbol"?this._mergedSymbolSourceCaches[f]:this._mergedOtherSourceCaches[f]}getSourceCaches(d){if(d==null)return Object.values(this._mergedSourceCaches);const f=[];return this._mergedOtherSourceCaches[d]&&f.push(this._mergedOtherSourceCaches[d]),this._mergedSymbolSourceCaches[d]&&f.push(this._mergedSymbolSourceCaches[d]),f}updateSourceCaches(){const d=this._changes.getUpdatedSourceCaches();for(const f in d){const j=d[f];j==="reload"?this.reloadSource(f):j==="clear"&&this.clearSource(f)}}updateLayers(d){const f=this._changes.getUpdatedPaintProperties();for(const j of f){const I=this.getLayer(j);I&&I.updateTransitions(d)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(d){this.stylesheet.glyphs=d,this.glyphManager.setURL(d)}getImages(d,f,j){this.imageManager.getImages(f.images,f.scope,j),this._updateTilesForChangedImages();const I=F=>{if(F){const B=f.images.map(W=>i.I.toString(W));F.setDependencies(f.tileID.key,f.type,B)}},O=i.B(f.source,f.scope);I(this._mergedOtherSourceCaches[O]),I(this._mergedSymbolSourceCaches[O]),f.images.some(F=>F.iconsetId)&&this.fire(new i.z("data",{dataType:"style"}))}rasterizeImages(d,f,j){this.imageManager.rasterizeImages(f,j)}getGlyphs(d,f,j){this.glyphManager.getGlyphs(f.stacks,j)}getResource(d,f,j){return i.dz(f,j)}getOwnSourceCache(d){return this._otherSourceCaches[d]}getOwnLayerSourceCache(d){return d.type==="symbol"?this._symbolSourceCaches[d.source]:this._otherSourceCaches[d.source]}getOwnSourceCaches(d){const f=[];return this._otherSourceCaches[d]&&f.push(this._otherSourceCaches[d]),this._symbolSourceCaches[d]&&f.push(this._symbolSourceCaches[d]),f}_isSourceCacheLoaded(d){const f=this.getOwnSourceCaches(d);return f.length===0?(this.fire(new i.y(new Error(`There is no source with ID '${d}'`))),!1):f.every(j=>j.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(d,f){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"),I=d.type==="building";if(d.is3D(!!this.terrain)){if(j||I||f&&f.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)}}xh.getSourceType=function(w){return mh[w]},xh.setSourceType=function(w,d){mh[w]=d},xh.registerForPluginStateChange=i.dA;class qP 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[f,j]of Object.entries(d.buildings))if(this._buildings[f])for(const I of j.floorIds)this._buildings[f].floors[I]||(this._buildings[f].floors[I]=j.floors[I]);else this._buildings[f]=j;for(const f of d.activeFloors)this._activeFloors.add(f);this._updateIndoorSelector()}getIndoorTileOptions(d,f){const j=this._style.getIndoorSourceLayers(d,f);return j&&this._indoorState?{sourceLayers:j,indoorState:this._indoorState}:null}_updateUI(d,f,j){const I=function(O,F,B,W){let J=null,te=Number.MAX_SAFE_INTEGER;if(W<16)return null;for(const[me,ue]of Object.entries(O)){const pe=ue.center;if(pe){const ke=F.distanceTo(i.aT.convert(pe));ke({id:F,name:j.floors[F].name,zIndex:j.floors[F].zIndex})).sort((F,B)=>B.zIndex-F.zIndex);this.fire(new i.z("selector-update",{selectedFloorId:I,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;}`,p5=` #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`,eN="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;}",Ou=` #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`,tN=`#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`,f5=`#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`,rN=`#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;}`,sN=`#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`,g5=`#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 Zv=/#include\s+"([^"]+)"/g,Fm=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,x5=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,gx=new Set(["ifdef","ifndef","elif","if","defined"]),xx=new Set;rg(i0,xx),rg(p5,xx),rg(o0,xx);const tg={"_prelude_fog.vertex.glsl":tN,"_prelude_terrain.vertex.glsl":Ou,"_prelude_shadow.vertex.glsl":sN,"_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":g5,"_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":f5,"_prelude_raster_particle.glsl":rN},nN={};la("",Ou),la(Ar,tN),la(g5,sN),la(f5,""),la(rN,"");const VP=la(o0,p5),aN=i0,Gie=[` #if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING) #extension GL_EXT_blend_func_extended : require #endif`,"precision mediump float;",aN,VP.fragmentSource].join(` `),HP=["precision highp float;",aN,VP.vertexSource].join(` `);var y5={background:la(`#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:la(`#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:la(`#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:la(`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:la(`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:la(`#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:la("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:la(`#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:la(`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:la("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:la("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:la("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:la(`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:la(`#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:la(`#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:la(`#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:la(`#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:la(`#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:la(`#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:la(`#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:la(`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:la(`#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:la(`#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:la(`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:la(`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:la(`#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:la(`#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:la(`#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:la(`#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:la(`#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:la("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:la("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:la(`#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:la(`#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:la(`#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:la("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:la(`#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 }`,eN),skyboxGradient:la(`#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 }`,eN),skyboxCapture:la(` 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:la(`#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:la(`#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:la(`#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:la(`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:la(`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:la("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:la("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:la("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:la("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 rg(w,d){const f=w.split(` `);for(let j of f){if(j=j.trimStart(),j[0]!=="#"||!j.includes("if")||j.startsWith("#endif"))continue;const I=j.match(x5);if(I)for(const O of I)gx.has(O)||d.add(O)}}function la(w,d){const f=new Set,j=[],I=[];w=w.replace(Zv,(F,B)=>(I.push(B),"")),d=d.replace(Zv,(F,B)=>(j.push(B),""));let O=new Set(xx);rg(w,O),rg(d,O);for(const F of[...j,...I])nN[F]||(nN[F]=new Set,rg(tg[F],nN[F])),O=new Set([...O,...nN[F]]);return{fragmentSource:w=w.replace(Fm,(F,B,W,J,te)=>(f.add(te),B==="define"?` #ifndef HAS_UNIFORM_u_${te} in ${W} ${J} ${te}; #else uniform ${W} ${J} u_${te}; #endif `:B==="initialize"?` #ifdef HAS_UNIFORM_u_${te} ${W} ${J} ${te} = u_${te}; #endif `:B==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${te} in ${W} ${J} ${te}; #endif `:B==="initialize-attribute"?"":void 0)),vertexSource:d=d.replace(Fm,(F,B,W,J,te)=>{const me=`MATERIAL_ATTRIBUTE_OFFSET_${te}`,ue=J==="float"?"vec2":J,pe=`GET_ATTRIBUTE_${ue}(a_${te}, materialInfo, ${me})`,ke=te.match(/color/)?"color":ue;return B==="define-attribute-vertex-shader-only"?` #ifdef HAS_ATTRIBUTE_a_${te} in ${W} ${J} a_${te}; #endif `:f.has(te)?B==="define"?` #ifndef HAS_UNIFORM_u_${te} uniform lowp float u_${te}_t; #if !defined(${me}) in ${W} ${ue} a_${te}; #endif out ${W} ${J} ${te}; #else uniform ${W} ${J} u_${te}; #endif `:B==="initialize"?ke==="vec4"?` #ifndef HAS_UNIFORM_u_${te} ${te} = a_${te}; #else ${W} ${J} ${te} = u_${te}; #endif `:` #if !defined(HAS_UNIFORM_u_${te}) #ifdef ${me} ${te} = unpack_mix_${ke}(${pe}, u_${te}_t); #else ${te} = unpack_mix_${ke}(a_${te}, u_${te}_t); #endif #else ${W} ${J} ${te} = u_${te}; #endif `:B==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${te} in ${W} ${J} a_${te}; out ${W} ${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(${me}) in ${W} ${ue} a_${te}; #endif #else uniform ${W} ${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 ${W} ${J} u_${te}; #endif `:` #ifdef INSTANCED_ARRAYS in ${W} ${ue} a_${te}; #else uniform ${W} ${J} u_${te}; #endif `:B==="initialize-attribute-custom"?` #ifdef HAS_ATTRIBUTE_a_${te} ${W} ${J} ${te} = a_${te}; #endif `:ke==="vec4"?` #ifndef HAS_UNIFORM_u_${te} #ifdef ${me} ${W} ${J} ${te} = ${pe}; #else ${W} ${J} ${te} = a_${te}; #endif #else ${W} ${J} ${te} = u_${te}; #endif `:` #ifndef HAS_UNIFORM_u_${te} #ifdef ${me} ${W} ${J} ${te} = unpack_mix_${ke}(${pe}, u_${te}_t); #else ${W} ${J} ${te} = unpack_mix_${ke}(a_${te}, u_${te}_t); #endif #else ${W} ${J} ${te} = u_${te}; #endif `}),usedDefines:O,vertexIncludes:j,fragmentIncludes:I}}class Kie{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(d,f,j,I,O,F,B,W){this.context=d;let J=this.boundPaintVertexBuffers.length!==I.length;for(let me=0;!J&&me{const kt=at.paint.get("hillshade-shadow-color"),yt=at.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",bt=at.paint.get("hillshade-highlight-color"),ft=at.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",ht=at.paint.get("hillshade-accent-color"),Ct=at.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",Rt=at.paint.get("hillshade-emissive-strength");let Dt=i.an(at.paint.get("hillshade-illumination-direction"));if(at.paint.get("hillshade-illumination-anchor")==="viewport")Dt-=Re.transform.angle;else if(Re.style&&Re.style.enable3dLights()&&Re.style.directionalLight){const Xt=Re.style.directionalLight.properties.get("direction"),lr=i.d4(Xt.x,Xt.y,Xt.z);Dt=i.an(lr[1])}const Yt=!Re.options.moving;return{u_matrix:Ge||Re.transform.calculateProjMatrix(We.tileID.toUnwrapped(),Yt),u_image:0,u_latrange:Zie(0,We.tileID),u_light:[at.paint.get("hillshade-exaggeration"),Dt],u_shadow:kt.toPremultipliedRenderColor(yt?null:at.lut),u_highlight:bt.toPremultipliedRenderColor(ft?null:at.lut),u_emissive_strength:Rt,u_accent:ht.toPremultipliedRenderColor(Ct?null:at.lut)}})(w,f,j,w.terrain?d.projMatrix:null);w.uploadCommonUniforms(B,ue,d.toUnwrapped());const{tileBoundsBuffer:ke,tileBoundsIndexBuffer:_e,tileBoundsSegments:Fe}=w.getTileBoundsBuffers(f);ue.draw(w,W.TRIANGLES,I,O,F,Vs.disabled,pe,j.id,ke,_e,Fe)}function v5(w,d,f){if(!d.needsDEMTextureUpload)return;const j=w.context,I=j.gl;j.pixelStoreUnpackPremultiplyAlpha.set(!1),d.demTexture=d.demTexture||w.getTileTexture(f.stride);const O=f.getPixels();d.demTexture?d.demTexture.update(O,{premultiply:!1}):d.demTexture=new i.T(j,O,I.R32F,{premultiply:!1}),d.needsDEMTextureUpload=!1}function Xie(w,d,f){const j=w.context,I=j.gl;if(!d.dem)return;const O=d.dem;if(j.activeTexture.set(I.TEXTURE1),v5(w,d,O),!d.demTexture)return;d.demTexture.bind(I.NEAREST,I.CLAMP_TO_EDGE);const F=O.dim;j.activeTexture.set(I.TEXTURE0);let B=d.hillshadeFBO;if(!B){const ue=new i.T(j,{width:F,height:F,data:null},I.RGBA8);ue.bind(I.LINEAR,I.CLAMP_TO_EDGE),B=d.hillshadeFBO=j.createFramebuffer(F,F,1,"renderbuffer"),B.colorAttachment0.set(ue.texture)}j.bindFramebuffer.set(B.framebuffer),j.viewport.set([0,0,F,F]);const{tileBoundsBuffer:W,tileBoundsIndexBuffer:J,tileBoundsSegments:te}=w.getMercatorTileBoundsBuffers(),me=[];w.linearFloatFilteringSupported()&&me.push("TERRAIN_DEM_FLOAT_FORMAT"),w.terrain&&w.terrain.renderingToTexture&&w.emissiveMode==="mrt-fallback"&&me.push("USE_MRT1"),w.getOrCreateProgram("hillshadePrepare",{defines:me}).draw(w,I.TRIANGLES,_s.disabled,Gs.disabled,fn.unblended,Vs.disabled,((ue,pe)=>{const ke=pe.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:ue.overscaledZ}})(d.tileID,O),f.id,W,J,te),d.needsHillshadePrepare=!1}class Ri{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 Qie extends Ri{getDefault(){return i.ao.transparent.toNonPremultipliedRenderColor(null)}set(d){const f=this.current;(d.r!==f.r||d.g!==f.g||d.b!==f.b||d.a!==f.a||this.dirty)&&(this.gl.clearColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class WP extends Ri{getDefault(){return 1}set(d){(d!==this.current||this.dirty)&&(this.gl.clearDepth(d),this.current=d,this.dirty=!1)}}class _5 extends Ri{getDefault(){return 0}set(d){(d!==this.current||this.dirty)&&(this.gl.clearStencil(d),this.current=d,this.dirty=!1)}}class iN extends Ri{getDefault(){return[!0,!0,!0,!0]}set(d){const f=this.current;(d[0]!==f[0]||d[1]!==f[1]||d[2]!==f[2]||d[3]!==f[3]||this.dirty)&&(this.gl.colorMask(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class b5 extends Ri{getDefault(){return!0}set(d){(d!==this.current||this.dirty)&&(this.gl.depthMask(d),this.current=d,this.dirty=!1)}}class yx extends Ri{getDefault(){return 255}set(d){(d!==this.current||this.dirty)&&(this.gl.stencilMask(d),this.current=d,this.dirty=!1)}}class l0 extends Ri{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(d){const f=this.current;(d.func!==f.func||d.ref!==f.ref||d.mask!==f.mask||this.dirty)&&(this.gl.stencilFunc(d.func,d.ref,d.mask),this.current=d,this.dirty=!1)}}class Yv extends Ri{getDefault(){const d=this.gl;return[d.KEEP,d.KEEP,d.KEEP]}set(d){const f=this.current;(d[0]!==f[0]||d[1]!==f[1]||d[2]!==f[2]||this.dirty)&&(this.gl.stencilOp(d[0],d[1],d[2]),this.current=d,this.dirty=!1)}}class c0 extends Ri{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const f=this.gl;d?f.enable(f.STENCIL_TEST):f.disable(f.STENCIL_TEST),this.current=d,this.dirty=!1}}class GP extends Ri{getDefault(){return[0,1]}set(d){const f=this.current;(d[0]!==f[0]||d[1]!==f[1]||this.dirty)&&(this.gl.depthRange(d[0],d[1]),this.current=d,this.dirty=!1)}}class w5 extends Ri{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const f=this.gl;d?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST),this.current=d,this.dirty=!1}}class KP extends Ri{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 Ri{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const f=this.gl;d?f.enable(f.BLEND):f.disable(f.BLEND),this.current=d,this.dirty=!1}}class oN extends Ri{getDefault(){const d=this.gl;return[d.ONE,d.ZERO,d.ONE,d.ZERO]}set(d){const f=this.current;(d[0]!==f[0]||d[1]!==f[1]||d[2]!==f[2]||d[3]!==f[3]||this.dirty)&&(this.gl.blendFuncSeparate(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class lN extends Ri{getDefault(){return i.ao.transparent.toNonPremultipliedRenderColor(null)}set(d){const f=this.current;(d.r!==f.r||d.g!==f.g||d.b!==f.b||d.a!==f.a||this.dirty)&&(this.gl.blendColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class j5 extends Ri{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 cN extends Ri{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const f=this.gl;d?f.enable(f.CULL_FACE):f.disable(f.CULL_FACE),this.current=d,this.dirty=!1}}class Xv extends Ri{getDefault(){return this.gl.BACK}set(d){(d!==this.current||this.dirty)&&(this.gl.cullFace(d),this.current=d,this.dirty=!1)}}class ZP extends Ri{getDefault(){return this.gl.CCW}set(d){(d!==this.current||this.dirty)&&(this.gl.frontFace(d),this.current=d,this.dirty=!1)}}let YP=class extends Ri{getDefault(){return null}set(w){(w!==this.current||this.dirty)&&(this.gl.useProgram(w),this.current=w,this.dirty=!1)}};class XP extends Ri{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 Ri{getDefault(){const d=this.gl;return[0,0,d.drawingBufferWidth,d.drawingBufferHeight]}set(d){const f=this.current;(d[0]!==f[0]||d[1]!==f[1]||d[2]!==f[2]||d[3]!==f[3]||this.dirty)&&(this.gl.viewport(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class QP extends Ri{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const f=this.gl;f.bindFramebuffer(f.FRAMEBUFFER,d),this.current=d,this.dirty=!1}}class Jie extends Ri{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const f=this.gl;f.bindRenderbuffer(f.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class eoe extends Ri{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const f=this.gl;f.bindTexture(f.TEXTURE_2D,d),this.current=d,this.dirty=!1}}class toe extends Ri{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const f=this.gl;f.bindBuffer(f.ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class k5 extends Ri{getDefault(){return null}set(d){const f=this.gl;f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class N5 extends Ri{getDefault(){return null}set(d){this.gl&&(d!==this.current||this.dirty)&&(this.gl.bindVertexArray(d),this.current=d,this.dirty=!1)}}class S5 extends Ri{getDefault(){return 4}set(d){if(d===this.current&&!this.dirty)return;const f=this.gl;f.pixelStorei(f.UNPACK_ALIGNMENT,d),this.current=d,this.dirty=!1}}class C5 extends Ri{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const f=this.gl;f.pixelStorei(f.UNPACK_PREMULTIPLY_ALPHA_WEBGL,d),this.current=d,this.dirty=!1}}class JP extends Ri{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const f=this.gl;f.pixelStorei(f.UNPACK_FLIP_Y_WEBGL,d),this.current=d,this.dirty=!1}}class dN extends Ri{constructor(d,f){super(d),this.context=d,this.parent=f}getDefault(){return null}}class uN extends dN{constructor(d,f,j=0){super(d,f),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 f=this.gl;f.framebufferTexture2D(f.FRAMEBUFFER,this.attachmentPoint,f.TEXTURE_2D,d,0),this.current=d,this.dirty=!1}}class h0 extends dN{attachment(){return this.gl.DEPTH_ATTACHMENT}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const f=this.gl;f.framebufferRenderbuffer(f.FRAMEBUFFER,this.attachment(),f.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class Qv extends dN{attachment(){return this.gl.DEPTH_ATTACHMENT}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const f=this.gl;f.framebufferTexture2D(f.FRAMEBUFFER,this.attachment(),f.TEXTURE_2D,d,0),this.current=d,this.dirty=!1}}class e6 extends h0{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const Du=(w,d,f,j)=>({u_matrix:w,u_image0:0,u_image1:1,u_skirt_height:d,u_ground_shadow_factor:f,u_emissive_texture_available:j}),hN=(w,d,f,j,I,O,F,B,W,J,te,me,ue,pe,ke,_e,Fe)=>({u_proj_matrix:Float32Array.from(w),u_globe_matrix:d,u_normalize_matrix:Float32Array.from(j),u_merc_matrix:f,u_zoom_transition:I,u_merc_center:O,u_image0:0,u_image1:1,u_frustum_tl:F,u_frustum_tr:B,u_frustum_br:W,u_frustum_bl:J,u_globe_pos:te,u_globe_radius:me,u_viewport:ue,u_grid_matrix:Fe?Float32Array.from(Fe):new Float32Array(9),u_skirt_height:pe,u_far_z_cutoff:ke,u_emissive_texture_available:_e});function Jv(w,d){return w!=null&&d!=null&&!(!w.hasData()||!d.hasData())&&w.demTexture!=null&&d.demTexture!=null&&w.tileID.key!==d.tileID.key}const Lp=new class{constructor(){this.operations={}}newMorphing(w,d,f,j,I){if(w in this.operations){const O=this.operations[w];O.to.tileID.key!==f.tileID.key&&(O.queued=f)}else this.operations[w]={startTime:j,phase:0,duration:I,from:d,to:f,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 f=this.operations[d];for(f.phase=(w-f.startTime)/f.duration;f.phase>=1||!this._validOp(f);)if(!this._nextOp(f,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()}},mN={0:null,1:"TERRAIN_VERTEX_MORPHING"};function pN(w,d,f){if(d===0)return 0;const j=d<1&&f===514?.25/d:1;return 6*Math.pow(1.5,22-w)*Math.max(d,1)*j}function M5(w,d){const f=1<({u_matrix:w});function t_(w,d,f,j,I){if(I>0){const O=i.o.now(),F=(O-w.timeAdded)/I,B=d?(O-d.timeAdded)/I:-1,W=f.getSource(),J=j.coveringZoomLevel({tileSize:W.tileSize,roundZoom:W.roundZoom}),te=!d||Math.abs(d.tileID.overscaledZ-J)>Math.abs(w.tileID.overscaledZ-J),me=te&&w.refreshedUponExpiration?1:i.aA(te?F:1-B,0,1);return d?{opacity:1,mix:1-me,isFading:F<1}:{opacity:me,mix:0,isFading:F<1}}return{opacity:1,mix:0,isFading:!1}}class fN extends bd{constructor(d){const f=Qo("mock-dem",{type:"raster-dem",maxzoom:d.transform.maxZoom},d.style.dispatcher,d.style);super("mock-dem",f,!1),f.setEventedParent(this),this._sourceLoaded=!0}_loadTile(d,f){d.state="loaded",f(null)}}class T5 extends bd{constructor(d){const f=Qo("proxy",{type:"geojson",maxzoom:d.transform.maxZoom},d.style.dispatcher,d.style);super("proxy",f,!1),f.setEventedParent(this),this.map=this.getSource().map=d,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(d,f,j){if(d.freezeTileCoverage)return;this.transform=d;const I=d.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((O,F)=>{if(O[F.key]="",!this._tiles[F.key]){const B=new Tp(F,this._source.tileSize*F.overscaleFactor(),d.tileZoom,void 0,void 0,this._source.worldview);B.state="loaded",this._tiles[F.key]=B}return O},{});for(const O in this._tiles)O in I||(this.freeFBO(O),this._tiles[O].unloadVectorData(),delete this._tiles[O])}freeFBO(d){const f=this.proxyCachedFBO[d];if(f!==void 0){const j=Object.values(f);this.renderCachePool.push(...j),delete this.proxyCachedFBO[d]}}deallocRenderCache(){this.renderCache.forEach(d=>d.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class A5 extends i.aQ{constructor(d,f,j){super(d.overscaledZ,d.wrap,d.canonical.z,d.canonical.x,d.canonical.y),this.proxyTileKey=f,this.projMatrix=j}}class E5 extends i.bV{constructor(d,f){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},this.painter=d,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[j,I,O]=function(W){const J=new i.bd,te=new i.b0,me=131;J.reserve(17161),te.reserve(33800);const ue=i.al/128,pe=i.al+ue/2,ke=pe+ue;for(let Fe=-ue;Fepe||Fe<0||Fe>pe?24575:0,at=i.aA(Math.round(Re),0,i.al),Ge=i.aA(Math.round(Fe),0,i.al);J.emplaceBack(at+We,Ge)}const _e=(Fe,Re)=>{const We=Re*me+Fe;te.emplaceBack(We+1,We,We+me),te.emplaceBack(We+me,We+me+1,We+1)};for(let Fe=1;Fe<129;Fe++)for(let Re=1;Re<129;Re++)_e(Re,Fe);return[0,129].forEach(Fe=>{for(let Re=0;Re<130;Re++)_e(Re,Fe),_e(Fe,Re)}),[J,te,32768]}(),F=d.context;this.gridBuffer=F.createVertexBuffer(j,i.bf.members),this.gridIndexBuffer=F.createIndexBuffer(I),this.gridSegments=i.bg.simpleSegment(0,0,j.length,I.length),this.gridNoSkirtSegments=i.bg.simpleSegment(0,0,j.length,O),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new T5(f.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=F.gl;this._overlapStencilMode=new Gs({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=f,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new fN(f.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,f,j){if(d&&d.terrain){this._style!==d&&(this.style=d,this._evaluationZoom=void 0);const I=d.terrain.properties,O=d.terrain.drapeRenderMode===0,F=d.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=i.o.now();const B=d.terrain&&d.terrain.scope,W=I.get("source"),J=O?this._mockSourceCache:d.getSourceCache(W,B);if(!J)return void i.w(`Couldn't find terrain source "${W}".`);if(this.sourceCache=J,this._attenuationRange=d.terrain.getAttenuationRange(),this._exaggeration=F?this.calculateExaggeration(f):I.get("exaggeration"),!f.projection.requiresDraping&&F&&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 me=this.getScaledDemTileSize();this.sourceCache.update(f,me,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,te(),this._initializing=!0),te(),f.updateElevation(!0,j),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(f),this._emptyDEMTextureDirty=!0,this._previousZoom=f.zoom}else this._disable()}calculateExaggeration(d){if(this._attenuationRange&&d.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(d.zoom);const f=this._previousCameraAltitude,j=d.getFreeCameraOptions().position.z/d.pixelsPerMeter*d.worldSize;this._previousCameraAltitude=j;const I=f!=null?j-f:Number.MAX_VALUE;if(Math.abs(I)<2)return this._exaggeration;const O=d.zoom,F=this._style.terrain;if(!this._previousUpdateTimestamp)return F.getExaggeration(O);let B=O-this._previousZoom;const W=this._previousUpdateTimestamp;let J=O;this._evaluationZoom!=null&&(J=this._evaluationZoom,Math.abs(O-J)>.5&&(B=.5*(O-J+B)),B*I<0&&(J+=B)),this._evaluationZoom=J;const te=F.getExaggeration(J),me=te===F.getExaggeration(Math.max(0,J-.1));if(me&&Math.abs(te-this._exaggeration)<.01)return te;let ue=Math.min(.1,.00375*(this._updateTimestamp-W));return(me||te<.1||Math.abs(B)<1e-4)&&(ue=Math.min(.2,4*ue)),i.ak(this._exaggeration,te,ue)}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 f=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 I=this.proxyCoords=f.getIds().map(W=>{const J=f.getTileByID(W).tileID;return J.projMatrix=j.calculateProjMatrix(J.toUnwrapped()),J});(function(W,J){const te=J.transform.pointCoordinate(J.transform.getCameraPoint()),me=new i.P(te.x,te.y);W.sort((ue,pe)=>{if(pe.overscaledZ-ue.overscaledZ)return pe.overscaledZ-ue.overscaledZ;const ke=new i.P(ue.canonical.x+(1<{this.proxyToSource[W.key]={}}),this.terrainTileForTile={};const F=this._style._mergedSourceCaches;for(const W in F){const J=F[W];if(!J.used||(J!==this.sourceCache&&this.resetTileLookupCache(J.id),this._setupProxiedCoordsForOrtho(J,d[W],O),J.usedForTerrain))continue;const te=d[W];J.getSource().reparseOverscaled&&this._assignTerrainTiles(te)}this.proxiedCoords[f.id]=I.map(W=>new A5(W,W.key,this.orthoMatrix)),this._assignTerrainTiles(I),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(O),this.renderingToTexture=!1;const B={};this._visibleDemTiles=[];for(const W of this.proxyCoords){const J=this.terrainTileForTile[W.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(f=>{if(this.terrainTileForTile[f.key])return;const j=this._findTileCoveringTileID(f,this.sourceCache);j&&(this.terrainTileForTile[f.key]=j)})}_prepareDEMTextures(){const d=this.painter.context,f=d.gl;for(const j in this.terrainTileForTile){const I=this.terrainTileForTile[j],O=I.dem;!O||I.demTexture&&!I.needsDEMTextureUpload||(d.activeTexture.set(f.TEXTURE1),v5(this.painter,I,O))}}_prepareDemTileUniforms(d,f,j,I){if(!f||f.demTexture==null)return!1;const O=d.tileID.canonical,F=Math.pow(2,f.tileID.canonical.z-O.z),B=I||"";return j[`u_dem_tl${B}`]=[O.x*F%1,O.y*F%1],j[`u_dem_scale${B}`]=F,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let d=0;const f=this._visibleDemTiles.reduce((j,I)=>{if(!I.dem)return j;const O=I.dem.tree.minimums[0];return O>0&&d++,j+O},0);return d?f/d:0}_updateEmptyDEMTexture(){const d=this.painter.context,f=d.gl;d.activeTexture.set(f.TEXTURE2);const j=this._getLoadedAreaMinimum(),I=new i.dL({width:1,height:1},new Float32Array([j]));this._emptyDEMTextureDirty=!1;let O=this._emptyDEMTexture;return O?O.update(I,{premultiply:!1}):O=this._emptyDEMTexture=new i.T(d,I,f.R32F,{premultiply:!1}),O}setupElevationDraw(d,f,j){const I=this.painter.context,O=I.gl,F={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};F.u_exaggeration=this.exaggeration();let B=null,W=null,J=1;if(j&&j.morphing&&this._useVertexMorphing){const pe=j.morphing.srcDemTile,ke=j.morphing.dstDemTile;J=j.morphing.phase,pe&&ke&&(this._prepareDemTileUniforms(d,pe,F,"_prev")&&(W=pe),this._prepareDemTileUniforms(d,ke,F)&&(B=ke))}const te=pe=>pe&&pe.demTexture&&this.painter.linearFloatFilteringSupported()?O.LINEAR:O.NEAREST;let me=null;var ue;if(this.enabled?W&&B?(me=B.demTexture,I.activeTexture.set(O.TEXTURE4),W.demTexture.bind(te(W),O.CLAMP_TO_EDGE),F.u_dem_lerp=J):(B=this.terrainTileForTile[d.tileID.key],me=this._prepareDemTileUniforms(d,B,F)?B.demTexture:this.emptyDEMTexture):me=this.emptyDEMTexture,I.activeTexture.set(O.TEXTURE2),me&&(F.u_dem_size=(ue=me).size[0]===1?1:ue.size[0]-2,me.bind(te(B),O.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(j&&j.useDepthForOcclusion,f,F),j&&j.useMeterToDem&&B){const pe=(1<{if(Re===Xt)return;const lr=[mN[Xt],"PROJECTION_GLOBE_VIEW"];at&&lr.push("CUSTOM_ANTIALIASING");const br=J.isTileAffectedByFog(Yt);Fe=J.getOrCreateProgram("globeRaster",{defines:lr,overrideFog:br}),Re=Xt},kt=J.colorModeForRenderPass(),yt=new _s(_e.LEQUAL,_s.ReadWrite,J.depthRangeFor3D);Lp.update(pe);const bt=i.dF(We),ft=[i.aF(We.center.lng),i.aJ(We.center.lat)],ht=J.globeSharedBuffers,Ct=[We.width*i.o.devicePixelRatio,We.height*i.o.devicePixelRatio],Rt=Float32Array.from(We.globeMatrix),Dt={useDenormalizedUpVectorScale:!0};{const Yt=J.transform,Xt=pN(Yt.zoom,te.exaggeration(),te.sourceCache._source.tileSize);Re=-1;const lr=_e.TRIANGLES;for(const br of ue){const Ht=me.getTile(br),Et=Gs.disabled,er=te.prevTerrainTileForTile[br.key],Zt=te.terrainTileForTile[br.key];Jv(er,Zt)&&Lp.newMorphing(br.key,er,Zt,pe,250),m0(J,Ht.emissiveTexture),ke.activeTexture.set(_e.TEXTURE0),Ht.texture&&Ht.texture.bind(_e.LINEAR,_e.CLAMP_TO_EDGE);const hr=Lp.getMorphValuesForProxy(br.key),Ir=hr?1:0;hr&&Object.assign(Dt,{morphing:{srcDemTile:hr.from,dstDemTile:hr.to,phase:i.dD(hr.phase)}});const Xr=i.dG(br.canonical),Mr=i.dH(Xr.getCenter().lat),wr=i.dI(br.canonical,Xr,Mr,Yt.worldSize/Yt._pixelsPerMercatorPixel),fs=i.bk(i.dJ(br.canonical)),ls=J.emissiveMode==="mrt-fallback"?1:0,Wr=hN(Yt.expandedFarZProjMatrix,Rt,bt,fs,i.aj(Yt.zoom),ft,Yt.frustumCorners.TL,Yt.frustumCorners.TR,Yt.frustumCorners.BR,Yt.frustumCorners.BL,Yt.globeCenterInViewSpace,Yt.globeRadius,Ct,Xt,Yt._farZ,ls,wr);if(Ge(br,Ir),Fe&&(te.setupElevationDraw(Ht,Fe,Dt),J.uploadCommonUniforms(ke,Fe,br.toUnwrapped()),ht)){const[Jr,As,an]=ht.getGridBuffers(Mr,Xt!==0);Fe.draw(J,lr,yt,Et,kt,Vs.backCCW,Wr,"globe_raster",Jr,As,an)}}}if(ht&&(J.renderDefaultNorthPole||J.renderDefaultSouthPole)){const Yt=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];at&&Yt.push("CUSTOM_ANTIALIASING"),Fe=J.getOrCreateProgram("globeRaster",{defines:Yt});for(const Xt of ue){const{x:lr,y:br,z:Ht}=Xt.canonical,Et=br===0,er=br===(1<Jr.draw(J,_e.TRIANGLES,yt,Gs.disabled,kt,Vs.disabled,hN(We.expandedFarZProjMatrix,wr,wr,fs,0,ft,We.frustumCorners.TL,We.frustumCorners.TR,We.frustumCorners.BR,We.frustumCorners.BL,We.globeCenterInViewSpace,We.globeRadius,Ct,0,We._farZ,ls),"globe_pole_raster",As,Ir,Xr);te.setupElevationDraw(Mr,Fe,Dt),J.uploadCommonUniforms(ke,Fe,Xt.toUnwrapped()),Et&&J.renderDefaultNorthPole&&Wr(Fe,Zt),er&&J.renderDefaultSouthPole&&(wr=i.cS(i.bC(),wr,[1,-1,1]),Wr(Fe,hr))}}}})(I,O,F,B,W);else{const J=I.context,te=J.gl;let me,ue;const pe=I.shadowRenderer,ke=Xf(I,I.longestCutoffRange),_e=kt=>{if(ue===kt)return;const yt=[];yt.push(mN[kt]),ke.shouldRenderCutoff&&yt.push("RENDER_CUTOFF"),pe&&(yt.push("RENDER_SHADOWS","DEPTH_TEXTURE"),pe.useNormalOffset&&yt.push("NORMAL_OFFSET")),me=I.getOrCreateProgram("terrainRaster",{defines:yt}),ue=kt},Fe=I.colorModeForRenderPass(),Re=new _s(te.LEQUAL,_s.ReadWrite,I.depthRangeFor3D);Lp.update(W);const We=I.transform,at=pN(We.zoom,O.exaggeration(),O.sourceCache._source.tileSize);let Ge=[0,0,0];if(pe){const kt=I.style.directionalLight,yt=I.style.ambientLight;kt&&yt&&(Ge=Pp(I.style,kt,yt))}{ue=-1;const kt=te.TRIANGLES,[yt,bt]=[O.gridIndexBuffer,O.gridSegments];for(const ft of B){const ht=F.getTile(ft),Ct=Gs.disabled,Rt=O.prevTerrainTileForTile[ft.key],Dt=O.terrainTileForTile[ft.key];Jv(Rt,Dt)&&Lp.newMorphing(ft.key,Rt,Dt,W,250),m0(I,ht.emissiveTexture),J.activeTexture.set(te.TEXTURE0),ht.texture&&ht.texture.bind(te.LINEAR,te.CLAMP_TO_EDGE);const Yt=Lp.getMorphValuesForProxy(ft.key),Xt=Yt?1:0;let lr;Yt&&(lr={morphing:{srcDemTile:Yt.from,dstDemTile:Yt.to,phase:i.dD(Yt.phase)}});const br=I.emissiveMode==="mrt-fallback"?1:0,Ht=Du(ft.projMatrix,M5(ft.canonical,We.renderWorldCopies)?at/10:at,Ge,br);if(_e(Xt),!me)continue;O.setupElevationDraw(ht,me,lr);const Et=ft.toUnwrapped();pe&&pe.setupShadows(Et,me),I.uploadCommonUniforms(J,me,Et,null,ke),me.draw(I,kt,Re,Ct,Fe,Vs.backCCW,Ht,"terrain_raster",O.gridBuffer,yt,bt)}}}}(f,this,this.proxySourceCache,d,this._updateTimestamp),this.renderingToTexture=!0,f.gpuTimingDeferredRenderEnd(),d.splice(0,d.length))}renderBatch(d){if(this._drapedRenderBatches.length===0)return d+1;this.renderingToTexture=!0;const f=this.painter,j=this.painter.context,I=this.proxySourceCache,O=this.proxiedCoords[I.id],F=this._drapedRenderBatches.shift(),B=f.style.order,W=[];this._updateFBOs(f.emissiveMode==="mrt-fallback");let J=0;for(const te of O){const me=I.getTileByID(te.proxyTileKey),ue=I.proxyCachedFBO[te.key]?I.proxyCachedFBO[te.key][d]:void 0,pe=ue!==void 0?I.renderCache[ue]:this.pool[J++],ke=ue!==void 0;if(me.texture=pe.tex,me.emissiveTexture=pe.emissiveTex,ke&&!pe.dirty){W.push(me.tileID);continue}j.bindFramebuffer.set(pe.fb.framebuffer);const _e=j.gl;let Fe;_e.drawBuffers(f.emissiveMode==="mrt-fallback"?[_e.COLOR_ATTACHMENT0,_e.COLOR_ATTACHMENT1]:[_e.COLOR_ATTACHMENT0]),this.renderedToTile=!1,pe.dirty&&(j.clear({color:i.ao.transparent,stencil:0}),pe.dirty=!1);for(let Re=F.start;Re<=F.end;++Re){const We=f.style._mergedLayers[B[Re]];if(We.isHidden(f.transform.zoom))continue;const at=f.style.getLayerSourceCache(We),Ge=at?this.proxyToSource[te.key][at.id]:[te];if(!Ge)continue;const kt=Ge;j.viewport.set([0,0,pe.fb.width,pe.fb.height]),Fe!==(at?at.id:null)&&(this._setupStencil(pe,Ge,We,at),Fe=at?at.id:null),f.renderLayer(f,at,We,kt)}if(_e.drawBuffers([_e.COLOR_ATTACHMENT0]),this._drapedRenderBatches.length===0)for(const Re of this._pendingGroundEffectLayers){const We=f.style._mergedLayers[B[Re]];if(We.isHidden(f.transform.zoom))continue;const at=f.style.getLayerSourceCache(We),Ge=at?this.proxyToSource[te.key][at.id]:[te];if(!Ge)continue;const kt=Ge;j.viewport.set([0,0,pe.fb.width,pe.fb.height]),Fe!==(at?at.id:null)&&(this._setupStencil(pe,Ge,We,at),Fe=at?at.id:null),f.renderLayer(f,at,We,kt)}this.renderedToTile?(pe.dirty=!0,W.push(me.tileID)):ke||--J,J===5&&(J=0,this.renderToBackBuffer(W))}return this.renderToBackBuffer(W),this.renderingToTexture=!1,j.bindFramebuffer.set(null),j.viewport.set([0,0,f.width,f.height]),F.end+1}postRender(){}isLayerOrderingCorrect(d){const f=d.order.length;let j=-1,I=f;for(let O=0;Oj}getMinElevationBelowMSL(){let d=0;return this._visibleDemTiles.filter(f=>f.dem).forEach(f=>{d=Math.min(d,f.dem.tree.minimums[0])}),d===0?d:(d-30)*this._exaggeration}raycast(d,f,j){if(!this._visibleDemTiles)return null;const I=this._visibleDemTiles.filter(O=>O.dem).map(O=>{const F=O.tileID,B=1<(O.t!==null?O.t:Number.MAX_VALUE)-(F.t!==null?F.t:Number.MAX_VALUE));for(const O of I){if(O.t==null)return null;const F=O.tile.dem.tree.raycast(O.minx,O.miny,O.maxx,O.maxy,d,f,j);if(F!=null)return F}return null}_createFBO(){const d=this.painter.context,f=d.gl,j=this.drapeBufferSize;d.activeTexture.set(f.TEXTURE0);const I=new i.T(d,{width:j[0],height:j[1],data:null},f.RGBA8);I.bind(f.LINEAR,f.CLAMP_TO_EDGE);const O=d.createFramebuffer(j[0],j[1],1,null);let F;return O.colorAttachment0.set(I.texture),this._emissiveTexture&&(F=new i.T(d,{width:j[0],height:j[1],data:null},f.R8),F.bind(f.LINEAR,f.CLAMP_TO_EDGE),O.createColorAttachment(d,1),O.colorAttachment1.set(F.texture)),O.depthAttachment=new e6(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&&f.texParameterf(f.TEXTURE_2D,d.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,d.extTextureFilterAnisotropicMax),{fb:O,tex:I,emissiveTex:F,dirty:!1}}_updateFBOs(d){if(this._emissiveTexture!==d){for(const f of this.pool)this._updateFBO(f,d);for(const f of this.proxySourceCache.renderCache)this._updateFBO(f,d);this._emissiveTexture=d}}_updateFBO(d,f){const j=d.fb,I=this.painter.context,O=I.gl,F=this.drapeBufferSize;if(f){const B=new i.T(I,{width:F[0],height:F[1],data:null},O.R8);B.bind(O.LINEAR,O.CLAMP_TO_EDGE),d.emissiveTex=B,j.createColorAttachment(I,1),j.colorAttachment1.set(B.texture)}else d.emissiveTex=void 0,j.removeColorAttachment(I,1);d.dirty=!0}_initFBOPool(){for(;this.pool.length{const f=this._style._mergedLayers[d],j=f.isHidden(this.painter.transform.zoom);return f.type==="hillshade"||f.type==="custom"?!j&&f.shouldRedrape():!j&&f.hasTransition()})}_clearLineLayersFromRenderCache(){let d=!1;for(const j of this._style.getSources())if(j instanceof Im){d=!0;break}if(!d)return;const f={};for(let j=0;jW>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 f=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,f.renderCache.length>f.renderCachePool.length){const F=Object.values(f.proxyCachedFBO);f.proxyCachedFBO={};for(let B=0;B=0;F--){const B=j[F];if(f.getTileByID(B.key),f.proxyCachedFBO[B.key]!==void 0){const W=d[B.key],J=this.proxyToSource[B.key];let te=0;for(const me in J){const ue=J[me],pe=W[me];if(!pe||pe.length!==ue.length||ue.some((ke,_e)=>ke!==pe[_e]||I[me]&&I[me].hasOwnProperty(ke.key))){te=-1;break}++te}for(const me in f.proxyCachedFBO[B.key])f.renderCache[f.proxyCachedFBO[B.key][me]].dirty=te<0||te!==Object.values(W).length}}const O=[...this._drapedRenderBatches];O.sort((F,B)=>B.end-B.start-(F.end-F.start));for(const F of O)for(const B of j){if(f.proxyCachedFBO[B.key])continue;let W=f.renderCachePool.pop();W===void 0&&f.renderCache.length<50&&(W=f.renderCache.length,f.renderCache.push(this._createFBO())),W!==void 0&&(f.proxyCachedFBO[B.key]={},f.proxyCachedFBO[B.key][F.start]=W,f.renderCache[W].dirty=!0)}this._tilesDirty={}}_setupStencil(d,f,j,I){if(!I||!this._sourceTilesOverlap[I.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const O=this.painter.context,F=O.gl;if(f.length<=1)return void(this._overlapStencilType=!1);let B;if(j.isTileClipped())B=f.length,this._overlapStencilMode.test={func:F.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(f[0].overscaledZ>f[f.length-1].overscaledZ))return void(this._overlapStencilType=!1);B=1,this._overlapStencilMode.test={func:F.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(f,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):Gs.disabled}_renderTileClippingMasks(d,f){const j=this.painter,I=this.painter.context,O=I.gl;j._tileClippingMaskIDs={},I.setColorMode(fn.disabled),I.setDepthMode(_s.disabled);const F=j.getOrCreateProgram("clippingMask");for(const B of d){const W=j._tileClippingMaskIDs[B.key]=--f;F.draw(j,O.TRIANGLES,_s.disabled,new Gs({func:O.ALWAYS,mask:0},W,255,O.KEEP,O.KEEP,O.REPLACE),fn.disabled,Vs.disabled,e_(B.projMatrix),"$clipping",j.tileExtentBuffer,j.quadTriangleIndexBuffer,j.tileExtentSegments)}}pointCoordinate(d){const f=this.painter.transform;if(d.x<0||d.x>f.width||d.y<0||d.y>f.height)return null;const j=[d.x,d.y,1,1];i.aC(j,j,f.pixelMatrixInverse),i.cK(j,j,1/j[3]),j[0]/=f.worldSize,j[1]/=f.worldSize;const I=f._camera.position,O=i.cf(1,f.center.lat),F=[I[0],I[1],I[2]/O,0],B=i.da([],j.slice(0,3),F);i.aw(B,B);const W=this.raycast(F,B,this._exaggeration);return W!==null&&W?(i.bH(F,F,B,W),F[3]=F[2],F[2]*=O,F):null}_setupProxiedCoordsForOrtho(d,f,j){if(d.getSource()instanceof i.aU)return this._setupProxiedCoordsForImageSource(d,f,j);this._findCoveringTileCache[d.id]=this._findCoveringTileCache[d.id]||{};const I=this.proxiedCoords[d.id]=[],O=this.proxyCoords;for(let W=0;Wte.overscaledZ-J.overscaledZ)}_setupProxiedCoordsForImageSource(d,f,j){if(!d.getSource().loaded())return;const I=this.proxiedCoords[d.id]=[],O=this.proxyCoords,F=d.getSource(),B=F.tileID;if(!B)return;const W=new i.P(B.x,B.y)._div(1<(me.min.x=Math.min(me.min.x,ue.x-W.x),me.min.y=Math.min(me.min.y,ue.y-W.y),me.max.x=Math.max(me.max.x,ue.x-W.x),me.max.y=Math.max(me.max.y,ue.y-W.y),me),{min:new i.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new i.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),te=(me,ue)=>{const pe=me.wrap+me.canonical.x/(1<Fe+J.max.x||ke+_eRe+J.max.y};for(let me=0;meF.key===f.tileID.key);if(O)return O}if(f.tileID.key!==d.key){const O=d.canonical.z-f.tileID.canonical.z;let F,B,W;I=i.bC();const J=f.tileID.wrap-d.wrap<0?(F=i.al>>O,B=F*((f.tileID.canonical.x<=me){const ue=d.canonical.z-me;f.getSource().reparseOverscaled?(B=Math.max(d.canonical.z+2,f.transform.tileZoom),F=new i.aQ(B,d.wrap,me,d.canonical.x>>ue,d.canonical.y>>ue)):ue!==0&&(B=me,F=new i.aQ(B,d.wrap,me,d.canonical.x>>ue,d.canonical.y>>ue))}F.key!==d.key&&(J.push(F.key),j=f.getTile(F))}const te=me=>{J.forEach(ue=>{I[ue]=me}),J.length=0};for(B-=1;B>=W&&(!j||!j.hasData());B--){j&&te(j.tileID.key);const me=F.calculateScaledKey(B);if(j=f.getTileByID(me),j&&j.hasData())break;const ue=I[me];if(ue===null)break;ue===void 0?J.push(me):j=f.getTileByID(ue)}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,f){let j=this._tilesDirty[d];j||(j=this._tilesDirty[d]={}),j[f.key]=!0}}function p0(w,d,f){const j=function(B,W,J){const te=i.bJ(W,B),me=i.bJ(J,[.2126,.7152,.0722]),ue=(ke,_e,Fe)=>(1-Fe)*ke+Fe*_e,pe=ue(1-.3*Math.min(me,1),1,Math.min(te+1,1));return ue(.92,1,Math.asin(i.aA(W[2],-1,1))/Math.PI+.5)*pe}(w,[0,0,1],d),I=[0,0,0];i.c5(I,f.slice(0,3),j);const O=[0,0,0];i.c5(O,d.slice(0,3),w[2]);const F=[0,0,0];return i.d8(F,I,O),i.db(F)}const roe=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],soe=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class t6{static cacheKey(d,f,j,I){const O=[f];I&&O.push(I.cacheKey);for(const F of j)d.usedDefines.has(F)&&O.push(F);return O.join("/")}constructor(d,f,j,I,O,F){const B=d.gl;this.program=B.createProgram(),this.configuration=I,this.name=f,this.fixedDefines=[...F];const W=`#version 300 es ${(I?I.defines():[]).concat(F.map(_e=>`#define ${_e}`)).join(` `)}`,J=[W,Gie];for(const _e of j.fragmentIncludes)J.push(tg[_e]);J.push(j.fragmentSource);const te=J.join(` `),me=[W,HP];for(const _e of j.vertexIncludes)me.push(tg[_e]);this.forceManualRenderingForInstanceIDShaders=d.forceManualRenderingForInstanceIDShaders&&j.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&me.push("uniform int u_instanceID;"),me.push(j.vertexSource);let ue=me.join(` `);this.forceManualRenderingForInstanceIDShaders&&(ue=ue.replaceAll("gl_InstanceID","u_instanceID"));const pe=B.createShader(B.FRAGMENT_SHADER);if(B.isContextLost())return void(this.failedToCreate=!0);B.shaderSource(pe,te),B.compileShader(pe),B.attachShader(this.program,pe);const ke=B.createShader(B.VERTEX_SHADER);B.isContextLost()?this.failedToCreate=!0:(B.shaderSource(ke,ue),B.compileShader(ke),B.attachShader(this.program,ke),this.attributes={},B.linkProgram(this.program),B.deleteShader(ke),B.deleteShader(pe),this.fixedUniforms=O(d),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=I?I.getUniforms(d):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(_e=>({u_instanceID:new i.ch(_e)}))(d)),(F.includes("TERRAIN")||f.includes("symbol")||f.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)),F.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)),F.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)),F.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(_e=>({u_cutoff_params:new i.d3(_e)}))(d)),F.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)),F.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,f){let j=this.attributes[f];return j===void 0&&(j=this.attributes[f]=d.getAttribLocation(this.program,f)),j}setTerrainUniformValues(d,f){if(!this.terrainUniforms)return;const j=this.terrainUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const I in f)j[I]&&j[I].set(this.program,I,f[I])}}setGlobeUniformValues(d,f){if(!this.globeUniforms)return;const j=this.globeUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const I in f)j[I]&&j[I].set(this.program,I,f[I])}}setFogUniformValues(d,f){if(!this.fogUniforms)return;const j=this.fogUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const I in f)j[I].set(this.program,I,f[I])}}setCutoffUniformValues(d,f){if(!this.cutoffUniforms)return;const j=this.cutoffUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const I in f)j[I].set(this.program,I,f[I])}}setLightsUniformValues(d,f){if(!this.lightsUniforms)return;const j=this.lightsUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const I in f)j[I].set(this.program,I,f[I])}}setShadowUniformValues(d,f){if(this.failedToCreate||!this.shadowUniforms)return;const j=this.shadowUniforms;d.program.set(this.program);for(const I in f)j[I].set(this.program,I,f[I])}_drawDebugWireframe(d,f,j,I,O,F,B,W,J,te){const me=d.options.wireframe;if(me.terrain===!1&&me.layers2D===!1&&me.layers3D===!1)return;const ue=d.context;if(!(!(!me.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!me.layers2D||d._terrain&&d._terrain.renderingToTexture||!roe.includes(this.name))||!(!me.layers3D||!soe.includes(this.name))))return;const pe=ue.gl,ke=d.wireframeDebugCache.getLinesFromTrianglesBuffer(d.frameCounter,O,ue);if(!ke)return;const _e=[...this.fixedDefines,"DEBUG_WIREFRAME"],Fe=d.getOrCreateProgram(this.name,{config:this.configuration,defines:_e});ue.program.set(Fe.program);const Re=(Ge,kt,yt)=>{if(kt[Ge]&&yt[Ge])for(const bt in kt[Ge])yt[Ge][bt]&&yt[Ge][bt].set(yt.program,bt,kt[Ge][bt].current)};J&&J.setUniforms(Fe.program,ue,Fe.binderUniforms,B,{zoom:W}),Re("fixedUniforms",this,Fe),Re("terrainUniforms",this,Fe),Re("globeUniforms",this,Fe),Re("fogUniforms",this,Fe),Re("lightsUniforms",this,Fe),Re("shadowUniforms",this,Fe),ke.bind(),ue.setColorMode(new fn([pe.ONE,pe.ONE_MINUS_SRC_ALPHA,pe.ZERO,pe.ONE],i.ao.transparent,[!0,!0,!0,!1])),ue.setDepthMode(new _s(f.func===pe.LESS?pe.LEQUAL:f.func,_s.ReadOnly,f.range)),ue.setStencilMode(Gs.disabled);const We=3*F.primitiveLength*2,at=3*F.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const Ge=te||1;for(let kt=0;kt1?pe.drawElementsInstanced(pe.LINES,We,pe.UNSIGNED_SHORT,at,te):pe.drawElements(pe.LINES,We,pe.UNSIGNED_SHORT,at);O.bind(),ue.program.set(this.program),ue.setDepthMode(f),ue.setStencilMode(j),ue.setColorMode(I)}checkUniforms(d,f,j){if(this.fixedDefines.includes(f)){for(const I of Object.keys(j))if(!j[I].initialized)throw new Error(`Program '${this.name}', from draw '${d}': uniform ${I} not set but required by ${f} being defined`)}}draw(d,f,j,I,O,F,B,W,J,te,me,ue,pe,ke,_e,Fe){const Re=d.context,We=Re.gl;if(this.failedToCreate)return;Re.program.set(this.program),Re.setDepthMode(j),Re.setStencilMode(I),Re.setColorMode(O),Re.setCullFace(F);for(const[ft,ht]of this.fixedUniformsEntries)ht.set(this.program,ft,B[ft]);ke&&ke.setUniforms(this.program,Re,this.binderUniforms,ue,{zoom:pe});const at={[We.POINTS]:1,[We.LINES]:2,[We.TRIANGLES]:3,[We.LINE_STRIP]:1}[f];this.checkUniforms(W,"RENDER_SHADOWS",this.shadowUniforms);const Ge=_e||[],kt=ke?ke.getPaintVertexBuffers():[],yt=f===We.TRIANGLES&&te,bt=Fe&&Fe>0?1:void 0;for(const ft of me.get()){const ht=ft.vaos||(ft.vaos={});if((ht[W]||(ht[W]=new Kie)).bind(Re,this,J,kt,te,ft.vertexOffset,Ge,bt),this.forceManualRenderingForInstanceIDShaders){const Ct=Fe||1;for(let Rt=0;Rt1?We.drawElementsInstanced(f,ft.primitiveLength*at,We.UNSIGNED_SHORT,ft.primitiveOffset*at*2,Fe):te?We.drawElements(f,ft.primitiveLength*at,We.UNSIGNED_SHORT,ft.primitiveOffset*at*2):We.drawArrays(f,ft.vertexOffset,ft.vertexLength);yt&&this._drawDebugWireframe(d,j,I,O,te,ft,ue,pe,ke,Fe)}}}function r6(w,d,f=0){const j=Math.pow(2,d.tileID.overscaledZ),I=d.tileSize*Math.pow(2,w.transform.tileZoom)/j,O=I*(d.tileID.canonical.x+d.tileID.wrap*j),F=I*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,F>>16],u_pixel_coord_lower:[65535&O,65535&F],u_pattern_transition:f}}const gN={terrain:0,flat:1},noe=i.bC(),xN=(w,d,f,j,I,O,F,B,W,J,te,me,ue,pe,ke,_e,Fe,Re)=>{const We=d.style.light,at=We.properties.get("position"),Ge=[at.x,at.y,at.z],kt=i.dO();We.properties.get("anchor")==="viewport"&&(i.dP(kt,-d.transform.angle),i.dQ(Ge,Ge,kt));const yt=We.properties.get("color").toPremultipliedRenderColor(null),bt=d.transform,ft={u_matrix:w,u_lightpos:Ge,u_lightintensity:We.properties.get("intensity"),u_lightcolor:[yt.r,yt.g,yt.b],u_vertical_gradient:+f,u_opacity:j,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:noe,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:gN[J],u_base_type:gN[te],u_ao:I,u_edge_radius:O,u_width_scale:F,u_flood_light_color:ke,u_vertical_scale:_e,u_flood_light_intensity:Fe,u_ground_shadow_factor:Re};return bt.projection.name==="globe"&&(ft.u_tile_id=[B.canonical.x,B.canonical.y,1<({u_matrix:w,u_edge_radius:d,u_width_scale:f,u_vertical_scale:j,u_height_type:gN[I],u_base_type:gN[O]}),s6=(w,d,f,j,I,O,F,B,W,J,te,me,ue,pe,ke,_e,Fe,Re)=>{const We=xN(w,d,f,j,I,O,F,B,J,te,me,ue,pe,ke,_e,Fe,1,[0,0,0]),at={u_height_factor:-Math.pow(2,B.overscaledZ)/W.tileSize/8};return Object.assign(We,r6(d,W,Re),at)},f0=(w,d,f,j,I,O,F,B,W,J,te)=>({u_matrix:d,u_opacity:f,u_ao_pass:j?1:0,u_meter_to_tile:I,u_ao:O,u_flood_light_intensity:F,u_flood_light_color:B,u_attenuation:W,u_edge_radius:J,u_fb:0,u_fb_size:te,u_dynamic_offset:1}),P5=(w,d,f)=>({u_matrix:w,u_emissive_strength:d,u_ground_shadow_factor:f}),L5=(w,d,f,j,I,O=0)=>Object.assign(P5(w,d,I),r6(f,j,O)),n6=(w,d,f,j)=>({u_matrix:w,u_world:f,u_emissive_strength:d,u_ground_shadow_factor:j}),O5=(w,d,f,j,I,O,F=0)=>Object.assign(L5(w,d,f,j,O,F),{u_world:I}),sg=(w,d)=>({u_matrix:w,u_ground_shadow_factor:d}),vx=(w,d,f,j,I)=>({u_matrix:w,u_camera_pos:[d[0],d[1],d[2]],u_depth_bias:f,u_height_scale:j,u_reset_depth:I}),yN=(w,d,f,j,I,O,F,B,W)=>({u_matrix:w,u_normal_matrix:d,u_opacity:f,u_faux_facade_ao_intensity:j,u_camera_pos:I,u_tile_to_meter:O,u_facade_emissive_chance:F,u_flood_light_color:B,u_flood_light_intensity:W}),a6=w=>({u_matrix:w}),ng=w=>({u_matrix:w}),D5=(w,d,f,j,I,O,F,B)=>{const W=i.al/O.tileSize;return{u_matrix:w,u_inv_rot_matrix:d,u_camera_to_center_distance:f.getCameraToCenterDistance(B),u_extrude_scale:[f.pixelsToGLUnits[0]/W,f.pixelsToGLUnits[1]/W],u_zoom_transition:j,u_tile_id:F,u_merc_center:I}},r_=(w,d,f=1)=>({u_matrix:w,u_color:d,u_overlay:0,u_overlay_scale:f}),i6=i.bC(),o6=(w,d,f,j,I,O,F)=>{const B=w.transform,W=B.projection.name==="globe",J=W?i.dR(B.zoom,d.canonical)*B._pixelsPerMercatorPixel:i.ay(f,1,O),te={u_matrix:d.projMatrix,u_extrude_scale:J,u_intensity:F,u_inv_rot_matrix:i6,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(W){te.u_inv_rot_matrix=j,te.u_merc_center=I,te.u_tile_id=[d.canonical.x,d.canonical.y,1<({u_matrix:w,u_normalize_matrix:d,u_globe_matrix:f,u_merc_matrix:j,u_grid_matrix:I,u_tl_parent:O,u_scale_parent:J,u_fade_t:te.mix,u_opacity:te.opacity*me.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:me.paint.get("raster-brightness-min"),u_brightness_high:me.paint.get("raster-brightness-max"),u_saturation_factor:i.dT(me.paint.get("raster-saturation")),u_contrast_factor:i.dS(me.paint.get("raster-contrast")),u_spin_weights:c6(me.paint.get("raster-hue-rotate")),u_perspective_transform:ue,u_raster_elevation:pe,u_zoom_transition:F,u_merc_center:B,u_cutoff_params:W,u_colorization_mix:vN(i.dU,_e,Re),u_colorization_offset:_N(i.dU,Fe,Re),u_color_ramp:ke,u_texture_offset:[at/(We+2*at),We/(We+2*at)],u_texture_res:[We+2*at,We+2*at],u_emissive_strength:Ge});function c6(w){w*=Math.PI/180;const d=Math.sin(w),f=Math.cos(w);return[(2*f+1)/3,(-Math.sqrt(3)*d-f+1)/3,(Math.sqrt(3)*d-f+1)/3]}const zm=.05,aoe=(w,d,f,j,I,O,F,B,W,J,te,me)=>({u_matrix:w,u_normalize_matrix:d,u_globe_matrix:f,u_merc_matrix:j,u_grid_matrix:I,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:me,u_zoom_transition:F,u_merc_center:B,u_cutoff_params:W}),ioe=(w,d,f,j,I,O,F,B,W,J)=>({u_particle_texture:w,u_particle_texture_side_len:d,u_tile_offset:f,u_velocity:j,u_color_ramp:O,u_velocity_res:I,u_max_speed:F,u_uv_offset:B,u_data_scale:[255*W[0],255*W[1]],u_data_offset:J,u_particle_pos_scale:1.1,u_particle_pos_offset:[zm,zm]}),d6=(w,d,f,j,I,O,F,B,W,J)=>({u_particle_texture:w,u_particle_texture_side_len:d,u_velocity:f,u_velocity_res:j,u_max_speed:I,u_speed_factor:O,u_reset_rate:F,u_rand_seed:Math.random(),u_uv_offset:B,u_data_scale:[255*W[0],255*W[1]],u_data_offset:J,u_particle_pos_scale:1.1,u_particle_pos_offset:[zm,zm]}),u6=i.bC(),bN=(w,d,f,j,I,O,F,B,W,J,te,me,ue,pe,ke,_e,Fe,Re,We,at,Ge,kt,yt,bt)=>{const ft=I.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:ft.getCameraToCenterDistance(We),u_rotate_symbol:+f,u_aspect_ratio:ft.width/ft.height,u_fade_change:I.options.fadeDuration?I.symbolFadeChange:1,u_matrix:O,u_label_plane_matrix:F,u_coord_matrix:B,u_is_text:+J,u_elevation_from_sea:W?1:0,u_pitch_with_map:+j,u_texsize:te,u_texsize_icon:me,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:u6,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:u6,u_up_vector:[0,-1,0],u_color_adj_mat:kt,u_icon_transition:yt||0,u_gamma_scale:j?I.transform.getCameraToCenterDistance(We)*Math.cos(I.terrain?0:I.transform._pitch):1,u_device_pixel_ratio:i.o.devicePixelRatio,u_is_halo:1,u_scale_factor:bt||1,u_ground_shadow_factor:at,u_inv_matrix:i.bl(i.bC(),F),u_normal_scale:Ge,u_lutTexture:Ol.LUT};return We.name==="globe"&&(ht.u_tile_id=[pe.canonical.x,pe.canonical.y,1<({u_matrix:w,u_emissive_strength:d,u_opacity:f,u_color:j}),ag=(w,d,f,j,I,O,F,B,W)=>Object.assign(function(J,te,me,ue,pe,ke){const{width:_e,height:Fe}=ue.imageManager.getPixelSize(te),Re=Math.pow(2,ke.tileID.overscaledZ),We=ke.tileSize*Math.pow(2,ue.transform.tileZoom)/Re,at=We*(ke.tileID.canonical.x+ke.tileID.wrap*Re),Ge=We*ke.tileID.canonical.y;return{u_image:0,u_pattern_tl:me.tl,u_pattern_br:me.br,u_texsize:[_e,Fe],u_pattern_size:me.displaySize,u_pattern_units_to_pixels:pe?[ue.transform.width,-1*ue.transform.height]:[1/i.ay(ke,1,ue.transform.tileZoom),1/i.ay(ke,1,ue.transform.tileZoom)],u_pixel_coord_upper:[at>>16,Ge>>16],u_pixel_coord_lower:[65535&at,65535&Ge]}}(0,O,F,j,B,W),{u_matrix:w,u_emissive_strength:d,u_opacity:f}),g0=new Float32Array(i.bA([])),_x=(w,d,f,j,I,O,F,B,W,J,te,me,ue,pe=[0,0,0],ke,_e,Fe)=>{const Re=I.style.light,We=Re.properties.get("position"),at=[-We.x,-We.y,We.z],Ge=i.dO();Re.properties.get("anchor")==="viewport"&&(i.dP(Ge,-I.transform.angle),i.dQ(at,at,Ge));const kt=te.alphaMode==="MASK",yt=Re.properties.get("color").toNonPremultipliedRenderColor(null),bt=ue.paint.get("model-ambient-occlusion-intensity"),ft=ue.paint.get("model-color").constantOr(i.ao.white).toNonPremultipliedRenderColor(null);return ft.a=ue.paint.get("model-color-mix-intensity").constantOr(0),Fe&&(ft.r=Fe[0],ft.g=Fe[1],ft.b=Fe[2],ft.a=Fe[3]),_e&&(ft.r=_e.color.r,ft.g=_e.color.g,ft.b=_e.color.b,ft.a=_e.colorMix,me=_e.emissionStrength,O*=_e.opacity),{u_matrix:w,u_lighting_matrix:d,u_normal_matrix:f,u_node_matrix:j||g0,u_lightpos:at,u_lightintensity:Re.properties.get("intensity"),u_lightcolor:[yt.r,yt.g,yt.b],u_camera_pos:pe,u_opacity:O,u_baseTextureIsAlpha:0,u_alphaMask:+kt,u_alphaCutoff:te.alphaCutoff,u_baseColorFactor:F.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:B.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:W,u_roughnessFactor:J,u_baseColorTexture:Ol.BaseColor,u_metallicRoughnessTexture:Ol.MetallicRoughness,u_normalTexture:Ol.Normal,u_occlusionTexture:Ol.Occlusion,u_emissionTexture:Ol.Emission,u_lutTexture:Ol.LUT,u_color_mix:ft.toArray01(),u_aoIntensity:bt,u_emissive_strength:me,u_occlusionTextureTransform:ke||[0,0,0,0]}},R5=(w,d=g0,f=g0)=>({u_matrix:w,u_instance:d,u_node_matrix:f}),wN={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 Yh{constructor(d,f,j,I){this.id=Yh.uniqueIdxCounter,Yh.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,f.arrayBuffer,this.dynamicDraw?O.DYNAMIC_DRAW:O.STATIC_DRAW),this.dynamicDraw||I||f.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(d){this.id=Yh.uniqueIdxCounter,Yh.uniqueIdxCounter++;const f=this.context.gl;this.context.unbindVAO(),this.bind(),f.bufferSubData(f.ELEMENT_ARRAY_BUFFER,0,d.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Yh.uniqueIdxCounter=0;const F5={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class h6{constructor(d,f,j,I,O,F){this.length=f.length,this.attributes=j,this.itemSize=f.bytesPerElement,this.dynamicDraw=I,this.instanceCount=F,this.context=d;const B=d.gl;this.buffer=B.createBuffer(),d.bindVertexBuffer.set(this.buffer),B.bufferData(B.ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?B.DYNAMIC_DRAW:B.STATIC_DRAW),this.dynamicDraw||O||f.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(d){const f=this.context.gl;this.bind(),f.bufferSubData(f.ARRAY_BUFFER,0,d.arrayBuffer)}enableAttributes(d,f){for(let j=0;j0&&d.vertexAttribDivisor(O,j)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class m6{constructor(d,f,j,I,O){this.context=d,this.width=f,this.height=j;const F=this.framebuffer=d.gl.createFramebuffer();I>0&&(this.colorAttachment0=new uN(d,F,0)),I>1&&(this.colorAttachment1=new uN(d,F,1)),O&&(this.depthAttachmentType=O,this.depthAttachment=O==="renderbuffer"?new h0(d,F):new Qv(d,F))}createColorAttachment(d,f){f===0?this.colorAttachment0=new uN(d,this.framebuffer,0):f===1&&(this.colorAttachment1=new uN(d,this.framebuffer,1))}removeColorAttachment(d,f){const j=this.context.gl;let I;f===0?(I=this.colorAttachment0.get(),this.colorAttachment0=void 0):f===1&&(I=this.colorAttachment1.get(),this.colorAttachment1=void 0),I&&j.deleteTexture(I)}destroy(){const d=this.context.gl;if(this.colorAttachment0){const f=this.colorAttachment0.get();f&&d.deleteTexture(f)}if(this.colorAttachment1){const f=this.colorAttachment1.get();f&&d.deleteTexture(f)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const f=this.depthAttachment.get();f&&d.deleteRenderbuffer(f)}else{const f=this.depthAttachment.get();f&&d.deleteTexture(f)}d.deleteFramebuffer(this.framebuffer)}}class x0{constructor(d,f){this.gl=d,this.clearColor=new Qie(this),this.clearDepth=new WP(this),this.clearStencil=new _5(this),this.colorMask=new iN(this),this.depthMask=new b5(this),this.stencilMask=new yx(this),this.stencilFunc=new l0(this),this.stencilOp=new Yv(this),this.stencilTest=new c0(this),this.depthRange=new GP(this),this.depthTest=new w5(this),this.depthFunc=new KP(this),this.blend=new d0(this),this.blendFunc=new oN(this),this.blendColor=new lN(this),this.blendEquation=new j5(this),this.cullFace=new cN(this),this.cullFaceSide=new Xv(this),this.frontFace=new ZP(this),this.program=new YP(this),this.activeTexture=new XP(this),this.viewport=new u0(this),this.bindFramebuffer=new QP(this),this.bindRenderbuffer=new Jie(this),this.bindTexture=new eoe(this),this.bindVertexBuffer=new toe(this),this.bindElementBuffer=new k5(this),this.bindVertexArrayOES=new N5(this),this.pixelStoreUnpack=new S5(this),this.pixelStoreUnpackPremultiplyAlpha=new C5(this),this.pixelStoreUnpackFlipY=new JP(this),this.options=f?Object.assign({},f):{},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=f&&!!f.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,f,j){return new Yh(this,d,f,j)}createVertexBuffer(d,f,j,I,O){return new h6(this,d,f,j,I,O)}createRenderbuffer(d,f,j){const I=this.gl,O=I.createRenderbuffer();return this.bindRenderbuffer.set(O),I.renderbufferStorage(I.RENDERBUFFER,d,f,j),this.bindRenderbuffer.set(null),O}createFramebuffer(d,f,j,I){return new m6(this,d,f,j,I)}clear({color:d,depth:f,stencil:j,colorMask:I}){const O=this.gl;let F=0;d&&(F|=O.COLOR_BUFFER_BIT,this.clearColor.set(d.toNonPremultipliedRenderColor(null)),this.colorMask.set(I||[!0,!0,!0,!0])),f!==void 0&&(F|=O.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(f),this.depthMask.set(!0)),j!==void 0&&(F|=O.STENCIL_BUFFER_BIT,this.clearStencil.set(j),this.stencilMask.set(255)),O.clear(F)}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,fn.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 bx;function as(w,d,f,j,I,O,F){const B=w.context,W=B.gl,J=w.transform,te=[i.aF(J.center.lng),i.aJ(J.center.lat)],me=f.layout.get("symbol-placement"),ue=f.layout.get("text-variable-anchor"),pe=f.layout.get("icon-rotation-alignment")==="map",ke=f.layout.get("text-rotation-alignment")==="map",_e=me!=="point",Fe=[];let Re=0,We=0;for(let ht=0;ht0){const Wr=i.bC(),Jr=Mr;i.cP(Wr,Dt.placementInvProjMatrix,J.glCoordMatrix),i.cP(Wr,Wr,Dt.placementViewportMatrix),Fe.push({circleArray:fs,circleOffset:We,transform:Jr,invTransform:Wr,projection:Dt.getProjection()}),Re+=fs.length/4,We=Re}if(!wr)continue;w.terrain&&w.terrain.setupElevationDraw(Rt,Xr);const ls=hr?[Ct.canonical.x,Ct.canonical.y,1<=0&&(pe[at.associatedIconIndex]={x:Dt,y:Yt,z:Xt,angle:er})}else Gh(yt,me)}if(J){ue.clear();const We=w.icon.placedSymbolArray;for(let at=0;at{let ca=[0,0,0];if(Ea){const xn=w.style.directionalLight,xi=w.style.ambientLight;xn&&xi&&(ca=Pp(w.style,xn,xi))}return ca},xa=Ea=>{ht.depthOcclusionForSymbolsAndCircles&&(f.hasOcclusionOpacityProperties||w.terrain)&&(Ea.push("DEPTH_D24"),Ea.push("DEPTH_OCCLUSION"))},tn=Ea=>{f.lut&&!yt&&(f.lut.texture||(f.lut.texture=new i.d$(w.context,f.lut.image,[f.lut.image.height,f.lut.image.height,f.lut.image.height],bt.gl.RGBA8)),bt.activeTexture.set(bt.gl.TEXTURE0+Ol.LUT),f.lut.texture&&f.lut.texture.bind(bt.gl.LINEAR,bt.gl.CLAMP_TO_EDGE),Ea.push("APPLY_LUT_ON_GPU"))},Aa=()=>{const Ea=Ct&&f.layout.get("symbol-placement")!=="point",ca=[];xa(ca),tn(ca);const xn=Ea||an,xi=wr.elevationType==="road",go=w.shadowRenderer,Hi=xi&&Dt&&!!go&&go.enabled,ei=ys(Hi),Cd=xi&&Dt&&!w.terrain?Ht:br,xc=f.paint.get("icon-image-cross-fade");w.terrainRenderModeElevated()&&Dt&&ca.push("PITCH_WITH_MAP_TERRAIN"),fs&&(ca.push("PROJECTION_GLOBE_VIEW"),xn&&ca.push("PROJECTED_POS_ON_VIEWPORT")),xc>0&&wr.hasAnySecondaryIcon&&ca.push("ICON_TRANSITION"),!wr.icon.zOffsetVertexBuffer||xi&&w.terrain||ca.push("Z_OFFSET"),Re===0&&We===0&&at===0&&Ge===1||ca.push("COLOR_ADJUSTMENT"),wr.sdfIcons&&ca.push("RENDER_SDF"),Hi&&ca.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),xi&&Dt&&!w.terrain&&wr.icon.orientationVertexBuffer&&ca.push("ELEVATED_ROADS");const tl=wr.icon.programConfigurations.get(f.id),Dc=w.getOrCreateProgram("symbol",{config:tl,defines:ca}),Rc=Mr.imageAtlasTexture?Mr.imageAtlasTexture.size:[0,0],Kl=wr.iconSizeData,zu=i.bK(Kl,ht.zoom),bh=Dt||!ht.isOrthographic,Yd=ka(Wr,Mr.tileID.canonical,Dt,Ct,ht,wr.getProjection(),Jr),io=cu(Wr,Mr.tileID.canonical,Dt,Ct,ht,wr.getProjection(),Jr),wo=w.translatePosMatrix(io,Mr,B,J,!0),ti=w.translatePosMatrix(Wr,Mr,B,J),Io=xn?n_:Yd,Qi=Ct&&!Dt&&!Ea;let Wi=Ir;!Zt&&!ht.mercatorFromTransition||Ct||(Wi=Op(ht));const wh=fs?Wi:Ir,x_=f.getColorAdjustmentMatrix(Re,We,at,Ge),Jh=bN(Kl.kind,zu,Qi,Dt,w,ti,Io,wo,kt,!1,Rc,[0,0],0,Xr,ls,Et,Kn,wh,wr.getProjection(),ei,Sa,x_,xc,null),y_=Mr.imageAtlasTexture?Mr.imageAtlasTexture:null,S0=f.layout.get("icon-size").constantOr(0)!==1||wr.iconsNeedLinear,Vm=wr.sdfIcons||w.options.rotating||w.options.zooming||S0||bh?ft.LINEAR:ft.NEAREST,Vp=wr.sdfIcons&&f.paint.get("icon-halo-width").constantOr(1)!==0,C0=w.terrain&&Dt&&Ea?i.bl(i.bC(),Yd):n_;if(Ea&&wr.icon){const ug=i.bV.getAtTileOffsetFunc(Xr,ht.center.lat,ht.worldSize,wr.getProjection()),Hp=Wh(Wr,Mr.tileID.canonical,Dt,Ct,ht,wr.getProjection(),Jr),em=f.layout.get("icon-size-scale-range"),Wp=i.aA(w.scaleFactor,em[0],em[1]);RP(wr,Wr,w,!1,Hp,io,Dt,_e,ug,Xr,Wp)}return{program:Dc,buffers:wr.icon,uniformValues:Jh,atlasTexture:y_,atlasTextureIcon:null,atlasInterpolation:Vm,atlasInterpolationIcon:null,isSDF:wr.sdfIcons,hasHalo:Vp,depthMode:Cd,tile:Mr,renderWithShadows:Hi,labelPlaneMatrixInv:C0}},Ha=()=>{const Ea=Rt&&f.layout.get("symbol-placement")!=="point",ca=[],xn=Ea||er||an,xi=wr.elevationType==="road",go=w.shadowRenderer,Hi=xi&&Yt&&!!go&&go.enabled,ei=ys(Hi),Cd=xi&&Yt&&!w.terrain?Ht:br;w.terrainRenderModeElevated()&&Yt&&ca.push("PITCH_WITH_MAP_TERRAIN"),fs&&(ca.push("PROJECTION_GLOBE_VIEW"),xn&&ca.push("PROJECTED_POS_ON_VIEWPORT")),!wr.text.zOffsetVertexBuffer||xi&&w.terrain||ca.push("Z_OFFSET"),wr.iconsInText&&ca.push("RENDER_TEXT_AND_SYMBOL"),ca.push("RENDER_SDF"),Hi&&ca.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),xi&&Yt&&!w.terrain&&wr.text.orientationVertexBuffer&&ca.push("ELEVATED_ROADS"),xa(ca);const xc=wr.text.programConfigurations.get(f.id),tl=w.getOrCreateProgram("symbol",{config:xc,defines:ca});let Dc,Rc=[0,0],Kl=null;const zu=wr.textSizeData;wr.iconsInText&&(Rc=Mr.imageAtlasTexture?Mr.imageAtlasTexture.size:[0,0],Kl=Mr.imageAtlasTexture?Mr.imageAtlasTexture:null,Dc=Yt||!ht.isOrthographic||w.options.rotating||w.options.zooming||zu.kind==="composite"||zu.kind==="camera"?ft.LINEAR:ft.NEAREST);const bh=Mr.glyphAtlasTexture?Mr.glyphAtlasTexture.size:[0,0],Yd=f.layout.get("text-size-scale-range"),io=i.aA(w.scaleFactor,Yd[0],Yd[1]),wo=i.bK(zu,ht.zoom,io),ti=ka(Wr,Mr.tileID.canonical,Yt,Rt,ht,wr.getProjection(),Jr),Io=cu(Wr,Mr.tileID.canonical,Yt,Rt,ht,wr.getProjection(),Jr),Qi=w.translatePosMatrix(Io,Mr,W,te,!0),Wi=w.translatePosMatrix(Wr,Mr,W,te),wh=xn?n_:ti,x_=Rt&&!Yt&&!Ea;let Jh=Ir;!Zt&&!ht.mercatorFromTransition||Rt||(Jh=Op(ht));const y_=bN(zu.kind,wo,x_,Yt,w,Wi,wh,Qi,kt,!0,bh,Rc,0,Xr,ls,Et,Kn,fs?Jh:Ir,wr.getProjection(),ei,Sa,null,null,io),S0=Mr.glyphAtlasTexture?Mr.glyphAtlasTexture:null,Vm=ft.LINEAR,Vp=f.paint.get("text-halo-width").constantOr(1)!==0,C0=w.terrain&&Yt&&Ea?i.bl(i.bC(),ti):n_;if(Ea&&wr.text){const ug=i.bV.getAtTileOffsetFunc(Xr,ht.center.lat,ht.worldSize,wr.getProjection()),Hp=Wh(Wr,Mr.tileID.canonical,Yt,Rt,ht,wr.getProjection(),Jr);RP(wr,Wr,w,!0,Hp,Io,Yt,Fe,ug,Xr,io)}return{program:tl,buffers:wr.text,uniformValues:y_,atlasTexture:S0,atlasTextureIcon:Kl,atlasInterpolation:Vm,atlasInterpolationIcon:Dc,isSDF:!0,hasHalo:Vp,depthMode:Cd,tile:Mr,renderWithShadows:Hi,labelPlaneMatrixInv:C0}},Fa=wr.icon.segments.get().length,fa=wr.text.segments.get().length,gn=Fa&&!F.onlyText?Aa():null,Ma=fa&&!F.onlyIcons?Ha():null,Xi=f.paint.get("icon-opacity").constantOr(1),Ti=f.paint.get("text-opacity").constantOr(1);if(Xt&&wr.canOverlap){lr=!0;const Ea=Xi&&!F.onlyText?wr.icon.segments.get():[],ca=Ti&&!F.onlyIcons?wr.text.segments.get():[];for(const xn of Ea)hr.push({segments:new i.bg([xn]),sortKey:xn.sortKey,state:gn});for(const xn of ca)hr.push({segments:new i.bg([xn]),sortKey:xn.sortKey,state:Ma})}else F.onlyText||hr.push({segments:Xi?wr.icon.segments:new i.bg([]),sortKey:0,state:gn}),F.onlyIcons||hr.push({segments:Ti?wr.text.segments:new i.bg([]),sortKey:0,state:Ma})}lr&&hr.sort((Xr,Mr)=>Xr.sortKey-Mr.sortKey);for(const Xr of hr){const Mr=Xr.state;if(Mr)if(w.terrain?w.terrain.setupElevationDraw(Mr.tile,Mr.program,{useDepthForOcclusion:ht.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Mr.labelPlaneMatrixInv}):w.setupDepthForOcclusion(ht.depthOcclusionForSymbolsAndCircles,Mr.program),bt.activeTexture.set(ft.TEXTURE0),Mr.atlasTexture&&Mr.atlasTexture.bind(Mr.atlasInterpolation,ft.CLAMP_TO_EDGE,!0),Mr.atlasTextureIcon&&(bt.activeTexture.set(ft.TEXTURE1),Mr.atlasTextureIcon&&Mr.atlasTextureIcon.bind(Mr.atlasInterpolationIcon,ft.CLAMP_TO_EDGE,!0)),Mr.renderWithShadows&&w.shadowRenderer.setupShadows(Mr.tile.tileID.toUnwrapped(),Mr.program,"vector-tile"),w.uploadCommonLightUniforms(w.context,Mr.program),Mr.hasHalo){const wr=Mr.uniformValues;wr.u_is_halo=1,z5(Mr.buffers,Xr.segments,f,w,Mr.program,Mr.depthMode,I,O,wr,2),wr.u_is_halo=0}else{if(Mr.isSDF){const wr=Mr.uniformValues;Mr.hasHalo&&(wr.u_is_halo=1,z5(Mr.buffers,Xr.segments,f,w,Mr.program,Mr.depthMode,I,O,wr,1)),wr.u_is_halo=0}z5(Mr.buffers,Xr.segments,f,w,Mr.program,Mr.depthMode,I,O,Mr.uniformValues,1)}}}function z5(w,d,f,j,I,O,F,B,W,J){const te=[w.dynamicLayoutVertexBuffer,w.opacityVertexBuffer,w.iconTransitioningVertexBuffer,w.globeExtVertexBuffer,w.zOffsetVertexBuffer,w.orientationVertexBuffer];I.draw(j,j.context.gl.TRIANGLES,O,F,B,Vs.disabled,W,f.id,w.layoutVertexBuffer,w.indexBuffer,d,f.paint,j.transform.zoom,w.programConfigurations.get(f.id),te,J)}function p6(w,d){const f=1<=Zh?1:pe.pitch/Zh))),2*ke}(w.transform),J=w.transform.getFreeCameraOptions().position,te="elevatedStructuresDepthReconstruct",me=w.getOrCreateProgram(te,{defines:["DEPTH_RECONSTRUCTION"]}),ue=w.getOrCreateProgram(te);for(const pe of j){const ke=d.getTile(pe),_e=ke.getBucket(f);if(!_e)continue;const Fe=_e.elevatedStructures;if(!Fe)continue;const Re=_e.elevationBufferData.heightRange,We=p6(pe.toUnwrapped(),J),at=w.translatePosMatrix(pe.projMatrix,ke,f.paint.get("fill-translate"),f.paint.get("fill-translate-anchor"));let Ge,kt,yt,bt;if(I==="initialize"){if(!Re||Re.min>=1||Fe.depthSegments.segments[0].primitiveLength===0)continue;Ge=vx(at,We,W,1,0),kt=F,yt=Fe.depthSegments,bt=me}else if(I==="reset"){if(!Re||Re.min>=0||Fe.maskSegments.segments[0].primitiveLength===0)continue;Ge=vx(at,We,0,0,1),kt=B,yt=Fe.maskSegments,bt=me}else if(I==="geometry"){if(Fe.depthSegments.segments[0].primitiveLength===0)continue;Ge=vx(at,We,W,1,0),kt=F,yt=Fe.depthSegments,bt=ue}bt.draw(w,O.TRIANGLES,kt,Gs.disabled,fn.disabled,Vs.disabled,Ge,f.id,Fe.vertexBuffer,Fe.indexBuffer,yt,f.paint,w.transform.zoom)}}function kN(w,d,f,j){const{painter:I,sourceCache:O,layer:F,coords:B,colorMode:W,elevationType:J,terrainEnabled:te,pass:me}=w,ue=I.context.gl,pe=F.paint.get("fill-pattern"),ke=F.paint.get("fill-pattern-cross-fade"),_e=pe.constantOr(null);let Fe=J;J!=="road"||d&&!te||(Fe="none");const Re=Fe==="road",We=w.painter.shadowRenderer,at=Re&&!!We&&We.enabled,Ge=new _s(I.context.gl.LEQUAL,_s.ReadOnly,I.depthRangeFor3D);let kt=[0,0,0];if(at){const ht=I.style.directionalLight,Ct=I.style.ambientLight;ht&&Ct&&(kt=Pp(I.style,ht,Ct))}const yt=pe&&pe.constantOr(1),bt=I.terrain&&I.terrain.renderingToTexture,ft=(ht,Ct)=>{let Rt,Dt,Yt,Xt,lr;Ct?(Rt=yt&&!F.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Yt=ue.LINES):(Rt=yt?"fillPattern":"fill",Yt=ue.TRIANGLES);for(const br of B){const Ht=O.getTile(br);if(yt&&!Ht.patternsLoaded())continue;const Et=Ht.getBucket(F);if(!Et)continue;const er=d?Et.elevationBufferData:Et.bufferData;if(er.isEmpty())continue;I.prepareDrawTile();const Zt=er.programConfigurations.get(F.id),hr=I.isTileAffectedByFog(br),Ir=[],Xr=[];Re&&(Ir.push("ELEVATED_ROADS"),Xr.push(er.elevatedLayoutVertexBuffer)),at&&Ir.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),bt&&f&&Ir.push("USE_MRT1"),yt&&(I.context.activeTexture.set(ue.TEXTURE0),Ht.imageAtlasTexture&&Ht.imageAtlasTexture.bind(ue.LINEAR,ue.CLAMP_TO_EDGE),Zt.updatePaintBuffers());let Mr=!1;if(_e&&Ht.imageAtlas){const Jr=Ht.imageAtlas,As=i.e3.from(_e),an=As.getPrimary().scaleSelf(i.o.devicePixelRatio).toString(),Kn=As.getSecondary(),Sa=Jr.patternPositions.get(an),ys=Kn?Jr.patternPositions.get(Kn.scaleSelf(i.o.devicePixelRatio).toString()):null;Mr=!!Sa&&!!ys,Sa&&Zt.setConstantPatternPositions(Sa,ys)}ke>0&&(Mr||Zt.getPatternTransitionVertexBuffer("fill-pattern"))&&Ir.push("FILL_PATTERN_TRANSITION");const wr=I.getOrCreateProgram(Rt,{config:Zt,overrideFog:hr,defines:Ir}),fs=I.translatePosMatrix(br.projMatrix,Ht,F.paint.get("fill-translate"),F.paint.get("fill-translate-anchor"));at&&We.setupShadows(Ht.tileID.toUnwrapped(),wr,"vector-tile");const ls=F.paint.get("fill-emissive-strength");if(Ct){Xt=er.lineIndexBuffer,lr=er.lineSegments;const Jr=I.terrain&&I.terrain.renderingToTexture?I.terrain.drapeBufferSize:[ue.drawingBufferWidth,ue.drawingBufferHeight];Dt=Rt==="fillOutlinePattern"&&yt?O5(fs,ls,I,Ht,Jr,kt,ke):n6(fs,ls,Jr,kt)}else Xt=er.indexBuffer,lr=er.triangleSegments,Dt=yt?L5(fs,ls,I,Ht,kt,ke):P5(fs,ls,kt);I.uploadCommonUniforms(I.context,wr,br.toUnwrapped());let Wr=ht;(J==="road"&&!te||J==="offset")&&(Wr=Ge),wr.draw(I,Yt,Wr,j||I.stencilModeForClipping(br),W,Vs.disabled,Dt,F.id,er.layoutVertexBuffer,Xt,lr,F.paint,I.transform.zoom,Zt,Xr)}};I.renderPass===me&&ft(I.depthModeForSublayer(1,I.renderPass==="opaque"?_s.ReadWrite:_s.ReadOnly),!1),Fe==="none"&&I.renderPass==="translucent"&&F.paint.get("fill-antialias")&&ft(I.depthModeForSublayer(F.getPaintProperty("fill-outline-color")?2:0,_s.ReadOnly),!0)}function NN(w,d,f,j,I,O,F,B){f.resetLayerRenderingStats(w);const W=w.context,J=W.gl,te=w.transform,me=f.paint.get("fill-extrusion-pattern"),ue=f.paint.get("fill-extrusion-pattern-cross-fade"),pe=me.constantOr(null),ke=me.constantOr(1),_e=f.paint.get("fill-extrusion-opacity"),Fe=w.style.enable3dLights(),Re=f.paint.get(Fe&&!ke?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),We=[f.paint.get("fill-extrusion-ambient-occlusion-intensity"),Re],at=f.layout.get("fill-extrusion-edge-radius"),Ge=at>0&&!f.paint.get("fill-extrusion-rounded-roof"),kt=Ge?0:at,yt=te.projection.name==="globe"?i.eb():0,bt=te.projection.name==="globe",ft=bt?i.aj(te.zoom):0,ht=[i.aF(te.center.lng),i.aJ(te.center.lat)],Ct=f.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",Rt=f.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(Ct?null:f.lut).toArray01().slice(0,3),Dt=f.paint.get("fill-extrusion-flood-light-intensity"),Yt=f.paint.get("fill-extrusion-vertical-scale"),Xt=f.paint.get("fill-extrusion-line-width").constantOr(1)!==0,lr=f.paint.get("fill-extrusion-height-alignment"),br=f.paint.get("fill-extrusion-base-alignment"),Ht=Xf(w,f.paint.get("fill-extrusion-cutoff-fade-range")),Et=[];let er;bt&&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"),Ht.shouldRenderCutoff&&Et.push("RENDER_CUTOFF"),Xt&&Et.push("RENDER_WALL_MODE");const Zt=w.renderPass==="shadow",hr=w.shadowRenderer,Ir=Zt&&!!hr,Xr=Zt?Vs.disabled:Vs.backCCW;w.shadowRenderer&&(w.shadowRenderer.useNormalOffset=!0);let Mr=[0,0,0];if(hr){const ls=w.style.directionalLight,Wr=w.style.ambientLight;ls&&Wr&&(Mr=Pp(w.style,ls,Wr)),Zt||(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",fs=f.getLayerRenderingStats();for(const ls of j){const Wr=d.getTile(ls),Jr=Wr.getBucket(f);if(!Jr||Jr.projection.name!==te.projection.name)continue;let As=!1;hr&&(As=hr.getMaxCascadeForTile(ls.toUnwrapped())===0);const an=w.isTileAffectedByFog(ls),Kn=Jr.programConfigurations.get(f.id);let Sa=!1;if(pe&&Wr.imageAtlas){const fa=Wr.imageAtlas,gn=i.e3.from(pe),Ma=gn.getPrimary().scaleSelf(i.o.devicePixelRatio).toString(),Xi=gn.getSecondary(),Ti=fa.patternPositions.get(Ma),Ea=Xi?fa.patternPositions.get(Xi.scaleSelf(i.o.devicePixelRatio).toString()):null;Sa=!!Ti&&!!Ea,Ti&&Kn.setConstantPatternPositions(Ti,Ea)}ue>0&&(Sa||Kn.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&Et.push("FILL_EXTRUSION_PATTERN_TRANSITION");const ys=w.getOrCreateProgram(wr,{config:Kn,defines:As?er:Et,overrideFog:an});if(w.terrain&&w.terrain.setupElevationDraw(Wr,ys,{useMeterToDem:!0}),!Jr.centroidVertexBuffer){const fa=ys.getAttributeLocation(J,"a_centroid_pos");fa!==-1&&J.vertexAttrib2f(fa,0,0)}!Zt&&hr&&hr.setupShadows(Wr.tileID.toUnwrapped(),ys,"vector-tile"),ke&&(w.context.activeTexture.set(J.TEXTURE0),Wr.imageAtlasTexture&&Wr.imageAtlasTexture.bind(J.LINEAR,J.CLAMP_TO_EDGE),Kn.updatePaintBuffers());const xa=f.paint.get("fill-extrusion-vertical-gradient"),tn=1/Jr.tileToMeter;let Aa;if(Zt&&hr){if(Rp(Wr.tileID,Jr.maxHeight,w))continue;const fa=hr.calculateShadowPassMatrixFromTile(Wr.tileID.toUnwrapped());Aa=I5(fa,kt,tn,Yt,lr,br)}else{const fa=w.translatePosMatrix(ls.expandedProjMatrix,Wr,f.paint.get("fill-extrusion-translate"),f.paint.get("fill-extrusion-translate-anchor")),gn=te.projection.createInversionMatrix(te,ls.canonical);Aa=ke?s6(fa,w,xa,_e,We,kt,tn,ls,Wr,yt,lr,br,ft,ht,gn,Rt,Yt,ue):xN(fa,w,xa,_e,We,kt,tn,ls,yt,lr,br,ft,ht,gn,Rt,Yt,Dt,Mr)}w.uploadCommonUniforms(W,ys,ls.toUnwrapped(),null,Ht);let Ha=Jr.segments;if(te.projection.name==="mercator"&&!Zt&&(Ha=Jr.getVisibleSegments(Wr.tileID,w.terrain,w.transform.getFrustum(0)),!Ha.get().length))continue;if(fs)if(Zt)for(const fa of Ha.get())fs.numRenderedVerticesInShadowPass+=fa.primitiveLength;else for(const fa of Ha.get())fs.numRenderedVerticesInTransparentPass+=fa.primitiveLength;const Fa=[];(w.terrain||B)&&Fa.push(Jr.centroidVertexBuffer),bt&&Fa.push(Jr.layoutVertexExtBuffer),Xt&&Fa.push(Jr.wallVertexBuffer),ys.draw(w,W.gl.TRIANGLES,I,O,F,Xr,Aa,f.id,Jr.layoutVertexBuffer,Jr.indexBuffer,Ha,f.paint,w.transform.zoom,Kn,Fa)}w.shadowRenderer&&(w.shadowRenderer.useNormalOffset=!1)}class B5{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function Dp(w,d,f,j,I,O,F,B,W,J,te,me,ue,pe,ke,_e,Fe,Re,We,at){const Ge=d.context,kt=Ge.gl,yt=d.transform,bt=d.transform.zoom,ft=[],ht=w.translate,Ct=w.translateAnchor,Rt=w.edgeRadius,Dt=Xf(d,w.cutoffFadeRange);te==="clear"?(ft.push("CLEAR_SUBPASS"),at&&(ft.push("CLEAR_FROM_TEXTURE"),Ge.activeTexture.set(kt.TEXTURE0),at.bind(kt.LINEAR,kt.CLAMP_TO_EDGE))):te==="sdf"?ft.push("SDF_SUBPASS"):te==="emissive"&&(ft.push("USE_MRT1"),Ge.activeTexture.set(kt.TEXTURE0),at.bind(kt.LINEAR,kt.CLAMP_TO_EDGE)),Re&&ft.push("HAS_CENTROID"),Dt.shouldRenderCutoff&&ft.push("RENDER_CUTOFF");const Yt=(Xt,lr,br,Ht,Et)=>{let er=ft;lr.groundRadiusBuffer!=null&&(er=ft.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const Zt=lr.programConfigurations.get(j.id),hr=d.isTileAffectedByFog(Xt),Ir=d.getOrCreateProgram("fillExtrusionGroundEffect",{config:Zt,defines:er,overrideFog:hr}),Xr=f0(d,Ht,me,J,Et,[ue,pe*Et],ke,_e,Fe,bt>=17?0:Rt*Et,at?at.size[0]:0),Mr=[];Re&&Mr.push(lr.hiddenByLandmarkVertexBuffer),lr.groundRadiusBuffer!=null&&Mr.push(lr.groundRadiusBuffer),d.uploadCommonUniforms(Ge,Ir,Xt.toUnwrapped(),null,Dt),Ir.draw(d,Ge.gl.TRIANGLES,O,F,B,W,Xr,j.id,lr.vertexBuffer,lr.indexBuffer,br,j.paint,bt,Zt,Mr)};for(const Xt of I){const lr=f.getTile(Xt),br=lr.getBucket(j);if(!br||br.projection.name!==yt.projection.name||!br.groundEffect||br.groundEffect&&!br.groundEffect.hasData())continue;const Ht=br.groundEffect,Et=1/br.tileToMeter;{const er=d.translatePosMatrix(Xt.projMatrix,lr,ht,Ct),Zt=Ht.getDefaultSegment();Yt(Xt,Ht,Zt,er,Et)}if(We)for(let er=0;er<4;er++){const Zt=i.e9[er](Xt),hr=f.getTile(Zt);if(!hr)continue;const Ir=hr.getBucket(j);if(!Ir||Ir.projection.name!==yt.projection.name||!Ir.groundEffect||Ir.groundEffect&&!Ir.groundEffect.hasData())continue;const Xr=Ir.groundEffect;let Mr,wr;er===0?(Mr=[-i.al,0,0],wr=1):er===1?(Mr=[i.al,0,0],wr=0):er===2?(Mr=[0,-i.al,0],wr=3):(Mr=[0,i.al,0],wr=2);const fs=Xr.regionSegments[wr];if(!fs)continue;const ls=new Float32Array(16);i.br(ls,Xt.projMatrix,Mr),Yt(Xt,Xr,fs,d.translatePosMatrix(ls,lr,ht,Ct),Et)}}}function ooe(w,d,f,j,I,O,F){j.centroidVertexArray.length===0&&j.createCentroidsBuffer();const B=O?O.findDEMTileFor(f):null;if(!(B&&B.dem||F))return;O&&B&&B.dem&&j.selfDEMTileTimestamp!==B.dem._timestamp&&(j.borderDoneWithNeighborZ=[-1,-1,-1,-1],j.selfDEMTileTimestamp=B.dem._timestamp);const W=Re=>new i.P(Math.ceil((Re+i.ed)*i.ee),0),J=Re=>{const We=d.getSource().minzoom,at=kt=>{const yt=d.getTileByID(kt);if(yt&&yt.hasData())return yt.getBucket(I)},Ge=[0,-1,1];for(const kt of Ge){if(Re.overscaledZ+kt(te[0]=Math.min(Re.min.y,We.min.y),te[1]=Math.max(Re.max.y,We.max.y),te[2]=i.al-We.min.x>Re.max.x?We.min.x-i.al:Re.max.x,te),ue=(Re,We)=>(te[0]=Math.min(Re.min.x,We.min.x),te[1]=Math.max(Re.max.x,We.max.x),te[2]=i.al-We.min.y>Re.max.y?We.min.y-i.al:Re.max.y,te),pe=[(Re,We)=>me(Re,We),(Re,We)=>me(We,Re),(Re,We)=>ue(Re,We),(Re,We)=>ue(We,Re)],ke=(Re,We,at,Ge,kt,yt,bt)=>{if(!O)return 0;const ft=[[yt?at:Re,yt?Re:at,0],[yt?at:We,yt?We:at,0]],ht=bt<0?i.al+bt:bt,Ct=[yt?ht:(Re+We)/2,yt?(Re+We)/2:ht,0];return at===0&&bt<0||at!==0&&bt>0?O.getForTilePoints(kt,[Ct],!0,Ge):ft.push(Ct),O.getForTilePoints(f,ft,!0,B),Math.max(ft[0][2],ft[1][2],Ct[2])/O.exaggeration()};for(let Re=0;Re<4;Re++){const We=j.borderFeatureIndices[Re];if(We.length===0)continue;const at=i.e9[Re](f),Ge=J(at);if(!(Ge&&Ge instanceof i.ea))continue;const kt=O?O.findDEMTileFor(at):null;if(!(kt&&kt.dem||F)||(O&&kt&&kt.dem&&j.borderDEMTileTimestamp[Re]!==kt.dem._timestamp&&(j.borderDoneWithNeighborZ[Re]=-1,j.borderDEMTileTimestamp[Re]=kt.dem._timestamp),j.borderDoneWithNeighborZ[Re]===Ge.canonical.z))continue;Ge.centroidVertexArray.length===0&&Ge.createCentroidsBuffer();const yt=(Re<2?1:5)-Re,bt=Ge.borderDoneWithNeighborZ[yt]!==j.canonical.z,ft=Ge.borderFeatureIndices[yt];let ht=0;if(j.canonical.z!==Ge.canonical.z){for(const Ct of We)j.showCentroid(j.featuresOnBorder[Ct]);if(bt)for(const Ct of ft)Ge.showCentroid(Ge.featuresOnBorder[Ct]);j.borderDoneWithNeighborZ[Re]=Ge.canonical.z,Ge.borderDoneWithNeighborZ[yt]=j.canonical.z}for(const Ct of We){const Rt=j.featuresOnBorder[Ct],Dt=j.centroidData[Rt.centroidDataIndex],Yt=Rt.borders[Re];let Xt;for(;htYt[0]+3||lr[0]>Yt[0]-3)break;Ge.showCentroid(Xt),ht++}if(Xt&&htYt[1]-3)&&(br++,++ht!==ft.length);)Xt=Ge.featuresOnBorder[ft[ht]];Xt=Ge.featuresOnBorder[ft[lr]];let Ht=!1;if(br>=1){const Zt=Xt.borders[yt];Math.abs(Yt[0]-Zt[0])<3&&Math.abs(Yt[1]-Zt[1])<3&&(br=1,Ht=!0,ht=lr+1)}else if(br===0){j.showCentroid(Rt);continue}const Et=Ge.centroidData[Xt.centroidDataIndex];F&&Ht&&(((_e=Dt).flags|(Fe=Et).flags)&i.ec?(_e.flags|=i.ec,Fe.flags|=i.ec):(_e.flags&=~i.ec,Fe.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(kt&&kt.dem&&!er){const Zt=pe[Re](Dt,Et),hr=Re%2?i.al-1:0,Ir=ke(Zt[0],Math.min(i.al-1,Zt[1]),hr,kt,at,Re<2,Zt[2]);Dt.centroidXY=Et.centroidXY=W(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[Re]=Ge.canonical.z,Ge.borderDoneWithNeighborZ[yt]=j.canonical.z}var _e,Fe;(j.needsCentroidUpdate||!j.centroidVertexBuffer&&j.centroidVertexArray.length!==0)&&j.uploadCentroid(w)}const du=[1,0,0],$5=[0,1,0],Nd=[0,0,1];function Rp(w,d,f){const j=f.transform,I=f.shadowRenderer;if(!I)return!0;const O=w.toUnwrapped(),F=j.tileSize*I._cascades[f.currentShadowCascade].scale;let B=d;if(j.elevation){const _e=j.elevation.getMinMaxForTile(w);_e&&(B+=_e.max)}const W=[...I.shadowDirection];W[2]=-W[2];const J=I.computeSimplifiedTileShadowVolume(O,B,F,W);if(!J)return!1;const te=[du,$5,Nd,W,[W[0],0,W[2]],[0,W[1],W[2]]],me=j.projection.name==="globe",ue=j.scaleZoom(F),pe=i.cB.fromInvProjectionMatrix(j.invProjMatrix,j.worldSize,ue,!me),ke=I.getCurrentCascadeFrustum();return pe.intersectsPrecise(J.vertices,J.planes,te)===0||ke.intersectsPrecise(J.vertices,J.planes,te)===0}function i_(w){const{painter:d,source:f,layer:j,coords:I}=w;let O=w.defines;const F=d.context,B=d.renderPass==="shadow",W=d.renderPass==="light-beam",J=d.shadowRenderer,te=i.ef(d.transform.center.lat,d.transform.zoom),me=Xf(d,j.paint.get("building-cutoff-fade-range"));me.shouldRenderCutoff&&(O=O.concat("RENDER_CUTOFF")),w.floodLightIntensity>0&&(O=O.concat("FLOOD_LIGHT"));for(const ue of I){const pe=f.getTile(ue),ke=pe.getBucket(j);if(!ke)continue;J&&J.getMaxCascadeForTile(ue.toUnwrapped())===0&&(O=O.concat("SHADOWS_SINGLE_CASCADE"));const _e=ke.programConfigurations.get(j.id);let Fe,Re,We,at=d.translatePosMatrix(ue.expandedProjMatrix,pe,[0,0],"map");if(at=i.cS(i.bC(),at,[1,1,w.verticalScale]),B&&J){if(Rp(pe.tileID,ke.maxHeight*te,d))continue;let kt=J.calculateShadowPassMatrixFromTile(pe.tileID.toUnwrapped());kt=i.cS(i.bC(),kt,[1,1,w.verticalScale]),We=ng(kt),Fe=Re=d.getOrCreateProgram("buildingDepth",{config:_e,defines:O,overrideFog:!1})}else if(W)Fe=Re=d.getOrCreateProgram("buildingBloom",{config:_e,defines:O,overrideFog:!1}),We=a6(at);else{const kt=d.transform.calculatePosMatrix(ue.toUnwrapped(),d.transform.worldSize);i.cS(kt,kt,[1,1,w.verticalScale]);const yt=i.bC();i.cS(yt,kt,[1,-1,1/te]),i.bl(yt,yt),i.eg(yt,yt);const bt=d.transform.getFreeCameraOptions().position,ft=1<{if(W){const bt=kt.entranceBloom;yt.draw(d,F.gl.TRIANGLES,w.depthMode,Gs.disabled,w.blendMode,Vs.disabled,We,j.id,bt.layoutVertexBuffer,bt.indexBuffer,bt.segmentsBucket,j.paint,d.transform.zoom,_e,[bt.layoutAttenuationBuffer,bt.layoutColorBuffer])}else{const bt=kt.segmentsBucket;let ft=[kt.layoutNormalBuffer,kt.layoutCentroidBuffer,kt.layoutColorBuffer,kt.layoutFloodLightDataBuffer];kt.layoutFacadePaintBuffer&&(ft=ft.concat([kt.layoutFacadeDataBuffer,kt.layoutFacadeVerticalRangeBuffer,kt.layoutFacadePaintBuffer])),yt.draw(d,F.gl.TRIANGLES,w.depthMode,Gs.disabled,w.blendMode,B?Vs.disabled:Vs.backCW,We,j.id,kt.layoutVertexBuffer,kt.indexBuffer,bt,j.paint,d.transform.zoom,_e,ft)}};d.uploadCommonUniforms(F,Re,ue.toUnwrapped(),null,me),ke.buildingWithoutFacade&&Ge(ke.buildingWithoutFacade,Re),ke.buildingWithFacade&&(Fe!==Re&&d.uploadCommonUniforms(F,Fe,ue.toUnwrapped(),null,me),Ge(ke.buildingWithFacade,Fe))}}function SN(w,d,f,j,I,O,F,B,W,J,te,me,ue){const pe=w.context.gl,ke=w.depthModeForSublayer(1,_s.ReadOnly,pe.LEQUAL,!0),_e=.1*(1-(Fe=te))+3*Fe;var Fe;const Re=w._showOverdrawInspector,We=me,at=new B5;Re||Dp(at,w,d,f,j,ke,new Gs({func:pe.ALWAYS,mask:255},255,255,pe.KEEP,pe.KEEP,pe.REPLACE),new fn([pe.ONE,pe.ONE,pe.ONE,pe.ONE],i.ao.transparent,[!1,!1,!1,!0],pe.MIN),Vs.disabled,I,"sdf",O,F,B,W,J,_e,We,!1);{const Ge=Re?Gs.disabled:new Gs({func:pe.EQUAL,mask:255},255,255,pe.KEEP,pe.DECR,pe.DECR),kt=Re?w.colorModeForRenderPass():new fn([pe.ONE_MINUS_DST_ALPHA,pe.DST_ALPHA,pe.ONE,pe.ONE],i.ao.transparent,[!0,!0,!0,!0]);Dp(at,w,d,f,j,ke,Ge,kt,Vs.disabled,I,"color",O,F,B,W,J,_e,We,!1)}}function CN(w){return[w[0]*i.eh,w[1]*i.eh,w[2]*i.eh,0]}function o_(w,d,f,j,I,O,F,B,W){const J=j.getSource(),te=f.globeSharedBuffers;if(!te)return;let me,ue,pe;if(d&&(me=j.getTile(d)),J instanceof i.aU?(ue=J.texture,pe=i.dK(0,0,f.transform)):me&&d&&(ue=me.texture,pe=i.dK(d.canonical.z,d.canonical.x,f.transform)),!ue||!pe)return;w||(pe=i.cS(i.bC(),pe,[1,-1,1]));const ke=f.context,_e=ke.gl,Fe=I.paint.get("raster-resampling")==="nearest"?_e.NEAREST:_e.LINEAR,Re=f.colorModeForDrapableLayerRenderPass(O),We=F.defines;We.push("GLOBE_POLES");const at=new _s(_e.LEQUAL,_s.ReadWrite,f.depthRangeFor3D),Ge=Float32Array.from(f.transform.expandedFarZProjMatrix),kt=Float32Array.from(i.bk(i.dJ(new i.cD(0,0,0))));f.terrain&&f.terrain.prepareDrawTile(),ke.activeTexture.set(_e.TEXTURE0),ue.bind(Fe,_e.CLAMP_TO_EDGE),ke.activeTexture.set(_e.TEXTURE1),ue.bind(Fe,_e.CLAMP_TO_EDGE),"useMipmap"in ue&&ke.extTextureFilterAnisotropic&&f.transform.pitch>20&&_e.texParameterf(_e.TEXTURE_2D,ke.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,ke.extTextureFilterAnisotropicMax);const[yt,bt,ft,ht]=d?te.getPoleBuffers(d.canonical.z,!1):te.getPoleBuffers(0,!0),Ct=I.paint.get("raster-elevation");let Rt;w?(Rt=yt,f.renderDefaultNorthPole=Ct!==0):(Rt=bt,f.renderDefaultSouthPole=Ct!==0);const Dt=CN(F.mix),Yt=((lr,br,Ht,Et,er,Zt,hr,Ir,Xr,Mr,wr,fs,ls)=>l6(lr,br,Ht,new Float32Array(16),new Float32Array(9),[0,0],Et,[0,0],[0,0,0,0],1,{opacity:1,mix:0},Zt,[0,0],Ir,2,Mr,wr,fs,1,0,ls))(Ge,kt,pe,i.aj(f.transform.zoom),0,I,0,Ct,0,Dt,F.offset,F.range,O),Xt=f.getOrCreateProgram("raster",{defines:We});f.uploadCommonUniforms(ke,Xt,null),Xt.draw(f,_e.TRIANGLES,at,W,Re,B,Yt,I.id,Rt,ft,ht)}function f6(w){const d=w._nearZ,f=w.projection.farthestPixelDistance(w),j=f-d,I=.2*w.height,O=d+I;return[d,f,(O-I-d)/j,(O-d)/j]}function Fp(w,d,f,j){if(w)return d instanceof fc&&w instanceof Jy?d.getTextureDescriptor(w,f,!0):{texture:w.texture,mix:CN(j.mix),offset:j.offset,buffer:0,tileSize:1}}var di=i.ei([{name:"a_index",type:"Int16",components:1}]);class MN{constructor(d,f,j,I){const O={width:j[0],height:j[1],data:null},F=d.gl;this.targetColorTexture=new i.T(d,O,F.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new i.T(d,O,F.RGBA8,{useMipmap:!1}),this.context=d,this.updateParticleTexture(f,I),this.lastInvalidatedAt=0}updateParticleTexture(d,f){if(this.particleTextureDimension===f.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,I=f.width*f.height;this.particleTexture0=new i.T(this.context,f,j.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new i.T(this.context,f,j.RGBA8,{premultiply:!1,useMipmap:!1});const O=new i.ej;O.reserve(I);for(let F=0;F0){const Dt=i.bj(f.canonical,W),Yt=i.el(Dt);ue=i.aB(new Float32Array(16),W.globeMatrix,Yt),i.aB(ue,W.projMatrix,ue)}const pe=i.bC();pe[12]+=2*I/(i.o.devicePixelRatio*W.width),pe[13]+=2*O/(i.o.devicePixelRatio*W.height),i.aB(ue,pe,ue);const ke=w.getOrCreateProgram("debug",{defines:me}),_e=d.getTileByID(f.key);w.terrain&&w.terrain.setupElevationDraw(_e,ke);const Fe=_s.disabled,Re=Gs.disabled,We=w.colorModeForRenderPass(),at="$debug";B.activeTexture.set(J.TEXTURE0),w.emptyTexture.bind(J.LINEAR,J.CLAMP_TO_EDGE),te?_e._makeGlobeTileDebugBuffers(w.context,W):_e._makeDebugTileBoundsBuffers(w.context,W.projection);const Ge=_e._tileDebugBuffer||w.debugBuffer,kt=_e._tileDebugIndexBuffer||w.debugIndexBuffer,yt=_e._tileDebugSegments||w.debugSegments;if(ke.draw(w,J.LINE_STRIP,Fe,Re,We,Vs.disabled,r_(ue,j.toPremultipliedRenderColor(null)),at,Ge,kt,yt,null,null,null,[_e._globeTileDebugBorderBuffer]),F){const Dt=_e.latestRawTileData,Yt=Math.floor((Dt&&Dt.byteLength||0)/1024);let Xt=f.canonical.toString();f.overscaledZ!==f.canonical.z&&(Xt+=` => ${f.overscaledZ}`),Xt+=` ${_e.state}`,Xt+=` ${Yt}kb`,function(lr,br){lr.initDebugOverlayCanvas();const Ht=lr.debugOverlayCanvas,Et=lr.context.gl,er=lr.debugOverlayCanvas.getContext("2d");er.clearRect(0,0,Ht.width,Ht.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(Ht),lr.debugOverlayTexture.bind(Et.LINEAR,Et.CLAMP_TO_EDGE)}(w,Xt)}const bt=d.getTile(f).tileSize,ft=512/Math.min(bt,512)*(f.overscaledZ/W.zoom)*.5,ht=_e._tileDebugTextBuffer||w.debugBuffer,Ct=_e._tileDebugTextIndexBuffer||w.quadTriangleIndexBuffer,Rt=_e._tileDebugTextSegments||w.debugSegments;ke.draw(w,J.TRIANGLES,Fe,Re,fn.alphaBlended,Vs.disabled,r_(ue,i.ao.transparent.toPremultipliedRenderColor(null),ft),at,ht,Ct,Rt,null,null,null,[_e._globeTileDebugTextBuffer])}function kx(w,d,f,j){Bt(w,0,d+f/2,w.transform.width,f,j)}function ao(w,d,f,j){Bt(w,d-f/2,0,f,w.transform.height,j)}function Bt(w,d,f,j,I,O){const F=w.context,B=F.gl;B.enable(B.SCISSOR_TEST),B.scissor(d*i.o.devicePixelRatio,f*i.o.devicePixelRatio,j*i.o.devicePixelRatio,I*i.o.devicePixelRatio),F.clear({color:O}),B.disable(B.SCISSOR_TEST)}const _6=i.ei([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:TN}=_6;function Bm(w,d,f,j){w.emplaceBack(d,f,j)}class AN{constructor(d){this.vertexArray=new i.em,this.indices=new i.b0,Bm(this.vertexArray,-1,-1,1),Bm(this.vertexArray,1,-1,1),Bm(this.vertexArray,-1,1,1),Bm(this.vertexArray,1,1,1),Bm(this.vertexArray,-1,-1,-1),Bm(this.vertexArray,1,-1,-1),Bm(this.vertexArray,-1,1,-1),Bm(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,TN),this.indexBuffer=d.createIndexBuffer(this.indices),this.segment=i.bg.simpleSegment(0,0,36,12)}}function Nx(w,d,f,j,I,O){const F=w.context.gl,B=d.paint.get("sky-atmosphere-color"),W=d.paint.get("sky-atmosphere-halo-color"),J=d.paint.get("sky-atmosphere-sun-intensity"),te=((me,ue,pe,ke,_e)=>({u_matrix_3f:me,u_sun_direction:ue,u_sun_intensity:pe,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),I,J,B.toPremultipliedRenderColor(null),W.toPremultipliedRenderColor(null));F.framebufferTexture2D(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_CUBE_MAP_POSITIVE_X+O,d.skyboxTexture,0),f.draw(w,F.TRIANGLES,_s.disabled,Gs.disabled,fn.unblended,Vs.frontCW,te,"skyboxCapture",d.skyboxGeometry.vertexBuffer,d.skyboxGeometry.indexBuffer,d.skyboxGeometry.segment)}const b6=i.ei([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class y0{constructor(d){const f=new i.ep;f.emplaceBack(-1,1,1,0,0),f.emplaceBack(1,1,1,1,0),f.emplaceBack(1,-1,1,1,1),f.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(f,b6.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 loe=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 coe{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class w6{constructor(d){this.colorModeAlphaBlendedWriteRGB=new fn([1,Dm,1,Dm],i.ao.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new fn([1,0,1,0],i.ao.transparent,[!1,!1,!1,!0]),this.params=new coe,this.updateNeeded=!0}update(d){const f=d.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new y0(f);const j=this.params.sizeRange,I=this.params.intensityRange,O=function(te){const me=i.eq(30),ue=[];for(let pe=0;pe{const ft=O.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];bt&&ft.push("ALPHA_PASS");const ht=d.getOrCreateProgram("globeAtmosphere",{defines:ft}),Ct=((Dt,Yt,Xt,lr,br,Ht,Et,er,Zt,hr,Ir,Xr)=>({u_frustum_tl:Dt,u_frustum_tr:Yt,u_frustum_br:Xt,u_frustum_bl:lr,u_horizon:br,u_transition:Ht,u_fadeout_range:Et,u_atmosphere_fog_color:er.toArray01(),u_high_color:Zt.toArray01(),u_space_color:hr.toArray01(),u_temporal_offset:Ir,u_horizon_angle:Xr}))(O.frustumCorners.TL,O.frustumCorners.TR,O.frustumCorners.BR,O.frustumCorners.BL,O.frustumCorners.horizon,B,Fe,te,ue,ke,We,kt);d.uploadCommonUniforms(j,ht);const Rt=this.atmosphereBuffer;Rt&&ht.draw(d,I.TRIANGLES,F,Gs.disabled,bt?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,Vs.backCW,Ct,bt?"atmosphere_glow_alpha":"atmosphere_glow",Rt.vertexBuffer,Rt.indexBuffer,Rt.segments)};yt(!1),yt(!0)}drawStars(d,f){const j=i.aA(f.properties.get("star-intensity"),0,1);if(j===0)return;const I=d.context,O=I.gl,F=d.transform,B=d.getOrCreateProgram("stars"),W=i.c7([]);i.c9(W,W,-F._pitch),i.c8(W,W,-F.angle),i.c9(W,W,i.an(F._center.lat)),i.et(W,W,-i.an(F._center.lng));const J=i.cc(new Float32Array(16),W),te=i.aB([],F.starsProjMatrix,J),me=i.eo([],J),ue=i.eu([],me),pe=[0,1,0];i.dQ(pe,pe,ue),i.c5(pe,pe,this.params.sizeMultiplier);const ke=[1,0,0];i.dQ(ke,ke,ue),i.c5(ke,ke,this.params.sizeMultiplier);const _e=(Fe=pe,Re=ke,We=j,{u_matrix:Float32Array.from(te),u_up:Fe,u_right:Re,u_intensity_multiplier:We});var Fe,Re,We;d.uploadCommonUniforms(I,B),this.starsVx&&this.starsIdx&&B.draw(d,O.TRIANGLES,_s.disabled,Gs.disabled,this.colorModeAlphaBlendedWriteRGB,Vs.disabled,_e,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class EN{constructor(){this.visibleTiles=[]}updateBorders(d,f){const j=[],I=[],O=d._getRenderableCoordinates(!1,!0);for(const W of O){const J=d.getTile(W);if(!J.hasData())continue;const te=J.getBucket(f);te&&(te.isEmpty()||(j.push(W.key),I.push({bucket:te,tileID:W.canonical})))}let F=j.length!==this.visibleTiles.length;if(!F){j.sort();for(let W=0;WW.tileID.z-J.tileID.z||W.tileID.x-J.tileID.x||W.tileID.y-J.tileID.y);for(const W of I){const J=new Array,te=new Array,me=W.bucket;for(const ue of me.featuresOnBorder)B.has(ue.featureId)?te.push(ue.footprintIndex):(B.add(ue.featureId),J.push(ue.footprintIndex));me.updateFootprintHiddenFlags(J,i.ev,!1),me.updateFootprintHiddenFlags(te,i.ev,!0)}}}function IN(w,d){const f=[...w],j=d.cameraWorldSizeForFog/d.worldSize,I=i.bA([]);return i.cS(I,I,[j,j,1]),i.aB(f,I,f),i.aB(f,d.worldToFogMatrix,f),f}function PN(w,d,f,j,I){const O=f.material,F=j.context,{baseColorTexture:B,metallicRoughnessTexture:W}=O.pbrMetallicRoughness,{normalTexture:J,occlusionTexture:te,emissionTexture:me}=O;function ue(ke,_e,Fe){if(ke&&(w.push(_e),F.activeTexture.set(F.gl.TEXTURE0+Fe),ke.gfxTexture)){const{minFilter:Re,magFilter:We,wrapS:at,wrapT:Ge}=ke.sampler;ke.gfxTexture.bindExtraParam(Re,We,at,Ge)}}ue(B,"HAS_TEXTURE_u_baseColorTexture",Ol.BaseColor),ue(W,"HAS_TEXTURE_u_metallicRoughnessTexture",Ol.MetallicRoughness),ue(J,"HAS_TEXTURE_u_normalTexture",Ol.Normal),ue(te,"HAS_TEXTURE_u_occlusionTexture",Ol.Occlusion),ue(me,"HAS_TEXTURE_u_emissionTexture",Ol.Emission),I&&(I.texture||(I.texture=new i.d$(j.context,I.image,[I.image.height,I.image.height,I.image.height],F.gl.RGBA8)),F.activeTexture.set(F.gl.TEXTURE0+Ol.LUT),I.texture&&I.texture.bind(F.gl.LINEAR,F.gl.CLAMP_TO_EDGE),w.push("APPLY_LUT_ON_GPU")),f.texcoordBuffer&&(w.push("HAS_ATTRIBUTE_a_uv_2f"),d.push(f.texcoordBuffer)),f.colorBuffer&&(w.push(f.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),d.push(f.colorBuffer)),f.normalBuffer&&(w.push("HAS_ATTRIBUTE_a_normal_3f"),d.push(f.normalBuffer)),f.pbrBuffer&&(w.push("HAS_ATTRIBUTE_a_pbr"),w.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),d.push(f.pbrBuffer)),O.alphaMode!=="OPAQUE"&&O.alphaMode!=="MASK"||w.push("UNPREMULT_TEXTURE_IN_SHADER"),O.defined||w.push("DIFFUSE_SHADED");const pe=j.shadowRenderer;pe&&(w.push("RENDER_SHADOWS","DEPTH_TEXTURE"),pe.useNormalOffset&&w.push("NORMAL_OFFSET"))}function LN(w,d,f,j,I,O){const F=w.modelOpacity,B=d.context,W=new _s(d.context.gl.LEQUAL,w.isLightMesh?_s.ReadOnly:_s.ReadWrite,d.depthRangeFor3D),J=d.transform,te=w.mesh,me=te.material,ue=me.pbrMetallicRoughness,pe=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 Fe=f.paint.get("model-color-use-theme").constantOr("default")==="none",Re=f.paint.get("model-emissive-strength").constantOr(0),We=_x(new Float32Array(w.worldViewProjection),new Float32Array(ke),new Float32Array(_e),null,d,F,ue.baseColorFactor,me.emissiveFactor,ue.metallicFactor,ue.roughnessFactor,me,Re,f,void 0,void 0,w.materialOverride,w.modelColor),at={defines:[]},Ge=[],kt=d.shadowRenderer;kt&&(kt.useNormalOffset=!1),PN(at.defines,Ge,te,d,Fe?null:f.lut);let yt=null;if(pe){const ht=IN(w.nodeModelMatrix,d.transform);if(yt=new Float32Array(ht),J.projection.name!=="globe"){const Ct=te.aabb.min,Rt=te.aabb.max,[Dt,Yt]=pe.getOpacityForBounds(ht,Ct[0],Ct[1],Rt[0],Rt[1]);at.overrideFog=Dt>=cr||Yt>=cr}}const bt=Xf(d,f.paint.get("model-cutoff-fade-range"));bt.shouldRenderCutoff&&at.defines.push("RENDER_CUTOFF");const ft=d.getOrCreateProgram("model",at);d.uploadCommonUniforms(B,ft,null,yt,bt),d.renderPass!=="shadow"&&kt&&kt.setupShadowsFromMatrix(w.nodeModelMatrix,ft),ft.draw(d,B.gl.TRIANGLES,W,I,O,te.material.doubleSided?Vs.disabled:Vs.backCCW,We,f.id,te.vertexBuffer,te.indexBuffer,te.segments,f.paint,d.transform.zoom,void 0,Ge)}function l_(w,d){return w.style._importedAsBasemap?"basemap":d.scope}function Sx(w,d,f,j,I,O,F,B,W,J){const te=w.transform,me=!!d.isGeometryBloom&&d.isGeometryBloom;if(me&&w.renderPass==="shadow")return;const ue=te.projection.name==="globe"?i.eD(f,te):[...f];i.aB(ue,ue,d.globalMatrix);const pe=i.aB([],j,ue);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"){F.push({mesh:ke,depth:0,modelIndex:I,worldViewProjection:pe,nodeModelMatrix:ue,isLightMesh:me,materialOverride:_e,modelOpacity:W,modelColor:J});continue}const Fe=i.af([],ke.centroid,pe);!te.isOrthographic&&Fe[2]<=0||O.push({mesh:ke,depth:Fe[2],modelIndex:I,worldViewProjection:pe,nodeModelMatrix:ue,isLightMesh:me,materialOverride:_e,modelOpacity:W,modelColor:J})}if(d.children)for(const ke of d.children)Sx(w,ke,f,j,I,O,F,B,W,J)}function Xh(w,d,f,j){const I=f.shadowRenderer;if(!I)return;const O=I.getShadowPassDepthMode(),F=I.getShadowPassColorMode(),B=I.calculateShadowPassMatrixFromMatrix(d),W=R5(B);f.getOrCreateProgram("modelDepth",{defines:f._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(f,f.context.gl.TRIANGLES,O,Gs.disabled,F,Vs.disabled,W,j.id,w.vertexBuffer,w.indexBuffer,w.segments,j.paint,f.transform.zoom,void 0,void 0)}function j6(w,d,f,j,I,O){for(const F of I){const B=Object.assign({},j);B.part=F;const W={type:"Unknown",id:d,properties:B},J={orientation:w.paint.get("model-rotation").evaluate(W,f)};O.set(F,J)}}function k6(w,d,f,j,I,O){for(const F of I){const B=Object.assign({},j);B.part=F;const W={type:"Unknown",id:d,properties:B},J={color:w.paint.get("model-color").evaluate(W,f),colorMix:w.paint.get("model-color-mix-intensity").evaluate(W,f),opacity:w.paint.get("model-opacity").evaluate(W,f),emissionStrength:w.paint.get("model-emissive-strength").evaluate(W,f)};O.set(F,J)}}function N6(w,d,f,j,I){let O=!1;for(const B of j)B.modelOpacity!==1&&(LN(B,w,d,I[B.modelIndex],Gs.disabled,fn.disabled),O=!0);for(const B of j)LN(B,w,d,I[B.modelIndex],B.modelOpacity!==1?w.stencilModeFor3D():Gs.disabled,w.colorModeForRenderPass());O&&w.resetStencilClippingMasks();const F=fn.additive;for(const B of f)LN(B,w,d,I[B.modelIndex],Gs.disabled,B.isLightMesh?F:w.colorModeForRenderPass())}function S6(w,d,f){const j=d.updateZoomBasedPaintProperties(),I=function(O,F,B){let W,J,te,me=O.terrain?O.terrain.exaggeration():0;if(O.terrain&&me>0){const ue=O.terrain,pe=ue.findDEMTileFor(B);pe&&pe.dem?W=i.eF.create(ue,B,pe):me=0}if(me===0&&(F.terrainElevationMin=0,F.terrainElevationMax=0),me===F.validForExaggeration&&(me===0||W&&W._demTile&&W._demTile.tileID===F.validForDEMTile.id&&W._dem._timestamp===F.validForDEMTile.timestamp))return!1;for(const ue in F.instancesPerModel){const pe=F.instancesPerModel[ue];for(let ke=0;keJ&&(J=pe.max)}const te=i.aA(j.x,O,F)-j.x,me=i.aA(j.y,B,W)-j.y,ue=i.cf(J,d.center.lat)-j.z;return d._zoomFromMercatorZ(Math.sqrt(te*te+me*me+ue*ue))}function C6(w,d,f,j,I,O,F){const B=w.context,W=w.renderPass==="shadow",J=w.shadowRenderer,te=W&&J?J.getShadowPassDepthMode():new _s(B.gl.LEQUAL,_s.ReadWrite,w.depthRangeFor3D),me=w.isTileAffectedByFog(O),ue=w.transform.projection.name==="globe";if(f.meshes)for(const pe of f.meshes){const ke=ue?[]:["MODEL_POSITION_ON_GPU"],_e=[];let Fe,Re,We;const at=!ue&&j.instancedDataArray.length>20;at&&ke.push("INSTANCED_ARRAYS");const Ge=Xf(w,d.paint.get("model-cutoff-fade-range"));if(Ge.shouldRenderCutoff&&ke.push("RENDER_CUTOFF"),W&&J)Fe=w.getOrCreateProgram("modelDepth",{defines:ke}),Re=R5(F.shadowTileMatrix,F.shadowTileMatrix,Float32Array.from(f.globalMatrix)),We=J.getShadowPassColorMode();else{PN(ke,_e,pe,w,d.paint.get("model-color-use-theme").constantOr("default")==="none"?null:d.lut),Fe=w.getOrCreateProgram("model",{defines:ke,overrideFog:me});const yt=pe.material,bt=yt.pbrMetallicRoughness,ft=d.paint.get("model-opacity").constantOr(1),ht=d.paint.get("model-emissive-strength").constantOr(0);Re=_x(O.expandedProjMatrix,Float32Array.from(f.globalMatrix),new Float32Array(16),null,w,ft,bt.baseColorFactor,yt.emissiveFactor,bt.metallicFactor,bt.roughnessFactor,yt,ht,d,I),J&&(F.shadowUniformsInitialized?Fe.setShadowUniformValues(B,J.getShadowUniformValues()):(J.setupShadows(O.toUnwrapped(),Fe,"model-tile"),F.shadowUniformsInitialized=!0)),We=Ge.shouldRenderCutoff||ft<1||yt.alphaMode!=="OPAQUE"?fn.alphaBlended:fn.unblended}w.uploadCommonUniforms(B,Fe,O.toUnwrapped(),null,Ge);const kt=pe.material.doubleSided?Vs.disabled:Vs.backCCW;if(at)_e.push(j.instancedDataBuffer),Fe.draw(w,B.gl.TRIANGLES,te,Gs.disabled,We,kt,Re,d.id,pe.vertexBuffer,pe.indexBuffer,pe.segments,d.paint,w.transform.zoom,void 0,_e,j.instancedDataArray.length);else{const yt=W?"u_instance":"u_normal_matrix";for(let bt=0;btW[1]?F:W,O[0]=f.max[0],F=i.aC(i.eG(),O,I),B=F[1]W[1]?F:W,O[1]=f.min[1],F=i.aC(i.eG(),O,I),B=F[1]W[1]?F:W;const J=i.aA(j[0],0,1),te=100*d.pixelsPerMeter*i.aA(j[1],0,1),me=i.aA(j[2],0,1),ue=i.eH(i.eG(),B,W,J),pe=Math.tan(.5*d.fovX),ke=-ue[2]*pe;if(te===0)return ue[1]<-Math.abs(ke)?me:1;const _e=(-Math.abs(ke)-ue[1])/te,Fe=(We,at,Ge)=>(1-Ge)*We+Ge*at,Re=i.aA(Fe(1,me,_e),me,1);return Fe(1,Re,i.aA((d.pitch-20)/20,0,1))}class M6{}class og{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(d,f,j){{const me=this._storage.get(f.id);if(me)return me.lastUsedFrameIdx=d,me.buf}const I=j.gl,O=I.getBufferParameter(I.ELEMENT_ARRAY_BUFFER,I.BUFFER_SIZE),F=new ArrayBuffer(O),B=new Int16Array(F);I.getBufferSubData(I.ELEMENT_ARRAY_BUFFER,0,new Int16Array(F));const W=new i.eJ;for(let me=0;me30&&(j.buf.destroy(),this._storage.delete(f))}destroy(){for(const[d,f]of this._storage)f.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 zp{constructor(d){this.revealStart=11,this.revealRange=2}}const q5=i.ei([{type:"Float32",name:"a_pos_2f",components:2}]);class V5{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(d,f){const j=d.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const F=new i.eK,B=new i.b0;F.emplaceBack(-1,-1),F.emplaceBack(1,-1),F.emplaceBack(1,1),F.emplaceBack(-1,1),B.emplaceBack(0,1,2),B.emplaceBack(0,2,3),this.vignetteVx=d.context.createVertexBuffer(F,q5.members),this.vignetteIdx=d.context.createIndexBuffer(B)}const I=i.bg.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){d.uploadCommonUniforms(d.context,j);const F={u_vignetteShape:(O={vignetteShape:[f.start,f.range,Math.pow(10,f.fadePower)],vignetteColor:[f.color.r,f.color.g,f.color.b,f.color.a*f.strength]}).vignetteShape,u_vignetteColor:O.vignetteColor};j.draw(d,d.context.gl.TRIANGLES,_s.disabled,Gs.disabled,fn.alphaBlended,Vs.disabled,F,"vignette",this.vignetteVx,this.vignetteIdx,I)}var O}}class H5{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(d,f){const j=d.getFreeCameraOptions().position,I=j.toAltitude(),O=j.toLngLat(),F=i.an(O.lng),B=i.an(O.lat),W=d.pixelsPerMeter/f,J=F*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 me=-this._offsetYPrev+te,ue=-this._elevationPrev+I;this._accumulatedOffsetX+=(-this._offsetXPrev+J)*W,this._accumulatedOffsetY+=me*W,this._accumulatedElevation+=ue*W,this._offsetXPrev=J,this._offsetYPrev=te,this._elevationPrev=I}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function ON(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 Ru(w){const d=i.eq(1323123451230),f=[];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 f=d.context;if(!this.particlesVx){const j=Ru(this.particlesCount),I=new i.eN,O=new i.b0;let F=0;const B=i.eq(1323123451230);for(let W=0;Wj)return;const I=Kd(0,1,f.revealStart,f.revealStart+f.revealRange,j);if(!this.particlesVx||!this.particlesIdx)return;const O=structuredClone(this._params);let F=[-O.direction.x,O.direction.y,-100];i.aw(F,F);const B=structuredClone(this._vignetteParams);B.strength*=I,O.overrideStyleParameters||(O.intensity=d.style.rain.state.density,O.timeFactor=d.style.rain.state.intensity,O.color=structuredClone(d.style.rain.state.color),F=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 W=this.updateOnRender(d,O.timeFactor),J=d.context,te=J.gl,me=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 ue=d.getOrCreateProgram("rainParticle");d.uploadCommonUniforms(J,ue),J.activeTexture.set(te.TEXTURE0),this.screenTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE);const pe=[O.color.r,O.color.g,O.color.b,O.color.a],ke=(_e,Fe)=>{const Re=ON(this._movement.getPosition(),_e),We=O.dropletSizeX,at=O.dropletSizeX*O.dropletSizeYScale,Ge=d.width/2,kt=d.height/2,yt=Kd(0,O.screenThinning.start,0,1,O.screenThinning.intensity),bt=Kd(.001,O.screenThinning.range,0,1,O.screenThinning.intensity),ft=Kd(0,O.screenThinning.particleOffset,0,1,O.screenThinning.intensity),ht=(Ct={modelview:W.modelviewMatrix,projection:W.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:Re,velocityConeAperture:O.velocityConeAperture,velocity:O.velocity,boxSize:_e,rainDropletSize:[We,at],distortionStrength:O.distortionStrength,rainDirection:F,color:pe,screenSize:[me.width,me.height],thinningCenterPos:[Ge,kt],thinningShape:[yt,bt,Math.pow(10,O.screenThinning.fadePower)],thinningAffectedRatio:O.screenThinning.affectedRatio,thinningParticleOffset:ft,shapeDirectionalPower:O.shapeDirPower,shapeNormalPower:O.shapeNormalPower,mode:Fe?0:1},{u_modelview:Float32Array.from(Ct.modelview),u_projection:Float32Array.from(Ct.projection),u_time:Ct.time,u_cam_pos:Ct.camPos,u_texScreen:0,u_velocityConeAperture:Ct.velocityConeAperture,u_velocity:Ct.velocity,u_boxSize:Ct.boxSize,u_rainDropletSize:Ct.rainDropletSize,u_distortionStrength:Ct.distortionStrength,u_rainDirection:Ct.rainDirection,u_color:Ct.color,u_screenSize:Ct.screenSize,u_thinningCenterPos:Ct.thinningCenterPos,u_thinningShape:Ct.thinningShape,u_thinningAffectedRatio:Ct.thinningAffectedRatio,u_thinningParticleOffset:Ct.thinningParticleOffset,u_shapeDirectionalPower:Ct.shapeDirectionalPower,u_shapeNormalPower:Ct.shapeNormalPower,u_mode:Ct.mode});var Ct;const Rt=Math.round(O.intensity*this.particlesCount),Dt=i.bg.simpleSegment(0,0,4*Rt,2*Rt);ue.draw(d,te.TRIANGLES,_s.disabled,Gs.disabled,fn.alphaBlended,Vs.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 W5=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 G5 extends Cx{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 zp("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 f=d.context;if(!this.particlesVx){const j=Ru(this.particlesCount),I=new i.eO,O=new i.b0;let F=0;const B=i.eq(1323123451230);for(let W=0;WF)return;const B=Kd(0,1,O.revealStart,O.revealStart+O.revealRange,F);I.strength*=B,f.overrideStyleParameters||(f.intensity=d.style.snow.state.density,f.timeFactor=d.style.snow.state.intensity,f.color=structuredClone(d.style.snow.state.color),j=structuredClone(d.style.snow.state.direction),f.screenThinning.intensity=d.style.snow.state.centerThinning,f.billboardSize=2.79*d.style.snow.state.flakeSize,I.strength=1,I.color=structuredClone(d.style.snow.state.vignetteColor));const W=this.updateOnRender(d,f.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const J=d.context,te=J.gl,me=d.transform,ue=d.getOrCreateProgram("snowParticle");d.uploadCommonUniforms(J,ue),((pe,ke,_e)=>{const Fe=ON(this._movement.getPosition(),pe),Re=me.width/2,We=me.height/2,at=Kd(0,_e.screenThinning.start,0,1,_e.screenThinning.intensity),Ge=Kd(.001,_e.screenThinning.range,0,1,_e.screenThinning.intensity),kt=Kd(0,_e.screenThinning.particleOffset,0,1,_e.screenThinning.intensity),yt=(bt={modelview:W.modelviewMatrix,projection:W.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:Fe,velocityConeAperture:_e.velocityConeAperture,velocity:_e.velocity,horizontalOscillationRadius:_e.horizontalOscillationRadius,horizontalOscillationRate:_e.horizontalOscillationRate,boxSize:pe,billboardSize:1*_e.billboardSize,simpleShapeParameters:[_e.shapeFadeStart,_e.shapeFadePower],screenSize:[me.width,me.height],thinningCenterPos:[Re,We],thinningShape:[at,Ge,Math.pow(10,_e.screenThinning.fadePower)],thinningAffectedRatio:_e.screenThinning.affectedRatio,thinningParticleOffset:kt,color:[_e.color.r,_e.color.g,_e.color.b,_e.color.a],direction:j},{u_modelview:Float32Array.from(bt.modelview),u_projection:Float32Array.from(bt.projection),u_time:bt.time,u_cam_pos:bt.camPos,u_velocityConeAperture:bt.velocityConeAperture,u_velocity:bt.velocity,u_horizontalOscillationRadius:bt.horizontalOscillationRadius,u_horizontalOscillationRate:bt.horizontalOscillationRate,u_boxSize:bt.boxSize,u_billboardSize:bt.billboardSize,u_simpleShapeParameters:bt.simpleShapeParameters,u_screenSize:bt.screenSize,u_thinningCenterPos:bt.thinningCenterPos,u_thinningShape:bt.thinningShape,u_thinningAffectedRatio:bt.thinningAffectedRatio,u_thinningParticleOffset:bt.thinningParticleOffset,u_particleColor:bt.color,u_direction:bt.direction});var bt;const ft=Math.round(_e.intensity*this.particlesCount),ht=i.bg.simpleSegment(0,0,4*ft,2*ft);this.particlesVx&&this.particlesIdx&&ue.draw(d,te.TRIANGLES,_s.disabled,Gs.disabled,fn.alphaBlended,Vs.disabled,yt,"snow_particles",this.particlesVx,this.particlesIdx,ht)})(f.boxSize,0,f),this._vignette.draw(d,I)}}const lg={symbol:function(w,d,f,j,I){if(w.renderPass!=="translucent")return;const O=Gs.disabled,F=w.colorModeForRenderPass(),B=f.layout.get("text-variable-anchor"),W=f.layout.get("text-size-scale-range"),J=i.aA(w.scaleFactor,W[0],W[1]);B&&function(ue,pe,ke,_e,Fe,Re,We,at){const Ge=pe.transform,kt=Fe==="map",yt=Re==="map";for(const bt of ue){const ft=_e.getTile(bt),ht=ft.getBucket(ke);if(!ht||!ht.text||!ht.text.segments.get().length)continue;const Ct=i.bK(ht.textSizeData,Ge.zoom,at),Rt=Lr(bt,ht.getProjection(),Ge),Dt=Ge.calculatePixelsToTileUnitsMatrix(ft),Yt=ka(Rt,ft.tileID.canonical,yt,kt,Ge,ht.getProjection(),Dt),Xt=ht.hasIconTextFit()&&ht.hasIconData();Ct&&Ps(ht,kt,yt,We,Ge,Yt,bt,Math.pow(2,Ge.zoom-ft.tileID.overscaledZ),Ct,Xt)}}(j,w,f,d,f.layout.get("text-rotation-alignment"),f.layout.get("text-pitch-alignment"),I,J);const te=f.paint.get("icon-opacity").constantOr(1)!==0,me=f.paint.get("text-opacity").constantOr(1)!==0;f.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(te||me)?a_(w,d,f,j,O,F):(te&&a_(w,d,f,j,O,F,{onlyIcons:!0}),me&&a_(w,d,f,j,O,F,{onlyText:!0})),d.map.showCollisionBoxes&&(as(w,d,f,j,f.paint.get("text-translate"),f.paint.get("text-translate-anchor"),!0),as(w,d,f,j,f.paint.get("icon-translate"),f.paint.get("icon-translate-anchor"),!1))},circle:function(w,d,f,j){if(w.renderPass!=="translucent")return;const I=f.paint.get("circle-opacity"),O=f.paint.get("circle-stroke-width"),F=f.paint.get("circle-stroke-opacity"),B=f.layout.get("circle-sort-key").constantOr(1)!==void 0,W=f.paint.get("circle-emissive-strength");if(I.constantOr(1)===0&&(O.constantOr(1)===0||F.constantOr(1)===0))return;const J=w.context,te=J.gl,me=w.transform,ue=!(!w.terrain||!w.terrain.enabled),pe=f.layout.get("circle-elevation-reference"),ke=w.depthModeForSublayer(0,_s.ReadOnly),_e=new _s(w.context.gl.LEQUAL,_s.ReadOnly,w.depthRangeFor3D),Fe=pe==="none"||ue?ke:_e,Re=Gs.disabled,We=w.colorModeForDrapableLayerRenderPass(W),at=me.projection.name==="globe",Ge=[i.aF(me.center.lng),i.aJ(me.center.lat)],kt=[];for(let bt=0;btbt.sortKey-ft.sortKey);const yt={useDepthForOcclusion:me.depthOcclusionForSymbolsAndCircles};for(const bt of kt){const{programConfiguration:ft,program:ht,layoutVertexBuffer:Ct,dynamicBuffers:Rt,indexBuffer:Dt,uniformValues:Yt,tile:Xt}=bt.state,lr=bt.segments;w.terrain&&w.terrain.setupElevationDraw(Xt,ht,yt),w.uploadCommonUniforms(J,ht,Xt.tileID.toUnwrapped()),ht.draw(w,te.TRIANGLES,Fe,Re,We,Vs.disabled,Yt,f.id,Ct,Dt,lr,f.paint,me.zoom,ft,Rt)}},heatmap:function(w,d,f,j){if(f.paint.get("heatmap-opacity")!==0)if(w.renderPass==="offscreen"){const I=w.context,O=I.gl,F=Gs.disabled,B=new fn([O.ONE,O.ONE,O.ONE,O.ONE],i.ao.transparent,[!0,!0,!0,!0]);(function(pe,ke,_e,Fe){const Re=pe.gl,We=ke.width*Fe,at=ke.height*Fe;pe.activeTexture.set(Re.TEXTURE1),pe.viewport.set([0,0,We,at]);let Ge=_e.heatmapFbo;if(!Ge||Ge&&(Ge.width!==We||Ge.height!==at)){Ge&&Ge.destroy();const kt=Re.createTexture();Re.bindTexture(Re.TEXTURE_2D,kt),Re.texParameteri(Re.TEXTURE_2D,Re.TEXTURE_WRAP_S,Re.CLAMP_TO_EDGE),Re.texParameteri(Re.TEXTURE_2D,Re.TEXTURE_WRAP_T,Re.CLAMP_TO_EDGE),Re.texParameteri(Re.TEXTURE_2D,Re.TEXTURE_MIN_FILTER,Re.LINEAR),Re.texParameteri(Re.TEXTURE_2D,Re.TEXTURE_MAG_FILTER,Re.LINEAR),Ge=_e.heatmapFbo=pe.createFramebuffer(We,at,1,null),function(yt,bt,ft,ht,Ct,Rt){const Dt=yt.gl;Dt.texImage2D(Dt.TEXTURE_2D,0,yt.extRenderToTextureHalfFloat?Dt.RGBA16F:Dt.RGBA,Ct,Rt,0,Dt.RGBA,yt.extRenderToTextureHalfFloat?Dt.HALF_FLOAT:Dt.UNSIGNED_BYTE,null),ht.colorAttachment0.set(ft)}(pe,0,kt,Ge,We,at)}else Re.bindTexture(Re.TEXTURE_2D,Ge.colorAttachment0.get()),pe.bindFramebuffer.set(Ge.framebuffer)})(I,w,f,w.transform.projection.name==="globe"?.5:.25),I.clear({color:i.ao.transparent});const W=w.transform,J=W.projection.name==="globe",te=J?["PROJECTION_GLOBE_VIEW"]:[],me=J?Vs.frontCCW:Vs.disabled,ue=[i.aF(W.center.lng),i.aJ(W.center.lat)];for(let pe=0;pe({u_image:0,u_color_ramp:1,u_opacity:me.paint.get("heatmap-opacity")}))(0,O),O.id,I.viewportBuffer,I.quadTriangleIndexBuffer,I.viewportSegments,O.paint,I.transform.zoom)}(w,f))},line:function(w,d,f,j){if(w.renderPass!=="translucent")return;const I=f.paint.get("line-opacity"),O=f.paint.get("line-width");if(I.constantOr(1)===0||O.constantOr(1)===0)return;const F=f.paint.get("line-emissive-strength").isConstant(),B=f.paint.get("line-emissive-strength").constantOr(0),W=f.paint.get("line-occlusion-opacity"),J=f.layout.get("line-elevation-reference"),te=f.layout.get("line-width-unit")==="meters",me=J==="sea",ue=!(!w.terrain||!w.terrain.enabled),pe=w.context,ke=pe.gl;if(f.hasElevatedBuckets&&w.transform.projection.name==="globe")return;const _e=f.layout.get("line-cross-slope"),Fe=_e!==void 0,Re=_e<1,We=w.colorModeForDrapableLayerRenderPass(F?B:null),at=w.terrain&&w.terrain.renderingToTexture,Ge=at?1:i.o.devicePixelRatio,kt=f.paint.get("line-dasharray"),yt=kt.constantOr(1),bt=f.layout.get("line-cap"),ft=kt.constantOr(null),ht=bt.constantOr(null),Ct=f.paint.get("line-pattern"),Rt=Ct.constantOr(1),Dt=f.paint.get("line-pattern-cross-fade"),Yt=Ct.constantOr(null),Xt=f.paint.get("line-opacity").constantOr(1);let lr=!Rt&&Xt!==1||w.depthOcclusion&&W>0&&W<1;const br=f.paint.get("line-gradient"),Ht=Rt?"linePattern":"line",Et=i.e2(f);let er;if(at&&w.terrain&&w.terrain.clipOrMaskOverlapStencilType()&&(lr=!1),W!==0&&w.depthOcclusion){const Xr=f.paint._values["line-opacity"];Xr&&Xr.value&&Xr.value.kind==="constant"?er=Xr.value:i.w(`Occlusion opacity for layer ${f.id} is supported only when line-opacity isn't data-driven.`)}O.value.kind!=="constant"&&O.value.isLineProgressConstant===!1&&Et.push("VARIABLE_LINE_WIDTH"),at&&(w.emissiveMode!=="dual-source-blending"||F?w.emissiveMode==="mrt-fallback"&&Et.push("USE_MRT1"):Et.push("DUAL_SOURCE_BLENDING"));const Zt=(Xr,Mr,wr,fs,ls,Wr)=>{for(const Jr of Xr){const As=d.getTile(Jr);if(Rt&&!As.patternsLoaded())continue;const an=As.getBucket(f);if(!an||an.elevationType!=="none"&&!ls||an.elevationType==="none"&&ls)continue;w.prepareDrawTile();const Kn=[...Mr],Sa=w.shadowRenderer,ys=an.elevationType==="road"&&!!Sa&&Sa.enabled;let xa=[0,0,0];if(ys){const xn=w.style.directionalLight,xi=w.style.ambientLight;xn&&xi&&(xa=Pp(w.style,xn,xi)),Kn.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const tn=an.programConfigurations.get(f.id);let Aa=!1;if(Yt&&As.imageAtlas){const xn=i.e3.from(Yt),xi=xn.getPrimary().scaleSelf(Ge).toString(),go=As.imageAtlas.patternPositions.get(xi),Hi=xn.getSecondary(),ei=Hi?As.imageAtlas.patternPositions.get(Hi.scaleSelf(Ge).toString()):null;Aa=!!go&&!!ei,go&&tn.setConstantPatternPositions(go,ei)}Dt>0&&(Aa||tn.getPatternTransitionVertexBuffer("line-pattern"))&&Kn.push("LINE_PATTERN_TRANSITION");const Ha=w.isTileAffectedByFog(Jr),Fa=w.getOrCreateProgram(Ht,{config:tn,defines:Kn,overrideFog:Ha});if(!Rt&&ft&&ht&&As.lineAtlas){const xn=As.lineAtlas.getDash(ft,ht);xn&&tn.setConstantPatternPositions(xn)}ys&&Sa.setupShadows(As.tileID.toUnwrapped(),Fa,"vector-tile");let[fa,gn]=f.paint.get("line-trim-offset");(ht==="round"||ht==="square")&&fa!==gn&&(fa===0&&(fa-=1),gn===1&&(gn+=1));const Ma=at?Jr.projMatrix:null,Xi=te?1/an.tileToMeter/i.ay(As,1,w.transform.zoom):1,Ti=te?1/an.tileToMeter/i.ay(As,1,Math.floor(w.transform.zoom)):1,Ea=Rt?i.e4(w,As,f,Ma,Ge,Xi,Ti,[fa,gn],xa,Dt):i.e5(w,As,f,Ma,an.lineClipsArray.length,Ge,Xi,Ti,[fa,gn],xa);if(br){const xn=an.gradients[f.id];let xi=xn.texture;if(f.gradientVersion!==xn.version){let go=256;if(f.stepInterpolant){const Hi=d.getSource().maxzoom,ei=Jr.canonical.z===Hi?Math.ceil(1<{er!=null&&(er.value=Xt*W),Fa.draw(w,ke.TRIANGLES,wr,xn,We,Vs.disabled,Ea,f.id,an.layoutVertexBuffer,an.indexBuffer,an.segments,f.paint,w.transform.zoom,tn,[an.layoutVertexBuffer2,an.patternVertexBuffer,an.zOffsetVertexBuffer]),er!=null&&(er.value=Xt)};if(lr&&!ls){const xn=w.stencilModeForClipping(Jr).ref;xn===0&&at&&pe.clear({stencil:0});const xi={func:ke.EQUAL,mask:255};Ea.u_alpha_discard_threshold=.8,ca(new Gs(xi,xn,255,ke.KEEP,ke.KEEP,ke.INVERT)),Ea.u_alpha_discard_threshold=0,ca(new Gs(xi,xn,255,ke.KEEP,ke.KEEP,ke.KEEP))}else Ea.u_alpha_discard_threshold=lr&&ls&&Wr?.8:0,ca(ls?fs:w.stencilModeForClipping(Jr))}};let hr=w.depthModeForSublayer(0,_s.ReadOnly);const Ir=new _s(w.depthOcclusion?ke.GREATER:ke.LEQUAL,_s.ReadOnly,w.depthRangeFor3D);if(f.hasNonElevatedBuckets){const Xr=!at&&w.terrain;W!==0&&Xr?i.w(`Occlusion opacity for layer ${f.id} is supported on terrain only if the layer has line-z-offset enabled.`):Xr?i.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${f.id}.`):Zt(j,Et,hr,Gs.disabled,!1,!0)}if(f.hasElevatedBuckets){J==="hd-road-markup"?ue||(hr=Ir,Et.push("ELEVATED_ROADS")):(Et.push("ELEVATED"),hr=Ir,Fe&&Et.push(Re?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),me&&Et.push("ELEVATION_REFERENCE_SEA"));const Xr=lr?w.stencilModeFor3D():Gs.disabled;w.forceTerrainMode=!0,Zt(j,Et,hr,Xr,!0,!0),lr&&Zt(j,Et,hr,Xr,!0,!1),w.forceTerrainMode=!1}lr&&(w.resetStencilClippingMasks(),at&&pe.clear({stencil:0})),W===0||w.depthOcclusion||at||w.layersWithOcclusionOpacity.push(w.currentLayer)},fill:function(w,d,f,j){const I=f.paint.get("fill-color"),O=f.paint.get("fill-opacity");if(O.constantOr(1)===0)return;const F=f.paint.get("fill-emissive-strength"),B=w.colorModeForDrapableLayerRenderPass(F),W=f.paint.get("fill-pattern"),J=w.opaquePassEnabledForLayer()&&!W.constantOr(1)&&I.constantOr(i.ao.transparent).a===1&&O.constantOr(0)===1?"opaque":"translucent";let te="none";f.layout.get("fill-elevation-reference")!=="none"?te="road":f.paint.get("fill-z-offset").constantOr(1)!==0&&(te="offset");const me=!(!w.terrain||!w.terrain.enabled),ue={painter:w,sourceCache:d,layer:f,coords:j,colorMode:B,elevationType:te,terrainEnabled:me,pass:J};if(w.renderPass==="shadow")return void(w.shadowRenderer&&te==="road"&&!me&&function(ke){const{painter:_e,sourceCache:Fe,layer:Re,coords:We}=ke,at=_e.context.gl,Ge=ke.painter.shadowRenderer;for(const kt of We){const yt=Fe.getTile(kt),bt=yt.getBucket(Re);if(!bt)continue;const ft=bt.elevatedStructures;if(!ft||!ft.shadowCasterSegments||ft.shadowCasterSegments.segments[0].primitiveLength===0)continue;_e.prepareDrawTile();const ht=bt.bufferData.programConfigurations.get(Re.id),Ct=_e.isTileAffectedByFog(kt),Rt=_e.getOrCreateProgram("elevatedStructuresDepth",{config:ht,overrideFog:Ct}),Dt=Ge.calculateShadowPassMatrixFromTile(yt.tileID.toUnwrapped());_e.uploadCommonUniforms(_e.context,Rt,kt.toUnwrapped());const Yt={u_matrix:Dt,u_depth_bias:0};Rt.draw(_e,at.TRIANGLES,Ge.getShadowPassDepthMode(),Gs.disabled,Ge.getShadowPassColorMode(),Vs.disabled,Yt,Re.id,ft.vertexBuffer,ft.indexBuffer,ft.shadowCasterSegments,Re.paint,_e.transform.zoom,ht)}}(ue));const pe=w.emissiveMode==="mrt-fallback";if(te!=="offset"){if(kN(ue,!1,pe),te==="road"){const ke=!me&&w.renderPass==="translucent";ke&&jN(w,d,f,j,"geometry"),kN(ue,!0,pe,Gs.disabled),ke&&function(_e){const{painter:Fe,sourceCache:Re,layer:We,coords:at,colorMode:Ge}=_e,kt=Fe.context.gl,yt=_e.painter.shadowRenderer,bt=!!yt&&yt.enabled,ft=new _s(Fe.context.gl.LEQUAL,_s.ReadOnly,Fe.depthRangeFor3D);let ht=[0,0,0];if(bt){const Rt=Fe.style.directionalLight,Dt=Fe.style.ambientLight;Rt&&Dt&&(ht=Pp(Fe.style,Rt,Dt))}const Ct=Rt=>{for(const Dt of at){const Yt=Re.getTile(Dt),Xt=Yt.getBucket(We);if(!Xt)continue;const lr=Xt.elevatedStructures;if(!lr)continue;let br,Ht;if(Rt?(br=lr.renderableBridgeSegments,Ht=lr.bridgeProgramConfigurations.get(We.id)):(br=lr.renderableTunnelSegments,Ht=lr.tunnelProgramConfigurations.get(We.id)),!br||br.segments[0].primitiveLength===0)continue;Ht.updatePaintBuffers(),Fe.prepareDrawTile();const Et=Fe.isTileAffectedByFog(Dt),er=[];bt&&er.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const Zt=Fe.getOrCreateProgram("elevatedStructures",{config:Ht,overrideFog:Et,defines:er}),hr=Fe.translatePosMatrix(Dt.projMatrix,Yt,We.paint.get("fill-translate"),We.paint.get("fill-translate-anchor"));bt&&yt.setupShadows(Yt.tileID.toUnwrapped(),Zt,"vector-tile");const Ir=sg(hr,ht);Fe.uploadCommonUniforms(Fe.context,Zt,Dt.toUnwrapped()),Zt.draw(Fe,kt.TRIANGLES,ft,Gs.disabled,Ge,Vs.backCCW,Ir,We.id,lr.vertexBuffer,lr.indexBuffer,br,We.paint,Fe.transform.zoom,Ht,[lr.vertexBufferNormal])}};Ct(!0),Ct(!1)}(ue)}}else kN(ue,!1,pe,w.stencilModeFor3D())},"fill-extrusion":function(w,d,f,j){const I=f.paint.get("fill-extrusion-opacity"),O=w.context,F=O.gl,B=w.terrain,W=B&&B.renderingToTexture;if(I===0)return;const J=w.emissiveMode==="mrt-fallback",te=w.conflationActive&&w.style.isLayerClipped(f,d.getSource()),me=w.style.order.indexOf(f.fqid);if(te&&function(ue,pe,ke,_e,Fe){for(const Re of _e){const We=pe.getTile(Re).getBucket(ke);We&&(We.updateReplacement(Re,ue.replacementSource,Fe),We.uploadCentroid(ue.context))}}(w,d,f,j,me),B||te)for(const ue of j){const pe=d.getTile(ue).getBucket(f);pe&&ooe(w.context,d,ue,pe,f,B,te)}if(w.renderPass==="shadow"&&w.shadowRenderer){const ue=w.shadowRenderer;if(B&&I<.65&&f._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof i.ad)return;const pe=ue.getShadowPassDepthMode(),ke=ue.getShadowPassColorMode();NN(w,d,f,j,pe,Gs.disabled,ke,te)}else if(w.renderPass==="translucent"){const ue=!f.paint.get("fill-extrusion-pattern").constantOr(1),pe=f.paint.get("fill-extrusion-color").constantOr(i.ao.white);if(!W&&pe.a!==0){const ke=new _s(w.context.gl.LEQUAL,_s.ReadWrite,w.depthRangeFor3D);I===1&&ue?NN(w,d,f,j,ke,Gs.disabled,fn.unblended,te):(NN(w,d,f,j,ke,Gs.disabled,fn.disabled,te),NN(w,d,f,j,ke,w.stencilModeFor3D(),w.colorModeForRenderPass(),te),w.resetStencilClippingMasks())}if(w.style.enable3dLights()&&ue&&(!B&&w.transform.projection.name!=="globe"||W)){const ke=f.paint.get("fill-extrusion-opacity"),_e=f.paint.get("fill-extrusion-ambient-occlusion-intensity"),Fe=f.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),Re=f.paint.get("fill-extrusion-flood-light-intensity"),We=f.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",at=f.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(We?null:f.lut).toArray01().slice(0,3),Ge=_e>0&&Fe>0,kt=Re>0,yt=(ht,Ct,Rt)=>(1-Rt)*ht+Rt*Ct,bt=new B5;bt.translate=f.paint.get("fill-extrusion-translate"),bt.translateAnchor=f.paint.get("fill-extrusion-translate-anchor"),bt.edgeRadius=f.layout.get("fill-extrusion-edge-radius"),bt.cutoffFadeRange=f.paint.get("fill-extrusion-cutoff-fade-range");const ft=ht=>{const Ct=w.depthModeForSublayer(1,_s.ReadOnly,F.LEQUAL,!0),Rt=f.paint.get(ht?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Dt=yt(.1,3,Rt),Yt=w._showOverdrawInspector;if(!Yt){const Xt=new Gs({func:F.ALWAYS,mask:255},255,255,F.KEEP,F.KEEP,F.REPLACE),lr=new fn([F.ONE,F.ONE,F.ONE,F.ONE],i.ao.transparent,[!1,!1,!1,!0],F.MIN);Dp(bt,w,d,f,j,Ct,Xt,lr,Vs.disabled,ht,"sdf",ke,_e,Fe,Re,at,Dt,te,!1)}{const Xt=Yt?Gs.disabled:new Gs({func:F.EQUAL,mask:255},255,255,F.KEEP,F.DECR,F.DECR),lr=Yt?w.colorModeForRenderPass():new fn([F.ONE_MINUS_DST_ALPHA,F.DST_ALPHA,F.ONE,F.ONE],i.ao.transparent,[!0,!0,!0,!0]);Dp(bt,w,d,f,j,Ct,Xt,lr,Vs.disabled,ht,"color",ke,_e,Fe,Re,at,Dt,te,!1)}};if(W){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}),F.RGBA8)),Yt.bind(F.LINEAR,F.CLAMP_TO_EDGE),F.copyTexSubImage2D(F.TEXTURE_2D,0,0,0,0,0,Rt,Dt),Yt},Ct=(Rt,Dt,Yt)=>{const Xt=w.depthModeForSublayer(1,_s.ReadOnly,F.LEQUAL,!1),lr=f.paint.get(Rt?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),br=yt(.1,3,lr);{const Ht=new fn([F.ONE,F.ONE,F.ONE,F.ONE],i.ao.transparent,[!1,!1,!1,!0]);Dp(bt,w,d,f,j,Xt,Gs.disabled,Ht,Vs.disabled,Rt,"clear",ke,_e,Fe,Re,at,br,te,Dt)}{const Ht=new Gs({func:F.ALWAYS,mask:255},255,255,F.KEEP,F.KEEP,F.REPLACE),Et=new fn([F.ONE,F.ONE,F.ONE,F.ONE],i.ao.transparent,[!1,!1,!1,!0],F.MIN);Dp(bt,w,d,f,j,Xt,Ht,Et,Vs.disabled,Rt,"sdf",ke,_e,Fe,Re,at,br,te,Dt)}J&&!Rt&&(Yt=ht());{const Ht=Rt?F.ZERO:F.ONE_MINUS_DST_ALPHA,Et=new Gs({func:F.EQUAL,mask:255},255,255,F.KEEP,F.DECR,F.DECR),er=new fn([Ht,F.DST_ALPHA,F.ONE_MINUS_DST_ALPHA,F.ZERO],i.ao.transparent,[!0,!0,!0,!0]);Dp(bt,w,d,f,j,Xt,Et,er,Vs.disabled,Rt,"color",ke,_e,Fe,Re,at,br,te,Dt)}if(!J||Rt){const Ht=new fn([F.ONE,F.ONE,F.ONE,Rt?F.ZERO:F.ONE],i.ao.transparent,[!1,!1,!1,!0],Rt?F.FUNC_ADD:F.MAX);Dp(bt,w,d,f,j,Xt,Gs.disabled,Ht,Vs.disabled,Rt,"clear",ke,_e,Fe,Re,at,br,te,Dt,Yt)}else{F.drawBuffers([F.NONE,F.COLOR_ATTACHMENT1]);const Ht=new Gs({func:F.EQUAL,mask:255},254,255,F.KEEP,F.DECR,F.DECR),Et=new fn([F.ONE,F.ONE,F.ONE,F.ONE],i.ao.transparent,[!0,!1,!1,!1],F.MAX);Dp(bt,w,d,f,j,Xt,Ht,Et,Vs.disabled,Rt,"emissive",ke,_e,Fe,Re,at,br,te,Dt,Yt),F.drawBuffers([F.COLOR_ATTACHMENT0])}};if(Ge||kt){let Rt;w.prepareDrawTile(),J&&!Ge||(Rt=ht()),Ge&&Ct(!0,!1,Rt),kt&&Ct(!1,!0,Rt)}}else Ge&&ft(!0),kt&&ft(!1),(Ge||kt)&&w.resetStencilClippingMasks()}}},building:function(w,d,f,j){w.currentLayer0&&O>0,J=!0;const te=f.paint.get("building-vertical-scale");if(te<=0)return;w.shadowRenderer||(J=!1);const me=w.conflationActive&&w.style.isLayerClipped(f,d.getSource()),ue=w.style.order.indexOf(f.fqid);if(function(pe,ke,_e,Fe,Re,We){for(const at of We){const Ge=ke.getTile(at).getBucket(_e);Ge&&(Re&&Ge.updateReplacement(at,pe.replacementSource,Fe),Ge.uploadUpdatedIndexBuffer(pe.context))}}(w,d,f,ue,me,j),function(pe,ke,_e,Fe){for(const Re of Fe){const We=ke.getTile(Re).getBucket(_e);We&&We.needsEvaluation()&&We.uploadUpdatedColorBuffer(pe.context)}}(w,d,f,j),f.resetLayerRenderingStats(w),w.shadowRenderer&&(w.shadowRenderer.useNormalOffset=!0),w.renderPass==="shadow"&&w.shadowRenderer){const pe=w.shadowRenderer,ke=[],_e=pe.getShadowPassDepthMode();i_({painter:w,source:d,layer:f,coords:j,defines:ke,blendMode:pe.getShadowPassColorMode(),depthMode:_e,opacity:B,verticalScale:te,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(w.renderPass==="translucent"){let pe=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];J&&(pe=pe.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),w.shadowRenderer&&w.shadowRenderer.useNormalOffset&&(pe=pe.concat("NORMAL_OFFSET"));const ke=f.paint.get("building-facade-emissive-chance"),_e=f.paint.get("building-ambient-occlusion-intensity"),Fe=f.paint.get("building-flood-light-intensity"),Re=f.paint.get("building-flood-light-color-use-theme").constantOr("default")==="none",We=f.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(Re?null:f.lut).toArray01().slice(0,3),at=f.paint.get("building-flood-light-ground-attenuation"),Ge=Fe>0,kt=new _s(w.context.gl.LEQUAL,_s.ReadWrite,w.depthRangeFor3D);B<1&&i_({painter:w,source:d,layer:f,coords:j,defines:pe,blendMode:fn.disabled,depthMode:kt,opacity:B,verticalScale:te,facadeEmissiveChance:ke,facadeAOIntensity:_e,floodLightIntensity:Fe,floodLightColor:We,depthOnly:!0});const yt=w.colorModeForRenderPass();i_({painter:w,source:d,layer:f,coords:j,defines:pe,blendMode:yt,depthMode:kt,opacity:B,verticalScale:te,facadeEmissiveChance:ke,facadeAOIntensity:_e,floodLightIntensity:Fe,floodLightColor:We}),W&&SN(w,d,f,j,!0,B,I,O,Fe,We,F,me),Ge&&SN(w,d,f,j,!1,B,I,O,Fe,We,at,me)}else if(w.renderPass==="light-beam"){const pe=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],ke=new _s(w.context.gl.LEQUAL,_s.ReadOnly,w.depthRangeFor3D);i_({painter:w,source:d,layer:f,coords:j,defines:pe,blendMode:fn.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,f,j){if(w.renderPass!=="offscreen"&&w.renderPass!=="translucent"||w.style.disableElevatedTerrain)return;const I=w.context,O=w.terrain&&w.terrain.renderingToTexture,[F,B]=w.renderPass!=="translucent"||O?[{},j]:w.stencilConfigForOverlap(j);for(const W of B){const J=d.getTile(W);if(J.needsHillshadePrepare&&w.renderPass==="offscreen")Xie(w,J,f);else if(w.renderPass==="translucent"){const te=w.depthModeForSublayer(0,_s.ReadOnly),me=f.paint.get("hillshade-emissive-strength"),ue=w.colorModeForDrapableLayerRenderPass(me),pe=O&&w.terrain?w.terrain.stencilModeForRTTOverlap(W):F[W.overscaledZ];Yie(w,W,J,f,te,pe,ue)}}I.viewport.set([0,0,w.width,w.height]),w.resetStencilClippingMasks()},raster:function(w,d,f,j,I,O){if(w.renderPass!=="translucent"||f.paint.get("raster-opacity")===0)return;const F=w.transform.projection.name==="globe",B=f.paint.get("raster-elevation")!==0,W=B&&F;if(w.renderElevatedRasterBackface&&!W)return;const J=w.context,te=J.gl,me=d.getSource(),ue=function(yt,bt,ft,ht,Ct){const Rt=bt.paint.get("raster-color"),Dt=yt.type==="raster-array",Yt=[],Xt=bt.paint.get("raster-resampling"),lr=bt.paint.get("raster-color-mix");let br=bt.paint.get("raster-color-range");const Ht=[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&&yt.rasterLayers)){const Zt=yt.rasterLayers.find(({id:hr})=>hr===bt.sourceLayer);Zt&&Zt.fields&&Zt.fields.range&&(br=Zt.fields.range)}if(br=br||[0,1],Rt){Yt.push("RASTER_COLOR"),ft.activeTexture.set(ht.TEXTURE2),bt.updateColorRamp(br);let Zt=bt.colorRampTexture;Zt||(Zt=bt.colorRampTexture=new i.T(ft,bt.colorRamp,ht.RGBA8)),Zt.bind(ht.LINEAR,ht.CLAMP_TO_EDGE)}return Ct&&Yt.push("USE_MRT1"),{mix:Ht,range:br,offset:Et,defines:Yt,resampling:er}}(me,f,J,te,w.terrain&&w.terrain.renderingToTexture&&w.emissiveMode==="mrt-fallback");if(me instanceof i.aU&&!j.length&&!F)return;const pe=f.paint.get("raster-emissive-strength"),ke=w.colorModeForDrapableLayerRenderPass(pe),_e=w.terrain&&w.terrain.renderingToTexture,Fe=!w.options.moving,Re=f.paint.get("raster-resampling")==="nearest"?te.NEAREST:te.LINEAR;if(me instanceof i.aU&&!j.length&&(me.onNorthPole||me.onSouthPole)){const yt=B?w.stencilModeFor3D():Gs.disabled;return void o_(!!me.onNorthPole,null,w,d,f,pe,ue,Vs.disabled,yt)}if(!j.length)return;const[We,at]=me instanceof i.aU||_e?[{},j]:w.stencilConfigForOverlap(j),Ge=at[at.length-1].overscaledZ;W&&ue.defines.push("PROJECTION_GLOBE_VIEW"),B&&ue.defines.push("RENDER_CUTOFF");const kt=(yt,bt,ft)=>{for(const ht of yt){const Ct=ht.toUnwrapped(),Rt=d.getTile(ht);if(_e&&(!Rt||!Rt.hasData()))continue;J.activeTexture.set(te.TEXTURE0);const Dt=Fp(Rt,me,f,ue);if(!Dt||!Dt.texture)continue;const{texture:Yt,mix:Xt,offset:lr,tileSize:br,buffer:Ht}=Dt;let Et,er;_e?(Et=_s.disabled,er=ht.projMatrix):B?(Et=new _s(te.LEQUAL,_s.ReadWrite,w.depthRangeFor3D),er=F?Float32Array.from(w.transform.expandedFarZProjMatrix):w.transform.calculateProjMatrix(Ct,Fe)):(Et=w.depthModeForSublayer(ht.overscaledZ-Ge,f.paint.get("raster-opacity")===1?_s.ReadWrite:_s.ReadOnly,te.LESS),er=w.transform.calculateProjMatrix(Ct,Fe));const Zt=w.terrain&&_e?w.terrain.stencilModeForRTTOverlap(ht):We[ht.overscaledZ],hr=O?0:f.paint.get("raster-fade-duration");Rt.registerFadeDuration(hr);const Ir=d.findLoadedParent(ht,0),Xr=t_(Rt,Ir,d,w.transform,hr);let Mr,wr;!Xr.isFading&&Rt.refreshedUponExpiration&&(Rt.refreshedUponExpiration=!1),w.terrain&&w.terrain.prepareDrawTile(),J.activeTexture.set(te.TEXTURE0),Yt.bind(Re,te.CLAMP_TO_EDGE),J.activeTexture.set(te.TEXTURE1),Ir?(Ir.texture&&Ir.texture.bind(Re,te.CLAMP_TO_EDGE),Mr=Math.pow(2,Ir.tileID.overscaledZ-Rt.tileID.overscaledZ),wr=[Rt.tileID.canonical.x*Mr%1,Rt.tileID.canonical.y*Mr%1]):Yt.bind(Re,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 fs=w.transform;let ls;const Wr=B?f6(fs):[0,0,0,0];let Jr,As,an,Kn,Sa,ys=0;if(W&&me instanceof i.aU&&me.coordinates.length>3)Jr=Float32Array.from(i.bk(i.dJ(new i.cD(0,0,0)))),As=Float32Array.from(fs.globeMatrix),an=Float32Array.from(i.dF(fs)),Kn=[i.aF(fs.center.lng),i.aJ(fs.center.lat)],ls=me.elevatedGlobePerspectiveTransform,Sa=me.elevatedGlobeGridMatrix||new Float32Array(9);else if(W){const Ha=i.dG(ht.canonical);ys=i.dH(Ha.getCenter().lat),Jr=Float32Array.from(i.bk(i.dJ(ht.canonical))),As=Float32Array.from(fs.globeMatrix),an=Float32Array.from(i.dF(fs)),Kn=[i.aF(fs.center.lng),i.aJ(fs.center.lat)],ls=[0,0],Sa=Float32Array.from(i.dI(ht.canonical,Ha,ys,fs.worldSize/fs._pixelsPerMercatorPixel))}else ls=me instanceof i.aU?me.perspectiveTransform:[0,0],Jr=new Float32Array(16),As=new Float32Array(9),an=new Float32Array(16),Kn=[0,0],Sa=new Float32Array(9);const xa=l6(er,Jr,As,an,Sa,wr||[0,0],i.aj(w.transform.zoom),Kn,Wr,Mr||1,Xr,f,ls,B?f.paint.get("raster-elevation"):0,2,Xt,lr,ue.range,br,Ht,pe),tn=w.isTileAffectedByFog(ht),Aa=w.getOrCreateProgram("raster",{defines:ue.defines,overrideFog:tn});if(w.uploadCommonUniforms(J,Aa,Ct),me instanceof i.aU){const Ha=me.elevatedGlobeVertexBuffer,Fa=me.elevatedGlobeIndexBuffer;if(_e||!F)me.boundsBuffer&&me.boundsSegments&&Aa.draw(w,te.TRIANGLES,Et,Gs.disabled,ke,Vs.disabled,xa,f.id,me.boundsBuffer,w.quadTriangleIndexBuffer,me.boundsSegments);else if(Ha&&Fa){const fa=fs.zoom<=i.c_?me.elevatedGlobeSegments:me.getSegmentsForLongitude(fs.center.lng);fa&&Aa.draw(w,te.TRIANGLES,Et,Gs.disabled,ke,bt,xa,f.id,Ha,Fa,fa)}}else if(W){Et=new _s(te.LEQUAL,_s.ReadOnly,w.depthRangeFor3D);const Ha=w.globeSharedBuffers;if(Ha){const[Fa,fa,gn]=Ha.getGridBuffers(ys,!1);Aa.draw(w,te.TRIANGLES,Et,ft||Zt,w.colorModeForRenderPass(),bt,xa,f.id,Fa,fa,gn)}}else{const{tileBoundsBuffer:Ha,tileBoundsIndexBuffer:Fa,tileBoundsSegments:fa}=w.getTileBoundsBuffers(Rt);Aa.draw(w,te.TRIANGLES,Et,Zt,ke,Vs.disabled,xa,f.id,Ha,Fa,fa)}}if(!(me instanceof i.aU)&&W)for(const ht of yt){const Ct=ht.canonical.y===(1<>>16,2654435769),((ht=Math.imul(ht^ht>>>16,2654435769))>>>0)/4294967296},ft=1/1.1;for(let ht=0;hti.e9[Zt](Yt));Ht.push(Yt);const Et=Yt.canonical.x,er=Yt.canonical.y;for(const Zt of Ht){const hr=Ge.getTile(Ct?Zt.wrapped():Zt);if(!hr)continue;const Ir=hr.rasterParticleState;if(!Ir)continue;const Xr=Zt.canonical.x+(1<bt.tileID)),pe&&(J.activeTexture.set(te.TEXTURE0),w.imageManager.bind(w.context,f.scope));const yt=[];if(w.terrain&&w.terrain.renderingToTexture&&w.emissiveMode==="mrt-fallback"&&yt.push("USE_MRT1"),W){const bt=w.getOrCreateProgram(at,{overrideFog:!1,overrideRtt:!0,defines:yt}),ft=new Float32Array(i.bA([])),ht=new i.aQ(0,0,0,0,0),Ct=pe?ag(ft,B,F,w,0,f.scope,ke,W,{tileID:ht,tileSize:ue}):s_(ft,B,F,I.toPremultipliedRenderColor(O?null:f.lut));bt.draw(w,te.TRIANGLES,Re,Fe,We,Vs.disabled,Ct,f.id,w.viewportBuffer,w.quadTriangleIndexBuffer,w.viewportSegments)}else for(const bt of kt){const ft=w.isTileAffectedByFog(bt),ht=w.getOrCreateProgram(at,{overrideFog:ft,defines:yt}),Ct=bt.toUnwrapped(),Rt=j?bt.projMatrix:w.transform.calculateProjMatrix(Ct);w.prepareDrawTile();const Dt=d?d.getTile(bt):Ge?Ge[bt.key]:new Tp(bt,ue,me.zoom,w),Yt=pe?ag(Rt,B,F,w,0,f.scope,ke,W,{tileID:bt,tileSize:ue}):s_(Rt,B,F,I.toPremultipliedRenderColor(O?null:f.lut));w.uploadCommonUniforms(J,ht,Ct);const{tileBoundsBuffer:Xt,tileBoundsIndexBuffer:lr,tileBoundsSegments:br}=w.getTileBoundsBuffers(Dt);ht.draw(w,te.TRIANGLES,Re,Fe,We,Vs.disabled,Yt,f.id,Xt,lr,br)}},sky:function(w,d,f){const j=w._atmosphere?i.aj(w.transform.zoom):1,I=f.paint.get("sky-opacity")*j;if(I===0)return;const O=w.context,F=f.paint.get("sky-type"),B=new _s(O.gl.LEQUAL,_s.ReadOnly,[0,1]),W=w.frameCounter/1e3%1;F==="atmosphere"?w.renderPass==="offscreen"?f.needsSkyboxCapture(w)&&(function(J,te,me,ue){const pe=J.context,ke=pe.gl;let _e=te.skyboxFbo;if(!_e){_e=te.skyboxFbo=pe.createFramebuffer(32,32,1,null),te.skyboxGeometry=new AN(pe),te.skyboxTexture=pe.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 at=0;at<6;++at)ke.texImage2D(ke.TEXTURE_CUBE_MAP_POSITIVE_X+at,0,ke.RGBA,32,32,0,ke.RGBA,ke.UNSIGNED_BYTE,null)}pe.bindFramebuffer.set(_e.framebuffer),pe.viewport.set([0,0,32,32]);const Fe=te.getCenter(J,!0),Re=J.getOrCreateProgram("skyboxCapture"),We=new Float64Array(16);i.bA(We),i.en(We,We,.5*-Math.PI),Nx(J,te,Re,We,Fe,0),i.bA(We),i.en(We,We,.5*Math.PI),Nx(J,te,Re,We,Fe,1),i.bA(We),i.cU(We,We,.5*-Math.PI),Nx(J,te,Re,We,Fe,2),i.bA(We),i.cU(We,We,.5*Math.PI),Nx(J,te,Re,We,Fe,3),i.bA(We),Nx(J,te,Re,We,Fe,4),i.bA(We),i.en(We,We,Math.PI),Nx(J,te,Re,We,Fe,5),pe.viewport.set([0,0,J.width,J.height])}(w,f),f.markSkyboxValid(w)):w.renderPass==="sky"&&function(J,te,me,ue,pe){const ke=J.context,_e=ke.gl,Fe=J.transform,Re=J.getOrCreateProgram("skybox");ke.activeTexture.set(_e.TEXTURE0),_e.bindTexture(_e.TEXTURE_CUBE_MAP,te.skyboxTexture);const We=((at,Ge,kt,yt,bt)=>({u_matrix:at,u_sun_direction:Ge,u_cubemap:0,u_opacity:yt,u_temporal_offset:bt}))(Fe.skyboxMatrix,te.getCenter(J,!1),0,ue,pe);J.uploadCommonUniforms(ke,Re),Re.draw(J,_e.TRIANGLES,me,Gs.disabled,J.colorModeForRenderPass(),Vs.backCW,We,"skybox",te.skyboxGeometry.vertexBuffer,te.skyboxGeometry.indexBuffer,te.skyboxGeometry.segment)}(w,f,B,I,W):F==="gradient"&&w.renderPass==="sky"&&function(J,te,me,ue,pe){const ke=J.context,_e=ke.gl,Fe=J.transform,Re=J.getOrCreateProgram("skyboxGradient");te.skyboxGeometry||(te.skyboxGeometry=new AN(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 at=((Ge,kt,yt,bt,ft)=>({u_matrix:Ge,u_color_ramp:0,u_center_direction:kt,u_radius:i.an(yt),u_opacity:bt,u_temporal_offset:ft}))(Fe.skyboxMatrix,te.getCenter(J,!1),te.paint.get("sky-gradient-radius"),ue,pe);J.uploadCommonUniforms(ke,Re),Re.draw(J,_e.TRIANGLES,me,Gs.disabled,J.colorModeForRenderPass(),Vs.backCW,at,"skyboxGradient",te.skyboxGeometry.vertexBuffer,te.skyboxGeometry.indexBuffer,te.skyboxGeometry.segment)}(w,f,B,I,W)},custom:function(w,d,f,j){const I=w.context,O=f.implementation;if(!w.transform.projection.unsupportedLayers||!w.transform.projection.unsupportedLayers.includes("custom")||w.terrain&&(w.terrain.renderingToTexture||w.renderPass==="offscreen")&&f.isDraped(d)){if(w.renderPass==="offscreen"){const F=O.prerender;if(F){if(w.setCustomLayerDefaults(),I.setColorMode(w.colorModeForRenderPass()),w.transform.projection.name==="globe"){const B=w.transform.pointMerc;F.call(O,I.gl,w.transform.customLayerMatrix(),w.transform.getProjection(),w.transform.globeToMercatorMatrix(),i.aj(w.transform.zoom),[B.x,B.y],w.transform.pixelsPerMeterRatio)}else F.call(O,I.gl,w.transform.customLayerMatrix());I.setDirty(),w.setBaseState()}}else if(w.renderPass==="translucent"){if(w.terrain&&w.terrain.renderingToTexture){const B=O.renderToTile;if(B){const W=j[0].canonical,J={x:W.x+j[0].wrap*(O.wrapTileId?0:1<{J&&(J.useNormalOffset=!0,te||(J.enabled=!0))},ue=d.getSource();if(w.renderPass==="light-beam"&&ue.type!=="batched-model")return;if(ue.type==="vector"||ue.type==="geojson")return function(Ge,kt,yt,bt,ft){const ht=Ge.transform,Ct=ht.projection.name==="globe",Rt=ht.getFreeCameraOptions().position;if(!Ge.modelManager)return;const Dt=Ge.modelManager;yt.modelManager=Dt;const Yt=Ge.shadowRenderer;if(!yt._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const Xt=yt._unevaluatedLayout._values["model-id"],lr=Object.assign({},yt.layout.get("model-id").parameters),br=Ge.style.order.indexOf(yt.fqid),Ht=yt.paint.get("model-opacity").constantOr(1);for(const Et of bt){const er=kt.getTile(Et).getBucket(yt);if(!er||er.projection.name!==ht.projection.name)continue;const Zt=er.getModelUris();if(Zt&&!er.modelsRequested&&(Dt.addModelsFromBucket(Zt,ft),er.modelsRequested=!0),Ct)lr.zoom=Et.overscaledZ;else{const Wr=Sd(Et,ht);lr.zoom=Wr}const hr=Xt.possiblyEvaluate(lr);if(S6(Ge,er,Et),$m.shadowUniformsInitialized=!1,$m.useSingleShadowCascade=!!Yt&&Yt.getMaxCascadeForTile(Et.toUnwrapped())===0,Ge.renderPass==="shadow"&&Yt){if(Ge.currentShadowCascade===1&&er.isInsideFirstShadowMapFrustum)continue;const Wr=ht.calculatePosMatrix(Et.toUnwrapped(),ht.worldSize);if($m.tileMatrix.set(Wr),$m.shadowTileMatrix=Float32Array.from(Yt.calculateShadowPassMatrixFromMatrix(Wr)),$m.aabb.min=[0,0,0],$m.aabb.max[0]=$m.aabb.max[1]=i.al,$m.aabb.max[2]=0,doe(er,$m,Ge,yt.scope))continue}const Ir=1<0&&Ge.style.isLayerClipped(yt,kt.getSource())&&er.updateReplacement(Et,Ge.replacementSource,br,yt.scope)&&(er.uploaded=!1,er.upload(Ge.context));let Mr=0;const wr=new Array,fs=new Array,ls=new Array;for(let Wr in er.instancesPerModel){const Jr=er.instancesPerModel[Wr];Jr.features.length>0&&!Ct&&(Wr=hr.evaluate(Jr.features[0].feature,{}));const As=Dt.getModel(Wr,ft);if(As||Dt.hasURLBeenRequested(Wr)||er.modelUris.includes(Wr)||(er.modelUris.push(Wr),er.modelsRequested=!1),As&&As.uploaded)if(Ct){const an=i.c5([],[Rt.x,Rt.y,Rt.z],Ge.transform.worldSize);i.ew(an,an);for(let Kn=0;Kn0&&xa.elevationUpdate(Wr.terrain,Kn,ys,As.source),xa.needsReEvaluation(Wr,Sa,As)&&xa.evaluate(As))}})(Ge,kt,yt,bt),function(){let Wr,Jr,As;wr?(Wr=bt.length-1,Jr=-1,As=-1):(Wr=0,Jr=bt.length,As=1);const an=new Float64Array(16),Kn=i.cA(),Sa=new i.P(0,0);for(let ys=Wr;ys!==Jr;ys+=As){const xa=bt[ys],tn=kt.getTile(xa).getBucket(yt);if(!tn||!tn.uploaded)continue;let Aa=!1;Rt&&(Aa=Rt.getMaxCascadeForTile(xa.toUnwrapped())===0);const Ha=ht.calculatePosMatrix(xa.toUnwrapped(),ht.worldSize),Fa=tn.modelTraits;!Ir&&wr&&(i.bl(an,Ha),i.af(Kn,Yt,an),Sa.x=Kn[0],Sa.y=Kn[1]);const fa=[];tn.setFilter(yt.filter);for(const gn of tn.getNodesInfo()){if(gn.hiddenByReplacement||!gn.node.meshes)continue;const Ma=gn.node;let Xi=0;Ge.terrain&&Ma.elevation&&(Xi=Ma.elevation*Ge.terrain.exaggeration());const Ti=(()=>{const Dc=gn.aabb;return hr.min=[...Dc.min],hr.max=[...Dc.max],hr.min[2]+=Xi,hr.max[2]+=Xi,i.af(hr.min,hr.min,Ha),i.af(hr.max,hr.max,Ha),hr})(),Ea=gn.evaluatedScale;if(Ea[0]<=1&&Ea[1]<=1&&Ea[2]<=1&&Ti.intersects(Xr)===0)continue;if(!Ir&&wr){const Dc=.16666666666666666;gn.cameraCollisionOpacity=Yt[0]>Ti.min[0]&&Yt[0]Ti.min[1]&&Yt[1]!wr||gn.opacity===1&&Ma.opacity===1?gn.depthMa.depth?-1:1);for(const gn of fa){const Ma=gn.nodeInfo,Xi=Ma.node;let Ti=i.aB([],Ht,gn.tileModelMatrix);i.aB(Ti,lr,Ti);const Ea=i.bl([],Ti);i.eg(Ea,Ea),i.cS(Ea,Ea,c_),Ti=i.aB(Ti,Ti,Xi.globalMatrix);const ca=Ge.renderPass==="light-beam",xn=yt.paint.get("model-color-use-theme").constantOr("default")==="none",xi=Fa&i.eI.HasMapboxMeshFeatures,go=xi?0:Ma.evaluatedRMEA[0][2];for(let Hi=0;Hi=cr||Wi>=cr}}const Kl=ei.material;let zu;Kl.occlusionTexture&&Kl.occlusionTexture.offsetScale&&(zu=Kl.occlusionTexture.offsetScale,tl.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const bh=Ge.getOrCreateProgram("model",tl);!Ir&&Rt&&Rt.setupShadowsFromMatrix(gn.tileModelMatrix,bh,Rt.useNormalOffset),Ge.uploadCommonUniforms(ft,bh,null,Rc);const Yd=Kl.pbrMetallicRoughness;Yd.metallicFactor=.9,Yd.roughnessFactor=.5;const io=_x(new Float32Array(xc),new Float32Array(Ti),new Float32Array(Ea),new Float32Array(Xi.globalMatrix),Ge,gn.opacity,Yd.baseColorFactor,Kl.emissiveFactor,Yd.metallicFactor,Yd.roughnessFactor,Kl,go,yt,[0,0,0],zu);!Cd&&(Ma.hasTranslucentParts||gn.opacity<1)&&bh.draw(Ge,ft.gl.TRIANGLES,er,Gs.disabled,fn.disabled,Vs.backCCW,io,yt.id,ei.vertexBuffer,ei.indexBuffer,ei.segments,yt.paint,Ge.transform.zoom,void 0,Dc),bh.draw(Ge,ft.gl.TRIANGLES,Cd?Zt:er,Gs.disabled,Cd||gn.opacity<1||Ma.hasTranslucentParts?fn.alphaBlended:fn.unblended,Vs.backCCW,io,yt.id,ei.vertexBuffer,ei.indexBuffer,ei.segments,yt.paint,Ge.transform.zoom,void 0,Dc)}}}}()}(w,d,f,j),void me();if(ue.type!=="model")return;const pe=ue.getModels(),ke=[],_e=w.transform.getFreeCameraOptions().position,Fe=i.c5([],[_e.x,_e.y,_e.z],w.transform.worldSize);i.ew(Fe,Fe);const Re=[],We=[];let at=0;for(const Ge of pe){const kt=d.getFeatureState("",Ge.id),yt={type:"Unknown",id:Ge.id,properties:Ge.featureProperties},bt=f.paint.get("model-rotation").evaluate(yt,kt),ft=f.paint.get("model-scale").evaluate(yt,kt),ht=f.paint.get("model-translation").evaluate(yt,kt),Ct=f.paint.get("model-opacity").evaluate(yt,kt);j6(f,Ge.id,kt,Ge.featureProperties,Ge.nodeOverrideNames,Ge.nodeOverrides),k6(f,Ge.id,kt,Ge.featureProperties,Ge.materialOverrideNames,Ge.materialOverrides),Ge.nodeOverrides.size>0&&Ge.computeBoundsAndApplyParent(),Ge.computeModelMatrix(w,bt,ft,ht,B,F,!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,Fe),ke.push({zScaleMatrix:Yt,negCameraPosMatrix:Rt});for(const Xt of Ge.nodes)Sx(w,Xt,Ge.matrix,w.transform.expandedFarZProjMatrix,at,Re,We,Ge.materialOverrides,Ct);at++}if(Re.sort((Ge,kt)=>kt.depth-Ge.depth),w.renderPass!=="shadow")N6(w,f,Re,We,ke),me();else{for(const Ge of We)Xh(Ge.mesh,Ge.nodeModelMatrix,w,f);for(const Ge of Re)Xh(Ge.mesh,Ge.nodeModelMatrix,w,f);me()}}},RN={line:function(w,d,f){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 I of j){const O=d.getTile(I).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,f){const j=d.getSource();if(!j.loaded())return;if(j.type==="vector"||j.type==="geojson")return void(f.modelManager&&f.modelManager.upload(f,l_(f,w)));if(j.type==="batched-model"||j.type!=="model")return;const I=j.getModels();for(const O of I)O.upload(f.context)},raster:function(w,d,f){const j=d.getSource();if(!(j instanceof fc&&j.loaded()))return;const I=w.sourceLayer||j.rasterLayerIds&&j.rasterLayerIds[0];if(!I)return;const O=w.paint.get("raster-array-band")||j.getInitialBand(I);if(O==null)return;const F=d.getIds().map(B=>d.getTileByID(B));for(const B of F)B.updateNeeded(w.id,O)&&j.prepareTile(B,I,w.id,O)},"raster-particle":function(w,d,f){const j=d.getSource();if(!(j instanceof fc&&j.loaded()))return;const I=w.sourceLayer||j.rasterLayerIds&&j.rasterLayerIds[0];if(!I)return;const O=w.paint.get("raster-particle-array-band")||j.getInitialBand(I);if(O==null)return;const F=d.getIds().map(B=>d.getTileByID(B));for(const B of F)B.updateNeeded(w.id,O)&&j.prepareTile(B,I,w.id,O)}},Fu={fill:jN},FN={fill:function(w,d,f,j){if(!f.layout||f.layout.get("fill-elevation-reference")==="none"||f.paint.get("fill-opacity").constantOr(1)===0)return;const I=w.context.gl,O=new _s(I.LEQUAL,_s.ReadOnly,w.depthRangeFor3D),F=new Gs({func:I.ALWAYS,mask:255},255,255,I.KEEP,I.KEEP,I.REPLACE),B=w.transform.getFreeCameraOptions().position,W=w.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const J of j){const te=d.getTile(J),me=te.getBucket(f);if(!me)continue;const ue=me.elevatedStructures;if(!ue||ue.depthSegments.segments[0].primitiveLength===0)continue;const pe=p6(J.toUnwrapped(),B),ke=w.translatePosMatrix(J.projMatrix,te,f.paint.get("fill-translate"),f.paint.get("fill-translate-anchor")),_e=vx(ke,pe,0,1,0);W.draw(w,I.TRIANGLES,O,F,fn.disabled,Vs.disabled,_e,f.id,ue.vertexBuffer,ue.indexBuffer,ue.depthSegments,f.paint,w.transform.zoom)}}};class zN{constructor(d,f,j,I,O){this.context=new x0(d,f),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 F=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const W of F)this._debugParams.enabledLayers[W]=!0;for(const W of F);this.occlusionParams=new v0,this.setup(),this.numSublayers=bd.maxUnderzooming+bd.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 og,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=I,this.worldview=O,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(d,f){const j=!!d&&!!d.terrain&&this.transform.projection.supportsTerrain;if(!(j||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new E5(this,d));const I=this._terrain;this.transform.elevation=j?I:null,I.update(d,this.transform,f),this.transform.elevation&&!I.enabled&&(this.transform.elevation=null)}_updateFog(d){const f=d.fog;if(!f||this.transform.projection.name==="globe"||f.getOpacity(this.transform.pitch)<1||f.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[j,I]=f.getFovAdjustedRange(this.transform._fov);if(j>I)return void(this.transform.fogCullDistSq=null);const O=j+.78*(I-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 E5(this,this.style)),this._forceTerrainMode=d}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(d,f){if(this.width=d*i.o.devicePixelRatio,this.height=f*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,f=new i.bd;f.emplaceBack(0,0),f.emplaceBack(i.al,0),f.emplaceBack(0,i.al),f.emplaceBack(i.al,i.al),this.tileExtentBuffer=d.createVertexBuffer(f,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 I=new i.bd;I.emplaceBack(-1,-1),I.emplaceBack(1,-1),I.emplaceBack(-1,1),I.emplaceBack(1,1),this.viewportBuffer=d.createVertexBuffer(I,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 F=new i.b0;F.emplaceBack(0,1,2),F.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=d.createIndexBuffer(F);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 W=this.context.gl;this.stencilClearMode=new Gs({func:W.ALWAYS,mask:0},0,255,W.ZERO,W.ZERO,W.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,_s.disabled,this.stencilClearMode,fn.disabled,Vs.disabled,e_(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(d,f,j){if(!f||this.currentStencilSource===f.id||!d.isTileClipped()||!j||j.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let B=!1;for(const W of j)if(this._tileClippingMaskIDs[W.key]===void 0){B=!0;break}if(!B)return}this.currentStencilSource=f.id;const I=this.context,O=I.gl;this.nextStencilID+j.length>256&&this.clearStencil(),I.setColorMode(fn.disabled),I.setDepthMode(_s.disabled);const F=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const B of j){const W=f.getTile(B),J=this._tileClippingMaskIDs[B.key]=this.nextStencilID++,{tileBoundsBuffer:te,tileBoundsIndexBuffer:me,tileBoundsSegments:ue}=this.getTileBoundsBuffers(W);F.draw(this,O.TRIANGLES,_s.disabled,new Gs({func:O.ALWAYS,mask:0},J,255,O.KEEP,O.KEEP,O.REPLACE),fn.disabled,Vs.disabled,e_(B.projMatrix),"$clipping",te,me,ue)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const d=this.nextStencilID++,f=this.context.gl;return new Gs({func:f.NOTEQUAL,mask:255},d,255,f.KEEP,f.KEEP,f.REPLACE)}stencilModeForClipping(d){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(d);const f=this.context.gl;return new Gs({func:f.EQUAL,mask:255},this._tileClippingMaskIDs[d.key],0,f.KEEP,f.KEEP,f.REPLACE)}stencilConfigForOverlap(d){const f=this.context.gl,j=d.sort((F,B)=>B.overscaledZ-F.overscaledZ),I=j[j.length-1].overscaledZ,O=j[0].overscaledZ-I+1;if(O>1){this.currentStencilSource=void 0,this.nextStencilID+O>256&&this.clearStencil();const F={};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,f)=>d+f/this._fpsHistory.length,0))}render(d,f){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=f;const I=this.style._mergedLayers,O=!(!this.terrain||!this.terrain.enabled),F=()=>this.style._getOrder(O).filter(Ht=>{const Et=I[Ht];return!(Et.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[Et.type]});let B=F(),W=!1,J=!1,te=null,me=0,ue=!1;for(const Ht of B){const Et=I[Ht];Et.visibility!=="none"&&(Et.type==="circle"?W=!0:Et.type==="building"?(te=Et,++me):Et.type==="symbol"&&(Et.hasOcclusionOpacityProperties?J=!0:W=!0))}this.updateEmissiveMode();let pe=B.map(Ht=>I[Ht]);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 Ht in ke){const Et=ke[Ht];Et.used&&(Et.prepare(this.context),Et.getSource().usedInConflation&&++me)}let _e=!1;for(const Ht of pe)Ht.isHidden(this.transform.zoom)||(Ht.type==="clip"&&(_e=!0),this.prepareLayer(Ht));const Fe={},Re={},We={},at={},Ge={};for(const Ht in ke){const Et=ke[Ht];Fe[Ht]=Et.getVisibleCoordinates(),Re[Ht]=Fe[Ht].slice().reverse(),We[Ht]=Et.getVisibleCoordinates(!0).reverse(),at[Ht]=Et.getShadowCasterCoordinates(),Ge[Ht]=Et.sortCoordinatesByDistance(Fe[Ht])}const kt=Ht=>{const Et=this.style.getLayerSourceCache(Ht);return Et&&Et.used?Et.getSource():null};if(me||_e||this._clippingActiveLastFrame){const Ht=[],Et=[];let er=0;for(const Zt of pe)this.isSourceForClippingOrConflation(Zt,kt(Zt))&&(Ht.push(Zt),Et.push(er)),er++;if(Ht&&(_e||Ht.length>1)||this._clippingActiveLastFrame){_e=!1;const Zt=[];for(let hr=0;hr0){const Zt=kt(Et);Zt&&(this.minCutoffZoom=Math.max(Zt.minzoom,this.minCutoffZoom)),Et.minzoom&&(this.minCutoffZoom=Math.max(Et.minzoom,this.minCutoffZoom))}Et.is3D(O)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=Ht),this._lastOcclusionLayer=Ht)}const yt=this.style&&this.style.fog;yt?(this._fogVisible=yt.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=yt.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(We),this.opaquePassCutoff=0,B=F(),pe=B.map(Ht=>I[Ht]));const bt=this._shadowRenderer;if(bt){bt.updateShadowParameters(this.transform,this.style.directionalLight);for(const Ht in ke)for(const Et of Fe[Ht]){let er={min:0,max:0};this.terrain&&(er=this.terrain.getMinMaxForTile(Et)||er),bt.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 w6(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const ft=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),ht=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(ft&&!this._snow&&(this._snow=new G5(this)),!ft&&this._snow&&(this._snow.destroy(),delete this._snow),ht&&!this._rain&&(this._rain=new DN(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 EN);const Ht=this.style.getLayerSourceCache(te);this.buildingTileBorderManager.updateBorders(Ht,te)}if(!Je.has(this.context.gl))return;this.renderPass="offscreen";for(const Ht of pe){const Et=d.getLayerSourceCache(Ht);if(!Ht.hasOffscreenPass()||Ht.isHidden(this.transform.zoom))continue;const er=Et?Re[Et.id]:void 0;(Ht.type==="custom"||Ht.type==="raster"||Ht.type==="raster-particle"||Ht.isSky()||er&&er.length)&&this.renderLayer(this,Et,Ht,er)}this.depthRangeFor3D=[0,1-(pe.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,at)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const Ct=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),Rt=(()=>{if(f.showOverdrawInspector)return i.ao.black;const Ht=this.style.fog;if(Ht&&this.transform.projection.supportsFog){const Et=this.style.getLut(Ht.scope);if(!Ct){const er=Ht.properties.get("color-use-theme")==="none",Zt=Ht.properties.get("color").toNonPremultipliedRenderColor(er?null:Et).toArray01();return new i.ao(...Zt)}if(Ct){const er=Ht.properties.get("space-color-use-theme")==="none",Zt=Ht.properties.get("space-color").toNonPremultipliedRenderColor(er?null:Et).toArray01();return new i.ao(...Zt)}}return i.ao.transparent})();if(this.context.clear({color:Rt,depth:1}),this.clearStencil(),this._showOverdrawInspector=f.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&Ct&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=B.length-1;this.currentLayer>=0;this.currentLayer--){const Ht=pe[this.currentLayer],Et=d.getLayerSourceCache(Ht);if(Ht.isSky())continue;const er=Et?(Ht.is3D(O)?Ge:Re)[Et.id]:void 0;this._renderTileClippingMasks(Ht,Et,er),this.renderLayer(this,Et,Ht,er)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&Ct&&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&&Ht.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 Zt of this.layersWithOcclusionOpacity){this.currentLayer=Zt;const hr=pe[this.currentLayer],Ir=d.getLayerSourceCache(hr),Xr=Ir?Re[Ir.id]:void 0;this.terrain||this._renderTileClippingMasks(hr,Ir,Ir?Fe[Ir.id]:void 0),this.renderLayer(this,Ir,hr,Xr)}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 Ht=null;pe.forEach(Et=>{const er=d.getLayerSourceCache(Et);er&&!Et.isHidden(this.transform.zoom)&&er.getVisibleCoordinates().length&&(!Ht||Ht.getSource().maxzoom0?f.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(d,f,j){const I=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")):I||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||I||f!==void 0&&!f||O.push("FOG","FOG_DITHERING"),I&&O.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&O.push("OVERDRAW_INSPECTOR"),O}getOrCreateProgram(d,f){this.cache=this.cache||{};const j=f&&f.defines||[],I=f&&f.config,O=this.currentGlobalDefines(d,f&&f.overrideFog,f&&f.overrideRtt).concat(j),F=t6.cacheKey(y5[d],d,O,I);return this.cache[F]||(this.cache[F]=new t6(this.context,d,y5[d],I,wN[d],O)),this.cache[F]}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,f){if(this.style.enable3dLights()){const j=this.style.directionalLight,I=this.style.ambientLight;if(j&&I){const O=((F,B,W)=>{const J=F.properties.get("direction"),te=F.properties.get("color-use-theme")==="none",me=F.properties.get("color").toNonPremultipliedRenderColor(te?null:W.getLut(F.scope)).toArray01(),ue=F.properties.get("intensity"),pe=B.properties.get("color-use-theme")==="none",ke=B.properties.get("color").toNonPremultipliedRenderColor(pe?null:W.getLut(B.scope)).toArray01(),_e=B.properties.get("intensity"),Fe=[J.x,J.y,J.z],Re=i.dN(ke,_e),We=i.dN(me,ue);return{u_lighting_ambient_color:Re,u_lighting_directional_dir:Fe,u_lighting_directional_color:We,u_ground_radiance:p0(Fe,We,Re)}})(j,I,this.style);f.setLightsUniformValues(d,O)}}}uploadCommonUniforms(d,f,j,I,O){if(this.uploadCommonLightUniforms(d,f),this.terrain&&this.terrain.renderingToTexture)return;const F=this.style.fog;if(F){const B=F.getOpacity(this.transform.pitch),W=((J,te,me,ue,pe,ke,_e,Fe,Re,We,at,Ge)=>{const kt=J.transform,yt=te.properties.get("color-use-theme")==="none",bt=te.properties.get("color").toNonPremultipliedRenderColor(yt?null:J.style.getLut(te.scope)).toArray01();bt[3]=ue;const ft=J.frameCounter/1e3%1,[ht,Ct]=te.properties.get("vertical-range");return{u_fog_matrix:me?kt.calculateFogTileMatrix(me):Ge||J.identityMat,u_fog_range:te.getFovAdjustedRange(kt._fov),u_fog_color:bt,u_fog_horizon_blend:te.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(ht,Ct),Ct],u_fog_temporal_offset:ft,u_frustum_tl:pe,u_frustum_tr:ke,u_frustum_br:_e,u_frustum_bl:Fe,u_globe_pos:Re,u_globe_radius:We,u_viewport:at,u_globe_transition:i.aj(kt.zoom),u_is_globe:+(kt.projection.name==="globe")}})(this,F,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],I);f.setFogUniformValues(d,W)}O&&f.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,f=d.createTexture();return d.bindTexture(d.TEXTURE_2D,f),d.copyTexImage2D(d.TEXTURE_2D,0,d.RGBA,0,0,d.drawingBufferWidth,d.drawingBufferHeight,0),f}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,f=this._backgroundTiles={},j=this.transform.coveringTiles({tileSize:512});for(const I of j)f[I.key]=d[I.key]||new Tp(I,512,this.transform.tileZoom,this,void 0,this.worldview);return f}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(d,f){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")&&(!f||f.type!=="batched-model")))}isTileAffectedByFog(d){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let f=this._cachedTileFogOpacities[d.key];return f||(this._cachedTileFogOpacities[d.key]=f=this.style.fog.getOpacityForTile(d)),f[0]>=cr||f[1]>=cr}setupDepthForOcclusion(d,f,j){const I=this.context,O=I.gl,F=!!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}),I.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),I.activeTexture.set(O.TEXTURE0),F||f.setTerrainUniformValues(I,j)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const d=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=d?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function BN(w,d){let f=!1,j=null;const I=()=>{j=null,f&&(w(),j=setTimeout(I,d),f=!1)};return()=>(f=!0,j||I(),j)}class K5{constructor(d){this._hashName=d&&encodeURIComponent(d),i.aY(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=BN(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 f=Jo(d);if(this._hashName){const j=this._hashName;let I=!1;const O=location.hash.slice(1).split("&").map(F=>{const B=F.split("=")[0];return B===j?(I=!0,`${B}=${f}`):F}).filter(F=>F);return I||O.push(`${j}=${f}`),`#${O.join("&")}`}return`#${f}`}_getCurrentHash(){const d=location.hash.replace("#","");if(this._hashName){let f;return d.split("&").map(j=>j.split("=")).forEach(j=>{j[0]===this._hashName&&(f=j)}),(f&&f[1]||"").split("/")}return d.split("/")}_onHashChange(){const d=this._map;if(!d)return!1;const f=this._getCurrentHash();if(f.length>=3&&!f.some(j=>isNaN(Number(j)))){const j=d.dragRotate.isEnabled()&&d.touchZoomRotate.isEnabled()?+(f[3]||0):d.getBearing();return d.jumpTo({center:[+f[2],+f[1]],zoom:+f[0],bearing:j,pitch:+(f[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function Jo(w,d){const f=w.getCenter(),j=Math.round(100*w.getZoom())/100,I=Math.ceil((j*Math.LN2+Math.log(512/360/.5))/Math.LN10),O=Math.pow(10,I),F=Math.round(f.lng*O)/O,B=Math.round(f.lat*O)/O,W=w.getBearing(),J=w.getPitch();let te=d?`/${F}/${B}/${j}`:`${j}/${B}/${F}`;return(W||J)&&(te+="/"+Math.round(10*W)/10),J&&(te+=`/${Math.round(J)}`),te}const b0={linearity:.3,easing:i.eT(0,0,.3,1)},Z5=Object.assign({deceleration:2500,maxSpeed:1400},b0),Y5=Object.assign({deceleration:20,maxSpeed:1400},b0),Mx=Object.assign({deceleration:1e3,maxSpeed:360},b0),X5=Object.assign({deceleration:1e3,maxSpeed:90},b0);class Q5{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,f=i.o.now();for(;d.length>0&&f-d[0].time>160;)d.shift()}_onMoveEnd(d){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const f={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)f.zoom+=O.zoomDelta||0,f.bearing+=O.bearingDelta||0,f.pitch+=O.pitchDelta||0,O.panDelta&&f.pan._add(O.panDelta),O.around&&(f.around=O.around),O.pinchAround&&(f.pinchAround=O.pinchAround);const j=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,I={};if(f.pan.mag()){const O=Um(f.pan.mag(),j,Object.assign({},Z5,d||{}));I.offset=f.pan.mult(O.amount/f.pan.mag()),I.center=this._map.transform.center,w0(I,O)}if(f.zoom){const O=Um(f.zoom,j,Y5);I.zoom=this._map.transform.zoom+O.amount,w0(I,O)}if(f.bearing){const O=Um(f.bearing,j,Mx);I.bearing=this._map.transform.bearing+i.aA(O.amount,-179,179),w0(I,O)}if(f.pitch){const O=Um(f.pitch,j,X5);I.pitch=this._map.transform.pitch+O.amount,w0(I,O)}if(I.zoom||I.bearing){const O=f.pinchAround===void 0?f.around:f.pinchAround;I.around=O?this._map.unproject(O):this._map.getCenter()}return this.clear(),I.noMoveStart=!0,I}}function w0(w,d){(!w.duration||w.durationf.unproject(W)),B=O.reduce((W,J,te,me)=>W.add(J.div(me.length)),new i.P(0,0));super(d,{points:O,point:B,lngLats:F,lngLat:f.unproject(B),originalEvent:j}),this._defaultPrevented=!1}}class J5 extends i.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(d,f){super("wheel",{originalEvent:f}),this._defaultPrevented=!1}}class $N{constructor(d,f){this._map=d,this._clickTolerance=f.clickTolerance}reset(){this._mousedownPos=void 0}wheel(d){return this._firePreventable(new J5(this._map,d))}mousedown(d,f){return this._mousedownPos=f,this._firePreventable(new Zd(d.type,this._map,d))}mouseup(d){this._map.fire(new Zd(d.type,this._map,d))}preclick(d){const f=new MouseEvent("preclick",d);this._map.fire(new Zd(f.type,this._map,f))}click(d,f){this._mousedownPos&&this._mousedownPos.dist(f)>=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 cg(d.type,this._map,d))}touchmove(d){this._map.fire(new cg(d.type,this._map,d))}touchend(d){this._map.fire(new cg(d.type,this._map,d))}touchcancel(d){this._map.fire(new cg(d.type,this._map,d))}_firePreventable(d){if(this._map.fire(d),d.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class eM{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 UN{constructor(d,f){this._map=d,this._el=d.getCanvasContainer(),this._container=d.getContainer(),this._clickTolerance=f.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(d,f){this.isEnabled()&&d.shiftKey&&d.button===0&&(R(),this._startPos=this._lastPos=f,this._active=!0)}mousemoveWindow(d,f){if(!this._active)return;const j=f,I=this._startPos,O=this._lastPos;if(!I||!O||O.equals(j)||!this._box&&j.dist(I){this._box&&(this._box.style.transform=`translate(${F}px,${W}px)`,this._box.style.width=B-F+"px",this._box.style.height=J-W+"px")})}mouseupWindow(d,f){if(!this._active)return;const j=this._startPos,I=f;if(j&&d.button===0){if(this.reset(),q(),j.x!==I.x||j.y!==I.y)return this._map.fire(new i.z("boxzoomend",{originalEvent:d})),{cameraAnimation:O=>O.fitScreenCoordinates(j,I,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,f){return this._map.fire(new i.z(d,{originalEvent:f}))}}function qN(w,d){const f={};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(I){const O=new i.P(0,0);for(const F of I)O._add(F);return O.div(I.length)}(f),this.touches=qN(j,f)))}touchmove(d,f,j){if(this.aborted||!this.centroid)return;const I=qN(j,f);for(const O in this.touches){const F=I[O];(!F||F.dist(this.touches[O])>30)&&(this.aborted=!0)}}touchend(d,f,j){if((!this.centroid||d.timeStamp-this.startTime>500)&&(this.aborted=!0),j.length===0){const I=!this.aborted&&this.centroid;if(this.reset(),I)return I}}}class VN{constructor(d){this.singleTap=new T6(d),this.numTaps=d.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(d,f,j){this.singleTap.touchstart(d,f,j)}touchmove(d,f,j){this.singleTap.touchmove(d,f,j)}touchend(d,f,j){const I=this.singleTap.touchend(d,f,j);if(I){const O=d.timeStamp-this.lastTime<500,F=!this.lastTap||this.lastTap.dist(I)<30;if(O&&F||this.reset(),this.count++,this.lastTime=d.timeStamp,this.lastTap=I,this.count===this.numTaps)return this.reset(),I}}}class A6{constructor(){this._zoomIn=new VN({numTouches:1,numTaps:2}),this._zoomOut=new VN({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(d,f,j){this._zoomIn.touchstart(d,f,j),this._zoomOut.touchstart(d,f,j)}touchmove(d,f,j){this._zoomIn.touchmove(d,f,j),this._zoomOut.touchmove(d,f,j)}touchend(d,f,j){const I=this._zoomIn.touchend(d,f,j),O=this._zoomOut.touchend(d,f,j);return I?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:F=>F.easeTo({duration:300,zoom:F.getZoom()+1,around:F.unproject(I)},{originalEvent:d})}):O?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:F=>F.easeTo({duration:300,zoom:F.getZoom()-1,around:F.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 E6={0:1,2:2},tM={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class HN{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,f){return!1}_move(d,f){return{}}mousedown(d,f){if(this._lastPoint)return;const j=Q(d);this._correctButton(d,j)&&(this._lastPoint=f,this._eventButton=j)}mousemoveWindow(d,f){const j=this._lastPoint;if(j){if(d.preventDefault(),this._eventButton!=null&&function(I,O){const F=E6[O];return I.buttons===void 0||(I.buttons&F)!==F}(d,this._eventButton))this.reset();else if(this._moved||!(f.dist(j)0&&(this._active=!0);const I=qN(j,f),O=new i.P(0,0),F=new i.P(0,0);let B=0;for(const J in I){const te=I[J],me=this._touches[J];me&&(O._add(te),F._add(te.sub(me)),B++,I[J]=te)}if(this._touches=I,B{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class WN{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(d){}_move(d,f,j){return{}}touchstart(d,f,j){this._firstTwoTouches||j.length<2||(this._firstTwoTouches=[j[0].identifier,j[1].identifier],this._start([f[0],f[1]]))}touchmove(d,f,j){const I=this._firstTwoTouches;if(!I)return;d.preventDefault();const[O,F]=I,B=d_(j,f,O),W=d_(j,f,F);if(!B||!W)return;const J=this._aroundCenter?null:B.add(W).div(2);return this._move([B,W],J,d)}touchend(d,f,j){if(!this._firstTwoTouches)return;const[I,O]=this._firstTwoTouches,F=d_(j,f,I),B=d_(j,f,O);F&&B||(this._active&&q(),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 d_(w,d,f){for(let j=0;jMath.abs(w.x)}class hoe extends WN{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,GN(d[0].sub(d[1]))&&(this._valid=!1)}_move(d,f,j){const I=this._lastPoints;if(!I)return;const O=d[0].sub(I[0]),F=d[1].sub(I[1]);return this._map._cooperativeGestures&&!i.eU()&&j.touches.length<3||(this._valid=this.gestureBeginsVertically(O,F,j.timeStamp),!this._valid)?void 0:(this._lastPoints=d,this._active=!0,{pitchDelta:(O.y+F.y)/2*-.5})}gestureBeginsVertically(d,f,j){if(this._valid!==void 0)return this._valid;const I=d.mag()>=2,O=f.mag()>=2;if(!I&&!O)return;if(!I||!O)return this._firstMove==null&&(this._firstMove=j),j-this._firstMove<100&&void 0;const F=d.y>0==f.y>0;return GN(d)&&GN(f)&&F}}const moe={panStep:100,bearingStep:15,pitchStep:10};class poe{constructor(){const d=moe;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 f=0,j=0,I=0,O=0,F=0;switch(d.keyCode){case 61:case 107:case 171:case 187:f=1;break;case 189:case 109:case 173:f=-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?I=1:(d.preventDefault(),F=-1);break;case 40:d.shiftKey?I=-1:(d.preventDefault(),F=1);break;default:return}return this._rotationDisabled&&(j=0,I=0),{cameraAnimation:B=>{const W=B.getZoom();B.easeTo({duration:300,easeId:"keyboardHandler",easing:u_,zoom:f?Math.round(W)+f*(d.shiftKey?2:1):W,bearing:B.getBearing()+j*this._bearingStep,pitch:B.getPitch()+I*this._pitchStep,offset:[-O*this._panStep,-F*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 u_(w){return w*(2-w)}const nM=4.000244140625,aM=1/450;class KN{constructor(d,f){this._map=d,this._el=d.getCanvasContainer(),this._handler=f,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=aM,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 f=d.deltaMode===WheelEvent.DOM_DELTA_LINE?40*d.deltaY:d.deltaY;const j=i.o.now(),I=j-(this._lastWheelEventTime||0);this._lastWheelEventTime=j,f!==0&&f%nM==0?this._type="wheel":f!==0&&Math.abs(f)<4?this._type="trackpad":I>400?(this._type=null,this._lastValue=f,this._timeout=window.setTimeout(this._onTimeout,40,d)):this._type||(this._type=Math.abs(I*f)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,f+=this._lastValue)),d.shiftKey&&f&&(f/=4),this._type&&(this._lastWheelEvent=d,this._delta-=f,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 f=H(this._el,d);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:f,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 f=()=>d._terrainEnabled()&&this._aroundCoord?d.computeZoomRelativeTo(this._aroundCoord):d.zoom;if(this._delta!==0){const J=this._type==="wheel"&&Math.abs(this._delta)>nM?this._wheelZoomRate:this._defaultZoomRate;let te=2/(1+Math.exp(-Math.abs(this._delta*J)));this._delta<0&&te!==0&&(te=1/te);const me=f(),ue=Math.pow(2,me),pe=typeof this._targetZoom=="number"?d.zoomScale(this._targetZoom):ue;this._targetZoom=Math.min(d.maxZoom,Math.max(d.minZoom,d.scaleZoom(pe*te))),this._type==="wheel"&&(this._startZoom=me,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const j=typeof this._targetZoom=="number"?this._targetZoom:f(),I=this._startZoom,O=this._easing;let F,B=!1;if(this._type==="wheel"&&I&&O){const J=Math.min((i.o.now()-this._lastWheelEventTime)/200,1),te=O(J);F=i.ak(I,j,te),J<1?this._frameId||(this._frameId=!0):B=!0}else F=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 W=F-f();return W*this._lastDelta<0&&(W=0),{noInertia:!0,needsRenderFrame:!B,zoomDelta:W,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(d){let f=i.eV;if(this._prevEase){const j=this._prevEase,I=(i.o.now()-j.start)/j.duration,O=j.easing(I+.01)-j.easing(I),F=.27/Math.sqrt(O*O+1e-4)*.01,B=Math.sqrt(.0729-F*F);f=i.eT(F,B,.25,1)}return this._prevEase={start:i.o.now(),duration:d,easing:f},f}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 Bp{constructor(d,f){this._clickZoom=d,this._tapZoom=f}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 ZN{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(d,f){return d.preventDefault(),{cameraAnimation:j=>{j.easeTo({duration:300,zoom:j.getZoom()+(d.shiftKey?-1:1),around:j.unproject(f)},{originalEvent:d})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class el{constructor(){this._tap=new VN({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,f,j){this._swipePoint||(this._tapTime&&d.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?j.length>0&&(this._swipePoint=f[0],this._swipeTouch=j[0].identifier):this._tap.touchstart(d,f,j))}touchmove(d,f,j){if(this._tapTime){if(this._swipePoint){if(j[0].identifier!==this._swipeTouch)return;const I=f[0],O=I.y-this._swipePoint.y;return this._swipePoint=I,d.preventDefault(),this._active=!0,{zoomDelta:O/128}}}else this._tap.touchmove(d,f,j)}touchend(d,f,j){this._tapTime?this._swipePoint&&j.length===0&&this.reset():this._tap.touchend(d,f,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 qm{constructor(d,f,j){this._el=d,this._mousePan=f,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 h_{constructor(d,f,j){this._pitchWithRotate=d.pitchWithRotate,this._mouseRotate=f,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 YN{constructor(d,f,j,I){this._el=d,this._touchZoom=f,this._touchRotate=j,this._tapDragZoom=I,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 m_=w=>w.zoom||w.drag||w.pitch||w.rotate;class foe extends i.z{}class p_{constructor(){this.constants=[1,1,.01],this.radius=0}setup(d,f){const j=i.av([],f,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 f=i.c5([],d,this.radius);if(f[2]>0){const j=i.c5([],[0,0,1],i.bJ(f,[0,0,1])),I=i.c5([],i.aw([],[f[0],f[1],0]),this.radius),O=i.d8([],f,i.c5([],i.av([],i.d8([],I,j),f),2));f[0]=O[0],f[1]=O[1]}return f}}function XN(w){return w.panDelta&&w.panDelta.mag()||w.zoomDelta||w.bearingDelta||w.pitchDelta}class goe{constructor(d,f){this._map=d,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Q5(d),this._bearingSnap=f.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new p_,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(f),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[I,O,F]of this._listeners){const B=I===document?this.handleWindowEvent:this.handleEvent;I.addEventListener(O,B,F)}}destroy(){for(const[d,f,j]of this._listeners){const I=d===document?this.handleWindowEvent:this.handleEvent;d.removeEventListener(f,I,j)}}_addDefaultHandlers(d){const f=this._map,j=f.getCanvasContainer();this._add("mapEvent",new $N(f,d));const I=f.boxZoom=new UN(f,d);this._add("boxZoom",I);const O=new A6,F=new ZN;f.doubleClickZoom=new Bp(F,O),this._add("tapZoom",O),this._add("clickZoom",F);const B=new el;this._add("tapDragZoom",B);const W=f.touchPitch=new hoe(f);this._add("touchPitch",W);const J=new rM(d),te=new sM(d);f.dragRotate=new h_(d,J,te),this._add("mouseRotate",J,["mousePitch"]),this._add("mousePitch",te,["mouseRotate"]);const me=new I6(d),ue=new P6(f,d);f.dragPan=new qm(j,me,ue),this._add("mousePan",me),this._add("touchPan",ue,["touchZoom","touchRotate"]);const pe=new Vi,ke=new uoe;f.touchZoomRotate=new YN(j,ke,pe,B),this._add("touchRotate",pe,["touchPan","touchZoom"]),this._add("touchZoom",ke,["touchPan","touchRotate"]),this._add("blockableMapEvent",new eM(f));const _e=f.scrollZoom=new KN(f,this);this._add("scrollZoom",_e,["mousePan"]);const Fe=f.keyboard=new poe;this._add("keyboard",Fe);for(const Re of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])d.interactive&&d[Re]&&f[Re].enable(d[Re])}_add(d,f,j){this._handlers.push({handlerName:d,handler:f,allowed:j}),this._handlersById[d]=f}stop(d){if(!this._updatingCamera){for(const{handler:f}of this._handlers)f.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!!m_(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(d,f,j){for(const I in d)if(I!==j&&(!f||f.indexOf(I)<0))return!0;return!1}handleWindowEvent(d){this.handleEvent(d,`${d.type}Window`)}_getMapTouches(d){const f=[];for(const j of d)this._el.contains(j.target)&&f.push(j);return f}handleEvent(d,f){this._updatingCamera=!0;const j=d.type==="renderFrame",I=j?void 0:d,O={needsRenderFrame:!1},F={},B={},W=d.touches?this._getMapTouches(d.touches):void 0,J=W?G(this._el,W):j?void 0:H(this._el,d);for(const{handlerName:ue,handler:pe,allowed:ke}of this._handlers){if(!pe.isEnabled())continue;let _e;this._blockedByActive(B,ke,ue)?pe.reset():pe[f||d.type]&&(_e=pe[f||d.type](d,J,W),this.mergeHandlerResult(O,F,_e,ue,I),_e&&_e.needsRenderFrame&&this._triggerRenderFrame()),(_e||pe.isActive())&&(B[ue]=pe)}const te={};for(const ue in this._previousActiveHandlers)B[ue]||(te[ue]=I);this._previousActiveHandlers=B,(Object.keys(te).length||XN(O))&&(this._changes.push([O,F,te]),this._triggerRenderFrame()),(Object.keys(B).length||XN(O))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:me}=O;me&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],me(this._map))}mergeHandlerResult(d,f,j,I,O){if(!j)return;Object.assign(d,j);const F={handlerName:I,originalEvent:j.originalEvent||O};j.zoomDelta!==void 0&&(f.zoom=F),j.panDelta!==void 0&&(f.drag=F),j.pitchDelta!==void 0&&(f.pitch=F),j.bearingDelta!==void 0&&(f.rotate=F)}_applyChanges(){const d={},f={},j={};for(const[I,O,F]of this._changes)I.panDelta&&(d.panDelta=(d.panDelta||new i.P(0,0))._add(I.panDelta)),I.zoomDelta&&(d.zoomDelta=(d.zoomDelta||0)+I.zoomDelta),I.bearingDelta&&(d.bearingDelta=(d.bearingDelta||0)+I.bearingDelta),I.pitchDelta&&(d.pitchDelta=(d.pitchDelta||0)+I.pitchDelta),I.around!==void 0&&(d.around=I.around),I.aroundCoord!==void 0&&(d.aroundCoord=I.aroundCoord),I.pinchAround!==void 0&&(d.pinchAround=I.pinchAround),I.noInertia&&(d.noInertia=I.noInertia),Object.assign(f,O),Object.assign(j,F);this._updateMapTransform(d,f,j),this._changes=[]}_updateMapTransform(d,f,j){const I=this._map,O=I.transform,F=We=>[We.x,We.y,We.z];if((We=>{const at=this._eventsInProgress.drag;return at&&!this._handlersById[at.handlerName].isActive()})()&&!XN(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&&I._stop(!0),!XN(d))return void this._fireEvents(f,j,!0);let{panDelta:B,zoomDelta:W,bearingDelta:J,pitchDelta:te,around:me,aroundCoord:ue,pinchAround:pe}=d;O._isCameraConstrained&&(W>0&&(W=0),O._isCameraConstrained=!1),pe!==void 0&&(me=pe),(W||(We=>f[We]&&!this._eventsInProgress[We])("drag"))&&me&&(this._dragOrigin=F(O.pointCoordinate3D(me)),this._originalZoom=O.zoom,this._trackingEllipsoid.setup(O._camera.position,this._dragOrigin)),O.cameraElevationReference="sea",I._stop(!0),me=me||I.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(me).dir),at=this._trackingEllipsoid.projectRay(O.screenPointToMercatorRay(me.sub(B)).dir);ke[0]=at[0]-We[0],ke[1]=at[1]-We[1]}else{const We=O.pointCoordinate(me);if(O.projection.name==="globe"){B=B.rotate(-O.angle);const at=O._pixelsPerMercatorPixel/O.worldSize;ke[0]=-B.x*i.eW(i.a$(We.y))*at,ke[1]=-B.y*i.eW(O.center.lat)*at}else{const at=O.pointCoordinate(me.sub(B));We&&at&&(ke[0]=at.x-We.x,ke[1]=at.y-We.y)}}const _e=O.zoom,Fe=[0,0,0];if(W){const We=F(ue||O.pointCoordinate3D(me)),at={dir:i.aw([],i.av([],We,O._camera.position))};if(at.dir[2]<0){const Ge=O.zoomDeltaToMovement(We,W);i.c5(Fe,at.dir,Ge)}}const Re=i.d8(ke,ke,Fe);O._translateCameraConstrained(Re),W&&Math.abs(O.zoom-_e)>1e-4&&O.recenterOnTerrain(),O.cameraElevationReference="ground",this._map._update(),d.noInertia||this._inertia.record(d),this._fireEvents(f,j,!0)}_fireEvents(d,f,j){const I=m_(this._eventsInProgress),O=m_(d),F={};for(const te in d){const{originalEvent:me}=d[te];this._eventsInProgress[te]||(F[`${te}start`]=me),this._eventsInProgress[te]=d[te]}!I&&O&&this._fireEvent("movestart",O.originalEvent);for(const te in F)this._fireEvent(te,F[te]);O&&this._fireEvent("move",O.originalEvent);for(const te in d){const{originalEvent:me}=d[te];this._fireEvent(te,me)}const B={};let W;for(const te in this._eventsInProgress){const{handlerName:me,originalEvent:ue}=this._eventsInProgress[te];this._handlersById[me].isActive()||(delete this._eventsInProgress[te],W=f[me]||ue,B[`${te}end`]=W)}for(const te in B)this._fireEvent(te,B[te]);const J=m_(this._eventsInProgress);if(j&&(I||O)&&!J){this._updatingCamera=!0;const te=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),me=ue=>ue!==0&&-this._bearingSnap{this._frameId=void 0,this.handleEvent(new foe("renderFrame",{timeStamp:d})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const QN="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class iM extends i.E{constructor(d,f){super(),this._moving=!1,this._zooming=!1,this.transform=d,this._bearingSnap=f.bearingSnap,this._respectPrefersReducedMotion=f.respectPrefersReducedMotion!==!1,i.aY(["_renderFrameCallback"],this)}getCenter(){return new i.aT(this.transform.center.lng,this.transform.center.lat)}setCenter(d,f){return this.jumpTo({center:d},f)}panBy(d,f,j){return d=i.P.convert(d).mult(-1),this.panTo(this.transform.center,Object.assign({offset:d},f),j)}panTo(d,f,j){return this.easeTo(Object.assign({center:d},f),j)}getZoom(){return this.transform.zoom}setZoom(d,f){return this.jumpTo({zoom:d},f),this}zoomTo(d,f,j){return this.easeTo(Object.assign({zoom:d},f),j)}zoomIn(d,f){return this.zoomTo(this.getZoom()+1,d,f),this}zoomOut(d,f){return this.zoomTo(this.getZoom()-1,d,f),this}getBearing(){return this.transform.bearing}setBearing(d,f){return this.jumpTo({bearing:d},f),this}getPadding(){return this.transform.padding}setPadding(d,f){return this.jumpTo({padding:d},f),this}rotateTo(d,f,j){return this.easeTo(Object.assign({bearing:d},f),j)}resetNorth(d,f){return this.rotateTo(0,Object.assign({duration:1e3},d),f),this}resetNorthPitch(d,f){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},d),f),this}snapToNorth(d,f){return Math.abs(this.getBearing())d.aspect?j/(2*Math.tan(.5*d.fovX)*d.aspect):I/(2*Math.tan(.5*d.fovY)*d.aspect)}_cameraForBoundsOnGlobe(d,f,j,I,O,F){const B=d.clone(),W=this._extendCameraOptions(F);B.bearing=I,B.pitch=O;const J=i.aT.convert(f),te=i.aT.convert(j),me=.5*(J.lat+te.lat),ue=.5*(J.lng+te.lng),pe=i.eZ(me,ue),ke=i.aw([],pe),_e=i.aw([],i.bI([],ke,[0,1,0])),Fe=i.bI([],_e,ke),Re=[_e[0],_e[1],_e[2],0,Fe[0],Fe[1],Fe[2],0,ke[0],ke[1],ke[2],0,0,0,0,1],We=[pe,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(me,J.lng),i.eZ(me,te.lng),i.eZ(J.lat,ue),i.eZ(te.lat,ue)];let at=i.d9.fromPoints(We.map(Zt=>[i.bJ(_e,Zt),i.bJ(Fe,Zt),i.bJ(ke,Zt)]));const Ge=i.af([],at.center,Re);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 kt=B.getWorldToCameraMatrix(),yt=i.bl(new Float64Array(16),kt);at=i.d9.applyTransform(at,i.aB([],kt,Re));const bt=this._extendAABB(at,B,W,I);if(!bt)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");at=bt,i.af(Ge,Ge,kt);const ft=.5*(at.max[2]-at.min[2]),ht=this._minimumAABBFrustumDistance(B,at),Ct=i.c5([],[0,0,1],ft),Rt=i.d8(Ct,Ge,Ct),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,yt);const br=i.eM/i.aD,Ht=i.ag(lr),Et=i.cf(Math.max(Ht*br-i.eM,Number.EPSILON),0),er=Math.min(B.zoomFromMercatorZAdjusted(Et),W.maxZoom);return er>.5*(i.c_+i.cL)?(B.setProjection({name:"mercator"}),B.zoom=er,this._cameraForBounds(B,f,j,I,O,F)):{center:B.center,zoom:er,bearing:I,pitch:O}}_extendAABB(d,f,j,I){const O=.5*((j.padding.left||0)+(j.padding.right||0)),F=.5*((j.padding.top||0)+(j.padding.bottom||0)),B=F,W=O,J=O,te=F,me=f.width-(W+J),ue=f.height-(B+te),pe=i.av([],d.max,d.min),ke=Math.min(me/pe[0],ue/pe[1]),_e=Math.min(f.scaleZoom(f.scale*ke),j.maxZoom);if(isNaN(_e))return null;const Fe=f.scale/f.zoomScale(_e),Re=new i.d9([d.min[0]-W*Fe,d.min[1]-te*Fe,d.min[2]],[d.max[0]+J*Fe,d.max[1]+B*Fe,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(I));return Re.center[0]-=We.x*Fe,Re.center[1]+=We.y*Fe,Re}queryTerrainElevation(d,f){const j=this.transform.elevation;return j?(f=Object.assign({},{exaggerated:!0},f),j.getAtPoint(i.ae.fromLngLat(d),null,f.exaggerated)):null}_cameraForBounds(d,f,j,I,O,F){if(d.projection.name==="globe")return this._cameraForBoundsOnGlobe(d,f,j,I,O,F);const B=d.clone(),W=this._extendCameraOptions(F);B.bearing=I,B.pitch=O;const J=i.aT.convert(f),te=i.aT.convert(j),me=new i.aT(J.lng,te.lat),ue=new i.aT(te.lng,J.lat),pe=B.project(J),ke=B.project(te),_e=this.queryTerrainElevation(J),Fe=this.queryTerrainElevation(te),Re=this.queryTerrainElevation(me),We=this.queryTerrainElevation(ue),at=[[pe.x,pe.y,Math.min(_e||0,Fe||0,Re||0,We||0)],[ke.x,ke.y,Math.max(_e||0,Fe||0,Re||0,We||0)]];let Ge=i.d9.fromPoints(at);const kt=B.getWorldToCameraMatrix(),yt=i.bl(new Float64Array(16),kt);Ge=i.d9.applyTransform(Ge,kt);const bt=this._extendAABB(Ge,B,W,I);if(!bt)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");Ge=bt;const ft=.5*i.av([],Ge.max,Ge.min)[2],ht=this._minimumAABBFrustumDistance(B,Ge),Ct=[0,0,1,0];i.aC(Ct,Ct,kt),i.f1(Ct,Ct);const Rt=i.c5([],Ct,ht+ft),Dt=i.d8([],Ge.center,Rt);i.af(Ge.center,Ge.center,yt),i.af(Dt,Dt,yt);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),W.maxZoom);return B.mercatorFromTransition&&br<.5*(i.c_+i.cL)?(B.setProjection({name:"globe"}),B.zoom=br,this._cameraForBounds(B,f,j,I,O,F)):{center:Yt,zoom:br,bearing:I,pitch:O}}fitBounds(d,f,j){const I=this.cameraForBounds(d,f);return this._fitInternal(I,f,j)}fitScreenCoordinates(d,f,j,I,O){const F=i.P.convert(d),B=i.P.convert(f),W=new i.P(Math.min(F.x,B.x),Math.min(F.y,B.y)),J=new i.P(Math.max(F.x,B.x),Math.max(F.y,B.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(F,B))return this;const te=this.transform.pointLocation3D(W),me=this.transform.pointLocation3D(J),ue=this.transform.pointLocation3D(new i.P(W.x,J.y)),pe=this.transform.pointLocation3D(new i.P(J.x,W.y)),ke=[Math.min(te.lng,me.lng,ue.lng,pe.lng),Math.min(te.lat,me.lat,ue.lat,pe.lat)],_e=[Math.max(te.lng,me.lng,ue.lng,pe.lng),Math.max(te.lat,me.lat,ue.lat,pe.lat)],Fe=I&&I.pitch?I.pitch:this.getPitch(),Re=this._cameraForBounds(this.transform,ke,_e,j,Fe,I);return this._fitInternal(Re,I,O)}_fitInternal(d,f,j){return d?(f=Object.assign(d,f)).linear?this.easeTo(f,j):this.flyTo(f,j):this}jumpTo(d,f){this.stop();const j=d.preloadOnly?this.transform.clone():this.transform;let I=!1,O=!1,F=!1;"zoom"in d&&j.zoom!==+d.zoom&&(I=!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&&(F=!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 W=j.clone();W.padding=B,j.setLocationAtPoint(j.center,W.centerPoint)}else j.padding=B;return d.preloadOnly?(this._preloadTiles(j),this):(this.fire(new i.z("movestart",f)).fire(new i.z("move",f)),I&&this.fire(new i.z("zoomstart",f)).fire(new i.z("zoom",f)).fire(new i.z("zoomend",f)),O&&this.fire(new i.z("rotatestart",f)).fire(new i.z("rotate",f)).fire(new i.z("rotateend",f)),F&&this.fire(new i.z("pitchstart",f)).fire(new i.z("pitch",f)).fire(new i.z("pitchend",f)),this.fire(new i.z("moveend",f)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||i.w(QN),this.transform.getFreeCameraOptions()}setFreeCameraOptions(d,f){const j=this.transform;if(!j.projection.supportsFreeCamera)return i.w(QN),this;this.stop();const I=j.zoom,O=j.pitch,F=j.bearing;j.setFreeCameraOptions(d);const B=I!==j.zoom,W=O!==j.pitch,J=F!==j.bearing;return this.fire(new i.z("movestart",f)).fire(new i.z("move",f)),B&&this.fire(new i.z("zoomstart",f)).fire(new i.z("zoom",f)).fire(new i.z("zoomend",f)),J&&this.fire(new i.z("rotatestart",f)).fire(new i.z("rotate",f)).fire(new i.z("rotateend",f)),W&&this.fire(new i.z("pitchstart",f)).fire(new i.z("pitch",f)).fire(new i.z("pitchend",f)),this.fire(new i.z("moveend",f)),this}easeTo(d,f){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,I=this.getZoom(),O=this.getBearing(),F=this.getPitch(),B=this.getPadding(),W="zoom"in d?+d.zoom:I,J="bearing"in d?this._normalizeBearing(d.bearing,O):O,te="pitch"in d?+d.pitch:F,me=this._extendPadding(d.padding),ue=i.P.convert(d.offset);let pe,ke,_e;if(j.projection.name==="globe"){const Ct=i.ae.fromLngLat(j.center),Rt=ue.rotate(-j.angle);Ct.x+=Rt.x/j.worldSize,Ct.y+=Rt.y/j.worldSize;const Dt=Ct.toLngLat(),Yt=i.aT.convert(d.center||Dt);this._normalizeCenter(Yt),pe=j.centerPoint.add(Rt),ke=new i.P(Ct.x,Ct.y).mult(j.worldSize),_e=new i.P(i.aF(Yt.lng),i.aJ(Yt.lat)).mult(j.worldSize).sub(ke)}else{pe=j.centerPoint.add(ue);const Ct=j.pointLocation(pe),Rt=i.aT.convert(d.center||Ct);this._normalizeCenter(Rt),ke=j.project(Ct),_e=j.project(Rt).sub(ke)}const Fe=j.zoomScale(W-I);let Re,We;d.around&&(Re=i.aT.convert(d.around),We=j.locationPoint(Re));const at=this._zooming||W!==I,Ge=this._rotating||O!==J,kt=this._pitching||te!==F,yt=!j.isPaddingEqual(me),bt=d.retainPadding===!1?j.clone():j,ft=Ct=>Rt=>{if(at&&(Ct.zoom=i.ak(I,W,Rt)),Ge&&(Ct.bearing=i.ak(O,J,Rt)),kt&&(Ct.pitch=i.ak(F,te,Rt)),yt&&(bt.interpolatePadding(B,me,Rt),pe=bt.centerPoint.add(ue)),Re)Ct.setLocationAtPoint(Re,We);else{const Dt=Ct.zoomScale(Ct.zoom-I),Yt=W>I?Math.min(2,Fe):Math.max(.5,Fe),Xt=Math.pow(Yt,1-Rt),lr=Ct.unproject(ke.add(_e.mult(Rt*Xt)).mult(Dt));Ct.setLocationAtPoint(Ct.renderWorldCopies?lr.wrap():lr,pe)}return d.preloadOnly||this._fireMoveEvents(f),Ct};if(d.preloadOnly){const Ct=this._emulate(ft,d.duration,j);return this._preloadTiles(Ct),this}const ht={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=at,this._rotating=Ge,this._pitching=kt,this._padding=yt,this._easeId=d.easeId,this._prepareEase(f,d.noMoveStart,ht),this._ease(ft(j),Ct=>{j.cameraElevationReference==="sea"&&j.recenterOnTerrain(),this._afterEase(f,Ct)},d),this}_prepareEase(d,f,j={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),f||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,f){if(this._easeId&&f&&this._easeId===f)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const j=this._zooming,I=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)),I&&this.fire(new i.z("rotateend",d)),O&&this.fire(new i.z("pitchend",d)),this.fire(new i.z("moveend",d))}flyTo(d,f){if(this._prefersReducedMotion(d)){const Zt=i.aH(d,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(Zt,f)}this.stop(),d=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:i.eV},d);const j=this.transform,I=this.getZoom(),O=this.getBearing(),F=this.getPitch(),B=this.getPadding(),W="zoom"in d?i.aA(+d.zoom,j.minZoom,j.maxZoom):I,J="bearing"in d?this._normalizeBearing(d.bearing,O):O,te="pitch"in d?+d.pitch:F,me=this._extendPadding(d.padding),ue=j.zoomScale(W-I),pe=i.P.convert(d.offset);let ke=j.centerPoint.add(pe);const _e=j.pointLocation(ke),Fe=i.aT.convert(d.center||_e);this._normalizeCenter(Fe);const Re=j.project(_e),We=j.project(Fe).sub(Re);let at=d.curve;const Ge=Math.max(j.width,j.height),kt=Ge/ue,yt=We.mag();if("minZoom"in d){const Zt=i.aA(Math.min(d.minZoom,I,W),j.minZoom,j.maxZoom),hr=Ge/j.zoomScale(Zt-I);at=Math.sqrt(hr/yt*2)}const bt=at*at;function ft(Zt){const hr=(kt*kt-Ge*Ge+(Zt?-1:1)*bt*bt*yt*yt)/(2*(Zt?kt:Ge)*bt*yt);return Math.log(Math.sqrt(hr*hr+1)-hr)}function ht(Zt){return(Math.exp(Zt)-Math.exp(-Zt))/2}function Ct(Zt){return(Math.exp(Zt)+Math.exp(-Zt))/2}const Rt=ft(0);let Dt=function(Zt){return Ct(Rt)/Ct(Rt+at*Zt)},Yt=function(Zt){return Ge*((Ct(Rt)*(ht(hr=Rt+at*Zt)/Ct(hr))-ht(Rt))/bt)/yt;var hr},Xt=(ft(1)-Rt)/at;if(Math.abs(yt)<1e-6||!isFinite(Xt)){if(Math.abs(Ge-kt)<1e-6)return this.easeTo(d,f);const Zt=ktd.maxDuration&&(d.duration=0);const lr=O!==J,br=te!==F,Ht=!j.isPaddingEqual(me),Et=d.retainPadding===!1?j.clone():j,er=Zt=>hr=>{const Ir=hr*Xt,Xr=1/Dt(Ir);Zt.zoom=hr===1?W:I+Zt.scaleZoom(Xr),lr&&(Zt.bearing=i.ak(O,J,hr)),br&&(Zt.pitch=i.ak(F,te,hr)),Ht&&(Et.interpolatePadding(B,me,hr),ke=Et.centerPoint.add(pe));const Mr=hr===1?Fe:Zt.unproject(Re.add(We.mult(Yt(Ir))).mult(Xr));return Zt.setLocationAtPoint(Zt.renderWorldCopies?Mr.wrap():Mr,ke),Zt._updateCameraOnTerrain(),d.preloadOnly||this._fireMoveEvents(f),Zt};if(d.preloadOnly){const Zt=this._emulate(er,d.duration,j);return this._preloadTiles(Zt),this}return this._zooming=!0,this._rotating=lr,this._pitching=br,this._padding=Ht,this._prepareEase(f,!1),this._ease(er(j),()=>this._afterEase(f),d),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(d){}_cancelRenderFrame(d){}_stop(d,f){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,f)}if(!d){const j=this.handlers;j&&j.stop(!1)}return this}_ease(d,f,j){j.animate===!1||j.duration===0?(d(1),f()):(this._easeStart=i.o.now(),this._easeOptions=j,this._onEaseFrame=d,this._onEaseEnd=f,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const d=Math.min((i.o.now()-this._easeStart)/this._easeOptions.duration,1),f=this._onEaseFrame;f&&f(this._easeOptions.easing(d)),d<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(d,f){d=i.bT(d,-180,180);const j=Math.abs(d-f);return Math.abs(d-360-f)180?-360:j<-180?360:0}_prefersReducedMotion(d){return this._respectPrefersReducedMotion&&i.o.prefersReducedMotion&&!(d&&d.essential)}_emulate(d,f,j){const I=Math.ceil(15*f/1e3),O=[],F=d(j.clone());for(let B=0;B<=I;B++){const W=F(B/I);O.push(W.clone())}return O}_preloadTiles(d,f){}}class f_{constructor(d={}){this.options=d,i.aY(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(d){const f=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 I=k("span","mapboxgl-ctrl-icon",this._compactButton);return I.setAttribute("aria-hidden","true"),I.setAttribute("title",j),this._innerContainer=k("div","mapboxgl-ctrl-attrib-inner",this._container),f&&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),f===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 f=[{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=f.reduce((I,O,F)=>(O.value&&(I+=`${O.key}=${O.value}${FI.length-O.length),d=d.filter((I,O)=>{for(let F=O+1;F=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(I=>function(O){const F=new DOMParser().parseFromString(O,"text/html");return Array.from(F.body.querySelectorAll("*")).forEach(B=>{const W=B.textContent||"";if(B.tagName!=="A")return void B.replaceWith(F.createTextNode(W));const J=B.getAttribute("href");if(!J||!/^(https?:|mailto:)/i.test(J))return void B.replaceWith(F.createTextNode(W));const te=F.createElement("a");te.href=J,te.textContent=W,te.rel="noopener nofollow";const me=B.getAttribute("class");me&&(te.className=me),B.replaceWith(te)}),F.body.innerHTML}(I)).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 g_{constructor(){i.aY(["_updateLogo","_updateCompact"],this)}onAdd(d){this._map=d,this._container=k("div","mapboxgl-ctrl");const f=k("a","mapboxgl-ctrl-logo");return f.target="_blank",f.rel="noopener nofollow",f.href="https://www.mapbox.com/",f.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),f.setAttribute("rel","noopener nofollow"),this._container.appendChild(f),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 f in d){const j=d[f].getSource();if(j.hasOwnProperty("mapbox_logo")&&!j.mapbox_logo)return!1}return!0}_updateCompact(){const d=this._container.children;if(d.length){const f=d[0];this._map.getCanvasContainer().offsetWidth<250?f.classList.add("mapboxgl-compact"):f.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",f=>this._onIndoorUpdate(f)),this._container}_createButton(d,f){const j=k("button",d,this._container);return j.type="button",j.addEventListener("click",f),j}_createSeparator(){return k("div","mapboxgl-ctrl-separator",this._container)}_setButtonTitle(d,f){this._map&&(d.setAttribute("aria-label",f),d.textContent=f)}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 f=this._model;this._model=d,this._container.style.display="inline-block",this._container.style.borderRadius="8px",f&&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 f=this._map;this._model&&f&&f._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,f){for(let j=0;j{this._map._selectIndoorFloor(I.id)});this._setButtonTitle(O,I.zIndex.toString()),this._model&&I.id===this._model.selectedFloorId&&f&&O.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(O),j=this._endTime)return this._end;const f=i.dD((d-this._startTime)/(this._endTime-this._startTime));return this._start*(1-f)+this._end*f}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,f,j){this._start=this.getValue(f),this._end=d,this._startTime=f,this._endTime=f+j}}const qp={"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 dg extends i.z{constructor(d,f,j,I){const{point:O,lngLat:F,originalEvent:B,target:W}=d;super(d.type,{point:O,lngLat:F,originalEvent:B,target:W}),this.preventDefault=()=>{d.preventDefault()},this.id=f,this.interaction=j,this.feature=I}}class Qh{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,f){if(this.typeById.has(d))throw new Error(`Interaction id "${d}" already exists.`);const j=f.filter;let I=f.type;j&&this.filters.set(d,i.b6(j)),I==="mouseover"&&(I="mouseenter"),I==="mouseout"&&(I="mouseleave");const O=this.interactionsByType.get(I)||new Map;I==="mouseenter"||I==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(d,f)):O.size===0&&this.map.on(I,this.handleType),O.size===0&&this.interactionsByType.set(I,O),O.set(d,f),this.typeById.set(d,I)}get(d){const f=this.typeById.get(d);if(!f)return;const j=this.interactionsByType.get(f);return j?j.get(d):void 0}remove(d){const f=this.typeById.get(d);if(!f)return;this.typeById.delete(d),this.filters.delete(d);const j=this.interactionsByType.get(f);j&&(j.delete(d),f==="mouseenter"||f==="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(f,this.handleType))}queryTargets(d,f){const j=[];for(const[I,O]of f)O.target&&j.push({targetId:I,target:O.target,filter:this.filters.get(I)});return this.map.style.queryRenderedTargets(d,j,this.map.transform)}handleMove(d){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const f=this.queryTargets(d.point,Array.from(this.delegatedInteractions).reverse());f.length&&(d.type="mouseenter",this.handleType(d,f));const j=new Map;for(const[I,{feature:O}]of this.prevHoveredFeatures)this.hoveredFeatures.has(I)||j.set(O.id,O);j.size&&(d.type="mouseleave",this.handleType(d,Array.from(j.values())))}handleOut(d){const f=Array.from(this.hoveredFeatures.values()).map(({feature:j})=>j);f.length&&(d.type="mouseleave",this.handleType(d,f)),this.hoveredFeatures.clear()}handleType(d,f){const j=d.type==="mouseenter";if(j&&!this.interactionsByType.has(d.type))return void i.w("mouseenter interaction required for mouseleave to work.");const I=Array.from(this.interactionsByType.get(d.type)).reverse(),O=!!f;f=f||this.queryTargets(d.point,I);let F=!1;const B=new Set;for(const W of f){for(const[J,te]of I){if(!te.target)continue;const me=W.variants?W.variants[J]:null;if(me){for(const ue of me){if(Kf(ue,W,B,J))continue;const pe=new i.dx(W,ue),ke=Mp(ue,W,J);O&&pe.id!==void 0&&(pe.state=this.map.getFeatureState(pe));const _e=j?this.prevHoveredFeatures.get(ke):null,Fe=new dg(d,J,te,pe),Re=_e?_e.stop:te.handler(Fe);if(j&&this.hoveredFeatures.set(ke,{feature:W,stop:Re}),Re!==!1){F=!0;break}}if(F)break}}if(F)break}if(!F)for(const[W,J]of I){const{handler:te,target:me}=J;if(!me&&te(new dg(d,W,J,null))!==!1)break}}}function xoe(w,d){if(Array.isArray(w)&&Array.isArray(d)){const f=new Set(w),j=new Set(d);return f.size===j.size&&w.every(I=>j.has(I))}return i.by(w,d)}const yoe={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"},voe={showCompass:!0,showZoom:!0,visualizePitch:!1};class _oe{constructor(d,f,j=!1){this._clickTolerance=10,this.element=f,this.mouseRotate=new rM({clickTolerance:d.dragRotate._mouseRotate._clickTolerance}),this.map=d,j&&(this.mousePitch=new sM({clickTolerance:d.dragRotate._mousePitch._clickTolerance})),i.aY(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),f.addEventListener("mousedown",this.mousedown),f.addEventListener("touchstart",this.touchstart,{passive:!1}),f.addEventListener("touchmove",this.touchmove),f.addEventListener("touchend",this.touchend),f.addEventListener("touchcancel",this.reset)}down(d,f){this.mouseRotate.mousedown(d,f),this.mousePitch&&this.mousePitch.mousedown(d,f),R()}move(d,f){const j=this.map,I=this.mouseRotate.mousemoveWindow(d,f),O=I&&I.bearingDelta;if(O&&j.setBearing(j.getBearing()+O),this.mousePitch){const F=this.mousePitch.mousemoveWindow(d,f),B=F&&F.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()}),H(this.element,d)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(d){this.move(d,H(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)f.width||d.y>f.height;f.locationPoint3D(j).distSqr(d)180;){const j=f.locationPoint3D(w);if(j.x>=0&&j.y>=0&&j.x<=f.width&&j.y<=f.height)break;w.lng>f.center.lng?w.lng-=360:w.lng+=360}return w}const Oc={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%)"},yh={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class JN extends i.E{constructor(d,f){super(),(d instanceof HTMLElement||f)&&(d=Object.assign({element:d},f)),i.aY(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:j="center",color:I="#3FB1CE",scale:O=1,draggable:F=!1,clickTolerance:B=0,rotation:W=yh.rotation,rotationAlignment:J=yh.rotationAlignment,pitchAlignment:te=yh.pitchAlignment,occludedOpacity:me=yh.occludedOpacity,altitude:ue=yh.altitude}=d||{};this._anchor=j,this._color=I,this._scale=O,this._draggable=F,this._clickTolerance=B,this._rotation=W,this._rotationAlignment=J,this._pitchAlignment=te,this._occludedOpacity=me,this._altitude=ue,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 pe=this._element.classList;for(const _e in Oc)pe.remove(`mapboxgl-marker-anchor-${_e}`);pe.add(`mapboxgl-marker-anchor-${this._anchor}`);const ke=d&&d.className?d.className.trim().split(/\s+/):[];pe.add(...ke),this._popup=null}_createDefaultMarker(){const d=k("div"),f=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",{},f));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)"},f)}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"},f),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"},f),M("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},f),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||yh.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 I=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":[I,-1*(38.1-13.5+I)],"bottom-right":[-I,-1*(38.1-13.5+I)],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 f=d.code,j=d.charCode||d.keyCode;f!=="Space"&&f!=="Enter"&&j!==32&&j!==13||this.togglePopup()}_onMapClick(d){const f=d.originalEvent.target,j=this._element;this._popup&&(f===j||j.contains(f))&&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,f=this._pos;if(!d||!f)return!1;const j=d.unproject(f,this._altitude),I=d.getFreeCameraOptions();if(!I.position)return!1;const O=I.position.toLngLat();return O.distanceTo(j)<.9*O.distanceTo(this._lngLat)}_evaluateOpacity(){const d=this._map;if(!d)return;const f=this._pos;if(!f||f.x<0||f.x>d.transform.width||f.y<0||f.y>d.transform.height)return void this._clearFadeTimer();const j=d.unproject(f,this._altitude);let I;d._showingGlobe()&&i.f5(d.transform,this._lngLat)?I=0:(I=1-d._queryFogOpacity(j),d.transform._terrainEnabled()&&d.getTerrain()&&this._behindTerrain()&&(I*=this._occludedOpacity)),this._element.style.opacity=`${I}`,this._element.style.pointerEvents=I>0?"auto":"none",this._popup&&this._popup._setOpacity(I),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const d=this._pos;if(!d||!this._map)return;const f=this._offset.mult(this._scale);this._element.style.transform=` translate(${d.x}px,${d.y}px) ${Oc[this._anchor]} ${this._calculateXYTransform()} ${this._calculateZTransform()} translate(${f.x}px,${f.y}px) `}_calculateXYTransform(){const d=this._pos,f=this._map,j=this.getPitchAlignment();if(!f||!d||j!=="map")return"";if(!f._showingGlobe()){const W=f.getPitch();return W?`rotateX(${W}deg)`:""}const I=i.cX(i.f6(f.transform,this._lngLat)),O=d.sub(i.f7(f.transform)),F=Math.abs(O.x)+Math.abs(O.y);if(F===0)return"";const B=I/F;return`rotateX(${-O.y*B}deg) rotateY(${O.x*B}deg)`}_calculateZTransform(){const d=this._pos,f=this._map;if(!f||!d)return"";let j=0;const I=this.getRotationAlignment();if(I==="map")if(f._showingGlobe()){const O=f.project(new i.aT(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),F=f.project(new i.aT(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(O);j=i.cX(Math.atan2(F.y,F.x))-90}else j=-f.getBearing();else if(I==="horizon"){const O=i.ah(4,6,f.getZoom()),F=i.f7(f.transform);F.y+=O*f.transform.height;const B=d.sub(F),W=i.cX(Math.atan2(B.y,B.x));j=(W>90?W-270:W+90)*(1-O)}return j+=this._rotation,j?`rotateZ(${j}deg)`:""}_update(d){cancelAnimationFrame(this._updateFrameId);const f=this._map;f&&(f.transform.renderWorldCopies&&(this._lngLat=oM(this._lngLat,this._pos,f.transform)),this._pos=f.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(),f._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(f._showingGlobe()||f.getTerrain()||f.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 f=this._map;if(!f)return;const j=this._pointerdownPos,I=this._positionDelta;if(j&&I){if(!this._isDragging){const O=this._clickTolerance||f._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 u5(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 $p,this._domRenderTaskQueue=new $p,this._controls=[],this._markers=[],this._popups=[],this._mapId=i.b2(),this._locale=Object.assign({},qp,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 Up(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 f=document.getElementById(w.container);if(!f)throw new Error(`Container '${w.container.toString()}' not found.`);this._container=f}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 goe(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 K5(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 f=w.bounds;f&&(this.resize(),this.fitBounds(f,Object.assign({},w.fitBoundsOptions,{duration:0})))}this.resize(),w.attributionControl&&this.addControl(new f_({customAttribution:w.customAttribution})),this._logoControl=new g_,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",f=>{this._update(f.dataType==="style"),this.fire(new i.z(`${f.dataType}data`,f))}),this.on("dataloading",f=>{this.fire(new i.z(`${f.dataType}dataloading`,f))}),this._interactions=new Qh(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 f=w.onAdd(this);this._controls.push(w);const j=this._controlPositions[d];return d.indexOf("bottom")!==-1?j.insertBefore(f,j.firstChild):j.appendChild(f),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 f of this._controls)f._setLanguage&&f._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 f;d==="globe"&&w.zoom>=i.cL?(w.setMercatorFromTransition(),f=!0):d==="mercator"&&w.zoom=i.cL?this.transform.setMercatorFromTransition():this.transform.setProjection(w),this.style.applyProjectionUpdate();const j=this.transform.getProjection().name==="mercator"&&f!==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,f){const j=I=>{let O=[];if(Array.isArray(d)){const F=d.filter(B=>this.getLayer(B));O=F.length?this.queryRenderedFeatures(I,{layers:F}):[]}else O=this.queryRenderedFeatures(I,{target:d});return O};if(w==="mouseenter"||w==="mouseover"){let I=!1;return{listener:f,targets:d,delegates:{mousemove:F=>{const B=j(F.point);B.length?I||(I=!0,f.call(this,new Zd(w,this,F.originalEvent,{features:B}))):I=!1},mouseout:()=>{I=!1}}}}if(w==="mouseleave"||w==="mouseout"){let I=!1;return{listener:f,targets:d,delegates:{mousemove:B=>{j(B.point).length?I=!0:I&&(I=!1,f.call(this,new Zd(w,this,B.originalEvent)))},mouseout:B=>{I&&(I=!1,f.call(this,new Zd(w,this,B.originalEvent)))}}}}{const I=O=>{const F=j(O.point);F.length&&(O.features=F,f.call(this,O),delete O.features)};return{listener:f,targets:d,delegates:{[w]:I}}}}on(w,d,f){if(typeof d=="function"||f===void 0)return super.on(w,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const j=this._createDelegatedListener(w,d,f);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[w]=this._delegatedListeners[w]||[],this._delegatedListeners[w].push(j);for(const I in j.delegates)this.on(I,j.delegates[I]);return this}once(w,d,f){if(typeof d=="function"||f===void 0)return super.once(w,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const j=this._createDelegatedListener(w,d,f);for(const I in j.delegates)this.once(I,j.delegates[I]);return this}off(w,d,f){if(typeof d=="function"||f===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&&(I=>{for(let O=0;O{if(f){const I=typeof f=="string"?f:f instanceof Error?f.message:f.error;i.w(`Unable to perform style diff: ${I}. 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 f=Object.assign({},d);d&&d.config&&(f.initialConfig=d.config,delete f.config),this.style=new xh(this,f).load(w),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new xh(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,f){this._lazyInitEmptyStyle(),this.style.addSourceType(w,d,f)}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:f=1,sdf:j=!1,stretchX:I,stretchY:O,content:F}={}){this._lazyInitEmptyStyle();const B=i.I.from(w);if(d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap){const{width:W,height:J,data:te}=i.o.getImageData(d);this.style.addImage(B,{data:new i.q({width:W,height:J},te),pixelRatio:f,stretchX:I,stretchY:O,content:F,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:W,height:J}=d,te=d;this.style.addImage(B,{data:new i.q({width:W,height:J},new Uint8Array(te.data)),pixelRatio:f,stretchX:I,stretchY:O,content:F,sdf:j,usvg:!1,version:0,userImage:te}),te.onAdd&&te.onAdd(this,w)}}updateImage(w,d){this._lazyInitEmptyStyle();const f=i.I.from(w),j=this.style.getImage(f);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 I=d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap?i.o.getImageData(d):d,{width:O,height:F,data:B}=I;if(O===void 0||F===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)||F!==(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}, ${F}) must be that same as the previous version of the image (${j.data.width}, ${j.data.height})`)));const W=!(d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap);let J=!1;j.usvg?(j.data=new i.q({width:O,height:F},new Uint8Array(B)),j.usvg=!1,j.icon=void 0,J=!0):j.data.replace(B,W),this.style.updateImage(f,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),(f,j)=>{d(f,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(f=>this.fire(new i.y(new Error("Failed to add import",f)))),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,f){return this._isValidId(w)?(this.style.setLayerZoomRange(w,d,f),this._update(!0)):this}setFilter(w,d,f={}){return this._isValidId(w)?(this.style.setFilter(w,d,f),this._update(!0)):this}getFilter(w){return this._isValidId(w)?this.style.getFilter(w):null}setPaintProperty(w,d,f,j={}){return this._isValidId(w)?(this.style.setPaintProperty(w,d,f,j),this._update(!0)):this}getPaintProperty(w,d){return this._isValidId(w)?this.style.getPaintProperty(w,d):null}setLayoutProperty(w,d,f,j={}){return this._isValidId(w)?(this.style.setLayoutProperty(w,d,f,j),this._update(!0)):this}getLayoutProperty(w,d){return this._isValidId(w)?this.style.getLayoutProperty(w,d):null}setLayerProperty(w,d,f,j={}){return this._isValidId(w)?(d==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(w,d,f,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,f){return this.style.setConfigProperty(w,d,f),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 f,j,I,O=this._container;for(;O&&(!j||!I);){const F=window.getComputedStyle(O).transform;F&&F!=="none"&&(f=F.match(/matrix.*\((.+)\)/)[1].split(", "),f[0]&&f[0]!=="0"&&f[0]!=="1"&&(j=f[0]),f[3]&&f[3]!=="0"&&f[3]!=="1"&&(I=f[3])),O=O.parentElement}this._containerWidth=j?Math.abs(w/j):w,this._containerHeight=I?Math.abs(d/I):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 qP(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 f=this._controlContainer=k("div","mapboxgl-control-container",w),j=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(I=>{j[I]=k("div",`mapboxgl-ctrl-${I}`,f)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(w,d){const f=i.o.devicePixelRatio||1;this._canvas.width=f*Math.ceil(w),this._canvas.height=f*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 zN(d,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",f=>{f.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 f=this.painter.context.extTimerQuery,j=i.o.now(),I=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(d=I.createQuery(),I.beginQuery(f.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,me=i.o.now(),ue=new i.ac(J,{now:me,fadeDuration:O,pitch:te,transition:this.style.transition,worldview:this._worldview});this.style.update(ue)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let F=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),F=this._updateAverageElevation(j),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):F=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;I.endQuery(f.TIME_ELAPSED_EXT),setTimeout(()=>{const te=I.getQueryParameter(d,I.QUERY_RESULT)/1e6;I.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 W=this._sourcesDirty||this._styleDirty||this._placementDirty||F;if(W||this._repaint)this.triggerRepaint();else{const J=this.idle();if(J&&(F=this._updateAverageElevation(j,!0)),F)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||W||(this._fullyLoaded=!0,x.mark(m.fullLoad),this._performanceMetricsCollection&&et(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 f=I=>(this.transform.averageElevation=I,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&f(0);const j=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(j||(d||w-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(w)){const I=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 F=Math.abs(I-O);if(F>1){if(this._isInitialLoad||j)return this._averageElevation.jumpTo(O),f(O);this._averageElevation.easeTo(O,w,300)}else if(F>1e-4)return this._averageElevation.jumpTo(O),f(O)}return!!this._averageElevation.isEasing(w)&&f(this._averageElevation.getValue(w))}_authenticate(){Ve(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,w=>{if(w&&(w.message===he||w.status===401)){const d=this.painter.context.gl;rt(d,!1),this._logoControl instanceof g_&&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/")))}}),Ae(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&Ue(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&$e(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){xt(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 f=this.painter.context.gl,j=f.createFramebuffer();function I(O){f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,O,0);const F=new Uint8Array(f.drawingBufferWidth*f.drawingBufferHeight*4);return f.readPixels(0,0,f.drawingBufferWidth,f.drawingBufferHeight,f.RGBA,f.UNSIGNED_BYTE,F),F}return f.bindFramebuffer(f.FRAMEBUFFER,j),this._canvasPixelComparison(I(w),d.canvasCopies.map(I),d.timeStamps)}_canvasPixelComparison(w,d,f){let j=f[1]-f[0];const I=w.length/4;for(let O=0;O{const f=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,f&&this._render(d)}))}_preloadTiles(w){const d=this.style?this.style.getSourceCaches():[];return i.bw(d,(f,j)=>f._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({},voe,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 f=this._map;f&&(this.options.visualizePitch?f.resetNorthPitch({},{originalEvent:d}):f.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(),f=d===w.getMaxZoom(),j=d===w.getMinZoom();this._zoomInButton.disabled=f,this._zoomOutButton.disabled=j,this._zoomInButton.setAttribute("aria-disabled",f.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 _oe(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 f=k("button",w,this._container);return f.type="button",f.addEventListener("click",d),f}_setButtonTitle(w,d){if(!this._map)return;const f=this._map._getUIString(`NavigationControl.${d}`);w.setAttribute("aria-label",f),w.firstElementChild&&w.firstElementChild.setAttribute("title",f)}},GeolocateControl:class extends i.E{constructor(w={}){super();const d=navigator.geolocation;this.options=Object.assign({geolocation:d},boe,w),i.aY(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=BN(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=(f=!!this.options.geolocation)=>{this._supportsGeolocation=f,w(f)};this._supportsGeolocation!==void 0?w(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(f=>d(f.state!=="denied")).catch(()=>d()):d()}_isOutOfMapMaxBounds(w){const d=this._map.getMaxBounds(),f=w.coords;return!!d&&(f.longituded.getEast()||f.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),f=w.coords.accuracy,j=this._map.getBearing(),I=Object.assign({bearing:j},this.options.fitBoundsOptions);this._map.fitBounds(d.toBounds(f),I,{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,f=Math.ceil(2*this._accuracy*d);this._circleElement.style.width=`${f}px`,this._circleElement.style.height=`${f}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 JN({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=k("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new JN({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:f_,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,f=d._containerHeight/2,j=d._containerWidth/2-w/2,I=d.unproject([j,f]),O=d.unproject([j+w,f]),F=I.distanceTo(O);if(this.options.unit==="imperial"){const B=3.2808*F;B>5280?this._setScale(w,B/5280,"mile"):this._setScale(w,B,"foot")}else this.options.unit==="nautical"?this._setScale(w,F/1852,"nautical-mile"):F>=1e3?this._setScale(w,F/1e3,"kilometer"):this._setScale(w,F,"meter")}_setScale(w,d,f){this._map._requestDomTask(()=>{const j=function(O){const F=Math.pow(10,`${Math.floor(O)}`.length-1);let B=O/F;return B=B>=10?10:B>=5?5:B>=3?3:B>=2?2:B>=1?1:function(W){const J=Math.pow(10,Math.ceil(-Math.log(W)/Math.LN10));return Math.round(W*J)/J}(B),F*B}(d),I=j/d;this._container.innerHTML=f!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:f}).format(j):`${j} ${lM[f]}`,this._container.style.width=w*I+"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(vh),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(),f=document.createElement("body");let j;for(f.innerHTML=w;j=f.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 f=this._closeButton=k("button","mapboxgl-popup-close-button",d);f.type="button",f.setAttribute("aria-label","Close popup"),f.innerHTML='',f.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,f=this._container,j=this._pos;if(!d||!f||!j)return"bottom";const I=f.offsetWidth,O=f.offsetHeight,F=j.xd.transform.width-I/2;if(j.y+wd.transform.height-O){if(F)return"bottom-left";if(B)return"bottom-right"}return F?"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,f=this._content;if(!d||!this._lngLat&&!this._trackPointer||!f)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(f)),this.options.maxWidth&&j.style.maxWidth!==this.options.maxWidth&&(j.style.maxWidth=this.options.maxWidth),d.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=oM(this._lngLat,this._pos,d.transform)),!this._trackPointer||w){const I=this._pos=this._trackPointer&&w instanceof i.P?w:d.project(this._lngLat,this._altitude),O=Tx(this.options.offset),F=this._anchor=this._getAnchor(O.y),B=Tx(this.options.offset,F),W=I.add(B).round();d._requestDomTask(()=>{this._container&&F&&(this._container.style.transform=`${Oc[F]} translate(${W.x}px,${W.y}px)`)})}if(!this._marker&&d._showingGlobe()){const I=i.f5(d.transform,this._lngLat)?0:1;this._setOpacity(I)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const w=this._container.querySelector(_h);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:JN,Style:xh,LngLat:i.aT,LngLatBounds:i.aI,Point:i.P,MercatorCoordinate:i.ae,FreeCameraOptions:kd,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})})(BOe);var Ylt=BOe.exports;const sc=no(Ylt);function Cr({className:e,...t}){return r.jsx("div",{className:Ut("animate-pulse rounded-md bg-muted",e),...t})}const Zke={coming_soon:"#3B82F6",active:"#10B981",price_improvement:"#F97316",under_contract:"#8B5CF6",sold:"#6B7280"},Yke={coming_soon:"Coming Soon",active:"Active",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"};function Xlt(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:`$${(e/1e3).toFixed(0)}K`}function Qlt({listings:e,isLoading:t}){const s=Hs(),n=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(!n.current||!l||a.current)return;sc.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,E)=>M+E.longitude,0)/y.length,k=y.reduce((M,E)=>M+E.latitude,0)/y.length;v=[N,k],b=y.length===1?12:10}return a.current=new sc.Map({container:n.current,style:"mapbox://styles/mapbox/light-v11",zoom:b,center:v}),a.current.addControl(new sc.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 R,D,U;const b=Zke[v.status]||"#10B981",N=((R=v.photos)==null?void 0:R.find(q=>q.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}`,E=document.createElement("div");E.className="cursor-pointer",E.innerHTML=`
`;const T=new sc.Popup({offset:25,closeButton:!0,maxWidth:"280px"}).setHTML(`
${N!=null&&N.photo_url?``:""}
${Xlt(v.price)}
${v.property_address||""}
${v.city}, ${v.state}
${Yke[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 sc.Marker(E).setLngLat([v.longitude,v.latitude]).setPopup(T).addTo(a.current);o.current.push(P)}),y.length>1){const v=new sc.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=>{s(y)},()=>{delete window.__navigateToPublicListing__}),[s]),u||t?r.jsx(Cr,{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(Zke).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:Yke[y]})]},y))}),r.jsx("div",{ref:n,className:"w-full h-[500px] rounded-lg shadow-lg border border-gray-200"})]})}function zE(e,[t,s]){return Math.min(s,Math.max(t,e))}function hP(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 Jlt=[" ","Enter","ArrowUp","ArrowDown"],ect=[" ","Enter"],hk="Select",[zne,Bne,tct]=YI(hk),[R3]=uc(hk,[tct,ix]),$ne=ix(),[rct,Mv]=R3(hk),[sct,nct]=R3(hk),UOe=e=>{const{__scopeSelect:t,children:s,open:n,defaultOpen:a,onOpenChange:o,value:l,defaultValue:i,onValueChange:u,dir:m,name:x,autoComplete:y,disabled:v,required:b,form:N}=e,k=$ne(t),[M,E]=A.useState(null),[T,P]=A.useState(null),[R,D]=A.useState(!1),U=Ik(m),[q,H]=ah({prop:n,defaultProp:a??!1,onChange:o,caller:hk}),[G,Q]=ah({prop:l,defaultProp:i,onChange:u,caller:hk}),ne=A.useRef(null),ie=M?N||!!M.closest("form"):!0,[he,se]=A.useState(new Set),fe=Array.from(he).map(oe=>oe.props.value).join(";");return r.jsx(eP,{...k,children:r.jsxs(rct,{required:b,scope:t,trigger:M,onTriggerChange:E,valueNode:T,onValueNodeChange:P,valueNodeHasChildren:R,onValueNodeHasChildrenChange:D,contentId:yd(),value:G,onValueChange:Q,open:q,onOpenChange:H,dir:U,triggerPointerDownPosRef:ne,disabled:v,children:[r.jsx(zne.Provider,{scope:t,children:r.jsx(sct,{scope:e.__scopeSelect,onNativeOptionAdd:A.useCallback(oe=>{se(ce=>new Set(ce).add(oe))},[]),onNativeOptionRemove:A.useCallback(oe=>{se(ce=>{const de=new Set(ce);return de.delete(oe),de})},[]),children:s})}),ie?r.jsxs(h8e,{"aria-hidden":!0,required:b,tabIndex:-1,name:x,autoComplete:y,value:G,onChange:oe=>Q(oe.target.value),disabled:v,form:N,children:[G===void 0?r.jsx("option",{value:""}):null,Array.from(he)]},fe):null]})})};UOe.displayName=hk;var qOe="SelectTrigger",VOe=A.forwardRef((e,t)=>{const{__scopeSelect:s,disabled:n=!1,...a}=e,o=$ne(s),l=Mv(qOe,s),i=l.disabled||n,u=ha(t,l.onTriggerChange),m=Bne(s),x=A.useRef("touch"),[y,v,b]=p8e(k=>{const M=m().filter(P=>!P.disabled),E=M.find(P=>P.value===l.value),T=f8e(M,k,E);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(C3,{asChild:!0,...o,children:r.jsx($s.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":m8e(l.value)?"":void 0,...a,ref:u,onClick:xs(a.onClick,k=>{k.currentTarget.focus(),x.current!=="mouse"&&N(k)}),onPointerDown:xs(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:xs(a.onKeyDown,k=>{const M=y.current!=="";!(k.ctrlKey||k.altKey||k.metaKey)&&k.key.length===1&&v(k.key),!(M&&k.key===" ")&&Jlt.includes(k.key)&&(N(),k.preventDefault())})})})});VOe.displayName=qOe;var HOe="SelectValue",WOe=A.forwardRef((e,t)=>{const{__scopeSelect:s,className:n,style:a,children:o,placeholder:l="",...i}=e,u=Mv(HOe,s),{onValueNodeHasChildrenChange:m}=u,x=o!==void 0,y=ha(t,u.onValueNodeChange);return cc(()=>{m(x)},[m,x]),r.jsx($s.span,{...i,ref:y,style:{pointerEvents:"none"},children:m8e(u.value)?r.jsx(r.Fragment,{children:l}):o})});WOe.displayName=HOe;var act="SelectIcon",GOe=A.forwardRef((e,t)=>{const{__scopeSelect:s,children:n,...a}=e;return r.jsx($s.span,{"aria-hidden":!0,...a,ref:t,children:n||"▼"})});GOe.displayName=act;var ict="SelectPortal",KOe=e=>r.jsx(w3,{asChild:!0,...e});KOe.displayName=ict;var mk="SelectContent",ZOe=A.forwardRef((e,t)=>{const s=Mv(mk,e.__scopeSelect),[n,a]=A.useState();if(cc(()=>{a(new DocumentFragment)},[]),!s.open){const o=n;return o?Eh.createPortal(r.jsx(YOe,{scope:e.__scopeSelect,children:r.jsx(zne.Slot,{scope:e.__scopeSelect,children:r.jsx("div",{children:e.children})})}),o):null}return r.jsx(XOe,{...e,ref:t})});ZOe.displayName=mk;var of=10,[YOe,Tv]=R3(mk),oct="SelectContentImpl",lct=mv("SelectContent.RemoveScroll"),XOe=A.forwardRef((e,t)=>{const{__scopeSelect:s,position:n="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,...E}=e,T=Mv(mk,s),[P,R]=A.useState(null),[D,U]=A.useState(null),q=ha(t,Ue=>R(Ue)),[H,G]=A.useState(null),[Q,ne]=A.useState(null),ie=Bne(s),[he,se]=A.useState(!1),fe=A.useRef(!1);A.useEffect(()=>{if(P)return Ane(P)},[P]),Tne();const oe=A.useCallback(Ue=>{const[Pe,...$e]=ie().map(Ee=>Ee.ref.current),[it]=$e.slice(-1),xt=document.activeElement;for(const Ee of Ue)if(Ee===xt||(Ee==null||Ee.scrollIntoView({block:"nearest"}),Ee===Pe&&D&&(D.scrollTop=0),Ee===it&&D&&(D.scrollTop=D.scrollHeight),Ee==null||Ee.focus(),document.activeElement!==xt))return},[ie,D]),ce=A.useCallback(()=>oe([H,P]),[oe,H,P]);A.useEffect(()=>{he&&ce()},[he,ce]);const{onOpenChange:de,triggerPointerDownPosRef:xe}=T;A.useEffect(()=>{if(P){let Ue={x:0,y:0};const Pe=it=>{var xt,Ee;Ue={x:Math.abs(Math.round(it.pageX)-(((xt=xe.current)==null?void 0:xt.x)??0)),y:Math.abs(Math.round(it.pageY)-(((Ee=xe.current)==null?void 0:Ee.y)??0))}},$e=it=>{Ue.x<=10&&Ue.y<=10?it.preventDefault():P.contains(it.target)||de(!1),document.removeEventListener("pointermove",Pe),xe.current=null};return xe.current!==null&&(document.addEventListener("pointermove",Pe),document.addEventListener("pointerup",$e,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Pe),document.removeEventListener("pointerup",$e,{capture:!0})}}},[P,de,xe]),A.useEffect(()=>{const Ue=()=>de(!1);return window.addEventListener("blur",Ue),window.addEventListener("resize",Ue),()=>{window.removeEventListener("blur",Ue),window.removeEventListener("resize",Ue)}},[de]);const[Me,ve]=p8e(Ue=>{const Pe=ie().filter(xt=>!xt.disabled),$e=Pe.find(xt=>xt.ref.current===document.activeElement),it=f8e(Pe,Ue,$e);it&&setTimeout(()=>it.ref.current.focus())}),be=A.useCallback((Ue,Pe,$e)=>{const it=!fe.current&&!$e;(T.value!==void 0&&T.value===Pe||it)&&(G(Ue),it&&(fe.current=!0))},[T.value]),we=A.useCallback(()=>P==null?void 0:P.focus(),[P]),tt=A.useCallback((Ue,Pe,$e)=>{const it=!fe.current&&!$e;(T.value!==void 0&&T.value===Pe||it)&&ne(Ue)},[T.value]),Ae=n==="popper"?dme:QOe,Le=Ae===dme?{side:i,sideOffset:u,align:m,alignOffset:x,arrowPadding:y,collisionBoundary:v,collisionPadding:b,sticky:N,hideWhenDetached:k,avoidCollisions:M}:{};return r.jsx(YOe,{scope:s,content:P,viewport:D,onViewportChange:U,itemRefCallback:be,selectedItem:H,onItemLeave:we,itemTextRefCallback:tt,focusSelectedItem:ce,selectedItemText:Q,position:n,isPositioned:he,searchRef:Me,children:r.jsx(oP,{as:lct,allowPinchZoom:!0,children:r.jsx(aP,{asChild:!0,trapped:T.open,onMountAutoFocus:Ue=>{Ue.preventDefault()},onUnmountAutoFocus:xs(a,Ue=>{var Pe;(Pe=T.trigger)==null||Pe.focus({preventScroll:!0}),Ue.preventDefault()}),children:r.jsx(kv,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:Ue=>Ue.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:r.jsx(Ae,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:Ue=>Ue.preventDefault(),...E,...Le,onPlaced:()=>se(!0),ref:q,style:{display:"flex",flexDirection:"column",outline:"none",...E.style},onKeyDown:xs(E.onKeyDown,Ue=>{const Pe=Ue.ctrlKey||Ue.altKey||Ue.metaKey;if(Ue.key==="Tab"&&Ue.preventDefault(),!Pe&&Ue.key.length===1&&ve(Ue.key),["ArrowUp","ArrowDown","Home","End"].includes(Ue.key)){let it=ie().filter(xt=>!xt.disabled).map(xt=>xt.ref.current);if(["ArrowUp","End"].includes(Ue.key)&&(it=it.slice().reverse()),["ArrowUp","ArrowDown"].includes(Ue.key)){const xt=Ue.target,Ee=it.indexOf(xt);it=it.slice(Ee+1)}setTimeout(()=>oe(it)),Ue.preventDefault()}})})})})})})});XOe.displayName=oct;var cct="SelectItemAlignedPosition",QOe=A.forwardRef((e,t)=>{const{__scopeSelect:s,onPlaced:n,...a}=e,o=Mv(mk,s),l=Tv(mk,s),[i,u]=A.useState(null),[m,x]=A.useState(null),y=ha(t,q=>x(q)),v=Bne(s),b=A.useRef(!1),N=A.useRef(!0),{viewport:k,selectedItem:M,selectedItemText:E,focusSelectedItem:T}=l,P=A.useCallback(()=>{if(o.trigger&&o.valueNode&&i&&m&&k&&M&&E){const q=o.trigger.getBoundingClientRect(),H=m.getBoundingClientRect(),G=o.valueNode.getBoundingClientRect(),Q=E.getBoundingClientRect();if(o.dir!=="rtl"){const xt=Q.left-H.left,Ee=G.left-xt,et=q.left-Ee,le=q.width+et,Ve=Math.max(le,H.width),Je=window.innerWidth-of,rt=zE(Ee,[of,Math.max(of,Je-Ve)]);i.style.minWidth=le+"px",i.style.left=rt+"px"}else{const xt=H.right-Q.right,Ee=window.innerWidth-G.right-xt,et=window.innerWidth-q.right-Ee,le=q.width+et,Ve=Math.max(le,H.width),Je=window.innerWidth-of,rt=zE(Ee,[of,Math.max(of,Je-Ve)]);i.style.minWidth=le+"px",i.style.right=rt+"px"}const ne=v(),ie=window.innerHeight-of*2,he=k.scrollHeight,se=window.getComputedStyle(m),fe=parseInt(se.borderTopWidth,10),oe=parseInt(se.paddingTop,10),ce=parseInt(se.borderBottomWidth,10),de=parseInt(se.paddingBottom,10),xe=fe+oe+he+de+ce,Me=Math.min(M.offsetHeight*5,xe),ve=window.getComputedStyle(k),be=parseInt(ve.paddingTop,10),we=parseInt(ve.paddingBottom,10),tt=q.top+q.height/2-of,Ae=ie-tt,Le=M.offsetHeight/2,Ue=M.offsetTop+Le,Pe=fe+oe+Ue,$e=xe-Pe;if(Pe<=tt){const xt=ne.length>0&&M===ne[ne.length-1].ref.current;i.style.bottom="0px";const Ee=m.clientHeight-k.offsetTop-k.offsetHeight,et=Math.max(Ae,Le+(xt?we:0)+Ee+ce),le=Pe+et;i.style.height=le+"px"}else{const xt=ne.length>0&&M===ne[0].ref.current;i.style.top="0px";const et=Math.max(tt,fe+k.offsetTop+(xt?be:0)+Le)+$e;i.style.height=et+"px",k.scrollTop=Pe-tt+k.offsetTop}i.style.margin=`${of}px 0`,i.style.minHeight=Me+"px",i.style.maxHeight=ie+"px",n==null||n(),requestAnimationFrame(()=>b.current=!0)}},[v,o.trigger,o.valueNode,i,m,k,M,E,o.dir,n]);cc(()=>P(),[P]);const[R,D]=A.useState();cc(()=>{m&&D(window.getComputedStyle(m).zIndex)},[m]);const U=A.useCallback(q=>{q&&N.current===!0&&(P(),T==null||T(),N.current=!1)},[P,T]);return r.jsx(uct,{scope:s,contentWrapper:i,shouldExpandOnScrollRef:b,onScrollButtonChange:U,children:r.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:R},children:r.jsx($s.div,{...a,ref:y,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});QOe.displayName=cct;var dct="SelectPopperPosition",dme=A.forwardRef((e,t)=>{const{__scopeSelect:s,align:n="start",collisionPadding:a=of,...o}=e,l=$ne(s);return r.jsx(tP,{...l,...o,ref:t,align:n,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)"}})});dme.displayName=dct;var[uct,rye]=R3(mk,{}),ume="SelectViewport",JOe=A.forwardRef((e,t)=>{const{__scopeSelect:s,nonce:n,...a}=e,o=Tv(ume,s),l=rye(ume,s),i=ha(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:n}),r.jsx(zne.Slot,{scope:s,children:r.jsx($s.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:i,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:xs(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-of*2,k=parseFloat(y.style.minHeight),M=parseFloat(y.style.height),E=Math.max(k,M);if(E0?R:0,y.style.justifyContent="flex-end")}}}u.current=x.scrollTop})})})]})});JOe.displayName=ume;var e8e="SelectGroup",[hct,mct]=R3(e8e),pct=A.forwardRef((e,t)=>{const{__scopeSelect:s,...n}=e,a=yd();return r.jsx(hct,{scope:s,id:a,children:r.jsx($s.div,{role:"group","aria-labelledby":a,...n,ref:t})})});pct.displayName=e8e;var t8e="SelectLabel",r8e=A.forwardRef((e,t)=>{const{__scopeSelect:s,...n}=e,a=mct(t8e,s);return r.jsx($s.div,{id:a.id,...n,ref:t})});r8e.displayName=t8e;var qte="SelectItem",[fct,s8e]=R3(qte),n8e=A.forwardRef((e,t)=>{const{__scopeSelect:s,value:n,disabled:a=!1,textValue:o,...l}=e,i=Mv(qte,s),u=Tv(qte,s),m=i.value===n,[x,y]=A.useState(o??""),[v,b]=A.useState(!1),N=ha(t,T=>{var P;return(P=u.itemRefCallback)==null?void 0:P.call(u,T,n,a)}),k=yd(),M=A.useRef("touch"),E=()=>{a||(i.onValueChange(n),i.onOpenChange(!1))};if(n==="")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(fct,{scope:s,value:n,disabled:a,textId:k,isSelected:m,onItemTextChange:A.useCallback(T=>{y(P=>P||((T==null?void 0:T.textContent)??"").trim())},[]),children:r.jsx(zne.ItemSlot,{scope:s,value:n,disabled:a,textValue:x,children:r.jsx($s.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:xs(l.onFocus,()=>b(!0)),onBlur:xs(l.onBlur,()=>b(!1)),onClick:xs(l.onClick,()=>{M.current!=="mouse"&&E()}),onPointerUp:xs(l.onPointerUp,()=>{M.current==="mouse"&&E()}),onPointerDown:xs(l.onPointerDown,T=>{M.current=T.pointerType}),onPointerMove:xs(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:xs(l.onPointerLeave,T=>{var P;T.currentTarget===document.activeElement&&((P=u.onItemLeave)==null||P.call(u))}),onKeyDown:xs(l.onKeyDown,T=>{var R;((R=u.searchRef)==null?void 0:R.current)!==""&&T.key===" "||(ect.includes(T.key)&&E(),T.key===" "&&T.preventDefault())})})})})});n8e.displayName=qte;var zT="SelectItemText",a8e=A.forwardRef((e,t)=>{const{__scopeSelect:s,className:n,style:a,...o}=e,l=Mv(zT,s),i=Tv(zT,s),u=s8e(zT,s),m=nct(zT,s),[x,y]=A.useState(null),v=ha(t,E=>y(E),u.onItemTextChange,E=>{var T;return(T=i.itemTextRefCallback)==null?void 0:T.call(i,E,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 cc(()=>(k(N),()=>M(N)),[k,M,N]),r.jsxs(r.Fragment,{children:[r.jsx($s.span,{id:u.textId,...o,ref:v}),u.isSelected&&l.valueNode&&!l.valueNodeHasChildren?Eh.createPortal(o.children,l.valueNode):null]})});a8e.displayName=zT;var i8e="SelectItemIndicator",o8e=A.forwardRef((e,t)=>{const{__scopeSelect:s,...n}=e;return s8e(i8e,s).isSelected?r.jsx($s.span,{"aria-hidden":!0,...n,ref:t}):null});o8e.displayName=i8e;var hme="SelectScrollUpButton",l8e=A.forwardRef((e,t)=>{const s=Tv(hme,e.__scopeSelect),n=rye(hme,e.__scopeSelect),[a,o]=A.useState(!1),l=ha(t,n.onScrollButtonChange);return cc(()=>{if(s.viewport&&s.isPositioned){let i=function(){const m=u.scrollTop>0;o(m)};const u=s.viewport;return i(),u.addEventListener("scroll",i),()=>u.removeEventListener("scroll",i)}},[s.viewport,s.isPositioned]),a?r.jsx(d8e,{...e,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:u}=s;i&&u&&(i.scrollTop=i.scrollTop-u.offsetHeight)}}):null});l8e.displayName=hme;var mme="SelectScrollDownButton",c8e=A.forwardRef((e,t)=>{const s=Tv(mme,e.__scopeSelect),n=rye(mme,e.__scopeSelect),[a,o]=A.useState(!1),l=ha(t,n.onScrollButtonChange);return cc(()=>{if(s.viewport&&s.isPositioned){let i=function(){const m=u.scrollHeight-u.clientHeight,x=Math.ceil(u.scrollTop)u.removeEventListener("scroll",i)}},[s.viewport,s.isPositioned]),a?r.jsx(d8e,{...e,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:u}=s;i&&u&&(i.scrollTop=i.scrollTop+u.offsetHeight)}}):null});c8e.displayName=mme;var d8e=A.forwardRef((e,t)=>{const{__scopeSelect:s,onAutoScroll:n,...a}=e,o=Tv("SelectScrollButton",s),l=A.useRef(null),i=Bne(s),u=A.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return A.useEffect(()=>()=>u(),[u]),cc(()=>{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($s.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:xs(a.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(n,50))}),onPointerMove:xs(a.onPointerMove,()=>{var m;(m=o.onItemLeave)==null||m.call(o),l.current===null&&(l.current=window.setInterval(n,50))}),onPointerLeave:xs(a.onPointerLeave,()=>{u()})})}),gct="SelectSeparator",u8e=A.forwardRef((e,t)=>{const{__scopeSelect:s,...n}=e;return r.jsx($s.div,{"aria-hidden":!0,...n,ref:t})});u8e.displayName=gct;var pme="SelectArrow",xct=A.forwardRef((e,t)=>{const{__scopeSelect:s,...n}=e,a=$ne(s),o=Mv(pme,s),l=Tv(pme,s);return o.open&&l.position==="popper"?r.jsx(rP,{...a,...n,ref:t}):null});xct.displayName=pme;var yct="SelectBubbleInput",h8e=A.forwardRef(({__scopeSelect:e,value:t,...s},n)=>{const a=A.useRef(null),o=ha(n,a),l=hP(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($s.select,{...s,style:{...cIe,...s.style},ref:o,defaultValue:t})});h8e.displayName=yct;function m8e(e){return e===""||e===void 0}function p8e(e){const t=ac(e),s=A.useRef(""),n=A.useRef(0),a=A.useCallback(l=>{const i=s.current+l;t(i),function u(m){s.current=m,window.clearTimeout(n.current),m!==""&&(n.current=window.setTimeout(()=>u(""),1e3))}(i)},[t]),o=A.useCallback(()=>{s.current="",window.clearTimeout(n.current)},[]);return A.useEffect(()=>()=>window.clearTimeout(n.current),[]),[s,a,o]}function f8e(e,t,s){const a=t.length>1&&Array.from(t).every(m=>m===t[0])?t[0]:t,o=s?e.indexOf(s):-1;let l=vct(e,Math.max(o,0));a.length===1&&(l=l.filter(m=>m!==s));const u=l.find(m=>m.textValue.toLowerCase().startsWith(a.toLowerCase()));return u!==s?u:void 0}function vct(e,t){return e.map((s,n)=>e[(t+n)%e.length])}var _ct=UOe,g8e=VOe,bct=WOe,wct=GOe,jct=KOe,x8e=ZOe,kct=JOe,y8e=r8e,v8e=n8e,Nct=a8e,Sct=o8e,_8e=l8e,b8e=c8e,w8e=u8e;const us=_ct,ms=bct,cs=A.forwardRef(({className:e,children:t,...s},n)=>r.jsxs(g8e,{ref:n,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),...s,children:[t,r.jsx(wct,{asChild:!0,children:r.jsx(gd,{className:"h-4 w-4 opacity-50"})})]}));cs.displayName=g8e.displayName;const j8e=A.forwardRef(({className:e,...t},s)=>r.jsx(_8e,{ref:s,className:Ut("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(zg,{className:"h-4 w-4"})}));j8e.displayName=_8e.displayName;const k8e=A.forwardRef(({className:e,...t},s)=>r.jsx(b8e,{ref:s,className:Ut("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(gd,{className:"h-4 w-4"})}));k8e.displayName=b8e.displayName;const ds=A.forwardRef(({className:e,children:t,position:s="popper",...n},a)=>r.jsx(jct,{children:r.jsxs(x8e,{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",s==="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:s,...n,children:[r.jsx(j8e,{}),r.jsx(kct,{className:Ut("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),r.jsx(k8e,{})]})}));ds.displayName=x8e.displayName;const Cct=A.forwardRef(({className:e,...t},s)=>r.jsx(y8e,{ref:s,className:Ut("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Cct.displayName=y8e.displayName;const $t=A.forwardRef(({className:e,children:t,...s},n)=>r.jsxs(v8e,{ref:n,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),...s,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(Sct,{children:r.jsx(fi,{className:"h-4 w-4"})})}),r.jsx(Nct,{children:t})]}));$t.displayName=v8e.displayName;const Mct=A.forwardRef(({className:e,...t},s)=>r.jsx(w8e,{ref:s,className:Ut("-mx-1 my-1 h-px bg-muted",e),...t}));Mct.displayName=w8e.displayName;const Tct=e=>Kt({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:s,error:n}=await t;if(n)throw n;return s}}),N8e=e=>Kt({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 s=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?s=s.eq("id",e):s=s.eq("slug",e);const{data:n,error:a}=await s.single();if(a)throw a;return n},enabled:!!e}),S8e=()=>ar({mutationFn:async({listingId:e,agentId:t,firstName:s,lastName:n,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:s,last_name:n,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}}),Act=()=>ar({mutationFn:async e=>{const{error:t}=await Y.rpc("increment_listing_share_click",{p_share_token:e});if(t)throw t}}),Ect={active:"bg-emerald-500",coming_soon:"bg-blue-600",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},Xke={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},Ict={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function C8e(){const[e,t]=A.useState(""),[s,n]=A.useState(!1),[a,o]=A.useState({status:"",propertyType:"",minPrice:"",maxPrice:""}),{data:l,isLoading:i}=Tct({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(Bh,{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(ho,{to:"/public/listings",className:"flex items-center",children:r.jsx("img",{src:zOe,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(${Zlt})`},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(ua,{className:"absolute left-4 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-400"}),r.jsx(ot,{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(ua,{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:()=>n(!s),className:"gap-2 bg-white/90 hover:bg-white text-gray-700 shadow-lg",children:[r.jsx(AA,{className:"h-4 w-4"}),s?"Hide Filters":"More Filters"]})}),s&&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(us,{value:a.status||"all",onValueChange:y=>o({...a,status:y==="all"?"":y}),children:[r.jsx(cs,{className:"bg-white",children:r.jsx(ms,{placeholder:"Any status"})}),r.jsxs(ds,{children:[r.jsx($t,{value:"all",children:"Any status"}),Object.entries(Xke).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(us,{value:a.propertyType||"all",onValueChange:y=>o({...a,propertyType:y==="all"?"":y}),children:[r.jsx(cs,{className:"bg-white",children:r.jsx(ms,{placeholder:"Any type"})}),r.jsxs(ds,{children:[r.jsx($t,{value:"all",children:"Any type"}),Object.entries(Ict).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(ot,{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(ot,{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(en,{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(Qlt,{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(Cr,{className:"aspect-[4/3]"}),r.jsxs("div",{className:"p-4 space-y-3",children:[r.jsx(Cr,{className:"h-7 w-28"}),r.jsx(Cr,{className:"h-4 w-full"}),r.jsx(Cr,{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,E;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(ho,{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(sa,{className:"h-12 w-12 text-gray-300"})}),r.jsx(Tt,{className:`absolute top-2 left-2 ${Ect[y.status]} text-white border-0 text-xs font-medium px-2 py-0.5`,children:Xke[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}),((E=y.agent.brokerage)==null?void 0:E.name)&&r.jsx("p",{className:"text-xs text-gray-400 truncate",children:y.agent.brokerage.name})]})]})]})},y.id)})})]}):r.jsxs("div",{className:"text-center py-16",children:[r.jsx("div",{className:"w-20 h-20 mx-auto mb-4 rounded-full bg-gray-100 flex items-center justify-center",children:r.jsx(sa,{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:tye,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},s)=>r.jsx("div",{ref:s,className:Ut("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));He.displayName="Card";const Vt=A.forwardRef(({className:e,...t},s)=>r.jsx("div",{ref:s,className:Ut("flex flex-col space-y-1.5 p-6",e),...t}));Vt.displayName="CardHeader";const Gt=A.forwardRef(({className:e,...t},s)=>r.jsx("h3",{ref:s,className:Ut("text-2xl font-semibold leading-none tracking-tight",e),...t}));Gt.displayName="CardTitle";const Ns=A.forwardRef(({className:e,...t},s)=>r.jsx("p",{ref:s,className:Ut("text-sm text-muted-foreground",e),...t}));Ns.displayName="CardDescription";const Xe=A.forwardRef(({className:e,...t},s)=>r.jsx("div",{ref:s,className:Ut("p-6 pt-0",e),...t}));Xe.displayName="CardContent";const BA=A.forwardRef(({className:e,...t},s)=>r.jsx("div",{ref:s,className:Ut("flex items-center p-6 pt-0",e),...t}));BA.displayName="CardFooter";var Pct="Label",M8e=A.forwardRef((e,t)=>r.jsx($s.label,{...e,ref:t,onMouseDown:s=>{var a;s.target.closest("button, input, select, textarea")||((a=e.onMouseDown)==null||a.call(e,s),!s.defaultPrevented&&s.detail>1&&s.preventDefault())}}));M8e.displayName=Pct;var T8e=M8e;const Lct=j3("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ze=A.forwardRef(({className:e,...t},s)=>r.jsx(T8e,{ref:s,className:Ut(Lct(),e),...t}));ze.displayName=T8e.displayName;const Vte="/assets/levelup-logo-color-D3mY9gCJ.png";function Oct(){const e=Em(),t=window.location.hostname;if(!(t==="listings.relevelup.com"||t.startsWith("listings.")))return null;const n=e.pathname.slice(1);return!n||n===""?r.jsx(C8e,{}):n.startsWith("public/")?null:r.jsx(Dct,{slug:n})}function Dct({slug:e}){return r.jsx(zct,{slug:e})}const Rct={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},Fct={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},Qke={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function zct({slug:e}){var G,Q;const{data:t,isLoading:s}=N8e(e),n=S8e(),[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,E]=A.useState(null),T=ne=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(ne),P=async ne=>{if(ne.preventDefault(),!(!a.trim()||!u.trim()||!t)){b(!0);try{await n.mutateAsync({listingId:t.id,agentId:t.agent_id,firstName:a.trim(),lastName:l.trim(),email:u.trim(),phone:x.trim()}),k(!0),Te.success("Thanks! The agent will be in touch soon.")}catch(ie){console.error("Lead submission error:",ie),Te.error(`Failed to submit: ${ie.message||"Please try again"}`)}finally{b(!1)}}},R=(t==null?void 0:t.photos)||[],D=R.find(ne=>ne.is_primary)||R[0],U=()=>{M!==null&&E(M===0?R.length-1:M-1)},q=()=>{M!==null&&E(M===R.length-1?0:M+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(Cr,{className:"h-8 w-32"})})}),r.jsxs("div",{className:"container mx-auto px-4 py-8",children:[r.jsx(Cr,{className:"h-10 w-48 mb-6"}),r.jsx(Cr,{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(Cr,{className:"h-12 w-48"}),r.jsx(Cr,{className:"h-6 w-full"}),r.jsx(Cr,{className:"h-6 w-3/4"})]}),r.jsx(Cr,{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:Vte,alt:"LevelUp",className:"h-8"})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[r.jsx(sa,{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 H=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(Bh,{children:[r.jsxs("title",{children:[H," | 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":""} ${Qke[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:H}),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:Vte,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"]}),R.length>0&&r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-8",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsx("div",{className:"aspect-[16/10] rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>E(0),children:r.jsx("img",{src: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:R.slice(1,5).map((ne,ie)=>r.jsxs("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer relative",onClick:()=>E(ie+1),children:[r.jsx("img",{src:ne.photo_url,alt:`Photo ${ie+2}`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"}),ie===3&&R.length>5&&r.jsxs("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center text-white font-semibold",children:["+",R.length-5," more"]})]},ne.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:`${Rct[t.status]} text-white border-0`,children:Fct[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(po,{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(qg,{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(jn,{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(pi,{className:"h-3 w-3 mr-1"}),Qke[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(Sn,{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(Vt,{children:r.jsxs(Gt,{className:"text-lg flex items-center gap-2",children:[r.jsx(oc,{className:"h-5 w-5"}),"Listing Agent"]})}),r.jsxs(Xe,{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(Vt,{children:r.jsx(Gt,{className:"text-lg",children:"Interested in this property?"})}),r.jsx(Xe,{children:N?r.jsxs("div",{className:"text-center py-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-3",children:r.jsx(Nn,{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(ot,{id:"firstName",type:"text",placeholder:"John",value:a,onChange:ne=>o(ne.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"lastName",children:"Last Name"}),r.jsx(ot,{id:"lastName",type:"text",placeholder:"Doe",value:l,onChange:ne=>i(ne.target.value)})]})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"email",children:"Email *"}),r.jsx(ot,{id:"email",type:"email",placeholder:"you@example.com",value:u,onChange:ne=>m(ne.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"phone",children:"Phone"}),r.jsx(ot,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:x,onChange:ne=>y(ne.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:()=>E(null),children:r.jsxs(Pr,{className:"max-w-5xl p-0 bg-black/95",children:[r.jsx(zr,{className:"sr-only",children:r.jsx(Rr,{children:"Photo Gallery"})}),r.jsx("button",{onClick:()=>E(null),className:"absolute right-4 top-4 z-50 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(en,{className:"h-5 w-5"})}),M!==null&&R[M]&&r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:R[M].photo_url,alt:`Photo ${M+1}`,className:"w-full max-h-[80vh] object-contain"}),R.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(Sc,{className:"h-6 w-6"})}),r.jsx("button",{onClick:q,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(Zi,{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," / ",R.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 Une({card:e,variant:t}){const s=e.brokerage_display_name||e.brokerage_logo_url,n=e.team_name||e.team_logo_url;if(!s&&!n)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 ${s&&n?"divide-y divide-current/10":""}`,children:[s&&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})]}),n&&r.jsxs("div",{className:`flex flex-col items-center gap-1.5 w-full ${s?"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 A8e=e=>Kt({queryKey:["agent-card-public",e],queryFn:async()=>{if(!e)throw new Error("No slug provided");const{data:t,error:s}=await Y.from("agent_cards").select("*").eq("slug",e).eq("is_published",!0).single();if(s)throw s;const{data:n}=await Y.from("profiles").select("name, email, phone, brokerage_id").eq("id",t.user_id).single();let a=null;if(n!=null&&n.brokerage_id){const{data:l}=await Y.from("brokerages").select("name").eq("id",n.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:n||{name:null,email:null,phone:null,brokerage_id:null},brokerage_name:t.brokerage_display_name||a,avatar_url:o}},enabled:!!e}),Bct=()=>Kt({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}}),$ct=e=>Kt({queryKey:["agent-card",e],queryFn:async()=>{if(!e)return null;const{data:t,error:s}=await Y.from("agent_cards").select("*").eq("user_id",e).maybeSingle();if(s)throw s;return t},enabled:!!e}),E8e=()=>{const e=Br();return ar({mutationFn:async t=>{const{data:s,error:n}=await Y.from("agent_cards").insert(t).select().single();if(n)throw n;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-cards-admin"]}),e.invalidateQueries({queryKey:["agent-card"]}),Te.success("Agent card created")},onError:t=>Te.error(t.message)})},I8e=()=>{const e=Br();return ar({mutationFn:async({id:t,...s})=>{const{data:n,error:a}=await Y.from("agent_cards").update(s).eq("id",t).select().single();if(a)throw a;return n},onSuccess:(t,s)=>{e.invalidateQueries({queryKey:["agent-cards-admin"]}),e.invalidateQueries({queryKey:["agent-card"]}),Te.success("Agent card updated")},onError:t=>Te.error(t.message)})},Bi=async(e,t,s,n)=>{const a=new URLSearchParams(window.location.search);await Y.from("agent_card_interactions").insert({card_id:e,interaction_type:t,interaction_detail:s||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:{}})},Uct=async(e,t)=>{const{error:s}=await Y.from("agent_card_leads").insert({card_id:e,...t});if(s)throw s},P8e=e=>Kt({queryKey:["agent-card-analytics",e],queryFn:async()=>{if(!e)return null;const{data:t,error:s}=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(s)throw s;const{data:n,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:n||[],interactions:t||[]}},enabled:!!e});function qne({open:e,onOpenChange:t,cardId:s,type:n,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),E=async T=>{if(T.preventDefault(),!o.trim()){Te.error("Please enter your name");return}M(!0);try{await Uct(s,{lead_type:n,name:o.trim(),email:i.trim()||void 0,phone:m.trim()||void 0,message:b.trim()||void 0,intent:y||void 0}),Bi(s,"lead_submitted",n),Y.functions.invoke("card-lead-notify",{body:{cardId:s,leadType:n,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)),Te.success(n==="booking"?"Request sent! They'll be in touch soon.":n==="connect"?"Info shared! They'll be in touch soon.":"Referral submitted! Thank you."),t(!1),l(""),u(""),x(""),v(""),N("")}catch{Te.error("Something went wrong. Please try again.")}finally{M(!1)}};return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Pr,{className:"sm:max-w-md rounded-2xl",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:n==="booking"?"Book a Call":n==="connect"?"Connect with Me":"Refer a Friend"}),r.jsx(Zs,{children:n==="booking"?`Let ${a} know you'd like to connect.`:n==="connect"?`Share your info and ${a} will reach out.`:`Know someone who could use ${a}'s help?`})]}),r.jsxs("form",{onSubmit:E,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"lead-name",children:"Name *"}),r.jsx(ot,{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(ot,{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(ot,{id:"lead-email",type:"email",value:i,onChange:T=>u(T.target.value),placeholder:"you@example.com"})]}),n==="booking"&&r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"lead-intent",children:"I'm looking to..."}),r.jsxs(us,{value:y,onValueChange:v,children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select one"})}),r.jsxs(ds,{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"})]})]})]}),n!=="connect"&&r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"lead-message",children:n==="referral"?"Tell us about them":"Message (optional)"}),r.jsx(ot,{id:"lead-message",value:b,onChange:T=>N(T.target.value),placeholder:n==="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 qct=e=>Kt({queryKey:["card-blocks",e],queryFn:async()=>{if(!e)return[];const{data:t,error:s}=await Y.from("card_blocks").select("*").eq("card_id",e).eq("is_visible",!0).order("sort_order",{ascending:!0});if(s)throw s;return t||[]},enabled:!!e}),Vct=e=>Kt({queryKey:["card-blocks-all",e],queryFn:async()=>{if(!e)return[];const{data:t,error:s}=await Y.from("card_blocks").select("*").eq("card_id",e).order("sort_order",{ascending:!0});if(s)throw s;return t||[]},enabled:!!e}),Hct=()=>{const e=Br();return ar({mutationFn:async t=>{const{data:s,error:n}=await Y.from("card_blocks").insert(t).select().single();if(n)throw n;return s},onSuccess:(t,s)=>{e.invalidateQueries({queryKey:["card-blocks",s.card_id]}),e.invalidateQueries({queryKey:["card-blocks-all",s.card_id]}),Te.success("Block added")},onError:t=>Te.error(t.message)})},Wct=()=>{const e=Br();return ar({mutationFn:async({id:t,...s})=>{const{data:n,error:a}=await Y.from("card_blocks").update(s).eq("id",t).select().single();if(a)throw a;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["card-blocks"]}),e.invalidateQueries({queryKey:["card-blocks-all"]}),Te.success("Block updated")},onError:t=>Te.error(t.message)})},Gct=()=>{const e=Br();return ar({mutationFn:async t=>{const{error:s}=await Y.from("card_blocks").delete().eq("id",t);if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["card-blocks"]}),e.invalidateQueries({queryKey:["card-blocks-all"]}),Te.success("Block removed")},onError:t=>Te.error(t.message)})};function Kct(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 Zct(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 Yct={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 Xct({block:e,variant:t}){const s=e.config;if(!s.video_url)return null;const n=s.video_url.includes("mediadelivery.net")||s.video_url.includes("bunnycdn.com"),a=Zct(s.video_url),o=n||!!a,l=n?Kct(s.video_url):a||s.video_url;return r.jsx("div",{className:Yct[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:s.video_url,controls:!0,className:"w-full",preload:"metadata"})})}const Qct={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 Jct({block:e,variant:t}){const n=e.config.testimonials||[],[a,o]=A.useState(0);if(n.length===0)return null;const l=Qct[t],i=n[a];return r.jsxs("div",{className:l.container,children:[r.jsxs("div",{className:l.card,children:[r.jsx(kA,{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})]})]}),n.length>1&&r.jsxs("div",{className:"flex items-center justify-center gap-3 mt-3",children:[r.jsx("button",{onClick:()=>o(u=>(u-1+n.length)%n.length),className:l.nav,children:r.jsx(Sc,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex gap-1.5",children:n.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)%n.length),className:l.nav,children:r.jsx(Zi,{className:"h-4 w-4"})})]})]})}const edt={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 tdt({block:e,variant:t}){const n=e.config.tags||[];if(n.length===0)return null;const a=edt[t];return r.jsx("div",{className:a.container,children:n.map((o,l)=>r.jsx("span",{className:a.tag,children:o},l))})}const rdt={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 sdt({block:e,cardId:t,variant:s}){const a=e.config.links||[];if(a.length===0)return null;const o=rdt[s];return r.jsx("div",{className:o.container,children:a.map((l,i)=>r.jsxs("a",{href:l.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Bi(t,"button_click",`custom_link_${l.label}`),className:o.link,children:[r.jsx("span",{children:l.label}),r.jsx(Sn,{className:`h-4 w-4 ${o.icon}`})]},i))})}const fme={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 ndt({path:e,color:t,size:s=20}){return r.jsx("svg",{viewBox:"0 0 24 24",width:s,height:s,fill:t,children:r.jsx("path",{d:e})})}const adt={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 idt({block:e,cardId:t,variant:s}){const a=e.config.platforms||[],o=adt[s];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=fme[l.platform.toLowerCase()];return!u||!l.url?null:r.jsx("a",{href:l.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Bi(t,"button_click",`social_${l.platform}`),className:o.linkClass,title:u.label,children:r.jsx(ndt,{path:u.icon,color:u.color})},i)})})]})}function Vne({cardId:e,variant:t}){const{data:s}=qct(e);if(!s||s.length===0)return null;const n=s.filter(l=>l.block_type==="social_media"&&l.is_visible),a=s.filter(l=>l.block_type!=="social_media"),o=n.length>0?{...n[0],config:{platforms:n.flatMap(l=>l.config.platforms||[])}}:null;return s.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(Xct,{block:l,variant:t},l.id);case"testimonials":return r.jsx(Jct,{block:l,variant:t},l.id);case"specialties":return r.jsx(tdt,{block:l,variant:t},l.id);case"custom_links":return r.jsx(sdt,{block:l,cardId:e,variant:t},l.id);default:return null}}),o&&r.jsx(idt,{block:o,cardId:e,variant:t})]})}async function odt(e){try{const t=await fetch(e);if(!t.ok)return null;const s=await t.blob(),n=s.type||"image/jpeg";return new Promise(a=>{const o=new FileReader;o.onloadend=()=>{const i=o.result.split(",")[1];a({base64:i,mimeType:n})},o.onerror=()=>a(null),o.readAsDataURL(s)})}catch{return null}}function ldt(e){const t=e.trim().split(/\s+/);if(t.length<=1)return{first:t[0]||"",last:""};const s=t.pop();return{first:t.join(" "),last:s}}async function Hne(e){const{first:t,last:s}=ldt(e.name),n=["BEGIN:VCARD","VERSION:3.0",`FN:${e.name}`,`N:${s};${t};;;`];if(e.phone&&n.push(`TEL;TYPE=CELL:${e.phone}`),e.email&&n.push(`EMAIL;TYPE=INTERNET:${e.email}`),e.brokerage&&n.push(`ORG:${e.brokerage}`),n.push(`URL:${e.cardUrl}`),e.avatarUrl){const i=await odt(e.avatarUrl);if(i){const m={"image/jpeg":"JPEG","image/jpg":"JPEG","image/png":"PNG","image/gif":"GIF","image/webp":"JPEG"}[i.mimeType]||"JPEG";n.push(`PHOTO;ENCODING=b;TYPE=${m}:${i.base64}`)}}n.push("END:VCARD");const a=new Blob([n.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),Te.success("Contact saved!")}function cdt({card:e}){var E;const[t,s]=A.useState(!1),[n,a]=A.useState("booking"),o=((E=e.profile)==null?void 0:E.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),i=(T,P)=>{Bi(e.id,"button_click",T),P()},u=()=>i("call",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`tel:${e.profile.phone}`:Te.error("Phone number not available")}),m=()=>i("text",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`sms:${e.profile.phone}`:Te.error("Phone number not available")}),x=()=>i("email",()=>{var T;(T=e.profile)!=null&&T.email?window.location.href=`mailto:${e.profile.email}`:Te.error("Email not available")}),y=()=>{e.booking_url?i("book",()=>window.open(e.booking_url,"_blank")):(a("booking"),s(!0),Bi(e.id,"button_click","book"))},v=()=>{var T,P;Bi(e.id,"contact_saved"),Hne({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(Bi(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),Te.success("Link copied!")},N=()=>{a("referral"),s(!0),Bi(e.id,"button_click","refer")},k=()=>{a("connect"),s(!0),Bi(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(Xn,{className:"h-28 w-28 mx-auto mb-4 ring-4 ring-white shadow-lg",children:[r.jsx(ji,{src:e.avatar_url||void 0,alt:o}),r.jsx(Qn,{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(Pi,{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(Bo,{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(Nn,{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(jn,{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(Mn,{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(Une,{card:e,variant:"standard"}),r.jsx(Vne,{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($i,{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:()=>{Bi(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(Mn,{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(qs,{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(wu,{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(Cc,{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:()=>Bi(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(qne,{open:t,onOpenChange:s,cardId:e.id,type:n,agentName:o})]})}function ddt({card:e}){var E;const[t,s]=A.useState(!1),[n,a]=A.useState("booking"),o=((E=e.profile)==null?void 0:E.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),i=(T,P)=>{Bi(e.id,"button_click",T),P()},u=()=>i("call",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`tel:${e.profile.phone}`:Te.error("Phone number not available")}),m=()=>i("text",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`sms:${e.profile.phone}`:Te.error("Phone number not available")}),x=()=>i("email",()=>{var T;(T=e.profile)!=null&&T.email?window.location.href=`mailto:${e.profile.email}`:Te.error("Email not available")}),y=()=>{e.booking_url?i("book",()=>window.open(e.booking_url,"_blank")):(a("booking"),s(!0),Bi(e.id,"button_click","book"))},v=()=>{var T,P;Bi(e.id,"contact_saved"),Hne({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(Bi(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),Te.success("Link copied!")},N=()=>{a("referral"),s(!0),Bi(e.id,"button_click","refer")},k=()=>{a("connect"),s(!0),Bi(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(Xn,{className:"h-32 w-32 mx-auto mb-5 ring-2 ring-[#c9a84c]/40 shadow-2xl",children:[r.jsx(ji,{src:e.avatar_url||void 0,alt:o}),r.jsx(Qn,{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:Pi,label:"Call",handler:u},{icon:Bo,label:"Text",handler:m},{icon:Nn,label:"Email",handler:x}].map(({icon:T,label:P,handler:R})=>r.jsxs("button",{onClick:R,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(jn,{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(Mn,{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(Une,{card:e,variant:"luxury"}),r.jsx(Vne,{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($i,{className:"h-4 w-4 text-[#c9a84c]"})," Save Contact"]}),e.show_leave_review&&e.review_source_url&&r.jsxs("button",{onClick:()=>{Bi(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(Mn,{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(qs,{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(wu,{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(Cc,{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:()=>Bi(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(qne,{open:t,onOpenChange:s,cardId:e.id,type:n,agentName:o})]})}function udt({card:e}){var P,R,D,U;const[t,s]=A.useState(!1),[n,a]=A.useState("booking"),o=((P=e.profile)==null?void 0:P.name)||"Agent",l=o.split(" ").map(q=>q[0]).join("").toUpperCase().slice(0,2),i={accent:((R=e.bold_theme_colors)==null?void 0:R.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=(q,H)=>{const G=parseInt(q.replace("#",""),16),Q=Math.max(0,(G>>16)-H),ne=Math.max(0,(G>>8&255)-H),ie=Math.max(0,(G&255)-H);return`#${(Q<<16|ne<<8|ie).toString(16).padStart(6,"0")}`};u(i.accent,25),u(i.dark,-20),u(i.button,25);const m=(q,H)=>{Bi(e.id,"button_click",q),H()},x=()=>m("call",()=>{var q;(q=e.profile)!=null&&q.phone?window.location.href=`tel:${e.profile.phone}`:Te.error("Phone number not available")}),y=()=>m("text",()=>{var q;(q=e.profile)!=null&&q.phone?window.location.href=`sms:${e.profile.phone}`:Te.error("Phone number not available")}),v=()=>m("email",()=>{var q;(q=e.profile)!=null&&q.email?window.location.href=`mailto:${e.profile.email}`:Te.error("Email not available")}),b=()=>{e.booking_url?m("book",()=>window.open(e.booking_url,"_blank")):(a("booking"),s(!0),Bi(e.id,"button_click","book"))},N=()=>{var q,H;Bi(e.id,"contact_saved"),Hne({name:o,phone:(q=e.profile)==null?void 0:q.phone,email:(H=e.profile)==null?void 0:H.email,brokerage:e.brokerage_name,avatarUrl:e.avatar_url,cardUrl:window.location.href})},k=async()=>{if(Bi(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),Te.success("Link copied!")},M=()=>{a("referral"),s(!0),Bi(e.id,"button_click","refer")},E=()=>{a("connect"),s(!0),Bi(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(Xn,{className:"h-28 w-28 mx-auto mb-4 shadow-2xl",style:{boxShadow:`0 0 0 4px ${i.accent}`},children:[r.jsx(ji,{src:e.avatar_url||void 0,alt:o}),r.jsx(Qn,{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:Pi,label:"Call",handler:x},{icon:Bo,label:"Text",handler:y},{icon:Nn,label:"Email",handler:v}].map(({icon:q,label:H,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(q,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs",children:H})]},H))}),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(jn,{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(Mn,{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(Une,{card:e,variant:"bold"}),r.jsx(Vne,{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($i,{className:"h-4 w-4",style:{color:i.accent}})," Save Contact"]}),e.show_leave_review&&e.review_source_url&&r.jsxs("button",{onClick:()=>{Bi(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(Mn,{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(qs,{className:"h-4 w-4",style:{color:i.accent}})," Refer a Friend"]}),r.jsxs("button",{onClick:E,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(wu,{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(Cc,{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((q,H)=>r.jsx("a",{href:q.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Bi(e.id,"button_click",`social_${q.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[q.platform.toLowerCase()]||"🔗"},H))})]}),r.jsx("div",{className:"text-center py-6",children:r.jsx("p",{className:"text-xs text-white/50",children:"Powered by LevelUp"})})]}),r.jsx(qne,{open:t,onOpenChange:s,cardId:e.id,type:n,agentName:o})]})}function hdt({card:e}){var E;const[t,s]=A.useState(!1),[n,a]=A.useState("booking"),o=((E=e.profile)==null?void 0:E.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),i=(T,P)=>{Bi(e.id,"button_click",T),P()},u=()=>i("call",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`tel:${e.profile.phone}`:Te.error("Phone number not available")}),m=()=>i("text",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`sms:${e.profile.phone}`:Te.error("Phone number not available")}),x=()=>i("email",()=>{var T;(T=e.profile)!=null&&T.email?window.location.href=`mailto:${e.profile.email}`:Te.error("Email not available")}),y=()=>{e.booking_url?i("book",()=>window.open(e.booking_url,"_blank")):(a("booking"),s(!0),Bi(e.id,"button_click","book"))},v=()=>{var T,P;Bi(e.id,"contact_saved"),Hne({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(Bi(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),Te.success("Link copied!")},N=()=>{a("referral"),s(!0),Bi(e.id,"button_click","refer")},k=()=>{a("connect"),s(!0),Bi(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(Xn,{className:"h-28 w-28 mx-auto mb-4 ring-4 ring-white shadow-lg",children:[r.jsx(ji,{src:e.avatar_url||void 0,alt:o}),r.jsx(Qn,{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:Pi,label:"Call",handler:u},{icon:Bo,label:"Text",handler:m},{icon:Nn,label:"Email",handler:x}].map(({icon:T,label:P,handler:R})=>r.jsxs("button",{onClick:R,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(jn,{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(Mn,{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(Une,{card:e,variant:"classic"}),r.jsx(Vne,{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($i,{className:"h-4 w-4 text-[#5a7a6f]"})," Save Contact"]}),e.show_leave_review&&e.review_source_url&&r.jsxs("button",{onClick:()=>{Bi(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(Mn,{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(qs,{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(wu,{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(Cc,{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:()=>Bi(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(qne,{open:t,onOpenChange:s,cardId:e.id,type:n,agentName:o})]})}function sye({card:e}){switch(e.theme){case"luxury":return r.jsx(ddt,{card:e});case"bold":return r.jsx(udt,{card:e});case"classic":return r.jsx(hdt,{card:e});case"standard":default:return r.jsx(cdt,{card:e})}}function mdt(){const e=Em();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(pdt,{slug:t})}function pdt({slug:e}){return r.jsx(fdt,{slug:e})}function fdt({slug:e}){var o;const{data:t,isLoading:s,error:n}=A8e(e);if(A.useEffect(()=>{t!=null&&t.id&&Bi(t.id,"card_view")},[t==null?void 0:t.id]),s)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(Cr,{className:"h-28 w-28 rounded-full"}),r.jsx(Cr,{className:"h-6 w-48"}),r.jsx(Cr,{className:"h-4 w-36"})]}),r.jsx(Cr,{className:"h-12 w-full"}),r.jsx(Cr,{className:"h-12 w-full"})]})});if(n||!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(Bh,{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(sye,{card:t})]})}function L8e({presentationId:e,ctaLabel:t,agentName:s,prefillName:n,prefillEmail:a,prefillPhone:o}){const[l,i]=A.useState(n||""),[u,m]=A.useState(a||""),[x,y]=A.useState(o||""),[v,b]=A.useState(""),[N,k]=A.useState(""),[M,E]=A.useState(!1),[T,P]=A.useState(!1),R=async D=>{if(D.preventDefault(),!l.trim()){Te.error("Please enter your name");return}E(!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(q=>console.error("Presentation lead notify failed:",q)),P(!0)}catch{Te.error("Something went wrong. Please try again.")}finally{E(!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:s?`${s} will be in touch soon.`:"We'll be in touch soon."})]}):r.jsxs("form",{onSubmit:R,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(ot,{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(ot,{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(ot,{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(us,{value:v,onValueChange:b,children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select one"})}),r.jsxs(ds,{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(ot,{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 gdt(){const e=Em();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(xdt,{shareToken:t})}function xdt({shareToken:e}){var N;const[t,s]=A.useState(null),[n,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:E}=await Y.from("profiles").select("name, email, phone, avatar_url, title, brokerage_id").eq("id",k.owner_user_id).single();let T;if(E!=null&&E.brokerage_id){const{data:R}=await Y.from("brokerages").select("name").eq("id",E.brokerage_id).single();T=(R==null?void 0:R.name)||void 0}let P=null;if(k.contact_id){const{data:R}=await Y.from("innercircle_contacts").select("first_name, last_name, email, phone").eq("id",k.contact_id).single();P=R}s({...k,owner_name:E==null?void 0:E.name,owner_email:E==null?void 0:E.email,owner_phone:E==null?void 0:E.phone,owner_avatar:E==null?void 0:E.avatar_url,owner_title:(E==null?void 0:E.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/"),R=P.includes("?")?"&":"?";return`${P}${R}responsive=true`}if(k.includes("iframe.mediadelivery.net")){const P=k.includes("?")?"&":"?";return`${k}${P}responsive=true`}const E=k.match(/loom\.com\/share\/([a-zA-Z0-9]+)/);if(E)return`https://www.loom.com/embed/${E[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(n)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(Cr,{className:"h-12 w-3/4 mx-auto"}),r.jsx(Cr,{className:"h-64 w-full"}),r.jsx(Cr,{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(Sn,{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(L8e,{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"})]})}function ydt(){const{user:e}=Yr();return Kt({queryKey:["open-houses",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:s}=await Y.from("open_houses").select("*").order("event_date",{ascending:!1});if(s)throw s;return t},enabled:!!e})}function vdt(e){const{user:t}=Yr(),s=Br();return A.useEffect(()=>{if(!e)return;const n=Y.channel(`visitors-${e}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"open_house_visitors",filter:`open_house_id=eq.${e}`},()=>{s.invalidateQueries({queryKey:["open-house-visitors",e]}),s.invalidateQueries({queryKey:["open-houses"]})}).subscribe();return()=>{Y.removeChannel(n)}},[e,s]),Kt({queryKey:["open-house-visitors",e],queryFn:async()=>{const{data:n,error:a}=await Y.from("open_house_visitors").select("*").eq("open_house_id",e).order("created_at",{ascending:!1});if(a)throw a;return n},enabled:!!t&&!!e})}function _dt(){const e=Br(),{user:t}=Yr();return ar({mutationFn:async s=>{const{data:n,error:a}=await Y.from("open_houses").insert({...s,agent_id:t.id}).select().single();if(a)throw a;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["open-houses"]}),Wn({title:"Open house created!"})},onError:s=>{Wn({title:"Error",description:s.message,variant:"destructive"})}})}function bdt(){const e=Br();return ar({mutationFn:async({id:t,...s})=>{const{error:n}=await Y.from("open_houses").update(s).eq("id",t);if(n)throw n},onSuccess:(t,s)=>{e.invalidateQueries({queryKey:["open-houses"]}),e.invalidateQueries({queryKey:["open-house",s.id]})}})}function wdt(){const e=Br();return ar({mutationFn:async t=>{const{error:s}=await Y.from("open_houses").delete().eq("id",t);if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["open-houses"]}),Wn({title:"Open house deleted"})}})}function O8e(e){return Kt({queryKey:["public-open-house",e],queryFn:async()=>{const{data:t,error:s}=await Y.from("open_houses").select("*, profiles:agent_id(name, avatar_url, title)").eq("slug",e).eq("is_active",!0).single();if(s)throw s;let n=null;if(t.agent_id){const{data:a}=await Y.from("agent_cards").select("slug").eq("user_id",t.agent_id).eq("is_published",!0).maybeSingle();a&&(n=a.slug)}return{...t,agent_card_slug:n}},enabled:!!e})}function D8e(){return ar({mutationFn:async e=>{const{error:t}=await Y.from("open_house_visitors").insert(e);if(t)throw t}})}function En(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 Do(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Jl(e,t){const s=En(e);return isNaN(t)?Do(e,NaN):(t&&s.setDate(s.getDate()+t),s)}function zh(e,t){const s=En(e);if(isNaN(t))return Do(e,NaN);if(!t)return s;const n=s.getDate(),a=Do(e,s.getTime());a.setMonth(s.getMonth()+t+1,0);const o=a.getDate();return n>=o?a:(s.setFullYear(a.getFullYear(),a.getMonth(),n),s)}function R8e(e,t){const s=+En(e);return Do(e,s+t)}const nye=6048e5,jdt=864e5,F8e=6e4,z8e=36e5,kdt=1e3,hO=43200,Jke=1440;function eNe(e,t){return R8e(e,t*z8e)}let Ndt={};function Av(){return Ndt}function Sm(e,t){var i,u,m,x;const s=Av(),n=(t==null?void 0:t.weekStartsOn)??((u=(i=t==null?void 0:t.locale)==null?void 0:i.options)==null?void 0:u.weekStartsOn)??s.weekStartsOn??((x=(m=s.locale)==null?void 0:m.options)==null?void 0:x.weekStartsOn)??0,a=En(e),o=a.getDay(),l=(o=a.getTime()?s+1:t.getTime()>=l.getTime()?s:s-1}function Cm(e){const t=En(e);return t.setHours(0,0,0,0),t}function gv(e){const t=En(e),s=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return s.setUTCFullYear(t.getFullYear()),+e-+s}function kf(e,t){const s=Cm(e),n=Cm(t),a=+s-gv(s),o=+n-gv(n);return Math.round((a-o)/jdt)}function Sdt(e){const t=B8e(e),s=Do(e,0);return s.setFullYear(t,0,4),s.setHours(0,0,0,0),Iy(s)}function tNe(e,t){return R8e(e,t*F8e)}function cj(e,t){const s=t*7;return Jl(e,s)}function Cdt(e,t){return zh(e,t*12)}function Mdt(e){let t;return e.forEach(function(s){const n=En(s);(t===void 0||t{const n=En(s);(!t||t>n||isNaN(+n))&&(t=n)}),t||new Date(NaN)}function Vee(e,t){const s=En(e),n=En(t),a=s.getTime()-n.getTime();return a<0?-1:a>0?1:a}function Adt(e){return Do(e,Date.now())}function ic(e,t){const s=Cm(e),n=Cm(t);return+s==+n}function aye(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function gme(e){if(!aye(e)&&typeof e!="number")return!1;const t=En(e);return!isNaN(Number(t))}function OC(e,t){const s=En(e),n=En(t),a=s.getFullYear()-n.getFullYear(),o=s.getMonth()-n.getMonth();return a*12+o}function Edt(e,t,s){const n=Sm(e,s),a=Sm(t,s),o=+n-gv(n),l=+a-gv(a);return Math.round((o-l)/nye)}function Py(e,t){const s=En(e),n=En(t),a=rNe(s,n),o=Math.abs(kf(s,n));s.setDate(s.getDate()-a*o);const l=+(rNe(s,n)===-a),i=a*(o-l);return i===0?0:i}function rNe(e,t){const s=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 s<0?-1:s>0?1:s}function Idt(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function Pdt(e,t){return+En(e)-+En(t)}function Ldt(e){const t=En(e);return t.setHours(23,59,59,999),t}function Wne(e){const t=En(e),s=t.getMonth();return t.setFullYear(t.getFullYear(),s+1,0),t.setHours(23,59,59,999),t}function Odt(e){const t=En(e);return+Ldt(t)==+Wne(t)}function Ddt(e,t){const s=En(e),n=En(t),a=Vee(s,n),o=Math.abs(OC(s,n));let l;if(o<1)l=0;else{s.getMonth()===1&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-a*o);let i=Vee(s,n)===-a;Odt(En(e))&&o===1&&Vee(e,n)===1&&(i=!1),l=a*(o-Number(i))}return l===0?0:l}function Rdt(e,t,s){const n=Pdt(e,t)/1e3;return Idt(s==null?void 0:s.roundingMethod)(n)}function Rh(e){const t=En(e);return t.setDate(1),t.setHours(0,0,0,0),t}function $8e(e){const t=En(e),s=Do(e,0);return s.setFullYear(t.getFullYear(),0,1),s.setHours(0,0,0,0),s}function iye(e,t){var i,u,m,x;const s=Av(),n=(t==null?void 0:t.weekStartsOn)??((u=(i=t==null?void 0:t.locale)==null?void 0:i.options)==null?void 0:u.weekStartsOn)??s.weekStartsOn??((x=(m=s.locale)==null?void 0:m.options)==null?void 0:x.weekStartsOn)??0,a=En(e),o=a.getDay(),l=(o{let n;const a=Fdt[e];return typeof a=="string"?n=a:t===1?n=a.one:n=a.other.replace("{{count}}",t.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+n:n+" ago":n};function Vce(e){return(t={})=>{const s=t.width?String(t.width):e.defaultWidth;return e.formats[s]||e.formats[e.defaultWidth]}}const Bdt={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},$dt={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Udt={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},qdt={date:Vce({formats:Bdt,defaultWidth:"full"}),time:Vce({formats:$dt,defaultWidth:"full"}),dateTime:Vce({formats:Udt,defaultWidth:"full"})},Vdt={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Hdt=(e,t,s,n)=>Vdt[e];function dT(e){return(t,s)=>{const n=s!=null&&s.context?String(s.context):"standalone";let a;if(n==="formatting"&&e.formattingValues){const l=e.defaultFormattingWidth||e.defaultWidth,i=s!=null&&s.width?String(s.width):l;a=e.formattingValues[i]||e.formattingValues[l]}else{const l=e.defaultWidth,i=s!=null&&s.width?String(s.width):e.defaultWidth;a=e.values[i]||e.values[l]}const o=e.argumentCallback?e.argumentCallback(t):t;return a[o]}}const Wdt={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Gdt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Kdt={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"]},Zdt={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"]},Ydt={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"}},Xdt={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"}},Qdt=(e,t)=>{const s=Number(e),n=s%100;if(n>20||n<10)switch(n%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},Jdt={ordinalNumber:Qdt,era:dT({values:Wdt,defaultWidth:"wide"}),quarter:dT({values:Gdt,defaultWidth:"wide",argumentCallback:e=>e-1}),month:dT({values:Kdt,defaultWidth:"wide"}),day:dT({values:Zdt,defaultWidth:"wide"}),dayPeriod:dT({values:Ydt,defaultWidth:"wide",formattingValues:Xdt,defaultFormattingWidth:"wide"})};function uT(e){return(t,s={})=>{const n=s.width,a=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],o=t.match(a);if(!o)return null;const l=o[0],i=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],u=Array.isArray(i)?tut(i,y=>y.test(l)):eut(i,y=>y.test(l));let m;m=e.valueCallback?e.valueCallback(u):u,m=s.valueCallback?s.valueCallback(m):m;const x=t.slice(l.length);return{value:m,rest:x}}}function eut(e,t){for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&t(e[s]))return s}function tut(e,t){for(let s=0;s{const n=t.match(e.matchPattern);if(!n)return null;const a=n[0],o=t.match(e.parsePattern);if(!o)return null;let l=e.valueCallback?e.valueCallback(o[0]):o[0];l=s.valueCallback?s.valueCallback(l):l;const i=t.slice(a.length);return{value:l,rest:i}}}const sut=/^(\d+)(th|st|nd|rd)?/i,nut=/\d+/i,aut={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},iut={any:[/^b/i,/^(a|c)/i]},out={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},lut={any:[/1/i,/2/i,/3/i,/4/i]},cut={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},dut={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]},uut={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},hut={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]},mut={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},put={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}},fut={ordinalNumber:rut({matchPattern:sut,parsePattern:nut,valueCallback:e=>parseInt(e,10)}),era:uT({matchPatterns:aut,defaultMatchWidth:"wide",parsePatterns:iut,defaultParseWidth:"any"}),quarter:uT({matchPatterns:out,defaultMatchWidth:"wide",parsePatterns:lut,defaultParseWidth:"any",valueCallback:e=>e+1}),month:uT({matchPatterns:cut,defaultMatchWidth:"wide",parsePatterns:dut,defaultParseWidth:"any"}),day:uT({matchPatterns:uut,defaultMatchWidth:"wide",parsePatterns:hut,defaultParseWidth:"any"}),dayPeriod:uT({matchPatterns:mut,defaultMatchWidth:"any",parsePatterns:put,defaultParseWidth:"any"})},Gne={code:"en-US",formatDistance:zdt,formatLong:qdt,formatRelative:Hdt,localize:Jdt,match:fut,options:{weekStartsOn:0,firstWeekContainsDate:1}};function gut(e){const t=En(e);return kf(t,$8e(t))+1}function oye(e){const t=En(e),s=+Iy(t)-+Sdt(t);return Math.round(s/nye)+1}function lye(e,t){var x,y,v,b;const s=En(e),n=s.getFullYear(),a=Av(),o=(t==null?void 0:t.firstWeekContainsDate)??((y=(x=t==null?void 0:t.locale)==null?void 0:x.options)==null?void 0:y.firstWeekContainsDate)??a.firstWeekContainsDate??((b=(v=a.locale)==null?void 0:v.options)==null?void 0:b.firstWeekContainsDate)??1,l=Do(e,0);l.setFullYear(n+1,0,o),l.setHours(0,0,0,0);const i=Sm(l,t),u=Do(e,0);u.setFullYear(n,0,o),u.setHours(0,0,0,0);const m=Sm(u,t);return s.getTime()>=i.getTime()?n+1:s.getTime()>=m.getTime()?n:n-1}function xut(e,t){var i,u,m,x;const s=Av(),n=(t==null?void 0:t.firstWeekContainsDate)??((u=(i=t==null?void 0:t.locale)==null?void 0:i.options)==null?void 0:u.firstWeekContainsDate)??s.firstWeekContainsDate??((x=(m=s.locale)==null?void 0:m.options)==null?void 0:x.firstWeekContainsDate)??1,a=lye(e,t),o=Do(e,0);return o.setFullYear(a,0,n),o.setHours(0,0,0,0),Sm(o,t)}function cye(e,t){const s=En(e),n=+Sm(s,t)-+xut(s,t);return Math.round(n/nye)+1}function Lo(e,t){const s=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return s+n}const B0={y(e,t){const s=e.getFullYear(),n=s>0?s:1-s;return Lo(t==="yy"?n%100:n,t.length)},M(e,t){const s=e.getMonth();return t==="M"?String(s+1):Lo(s+1,2)},d(e,t){return Lo(e.getDate(),t.length)},a(e,t){const s=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(e,t){return Lo(e.getHours()%12||12,t.length)},H(e,t){return Lo(e.getHours(),t.length)},m(e,t){return Lo(e.getMinutes(),t.length)},s(e,t){return Lo(e.getSeconds(),t.length)},S(e,t){const s=t.length,n=e.getMilliseconds(),a=Math.trunc(n*Math.pow(10,s-3));return Lo(a,t.length)}},E4={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},sNe={G:function(e,t,s){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return s.era(n,{width:"abbreviated"});case"GGGGG":return s.era(n,{width:"narrow"});case"GGGG":default:return s.era(n,{width:"wide"})}},y:function(e,t,s){if(t==="yo"){const n=e.getFullYear(),a=n>0?n:1-n;return s.ordinalNumber(a,{unit:"year"})}return B0.y(e,t)},Y:function(e,t,s,n){const a=lye(e,n),o=a>0?a:1-a;if(t==="YY"){const l=o%100;return Lo(l,2)}return t==="Yo"?s.ordinalNumber(o,{unit:"year"}):Lo(o,t.length)},R:function(e,t){const s=B8e(e);return Lo(s,t.length)},u:function(e,t){const s=e.getFullYear();return Lo(s,t.length)},Q:function(e,t,s){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return Lo(n,2);case"Qo":return s.ordinalNumber(n,{unit:"quarter"});case"QQQ":return s.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,s){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return Lo(n,2);case"qo":return s.ordinalNumber(n,{unit:"quarter"});case"qqq":return s.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,s){const n=e.getMonth();switch(t){case"M":case"MM":return B0.M(e,t);case"Mo":return s.ordinalNumber(n+1,{unit:"month"});case"MMM":return s.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,s){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return Lo(n+1,2);case"Lo":return s.ordinalNumber(n+1,{unit:"month"});case"LLL":return s.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,s,n){const a=cye(e,n);return t==="wo"?s.ordinalNumber(a,{unit:"week"}):Lo(a,t.length)},I:function(e,t,s){const n=oye(e);return t==="Io"?s.ordinalNumber(n,{unit:"week"}):Lo(n,t.length)},d:function(e,t,s){return t==="do"?s.ordinalNumber(e.getDate(),{unit:"date"}):B0.d(e,t)},D:function(e,t,s){const n=gut(e);return t==="Do"?s.ordinalNumber(n,{unit:"dayOfYear"}):Lo(n,t.length)},E:function(e,t,s){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return s.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(n,{width:"short",context:"formatting"});case"EEEE":default:return s.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,s,n){const a=e.getDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return Lo(o,2);case"eo":return s.ordinalNumber(o,{unit:"day"});case"eee":return s.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(a,{width:"short",context:"formatting"});case"eeee":default:return s.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,s,n){const a=e.getDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return Lo(o,t.length);case"co":return s.ordinalNumber(o,{unit:"day"});case"ccc":return s.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(a,{width:"narrow",context:"standalone"});case"cccccc":return s.day(a,{width:"short",context:"standalone"});case"cccc":default:return s.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,s){const n=e.getDay(),a=n===0?7:n;switch(t){case"i":return String(a);case"ii":return Lo(a,t.length);case"io":return s.ordinalNumber(a,{unit:"day"});case"iii":return s.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(n,{width:"short",context:"formatting"});case"iiii":default:return s.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,s){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return s.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,s){const n=e.getHours();let a;switch(n===12?a=E4.noon:n===0?a=E4.midnight:a=n/12>=1?"pm":"am",t){case"b":case"bb":return s.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,s){const n=e.getHours();let a;switch(n>=17?a=E4.evening:n>=12?a=E4.afternoon:n>=4?a=E4.morning:a=E4.night,t){case"B":case"BB":case"BBB":return s.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,s){if(t==="ho"){let n=e.getHours()%12;return n===0&&(n=12),s.ordinalNumber(n,{unit:"hour"})}return B0.h(e,t)},H:function(e,t,s){return t==="Ho"?s.ordinalNumber(e.getHours(),{unit:"hour"}):B0.H(e,t)},K:function(e,t,s){const n=e.getHours()%12;return t==="Ko"?s.ordinalNumber(n,{unit:"hour"}):Lo(n,t.length)},k:function(e,t,s){let n=e.getHours();return n===0&&(n=24),t==="ko"?s.ordinalNumber(n,{unit:"hour"}):Lo(n,t.length)},m:function(e,t,s){return t==="mo"?s.ordinalNumber(e.getMinutes(),{unit:"minute"}):B0.m(e,t)},s:function(e,t,s){return t==="so"?s.ordinalNumber(e.getSeconds(),{unit:"second"}):B0.s(e,t)},S:function(e,t){return B0.S(e,t)},X:function(e,t,s){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return aNe(n);case"XXXX":case"XX":return Yw(n);case"XXXXX":case"XXX":default:return Yw(n,":")}},x:function(e,t,s){const n=e.getTimezoneOffset();switch(t){case"x":return aNe(n);case"xxxx":case"xx":return Yw(n);case"xxxxx":case"xxx":default:return Yw(n,":")}},O:function(e,t,s){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+nNe(n,":");case"OOOO":default:return"GMT"+Yw(n,":")}},z:function(e,t,s){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+nNe(n,":");case"zzzz":default:return"GMT"+Yw(n,":")}},t:function(e,t,s){const n=Math.trunc(e.getTime()/1e3);return Lo(n,t.length)},T:function(e,t,s){const n=e.getTime();return Lo(n,t.length)}};function nNe(e,t=""){const s=e>0?"-":"+",n=Math.abs(e),a=Math.trunc(n/60),o=n%60;return o===0?s+String(a):s+String(a)+t+Lo(o,2)}function aNe(e,t){return e%60===0?(e>0?"-":"+")+Lo(Math.abs(e)/60,2):Yw(e,t)}function Yw(e,t=""){const s=e>0?"-":"+",n=Math.abs(e),a=Lo(Math.trunc(n/60),2),o=Lo(n%60,2);return s+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"})}},q8e=(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"})}},yut=(e,t)=>{const s=e.match(/(P+)(p+)?/)||[],n=s[1],a=s[2];if(!a)return iNe(e,t);let o;switch(n){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(n,t)).replace("{{time}}",q8e(a,t))},xme={p:q8e,P:yut},vut=/^D+$/,_ut=/^Y+$/,but=["D","DD","YY","YYYY"];function V8e(e){return vut.test(e)}function H8e(e){return _ut.test(e)}function yme(e,t,s){const n=wut(e,t,s);if(console.warn(n),but.includes(e))throw new RangeError(n)}function wut(e,t,s){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const jut=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,kut=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Nut=/^'([^]*?)'?$/,Sut=/''/g,Cut=/[a-zA-Z]/;function rs(e,t,s){var x,y,v,b,N,k,M,E;const n=Av(),a=(s==null?void 0:s.locale)??n.locale??Gne,o=(s==null?void 0:s.firstWeekContainsDate)??((y=(x=s==null?void 0:s.locale)==null?void 0:x.options)==null?void 0:y.firstWeekContainsDate)??n.firstWeekContainsDate??((b=(v=n.locale)==null?void 0:v.options)==null?void 0:b.firstWeekContainsDate)??1,l=(s==null?void 0:s.weekStartsOn)??((k=(N=s==null?void 0:s.locale)==null?void 0:N.options)==null?void 0:k.weekStartsOn)??n.weekStartsOn??((E=(M=n.locale)==null?void 0:M.options)==null?void 0:E.weekStartsOn)??0,i=En(e);if(!gme(i))throw new RangeError("Invalid time value");let u=t.match(kut).map(T=>{const P=T[0];if(P==="p"||P==="P"){const R=xme[P];return R(T,a.formatLong)}return T}).join("").match(jut).map(T=>{if(T==="''")return{isToken:!1,value:"'"};const P=T[0];if(P==="'")return{isToken:!1,value:Mut(T)};if(sNe[P])return{isToken:!0,value:T};if(P.match(Cut))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;(!(s!=null&&s.useAdditionalWeekYearTokens)&&H8e(P)||!(s!=null&&s.useAdditionalDayOfYearTokens)&&V8e(P))&&yme(P,t,String(e));const R=sNe[P[0]];return R(i,P,a.localize,m)}).join("")}function Mut(e){const t=e.match(Nut);return t?t[1].replace(Sut,"'"):e}function Tut(e,t,s){const n=Av(),a=(s==null?void 0:s.locale)??n.locale??Gne,o=2520,l=Vee(e,t);if(isNaN(l))throw new RangeError("Invalid time value");const i=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:l});let u,m;l>0?(u=En(t),m=En(e)):(u=En(e),m=En(t));const x=Rdt(m,u),y=(gv(m)-gv(u))/1e3,v=Math.round((x-y)/60);let b;if(v<2)return s!=null&&s.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(vn.getTime()}function Kne(e,t){const s=En(e),n=En(t);return+s<+n}function Dut(e){return+En(e)>Date.now()}function Rut(e,t){const s=t instanceof Date?Do(t,0):new t(0);return s.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),s.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),s}const Fut=10;class W8e{constructor(){rn(this,"subPriority",0)}validate(t,s){return!0}}class zut extends W8e{constructor(t,s,n,a,o){super(),this.value=t,this.validateValue=s,this.setValue=n,this.priority=a,o&&(this.subPriority=o)}validate(t,s){return this.validateValue(t,this.value,s)}set(t,s,n){return this.setValue(t,s,this.value,n)}}class But extends W8e{constructor(){super(...arguments);rn(this,"priority",Fut);rn(this,"subPriority",-1)}set(s,n){return n.timestampIsSet?s:Do(s,Rut(s,Date))}}class No{run(t,s,n,a){const o=this.parse(t,s,n,a);return o?{setter:new zut(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}validate(t,s,n){return!0}}class $ut extends No{constructor(){super(...arguments);rn(this,"priority",140);rn(this,"incompatibleTokens",["R","u","t","T"])}parse(s,n,a){switch(n){case"G":case"GG":case"GGG":return a.era(s,{width:"abbreviated"})||a.era(s,{width:"narrow"});case"GGGGG":return a.era(s,{width:"narrow"});case"GGGG":default:return a.era(s,{width:"wide"})||a.era(s,{width:"abbreviated"})||a.era(s,{width:"narrow"})}}set(s,n,a){return n.era=a,s.setFullYear(a,0,1),s.setHours(0,0,0,0),s}}const kc={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}/},Cg={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 Nc(e,t){return e&&{value:t(e.value),rest:e.rest}}function Bl(e,t){const s=t.match(e);return s?{value:parseInt(s[0],10),rest:t.slice(s[0].length)}:null}function Mg(e,t){const s=t.match(e);if(!s)return null;if(s[0]==="Z")return{value:0,rest:t.slice(1)};const n=s[1]==="+"?1:-1,a=s[2]?parseInt(s[2],10):0,o=s[3]?parseInt(s[3],10):0,l=s[5]?parseInt(s[5],10):0;return{value:n*(a*z8e+o*F8e+l*kdt),rest:t.slice(s[0].length)}}function G8e(e){return Bl(kc.anyDigitsSigned,e)}function dc(e,t){switch(e){case 1:return Bl(kc.singleDigit,t);case 2:return Bl(kc.twoDigits,t);case 3:return Bl(kc.threeDigits,t);case 4:return Bl(kc.fourDigits,t);default:return Bl(new RegExp("^\\d{1,"+e+"}"),t)}}function Wte(e,t){switch(e){case 1:return Bl(kc.singleDigitSigned,t);case 2:return Bl(kc.twoDigitsSigned,t);case 3:return Bl(kc.threeDigitsSigned,t);case 4:return Bl(kc.fourDigitsSigned,t);default:return Bl(new RegExp("^-?\\d{1,"+e+"}"),t)}}function dye(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 K8e(e,t){const s=t>0,n=s?t:1-t;let a;if(n<=50)a=e||100;else{const o=n+50,l=Math.trunc(o/100)*100,i=e>=o%100;a=e+l-(i?100:0)}return s?a:1-a}function Z8e(e){return e%400===0||e%4===0&&e%100!==0}class Uut extends No{constructor(){super(...arguments);rn(this,"priority",130);rn(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(s,n,a){const o=l=>({year:l,isTwoDigitYear:n==="yy"});switch(n){case"y":return Nc(dc(4,s),o);case"yo":return Nc(a.ordinalNumber(s,{unit:"year"}),o);default:return Nc(dc(n.length,s),o)}}validate(s,n){return n.isTwoDigitYear||n.year>0}set(s,n,a){const o=s.getFullYear();if(a.isTwoDigitYear){const i=K8e(a.year,o);return s.setFullYear(i,0,1),s.setHours(0,0,0,0),s}const l=!("era"in n)||n.era===1?a.year:1-a.year;return s.setFullYear(l,0,1),s.setHours(0,0,0,0),s}}class qut extends No{constructor(){super(...arguments);rn(this,"priority",130);rn(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(s,n,a){const o=l=>({year:l,isTwoDigitYear:n==="YY"});switch(n){case"Y":return Nc(dc(4,s),o);case"Yo":return Nc(a.ordinalNumber(s,{unit:"year"}),o);default:return Nc(dc(n.length,s),o)}}validate(s,n){return n.isTwoDigitYear||n.year>0}set(s,n,a,o){const l=lye(s,o);if(a.isTwoDigitYear){const u=K8e(a.year,l);return s.setFullYear(u,0,o.firstWeekContainsDate),s.setHours(0,0,0,0),Sm(s,o)}const i=!("era"in n)||n.era===1?a.year:1-a.year;return s.setFullYear(i,0,o.firstWeekContainsDate),s.setHours(0,0,0,0),Sm(s,o)}}class Vut extends No{constructor(){super(...arguments);rn(this,"priority",130);rn(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(s,n){return Wte(n==="R"?4:n.length,s)}set(s,n,a){const o=Do(s,0);return o.setFullYear(a,0,4),o.setHours(0,0,0,0),Iy(o)}}class Hut extends No{constructor(){super(...arguments);rn(this,"priority",130);rn(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(s,n){return Wte(n==="u"?4:n.length,s)}set(s,n,a){return s.setFullYear(a,0,1),s.setHours(0,0,0,0),s}}class Wut extends No{constructor(){super(...arguments);rn(this,"priority",120);rn(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(s,n,a){switch(n){case"Q":case"QQ":return dc(n.length,s);case"Qo":return a.ordinalNumber(s,{unit:"quarter"});case"QQQ":return a.quarter(s,{width:"abbreviated",context:"formatting"})||a.quarter(s,{width:"narrow",context:"formatting"});case"QQQQQ":return a.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return a.quarter(s,{width:"wide",context:"formatting"})||a.quarter(s,{width:"abbreviated",context:"formatting"})||a.quarter(s,{width:"narrow",context:"formatting"})}}validate(s,n){return n>=1&&n<=4}set(s,n,a){return s.setMonth((a-1)*3,1),s.setHours(0,0,0,0),s}}class Gut extends No{constructor(){super(...arguments);rn(this,"priority",120);rn(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(s,n,a){switch(n){case"q":case"qq":return dc(n.length,s);case"qo":return a.ordinalNumber(s,{unit:"quarter"});case"qqq":return a.quarter(s,{width:"abbreviated",context:"standalone"})||a.quarter(s,{width:"narrow",context:"standalone"});case"qqqqq":return a.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return a.quarter(s,{width:"wide",context:"standalone"})||a.quarter(s,{width:"abbreviated",context:"standalone"})||a.quarter(s,{width:"narrow",context:"standalone"})}}validate(s,n){return n>=1&&n<=4}set(s,n,a){return s.setMonth((a-1)*3,1),s.setHours(0,0,0,0),s}}class Kut extends No{constructor(){super(...arguments);rn(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);rn(this,"priority",110)}parse(s,n,a){const o=l=>l-1;switch(n){case"M":return Nc(Bl(kc.month,s),o);case"MM":return Nc(dc(2,s),o);case"Mo":return Nc(a.ordinalNumber(s,{unit:"month"}),o);case"MMM":return a.month(s,{width:"abbreviated",context:"formatting"})||a.month(s,{width:"narrow",context:"formatting"});case"MMMMM":return a.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return a.month(s,{width:"wide",context:"formatting"})||a.month(s,{width:"abbreviated",context:"formatting"})||a.month(s,{width:"narrow",context:"formatting"})}}validate(s,n){return n>=0&&n<=11}set(s,n,a){return s.setMonth(a,1),s.setHours(0,0,0,0),s}}class Zut extends No{constructor(){super(...arguments);rn(this,"priority",110);rn(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(s,n,a){const o=l=>l-1;switch(n){case"L":return Nc(Bl(kc.month,s),o);case"LL":return Nc(dc(2,s),o);case"Lo":return Nc(a.ordinalNumber(s,{unit:"month"}),o);case"LLL":return a.month(s,{width:"abbreviated",context:"standalone"})||a.month(s,{width:"narrow",context:"standalone"});case"LLLLL":return a.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return a.month(s,{width:"wide",context:"standalone"})||a.month(s,{width:"abbreviated",context:"standalone"})||a.month(s,{width:"narrow",context:"standalone"})}}validate(s,n){return n>=0&&n<=11}set(s,n,a){return s.setMonth(a,1),s.setHours(0,0,0,0),s}}function Yut(e,t,s){const n=En(e),a=cye(n,s)-t;return n.setDate(n.getDate()-a*7),n}class Xut extends No{constructor(){super(...arguments);rn(this,"priority",100);rn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(s,n,a){switch(n){case"w":return Bl(kc.week,s);case"wo":return a.ordinalNumber(s,{unit:"week"});default:return dc(n.length,s)}}validate(s,n){return n>=1&&n<=53}set(s,n,a,o){return Sm(Yut(s,a,o),o)}}function Qut(e,t){const s=En(e),n=oye(s)-t;return s.setDate(s.getDate()-n*7),s}class Jut extends No{constructor(){super(...arguments);rn(this,"priority",100);rn(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(s,n,a){switch(n){case"I":return Bl(kc.week,s);case"Io":return a.ordinalNumber(s,{unit:"week"});default:return dc(n.length,s)}}validate(s,n){return n>=1&&n<=53}set(s,n,a){return Iy(Qut(s,a))}}const eht=[31,28,31,30,31,30,31,31,30,31,30,31],tht=[31,29,31,30,31,30,31,31,30,31,30,31];class rht extends No{constructor(){super(...arguments);rn(this,"priority",90);rn(this,"subPriority",1);rn(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(s,n,a){switch(n){case"d":return Bl(kc.date,s);case"do":return a.ordinalNumber(s,{unit:"date"});default:return dc(n.length,s)}}validate(s,n){const a=s.getFullYear(),o=Z8e(a),l=s.getMonth();return o?n>=1&&n<=tht[l]:n>=1&&n<=eht[l]}set(s,n,a){return s.setDate(a),s.setHours(0,0,0,0),s}}class sht extends No{constructor(){super(...arguments);rn(this,"priority",90);rn(this,"subpriority",1);rn(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(s,n,a){switch(n){case"D":case"DD":return Bl(kc.dayOfYear,s);case"Do":return a.ordinalNumber(s,{unit:"date"});default:return dc(n.length,s)}}validate(s,n){const a=s.getFullYear();return Z8e(a)?n>=1&&n<=366:n>=1&&n<=365}set(s,n,a){return s.setMonth(0,a),s.setHours(0,0,0,0),s}}function uye(e,t,s){var y,v,b,N;const n=Av(),a=(s==null?void 0:s.weekStartsOn)??((v=(y=s==null?void 0:s.locale)==null?void 0:y.options)==null?void 0:v.weekStartsOn)??n.weekStartsOn??((N=(b=n.locale)==null?void 0:b.options)==null?void 0:N.weekStartsOn)??0,o=En(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 Jl(o,x)}class nht extends No{constructor(){super(...arguments);rn(this,"priority",90);rn(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(s,n,a){switch(n){case"E":case"EE":case"EEE":return a.day(s,{width:"abbreviated",context:"formatting"})||a.day(s,{width:"short",context:"formatting"})||a.day(s,{width:"narrow",context:"formatting"});case"EEEEE":return a.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return a.day(s,{width:"short",context:"formatting"})||a.day(s,{width:"narrow",context:"formatting"});case"EEEE":default:return a.day(s,{width:"wide",context:"formatting"})||a.day(s,{width:"abbreviated",context:"formatting"})||a.day(s,{width:"short",context:"formatting"})||a.day(s,{width:"narrow",context:"formatting"})}}validate(s,n){return n>=0&&n<=6}set(s,n,a,o){return s=uye(s,a,o),s.setHours(0,0,0,0),s}}class aht extends No{constructor(){super(...arguments);rn(this,"priority",90);rn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(s,n,a,o){const l=i=>{const u=Math.floor((i-1)/7)*7;return(i+o.weekStartsOn+6)%7+u};switch(n){case"e":case"ee":return Nc(dc(n.length,s),l);case"eo":return Nc(a.ordinalNumber(s,{unit:"day"}),l);case"eee":return a.day(s,{width:"abbreviated",context:"formatting"})||a.day(s,{width:"short",context:"formatting"})||a.day(s,{width:"narrow",context:"formatting"});case"eeeee":return a.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return a.day(s,{width:"short",context:"formatting"})||a.day(s,{width:"narrow",context:"formatting"});case"eeee":default:return a.day(s,{width:"wide",context:"formatting"})||a.day(s,{width:"abbreviated",context:"formatting"})||a.day(s,{width:"short",context:"formatting"})||a.day(s,{width:"narrow",context:"formatting"})}}validate(s,n){return n>=0&&n<=6}set(s,n,a,o){return s=uye(s,a,o),s.setHours(0,0,0,0),s}}class iht extends No{constructor(){super(...arguments);rn(this,"priority",90);rn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(s,n,a,o){const l=i=>{const u=Math.floor((i-1)/7)*7;return(i+o.weekStartsOn+6)%7+u};switch(n){case"c":case"cc":return Nc(dc(n.length,s),l);case"co":return Nc(a.ordinalNumber(s,{unit:"day"}),l);case"ccc":return a.day(s,{width:"abbreviated",context:"standalone"})||a.day(s,{width:"short",context:"standalone"})||a.day(s,{width:"narrow",context:"standalone"});case"ccccc":return a.day(s,{width:"narrow",context:"standalone"});case"cccccc":return a.day(s,{width:"short",context:"standalone"})||a.day(s,{width:"narrow",context:"standalone"});case"cccc":default:return a.day(s,{width:"wide",context:"standalone"})||a.day(s,{width:"abbreviated",context:"standalone"})||a.day(s,{width:"short",context:"standalone"})||a.day(s,{width:"narrow",context:"standalone"})}}validate(s,n){return n>=0&&n<=6}set(s,n,a,o){return s=uye(s,a,o),s.setHours(0,0,0,0),s}}function oht(e,t){const s=En(e),n=Iut(s),a=t-n;return Jl(s,a)}class lht extends No{constructor(){super(...arguments);rn(this,"priority",90);rn(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(s,n,a){const o=l=>l===0?7:l;switch(n){case"i":case"ii":return dc(n.length,s);case"io":return a.ordinalNumber(s,{unit:"day"});case"iii":return Nc(a.day(s,{width:"abbreviated",context:"formatting"})||a.day(s,{width:"short",context:"formatting"})||a.day(s,{width:"narrow",context:"formatting"}),o);case"iiiii":return Nc(a.day(s,{width:"narrow",context:"formatting"}),o);case"iiiiii":return Nc(a.day(s,{width:"short",context:"formatting"})||a.day(s,{width:"narrow",context:"formatting"}),o);case"iiii":default:return Nc(a.day(s,{width:"wide",context:"formatting"})||a.day(s,{width:"abbreviated",context:"formatting"})||a.day(s,{width:"short",context:"formatting"})||a.day(s,{width:"narrow",context:"formatting"}),o)}}validate(s,n){return n>=1&&n<=7}set(s,n,a){return s=oht(s,a),s.setHours(0,0,0,0),s}}class cht extends No{constructor(){super(...arguments);rn(this,"priority",80);rn(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(s,n,a){switch(n){case"a":case"aa":case"aaa":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"})||a.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaaa":return a.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return a.dayPeriod(s,{width:"wide",context:"formatting"})||a.dayPeriod(s,{width:"abbreviated",context:"formatting"})||a.dayPeriod(s,{width:"narrow",context:"formatting"})}}set(s,n,a){return s.setHours(dye(a),0,0,0),s}}class dht extends No{constructor(){super(...arguments);rn(this,"priority",80);rn(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(s,n,a){switch(n){case"b":case"bb":case"bbb":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"})||a.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbbb":return a.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return a.dayPeriod(s,{width:"wide",context:"formatting"})||a.dayPeriod(s,{width:"abbreviated",context:"formatting"})||a.dayPeriod(s,{width:"narrow",context:"formatting"})}}set(s,n,a){return s.setHours(dye(a),0,0,0),s}}class uht extends No{constructor(){super(...arguments);rn(this,"priority",80);rn(this,"incompatibleTokens",["a","b","t","T"])}parse(s,n,a){switch(n){case"B":case"BB":case"BBB":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"})||a.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBBB":return a.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return a.dayPeriod(s,{width:"wide",context:"formatting"})||a.dayPeriod(s,{width:"abbreviated",context:"formatting"})||a.dayPeriod(s,{width:"narrow",context:"formatting"})}}set(s,n,a){return s.setHours(dye(a),0,0,0),s}}class hht extends No{constructor(){super(...arguments);rn(this,"priority",70);rn(this,"incompatibleTokens",["H","K","k","t","T"])}parse(s,n,a){switch(n){case"h":return Bl(kc.hour12h,s);case"ho":return a.ordinalNumber(s,{unit:"hour"});default:return dc(n.length,s)}}validate(s,n){return n>=1&&n<=12}set(s,n,a){const o=s.getHours()>=12;return o&&a<12?s.setHours(a+12,0,0,0):!o&&a===12?s.setHours(0,0,0,0):s.setHours(a,0,0,0),s}}class mht extends No{constructor(){super(...arguments);rn(this,"priority",70);rn(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(s,n,a){switch(n){case"H":return Bl(kc.hour23h,s);case"Ho":return a.ordinalNumber(s,{unit:"hour"});default:return dc(n.length,s)}}validate(s,n){return n>=0&&n<=23}set(s,n,a){return s.setHours(a,0,0,0),s}}class pht extends No{constructor(){super(...arguments);rn(this,"priority",70);rn(this,"incompatibleTokens",["h","H","k","t","T"])}parse(s,n,a){switch(n){case"K":return Bl(kc.hour11h,s);case"Ko":return a.ordinalNumber(s,{unit:"hour"});default:return dc(n.length,s)}}validate(s,n){return n>=0&&n<=11}set(s,n,a){return s.getHours()>=12&&a<12?s.setHours(a+12,0,0,0):s.setHours(a,0,0,0),s}}class fht extends No{constructor(){super(...arguments);rn(this,"priority",70);rn(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(s,n,a){switch(n){case"k":return Bl(kc.hour24h,s);case"ko":return a.ordinalNumber(s,{unit:"hour"});default:return dc(n.length,s)}}validate(s,n){return n>=1&&n<=24}set(s,n,a){const o=a<=24?a%24:a;return s.setHours(o,0,0,0),s}}class ght extends No{constructor(){super(...arguments);rn(this,"priority",60);rn(this,"incompatibleTokens",["t","T"])}parse(s,n,a){switch(n){case"m":return Bl(kc.minute,s);case"mo":return a.ordinalNumber(s,{unit:"minute"});default:return dc(n.length,s)}}validate(s,n){return n>=0&&n<=59}set(s,n,a){return s.setMinutes(a,0,0),s}}class xht extends No{constructor(){super(...arguments);rn(this,"priority",50);rn(this,"incompatibleTokens",["t","T"])}parse(s,n,a){switch(n){case"s":return Bl(kc.second,s);case"so":return a.ordinalNumber(s,{unit:"second"});default:return dc(n.length,s)}}validate(s,n){return n>=0&&n<=59}set(s,n,a){return s.setSeconds(a,0),s}}class yht extends No{constructor(){super(...arguments);rn(this,"priority",30);rn(this,"incompatibleTokens",["t","T"])}parse(s,n){const a=o=>Math.trunc(o*Math.pow(10,-n.length+3));return Nc(dc(n.length,s),a)}set(s,n,a){return s.setMilliseconds(a),s}}class vht extends No{constructor(){super(...arguments);rn(this,"priority",10);rn(this,"incompatibleTokens",["t","T","x"])}parse(s,n){switch(n){case"X":return Mg(Cg.basicOptionalMinutes,s);case"XX":return Mg(Cg.basic,s);case"XXXX":return Mg(Cg.basicOptionalSeconds,s);case"XXXXX":return Mg(Cg.extendedOptionalSeconds,s);case"XXX":default:return Mg(Cg.extended,s)}}set(s,n,a){return n.timestampIsSet?s:Do(s,s.getTime()-gv(s)-a)}}class _ht extends No{constructor(){super(...arguments);rn(this,"priority",10);rn(this,"incompatibleTokens",["t","T","X"])}parse(s,n){switch(n){case"x":return Mg(Cg.basicOptionalMinutes,s);case"xx":return Mg(Cg.basic,s);case"xxxx":return Mg(Cg.basicOptionalSeconds,s);case"xxxxx":return Mg(Cg.extendedOptionalSeconds,s);case"xxx":default:return Mg(Cg.extended,s)}}set(s,n,a){return n.timestampIsSet?s:Do(s,s.getTime()-gv(s)-a)}}class bht extends No{constructor(){super(...arguments);rn(this,"priority",40);rn(this,"incompatibleTokens","*")}parse(s){return G8e(s)}set(s,n,a){return[Do(s,a*1e3),{timestampIsSet:!0}]}}class wht extends No{constructor(){super(...arguments);rn(this,"priority",20);rn(this,"incompatibleTokens","*")}parse(s){return G8e(s)}set(s,n,a){return[Do(s,a),{timestampIsSet:!0}]}}const jht={G:new $ut,y:new Uut,Y:new qut,R:new Vut,u:new Hut,Q:new Wut,q:new Gut,M:new Kut,L:new Zut,w:new Xut,I:new Jut,d:new rht,D:new sht,E:new nht,e:new aht,c:new iht,i:new lht,a:new cht,b:new dht,B:new uht,h:new hht,H:new mht,K:new pht,k:new fht,m:new ght,s:new xht,S:new yht,X:new vht,x:new _ht,t:new bht,T:new wht},kht=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Nht=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Sht=/^'([^]*?)'?$/,Cht=/''/g,Mht=/\S/,Tht=/[a-zA-Z]/;function hye(e,t,s,n){var k,M,E,T;const a=Eut(),o=a.locale??Gne,l=a.firstWeekContainsDate??((M=(k=a.locale)==null?void 0:k.options)==null?void 0:M.firstWeekContainsDate)??1,i=a.weekStartsOn??((T=(E=a.locale)==null?void 0:E.options)==null?void 0:T.weekStartsOn)??0;if(t==="")return e===""?En(s):Do(s,NaN);const u={firstWeekContainsDate:l,weekStartsOn:i,locale:o},m=[new But],x=t.match(Nht).map(P=>{const R=P[0];if(R in xme){const D=xme[R];return D(P,o.formatLong)}return P}).join("").match(kht),y=[];for(let P of x){H8e(P)&&yme(P,t,e),V8e(P)&&yme(P,t,e);const R=P[0],D=jht[R];if(D){const{incompatibleTokens:U}=D;if(Array.isArray(U)){const H=y.find(G=>U.includes(G.token)||G.token===R);if(H)throw new RangeError(`The format string mustn't contain \`${H.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:R,fullToken:P});const q=D.run(e,P,o.match,u);if(!q)return Do(s,NaN);m.push(q.setter),e=q.rest}else{if(R.match(Tht))throw new RangeError("Format string contains an unescaped latin alphabet character `"+R+"`");if(P==="''"?P="'":R==="'"&&(P=Aht(P)),e.indexOf(P)===0)e=e.slice(P.length);else return Do(s,NaN)}}if(e.length>0&&Mht.test(e))return Do(s,NaN);const v=m.map(P=>P.priority).sort((P,R)=>R-P).filter((P,R,D)=>D.indexOf(P)===R).map(P=>m.filter(R=>R.priority===P).sort((R,D)=>D.subPriority-R.subPriority)).map(P=>P[0]);let b=En(s);if(isNaN(b.getTime()))return Do(s,NaN);const N={};for(const P of v){if(!P.validate(b,u))return Do(s,NaN);const R=P.set(b,N,u);Array.isArray(R)?(b=R[0],Object.assign(N,R[1])):b=R}return Do(s,b)}function Aht(e){return e.match(Sht)[1].replace(Cht,"'")}function Eht(e){return+En(e)o-l);return s>=n&&s<=a}function Hce(e,t){return Jl(e,-t)}function Wce(e,t){const s=En(e),n=s.getFullYear(),a=s.getDate(),o=Do(e,0);o.setFullYear(n,t,15),o.setHours(0,0,0,0);const l=Aut(o);return s.setMonth(t,Math.min(a,l)),s}function Y8e(e,t){const s=En(e);return s.setHours(t),s}function X8e(e,t){const s=En(e);return s.setMinutes(t),s}function cNe(e,t){const s=En(e);return isNaN(+s)?Do(e,NaN):(s.setFullYear(t),s)}function Pht(e,t){return zh(e,-12)}var yo;(function(e){e.assertEqual=a=>{};function t(a){}e.assertIs=t;function s(a){throw new Error}e.assertNever=s,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 n(a,o=" | "){return a.map(l=>typeof l=="string"?`'${l}'`:l).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(yo||(yo={}));var dNe;(function(e){e.mergeShapes=(t,s)=>({...t,...s})})(dNe||(dNe={}));const Fn=yo.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 Fn.undefined;case"string":return Fn.string;case"number":return Number.isNaN(e)?Fn.nan:Fn.number;case"boolean":return Fn.boolean;case"function":return Fn.function;case"bigint":return Fn.bigint;case"symbol":return Fn.symbol;case"object":return Array.isArray(e)?Fn.array:e===null?Fn.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Fn.promise:typeof Map<"u"&&e instanceof Map?Fn.map:typeof Set<"u"&&e instanceof Set?Fn.set:typeof Date<"u"&&e instanceof Date?Fn.date:Fn.object;default:return Fn.unknown}},Rs=yo.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 Jg extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=t}format(t){const s=t||function(o){return o.message},n={_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)n._errors.push(s(l));else{let i=n,u=0;for(;us.message){const s={},n=[];for(const a of this.issues)if(a.path.length>0){const o=a.path[0];s[o]=s[o]||[],s[o].push(t(a))}else n.push(t(a));return{formErrors:n,fieldErrors:s}}get formErrors(){return this.flatten()}}Jg.create=e=>new Jg(e);const vme=(e,t)=>{let s;switch(e.code){case Rs.invalid_type:e.received===Fn.undefined?s="Required":s=`Expected ${e.expected}, received ${e.received}`;break;case Rs.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(e.expected,yo.jsonStringifyReplacer)}`;break;case Rs.unrecognized_keys:s=`Unrecognized key(s) in object: ${yo.joinValues(e.keys,", ")}`;break;case Rs.invalid_union:s="Invalid input";break;case Rs.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${yo.joinValues(e.options)}`;break;case Rs.invalid_enum_value:s=`Invalid enum value. Expected ${yo.joinValues(e.options)}, received '${e.received}'`;break;case Rs.invalid_arguments:s="Invalid function arguments";break;case Rs.invalid_return_type:s="Invalid function return type";break;case Rs.invalid_date:s="Invalid date";break;case Rs.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(s=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?s=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?s=`Invalid input: must end with "${e.validation.endsWith}"`:yo.assertNever(e.validation):e.validation!=="regex"?s=`Invalid ${e.validation}`:s="Invalid";break;case Rs.too_small:e.type==="array"?s=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?s=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?s=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?s=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?s=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:s="Invalid input";break;case Rs.too_big:e.type==="array"?s=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?s=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?s=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?s=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?s=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:s="Invalid input";break;case Rs.custom:s="Invalid input";break;case Rs.invalid_intersection_types:s="Intersection results could not be merged";break;case Rs.not_multiple_of:s=`Number must be a multiple of ${e.multipleOf}`;break;case Rs.not_finite:s="Number must be finite";break;default:s=t.defaultError,yo.assertNever(e)}return{message:s}};let Lht=vme;function Oht(){return Lht}const Dht=e=>{const{data:t,path:s,errorMaps:n,issueData:a}=e,o=[...s,...a.path||[]],l={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let i="";const u=n.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 bn(e,t){const s=Oht(),n=Dht({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,s,s===vme?void 0:vme].filter(a=>!!a)});e.common.issues.push(n)}class Mm{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,s){const n=[];for(const a of s){if(a.status==="aborted")return si;a.status==="dirty"&&t.dirty(),n.push(a.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,s){const n=[];for(const a of s){const o=await a.key,l=await a.value;n.push({key:o,value:l})}return Mm.mergeObjectSync(t,n)}static mergeObjectSync(t,s){const n={};for(const a of s){const{key:o,value:l}=a;if(o.status==="aborted"||l.status==="aborted")return si;o.status==="dirty"&&t.dirty(),l.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof l.value<"u"||a.alwaysSet)&&(n[o.value]=l.value)}return{status:t.value,value:n}}}const si=Object.freeze({status:"aborted"}),BT=e=>({status:"dirty",value:e}),jp=e=>({status:"valid",value:e}),uNe=e=>e.status==="aborted",hNe=e=>e.status==="dirty",DC=e=>e.status==="valid",Gte=e=>typeof Promise<"u"&&e instanceof Promise;var Yn;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Yn||(Yn={}));class xv{constructor(t,s,n,a){this._cachedPath=[],this.parent=t,this.data=s,this._path=n,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 mNe=(e,t)=>{if(DC(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 s=new Jg(e.common.issues);return this._error=s,this._error}}};function Ei(e){if(!e)return{};const{errorMap:t,invalid_type_error:s,required_error:n,description:a}=e;if(t&&(s||n))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??n??i.defaultError}:l.code!=="invalid_type"?{message:i.defaultError}:{message:u??s??i.defaultError}},description:a}}class fo{get description(){return this._def.description}_getType(t){return Q0(t.data)}_getOrReturnCtx(t,s){return s||{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 Mm,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 s=this._parse(t);if(Gte(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(t){const s=this._parse(t);return Promise.resolve(s)}parse(t,s){const n=this.safeParse(t,s);if(n.success)return n.data;throw n.error}safeParse(t,s){const n={common:{issues:[],async:(s==null?void 0:s.async)??!1,contextualErrorMap:s==null?void 0:s.errorMap},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Q0(t)},a=this._parseSync({data:t,path:n.path,parent:n});return mNe(n,a)}"~validate"(t){var n,a;const s={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:s});return DC(o)?{value:o.value}:{issues:s.common.issues}}catch(o){(a=(n=o==null?void 0:o.message)==null?void 0:n.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:s}).then(o=>DC(o)?{value:o.value}:{issues:s.common.issues})}async parseAsync(t,s){const n=await this.safeParseAsync(t,s);if(n.success)return n.data;throw n.error}async safeParseAsync(t,s){const n={common:{issues:[],contextualErrorMap:s==null?void 0:s.errorMap,async:!0},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Q0(t)},a=this._parse({data:t,path:n.path,parent:n}),o=await(Gte(a)?a:Promise.resolve(a));return mNe(n,o)}refine(t,s){const n=a=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(a):s;return this._refinement((a,o)=>{const l=t(a),i=()=>o.addIssue({code:Rs.custom,...n(a)});return typeof Promise<"u"&&l instanceof Promise?l.then(u=>u?!0:(i(),!1)):l?!0:(i(),!1)})}refinement(t,s){return this._refinement((n,a)=>t(n)?!0:(a.addIssue(typeof s=="function"?s(n,a):s),!1))}_refinement(t){return new zC({schema:this,typeName:ni.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:s=>this["~validate"](s)}}optional(){return sv.create(this,this._def)}nullable(){return BC.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Zg.create(this)}promise(){return Xte.create(this,this._def)}or(t){return Zte.create([this,t],this._def)}and(t){return Yte.create(this,t,this._def)}transform(t){return new zC({...Ei(this._def),schema:this,typeName:ni.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const s=typeof t=="function"?t:()=>t;return new jme({...Ei(this._def),innerType:this,defaultValue:s,typeName:ni.ZodDefault})}brand(){return new amt({typeName:ni.ZodBranded,type:this,...Ei(this._def)})}catch(t){const s=typeof t=="function"?t:()=>t;return new kme({...Ei(this._def),innerType:this,catchValue:s,typeName:ni.ZodCatch})}describe(t){const s=this.constructor;return new s({...this._def,description:t})}pipe(t){return pye.create(this,t)}readonly(){return Nme.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Rht=/^c[^\s-]{8,}$/i,Fht=/^[0-9a-z]+$/,zht=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Bht=/^[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,$ht=/^[a-z0-9_-]{21}$/i,Uht=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,qht=/^[-+]?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)?)??$/,Vht=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Hht="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Gce;const Wht=/^(?:(?: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])$/,Ght=/^(?:(?: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])$/,Kht=/^(([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]))$/,Zht=/^(([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])$/,Yht=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Xht=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Q8e="((\\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])))",Qht=new RegExp(`^${Q8e}$`);function J8e(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const s=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${s}`}function Jht(e){return new RegExp(`^${J8e(e)}$`)}function emt(e){let t=`${Q8e}T${J8e(e)}`;const s=[];return s.push(e.local?"Z?":"Z"),e.offset&&s.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${s.join("|")})`,new RegExp(`^${t}$`)}function tmt(e,t){return!!((t==="v4"||!t)&&Wht.test(e)||(t==="v6"||!t)&&Kht.test(e))}function rmt(e,t){if(!Uht.test(e))return!1;try{const[s]=e.split(".");if(!s)return!1;const n=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),a=JSON.parse(atob(n));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 smt(e,t){return!!((t==="v4"||!t)&&Ght.test(e)||(t==="v6"||!t)&&Zht.test(e))}class M1 extends fo{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Fn.string){const o=this._getOrReturnCtx(t);return bn(o,{code:Rs.invalid_type,expected:Fn.string,received:o.parsedType}),si}const n=new Mm;let a;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(a=this._getOrReturnCtx(t,a),bn(a,{code:Rs.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){const l=t.data.length>o.value,i=t.data.lengtht.test(a),{validation:s,code:Rs.invalid_string,...Yn.errToObj(n)})}_addCheck(t){return new M1({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Yn.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Yn.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Yn.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Yn.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Yn.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Yn.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Yn.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Yn.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Yn.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Yn.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Yn.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Yn.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Yn.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,...Yn.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,...Yn.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Yn.errToObj(t)})}regex(t,s){return this._addCheck({kind:"regex",regex:t,...Yn.errToObj(s)})}includes(t,s){return this._addCheck({kind:"includes",value:t,position:s==null?void 0:s.position,...Yn.errToObj(s==null?void 0:s.message)})}startsWith(t,s){return this._addCheck({kind:"startsWith",value:t,...Yn.errToObj(s)})}endsWith(t,s){return this._addCheck({kind:"endsWith",value:t,...Yn.errToObj(s)})}min(t,s){return this._addCheck({kind:"min",value:t,...Yn.errToObj(s)})}max(t,s){return this._addCheck({kind:"max",value:t,...Yn.errToObj(s)})}length(t,s){return this._addCheck({kind:"length",value:t,...Yn.errToObj(s)})}nonempty(t){return this.min(1,Yn.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 s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxLength(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.valuenew M1({checks:[],typeName:ni.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Ei(e)});function nmt(e,t){const s=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,a=s>n?s:n,o=Number.parseInt(e.toFixed(a).replace(".","")),l=Number.parseInt(t.toFixed(a).replace(".",""));return o%l/10**a}class RC extends fo{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)!==Fn.number){const o=this._getOrReturnCtx(t);return bn(o,{code:Rs.invalid_type,expected:Fn.number,received:o.parsedType}),si}let n;const a=new Mm;for(const o of this._def.checks)o.kind==="int"?yo.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),bn(n,{code:Rs.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),bn(n,{code:Rs.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?nmt(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),bn(n,{code:Rs.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),bn(n,{code:Rs.not_finite,message:o.message}),a.dirty()):yo.assertNever(o);return{status:a.value,value:t.data}}gte(t,s){return this.setLimit("min",t,!0,Yn.toString(s))}gt(t,s){return this.setLimit("min",t,!1,Yn.toString(s))}lte(t,s){return this.setLimit("max",t,!0,Yn.toString(s))}lt(t,s){return this.setLimit("max",t,!1,Yn.toString(s))}setLimit(t,s,n,a){return new RC({...this._def,checks:[...this._def.checks,{kind:t,value:s,inclusive:n,message:Yn.toString(a)}]})}_addCheck(t){return new RC({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Yn.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Yn.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Yn.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Yn.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Yn.toString(t)})}multipleOf(t,s){return this._addCheck({kind:"multipleOf",value:t,message:Yn.toString(s)})}finite(t){return this._addCheck({kind:"finite",message:Yn.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Yn.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Yn.toString(t)})}get minValue(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxValue(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.valuet.kind==="int"||t.kind==="multipleOf"&&yo.isInteger(t.value))}get isFinite(){let t=null,s=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(s===null||n.value>s)&&(s=n.value):n.kind==="max"&&(t===null||n.valuenew RC({checks:[],typeName:ni.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Ei(e)});class BE extends fo{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)!==Fn.bigint)return this._getInvalidInput(t);let n;const a=new Mm;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),bn(n,{code:Rs.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),bn(n,{code:Rs.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):yo.assertNever(o);return{status:a.value,value:t.data}}_getInvalidInput(t){const s=this._getOrReturnCtx(t);return bn(s,{code:Rs.invalid_type,expected:Fn.bigint,received:s.parsedType}),si}gte(t,s){return this.setLimit("min",t,!0,Yn.toString(s))}gt(t,s){return this.setLimit("min",t,!1,Yn.toString(s))}lte(t,s){return this.setLimit("max",t,!0,Yn.toString(s))}lt(t,s){return this.setLimit("max",t,!1,Yn.toString(s))}setLimit(t,s,n,a){return new BE({...this._def,checks:[...this._def.checks,{kind:t,value:s,inclusive:n,message:Yn.toString(a)}]})}_addCheck(t){return new BE({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Yn.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Yn.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Yn.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Yn.toString(t)})}multipleOf(t,s){return this._addCheck({kind:"multipleOf",value:t,message:Yn.toString(s)})}get minValue(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxValue(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.valuenew BE({checks:[],typeName:ni.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Ei(e)});class _me extends fo{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Fn.boolean){const n=this._getOrReturnCtx(t);return bn(n,{code:Rs.invalid_type,expected:Fn.boolean,received:n.parsedType}),si}return jp(t.data)}}_me.create=e=>new _me({typeName:ni.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Ei(e)});class Kte extends fo{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Fn.date){const o=this._getOrReturnCtx(t);return bn(o,{code:Rs.invalid_type,expected:Fn.date,received:o.parsedType}),si}if(Number.isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return bn(o,{code:Rs.invalid_date}),si}const n=new Mm;let a;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(a=this._getOrReturnCtx(t,a),bn(a,{code:Rs.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):yo.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Kte({...this._def,checks:[...this._def.checks,t]})}min(t,s){return this._addCheck({kind:"min",value:t.getTime(),message:Yn.toString(s)})}max(t,s){return this._addCheck({kind:"max",value:t.getTime(),message:Yn.toString(s)})}get minDate(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.valuenew Kte({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:ni.ZodDate,...Ei(e)});class pNe extends fo{_parse(t){if(this._getType(t)!==Fn.symbol){const n=this._getOrReturnCtx(t);return bn(n,{code:Rs.invalid_type,expected:Fn.symbol,received:n.parsedType}),si}return jp(t.data)}}pNe.create=e=>new pNe({typeName:ni.ZodSymbol,...Ei(e)});class fNe extends fo{_parse(t){if(this._getType(t)!==Fn.undefined){const n=this._getOrReturnCtx(t);return bn(n,{code:Rs.invalid_type,expected:Fn.undefined,received:n.parsedType}),si}return jp(t.data)}}fNe.create=e=>new fNe({typeName:ni.ZodUndefined,...Ei(e)});class gNe extends fo{_parse(t){if(this._getType(t)!==Fn.null){const n=this._getOrReturnCtx(t);return bn(n,{code:Rs.invalid_type,expected:Fn.null,received:n.parsedType}),si}return jp(t.data)}}gNe.create=e=>new gNe({typeName:ni.ZodNull,...Ei(e)});class xNe extends fo{constructor(){super(...arguments),this._any=!0}_parse(t){return jp(t.data)}}xNe.create=e=>new xNe({typeName:ni.ZodAny,...Ei(e)});class yNe extends fo{constructor(){super(...arguments),this._unknown=!0}_parse(t){return jp(t.data)}}yNe.create=e=>new yNe({typeName:ni.ZodUnknown,...Ei(e)});class yv extends fo{_parse(t){const s=this._getOrReturnCtx(t);return bn(s,{code:Rs.invalid_type,expected:Fn.never,received:s.parsedType}),si}}yv.create=e=>new yv({typeName:ni.ZodNever,...Ei(e)});class vNe extends fo{_parse(t){if(this._getType(t)!==Fn.undefined){const n=this._getOrReturnCtx(t);return bn(n,{code:Rs.invalid_type,expected:Fn.void,received:n.parsedType}),si}return jp(t.data)}}vNe.create=e=>new vNe({typeName:ni.ZodVoid,...Ei(e)});class Zg extends fo{_parse(t){const{ctx:s,status:n}=this._processInputParams(t),a=this._def;if(s.parsedType!==Fn.array)return bn(s,{code:Rs.invalid_type,expected:Fn.array,received:s.parsedType}),si;if(a.exactLength!==null){const l=s.data.length>a.exactLength.value,i=s.data.lengtha.maxLength.value&&(bn(s,{code:Rs.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),s.common.async)return Promise.all([...s.data].map((l,i)=>a.type._parseAsync(new xv(s,l,s.path,i)))).then(l=>Mm.mergeArray(n,l));const o=[...s.data].map((l,i)=>a.type._parseSync(new xv(s,l,s.path,i)));return Mm.mergeArray(n,o)}get element(){return this._def.type}min(t,s){return new Zg({...this._def,minLength:{value:t,message:Yn.toString(s)}})}max(t,s){return new Zg({...this._def,maxLength:{value:t,message:Yn.toString(s)}})}length(t,s){return new Zg({...this._def,exactLength:{value:t,message:Yn.toString(s)}})}nonempty(t){return this.min(1,t)}}Zg.create=(e,t)=>new Zg({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ni.ZodArray,...Ei(t)});function V4(e){if(e instanceof Uc){const t={};for(const s in e.shape){const n=e.shape[s];t[s]=sv.create(V4(n))}return new Uc({...e._def,shape:()=>t})}else return e instanceof Zg?new Zg({...e._def,type:V4(e.element)}):e instanceof sv?sv.create(V4(e.unwrap())):e instanceof BC?BC.create(V4(e.unwrap())):e instanceof pk?pk.create(e.items.map(t=>V4(t))):e}class Uc extends fo{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(),s=yo.objectKeys(t);return this._cached={shape:t,keys:s},this._cached}_parse(t){if(this._getType(t)!==Fn.object){const m=this._getOrReturnCtx(t);return bn(m,{code:Rs.invalid_type,expected:Fn.object,received:m.parsedType}),si}const{status:n,ctx:a}=this._processInputParams(t),{shape:o,keys:l}=this._getCached(),i=[];if(!(this._def.catchall instanceof yv&&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 xv(a,y,a.path,m)),alwaysSet:m in a.data})}if(this._def.catchall instanceof yv){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&&(bn(a,{code:Rs.unrecognized_keys,keys:i}),n.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 xv(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=>Mm.mergeObjectSync(n,m)):Mm.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(t){return Yn.errToObj,new Uc({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(s,n)=>{var o,l;const a=((l=(o=this._def).errorMap)==null?void 0:l.call(o,s,n).message)??n.defaultError;return s.code==="unrecognized_keys"?{message:Yn.errToObj(t).message??a}:{message:a}}}:{}})}strip(){return new Uc({...this._def,unknownKeys:"strip"})}passthrough(){return new Uc({...this._def,unknownKeys:"passthrough"})}extend(t){return new Uc({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Uc({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ni.ZodObject})}setKey(t,s){return this.augment({[t]:s})}catchall(t){return new Uc({...this._def,catchall:t})}pick(t){const s={};for(const n of yo.objectKeys(t))t[n]&&this.shape[n]&&(s[n]=this.shape[n]);return new Uc({...this._def,shape:()=>s})}omit(t){const s={};for(const n of yo.objectKeys(this.shape))t[n]||(s[n]=this.shape[n]);return new Uc({...this._def,shape:()=>s})}deepPartial(){return V4(this)}partial(t){const s={};for(const n of yo.objectKeys(this.shape)){const a=this.shape[n];t&&!t[n]?s[n]=a:s[n]=a.optional()}return new Uc({...this._def,shape:()=>s})}required(t){const s={};for(const n of yo.objectKeys(this.shape))if(t&&!t[n])s[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof sv;)o=o._def.innerType;s[n]=o}return new Uc({...this._def,shape:()=>s})}keyof(){return eDe(yo.objectKeys(this.shape))}}Uc.create=(e,t)=>new Uc({shape:()=>e,unknownKeys:"strip",catchall:yv.create(),typeName:ni.ZodObject,...Ei(t)});Uc.strictCreate=(e,t)=>new Uc({shape:()=>e,unknownKeys:"strict",catchall:yv.create(),typeName:ni.ZodObject,...Ei(t)});Uc.lazycreate=(e,t)=>new Uc({shape:e,unknownKeys:"strip",catchall:yv.create(),typeName:ni.ZodObject,...Ei(t)});class Zte extends fo{_parse(t){const{ctx:s}=this._processInputParams(t),n=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 s.common.issues.push(...i.ctx.common.issues),i.result;const l=o.map(i=>new Jg(i.ctx.common.issues));return bn(s,{code:Rs.invalid_union,unionErrors:l}),si}if(s.common.async)return Promise.all(n.map(async o=>{const l={...s,common:{...s.common,issues:[]},parent:null};return{result:await o._parseAsync({data:s.data,path:s.path,parent:l}),ctx:l}})).then(a);{let o;const l=[];for(const u of n){const m={...s,common:{...s.common,issues:[]},parent:null},x=u._parseSync({data:s.data,path:s.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 s.common.issues.push(...o.ctx.common.issues),o.result;const i=l.map(u=>new Jg(u));return bn(s,{code:Rs.invalid_union,unionErrors:i}),si}}get options(){return this._def.options}}Zte.create=(e,t)=>new Zte({options:e,typeName:ni.ZodUnion,...Ei(t)});function bme(e,t){const s=Q0(e),n=Q0(t);if(e===t)return{valid:!0,data:e};if(s===Fn.object&&n===Fn.object){const a=yo.objectKeys(t),o=yo.objectKeys(e).filter(i=>a.indexOf(i)!==-1),l={...e,...t};for(const i of o){const u=bme(e[i],t[i]);if(!u.valid)return{valid:!1};l[i]=u.data}return{valid:!0,data:l}}else if(s===Fn.array&&n===Fn.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let o=0;o{if(uNe(o)||uNe(l))return si;const i=bme(o.value,l.value);return i.valid?((hNe(o)||hNe(l))&&s.dirty(),{status:s.value,value:i.data}):(bn(n,{code:Rs.invalid_intersection_types}),si)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,l])=>a(o,l)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Yte.create=(e,t,s)=>new Yte({left:e,right:t,typeName:ni.ZodIntersection,...Ei(s)});class pk extends fo{_parse(t){const{status:s,ctx:n}=this._processInputParams(t);if(n.parsedType!==Fn.array)return bn(n,{code:Rs.invalid_type,expected:Fn.array,received:n.parsedType}),si;if(n.data.lengththis._def.items.length&&(bn(n,{code:Rs.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());const o=[...n.data].map((l,i)=>{const u=this._def.items[i]||this._def.rest;return u?u._parse(new xv(n,l,n.path,i)):null}).filter(l=>!!l);return n.common.async?Promise.all(o).then(l=>Mm.mergeArray(s,l)):Mm.mergeArray(s,o)}get items(){return this._def.items}rest(t){return new pk({...this._def,rest:t})}}pk.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new pk({items:e,typeName:ni.ZodTuple,rest:null,...Ei(t)})};class _Ne extends fo{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:s,ctx:n}=this._processInputParams(t);if(n.parsedType!==Fn.map)return bn(n,{code:Rs.invalid_type,expected:Fn.map,received:n.parsedType}),si;const a=this._def.keyType,o=this._def.valueType,l=[...n.data.entries()].map(([i,u],m)=>({key:a._parse(new xv(n,i,n.path,[m,"key"])),value:o._parse(new xv(n,u,n.path,[m,"value"]))}));if(n.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 si;(m.status==="dirty"||x.status==="dirty")&&s.dirty(),i.set(m.value,x.value)}return{status:s.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 si;(m.status==="dirty"||x.status==="dirty")&&s.dirty(),i.set(m.value,x.value)}return{status:s.value,value:i}}}}_Ne.create=(e,t,s)=>new _Ne({valueType:t,keyType:e,typeName:ni.ZodMap,...Ei(s)});class $E extends fo{_parse(t){const{status:s,ctx:n}=this._processInputParams(t);if(n.parsedType!==Fn.set)return bn(n,{code:Rs.invalid_type,expected:Fn.set,received:n.parsedType}),si;const a=this._def;a.minSize!==null&&n.data.sizea.maxSize.value&&(bn(n,{code:Rs.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),s.dirty());const o=this._def.valueType;function l(u){const m=new Set;for(const x of u){if(x.status==="aborted")return si;x.status==="dirty"&&s.dirty(),m.add(x.value)}return{status:s.value,value:m}}const i=[...n.data.values()].map((u,m)=>o._parse(new xv(n,u,n.path,m)));return n.common.async?Promise.all(i).then(u=>l(u)):l(i)}min(t,s){return new $E({...this._def,minSize:{value:t,message:Yn.toString(s)}})}max(t,s){return new $E({...this._def,maxSize:{value:t,message:Yn.toString(s)}})}size(t,s){return this.min(t,s).max(t,s)}nonempty(t){return this.min(1,t)}}$E.create=(e,t)=>new $E({valueType:e,minSize:null,maxSize:null,typeName:ni.ZodSet,...Ei(t)});class bNe extends fo{get schema(){return this._def.getter()}_parse(t){const{ctx:s}=this._processInputParams(t);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}}bNe.create=(e,t)=>new bNe({getter:e,typeName:ni.ZodLazy,...Ei(t)});class wme extends fo{_parse(t){if(t.data!==this._def.value){const s=this._getOrReturnCtx(t);return bn(s,{received:s.data,code:Rs.invalid_literal,expected:this._def.value}),si}return{status:"valid",value:t.data}}get value(){return this._def.value}}wme.create=(e,t)=>new wme({value:e,typeName:ni.ZodLiteral,...Ei(t)});function eDe(e,t){return new FC({values:e,typeName:ni.ZodEnum,...Ei(t)})}class FC extends fo{_parse(t){if(typeof t.data!="string"){const s=this._getOrReturnCtx(t),n=this._def.values;return bn(s,{expected:yo.joinValues(n),received:s.parsedType,code:Rs.invalid_type}),si}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const s=this._getOrReturnCtx(t),n=this._def.values;return bn(s,{received:s.data,code:Rs.invalid_enum_value,options:n}),si}return jp(t.data)}get options(){return this._def.values}get enum(){const t={};for(const s of this._def.values)t[s]=s;return t}get Values(){const t={};for(const s of this._def.values)t[s]=s;return t}get Enum(){const t={};for(const s of this._def.values)t[s]=s;return t}extract(t,s=this._def){return FC.create(t,{...this._def,...s})}exclude(t,s=this._def){return FC.create(this.options.filter(n=>!t.includes(n)),{...this._def,...s})}}FC.create=eDe;class wNe extends fo{_parse(t){const s=yo.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==Fn.string&&n.parsedType!==Fn.number){const a=yo.objectValues(s);return bn(n,{expected:yo.joinValues(a),received:n.parsedType,code:Rs.invalid_type}),si}if(this._cache||(this._cache=new Set(yo.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const a=yo.objectValues(s);return bn(n,{received:n.data,code:Rs.invalid_enum_value,options:a}),si}return jp(t.data)}get enum(){return this._def.values}}wNe.create=(e,t)=>new wNe({values:e,typeName:ni.ZodNativeEnum,...Ei(t)});class Xte extends fo{unwrap(){return this._def.type}_parse(t){const{ctx:s}=this._processInputParams(t);if(s.parsedType!==Fn.promise&&s.common.async===!1)return bn(s,{code:Rs.invalid_type,expected:Fn.promise,received:s.parsedType}),si;const n=s.parsedType===Fn.promise?s.data:Promise.resolve(s.data);return jp(n.then(a=>this._def.type.parseAsync(a,{path:s.path,errorMap:s.common.contextualErrorMap})))}}Xte.create=(e,t)=>new Xte({type:e,typeName:ni.ZodPromise,...Ei(t)});class zC extends fo{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ni.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:s,ctx:n}=this._processInputParams(t),a=this._def.effect||null,o={addIssue:l=>{bn(n,l),l.fatal?s.abort():s.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){const l=a.transform(n.data,o);if(n.common.async)return Promise.resolve(l).then(async i=>{if(s.value==="aborted")return si;const u=await this._def.schema._parseAsync({data:i,path:n.path,parent:n});return u.status==="aborted"?si:u.status==="dirty"||s.value==="dirty"?BT(u.value):u});{if(s.value==="aborted")return si;const i=this._def.schema._parseSync({data:l,path:n.path,parent:n});return i.status==="aborted"?si:i.status==="dirty"||s.value==="dirty"?BT(i.value):i}}if(a.type==="refinement"){const l=i=>{const u=a.refinement(i,o);if(n.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(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?si:(i.status==="dirty"&&s.dirty(),l(i.value),{status:s.value,value:i.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>i.status==="aborted"?si:(i.status==="dirty"&&s.dirty(),l(i.value).then(()=>({status:s.value,value:i.value}))))}if(a.type==="transform")if(n.common.async===!1){const l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!DC(l))return si;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:s.value,value:i}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>DC(l)?Promise.resolve(a.transform(l.value,o)).then(i=>({status:s.value,value:i})):si);yo.assertNever(a)}}zC.create=(e,t,s)=>new zC({schema:e,typeName:ni.ZodEffects,effect:t,...Ei(s)});zC.createWithPreprocess=(e,t,s)=>new zC({schema:t,effect:{type:"preprocess",transform:e},typeName:ni.ZodEffects,...Ei(s)});class sv extends fo{_parse(t){return this._getType(t)===Fn.undefined?jp(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}sv.create=(e,t)=>new sv({innerType:e,typeName:ni.ZodOptional,...Ei(t)});class BC extends fo{_parse(t){return this._getType(t)===Fn.null?jp(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}BC.create=(e,t)=>new BC({innerType:e,typeName:ni.ZodNullable,...Ei(t)});class jme extends fo{_parse(t){const{ctx:s}=this._processInputParams(t);let n=s.data;return s.parsedType===Fn.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:s.path,parent:s})}removeDefault(){return this._def.innerType}}jme.create=(e,t)=>new jme({innerType:e,typeName:ni.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ei(t)});class kme extends fo{_parse(t){const{ctx:s}=this._processInputParams(t),n={...s,common:{...s.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Gte(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Jg(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Jg(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}kme.create=(e,t)=>new kme({innerType:e,typeName:ni.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ei(t)});class jNe extends fo{_parse(t){if(this._getType(t)!==Fn.nan){const n=this._getOrReturnCtx(t);return bn(n,{code:Rs.invalid_type,expected:Fn.nan,received:n.parsedType}),si}return{status:"valid",value:t.data}}}jNe.create=e=>new jNe({typeName:ni.ZodNaN,...Ei(e)});class amt extends fo{_parse(t){const{ctx:s}=this._processInputParams(t),n=s.data;return this._def.type._parse({data:n,path:s.path,parent:s})}unwrap(){return this._def.type}}class pye extends fo{_parse(t){const{status:s,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?si:o.status==="dirty"?(s.dirty(),BT(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?si:a.status==="dirty"?(s.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(t,s){return new pye({in:t,out:s,typeName:ni.ZodPipeline})}}class Nme extends fo{_parse(t){const s=this._def.innerType._parse(t),n=a=>(DC(a)&&(a.value=Object.freeze(a.value)),a);return Gte(s)?s.then(a=>n(a)):n(s)}unwrap(){return this._def.innerType}}Nme.create=(e,t)=>new Nme({innerType:e,typeName:ni.ZodReadonly,...Ei(t)});var ni;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ni||(ni={}));const Oo=M1.create,$A=RC.create,imt=_me.create;yv.create;Zg.create;const Ev=Uc.create;Zte.create;Yte.create;pk.create;const $C=wme.create,tDe=FC.create;Xte.create;sv.create;BC.create;function omt(){const t=Em().pathname.slice(1);return A.useEffect(()=>(document.body.classList.add("guestbook-page"),()=>{document.body.classList.remove("guestbook-page")}),[]),!t||t===""?r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center p-6",children:r.jsxs("div",{className:"text-center text-white",children:[r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Guest Book"}),r.jsx("p",{className:"text-white/60",children:"The modern open house sign-in experience."}),r.jsx("p",{className:"text-white/40 text-sm mt-2",children:"Visit a specific open house link to sign in."})]})}):r.jsx(lmt,{slug:t})}function lmt({slug:e}){return r.jsx(umt,{slug:e})}const cmt=Ev({first_name:Oo().trim().min(1,"First name is required").max(50),last_name:Oo().trim().max(50).optional(),email:Oo().trim().email("Please enter a valid email").max(255).optional().or($C("")),phone:Oo().trim().max(20).optional().or($C(""))}),dmt=[{value:"buying",label:"Looking to Buy",emoji:"🏠"},{value:"selling",label:"Thinking of Selling",emoji:"📋"},{value:"browsing",label:"Just Browsing",emoji:"👀"},{value:"neighbor",label:"I'm a Neighbor",emoji:"👋"}];function umt({slug:e}){var T;const{data:t,isLoading:s,error:n}=O8e(e),a=D8e(),[o,l]=A.useState("welcome"),[i,u]=A.useState({first_name:"",last_name:"",email:"",phone:""}),[m,x]=A.useState(!1),[y,v]=A.useState(""),b=P=>{if(!P)return"";const[R,D]=P.split(":"),U=parseInt(R),q=U>=12?"PM":"AM";return`${U>12?U-12:U||12}:${D} ${q}`},N=()=>{v("");const P=cmt.safeParse(i);if(!P.success){v(P.error.issues[0].message);return}if(!i.email&&!i.phone){v("Please provide either an email or phone number");return}l("intent")},k=async P=>{try{await a.mutateAsync({open_house_id:t.id,first_name:i.first_name.trim(),last_name:i.last_name.trim()||void 0,email:i.email.trim()||void 0,phone:i.phone.trim()||void 0,visitor_intent:P,wants_market_updates:m}),l("done")}catch{v("Something went wrong. Please try again.")}};if(s)return r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center",children:r.jsx("div",{className:"w-10 h-10 border-4 border-white/20 border-t-white rounded-full animate-spin"})});if(n||!t)return r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center p-6",children:r.jsxs("div",{className:"text-center text-white",children:[r.jsx(sa,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Open House Not Found"}),r.jsx("p",{className:"text-white/60",children:"This sign-in page doesn't exist or is no longer active."})]})});const M=t.profiles,E=((T=M==null?void 0:M.name)==null?void 0:T.split(" ").map(P=>P[0]).join("").slice(0,2))||"?";return r.jsxs(r.Fragment,{children:[r.jsxs(Bh,{children:[r.jsxs("title",{children:["Open House | ",t.property_address]}),r.jsx("meta",{name:"robots",content:"noindex, nofollow"})]}),r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center p-4",children:r.jsxs("div",{className:"w-full max-w-md",children:[r.jsxs("div",{className:"text-center mb-6",children:[r.jsxs(Xn,{className:"h-16 w-16 mx-auto mb-3 ring-2 ring-white/20",children:[r.jsx(ji,{src:(M==null?void 0:M.avatar_url)||"",alt:(M==null?void 0:M.name)||""}),r.jsx(Qn,{className:"bg-white/10 text-white text-lg",children:E})]}),r.jsx("p",{className:"text-white/60 text-sm",children:M==null?void 0:M.name}),(M==null?void 0:M.title)&&r.jsx("p",{className:"text-white/40 text-xs",children:M.title})]}),r.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl overflow-hidden",children:[t.photo_url&&r.jsxs("div",{className:"relative w-full h-48 overflow-hidden",children:[r.jsx("img",{src:t.photo_url,alt:t.property_address,className:"w-full h-full object-cover"}),r.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-slate-900/60 to-transparent"})]}),r.jsx("div",{className:`${t.photo_url?"px-6 py-4":"px-6 py-5"} bg-gradient-to-r from-slate-800 to-slate-700`,children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-white/10 flex items-center justify-center shrink-0 mt-0.5",children:r.jsx(sa,{className:"h-5 w-5 text-white"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-white font-bold text-lg leading-tight",children:t.property_address}),r.jsxs("div",{className:"flex flex-wrap gap-3 mt-2 text-white/60 text-xs",children:[t.city&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(po,{className:"h-3 w-3"}),t.city,t.state?`, ${t.state}`:""," ",t.zip]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(jn,{className:"h-3 w-3"}),rs(new Date(t.event_date+"T00:00:00"),"MMM d, yyyy")]}),t.start_time&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ra,{className:"h-3 w-3"}),b(t.start_time),t.end_time?` – ${b(t.end_time)}`:""]})]})]})]})}),r.jsxs("div",{className:"p-6",children:[o==="welcome"&&r.jsxs("div",{className:"text-center space-y-6",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-xl font-bold text-slate-900 mb-2",children:"Welcome!"}),r.jsx("p",{className:"text-slate-500 text-sm",children:t.agent_greeting||"Please sign in below."})]}),r.jsxs(X,{onClick:()=>l("info"),className:"w-full h-14 text-base bg-slate-900 hover:bg-slate-800 text-white rounded-xl",children:["Sign In ",r.jsx(to,{className:"h-5 w-5 ml-2"})]}),r.jsx("p",{className:"text-xs text-slate-400",children:"Quick & easy — takes 30 seconds"})]}),o==="info"&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("button",{onClick:()=>l("welcome"),className:"text-slate-400 hover:text-slate-600",children:r.jsx(wi,{className:"h-4 w-4"})}),r.jsx("h2",{className:"text-lg font-bold text-slate-900",children:"Your Info"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx(ze,{className:"text-slate-600 text-xs",children:"First Name *"}),r.jsx(ot,{value:i.first_name,onChange:P=>u(R=>({...R,first_name:P.target.value})),placeholder:"First",className:"mt-1 h-12 rounded-xl border-slate-200 text-base",autoFocus:!0})]}),r.jsxs("div",{children:[r.jsx(ze,{className:"text-slate-600 text-xs",children:"Last Name"}),r.jsx(ot,{value:i.last_name,onChange:P=>u(R=>({...R,last_name:P.target.value})),placeholder:"Last",className:"mt-1 h-12 rounded-xl border-slate-200 text-base"})]})]}),r.jsxs("div",{children:[r.jsx(ze,{className:"text-slate-600 text-xs",children:"Email"}),r.jsx(ot,{type:"email",value:i.email,onChange:P=>u(R=>({...R,email:P.target.value})),placeholder:"your@email.com",className:"mt-1 h-12 rounded-xl border-slate-200 text-base"})]}),r.jsxs("div",{children:[r.jsx(ze,{className:"text-slate-600 text-xs",children:"Phone"}),r.jsx(ot,{type:"tel",value:i.phone,onChange:P=>u(R=>({...R,phone:P.target.value})),placeholder:"(555) 123-4567",className:"mt-1 h-12 rounded-xl border-slate-200 text-base"})]}),r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer pt-1",children:[r.jsx("input",{type:"checkbox",checked:m,onChange:P=>x(P.target.checked),className:"rounded border-slate-300"}),r.jsx("span",{className:"text-sm text-slate-600",children:"Send me market updates for this area"})]}),y&&r.jsx("p",{className:"text-red-500 text-sm",children:y}),r.jsxs(X,{onClick:N,className:"w-full h-14 text-base bg-slate-900 hover:bg-slate-800 text-white rounded-xl",children:["Continue ",r.jsx(to,{className:"h-5 w-5 ml-2"})]})]}),o==="intent"&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("button",{onClick:()=>l("info"),className:"text-slate-400 hover:text-slate-600",children:r.jsx(wi,{className:"h-4 w-4"})}),r.jsx("h2",{className:"text-lg font-bold text-slate-900",children:"What brings you here?"})]}),r.jsx("div",{className:"grid grid-cols-2 gap-3",children:dmt.map(P=>r.jsxs("button",{onClick:()=>k(P.value),disabled:a.isPending,className:"flex flex-col items-center gap-2 p-5 rounded-xl border-2 border-slate-200 hover:border-slate-900 hover:bg-slate-50 transition-all text-center group",children:[r.jsx("span",{className:"text-2xl",children:P.emoji}),r.jsx("span",{className:"text-sm font-medium text-slate-700 group-hover:text-slate-900",children:P.label})]},P.value))}),y&&r.jsx("p",{className:"text-red-500 text-sm text-center",children:y})]}),o==="done"&&r.jsx(hmt,{firstName:i.first_name,agentName:M==null?void 0:M.name,agentCardSlug:t.agent_card_slug})]})]}),r.jsx("p",{className:"text-center text-white/30 text-xs mt-6",children:"Powered by LevelUp Guest Book"})]})})]})}function hmt({firstName:e,agentName:t,agentCardSlug:s}){const[n,a]=A.useState(3);return A.useEffect(()=>{if(!s)return;const o=setInterval(()=>{a(l=>l<=1?(clearInterval(o),window.location.href=`https://cards.relevelup.com/${s}`,0):l-1)},1e3);return()=>clearInterval(o)},[s]),r.jsxs("div",{className:"text-center space-y-4 py-4",children:[r.jsx("div",{className:"w-16 h-16 rounded-full bg-green-100 flex items-center justify-center mx-auto",children:r.jsx(Ki,{className:"h-8 w-8 text-green-600"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-xl font-bold text-slate-900",children:"You're all set!"}),r.jsxs("p",{className:"text-slate-500 text-sm mt-1",children:["Thanks for signing in, ",e,". Enjoy the open house!"]})]}),t&&r.jsxs("p",{className:"text-sm text-slate-400",children:["Your host today: ",r.jsx("strong",{className:"text-slate-600",children:t})]}),s&&r.jsxs("p",{className:"text-xs text-slate-400 animate-pulse",children:["Redirecting to ",t?`${t}'s`:"your agent's"," card in ",n,"s…"]})]})}const Sme="levelup_affiliate_ref",mmt=30,pmt=()=>{const[e]=Ic();A.useEffect(()=>{const t=e.get("ref");if(t){const s={code:t.toUpperCase(),timestamp:Date.now()};localStorage.setItem(Sme,JSON.stringify(s)),console.log("[Affiliate] Stored referral code:",t)}},[e])},fmt=()=>{try{const e=localStorage.getItem(Sme);if(!e)return null;const t=JSON.parse(e),s=mmt*24*60*60*1e3;return Date.now()-t.timestamp>s?(localStorage.removeItem(Sme),console.log("[Affiliate] Referral code expired"),null):t.code}catch{return null}},Qte="/assets/levelup-logo-header-_ZX7DvlA.png",gmt="/assets/scale-your-team-ku4MPatU.png";function xmt({open:e,onOpenChange:t}){return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Pr,{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(pi,{className:"h-5 w-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Rr,{children:"Schedule a Brokerage Interest Meeting"}),r.jsx(Zs,{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 Td={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"]}},ymt=[{icon:ap,title:"Academy Training",description:"Access a library of on-demand video training covering lead generation, marketing, technology, and more."},{icon:Wc,title:"300+ Templates",description:"Professional Canva templates for social media, flyers, postcards, and marketing materials."},{icon:jn,title:"Live Events",description:"Weekly live training sessions, workshops, and Q&A events with industry experts."},{icon:ql,title:"Agent Community",description:"Connect with fellow agents, share wins, ask questions, and network in our private community."},{icon:ga,title:"Resource Kits",description:"Downloadable toolkits with scripts, checklists, guides, and everything you need to close more deals."},{icon:oo,title:"Social Swag",description:"Fresh social media content and designs updated regularly to help you stand out online."}],vmt=[{icon:qs,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:Bn,title:"Smart Touchpoint Plans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:Pi,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:po,title:"Pop-by Map",description:"See all your contacts on a map and plan efficient pop-by routes in your area."},{icon:wc,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:Hg,title:"Daily Action Cards",description:"Wake up to a prioritized list of exactly who to reach out to today."}],_mt=[{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."}],bmt=()=>{const{user:e,loading:t}=Yr(),s=Hs(),[n]=Ic();A.useEffect(()=>{const q=window.location.host==="listings.relevelup.com",H=window.location.pathname==="/";if(q&&H){s("/public/listings",{replace:!0});return}},[s]);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,E]=A.useState(!1),[T,P]=A.useState(!1),R=(q,H=!1)=>{i({tier:q,skipTrial:H}),m(!0)};pmt(),A.useEffect(()=>{const q=window.location.host==="listings.relevelup.com",H=location.pathname.startsWith("/public/");!t&&e&&!q&&!H&&s("/dashboard")},[e,t,s,location.pathname]),A.useEffect(()=>{n.get("canceled")==="true"&&Te.error("Checkout was canceled. Feel free to try again when you're ready!")},[n]);const D=async(q,H=!1)=>{if(!x){Te.error("Please enter your email address");return}if(!v.trim()){Te.error("Please enter your full name");return}E(!0),o(q+(H?"_direct":""));const G=fmt();try{const{data:Q,error:ne}=await Y.functions.invoke("create-checkout",{body:{tier:q,email:x,name:v.trim(),couponCode:N.trim()||void 0,skipTrial:H,referralCode:G}});if(ne)throw ne;if(Q!=null&&Q.url)window.open(Q.url,"_blank","noopener,noreferrer"),Te.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(Q){console.error("Checkout error:",Q),Te.error(Q.message||"Failed to start checkout. Please try again.")}finally{E(!1),o(null),m(!1),i(null)}},U=()=>{l&&D(l.tier,l.skipTrial)};return t?r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-[#4a6b6d]",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-white border-t-transparent"})}):r.jsxs("div",{className:"min-h-screen bg-background overflow-hidden",children:[r.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-[#4a6b6d] shadow-md",children:r.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("img",{src:Qte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[r.jsx(X,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var q;return(q=document.getElementById("features"))==null?void 0:q.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 q;return(q=document.getElementById("pricing"))==null?void 0:q.scrollIntoView({behavior:"smooth"})},children:"Pricing"}),r.jsx(X,{onClick:()=>s("/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 q;return(q=document.getElementById("free-trial"))==null?void 0:q.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(to,{className:"ml-2 w-5 h-5 group-hover:translate-x-1 transition-transform"})]}),r.jsx(X,{size:"lg",variant:"outline",onClick:()=>{var q;return(q=document.getElementById("features"))==null?void 0:q.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 q;return(q=document.getElementById("brokerage"))==null?void 0:q.scrollIntoView({behavior:"smooth"})},className:"border-[#4a6b6d] text-[#4a6b6d] hover:bg-[#4a6b6d]/5",children:[r.jsx(pi,{className:"mr-2 h-5 w-5"}),"Brokerage Partnership"]}),r.jsxs(X,{size:"lg",onClick:()=>{var q;return(q=document.getElementById("pricing"))==null?void 0:q.scrollIntoView({behavior:"smooth"})},className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:[r.jsx(oc,{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:ymt.map((q,H)=>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(Vt,{children:[r.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#4a6b6d]/10 flex items-center justify-center mb-4",children:r.jsx(q.icon,{className:"w-7 h-7 text-[#4a6b6d]"})}),r.jsx(Gt,{className:"text-xl font-sans",children:q.title})]}),r.jsx(Xe,{children:r.jsx("p",{className:"text-muted-foreground leading-relaxed",children:q.description})})]},H))})]})}),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(Bn,{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:vmt.map((q,H)=>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(Vt,{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(q.icon,{className:"w-6 h-6 text-white"})}),r.jsx(Gt,{className:"text-lg font-semibold text-white",children:q.title})]}),r.jsx(Xe,{children:r.jsx("p",{className:"text-white/70 text-sm leading-relaxed",children:q.description})})]},H))}),r.jsx("div",{className:"text-center mt-12",children:r.jsxs(X,{size:"lg",onClick:()=>{var q;return(q=document.getElementById("pricing"))==null?void 0:q.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(to,{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(pi,{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((q,H)=>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:q})]},H))}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-4",children:[r.jsxs(X,{size:"lg",onClick:()=>{var q;return(q=document.getElementById("pricing"))==null?void 0:q.scrollIntoView({behavior:"smooth"})},className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:["See Brokerage Plans",r.jsx(Zi,{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(jn,{className:"mr-2 w-5 h-5"}),"Schedule Info Session"]})]})]}),r.jsx("div",{className:"relative hidden md:block",children:r.jsx("img",{src:gmt,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:_mt.map((q,H)=>r.jsx(He,{className:"bg-muted/30 border-0",children:r.jsxs(Xe,{className:"pt-8",children:[r.jsx("div",{className:"flex gap-1 mb-4",children:[1,2,3,4,5].map(G=>r.jsx(Mn,{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:['"',q.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:q.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:q.role})]})]})},H))})]})}),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:()=>R("individual_agent"),children:["Start Free Trial",r.jsx(to,{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(Vt,{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(oc,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsx(Gt,{className:"text-xl font-sans",children:Td.individual_agent.name})]}),r.jsxs("div",{className:"flex items-baseline gap-1 mt-4",children:[r.jsx("span",{className:"text-5xl font-bold",children:Td.individual_agent.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:Td.individual_agent.period})]}),r.jsx(Ns,{className:"text-base mt-2",children:Td.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(Ra,{className:"w-4 h-4"}),Td.individual_agent.trial]})]}),r.jsx(Xe,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:Td.individual_agent.features.map((q,H)=>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:q})]},H))})}),r.jsxs(BA,{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:()=>R("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:()=>R("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(Vt,{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(pi,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Gt,{className:"text-xl font-sans",children:Td.brokerage_under_25.name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:Td.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:Td.brokerage_under_25.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:Td.brokerage_under_25.period})]}),r.jsx(Ns,{className:"text-base mt-2",children:Td.brokerage_under_25.description})]}),r.jsx(Xe,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:Td.brokerage_under_25.features.map((q,H)=>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:q})]},H))})}),r.jsx(BA,{className:"pt-4",children:r.jsx(X,{className:"w-full py-6 text-lg shadow-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>R("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(Vt,{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(pi,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Gt,{className:"text-xl font-sans",children:Td.brokerage_over_25.name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:Td.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:Td.brokerage_over_25.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:Td.brokerage_over_25.period})]}),r.jsx(Ns,{className:"text-base mt-2",children:Td.brokerage_over_25.description})]}),r.jsx(Xe,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:Td.brokerage_over_25.features.map((q,H)=>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:q})]},H))})}),r.jsx(BA,{className:"pt-4",children:r.jsx(X,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>R("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 q;return(q=document.getElementById("pricing"))==null?void 0:q.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(to,{className:"ml-2 w-5 h-5"})]}),r.jsx(X,{size:"lg",onClick:()=>s("/auth"),className:"px-10 py-7 text-lg font-semibold border-2 border-white text-white bg-transparent hover:bg-white hover:text-[#4a6b6d]",children:"Sign In"})]})]})})]}),r.jsx("footer",{className:"py-12 bg-[#3d5a5c] text-white/80",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4",children:[r.jsx("img",{src:Qte,alt:"LevelUp",className:"h-8"}),r.jsxs("p",{className:"text-sm",children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsxs("div",{className:"flex items-center gap-6",children:[r.jsx("a",{href:"/privacy-policy",className:"text-white/60 hover:text-white transition-colors text-sm",children:"Privacy Policy"}),r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-white/60 hover:text-white transition-colors text-sm",children:"Contact Support"})]})]})})}),r.jsx(xmt,{open:T,onOpenChange:P}),r.jsx(Or,{open:u,onOpenChange:m,children:r.jsxs(Pr,{className:"sm:max-w-md",children:[r.jsxs(zr,{children:[r.jsx(Rr,{className:"text-xl font-sans font-semibold",children:"Enter your details to get started"}),r.jsx(Zs,{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(ot,{id:"dialog-name",type:"text",placeholder:"John Smith",value:v,onChange:q=>b(q.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(ot,{id:"dialog-email",type:"email",placeholder:"you@example.com",value:x,onChange:q=>y(q.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(ot,{id:"dialog-coupon",type:"text",placeholder:"Enter discount code",value:N,onChange:q=>k(q.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"})]})})]})},wmt=()=>r.jsxs(r.Fragment,{children:[r.jsxs(Bh,{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"})]})]})]})]})})]}),jmt=()=>r.jsxs(r.Fragment,{children:[r.jsxs(Bh,{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"})]})]})]})]})})]}),kmt=()=>r.jsxs(r.Fragment,{children:[r.jsxs(Bh,{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"})]})]})]})]})})]}),Nmt=Ev({email:Oo().email("Invalid email address"),password:Oo().min(6,"Password must be at least 6 characters")}),Smt=()=>{const{signIn:e,user:t}=Yr(),s=Hs(),[n,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&&s("/dashboard")},[t,s]);const b=async k=>{k.preventDefault(),l({}),a(!0);const M=new FormData(k.currentTarget),E=M.get("email"),T=M.get("password");try{Nmt.parse({email:E,password:T}),await e(E,T)}catch(P){if(P instanceof Jg){const R={};P.errors.forEach(D=>{D.path[0]&&(R[D.path[0]]=D.message)}),l(R)}}finally{a(!1)}},N=async()=>{if(!i){Te.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;Te.success("Password reset email sent! Check your inbox."),v(!1),u("")}catch(k){Te.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(ho,{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:zOe,alt:"LevelUp",className:"h-12 w-auto"})})}),r.jsxs(He,{className:"border-0 shadow-2xl bg-white/95 backdrop-blur-sm",children:[r.jsxs(Vt,{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(Ns,{className:"text-gray-600",children:"Sign in to access your dashboard"})]}),r.jsx(Xe,{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(ot,{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(ot,{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:n,children:n?"Signing in...":"Sign In"}),r.jsxs(Or,{open:y,onOpenChange:v,children:[r.jsx(vo,{asChild:!0,children:r.jsx(X,{variant:"link",className:"w-full text-sm text-[#4a6b6d] hover:text-[#3d5a5c]",children:"Forgot password?"})}),r.jsxs(Pr,{className:"bg-white",children:[r.jsxs(zr,{children:[r.jsx(Rr,{className:"text-[#2a4347]",style:{fontFamily:"'Libre Baskerville', serif"},children:"Reset Password"}),r.jsx(Zs,{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(ot,{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(ho,{to:"/",className:"text-white hover:underline font-medium",children:"View Plans"})]})]})})]})]})},Cmt=()=>{const[e]=Ic(),t=e.get("tier"),s=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(Vt,{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(ii,{className:"w-10 h-10 text-green-500"})}),r.jsx(Gt,{className:"text-2xl",children:"Welcome to LevelUp!"}),r.jsx(Ns,{className:"text-lg",children:"Your subscription has been activated successfully."})]}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"p-4 rounded-lg bg-primary/10 border border-primary/20 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[r.jsx(Nn,{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."})]}),s?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,s]=A.useState(null),[n,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}`);s(`${u.publicUrl}?t=${Date.now()}`)}else s(null)}catch(i){console.error("Error fetching avatar:",i),s(null)}finally{a(!1)}})()},[e]),{avatarUrl:t,loading:n,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}`);s(`${i.publicUrl}?t=${Date.now()}`)}}catch(l){console.error("Error refreshing avatar:",l)}}}},sDe=async e=>{const t=new Map;return await Promise.all(e.map(async s=>{try{const{data:n}=await Y.storage.from("avatars").list(`${s}`);if(n&&n.length>0){const{data:a}=Y.storage.from("avatars").getPublicUrl(`${s}/${n[0].name}`);t.set(s,a.publicUrl)}}catch{}})),t},Mmt=e=>{const[t,s]=A.useState({isTrial:!1,isExpired:!1,expiresAt:null,daysLeft:null,loading:!0});return A.useEffect(()=>{if(!e){s(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),s(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;s({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;s({isTrial:!0,isExpired:y,expiresAt:a.trial_expires_at,daysLeft:y?0:x,loading:!1})}else s({isTrial:!1,isExpired:!1,expiresAt:null,daysLeft:null,loading:!1})}catch(a){console.error("Error in useTrialStatus:",a),s(o=>({...o,loading:!1}))}})()},[e]),t},nDe=()=>{const{data:e,isLoading:t}=Kt({queryKey:["feature-flags"],queryFn:async()=>{const{data:n,error:a}=await Y.from("feature_flags").select("*");if(a)throw a;return n}}),s=n=>{if(!e)return!1;const a=e.find(o=>o.key===n);return(a==null?void 0:a.enabled)??!1};return{flags:e,isLoading:t,isFeatureEnabled:s,isAgentOSEnabled:s("agent_os_enabled"),isInnerCircleEnabled:s("innercircle_enabled"),isMarketplaceEnabled:s("marketplace")}},kNe="community_last_seen_post_at";function Tmt(){const{user:e}=Yr(),t=Em(),[s,n]=A.useState(0),[a,o]=A.useState(null);A.useEffect(()=>{if(!e)return;const i=localStorage.getItem(`${kNe}_${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&&n(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||n(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||Te("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(`${kNe}_${e.id}`,i),o(i),n(0)},[e]);return A.useEffect(()=>{t.pathname==="/community"&&s>0&&l()},[t.pathname,s,l]),{unreadCount:s,markAsRead:l}}function Amt(){const{isAdmin:e}=Yr(),{data:t=0}=Kt({queryKey:["wishlist-open-count"],queryFn:async()=>{const{count:s,error:n}=await Y.from("wishlist_items").select("*",{count:"exact",head:!0}).eq("status","open");if(n)throw n;return s||0},enabled:e,staleTime:6e4});return{openCount:e?t:0}}const Zne=Dne,fye=eye,Emt=Rne,aDe=A.forwardRef(({className:e,...t},s)=>r.jsx(O3,{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:s}));aDe.displayName=O3.displayName;const Imt=j3("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"}}),mP=A.forwardRef(({side:e="right",className:t,children:s,...n},a)=>r.jsxs(Emt,{children:[r.jsx(aDe,{}),r.jsxs(D3,{ref:a,className:Ut(Imt({side:e}),t),...n,children:[s,r.jsxs(Fne,{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(en,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));mP.displayName=D3.displayName;const Yne=({className:e,...t})=>r.jsx("div",{className:Ut("flex flex-col space-y-2 text-center sm:text-left",e),...t});Yne.displayName="SheetHeader";const Xne=A.forwardRef(({className:e,...t},s)=>r.jsx(dP,{ref:s,className:Ut("text-lg font-semibold text-foreground",e),...t}));Xne.displayName=dP.displayName;const Pmt=A.forwardRef(({className:e,...t},s)=>r.jsx(uP,{ref:s,className:Ut("text-sm text-muted-foreground",e),...t}));Pmt.displayName=uP.displayName;function Lmt(e,t){return A.useReducer((s,n)=>t[s][n]??s,e)}var gye="ScrollArea",[iDe]=uc(gye),[Omt,kp]=iDe(gye),oDe=A.forwardRef((e,t)=>{const{__scopeScrollArea:s,type:n="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),[E,T]=A.useState(0),[P,R]=A.useState(0),[D,U]=A.useState(!1),[q,H]=A.useState(!1),G=ha(t,ne=>u(ne)),Q=Ik(a);return r.jsx(Omt,{scope:s,type:n,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:q,onScrollbarYEnabledChange:H,onCornerWidthChange:T,onCornerHeightChange:R,children:r.jsx($s.div,{dir:Q,...l,ref:G,style:{position:"relative","--radix-scroll-area-corner-width":E+"px","--radix-scroll-area-corner-height":P+"px",...e.style}})})});oDe.displayName=gye;var lDe="ScrollAreaViewport",cDe=A.forwardRef((e,t)=>{const{__scopeScrollArea:s,children:n,nonce:a,...o}=e,l=kp(lDe,s),i=A.useRef(null),u=ha(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($s.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:n})})]})});cDe.displayName=lDe;var lx="ScrollAreaScrollbar",xye=A.forwardRef((e,t)=>{const{forceMount:s,...n}=e,a=kp(lx,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(Dmt,{...n,ref:t,forceMount:s}):a.type==="scroll"?r.jsx(Rmt,{...n,ref:t,forceMount:s}):a.type==="auto"?r.jsx(dDe,{...n,ref:t,forceMount:s}):a.type==="always"?r.jsx(yye,{...n,ref:t}):null});xye.displayName=lx;var Dmt=A.forwardRef((e,t)=>{const{forceMount:s,...n}=e,a=kp(lx,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(Ec,{present:s||o,children:r.jsx(dDe,{"data-state":o?"visible":"hidden",...n,ref:t})})}),Rmt=A.forwardRef((e,t)=>{const{forceMount:s,...n}=e,a=kp(lx,e.__scopeScrollArea),o=e.orientation==="horizontal",l=Jne(()=>u("SCROLL_END"),100),[i,u]=Lmt("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(Ec,{present:s||i!=="hidden",children:r.jsx(yye,{"data-state":i==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:xs(e.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:xs(e.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),dDe=A.forwardRef((e,t)=>{const s=kp(lx,e.__scopeScrollArea),{forceMount:n,...a}=e,[o,l]=A.useState(!1),i=e.orientation==="horizontal",u=Jne(()=>{if(s.viewport){const m=s.viewport.offsetWidth{const{orientation:s="vertical",...n}=e,a=kp(lx,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=fDe(i.viewport,i.content),x={...n,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 qmt(v,l.current,i,b)}return s==="horizontal"?r.jsx(Fmt,{...x,ref:t,onThumbPositionChange:()=>{if(a.viewport&&o.current){const v=a.viewport.scrollLeft,b=NNe(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))}}):s==="vertical"?r.jsx(zmt,{...x,ref:t,onThumbPositionChange:()=>{if(a.viewport&&o.current){const v=a.viewport.scrollTop,b=NNe(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}),Fmt=A.forwardRef((e,t)=>{const{sizes:s,onSizesChange:n,...a}=e,o=kp(lx,e.__scopeScrollArea),[l,i]=A.useState(),u=A.useRef(null),m=ha(t,u,o.onScrollbarXChange);return A.useEffect(()=>{u.current&&i(getComputedStyle(u.current))},[u]),r.jsx(hDe,{"data-orientation":"horizontal",...a,ref:m,sizes:s,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":Qne(s)+"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),xDe(v,y)&&x.preventDefault()}},onResize:()=>{u.current&&o.viewport&&l&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:ere(l.paddingLeft),paddingEnd:ere(l.paddingRight)}})}})}),zmt=A.forwardRef((e,t)=>{const{sizes:s,onSizesChange:n,...a}=e,o=kp(lx,e.__scopeScrollArea),[l,i]=A.useState(),u=A.useRef(null),m=ha(t,u,o.onScrollbarYChange);return A.useEffect(()=>{u.current&&i(getComputedStyle(u.current))},[u]),r.jsx(hDe,{"data-orientation":"vertical",...a,ref:m,sizes:s,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":Qne(s)+"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),xDe(v,y)&&x.preventDefault()}},onResize:()=>{u.current&&o.viewport&&l&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:ere(l.paddingTop),paddingEnd:ere(l.paddingBottom)}})}})}),[Bmt,uDe]=iDe(lx),hDe=A.forwardRef((e,t)=>{const{__scopeScrollArea:s,sizes:n,hasThumb:a,onThumbChange:o,onThumbPointerUp:l,onThumbPointerDown:i,onThumbPositionChange:u,onDragScroll:m,onWheelScroll:x,onResize:y,...v}=e,b=kp(lx,s),[N,k]=A.useState(null),M=ha(t,G=>k(G)),E=A.useRef(null),T=A.useRef(""),P=b.viewport,R=n.content-n.viewport,D=ac(x),U=ac(u),q=Jne(y,10);function H(G){if(E.current){const Q=G.clientX-E.current.left,ne=G.clientY-E.current.top;m({x:Q,y:ne})}}return A.useEffect(()=>{const G=Q=>{const ne=Q.target;(N==null?void 0:N.contains(ne))&&D(Q,R)};return document.addEventListener("wheel",G,{passive:!1}),()=>document.removeEventListener("wheel",G,{passive:!1})},[P,N,R,D]),A.useEffect(U,[n,U]),UC(N,q),UC(b.content,q),r.jsx(Bmt,{scope:s,scrollbar:N,hasThumb:a,onThumbChange:ac(o),onThumbPointerUp:ac(l),onThumbPositionChange:U,onThumbPointerDown:ac(i),children:r.jsx($s.div,{...v,ref:M,style:{position:"absolute",...v.style},onPointerDown:xs(e.onPointerDown,G=>{G.button===0&&(G.target.setPointerCapture(G.pointerId),E.current=N.getBoundingClientRect(),T.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",b.viewport&&(b.viewport.style.scrollBehavior="auto"),H(G))}),onPointerMove:xs(e.onPointerMove,H),onPointerUp:xs(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=""),E.current=null})})})}),Jte="ScrollAreaThumb",mDe=A.forwardRef((e,t)=>{const{forceMount:s,...n}=e,a=uDe(Jte,e.__scopeScrollArea);return r.jsx(Ec,{present:s||a.hasThumb,children:r.jsx($mt,{ref:t,...n})})}),$mt=A.forwardRef((e,t)=>{const{__scopeScrollArea:s,style:n,...a}=e,o=kp(Jte,s),l=uDe(Jte,s),{onThumbPositionChange:i}=l,u=ha(t,y=>l.onThumbChange(y)),m=A.useRef(void 0),x=Jne(()=>{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=Vmt(y,i);m.current=b,i()}};return i(),y.addEventListener("scroll",v),()=>y.removeEventListener("scroll",v)}},[o.viewport,x,i]),r.jsx($s.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)",...n},onPointerDownCapture:xs(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:xs(e.onPointerUp,l.onThumbPointerUp)})});mDe.displayName=Jte;var vye="ScrollAreaCorner",pDe=A.forwardRef((e,t)=>{const s=kp(vye,e.__scopeScrollArea),n=!!(s.scrollbarX&&s.scrollbarY);return s.type!=="scroll"&&n?r.jsx(Umt,{...e,ref:t}):null});pDe.displayName=vye;var Umt=A.forwardRef((e,t)=>{const{__scopeScrollArea:s,...n}=e,a=kp(vye,s),[o,l]=A.useState(0),[i,u]=A.useState(0),m=!!(o&&i);return UC(a.scrollbarX,()=>{var y;const x=((y=a.scrollbarX)==null?void 0:y.offsetHeight)||0;a.onCornerHeightChange(x),u(x)}),UC(a.scrollbarY,()=>{var y;const x=((y=a.scrollbarY)==null?void 0:y.offsetWidth)||0;a.onCornerWidthChange(x),l(x)}),m?r.jsx($s.div,{...n,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 ere(e){return e?parseInt(e,10):0}function fDe(e,t){const s=e/t;return isNaN(s)?0:s}function Qne(e){const t=fDe(e.viewport,e.content),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-s)*t;return Math.max(n,18)}function qmt(e,t,s,n="ltr"){const a=Qne(s),o=a/2,l=t||o,i=a-l,u=s.scrollbar.paddingStart+l,m=s.scrollbar.size-s.scrollbar.paddingEnd-i,x=s.content-s.viewport,y=n==="ltr"?[0,x]:[x*-1,0];return gDe([u,m],y)(e)}function NNe(e,t,s="ltr"){const n=Qne(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-a,l=t.content-t.viewport,i=o-n,u=s==="ltr"?[0,l]:[l*-1,0],m=zE(e,u);return gDe([0,l],[0,i])(m)}function gDe(e,t){return s=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(s-e[0])}}function xDe(e,t){return e>0&&e{})=>{let s={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const o={left:e.scrollLeft,top:e.scrollTop},l=s.left!==o.left,i=s.top!==o.top;(l||i)&&t(),s=o,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function Jne(e,t){const s=ac(e),n=A.useRef(0);return A.useEffect(()=>()=>window.clearTimeout(n.current),[]),A.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(s,t)},[s,t])}function UC(e,t){const s=ac(t);cc(()=>{let n=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(s)});return a.observe(e),()=>{window.cancelAnimationFrame(n),a.unobserve(e)}}},[e,s])}var yDe=oDe,Hmt=cDe,Wmt=pDe;const Yo=A.forwardRef(({className:e,children:t,...s},n)=>r.jsxs(yDe,{ref:n,className:Ut("relative overflow-hidden",e),...s,children:[r.jsx(Hmt,{className:"h-full w-full rounded-[inherit]",children:t}),r.jsx(_ye,{}),r.jsx(Wmt,{})]}));Yo.displayName=yDe.displayName;const _ye=A.forwardRef(({className:e,orientation:t="vertical",...s},n)=>r.jsx(xye,{ref:n,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),...s,children:r.jsx(mDe,{className:"relative flex-1 rounded-full bg-border"})}));_ye.displayName=xye.displayName;var eae="Collapsible",[Gmt]=uc(eae),[Kmt,bye]=Gmt(eae),vDe=A.forwardRef((e,t)=>{const{__scopeCollapsible:s,open:n,defaultOpen:a,disabled:o,onOpenChange:l,...i}=e,[u,m]=ah({prop:n,defaultProp:a??!1,onChange:l,caller:eae});return r.jsx(Kmt,{scope:s,disabled:o,contentId:yd(),open:u,onOpenToggle:A.useCallback(()=>m(x=>!x),[m]),children:r.jsx($s.div,{"data-state":jye(u),"data-disabled":o?"":void 0,...i,ref:t})})});vDe.displayName=eae;var _De="CollapsibleTrigger",bDe=A.forwardRef((e,t)=>{const{__scopeCollapsible:s,...n}=e,a=bye(_De,s);return r.jsx($s.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":jye(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...n,ref:t,onClick:xs(e.onClick,a.onOpenToggle)})});bDe.displayName=_De;var wye="CollapsibleContent",wDe=A.forwardRef((e,t)=>{const{forceMount:s,...n}=e,a=bye(wye,e.__scopeCollapsible);return r.jsx(Ec,{present:s||a.open,children:({present:o})=>r.jsx(Zmt,{...n,ref:t,present:o})})});wDe.displayName=wye;var Zmt=A.forwardRef((e,t)=>{const{__scopeCollapsible:s,present:n,children:a,...o}=e,l=bye(wye,s),[i,u]=A.useState(n),m=A.useRef(null),x=ha(t,m),y=A.useRef(0),v=y.current,b=A.useRef(0),N=b.current,k=l.open||i,M=A.useRef(k),E=A.useRef(void 0);return A.useEffect(()=>{const T=requestAnimationFrame(()=>M.current=!1);return()=>cancelAnimationFrame(T)},[]),cc(()=>{const T=m.current;if(T){E.current=E.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=E.current.transitionDuration,T.style.animationName=E.current.animationName),u(n)}},[l.open,n]),r.jsx($s.div,{"data-state":jye(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 jye(e){return e?"open":"closed"}var Ymt=vDe;const XS=Ymt,QS=bDe,JS=wDe,Xmt="/assets/levelup-logo-Eif24dqY.png",Qmt="/assets/levelup-logo-icon-C-7iromj.png",Jmt="/assets/levelup-logo-mobile-B9skSjUG.png";var pP=e=>e.type==="checkbox",dj=e=>e instanceof Date,Ku=e=>e==null;const jDe=e=>typeof e=="object";var Tc=e=>!Ku(e)&&!Array.isArray(e)&&jDe(e)&&!dj(e),kDe=e=>Tc(e)&&e.target?pP(e.target)?e.target.checked:e.target.value:e,ept=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,NDe=(e,t)=>e.has(ept(t)),tpt=e=>{const t=e.constructor&&e.constructor.prototype;return Tc(t)&&t.hasOwnProperty("isPrototypeOf")},kye=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function sd(e){let t;const s=Array.isArray(e),n=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(kye&&(e instanceof Blob||n))&&(s||Tc(e)))if(t=s?[]:{},!s&&!tpt(e))t=e;else for(const a in e)e.hasOwnProperty(a)&&(t[a]=sd(e[a]));else return e;return t}var tae=e=>/^\w*$/.test(e),_c=e=>e===void 0,Nye=e=>Array.isArray(e)?e.filter(Boolean):[],Sye=e=>Nye(e.replace(/["|']|\]/g,"").split(/\.|\[/)),sn=(e,t,s)=>{if(!t||!Tc(e))return s;const n=(tae(t)?[t]:Sye(t)).reduce((a,o)=>Ku(a)?a:a[o],e);return _c(n)||n===e?_c(e[t])?s:e[t]:n},im=e=>typeof e=="boolean",Po=(e,t,s)=>{let n=-1;const a=tae(t)?[t]:Sye(t),o=a.length,l=o-1;for(;++nut.useContext(Cye),rpt=e=>{const{children:t,...s}=e;return ut.createElement(Cye.Provider,{value:s},t)};var SDe=(e,t,s,n=!0)=>{const a={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(a,o,{get:()=>{const l=o;return t._proxyFormState[l]!==yf.all&&(t._proxyFormState[l]=!n||yf.all),s&&(s[l]=!0),e[l]}});return a};const Mye=typeof window<"u"?ut.useLayoutEffect:ut.useEffect;function spt(e){const t=rae(),{control:s=t.control,disabled:n,name:a,exact:o}=e||{},[l,i]=ut.useState(s._formState),u=ut.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Mye(()=>s._subscribe({name:a,formState:u.current,exact:o,callback:m=>{!n&&i({...s._formState,...m})}}),[a,n,o]),ut.useEffect(()=>{u.current.isValid&&s._setValid(!0)},[s]),ut.useMemo(()=>SDe(l,s,u.current,!1),[l,s])}var Ag=e=>typeof e=="string",CDe=(e,t,s,n,a)=>Ag(e)?(n&&t.watch.add(e),sn(s,e,a)):Array.isArray(e)?e.map(o=>(n&&t.watch.add(o),sn(s,o))):(n&&(t.watchAll=!0),s),Cme=e=>Ku(e)||!jDe(e);function Qx(e,t,s=new WeakSet){if(Cme(e)||Cme(t))return e===t;if(dj(e)&&dj(t))return e.getTime()===t.getTime();const n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;if(s.has(e)||s.has(t))return!0;s.add(e),s.add(t);for(const o of n){const l=e[o];if(!a.includes(o))return!1;if(o!=="ref"){const i=t[o];if(dj(l)&&dj(i)||Tc(l)&&Tc(i)||Array.isArray(l)&&Array.isArray(i)?!Qx(l,i,s):l!==i)return!1}}return!0}function npt(e){const t=rae(),{control:s=t.control,name:n,defaultValue:a,disabled:o,exact:l,compute:i}=e||{},u=ut.useRef(a),m=ut.useRef(i),x=ut.useRef(void 0);m.current=i;const y=ut.useMemo(()=>s._getWatch(n,u.current),[s,n]),[v,b]=ut.useState(m.current?m.current(y):y);return Mye(()=>s._subscribe({name:n,formState:{values:!0},exact:l,callback:N=>{if(!o){const k=CDe(n,s._names,N.values||s._formValues,!1,u.current);if(m.current){const M=m.current(k);Qx(M,x.current)||(b(M),x.current=M)}else b(k)}}}),[s,o,n,l]),ut.useEffect(()=>s._removeUnmounted()),v}function apt(e){const t=rae(),{name:s,disabled:n,control:a=t.control,shouldUnregister:o,defaultValue:l}=e,i=NDe(a._names.array,s),u=ut.useMemo(()=>sn(a._formValues,s,sn(a._defaultValues,s,l)),[a,s,l]),m=npt({control:a,name:s,defaultValue:u,exact:!0}),x=spt({control:a,name:s,exact:!0}),y=ut.useRef(e),v=ut.useRef(a.register(s,{...e.rules,value:m,...im(e.disabled)?{disabled:e.disabled}:{}}));y.current=e;const b=ut.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!sn(x.errors,s)},isDirty:{enumerable:!0,get:()=>!!sn(x.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!sn(x.touchedFields,s)},isValidating:{enumerable:!0,get:()=>!!sn(x.validatingFields,s)},error:{enumerable:!0,get:()=>sn(x.errors,s)}}),[x,s]),N=ut.useCallback(T=>v.current.onChange({target:{value:kDe(T),name:s},type:tre.CHANGE}),[s]),k=ut.useCallback(()=>v.current.onBlur({target:{value:sn(a._formValues,s),name:s},type:tre.BLUR}),[s,a._formValues]),M=ut.useCallback(T=>{const P=sn(a._fields,s);P&&T&&(P._f.ref={focus:()=>T.focus&&T.focus(),select:()=>T.select&&T.select(),setCustomValidity:R=>T.setCustomValidity(R),reportValidity:()=>T.reportValidity()})},[a._fields,s]),E=ut.useMemo(()=>({name:s,value:m,...im(n)||x.disabled?{disabled:x.disabled||n}:{},onChange:N,onBlur:k,ref:M}),[s,n,x.disabled,N,k,M,m]);return ut.useEffect(()=>{const T=a._options.shouldUnregister||o;a.register(s,{...y.current.rules,...im(y.current.disabled)?{disabled:y.current.disabled}:{}});const P=(R,D)=>{const U=sn(a._fields,R);U&&U._f&&(U._f.mount=D)};if(P(s,!0),T){const R=sd(sn(a._options.defaultValues,s));Po(a._defaultValues,s,R),_c(sn(a._formValues,s))&&Po(a._formValues,s,R)}return!i&&a.register(s),()=>{(i?T&&!a._state.action:T)?a.unregister(s):P(s,!1)}},[s,a,i,o]),ut.useEffect(()=>{a._setDisabledField({disabled:n,name:s})},[n,s,a]),ut.useMemo(()=>({field:E,formState:x,fieldState:b}),[E,x,b])}const ipt=e=>e.render(apt(e));var MDe=(e,t,s,n,a)=>t?{...s[e],types:{...s[e]&&s[e].types?s[e].types:{},[n]:a||!0}}:{},UA=e=>Array.isArray(e)?e:[e],SNe=()=>{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=[]}}},Nh=e=>Tc(e)&&!Object.keys(e).length,Tye=e=>e.type==="file",vf=e=>typeof e=="function",rre=e=>{if(!kye)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},TDe=e=>e.type==="select-multiple",Aye=e=>e.type==="radio",opt=e=>Aye(e)||pP(e),Kce=e=>rre(e)&&e.isConnected;function lpt(e,t){const s=t.slice(0,-1).length;let n=0;for(;n{for(const t in e)if(vf(e[t]))return!0;return!1};function sre(e,t={}){const s=Array.isArray(e);if(Tc(e)||s)for(const n in e)Array.isArray(e[n])||Tc(e[n])&&!ADe(e[n])?(t[n]=Array.isArray(e[n])?[]:{},sre(e[n],t[n])):Ku(e[n])||(t[n]=!0);return t}function EDe(e,t,s){const n=Array.isArray(e);if(Tc(e)||n)for(const a in e)Array.isArray(e[a])||Tc(e[a])&&!ADe(e[a])?_c(t)||Cme(s[a])?s[a]=Array.isArray(e[a])?sre(e[a],[]):{...sre(e[a])}:EDe(e[a],Ku(t)?{}:t[a],s[a]):s[a]=!Qx(e[a],t[a]);return s}var hT=(e,t)=>EDe(e,t,sre(t));const CNe={value:!1,isValid:!1},MNe={value:!0,isValid:!0};var IDe=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!_c(e[0].attributes.value)?_c(e[0].value)||e[0].value===""?MNe:{value:e[0].value,isValid:!0}:MNe:CNe}return CNe},PDe=(e,{valueAsNumber:t,valueAsDate:s,setValueAs:n})=>_c(e)?e:t?e===""?NaN:e&&+e:s&&Ag(e)?new Date(e):n?n(e):e;const TNe={isValid:!1,value:null};var LDe=e=>Array.isArray(e)?e.reduce((t,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:t,TNe):TNe;function ANe(e){const t=e.ref;return Tye(t)?t.files:Aye(t)?LDe(e.refs).value:TDe(t)?[...t.selectedOptions].map(({value:s})=>s):pP(t)?IDe(e.refs).value:PDe(_c(t.value)?e.ref.value:t.value,e)}var dpt=(e,t,s,n)=>{const a={};for(const o of e){const l=sn(t,o);l&&Po(a,o,l._f)}return{criteriaMode:s,names:[...e],fields:a,shouldUseNativeValidation:n}},nre=e=>e instanceof RegExp,mT=e=>_c(e)?e:nre(e)?e.source:Tc(e)?nre(e.value)?e.value.source:e.value:e,ENe=e=>({isOnSubmit:!e||e===yf.onSubmit,isOnBlur:e===yf.onBlur,isOnChange:e===yf.onChange,isOnAll:e===yf.all,isOnTouch:e===yf.onTouched});const INe="AsyncFunction";var upt=e=>!!e&&!!e.validate&&!!(vf(e.validate)&&e.validate.constructor.name===INe||Tc(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===INe)),hpt=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),PNe=(e,t,s)=>!s&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const qA=(e,t,s,n)=>{for(const a of s||Object.keys(e)){const o=sn(e,a);if(o){const{_f:l,...i}=o;if(l){if(l.refs&&l.refs[0]&&t(l.refs[0],a)&&!n)return!0;if(l.ref&&t(l.ref,l.name)&&!n)return!0;if(qA(i,t))break}else if(Tc(i)&&qA(i,t))break}}};function LNe(e,t,s){const n=sn(e,s);if(n||tae(s))return{error:n,name:s};const a=s.split(".");for(;a.length;){const o=a.join("."),l=sn(t,o),i=sn(e,o);if(l&&!Array.isArray(l)&&s!==o)return{name:s};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:s}}var mpt=(e,t,s,n)=>{s(e);const{name:a,...o}=e;return Nh(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(l=>t[l]===(!n||yf.all))},ppt=(e,t,s)=>!e||!t||e===t||UA(e).some(n=>n&&(s?n===t:n.startsWith(t)||t.startsWith(n))),fpt=(e,t,s,n,a)=>a.isOnAll?!1:!s&&a.isOnTouch?!(t||e):(s?n.isOnBlur:a.isOnBlur)?!e:(s?n.isOnChange:a.isOnChange)?e:!0,gpt=(e,t)=>!Nye(sn(e,t)).length&&zc(e,t),xpt=(e,t,s)=>{const n=UA(sn(e,s));return Po(n,"root",t[s]),Po(e,s,n),e},Hee=e=>Ag(e);function ONe(e,t,s="validate"){if(Hee(e)||Array.isArray(e)&&e.every(Hee)||im(e)&&!e)return{type:s,message:Hee(e)?e:"",ref:t}}var I4=e=>Tc(e)&&!nre(e)?e:{value:e,message:""},DNe=async(e,t,s,n,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:E}=e._f,T=sn(s,k);if(!E||t.has(k))return{};const P=i?i[0]:l,R=ie=>{a&&P.reportValidity&&(P.setCustomValidity(im(ie)?"":ie||""),P.reportValidity())},D={},U=Aye(l),q=pP(l),H=U||q,G=(M||Tye(l))&&_c(l.value)&&_c(T)||rre(l)&&l.value===""||T===""||Array.isArray(T)&&!T.length,Q=MDe.bind(null,k,n,D),ne=(ie,he,se,fe=Ox.maxLength,oe=Ox.minLength)=>{const ce=ie?he:se;D[k]={type:ie?fe:oe,message:ce,ref:l,...Q(ie?fe:oe,ce)}};if(o?!Array.isArray(T)||!T.length:u&&(!H&&(G||Ku(T))||im(T)&&!T||q&&!IDe(i).isValid||U&&!LDe(i).isValid)){const{value:ie,message:he}=Hee(u)?{value:!!u,message:u}:I4(u);if(ie&&(D[k]={type:Ox.required,message:he,ref:P,...Q(Ox.required,he)},!n))return R(he),D}if(!G&&(!Ku(y)||!Ku(v))){let ie,he;const se=I4(v),fe=I4(y);if(!Ku(T)&&!isNaN(T)){const oe=l.valueAsNumber||T&&+T;Ku(se.value)||(ie=oe>se.value),Ku(fe.value)||(he=oenew Date(new Date().toDateString()+" "+Me),de=l.type=="time",xe=l.type=="week";Ag(se.value)&&T&&(ie=de?ce(T)>ce(se.value):xe?T>se.value:oe>new Date(se.value)),Ag(fe.value)&&T&&(he=de?ce(T)+ie.value,fe=!Ku(he.value)&&T.length<+he.value;if((se||fe)&&(ne(se,ie.message,he.message),!n))return R(D[k].message),D}if(b&&!G&&Ag(T)){const{value:ie,message:he}=I4(b);if(nre(ie)&&!T.match(ie)&&(D[k]={type:Ox.pattern,message:he,ref:l,...Q(Ox.pattern,he)},!n))return R(he),D}if(N){if(vf(N)){const ie=await N(T,s),he=ONe(ie,P);if(he&&(D[k]={...he,...Q(Ox.validate,he.message)},!n))return R(he.message),D}else if(Tc(N)){let ie={};for(const he in N){if(!Nh(ie)&&!n)break;const se=ONe(await N[he](T,s),P,he);se&&(ie={...se,...Q(he,se.message)},R(se.message),n&&(D[k]=ie))}if(!Nh(ie)&&(D[k]={ref:P,...ie},!n))return D}}return R(!0),D};const ypt={mode:yf.onSubmit,reValidateMode:yf.onChange,shouldFocusError:!0};function vpt(e={}){let t={...ypt,...e},s={submitCount:0,isDirty:!1,isReady:!1,isLoading:vf(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},a=Tc(t.defaultValues)||Tc(t.values)?sd(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:sd(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:SNe(),state:SNe()},b=t.criteriaMode===yf.all,N=Ce=>Ie=>{clearTimeout(m),m=setTimeout(Ce,Ie)},k=async Ce=>{if(!t.disabled&&(x.isValid||y.isValid||Ce)){const Ie=t.resolver?Nh((await q()).errors):await G(n,!0);Ie!==s.isValid&&v.state.next({isValid:Ie})}},M=(Ce,Ie)=>{!t.disabled&&(x.isValidating||x.validatingFields||y.isValidating||y.validatingFields)&&((Ce||Array.from(i.mount)).forEach(Ze=>{Ze&&(Ie?Po(s.validatingFields,Ze,Ie):zc(s.validatingFields,Ze))}),v.state.next({validatingFields:s.validatingFields,isValidating:!Nh(s.validatingFields)}))},E=(Ce,Ie=[],Ze,De,Ke=!0,st=!0)=>{if(De&&Ze&&!t.disabled){if(l.action=!0,st&&Array.isArray(sn(n,Ce))){const dt=Ze(sn(n,Ce),De.argA,De.argB);Ke&&Po(n,Ce,dt)}if(st&&Array.isArray(sn(s.errors,Ce))){const dt=Ze(sn(s.errors,Ce),De.argA,De.argB);Ke&&Po(s.errors,Ce,dt),gpt(s.errors,Ce)}if((x.touchedFields||y.touchedFields)&&st&&Array.isArray(sn(s.touchedFields,Ce))){const dt=Ze(sn(s.touchedFields,Ce),De.argA,De.argB);Ke&&Po(s.touchedFields,Ce,dt)}(x.dirtyFields||y.dirtyFields)&&(s.dirtyFields=hT(a,o)),v.state.next({name:Ce,isDirty:ne(Ce,Ie),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else Po(o,Ce,Ie)},T=(Ce,Ie)=>{Po(s.errors,Ce,Ie),v.state.next({errors:s.errors})},P=Ce=>{s.errors=Ce,v.state.next({errors:s.errors,isValid:!1})},R=(Ce,Ie,Ze,De)=>{const Ke=sn(n,Ce);if(Ke){const st=sn(o,Ce,_c(Ze)?sn(a,Ce):Ze);_c(st)||De&&De.defaultChecked||Ie?Po(o,Ce,Ie?st:ANe(Ke._f)):se(Ce,st),l.mount&&k()}},D=(Ce,Ie,Ze,De,Ke)=>{let st=!1,dt=!1;const ct={name:Ce};if(!t.disabled){if(!Ze||De){(x.isDirty||y.isDirty)&&(dt=s.isDirty,s.isDirty=ct.isDirty=ne(),st=dt!==ct.isDirty);const zt=Qx(sn(a,Ce),Ie);dt=!!sn(s.dirtyFields,Ce),zt?zc(s.dirtyFields,Ce):Po(s.dirtyFields,Ce,!0),ct.dirtyFields=s.dirtyFields,st=st||(x.dirtyFields||y.dirtyFields)&&dt!==!zt}if(Ze){const zt=sn(s.touchedFields,Ce);zt||(Po(s.touchedFields,Ce,Ze),ct.touchedFields=s.touchedFields,st=st||(x.touchedFields||y.touchedFields)&&zt!==Ze)}st&&Ke&&v.state.next(ct)}return st?ct:{}},U=(Ce,Ie,Ze,De)=>{const Ke=sn(s.errors,Ce),st=(x.isValid||y.isValid)&&im(Ie)&&s.isValid!==Ie;if(t.delayError&&Ze?(u=N(()=>T(Ce,Ze)),u(t.delayError)):(clearTimeout(m),u=null,Ze?Po(s.errors,Ce,Ze):zc(s.errors,Ce)),(Ze?!Qx(Ke,Ze):Ke)||!Nh(De)||st){const dt={...De,...st&&im(Ie)?{isValid:Ie}:{},errors:s.errors,name:Ce};s={...s,...dt},v.state.next(dt)}},q=async Ce=>{M(Ce,!0);const Ie=await t.resolver(o,t.context,dpt(Ce||i.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return M(Ce),Ie},H=async Ce=>{const{errors:Ie}=await q(Ce);if(Ce)for(const Ze of Ce){const De=sn(Ie,Ze);De?Po(s.errors,Ze,De):zc(s.errors,Ze)}else s.errors=Ie;return Ie},G=async(Ce,Ie,Ze={valid:!0})=>{for(const De in Ce){const Ke=Ce[De];if(Ke){const{_f:st,...dt}=Ke;if(st){const ct=i.array.has(st.name),zt=Ke._f&&upt(Ke._f);zt&&x.validatingFields&&M([De],!0);const ir=await DNe(Ke,i.disabled,o,b,t.shouldUseNativeValidation&&!Ie,ct);if(zt&&x.validatingFields&&M([De]),ir[st.name]&&(Ze.valid=!1,Ie))break;!Ie&&(sn(ir,st.name)?ct?xpt(s.errors,ir,st.name):Po(s.errors,st.name,ir[st.name]):zc(s.errors,st.name))}!Nh(dt)&&await G(dt,Ie,Ze)}}return Ze.valid},Q=()=>{for(const Ce of i.unMount){const Ie=sn(n,Ce);Ie&&(Ie._f.refs?Ie._f.refs.every(Ze=>!Kce(Ze)):!Kce(Ie._f.ref))&&Ue(Ce)}i.unMount=new Set},ne=(Ce,Ie)=>!t.disabled&&(Ce&&Ie&&Po(o,Ce,Ie),!Qx(Me(),a)),ie=(Ce,Ie,Ze)=>CDe(Ce,i,{...l.mount?o:_c(Ie)?a:Ag(Ce)?{[Ce]:Ie}:Ie},Ze,Ie),he=Ce=>Nye(sn(l.mount?o:a,Ce,t.shouldUnregister?sn(a,Ce,[]):[])),se=(Ce,Ie,Ze={})=>{const De=sn(n,Ce);let Ke=Ie;if(De){const st=De._f;st&&(!st.disabled&&Po(o,Ce,PDe(Ie,st)),Ke=rre(st.ref)&&Ku(Ie)?"":Ie,TDe(st.ref)?[...st.ref.options].forEach(dt=>dt.selected=Ke.includes(dt.value)):st.refs?pP(st.ref)?st.refs.forEach(dt=>{(!dt.defaultChecked||!dt.disabled)&&(Array.isArray(Ke)?dt.checked=!!Ke.find(ct=>ct===dt.value):dt.checked=Ke===dt.value||!!Ke)}):st.refs.forEach(dt=>dt.checked=dt.value===Ke):Tye(st.ref)?st.ref.value="":(st.ref.value=Ke,st.ref.type||v.state.next({name:Ce,values:sd(o)})))}(Ze.shouldDirty||Ze.shouldTouch)&&D(Ce,Ke,Ze.shouldTouch,Ze.shouldDirty,!0),Ze.shouldValidate&&xe(Ce)},fe=(Ce,Ie,Ze)=>{for(const De in Ie){if(!Ie.hasOwnProperty(De))return;const Ke=Ie[De],st=Ce+"."+De,dt=sn(n,st);(i.array.has(Ce)||Tc(Ke)||dt&&!dt._f)&&!dj(Ke)?fe(st,Ke,Ze):se(st,Ke,Ze)}},oe=(Ce,Ie,Ze={})=>{const De=sn(n,Ce),Ke=i.array.has(Ce),st=sd(Ie);Po(o,Ce,st),Ke?(v.array.next({name:Ce,values:sd(o)}),(x.isDirty||x.dirtyFields||y.isDirty||y.dirtyFields)&&Ze.shouldDirty&&v.state.next({name:Ce,dirtyFields:hT(a,o),isDirty:ne(Ce,st)})):De&&!De._f&&!Ku(st)?fe(Ce,st,Ze):se(Ce,st,Ze),PNe(Ce,i)&&v.state.next({...s,name:Ce}),v.state.next({name:l.mount?Ce:void 0,values:sd(o)})},ce=async Ce=>{l.mount=!0;const Ie=Ce.target;let Ze=Ie.name,De=!0;const Ke=sn(n,Ze),st=zt=>{De=Number.isNaN(zt)||dj(zt)&&isNaN(zt.getTime())||Qx(zt,sn(o,Ze,zt))},dt=ENe(t.mode),ct=ENe(t.reValidateMode);if(Ke){let zt,ir;const Tr=Ie.type?ANe(Ke._f):kDe(Ce),Zr=Ce.type===tre.BLUR||Ce.type===tre.FOCUS_OUT,$r=!hpt(Ke._f)&&!t.resolver&&!sn(s.errors,Ze)&&!Ke._f.deps||fpt(Zr,sn(s.touchedFields,Ze),s.isSubmitted,ct,dt),ns=PNe(Ze,i,Zr);Po(o,Ze,Tr),Zr?(Ke._f.onBlur&&Ke._f.onBlur(Ce),u&&u(0)):Ke._f.onChange&&Ke._f.onChange(Ce);const Xs=D(Ze,Tr,Zr),Ot=!Nh(Xs)||ns;if(!Zr&&v.state.next({name:Ze,type:Ce.type,values:sd(o)}),$r)return(x.isValid||y.isValid)&&(t.mode==="onBlur"?Zr&&k():Zr||k()),Ot&&v.state.next({name:Ze,...ns?{}:Xs});if(!Zr&&ns&&v.state.next({...s}),t.resolver){const{errors:Hr}=await q([Ze]);if(st(Tr),De){const Ts=LNe(s.errors,n,Ze),zs=LNe(Hr,n,Ts.name||Ze);zt=zs.error,Ze=zs.name,ir=Nh(Hr)}}else M([Ze],!0),zt=(await DNe(Ke,i.disabled,o,b,t.shouldUseNativeValidation))[Ze],M([Ze]),st(Tr),De&&(zt?ir=!1:(x.isValid||y.isValid)&&(ir=await G(n,!0)));De&&(Ke._f.deps&&xe(Ke._f.deps),U(Ze,ir,zt,Xs))}},de=(Ce,Ie)=>{if(sn(s.errors,Ie)&&Ce.focus)return Ce.focus(),1},xe=async(Ce,Ie={})=>{let Ze,De;const Ke=UA(Ce);if(t.resolver){const st=await H(_c(Ce)?Ce:Ke);Ze=Nh(st),De=Ce?!Ke.some(dt=>sn(st,dt)):Ze}else Ce?(De=(await Promise.all(Ke.map(async st=>{const dt=sn(n,st);return await G(dt&&dt._f?{[st]:dt}:dt)}))).every(Boolean),!(!De&&!s.isValid)&&k()):De=Ze=await G(n);return v.state.next({...!Ag(Ce)||(x.isValid||y.isValid)&&Ze!==s.isValid?{}:{name:Ce},...t.resolver||!Ce?{isValid:Ze}:{},errors:s.errors}),Ie.shouldFocus&&!De&&qA(n,de,Ce?Ke:i.mount),De},Me=Ce=>{const Ie={...l.mount?o:a};return _c(Ce)?Ie:Ag(Ce)?sn(Ie,Ce):Ce.map(Ze=>sn(Ie,Ze))},ve=(Ce,Ie)=>({invalid:!!sn((Ie||s).errors,Ce),isDirty:!!sn((Ie||s).dirtyFields,Ce),error:sn((Ie||s).errors,Ce),isValidating:!!sn(s.validatingFields,Ce),isTouched:!!sn((Ie||s).touchedFields,Ce)}),be=Ce=>{Ce&&UA(Ce).forEach(Ie=>zc(s.errors,Ie)),v.state.next({errors:Ce?s.errors:{}})},we=(Ce,Ie,Ze)=>{const De=(sn(n,Ce,{_f:{}})._f||{}).ref,Ke=sn(s.errors,Ce)||{},{ref:st,message:dt,type:ct,...zt}=Ke;Po(s.errors,Ce,{...zt,...Ie,ref:De}),v.state.next({name:Ce,errors:s.errors,isValid:!1}),Ze&&Ze.shouldFocus&&De&&De.focus&&De.focus()},tt=(Ce,Ie)=>vf(Ce)?v.state.subscribe({next:Ze=>"values"in Ze&&Ce(ie(void 0,Ie),Ze)}):ie(Ce,Ie,!0),Ae=Ce=>v.state.subscribe({next:Ie=>{ppt(Ce.name,Ie.name,Ce.exact)&&mpt(Ie,Ce.formState||x,rt,Ce.reRenderRoot)&&Ce.callback({values:{...o},...s,...Ie,defaultValues:a})}}).unsubscribe,Le=Ce=>(l.mount=!0,y={...y,...Ce.formState},Ae({...Ce,formState:y})),Ue=(Ce,Ie={})=>{for(const Ze of Ce?UA(Ce):i.mount)i.mount.delete(Ze),i.array.delete(Ze),Ie.keepValue||(zc(n,Ze),zc(o,Ze)),!Ie.keepError&&zc(s.errors,Ze),!Ie.keepDirty&&zc(s.dirtyFields,Ze),!Ie.keepTouched&&zc(s.touchedFields,Ze),!Ie.keepIsValidating&&zc(s.validatingFields,Ze),!t.shouldUnregister&&!Ie.keepDefaultValue&&zc(a,Ze);v.state.next({values:sd(o)}),v.state.next({...s,...Ie.keepDirty?{isDirty:ne()}:{}}),!Ie.keepIsValid&&k()},Pe=({disabled:Ce,name:Ie})=>{(im(Ce)&&l.mount||Ce||i.disabled.has(Ie))&&(Ce?i.disabled.add(Ie):i.disabled.delete(Ie))},$e=(Ce,Ie={})=>{let Ze=sn(n,Ce);const De=im(Ie.disabled)||im(t.disabled);return Po(n,Ce,{...Ze||{},_f:{...Ze&&Ze._f?Ze._f:{ref:{name:Ce}},name:Ce,mount:!0,...Ie}}),i.mount.add(Ce),Ze?Pe({disabled:im(Ie.disabled)?Ie.disabled:t.disabled,name:Ce}):R(Ce,!0,Ie.value),{...De?{disabled:Ie.disabled||t.disabled}:{},...t.progressive?{required:!!Ie.required,min:mT(Ie.min),max:mT(Ie.max),minLength:mT(Ie.minLength),maxLength:mT(Ie.maxLength),pattern:mT(Ie.pattern)}:{},name:Ce,onChange:ce,onBlur:ce,ref:Ke=>{if(Ke){$e(Ce,Ie),Ze=sn(n,Ce);const st=_c(Ke.value)&&Ke.querySelectorAll&&Ke.querySelectorAll("input,select,textarea")[0]||Ke,dt=opt(st),ct=Ze._f.refs||[];if(dt?ct.find(zt=>zt===st):st===Ze._f.ref)return;Po(n,Ce,{_f:{...Ze._f,...dt?{refs:[...ct.filter(Kce),st,...Array.isArray(sn(a,Ce))?[{}]:[]],ref:{type:st.type,name:Ce}}:{ref:st}}}),R(Ce,!1,void 0,st)}else Ze=sn(n,Ce,{}),Ze._f&&(Ze._f.mount=!1),(t.shouldUnregister||Ie.shouldUnregister)&&!(NDe(i.array,Ce)&&l.action)&&i.unMount.add(Ce)}}},it=()=>t.shouldFocusError&&qA(n,de,i.mount),xt=Ce=>{im(Ce)&&(v.state.next({disabled:Ce}),qA(n,(Ie,Ze)=>{const De=sn(n,Ze);De&&(Ie.disabled=De._f.disabled||Ce,Array.isArray(De._f.refs)&&De._f.refs.forEach(Ke=>{Ke.disabled=De._f.disabled||Ce}))},0,!1))},Ee=(Ce,Ie)=>async Ze=>{let De;Ze&&(Ze.preventDefault&&Ze.preventDefault(),Ze.persist&&Ze.persist());let Ke=sd(o);if(v.state.next({isSubmitting:!0}),t.resolver){const{errors:st,values:dt}=await q();s.errors=st,Ke=sd(dt)}else await G(n);if(i.disabled.size)for(const st of i.disabled)zc(Ke,st);if(zc(s.errors,"root"),Nh(s.errors)){v.state.next({errors:{}});try{await Ce(Ke,Ze)}catch(st){De=st}}else Ie&&await Ie({...s.errors},Ze),it(),setTimeout(it);if(v.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Nh(s.errors)&&!De,submitCount:s.submitCount+1,errors:s.errors}),De)throw De},et=(Ce,Ie={})=>{sn(n,Ce)&&(_c(Ie.defaultValue)?oe(Ce,sd(sn(a,Ce))):(oe(Ce,Ie.defaultValue),Po(a,Ce,sd(Ie.defaultValue))),Ie.keepTouched||zc(s.touchedFields,Ce),Ie.keepDirty||(zc(s.dirtyFields,Ce),s.isDirty=Ie.defaultValue?ne(Ce,sd(sn(a,Ce))):ne()),Ie.keepError||(zc(s.errors,Ce),x.isValid&&k()),v.state.next({...s}))},le=(Ce,Ie={})=>{const Ze=Ce?sd(Ce):a,De=sd(Ze),Ke=Nh(Ce),st=Ke?a:De;if(Ie.keepDefaultValues||(a=Ze),!Ie.keepValues){if(Ie.keepDirtyValues){const dt=new Set([...i.mount,...Object.keys(hT(a,o))]);for(const ct of Array.from(dt))sn(s.dirtyFields,ct)?Po(st,ct,sn(o,ct)):oe(ct,sn(st,ct))}else{if(kye&&_c(Ce))for(const dt of i.mount){const ct=sn(n,dt);if(ct&&ct._f){const zt=Array.isArray(ct._f.refs)?ct._f.refs[0]:ct._f.ref;if(rre(zt)){const ir=zt.closest("form");if(ir){ir.reset();break}}}}if(Ie.keepFieldsRef)for(const dt of i.mount)oe(dt,sn(st,dt));else n={}}o=t.shouldUnregister?Ie.keepDefaultValues?sd(a):{}:sd(st),v.array.next({values:{...st}}),v.state.next({values:{...st}})}i={mount:Ie.keepDirtyValues?i.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!x.isValid||!!Ie.keepIsValid||!!Ie.keepDirtyValues,l.watch=!!t.shouldUnregister,v.state.next({submitCount:Ie.keepSubmitCount?s.submitCount:0,isDirty:Ke?!1:Ie.keepDirty?s.isDirty:!!(Ie.keepDefaultValues&&!Qx(Ce,a)),isSubmitted:Ie.keepIsSubmitted?s.isSubmitted:!1,dirtyFields:Ke?{}:Ie.keepDirtyValues?Ie.keepDefaultValues&&o?hT(a,o):s.dirtyFields:Ie.keepDefaultValues&&Ce?hT(a,Ce):Ie.keepDirty?s.dirtyFields:{},touchedFields:Ie.keepTouched?s.touchedFields:{},errors:Ie.keepErrors?s.errors:{},isSubmitSuccessful:Ie.keepIsSubmitSuccessful?s.isSubmitSuccessful:!1,isSubmitting:!1})},Ve=(Ce,Ie)=>le(vf(Ce)?Ce(o):Ce,Ie),Je=(Ce,Ie={})=>{const Ze=sn(n,Ce),De=Ze&&Ze._f;if(De){const Ke=De.refs?De.refs[0]:De.ref;Ke.focus&&(Ke.focus(),Ie.shouldSelect&&vf(Ke.select)&&Ke.select())}},rt=Ce=>{s={...s,...Ce}},lt={control:{register:$e,unregister:Ue,getFieldState:ve,handleSubmit:Ee,setError:we,_subscribe:Ae,_runSchema:q,_focusError:it,_getWatch:ie,_getDirty:ne,_setValid:k,_setFieldArray:E,_setDisabledField:Pe,_setErrors:P,_getFieldArray:he,_reset:le,_resetDefaultValues:()=>vf(t.defaultValues)&&t.defaultValues().then(Ce=>{Ve(Ce,t.resetOptions),v.state.next({isLoading:!1})}),_removeUnmounted:Q,_disableForm:xt,_subjects:v,_proxyFormState:x,get _fields(){return n},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 s},get _options(){return t},set _options(Ce){t={...t,...Ce}}},subscribe:Le,trigger:xe,register:$e,handleSubmit:Ee,watch:tt,setValue:oe,getValues:Me,reset:Ve,resetField:et,clearErrors:be,unregister:Ue,setError:we,setFocus:Je,getFieldState:ve};return{...lt,formControl:lt}}function sae(e={}){const t=ut.useRef(void 0),s=ut.useRef(void 0),[n,a]=ut.useState({isDirty:!1,isValidating:!1,isLoading:vf(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:vf(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!vf(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...i}=vpt(e);t.current={...i,formState:n}}const o=t.current.control;return o._options=e,Mye(()=>{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]),ut.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),ut.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),ut.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),ut.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),ut.useEffect(()=>{if(o._proxyFormState.isDirty){const l=o._getDirty();l!==n.isDirty&&o._subjects.state.next({isDirty:l})}},[o,n.isDirty]),ut.useEffect(()=>{e.values&&!Qx(e.values,s.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),s.current=e.values,a(l=>({...l}))):o._resetDefaultValues()},[o,e.values]),ut.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=SDe(n,o),t.current}const RNe=(e,t,s)=>{if(e&&"reportValidity"in e){const n=sn(s,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},ODe=(e,t)=>{for(const s in t.fields){const n=t.fields[s];n&&n.ref&&"reportValidity"in n.ref?RNe(n.ref,s,e):n.refs&&n.refs.forEach(a=>RNe(a,s,e))}},_pt=(e,t)=>{t.shouldUseNativeValidation&&ODe(e,t);const s={};for(const n in e){const a=sn(t.fields,n),o=Object.assign(e[n]||{},{ref:a&&a.ref});if(bpt(t.names||Object.keys(e),n)){const l=Object.assign({},sn(s,n));Po(l,"root",o),Po(s,n,l)}else Po(s,n,o)}return s},bpt=(e,t)=>e.some(s=>s.startsWith(t+"."));var wpt=function(e,t){for(var s={};e.length;){var n=e[0],a=n.code,o=n.message,l=n.path.join(".");if(!s[l])if("unionErrors"in n){var i=n.unionErrors[0].errors[0];s[l]={message:i.message,type:i.code}}else s[l]={message:o,type:a};if("unionErrors"in n&&n.unionErrors.forEach(function(x){return x.errors.forEach(function(y){return e.push(y)})}),t){var u=s[l].types,m=u&&u[n.code];s[l]=MDe(l,t,s,a,m?[].concat(m,n.message):n.message)}e.shift()}return s},nae=function(e,t,s){return s===void 0&&(s={}),function(n,a,o){try{return Promise.resolve(function(l,i){try{var u=Promise.resolve(e[s.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(m){return o.shouldUseNativeValidation&&ODe({},o),{errors:{},values:s.raw?n: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:_pt(wpt(l.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw l}))}catch(l){return Promise.reject(l)}}};const aae=rpt,DDe=A.createContext({}),Rl=({...e})=>r.jsx(DDe.Provider,{value:{name:e.name},children:r.jsx(ipt,{...e})}),iae=()=>{const e=A.useContext(DDe),t=A.useContext(RDe),{getFieldState:s,formState:n}=rae(),a=s(e.name,n);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}},RDe=A.createContext({}),Cl=A.forwardRef(({className:e,...t},s)=>{const n=A.useId();return r.jsx(RDe.Provider,{value:{id:n},children:r.jsx("div",{ref:s,className:Ut("space-y-2",e),...t})})});Cl.displayName="FormItem";const Ml=A.forwardRef(({className:e,...t},s)=>{const{error:n,formItemId:a}=iae();return r.jsx(ze,{ref:s,className:Ut(n&&"text-destructive",e),htmlFor:a,...t})});Ml.displayName="FormLabel";const Tl=A.forwardRef(({...e},t)=>{const{error:s,formItemId:n,formDescriptionId:a,formMessageId:o}=iae();return r.jsx(sxe,{ref:t,id:n,"aria-describedby":s?`${a} ${o}`:`${a}`,"aria-invalid":!!s,...e})});Tl.displayName="FormControl";const Wee=A.forwardRef(({className:e,...t},s)=>{const{formDescriptionId:n}=iae();return r.jsx("p",{ref:s,id:n,className:Ut("text-sm text-muted-foreground",e),...t})});Wee.displayName="FormDescription";const Yu=A.forwardRef(({className:e,children:t,...s},n)=>{const{error:a,formMessageId:o}=iae(),l=a?String(a==null?void 0:a.message):t;return l?r.jsx("p",{ref:n,id:o,className:Ut("text-sm font-medium text-destructive",e),...s,children:l}):null});Yu.displayName="FormMessage";const Ys=A.forwardRef(({className:e,...t},s)=>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:s,...t}));Ys.displayName="Textarea";const jpt=Ev({category:tDe(["general","technology","crm","marketing"]),subject:Oo().min(5,"Subject must be at least 5 characters").max(200),description:Oo().min(20,"Please provide more details (at least 20 characters)").max(2e3)}),kpt={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function Mme({trigger:e}){const[t,s]=A.useState(!1),[n,a]=A.useState(!1),{user:o}=Yr(),l=sae({resolver:nae(jpt),defaultValues:{category:"general",subject:"",description:""}}),i=async u=>{if(!o){Te.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:kpt[u.category],subject:u.subject}})}catch(x){console.log("Notification send attempted:",x)}Te.success("Support ticket submitted successfully!"),l.reset(),s(!1)}catch(m){console.error("Error submitting ticket:",m),Te.error("Failed to submit ticket. Please try again.")}finally{a(!1)}};return r.jsxs(Or,{open:t,onOpenChange:s,children:[r.jsx(vo,{asChild:!0,children:e||r.jsxs(X,{variant:"ghost",size:"icon",className:"relative",children:[r.jsx(gA,{className:"h-5 w-5"}),r.jsx("span",{className:"sr-only",children:"Support"})]})}),r.jsxs(Pr,{className:"sm:max-w-[500px]",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Need Help?"}),r.jsx(Zs,{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(Pi,{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(aae,{...l,children:r.jsxs("form",{onSubmit:l.handleSubmit(i),className:"space-y-4",children:[r.jsx(Rl,{control:l.control,name:"category",render:({field:u})=>r.jsxs(Cl,{children:[r.jsx(Ml,{children:"Category"}),r.jsxs(us,{onValueChange:u.onChange,defaultValue:u.value,children:[r.jsx(Tl,{children:r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select a category"})})}),r.jsxs(ds,{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(Yu,{})]})}),r.jsx(Rl,{control:l.control,name:"subject",render:({field:u})=>r.jsxs(Cl,{children:[r.jsx(Ml,{children:"Subject"}),r.jsx(Tl,{children:r.jsx(ot,{placeholder:"Brief description of your issue",...u})}),r.jsx(Yu,{})]})}),r.jsx(Rl,{control:l.control,name:"description",render:({field:u})=>r.jsxs(Cl,{children:[r.jsx(Ml,{children:"Description"}),r.jsx(Tl,{children:r.jsx(Ys,{placeholder:"Please describe your issue in detail...",className:"min-h-[120px]",...u})}),r.jsx(Yu,{})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(X,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),r.jsx(X,{type:"submit",disabled:n,children:n?"Submitting...":"Submit Ticket"})]})]})})]})]})}const Npt=()=>{const{user:e}=Yr(),t=Hs(),[s,n]=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){n(T);const R=k?new Date(k):null,D=T.filter(U=>R?new Date(U.created_at)>R:!0);o(D.length)}})();const E=Y.channel("push-notifications").on("postgres_changes",{event:"INSERT",schema:"public",table:"push_notifications"},T=>{const P=T.new;n(D=>[P,...D].slice(0,20));const R=k?new Date(k):null;(!R||new Date(P.created_at)>R)&&o(D=>D+1),Notification.permission==="granted"&&new Notification(P.title,{body:P.body,icon:"/favicon.ico"})}).subscribe();return()=>{Y.removeChannel(E)}},[e,u]);const x=N=>{const k=N.toLowerCase();return k.includes("community")||k.includes("post")?Bo:k.includes("academy")||k.includes("video")?Ta:k.includes("template")?Wc:k.includes("event")?jn:k.includes("newsletter")?fy:k.includes("brokerage")?rh:k.includes("swag")||k.includes("social")?oo:k.includes("toolbox")||k.includes("tool")?vy:k.includes("brief")?Bn:Bo},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(uh,{open:l,onOpenChange:b,children:[r.jsx(hh,{asChild:!0,children:r.jsxs(X,{variant:"ghost",size:"icon",className:"relative",children:[r.jsx(Rg,{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(Cu,{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"}),s.length>0&&r.jsx(X,{variant:"ghost",size:"sm",className:"text-xs h-6",onClick:v,children:"Mark all read"})]}),r.jsx(Yo,{className:"h-[300px]",children:s.length===0?r.jsx("div",{className:"p-4 text-center text-muted-foreground text-sm",children:"No notifications yet"}):s.map(N=>{const k=x(N.title);return r.jsxs(Wa,{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:ju(new Date(N.created_at),{addSuffix:!0})})]})]},N.id)})})]})]})};var FNe=1,Spt=.9,Cpt=.8,Mpt=.17,Zce=.1,Yce=.999,Tpt=.9999,Apt=.99,Ept=/[\\\/_+.#"@\[\(\{&]/,Ipt=/[\\\/_+.#"@\[\(\{&]/g,Ppt=/[\s-]/,FDe=/[\s-]/g;function Tme(e,t,s,n,a,o,l){if(o===t.length)return a===e.length?FNe:Apt;var i=`${a},${o}`;if(l[i]!==void 0)return l[i];for(var u=n.charAt(o),m=s.indexOf(u,a),x=0,y,v,b,N;m>=0;)y=Tme(e,t,s,n,m+1,o+1,l),y>x&&(m===a?y*=FNe:Ept.test(e.charAt(m-1))?(y*=Cpt,b=e.slice(a,m-1).match(Ipt),b&&a>0&&(y*=Math.pow(Yce,b.length))):Ppt.test(e.charAt(m-1))?(y*=Spt,N=e.slice(a,m-1).match(FDe),N&&a>0&&(y*=Math.pow(Yce,N.length))):(y*=Mpt,a>0&&(y*=Math.pow(Yce,m-a))),e.charAt(m)!==t.charAt(o)&&(y*=Tpt)),(yy&&(y=v*Zce)),y>x&&(x=y),m=s.indexOf(u,m+1);return l[i]=x,x}function zNe(e){return e.toLowerCase().replace(FDe," ")}function Lpt(e,t,s){return e=s&&s.length>0?`${e+" "+s.join(" ")}`:e,Tme(e,t,zNe(e),zNe(t),0,0,{})}var pT='[cmdk-group=""]',Xce='[cmdk-group-items=""]',Opt='[cmdk-group-heading=""]',zDe='[cmdk-item=""]',BNe=`${zDe}:not([aria-disabled="true"])`,Ame="cmdk-item-select",H4="data-value",Dpt=(e,t,s)=>Lpt(e,t,s),BDe=A.createContext(void 0),fP=()=>A.useContext(BDe),$De=A.createContext(void 0),Eye=()=>A.useContext($De),UDe=A.createContext(void 0),qDe=A.forwardRef((e,t)=>{let s=W4(()=>{var be,we;return{search:"",value:(we=(be=e.value)!=null?be:e.defaultValue)!=null?we:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=W4(()=>new Set),a=W4(()=>new Map),o=W4(()=>new Map),l=W4(()=>new Set),i=VDe(e),{label:u,children:m,value:x,onValueChange:y,filter:v,shouldFilter:b,loop:N,disablePointerSelection:k=!1,vimBindings:M=!0,...E}=e,T=yd(),P=yd(),R=yd(),D=A.useRef(null),U=Gpt();fk(()=>{if(x!==void 0){let be=x.trim();s.current.value=be,q.emit()}},[x]),fk(()=>{U(6,he)},[]);let q=A.useMemo(()=>({subscribe:be=>(l.current.add(be),()=>l.current.delete(be)),snapshot:()=>s.current,setState:(be,we,tt)=>{var Ae,Le,Ue,Pe;if(!Object.is(s.current[be],we)){if(s.current[be]=we,be==="search")ie(),Q(),U(1,ne);else if(be==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let $e=document.getElementById(R);$e?$e.focus():(Ae=document.getElementById(T))==null||Ae.focus()}if(U(7,()=>{var $e;s.current.selectedItemId=($e=se())==null?void 0:$e.id,q.emit()}),tt||U(5,he),((Le=i.current)==null?void 0:Le.value)!==void 0){let $e=we??"";(Pe=(Ue=i.current).onValueChange)==null||Pe.call(Ue,$e);return}}q.emit()}},emit:()=>{l.current.forEach(be=>be())}}),[]),H=A.useMemo(()=>({value:(be,we,tt)=>{var Ae;we!==((Ae=o.current.get(be))==null?void 0:Ae.value)&&(o.current.set(be,{value:we,keywords:tt}),s.current.filtered.items.set(be,G(we,tt)),U(2,()=>{Q(),q.emit()}))},item:(be,we)=>(n.current.add(be),we&&(a.current.has(we)?a.current.get(we).add(be):a.current.set(we,new Set([be]))),U(3,()=>{ie(),Q(),s.current.value||ne(),q.emit()}),()=>{o.current.delete(be),n.current.delete(be),s.current.filtered.items.delete(be);let tt=se();U(4,()=>{ie(),(tt==null?void 0:tt.getAttribute("id"))===be&&ne(),q.emit()})}),group:be=>(a.current.has(be)||a.current.set(be,new Set),()=>{o.current.delete(be),a.current.delete(be)}),filter:()=>i.current.shouldFilter,label:u||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:T,inputId:R,labelId:P,listInnerRef:D}),[]);function G(be,we){var tt,Ae;let Le=(Ae=(tt=i.current)==null?void 0:tt.filter)!=null?Ae:Dpt;return be?Le(be,s.current.search,we):0}function Q(){if(!s.current.search||i.current.shouldFilter===!1)return;let be=s.current.filtered.items,we=[];s.current.filtered.groups.forEach(Ae=>{let Le=a.current.get(Ae),Ue=0;Le.forEach(Pe=>{let $e=be.get(Pe);Ue=Math.max($e,Ue)}),we.push([Ae,Ue])});let tt=D.current;fe().sort((Ae,Le)=>{var Ue,Pe;let $e=Ae.getAttribute("id"),it=Le.getAttribute("id");return((Ue=be.get(it))!=null?Ue:0)-((Pe=be.get($e))!=null?Pe:0)}).forEach(Ae=>{let Le=Ae.closest(Xce);Le?Le.appendChild(Ae.parentElement===Le?Ae:Ae.closest(`${Xce} > *`)):tt.appendChild(Ae.parentElement===tt?Ae:Ae.closest(`${Xce} > *`))}),we.sort((Ae,Le)=>Le[1]-Ae[1]).forEach(Ae=>{var Le;let Ue=(Le=D.current)==null?void 0:Le.querySelector(`${pT}[${H4}="${encodeURIComponent(Ae[0])}"]`);Ue==null||Ue.parentElement.appendChild(Ue)})}function ne(){let be=fe().find(tt=>tt.getAttribute("aria-disabled")!=="true"),we=be==null?void 0:be.getAttribute(H4);q.setState("value",we||void 0)}function ie(){var be,we,tt,Ae;if(!s.current.search||i.current.shouldFilter===!1){s.current.filtered.count=n.current.size;return}s.current.filtered.groups=new Set;let Le=0;for(let Ue of n.current){let Pe=(we=(be=o.current.get(Ue))==null?void 0:be.value)!=null?we:"",$e=(Ae=(tt=o.current.get(Ue))==null?void 0:tt.keywords)!=null?Ae:[],it=G(Pe,$e);s.current.filtered.items.set(Ue,it),it>0&&Le++}for(let[Ue,Pe]of a.current)for(let $e of Pe)if(s.current.filtered.items.get($e)>0){s.current.filtered.groups.add(Ue);break}s.current.filtered.count=Le}function he(){var be,we,tt;let Ae=se();Ae&&(((be=Ae.parentElement)==null?void 0:be.firstChild)===Ae&&((tt=(we=Ae.closest(pT))==null?void 0:we.querySelector(Opt))==null||tt.scrollIntoView({block:"nearest"})),Ae.scrollIntoView({block:"nearest"}))}function se(){var be;return(be=D.current)==null?void 0:be.querySelector(`${zDe}[aria-selected="true"]`)}function fe(){var be;return Array.from(((be=D.current)==null?void 0:be.querySelectorAll(BNe))||[])}function oe(be){let we=fe()[be];we&&q.setState("value",we.getAttribute(H4))}function ce(be){var we;let tt=se(),Ae=fe(),Le=Ae.findIndex(Pe=>Pe===tt),Ue=Ae[Le+be];(we=i.current)!=null&&we.loop&&(Ue=Le+be<0?Ae[Ae.length-1]:Le+be===Ae.length?Ae[0]:Ae[Le+be]),Ue&&q.setState("value",Ue.getAttribute(H4))}function de(be){let we=se(),tt=we==null?void 0:we.closest(pT),Ae;for(;tt&&!Ae;)tt=be>0?Hpt(tt,pT):Wpt(tt,pT),Ae=tt==null?void 0:tt.querySelector(BNe);Ae?q.setState("value",Ae.getAttribute(H4)):ce(be)}let xe=()=>oe(fe().length-1),Me=be=>{be.preventDefault(),be.metaKey?xe():be.altKey?de(1):ce(1)},ve=be=>{be.preventDefault(),be.metaKey?oe(0):be.altKey?de(-1):ce(-1)};return A.createElement($s.div,{ref:t,tabIndex:-1,...E,"cmdk-root":"",onKeyDown:be=>{var we;(we=E.onKeyDown)==null||we.call(E,be);let tt=be.nativeEvent.isComposing||be.keyCode===229;if(!(be.defaultPrevented||tt))switch(be.key){case"n":case"j":{M&&be.ctrlKey&&Me(be);break}case"ArrowDown":{Me(be);break}case"p":case"k":{M&&be.ctrlKey&&ve(be);break}case"ArrowUp":{ve(be);break}case"Home":{be.preventDefault(),oe(0);break}case"End":{be.preventDefault(),xe();break}case"Enter":{be.preventDefault();let Ae=se();if(Ae){let Le=new Event(Ame);Ae.dispatchEvent(Le)}}}}},A.createElement("label",{"cmdk-label":"",htmlFor:H.inputId,id:H.labelId,style:Zpt},u),oae(e,be=>A.createElement($De.Provider,{value:q},A.createElement(BDe.Provider,{value:H},be))))}),Rpt=A.forwardRef((e,t)=>{var s,n;let a=yd(),o=A.useRef(null),l=A.useContext(UDe),i=fP(),u=VDe(e),m=(n=(s=u.current)==null?void 0:s.forceMount)!=null?n:l==null?void 0:l.forceMount;fk(()=>{if(!m)return i.item(a,l==null?void 0:l.id)},[m]);let x=HDe(a,o,[e.value,e.children,o],e.keywords),y=Eye(),v=vv(U=>U.value&&U.value===x.current),b=vv(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(Ame,N),()=>U.removeEventListener(Ame,N)},[b,e.onSelect,e.disabled]);function N(){var U,q;k(),(q=(U=u.current).onSelect)==null||q.call(U,x.current)}function k(){y.setState("value",x.current,!0)}if(!b)return null;let{disabled:M,value:E,onSelect:T,forceMount:P,keywords:R,...D}=e;return A.createElement($s.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)}),Fpt=A.forwardRef((e,t)=>{let{heading:s,children:n,forceMount:a,...o}=e,l=yd(),i=A.useRef(null),u=A.useRef(null),m=yd(),x=fP(),y=vv(b=>a||x.filter()===!1?!0:b.search?b.filtered.groups.has(l):!0);fk(()=>x.group(l),[]),HDe(l,i,[e.value,e.heading,u]);let v=A.useMemo(()=>({id:l,forceMount:a}),[a]);return A.createElement($s.div,{ref:Ty(i,t),...o,"cmdk-group":"",role:"presentation",hidden:y?void 0:!0},s&&A.createElement("div",{ref:u,"cmdk-group-heading":"","aria-hidden":!0,id:m},s),oae(e,b=>A.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":s?m:void 0},A.createElement(UDe.Provider,{value:v},b))))}),zpt=A.forwardRef((e,t)=>{let{alwaysRender:s,...n}=e,a=A.useRef(null),o=vv(l=>!l.search);return!s&&!o?null:A.createElement($s.div,{ref:Ty(a,t),...n,"cmdk-separator":"",role:"separator"})}),Bpt=A.forwardRef((e,t)=>{let{onValueChange:s,...n}=e,a=e.value!=null,o=Eye(),l=vv(m=>m.search),i=vv(m=>m.selectedItemId),u=fP();return A.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),A.createElement($s.input,{ref:t,...n,"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),s==null||s(m.target.value)}})}),$pt=A.forwardRef((e,t)=>{let{children:s,label:n="Suggestions",...a}=e,o=A.useRef(null),l=A.useRef(null),i=vv(m=>m.selectedItemId),u=fP();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($s.div,{ref:Ty(o,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":n,id:u.listId},oae(e,m=>A.createElement("div",{ref:Ty(l,u.listInnerRef),"cmdk-list-sizer":""},m)))}),Upt=A.forwardRef((e,t)=>{let{open:s,onOpenChange:n,overlayClassName:a,contentClassName:o,container:l,...i}=e;return A.createElement(Dne,{open:s,onOpenChange:n},A.createElement(Rne,{container:l},A.createElement(O3,{"cmdk-overlay":"",className:a}),A.createElement(D3,{"aria-label":e.label,"cmdk-dialog":"",className:o},A.createElement(qDe,{ref:t,...i}))))}),qpt=A.forwardRef((e,t)=>vv(s=>s.filtered.count===0)?A.createElement($s.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Vpt=A.forwardRef((e,t)=>{let{progress:s,children:n,label:a="Loading...",...o}=e;return A.createElement($s.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":s,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},oae(e,l=>A.createElement("div",{"aria-hidden":!0},l)))}),$h=Object.assign(qDe,{List:$pt,Item:Rpt,Input:Bpt,Group:Fpt,Separator:zpt,Dialog:Upt,Empty:qpt,Loading:Vpt});function Hpt(e,t){let s=e.nextElementSibling;for(;s;){if(s.matches(t))return s;s=s.nextElementSibling}}function Wpt(e,t){let s=e.previousElementSibling;for(;s;){if(s.matches(t))return s;s=s.previousElementSibling}}function VDe(e){let t=A.useRef(e);return fk(()=>{t.current=e}),t}var fk=typeof window>"u"?A.useEffect:A.useLayoutEffect;function W4(e){let t=A.useRef();return t.current===void 0&&(t.current=e()),t}function vv(e){let t=Eye(),s=()=>e(t.snapshot());return A.useSyncExternalStore(t.subscribe,s,s)}function HDe(e,t,s,n=[]){let a=A.useRef(),o=fP();return fk(()=>{var l;let i=(()=>{var m;for(let x of s){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=n.map(m=>m.trim());o.value(e,i,u),(l=t.current)==null||l.setAttribute(H4,i),a.current=i}),a}var Gpt=()=>{let[e,t]=A.useState(),s=W4(()=>new Map);return fk(()=>{s.current.forEach(n=>n()),s.current=new Map},[e]),(n,a)=>{s.current.set(n,a),t({})}};function Kpt(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function oae({asChild:e,children:t},s){return e&&A.isValidElement(t)?A.cloneElement(Kpt(t),{ref:t.ref},s(t.props.children)):s(t)}var Zpt={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},s)=>r.jsx($h,{ref:s,className:Ut("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Ly.displayName=$h.displayName;const Ypt=({children:e,...t})=>r.jsx(Or,{...t,children:r.jsx(Pr,{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},s)=>r.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[r.jsx(ua,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),r.jsx($h.Input,{ref:s,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=$h.Input.displayName;const Dy=A.forwardRef(({className:e,...t},s)=>r.jsx($h.List,{ref:s,className:Ut("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));Dy.displayName=$h.List.displayName;const Ry=A.forwardRef((e,t)=>r.jsx($h.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));Ry.displayName=$h.Empty.displayName;const Fy=A.forwardRef(({className:e,...t},s)=>r.jsx($h.Group,{ref:s,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=$h.Group.displayName;const Xpt=A.forwardRef(({className:e,...t},s)=>r.jsx($h.Separator,{ref:s,className:Ut("-mx-1 h-px bg-border",e),...t}));Xpt.displayName=$h.Separator.displayName;const zy=A.forwardRef(({className:e,...t},s)=>r.jsx($h.Item,{ref:s,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=$h.Item.displayName;const Qpt={event:{label:"Events",icon:Af,color:"bg-blue-500/10 text-blue-600"},template:{label:"Templates",icon:Wc,color:"bg-purple-500/10 text-purple-600"},academy:{label:"Academy",icon:K1,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:Bn,color:"bg-fuchsia-500/10 text-fuchsia-600"}},$Ne=()=>{const[e,t]=A.useState(!1),[s,n]=A.useState(""),[a,o]=A.useState([]),[l,i]=A.useState(!1),u=Hs();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,E,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(R=>{P.push({id:R.id,title:R.title,description:R.description,type:"event",date:R.event_date,path:`/event/${R.id}`})}),k.data&&k.data.forEach(R=>{P.push({id:R.id,title:R.name,description:R.description,type:"template",date:R.publish_date,path:`/templates/${R.id}`})}),M.data&&M.data.forEach(R=>{P.push({id:R.id,title:R.title,description:R.description,type:"academy",date:R.publish_date,path:`/academy/${R.id}`})}),E.data&&E.data.forEach(R=>{P.push({id:R.id,title:R.name,description:R.description,type:"toolbox",date:R.publish_date,path:`/toolbox/${R.id}`})}),T.data&&T.data.forEach(R=>{P.push({id:R.id,title:R.title,description:R.description,type:"social-swag",date:R.publish_date,path:`/social-swag/${R.id}`})}),o(P)}catch(N){console.error("Search error:",N)}finally{i(!1)}},[]);A.useEffect(()=>{const v=setTimeout(()=>{m(s)},300);return()=>clearTimeout(v)},[s,m]);const x=v=>{t(!1),n(""),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(ua,{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(Ypt,{open:e,onOpenChange:t,children:[r.jsx(Oy,{placeholder:"Search events, templates, academy, toolbox, social swag...",value:s,onValueChange:n}),r.jsxs(Dy,{children:[l&&r.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Searching..."}),!l&&s&&a.length===0&&r.jsxs(Ry,{children:['No results found for "',s,'"']}),!l&&!s&&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=Qpt[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:ju(new Date(M.date),{addSuffix:!0})})]})]},`${M.type}-${M.id}`))},v)})]})]})]})},Jpt=({expiresAt:e,className:t,showUpgradeButton:s=!0})=>{const[n,a]=A.useState(null),o=Hs();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]),!n)return null;const l=n.days===0&&n.hours===0&&n.minutes===0,i=n.days<=1,u=n.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(Zu,{className:"h-4 w-4 text-destructive"}),r.jsx("span",{className:"text-sm font-medium text-destructive",children:"Your free trial has expired"})]}),s&&r.jsxs(X,{size:"sm",onClick:()=>o("/subscription"),className:"bg-primary hover:bg-primary/90 text-xs h-7 px-3",children:[r.jsx(Bn,{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(Ra,{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:[n.days>0&&r.jsxs("span",{className:Ut("text-sm font-bold",i?"text-destructive":u?"text-amber-600":"text-primary"),children:[n.days,"d"]}),r.jsxs("span",{className:Ut("text-sm font-bold",i?"text-destructive":u?"text-amber-600":"text-primary"),children:[n.hours,"h"]}),r.jsxs("span",{className:Ut("text-sm font-bold",i?"text-destructive":u?"text-amber-600":"text-primary"),children:[n.minutes,"m"]}),r.jsx("span",{className:Ut("text-xs",i?"text-destructive/70":u?"text-amber-600/70":"text-primary/70"),children:"remaining"})]})]})]}),s&&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(Bn,{className:"h-3 w-3 mr-1"}),"Upgrade"]})]})},eft=()=>{const e=Hs();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(Vt,{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(Zu,{className:"h-8 w-8 text-destructive"})}),r.jsx(Gt,{className:"text-2xl",children:"Your Free Trial Has Ended"}),r.jsx(Ns,{className:"text-base",children:"Your 7-day free trial has expired. Upgrade now to continue accessing all the powerful tools and resources LevelUp has to offer!"})]}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsx(He,{className:"border-2 border-primary/20 hover:border-primary/50 transition-colors cursor-pointer",onClick:()=>e("/subscription"),children:r.jsxs(Xe,{className:"p-5 text-center",children:[r.jsx("div",{className:"mx-auto mb-3 h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(qs,{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(Bn,{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(Xe,{className:"p-5 text-center",children:[r.jsx("div",{className:"mx-auto mb-3 h-12 w-12 rounded-full bg-amber-500/10 flex items-center justify-center",children:r.jsx(pi,{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(pi,{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(Pi,{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(Nn,{className:"h-4 w-4"}),r.jsx("span",{children:"support@relevelup.com"})]})]})]})]})]})})},tft=({hasUnseenBrief:e,onClick:t,className:s})=>r.jsxs(Gg,{children:[r.jsx(Kg,{asChild:!0,children:r.jsxs(X,{variant:"ghost",size:"icon",onClick:t,className:Ut("relative transition-colors",e&&"text-primary hover:text-primary",s),children:[r.jsx(Pf,{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(Of,{children:r.jsx("p",{children:"The LevelUp Brief"})})]});var lae="Checkbox",[rft]=uc(lae),[sft,Iye]=rft(lae);function nft(e){const{__scopeCheckbox:t,checked:s,children:n,defaultChecked:a,disabled:o,form:l,name:i,onCheckedChange:u,required:m,value:x="on",internal_do_not_use_render:y}=e,[v,b]=ah({prop:s,defaultProp:a??!1,onChange:u,caller:lae}),[N,k]=A.useState(null),[M,E]=A.useState(null),T=A.useRef(!1),P=N?!!l||!!N.closest("form"):!0,R={checked:v,disabled:o,setChecked:b,control:N,setControl:k,name:i,form:l,value:x,hasConsumerStoppedPropagationRef:T,required:m,defaultChecked:nv(a)?!1:a,isFormControl:P,bubbleInput:M,setBubbleInput:E};return r.jsx(sft,{scope:t,...R,children:aft(y)?y(R):n})}var WDe="CheckboxTrigger",GDe=A.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:s,...n},a)=>{const{control:o,value:l,disabled:i,checked:u,required:m,setControl:x,setChecked:y,hasConsumerStoppedPropagationRef:v,isFormControl:b,bubbleInput:N}=Iye(WDe,e),k=ha(a,x),M=A.useRef(u);return A.useEffect(()=>{const E=o==null?void 0:o.form;if(E){const T=()=>y(M.current);return E.addEventListener("reset",T),()=>E.removeEventListener("reset",T)}},[o,y]),r.jsx($s.button,{type:"button",role:"checkbox","aria-checked":nv(u)?"mixed":u,"aria-required":m,"data-state":QDe(u),"data-disabled":i?"":void 0,disabled:i,value:l,...n,ref:k,onKeyDown:xs(t,E=>{E.key==="Enter"&&E.preventDefault()}),onClick:xs(s,E=>{y(T=>nv(T)?!0:!T),N&&b&&(v.current=E.isPropagationStopped(),v.current||E.stopPropagation())})})});GDe.displayName=WDe;var Pye=A.forwardRef((e,t)=>{const{__scopeCheckbox:s,name:n,checked:a,defaultChecked:o,required:l,disabled:i,value:u,onCheckedChange:m,form:x,...y}=e;return r.jsx(nft,{__scopeCheckbox:s,checked:a,defaultChecked:o,disabled:i,required:l,onCheckedChange:m,name:n,form:x,value:u,internal_do_not_use_render:({isFormControl:v})=>r.jsxs(r.Fragment,{children:[r.jsx(GDe,{...y,ref:t,__scopeCheckbox:s}),v&&r.jsx(XDe,{__scopeCheckbox:s})]})})});Pye.displayName=lae;var KDe="CheckboxIndicator",ZDe=A.forwardRef((e,t)=>{const{__scopeCheckbox:s,forceMount:n,...a}=e,o=Iye(KDe,s);return r.jsx(Ec,{present:n||nv(o.checked)||o.checked===!0,children:r.jsx($s.span,{"data-state":QDe(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});ZDe.displayName=KDe;var YDe="CheckboxBubbleInput",XDe=A.forwardRef(({__scopeCheckbox:e,...t},s)=>{const{control:n,hasConsumerStoppedPropagationRef:a,checked:o,defaultChecked:l,required:i,disabled:u,name:m,value:x,form:y,bubbleInput:v,setBubbleInput:b}=Iye(YDe,e),N=ha(s,b),k=hP(o),M=JI(n);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 q=new Event("click",{bubbles:U});T.indeterminate=nv(o),D.call(T,nv(o)?!1:o),T.dispatchEvent(q)}},[v,k,o,a]);const E=A.useRef(nv(o)?!1:o);return r.jsx($s.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??E.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%)"}})});XDe.displayName=YDe;function aft(e){return typeof e=="function"}function nv(e){return e==="indeterminate"}function QDe(e){return nv(e)?"indeterminate":e?"checked":"unchecked"}const bl=A.forwardRef(({className:e,...t},s)=>r.jsx(Pye,{ref:s,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(ZDe,{className:Ut("flex items-center justify-center text-current"),children:r.jsx(fi,{className:"h-4 w-4"})})}));bl.displayName=Pye.displayName;var Lye="Radio",[ift,JDe]=uc(Lye),[oft,lft]=ift(Lye),eRe=A.forwardRef((e,t)=>{const{__scopeRadio:s,name:n,checked:a=!1,required:o,disabled:l,value:i="on",onCheck:u,form:m,...x}=e,[y,v]=A.useState(null),b=ha(t,M=>v(M)),N=A.useRef(!1),k=y?m||!!y.closest("form"):!0;return r.jsxs(oft,{scope:s,checked:a,disabled:l,children:[r.jsx($s.button,{type:"button",role:"radio","aria-checked":a,"data-state":nRe(a),"data-disabled":l?"":void 0,disabled:l,value:i,...x,ref:b,onClick:xs(e.onClick,M=>{a||u==null||u(),k&&(N.current=M.isPropagationStopped(),N.current||M.stopPropagation())})}),k&&r.jsx(sRe,{control:y,bubbles:!N.current,name:n,value:i,checked:a,required:o,disabled:l,form:m,style:{transform:"translateX(-100%)"}})]})});eRe.displayName=Lye;var tRe="RadioIndicator",rRe=A.forwardRef((e,t)=>{const{__scopeRadio:s,forceMount:n,...a}=e,o=lft(tRe,s);return r.jsx(Ec,{present:n||o.checked,children:r.jsx($s.span,{"data-state":nRe(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:t})})});rRe.displayName=tRe;var cft="RadioBubbleInput",sRe=A.forwardRef(({__scopeRadio:e,control:t,checked:s,bubbles:n=!0,...a},o)=>{const l=A.useRef(null),i=ha(l,o),u=hP(s),m=JI(t);return A.useEffect(()=>{const x=l.current;if(!x)return;const y=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(y,"checked").set;if(u!==s&&b){const N=new Event("click",{bubbles:n});b.call(x,s),x.dispatchEvent(N)}},[u,s,n]),r.jsx($s.input,{type:"radio","aria-hidden":!0,defaultChecked:s,...a,tabIndex:-1,ref:i,style:{...a.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});sRe.displayName=cft;function nRe(e){return e?"checked":"unchecked"}var dft=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],cae="RadioGroup",[uft]=uc(cae,[L3,JDe]),aRe=L3(),iRe=JDe(),[hft,mft]=uft(cae),oRe=A.forwardRef((e,t)=>{const{__scopeRadioGroup:s,name:n,defaultValue:a,value:o,required:l=!1,disabled:i=!1,orientation:u,dir:m,loop:x=!0,onValueChange:y,...v}=e,b=aRe(s),N=Ik(m),[k,M]=ah({prop:o,defaultProp:a??null,onChange:y,caller:cae});return r.jsx(hft,{scope:s,name:n,required:l,disabled:i,value:k,onValueChange:M,children:r.jsx($xe,{asChild:!0,...b,orientation:u,dir:N,loop:x,children:r.jsx($s.div,{role:"radiogroup","aria-required":l,"aria-orientation":u,"data-disabled":i?"":void 0,dir:N,...v,ref:t})})})});oRe.displayName=cae;var lRe="RadioGroupItem",cRe=A.forwardRef((e,t)=>{const{__scopeRadioGroup:s,disabled:n,...a}=e,o=mft(lRe,s),l=o.disabled||n,i=aRe(s),u=iRe(s),m=A.useRef(null),x=ha(t,m),y=o.value===a.value,v=A.useRef(!1);return A.useEffect(()=>{const b=k=>{dft.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(Uxe,{asChild:!0,...i,focusable:!l,active:y,children:r.jsx(eRe,{disabled:l,required:o.required,checked:y,...u,...a,name:o.name,ref:x,onCheck:()=>o.onValueChange(a.value),onKeyDown:xs(b=>{b.key==="Enter"&&b.preventDefault()}),onFocus:xs(a.onFocus,()=>{var b;v.current&&((b=m.current)==null||b.click())})})})});cRe.displayName=lRe;var pft="RadioGroupIndicator",dRe=A.forwardRef((e,t)=>{const{__scopeRadioGroup:s,...n}=e,a=iRe(s);return r.jsx(rRe,{...a,...n,ref:t})});dRe.displayName=pft;var uRe=oRe,hRe=cRe,fft=dRe;const mRe=A.forwardRef(({className:e,...t},s)=>r.jsx(uRe,{className:Ut("grid gap-2",e),...t,ref:s}));mRe.displayName=uRe.displayName;const pRe=A.forwardRef(({className:e,...t},s)=>r.jsx(hRe,{ref:s,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(fft,{className:"flex items-center justify-center",children:r.jsx(sh,{className:"h-2.5 w-2.5 fill-current text-current"})})}));pRe.displayName=hRe.displayName;const gft=({brief:e,open:t,onClose:s,onDismiss:n})=>{const{user:a}=Yr(),[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:E}=await Y.from("levelup_brief_poll_responses").select("poll_id, option_id").eq("user_id",a.id).in("poll_id",M);if(E){const T={};E.forEach(P=>{T[P.poll_id]||(T[P.poll_id]=[]),T[P.poll_id].push(P.option_id)}),u(T)}},v=(M,E)=>{l(T=>({...T,[M]:E}))},b=(M,E,T)=>{l(P=>{const R=P[M]||[];return T?{...P,[M]:[...R,E]}:{...P,[M]:R.filter(D=>D!==E)}})},N=async M=>{if(!a)return;const E=o[M];if(!E||Array.isArray(E)&&E.length===0){Te.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(E)?E:[E],P=T.map(D=>({poll_id:M,option_id:D,user_id:a.id})),{error:R}=await Y.from("levelup_brief_poll_responses").insert(P);if(R)throw R;u(D=>({...D,[M]:T})),Te.success("Response submitted!")}catch(T){console.error("Error submitting poll response:",T),Te.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&&s(),children:r.jsxs(Pr,{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:s,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(en,{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(Pf,{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(Rr,{className:"text-xl font-bold text-white",children:e.brief.title})]})]})]}),r.jsx(Yo,{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(Sn,{className:"h-4 w-4"}),M.title]},M.id))})]}),e.polls.map(M=>{var P,R;const E=((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}),E&&r.jsxs(Tt,{variant:"secondary",className:"gap-1",children:[r.jsx(Ki,{className:"h-3 w-3"}),"Responded"]})]}),M.poll_type==="single"?r.jsx(mRe,{value:o[M.id]||((R=i[M.id])==null?void 0:R[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(pRe,{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 q=(o[M.id]||i[M.id]||[]).includes(D.id);return r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(bl,{id:D.id,checked:q,onCheckedChange:H=>b(M.id,D.id,H)}),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...":E?"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:s,className:"w-full max-w-xs",children:"Got it!"}),r.jsx(X,{variant:"ghost",size:"sm",onClick:n,children:"Don't show again"})]})]})})},xft=()=>{const{user:e}=Yr(),[t,s]=A.useState(null),[n,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(),[E,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 q of T.data){const{data:H}=await Y.from("levelup_brief_poll_options").select("*").eq("poll_id",q.id).order("sort_order");P.push({...q,options:H||[]})}const R={brief:N,links:E.data||[],polls:P};s(R);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 q=new Date(M.viewed_at);(new Date().getTime()-q.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:n,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 yft(){const[e,t]=A.useState(!1),[s,n]=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);n(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($i,{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"}),s?r.jsxs("p",{className:"text-xs opacity-80 flex items-center gap-1",children:["Tap ",r.jsx(MA,{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:[!s&&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(en,{className:"h-4 w-4"})})]})]})}):null}const vft=({children:e,onRefresh:t})=>{const[s,n]=A.useState(!1),[a,o]=A.useState(0),[l,i]=A.useState(!1),u=A.useRef(null),m=A.useRef(0),x=Br(),y=80,v=120,b=A.useCallback(T=>{const P=u.current;P&&P.scrollTop<=0&&(m.current=T.touches[0].clientY,n(!0))},[]),N=A.useCallback(T=>{if(!s||l)return;const P=u.current;if(!P||P.scrollTop>0){n(!1),o(0);return}const D=T.touches[0].clientY-m.current;if(D>0){const q=Math.min(D*.5,v);o(q),q>10&&T.preventDefault()}},[s,l]),k=A.useCallback(async()=>{if(s)if(n(!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)},[s,a,l,t,x]),M=Math.min(a/y,1),E=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(${E}deg)`,transition:l?void 0:"transform 0.1s ease-out"},children:r.jsx(Go,{className:"h-5 w-5 text-primary"})})}),r.jsx("div",{style:{transform:a>0?`translateY(${Math.max(0,a-60)}px)`:void 0,transition:s?void 0:"transform 0.2s ease-out"},children:e})]})},fRe=()=>{const{user:e}=Yr(),[t,s]=A.useState(!1),[n,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),s(!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");s(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"),s(!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),s(!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:n,loginCount:o,isLoading:i,dismissPrompt:m,submitReview:x,markPostedToGoogle:y}},_ft="https://search.google.com/local/writereview?placeid=ChIJM73ERQD1QogRPxupMFObuck&source=g.page.m.ia._&laa=nmx-review-solicitation-ia2",bft=()=>{const{shouldShowPrompt:e,isLoading:t,dismissPrompt:s,submitReview:n,markPostedToGoogle:a}=fRe(),[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),[E,T]=A.useState(!1);if(t||!e&&!E)return null;const P=async()=>{if(m===0){Wn({title:"Please select a rating",variant:"destructive"});return}M(!0);const U=await n(m,b);M(!1),U.success?(T(!0),Wn({title:"Thank you for your feedback!",description:"Your review helps us improve."}),u("google")):Wn({title:"Error submitting review",description:U.error,variant:"destructive"})},R=async U=>{U&&(await navigator.clipboard.writeText(b||`${m} star rating for LevelUp!`),Wn({title:"Review copied!",description:"Paste it on Google Reviews."}),await a(),window.open(_ft,"_blank")),l(!1),s()},D=()=>{l(!1),s()};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(Mn,{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(Pr,{className:"sm:max-w-md",children:i==="review"?r.jsxs(r.Fragment,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{className:"text-center",children:"How are you enjoying LevelUp?"}),r.jsx(Zs,{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(Mn,{className:Ut("h-8 w-8 transition-colors",(y||m)>=U?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},U))}),r.jsx(Ys,{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(Rr,{className:"text-center",children:"🎉 Thank you!"}),r.jsx(Zs,{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:()=>R(!1),className:"flex-1",children:"No Thanks"}),r.jsx(X,{onClick:()=>R(!0),className:"flex-1",children:"Yes, Open Google"})]})]})]})})})]})};function wft(e){const t="=".repeat((4-e.length%4)%4),s=(e+t).replace(/-/g,"+").replace(/_/g,"/"),n=window.atob(s),a=new Uint8Array(n.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:R}=await Y.functions.invoke("get-vapid-public-key",{body:{}});if(R)throw R;if(M=(P==null?void 0:P.vapidPublicKey)??null,!M)throw new Error("Missing VAPID public key");localStorage.setItem(k,M)}x(M);const E=await navigator.serviceWorker.register("/push-sw.js");u(E),s(Notification.permission);const T=await E.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 Te.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(R){console.warn("Failed to unsubscribe existing push subscription:",R)}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(s(P),P!=="granted")return P==="denied"?Te.error("Notifications blocked. Please enable them in your browser settings (click the lock icon in the address bar)."):Te.error("Notification permission was dismissed. Please try again."),!1}const k=wft(m);let M;try{M=await i.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:k})}catch(P){console.error("PushManager.subscribe() failed:",P);const R=(P==null?void 0:P.message)||String(P);return R.includes("permission")?Te.error("Push permission denied. Check your browser notification settings."):R.includes("key")||R.includes("VAPID")?Te.error("Push configuration error. Please contact support."):R.includes("AbortError")?Te.error("Push subscription was cancelled. Please try again."):Te.error(`Failed to subscribe: ${R}`),!1}const E=M.toJSON(),{error:T}=await Y.from("push_subscriptions").upsert({user_id:e.id,endpoint:E.endpoint,p256dh_key:E.keys.p256dh,auth_key:E.keys.auth},{onConflict:"user_id,endpoint"});if(T)throw console.error("Error saving subscription:",T),Te.error("Failed to save notification preferences. Please try again."),T;return a(!0),Te.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";Te.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),Te.success("Push notifications disabled"),!0}catch(N){console.error("Error unsubscribing:",N);const k=N instanceof Error?N.message:"Unknown error";return Te.error("Failed to disable push notifications: "+k),!1}finally{l(!1)}},[i,e]);return{isSupported:y,permission:t,isSubscribed:n,isLoading:o,vapidPublicKey:m,subscribe:v,unsubscribe:b}}const UNe="push_notification_prompt_dismissed",jft=()=>{const{user:e}=Yr(),{isSupported:t,isSubscribed:s,isLoading:n,subscribe:a}=gRe(),[o,l]=A.useState(!1),[i,u]=A.useState(!1);A.useEffect(()=>{if(!e||!t||s||n||localStorage.getItem(`${UNe}_${e.id}`))return;const v=setTimeout(()=>{l(!0)},2e3);return()=>clearTimeout(v)},[e,t,s,n]);const m=async()=>{u(!0);const y=await a();u(!1),y&&l(!1)},x=()=>{e&&localStorage.setItem(`${UNe}_${e.id}`,"true"),l(!1)};return!t||s?null:r.jsx(Or,{open:o,onOpenChange:y=>!y&&x(),children:r.jsxs(Pr,{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(Rg,{className:"h-6 w-6 text-primary"})}),r.jsx(Rr,{className:"text-center",children:"Stay in the Loop!"}),r.jsx(Zs,{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."})]})})},qNe=e=>{let t;const s=new Set,n=(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),s.forEach(b=>b(t,v))}},a=()=>t,i={setState:n,getState:a,getInitialState:()=>u,subscribe:m=>(s.add(m),()=>s.delete(m))},u=t=e(n,a,i);return i},kft=e=>e?qNe(e):qNe,Nft=e=>e;function Sft(e,t=Nft){const s=ut.useSyncExternalStore(e.subscribe,ut.useCallback(()=>t(e.getState()),[e,t]),ut.useCallback(()=>t(e.getInitialState()),[e,t]));return ut.useDebugValue(s),s}const Cft=e=>{const t=kft(e),s=n=>Sft(t,n);return Object.assign(s,t),s},Mft=e=>Cft;function Tft(e,t){let s;try{s=e()}catch{return}return{getItem:a=>{var o;const l=u=>u===null?null:JSON.parse(u,void 0),i=(o=s.getItem(a))!=null?o:null;return i instanceof Promise?i.then(l):l(i)},setItem:(a,o)=>s.setItem(a,JSON.stringify(o,void 0)),removeItem:a=>s.removeItem(a)}}const Eme=e=>t=>{try{const s=e(t);return s instanceof Promise?s:{then(n){return Eme(n)(s)},catch(n){return this}}}catch(s){return{then(n){return this},catch(n){return Eme(n)(s)}}}},Aft=(e,t)=>(s,n,a)=>{let o={storage:Tft(()=>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.`),s(...k)},n,a);const x=()=>{const k=o.partialize({...n()});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)=>(s(...k),x()),n,a);a.getInitialState=()=>v;let b;const N=()=>{var k,M;if(!m)return;l=!1,i.forEach(T=>{var P;return T((P=n())!=null?P:v)});const E=((M=o.onRehydrateStorage)==null?void 0:M.call(o,(k=n())!=null?k:v))||void 0;return Eme(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(R=>[!0,R]):[!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[R,D]=T;if(b=o.merge(D,(P=n())!=null?P:v),s(b,!0),R)return x()}).then(()=>{E==null||E(b,void 0),b=n(),l=!0,u.forEach(T=>T(b))}).catch(T=>{E==null||E(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},Eft=Aft,dae=Mft()(Eft((e,t)=>({cartItems:[],addToCart:(s,n,a=1,o)=>{e(l=>{const i=l.cartItems.findIndex(u=>{var m;return u.product.id===s.id&&((m=u.variant)==null?void 0:m.id)===(n==null?void 0:n.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:s,variant:n,quantity:a,artworkUrl:o}]}})},removeFromCart:(s,n)=>{e(a=>({cartItems:a.cartItems.filter(o=>{var l;return!(o.product.id===s&&((l=o.variant)==null?void 0:l.id)===n)})}))},updateQuantity:(s,n,a)=>{e(o=>({cartItems:o.cartItems.map(l=>{var i;return l.product.id===s&&((i=l.variant)==null?void 0:i.id)===n?{...l,quantity:Math.max(1,a)}:l})}))},updateArtwork:(s,n,a)=>{e(o=>({cartItems:o.cartItems.map(l=>{var i;return l.product.id===s&&((i=l.variant)==null?void 0:i.id)===n?{...l,artworkUrl:a}:l})}))},clearCart:()=>e({cartItems:[]}),getItemPrice:s=>{const n=Number(s.product.base_price),a=s.variant?Number(s.variant.price_adjustment):0;return n+a},getSubtotal:()=>{const{cartItems:s,getItemPrice:n}=t();return s.reduce((a,o)=>a+n(o)*o.quantity,0)},getShippingTotal:()=>{const{cartItems:s}=t();return s.reduce((n,a)=>n+Number(a.product.shipping_fee)*a.quantity,0)},getTotal:()=>{const{getSubtotal:s,getShippingTotal:n}=t();return s()+n()}}),{name:"marketplace-cart",partialize:e=>({cartItems:e.cartItems})})),xRe=A.createContext({onlineUsers:[],totalOnline:0}),Ift=async e=>{try{const{data:t}=await Y.storage.from("avatars").list(`${e}`);if(t&&t.length>0){const{data:s}=Y.storage.from("avatars").getPublicUrl(`${e}/${t[0].name}`);return s.publicUrl}}catch{}},Pft=({children:e})=>{const{user:t,brokerageId:s,isAdmin:n}=Yr(),[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 Ift(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:!!(n||s&&m.brokerageId===s||!s&&!m.brokerageId));return r.jsx(xRe.Provider,{value:{onlineUsers:u,totalOnline:a.length},children:e})},yRe=()=>A.useContext(xRe),VNe="dashboard-sidebar-collapsed",Dr=({children:e,title:t})=>{var tt,Ae,Le;const{user:s,signOut:n,isAdmin:a,isBrokerageManager:o,brokerageId:l}=Yr(),{isAssistant:i,actingAsAgent:u}=zxe(),{isImpersonating:m}=Fxe(),y=(i&&!!u?40:0)+(m?40:0),{avatarUrl:v}=rDe(s==null?void 0:s.id),{isTrial:b,isExpired:N,expiresAt:k}=Mmt(s==null?void 0:s.id),{isMarketplaceEnabled:M}=nDe(),{currentBrief:E,shouldShowPopup:T,hasUnseenBrief:P,openBrief:R,closeBrief:D,dismissBrief:U}=xft(),{unreadCount:q}=Tmt(),{openCount:H}=Amt(),Q=dae(Ue=>Ue.cartItems).reduce((Ue,Pe)=>Ue+Pe.quantity,0),ne=Hs(),ie=Em(),[he,se]=A.useState(()=>typeof window<"u"?localStorage.getItem(VNe)==="true":!1);A.useEffect(()=>{localStorage.setItem(VNe,String(he))},[he]);const[fe,oe]=A.useState({agentos:!0,tools:!0,marketing:!0,learning:!0,community:!0,help:!1}),ce=Ue=>{oe(Pe=>({...Pe,[Ue]:!Pe[Ue]}))},de=Ue=>Ue.split(" ").map(Pe=>Pe[0]).join("").toUpperCase().slice(0,2),xe=Ue=>ie.pathname===Ue,Me=Ue=>Ue.some(Pe=>ie.pathname===Pe),ve=({path:Ue,icon:Pe,label:$e,badgeCount:it})=>{const xt=r.jsxs(X,{variant:"ghost",size:"sm",className:Ut("text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground relative",xe(Ue)&&"bg-sidebar-accent text-sidebar-accent-foreground",he?"w-10 h-10 p-0 justify-center":"w-full justify-start gap-2"),onClick:()=>ne(Ue),children:[r.jsxs("div",{className:"relative",children:[r.jsx(Pe,{className:"h-4 w-4 shrink-0"}),he&&it!=null&&it>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-muted-foreground/40 border border-background"})]}),!he&&$e,!he&&it!=null&&it>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:it>9?"9+":it})]});return he?r.jsxs(Gg,{delayDuration:0,children:[r.jsx(Kg,{asChild:!0,children:xt}),r.jsxs(Of,{side:"right",className:"flex items-center gap-2",children:[$e,it!=null&&it>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:it>9?"9+":it})]})]}):xt},be=({id:Ue,label:Pe,icon:$e,children:it,activePaths:xt,showBetaBadge:Ee,defaultPath:et,badgeCount:le})=>{if(he){const Ve=et||xt[0];return r.jsxs(Gg,{delayDuration:0,children:[r.jsx(Kg,{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",Me(xt)&&"text-primary"),onClick:()=>ne(Ve),children:r.jsxs("div",{className:"relative",children:[r.jsx($e,{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(Of,{side:"right",className:"flex items-center gap-2",children:[Pe,Ee&&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(XS,{open:fe[Ue],onOpenChange:()=>ce(Ue),children:[r.jsx(QS,{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",Me(xt)&&"text-primary"),children:[r.jsxs("span",{className:"flex items-center gap-2 font-semibold text-[15px]",children:[r.jsx($e,{className:"h-4 w-4"}),Pe,Ee&&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(gd,{className:Ut("h-4 w-4 transition-transform duration-200",fe[Ue]&&"rotate-180")})]})]})}),r.jsx(JS,{className:"pl-4 space-y-1 mt-1",children:it})]})},we=({isMobile:Ue=!1})=>{const Pe=Ue?!1:he;return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:Ut("p-3 border-b border-sidebar-border",Pe?"flex flex-col items-center gap-2":"flex items-center justify-between"),children:[Pe?r.jsx("img",{src:Qmt,alt:"LevelUp",className:"h-8 w-auto"}):r.jsx("img",{src:Xmt,alt:"LevelUp",className:"h-8 w-auto"}),!Ue&&r.jsxs(Gg,{delayDuration:0,children:[r.jsx(Kg,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",onClick:()=>se(!Pe),children:r.jsx(Sc,{className:Ut("h-4 w-4 transition-transform duration-300",Pe&&"rotate-180")})})}),r.jsx(Of,{side:"right",children:Pe?"Expand sidebar":"Collapse sidebar"})]})]}),r.jsx(Yo,{className:"flex-1",children:r.jsxs("nav",{className:Ut("p-3 space-y-1",Pe&&"flex flex-col items-center"),children:[r.jsx(ve,{path:"/dashboard",icon:Bj,label:"Dashboard"}),r.jsx(ve,{path:"/events",icon:Af,label:"Events"}),r.jsxs(be,{id:"agentos",label:"Agent OS",icon:SS,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(ve,{path:"/mission-control",icon:bi,label:"Mission Control"}),r.jsx(ve,{path:"/mission-control/contacts",icon:qs,label:"Contacts"}),r.jsx(ve,{path:"/mission-control/plans",icon:Af,label:"TouchPlans"}),r.jsx(ve,{path:"/mission-control/pipeline",icon:hy,label:"Deal Pipeline"}),r.jsx(ve,{path:"/mission-control/popbys",icon:oo,label:"Popbys"}),r.jsx(ve,{path:"/mission-control/video-library",icon:Ta,label:"Video Library"}),r.jsx(ve,{path:"/mission-control/scorecard",icon:wc,label:"Scorecard"}),r.jsx(ve,{path:"/mission-control/listings",icon:pi,label:"Listing Exchange"})]}),r.jsxs(be,{id:"tools",label:"Tools",icon:sm,activePaths:["/apps","/ai-toolkit","/mission-control/my-card","/mission-control/presentations","/mission-control/guest-book"],defaultPath:"/apps",children:[r.jsx(ve,{path:"/apps",icon:sm,label:"Apps"}),!Pe&&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:()=>ne("/mission-control/my-card"),children:[r.jsx(mp,{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"})]}),Pe&&r.jsx(ve,{path:"/mission-control/my-card",icon:mp,label:"Digital Card"}),!Pe&&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",ie.pathname.startsWith("/mission-control/presentations")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>ne("/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"})]}),Pe&&r.jsx(ve,{path:"/mission-control/presentations",icon:gy,label:"Smart Presentations"}),!Pe&&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/guest-book")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>ne("/mission-control/guest-book"),children:[r.jsx(q1,{className:"h-4 w-4"}),"Guest Book",r.jsx("span",{className:"ml-auto 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"})]}),Pe&&r.jsx(ve,{path:"/mission-control/guest-book",icon:q1,label:"Guest Book"})]}),r.jsxs(be,{id:"marketing",label:"Marketing",icon:Pf,activePaths:["/templates","/social-swag-2","/newsletters"],defaultPath:"/templates",children:[r.jsx(ve,{path:"/templates",icon:Wc,label:"Templates"}),r.jsx(ve,{path:"/social-swag-2",icon:xy,label:"Social Swag"}),r.jsx(ve,{path:"/newsletters",icon:fy,label:"Newsletters"})]}),r.jsxs(be,{id:"learning",label:"Learning",icon:q1,activePaths:["/academy","/toolbox"],defaultPath:"/academy",children:[r.jsx(ve,{path:"/academy",icon:K1,label:"Academy"}),r.jsx(ve,{path:"/toolbox",icon:vy,label:"Toolbox"})]}),r.jsxs(be,{id:"community",label:"Community",icon:Bo,activePaths:["/community","/wishlist"],defaultPath:"/community",badgeCount:q,children:[r.jsx(ve,{path:"/community",icon:qs,label:"Community",badgeCount:q}),r.jsx(ve,{path:"/wishlist",icon:my,label:"Wishlist",badgeCount:H}),!Pe&&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(Sn,{className:"h-4 w-4"}),"Facebook Group"]})]}),r.jsxs(be,{id:"goods",label:"The Goods",icon:Ih,activePaths:["/marketplace","/reward-store"],defaultPath:"/reward-store",children:[M&&!Pe&&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",ie.pathname.startsWith("/marketplace")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>ne("/marketplace"),children:[r.jsx(Ih,{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&&Pe&&r.jsx(ve,{path:"/marketplace",icon:Ih,label:"Marketplace"}),r.jsx(ve,{path:"/reward-store",icon:lo,label:"Reward Store"})]}),r.jsxs(be,{id:"help",label:"Help & Services",icon:Zx,activePaths:["/support","/additional-services"],defaultPath:"/support",children:[r.jsx(ve,{path:"/support",icon:PS,label:"Support"}),r.jsx(ve,{path:"/additional-services",icon:Bn,label:"Additional Services"})]}),a&&r.jsxs(r.Fragment,{children:[!Pe&&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"})}),Pe?r.jsx("div",{className:"pt-3 border-t border-sidebar-border mt-3 space-y-1",children:r.jsx(ve,{path:"/admin",icon:nh,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",ie.pathname==="/admin"&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>ne("/admin"),children:[r.jsx(nh,{className:"h-4 w-4"}),"Admin Dashboard"]})]}),(l||o)&&!a&&r.jsxs(r.Fragment,{children:[!Pe&&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"})}),Pe?r.jsxs("div",{className:"border-t border-sidebar-border mt-3 pt-3 space-y-1",children:[l&&r.jsx(ve,{path:"/my-brokerage",icon:pi,label:"My Brokerage"}),o&&r.jsxs(r.Fragment,{children:[r.jsx(ve,{path:"/brokerage/dashboard",icon:Bd,label:"Manage Brokerages"}),r.jsx(ve,{path:"/brokerage-resources",icon:rh,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:()=>ne("/my-brokerage"),children:[r.jsx(pi,{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:()=>ne("/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:()=>ne("/brokerage-resources"),children:[r.jsx(rh,{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:()=>ne("/profile"),children:[r.jsx(oc,{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:n,children:[r.jsx(DS,{className:"h-4 w-4"}),"Sign Out"]})]})]})};return r.jsx(Pft,{children:r.jsx(sP,{children:r.jsxs("div",{className:"min-h-screen bg-background flex",children:[b&&N&&r.jsx(eft,{}),typeof document<"u"&&Eh.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",he?"w-16":"w-52"),style:{top:`${y}px`,height:`calc(100vh - ${y}px)`},children:r.jsx(we,{})}),document.body),r.jsxs("div",{className:Ut("flex-1 flex flex-col overflow-hidden transition-all duration-300",he?"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(Zne,{children:[r.jsx(fye,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"md:hidden",children:r.jsx(fA,{className:"h-5 w-5"})})}),r.jsx(mP,{side:"left",className:"w-52 p-0 bg-card",children:r.jsx(we,{isMobile:!0})})]}),r.jsx("div",{className:"flex-1 md:hidden",children:r.jsx("img",{src:Jmt,alt:"LevelUp",className:"h-8 w-auto"})}),r.jsx("div",{className:"hidden md:flex flex-1 justify-center",children:r.jsx($Ne,{})}),r.jsxs("div",{className:"flex items-center gap-3 ml-auto",children:[b&&!N&&k&&r.jsx(Jpt,{expiresAt:k,className:"hidden lg:flex"}),r.jsx("div",{className:"md:hidden",children:r.jsx($Ne,{})}),E&&r.jsx(tft,{hasUnseenBrief:P,onClick:R}),M&&r.jsxs(X,{variant:"ghost",size:"icon",className:"relative",onClick:()=>ne("/marketplace/cart"),children:[r.jsx(Ih,{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(Npt,{}),r.jsx(Mme,{}),r.jsxs("span",{className:"hidden sm:block text-sm font-medium text-foreground",children:["Hello, ",((Ae=(tt=s==null?void 0:s.user_metadata)==null?void 0:tt.name)==null?void 0:Ae.split(" ")[0])||"User","!"]}),r.jsxs(uh,{children:[r.jsx(hh,{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(Xn,{className:"h-9 w-9 cursor-pointer hover:opacity-80 transition-opacity",children:[r.jsx(ji,{src:v||void 0}),r.jsx(Qn,{className:"bg-primary text-primary-foreground font-medium text-sm",children:de(((Le=s==null?void 0:s.user_metadata)==null?void 0:Le.name)||(s==null?void 0:s.email)||"U")})]})})}),r.jsxs(Cu,{align:"end",className:"w-48",children:[r.jsxs(Wa,{onClick:()=>ne("/profile"),className:"cursor-pointer",children:[r.jsx(oc,{className:"h-4 w-4 mr-2"}),"Profile"]}),r.jsxs(Wa,{onClick:()=>ne("/mission-control/integrations"),className:"cursor-pointer",children:[r.jsx(wA,{className:"h-4 w-4 mr-2"}),"Integrations"]}),r.jsx(dk,{}),r.jsxs(Wa,{onClick:n,className:"cursor-pointer text-destructive focus:text-destructive",children:[r.jsx(DS,{className:"h-4 w-4 mr-2"}),"Sign Out"]})]})]})]})]})}),r.jsx(vft,{children:r.jsx("main",{className:"p-4 sm:p-6 lg:p-8 overflow-x-hidden",children:e})}),E&&r.jsx(gft,{brief:E,open:T,onClose:D,onDismiss:U}),r.jsx(yft,{}),r.jsx(bft,{}),r.jsx(jft,{})]})]})})})},Lft=()=>{const{user:e}=Yr(),[t,s]=A.useState(!1),[n,a]=A.useState(null),[o,l]=A.useState(""),i=async y=>{var v;if(!(e!=null&&e.email)){Te.error("Please sign in to upgrade");return}s(!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"),Te.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(b){console.error("Checkout error:",b),Te.error(b.message||"Failed to start checkout. Please try again.")}finally{s(!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(ot,{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(Vt,{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(qs,{className:"h-7 w-7 text-primary"})}),r.jsx(Gt,{className:"text-xl",children:"Individual Agent"}),r.jsx(Ns,{children:"Perfect for solo agents ready to level up"})]}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("span",{className:"text-4xl font-bold text-primary",children:"$39"}),r.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),r.jsx("ul",{className:"space-y-2",children: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&&n==="individual_agent"?r.jsx(Vr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(Bn,{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(Vt,{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(pi,{className:"h-7 w-7 text-amber-600"})}),r.jsx(Gt,{className:"text-xl",children:"Brokerage"}),r.jsx(Ns,{children:"For teams and brokerages up to 25 agents"})]}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("span",{className:"text-4xl font-bold text-amber-600",children:"$299"}),r.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),r.jsx("ul",{className:"space-y-2",children: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&&n==="brokerage_under_25"?r.jsx(Vr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(pi,{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(Vt,{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(pi,{className:"h-7 w-7 text-purple-600"})}),r.jsx(Gt,{className:"text-xl",children:"Brokerage 25+"}),r.jsx(Ns,{children:"For larger brokerages with 25+ agents"})]}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("span",{className:"text-4xl font-bold text-purple-600",children:"$499"}),r.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),r.jsx("ul",{className:"space-y-2",children:x.map((y,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&&n==="brokerage_over_25"?r.jsx(Vr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(pi,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]})]}),r.jsx(He,{className:"bg-muted/50",children:r.jsxs(Xe,{className:"py-6",children:[r.jsx("p",{className:"text-center font-medium mb-4",children:"Questions? We're here to help!"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsxs("a",{href:"tel:1-866-527-8668",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[r.jsx(Pi,{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(Nn,{className:"h-4 w-4"}),r.jsx("span",{children:"support@relevelup.com"})]})]})]})})]})})},Oft=()=>{const{user:e,loading:t,isBrokerageManager:s,brokerageId:n}=Yr(),a=Hs(),[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&&n&&a("/profile?setup=true")},[e,t,n,a]);const y=async()=>{if(!o.trim()){Te.error("Please enter a brokerage name");return}const{data:v}=await Y.auth.getSession(),b=v.session;if(!e||!b){Te.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),Te.success("Brokerage created! Setting up your account..."),setTimeout(()=>{a("/profile?setup=true")},2e3)}catch(N){console.error("Error creating brokerage:",N),Te.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(Vt,{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(Vr,{className:"w-10 h-10 text-primary animate-spin"})}),r.jsx(Gt,{className:"text-2xl",children:"Setting Up Your Brokerage"}),r.jsx(Ns,{className:"text-lg",children:"We're assigning you as the brokerage manager and preparing your dashboard..."})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[r.jsx(ii,{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(Vr,{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(Vt,{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(pi,{className:"w-10 h-10 text-primary"})}),r.jsx(Gt,{className:"text-2xl",children:"Set Up Your Brokerage"}),r.jsx(Ns,{className:"text-lg",children:"Create your brokerage to start managing your team"})]}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"brokerage-name",children:"Brokerage Name"}),r.jsx(ot,{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(qs,{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(ii,{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(ii,{className:"w-4 h-4 text-green-500"}),"Access exclusive brokerage resources"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(ii,{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(ii,{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(to,{className:"w-4 h-4 ml-2"})]})]})]})})},HNe=()=>{const e=Hs(),[t,s]=A.useState("verifying"),[n,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"),s("already_claimed");return}console.log("User logged in successfully:",i.user.email),s("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(()=>{s("already_claimed")},2e3)}catch(i){console.error("Claim error:",i),s("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(Vt,{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(Ns,{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"&&n]})]}),(t==="already_claimed"||t==="error")&&r.jsx(Xe,{children:r.jsx(X,{onClick:o,className:"w-full",children:"Go to Login"})})]})})},Dft=()=>{const e=Hs(),[t]=Ic(),[s,n]=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,E]=A.useState(!1),[T,P]=A.useState(null),[R,D]=A.useState(null),[U,q]=A.useState(null),[H,G]=A.useState(null);A.useEffect(()=>{const he=t.get("code");he&&(n(he),Q(he))},[t]);const Q=async he=>{k(!0);const{data:se,error:fe}=await Y.from("invite_codes").select("id, code, max_uses, uses_count, expires_at, is_active, brokerage_id, trial_days").eq("code",he.toUpperCase().trim()).single();if(fe||!se){Te.error("Invalid invite code"),k(!1);return}if(!se.is_active){Te.error("This invite code is no longer active"),k(!1);return}if(se.max_uses&&se.uses_count>=se.max_uses){Te.error("This invite code has reached its maximum uses"),k(!1);return}if(se.expires_at&&new Date(se.expires_at){he.preventDefault(),Q(s)},ie=async he=>{var se;if(he.preventDefault(),!u.trim()){Te.error("Please enter your name");return}if(l.length<6){Te.error("Password must be at least 6 characters");return}b(!0);try{const fe=`${window.location.origin}/`,{data:oe,error:ce}=await Y.auth.signUp({email:a.trim(),password:l,options:{emailRedirectTo:fe,data:{name:u.trim()}}});if(ce){ce.message.includes("already registered")?Te.error("This email is already registered. Please sign in instead."):Te.error(ce.message);return}oe.user&&(await Y.rpc("add_default_signup_tag",{user_id:oe.user.id}),R?await Y.functions.invoke("assign-brokerage",{body:{userId:oe.user.id,brokerageId:R}}):H?await Y.functions.invoke("assign-brokerage",{body:{userId:oe.user.id,trialDays:H}}):await Y.functions.invoke("assign-brokerage",{body:{userId:oe.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),Te.success("Account created! You can now access the dashboard."),e("/dashboard"))}catch(fe){console.error("Signup error:",fe),Te.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(Vt,{className:"text-center",children:[r.jsx(Gt,{className:"text-2xl font-bold text-primary",children:U?`Join ${U}`:"Join LevelUp"}),r.jsx(Ns,{children:M?U?`Create your account to join ${U}`:"Create your account to get started":"Enter your invite code to continue"})]}),r.jsx(Xe,{children:M?r.jsxs("form",{onSubmit:ie,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"name",children:"Full Name"}),r.jsx(ot,{id:"name",type:"text",placeholder:"John Doe",value:u,onChange:he=>m(he.target.value),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"email",children:"Email"}),r.jsx(ot,{id:"email",type:"email",placeholder:"you@example.com",value:a,onChange:he=>o(he.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(ot,{id:"password",type:x?"text":"password",placeholder:"••••••••",value:l,onChange:he=>i(he.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(Ef,{className:"h-4 w-4"}):r.jsx(mo,{className:"h-4 w-4"})})]})]}),r.jsx(X,{type:"submit",className:"w-full",disabled:v,children:v?r.jsxs(r.Fragment,{children:[r.jsx(Vr,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating Account..."]}):"Create Account"})]}):r.jsxs("form",{onSubmit:ne,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"inviteCode",children:"Invite Code"}),r.jsx(ot,{id:"inviteCode",type:"text",placeholder:"Enter your invite code",value:s,onChange:he=>n(he.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(Vr,{className:"mr-2 h-4 w-4 animate-spin"}),"Verifying..."]}):"Verify Code"})]})})]})})},Rft="/assets/testimonial-avatar-1-BsCQFauB.jpg",Fft="/assets/testimonial-avatar-2-B6VPVc2t.jpg",zft="/assets/testimonial-avatar-3-GuEFwYUE.jpg",Bft="/assets/testimonial-avatar-4-98iKMtkB.jpg",$ft="/assets/testimonial-avatar-5-ZsZfyxMX.jpg",Uft=[Rft,Fft,zft,Bft,$ft],qft=Ev({name:Oo().trim().min(2,"Name must be at least 2 characters").max(100),email:Oo().trim().email("Please enter a valid email address").max(255),phone:Oo().trim().min(10,"Please enter a valid phone number").max(20).optional().or($C("")),brokerage:Oo().trim().max(200).optional().or($C(""))}),Vft=[{icon:ap,title:"Academy Training",description:"Access a library of on-demand video training covering lead generation, marketing, technology, and more."},{icon:Wc,title:"300+ Templates",description:"Professional Canva templates for social media, flyers, postcards, and marketing materials."},{icon:jn,title:"Live Events",description:"Weekly live training sessions, workshops, and Q&A events with industry experts."},{icon:ql,title:"Agent Community",description:"Connect with fellow agents, share wins, ask questions, and network in our private community."},{icon:ga,title:"Resource Kits",description:"Downloadable toolkits with scripts, checklists, guides, and everything you need to close more deals."},{icon:oo,title:"Social Swag",description:"Fresh social media content and designs updated regularly to help you stand out online."}],Hft=[{icon:qs,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:Bn,title:"Smart TouchPlans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:Pi,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:po,title:"Pop-by Map",description:"See all your contacts on a map and plan efficient pop-by routes in your area."},{icon:wc,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:Hg,title:"Daily Action Cards",description:"Wake up to a prioritized list of exactly who to reach out to today."}],Wft=[{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."}],Gft=()=>{const e=Hs(),[t,s]=A.useState(!1),[n,a]=A.useState({name:"",email:"",phone:"",brokerage:""}),[o,l]=A.useState({}),i=async u=>{var x,y;u.preventDefault(),l({});const m=qft.safeParse(n);if(!m.success){const v={};m.error.errors.forEach(b=>{b.path[0]&&(v[b.path[0]]=b.message)}),l(v);return}s(!0);try{const{data:v,error:b}=await Y.functions.invoke("create-trial-signup",{body:{name:n.name.trim(),email:n.email.trim().toLowerCase(),phone:((x=n.phone)==null?void 0:x.trim())||void 0,brokerage:((y=n.brokerage)==null?void 0:y.trim())||void 0}});if(b){console.error("Trial signup error:",b),Te.error(b.message||"Something went wrong. Please try again.");return}if(v!=null&&v.error){Te.error(v.error);return}Te.success("🎉 Welcome aboard! Check your email to claim your account."),e("/trial/success")}catch(v){console.error("Trial signup error:",v),Te.error("Something went wrong. Please try again.")}finally{s(!1)}};return r.jsxs(r.Fragment,{children:[r.jsxs(Bh,{children:[r.jsx("title",{children:"Start Your Free 7-Day Trial | LevelUp Dashboard"}),r.jsx("meta",{name:"description",content:"Take LevelUp for a free 7-day test drive. No credit card required. The all-in-one platform for real estate agents and brokerages."}),r.jsx("meta",{property:"og:title",content:"Start Your Free 7-Day Trial | LevelUp"}),r.jsx("meta",{property:"og:description",content:"Take LevelUp for a free 7-day test drive. No credit card required."}),r.jsx("meta",{property:"og:type",content:"website"})]}),r.jsxs("div",{className:"min-h-screen bg-background overflow-hidden",children:[r.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-[#4a6b6d] shadow-md",children:r.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("img",{src:Qte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[r.jsx(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(Bn,{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(Ki,{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(Ki,{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:Uft.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(Mn,{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(Xe,{className:"p-8",children:[r.jsxs("div",{className:"text-center mb-8",children:[r.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-[#4a6b6d] mb-4",children:r.jsx($g,{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(ot,{id:"name",type:"text",placeholder:"John Smith",value:n.name,onChange:u=>a({...n,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(ot,{id:"email",type:"email",placeholder:"john@example.com",value:n.email,onChange:u=>a({...n,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(ot,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:n.phone,onChange:u=>a({...n,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(ot,{id:"brokerage",type:"text",placeholder:"Your brokerage or team name",value:n.brokerage,onChange:u=>a({...n,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(Vr,{className:"mr-2 h-5 w-5 animate-spin"}),"Creating Your Account..."]}):r.jsxs(r.Fragment,{children:["Start My Free Trial",r.jsx(to,{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:Vft.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(Vt,{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(Xe,{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(Bn,{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:Hft.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(Vt,{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(Xe,{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:Wft.map((u,m)=>r.jsx(He,{className:"border hover:shadow-lg transition-shadow",children:r.jsxs(Xe,{className:"p-6",children:[r.jsx("div",{className:"flex gap-1 mb-4",children:[1,2,3,4,5].map(x=>r.jsx(Mn,{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(bm,{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(Hg,{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(qs,{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(Xe,{className:"p-12 text-center relative",children:[r.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-white mb-4 font-sans",children:"Ready to Level Up Your Business?"}),r.jsx("p",{className:"text-xl text-white/80 mb-8 max-w-2xl mx-auto",children:"Join thousands of successful agents. Start your free 7-day trial today."}),r.jsxs(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(to,{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:tye,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."})]})})})]})]})},Kft=()=>{const e=Hs();return r.jsxs(r.Fragment,{children:[r.jsx(Bh,{children:r.jsx("title",{children:"Welcome to LevelUp! | Check Your Email"})}),r.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[r.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-[#4a6b6d] shadow-md",children:r.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("img",{src:Qte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsx(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(Xe,{className:"p-8 md:p-12 text-center",children:[r.jsxs("div",{className:"relative inline-block mb-8",children:[r.jsx("div",{className:"w-24 h-24 rounded-full bg-gradient-to-br from-[#4a6b6d] to-[#3d5a5c] flex items-center justify-center",children:r.jsx(Ki,{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(Gc,{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(Nn,{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(to,{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:tye,alt:"LevelUp",className:"h-8"}),r.jsxs("p",{className:"text-sm text-white/40",children:["© ",new Date().getFullYear()," LevelUp Consulting Group. All rights reserved."]})]})})})]})]})},Zft=Ev({viewerName:Oo().min(1,"Name is required").max(100,"Name must be less than 100 characters"),viewerEmail:Oo().email("Please enter a valid email").max(255,"Email must be less than 255 characters"),viewerPhone:Oo().max(20,"Phone must be less than 20 characters").optional(),message:Oo().min(1,"Message is required").max(1e3,"Message must be less than 1000 characters")});function Yft({shareToken:e,agentName:t,hasContact:s}){const[n,a]=A.useState(!1),[o,l]=A.useState(!1),[i,u]=A.useState(null),m=sae({resolver:nae(Zft),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(Xe,{className:"py-8 text-center",children:[r.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/20 mb-4",children:r.jsx(Ki,{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(Vt,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(ql,{className:"h-5 w-5 text-primary"}),r.jsx(Gt,{className:"text-lg",children:"Reply to this video"})]}),r.jsx(Ns,{children:s?`Have a question or want to connect? Send ${t||"them"} a message.`:`Interested? Share your info and ${t||"your agent"} will be in touch.`})]}),r.jsx(Xe,{children:r.jsx(aae,{...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(Rl,{control:m.control,name:"viewerName",render:({field:y})=>r.jsxs(Cl,{children:[r.jsx(Ml,{children:"Your Name *"}),r.jsx(Tl,{children:r.jsx(ot,{placeholder:"John Smith",...y})}),r.jsx(Yu,{})]})}),r.jsx(Rl,{control:m.control,name:"viewerEmail",render:({field:y})=>r.jsxs(Cl,{children:[r.jsx(Ml,{children:"Email *"}),r.jsx(Tl,{children:r.jsx(ot,{type:"email",placeholder:"john@example.com",...y})}),r.jsx(Yu,{})]})})]}),!s&&r.jsx(Rl,{control:m.control,name:"viewerPhone",render:({field:y})=>r.jsxs(Cl,{children:[r.jsx(Ml,{children:"Phone (optional)"}),r.jsx(Tl,{children:r.jsx(ot,{type:"tel",placeholder:"(555) 123-4567",...y})}),r.jsx(Yu,{})]})}),r.jsx(Rl,{control:m.control,name:"message",render:({field:y})=>r.jsxs(Cl,{children:[r.jsx(Ml,{children:"Message *"}),r.jsx(Tl,{children:r.jsx(Ys,{placeholder:s?"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(Yu,{})]})}),i&&r.jsx("p",{className:"text-sm text-destructive",children:i}),r.jsx(X,{type:"submit",className:"w-full gap-2",disabled:n,children:n?r.jsxs(r.Fragment,{children:[r.jsx(Vr,{className:"h-4 w-4 animate-spin"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(ro,{className:"h-4 w-4"}),"Send Message"]})})]})})})]})}const Xft=()=>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(Mn,{className:"absolute top-[5%] left-[8%] w-6 h-6 text-blue-600/30 fill-blue-600/20"}),r.jsx(Mn,{className:"absolute top-[15%] left-[20%] w-4 h-4 text-blue-600/25 fill-blue-600/15"}),r.jsx(Mn,{className:"absolute top-[8%] left-[28%] w-5 h-5 text-blue-600/30 fill-blue-600/20"}),r.jsx(Mn,{className:"absolute top-[25%] left-[12%] w-4 h-4 text-blue-600/20 fill-blue-600/10"}),r.jsx(Mn,{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"})]}),Qft=()=>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(Bn,{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(Mn,{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(Bn,{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(Mn,{className:"absolute bottom-[25%] left-[10%] w-6 h-6 text-blue-500/25 fill-blue-500/15 animate-pulse"}),r.jsx(Mn,{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"})]}),Jft=()=>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(wf,{className:"w-20 h-20 text-pink-400 rotate-12"})}),r.jsx("div",{className:"absolute top-[2%] right-[8%] opacity-15",children:r.jsx(wf,{className:"w-16 h-16 text-rose-400 -rotate-12"})}),r.jsx("div",{className:"absolute bottom-[15%] left-[8%] opacity-15",children:r.jsx(wf,{className:"w-14 h-14 text-purple-400 rotate-45"})}),r.jsx("div",{className:"absolute bottom-[20%] right-[5%] opacity-20",children:r.jsx(wf,{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"})]}),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-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($l,{className:"absolute top-[8%] left-[12%] w-12 h-12 text-blue-600/15"}),r.jsx(Mn,{className:"absolute top-[15%] left-[22%] w-5 h-5 text-amber-500/25 fill-amber-500/15"}),r.jsx($l,{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(Mn,{className:"absolute bottom-[25%] left-[15%] w-6 h-6 text-blue-500/20 fill-blue-500/10 animate-pulse"}),r.jsx(Mn,{className:"absolute top-[20%] right-[22%] w-5 h-5 text-indigo-400/20 fill-indigo-400/10 animate-pulse",style:{animationDelay:"0.5s"}})]}),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-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(wf,{className:"absolute top-[20%] left-[32%] w-7 h-7 text-purple-400/30"}),r.jsx(wf,{className:"absolute top-[12%] right-[28%] w-6 h-6 text-pink-400/30"}),r.jsx(CS,{className:"absolute top-[18%] left-[52%] w-5 h-5 text-sky-400/35"})]}),rgt=()=>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(Fj,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-orange-400/25"}),r.jsx(Fj,{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(Bn,{className:"absolute top-[8%] left-[55%] w-6 h-6 text-purple-400/35 animate-pulse"}),r.jsx(Bn,{className:"absolute bottom-[28%] right-[25%] w-5 h-5 text-orange-400/30 animate-pulse",style:{animationDelay:"0.5s"}})]}),sgt=()=>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(ev,{className:"absolute bottom-[8%] left-[5%] w-20 h-20 text-green-600/18"}),r.jsx(ev,{className:"absolute bottom-[12%] right-[8%] w-16 h-16 text-emerald-600/15"}),r.jsx(ev,{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(Mn,{className:"absolute top-[3%] left-[50%] -translate-x-1/2 w-10 h-10 text-amber-400/35 fill-amber-400/25"})]}),ngt=()=>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"})]}),agt=()=>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(Mn,{className:"absolute top-[5%] left-[15%] w-12 h-12 text-yellow-400/35 fill-yellow-400/25 animate-pulse"}),r.jsx(Mn,{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(Mn,{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(Mn,{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(Bn,{className:"absolute top-[3%] left-[50%] w-10 h-10 text-yellow-400/40"}),r.jsx(Gc,{className:"absolute bottom-[18%] left-[10%] w-12 h-12 text-purple-400/18 rotate-12"}),r.jsx(Gc,{className:"absolute bottom-[20%] right-[12%] w-10 h-10 text-amber-400/15 -rotate-12"})]}),igt=()=>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(Mn,{className:"absolute top-[8%] left-[50%] -translate-x-1/2 w-14 h-14 text-yellow-400/28 fill-yellow-400/18"}),r.jsx(Bn,{className:"absolute top-[5%] left-[20%] w-7 h-7 text-blue-400/35"}),r.jsx(Bn,{className:"absolute top-[10%] right-[18%] w-6 h-6 text-sky-400/30"})]}),ogt=()=>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(ry,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-green-500/25"}),r.jsx(ry,{className:"absolute top-[8%] right-[12%] w-12 h-12 text-emerald-500/20"}),r.jsx(ry,{className:"absolute bottom-[18%] left-[12%] w-14 h-14 text-green-400/22"}),r.jsx(ry,{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"})]})]})]}),lgt=()=>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(Mn,{className:"absolute top-[5%] left-[42%] w-10 h-10 text-amber-400/30 fill-amber-400/20"}),r.jsx(Mn,{className:"absolute top-[15%] right-[25%] w-7 h-7 text-yellow-400/25 fill-yellow-400/15"}),r.jsx($l,{className:"absolute bottom-[20%] right-[12%] w-12 h-12 text-blue-500/18"}),r.jsx($l,{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"})]}),cgt=()=>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(Gc,{className:"absolute top-[8%] left-[45%] w-10 h-10 text-purple-400/22 rotate-12"}),r.jsx(oo,{className:"absolute bottom-[18%] right-[15%] w-12 h-12 text-rose-400/18"})]}),dgt=()=>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"})]}),ugt=()=>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(J1,{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(J1,{className:"absolute top-[15%] left-[18%] w-10 h-10 text-yellow-400/30"}),r.jsx(Bn,{className:"absolute top-[10%] left-[42%] w-7 h-7 text-amber-400/35"}),r.jsx(J1,{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"})]}),hgt=()=>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(sa,{className:"absolute top-[8%] left-[10%] w-14 h-14 text-teal-500/22"}),r.jsx(sa,{className:"absolute bottom-[15%] right-[8%] w-16 h-16 text-emerald-500/18"}),r.jsx(xm,{className:"absolute top-[12%] right-[18%] w-10 h-10 text-amber-400/25"}),r.jsx(xm,{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(Bn,{className:"absolute top-[5%] left-[55%] w-8 h-8 text-teal-400/30"}),r.jsx(Gc,{className:"absolute bottom-[20%] left-[48%] w-10 h-10 text-cyan-400/18 rotate-12"})]}),mgt=()=>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(Gc,{className:"absolute top-[5%] left-[12%] w-14 h-14 text-emerald-400/25 rotate-12"}),r.jsx(Gc,{className:"absolute top-[8%] right-[10%] w-12 h-12 text-teal-400/22 -rotate-12"}),r.jsx(xm,{className:"absolute bottom-[18%] left-[18%] w-12 h-12 text-amber-400/25"}),r.jsx(sa,{className:"absolute bottom-[15%] right-[12%] w-14 h-14 text-teal-500/18"}),r.jsx(Bn,{className:"absolute top-[15%] left-[42%] w-10 h-10 text-emerald-400/35"}),r.jsx(Bn,{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"})]}),pgt=()=>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(xm,{className:"absolute bottom-[12%] left-[50%] -translate-x-1/2 w-24 h-24 text-amber-400/25 rotate-45"}),r.jsx(xm,{className:"absolute top-[10%] left-[12%] w-10 h-10 text-yellow-400/30"}),r.jsx(xm,{className:"absolute top-[12%] right-[15%] w-9 h-9 text-amber-300/25"}),r.jsx(sa,{className:"absolute top-[8%] left-[42%] w-12 h-12 text-teal-500/18"}),r.jsx(Gc,{className:"absolute bottom-[22%] right-[18%] w-12 h-12 text-orange-400/18 rotate-12"}),r.jsx(Bn,{className:"absolute top-[5%] right-[35%] w-8 h-8 text-yellow-400/35"}),r.jsx(Mn,{className:"absolute top-[18%] left-[28%] w-6 h-6 text-amber-400/25 fill-amber-400/15"})]}),fgt=()=>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(sa,{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(xm,{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(Bn,{className:"absolute top-[12%] left-[45%] w-8 h-8 text-teal-400/30"}),r.jsx(Dj,{className:"absolute top-[15%] right-[28%] w-10 h-10 text-emerald-400/20"})]}),WNe=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute top-4 left-[10%] w-3 h-3 bg-amber-400/60 rounded-full animate-pulse"}),r.jsx("div",{className:"absolute top-12 right-[15%] w-2 h-2 bg-rose-400/60 rounded-full animate-pulse delay-100"}),r.jsx("div",{className:"absolute top-8 left-[30%] w-2.5 h-2.5 bg-sky-400/60 rounded-full animate-pulse delay-200"}),r.jsx("div",{className:"absolute top-16 right-[25%] w-2 h-2 bg-emerald-400/60 rounded-full animate-pulse delay-300"})]}),ggt=()=>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"})]}),xgt=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(Dj,{className:"absolute top-5 left-[10%] w-4 h-4 text-blue-400/50 animate-pulse"}),r.jsx(Bn,{className:"absolute top-10 right-[15%] w-3 h-3 text-amber-400/50 animate-pulse delay-100"}),r.jsx(sa,{className:"absolute top-8 left-[38%] w-3 h-3 text-teal-300/40 animate-pulse delay-200"})]}),ygt=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(Oj,{className:"absolute top-5 left-[12%] w-4 h-4 text-amber-500/50 animate-pulse"}),r.jsx(RS,{className:"absolute top-10 right-[15%] w-3 h-3 text-rose-400/50 animate-pulse delay-100"}),r.jsx(Oj,{className:"absolute top-8 left-[40%] w-3 h-3 text-amber-400/40 animate-pulse delay-200"})]}),fT=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(Bn,{className:"absolute top-5 left-[10%] w-4 h-4 text-emerald-400/50 animate-pulse"}),r.jsx(Gc,{className:"absolute top-10 right-[12%] w-5 h-5 text-amber-400/50 animate-pulse delay-150"}),r.jsx(Bn,{className:"absolute top-8 left-[45%] w-3 h-3 text-sky-400/40 animate-pulse delay-300"})]}),GNe=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(sa,{className:"absolute top-6 left-[12%] w-4 h-4 text-teal-400/40 animate-pulse"}),r.jsx(Bn,{className:"absolute top-10 right-[15%] w-3 h-3 text-emerald-400/50 animate-pulse delay-100"}),r.jsx(sa,{className:"absolute top-4 right-[40%] w-3 h-3 text-cyan-400/30 animate-pulse delay-200"})]}),Ime=[{id:"default",name:"Classic",description:"Clean, professional look for any occasion",icon:r.jsx(Bn,{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(ggt,{})},{id:"thinking_of_you",name:"Thinking of You",description:"Let them know they're on your mind",icon:r.jsx(iA,{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(fT,{})},{id:"check_in",name:"Check-in",description:"Touch base with your contacts",icon:r.jsx(Oj,{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(ygt,{})},{id:"market_update",name:"Market Update",description:"Share real estate market insights",icon:r.jsx(wc,{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(qs,{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(fT,{})},{id:"congratulations",name:"Congratulations",description:"Celebrate their achievements",icon:r.jsx($l,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Congratulations, ${e}!`:"Congratulations!",subText:"So proud of your accomplishment",gradientClasses:"from-amber-50/70 via-yellow-50/50 to-orange-50/40 dark:from-amber-950/30 dark:via-yellow-950/20 dark:to-orange-950/20",accentColor:"amber",decorativeElement:r.jsx(WNe,{})},{id:"welcome_neighborhood",name:"Welcome to the Neighborhood",description:"Greet new neighbors",icon:r.jsx(po,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Welcome to the Neighborhood, ${e}!`:"Welcome to the Neighborhood!",subText:"So excited to have you as our new neighbor",gradientClasses:"from-teal-50/70 via-cyan-50/50 to-sky-50/40 dark:from-teal-950/30 dark:via-cyan-950/20 dark:to-sky-950/20",accentColor:"teal",decorativeElement:r.jsx(GNe,{})},{id:"just_because",name:"Just Because",description:"No reason needed to connect",icon:r.jsx(RS,{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(fT,{})},{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(cgt,{})},{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(dgt,{})},{id:"groundhog_day",name:"Groundhog Day",description:"A fun seasonal greeting",icon:r.jsx(J1,{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(ugt,{})},{id:"new_years",name:"New Year's Day",description:"Ring in the new year",icon:r.jsx(Mn,{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(agt,{})},{id:"easter",name:"Easter",description:"Celebrate the spring season",icon:r.jsx(CS,{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(tgt,{})},{id:"mothers_day",name:"Mother's Day",description:"Celebrate the amazing moms",icon:r.jsx(wf,{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(Jft,{})},{id:"fathers_day",name:"Father's Day",description:"Celebrate the amazing dads",icon:r.jsx($l,{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(egt,{})},{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(Xft,{})},{id:"independence_day",name:"4th of July",description:"Celebrate Independence Day",icon:r.jsx(gm,{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(Qft,{})},{id:"labor_day",name:"Labor Day",description:"Celebrate the workers",icon:r.jsx($l,{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(lgt,{})},{id:"halloween",name:"Halloween",description:"Spooky seasonal greetings",icon:r.jsx(Fj,{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(rgt,{})},{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(ngt,{})},{id:"christmas",name:"Christmas",description:"Spread holiday cheer",icon:r.jsx(ev,{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(sgt,{})},{id:"hanukkah",name:"Hanukkah",description:"Celebrate the Festival of Lights",icon:r.jsx(Bn,{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(igt,{})},{id:"st_patricks_day",name:"St. Patrick's Day",description:"Celebrate the luck of the Irish",icon:r.jsx(ry,{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(ogt,{})},{id:"home_anniversary",name:"Home Anniversary",description:"Celebrate their home ownership milestone",icon:r.jsx(sa,{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(hgt,{})},{id:"under_contract",name:"Under Contract",description:"Celebrate this exciting milestone",icon:r.jsx(Gc,{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(mgt,{})},{id:"just_listed",name:"Just Listed",description:"Announce a new listing",icon:r.jsx(jn,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Exciting News, ${e}!`:"Just Listed!",subText:"A new property is now on the market",gradientClasses:"from-blue-50/70 via-indigo-50/50 to-violet-50/40 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-violet-950/20",accentColor:"blue",decorativeElement:r.jsx(GNe,{})},{id:"just_sold",name:"Just Sold",description:"Celebrate a successful sale",icon:r.jsx(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(fT,{})},{id:"price_reduction",name:"Price Reduction",description:"Notify about a price change",icon:r.jsx(Gj,{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(Dj,{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(xgt,{})},{id:"closing_day",name:"Closing Day",description:"Celebrate their closing day",icon:r.jsx(xm,{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(pgt,{})},{id:"move_in_day",name:"Move-in Day",description:"Welcome them to their new home",icon:r.jsx(sa,{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(fgt,{})},{id:"offer_accepted",name:"Offer Accepted",description:"Celebrate their accepted offer",icon:r.jsx(xd,{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(fT,{})},{id:"pre_approval",name:"Pre-Approval Congrats",description:"Congratulate on pre-approval",icon:r.jsx($l,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Congratulations, ${e}!`:"Congratulations!",subText:"You're pre-approved and ready to find your dream home",gradientClasses:"from-violet-50/70 via-purple-50/50 to-indigo-50/40 dark:from-violet-950/30 dark:via-purple-950/20 dark:to-indigo-950/20",accentColor:"violet",decorativeElement:r.jsx(WNe,{})}],vgt=[{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 _gt(e){return Ime.filter(t=>t.category===e)}function eC(e){return Ime.find(t=>t.id===e)||Ime[0]}function bgt(){const{shareToken:e}=hc(),[t,s]=A.useState(null),[n,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(ne=>{ne.style.display="none"})})};U();const q=[setTimeout(U,500),setTimeout(U,1500),setTimeout(U,3e3)],H=new MutationObserver(U);return H.observe(document.body,{childList:!0,subtree:!0}),()=>{q.forEach(clearTimeout),H.disconnect()}},[]),A.useEffect(()=>{(async()=>{if(!e){x("Invalid share link"),u(!1);return}const{data:q,error:H}=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(H||!q){x("Video not found or has been removed"),u(!1);return}s(q);try{await Y.rpc("log_video_view",{p_video_id:q.id,p_user_agent:navigator.userAgent,p_referrer:document.referrer||null})}catch(G){console.warn("Failed to log video view:",G)}if(q.owner_user_id){const{data:G}=await Y.from("profiles").select("id, name, email, phone").eq("id",q.owner_user_id).single();if(G){a(G);try{const{data:Q}=await Y.storage.from("avatars").list(`${q.owner_user_id}`);if(Q&&Q.length>0){const{data:ne}=Y.storage.from("avatars").getPublicUrl(`${q.owner_user_id}/${Q[0].name}`);l(ne.publicUrl)}}catch{}}}u(!1)})()},[e]);const b=U=>{if(!U)return"0:00";const q=Math.floor(U/60),H=U%60;return`${q}:${H.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 q=U.split(" ");return q.length>=2?`${q[0][0]}${q[1][0]}`.toUpperCase():U.substring(0,2).toUpperCase()},M=eC((t==null?void 0:t.page_template)||"default"),E=(t==null?void 0:t.recipient_name)||null,T=M.headerText(E),R=`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(Vr,{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(Xe,{className:"py-12 text-center",children:[r.jsx(Ta,{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(Bh,{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:R}),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})]}),n&&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(Xn,{className:"h-14 w-14 border-2 border-primary/20",children:[r.jsx(ji,{src:o||void 0,alt:n.name||"Agent"}),r.jsx(Qn,{className:"bg-primary/10 text-primary font-semibold",children:k(n.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:n.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:[n.phone&&r.jsx(X,{variant:"outline",size:"icon",asChild:!0,className:"h-10 w-10",children:r.jsx("a",{href:`tel:${n.phone}`,"aria-label":"Call agent",children:r.jsx(Pi,{className:"h-4 w-4"})})}),n.email&&r.jsx(X,{variant:"outline",size:"icon",asChild:!0,className:"h-10 w-10",children:r.jsx("a",{href:`mailto:${n.email}`,"aria-label":"Email agent",children:r.jsx(Nn,{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 H;U.currentTarget.style.display="none";const q=(H=U.currentTarget.parentElement)==null?void 0:H.querySelector(".video-fallback");q&&(q.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(Ta,{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(Hl,{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(Hl,{className:"h-5 w-5"}),"Watch Video"]})}),r.jsx(Yft,{shareToken:e,agentName:(n==null?void 0:n.name)||null,hasContact:!!t.contact_id})]})]})]})}function wgt(){return A.useEffect(()=>(document.body.classList.add("video-landing-page"),()=>{document.body.classList.remove("video-landing-page")}),[]),r.jsx(Drt,{})}function jgt(){const{token:e}=hc();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(Vr,{className:"h-5 w-5 animate-spin"}),r.jsx("span",{children:"Loading video preview…"})]})})}const kgt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},Ngt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},P4={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function Sgt(){var se,fe,oe,ce;const{slugOrId:e}=hc(),[t]=Ic(),{data:s,isLoading:n}=N8e(e||""),a=S8e(),o=Act(),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),[E,T]=A.useState(!1),[P,R]=A.useState(null),[D,U]=A.useState(!1);A.useEffect(()=>{l&&o.mutate(l)},[l]);const q=de=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(de),H=async de=>{if(de.preventDefault(),!(!i.trim()||!y.trim()||!s)){M(!0);try{await a.mutateAsync({listingId:s.id,agentId:s.agent_id,firstName:i.trim(),lastName:m.trim(),email:y.trim(),phone:b.trim(),shareToken:l}),T(!0),Te.success("Thanks! The agent will be in touch soon.")}catch(xe){console.error("Lead submission error:",xe),Te.error(`Failed to submit: ${xe.message||"Please try again"}`)}finally{M(!1)}}},G=(s==null?void 0:s.photos)||[],Q=G.find(de=>de.is_primary)||G[0],ne=()=>{P!==null&&R(P===0?G.length-1:P-1)},ie=()=>{P!==null&&R(P===G.length-1?0:P+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(Cr,{className:"h-8 w-32"})})}),r.jsxs("div",{className:"container mx-auto px-4 py-8",children:[r.jsx(Cr,{className:"h-10 w-48 mb-6"}),r.jsx(Cr,{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(Cr,{className:"h-12 w-48"}),r.jsx(Cr,{className:"h-6 w-full"}),r.jsx(Cr,{className:"h-6 w-3/4"})]}),r.jsx(Cr,{className:"h-64"})]})]})]});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(ho,{to:"/public/listings",className:"flex items-center gap-2",children:r.jsx("img",{src:Vte,alt:"LevelUp",className:"h-8"})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[r.jsx(sa,{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(ho,{to:"/public/listings",children:"Browse All Listings"})})]})]});const he=s.property_address?`${s.property_address} - ${s.city}, ${s.state}`:`${s.city}, ${s.state} Home for Sale`;return r.jsxs(r.Fragment,{children:[r.jsxs(Bh,{children:[r.jsxs("title",{children:[he," | LevelUp Listings"]}),r.jsx("meta",{name:"description",content:`${q(s.price)} - ${s.bedrooms||""}BD ${s.bathrooms||""}BA ${s.square_footage?s.square_footage.toLocaleString()+" sqft":""} ${P4[s.property_type]} in ${s.city}, ${s.state}. ${((se=s.description)==null?void 0:se.slice(0,150))||""}`}),r.jsx("link",{rel:"canonical",href:`https://listings.relevelup.com/${s.slug||s.id}`}),r.jsx("meta",{property:"og:title",content:he}),r.jsx("meta",{property:"og:description",content:`${q(s.price)} - ${s.bedrooms||""}BD ${s.bathrooms||""}BA ${P4[s.property_type]} in ${s.city}, ${s.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/${s.slug||s.id}`}),Q&&r.jsx("meta",{property:"og:image",content:Q.photo_url}),Q&&r.jsx("meta",{property:"og:image:alt",content:`${s.property_address||s.city} - ${P4[s.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:he}),r.jsx("meta",{name:"twitter:description",content:`${q(s.price)} - ${s.bedrooms||""}BD ${s.bathrooms||""}BA in ${s.city}, ${s.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-${s.state}`}),r.jsx("meta",{name:"geo.placename",content:s.city}),r.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"RealEstateListing",name:s.property_address||`${s.city}, ${s.state} Home`,description:s.description||`${P4[s.property_type]} for sale in ${s.city}, ${s.state}`,url:`https://listings.relevelup.com/${s.slug||s.id}`,datePosted:s.created_at,image:G.map(de=>de.photo_url),address:{"@type":"PostalAddress",streetAddress:s.property_address||void 0,addressLocality:s.city,addressRegion:s.state,addressCountry:"US"},geo:s.neighborhood?{"@type":"GeoCoordinates",name:s.neighborhood}:void 0,offers:{"@type":"Offer",price:s.price,priceCurrency:"USD",availability:s.status==="sold"?"https://schema.org/SoldOut":s.status==="under_contract"?"https://schema.org/LimitedAvailability":"https://schema.org/InStock"},numberOfRooms:s.bedrooms||void 0,numberOfBathroomsTotal:s.bathrooms||void 0,floorSize:s.square_footage?{"@type":"QuantitativeValue",value:s.square_footage,unitCode:"FTK"}:void 0,yearBuilt:s.year_built||void 0,broker:s.agent?{"@type":"RealEstateAgent",name:s.agent.name,email:s.agent.email,worksFor:(fe=s.agent.brokerage)!=null&&fe.name?{"@type":"RealEstateAgent",name:s.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(ho,{to:"/public/listings",className:"flex items-center gap-2",children:r.jsx("img",{src:Vte,alt:"LevelUp",className:"h-8"})})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-6",children:[r.jsxs(ho,{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:()=>R(0),children:r.jsx("img",{src:Q==null?void 0:Q.photo_url,alt:`${s.property_address||s.city+", "+s.state} - ${P4[s.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((de,xe)=>r.jsxs("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer relative",onClick:()=>R(xe+1),children:[r.jsx("img",{src:de.photo_url,alt:`${s.property_address||s.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"]})]},de.id))})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-8",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[r.jsxs("div",{children:[r.jsx("div",{className:"flex items-center gap-2 mb-3",children:r.jsx(Tt,{className:`${kgt[s.status]} text-white border-0`,children:Ngt[s.status]})}),r.jsx("h1",{className:"text-4xl font-bold text-primary mb-2",children:q(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(po,{className:"h-4 w-4"}),s.city,", ",s.state,s.neighborhood&&` • ${s.neighborhood}`]})]}),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-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:s.bedrooms}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Beds"})]}),s.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:s.bathrooms}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Baths"})]}),s.square_footage&&r.jsxs("div",{className:"text-center",children:[r.jsx(qg,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:s.square_footage.toLocaleString()}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Sq Ft"})]}),s.year_built&&r.jsxs("div",{className:"text-center",children:[r.jsx(jn,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:s.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(pi,{className:"h-3 w-3 mr-1"}),P4[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("h2",{className:"text-lg font-semibold mb-2",children:"About This Property"}),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("h2",{className:"text-lg font-semibold 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(Sn,{className:"h-4 w-4 mr-2"}),"View on MLS"]})})]})]}),r.jsxs("div",{className:"space-y-6",children:[s.video&&s.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(Xe,{className:"p-0",children:[r.jsxs("div",{className:"relative aspect-video bg-muted cursor-pointer group",onClick:()=>U(!0),children:[s.video.thumbnail_url?r.jsx("img",{src:s.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(Ta,{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(Hl,{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(Hl,{className:"h-4 w-4"}),"Watch Video Tour"]}),s.video.title&&r.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center truncate",children:s.video.title})]})]})}),s.agent&&r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsxs(Gt,{className:"text-lg flex items-center gap-2",children:[r.jsx(oc,{className:"h-5 w-5"}),"Listing Agent"]})}),r.jsxs(Xe,{children:[r.jsx("p",{className:"font-semibold text-lg",children:s.agent.name}),((oe=s.agent.brokerage)==null?void 0:oe.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:s.agent.brokerage.name})]})]}),r.jsxs(He,{className:"border-primary",children:[r.jsx(Vt,{children:r.jsx(Gt,{className:"text-lg",children:"Interested in this property?"})}),r.jsx(Xe,{children:E?r.jsxs("div",{className:"text-center py-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-3",children:r.jsx(Nn,{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:H,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(ot,{id:"firstName",type:"text",placeholder:"John",value:i,onChange:de=>u(de.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"lastName",children:"Last Name"}),r.jsx(ot,{id:"lastName",type:"text",placeholder:"Doe",value:m,onChange:de=>x(de.target.value)})]})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"email",children:"Email *"}),r.jsx(ot,{id:"email",type:"email",placeholder:"you@example.com",value:y,onChange:de=>v(de.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"phone",children:"Phone"}),r.jsx(ot,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:b,onChange:de=>N(de.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:()=>R(null),children:r.jsxs(Pr,{className:"max-w-5xl p-0 bg-black/95",children:[r.jsx(zr,{className:"sr-only",children:r.jsx(Rr,{children:"Photo Gallery"})}),r.jsx("button",{onClick:()=>R(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(en,{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:ne,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(Sc,{className:"h-6 w-6"})}),r.jsx("button",{onClick:ie,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(Zi,{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(Pr,{className:"max-w-4xl p-0 bg-black overflow-hidden",children:[r.jsx(zr,{className:"sr-only",children:r.jsx(Rr,{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(en,{className:"h-5 w-5"})}),((ce=s==null?void 0:s.video)==null?void 0:ce.playback_url)&&r.jsx("div",{className:"aspect-video w-full",children:r.jsx("iframe",{src:s.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 Cgt(){var o;const{slug:e}=hc(),{data:t,isLoading:s,error:n}=A8e(e);if(A.useEffect(()=>(document.body.classList.add("agent-card-page"),()=>{document.body.classList.remove("agent-card-page")}),[]),A.useEffect(()=>{t!=null&&t.id&&Bi(t.id,"card_view")},[t==null?void 0:t.id]),s)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(Cr,{className:"h-28 w-28 rounded-full"}),r.jsx(Cr,{className:"h-6 w-48"}),r.jsx(Cr,{className:"h-4 w-36"})]}),r.jsx(Cr,{className:"h-12 w-full"}),r.jsx(Cr,{className:"h-12 w-full"})]})});if(n||!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(Bh,{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(sye,{card:t})]})}function gT({banners:e,autoPlayInterval:t=5e3,className:s}){const[n,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[n];return r.jsxs("div",{className:Ut("relative w-full overflow-hidden rounded-xl",s),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(Sc,{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(Zi,{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===n?"bg-white w-6":"bg-white/50 hover:bg-white/70"),"aria-label":`Go to slide ${v+1}`},v))})]})}function Mgt(e){return"EST"}function UE(e){const s=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0,timeZone:"America/New_York"}).format(e),n=Mgt();return`${s} ${n}`}function tC(e){const t=new Date,s=new Date(e),n=tNe(s,-15),a=tNe(s,30);return t>a?"ended":lNe(t,{start:s,end:a})?"live":lNe(t,{start:n,end:s})?"starting_soon":"upcoming"}function Oye(e){const t=tC(e);return t==="starting_soon"||t==="live"}const KNe=Oye,Tgt=({events:e,registrations:t,onNavigateToEvents:s})=>{const[n,a]=A.useState(new Date);A.useEffect(()=>{const b=setInterval(()=>{a(new Date)},3e4);return()=>clearInterval(b)},[]);const o=e.filter(b=>Oye(b.event_date));if(o.length===0)return null;const l=o[0],i=tC(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(Wj,{className:"h-4 w-4"}),"Live Now"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ra,{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 ${UE(new Date(l.event_date))}`:`Starts at ${UE(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(Sn,{className:"h-4 w-4"}),y?"Join Now":"Join When Live"]}):r.jsxs(X,{variant:"outline",onClick:s,className:`${v.outlineButton} gap-2`,children:[r.jsx(qs,{className:"h-4 w-4"}),"Register & Join"]})})]})})]})};var Dye="Progress",Rye=100,[Agt]=uc(Dye),[Egt,Igt]=Agt(Dye),vRe=A.forwardRef((e,t)=>{const{__scopeProgress:s,value:n=null,max:a,getValueLabel:o=Pgt,...l}=e;(a||a===0)&&!ZNe(a)&&console.error(Lgt(`${a}`,"Progress"));const i=ZNe(a)?a:Rye;n!==null&&!YNe(n,i)&&console.error(Ogt(`${n}`,"Progress"));const u=YNe(n,i)?n:null,m=are(u)?o(u,i):void 0;return r.jsx(Egt,{scope:s,value:u,max:i,children:r.jsx($s.div,{"aria-valuemax":i,"aria-valuemin":0,"aria-valuenow":are(u)?u:void 0,"aria-valuetext":m,role:"progressbar","data-state":wRe(u,i),"data-value":u??void 0,"data-max":i,...l,ref:t})})});vRe.displayName=Dye;var _Re="ProgressIndicator",bRe=A.forwardRef((e,t)=>{const{__scopeProgress:s,...n}=e,a=Igt(_Re,s);return r.jsx($s.div,{"data-state":wRe(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...n,ref:t})});bRe.displayName=_Re;function Pgt(e,t){return`${Math.round(e/t*100)}%`}function wRe(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function are(e){return typeof e=="number"}function ZNe(e){return are(e)&&!isNaN(e)&&e>0}function YNe(e,t){return are(e)&&!isNaN(e)&&e<=t&&e>=0}function Lgt(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Rye}\`.`}function Ogt(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 ${Rye} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. Defaulting to \`null\`.`}var jRe=vRe,Dgt=bRe;const lc=A.forwardRef(({className:e,value:t,...s},n)=>r.jsx(jRe,{ref:n,className:Ut("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...s,children:r.jsx(Dgt,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));lc.displayName=jRe.displayName;function Rgt(){const{user:e,isBrokerageManager:t}=Yr(),[s,n]=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:R,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:q}=await Y.from("onboarding_checklist_progress").select("item_id, completed_at").eq("user_id",e.id);if(q)throw q;const{data:H,error:G}=await Y.from("onboarding_checklist_dismissed").select("id").eq("user_id",e.id).maybeSingle();if(G)throw G;n(R||[]),o(U||[]),i(!!H),R&&R.length>0&&await v(R,U||[])}catch(R){console.error("Error fetching checklist data:",R)}finally{m(!1)}},v=async(R,D)=>{var Pe,$e;if(!(e!=null&&e.id))return;const U=D.map(it=>it.item_id),q=R.filter(it=>!U.includes(it.id));if(q.length===0)return;const[H,G,Q,ne,ie,he,se,fe,oe,ce,de,xe,Me,ve,be]=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)]),we={},tt=(Pe=H.data)==null?void 0:Pe.brokerage_id;we.share_resource=(G.count||0)>0,we.post_community=(Q.count||0)>0,we.register_event=(ne.count||0)>0,we.view_template=(ie.count||0)>0,we.watch_academy=(he.count||0)>0,we.use_toolbox=(se.count||0)>0,we.launch_app=(fe.count||0)>0,we.add_contact=(oe.count||0)>0,we.create_video=(ce.count||0)>0,we.complete_touch=(de.count||0)>0,we.add_transaction=(xe.count||0)>0,we.add_listing=(Me.count||0)>0,we.add_deal=(be.count||0)>0;const Ae=(($e=ve.data)==null?void 0:$e.map(it=>it.id))||[],Le=[];tt?Le.push(Y.from("profiles").select("id").eq("brokerage_id",tt).neq("id",e.id).then(it=>{var xt;we.add_agent=(((xt=it.data)==null?void 0:xt.length)||0)>0})):we.add_agent=!1,Ae.length>0?(Le.push(Y.from("contact_plan_cycles").select("id",{count:"exact",head:!0}).in("contact_id",Ae).then(it=>{we.add_plan=(it.count||0)>0})),Le.push(Y.from("contact_popby_settings").select("id",{count:"exact",head:!0}).in("contact_id",Ae).then(it=>{we.schedule_popby=(it.count||0)>0}))):(we.add_plan=!1,we.schedule_popby=!1),await Promise.all(Le);const Ue=q.filter(it=>we[it.action_type]);if(Ue.length>0){const it=Ue.map(Ee=>({user_id:e.id,item_id:Ee.id})),{error:xt}=await Y.from("onboarding_checklist_progress").upsert(it,{onConflict:"user_id,item_id",ignoreDuplicates:!0});if(!xt){const Ee=Ue.map(et=>({item_id:et.id,completed_at:new Date().toISOString()}));o(et=>[...et,...Ee])}}},b=async R=>{if(e!=null&&e.id)try{const{error:D}=await Y.from("onboarding_checklist_progress").insert({user_id:e.id,item_id:R});if(D)throw D;o(U=>[...U,{item_id:R,completed_at:new Date().toISOString()}])}catch(D){console.error("Error marking item complete:",D)}},N=async()=>{if(e!=null&&e.id)try{const{error:R}=await Y.from("onboarding_checklist_dismissed").insert({user_id:e.id});if(R)throw R;i(!0)}catch(R){console.error("Error dismissing checklist:",R)}},k=a.length,M=s.length,E=M>0&&k>=M,T=M>0?k/M*100:0;return{items:s,progress:a,isDismissed:l,loading:u,completedCount:k,totalCount:M,isComplete:E,progressPercentage:T,isItemComplete:R=>a.some(D=>D.item_id===R),markComplete:b,dismiss:N,refetch:y}}const Fgt={add_agent:r.jsx(qs,{className:"h-4 w-4"}),share_resource:r.jsx(Cc,{className:"h-4 w-4"}),post_community:r.jsx(Bo,{className:"h-4 w-4"}),register_event:r.jsx(jn,{className:"h-4 w-4"}),view_template:r.jsx(K0,{className:"h-4 w-4"}),watch_academy:r.jsx(K1,{className:"h-4 w-4"}),use_toolbox:r.jsx(vy,{className:"h-4 w-4"}),launch_app:r.jsx(sA,{className:"h-4 w-4"}),add_deal:r.jsx(hy,{className:"h-4 w-4"}),add_listing:r.jsx(sa,{className:"h-4 w-4"})},zgt={add_deal:"/mission-control/pipeline",add_listing:"/mission-control/listings/new",post_community:"/community",add_contact:"/mission-control/contacts"};function Bgt(){const{items:e,isDismissed:t,loading:s,completedCount:n,totalCount:a,isComplete:o,progressPercentage:l,isItemComplete:i,markComplete:u,dismiss:m}=Rgt(),x=Hs(),[y,v]=A.useState(!0);return s||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(Vt,{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($g,{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(zg,{className:"h-4 w-4"}):r.jsx(gd,{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(en,{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:[n," of ",a," complete"]})]}),r.jsx(lc,{value:l,className:"h-2"})]})]}),y&&r.jsx(Xe,{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=zgt[b.action_type];k?x(k):u(b.id)},children:[r.jsx("div",{className:"mt-0.5",children:N?r.jsx(Ki,{className:"h-5 w-5 text-primary"}):r.jsx(sh,{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:Fgt[b.action_type]||r.jsx(sh,{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 Vf=()=>Kt({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}}),Np=e=>{const t=Pc(),s=1e3,n=async a=>{const o=[];let l=0;for(;;){const{data:i,error:u}=await a.range(l,l+s-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 n(a)},enabled:!!t})},$gt=e=>Kt({queryKey:["innercircle-contact",e],queryFn:async()=>{const{data:t,error:s}=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(s)throw s;return t},enabled:!!e}),kRe=()=>{const e=Pc();return Kt({queryKey:["innercircle-contact-counts",e],queryFn:async()=>{const{data:t,error:s}=await Y.from("innercircle_contacts").select(` id, tags:innercircle_contact_tags(relationship_type_id) `);if(s)throw s;const n={};return t==null||t.forEach(a=>{var o;(o=a.tags)==null||o.forEach(l=>{n[l.relationship_type_id]=(n[l.relationship_type_id]||0)+1})}),n},enabled:!!e})},Fye=()=>{const e=Br(),t=Pc();return ar({mutationFn:async s=>{const{tagIds:n,...a}=s,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(n&&n.length>0){const{error:u}=await Y.from("innercircle_contact_tags").insert(n.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"]}),Wn({title:"Contact created successfully"})},onError:s=>{Wn({title:"Error creating contact",description:s.message,variant:"destructive"})}})},NRe=()=>{const e=Br();return ar({mutationFn:async({id:t,...s})=>{const{tagIds:n,tags:a,...o}=s,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(n!==void 0&&(await Y.from("innercircle_contact_tags").delete().eq("contact_id",t),n.length>0)){const{error:m}=await Y.from("innercircle_contact_tags").insert(n.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"]}),Wn({title:"Contact updated successfully"})},onError:t=>{Wn({title:"Error updating contact",description:t.message,variant:"destructive"})}})},zye=()=>{const e=Br();return ar({mutationFn:async t=>{const{error:s}=await Y.from("innercircle_contacts").delete().eq("id",t);if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["innercircle-contacts"]}),e.invalidateQueries({queryKey:["innercircle-contact-counts"]}),Wn({title:"Contact deleted successfully"})},onError:t=>{Wn({title:"Error deleting contact",description:t.message,variant:"destructive"})}})},Bye=()=>Kt({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}}),Ugt=e=>Kt({queryKey:["action-scripts",e],queryFn:async()=>{let t=Y.from("action_scripts").select("*, action_type:action_types(*)");const{data:s,error:n}=await t;if(n)throw n;return s}}),qgt=()=>Kt({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}}),Vgt=()=>{const e=Br(),t=Pc();return ar({mutationFn:async({name:s,description:n})=>{const{data:a,error:o}=await Y.from("touchpoint_plans").insert({name:s,description:n,owner_user_id:t,active:!0,is_template:!1}).select().single();if(o)throw o;return a},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),Wn({title:"Plan created successfully"})},onError:s=>{Wn({title:"Error creating plan",description:s.message,variant:"destructive"})}})},Hgt=()=>{const e=Br(),t=Pc();return ar({mutationFn:async({sourcePlanId:s,newName:n})=>{const{data:a,error:o}=await Y.from("touchpoint_plans").select(` *, items:touchpoint_plan_items(*) `).eq("id",s).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:n,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"]}),Wn({title:"Plan duplicated successfully",description:"You can now edit your copy of this plan."})},onError:s=>{Wn({title:"Error duplicating plan",description:s.message,variant:"destructive"})}})},Wgt=()=>{const e=Br();return ar({mutationFn:async({id:t,name:s,description:n})=>{const{data:a,error:o}=await Y.from("touchpoint_plans").update({name:s,description:n}).eq("id",t).select().single();if(o)throw o;return a},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),Wn({title:"Plan updated successfully"})}})},Ggt=()=>{const e=Br();return ar({mutationFn:async t=>{const{error:s}=await Y.from("touchpoint_plans").delete().eq("id",t);if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),Wn({title:"Plan deleted successfully"})}})},Kgt=()=>{const e=Br();return ar({mutationFn:async({planId:t,items:s})=>{if(await Y.from("touchpoint_plan_items").delete().eq("plan_id",t),s.length>0){const{error:n}=await Y.from("touchpoint_plan_items").insert(s.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(n)throw n}},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),Wn({title:"Plan schedule updated"})}})},Zgt=()=>{const e=Br();return ar({mutationFn:async({actionTypeId:t,title:s,scriptBody:n,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:s,script_body:n,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"]}),Wn({title:"Script created successfully"})},onError:t=>{Wn({title:"Error creating script",description:t.message,variant:"destructive"})}})},Ygt=()=>{const e=Pc();return Kt({queryKey:["user-plan-enrollments",e],queryFn:async()=>{const{data:t,error:s}=await Y.from("user_plan_enrollments").select(` *, plan:touchpoint_plans(*), relationship_type:relationship_types(*) `);if(s)throw s;return t},enabled:!!e})},Xgt=()=>{const e=Br(),t=Pc();return ar({mutationFn:async({planId:s,relationshipTypeId:n,active:a})=>{const{data:o}=await Y.from("user_plan_enrollments").select("id").eq("plan_id",s).eq("relationship_type_id",n).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:s,relationship_type_id:n,active:!0,start_date:new Date().toISOString().split("T")[0]});if(l)throw l}},onSuccess:()=>{e.invalidateQueries({queryKey:["user-plan-enrollments"]}),Wn({title:"Plan enrollment updated"})}})},uae=(e=7)=>{const t=Pc();return Kt({queryKey:["contact-touch-logs",t,e],queryFn:async()=>{const s=new Date;s.setDate(s.getDate()-e);const{data:n,error:a}=await Y.from("contact_touch_logs").select(` *, contact:innercircle_contacts(*), action_type:action_types(*) `).gte("completed_at",s.toISOString()).order("completed_at",{ascending:!1});if(a)throw a;return n},enabled:!!t})},SRe=()=>{const e=Pc();return Kt({queryKey:["contacts-last-touch",e],queryFn:async()=>{const{data:t,error:s}=await Y.from("contact_touch_logs").select("contact_id, completed_at").order("completed_at",{ascending:!1});if(s)throw s;const n={};return t==null||t.forEach(a=>{n[a.contact_id]||(n[a.contact_id]=a.completed_at)}),n},enabled:!!e})},Qgt=(e=90)=>{const{data:t}=Np(),{data:s}=SRe();if(!t||!s)return{contacts:[],count:0};const n=new Date;n.setDate(n.getDate()-e);const a=t.filter(o=>{const l=s[o.id];return l?new Date(l){const e=Br(),t=Pc();return ar({mutationFn:async({contactId:s,actionTypeId:n,scriptUsedId:a,notes:o})=>{const{data:l,error:i}=await Y.from("contact_touch_logs").insert({owner_user_id:t,contact_id:s,action_type_id:n,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"]}),Wn({title:"Action completed!"})}})},MRe="agentos_weekly_touch_goal",XNe=20,ire=()=>{if(typeof window>"u")return XNe;const e=localStorage.getItem(MRe);if(e){const t=parseInt(e,10);if(!isNaN(t)&&t>0)return t}return XNe},TRe=e=>{localStorage.setItem(MRe,e.toString())},ARe=()=>{const{data:e}=uae(7),t=new Date;t.setHours(0,0,0,0);const s=new Date(t);s.setDate(t.getDate()-t.getDay());const n=(e==null?void 0:e.filter(l=>new Date(l.completed_at)>=s).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=ire();return{actionsThisWeek:n,weeklyGoal:o,streak:a,progress:Math.min(n/o*100,100)}},Jgt=()=>{const e=Pc();return Kt({queryKey:["contact-plan-cycles",e],queryFn:async()=>{const{data:t,error:s}=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(s)throw s;return t},enabled:!!e})},ext=()=>{const e=Br();return Pc(),ar({mutationFn:async()=>{const{data:t}=await Y.from("user_plan_enrollments").select("*").eq("active",!0);if(!t||t.length===0)return;const{data:s}=await Y.from("innercircle_contacts").select(` id, tags:innercircle_contact_tags(relationship_type_id) `);if(!s)return;const{data:n}=await Y.from("contact_plan_cycles").select("contact_id, plan_id"),a=new Set((n==null?void 0:n.map(l=>`${l.contact_id}-${l.plan_id}`))||[]),o=[];for(const l of s)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&&Wn({title:`${t} contact(s) enrolled in plans`})}})},ERe=()=>{const e=Pc(),{data:t}=Jgt(),{data:s}=uae(30);return Kt({queryKey:["today-actions",e,t==null?void 0:t.length,s==null?void 0:s.length],queryFn:async()=>{var N;if(!t||t.length===0)return[];const{data:n}=await Y.from("contact_snoozes").select("contact_id").gte("snoozed_until",new Date().toISOString()),a=new Set((n==null?void 0:n.map(k=>k.contact_id))||[]),o=new Date,l=[],i=new Date(o.getFullYear(),o.getMonth(),1),u=new Set((s==null?void 0:s.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(R=>R.month_number===T);if(P&&P.action_type){const R=`${k.contact_id}-${P.action_type_id}`;if(!u.has(R)){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 txt(){const e=Hs(),{data:t,isLoading:s}=ERe(),{data:n}=Np(),a=ARe(),[o,l]=A.useState(ire()),[i,u]=A.useState(""),[m,x]=A.useState(!1);A.useEffect(()=>{l(ire())},[]);const y=()=>{const U=parseInt(i,10);if(isNaN(U)||U<1){Wn({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}l(U),TRe(U),x(!1),Wn({title:"Goal updated",description:`Weekly touch goal set to ${U}`})},v=()=>{u(o.toString()),x(!0)},b=Cm(new Date),N=Jl(b,7),k=U=>{if(!U)return null;const q=U.split(/[-/T]/);if(q.length<3)return null;const H=parseInt(q[1],10)-1,G=parseInt(q[2],10);return isNaN(H)||isNaN(G)?null:new Date(b.getFullYear(),H,G)},M=(n==null?void 0:n.map(U=>{const q=k(U.birthday),H=k(U.home_anniversary),G=[];return q&&q>=b&&q<=N&&G.push({contact:U,type:"birthday",date:q,isToday:ic(q,b)}),H&&H>=b&&H<=N&&G.push({contact:U,type:"anniversary",date:H,isToday:ic(H,b)}),G}).flat().sort((U,q)=>U.date.getTime()-q.date.getTime()).slice(0,3))||[],E=(n==null?void 0:n.filter(U=>{const q=k(U.birthday),H=k(U.home_anniversary);return q&&ic(q,b)||H&&ic(H,b)}).length)||0,T=(t==null?void 0:t.length)||0,P=E+T,R=(a==null?void 0:a.actionsThisWeek)||0,D=(a==null?void 0:a.streak)||0;return s?r.jsx(He,{className:"bg-gradient-to-br from-primary/5 via-primary/10 to-primary/5 border-primary/20",children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"animate-pulse flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 bg-primary/20 rounded-lg"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("div",{className:"h-4 bg-primary/20 rounded w-1/3"}),r.jsx("div",{className:"h-3 bg-primary/10 rounded w-1/2"})]})]})})}):r.jsxs(He,{className:"bg-gradient-to-br from-primary/5 via-primary/10 to-primary/5 border-primary/20",children:[r.jsxs(Vt,{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(qs,{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(gm,{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",R>0&&r.jsxs("span",{className:"ml-2",children:["• ",r.jsx("span",{className:"text-emerald-600 font-medium",children:R})," touches this week"]})]})]}),r.jsxs(Xe,{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(wu,{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(Pi,{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(Ta,{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(po,{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(vo,{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(Pr,{className:"sm:max-w-[360px]",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Set Weekly Goal"}),r.jsx(Zs,{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(ot,{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:R}),r.jsxs("span",{className:"text-muted-foreground",children:[" / ",o," touches"]})]})]}),r.jsx(lc,{value:Math.min(R/o*100,100),className:"h-2 bg-muted [&>div]:bg-primary"}),R>=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."]}),R0&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1.5",children:[o-R," 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,q)=>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:H=>{H.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(sa,{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"?"🎂":"🏠":rs(U.date,"EEE, MMM d")}),r.jsx(Zi,{className:"h-3 w-3"})]})]},`${U.contact.id}-${U.type}-${q}`))})]}),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(to,{className:"h-4 w-4"})]})]})]})}const IRe=()=>Kt({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}}),PRe=e=>{const{user:t,brokerageId:s}=Yr();return Kt({queryKey:["listings",e,s],queryFn:async()=>{let n=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&&(n=n.eq("status",e.status)),e!=null&&e.propertyType&&(n=n.eq("property_type",e.propertyType)),e!=null&&e.city&&(n=n.ilike("city",`%${e.city}%`)),e!=null&&e.minPrice&&(n=n.gte("price",e.minPrice)),e!=null&&e.maxPrice&&(n=n.lte("price",e.maxPrice)),e!=null&&e.openToReferrals&&(n=n.eq("open_to_referrals",!0));const{data:a,error:o}=await n;if(o)throw o;let l=a||[];if(s){const{data:i}=await Y.from("profiles").select("id").eq("brokerage_id",s);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}})},LRe=()=>{const{user:e}=Yr();return Kt({queryKey:["my-listings",e==null?void 0:e.id],queryFn:async()=>{if(!e)return[];const{data:t,error:s}=await Y.from("listings").select(` *, photos:listing_photos(*) `).eq("agent_id",e.id).order("created_at",{ascending:!1});if(s)throw s;return t},enabled:!!e})},ORe=e=>{const{user:t}=Yr();return Kt({queryKey:["listing",e],queryFn:async()=>{const{data:s,error:n}=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(n)throw n;return t&&await Y.from("listing_views").insert({listing_id:e,viewer_id:t.id}),s},enabled:!!e})},rxt=()=>{const e=Br(),{user:t}=Yr();return ar({mutationFn:async s=>{if(!t)throw new Error("Not authenticated");const{data:n,error:a}=await Y.from("listings").insert({...s,agent_id:t.id}).select().single();if(a)throw a;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["listings"]}),e.invalidateQueries({queryKey:["my-listings"]})}})},sxt=()=>{const e=Br();return ar({mutationFn:async({agentId:t,...s})=>{const{data:n,error:a}=await Y.from("listings").insert({...s,agent_id:t}).select().single();if(a)throw a;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["listings"]}),e.invalidateQueries({queryKey:["my-listings"]}),e.invalidateQueries({queryKey:["brokerage-listings"]})}})},nxt=()=>{const e=Br();return ar({mutationFn:async({id:t,...s})=>{const{data:n,error:a}=await Y.from("listings").update(s).eq("id",t).select().single();if(a)throw a;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["listings"]}),e.invalidateQueries({queryKey:["my-listings"]}),e.invalidateQueries({queryKey:["listing",t.id]})}})},DRe=()=>{const e=Br();return ar({mutationFn:async t=>{const{error:s}=await Y.from("listings").delete().eq("id",t);if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["listings"]}),e.invalidateQueries({queryKey:["my-listings"]})}})},axt=()=>{const e=Br();return ar({mutationFn:async({listingId:t,photoUrl:s,isPrimary:n=!1})=>{const{data:a,error:o}=await Y.from("listing_photos").insert({listing_id:t,photo_url:s,is_primary:n}).select().single();if(o)throw o;return a},onSuccess:t=>{e.invalidateQueries({queryKey:["listing",t.listing_id]}),e.invalidateQueries({queryKey:["my-listings"]})}})},ixt=()=>{const e=Br();return ar({mutationFn:async({photoId:t,listingId:s})=>{const{error:n}=await Y.from("listing_photos").delete().eq("id",t);if(n)throw n;return s},onSuccess:t=>{e.invalidateQueries({queryKey:["listing",t]}),e.invalidateQueries({queryKey:["my-listings"]})}})},oxt=()=>{const{user:e}=Yr();return Kt({queryKey:["saved-listings",e==null?void 0:e.id],queryFn:async()=>{if(!e)return[];const{data:t,error:s}=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(s)throw s;return t},enabled:!!e})},RRe=()=>{const e=Br(),{user:t}=Yr();return ar({mutationFn:async s=>{if(!t)throw new Error("Not authenticated");const{data:n}=await Y.from("listing_saves").select("id").eq("listing_id",s).eq("agent_id",t.id).maybeSingle();return n?(await Y.from("listing_saves").delete().eq("id",n.id),{saved:!1}):(await Y.from("listing_saves").insert({listing_id:s,agent_id:t.id}),{saved:!0})},onSuccess:()=>{e.invalidateQueries({queryKey:["saved-listings"]}),e.invalidateQueries({queryKey:["listings"]})}})},FRe=e=>{const{user:t}=Yr();return Kt({queryKey:["listing-saved",e,t==null?void 0:t.id],queryFn:async()=>{if(!t)return!1;const{data:s}=await Y.from("listing_saves").select("id").eq("listing_id",e).eq("agent_id",t.id).maybeSingle();return!!s},enabled:!!t&&!!e})},lxt=()=>{const e=Br(),{user:t}=Yr();return ar({mutationFn:async s=>{if(!t)throw new Error("Not authenticated");const{data:n}=await Y.from("listing_follows").select("id").eq("listing_id",s).eq("agent_id",t.id).maybeSingle();return n?(await Y.from("listing_follows").delete().eq("id",n.id),{following:!1}):(await Y.from("listing_follows").insert({listing_id:s,agent_id:t.id}),{following:!0})},onSuccess:()=>{e.invalidateQueries({queryKey:["listing-following"]})}})},cxt=e=>{const{user:t}=Yr();return Kt({queryKey:["listing-following",e,t==null?void 0:t.id],queryFn:async()=>{if(!t)return!1;const{data:s}=await Y.from("listing_follows").select("id").eq("listing_id",e).eq("agent_id",t.id).maybeSingle();return!!s},enabled:!!t&&!!e})},dxt=()=>{const{user:e}=Yr();return ar({mutationFn:async({listingId:t,shareType:s})=>{if(!e)throw new Error("Not authenticated");const{error:n}=await Y.from("listing_shares").insert({listing_id:t,sharing_agent_id:e.id,share_type:s});if(n)throw n}})},uxt=()=>{const{user:e}=Yr();return Kt({queryKey:["my-referrals",e==null?void 0:e.id],queryFn:async()=>{if(!e)return{sent:[],received:[]};const[t,s]=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:s.data||[]}},enabled:!!e})},hxt=()=>{const e=Br(),{user:t}=Yr();return ar({mutationFn:async({listingId:s,listingAgentId:n,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:s,sender_agent_id:t.id,listing_agent_id:n,buyer_name:a,buyer_type:o,notes:l}).select().single();if(u)throw u;return i},onSuccess:()=>{e.invalidateQueries({queryKey:["my-referrals"]})}})},mxt=()=>Kt({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 s=Array.from(t.entries()).map(([l,i])=>({agentId:l,...i})).sort((l,i)=>i.count-l.count).slice(0,10),{data:n}=await Y.from("listings").select("agent_id, agent:profiles!listings_agent_id_fkey(name)").eq("is_approved",!0),a=new Map;n==null||n.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:s,topListers:o}}}),pxt=()=>{const{user:e,brokerageId:t}=Yr();return Kt({queryKey:["brokerage-listings",t],queryFn:async()=>{if(!e||!t)return[];const{data:s}=await Y.from("profiles").select("id").eq("brokerage_id",t);if(!s||s.length===0)return[];const n=s.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",n).eq("is_approved",!0).order("created_at",{ascending:!1});if(o)throw o;return a},enabled:!!e&&!!t})},zRe=({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"}),fxt={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"},gxt={coming_soon:"Coming Soon",active:"Active",under_contract:"Under Contract",sold:"Sold",withdrawn:"Withdrawn"};function xxt(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:`$${(e/1e3).toFixed(0)}K`}function yxt(){const e=Hs(),{data:t,isLoading:s}=IRe(),{data:n,isLoading:a}=PRe({status:void 0,propertyType:void 0,sortBy:"newest"}),o=(n==null?void 0:n.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=s||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(Xe,{className:"p-4",children:r.jsxs("div",{className:"animate-pulse flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 bg-emerald-500/20 rounded-lg"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("div",{className:"h-4 bg-emerald-500/20 rounded w-1/3"}),r.jsx("div",{className:"h-3 bg-emerald-500/10 rounded w-1/2"})]})]})})}):r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Listing Exchange"}),r.jsx(zRe,{})]}),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(to,{className:"h-4 w-4"})]})]}),u.length===0?r.jsx(He,{className:"bg-muted/30 border-dashed",children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(sa,{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(sa,{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(Mn,{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 ${fxt[x.status]}`,children:gxt[x.status]})})]}),r.jsxs("div",{className:"p-2",children:[r.jsx("p",{className:"font-bold text-sm text-foreground",children:xxt(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 BRe(e=10,t){return Kt({queryKey:["event-leaderboard",e,t],queryFn:async()=>{const{data:s}=await Y.from("user_roles").select("user_id").eq("role","admin"),n=new Set((s==null?void 0:s.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+n.size+50);if(l)throw l;if(!o||o.length===0)return[];let i=o.filter(v=>!n.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 $Re(e){return Kt({queryKey:["user-attendance-stats",e],queryFn:async()=>{if(!e)return null;const{data:t,error:s}=await Y.from("agent_attendance_stats").select("*").eq("user_id",e).single();if(s&&s.code!=="PGRST116")throw s;return t},enabled:!!e})}function URe(e){return Kt({queryKey:["user-badges",e],queryFn:async()=>{if(!e)return[];const{data:t,error:s}=await Y.from("agent_badges").select("*").eq("user_id",e).order("earned_at",{ascending:!1});if(s)throw s;return t},enabled:!!e})}function qRe(e,t){return Kt({queryKey:["user-rank",e,t],queryFn:async()=>{if(!e)return null;const{data:s}=await Y.from("agent_attendance_stats").select("total_points").eq("user_id",e).single();if(!s)return null;const{data:n}=await Y.from("user_roles").select("user_id").eq("role","admin"),a=new Set((n==null?void 0:n.map(u=>u.user_id))||[]),{data:o,error:l}=await Y.from("agent_attendance_stats").select("user_id, total_points").gt("total_points",s.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 vxt(){const{user:e,brokerageId:t,isAdmin:s}=Yr();Hs();const n=!!t,[a,o]=A.useState("brokerage"),l=()=>{if(s)return null;if(n)return a==="global"?null:t},{data:i,isLoading:u}=BRe(5,l()),{data:m}=$Re(e==null?void 0:e.id),{data:x}=qRe(e==null?void 0:e.id,l()),{data:y}=URe(e==null?void 0:e.id),v=s||n,b=()=>s?"Agent Leaderboard":n?a==="global"?"All LevelUp":"My Brokerage":"My Points";if(u)return r.jsxs(He,{children:[r.jsx(Vt,{className:"pb-2",children:r.jsxs(Gt,{className:"text-base flex items-center gap-2",children:[r.jsx(lo,{className:"h-4 w-4 text-yellow-500"}),b()]})}),r.jsx(Xe,{children:r.jsx("div",{className:"space-y-2",children:[...Array(v?5:3)].map((k,M)=>r.jsx(Cr,{className:"h-10 w-full"},M))})})]});const N=k=>k===0?r.jsx(lo,{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(Vt,{className:"pb-2",children:[r.jsxs(Gt,{className:"text-base flex items-center gap-2",children:[r.jsx(lo,{className:"h-4 w-4 text-yellow-500"}),b()]}),!s&&n&&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(Xe,{children:[!s&&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,E)=>{var T,P,R;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":E===0?"bg-yellow-500/10":""}`,children:[r.jsx("div",{className:"w-5 text-center",children:N(E)}),r.jsx(Xn,{className:"h-6 w-6",children:r.jsx(Qn,{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:((R=M.profile)==null?void 0:R.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(ho,{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(oo,{className:"h-4 w-4"}),"Spend Points in Reward Store",r.jsx(Zi,{className:"h-4 w-4"})]})]})]})}return r.jsxs(He,{children:[r.jsx(Vt,{className:"pb-2",children:r.jsxs(Gt,{className:"text-base flex items-center gap-2",children:[r.jsx(lo,{className:"h-4 w-4 text-yellow-500"}),"My Points"]})}),r.jsx(Xe,{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(gm,{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($l,{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(ho,{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(oo,{className:"h-4 w-4"}),"Spend Points in Reward Store",r.jsx(Zi,{className:"h-4 w-4"})]})]}):r.jsxs("div",{className:"text-center text-muted-foreground py-4 text-sm",children:[r.jsx(Mn,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground/50"}),r.jsx("p",{children:"Attend events to earn points!"}),r.jsxs(ho,{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(oo,{className:"h-4 w-4"}),"Visit Reward Store",r.jsx(Zi,{className:"h-4 w-4"})]})]})})]})}const hae=()=>Kt({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}}),_xt=()=>{const e=Br(),{user:t}=Yr();return ar({mutationFn:async s=>{const{data:n,error:a}=await Y.from("lead_sources").insert({name:s,owner_user_id:t==null?void 0:t.id,sort_order:100}).select().single();if(a)throw a;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["lead-sources"]}),Te.success("Lead source added")},onError:s=>{Te.error("Failed to add lead source"),console.error(s)}})},$ye=(e,t)=>{const{user:s,isAdmin:n}=Yr(),a=n&&t?t:s==null?void 0:s.id;return Kt({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})},VRe=e=>{const{user:t,isAdmin:s}=Yr(),n=s&&e?e:t==null?void 0:t.id;return Kt({queryKey:["scorecard-transactions-all",n],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",n).order("close_date",{ascending:!1});if(o)throw o;return a},enabled:!!n})},mae=()=>{const e=Br(),{user:t}=Yr();return ar({mutationFn:async s=>{const{data:n,error:a}=await Y.from("scorecard_transactions").insert({...s,owner_user_id:t.id}).select().single();if(a)throw a;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["scorecard-transactions"]}),e.invalidateQueries({queryKey:["scorecard-transactions-all"]}),Te.success("Transaction added")},onError:s=>{Te.error("Failed to add transaction"),console.error(s)}})},bxt=()=>{const e=Br();return ar({mutationFn:async({id:t,...s})=>{const{data:n,error:a}=await Y.from("scorecard_transactions").update(s).eq("id",t).select().single();if(a)throw a;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["scorecard-transactions"]}),e.invalidateQueries({queryKey:["scorecard-transactions-all"]}),Te.success("Transaction updated")},onError:t=>{Te.error("Failed to update transaction"),console.error(t)}})},wxt=()=>{const e=Br();return ar({mutationFn:async t=>{const{error:s}=await Y.from("scorecard_transactions").delete().eq("id",t);if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["scorecard-transactions"]}),e.invalidateQueries({queryKey:["scorecard-transactions-all"]}),Te.success("Transaction deleted")},onError:t=>{Te.error("Failed to delete transaction"),console.error(t)}})},HRe=(e,t)=>{const{user:s,isAdmin:n}=Yr(),a=n&&t?t:s==null?void 0:s.id;return Kt({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})},jxt=()=>{const e=Br(),{user:t}=Yr();return ar({mutationFn:async s=>{const{data:n,error:a}=await Y.from("scorecard_goals").upsert({...s,owner_user_id:t.id},{onConflict:"owner_user_id,year"}).select().single();if(a)throw a;return n},onSuccess:(s,n)=>{e.invalidateQueries({queryKey:["scorecard-goals",n.year]}),Te.success("Goals saved")},onError:s=>{Te.error("Failed to save goals"),console.error(s)}})},pae=()=>{const{user:e}=Yr();return Kt({queryKey:["scorecard-settings",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:s}=await Y.from("scorecard_settings").select("*").eq("user_id",e.id).maybeSingle();if(s)throw s;return t},enabled:!!(e!=null&&e.id)})},kxt=()=>{const e=Br(),{user:t}=Yr();return ar({mutationFn:async s=>{const{data:n,error:a}=await Y.from("scorecard_settings").upsert({...s,user_id:t.id},{onConflict:"user_id"}).select().single();if(a)throw a;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["scorecard-settings"]}),Te.success("Settings saved")},onError:s=>{Te.error("Failed to save settings"),console.error(s)}})},WRe=(e,t)=>{const{data:s,isLoading:n}=$ye(e,t),{data:a,isLoading:o}=VRe(t),{data:l}=pae(),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(R=>R.transaction_type==="buyer").length,y=m.filter(R=>R.transaction_type==="seller").length,v=m.reduce((R,D)=>R+Number(D.sale_price),0),b=m.reduce((R,D)=>R+(Number(D.commission_amount)||0),0),N={};m.forEach(R=>{var U;const D=((U=R.lead_source)==null?void 0:U.name)||"Unknown";N[D]=(N[D]||0)+1});const k=Object.entries(N).map(([R,D])=>({name:R,count:D})).sort((R,D)=>D.count-R.count),M=k[0]||null,E={};m.forEach(R=>{const D=new Date(R.close_date).toLocaleString("default",{month:"short"});E[D]=(E[D]||0)+1});const P=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"].map(R=>({month:R,count:E[R]||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(s),lifetimeStats:u(a),isLoading:n||o,showCommission:i}},Nxt=()=>{const{isAdmin:e}=Yr();return Kt({queryKey:["agents-with-transactions"],queryFn:async()=>{const{data:t,error:s}=await Y.from("scorecard_transactions").select("owner_user_id").order("owner_user_id");if(s)throw s;const n=[...new Set(t.map(l=>l.owner_user_id))],{data:a,error:o}=await Y.from("profiles").select("id, name, email").in("id",n);if(o)throw o;return a},enabled:e})},J0={recency:40,touchpoints:30,transactions:20},QNe={warm:70,cooling:40};function Sxt(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 Cxt(e){const t=Math.min(e/12,1);return Math.round(J0.touchpoints*t)}function Mxt(e){return e?J0.transactions:0}function Txt(){return 0}function Axt(e){return e>=QNe.warm?"warm":e>=QNe.cooling?"cooling":"at-risk"}function Uye(){const{data:e,isLoading:t}=Np(),{data:s}=SRe(),{data:n}=uae(365),{data:a}=VRe(),o=A.useMemo(()=>{if(!e)return[];const i=new Date,u=Pht(i),m={};n==null||n.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=(s==null?void 0:s[y.id])||null,b=v?Py(i,new Date(v)):null,N=m[y.id]||0,k=x.has(y.id),M=Sxt(b),E=Cxt(N),T=Mxt(k),P=Txt(),R=Math.round(M+E+T+P),D={score:R,status:Axt(R),breakdown:{recency:Math.round(M),touchpoints:Math.round(E),transactions:Math.round(T),referrals:Math.round(P)},lastTouchDate:v,daysSinceTouch:b,touchCountLast12Months:N,hasTransaction:k};return{...y,relationshipScore:D}})},[e,s,n,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 GRe(){const e=Hs(),{stats:t,contactsWithScores:s,isLoading:n}=Uye();if(n)return r.jsxs(He,{children:[r.jsx(Vt,{className:"pb-2",children:r.jsx(Cr,{className:"h-5 w-40"})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsx(Cr,{className:"h-20 w-full"}),r.jsx(Cr,{className:"h-16 w-full"})]})]});if(t.total===0)return r.jsxs(He,{children:[r.jsx(Vt,{className:"pb-2",children:r.jsxs(Gt,{className:"text-lg flex items-center gap-2",children:[r.jsx(qs,{className:"h-5 w-5"}),"Relationship Health"]})}),r.jsxs(Xe,{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Add contacts to see your relationship health scores."}),r.jsx(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=s.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(Vt,{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(bu,{className:"h-5 w-5 text-emerald-500"}),"Relationship Health"]}),r.jsx("span",{className:"text-2xl font-bold",children:t.averageScore})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Average score across ",t.total," contacts"]})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-emerald-500"}),r.jsx("span",{children:"Warm"})]}),r.jsxs("span",{className:"font-medium",children:[t.warm," (",a,"%)"]})]}),r.jsx(lc,{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(lc,{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(lc,{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(Gj,{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(Zi,{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(Zi,{className:"h-4 w-4 ml-1"})]})]})]})}const Ext=()=>{var oe;const{user:e,isAdmin:t}=Yr(),s=Hs(),[n,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),[E,T]=A.useState([]),[P,R]=A.useState([]),[D,U]=A.useState([]),[q,H]=A.useState(null),[G,Q]=A.useState(!0);A.useEffect(()=>{ne()},[e]);const ne=async()=>{var ce,de,xe,Me,ve;try{const[be,we,tt,Ae,Le,Ue,Pe,$e,it,xt,Ee]=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"),Y.from("profiles").select("name").eq("id",e==null?void 0:e.id).single()]);(ce=Ee.data)!=null&&ce.name&&H(Ee.data.name);const et=((de=be.data)==null?void 0:de.map(lt=>lt.tag))||[],le=new Set(((xe=tt.data)==null?void 0:xe.map(lt=>lt.app_id))||[]);M(le);const Je=(((Me=we.data)==null?void 0:Me.filter(lt=>!lt.required_tags||lt.required_tags.length===0?!0:lt.required_tags.some(Ce=>et.includes(Ce))))||[]).sort((lt,Ce)=>lt.name==="LevelUp Members Portal"?-1:Ce.name==="LevelUp Members Portal"?1:0);a(Je.slice(0,6));const rt=((ve=Ae.data)==null?void 0:ve.filter(lt=>tC(lt.event_date)!=="ended"))||[];l(rt.slice(0,4)),T(Le.data||[]),u(Ue.data||[]),x(Pe.data||[]),v($e.data||[]),N(it.data||[]);const je=xt.data||[];R(je.filter(lt=>lt.placement==="top")),U(je.filter(lt=>lt.placement==="between"))}catch(be){console.error("Error loading dashboard:",be),Te.error("Failed to load dashboard data")}finally{Q(!1)}},ie=async ce=>{var xe;const de=window.open("about:blank","_blank");try{await Y.from("activity_logs").insert({user_id:e==null?void 0:e.id,app_id:ce.app_id,app_name:ce.name,user_agent:navigator.userAgent});const{data:Me,error:ve}=await Y.functions.invoke("sso-launch",{body:{app_id:ce.app_id}});if(ve)throw ve;Me!=null&&Me.redirect_url?de&&!de.closed?(de.location.href=Me.redirect_url,(xe=de.focus)==null||xe.call(de)):window.location.assign(Me.redirect_url):(de==null||de.close(),Te.error("Launch link unavailable"))}catch(Me){de==null||de.close(),console.error("Error launching app:",Me),Te.error("Failed to launch app")}},he=ce=>E==null?void 0:E.some(de=>de.event_id===ce),se=ce=>{const de=E==null?void 0:E.find(xe=>xe.event_id===ce);return de==null?void 0:de.zoom_join_url};if(G)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 fe=ce=>D.filter(de=>de.section_after===ce);return r.jsxs(Dr,{title:"Dashboard",children:[r.jsx(Tgt,{events:o,registrations:E,onNavigateToEvents:()=>s("/events")}),P.length>0&&r.jsx("div",{className:"mb-8",children:r.jsx(gT,{banners:P})}),r.jsx(Bgt,{}),r.jsxs("div",{className:"mb-6",children:[r.jsxs("h2",{className:"text-2xl font-bold text-foreground",children:["Welcome back, ",(q||((oe=e==null?void 0:e.user_metadata)==null?void 0:oe.name)||"there").split(" ")[0],"!"]}),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(txt,{}),r.jsx(GRe,{}),r.jsx(vxt,{})]}),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:()=>s("/events"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(to,{className:"h-4 w-4"})]})]}),o.length===0?r.jsx(He,{className:"bg-muted/30 border-dashed",children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(jn,{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(ce=>{const de=he(ce.id),xe=se(ce.id)||ce.zoom_link;return r.jsxs("div",{className:`flex items-start gap-3 sm:gap-4 p-3 sm:p-4 hover:bg-muted/50 transition-colors cursor-pointer group ${KNe(ce.event_date)?"bg-red-500/5 border-l-2 border-l-red-500":""}`,onClick:()=>s("/events"),children:[KNe(ce.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(Wj,{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(ce.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(ce.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:ce.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(ce.event_date))," at ",UE(new Date(ce.event_date))]})]}),r.jsx("div",{className:"hidden sm:flex flex-shrink-0",children:de?r.jsxs(X,{size:"sm",variant:"default",className:"gap-1",onClick:Me=>{Me.stopPropagation(),window.open(xe,"_blank")},children:[r.jsx(Sn,{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(Zi,{className:"h-4 w-4"})]})})]},ce.id)})})]}),fe("events").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(gT,{banners:fe("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:()=>s("/academy"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(to,{className:"h-4 w-4"})]})]}),y.length===0?r.jsx(He,{className:"bg-muted/30 border-dashed",children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(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 academy videos available"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:y.map(ce=>r.jsxs("div",{onClick:()=>s(`/academy/${ce.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:[ce.thumbnail_url?r.jsx("img",{src:ce.thumbnail_url,alt:ce.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(ap,{className:"h-8 w-8 text-muted-foreground/50"})}),ce.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:ce.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:ce.title})})]},ce.id))})]}),fe("academy").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(gT,{banners:fe("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:()=>s("/toolbox"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(to,{className:"h-4 w-4"})]})]}),m.length===0?r.jsx(He,{className:"bg-muted/30 border-dashed",children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(If,{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(ce=>r.jsxs("div",{onClick:()=>s(`/toolbox/${ce.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:ce.featured_image_url?r.jsx("img",{src:ce.featured_image_url,alt:ce.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(If,{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:ce.name})})]},ce.id))})]}),fe("toolbox").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(gT,{banners:fe("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:()=>s("/templates"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(to,{className:"h-4 w-4"})]})]}),i.length===0?r.jsx(He,{className:"bg-muted/30 border-dashed",children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(H1,{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(ce=>r.jsxs("div",{onClick:()=>s("/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:ce.preview_image_url?r.jsx("img",{src:ce.preview_image_url,alt:ce.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(H1,{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:ce.name})})]},ce.id))})]}),fe("templates").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(gT,{banners:fe("templates")})}),r.jsx("div",{className:"mb-10",children:r.jsx(yxt,{})}),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:()=>s("/apps"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(to,{className:"h-4 w-4"})]})]}),n.length===0?r.jsx(He,{className:"bg-muted/30 border-dashed",children:r.jsx(Xe,{className:"flex items-center justify-center py-12",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Tf,{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:n.map(ce=>{const de=k.has(ce.id);return r.jsxs("div",{onClick:()=>ie(ce),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:ce.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:ce.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:ce.description})]}),de&&r.jsx(Tf,{className:"h-5 w-5 text-primary fill-current flex-shrink-0"})]},ce.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:()=>s("/additional-services"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(to,{className:"h-4 w-4"})]})]}),b.length===0?r.jsx(He,{className:"bg-muted/30 border-dashed",children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Bn,{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(ce=>r.jsxs("div",{onClick:()=>window.open(ce.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:ce.preview_image_url?r.jsx("img",{src:ce.preview_image_url,alt:ce.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(Bn,{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:ce.name}),ce.description&&r.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:ce.description})]})]},ce.id))})]})]})};var fae="Switch",[Ixt]=uc(fae),[Pxt,Lxt]=Ixt(fae),KRe=A.forwardRef((e,t)=>{const{__scopeSwitch:s,name:n,checked:a,defaultChecked:o,required:l,disabled:i,value:u="on",onCheckedChange:m,form:x,...y}=e,[v,b]=A.useState(null),N=ha(t,P=>b(P)),k=A.useRef(!1),M=v?x||!!v.closest("form"):!0,[E,T]=ah({prop:a,defaultProp:o??!1,onChange:m,caller:fae});return r.jsxs(Pxt,{scope:s,checked:E,disabled:i,children:[r.jsx($s.button,{type:"button",role:"switch","aria-checked":E,"aria-required":l,"data-state":QRe(E),"data-disabled":i?"":void 0,disabled:i,value:u,...y,ref:N,onClick:xs(e.onClick,P=>{T(R=>!R),M&&(k.current=P.isPropagationStopped(),k.current||P.stopPropagation())})}),M&&r.jsx(XRe,{control:v,bubbles:!k.current,name:n,value:u,checked:E,required:l,disabled:i,form:x,style:{transform:"translateX(-100%)"}})]})});KRe.displayName=fae;var ZRe="SwitchThumb",YRe=A.forwardRef((e,t)=>{const{__scopeSwitch:s,...n}=e,a=Lxt(ZRe,s);return r.jsx($s.span,{"data-state":QRe(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:t})});YRe.displayName=ZRe;var Oxt="SwitchBubbleInput",XRe=A.forwardRef(({__scopeSwitch:e,control:t,checked:s,bubbles:n=!0,...a},o)=>{const l=A.useRef(null),i=ha(l,o),u=hP(s),m=JI(t);return A.useEffect(()=>{const x=l.current;if(!x)return;const y=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(y,"checked").set;if(u!==s&&b){const N=new Event("click",{bubbles:n});b.call(x,s),x.dispatchEvent(N)}},[u,s,n]),r.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:s,...a,tabIndex:-1,ref:i,style:{...a.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});XRe.displayName=Oxt;function QRe(e){return e?"checked":"unchecked"}var JRe=KRe,Dxt=YRe;const In=A.forwardRef(({className:e,...t},s)=>r.jsx(JRe,{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:s,children:r.jsx(Dxt,{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")})}));In.displayName=JRe.displayName;var eFe="AlertDialog",[Rxt]=uc(eFe,[wOe]),Hy=wOe(),tFe=e=>{const{__scopeAlertDialog:t,...s}=e,n=Hy(t);return r.jsx(Dne,{...n,...s,modal:!0})};tFe.displayName=eFe;var Fxt="AlertDialogTrigger",rFe=A.forwardRef((e,t)=>{const{__scopeAlertDialog:s,...n}=e,a=Hy(s);return r.jsx(eye,{...a,...n,ref:t})});rFe.displayName=Fxt;var zxt="AlertDialogPortal",sFe=e=>{const{__scopeAlertDialog:t,...s}=e,n=Hy(t);return r.jsx(Rne,{...n,...s})};sFe.displayName=zxt;var Bxt="AlertDialogOverlay",nFe=A.forwardRef((e,t)=>{const{__scopeAlertDialog:s,...n}=e,a=Hy(s);return r.jsx(O3,{...a,...n,ref:t})});nFe.displayName=Bxt;var rC="AlertDialogContent",[$xt,Uxt]=Rxt(rC),qxt=aIe("AlertDialogContent"),aFe=A.forwardRef((e,t)=>{const{__scopeAlertDialog:s,children:n,...a}=e,o=Hy(s),l=A.useRef(null),i=ha(t,l),u=A.useRef(null);return r.jsx(Ult,{contentName:rC,titleName:iFe,docsSlug:"alert-dialog",children:r.jsx($xt,{scope:s,cancelRef:u,children:r.jsxs(D3,{role:"alertdialog",...o,...a,ref:i,onOpenAutoFocus:xs(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(qxt,{children:n}),r.jsx(Hxt,{contentRef:l})]})})})});aFe.displayName=rC;var iFe="AlertDialogTitle",oFe=A.forwardRef((e,t)=>{const{__scopeAlertDialog:s,...n}=e,a=Hy(s);return r.jsx(dP,{...a,...n,ref:t})});oFe.displayName=iFe;var lFe="AlertDialogDescription",cFe=A.forwardRef((e,t)=>{const{__scopeAlertDialog:s,...n}=e,a=Hy(s);return r.jsx(uP,{...a,...n,ref:t})});cFe.displayName=lFe;var Vxt="AlertDialogAction",dFe=A.forwardRef((e,t)=>{const{__scopeAlertDialog:s,...n}=e,a=Hy(s);return r.jsx(Fne,{...a,...n,ref:t})});dFe.displayName=Vxt;var uFe="AlertDialogCancel",hFe=A.forwardRef((e,t)=>{const{__scopeAlertDialog:s,...n}=e,{cancelRef:a}=Uxt(uFe,s),o=Hy(s),l=ha(t,a);return r.jsx(Fne,{...o,...n,ref:l})});hFe.displayName=uFe;var Hxt=({contentRef:e})=>{const t=`\`${rC}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${rC}\` by passing a \`${lFe}\` 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 \`${rC}\`. 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 n;document.getElementById((n=e.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Wxt=tFe,Gxt=rFe,Kxt=sFe,mFe=nFe,pFe=aFe,fFe=dFe,gFe=hFe,xFe=oFe,yFe=cFe;const Dd=Wxt,Nf=Gxt,Zxt=Kxt,vFe=A.forwardRef(({className:e,...t},s)=>r.jsx(mFe,{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:s}));vFe.displayName=mFe.displayName;const ld=A.forwardRef(({className:e,...t},s)=>r.jsxs(Zxt,{children:[r.jsx(vFe,{}),r.jsx(pFe,{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),...t})]}));ld.displayName=pFe.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},s)=>r.jsx(xFe,{ref:s,className:Ut("text-lg font-semibold",e),...t}));ud.displayName=xFe.displayName;const hd=A.forwardRef(({className:e,...t},s)=>r.jsx(yFe,{ref:s,className:Ut("text-sm text-muted-foreground",e),...t}));hd.displayName=yFe.displayName;const Vc=A.forwardRef(({className:e,...t},s)=>r.jsx(fFe,{ref:s,className:Ut(DE(),e),...t}));Vc.displayName=fFe.displayName;const md=A.forwardRef(({className:e,...t},s)=>r.jsx(gFe,{ref:s,className:Ut(DE({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));md.displayName=gFe.displayName;const Yxt=[{key:"contacts",label:"Contacts",icon:Pi,description:"View, add, and edit contacts"},{key:"pipeline",label:"Deal Pipeline",icon:Bj,description:"View, add, and move deals"},{key:"videos",label:"Videos",icon:Ta,description:"View and upload videos"},{key:"listings",label:"Listings",icon:sa,description:"View, create, and edit listings"},{key:"scorecard",label:"Scorecard",icon:cA,description:"View and add transactions"},{key:"popbys",label:"Pop-bys",icon:po,description:"View and log pop-bys"}];function Xxt(){var D;const{user:e}=Yr(),[t,s]=A.useState([]),[n,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&&E()},[e]);const E=async()=>{if(e){a(!0);try{const{data:U,error:q}=await Y.from("agent_assistant_assignments").select("id, assistant_id, permissions, created_at").eq("agent_id",e.id);if(q)throw q;if(U&&U.length>0){const H=U.map(ne=>ne.assistant_id),{data:G}=await Y.from("profiles").select("id, name, email").in("id",H),Q=U.map(ne=>{const ie=G==null?void 0:G.find(he=>he.id===ne.assistant_id);return{...ne,permissions:ne.permissions,assistant_profile:ie?{name:ie.name||"",email:ie.email||""}:void 0}});s(Q)}else s([])}catch(U){console.error("Error loading assistants:",U)}finally{a(!1)}}},T=async()=>{if(!e||!y.email.trim()||!y.name.trim()||!y.password.trim()){Te.error("Please fill in all fields");return}if(y.password.length<6){Te.error("Password must be at least 6 characters");return}if(t.length>=1){Te.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 q=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"})}),H=await q.json();if(!q.ok)throw new Error(H.error||"Failed to create assistant account");const G=H.userId||H.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})}),ne=await Q.json();if(!Q.ok)throw new Error(ne.error||"Failed to assign assistant role");const{error:ie}=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(ie)throw ie;Te.success(`Assistant account created for ${y.name.trim()}`),l(!1),v({email:"",name:"",password:""}),E()}catch(U){console.error("Error adding assistant:",U),Te.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:q}=await Y.from("agent_assistant_assignments").delete().eq("id",m.id);if(q)throw q;const{data:H}=await Y.from("agent_assistant_assignments").select("id").eq("assistant_id",m.assistant_id);(!H||H.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"})}),Te.success("Assistant removed"),u(!1),x(null),E()}catch(U){console.error("Error removing assistant:",U),Te.error(U.message||"Failed to remove assistant")}},R=async(U,q,H)=>{M(U);try{const G=t.find(ie=>ie.id===U);if(!G)return;const Q={...G.permissions,[q]:H},{error:ne}=await Y.from("agent_assistant_assignments").update({permissions:Q}).eq("id",U);if(ne)throw ne;s(ie=>ie.map(he=>he.id===U?{...he,permissions:Q}:he))}catch(G){console.error("Error updating permissions:",G),Te.error("Failed to update permissions")}finally{M(null)}};return n?r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(qs,{className:"h-5 w-5"}),"My Assistant"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(Vr,{className:"h-6 w-6 animate-spin text-muted-foreground"})})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(He,{children:[r.jsx(Vt,{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(qs,{className:"h-5 w-5"}),"My Assistant"]}),r.jsx(Ns,{children:"Add an assistant to help manage your Agent OS"})]}),t.length===0&&r.jsxs(X,{size:"sm",onClick:()=>l(!0),children:[r.jsx(vs,{className:"h-4 w-4 mr-1"}),"Add Assistant"]})]})}),r.jsx(Xe,{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 q,H,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(Xn,{className:"h-10 w-10",children:r.jsx(Qn,{children:((H=(q=U.assistant_profile)==null?void 0:q.name)==null?void 0:H.split(" ").map(ne=>ne[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(bm,{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(Bs,{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:Yxt.map(ne=>{const ie=ne.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(ie,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:ne.label}),r.jsx("p",{className:"text-xs text-muted-foreground",children:ne.description})]})]}),r.jsx(In,{checked:U.permissions[ne.key]||!1,onCheckedChange:he=>R(U.id,ne.key,he),disabled:k===U.id})]},ne.key)})})]})]},U.id)})})})]}),r.jsx(Or,{open:o,onOpenChange:l,children:r.jsxs(Pr,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Add Assistant"}),r.jsx(Zs,{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(ot,{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(ot,{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(ot,{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(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsxs(X,{onClick:T,disabled:b,children:[b&&r.jsx(Vr,{className:"h-4 w-4 mr-2 animate-spin"}),"Create Assistant"]})]})]})}),r.jsx(Dd,{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(Vc,{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 s in e)t.push(s,e[s]);return new eu(t)};function _Fe(e,t,s){for(let n=0;;n++){if(n==e.childCount||n==t.childCount)return e.childCount==t.childCount?null:s;let a=e.child(n),o=t.child(n);if(a==o){s+=a.nodeSize;continue}if(!a.sameMarkup(o))return s;if(a.isText&&a.text!=o.text){for(let l=0;a.text[l]==o.text[l];l++)s++;return s}if(a.content.size||o.content.size){let l=_Fe(a.content,o.content,s+1);if(l!=null)return l}s+=a.nodeSize}}function bFe(e,t,s,n){for(let a=e.childCount,o=t.childCount;;){if(a==0||o==0)return a==o?null:{a:s,b:n};let l=e.child(--a),i=t.child(--o),u=l.nodeSize;if(l==i){s-=u,n-=u;continue}if(!l.sameMarkup(i))return{a:s,b:n};if(l.isText&&l.text!=i.text){let m=0,x=Math.min(l.text.length,i.text.length);for(;mt&&n(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,s-x),n,a+x)}i=m}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,s,n,a){let o="",l=!0;return this.nodesBetween(t,s,(i,u)=>{let m=i.isText?i.text.slice(Math.max(t,u)-u,s-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)&&n&&(l?l=!1:o+=n),o+=m},0),o}append(t){if(!t.size)return this;if(!this.size)return t;let s=this.lastChild,n=t.firstChild,a=this.content.slice(),o=0;for(s.isText&&s.sameMarkup(n)&&(a[a.length-1]=s.withText(s.text+n.text),o=1);ot)for(let o=0,l=0;lt&&((ls)&&(i.isText?i=i.cut(Math.max(0,t-l),Math.min(i.text.length,s-l)):i=i.cut(Math.max(0,t-l-1),Math.min(i.content.size,s-l-1))),n.push(i),a+=i.nodeSize),l=u}return new gs(n,a)}cutByIndex(t,s){return t==s?gs.empty:t==0&&s==this.content.length?this:new gs(this.content.slice(t,s))}replaceChild(t,s){let n=this.content[t];if(n==s)return this;let a=this.content.slice(),o=this.size+s.nodeSize-n.nodeSize;return a[t]=s,new gs(a,o)}addToStart(t){return new gs([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new gs(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let s=0;sthis.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let s=0,n=0;;s++){let a=this.child(s),o=n+a.nodeSize;if(o>=t)return o==t?mO(s+1,o):mO(s,n);n=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,s){if(!s)return gs.empty;if(!Array.isArray(s))throw new RangeError("Invalid input for Fragment.fromJSON");return new gs(s.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return gs.empty;let s,n=0;for(let a=0;athis.type.rank&&(s||(s=t.slice(0,a)),s.push(this),n=!0),s&&s.push(o)}}return s||(s=t.slice()),n||s.push(this),s}removeFromSet(t){for(let s=0;sn.type.rank-a.type.rank),s}};Ko.none=[];class lre extends Error{}class Js{constructor(t,s,n){this.content=t,this.openStart=s,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,s){let n=jFe(this.content,t+this.openStart,s);return n&&new Js(n,this.openStart,this.openEnd)}removeBetween(t,s){return new Js(wFe(this.content,t+this.openStart,s+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,s){if(!s)return Js.empty;let n=s.openStart||0,a=s.openEnd||0;if(typeof n!="number"||typeof a!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Js(gs.fromJSON(t,s.content),n,a)}static maxOpen(t,s=!0){let n=0,a=0;for(let o=t.firstChild;o&&!o.isLeaf&&(s||!o.type.spec.isolating);o=o.firstChild)n++;for(let o=t.lastChild;o&&!o.isLeaf&&(s||!o.type.spec.isolating);o=o.lastChild)a++;return new Js(t,n,a)}}Js.empty=new Js(gs.empty,0,0);function wFe(e,t,s){let{index:n,offset:a}=e.findIndex(t),o=e.maybeChild(n),{index:l,offset:i}=e.findIndex(s);if(a==t||o.isText){if(i!=s&&!e.child(l).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(s))}if(n!=l)throw new RangeError("Removing non-flat range");return e.replaceChild(n,o.copy(wFe(o.content,t-a-1,s-a-1)))}function jFe(e,t,s,n){let{index:a,offset:o}=e.findIndex(t),l=e.maybeChild(a);if(o==t||l.isText)return n&&!n.canReplace(a,a,s)?null:e.cut(0,t).append(s).append(e.cut(t));let i=jFe(l.content,t-o-1,s,l);return i&&e.replaceChild(a,l.copy(i))}function Qxt(e,t,s){if(s.openStart>e.depth)throw new lre("Inserted content deeper than insertion position");if(e.depth-s.openStart!=t.depth-s.openEnd)throw new lre("Inconsistent open depths");return kFe(e,t,s,0)}function kFe(e,t,s,n){let a=e.index(n),o=e.node(n);if(a==t.index(n)&&n=0&&e.isText&&e.sameMarkup(t[s])?t[s]=e.withText(t[s].text+e.text):t.push(e)}function VA(e,t,s,n){let a=(t||e).node(s),o=0,l=t?t.index(s):a.childCount;e&&(o=e.index(s),e.depth>s?o++:e.textOffset&&(Zj(e.nodeAfter,n),o++));for(let i=o;ia&&Lme(e,t,a+1),l=n.depth>a&&Lme(s,n,a+1),i=[];return VA(null,e,a,i),o&&l&&t.index(a)==s.index(a)?(NFe(o,l),Zj(Yj(o,SFe(e,t,s,n,a+1)),i)):(o&&Zj(Yj(o,cre(e,t,a+1)),i),VA(t,s,a,i),l&&Zj(Yj(l,cre(s,n,a+1)),i)),VA(n,null,a,i),new gs(i)}function cre(e,t,s){let n=[];if(VA(null,e,s,n),e.depth>s){let a=Lme(e,t,s+1);Zj(Yj(a,cre(e,t,s+1)),n)}return VA(t,null,s,n),new gs(n)}function Jxt(e,t){let s=t.depth-e.openStart,a=t.node(s).copy(e.content);for(let o=s-1;o>=0;o--)a=t.node(o).copy(gs.from(a));return{start:a.resolveNoCache(e.openStart+s),end:a.resolveNoCache(a.content.size-e.openEnd-s)}}class qE{constructor(t,s,n){this.pos=t,this.path=s,this.parentOffset=n,this.depth=s.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,s=this.index(this.depth);if(s==t.childCount)return null;let n=this.pos-this.path[this.path.length-1],a=t.child(s);return n?t.child(s).cut(n):a}get nodeBefore(){let t=this.index(this.depth),s=this.pos-this.path[this.path.length-1];return s?this.parent.child(t).cut(0,s):t==0?null:this.parent.child(t-1)}posAtIndex(t,s){s=this.resolveDepth(s);let n=this.path[s*3],a=s==0?0:this.path[s*3-1]+1;for(let o=0;o0;s--)if(this.start(s)<=t&&this.end(s)>=t)return s;return 0}blockRange(t=this,s){if(t.pos=0;n--)if(t.pos<=this.end(n)&&(!s||s(this.node(n))))return new dre(this,t,n);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&&s<=t.content.size))throw new RangeError("Position "+s+" out of range");let n=[],a=0,o=s;for(let l=t;;){let{index:i,offset:u}=l.content.findIndex(o),m=o-u;if(n.push(l,i,a+u),!m||(l=l.child(i),l.isText))break;o=m-1,a+=u+1}return new qE(s,n,o)}static resolveCached(t,s){let n=JNe.get(t);if(n)for(let o=0;ot&&this.nodesBetween(t,s,o=>(n.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()+")"),CFe(this.marks,t)}contentMatchAt(t){let s=this.type.contentMatch.matchFragment(this.content,0,t);if(!s)throw new Error("Called contentMatchAt on a node with invalid content");return s}canReplace(t,s,n=gs.empty,a=0,o=n.childCount){let l=this.contentMatchAt(t).matchFragment(n,a,o),i=l&&l.matchFragment(this.content,s);if(!i||!i.validEnd)return!1;for(let u=a;us.type.name)}`);this.content.forEach(s=>s.check())}toJSON(){let t={type:this.type.name};for(let s 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(s=>s.toJSON())),t}static fromJSON(t,s){if(!s)throw new RangeError("Invalid input for Node.fromJSON");let n;if(s.marks){if(!Array.isArray(s.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=s.marks.map(t.markFromJSON)}if(s.type=="text"){if(typeof s.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(s.text,n)}let a=gs.fromJSON(t,s.content),o=t.nodeType(s.type).create(s.attrs,a,n);return o.type.checkAttrs(o.attrs),o}};av.prototype.text=void 0;class ure extends av{constructor(t,s,n,a){if(super(t,s,null,a),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):CFe(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,s){return this.text.slice(t,s)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new ure(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new ure(this.type,this.attrs,t,this.marks)}cut(t=0,s=this.text.length){return t==0&&s==this.text.length?this:this.withText(this.text.slice(t,s))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function CFe(e,t){for(let s=e.length-1;s>=0;s--)t=e[s].type.name+"("+t+")";return t}class gk{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,s){let n=new syt(t,s);if(n.next==null)return gk.empty;let a=MFe(n);n.next&&n.err("Unexpected trailing text");let o=dyt(cyt(a));return uyt(o,n),o}matchType(t){for(let s=0;sm.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 s(n){t.push(n);for(let a=0;a{let o=a+(n.validEnd?"*":" ")+" ";for(let l=0;l"+t.indexOf(n.next[l].next);return o}).join(` `)}}gk.empty=new gk(!0);class syt{constructor(t,s){this.string=t,this.nodeTypes=s,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 MFe(e){let t=[];do t.push(nyt(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function nyt(e){let t=[];do t.push(ayt(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function ayt(e){let t=lyt(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=iyt(e,t);else break;return t}function e4e(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function iyt(e,t){let s=e4e(e),n=s;return e.eat(",")&&(e.next!="}"?n=e4e(e):n=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:s,max:n,expr:t}}function oyt(e,t){let s=e.nodeTypes,n=s[t];if(n)return[n];let a=[];for(let o in s){let l=s[o];l.isInGroup(t)&&a.push(l)}return a.length==0&&e.err("No node type or group '"+t+"' found"),a}function lyt(e){if(e.eat("(")){let t=MFe(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=oyt(e,e.next).map(s=>(e.inline==null?e.inline=s.isInline:e.inline!=s.isInline&&e.err("Mixing inline and block content"),{type:"name",value:s}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function cyt(e){let t=[[]];return a(o(e,0),s()),t;function s(){return t.push([])-1}function n(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=s())}else if(l.type=="star"){let u=s();return n(i,u),a(o(l.expr,u),u),[n(u)]}else if(l.type=="plus"){let u=s();return a(o(l.expr,i),u),a(o(l.expr,u),u),[n(u)]}else{if(l.type=="opt")return[n(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[n.join(",")]=new gk(n.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:EFe(this.attrs,t)}create(t=null,s,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new av(this,this.computeAttrs(t),gs.from(s),Ko.setFrom(n))}createChecked(t=null,s,n){return s=gs.from(s),this.checkContent(s),new av(this,this.computeAttrs(t),s,Ko.setFrom(n))}createAndFill(t=null,s,n){if(t=this.computeAttrs(t),s=gs.from(s),s.size){let l=this.contentMatch.fillBefore(s);if(!l)return null;s=l.append(s)}let a=this.contentMatch.matchFragment(s),o=a&&a.fillBefore(gs.empty,!0);return o?new av(this,t,s.append(o),Ko.setFrom(n)):null}validContent(t){let s=this.contentMatch.matchFragment(t);if(!s||!s.validEnd)return!1;for(let n=0;n-1}allowsMarks(t){if(this.markSet==null)return!0;for(let s=0;sn[o]=new LFe(o,s,l));let a=s.spec.topNode||"doc";if(!n[a])throw new RangeError("Schema is missing its top node type ('"+a+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let o in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function hyt(e,t,s){let n=s.split("|");return a=>{let o=a===null?"null":typeof a;if(n.indexOf(o)<0)throw new RangeError(`Expected value of type ${n} for attribute ${t} on type ${e}, got ${o}`)}}class myt{constructor(t,s,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?hyt(t,s,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class gae{constructor(t,s,n,a){this.name=t,this.rank=s,this.schema=n,this.spec=a,this.attrs=PFe(t,a.attrs),this.excluded=null;let o=AFe(this.attrs);this.instance=o?new Ko(this,o):null}create(t=null){return!t&&this.instance?this.instance:new Ko(this,EFe(this.attrs,t))}static compile(t,s){let n=Object.create(null),a=0;return t.forEach((o,l)=>n[o]=new gae(o,a++,s,l)),n}removeFromSet(t){for(var s=0;s-1}}class OFe{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let s=this.spec={};for(let a in t)s[a]=t[a];s.nodes=eu.from(t.nodes),s.marks=eu.from(t.marks||{}),this.nodes=r4e.compile(this.spec.nodes,this),this.marks=gae.compile(this.spec.marks,this);let n=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=n[l]||(n[l]=gk.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?s4e(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==""?[]:s4e(this,l.split(" "))}this.nodeFromJSON=a=>av.fromJSON(this,a),this.markFromJSON=a=>Ko.fromJSON(this,a),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,s=null,n,a){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof r4e){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(s,n,a)}text(t,s){let n=this.nodes.text;return new ure(n,n.defaultAttrs,t,Ko.setFrom(s))}mark(t,s){return typeof t=="string"&&(t=this.marks[t]),t.create(s)}nodeType(t){let s=this.nodes[t];if(!s)throw new RangeError("Unknown node type: "+t);return s}}function s4e(e,t){let s=[];for(let n=0;n-1)&&s.push(l=u)}if(!l)throw new SyntaxError("Unknown mark type: '"+t[n]+"'")}return s}function pyt(e){return e.tag!=null}function fyt(e){return e.style!=null}let HA=class Dme{constructor(t,s){this.schema=t,this.rules=s,this.tags=[],this.styles=[];let n=this.matchedStyles=[];s.forEach(a=>{if(pyt(a))this.tags.push(a);else if(fyt(a)){let o=/[^=]*/.exec(a.style)[0];n.indexOf(o)<0&&n.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,s={}){let n=new a4e(this,s,!1);return n.addAll(t,Ko.none,s.from,s.to),n.finish()}parseSlice(t,s={}){let n=new a4e(this,s,!0);return n.addAll(t,Ko.none,s.from,s.to),Js.maxOpen(n.finish())}matchTag(t,s,n){for(let a=n?this.tags.indexOf(n)+1:0;at.length&&(i.charCodeAt(t.length)!=61||i.slice(t.length+1)!=s))){if(l.getAttrs){let u=l.getAttrs(s);if(u===!1)continue;l.attrs=u||void 0}return l}}}static schemaRules(t){let s=[];function n(a){let o=a.priority==null?50:a.priority,l=0;for(;l{n(l=i4e(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=>{n(l=i4e(l)),l.node||l.ignore||l.mark||(l.node=a)})}return s}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new Dme(t,Dme.schemaRules(t)))}};const DFe={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},gyt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},RFe={ol:!0,ul:!0},VE=1,Rme=2,WA=4;function n4e(e,t,s){return t!=null?(t?VE:0)|(t==="full"?Rme:0):e&&e.whitespace=="pre"?VE|Rme:s&~WA}class pO{constructor(t,s,n,a,o,l){this.type=t,this.attrs=s,this.marks=n,this.solid=a,this.options=l,this.content=[],this.activeMarks=Ko.none,this.match=o||(l&WA?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let s=this.type.contentMatch.fillBefore(gs.from(t));if(s)this.match=this.type.contentMatch.matchFragment(s);else{let n=this.type.contentMatch,a;return(a=n.findWrapping(t.type))?(this.match=n,a):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&VE)){let n=this.content[this.content.length-1],a;if(n&&n.isText&&(a=/[ \t\r\n\u000c]+$/.exec(n.text))){let o=n;n.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 s=gs.from(this.content);return!t&&this.match&&(s=s.append(this.match.fillBefore(gs.empty,!0))),this.type?this.type.create(this.attrs,s,this.marks):s}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!DFe.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class a4e{constructor(t,s,n){this.parser=t,this.options=s,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let a=s.topNode,o,l=n4e(null,s.preserveWhitespace,0)|(n?WA:0);a?o=new pO(a.type,a.attrs,Ko.none,!0,s.topMatch||a.type.contentMatch,l):n?o=new pO(null,null,Ko.none,!0,null,l):o=new pO(t.schema.topNodeType,null,Ko.none,!0,null,l),this.nodes=[o],this.find=s.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,s){t.nodeType==3?this.addTextNode(t,s):t.nodeType==1&&this.addElement(t,s)}addTextNode(t,s){let n=t.nodeValue,a=this.top,o=a.options&Rme?"full":this.localPreserveWS||(a.options&VE)>0,{schema:l}=this.parser;if(o==="full"||a.inlineContext(t)||/[^ \t\r\n\u000c]/.test(n)){if(o)if(o==="full")n=n.replace(/\r\n?/g,` `);else if(l.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(l.linebreakReplacement.create())){let i=n.split(/\r?\n|\r/);for(let u=0;u!u.clearMark(m)):s=s.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)i=u;else break}}return s}addElementByRule(t,s,n,a){let o,l;if(s.node)if(l=this.parser.schema.nodes[s.node],l.isLeaf)this.insertNode(l.create(s.attrs),n,t.nodeName=="BR")||this.leafFallback(t,n);else{let u=this.enter(l,s.attrs||null,n,s.preserveWhitespace);u&&(o=!0,n=u)}else{let u=this.parser.schema.marks[s.mark];n=n.concat(u.create(s.attrs))}let i=this.top;if(l&&l.isLeaf)this.findInside(t);else if(a)this.addElement(t,n,a);else if(s.getContent)this.findInside(t),s.getContent(t,this.parser.schema).forEach(u=>this.insertNode(u,n,!1));else{let u=t;typeof s.contentElement=="string"?u=t.querySelector(s.contentElement):typeof s.contentElement=="function"?u=s.contentElement(t):s.contentElement&&(u=s.contentElement),this.findAround(t,u,!0),this.addAll(u,n),this.findAround(t,u,!1)}o&&this.sync(i)&&this.open--}addAll(t,s,n,a){let o=n||0;for(let l=n?t.childNodes[n]:t.firstChild,i=a==null?null:t.childNodes[a];l!=i;l=l.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(l,s);this.findAtPoint(t,o)}findPlace(t,s,n){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(n)break;i+=2}}if(!a)return null;this.sync(o);for(let l=0;l(l.type?l.type.allowsMarkType(m.type):o4e(m.type,t))?(u=m.addToSet(u),!1):!0),this.nodes.push(new pO(t,s,u,a,null,i)),this.open++,n}closeExtra(t=!1){let s=this.nodes.length-1;if(s>this.open){for(;s>this.open;s--)this.nodes[s-1].content.push(this.nodes[s].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 s=this.open;s>=0;s--){if(this.nodes[s]==t)return this.open=s,!0;this.localPreserveWS&&(this.nodes[s].options|=VE)}return!1}get currentPos(){this.closeExtra();let t=0;for(let s=this.open;s>=0;s--){let n=this.nodes[s].content;for(let a=n.length-1;a>=0;a--)t+=n[a].nodeSize;s&&t++}return t}findAtPoint(t,s){if(this.find)for(let n=0;n-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let s=t.split("/"),n=this.options.context,a=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),o=-(n?n.depth+1:0)+(a?0:1),l=(i,u)=>{for(;i>=0;i--){let m=s[i];if(m==""){if(i==s.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:n&&u>=o?n.node(u-o).type:null;if(!x||x.name!=m&&!x.isInGroup(m))return!1;u--}}return!0};return l(s.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let s=t.depth;s>=0;s--){let n=t.node(s).contentMatchAt(t.indexAfter(s)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let s in this.parser.schema.nodes){let n=this.parser.schema.nodes[s];if(n.isTextblock&&n.defaultAttrs)return n}}}function xyt(e){for(let t=e.firstChild,s=null;t;t=t.nextSibling){let n=t.nodeType==1?t.nodeName.toLowerCase():null;n&&RFe.hasOwnProperty(n)&&s?(s.appendChild(t),t=s):n=="li"?s=t:n&&(s=null)}}function yyt(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function i4e(e){let t={};for(let s in e)t[s]=e[s];return t}function o4e(e,t){let s=t.schema.nodes;for(let n in s){let a=s[n];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,s);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(t,s,n={}){let a=this.marks[t.type.name];return a&&Gee(Jce(n),a(t,s),null,t.attrs)}static renderSpec(t,s,n=null,a){return Gee(t,s,n,a)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new Ok(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let s=l4e(t.nodes);return s.text||(s.text=n=>n.text),s}static marksFromSchema(t){return l4e(t.marks)}}function l4e(e){let t={};for(let s in e){let n=e[s].spec.toDOM;n&&(t[s]=n)}return t}function Jce(e){return e.document||window.document}const c4e=new WeakMap;function vyt(e){let t=c4e.get(e);return t===void 0&&c4e.set(e,t=_yt(e)),t}function _yt(e){let t=null;function s(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")t||(t=[]),t.push(n);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&&(s=a.slice(0,l),a=a.slice(l+1));let i,u=s?e.createElementNS(s,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}=Gee(e,v,s,n);if(u.appendChild(b),N){if(i)throw new RangeError("Multiple content holes");i=N}}}return{dom:u,contentDOM:i}}const FFe=65535,zFe=Math.pow(2,16);function byt(e,t){return e+t*zFe}function d4e(e){return e&FFe}function wyt(e){return(e-(e&FFe))/zFe}const BFe=1,$Fe=2,Kee=4,UFe=8;class Fme{constructor(t,s,n){this.pos=t,this.delInfo=s,this.recover=n}get deleted(){return(this.delInfo&UFe)>0}get deletedBefore(){return(this.delInfo&(BFe|Kee))>0}get deletedAfter(){return(this.delInfo&($Fe|Kee))>0}get deletedAcross(){return(this.delInfo&Kee)>0}}class dm{constructor(t,s=!1){if(this.ranges=t,this.inverted=s,!t.length&&dm.empty)return dm.empty}recover(t){let s=0,n=d4e(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:s:s,b=u+a+(v<0?0:x);if(n)return b;let N=t==(s<0?u:y)?null:byt(i/3,t-u),k=t==u?$Fe:t==y?BFe:Kee;return(s<0?t!=u:t!=y)&&(k|=UFe),new Fme(b,k,N)}a+=x-m}return n?t+a:new Fme(t+a,0,null)}touches(t,s){let n=0,a=d4e(s),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;n+=this.ranges[i+l]-m}return!1}forEach(t){let s=this.inverted?2:1,n=this.inverted?1:2;for(let a=0,o=0;a=0;s--){let a=t.getMirror(s);this.appendMap(t._maps[s].invert(),a!=null&&a>s?n-a-1:void 0)}}invert(){let t=new HE;return t.appendMappingInverted(this),t}map(t,s=1){if(this.mirror)return this._map(t,s,!0);for(let n=this.from;no&&u!l.isAtom||!i.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),a),s.openStart,s.openEnd);return Hc.fromReplace(t,this.from,this.to,o)}invert(){return new Eg(this.from,this.to,this.mark)}map(t){let s=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return s.deleted&&n.deleted||s.pos>=n.pos?null:new T1(s.pos,n.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,s){if(typeof s.from!="number"||typeof s.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new T1(s.from,s.to,t.markFromJSON(s.mark))}}Mu.jsonID("addMark",T1);class Eg extends Mu{constructor(t,s,n){super(),this.from=t,this.to=s,this.mark=n}apply(t){let s=t.slice(this.from,this.to),n=new Js(qye(s.content,a=>a.mark(this.mark.removeFromSet(a.marks)),t),s.openStart,s.openEnd);return Hc.fromReplace(t,this.from,this.to,n)}invert(){return new T1(this.from,this.to,this.mark)}map(t){let s=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return s.deleted&&n.deleted||s.pos>=n.pos?null:new Eg(s.pos,n.pos,this.mark)}merge(t){return t instanceof Eg&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Eg(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,s){if(typeof s.from!="number"||typeof s.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Eg(s.from,s.to,t.markFromJSON(s.mark))}}Mu.jsonID("removeMark",Eg);class A1 extends Mu{constructor(t,s){super(),this.pos=t,this.mark=s}apply(t){let s=t.nodeAt(this.pos);if(!s)return Hc.fail("No node at mark step's position");let n=s.type.create(s.attrs,null,this.mark.addToSet(s.marks));return Hc.fromReplace(t,this.pos,this.pos+1,new Js(gs.from(n),0,s.isLeaf?0:1))}invert(t){let s=t.nodeAt(this.pos);if(s){let n=this.mark.addToSet(s.marks);if(n.length==s.marks.length){for(let a=0;an.pos?null:new $d(s.pos,n.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,s){if(typeof s.from!="number"||typeof s.to!="number"||typeof s.gapFrom!="number"||typeof s.gapTo!="number"||typeof s.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new $d(s.from,s.to,s.gapFrom,s.gapTo,Js.fromJSON(t,s.slice),s.insert,!!s.structure)}}Mu.jsonID("replaceAround",$d);function zme(e,t,s){let n=e.resolve(t),a=s-t,o=n.depth;for(;a>0&&o>0&&n.indexAfter(o)==n.node(o).childCount;)o--,a--;if(a>0){let l=n.node(o).maybeChild(n.indexAfter(o));for(;a>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,a--}}return!1}function jyt(e,t,s,n){let a=[],o=[],l,i;e.doc.nodesBetween(t,s,(u,m,x)=>{if(!u.isInline)return;let y=u.marks;if(!n.isInSet(y)&&x.type.allowsMarkType(n.type)){let v=Math.max(m,t),b=Math.min(m+u.nodeSize,s),N=n.addToSet(y);for(let k=0;ke.step(u)),o.forEach(u=>e.step(u))}function kyt(e,t,s,n){let a=[],o=0;e.doc.nodesBetween(t,s,(l,i)=>{if(!l.isInline)return;o++;let u=null;if(n instanceof gae){let m=l.marks,x;for(;x=n.isInSet(m);)(u||(u=[])).push(x),m=x.removeFromSet(m)}else n?n.isInSet(l.marks)&&(u=[n]):u=l.marks;if(u&&u.length){let m=Math.min(i+l.nodeSize,s);for(let x=0;xe.step(new Eg(l.from,l.to,l.style)))}function Vye(e,t,s,n=s.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 Nyt(e,t,s){return(t==0||e.canReplace(t,e.childCount))&&(s==e.childCount||e.canReplace(0,s))}function F3(e){let s=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,a=0,o=0;;--n){let l=e.$from.node(n),i=e.$from.index(n)+a,u=e.$to.indexAfter(n)-o;if(ns;N--)k||n.index(N)>0?(k=!0,x=gs.from(n.node(N).copy(x)),y++):u--;let v=gs.empty,b=0;for(let N=o,k=!1;N>s;N--)k||a.after(N+1)=0;l--){if(n.size){let i=s[l].type.contentMatch.matchFragment(n);if(!i||!i.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=gs.from(s[l].type.create(s[l].attrs,n))}let a=t.start,o=t.end;e.step(new $d(a,o,a,o,new Js(n,0,0),s.length,!0))}function Ayt(e,t,s,n,a){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=e.steps.length;e.doc.nodesBetween(t,s,(l,i)=>{let u=typeof a=="function"?a(l):a;if(l.isTextblock&&!l.hasMarkup(n,u)&&Eyt(e.doc,e.mapping.slice(o).map(i),n)){let m=null;if(n.schema.linebreakReplacement){let b=n.whitespace=="pre",N=!!n.contentMatch.matchType(n.schema.linebreakReplacement);b&&!N?m=!1:!b&&N&&(m=!0)}m===!1&&VFe(e,l,i,o),Vye(e,e.mapping.slice(o).map(i,1),n,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 Js(gs.from(n.create(u,null,l.marks)),0,0),1,!0)),m===!0&&qFe(e,l,i,o),!1}})}function qFe(e,t,s,n){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(n).map(s+1+o+l.index);e.replaceWith(u,u+1,t.type.schema.linebreakReplacement.create())}}})}function VFe(e,t,s,n){t.forEach((a,o)=>{if(a.type==a.type.schema.linebreakReplacement){let l=e.mapping.slice(n).map(s+1+o);e.replaceWith(l,l+1,t.type.schema.text(` `))}})}function Eyt(e,t,s){let n=e.resolve(t),a=n.index();return n.parent.canReplaceWith(a,a+1,s)}function Iyt(e,t,s,n,a){let o=e.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");s||(s=o.type);let l=s.create(n,null,a||o.marks);if(o.isLeaf)return e.replaceWith(t,t+o.nodeSize,l);if(!s.validContent(o.content))throw new RangeError("Invalid content for node type "+s.name);e.step(new $d(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new Js(gs.from(l),0,0),1,!0))}function _y(e,t,s=1,n){let a=e.resolve(t),o=a.depth-s,l=n&&n[n.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=s-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=n&&n[x+1];N&&(b=b.replaceChild(0,N.type.create(N.attrs)));let k=n&&n[x]||y;if(!y.canReplace(v+1,y.childCount)||!k.type.validContent(b))return!1}let i=a.indexAfter(o),u=n&&n[0];return a.node(o).canReplaceWith(i,i,u?u.type:a.node(o+1).type)}function Pyt(e,t,s=1,n){let a=e.doc.resolve(t),o=gs.empty,l=gs.empty;for(let i=a.depth,u=a.depth-s,m=s-1;i>u;i--,m--){o=gs.from(a.node(i).copy(o));let x=n&&n[m];l=gs.from(x?x.type.create(x.attrs,l):a.node(i).copy(l))}e.step(new Ld(t,t,new Js(o.append(l),s,s),!0))}function Iv(e,t){let s=e.resolve(t),n=s.index();return HFe(s.nodeBefore,s.nodeAfter)&&s.parent.canReplace(n,n+1)}function Lyt(e,t){t.content.size||e.type.compatibleContent(t.type);let s=e.contentMatchAt(e.childCount),{linebreakReplacement:n}=e.type.schema;for(let a=0;a0?(o=n.node(a+1),i++,l=n.node(a).maybeChild(i)):(o=n.node(a).maybeChild(i-1),l=n.node(a+1)),o&&!o.isTextblock&&HFe(o,l)&&n.node(a).canReplace(i,i+1))return t;if(a==0)break;t=s<0?n.before(a):n.after(a)}}function Oyt(e,t,s){let n=null,{linebreakReplacement:a}=e.doc.type.schema,o=e.doc.resolve(t-s),l=o.node().type;if(a&&l.inlineContent){let x=l.whitespace=="pre",y=!!l.contentMatch.matchType(a);x&&!y?n=!1:!x&&y&&(n=!0)}let i=e.steps.length;if(n===!1){let x=e.doc.resolve(t+s);VFe(e,x.node(),x.before(),i)}l.inlineContent&&Vye(e,t+s-1,l,o.node().contentMatchAt(o.index()),n==null);let u=e.mapping.slice(i),m=u.map(t-s);if(e.step(new Ld(m,u.map(t+s,-1),Js.empty,!0)),n===!0){let x=e.doc.resolve(m);qFe(e,x.node(),x.before(),e.steps.length)}return e}function Dyt(e,t,s){let n=e.resolve(t);if(n.parent.canReplaceWith(n.index(),n.index(),s))return t;if(n.parentOffset==0)for(let a=n.depth-1;a>=0;a--){let o=n.index(a);if(n.node(a).canReplaceWith(o,o,s))return n.before(a+1);if(o>0)return null}if(n.parentOffset==n.parent.content.size)for(let a=n.depth-1;a>=0;a--){let o=n.indexAfter(a);if(n.node(a).canReplaceWith(o,o,s))return n.after(a+1);if(o=0;l--){let i=l==n.depth?0:n.pos<=(n.start(l+1)+n.end(l+1))/2?-1:1,u=n.index(l)+(i>0?1:0),m=n.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?n.pos:i<0?n.before(l+1):n.after(l+1)}return null}function yae(e,t,s=t,n=Js.empty){if(t==s&&!n.size)return null;let a=e.resolve(t),o=e.resolve(s);return GFe(a,o,n)?new Ld(t,s,n):new Ryt(a,o,n).fit()}function GFe(e,t,s){return!s.openStart&&!s.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),s.content)}class Ryt{constructor(t,s,n){this.$from=t,this.$to=s,this.unplaced=n,this.frontier=[],this.placed=gs.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=gs.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(),s=this.placed.size-this.depth-this.$from.depth,n=this.$from,a=this.close(t<0?this.$to:n.doc.resolve(t));if(!a)return null;let o=this.placed,l=n.depth,i=a.depth;for(;l&&i&&o.childCount==1;)o=o.firstChild.content,l--,i--;let u=new Js(o,l,i);return t>-1?new $d(n.pos,t,this.$to.pos,this.$to.end(),u,s):u.size||n.pos!=this.$to.pos?new Ld(n.pos,a.pos,u):null}findFittable(){let t=this.unplaced.openStart;for(let s=this.unplaced.content,n=0,a=this.unplaced.openEnd;n1&&(a=0),o.type.spec.isolating&&a<=n){t=n;break}s=o.content}for(let s=1;s<=2;s++)for(let n=s==1?t:this.unplaced.openStart;n>=0;n--){let a,o=null;n?(o=tde(this.unplaced.content,n-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(s==1&&(l?m.matchType(l.type)||(y=m.fillBefore(gs.from(l),!1)):o&&u.compatibleContent(o.type)))return{sliceDepth:n,frontierDepth:i,parent:o,inject:y};if(s==2&&l&&(x=m.findWrapping(l.type)))return{sliceDepth:n,frontierDepth:i,parent:o,wrap:x};if(o&&m.matchType(o.type))break}}}openMore(){let{content:t,openStart:s,openEnd:n}=this.unplaced,a=tde(t,s);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new Js(t,s+1,Math.max(n,a.size+s>=t.size-n?s+1:0)),!0)}dropNode(){let{content:t,openStart:s,openEnd:n}=this.unplaced,a=tde(t,s);if(a.childCount<=1&&s>0){let o=t.size-s<=s+a.size;this.unplaced=new Js($T(t,s-1,1),s-1,o?s-1:n)}else this.unplaced=new Js($T(t,s,1),s,n)}placeNodes({sliceDepth:t,frontierDepth:s,parent:n,inject:a,wrap:o}){for(;this.depth>s;)this.closeFrontierNode();if(o)for(let k=0;k1||u==0||k.content.size)&&(y=M,x.push(KFe(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=UT(this.placed,s,gs.from(x)),this.frontier[s].match=y,N&&b<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let k=0,M=i;k1&&a==this.$to.end(--n);)++a;return a}findCloseLevel(t){e:for(let s=Math.min(this.depth,t.depth);s>=0;s--){let{match:n,type:a}=this.frontier[s],o=s=0;i--){let{match:u,type:m}=this.frontier[i],x=rde(t,i,m,u,!0);if(!x||x.childCount)continue e}return{depth:s,fit:l,move:o?t.doc.resolve(t.after(s+1)):t}}}}close(t){let s=this.findCloseLevel(t);if(!s)return null;for(;this.depth>s.depth;)this.closeFrontierNode();s.fit.childCount&&(this.placed=UT(this.placed,s.depth,s.fit)),t=s.move;for(let n=s.depth+1;n<=t.depth;n++){let a=t.node(n),o=a.type.contentMatch.fillBefore(a.content,!0,t.index(n));this.openFrontierNode(a.type,a.attrs,o)}return t}openFrontierNode(t,s=null,n){let a=this.frontier[this.depth];a.match=a.match.matchType(t),this.placed=UT(this.placed,this.depth,gs.from(t.create(s,n))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let s=this.frontier.pop().match.fillBefore(gs.empty,!0);s.childCount&&(this.placed=UT(this.placed,this.frontier.length,s))}}function $T(e,t,s){return t==0?e.cutByIndex(s,e.childCount):e.replaceChild(0,e.firstChild.copy($T(e.firstChild.content,t-1,s)))}function UT(e,t,s){return t==0?e.append(s):e.replaceChild(e.childCount-1,e.lastChild.copy(UT(e.lastChild.content,t-1,s)))}function tde(e,t){for(let s=0;s1&&(n=n.replaceChild(0,KFe(n.firstChild,t-1,n.childCount==1?s-1:0))),t>0&&(n=e.type.contentMatch.fillBefore(n).append(n),s<=0&&(n=n.append(e.type.contentMatch.matchFragment(n).fillBefore(gs.empty,!0)))),e.copy(n)}function rde(e,t,s,n,a){let o=e.node(t),l=a?e.indexAfter(t):e.index(t);if(l==o.childCount&&!s.compatibleContent(o.type))return null;let i=n.fillBefore(o.content,!0,l);return i&&!Fyt(s,o.content,l)?i:null}function Fyt(e,t,s){for(let n=s;n0;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=n.openStart;for(let v=n.content,b=0;;b++){let N=v.firstChild;if(m.push(N),b==n.openStart)break;v=N.content}for(let v=x-1;v>=0;v--){let b=m[v],N=zyt(b.type);if(N&&!b.sameMarkup(a.node(Math.abs(i)-1)))x=v;else if(N||!b.type.isTextblock)break}for(let v=n.openStart;v>=0;v--){let b=(v+x+1)%(n.openStart+1),N=m[b];if(N)for(let k=0;k=0&&(e.replace(t,s,n),!(e.steps.length>y));v--){let b=l[v];b<0||(t=a.before(b),s=o.after(b))}}function ZFe(e,t,s,n,a){if(tn){let o=a.contentMatchAt(0),l=o.fillBefore(e).append(e);e=l.append(o.matchFragment(l).fillBefore(gs.empty,!0))}return e}function $yt(e,t,s,n){if(!n.isInline&&t==s&&e.doc.resolve(t).parent.content.size){let a=Dyt(e.doc,t,n.type);a!=null&&(t=s=a)}e.replaceRange(t,s,new Js(gs.from(n),0,0))}function Uyt(e,t,s){let n=e.doc.resolve(t),a=e.doc.resolve(s),o=YFe(n,a);for(let l=0;l0&&(u||n.node(i-1).canReplace(n.index(i-1),a.indexAfter(i-1))))return e.delete(n.before(i),a.after(i))}for(let l=1;l<=n.depth&&l<=a.depth;l++)if(t-n.start(l)==n.depth-l&&s>n.end(l)&&a.end(l)-s!=a.depth-l&&n.start(l-1)==a.start(l-1)&&n.node(l-1).canReplace(n.index(l-1),a.index(l-1)))return e.delete(n.before(l),s);e.delete(t,s)}function YFe(e,t){let s=[],n=Math.min(e.depth,t.depth);for(let a=n;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)&&s.push(a)}return s}class sC extends Mu{constructor(t,s,n){super(),this.pos=t,this.attr=s,this.value=n}apply(t){let s=t.nodeAt(this.pos);if(!s)return Hc.fail("No node at attribute step's position");let n=Object.create(null);for(let o in s.attrs)n[o]=s.attrs[o];n[this.attr]=this.value;let a=s.type.create(n,null,s.marks);return Hc.fromReplace(t,this.pos,this.pos+1,new Js(gs.from(a),0,s.isLeaf?0:1))}getMap(){return dm.empty}invert(t){return new sC(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let s=t.mapResult(this.pos,1);return s.deletedAfter?null:new sC(s.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,s){if(typeof s.pos!="number"||typeof s.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new sC(s.pos,s.attr,s.value)}}Mu.jsonID("attr",sC);class WE extends Mu{constructor(t,s){super(),this.attr=t,this.value=s}apply(t){let s=Object.create(null);for(let a in t.attrs)s[a]=t.attrs[a];s[this.attr]=this.value;let n=t.type.create(s,t.content,t.marks);return Hc.ok(n)}getMap(){return dm.empty}invert(t){return new WE(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,s){if(typeof s.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new WE(s.attr,s.value)}}Mu.jsonID("docAttr",WE);let qC=class extends Error{};qC=function e(t){let s=Error.call(this,t);return s.__proto__=e.prototype,s};qC.prototype=Object.create(Error.prototype);qC.prototype.constructor=qC;qC.prototype.name="TransformError";class Wye{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new HE}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let s=this.maybeStep(t);if(s.failed)throw new qC(s.failed);return this}maybeStep(t){let s=t.apply(this.doc);return s.failed||this.addStep(t,s.doc),s}get docChanged(){return this.steps.length>0}addStep(t,s){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=s}replace(t,s=t,n=Js.empty){let a=yae(this.doc,t,s,n);return a&&this.step(a),this}replaceWith(t,s,n){return this.replace(t,s,new Js(gs.from(n),0,0))}delete(t,s){return this.replace(t,s,Js.empty)}insert(t,s){return this.replaceWith(t,t,s)}replaceRange(t,s,n){return Byt(this,t,s,n),this}replaceRangeWith(t,s,n){return $yt(this,t,s,n),this}deleteRange(t,s){return Uyt(this,t,s),this}lift(t,s){return Syt(this,t,s),this}join(t,s=1){return Oyt(this,t,s),this}wrap(t,s){return Tyt(this,t,s),this}setBlockType(t,s=t,n,a=null){return Ayt(this,t,s,n,a),this}setNodeMarkup(t,s,n=null,a){return Iyt(this,t,s,n,a),this}setNodeAttribute(t,s,n){return this.step(new sC(t,s,n)),this}setDocAttribute(t,s){return this.step(new WE(t,s)),this}addNodeMark(t,s){return this.step(new A1(t,s)),this}removeNodeMark(t,s){let n=this.doc.nodeAt(t);if(!n)throw new RangeError("No node at position "+t);if(s instanceof Ko)s.isInSet(n.marks)&&this.step(new xk(t,s));else{let a=n.marks,o,l=[];for(;o=s.isInSet(a);)l.push(new xk(t,o)),a=o.removeFromSet(a);for(let i=l.length-1;i>=0;i--)this.step(l[i])}return this}split(t,s=1,n){return Pyt(this,t,s,n),this}addMark(t,s,n){return jyt(this,t,s,n),this}removeMark(t,s,n){return kyt(this,t,s,n),this}clearIncompatible(t,s,n){return Vye(this,t,s,n),this}}const sde=Object.create(null);class Da{constructor(t,s,n){this.$anchor=t,this.$head=s,this.ranges=n||[new XFe(t.min(s),t.max(s))]}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 s=0;s=0;o--){let l=s<0?G4(t.node(0),t.node(o),t.before(o+1),t.index(o),s,n):G4(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,s,n);if(l)return l}return null}static near(t,s=1){return this.findFrom(t,s)||this.findFrom(t,-s)||new jm(t.node(0))}static atStart(t){return G4(t,t,0,0,1)||new jm(t)}static atEnd(t){return G4(t,t,t.content.size,t.childCount,-1)||new jm(t)}static fromJSON(t,s){if(!s||!s.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=sde[s.type];if(!n)throw new RangeError(`No selection type ${s.type} defined`);return n.fromJSON(t,s)}static jsonID(t,s){if(t in sde)throw new RangeError("Duplicate use of selection JSON ID "+t);return sde[t]=s,s.prototype.jsonID=t,s}getBookmark(){return ba.between(this.$anchor,this.$head).getBookmark()}}Da.prototype.visible=!0;class XFe{constructor(t,s){this.$from=t,this.$to=s}}let h4e=!1;function m4e(e){!h4e&&!e.parent.inlineContent&&(h4e=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class ba extends Da{constructor(t,s=t){m4e(t),m4e(s),super(t,s)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,s){let n=t.resolve(s.map(this.head));if(!n.parent.inlineContent)return Da.near(n);let a=t.resolve(s.map(this.anchor));return new ba(a.parent.inlineContent?a:n,n)}replace(t,s=Js.empty){if(super.replace(t,s),s==Js.empty){let n=this.$from.marksAcross(this.$to);n&&t.ensureMarks(n)}}eq(t){return t instanceof ba&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new vae(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,s){if(typeof s.anchor!="number"||typeof s.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ba(t.resolve(s.anchor),t.resolve(s.head))}static create(t,s,n=s){let a=t.resolve(s);return new this(a,n==s?a:t.resolve(n))}static between(t,s,n){let a=t.pos-s.pos;if((!n||a)&&(n=a>=0?1:-1),!s.parent.inlineContent){let o=Da.findFrom(s,n,!0)||Da.findFrom(s,-n,!0);if(o)s=o.$head;else return Da.near(s,n)}return t.parent.inlineContent||(a==0?t=s:(t=(Da.findFrom(t,-n,!0)||Da.findFrom(t,n,!0)).$anchor,t.pos0?0:1);a>0?l=0;l+=a){let i=t.child(l);if(i.isAtom){if(!o&&pa.isSelectable(i))return pa.create(e,s-(a<0?i.nodeSize:0))}else{let u=G4(e,i,s+a,a<0?i.childCount:0,a,o);if(u)return u}s+=i.nodeSize*a}return null}function p4e(e,t,s){let n=e.steps.length-1;if(n{l==null&&(l=x)}),e.setSelection(Da.near(e.doc.resolve(l),s))}const f4e=1,fO=2,g4e=4;class Vyt extends Wye{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|=fO,this}ensureMarks(t){return Ko.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&fO)>0}addStep(t,s){super.addStep(t,s),this.updated=this.updated&~fO,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,s=!0){let n=this.selection;return s&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Ko.none))),n.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,s,n){let a=this.doc.type.schema;if(s==null)return t?this.replaceSelectionWith(a.text(t),!0):this.deleteSelection();{if(n==null&&(n=s),!t)return this.deleteRange(s,n);let o=this.storedMarks;if(!o){let l=this.doc.resolve(s);o=n==s?l.marks():l.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(s,n,a.text(t,o)),!this.selection.empty&&this.selection.to==s+t.length&&this.setSelection(Da.near(this.selection.$to)),this}}setMeta(t,s){return this.meta[typeof t=="string"?t:t.key]=s,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|=g4e,this}get scrolledIntoView(){return(this.updated&g4e)>0}}function x4e(e,t){return!t||!e?e:e.bind(t)}class qT{constructor(t,s,n){this.name=t,this.init=x4e(s.init,n),this.apply=x4e(s.apply,n)}}const Hyt=[new qT("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new qT("selection",{init(e,t){return e.selection||Da.atStart(t.doc)},apply(e){return e.selection}}),new qT("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,s,n){return n.selection.$cursor?e.storedMarks:null}}),new qT("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class nde{constructor(t,s){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Hyt.slice(),s&&s.forEach(n=>{if(this.pluginsByKey[n.key])throw new RangeError("Adding different instances of a keyed plugin ("+n.key+")");this.plugins.push(n),this.pluginsByKey[n.key]=n,n.spec.state&&this.fields.push(new qT(n.key,n.spec.state,n))})}}class lS{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,s=-1){for(let n=0;nn.toJSON())),t&&typeof t=="object")for(let n in t){if(n=="doc"||n=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let a=t[n],o=a.spec.state;o&&o.toJSON&&(s[n]=o.toJSON.call(a,this[a.key]))}return s}static fromJSON(t,s,n){if(!s)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let a=new nde(t.schema,t.plugins),o=new lS(a);return a.fields.forEach(l=>{if(l.name=="doc")o.doc=av.fromJSON(t.schema,s.doc);else if(l.name=="selection")o.selection=Da.fromJSON(o.doc,s.selection);else if(l.name=="storedMarks")s.storedMarks&&(o.storedMarks=s.storedMarks.map(t.schema.markFromJSON));else{if(n)for(let i in n){let u=n[i],m=u.spec.state;if(u.key==l.name&&m&&m.fromJSON&&Object.prototype.hasOwnProperty.call(s,i)){o[l.name]=m.fromJSON.call(u,t,s[i],o);return}}o[l.name]=l.init(t,o)}}),o}}function QFe(e,t,s){for(let n in e){let a=e[n];a instanceof Function?a=a.bind(t):n=="handleDOMEvents"&&(a=QFe(a,t,{})),s[n]=a}return s}class vd{constructor(t){this.spec=t,this.props={},t.props&&QFe(t.props,this,this.props),this.key=t.key?t.key.key:JFe("plugin")}getState(t){return t[this.key]}}const ade=Object.create(null);function JFe(e){return e in ade?e+"$"+ ++ade[e]:(ade[e]=0,e+"$")}class Tu{constructor(t="key"){this.key=JFe(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},VC=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let Bme=null;const Wx=function(e,t,s){let n=Bme||(Bme=document.createRange());return n.setEnd(e,s??e.nodeValue.length),n.setStart(e,t||0),n},Wyt=function(){Bme=null},yk=function(e,t,s,n){return s&&(y4e(e,t,s,n,-1)||y4e(e,t,s,n,1))},Gyt=/^(img|br|input|textarea|hr)$/i;function y4e(e,t,s,n,a){for(var o;;){if(e==s&&t==n)return!0;if(t==(a<0?0:op(e))){let l=e.parentNode;if(!l||l.nodeType!=1||gP(e)||Gyt.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?op(e):0}else return!1}}function op(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Kyt(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=op(e)}else if(e.parentNode&&!gP(e))t=ru(e),e=e.parentNode;else return null}}function Zyt(e,t){for(;;){if(e.nodeType==3&&t2),tp=HC||(ex?/Mac/.test(ex.platform):!1),rze=ex?/Win/.test(ex.platform):!1,sy=/Android \d/.test(Pv),xP=!!v4e&&"webkitFontSmoothing"in v4e.documentElement.style,Jyt=xP?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function e0t(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 Dx(e,t){return typeof e=="number"?e:e[t]}function t0t(e){let t=e.getBoundingClientRect(),s=t.width/e.offsetWidth||1,n=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*s,top:t.top,bottom:t.top+e.clientHeight*n}}function _4e(e,t,s){let n=e.someProp("scrollThreshold")||0,a=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument;for(let l=s||e.dom;l;){if(l.nodeType!=1){l=VC(l);continue}let i=l,u=i==o.body,m=u?e0t(o):t0t(i),x=0,y=0;if(t.topm.bottom-Dx(n,"bottom")&&(y=t.bottom-t.top>m.bottom-m.top?t.top+Dx(a,"top")-m.top:t.bottom-m.bottom+Dx(a,"bottom")),t.leftm.right-Dx(n,"right")&&(x=t.right-m.right+Dx(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:VC(l)}}function r0t(e){let t=e.dom.getBoundingClientRect(),s=Math.max(0,t.top),n,a;for(let o=(t.left+t.right)/2,l=s+1;l=s-20){n=i,a=u.top;break}}return{refDOM:n,refTop:a,stack:sze(e.dom)}}function sze(e){let t=[],s=e.ownerDocument;for(let n=e;n&&(t.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),e!=s);n=VC(n));return t}function s0t({refDOM:e,refTop:t,stack:s}){let n=e?e.getBoundingClientRect().top:0;nze(s,n==0?0:n-t)}function nze(e,t){for(let s=0;s=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});!s&&(t.left>=N.right&&t.top>=N.top||t.left>=N.left&&t.top>=N.bottom)&&(o=y+1)}}return!s&&u&&(s=u,a=m,n=0),s&&s.nodeType==3?a0t(s,a):!s||n&&s.nodeType==1?{node:e,offset:o}:aze(s,a)}function a0t(e,t){let s=e.nodeValue.length,n=document.createRange(),a;for(let o=0;o=(l.left+l.right)/2?1:0)};break}}return n.detach(),a||{node:e,offset:0}}function Kye(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function i0t(e,t){let s=e.parentNode;return s&&/^li$/i.test(s.nodeName)&&t.left(l.left+l.right)/2?1:-1}return e.docView.posFromDOM(n,a,o)}function l0t(e,t,s,n){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>n.left||u.top>n.top?a=i.posBefore:(!l&&u.right-1?a:e.docView.posFromDOM(t,s,-1)}function ize(e,t,s){let n=e.childNodes.length;if(n&&s.topt.top&&a++}let m;xP&&a&&n.nodeType==1&&(m=n.childNodes[a-1]).nodeType==1&&m.contentEditable=="false"&&m.getBoundingClientRect().top>=t.top&&a--,n==e.dom&&a==n.childNodes.length-1&&n.lastChild.nodeType==1&&t.top>n.lastChild.getBoundingClientRect().bottom?i=e.state.doc.content.size:(a==0||n.nodeType!=1||n.childNodes[a-1].nodeName!="BR")&&(i=l0t(e,n,a,t))}i==null&&(i=o0t(e,l,t));let u=e.docView.nearestDesc(l,!0);return{pos:i,inside:u?u.posAtStart-u.border:-1}}function b4e(e){return e.top=0&&a==n.nodeValue.length?(u--,x=1):s<0?u--:m++,xT(V0(Wx(n,u,m),x),x<0)}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(o==null&&a&&(s<0||a==op(n))){let u=n.childNodes[a-1];if(u.nodeType==1)return ide(u.getBoundingClientRect(),!1)}if(o==null&&a=0)}if(o==null&&a&&(s<0||a==op(n))){let u=n.childNodes[a-1],m=u.nodeType==3?Wx(u,op(u)-(l?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(m)return xT(V0(m,1),!1)}if(o==null&&a=0)}function xT(e,t){if(e.width==0)return e;let s=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:s,right:s}}function ide(e,t){if(e.height==0)return e;let s=t?e.top:e.bottom;return{top:s,bottom:s,left:e.left,right:e.right}}function lze(e,t,s){let n=e.state,a=e.root.activeElement;n!=t&&e.updateState(t),a!=e.dom&&e.focus();try{return s()}finally{n!=t&&e.updateState(n),a!=e.dom&&a&&a.focus()}}function u0t(e,t,s){let n=t.selection,a=s=="up"?n.$from:n.$to;return lze(e,t,()=>{let{node:o}=e.docView.domFromPos(a.pos,s=="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=oze(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=Wx(i,0,i.nodeValue.length).getClientRects();else continue;for(let m=0;mx.top+1&&(s=="up"?l.top-x.top>(x.bottom-l.top)*2:x.bottom-l.bottom>(l.bottom-x.top)*2))return!1}}return!0})}const h0t=/[\u0590-\u08ac]/;function m0t(e,t,s){let{$head:n}=t.selection;if(!n.parent.isTextblock)return!1;let a=n.parentOffset,o=!a,l=a==n.parent.content.size,i=e.domSelection();return i?!h0t.test(n.parent.textContent)||!i.modify?s=="left"||s=="backward"?o:l:lze(e,t,()=>{let{focusNode:u,focusOffset:m,anchorNode:x,anchorOffset:y}=e.domSelectionRange(),v=i.caretBidiLevel;i.modify("move",s,"character");let b=n.depth?e.docView.domAfterPos(n.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}):n.pos==n.start()||n.pos==n.end()}let w4e=null,j4e=null,k4e=!1;function p0t(e,t,s){return w4e==t&&j4e==s?k4e:(w4e=t,j4e=s,k4e=s=="up"||s=="down"?u0t(e,t,s):m0t(e,t,s))}const yp=0,N4e=1,uj=2,tx=3;class yP{constructor(t,s,n,a){this.parent=t,this.children=s,this.dom=n,this.contentDOM=a,this.dirty=yp,n.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,s,n){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let s=0;sru(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(s==0)for(let o=t;;o=o.parentNode){if(o==this.dom){a=!1;break}if(o.previousSibling)break}if(a==null&&s==t.childNodes.length)for(let o=t;;o=o.parentNode){if(o==this.dom){a=!0;break}if(o.nextSibling)break}}return a??n>0?this.posAtEnd:this.posAtStart}nearestDesc(t,s=!1){for(let n=!0,a=t;a;a=a.parentNode){let o=this.getDesc(a),l;if(o&&(!s||o.node))if(n&&(l=o.nodeDOM)&&!(l.nodeType==1?l.contains(t.nodeType==1?t:t.parentNode):l==t))n=!1;else return o}}getDesc(t){let s=t.pmViewDesc;for(let n=s;n;n=n.parent)if(n==this)return s}posFromDOM(t,s,n){for(let a=t;a;a=a.parentNode){let o=this.getDesc(a);if(o)return o.localPosFromDOM(t,s,n)}return-1}descAt(t){for(let s=0,n=0;st||l instanceof dze){a=t-o;break}o=i}if(a)return this.children[n].domFromPos(a-this.children[n].border,s);for(let o;n&&!(o=this.children[n-1]).size&&o instanceof cze&&o.side>=0;n--);if(s<=0){let o,l=!0;for(;o=n?this.children[n-1]:null,!(!o||o.dom.parentNode==this.contentDOM);n--,l=!1);return o&&s&&l&&!o.border&&!o.domAtom?o.domFromPos(o.size,s):{node:this.contentDOM,offset:o?ru(o.dom)+1:0}}else{let o,l=!0;for(;o=n=x&&s<=m-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(t,s,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>s||i==this.children.length-1)){s=m;for(let x=i+1;xN&&ls){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,s){for(let n=0,a=0;a=n:tn){let i=n+o.border,u=l-o.border;if(t>=i&&s<=u){this.dirty=t==n||s==l?uj:N4e,t==i&&s==u&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=tx:o.markDirty(t-i,s-i);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?uj:tx}n=l}this.dirty=uj}markParentsDirty(){let t=1;for(let s=this.parent;s;s=s.parent,t++){let n=t==1?uj:N4e;s.dirty{if(!o)return a;if(o.parent)return o.parent.posBeforeChild(o)})),!s.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=s,this.widget=s,o=this}matchesWidget(t){return this.dirty==yp&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let s=this.widget.spec.stopEvent;return s?s(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 f0t extends yP{constructor(t,s,n,a){super(t,[],s,null),this.textDOM=n,this.text=a}get size(){return this.text.length}localPosFromDOM(t,s){return t!=this.textDOM?this.posAtStart+(s?this.size:0):this.posAtStart+s}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class vk extends yP{constructor(t,s,n,a,o){super(t,[],n,a),this.mark=s,this.spec=o}static create(t,s,n,a){let o=a.nodeViews[s.type.name],l=o&&o(s,a,n);return(!l||!l.dom)&&(l=Ok.renderSpec(document,s.type.spec.toDOM(s,n),null,s.attrs)),new vk(t,s,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&tx||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=tx&&this.mark.eq(t)}markDirty(t,s){if(super.markDirty(t,s),this.dirty!=yp){let n=this.parent;for(;!n.node;)n=n.parent;n.dirty0&&(o=Hme(o,0,t,n));for(let i=0;i{if(!u)return l;if(u.parent)return u.parent.posBeforeChild(u)},n,a),x=m&&m.dom,y=m&&m.contentDOM;if(s.isText){if(!x)x=document.createTextNode(s.text);else if(x.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else x||({dom:x,contentDOM:y}=Ok.renderSpec(document,s.type.spec.toDOM(s),null,s.attrs));!y&&!s.isText&&x.nodeName!="BR"&&(x.hasAttribute("contenteditable")||(x.contentEditable="false"),s.type.spec.draggable&&(x.draggable=!0));let v=x;return x=mze(x,n,s),m?u=new g0t(t,s,n,a,x,y||null,v,m,o,l+1):s.isText?new bae(t,s,n,a,x,v,o):new ov(t,s,n,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 s=this.children.length-1;s>=0;s--){let n=this.children[s];if(this.dom.contains(n.dom.parentNode)){t.contentElement=n.dom.parentNode;break}}t.contentElement||(t.getContent=()=>gs.empty)}return t}matchesNode(t,s,n){return this.dirty==yp&&t.eq(this.node)&&hre(s,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,s){let n=this.node.inlineContent,a=s,o=t.composing?this.localCompositionInfo(t,s):null,l=o&&o.pos>-1?o:null,i=o&&o.pos<0,u=new y0t(this,l&&l.node,t);b0t(this.node,this.innerDeco,(m,x,y)=>{m.spec.marks?u.syncToMarks(m.spec.marks,n,t):m.type.side>=0&&!y&&u.syncToMarks(x==this.node.childCount?Ko.none:this.node.child(x).marks,n,t),u.placeWidget(m,t,a)},(m,x,y,v)=>{u.syncToMarks(m.marks,n,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([],n,t),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==uj)&&(l&&this.protectLocalComposition(t,l),uze(this.contentDOM,this.children,t),HC&&w0t(this.dom))}localCompositionInfo(t,s){let{from:n,to:a}=t.state.selection;if(!(t.state.selection instanceof ba)||ns+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=j0t(this.node.content,l,n-s,a-s);return i<0?null:{node:o,pos:i,text:l}}else return{node:o,pos:-1,text:""}}protectLocalComposition(t,{node:s,pos:n,text:a}){if(this.getDesc(s))return;let o=s;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 f0t(this,o,s,a);t.input.compositionNodes.push(l),this.children=Hme(this.children,n,n+a.length,t,l)}update(t,s,n,a){return this.dirty==tx||!t.sameMarkup(this.node)?!1:(this.updateInner(t,s,n,a),!0)}updateInner(t,s,n,a){this.updateOuterDeco(s),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(a,this.posAtStart),this.dirty=yp}updateOuterDeco(t){if(hre(t,this.outerDeco))return;let s=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=hze(this.dom,this.nodeDOM,Vme(this.outerDeco,this.node,s),Vme(t,this.node,s)),this.dom!=n&&(n.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 S4e(e,t,s,n,a){mze(n,t,e);let o=new ov(void 0,e,t,s,n,n,n,a,0);return o.contentDOM&&o.updateChildren(a,0),o}class bae extends ov{constructor(t,s,n,a,o,l,i){super(t,s,n,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,s,n,a){return this.dirty==tx||this.dirty!=yp&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(s),(this.dirty!=yp||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=yp,!0)}inParent(){let t=this.parent.contentDOM;for(let s=this.nodeDOM;s;s=s.parentNode)if(s==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,s,n){return t==this.nodeDOM?this.posAtStart+Math.min(s,this.node.text.length):super.localPosFromDOM(t,s,n)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,s,n){let a=this.node.cut(t,s),o=document.createTextNode(a.text);return new bae(this.parent,a,this.outerDeco,this.innerDeco,o,o,n)}markDirty(t,s){super.markDirty(t,s),this.dom!=this.nodeDOM&&(t==0||s==this.nodeDOM.nodeValue.length)&&(this.dirty=tx)}get domAtom(){return!1}isText(t){return this.node.text==t}}class dze extends yP{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==yp&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class g0t extends ov{constructor(t,s,n,a,o,l,i,u,m,x){super(t,s,n,a,o,l,i,m,x),this.spec=u}update(t,s,n,a){if(this.dirty==tx)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let o=this.spec.update(t,s,n);return o&&this.updateInner(t,s,n,a),o}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,s,n,a)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,s,n,a){this.spec.setSelection?this.spec.setSelection(t,s,n.root):super.setSelection(t,s,n,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 uze(e,t,s){let n=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=vk.create(this.top,t[o],s,n);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,o++}}findNodeMatch(t,s,n,a){let o=-1,l;if(a>=this.preMatch.index&&(l=this.preMatch.matches[a-this.preMatch.index]).parent==this.top&&l.matchesNode(t,s,n))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(n){let m=s.children[n-1];if(m instanceof vk)s=m,n=m.children.length;else{i=m,n--;break}}else{if(s==t)break e;n=s.parent.children.indexOf(s),s=s.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 _0t(e,t){return e.type.side-t.type.side}function b0t(e,t,s,n){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();n(v,k,t.forChild(o,v),b),o=N}}function w0t(e){if(e.nodeName=="UL"||e.nodeName=="OL"){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function j0t(e,t,s,n){for(let a=0,o=0;a=s){if(o>=n&&u.slice(n-t.length-i,n-i)==t)return n-t.length;let m=i=0&&m+t.length+i>=s)return i+m;if(s==n&&u.length>=n+t.length-i&&u.slice(n-i,n-i+t.length)==t)return n}}return-1}function Hme(e,t,s,n,a){let o=[];for(let l=0,i=0;l=s||x<=t?o.push(u):(ms&&o.push(u.slice(s-m,u.size,n)))}return o}function Zye(e,t=null){let s=e.domSelectionRange(),n=e.state.doc;if(!s.focusNode)return null;let a=e.docView.nearestDesc(s.focusNode),o=a&&a.size==0,l=e.docView.posFromDOM(s.focusNode,s.focusOffset,1);if(l<0)return null;let i=n.resolve(l),u,m;if(_ae(s)){for(u=l;a&&!a.node;)a=a.parent;let y=a.node;if(a&&y.isAtom&&pa.isSelectable(y)&&a.parent&&!(y.isInline&&Yyt(s.focusNode,s.focusOffset,a.dom))){let v=a.posBefore;m=new pa(l==v?i:n.resolve(v))}}else{if(s instanceof e.dom.ownerDocument.defaultView.Selection&&s.rangeCount>1){let y=l,v=l;for(let b=0;b{(s.anchorNode!=n||s.anchorOffset!=a)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!pze(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function N0t(e){let t=e.domSelection();if(!t)return;let s=e.cursorWrapper.dom,n=s.nodeName=="IMG";n?t.collapse(s.parentNode,ru(s)+1):t.collapse(s,0),!n&&!e.state.selection.visible&&Fh&&iv<=11&&(s.disabled=!0,s.disabled=!1)}function fze(e,t){if(t instanceof pa){let s=e.docView.descAt(t.from);s!=e.lastSelectedViewDesc&&(E4e(e),s&&s.selectNode(),e.lastSelectedViewDesc=s)}else E4e(e)}function E4e(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Yye(e,t,s,n){return e.someProp("createSelectionBetween",a=>a(e,t,s))||ba.between(t,s,n)}function I4e(e){return e.editable&&!e.hasFocus()?!1:gze(e)}function gze(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 S0t(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),s=e.domSelectionRange();return yk(t.node,t.offset,s.anchorNode,s.anchorOffset)}function Wme(e,t){let{$anchor:s,$head:n}=e.selection,a=t>0?s.max(n):s.min(n),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 P4e(e,t,s){let n=e.state.selection;if(n instanceof ba)if(s.indexOf("s")>-1){let{$head:a}=n,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 ba(n.$anchor,l))}else if(n.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let a=Wme(e.state,t);return a&&a instanceof pa?e1(e,a):!1}else if(!(tp&&s.indexOf("m")>-1)){let a=n.$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?pa.isSelectable(o)?e1(e,new pa(t<0?e.state.doc.resolve(a.pos-o.nodeSize):a)):xP?e1(e,new ba(e.state.doc.resolve(t<0?i:i+o.nodeSize))):!1:!1}}else return!1;else{if(n instanceof pa&&n.node.isInline)return e1(e,new ba(t>0?n.$to:n.$from));{let a=Wme(e.state,t);return a?e1(e,a):!1}}}function mre(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function KA(e,t){let s=e.pmViewDesc;return s&&s.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function O4(e,t){return t<0?C0t(e):M0t(e)}function C0t(e){let t=e.domSelectionRange(),s=t.focusNode,n=t.focusOffset;if(!s)return;let a,o,l=!1;for(xp&&s.nodeType==1&&n0){if(s.nodeType!=1)break;{let i=s.childNodes[n-1];if(KA(i,-1))a=s,o=--n;else if(i.nodeType==3)s=i,n=s.nodeValue.length;else break}}else{if(xze(s))break;{let i=s.previousSibling;for(;i&&KA(i,-1);)a=s.parentNode,o=ru(i),i=i.previousSibling;if(i)s=i,n=mre(s);else{if(s=s.parentNode,s==e.dom)break;n=0}}}l?Gme(e,s,n):a&&Gme(e,a,o)}function M0t(e){let t=e.domSelectionRange(),s=t.focusNode,n=t.focusOffset;if(!s)return;let a=mre(s),o,l;for(;;)if(n{e.state==a&&by(e)},50)}function L4e(e,t){let s=e.state.doc.resolve(t);if(!(Rd||rze)&&s.parent.inlineContent){let a=e.coordsAtPos(t);if(t>s.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 O4e(e,t,s){let n=e.state.selection;if(n instanceof ba&&!n.empty||s.indexOf("s")>-1||tp&&s.indexOf("m")>-1)return!1;let{$from:a,$to:o}=n;if(!a.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let l=Wme(e.state,t);if(l&&l instanceof pa)return e1(e,l)}if(!a.parent.inlineContent){let l=t<0?a:o,i=n instanceof jm?Da.near(l,t):Da.findFrom(l,t);return i?e1(e,i):!1}return!1}function D4e(e,t){if(!(e.state.selection instanceof ba))return!0;let{$head:s,$anchor:n,empty:a}=e.state.selection;if(!s.sameParent(n))return!0;if(!a)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!s.textOffset&&(t<0?s.nodeBefore:s.nodeAfter);if(o&&!o.isText){let l=e.state.tr;return t<0?l.delete(s.pos-o.nodeSize,s.pos):l.delete(s.pos,s.pos+o.nodeSize),e.dispatch(l),!0}return!1}function R4e(e,t,s){e.domObserver.stop(),t.contentEditable=s,e.domObserver.start()}function E0t(e){if(!Nu||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:s}=e.domSelectionRange();if(t&&t.nodeType==1&&s==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let n=t.firstChild;R4e(e,n,"true"),setTimeout(()=>R4e(e,n,"false"),20)}return!1}function I0t(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function P0t(e,t){let s=t.keyCode,n=I0t(t);if(s==8||tp&&s==72&&n=="c")return D4e(e,-1)||O4(e,-1);if(s==46&&!t.shiftKey||tp&&s==68&&n=="c")return D4e(e,1)||O4(e,1);if(s==13||s==27)return!0;if(s==37||tp&&s==66&&n=="c"){let a=s==37?L4e(e,e.state.selection.from)=="ltr"?-1:1:-1;return P4e(e,a,n)||O4(e,a)}else if(s==39||tp&&s==70&&n=="c"){let a=s==39?L4e(e,e.state.selection.from)=="ltr"?1:-1:1;return P4e(e,a,n)||O4(e,a)}else{if(s==38||tp&&s==80&&n=="c")return O4e(e,-1,n)||O4(e,-1);if(s==40||tp&&s==78&&n=="c")return E0t(e)||O4e(e,1,n)||O4(e,1);if(n==(tp?"m":"c")&&(s==66||s==73||s==89||s==90))return!0}return!1}function Xye(e,t){e.someProp("transformCopied",b=>{t=b(t,e)});let s=[],{content:n,openStart:a,openEnd:o}=t;for(;a>1&&o>1&&n.childCount==1&&n.firstChild.childCount==1;){a--,o--;let b=n.firstChild;s.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),n=b.content}let l=e.someProp("clipboardSerializer")||Ok.fromSchema(e.state.schema),i=jze(),u=i.createElement("div");u.appendChild(l.serializeFragment(n,{document:i}));let m=u.firstChild,x,y=0;for(;m&&m.nodeType==1&&(x=wze[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(s)}`);let v=e.someProp("clipboardTextSerializer",b=>b(t,e))||t.content.textBetween(0,t.content.size,` `);return{dom:u,text:v,slice:t}}function yze(e,t,s,n,a){let o=a.parent.type.spec.code,l,i;if(!s&&!t)return null;let u=!!t&&(n||o||!s);if(u){if(e.someProp("transformPastedText",v=>{t=v(t,o||n,e)}),o)return i=new Js(gs.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,n,e));if(y)i=y;else{let v=a.marks(),{schema:b}=e.state,N=Ok.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=>{s=y(s,e)}),l=R0t(s),xP&&F0t(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")||HA.fromSchema(e.state.schema)).parseSlice(l,{preserveWhitespace:!!(u||x),context:a,ruleFromNode(v){return v.nodeName=="BR"&&!v.nextSibling&&v.parentNode&&!L0t.test(v.parentNode.nodeName)?{ignore:!0}:null}})),x)i=z0t(F4e(i,+x[1],+x[2]),x[4]);else if(i=Js.maxOpen(O0t(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 L0t=/^(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 O0t(e,t){if(e.childCount<2)return e;for(let s=t.depth;s>=0;s--){let a=t.node(s).contentMatchAt(t.index(s)),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&&_ze(u,o,i,l[l.length-1],0))l[l.length-1]=m;else{l.length&&(l[l.length-1]=bze(l[l.length-1],o.length));let x=vze(i,u);l.push(x),a=a.matchType(x.type),o=u}}),l)return gs.from(l)}return e}function vze(e,t,s=0){for(let n=t.length-1;n>=s;n--)e=t[n].create(null,gs.from(e));return e}function _ze(e,t,s,n,a){if(a1&&(o=0),a=s&&(i=t<0?l.contentMatchAt(0).fillBefore(i,o<=a).append(i):i.append(l.contentMatchAt(l.childCount).fillBefore(gs.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,l.copy(i))}function F4e(e,t,s){return ts})),lde.createHTML(e)):e}function R0t(e){let t=/^(\s*]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let s=jze().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(e),a;if((a=n&&wze[n[1].toLowerCase()])&&(e=a.map(o=>"<"+o+">").join("")+e+a.map(o=>"").reverse().join("")),s.innerHTML=D0t(e),a)for(let o=0;o=0;i-=2){let u=s.nodes[n[i]];if(!u||u.hasRequiredAttrs())break;a=gs.from(u.create(n[i+1],a)),o++,l++}return new Js(a,o,l)}const ih={},oh={},B0t={touchstart:!0,touchmove:!0};class $0t{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 U0t(e){for(let t in ih){let s=ih[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=n=>{V0t(e,n)&&!Qye(e,n)&&(e.editable||!(n.type in oh))&&s(e,n)},B0t[t]?{passive:!0}:void 0)}Nu&&e.dom.addEventListener("input",()=>null),Zme(e)}function E1(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function q0t(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 Zme(e){e.someProp("handleDOMEvents",t=>{for(let s in t)e.input.eventHandlers[s]||e.dom.addEventListener(s,e.input.eventHandlers[s]=n=>Qye(e,n))})}function Qye(e,t){return e.someProp("handleDOMEvents",s=>{let n=s[t.type];return n?n(e,t)||t.defaultPrevented:!1})}function V0t(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let s=t.target;s!=e.dom;s=s.parentNode)if(!s||s.nodeType==11||s.pmViewDesc&&s.pmViewDesc.stopEvent(t))return!1;return!0}function H0t(e,t){!Qye(e,t)&&ih[t.type]&&(e.editable||!(t.type in oh))&&ih[t.type](e,t)}oh.keydown=(e,t)=>{let s=t;if(e.input.shiftKey=s.keyCode==16||s.shiftKey,!Nze(e,s)&&(e.input.lastKeyCode=s.keyCode,e.input.lastKeyCodeTime=Date.now(),!(sy&&Rd&&s.keyCode==13)))if(s.keyCode!=229&&e.domObserver.forceFlush(),HC&&s.keyCode==13&&!s.ctrlKey&&!s.altKey&&!s.metaKey){let n=Date.now();e.input.lastIOSEnter=n,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==n&&(e.someProp("handleKeyDown",a=>a(e,rj(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",n=>n(e,s))||P0t(e,s)?s.preventDefault():E1(e,"key")};oh.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};oh.keypress=(e,t)=>{let s=t;if(Nze(e,s)||!s.charCode||s.ctrlKey&&!s.altKey||tp&&s.metaKey)return;if(e.someProp("handleKeyPress",a=>a(e,s))){s.preventDefault();return}let n=e.state.selection;if(!(n instanceof ba)||!n.$from.sameParent(n.$to)){let a=String.fromCharCode(s.charCode),o=()=>e.state.tr.insertText(a).scrollIntoView();!/[\r\n]/.test(a)&&!e.someProp("handleTextInput",l=>l(e,n.$from.pos,n.$to.pos,a,o))&&e.dispatch(o()),s.preventDefault()}};function wae(e){return{left:e.clientX,top:e.clientY}}function W0t(e,t){let s=t.x-e.clientX,n=t.y-e.clientY;return s*s+n*n<100}function Jye(e,t,s,n,a){if(n==-1)return!1;let o=e.state.doc.resolve(n);for(let l=o.depth+1;l>0;l--)if(e.someProp(t,i=>l>o.depth?i(e,s,o.nodeAfter,o.before(l),a,!0):i(e,s,o.node(l),o.before(l),a,!1)))return!0;return!1}function nC(e,t,s){if(e.focused||e.focus(),e.state.selection.eq(t))return;let n=e.state.tr.setSelection(t);n.setMeta("pointer",!0),e.dispatch(n)}function G0t(e,t){if(t==-1)return!1;let s=e.state.doc.resolve(t),n=s.nodeAfter;return n&&n.isAtom&&pa.isSelectable(n)?(nC(e,new pa(s)),!0):!1}function K0t(e,t){if(t==-1)return!1;let s=e.state.selection,n,a;s instanceof pa&&(n=s.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(pa.isSelectable(i)){n&&s.$from.depth>0&&l>=s.$from.depth&&o.before(s.$from.depth+1)==s.$from.pos?a=o.before(s.$from.depth):a=o.before(l);break}}return a!=null?(nC(e,pa.create(e.state.doc,a)),!0):!1}function Z0t(e,t,s,n,a){return Jye(e,"handleClickOn",t,s,n)||e.someProp("handleClick",o=>o(e,t,n))||(a?K0t(e,s):G0t(e,s))}function Y0t(e,t,s,n){return Jye(e,"handleDoubleClickOn",t,s,n)||e.someProp("handleDoubleClick",a=>a(e,t,n))}function X0t(e,t,s,n){return Jye(e,"handleTripleClickOn",t,s,n)||e.someProp("handleTripleClick",a=>a(e,t,n))||Q0t(e,s,n)}function Q0t(e,t,s){if(s.button!=0)return!1;let n=e.state.doc;if(t==-1)return n.inlineContent?(nC(e,ba.create(n,0,n.content.size)),!0):!1;let a=n.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)nC(e,ba.create(n,i+1,i+1+l.content.size));else if(pa.isSelectable(l))nC(e,pa.create(n,i));else continue;return!0}}function e0e(e){return pre(e)}const kze=tp?"metaKey":"ctrlKey";ih.mousedown=(e,t)=>{let s=t;e.input.shiftKey=s.shiftKey;let n=e0e(e),a=Date.now(),o="singleClick";a-e.input.lastClick.time<500&&W0t(s,e.input.lastClick)&&!s[kze]&&e.input.lastClick.button==s.button&&(e.input.lastClick.type=="singleClick"?o="doubleClick":e.input.lastClick.type=="doubleClick"&&(o="tripleClick")),e.input.lastClick={time:a,x:s.clientX,y:s.clientY,type:o,button:s.button};let l=e.posAtCoords(wae(s));l&&(o=="singleClick"?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new J0t(e,l,s,!!n)):(o=="doubleClick"?Y0t:X0t)(e,l.pos,l.inside,s)?s.preventDefault():E1(e,"pointer"))};class J0t{constructor(t,s,n,a){this.view=t,this.pos=s,this.event=n,this.flushed=a,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!n[kze],this.allowDefault=n.shiftKey;let o,l;if(s.inside>-1)o=t.state.doc.nodeAt(s.inside),l=s.inside;else{let x=t.state.doc.resolve(s.pos);o=x.parent,l=x.depth?x.before():0}const i=a?null:n.target,u=i?t.docView.nearestDesc(i,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:m}=t.state;(n.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||m instanceof pa&&m.from<=l&&m.to>l)&&(this.mightDrag={node:o,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&xp&&!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 s=this.pos;this.view.state.doc!=this.startDoc&&(s=this.view.posAtCoords(wae(t))),this.updateAllowDefault(t),this.allowDefault||!s?E1(this.view,"pointer"):Z0t(this.view,s.pos,s.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||Nu&&this.mightDrag&&!this.mightDrag.node.isAtom||Rd&&!this.view.state.selection.visible&&Math.min(Math.abs(s.pos-this.view.state.selection.from),Math.abs(s.pos-this.view.state.selection.to))<=2)?(nC(this.view,Da.near(this.view.state.doc.resolve(s.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)}}ih.touchstart=e=>{e.input.lastTouch=Date.now(),e0e(e),E1(e,"pointer")};ih.touchmove=e=>{e.input.lastTouch=Date.now(),E1(e,"pointer")};ih.contextmenu=e=>e0e(e);function Nze(e,t){return e.composing?!0:Nu&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const e1t=sy?5e3:-1;oh.compositionstart=oh.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,s=t.selection.$to;if(t.selection instanceof ba&&(t.storedMarks||!s.textOffset&&s.parentOffset&&s.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)||Rd&&rze&&t1t(e)))e.markCursor=e.state.storedMarks||s.marks(),pre(e,!0),e.markCursor=null;else if(pre(e,!t.selection.empty),xp&&t.selection.empty&&s.parentOffset&&!s.textOffset&&s.nodeBefore.marks.length){let n=e.domSelectionRange();for(let a=n.focusNode,o=n.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}Sze(e,e1t)};function t1t(e){let{focusNode:t,focusOffset:s}=e.domSelectionRange();if(!t||t.nodeType!=1||s>=t.childNodes.length)return!1;let n=t.childNodes[s];return n.nodeType==1&&n.contentEditable=="false"}oh.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++,Sze(e,20))};function Sze(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>pre(e),t))}function Cze(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=s1t());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function r1t(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let s=Kyt(t.focusNode,t.focusOffset),n=Zyt(t.focusNode,t.focusOffset);if(s&&n&&s!=n){let a=n.pmViewDesc,o=e.domObserver.lastChangedTextNode;if(s==o||n==o)return o;if(!a||!a.isText(n.nodeValue))return n;if(e.input.compositionNode==n){let l=s.pmViewDesc;if(!(!l||!l.isText(s.nodeValue)))return n}}return s||n}function s1t(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function pre(e,t=!1){if(!(sy&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Cze(e),t||e.docView&&e.docView.dirty){let s=Zye(e),n=e.state.selection;return s&&!s.eq(n)?e.dispatch(e.state.tr.setSelection(s)):(e.markCursor||t)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function n1t(e,t){if(!e.dom.parentNode)return;let s=e.dom.parentNode.appendChild(document.createElement("div"));s.appendChild(t),s.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),a=document.createRange();a.selectNodeContents(t),e.dom.blur(),n.removeAllRanges(),n.addRange(a),setTimeout(()=>{s.parentNode&&s.parentNode.removeChild(s),e.focus()},50)}const GE=Fh&&iv<15||HC&&Jyt<604;ih.copy=oh.cut=(e,t)=>{let s=t,n=e.state.selection,a=s.type=="cut";if(n.empty)return;let o=GE?null:s.clipboardData,l=n.content(),{dom:i,text:u}=Xye(e,l);o?(s.preventDefault(),o.clearData(),o.setData("text/html",i.innerHTML),o.setData("text/plain",u)):n1t(e,i),a&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function a1t(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function i1t(e,t){if(!e.dom.parentNode)return;let s=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,n=e.dom.parentNode.appendChild(document.createElement(s?"textarea":"div"));s||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let a=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),n.parentNode&&n.parentNode.removeChild(n),s?KE(e,n.value,null,a,t):KE(e,n.textContent,n.innerHTML,a,t)},50)}function KE(e,t,s,n,a){let o=yze(e,t,s,n,e.state.selection.$from);if(e.someProp("handlePaste",u=>u(e,a,o||Js.empty)))return!0;if(!o)return!1;let l=a1t(o),i=l?e.state.tr.replaceSelectionWith(l,n):e.state.tr.replaceSelection(o);return e.dispatch(i.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Mze(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let s=e.getData("text/uri-list");return s?s.replace(/\r?\n/g," "):""}oh.paste=(e,t)=>{let s=t;if(e.composing&&!sy)return;let n=GE?null:s.clipboardData,a=e.input.shiftKey&&e.input.lastKeyCode!=45;n&&KE(e,Mze(n),n.getData("text/html"),a,s)?s.preventDefault():i1t(e,s)};class Tze{constructor(t,s,n){this.slice=t,this.move=s,this.node=n}}const o1t=tp?"altKey":"ctrlKey";function Aze(e,t){let s=e.someProp("dragCopies",n=>!n(t));return s??!t[o1t]}ih.dragstart=(e,t)=>{let s=t,n=e.input.mouseDown;if(n&&n.done(),!s.dataTransfer)return;let a=e.state.selection,o=a.empty?null:e.posAtCoords(wae(s)),l;if(!(o&&o.pos>=a.from&&o.pos<=(a instanceof pa?a.to-1:a.to))){if(n&&n.mightDrag)l=pa.create(e.state.doc,n.mightDrag.pos);else if(s.target&&s.target.nodeType==1){let y=e.docView.nearestDesc(s.target,!0);y&&y.node.type.spec.draggable&&y!=e.docView&&(l=pa.create(e.state.doc,y.posBefore))}}let i=(l||e.state.selection).content(),{dom:u,text:m,slice:x}=Xye(e,i);(!s.dataTransfer.files.length||!Rd||tze>120)&&s.dataTransfer.clearData(),s.dataTransfer.setData(GE?"Text":"text/html",u.innerHTML),s.dataTransfer.effectAllowed="copyMove",GE||s.dataTransfer.setData("text/plain",m),e.dragging=new Tze(x,Aze(e,s),l)};ih.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};oh.dragover=oh.dragenter=(e,t)=>t.preventDefault();oh.drop=(e,t)=>{try{l1t(e,t,e.dragging)}finally{e.dragging=null}};function l1t(e,t,s){if(!t.dataTransfer)return;let n=e.posAtCoords(wae(t));if(!n)return;let a=e.state.doc.resolve(n.pos),o=s&&s.slice;o?e.someProp("transformPasted",b=>{o=b(o,e,!1)}):o=yze(e,Mze(t.dataTransfer),GE?null:t.dataTransfer.getData("text/html"),!1,a);let l=!!(s&&Aze(e,t));if(e.someProp("handleDrop",b=>b(e,t,o||Js.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let i=o?WFe(e.state.doc,a.pos,o):a.pos;i==null&&(i=a.pos);let u=e.state.tr;if(l){let{node:b}=s;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&&pa.isSelectable(o.content.firstChild)&&v.nodeAfter&&v.nodeAfter.sameMarkup(o.content.firstChild))u.setSelection(new pa(v));else{let b=u.mapping.map(i);u.mapping.maps[u.mapping.maps.length-1].forEach((N,k,M,E)=>b=E),u.setSelection(Yye(e,v,u.doc.resolve(b)))}e.focus(),e.dispatch(u.setMeta("uiEvent","drop"))}ih.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))};ih.blur=(e,t)=>{let s=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),s.relatedTarget&&e.dom.contains(s.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};ih.beforeinput=(e,t)=>{if(Rd&&sy&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:n}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=n||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",o=>o(e,rj(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 oh)ih[e]=oh[e];function ZE(e,t){if(e==t)return!0;for(let s in e)if(e[s]!==t[s])return!1;for(let s in t)if(!(s in e))return!1;return!0}class fre{constructor(t,s){this.toDOM=t,this.spec=s||Xj,this.side=this.spec.side||0}map(t,s,n,a){let{pos:o,deleted:l}=t.mapResult(s.from+a,this.side<0?-1:1);return l?null:new Xu(o-n,o-n,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&&ZE(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class lv{constructor(t,s){this.attrs=t,this.spec=s||Xj}map(t,s,n,a){let o=t.map(s.from+a,this.spec.inclusiveStart?-1:1)-n,l=t.map(s.to+a,this.spec.inclusiveEnd?1:-1)-n;return o>=l?null:new Xu(o,l,this)}valid(t,s){return s.from=t&&(!o||o(i.spec))&&n.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,s-i,n,a+i,o)}}map(t,s,n){return this==fu||t.maps.length==0?this:this.mapInner(t,s,0,0,n||Xj)}mapInner(t,s,n,a,o){let l;for(let i=0;i{let m=u+n,x;if(x=Ize(s,i,m)){for(a||(a=this.children.slice());oi&&y.to=t){this.children[i]==t&&(n=this.children[i+2]);break}let o=t+1,l=o+s.content.size;for(let i=0;io&&u.type instanceof lv){let m=Math.max(o,u.from)-o,x=Math.min(l,u.to)-o;ma.map(t,s,Xj));return d1.from(n)}forChild(t,s){if(s.isLeaf)return tc.empty;let n=[];for(let a=0;as instanceof tc)?t:t.reduce((s,n)=>s.concat(n instanceof tc?n:n.members),[]))}}forEachSet(t){for(let s=0;s{let M=k-N-(b-v);for(let E=0;ET+x-y)continue;let P=i[E]+x-y;b>=P?i[E+1]=v<=P?-2:-1:v>=x&&M&&(i[E]+=M,i[E+1]+=M)}y+=M}),x=s.maps[m].map(x,-1)}let u=!1;for(let m=0;m=n.content.size){u=!0;continue}let v=s.map(e[m+1]+o,-1),b=v-a,{index:N,offset:k}=n.content.findIndex(y),M=n.maybeChild(N);if(M&&k==y&&k+M.nodeSize==b){let E=i[m+2].mapInner(s,M,x+1,e[m]+o+1,l);E!=fu?(i[m]=y,i[m+1]=b,i[m+2]=E):(i[m+1]=-2,u=!0)}else u=!0}if(u){let m=d1t(i,e,t,s,a,o,l),x=gre(m,n,0,l);t=x.local;for(let y=0;ys&&l.to{let m=Ize(e,i,u+s);if(m){o=!0;let x=gre(m,i,s+u+1,n);x!=fu&&a.push(u,u+i.nodeSize,x)}});let l=Eze(o?Pze(e):e,-s).sort(Qj);for(let i=0;i0;)t++;e.splice(t,0,s)}function cde(e){let t=[];return e.someProp("decorations",s=>{let n=s(e.state);n&&n!=fu&&t.push(n)}),e.cursorWrapper&&t.push(tc.create(e.state.doc,[e.cursorWrapper.deco])),d1.from(t)}const u1t={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},h1t=Fh&&iv<=11;class m1t{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 p1t{constructor(t,s){this.view=t,this.handleDOMChange=s,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new m1t,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(n=>{for(let a=0;aa.type=="childList"&&a.removedNodes.length||a.type=="characterData"&&a.oldValue.length>a.target.nodeValue.length)?this.flushSoon():this.flush()}),h1t&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,u1t)),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 s=0;sthis.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(I4e(this.view)){if(this.suppressingSelectionUpdates)return by(this.view);if(Fh&&iv<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&yk(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 s=new Set,n;for(let o=t.focusNode;o;o=VC(o))s.add(o);for(let o=t.anchorNode;o;o=VC(o))if(s.has(o)){n=o;break}let a=n&&this.view.docView.nearestDesc(n);if(a&&a.ignoreMutation({type:"selection",target:n.nodeType==3?n.parentNode:n}))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 s=this.pendingRecords();s.length&&(this.queue=[]);let n=t.domSelectionRange(),a=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&I4e(t)&&!this.ignoreSelectionChange(n),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||x1t(t,y)!=b)&&v.remove()}}}else if((Rd||Nu)&&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),f1t(t)),this.handleDOMChange(o,l,i,u),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(n)||by(t),this.currentSelection.set(n))}registerMutation(t,s){if(s.indexOf(t.target)>-1)return null;let n=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(n==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!n||n.ignoreMutation(t))return null;if(t.type=="childList"){for(let x=0;xa;M--){let E=n.childNodes[M-1],T=E.pmViewDesc;if(E.nodeName=="BR"&&!T){o=M;break}if(!T||T.size)break}let y=e.state.doc,v=e.someProp("domParser")||HA.fromSchema(e.state.schema),b=y.resolve(l),N=null,k=v.parse(n,{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:v1t,context:b});if(m&&m[0].pos!=null){let M=m[0].pos,E=m[1]&&m[1].pos;E==null&&(E=M),N={anchor:M+l,head:E+l}}return{doc:k,sel:N,from:l,to:i}}function v1t(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(Nu&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let s=document.createElement("div");return s.appendChild(document.createElement("li")),{skip:s}}else if(e.parentNode.lastChild==e||Nu&&/^(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 _1t=/^(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 b1t(e,t,s,n,a){let o=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let q=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,H=Zye(e,q);if(H&&!e.state.selection.eq(H)){if(Rd&&sy&&e.input.lastKeyCode===13&&Date.now()-100Q(e,rj(13,"Enter"))))return;let G=e.state.tr.setSelection(H);q=="pointer"?G.setMeta("pointer",!0):q=="key"&&G.scrollIntoView(),o&&G.setMeta("composition",o),e.dispatch(G)}return}let l=e.state.doc.resolve(t),i=l.sharedDepth(s);t=l.before(i+1),s=e.state.doc.resolve(s).after(i+1);let u=e.state.selection,m=y1t(e,t,s),x=e.state.doc,y=x.slice(m.from,m.to),v,b;e.input.lastKeyCode===8&&Date.now()-100Date.now()-225||sy)&&a.some(q=>q.nodeType==1&&!_1t.test(q.nodeName))&&(!N||N.endA>=N.endB)&&e.someProp("handleKeyDown",q=>q(e,rj(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!N)if(n&&u instanceof ba&&!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 q=V4e(e,e.state.doc,m.sel);if(q&&!q.eq(e.state.selection)){let H=e.state.tr.setSelection(q);o&&H.setMeta("composition",o),e.dispatch(H)}}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&&iv<=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),E=x.resolve(N.start),T=k.sameParent(M)&&k.parent.inlineContent&&E.end()>=N.endA;if((HC&&e.input.lastIOSEnter>Date.now()-225&&(!T||a.some(q=>q.nodeName=="DIV"||q.nodeName=="P"))||!T&&k.posq(e,rj(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>N.start&&j1t(x,N.start,N.endA,k,M)&&e.someProp("handleKeyDown",q=>q(e,rj(8,"Backspace")))){sy&&Rd&&e.domObserver.suppressSelectionUpdates();return}Rd&&N.endB==N.start&&(e.input.lastChromeDelete=Date.now()),sy&&!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(q){return q(e,rj(13,"Enter"))})},20));let P=N.start,R=N.endA,D=q=>{let H=q||e.state.tr.replace(P,R,m.doc.slice(N.start-m.from,N.endB-m.from));if(m.sel){let G=V4e(e,H.doc,m.sel);G&&!(Rd&&e.composing&&G.empty&&(N.start!=N.endB||e.input.lastChromeDeleteby(e),20));let q=D(e.state.tr.delete(P,R)),H=x.resolve(N.start).marksAcross(x.resolve(N.endA));H&&q.ensureMarks(H),e.dispatch(q)}else if(N.endA==N.endB&&(U=w1t(k.parent.content.cut(k.parentOffset,M.parentOffset),E.parent.content.cut(E.parentOffset,N.endA-E.start())))){let q=D(e.state.tr);U.type=="add"?q.addMark(P,R,U.mark):q.removeMark(P,R,U.mark),e.dispatch(q)}else if(k.parent.child(k.index()).isText&&k.index()==M.index()-(M.textOffset?0:1)){let q=k.parent.textBetween(k.parentOffset,M.parentOffset),H=()=>D(e.state.tr.insertText(q,P,R));e.someProp("handleTextInput",G=>G(e,P,R,q,H))||e.dispatch(H())}else e.dispatch(D());else e.dispatch(D())}function V4e(e,t,s){return Math.max(s.anchor,s.head)>t.content.size?null:Yye(e,t.resolve(s.anchor),t.resolve(s.head))}function w1t(e,t){let s=e.firstChild.marks,n=t.firstChild.marks,a=s,o=n,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;xs||dde(l,!0,!1)0&&(t||e.indexAfter(n)==e.node(n).childCount);)n--,a++,t=!1;if(s){let o=e.node(n).maybeChild(e.indexAfter(n));for(;o&&!o.isLeaf;)o=o.firstChild,a++}return a}function k1t(e,t,s,n,a){let o=e.findDiffStart(t,s);if(o==null)return null;let{a:l,b:i}=e.findDiffEnd(t,s+e.size,s+t.size);if(a=="end"){let u=Math.max(0,o-Math.min(l,i));n-=l+u-o}if(l=l?o-n:0;o-=u,o&&o=i?o-n:0;o-=u,o&&o=56320&&t<=57343&&s>=55296&&s<=56319}class Lze{constructor(t,s){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 $0t,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=s,this.state=s.state,this.directPlugins=s.plugins||[],this.directPlugins.forEach(Y4e),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=K4e(this),G4e(this),this.nodeViews=Z4e(this),this.docView=S4e(this.state.doc,W4e(this),cde(this),this.dom,this),this.domObserver=new p1t(this,(n,a,o,l)=>b1t(this,n,a,o,l)),this.domObserver.start(),U0t(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 s in t)this._props[s]=t[s];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&Zme(this);let s=this._props;this._props=t,t.plugins&&(t.plugins.forEach(Y4e),this.directPlugins=t.plugins),this.updateStateInner(t.state,s)}setProps(t){let s={};for(let n in this._props)s[n]=this._props[n];s.state=this.state;for(let n in t)s[n]=t[n];this.update(s)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,s){var n;let a=this.state,o=!1,l=!1;t.storedMarks&&this.composing&&(Cze(this),l=!0),this.state=t;let i=a.plugins!=t.plugins||this._props.plugins!=s.plugins;if(i||this._props.plugins!=s.plugins||this._props.nodeViews!=s.nodeViews){let b=Z4e(this);S1t(b,this.nodeViews)&&(this.nodeViews=b,o=!0)}(i||s.handleDOMEvents!=this._props.handleDOMEvents)&&Zme(this),this.editable=K4e(this),G4e(this);let u=cde(this),m=W4e(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&&r0t(this);if(l){this.domObserver.stop();let b=y&&(Fh||Rd)&&!this.composing&&!a.selection.empty&&!t.selection.empty&&N1t(a.selection,t.selection);if(y){let N=Rd?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=r1t(this)),(o||!this.docView.update(t.doc,m,u,this))&&(this.docView.updateOuterDeco(m),this.docView.destroy(),this.docView=S4e(t.doc,m,u,this.dom,this)),N&&!this.trackWrites&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&S0t(this))?by(this,b):(fze(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(a),!((n=this.dragging)===null||n===void 0)&&n.node&&!a.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,a),x=="reset"?this.dom.scrollTop=0:x=="to selection"?this.scrollToSelection():v&&s0t(v)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!(!t||!this.dom.contains(t.nodeType==1?t:t.parentNode))){if(!this.someProp("handleScrollToSelection",s=>s(this)))if(this.state.selection instanceof pa){let s=this.docView.domAfterPos(this.state.selection.from);s.nodeType==1&&_4e(this,s.getBoundingClientRect(),t)}else _4e(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 s=0;s0&&this.state.doc.nodeAt(o))==n.node&&(a=o)}this.dragging=new Tze(t.slice,t.move,a<0?void 0:pa.create(this.state.doc,a))}someProp(t,s){let n=this._props&&this._props[t],a;if(n!=null&&(a=s?s(n):n))return a;for(let l=0;ls.ownerDocument.getSelection()),this._root=s}return t||document}updateRoot(){this._root=null}posAtCoords(t){return c0t(this,t)}coordsAtPos(t,s=1){return oze(this,t,s)}domAtPos(t,s=0){return this.docView.domFromPos(t,s)}nodeDOM(t){let s=this.docView.descAt(t);return s?s.nodeDOM:null}posAtDOM(t,s,n=-1){let a=this.docView.posFromDOM(t,s,n);if(a==null)throw new RangeError("DOM position not inside the editor");return a}endOfTextblock(t,s){return p0t(this,s||this.state,t)}pasteHTML(t,s){return KE(this,"",t,!1,s||new ClipboardEvent("paste"))}pasteText(t,s){return KE(this,t,null,!0,s||new ClipboardEvent("paste"))}serializeForClipboard(t){return Xye(this,t)}destroy(){this.docView&&(q0t(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],cde(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Wyt())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return H0t(this,t)}domSelectionRange(){let t=this.domSelection();return t?Nu&&this.root.nodeType===11&&Xyt(this.dom.ownerDocument)==this.dom&&g1t(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Lze.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function W4e(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",s=>{if(typeof s=="function"&&(s=s(e.state)),s)for(let n in s)n=="class"?t.class+=" "+s[n]:n=="style"?t.style=(t.style?t.style+";":"")+s[n]:!t[n]&&n!="contenteditable"&&n!="nodeName"&&(t[n]=String(s[n]))}),t.translate||(t.translate="no"),[Xu.node(0,e.state.doc.content.size,t)]}function G4e(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:Xu.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function K4e(e){return!e.someProp("editable",t=>t(e.state)===!1)}function N1t(e,t){let s=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(s)!=t.$anchor.start(s)}function Z4e(e){let t=Object.create(null);function s(n){for(let a in n)Object.prototype.hasOwnProperty.call(t,a)||(t[a]=n[a])}return e.someProp("nodeViews",s),e.someProp("markViews",s),t}function S1t(e,t){let s=0,n=0;for(let a in e){if(e[a]!=t[a])return!0;s++}for(let a in t)n++;return s!=n}function Y4e(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 _v={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:"'"},xre={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},C1t=typeof navigator<"u"&&/Mac/.test(navigator.platform),M1t=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var su=0;su<10;su++)_v[48+su]=_v[96+su]=String(su);for(var su=1;su<=24;su++)_v[su+111]="F"+su;for(var su=65;su<=90;su++)_v[su]=String.fromCharCode(su+32),xre[su]=String.fromCharCode(su);for(var ude in _v)xre.hasOwnProperty(ude)||(xre[ude]=_v[ude]);function T1t(e){var t=C1t&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||M1t&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",s=!t&&e.key||(e.shiftKey?xre:_v)[e.keyCode]||e.key||"Unidentified";return s=="Esc"&&(s="Escape"),s=="Del"&&(s="Delete"),s=="Left"&&(s="ArrowLeft"),s=="Up"&&(s="ArrowUp"),s=="Right"&&(s="ArrowRight"),s=="Down"&&(s="ArrowDown"),s}const A1t=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),E1t=typeof navigator<"u"&&/Win/.test(navigator.platform);function I1t(e){let t=e.split(/-(?!$)/),s=t[t.length-1];s=="Space"&&(s=" ");let n,a,o,l;for(let i=0;ie.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Oze(e,t){let{$cursor:s}=e.selection;return!s||(t?!t.endOfTextblock("backward",e):s.parentOffset>0)?null:s}const Dze=(e,t,s)=>{let n=Oze(e,s);if(!n)return!1;let a=a0e(n);if(!a){let l=n.blockRange(),i=l&&F3(l);return i==null?!1:(t&&t(e.tr.lift(l,i).scrollIntoView()),!0)}let o=a.nodeBefore;if(Hze(e,a,t,-1))return!0;if(n.parent.content.size==0&&(WC(o,"end")||pa.isSelectable(o)))for(let l=n.depth;;l--){let i=yae(e.doc,n.before(l),n.after(l),Js.empty);if(i&&i.slice.size1)break}return o.isAtom&&a.depth==n.depth-1?(t&&t(e.tr.delete(a.pos-o.nodeSize,a.pos).scrollIntoView()),!0):!1},O1t=(e,t,s)=>{let n=Oze(e,s);if(!n)return!1;let a=a0e(n);return a?Rze(e,a,t):!1},D1t=(e,t,s)=>{let n=zze(e,s);if(!n)return!1;let a=i0e(n);return a?Rze(e,a,t):!1};function Rze(e,t,s){let n=t.nodeBefore,a=n,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=yae(e.doc,o,u,Js.empty);if(!m||m.from!=o||m instanceof Ld&&m.slice.size>=u-o)return!1;if(s){let x=e.tr.step(m);x.setSelection(ba.create(x.doc,o)),s(x.scrollIntoView())}return!0}function WC(e,t,s=!1){for(let n=e;n;n=t=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(s&&n.childCount!=1)return!1}return!1}const Fze=(e,t,s)=>{let{$head:n,empty:a}=e.selection,o=n;if(!a)return!1;if(n.parent.isTextblock){if(s?!s.endOfTextblock("backward",e):n.parentOffset>0)return!1;o=a0e(n)}let l=o&&o.nodeBefore;return!l||!pa.isSelectable(l)?!1:(t&&t(e.tr.setSelection(pa.create(e.doc,o.pos-l.nodeSize)).scrollIntoView()),!0)};function a0e(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 zze(e,t){let{$cursor:s}=e.selection;return!s||(t?!t.endOfTextblock("forward",e):s.parentOffset{let n=zze(e,s);if(!n)return!1;let a=i0e(n);if(!a)return!1;let o=a.nodeAfter;if(Hze(e,a,t,1))return!0;if(n.parent.content.size==0&&(WC(o,"start")||pa.isSelectable(o))){let l=yae(e.doc,n.before(),n.after(),Js.empty);if(l&&l.slice.size{let{$head:n,empty:a}=e.selection,o=n;if(!a)return!1;if(n.parent.isTextblock){if(s?!s.endOfTextblock("forward",e):n.parentOffset=0;t--){let s=e.node(t);if(e.index(t)+1{let s=e.selection,n=s instanceof pa,a;if(n){if(s.node.isTextblock||!Iv(e.doc,s.from))return!1;a=s.from}else if(a=xae(e.doc,s.from,-1),a==null)return!1;if(t){let o=e.tr.join(a);n&&o.setSelection(pa.create(o.doc,a-e.doc.resolve(a).nodeBefore.nodeSize)),t(o.scrollIntoView())}return!0},F1t=(e,t)=>{let s=e.selection,n;if(s instanceof pa){if(s.node.isTextblock||!Iv(e.doc,s.to))return!1;n=s.to}else if(n=xae(e.doc,s.to,1),n==null)return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0},z1t=(e,t)=>{let{$from:s,$to:n}=e.selection,a=s.blockRange(n),o=a&&F3(a);return o==null?!1:(t&&t(e.tr.lift(a,o).scrollIntoView()),!0)},Uze=(e,t)=>{let{$head:s,$anchor:n}=e.selection;return!s.parent.type.spec.code||!s.sameParent(n)?!1:(t&&t(e.tr.insertText(` `).scrollIntoView()),!0)};function o0e(e){for(let t=0;t{let{$head:s,$anchor:n}=e.selection;if(!s.parent.type.spec.code||!s.sameParent(n))return!1;let a=s.node(-1),o=s.indexAfter(-1),l=o0e(a.contentMatchAt(o));if(!l||!a.canReplaceWith(o,o,l))return!1;if(t){let i=s.after(),u=e.tr.replaceWith(i,i,l.createAndFill());u.setSelection(Da.near(u.doc.resolve(i),1)),t(u.scrollIntoView())}return!0},qze=(e,t)=>{let s=e.selection,{$from:n,$to:a}=s;if(s instanceof jm||n.parent.inlineContent||a.parent.inlineContent)return!1;let o=o0e(a.parent.contentMatchAt(a.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let l=(!n.parentOffset&&a.index(){let{$cursor:s}=e.selection;if(!s||s.parent.content.size)return!1;if(s.depth>1&&s.after()!=s.end(-1)){let o=s.before();if(_y(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}let n=s.blockRange(),a=n&&F3(n);return a==null?!1:(t&&t(e.tr.lift(n,a).scrollIntoView()),!0)};function $1t(e){return(t,s)=>{let{$from:n,$to:a}=t.selection;if(t.selection instanceof pa&&t.selection.node.isBlock)return!n.parentOffset||!_y(t.doc,n.pos)?!1:(s&&s(t.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let o=[],l,i,u=!1,m=!1;for(let b=n.depth;;b--)if(n.node(b).isBlock){u=n.end(b)==n.pos+(n.depth-b),m=n.start(b)==n.pos-(n.depth-b),i=o0e(n.node(b-1).contentMatchAt(n.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 ba||t.selection instanceof jm)&&x.deleteSelection();let y=x.mapping.map(n.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&&n.node(l).type!=i){let b=x.mapping.map(n.before(l)),N=x.doc.resolve(b);i&&n.node(l-1).canReplaceWith(N.index(),N.index()+1,i)&&x.setNodeMarkup(x.mapping.map(n.before(l)),i)}return s&&s(x.scrollIntoView()),!0}}const U1t=$1t(),q1t=(e,t)=>{let{$from:s,to:n}=e.selection,a,o=s.sharedDepth(n);return o==0?!1:(a=s.before(o),t&&t(e.tr.setSelection(pa.create(e.doc,a))),!0)};function V1t(e,t,s){let n=t.nodeBefore,a=t.nodeAfter,o=t.index();return!n||!a||!n.type.compatibleContent(a.type)?!1:!n.content.size&&t.parent.canReplace(o-1,o)?(s&&s(e.tr.delete(t.pos-n.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(o,o+1)||!(a.isTextblock||Iv(e.doc,t.pos))?!1:(s&&s(e.tr.join(t.pos).scrollIntoView()),!0)}function Hze(e,t,s,n){let a=t.nodeBefore,o=t.nodeAfter,l,i,u=a.type.spec.isolating||o.type.spec.isolating;if(!u&&V1t(e,t,s))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(s){let b=t.pos+o.nodeSize,N=gs.empty;for(let E=l.length-1;E>=0;E--)N=gs.from(l[E].create(null,N));N=gs.from(a.copy(N));let k=e.tr.step(new $d(t.pos-1,b,t.pos,b,new Js(N,1,0),l.length,!0)),M=k.doc.resolve(b+2*l.length);M.nodeAfter&&M.nodeAfter.type==a.type&&Iv(k.doc,M.pos)&&k.join(M.pos),s(k.scrollIntoView())}return!0}let x=o.type.spec.isolating||n>0&&u?null:Da.findFrom(t,1),y=x&&x.$from.blockRange(x.$to),v=y&&F3(y);if(v!=null&&v>=t.depth)return s&&s(e.tr.lift(y,v).scrollIntoView()),!0;if(m&&WC(o,"start",!0)&&WC(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(s){let E=gs.empty;for(let P=N.length-1;P>=0;P--)E=gs.from(N[P].copy(E));let T=e.tr.step(new $d(t.pos-N.length,t.pos+o.nodeSize,t.pos+M,t.pos+o.nodeSize-M,new Js(E,N.length,0),0,!0));s(T.scrollIntoView())}return!0}}return!1}function Wze(e){return function(t,s){let n=t.selection,a=e<0?n.$from:n.$to,o=a.depth;for(;a.node(o).isInline;){if(!o)return!1;o--}return a.node(o).isTextblock?(s&&s(t.tr.setSelection(ba.create(t.doc,e<0?a.start(o):a.end(o)))),!0):!1}}const H1t=Wze(-1),W1t=Wze(1);function G1t(e,t=null){return function(s,n){let{$from:a,$to:o}=s.selection,l=a.blockRange(o),i=l&&Hye(l,e,t);return i?(n&&n(s.tr.wrap(l,i).scrollIntoView()),!0):!1}}function X4e(e,t=null){return function(s,n){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=s.doc.resolve(m),y=x.index();a=x.parent.canReplaceWith(y,y+1,e)}})}if(!a)return!1;if(n){let o=s.tr;for(let l=0;l=2&&t.$from.node(t.depth-1).type.compatibleContent(s)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let u=l.resolve(t.start-2);o=new dre(u,u,t.depth),t.endIndex=0;x--)o=gs.from(s[x].type.create(s[x].attrs,o));e.step(new $d(t.start-(n?2:0),t.end,t.start,t.end,new Js(o,0,0),s.length,!0));let l=0;for(let x=0;xl.childCount>0&&l.firstChild.type==e);return o?s?n.node(o.depth-1).type==e?Q1t(t,s,e,o):J1t(t,s,o):!0:!1}}function Q1t(e,t,s,n){let a=e.tr,o=n.end,l=n.$to.end(n.depth);ok;N--)b-=a.child(N).nodeSize,n.delete(b-1,b+1);let o=n.doc.resolve(s.start),l=o.nodeAfter;if(n.mapping.map(s.end)!=s.start+o.nodeAfter.nodeSize)return!1;let i=s.startIndex==0,u=s.endIndex==a.childCount,m=o.node(-1),x=o.index(-1);if(!m.canReplace(x+(i?0:1),x+1,l.content.append(u?gs.empty:gs.from(a))))return!1;let y=o.pos,v=y+l.nodeSize;return n.step(new $d(y-(i?1:0),v+(u?1:0),y+1,v-1,new Js((i?gs.empty:gs.from(a.copy(gs.empty))).append(u?gs.empty:gs.from(a.copy(gs.empty))),i?0:1,u?0:1),i?0:1)),t(n.scrollIntoView()),!0}function evt(e){return function(t,s){let{$from:n,$to:a}=t.selection,o=n.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(s){let m=u.lastChild&&u.lastChild.type==i.type,x=gs.from(m?e.create():null),y=new Js(gs.from(e.create(null,gs.from(i.type.create(null,x)))),m?3:1,0),v=o.start,b=o.end;s(t.tr.step(new $d(v-(m?3:1),b,v,b,y,1,!0)).scrollIntoView())}return!0}}function jae(e){const{state:t,transaction:s}=e;let{selection:n}=s,{doc:a}=s,{storedMarks:o}=s;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 n},get doc(){return a},get tr(){return n=s.selection,a=s.doc,o=s.storedMarks,s}}}class kae{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:s,state:n}=this,{view:a}=s,{tr:o}=n,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,s=!0){const{rawCommands:n,editor:a,state:o}=this,{view:l}=a,i=[],u=!!t,m=t||o.tr,x=()=>(!u&&s&&!m.getMeta("preventDispatch")&&!this.hasCustomState&&l.dispatch(m),i.every(v=>v===!0)),y={...Object.fromEntries(Object.entries(n).map(([v,b])=>[v,(...k)=>{const M=this.buildProps(m,s),E=b(...k)(M);return i.push(E),y}])),run:x};return y}createCan(t){const{rawCommands:s,state:n}=this,a=!1,o=t||n.tr,l=this.buildProps(o,a);return{...Object.fromEntries(Object.entries(s).map(([u,m])=>[u,(...x)=>m(...x)({...l,dispatch:void 0})])),chain:()=>this.createChain(o,a)}}buildProps(t,s=!0){const{rawCommands:n,editor:a,state:o}=this,{view:l}=a,i={tr:t,editor:a,view:l,state:jae({state:o,transaction:t}),dispatch:s?()=>{}:void 0,chain:()=>this.createChain(t,s),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([u,m])=>[u,(...x)=>m(...x)(i)]))}};return i}}let tvt=class{constructor(){this.callbacks={}}on(t,s){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(s),this}emit(t,...s){const n=this.callbacks[t];return n&&n.forEach(a=>a.apply(this,s)),this}off(t,s){const n=this.callbacks[t];return n&&(s?this.callbacks[t]=n.filter(a=>a!==s):delete this.callbacks[t]),this}once(t,s){const n=(...a)=>{this.off(t,n),s.apply(this,a)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}};function An(e,t,s){return e.config[t]===void 0&&e.parent?An(e.parent,t,s):typeof e.config[t]=="function"?e.config[t].bind({...s,parent:e.parent?An(e.parent,t,s):null}):e.config[t]}function Nae(e){const t=e.filter(a=>a.type==="extension"),s=e.filter(a=>a.type==="node"),n=e.filter(a=>a.type==="mark");return{baseExtensions:t,nodeExtensions:s,markExtensions:n}}function Gze(e){const t=[],{nodeExtensions:s,markExtensions:n}=Nae(e),a=[...s,...n],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=An(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=An(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 Gl(...e){return e.filter(t=>!!t).reduce((t,s)=>{const n={...t};return Object.entries(s).forEach(([a,o])=>{if(!n[a]){n[a]=o;return}if(a==="class"){const i=o?String(o).split(" "):[],u=n[a]?n[a].split(" "):[],m=i.filter(x=>!u.includes(x));n[a]=[...u,...m].join(" ")}else if(a==="style"){const i=o?o.split(";").map(x=>x.trim()).filter(Boolean):[],u=n[a]?n[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)}),n[a]=Array.from(m.entries()).map(([x,y])=>`${x}: ${y}`).join("; ")}else n[a]=o}),n},{})}function Yme(e,t){return t.filter(s=>s.type===e.type.name).filter(s=>s.attribute.rendered).map(s=>s.attribute.renderHTML?s.attribute.renderHTML(e.attrs)||{}:{[s.name]:e.attrs[s.name]}).reduce((s,n)=>Gl(s,n),{})}function Kze(e){return typeof e=="function"}function _i(e,t=void 0,...s){return Kze(e)?t?e.bind(t)(...s):e(...s):e}function rvt(e={}){return Object.keys(e).length===0&&e.constructor===Object}function svt(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function Q4e(e,t){return"style"in e?e:{...e,getAttrs:s=>{const n=e.getAttrs?e.getAttrs(s):e.attrs;if(n===!1)return!1;const a=t.reduce((o,l)=>{const i=l.attribute.parseHTML?l.attribute.parseHTML(s):svt(s.getAttribute(l.name));return i==null?o:{...o,[l.name]:i}},{});return{...n,...a}}}}function J4e(e){return Object.fromEntries(Object.entries(e).filter(([t,s])=>t==="attrs"&&rvt(s)?!1:s!=null))}function nvt(e,t){var s;const n=Gze(e),{nodeExtensions:a,markExtensions:o}=Nae(e),l=(s=a.find(m=>An(m,"topNode")))===null||s===void 0?void 0:s.name,i=Object.fromEntries(a.map(m=>{const x=n.filter(E=>E.type===m.name),y={name:m.name,options:m.options,storage:m.storage,editor:t},v=e.reduce((E,T)=>{const P=An(T,"extendNodeSchema",y);return{...E,...P?P(m):{}}},{}),b=J4e({...v,content:_i(An(m,"content",y)),marks:_i(An(m,"marks",y)),group:_i(An(m,"group",y)),inline:_i(An(m,"inline",y)),atom:_i(An(m,"atom",y)),selectable:_i(An(m,"selectable",y)),draggable:_i(An(m,"draggable",y)),code:_i(An(m,"code",y)),whitespace:_i(An(m,"whitespace",y)),linebreakReplacement:_i(An(m,"linebreakReplacement",y)),defining:_i(An(m,"defining",y)),isolating:_i(An(m,"isolating",y)),attrs:Object.fromEntries(x.map(E=>{var T;return[E.name,{default:(T=E==null?void 0:E.attribute)===null||T===void 0?void 0:T.default}]}))}),N=_i(An(m,"parseHTML",y));N&&(b.parseDOM=N.map(E=>Q4e(E,x)));const k=An(m,"renderHTML",y);k&&(b.toDOM=E=>k({node:E,HTMLAttributes:Yme(E,x)}));const M=An(m,"renderText",y);return M&&(b.toText=M),[m.name,b]})),u=Object.fromEntries(o.map(m=>{const x=n.filter(M=>M.type===m.name),y={name:m.name,options:m.options,storage:m.storage,editor:t},v=e.reduce((M,E)=>{const T=An(E,"extendMarkSchema",y);return{...M,...T?T(m):{}}},{}),b=J4e({...v,inclusive:_i(An(m,"inclusive",y)),excludes:_i(An(m,"excludes",y)),group:_i(An(m,"group",y)),spanning:_i(An(m,"spanning",y)),code:_i(An(m,"code",y)),attrs:Object.fromEntries(x.map(M=>{var E;return[M.name,{default:(E=M==null?void 0:M.attribute)===null||E===void 0?void 0:E.default}]}))}),N=_i(An(m,"parseHTML",y));N&&(b.parseDOM=N.map(M=>Q4e(M,x)));const k=An(m,"renderHTML",y);return k&&(b.toDOM=M=>k({mark:M,HTMLAttributes:Yme(M,x)})),[m.name,b]}));return new OFe({topNode:l,nodes:i,marks:u})}function mde(e,t){return t.nodes[e]||t.marks[e]||null}function eSe(e,t){return Array.isArray(t)?t.some(s=>(typeof s=="string"?s:s.name)===e.name):t}function c0e(e,t){const s=Ok.fromSchema(t).serializeFragment(e),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(s),a.innerHTML}const avt=(e,t=500)=>{let s="";const n=e.parentOffset;return e.parent.nodesBetween(Math.max(0,n-t),n,(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%";s+=a.isAtom&&!a.isText?x:x.slice(0,Math.max(0,n-o))}),s};function d0e(e){return Object.prototype.toString.call(e)==="[object RegExp]"}class Sae{constructor(t){this.find=t.find,this.handler=t.handler}}const ivt=(e,t)=>{if(d0e(t))return t.exec(e);const s=t(e);if(!s)return null;const n=[s.text];return n.index=s.index,n.input=e,n.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),n.push(s.replaceWith)),n};function gO(e){var t;const{editor:s,from:n,to:a,text:o,rules:l,plugin:i}=e,{view:u}=s;if(u.composing)return!1;const m=u.state.doc.resolve(n);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=avt(m)+o;return l.forEach(v=>{if(x)return;const b=ivt(y,v.find);if(!b)return;const N=u.state.tr,k=jae({state:u.state,transaction:N}),M={from:n-(b[0].length-o.length),to:a},{commands:E,chain:T,can:P}=new kae({editor:s,state:k});v.handler({state:k,range:M,match:b,commands:E,chain:T,can:P})===null||!N.steps.length||(N.setMeta(i,{transform:N,from:n,to:a,text:o}),u.dispatch(N),x=!0)}),x}function ovt(e){const{editor:t,rules:s}=e,n=new vd({state:{init(){return null},apply(a,o,l){const i=a.getMeta(n);if(i)return i;const u=a.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:x}=u;typeof x=="string"?x=x:x=c0e(gs.from(x),l.schema);const{from:y}=u,v=y+x.length;gO({editor:t,from:y,to:v,text:x,rules:s,plugin:n})}),a.selectionSet||a.docChanged?null:o}},props:{handleTextInput(a,o,l,i){return gO({editor:t,from:o,to:l,text:i,rules:s,plugin:n})},handleDOMEvents:{compositionend:a=>(setTimeout(()=>{const{$cursor:o}=a.state.selection;o&&gO({editor:t,from:o.pos,to:o.pos,text:"",rules:s,plugin:n})}),!1)},handleKeyDown(a,o){if(o.key!=="Enter")return!1;const{$cursor:l}=a.state.selection;return l?gO({editor:t,from:l.pos,to:l.pos,text:` `,rules:s,plugin:n}):!1}},isInputRules:!0});return n}function lvt(e){return Object.prototype.toString.call(e).slice(8,-1)}function xO(e){return lvt(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function Cae(e,t){const s={...e};return xO(e)&&xO(t)&&Object.keys(t).forEach(n=>{xO(t[n])&&xO(e[n])?s[n]=Cae(e[n],t[n]):s[n]=t[n]}),s}class rx{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(An(this,"addOptions",{name:this.name}))),this.storage=_i(An(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new rx(t)}configure(t={}){const s=this.extend({...this.config,addOptions:()=>Cae(this.options,t)});return s.name=this.name,s.parent=this.parent,s}extend(t={}){const s=new rx(t);return s.parent=this,this.child=s,s.name=t.name?t.name:s.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: "${s.name}".`),s.options=_i(An(s,"addOptions",{name:s.name})),s.storage=_i(An(s,"addStorage",{name:s.name,options:s.options})),s}static handleExit({editor:t,mark:s}){const{tr:n}=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)===s.name))return!1;const u=l.find(m=>(m==null?void 0:m.type.name)===s.name);return u&&n.removeStoredMark(u),n.insertText(" ",a.pos),t.view.dispatch(n),!0}return!1}}function cvt(e){return typeof e=="number"}class dvt{constructor(t){this.find=t.find,this.handler=t.handler}}const uvt=(e,t,s)=>{if(d0e(t))return[...e.matchAll(t)];const n=t(e,s);return n?n.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 hvt(e){const{editor:t,state:s,from:n,to:a,rule:o,pasteEvent:l,dropEvent:i}=e,{commands:u,chain:m,can:x}=new kae({editor:t,state:s}),y=[];return s.doc.nodesBetween(n,a,(b,N)=>{if(!b.isTextblock||b.type.spec.code)return;const k=Math.max(n,N),M=Math.min(a,N+b.content.size),E=b.textBetween(k-N,M-N,void 0,"");uvt(E,o.find,l).forEach(P=>{if(P.index===void 0)return;const R=k+P.index+1,D=R+P[0].length,U={from:s.tr.mapping.map(R),to:s.tr.mapping.map(D)},q=o.handler({state:s,range:U,match:P,commands:u,chain:m,can:x,pasteEvent:l,dropEvent:i});y.push(q)})}),y.every(b=>b!==null)}let yO=null;const mvt=e=>{var t;const s=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=s.clipboardData)===null||t===void 0||t.setData("text/html",e),s};function pvt(e){const{editor:t,rules:s}=e;let n=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=jae({state:x,transaction:k});if(!(!hvt({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 s.map(x=>new vd({view(y){const v=N=>{var k;n=!((k=y.dom.parentElement)===null||k===void 0)&&k.contains(N.target)?y.dom.parentElement:null,n&&(yO=t)},b=()=>{yO&&(yO=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=n===y.dom.parentElement,i=v,!o){const b=yO;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,E=N.getMeta("applyPasteRules"),T=!!E;if(!k&&!M&&!T)return;if(T){let{text:D}=E;typeof D=="string"?D=D:D=c0e(gs.from(D),b.schema);const{from:U}=E,q=U+D.length,H=mvt(D);return u({rule:x,state:b,from:U,to:{b:q},pasteEvt:H})}const P=v.doc.content.findDiffStart(b.doc.content),R=v.doc.content.findDiffEnd(b.doc.content);if(!(!cvt(P)||!R||P===R.b))return u({rule:x,state:b,from:P,to:R,pasteEvt:l})}}))}function fvt(e){const t=e.filter((s,n)=>e.indexOf(s)!==n);return Array.from(new Set(t))}class cS{constructor(t,s){this.splittableMarks=[],this.editor=s,this.extensions=cS.resolve(t),this.schema=nvt(this.extensions,s),this.setupExtensions()}static resolve(t){const s=cS.sort(cS.flatten(t)),n=fvt(s.map(a=>a.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(a=>`'${a}'`).join(", ")}]. This can lead to issues.`),s}static flatten(t){return t.map(s=>{const n={name:s.name,options:s.options,storage:s.storage},a=An(s,"addExtensions",n);return a?[s,...this.flatten(a())]:s}).flat(10)}static sort(t){return t.sort((n,a)=>{const o=An(n,"priority")||100,l=An(a,"priority")||100;return o>l?-1:o{const n={name:s.name,options:s.options,storage:s.storage,editor:this.editor,type:mde(s.name,this.schema)},a=An(s,"addCommands",n);return a?{...t,...a()}:t},{})}get plugins(){const{editor:t}=this,s=cS.sort([...this.extensions].reverse()),n=[],a=[],o=s.map(l=>{const i={name:l.name,options:l.options,storage:l.storage,editor:t,type:mde(l.name,this.schema)},u=[],m=An(l,"addKeyboardShortcuts",i);let x={};if(l.type==="mark"&&An(l,"exitable",i)&&(x.ArrowRight=()=>rx.handleExit({editor:t,mark:l})),m){const k=Object.fromEntries(Object.entries(m()).map(([M,E])=>[M,()=>E({editor:t})]));x={...x,...k}}const y=L1t(x);u.push(y);const v=An(l,"addInputRules",i);eSe(l,t.options.enableInputRules)&&v&&n.push(...v());const b=An(l,"addPasteRules",i);eSe(l,t.options.enablePasteRules)&&b&&a.push(...b());const N=An(l,"addProseMirrorPlugins",i);if(N){const k=N();u.push(...k)}return u}).flat();return[ovt({editor:t,rules:n}),...pvt({editor:t,rules:a}),...o]}get attributes(){return Gze(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:s}=Nae(this.extensions);return Object.fromEntries(s.filter(n=>!!An(n,"addNodeView")).map(n=>{const a=this.attributes.filter(u=>u.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t,type:qd(n.name,this.schema)},l=An(n,"addNodeView",o);if(!l)return[];const i=(u,m,x,y,v)=>{const b=Yme(u,a);return l()({node:u,view:m,getPos:x,decorations:y,innerDecorations:v,editor:t,extension:n,HTMLAttributes:b})};return[n.name,i]}))}setupExtensions(){this.extensions.forEach(t=>{var s;this.editor.extensionStorage[t.name]=t.storage;const n={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:mde(t.name,this.schema)};t.type==="mark"&&(!((s=_i(An(t,"keepOnSplit",n)))!==null&&s!==void 0)||s)&&this.splittableMarks.push(t.name);const a=An(t,"onBeforeCreate",n),o=An(t,"onCreate",n),l=An(t,"onUpdate",n),i=An(t,"onSelectionUpdate",n),u=An(t,"onTransaction",n),m=An(t,"onFocus",n),x=An(t,"onBlur",n),y=An(t,"onDestroy",n);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(An(this,"addOptions",{name:this.name}))),this.storage=_i(An(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new ou(t)}configure(t={}){const s=this.extend({...this.config,addOptions:()=>Cae(this.options,t)});return s.name=this.name,s.parent=this.parent,s}extend(t={}){const s=new ou({...this.config,...t});return s.parent=this,this.child=s,s.name=t.name?t.name:s.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: "${s.name}".`),s.options=_i(An(s,"addOptions",{name:s.name})),s.storage=_i(An(s,"addStorage",{name:s.name,options:s.options})),s}}function Zze(e,t,s){const{from:n,to:a}=t,{blockSeparator:o=` `,textSerializers:l={}}=s||{};let i="";return e.nodesBetween(n,a,(u,m,x,y)=>{var v;u.isBlock&&m>n&&(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(n,m)-m,a-m))}),i}function Yze(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,s])=>[t,s.spec.toText]))}const gvt=ou.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new vd({key:new Tu("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:s}=e,{doc:n,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=Yze(s);return Zze(n,{from:l,to:i},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),xvt=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var s;e.isDestroyed||(t.dom.blur(),(s=window==null?void 0:window.getSelection())===null||s===void 0||s.removeAllRanges())}),!0),yvt=(e=!1)=>({commands:t})=>t.setContent("",e),vvt=()=>({state:e,tr:t,dispatch:s})=>{const{selection:n}=t,{ranges:a}=n;return s&&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=F3(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},_vt=e=>t=>e(t),bvt=()=>({state:e,dispatch:t})=>qze(e,t),wvt=(e,t)=>({editor:s,tr:n})=>{const{state:a}=s,o=a.doc.slice(e.from,e.to);n.deleteRange(e.from,e.to);const l=n.mapping.map(t);return n.insert(l,o.content),n.setSelection(new ba(n.doc.resolve(Math.max(l-1,0)))),!0},jvt=()=>({tr:e,dispatch:t})=>{const{selection:s}=e,n=s.$anchor.node();if(n.content.size>0)return!1;const a=e.selection.$anchor;for(let o=a.depth;o>0;o-=1)if(a.node(o).type===n.type){if(t){const i=a.before(o),u=a.after(o);e.delete(i,u).scrollIntoView()}return!0}return!1},kvt=e=>({tr:t,state:s,dispatch:n})=>{const a=qd(e,s.schema),o=t.selection.$anchor;for(let l=o.depth;l>0;l-=1)if(o.node(l).type===a){if(n){const u=o.before(l),m=o.after(l);t.delete(u,m).scrollIntoView()}return!0}return!1},Nvt=e=>({tr:t,dispatch:s})=>{const{from:n,to:a}=e;return s&&t.delete(n,a),!0},Svt=()=>({state:e,dispatch:t})=>n0e(e,t),Cvt=()=>({commands:e})=>e.keyboardShortcut("Enter"),Mvt=()=>({state:e,dispatch:t})=>B1t(e,t);function yre(e,t,s={strict:!0}){const n=Object.keys(t);return n.length?n.every(a=>s.strict?t[a]===e[a]:d0e(t[a])?t[a].test(e[a]):t[a]===e[a]):!0}function Xze(e,t,s={}){return e.find(n=>n.type===t&&yre(Object.fromEntries(Object.keys(s).map(a=>[a,n.attrs[a]])),s))}function tSe(e,t,s={}){return!!Xze(e,t,s)}function u0e(e,t,s){var n;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)||(s=s||((n=a.node.marks[0])===null||n===void 0?void 0:n.attrs),!Xze([...a.node.marks],t,s)))return;let l=a.index,i=e.start()+a.offset,u=l+1,m=i+a.node.nodeSize;for(;l>0&&tSe([...e.parent.child(l-1).marks],t,s);)l-=1,i-=e.parent.child(l).nodeSize;for(;u({tr:s,state:n,dispatch:a})=>{const o=Lv(e,n.schema),{doc:l,selection:i}=s,{$from:u,from:m,to:x}=i;if(a){const y=u0e(u,o,t);if(y&&y.from<=m&&y.to>=x){const v=ba.create(l,y.from,y.to);s.setSelection(v)}}return!0},Avt=e=>t=>{const s=typeof e=="function"?e(t):e;for(let n=0;n({editor:s,view:n,tr:a,dispatch:o})=>{t={scrollIntoView:!0,...t};const l=()=>{(h0e()||Evt())&&n.dom.focus(),requestAnimationFrame(()=>{s.isDestroyed||(n.focus(),t!=null&&t.scrollIntoView&&s.commands.scrollIntoView())})};if(n.hasFocus()&&e===null||e===!1)return!0;if(o&&e===null&&!Qze(s.state.selection))return l(),!0;const i=Jze(a.doc,e)||s.state.selection,u=s.state.selection.eq(i);return o&&(u||a.setSelection(i),u&&a.storedMarks&&a.setStoredMarks(a.storedMarks),l()),!0},Pvt=(e,t)=>s=>e.every((n,a)=>t(n,{...s,index:a})),Lvt=(e,t)=>({tr:s,commands:n})=>n.insertContentAt({from:s.selection.from,to:s.selection.to},e,t),e7e=e=>{const t=e.childNodes;for(let s=t.length-1;s>=0;s-=1){const n=t[s];n.nodeType===3&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?e.removeChild(n):n.nodeType===1&&e7e(n)}return e};function vO(e){const t=`${e}`,s=new window.DOMParser().parseFromString(t,"text/html").body;return e7e(s)}function YE(e,t,s){if(e instanceof av||e instanceof gs)return e;s={slice:!0,parseOptions:{},...s};const n=typeof e=="object"&&e!==null,a=typeof e=="string";if(n)try{if(Array.isArray(e)&&e.length>0)return gs.fromArray(e.map(i=>t.nodeFromJSON(i)));const l=t.nodeFromJSON(e);return s.errorOnInvalidContent&&l.check(),l}catch(o){if(s.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",o),YE("",t,s)}if(a){if(s.errorOnInvalidContent){let l=!1,i="";const u=new OFe({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(s.slice?HA.fromSchema(u).parseSlice(vO(e),s.parseOptions):HA.fromSchema(u).parse(vO(e),s.parseOptions),s.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${i}`)})}const o=HA.fromSchema(t);return s.slice?o.parseSlice(vO(e),s.parseOptions).content:o.parse(vO(e),s.parseOptions)}return YE("",t,s)}function Ovt(e,t,s){const n=e.steps.length-1;if(n{l===0&&(l=x)}),e.setSelection(Da.near(e.doc.resolve(l),s))}const Dvt=e=>!("type"in e),Rvt=(e,t,s)=>({tr:n,dispatch:a,editor:o})=>{var l;if(a){s={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...s};let i;const u=M=>{o.emit("contentError",{editor:o,error:M,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},m={preserveWhitespace:"full",...s.parseOptions};if(!s.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{YE(t,o.schema,{parseOptions:m,errorOnInvalidContent:!0})}catch(M){u(M)}try{i=YE(t,o.schema,{parseOptions:m,errorOnInvalidContent:(l=s.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((Dvt(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}=n.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 gs){let M="";t.forEach(E=>{E.text&&(M+=E.text)}),k=M}else typeof t=="object"&&t&&t.text?k=t.text:k=t;n.insertText(k,x,y)}else k=i,n.replaceWith(x,y,k);s.updateSelection&&Ovt(n,n.steps.length-1,-1),s.applyInputRules&&n.setMeta("applyInputRules",{from:x,text:k}),s.applyPasteRules&&n.setMeta("applyPasteRules",{from:x,text:k})}return!0},Fvt=()=>({state:e,dispatch:t})=>R1t(e,t),zvt=()=>({state:e,dispatch:t})=>F1t(e,t),Bvt=()=>({state:e,dispatch:t})=>Dze(e,t),$vt=()=>({state:e,dispatch:t})=>Bze(e,t),Uvt=()=>({state:e,dispatch:t,tr:s})=>{try{const n=xae(e.doc,e.selection.$from.pos,-1);return n==null?!1:(s.join(n,2),t&&t(s),!0)}catch{return!1}},qvt=()=>({state:e,dispatch:t,tr:s})=>{try{const n=xae(e.doc,e.selection.$from.pos,1);return n==null?!1:(s.join(n,2),t&&t(s),!0)}catch{return!1}},Vvt=()=>({state:e,dispatch:t})=>O1t(e,t),Hvt=()=>({state:e,dispatch:t})=>D1t(e,t);function t7e(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Wvt(e){const t=e.split(/-(?!$)/);let s=t[t.length-1];s==="Space"&&(s=" ");let n,a,o,l;for(let i=0;i({editor:t,view:s,tr:n,dispatch:a})=>{const o=Wvt(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(()=>{s.someProp("handleKeyDown",m=>m(s,i))});return u==null||u.steps.forEach(m=>{const x=m.map(n.mapping);x&&a&&n.maybeStep(x)}),!0};function XE(e,t,s={}){const{from:n,to:a,empty:o}=e.selection,l=t?qd(t,e.schema):null,i=[];e.doc.nodesBetween(n,a,(y,v)=>{if(y.isText)return;const b=Math.max(n,v),N=Math.min(a,v+y.nodeSize);i.push({node:y,from:b,to:N})});const u=a-n,m=i.filter(y=>l?l.name===y.node.type.name:!0).filter(y=>yre(y.node.attrs,s,{strict:!1}));return o?!!m.length:m.reduce((y,v)=>y+v.to-v.from,0)>=u}const Kvt=(e,t={})=>({state:s,dispatch:n})=>{const a=qd(e,s.schema);return XE(s,a,t)?z1t(s,n):!1},Zvt=()=>({state:e,dispatch:t})=>Vze(e,t),Yvt=e=>({state:t,dispatch:s})=>{const n=qd(e,t.schema);return X1t(n)(t,s)},Xvt=()=>({state:e,dispatch:t})=>Uze(e,t);function Mae(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function rSe(e,t){const s=typeof t=="string"?[t]:t;return Object.keys(e).reduce((n,a)=>(s.includes(a)||(n[a]=e[a]),n),{})}const Qvt=(e,t)=>({tr:s,state:n,dispatch:a})=>{let o=null,l=null;const i=Mae(typeof e=="string"?e:e.name,n.schema);return i?(i==="node"&&(o=qd(e,n.schema)),i==="mark"&&(l=Lv(e,n.schema)),a&&s.selection.ranges.forEach(u=>{n.doc.nodesBetween(u.$from.pos,u.$to.pos,(m,x)=>{o&&o===m.type&&s.setNodeMarkup(x,void 0,rSe(m.attrs,t)),l&&m.marks.length&&m.marks.forEach(y=>{l===y.type&&s.addMark(x,x+m.nodeSize,l.create(rSe(y.attrs,t)))})})}),!0):!1},Jvt=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),e_t=()=>({tr:e,dispatch:t})=>{if(t){const s=new jm(e.doc);e.setSelection(s)}return!0},t_t=()=>({state:e,dispatch:t})=>Fze(e,t),r_t=()=>({state:e,dispatch:t})=>$ze(e,t),s_t=()=>({state:e,dispatch:t})=>q1t(e,t),n_t=()=>({state:e,dispatch:t})=>W1t(e,t),a_t=()=>({state:e,dispatch:t})=>H1t(e,t);function Xme(e,t,s={},n={}){return YE(e,t,{slice:!1,parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent})}const i_t=(e,t=!1,s={},n={})=>({editor:a,tr:o,dispatch:l,commands:i})=>{var u,m;const{doc:x}=o;if(s.preserveWhitespace!=="full"){const y=Xme(e,a.schema,s,{errorOnInvalidContent:(u=n.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:s,errorOnInvalidContent:(m=n.errorOnInvalidContent)!==null&&m!==void 0?m:a.options.enableContentCheck})};function r7e(e,t){const s=Lv(t,e.schema),{from:n,to:a,empty:o}=e.selection,l=[];o?(e.storedMarks&&l.push(...e.storedMarks),l.push(...e.selection.$head.marks())):e.doc.nodesBetween(n,a,u=>{l.push(...u.marks)});const i=l.find(u=>u.type.name===s.name);return i?{...i.attrs}:{}}function o_t(e,t){const s=new Wye(e);return t.forEach(n=>{n.steps.forEach(a=>{s.step(a)})}),s}function l_t(e){for(let t=0;t{s(a)&&n.push({node:a,pos:o})}),n}function s7e(e,t){for(let s=e.depth;s>0;s-=1){const n=e.node(s);if(t(n))return{pos:s>0?e.before(s):0,start:e.start(s),depth:s,node:n}}}function m0e(e){return t=>s7e(t.$from,e)}function d_t(e,t){const s={from:0,to:e.content.size};return Zze(e,s,t)}function u_t(e,t){const s=qd(t,e.schema),{from:n,to:a}=e.selection,o=[];e.doc.nodesBetween(n,a,i=>{o.push(i)});const l=o.reverse().find(i=>i.type.name===s.name);return l?{...l.attrs}:{}}function n7e(e,t){const s=Mae(typeof t=="string"?t:t.name,e.schema);return s==="node"?u_t(e,t):s==="mark"?r7e(e,t):{}}function h_t(e,t=JSON.stringify){const s={};return e.filter(n=>{const a=t(n);return Object.prototype.hasOwnProperty.call(s,a)?!1:s[a]=!0})}function m_t(e){const t=h_t(e);return t.length===1?t:t.filter((s,n)=>!t.filter((o,l)=>l!==n).some(o=>s.oldRange.from>=o.oldRange.from&&s.oldRange.to<=o.oldRange.to&&s.newRange.from>=o.newRange.from&&s.newRange.to<=o.newRange.to))}function p_t(e){const{mapping:t,steps:s}=e,n=[];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}=s[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);n.push({oldRange:{from:y,to:v},newRange:{from:m,to:x}})})}),m_t(n)}function p0e(e,t,s){const n=[];return e===t?s.resolve(e).marks().forEach(a=>{const o=s.resolve(e),l=u0e(o,a.type);l&&n.push({mark:a,...l})}):s.nodesBetween(e,t,(a,o)=>{!a||(a==null?void 0:a.nodeSize)===void 0||n.push(...a.marks.map(l=>({from:o,to:o+a.nodeSize,mark:l})))}),n}function Zee(e,t,s){return Object.fromEntries(Object.entries(s).filter(([n])=>{const a=e.find(o=>o.type===t&&o.name===n);return a?a.attribute.keepOnSplit:!1}))}function Qme(e,t,s={}){const{empty:n,ranges:a}=e.selection,o=t?Lv(t,e.schema):null;if(n)return!!(e.storedMarks||e.selection.$from.marks()).filter(y=>o?o.name===y.type.name:!0).find(y=>yre(y.attrs,s,{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 E=Math.max(b,M),T=Math.min(N,M+k.nodeSize),P=T-E;l+=P,i.push(...k.marks.map(R=>({mark:R,from:E,to:T})))})}),l===0)return!1;const u=i.filter(y=>o?o.name===y.mark.type.name:!0).filter(y=>yre(y.mark.attrs,s,{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 f_t(e,t,s={}){if(!t)return XE(e,null,s)||Qme(e,null,s);const n=Mae(t,e.schema);return n==="node"?XE(e,t,s):n==="mark"?Qme(e,t,s):!1}function sSe(e,t){const{nodeExtensions:s}=Nae(t),n=s.find(l=>l.name===e);if(!n)return!1;const a={name:n.name,options:n.options,storage:n.storage},o=_i(An(n,"group",a));return typeof o!="string"?!1:o.split(" ").includes("list")}function f0e(e,{checkChildren:t=!0,ignoreWhitespace:s=!1}={}){var n;if(s){if(e.type.name==="hardBreak")return!0;if(e.isText)return/^\s*$/m.test((n=e.text)!==null&&n!==void 0?n:"")}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&&(f0e(o,{ignoreWhitespace:s,checkChildren:t})||(a=!1))}),a}return!1}function g_t(e){return e instanceof pa}function x_t(e,t,s){var n;const{selection:a}=t;let o=null;if(Qze(a)&&(o=a.$cursor),o){const i=(n=e.storedMarks)!==null&&n!==void 0?n:o.marks();return!!s.isInSet(i)||!i.some(u=>u.type.excludes(s))}const{ranges:l}=a;return l.some(({$from:i,$to:u})=>{let m=i.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(s):!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(s),N=!!s.isInSet(x.marks)||!x.marks.some(k=>k.type.excludes(s));m=b&&N}return!m}),m})}const y_t=(e,t={})=>({tr:s,state:n,dispatch:a})=>{const{selection:o}=s,{empty:l,ranges:i}=o,u=Lv(e,n.schema);if(a)if(l){const m=r7e(n,u);s.addStoredMark(u.create({...m,...t}))}else i.forEach(m=>{const x=m.$from.pos,y=m.$to.pos;n.doc.nodesBetween(x,y,(v,b)=>{const N=Math.max(b,x),k=Math.min(b+v.nodeSize,y);v.marks.find(E=>E.type===u)?v.marks.forEach(E=>{u===E.type&&s.addMark(N,k,u.create({...E.attrs,...t}))}):s.addMark(N,k,u.create(t))})});return x_t(n,s,u)},v_t=(e,t)=>({tr:s})=>(s.setMeta(e,t),!0),__t=(e,t={})=>({state:s,dispatch:n,chain:a})=>{const o=qd(e,s.schema);let l;return s.selection.$anchor.sameParent(s.selection.$head)&&(l=s.selection.$anchor.parent.attrs),o.isTextblock?a().command(({commands:i})=>X4e(o,{...l,...t})(s)?!0:i.clearNodes()).command(({state:i})=>X4e(o,{...l,...t})(i,n)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},b_t=e=>({tr:t,dispatch:s})=>{if(s){const{doc:n}=t,a=mj(e,0,n.content.size),o=pa.create(n,a);t.setSelection(o)}return!0},w_t=e=>({tr:t,dispatch:s})=>{if(s){const{doc:n}=t,{from:a,to:o}=typeof e=="number"?{from:e,to:e}:e,l=ba.atStart(n).from,i=ba.atEnd(n).to,u=mj(a,l,i),m=mj(o,l,i),x=ba.create(n,u,m);t.setSelection(x)}return!0},j_t=e=>({state:t,dispatch:s})=>{const n=qd(e,t.schema);return evt(n)(t,s)};function nSe(e,t){const s=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(s){const n=s.filter(a=>t==null?void 0:t.includes(a.type.name));e.tr.ensureMarks(n)}}const k_t=({keepMarks:e=!0}={})=>({tr:t,state:s,dispatch:n,editor:a})=>{const{selection:o,doc:l}=t,{$from:i,$to:u}=o,m=a.extensionManager.attributes,x=Zee(m,i.node().type.name,i.node().attrs);if(o instanceof pa&&o.node.isBlock)return!i.parentOffset||!_y(l,i.pos)?!1:(n&&(e&&nSe(s,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:l_t(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),n){if(N&&(o instanceof ba&&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&&nSe(s,a.extensionManager.splittableMarks),t.scrollIntoView()}return N},N_t=(e,t={})=>({tr:s,state:n,dispatch:a,editor:o})=>{var l;const i=qd(e,n.schema),{$from:u,$to:m}=n.selection,x=n.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 E=gs.empty;const T=u.index(-1)?1:u.index(-2)?2:3;for(let H=u.depth-T;H>=u.depth-3;H-=1)E=gs.from(u.node(H).copy(E));const P=u.indexAfter(-1){if(q>-1)return!1;H.isTextblock&&H.content.size===0&&(q=G+1)}),q>-1&&s.setSelection(ba.near(s.doc.resolve(q))),s.scrollIntoView()}return!0}const b=m.pos===u.end()?y.contentMatchAt(0).defaultType:null,N={...Zee(v,y.type.name,y.attrs),...t},k={...Zee(v,u.node().type.name,u.node().attrs),...t};s.delete(u.pos,m.pos);const M=b?[{type:i,attrs:N},{type:b,attrs:k}]:[{type:i,attrs:N}];if(!_y(s.doc,u.pos,2))return!1;if(a){const{selection:E,storedMarks:T}=n,{splittableMarks:P}=o.extensionManager,R=T||E.$to.parentOffset&&E.$from.marks();if(s.split(u.pos,2,M).scrollIntoView(),!R||!a)return!0;const D=R.filter(U=>P.includes(U.type.name));s.ensureMarks(D)}return!0},pde=(e,t)=>{const s=m0e(l=>l.type===t)(e.selection);if(!s)return!0;const n=e.doc.resolve(Math.max(0,s.pos-1)).before(s.depth);if(n===void 0)return!0;const a=e.doc.nodeAt(n);return s.node.type===(a==null?void 0:a.type)&&Iv(e.doc,s.pos)&&e.join(s.pos),!0},fde=(e,t)=>{const s=m0e(l=>l.type===t)(e.selection);if(!s)return!0;const n=e.doc.resolve(s.start).after(s.depth);if(n===void 0)return!0;const a=e.doc.nodeAt(n);return s.node.type===(a==null?void 0:a.type)&&Iv(e.doc,n)&&e.join(n),!0},S_t=(e,t,s,n={})=>({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:E,$to:T}=k,P=E.blockRange(T),R=M||k.$to.parentOffset&&k.$from.marks();if(!P)return!1;const D=m0e(U=>sSe(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(sSe(D.node.type.name,y)&&b.validContent(D.node.content)&&i)return u().command(()=>(o.setNodeMarkup(D.pos,b),!0)).command(()=>pde(o,b)).command(()=>fde(o,b)).run()}return!s||!R||!i?u().command(()=>x().wrapInList(b,n)?!0:m.clearNodes()).wrapInList(b,n).command(()=>pde(o,b)).command(()=>fde(o,b)).run():u().command(()=>{const U=x().wrapInList(b,n),q=R.filter(H=>v.includes(H.type.name));return o.ensureMarks(q),U?!0:m.clearNodes()}).wrapInList(b,n).command(()=>pde(o,b)).command(()=>fde(o,b)).run()},C_t=(e,t={},s={})=>({state:n,commands:a})=>{const{extendEmptyMarkRange:o=!1}=s,l=Lv(e,n.schema);return Qme(n,l,t)?a.unsetMark(l,{extendEmptyMarkRange:o}):a.setMark(l,t)},M_t=(e,t,s={})=>({state:n,commands:a})=>{const o=qd(e,n.schema),l=qd(t,n.schema),i=XE(n,o,s);let u;return n.selection.$anchor.sameParent(n.selection.$head)&&(u=n.selection.$anchor.parent.attrs),i?a.setNode(l,u):a.setNode(o,{...u,...s})},T_t=(e,t={})=>({state:s,commands:n})=>{const a=qd(e,s.schema);return XE(s,a,t)?n.lift(a):n.wrapIn(a,t)},A_t=()=>({state:e,dispatch:t})=>{const s=e.plugins;for(let n=0;n=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},E_t=()=>({tr:e,dispatch:t})=>{const{selection:s}=e,{empty:n,ranges:a}=s;return n||t&&a.forEach(o=>{e.removeMark(o.$from.pos,o.$to.pos)}),!0},I_t=(e,t={})=>({tr:s,state:n,dispatch:a})=>{var o;const{extendEmptyMarkRange:l=!1}=t,{selection:i}=s,u=Lv(e,n.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=u0e(m,u,N);k&&(v=k.from,b=k.to),s.removeMark(v,b,u)}else y.forEach(v=>{s.removeMark(v.$from.pos,v.$to.pos,u)});return s.removeStoredMark(u),!0},P_t=(e,t={})=>({tr:s,state:n,dispatch:a})=>{let o=null,l=null;const i=Mae(typeof e=="string"?e:e.name,n.schema);return i?(i==="node"&&(o=qd(e,n.schema)),i==="mark"&&(l=Lv(e,n.schema)),a&&s.selection.ranges.forEach(u=>{const m=u.$from.pos,x=u.$to.pos;let y,v,b,N;s.selection.empty?n.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)}):n.doc.nodesBetween(m,x,(k,M)=>{M=m&&M<=x&&(o&&o===k.type&&s.setNodeMarkup(M,void 0,{...k.attrs,...t}),l&&k.marks.length&&k.marks.forEach(E=>{if(l===E.type){const T=Math.max(M,m),P=Math.min(M+k.nodeSize,x);s.addMark(T,P,l.create({...E.attrs,...t}))}}))}),v&&(y!==void 0&&s.setNodeMarkup(y,void 0,{...v.attrs,...t}),l&&v.marks.length&&v.marks.forEach(k=>{l===k.type&&s.addMark(b,N,l.create({...k.attrs,...t}))}))}),!0):!1},L_t=(e,t={})=>({state:s,dispatch:n})=>{const a=qd(e,s.schema);return G1t(a,t)(s,n)},O_t=(e,t={})=>({state:s,dispatch:n})=>{const a=qd(e,s.schema);return K1t(a,t)(s,n)};var D_t=Object.freeze({__proto__:null,blur:xvt,clearContent:yvt,clearNodes:vvt,command:_vt,createParagraphNear:bvt,cut:wvt,deleteCurrentNode:jvt,deleteNode:kvt,deleteRange:Nvt,deleteSelection:Svt,enter:Cvt,exitCode:Mvt,extendMarkRange:Tvt,first:Avt,focus:Ivt,forEach:Pvt,insertContent:Lvt,insertContentAt:Rvt,joinBackward:Bvt,joinDown:zvt,joinForward:$vt,joinItemBackward:Uvt,joinItemForward:qvt,joinTextblockBackward:Vvt,joinTextblockForward:Hvt,joinUp:Fvt,keyboardShortcut:Gvt,lift:Kvt,liftEmptyBlock:Zvt,liftListItem:Yvt,newlineInCode:Xvt,resetAttributes:Qvt,scrollIntoView:Jvt,selectAll:e_t,selectNodeBackward:t_t,selectNodeForward:r_t,selectParentNode:s_t,selectTextblockEnd:n_t,selectTextblockStart:a_t,setContent:i_t,setMark:y_t,setMeta:v_t,setNode:__t,setNodeSelection:b_t,setTextSelection:w_t,sinkListItem:j_t,splitBlock:k_t,splitListItem:N_t,toggleList:S_t,toggleMark:C_t,toggleNode:M_t,toggleWrap:T_t,undoInputRule:A_t,unsetAllMarks:E_t,unsetMark:I_t,updateAttributes:P_t,wrapIn:L_t,wrapInList:O_t});const R_t=ou.create({name:"commands",addCommands(){return{...D_t}}}),F_t=ou.create({name:"drop",addProseMirrorPlugins(){return[new vd({key:new Tu("tiptapDrop"),props:{handleDrop:(e,t,s,n)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:s,moved:n})}}})]}}),z_t=ou.create({name:"editable",addProseMirrorPlugins(){return[new vd({key:new Tu("editable"),props:{editable:()=>this.editor.options.editable}})]}}),B_t=new Tu("focusEvents"),$_t=ou.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new vd({key:B_t,props:{handleDOMEvents:{focus:(t,s)=>{e.isFocused=!0;const n=e.state.tr.setMeta("focus",{event:s}).setMeta("addToHistory",!1);return t.dispatch(n),!1},blur:(t,s)=>{e.isFocused=!1;const n=e.state.tr.setMeta("blur",{event:s}).setMeta("addToHistory",!1);return t.dispatch(n),!1}}}})]}}),U_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,E=k&&N.parent.childCount===1?M===y.pos:Da.atStart(m).from===v;return!x||!b.type.isTextblock||b.textContent.length||!E||E&&y.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:l})=>[()=>l.deleteSelection(),()=>l.deleteCurrentNode(),()=>l.joinForward(),()=>l.selectNodeForward()]),n={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={...n},o={...n,"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 h0e()||t7e()?o:a},addProseMirrorPlugins(){return[new vd({key:new Tu("clearDocument"),appendTransaction:(e,t,s)=>{if(e.some(k=>k.getMeta("composition")))return;const n=e.some(k=>k.docChanged)&&!t.doc.eq(s.doc),a=e.some(k=>k.getMeta("preventClearDocument"));if(!n||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)||!f0e(s.doc))return;const v=s.tr,b=jae({state:s,transaction:v}),{commands:N}=new kae({editor:this.editor,state:b});if(N.clearNodes(),!!v.steps.length)return v}})]}}),q_t=ou.create({name:"paste",addProseMirrorPlugins(){return[new vd({key:new Tu("tiptapPaste"),props:{handlePaste:(e,t,s)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:s})}}})]}}),V_t=ou.create({name:"tabindex",addProseMirrorPlugins(){return[new vd({key:new Tu("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class sj{get name(){return this.node.type.name}constructor(t,s,n=!1,a=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=t,this.editor=s,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 s=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}s=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:s,to:n},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),s=this.resolvedPos.doc.resolve(t);return new sj(s,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 sj(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 sj(t,this.editor)}get children(){const t=[];return this.node.content.forEach((s,n)=>{const a=s.isBlock&&!s.isTextblock,o=s.isAtom&&!s.isText,l=this.pos+n+(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 sj(i,this.editor,a,a?s:null);a&&(u.actualDepth=this.depth+1),t.push(new sj(i,this.editor,a,a?s:null))}),t}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,s={}){let n=null,a=this.parent;for(;a&&!n;){if(a.node.type.name===t)if(Object.keys(s).length>0){const o=a.node.attrs,l=Object.keys(s);for(let i=0;i{n&&a.length>0||(l.node.type.name===t&&o.every(u=>s[u]===l.node.attrs[u])&&a.push(l),!(n&&a.length>0)&&(a=a.concat(l.querySelectorAll(t,s,n))))}),a}setAttribute(t){const{tr:s}=this.editor.state;s.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(s)}}const H_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 W_t(e,t,s){const n=document.querySelector("style[data-tiptap-style]");if(n!==null)return n;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 G_t extends tvt{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:s})=>{throw s},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:s,slice:n,moved:a})=>this.options.onDrop(s,n,a)),this.on("paste",({event:s,slice:n})=>this.options.onPaste(s,n)),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=W_t(H_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,s=!0){this.setOptions({editable:t}),s&&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,s){const n=Kze(s)?s(t,[...this.state.plugins]):[...this.state.plugins,t],a=this.state.reconfigure({plugins:n});return this.view.updateState(a),a}unregisterPlugin(t){if(this.isDestroyed)return;const s=this.state.plugins;let n=s;if([].concat(t).forEach(o=>{const l=typeof o=="string"?`${o}$`:o.key;n=n.filter(i=>!i.key.startsWith(l))}),s.length===n.length)return;const a=this.state.reconfigure({plugins:n});return this.view.updateState(a),a}createExtensionManager(){var t,s;const a=[...this.options.enableCoreExtensions?[z_t,gvt.configure({blockSeparator:(s=(t=this.options.coreExtensionOptions)===null||t===void 0?void 0:t.clipboardTextSerializer)===null||s===void 0?void 0:s.blockSeparator}),R_t,$_t,U_t,V_t,F_t,q_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 cS(a,this)}createCommandManager(){this.commandManager=new kae({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var t;let s;try{s=Xme(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()}}),s=Xme(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const n=Jze(s,this.options.autofocus);this.view=new Lze(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:lS.create({doc:s,selection:n||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 s=this.capturedTransaction;return this.capturedTransaction=null,s}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 s=this.state.apply(t),n=!this.state.selection.eq(s.selection);this.emit("beforeTransaction",{editor:this,transaction:t,nextState:s}),this.view.updateState(s),this.emit("transaction",{editor:this,transaction:t}),n&&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 n7e(this.state,t)}isActive(t,s){const n=typeof t=="string"?t:null,a=typeof t=="string"?s:t;return f_t(this.state,n,a)}getJSON(){return this.state.doc.toJSON()}getHTML(){return c0e(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:s=` `,textSerializers:n={}}=t||{};return d_t(this.state.doc,{blockSeparator:s,textSerializers:{...Yze(this.schema),...n}})}get isEmpty(){return f0e(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,s){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelector(t,s))||null}$nodes(t,s){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelectorAll(t,s))||null}$pos(t){const s=this.state.doc.resolve(t);return new sj(s,this)}get $doc(){return this.$pos(0)}}function GC(e){return new Sae({find:e.find,handler:({state:t,range:s,match:n})=>{const a=_i(e.getAttributes,void 0,n);if(a===!1||a===null)return null;const{tr:o}=t,l=n[n.length-1],i=n[0];if(l){const u=i.search(/\S/),m=s.from+i.indexOf(l),x=m+l.length;if(p0e(s.from,s.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;xs.from&&o.delete(s.from+u,m);const v=s.from+u+l.length;o.addMark(s.from+u,v,e.type.create(a||{})),o.removeStoredMark(e.type)}}})}function a7e(e){return new Sae({find:e.find,handler:({state:t,range:s,match:n})=>{const a=_i(e.getAttributes,void 0,n)||{},{tr:o}=t,l=s.from;let i=s.to;const u=e.type.create(a);if(n[1]){const m=n[0].lastIndexOf(n[1]);let x=l+m;x>i?x=i:i=x+n[1].length;const y=n[0][n[0].length-1];o.insertText(y,l+n[0].length-1),o.replaceWith(x,i,u)}else if(n[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 Jme(e){return new Sae({find:e.find,handler:({state:t,range:s,match:n})=>{const a=t.doc.resolve(s.from),o=_i(e.getAttributes,void 0,n)||{};if(!a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),e.type))return null;t.tr.delete(s.from,s.to).setBlockType(s.from,s.from,e.type,o)}})}function QE(e){return new Sae({find:e.find,handler:({state:t,range:s,match:n,chain:a})=>{const o=_i(e.getAttributes,void 0,n)||{},l=t.tr.delete(s.from,s.to),u=l.doc.resolve(s.from).blockRange(),m=u&&Hye(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(s.from-1).nodeBefore;x&&x.type===e.type&&Iv(l.doc,s.from-1)&&(!e.joinPredicate||e.joinPredicate(n,x))&&l.join(s.from-1)}})}let Au=class epe{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(An(this,"addOptions",{name:this.name}))),this.storage=_i(An(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new epe(t)}configure(t={}){const s=this.extend({...this.config,addOptions:()=>Cae(this.options,t)});return s.name=this.name,s.parent=this.parent,s}extend(t={}){const s=new epe(t);return s.parent=this,this.child=s,s.name=t.name?t.name:s.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: "${s.name}".`),s.options=_i(An(s,"addOptions",{name:s.name})),s.storage=_i(An(s,"addStorage",{name:s.name,options:s.options})),s}};function _k(e){return new dvt({find:e.find,handler:({state:t,range:s,match:n,pasteEvent:a})=>{const o=_i(e.getAttributes,void 0,n,a);if(o===!1||o===null)return null;const{tr:l}=t,i=n[n.length-1],u=n[0];let m=s.to;if(i){const x=u.search(/\S/),y=s.from+u.indexOf(i),v=y+i.length;if(p0e(s.from,s.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;vs.from&&l.delete(s.from+x,y),m=s.from+x+i.length,l.addMark(s.from+x,m,e.type.create(o||{})),l.removeStoredMark(e.type)}}})}function K_t(e,t){const{selection:s}=e,{$from:n}=s;if(s instanceof pa){const o=n.index();return n.parent.canReplaceWith(o,o+1,t)}let a=n.depth;for(;a>=0;){const o=n.index(a);if(n.node(a).contentMatchAt(o).matchType(t))return!0;a-=1}return!1}function Z_t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var i7e={exports:{}},gde={};/** * @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 aSe;function Y_t(){if(aSe)return gde;aSe=1;var e=ut;function t(y,v){return y===v&&(y!==0||1/y===1/v)||y!==y&&v!==v}var s=typeof Object.is=="function"?Object.is:t,n=e.useState,a=e.useEffect,o=e.useLayoutEffect,l=e.useDebugValue;function i(y,v){var b=v(),N=n({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!s(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 gde.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:x,gde}i7e.exports=Y_t();var g0e=i7e.exports;const X_t=(...e)=>t=>{e.forEach(s=>{typeof s=="function"?s(t):s&&(s.current=t)})},Q_t=({contentComponent:e})=>{const t=g0e.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return ut.createElement(ut.Fragment,null,Object.values(t))};function J_t(){const e=new Set;let t={};return{subscribe(s){return e.add(s),()=>{e.delete(s)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(s,n){t={...t,[s]:rxe.createPortal(n.reactElement,n.element,s)},e.forEach(a=>a())},removeRenderer(s){const n={...t};delete n[s],t=n,e.forEach(a=>a())}}}class ebt extends ut.Component{constructor(t){var s;super(t),this.editorContentRef=ut.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((s=t.editor)===null||s===void 0)&&s.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 s=this.editorContentRef.current;s.append(...t.options.element.childNodes),t.setOptions({element:s}),t.contentComponent=J_t(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(n=>n.hasContentComponentInitialized?n:{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 s=document.createElement("div");s.append(...t.options.element.childNodes),t.setOptions({element:s})}render(){const{editor:t,innerRef:s,...n}=this.props;return ut.createElement(ut.Fragment,null,ut.createElement("div",{ref:X_t(s,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&ut.createElement(Q_t,{contentComponent:t.contentComponent}))}}const tbt=A.forwardRef((e,t)=>{const s=ut.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return ut.createElement(ebt,{key:s,innerRef:t,...e})}),o7e=ut.memo(tbt);var rbt=function e(t,s){if(t===s)return!0;if(t&&s&&typeof t=="object"&&typeof s=="object"){if(t.constructor!==s.constructor)return!1;var n,a,o;if(Array.isArray(t)){if(n=t.length,n!=s.length)return!1;for(a=n;a--!==0;)if(!e(t[a],s[a]))return!1;return!0}if(t instanceof Map&&s instanceof Map){if(t.size!==s.size)return!1;for(a of t.entries())if(!s.has(a[0]))return!1;for(a of t.entries())if(!e(a[1],s.get(a[0])))return!1;return!0}if(t instanceof Set&&s instanceof Set){if(t.size!==s.size)return!1;for(a of t.entries())if(!s.has(a[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(s)){if(n=t.length,n!=s.length)return!1;for(a=n;a--!==0;)if(t[a]!==s[a])return!1;return!0}if(t.constructor===RegExp)return t.source===s.source&&t.flags===s.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===s.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===s.toString();if(o=Object.keys(t),n=o.length,n!==Object.keys(s).length)return!1;for(a=n;a--!==0;)if(!Object.prototype.hasOwnProperty.call(s,o[a]))return!1;for(a=n;a--!==0;){var l=o[a];if(!(l==="_owner"&&t.$$typeof)&&!e(t[l],s[l]))return!1}return!0}return t!==t&&s!==s},sbt=Z_t(rbt),l7e={exports:{}},xde={};/** * @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 iSe;function nbt(){if(iSe)return xde;iSe=1;var e=ut,t=g0e;function s(m,x){return m===x&&(m!==0||1/m===1/x)||m!==m&&x!==x}var n=typeof Object.is=="function"?Object.is:s,a=t.useSyncExternalStore,o=e.useRef,l=e.useEffect,i=e.useMemo,u=e.useDebugValue;return xde.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 E(U){if(!T){if(T=!0,P=U,U=v(U),b!==void 0&&k.hasValue){var q=k.value;if(b(q,U))return R=q}return R=U}if(q=R,n(P,U))return q;var H=v(U);return b!==void 0&&b(q,H)?q:(P=U,R=H)}var T=!1,P,R,D=y===void 0?null:y;return[function(){return E(x())},D===null?void 0:function(){return E(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},xde}l7e.exports=nbt();var abt=l7e.exports;const ibt=typeof window<"u"?A.useLayoutEffect:A.useEffect;class obt{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 s=()=>{this.transactionNumber+=1,this.subscribers.forEach(a=>a())},n=this.editor;return n.on("transaction",s),()=>{n.off("transaction",s)}}}}function lbt(e){var t;const[s]=A.useState(()=>new obt(e.editor)),n=abt.useSyncExternalStoreWithSelector(s.subscribe,s.getSnapshot,s.getServerSnapshot,e.selector,(t=e.equalityFn)!==null&&t!==void 0?t:sbt);return ibt(()=>s.watch(e.editor),[e.editor,s]),A.useDebugValue(n),n}const cbt=!1,tpe=typeof window>"u",dbt=tpe||!!(typeof window<"u"&&window.next);class x0e{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(s=>s())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?tpe||dbt?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const t={...this.options.current,onBeforeCreate:(...n)=>{var a,o;return(o=(a=this.options.current).onBeforeCreate)===null||o===void 0?void 0:o.call(a,...n)},onBlur:(...n)=>{var a,o;return(o=(a=this.options.current).onBlur)===null||o===void 0?void 0:o.call(a,...n)},onCreate:(...n)=>{var a,o;return(o=(a=this.options.current).onCreate)===null||o===void 0?void 0:o.call(a,...n)},onDestroy:(...n)=>{var a,o;return(o=(a=this.options.current).onDestroy)===null||o===void 0?void 0:o.call(a,...n)},onFocus:(...n)=>{var a,o;return(o=(a=this.options.current).onFocus)===null||o===void 0?void 0:o.call(a,...n)},onSelectionUpdate:(...n)=>{var a,o;return(o=(a=this.options.current).onSelectionUpdate)===null||o===void 0?void 0:o.call(a,...n)},onTransaction:(...n)=>{var a,o;return(o=(a=this.options.current).onTransaction)===null||o===void 0?void 0:o.call(a,...n)},onUpdate:(...n)=>{var a,o;return(o=(a=this.options.current).onUpdate)===null||o===void 0?void 0:o.call(a,...n)},onContentError:(...n)=>{var a,o;return(o=(a=this.options.current).onContentError)===null||o===void 0?void 0:o.call(a,...n)},onDrop:(...n)=>{var a,o;return(o=(a=this.options.current).onDrop)===null||o===void 0?void 0:o.call(a,...n)},onPaste:(...n)=>{var a,o;return(o=(a=this.options.current).onPaste)===null||o===void 0?void 0:o.call(a,...n)}};return new G_t(t)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(t){return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)}}static compareOptions(t,s){return Object.keys(t).every(n=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)?!0:n==="extensions"&&t.extensions&&s.extensions?t.extensions.length!==s.extensions.length?!1:t.extensions.every((a,o)=>{var l;return a===((l=s.extensions)===null||l===void 0?void 0:l[o])}):t[n]===s[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?x0e.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((n,a)=>n===t[a]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=t}scheduleDestroy(){const t=this.instanceId,s=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===t){s&&s.setOptions(this.options.current);return}s&&!s.isDestroyed&&(s.destroy(),this.instanceId===t&&this.setEditor(null))},1)}}function c7e(e={},t=[]){const s=A.useRef(e);s.current=e;const[n]=A.useState(()=>new x0e(s)),a=g0e.useSyncExternalStore(n.subscribe,n.getEditor,n.getServerSnapshot);return A.useDebugValue(a),A.useEffect(n.onRender(t)),lbt({editor:a,selector:({transactionNumber:o})=>e.shouldRerenderOnTransaction===!1?null:e.immediatelyRender&&o===0?0:o+1}),a}const ubt=A.createContext({editor:null});ubt.Consumer;const hbt=A.createContext({onDragStart:void 0}),mbt=()=>A.useContext(hbt);ut.forwardRef((e,t)=>{const{onDragStart:s}=mbt(),n=e.as||"div";return ut.createElement(n,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:s,style:{whiteSpace:"normal",...e.style}})});const pbt=/^\s*>\s$/,fbt=Au.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:e}){return["blockquote",Gl(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[QE({find:pbt,type:this.type})]}}),gbt=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,xbt=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,ybt=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,vbt=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,_bt=rx.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",Gl(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[GC({find:gbt,type:this.type}),GC({find:ybt,type:this.type})]},addPasteRules(){return[_k({find:xbt,type:this.type}),_k({find:vbt,type:this.type})]}}),bbt="listItem",oSe="textStyle",lSe=/^\s*([-+*])\s$/,wbt=Au.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",Gl(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(bbt,this.editor.getAttributes(oSe)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=QE({find:lSe,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=QE({find:lSe,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(oSe),editor:this.editor})),[e]}}),jbt=/(^|[^`])`([^`]+)`(?!`)/,kbt=/(^|[^`])`([^`]+)`(?!`)/g,Nbt=rx.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",Gl(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[GC({find:jbt,type:this.type})]},addPasteRules(){return[_k({find:kbt,type:this.type})]}}),Sbt=/^```([a-z]+)?[\s\n]$/,Cbt=/^~~~([a-z]+)?[\s\n]$/,Mbt=Au.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:s}=this.options,o=[...((t=e.firstElementChild)===null||t===void 0?void 0:t.classList)||[]].filter(l=>l.startsWith(s)).map(l=>l.replace(s,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:e,HTMLAttributes:t}){return["pre",Gl(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,s=t.pos===1;return!e||t.parent.type.name!==this.name?!1:s||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:s}=t,{$from:n,empty:a}=s;if(!a||n.parent.type!==this.type)return!1;const o=n.parentOffset===n.parent.nodeSize-2,l=n.parent.textContent.endsWith(` `);return!o||!l?!1:e.chain().command(({tr:i})=>(i.delete(n.pos-2,n.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:s,doc:n}=t,{$from:a,empty:o}=s;if(!o||a.parent.type!==this.type||!(a.parentOffset===a.parent.nodeSize-2))return!1;const i=a.after();return i===void 0?!1:n.nodeAt(i)?e.commands.command(({tr:m})=>(m.setSelection(Da.near(n.resolve(i))),!0)):e.commands.exitCode()}}},addInputRules(){return[Jme({find:Sbt,type:this.type,getAttributes:e=>({language:e[1]})}),Jme({find:Cbt,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new vd({key:new Tu("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const s=t.clipboardData.getData("text/plain"),n=t.clipboardData.getData("vscode-editor-data"),a=n?JSON.parse(n):void 0,o=a==null?void 0:a.mode;if(!s||!o)return!1;const{tr:l,schema:i}=e.state,u=i.text(s.replace(/\r\n?/g,` `));return l.replaceSelectionWith(this.type.create({language:o},u)),l.selection.$from.parent.type!==this.type&&l.setSelection(ba.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),e.dispatch(l),!0}}})]}}),Tbt=Au.create({name:"doc",topNode:!0,content:"block+"});function Abt(e={}){return new vd({view(t){return new Ebt(t,e)}})}class Ebt{constructor(t,s){var n;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=s.width)!==null&&n!==void 0?n:1,this.color=s.color===!1?void 0:s.color||"black",this.class=s.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:s})=>this.editorView.dom.removeEventListener(t,s))}update(t,s){this.cursorPos!=null&&s.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),s=!t.parent.inlineContent,n,a=this.editorView.dom,o=a.getBoundingClientRect(),l=o.width/a.offsetWidth,i=o.height/a.offsetHeight;if(s){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;n={left:N.left,right:N.right,top:k-M,bottom:k+M}}}}if(!n){let y=this.editorView.coordsAtPos(this.cursorPos),v=this.width/2*l;n={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",s),this.element.classList.toggle("prosemirror-dropcursor-inline",!s);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=(n.left-m)/l+"px",this.element.style.top=(n.top-x)/i+"px",this.element.style.width=(n.right-n.left)/l+"px",this.element.style.height=(n.bottom-n.top)/i+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let s=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),n=s&&s.inside>=0&&this.editorView.state.doc.nodeAt(s.inside),a=n&&n.type.spec.disableDropCursor,o=typeof a=="function"?a(this.editorView,s,t):a;if(s&&!o){let l=s.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let i=WFe(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 Ibt=ou.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Abt(this.options)]}});class rc extends Da{constructor(t){super(t,t)}map(t,s){let n=t.resolve(s.map(this.head));return rc.valid(n)?new rc(n):Da.near(n)}content(){return Js.empty}eq(t){return t instanceof rc&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,s){if(typeof s.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new rc(t.resolve(s.pos))}getBookmark(){return new y0e(this.anchor)}static valid(t){let s=t.parent;if(s.isTextblock||!Pbt(t)||!Lbt(t))return!1;let n=s.type.spec.allowGapCursor;if(n!=null)return n;let a=s.contentMatchAt(t.index()).defaultType;return a&&a.isTextblock}static findGapCursorFrom(t,s,n=!1){e:for(;;){if(!n&&rc.valid(t))return t;let a=t.pos,o=null;for(let l=t.depth;;l--){let i=t.node(l);if(s>0?t.indexAfter(l)0){o=i.child(s>0?t.indexAfter(l):t.index(l)-1);break}else if(l==0)return null;a+=s;let u=t.doc.resolve(a);if(rc.valid(u))return u}for(;;){let l=s>0?o.firstChild:o.lastChild;if(!l){if(o.isAtom&&!o.isText&&!pa.isSelectable(o)){t=t.doc.resolve(a+o.nodeSize*s),n=!1;continue e}break}o=l,a+=s;let i=t.doc.resolve(a);if(rc.valid(i))return i}return null}}}rc.prototype.visible=!1;rc.findFrom=rc.findGapCursorFrom;Da.jsonID("gapcursor",rc);class y0e{constructor(t){this.pos=t}map(t){return new y0e(t.map(this.pos))}resolve(t){let s=t.resolve(this.pos);return rc.valid(s)?new rc(s):Da.near(s)}}function d7e(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function Pbt(e){for(let t=e.depth;t>=0;t--){let s=e.index(t),n=e.node(t);if(s==0){if(n.type.spec.isolating)return!0;continue}for(let a=n.child(s-1);;a=a.lastChild){if(a.childCount==0&&!a.inlineContent||d7e(a.type))return!0;if(a.inlineContent)return!1}}return!0}function Lbt(e){for(let t=e.depth;t>=0;t--){let s=e.indexAfter(t),n=e.node(t);if(s==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let a=n.child(s);;a=a.firstChild){if(a.childCount==0&&!a.inlineContent||d7e(a.type))return!0;if(a.inlineContent)return!1}}return!0}function Obt(){return new vd({props:{decorations:zbt,createSelectionBetween(e,t,s){return t.pos==s.pos&&rc.valid(s)?new rc(s):null},handleClick:Rbt,handleKeyDown:Dbt,handleDOMEvents:{beforeinput:Fbt}}})}const Dbt=s0e({ArrowLeft:_O("horiz",-1),ArrowRight:_O("horiz",1),ArrowUp:_O("vert",-1),ArrowDown:_O("vert",1)});function _O(e,t){const s=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(n,a,o){let l=n.selection,i=t>0?l.$to:l.$from,u=l.empty;if(l instanceof ba){if(!o.endOfTextblock(s)||i.depth==0)return!1;u=!1,i=n.doc.resolve(t>0?i.after():i.before())}let m=rc.findGapCursorFrom(i,t,u);return m?(a&&a(n.tr.setSelection(new rc(m))),!0):!1}}function Rbt(e,t,s){if(!e||!e.editable)return!1;let n=e.state.doc.resolve(t);if(!rc.valid(n))return!1;let a=e.posAtCoords({left:s.clientX,top:s.clientY});return a&&a.inside>-1&&pa.isSelectable(e.state.doc.nodeAt(a.inside))?!1:(e.dispatch(e.state.tr.setSelection(new rc(n))),!0)}function Fbt(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof rc))return!1;let{$from:s}=e.state.selection,n=s.parent.contentMatchAt(s.index()).findWrapping(e.state.schema.nodes.text);if(!n)return!1;let a=gs.empty;for(let l=n.length-1;l>=0;l--)a=gs.from(n[l].createAndFill(null,a));let o=e.state.tr.replace(s.pos,s.pos,new Js(a,0,0));return o.setSelection(ba.near(o.doc.resolve(s.pos+1))),e.dispatch(o),!1}function zbt(e){if(!(e.selection instanceof rc))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",tc.create(e.doc,[Xu.widget(e.selection.head,t,{key:"gapcursor"})])}const Bbt=ou.create({name:"gapCursor",addProseMirrorPlugins(){return[Obt()]},extendNodeSchema(e){var t;const s={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:(t=_i(An(e,"allowGapCursor",s)))!==null&&t!==void 0?t:null}}}),$bt=Au.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",Gl(this.options.HTMLAttributes,e)]},renderText(){return` `},addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:s,editor:n})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:a,storedMarks:o}=s;if(a.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:i}=n.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()}}}),Ubt=Au.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]}`,Gl(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=>Jme({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}});var vre=200,Ud=function(){};Ud.prototype.append=function(t){return t.length?(t=Ud.from(t),!this.length&&t||t.length=s?Ud.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,s))};Ud.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};Ud.prototype.forEach=function(t,s,n){s===void 0&&(s=0),n===void 0&&(n=this.length),s<=n?this.forEachInner(t,s,n,0):this.forEachInvertedInner(t,s,n,0)};Ud.prototype.map=function(t,s,n){s===void 0&&(s=0),n===void 0&&(n=this.length);var a=[];return this.forEach(function(o,l){return a.push(t(o,l))},s,n),a};Ud.from=function(t){return t instanceof Ud?t:t&&t.length?new u7e(t):Ud.empty};var u7e=function(e){function t(n){e.call(this),this.values=n}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var s={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<=vre)return new t(this.values.concat(a.flatten()))},t.prototype.leafPrepend=function(a){if(this.length+a.length<=vre)return new t(a.flatten().concat(this.values))},s.length.get=function(){return this.values.length},s.depth.get=function(){return 0},Object.defineProperties(t.prototype,s),t}(Ud);Ud.empty=new u7e([]);var qbt=function(e){function t(s,n){e.call(this),this.left=s,this.right=n,this.length=s.length+n.length,this.depth=Math.max(s.depth,n.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(n){return ni&&this.right.forEachInner(n,Math.max(a-i,0),Math.min(this.length,o)-i,l+i)===!1)return!1},t.prototype.forEachInvertedInner=function(n,a,o,l){var i=this.left.length;if(a>i&&this.right.forEachInvertedInner(n,a-i,Math.max(o,i)-i,l+i)===!1||o=o?this.right.slice(n-o,a-o):this.left.slice(n,o).append(this.right.slice(0,a-o))},t.prototype.leafAppend=function(n){var a=this.right.leafAppend(n);if(a)return new t(this.left,a)},t.prototype.leafPrepend=function(n){var a=this.left.leafPrepend(n);if(a)return new t(a,this.right)},t.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new t(this.left,new t(this.right,n)):new t(this,n)},t}(Ud);const Vbt=500;class _f{constructor(t,s){this.items=t,this.eventCount=s}popEvent(t,s){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let a,o;s&&(a=this.remapping(n,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(n,v+1),o=a.maps.length),o--,x.push(y);return}if(a){x.push(new yg(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 yg(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 _f(this.items.slice(0,n).append(x.reverse().concat(m)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:l,selection:i}}addTransform(t,s,n,a){let o=[],l=this.eventCount,i=this.items,u=!a&&i.length?i.get(i.length-1):null;for(let x=0;xWbt&&(i=Hbt(i,m),l-=m),new _f(i.append(o),l)}remapping(t,s){let n=new HE;return this.items.forEach((a,o)=>{let l=a.mirrorOffset!=null&&o-a.mirrorOffset>=t?n.maps.length-a.mirrorOffset:void 0;n.appendMap(a.map,l)},t,s),n}addMaps(t){return this.eventCount==0?this:new _f(this.items.append(t.map(s=>new yg(s))),this.eventCount)}rebased(t,s){if(!this.eventCount)return this;let n=[],a=Math.max(0,this.items.length-s),o=t.mapping,l=t.steps.length,i=this.eventCount;this.items.forEach(v=>{v.selection&&i--},a);let u=s;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++,n.push(new yg(N,k,M))}else n.push(new yg(N))},a);let m=[];for(let v=s;vVbt&&(y=y.compress(this.items.length-n.length)),y}emptyItemCount(){let t=0;return this.items.forEach(s=>{s.step||t++}),t}compress(t=this.items.length){let s=this.remapping(0,t),n=s.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(s.slice(n)),m=u&&u.getMap();if(n--,m&&s.appendMap(m,n),u){let x=l.selection&&l.selection.map(s.slice(n));x&&o++;let y=new yg(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&&n--},this.items.length,0),new _f(Ud.from(a.reverse()),o)}}_f.empty=new _f(Ud.empty,0);function Hbt(e,t){let s;return e.forEach((n,a)=>{if(n.selection&&t--==0)return s=a,!1}),e.slice(s)}class yg{constructor(t,s,n,a){this.map=t,this.step=s,this.selection=n,this.mirrorOffset=a}merge(t){if(this.step&&t.step&&!t.selection){let s=t.step.merge(this.step);if(s)return new yg(s.getMap().invert(),s,this.selection)}}}class t1{constructor(t,s,n,a,o){this.done=t,this.undone=s,this.prevRanges=n,this.prevTime=a,this.prevComposition=o}}const Wbt=20;function Gbt(e,t,s,n){let a=s.getMeta(Jj),o;if(a)return a.historyState;s.getMeta(Ybt)&&(e=new t1(e.done,e.undone,null,0,-1));let l=s.getMeta("appendedTransaction");if(s.steps.length==0)return e;if(l&&l.getMeta(Jj))return l.getMeta(Jj).redo?new t1(e.done.addTransform(s,void 0,n,Yee(t)),e.undone,cSe(s.mapping.maps),e.prevTime,e.prevComposition):new t1(e.done,e.undone.addTransform(s,void 0,n,Yee(t)),null,e.prevTime,e.prevComposition);if(s.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let i=s.getMeta("composition"),u=e.prevTime==0||!l&&e.prevComposition!=i&&(e.prevTime<(s.time||0)-n.newGroupDelay||!Kbt(s,e.prevRanges)),m=l?yde(e.prevRanges,s.mapping):cSe(s.mapping.maps);return new t1(e.done.addTransform(s,u?t.selection.getBookmark():void 0,n,Yee(t)),_f.empty,m,s.time,i??e.prevComposition)}else return(o=s.getMeta("rebased"))?new t1(e.done.rebased(s,o),e.undone.rebased(s,o),yde(e.prevRanges,s.mapping),e.prevTime,e.prevComposition):new t1(e.done.addMaps(s.mapping.maps),e.undone.addMaps(s.mapping.maps),yde(e.prevRanges,s.mapping),e.prevTime,e.prevComposition)}function Kbt(e,t){if(!t)return!1;if(!e.docChanged)return!0;let s=!1;return e.mapping.maps[0].forEach((n,a)=>{for(let o=0;o=t[o]&&(s=!0)}),s}function cSe(e){let t=[];for(let s=e.length-1;s>=0&&t.length==0;s--)e[s].forEach((n,a,o,l)=>t.push(o,l));return t}function yde(e,t){if(!e)return null;let s=[];for(let n=0;n{let a=Jj.getState(s);if(!a||(e?a.undone:a.done).eventCount==0)return!1;if(n){let o=Zbt(a,s,e);o&&n(t?o.scrollIntoView():o)}return!0}}const m7e=h7e(!1,!0),p7e=h7e(!0,!0),Qbt=ou.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>m7e(e,t),redo:()=>({state:e,dispatch:t})=>p7e(e,t)}},addProseMirrorPlugins(){return[Xbt(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()}}}),Jbt=Au.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",Gl(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!K_t(t,t.schema.nodes[this.name]))return!1;const{selection:s}=t,{$from:n,$to:a}=s,o=e();return n.parentOffset===0?o.insertContentAt({from:Math.max(n.pos-1,0),to:a.pos},{type:this.name}):g_t(s)?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(ba.create(l.doc,m.pos+1)):m.nodeAfter.isBlock?l.setSelection(pa.create(l.doc,m.pos)):l.setSelection(ba.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(ba.create(l.doc,x+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[a7e({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),e2t=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,t2t=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,r2t=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,s2t=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,n2t=rx.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",Gl(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[GC({find:e2t,type:this.type}),GC({find:r2t,type:this.type})]},addPasteRules(){return[_k({find:t2t,type:this.type}),_k({find:s2t,type:this.type})]}}),a2t=Au.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",Gl(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)}}}),i2t="listItem",uSe="textStyle",hSe=/^(\d+)\.\s$/,o2t=Au.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,...s}=e;return t===1?["ol",Gl(this.options.HTMLAttributes,s),0]:["ol",Gl(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(i2t,this.editor.getAttributes(uSe)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=QE({find:hSe,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,s)=>s.childCount+s.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=QE({find:hSe,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(uSe)}),joinPredicate:(t,s)=>s.childCount+s.attrs.start===+t[1],editor:this.editor})),[e]}}),l2t=Au.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",Gl(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),c2t=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,d2t=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,u2t=rx.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",Gl(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[GC({find:c2t,type:this.type})]},addPasteRules(){return[_k({find:d2t,type:this.type})]}}),h2t=Au.create({name:"text",group:"inline"}),f7e=ou.create({name:"starterKit",addExtensions(){const e=[];return this.options.bold!==!1&&e.push(_bt.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(fbt.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(wbt.configure(this.options.bulletList)),this.options.code!==!1&&e.push(Nbt.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(Mbt.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(Tbt.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(Ibt.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(Bbt.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push($bt.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(Ubt.configure(this.options.heading)),this.options.history!==!1&&e.push(Qbt.configure(this.options.history)),this.options.horizontalRule!==!1&&e.push(Jbt.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(n2t.configure(this.options.italic)),this.options.listItem!==!1&&e.push(a2t.configure(this.options.listItem)),this.options.orderedList!==!1&&e.push(o2t.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(l2t.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(u2t.configure(this.options.strike)),this.options.text!==!1&&e.push(h2t.configure(this.options.text)),e}}),m2t="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",p2t="ελ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",rpe="numeric",spe="ascii",npe="alpha",ZA="asciinumeric",VT="alphanumeric",ape="domain",g7e="emoji",f2t="scheme",g2t="slashscheme",_de="whitespace";function x2t(e,t){return e in t||(t[e]=[]),t[e]}function pj(e,t,s){t[rpe]&&(t[ZA]=!0,t[VT]=!0),t[spe]&&(t[ZA]=!0,t[npe]=!0),t[ZA]&&(t[VT]=!0),t[npe]&&(t[VT]=!0),t[VT]&&(t[ape]=!0),t[g7e]&&(t[ape]=!0);for(const n in t){const a=x2t(n,s);a.indexOf(e)<0&&a.push(e)}}function y2t(e,t){const s={};for(const n in t)t[n].indexOf(e)>=0&&(s[n]=!0);return s}function Th(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}Th.groups={};Th.prototype={accepts(){return!!this.t},go(e){const t=this,s=t.j[e];if(s)return s;for(let n=0;ne.ta(t,s,n,a),Zl=(e,t,s,n,a)=>e.tr(t,s,n,a),mSe=(e,t,s,n,a)=>e.ts(t,s,n,a),Es=(e,t,s,n,a)=>e.tt(t,s,n,a),Ux="WORD",ipe="UWORD",x7e="ASCIINUMERICAL",y7e="ALPHANUMERICAL",JE="LOCALHOST",ope="TLD",lpe="UTLD",Xee="SCHEME",Z4="SLASH_SCHEME",v0e="NUM",cpe="WS",_0e="NL",YA="OPENBRACE",XA="CLOSEBRACE",_re="OPENBRACKET",bre="CLOSEBRACKET",wre="OPENPAREN",jre="CLOSEPAREN",kre="OPENANGLEBRACKET",Nre="CLOSEANGLEBRACKET",Sre="FULLWIDTHLEFTPAREN",Cre="FULLWIDTHRIGHTPAREN",Mre="LEFTCORNERBRACKET",Tre="RIGHTCORNERBRACKET",Are="LEFTWHITECORNERBRACKET",Ere="RIGHTWHITECORNERBRACKET",Ire="FULLWIDTHLESSTHAN",Pre="FULLWIDTHGREATERTHAN",Lre="AMPERSAND",Ore="APOSTROPHE",Dre="ASTERISK",r1="AT",Rre="BACKSLASH",Fre="BACKTICK",zre="CARET",u1="COLON",b0e="COMMA",Bre="DOLLAR",vg="DOT",$re="EQUALS",w0e="EXCLAMATION",Xm="HYPHEN",QA="PERCENT",Ure="PIPE",qre="PLUS",Vre="POUND",JA="QUERY",j0e="QUOTE",v7e="FULLWIDTHMIDDLEDOT",k0e="SEMI",_g="SLASH",eE="TILDE",Hre="UNDERSCORE",_7e="EMOJI",Wre="SYM";var b7e=Object.freeze({__proto__:null,ALPHANUMERICAL:y7e,AMPERSAND:Lre,APOSTROPHE:Ore,ASCIINUMERICAL:x7e,ASTERISK:Dre,AT:r1,BACKSLASH:Rre,BACKTICK:Fre,CARET:zre,CLOSEANGLEBRACKET:Nre,CLOSEBRACE:XA,CLOSEBRACKET:bre,CLOSEPAREN:jre,COLON:u1,COMMA:b0e,DOLLAR:Bre,DOT:vg,EMOJI:_7e,EQUALS:$re,EXCLAMATION:w0e,FULLWIDTHGREATERTHAN:Pre,FULLWIDTHLEFTPAREN:Sre,FULLWIDTHLESSTHAN:Ire,FULLWIDTHMIDDLEDOT:v7e,FULLWIDTHRIGHTPAREN:Cre,HYPHEN:Xm,LEFTCORNERBRACKET:Mre,LEFTWHITECORNERBRACKET:Are,LOCALHOST:JE,NL:_0e,NUM:v0e,OPENANGLEBRACKET:kre,OPENBRACE:YA,OPENBRACKET:_re,OPENPAREN:wre,PERCENT:QA,PIPE:Ure,PLUS:qre,POUND:Vre,QUERY:JA,QUOTE:j0e,RIGHTCORNERBRACKET:Tre,RIGHTWHITECORNERBRACKET:Ere,SCHEME:Xee,SEMI:k0e,SLASH:_g,SLASH_SCHEME:Z4,SYM:Wre,TILDE:eE,TLD:ope,UNDERSCORE:Hre,UTLD:lpe,UWORD:ipe,WORD:Ux,WS:cpe});const Rx=/[a-z]/,yT=new RegExp("\\p{L}","u"),bde=new RegExp("\\p{Emoji}","u"),Fx=/\d/,wde=/\s/,pSe="\r",jde=` `,v2t="️",_2t="‍",kde="";let bO=null,wO=null;function b2t(e=[]){const t={};Th.groups=t;const s=new Th;bO==null&&(bO=fSe(m2t)),wO==null&&(wO=fSe(p2t)),Es(s,"'",Ore),Es(s,"{",YA),Es(s,"}",XA),Es(s,"[",_re),Es(s,"]",bre),Es(s,"(",wre),Es(s,")",jre),Es(s,"<",kre),Es(s,">",Nre),Es(s,"(",Sre),Es(s,")",Cre),Es(s,"「",Mre),Es(s,"」",Tre),Es(s,"『",Are),Es(s,"』",Ere),Es(s,"<",Ire),Es(s,">",Pre),Es(s,"&",Lre),Es(s,"*",Dre),Es(s,"@",r1),Es(s,"`",Fre),Es(s,"^",zre),Es(s,":",u1),Es(s,",",b0e),Es(s,"$",Bre),Es(s,".",vg),Es(s,"=",$re),Es(s,"!",w0e),Es(s,"-",Xm),Es(s,"%",QA),Es(s,"|",Ure),Es(s,"+",qre),Es(s,"#",Vre),Es(s,"?",JA),Es(s,'"',j0e),Es(s,"/",_g),Es(s,";",k0e),Es(s,"~",eE),Es(s,"_",Hre),Es(s,"\\",Rre),Es(s,"・",v7e);const n=Zl(s,Fx,v0e,{[rpe]:!0});Zl(n,Fx,n);const a=Zl(n,Rx,x7e,{[ZA]:!0}),o=Zl(n,yT,y7e,{[VT]:!0}),l=Zl(s,Rx,Ux,{[spe]:!0});Zl(l,Fx,a),Zl(l,Rx,l),Zl(a,Fx,a),Zl(a,Rx,a);const i=Zl(s,yT,ipe,{[npe]:!0});Zl(i,Rx),Zl(i,Fx,o),Zl(i,yT,i),Zl(o,Fx,o),Zl(o,Rx),Zl(o,yT,o);const u=Es(s,jde,_0e,{[_de]:!0}),m=Es(s,pSe,cpe,{[_de]:!0}),x=Zl(s,wde,cpe,{[_de]:!0});Es(s,kde,x),Es(m,jde,u),Es(m,kde,x),Zl(m,wde,x),Es(x,pSe),Es(x,jde),Zl(x,wde,x),Es(x,kde,x);const y=Zl(s,bde,_7e,{[g7e]:!0});Es(y,"#"),Zl(y,bde,y),Es(y,v2t,y);const v=Es(y,_2t);Es(v,"#"),Zl(v,bde,y);const b=[[Rx,l],[Fx,a]],N=[[Rx,null],[yT,i],[Fx,o]];for(let k=0;kk[0]>M[0]?1:-1);for(let k=0;k=0?T[ape]=!0:Rx.test(M)?Fx.test(M)?T[ZA]=!0:T[spe]=!0:T[rpe]=!0,mSe(s,M,M,T)}return mSe(s,"localhost",JE,{ascii:!0}),s.jd=new Th(Wre),{start:s,tokens:Object.assign({groups:t},b7e)}}function w7e(e,t){const s=w2t(t.replace(/[A-Z]/g,i=>i.toLowerCase())),n=s.length,a=[];let o=0,l=0;for(;l=0&&(y+=s[l].length,v++),m+=s[l].length,o+=s[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 w2t(e){const t=[],s=e.length;let n=0;for(;n56319||n+1===s||(o=e.charCodeAt(n+1))<56320||o>57343?e[n]:e.slice(n,n+2);t.push(l),n+=l.length}return t}function $0(e,t,s,n,a){let o;const l=t.length;for(let i=0;i=0;)o++;if(o>0){t.push(s.join(""));for(let l=parseInt(e.substring(n,n+o),10);l>0;l--)s.pop();n+=o}else s.push(e[n]),n++}return t}const eI={defaultProtocol:"http",events:null,format:gSe,formatHref:gSe,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function N0e(e,t=null){let s=Object.assign({},eI);e&&(s=Object.assign(s,e instanceof N0e?e.o:e));const n=s.ignoreTags,a=[];for(let o=0;os?n.substring(0,s)+"…":n},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=eI.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,s=this.toHref(e.get("defaultProtocol")),n=e.get("formatHref",s,this),a=e.get("tagName",s,t),o=this.toFormattedString(e),l={},i=e.get("className",s,t),u=e.get("target",s,t),m=e.get("rel",s,t),x=e.getObj("attributes",s,t),y=e.getObj("events",s,t);return l.href=n,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 Tae(e,t){class s extends j7e{constructor(a,o){super(a,o),this.t=e}}for(const n in t)s.prototype[n]=t[n];return s.t=e,s}const xSe=Tae("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ySe=Tae("text"),j2t=Tae("nl"),jO=Tae("url",{isLink:!0,toHref(e=eI.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==JE&&e[1].t===u1}}),Gm=e=>new Th(e);function k2t({groups:e}){const t=e.domain.concat([Lre,Dre,r1,Rre,Fre,zre,Bre,$re,Xm,v0e,QA,Ure,qre,Vre,_g,Wre,eE,Hre]),s=[Ore,u1,b0e,vg,w0e,QA,JA,j0e,k0e,kre,Nre,YA,XA,bre,_re,wre,jre,Sre,Cre,Mre,Tre,Are,Ere,Ire,Pre],n=[Lre,Ore,Dre,Rre,Fre,zre,Bre,$re,Xm,YA,XA,QA,Ure,qre,Vre,JA,_g,Wre,eE,Hre],a=Gm(),o=Es(a,eE);vi(o,n,o),vi(o,e.domain,o);const l=Gm(),i=Gm(),u=Gm();vi(a,e.domain,l),vi(a,e.scheme,i),vi(a,e.slashscheme,u),vi(l,n,o),vi(l,e.domain,l);const m=Es(l,r1);Es(o,r1,m),Es(i,r1,m),Es(u,r1,m);const x=Es(o,vg);vi(x,n,o),vi(x,e.domain,o);const y=Gm();vi(m,e.domain,y),vi(y,e.domain,y);const v=Es(y,vg);vi(v,e.domain,y);const b=Gm(xSe);vi(v,e.tld,b),vi(v,e.utld,b),Es(m,JE,b);const N=Es(y,Xm);Es(N,Xm,N),vi(N,e.domain,y),vi(b,e.domain,y),Es(b,vg,v),Es(b,Xm,N);const k=Es(b,u1);vi(k,e.numeric,xSe);const M=Es(l,Xm),E=Es(l,vg);Es(M,Xm,M),vi(M,e.domain,l),vi(E,n,o),vi(E,e.domain,l);const T=Gm(jO);vi(E,e.tld,T),vi(E,e.utld,T),vi(T,e.domain,l),vi(T,n,o),Es(T,vg,E),Es(T,Xm,M),Es(T,r1,m);const P=Es(T,u1),R=Gm(jO);vi(P,e.numeric,R);const D=Gm(jO),U=Gm();vi(D,t,D),vi(D,s,U),vi(U,t,D),vi(U,s,U),Es(T,_g,D),Es(R,_g,D);const q=Es(i,u1),H=Es(u,u1),G=Es(H,_g),Q=Es(G,_g);vi(i,e.domain,l),Es(i,vg,E),Es(i,Xm,M),vi(u,e.domain,l),Es(u,vg,E),Es(u,Xm,M),vi(q,e.domain,D),Es(q,_g,D),Es(q,JA,D),vi(Q,e.domain,D),vi(Q,t,D),Es(Q,_g,D);const ne=[[YA,XA],[_re,bre],[wre,jre],[kre,Nre],[Sre,Cre],[Mre,Tre],[Are,Ere],[Ire,Pre]];for(let ie=0;ie=0&&v++,a++,x++;if(v<0)a-=x,a0&&(o.push(Nde(ySe,t,l)),l=[]),a-=v,x-=v;const b=y.t,N=s.slice(a-x,a);o.push(Nde(b,t,N))}}return l.length>0&&o.push(Nde(ySe,t,l)),o}function Nde(e,t,s){const n=s[0].s,a=s[s.length-1].e,o=t.slice(n,a);return new e(o,s)}const S2t=typeof console<"u"&&console&&console.warn||(()=>{}),C2t="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",xl={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function M2t(){return Th.groups={},xl.scanner=null,xl.parser=null,xl.tokenQueue=[],xl.pluginQueue=[],xl.customSchemes=[],xl.initialized=!1,xl}function vSe(e,t=!1){if(xl.initialized&&S2t(`linkifyjs: already initialized - will not register custom scheme "${e}" ${C2t}`),!/^[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`);xl.customSchemes.push([e,t])}function T2t(){xl.scanner=b2t(xl.customSchemes);for(let e=0;e{const a=t.some(m=>m.docChanged)&&!s.doc.eq(n.doc),o=t.some(m=>m.getMeta("preventAutolink"));if(!a||o)return;const{tr:l}=n,i=o_t(s.doc,[...t]);if(p_t(i).forEach(({newRange:m})=>{const x=c_t(n.doc,m,b=>b.isTextblock);let y,v;if(x.length>1)y=x[0],v=n.doc.textBetween(y.pos,y.pos+y.node.nodeSize,void 0," ");else if(x.length){const b=n.doc.textBetween(m.from,m.to," "," ");if(!E2t.test(b))return;y=x[0],v=n.doc.textBetween(y.pos,m.to,void 0," ")}if(y&&v){const b=v.split(A2t).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=S0e(N).map(E=>E.toObject(e.defaultProtocol));if(!P2t(M))return!1;M.filter(E=>E.isLink).map(E=>({...E,from:k+E.start+1,to:k+E.end+1})).filter(E=>n.schema.marks.code?!n.doc.rangeHasMark(E.from,E.to,n.schema.marks.code):!0).filter(E=>e.validate(E.value)).filter(E=>e.shouldAutoLink(E.value)).forEach(E=>{p0e(E.from,E.to,n.doc).some(T=>T.mark.type===e.type)||l.addMark(E.from,E.to,e.type.create({href:E.href}))})}}),!!l.steps.length)return l}})}function O2t(e){return new vd({key:new Tu("handleClickLink"),props:{handleClick:(t,s,n)=>{var a,o;if(n.button!==0||!t.editable)return!1;let l=n.target;const i=[];for(;l.nodeName!=="DIV";)i.push(l),l=l.parentNode;if(!i.find(v=>v.nodeName==="A"))return!1;const u=n7e(t.state,e.type.name),m=n.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 D2t(e){return new vd({key:new Tu("handlePasteLink"),props:{handlePaste:(t,s,n)=>{const{state:a}=t,{selection:o}=a,{empty:l}=o;if(l)return!1;let i="";n.content.forEach(m=>{i+=m.textContent});const u=k7e(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 E_(e,t){const s=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(n=>{const a=typeof n=="string"?n:n.scheme;a&&s.push(a)}),!e||e.replace(I2t,"").match(new RegExp(`^(?:(?:${s.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const N7e=rx.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"){vSe(e);return}vSe(e.scheme,e.optionalSlashes)})},onDestroy(){M2t()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!E_(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:s=>!!E_(s,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:t=>!!E_(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Gl(this.options.HTMLAttributes,e),0]:["a",Gl(this.options.HTMLAttributes,{...e,href:""}),0]},addCommands(){return{setLink:e=>({chain:t})=>{const{href:s}=e;return this.options.isAllowedUri(s,{defaultValidate:n=>!!E_(n,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:s}=e;return this.options.isAllowedUri(s,{defaultValidate:n=>!!E_(n,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[_k({find:e=>{const t=[];if(e){const{protocols:s,defaultProtocol:n}=this.options,a=k7e(e).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:l=>!!E_(l,s),protocols:s,defaultProtocol:n}));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:s}=this.options;return this.options.autolink&&e.push(L2t({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:n=>this.options.isAllowedUri(n,{defaultValidate:a=>!!E_(a,t),protocols:t,defaultProtocol:s}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&e.push(O2t({type:this.type})),this.options.linkOnPaste&&e.push(D2t({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),e}}),S7e=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(s=>t.updateAttributes(s,{textAlign:e})).every(s=>s):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).every(t=>t),toggleTextAlign:e=>({editor:t,commands:s})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?s.unsetTextAlign():s.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")}}}),R2t=e=>{if(!e.children.length)return;const t=e.querySelectorAll("span");t&&t.forEach(s=>{var n,a;const o=s.getAttribute("style"),l=(a=(n=s.parentElement)===null||n===void 0?void 0:n.closest("span"))===null||a===void 0?void 0:a.getAttribute("style");s.setAttribute("style",`${l};${o}`)})},C7e=rx.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:e=>e.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&R2t(e),{}):!1}]},renderHTML({HTMLAttributes:e}){return["span",Gl(this.options.HTMLAttributes,e),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:e})=>{const{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(s,n)=>{if(s.isTextblock)return!0;s.marks.filter(a=>a.type===this.type).some(a=>Object.values(a.attrs).some(o=>!!o))||e.removeMark(n,n+s.nodeSize,this.type)}),!0}}}}),F2t=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,z2t=Au.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",Gl(this.options.HTMLAttributes,e)]},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[a7e({find:F2t,type:this.type,getAttributes:e=>{const[,,t,s,n]=e;return{src:s,alt:t,title:n}}})]}});let dpe,upe;if(typeof WeakMap<"u"){let e=new WeakMap;dpe=t=>e.get(t),upe=(t,s)=>(e.set(t,s),s)}else{const e=[];let s=0;dpe=n=>{for(let a=0;a(s==10&&(s=0),e[s++]=n,e[s++]=a)}var nc=class{constructor(e,t,s,n){this.width=e,this.height=t,this.map=s,this.problems=n}findCell(e){for(let t=0;t=s){(o||(o=[])).push({type:"overlong_rowspan",pos:x,n:E-P});break}const R=a+P*t;for(let D=0;Dn&&(o+=m.attrs.colspan)}}for(let l=0;l1&&(s=!0)}t==-1?t=o:t!=o&&(t=Math.max(t,o))}return t}function U2t(e,t,s){e.problems||(e.problems=[]);const n={};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 V2t(e){for(let t=e.depth;t>0;t--){const s=e.node(t).type.spec.tableRole;if(s==="cell"||s==="header_cell")return e.node(t)}return null}function Hf(e){const t=e.selection.$head;for(let s=t.depth;s>0;s--)if(t.node(s).type.spec.tableRole=="row")return!0;return!1}function Aae(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 s=z3(t.$head)||H2t(t.$head);if(s)return s;throw new RangeError(`No cell found around position ${t.head}`)}function H2t(e){for(let t=e.nodeAfter,s=e.pos;t;t=t.firstChild,s++){const n=t.type.spec.tableRole;if(n=="cell"||n=="header_cell")return e.doc.resolve(s)}for(let t=e.nodeBefore,s=e.pos;t;t=t.lastChild,s--){const n=t.type.spec.tableRole;if(n=="cell"||n=="header_cell")return e.doc.resolve(s-t.nodeSize)}}function hpe(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function W2t(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function M0e(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function M7e(e,t,s){const n=e.node(-1),a=nc.get(n),o=e.start(-1),l=a.nextCell(e.pos-o,t,s);return l==null?null:e.node(0).resolve(o+l)}function bk(e,t,s=1){const n={...e,colspan:e.colspan-s};return n.colwidth&&(n.colwidth=n.colwidth.slice(),n.colwidth.splice(t,s),n.colwidth.some(a=>a>0)||(n.colwidth=null)),n}function T7e(e,t,s=1){const n={...e,colspan:e.colspan+s};if(n.colwidth){n.colwidth=n.colwidth.slice();for(let a=0;ax!=s.pos-o);u.unshift(s.pos-o);const m=u.map(x=>{const y=n.nodeAt(x);if(!y)throw new RangeError(`No cell with offset ${x} found`);const v=o+x+1;return new XFe(i.resolve(v),i.resolve(v+y.content.size))});super(m[0].$from,m[0].$to,m),this.$anchorCell=t,this.$headCell=s}map(t,s){const n=t.resolve(s.map(this.$anchorCell.pos)),a=t.resolve(s.map(this.$headCell.pos));if(hpe(n)&&hpe(a)&&M0e(n,a)){const o=this.$anchorCell.node(-1)!=n.node(-1);return o&&this.isRowSelection()?qx.rowSelection(n,a):o&&this.isColSelection()?qx.colSelection(n,a):new qx(n,a)}return ba.between(n,a)}content(){const t=this.$anchorCell.node(-1),s=nc.get(t),n=this.$anchorCell.start(-1),a=s.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),o={},l=[];for(let u=a.top;u0||M>0){let E=N.attrs;if(k>0&&(E=bk(E,0,k)),M>0&&(E=bk(E,E.colspan-M,M)),b.lefta.bottom){const E={...N.attrs,rowspan:Math.min(b.bottom,a.bottom)-Math.max(b.top,a.top)};b.top0)return!1;const n=t+this.$anchorCell.nodeAfter.attrs.rowspan,a=s+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,a)==this.$headCell.node(-1).childCount}static colSelection(t,s=t){const n=t.node(-1),a=nc.get(n),o=t.start(-1),l=a.findCell(t.pos-o),i=a.findCell(s.pos-o),u=t.node(0);return l.top<=i.top?(l.top>0&&(t=u.resolve(o+a.map[l.left])),i.bottom0&&(s=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)==s.width}eq(t){return t instanceof qx&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,s=t){const n=t.node(-1),a=nc.get(n),o=t.start(-1),l=a.findCell(t.pos-o),i=a.findCell(s.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&&(s=u.resolve(o+a.map[i.top*a.width])),l.right{t.push(Xu.node(n,n+s.nodeSize,{class:"selectedCell"}))}),tc.create(e.doc,t)}function Y2t({$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--,n--);return s==n&&/row|table/.test(e.node(a).type.spec.tableRole)}function X2t({$from:e,$to:t}){let s,n;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"){s=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"){n=o;break}}return s!==n&&t.parentOffset===0}function Q2t(e,t,s){const n=(t||e).selection,a=(t||e).doc;let o,l;if(n instanceof pa&&(l=n.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")o=cl.create(a,n.from);else if(l=="row"){const i=a.resolve(n.from+1);o=cl.rowSelection(i,i)}else if(!s){const i=nc.get(n.node),u=n.from+1,m=u+i.map[i.width*i.height-1];o=cl.create(a,u+1,m)}}else n instanceof ba&&Y2t(n)?o=ba.create(a,n.from):n instanceof ba&&X2t(n)&&(o=ba.create(a,n.$from.start(),n.$from.end()));return o&&(t||(t=e.tr)).setSelection(o),t}const J2t=new Tu("fix-tables");function E7e(e,t,s,n){const a=e.childCount,o=t.childCount;e:for(let l=0,i=0;l{a.type.spec.tableRole=="table"&&(s=ewt(e,a,o,s))};return t?t.doc!=e.doc&&E7e(t.doc,e.doc,0,n):e.doc.descendants(n),s}function ewt(e,t,s,n){const a=nc.get(t);if(!a.problems)return n;n||(n=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;G2t(t,n,a+o)&&(o=a==0||a==t.width?null:0);for(let l=0;l0&&a0&&t.map[i-1]==u||a0?-1:0;awt(t,n,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=s.nodeAt(y).attrs;e.setNodeMarkup(e.mapping.slice(i).map(y+n),null,{...v,rowspan:v.rowspan-1}),m+=v.colspan-1}else if(a0&&s[o]==s[o-1]||n.right0&&s[a]==s[a-e]||n.bottom0){const x=u+1+m.content.size,y=_Se(m)?u+1:x;o.replaceWith(y+n.tableStart,x+n.tableStart,i)}o.setSelection(new cl(o.doc.resolve(u+n.tableStart))),t(o)}return!0}function wSe(e,t){const s=Su(e.schema);return uwt(({node:n})=>s[n.type.spec.tableRole])(e,t)}function uwt(e){return(t,s)=>{const n=t.selection;let a,o;if(n instanceof cl){if(n.$anchorCell.pos!=n.$headCell.pos)return!1;a=n.$anchorCell.nodeAfter,o=n.$anchorCell.pos}else{var l;if(a=V2t(n.$from),!a)return!1;o=(l=z3(n.$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(s){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=cx(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}),n(o)}return!0}}function mwt(e){return function(t,s){if(!Hf(t))return!1;if(s){const n=Su(t.schema),a=cx(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)}),n(l)}return!0}}tI("row",{useDeprecatedLogic:!0});tI("column",{useDeprecatedLogic:!0});const pwt=tI("cell",{useDeprecatedLogic:!0});function fwt(e,t){if(t<0){const s=e.nodeBefore;if(s)return e.pos-s.nodeSize;for(let n=e.index(-1)-1,a=e.before();n>=0;n--){const o=e.node(-1).child(n),l=o.lastChild;if(l)return a-1-l.nodeSize;a-=o.nodeSize}}else{if(e.index()0;n--)if(s.node(n).type.spec.tableRole=="table")return t&&t(e.tr.delete(s.before(n),s.after(n)).scrollIntoView()),!0;return!1}function kO(e,t){const s=e.selection;if(!(s instanceof cl))return!1;if(t){const n=e.tr,a=Su(e.schema).cell.createAndFill().content;s.forEachCell((o,l)=>{o.content.eq(a)||n.replace(n.mapping.map(l+1),n.mapping.map(l+o.nodeSize-1),new Js(a,0,0))}),n.docChanged&&t(n)}return!0}function xwt(e){if(e.size===0)return null;let{content:t,openStart:s,openEnd:n}=e;for(;t.childCount==1&&(s>0&&n>0||t.child(0).type.spec.tableRole=="table");)s--,n--,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(gs.empty),s[a]n&&(v=v.type.createChecked(bk(v.attrs,v.attrs.colspan,x+v.attrs.colspan-n),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(gs.from(u))}s=o,t=a}return{width:e,height:t,rows:s}}function _wt(e,t,s,n,a,o,l){const i=e.doc.type.schema,u=Su(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:s.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,gs.from(y)),b=[];for(let N=t.height;N{if(!a)return!1;const o=s.selection;if(o instanceof cl)return Qee(s,n,Da.near(o.$headCell,t));if(e!="horiz"&&!o.empty)return!1;const l=O7e(a,e,t);if(l==null)return!1;if(e=="horiz")return Qee(s,n,Da.near(s.doc.resolve(o.head+t),t));{const i=s.doc.resolve(l),u=M7e(i,e,t);let m;return u?m=Da.near(u,1):t<0?m=Da.near(s.doc.resolve(i.before(-1)),-1):m=Da.near(s.doc.resolve(i.after(-1)),1),Qee(s,n,m)}}}function SO(e,t){return(s,n,a)=>{if(!a)return!1;const o=s.selection;let l;if(o instanceof cl)l=o;else{const u=O7e(a,e,t);if(u==null)return!1;l=new cl(s.doc.resolve(u))}const i=M7e(l.$headCell,e,t);return i?Qee(s,n,new cl(l.$anchorCell,i)):!1}}function wwt(e,t){const s=e.state.doc,n=z3(s.resolve(t));return n?(e.dispatch(e.state.tr.setSelection(new cl(n))),!0):!1}function jwt(e,t,s){if(!Hf(e.state))return!1;let n=xwt(s);const a=e.state.selection;if(a instanceof cl){n||(n={width:1,height:1,rows:[gs.from(mpe(Su(e.state.schema).cell,s))]});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 n=vwt(n,i.right-i.left,i.bottom-i.top),CSe(e.state,e.dispatch,l,i,n),!0}else if(n){const o=Aae(e.state),l=o.start(-1);return CSe(e.state,e.dispatch,l,nc.get(o.node(-1)).findCell(o.pos-l),n),!0}else return!1}function kwt(e,t){var s;if(t.ctrlKey||t.metaKey)return;const n=MSe(e,t.target);let a;if(t.shiftKey&&e.state.selection instanceof cl)o(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(a=z3(e.state.selection.$anchor))!=null&&((s=Sde(e,t))===null||s===void 0?void 0:s.pos)!=a.pos)o(a,t),t.preventDefault();else if(!n)return;function o(u,m){let x=Sde(e,m);const y=h1.getState(e.state)==null;if(!x||!M0e(u,x))if(y)x=u;else return;const v=new cl(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(MSe(e,m.target)!=n&&(y=Sde(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 O7e(e,t,s){if(!(e.state.selection instanceof ba))return null;const{$head:n}=e.state.selection;for(let a=n.depth-1;a>=0;a--){const o=n.node(a);if((s<0?n.index(a):n.indexAfter(a))!=(s<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){const l=n.before(a),i=t=="vert"?s>0?"down":"up":s>0?"right":"left";return e.endOfTextblock(i)?l:null}}return null}function MSe(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function Sde(e,t){const s=e.posAtCoords({left:t.clientX,top:t.clientY});if(!s)return null;const n=s.inside>=0?s.inside:s.pos;return z3(e.state.doc.resolve(n))}var Nwt=class{constructor(t,s){this.node=t,this.defaultCellMinWidth=s,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",`${s}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ppe(t,this.colgroup,this.table,s),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,ppe(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function ppe(e,t,s,n,a,o){let l=0,i=!0,u=t.firstChild;const m=e.firstChild;if(m){for(let y=0,v=0;ynew n(y,s,v)),new Cwt(-1,!1)},apply(l,i){return i.apply(l)}},props:{attributes:l=>{const i=um.getState(l);return i&&i.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,i)=>{Mwt(l,i,e,a)},mouseleave:l=>{Twt(l)},mousedown:(l,i)=>{Awt(l,i,t,s)}},decorations:l=>{const i=um.getState(l);if(i&&i.activeHandle>-1)return Owt(l,i.activeHandle)},nodeViews:{}}});return o}var Cwt=class Jee{constructor(t,s){this.activeHandle=t,this.dragging=s}apply(t){const s=this,n=t.getMeta(um);if(n&&n.setHandle!=null)return new Jee(n.setHandle,!1);if(n&&n.setDragging!==void 0)return new Jee(s.activeHandle,n.setDragging);if(s.activeHandle>-1&&t.docChanged){let a=t.mapping.map(s.activeHandle,-1);return hpe(t.doc.resolve(a))||(a=-1),new Jee(a,s.dragging)}return s}};function Mwt(e,t,s,n){if(!e.editable)return;const a=um.getState(e.state);if(a&&!a.dragging){const o=Iwt(t.target);let l=-1;if(o){const{left:i,right:u}=o.getBoundingClientRect();t.clientX-i<=s?l=TSe(e,t,"left",s):u-t.clientX<=s&&(l=TSe(e,t,"right",s))}if(l!=a.activeHandle){if(!n&&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}D7e(e,l)}}}function Twt(e){if(!e.editable)return;const t=um.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&D7e(e,-1)}function Awt(e,t,s,n){var a;if(!e.editable)return!1;const o=(a=e.dom.ownerDocument.defaultView)!==null&&a!==void 0?a:window,l=um.getState(e.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const i=e.state.doc.nodeAt(l.activeHandle),u=Ewt(e,l.activeHandle,i.attrs);e.dispatch(e.state.tr.setMeta(um,{setDragging:{startX:t.clientX,startWidth:u}}));function m(y){o.removeEventListener("mouseup",m),o.removeEventListener("mousemove",x);const v=um.getState(e.state);v!=null&&v.dragging&&(Pwt(e,v.activeHandle,ASe(v.dragging,y,s)),e.dispatch(e.state.tr.setMeta(um,{setDragging:null})))}function x(y){if(!y.which)return m(y);const v=um.getState(e.state);if(v&&v.dragging){const b=ASe(v.dragging,y,s);ESe(e,v.activeHandle,b,n)}}return ESe(e,l.activeHandle,u,n),o.addEventListener("mouseup",m),o.addEventListener("mousemove",x),t.preventDefault(),!0}function Ewt(e,t,{colspan:s,colwidth:n}){const a=n&&n[n.length-1];if(a)return a;const o=e.domAtPos(t);let l=o.node.childNodes[o.offset].offsetWidth,i=s;if(n)for(let u=0;u{const n=e.nodes[s];n.spec.tableRole&&(t[n.spec.tableRole]=n)}),e.cached.tableNodeTypes=t,t}function Bwt(e,t,s,n,a){const o=zwt(e),l=[],i=[];for(let m=0;m{const{selection:t}=e.state;if(!$wt(t))return!1;let s=0;const n=s7e(t.ranges[0].$from,o=>o.type.name==="table");return n==null||n.node.descendants(o=>{if(o.type.name==="table")return!1;["tableCell","tableHeader"].includes(o.type.name)&&(s+=1)}),s===t.ranges.length?(e.commands.deleteTable(),!0):!1},Uwt=Au.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:Rwt,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:e,HTMLAttributes:t}){const{colgroup:s,tableWidth:n,tableMinWidth:a}=Fwt(e,this.options.cellMinWidth),o=["table",Gl(this.options.HTMLAttributes,t,{style:n?`width: ${n}`:`min-width: ${a}`}),s,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},o]:o},addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:s=!0}={})=>({tr:n,dispatch:a,editor:o})=>{const l=Bwt(o.schema,e,t,s);if(a){const i=n.selection.from+1;n.replaceSelectionWith(l).scrollIntoView().setSelection(ba.near(n.doc.resolve(i)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>twt(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>rwt(e,t),deleteColumn:()=>({state:e,dispatch:t})=>nwt(e,t),addRowBefore:()=>({state:e,dispatch:t})=>iwt(e,t),addRowAfter:()=>({state:e,dispatch:t})=>owt(e,t),deleteRow:()=>({state:e,dispatch:t})=>cwt(e,t),deleteTable:()=>({state:e,dispatch:t})=>gwt(e,t),mergeCells:()=>({state:e,dispatch:t})=>bSe(e,t),splitCell:()=>({state:e,dispatch:t})=>wSe(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>tI("column")(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>tI("row")(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>pwt(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>bSe(e,t)?!0:wSe(e,t),setCellAttribute:(e,t)=>({state:s,dispatch:n})=>hwt(e,t)(s,n),goToNextCell:()=>({state:e,dispatch:t})=>kSe(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>kSe(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&I7e(e),!0),setCellSelection:e=>({tr:t,dispatch:s})=>{if(s){const n=cl.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}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:CO,"Mod-Backspace":CO,Delete:CO,"Mod-Delete":CO}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Swt({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Dwt({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(e){const t={name:e.name,options:e.options,storage:e.storage};return{tableRole:_i(An(e,"tableRole",t))}}}),qwt=Au.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:e}){return["tr",Gl(this.options.HTMLAttributes,e),0]}}),Vwt=Au.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(n=>parseInt(n,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:e}){return["td",Gl(this.options.HTMLAttributes,e),0]}}),Hwt=Au.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(n=>parseInt(n,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:e}){return["th",Gl(this.options.HTMLAttributes,e),0]}});function Wf({content:e,onChange:t,placeholder:s="Enter content...",minHeight:n="150px",compact:a=!1}){const[o,l]=A.useState(!1),[i,u]=A.useState(""),[m,x]=A.useState(!0),y=c7e({extensions:[f7e,N7e.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),S7e.configure({types:["heading","paragraph"]}),C7e,z2t.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}),Uwt.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}),qwt.extend({addAttributes(){var k;return{...(k=this.parent)==null?void 0:k.call(this),style:{default:null}}}}),Vwt.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}}}}),Hwt.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":s},handlePaste:(k,M)=>{var T;const E=(T=M.clipboardData)==null?void 0:T.items;if(!E)return!1;for(const P of Array.from(E))if(P.type.startsWith("image/")){M.preventDefault();const R=P.getAsFile();if(!R)continue;const D=new FileReader;return D.onload=U=>{var H;const q=(H=U.target)==null?void 0:H.result;k.dispatch(k.state.tr.replaceSelectionWith(k.state.schema.nodes.image.create({src:q})))},D.readAsDataURL(R),!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(uA,{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(hA,{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(NS,{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(ES,{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(fp,{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(LS,{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(jS,{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(wS,{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(kS,{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(zo,{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(zo,{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(US,{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(zS,{className:"h-4 w-4"})})]}),r.jsx(o7e,{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:n}})]}),r.jsx(Or,{open:o,onOpenChange:l,children:r.jsxs(Pr,{className:"sm:max-w-md",children:[r.jsx(zr,{children:r.jsx(Rr,{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(ot,{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(In,{id:"link-new-tab",checked:m,onCheckedChange:x}),r.jsx(ze,{htmlFor:"link-new-tab",children:"Open in new tab"})]})]}),r.jsxs(zn,{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 Wwt=Object.defineProperty,Gwt=(e,t,s)=>t in e?Wwt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Sl=(e,t,s)=>Gwt(e,typeof t!="symbol"?t+"":t,s);const Gre={x:0,y:0,width:0,height:0,unit:"px"},D4=(e,t,s)=>Math.min(Math.max(e,t),s),Kwt=(...e)=>e.filter(t=>t&&typeof t=="string").join(" "),LSe=(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 Zwt(e,t,s,n){const a=bg(e,s,n);return e.width&&(a.height=a.width/t),e.height&&(a.width=a.height*t),a.y+a.height>n&&(a.height=n-a.y,a.width=a.height*t),a.x+a.width>s&&(a.width=s-a.x,a.height=a.width/t),e.unit==="%"?s1(a,s,n):a}function Ywt(e,t,s){const n=bg(e,t,s);return n.x=(t-n.width)/2,n.y=(s-n.height)/2,e.unit==="%"?s1(n,t,s):n}function s1(e,t,s){return e.unit==="%"?{...Gre,...e,unit:"%"}:{unit:"%",x:e.x?e.x/t*100:0,y:e.y?e.y/s*100:0,width:e.width?e.width/t*100:0,height:e.height?e.height/s*100:0}}function bg(e,t,s){return e.unit?e.unit==="px"?{...Gre,...e,unit:"px"}:{unit:"px",x:e.x?e.x*t/100:0,y:e.y?e.y*s/100:0,width:e.width?e.width*t/100:0,height:e.height?e.height*s/100:0}:{...Gre,...e,unit:"px"}}function OSe(e,t,s,n,a,o=0,l=0,i=n,u=a){const m={...e};let x=Math.min(o,n),y=Math.min(l,a),v=Math.min(i,n),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=n-(m.x+m.width);N<0&&(m.x=Math.min(m.x,n-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&&((s==="sw"||s=="nw")&&(m.x-=v-m.width),m.width=v),m.height>b&&((s==="nw"||s=="ne")&&(m.y-=b-m.height),m.height=b),t){const M=m.width/m.height;if(Mt){const E=Math.max(m.height*t,x);(s==="sw"||s=="nw")&&(m.x-=E-m.width),m.width=E}}return m}function Xwt(e,t,s,n){const a={...e};return t==="ArrowLeft"?n==="nw"?(a.x-=s,a.y-=s,a.width+=s,a.height+=s):n==="w"?(a.x-=s,a.width+=s):n==="sw"?(a.x-=s,a.width+=s,a.height+=s):n==="ne"?(a.y+=s,a.width-=s,a.height-=s):n==="e"?a.width-=s:n==="se"&&(a.width-=s,a.height-=s):t==="ArrowRight"&&(n==="nw"?(a.x+=s,a.y+=s,a.width-=s,a.height-=s):n==="w"?(a.x+=s,a.width-=s):n==="sw"?(a.x+=s,a.width-=s,a.height-=s):n==="ne"?(a.y-=s,a.width+=s,a.height+=s):n==="e"?a.width+=s:n==="se"&&(a.width+=s,a.height+=s)),t==="ArrowUp"?n==="nw"?(a.x-=s,a.y-=s,a.width+=s,a.height+=s):n==="n"?(a.y-=s,a.height+=s):n==="ne"?(a.y-=s,a.width+=s,a.height+=s):n==="sw"?(a.x+=s,a.width-=s,a.height-=s):n==="s"?a.height-=s:n==="se"&&(a.width-=s,a.height-=s):t==="ArrowDown"&&(n==="nw"?(a.x+=s,a.y+=s,a.width-=s,a.height-=s):n==="n"?(a.y+=s,a.height-=s):n==="ne"?(a.y+=s,a.width-=s,a.height-=s):n==="sw"?(a.x-=s,a.width+=s,a.height+=s):n==="s"?a.height+=s:n==="se"&&(a.width+=s,a.height+=s)),a}const R4={capture:!0,passive:!1};let Qwt=0;const H0=class af extends A.PureComponent{constructor(){super(...arguments),Sl(this,"docMoveBound",!1),Sl(this,"mouseDownOnCrop",!1),Sl(this,"dragStarted",!1),Sl(this,"evData",{startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0}),Sl(this,"componentRef",A.createRef()),Sl(this,"mediaRef",A.createRef()),Sl(this,"resizeObserver"),Sl(this,"initChangeCalled",!1),Sl(this,"instanceId",`rc-${Qwt++}`),Sl(this,"state",{cropIsActive:!1,newCropIsBeingDrawn:!1}),Sl(this,"onCropPointerDown",t=>{const{crop:s,disabled:n}=this.props,a=this.getBox();if(!s)return;const o=bg(s,a.width,a.height);if(n)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})}),Sl(this,"onComponentPointerDown",t=>{const{crop:s,disabled:n,locked:a,keepSelection:o,onChange:l}=this.props,i=this.getBox();if(n||a||o&&s)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(bg(x,i.width,i.height),s1(x,i.width,i.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})}),Sl(this,"onDocPointerMove",t=>{const{crop:s,disabled:n,onChange:a,onDragStart:o}=this.props,l=this.getBox();if(n||!s||!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(),LSe(s,u)||a(bg(u,l.width,l.height),s1(u,l.width,l.height))}),Sl(this,"onComponentKeyDown",t=>{const{crop:s,disabled:n,onChange:a,onComplete:o}=this.props;if(n)return;const l=t.key;let i=!1;if(!s)return;const u=this.getBox(),m=this.makePixelCrop(u),x=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?af.nudgeStepLarge:t.shiftKey?af.nudgeStepMedium:af.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=D4(m.x,0,u.width-m.width),m.y=D4(m.y,0,u.height-m.height);const y=bg(m,u.width,u.height),v=s1(m,u.width,u.height);a(y,v),o&&o(y,v)}}),Sl(this,"onHandlerKeyDown",(t,s)=>{const{aspect:n=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)?af.nudgeStepLarge:t.shiftKey?af.nudgeStepMedium:af.nudgeStep,N=bg(a,v.width,v.height),k=Xwt(N,t.key,b,s),M=OSe(k,n,s,v.width,v.height,l,i,u,m);if(!LSe(a,M)){const E=s1(M,v.width,v.height);x(M,E),y&&y(M,E)}}),Sl(this,"onDocPointerDone",t=>{const{crop:s,disabled:n,onComplete:a,onDragEnd:o}=this.props,l=this.getBox();this.unbindDocMove(),!(n||!s)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,o&&o(t),a&&a(bg(s,l.width,l.height),s1(s,l.width,l.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))}),Sl(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:s,y:n,width:a,height:o}=t.getBoundingClientRect();return{x:s,y:n,width:a,height:o}}componentDidUpdate(t){const{crop:s,onComplete:n}=this.props;if(n&&!t.crop&&s){const{width:a,height:o}=this.getBox();a&&o&&n(bg(s,a,o),s1(s,a,o))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,R4),this.document.addEventListener("pointerup",this.onDocPointerDone,R4),this.document.addEventListener("pointercancel",this.onDocPointerDone,R4),this.docMoveBound=!0)}unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,R4),this.document.removeEventListener("pointerup",this.onDocPointerDone,R4),this.document.removeEventListener("pointercancel",this.onDocPointerDone,R4),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,s=this.getBox(),n=this.makePixelCrop(s),a=t.clientX-t.startClientX,o=t.clientY-t.startClientY;return n.x=D4(t.startCropX+a,0,s.width-n.width),n.y=D4(t.startCropY+o,0,s.height-n.height),n}getPointRegion(t,s,n,a){const{evData:o}=this,l=o.clientX-t.x,i=o.clientY-t.y;let u;a&&s?u=s==="nw"||s==="n"||s==="ne":u=i1?o?[o,o/s]:[l*s,l]:l?[l*s,l]:[o,o/s]}resizeCrop(){const{evData:t}=this,{aspect:s=0,maxWidth:n,maxHeight:a}=this.props,o=this.getBox(),[l,i]=this.resolveMinDimensions(o,s,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,s?(b.height=b.width/s,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,s?b.height=b.width/s:b.height=v):m==="sw"?(b.x=t.startCropX+y,b.y=t.startCropY,b.width=Math.abs(y),s?b.height=b.width/s:b.height=v):m==="nw"&&(b.x=t.startCropX+y,b.width=Math.abs(y),s?(b.height=b.width/s,b.y=t.startCropY-b.height):(b.height=Math.abs(v),b.y=t.startCropY+v));const N=OSe(b,s,m,o.width,o.height,l,i,n,a);return s||af.xyOrds.indexOf(x)>-1?u=N:af.xOrds.indexOf(x)>-1?(u.x=N.x,u.width=N.width):af.yOrds.indexOf(x)>-1&&(u.y=N.y,u.height=N.height),u.x=D4(u.x,0,o.width-u.width),u.y=D4(u.y,0,o.height-u.height),u}renderCropSelection(){const{ariaLabels:t=af.defaultProps.ariaLabels,disabled:s,locked:n,renderSelectionAddon:a,ruleOfThirds:o,crop:l}=this.props,i=this.getCropStyle();if(l)return ut.createElement("div",{style:i,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":t.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!s&&!n&&ut.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},ut.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),ut.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),ut.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),ut.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),ut.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"}),ut.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"}),ut.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"}),ut.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"}),ut.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"}),ut.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"}),ut.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"}),ut.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&&ut.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:u=>u.stopPropagation()},a(this.state)),o&&ut.createElement(ut.Fragment,null,ut.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),ut.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(t){const s={...Gre,...this.props.crop||{}};return bg(s,t.width,t.height)}render(){const{aspect:t,children:s,circularCrop:n,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=Kwt("ReactCrop",a,x&&"ReactCrop--active",l&&"ReactCrop--disabled",i&&"ReactCrop--locked",y&&"ReactCrop--new-crop",o&&t&&"ReactCrop--fixed-aspect",o&&n&&"ReactCrop--circular-crop",o&&m&&"ReactCrop--rule-of-thirds",!this.dragStarted&&o&&!o.width&&!o.height&&"ReactCrop--invisible-crop",n&&"ReactCrop--no-animate");return ut.createElement("div",{ref:this.componentRef,className:b,style:u},ut.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},s),o?ut.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},ut.createElement("defs",null,ut.createElement("mask",{id:`hole-${this.instanceId}`},ut.createElement("rect",{width:"100%",height:"100%",fill:"white"}),n?ut.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"}):ut.createElement("rect",{x:`${o.x}${o.unit}`,y:`${o.y}${o.unit}`,width:`${o.width}${o.unit}`,height:`${o.height}${o.unit}`,fill:"black"}))),ut.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,v)}};Sl(H0,"xOrds",["e","w"]),Sl(H0,"yOrds",["n","s"]),Sl(H0,"xyOrds",["nw","ne","se","sw"]),Sl(H0,"nudgeStep",1),Sl(H0,"nudgeStepMedium",10),Sl(H0,"nudgeStepLarge",100),Sl(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 Jwt=H0;var R7e=["PageUp","PageDown"],F7e=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],z7e={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},B3="Slider",[gpe,ejt,tjt]=YI(B3),[B7e]=uc(B3,[tjt]),[rjt,Eae]=B7e(B3),$7e=A.forwardRef((e,t)=>{const{name:s,min:n=0,max:a=100,step:o=1,orientation:l="horizontal",disabled:i=!1,minStepsBetweenThumbs:u=0,defaultValue:m=[n],value:x,onValueChange:y=()=>{},onValueCommit:v=()=>{},inverted:b=!1,form:N,...k}=e,M=A.useRef(new Set),E=A.useRef(0),P=l==="horizontal"?sjt:njt,[R=[],D]=ah({prop:x,defaultProp:m,onChange:ne=>{var he;(he=[...M.current][E.current])==null||he.focus(),y(ne)}}),U=A.useRef(R);function q(ne){const ie=cjt(R,ne);Q(ne,ie)}function H(ne){Q(ne,E.current)}function G(){const ne=U.current[E.current];R[E.current]!==ne&&v(R)}function Q(ne,ie,{commit:he}={commit:!1}){const se=mjt(o),fe=pjt(Math.round((ne-n)/o)*o+n,se),oe=zE(fe,[n,a]);D((ce=[])=>{const de=ojt(ce,oe,ie);if(hjt(de,u*o)){E.current=de.indexOf(oe);const xe=String(de)!==String(ce);return xe&&he&&v(de),xe?de:ce}else return ce})}return r.jsx(rjt,{scope:e.__scopeSlider,name:s,disabled:i,min:n,max:a,valueIndexToChangeRef:E,thumbs:M.current,values:R,orientation:l,form:N,children:r.jsx(gpe.Provider,{scope:e.__scopeSlider,children:r.jsx(gpe.Slot,{scope:e.__scopeSlider,children:r.jsx(P,{"aria-disabled":i,"data-disabled":i?"":void 0,...k,ref:t,onPointerDown:xs(k.onPointerDown,()=>{i||(U.current=R)}),min:n,max:a,inverted:b,onSlideStart:i?void 0:q,onSlideMove:i?void 0:H,onSlideEnd:i?void 0:G,onHomeKeyDown:()=>!i&&Q(n,0,{commit:!0}),onEndKeyDown:()=>!i&&Q(a,R.length-1,{commit:!0}),onStepKeyDown:({event:ne,direction:ie})=>{if(!i){const fe=R7e.includes(ne.key)||ne.shiftKey&&F7e.includes(ne.key)?10:1,oe=E.current,ce=R[oe],de=o*fe*ie;Q(ce+de,oe,{commit:!0})}}})})})})});$7e.displayName=B3;var[U7e,q7e]=B7e(B3,{startEdge:"left",endEdge:"right",size:"width",direction:1}),sjt=A.forwardRef((e,t)=>{const{min:s,max:n,dir:a,inverted:o,onSlideStart:l,onSlideMove:i,onSlideEnd:u,onStepKeyDown:m,...x}=e,[y,v]=A.useState(null),b=ha(t,P=>v(P)),N=A.useRef(void 0),k=Ik(a),M=k==="ltr",E=M&&!o||!M&&o;function T(P){const R=N.current||y.getBoundingClientRect(),D=[0,R.width],q=T0e(D,E?[s,n]:[n,s]);return N.current=R,q(P-R.left)}return r.jsx(U7e,{scope:e.__scopeSlider,startEdge:E?"left":"right",endEdge:E?"right":"left",direction:E?1:-1,size:"width",children:r.jsx(V7e,{dir:k,"data-orientation":"horizontal",...x,ref:b,style:{...x.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:P=>{const R=T(P.clientX);l==null||l(R)},onSlideMove:P=>{const R=T(P.clientX);i==null||i(R)},onSlideEnd:()=>{N.current=void 0,u==null||u()},onStepKeyDown:P=>{const D=z7e[E?"from-left":"from-right"].includes(P.key);m==null||m({event:P,direction:D?-1:1})}})})}),njt=A.forwardRef((e,t)=>{const{min:s,max:n,inverted:a,onSlideStart:o,onSlideMove:l,onSlideEnd:i,onStepKeyDown:u,...m}=e,x=A.useRef(null),y=ha(t,x),v=A.useRef(void 0),b=!a;function N(k){const M=v.current||x.current.getBoundingClientRect(),E=[0,M.height],P=T0e(E,b?[n,s]:[s,n]);return v.current=M,P(k-M.top)}return r.jsx(U7e,{scope:e.__scopeSlider,startEdge:b?"bottom":"top",endEdge:b?"top":"bottom",size:"height",direction:b?1:-1,children:r.jsx(V7e,{"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 E=z7e[b?"from-bottom":"from-top"].includes(k.key);u==null||u({event:k,direction:E?-1:1})}})})}),V7e=A.forwardRef((e,t)=>{const{__scopeSlider:s,onSlideStart:n,onSlideMove:a,onSlideEnd:o,onHomeKeyDown:l,onEndKeyDown:i,onStepKeyDown:u,...m}=e,x=Eae(B3,s);return r.jsx($s.span,{...m,ref:t,onKeyDown:xs(e.onKeyDown,y=>{y.key==="Home"?(l(y),y.preventDefault()):y.key==="End"?(i(y),y.preventDefault()):R7e.concat(F7e).includes(y.key)&&(u(y),y.preventDefault())}),onPointerDown:xs(e.onPointerDown,y=>{const v=y.target;v.setPointerCapture(y.pointerId),y.preventDefault(),x.thumbs.has(v)?v.focus():n(y)}),onPointerMove:xs(e.onPointerMove,y=>{y.target.hasPointerCapture(y.pointerId)&&a(y)}),onPointerUp:xs(e.onPointerUp,y=>{const v=y.target;v.hasPointerCapture(y.pointerId)&&(v.releasePointerCapture(y.pointerId),o(y))})})}),H7e="SliderTrack",W7e=A.forwardRef((e,t)=>{const{__scopeSlider:s,...n}=e,a=Eae(H7e,s);return r.jsx($s.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...n,ref:t})});W7e.displayName=H7e;var xpe="SliderRange",G7e=A.forwardRef((e,t)=>{const{__scopeSlider:s,...n}=e,a=Eae(xpe,s),o=q7e(xpe,s),l=A.useRef(null),i=ha(t,l),u=a.values.length,m=a.values.map(v=>Y7e(v,a.min,a.max)),x=u>1?Math.min(...m):0,y=100-Math.max(...m);return r.jsx($s.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...n,ref:i,style:{...e.style,[o.startEdge]:x+"%",[o.endEdge]:y+"%"}})});G7e.displayName=xpe;var ype="SliderThumb",K7e=A.forwardRef((e,t)=>{const s=ejt(e.__scopeSlider),[n,a]=A.useState(null),o=ha(t,i=>a(i)),l=A.useMemo(()=>n?s().findIndex(i=>i.ref.current===n):-1,[s,n]);return r.jsx(ajt,{...e,ref:o,index:l})}),ajt=A.forwardRef((e,t)=>{const{__scopeSlider:s,index:n,name:a,...o}=e,l=Eae(ype,s),i=q7e(ype,s),[u,m]=A.useState(null),x=ha(t,T=>m(T)),y=u?l.form||!!u.closest("form"):!0,v=JI(u),b=l.values[n],N=b===void 0?0:Y7e(b,l.min,l.max),k=ljt(n,l.values.length),M=v==null?void 0:v[i.size],E=M?djt(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}% + ${E}px)`},children:[r.jsx(gpe.ItemSlot,{scope:e.__scopeSlider,children:r.jsx($s.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:xs(e.onFocus,()=>{l.valueIndexToChangeRef.current=n})})}),y&&r.jsx(Z7e,{name:a??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:b},n)]})});K7e.displayName=ype;var ijt="RadioBubbleInput",Z7e=A.forwardRef(({__scopeSlider:e,value:t,...s},n)=>{const a=A.useRef(null),o=ha(a,n),l=hP(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($s.input,{style:{display:"none"},...s,ref:o,defaultValue:t})});Z7e.displayName=ijt;function ojt(e=[],t,s){const n=[...e];return n[s]=t,n.sort((a,o)=>a-o)}function Y7e(e,t,s){const o=100/(s-t)*(e-t);return zE(o,[0,100])}function ljt(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function cjt(e,t){if(e.length===1)return 0;const s=e.map(a=>Math.abs(a-t)),n=Math.min(...s);return s.indexOf(n)}function djt(e,t,s){const n=e/2,o=T0e([0,50],[0,n]);return(n-o(t)*s)*s}function ujt(e){return e.slice(0,-1).map((t,s)=>e[s+1]-t)}function hjt(e,t){if(t>0){const s=ujt(e);return Math.min(...s)>=t}return!0}function T0e(e,t){return s=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(s-e[0])}}function mjt(e){return(String(e).split(".")[1]||"").length}function pjt(e,t){const s=Math.pow(10,t);return Math.round(e*s)/s}var X7e=$7e,fjt=W7e,gjt=G7e,xjt=K7e;const Sf=A.forwardRef(({className:e,...t},s)=>r.jsxs(X7e,{ref:s,className:Ut("relative flex w-full touch-none select-none items-center",e),...t,children:[r.jsx(fjt,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:r.jsx(gjt,{className:"absolute h-full bg-primary"})}),r.jsx(xjt,{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"})]}));Sf.displayName=X7e.displayName;function yjt(e,t,s){return Ywt(Zwt({unit:"%",width:90},s,e,t),e,t)}const A0e=({open:e,onClose:t,imageSrc:s,onCropComplete:n,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(E=>{const{width:T,height:P}=E.currentTarget;i(yjt(T,P,a))},[a]),k=A.useCallback(async()=>{const E=o.current;if(!E||!u)return;const T=document.createElement("canvas"),P=T.getContext("2d");if(!P)return;const R=E.naturalWidth/E.width,D=E.naturalHeight/E.height,U=400;T.width=U,T.height=U,P.imageSmoothingQuality="high";const q=u.x*R,H=u.y*D,G=u.width*R,Q=u.height*D,ne=v*Math.PI/180,ie=T.width/2,he=T.height/2;return P.save(),P.translate(ie,he),P.rotate(ne),P.scale(x,x),P.translate(-ie,-he),P.drawImage(E,q,H,G,Q,0,0,U,U),P.restore(),new Promise((se,fe)=>{T.toBlob(oe=>{oe?se(oe):fe(new Error("Canvas is empty"))},"image/jpeg",.95)})},[u,x,v]),M=async()=>{try{const E=await k();E&&(n(E),t())}catch(E){console.error("Error cropping image:",E)}};return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Pr,{className:"max-w-lg",children:[r.jsx(zr,{children:r.jsx(Rr,{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(Jwt,{crop:l,onChange:(E,T)=>i(T),onComplete:E=>m(E),aspect:a,circularCrop:!0,className:"max-h-[400px]",children:r.jsx("img",{ref:o,src:s,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(VS,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Sf,{value:[x],min:.5,max:3,step:.1,onValueChange:([E])=>y(E),className:"flex-1"}),r.jsx(qS,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(CA,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Sf,{value:[v],min:-180,max:180,step:1,onValueChange:([E])=>b(E),className:"flex-1"}),r.jsxs("span",{className:"text-sm text-muted-foreground w-12",children:[v,"°"]})]})]})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:t,children:"Cancel"}),r.jsx(X,{onClick:M,children:"Save Photo"})]})]})})},vjt=()=>{const{user:e}=Yr(),{toast:t}=ci(),[s,n]=A.useState(!1),[a,o]=A.useState(!1),[l,i]=A.useState(null);A.useEffect(()=>{e&&u()},[e]);const u=async()=>{n(!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{n(!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 s?r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(mp,{className:"h-5 w-5"}),"Subscription"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(Vr,{className:"h-6 w-6 animate-spin text-muted-foreground"})})})]}):r.jsxs(He,{children:[r.jsxs(Vt,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(mp,{className:"h-5 w-5"}),"Subscription"]}),r.jsx(Ns,{children:"Manage your subscription and billing"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Status"}),r.jsx("div",{className:"mt-1",children:x()})]}),(l==null?void 0:l.endDate)&&l.status==="active"&&r.jsxs("div",{className:"text-right",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Next billing date"}),r.jsx("p",{className:"font-medium",children:new Date(l.endDate).toLocaleDateString()})]})]}),l!=null&&l.isGrandfathered?r.jsx("p",{className:"text-sm text-muted-foreground",children:"Your account was upgraded from LevelUp 1.0. To update/manage your subscription please reach out to support."}):(l==null?void 0:l.status)==="active"||(l==null?void 0:l.status)==="trialing"?r.jsxs(r.Fragment,{children:[(l==null?void 0:l.status)==="trialing"&&(l==null?void 0:l.endDate)&&r.jsxs("p",{className:"text-sm text-muted-foreground mb-3",children:["Your trial ends on ",new Date(l.endDate).toLocaleDateString(),". After the trial, you'll be charged automatically."]}),r.jsxs(X,{onClick:m,variant:"outline",disabled:a,children:[a?r.jsx(Vr,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(Sn,{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."})]})]})},_jt=()=>{const{user:e}=Yr(),t=Hs(),{toast:s}=ci(),[n]=Ic(),a=n.get("setup")==="true",o=n.get("reset")==="true",{isSupported:l,isSubscribed:i,isLoading:u,subscribe:m,unsubscribe:x}=gRe(),[y,v]=A.useState(!1),[b,N]=A.useState(""),[k,M]=A.useState(!1),[E,T]=A.useState(!1),[P,R]=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}),[q,H]=A.useState(!1),[G,Q]=A.useState(!1),[ne,ie]=A.useState({newPassword:"",confirmPassword:""});A.useEffect(()=>{e&&he()},[e]),A.useEffect(()=>{o&&e&&setTimeout(()=>{var de;(de=document.getElementById("change-password-section"))==null||de.scrollIntoView({behavior:"smooth",block:"center"})},500)},[o,e]);const he=async()=>{var de,xe,Me;if(!(e!=null&&e.id)){console.log("No user ID available yet");return}try{console.log("Loading profile for user:",e.id);const{data:ve,error:be}=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(be)throw console.error("Profile query error:",be),be;ve?(console.log("Profile loaded successfully:",ve),U({name:ve.name||"",email:ve.email||"",title:ve.title||"",bio:ve.bio||"",areas_served:ve.areas_served||"",years_experience:((de=ve.years_experience)==null?void 0:de.toString())||"",instagram_url:ve.instagram_url||"",facebook_url:ve.facebook_url||"",linkedin_url:ve.linkedin_url||"",email_signature:ve.email_signature||"",use_email_signature:ve.use_email_signature||!1}),H(ve.digest_opt_out||!1)):(console.warn("No profile found for user"),U({name:((xe=e.user_metadata)==null?void 0:xe.name)||((Me=e.email)==null?void 0:Me.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:we}=await Y.storage.from("avatars").list(`${e.id}`);if(we&&we.length>0){const{data:tt}=Y.storage.from("avatars").getPublicUrl(`${e.id}/${we[0].name}`);N(tt.publicUrl)}}catch(ve){console.error("Error loading profile:",ve),s({title:"Error",description:ve.message||"Failed to load profile",variant:"destructive"})}},se=de=>{var ve;const xe=(ve=de.target.files)==null?void 0:ve[0];if(!xe)return;const Me=new FileReader;Me.onloadend=()=>{R(Me.result),T(!0)},Me.readAsDataURL(xe),de.target.value=""},fe=async de=>{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(tt=>`${e.id}/${tt.name}`));const ve=`${e.id}/avatar.jpg`,{error:be}=await Y.storage.from("avatars").upload(ve,de,{upsert:!0,contentType:"image/jpeg"});if(be)throw be;const{data:we}=Y.storage.from("avatars").getPublicUrl(ve);N(`${we.publicUrl}?t=${Date.now()}`),s({title:"Success",description:"Profile photo updated successfully"})}catch(xe){console.error("Error uploading avatar:",xe),s({title:"Error",description:xe.message||"Failed to upload photo",variant:"destructive"})}finally{M(!1)}}},oe=async()=>{if(!D.name.trim()||!D.email.trim()){s({title:"Error",description:"Name and email are required",variant:"destructive"});return}v(!0);try{const{error:de}=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(de)throw de;s({title:"Success",description:"Profile updated successfully"})}catch(de){console.error("Error updating profile:",de),s({title:"Error",description:de.message||"Failed to update profile",variant:"destructive"})}finally{v(!1)}},ce=async()=>{if(!ne.newPassword){s({title:"Error",description:"Please enter a new password",variant:"destructive"});return}if(ne.newPassword.length<6){s({title:"Error",description:"Password must be at least 6 characters",variant:"destructive"});return}if(ne.newPassword!==ne.confirmPassword){s({title:"Error",description:"Passwords do not match",variant:"destructive"});return}v(!0);try{const{error:de}=await Y.auth.updateUser({password:ne.newPassword});if(de)throw de;s({title:"Success",description:"Password updated successfully"}),ie({newPassword:"",confirmPassword:""}),a&&setTimeout(()=>t("/dashboard"),1e3)}catch(de){console.error("Error updating password:",de),s({title:"Error",description:de.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 de;(de=document.getElementById("change-password-section"))==null||de.scrollIntoView({behavior:"smooth",block:"center"})},className:"gap-2",children:[r.jsx(zj,{className:"h-4 w-4"}),"Change Password"]})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(He,{children:[r.jsxs(Vt,{children:[r.jsx(Gt,{children:"Profile Photo"}),r.jsx(Ns,{children:"Upload a professional photo for your profile"})]}),r.jsxs(Xe,{className:"flex items-center gap-6",children:[r.jsxs(Xn,{className:"h-24 w-24",children:[r.jsx(ji,{src:b}),r.jsx(Qn,{className:"text-2xl",children:D.name.split(" ").map(de=>de[0]).join("").toUpperCase()||"U"})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("input",{type:"file",id:"avatar-upload",accept:"image/*",className:"hidden",onChange:se,disabled:k}),r.jsxs(X,{variant:"outline",onClick:()=>{var de;return(de=document.getElementById("avatar-upload"))==null?void 0:de.click()},disabled:k,children:[r.jsx(so,{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(Vt,{children:[r.jsx(Gt,{children:"Personal Information"}),r.jsx(Ns,{children:"Update your profile details"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"name",children:"Name"}),r.jsx(ot,{id:"name",value:D.name,onChange:de=>U({...D,name:de.target.value}),maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"email",children:"Email"}),r.jsx(ot,{id:"email",type:"email",value:D.email,onChange:de=>U({...D,email:de.target.value}),maxLength:255})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"title",children:"Job Title"}),r.jsx(ot,{id:"title",value:D.title,onChange:de=>U({...D,title:de.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(Ys,{id:"bio",value:D.bio,onChange:de=>U({...D,bio:de.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(ot,{id:"areas_served",value:D.areas_served,onChange:de=>U({...D,areas_served:de.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(ot,{id:"years_experience",type:"number",min:"0",value:D.years_experience,onChange:de=>U({...D,years_experience:de.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(ot,{value:D.linkedin_url,onChange:de=>U({...D,linkedin_url:de.target.value}),placeholder:"LinkedIn URL"}),r.jsx(ot,{value:D.instagram_url,onChange:de=>U({...D,instagram_url:de.target.value}),placeholder:"Instagram URL"}),r.jsx(ot,{value:D.facebook_url,onChange:de=>U({...D,facebook_url:de.target.value}),placeholder:"Facebook URL"})]})]}),r.jsxs(X,{onClick:oe,disabled:y,children:[r.jsx(Lf,{className:"mr-2 h-4 w-4"}),"Save Changes"]})]})]}),r.jsxs(He,{children:[r.jsxs(Vt,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Z0,{className:"h-5 w-5"}),"Email Signature"]}),r.jsx(Ns,{children:"Add a signature that will be appended to emails sent via Gmail"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"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(In,{checked:D.use_email_signature,onCheckedChange:de=>U({...D,use_email_signature:de})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Signature"}),r.jsx(Wf,{content:D.email_signature,onChange:de=>U({...D,email_signature:de}),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:oe,disabled:y,children:[r.jsx(Lf,{className:"mr-2 h-4 w-4"}),"Save Signature"]})]})]}),r.jsxs(He,{id:"change-password-section",children:[r.jsxs(Vt,{children:[r.jsx(Gt,{children:a?"Set Your Password":"Change Password"}),r.jsx(Ns,{children:a?"Create a secure password for your account":"Update your password to keep your account secure"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"newPassword",children:"New Password"}),r.jsx(ot,{id:"newPassword",type:"password",value:ne.newPassword,onChange:de=>ie({...ne,newPassword:de.target.value}),placeholder:"Min 6 characters"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"confirmPassword",children:"Confirm Password"}),r.jsx(ot,{id:"confirmPassword",type:"password",value:ne.confirmPassword,onChange:de=>ie({...ne,confirmPassword:de.target.value}),placeholder:"Re-enter your new password"})]}),r.jsxs(X,{onClick:ce,disabled:y,children:[r.jsx(Lf,{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(Vt,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[i?r.jsx(Rg,{className:"h-5 w-5"}):r.jsx(Ej,{className:"h-5 w-5"}),"Push Notifications"]}),r.jsx(Ns,{children:"Receive browser notifications when new content is added"})]}),r.jsx(Xe,{children:l?r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children: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(In,{checked:i,onCheckedChange:de=>{de?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(Vt,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[q?r.jsx(pA,{className:"h-5 w-5"}):r.jsx(Nn,{className:"h-5 w-5"}),"Email Preferences"]}),r.jsx(Ns,{children:"Manage your email subscription settings"})]}),r.jsx(Xe,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Weekly Digest"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:q?"You won't receive weekly digest emails":"Receive a weekly summary of new content, events, and your progress"})]}),r.jsx(In,{checked:!q,onCheckedChange:async de=>{Q(!0);try{const{error:xe}=await Y.from("profiles").update({digest_opt_out:!de}).eq("id",e==null?void 0:e.id);if(xe)throw xe;H(!de),s({title:de?"Subscribed":"Unsubscribed",description:de?"You will now receive weekly digest emails":"You will no longer receive weekly digest emails"})}catch(xe){s({title:"Error",description:xe.message||"Failed to update preference",variant:"destructive"})}finally{Q(!1)}},disabled:G})]})})]}),r.jsx(Xxt,{}),r.jsx(vjt,{})]}),r.jsx(A0e,{open:E,onClose:()=>T(!1),imageSrc:P,onCropComplete:fe,aspectRatio:1})]})})};var bjt="AspectRatio",Q7e=A.forwardRef((e,t)=>{const{ratio:s=1/1,style:n,...a}=e;return r.jsx("div",{style:{position:"relative",width:"100%",paddingBottom:`${100/s}%`},"data-radix-aspect-ratio-wrapper":"",children:r.jsx($s.div,{...a,ref:t,style:{...n,position:"absolute",top:0,right:0,bottom:0,left:0}})})});Q7e.displayName=bjt;var wjt=Q7e;const jjt=wjt;function kjt(){const{user:e}=Yr(),t=Br(),[s,n]=A.useState(!1),[a,o]=A.useState(!1),{data:l,isLoading:i}=Kt({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]}),Te.success("Calendar subscription URL generated!")},onError:N=>{Te.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),n(!0),Te.success("Calendar URL copied to clipboard!"),setTimeout(()=>n(!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(vo,{asChild:!0,children:r.jsxs(X,{variant:"outline",className:"gap-2",children:[r.jsx(jn,{className:"h-4 w-4"}),"Subscribe to Calendar"]})}),r.jsxs(Pr,{className:"sm:max-w-md",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{className:"flex items-center gap-2",children:[r.jsx(jn,{className:"h-5 w-5 text-primary"}),"Subscribe to Events Calendar"]}),r.jsx(Zs,{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(Vr,{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(ot,{value:m,readOnly:!0,className:"text-xs font-mono"}),r.jsx(X,{variant:"outline",size:"icon",onClick:x,children:s?r.jsx(fi,{className:"h-4 w-4 text-green-500"}):r.jsx(Mo,{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(Sn,{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(Sn,{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(Sn,{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(Vr,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating..."]}):r.jsxs(r.Fragment,{children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Generate Calendar URL"]})})]})})]})]})}var Iae="Tabs",[Njt]=uc(Iae,[L3]),J7e=L3(),[Sjt,E0e]=Njt(Iae),e9e=A.forwardRef((e,t)=>{const{__scopeTabs:s,value:n,onValueChange:a,defaultValue:o,orientation:l="horizontal",dir:i,activationMode:u="automatic",...m}=e,x=Ik(i),[y,v]=ah({prop:n,onChange:a,defaultProp:o??"",caller:Iae});return r.jsx(Sjt,{scope:s,baseId:yd(),value:y,onValueChange:v,orientation:l,dir:x,activationMode:u,children:r.jsx($s.div,{dir:x,"data-orientation":l,...m,ref:t})})});e9e.displayName=Iae;var t9e="TabsList",r9e=A.forwardRef((e,t)=>{const{__scopeTabs:s,loop:n=!0,...a}=e,o=E0e(t9e,s),l=J7e(s);return r.jsx($xe,{asChild:!0,...l,orientation:o.orientation,dir:o.dir,loop:n,children:r.jsx($s.div,{role:"tablist","aria-orientation":o.orientation,...a,ref:t})})});r9e.displayName=t9e;var s9e="TabsTrigger",n9e=A.forwardRef((e,t)=>{const{__scopeTabs:s,value:n,disabled:a=!1,...o}=e,l=E0e(s9e,s),i=J7e(s),u=o9e(l.baseId,n),m=l9e(l.baseId,n),x=n===l.value;return r.jsx(Uxe,{asChild:!0,...i,focusable:!a,active:x,children:r.jsx($s.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:xs(e.onMouseDown,y=>{!a&&y.button===0&&y.ctrlKey===!1?l.onValueChange(n):y.preventDefault()}),onKeyDown:xs(e.onKeyDown,y=>{[" ","Enter"].includes(y.key)&&l.onValueChange(n)}),onFocus:xs(e.onFocus,()=>{const y=l.activationMode!=="manual";!x&&!a&&y&&l.onValueChange(n)})})})});n9e.displayName=s9e;var a9e="TabsContent",i9e=A.forwardRef((e,t)=>{const{__scopeTabs:s,value:n,forceMount:a,children:o,...l}=e,i=E0e(a9e,s),u=o9e(i.baseId,n),m=l9e(i.baseId,n),x=n===i.value,y=A.useRef(x);return A.useEffect(()=>{const v=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(v)},[]),r.jsx(Ec,{present:a||x,children:({present:v})=>r.jsx($s.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})})});i9e.displayName=a9e;function o9e(e,t){return`${e}-trigger-${t}`}function l9e(e,t){return`${e}-content-${t}`}var Cjt=e9e,c9e=r9e,d9e=n9e,u9e=i9e;const Si=Cjt,ki=A.forwardRef(({className:e,...t},s)=>r.jsx(c9e,{ref:s,className:Ut("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));ki.displayName=c9e.displayName;const is=A.forwardRef(({className:e,...t},s)=>r.jsx(d9e,{ref:s,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}));is.displayName=d9e.displayName;const Ss=A.forwardRef(({className:e,...t},s)=>r.jsx(u9e,{ref:s,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}));Ss.displayName=u9e.displayName;const Mjt={first_timer:Mn,regular:py,dedicated:$l,veteran:lo,streak_master:gm,century:lo},Tjt={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 DSe(e){return e===1?r.jsx(lo,{className:"h-5 w-5 text-yellow-500"}):e===2?r.jsx(py,{className:"h-5 w-5 text-gray-400"}):e===3?r.jsx($l,{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 h9e({showUserStats:e=!0,compact:t=!1,brokerageId:s,title:n="Event Leaderboard"}){const{user:a}=Yr(),{data:o,isLoading:l}=BRe(t?5:10,s),{data:i}=$Re(a==null?void 0:a.id),{data:u}=qRe(a==null?void 0:a.id),{data:m}=URe(a==null?void 0:a.id);return l?r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(lo,{className:"h-5 w-5 text-yellow-500"}),n]})}),r.jsx(Xe,{children:r.jsx("div",{className:"space-y-3",children:[...Array(5)].map((x,y)=>r.jsx(Cr,{className:"h-12 w-full"},y))})})]}):r.jsxs(He,{children:[r.jsx(Vt,{className:"pb-3",children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(lo,{className:"h-5 w-5 text-yellow-500"}),n]})}),r.jsxs(Xe,{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(gm,{className:"h-4 w-4 text-orange-500"}),r.jsx("div",{className:"text-lg font-bold",children:i.current_streak}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Streak"})]})]}),m&&m.length>0&&r.jsxs("div",{className:"mt-3 flex flex-wrap gap-1",children:[m.slice(0,4).map(x=>{const y=Mjt[x.badge_type]||Mn;return r.jsxs(Tt,{variant:"outline",className:`text-xs ${Tjt[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(Si,{defaultValue:"points",className:"w-full",children:[r.jsxs(ki,{className:"w-full mb-3",children:[r.jsx(is,{value:"points",className:"flex-1",children:"By Points"}),r.jsx(is,{value:"events",className:"flex-1",children:"By Events"})]}),r.jsx(Ss,{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:DSe(y+1)}),r.jsx(Xn,{className:"h-8 w-8",children:r.jsx(Qn,{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(Ss,{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:DSe(y+1)}),r.jsx(Xn,{className:"h-8 w-8",children:r.jsx(Qn,{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 Ajt(){const e=Hs(),{user:t,isAdmin:s}=Yr(),n=Br(),{data:a,isLoading:o}=Kt({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}=Kt({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}=Kt({queryKey:["event-registration-counts"],queryFn:async()=>{const{data:k,error:M}=await Y.from("event_registrations").select("event_id");if(M)throw M;const E={};return k.forEach(T=>{E[T.event_id]=(E[T.event_id]||0)+1}),E}}),u=ar({mutationFn:async k=>{const{data:M,error:E}=await Y.functions.invoke("zoom-register",{body:{event_id:k}});if(E)throw E;if(M!=null&&M.error)throw new Error(M.error);return M},onSuccess:k=>{n.invalidateQueries({queryKey:["my-registrations"]}),n.invalidateQueries({queryKey:["event-registration-counts"]}),k!=null&&k.join_url?Te.success("Successfully registered! You'll receive a Zoom confirmation email."):Te.success("Successfully registered for the event!")},onError:k=>{Te.error("Failed to register: "+k.message)}}),m=ar({mutationFn:async k=>{const{data:M,error:E}=await Y.functions.invoke("zoom-unregister",{body:{event_id:k}});if(E)throw E;if(M!=null&&M.error)throw new Error(M.error);return M},onSuccess:()=>{n.invalidateQueries({queryKey:["my-registrations"]}),n.invalidateQueries({queryKey:["event-registration-counts"]}),Te.success("Registration cancelled and removed from Zoom")},onError:k=>{Te.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(E=>E.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=>tC(k.event_date)!=="ended"))||[],N=(a==null?void 0:a.filter(k=>tC(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(kjt,{}),s&&r.jsx(X,{variant:"outline",onClick:()=>e("/admin/events"),children:"Manage Events"})]})]}),r.jsxs("div",{className:`grid grid-cols-1 ${s?"lg:grid-cols-3":""} gap-6`,children:[r.jsxs("div",{className:s?"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(Xe,{children:r.jsx("p",{className:"text-muted-foreground",children:"No upcoming events at the moment. Check back soon!"})})}):r.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:b.map(k=>{const M=tC(k.event_date),E=Oye(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:[E&&r.jsxs("div",{className:`${T?"bg-red-500":"bg-amber-500"} text-white px-3 py-1.5 flex items-center gap-2 text-sm font-medium`,children:[r.jsxs("span",{className:"relative flex h-2 w-2",children:[r.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-white opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-white"})]}),T?r.jsxs(r.Fragment,{children:[r.jsx(Wj,{className:"h-3.5 w-3.5"}),"LIVE NOW"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ra,{className:"h-3.5 w-3.5"}),"STARTING SOON"]})]}),k.image_url&&r.jsx(jjt,{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(Vt,{children:[r.jsx(Gt,{className:"line-clamp-2",children:k.title}),k.description&&r.jsx(Ns,{className:"line-clamp-2",children:k.description.replace(/<[^>]*>/g,"")})]}),r.jsxs(Xe,{className:"flex-1 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(jn,{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(Ra,{className:"h-4 w-4"}),UE(new Date(k.event_date))]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(qs,{className:"h-4 w-4"}),(i==null?void 0:i[k.id])||0," registered",k.capacity&&` / ${k.capacity} spots`]})]}),r.jsx(BA,{className:"flex gap-2",onClick:R=>R.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(en,{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(Sn,{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(Vt,{children:[r.jsx(Gt,{className:"text-base line-clamp-1",children:k.title}),r.jsx(Ns,{children:new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long",day:"numeric",timeZone:"America/New_York"}).format(new Date(k.event_date))})]})},k.id))})]})]}),s&&r.jsx("div",{className:"lg:col-span-1",children:r.jsx(h9e,{showUserStats:!0})})]})]})})}const Cde=[{value:"all",label:"All Roles",icon:qs},{value:"brokerage_manager",label:"Brokerage Managers",icon:OA},{value:"admin",label:"Admins",icon:bm}];function Ejt({open:e,onOpenChange:t,resourceType:s,resourceId:n,resourceTitle:a}){var it,xt;const{user:o,isAdmin:l,isBrokerageManager:i}=Yr(),[u,m]=A.useState([]),[x,y]=A.useState([]),[v,b]=A.useState([]),[N,k]=A.useState([]),[M,E]=A.useState(""),[T,P]=A.useState(""),[R,D]=A.useState(""),[U,q]=A.useState(!1),[H,G]=A.useState(!1),[Q,ne]=A.useState("agents"),[ie,he]=A.useState("all"),[se,fe]=A.useState({}),oe=l||i;A.useEffect(()=>{e&&o&&(l?ce():de())},[e,o,l]),A.useEffect(()=>{e||(b([]),k([]),E(""),P(""),D(""),ne("agents"),he("all"))},[e]);const ce=async()=>{if(o){q(!0);try{const{data:Ee,error:et}=await Y.from("brokerages").select("id, name").order("name");if(et)throw et;const le=1e3,Ve={};let Je=0,rt=!0;for(;rt;){const{data:Ce,error:Ie}=await Y.from("profiles").select("brokerage_id").range(Je*le,(Je+1)*le-1);if(Ie)throw Ie;Ce==null||Ce.forEach(Ze=>{Ze.brokerage_id&&(Ve[Ze.brokerage_id]=(Ve[Ze.brokerage_id]||0)+1)}),rt=(Ce==null?void 0:Ce.length)===le,Je++}y((Ee==null?void 0:Ee.map(Ce=>({...Ce,agent_count:Ve[Ce.id]||0})))||[]);const je=[];for(Je=0,rt=!0;rt;){const{data:Ce,error:Ie}=await Y.from("profiles").select("id, name, email, brokerage_id, brokerages(name)").neq("id",o.id).order("name").range(Je*le,(Je+1)*le-1);if(Ie)throw Ie;Ce&&je.push(...Ce),rt=(Ce==null?void 0:Ce.length)===le,Je++}const lt={};for(Je=0,rt=!0;rt;){const{data:Ce,error:Ie}=await Y.from("user_roles").select("user_id, role").range(Je*le,(Je+1)*le-1);if(Ie)throw Ie;Ce==null||Ce.forEach(Ze=>{lt[Ze.user_id]||(lt[Ze.user_id]=[]),lt[Ze.user_id].push(Ze.role)}),rt=(Ce==null?void 0:Ce.length)===le,Je++}fe(lt),m(je.map(Ce=>{var Ie;return{id:Ce.id,name:Ce.name,email:Ce.email,brokerage_name:((Ie=Ce.brokerages)==null?void 0:Ie.name)||"No Brokerage",roles:lt[Ce.id]||[]}}))}catch(Ee){console.error("Error loading data:",Ee),Te.error("Failed to load agents and brokerages")}finally{q(!1)}}},de=async()=>{if(o){q(!0);try{const{data:Ee}=await Y.from("profiles").select("brokerage_id").eq("id",o.id).single();if(!(Ee!=null&&Ee.brokerage_id)){Te.error("You must be part of a brokerage to share resources"),t(!1);return}const{data:et,error:le}=await Y.from("profiles").select("id, name, email").eq("brokerage_id",Ee.brokerage_id).neq("id",o.id).order("name");if(le)throw le;m(et||[])}catch(Ee){console.error("Error loading agents:",Ee),Te.error("Failed to load agents")}finally{q(!1)}}},xe=u.filter(Ee=>{var le;const et=Ee.name.toLowerCase().includes(M.toLowerCase())||Ee.email.toLowerCase().includes(M.toLowerCase())||((le=Ee.brokerage_name)==null?void 0:le.toLowerCase().includes(M.toLowerCase()));if(l&&ie!=="all"){const Ve=se[Ee.id]||[];return et&&Ve.includes(ie)}return et}),Me=x.filter(Ee=>Ee.name.toLowerCase().includes(T.toLowerCase())),ve=()=>{v.length===xe.length?b([]):b(xe.map(Ee=>Ee.id))},be=()=>{N.length===Me.length?k([]):k(Me.map(Ee=>Ee.id))},we=Ee=>{if(!oe){b([Ee]);return}b(et=>et.includes(Ee)?et.filter(le=>le!==Ee):[...et,Ee])},tt=Ee=>{k(et=>et.includes(Ee)?et.filter(le=>le!==Ee):[...et,Ee])},Ae=async()=>{if(!(v.length>0||N.length>0)){Te.error("Please select at least one agent or brokerage to share with");return}G(!0);try{const{data:et,error:le}=await Y.functions.invoke("send-share-notification",{body:{recipientIds:v,brokerageIds:N,resourceType:s,resourceId:n,resourceTitle:a,message:R.trim()||void 0}});if(le)throw le;const Ve=(et==null?void 0:et.sharesCreated)||v.length;Te.success(`Shared with ${Ve} agent${Ve!==1?"s":""}`),t(!1)}catch(et){console.error("Error sharing resource:",et),Te.error("Failed to share resource")}finally{G(!1)}},Le=Ee=>Ee.split(" ").map(et=>et[0]).join("").toUpperCase().slice(0,2),Ue=Ee=>{const et=se[Ee]||[];return et.includes("admin")?r.jsx(Tt,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:"Admin"}):et.includes("brokerage_manager")?r.jsx(Tt,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:"Manager"}):null},Pe=v.length+N.length,$e=ie!=="all"?xe.length:null;return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Pr,{className:"sm:max-w-lg max-h-[90vh] overflow-hidden flex flex-col",children:[r.jsxs(zr,{className:"flex-shrink-0",children:[r.jsxs(Rr,{className:"flex items-center gap-2",children:[r.jsx(ro,{className:"h-5 w-5 text-primary"}),"Share Resource"]}),r.jsxs(Zs,{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(Si,{value:Q,onValueChange:ne,className:"flex-1 flex flex-col overflow-hidden",children:[r.jsxs(ki,{className:"grid w-full grid-cols-2 flex-shrink-0",children:[r.jsxs(is,{value:"agents",className:"flex items-center gap-2",children:[r.jsx(qs,{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(is,{value:"brokerages",className:"flex items-center gap-2",children:[r.jsx(pi,{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(Ss,{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(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by name, email, or brokerage...",value:M,onChange:Ee=>E(Ee.target.value),className:"pl-9"})]}),r.jsxs(us,{value:ie,onValueChange:he,children:[r.jsxs(cs,{className:"w-[180px]",children:[r.jsx(G1,{className:"h-4 w-4 mr-2 text-muted-foreground"}),r.jsx(ms,{placeholder:"Filter by role"})]}),r.jsx(ds,{children:Cde.map(Ee=>r.jsx($t,{value:Ee.value,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ee.icon,{className:"h-4 w-4"}),r.jsx("span",{children:Ee.label})]})},Ee.value))})]})]}),r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(X,{variant:"ghost",size:"sm",onClick:ve,className:"text-xs h-8",disabled:xe.length===0,children:[r.jsx(qs,{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:[$e!==null&&r.jsxs("span",{className:"text-primary font-medium",children:[$e," ",(it=Cde.find(Ee=>Ee.value===ie))==null?void 0:it.label]}),r.jsxs("span",{className:"font-medium",children:[v.length," selected"]})]})]}),r.jsx(Yo,{className:"h-[300px] border rounded-lg",children:U?r.jsx("div",{className:"flex items-center justify-center h-[200px]",children:r.jsx(Vr,{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(qs,{className:"h-8 w-8 mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:ie!=="all"?`No ${(xt=Cde.find(Ee=>Ee.value===ie))==null?void 0:xt.label.toLowerCase()} found`:"No agents found"})]}):r.jsx("div",{className:"p-2 space-y-1",children:xe.map(Ee=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${v.includes(Ee.id)?"bg-accent":""}`,onClick:()=>we(Ee.id),children:[r.jsx(bl,{checked:v.includes(Ee.id),onCheckedChange:()=>we(Ee.id),className:"flex-shrink-0"}),r.jsx(Xn,{className:"h-9 w-9 flex-shrink-0",children:r.jsx(Qn,{className:"text-xs bg-primary/10 text-primary",children:Le(Ee.name)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:Ee.name}),Ue(Ee.id)]}),r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[Ee.email,Ee.brokerage_name&&r.jsxs("span",{className:"ml-1 opacity-75",children:["• ",Ee.brokerage_name]})]})]})]},Ee.id))})})]}),r.jsxs(Ss,{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(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search brokerages...",value:T,onChange:Ee=>P(Ee.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:be,className:"text-xs h-8",disabled:Me.length===0,children:[r.jsx(pi,{className:"h-3.5 w-3.5 mr-1.5"}),N.length===Me.length&&Me.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(Yo,{className:"h-[250px] border rounded-lg",children:U?r.jsx("div",{className:"flex items-center justify-center h-[180px]",children:r.jsx(Vr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):Me.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[180px] text-muted-foreground",children:[r.jsx(pi,{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:Me.map(Ee=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${N.includes(Ee.id)?"bg-accent":""}`,onClick:()=>tt(Ee.id),children:[r.jsx(bl,{checked:N.includes(Ee.id),onCheckedChange:()=>tt(Ee.id),className:"flex-shrink-0"}),r.jsx("div",{className:"h-9 w-9 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:r.jsx(pi,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:Ee.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[Ee.agent_count," agent",Ee.agent_count!==1?"s":""]})]})]},Ee.id))})})]})]}):r.jsxs("div",{className:"flex-1 flex flex-col space-y-3 overflow-hidden",children:[r.jsxs("div",{className:"relative flex-shrink-0",children:[r.jsx(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search agents...",value:M,onChange:Ee=>E(Ee.target.value),className:"pl-9"})]}),oe&&r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(X,{variant:"ghost",size:"sm",onClick:ve,className:"text-xs h-8",disabled:xe.length===0,children:[r.jsx(qs,{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(Yo,{className:"h-[300px] border rounded-lg",children:U?r.jsx("div",{className:"flex items-center justify-center h-[200px]",children:r.jsx(Vr,{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(qs,{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(Ee=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${v.includes(Ee.id)?"bg-accent":""}`,onClick:()=>we(Ee.id),children:[r.jsx(bl,{checked:v.includes(Ee.id),onCheckedChange:()=>we(Ee.id),className:"flex-shrink-0"}),r.jsx(Xn,{className:"h-9 w-9 flex-shrink-0",children:r.jsx(Qn,{className:"text-xs bg-primary/10 text-primary",children:Le(Ee.name)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:Ee.name}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Ee.email})]})]},Ee.id))})})]}),r.jsxs("div",{className:"space-y-2 flex-shrink-0",children:[r.jsx(ze,{htmlFor:"message",className:"text-sm font-medium",children:"Add a message (optional)"}),r.jsx(Ys,{id:"message",placeholder:"I thought you might find this useful...",value:R,onChange:Ee=>D(Ee.target.value),rows:2,className:"resize-none"})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2 flex-shrink-0",children:[r.jsx(X,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(X,{onClick:Ae,disabled:Pe===0||H,children:H?r.jsxs(r.Fragment,{children:[r.jsx(Vr,{className:"h-4 w-4 mr-2 animate-spin"}),"Sharing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(ro,{className:"h-4 w-4 mr-2"}),"Share"]})})]})]})]})})}function $3({resourceType:e,resourceId:t,resourceTitle:s,variant:n="outline",size:a="sm",className:o=""}){const[l,i]=A.useState(!1),{user:u}=Yr();return u?r.jsxs(r.Fragment,{children:[r.jsxs(X,{variant:n,size:a,onClick:()=>i(!0),className:o,children:[r.jsx(Cc,{className:"h-4 w-4 mr-2"}),"Share"]}),r.jsx(Ejt,{open:l,onOpenChange:i,resourceType:e,resourceId:t,resourceTitle:s})]}):null}function Ijt(){const{eventId:e}=hc(),t=Hs(),{user:s}=Yr(),[n,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,s]);const b=async()=>{try{const{data:P,error:R}=await Y.from("events").select("*").eq("id",e).single();if(R)throw R;a(P);const{count:D}=await Y.from("event_registrations").select("*",{count:"exact",head:!0}).eq("event_id",e);if(u(D||0),s){const{data:U}=await Y.from("event_registrations").select("id, zoom_join_url").eq("event_id",e).eq("user_id",s.id).maybeSingle();l(U)}}catch(P){console.error("Error loading event:",P),Te.error("Failed to load event"),t("/events")}finally{x(!1)}},N=async()=>{if(!(!s||!n)){v(!0);try{if(o){const{error:P}=await Y.functions.invoke("zoom-unregister",{body:{event_id:n.id}});if(P)throw P;Te.success("Successfully cancelled registration"),l(null),u(R=>R-1)}else{const{data:P,error:R}=await Y.functions.invoke("zoom-register",{body:{event_id:n.id}});if(R)throw R;Te.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),Te.error(o?"Failed to cancel registration":"Failed to register for event")}finally{v(!1)}}},k=P=>{var R,D,U;if(P.includes("iframe.mediadelivery.net")||P.includes("video.bunnycdn.com")){const q=P.match(/embed\/(\d+)\/([a-f0-9-]+)/);if(q)return`https://iframe.mediadelivery.net/embed/${q[1]}/${q[2]}?autoplay=false&preload=true`}if(P.includes("youtube.com")||P.includes("youtu.be")){const q=P.includes("youtu.be")?(R=P.split("youtu.be/")[1])==null?void 0:R.split("?")[0]:(D=P.split("v=")[1])==null?void 0:D.split("&")[0];if(q)return`https://www.youtube.com/embed/${q}`}if(P.includes("vimeo.com")){const q=(U=P.split("vimeo.com/")[1])==null?void 0:U.split("?")[0];if(q)return`https://player.vimeo.com/video/${q}`}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(!n)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=Eht(new Date(n.event_date)),E=n.capacity&&i>=n.capacity,T=(o==null?void 0:o.zoom_join_url)||n.zoom_link;return r.jsx(Dr,{title:n.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"]}),n.image_url&&r.jsxs("div",{className:"relative aspect-video rounded-xl overflow-hidden mb-6",children:[r.jsx("img",{src:n.image_url,alt:n.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:n.title}),r.jsx($3,{resourceType:"event",resourceId:n.id,resourceTitle:n.title})]}),n.description&&r.jsx("div",{className:"prose prose-sm max-w-none text-muted-foreground dark:prose-invert",dangerouslySetInnerHTML:{__html:n.description}})]}),n.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(ap,{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(n.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(Xe,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(jn,{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(n.event_date))}),r.jsx("p",{className:"text-sm text-muted-foreground",children:UE(new Date(n.event_date))})]})]}),n.capacity&&r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(qs,{className:"h-5 w-5 text-primary mt-0.5"}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:[i," / ",n.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(ii,{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(Sn,{className:"h-4 w-4"}),"Join Event"]}),r.jsxs(X,{variant:"outline",className:"w-full",onClick:N,disabled:y,children:[y?r.jsx(Vr,{className:"h-4 w-4 animate-spin mr-2"}):null,"Cancel Registration"]})]}):r.jsx(X,{className:"w-full gap-2",onClick:N,disabled:y||(E??!1),children:y?r.jsx(Vr,{className:"h-4 w-4 animate-spin"}):E?"Event Full":"Register Now"})}),M&&o&&r.jsxs(X,{variant:"outline",className:"w-full gap-2",onClick:()=>window.open(n.zoom_link,"_blank"),children:[r.jsx(Sn,{className:"h-4 w-4"}),"View Recording"]})]})]})})})]})]})})}const Pjt=()=>{const{user:e,isAdmin:t}=Yr(),s=Hs(),[n,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:R,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),q=new Set((U==null?void 0:U.map(Q=>Q.app_id))||[]);v(q);const G=((R==null?void 0:R.filter(Q=>!Q.required_tags||Q.required_tags.length===0?!0:Q.required_tags.some(ne=>P.includes(ne))))||[]).sort((Q,ne)=>Q.name==="LevelUp Members Portal"?-1:ne.name==="LevelUp Members Portal"?1:0);a(G)}catch(T){console.error("Error loading apps:",T),Te.error("Failed to load apps")}finally{l(!1)}},N=async T=>{var R;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(),Te.error("Session expired. Please refresh the page and try again.");return}const q=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:H,error:G}=await Y.functions.invoke("sso-launch",{body:{app_id:T.app_id},headers:{Authorization:`Bearer ${q}`}});if(G)throw G;H!=null&&H.redirect_url?P&&!P.closed?(P.location.href=H.redirect_url,(R=P.focus)==null||R.call(P)):window.location.assign(H.redirect_url):(P==null||P.close(),Te.error("Launch link unavailable"))}catch(D){P==null||P.close(),console.error("Error launching app:",D),Te.error("Failed to launch app. Please try again.")}},k=async(T,P)=>{T.stopPropagation();const R=y.has(P);try{if(R){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 q=new Set(U);return q.delete(P),q}),Te.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)),Te.success("Added to favorites")}}catch(D){console.error("Error toggling favorite:",D),Te.error("Failed to update favorites")}},M=n.filter(T=>{var R;const P=T.name.toLowerCase().includes(i.toLowerCase())||((R=T.description)==null?void 0:R.toLowerCase().includes(i.toLowerCase()));return m==="favorites"?P&&y.has(T.id):P}),E=[{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(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{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:E.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(Tf,{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(nh,{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:()=>s("/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),R=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(Tf,{className:Ut("h-5 w-5",P&&"fill-current")})})]}),R&&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)})})]})},Ljt=()=>{const e=Hs(),[t,s]=A.useState(""),[n,a]=A.useState("all"),[o,l]=A.useState("all"),[i,u]=A.useState("grid"),{data:m=[]}=Kt({queryKey:["template-categories"],queryFn:async()=>{const{data:E,error:T}=await Y.from("template_categories").select("*").order("name");if(T)throw T;return E}}),{data:x=[]}=Kt({queryKey:["template-types"],queryFn:async()=>{const{data:E,error:T}=await Y.from("template_types").select("*").order("name");if(T)throw T;return E}}),{data:y=[],isLoading:v}=Kt({queryKey:["canva-templates"],queryFn:async()=>{const{data:E,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:R}=await Y.from("template_links").select("*").order("sort_order");if(R)throw R;const{data:D}=await Y.from("template_likes").select("template_id"),{data:U}=await Y.from("template_comments").select("template_id"),q=new Map;D==null||D.forEach(Q=>{q.set(Q.template_id,(q.get(Q.template_id)||0)+1)});const H=new Map;return U==null||U.forEach(Q=>{H.set(Q.template_id,(H.get(Q.template_id)||0)+1)}),(E||[]).map(Q=>({...Q,links:(P||[]).filter(ne=>ne.template_id===Q.id)||[],likesCount:q.get(Q.id)||0,commentsCount:H.get(Q.id)||0}))}}),b=y.filter(E=>{var D;const T=E.name.toLowerCase().includes(t.toLowerCase())||((D=E.description)==null?void 0:D.toLowerCase().includes(t.toLowerCase())),P=n==="all"||E.category_id===n,R=o==="all"||E.type_id===o;return T&&P&&R}),N=()=>{s(""),a("all"),l("all")},k=t||n!=="all"||o!=="all",M=E=>{e(`/templates/${E}`)};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(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search templates...",value:t,onChange:E=>s(E.target.value),className:"pl-9"})]}),r.jsxs(us,{value:n,onValueChange:a,children:[r.jsx(cs,{className:"w-full sm:w-48",children:r.jsx(ms,{placeholder:"All Categories"})}),r.jsxs(ds,{children:[r.jsx($t,{value:"all",children:"All Categories"}),m.map(E=>r.jsx($t,{value:E.id,children:E.name},E.id))]})]}),r.jsxs(us,{value:o,onValueChange:l,children:[r.jsx(cs,{className:"w-full sm:w-48",children:r.jsx(ms,{placeholder:"All Types"})}),r.jsxs(ds,{children:[r.jsx($t,{value:"all",children:"All Types"}),x.map(E=>r.jsx($t,{value:E.id,children:E.name},E.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(pp,{className:"h-4 w-4"})}),r.jsx(X,{variant:i==="list"?"secondary":"outline",size:"icon",onClick:()=>u("list"),className:"rounded-full",children:r.jsx(fp,{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((E,T)=>r.jsx(He,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx(Cr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Cr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Cr,{className:"h-4 w-full mb-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Cr,{className:"h-5 w-16"}),r.jsx(Cr,{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(E=>r.jsxs(He,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${i==="list"?"flex flex-row":""}`,onClick:()=>M(E.id),children:[r.jsxs("div",{className:`relative overflow-hidden bg-muted ${i==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:[E.preview_image_url?r.jsx("img",{src:E.preview_image_url,alt:E.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No Preview"}),E.links.length>1&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Tt,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm !text-secondary",children:[r.jsx(zo,{className:"h-3 w-3"}),E.links.length]})})]}),r.jsxs(Xe,{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:E.name}),E.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:vne(E.description)}),r.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[E.category&&r.jsx(Tt,{variant:"secondary",className:"text-xs",children:E.category.name}),E.type&&r.jsx(Tt,{variant:"outline",className:"text-xs",children:E.type.name})]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(xd,{className:"h-3.5 w-3.5"}),E.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ql,{className:"h-3.5 w-3.5"}),E.commentsCount]})]}),r.jsxs(X,{size:"sm",className:"w-full gap-2",onClick:T=>{T.stopPropagation(),M(E.id)},children:[r.jsx(Sn,{className:"h-4 w-4"}),"View Template"]})]})]},E.id))})]})})};var Ojt="Separator",RSe="horizontal",Djt=["horizontal","vertical"],m9e=A.forwardRef((e,t)=>{const{decorative:s,orientation:n=RSe,...a}=e,o=Rjt(n)?n:RSe,i=s?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return r.jsx($s.div,{"data-orientation":o,...i,...a,ref:t})});m9e.displayName=Ojt;function Rjt(e){return Djt.includes(e)}var p9e=m9e;const pd=A.forwardRef(({className:e,orientation:t="horizontal",decorative:s=!0,...n},a)=>r.jsx(p9e,{ref:a,decorative:s,orientation:t,className:Ut("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));pd.displayName=p9e.displayName;const vP=()=>({trackEngagement:A.useCallback(async(t,s,n,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:s,resource_title:n,action_type:a})}catch(o){console.error("Error tracking engagement:",o)}},[])}),Fjt=()=>{const{templateId:e}=hc(),{user:t,isAdmin:s}=Yr(),{toast:n}=ci(),a=Br(),{trackEngagement:o}=vP(),[l,i]=A.useState(""),{data:u,isLoading:m}=Kt({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:R}=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:R||[],guides:D||[]}},enabled:!!e});A.useEffect(()=>{u&&o("template",u.id,u.name,"view")},[u==null?void 0:u.id]);const{data:x=[]}=Kt({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=[]}=Kt({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 R=[...new Set(T.map(q=>q.user_id))],{data:D}=await Y.from("profiles").select("id, name").in("id",R),U=new Map((D==null?void 0:D.map(q=>[q.id,q.name]))||[]);return T.map(q=>({...q,user_name:U.get(q.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(""),n({title:"Comment added!"})},onError:T=>{n({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]}),n({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),E=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(ho,{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:[s&&r.jsx(X,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(ho,{to:`/admin/templates?edit=${u.id}`,children:[r.jsx(Ja,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx($3,{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(xd,{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(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(zo,{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(Sn,{className:"h-4 w-4 text-muted-foreground"})]},T.id))})]})}),u.video_url&&r.jsx(He,{children:r.jsx(Xe,{className:"pt-6",children:r.jsx("div",{className:"aspect-video w-full rounded-lg overflow-hidden",children:r.jsx("iframe",{src: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(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(ga,{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(ga,{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($i,{className:"h-4 w-4 text-muted-foreground"})]},T.id))})]})}),r.jsx(pd,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(ql,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),t?r.jsxs("form",{onSubmit:E,className:"flex gap-2",children:[r.jsx(Ys,{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(ro,{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(Xe,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):y.map(T=>r.jsx(He,{children:r.jsx(Xe,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Xn,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Qn,{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:ju(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(Bs,{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(zo,{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(ho,{to:"/templates",children:"Back to Templates"})})]})})},zjt=()=>{const{user:e}=Yr(),[t,s]=A.useState(""),[n,a]=A.useState("all"),{data:o=[]}=Kt({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}=Kt({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(E=>({...E,resources:(N==null?void 0:N.filter(T=>T.video_id===E.id))||[]}))}}),{data:u=[]}=Kt({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=n==="all"||v.category_id===n;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(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search videos...",value:t,onChange:v=>s(v.target.value),className:"pl-10"})]})}),r.jsx(Si,{value:n,onValueChange:a,children:r.jsxs(ki,{className:"w-full justify-start flex-wrap h-auto gap-2 bg-transparent p-0",children:[r.jsx(is,{value:"all",className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:"All Videos"}),o.map(v=>r.jsx(is,{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(Xe,{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Ta,{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(ho,{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(Ta,{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(Hl,{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(Ra,{className:"h-3 w-3"}),v.duration]})]}),r.jsxs(Vt,{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(Xe,{className:"pt-0",children:[v.description&&r.jsx(Ns,{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(xd,{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(ga,{className:"h-4 w-4"}),v.resources.length]})]})]})]})},v.id))})]})})};function f9e({resourceType:e,resourceId:t}){const{data:s=[]}=Kt({queryKey:["linked-templates",e,t],queryFn:async()=>{if(e==="academy_video"){const{data:n,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(n||[]).map(o=>o.canva_templates).filter(Boolean)}else{const{data:n,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(n||[]).map(o=>o.canva_templates).filter(Boolean)}},enabled:!!t});return s.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(Wc,{className:"h-4 w-4"}),"Related Templates"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:s.map(n=>r.jsx(ho,{to:`/templates/${n.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(Wc,{className:"h-3 w-3"}),n.name]})},n.id))})]})}const Bjt=(e,t)=>{if(t==="bunny_stream"){let s=e.replace("iframe.mediadelivery.net","player.mediadelivery.net");return s.includes("?")||(s+="?autoplay=false&loop=false&muted=false&preload=true&responsive=true"),s}if(t==="youtube"){const s=/(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,n=e.match(s);if(n)return`https://www.youtube.com/embed/${n[1]}`}if(t==="vimeo"){const s=/vimeo\.com\/(?:video\/)?(\d+)/,n=e.match(s);if(n)return`https://player.vimeo.com/video/${n[1]}`}if(t==="loom"){const s=/loom\.com\/share\/([a-zA-Z0-9]+)/,n=e.match(s);if(n)return`https://www.loom.com/embed/${n[1]}`}return e},$jt=()=>{const{videoId:e}=hc();Hs();const{user:t,isAdmin:s}=Yr(),{toast:n}=ci(),a=Br(),{trackEngagement:o}=vP(),[l,i]=A.useState(""),{data:u,isLoading:m}=Kt({queryKey:["academy-video",e],queryFn:async()=>{const{data:P,error:R}=await Y.from("academy_videos").select(` *, category:academy_categories(id, name) `).eq("id",e).eq("is_published",!0).single();if(R)throw R;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=[]}=Kt({queryKey:["academy-video-likes",e],queryFn:async()=>{const{data:P,error:R}=await Y.from("academy_video_likes").select("*").eq("video_id",e);if(R)throw R;return P},enabled:!!e}),{data:y=[]}=Kt({queryKey:["academy-video-comments",e],queryFn:async()=>{const{data:P,error:R}=await Y.from("academy_video_comments").select("*").eq("video_id",e).order("created_at",{ascending:!1});if(R)throw R;const D=[...new Set(P.map(H=>H.user_id))],{data:U}=await Y.from("profiles").select("id, name").in("id",D),q=new Map((U==null?void 0:U.map(H=>[H.id,H.name]))||[]);return P.map(H=>({...H,user_name:q.get(H.user_id)||"Unknown User"}))},enabled:!!e}),v=ar({mutationFn:async P=>{const{error:R}=await Y.from("academy_video_comments").insert({video_id:e,user_id:t.id,content:P});if(R)throw R},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-video-comments",e]}),i(""),n({title:"Comment added!"})},onError:P=>{n({title:"Error adding comment",description:P.message,variant:"destructive"})}}),b=ar({mutationFn:async P=>{const{error:R}=await Y.from("academy_video_comments").delete().eq("id",P);if(R)throw R},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-video-comments",e]}),n({title:"Comment deleted"})}}),N=ar({mutationFn:async()=>{const P=x.find(R=>R.user_id===(t==null?void 0:t.id));if(P){const{error:R}=await Y.from("academy_video_likes").delete().eq("id",P.id);if(R)throw R}else{const{error:R}=await Y.from("academy_video_likes").insert({video_id:e,user_id:t.id});if(R)throw R}},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"📁"}},E=P=>P.split(" ").map(R=>R[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(ho,{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:Bjt(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(Ta,{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(Sn,{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:[s&&r.jsx(X,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(ho,{to:`/admin/academy?edit=${u.id}`,children:[r.jsx(Ja,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx($3,{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(xd,{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(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(ga,{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($i,{className:"h-4 w-4 text-muted-foreground"})]},P.id))})]})}),r.jsx(f9e,{resourceType:"academy_video",resourceId:u.id}),r.jsx(pd,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(ql,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),t?r.jsxs("form",{onSubmit:T,className:"flex gap-2",children:[r.jsx(Ys,{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(ro,{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(Xe,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):y.map(P=>r.jsx(He,{children:r.jsx(Xe,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Xn,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Qn,{className:"text-sm",children:E(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:ju(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(Bs,{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(Ta,{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(ho,{to:"/academy",children:"Back to Academy"})})]})})};function Ujt(){const e=Hs(),[t,s]=A.useState(""),{data:n,isLoading:a}=Kt({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}=Kt({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}=Kt({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}=Kt({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=n==null?void 0:n.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(ua,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search resource kits...",value:t,onChange:b=>s(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(Xe,{className:"p-4",children:[r.jsx(Cr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Cr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Cr,{className:"h-4 w-full mb-4"}),r.jsx(Cr,{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(Vl,{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(Vl,{className:"h-16 w-16 text-muted-foreground"})})}),r.jsxs(Xe,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:b.name}),b.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:vne(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(ga,{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(xd,{className:"h-3.5 w-3.5"}),k]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ql,{className:"h-3.5 w-3.5"}),M]})]})]})]})]},b.id)})})]})})}const qjt=()=>{const{kitId:e}=hc(),{user:t,isAdmin:s}=Yr(),{toast:n}=ci(),a=Br(),{trackEngagement:o}=vP(),[l,i]=A.useState(""),{data:u,isLoading:m}=Kt({queryKey:["resource-kit-detail",e],queryFn:async()=>{const{data:P,error:R}=await Y.from("resource_kits").select("*").eq("id",e).eq("is_published",!0).single();if(R)throw R;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=[]}=Kt({queryKey:["resource-kit-likes",e],queryFn:async()=>{const{data:P,error:R}=await Y.from("resource_kit_likes").select("*").eq("kit_id",e);if(R)throw R;return P},enabled:!!e}),{data:y=[]}=Kt({queryKey:["resource-kit-comments",e],queryFn:async()=>{const{data:P,error:R}=await Y.from("resource_kit_comments").select("*").eq("kit_id",e).order("created_at",{ascending:!1});if(R)throw R;const D=[...new Set(P.map(H=>H.user_id))],{data:U}=await Y.from("profiles").select("id, name").in("id",D),q=new Map((U==null?void 0:U.map(H=>[H.id,H.name]))||[]);return P.map(H=>({...H,user_name:q.get(H.user_id)||"Unknown User"}))},enabled:!!e}),v=ar({mutationFn:async P=>{const{error:R}=await Y.from("resource_kit_comments").insert({kit_id:e,user_id:t.id,content:P});if(R)throw R},onSuccess:()=>{a.invalidateQueries({queryKey:["resource-kit-comments",e]}),i(""),n({title:"Comment added!"})},onError:P=>{n({title:"Error adding comment",description:P.message,variant:"destructive"})}}),b=ar({mutationFn:async P=>{const{error:R}=await Y.from("resource_kit_comments").delete().eq("id",P);if(R)throw R},onSuccess:()=>{a.invalidateQueries({queryKey:["resource-kit-comments",e]}),n({title:"Comment deleted"})}}),N=ar({mutationFn:async()=>{const P=x.find(R=>R.user_id===(t==null?void 0:t.id));if(P){const{error:R}=await Y.from("resource_kit_likes").delete().eq("id",P.id);if(R)throw R}else{const{error:R}=await Y.from("resource_kit_likes").insert({kit_id:e,user_id:t.id});if(R)throw R}},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(R=>R[0]).join("").toUpperCase().slice(0,2),E=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(ho,{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:[s&&r.jsx(X,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(ho,{to:`/admin/toolbox?edit=${u.id}`,children:[r.jsx(Ja,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx($3,{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(xd,{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(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(ga,{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(ga,{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:E(P.file_size)})]})]}),r.jsx($i,{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(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Sn,{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(Sn,{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(f9e,{resourceType:"resource_kit",resourceId:u.id}),r.jsx(pd,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(ql,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),t?r.jsxs("form",{onSubmit:T,className:"flex gap-2",children:[r.jsx(Ys,{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(ro,{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(Xe,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):y.map(P=>r.jsx(He,{children:r.jsx(Xe,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Xn,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Qn,{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:ju(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(Bs,{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(Vl,{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(ho,{to:"/toolbox",children:"Back to Toolbox"})})]})})},Vjt=()=>{const e=Hs(),[t,s]=A.useState(""),[n,a]=A.useState("grid"),{data:o=[],isLoading:l}=Kt({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(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search social swag...",value:t,onChange:m=>s(m.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[t&&r.jsx(X,{variant:"outline",size:"sm",onClick:()=>s(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(X,{variant:n==="grid"?"secondary":"outline",size:"icon",onClick:()=>a("grid"),className:"rounded-full",children:r.jsx(pp,{className:"h-4 w-4"})}),r.jsx(X,{variant:n==="list"?"secondary":"outline",size:"icon",onClick:()=>a("list"),className:"rounded-full",children:r.jsx(fp,{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: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(8)].map((m,x)=>r.jsx(He,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx(Cr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Cr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Cr,{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:()=>s(""),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(m=>r.jsxs(He,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${n==="list"?"flex flex-row":""}`,onClick:()=>u(m.id),children:[r.jsxs("div",{className:`relative overflow-hidden bg-muted ${n==="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(zo,{className:"h-3 w-3"}),m.links.length]})})]}),r.jsxs(Xe,{className:`p-4 flex flex-col ${n==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children: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(xd,{className:"h-3.5 w-3.5"}),m.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ql,{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(Sn,{className:"h-4 w-4"}),"View Details"]})]})]},m.id))})]})})};var Ua=function(){return Ua=Object.assign||function(t){for(var s,n=1,a=arguments.length;n1&&(u||!m),y=t>1&&(m||!u),v=function(){n&&o(n)},b=function(){a&&o(a)};return r.jsx(jkt,{displayMonth:e.displayMonth,hideNext:x,hidePrevious:y,nextMonth:a,previousMonth:n,onPreviousClick:v,onNextClick:b})}function kkt(e){var t,s=dl(),n=s.classNames,a=s.disableNavigation,o=s.styles,l=s.captionLayout,i=s.components,u=(t=i==null?void 0:i.CaptionLabel)!==null&&t!==void 0?t:y9e,m;return a?m=r.jsx(u,{id:e.id,displayMonth:e.displayMonth}):l==="dropdown"?m=r.jsx(FSe,{displayMonth:e.displayMonth,id:e.id}):l==="dropdown-buttons"?m=r.jsxs(r.Fragment,{children:[r.jsx(FSe,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),r.jsx(zSe,{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(zSe,{displayMonth:e.displayMonth,id:e.id})]}),r.jsx("div",{className:n.caption,style:o.caption,children:m})}function Nkt(e){var t=dl(),s=t.footer,n=t.styles,a=t.classNames.tfoot;return s?r.jsx("tfoot",{className:a,style:n.tfoot,children:r.jsx("tr",{children:r.jsx("td",{colSpan:8,children:s})})}):r.jsx(r.Fragment,{})}function Skt(e,t,s){for(var n=s?Iy(new Date):Sm(new Date,{locale:e,weekStartsOn:t}),a=[],o=0;o<7;o++){var l=Jl(n,o);a.push(l)}return a}function Ckt(){var e=dl(),t=e.classNames,s=e.styles,n=e.showWeekNumber,a=e.locale,o=e.weekStartsOn,l=e.ISOWeek,i=e.formatters.formatWeekdayName,u=e.labels.labelWeekday,m=Skt(a,o,l);return r.jsxs("tr",{style:s.head_row,className:t.head_row,children:[n&&r.jsx("td",{style:s.head_cell,className:t.head_cell}),m.map(function(x,y){return r.jsx("th",{scope:"col",className:t.head_cell,style:s.head_cell,"aria-label":u(x,{locale:a}),children:i(x,{locale:a})},y)})]})}function Mkt(){var e,t=dl(),s=t.classNames,n=t.styles,a=t.components,o=(e=a==null?void 0:a.HeadRow)!==null&&e!==void 0?e:Ckt;return r.jsx("thead",{style:n.head,className:s.head,children:r.jsx(o,{})})}function Tkt(e){var t=dl(),s=t.locale,n=t.formatters.formatDay;return r.jsx(r.Fragment,{children:n(e.date,{locale:s})})}var I0e=A.createContext(void 0);function Akt(e){if(!_P(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return r.jsx(I0e.Provider,{value:t,children:e.children})}return r.jsx(Ekt,{initialProps:e.initialProps,children:e.children})}function Ekt(e){var t=e.initialProps,s=e.children,n=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&&(n==null?void 0:n.length)===a);if(!N){var k=!!(!x.selected&&o&&(n==null?void 0:n.length)===o);if(!k){var M=n?g9e([],n):[];if(x.selected){var E=M.findIndex(function(T){return ic(m,T)});M.splice(E,1)}else M.push(m);(b=t.onSelect)===null||b===void 0||b.call(t,M,m,x,y)}}},i={disabled:[]};n&&i.disabled.push(function(m){var x=o&&n.length>o-1,y=n.some(function(v){return ic(v,m)});return!!(x&&!y)});var u={selected:n,onDayClick:l,modifiers:i};return r.jsx(I0e.Provider,{value:u,children:s})}function P0e(){var e=A.useContext(I0e);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function Ikt(e,t){var s=t||{},n=s.from,a=s.to;return n&&a?ic(a,e)&&ic(n,e)?void 0:ic(a,e)?{from:a,to:void 0}:ic(n,e)?void 0:Hte(n,e)?{from:e,to:a}:{from:n,to:e}:a?Hte(e,a)?{from:a,to:e}:{from:e,to:a}:n?Kne(e,n)?{from:e,to:n}:{from:n,to:e}:{from:e,to:void 0}}var L0e=A.createContext(void 0);function Pkt(e){if(!bP(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return r.jsx(L0e.Provider,{value:t,children:e.children})}return r.jsx(Lkt,{initialProps:e.initialProps,children:e.children})}function Lkt(e){var t=e.initialProps,s=e.children,n=t.selected,a=n||{},o=a.from,l=a.to,i=t.min,u=t.max,m=function(b,N,k){var M,E;(M=t.onDayClick)===null||M===void 0||M.call(t,b,N,k);var T=Ikt(b,n);(E=t.onSelect)===null||E===void 0||E.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],ic(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:Hce(o,i-1),before:Jl(o,i-1)}),o&&l&&x.disabled.push({after:o,before:Jl(o,i-1)}),!o&&l&&x.disabled.push({after:Hce(l,i-1),before:Jl(l,i-1)})),u){if(o&&!l&&(x.disabled.push({before:Jl(o,-u+1)}),x.disabled.push({after:Jl(o,u-1)})),o&&l){var y=kf(l,o)+1,v=u-y;x.disabled.push({before:Hce(o,v)}),x.disabled.push({after:Jl(l,v)})}!o&&l&&(x.disabled.push({before:Jl(l,-u+1)}),x.disabled.push({after:Jl(l,u-1)}))}return r.jsx(L0e.Provider,{value:{selected:n,onDayClick:m,modifiers:x},children:s})}function O0e(){var e=A.useContext(L0e);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function ete(e){return Array.isArray(e)?g9e([],e):e!==void 0?[e]:[]}function Okt(e){var t={};return Object.entries(e).forEach(function(s){var n=s[0],a=s[1];t[n]=ete(a)}),t}var $f;(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"})($f||($f={}));var Dkt=$f.Selected,zx=$f.Disabled,Rkt=$f.Hidden,Fkt=$f.Today,Mde=$f.RangeEnd,Tde=$f.RangeMiddle,Ade=$f.RangeStart,zkt=$f.Outside;function Bkt(e,t,s){var n,a=(n={},n[Dkt]=ete(e.selected),n[zx]=ete(e.disabled),n[Rkt]=ete(e.hidden),n[Fkt]=[e.today],n[Mde]=[],n[Tde]=[],n[Ade]=[],n[zkt]=[],n);return e.fromDate&&a[zx].push({before:e.fromDate}),e.toDate&&a[zx].push({after:e.toDate}),_P(e)?a[zx]=a[zx].concat(t.modifiers[zx]):bP(e)&&(a[zx]=a[zx].concat(s.modifiers[zx]),a[Ade]=s.modifiers[Ade],a[Tde]=s.modifiers[Tde],a[Mde]=s.modifiers[Mde]),a}var b9e=A.createContext(void 0);function $kt(e){var t=dl(),s=P0e(),n=O0e(),a=Bkt(t,s,n),o=Okt(t.modifiers),l=Ua(Ua({},a),o);return r.jsx(b9e.Provider,{value:l,children:e.children})}function w9e(){var e=A.useContext(b9e);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function Ukt(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function qkt(e){return!!(e&&typeof e=="object"&&"from"in e)}function Vkt(e){return!!(e&&typeof e=="object"&&"after"in e)}function Hkt(e){return!!(e&&typeof e=="object"&&"before"in e)}function Wkt(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function Gkt(e,t){var s,n=t.from,a=t.to;if(n&&a){var o=kf(a,n)<0;o&&(s=[a,n],n=s[0],a=s[1]);var l=kf(e,n)>=0&&kf(a,e)>=0;return l}return a?ic(a,e):n?ic(n,e):!1}function Kkt(e){return aye(e)}function Zkt(e){return Array.isArray(e)&&e.every(aye)}function Ykt(e,t){return t.some(function(s){if(typeof s=="boolean")return s;if(Kkt(s))return ic(e,s);if(Zkt(s))return s.includes(e);if(qkt(s))return Gkt(e,s);if(Wkt(s))return s.dayOfWeek.includes(e.getDay());if(Ukt(s)){var n=kf(s.before,e),a=kf(s.after,e),o=n>0,l=a<0,i=Hte(s.before,s.after);return i?l&&o:o||l}return Vkt(s)?kf(e,s.after)>0:Hkt(s)?kf(s.before,e)>0:typeof s=="function"?s(e):!1})}function D0e(e,t,s){var n=Object.keys(t).reduce(function(o,l){var i=t[l];return Ykt(e,i)&&o.push(l),o},[]),a={};return n.forEach(function(o){return a[o]=!0}),s&&!mye(e,s)&&(a.outside=!0),a}function Xkt(e,t){for(var s=Rh(e[0]),n=Wne(e[e.length-1]),a,o,l=s;l<=n;){var i=D0e(l,t),u=!i.disabled&&!i.hidden;if(!u){l=Jl(l,1);continue}if(i.selected)return l;i.today&&!o&&(o=l),a||(a=l),l=Jl(l,1)}return o||a}var Qkt=365;function j9e(e,t){var s=t.moveBy,n=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:Jl,week:cj,month:zh,year:Cdt,startOfWeek:function(M){return a.ISOWeek?Iy(M):Sm(M,{locale:y,weekStartsOn:u})},endOfWeek:function(M){return a.ISOWeek?U8e(M):iye(M,{locale:y,weekStartsOn:u})}},b=v[s](e,n==="after"?1:-1);n==="before"&&m?b=Mdt([m,b]):n==="after"&&x&&(b=Tdt([x,b]));var N=!0;if(o){var k=D0e(b,o);N=!k.disabled&&!k.hidden}return N?b:i.count>Qkt?i.lastFocused:j9e(b,{moveBy:s,direction:n,context:a,modifiers:o,retry:Ua(Ua({},i),{count:i.count+1})})}var k9e=A.createContext(void 0);function Jkt(e){var t=wP(),s=w9e(),n=A.useState(),a=n[0],o=n[1],l=A.useState(),i=l[0],u=l[1],m=Xkt(t.displayMonths,s),x=a??(i&&t.isDateDisplayed(i))?i:m,y=function(){u(a),o(void 0)},v=function(M){o(M)},b=dl(),N=function(M,E){if(a){var T=j9e(a,{moveBy:M,direction:E,context:b,modifiers:s});ic(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(k9e.Provider,{value:k,children:e.children})}function R0e(){var e=A.useContext(k9e);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function eNt(e,t){var s=w9e(),n=D0e(e,s,t);return n}var F0e=A.createContext(void 0);function tNt(e){if(!Pae(e.initialProps)){var t={selected:void 0};return r.jsx(F0e.Provider,{value:t,children:e.children})}return r.jsx(rNt,{initialProps:e.initialProps,children:e.children})}function rNt(e){var t=e.initialProps,s=e.children,n=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:n};return r.jsx(F0e.Provider,{value:a,children:s})}function N9e(){var e=A.useContext(F0e);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function sNt(e,t){var s=dl(),n=N9e(),a=P0e(),o=O0e(),l=R0e(),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,E=l.focusStartOfWeek,T=l.focusEndOfWeek,P=function(ce){var de,xe,Me,ve;Pae(s)?(de=n.onDayClick)===null||de===void 0||de.call(n,e,t,ce):_P(s)?(xe=a.onDayClick)===null||xe===void 0||xe.call(a,e,t,ce):bP(s)?(Me=o.onDayClick)===null||Me===void 0||Me.call(o,e,t,ce):(ve=s.onDayClick)===null||ve===void 0||ve.call(s,e,t,ce)},R=function(ce){var de;v(e),(de=s.onDayFocus)===null||de===void 0||de.call(s,e,t,ce)},D=function(ce){var de;y(),(de=s.onDayBlur)===null||de===void 0||de.call(s,e,t,ce)},U=function(ce){var de;(de=s.onDayMouseEnter)===null||de===void 0||de.call(s,e,t,ce)},q=function(ce){var de;(de=s.onDayMouseLeave)===null||de===void 0||de.call(s,e,t,ce)},H=function(ce){var de;(de=s.onDayPointerEnter)===null||de===void 0||de.call(s,e,t,ce)},G=function(ce){var de;(de=s.onDayPointerLeave)===null||de===void 0||de.call(s,e,t,ce)},Q=function(ce){var de;(de=s.onDayTouchCancel)===null||de===void 0||de.call(s,e,t,ce)},ne=function(ce){var de;(de=s.onDayTouchEnd)===null||de===void 0||de.call(s,e,t,ce)},ie=function(ce){var de;(de=s.onDayTouchMove)===null||de===void 0||de.call(s,e,t,ce)},he=function(ce){var de;(de=s.onDayTouchStart)===null||de===void 0||de.call(s,e,t,ce)},se=function(ce){var de;(de=s.onDayKeyUp)===null||de===void 0||de.call(s,e,t,ce)},fe=function(ce){var de;switch(ce.key){case"ArrowLeft":ce.preventDefault(),ce.stopPropagation(),s.dir==="rtl"?i():u();break;case"ArrowRight":ce.preventDefault(),ce.stopPropagation(),s.dir==="rtl"?u():i();break;case"ArrowDown":ce.preventDefault(),ce.stopPropagation(),m();break;case"ArrowUp":ce.preventDefault(),ce.stopPropagation(),x();break;case"PageUp":ce.preventDefault(),ce.stopPropagation(),ce.shiftKey?k():b();break;case"PageDown":ce.preventDefault(),ce.stopPropagation(),ce.shiftKey?M():N();break;case"Home":ce.preventDefault(),ce.stopPropagation(),E();break;case"End":ce.preventDefault(),ce.stopPropagation(),T();break}(de=s.onDayKeyDown)===null||de===void 0||de.call(s,e,t,ce)},oe={onClick:P,onFocus:R,onBlur:D,onKeyDown:fe,onKeyUp:se,onMouseEnter:U,onMouseLeave:q,onPointerEnter:H,onPointerLeave:G,onTouchCancel:Q,onTouchEnd:ne,onTouchMove:ie,onTouchStart:he};return oe}function nNt(){var e=dl(),t=N9e(),s=P0e(),n=O0e(),a=Pae(e)?t.selected:_P(e)?s.selected:bP(e)?n.selected:void 0;return a}function aNt(e){return Object.values($f).includes(e)}function iNt(e,t){var s=[e.classNames.day];return Object.keys(t).forEach(function(n){var a=e.modifiersClassNames[n];if(a)s.push(a);else if(aNt(n)){var o=e.classNames["day_".concat(n)];o&&s.push(o)}}),s}function oNt(e,t){var s=Ua({},e.styles.day);return Object.keys(t).forEach(function(n){var a;s=Ua(Ua({},s),(a=e.modifiersStyles)===null||a===void 0?void 0:a[n])}),s}function lNt(e,t,s){var n,a,o,l=dl(),i=R0e(),u=eNt(e,t),m=sNt(e,u),x=nNt(),y=!!(l.onDayClick||l.mode!=="default");A.useEffect(function(){var U;u.outside||i.focusedDay&&y&&ic(i.focusedDay,e)&&((U=s.current)===null||U===void 0||U.focus())},[i.focusedDay,e,s,y,u.outside]);var v=iNt(l,u).join(" "),b=oNt(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:Tkt,M=r.jsx(k,{date:e,displayMonth:t,activeModifiers:u}),E={style:b,className:v,children:M,role:"gridcell"},T=i.focusTarget&&ic(i.focusTarget,e)&&!u.outside,P=i.focusedDay&&ic(i.focusedDay,e),R=Ua(Ua(Ua({},E),(n={disabled:u.disabled,role:"gridcell"},n["aria-selected"]=u.selected,n.tabIndex=P||T?0:-1,n)),m),D={isButton:y,isHidden:N,activeModifiers:u,selectedDays:x,buttonProps:R,divProps:E};return D}function cNt(e){var t=A.useRef(null),s=lNt(e.date,e.displayMonth,t);return s.isHidden?r.jsx("div",{role:"gridcell"}):s.isButton?r.jsx(Kre,Ua({name:"day",ref:t},s.buttonProps)):r.jsx("div",Ua({},s.divProps))}function dNt(e){var t=e.number,s=e.dates,n=dl(),a=n.onWeekNumberClick,o=n.styles,l=n.classNames,i=n.locale,u=n.labels.labelWeekNumber,m=n.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,s,b)};return r.jsx(Kre,{name:"week-number","aria-label":y,className:l.weeknumber,style:o.weeknumber,onClick:v,children:x})}function uNt(e){var t,s,n=dl(),a=n.styles,o=n.classNames,l=n.showWeekNumber,i=n.components,u=(t=i==null?void 0:i.Day)!==null&&t!==void 0?t:cNt,m=(s=i==null?void 0:i.WeekNumber)!==null&&s!==void 0?s:dNt,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})},Put(y))})]})}function BSe(e,t,s){for(var n=s!=null&&s.ISOWeek?U8e(t):iye(t,s),a=s!=null&&s.ISOWeek?Iy(e):Sm(e,s),o=kf(n,a),l=[],i=0;i<=o;i++)l.push(Jl(a,i));var u=l.reduce(function(m,x){var y=s!=null&&s.ISOWeek?oye(x):cye(x,s),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 hNt(e,t){var s=BSe(Rh(e),Wne(e),t);if(t!=null&&t.useFixedWeeks){var n=Out(e,t);if(n<6){var a=s[s.length-1],o=a.dates[a.dates.length-1],l=cj(o,6-n),i=BSe(cj(o,1),l,t);s.push.apply(s,i)}}return s}function mNt(e){var t,s,n,a=dl(),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=hNt(e.displayMonth,{useFixedWeeks:!!m,ISOWeek:b,locale:o,weekStartsOn:y,firstWeekContainsDate:v}),k=(t=x==null?void 0:x.Head)!==null&&t!==void 0?t:Mkt,M=(s=x==null?void 0:x.Row)!==null&&s!==void 0?s:uNt,E=(n=x==null?void 0:x.Footer)!==null&&n!==void 0?n:Nkt;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(E,{displayMonth:e.displayMonth})]})}function pNt(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var fNt=pNt()?A.useLayoutEffect:A.useEffect,Ede=!1,gNt=0;function $Se(){return"react-day-picker-".concat(++gNt)}function xNt(e){var t,s=e??(Ede?$Se():null),n=A.useState(s),a=n[0],o=n[1];return fNt(function(){a===null&&o($Se())},[]),A.useEffect(function(){Ede===!1&&(Ede=!0)},[]),(t=e??a)!==null&&t!==void 0?t:void 0}function yNt(e){var t,s,n=dl(),a=n.dir,o=n.classNames,l=n.styles,i=n.components,u=wP().displayMonths,m=xNt(n.id?"".concat(n.id,"-").concat(e.displayIndex):void 0),x=n.id?"".concat(n.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=Ua(Ua({},v),l.caption_start)),N&&(y.push(o.caption_end),v=Ua(Ua({},v),l.caption_end)),k&&(y.push(o.caption_between),v=Ua(Ua({},v),l.caption_between));var M=(s=i==null?void 0:i.Caption)!==null&&s!==void 0?s:kkt;return r.jsxs("div",{className:y.join(" "),style:v,children:[r.jsx(M,{id:m,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),r.jsx(mNt,{id:x,"aria-labelledby":m,displayMonth:e.displayMonth})]},e.displayIndex)}function vNt(e){var t=dl(),s=t.classNames,n=t.styles;return r.jsx("div",{className:s.months,style:n.months,children:e.children})}function _Nt(e){var t,s,n=e.initialProps,a=dl(),o=R0e(),l=wP(),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=Ua(Ua({},a.styles.root),a.style),v=Object.keys(n).filter(function(N){return N.startsWith("data-")}).reduce(function(N,k){var M;return Ua(Ua({},N),(M={},M[k]=n[k],M))},{}),b=(s=(t=n.components)===null||t===void 0?void 0:t.Months)!==null&&s!==void 0?s:vNt;return r.jsx("div",Ua({className:x.join(" "),style:y,dir:a.dir,id:a.id,nonce:n.nonce,title:n.title,lang:n.lang},v,{children:r.jsx(b,{children:l.displayMonths.map(function(N,k){return r.jsx(yNt,{displayIndex:k,displayMonth:N},k)})})}))}function bNt(e){var t=e.children,s=Hjt(e,["children"]);return r.jsx(dkt,{initialProps:s,children:r.jsx(_kt,{children:r.jsx(tNt,{initialProps:s,children:r.jsx(Akt,{initialProps:s,children:r.jsx(Pkt,{initialProps:s,children:r.jsx($kt,{children:r.jsx(Jkt,{children:t})})})})})})})}function wNt(e){return r.jsx(bNt,Ua({},e,{children:r.jsx(_Nt,{initialProps:e})}))}function Df({className:e,classNames:t,showOutsideDays:s=!0,...n}){return r.jsx(wNt,{showOutsideDays:s,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(DE({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(DE({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(Sc,{className:"h-4 w-4"}),IconRight:({...a})=>r.jsx(Zi,{className:"h-4 w-4"})},...n})}Df.displayName="Calendar";var Lae="Popover",[S9e]=uc(Lae,[ix]),jP=ix(),[jNt,Ov]=S9e(Lae),C9e=e=>{const{__scopePopover:t,children:s,open:n,defaultOpen:a,onOpenChange:o,modal:l=!1}=e,i=jP(t),u=A.useRef(null),[m,x]=A.useState(!1),[y,v]=ah({prop:n,defaultProp:a??!1,onChange:o,caller:Lae});return r.jsx(eP,{...i,children:r.jsx(jNt,{scope:t,contentId:yd(),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:s})})};C9e.displayName=Lae;var M9e="PopoverAnchor",kNt=A.forwardRef((e,t)=>{const{__scopePopover:s,...n}=e,a=Ov(M9e,s),o=jP(s),{onCustomAnchorAdd:l,onCustomAnchorRemove:i}=a;return A.useEffect(()=>(l(),()=>i()),[l,i]),r.jsx(C3,{...o,...n,ref:t})});kNt.displayName=M9e;var T9e="PopoverTrigger",A9e=A.forwardRef((e,t)=>{const{__scopePopover:s,...n}=e,a=Ov(T9e,s),o=jP(s),l=ha(t,a.triggerRef),i=r.jsx($s.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":O9e(a.open),...n,ref:l,onClick:xs(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?i:r.jsx(C3,{asChild:!0,...o,children:i})});A9e.displayName=T9e;var z0e="PopoverPortal",[NNt,SNt]=S9e(z0e,{forceMount:void 0}),E9e=e=>{const{__scopePopover:t,forceMount:s,children:n,container:a}=e,o=Ov(z0e,t);return r.jsx(NNt,{scope:t,forceMount:s,children:r.jsx(Ec,{present:s||o.open,children:r.jsx(w3,{asChild:!0,container:a,children:n})})})};E9e.displayName=z0e;var KC="PopoverContent",I9e=A.forwardRef((e,t)=>{const s=SNt(KC,e.__scopePopover),{forceMount:n=s.forceMount,...a}=e,o=Ov(KC,e.__scopePopover);return r.jsx(Ec,{present:n||o.open,children:o.modal?r.jsx(MNt,{...a,ref:t}):r.jsx(TNt,{...a,ref:t})})});I9e.displayName=KC;var CNt=mv("PopoverContent.RemoveScroll"),MNt=A.forwardRef((e,t)=>{const s=Ov(KC,e.__scopePopover),n=A.useRef(null),a=ha(t,n),o=A.useRef(!1);return A.useEffect(()=>{const l=n.current;if(l)return Ane(l)},[]),r.jsx(oP,{as:CNt,allowPinchZoom:!0,children:r.jsx(P9e,{...e,ref:a,trapFocus:s.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:xs(e.onCloseAutoFocus,l=>{var i;l.preventDefault(),o.current||(i=s.triggerRef.current)==null||i.focus()}),onPointerDownOutside:xs(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:xs(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),TNt=A.forwardRef((e,t)=>{const s=Ov(KC,e.__scopePopover),n=A.useRef(!1),a=A.useRef(!1);return r.jsx(P9e,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,i;(l=e.onCloseAutoFocus)==null||l.call(e,o),o.defaultPrevented||(n.current||(i=s.triggerRef.current)==null||i.focus(),o.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:o=>{var u,m;(u=e.onInteractOutside)==null||u.call(e,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=o.target;((m=s.triggerRef.current)==null?void 0:m.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}})}),P9e=A.forwardRef((e,t)=>{const{__scopePopover:s,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEscapeKeyDown:i,onPointerDownOutside:u,onFocusOutside:m,onInteractOutside:x,...y}=e,v=Ov(KC,s),b=jP(s);return Tne(),r.jsx(aP,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:o,children:r.jsx(kv,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:x,onEscapeKeyDown:i,onPointerDownOutside:u,onFocusOutside:m,onDismiss:()=>v.onOpenChange(!1),children:r.jsx(tP,{"data-state":O9e(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)"}})})})}),L9e="PopoverClose",ANt=A.forwardRef((e,t)=>{const{__scopePopover:s,...n}=e,a=Ov(L9e,s);return r.jsx($s.button,{type:"button",...n,ref:t,onClick:xs(e.onClick,()=>a.onOpenChange(!1))})});ANt.displayName=L9e;var ENt="PopoverArrow",INt=A.forwardRef((e,t)=>{const{__scopePopover:s,...n}=e,a=jP(s);return r.jsx(rP,{...a,...n,ref:t})});INt.displayName=ENt;function O9e(e){return e?"open":"closed"}var PNt=C9e,LNt=A9e,ONt=E9e,D9e=I9e;const Kc=PNt,Zc=LNt,Ac=A.forwardRef(({className:e,align:t="center",sideOffset:s=4,...n},a)=>r.jsx(ONt,{children:r.jsx(D9e,{ref:a,align:t,sideOffset:s,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),...n})}));Ac.displayName=D9e.displayName;const DNt=j3("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"}}),B0e=A.forwardRef(({className:e,variant:t,...s},n)=>r.jsx("div",{ref:n,role:"alert",className:Ut(DNt({variant:t}),e),...s}));B0e.displayName="Alert";const RNt=A.forwardRef(({className:e,...t},s)=>r.jsx("h5",{ref:s,className:Ut("mb-1 font-medium leading-none tracking-tight",e),...t}));RNt.displayName="AlertTitle";const $0e=A.forwardRef(({className:e,...t},s)=>r.jsx("div",{ref:s,className:Ut("text-sm [&_p]:leading-relaxed",e),...t}));$0e.displayName="AlertDescription";function FNt({open:e,onOpenChange:t,imageUrl:s,imageId:n,defaultCaption:a="",swagItemId:o,reelId:l}){const i=Br(),[u,m]=A.useState(a),[x,y]=A.useState([]),[v,b]=A.useState(null),[N,k]=A.useState("now"),[M,E]=A.useState(eNe(oNe(new Date),1)),[T,P]=A.useState("12"),[R,D]=A.useState("00"),[U,q]=A.useState("PM");A.useEffect(()=>{if(e){m(a),k("now"),y([]);const we=eNe(oNe(new Date),1);E(we);const tt=we.getHours();P(String(tt>12?tt-12:tt===0?12:tt)),D("00"),q(tt>=12?"PM":"AM")}},[e,a]);const H=()=>{if(!M)return null;let we=parseInt(T);const tt=parseInt(R);return U==="PM"&&we!==12&&(we+=12),U==="AM"&&we===12&&(we=0),X8e(Y8e(M,we),tt)},{data:G,isLoading:Q}=Kt({queryKey:["social-accounts-for-post"],queryFn:async()=>{const{data:{user:we}}=await Y.auth.getUser();if(!we)return[];const{data:tt,error:Ae}=await Y.from("social_accounts").select("*").eq("user_id",we.id).eq("is_active",!0).order("platform",{ascending:!0});if(Ae)throw Ae;return console.log("Fetched social accounts for posting:",tt),tt},enabled:e,staleTime:0}),ne=ar({mutationFn:async({accountId:we,platform:tt})=>{b(we);const{data:Ae,error:Le}=await Y.functions.invoke("social-post",{body:{platform:tt,accountId:we,imageUrl:s,caption:u}});if(Le)throw Le;if(Ae!=null&&Ae.error)throw new Error(Ae.error);return Ae},onSuccess:we=>{const tt=we.platform==="facebook"?"Facebook":we.platform==="instagram"?"Instagram":we.platform==="linkedin"?"LinkedIn":"Google Business";Te.success(`Posted to ${tt}!`)},onError:we=>{Te.error(`Failed to post: ${we.message}`)},onSettled:()=>{b(null)}}),ie=ar({mutationFn:async({accountId:we,platform:tt,scheduledFor:Ae})=>{const{data:{user:Le}}=await Y.auth.getUser();if(!Le)throw new Error("Not authenticated");const{error:Ue}=await Y.from("scheduled_posts").insert({user_id:Le.id,social_account_id:we,platform:tt,image_url:s,caption:u,swag_item_id:o||null,reel_id:l||null,scheduled_for:Ae.toISOString(),status:"scheduled"});if(Ue)throw Ue;return{platform:tt}},onSuccess:we=>{const tt=we.platform==="facebook"?"Facebook":we.platform==="instagram"?"Instagram":"LinkedIn";Te.success(`Post scheduled for ${tt}!`)},onError:we=>{Te.error(`Failed to schedule: ${we.message}`)}}),he=async()=>{if(x.length===0){Te.error("Please select at least one account");return}if(N==="schedule"){const we=H();if(!we||we<=new Date){Te.error("Please select a future date and time");return}for(const tt of x){const Ae=G==null?void 0:G.find(Le=>Le.id===tt);Ae&&await ie.mutateAsync({accountId:tt,platform:Ae.platform,scheduledFor:we})}i.invalidateQueries({queryKey:["scheduled-posts"]}),Te.success(`${x.length} post(s) scheduled for ${rs(we,"PPp")}`)}else for(const we of x){const tt=G==null?void 0:G.find(Ae=>Ae.id===we);tt&&await ne.mutateAsync({accountId:we,platform:tt.platform})}i.invalidateQueries({queryKey:["scheduled-posts"]}),m(""),y([]),t(!1)},se=we=>{y(tt=>tt.includes(we)?tt.filter(Ae=>Ae!==we):[...tt,we])},fe=(G==null?void 0:G.filter(we=>we.platform==="facebook"))||[],oe=(G==null?void 0:G.filter(we=>we.platform==="instagram"))||[],ce=(G==null?void 0:G.filter(we=>we.platform==="linkedin"))||[],de=(G==null?void 0:G.filter(we=>we.platform==="google_business"))||[],xe=((G==null?void 0:G.length)||0)>0,Me=ne.isPending||ie.isPending,ve=Array.from({length:12},(we,tt)=>String(tt+1)),be=["00","15","30","45"];return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Pr,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Create Social Post"}),r.jsx(Zs,{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:s,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(Ys,{id:"caption",placeholder:"Write a caption for your post...",value:u,onChange:we=>m(we.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(Ra,{className:"h-4 w-4"}),"Schedule for"]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(Kc,{children:[r.jsx(Zc,{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(jn,{className:"mr-2 h-4 w-4"}),M?rs(M,"PPP"):r.jsx("span",{children:"Pick a date"})]})}),r.jsx(Ac,{className:"w-auto p-0",align:"start",children:r.jsx(Df,{mode:"single",selected:M,onSelect:E,disabled:we=>wer.jsx($t,{value:we,children:we},we))})]}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsxs(us,{value:R,onValueChange:D,children:[r.jsx(cs,{className:"w-[70px]",children:r.jsx(ms,{})}),r.jsx(ds,{children:be.map(we=>r.jsx($t,{value:we,children:we},we))})]}),r.jsxs(us,{value:U,onValueChange:we=>q(we),children:[r.jsx(cs,{className:"w-[70px]",children:r.jsx(ms,{})}),r.jsxs(ds,{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 ",rs(H()||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(Vr,{className:"h-6 w-6 animate-spin"})}),!Q&&!xe&&r.jsxs(B0e,{children:[r.jsx(vl,{className:"h-4 w-4"}),r.jsxs($0e,{className:"flex flex-col gap-2",children:[r.jsx("span",{children:"No social accounts connected yet."}),r.jsxs(ho,{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"]})]})]}),fe.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(au,{className:"h-4 w-4 text-blue-600"})," Facebook"]}),fe.map(we=>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(bl,{checked:x.includes(we.id),onCheckedChange:()=>se(we.id),disabled:v===we.id}),r.jsxs(Xn,{className:"h-8 w-8",children:[r.jsx(ji,{src:we.profile_picture_url||""}),r.jsx(Qn,{children:r.jsx(au,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:we.page_name||we.platform_username}),v===we.id&&r.jsx(Vr,{className:"h-4 w-4 animate-spin"})]},we.id))]}),oe.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"]}),oe.map(we=>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(bl,{checked:x.includes(we.id),onCheckedChange:()=>se(we.id),disabled:v===we.id}),r.jsxs(Xn,{className:"h-8 w-8",children:[r.jsx(ji,{src:we.profile_picture_url||""}),r.jsx(Qn,{children:r.jsx(_u,{className:"h-4 w-4"})})]}),r.jsxs("span",{className:"flex-1 text-sm font-medium",children:["@",we.platform_username]}),v===we.id&&r.jsx(Vr,{className:"h-4 w-4 animate-spin"})]},we.id))]}),ce.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(vm,{className:"h-4 w-4 text-blue-700"})," LinkedIn"]}),ce.map(we=>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(bl,{checked:x.includes(we.id),onCheckedChange:()=>se(we.id),disabled:v===we.id}),r.jsxs(Xn,{className:"h-8 w-8",children:[r.jsx(ji,{src:we.profile_picture_url||""}),r.jsx(Qn,{children:r.jsx(vm,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:we.platform_username}),v===we.id&&r.jsx(Vr,{className:"h-4 w-4 animate-spin"})]},we.id))]}),de.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(po,{className:"h-4 w-4 text-red-600"})," Google Business"]}),de.map(we=>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(bl,{checked:x.includes(we.id),onCheckedChange:()=>se(we.id),disabled:v===we.id}),r.jsxs(Xn,{className:"h-8 w-8",children:[r.jsx(ji,{src:we.profile_picture_url||""}),r.jsx(Qn,{children:r.jsx(po,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:we.page_name||we.platform_username}),v===we.id&&r.jsx(Vr,{className:"h-4 w-4 animate-spin"})]},we.id))]})]})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsxs(X,{onClick:he,disabled:x.length===0||Me,className:"gap-2",children:[Me?r.jsx(Vr,{className:"h-4 w-4 animate-spin"}):N==="schedule"?r.jsx(jn,{className:"h-4 w-4"}):r.jsx(ro,{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 zNt(){const e=Br(),[t,s]=A.useState(void 0),[n,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:E=[],isLoading:T}=Kt({queryKey:["scheduled-posts"],queryFn:async()=>{const{data:de,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 de}}),P=E.filter(de=>{if(n!=="all"&&de.status!==n)return!1;if(t&&de.scheduled_for){const xe=new Date(de.scheduled_for);if(!ic(xe,t))return!1}return!0}),R=E.filter(de=>de.scheduled_for).map(de=>Cm(new Date(de.scheduled_for))),D=ar({mutationFn:async de=>{const{error:xe}=await Y.from("scheduled_posts").update({caption:de.caption,scheduled_for:de.scheduled_for}).eq("id",de.id);if(xe)throw xe},onSuccess:()=>{Te.success("Post updated!"),e.invalidateQueries({queryKey:["scheduled-posts"]}),l(null)},onError:de=>{Te.error(`Failed to update: ${de.message}`)}}),U=ar({mutationFn:async de=>{const{error:xe}=await Y.from("scheduled_posts").update({status:"cancelled"}).eq("id",de);if(xe)throw xe},onSuccess:()=>{Te.success("Post cancelled"),e.invalidateQueries({queryKey:["scheduled-posts"]})},onError:de=>{Te.error(`Failed to cancel: ${de.message}`)}}),q=ar({mutationFn:async de=>{const{error:xe}=await Y.from("scheduled_posts").delete().eq("id",de);if(xe)throw xe},onSuccess:()=>{Te.success("Post deleted"),e.invalidateQueries({queryKey:["scheduled-posts"]})},onError:de=>{Te.error(`Failed to delete: ${de.message}`)}}),H=ar({mutationFn:async de=>{const{data:xe,error:Me}=await Y.functions.invoke("social-post",{body:{platform:de.platform,accountId:de.social_account_id,imageUrl:de.image_url,caption:de.caption}});if(Me)throw Me;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",de.id),xe},onSuccess:de=>{const xe=de.platform==="facebook"?"Facebook":de.platform==="instagram"?"Instagram":"LinkedIn";Te.success(`Posted to ${xe}!`),e.invalidateQueries({queryKey:["scheduled-posts"]})},onError:de=>{Te.error(`Failed to post: ${de.message}`)}}),G=de=>{if(l(de),u(de.caption||""),de.scheduled_for){const xe=new Date(de.scheduled_for);x(xe);const Me=xe.getHours();v(String(Me>12?Me-12:Me===0?12:Me)),N(String(xe.getMinutes()).padStart(2,"0")),M(Me>=12?"PM":"AM")}},Q=()=>{if(!o||!m)return;let de=parseInt(y);const xe=parseInt(b);k==="PM"&&de!==12&&(de+=12),k==="AM"&&de===12&&(de=0);const Me=X8e(Y8e(m,de),xe);D.mutate({id:o.id,caption:i,scheduled_for:Me.toISOString()})},ne=de=>{switch(de){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(vm,{className:"h-4 w-4 text-blue-700"});default:return null}},ie=de=>{switch(de){case"scheduled":return r.jsxs(Tt,{variant:"secondary",className:"gap-1",children:[r.jsx(Ra,{className:"h-3 w-3"}),"Scheduled"]});case"posted":return r.jsxs(Tt,{variant:"default",className:"gap-1 bg-green-600",children:[r.jsx(ii,{className:"h-3 w-3"}),"Posted"]});case"failed":return r.jsxs(Tt,{variant:"destructive",className:"gap-1",children:[r.jsx(jc,{className:"h-3 w-3"}),"Failed"]});case"cancelled":return r.jsxs(Tt,{variant:"outline",className:"gap-1 text-muted-foreground",children:[r.jsx(vl,{className:"h-3 w-3"}),"Cancelled"]});default:return r.jsx(Tt,{variant:"outline",children:de})}},he=Array.from({length:12},(de,xe)=>String(xe+1)),se=["00","15","30","45"],fe=E.filter(de=>de.status==="scheduled").length,oe=E.filter(de=>de.status==="posted").length,ce=E.filter(de=>de.status==="scheduled"&&de.scheduled_for&&Dut(new Date(de.scheduled_for))).length;return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs(He,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:fe}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Scheduled"})]}),r.jsxs(He,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:ce}),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:oe}),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:E.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Total"})]})]}),r.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[r.jsxs(He,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(Af,{className:"h-5 w-5"}),r.jsx("h3",{className:"font-semibold",children:"Calendar"})]}),r.jsx(Df,{mode:"single",selected:t,onSelect:s,className:Ut("pointer-events-auto"),modifiers:{hasPost:R},modifiersStyles:{hasPost:{fontWeight:"bold",backgroundColor:"hsl(var(--primary) / 0.1)",borderRadius:"50%"}}}),t&&r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>s(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(G1,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:["all","scheduled","posted","failed","cancelled"].map(de=>r.jsx(X,{variant:n===de?"default":"outline",size:"sm",onClick:()=>a(de),className:"capitalize",children:de},de))})]}),T&&r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(Vr,{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(jn,{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 ${rs(t,"PPP")}`:"Schedule a post from Social Swag to get started!"})]}),r.jsx("div",{className:"space-y-4",children:P.map(de=>{var xe,Me;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:de.image_url,alt:"Post preview",className:"w-full h-full object-cover"})}),r.jsxs(Xe,{className:"flex-1 p-4",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2 mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[ne(de.platform),r.jsx("span",{className:"font-medium",children:((xe=de.social_accounts)==null?void 0:xe.page_name)||((Me=de.social_accounts)==null?void 0:Me.platform_username)||"Unknown"}),ie(de.status)]}),r.jsxs("div",{className:"flex items-center gap-1",children:[de.status==="scheduled"&&r.jsxs(sP,{children:[r.jsxs(Gg,{children:[r.jsx(Kg,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>G(de),children:r.jsx(Ja,{className:"h-4 w-4"})})}),r.jsx(Of,{children:"Edit post"})]}),r.jsxs(Gg,{children:[r.jsx(Kg,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>H.mutate(de),disabled:H.isPending,children:H.isPending?r.jsx(Vr,{className:"h-4 w-4 animate-spin"}):r.jsx(ro,{className:"h-4 w-4"})})}),r.jsx(Of,{children:"Post now"})]}),r.jsxs(Dd,{children:[r.jsx(Nf,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive",children:r.jsx(Bs,{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(Vc,{onClick:()=>U.mutate(de.id),className:"bg-amber-600 hover:bg-amber-700",children:"Cancel Post"}),r.jsx(Vc,{onClick:()=>q.mutate(de.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]}),(de.status==="posted"||de.status==="cancelled"||de.status==="failed")&&r.jsxs(Dd,{children:[r.jsx(Nf,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive",children:r.jsx(Bs,{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(Vc,{onClick:()=>q.mutate(de.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]})]}),de.caption&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-2",children:de.caption}),r.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(Ra,{className:"h-3 w-3"}),de.status==="posted"&&de.posted_at?`Posted ${rs(new Date(de.posted_at),"PPp")}`:de.scheduled_for?`Scheduled for ${rs(new Date(de.scheduled_for),"PPp")}`:"Not scheduled"]}),de.status==="failed"&&de.error_message&&r.jsxs("p",{className:"text-xs text-destructive mt-2",children:["Error: ",de.error_message]})]})]})},de.id)})})]})]}),r.jsx(Or,{open:!!o,onOpenChange:de=>!de&&l(null),children:r.jsxs(Pr,{className:"max-w-lg",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Edit Scheduled Post"}),r.jsx(Zs,{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(Ys,{value:i,onChange:de=>u(de.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(Kc,{children:[r.jsx(Zc,{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(jn,{className:"mr-2 h-4 w-4"}),m?rs(m,"PPP"):"Pick a date"]})}),r.jsx(Ac,{className:"w-auto p-0",align:"start",children:r.jsx(Df,{mode:"single",selected:m,onSelect:x,disabled:de=>der.jsx($t,{value:de,children:de},de))})]}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsxs(us,{value:b,onValueChange:N,children:[r.jsx(cs,{className:"w-[70px]",children:r.jsx(ms,{})}),r.jsx(ds,{children:se.map(de=>r.jsx($t,{value:de,children:de},de))})]}),r.jsxs(us,{value:k,onValueChange:de=>M(de),children:[r.jsx(cs,{className:"w-[70px]",children:r.jsx(ms,{})}),r.jsxs(ds,{children:[r.jsx($t,{value:"AM",children:"AM"}),r.jsx($t,{value:"PM",children:"PM"})]})]})]})]})]})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>l(null),children:"Cancel"}),r.jsxs(X,{onClick:Q,disabled:D.isPending,children:[D.isPending?r.jsx(Vr,{className:"h-4 w-4 animate-spin mr-2"}):null,"Save Changes"]})]})]})})]})}function MO(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 R9e={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(s){e.exports=s()})(function(){return function s(n,a,o){function l(m,x){if(!a[m]){if(!n[m]){var y=typeof MO=="function"&&MO;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:{}};n[m][0].call(b.exports,function(N){var k=n[m][1][N];return l(k||N)},b,b.exports,s,n,a,o)}return a[m].exports}for(var i=typeof MO=="function"&&MO,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(s,n,a){var o=s("./external"),l=s("./stream/DataWorker"),i=s("./stream/Crc32Probe"),u=s("./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)},n.exports=m},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(s,n,a){var o=s("./stream/GenericWorker");a.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},a.DEFLATE=s("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(s,n,a){var o=s("./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}();n.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(s,n,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(s,n,a){var o=null;o=typeof Promise<"u"?Promise:s("lie"),n.exports={Promise:o}},{lie:37}],7:[function(s,n,a){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",l=s("pako"),i=s("./utils"),u=s("./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(s,n,a){function o(b,N){var k,M="";for(k=0;k>>=8;return M}function l(b,N,k,M,E,T){var P,R,D=b.file,U=b.compression,q=T!==m.utf8encode,H=i.transformTo("string",T(D.name)),G=i.transformTo("string",m.utf8encode(D.name)),Q=D.comment,ne=i.transformTo("string",T(Q)),ie=i.transformTo("string",m.utf8encode(Q)),he=G.length!==D.name.length,se=ie.length!==Q.length,fe="",oe="",ce="",de=D.dir,xe=D.date,Me={crc32:0,compressedSize:0,uncompressedSize:0};N&&!k||(Me.crc32=b.crc32,Me.compressedSize=b.compressedSize,Me.uncompressedSize=b.uncompressedSize);var ve=0;N&&(ve|=8),q||!he&&!se||(ve|=2048);var be=0,we=0;de&&(be|=16),E==="UNIX"?(we=798,be|=function(Ae,Le){var Ue=Ae;return Ae||(Ue=Le?16893:33204),(65535&Ue)<<16}(D.unixPermissions,de)):(we=20,be|=function(Ae){return 63&(Ae||0)}(D.dosPermissions)),P=xe.getUTCHours(),P<<=6,P|=xe.getUTCMinutes(),P<<=5,P|=xe.getUTCSeconds()/2,R=xe.getUTCFullYear()-1980,R<<=4,R|=xe.getUTCMonth()+1,R<<=5,R|=xe.getUTCDate(),he&&(oe=o(1,1)+o(x(H),4)+G,fe+="up"+o(oe.length,2)+oe),se&&(ce=o(1,1)+o(x(ne),4)+ie,fe+="uc"+o(ce.length,2)+ce);var tt="";return tt+=` \0`,tt+=o(ve,2),tt+=U.magic,tt+=o(P,2),tt+=o(R,2),tt+=o(Me.crc32,4),tt+=o(Me.compressedSize,4),tt+=o(Me.uncompressedSize,4),tt+=o(H.length,2),tt+=o(fe.length,2),{fileRecord:y.LOCAL_FILE_HEADER+tt+H+fe,dirRecord:y.CENTRAL_FILE_HEADER+o(we,2)+tt+o(ne.length,2)+"\0\0\0\0"+o(be,4)+o(M,4)+H+fe+ne}}var i=s("../utils"),u=s("../stream/GenericWorker"),m=s("../utf8"),x=s("../crc32"),y=s("../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))}},n.exports=l},{"../utils":32}],19:[function(s,n,a){var o=s("./Uint8ArrayReader");function l(i){o.call(this,i)}s("../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},n.exports=l},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(s,n,a){var o=s("./DataReader");function l(i){o.call(this,i)}s("../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},n.exports=l},{"../utils":32,"./DataReader":18}],21:[function(s,n,a){var o=s("./ArrayReader");function l(i){o.call(this,i)}s("../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},n.exports=l},{"../utils":32,"./ArrayReader":17}],22:[function(s,n,a){var o=s("../utils"),l=s("../support"),i=s("./ArrayReader"),u=s("./StringReader"),m=s("./NodeBufferReader"),x=s("./Uint8ArrayReader");n.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(s,n,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(s,n,a){var o=s("./GenericWorker"),l=s("../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})},n.exports=i},{"../utils":32,"./GenericWorker":28}],25:[function(s,n,a){var o=s("./GenericWorker"),l=s("../crc32");function i(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}s("../utils").inherits(i,o),i.prototype.processChunk=function(u){this.streamInfo.crc32=l(u.data,this.streamInfo.crc32||0),this.push(u)},n.exports=i},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(s,n,a){var o=s("../utils"),l=s("./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)},n.exports=i},{"../utils":32,"./GenericWorker":28}],27:[function(s,n,a){var o=s("../utils"),l=s("./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}})},n.exports=i},{"../utils":32,"./GenericWorker":28}],28:[function(s,n,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}},n.exports=o},{}],29:[function(s,n,a){var o=s("../utils"),l=s("./ConvertWorker"),i=s("./GenericWorker"),u=s("../base64"),m=s("../support"),x=s("../external"),y=null;if(m.nodestream)try{y=s("../nodejs/NodejsStreamOutputAdapter")}catch{}function v(N,k){return new x.Promise(function(M,E){var T=[],P=N._internalType,R=N._outputType,D=N._mimeType;N.on("data",function(U,q){T.push(U),k&&k(q)}).on("error",function(U){T=[],E(U)}).on("end",function(){try{var U=function(q,H,G){switch(q){case"blob":return o.newBlob(o.transformTo("arraybuffer",H),G);case"base64":return u.encode(H);default:return o.transformTo(q,H)}}(R,function(q,H){var G,Q=0,ne=null,ie=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=!!s("readable-stream").Readable}catch{a.nodestream=!1}},{"readable-stream":16}],31:[function(s,n,a){for(var o=s("./utils"),l=s("./support"),i=s("./nodejsUtils"),u=s("./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,E,T,P,R=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,E,T,P=N.length,R=new Array(2*P);for(k=M=0;k>10&1023,R[M++]=56320|1023&E)}return R.length!==M&&(R.subarray?R=R.subarray(0,M):R.length=M),o.applyFromCharCode(R)}(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 R;for((P=P||T.length)>T.length&&(P=T.length),R=P-1;0<=R&&(192&T[R])==128;)R--;return R<0||R===0?P:R+m[T[R]]>P?R:P}(N),E=N;M!==N.length&&(l.uint8array?(E=N.subarray(0,M),this.leftOver=N.subarray(M,N.length)):(E=N.slice(0,M),this.leftOver=N.slice(M,N.length))),this.push({data:a.utf8decode(E),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(s,n,a){var o=s("./support"),l=s("./base64"),i=s("./nodejsUtils"),u=s("./external");function m(k){return k}function x(k,M){for(var E=0;E>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,E=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(s,n,a){n.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}();n.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(s,n,a){var o,l=s("../utils/common"),i=s("./trees"),u=s("./adler32"),m=s("./crc32"),x=s("./messages"),y=0,v=4,b=0,N=-2,k=-1,M=4,E=2,T=8,P=9,R=286,D=30,U=19,q=2*R+1,H=15,G=3,Q=258,ne=Q+G+1,ie=42,he=113,se=1,fe=2,oe=3,ce=4;function de(le,Ve){return le.msg=x[Ve],Ve}function xe(le){return(le<<1)-(4le.avail_out&&(Je=le.avail_out),Je!==0&&(l.arraySet(le.output,Ve.pending_buf,Ve.pending_out,Je,le.next_out),le.next_out+=Je,Ve.pending_out+=Je,le.total_out+=Je,le.avail_out-=Je,Ve.pending-=Je,Ve.pending===0&&(Ve.pending_out=0))}function be(le,Ve){i._tr_flush_block(le,0<=le.block_start?le.block_start:-1,le.strstart-le.block_start,Ve),le.block_start=le.strstart,ve(le.strm)}function we(le,Ve){le.pending_buf[le.pending++]=Ve}function tt(le,Ve){le.pending_buf[le.pending++]=Ve>>>8&255,le.pending_buf[le.pending++]=255&Ve}function Ae(le,Ve){var Je,rt,je=le.max_chain_length,lt=le.strstart,Ce=le.prev_length,Ie=le.nice_match,Ze=le.strstart>le.w_size-ne?le.strstart-(le.w_size-ne):0,De=le.window,Ke=le.w_mask,st=le.prev,dt=le.strstart+Q,ct=De[lt+Ce-1],zt=De[lt+Ce];le.prev_length>=le.good_match&&(je>>=2),Ie>le.lookahead&&(Ie=le.lookahead);do if(De[(Je=Ve)+Ce]===zt&&De[Je+Ce-1]===ct&&De[Je]===De[lt]&&De[++Je]===De[lt+1]){lt+=2,Je++;do;while(De[++lt]===De[++Je]&&De[++lt]===De[++Je]&&De[++lt]===De[++Je]&&De[++lt]===De[++Je]&&De[++lt]===De[++Je]&&De[++lt]===De[++Je]&&De[++lt]===De[++Je]&&De[++lt]===De[++Je]&<Ze&&--je!=0);return Ce<=le.lookahead?Ce:le.lookahead}function Le(le){var Ve,Je,rt,je,lt,Ce,Ie,Ze,De,Ke,st=le.w_size;do{if(je=le.window_size-le.lookahead-le.strstart,le.strstart>=st+(st-ne)){for(l.arraySet(le.window,le.window,st,st,0),le.match_start-=st,le.strstart-=st,le.block_start-=st,Ve=Je=le.hash_size;rt=le.head[--Ve],le.head[Ve]=st<=rt?rt-st:0,--Je;);for(Ve=Je=st;rt=le.prev[--Ve],le.prev[Ve]=st<=rt?rt-st:0,--Je;);je+=st}if(le.strm.avail_in===0)break;if(Ce=le.strm,Ie=le.window,Ze=le.strstart+le.lookahead,De=je,Ke=void 0,Ke=Ce.avail_in,De=G)for(lt=le.strstart-le.insert,le.ins_h=le.window[lt],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&&(Je=le.pending_buf_size-5);;){if(le.lookahead<=1){if(Le(le),le.lookahead===0&&Ve===y)return se;if(le.lookahead===0)break}le.strstart+=le.lookahead,le.lookahead=0;var rt=le.block_start+Je;if((le.strstart===0||le.strstart>=rt)&&(le.lookahead=le.strstart-rt,le.strstart=rt,be(le,!1),le.strm.avail_out===0)||le.strstart-le.block_start>=le.w_size-ne&&(be(le,!1),le.strm.avail_out===0))return se}return le.insert=0,Ve===v?(be(le,!0),le.strm.avail_out===0?oe:ce):(le.strstart>le.block_start&&(be(le,!1),le.strm.avail_out),se)}),new $e(4,4,8,4,Ue),new $e(4,5,16,8,Ue),new $e(4,6,32,32,Ue),new $e(4,4,16,16,Pe),new $e(8,16,32,32,Pe),new $e(8,16,128,128,Pe),new $e(8,32,128,256,Pe),new $e(32,128,258,1024,Pe),new $e(32,258,258,4096,Pe)],a.deflateInit=function(le,Ve){return et(le,Ve,T,15,8,0)},a.deflateInit2=et,a.deflateReset=Ee,a.deflateResetKeep=xt,a.deflateSetHeader=function(le,Ve){return le&&le.state?le.state.wrap!==2?N:(le.state.gzhead=Ve,b):N},a.deflate=function(le,Ve){var Je,rt,je,lt;if(!le||!le.state||5>8&255),we(rt,rt.gzhead.time>>16&255),we(rt,rt.gzhead.time>>24&255),we(rt,rt.level===9?2:2<=rt.strategy||rt.level<2?4:0),we(rt,255&rt.gzhead.os),rt.gzhead.extra&&rt.gzhead.extra.length&&(we(rt,255&rt.gzhead.extra.length),we(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):(we(rt,0),we(rt,0),we(rt,0),we(rt,0),we(rt,0),we(rt,rt.level===9?2:2<=rt.strategy||rt.level<2?4:0),we(rt,3),rt.status=he);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=he,tt(rt,Ce),rt.strstart!==0&&(tt(rt,le.adler>>>16),tt(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)),ve(le),je=rt.pending,rt.pending!==rt.pending_buf_size));)we(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)),ve(le),je=rt.pending,rt.pending===rt.pending_buf_size)){lt=1;break}lt=rt.gzindexje&&(le.adler=m(le.adler,rt.pending_buf,rt.pending-je,je)),lt===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)),ve(le),je=rt.pending,rt.pending===rt.pending_buf_size)){lt=1;break}lt=rt.gzindexje&&(le.adler=m(le.adler,rt.pending_buf,rt.pending-je,je)),lt===0&&(rt.status=103)}else rt.status=103;if(rt.status===103&&(rt.gzhead.hcrc?(rt.pending+2>rt.pending_buf_size&&ve(le),rt.pending+2<=rt.pending_buf_size&&(we(rt,255&le.adler),we(rt,le.adler>>8&255),le.adler=0,rt.status=he)):rt.status=he),rt.pending!==0){if(ve(le),le.avail_out===0)return rt.last_flush=-1,b}else if(le.avail_in===0&&xe(Ve)<=xe(Je)&&Ve!==v)return de(le,-5);if(rt.status===666&&le.avail_in!==0)return de(le,-5);if(le.avail_in!==0||rt.lookahead!==0||Ve!==y&&rt.status!==666){var Ie=rt.strategy===2?function(Ze,De){for(var Ke;;){if(Ze.lookahead===0&&(Le(Ze),Ze.lookahead===0)){if(De===y)return se;break}if(Ze.match_length=0,Ke=i._tr_tally(Ze,0,Ze.window[Ze.strstart]),Ze.lookahead--,Ze.strstart++,Ke&&(be(Ze,!1),Ze.strm.avail_out===0))return se}return Ze.insert=0,De===v?(be(Ze,!0),Ze.strm.avail_out===0?oe:ce):Ze.last_lit&&(be(Ze,!1),Ze.strm.avail_out===0)?se:fe}(rt,Ve):rt.strategy===3?function(Ze,De){for(var Ke,st,dt,ct,zt=Ze.window;;){if(Ze.lookahead<=Q){if(Le(Ze),Ze.lookahead<=Q&&De===y)return se;if(Ze.lookahead===0)break}if(Ze.match_length=0,Ze.lookahead>=G&&0Ze.lookahead&&(Ze.match_length=Ze.lookahead)}if(Ze.match_length>=G?(Ke=i._tr_tally(Ze,1,Ze.match_length-G),Ze.lookahead-=Ze.match_length,Ze.strstart+=Ze.match_length,Ze.match_length=0):(Ke=i._tr_tally(Ze,0,Ze.window[Ze.strstart]),Ze.lookahead--,Ze.strstart++),Ke&&(be(Ze,!1),Ze.strm.avail_out===0))return se}return Ze.insert=0,De===v?(be(Ze,!0),Ze.strm.avail_out===0?oe:ce):Ze.last_lit&&(be(Ze,!1),Ze.strm.avail_out===0)?se:fe}(rt,Ve):o[rt.level].func(rt,Ve);if(Ie!==oe&&Ie!==ce||(rt.status=666),Ie===se||Ie===oe)return le.avail_out===0&&(rt.last_flush=-1),b;if(Ie===fe&&(Ve===1?i._tr_align(rt):Ve!==5&&(i._tr_stored_block(rt,0,0,!1),Ve===3&&(Me(rt.head),rt.lookahead===0&&(rt.strstart=0,rt.block_start=0,rt.insert=0))),ve(le),le.avail_out===0))return rt.last_flush=-1,b}return Ve!==v?b:rt.wrap<=0?1:(rt.wrap===2?(we(rt,255&le.adler),we(rt,le.adler>>8&255),we(rt,le.adler>>16&255),we(rt,le.adler>>24&255),we(rt,255&le.total_in),we(rt,le.total_in>>8&255),we(rt,le.total_in>>16&255),we(rt,le.total_in>>24&255)):(tt(rt,le.adler>>>16),tt(rt,65535&le.adler)),ve(le),0=Je.w_size&&(lt===0&&(Me(Je.head),Je.strstart=0,Je.block_start=0,Je.insert=0),De=new l.Buf8(Je.w_size),l.arraySet(De,Ve,Ke-Je.w_size,Je.w_size,0),Ve=De,Ke=Je.w_size),Ce=le.avail_in,Ie=le.next_in,Ze=le.input,le.avail_in=Ke,le.next_in=0,le.input=Ve,Le(Je);Je.lookahead>=G;){for(rt=Je.strstart,je=Je.lookahead-(G-1);Je.ins_h=(Je.ins_h<>>=G=H>>>24,P-=G,(G=H>>>16&255)===0)fe[x++]=65535&H;else{if(!(16&G)){if(!(64&G)){H=R[(65535&H)+(T&(1<>>=G,P-=G),P<15&&(T+=se[u++]<>>=G=H>>>24,P-=G,!(16&(G=H>>>16&255))){if(!(64&G)){H=D[(65535&H)+(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)+(ie>>>8&65280)+((65280&ie)<<8)+((255&ie)<<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(ie){var he;return ie&&ie.state?(he=ie.state,ie.total_in=ie.total_out=he.total=0,ie.msg="",he.wrap&&(ie.adler=1&he.wrap),he.mode=N,he.last=0,he.havedict=0,he.dmax=32768,he.head=null,he.hold=0,he.bits=0,he.lencode=he.lendyn=new o.Buf32(k),he.distcode=he.distdyn=new o.Buf32(M),he.sane=1,he.back=-1,v):b}function R(ie){var he;return ie&&ie.state?((he=ie.state).wsize=0,he.whave=0,he.wnext=0,P(ie)):b}function D(ie,he){var se,fe;return ie&&ie.state?(fe=ie.state,he<0?(se=0,he=-he):(se=1+(he>>4),he<48&&(he&=15)),he&&(he<8||15=ce.wsize?(o.arraySet(ce.window,he,se-ce.wsize,ce.wsize,0),ce.wnext=0,ce.whave=ce.wsize):(fe<(oe=ce.wsize-ce.wnext)&&(oe=fe),o.arraySet(ce.window,he,se-fe,oe,ce.wnext),(fe-=oe)?(o.arraySet(ce.window,he,se-fe,fe,0),ce.wnext=fe,ce.whave=ce.wsize):(ce.wnext+=oe,ce.wnext===ce.wsize&&(ce.wnext=0),ce.whave>>8&255,se.check=i(se.check,lt,2,0),be=ve=0,se.mode=2;break}if(se.flags=0,se.head&&(se.head.done=!1),!(1&se.wrap)||(((255&ve)<<8)+(ve>>8))%31){ie.msg="incorrect header check",se.mode=30;break}if((15&ve)!=8){ie.msg="unknown compression method",se.mode=30;break}if(be-=4,le=8+(15&(ve>>>=4)),se.wbits===0)se.wbits=le;else if(le>se.wbits){ie.msg="invalid window size",se.mode=30;break}se.dmax=1<>8&1),512&se.flags&&(lt[0]=255&ve,lt[1]=ve>>>8&255,se.check=i(se.check,lt,2,0)),be=ve=0,se.mode=3;case 3:for(;be<32;){if(xe===0)break e;xe--,ve+=fe[ce++]<>>8&255,lt[2]=ve>>>16&255,lt[3]=ve>>>24&255,se.check=i(se.check,lt,4,0)),be=ve=0,se.mode=4;case 4:for(;be<16;){if(xe===0)break e;xe--,ve+=fe[ce++]<>8),512&se.flags&&(lt[0]=255&ve,lt[1]=ve>>>8&255,se.check=i(se.check,lt,2,0)),be=ve=0,se.mode=5;case 5:if(1024&se.flags){for(;be<16;){if(xe===0)break e;xe--,ve+=fe[ce++]<>>8&255,se.check=i(se.check,lt,2,0)),be=ve=0}else se.head&&(se.head.extra=null);se.mode=6;case 6:if(1024&se.flags&&(xe<(Ae=se.length)&&(Ae=xe),Ae&&(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,fe,ce,Ae,le)),512&se.flags&&(se.check=i(se.check,fe,Ae,ce)),xe-=Ae,ce+=Ae,se.length-=Ae),se.length))break e;se.length=0,se.mode=7;case 7:if(2048&se.flags){if(xe===0)break e;for(Ae=0;le=fe[ce+Ae++],se.head&&le&&se.length<65536&&(se.head.name+=String.fromCharCode(le)),le&&Ae>9&1,se.head.done=!0),ie.adler=se.check=0,se.mode=12;break;case 10:for(;be<32;){if(xe===0)break e;xe--,ve+=fe[ce++]<>>=7&be,be-=7&be,se.mode=27;break}for(;be<3;){if(xe===0)break e;xe--,ve+=fe[ce++]<>>=1)){case 0:se.mode=14;break;case 1:if(Q(se),se.mode=20,he!==6)break;ve>>>=2,be-=2;break e;case 2:se.mode=17;break;case 3:ie.msg="invalid block type",se.mode=30}ve>>>=2,be-=2;break;case 14:for(ve>>>=7&be,be-=7&be;be<32;){if(xe===0)break e;xe--,ve+=fe[ce++]<>>16^65535)){ie.msg="invalid stored block lengths",se.mode=30;break}if(se.length=65535&ve,be=ve=0,se.mode=15,he===6)break e;case 15:se.mode=16;case 16:if(Ae=se.length){if(xe>>=5,be-=5,se.ndist=1+(31&ve),ve>>>=5,be-=5,se.ncode=4+(15&ve),ve>>>=4,be-=4,286>>=3,be-=3}for(;se.have<19;)se.lens[Ce[se.have++]]=0;if(se.lencode=se.lendyn,se.lenbits=7,Je={bits:se.lenbits},Ve=m(0,se.lens,0,19,se.lencode,0,se.work,Je),se.lenbits=Je.bits,Ve){ie.msg="invalid code lengths set",se.mode=30;break}se.have=0,se.mode=19;case 19:for(;se.have>>16&255,it=65535&je,!((Pe=je>>>24)<=be);){if(xe===0)break e;xe--,ve+=fe[ce++]<>>=Pe,be-=Pe,se.lens[se.have++]=it;else{if(it===16){for(rt=Pe+2;be>>=Pe,be-=Pe,se.have===0){ie.msg="invalid bit length repeat",se.mode=30;break}le=se.lens[se.have-1],Ae=3+(3&ve),ve>>>=2,be-=2}else if(it===17){for(rt=Pe+3;be>>=Pe)),ve>>>=3,be-=3}else{for(rt=Pe+7;be>>=Pe)),ve>>>=7,be-=7}if(se.have+Ae>se.nlen+se.ndist){ie.msg="invalid bit length repeat",se.mode=30;break}for(;Ae--;)se.lens[se.have++]=le}}if(se.mode===30)break;if(se.lens[256]===0){ie.msg="invalid code -- missing end-of-block",se.mode=30;break}if(se.lenbits=9,Je={bits:se.lenbits},Ve=m(x,se.lens,0,se.nlen,se.lencode,0,se.work,Je),se.lenbits=Je.bits,Ve){ie.msg="invalid literal/lengths set",se.mode=30;break}if(se.distbits=6,se.distcode=se.distdyn,Je={bits:se.distbits},Ve=m(y,se.lens,se.nlen,se.ndist,se.distcode,0,se.work,Je),se.distbits=Je.bits,Ve){ie.msg="invalid distances set",se.mode=30;break}if(se.mode=20,he===6)break e;case 20:se.mode=21;case 21:if(6<=xe&&258<=Me){ie.next_out=de,ie.avail_out=Me,ie.next_in=ce,ie.avail_in=xe,se.hold=ve,se.bits=be,u(ie,tt),de=ie.next_out,oe=ie.output,Me=ie.avail_out,ce=ie.next_in,fe=ie.input,xe=ie.avail_in,ve=se.hold,be=se.bits,se.mode===12&&(se.back=-1);break}for(se.back=0;$e=(je=se.lencode[ve&(1<>>16&255,it=65535&je,!((Pe=je>>>24)<=be);){if(xe===0)break e;xe--,ve+=fe[ce++]<>xt)])>>>16&255,it=65535&je,!(xt+(Pe=je>>>24)<=be);){if(xe===0)break e;xe--,ve+=fe[ce++]<>>=xt,be-=xt,se.back+=xt}if(ve>>>=Pe,be-=Pe,se.back+=Pe,se.length=it,$e===0){se.mode=26;break}if(32&$e){se.back=-1,se.mode=12;break}if(64&$e){ie.msg="invalid literal/length code",se.mode=30;break}se.extra=15&$e,se.mode=22;case 22:if(se.extra){for(rt=se.extra;be>>=se.extra,be-=se.extra,se.back+=se.extra}se.was=se.length,se.mode=23;case 23:for(;$e=(je=se.distcode[ve&(1<>>16&255,it=65535&je,!((Pe=je>>>24)<=be);){if(xe===0)break e;xe--,ve+=fe[ce++]<>xt)])>>>16&255,it=65535&je,!(xt+(Pe=je>>>24)<=be);){if(xe===0)break e;xe--,ve+=fe[ce++]<>>=xt,be-=xt,se.back+=xt}if(ve>>>=Pe,be-=Pe,se.back+=Pe,64&$e){ie.msg="invalid distance code",se.mode=30;break}se.offset=it,se.extra=15&$e,se.mode=24;case 24:if(se.extra){for(rt=se.extra;be>>=se.extra,be-=se.extra,se.back+=se.extra}if(se.offset>se.dmax){ie.msg="invalid distance too far back",se.mode=30;break}se.mode=25;case 25:if(Me===0)break e;if(Ae=tt-Me,se.offset>Ae){if((Ae=se.offset-Ae)>se.whave&&se.sane){ie.msg="invalid distance too far back",se.mode=30;break}Le=Ae>se.wnext?(Ae-=se.wnext,se.wsize-Ae):se.wnext-Ae,Ae>se.length&&(Ae=se.length),Ue=se.window}else Ue=oe,Le=de-se.offset,Ae=se.length;for(Meq?(G=Le[Ue+M[he]],be[we+M[he]]):(G=96,0),T=1<>de)+(P-=T)]=H<<24|G<<16|Q|0,P!==0;);for(T=1<>=1;if(T!==0?(ve&=T-1,ve+=T):ve=0,he++,--tt[ie]==0){if(ie===fe)break;ie=y[v+M[he]]}if(oe>>7)]}function we(je,lt){je.pending_buf[je.pending++]=255<,je.pending_buf[je.pending++]=lt>>>8&255}function tt(je,lt,Ce){je.bi_valid>E-Ce?(je.bi_buf|=lt<>E-je.bi_valid,je.bi_valid+=Ce-E):(je.bi_buf|=lt<>>=1,Ce<<=1,0<--lt;);return Ce>>>1}function Ue(je,lt,Ce){var Ie,Ze,De=new Array(M+1),Ke=0;for(Ie=1;Ie<=M;Ie++)De[Ie]=Ke=Ke+Ce[Ie-1]<<1;for(Ze=0;Ze<=lt;Ze++){var st=je[2*Ze+1];st!==0&&(je[2*Ze]=Le(De[st]++,st))}}function Pe(je){var lt;for(lt=0;lt>1;1<=Ce;Ce--)xt(je,De,Ce);for(Ze=dt;Ce=je.heap[1],je.heap[1]=je.heap[je.heap_len--],xt(je,De,1),Ie=je.heap[1],je.heap[--je.heap_max]=Ce,je.heap[--je.heap_max]=Ie,De[2*Ze]=De[2*Ce]+De[2*Ie],je.depth[Ze]=(je.depth[Ce]>=je.depth[Ie]?je.depth[Ce]:je.depth[Ie])+1,De[2*Ce+1]=De[2*Ie+1]=Ze,je.heap[1]=Ze++,xt(je,De,1),2<=je.heap_len;);je.heap[--je.heap_max]=je.heap[1],function(zt,ir){var Tr,Zr,$r,ns,Xs,Ot,Hr=ir.dyn_tree,Ts=ir.max_code,zs=ir.stat_desc.static_tree,wa=ir.stat_desc.has_stree,gi=ir.stat_desc.extra_bits,Ao=ir.stat_desc.extra_base,Ga=ir.stat_desc.max_length,mn=0;for(ns=0;ns<=M;ns++)zt.bl_count[ns]=0;for(Hr[2*zt.heap[zt.heap_max]+1]=0,Tr=zt.heap_max+1;Tr>=7;Ze>>=1)if(1&ct&&st.dyn_ltree[2*dt]!==0)return l;if(st.dyn_ltree[18]!==0||st.dyn_ltree[20]!==0||st.dyn_ltree[26]!==0)return i;for(dt=32;dt>>3,(De=je.static_len+3+7>>>3)<=Ze&&(Ze=De)):Ze=De=Ce+5,Ce+4<=Ze&<!==-1?rt(je,lt,Ce,Ie):je.strategy===4||De===Ze?(tt(je,2+(Ie?1:0),3),Ee(je,ne,ie)):(tt(je,4+(Ie?1:0),3),function(st,dt,ct,zt){var ir;for(tt(st,dt-257,5),tt(st,ct-1,5),tt(st,zt-4,4),ir=0;ir>>8&255,je.pending_buf[je.d_buf+2*je.last_lit+1]=255<,je.pending_buf[je.l_buf+je.last_lit]=255&Ce,je.last_lit++,lt===0?je.dyn_ltree[2*Ce]++:(je.matches++,lt--,je.dyn_ltree[2*(se[Ce]+y+1)]++,je.dyn_dtree[2*be(lt)]++),je.last_lit===je.lit_bufsize-1},a._tr_align=function(je){tt(je,2,3),Ae(je,P,ne),function(lt){lt.bi_valid===16?(we(lt,lt.bi_buf),lt.bi_buf=0,lt.bi_valid=0):8<=lt.bi_valid&&(lt.pending_buf[lt.pending++]=255<.bi_buf,lt.bi_buf>>=8,lt.bi_valid-=8)}(je)}},{"../utils/common":41}],53:[function(s,n,a){n.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(s,n,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(R){process.nextTick(function(){T(R)})}:function(){if(l.postMessage&&!l.importScripts){var R=!0,D=l.onmessage;return l.onmessage=function(){R=!1},l.postMessage("","*"),l.onmessage=D,R}}()?(y="setImmediate$"+Math.random()+"$",l.addEventListener?l.addEventListener("message",P,!1):l.attachEvent("onmessage",P),function(R){l.postMessage(y+R,"*")}):l.MessageChannel?((x=new MessageChannel).port1.onmessage=function(R){T(R.data)},function(R){x.port2.postMessage(R)}):k&&"onreadystatechange"in k.createElement("script")?(m=k.documentElement,function(R){var D=k.createElement("script");D.onreadystatechange=function(){T(R),D.onreadystatechange=null,m.removeChild(D),D=null},m.appendChild(D)}):function(R){setTimeout(T,0,R)},M.setImmediate=function(R){typeof R!="function"&&(R=new Function(""+R));for(var D=new Array(arguments.length-1),U=0;U"u"?o===void 0?this:o:self)}).call(this,typeof Jx<"u"?Jx:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(R9e);var BNt=R9e.exports;const $Nt=no(BNt);function Ide(e,t=400,s=75){return e&&`${e.replace("/storage/v1/object/public/","/storage/v1/render/image/public/")}?width=${t}&quality=${s}&resize=contain`}const UNt=()=>{const{isAdmin:e}=Yr(),[t,s]=A.useState(null),[n,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:E=[],isLoading:T}=Kt({queryKey:["social-swag-2"],queryFn:async()=>{const{data:xe,error:Me}=await Y.from("social_swag_2").select("*").order("month",{ascending:!1}).order("sort_order");if(Me)throw Me;return xe}}),{data:P=[]}=Kt({queryKey:["social-swag-2-months"],queryFn:async()=>{const{data:xe,error:Me}=await Y.from("social_swag_2_months").select("*").order("month",{ascending:!1});if(Me)throw Me;return xe}}),{data:R=[]}=Kt({queryKey:["social-swag-2-reels"],queryFn:async()=>{const{data:xe,error:Me}=await Y.from("social_swag_2_reels").select("*").order("month",{ascending:!1});if(Me)throw Me;return xe}}),{data:D=[]}=Kt({queryKey:["my-social-accounts-count"],queryFn:async()=>{const{data:xe,error:Me}=await Y.from("social_accounts").select("id, platform").eq("is_active",!0);if(Me)throw Me;return xe||[]}}),U=D.length>0,q=A.useMemo(()=>o==="all"?null:R.find(xe=>xe.month===o)||null,[o,R]),H=A.useMemo(()=>[...new Set(E.map(Me=>Me.month))].sort((Me,ve)=>ve.localeCompare(Me)),[E]);A.useEffect(()=>{H.length>0&&o==="all"&&l(H[0])},[H,o]);const G=xe=>{try{const Me=hye(xe,"yyyy-MM",new Date);return rs(Me,"MMMM yyyy")}catch{return xe}},Q=A.useMemo(()=>o==="all"?E:E.filter(xe=>xe.month===o),[o,E]),ne=A.useMemo(()=>{var xe;return o==="all"?null:((xe=P.find(Me=>Me.month===o))==null?void 0:xe.canva_link)||null},[o,P]),ie=async xe=>{try{await navigator.clipboard.writeText(xe),Te.success("Caption copied to clipboard!")}catch{Te.error("Failed to copy caption")}},he=async(xe,Me)=>{try{const be=await(await fetch(xe)).blob(),we=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),tt=navigator.canShare&&navigator.canShare({files:[new File([be],"test.jpg",{type:"image/jpeg"})]});if(we&&tt){const Ae=new File([be],`social-swag-${Me}.jpg`,{type:"image/jpeg"});await navigator.share({files:[Ae],title:"Social Swag Image"}),Te.success("Image ready to save!")}else{const Ae=window.URL.createObjectURL(be),Le=document.createElement("a");Le.href=Ae,Le.download=`social-swag-${Me}.jpg`,document.body.appendChild(Le),Le.click(),document.body.removeChild(Le),window.URL.revokeObjectURL(Ae),Te.success("Image downloaded!")}}catch(ve){ve.name!=="AbortError"&&Te.error("Failed to download image")}},se=xe=>{u(Me=>{const ve=new Set(Me);return ve.has(xe)?ve.delete(xe):ve.add(xe),ve})},fe=()=>{u(new Set(Q.map(xe=>xe.id)))},oe=()=>{u(new Set),x(!1)},ce=async()=>{const xe=Q.filter(Me=>i.has(Me.id));if(xe.length===0){Te.error("No images selected");return}v(!0),Te.info(`Preparing ${xe.length} images for download...`);try{const Me=new $Nt,ve=[...xe].sort((Le,Ue)=>Le.sort_order-Ue.sort_order);for(let Le=0;Le{m?se(xe.id):s(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(Bn,{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(El,{className:"h-3 w-3 mr-1"}),E.length," images"]})]}),r.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-3",children:"Social Swag 📸"}),r.jsx("p",{className:"text-lg text-primary-foreground/90 max-w-2xl",children:"Ready-to-post social media images delivered to you monthly. Just download, copy the caption, and share with your audience!"})]})]}),e?r.jsxs(Si,{defaultValue:"gallery",className:"space-y-6",children:[r.jsxs(ki,{className:"grid w-full max-w-md grid-cols-2",children:[r.jsxs(is,{value:"gallery",className:"gap-2",children:[r.jsx(El,{className:"h-4 w-4"}),"Gallery"]}),r.jsxs(is,{value:"scheduled",className:"gap-2",children:[r.jsx(Af,{className:"h-4 w-4"}),"Scheduled"]})]}),r.jsxs(Ss,{value:"gallery",className:"space-y-6",children:[e?U?r.jsx(He,{className:"border rounded-xl",children:r.jsx(Xe,{className:"p-6",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-muted text-2xl",children:"📸"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-foreground mb-1",children:"Ready to post!"}),r.jsx("p",{className:"text-muted-foreground",children:'Click any image and use "Create Post" to share directly to your connected accounts.'})]}),r.jsx(X,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:r.jsx(ho,{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(Xe,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(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(ho,{to:"/social-connections",children:[r.jsx(ym,{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(Xe,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 rounded-full bg-muted",children:r.jsx(Ra,{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:H.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"&&(ne?r.jsxs("a",{href:ne,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"),oe()},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(El,{className:"h-4 w-4"}),"Images"]}),r.jsxs("button",{onClick:()=>{N("reels"),oe()},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(Id,{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:fe,className:"gap-2",children:["Select All (",Q.length,")"]}),r.jsxs(X,{variant:"outline",size:"sm",onClick:oe,className:"gap-2",children:[r.jsx(en,{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:ce,disabled:y,className:"gap-2",children:[r.jsx($i,{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 Me=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&&Me&&"ring-2 ring-primary ring-offset-2"),onClick:()=>de(xe),children:r.jsxs("div",{className:"relative aspect-[4/5] overflow-hidden",children:[r.jsx("img",{src:Ide(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:rs(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",Me?"bg-primary border-primary text-primary-foreground":"bg-white/80 border-muted-foreground/50"),children:Me&&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(El,{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:q?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(q),children:r.jsxs("div",{className:"relative aspect-[9/16] overflow-hidden",children:[r.jsx("img",{src:Ide(q.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(Id,{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(Id,{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:()=>s(null),children:r.jsx(Pr,{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:Ide(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(jn,{className:"h-4 w-4"}),rs(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(jn,{className:"h-3.5 w-3.5"}),"Post on ",rs(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(ro,{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:()=>ie(t.caption),className:"flex-1 gap-2",children:[r.jsx(Mo,{className:"h-4 w-4"}),"Copy Caption"]}),r.jsxs(X,{variant:"outline",onClick:()=>he(t.image_url,t.id),className:"flex-1 gap-2",children:[r.jsx($i,{className:"h-4 w-4"}),"Download"]})]})]})]})]})})})}),r.jsx(Or,{open:!!n,onOpenChange:()=>a(null),children:r.jsx(Pr,{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:n&&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:n.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(Id,{className:"h-4 w-4"}),"Monthly Reel"]}),n.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:n.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[n.caption&&r.jsxs(X,{onClick:()=>ie(n.caption||""),className:"flex-1 gap-2",children:[r.jsx(Mo,{className:"h-4 w-4"}),"Copy Caption"]}),n.canva_link&&r.jsxs(X,{variant:"outline",onClick:()=>window.open(n.canva_link,"_blank"),className:"flex-1 gap-2",children:[r.jsx(Sn,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})}),r.jsx(FNt,{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(Ss,{value:"scheduled",children:r.jsx(zNt,{})})]}):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(Xe,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 rounded-full bg-muted",children:r.jsx(Ra,{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:H.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"&&(ne?r.jsxs("a",{href:ne,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"),oe()},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(El,{className:"h-4 w-4"}),"Images"]}),r.jsxs("button",{onClick:()=>{N("reels"),oe()},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(Id,{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:fe,className:"gap-2",children:["Select All (",Q.length,")"]}),r.jsxs(X,{variant:"outline",size:"sm",onClick:oe,className:"gap-2",children:[r.jsx(en,{className:"h-4 w-4"}),"Cancel"]}),i.size>0&&r.jsxs(X,{size:"sm",onClick:ce,disabled:y,className:"gap-2",children:[r.jsx($i,{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 Me=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&&Me&&"ring-2 ring-primary ring-offset-2"),onClick:()=>de(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",Me?"bg-primary border-primary text-primary-foreground":"bg-white/80 border-muted-foreground/50"),children:Me&&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(El,{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:q?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(q),children:r.jsxs("div",{className:"relative aspect-[9/16] overflow-hidden",children:[r.jsx("img",{src:q.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(Id,{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(Id,{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:()=>s(null),children:r.jsx(Pr,{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(jn,{className:"h-4 w-4"}),rs(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:()=>ie(t.caption),className:"flex-1 gap-2",children:[r.jsx(Mo,{className:"h-4 w-4"}),"Copy Caption"]}),r.jsxs(X,{variant:"outline",onClick:()=>he(t.image_url,t.id),className:"flex-1 gap-2",children:[r.jsx($i,{className:"h-4 w-4"}),"Download"]})]})]})]})})})}),r.jsx(Or,{open:!!n,onOpenChange:()=>a(null),children:r.jsx(Pr,{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:n&&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:n.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(Id,{className:"h-4 w-4"}),"Monthly Reel"]}),n.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:n.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[n.caption&&r.jsxs(X,{onClick:()=>ie(n.caption||""),className:"flex-1 gap-2",children:[r.jsx(Mo,{className:"h-4 w-4"}),"Copy Caption"]}),n.canva_link&&r.jsxs(X,{variant:"outline",onClick:()=>window.open(n.canva_link,"_blank"),className:"flex-1 gap-2",children:[r.jsx(Sn,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})})]})]})})},qNt=()=>{const{swagId:e}=hc(),{user:t}=Yr(),{toast:s}=ci(),n=Br(),{trackEngagement:a}=vP(),[o,l]=A.useState(""),{data:i,isLoading:u}=Kt({queryKey:["social-swag-detail",e],queryFn:async()=>{const{data:E,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{...E,links:P||[]}},enabled:!!e});A.useEffect(()=>{i&&a("social_swag",i.id,i.title,"view")},[i==null?void 0:i.id]);const{data:m=[]}=Kt({queryKey:["social-swag-likes",e],queryFn:async()=>{const{data:E,error:T}=await Y.from("social_swag_likes").select("*").eq("swag_id",e);if(T)throw T;return E},enabled:!!e}),{data:x=[]}=Kt({queryKey:["social-swag-comments",e],queryFn:async()=>{const{data:E,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(E.map(U=>U.user_id))],{data:R}=await Y.from("profiles").select("id, name").in("id",P),D=new Map((R==null?void 0:R.map(U=>[U.id,U.name]))||[]);return E.map(U=>({...U,user_name:D.get(U.user_id)||"Unknown User"}))},enabled:!!e}),y=ar({mutationFn:async E=>{const{error:T}=await Y.from("social_swag_comments").insert({swag_id:e,user_id:t.id,content:E});if(T)throw T},onSuccess:()=>{n.invalidateQueries({queryKey:["social-swag-comments",e]}),l(""),s({title:"Comment added!"})},onError:E=>{s({title:"Error adding comment",description:E.message,variant:"destructive"})}}),v=ar({mutationFn:async E=>{const{error:T}=await Y.from("social_swag_comments").delete().eq("id",E);if(T)throw T},onSuccess:()=>{n.invalidateQueries({queryKey:["social-swag-comments",e]}),s({title:"Comment deleted"})}}),b=ar({mutationFn:async()=>{const E=m.find(T=>T.user_id===(t==null?void 0:t.id));if(E){const{error:T}=await Y.from("social_swag_likes").delete().eq("id",E.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:()=>{n.invalidateQueries({queryKey:["social-swag-likes",e]})}}),N=m.some(E=>E.user_id===(t==null?void 0:t.id)),k=E=>E.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),M=E=>{E.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(ho,{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($3,{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(xd,{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(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(zo,{className:"h-4 w-4"}),i.links.length===1?"Canva Link":"Canva Links"]}),r.jsx("div",{className:"grid gap-2",children:i.links.map(E=>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(E.canva_share_link,"_blank")},children:[r.jsx("span",{className:"font-medium",children:E.title}),r.jsx(Sn,{className:"h-4 w-4 text-muted-foreground"})]},E.id))})]})}),r.jsx(pd,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(ql,{className:"h-5 w-5"}),"Comments (",x.length,")"]}),t?r.jsxs("form",{onSubmit:M,className:"flex gap-2",children:[r.jsx(Ys,{placeholder:"Add a comment...",value:o,onChange:E=>l(E.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(ro,{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(Xe,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):x.map(E=>r.jsx(He,{children:r.jsx(Xe,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Xn,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Qn,{className:"text-sm",children:k(E.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:E.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:ju(new Date(E.created_at),{addSuffix:!0})}),E.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(E.id),children:r.jsx(Bs,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:E.content})]})]})})},E.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(zo,{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(ho,{to:"/social-swag",children:"Back to Social Swag"})})]})})},VNt=({categories:e,privateGroups:t,selectedFilter:s,onFilterChange:n,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:s==="all"?"secondary":"ghost",className:"w-full justify-start",onClick:()=>n("all"),children:[r.jsx(TS,{className:"h-4 w-4 mr-2"}),"All Posts"]}),r.jsxs(XS,{open:o,onOpenChange:l,children:[r.jsx(QS,{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(gd,{className:"h-4 w-4"}):r.jsx(Zi,{className:"h-4 w-4"})]})}),r.jsx(JS,{className:"space-y-1 pl-2",children:e.map(v=>r.jsxs(X,{variant:s===v.id?"secondary":"ghost",size:"sm",className:"w-full justify-start h-9",onClick:()=>n(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(XS,{open:i,onOpenChange:u,children:[r.jsx(QS,{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(nh,{className:"h-3 w-3"}),"Your Groups"]}),i?r.jsx(gd,{className:"h-4 w-4"}):r.jsx(Zi,{className:"h-4 w-4"})]})}),r.jsx(JS,{className:"space-y-1 pl-2",children:t.map(v=>r.jsxs(X,{variant:s===`group:${v.id}`?"secondary":"ghost",size:"sm",className:"w-full justify-start h-9",onClick:()=>n(`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(XS,{open:m,onOpenChange:x,children:[r.jsx(QS,{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(qs,{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(gd,{className:"h-4 w-4"}):r.jsx(Zi,{className:"h-4 w-4"})]})}),r.jsx(JS,{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(Xn,{className:"h-7 w-7",children:[r.jsx(ji,{src:v.avatarUrl}),r.jsx(Qn,{className:"text-xs",children:y(v.name)})]}),r.jsx(sh,{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))})]})]})})})},HNt=({categories:e,privateGroups:t,selectedFilter:s,onFilterChange:n,onlineUsers:a})=>{const[o,l]=A.useState(!1),i=m=>m.split(" ").map(x=>x[0]).join("").toUpperCase().slice(0,2),u=()=>{if(s==="all")return"All Posts";if(s.startsWith("group:")){const x=s.replace("group:",""),y=t.find(v=>v.id===x);return y?`🔒 ${y.name}`:"Private Group"}const m=e.find(x=>x.id===s);return m?`${m.icon||"📂"} ${m.name}`:"Category"};return r.jsxs("div",{className:"lg:hidden flex items-center gap-2 mb-4",children:[r.jsxs(uh,{children:[r.jsx(hh,{asChild:!0,children:r.jsxs(X,{variant:"outline",className:"flex-1 justify-between",children:[r.jsx("span",{className:"truncate",children:u()}),r.jsx(gd,{className:"h-4 w-4 ml-2 shrink-0"})]})}),r.jsxs(Cu,{className:"w-56 bg-background border",children:[r.jsxs(Wa,{onClick:()=>n("all"),children:[r.jsx(TS,{className:"h-4 w-4 mr-2"}),"All Posts"]}),r.jsx(dk,{}),r.jsx(cme,{className:"text-xs text-muted-foreground",children:"Categories"}),e.map(m=>r.jsxs(Wa,{onClick:()=>n(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(dk,{}),r.jsxs(cme,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(nh,{className:"h-3 w-3"}),"Your Groups"]}),t.map(m=>r.jsxs(Wa,{onClick:()=>n(`group:${m.id}`),children:[r.jsx("span",{className:"mr-2",children:m.icon||"🔒"}),m.name]},m.id))]})]})]}),r.jsxs(Zne,{open:o,onOpenChange:l,children:[r.jsx(fye,{asChild:!0,children:r.jsxs(X,{variant:"outline",size:"icon",className:"relative",children:[r.jsx(qs,{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(mP,{children:[r.jsx(Yne,{children:r.jsxs(Xne,{className:"flex items-center gap-2",children:[r.jsx(qs,{className:"h-5 w-5"}),"Online Now (",a.length,")"]})}),r.jsx(Yo,{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(Xn,{className:"h-10 w-10",children:[r.jsx(ji,{src:m.avatarUrl}),r.jsx(Qn,{children:i(m.name)})]}),r.jsx(sh,{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 Pde,Oae="HoverCard",[F9e]=uc(Oae,[ix]),Dae=ix(),[WNt,U0e]=F9e(Oae),z9e=e=>{const{__scopeHoverCard:t,children:s,open:n,defaultOpen:a,onOpenChange:o,openDelay:l=700,closeDelay:i=300}=e,u=Dae(t),m=A.useRef(0),x=A.useRef(0),y=A.useRef(!1),v=A.useRef(!1),[b,N]=ah({prop:n,defaultProp:a??!1,onChange:o,caller:Oae}),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]),E=A.useCallback(()=>N(!1),[N]);return A.useEffect(()=>()=>{clearTimeout(m.current),clearTimeout(x.current)},[]),r.jsx(WNt,{scope:t,open:b,onOpenChange:N,onOpen:k,onClose:M,onDismiss:E,hasSelectionRef:y,isPointerDownOnContentRef:v,children:r.jsx(eP,{...u,children:s})})};z9e.displayName=Oae;var B9e="HoverCardTrigger",$9e=A.forwardRef((e,t)=>{const{__scopeHoverCard:s,...n}=e,a=U0e(B9e,s),o=Dae(s);return r.jsx(C3,{asChild:!0,...o,children:r.jsx($s.a,{"data-state":a.open?"open":"closed",...n,ref:t,onPointerEnter:xs(e.onPointerEnter,Yre(a.onOpen)),onPointerLeave:xs(e.onPointerLeave,Yre(a.onClose)),onFocus:xs(e.onFocus,a.onOpen),onBlur:xs(e.onBlur,a.onClose),onTouchStart:xs(e.onTouchStart,l=>l.preventDefault())})})});$9e.displayName=B9e;var GNt="HoverCardPortal",[Dtr,KNt]=F9e(GNt,{forceMount:void 0}),Zre="HoverCardContent",U9e=A.forwardRef((e,t)=>{const s=KNt(Zre,e.__scopeHoverCard),{forceMount:n=s.forceMount,...a}=e,o=U0e(Zre,e.__scopeHoverCard);return r.jsx(Ec,{present:n||o.open,children:r.jsx(ZNt,{"data-state":o.open?"open":"closed",...a,onPointerEnter:xs(e.onPointerEnter,Yre(o.onOpen)),onPointerLeave:xs(e.onPointerLeave,Yre(o.onClose)),ref:t})})});U9e.displayName=Zre;var ZNt=A.forwardRef((e,t)=>{const{__scopeHoverCard:s,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:l,...i}=e,u=U0e(Zre,s),m=Dae(s),x=A.useRef(null),y=ha(t,x),[v,b]=A.useState(!1);return A.useEffect(()=>{if(v){const N=document.body;return Pde=N.style.userSelect||N.style.webkitUserSelect,N.style.userSelect="none",N.style.webkitUserSelect="none",()=>{N.style.userSelect=Pde,N.style.webkitUserSelect=Pde}}},[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&&QNt(x.current).forEach(k=>k.setAttribute("tabindex","-1"))}),r.jsx(kv,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:xs(o,N=>{N.preventDefault()}),onDismiss:u.onDismiss,children:r.jsx(tP,{...m,...i,onPointerDown:xs(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)"}})})}),YNt="HoverCardArrow",XNt=A.forwardRef((e,t)=>{const{__scopeHoverCard:s,...n}=e,a=Dae(s);return r.jsx(rP,{...a,...n,ref:t})});XNt.displayName=YNt;function Yre(e){return t=>t.pointerType==="touch"?void 0:e()}function QNt(e){const t=[],s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;s.nextNode();)t.push(s.currentNode);return t}var JNt=z9e,e4t=$9e,q9e=U9e;const t4t=JNt,r4t=e4t,V9e=A.forwardRef(({className:e,align:t="center",sideOffset:s=4,...n},a)=>r.jsx(q9e,{ref:a,align:t,sideOffset:s,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),...n}));V9e.displayName=q9e.displayName;const s4t=[{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"}],n4t=e=>e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2),H9e=({reactions:e,children:t})=>{if(e.length===0)return r.jsx(r.Fragment,{children:t});const s={};return e.forEach(n=>{s[n.reaction_type]||(s[n.reaction_type]=[]),s[n.reaction_type].push(n)}),r.jsxs(t4t,{openDelay:200,closeDelay:100,children:[r.jsx(r4t,{asChild:!0,children:r.jsx("div",{className:"cursor-pointer",children:t})}),r.jsx(V9e,{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(s).map(([n,a])=>{const o=s4t.find(l=>l.type===n);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(Xn,{className:"h-6 w-6",children:[r.jsx(ji,{src:l.user_avatar||void 0}),r.jsx(Qn,{className:"text-[10px]",children:n4t(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"]})]})]},n)})})})]})};function a4t({images:e,initialIndex:t=0,open:s,onOpenChange:n}){const[a,o]=A.useState(t),[l,i]=A.useState(!1);A.useEffect(()=>{s&&(o(t),i(!1))},[s,t]);const u=()=>{o(v=>v>0?v-1:e.length-1),i(!1)},m=()=>{o(v=>v{s&&(v.key==="ArrowLeft"&&u(),v.key==="ArrowRight"&&m(),v.key==="Escape"&&n(!1))},[s,e.length]);A.useEffect(()=>(window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)),[x]);const y=e[a];return r.jsx(Or,{open:s,onOpenChange:n,children:r.jsxs(Pr,{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:()=>n(!1),children:r.jsx(en,{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(Sc,{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(Zi,{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(VS,{className:"h-5 w-5"}):r.jsx(qS,{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 TO=[{type:"like",emoji:"👍",label:"Like"},{type:"love",emoji:"❤️",label:"Love"}],i4t=({commentId:e,reactions:t,currentUserId:s})=>{var m,x;const n=Br(),[a,o]=A.useState(!1),l=t.find(y=>y.user_id===s),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:s,reaction_type:y})},onSuccess:()=>{n.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(H9e,{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=TO.find(b=>b.type===y))==null?void 0:v.emoji},y)})}),r.jsx("span",{children:t.length})]})}),s&&r.jsxs(Kc,{open:a,onOpenChange:o,children:[r.jsx(Zc,{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=TO.find(y=>y.type===l.reaction_type))==null?void 0:m.emoji," ",(x=TO.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(Ac,{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:TO.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 q0e({content:e,className:t}){const s=/([@#])\[([^\]]+)\]\(([^)]+)\)|(https?:\/\/[^\s<>]+)/g,n=[];let a=0,o,l=0;for(;(o=s.exec(e))!==null;){if(o.index>a&&n.push(e.substring(a,o.index)),o[1]){const i=o[1],u=o[2],m=o[3],x=i==="#";n.push(r.jsx(ho,{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}n.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&&n.push(m)}a=o.index+o[0].length}return ar.jsx(A.Fragment,{children:i},u))})}function Xre({value:e,onChange:t,placeholder:s="What's on your mind? Use @ to mention someone",className:n,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,E]=A.useState(""),[T,P]=A.useState(null),[R,D]=A.useState(0),[U,q]=A.useState({top:0,left:0,width:0}),H=A.useRef(new Map),G=A.useRef(new Map),Q=be=>{if(u==="plain"){const Le=[];return H.current.forEach((Pe,$e)=>{be.includes(`@${$e}`)&&Le.push(Pe)}),[...new Set(Le)]}const we=/@\[([^\]]+)\]\(([^)]+)\)/g,tt=[];let Ae;for(;(Ae=we.exec(be))!==null;)tt.push(Ae[2]);return[...new Set(tt)]},ne=be=>{if(u==="plain"){const Le=[];return G.current.forEach((Pe,$e)=>{be.includes(`#${$e}`)&&Le.push(Pe)}),[...new Set(Le)]}const we=/#\[([^\]]+)\]\(([^)]+)\)/g,tt=[];let Ae;for(;(Ae=we.exec(be))!==null;)tt.push(Ae[2]);return[...new Set(tt)]};A.useEffect(()=>{if(o){const be=Q(e);o(be)}if(l){const be=ne(e);l(be)}},[e,o,l,u]);const{data:ie=[],isLoading:he}=Kt({queryKey:["mention-users",M],queryFn:async()=>{const be=Y.from("profiles").select("id, name").limit(8),we=M.length>=1?be.ilike("name",`%${M}%`):be.order("name"),{data:tt,error:Ae}=await we;if(Ae)throw Ae;const Le=tt.map(Pe=>Pe.id),Ue=await sDe(Le);return tt.map(Pe=>({id:Pe.id,name:Pe.name||"Unknown",avatar_url:Ue.get(Pe.id)}))},enabled:v&&N==="user",staleTime:3e4}),{data:se=[],isLoading:fe}=Kt({queryKey:["mention-templates",M],queryFn:async()=>{let be=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&&(be=be.ilike("name",`%${M}%`));const{data:we,error:tt}=await be;if(tt)throw tt;return we||[]},enabled:v&&N==="template"&&m,staleTime:3e4}),oe=N==="user"?he:fe,ce=N==="user"?ie:se,de=be=>be.split(" ").map(we=>we[0]).join("").toUpperCase().slice(0,2),xe=be=>{const we=be.target.value,tt=be.target.selectionStart;t(we);const Ae=we.substring(0,tt),Le=Ae.lastIndexOf("@"),Ue=m?Ae.lastIndexOf("#"):-1;let Pe=-1,$e="user";if(Le>Ue?(Pe=Le,$e="user"):Ue>Le&&m&&(Pe=Ue,$e="template"),Pe!==-1){const it=Ae.substring(Pe+1),xt=it.includes(" "),Ee=it.includes(` `);if(!xt&&!Ee&&it.length<=30){P(Pe),E(it),k($e),b(!0),D(0);return}}b(!1),P(null)},Me=be=>{if(T===null)return;const we=e.substring(0,T),tt=e.substring(T+M.length+1),Ae=N==="user"?"@":"#",Le=u==="plain"?`${Ae}${be.name} `:`${Ae}[${be.name}](${be.id}) `;u==="plain"&&(N==="user"?H.current.set(be.name,be.id):G.current.set(be.name,be.id));const Ue=we+Le+tt;t(Ue),b(!1),P(null),E(""),setTimeout(()=>{if(x.current){const Pe=we.length+Le.length;x.current.focus(),x.current.setSelectionRange(Pe,Pe)}},0)},ve=be=>{if(!(!v||ce.length===0))switch(be.key){case"ArrowDown":be.preventDefault(),D(we=>(we+1)%ce.length);break;case"ArrowUp":be.preventDefault(),D(we=>(we-1+ce.length)%ce.length);break;case"Enter":ce[R]&&(be.preventDefault(),Me(ce[R]));break;case"Escape":be.preventDefault(),b(!1);break;case"Tab":ce[R]&&(be.preventDefault(),Me(ce[R]));break}};return A.useEffect(()=>{const be=we=>{y.current&&!y.current.contains(we.target)&&x.current&&!x.current.contains(we.target)&&b(!1)};return document.addEventListener("mousedown",be),()=>document.removeEventListener("mousedown",be)},[]),A.useEffect(()=>{if(!v)return;const be=()=>{const we=x.current;if(!we)return;const tt=we.getBoundingClientRect();q({top:tt.bottom+4,left:tt.left,width:tt.width})};return be(),window.addEventListener("resize",be),window.addEventListener("scroll",be,!0),()=>{window.removeEventListener("resize",be),window.removeEventListener("scroll",be,!0)}},[v,e]),r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ys,{ref:x,value:e,onChange:xe,onKeyDown:be=>{ve(be),be.defaultPrevented||i==null||i(be)},placeholder:s,className:Ut("resize-none",n),style:{minHeight:a}}),v&&Eh.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"}),oe?r.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:"Searching..."}):ce.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:ce.map((be,we)=>r.jsx("li",{className:Ut("flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors",we===R?"bg-accent":"hover:bg-accent/50"),onClick:()=>Me(be),onMouseEnter:()=>D(we),children:N==="user"?r.jsxs(r.Fragment,{children:[r.jsxs(Xn,{className:"h-6 w-6",children:[r.jsx(ji,{src:be.avatar_url}),r.jsx(Qn,{className:"text-xs",children:de(be.name)})]}),r.jsx("span",{className:"text-sm font-medium truncate",children:be.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:be.preview_image_url?r.jsx("img",{src:be.preview_image_url,alt:"",className:"w-full h-full object-cover"}):r.jsx(Wc,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{className:"text-sm font-medium truncate",children:be.name})]})},be.id))})]}),document.body)]})}function o4t(e){const t=/#\[([^\]]+)\]\(([^)]+)\)/g,s=[];let n;for(;(n=t.exec(e))!==null;)s.push(n[2]);return[...new Set(s)]}const USe=e=>e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2);function W9e({comment:e,postId:t,currentUserId:s,currentUserAvatar:n,currentUserEmail:a,canModerate:o,depth:l=0}){const i=Br(),[u,m]=A.useState(!1),[x,y]=A.useState(""),[v,b]=A.useState([]),N=ar({mutationFn:async({content:T,parentCommentId:P})=>{const{data:R,error:D}=await Y.from("community_comments").insert({post_id:t,user_id:s,content:T,parent_comment_id:P}).select("id").single();if(D)throw D;const U=v;if(U.length>0&&R){const q=U.filter(H=>H!==s).map(H=>({comment_id:R.id,mentioned_user_id:H,mentioned_by_user_id:s}));q.length>0&&await Y.from("community_comment_mentions").insert(q)}},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(Xn,{className:"h-8 w-8 shrink-0",children:[r.jsx(ji,{src:e.user_avatar||void 0}),r.jsx(Qn,{className:"text-xs",children:USe(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(q0e,{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:ju(new Date(e.created_at),{addSuffix:!0})}),r.jsx(i4t,{commentId:e.id,reactions:e.reactions,currentUserId:s}),s&&l<2&&r.jsxs("button",{onClick:()=>m(!u),className:"hover:text-primary flex items-center gap-1",children:[r.jsx(SA,{className:"h-3 w-3"}),"Reply"]}),(e.user_id===s||o)&&r.jsx("button",{onClick:()=>k.mutate(e.id),className:"hover:text-destructive",children:e.user_id!==s?"Remove":"Delete"})]}),u&&s&&r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsxs(Xn,{className:"h-6 w-6 shrink-0 mt-1",children:[r.jsx(ji,{src:n||void 0}),r.jsx(Qn,{className:"text-xs",children:USe((a==null?void 0:a.split("@")[0])||"U")})]}),r.jsxs("div",{className:"flex-1 flex gap-2 items-start",children:[r.jsx(Xre,{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(ro,{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(W9e,{comment:T,postId:t,currentUserId:s,currentUserAvatar:n,currentUserEmail:a,canModerate:o,depth:l+1},T.id))})]})}const AO=[{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"}],l4t=()=>{const{user:e,isBrokerageManager:t,managedBrokerages:s,isAdmin:n}=Yr(),{avatarUrl:a}=rDe(e==null?void 0:e.id),{onlineUsers:o}=yRe(),{toast:l}=ci(),i=Br(),u=A.useRef(null),[m,x]=A.useState("all"),[y,v]=A.useState(""),[b,N]=A.useState(""),[k,M]=A.useState(""),[E,T]=A.useState([]),[P,R]=A.useState([]),[D,U]=A.useState(""),[q,H]=A.useState(!1),[G,Q]=A.useState(null),[ne,ie]=A.useState(""),[he,se]=A.useState(new Set),[fe,oe]=A.useState({}),[ce,de]=A.useState({}),[xe,Me]=A.useState([]),[ve,be]=A.useState([]),[we,tt]=A.useState({open:!1,images:[],index:0});A.useEffect(()=>{if(m.startsWith("group:")){const ct=m.replace("group:","");M(ct),N("")}else m!=="all"?(N(m),M("")):(N(""),M(""))},[m]);const{data:Ae=[]}=Kt({queryKey:["community-categories"],queryFn:async()=>{const{data:ct,error:zt}=await Y.from("community_categories").select("*").order("sort_order");if(zt)throw zt;return ct}}),{data:Le=[]}=Kt({queryKey:["community-private-groups"],queryFn:async()=>{const{data:ct,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 ct}}),Ue=20,{data:Pe,isLoading:$e,hasNextPage:it,fetchNextPage:xt,isFetchingNextPage:Ee}=Vtt({queryKey:["community-posts",m],initialPageParam:0,queryFn:async({pageParam:ct})=>{var Oe;const zt=ct*Ue,ir=zt+Ue;let Tr=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 Ye=m.replace("group:","");Tr=Tr.eq("private_group_id",Ye)}else m==="all"||(Tr=Tr.eq("category_id",m).is("private_group_id",null));const{data:Zr,error:$r}=await Tr;if($r)throw $r;const ns=((Zr==null?void 0:Zr.length)||0)>Ue,Xs=(Zr||[]).slice(0,Ue);if(Xs.length===0)return{posts:[],hasMore:!1,nextPage:ct+1};const Ot=Xs.map(Ye=>Ye.id),Hr=[...new Set(Xs.filter(Ye=>Ye.category_id).map(Ye=>Ye.category_id))].filter(Boolean),[Ts,zs,wa,gi,Ao]=await Promise.all([Hr.length?Y.from("community_categories").select("*").in("id",Hr):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)]),Ga=Ts==null?void 0:Ts.data,mn=zs==null?void 0:zs.data,na=wa==null?void 0:wa.data,pn=gi==null?void 0:gi.data,Jn=Ao==null?void 0:Ao.data,$n=(pn||[]).map(Ye=>Ye.id),[Ci,or]=await Promise.all([$n.length?Y.from("community_comment_reactions").select("*").in("comment_id",$n):Promise.resolve({data:[]}),(()=>{const Ye=(Jn||[]).filter(St=>St.resource_type==="template").map(St=>St.resource_id);return Ye.length===0?Promise.resolve({data:[]}):Y.from("canva_templates").select("id, name, preview_image_url").in("id",Ye)})()]),La=(Ci==null?void 0:Ci.data)||[],co=(or==null?void 0:or.data)||[],Ni=new Map(co.map(Ye=>[Ye.id,{name:Ye.name,preview_image_url:Ye.preview_image_url}])),Ws=Array.from(new Set([...Xs.map(Ye=>Ye.user_id),...(na||[]).map(Ye=>Ye.user_id),...(pn||[]).map(Ye=>Ye.user_id),...La.map(Ye=>Ye.user_id)])),[Yi,mc]=await Promise.all([Ws.length?Y.from("profiles").select("id, name").in("id",Ws):Promise.resolve({data:[]}),sDe(Ws)]),bo=new Map(((Oe=Yi==null?void 0:Yi.data)==null?void 0:Oe.map(Ye=>[Ye.id,Ye.name]))||[]),pc=new Map((Ga||[]).map(Ye=>[Ye.id,Ye])),nt=Ye=>{const St=new Map,wt=[];return Ye.forEach(It=>{St.set(It.id,{...It,user_name:bo.get(It.user_id)||"Unknown User",user_avatar:mc.get(It.user_id),reactions:La.filter(qt=>qt.comment_id===It.id).map(qt=>({...qt,user_name:bo.get(qt.user_id)||"Unknown User",user_avatar:mc.get(qt.user_id)})),replies:[]})}),Ye.forEach(It=>{const qt=St.get(It.id);if(It.parent_comment_id&&St.has(It.parent_comment_id)){const Lt=St.get(It.parent_comment_id);Lt.replies=Lt.replies||[],Lt.replies.push(qt)}else wt.push(qt)}),wt};return{posts:Xs.map(Ye=>{const St=(Jn||[]).filter(wt=>wt.post_id===Ye.id).map(wt=>{let It="",qt=null;if(wt.resource_type==="template"){const Lt=Ni.get(wt.resource_id);It=(Lt==null?void 0:Lt.name)||"Unknown Template",qt=(Lt==null?void 0:Lt.preview_image_url)||null}return{id:wt.id,resource_type:wt.resource_type,resource_id:wt.resource_id,resource_name:It,resource_preview_url:qt}});return{...Ye,user_name:bo.get(Ye.user_id)||"Unknown User",user_avatar:mc.get(Ye.user_id),category:Ye.category_id?pc.get(Ye.category_id):null,media:(mn||[]).filter(wt=>wt.post_id===Ye.id),reactions:((na||[]).filter(wt=>wt.post_id===Ye.id)||[]).map(wt=>({...wt,user_name:bo.get(wt.user_id)||"Unknown User",user_avatar:mc.get(wt.user_id)})),comments:nt((pn||[]).filter(wt=>wt.post_id===Ye.id)),resources:St}}),hasMore:ns,nextPage:ct+1}},getNextPageParam:ct=>ct.hasMore?ct.nextPage:void 0}),et=A.useMemo(()=>(Pe==null?void 0:Pe.pages.flatMap(ct=>ct.posts))??[],[Pe]),le=ar({mutationFn:async()=>{H(!0);const{data:ct,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 Tr=0;Tr0){const Tr=xe.filter(Zr=>Zr!==e.id).map(Zr=>({post_id:ct.id,mentioned_user_id:Zr,mentioned_by_user_id:e.id}));Tr.length>0&&await Y.from("community_post_mentions").insert(Tr)}const ir=o4t(y);if(ir.length>0){const Tr=ir.map(Zr=>({post_id:ct.id,resource_type:"template",resource_id:Zr}));await Y.from("community_post_resources").insert(Tr)}return ct},onSuccess:async ct=>{var zt;i.invalidateQueries({queryKey:["community-posts"]}),v(""),Me([]),be([]),N(""),M(""),T([]),R([]),U(""),l({title:"Post created!"});try{const ir=((zt=e==null?void 0:e.user_metadata)==null?void 0:zt.name)||"Someone",Tr=y.length>50?y.substring(0,50)+"...":y;await Y.functions.invoke("send-push-notification",{body:{title:"New Community Post",body:`${ir}: ${Tr}`,url:"/community"}})}catch(ir){console.error("Failed to send push notification:",ir)}},onError:ct=>{l({title:"Error creating post",description:ct.message,variant:"destructive"})},onSettled:()=>H(!1)}),Ve=ar({mutationFn:async({postId:ct,content:zt})=>{const{error:ir}=await Y.from("community_posts").update({content:zt}).eq("id",ct);if(ir)throw ir},onSuccess:()=>{i.invalidateQueries({queryKey:["community-posts"]}),Q(null),ie(""),l({title:"Post updated!"})}}),Je=ar({mutationFn:async ct=>{const{error:zt}=await Y.from("community_posts").delete().eq("id",ct);if(zt)throw zt},onSuccess:()=>{i.invalidateQueries({queryKey:["community-posts"]}),l({title:"Post deleted"})}}),rt=ar({mutationFn:async({postId:ct,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",ct);if(ir)throw ir},onSuccess:(ct,{isPinned:zt})=>{i.invalidateQueries({queryKey:["community-posts"]}),l({title:zt?"Post unpinned":"Post pinned to top"})}}),je=ar({mutationFn:async({postId:ct,reactionType:zt})=>{var Tr;const ir=(Tr=et.find(Zr=>Zr.id===ct))==null?void 0:Tr.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:ct,user_id:e.id,reaction_type:zt})},onSuccess:()=>i.invalidateQueries({queryKey:["community-posts"]})}),lt=ar({mutationFn:async({postId:ct,content:zt})=>{const{data:ir,error:Tr}=await Y.from("community_comments").insert({post_id:ct,user_id:e.id,content:zt}).select("id").single();if(Tr)throw Tr;const Zr=ce[ct]||[];if(Zr.length>0&&ir){const $r=Zr.filter(ns=>ns!==e.id).map(ns=>({comment_id:ir.id,mentioned_user_id:ns,mentioned_by_user_id:e.id}));$r.length>0&&await Y.from("community_comment_mentions").insert($r)}},onSuccess:(ct,{postId:zt})=>{i.invalidateQueries({queryKey:["community-posts"]}),oe(ir=>({...ir,[zt]:""})),de(ir=>({...ir,[zt]:[]}))}});ar({mutationFn:async ct=>{const{error:zt}=await Y.from("community_comments").delete().eq("id",ct);if(zt)throw zt},onSuccess:()=>i.invalidateQueries({queryKey:["community-posts"]})});const Ce=ct=>{const zt=Array.from(ct.target.files||[]);if(zt.length+E.length>10){l({title:"Maximum 10 files allowed",variant:"destructive"});return}T(ir=>[...ir,...zt]),zt.forEach(ir=>{const Tr=new FileReader;Tr.onloadend=()=>{R(Zr=>[...Zr,Tr.result])},Tr.readAsDataURL(ir)})},Ie=ct=>{T(zt=>zt.filter((ir,Tr)=>Tr!==ct)),R(zt=>zt.filter((ir,Tr)=>Tr!==ct))},Ze=ct=>ct.split(" ").map(zt=>zt[0]).join("").toUpperCase().slice(0,2),De=ct=>{const zt={};return ct.forEach(ir=>{zt[ir.reaction_type]=(zt[ir.reaction_type]||0)+1}),zt},Ke=ct=>{var zt;return(zt=ct.find(ir=>ir.user_id===(e==null?void 0:e.id)))==null?void 0:zt.reaction_type},st=ct=>ct.reduce((zt,ir)=>zt+1+(ir.replies?st(ir.replies):0),0),dt=ct=>{if(n)return!0;if(!t||!ct.private_group_id)return!1;const zt=Le.find(ir=>ir.id===ct.private_group_id);return zt!=null&&zt.brokerage_id?s.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(VNt,{categories:Ae,privateGroups:Le,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(HNt,{categories:Ae,privateGroups:Le,selectedFilter:m,onFilterChange:x,onlineUsers:o}),r.jsx(He,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsxs(Xn,{className:"h-10 w-10",children:[r.jsx(ji,{src:a||void 0}),r.jsx(Qn,{children:e!=null&&e.email?Ze(e.email.split("@")[0]):"U"})]}),r.jsxs("div",{className:"flex-1 space-y-3",children:[r.jsx(Xre,{placeholder:n?"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:Me,onTemplatesChange:be,mentionFormat:"encoded",minHeight:"80px",enableTemplateMentions:n}),P.length>0&&r.jsx("div",{className:"grid grid-cols-3 gap-2",children:P.map((ct,zt)=>{var ir;return r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[(ir=E[zt])!=null&&ir.type.startsWith("video/")?r.jsx("video",{src:ct,className:"w-full h-full object-cover"}):r.jsx("img",{src:ct,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:()=>Ie(zt),children:r.jsx(en,{className:"h-3 w-3"})})]},zt)})}),D&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(zo,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ot,{value:D,onChange:ct=>U(ct.target.value),placeholder:"https://...",className:"flex-1"}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>U(""),children:r.jsx(en,{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 ct;return(ct=u.current)==null?void 0:ct.click()},children:[r.jsx(El,{className:"h-4 w-4 mr-1"}),"Photo"]}),r.jsxs(X,{variant:"ghost",size:"sm",onClick:()=>{var ct;return(ct=u.current)==null?void 0:ct.click()},children:[r.jsx(Ta,{className:"h-4 w-4 mr-1"}),"Video"]}),r.jsxs(X,{variant:"ghost",size:"sm",onClick:()=>U("https://"),children:[r.jsx(zo,{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:[Le.length>0?r.jsxs(us,{value:k||b||"none",onValueChange:ct=>{ct==="none"?(N(""),M("")):ct.startsWith("group:")?(M(ct.replace("group:","")),N("")):(N(ct),M(""))},children:[r.jsx(cs,{className:"w-[130px] sm:w-[160px] h-8 text-xs sm:text-sm",children:r.jsx(ms,{placeholder:"Select..."})}),r.jsxs(ds,{children:[r.jsx($t,{value:"none",children:"No category"}),Ae.map(ct=>r.jsxs($t,{value:ct.id,children:[ct.icon," ",ct.name]},ct.id)),Le.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"}),Le.map(ct=>r.jsxs($t,{value:`group:${ct.id}`,children:[ct.icon||"🔒"," ",ct.name]},ct.id))]})]})]}):r.jsxs(us,{value:b,onValueChange:N,children:[r.jsx(cs,{className:"w-[110px] sm:w-[140px] h-8 text-xs sm:text-sm",children:r.jsx(ms,{placeholder:"Category"})}),r.jsx(ds,{children:Ae.map(ct=>r.jsxs($t,{value:ct.id,children:[ct.icon," ",ct.name]},ct.id))})]}),r.jsxs(X,{size:"sm",onClick:()=>le.mutate(),disabled:!y.trim()||q,children:[r.jsx(ro,{className:"h-4 w-4 mr-1"}),"Post"]})]})]})]})]})})}),$e?r.jsx("div",{className:"space-y-4",children:[...Array(3)].map((ct,zt)=>r.jsx(He,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Cr,{className:"h-10 w-10 rounded-full"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx(Cr,{className:"h-4 w-32"}),r.jsx(Cr,{className:"h-4 w-full"}),r.jsx(Cr,{className:"h-4 w-3/4"})]})]})})},zt))}):et.length===0?r.jsx(He,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx(ql,{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:[et.map(ct=>{var zt,ir,Tr,Zr;return r.jsx(He,{children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsxs("div",{className:"flex gap-3 min-w-0",children:[r.jsxs(Xn,{className:"h-10 w-10",children:[r.jsx(ji,{src:ct.user_avatar||void 0}),r.jsx(Qn,{children:Ze(ct.user_name||"U")})]}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"font-semibold break-words",children:ct.user_name}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[r.jsx("span",{children:ju(new Date(ct.created_at),{addSuffix:!0})}),ct.category&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:"•"}),r.jsxs(Tt,{variant:"secondary",className:"text-xs",children:[ct.category.icon," ",ct.category.name]})]})]})]})]}),(ct.user_id===(e==null?void 0:e.id)||dt(ct))&&r.jsxs(uh,{children:[r.jsx(hh,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"h-8 w-8",children:r.jsx(xf,{className:"h-4 w-4"})})}),r.jsxs(Cu,{align:"end",children:[dt(ct)&&ct.private_group_id&&r.jsx(Wa,{onClick:()=>rt.mutate({postId:ct.id,isPinned:ct.is_pinned}),children:ct.is_pinned?r.jsxs(r.Fragment,{children:[r.jsx(bA,{className:"h-4 w-4 mr-2"}),"Unpin Post"]}):r.jsxs(r.Fragment,{children:[r.jsx(Q1,{className:"h-4 w-4 mr-2"}),"Pin to Top"]})}),ct.user_id===(e==null?void 0:e.id)&&r.jsxs(Wa,{onClick:()=>{Q(ct),ie(ct.content)},children:[r.jsx(Ja,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(Wa,{className:"text-destructive",onClick:()=>Je.mutate(ct.id),children:[r.jsx(Bs,{className:"h-4 w-4 mr-2"}),ct.user_id!==(e==null?void 0:e.id)?"Remove (Moderate)":"Delete"]})]})]})]}),ct.is_pinned&&r.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm text-primary",children:[r.jsx(Q1,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium",children:"Pinned"})]}),r.jsx("div",{className:"mb-3",children:r.jsx(q0e,{content:ct.content})}),ct.media.length>0&&r.jsx("div",{className:`grid gap-2 mb-3 ${ct.media.length===1?"grid-cols-1":ct.media.length===2?"grid-cols-2":ct.media.length===3?"grid-cols-3":"grid-cols-2"}`,children:ct.media.slice(0,4).map(($r,ns)=>{const Xs=ns===3&&ct.media.length>4,Ot=ct.media.length-4;return r.jsxs("div",{className:`relative rounded-lg overflow-hidden bg-muted cursor-pointer group ${ct.media.length===1?"max-h-[500px]":ct.media.length===2?"aspect-[4/3]":"aspect-square"}`,onClick:()=>tt({open:!0,images:ct.media.map(Hr=>({url:Hr.media_url,type:Hr.media_type==="video"?"video":"image"})),index:ns}),children:[$r.media_type==="video"?r.jsx("video",{src:$r.media_url,className:"w-full h-full object-cover transition-transform group-hover:scale-105"}):r.jsx("img",{src:$r.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"})})})}),Xs&&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]})})]},$r.id)})}),ct.link_url&&r.jsxs("a",{href:ct.link_url,target:"_blank",rel:"noopener noreferrer",className:"block rounded-lg border hover:bg-muted transition-colors mb-3 overflow-hidden",children:[ct.link_image&&r.jsx("div",{className:"aspect-video bg-muted",children:r.jsx("img",{src:ct.link_image,alt:ct.link_title||"Link preview",className:"w-full h-full object-cover",onError:$r=>{$r.currentTarget.style.display="none"}})}),r.jsx("div",{className:"p-3",children:ct.link_title?r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"font-medium text-foreground line-clamp-2",children:ct.link_title}),ct.link_description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:ct.link_description}),r.jsx("p",{className:"text-xs text-muted-foreground mt-2 truncate",children:new URL(ct.link_url).hostname})]}):r.jsxs("div",{className:"flex items-center gap-2 text-sm text-primary",children:[r.jsx(zo,{className:"h-4 w-4 flex-shrink-0"}),r.jsx("span",{className:"truncate",children:ct.link_url})]})})]}),ct.reactions.length>0&&r.jsx(H9e,{reactions:ct.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(De(ct.reactions)).slice(0,3).map(([$r])=>{var ns;return r.jsx("span",{className:"text-base",children:(ns=AO.find(Xs=>Xs.type===$r))==null?void 0:ns.emoji},$r)})}),r.jsx("span",{children:ct.reactions.length})]})}),r.jsxs("div",{className:"flex items-center gap-1 border-t border-b py-1 my-2",children:[r.jsxs(Kc,{children:[r.jsx(Zc,{asChild:!0,children:r.jsxs(X,{variant:"ghost",size:"sm",className:"flex-1",children:[Ke(ct.reactions)?r.jsx("span",{className:"mr-1",children:(zt=AO.find($r=>$r.type===Ke(ct.reactions)))==null?void 0:zt.emoji}):r.jsx(xd,{className:"h-4 w-4 mr-1"}),Ke(ct.reactions)?(ir=AO.find($r=>$r.type===Ke(ct.reactions)))==null?void 0:ir.label:"Like"]})}),r.jsx(Ac,{className:"w-auto p-2",side:"top",children:r.jsx("div",{className:"flex gap-1",children:AO.map($r=>r.jsx("button",{onClick:()=>je.mutate({postId:ct.id,reactionType:$r.type}),className:"text-2xl hover:scale-125 transition-transform p-1",title:$r.label,children:$r.emoji},$r.type))})})]}),r.jsxs(X,{variant:"ghost",size:"sm",className:"flex-1",onClick:()=>se($r=>{const ns=new Set($r);return ns.has(ct.id)?ns.delete(ct.id):ns.add(ct.id),ns}),children:[r.jsx(ql,{className:"h-4 w-4 mr-1"}),(()=>{const $r=st(ct.comments);return $r>0?`Comment (${$r})`:"Comment"})()]})]}),he.has(ct.id)&&r.jsxs("div",{className:"space-y-3 mt-3",children:[ct.comments.map($r=>r.jsx(W9e,{comment:$r,postId:ct.id,currentUserId:e==null?void 0:e.id,currentUserAvatar:a,currentUserEmail:e==null?void 0:e.email,canModerate:dt(ct)},$r.id)),e&&r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Xn,{className:"h-8 w-8",children:[r.jsx(ji,{src:a||void 0}),r.jsx(Qn,{className:"text-xs",children:Ze(((Tr=e.email)==null?void 0:Tr.split("@")[0])||"U")})]}),r.jsxs("div",{className:"flex-1 flex gap-2",children:[r.jsx(Xre,{placeholder:"Write a comment... (use @ to mention)",value:fe[ct.id]||"",onChange:$r=>oe(ns=>({...ns,[ct.id]:$r})),onMentionsChange:$r=>de(ns=>({...ns,[ct.id]:$r})),mentionFormat:"plain",onKeyDown:$r=>{var ns;$r.defaultPrevented||$r.key==="Enter"&&!$r.shiftKey&&((ns=fe[ct.id])!=null&&ns.trim())&&($r.preventDefault(),lt.mutate({postId:ct.id,content:fe[ct.id]}))},className:"text-sm min-h-0 py-1.5",minHeight:"32px"}),r.jsx(X,{size:"sm",variant:"ghost",onClick:()=>{var $r;($r=fe[ct.id])!=null&&$r.trim()&<.mutate({postId:ct.id,content:fe[ct.id]})},disabled:!((Zr=fe[ct.id])!=null&&Zr.trim()),className:"h-8 px-2 mt-0.5",children:r.jsx(ro,{className:"h-4 w-4"})})]})]})]})]})},ct.id)}),it&&r.jsx("div",{className:"flex justify-center pt-2",children:r.jsx(X,{variant:"outline",onClick:()=>xt(),disabled:Ee,children:Ee?"Loading…":"Load more posts"})})]}),r.jsx(Or,{open:!!G,onOpenChange:()=>Q(null),children:r.jsxs(Pr,{children:[r.jsx(zr,{children:r.jsx(Rr,{children:"Edit Post"})}),r.jsx(Ys,{value:ne,onChange:ct=>ie(ct.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&&Ve.mutate({postId:G.id,content:ne})},disabled:!ne.trim(),children:"Save Changes"})]})]})}),r.jsx(a4t,{images:we.images,initialIndex:we.index,open:we.open,onOpenChange:ct=>tt(zt=>({...zt,open:ct}))})]})]})})},F4={open:{label:"Open",icon:Ra,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:ql,color:"bg-blue-500"},resolved:{label:"Resolved",icon:ii,color:"bg-green-500"},closed:{label:"Closed",icon:jc,color:"bg-muted-foreground"}},qSe={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function c4t(){const{user:e}=Yr(),t=Br(),[s,n]=A.useState(null),[a,o]=A.useState(""),{data:l=[],isLoading:i}=Kt({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=[]}=Kt({queryKey:["ticket-replies",s==null?void 0:s.id],queryFn:async()=>{if(!s)return[];const{data:y,error:v}=await Y.from("support_ticket_replies").select("*, profiles(name)").eq("ticket_id",s.id).order("created_at",{ascending:!0});if(v)throw v;return y},enabled:!!s}),m=ar({mutationFn:async y=>{if(!s||!e)throw new Error("Missing data");const{error:v}=await Y.from("support_ticket_replies").insert({ticket_id:s.id,user_id:e.id,content:y,is_admin_reply:!1});if(v)throw v},onSuccess:()=>{t.invalidateQueries({queryKey:["ticket-replies",s==null?void 0:s.id]}),o(""),Te.success("Reply sent!")},onError:()=>{Te.error("Failed to send reply")}}),x=()=>{a.trim()&&m.mutate(a)};if(s){const y=F4[s.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:()=>n(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:s.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx(Tt,{variant:"secondary",children:qSe[s.category]}),r.jsxs(Tt,{className:F4[s.status].color,children:[r.jsx(y,{className:"h-3 w-3 mr-1"}),F4[s.status].label]})]})]})]}),r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsxs(Ns,{children:["Created on ",rs(new Date(s.created_at),"MMM d, yyyy 'at' h:mm a")]})}),r.jsx(Xe,{children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:s.description})})]}),r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsx(Gt,{className:"text-lg",children:"Conversation"})}),r.jsxs(Xe,{children:[r.jsx(Yo,{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:rs(new Date(v.created_at),"MMM d, h:mm a")})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:v.content})]},v.id)})})}),s.status!=="closed"&&r.jsxs(r.Fragment,{children:[r.jsx(pd,{className:"my-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Ys,{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(ro,{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(Xe,{className:"p-6 sm:p-8",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-6",children:[r.jsx("div",{className:"p-4 bg-primary/20 rounded-full",children:r.jsx(Zx,{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(Mme,{trigger:r.jsxs(X,{size:"lg",className:"gap-2",children:[r.jsx(vs,{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(Pi,{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(Mme,{trigger:r.jsxs(X,{variant:"outline",size:"sm",className:"gap-2",children:[r.jsx(vs,{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(Xe,{className:"text-center py-12",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 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=F4[y.status].icon;return r.jsx(He,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>n(y),children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-medium truncate",children:y.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx(Tt,{variant:"outline",className:"text-xs",children:qSe[y.category]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:rs(new Date(y.created_at),"MMM d, yyyy")})]})]}),r.jsxs(Tt,{className:F4[y.status].color,children:[r.jsx(v,{className:"h-3 w-3 mr-1"}),F4[y.status].label]})]})})},y.id)})})]})})}function d4t({open:e,onOpenChange:t}){return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Pr,{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(jn,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Rr,{children:"Schedule Agent Onboarding"}),r.jsx(Zs,{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 u4t({open:e,onOpenChange:t}){const{brokerageId:s}=Yr(),[n,a]=A.useState(""),[o,l]=A.useState([]),[i,u]=A.useState(!1),{data:m,isLoading:x}=Kt({queryKey:["brokerage-agents-for-onboarding",s],queryFn:async()=>{if(!s)return[];const{data:k,error:M}=await Y.from("profiles").select("id, name, email").eq("brokerage_id",s).order("name",{ascending:!0});if(M)throw M;return k},enabled:e&&!!s}),y=m==null?void 0:m.filter(k=>k.name.toLowerCase().includes(n.toLowerCase())||k.email.toLowerCase().includes(n.toLowerCase())),v=k=>{l(M=>M.includes(k)?M.filter(E=>E!==k):[...M,k])},b=async()=>{if(o.length===0){Te.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;Te.success(`Onboarding link sent to ${o.length} agent${o.length>1?"s":""}`),l([]),t(!1)}catch(k){console.error("Error sending onboarding link:",k),Te.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(Pr,{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(ro,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Rr,{children:"Send Onboarding Link"}),r.jsx(Zs,{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(ua,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search agents...",value:n,onChange:k=>a(k.target.value),className:"pl-10"})]}),x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Vr,{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(qs,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No agents found"})]}):r.jsx(Yo,{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(bl,{checked:o.includes(k.id),onCheckedChange:()=>v(k.id)}),r.jsx(Xn,{className:"h-8 w-8",children:r.jsx(Qn,{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(zn,{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(Vr,{className:"h-4 w-4 mr-2 animate-spin"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(ro,{className:"h-4 w-4 mr-2"}),"Send Link"]})})]})]})})}function h4t(){const[e,t]=A.useState(!1),[s,n]=A.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(He,{className:"mb-8",children:[r.jsx(Vt,{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(qs,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx(Gt,{children:"Agent Onboarding"}),r.jsx(Ns,{children:"Schedule onboarding sessions for yourself or your agents"})]})]})}),r.jsx(Xe,{children:r.jsxs("div",{className:"flex flex-wrap gap-4",children:[r.jsxs(X,{onClick:()=>t(!0),className:"flex items-center gap-2",children:[r.jsx(jn,{className:"h-4 w-4"}),"Schedule Agent Onboarding"]}),r.jsxs(X,{variant:"outline",onClick:()=>n(!0),className:"flex items-center gap-2",children:[r.jsx(ro,{className:"h-4 w-4"}),"Send New Agent Onboarding Link"]})]})})]}),r.jsx(d4t,{open:e,onOpenChange:t}),r.jsx(u4t,{open:s,onOpenChange:n})]})}function m4t({open:e,onOpenChange:t}){return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Pr,{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($g,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Rr,{children:"Schedule Launch Meeting"}),r.jsx(Zs,{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 p4t(){const[e,t]=A.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(He,{className:"mb-8",children:[r.jsx(Vt,{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($g,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx(Gt,{children:"Launch or ReLaunch Meeting"}),r.jsx(Ns,{children:"Schedule a private LevelUp information session for your brokerage. Have one of our staff host a meeting to help your team get the most out of all our trainings, tools, and resources."})]})]})}),r.jsx(Xe,{children:r.jsxs(X,{onClick:()=>t(!0),className:"flex items-center gap-2",children:[r.jsx($g,{className:"h-4 w-4"}),"Schedule Launch Meeting"]})})]}),r.jsx(m4t,{open:e,onOpenChange:t})]})}function f4t(){const e=Hs(),[t,s]=A.useState(""),[n,a]=A.useState(null),{data:o,isLoading:l}=Kt({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}=Kt({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}=Kt({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}=Kt({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}=Kt({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())),E=!n||k.category_id===n;return M&&E}),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,E=(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:E,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(h4t,{}),r.jsx(p4t,{}),r.jsxs("div",{className:"relative max-w-md",children:[r.jsx(ua,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search resources...",value:t,onChange:k=>s(k.target.value),className:"pl-10"})]}),v&&v.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(Tt,{variant:n===null?"default":"outline",className:"cursor-pointer",onClick:()=>a(null),children:"All"}),v.map(k=>r.jsx(Tt,{variant:n===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(Cr,{className:"h-40 w-full"}),r.jsx(Vt,{children:r.jsx(Cr,{className:"h-5 w-3/4"})}),r.jsxs(Xe,{children:[r.jsx(Cr,{className:"h-4 w-full mb-2"}),r.jsx(Cr,{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(rh,{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||n?"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:E,linkCount:T}=b(k.id),P=i==null?void 0:i.find(R=>R.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(rh,{className:"h-16 w-16 text-muted-foreground"})}),r.jsx(Vt,{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(Xe,{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(ga,{className:"h-4 w-4"}),M]}),E>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ta,{className:"h-4 w-4"}),E]}),T>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(zo,{className:"h-4 w-4"}),T]})]})]})]},k.id)})})]})})}const g4t=()=>{const{resourceId:e}=hc(),{data:t,isLoading:s}=Kt({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}),n=a=>a?a<1024?a+" B":a<1024*1024?(a/1024).toFixed(1)+" KB":(a/(1024*1024)).toFixed(1)+" MB":"";return s?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(ho,{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(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Ta,{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(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(ga,{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(ga,{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:n(a.file_size)})]})]}),r.jsx($i,{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(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Sn,{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(Sn,{className:"h-4 w-4 text-primary"})}),r.jsx("div",{className:"font-medium text-sm",children:a.title})]}),r.jsx(Sn,{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(rh,{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(ho,{to:"/brokerage-resources",children:"Back to Resources"})})]})})};function x4t(){const{onlineUsers:e,totalOnline:t}=yRe();return r.jsxs(He,{children:[r.jsx(Vt,{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(qs,{className:"h-4 w-4"}),"Online Now"]}),r.jsxs(Tt,{variant:"secondary",className:"bg-green-100 text-green-700",children:[r.jsx(sh,{className:"h-2 w-2 fill-green-500 text-green-500 mr-1"}),t," online"]})]})}),r.jsx(Xe,{children:e.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No other users online right now"}):r.jsx(Yo,{className:"h-[300px] pr-4",children:r.jsx("div",{className:"space-y-3",children:e.map(s=>{var n;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(Xn,{className:"h-9 w-9",children:[r.jsx(ji,{src:s.avatarUrl,alt:s.name}),r.jsx(Qn,{className:"text-xs",children:(n=s.name)==null?void 0:n.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:s.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Online ",ju(new Date(s.onlineSince),{addSuffix:!1})]})]})]},s.id)})})})})]})}const VSe={users:{label:"Users & Access",sections:[{title:"Members",description:"Manage users, roles, and brokerage assignments",icon:qs,path:"/admin/members",color:"bg-blue-500/10 text-blue-600"},{title:"Invite Codes",description:"Create and manage signup invite codes",icon:IA,path:"/admin/invite-codes",color:"bg-amber-500/10 text-amber-600"},{title:"Subscriptions",description:"Track and manage user subscriptions",icon:mp,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:Vg,path:"/admin/discounts",color:"bg-red-500/10 text-red-600"},{title:"Referral Program",description:"Track brokerage referrals and discounts",icon:Cc,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:Wc,path:"/admin/templates",color:"bg-pink-500/10 text-pink-600"},{title:"Manage Academy",description:"Upload videos and training content",icon:K1,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:Bn,path:"/admin/social-swag",color:"bg-fuchsia-500/10 text-fuchsia-600"},{title:"Social Swag 2.0",description:"New monthly social media images",icon:Bn,path:"/admin/social-swag-2",color:"bg-cyan-500/10 text-cyan-600"},{title:"Newsletters",description:"Manage monthly newsletter templates",icon:fy,path:"/admin/newsletters",color:"bg-violet-500/10 text-violet-600"},{title:"Manage Events",description:"Create and publish events with Zoom integration",icon:Af,path:"/admin/events",color:"bg-green-500/10 text-green-600"},{title:"Additional Services",description:"Manage additional service offerings",icon:rh,path:"/admin/additional-services",color:"bg-lime-500/10 text-lime-600"},{title:"Brokerage Resources",description:"Manage resources for brokerage managers",icon:rh,path:"/admin/brokerage-resources",color:"bg-slate-500/10 text-slate-600"},{title:"Agent Email Templates",description:"Manage curated email templates for agents",icon:Nn,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:Bj,path:"/admin/dashboard-management",color:"bg-teal-500/10 text-teal-600"},{title:"Manage Apps",description:"Configure app tiles and access requirements",icon:sm,path:"/admin/apps",color:"bg-purple-500/10 text-purple-600"},{title:"Email Templates",description:"Customize system email templates",icon:Nn,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:Pf,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:lA,path:"/admin/onboarding-checklist",color:"bg-emerald-500/10 text-emerald-600"},{title:"Marketplace",description:"Manage store categories, products, and orders",icon:Ug,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:oo,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:lo,path:"/admin/agent-points",color:"bg-amber-500/10 text-amber-600"},{title:"Integrations",description:"Connect Canva, Facebook & Instagram for platform-level features",icon:ym,path:"/admin/integrations",color:"bg-blue-500/10 text-blue-600"},{title:"Agent Cards",description:"Manage digital business cards for agents",icon:qs,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:Pf,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:Bo,path:"/admin/community",color:"bg-cyan-500/10 text-cyan-600"},{title:"Support Tickets",description:"View and respond to agent support requests",icon:PS,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:Mn,path:"/admin/membership-reviews",color:"bg-amber-500/10 text-amber-600"},{title:"Weekly Digest",description:"Configure automated weekly email digests",icon:Nn,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:wc,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:sa,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"},{title:"Guest Book Analytics",description:"Track open house sign-in usage, visitors, and lead generation",icon:q1,path:"/admin/guest-book-analytics",color:"bg-gradient-to-br from-emerald-500/20 to-teal-500/10 text-emerald-600"}]}};function y4t(){const e=Hs();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(x4t,{})})]}),r.jsxs(Si,{defaultValue:"users",className:"w-full",children:[r.jsx(ki,{className:"w-full justify-start flex-wrap h-auto gap-1 bg-muted/50 p-1",children:Object.entries(VSe).map(([t,s])=>r.jsx(is,{value:t,className:"data-[state=active]:bg-background",children:s.label},t))}),Object.entries(VSe).map(([t,s])=>r.jsx(Ss,{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:s.sections.map(n=>r.jsxs(He,{className:"cursor-pointer hover:shadow-md transition-all hover:border-primary/50 group",onClick:()=>e(n.path),children:[r.jsxs(Vt,{className:"pb-3",children:[r.jsx("div",{className:`w-10 h-10 rounded-lg flex items-center justify-center ${n.color} mb-2 group-hover:scale-110 transition-transform`,children:r.jsx(n.icon,{className:"h-5 w-5"})}),r.jsx(Gt,{className:"text-base",children:n.title})]}),r.jsx(Xe,{className:"pt-0",children:r.jsx(Ns,{className:"text-sm",children:n.description})})]},n.path))})},t))]})]})})}const Pn=A.forwardRef(({className:e,...t},s)=>r.jsx("div",{className:"relative w-full overflow-auto",children:r.jsx("table",{ref:s,className:Ut("w-full caption-bottom text-sm",e),...t})}));Pn.displayName="Table";const Ln=A.forwardRef(({className:e,...t},s)=>r.jsx("thead",{ref:s,className:Ut("[&_tr]:border-b",e),...t}));Ln.displayName="TableHeader";const On=A.forwardRef(({className:e,...t},s)=>r.jsx("tbody",{ref:s,className:Ut("[&_tr:last-child]:border-0",e),...t}));On.displayName="TableBody";const v4t=A.forwardRef(({className:e,...t},s)=>r.jsx("tfoot",{ref:s,className:Ut("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));v4t.displayName="TableFooter";const kr=A.forwardRef(({className:e,...t},s)=>r.jsx("tr",{ref:s,className:Ut("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",e),...t}));kr.displayName="TableRow";const Mt=A.forwardRef(({className:e,...t},s)=>r.jsx("th",{ref:s,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 gt=A.forwardRef(({className:e,...t},s)=>r.jsx("td",{ref:s,className:Ut("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));gt.displayName="TableCell";const _4t=A.forwardRef(({className:e,...t},s)=>r.jsx("caption",{ref:s,className:Ut("mt-4 text-sm text-muted-foreground",e),...t}));_4t.displayName="TableCaption";const b4t=()=>{const{isAdmin:e}=Yr(),t=Hs(),[s,n]=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;n(k||[])}catch(k){console.error("Error loading apps:",k),Te.error("Failed to load apps")}finally{o(!1)}},y=async k=>{k.preventDefault();const M=new FormData(k.currentTarget),E={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(E).eq("id",u.id);if(T)throw T;Te.success("App updated successfully")}else{const{error:T}=await Y.from("app_tiles").insert([E]);if(T)throw T;Te.success("App created successfully")}i(!1),m(null),x()}catch(T){console.error("Error saving app:",T),Te.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;Te.success("App deleted successfully"),x()}catch(M){console.error("Error deleting app:",M),Te.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(vo,{asChild:!0,children:r.jsxs(X,{onClick:N,children:[r.jsx(vs,{className:"mr-2 h-4 w-4"}),"Add App"]})}),r.jsxs(Pr,{className:"max-w-2xl",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:u?"Edit App":"Create New App"}),r.jsx(Zs,{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(ot,{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(ot,{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(Ys,{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(ot,{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(ot,{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(ot,{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(Vt,{children:[r.jsx(Gt,{children:"Application Tiles"}),r.jsx(Ns,{children:"Manage the apps that appear on the member dashboard"})]}),r.jsx(Xe,{children:s.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(vs,{className:"mr-2 h-4 w-4"}),"Create First App"]})]}):r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:s.map(k=>r.jsxs(kr,{children:[r.jsx(gt,{className:"text-2xl",children:k.icon}),r.jsx(gt,{className:"font-medium",children:k.name}),r.jsx(gt,{className:"font-mono text-sm",children:k.app_id}),r.jsx(gt,{className:"text-sm text-muted-foreground max-w-xs truncate",children:k.target_url}),r.jsx(gt,{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(gt,{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(Bs,{className:"h-4 w-4"})})]})})]},k.id))})]})})]})})]})};function Eu({title:e,description:t,children:s}){return r.jsxs("div",{className:"space-y-4",children:[r.jsx(ho,{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})]}),s]})]})}const HSe=({expiresAt:e,className:t})=>{const s=new Date().getTime(),n=new Date(e).getTime(),a=Math.ceil((n-s)/(1e3*60*60*24));return a<=0?r.jsxs(Tt,{variant:"destructive",className:Ut("gap-1",t),children:[r.jsx(Zu,{className:"h-3 w-3"}),"Trial Expired"]}):a<=1?r.jsxs(Tt,{variant:"destructive",className:Ut("gap-1",t),children:[r.jsx(Ra,{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(Ra,{className:"h-3 w-3"}),"Trial: ",a," days left"]}):r.jsxs(Tt,{variant:"secondary",className:Ut("gap-1",t),children:[r.jsx(Ra,{className:"h-3 w-3"}),"Trial: ",a," days left"]})},G9e=({open:e,onOpenChange:t,brokerages:s,fixedBrokerageId:n,onSuccess:a})=>{const{toast:o}=ci(),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),E=()=>{u([]),x(""),N("upload"),M(null),l.current&&(l.current.value="")},T=()=>{E(),t(!1)},P=H=>{const G=H.split(` `).map(se=>se.trim()).filter(se=>se);if(G.length===0)return[];const Q=G[0].toLowerCase(),ie=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,he=[];for(const se of ie){const oe=(se.includes(" ")?se.split(" "):se.split(",")).map(ce=>ce.trim().replace(/^["']|["']$/g,""));if(oe.length>=2){let ce="",de="",xe="",Me="",ve;if(oe.length===2){const tt=oe[0].split(" ");ce=tt[0]||"",de=tt.slice(1).join(" ")||"",xe=oe[1]}else if(oe.length===3)ce=oe[0],de=oe[1],xe=oe[2];else if(oe.length===4)ce=oe[0],de=oe[1],xe=oe[2],Me=oe[3];else if(oe.length>=5){ce=oe[0],de=oe[1],xe=oe[2],Me=oe[3];const tt=oe[4].toLowerCase();ve=tt==="true"||tt==="yes"||tt==="1"||tt==="y"}const we=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(xe);he.push({firstName:ce.trim(),lastName:de.trim(),email:xe.trim().toLowerCase(),phone:Me.trim()||void 0,smsConsent:ve,isValid:we&&ce.trim().length>0,error:we?ce.trim()?void 0:"Missing name":"Invalid email"})}}return he},R=H=>{var ne;const G=(ne=H.target.files)==null?void 0:ne[0];if(!G)return;const Q=new FileReader;Q.onload=ie=>{var fe;const he=(fe=ie.target)==null?void 0:fe.result,se=P(he);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 H=i.filter(Q=>Q.isValid);if(H.length===0){o({title:"No valid users",description:"There are no valid users to import.",variant:"destructive"});return}const G=n||m||null;v(!0);try{const{data:{session:Q}}=await Y.auth.getSession(),ne=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:H.map(he=>({firstName:he.firstName,lastName:he.lastName,email:he.email,phone:he.phone,smsConsent:he.smsConsent})),brokerageId:G})}),ie=await ne.json();if(!ne.ok)throw new Error(ie.error||"Failed to import users");M(ie),N("result"),ie.created>0&&a(),o({title:"Import Complete",description:`${ie.created} user(s) created successfully.${ie.failed>0?` ${ie.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(H=>H.isValid).length,q=i.filter(H=>!H.isValid).length;return r.jsx(Or,{open:e,onOpenChange:T,children:r.jsxs(Pr,{className:"max-w-2xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{className:"flex items-center gap-2",children:[r.jsx(W1,{className:"h-5 w-5"}),"Import Agents from CSV"]}),r.jsx(Zs,{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:R,className:"hidden"}),r.jsx(so,{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 H;return(H=l.current)==null?void 0:H.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:[!n&&s&&s.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Assign to Brokerage (optional)"}),r.jsxs(us,{value:m||"none",onValueChange:H=>x(H==="none"?"":H),children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select a brokerage..."})}),r.jsxs(ds,{children:[r.jsx($t,{value:"none",children:"No brokerage"}),s.map(H=>r.jsx($t,{value:H.id,children:H.name},H.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(Ki,{className:"h-4 w-4 text-green-500"}),r.jsxs("span",{children:[U," valid"]})]}),q>0&&r.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[r.jsx(vl,{className:"h-4 w-4"}),r.jsxs("span",{children:[q," invalid"]})]})]}),r.jsxs("div",{className:"flex-1 overflow-auto border rounded-lg",children:[r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:i.slice(0,100).map((H,G)=>r.jsxs(kr,{children:[r.jsx(gt,{children:H.firstName}),r.jsx(gt,{children:H.lastName}),r.jsx(gt,{children:H.email}),r.jsx(gt,{className:"text-muted-foreground",children:H.phone||"-"}),r.jsx(gt,{className:"text-muted-foreground",children:H.smsConsent===!0?"✓":H.smsConsent===!1?"✗":"-"}),r.jsx(gt,{children:H.isValid?r.jsx(Tt,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):r.jsx(Tt,{variant:"destructive",children:H.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(Ki,{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((H,G)=>r.jsxs("li",{children:["• ",H]},G)),k.errors.length>10&&r.jsxs("li",{children:["...and ",k.errors.length-10," more"]})]})]})]}),r.jsxs(zn,{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:E,children:"Back"}),r.jsx(X,{onClick:D,disabled:y||U===0,children:y?r.jsxs(r.Fragment,{children:[r.jsx(Vr,{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"})]})]})})},w4t=[{type:"custom",title:"Great job!",message:"Keep up the amazing work!",icon:Mn},{type:"custom",title:"You're on fire!",message:"Your dedication is inspiring!",icon:lo},{type:"custom",title:"Congratulations!",message:"You earned this celebration!",icon:Gc}];function K9e({open:e,onOpenChange:t,userId:s,userName:n}){const[a,o]=A.useState("custom"),[l,i]=A.useState(""),[u,m]=A.useState(""),x=Olt(),y=b=>{o(b.type),i(b.title),m(b.message)},v=async b=>{if(b.preventDefault(),!l.trim()){Wn({title:"Title required",description:"Please enter a celebration title",variant:"destructive"});return}try{await x.mutateAsync({user_id:s,celebration_type:a,title:l.trim(),message:u.trim()||void 0}),Wn({title:"Celebration sent! 🎉",description:`${n} will see confetti on their next visit!`}),t(!1),i(""),m(""),o("custom")}catch{Wn({title:"Error",description:"Failed to send celebration",variant:"destructive"})}};return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Pr,{className:"sm:max-w-md",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{className:"flex items-center gap-2",children:[r.jsx(Gc,{className:"h-5 w-5 text-primary"}),"Send Celebration to ",n]}),r.jsx(Zs,{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:w4t.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(us,{value:a,onValueChange:b=>o(b),children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsxs(ds,{children:[r.jsx($t,{value:"custom",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Mn,{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(lo,{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(sa,{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(ot,{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(Ys,{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(Gc,{className:"h-4 w-4 mr-2"}),x.isPending?"Sending...":"Send Celebration"]})]})]})]})})}const Lde={points_earned:{label:"Points Earned",icon:lo,color:"bg-yellow-500"},listing_created:{label:"Listing Created",icon:sa,color:"bg-blue-500"},deal_closed:{label:"Deal Closed",icon:zd,color:"bg-green-500"},custom:{label:"Custom",icon:Bn,color:"bg-purple-500"}};function j4t(){const[e,t]=A.useState(""),[s,n]=A.useState("all"),[a,o]=A.useState("all"),{data:l=[],isLoading:i}=Kt({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,E,T;return{...k,user_name:((M=N.get(k.user_id))==null?void 0:M.name)||"Unknown",user_email:((E=N.get(k.user_id))==null?void 0:E.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=s==="all"||x.celebration_type===s,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(Lde).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(Vr,{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(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium",children:"Total Celebrations"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:m.total})})]}),r.jsxs(He,{children:[r.jsx(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-green-600",children:"Seen"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold text-green-600",children:m.seen})})]}),r.jsxs(He,{children:[r.jsx(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-orange-600",children:"Pending"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold text-orange-600",children:m.unseen})})]}),r.jsxs(He,{children:[r.jsx(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-purple-600",children:"Custom Sent"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold text-purple-600",children:m.byType.custom||0})})]})]}),r.jsxs(He,{children:[r.jsxs(Vt,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Gc,{className:"h-5 w-5"}),"Celebration History"]}),r.jsx(Ns,{children:"View all celebrations awarded to agents"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ua,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by agent name, email, or title...",value:e,onChange:x=>t(x.target.value),className:"pl-9"})]}),r.jsxs(us,{value:s,onValueChange:n,children:[r.jsx(cs,{className:"w-[180px]",children:r.jsx(ms,{placeholder:"Filter by type"})}),r.jsxs(ds,{children:[r.jsx($t,{value:"all",children:"All Types"}),Object.entries(Lde).map(([x,y])=>r.jsx($t,{value:x,children:y.label},x))]})]}),r.jsxs(us,{value:a,onValueChange:o,children:[r.jsx(cs,{className:"w-[140px]",children:r.jsx(ms,{placeholder:"Status"})}),r.jsxs(ds,{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(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:u.length===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"No celebrations found"})}):u.map(x=>{const y=Lde[x.celebration_type],v=y.icon;return r.jsxs(kr,{children:[r.jsx(gt,{children:r.jsxs(Tt,{variant:"outline",className:"gap-1",children:[r.jsx(v,{className:"h-3 w-3"}),y.label]})}),r.jsx(gt,{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(gt,{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(gt,{children:x.points_amount?r.jsxs(Tt,{variant:"secondary",children:["+",x.points_amount]}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(gt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:x.creator_name})}),r.jsx(gt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:rs(new Date(x.created_at),"MMM d, yyyy h:mm a")})}),r.jsx(gt,{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 k4t=()=>{const{user:e}=Yr(),{toast:t}=ci(),[s,n]=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:he,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:fe,error:oe}=await Y.from("trial_email_exports").select("user_id");if(oe)throw oe;const ce=new Set((fe||[]).map(xe=>xe.user_id)),de=(he||[]).map(xe=>({...xe,converted_from_trial_at:xe.converted_from_trial_at??null,already_exported:ce.has(xe.id)}));de.sort((xe,Me)=>new Date(Me.created_at).getTime()-new Date(xe.created_at).getTime()),n(de)}catch(he){console.error("Error loading trial users:",he),t({title:"Error",description:"Failed to load trial users",variant:"destructive"})}finally{o(!1)}},[t]);A.useEffect(()=>{M()},[M]);const E=he=>he.trial_started_at?"ghl":"stripe",T=he=>he.trial_expires_at?he.trial_expires_at:he.subscription_end_date?he.subscription_end_date:null,P=he=>he.converted_from_trial_at!==null,R=he=>{if(P(he))return!1;const se=T(he);return se?new Date(se).getTime()<=Date.now():!1},D=s.filter(he=>!(u!=="all"&&E(he)!==u||x==="active"&&(R(he)||P(he))||x==="expired"&&!R(he)||x==="converted"&&!P(he)||v==="new"&&he.already_exported||v==="exported"&&!he.already_exported)),U=()=>{N.size===D.length?k(new Set):k(new Set(D.map(he=>he.id)))},q=he=>{const se=new Set(N);se.has(he)?se.delete(he):se.add(he),k(se)},H=async()=>{if(N.size===0){t({title:"No users selected",description:"Select users to export",variant:"destructive"});return}i(!0);try{const he=s.filter(ve=>N.has(ve.id)),se="First Name,Last Name,Email,Phone,Trial Type,Status,Signup Date,Expiry Date",fe=he.map(ve=>{const be=(ve.name||"").split(" "),we=be[0]||"",tt=be.slice(1).join(" ")||"",Ae=E(ve)==="stripe"?"Credit Card Trial":"Free Trial (No CC)",Le=P(ve)?"Converted":R(ve)?"Expired":"Active",Ue=ve.created_at?new Date(ve.created_at).toLocaleDateString():"",Pe=T(ve)?new Date(T(ve)).toLocaleDateString():"";return`"${we}","${tt}","${ve.email}","${ve.phone||""}","${Ae}","${Le}","${Ue}","${Pe}"`}),oe=[se,...fe].join(` `),ce=new Blob([oe],{type:"text/csv"}),de=URL.createObjectURL(ce),xe=document.createElement("a");xe.href=de,xe.download=`trial-users-${new Date().toISOString().split("T")[0]}.csv`,xe.click(),URL.revokeObjectURL(de);const Me=he.filter(ve=>!ve.already_exported).map(ve=>({user_id:ve.id,exported_by:e.id}));if(Me.length>0){const{error:ve}=await Y.from("trial_email_exports").upsert(Me,{onConflict:"user_id"});ve&&console.error("Error marking exports:",ve)}t({title:"Export complete",description:`Downloaded ${he.length} trial user(s). ${Me.length} newly marked as exported.`}),k(new Set),M()}catch(he){console.error("Export error:",he),t({title:"Error",description:"Failed to export",variant:"destructive"})}finally{i(!1)}},G=s.filter(he=>!he.already_exported).length,Q=s.filter(he=>he.already_exported).length,ne=s.filter(he=>P(he)).length,ie=s.filter(he=>!R(he)&&!P(he)).length;return a?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(Vr,{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(Vt,{className:"pb-2",children:[r.jsx(Ns,{children:"Total"}),r.jsx(Gt,{className:"text-2xl",children:s.length})]})}),r.jsx(He,{children:r.jsxs(Vt,{className:"pb-2",children:[r.jsx(Ns,{children:"New (Not Exported)"}),r.jsx(Gt,{className:"text-2xl text-green-600",children:G})]})}),r.jsx(He,{children:r.jsxs(Vt,{className:"pb-2",children:[r.jsx(Ns,{children:"Active Trials"}),r.jsx(Gt,{className:"text-2xl",children:ie})]})}),r.jsx(He,{children:r.jsxs(Vt,{className:"pb-2",children:[r.jsx(Ns,{children:"Converted 🎉"}),r.jsx(Gt,{className:"text-2xl text-primary",children:ne})]})}),r.jsx(He,{children:r.jsxs(Vt,{className:"pb-2",children:[r.jsx(Ns,{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(us,{value:v,onValueChange:he=>b(he),children:[r.jsx(cs,{className:"w-[160px]",children:r.jsx(ms,{})}),r.jsxs(ds,{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(us,{value:u,onValueChange:he=>m(he),children:[r.jsx(cs,{className:"w-[180px]",children:r.jsx(ms,{})}),r.jsxs(ds,{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(us,{value:x,onValueChange:he=>y(he),children:[r.jsx(cs,{className:"w-[160px]",children:r.jsx(ms,{})}),r.jsxs(ds,{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:H,disabled:l||N.size===0,children:[l?r.jsx(Vr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx($i,{className:"h-4 w-4 mr-2"}),"Export Selected (",N.size,")"]})})]}),r.jsx("div",{className:"border rounded-lg",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(Mt,{className:"w-[40px]",children:r.jsx(bl,{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(On,{children:D.length===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"No trial users match the current filters"})}):D.map(he=>{const se=E(he),fe=P(he),oe=R(he),ce=T(he);return r.jsxs(kr,{className:`hover:bg-muted/30 ${fe?"bg-primary/5":""}`,children:[r.jsx(gt,{children:r.jsx(bl,{checked:N.has(he.id),onCheckedChange:()=>q(he.id)})}),r.jsx(gt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[he.name,fe&&r.jsx(bu,{className:"h-3.5 w-3.5 text-primary"})]})}),r.jsx(gt,{className:"text-muted-foreground",children:he.email}),r.jsx(gt,{children:se==="stripe"?r.jsxs(Tt,{variant:"outline",className:"gap-1",children:[r.jsx(mp,{className:"h-3 w-3"}),"Credit Card"]}):r.jsxs(Tt,{variant:"secondary",className:"gap-1",children:[r.jsx(Nn,{className:"h-3 w-3"}),"Free (No CC)"]})}),r.jsx(gt,{children:fe?r.jsxs(Tt,{className:"bg-primary/10 text-primary hover:bg-primary/20 gap-1",children:[r.jsx(bu,{className:"h-3 w-3"}),"Converted"]}):oe?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(gt,{className:"text-sm",children:he.created_at?new Date(he.created_at).toLocaleDateString():"—"}),r.jsx(gt,{className:"text-sm",children:fe&&ce?r.jsxs("span",{className:"text-muted-foreground",children:["Renews ",new Date(ce).toLocaleDateString()]}):ce?new Date(ce).toLocaleDateString():"—"}),r.jsx(gt,{children:he.already_exported?r.jsx(Ki,{className:"h-4 w-4 text-muted-foreground"}):r.jsx(Tt,{variant:"outline",className:"text-green-600 border-green-300",children:"New"})})]},he.id)})})]})}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",D.length," of ",s.length," trial users · ",ne," converted to paid"]})]})},N4t=()=>{const[e,t]=A.useState([]),[s,n]=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),n(!1)})()},[]),s?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(Vr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):e.length===0?r.jsx(He,{children:r.jsxs(Xe,{className:"py-12 text-center text-muted-foreground",children:[r.jsx(Bs,{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(Vt,{children:r.jsx(Gt,{className:"text-lg",children:"User Deletion History"})}),r.jsx(Xe,{children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:e.map(a=>r.jsxs(kr,{children:[r.jsx(gt,{className:"whitespace-nowrap text-sm",children:rs(new Date(a.created_at),"MMM d, yyyy h:mm a")}),r.jsx(gt,{className:"font-medium",children:a.deleted_user_name||"—"}),r.jsx(gt,{className:"text-sm text-muted-foreground",children:a.deleted_user_email||"—"}),r.jsx(gt,{children:a.brokerage_name||"—"}),r.jsx(gt,{children:r.jsx(Tt,{variant:a.deletion_type==="deleted"?"destructive":"secondary",children:a.deletion_type==="deleted"?"Account Deleted":"Removed"})}),r.jsx(gt,{className:"text-sm",children:a.deleted_by_name||a.deleted_by_email||"—"})]},a.id))})]})})]})},S4t=()=>{const e=Hs(),{user:t,isAdmin:s}=Yr(),{startImpersonation:n,isLoading:a}=Fxe(),{toast:o}=ci(),[l,i]=A.useState([]),[u,m]=A.useState([]),[x,y]=A.useState([]),[v,b]=A.useState({}),[N,k]=A.useState(!0),[M,E]=A.useState({}),[T,P]=A.useState(!1),[R,D]=A.useState({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),[U,q]=A.useState(!1),[H,G]=A.useState(""),[Q,ne]=A.useState(1),[ie,he]=A.useState(50),[se,fe]=A.useState("all"),[oe,ce]=A.useState("all"),[de,xe]=A.useState("all"),[Me,ve]=A.useState("all"),[be,we]=A.useState(!1),[tt,Ae]=A.useState(!1),[Le,Ue]=A.useState(null),[Pe,$e]=A.useState(null),[it,xt]=A.useState(!1),[Ee,et]=A.useState({name:"",email:"",brokerage_id:"",phone:""}),[le,Ve]=A.useState(null),[Je,rt]=A.useState(!1),[je,lt]=A.useState(""),[Ce,Ie]=A.useState(!1),[Ze,De]=A.useState(!1),[Ke,st]=A.useState(null),[dt,ct]=A.useState(""),[zt,ir]=A.useState(!1),[Tr,Zr]=A.useState(!1),[$r,ns]=A.useState(null),[Xs,Ot]=A.useState(!1),[Hr,Ts]=A.useState(!1),[zs,wa]=A.useState(null),[gi,Ao]=A.useState(""),[Ga,mn]=A.useState(!1),[na,pn]=A.useState({email:"",name:"",password:"",phone:""}),[Jn,$n]=A.useState(!1),[Ci,or]=A.useState(!1),[La,co]=A.useState(""),[Ni,Ws]=A.useState(!1),[Yi,mc]=A.useState(!1),[bo,pc]=A.useState(""),[nt,ye]=A.useState(new Set),[Oe,Ye]=A.useState(!1),[St,wt]=A.useState(!1),[It,qt]=A.useState(null),[Lt,Wt]=A.useState(!1),[pr,cr]=A.useState(null),[Qr,Ms]=A.useState([]),[Kr,dn]=A.useState([]),[un,nn]=A.useState(!1),[Gn,qi]=A.useState({});A.useEffect(()=>{!t||!s||(ja(),Eo())},[t,s]);const So=async()=>{try{const{data:Nt,error:fr}=await Y.from("brokerage_manager_assignments").select("user_id, brokerage_id");if(fr)throw fr;const Lr={};for(const on of Nt??[])Lr[on.brokerage_id]||(Lr[on.brokerage_id]=[]),Lr[on.brokerage_id].push(on.user_id);b(Lr)}catch(Nt){console.error("Error loading brokerage manager assignments:",Nt)}},ja=async()=>{try{k(!0);const{data:Nt,error:fr}=await Y.functions.invoke("get-user-details");if(fr)throw fr;const Lr=Nt.users||[];i(Lr),y(Nt.brokerages||[]),await So();const on=Lr.filter(ln=>ln.roles.includes("assistant"));if(on.length>0){const ln=on.map(Rn=>Rn.id),{data:ia}=await Y.from("agent_assistant_assignments").select("agent_id, assistant_id").in("assistant_id",ln);if(ia&&ia.length>0){const Rn=[...new Set(ia.map(cu=>cu.agent_id))],{data:ka}=await Y.from("profiles").select("id, name, email").in("id",Rn),Wh={};for(const cu of ia){const Ll=ka==null?void 0:ka.find(Na=>Na.id===cu.agent_id);Ll&&(Wh[cu.assistant_id]={agent_name:Ll.name||"",agent_email:Ll.email||""})}qi(Wh)}}}catch(Nt){console.error("Error loading members:",Nt),o({title:"Error",description:"Failed to load members",variant:"destructive"})}finally{k(!1)}},Eo=async()=>{try{const{data:Nt,error:fr}=await Y.from("app_tiles").select("id, name, icon, app_id, required_tags").order("name");if(fr)throw fr;m(Nt||[])}catch(Nt){console.error("Error loading apps:",Nt),o({title:"Error",description:"Failed to load apps",variant:"destructive"})}},Li=async Nt=>{if(!Ee.name.trim()||!Ee.email.trim()){o({title:"Error",description:"Name and email are required",variant:"destructive"});return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(Ee.email)){o({title:"Error",description:"Please enter a valid email address",variant:"destructive"});return}try{const{error:Lr}=await Y.from("profiles").update({name:Ee.name.trim(),email:Ee.email.trim(),brokerage_id:Ee.brokerage_id||null,phone:Ee.phone.trim()||null}).eq("id",Nt);if(Lr)throw Lr;o({title:"Success",description:"Member details updated successfully"}),Ue(null),ja()}catch(Lr){console.error("Error updating member:",Lr),o({title:"Error",description:Lr.message||"Failed to update member",variant:"destructive"})}},aa=async Nt=>{try{const{data:{session:fr}}=await Y.auth.getSession(),Lr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${fr==null?void 0:fr.access_token}`},body:JSON.stringify({userId:Nt})}),on=await Lr.json();if(!Lr.ok)throw new Error(on.error||"Failed to resend welcome email");o({title:"Success",description:"Welcome email sent successfully"})}catch(fr){console.error("Error resending welcome email:",fr),o({title:"Error",description:fr.message||"Failed to resend welcome email",variant:"destructive"})}},Oi=async(Nt,fr)=>{try{const{error:Lr}=await Y.functions.invoke("send-password-reset",{body:{email:Nt,redirectTo:window.location.origin}});if(Lr)throw Lr;o({title:"Password Reset Sent",description:`Password reset email sent to ${fr}`})}catch(Lr){console.error("Error sending password reset:",Lr),o({title:"Error",description:Lr.message||"Failed to send password reset email",variant:"destructive"})}},Ka=async(Nt,fr)=>{if(confirm(`Are you sure you want to delete ${fr}? This action cannot be undone.`))try{const{data:{session:Lr}}=await Y.auth.getSession(),on=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Lr==null?void 0:Lr.access_token}`},body:JSON.stringify({userId:Nt})}),ln=await on.json();if(!on.ok)throw new Error(ln.error||"Failed to delete user");o({title:"Success",description:"User deleted successfully"}),ja()}catch(Lr){console.error("Error deleting user:",Lr),o({title:"Error",description:Lr.message||"Failed to delete user",variant:"destructive"})}},Dn=async()=>{if(!R.email||!R.name||!R.password){o({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}if(R.role==="brokerage_manager"&&!R.brokerage_id){o({title:"Error",description:"Please select a brokerage for this manager",variant:"destructive"});return}P(!0);try{const{data:{session:Nt}}=await Y.auth.getSession(),fr=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(R)}),Lr=await fr.json();if(!fr.ok)throw new Error(Lr.error||"Failed to create user");if(R.role&&R.role!=="user"&&Lr.userId){const on=R.role==="brokerage_manager"?R.brokerage_id:void 0;await Di(Lr.userId,R.role,"add",on)}o({title:"Success",description:`User ${R.email} created successfully`}),D({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),q(!1),ja()}catch(Nt){console.error("Error creating user:",Nt),o({title:"Error",description:Nt.message||"Failed to create user",variant:"destructive"})}finally{P(!1)}},Di=async(Nt,fr,Lr,on)=>{try{const{data:{session:ln}}=await Y.auth.getSession(),ia={userId:Nt,role:fr,action:Lr};if(fr==="brokerage_manager"){if(!on){o({title:"Error",description:"Please choose a brokerage for this manager assignment",variant:"destructive"});return}ia.brokerageId=on}const Rn=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ln==null?void 0:ln.access_token}`},body:JSON.stringify(ia)}),ka=await Rn.json();if(!Rn.ok)throw new Error(ka.error||"Failed to manage user role");o({title:"Success",description:`Role ${Lr==="add"?"added":"removed"} successfully`}),ja()}catch(ln){console.error("Error managing user role:",ln),o({title:"Error",description:ln.message||"Failed to manage user role",variant:"destructive"})}},wl=(Nt,fr)=>fr.length===0?!0:fr.some(Lr=>Nt.includes(Lr)),Pl=async(Nt,fr,Lr)=>{const on=`${Nt}-${fr.id}`;Ve(on);try{if(Lr){const ln=l.find(Rn=>Rn.id===Nt),ia=fr.required_tags.filter(Rn=>ln==null?void 0:ln.tags.includes(Rn));for(const Rn of ia){const{error:ka}=await Y.from("user_tags").delete().eq("user_id",Nt).eq("tag",Rn);if(ka)throw ka}o({title:"Access Removed",description:`Removed access to ${fr.name}`})}else if(fr.required_tags.length>0){const{error:ln}=await Y.from("user_tags").insert({user_id:Nt,tag:fr.required_tags[0]});if(ln)throw ln;o({title:"Access Granted",description:`Granted access to ${fr.name}`})}await ja()}catch(ln){console.error("Error toggling access:",ln),o({title:"Error",description:ln.message||"Failed to update access",variant:"destructive"})}finally{Ve(null)}},Xc=async()=>{const Nt=je.trim();if(!Nt){o({title:"Error",description:"Brokerage name is required",variant:"destructive"});return}if(Nt.length>100){o({title:"Error",description:"Brokerage name must be less than 100 characters",variant:"destructive"});return}if(x.find(Lr=>Lr.name.toLowerCase()===Nt.toLowerCase())){o({title:"Error",description:"A brokerage with this name already exists",variant:"destructive"});return}Ie(!0);try{const{error:Lr}=await Y.from("brokerages").insert({name:Nt});if(Lr)throw Lr;o({title:"Success",description:`Brokerage "${Nt}" created successfully`}),lt(""),rt(!1),ja()}catch(Lr){console.error("Error creating brokerage:",Lr),o({title:"Error",description:Lr.message||"Failed to create brokerage",variant:"destructive"})}finally{Ie(!1)}},Im=Nt=>{st(Nt),ct(Nt.name),De(!0)},Xo=()=>{st(null),ct(""),De(!1)},Hd=async()=>{if(!Ke)return;const Nt=dt.trim();if(!Nt){o({title:"Error",description:"Brokerage name is required",variant:"destructive"});return}if(Nt.length>100){o({title:"Error",description:"Brokerage name must be less than 100 characters",variant:"destructive"});return}ir(!0);try{const{error:fr}=await Y.from("brokerages").update({name:Nt}).eq("id",Ke.id);if(fr)throw fr;o({title:"Success",description:"Brokerage updated successfully"}),Xo(),ja()}catch(fr){console.error("Error updating brokerage:",fr),o({title:"Error",description:fr.message||"Failed to update brokerage",variant:"destructive"})}finally{ir(!1)}},fc=async(Nt,fr)=>{var Lr;if(!fr||typeof fr!="string"){o({title:"Error",description:"Please select a brokerage first",variant:"destructive"});return}try{const on={userId:Nt,role:"brokerage_manager",action:"add",brokerageId:fr};console.debug("[assignManagerToBrokerage] payload",on);const{data:{session:ln}}=await Y.auth.getSession(),ia=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ln==null?void 0:ln.access_token}`},body:JSON.stringify(on)}),Rn=await ia.json();if(!ia.ok&&!((Lr=Rn.error)!=null&&Lr.includes("duplicate")))throw new Error(Rn.error||"Failed to add role");o({title:"Success",description:"Manager assigned to brokerage"}),await ja()}catch(on){console.error("Error assigning manager:",on),o({title:"Error",description:on.message||"Failed to assign manager",variant:"destructive"})}},mh=Nt=>{ns(Nt),Zr(!0)},Qo=async()=>{if($r){Ot(!0);try{const Nt=l.filter(on=>on.brokerage_id===$r.id),{data:{session:fr}}=await Y.auth.getSession();for(const on of Nt){const ln=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${fr==null?void 0:fr.access_token}`},body:JSON.stringify({userId:on.id})});if(!ln.ok){const ia=await ln.json();console.error(`Failed to delete user ${on.email}:`,ia.error)}}const{error:Lr}=await Y.from("brokerages").delete().eq("id",$r.id);if(Lr)throw Lr;o({title:"Success",description:`Brokerage "${$r.name}" and ${Nt.length} member(s) deleted`}),Zr(!1),ns(null),ja()}catch(Nt){console.error("Error deleting brokerage:",Nt),o({title:"Error",description:Nt.message||"Failed to delete brokerage",variant:"destructive"})}finally{Ot(!1)}}},Mp=Nt=>{wa(Nt),Ao(""),Ts(!0)},Kf=()=>{wa(null),Ao(""),Ts(!1)},Yy=async Nt=>{try{const{error:fr}=await Y.from("profiles").update({brokerage_id:null}).eq("id",Nt);if(fr)throw fr;o({title:"Success",description:"User removed from brokerage"}),ja()}catch(fr){console.error("Error removing user from brokerage:",fr),o({title:"Error",description:fr.message||"Failed to remove user",variant:"destructive"})}},Xy=async(Nt,fr)=>{try{const{error:Lr}=await Y.from("profiles").update({brokerage_id:fr}).eq("id",Nt);if(Lr)throw Lr;o({title:"Success",description:"User added to brokerage"}),ja()}catch(Lr){console.error("Error adding user to brokerage:",Lr),o({title:"Error",description:Lr.message||"Failed to add user",variant:"destructive"})}},Qy=async()=>{if(!zs||!na.email||!na.name||!na.password){o({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}$n(!0);try{const{data:{session:Nt}}=await Y.auth.getSession(),fr=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({...na,brokerage_id:zs.id,role:"user"})}),Lr=await fr.json();if(!fr.ok)throw new Error(Lr.error||"Failed to create agent");o({title:"Success",description:`Agent ${na.email} created successfully`}),pn({email:"",name:"",password:"",phone:""}),mn(!1),ja()}catch(Nt){console.error("Error creating agent:",Nt),o({title:"Error",description:Nt.message||"Failed to create agent",variant:"destructive"})}finally{$n(!1)}},Vh=Nt=>l.filter(fr=>fr.brokerage_id===Nt),Iu=Nt=>{const fr=Vh(Nt);if(!gi)return fr;const Lr=gi.toLowerCase();return fr.filter(on=>on.name.toLowerCase().includes(Lr)||on.email.toLowerCase().includes(Lr))},Qc=Nt=>l.filter(fr=>fr.brokerage_id!==Nt),lu=l.filter(Nt=>{var fr;if(H){const Lr=H.toLowerCase();if(!(Nt.name.toLowerCase().includes(Lr)||Nt.email.toLowerCase().includes(Lr)||((fr=Nt.brokerage_name)==null?void 0:fr.toLowerCase().includes(Lr))))return!1}return!(se==="claimed"&&!Nt.claimed||se==="unclaimed"&&Nt.claimed||oe!=="all"&&!Nt.roles.includes(oe)||de==="trial"&&!Nt.is_trial||de==="non-trial"&&Nt.is_trial||Me==="none"&&Nt.brokerage_id||Me!=="all"&&Me!=="none"&&Nt.brokerage_id!==Me)}),gc=lu.length,Jc=ie===0,Wo=Jc?1:Math.ceil(gc/ie),Pu=Jc?0:(Q-1)*ie,Hh=Jc?gc:Pu+ie,Wd=lu.slice(Pu,Hh),Tp=Nt=>{G(Nt),ne(1)},Jy=Nt=>{he(Nt),ne(1)},hx=(Nt,fr)=>{Nt(fr),ne(1)},Ap=async(Nt,fr)=>{we(!0);try{const Lr=l.find(Rn=>Rn.id===Nt);if(!Lr)return;const on=Lr.trial_expires_at?new Date(Lr.trial_expires_at):new Date,ln=new Date(on.getTime()+fr*24*60*60*1e3),{error:ia}=await Y.from("profiles").update({trial_expires_at:ln.toISOString()}).eq("id",Nt);if(ia)throw ia;o({title:"Trial Extended",description:`Trial extended by ${fr} days`}),ja()}catch(Lr){console.error("Error extending trial:",Lr),o({title:"Error",description:Lr.message||"Failed to extend trial",variant:"destructive"})}finally{we(!1)}},bd=async Nt=>{Ae(!0);try{const{error:fr}=await Y.from("profiles").update({is_trial:!1,trial_expires_at:null,trial_started_at:null,trial_claimed_at:null}).eq("id",Nt);if(fr)throw fr;o({title:"Account Converted",description:"User has been converted to a full account"}),ja(),Lu()}catch(fr){console.error("Error converting trial:",fr),o({title:"Error",description:fr.message||"Failed to convert account",variant:"destructive"})}finally{Ae(!1)}},e0=async Nt=>{nn(!0);try{const{data:fr}=await Y.from("agent_assistant_assignments").select("id, assistant_id, permissions").eq("agent_id",Nt);if(fr&&fr.length>0){const on=fr.map(ia=>ia.assistant_id),{data:ln}=await Y.from("profiles").select("id, name, email").in("id",on);Ms(fr.map(ia=>{const Rn=ln==null?void 0:ln.find(ka=>ka.id===ia.assistant_id);return{id:ia.id,assistant_id:ia.assistant_id,assistant_name:(Rn==null?void 0:Rn.name)||"Unknown",assistant_email:(Rn==null?void 0:Rn.email)||"",permissions:ia.permissions||{}}}))}else Ms([]);const{data:Lr}=await Y.from("agent_assistant_assignments").select("id, agent_id, permissions").eq("assistant_id",Nt);if(Lr&&Lr.length>0){const on=Lr.map(ia=>ia.agent_id),{data:ln}=await Y.from("profiles").select("id, name, email").in("id",on);dn(Lr.map(ia=>{const Rn=ln==null?void 0:ln.find(ka=>ka.id===ia.agent_id);return{id:ia.id,agent_id:ia.agent_id,agent_name:(Rn==null?void 0:Rn.name)||"Unknown",agent_email:(Rn==null?void 0:Rn.email)||"",permissions:ia.permissions||{}}}))}else dn([])}catch(fr){console.error("Error loading assistant data:",fr)}finally{nn(!1)}},Pm=Nt=>{$e(Nt),et({name:Nt.name,email:Nt.email,brokerage_id:Nt.brokerage_id||"",phone:Nt.phone||""}),xt(!0),e0(Nt.id)},Lu=()=>{$e(null),xt(!1),et({name:"",email:"",brokerage_id:"",phone:""})},a5=async()=>{Pe&&(await Li(Pe.id),Lu())},$k=Nt=>{ye(fr=>{const Lr=new Set(fr);return Lr.has(Nt)?Lr.delete(Nt):Lr.add(Nt),Lr})},mx=()=>{if(nt.size===Wd.length&&Wd.every(Nt=>nt.has(Nt.id))){const Nt=new Set(nt);Wd.forEach(fr=>Nt.delete(fr.id)),ye(Nt)}else{const Nt=new Set(nt);Wd.forEach(fr=>Nt.add(fr.id)),ye(Nt)}},ea=()=>{ye(new Set)},t0=async()=>{if(nt.size===0)return;Ye(!0);let Nt=0,fr=0;try{const{data:{session:Lr}}=await Y.auth.getSession();for(const on of nt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Lr==null?void 0:Lr.access_token}`},body:JSON.stringify({userId:on})})).ok?Nt++:fr++}catch{fr++}o({title:"Bulk Email Complete",description:`Sent ${Nt} emails${fr>0?`, ${fr} failed`:""}`}),ea()}catch(Lr){o({title:"Error",description:Lr.message||"Failed to send emails",variant:"destructive"})}finally{Ye(!1)}},Bv=async()=>{if(nt.size===0)return;Ye(!0);let Nt=0,fr=0;try{const{data:{session:Lr}}=await Y.auth.getSession();for(const on of nt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/send-password-reset",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Lr==null?void 0:Lr.access_token}`},body:JSON.stringify({userId:on})})).ok?Nt++:fr++}catch{fr++}o({title:"Bulk Password Reset Complete",description:`Sent ${Nt} reset emails${fr>0?`, ${fr} failed`:""}`}),ea()}catch(Lr){o({title:"Error",description:Lr.message||"Failed to send password reset emails",variant:"destructive"})}finally{Ye(!1)}},Uk=async()=>{if(nt.size===0)return;const Nt=l.filter(ln=>nt.has(ln.id)).map(ln=>ln.name).slice(0,5).join(", "),fr=nt.size>5?` and ${nt.size-5} more`:"";if(!confirm(`Are you sure you want to delete ${nt.size} users (${Nt}${fr})? This action cannot be undone.`))return;Ye(!0);let Lr=0,on=0;try{const{data:{session:ln}}=await Y.auth.getSession();for(const ia of nt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ln==null?void 0:ln.access_token}`},body:JSON.stringify({userId:ia})})).ok?Lr++:on++}catch{on++}o({title:"Bulk Delete Complete",description:`Deleted ${Lr} users${on>0?`, ${on} failed`:""}`}),ea(),ja()}catch(ln){o({title:"Error",description:ln.message||"Failed to delete users",variant:"destructive"})}finally{Ye(!1)}},qk=async()=>{wt(!0);try{const{data:{session:Nt}}=await Y.auth.getSession(),fr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/ghl-phone-sync",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Nt==null?void 0:Nt.access_token}`}});if(!fr.ok){const on=await fr.json();throw new Error(on.error||"Failed to sync phones")}const Lr=await fr.json();o({title:"Phone Sync Complete",description:`Pulled ${Lr.summary.pulledFromGHL} from GHL, pushed ${Lr.summary.pushedToGHL} to GHL, ${Lr.summary.alreadySynced} already synced`}),ja()}catch(Nt){o({title:"Error",description:Nt.message||"Failed to sync phones with GHL",variant:"destructive"})}finally{wt(!1)}},Lm=async(Nt,fr)=>{qt(Nt);try{const{data:{session:Lr}}=await Y.auth.getSession(),{data:on}=await Y.from("profiles").select("phone").eq("id",Nt).single(),ln=(on==null?void 0:on.phone)||"",ia=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/ghl-tag-sync",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Lr==null?void 0:Lr.access_token}`},body:JSON.stringify({email:fr,action:"update",phone:ln||void 0})});if(!ia.ok){const ka=await ia.json();throw new Error(ka.error||"Failed to sync with GHL")}const Rn=await fetch(`https://services.leadconnectorhq.com/contacts/lookup?locationId=&email=${encodeURIComponent(fr)}`,{method:"GET",headers:{"Content-Type":"application/json"}});o({title:"Phone Synced",description:ln?`Phone ${ln} synced to GHL`:"Sync attempted - run bulk sync to pull phone from GHL"}),ja()}catch(Lr){o({title:"Error",description:Lr.message||"Failed to sync phone",variant:"destructive"})}finally{qt(null)}},Zf=async Nt=>{await n(Nt)},px=()=>{if(nt.size===0){o({title:"No members selected",description:"Please select members to export",variant:"destructive"});return}const Nt=l.filter(ka=>nt.has(ka.id)),fr=["Name","Email","Phone","Brokerage","Roles","Status","Created At"],Lr=Nt.map(ka=>[ka.name,ka.email,ka.phone||"",ka.brokerage_name||"",ka.roles.join("; "),ka.claimed?"Claimed":"Unclaimed",new Date(ka.created_at).toLocaleDateString()]),on=[fr.join(","),...Lr.map(ka=>ka.map(Wh=>`"${(Wh||"").replace(/"/g,'""')}"`).join(","))].join(` `),ln=new Blob([on],{type:"text/csv"}),ia=URL.createObjectURL(ln),Rn=document.createElement("a");Rn.href=ia,Rn.download=`members-export-${new Date().toISOString().split("T")[0]}.csv`,Rn.click(),URL.revokeObjectURL(ia),o({title:"Export complete",description:`Exported ${Nt.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(Eu,{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:qk,disabled:St,children:[St?r.jsx(Vr,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(Pi,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:St?"Syncing...":"Sync Phones with GHL"}),r.jsx("span",{className:"sm:hidden",children:St?"Syncing...":"Sync GHL"})]}),r.jsxs(X,{size:"sm",variant:"outline",onClick:()=>or(!0),children:[r.jsx(W1,{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:q,children:[r.jsx(vo,{asChild:!0,children:r.jsxs(X,{size:"sm",children:[r.jsx(wu,{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(Pr,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Create New User"}),r.jsx(Zs,{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(ot,{id:"name",placeholder:"John Doe",value:R.name,onChange:Nt=>D({...R,name:Nt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"email",children:"Email"}),r.jsx(ot,{id:"email",type:"email",placeholder:"john@example.com",value:R.email,onChange:Nt=>D({...R,email:Nt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"password",children:"Password"}),r.jsx(ot,{id:"password",type:"password",placeholder:"Min 6 characters",value:R.password,onChange:Nt=>D({...R,password:Nt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"phone",children:"Phone (optional)"}),r.jsx(ot,{id:"phone",type:"tel",placeholder:"555-123-4567",value:R.phone,onChange:Nt=>D({...R,phone:Nt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ze,{htmlFor:"brokerage",children:["Brokerage",R.role==="brokerage_manager"?" (required)":""]}),r.jsxs(us,{value:R.brokerage_id||"none",onValueChange:Nt=>D({...R,brokerage_id:Nt==="none"?"":Nt}),children:[r.jsx(cs,{id:"brokerage",children:r.jsx(ms,{placeholder:R.role==="brokerage_manager"?"Select brokerage":"Select brokerage (optional)"})}),r.jsxs(ds,{children:[r.jsx($t,{value:"none",children:"None"}),x.map(Nt=>r.jsx($t,{value:Nt.id,children:Nt.name},Nt.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"role",children:"Role"}),r.jsxs(us,{value:R.role,onValueChange:Nt=>D({...R,role:Nt}),children:[r.jsx(cs,{id:"role",children:r.jsx(ms,{placeholder:"Select role"})}),r.jsxs(ds,{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(us,{value:R.trial_days||"none",onValueChange:Nt=>D({...R,trial_days:Nt==="none"?"":Nt}),children:[r.jsx(cs,{id:"trial_days",children:r.jsx(ms,{placeholder:"No trial (full access)"})}),r.jsxs(ds,{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(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>q(!1),children:"Cancel"}),r.jsx(X,{onClick:Dn,disabled:T,children:T?"Creating...":"Create User"})]})]})]})]})]}),r.jsxs(Si,{defaultValue:"members",className:"space-y-6",children:[r.jsxs(ki,{children:[r.jsx(is,{value:"members",children:"Members"}),r.jsx(is,{value:"brokerages",children:"Brokerages"}),r.jsx(is,{value:"trials",children:"Trial Users"}),r.jsx(is,{value:"access",children:"Access Matrix"}),r.jsx(is,{value:"celebrations",children:"Celebrations"}),r.jsx(is,{value:"deletions",children:"Deletion Log"})]}),r.jsxs(Ss,{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(ua,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search members...",value:H,onChange:Nt=>Tp(Nt.target.value),className:"pl-10 h-9"})]}),r.jsxs(us,{value:se,onValueChange:Nt=>hx(fe,Nt),children:[r.jsx(cs,{className:"w-[130px] h-9",children:r.jsx(ms,{})}),r.jsxs(ds,{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(us,{value:oe,onValueChange:Nt=>hx(ce,Nt),children:[r.jsx(cs,{className:"w-[130px] h-9",children:r.jsx(ms,{})}),r.jsxs(ds,{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(us,{value:de,onValueChange:Nt=>hx(xe,Nt),children:[r.jsx(cs,{className:"w-[130px] h-9",children:r.jsx(ms,{})}),r.jsxs(ds,{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(us,{value:Me,onValueChange:Nt=>hx(ve,Nt),children:[r.jsx(cs,{className:"w-[150px] h-9",children:r.jsx(ms,{})}),r.jsxs(ds,{children:[r.jsx($t,{value:"all",children:"All Brokerages"}),r.jsx($t,{value:"none",children:"No Brokerage"}),x.map(Nt=>r.jsx($t,{value:Nt.id,children:Nt.name},Nt.id))]})]}),(H||se!=="all"||oe!=="all"||de!=="all"||Me!=="all")&&r.jsxs(X,{variant:"ghost",size:"sm",className:"h-9",onClick:()=>{G(""),fe("all"),ce("all"),xe("all"),ve("all"),ne(1)},children:[r.jsx(en,{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 ${gc} members`:`Showing ${Pu+1}-${Math.min(Hh,gc)} of ${gc} members`}),r.jsxs(us,{value:ie.toString(),onValueChange:Nt=>Jy(Number(Nt)),children:[r.jsx(cs,{className:"h-9 w-[110px]",children:r.jsx(ms,{})}),r.jsxs(ds,{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:Oe,children:[Oe?r.jsx(Vr,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(Nn,{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:Bv,disabled:Oe,children:[Oe?r.jsx(Vr,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(xm,{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:px,children:[r.jsx($i,{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:Uk,disabled:Oe,children:[Oe?r.jsx(Vr,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(Bs,{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:ea,disabled:Oe,children:r.jsx(en,{className:"h-4 w-4"})})]})]}),r.jsx("div",{className:"border rounded-lg bg-card overflow-hidden",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(Mt,{className:"w-[50px]",children:r.jsx(bl,{checked:Wd.length>0&&Wd.every(Nt=>nt.has(Nt.id)),onCheckedChange:mx,"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(On,{children:Wd.length===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:7,className:"text-center py-12 text-muted-foreground",children:"No members found"})}):Wd.map(Nt=>r.jsxs(kr,{className:`hover:bg-muted/30 ${nt.has(Nt.id)?"bg-primary/5":""}`,children:[r.jsx(gt,{children:r.jsx(bl,{checked:nt.has(Nt.id),onCheckedChange:()=>$k(Nt.id),"aria-label":`Select ${Nt.name}`})}),r.jsx(gt,{children:r.jsxs("div",{children:[r.jsx("button",{onClick:()=>Pm(Nt),className:"text-primary hover:underline font-medium text-left",children:Nt.name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:Nt.email})]})}),r.jsx(gt,{className:"text-muted-foreground",children:Nt.brokerage_name||"—"}),r.jsx(gt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(Tt,{variant:Nt.claimed?"default":"secondary",className:Nt.claimed?"bg-primary text-primary-foreground w-fit":"w-fit",children:Nt.claimed?"Active":"Pending"}),Nt.is_trial&&Nt.trial_expires_at&&r.jsx(HSe,{expiresAt:Nt.trial_expires_at,className:"w-fit"})]})}),r.jsx(gt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[Nt.roles.length>0?r.jsx("span",{className:"text-sm capitalize",children:Nt.roles[0]}):r.jsx("span",{className:"text-muted-foreground",children:"—"}),Nt.roles.includes("assistant")&&r.jsxs(Tt,{variant:"outline",className:"text-[10px] ml-1",children:["Asst",Gn[Nt.id]?` → ${Gn[Nt.id].agent_name||Gn[Nt.id].agent_email}`:""]})]})}),r.jsx(gt,{className:"text-muted-foreground",children:Nt.last_sign_in_at?new Date(Nt.last_sign_in_at).toLocaleDateString():"—"}),r.jsx(gt,{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(Nt),Wt(!0)},title:"Send celebration",children:r.jsx(Gc,{className:"h-4 w-4"})}),r.jsx(X,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Pm(Nt),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:()=>Lm(Nt.id,Nt.email),disabled:It===Nt.id,title:"Sync phone with GHL",children:It===Nt.id?r.jsx(Vr,{className:"h-4 w-4 animate-spin"}):r.jsx(Pi,{className:"h-4 w-4"})}),r.jsx(X,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>aa(Nt.id),title:"Resend welcome email",children:r.jsx(Nn,{className:"h-4 w-4"})}),r.jsx(X,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Oi(Nt.email,Nt.name),title:"Send password reset",children:r.jsx(zj,{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:()=>Zf(Nt.id),disabled:a||Nt.id===(t==null?void 0:t.id),title:Nt.id===(t==null?void 0:t.id)?"Cannot impersonate yourself":`Login as ${Nt.name}`,children:a?r.jsx(Vr,{className:"h-4 w-4 animate-spin"}):r.jsx(OS,{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:()=>Ka(Nt.id,Nt.name),title:"Delete user",children:r.jsx(Bs,{className:"h-4 w-4"})})]})})]},Nt.id))})]})}),Wo>1&&r.jsxs("div",{className:"flex items-center justify-between px-2 py-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Page ",Q," of ",Wo]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(X,{variant:"outline",size:"sm",onClick:()=>ne(1),disabled:Q===1,children:"First"}),r.jsx(X,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ne(Nt=>Math.max(1,Nt-1)),disabled:Q===1,children:r.jsx(Sc,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,Wo)},(Nt,fr)=>{let Lr;return Wo<=5||Q<=3?Lr=fr+1:Q>=Wo-2?Lr=Wo-4+fr:Lr=Q-2+fr,r.jsx(X,{variant:Q===Lr?"default":"outline",size:"sm",className:"h-8 w-8 p-0",onClick:()=>ne(Lr),children:Lr},Lr)})}),r.jsx(X,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ne(Nt=>Math.min(Wo,Nt+1)),disabled:Q===Wo,children:r.jsx(Zi,{className:"h-4 w-4"})}),r.jsx(X,{variant:"outline",size:"sm",onClick:()=>ne(Wo),disabled:Q===Wo,children:"Last"})]})]})]}),r.jsx(Or,{open:it,onOpenChange:xt,children:r.jsxs(Pr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Edit Member"}),r.jsx(Zs,{children:"Update member details, roles, and app access"})]}),Pe&&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(ot,{id:"edit-name",value:Ee.name,onChange:Nt=>et({...Ee,name:Nt.target.value}),maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"edit-email",children:"Email"}),r.jsx(ot,{id:"edit-email",type:"email",value:Ee.email,onChange:Nt=>et({...Ee,email:Nt.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(ot,{id:"edit-phone",type:"tel",value:Ee.phone,onChange:Nt=>et({...Ee,phone:Nt.target.value}),placeholder:"555-123-4567"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"edit-brokerage",children:"Brokerage"}),r.jsxs(us,{value:Ee.brokerage_id||"none",onValueChange:Nt=>et({...Ee,brokerage_id:Nt==="none"?"":Nt}),children:[r.jsx(cs,{id:"edit-brokerage",children:r.jsx(ms,{placeholder:"Select brokerage"})}),r.jsxs(ds,{children:[r.jsx($t,{value:"none",children:"None"}),x.map(Nt=>r.jsx($t,{value:Nt.id,children:Nt.name},Nt.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:[Pe.roles.map(Nt=>r.jsxs(Tt,{variant:"default",className:"gap-1",children:[r.jsx(bm,{className:"h-3 w-3"}),Nt,Nt==="brokerage_manager"?r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(manage in Brokerages tab)"}):r.jsx("button",{onClick:()=>Di(Pe.id,Nt,"remove"),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove role",children:r.jsx(en,{className:"h-3 w-3"})})]},Nt)),Pe.roles.length===0&&r.jsx("span",{className:"text-sm text-muted-foreground",children:"No roles assigned"})]}),r.jsxs(us,{onValueChange:Nt=>Di(Pe.id,Nt,"add"),children:[r.jsx(cs,{className:"w-[200px]",children:r.jsx(ms,{placeholder:"Add role..."})}),r.jsxs(ds,{children:[!Pe.roles.includes("admin")&&r.jsx($t,{value:"admin",children:"Admin"}),!Pe.roles.includes("user")&&r.jsx($t,{value:"user",children:"User"})]})]}),!Pe.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"})]}),(Qr.length>0||Kr.length>0||Pe.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(qs,{className:"h-4 w-4"}),"Assistant Relationships"]}),un?r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Vr,{className:"h-4 w-4 animate-spin"}),"Loading..."]}):r.jsxs("div",{className:"space-y-3",children:[Qr.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:"}),Qr.map(Nt=>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:Nt.assistant_name}),r.jsx(Tt,{variant:"outline",className:"text-xs",children:"Assistant"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:Nt.assistant_email}),r.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:Object.entries(Nt.permissions).filter(([,fr])=>fr).map(([fr])=>r.jsx(Tt,{variant:"secondary",className:"text-[10px] capitalize",children:fr},fr))})]},Nt.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(Nt=>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:Nt.agent_name}),r.jsx(Tt,{variant:"outline",className:"text-xs",children:"Agent"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:Nt.agent_email}),r.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:Object.entries(Nt.permissions).filter(([,fr])=>fr).map(([fr])=>r.jsx(Tt,{variant:"secondary",className:"text-[10px] capitalize",children:fr},fr))})]},Nt.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(Nt=>{const fr=wl(Pe.tags,Nt.required_tags),Lr=`${Pe.id}-${Nt.id}`,on=le===Lr,ln=Nt.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:Nt.icon}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:Nt.name}),ln&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Available to all members"})]})]}),r.jsx("div",{className:"flex items-center gap-2",children:on?r.jsx(Vr,{className:"h-4 w-4 animate-spin text-muted-foreground"}):ln?r.jsx(Tt,{variant:"secondary",className:"text-xs",children:"Always On"}):r.jsx(In,{checked:fr,onCheckedChange:()=>Pl(Pe.id,Nt,fr)})})]},Nt.id)})})]}),Pe.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(Ra,{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:Pe.trial_expires_at&&r.jsx(HSe,{expiresAt:Pe.trial_expires_at})}),Pe.trial_expires_at&&r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Expires: ",new Date(Pe.trial_expires_at).toLocaleDateString()]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(X,{size:"sm",variant:"outline",onClick:()=>Ap(Pe.id,7),disabled:be,children:[r.jsx(Pj,{className:"h-4 w-4 mr-1"}),"+7 Days"]}),r.jsxs(X,{size:"sm",variant:"outline",onClick:()=>Ap(Pe.id,14),disabled:be,children:[r.jsx(Pj,{className:"h-4 w-4 mr-1"}),"+14 Days"]}),r.jsxs(X,{size:"sm",variant:"outline",onClick:()=>Ap(Pe.id,30),disabled:be,children:[r.jsx(Pj,{className:"h-4 w-4 mr-1"}),"+30 Days"]}),r.jsxs(X,{size:"sm",variant:"default",onClick:()=>bd(Pe.id),disabled:tt,className:"bg-green-600 hover:bg-green-700",children:[r.jsx(Kj,{className:"h-4 w-4 mr-1"}),"Convert to Full Account"]})]}),Pe.trial_started_at&&r.jsxs("div",{className:"mt-3 text-xs text-muted-foreground",children:["Trial started: ",new Date(Pe.trial_started_at).toLocaleDateString(),Pe.trial_claimed_at&&r.jsxs("span",{children:[" • Claimed: ",new Date(Pe.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:[Pe.email_confirmed_at&&r.jsxs("div",{children:["Claimed: ",new Date(Pe.email_confirmed_at).toLocaleString()]}),Pe.last_sign_in_at&&r.jsxs("div",{children:["Last login: ",new Date(Pe.last_sign_in_at).toLocaleString()]}),r.jsxs("div",{children:["Created: ",new Date(Pe.created_at).toLocaleString()]})]})]})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:Lu,children:"Cancel"}),r.jsx(X,{onClick:a5,children:"Save Changes"})]})]})}),r.jsxs(Ss,{value:"access",children:[u.length===0?r.jsx(He,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"No apps configured yet"}),r.jsx(X,{onClick:()=>e("/admin/apps"),children:"Configure Apps"})]})}):r.jsxs(He,{children:[r.jsxs(Vt,{children:[r.jsx(Gt,{children:"Member Access Matrix"}),r.jsx(Ns,{children:"Toggle switches to grant or revoke app access for each member"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b",children:[r.jsx("th",{className:"text-left p-4 font-semibold sticky left-0 bg-card z-10",children:"Member"}),u.map(Nt=>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:Nt.icon}),r.jsx("span",{className:"text-sm",children:Nt.name})]})},Nt.id))]})}),r.jsxs("tbody",{children:[Wd.map(Nt=>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:Nt.name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:Nt.email})]})}),u.map(fr=>{const Lr=wl(Nt.tags,fr.required_tags),on=`${Nt.id}-${fr.id}`,ln=le===on;return r.jsx("td",{className:"p-4 text-center",children:r.jsx("div",{className:"flex items-center justify-center",children:ln?r.jsx(Vr,{className:"h-5 w-5 animate-spin text-muted-foreground"}):r.jsx(In,{checked:Lr,onCheckedChange:()=>Pl(Nt.id,fr,Lr),disabled:fr.required_tags.length===0})})},fr.id)})]},Nt.id)),Wd.length===0&&r.jsx("tr",{children:r.jsx("td",{colSpan:u.length+1,className:"p-8 text-center text-muted-foreground",children:"No members found"})})]})]})}),Wo>1&&r.jsxs("div",{className:"flex items-center justify-between px-2 py-4 border-t",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Showing ",Pu+1,"-",Math.min(Hh,gc)," of ",gc," • Page ",Q," of ",Wo]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(X,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ne(Nt=>Math.max(1,Nt-1)),disabled:Q===1,children:r.jsx(Sc,{className:"h-4 w-4"})}),r.jsx(X,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ne(Nt=>Math.min(Wo,Nt+1)),disabled:Q===Wo,children:r.jsx(Zi,{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(Ss,{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(ua,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search brokerages...",value:La,onChange:Nt=>co(Nt.target.value),className:"pl-10"})]}),r.jsxs("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:[x.filter(Nt=>Nt.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 Nt=[];for(const Rn of x){const ka=v[Rn.id]??[];for(const Wh of ka){const cu=l.find(Ll=>Ll.id===Wh);if(cu){const Ll=(cu.name||"").trim().split(/\s+/),Na=Ll[0]||"",Vk=Ll.slice(1).join(" ")||"";Nt.push({firstName:Na,lastName:Vk,email:cu.email,brokerageName:Rn.name})}}}if(Nt.length===0){o({title:"No managers found to export"});return}const Lr=[["First Name","Last Name","Email","Brokerage Name"].join(","),...Nt.map(Rn=>[Rn.firstName,Rn.lastName,Rn.email,Rn.brokerageName].map(ka=>`"${(ka||"").replace(/"/g,'""')}"`).join(","))].join(` `),on=new Blob([Lr],{type:"text/csv"}),ln=URL.createObjectURL(on),ia=document.createElement("a");ia.href=ln,ia.download=`brokerage-managers-${new Date().toISOString().slice(0,10)}.csv`,ia.click(),URL.revokeObjectURL(ln),o({title:`Exported ${Nt.length} managers`})},children:[r.jsx($i,{className:"mr-2 h-4 w-4"}),"Export Managers"]}),r.jsxs(Or,{open:Je,onOpenChange:rt,children:[r.jsx(vo,{asChild:!0,children:r.jsxs(X,{size:"sm",children:[r.jsx(pi,{className:"mr-2 h-4 w-4"}),"Add Brokerage"]})}),r.jsxs(Pr,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Create New Brokerage"}),r.jsx(Zs,{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(ot,{id:"brokerage-name",placeholder:"Enter brokerage name",value:je,onChange:Nt=>lt(Nt.target.value),maxLength:100})]})}),r.jsxs(zn,{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(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:(()=>{const Nt=x.filter(fr=>fr.name.toLowerCase().includes(La.toLowerCase()));return Nt.length===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:4,className:"text-center py-12 text-muted-foreground",children:La?"No brokerages match your search":"No brokerages found"})}):Nt.map(fr=>{const Lr=l.filter(Rn=>Rn.brokerage_id===fr.id),ln=(v[fr.id]??[]).map(Rn=>l.find(ka=>ka.id===Rn)).filter(Boolean),ia=Lr.length;return r.jsxs(kr,{className:"hover:bg-muted/30",children:[r.jsx(gt,{children:r.jsx("button",{onClick:()=>Im(fr),className:"text-primary hover:underline font-medium",children:fr.name})}),r.jsx(gt,{children:ln.length>0?r.jsx("div",{className:"flex flex-wrap gap-1",children:ln.map(Rn=>r.jsx(Tt,{variant:"secondary",className:"text-xs",children:Rn.name},Rn.id))}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"No manager"})}),r.jsxs(gt,{children:[ia," member",ia!==1?"s":""]}),r.jsx(gt,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[r.jsxs(X,{size:"sm",variant:"outline",className:"h-8",onClick:()=>Mp(fr),children:[r.jsx(qs,{className:"h-4 w-4 mr-1"}),"Manage"]}),r.jsx(X,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Im(fr),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:()=>mh(fr),title:"Delete brokerage",children:r.jsx(Bs,{className:"h-4 w-4"})})]})})]},fr.id)})})()})]})}),r.jsx(Or,{open:Ze,onOpenChange:De,children:r.jsxs(Pr,{className:"max-w-lg",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Edit Brokerage"}),r.jsx(Zs,{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(ot,{id:"edit-brokerage-name",value:dt,onChange:Nt=>ct(Nt.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 fr=(v[Ke.id]??[]).map(Lr=>l.find(on=>on.id===Lr)).filter(Boolean);return fr.length===0?r.jsx("span",{className:"text-sm text-muted-foreground",children:"No managers assigned"}):fr.map(Lr=>r.jsxs(Tt,{variant:"default",className:"gap-1",children:[r.jsx(bm,{className:"h-3 w-3"}),Lr.name,r.jsx("button",{onClick:()=>Di(Lr.id,"brokerage_manager","remove",Ke.id),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove manager from this brokerage",children:r.jsx(en,{className:"h-3 w-3"})})]},Lr.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(Kc,{open:Ni,onOpenChange:Ws,children:[r.jsx(Zc,{asChild:!0,children:r.jsxs(X,{variant:"outline",role:"combobox","aria-expanded":Ni,className:"w-full justify-between",children:["Search for a member...",r.jsx(ua,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Ac,{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 Nt=new Set(v[Ke.id]??[]);return l.filter(fr=>!Nt.has(fr.id)&&(s||fr.brokerage_id===Ke.id)).map(fr=>r.jsxs(zy,{value:`${fr.name} ${fr.email}`,onSelect:()=>{fc(fr.id,Ke.id),Ws(!1)},children:[fr.name," (",fr.email,")"]},fr.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(Nt=>Nt.brokerage_id===Ke.id).length===0?r.jsx("span",{className:"text-sm text-muted-foreground",children:"No members"}):l.filter(Nt=>Nt.brokerage_id===Ke.id).map(Nt=>r.jsxs("div",{className:"text-sm py-1 flex items-center justify-between",children:[r.jsx("span",{children:Nt.name}),Nt.roles.includes("brokerage_manager")&&r.jsx(Tt,{variant:"outline",className:"text-xs",children:"Manager"})]},Nt.id))})]})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:Xo,children:"Cancel"}),r.jsx(X,{onClick:Hd,disabled:zt,children:zt?"Saving...":"Save Changes"})]})]})}),r.jsx(Or,{open:Tr,onOpenChange:Zr,children:r.jsxs(Pr,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{className:"text-destructive",children:"Delete Brokerage"}),r.jsxs(Zs,{children:['Are you sure you want to delete "',$r==null?void 0:$r.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 "',$r==null?void 0:$r.name,'"']}),r.jsxs("li",{children:["All ",l.filter(Nt=>Nt.brokerage_id===($r==null?void 0:$r.id)).length," member(s) assigned to this brokerage"]}),r.jsx("li",{children:"All their data, roles, and access"})]})]})}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>Zr(!1),children:"Cancel"}),r.jsx(X,{variant:"destructive",onClick:Qo,disabled:Xs,children:Xs?"Deleting...":"Yes, Delete Brokerage"})]})]})}),r.jsx(Or,{open:Hr,onOpenChange:Ts,children:r.jsxs(Pr,{className:"max-w-4xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{className:"flex items-center gap-2",children:[r.jsx(pi,{className:"h-5 w-5"}),"Manage ",zs==null?void 0:zs.name]}),r.jsx(Zs,{children:"Add, remove, or manage users in this brokerage"})]}),zs&&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(ua,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search members...",value:gi,onChange:Nt=>Ao(Nt.target.value),className:"pl-10 h-9"})]}),r.jsxs(Or,{open:Ga,onOpenChange:mn,children:[r.jsx(vo,{asChild:!0,children:r.jsxs(X,{size:"sm",children:[r.jsx(wu,{className:"h-4 w-4 mr-1"}),"Add New Agent"]})}),r.jsxs(Pr,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Add New Agent"}),r.jsxs(Zs,{children:["Create a new agent for ",zs.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(ot,{id:"agent-name",placeholder:"John Doe",value:na.name,onChange:Nt=>pn({...na,name:Nt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"agent-email",children:"Email"}),r.jsx(ot,{id:"agent-email",type:"email",placeholder:"john@example.com",value:na.email,onChange:Nt=>pn({...na,email:Nt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"agent-password",children:"Password"}),r.jsx(ot,{id:"agent-password",type:"password",placeholder:"Min 6 characters",value:na.password,onChange:Nt=>pn({...na,password:Nt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"agent-phone",children:"Phone (optional)"}),r.jsx(ot,{id:"agent-phone",type:"tel",placeholder:"555-123-4567",value:na.phone,onChange:Nt=>pn({...na,phone:Nt.target.value})})]})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>mn(!1),children:"Cancel"}),r.jsx(X,{onClick:Qy,disabled:Jn,children:Jn?"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(Kc,{open:Yi,onOpenChange:mc,children:[r.jsx(Zc,{asChild:!0,children:r.jsxs(X,{variant:"outline",role:"combobox","aria-expanded":Yi,className:"w-[300px] justify-between",children:["Select a user to add...",r.jsx(ua,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Ac,{className:"w-[300px] p-0",align:"start",children:r.jsxs(Ly,{children:[r.jsx(Oy,{placeholder:"Search users...",value:bo,onValueChange:pc}),r.jsxs(Dy,{children:[r.jsx(Ry,{children:"No users found."}),r.jsx(Fy,{children:Qc(zs.id).filter(Nt=>bo===""||Nt.name.toLowerCase().includes(bo.toLowerCase())||Nt.email.toLowerCase().includes(bo.toLowerCase())).map(Nt=>r.jsxs(zy,{value:`${Nt.name} ${Nt.email}`,onSelect:()=>{Xy(Nt.id,zs.id),mc(!1),pc("")},children:[Nt.name," (",Nt.email,")"]},Nt.id))})]})]})})]})]}),r.jsx("div",{className:"flex-1 overflow-auto border rounded-lg",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:Iu(zs.id).length===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:gi?"No matching members found":"No members in this brokerage"})}):Iu(zs.id).map(Nt=>r.jsxs(kr,{className:"hover:bg-muted/30",children:[r.jsx(gt,{className:"font-medium",children:Nt.name}),r.jsx(gt,{className:"text-muted-foreground",children:Nt.email}),r.jsx(gt,{children:Nt.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(gt,{children:Nt.roles.includes("brokerage_manager")?r.jsxs(Tt,{variant:"outline",className:"gap-1",children:[r.jsx(bm,{className:"h-3 w-3"}),"Manager"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"Agent"})}),r.jsx(gt,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[!Nt.claimed&&r.jsx(X,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>aa(Nt.id),title:"Resend welcome email",children:r.jsx(Nn,{className:"h-4 w-4"})}),r.jsx(X,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Yy(Nt.id),title:"Remove from brokerage",children:r.jsx(en,{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:()=>Zf(Nt.id),disabled:a||Nt.id===(t==null?void 0:t.id),title:Nt.id===(t==null?void 0:t.id)?"Cannot impersonate yourself":`Login as ${Nt.name}`,children:a?r.jsx(Vr,{className:"h-4 w-4 animate-spin"}):r.jsx(OS,{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:()=>Ka(Nt.id,Nt.name),title:"Delete user",children:r.jsx(Bs,{className:"h-4 w-4"})})]})})]},Nt.id))})]})}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Vh(zs.id).length," total member",Vh(zs.id).length!==1?"s":""," •",Vh(zs.id).filter(Nt=>Nt.roles.includes("brokerage_manager")).length," manager",Vh(zs.id).filter(Nt=>Nt.roles.includes("brokerage_manager")).length!==1?"s":""]})]}),r.jsx(zn,{children:r.jsx(X,{variant:"outline",onClick:Kf,children:"Close"})})]})})]}),r.jsx(Ss,{value:"trials",children:r.jsx(k4t,{})}),r.jsx(Ss,{value:"celebrations",children:r.jsx(j4t,{})}),r.jsx(Ss,{value:"deletions",children:r.jsx(N4t,{})})]})]}),r.jsx(G9e,{open:Ci,onOpenChange:or,brokerages:x,onSuccess:ja}),pr&&r.jsx(K9e,{open:Lt,onOpenChange:Nt=>{Wt(Nt),Nt||cr(null)},userId:pr.id,userName:pr.name})]})},C4t=()=>{const[e,t]=A.useState([]),[s,n]=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?(Te.error("Failed to load invite codes"),console.error(U)):t(D||[]),n(!1)},k=async D=>{if(D.preventDefault(),!l.trim()){Te.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"?Te.error("This code already exists"):(Te.error("Failed to create invite code"),console.error(U)):(Te.success("Invite code created"),i(""),m(""),y(""),b(""),N()),o(!1)},M=async(D,U)=>{const{error:q}=await Y.from("invite_codes").update({is_active:!U}).eq("id",D);q?Te.error("Failed to update code"):t(e.map(H=>H.id===D?{...H,is_active:!U}:H))},E=async D=>{const{error:U}=await Y.from("invite_codes").delete().eq("id",D);U?Te.error("Failed to delete code"):(Te.success("Code deleted"),t(e.filter(q=>q.id!==D)))},T="https://dashboard.relevelup.com",P=D=>{const U=`${T}/join?code=${D}`;navigator.clipboard.writeText(U),Te.success("Link copied to clipboard")},R=`${T}/join`;return r.jsx(Dr,{title:"Invite Codes",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Eu,{title:"Invite Codes",description:"Manage signup invite codes"}),r.jsxs(He,{children:[r.jsxs(Vt,{children:[r.jsx(Gt,{children:"Create New Code"}),r.jsxs(Ns,{children:["Share link: ",r.jsx("code",{className:"bg-muted px-2 py-1 rounded text-sm",children:R})]})]}),r.jsx(Xe,{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(ot,{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(ot,{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(ot,{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(ot,{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(Vr,{className:"h-4 w-4 animate-spin"}):r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Create"]})]})})]}),r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsx(Gt,{children:"Active Codes"})}),r.jsx(Xe,{children:s?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Vr,{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(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:e.map(D=>r.jsxs(kr,{children:[r.jsx(gt,{className:"font-mono font-medium",children:D.code}),r.jsx(gt,{className:"text-muted-foreground",children:D.description||"—"}),r.jsxs(gt,{children:[D.uses_count,D.max_uses&&` / ${D.max_uses}`]}),r.jsx(gt,{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(gt,{className:"text-muted-foreground",children:rs(new Date(D.created_at),"MMM d, yyyy")}),r.jsx(gt,{children:r.jsx(In,{checked:D.is_active,onCheckedChange:()=>M(D.id,D.is_active)})}),r.jsx(gt,{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(Mo,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>E(D.id),className:"text-destructive hover:text-destructive",title:"Delete code",children:r.jsx(Bs,{className:"h-4 w-4"})})]})})]},D.id))})]})})]})]})})},Rae=async e=>{try{const{data:t,error:s}=await Y.from("push_notification_settings").select("is_enabled").eq("setting_key",e).maybeSingle();return s?(console.error("Error checking notification setting:",s),!0):(t==null?void 0:t.is_enabled)??!0}catch(t){return console.error("Error checking notification setting:",t),!0}},kP=async e=>{try{const{data:t,error:s}=await Y.functions.invoke("send-push-notification",{body:e});return s?(console.error("Error sending notification:",s),{success:!1,error:s}):(console.log("Notification sent:",t),{success:!0,data:t})}catch(t){return console.error("Error sending notification:",t),{success:!1,error:t}}},M4t=async(e,t)=>await Rae("new_templates")?kP({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}),T4t=async(e,t)=>kP({title:"New Academy Video",body:`New video added: ${e}`,url:`/academy/${t}`}),A4t=async(e,t)=>await Rae("new_events")?kP({title:"New Event",body:`New event: ${e}`,url:`/events/${t}`}):(console.log("New event notifications are disabled"),{success:!1,skipped:!0}),E4t=async(e,t)=>await Rae("new_toolbox")?kP({title:"New Resource Kit",body:`New resource kit available: ${e}`,url:`/toolbox/${t}`}):(console.log("New toolbox notifications are disabled"),{success:!1,skipped:!0}),vpe=async(e,t)=>await Rae("new_social_swag")?kP({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}),EO={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 I4t(){const e=Hs(),t=Br(),[s,n]=A.useState(!1),[a,o]=A.useState(null),[l,i]=A.useState(EO),[u,m]=A.useState(null),[x,y]=A.useState(null),[v,b]=A.useState(!1),N=A.useRef(null),[k,M]=A.useState(!1),[E,T]=A.useState(null),[P,R]=A.useState(!1),[D,U]=A.useState(null),[q,H]=A.useState(null),[G,Q]=A.useState(!0),[ne,ie]=A.useState(""),{data:he,isLoading:se}=Kt({queryKey:["admin-events"],queryFn:async()=>{const{data:je,error:lt}=await Y.from("events").select("*").order("event_date",{ascending:!0});if(lt)throw lt;return je}}),{data:fe}=Kt({queryKey:["event-registrations-count"],queryFn:async()=>{const{data:je,error:lt}=await Y.from("event_registrations").select("event_id");if(lt)throw lt;const Ce={};return je.forEach(Ie=>{Ce[Ie.event_id]=(Ce[Ie.event_id]||0)+1}),Ce}}),{data:oe,isLoading:ce}=Kt({queryKey:["event-registrations-details",E==null?void 0:E.id],queryFn:async()=>{if(!E)return[];const{data:je,error:lt}=await Y.from("event_registrations").select("id, user_id, registered_at, zoom_join_url, zoom_name, zoom_email").eq("event_id",E.id).order("registered_at",{ascending:!1});if(lt)throw lt;if(!je||je.length===0)return[];const Ce=je.map(De=>De.user_id).filter(Boolean);let Ie=[];if(Ce.length>0){const{data:De,error:Ke}=await Y.from("profiles").select("id, name, email").in("id",Ce);if(Ke)throw Ke;Ie=De||[]}const Ze=new Map((Ie==null?void 0:Ie.map(De=>[De.id,De]))||[]);return je.map(De=>({...De,profiles:De.user_id&&Ze.get(De.user_id)||null}))},enabled:!!E}),{data:de,isLoading:xe}=Kt({queryKey:["event-attendees-details",E==null?void 0:E.id],queryFn:async()=>{if(!E)return[];const{data:je,error:lt}=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",E.id).order("created_at",{ascending:!1});if(lt)throw lt;if(!je||je.length===0)return[];const Ce=je.map(st=>st.user_id).filter(Boolean);let Ie=[];if(Ce.length>0){const{data:st,error:dt}=await Y.from("profiles").select("id, name, email").in("id",Ce);if(dt)throw dt;Ie=st||[]}const{data:Ze}=await Y.from("agent_points").select("user_id").eq("event_id",E.id),De=new Set((Ze==null?void 0:Ze.map(st=>st.user_id))||[]),Ke=new Map((Ie==null?void 0:Ie.map(st=>[st.id,st]))||[]);return je.map(st=>({...st,profiles:st.user_id&&Ke.get(st.user_id)||null,points_awarded:st.user_id?De.has(st.user_id):!1}))},enabled:!!E}),Me=je=>{T(je),M(!0)},ve=ar({mutationFn:async je=>{const{data:{session:lt}}=await Y.auth.getSession();if(!lt)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 ${lt.access_token}`},body:JSON.stringify({event_id:je})}),Ie=await Ce.json();if(!Ce.ok)throw new Error(Ie.error||"Failed to sync");return Ie},onSuccess:je=>{t.invalidateQueries({queryKey:["event-registrations-details",E==null?void 0:E.id]}),t.invalidateQueries({queryKey:["event-registrations-count"]}),Te.success(je.message)},onError:je=>{Te.error("Failed to sync: "+je.message)}}),be=ar({mutationFn:async je=>{const{data:{session:lt}}=await Y.auth.getSession();if(!lt)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 ${lt.access_token}`},body:JSON.stringify({event_id:je})}),Ie=await Ce.json();if(!Ce.ok)throw new Error(Ie.error||"Failed to sync attendees");return Ie},onSuccess:je=>{t.invalidateQueries({queryKey:["event-attendees-details",E==null?void 0:E.id]}),t.invalidateQueries({queryKey:["event-leaderboard"]}),t.invalidateQueries({queryKey:["admin-agent-points"]}),je!=null&&je.message?Te.success(je.message):Te.success(`Synced ${je.synced||0} attendees. ${je.points_awarded||0} points awarded!`)},onError:je=>{Te.error("Failed to sync attendees: "+je.message)}}),we=ar({mutationFn:async({eventId:je,testMode:lt})=>{const{data:{session:Ce}}=await Y.auth.getSession();if(!Ce)throw new Error("Not authenticated");const Ie=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:lt})}),Ze=await Ie.json();if(!Ie.ok)throw new Error(Ze.error||"Failed to send reminders");return Ze},onSuccess:je=>{je.test?Te.success(je.message||"Test email sent!"):Te.success(je.message||`Reminder emails sent to ${je.sent} registrants!`)},onError:je=>{Te.error("Failed to send reminders: "+je.message)}}),{data:tt}=Kt({queryKey:["all-profiles-for-linking"],queryFn:async()=>{let je=[],lt=0;const Ce=1e3;for(;;){const{data:Ie,error:Ze}=await Y.from("profiles").select("id, name, email").order("name",{ascending:!0}).range(lt,lt+Ce-1);if(Ze)throw Ze;if(!Ie||Ie.length===0||(je=[...je,...Ie],Ie.length{const{error:Ze}=await Y.from("event_attendees").update({user_id:lt}).eq("id",je);if(Ze)throw Ze;if(Ie&&Ce){const{error:Ke}=await Y.from("zoom_email_aliases").upsert({user_id:lt,zoom_email:Ce.toLowerCase()},{onConflict:"zoom_email"});Ke&&console.error("Failed to save alias:",Ke)}const De=E==null?void 0:E.id;if(De){const{data:Ke}=await Y.from("user_roles").select("id").eq("user_id",lt).eq("role","admin").single();if(!Ke){const{data:st}=await Y.from("agent_points").select("id").eq("user_id",lt).eq("event_id",De).single();st||(await Y.rpc("award_attendance_points",{p_user_id:lt,p_event_id:De,p_points:10,p_reason:"Event Attendance (Manual Link)"}),await Y.rpc("check_and_award_badges",{p_user_id:lt}))}}return{userId:lt,zoomEmail:Ce,shouldSaveAlias:Ie}},onSuccess:je=>{t.invalidateQueries({queryKey:["event-attendees-details",E==null?void 0:E.id]}),t.invalidateQueries({queryKey:["event-leaderboard"]}),t.invalidateQueries({queryKey:["admin-agent-points"]});let lt="Attendee linked and points awarded!";je.shouldSaveAlias&&je.zoomEmail&&(lt+=` Email "${je.zoomEmail}" will be auto-matched in the future.`),Te.success(lt),R(!1),U(null),H(null),ie("")},onError:je=>{Te.error("Failed to link attendee: "+je.message)}}),Le=je=>{U(je),H(null),Q(!0),ie(""),R(!0)},Ue=()=>{!D||!q||Ae.mutate({attendeeId:D.id,userId:q,zoomEmail:D.zoom_email,shouldSaveAlias:G})},Pe=(tt==null?void 0:tt.filter(je=>{var Ce,Ie;if(!ne)return!0;const lt=ne.toLowerCase();return((Ce=je.name)==null?void 0:Ce.toLowerCase().includes(lt))||((Ie=je.email)==null?void 0:Ie.toLowerCase().includes(lt))}))||[],$e=async je=>{const lt=je.name.split(".").pop(),Ie=`${`${crypto.randomUUID()}.${lt}`}`,{error:Ze}=await Y.storage.from("event-images").upload(Ie,je);if(Ze)throw Ze;const{data:{publicUrl:De}}=Y.storage.from("event-images").getPublicUrl(Ie);return De},it=je=>{var Ce;const lt=(Ce=je.target.files)==null?void 0:Ce[0];if(lt){if(lt.size>5*1024*1024){Te.error("Image must be less than 5MB");return}m(lt),y(URL.createObjectURL(lt))}},xt=()=>{m(null),y(null),i({...l,image_url:""}),N.current&&(N.current.value="")},Ee=ar({mutationFn:async je=>{b(!0);let lt=je.image_url;u&&(lt=await $e(u)||"");const Ce=new Date(je.event_date),[Ie,Ze]=je.event_time.split(":");Ce.setHours(parseInt(Ie),parseInt(Ze));const De=[new Date(Ce)];if(je.is_recurring&&je.recurrence_end_date){let ct=new Date(Ce);for(;je.recurrence_pattern==="weekly"?ct=cj(ct,1):je.recurrence_pattern==="biweekly"?ct=cj(ct,2):ct=zh(ct,1),!(ct>je.recurrence_end_date);)De.push(new Date(ct))}const Ke=De.map(ct=>({title:je.title,description:je.description||null,image_url:lt||null,video_url:je.video_url||null,event_date:ct.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:st,error:dt}=await Y.from("events").insert(Ke).select();if(dt)throw dt;return st&&st.length>0&&A4t(je.title,st[0].id),De.length},onSuccess:je=>{t.invalidateQueries({queryKey:["admin-events"]}),Te.success(je>1?`${je} recurring events created successfully`:"Event created successfully"),n(!1),i(EO),m(null),y(null),b(!1)},onError:je=>{Te.error("Failed to create event: "+je.message),b(!1)}}),et=ar({mutationFn:async({id:je,data:lt})=>{b(!0);let Ce=lt.image_url;u&&(Ce=await $e(u)||"");const Ie=new Date(lt.event_date),[Ze,De]=lt.event_time.split(":");Ie.setHours(parseInt(Ze),parseInt(De));const{error:Ke}=await Y.from("events").update({title:lt.title,description:lt.description||null,image_url:Ce||null,video_url:lt.video_url||null,event_date:Ie.toISOString(),zoom_link:lt.zoom_link,zoom_meeting_id:lt.zoom_meeting_id||null,capacity:lt.capacity?parseInt(lt.capacity):null,is_published:lt.is_published}).eq("id",je);if(Ke)throw Ke},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-events"]}),Te.success("Event updated successfully"),n(!1),o(null),i(EO),m(null),y(null),b(!1)},onError:je=>{Te.error("Failed to update event: "+je.message),b(!1)}}),le=ar({mutationFn:async je=>{const{error:lt}=await Y.from("events").delete().eq("id",je);if(lt)throw lt},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-events"]}),Te.success("Event deleted successfully")},onError:je=>{Te.error("Failed to delete event: "+je.message)}}),Ve=je=>{var Ce;const lt=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:lt,event_time:rs(lt,"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),n(!0)},Je=je=>{if(je.preventDefault(),!l.event_date){Te.error("Please select a date");return}if(l.is_recurring&&!l.recurrence_end_date){Te.error("Please select an end date for recurring events");return}a?et.mutate({id:a.id,data:l}):Ee.mutate(l)},rt=()=>{n(!1),o(null),i(EO),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(Vt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Gt,{children:"All Events"}),r.jsxs(Or,{open:s,onOpenChange:je=>!je&&rt(),children:[r.jsx(vo,{asChild:!0,children:r.jsxs(X,{onClick:()=>n(!0),children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Add Event"]})}),r.jsxs(Pr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Rr,{children:a?"Edit Event":"Create New Event"})}),r.jsxs("form",{onSubmit:Je,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"title",children:"Title *"}),r.jsx(ot,{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(Wf,{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:it,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:xt,children:r.jsx(en,{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(so,{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(Kc,{children:[r.jsx(Zc,{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(jn,{className:"mr-2 h-4 w-4"}),l.event_date?rs(l.event_date,"PPP"):"Pick a date"]})}),r.jsx(Ac,{className:"w-auto p-0",align:"start",children:r.jsx(Df,{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(ot,{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(ot,{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(ot,{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(ot,{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(ot,{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(NA,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ze,{htmlFor:"is_recurring",children:"Recurring Event"})]}),r.jsx(In,{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(us,{value:l.recurrence_pattern,onValueChange:je=>i({...l,recurrence_pattern:je}),children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsxs(ds,{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(Kc,{children:[r.jsx(Zc,{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(jn,{className:"mr-2 h-4 w-4"}),l.recurrence_end_date?rs(l.recurrence_end_date,"PPP"):"Pick end date"]})}),r.jsx(Ac,{className:"w-auto p-0",align:"start",children:r.jsx(Df,{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,lt=new Date(l.event_date);for(;lt=l.recurrence_pattern==="weekly"?cj(lt,1):l.recurrence_pattern==="biweekly"?cj(lt,2):zh(lt,1),!(lt>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(In,{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:Ee.isPending||et.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(Xe,{children:se?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading events..."}):(he==null?void 0:he.length)===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No events yet. Create your first event!"}):r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:he==null?void 0:he.map(je=>r.jsxs(kr,{children:[r.jsx(gt,{className:"font-medium",children:je.title}),r.jsx(gt,{children:rs(new Date(je.event_date),"PPP p")}),r.jsx(gt,{children:r.jsxs(X,{variant:"ghost",size:"sm",className:"gap-1",onClick:()=>Me(je),children:[r.jsx(qs,{className:"h-4 w-4"}),(fe==null?void 0:fe[je.id])||0,je.capacity&&` / ${je.capacity}`]})}),r.jsx(gt,{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(gt,{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(Sn,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>Ve(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(Bs,{className:"h-4 w-4 text-destructive"})})]})})]},je.id))})]})})]}),r.jsx(Or,{open:k,onOpenChange:M,children:r.jsxs(Pr,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{className:"flex items-center gap-2",children:[r.jsx(qs,{className:"h-5 w-5"}),E==null?void 0:E.title]}),r.jsx(Zs,{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:()=>we.mutate({eventId:E.id,testMode:!0}),disabled:we.isPending,children:[r.jsx(Nn,{className:Ut("h-4 w-4 mr-2",we.isPending&&"animate-spin")}),"Send Test to Me"]}),r.jsxs(X,{variant:"outline",size:"sm",onClick:()=>we.mutate({eventId:E.id}),disabled:we.isPending||!(oe!=null&&oe.length),children:[r.jsx(Nn,{className:Ut("h-4 w-4 mr-2",we.isPending&&"animate-spin")}),we.isPending?"Sending...":"Send Reminder to All"]}),(E==null?void 0:E.zoom_meeting_id)&&r.jsxs(r.Fragment,{children:[r.jsxs(X,{variant:"outline",size:"sm",onClick:()=>ve.mutate(E.id),disabled:ve.isPending,children:[r.jsx(Go,{className:Ut("h-4 w-4 mr-2",ve.isPending&&"animate-spin")}),ve.isPending?"Syncing...":"Sync Registrations"]}),r.jsxs(X,{variant:"default",size:"sm",onClick:()=>be.mutate(E.id),disabled:be.isPending,children:[r.jsx(lo,{className:Ut("h-4 w-4 mr-2",be.isPending&&"animate-spin")}),be.isPending?"Syncing...":"Sync Attendees & Award Points"]})]})]}),r.jsxs(Si,{defaultValue:"registrations",className:"w-full",children:[r.jsxs(ki,{className:"grid w-full grid-cols-2",children:[r.jsxs(is,{value:"registrations",className:"gap-2",children:[r.jsx(qs,{className:"h-4 w-4"}),"Registrations (",(oe==null?void 0:oe.length)||0,")"]}),r.jsxs(is,{value:"attendees",className:"gap-2",children:[r.jsx(Ki,{className:"h-4 w-4"}),"Attendees (",(de==null?void 0:de.length)||0,")"]})]}),r.jsx(Ss,{value:"registrations",className:"mt-4",children:ce?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading registrations..."}):(oe==null?void 0:oe.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No registrations yet for this event."}),(E==null?void 0:E.zoom_meeting_id)&&r.jsx("p",{className:"text-xs mt-2",children:'Click "Sync Registrations" to import from Zoom.'})]}):r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{children:[r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{children:"Registered"}),r.jsx(Mt,{children:"Status"})]})}),r.jsx(On,{children:oe==null?void 0:oe.map(je=>{var Ze,De;const lt=((Ze=je.profiles)==null?void 0:Ze.name)||je.zoom_name||"Unknown",Ce=((De=je.profiles)==null?void 0:De.email)||je.zoom_email||null,Ie=!je.user_id;return r.jsxs(kr,{children:[r.jsx(gt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[lt,Ie&&r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"External"})]})}),r.jsx(gt,{children:Ce?r.jsxs("a",{href:`mailto:${Ce}`,className:"flex items-center gap-1 text-primary hover:underline",children:[r.jsx(Nn,{className:"h-3 w-3"}),Ce]}):r.jsx("span",{className:"text-muted-foreground",children:"No email"})}),r.jsx(gt,{className:"text-muted-foreground text-sm",children:rs(new Date(je.registered_at),"MMM d, yyyy h:mm a")}),r.jsx(gt,{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(Ss,{value:"attendees",className:"mt-4",children:xe?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading attendees..."}):(de==null?void 0:de.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No attendees recorded yet."}),(E==null?void 0:E.zoom_meeting_id)&&r.jsx("p",{className:"text-xs mt-2",children:'Click "Sync Attendees & Award Points" after the event ends to import actual participants from Zoom.'})]}):r.jsxs(r.Fragment,{children:[(de==null?void 0:de.filter(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(vl,{className:"h-4 w-4 text-amber-600 dark:text-amber-400"}),r.jsxs("h4",{className:"font-medium text-amber-800 dark:text-amber-200",children:["Unmatched Attendees (",de==null?void 0:de.filter(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:de==null?void 0:de.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:()=>Le(je),className:"gap-1",children:[r.jsx(ym,{className:"h-3 w-3"}),"Link to Profile"]})]},je.id))})]}),r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{children:[r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{children:"Duration"}),r.jsx(Mt,{children:"Points"})]})}),r.jsx(On,{children:de==null?void 0:de.filter(je=>je.user_id).map(je=>{var Ie,Ze;const lt=((Ie=je.profiles)==null?void 0:Ie.name)||je.zoom_name||"Unknown",Ce=((Ze=je.profiles)==null?void 0:Ze.email)||je.zoom_email||null;return r.jsxs(kr,{children:[r.jsx(gt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[lt,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(gt,{children:Ce?r.jsxs("a",{href:`mailto:${Ce}`,className:"flex items-center gap-1 text-primary hover:underline",children:[r.jsx(Nn,{className:"h-3 w-3"}),Ce]}):r.jsx("span",{className:"text-muted-foreground",children:"No email"})}),r.jsx(gt,{children:je.duration_minutes?r.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-sm",children:[r.jsx(Ra,{className:"h-3 w-3"}),je.duration_minutes," min"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(gt,{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(lo,{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:R,children:r.jsxs(Pr,{className:"max-w-md",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{className:"flex items-center gap-2",children:[r.jsx(ym,{className:"h-5 w-5"}),"Link Attendee to Profile"]}),r.jsx(Zs,{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(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by name or email...",value:ne,onChange:je=>ie(je.target.value),className:"pl-9"})]})]}),r.jsx("div",{className:"max-h-48 overflow-y-auto border rounded-md",children:Pe.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:Pe.slice(0,20).map(je=>r.jsxs("button",{type:"button",onClick:()=>H(je.id),className:Ut("w-full p-3 text-left hover:bg-muted/50 transition-colors",q===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(bl,{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:()=>R(!1),children:"Cancel"}),r.jsx(X,{onClick:Ue,disabled:!q||Ae.isPending,children:Ae.isPending?"Linking...":"Link & Award Points"})]})]})]})})]})})}const P4t=()=>{const{user:e}=Yr(),{toast:t}=ci(),s=Br(),[n,a]=Ic(),[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),[E,T]=A.useState(null),[P,R]=A.useState(""),[D,U]=A.useState(""),[q,H]=A.useState(""),[G,Q]=A.useState(!1),[ne,ie]=A.useState(!1),{data:he=[]}=Kt({queryKey:["template-categories"],queryFn:async()=>{const{data:et,error:le}=await Y.from("template_categories").select("*").order("name");if(le)throw le;return et}}),{data:se=[]}=Kt({queryKey:["template-types"],queryFn:async()=>{const{data:et,error:le}=await Y.from("template_types").select("*").order("name");if(le)throw le;return et}}),{data:fe=[],isLoading:oe}=Kt({queryKey:["canva-templates-admin"],queryFn:async()=>{const{data:et,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:Ve,error:Je}=await Y.from("template_links").select("*").order("sort_order");if(Je)throw Je;const{data:rt,error:je}=await Y.from("template_guides").select("*").order("sort_order");if(je)throw je;return et.map(Ce=>({...Ce,links:(Ve==null?void 0:Ve.filter(Ie=>Ie.template_id===Ce.id))||[],guides:(rt==null?void 0:rt.filter(Ie=>Ie.template_id===Ce.id))||[]}))}});A.useEffect(()=>{const et=n.get("edit");if(et&&fe.length>0){const le=fe.find(Ve=>Ve.id===et);le&&(be(le),a({},{replace:!0}))}},[fe,n]);const ce=ar({mutationFn:async et=>{const{data:le,error:Ve}=await Y.from("template_categories").insert({name:et}).select().single();if(Ve)throw Ve;return le},onSuccess:et=>{s.invalidateQueries({queryKey:["template-categories"]}),x({...m,category_id:et.id}),U(""),Q(!1),t({title:"Category added"})},onError:et=>{t({title:"Error adding category",description:et.message,variant:"destructive"})}}),de=ar({mutationFn:async et=>{const{data:le,error:Ve}=await Y.from("template_types").insert({name:et}).select().single();if(Ve)throw Ve;return le},onSuccess:et=>{s.invalidateQueries({queryKey:["template-types"]}),x({...m,type_id:et.id}),H(""),ie(!1),t({title:"Type added"})},onError:et=>{t({title:"Error adding type",description:et.message,variant:"destructive"})}}),xe=ar({mutationFn:async et=>{var je;let le=et.existingImageUrl;if(et.image){const lt=et.image.name.split(".").pop(),Ce=`${Date.now()}-${Math.random().toString(36).substring(7)}.${lt}`,{error:Ie}=await Y.storage.from("template-previews").upload(Ce,et.image);if(Ie)throw Ie;const{data:Ze}=Y.storage.from("template-previews").getPublicUrl(Ce);le=Ze.publicUrl}const Ve={name:et.template.name,description:et.template.description||null,category_id:et.template.category_id||null,type_id:et.template.type_id||null,preview_image_url:le,video_url:et.videoUrl||null,publish_date:et.template.publish_date?new Date(et.template.publish_date).toISOString():new Date().toISOString(),created_by:e==null?void 0:e.id};let Je=et.templateId;if(Je){const{error:lt}=await Y.from("canva_templates").update(Ve).eq("id",Je);if(lt)throw lt;const{error:Ce}=await Y.from("template_links").delete().eq("template_id",Je);if(Ce)throw Ce;const Ie=((je=et.existingGuides)==null?void 0:je.map(Ke=>Ke.id).filter(Boolean))||[],Ze=et.template.guides.map(Ke=>Ke.id).filter(Boolean),De=Ie.filter(Ke=>!Ze.includes(Ke));De.length>0&&await Y.from("template_guides").delete().in("id",De)}else{const{data:lt,error:Ce}=await Y.from("canva_templates").insert(Ve).select().single();if(Ce)throw Ce;Je=lt.id,M4t(et.template.name,lt.id)}const rt=et.template.links.filter(lt=>lt.title.trim()&<.canva_share_link.trim());if(rt.length>0){const lt=rt.map((Ie,Ze)=>({template_id:Je,title:Ie.title.trim(),canva_share_link:Ie.canva_share_link.trim(),sort_order:Ze})),{error:Ce}=await Y.from("template_links").insert(lt);if(Ce)throw Ce}for(let lt=0;lt{s.invalidateQueries({queryKey:["canva-templates-admin"]}),s.invalidateQueries({queryKey:["canva-templates"]}),ve(),l(!1),t({title:i?"Template updated":"Template created"})},onError:et=>{t({title:"Error saving template",description:et.message,variant:"destructive"})}}),Me=ar({mutationFn:async et=>{const{error:le}=await Y.from("canva_templates").delete().eq("id",et);if(le)throw le},onSuccess:()=>{s.invalidateQueries({queryKey:["canva-templates-admin"]}),s.invalidateQueries({queryKey:["canva-templates"]}),t({title:"Template deleted"})},onError:et=>{t({title:"Error deleting template",description:et.message,variant:"destructive"})}}),ve=()=>{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),R(""),u(null),Q(!1),ie(!1),U(""),H(""),v(null),N(0),M(!1)},be=et=>{var le;u(et),x({name:et.name,description:et.description||"",category_id:et.category_id||"",type_id:et.type_id||"",publish_date:et.publish_date?new Date(et.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],links:et.links&&et.links.length>0?et.links.map(Ve=>({id:Ve.id,title:Ve.title,canva_share_link:Ve.canva_share_link,sort_order:Ve.sort_order})):[{title:"",canva_share_link:"",sort_order:0}],guides:((le=et.guides)==null?void 0:le.map(Ve=>({id:Ve.id,name:Ve.name,file_url:Ve.file_url,file_type:Ve.file_type,file_size:Ve.file_size,sort_order:Ve.sort_order})))||[],video_url:et.video_url||""}),R(et.preview_image_url||""),v(null),l(!0)},we=et=>{var Ve;const le=(Ve=et.target.files)==null?void 0:Ve[0];le&&(T(le),R(URL.createObjectURL(le)))},tt=()=>{x({...m,links:[...m.links,{title:"",canva_share_link:"",sort_order:m.links.length}]})},Ae=et=>{if(m.links.length<=1)return;const le=m.links.filter((Ve,Je)=>Je!==et);x({...m,links:le})},Le=(et,le,Ve)=>{const Je=[...m.links];Je[et]={...Je[et],[le]:Ve},x({...m,links:Je})},Ue=et=>{const le=et.target.files;if(!le)return;const Ve=Array.from(le).map((Je,rt)=>({name:Je.name.replace(/\.[^/.]+$/,""),file_url:"",file_type:Je.type,file_size:Je.size,sort_order:m.guides.length+rt,file:Je}));x({...m,guides:[...m.guides,...Ve]}),et.target.value=""},Pe=et=>{const le=m.guides.filter((Ve,Je)=>Je!==et);x({...m,guides:le})},$e=(et,le)=>{const Ve=[...m.guides];Ve[et]={...Ve[et],name:le},x({...m,guides:Ve})},it=async()=>{if(!y)return null;M(!0),N(0);try{const{data:et,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:Ve,libraryId:Je}=et,{data:rt,error:je}=await Y.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:Ve}});if(je)throw new Error(je.message);const lt=new XMLHttpRequest;return await new Promise((Ie,Ze)=>{lt.upload.addEventListener("progress",De=>{if(De.lengthComputable){const Ke=Math.round(De.loaded/De.total*100);N(Ke)}}),lt.addEventListener("load",()=>{lt.status>=200&<.status<300?Ie():Ze(new Error(`Upload failed with status ${lt.status}`))}),lt.addEventListener("error",()=>Ze(new Error("Upload failed"))),lt.open("PUT",rt.uploadUrl),lt.setRequestHeader("AccessKey",rt.apiKey),lt.send(y)}),`https://player.mediadelivery.net/embed/${Je}/${Ve}`}catch(et){return console.error("Bunny upload error:",et),t({title:"Video upload failed",description:et instanceof Error?et.message:"Unknown error",variant:"destructive"}),null}finally{M(!1)}},xt=et=>{var Ve;const le=(Ve=et.target.files)==null?void 0:Ve[0];le&&v(le),et.target.value=""},Ee=async et=>{if(et.preventDefault(),!m.name.trim()){t({title:"Please enter a template name",variant:"destructive"});return}if(m.links.filter(Je=>Je.title.trim()&&Je.canva_share_link.trim()).length===0){t({title:"Please add at least one Canva link",variant:"destructive"});return}let Ve=m.video_url;if(y){const Je=await it();if(!Je)return;Ve=Je}xe.mutate({template:m,image:E,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:Ve})};return r.jsx(Dr,{title:"Manage Templates",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Eu,{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(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Total Templates"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:fe.length})})]}),r.jsxs(He,{children:[r.jsx(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Categories"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:he.length})})]}),r.jsxs(He,{children:[r.jsx(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Template Types"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:se.length})})]})]}),r.jsxs(Or,{open:o,onOpenChange:et=>{l(et),et||ve()},children:[r.jsx(vo,{asChild:!0,children:r.jsxs(X,{className:"gap-2",children:[r.jsx(vs,{className:"h-4 w-4"}),"Add Template"]})}),r.jsxs(Pr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Rr,{children:i?"Edit Template":"Add New Template"})}),r.jsxs("form",{onSubmit:Ee,className:"space-y-6 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"name",children:"Name *"}),r.jsx(ot,{id:"name",value:m.name,onChange:et=>x({...m,name:et.target.value}),placeholder:"Template name",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Description"}),r.jsx(Wf,{content:m.description,onChange:et=>x({...m,description:et}),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:tt,className:"gap-1",children:[r.jsx(vs,{className:"h-3 w-3"}),"Add Link"]})]}),r.jsx("div",{className:"space-y-3",children:m.links.map((et,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(ot,{value:et.title,onChange:Ve=>Le(le,"title",Ve.target.value),placeholder:"Link title (e.g., Instagram Post, Story)"}),r.jsx(ot,{value:et.canva_share_link,onChange:Ve=>Le(le,"canva_share_link",Ve.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:()=>Ae(le),children:r.jsx(en,{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(ot,{value:D,onChange:et=>U(et.target.value),placeholder:"New category name",className:"flex-1"}),r.jsx(X,{type:"button",size:"sm",onClick:()=>D.trim()&&ce.mutate(D.trim()),disabled:ce.isPending,children:"Add"}),r.jsx(X,{type:"button",size:"sm",variant:"ghost",onClick:()=>{Q(!1),U("")},children:r.jsx(en,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(us,{value:m.category_id,onValueChange:et=>x({...m,category_id:et}),children:[r.jsx(cs,{className:"flex-1",children:r.jsx(ms,{placeholder:"Select category"})}),r.jsx(ds,{children:he.map(et=>r.jsx($t,{value:et.id,children:et.name},et.id))})]}),r.jsx(X,{type:"button",variant:"outline",size:"icon",onClick:()=>Q(!0),children:r.jsx(vs,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Template Type"}),ne?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ot,{value:q,onChange:et=>H(et.target.value),placeholder:"New type name",className:"flex-1"}),r.jsx(X,{type:"button",size:"sm",onClick:()=>q.trim()&&de.mutate(q.trim()),disabled:de.isPending,children:"Add"}),r.jsx(X,{type:"button",size:"sm",variant:"ghost",onClick:()=>{ie(!1),H("")},children:r.jsx(en,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(us,{value:m.type_id,onValueChange:et=>x({...m,type_id:et}),children:[r.jsx(cs,{className:"flex-1",children:r.jsx(ms,{placeholder:"Select type"})}),r.jsx(ds,{children:se.map(et=>r.jsx($t,{value:et.id,children:et.name},et.id))})]}),r.jsx(X,{type:"button",variant:"outline",size:"icon",onClick:()=>ie(!0),children:r.jsx(vs,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(ot,{id:"publish_date",type:"date",value:m.publish_date,onChange:et=>x({...m,publish_date:et.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),R("")},children:r.jsx(en,{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(El,{className:"h-8 w-8 text-muted-foreground/50"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx(ot,{type:"file",accept:"image/*",onChange:we,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(Ta,{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(Vr,{className:"h-4 w-4 animate-spin"}),r.jsxs("span",{className:"text-sm",children:["Uploading video... ",b,"%"]})]}),r.jsx(lc,{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(Ta,{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(en,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:"cursor-pointer",children:[r.jsx(ot,{type:"file",accept:"video/*",onChange:xt,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(Ta,{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(ot,{type:"file",accept:".pdf,.doc,.docx",multiple:!0,onChange:Ue,className:"hidden"}),r.jsx(X,{type:"button",variant:"outline",size:"sm",className:"gap-1",asChild:!0,children:r.jsxs("span",{children:[r.jsx(so,{className:"h-3 w-3"}),"Add Files"]})})]})]}),m.guides.length>0?r.jsx("div",{className:"space-y-2",children:m.guides.map((et,le)=>r.jsxs("div",{className:"flex gap-2 items-center p-3 border rounded-lg bg-muted/30",children:[r.jsx(ga,{className:"h-5 w-5 text-muted-foreground shrink-0"}),r.jsx(ot,{value:et.name,onChange:Ve=>$e(le,Ve.target.value),placeholder:"Guide name",className:"flex-1"}),et.file_size&&r.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[(et.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:()=>Pe(le),children:r.jsx(en,{className:"h-4 w-4"})})]},et.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),ve()},children:"Cancel"}),r.jsx(X,{type:"submit",disabled:xe.isPending,children:xe.isPending?"Saving...":i?"Update":"Create"})]})]})]})]})]}),r.jsx(He,{children:r.jsx(Xe,{className:"p-0",children:oe?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading..."}):fe.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No templates yet. Add your first template!"}):r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:fe.map(et=>{var le,Ve,Je,rt,je;return r.jsxs(kr,{children:[r.jsx(gt,{children:r.jsx("div",{className:"w-16 h-12 rounded overflow-hidden bg-muted",children:et.preview_image_url?r.jsx("img",{src:et.preview_image_url,alt:et.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(El,{className:"h-4 w-4 text-muted-foreground"})})})}),r.jsx(gt,{className:"font-medium",children:et.name}),r.jsx(gt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsxs(Tt,{variant:"secondary",children:[((le=et.links)==null?void 0:le.length)||0," link",(((Ve=et.links)==null?void 0:Ve.length)||0)!==1?"s":""]}),(((Je=et.guides)==null?void 0:Je.length)||0)>0&&r.jsxs(Tt,{variant:"outline",className:"gap-1",children:[r.jsx(ga,{className:"h-3 w-3"}),(rt=et.guides)==null?void 0:rt.length," guide",(((je=et.guides)==null?void 0:je.length)||0)!==1?"s":""]})]})}),r.jsx(gt,{children:et.category?r.jsx(Tt,{variant:"secondary",children:et.category.name}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(gt,{children:et.type?r.jsx(Tt,{variant:"outline",children:et.type.name}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(gt,{className:"text-muted-foreground",children:new Date(et.publish_date).toLocaleDateString()}),r.jsx(gt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(X,{size:"icon",variant:"ghost",onClick:()=>be(et),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?")&&Me.mutate(et.id)},children:r.jsx(Bs,{className:"h-4 w-4"})})]})})]},et.id)})})]})})})]})})};function Z9e({selectedTemplateIds:e,onChange:t}){const[s,n]=A.useState(""),[a,o]=A.useState(!1),{data:l=[]}=Kt({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(s.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($j,{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(en,{className:"h-3 w-3"})})]},y.id))}),r.jsxs(Kc,{open:a,onOpenChange:o,children:[r.jsx(Zc,{asChild:!0,children:r.jsxs(X,{type:"button",variant:"outline",size:"sm",className:"gap-1",children:[r.jsx($j,{className:"h-3.5 w-3.5"}),"Add Template"]})}),r.jsxs(Ac,{className:"w-80 p-2",align:"start",children:[r.jsxs("div",{className:"relative mb-2",children:[r.jsx(ua,{className:"absolute left-2 top-2.5 h-3.5 w-3.5 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search templates...",value:s,onChange:y=>n(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:s?"No templates found":"All templates selected"}):u.map(y=>r.jsxs("button",{type:"button",onClick:()=>{m(y.id),n("")},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($j,{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 L4t=[{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"}],O4t=()=>{const{user:e}=Yr(),[t,s]=Ic(),{toast:n}=ci(),a=Br(),[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([]),[E,T]=A.useState([]),[P,R]=A.useState([]),[D,U]=A.useState([]),[q,H]=A.useState(""),[G,Q]=A.useState(!1),[ne,ie]=A.useState(null),[he,se]=A.useState(0),[fe,oe]=A.useState(!1),[ce,de]=A.useState(null),{data:xe=[]}=Kt({queryKey:["academy-categories"],queryFn:async()=>{const{data:le,error:Ve}=await Y.from("academy_categories").select("*").order("sort_order",{ascending:!0});if(Ve)throw Ve;return le}}),{data:Me=[],isLoading:ve}=Kt({queryKey:["academy-videos-admin"],queryFn:async()=>{const{data:le,error:Ve}=await Y.from("academy_videos").select(` *, category:academy_categories(id, name) `).order("publish_date",{ascending:!1});if(Ve)throw Ve;const{data:Je,error:rt}=await Y.from("academy_resources").select("*").order("sort_order");if(rt)throw rt;return le.map(lt=>({...lt,resources:(Je==null?void 0:Je.filter(Ce=>Ce.video_id===lt.id))||[]}))}});A.useEffect(()=>{const le=t.get("edit");if(le&&Me.length>0){const Ve=Me.find(Je=>Je.id===le);Ve&&(Ue(Ve),s({},{replace:!0}))}},[Me,t]);const be=ar({mutationFn:async le=>{const{data:Ve,error:Je}=await Y.from("academy_categories").insert({name:le,sort_order:xe.length}).select().single();if(Je)throw Je;return Ve},onSuccess:le=>{a.invalidateQueries({queryKey:["academy-categories"]}),x({...m,category_id:le.id}),H(""),Q(!1),n({title:"Category added"})},onError:le=>{n({title:"Error adding category",description:le.message,variant:"destructive"})}}),we=ar({mutationFn:async le=>{let Ve=le.existingThumbnailUrl;if(le.thumbnail){const je=le.thumbnail.name.split(".").pop(),lt=`thumbnails/${Date.now()}-${Math.random().toString(36).substring(7)}.${je}`,{error:Ce}=await Y.storage.from("academy-resources").upload(lt,le.thumbnail);if(Ce)throw Ce;const{data:Ie}=Y.storage.from("academy-resources").getPublicUrl(lt);Ve=Ie.publicUrl}const Je={title:le.video.title,description:le.video.description||null,video_url:le.video.video_url,video_type:le.video.video_type,duration:le.video.duration||null,thumbnail_url:Ve,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(Je).eq("id",rt);if(je)throw je}else{const{data:je,error:lt}=await Y.from("academy_videos").insert(Je).select().single();if(lt)throw lt;rt=je.id,T4t(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(lt=>({video_id:rt,template_id:lt})));if(je)throw je}},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-videos-admin"]}),a.invalidateQueries({queryKey:["academy-videos"]}),Le(),l(!1),n({title:i?"Video updated":"Video created"})},onError:le=>{n({title:"Error saving video",description:le.message,variant:"destructive"})}}),tt=ar({mutationFn:async le=>{const{error:Ve}=await Y.from("academy_videos").delete().eq("id",le);if(Ve)throw Ve},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-videos-admin"]}),a.invalidateQueries({queryKey:["academy-videos"]}),n({title:"Video deleted"})},onError:le=>{n({title:"Error deleting video",description:le.message,variant:"destructive"})}}),Ae=ar({mutationFn:async({id:le,is_published:Ve})=>{const{error:Je}=await Y.from("academy_videos").update({is_published:Ve}).eq("id",le);if(Je)throw Je},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-videos-admin"]}),a.invalidateQueries({queryKey:["academy-videos"]})},onError:le=>{n({title:"Error updating video",description:le.message,variant:"destructive"})}}),Le=()=>{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([]),R([]),u(null),U([]),H(""),ie(null),se(0),oe(!1),de(null)},Ue=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([]),R([]);const{data:Ve}=await Y.from("academy_video_templates").select("template_id").eq("video_id",le.id);U((Ve||[]).map(Je=>Je.template_id)),l(!0)},Pe=le=>{var Je;const Ve=(Je=le.target.files)==null?void 0:Je[0];Ve&&(v(Ve),N(URL.createObjectURL(Ve)))},$e=le=>{const Ve=le.target.files;if(Ve){const Je=Array.from(Ve).map(rt=>({file:rt,title:rt.name.replace(/\.[^/.]+$/,"")}));M([...k,...Je])}le.target.value=""},it=le=>{M(k.filter((Ve,Je)=>Je!==le))},xt=le=>{R([...P,le]),T(E.filter(Ve=>Ve.id!==le))},Ee=async()=>{if(!ne)return null;oe(!0),se(0);try{const{data:le,error:Ve}=await Y.functions.invoke("bunny-upload",{body:{action:"create",title:m.title||ne.name}});if(Ve)throw new Error(Ve.message);const{videoId:Je,libraryId:rt}=le;de(Je);const{data:je,error:lt}=await Y.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:Je}});if(lt)throw new Error(lt.message);const Ce=new XMLHttpRequest;return await new Promise((Ze,De)=>{Ce.upload.addEventListener("progress",Ke=>{if(Ke.lengthComputable){const st=Math.round(Ke.loaded/Ke.total*100);se(st)}}),Ce.addEventListener("load",()=>{Ce.status>=200&&Ce.status<300?Ze():De(new Error(`Upload failed with status ${Ce.status}`))}),Ce.addEventListener("error",()=>De(new Error("Upload failed"))),Ce.open("PUT",je.uploadUrl),Ce.setRequestHeader("AccessKey",je.apiKey),Ce.send(ne)}),`https://player.mediadelivery.net/embed/${rt}/${Je}`}catch(le){return console.error("Bunny upload error:",le),n({title:"Video upload failed",description:le instanceof Error?le.message:"Unknown error",variant:"destructive"}),null}finally{oe(!1)}},et=async le=>{if(le.preventDefault(),!m.title.trim()){n({title:"Please enter a video title",variant:"destructive"});return}let Ve=m.video_url;if(m.video_type==="bunny_stream"&&ne&&!i){const Je=await Ee();if(!Je)return;Ve=Je}else if(!m.video_url.trim()&&m.video_type!=="bunny_stream"){n({title:"Please enter a video URL",variant:"destructive"});return}else if(m.video_type==="bunny_stream"&&!ne&&!m.video_url&&!i){n({title:"Please select a video file to upload",variant:"destructive"});return}we.mutate({video:{...m,video_url:Ve},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(Eu,{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(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Total Videos"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:Me.length})})]}),r.jsxs(He,{children:[r.jsx(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:Me.filter(le=>le.is_published).length})})]})]}),r.jsxs(Or,{open:o,onOpenChange:le=>{l(le),le||Le()},children:[r.jsx(vo,{asChild:!0,children:r.jsxs(X,{className:"gap-2",children:[r.jsx(vs,{className:"h-4 w-4"}),"Add Video"]})}),r.jsxs(Pr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Rr,{children:i?"Edit Video":"Add New Video"})}),r.jsxs("form",{onSubmit:et,className:"space-y-6 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"title",children:"Title *"}),r.jsx(ot,{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(Wf,{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(us,{value:m.video_type,onValueChange:le=>{x({...m,video_type:le,video_url:""}),ie(null)},disabled:fe,children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsx(ds,{children:L4t.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(ot,{type:"file",accept:"video/*",onChange:le=>{var Je;const Ve=(Je=le.target.files)==null?void 0:Je[0];Ve&&ie(Ve)},disabled:fe}),ne&&r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Ta,{className:"h-4 w-4"}),ne.name," (",(ne.size/(1024*1024)).toFixed(1)," MB)"]}),fe&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Vr,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{className:"text-sm",children:"Uploading to Bunny.net..."})]}),r.jsx(lc,{value:he,className:"h-2"}),r.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[he,"%"]})]})]})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"video_url",children:"Video URL *"}),r.jsx(ot,{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(ot,{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(ot,{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(ot,{value:q,onChange:le=>H(le.target.value),placeholder:"New category name",className:"flex-1"}),r.jsx(X,{type:"button",size:"sm",onClick:()=>q.trim()&&be.mutate(q.trim()),disabled:be.isPending,children:"Add"}),r.jsx(X,{type:"button",size:"sm",variant:"ghost",onClick:()=>{Q(!1),H("")},children:r.jsx(en,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(us,{value:m.category_id,onValueChange:le=>x({...m,category_id:le}),children:[r.jsx(cs,{className:"flex-1",children:r.jsx(ms,{placeholder:"Select category"})}),r.jsx(ds,{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(vs,{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(ot,{type:"file",accept:"image/*",onChange:Pe,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(so,{className:"h-3 w-3"}),"Add Files",r.jsx("input",{type:"file",multiple:!0,accept:".pdf,.pptx,.ppt,.xlsx,.xls,.docx,.doc,.zip",onChange:$e,className:"hidden"})]})})]}),(E.length>0||k.length>0)&&r.jsxs("div",{className:"space-y-2 mt-2",children:[E.map(le=>r.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:[r.jsx(ga,{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:()=>xt(le.id),className:"text-destructive hover:text-destructive",children:r.jsx(en,{className:"h-4 w-4"})})]},le.id)),k.map((le,Ve)=>r.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:[r.jsx(ga,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ot,{value:le.title,onChange:Je=>{const rt=[...k];rt[Ve].title=Je.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:()=>it(Ve),className:"text-destructive hover:text-destructive",children:r.jsx(en,{className:"h-4 w-4"})})]},Ve))]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Supported: PDF, PowerPoint, Excel, Word, ZIP"})]}),r.jsx(Z9e,{selectedTemplateIds:D,onChange:U}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(In,{id:"is_published",checked:m.is_published,onCheckedChange:le=>x({...m,is_published:le})}),r.jsx(ze,{htmlFor:"is_published",children:"Published"})]}),r.jsxs(zn,{children:[r.jsx(X,{type:"button",variant:"outline",onClick:()=>l(!1),disabled:fe,children:"Cancel"}),r.jsx(X,{type:"submit",disabled:we.isPending||fe,children:fe?r.jsxs(r.Fragment,{children:[r.jsx(Vr,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):we.isPending?"Saving...":i?"Update Video":"Add Video"})]})]})]})]})]}),r.jsx(He,{children:r.jsx(Xe,{className:"p-0",children:ve?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"})}):Me.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Ta,{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(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:Me.map(le=>r.jsxs(kr,{children:[r.jsx(gt,{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(Ta,{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(gt,{children:le.category?r.jsx(Tt,{variant:"outline",children:le.category.name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(gt,{children:le.duration||"-"}),r.jsx(gt,{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(gt,{children:new Date(le.publish_date).toLocaleDateString()}),r.jsx(gt,{children:r.jsx(In,{checked:le.is_published,onCheckedChange:Ve=>Ae.mutate({id:le.id,is_published:Ve})})}),r.jsx(gt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>Ue(le),children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>tt.mutate(le.id),className:"text-destructive hover:text-destructive",children:r.jsx(Bs,{className:"h-4 w-4"})})]})})]},le.id))})]})})})]})})};function D4t(){var we,tt,Ae;const e=Br(),[t,s]=Ic(),[n,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([]),[E,T]=A.useState([]),[P,R]=A.useState(null),{data:D,isLoading:U}=Kt({queryKey:["resource-kits"],queryFn:async()=>{const{data:Le,error:Ue}=await Y.from("resource_kits").select("*").order("publish_date",{ascending:!1});if(Ue)throw Ue;return Le}}),{data:q}=Kt({queryKey:["resource-kit-files"],queryFn:async()=>{const{data:Le,error:Ue}=await Y.from("resource_kit_files").select("*").order("sort_order",{ascending:!0});if(Ue)throw Ue;return Le}}),{data:H}=Kt({queryKey:["resource-kit-links"],queryFn:async()=>{const{data:Le,error:Ue}=await Y.from("resource_kit_links").select("*").order("sort_order",{ascending:!0});if(Ue)throw Ue;return Le}});A.useEffect(()=>{const Le=t.get("edit");if(Le&&D&&D.length>0&&q&&H){const Ue=D.find(Pe=>Pe.id===Le);Ue&&(Q(Ue),s({},{replace:!0}))}},[D,q,H,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 Le=>{l(Le),u({name:Le.name,description:Le.description||"",publish_date:Le.publish_date.split("T")[0],is_published:Le.is_published}),v(Le.featured_image_url||"");const Ue=(q==null?void 0:q.filter(it=>it.kit_id===Le.id))||[];N(Ue.map(it=>({id:it.id,name:it.name,file_url:it.file_url,file_type:it.file_type,file_size:it.file_size,sort_order:it.sort_order})));const Pe=(H==null?void 0:H.filter(it=>it.kit_id===Le.id))||[];M(Pe.map(it=>({id:it.id,title:it.title,canva_share_link:it.canva_share_link,sort_order:it.sort_order})));const{data:$e}=await Y.from("resource_kit_templates").select("template_id").eq("kit_id",Le.id);T(($e||[]).map(it=>it.template_id)),a(!0)},ne=Le=>{var Pe;const Ue=(Pe=Le.target.files)==null?void 0:Pe[0];Ue&&(x(Ue),v(URL.createObjectURL(Ue)))},ie=()=>{N([...b,{name:"",file_url:"",sort_order:b.length}])},he=Le=>{N(b.filter((Ue,Pe)=>Pe!==Le))},se=(Le,Ue,Pe)=>{const $e=[...b];$e[Le]={...$e[Le],[Ue]:Pe},N($e)},fe=()=>{M([...k,{title:"",canva_share_link:"",sort_order:k.length}])},oe=Le=>{M(k.filter((Ue,Pe)=>Pe!==Le))},ce=(Le,Ue,Pe)=>{const $e=[...k];$e[Le]={...$e[Le],[Ue]:Pe},M($e)},de=(Le,Ue)=>{var $e;const Pe=($e=Ue.target.files)==null?void 0:$e[0];if(Pe){const it=[...b],xt=Pe.name.replace(/\.[^/.]+$/,"");it[Le]={...it[Le],file:Pe,file_type:Pe.type,file_size:Pe.size,name:it[Le].name||xt},N(it)}},xe=ar({mutationFn:async()=>{let Le=(o==null?void 0:o.featured_image_url)||null;if(m){const xt=m.name.split(".").pop(),Ee=`${Date.now()}.${xt}`,{error:et}=await Y.storage.from("resource-kits").upload(`featured/${Ee}`,m);if(et)throw et;const{data:le}=Y.storage.from("resource-kits").getPublicUrl(`featured/${Ee}`);Le=le.publicUrl}const Ue={name:i.name,description:i.description||null,featured_image_url:Le,publish_date:i.publish_date,is_published:i.is_published};let Pe;const $e=!o,it=(o==null?void 0:o.is_published)||!1;if(o){const{error:xt}=await Y.from("resource_kits").update(Ue).eq("id",o.id);if(xt)throw xt;Pe=o.id;const Ee=(q==null?void 0:q.filter(je=>je.kit_id===o.id).map(je=>je.id))||[],et=b.filter(je=>je.id).map(je=>je.id),le=Ee.filter(je=>!et.includes(je));le.length>0&&await Y.from("resource_kit_files").delete().in("id",le);const Ve=(H==null?void 0:H.filter(je=>je.kit_id===o.id).map(je=>je.id))||[],Je=k.filter(je=>je.id).map(je=>je.id),rt=Ve.filter(je=>!Je.includes(je));rt.length>0&&await Y.from("resource_kit_links").delete().in("id",rt)}else{const{data:xt,error:Ee}=await Y.from("resource_kits").insert(Ue).select().single();if(Ee)throw Ee;Pe=xt.id}for(let xt=0;xt0){const{error:xt}=await Y.from("resource_kit_templates").insert(E.map(Ee=>({kit_id:Pe,template_id:Ee})));if(xt)throw xt}return{kitId:Pe,kitName:i.name,isNewKit:$e,wasPublished:it,isPublished:i.is_published}},onSuccess:Le=>{e.invalidateQueries({queryKey:["resource-kits"]}),e.invalidateQueries({queryKey:["resource-kit-files"]}),e.invalidateQueries({queryKey:["resource-kit-links"]}),Te.success(o?"Resource kit updated":"Resource kit created"),Le.isPublished&&(Le.isNewKit||!Le.wasPublished)&&E4t(Le.kitName,Le.kitId),a(!1),G()},onError:Le=>{Te.error("Failed to save resource kit: "+Le.message)}}),Me=ar({mutationFn:async Le=>{const{error:Ue}=await Y.from("resource_kits").delete().eq("id",Le);if(Ue)throw Ue},onSuccess:()=>{e.invalidateQueries({queryKey:["resource-kits"]}),e.invalidateQueries({queryKey:["resource-kit-files"]}),Te.success("Resource kit deleted")},onError:Le=>{Te.error("Failed to delete: "+Le.message)}}),ve=Le=>{if(Le.preventDefault(),!i.name){Te.error("Please enter a name");return}xe.mutate()},be=Le=>(q==null?void 0:q.filter(Ue=>Ue.kit_id===Le).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(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Total Kits"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:(D==null?void 0:D.length)||0})})]}),r.jsxs(He,{children:[r.jsx(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:(D==null?void 0:D.filter(Le=>Le.is_published).length)||0})})]})]}),r.jsxs(X,{onClick:()=>{G(),a(!0)},children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Add Resource Kit"]})]}),r.jsx(He,{children:r.jsx(Xe,{className:"p-0",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:U?r.jsx(kr,{children:r.jsx(gt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):(D==null?void 0:D.length)===0?r.jsx(kr,{children:r.jsx(gt,{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(Le=>r.jsxs(kr,{children:[r.jsx(gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Le.featured_image_url?r.jsx("img",{src:Le.featured_image_url,alt:Le.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(Vl,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Le.name}),Le.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:Le.description})]})]})}),r.jsx(gt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ga,{className:"h-4 w-4 text-muted-foreground"}),be(Le.id)]})}),r.jsx(gt,{children:rs(new Date(Le.publish_date),"MMM d, yyyy")}),r.jsx(gt,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${Le.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:Le.is_published?"Published":"Draft"})}),r.jsx(gt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>{const Ue=(q==null?void 0:q.filter($e=>$e.kit_id===Le.id))||[],Pe=(H==null?void 0:H.filter($e=>$e.kit_id===Le.id))||[];R({...Le,files:Ue,links:Pe})},children:r.jsx(mo,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>Q(Le),children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource kit?")&&Me.mutate(Le.id)},children:r.jsx(Bs,{className:"h-4 w-4 text-destructive"})})]})})]},Le.id))})]})})}),r.jsx(Or,{open:n,onOpenChange:a,children:r.jsxs(Pr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Rr,{children:o?"Edit Resource Kit":"Add Resource Kit"})}),r.jsxs("form",{onSubmit:ve,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(Vl,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx(ot,{type:"file",accept:"image/*",onChange:ne})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"name",children:"Name *"}),r.jsx(ot,{id:"name",value:i.name,onChange:Le=>u({...i,name:Le.target.value}),placeholder:"Resource Kit Name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Description"}),r.jsx(Wf,{content:i.description,onChange:Le=>u({...i,description:Le}),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(ot,{id:"publish_date",type:"date",value:i.publish_date,onChange:Le=>u({...i,publish_date:Le.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(In,{checked:i.is_published,onCheckedChange:Le=>u({...i,is_published:Le})}),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:ie,children:[r.jsx(vs,{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((Le,Ue)=>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 ",Ue+1]}),r.jsx(X,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>he(Ue),children:r.jsx(en,{className:"h-4 w-4"})})]}),r.jsx(ot,{placeholder:"File name (e.g., Getting Started Guide)",value:Le.name,onChange:Pe=>se(Ue,"name",Pe.target.value)}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ot,{type:"file",onChange:Pe=>de(Ue,Pe),className:"flex-1"}),Le.file_url&&!Le.file&&r.jsx("a",{href:Le.file_url,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline whitespace-nowrap",children:"Current file"}),Le.file&&r.jsx("span",{className:"text-sm text-green-600 whitespace-nowrap",children:"New file selected"})]})]},Ue))})]}),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:fe,children:[r.jsx(vs,{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((Le,Ue)=>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 ",Ue+1]}),r.jsx(X,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>oe(Ue),children:r.jsx(en,{className:"h-4 w-4"})})]}),r.jsx(ot,{placeholder:"Link title (e.g., Social Media Post Template)",value:Le.title,onChange:Pe=>ce(Ue,"title",Pe.target.value)}),r.jsx(ot,{placeholder:"Canva share link (e.g., https://www.canva.com/design/...)",value:Le.canva_share_link,onChange:Pe=>ce(Ue,"canva_share_link",Pe.target.value)})]},Ue))})]}),r.jsx(Z9e,{selectedTemplateIds:E,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:()=>R(null),children:r.jsxs(Pr,{className:"max-w-lg",children:[r.jsx(zr,{children:r.jsx(Rr,{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 (",((we=P==null?void 0:P.files)==null?void 0:we.length)||0,")"]}),((tt=P==null?void 0:P.files)==null?void 0:tt.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:(Ae=P==null?void 0:P.files)==null?void 0:Ae.map(Le=>r.jsxs("a",{href:Le.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(ga,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm",children:Le.name})]},Le.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(Le=>r.jsxs("a",{href:Le.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(zo,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm",children:Le.title})]},Le.id))})]})]})]})})]})})}const R4t=()=>{const{user:e}=Yr(),{toast:t}=ci(),s=Br(),[n,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}=Kt({queryKey:["social-swag-admin"],queryFn:async()=>{const{data:H,error:G}=await Y.from("social_swag").select("*").order("publish_date",{ascending:!1});if(G)throw G;const{data:Q,error:ne}=await Y.from("social_swag_links").select("*").order("sort_order");if(ne)throw ne;return H.map(he=>({...he,links:(Q==null?void 0:Q.filter(se=>se.swag_id===he.id))||[]}))}}),k=ar({mutationFn:async H=>{let G=H.existingImageUrl;if(H.image){const fe=H.image.name.split(".").pop(),oe=`${Date.now()}-${Math.random().toString(36).substring(7)}.${fe}`,{error:ce}=await Y.storage.from("template-previews").upload(oe,H.image);if(ce)throw ce;const{data:de}=Y.storage.from("template-previews").getPublicUrl(oe);G=de.publicUrl}const Q={title:H.item.title,description:H.item.description||null,preview_image_url:G,publish_date:H.item.publish_date?new Date(H.item.publish_date).toISOString():new Date().toISOString(),is_published:H.item.is_published,created_by:e==null?void 0:e.id};let ne=H.itemId;const ie=!ne,he=(o==null?void 0:o.is_published)||!1;if(ne){const{error:fe}=await Y.from("social_swag").update(Q).eq("id",ne);if(fe)throw fe;await Y.from("social_swag_links").delete().eq("swag_id",ne)}else{const{data:fe,error:oe}=await Y.from("social_swag").insert(Q).select().single();if(oe)throw oe;ne=fe.id}const se=H.item.links.filter(fe=>fe.title.trim()&&fe.canva_share_link.trim());if(se.length>0){const fe=se.map((ce,de)=>({swag_id:ne,title:ce.title.trim(),canva_share_link:ce.canva_share_link.trim(),sort_order:de})),{error:oe}=await Y.from("social_swag_links").insert(fe);if(oe)throw oe}return{itemId:ne,itemTitle:H.item.title,isNewItem:ie,wasPublished:he,isPublished:H.item.is_published}},onSuccess:H=>{s.invalidateQueries({queryKey:["social-swag-admin"]}),s.invalidateQueries({queryKey:["social-swag"]}),t({title:o?"Item updated":"Item created"}),H.isPublished&&(H.isNewItem||!H.wasPublished)&&vpe(H.itemTitle,H.itemId),a(!1),E()},onError:H=>{t({title:"Error saving item",description:H.message,variant:"destructive"})}}),M=ar({mutationFn:async H=>{const{error:G}=await Y.from("social_swag").delete().eq("id",H);if(G)throw G},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-admin"]}),s.invalidateQueries({queryKey:["social-swag"]}),t({title:"Item deleted"})},onError:H=>{t({title:"Error deleting item",description:H.message,variant:"destructive"})}}),E=()=>{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=H=>{l(H),u({title:H.title,description:H.description||"",publish_date:H.publish_date?new Date(H.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:H.is_published,links:H.links&&H.links.length>0?H.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(H.preview_image_url||""),a(!0)},P=H=>{var Q;const G=(Q=H.target.files)==null?void 0:Q[0];G&&(x(G),v(URL.createObjectURL(G)))},R=()=>{u({...i,links:[...i.links,{title:"",canva_share_link:"",sort_order:i.links.length}]})},D=H=>{if(i.links.length<=1)return;const G=i.links.filter((Q,ne)=>ne!==H);u({...i,links:G})},U=(H,G,Q)=>{const ne=[...i.links];ne[H]={...ne[H],[G]:Q},u({...i,links:ne})},q=H=>{if(H.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(Eu,{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(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Total Items"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:b.length})})]}),r.jsxs(He,{children:[r.jsx(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:b.filter(H=>H.is_published).length})})]})]}),r.jsxs(Or,{open:n,onOpenChange:H=>{a(H),H||E()},children:[r.jsx(vo,{asChild:!0,children:r.jsxs(X,{className:"gap-2",children:[r.jsx(vs,{className:"h-4 w-4"}),"Add Item"]})}),r.jsxs(Pr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Rr,{children:o?"Edit Item":"Add New Item"})}),r.jsxs("form",{onSubmit:q,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"title",children:"Title *"}),r.jsx(ot,{id:"title",value:i.title,onChange:H=>u({...i,title:H.target.value}),placeholder:"Enter title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Description"}),r.jsx(Wf,{content:i.description,onChange:H=>u({...i,description:H}),placeholder:"Enter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(ot,{id:"publish_date",type:"date",value:i.publish_date,onChange:H=>u({...i,publish_date:H.target.value})})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(In,{id:"is_published",checked:i.is_published,onCheckedChange:H=>u({...i,is_published:H})}),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(en,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:[r.jsx(El,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx(ot,{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:R,children:[r.jsx(vs,{className:"h-3 w-3 mr-1"}),"Add Link"]})]}),i.links.map((H,G)=>r.jsx(He,{children:r.jsxs(Xe,{className:"pt-4 pb-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["Link ",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(en,{className:"h-3 w-3"})})]}),r.jsx(ot,{placeholder:"Link title (e.g., Instagram Post)",value:H.title,onChange:Q=>U(G,"title",Q.target.value)}),r.jsx(ot,{placeholder:"Canva share link",value:H.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(Xe,{className:"p-0",children:N?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):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(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:b.map(H=>{var G;return r.jsxs(kr,{children:[r.jsx(gt,{children:H.preview_image_url?r.jsx("img",{src:H.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(El,{className:"h-4 w-4 text-muted-foreground"})})}),r.jsx(gt,{className:"font-medium",children:H.title}),r.jsxs(gt,{children:[((G=H.links)==null?void 0:G.length)||0," links"]}),r.jsx(gt,{children:new Date(H.publish_date).toLocaleDateString()}),r.jsx(gt,{children:r.jsx(Tt,{variant:H.is_published?"default":"secondary",children:H.is_published?"Published":"Draft"})}),r.jsx(gt,{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/${H.id}`,"_blank"),children:r.jsx(mo,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>T(H),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(H.id)},children:r.jsx(Bs,{className:"h-4 w-4"})})]})})]},H.id)})})]})})})]})})};function F4t(){for(var e=arguments.length,t=new Array(e),s=0;sn=>{t.forEach(a=>a(n))},t)}const Fae=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function U3(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function V0e(e){return"nodeType"in e}function Uh(e){var t,s;return e?U3(e)?e:V0e(e)&&(t=(s=e.ownerDocument)==null?void 0:s.defaultView)!=null?t:window:window}function H0e(e){const{Document:t}=Uh(e);return e instanceof t}function NP(e){return U3(e)?!1:e instanceof Uh(e).HTMLElement}function Y9e(e){return e instanceof Uh(e).SVGElement}function q3(e){return e?U3(e)?e.document:V0e(e)?H0e(e)?e:NP(e)||Y9e(e)?e.ownerDocument:document:document:document}const sx=Fae?A.useLayoutEffect:A.useEffect;function W0e(e){const t=A.useRef(e);return sx(()=>{t.current=e}),A.useCallback(function(){for(var s=arguments.length,n=new Array(s),a=0;a{e.current=setInterval(n,a)},[]),s=A.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,s]}function rI(e,t){t===void 0&&(t=[e]);const s=A.useRef(e);return sx(()=>{s.current!==e&&(s.current=e)},t),s}function SP(e,t){const s=A.useRef();return A.useMemo(()=>{const n=e(s.current);return s.current=n,n},[...t])}function Qre(e){const t=W0e(e),s=A.useRef(null),n=A.useCallback(a=>{a!==s.current&&(t==null||t(a,s.current)),s.current=a},[]);return[s,n]}function _pe(e){const t=A.useRef();return A.useEffect(()=>{t.current=e},[e]),t.current}let Ode={};function CP(e,t){return A.useMemo(()=>{if(t)return t;const s=Ode[e]==null?0:Ode[e]+1;return Ode[e]=s,e+"-"+s},[e,t])}function X9e(e){return function(t){for(var s=arguments.length,n=new Array(s>1?s-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 aC=X9e(1),sI=X9e(-1);function B4t(e){return"clientX"in e&&"clientY"in e}function G0e(e){if(!e)return!1;const{KeyboardEvent:t}=Uh(e.target);return t&&e instanceof t}function $4t(e){if(!e)return!1;const{TouchEvent:t}=Uh(e.target);return t&&e instanceof t}function bpe(e){if($4t(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:s}=e.touches[0];return{x:t,y:s}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:s}=e.changedTouches[0];return{x:t,y:s}}}return B4t(e)?{x:e.clientX,y:e.clientY}:null}const nI=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:s}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(s?Math.round(s):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:s}=e;return"scaleX("+t+") scaleY("+s+")"}},Transform:{toString(e){if(e)return[nI.Translate.toString(e),nI.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:s,easing:n}=e;return t+" "+s+"ms "+n}}}),WSe="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function U4t(e){return e.matches(WSe)?e:e.querySelector(WSe)}const q4t={display:"none"};function V4t(e){let{id:t,value:s}=e;return ut.createElement("div",{id:t,style:q4t},s)}function H4t(e){let{id:t,announcement:s,ariaLiveType:n="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 ut.createElement("div",{id:t,style:a,role:"status","aria-live":n,"aria-atomic":!0},s)}function W4t(){const[e,t]=A.useState("");return{announce:A.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const Q9e=A.createContext(null);function G4t(e){const t=A.useContext(Q9e);A.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function K4t(){const[e]=A.useState(()=>new Set),t=A.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[A.useCallback(n=>{let{type:a,event:o}=n;e.forEach(l=>{var i;return(i=l[a])==null?void 0:i.call(l,o)})},[e]),t]}const Z4t={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. `},Y4t={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:s}=e;return s?"Draggable item "+t.id+" was moved over droppable area "+s.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:s}=e;return s?"Draggable item "+t.id+" was dropped over droppable area "+s.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function X4t(e){let{announcements:t=Y4t,container:s,hiddenTextDescribedById:n,screenReaderInstructions:a=Z4t}=e;const{announce:o,announcement:l}=W4t(),i=CP("DndLiveRegion"),[u,m]=A.useState(!1);if(A.useEffect(()=>{m(!0)},[]),G4t(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=ut.createElement(ut.Fragment,null,ut.createElement(V4t,{id:n,value:a.draggable}),ut.createElement(H4t,{id:i,announcement:l}));return s?Eh.createPortal(x,s):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 Jre(){}function GSe(e,t){return A.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Q4t(){for(var e=arguments.length,t=new Array(e),s=0;s[...t].filter(n=>n!=null),[...t])}const Uf=Object.freeze({x:0,y:0});function J9e(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function eBe(e,t){let{data:{value:s}}=e,{data:{value:n}}=t;return s-n}function J4t(e,t){let{data:{value:s}}=e,{data:{value:n}}=t;return n-s}function KSe(e){let{left:t,top:s,height:n,width:a}=e;return[{x:t,y:s},{x:t+a,y:s},{x:t,y:s+n},{x:t+a,y:s+n}]}function tBe(e,t){if(!e||e.length===0)return null;const[s]=e;return s[t]}function ZSe(e,t,s){return t===void 0&&(t=e.left),s===void 0&&(s=e.top),{x:t+e.width*.5,y:s+e.height*.5}}const eSt=e=>{let{collisionRect:t,droppableRects:s,droppableContainers:n}=e;const a=ZSe(t,t.left,t.top),o=[];for(const l of n){const{id:i}=l,u=s.get(i);if(u){const m=J9e(ZSe(u),a);o.push({id:i,data:{droppableContainer:l,value:m}})}}return o.sort(eBe)},tSt=e=>{let{collisionRect:t,droppableRects:s,droppableContainers:n}=e;const a=KSe(t),o=[];for(const l of n){const{id:i}=l,u=s.get(i);if(u){const m=KSe(u),x=a.reduce((v,b,N)=>v+J9e(m[N],b),0),y=Number((x/4).toFixed(4));o.push({id:i,data:{droppableContainer:l,value:y}})}}return o.sort(eBe)};function rSt(e,t){const s=Math.max(t.top,e.top),n=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-n,i=o-s;if(n{let{collisionRect:t,droppableRects:s,droppableContainers:n}=e;const a=[];for(const o of n){const{id:l}=o,i=s.get(l);if(i){const u=rSt(i,t);u>0&&a.push({id:l,data:{droppableContainer:o,value:u}})}}return a.sort(J4t)};function nSt(e,t,s){return{...e,scaleX:t&&s?t.width/s.width:1,scaleY:t&&s?t.height/s.height:1}}function rBe(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Uf}function aSt(e){return function(s){for(var n=arguments.length,a=new Array(n>1?n-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}),{...s})}}const iSt=aSt(1);function oSt(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 lSt(e,t,s){const n=oSt(t);if(!n)return e;const{scaleX:a,scaleY:o,x:l,y:i}=n,u=e.left-l-(1-a)*parseFloat(s),m=e.top-i-(1-o)*parseFloat(s.slice(s.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 cSt={ignoreTransform:!1};function V3(e,t){t===void 0&&(t=cSt);let s=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:x}=Uh(e).getComputedStyle(e);m&&(s=lSt(s,m,x))}const{top:n,left:a,width:o,height:l,bottom:i,right:u}=s;return{top:n,left:a,width:o,height:l,bottom:i,right:u}}function YSe(e){return V3(e,{ignoreTransform:!0})}function dSt(e){const t=e.innerWidth,s=e.innerHeight;return{top:0,left:0,right:t,bottom:s,width:t,height:s}}function uSt(e,t){return t===void 0&&(t=Uh(e).getComputedStyle(e)),t.position==="fixed"}function hSt(e,t){t===void 0&&(t=Uh(e).getComputedStyle(e));const s=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const o=t[a];return typeof o=="string"?s.test(o):!1})}function zae(e,t){const s=[];function n(a){if(t!=null&&s.length>=t||!a)return s;if(H0e(a)&&a.scrollingElement!=null&&!s.includes(a.scrollingElement))return s.push(a.scrollingElement),s;if(!NP(a)||Y9e(a)||s.includes(a))return s;const o=Uh(e).getComputedStyle(a);return a!==e&&hSt(a,o)&&s.push(a),uSt(a,o)?s:n(a.parentNode)}return e?n(e):s}function sBe(e){const[t]=zae(e,1);return t??null}function Dde(e){return!Fae||!e?null:U3(e)?e:V0e(e)?H0e(e)||e===q3(e).scrollingElement?window:NP(e)?e:null:null}function nBe(e){return U3(e)?e.scrollX:e.scrollLeft}function aBe(e){return U3(e)?e.scrollY:e.scrollTop}function wpe(e){return{x:nBe(e),y:aBe(e)}}var Pd;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Pd||(Pd={}));function iBe(e){return!Fae||!e?!1:e===document.scrollingElement}function oBe(e){const t={x:0,y:0},s=iBe(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-s.width,y:e.scrollHeight-s.height},a=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,l=e.scrollTop>=n.y,i=e.scrollLeft>=n.x;return{isTop:a,isLeft:o,isBottom:l,isRight:i,maxScroll:n,minScroll:t}}const mSt={x:.2,y:.2};function pSt(e,t,s,n,a){let{top:o,left:l,right:i,bottom:u}=s;n===void 0&&(n=10),a===void 0&&(a=mSt);const{isTop:m,isBottom:x,isLeft:y,isRight:v}=oBe(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=Pd.Backward,N.y=n*Math.abs((t.top+k.height-o)/k.height)):!x&&u>=t.bottom-k.height&&(b.y=Pd.Forward,N.y=n*Math.abs((t.bottom-k.height-u)/k.height)),!v&&i>=t.right-k.width?(b.x=Pd.Forward,N.x=n*Math.abs((t.right-k.width-i)/k.width)):!y&&l<=t.left+k.width&&(b.x=Pd.Backward,N.x=n*Math.abs((t.left+k.width-l)/k.width)),{direction:b,speed:N}}function fSt(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:s,right:n,bottom:a}=e.getBoundingClientRect();return{top:t,left:s,right:n,bottom:a,width:e.clientWidth,height:e.clientHeight}}function lBe(e){return e.reduce((t,s)=>aC(t,wpe(s)),Uf)}function gSt(e){return e.reduce((t,s)=>t+nBe(s),0)}function xSt(e){return e.reduce((t,s)=>t+aBe(s),0)}function ySt(e,t){if(t===void 0&&(t=V3),!e)return;const{top:s,left:n,bottom:a,right:o}=t(e);sBe(e)&&(a<=0||o<=0||s>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const vSt=[["x",["left","right"],gSt],["y",["top","bottom"],xSt]];class K0e{constructor(t,s){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 n=zae(s),a=lBe(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,l,i]of vSt)for(const u of l)Object.defineProperty(this,u,{get:()=>{const m=i(n),x=a[o]-m;return this.rect[u]+x},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class tE{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(s=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...s)})},this.target=t}add(t,s,n){var a;(a=this.target)==null||a.addEventListener(t,s,n),this.listeners.push([t,s,n])}}function _St(e){const{EventTarget:t}=Uh(e);return e instanceof t?e:q3(e)}function Rde(e,t){const s=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(s**2+n**2)>t:"x"in t&&"y"in t?s>t.x&&n>t.y:"x"in t?s>t.x:"y"in t?n>t.y:!1}var rp;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(rp||(rp={}));function XSe(e){e.preventDefault()}function bSt(e){e.stopPropagation()}var eo;(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"})(eo||(eo={}));const cBe={start:[eo.Space,eo.Enter],cancel:[eo.Esc],end:[eo.Space,eo.Enter,eo.Tab]},wSt=(e,t)=>{let{currentCoordinates:s}=t;switch(e.code){case eo.Right:return{...s,x:s.x+25};case eo.Left:return{...s,x:s.x-25};case eo.Down:return{...s,y:s.y+25};case eo.Up:return{...s,y:s.y-25}}};class Z0e{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:s}}=t;this.props=t,this.listeners=new tE(q3(s)),this.windowListeners=new tE(Uh(s)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(rp.Resize,this.handleCancel),this.windowListeners.add(rp.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(rp.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:s}=this.props,n=t.node.current;n&&ySt(n),s(Uf)}handleKeyDown(t){if(G0e(t)){const{active:s,context:n,options:a}=this.props,{keyboardCodes:o=cBe,coordinateGetter:l=wSt,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}=n.current,x=m?{x:m.left,y:m.top}:Uf;this.referenceCoordinates||(this.referenceCoordinates=x);const y=l(t,{active:s,context:n.current,currentCoordinates:x});if(y){const v=sI(y,x),b={x:0,y:0},{scrollableAncestors:N}=n.current;for(const k of N){const M=t.code,{isTop:E,isRight:T,isLeft:P,isBottom:R,maxScroll:D,minScroll:U}=oBe(k),q=fSt(k),H={x:Math.min(M===eo.Right?q.right-q.width/2:q.right,Math.max(M===eo.Right?q.left:q.left+q.width/2,y.x)),y:Math.min(M===eo.Down?q.bottom-q.height/2:q.bottom,Math.max(M===eo.Down?q.top:q.top+q.height/2,y.y))},G=M===eo.Right&&!T||M===eo.Left&&!P,Q=M===eo.Down&&!R||M===eo.Up&&!E;if(G&&H.x!==y.x){const ne=k.scrollLeft+v.x,ie=M===eo.Right&&ne<=D.x||M===eo.Left&&ne>=U.x;if(ie&&!v.y){k.scrollTo({left:ne,behavior:i});return}ie?b.x=k.scrollLeft-ne:b.x=M===eo.Right?k.scrollLeft-D.x:k.scrollLeft-U.x,b.x&&k.scrollBy({left:-b.x,behavior:i});break}else if(Q&&H.y!==y.y){const ne=k.scrollTop+v.y,ie=M===eo.Down&&ne<=D.y||M===eo.Up&&ne>=U.y;if(ie&&!v.x){k.scrollTo({top:ne,behavior:i});return}ie?b.y=k.scrollTop-ne:b.y=M===eo.Down?k.scrollTop-D.y:k.scrollTop-U.y,b.y&&k.scrollBy({top:-b.y,behavior:i});break}}this.handleMove(t,aC(sI(y,this.referenceCoordinates),b))}}}handleMove(t,s){const{onMove:n}=this.props;t.preventDefault(),n(s)}handleEnd(t){const{onEnd:s}=this.props;t.preventDefault(),this.detach(),s()}handleCancel(t){const{onCancel:s}=this.props;t.preventDefault(),this.detach(),s()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Z0e.activators=[{eventName:"onKeyDown",handler:(e,t,s)=>{let{keyboardCodes:n=cBe,onActivation:a}=t,{active:o}=s;const{code:l}=e.nativeEvent;if(n.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 QSe(e){return!!(e&&"distance"in e)}function JSe(e){return!!(e&&"delay"in e)}class Y0e{constructor(t,s,n){var a;n===void 0&&(n=_St(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=s;const{event:o}=t,{target:l}=o;this.props=t,this.events=s,this.document=q3(l),this.documentListeners=new tE(this.document),this.listeners=new tE(n),this.windowListeners=new tE(Uh(l)),this.initialCoordinates=(a=bpe(o))!=null?a:Uf,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:s,bypassActivationConstraint:n}}}=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(rp.Resize,this.handleCancel),this.windowListeners.add(rp.DragStart,XSe),this.windowListeners.add(rp.VisibilityChange,this.handleCancel),this.windowListeners.add(rp.ContextMenu,XSe),this.documentListeners.add(rp.Keydown,this.handleKeydown),s){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(JSe(s)){this.timeoutId=setTimeout(this.handleStart,s.delay),this.handlePending(s);return}if(QSe(s)){this.handlePending(s);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,s){const{active:n,onPending:a}=this.props;a(n,t,this.initialCoordinates,s)}handleStart(){const{initialCoordinates:t}=this,{onStart:s}=this.props;t&&(this.activated=!0,this.documentListeners.add(rp.Click,bSt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(rp.SelectionChange,this.removeTextSelection),s(t))}handleMove(t){var s;const{activated:n,initialCoordinates:a,props:o}=this,{onMove:l,options:{activationConstraint:i}}=o;if(!a)return;const u=(s=bpe(t))!=null?s:Uf,m=sI(a,u);if(!n&&i){if(QSe(i)){if(i.tolerance!=null&&Rde(m,i.tolerance))return this.handleCancel();if(Rde(m,i.distance))return this.handleStart()}if(JSe(i)&&Rde(m,i.tolerance))return this.handleCancel();this.handlePending(i,m);return}t.cancelable&&t.preventDefault(),l(u)}handleEnd(){const{onAbort:t,onEnd:s}=this.props;this.detach(),this.activated||t(this.props.active),s()}handleCancel(){const{onAbort:t,onCancel:s}=this.props;this.detach(),this.activated||t(this.props.active),s()}handleKeydown(t){t.code===eo.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const jSt={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class X0e extends Y0e{constructor(t){const{event:s}=t,n=q3(s.target);super(t,jSt,n)}}X0e.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:s}=e,{onActivation:n}=t;return!s.isPrimary||s.button!==0?!1:(n==null||n({event:s}),!0)}}];const kSt={move:{name:"mousemove"},end:{name:"mouseup"}};var jpe;(function(e){e[e.RightClick=2]="RightClick"})(jpe||(jpe={}));class NSt extends Y0e{constructor(t){super(t,kSt,q3(t.event.target))}}NSt.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:s}=e,{onActivation:n}=t;return s.button===jpe.RightClick?!1:(n==null||n({event:s}),!0)}}];const Fde={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class SSt extends Y0e{constructor(t){super(t,Fde)}static setup(){return window.addEventListener(Fde.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Fde.move.name,t)};function t(){}}}SSt.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:s}=e,{onActivation:n}=t;const{touches:a}=s;return a.length>1?!1:(n==null||n({event:s}),!0)}}];var rE;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(rE||(rE={}));var ese;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ese||(ese={}));function CSt(e){let{acceleration:t,activator:s=rE.Pointer,canScroll:n,draggingRect:a,enabled:o,interval:l=5,order:i=ese.TreeOrder,pointerCoordinates:u,scrollableAncestors:m,scrollableAncestorRects:x,delta:y,threshold:v}=e;const b=TSt({delta:y,disabled:!o}),[N,k]=z4t(),M=A.useRef({x:0,y:0}),E=A.useRef({x:0,y:0}),T=A.useMemo(()=>{switch(s){case rE.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case rE.DraggableRect:return a}},[s,a,u]),P=A.useRef(null),R=A.useCallback(()=>{const U=P.current;if(!U)return;const q=M.current.x*E.current.x,H=M.current.y*E.current.y;U.scrollBy(q,H)},[]),D=A.useMemo(()=>i===ese.TreeOrder?[...m].reverse():m,[i,m]);A.useEffect(()=>{if(!o||!m.length||!T){k();return}for(const U of D){if((n==null?void 0:n(U))===!1)continue;const q=m.indexOf(U),H=x[q];if(!H)continue;const{direction:G,speed:Q}=pSt(U,H,T,t,v);for(const ne of["x","y"])b[ne][G[ne]]||(Q[ne]=0,G[ne]=0);if(Q.x>0||Q.y>0){k(),P.current=U,N(R,l),M.current=Q,E.current=G;return}}M.current={x:0,y:0},E.current={x:0,y:0},k()},[t,R,n,k,o,l,JSON.stringify(T),JSON.stringify(b),N,m,D,x,JSON.stringify(v)])}const MSt={x:{[Pd.Backward]:!1,[Pd.Forward]:!1},y:{[Pd.Backward]:!1,[Pd.Forward]:!1}};function TSt(e){let{delta:t,disabled:s}=e;const n=_pe(t);return SP(a=>{if(s||!n||!a)return MSt;const o={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[Pd.Backward]:a.x[Pd.Backward]||o.x===-1,[Pd.Forward]:a.x[Pd.Forward]||o.x===1},y:{[Pd.Backward]:a.y[Pd.Backward]||o.y===-1,[Pd.Forward]:a.y[Pd.Forward]||o.y===1}}},[s,t,n])}function ASt(e,t){const s=t!=null?e.get(t):void 0,n=s?s.node.current:null;return SP(a=>{var o;return t==null?null:(o=n??a)!=null?o:null},[n,t])}function ESt(e,t){return A.useMemo(()=>e.reduce((s,n)=>{const{sensor:a}=n,o=a.activators.map(l=>({eventName:l.eventName,handler:t(l.handler,n)}));return[...s,...o]},[]),[e,t])}var aI;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(aI||(aI={}));var kpe;(function(e){e.Optimized="optimized"})(kpe||(kpe={}));const eCe=new Map;function ISt(e,t){let{dragging:s,dependencies:n,config:a}=t;const[o,l]=A.useState(null),{frequency:i,measure:u,strategy:m}=a,x=A.useRef(e),y=M(),v=rI(y),b=A.useCallback(function(E){E===void 0&&(E=[]),!v.current&&l(T=>T===null?E:T.concat(E.filter(P=>!T.includes(P))))},[v]),N=A.useRef(null),k=SP(E=>{if(y&&!s)return eCe;if(!E||E===eCe||x.current!==e||o!=null){const T=new Map;for(let P of e){if(!P)continue;if(o&&o.length>0&&!o.includes(P.id)&&P.rect.current){T.set(P.id,P.rect.current);continue}const R=P.node.current,D=R?new K0e(u(R),R):null;P.rect.current=D,D&&T.set(P.id,D)}return T}return E},[e,o,s,y,u]);return A.useEffect(()=>{x.current=e},[e]),A.useEffect(()=>{y||b()},[s,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,...n]),{droppableRects:k,measureDroppableContainers:b,measuringScheduled:o!=null};function M(){switch(m){case aI.Always:return!1;case aI.BeforeDragging:return s;default:return!s}}}function dBe(e,t){return SP(s=>e?s||(typeof t=="function"?t(e):e):null,[t,e])}function PSt(e,t){return dBe(e,t)}function LSt(e){let{callback:t,disabled:s}=e;const n=W0e(t),a=A.useMemo(()=>{if(s||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(n)},[n,s]);return A.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function Bae(e){let{callback:t,disabled:s}=e;const n=W0e(t),a=A.useMemo(()=>{if(s||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(n)},[s]);return A.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function OSt(e){return new K0e(V3(e),e)}function tCe(e,t,s){t===void 0&&(t=OSt);const[n,a]=A.useState(null);function o(){a(u=>{if(!e)return null;if(e.isConnected===!1){var m;return(m=u??s)!=null?m:null}const x=t(e);return JSON.stringify(u)===JSON.stringify(x)?u:x})}const l=LSt({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=Bae({callback:o});return sx(()=>{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]),n}function DSt(e){const t=dBe(e);return rBe(e,t)}const rCe=[];function RSt(e){const t=A.useRef(e),s=SP(n=>e?n&&n!==rCe&&e&&t.current&&e.parentNode===t.current.parentNode?n:zae(e):rCe,[e]);return A.useEffect(()=>{t.current=e},[e]),s}function FSt(e){const[t,s]=A.useState(null),n=A.useRef(e),a=A.useCallback(o=>{const l=Dde(o.target);l&&s(i=>i?(i.set(l,wpe(l)),new Map(i)):null)},[]);return A.useEffect(()=>{const o=n.current;if(e!==o){l(o);const i=e.map(u=>{const m=Dde(u);return m?(m.addEventListener("scroll",a,{passive:!0}),[m,wpe(m)]):null}).filter(u=>u!=null);s(i.length?new Map(i):null),n.current=e}return()=>{l(e),l(o)};function l(i){i.forEach(u=>{const m=Dde(u);m==null||m.removeEventListener("scroll",a)})}},[a,e]),A.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,l)=>aC(o,l),Uf):lBe(e):Uf,[e,t])}function sCe(e,t){t===void 0&&(t=[]);const s=A.useRef(null);return A.useEffect(()=>{s.current=null},t),A.useEffect(()=>{const n=e!==Uf;n&&!s.current&&(s.current=e),!n&&s.current&&(s.current=null)},[e]),s.current?sI(e,s.current):Uf}function zSt(e){A.useEffect(()=>{if(!Fae)return;const t=e.map(s=>{let{sensor:n}=s;return n.setup==null?void 0:n.setup()});return()=>{for(const s of t)s==null||s()}},e.map(t=>{let{sensor:s}=t;return s}))}function BSt(e,t){return A.useMemo(()=>e.reduce((s,n)=>{let{eventName:a,handler:o}=n;return s[a]=l=>{o(l,t)},s},{}),[e,t])}function uBe(e){return A.useMemo(()=>e?dSt(e):null,[e])}const nCe=[];function $St(e,t){t===void 0&&(t=V3);const[s]=e,n=uBe(s?Uh(s):null),[a,o]=A.useState(nCe);function l(){o(()=>e.length?e.map(u=>iBe(u)?n:new K0e(t(u),u)):nCe)}const i=Bae({callback:l});return sx(()=>{i==null||i.disconnect(),l(),e.forEach(u=>i==null?void 0:i.observe(u))},[e]),a}function USt(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return NP(t)?t:e}function qSt(e){let{measure:t}=e;const[s,n]=A.useState(null),a=A.useCallback(m=>{for(const{target:x}of m)if(NP(x)){n(y=>{const v=t(x);return y?{...y,width:v.width,height:v.height}:v});break}},[t]),o=Bae({callback:a}),l=A.useCallback(m=>{const x=USt(m);o==null||o.disconnect(),x&&(o==null||o.observe(x)),n(x?t(x):null)},[t,o]),[i,u]=Qre(l);return A.useMemo(()=>({nodeRef:i,rect:s,setRef:u}),[s,i,u])}const VSt=[{sensor:X0e,options:{}},{sensor:Z0e,options:{}}],HSt={current:{}},tte={draggable:{measure:YSe},droppable:{measure:YSe,strategy:aI.WhileDragging,frequency:kpe.Optimized},dragOverlay:{measure:V3}};class sE extends Map{get(t){var s;return t!=null&&(s=super.get(t))!=null?s:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:s}=t;return!s})}getNodeFor(t){var s,n;return(s=(n=this.get(t))==null?void 0:n.node.current)!=null?s:void 0}}const WSt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new sE,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Jre},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:tte,measureDroppableContainers:Jre,windowRect:null,measuringScheduled:!1},GSt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Jre,draggableNodes:new Map,over:null,measureDroppableContainers:Jre},$ae=A.createContext(GSt),hBe=A.createContext(WSt);function KSt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new sE}}}function ZSt(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:s}=t,{id:n}=s,a=new sE(e.droppable.containers);return a.set(n,s),{...e,droppable:{...e.droppable,containers:a}}}case ad.SetDroppableDisabled:{const{id:s,key:n,disabled:a}=t,o=e.droppable.containers.get(s);if(!o||n!==o.key)return e;const l=new sE(e.droppable.containers);return l.set(s,{...o,disabled:a}),{...e,droppable:{...e.droppable,containers:l}}}case ad.UnregisterDroppable:{const{id:s,key:n}=t,a=e.droppable.containers.get(s);if(!a||n!==a.key)return e;const o=new sE(e.droppable.containers);return o.delete(s),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function YSt(e){let{disabled:t}=e;const{active:s,activatorEvent:n,draggableNodes:a}=A.useContext($ae),o=_pe(n),l=_pe(s==null?void 0:s.id);return A.useEffect(()=>{if(!t&&!n&&o&&l!=null){if(!G0e(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=U4t(x);if(y){y.focus();break}}})}},[n,t,a,l,o]),null}function XSt(e,t){let{transform:s,...n}=t;return e!=null&&e.length?e.reduce((a,o)=>o({transform:a,...n}),s):s}function QSt(e){return A.useMemo(()=>({draggable:{...tte.draggable,...e==null?void 0:e.draggable},droppable:{...tte.droppable,...e==null?void 0:e.droppable},dragOverlay:{...tte.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 JSt(e){let{activeNode:t,measure:s,initialRect:n,config:a=!0}=e;const o=A.useRef(!1),{x:l,y:i}=typeof a=="boolean"?{x:a,y:a}:a;sx(()=>{if(!l&&!i||!t){o.current=!1;return}if(o.current||!n)return;const m=t==null?void 0:t.node.current;if(!m||m.isConnected===!1)return;const x=s(m),y=rBe(x,n);if(l||(y.x=0),i||(y.y=0),o.current=!0,Math.abs(y.x)>0||Math.abs(y.y)>0){const v=sBe(m);v&&v.scrollBy({top:y.y,left:y.x})}},[t,l,i,n,s])}const mBe=A.createContext({...Uf,scaleX:1,scaleY:1});var n1;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(n1||(n1={}));const eCt=A.memo(function(t){var s,n,a,o;let{id:l,accessibility:i,autoScroll:u=!0,children:m,sensors:x=VSt,collisionDetection:y=sSt,measuring:v,modifiers:b,...N}=t;const k=A.useReducer(ZSt,void 0,KSt),[M,E]=k,[T,P]=K4t(),[R,D]=A.useState(n1.Uninitialized),U=R===n1.Initialized,{draggable:{active:q,nodes:H,translate:G},droppable:{containers:Q}}=M,ne=q!=null?H.get(q):null,ie=A.useRef({initial:null,translated:null}),he=A.useMemo(()=>{var Ga;return q!=null?{id:q,data:(Ga=ne==null?void 0:ne.data)!=null?Ga:HSt,rect:ie}:null},[q,ne]),se=A.useRef(null),[fe,oe]=A.useState(null),[ce,de]=A.useState(null),xe=rI(N,Object.values(N)),Me=CP("DndDescribedBy",l),ve=A.useMemo(()=>Q.getEnabled(),[Q]),be=QSt(v),{droppableRects:we,measureDroppableContainers:tt,measuringScheduled:Ae}=ISt(ve,{dragging:U,dependencies:[G.x,G.y],config:be.droppable}),Le=ASt(H,q),Ue=A.useMemo(()=>ce?bpe(ce):null,[ce]),Pe=Ao(),$e=PSt(Le,be.draggable.measure);JSt({activeNode:q!=null?H.get(q):null,config:Pe.layoutShiftCompensation,initialRect:$e,measure:be.draggable.measure});const it=tCe(Le,be.draggable.measure,$e),xt=tCe(Le?Le.parentElement:null),Ee=A.useRef({activatorEvent:null,active:null,activeNode:Le,collisionRect:null,collisions:null,droppableRects:we,draggableNodes:H,draggingNode:null,draggingNodeRect:null,droppableContainers:Q,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),et=Q.getNodeFor((s=Ee.current.over)==null?void 0:s.id),le=qSt({measure:be.dragOverlay.measure}),Ve=(n=le.nodeRef.current)!=null?n:Le,Je=U?(a=le.rect)!=null?a:it:null,rt=!!(le.nodeRef.current&&le.rect),je=DSt(rt?null:it),lt=uBe(Ve?Uh(Ve):null),Ce=RSt(U?et??Le:null),Ie=$St(Ce),Ze=XSt(b,{transform:{x:G.x-je.x,y:G.y-je.y,scaleX:1,scaleY:1},activatorEvent:ce,active:he,activeNodeRect:it,containerNodeRect:xt,draggingNodeRect:Je,over:Ee.current.over,overlayNodeRect:le.rect,scrollableAncestors:Ce,scrollableAncestorRects:Ie,windowRect:lt}),De=Ue?aC(Ue,G):null,Ke=FSt(Ce),st=sCe(Ke),dt=sCe(Ke,[it]),ct=aC(Ze,st),zt=Je?iSt(Je,Ze):null,ir=he&&zt?y({active:he,collisionRect:zt,droppableRects:we,droppableContainers:ve,pointerCoordinates:De}):null,Tr=tBe(ir,"id"),[Zr,$r]=A.useState(null),ns=rt?Ze:aC(Ze,dt),Xs=nSt(ns,(o=Zr==null?void 0:Zr.rect)!=null?o:null,it),Ot=A.useRef(null),Hr=A.useCallback((Ga,mn)=>{let{sensor:na,options:pn}=mn;if(se.current==null)return;const Jn=H.get(se.current);if(!Jn)return;const $n=Ga.nativeEvent,Ci=new na({active:se.current,activeNode:Jn,event:$n,options:pn,context:Ee,onAbort(La){if(!H.get(La))return;const{onDragAbort:Ni}=xe.current,Ws={id:La};Ni==null||Ni(Ws),T({type:"onDragAbort",event:Ws})},onPending(La,co,Ni,Ws){if(!H.get(La))return;const{onDragPending:mc}=xe.current,bo={id:La,constraint:co,initialCoordinates:Ni,offset:Ws};mc==null||mc(bo),T({type:"onDragPending",event:bo})},onStart(La){const co=se.current;if(co==null)return;const Ni=H.get(co);if(!Ni)return;const{onDragStart:Ws}=xe.current,Yi={activatorEvent:$n,active:{id:co,data:Ni.data,rect:ie}};Eh.unstable_batchedUpdates(()=>{Ws==null||Ws(Yi),D(n1.Initializing),E({type:ad.DragStart,initialCoordinates:La,active:co}),T({type:"onDragStart",event:Yi}),oe(Ot.current),de($n)})},onMove(La){E({type:ad.DragMove,coordinates:La})},onEnd:or(ad.DragEnd),onCancel:or(ad.DragCancel)});Ot.current=Ci;function or(La){return async function(){const{active:Ni,collisions:Ws,over:Yi,scrollAdjustedTranslate:mc}=Ee.current;let bo=null;if(Ni&&mc){const{cancelDrop:pc}=xe.current;bo={activatorEvent:$n,active:Ni,collisions:Ws,delta:mc,over:Yi},La===ad.DragEnd&&typeof pc=="function"&&await Promise.resolve(pc(bo))&&(La=ad.DragCancel)}se.current=null,Eh.unstable_batchedUpdates(()=>{E({type:La}),D(n1.Uninitialized),$r(null),oe(null),de(null),Ot.current=null;const pc=La===ad.DragEnd?"onDragEnd":"onDragCancel";if(bo){const nt=xe.current[pc];nt==null||nt(bo),T({type:pc,event:bo})}})}}},[H]),Ts=A.useCallback((Ga,mn)=>(na,pn)=>{const Jn=na.nativeEvent,$n=H.get(pn);if(se.current!==null||!$n||Jn.dndKit||Jn.defaultPrevented)return;const Ci={active:$n};Ga(na,mn.options,Ci)===!0&&(Jn.dndKit={capturedBy:mn.sensor},se.current=pn,Hr(na,mn))},[H,Hr]),zs=ESt(x,Ts);zSt(x),sx(()=>{it&&R===n1.Initializing&&D(n1.Initialized)},[it,R]),A.useEffect(()=>{const{onDragMove:Ga}=xe.current,{active:mn,activatorEvent:na,collisions:pn,over:Jn}=Ee.current;if(!mn||!na)return;const $n={active:mn,activatorEvent:na,collisions:pn,delta:{x:ct.x,y:ct.y},over:Jn};Eh.unstable_batchedUpdates(()=>{Ga==null||Ga($n),T({type:"onDragMove",event:$n})})},[ct.x,ct.y]),A.useEffect(()=>{const{active:Ga,activatorEvent:mn,collisions:na,droppableContainers:pn,scrollAdjustedTranslate:Jn}=Ee.current;if(!Ga||se.current==null||!mn||!Jn)return;const{onDragOver:$n}=xe.current,Ci=pn.get(Tr),or=Ci&&Ci.rect.current?{id:Ci.id,rect:Ci.rect.current,data:Ci.data,disabled:Ci.disabled}:null,La={active:Ga,activatorEvent:mn,collisions:na,delta:{x:Jn.x,y:Jn.y},over:or};Eh.unstable_batchedUpdates(()=>{$r(or),$n==null||$n(La),T({type:"onDragOver",event:La})})},[Tr]),sx(()=>{Ee.current={activatorEvent:ce,active:he,activeNode:Le,collisionRect:zt,collisions:ir,droppableRects:we,draggableNodes:H,draggingNode:Ve,draggingNodeRect:Je,droppableContainers:Q,over:Zr,scrollableAncestors:Ce,scrollAdjustedTranslate:ct},ie.current={initial:Je,translated:zt}},[he,Le,ir,zt,H,Ve,Je,we,Q,Zr,Ce,ct]),CSt({...Pe,delta:G,draggingRect:zt,pointerCoordinates:De,scrollableAncestors:Ce,scrollableAncestorRects:Ie});const wa=A.useMemo(()=>({active:he,activeNode:Le,activeNodeRect:it,activatorEvent:ce,collisions:ir,containerNodeRect:xt,dragOverlay:le,draggableNodes:H,droppableContainers:Q,droppableRects:we,over:Zr,measureDroppableContainers:tt,scrollableAncestors:Ce,scrollableAncestorRects:Ie,measuringConfiguration:be,measuringScheduled:Ae,windowRect:lt}),[he,Le,it,ce,ir,xt,le,H,Q,we,Zr,tt,Ce,Ie,be,Ae,lt]),gi=A.useMemo(()=>({activatorEvent:ce,activators:zs,active:he,activeNodeRect:it,ariaDescribedById:{draggable:Me},dispatch:E,draggableNodes:H,over:Zr,measureDroppableContainers:tt}),[ce,zs,he,it,E,Me,H,Zr,tt]);return ut.createElement(Q9e.Provider,{value:P},ut.createElement($ae.Provider,{value:gi},ut.createElement(hBe.Provider,{value:wa},ut.createElement(mBe.Provider,{value:Xs},m)),ut.createElement(YSt,{disabled:(i==null?void 0:i.restoreFocus)===!1})),ut.createElement(X4t,{...i,hiddenTextDescribedById:Me}));function Ao(){const Ga=(fe==null?void 0:fe.autoScrollEnabled)===!1,mn=typeof u=="object"?u.enabled===!1:u===!1,na=U&&!Ga&&!mn;return typeof u=="object"?{...u,enabled:na}:{enabled:na}}}),tCt=A.createContext(null),aCe="button",rCt="Draggable";function sCt(e){let{id:t,data:s,disabled:n=!1,attributes:a}=e;const o=CP(rCt),{activators:l,activatorEvent:i,active:u,activeNodeRect:m,ariaDescribedById:x,draggableNodes:y,over:v}=A.useContext($ae),{role:b=aCe,roleDescription:N="draggable",tabIndex:k=0}=a??{},M=(u==null?void 0:u.id)===t,E=A.useContext(M?mBe:tCt),[T,P]=Qre(),[R,D]=Qre(),U=BSt(l,t),q=rI(s);sx(()=>(y.set(t,{id:t,key:o,node:T,activatorNode:R,data:q}),()=>{const G=y.get(t);G&&G.key===o&&y.delete(t)}),[y,t]);const H=A.useMemo(()=>({role:b,tabIndex:k,"aria-disabled":n,"aria-pressed":M&&b===aCe?!0:void 0,"aria-roledescription":N,"aria-describedby":x.draggable}),[n,b,k,M,N,x.draggable]);return{active:u,activatorEvent:i,activeNodeRect:m,attributes:H,isDragging:M,listeners:n?void 0:U,node:T,over:v,setNodeRef:P,setActivatorNodeRef:D,transform:E}}function nCt(){return A.useContext(hBe)}const aCt="Droppable",iCt={timeout:25};function oCt(e){let{data:t,disabled:s=!1,id:n,resizeObserverConfig:a}=e;const o=CP(aCt),{active:l,dispatch:i,over:u,measureDroppableContainers:m}=A.useContext($ae),x=A.useRef({disabled:s}),y=A.useRef(!1),v=A.useRef(null),b=A.useRef(null),{disabled:N,updateMeasurementsFor:k,timeout:M}={...iCt,...a},E=rI(k??n),T=A.useCallback(()=>{if(!y.current){y.current=!0;return}b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{m(Array.isArray(E.current)?E.current:[E.current]),b.current=null},M)},[M]),P=Bae({callback:T,disabled:N||!l}),R=A.useCallback((H,G)=>{P&&(G&&(P.unobserve(G),y.current=!1),H&&P.observe(H))},[P]),[D,U]=Qre(R),q=rI(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:n,key:o,disabled:s,node:D,rect:v,data:q}}),()=>i({type:ad.UnregisterDroppable,key:o,id:n})),[n]),A.useEffect(()=>{s!==x.current.disabled&&(i({type:ad.SetDroppableDisabled,id:n,key:o,disabled:s}),x.current.disabled=s)},[n,o,s,i]),{active:l,rect:v,isOver:(u==null?void 0:u.id)===n,node:D,over:u,setNodeRef:U}}function Q0e(e,t,s){const n=e.slice();return n.splice(s<0?n.length+s:s,0,n.splice(t,1)[0]),n}function lCt(e,t){return e.reduce((s,n,a)=>{const o=t.get(n);return o&&(s[a]=o),s},Array(e.length))}function IO(e){return e!==null&&e>=0}function cCt(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let s=0;s{let{rects:t,activeIndex:s,overIndex:n,index:a}=e;const o=Q0e(t,n,s),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}},pBe="Sortable",fBe=ut.createContext({activeIndex:-1,containerId:pBe,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:J0e,disabled:{draggable:!1,droppable:!1}});function uCt(e){let{children:t,id:s,items:n,strategy:a=J0e,disabled:o=!1}=e;const{active:l,dragOverlay:i,droppableRects:u,over:m,measureDroppableContainers:x}=nCt(),y=CP(pBe,s),v=i.rect!==null,b=A.useMemo(()=>n.map(U=>typeof U=="object"&&"id"in U?U.id:U),[n]),N=l!=null,k=l?b.indexOf(l.id):-1,M=m?b.indexOf(m.id):-1,E=A.useRef(b),T=!cCt(b,E.current),P=M!==-1&&k===-1||T,R=dCt(o);sx(()=>{T&&N&&x(b)},[T,b,N,x]),A.useEffect(()=>{E.current=b},[b]);const D=A.useMemo(()=>({activeIndex:k,containerId:y,disabled:R,disableTransforms:P,items:b,overIndex:M,useDragOverlay:v,sortedRects:lCt(b,u),strategy:a}),[k,y,R.draggable,R.droppable,P,b,M,u,v,a]);return ut.createElement(fBe.Provider,{value:D},t)}const hCt=e=>{let{id:t,items:s,activeIndex:n,overIndex:a}=e;return Q0e(s,n,a).indexOf(t)},mCt=e=>{let{containerId:t,isSorting:s,wasDragging:n,index:a,items:o,newIndex:l,previousItems:i,previousContainerId:u,transition:m}=e;return!m||!n||i!==o&&a===l?!1:s?!0:l!==a&&t===u},pCt={duration:200,easing:"ease"},gBe="transform",fCt=nI.Transition.toString({property:gBe,duration:0,easing:"linear"}),gCt={roleDescription:"sortable"};function xCt(e){let{disabled:t,index:s,node:n,rect:a}=e;const[o,l]=A.useState(null),i=A.useRef(s);return sx(()=>{if(!t&&s!==i.current&&n.current){const u=a.current;if(u){const m=V3(n.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)}}s!==i.current&&(i.current=s)},[t,s,n,a]),A.useEffect(()=>{o&&l(null)},[o]),o}function yCt(e){let{animateLayoutChanges:t=mCt,attributes:s,disabled:n,data:a,getNewIndex:o=hCt,id:l,strategy:i,resizeObserverConfig:u,transition:m=pCt}=e;const{items:x,containerId:y,activeIndex:v,disabled:b,disableTransforms:N,sortedRects:k,overIndex:M,useDragOverlay:E,strategy:T}=A.useContext(fBe),P=vCt(n,b),R=x.indexOf(l),D=A.useMemo(()=>({sortable:{containerId:y,index:R,items:x},...a}),[y,a,R,x]),U=A.useMemo(()=>x.slice(x.indexOf(l)),[x,l]),{rect:q,node:H,isOver:G,setNodeRef:Q}=oCt({id:l,data:D,disabled:P.droppable,resizeObserverConfig:{updateMeasurementsFor:U,...u}}),{active:ne,activatorEvent:ie,activeNodeRect:he,attributes:se,setNodeRef:fe,listeners:oe,isDragging:ce,over:de,setActivatorNodeRef:xe,transform:Me}=sCt({id:l,data:D,attributes:{...gCt,...s},disabled:P.draggable}),ve=F4t(Q,fe),be=!!ne,we=be&&!N&&IO(v)&&IO(M),tt=!E&&ce,Ae=tt&&we?Me:null,Ue=we?Ae??(i??T)({rects:k,activeNodeRect:he,activeIndex:v,overIndex:M,index:R}):null,Pe=IO(v)&&IO(M)?o({id:l,items:x,activeIndex:v,overIndex:M}):R,$e=ne==null?void 0:ne.id,it=A.useRef({activeId:$e,items:x,newIndex:Pe,containerId:y}),xt=x!==it.current.items,Ee=t({active:ne,containerId:y,isDragging:ce,isSorting:be,id:l,index:R,items:x,newIndex:it.current.newIndex,previousItems:it.current.items,previousContainerId:it.current.containerId,transition:m,wasDragging:it.current.activeId!=null}),et=xCt({disabled:!Ee,index:R,node:H,rect:q});return A.useEffect(()=>{be&&it.current.newIndex!==Pe&&(it.current.newIndex=Pe),y!==it.current.containerId&&(it.current.containerId=y),x!==it.current.items&&(it.current.items=x)},[be,Pe,y,x]),A.useEffect(()=>{if($e===it.current.activeId)return;if($e!=null&&it.current.activeId==null){it.current.activeId=$e;return}const Ve=setTimeout(()=>{it.current.activeId=$e},50);return()=>clearTimeout(Ve)},[$e]),{active:ne,activeIndex:v,attributes:se,data:D,rect:q,index:R,newIndex:Pe,items:x,isOver:G,isSorting:be,isDragging:ce,listeners:oe,node:H,overIndex:M,over:de,setNodeRef:ve,setActivatorNodeRef:xe,setDroppableNodeRef:Q,setDraggableNodeRef:fe,transform:et??Ue,transition:le()};function le(){if(et||xt&&it.current.newIndex===R)return fCt;if(!(tt&&!G0e(ie)||!m)&&(be||Ee))return nI.Transition.toString({...m,property:gBe})}}function vCt(e,t){var s,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(s=e==null?void 0:e.draggable)!=null?s:t.draggable,droppable:(n=e==null?void 0:e.droppable)!=null?n:t.droppable}}function tse(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 _Ct=[eo.Down,eo.Right,eo.Up,eo.Left],bCt=(e,t)=>{let{context:{active:s,collisionRect:n,droppableRects:a,droppableContainers:o,over:l,scrollableAncestors:i}}=t;if(_Ct.includes(e.code)){if(e.preventDefault(),!s||!n)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 eo.Down:n.topv.top&&u.push(y);break;case eo.Left:n.left>v.left&&u.push(y);break;case eo.Right:n.left1&&(x=m[1].id),x!=null){const y=o.get(s.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=zae(N).some((U,q)=>i[q]!==U),E=xBe(y,v),T=wCt(y,v),P=M||!E?{x:0,y:0}:{x:T?n.width-b.width:0,y:T?n.height-b.height:0},R={x:b.left,y:b.top};return P.x&&P.y?R:sI(R,P)}}}};function xBe(e,t){return!tse(e)||!tse(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function wCt(e,t){return!tse(e)||!tse(t)||!xBe(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:()=>s(e),children:r.jsx(Bs,{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(jn,{className:"h-2.5 w-2.5"}),rs(new Date(e.post_date+"T00:00:00"),"MMM d")]})})]}),r.jsxs(Xe,{className:"p-3 space-y-2",children:[r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-3",children:e.caption}),r.jsxs(Kc,{children:[r.jsx(Zc,{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(jn,{className:"h-3 w-3"}),e.post_date?rs(new Date(e.post_date+"T00:00:00"),"MMM d, yyyy"):"Set post date"]})}),r.jsxs(Ac,{className:"w-auto p-0",align:"start",children:[r.jsx(Df,{mode:"single",selected:e.post_date?new Date(e.post_date+"T00:00:00"):void 0,onSelect:y=>n(e.id,y?rs(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:()=>n(e.id,null),children:"Clear date"})})]})]})]})]})})}const kCt=()=>{const e=Br(),[t,s]=A.useState("all"),[n,a]=A.useState(!1),[o,l]=A.useState(rs(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(""),[E,T]=A.useState(null),[P,R]=A.useState(!1),[D,U]=A.useState(!1),[q,H]=A.useState(rs(new Date,"yyyy-MM")),[G,Q]=A.useState(null),[ne,ie]=A.useState(""),[he,se]=A.useState(""),[fe,oe]=A.useState(""),[ce,de]=A.useState(!1),xe=Q4t(GSe(X0e,{activationConstraint:{distance:5}}),GSe(Z0e,{coordinateGetter:bCt})),{data:Me=[],isLoading:ve}=Kt({queryKey:["admin-social-swag-2"],queryFn:async()=>{const{data:De,error:Ke}=await Y.from("social_swag_2").select("*").order("month",{ascending:!1}).order("sort_order");if(Ke)throw Ke;return De}}),{data:be=[]}=Kt({queryKey:["admin-social-swag-2-months"],queryFn:async()=>{const{data:De,error:Ke}=await Y.from("social_swag_2_months").select("*").order("month",{ascending:!1});if(Ke)throw Ke;return De}}),{data:we=[]}=Kt({queryKey:["admin-social-swag-2-reels"],queryFn:async()=>{const{data:De,error:Ke}=await Y.from("social_swag_2_reels").select("*").order("month",{ascending:!1});if(Ke)throw Ke;return De}}),tt=[...new Set(Me.map(De=>De.month))].sort((De,Ke)=>Ke.localeCompare(De)),Ae=t==="all"?Me:Me.filter(De=>De.month===t),Le=De=>{const Ke=hye(De,"yyyy-MM",new Date);return rs(Ke,"MMMM yyyy")},Ue=De=>{N(De),M(De.caption),T(De.post_date)},Pe=async()=>{if(b){R(!0);try{const{error:De}=await Y.from("social_swag_2").update({caption:k,post_date:E}).eq("id",b.id);if(De)throw De;Te.success("Image updated"),N(null),e.invalidateQueries({queryKey:["admin-social-swag-2"]}),e.invalidateQueries({queryKey:["social-swag-2"]})}catch{Te.error("Failed to update image")}finally{R(!1)}}},$e=async De=>{const{active:Ke,over:st}=De;if(!st||Ke.id===st.id)return;const dt=Ae,ct=dt.findIndex(Tr=>Tr.id===Ke.id),zt=dt.findIndex(Tr=>Tr.id===st.id);if(ct===-1||zt===-1)return;const ir=Q0e(dt,ct,zt);e.setQueryData(["admin-social-swag-2"],Tr=>{if(!Tr)return Tr;const Zr={};return ir.forEach(($r,ns)=>{Zr[$r.id]=ns}),Tr.map($r=>Zr[$r.id]!==void 0?{...$r,sort_order:Zr[$r.id]}:$r).sort(($r,ns)=>$r.month!==ns.month?ns.month.localeCompare($r.month):$r.sort_order-ns.sort_order)});try{await Promise.all(ir.map((Tr,Zr)=>Y.from("social_swag_2").update({sort_order:Zr}).eq("id",Tr.id)))}catch{Te.error("Failed to save order"),e.invalidateQueries({queryKey:["admin-social-swag-2"]})}},it=De=>{const st=Array.from(De.target.files||[]).slice(0,16-i.length).map(dt=>({file:dt,preview:URL.createObjectURL(dt),caption:""}));u(dt=>[...dt,...st].slice(0,16))},xt=De=>{u(Ke=>{const st=[...Ke];return URL.revokeObjectURL(st[De].preview),st.splice(De,1),st})},Ee=(De,Ke)=>{u(st=>{const dt=[...st];return dt[De]={...dt[De],caption:Ke},dt})},et=async()=>{if(i.length===0){Te.error("Please add at least one image");return}if(i.filter(Ke=>!Ke.caption.trim()).length>0){Te.error("Please add captions to all images");return}x(!0);try{for(let Ke=0;Ke{const Ke=De.image_url.split("/social-swag-2/");Ke[1]&&await Y.storage.from("social-swag-2").remove([Ke[1]]);const{error:st}=await Y.from("social_swag_2").delete().eq("id",De.id);if(st)throw st},onSuccess:()=>{Te.success("Image deleted"),e.invalidateQueries({queryKey:["admin-social-swag-2"]})},onError:()=>Te.error("Failed to delete image")}),Ve=ar({mutationFn:async({id:De,postDate:Ke})=>{const{error:st}=await Y.from("social_swag_2").update({post_date:Ke}).eq("id",De);if(st)throw st},onSuccess:()=>{Te.success("Post date updated"),e.invalidateQueries({queryKey:["admin-social-swag-2"]}),e.invalidateQueries({queryKey:["social-swag-2"]})},onError:()=>Te.error("Failed to update post date")}),Je=ar({mutationFn:async({month:De,link:Ke})=>{const{error:st}=await Y.from("social_swag_2_months").upsert({month:De,canva_link:Ke||null},{onConflict:"month"});if(st)throw st},onSuccess:()=>{Te.success("Canva link updated"),v(null),e.invalidateQueries({queryKey:["admin-social-swag-2-months"]})},onError:()=>Te.error("Failed to update Canva link")}),rt=De=>{var Ke;return((Ke=be.find(st=>st.month===De))==null?void 0:Ke.canva_link)||""},je=De=>we.find(Ke=>Ke.month===De)||null,lt=De=>{var st;const Ke=(st=De.target.files)==null?void 0:st[0];Ke&&(Q(Ke),ie(URL.createObjectURL(Ke)))},Ce=()=>{ne&&URL.revokeObjectURL(ne),Q(null),ie(""),se(""),oe("")},Ie=async()=>{if(!G){Te.error("Please select an image");return}de(!0);try{const De=G.name.split(".").pop(),Ke=`reels/${q}-${Date.now()}.${De}`,{error:st}=await Y.storage.from("social-swag-2").upload(Ke,G);if(st)throw st;const{data:{publicUrl:dt}}=Y.storage.from("social-swag-2").getPublicUrl(Ke),{error:ct}=await Y.from("social_swag_2_reels").upsert({month:q,image_url:dt,canva_link:fe||null,caption:he||null},{onConflict:"month"});if(ct)throw ct;Te.success("Reel uploaded successfully!"),vpe(`${Le(q)} Reel`,"social-swag-2"),Ce(),U(!1),e.invalidateQueries({queryKey:["admin-social-swag-2-reels"]})}catch(De){console.error("Reel upload error:",De),Te.error("Failed to upload reel")}finally{de(!1)}},Ze=ar({mutationFn:async De=>{const Ke=De.image_url.split("/social-swag-2/");Ke[1]&&await Y.storage.from("social-swag-2").remove([Ke[1]]);const{error:st}=await Y.from("social_swag_2_reels").delete().eq("id",De.id);if(st)throw st},onSuccess:()=>{Te.success("Reel deleted"),e.invalidateQueries({queryKey:["admin-social-swag-2-reels"]})},onError:()=>Te.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:n,onOpenChange:a,children:[r.jsx(vo,{asChild:!0,children:r.jsxs(X,{className:"gap-2",children:[r.jsx(vs,{className:"h-4 w-4"}),"Upload Images"]})}),r.jsxs(Pr,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Rr,{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(ot,{type:"month",value:o,onChange:De=>l(De.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:it,className:"hidden",id:"swag-upload",disabled:i.length>=16}),r.jsxs("label",{htmlFor:"swag-upload",className:"cursor-pointer",children:[r.jsx(so,{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((De,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:De.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:()=>xt(Ke),children:r.jsx(en,{className:"h-3 w-3"})})]}),r.jsx(Ys,{placeholder:"Caption...",value:De.caption,onChange:st=>Ee(Ke,st.target.value),className:"text-xs h-20"})]},Ke))}),r.jsx(X,{onClick:et,disabled:m||i.length===0,className:"w-full gap-2",children:m?r.jsxs(r.Fragment,{children:[r.jsx(Vr,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(so,{className:"h-4 w-4"}),"Upload ",i.length," Images"]})})]})]})]}),r.jsxs(Or,{open:D,onOpenChange:De=>{U(De),De||Ce()},children:[r.jsx(vo,{asChild:!0,children:r.jsxs(X,{variant:"outline",className:"gap-2",children:[r.jsx(Id,{className:"h-4 w-4"}),"Upload Reel"]})}),r.jsxs(Pr,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Rr,{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(ot,{type:"month",value:q,onChange:De=>H(De.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Reel Preview Image"}),ne?r.jsxs("div",{className:"relative aspect-[9/16] max-w-[120px] mx-auto rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:ne,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(ne),Q(null),ie("")},children:r.jsx(en,{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:lt,className:"hidden",id:"reel-upload"}),r.jsxs("label",{htmlFor:"reel-upload",className:"cursor-pointer",children:[r.jsx(Id,{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(ot,{value:fe,onChange:De=>oe(De.target.value),placeholder:"https://www.canva.com/..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Caption"}),r.jsx(Ys,{value:he,onChange:De=>se(De.target.value),placeholder:"Enter caption for this reel...",className:"h-24"})]}),r.jsx(X,{onClick:Ie,disabled:ce||!G,className:"w-full gap-2",children:ce?r.jsxs(r.Fragment,{children:[r.jsx(Vr,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(so,{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(Xe,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:Me.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Total Images"})]})}),r.jsx(He,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:tt.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Months"})]})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(Si,{value:t,onValueChange:s,children:r.jsxs(ki,{children:[r.jsx(is,{value:"all",children:"All"}),tt.map(De=>r.jsx(is,{value:De,children:Le(De)},De))]})}),t!=="all"&&r.jsx(He,{children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(zo,{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 ",Le(t)]}),(y==null?void 0:y.month)===t?r.jsxs("div",{className:"flex gap-2 mt-1",children:[r.jsx(ot,{value:y.link,onChange:De=>v({...y,link:De.target.value}),placeholder:"https://www.canva.com/..."}),r.jsx(X,{size:"sm",onClick:()=>Je.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(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx(Id,{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 ",Le(t)]}),(()=>{const De=je(t);return De?r.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[r.jsx("img",{src:De.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:De.caption||"No caption"}),De.canva_link&&r.jsx("a",{href:De.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:()=>Ze.mutate(De),children:r.jsx(Bs,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"No reel uploaded for this month"})})()]})]})})})]}),ve?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}):Ae.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(El,{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(eCt,{sensors:xe,collisionDetection:eSt,onDragEnd:$e,children:r.jsx(uCt,{items:Ae.map(De=>De.id),strategy:J0e,children:r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:Ae.map(De=>r.jsx(jCt,{item:De,onEdit:Ue,onDelete:Ke=>le.mutate(Ke),onDateChange:(Ke,st)=>Ve.mutate({id:Ke,postDate:st})},De.id))})})})]}),r.jsx(Or,{open:!!b,onOpenChange:De=>{De||N(null)},children:r.jsxs(Pr,{className:"max-w-md",children:[r.jsx(zr,{children:r.jsx(Rr,{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(Ys,{value:k,onChange:De=>M(De.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(Kc,{children:[r.jsx(Zc,{asChild:!0,children:r.jsxs(X,{variant:"outline",className:Ut("flex-1 justify-start gap-2 font-normal",!E&&"text-muted-foreground"),children:[r.jsx(jn,{className:"h-4 w-4"}),E?rs(new Date(E+"T00:00:00"),"MMM d, yyyy"):"Pick a date"]})}),r.jsx(Ac,{className:"w-auto p-0",align:"start",children:r.jsx(Df,{mode:"single",selected:E?new Date(E+"T00:00:00"):void 0,onSelect:De=>T(De?rs(De,"yyyy-MM-dd"):null),className:"p-3 pointer-events-auto"})})]}),E&&r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>T(null),children:r.jsx(en,{className:"h-4 w-4"})})]})]})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>N(null),children:"Cancel"}),r.jsx(X,{onClick:Pe,disabled:P,className:"gap-2",children:P?r.jsxs(r.Fragment,{children:[r.jsx(Vr,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})})]})},NCt=()=>{const{toast:e}=ci(),t=Br(),[s,n]=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,E]=A.useState(!1),[T,P]=A.useState(null),[R,D]=A.useState(""),{data:U=[],isLoading:q}=Kt({queryKey:["admin-community-categories"],queryFn:async()=>{const{data:$e,error:it}=await Y.from("community_categories").select("*").order("sort_order");if(it)throw it;return $e}}),{data:H=[],isLoading:G}=Kt({queryKey:["admin-private-groups"],queryFn:async()=>{const{data:$e,error:it}=await Y.from("community_private_groups").select("*").order("sort_order");if(it)throw it;return $e}}),{data:Q=[]}=Kt({queryKey:["admin-group-members",T==null?void 0:T.id],queryFn:async()=>{if(!T)return[];const{data:$e,error:it}=await Y.from("community_private_group_members").select("*").eq("group_id",T.id);if(it)throw it;return $e},enabled:!!T}),{data:ne=[]}=Kt({queryKey:["admin-all-profiles"],queryFn:async()=>{let it=[],xt=0,Ee=!0;for(;Ee;){const{data:et,error:le}=await Y.from("profiles").select("id, name, email, brokerage_id").order("name").range(xt,xt+1e3-1);if(le)throw le;et&&et.length>0?(it=[...it,...et],xt+=1e3,Ee=et.length===1e3):Ee=!1}return it}}),{data:ie=[]}=Kt({queryKey:["admin-all-brokerages"],queryFn:async()=>{const{data:$e,error:it}=await Y.from("brokerages").select("*").order("name");if(it)throw it;return $e}}),he=ar({mutationFn:async $e=>{if($e.id){const{error:it}=await Y.from("community_categories").update({name:$e.name,description:$e.description||null,icon:$e.icon||null}).eq("id",$e.id);if(it)throw it}else{const it=Math.max(...U.map(Ee=>Ee.sort_order),0),{error:xt}=await Y.from("community_categories").insert({name:$e.name,description:$e.description||null,icon:$e.icon||null,sort_order:it+1});if(xt)throw xt}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-community-categories"]}),o(!1),i(null),m({name:"",description:"",icon:""}),e({title:l?"Category updated!":"Category created!"})},onError:$e=>{e({title:"Error",description:$e.message,variant:"destructive"})}}),se=ar({mutationFn:async $e=>{const{error:it}=await Y.from("community_categories").delete().eq("id",$e);if(it)throw it},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-community-categories"]}),e({title:"Category deleted"})}}),fe=ar({mutationFn:async({id:$e,direction:it})=>{const xt=U.findIndex(Ee=>Ee.id===$e);if(it==="up"&&xt>0){const Ee=U[xt-1],et=U[xt];await Y.from("community_categories").update({sort_order:et.sort_order}).eq("id",Ee.id),await Y.from("community_categories").update({sort_order:Ee.sort_order}).eq("id",et.id)}else if(it==="down"&&xtt.invalidateQueries({queryKey:["admin-community-categories"]})}),oe=ar({mutationFn:async $e=>{if($e.id){const{error:it}=await Y.from("community_private_groups").update({name:$e.name,description:$e.description||null,icon:$e.icon||null}).eq("id",$e.id);if(it)throw it}else{const it=Math.max(...H.map(Ee=>Ee.sort_order),0),{error:xt}=await Y.from("community_private_groups").insert({name:$e.name,description:$e.description||null,icon:$e.icon||null,sort_order:it+1});if(xt)throw xt}},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:$e=>{e({title:"Error",description:$e.message,variant:"destructive"})}}),ce=ar({mutationFn:async $e=>{const{error:it}=await Y.from("community_private_groups").delete().eq("id",$e);if(it)throw it},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-private-groups"]}),e({title:"Private group deleted"})}}),de=ar({mutationFn:async({id:$e,direction:it})=>{const xt=H.findIndex(Ee=>Ee.id===$e);if(it==="up"&&xt>0){const Ee=H[xt-1],et=H[xt];await Y.from("community_private_groups").update({sort_order:et.sort_order}).eq("id",Ee.id),await Y.from("community_private_groups").update({sort_order:Ee.sort_order}).eq("id",et.id)}else if(it==="down"&&xtt.invalidateQueries({queryKey:["admin-private-groups"]})}),xe=ar({mutationFn:async({groupId:$e,userId:it,isMember:xt})=>{if(xt){const{error:Ee}=await Y.from("community_private_group_members").delete().eq("group_id",$e).eq("user_id",it);if(Ee)throw Ee}else{const{error:Ee}=await Y.from("community_private_group_members").insert({group_id:$e,user_id:it});if(Ee)throw Ee}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-group-members",T==null?void 0:T.id]})}}),Me=ar({mutationFn:async({groupId:$e,brokerageId:it,isMember:xt})=>{if(xt){const{error:Ee}=await Y.from("community_private_group_members").delete().eq("group_id",$e).eq("brokerage_id",it);if(Ee)throw Ee}else{const{error:Ee}=await Y.from("community_private_group_members").insert({group_id:$e,brokerage_id:it});if(Ee)throw Ee}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-group-members",T==null?void 0:T.id]})}}),ve=$e=>{i($e),m({name:$e.name,description:$e.description||"",icon:$e.icon||""}),o(!0)},be=()=>{i(null),m({name:"",description:"",icon:""}),o(!0)},we=$e=>{b($e),k({name:$e.name,description:$e.description||"",icon:$e.icon||""}),y(!0)},tt=()=>{b(null),k({name:"",description:"",icon:""}),y(!0)},Ae=$e=>{P($e),D(""),E(!0)},Le=$e=>Q.some(it=>it.user_id===$e),Ue=$e=>Q.some(it=>it.brokerage_id===$e),Pe=ne.filter($e=>$e.name.toLowerCase().includes(R.toLowerCase())||$e.email.toLowerCase().includes(R.toLowerCase()));return r.jsx(Dr,{title:"Community Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Eu,{title:"Community Management",description:"Manage categories and private groups for community discussions"}),r.jsxs(Si,{value:s,onValueChange:n,children:[r.jsxs(ki,{children:[r.jsx(is,{value:"categories",children:"Public Categories"}),r.jsxs(is,{value:"private-groups",children:[r.jsx(nh,{className:"h-4 w-4 mr-1"}),"Private Groups"]})]}),r.jsxs(Ss,{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:be,children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),r.jsx(He,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:q?r.jsx(kr,{children:r.jsx(gt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):U.length===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No categories yet. Create your first one!"})}):U.map(($e,it)=>r.jsxs(kr,{children:[r.jsx(gt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(X,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:it===0,onClick:()=>fe.mutate({id:$e.id,direction:"up"}),children:"↑"}),r.jsx(X,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:it===U.length-1,onClick:()=>fe.mutate({id:$e.id,direction:"down"}),children:"↓"})]})}),r.jsx(gt,{className:"text-2xl",children:$e.icon||"📁"}),r.jsx(gt,{className:"font-medium",children:$e.name}),r.jsx(gt,{className:"text-muted-foreground",children:$e.description||"—"}),r.jsx(gt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>ve($e),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($e.id)},children:r.jsx(Bs,{className:"h-4 w-4"})})]})})]},$e.id))})]})})})]}),r.jsxs(Ss,{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(pi,{className:"h-3 w-3"}),"Brokerage groups are created automatically and sync with brokerage names"]})]}),r.jsxs(X,{onClick:tt,children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Add Private Group"]})]}),r.jsx(He,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:G?r.jsx(kr,{children:r.jsx(gt,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):H.length===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No private groups yet. Create your first one!"})}):H.map(($e,it)=>r.jsxs(kr,{children:[r.jsx(gt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(X,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:it===0,onClick:()=>de.mutate({id:$e.id,direction:"up"}),children:"↑"}),r.jsx(X,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:it===H.length-1,onClick:()=>de.mutate({id:$e.id,direction:"down"}),children:"↓"})]})}),r.jsx(gt,{className:"text-2xl",children:$e.icon||"🔒"}),r.jsx(gt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[$e.name,$e.brokerage_id?r.jsxs(Tt,{variant:"outline",className:"text-xs bg-blue-50 text-blue-700 border-blue-200",children:[r.jsx(pi,{className:"h-3 w-3 mr-1"}),"Auto-managed"]}):r.jsxs(Tt,{variant:"secondary",className:"text-xs",children:[r.jsx(nh,{className:"h-3 w-3 mr-1"}),"Private"]})]})}),r.jsx(gt,{className:"text-muted-foreground",children:$e.description||"—"}),r.jsx(gt,{children:r.jsxs(X,{variant:"outline",size:"sm",onClick:()=>Ae($e),children:[r.jsx(qs,{className:"h-4 w-4 mr-1"}),"Manage"]})}),r.jsx(gt,{children:r.jsxs("div",{className:"flex gap-1",children:[!$e.brokerage_id&&r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>we($e),children:r.jsx(Ja,{className:"h-4 w-4"})}),!$e.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.")&&ce.mutate($e.id)},children:r.jsx(Bs,{className:"h-4 w-4"})}),$e.brokerage_id&&r.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Managed via brokerage"})]})})]},$e.id))})]})})})]})]}),r.jsx(Or,{open:a,onOpenChange:o,children:r.jsxs(Pr,{children:[r.jsx(zr,{children:r.jsx(Rr,{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(ot,{value:u.icon,onChange:$e=>m(it=>({...it,icon:$e.target.value})),placeholder:"💬",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name *"}),r.jsx(ot,{value:u.name,onChange:$e=>m(it=>({...it,name:$e.target.value})),placeholder:"Category name",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Description"}),r.jsx(Ys,{value:u.description,onChange:$e=>m(it=>({...it,description:$e.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:()=>he.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(Pr,{children:[r.jsx(zr,{children:r.jsx(Rr,{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(ot,{value:N.icon,onChange:$e=>k(it=>({...it,icon:$e.target.value})),placeholder:"🔒",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name *"}),r.jsx(ot,{value:N.name,onChange:$e=>k(it=>({...it,name:$e.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(Ys,{value:N.description,onChange:$e=>k(it=>({...it,description:$e.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:()=>oe.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:E,children:r.jsxs(Pr,{className:"max-w-2xl",children:[r.jsx(zr,{children:r.jsxs(Rr,{children:["Manage Members: ",T==null?void 0:T.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs(Si,{defaultValue:"brokerages",children:[r.jsxs(ki,{className:"w-full",children:[r.jsx(is,{value:"brokerages",className:"flex-1",children:"By Brokerage"}),r.jsx(is,{value:"users",className:"flex-1",children:"Individual Users"})]}),r.jsxs(Ss,{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(Yo,{className:"h-[300px] border rounded-md p-4",children:r.jsxs("div",{className:"space-y-2",children:[ie.map($e=>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(bl,{checked:Ue($e.id),onCheckedChange:()=>{T&&Me.mutate({groupId:T.id,brokerageId:$e.id,isMember:Ue($e.id)})}}),r.jsx("span",{className:"font-medium",children:$e.name})]}),r.jsxs(Tt,{variant:"secondary",children:[ne.filter(it=>it.brokerage_id===$e.id).length," agents"]})]},$e.id)),ie.length===0&&r.jsx("p",{className:"text-center text-muted-foreground py-4",children:"No brokerages found"})]})})]}),r.jsxs(Ss,{value:"users",className:"space-y-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search users...",value:R,onChange:$e=>D($e.target.value),className:"pl-9"})]}),r.jsx(Yo,{className:"h-[300px] border rounded-md p-4",children:r.jsxs("div",{className:"space-y-2",children:[Pe.map($e=>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(bl,{checked:Le($e.id),onCheckedChange:()=>{T&&xe.mutate({groupId:T.id,userId:$e.id,isMember:Le($e.id)})}}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:$e.name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:$e.email})]})]})},$e.id)),Pe.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:()=>E(!1),children:"Done"})})]})]})})]})})},iCe=e=>{switch(e){case"academy_video":return r.jsx(Hl,{className:"h-3 w-3"});case"template":return r.jsx(ga,{className:"h-3 w-3"});case"toolbox":return r.jsx(Vl,{className:"h-3 w-3"});case"newsletter":return r.jsx(fy,{className:"h-3 w-3"});case"social_swag":return r.jsx(Bn,{className:"h-3 w-3"});default:return r.jsx(Sn,{className:"h-3 w-3"})}},SCt=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}},CCt=e=>{switch(e){case"view":return"Viewed";case"click_canva":return"Clicked Canva";case"click_pdf":return"Downloaded PDF";case"click_video":return"Watched Video";case"click_link":return"Clicked Link";case"click_drive":return"Clicked Drive";default:return e}},MCt=()=>{const{toast:e}=ci(),[t,s]=A.useState([]),[n,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(()=>{E()},[]);const E=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:q,error:H}=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(H)throw H;const G=[...new Set((q==null?void 0:q.map(oe=>oe.user_id))||[])],{data:Q}=await Y.from("profiles").select(` id, name, email, brokerages ( name ) `).in("id",G),ne=new Map((Q==null?void 0:Q.map(oe=>[oe.id,oe]))||[]),ie=(D==null?void 0:D.map(oe=>{var ce,de,xe,Me;return{id:oe.id,user_id:oe.user_id,app_name:oe.app_name,launched_at:oe.launched_at,user_name:((ce=oe.profiles)==null?void 0:ce.name)||"Unknown",user_email:((de=oe.profiles)==null?void 0:de.email)||"Unknown",brokerage_name:((Me=(xe=oe.profiles)==null?void 0:xe.brokerages)==null?void 0:Me.name)||null}}))||[],he=(q==null?void 0:q.map(oe=>{var de;const ce=ne.get(oe.user_id);return{id:oe.id,user_id:oe.user_id,resource_type:oe.resource_type,resource_id:oe.resource_id,resource_title:oe.resource_title,action_type:oe.action_type,created_at:oe.created_at,user_name:(ce==null?void 0:ce.name)||"Unknown",user_email:(ce==null?void 0:ce.email)||"Unknown",brokerage_name:((de=ce==null?void 0:ce.brokerages)==null?void 0:de.name)||null}}))||[];s(ie),a(he);const se=new Map;ie.forEach(oe=>{if(!se.has(oe.user_id))se.set(oe.user_id,{user_id:oe.user_id,user_name:oe.user_name,user_email:oe.user_email,brokerage_name:oe.brokerage_name,last_activity_type:"app",last_activity_name:oe.app_name,last_activity_at:oe.launched_at,total_app_launches:1,total_content_views:0});else{const ce=se.get(oe.user_id);ce.total_app_launches++,new Date(oe.launched_at)>new Date(ce.last_activity_at)&&(ce.last_activity_type="app",ce.last_activity_name=oe.app_name,ce.last_activity_at=oe.launched_at)}}),he.forEach(oe=>{if(!se.has(oe.user_id))se.set(oe.user_id,{user_id:oe.user_id,user_name:oe.user_name,user_email:oe.user_email,brokerage_name:oe.brokerage_name,last_activity_type:oe.resource_type,last_activity_name:oe.resource_title,last_activity_at:oe.created_at,total_app_launches:0,total_content_views:1});else{const ce=se.get(oe.user_id);ce.total_content_views++,new Date(oe.created_at)>new Date(ce.last_activity_at)&&(ce.last_activity_type=oe.resource_type,ce.last_activity_name=oe.resource_title,ce.last_activity_at=oe.created_at)}});const fe=Array.from(se.values()).sort((oe,ce)=>new Date(ce.last_activity_at).getTime()-new Date(oe.last_activity_at).getTime());l(fe)}catch(D){console.error("Error loading activity:",D),e({title:"Error",description:"Failed to load activity logs",variant:"destructive"})}finally{u(!1)}},T=D=>{v({id:D.user_id,name:D.user_name,email:D.user_email});const U=t.filter(H=>H.user_id===D.user_id),q=n.filter(H=>H.user_id===D.user_id);N(U),M(q)},P=()=>{v(null),N([]),M([])},R=o.filter(D=>{var q;if(!m)return!0;const U=m.toLowerCase();return D.user_name.toLowerCase().includes(U)||D.user_email.toLowerCase().includes(U)||((q=D.brokerage_name)==null?void 0:q.toLowerCase().includes(U))});return i?r.jsx(He,{children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(r.Fragment,{children:[r.jsxs(He,{children:[r.jsxs(Vt,{children:[r.jsx(Gt,{children:"User Activity"}),r.jsx(Ns,{children:"App launches and content engagement - click to see full history"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"mb-4",children:r.jsxs("div",{className:"relative",children:[r.jsx(ua,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{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(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:R.length===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:6,className:"text-center text-muted-foreground",children:"No activity found"})}):R.map(D=>r.jsxs(kr,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>T(D),children:[r.jsx(gt,{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(gt,{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(gt,{children:r.jsx("div",{className:"flex items-center gap-2",children:D.last_activity_type==="app"?r.jsxs(Tt,{variant:"secondary",children:[r.jsx(Sn,{className:"h-3 w-3 mr-1"}),D.last_activity_name]}):r.jsxs(Tt,{variant:"outline",className:"flex items-center gap-1",children:[iCe(D.last_activity_type),r.jsx("span",{className:"max-w-32 truncate",children:D.last_activity_name})]})})}),r.jsx(gt,{className:"text-sm text-muted-foreground",children:ju(new Date(D.last_activity_at),{addSuffix:!0})}),r.jsx(gt,{className:"text-right",children:r.jsx(Tt,{variant:"outline",children:D.total_app_launches})}),r.jsx(gt,{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(Pr,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{children:[y==null?void 0:y.name,"'s Activity"]}),r.jsx(Zs,{children:y==null?void 0:y.email})]}),r.jsxs(Si,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[r.jsxs(ki,{className:"grid w-full grid-cols-2",children:[r.jsxs(is,{value:"content",children:["Content (",k.length,")"]}),r.jsxs(is,{value:"apps",children:["App Launches (",b.length,")"]})]}),r.jsx(Ss,{value:"content",className:"flex-1 overflow-auto mt-4",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{children:[r.jsx(Mt,{children:"Type"}),r.jsx(Mt,{children:"Resource"}),r.jsx(Mt,{children:"Action"}),r.jsx(Mt,{children:"Time"})]})}),r.jsx(On,{children:k.length===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement"})}):k.map(D=>r.jsxs(kr,{children:[r.jsx(gt,{children:r.jsxs(Tt,{variant:"outline",className:"flex items-center gap-1 w-fit",children:[iCe(D.resource_type),SCt(D.resource_type)]})}),r.jsx(gt,{className:"max-w-48",children:r.jsx("span",{className:"truncate block",children:D.resource_title})}),r.jsx(gt,{children:r.jsx(Tt,{variant:"secondary",children:CCt(D.action_type)})}),r.jsx(gt,{className:"text-sm text-muted-foreground",children:ju(new Date(D.created_at),{addSuffix:!0})})]},D.id))})]})})}),r.jsx(Ss,{value:"apps",className:"flex-1 overflow-auto mt-4",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{children:[r.jsx(Mt,{children:"App"}),r.jsx(Mt,{children:"Time"})]})}),r.jsx(On,{children:b.length===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches"})}):b.map(D=>r.jsxs(kr,{children:[r.jsx(gt,{children:r.jsx(Tt,{variant:"secondary",children:D.app_name})}),r.jsx(gt,{className:"text-sm text-muted-foreground",children:ju(new Date(D.launched_at),{addSuffix:!0})})]},D.id))})]})})})]})]})})]})},TCt=()=>{const{toast:e}=ci(),[t,s]=A.useState({totalUsers:0,activeUsers:0,pendingUsers:0,totalBrokerages:0,totalLaunches:0,launchesThisWeek:0,launchesThisMonth:0,uniqueActiveThisWeek:0}),[n,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(E=>E.user_id)).size;s({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 n?r.jsx(He,{children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[r.jsxs(He,{children:[r.jsxs(Vt,{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(qs,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.totalUsers}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.activeUsers," active, ",t.pendingUsers," pending"]})]})]}),r.jsxs(He,{children:[r.jsxs(Vt,{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(ii,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.activeUsers}),r.jsx("p",{className:"text-xs text-muted-foreground",children:t.totalUsers>0?`${Math.round(t.activeUsers/t.totalUsers*100)}% of total`:"0% of total"})]})]}),r.jsxs(He,{children:[r.jsxs(Vt,{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(Ra,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.pendingUsers}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Awaiting setup"})]})]}),r.jsxs(He,{children:[r.jsxs(Vt,{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(pi,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.totalBrokerages}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Total brokerages"})]})]}),r.jsxs(He,{children:[r.jsxs(Vt,{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(Og,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.totalLaunches}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"All time"})]})]}),r.jsxs(He,{children:[r.jsxs(Vt,{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(Og,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.launchesThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 7 days"})]})]}),r.jsxs(He,{children:[r.jsxs(Vt,{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(Og,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.launchesThisMonth}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 30 days"})]})]}),r.jsxs(He,{children:[r.jsxs(Vt,{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(bu,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.uniqueActiveThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Unique users"})]})]})]})},oCe={event:"Event",template:"Template",academy_video:"Academy Video",resource_kit:"Resource Kit",newsletter:"Newsletter",social_swag:"Social Swag"},lCe={event:"bg-blue-100 text-blue-800",template:"bg-purple-100 text-purple-800",academy_video:"bg-green-100 text-green-800",resource_kit:"bg-orange-100 text-orange-800",newsletter:"bg-pink-100 text-pink-800",social_swag:"bg-yellow-100 text-yellow-800"};function yBe({brokerageOnly:e=!1,brokerageId:t}){const[s,n]=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 E=[];if(e&&t){const{data:G}=await Y.from("profiles").select("id").eq("brokerage_id",t);if(E=(G==null?void 0:G.map(Q=>Q.id))||[],E.length===0){n([]),o(!1);return}}let T=Y.from("resource_shares").select("*").order("created_at",{ascending:!1});e&&E.length>0&&(T=T.or(`sender_id.in.(${E.join(",")}),recipient_id.in.(${E.join(",")})`));const{data:P,error:R}=await T;if(R)throw R;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)),q=new Map((U==null?void 0:U.map(G=>[G.id,G]))||[]),H=(P==null?void 0:P.map(G=>({...G,sender:q.get(G.sender_id),recipient:q.get(G.recipient_id)})))||[];n(H)}catch(E){console.error("Error loading shares:",E)}finally{o(!1)}},y=s.filter(E=>{var R,D;const T=l===""||E.resource_title.toLowerCase().includes(l.toLowerCase())||((R=E.sender)==null?void 0:R.name.toLowerCase().includes(l.toLowerCase()))||((D=E.recipient)==null?void 0:D.name.toLowerCase().includes(l.toLowerCase())),P=u==="all"||E.resource_type===u;return T&&P}),v=s.length,b=new Set(s.map(E=>E.sender_id)).size,N=new Set(s.map(E=>E.recipient_id)).size,k=s.length>0?Math.round(s.filter(E=>E.is_read).length/s.length*100):0,M=s.reduce((E,T)=>(E[T.resource_type]=(E[T.resource_type]||0)+1,E),{});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((E,T)=>r.jsxs(He,{children:[r.jsx(Vt,{className:"pb-2",children:r.jsx(Cr,{className:"h-4 w-20"})}),r.jsx(Xe,{children:r.jsx(Cr,{className:"h-8 w-16"})})]},T))}),r.jsx(He,{children:r.jsx(Xe,{className:"p-6",children:r.jsx(Cr,{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(Vt,{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(Cc,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:v})})]}),r.jsxs(He,{children:[r.jsxs(Vt,{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(qs,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:b})})]}),r.jsxs(He,{children:[r.jsxs(Vt,{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(bu,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:N})})]}),r.jsxs(He,{children:[r.jsxs(Vt,{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(ga,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Xe,{children:r.jsxs("div",{className:"text-2xl font-bold",children:[k,"%"]})})]})]}),r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsx(Gt,{className:"text-sm font-medium",children:"Shares by Resource Type"})}),r.jsx(Xe,{children:r.jsxs("div",{className:"flex flex-wrap gap-2",children:[Object.entries(M).map(([E,T])=>r.jsxs(Tt,{variant:"secondary",className:lCe[E],children:[oCe[E],": ",T]},E)),Object.keys(M).length===0&&r.jsx("span",{className:"text-muted-foreground text-sm",children:"No shares yet"})]})})]}),r.jsxs(He,{children:[r.jsxs(Vt,{children:[r.jsx(Gt,{children:"Share History"}),r.jsxs(Ns,{children:["All resource shares ",e?"in your brokerage":"across the platform"]})]}),r.jsxs(Xe,{children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by resource, sender, or recipient...",value:l,onChange:E=>i(E.target.value),className:"pl-9"})]}),r.jsxs(us,{value:u,onValueChange:m,children:[r.jsx(cs,{className:"w-[180px]",children:r.jsx(ms,{placeholder:"Resource type"})}),r.jsxs(ds,{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(Yo,{className:"h-[400px]",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:y.length===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No shares found"})}):y.map(E=>{var T,P;return r.jsxs(kr,{children:[r.jsx(gt,{className:"font-medium max-w-[200px] truncate",children:E.resource_title}),r.jsx(gt,{children:r.jsx(Tt,{variant:"secondary",className:lCe[E.resource_type],children:oCe[E.resource_type]})}),r.jsx(gt,{children:((T=E.sender)==null?void 0:T.name)||"Unknown"}),r.jsx(gt,{children:((P=E.recipient)==null?void 0:P.name)||"Unknown"}),r.jsx(gt,{children:r.jsx(Tt,{variant:E.is_read?"default":"outline",children:E.is_read?"Read":"Unread"})}),r.jsx(gt,{className:"text-muted-foreground",children:rs(new Date(E.created_at),"MMM d, yyyy")})]},E.id)})})]})})]})]})]})}const ACt=()=>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(Si,{defaultValue:"analytics",className:"space-y-4",children:[r.jsxs(ki,{children:[r.jsx(is,{value:"analytics",children:"Analytics"}),r.jsx(is,{value:"activity",children:"Activity"}),r.jsx(is,{value:"shares",children:"Shares"})]}),r.jsx(Ss,{value:"analytics",className:"space-y-4",children:r.jsx(TCt,{})}),r.jsx(Ss,{value:"activity",className:"space-y-4",children:r.jsx(MCt,{})}),r.jsx(Ss,{value:"shares",className:"space-y-4",children:r.jsx(yBe,{})})]})]})});function ECt(){const e=Br(),[t,s]=A.useState(!1),[n,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([]),[E,T]=A.useState(!1),[P,R]=A.useState(null),[D,U]=A.useState(""),{data:q,isLoading:H}=Kt({queryKey:["brokerage-resources"],queryFn:async()=>{const{data:Ee,error:et}=await Y.from("brokerage_resources").select("*").order("publish_date",{ascending:!1});if(et)throw et;return Ee}}),{data:G}=Kt({queryKey:["brokerage-resource-pdfs"],queryFn:async()=>{const{data:Ee,error:et}=await Y.from("brokerage_resource_pdfs").select("*").order("sort_order",{ascending:!0});if(et)throw et;return Ee}}),{data:Q}=Kt({queryKey:["brokerage-resource-videos"],queryFn:async()=>{const{data:Ee,error:et}=await Y.from("brokerage_resource_videos").select("*").order("sort_order",{ascending:!0});if(et)throw et;return Ee}}),{data:ne}=Kt({queryKey:["brokerage-resource-links"],queryFn:async()=>{const{data:Ee,error:et}=await Y.from("brokerage_resource_links").select("*").order("sort_order",{ascending:!0});if(et)throw et;return Ee}}),{data:ie,isLoading:he}=Kt({queryKey:["brokerage-resource-categories"],queryFn:async()=>{const{data:Ee,error:et}=await Y.from("brokerage_resource_categories").select("*").order("sort_order",{ascending:!0});if(et)throw et;return Ee}}),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("")},fe=Ee=>{a(Ee),l({title:Ee.title,description:Ee.description||"",publish_date:Ee.publish_date.split("T")[0],is_published:Ee.is_published,category_id:Ee.category_id||""}),x(Ee.preview_image_url||""),U("");const et=(G==null?void 0:G.filter(Je=>Je.resource_id===Ee.id))||[];v(et.map(Je=>({id:Je.id,name:Je.name,file_url:Je.file_url,file_size:Je.file_size,sort_order:Je.sort_order})));const le=(Q==null?void 0:Q.filter(Je=>Je.resource_id===Ee.id))||[];N(le.map(Je=>({id:Je.id,title:Je.title,video_url:Je.video_url,sort_order:Je.sort_order})));const Ve=(ne==null?void 0:ne.filter(Je=>Je.resource_id===Ee.id))||[];M(Ve.map(Je=>({id:Je.id,title:Je.title,canva_share_link:Je.canva_share_link,sort_order:Je.sort_order}))),s(!0)},oe=Ee=>{var le;const et=(le=Ee.target.files)==null?void 0:le[0];et&&(u(et),x(URL.createObjectURL(et)))},ce=()=>{v([...y,{name:"",file_url:"",sort_order:y.length}])},de=Ee=>{v(y.filter((et,le)=>le!==Ee))},xe=(Ee,et,le)=>{const Ve=[...y];if(et==="file"&&le instanceof File){const Je=le.name.replace(/\.[^/.]+$/,"");Ve[Ee]={...Ve[Ee],file:le,file_size:le.size,name:Ve[Ee].name||Je}}else Ve[Ee]={...Ve[Ee],[et]:le};v(Ve)},Me=()=>{N([...b,{title:"",video_url:"",sort_order:b.length}])},ve=Ee=>{N(b.filter((et,le)=>le!==Ee))},be=(Ee,et,le)=>{const Ve=[...b];et==="file"&&le instanceof File?Ve[Ee]={...Ve[Ee],file:le}:Ve[Ee]={...Ve[Ee],[et]:le},N(Ve)},we=()=>{M([...k,{title:"",canva_share_link:"",sort_order:k.length}])},tt=Ee=>{M(k.filter((et,le)=>le!==Ee))},Ae=(Ee,et,le)=>{const Ve=[...k];Ve[Ee]={...Ve[Ee],[et]:le},M(Ve)},Le=async(Ee,et)=>{try{const le=await Y.functions.invoke("bunny-upload",{body:{action:"create",title:Ee.name}});if(le.error)throw le.error;const{videoId:Ve,uploadUrl:Je,libraryId:rt}=le.data,je=await Y.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:Ve,libraryId:rt}});if(je.error)throw je.error;const{uploadUrl:lt,apiKey:Ce}=je.data,Ie=new XMLHttpRequest;return Ie.open("PUT",lt,!0),Ie.setRequestHeader("AccessKey",Ce),Ie.upload.onprogress=Ze=>{if(Ze.lengthComputable){const De=Math.round(Ze.loaded/Ze.total*100),Ke=[...b];Ke[et]={...Ke[et],uploadProgress:De},N(Ke)}},await new Promise((Ze,De)=>{Ie.onload=()=>Ie.status>=200&&Ie.status<300?Ze():De(new Error("Upload failed")),Ie.onerror=()=>De(new Error("Upload failed")),Ie.send(Ee)}),`https://iframe.mediadelivery.net/embed/${rt}/${Ve}`}catch(le){throw console.error("Bunny upload error:",le),le}},Ue=ar({mutationFn:async Ee=>{const{data:et,error:le}=await Y.from("brokerage_resource_categories").insert({name:Ee,sort_order:(ie==null?void 0:ie.length)||0}).select().single();if(le)throw le;return et},onSuccess:Ee=>{e.invalidateQueries({queryKey:["brokerage-resource-categories"]}),l({...o,category_id:Ee.id}),U(""),Te.success("Category created")},onError:Ee=>{Te.error("Failed to create category: "+Ee.message)}}),Pe=ar({mutationFn:async()=>{T(!0);let Ee=(n==null?void 0:n.preview_image_url)||null;if(i){const Ve=i.name.split(".").pop(),Je=`${Date.now()}.${Ve}`,{error:rt}=await Y.storage.from("brokerage-resources").upload(`previews/${Je}`,i);if(rt)throw rt;const{data:je}=Y.storage.from("brokerage-resources").getPublicUrl(`previews/${Je}`);Ee=je.publicUrl}const et={title:o.title,description:o.description||null,preview_image_url:Ee,publish_date:o.publish_date,is_published:o.is_published,category_id:o.category_id||null};let le;if(n){const{error:Ve}=await Y.from("brokerage_resources").update(et).eq("id",n.id);if(Ve)throw Ve;le=n.id;const Je=(G==null?void 0:G.filter(st=>st.resource_id===n.id).map(st=>st.id))||[],rt=y.filter(st=>st.id).map(st=>st.id),je=Je.filter(st=>!rt.includes(st));je.length>0&&await Y.from("brokerage_resource_pdfs").delete().in("id",je);const lt=(Q==null?void 0:Q.filter(st=>st.resource_id===n.id).map(st=>st.id))||[],Ce=b.filter(st=>st.id).map(st=>st.id),Ie=lt.filter(st=>!Ce.includes(st));Ie.length>0&&await Y.from("brokerage_resource_videos").delete().in("id",Ie);const Ze=(ne==null?void 0:ne.filter(st=>st.resource_id===n.id).map(st=>st.id))||[],De=k.filter(st=>st.id).map(st=>st.id),Ke=Ze.filter(st=>!De.includes(st));Ke.length>0&&await Y.from("brokerage_resource_links").delete().in("id",Ke)}else{const{data:Ve,error:Je}=await Y.from("brokerage_resources").insert(et).select().single();if(Je)throw Je;le=Ve.id}for(let Ve=0;Ve{e.invalidateQueries({queryKey:["brokerage-resources"]}),e.invalidateQueries({queryKey:["brokerage-resource-pdfs"]}),e.invalidateQueries({queryKey:["brokerage-resource-videos"]}),e.invalidateQueries({queryKey:["brokerage-resource-links"]}),Te.success(n?"Resource updated":"Resource created"),s(!1),se(),T(!1)},onError:Ee=>{Te.error("Failed to save resource: "+Ee.message),T(!1)}}),$e=ar({mutationFn:async Ee=>{const{error:et}=await Y.from("brokerage_resources").delete().eq("id",Ee);if(et)throw et},onSuccess:()=>{e.invalidateQueries({queryKey:["brokerage-resources"]}),e.invalidateQueries({queryKey:["brokerage-resource-pdfs"]}),e.invalidateQueries({queryKey:["brokerage-resource-videos"]}),e.invalidateQueries({queryKey:["brokerage-resource-links"]}),Te.success("Resource deleted")},onError:Ee=>{Te.error("Failed to delete: "+Ee.message)}}),it=Ee=>{if(Ee.preventDefault(),!o.title){Te.error("Please enter a title");return}Pe.mutate()},xt=Ee=>{const et=(G==null?void 0:G.filter(Je=>Je.resource_id===Ee).length)||0,le=(Q==null?void 0:Q.filter(Je=>Je.resource_id===Ee).length)||0,Ve=(ne==null?void 0:ne.filter(Je=>Je.resource_id===Ee).length)||0;return{pdfCount:et,videoCount:le,linkCount:Ve}};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(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Total Resources"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:(q==null?void 0:q.length)||0})})]}),r.jsxs(He,{children:[r.jsx(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:(q==null?void 0:q.filter(Ee=>Ee.is_published).length)||0})})]})]}),r.jsxs(X,{onClick:()=>{se(),s(!0)},children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Add Resource"]})]}),r.jsx(He,{children:r.jsx(Xe,{className:"p-0",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:H?r.jsx(kr,{children:r.jsx(gt,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):(q==null?void 0:q.length)===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No brokerage resources yet. Create your first one!"})}):q==null?void 0:q.map(Ee=>{const{pdfCount:et,videoCount:le,linkCount:Ve}=xt(Ee.id),Je=ie==null?void 0:ie.find(rt=>rt.id===Ee.category_id);return r.jsxs(kr,{children:[r.jsx(gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Ee.preview_image_url?r.jsx("img",{src:Ee.preview_image_url,alt:Ee.title,className:"w-10 h-10 rounded object-cover"}):r.jsx("div",{className:"w-10 h-10 rounded bg-muted flex items-center justify-center",children:r.jsx(rh,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Ee.title}),Ee.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:Ee.description})]})]})}),r.jsx(gt,{children:Je?r.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-muted",children:Je.name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(gt,{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(ga,{className:"h-3.5 w-3.5"}),et]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ta,{className:"h-3.5 w-3.5"}),le]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(zo,{className:"h-3.5 w-3.5"}),Ve]})]})}),r.jsx(gt,{children:rs(new Date(Ee.publish_date),"MMM d, yyyy")}),r.jsx(gt,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${Ee.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:Ee.is_published?"Published":"Draft"})}),r.jsx(gt,{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===Ee.id))||[],je=(Q==null?void 0:Q.filter(Ce=>Ce.resource_id===Ee.id))||[],lt=(ne==null?void 0:ne.filter(Ce=>Ce.resource_id===Ee.id))||[];R({...Ee,pdfs:rt,videos:je,links:lt})},children:r.jsx(mo,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>fe(Ee),children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource?")&&$e.mutate(Ee.id)},children:r.jsx(Bs,{className:"h-4 w-4 text-destructive"})})]})})]},Ee.id)})})]})})}),r.jsx(Or,{open:t,onOpenChange:s,children:r.jsxs(Pr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Rr,{children:n?"Edit Brokerage Resource":"Add Brokerage Resource"})}),r.jsxs("form",{onSubmit:it,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(rh,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx(ot,{type:"file",accept:"image/*",onChange:oe})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"title",children:"Title *"}),r.jsx(ot,{id:"title",value:o.title,onChange:Ee=>l({...o,title:Ee.target.value}),placeholder:"Resource Title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ze,{className:"flex items-center gap-2",children:[r.jsx(Vg,{className:"h-4 w-4"}),"Category"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(us,{value:o.category_id,onValueChange:Ee=>l({...o,category_id:Ee}),children:[r.jsx(cs,{className:"flex-1",children:r.jsx(ms,{placeholder:"Select a category"})}),r.jsx(ds,{children:ie==null?void 0:ie.map(Ee=>r.jsx($t,{value:Ee.id,children:Ee.name},Ee.id))})]}),o.category_id&&r.jsx(X,{type:"button",variant:"ghost",size:"icon",onClick:()=>l({...o,category_id:""}),children:r.jsx(en,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ot,{placeholder:"Or create new category...",value:D,onChange:Ee=>U(Ee.target.value),className:"flex-1"}),r.jsxs(X,{type:"button",variant:"outline",size:"sm",disabled:!D.trim()||Ue.isPending,onClick:()=>Ue.mutate(D.trim()),children:[r.jsx(vs,{className:"h-4 w-4 mr-1"}),"Add"]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Description"}),r.jsx(Wf,{content:o.description,onChange:Ee=>l({...o,description:Ee}),placeholder:"Brief description of this resource",minHeight:"120px"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(ot,{id:"publish_date",type:"date",value:o.publish_date,onChange:Ee=>l({...o,publish_date:Ee.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Published"}),r.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[r.jsx(In,{checked:o.is_published,onCheckedChange:Ee=>l({...o,is_published:Ee})}),r.jsx("span",{className:"text-sm text-muted-foreground",children:o.is_published?"Visible to brokerage managers":"Hidden from brokerage managers"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(ze,{className:"flex items-center gap-2",children:[r.jsx(ga,{className:"h-4 w-4"}),"PDF Documents (",y.length,")"]}),r.jsxs(X,{type:"button",variant:"outline",size:"sm",onClick:ce,children:[r.jsx(vs,{className:"h-4 w-4 mr-1"}),"Add PDF"]})]}),y.map((Ee,et)=>r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/50",children:[r.jsx(ot,{placeholder:"PDF Name",value:Ee.name,onChange:le=>xe(et,"name",le.target.value),className:"flex-1"}),r.jsx(ot,{type:"file",accept:".pdf",onChange:le=>{var Je;const Ve=(Je=le.target.files)==null?void 0:Je[0];Ve&&xe(et,"file",Ve)},className:"flex-1"}),Ee.file_url&&!Ee.file&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Uploaded"}),r.jsx(X,{type:"button",variant:"ghost",size:"icon",onClick:()=>de(et),children:r.jsx(en,{className:"h-4 w-4"})})]},et))]}),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(Ta,{className:"h-4 w-4"}),"Videos (",b.length,")"]}),r.jsxs(X,{type:"button",variant:"outline",size:"sm",onClick:Me,children:[r.jsx(vs,{className:"h-4 w-4 mr-1"}),"Add Video"]})]}),b.map((Ee,et)=>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(ot,{placeholder:"Video Title",value:Ee.title,onChange:le=>be(et,"title",le.target.value),className:"flex-1"}),r.jsx(X,{type:"button",variant:"ghost",size:"icon",onClick:()=>ve(et),children:r.jsx(en,{className:"h-4 w-4"})})]}),r.jsx(ot,{type:"file",accept:"video/*",onChange:le=>{var Je;const Ve=(Je=le.target.files)==null?void 0:Je[0];Ve&&be(et,"file",Ve)}}),Ee.uploadProgress!==void 0&&Ee.uploadProgress>0&&r.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:r.jsx("div",{className:"bg-primary h-2 rounded-full transition-all",style:{width:`${Ee.uploadProgress}%`}})}),Ee.video_url&&!Ee.file&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Video uploaded"})]},et))]}),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(zo,{className:"h-4 w-4"}),"Canva Links (",k.length,")"]}),r.jsxs(X,{type:"button",variant:"outline",size:"sm",onClick:we,children:[r.jsx(vs,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),k.map((Ee,et)=>r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/50",children:[r.jsx(ot,{placeholder:"Link Title",value:Ee.title,onChange:le=>Ae(et,"title",le.target.value),className:"flex-1"}),r.jsx(ot,{placeholder:"Canva Share Link",value:Ee.canva_share_link,onChange:le=>Ae(et,"canva_share_link",le.target.value),className:"flex-1"}),r.jsx(X,{type:"button",variant:"ghost",size:"icon",onClick:()=>tt(et),children:r.jsx(en,{className:"h-4 w-4"})})]},et))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(X,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),r.jsx(X,{type:"submit",disabled:Pe.isPending||E,children:Pe.isPending||E?"Saving...":n?"Update":"Create"})]})]})]})}),r.jsx(Or,{open:!!P,onOpenChange:()=>R(null),children:r.jsxs(Pr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Rr,{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(ga,{className:"h-4 w-4"}),"PDF Documents (",P.pdfs.length,")"]}),r.jsx("div",{className:"space-y-1",children:P.pdfs.map(Ee=>r.jsx("a",{href:Ee.file_url,target:"_blank",rel:"noopener noreferrer",className:"block p-2 border rounded hover:bg-muted",children:Ee.name},Ee.id))})]}),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(Ta,{className:"h-4 w-4"}),"Videos (",P.videos.length,")"]}),r.jsx("div",{className:"space-y-2",children:P.videos.map(Ee=>r.jsx("div",{className:"p-2 border rounded",children:r.jsx("p",{className:"font-medium text-sm",children:Ee.title})},Ee.id))})]}),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(zo,{className:"h-4 w-4"}),"Canva Links (",P.links.length,")"]}),r.jsx("div",{className:"space-y-1",children:P.links.map(Ee=>r.jsx("a",{href:Ee.canva_share_link,target:"_blank",rel:"noopener noreferrer",className:"block p-2 border rounded hover:bg-muted",children:Ee.title},Ee.id))})]})]})]})})]})})}const vBe=[{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 ICt(){const[e,t]=A.useState([]),[s,n]=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,E]=A.useState(""),[T,P]=A.useState(""),[R,D]=A.useState(""),[U,q]=A.useState("Learn More"),[H,G]=A.useState("top"),[Q,ne]=A.useState(""),[ie,he]=A.useState(!0),[se,fe]=A.useState(""),[oe,ce]=A.useState("");A.useEffect(()=>{de()},[]);const de=async()=>{try{const{data:Ue,error:Pe}=await Y.from("dashboard_banners").select("*").order("placement").order("sort_order");if(Pe)throw Pe;t(Ue||[])}catch(Ue){Te.error("Failed to load banners: "+Ue.message)}finally{n(!1)}},xe=()=>{k(""),E(""),P(""),D(""),q("Learn More"),G("top"),ne(""),he(!0),fe(""),ce(""),m(null)},Me=Ue=>{m(Ue),k(Ue.title),E(Ue.description||""),P(Ue.image_url),D(Ue.link_url||""),q(Ue.link_text||"Learn More"),G(Ue.placement),ne(Ue.section_after||""),he(Ue.is_active),fe(Ue.start_date?rs(new Date(Ue.start_date),"yyyy-MM-dd'T'HH:mm"):""),ce(Ue.end_date?rs(new Date(Ue.end_date),"yyyy-MM-dd'T'HH:mm"):""),o(!0)},ve=async Ue=>{var $e;const Pe=($e=Ue.target.files)==null?void 0:$e[0];if(Pe){y(!0);try{const it=Pe.name.split(".").pop(),xt=`${Date.now()}.${it}`,{error:Ee}=await Y.storage.from("banner-images").upload(xt,Pe);if(Ee)throw Ee;const{data:{publicUrl:et}}=Y.storage.from("banner-images").getPublicUrl(xt);P(et),Te.success("Image uploaded successfully")}catch(it){Te.error("Failed to upload image: "+it.message)}finally{y(!1)}}},be=async()=>{if(!N.trim()||!T){Te.error("Please fill in required fields (title and image)");return}b(!0);try{const Ue={title:N.trim(),description:M.trim()||null,image_url:T,link_url:R.trim()||null,link_text:U.trim()||"Learn More",placement:H,section_after:H==="between"?Q:null,is_active:ie,start_date:se?new Date(se).toISOString():null,end_date:oe?new Date(oe).toISOString():null};if(u){const{error:Pe}=await Y.from("dashboard_banners").update(Ue).eq("id",u.id);if(Pe)throw Pe;Te.success("Banner updated successfully")}else{const Pe=e.filter(it=>it.placement===H).length,{error:$e}=await Y.from("dashboard_banners").insert({...Ue,sort_order:Pe});if($e)throw $e;Te.success("Banner created successfully")}o(!1),xe(),de()}catch(Ue){Te.error("Failed to save banner: "+Ue.message)}finally{b(!1)}},we=async()=>{if(u)try{const{error:Ue}=await Y.from("dashboard_banners").delete().eq("id",u.id);if(Ue)throw Ue;Te.success("Banner deleted successfully"),i(!1),m(null),de()}catch(Ue){Te.error("Failed to delete banner: "+Ue.message)}},tt=async Ue=>{try{const{error:Pe}=await Y.from("dashboard_banners").update({is_active:!Ue.is_active}).eq("id",Ue.id);if(Pe)throw Pe;Te.success(Ue.is_active?"Banner deactivated":"Banner activated"),de()}catch(Pe){Te.error("Failed to update banner: "+Pe.message)}},Ae=e.filter(Ue=>Ue.placement==="top"),Le=e.filter(Ue=>Ue.placement==="between");return s?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(Vt,{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(El,{className:"h-5 w-5"}),"Hero Banners (Top of Dashboard)"]}),r.jsx(Ns,{children:"These banners appear in a rotating carousel at the top of the dashboard"})]}),r.jsxs(Or,{open:a&&H==="top",onOpenChange:Ue=>{Ue||xe(),o(Ue),Ue&&G("top")},children:[r.jsx(vo,{asChild:!0,children:r.jsxs(X,{onClick:()=>{xe(),G("top")},children:[r.jsx(vs,{className:"mr-2 h-4 w-4"}),"Add Hero Banner"]})}),r.jsxs(Pr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{children:[u?"Edit":"Create"," Banner"]}),r.jsx(Zs,{children:"Configure the banner's content and display settings"})]}),r.jsx(cCe,{title:N,setTitle:k,description:M,setDescription:E,imageUrl:T,linkUrl:R,setLinkUrl:D,linkText:U,setLinkText:q,placement:H,setPlacement:G,sectionAfter:Q,setSectionAfter:ne,isActive:ie,setIsActive:he,startDate:se,setStartDate:fe,endDate:oe,setEndDate:ce,handleImageUpload:ve,uploading:x,showPlacementOptions:!1}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>{o(!1),xe()},children:"Cancel"}),r.jsx(X,{onClick:be,disabled:v,children:v?"Saving...":u?"Update Banner":"Create Banner"})]})]})]})]}),r.jsx(Xe,{children:Ae.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:Ae.map(Ue=>r.jsx(dCe,{banner:Ue,onEdit:()=>Me(Ue),onDelete:()=>{m(Ue),i(!0)},onToggleActive:()=>tt(Ue)},Ue.id))})})]}),r.jsxs(He,{children:[r.jsxs(Vt,{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(El,{className:"h-5 w-5"}),"Section Banners"]}),r.jsx(Ns,{children:"These banners appear between dashboard content sections"})]}),r.jsxs(Or,{open:a&&H==="between",onOpenChange:Ue=>{Ue||xe(),o(Ue),Ue&&G("between")},children:[r.jsx(vo,{asChild:!0,children:r.jsxs(X,{onClick:()=>{xe(),G("between")},children:[r.jsx(vs,{className:"mr-2 h-4 w-4"}),"Add Section Banner"]})}),r.jsxs(Pr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{children:[u?"Edit":"Create"," Section Banner"]}),r.jsx(Zs,{children:"Configure where this banner appears between sections"})]}),r.jsx(cCe,{title:N,setTitle:k,description:M,setDescription:E,imageUrl:T,linkUrl:R,setLinkUrl:D,linkText:U,setLinkText:q,placement:H,setPlacement:G,sectionAfter:Q,setSectionAfter:ne,isActive:ie,setIsActive:he,startDate:se,setStartDate:fe,endDate:oe,setEndDate:ce,handleImageUpload:ve,uploading:x,showPlacementOptions:!0}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>{o(!1),xe()},children:"Cancel"}),r.jsx(X,{onClick:be,disabled:v,children:v?"Saving...":u?"Update Banner":"Create Banner"})]})]})]})]}),r.jsx(Xe,{children:Le.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:Le.map(Ue=>r.jsx(dCe,{banner:Ue,onEdit:()=>Me(Ue),onDelete:()=>{m(Ue),i(!0)},onToggleActive:()=>tt(Ue),showSection:!0},Ue.id))})})]})]}),r.jsx(Or,{open:l,onOpenChange:i,children:r.jsxs(Pr,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Delete Banner"}),r.jsxs(Zs,{children:['Are you sure you want to delete "',u==null?void 0:u.title,'"? This action cannot be undone.']})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(X,{variant:"destructive",onClick:we,children:"Delete"})]})]})})]})}function cCe({title:e,setTitle:t,description:s,setDescription:n,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:E,setEndDate:T,handleImageUpload:P,uploading:R,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(ot,{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(Ys,{id:"description",placeholder:"Optional banner description...",value:s,onChange:U=>n(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(ot,{type:"file",accept:"image/*",onChange:P,disabled:R,className:"flex-1"}),R&&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(ot,{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(ot,{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(us,{value:y,onValueChange:v,children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select section placement..."})}),r.jsx(ds,{children:vBe.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(jn,{className:"h-4 w-4"}),"Start Date (optional)"]}),r.jsx(ot,{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(jn,{className:"h-4 w-4"}),"End Date (optional)"]}),r.jsx(ot,{id:"endDate",type:"datetime-local",value:E,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(In,{id:"isActive",checked:b,onCheckedChange:N}),r.jsx(ze,{htmlFor:"isActive",children:"Active"})]})})]})}function dCe({banner:e,onEdit:t,onDelete:s,onToggleActive:n,showSection:a=!1}){var l;const o=(l=vBe.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(Bg,{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(Sn,{className:"h-4 w-4"})})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:n,children:e.is_active?r.jsx(mo,{className:"h-4 w-4"}):r.jsx(Ef,{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:s,children:r.jsx(Bs,{className:"h-4 w-4 text-destructive"})})]})]})}const PO={open:{label:"Open",icon:Ra,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:ql,color:"bg-blue-500"},resolved:{label:"Resolved",icon:ii,color:"bg-green-500"},closed:{label:"Closed",icon:jc,color:"bg-muted-foreground"}},uCe={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function PCt(){var U,q;const{user:e}=Yr(),t=Br(),[s,n]=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}=Kt({queryKey:["admin-support-tickets",l,u],queryFn:async()=>{let H=Y.from("support_tickets").select("*, profiles!support_tickets_user_id_fkey(name, email)").order("created_at",{ascending:!1});l!=="all"&&(H=H.eq("status",l)),u!=="all"&&(H=H.eq("category",u));const{data:G,error:Q}=await H;if(Q)throw Q;return G}}),{data:N=[]}=Kt({queryKey:["admin-users-notifications"],queryFn:async()=>{const{data:H,error:G}=await Y.from("user_roles").select("user_id").eq("role","admin");if(G)throw G;const Q=H.map(oe=>oe.user_id),{data:ne,error:ie}=await Y.from("profiles").select("id, name, email").in("id",Q);if(ie)throw ie;const{data:he,error:se}=await Y.from("support_notification_settings").select("user_id, receive_notifications");if(se)throw se;const fe=new Map((he==null?void 0:he.map(oe=>[oe.user_id,oe.receive_notifications]))||[]);return ne.map(oe=>({...oe,receives_notifications:fe.get(oe.id)||!1}))}}),{data:k=[]}=Kt({queryKey:["admin-ticket-replies",s==null?void 0:s.id],queryFn:async()=>{if(!s)return[];const{data:H,error:G}=await Y.from("support_ticket_replies").select("*, profiles(name)").eq("ticket_id",s.id).order("created_at",{ascending:!0});if(G)throw G;return H},enabled:!!s}),M=ar({mutationFn:async({userId:H,enabled:G})=>{const{data:Q}=await Y.from("support_notification_settings").select("id").eq("user_id",H).maybeSingle();if(Q){const{error:ne}=await Y.from("support_notification_settings").update({receive_notifications:G}).eq("user_id",H);if(ne)throw ne}else{const{error:ne}=await Y.from("support_notification_settings").insert({user_id:H,receive_notifications:G});if(ne)throw ne}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-users-notifications"]}),Te.success("Notification settings updated")},onError:()=>{Te.error("Failed to update settings")}}),E=ar({mutationFn:async({ticketId:H,status:G})=>{const{error:Q}=await Y.from("support_tickets").update({status:G}).eq("id",H);if(Q)throw Q},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-support-tickets"]}),s&&n({...s,status:s.status}),Te.success("Status updated")},onError:()=>{Te.error("Failed to update status")}}),T=ar({mutationFn:async({ticketId:H,assignedTo:G})=>{const{error:Q}=await Y.from("support_tickets").update({assigned_to:G}).eq("id",H);if(Q)throw Q},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-support-tickets"]}),Te.success("Ticket assigned")},onError:()=>{Te.error("Failed to assign ticket")}}),P=ar({mutationFn:async H=>{var Q,ne;if(!s||!e)throw new Error("Missing data");const{error:G}=await Y.from("support_ticket_replies").insert({ticket_id:s.id,user_id:e.id,content:H,is_admin_reply:!0});if(G)throw G;try{await Y.functions.invoke("support-reply-notify",{body:{ticketId:s.id,ticketSubject:s.subject,replyContent:H,userEmail:(Q=s.profiles)==null?void 0:Q.email,userName:(ne=s.profiles)==null?void 0:ne.name}})}catch(ie){console.error("Failed to send reply notification:",ie)}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-ticket-replies",s==null?void 0:s.id]}),o(""),Te.success("Reply sent!")},onError:()=>{Te.error("Failed to send reply")}}),R=()=>{a.trim()&&P.mutate(a)};A.useEffect(()=>{const H=Y.channel("admin-tickets").on("postgres_changes",{event:"*",schema:"public",table:"support_tickets"},()=>{t.invalidateQueries({queryKey:["admin-support-tickets"]})}).subscribe();return()=>{Y.removeChannel(H)}},[t]);const D=v.filter(H=>H.status==="open").length;return s?(PO[s.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:()=>n(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:s.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx(Tt,{variant:"secondary",children:uCe[s.category]}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["from ",((U=s.profiles)==null?void 0:U.name)||"Unknown"," (",(q=s.profiles)==null?void 0:q.email,")"]})]})]})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[r.jsxs(He,{children:[r.jsx(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm",children:"Status"})}),r.jsx(Xe,{children:r.jsxs(us,{value:s.status,onValueChange:H=>{E.mutate({ticketId:s.id,status:H}),n({...s,status:H})},children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsxs(ds,{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(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm",children:"Assigned To"})}),r.jsx(Xe,{children:r.jsxs(us,{value:s.assigned_to||"unassigned",onValueChange:H=>{const G=H==="unassigned"?null:H;T.mutate({ticketId:s.id,assignedTo:G}),n({...s,assigned_to:G})},children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"Unassigned"})}),r.jsxs(ds,{children:[r.jsx($t,{value:"unassigned",children:"Unassigned"}),N.map(H=>r.jsx($t,{value:H.id,children:H.name},H.id))]})]})})]})]}),r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsxs(Ns,{children:["Created on ",rs(new Date(s.created_at),"MMM d, yyyy 'at' h:mm a")]})}),r.jsx(Xe,{children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:s.description})})]}),r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsx(Gt,{className:"text-lg",children:"Conversation"})}),r.jsxs(Xe,{children:[r.jsx(Yo,{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(H=>{var G,Q;return r.jsxs("div",{className:`p-4 rounded-lg ${H.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:H.is_admin_reply?`${((G=H.profiles)==null?void 0:G.name)||"Admin"} (Support)`:((Q=H.profiles)==null?void 0:Q.name)||"User"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:rs(new Date(H.created_at),"MMM d, h:mm a")})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:H.content})]},H.id)})})}),r.jsx(pd,{className:"my-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Ys,{placeholder:"Type your reply...",value:a,onChange:H=>o(H.target.value),className:"min-h-[80px]"}),r.jsx(X,{onClick:R,disabled:!a.trim()||P.isPending,className:"self-end",children:r.jsx(ro,{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(vo,{asChild:!0,children:r.jsxs(X,{variant:"outline",children:[r.jsx(Bd,{className:"h-4 w-4 mr-2"}),"Notification Settings"]})}),r.jsxs(Pr,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Email Notification Settings"}),r.jsx(Zs,{children:"Choose which admins receive email notifications for new support tickets."})]}),r.jsx("div",{className:"space-y-4 mt-4",children:N.map(H=>r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(oc,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:H.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:H.email})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[H.receives_notifications?r.jsx(Rg,{className:"h-4 w-4 text-primary"}):r.jsx(Ej,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(In,{checked:H.receives_notifications,onCheckedChange:G=>M.mutate({userId:H.id,enabled:G})})]})]},H.id))})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[r.jsx(Si,{value:l,onValueChange:i,className:"w-auto",children:r.jsxs(ki,{children:[r.jsx(is,{value:"all",children:"All"}),r.jsx(is,{value:"open",children:"Open"}),r.jsx(is,{value:"in_progress",children:"In Progress"}),r.jsx(is,{value:"resolved",children:"Resolved"}),r.jsx(is,{value:"closed",children:"Closed"})]})}),r.jsxs(us,{value:u,onValueChange:m,children:[r.jsx(cs,{className:"w-[180px]",children:r.jsx(ms,{placeholder:"All Categories"})}),r.jsxs(ds,{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(Xe,{className:"text-center py-12",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 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(H=>{var Q,ne;const G=PO[H.status].icon;return r.jsx(He,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>n(H),children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-medium truncate",children:H.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[r.jsx(Tt,{variant:"outline",className:"text-xs",children:uCe[H.category]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[(Q=H.profiles)==null?void 0:Q.name," • ",rs(new Date(H.created_at),"MMM d, yyyy")]}),H.assigned_to&&r.jsxs(Tt,{variant:"secondary",className:"text-xs gap-1",children:[r.jsx(oc,{className:"h-3 w-3"}),((ne=N.find(ie=>ie.id===H.assigned_to))==null?void 0:ne.name)||"Assigned"]})]})]}),r.jsxs(Tt,{className:PO[H.status].color,children:[r.jsx(G,{className:"h-3 w-3 mr-1"}),PO[H.status].label]})]})})},H.id)})})})]})]})})}const LCt=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 OCt({content:e,onChange:t,variables:s}){const n=c7e({extensions:[f7e,N7e.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),S7e.configure({types:["heading","paragraph"]}),C7e,LCt],content:e,onUpdate:({editor:l})=>{t(l.getHTML())}});A.useEffect(()=>{n&&e!==n.getHTML()&&n.commands.setContent(e)},[e,n]);const a=l=>{n&&n.chain().focus().insertContent(`{{${l.key}}}`).run()},o=()=>{if(!n)return;const l=n.getAttributes("link").href,i=window.prompt("URL",l);if(i!==null){if(i===""){n.chain().focus().extendMarkRange("link").unsetLink().run();return}n.chain().focus().extendMarkRange("link").setLink({href:i}).run()}};return n?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:()=>n.chain().focus().toggleBold().run(),className:n.isActive("bold")?"bg-muted":"",children:r.jsx(NS,{className:"h-4 w-4"})}),r.jsx(X,{type:"button",variant:"ghost",size:"sm",onClick:()=>n.chain().focus().toggleItalic().run(),className:n.isActive("italic")?"bg-muted":"",children:r.jsx(ES,{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:()=>n.chain().focus().toggleBulletList().run(),className:n.isActive("bulletList")?"bg-muted":"",children:r.jsx(fp,{className:"h-4 w-4"})}),r.jsx(X,{type:"button",variant:"ghost",size:"sm",onClick:()=>n.chain().focus().toggleOrderedList().run(),className:n.isActive("orderedList")?"bg-muted":"",children:r.jsx(LS,{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:()=>n.chain().focus().setTextAlign("left").run(),className:n.isActive({textAlign:"left"})?"bg-muted":"",children:r.jsx(jS,{className:"h-4 w-4"})}),r.jsx(X,{type:"button",variant:"ghost",size:"sm",onClick:()=>n.chain().focus().setTextAlign("center").run(),className:n.isActive({textAlign:"center"})?"bg-muted":"",children:r.jsx(wS,{className:"h-4 w-4"})}),r.jsx(X,{type:"button",variant:"ghost",size:"sm",onClick:()=>n.chain().focus().setTextAlign("right").run(),className:n.isActive({textAlign:"right"})?"bg-muted":"",children:r.jsx(kS,{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:n.isActive("link")?"bg-muted":"",children:r.jsx(zo,{className:"h-4 w-4"})}),r.jsx(X,{type:"button",variant:"ghost",size:"sm",onClick:()=>n.chain().focus().toggleCodeBlock().run(),className:n.isActive("codeBlock")?"bg-muted":"",children:r.jsx(Lj,{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:()=>n.chain().focus().undo().run(),disabled:!n.can().undo(),children:r.jsx(US,{className:"h-4 w-4"})}),r.jsx(X,{type:"button",variant:"ghost",size:"sm",onClick:()=>n.chain().focus().redo().run(),disabled:!n.can().redo(),children:r.jsx(zS,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex-1"}),s.length>0&&r.jsxs(uh,{children:[r.jsx(hh,{asChild:!0,children:r.jsxs(X,{type:"button",variant:"outline",size:"sm",className:"gap-2",children:[r.jsx(DA,{className:"h-4 w-4"}),"Insert Variable"]})}),r.jsx(Cu,{align:"end",className:"w-64",children:s.map(l=>r.jsxs(Wa,{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(o7e,{editor:n,className:"prose prose-sm max-w-none p-4 min-h-[300px] focus:outline-none [&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[280px]"}),s.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:s.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 DCt(){const e=Br(),[t,s]=A.useState(null),[n,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}=Kt({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(q=>({...q,available_variables:q.available_variables||[]}))}}),E=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"]}),Te.success("Email template updated successfully"),s(null)},onError:D=>{Te.error("Failed to update template: "+D.message)}}),T=D=>{s(D),l(D.subject),u(D.body_html),x(D.description||""),v(D.is_active),N("visual")},P=()=>{t&&E.mutate({id:t.id,subject:o,body_html:i,description:m,is_active:y})},R=(D,U)=>{let q=D;return U.forEach(H=>{const G=`{{${H.key}}}`,Q=`[${H.label}]`;q=q.replace(new RegExp(G.replace(/[{}]/g,"\\$&"),"g"),Q)}),q};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:()=>s(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(mo,{className:"h-4 w-4 mr-2"}),"Preview"]}),r.jsxs(X,{onClick:P,disabled:E.isPending,children:[r.jsx(Lf,{className:"h-4 w-4 mr-2"}),E.isPending?"Saving...":"Save Changes"]})]}),r.jsxs(He,{children:[r.jsx(Vt,{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(Nn,{className:"h-5 w-5"}),t.name]}),r.jsxs(Ns,{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(In,{id:"active-toggle",checked:y,onCheckedChange:v})]})]})}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"description",children:"Description"}),r.jsx(Ys,{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(ot,{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(Si,{value:b,onValueChange:D=>N(D),children:r.jsxs(ki,{className:"h-8",children:[r.jsxs(is,{value:"visual",className:"text-xs px-3 h-6",children:[r.jsx(Uj,{className:"h-3 w-3 mr-1"}),"Visual"]}),r.jsxs(is,{value:"html",className:"text-xs px-3 h-6",children:[r.jsx(Lj,{className:"h-3 w-3 mr-1"}),"HTML"]})]})})]}),b==="visual"?r.jsx(OCt,{content:i,onChange:u,variables:t.available_variables}):r.jsx(Ys,{value:i,onChange:D=>u(D.target.value),className:"font-mono text-sm min-h-[400px]",placeholder:"HTML email body"})]})]})]})]}),r.jsx(Or,{open:!!n,onOpenChange:()=>a(null),children:r.jsxs(Pr,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Email Preview"}),r.jsxs(Zs,{children:["Subject: ",o.replace(/\{\{(\w+)\}\}/g,"[$1]")]})]}),r.jsx("div",{className:"border rounded-lg p-4 bg-white",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:R(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(Vt,{children:[r.jsx(Cr,{className:"h-5 w-48"}),r.jsx(Cr,{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(Vt,{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(Nn,{className:"h-5 w-5 text-muted-foreground"}),D.name,!D.is_active&&r.jsx(Tt,{variant:"secondary",children:"Inactive"})]}),r.jsx(Ns,{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(mo,{className:"h-4 w-4 mr-2"}),"Preview"]}),r.jsxs(X,{size:"sm",onClick:()=>T(D),children:[r.jsx(vc,{className:"h-4 w-4 mr-2"}),"Edit"]})]})]})}),r.jsx(Xe,{children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Subject:"}),r.jsx("code",{className:"bg-muted px-2 py-0.5 rounded text-sm",children: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:!!n&&!t,onOpenChange:()=>a(null),children:r.jsxs(Pr,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{children:["Email Preview: ",n==null?void 0:n.name]}),r.jsxs(Zs,{children:["Subject: ",n==null?void 0:n.subject.replace(/\{\{(\w+)\}\}/g,"[$1]")]})]}),n&&r.jsx("div",{className:"border rounded-lg p-4 bg-white",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:R(n.body_html,n.available_variables)}})})]})})]})})}function RCt(){const e=Br(),[t,s]=A.useState("templates"),[n,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=[]}=Kt({queryKey:["agent-email-template-categories"],queryFn:async()=>{const{data:Q,error:ne}=await Y.from("email_template_categories").select("*").order("sort_order");if(ne)throw ne;return Q}}),{data:M=[],isLoading:E}=Kt({queryKey:["agent-email-templates-admin"],queryFn:async()=>{const{data:Q,error:ne}=await Y.from("agent_email_templates").select("*, category:email_template_categories(*)").order("sort_order");if(ne)throw ne;return Q}}),T=ar({mutationFn:async Q=>{const ne={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:ie}=await Y.from("agent_email_templates").update(ne).eq("id",Q.id);if(ie)throw ie}else{const{error:ie}=await Y.from("agent_email_templates").insert(ne);if(ie)throw ie}},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-email-templates-admin"]}),u(!1),Te.success(n?"Template updated":"Template created")},onError:()=>Te.error("Failed to save template")}),P=ar({mutationFn:async Q=>{const{error:ne}=await Y.from("agent_email_templates").delete().eq("id",Q);if(ne)throw ne},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-email-templates-admin"]}),Te.success("Template deleted")}}),R=ar({mutationFn:async Q=>{const ne={name:Q.name,description:Q.description||null,icon:Q.icon};if(Q.id){const{error:ie}=await Y.from("email_template_categories").update(ne).eq("id",Q.id);if(ie)throw ie}else{const ie=k.length>0?Math.max(...k.map(se=>se.sort_order))+1:0,{error:he}=await Y.from("email_template_categories").insert({...ne,sort_order:ie});if(he)throw he}},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-email-template-categories"]}),x(!1),Te.success(o?"Category updated":"Category created")},onError:()=>Te.error("Failed to save category")}),D=ar({mutationFn:async Q=>{const{error:ne}=await Y.from("email_template_categories").delete().eq("id",Q);if(ne)throw ne},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-email-template-categories"]}),Te.success("Category deleted")}}),U=()=>{a(null),v({title:"",subject:"",body:"",description:"",tone:"",category_id:"",is_active:!0}),u(!0)},q=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)},H=()=>{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(Eu,{title:"Agent Email Templates",description:"Manage email templates that agents use when composing emails from Mission Control."}),r.jsxs(Si,{value:t,onValueChange:s,children:[r.jsxs(ki,{children:[r.jsxs(is,{value:"templates",className:"gap-2",children:[r.jsx(Nn,{className:"h-4 w-4"})," Templates"]}),r.jsxs(is,{value:"categories",className:"gap-2",children:[r.jsx(If,{className:"h-4 w-4"})," Categories"]})]}),r.jsxs(Ss,{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(vs,{className:"h-4 w-4"})," Add Template"]})}),r.jsx(He,{children:r.jsx(Xe,{className:"p-0",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:E?r.jsx(kr,{children:r.jsx(gt,{colSpan:5,className:"text-center py-8",children:r.jsx(Vr,{className:"h-6 w-6 animate-spin mx-auto"})})}):M.length===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No templates yet. Create your first one!"})}):M.map(Q=>r.jsxs(kr,{children:[r.jsx(gt,{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(gt,{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(gt,{className:"hidden md:table-cell",children:Q.tone?r.jsx(Tt,{variant:"secondary",children:Q.tone}):"—"}),r.jsx(gt,{children:r.jsx(Tt,{variant:Q.is_active?"default":"secondary",children:Q.is_active?"Active":"Inactive"})}),r.jsx(gt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-1",children:[r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>q(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(Bs,{className:"h-4 w-4"})})]})})]},Q.id))})]})})})]}),r.jsxs(Ss,{value:"categories",className:"space-y-4",children:[r.jsx("div",{className:"flex justify-end",children:r.jsxs(X,{onClick:H,className:"gap-2",children:[r.jsx(vs,{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(Vt,{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(Bs,{className:"h-3.5 w-3.5"})})]})]})}),r.jsxs(Xe,{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(ne=>ne.category_id===Q.id).length," templates"]})]})]},Q.id))})]})]}),r.jsx(Or,{open:i,onOpenChange:u,children:r.jsxs(Pr,{className:"sm:max-w-[700px] max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Rr,{children:n?"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(ot,{value:y.title,onChange:Q=>v(ne=>({...ne,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(us,{value:y.category_id,onValueChange:Q=>v(ne=>({...ne,category_id:Q})),children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select category"})}),r.jsx(ds,{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(ot,{value:y.subject,onChange:Q=>v(ne=>({...ne,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(Ys,{value:y.body,onChange:Q=>v(ne=>({...ne,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(ot,{value:y.description,onChange:Q=>v(ne=>({...ne,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(ot,{value:y.tone,onChange:Q=>v(ne=>({...ne,tone:Q.target.value})),placeholder:"e.g. Warm & Casual"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(In,{checked:y.is_active,onCheckedChange:Q=>v(ne=>({...ne,is_active:Q}))}),r.jsx(ze,{children:"Active"})]})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsxs(X,{onClick:()=>T.mutate({...y,id:n==null?void 0:n.id}),disabled:T.isPending||!y.title||!y.subject||!y.body,children:[T.isPending&&r.jsx(Vr,{className:"h-4 w-4 mr-2 animate-spin"}),n?"Save Changes":"Create Template"]})]})]})}),r.jsx(Or,{open:m,onOpenChange:x,children:r.jsxs(Pr,{className:"sm:max-w-[450px]",children:[r.jsx(zr,{children:r.jsx(Rr,{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(ot,{value:b.icon,onChange:Q=>N(ne=>({...ne,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(ot,{value:b.name,onChange:Q=>N(ne=>({...ne,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(ot,{value:b.description,onChange:Q=>N(ne=>({...ne,description:Q.target.value})),placeholder:"Brief description of this category"})]})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>x(!1),children:"Cancel"}),r.jsxs(X,{onClick:()=>R.mutate({...b,id:o==null?void 0:o.id}),disabled:R.isPending||!b.name,children:[R.isPending&&r.jsx(Vr,{className:"h-4 w-4 mr-2 animate-spin"}),o?"Save Changes":"Create Category"]})]})]})})]})})}const FCt=({brokerageId:e})=>{var bo,pc;const{toast:t}=ci(),[s,n]=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,E]=A.useState(!1),[T,P]=A.useState(!1),[R,D]=A.useState({email:"",name:"",password:"",phone:""}),[U,q]=A.useState(!1),[H,G]=A.useState(null),[Q,ne]=A.useState(!1),[ie,he]=A.useState(!1),[se,fe]=A.useState(!1),[oe,ce]=A.useState(""),[de,xe]=A.useState(!1),[Me,ve]=A.useState([]),[be,we]=A.useState(!1),[tt,Ae]=A.useState(!1),[Le,Ue]=A.useState(null),[Pe,$e]=A.useState({name:"",phone:"",email:""}),[it,xt]=A.useState(!1),[Ee,et]=A.useState(!1),[le,Ve]=A.useState(null),[Je,rt]=A.useState("asc"),[je,lt]=A.useState(!1),[Ce,Ie]=A.useState(null),[Ze,De]=A.useState(!1),[Ke,st]=A.useState(null),[dt,ct]=A.useState(""),[zt,ir]=A.useState(!1),[Tr,Zr]=A.useState(null);A.useEffect(()=>{ns(),$r()},[e]);const $r=async()=>{try{const{data:nt,error:ye}=await Y.from("brokerage_manager_assignments").select("user_id").eq("brokerage_id",e);if(ye)throw ye;ve((nt==null?void 0:nt.map(Oe=>Oe.user_id))||[])}catch(nt){console.error("Error loading brokerage managers:",nt)}},ns=async()=>{try{o(!0);const{data:nt,error:ye}=await Y.functions.invoke("get-brokerage-agents",{body:{brokerageId:e}});if(ye)throw ye;const Oe=nt.agents||[];if(n(Oe),Oe.length>0){const Ye=Oe.map(wt=>wt.id),{data:St}=await Y.from("agent_assistant_assignments").select("agent_id, assistant_id").in("agent_id",Ye);if(St&&St.length>0){const wt=St.map(Lt=>Lt.assistant_id),{data:It}=await Y.from("profiles").select("id, name, email").in("id",wt),qt={};for(const Lt of St){const Wt=It==null?void 0:It.find(pr=>pr.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)}},Xs=async()=>{if(!R.email||!R.name||!R.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({...R,brokerageId:e})}),Oe=await ye.json();if(!ye.ok)throw new Error(Oe.error||"Failed to create agent");t({title:"Success",description:`Agent ${R.email} created successfully`}),D({email:"",name:"",password:"",phone:""}),E(!1),ns()}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(),Oe=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})}),Ye=await Oe.json();if(!Oe.ok)throw new Error(Ye.error||"Failed to resend welcome email");t({title:"Success",description:"Welcome email sent successfully"})}catch(ye){console.error("Error resending welcome email:",ye),t({title:"Error",description:ye.message||"Failed to resend welcome email",variant:"destructive"})}},Hr=async(nt,ye)=>{try{const{error:Oe}=await Y.functions.invoke("send-password-reset",{body:{email:nt,redirectTo:window.location.origin}});if(Oe)throw Oe;t({title:"Password Reset Sent",description:`Password reset email sent to ${ye}`})}catch(Oe){console.error("Error sending password reset:",Oe),t({title:"Error",description:Oe.message||"Failed to send password reset email",variant:"destructive"})}},Ts=nt=>{G(nt),q(!0)},zs=nt=>{Ue(nt),$e({name:nt.name,phone:nt.phone||"",email:nt.email}),Ae(!0)},wa=async()=>{if(!Le)return;if(!Pe.name.trim()){t({title:"Error",description:"Name is required",variant:"destructive"});return}const nt=Pe.email.trim().toLowerCase()!==Le.email.toLowerCase();xt(!0);try{if(nt){if(!Pe.email.trim())throw new Error("Email is required");et(!0);const{data:{session:Oe}}=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 ${Oe==null?void 0:Oe.access_token}`},body:JSON.stringify({agentId:Le.id,newEmail:Pe.email.trim(),brokerageId:e})}),St=await Ye.json();if(et(!1),!Ye.ok)throw new Error(St.error||"Failed to update email")}const{error:ye}=await Y.from("profiles").update({name:Pe.name.trim(),phone:Pe.phone.trim()||null}).eq("id",Le.id);if(ye)throw ye;t({title:"Success",description:"Agent profile updated successfully"}),Ae(!1),Ue(null),ns()}catch(ye){console.error("Error updating agent:",ye),t({title:"Error",description:ye.message||"Failed to update agent",variant:"destructive"})}finally{xt(!1),et(!1)}},gi=async()=>{if(!oe){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:oe,role:"brokerage_manager",action:"add",brokerageId:e})}),Oe=await ye.json();if(!ye.ok)throw new Error(Oe.error||"Failed to add brokerage manager");t({title:"Success",description:"Brokerage manager added successfully"}),fe(!1),ce(""),$r()}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)}},Ao=async nt=>{try{const{data:{session:ye}}=await Y.auth.getSession(),Oe=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})}),Ye=await Oe.json();if(!Oe.ok)throw new Error(Ye.error||"Failed to remove brokerage manager");t({title:"Success",description:"Brokerage manager role removed"}),$r()}catch(ye){console.error("Error removing brokerage manager:",ye),t({title:"Error",description:ye.message||"Failed to remove brokerage manager",variant:"destructive"})}},Ga=nt=>Me.includes(nt),mn=nt=>{st(nt),ct(""),De(!0)},na=async()=>{if(!(!Ke||!dt)){if(dt.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:dt})}),Oe=await ye.json();if(!ye.ok)throw new Error(Oe.error||"Failed to set password");t({title:"Success",description:`Password set for ${Ke.name}`}),De(!1),st(null),ct("")}catch(nt){console.error("Error setting password:",nt),t({title:"Error",description:nt.message||"Failed to set password",variant:"destructive"})}finally{ir(!1)}}},pn=async nt=>{Zr(nt.id);try{const{data:{session:ye}}=await Y.auth.getSession(),Oe=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"})}),Ye=await Oe.json();if(!Oe.ok)throw new Error(Ye.error||"Failed to claim account");t({title:"Success",description:`Account claimed for ${nt.name}`}),ns()}catch(ye){console.error("Error claiming account:",ye),t({title:"Error",description:ye.message||"Failed to claim account",variant:"destructive"})}finally{Zr(null)}},Jn=async()=>{if(H){ne(!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:H.id,brokerageId:e})}),Oe=await ye.json();if(!ye.ok)throw new Error(Oe.error||"Failed to remove agent");t({title:"Success",description:`${H.name} has been removed from your brokerage`}),q(!1),G(null),ns()}catch(nt){console.error("Error removing agent:",nt),t({title:"Error",description:nt.message||"Failed to remove agent",variant:"destructive"})}finally{ne(!1)}}},$n=nt=>{const ye=nt.trim().split(" ");return ye.length>1?ye[ye.length-1].toLowerCase():nt.toLowerCase()},Ci=nt=>{le===nt?rt(Je==="asc"?"desc":"asc"):(Ve(nt),rt("asc"))},or=nt=>le!==nt?r.jsx(Dg,{className:"ml-1 h-4 w-4"}):Je==="asc"?r.jsx(hp,{className:"ml-1 h-4 w-4"}):r.jsx(ly,{className:"ml-1 h-4 w-4"}),La=s.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)}),co=[...La].sort((nt,ye)=>{if(!le)return 0;let Oe=0;return le==="name"?Oe=$n(nt.name).localeCompare($n(ye.name)):le==="status"&&(Oe=nt.claimed===ye.claimed?0:nt.claimed?-1:1),Je==="asc"?Oe:-Oe});La.filter(nt=>nt.claimed&&!Ga(nt.id));const Ni=nt=>{y(ye=>{const Oe=new Set(ye);return Oe.has(nt)?Oe.delete(nt):Oe.add(nt),Oe})},Ws=()=>{x.size===co.length?y(new Set):y(new Set(co.map(nt=>nt.id)))},Yi=()=>{y(new Set)},mc=async()=>{const nt=Array.from(x);if(nt.length===0)return;b(!0);let ye=0,Oe=0;try{const{data:{session:Ye}}=await Y.auth.getSession();for(const St of nt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ye==null?void 0:Ye.access_token}`},body:JSON.stringify({userId:St})})).ok?ye++:Oe++}catch{Oe++}ye>0?t({title:"Success",description:`Welcome emails sent to ${ye} agent${ye>1?"s":""}${Oe>0?` (${Oe} failed)`:""}`}):t({title:"Error",description:"Failed to send welcome emails",variant:"destructive"}),Yi()}catch(Ye){console.error("Error bulk sending welcome emails:",Ye),t({title:"Error",description:Ye.message||"Failed to send welcome emails",variant:"destructive"})}finally{b(!1)}};return a?r.jsx(He,{children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(r.Fragment,{children:[r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Gt,{children:"Agents"}),r.jsx(Ns,{children:"Manage your brokerage's agents"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(X,{variant:"outline",onClick:()=>fe(!0),children:[r.jsx(bm,{className:"mr-2 h-4 w-4"}),"Add Brokerage Manager"]}),r.jsxs(X,{variant:"outline",onClick:()=>he(!0),children:[r.jsx(W1,{className:"mr-2 h-4 w-4"}),"Import CSV"]}),r.jsxs(X,{onClick:()=>E(!0),children:[r.jsx(wu,{className:"mr-2 h-4 w-4"}),"Add Agent"]})]})]})}),r.jsxs(Xe,{children:[r.jsxs("div",{className:"mb-4 flex flex-col gap-4 sm:flex-row sm:items-center",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ua,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search agents...",value:l,onChange:nt=>i(nt.target.value),className:"pl-9"})]}),r.jsxs(us,{value:u,onValueChange:nt=>m(nt),children:[r.jsx(cs,{className:"w-[160px]",children:r.jsx(ms,{placeholder:"Filter by status"})}),r.jsxs(ds,{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:mc,disabled:v,children:[r.jsx(Nn,{className:"mr-2 h-4 w-4"}),v?"Sending...":"Resend Welcome Email"]}),r.jsx(X,{size:"sm",variant:"ghost",onClick:Yi,children:"Clear"})]}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{children:[r.jsx(Mt,{className:"w-[40px]",children:r.jsx(bl,{checked:co.length>0&&x.size===co.length,onCheckedChange:Ws,"aria-label":"Select all"})}),r.jsx(Mt,{children:r.jsxs(X,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-transparent",onClick:()=>Ci("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:()=>Ci("status"),children:["Status",or("status")]})}),r.jsx(Mt,{children:"Actions"})]})}),r.jsx(On,{children:co.length===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:5,className:"text-center text-muted-foreground",children:"No agents found"})}):co.map(nt=>r.jsxs(kr,{children:[r.jsx(gt,{children:r.jsx(bl,{checked:x.has(nt.id),onCheckedChange:()=>Ni(nt.id),"aria-label":`Select ${nt.name}`})}),r.jsx(gt,{className:"font-medium",children:nt.name}),r.jsx(gt,{children:nt.email}),r.jsx(gt,{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"}),Ga(nt.id)&&r.jsxs(Tt,{variant:"outline",className:"border-primary text-primary",children:[r.jsx(TA,{className:"mr-1 h-3 w-3"}),"Manager"]}),N[nt.id]&&r.jsxs(Tt,{variant:"outline",className:"text-xs",children:[r.jsx(qs,{className:"mr-1 h-3 w-3"}),"Asst: ",N[nt.id].name||N[nt.id].email]})]})}),r.jsx(gt,{children:r.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.jsx(X,{size:"sm",variant:"ghost",onClick:()=>{Ie(nt),lt(!0)},title:"Send celebration",className:"text-yellow-500 hover:text-yellow-600 hover:bg-yellow-50",children:r.jsx(Gc,{className:"h-4 w-4"})}),r.jsx(X,{size:"sm",variant:"ghost",onClick:()=>zs(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(Nn,{className:"h-4 w-4"})}),r.jsx(X,{size:"sm",variant:"ghost",onClick:()=>pn(nt),title:"Claim account for agent",disabled:Tr===nt.id,className:"text-green-600 hover:text-green-700 hover:bg-green-50",children:r.jsx(Kj,{className:"h-4 w-4"})})]}),r.jsx(X,{size:"sm",variant:"ghost",onClick:()=>mn(nt),title:"Set password",className:"text-blue-600 hover:text-blue-700 hover:bg-blue-50",children:r.jsx(nh,{className:"h-4 w-4"})}),r.jsx(X,{size:"sm",variant:"ghost",onClick:()=>Hr(nt.email,nt.name),title:"Send password reset email",children:r.jsx(zj,{className:"h-4 w-4"})}),Ga(nt.id)&&r.jsx(X,{size:"sm",variant:"ghost",onClick:()=>Ao(nt.id),title:"Remove manager role",className:"text-orange-500 hover:text-orange-600",children:r.jsx(bm,{className:"h-4 w-4"})}),r.jsx(X,{size:"sm",variant:"ghost",onClick:()=>Ts(nt),className:"text-destructive hover:text-destructive",title:"Remove agent",children:r.jsx(Bs,{className:"h-4 w-4"})})]})})]},nt.id))})]})})]})]}),r.jsx(Or,{open:M,onOpenChange:E,children:r.jsxs(Pr,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Add New Agent"}),r.jsx(Zs,{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(ot,{id:"name",value:R.name,onChange:nt=>D({...R,name:nt.target.value}),placeholder:"John Doe"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"email",children:"Email"}),r.jsx(ot,{id:"email",type:"email",value:R.email,onChange:nt=>D({...R,email:nt.target.value}),placeholder:"john@example.com"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"phone",children:"Phone (optional)"}),r.jsx(ot,{id:"phone",type:"tel",value:R.phone,onChange:nt=>D({...R,phone:nt.target.value}),placeholder:"555-123-4567"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"password",children:"Temporary Password"}),r.jsx(ot,{id:"password",type:"password",value:R.password,onChange:nt=>D({...R,password:nt.target.value}),placeholder:"Temporary password"})]})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>E(!1),children:"Cancel"}),r.jsx(X,{onClick:Xs,disabled:T,children:T?"Creating...":"Create Agent"})]})]})}),r.jsx(Or,{open:U,onOpenChange:q,children:r.jsxs(Pr,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Remove Agent"}),r.jsxs(Zs,{children:["Are you sure you want to remove ",r.jsx("strong",{children:H==null?void 0:H.name})," from your brokerage? This will revoke their access to the dashboard."]})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>q(!1),children:"Cancel"}),r.jsx(X,{variant:"destructive",onClick:Jn,disabled:Q,children:Q?"Removing...":"Remove Agent"})]})]})}),r.jsx(G9e,{open:ie,onOpenChange:he,fixedBrokerageId:e,onSuccess:ns}),r.jsx(Or,{open:se,onOpenChange:fe,children:r.jsxs(Pr,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Add Brokerage Manager"}),r.jsx(Zs,{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(Kc,{open:be,onOpenChange:we,children:[r.jsx(Zc,{asChild:!0,children:r.jsxs(X,{variant:"outline",role:"combobox","aria-expanded":be,className:"w-full justify-between",children:[oe?((bo=s.find(nt=>nt.id===oe))==null?void 0:bo.name)+" ("+((pc=s.find(nt=>nt.id===oe))==null?void 0:pc.email)+")":"Select an agent to promote...",r.jsx(cy,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Ac,{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:s.filter(nt=>!Ga(nt.id)).map(nt=>r.jsxs(zy,{value:`${nt.name} ${nt.email}`,onSelect:()=>{ce(nt.id),we(!1)},children:[r.jsx(fi,{className:`mr-2 h-4 w-4 ${oe===nt.id?"opacity-100":"opacity-0"}`}),nt.name," (",nt.email,")"]},nt.id))})]})]})})]}),s.filter(nt=>!Ga(nt.id)).length===0&&r.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"All agents are already brokerage managers."})]})}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>fe(!1),children:"Cancel"}),r.jsx(X,{onClick:gi,disabled:de||!oe,children:de?"Adding...":"Add as Manager"})]})]})}),r.jsx(Or,{open:tt,onOpenChange:Ae,children:r.jsxs(Pr,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Edit Agent"}),r.jsxs(Zs,{children:["Update profile information for ",Le==null?void 0:Le.name]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"edit-name",children:"Name"}),r.jsx(ot,{id:"edit-name",value:Pe.name,onChange:nt=>$e({...Pe,name:nt.target.value}),placeholder:"Agent name"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"edit-email",children:"Email"}),r.jsx(ot,{id:"edit-email",type:"email",value:Pe.email,onChange:nt=>$e({...Pe,email:nt.target.value}),placeholder:"agent@example.com"}),Pe.email.trim().toLowerCase()!==(Le==null?void 0:Le.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(ot,{id:"edit-phone",type:"tel",value:Pe.phone,onChange:nt=>$e({...Pe,phone:nt.target.value}),placeholder:"555-123-4567"})]})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>Ae(!1),children:"Cancel"}),r.jsx(X,{onClick:wa,disabled:it||Ee,children:Ee?"Updating email...":it?"Saving...":"Save Changes"})]})]})}),Ce&&r.jsx(K9e,{open:je,onOpenChange:nt=>{lt(nt),nt||Ie(null)},userId:Ce.id,userName:Ce.name}),r.jsx(Or,{open:Ze,onOpenChange:De,children:r.jsxs(Pr,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Set Password"}),r.jsxs(Zs,{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(ot,{id:"new-password",type:"password",value:dt,onChange:nt=>ct(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(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>De(!1),children:"Cancel"}),r.jsx(X,{onClick:na,disabled:zt||!dt||dt.length<6,children:zt?"Setting...":"Set Password"})]})]})})]})},zCt={academy_video:"Academy Video",template:"Template",toolbox:"Toolbox Resource",newsletter:"Newsletter",social_swag:"Social Swag",event:"Event"},BCt={view:"Viewed",click_canva:"Opened Canva",click_pdf:"Downloaded PDF",click_video:"Watched Video",click_link:"Clicked Link",register:"Registered"},$Ct=e=>{switch(e){case"academy_video":return r.jsx(Ta,{className:"h-4 w-4"});case"template":return r.jsx(ga,{className:"h-4 w-4"});case"toolbox":return r.jsx(ga,{className:"h-4 w-4"});case"newsletter":return r.jsx(fy,{className:"h-4 w-4"});case"social_swag":return r.jsx(Bn,{className:"h-4 w-4"});case"event":return r.jsx(jn,{className:"h-4 w-4"});default:return r.jsx(Sn,{className:"h-4 w-4"})}},UCt=({brokerageId:e})=>{const{toast:t}=ci(),[s,n]=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 E=k.map(ne=>ne.id),T=new Map(k.map(ne=>[ne.id,ne]));if(E.length===0){n([]),o([]),i([]);return}const{data:P,error:R}=await Y.from("activity_logs").select("*").in("user_id",E).order("launched_at",{ascending:!1});if(R)throw R;const D=P.map(ne=>{var ie,he;return{id:ne.id,user_id:ne.user_id,app_name:ne.app_name,launched_at:ne.launched_at,user_name:((ie=T.get(ne.user_id))==null?void 0:ie.name)||"Unknown",user_email:((he=T.get(ne.user_id))==null?void 0:he.email)||"Unknown"}});n(D);const{data:U,error:q}=await Y.from("content_engagement_logs").select("*").in("user_id",E).order("created_at",{ascending:!1});if(q)throw q;const H=(U||[]).map(ne=>{var ie,he;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:((ie=T.get(ne.user_id))==null?void 0:ie.name)||"Unknown",user_email:((he=T.get(ne.user_id))==null?void 0:he.email)||"Unknown"}});o(H);const G=new Map;k.forEach(ne=>{G.set(ne.id,{user_id:ne.id,user_name:ne.name,user_email:ne.email,app_launches:0,content_views:0,last_activity:""})}),D.forEach(ne=>{const ie=G.get(ne.user_id);ie&&(ie.app_launches++,(!ie.last_activity||new Date(ne.launched_at)>new Date(ie.last_activity))&&(ie.last_activity=ne.launched_at))}),H.forEach(ne=>{const ie=G.get(ne.user_id);ie&&(ie.content_views++,(!ie.last_activity||new Date(ne.created_at)>new Date(ie.last_activity))&&(ie.last_activity=ne.created_at))});const Q=Array.from(G.values()).filter(ne=>ne.app_launches>0||ne.content_views>0).sort((ne,ie)=>new Date(ie.last_activity).getTime()-new Date(ne.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=>s.filter(M=>M.user_id===k),N=k=>a.filter(M=>M.user_id===k);return u?r.jsx(He,{children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(r.Fragment,{children:[r.jsxs(He,{children:[r.jsxs(Vt,{children:[r.jsx(Gt,{children:"Agent Activity"}),r.jsx(Ns,{children:"Track app usage and content engagement - click an agent for details"})]}),r.jsx(Xe,{children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:l.length===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:4,className:"text-center text-muted-foreground",children:"No activity yet"})}):l.map(k=>r.jsxs(kr,{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(gt,{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(gt,{className:"text-center",children:r.jsxs(Tt,{variant:"outline",className:"gap-1",children:[r.jsx(Hl,{className:"h-3 w-3"}),k.app_launches]})}),r.jsx(gt,{className:"text-center",children:r.jsxs(Tt,{variant:"secondary",className:"gap-1",children:[r.jsx(ga,{className:"h-3 w-3"}),k.content_views]})}),r.jsx(gt,{className:"text-sm text-muted-foreground",children:k.last_activity&&ju(new Date(k.last_activity),{addSuffix:!0})})]},k.user_id))})]})})})]}),r.jsx(Or,{open:!!x,onOpenChange:k=>!k&&y(null),children:r.jsxs(Pr,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{children:[x==null?void 0:x.name,"'s Activity"]}),r.jsx(Zs,{children:x==null?void 0:x.email})]}),r.jsxs(Si,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[r.jsxs(ki,{className:"grid w-full grid-cols-2",children:[r.jsx(is,{value:"content",children:"Content Engagement"}),r.jsx(is,{value:"apps",children:"App Launches"})]}),r.jsx(Ss,{value:"content",className:"flex-1 overflow-auto",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{children:[r.jsx(Mt,{children:"Resource"}),r.jsx(Mt,{children:"Type"}),r.jsx(Mt,{children:"Action"}),r.jsx(Mt,{children:"Time"})]})}),r.jsx(On,{children:x&&N(x.id).length===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement yet"})}):x&&N(x.id).map(k=>r.jsxs(kr,{children:[r.jsx(gt,{className:"max-w-[200px] truncate font-medium",children:k.resource_title}),r.jsx(gt,{children:r.jsxs(Tt,{variant:"outline",className:"gap-1",children:[$Ct(k.resource_type),zCt[k.resource_type]||k.resource_type]})}),r.jsx(gt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:BCt[k.action_type]||k.action_type})}),r.jsx(gt,{className:"text-sm text-muted-foreground",children:ju(new Date(k.created_at),{addSuffix:!0})})]},k.id))})]})})}),r.jsx(Ss,{value:"apps",className:"flex-1 overflow-auto",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{children:[r.jsx(Mt,{children:"App"}),r.jsx(Mt,{children:"Time"})]})}),r.jsx(On,{children:x&&b(x.id).length===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches yet"})}):x&&b(x.id).map(k=>r.jsxs(kr,{children:[r.jsx(gt,{children:r.jsx(Tt,{variant:"outline",children:k.app_name})}),r.jsx(gt,{className:"text-sm text-muted-foreground",children:ju(new Date(k.launched_at),{addSuffix:!0})})]},k.id))})]})})})]})]})})]})},qCt=({brokerageId:e})=>{const{toast:t}=ci(),[s,n]=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),E=new Date;E.setDate(E.getDate()-7);const{count:T}=await Y.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",m).gte("launched_at",E.toISOString()),P=new Date;P.setMonth(P.getMonth()-1);const{count:R}=await Y.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",m).gte("launched_at",P.toISOString());n({totalAgents:x,activeAgents:N,pendingAgents:k,totalLaunches:M||0,launchesThisWeek:T||0,launchesThisMonth:R||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(Xe,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[r.jsxs(He,{children:[r.jsxs(Vt,{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(qs,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:s.totalAgents}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.activeAgents," active, ",s.pendingAgents," pending"]})]})]}),r.jsxs(He,{children:[r.jsxs(Vt,{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(ii,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:s.activeAgents}),r.jsx("p",{className:"text-xs text-muted-foreground",children:s.totalAgents>0?`${Math.round(s.activeAgents/s.totalAgents*100)}% of total`:"0% of total"})]})]}),r.jsxs(He,{children:[r.jsxs(Vt,{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(Ra,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:s.pendingAgents}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Awaiting setup"})]})]}),r.jsxs(He,{children:[r.jsxs(Vt,{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(Og,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:s.totalLaunches}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"All time"})]})]}),r.jsxs(He,{children:[r.jsxs(Vt,{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(Og,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:s.launchesThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 7 days"})]})]}),r.jsxs(He,{children:[r.jsxs(Vt,{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(Og,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:s.launchesThisMonth}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 30 days"})]})]})]})},VCt=({brokerageId:e})=>{const[t,s]=A.useState([]),[n,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:E,error:T}=await Y.from("invite_codes").select("*").eq("brokerage_id",e).order("created_at",{ascending:!1});if(T)throw T;s(E||[])}catch(E){console.error("Error loading invite codes:",E),Te.error("Failed to load invite links")}finally{a(!1)}},v=()=>Math.random().toString(36).substring(2,8).toUpperCase(),b=async()=>{l(!0);try{const E=v(),{error:T}=await Y.from("invite_codes").insert({code:E,description:m.description||null,max_uses:m.maxUses?parseInt(m.maxUses):null,brokerage_id:e,is_active:!0});if(T)throw T;Te.success("Invite link created!"),u(!1),x({description:"",maxUses:""}),y()}catch(E){console.error("Error creating invite code:",E),Te.error("Failed to create invite link")}finally{l(!1)}},N=async E=>{try{const{error:T}=await Y.from("invite_codes").delete().eq("id",E);if(T)throw T;Te.success("Invite link deleted"),s(t.filter(P=>P.id!==E))}catch(T){console.error("Error deleting invite code:",T),Te.error("Failed to delete invite link")}},k=async(E,T)=>{try{const{error:P}=await Y.from("invite_codes").update({is_active:!T}).eq("id",E);if(P)throw P;s(t.map(R=>R.id===E?{...R,is_active:!T}:R)),Te.success(`Invite link ${T?"deactivated":"activated"}`)}catch(P){console.error("Error toggling invite code:",P),Te.error("Failed to update invite link")}},M=E=>{const T=`${window.location.origin}/join?code=${E}`;navigator.clipboard.writeText(T),Te.success("Link copied to clipboard!")};return n?r.jsx(He,{children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsx(Vr,{className:"h-6 w-6 animate-spin text-muted-foreground"})})}):r.jsxs(He,{children:[r.jsxs(Vt,{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(zo,{className:"h-5 w-5"}),"Agent Invite Links"]}),r.jsx(Ns,{children:"Create shareable links for agents to join your brokerage"})]}),r.jsxs(Or,{open:i,onOpenChange:u,children:[r.jsx(vo,{asChild:!0,children:r.jsxs(X,{size:"sm",children:[r.jsx(vs,{className:"mr-2 h-4 w-4"}),"Create Link"]})}),r.jsxs(Pr,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Create Invite Link"}),r.jsx(Zs,{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(ot,{id:"description",placeholder:"e.g., New agent recruiting campaign",value:m.description,onChange:E=>x({...m,description:E.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"maxUses",children:"Max Uses (optional)"}),r.jsx(ot,{id:"maxUses",type:"number",placeholder:"Leave empty for unlimited",value:m.maxUses,onChange:E=>x({...m,maxUses:E.target.value})})]}),r.jsx(X,{onClick:b,disabled:o,className:"w-full",children:o?r.jsxs(r.Fragment,{children:[r.jsx(Vr,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Invite Link"})]})]})]})]}),r.jsx(Xe,{children:t.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(zo,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No invite links yet"}),r.jsx("p",{className:"text-sm",children:"Create one to start inviting agents"})]}):r.jsx("div",{className:"space-y-3",children:t.map(E=>r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-card",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("code",{className:"text-sm font-mono bg-muted px-2 py-0.5 rounded",children:E.code}),r.jsx(Tt,{variant:E.is_active?"default":"secondary",children:E.is_active?"Active":"Inactive"})]}),E.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:E.description}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[E.uses_count," uses",E.max_uses&&` / ${E.max_uses} max`]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>M(E.code),title:"Copy link",children:r.jsx(Mo,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>k(E.id,E.is_active),title:E.is_active?"Deactivate":"Activate",children:E.is_active?"Disable":"Enable"}),r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>N(E.id),className:"text-destructive hover:text-destructive",title:"Delete",children:r.jsx(Bs,{className:"h-4 w-4"})})]})]},E.id))})})]})},HCt=({open:e,onOpenChange:t,referralCode:s,brokerageId:n,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=R=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(R),M=()=>{const R=i.trim().toLowerCase();if(R&&k(R)&&!m.includes(R)){if(m.length>=10){Te.error("Maximum 10 emails per invite");return}x([...m,R]),u("")}else R&&!k(R)?Te.error("Please enter a valid email address"):m.includes(R)&&Te.error("Email already added")},E=R=>{x(m.filter(D=>D!==R))},T=R=>{(R.key==="Enter"||R.key===",")&&(R.preventDefault(),M())},P=async()=>{if(m.length===0){Te.error("Please add at least one email address");return}N(!0);try{const{data:R,error:D}=await Y.functions.invoke("send-referral-invite",{body:{emails:m,personalMessage:y.trim()||void 0,referralCode:s,brokerageId:n,senderName:a,brokerageName:o}});if(D)throw D;R.successCount===R.totalCount?Te.success(`${R.successCount} invite${R.successCount>1?"s":""} sent successfully!`):Te.warning(`${R.successCount} of ${R.totalCount} invites sent. Some failed.`),x([]),v(""),t(!1),l==null||l()}catch(R){console.error("Error sending invites:",R),Te.error("Failed to send invites. Please try again.")}finally{N(!1)}};return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Pr,{className:"sm:max-w-[550px]",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{className:"flex items-center gap-2",children:[r.jsx(Nn,{className:"h-5 w-5 text-primary"}),"Invite Broker Friends"]}),r.jsx(Zs,{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(oo,{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(ot,{id:"email",type:"email",placeholder:"Enter email and press Enter",value:i,onChange:R=>u(R.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(R=>r.jsxs(Tt,{variant:"secondary",className:"flex items-center gap-1 pr-1",children:[R,r.jsx("button",{type:"button",onClick:()=>E(R),className:"ml-1 rounded-full p-0.5 hover:bg-muted",children:r.jsx(en,{className:"h-3 w-3"})})]},R))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"message",children:"Personal Message (optional)"}),r.jsx(Ys,{id:"message",placeholder:"Add a personal note that will appear at the top of the email...",value:y,onChange:R=>v(R.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(Bn,{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(ro,{className:"h-4 w-4 mr-2"}),"Send ",m.length>0&&`(${m.length})`," Invite",m.length!==1?"s":""]})})]})]})})},WCt=({brokerageId:e,refreshTrigger:t})=>{const[s,n]=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;n(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(ii,{className:"h-3 w-3"}),"Signed Up"]});case"expired":return r.jsxs(Tt,{variant:"outline",className:"text-muted-foreground gap-1",children:[r.jsx(jc,{className:"h-3 w-3"}),"Expired"]});default:return r.jsxs(Tt,{variant:"secondary",className:"gap-1",children:[r.jsx(Ra,{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"})}):s.length===0?r.jsxs("div",{className:"text-center py-6 text-muted-foreground",children:[r.jsx(Nn,{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"}),s.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 ",rs(new Date(u.sent_at),"MMM d, yyyy")]})]}),i(u.status)]},u.id))]})},GCt=()=>{const{brokerageId:e,user:t}=Yr(),[s,n]=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,q]=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),q.data&&i(q.data.name||"A LevelUp Member");const{data:H}=await Y.from("referral_codes").select("code").eq("brokerage_id",e).single();if(H)n(H.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}),n(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)}},E=()=>{const U=`https://dashboard.relevelup.com/?ref=${s}`;navigator.clipboard.writeText(U),Te.success("Referral link copied to clipboard!")},T=u.filter(U=>U.status==="qualified").length,P=u.filter(U=>U.status==="pending").length,R=T*25,D=Math.max(0,Math.ceil((299-R)/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(oo,{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:["$",R]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Monthly Savings"})]}),R>0&&r.jsxs("div",{className:"flex items-center gap-1 text-green-600",children:[r.jsx(ii,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm font-medium",children:"Active"})]})]}),D>0&&R<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"})]}),R>=299&&r.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[r.jsx(Bn,{className:"h-5 w-5"}),r.jsx("span",{className:"font-bold",children:"FREE Membership Unlocked!"})]})]})})]})}),r.jsxs(Xe,{className:"pt-6 space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[r.jsxs(X,{onClick:()=>b(!0),className:"w-full",size:"lg",children:[r.jsx(Nn,{className:"h-4 w-4 mr-2"}),"Invite Broker Friends"]}),r.jsxs(X,{onClick:E,variant:"outline",className:"w-full",size:"lg",children:[r.jsx(Mo,{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=",s]})]}),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:["$",R]}),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(qs,{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(Ra,{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(WCt,{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 q,H;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:((q=U.referred_brokerage)==null?void 0:q.name)||((H=U.referred_user)==null?void 0:H.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(ii,{className:"h-3 w-3 mr-1"}),U.status]})]},U.id)})]})]})]}),r.jsx(HCt,{open:v,onOpenChange:b,referralCode:s||"",brokerageId:e||"",senderName:l||"A LevelUp Member",brokerageName:a,onInvitesSent:()=>k(U=>U+1)})]})},KCt=()=>{const{user:e,isBrokerageManager:t,brokerageId:s,isAdmin:n,managedBrokerages:a,selectedBrokerageId:o,setSelectedBrokerageId:l}=Yr(),i=Hs(),{toast:u}=ci(),[m,x]=A.useState(""),[y,v]=A.useState(!0),b=o||(a.length>0?a[0].id:s);A.useEffect(()=>{if(!e||!t&&!n){i("/dashboard");return}!o&&a.length>0&&l(a[0].id),b?N():a.length===0&&!s&&v(!1)},[e,t,n,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(us,{value:o||"",onValueChange:l,children:[r.jsxs(cs,{className:"w-[280px]",children:[r.jsx(pi,{className:"mr-2 h-4 w-4"}),r.jsx(ms,{placeholder:"Select brokerage"})]}),r.jsx(ds,{children:a.map(k=>r.jsx($t,{value:k.id,children:k.name},k.id))})]})]}),r.jsxs(Si,{defaultValue:"agents",className:"space-y-4",children:[r.jsxs(ki,{className:"grid w-full grid-cols-3 md:grid-cols-7",children:[r.jsx(is,{value:"agents",children:"Agents"}),r.jsx(is,{value:"invite",children:"Invite Links"}),r.jsx(is,{value:"referrals",children:"Referrals"}),r.jsx(is,{value:"leaderboard",children:"Leaderboard"}),r.jsx(is,{value:"activity",children:"Activity"}),r.jsx(is,{value:"analytics",children:"Analytics"}),r.jsx(is,{value:"shares",children:"Shares"})]}),r.jsx(Ss,{value:"agents",className:"space-y-4",children:r.jsx(FCt,{brokerageId:b})}),r.jsx(Ss,{value:"invite",className:"space-y-4",children:r.jsx(VCt,{brokerageId:b})}),r.jsx(Ss,{value:"referrals",className:"space-y-4",children:r.jsx(GCt,{})}),r.jsx(Ss,{value:"leaderboard",className:"space-y-4",children:r.jsx(h9e,{brokerageId:b,title:`${m} Event Leaderboard`,showUserStats:!1})}),r.jsx(Ss,{value:"activity",className:"space-y-4",children:r.jsx(UCt,{brokerageId:b})}),r.jsx(Ss,{value:"analytics",className:"space-y-4",children:r.jsx(qCt,{brokerageId:b})}),r.jsx(Ss,{value:"shares",className:"space-y-4",children:r.jsx(yBe,{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(pi,{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 ZCt({brokerageId:e,canManage:t}){const{user:s}=Yr(),[n,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(""),[E,T]=A.useState(""),[P,R]=A.useState(!1),D=async()=>{try{const{data:Q,error:ne}=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(ne)throw ne;const ie=Q;if(ie&&ie.length>0){const he=[...new Set(ie.map(ce=>ce.created_by))],{data:se}=await Y.from("profiles").select("id, name, avatar_url").in("id",he),fe=new Map((se==null?void 0:se.map(ce=>[ce.id,ce]))||[]),oe=ie.map(ce=>({...ce,author:fe.get(ce.created_by)||{name:"Unknown",avatar_url:null}}));a(oe)}else a([])}catch(Q){console.error("Error fetching announcements:",Q)}finally{l(!1)}};A.useEffect(()=>{D()},[e]);const U=()=>{M(""),T(""),R(!1),x(null)},q=Q=>{Q?(x(Q),M(Q.title),T(Q.content),R(Q.is_pinned)):U(),u(!0)},H=async()=>{if(!k.trim()||!E.trim()){Te.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:E.trim(),is_pinned:P,pinned_at:P?new Date().toISOString():null}).eq("id",m.id);if(Q)throw Q;Te.success("Announcement updated")}else{const{error:Q}=await Y.from("brokerage_announcements").insert({brokerage_id:e,created_by:s==null?void 0:s.id,title:k.trim(),content:E.trim(),is_pinned:P,pinned_at:P?new Date().toISOString():null});if(Q)throw Q;Te.success("Announcement created")}u(!1),U(),D()}catch(Q){console.error("Error saving announcement:",Q),Te.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;Te.success("Announcement deleted"),D()}catch(Q){console.error("Error deleting announcement:",Q),Te.error("Failed to delete announcement")}finally{v(null)}};return o?r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Pf,{className:"h-5 w-5"}),"Announcements"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"animate-pulse space-y-3",children:r.jsx("div",{className:"h-20 bg-muted rounded"})})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(He,{children:[r.jsxs(Vt,{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(Pf,{className:"h-5 w-5 text-primary"}),"Announcements"]}),t&&r.jsxs(X,{size:"sm",onClick:()=>q(),className:"gap-1",children:[r.jsx(vs,{className:"h-4 w-4"}),"New"]})]}),r.jsx(Xe,{children:n.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:n.map(Q=>{var ne,ie,he,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(Q1,{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(Xn,{className:"h-5 w-5",children:[r.jsx(ji,{src:((ne=Q.author)==null?void 0:ne.avatar_url)||void 0}),r.jsx(Qn,{className:"text-[10px]",children:((he=(ie=Q.author)==null?void 0:ie.name)==null?void 0:he.charAt(0))||"?"})]}),r.jsx("span",{children:(se=Q.author)==null?void 0:se.name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:rs(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:()=>q(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(Bs,{className:"h-4 w-4"})})]})]})},Q.id)})})})]}),r.jsx(Or,{open:i,onOpenChange:u,children:r.jsxs(Pr,{children:[r.jsx(zr,{children:r.jsx(Rr,{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(ot,{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(Ys,{id:"content",value:E,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(In,{id:"pinned",checked:P,onCheckedChange:R}),r.jsxs(ze,{htmlFor:"pinned",className:"flex items-center gap-1 cursor-pointer",children:[r.jsx(Q1,{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:H,disabled:b,children:b?"Saving...":m?"Update":"Create"})]})]})]})}),r.jsx(Dd,{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(Vc,{onClick:G,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function YCt({brokerageId:e}){const[t,s]=A.useState([]),[n,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(s(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 n?r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(qs,{className:"h-5 w-5"}),"Agent Roster"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[1,2,3,4].map(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(Vt,{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(qs,{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(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search agents...",value:o,onChange:x=>l(x.target.value),className:"pl-9"})]})]}),r.jsx(Xe,{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(XCt,{agent:x,hasAssistant:i.has(x.id)},x.id))})})]})}function XCt({agent:e,hasAssistant:t}){const s=e.name.split(" ").map(n=>n[0]).join("").toUpperCase().slice(0,2);return r.jsxs("div",{className:"group relative bg-card border rounded-xl p-4 hover:shadow-md transition-shadow",children:[r.jsxs("div",{className:"flex flex-col items-center text-center mb-3",children:[r.jsxs(Xn,{className:"h-20 w-20 mb-3 ring-2 ring-background shadow-md",children:[r.jsx(ji,{src:e.avatar_url||void 0,alt:e.name}),r.jsx(Qn,{className:"text-lg bg-primary/10 text-primary",children:s})]}),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(po,{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(Pi,{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(Nn,{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(vm,{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 QCt({brokerageId:e}){const[t,s]=A.useState([]),[n,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){s([]),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}});s(N)}catch(u){console.error("Error fetching leaderboard:",u)}finally{a(!1)}})()},[e]),n)return r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(lo,{className:"h-5 w-5"}),"Team Leaderboard"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"animate-pulse space-y-3",children:[1,2,3].map(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(py,{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(Vt,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(lo,{className:"h-5 w-5 text-primary"}),"Team Leaderboard"]})}),r.jsx(Xe,{children:t.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No points earned yet. Attend events to earn points!"}):r.jsx("div",{className:"space-y-2",children:t.slice(0,10).map((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(Xn,{className:"h-8 w-8",children:[r.jsx(ji,{src:i.avatar_url||void 0}),r.jsx(Qn,{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 JCt({brokerageId:e}){const t=Hs(),[s,n]=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){n([]),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||[]}));n(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(Vt,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(sa,{className:"h-5 w-5"}),"Brokerage Listings"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[1,2].map(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(Vt,{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(sa,{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(vs,{className:"h-4 w-4"}),"Add Listing"]})]}),r.jsxs(Xe,{children:[s.length===0?r.jsxs("div",{className:"text-center py-8",children:[r.jsx(sa,{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(vs,{className:"h-4 w-4"}),"Add Your First Listing"]})]}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:s.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(sa,{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))}),s.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(Sn,{className:"h-3 w-3 ml-1"})]})]})]})}function e3t(){const{user:e,isAdmin:t,isBrokerageManager:s}=Yr(),n=Hs(),[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:E}=await Y.from("profiles").select("brokerage_id").eq("id",e.id).maybeSingle();if(!(E!=null&&E.brokerage_id)){o(!1);return}i(E.brokerage_id);const{data:T}=await Y.from("brokerages").select("name").eq("id",E.brokerage_id).maybeSingle();T&&m(T.name);const{count:P}=await Y.from("profiles").select("id",{count:"exact",head:!0}).eq("brokerage_id",E.brokerage_id);if(y(P||0),t)b(!0),k(!0);else if(s){const{data:R}=await Y.from("brokerage_manager_assignments").select("id").eq("user_id",e.id).eq("brokerage_id",E.brokerage_id).maybeSingle();b(!!R),k(!!R)}}catch(E){console.error("Error fetching brokerage info:",E)}finally{o(!1)}})()},[e,t,s]),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(qs,{className:"h-5 w-5 text-primary"}),r.jsxs("span",{className:"font-medium",children:[x," ",x===1?"Agent":"Agents"]})]}),N&&r.jsxs(X,{onClick:()=>n(`/mission-control/listings/new?brokerage=${l}`),children:[r.jsx(sa,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]}),r.jsx(ZCt,{brokerageId:l,canManage:v}),r.jsx(YCt,{brokerageId:l}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[r.jsx(QCt,{brokerageId:l}),r.jsx(JCt,{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(pi,{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 t3t(){const e=Hs(),[t,s]=A.useState(""),[n,a]=A.useState("grid"),{data:o,isLoading:l}=Kt({queryKey:["newsletters"],queryFn:async()=>{const{data:P,error:R}=await Y.from("newsletter_content").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(R)throw R;return P}}),{data:i}=Kt({queryKey:["newsletter-likes-all"],queryFn:async()=>{const{data:P}=await Y.from("newsletter_likes").select("newsletter_id");return P||[]}}),{data:u}=Kt({queryKey:["newsletter-comments-all"],queryFn:async()=>{const{data:P}=await Y.from("newsletter_comments").select("newsletter_id");return P||[]}}),{data:m}=Kt({queryKey:["newsletter-resource-counts"],queryFn:async()=>{const[P,R,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:R.data||[],videos:D.data||[],drives:U.data||[]}}}),x=P=>(i==null?void 0:i.filter(R=>R.newsletter_id===P).length)||0,y=P=>(u==null?void 0:u.filter(R=>R.newsletter_id===P).length)||0,v=P=>{var R;return((R=m==null?void 0:m.canva)==null?void 0:R.filter(D=>D.newsletter_id===P).length)||0},b=P=>{var R;return((R=m==null?void 0:m.pdfs)==null?void 0:R.filter(D=>D.newsletter_id===P).length)||0},N=P=>{var R;return((R=m==null?void 0:m.videos)==null?void 0:R.filter(D=>D.newsletter_id===P).length)||0},k=P=>{var R;return((R=m==null?void 0:m.drives)==null?void 0:R.filter(D=>D.newsletter_id===P).length)||0},M=P=>v(P)+b(P)+N(P)+k(P),E=o==null?void 0:o.filter(P=>{var R;return P.title.toLowerCase().includes(t.toLowerCase())||((R=P.description)==null?void 0:R.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(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search newsletters...",value:t,onChange:P=>s(P.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[t&&r.jsx(X,{variant:"outline",size:"sm",onClick:()=>s(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(X,{variant:n==="grid"?"secondary":"outline",size:"icon",onClick:()=>a("grid"),className:"rounded-full",children:r.jsx(pp,{className:"h-4 w-4"})}),r.jsx(X,{variant:n==="list"?"secondary":"outline",size:"icon",onClick:()=>a("list"),className:"rounded-full",children:r.jsx(fp,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[(E==null?void 0:E.length)||0," item",(E==null?void 0:E.length)!==1?"s":""," found"]}),l&&r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:[...Array(8)].map((P,R)=>r.jsx(He,{children:r.jsxs(Xe,{className:"p-0",children:[r.jsx(Cr,{className:"aspect-[3/2] w-full"}),r.jsxs("div",{className:"p-4 space-y-2",children:[r.jsx(Cr,{className:"h-5 w-3/4"}),r.jsx(Cr,{className:"h-4 w-full"})]})]})},R))}),!l&&(E==null?void 0:E.length)===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(ga,{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:()=>s(""),children:"Clear Search"})]}),!l&&E&&E.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-3",children:E.map(P=>{const R=M(P.id),D=v(P.id),U=b(P.id),q=N(P.id);return n==="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(ga,{className:"h-16 w-16"})})}),r.jsxs(Xe,{className:"p-4 space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1",children:P.title}),r.jsxs("div",{className:"flex items-center gap-1.5 mt-1 text-xs text-muted-foreground",children:[r.jsx(jn,{className:"h-3 w-3"}),rs(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,"")}),R>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(Wc,{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($i,{className:"h-3 w-3"})," ",U," PDF",U>1?"s":""]}),q>0&&r.jsxs(Tt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[r.jsx(Hl,{className:"h-3 w-3"})," ",q," Video",q>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(xd,{className:"h-3 w-3"})," ",x(P.id)]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ql,{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(ga,{className:"h-10 w-10"})})}),r.jsxs(Xe,{className:"p-4 flex-1 flex flex-col justify-center gap-2",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1",children:P.title}),r.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5 text-xs text-muted-foreground",children:[r.jsx(jn,{className:"h-3 w-3"}),rs(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:[R>0&&r.jsxs("span",{children:[R," resource",R>1?"s":""]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(xd,{className:"h-3 w-3"})," ",x(P.id)]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ql,{className:"h-3 w-3"})," ",y(P.id)]})]})]})]})},P.id)})})]})})}function r3t({rows:e}){if(!e||e.length===0)return null;const t=e.filter(s=>s.columns.some(n=>n.title||n.description||n.image_url));return t.length===0?null:r.jsx("div",{className:"space-y-6",children:t.map((s,n)=>{const a=s.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(Xe,{className:"p-4 space-y-2",children:[o.title&&r.jsx("h4",{className:"font-semibold text-foreground",children:o.title}),o.description&&r.jsx("p",{className:"text-sm text-muted-foreground",children:o.description})]})]},l))},n)})})}function s3t(){const{id:e}=hc(),t=Hs(),{user:s}=Yr(),{toast:n}=ci(),a=Br(),{trackEngagement:o}=vP(),[l,i]=A.useState(""),{data:u,isLoading:m}=Kt({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}=Kt({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}=Kt({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}=Kt({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}=Kt({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}=Kt({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}=Kt({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===(s==null?void 0:s.id)),E=ar({mutationFn:async()=>{M?await Y.from("newsletter_likes").delete().eq("newsletter_id",e).eq("user_id",s==null?void 0:s.id):await Y.from("newsletter_likes").insert({newsletter_id:e,user_id:s==null?void 0:s.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:s==null?void 0:s.id,content:D});if(U)throw U},onSuccess:()=>{a.invalidateQueries({queryKey:["newsletter-comments",e]}),i(""),n({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]}),n({title:"Comment deleted"})}}),R=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(Hl,{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(Cr,{className:"h-8 w-32"}),r.jsx(Cr,{className:"h-64 w-full"}),r.jsx(Cr,{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:rs(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(r3t,{rows:u.content_blocks||[]}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx($3,{resourceType:"newsletter",resourceId:u.id,resourceTitle:u.title}),r.jsxs(X,{variant:M?"default":"outline",size:"sm",onClick:()=>E.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(Vt,{children:r.jsx(Gt,{className:"text-lg",children:"Canva Templates"})}),r.jsx(Xe,{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(Wc,{className:"h-5 w-5 text-purple-500"}),r.jsx("span",{className:"font-medium",children:D.title}),r.jsx(Sn,{className:"h-4 w-4 text-muted-foreground ml-auto"})]},D.id))})]}),x&&x.length>0&&r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsx(Gt,{className:"text-lg",children:"Google Drive Files"})}),r.jsx(Xe,{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(Sn,{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(Vt,{children:r.jsx(Gt,{className:"text-lg",children:"PDF Downloads"})}),r.jsx(Xe,{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(ga,{className:"h-5 w-5 text-red-500"}),r.jsx("span",{className:"font-medium flex-1",children:D.name}),r.jsx($i,{className:"h-4 w-4 text-muted-foreground"})]},D.id))})]}),v&&v.length>0&&r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsx(Gt,{className:"text-lg",children:"Videos"})}),r.jsx(Xe,{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}),R(D.video_url)]},D.id))})]}),r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsxs(Gt,{className:"text-lg",children:["Comments (",(k==null?void 0:k.length)||0,")"]})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Ys,{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(ro,{className:"h-4 w-4"})})]}),r.jsx("div",{className:"space-y-4",children:k==null?void 0:k.map(D=>{var U,q,H;return r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Xn,{className:"h-8 w-8",children:r.jsx(Qn,{children:((q=(U=D.profiles)==null?void 0:U.name)==null?void 0:q[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:((H=D.profiles)==null?void 0:H.name)||"User"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:rs(new Date(D.created_at),"MMM d, yyyy")}),D.user_id===(s==null?void 0:s.id)&&r.jsx(X,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>P.mutate(D.id),children:r.jsx(Bs,{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 n3t({rows:e,onChange:t}){const[s,n]=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}`;n(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:E}=Y.storage.from("newsletter-content").getPublicUrl(k);l(m,x,"image_url",E.publicUrl)}}finally{n(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(vs,{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(en,{className:"h-4 w-4"})}),r.jsxs(Xe,{className:"p-4 pt-3",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(Bg,{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(en,{className:"h-3 w-3"})})]}):r.jsxs("div",{children:[r.jsx(ot,{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:s===b,asChild:!0,children:r.jsx("label",{htmlFor:`block-img-${b}`,className:"cursor-pointer",children:s===b?"Uploading...":r.jsxs(r.Fragment,{children:[r.jsx(El,{className:"h-3 w-3 mr-1"})," Image"]})})})]}),r.jsx(ot,{placeholder:"Title",value:y.title,onChange:N=>l(x,v,"title",N.target.value),className:"h-8 text-sm"}),r.jsx(Ys,{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 a3t(){const{toast:e}=ci(),t=Br(),[s,n]=A.useState(!1),[a,o]=A.useState(null),[l,i]=A.useState({title:"",description:"",publish_date:rs(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,E]=A.useState([]),[T,P]=A.useState([]),[R,D]=A.useState([]),[U,q]=A.useState([]),[H,G]=A.useState(!1),{data:Q,isLoading:ne}=Kt({queryKey:["admin-newsletters"],queryFn:async()=>{const{data:Ae,error:Le}=await Y.from("newsletter_content").select("*").order("publish_date",{ascending:!1});if(Le)throw Le;return Ae}}),ie=ar({mutationFn:async Ae=>{const{data:Le,error:Ue}=await Y.from("newsletter_content").insert({title:Ae.title,description:Ae.description||null,preview_image_url:Ae.preview_image_url,publish_date:Ae.publish_date,is_published:Ae.is_published,content_blocks:Ae.content_blocks}).select().single();if(Ue)throw Ue;return Le},onSuccess:async Ae=>{await fe(Ae.id),t.invalidateQueries({queryKey:["admin-newsletters"]}),e({title:"Newsletter created successfully"}),de()},onError:Ae=>{e({title:"Error creating newsletter",description:Ae.message,variant:"destructive"})}}),he=ar({mutationFn:async Ae=>{const{error:Le}=await Y.from("newsletter_content").update({title:Ae.title,description:Ae.description||null,preview_image_url:Ae.preview_image_url,publish_date:Ae.publish_date,is_published:Ae.is_published,content_blocks:Ae.content_blocks}).eq("id",Ae.id);if(Le)throw Le;return Ae.id},onSuccess:async Ae=>{await fe(Ae),t.invalidateQueries({queryKey:["admin-newsletters"]}),e({title:"Newsletter updated successfully"}),de()},onError:Ae=>{e({title:"Error updating newsletter",description:Ae.message,variant:"destructive"})}}),se=ar({mutationFn:async Ae=>{const{error:Le}=await Y.from("newsletter_content").delete().eq("id",Ae);if(Le)throw Le},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-newsletters"]}),e({title:"Newsletter deleted successfully"})},onError:Ae=>{e({title:"Error deleting newsletter",description:Ae.message,variant:"destructive"})}}),fe=async Ae=>{await Y.from("newsletter_drive_links").delete().eq("newsletter_id",Ae),await Y.from("newsletter_pdfs").delete().eq("newsletter_id",Ae),await Y.from("newsletter_videos").delete().eq("newsletter_id",Ae),await Y.from("newsletter_canva_links").delete().eq("newsletter_id",Ae);for(const Le of U){const Ue=`${Ae}/${Date.now()}-${Le.file.name}`,{error:Pe}=await Y.storage.from("newsletter-content").upload(Ue,Le.file);if(!Pe){const{data:$e}=Y.storage.from("newsletter-content").getPublicUrl(Ue);N.push({name:Le.name,file_url:$e.publicUrl,file_size:Le.file.size,sort_order:N.length})}}v.length>0&&await Y.from("newsletter_drive_links").insert(v.map((Le,Ue)=>({newsletter_id:Ae,title:Le.title,drive_url:Le.drive_url,sort_order:Ue}))),N.length>0&&await Y.from("newsletter_pdfs").insert(N.map((Le,Ue)=>({newsletter_id:Ae,name:Le.name,file_url:Le.file_url,file_size:Le.file_size||null,sort_order:Ue}))),M.length>0&&await Y.from("newsletter_videos").insert(M.map((Le,Ue)=>({newsletter_id:Ae,title:Le.title,video_url:Le.video_url,sort_order:Ue}))),T.length>0&&await Y.from("newsletter_canva_links").insert(T.map((Le,Ue)=>({newsletter_id:Ae,title:Le.title,canva_share_link:Le.canva_share_link,sort_order:Ue})))},oe=async Ae=>{o(Ae),i({title:Ae.title,description:Ae.description||"",publish_date:rs(new Date(Ae.publish_date),"yyyy-MM-dd'T'HH:mm"),is_published:Ae.is_published}),y(Ae.preview_image_url),D(Ae.content_blocks||[]);const[Le,Ue,Pe,$e]=await Promise.all([Y.from("newsletter_drive_links").select("*").eq("newsletter_id",Ae.id).order("sort_order"),Y.from("newsletter_pdfs").select("*").eq("newsletter_id",Ae.id).order("sort_order"),Y.from("newsletter_videos").select("*").eq("newsletter_id",Ae.id).order("sort_order"),Y.from("newsletter_canva_links").select("*").eq("newsletter_id",Ae.id).order("sort_order")]);b(Le.data||[]),k(Ue.data||[]),E(Pe.data||[]),P($e.data||[]),q([]),n(!0)},ce=async Ae=>{const[Le,Ue,Pe,$e]=await Promise.all([Y.from("newsletter_drive_links").select("*").eq("newsletter_id",Ae.id).order("sort_order"),Y.from("newsletter_pdfs").select("*").eq("newsletter_id",Ae.id).order("sort_order"),Y.from("newsletter_videos").select("*").eq("newsletter_id",Ae.id).order("sort_order"),Y.from("newsletter_canva_links").select("*").eq("newsletter_id",Ae.id).order("sort_order")]);o(null),i({title:`${Ae.title} (Copy)`,description:Ae.description||"",publish_date:rs(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),y(Ae.preview_image_url),D(Ae.content_blocks||[]),b((Le.data||[]).map(({id:it,...xt})=>xt)),k((Ue.data||[]).map(({id:it,...xt})=>xt)),E((Pe.data||[]).map(({id:it,...xt})=>xt)),P(($e.data||[]).map(({id:it,...xt})=>xt)),q([]),n(!0)},de=()=>{n(!1),o(null),i({title:"",description:"",publish_date:rs(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),m(null),y(null),b([]),k([]),E([]),P([]),D([]),q([])},xe=async Ae=>{var Ue;const Le=(Ue=Ae.target.files)==null?void 0:Ue[0];Le&&(m(Le),y(URL.createObjectURL(Le)))},Me=async()=>{if(!l.title){e({title:"Title is required",variant:"destructive"});return}G(!0);let Ae=x;if(u){const Le=`previews/${Date.now()}-${u.name}`,{error:Ue}=await Y.storage.from("newsletter-content").upload(Le,u);if(!Ue){const{data:Pe}=Y.storage.from("newsletter-content").getPublicUrl(Le);Ae=Pe.publicUrl}}a?he.mutate({id:a.id,...l,preview_image_url:Ae,content_blocks:R}):ie.mutate({...l,preview_image_url:Ae,content_blocks:R}),G(!1)},ve=()=>b([...v,{title:"",drive_url:"",sort_order:v.length}]),be=()=>E([...M,{title:"",video_url:"",sort_order:M.length}]),we=()=>P([...T,{title:"",canva_share_link:"",sort_order:T.length}]),tt=Ae=>{const Le=Ae.target.files;if(!Le)return;const Ue=Array.from(Le).map(Pe=>({file:Pe,name:Pe.name.replace(/\.[^/.]+$/,"")}));q([...U,...Ue])};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(Eu,{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(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Total"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:(Q==null?void 0:Q.length)||0})})]}),r.jsxs(He,{children:[r.jsx(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:(Q==null?void 0:Q.filter(Ae=>Ae.is_published).length)||0})})]})]}),r.jsxs(Or,{open:s,onOpenChange:Ae=>!Ae&&de(),children:[r.jsx(vo,{asChild:!0,children:r.jsxs(X,{onClick:()=>n(!0),children:[r.jsx(vs,{className:"mr-2 h-4 w-4"})," Add Newsletter"]})}),r.jsxs(Pr,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Rr,{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(ot,{value:l.title,onChange:Ae=>i({...l,title:Ae.target.value}),placeholder:"Newsletter title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Publish Date"}),r.jsx(ot,{type:"datetime-local",value:l.publish_date,onChange:Ae=>i({...l,publish_date:Ae.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Description"}),r.jsx(Wf,{content:l.description,onChange:Ae=>i({...l,description:Ae}),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(en,{className:"h-3 w-3"})})]}),r.jsxs("div",{children:[r.jsx(ot,{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(so,{className:"mr-2 h-4 w-4"})," Upload Image"]})})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(In,{checked:l.is_published,onCheckedChange:Ae=>i({...l,is_published:Ae})}),r.jsx(ze,{children:"Published"})]}),r.jsx(n3t,{rows:R,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:we,children:[r.jsx(vs,{className:"mr-1 h-3 w-3"})," Add Canva Link"]})]}),T.map((Ae,Le)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(ot,{placeholder:"Link title",value:Ae.title,onChange:Ue=>{const Pe=[...T];Pe[Le].title=Ue.target.value,P(Pe)},className:"w-1/3"}),r.jsx(ot,{placeholder:"Canva share link",value:Ae.canva_share_link,onChange:Ue=>{const Pe=[...T];Pe[Le].canva_share_link=Ue.target.value,P(Pe)},className:"flex-1"}),r.jsx(X,{type:"button",variant:"ghost",size:"icon",onClick:()=>P(T.filter((Ue,Pe)=>Pe!==Le)),children:r.jsx(en,{className:"h-4 w-4"})})]},Le))]}),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:ve,children:[r.jsx(vs,{className:"mr-1 h-3 w-3"})," Add Link"]})]}),v.map((Ae,Le)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(ot,{placeholder:"Link title",value:Ae.title,onChange:Ue=>{const Pe=[...v];Pe[Le].title=Ue.target.value,b(Pe)},className:"w-1/3"}),r.jsx(ot,{placeholder:"Google Drive URL",value:Ae.drive_url,onChange:Ue=>{const Pe=[...v];Pe[Le].drive_url=Ue.target.value,b(Pe)},className:"flex-1"}),r.jsx(X,{type:"button",variant:"ghost",size:"icon",onClick:()=>b(v.filter((Ue,Pe)=>Pe!==Le)),children:r.jsx(en,{className:"h-4 w-4"})})]},Le))]}),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(ot,{type:"file",accept:".pdf",multiple:!0,onChange:tt,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(so,{className:"mr-1 h-3 w-3"})," Upload PDF"]})})]})]}),N.map((Ae,Le)=>r.jsxs("div",{className:"flex gap-2 items-center bg-muted/50 p-2 rounded",children:[r.jsx(ga,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-sm",children:Ae.name}),r.jsx(X,{type:"button",variant:"ghost",size:"icon",onClick:()=>k(N.filter((Ue,Pe)=>Pe!==Le)),children:r.jsx(en,{className:"h-4 w-4"})})]},`existing-${Le}`)),U.map((Ae,Le)=>r.jsxs("div",{className:"flex gap-2 items-center bg-muted/50 p-2 rounded",children:[r.jsx(ga,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ot,{value:Ae.name,onChange:Ue=>{const Pe=[...U];Pe[Le].name=Ue.target.value,q(Pe)},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:()=>q(U.filter((Ue,Pe)=>Pe!==Le)),children:r.jsx(en,{className:"h-4 w-4"})})]},`pending-${Le}`))]}),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:be,children:[r.jsx(vs,{className:"mr-1 h-3 w-3"})," Add Video"]})]}),M.map((Ae,Le)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(ot,{placeholder:"Video title",value:Ae.title,onChange:Ue=>{const Pe=[...M];Pe[Le].title=Ue.target.value,E(Pe)},className:"w-1/3"}),r.jsx(ot,{placeholder:"Video URL",value:Ae.video_url,onChange:Ue=>{const Pe=[...M];Pe[Le].video_url=Ue.target.value,E(Pe)},className:"flex-1"}),r.jsx(X,{type:"button",variant:"ghost",size:"icon",onClick:()=>E(M.filter((Ue,Pe)=>Pe!==Le)),children:r.jsx(en,{className:"h-4 w-4"})})]},Le))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[r.jsx(X,{variant:"outline",onClick:de,children:"Cancel"}),r.jsx(X,{onClick:Me,disabled:H||ie.isPending||he.isPending,children:H?"Uploading...":a?"Update":"Create"})]})]})]})]})]}),r.jsx(He,{children:r.jsx(Xe,{className:"p-0",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:ne?r.jsx(kr,{children:r.jsx(gt,{colSpan:4,className:"text-center py-8",children:"Loading..."})}):(Q==null?void 0:Q.length)===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:4,className:"text-center py-8 text-muted-foreground",children:"No newsletters yet. Create your first one!"})}):Q==null?void 0:Q.map(Ae=>r.jsxs(kr,{children:[r.jsx(gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Ae.preview_image_url?r.jsx("img",{src:Ae.preview_image_url,alt:Ae.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(ga,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Ae.title}),Ae.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:Ae.description.replace(/<[^>]*>/g,"")})]})]})}),r.jsx(gt,{children:rs(new Date(Ae.publish_date),"MMM d, yyyy")}),r.jsx(gt,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${Ae.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:Ae.is_published?"Published":"Draft"})}),r.jsx(gt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-1",children:[r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>oe(Ae),title:"Edit",children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>ce(Ae),title:"Duplicate",children:r.jsx(Mo,{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(Ae.id)},children:r.jsx(Bs,{className:"h-4 w-4"})})]})})]},Ae.id))})]})})})]})})}const hCe={open:{label:"Open",color:"bg-blue-100 text-blue-800"},under_review:{label:"Under Review",color:"bg-yellow-100 text-yellow-800"},planned:{label:"Planned",color:"bg-purple-100 text-purple-800"},in_progress:{label:"In Progress",color:"bg-orange-100 text-orange-800"},launched:{label:"Launched",color:"bg-green-100 text-green-800"},declined:{label:"Declined",color:"bg-gray-100 text-gray-800"}};function i3t(){const{user:e}=Yr(),{toast:t}=ci(),s=Hs(),n=Br(),[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:E}=Kt({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:q,error:H}=await U;if(H)throw H;const G=[...new Set((q==null?void 0:q.map(oe=>oe.user_id))||[])],{data:Q}=await Y.from("profiles").select("id, name").in("id",G),ne=new Map((Q==null?void 0:Q.map(oe=>[oe.id,oe]))||[]);let ie=[];if(e){const{data:oe}=await Y.from("wishlist_votes").select("item_id").eq("user_id",e.id);ie=(oe==null?void 0:oe.map(ce=>ce.item_id))||[]}const he=(q==null?void 0:q.map(oe=>oe.id))||[],{data:se}=await Y.from("wishlist_comments").select("item_id").in("item_id",he),fe=new Map;return se==null||se.forEach(oe=>{fe.set(oe.item_id,(fe.get(oe.item_id)||0)+1)}),q==null?void 0:q.map(oe=>{const ce=ne.get(oe.user_id),de=(ce==null?void 0:ce.name)||"Unknown";return{...oe,user_name:de,user_initials:de.split(" ").map(xe=>xe[0]).join("").toUpperCase().slice(0,2),has_voted:ie.includes(oe.id),comment_count:fe.get(oe.id)||0}})}}),T=ar({mutationFn:async({title:U,description:q})=>{const{error:H}=await Y.from("wishlist_items").insert({user_id:e.id,title:U,description:q});if(H)throw H},onSuccess:()=>{n.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:q})=>{if(q){const{error:H}=await Y.from("wishlist_votes").delete().eq("item_id",U).eq("user_id",e.id);if(H)throw H;return{itemId:U,wasAdded:!1}}else{const{error:H}=await Y.from("wishlist_votes").insert({item_id:U,user_id:e.id});if(H)throw H;return{itemId:U,wasAdded:!0}}},onSuccess:async U=>{if(n.invalidateQueries({queryKey:["wishlist-items"]}),U!=null&&U.wasAdded){const q=M.find(G=>G.id===U.itemId),H=((q==null?void 0:q.vote_count)||0)+1;Y.functions.invoke("wishlist-notify",{body:{itemId:U.itemId,voteCount:H}}).catch(console.error)}},onError:U=>{t({title:"Error",description:U.message,variant:"destructive"})}}),R=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(vo,{asChild:!0,children:r.jsxs(X,{className:"gap-2",children:[r.jsx(vs,{className:"h-4 w-4"}),"Add Idea"]})}),r.jsxs(Pr,{children:[r.jsx(zr,{children:r.jsx(Rr,{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(ot,{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(Ys,{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(Vr,{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(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search ideas...",value:a,onChange:U=>o(U.target.value),className:"pl-10"})]}),r.jsx("div",{className:"flex gap-2",children:r.jsx(Si,{value:l,onValueChange:U=>i(U),children:r.jsxs(ki,{children:[r.jsx(is,{value:"popular",children:"Most Popular"}),r.jsx(is,{value:"latest",children:"Latest"}),r.jsx(is,{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"})}),E?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(Vr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):R.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(vs,{className:"h-4 w-4 mr-2"}),"Add Idea"]})]}):r.jsx("div",{className:"space-y-3",children:R.map(U=>r.jsx("div",{className:"bg-card border rounded-lg p-4 hover:shadow-md transition-shadow cursor-pointer",onClick:()=>s(`/wishlist/${U.id}`),children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsxs("button",{onClick:q=>{q.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(hp,{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(Xn,{className:"h-10 w-10 bg-primary/20",children:r.jsx(Qn,{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",hCe[U.status].color),children:hCe[U.status].label})]}),r.jsx("p",{className:"text-muted-foreground text-sm line-clamp-2",children:U.description}),r.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:U.user_name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:new Date(U.created_at).toLocaleDateString()})]})]}),r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Bo,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:U.comment_count})]})]})},U.id))})]})})}const mCe={open:{label:"Open",color:"bg-blue-100 text-blue-800"},under_review:{label:"Under Review",color:"bg-yellow-100 text-yellow-800"},planned:{label:"Planned",color:"bg-purple-100 text-purple-800"},in_progress:{label:"In Progress",color:"bg-orange-100 text-orange-800"},launched:{label:"Launched",color:"bg-green-100 text-green-800"},declined:{label:"Declined",color:"bg-gray-100 text-gray-800"}};function o3t(){const{itemId:e}=hc(),t=Hs(),{user:s}=Yr(),{toast:n}=ci(),a=Br(),[o,l]=A.useState(""),{data:i=!1}=Kt({queryKey:["user-is-admin",s==null?void 0:s.id],queryFn:async()=>{if(!s)return!1;const{data:M,error:E}=await Y.from("user_roles").select("role").eq("user_id",s.id).eq("role","admin").maybeSingle();return!E&&!!M},enabled:!!s}),{data:u,isLoading:m}=Kt({queryKey:["wishlist-item",e],queryFn:async()=>{const{data:M,error:E}=await Y.from("wishlist_items").select("*").eq("id",e).single();if(E)throw E;const{data:T}=await Y.from("profiles").select("name").eq("id",M.user_id).single();let P=!1;if(s){const{data:R}=await Y.from("wishlist_votes").select("id").eq("item_id",e).eq("user_id",s.id).maybeSingle();P=!!R}return{...M,user_name:(T==null?void 0:T.name)||"Unknown",user_initials:((T==null?void 0:T.name)||"U").split(" ").map(R=>R[0]).join("").toUpperCase().slice(0,2),has_voted:P}}}),{data:x=[],isLoading:y}=Kt({queryKey:["wishlist-comments",e],queryFn:async()=>{const{data:M,error:E}=await Y.from("wishlist_comments").select("*").eq("item_id",e).order("created_at",{ascending:!0});if(E)throw E;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),R=new Map((P==null?void 0:P.map(D=>[D.id,D]))||[]);return M==null?void 0:M.map(D=>{const U=R.get(D.user_id),q=(U==null?void 0:U.name)||"Unknown";return{...D,user_name:q,user_initials:q.split(" ").map(H=>H[0]).join("").toUpperCase().slice(0,2)}})}}),v=ar({mutationFn:async M=>{if(M){const{error:E}=await Y.from("wishlist_votes").delete().eq("item_id",e).eq("user_id",s.id);if(E)throw E;return{wasAdded:!1}}else{const{error:E}=await Y.from("wishlist_votes").insert({item_id:e,user_id:s.id});if(E)throw E;return{wasAdded:!0}}},onSuccess:async M=>{if(a.invalidateQueries({queryKey:["wishlist-item",e]}),a.invalidateQueries({queryKey:["wishlist-items"]}),M!=null&&M.wasAdded&&u){const E=(u.vote_count||0)+1;Y.functions.invoke("wishlist-notify",{body:{itemId:e,voteCount:E}}).catch(console.error)}},onError:M=>{n({title:"Error",description:M.message,variant:"destructive"})}}),b=ar({mutationFn:async M=>{const{error:E}=await Y.from("wishlist_comments").insert({item_id:e,user_id:s.id,content:M});if(E)throw E},onSuccess:()=>{a.invalidateQueries({queryKey:["wishlist-comments",e]}),l(""),n({title:"Comment added!"})},onError:M=>{n({title:"Error",description:M.message,variant:"destructive"})}}),N=ar({mutationFn:async M=>{const{error:E}=await Y.from("wishlist_comments").delete().eq("id",M);if(E)throw E},onSuccess:()=>{a.invalidateQueries({queryKey:["wishlist-comments",e]}),n({title:"Comment deleted"})},onError:M=>{n({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(Cr,{className:"h-8 w-32 mb-6"}),r.jsx(Cr,{className:"h-48 w-full mb-6"}),r.jsx(Cr,{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(hp,{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",mCe[u.status].color),children:mCe[u.status].label})]}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap mb-4",children:u.description}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Xn,{className:"h-6 w-6",children:r.jsx(Qn,{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(Xre,{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(Vr,{className:"h-4 w-4 animate-spin"}):r.jsx(ro,{className:"h-4 w-4"})})]}),y?r.jsx("div",{className:"space-y-4",children:[1,2].map(M=>r.jsx(Cr,{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(Xn,{className:"h-8 w-8",children:r.jsx(Qn,{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(q0e,{content:M.content,className:"text-sm text-foreground"})]}),(s==null?void 0:s.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(Bs,{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 pCe={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"}},fCe=["open","under_review","planned","in_progress","launched","declined"];function l3t(){const{toast:e}=ci(),t=Hs(),s=Br(),[n,a]=A.useState(""),[o,l]=A.useState("all"),[i,u]=A.useState(!1),[m,x]=A.useState(null),{data:y=[],isLoading:v}=Kt({queryKey:["admin-wishlist-items"],queryFn:async()=>{const{data:E,error:T}=await Y.from("wishlist_items").select("*").order("vote_count",{ascending:!1});if(T)throw T;const P=[...new Set((E==null?void 0:E.map(G=>G.user_id))||[])],{data:R}=await Y.from("profiles").select("id, name, email").in("id",P),D=new Map((R==null?void 0:R.map(G=>[G.id,G]))||[]),U=(E==null?void 0:E.map(G=>G.id))||[],{data:q}=await Y.from("wishlist_comments").select("item_id").in("item_id",U),H=new Map;return q==null||q.forEach(G=>{H.set(G.item_id,(H.get(G.item_id)||0)+1)}),E==null?void 0:E.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:H.get(G.id)||0}})}}),b=ar({mutationFn:async({itemId:E,status:T})=>{const{error:P}=await Y.from("wishlist_items").update({status:T}).eq("id",E);if(P)throw P},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-wishlist-items"]}),e({title:"Status updated!"})},onError:E=>{e({title:"Error",description:E.message,variant:"destructive"})}}),N=ar({mutationFn:async E=>{const{error:T}=await Y.from("wishlist_items").delete().eq("id",E);if(T)throw T},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-wishlist-items"]}),u(!1),x(null),e({title:"Item deleted!"})},onError:E=>{e({title:"Error",description:E.message,variant:"destructive"})}}),k=y.filter(E=>{const T=E.title.toLowerCase().includes(n.toLowerCase())||E.description.toLowerCase().includes(n.toLowerCase())||E.user_name.toLowerCase().includes(n.toLowerCase()),P=o==="all"||E.status===o;return T&&P}),M={total:y.length,open:y.filter(E=>E.status==="open").length,inProgress:y.filter(E=>E.status==="in_progress").length,launched:y.filter(E=>E.status==="launched").length,highVotes:y.filter(E=>E.vote_count>=10).length};return r.jsx(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(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search ideas, users...",value:n,onChange:E=>a(E.target.value),className:"pl-10"})]}),r.jsxs(us,{value:o,onValueChange:E=>l(E),children:[r.jsx(cs,{className:"w-[180px]",children:r.jsx(ms,{placeholder:"Filter by status"})}),r.jsxs(ds,{children:[r.jsx($t,{value:"all",children:"All Statuses"}),fCe.map(E=>r.jsx($t,{value:E,children:pCe[E].label},E))]})]})]}),v?r.jsx("div",{className:"space-y-2",children:[1,2,3,4,5].map(E=>r.jsx(Cr,{className:"h-16 w-full"},E))}):r.jsx("div",{className:"bg-card border rounded-lg overflow-hidden",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:k.length===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No items found"})}):k.map(E=>r.jsxs(kr,{className:Ut(E.vote_count>=10&&"bg-primary/5"),children:[r.jsx(gt,{children:r.jsx(Tt,{variant:E.vote_count>=10?"default":"secondary",children:E.vote_count})}),r.jsx(gt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium line-clamp-1",children:E.title}),r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:E.description})]})}),r.jsx(gt,{className:"hidden md:table-cell",children:r.jsxs("div",{children:[r.jsx("p",{className:"text-sm",children:E.user_name}),r.jsx("p",{className:"text-xs text-muted-foreground",children:E.user_email})]})}),r.jsx(gt,{className:"hidden sm:table-cell",children:E.comment_count}),r.jsx(gt,{children:r.jsxs(us,{value:E.status,onValueChange:T=>b.mutate({itemId:E.id,status:T}),children:[r.jsx(cs,{className:"w-[140px] h-8",children:r.jsx(ms,{})}),r.jsx(ds,{children:fCe.map(T=>r.jsx($t,{value:T,children:pCe[T].label},T))})]})}),r.jsx(gt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>window.open(`/wishlist/${E.id}`,"_blank"),children:r.jsx(Sn,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{x(E.id),u(!0)},children:r.jsx(Bs,{className:"h-4 w-4"})})]})})]},E.id))})]})}),r.jsx(Or,{open:i,onOpenChange:u,children:r.jsxs(Pr,{children:[r.jsx(zr,{children:r.jsx(Rr,{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(Vr,{className:"h-4 w-4 mr-2 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})})}function c3t(){const{user:e}=Yr(),[t,s]=A.useState([]),[n,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(""),[E,T]=A.useState(""),[P,R]=A.useState(""),[D,U]=A.useState(""),[q,H]=A.useState(!1),[G,Q]=A.useState(""),[ne,ie]=A.useState("once"),[he,se]=A.useState([]),[fe,oe]=A.useState([]),[ce,de]=A.useState(!1),[xe,Me]=A.useState(!1),[ve,be]=A.useState([]),[we,tt]=A.useState({total:0,dismissed:0});A.useEffect(()=>{Ae()},[]);const Ae=async()=>{const{data:De,error:Ke}=await Y.from("levelup_briefs").select("*").order("created_at",{ascending:!1});Ke?(Te.error("Failed to fetch briefs"),console.error(Ke)):s(De||[]),a(!1)},Le=()=>{N(""),M(""),T(""),R(""),U(""),H(!1),Q(new Date().toISOString().slice(0,16)),ie("once"),se([]),oe([]),u(null)},Ue=()=>{Le(),l(!0)},Pe=async De=>{u(De),N(De.title),M(De.description||""),T(De.video_url||""),R(De.graphic_url||""),U(De.graphic_link_url||""),H(De.is_published),Q(De.publish_date.slice(0,16)),ie(De.show_frequency);const{data:Ke}=await Y.from("levelup_brief_links").select("*").eq("brief_id",De.id).order("sort_order");se((Ke==null?void 0:Ke.map(dt=>({title:dt.title,url:dt.url})))||[]);const{data:st}=await Y.from("levelup_brief_polls").select("*").eq("brief_id",De.id).order("sort_order");if(st){const dt=[];for(const ct of st){const{data:zt}=await Y.from("levelup_brief_poll_options").select("*").eq("poll_id",ct.id).order("sort_order");dt.push({question:ct.question,poll_type:ct.poll_type,options:(zt==null?void 0:zt.map(ir=>ir.option_text))||[]})}oe(dt)}l(!0)},$e=async De=>{var st;const Ke=(st=De.target.files)==null?void 0:st[0];if(Ke){de(!0);try{const dt=await Y.functions.invoke("bunny-upload",{body:{action:"create",title:Ke.name.replace(/\.[^/.]+$/,"")}});if(dt.error)throw dt.error;const{videoId:ct,libraryId:zt}=dt.data,ir=await Y.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:ct}});if(ir.error)throw ir.error;const{uploadUrl:Tr,apiKey:Zr}=ir.data,$r=new XMLHttpRequest;await new Promise((Xs,Ot)=>{$r.upload.addEventListener("progress",Hr=>{if(Hr.lengthComputable){const Ts=Math.round(Hr.loaded/Hr.total*100);console.log("Upload progress:",Ts)}}),$r.addEventListener("load",()=>{$r.status>=200&&$r.status<300?Xs():Ot(new Error(`Upload failed with status ${$r.status}`))}),$r.addEventListener("error",()=>Ot(new Error("Upload failed"))),$r.open("PUT",Tr),$r.setRequestHeader("AccessKey",Zr),$r.send(Ke)});const ns=`https://player.mediadelivery.net/embed/${zt}/${ct}`;T(ns),Te.success("Video uploaded successfully! It may take a few minutes to process.")}catch(dt){console.error("Upload error:",dt),Te.error("Failed to upload video")}finally{de(!1)}}},it=async()=>{if(!b.trim()){Te.error("Title is required");return}try{let De;if(i){const{error:Ke}=await Y.from("levelup_briefs").update({title:b,description:k||null,video_url:E||null,graphic_url:P||null,graphic_link_url:D||null,is_published:q,publish_date:G,show_frequency:ne}).eq("id",i.id);if(Ke)throw Ke;De=i.id,await Y.from("levelup_brief_links").delete().eq("brief_id",De);const{data:st}=await Y.from("levelup_brief_polls").select("id").eq("brief_id",De);if(st)for(const dt of st)await Y.from("levelup_brief_poll_options").delete().eq("poll_id",dt.id);await Y.from("levelup_brief_polls").delete().eq("brief_id",De)}else{const{data:Ke,error:st}=await Y.from("levelup_briefs").insert({title:b,description:k||null,video_url:E||null,graphic_url:P||null,graphic_link_url:D||null,is_published:q,publish_date:G,show_frequency:ne,created_by:e==null?void 0:e.id}).select().single();if(st)throw st;De=Ke.id}if(he.length>0){const Ke=he.map((st,dt)=>({brief_id:De,title:st.title,url:st.url,sort_order:dt}));await Y.from("levelup_brief_links").insert(Ke)}for(let Ke=0;Ke0){const zt=st.options.map((ir,Tr)=>({poll_id:dt.id,option_text:ir,sort_order:Tr}));await Y.from("levelup_brief_poll_options").insert(zt)}}Te.success(i?"Brief updated":"Brief created"),l(!1),Le(),Ae()}catch(De){console.error("Error saving brief:",De),Te.error("Failed to save brief")}},xt=async De=>{if(confirm("Are you sure you want to delete this brief?"))try{const{error:Ke}=await Y.from("levelup_briefs").delete().eq("id",De);if(Ke)throw Ke;Te.success("Brief deleted"),Ae()}catch(Ke){console.error("Error deleting brief:",Ke),Te.error("Failed to delete brief")}},Ee=async De=>{v(De);const{count:Ke}=await Y.from("levelup_brief_views").select("*",{count:"exact",head:!0}).eq("brief_id",De.id),{count:st}=await Y.from("levelup_brief_views").select("*",{count:"exact",head:!0}).eq("brief_id",De.id).not("dismissed_at","is",null);tt({total:Ke||0,dismissed:st||0});const{data:dt}=await Y.from("levelup_brief_polls").select("*").eq("brief_id",De.id).order("sort_order");if(dt){const ct=[];for(const zt of dt){const{data:ir}=await Y.from("levelup_brief_poll_options").select("*").eq("poll_id",zt.id).order("sort_order"),{data:Tr}=await Y.from("levelup_brief_poll_responses").select("option_id, user_id").eq("poll_id",zt.id),Zr=[...new Set((Tr==null?void 0:Tr.map(Hr=>Hr.user_id))||[])];let $r={};if(Zr.length>0){const{data:Hr}=await Y.from("profiles").select("id, name, email").in("id",Zr);Hr&&Hr.forEach(Ts=>{$r[Ts.id]=Ts.name||Ts.email||"Unknown"})}const ns=(Tr||[]).map(Hr=>({optionId:Hr.option_id,userName:$r[Hr.user_id]||"Unknown",userId:Hr.user_id})),Xs={};let Ot=0;ir&&ir.forEach(Hr=>{const Ts=(Tr==null?void 0:Tr.filter(zs=>zs.option_id===Hr.id).length)||0;Xs[Hr.id]=Ts,Ot+=Ts}),ct.push({...zt,options:ir||[],results:Xs,respondents:ns,totalResponses:zt.poll_type==="single"?new Set(Tr==null?void 0:Tr.map(Hr=>Hr.user_id)).size:Ot})}be(ct)}x(!0)},et=()=>{se([...he,{title:"",url:""}])},le=(De,Ke,st)=>{const dt=[...he];dt[De][Ke]=st,se(dt)},Ve=De=>{se(he.filter((Ke,st)=>st!==De))},Je=()=>{oe([...fe,{question:"",poll_type:"single",options:["",""]}])},rt=(De,Ke)=>{const st=[...fe];st[De].question=Ke,oe(st)},je=(De,Ke)=>{const st=[...fe];st[De].poll_type=Ke,oe(st)},lt=De=>{const Ke=[...fe];Ke[De].options.push(""),oe(Ke)},Ce=(De,Ke,st)=>{const dt=[...fe];dt[De].options[Ke]=st,oe(dt)},Ie=(De,Ke)=>{const st=[...fe];st[De].options=st[De].options.filter((dt,ct)=>ct!==Ke),oe(st)},Ze=De=>{oe(fe.filter((Ke,st)=>st!==De))};return r.jsxs(Dr,{title:"The LevelUp Brief",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(Eu,{title:"The LevelUp Brief",description:"Create engaging popup briefs for your agents",children:r.jsxs(X,{onClick:Ue,children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Create Brief"]})}),r.jsx(He,{children:r.jsx(Xe,{className:"p-0",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:n?r.jsx(kr,{children:r.jsx(gt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):t.length===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No briefs created yet"})}):t.map(De=>r.jsxs(kr,{children:[r.jsx(gt,{className:"font-medium",children:De.title}),r.jsx(gt,{children:r.jsx(Tt,{variant:De.is_published?"default":"secondary",children:De.is_published?"Published":"Draft"})}),r.jsx(gt,{className:"capitalize",children:De.show_frequency.replace("_"," ")}),r.jsx(gt,{children:rs(new Date(De.publish_date),"MMM d, yyyy h:mm a")}),r.jsx(gt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>Ee(De),children:r.jsx(wc,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>Pe(De),children:r.jsx(vc,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>xt(De.id),children:r.jsx(Bs,{className:"h-4 w-4 text-destructive"})})]})})]},De.id))})]})})})]}),r.jsx(Or,{open:o,onOpenChange:l,children:r.jsxs(Pr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Rr,{children:i?"Edit Brief":"Create New Brief"})}),r.jsxs(Si,{defaultValue:"content",className:"w-full",children:[r.jsxs(ki,{className:"grid w-full grid-cols-4",children:[r.jsx(is,{value:"content",children:"Content"}),r.jsx(is,{value:"media",children:"Media"}),r.jsx(is,{value:"links",children:"Links"}),r.jsx(is,{value:"polls",children:"Polls"})]}),r.jsxs(Ss,{value:"content",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Title *"}),r.jsx(ot,{value:b,onChange:De=>N(De.target.value),placeholder:"What's happening at LevelUp..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Description"}),r.jsx(Wf,{content:k,onChange:De=>M(De),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(ot,{type:"datetime-local",value:G,onChange:De=>Q(De.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Show Frequency"}),r.jsxs(us,{value:ne,onValueChange:ie,children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsxs(ds,{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(In,{checked:q,onCheckedChange:H}),r.jsx(ze,{children:"Publish immediately"})]})]}),r.jsxs(Ss,{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(ot,{type:"file",accept:"video/*",onChange:$e,disabled:ce})}),ce&&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(ot,{value:E,onChange:De=>T(De.target.value),placeholder:"https://iframe.mediadelivery.net/embed/..."})]}),E&&r.jsx("div",{className:"aspect-video rounded-lg overflow-hidden bg-muted",children:r.jsx("iframe",{src:E,className:"w-full h-full",allow:"autoplay; fullscreen",allowFullScreen:!0})})]}),r.jsxs("div",{className:"border-t pt-4 space-y-4",children:[r.jsx("h4",{className:"font-semibold text-sm text-foreground",children:"Graphic / Image (optional)"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Upload Image"}),r.jsx("div",{className:"flex gap-2",children:r.jsx(ot,{type:"file",accept:"image/*",onChange:async De=>{var st;const Ke=(st=De.target.files)==null?void 0:st[0];if(Ke){Me(!0);try{const dt=Ke.name.split(".").pop(),ct=`brief-graphics/${Date.now()}.${dt}`,{error:zt}=await Y.storage.from("banner-images").upload(ct,Ke,{upsert:!0});if(zt)throw zt;const{data:ir}=Y.storage.from("banner-images").getPublicUrl(ct);R(ir.publicUrl),Te.success("Image uploaded!")}catch(dt){console.error(dt),Te.error("Failed to upload image")}finally{Me(!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(ot,{value:P,onChange:De=>R(De.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(ot,{value:D,onChange:De=>U(De.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(Ss,{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:et,children:[r.jsx(vs,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),he.map((De,Ke)=>r.jsxs("div",{className:"flex gap-2 items-start",children:[r.jsx(ot,{value:De.title,onChange:st=>le(Ke,"title",st.target.value),placeholder:"Link title",className:"flex-1"}),r.jsx(ot,{value:De.url,onChange:st=>le(Ke,"url",st.target.value),placeholder:"https://...",className:"flex-[2]"}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>Ve(Ke),children:r.jsx(Bs,{className:"h-4 w-4 text-destructive"})})]},Ke)),he.length===0&&r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No links added yet"})]}),r.jsxs(Ss,{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:Je,children:[r.jsx(vs,{className:"h-4 w-4 mr-1"}),"Add Poll"]})]}),fe.map((De,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(ot,{value:De.question,onChange:st=>rt(Ke,st.target.value),placeholder:"Poll question...",className:"flex-1 mr-2"}),r.jsxs(us,{value:De.poll_type,onValueChange:st=>je(Ke,st),children:[r.jsx(cs,{className:"w-32",children:r.jsx(ms,{})}),r.jsxs(ds,{children:[r.jsx($t,{value:"single",children:"Single"}),r.jsx($t,{value:"multi",children:"Multi-select"})]})]}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>Ze(Ke),children:r.jsx(Bs,{className:"h-4 w-4 text-destructive"})})]}),r.jsxs("div",{className:"space-y-2 pl-4",children:[De.options.map((st,dt)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ot,{value:st,onChange:ct=>Ce(Ke,dt,ct.target.value),placeholder:`Option ${dt+1}`}),De.options.length>2&&r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>Ie(Ke,dt),children:r.jsx(Bs,{className:"h-4 w-4 text-muted-foreground"})})]},dt)),r.jsxs(X,{variant:"ghost",size:"sm",onClick:()=>lt(Ke),children:[r.jsx(vs,{className:"h-4 w-4 mr-1"}),"Add Option"]})]})]})},Ke)),fe.length===0&&r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No polls added yet"})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[r.jsx(X,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsx(X,{onClick:it,children:i?"Update Brief":"Create Brief"})]})]})}),r.jsx(Or,{open:m,onOpenChange:x,children:r.jsxs(Pr,{className:"max-w-2xl",children:[r.jsx(zr,{children:r.jsxs(Rr,{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(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Total Views"})}),r.jsx(Xe,{children:r.jsx("p",{className:"text-2xl font-bold",children:we.total})})]}),r.jsxs(He,{children:[r.jsx(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Dismissed"})}),r.jsx(Xe,{children:r.jsx("p",{className:"text-2xl font-bold",children:we.dismissed})})]})]}),ve.length>0?r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold",children:"Poll Results"}),ve.map(De=>r.jsxs(He,{className:"p-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:De.question}),r.jsx("div",{className:"space-y-2",children:De.options.map(Ke=>{const st=De.results[Ke.id]||0,dt=De.totalResponses>0?Math.round(st/De.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:[st," (",dt,"%)"]})]}),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:`${dt}%`}})}),st>0&&r.jsx("div",{className:"flex flex-wrap gap-1 pt-1",children:(De.respondents||[]).filter(ct=>ct.optionId===Ke.id).map((ct,zt)=>r.jsx(Tt,{variant:"secondary",className:"text-xs font-normal",children:ct.userName},zt))})]},Ke.id)})})]},De.id))]}):r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No polls in this brief"})]})]})})]})}const d3t=()=>{const{user:e}=Yr(),{toast:t}=ci(),s=Br(),[n,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}=Kt({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 H=D.image.name.split(".").pop(),G=`${Date.now()}-${Math.random().toString(36).substring(7)}.${H}`,{error:Q}=await Y.storage.from("service-images").upload(G,D.image);if(Q)throw Q;const{data:ne}=Y.storage.from("service-images").getPublicUrl(G);U=ne.publicUrl}const q={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:H}=await Y.from("additional_services").update(q).eq("id",D.itemId);if(H)throw H}else{const{error:H}=await Y.from("additional_services").insert(q);if(H)throw H}},onSuccess:()=>{s.invalidateQueries({queryKey:["additional-services-admin"]}),s.invalidateQueries({queryKey:["additional-services"]}),t({title:o?"Service updated":"Service created"}),a(!1),E()},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:()=>{s.invalidateQueries({queryKey:["additional-services-admin"]}),s.invalidateQueries({queryKey:["additional-services"]}),t({title:"Service deleted"})},onError:D=>{t({title:"Error deleting service",description:D.message,variant:"destructive"})}}),E=()=>{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 q;const U=(q=D.target.files)==null?void 0:q[0];U&&(x(U),v(URL.createObjectURL(U)))},R=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(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Total Services"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:b.length})})]}),r.jsxs(He,{children:[r.jsx(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:b.filter(D=>D.is_published).length})})]})]}),r.jsxs(Or,{open:n,onOpenChange:D=>{a(D),D||E()},children:[r.jsx(vo,{asChild:!0,children:r.jsxs(X,{className:"gap-2",children:[r.jsx(vs,{className:"h-4 w-4"}),"Add Service"]})}),r.jsxs(Pr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Rr,{children:o?"Edit Service":"Add New Service"})}),r.jsxs("form",{onSubmit:R,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"name",children:"Name *"}),r.jsx(ot,{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(Wf,{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(ot,{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(ot,{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(In,{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(en,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:[r.jsx(El,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx(ot,{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(Xe,{className:"p-0",children:N?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):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(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:b.map(D=>r.jsxs(kr,{children:[r.jsx(gt,{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(El,{className:"h-5 w-5 text-muted-foreground"})})}),r.jsx(gt,{className:"font-medium",children:D.name}),r.jsx(gt,{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(Sn,{className:"h-3 w-3"}),"Link"]})}),r.jsx(gt,{children:new Date(D.publish_date).toLocaleDateString()}),r.jsx(gt,{children:r.jsx(Tt,{variant:D.is_published?"default":"secondary",children:D.is_published?"Published":"Draft"})}),r.jsx(gt,{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(Bs,{className:"h-4 w-4 text-destructive"})})]})})]},D.id))})]})})})]})})};function u3t(){const{toast:e}=ci(),[t,s]=A.useState([]),[n,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:E}=await Y.functions.invoke("stripe-manage-coupons",{body:{action:"list"}});if(E)throw E;s(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:E,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:E}=await Y.functions.invoke("stripe-manage-coupons",{body:{action:"delete",couponId:M}});if(E)throw E;e({title:"Success",description:"Coupon deleted successfully"}),y()}catch(E){console.error("Error deleting coupon:",E),e({title:"Error",description:E.message||"Failed to delete coupon",variant:"destructive"})}},N=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(Eu,{title:"Subscription Discounts",description:"Create and manage discount coupons for subscriptions",children:r.jsxs(Or,{open:i,onOpenChange:u,children:[r.jsx(vo,{asChild:!0,children:r.jsxs(X,{children:[r.jsx(vs,{className:"mr-2 h-4 w-4"}),"Create Coupon"]})}),r.jsxs(Pr,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Create New Coupon"}),r.jsx(Zs,{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(ot,{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(ot,{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(us,{value:m.discountType,onValueChange:M=>{const E=M==="amount"&&m.duration==="forever"?"once":m.duration;x({...m,discountType:M,duration:E})},children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsxs(ds,{children:[r.jsx($t,{value:"percent",children:r.jsxs("span",{className:"flex items-center",children:[r.jsx(FS,{className:"mr-2 h-4 w-4"}),"Percentage Off"]})}),r.jsx($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(ot,{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(ot,{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(us,{value:m.duration,onValueChange:M=>x({...m,duration:M}),children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsxs(ds,{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(ot,{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(Vr,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Coupon"})]})]})]})}),r.jsxs(He,{children:[r.jsxs(Vt,{children:[r.jsx(Gt,{children:"Active Coupons"}),r.jsx(Ns,{children:"Share coupon codes with users to give them discounts on subscriptions"})]}),r.jsx(Xe,{children:n?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Vr,{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(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:t.map(M=>{var E;return r.jsxs(kr,{children:[r.jsx(gt,{className:"font-mono font-medium",children:((E=M.promotion_codes)==null?void 0:E.length)>0?M.promotion_codes.join(", "):r.jsx("span",{className:"text-muted-foreground text-xs",children:"No promo code"})}),r.jsx(gt,{children:M.name||"-"}),r.jsx(gt,{children:N(M)}),r.jsx(gt,{children:k(M)}),r.jsx(gt,{children:M.times_redeemed}),r.jsx(gt,{children:r.jsx(Tt,{variant:M.valid?"default":"secondary",children:M.valid?"Active":"Inactive"})}),r.jsx(gt,{className:"text-right",children:r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>b(M.id),children:r.jsx(Bs,{className:"h-4 w-4 text-destructive"})})})]},M.id)})})]})})]}),r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsx(Gt,{children:"How to Use Coupons"})}),r.jsxs(Xe,{className:"text-sm text-muted-foreground space-y-2",children:[r.jsx("p",{children:"1. Create a coupon above with your desired discount."}),r.jsx("p",{children:'2. Share the coupon code (shown in the "Code" column) with users.'}),r.jsx("p",{children:"3. Users can enter the code during checkout to receive the discount."}),r.jsx("p",{children:"4. Alternatively, you can create a promotion code in Stripe dashboard for public-facing promotions."})]})]})]})})}const zde={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 h3t(){const[e,t]=A.useState(""),[s,n]=A.useState("all"),[a,o]=A.useState(null),{data:l,isLoading:i,refetch:u}=Kt({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}=Kt({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 E=>{const{data:T}=await Y.from("profiles").select("id, name, email, subscription_status, subscription_product_id").eq("brokerage_id",E.id),{data:P}=await Y.from("user_roles").select("user_id").eq("role","brokerage_manager"),R=(P==null?void 0:P.map(q=>q.user_id))||[],D=(T==null?void 0:T.filter(q=>R.includes(q.id)))||[],U=(T==null?void 0:T.length)||0;return{...E,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=zde[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,E;if(!(((M=N.name)==null?void 0:M.toLowerCase().includes(e.toLowerCase()))||((E=N.email)==null?void 0:E.toLowerCase().includes(e.toLowerCase()))))return!1;switch(x(N),s){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(Eu,{title:"Subscription Management",description:"Track and manage all subscriptions",children:r.jsxs(X,{onClick:()=>u(),variant:"outline",size:"sm",children:[r.jsx(Go,{className:"h-4 w-4 mr-2"}),"Refresh"]})}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-7 gap-4",children:[r.jsx(He,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(qs,{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(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(mp,{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(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ra,{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(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(V1,{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(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(pi,{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(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Kj,{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(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(pi,{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(Si,{defaultValue:"users",className:"space-y-4",children:[r.jsxs(ki,{children:[r.jsx(is,{value:"users",children:"All Users"}),r.jsx(is,{value:"brokerages",children:"Brokerages"})]}),r.jsxs(Ss,{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(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by name or email...",value:e,onChange:N=>t(N.target.value),className:"pl-9"})]}),r.jsxs(us,{value:s,onValueChange:N=>n(N),children:[r.jsx(cs,{className:"w-[200px]",children:r.jsx(ms,{placeholder:"Filter by status"})}),r.jsxs(ds,{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(Xe,{className:"p-0",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:i?r.jsx(kr,{children:r.jsx(gt,{colSpan:6,className:"text-center py-8",children:"Loading subscriptions..."})}):(y==null?void 0:y.length)===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No users found"})}):y==null?void 0:y.map(N=>{var E,T;const k=x(N),M=zde[N.subscription_product_id];return r.jsxs(kr,{children:[r.jsx(gt,{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(gt,{children:r.jsx(Tt,{variant:k.variant,children:k.badge})}),r.jsx(gt,{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(gt,{children:(E=N.brokerages)!=null&&E.name?r.jsx("span",{className:"text-sm",children:N.brokerages.name}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),r.jsx(gt,{children:N.subscription_end_date?r.jsx("span",{className:"text-sm",children:rs(new Date(N.subscription_end_date),"MMM d, yyyy")}):N.trial_expires_at?r.jsxs("span",{className:"text-sm text-blue-600",children:["Trial: ",rs(new Date(N.trial_expires_at),"MMM d, yyyy")]}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),r.jsx(gt,{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(Sn,{className:"h-4 w-4"})}),r.jsxs(Or,{children:[r.jsx(vo,{asChild:!0,children:r.jsx(X,{variant:"outline",size:"sm",onClick:()=>o(N),children:"Details"})}),r.jsxs(Pr,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Subscription Details"}),r.jsxs(Zs,{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:rs(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:rs(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(Sn,{className:"h-4 w-4 mr-2"}),"View in Stripe Dashboard"]})]})]})]})]})})]},N.id)})})]})})})]}),r.jsx(Ss,{value:"brokerages",className:"space-y-4",children:r.jsx("div",{className:"grid gap-4",children:m==null?void 0:m.map(N=>{var M,E;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(Vt,{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(pi,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Gt,{className:"text-lg",children:N.name}),r.jsxs(Ns,{children:[N.agentCount," agents"]})]})]}),r.jsx(Tt,{variant:k?"default":"outline",children:k?"Active Subscription":"No Active Subscription"})]})}),r.jsx(Xe,{children:((E=N.managers)==null?void 0:E.length)>0?r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Managers:"}),N.managers.map(T=>{const P=zde[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 m3t(){const[e,t]=A.useState([]),[s,n]=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,E=(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:E,cancelled:T,totalDiscounts:M*25})}catch(N){console.error("Error fetching referrals:",N),Te.error("Failed to load referrals")}finally{n(!1)}},y=async()=>{try{Te.loading("Processing qualifications...");const{error:N}=await Y.functions.invoke("process-referral-qualifications");if(N)throw N;Te.dismiss(),Te.success("Qualifications processed successfully"),x()}catch(N){Te.dismiss(),console.error("Error processing qualifications:",N),Te.error("Failed to process qualifications")}},v=e.filter(N=>{var E,T,P,R,D,U;const k=((T=(E=N.referrer_brokerage)==null?void 0:E.name)==null?void 0:T.toLowerCase().includes(a.toLowerCase()))||((R=(P=N.referred_brokerage)==null?void 0:P.name)==null?void 0:R.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(ii,{className:"h-3 w-3 mr-1"}),"Qualified"]});case"pending":return r.jsxs(Tt,{variant:"secondary",children:[r.jsx(Ra,{className:"h-3 w-3 mr-1"}),"Pending"]});case"cancelled":return r.jsxs(Tt,{variant:"destructive",children:[r.jsx(jc,{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(Eu,{title:"Referral Program",description:"Track and manage brokerage referrals",children:r.jsxs(X,{onClick:y,variant:"outline",children:[r.jsx(Go,{className:"h-4 w-4 mr-2"}),"Process Qualifications"]})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4",children:[r.jsx(He,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(qs,{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(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ii,{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(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ra,{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(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(jc,{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(Xe,{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(Vt,{children:[r.jsx(Gt,{children:"All Referrals"}),r.jsx(Ns,{children:"View and manage all referral relationships"})]}),r.jsxs(Xe,{children:[r.jsxs("div",{className:"flex gap-4 mb-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by brokerage or email...",value:a,onChange:N=>o(N.target.value),className:"pl-10"})]}),r.jsxs(us,{value:l,onValueChange:i,children:[r.jsx(cs,{className:"w-[180px]",children:r.jsx(ms,{placeholder:"Filter by status"})}),r.jsxs(ds,{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"})]})]})]}),s?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(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:v.length===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No referrals found"})}):v.map(N=>{var k,M,E,T;return r.jsxs(kr,{children:[r.jsx(gt,{className:"font-medium",children:((k=N.referrer_brokerage)==null?void 0:k.name)||"Unknown"}),r.jsx(gt,{children:r.jsxs("div",{children:[r.jsx("p",{children:((M=N.referred_brokerage)==null?void 0:M.name)||((E=N.referred_user)==null?void 0:E.name)||"Pending setup"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(T=N.referred_user)==null?void 0:T.email})]})}),r.jsx(gt,{children:rs(new Date(N.signup_date),"MMM d, yyyy")}),r.jsx(gt,{children:b(N.status)}),r.jsx(gt,{children:N.qualified_date?rs(new Date(N.qualified_date),"MMM d, yyyy"):"-"}),r.jsx(gt,{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 Bde=[{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"}],p3t=[{value:"brokerage_manager",label:"Brokerage Manager"},{value:"agent",label:"Agent"}];function f3t(){const[e,t]=A.useState([]),[s,n]=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),Te.error("Failed to load checklist items")}finally{n(!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()){Te.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;Te.success("Checklist item updated")}else{const T=e.filter(R=>R.target_role===u.target_role).reduce((R,D)=>Math.max(R,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;Te.success("Checklist item created")}o(!1),x()}catch(T){console.error("Error saving checklist item:",T),Te.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;Te.success("Checklist item deleted"),x()}catch(P){console.error("Error deleting checklist item:",P),Te.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;Te.success(T.is_active?"Item deactivated":"Item activated"),x()}catch(P){console.error("Error toggling item:",P),Te.error("Failed to update item")}},M=e.filter(T=>T.target_role==="brokerage_manager"),E=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(vs,{className:"h-4 w-4"}),"Add Item"]})]}),r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Tt,{variant:"secondary",children:"Brokerage Manager"}),"Checklist Items"]})}),r.jsx(Xe,{children:M.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No checklist items for brokerage managers"}):r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:M.map((T,P)=>{var R;return r.jsxs(kr,{children:[r.jsx(gt,{className:"text-muted-foreground",children:P+1}),r.jsx(gt,{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(gt,{children:r.jsx(Tt,{variant:"outline",children:((R=Bde.find(D=>D.value===T.action_type))==null?void 0:R.label)||T.action_type})}),r.jsx(gt,{children:r.jsx(In,{checked:T.is_active,onCheckedChange:()=>k(T)})}),r.jsx(gt,{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(Bs,{className:"h-4 w-4 text-destructive"})})]})})]},T.id)})})]})})]}),r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Tt,{variant:"secondary",children:"Agent"}),"Checklist Items"]})}),r.jsx(Xe,{children:E.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No checklist items for agents"}):r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:E.map((T,P)=>{var R;return r.jsxs(kr,{children:[r.jsx(gt,{className:"text-muted-foreground",children:P+1}),r.jsx(gt,{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(gt,{children:r.jsx(Tt,{variant:"outline",children:((R=Bde.find(D=>D.value===T.action_type))==null?void 0:R.label)||T.action_type})}),r.jsx(gt,{children:r.jsx(In,{checked:T.is_active,onCheckedChange:()=>k(T)})}),r.jsx(gt,{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(Bs,{className:"h-4 w-4 text-destructive"})})]})})]},T.id)})})]})})]})]}),r.jsx(Or,{open:a,onOpenChange:o,children:r.jsxs(Pr,{children:[r.jsx(zr,{children:r.jsx(Rr,{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(ot,{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(Ys,{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(us,{value:u.target_role,onValueChange:T=>m({...u,target_role:T}),children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsx(ds,{children:p3t.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(us,{value:u.action_type,onValueChange:T=>m({...u,action_type:T}),children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsx(ds,{children:Bde.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(In,{id:"is_active",checked:u.is_active,onCheckedChange:T=>m({...u,is_active:T})}),r.jsx(ze,{htmlFor:"is_active",children:"Active"})]})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(X,{onClick:b,children:l?"Save Changes":"Create Item"})]})]})})]})}function g3t(){const[e,t]=A.useState(""),[s,n]=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}=Kt({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}}),E=async G=>{let ne=[],ie=0,he=!0;for(;he;){const{data:se,error:fe}=await G(ie,ie+1e3-1);if(fe)throw fe;se&&se.length>0?(ne=[...ne,...se],ie+=1e3,he=se.length===1e3):he=!1}return ne},{data:T,isLoading:P}=Kt({queryKey:["admin-agent-os-user-stats"],queryFn:async()=>{const G=await E((we,tt)=>Y.from("profiles").select("id, name, email, brokerage_id, created_at").range(we,tt)),{data:Q}=await Y.from("brokerages").select("id, name"),ne=new Map((Q==null?void 0:Q.map(we=>[we.id,we.name]))||[]),{data:ie}=await Y.rpc("get_admin_contact_counts"),he=new Map;ie==null||ie.forEach(we=>{he.set(we.owner_user_id,we.contact_count)});const{data:se}=await Y.rpc("get_admin_video_counts"),fe=new Map;se==null||se.forEach(we=>{fe.set(we.owner_user_id,we.video_count)});const{data:oe}=await Y.rpc("get_admin_popby_counts"),ce=new Map;oe==null||oe.forEach(we=>{ce.set(we.owner_user_id,we.popby_count)});const{data:de}=await Y.rpc("get_admin_listing_counts"),xe=new Map;de==null||de.forEach(we=>{xe.set(we.agent_id,we.listing_count)});const{data:Me}=await Y.rpc("get_admin_deal_counts"),ve=new Map;return Me==null||Me.forEach(we=>{ve.set(we.owner_user_id,we.deal_count)}),G.map(we=>({id:we.id,name:we.name||"Unknown",email:we.email||"",brokerage_id:we.brokerage_id,brokerage_name:we.brokerage_id&&ne.get(we.brokerage_id)||null,contact_count:he.get(we.id)||0,video_count:fe.get(we.id)||0,popby_count:ce.get(we.id)||0,listing_count:xe.get(we.id)||0,deal_count:ve.get(we.id)||0,created_at:we.created_at}))}}),R=A.useMemo(()=>{if(!T)return[];let G=T.filter(Q=>{const ne=e.toLowerCase(),ie=!e||Q.name.toLowerCase().includes(ne)||Q.email.toLowerCase().includes(ne),he=s==="all"||s==="none"&&!Q.brokerage_id||Q.brokerage_id===s,se=parseInt(u)||0,fe=parseInt(x)||0,oe=parseInt(v)||0,ce=parseInt(N)||0,de=Q.contact_count>=se&&Q.video_count>=fe&&Q.popby_count>=oe&&Q.listing_count>=ce;return ie&&he&&de});return G.sort((Q,ne)=>{let ie=0;return a==="name"?ie=Q.name.localeCompare(ne.name):ie=Q[a]-ne[a],l==="asc"?ie:-ie}),G},[T,e,s,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=R.map(fe=>[fe.name,fe.email,fe.brokerage_name||"None",fe.contact_count,fe.video_count,fe.popby_count,fe.listing_count,fe.deal_count]),ne=[G.join(","),...Q.map(fe=>fe.map(oe=>`"${oe}"`).join(","))].join(` `),ie=new Blob([ne],{type:"text/csv"}),he=URL.createObjectURL(ie),se=document.createElement("a");se.href=he,se.download=`agent-os-user-stats-${new Date().toISOString().split("T")[0]}.csv`,se.click(),URL.revokeObjectURL(he)},q=A.useMemo(()=>R.length?R.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},[R]),H=({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(Dg,{className:`h-3 w-3 ${a===G?"text-primary":"text-muted-foreground"}`})]})});return r.jsxs(He,{children:[r.jsx(Vt,{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(qs,{className:"h-5 w-5"}),"User Activity Analytics"]}),r.jsx(Ns,{children:"View all users and their Agent OS usage metrics"})]}),r.jsxs(X,{variant:"outline",size:"sm",onClick:U,children:[r.jsx($i,{className:"h-4 w-4 mr-2"}),"Export CSV"]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-4 md:grid-cols-6",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsxs("div",{className:"relative",children:[r.jsx(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by name or email...",value:e,onChange:G=>t(G.target.value),className:"pl-9"})]})}),r.jsx("div",{children:r.jsxs(us,{value:s,onValueChange:n,children:[r.jsxs(cs,{children:[r.jsx(pi,{className:"h-4 w-4 mr-2 text-muted-foreground"}),r.jsx(ms,{placeholder:"Brokerage"})]}),r.jsxs(ds,{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(ot,{type:"number",placeholder:"Min contacts",value:u,onChange:G=>m(G.target.value),min:"0"})}),r.jsx("div",{children:r.jsx(ot,{type:"number",placeholder:"Min videos",value:x,onChange:G=>y(G.target.value),min:"0"})}),r.jsx("div",{children:r.jsx(ot,{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:R.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:q.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:q.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:q.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:q.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:q.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(Vr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsx("div",{className:"rounded-md border",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{children:[r.jsx(H,{field:"name",children:"Name"}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{children:"Brokerage"}),r.jsx(H,{field:"contact_count",children:"Contacts"}),r.jsx(H,{field:"video_count",children:"Videos"}),r.jsx(H,{field:"popby_count",children:"Popbys"}),r.jsx(H,{field:"listing_count",children:"Listings"}),r.jsx(H,{field:"deal_count",children:"Deals"})]})}),r.jsx(On,{children:R.length===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"No users found matching your filters"})}):R.map(G=>r.jsxs(kr,{children:[r.jsx(gt,{className:"font-medium",children:G.name}),r.jsx(gt,{className:"text-muted-foreground",children:G.email}),r.jsx(gt,{children:G.brokerage_name?r.jsx(Tt,{variant:"secondary",children:G.brokerage_name}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(gt,{children:r.jsx(Tt,{variant:G.contact_count>0?"default":"outline",children:G.contact_count})}),r.jsx(gt,{children:r.jsx(Tt,{variant:G.video_count>0?"default":"outline",children:G.video_count})}),r.jsx(gt,{children:r.jsx(Tt,{variant:G.popby_count>0?"default":"outline",children:G.popby_count})}),r.jsx(gt,{children:r.jsx(Tt,{variant:G.listing_count>0?"default":"outline",children:G.listing_count})}),r.jsx(gt,{children:r.jsx(Tt,{variant:G.deal_count>0?"default":"outline",children:G.deal_count})})]},G.id))})]})})]})]})}function x3t(){ci(),Br();const[e,t]=A.useState("user-analytics"),{data:s}=Kt({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:n,isLoading:a}=Kt({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}=Kt({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}=Kt({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}=Kt({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}=Kt({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(Eu,{title:"Agent OS Control Center",description:"Manage InnerCircle settings, scripts, and touchpoint plans"}),r.jsxs(Si,{value:e,onValueChange:t,children:[r.jsxs(ki,{className:"grid w-full grid-cols-9",children:[r.jsxs(is,{value:"user-analytics",className:"gap-2",children:[r.jsx(wc,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Users"})]}),r.jsxs(is,{value:"relationship-types",className:"gap-2",children:[r.jsx(qs,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Relationships"})]}),r.jsxs(is,{value:"action-types",className:"gap-2",children:[r.jsx(Pi,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Actions"})]}),r.jsxs(is,{value:"scripts",className:"gap-2",children:[r.jsx(ga,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Scripts"})]}),r.jsxs(is,{value:"video-scripts",className:"gap-2",children:[r.jsx(Id,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Video Scripts"})]}),r.jsxs(is,{value:"plans",className:"gap-2",children:[r.jsx(jn,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Plans"})]}),r.jsxs(is,{value:"popbys",className:"gap-2",children:[r.jsx(oo,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Popbys"})]}),r.jsxs(is,{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(is,{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(Ss,{value:"user-analytics",className:"mt-6",children:r.jsx(g3t,{})}),r.jsx(Ss,{value:"relationship-types",className:"mt-6",children:r.jsx(y3t,{types:n||[],isLoading:a})}),r.jsx(Ss,{value:"action-types",className:"mt-6",children:r.jsx(v3t,{types:o||[],isLoading:l})}),r.jsx(Ss,{value:"scripts",className:"mt-6",children:r.jsx(_3t,{scripts:i||[],actionTypes:o||[],isLoading:u})}),r.jsx(Ss,{value:"video-scripts",className:"mt-6",children:r.jsx(k3t,{})}),r.jsx(Ss,{value:"plans",className:"mt-6",children:r.jsx(b3t,{plans:m||[],actionTypes:o||[],scripts:i||[],isLoading:x})}),r.jsx(Ss,{value:"popbys",className:"mt-6",children:r.jsx(j3t,{items:y||[],isLoading:v})}),r.jsx(Ss,{value:"settings",className:"mt-6",children:r.jsx(N3t,{})}),r.jsx(Ss,{value:"feature-flags",className:"mt-6",children:r.jsx(w3t,{flags:s||[]})})]})]})})}function y3t({types:e,isLoading:t}){const{toast:s}=ci(),n=Br(),[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:()=>{n.invalidateQueries({queryKey:["admin-relationship-types"]}),i(!1),o(null),s({title:"Saved successfully"})},onError:x=>{s({title:"Error",description:x.message,variant:"destructive"})}}),m=async x=>{await Y.from("relationship_types").update({active:!x.active}).eq("id",x.id),n.invalidateQueries({queryKey:["admin-relationship-types"]})};return r.jsxs(He,{children:[r.jsxs(Vt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Gt,{children:"Relationship Types"}),r.jsx(Ns,{children:"Define the relationship categories for InnerCircle contacts"})]}),r.jsxs(X,{onClick:()=>{o(null),i(!0)},children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Add Type"]})]}),r.jsx(Xe,{children:t?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Vr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:e.map(x=>r.jsxs(kr,{children:[r.jsx(gt,{children:r.jsx(Bg,{className:"h-4 w-4 text-muted-foreground cursor-grab"})}),r.jsx(gt,{className:"font-medium",children:x.name}),r.jsx(gt,{className:"text-muted-foreground",children:x.description}),r.jsx(gt,{children:r.jsx(In,{checked:x.active,onCheckedChange:()=>m(x)})}),r.jsx(gt,{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(Pr,{children:[r.jsx(zr,{children:r.jsxs(Rr,{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(ot,{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(Ys,{id:"description",name:"description",defaultValue:(a==null?void 0:a.description)||""})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"icon",children:"Icon"}),r.jsx(ot,{id:"icon",name:"icon",defaultValue:(a==null?void 0:a.icon)||"",placeholder:"e.g., star, heart, user"})]})]}),r.jsxs(zn,{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(Vr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function v3t({types:e,isLoading:t}){const{toast:s}=ci(),n=Br(),[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:()=>{n.invalidateQueries({queryKey:["admin-action-types"]}),i(!1),o(null),s({title:"Saved successfully"})},onError:x=>{s({title:"Error",description:x.message,variant:"destructive"})}}),m=async x=>{await Y.from("action_types").update({active:!x.active}).eq("id",x.id),n.invalidateQueries({queryKey:["admin-action-types"]})};return r.jsxs(He,{children:[r.jsxs(Vt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Gt,{children:"Action Types"}),r.jsx(Ns,{children:"Define the types of touchpoint actions agents can take"})]}),r.jsxs(X,{onClick:()=>{o(null),i(!0)},children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Add Action"]})]}),r.jsx(Xe,{children:t?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Vr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:e.map(x=>r.jsxs(kr,{children:[r.jsx(gt,{className:"font-medium",children:x.name}),r.jsx(gt,{className:"text-muted-foreground",children:x.description}),r.jsx(gt,{children:x.color&&r.jsx("div",{className:"w-6 h-6 rounded",style:{backgroundColor:x.color}})}),r.jsx(gt,{children:r.jsx(In,{checked:x.active,onCheckedChange:()=>m(x)})}),r.jsx(gt,{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(Pr,{children:[r.jsx(zr,{children:r.jsxs(Rr,{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(ot,{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(Ys,{id:"description",name:"description",defaultValue:(a==null?void 0:a.description)||""})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"icon",children:"Icon"}),r.jsx(ot,{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(ot,{id:"color",name:"color",type:"color",defaultValue:(a==null?void 0:a.color)||"#6366f1"})]})]}),r.jsxs(zn,{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(Vr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function _3t({scripts:e,actionTypes:t,isLoading:s}){const{toast:n}=ci(),a=Br(),[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),n({title:"Saved successfully"})},onError:y=>{n({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"]}),n({title:"Deleted successfully"})}});return r.jsxs(He,{children:[r.jsxs(Vt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Gt,{children:"Script Library"}),r.jsx(Ns,{children:"Create and manage scripts for each action type"})]}),r.jsxs(X,{onClick:()=>{l(null),u(!0)},children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Add Script"]})]}),r.jsx(Xe,{children:s?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Vr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:e.map(y=>{var v;return r.jsxs(kr,{children:[r.jsx(gt,{className:"font-medium",children:y.title}),r.jsx(gt,{children:r.jsx(Tt,{variant:"outline",children:((v=y.action_type)==null?void 0:v.name)||"Unknown"})}),r.jsx(gt,{className:"text-muted-foreground",children:y.tone}),r.jsx(gt,{children:r.jsx(Tt,{variant:y.active?"default":"secondary",children:y.active?"Active":"Inactive"})}),r.jsxs(gt,{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(Bs,{className:"h-4 w-4 text-destructive"})})]})]},y.id)})})]})}),r.jsx(Or,{open:i,onOpenChange:u,children:r.jsxs(Pr,{className:"max-w-2xl",children:[r.jsx(zr,{children:r.jsxs(Rr,{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(ot,{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(us,{name:"action_type_id",defaultValue:o==null?void 0:o.action_type_id,children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select action type"})}),r.jsx(ds,{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(ot,{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(Ys,{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(zn,{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(Vr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function b3t({plans:e,actionTypes:t,scripts:s,isLoading:n}){const{toast:a}=ci(),o=Br(),[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,E]=A.useState(null),{data:T}=Kt({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"})}}),R=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:ne}=await Y.from("action_scripts").insert([{...G,active:!0}]).select().single();if(ne)throw ne;return Q},onSuccess:async G=>{o.invalidateQueries({queryKey:["admin-action-scripts"]}),N&&await R.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"})}}),q=(G,Q,ne)=>{k({month:G,actionTypeId:Q,itemId:ne}),b(!0)},H=G=>s.find(Q=>Q.id===G);return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(He,{children:[r.jsxs(Vt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Gt,{children:"Touchpoint Plans"}),r.jsx(Ns,{children:"Create annual touchpoint plans that agents can apply to their contacts"})]}),r.jsxs(X,{onClick:()=>{i(null),m(!0)},children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Add Plan"]})]}),r.jsx(Xe,{children:n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Vr,{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(Vt,{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(Xe,{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(Vt,{children:[r.jsx(Gt,{children:"Plan Schedule"}),r.jsx(Ns,{children:"Configure the monthly touchpoint schedule. Select an action type for each month, then assign or create a script."})]}),r.jsx(Xe,{children:r.jsx("div",{className:"grid gap-3",children:Array.from({length:12},(G,Q)=>Q+1).map(G=>{const Q=T==null?void 0:T.find(he=>he.month_number===G),ne=Q!=null&&Q.default_script_id?H(Q.default_script_id):null,ie=s.filter(he=>he.action_type_id===(Q==null?void 0:Q.action_type_id)&&he.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(us,{value:(Q==null?void 0:Q.action_type_id)||"none",onValueChange:he=>{he==="none"&&Q?D.mutate(Q.id):he!=="none"&&R.mutate({id:Q==null?void 0:Q.id,plan_id:x,month_number:G,action_type_id:he,default_script_id:null})},children:[r.jsx(cs,{className:"w-40",children:r.jsx(ms,{placeholder:"No action"})}),r.jsxs(ds,{children:[r.jsx($t,{value:"none",children:"No action"}),t.filter(he=>he.active).map(he=>r.jsx($t,{value:he.id,children:r.jsxs("span",{className:"flex items-center gap-2",children:[he.color&&r.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:he.color}}),he.name]})},he.id))]})]}),Q&&r.jsxs(r.Fragment,{children:[r.jsxs(us,{value:Q.default_script_id||"none",onValueChange:he=>{E(null),R.mutate({id:Q.id,default_script_id:he==="none"?null:he})},children:[r.jsx(cs,{className:"w-56",children:r.jsx(ms,{placeholder:"Select script"})}),r.jsxs(ds,{children:[r.jsx($t,{value:"none",children:"No default script"}),ie.map(he=>r.jsxs($t,{value:he.id,children:[he.title," ",he.tone&&`(${he.tone})`]},he.id))]})]}),r.jsxs(X,{variant:"outline",size:"sm",onClick:()=>q(G,Q.action_type_id,Q.id),children:[r.jsx(vs,{className:"h-3 w-3 mr-1"}),"New Script"]}),ne&&r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>E((M==null?void 0:M.id)===ne.id?null:ne),children:(M==null?void 0:M.id)===ne.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(Pr,{children:[r.jsx(zr,{children:r.jsxs(Rr,{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(ot,{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(Ys,{id:"description",name:"description",defaultValue:(l==null?void 0:l.description)||"",rows:3})]})]}),r.jsxs(zn,{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(Vr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})}),r.jsx(Or,{open:v,onOpenChange:b,children:r.jsxs(Pr,{className:"max-w-2xl",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Create New Script"}),r.jsxs(Zs,{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(ot,{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(ot,{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(Ys,{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(zn,{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(Vr,{className:"h-4 w-4 mr-2 animate-spin"}),"Create & Assign"]})]})]})]})})]})}function w3t({flags:e}){const{toast:t}=ci(),s=Br(),n=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"}):(s.invalidateQueries({queryKey:["admin-feature-flags"]}),t({title:"Flag updated"}))};return r.jsxs(He,{children:[r.jsxs(Vt,{children:[r.jsx(Gt,{children:"Feature Flags"}),r.jsx(Ns,{children:"Control which features are enabled for members"})]}),r.jsx(Xe,{children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{children:[r.jsx(Mt,{children:"Flag"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{children:"Notes"}),r.jsx(Mt,{children:"Last Updated"})]})}),r.jsx(On,{children:e.map(a=>r.jsxs(kr,{children:[r.jsx(gt,{className:"font-mono text-sm",children:a.key}),r.jsx(gt,{children:r.jsx(In,{checked:a.enabled,onCheckedChange:o=>n(a,{enabled:o})})}),r.jsx(gt,{children:r.jsx(ot,{defaultValue:a.notes||"",placeholder:"Add notes...",className:"max-w-xs",onBlur:o=>{o.target.value!==a.notes&&n(a,{notes:o.target.value})}})}),r.jsx(gt,{className:"text-muted-foreground text-sm",children:new Date(a.updated_at).toLocaleDateString()})]},a.id))})]})})]})}function j3t({items:e,isLoading:t}){const{toast:s}=ci(),n=Br(),[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:()=>{n.invalidateQueries({queryKey:["admin-popby-items"]}),n.invalidateQueries({queryKey:["popby-items"]}),i(!1),o(null),s({title:"Saved successfully"})},onError:y=>{s({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),n.invalidateQueries({queryKey:["admin-popby-items"]}),n.invalidateQueries({queryKey:["popby-items"]})},x=async y=>{await Y.from("popby_items").delete().eq("id",y),n.invalidateQueries({queryKey:["admin-popby-items"]}),n.invalidateQueries({queryKey:["popby-items"]}),s({title:"Deleted successfully"})};return r.jsxs(He,{children:[r.jsxs(Vt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Gt,{children:"Popby Ideas"}),r.jsx(Ns,{children:"Manage global popby ideas that all agents can see"})]}),r.jsxs(X,{onClick:()=>{o(null),i(!0)},children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Add Popby Idea"]})]}),r.jsx(Xe,{children:t?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Vr,{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(oo,{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(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:e.map(y=>r.jsxs(kr,{children:[r.jsx(gt,{className:"font-medium",children:y.name}),r.jsx(gt,{className:"text-muted-foreground",children:y.description}),r.jsx(gt,{children:r.jsx(In,{checked:y.is_active,onCheckedChange:()=>m(y)})}),r.jsx(gt,{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(Bs,{className:"h-4 w-4 text-destructive"})})]})})]},y.id))})]})}),r.jsx(Or,{open:l,onOpenChange:i,children:r.jsxs(Pr,{children:[r.jsx(zr,{children:r.jsxs(Rr,{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(ot,{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(Ys,{id:"description",name:"description",defaultValue:(a==null?void 0:a.description)||"",placeholder:"Brief description of the popby idea..."})]})]}),r.jsxs(zn,{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(Vr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function k3t(){var b;const{toast:e}=ci(),t=Br(),[s,n]=A.useState(null),[a,o]=A.useState(!1),{data:l,isLoading:i}=Kt({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}=Kt({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:E}=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(E)throw E}else{const{error:E}=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(E)throw E}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-video-scripts"]}),o(!1),n(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(Vt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Gt,{children:"Video Scripts"}),r.jsx(Ns,{children:"Manage teleprompter scripts for Quick Video Touch"})]}),r.jsxs(X,{onClick:()=>{n(null),o(!0)},children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Add Script"]})]}),r.jsx(Xe,{children:m?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Vr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:u==null?void 0:u.map(N=>{var k;return r.jsxs(kr,{children:[r.jsx(gt,{className:"font-medium",children:N.title}),r.jsx(gt,{className:"text-muted-foreground",children:((k=N.category)==null?void 0:k.name)||"Uncategorized"}),r.jsx(gt,{children:r.jsx(In,{checked:N.is_active,onCheckedChange:()=>y(N)})}),r.jsxs(gt,{className:"flex gap-1",children:[r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>{n(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(Bs,{className:"h-4 w-4"})})]})]},N.id)})})]})}),r.jsx(Or,{open:a,onOpenChange:o,children:r.jsxs(Pr,{className:"max-w-2xl",children:[r.jsx(zr,{children:r.jsxs(Rr,{children:[s?"Edit":"Add"," Video Script"]})}),r.jsxs("form",{onSubmit:N=>{N.preventDefault();const k=new FormData(N.currentTarget);x.mutate({id:s==null?void 0:s.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(ot,{id:"title",name:"title",defaultValue:s==null?void 0:s.title,required:!0})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"category_id",children:"Category"}),r.jsxs(us,{name:"category_id",defaultValue:(s==null?void 0:s.category_id)||"",children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select category"})}),r.jsx(ds,{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(Ys,{id:"script_text",name:"script_text",defaultValue:s==null?void 0:s.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(ot,{id:"tags",name:"tags",defaultValue:((b=s==null?void 0:s.tags)==null?void 0:b.join(", "))||"",placeholder:"birthday, follow-up, thank-you"})]})]}),r.jsxs(zn,{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(Vr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function N3t(){const{toast:e}=ci(),[t,s]=A.useState(""),[n,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&&s(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 n?r.jsx(He,{children:r.jsx(Xe,{className:"flex justify-center py-8",children:r.jsx(Vr,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}):r.jsx("div",{className:"space-y-6",children:r.jsxs(He,{children:[r.jsxs(Vt,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(po,{className:"h-5 w-5"}),"Popby Map Settings"]}),r.jsx(Ns,{children:"Configure the map feature for popbys"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"mapbox-token",children:"Mapbox Public Token"}),r.jsx(ot,{id:"mapbox-token",placeholder:"pk.eyJ1I...",value:t,onChange:u=>s(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(Vr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Token"]}),t&&r.jsx(Tt,{variant:"secondary",className:"ml-2",children:"Token configured"})]})]})})}const S3t=()=>{const[e,t]=A.useState(""),[s,n]=A.useState("grid"),a=Hs(),{data:o=[],isLoading:l}=Kt({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(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{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:s==="grid"?"secondary":"outline",size:"icon",onClick:()=>n("grid"),className:"rounded-full",children:r.jsx(pp,{className:"h-4 w-4"})}),r.jsx(X,{variant:s==="list"?"secondary":"outline",size:"icon",onClick:()=>n("list"),className:"rounded-full",children:r.jsx(fp,{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: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(4)].map((u,m)=>r.jsx(He,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx(Cr,{className:"aspect-[3/2] w-full rounded-lg mb-4"}),r.jsx(Cr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Cr,{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: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(u=>r.jsxs(He,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${s==="list"?"flex flex-row":""}`,onClick:()=>a(`/additional-services/${u.id}`),children:[r.jsx("div",{className:`relative overflow-hidden bg-muted ${s==="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(Bn,{className:"h-8 w-8"})})}),r.jsxs(Xe,{className:`p-4 flex flex-col ${s==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:u.name}),u.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 flex-1",children:vne(u.description)})]})]},u.id))})]})})},C3t=()=>{const{serviceId:e}=hc(),t=Hs(),{data:s,isLoading:n}=Kt({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 n?r.jsx(Dr,{title:"Loading...",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsx(Cr,{className:"h-8 w-48"}),r.jsx(Cr,{className:"h-64 w-full rounded-lg"}),r.jsx(Cr,{className:"h-24 w-full"})]})}):s?r.jsx(Dr,{title:s.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:s.preview_image_url?r.jsx("img",{src:s.preview_image_url,alt:s.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(Bn,{className:"h-16 w-16"})})})}),r.jsx(He,{children:r.jsxs(Xe,{className:"p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground mb-2",children:s.name}),r.jsxs("div",{className:"flex items-center text-sm text-muted-foreground",children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Published ",rs(new Date(s.publish_date),"MMMM d, yyyy")]})]}),s.description&&r.jsx("div",{className:"prose prose-sm max-w-none text-muted-foreground [&_a]:text-primary [&_a]:underline",dangerouslySetInnerHTML:{__html:s.description}}),r.jsx("div",{className:"pt-4 border-t",children:r.jsxs(X,{size:"lg",className:"gap-2",onClick:()=>window.open(s.signup_link_url,"_blank"),children:[r.jsx(Sn,{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"]})]})})},vT=[{id:"content-calendar",name:"Social Media Content Calendar Generator",iframe:``},{id:"property-promotion",name:"Property Promotion AI Tool",iframe:''},{id:"bio-boost",name:"Realtor Bio-Boost",iframe:''},{id:"market-report",name:"Market Report & Video Script Generator",iframe:''},{id:"property-description",name:"Property Description Writer",iframe:''},{id:"newsletter-generator",name:"Local Real Estate Newsletter Generator",iframe:''}];function M3t(){const[e,t]=A.useState(vT[0].id),s=vT.find(n=>n.id===e)||vT[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(SS,{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(us,{value:e,onValueChange:t,children:[r.jsx(cs,{className:"w-full",children:r.jsx(ms,{placeholder:"Select a tool"})}),r.jsx(ds,{children:vT.map(n=>r.jsx($t,{value:n.id,children:n.name},n.id))})]})}),r.jsx("div",{className:"hidden md:block",children:r.jsx(Si,{value:e,onValueChange:t,className:"w-full",children:r.jsx(ki,{className:"w-full flex-wrap h-auto gap-1 bg-muted p-1",children:vT.map(n=>r.jsx(is,{value:n.id,className:"flex-1 min-w-[150px] text-xs lg:text-sm whitespace-normal h-auto py-2",children:n.name},n.id))})})}),r.jsx("div",{className:"flex justify-center",children:r.jsx("div",{className:"w-full max-w-[700px]",dangerouslySetInnerHTML:{__html:s.iframe}})})]})})}const gCe="agent-os-onboarding-completed",LO=[{icon:$g,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:Hg,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:qs,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:Af,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:oo,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:wc,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"]}],T3t=()=>{const[e,t]=A.useState(!1),[s,n]=A.useState(0),[a,o]=A.useState(!1);A.useEffect(()=>{if(!localStorage.getItem(gCe)){const N=setTimeout(()=>t(!0),500);return()=>clearTimeout(N)}},[]);const l=()=>{s{n(s+1),o(!1)},150)):u()},i=()=>{u()},u=()=>{localStorage.setItem(gCe,"true"),t(!1)},m=LO[s],x=m.icon,y=s===LO.length-1,v=b=>{b||u(),t(b)};return r.jsx(Or,{open:e,onOpenChange:v,children:r.jsxs(Pr,{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`})})]}),s===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(Bn,{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(Rr,{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(Zs,{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:LO.map((b,N)=>r.jsx("button",{onClick:()=>{N!==s&&(o(!0),setTimeout(()=>{n(N),o(!1)},150))},className:`h-2 rounded-full transition-all duration-300 ${N===s?"w-8 bg-gradient-to-r "+m.bgGradient:N{const{user:e}=Yr();return Kt({queryKey:["contact-snoozes",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:s}=await Y.from("contact_snoozes").select("*").gte("snoozed_until",new Date().toISOString());if(s)throw s;return t},enabled:!!e})},E3t=()=>{const e=Br(),{user:t}=Yr();return ar({mutationFn:async({contactId:s,days:n})=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const a=Jl(new Date,n);await Y.from("contact_snoozes").delete().eq("contact_id",s);const{error:o}=await Y.from("contact_snoozes").insert({contact_id:s,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"]}),Wn({title:"Touch snoozed!",description:"Contact has been snoozed."})},onError:s=>{Wn({title:"Error snoozing contact",description:s.message,variant:"destructive"})}})},I3t=()=>{const e=Br();return ar({mutationFn:async t=>{const{error:s}=await Y.from("contact_snoozes").delete().eq("contact_id",t);if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["contact-snoozes"]}),Wn({title:"Snooze cancelled"})},onError:t=>{Wn({title:"Error cancelling snooze",description:t.message,variant:"destructive"})}})},P3t=[{label:"1 week",days:7},{label:"2 weeks",days:14},{label:"1 month",days:30}];function Uae({open:e,onOpenChange:t,contactId:s,contactName:n}){const[a,o]=A.useState(null),l=E3t(),i=async()=>{a&&(await l.mutateAsync({contactId:s,days:a}),o(null),t(!1))},u=m=>rs(Jl(new Date,m),"MMM d, yyyy");return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Pr,{className:"sm:max-w-md",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{className:"flex items-center gap-2",children:[r.jsx(Ra,{className:"h-5 w-5"}),"Snooze Touch"]}),r.jsxs(Zs,{children:["Postpone the next scheduled touch for ",n,". Select how long to snooze."]})]}),r.jsx("div",{className:"space-y-3 py-4",children:P3t.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(jn,{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 L3t={Crown:V1,FileText:ga,Users:qs,Globe:uy,Star:Mn,Phone:Pi,MessageSquare:Bo,PenTool:Vj,Video:Ta,Gift:oo};function O3t({actions:e,onMarkComplete:t,onViewScript:s,isLoading:n,buildSmsLink:a,buildEmailLink:o,onGmailCompose:l}){const i=Hs(),[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"))},E=A.useMemo(()=>[...e].sort((D,U)=>{var H,G;let q=0;switch(u){case"name":{const Q=`${D.contact.first_name} ${D.contact.last_name||""}`.toLowerCase(),ne=`${U.contact.first_name} ${U.contact.last_name||""}`.toLowerCase();q=Q.localeCompare(ne);break}case"relationship_type":q=(D.relationshipTypeName||"").localeCompare(U.relationshipTypeName||"");break;case"action_type":q=(((H=D.actionType)==null?void 0:H.name)||"").localeCompare(((G=U.actionType)==null?void 0:G.name)||"");break;case"last_touch":q=(D.monthNumber||0)-(U.monthNumber||0);break}return x==="asc"?q:-q}),[e,u,x]),T=D=>L3t[D||"Phone"]||Pi,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(hp,{className:"ml-2 h-4 w-4"}):r.jsx(ly,{className:"ml-2 h-4 w-4"}):r.jsx(Dg,{className:"ml-2 h-4 w-4 opacity-50"})]}),R=(D,U,q)=>{b(D),k(`${U} ${q||""}`.trim())};return e.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No actions scheduled for today."}),r.jsx("p",{className:"text-sm mt-1",children:"Add contacts and enable touchpoint plans to get started."})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"border rounded-lg overflow-hidden",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:E.map((D,U)=>{var ie,he,se,fe,oe,ce;const q=D.isSpecialDate,H=D.specialDateType,G=q?H==="birthday"?fm:sa:T(((ie=D.actionType)==null?void 0:ie.icon)||null),Q=D.contact.phone,ne=D.contact.email;return r.jsxs(kr,{className:Ut("hover:bg-muted/50 transition-colors",q&&H==="birthday"&&"bg-pink-50/50 dark:bg-pink-950/20",q&&H==="anniversary"&&"bg-purple-50/50 dark:bg-purple-950/20"),children:[r.jsx(gt,{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(gt,{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(gt,{children:r.jsx("div",{className:"flex items-center gap-1.5",children:q?r.jsx(Tt,{className:Ut("gap-1",H==="birthday"&&"bg-pink-500 hover:bg-pink-600",H==="anniversary"&&"bg-purple-500 hover:bg-purple-600"),children:H==="birthday"?r.jsxs(r.Fragment,{children:[r.jsx(fm,{className:"h-3 w-3"})," Birthday"]}):r.jsxs(r.Fragment,{children:[r.jsx(sa,{className:"h-3 w-3"})," Anniversary"]})}):r.jsxs(Tt,{variant:"outline",className:"gap-1",children:[r.jsx(G,{className:"h-3 w-3"}),(he=D.actionType)==null?void 0:he.name]})})}),r.jsx(gt,{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(gt,{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(Pi,{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(Bo,{className:"h-3.5 w-3.5"})}),ne&&(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(Nn,{className:"h-3.5 w-3.5"})}):r.jsx("a",{href:o(D.contact.email,(fe=D.script)==null?void 0:fe.script_body,(oe=D.script)==null?void 0:oe.email_subject,(ce=D.actionType)==null?void 0:ce.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(Nn,{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:()=>R(D.contact.id,D.contact.first_name,D.contact.last_name),title:"Snooze",children:r.jsx(_m,{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 de;return t(D.contact.id,D.actionType.id,(de=D.script)==null?void 0:de.id)},disabled:n,children:[r.jsx(Ki,{className:"h-3.5 w-3.5 mr-1"}),"Done"]})]})})]},`${D.contact.id}-${U}`)})})]})}),r.jsx(Uae,{open:!!v,onOpenChange:D=>!D&&b(null),contactId:v||"",contactName:N})]})}function MP(){const{data:e,isLoading:t}=Kt({queryKey:["gmail-integration"],queryFn:async()=>{const{data:a,error:o}=await Y.from("gmail_integrations").select("*").maybeSingle();if(o)throw o;return a}}),s=!!(e!=null&&e.is_active),n=(e==null?void 0:e.gmail_email)||null;return{isGmailConnected:s,gmailEmail:n,isLoading:t}}function D3t({onSelect:e}){const[t,s]=A.useState(null),{data:n=[],isLoading:a}=Kt({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}=Kt({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=n.find(u=>u.id===t);return a?r.jsx("div",{className:"flex items-center justify-center py-6",children:r.jsx(Vr,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):t?r.jsxs("div",{className:"space-y-2",children:[r.jsxs("button",{onClick:()=>s(null),className:"flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx(Sc,{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(Vr,{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(Yo,{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:n.map(u=>r.jsxs("button",{onClick:()=>s(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(Zi,{className:"h-4 w-4 text-muted-foreground shrink-0"})]},u.id))})]})}const R3t=5*1024*1024,F3t=["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 z3t(e){return e<1024?e+" B":e<1024*1024?(e/1024).toFixed(1)+" KB":(e/(1024*1024)).toFixed(1)+" MB"}function B3t(e){return new Promise((t,s)=>{const n=new FileReader;n.onload=()=>{const a=n.result;t(a.split(",")[1])},n.onerror=s,n.readAsDataURL(e)})}function _T(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 qae({open:e,onOpenChange:t,contact:s,bulkContacts:n,defaultSubject:a="",defaultBody:o="",gmailEmail:l,onSendComplete:i}){const u=!!n&&n.length>0,m=u?n:s?[s]:[],x=m[0],[y,v]=A.useState((x==null?void 0:x.email)||""),[b,N]=A.useState(a),[k,M]=A.useState(o),[E,T]=A.useState(!1),[P,R]=A.useState(!1),[D,U]=A.useState([]);A.useEffect(()=>{e&&(v((x==null?void 0:x.email)||""),N(_T(a,x||{first_name:""})),M(_T(o,x||{first_name:""})),R(!a&&!o),U([]))},[e,x,a,o]);const q=async he=>{const se=he.target.files;if(!se)return;const fe=D.reduce((ce,de)=>ce+de.size,0),oe=[];for(const ce of Array.from(se)){if(!F3t.includes(ce.type)){Te.error(`${ce.name}: Unsupported file type`);continue}if(fe+ce.size>R3t){Te.error("Total attachments exceed 20MB limit");break}try{const de=await B3t(ce);oe.push({name:ce.name,type:ce.type,size:ce.size,data:de})}catch{Te.error(`Failed to read ${ce.name}`)}}U(ce=>[...ce,...oe]),he.target.value=""},H=he=>{U(se=>se.filter((fe,oe)=>oe!==he))},G=he=>{N(_T(he.subject,x||{first_name:""})),M(_T(he.body,x||{first_name:""})),R(!1)},Q=he=>he.split(/\n\n+/).map(se=>`

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

`).join(""),ne=async he=>{if(!b||!k)return Te.error("Please fill in subject and message"),!1;const se=_T(k,he),fe=Q(se);try{const{data:oe,error:ce}=await Y.functions.invoke("gmail-send",{body:{to:he.email,subject:b,body:fe,contactId:he.id,attachments:D.map(({name:de,type:xe,data:Me})=>({name:de,type:xe,data:Me}))}});if(ce)throw ce;if(!(oe!=null&&oe.success))throw new Error((oe==null?void 0:oe.error)||"Failed to send");return!0}catch(oe){return console.error("Gmail send error:",oe),Te.error("Failed to send to "+he.first_name+": "+(oe instanceof Error?oe.message:"Unknown error")),!1}},ie=async()=>{if(!b||!k){Te.error("Please fill in subject and message");return}if(u&&m.length>50){Te.error("Maximum 50 recipients per bulk send");return}T(!0);try{if(u){let he=0;for(const se of m)await ne(se)&&he++,await new Promise(oe=>setTimeout(oe,100));Te.success(`Sent ${he} of ${m.length} emails`)}else await ne(x)&&Te.success("Email sent successfully!");t(!1),i==null||i()}catch(he){console.error("Bulk send error:",he),Te.error("Error sending emails")}finally{T(!1)}};return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Pr,{className:"sm:max-w-[600px] max-h-[90vh] overflow-y-auto",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{className:"flex items-center gap-2",children:[r.jsx(Nn,{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(ga,{className:"h-4 w-4"})," Choose a Template"]}),r.jsxs(X,{variant:"ghost",size:"sm",onClick:()=>R(!1),className:"h-7 px-2 text-xs",children:[r.jsx(en,{className:"h-3 w-3 mr-1"})," Write from scratch"]})]}),r.jsx(D3t,{onSelect:G})]}):r.jsxs(X,{variant:"outline",size:"sm",className:"gap-2",onClick:()=>R(!0),children:[r.jsx(ga,{className:"h-4 w-4"}),"Browse Templates"]}),r.jsx(pd,{}),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(he=>r.jsxs("div",{className:"text-sm",children:[he.first_name," ",he.last_name," — ",he.email]},he.id))})]}):r.jsxs(r.Fragment,{children:[r.jsx(ze,{htmlFor:"gmail-to",children:"To"}),r.jsx(ot,{id:"gmail-to",value:y,onChange:he=>v(he.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(ot,{id:"gmail-subject",value:b,onChange:he=>N(he.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(he=>he+"{{first_name}}"),children:"{{first_name}}"}),r.jsx(Tt,{variant:"outline",className:"text-[10px] cursor-pointer hover:bg-accent",onClick:()=>M(he=>he+"{{last_name}}"),children:"{{last_name}}"})]})]}),r.jsx(Ys,{id:"gmail-body",value:k,onChange:he=>M(he.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 he;return(he=document.getElementById("gmail-attachments"))==null?void 0:he.click()},disabled:E,children:[r.jsx(qj,{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:q})]}),D.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2",children:D.map((he,se)=>r.jsxs(Tt,{variant:"secondary",className:"gap-1.5 pl-2 pr-1 py-1",children:[r.jsx(qj,{className:"h-3 w-3"}),r.jsx("span",{className:"max-w-[140px] truncate text-xs",children:he.name}),r.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["(",z3t(he.size),")"]}),r.jsx("button",{type:"button",onClick:()=>H(se),className:"ml-0.5 rounded-full p-0.5 hover:bg-muted",children:r.jsx(en,{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:E,children:"Cancel"}),r.jsxs(X,{onClick:ie,disabled:E||!b||!k,className:"gap-2",children:[E?r.jsx(Vr,{className:"h-4 w-4 animate-spin"}):r.jsx(ro,{className:"h-4 w-4"}),E?"Sending...":u?`Send to ${m.length}`:"Send Email"]})]})]})]})})}const xCe={Crown:V1,FileText:ga,Users:qs,Globe:uy,Star:Mn,Phone:Pi,MessageSquare:Bo,PenTool:Vj,Video:Ta,Gift:oo},$3t={"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 U3t(){const e=Hs(),{user:t}=Yr(),{data:s}=Vf(),{data:n}=kRe(),{data:a}=Np(),{data:o}=Bye(),{data:l}=ERe(),i=ext(),u=ARe(),m=Qgt(90),x=CRe(),[y,v]=A.useState(null),[b,N]=A.useState(null),[k,M]=A.useState(!1),[E,T]=A.useState(""),[P,R]=A.useState(!1),[D,U]=A.useState(""),[q,H]=A.useState(ire()),[G,Q]=A.useState("cards"),[ne,ie]=A.useState(!1),[he,se]=A.useState(null),[fe,oe]=A.useState(null),[ce,de]=A.useState(""),{isGmailConnected:xe,gmailEmail:Me}=MP(),ve=()=>{const Ce=parseInt(D,10);if(isNaN(Ce)||Ce<1){Wn({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}H(Ce),TRe(Ce),R(!1),Wn({title:"Goal updated",description:`Weekly touch goal set to ${Ce}`})},be=()=>{U(q.toString()),R(!0)};A.useEffect(()=>{(async()=>{if(!(t!=null&&t.id))return;const{data:Ie}=await Y.from("profiles").select("name").eq("id",t.id).single();Ie!=null&&Ie.name&&T(Ie.name.split(" ")[0])})()},[t==null?void 0:t.id]),A.useEffect(()=>{i.mutate()},[]);const we=Cm(new Date),tt=Jl(we,7),Ae=Ce=>{if(!Ce)return null;const Ie=new Date(Ce);return new Date(we.getFullYear(),Ie.getMonth(),Ie.getDate())},Le=(a==null?void 0:a.filter(Ce=>{const Ie=Ae(Ce.birthday),Ze=Ae(Ce.home_anniversary);return Ie&&ic(Ie,we)||Ze&&ic(Ze,we)}))||[],Ue=(a==null?void 0:a.filter(Ce=>{if(!Ce.birthday&&!Ce.home_anniversary)return!1;const Ie=Ze=>{if(!Ze)return!1;const De=Ae(Ze);return De?Hte(De,we)&&Kne(De,tt):!1};return Ie(Ce.birthday)||Ie(Ce.home_anniversary)}).slice(0,5))||[],Pe=Le.map(Ce=>{var Ke,st,dt;const Ie=Ae(Ce.birthday),Ze=Ie&&ic(Ie,we),De=(o==null?void 0:o.find(ct=>ct.name==="Call"))||(o==null?void 0:o[0]);return{contact:Ce,actionType:De||{id:"special-date",name:Ze?"Birthday Call":"Anniversary Call",icon:Ze?"Cake":"Home",color:Ze?"#EC4899":"#8B5CF6",description:Ze?"Wish them happy birthday!":"Celebrate their home anniversary!",active:!0,sort_order:0,created_at:"",updated_at:""},planName:Ze?"🎂 Birthday Today!":"🏠 Home Anniversary!",relationshipTypeName:((dt=(st=(Ke=Ce.tags)==null?void 0:Ke[0])==null?void 0:st.relationship_type)==null?void 0:dt.name)||"",monthNumber:0,isSpecialDate:!0,specialDateType:Ze?"birthday":"anniversary"}}),it=l!==void 0?l||[]:(a==null?void 0:a.slice(0,5).map((Ce,Ie)=>{var De,Ke,st;const Ze=o==null?void 0:o[Ie%((o==null?void 0:o.length)||1)];return Ze?{contact:Ce,actionType:Ze,planName:"Quick Touch",relationshipTypeName:((st=(Ke=(De=Ce.tags)==null?void 0:De[0])==null?void 0:Ke.relationship_type)==null?void 0:st.name)||"",monthNumber:0}:null}).filter(Boolean))||[],xt=[...Pe,...it],Ee=async(Ce,Ie,Ze)=>{await x.mutateAsync({contactId:Ce,actionTypeId:Ie,scriptUsedId:Ze}),M(!1),N(null)},et=Ce=>{Ce.script?(N(Ce),M(!0)):Ee(Ce.contact.id,Ce.actionType.id)},le=Ce=>xCe[Ce||"Phone"]||Pi,Ve=Ce=>xCe[Ce||"Users"]||qs,Je=(Ce,Ie)=>Ce.replace(/\{\{FirstName\}\}/g,Ie.first_name).replace(/\{\{LastName\}\}/g,Ie.last_name||"").replace(/\{\{AgentName\}\}/g,E||"there"),rt=(Ce,Ie)=>({Call:`Thinking of you, ${Ie}!`,Text:`Quick hello, ${Ie}`,Email:`Checking in, ${Ie}`,"Handwritten Note":`A note for ${Ie}`,Video:`Video message for ${Ie}`,Gift:`Something special for you, ${Ie}`})[Ce]||`Hello ${Ie}!`,je=(Ce,Ie,Ze)=>{const De=`sms:${Ce}`;if(Ie&&Ze){const Ke=Je(Ie,Ze);return`${De}?body=${encodeURIComponent(Ke)}`}return De},lt=(Ce,Ie,Ze,De,Ke)=>{const st=`mailto:${Ce}`,dt=[];if(Ke){const ct=Ze||rt(De||"Email",Ke.first_name);if(dt.push(`subject=${encodeURIComponent(ct)}`),Ie){const zt=Je(Ie,Ke);dt.push(`body=${encodeURIComponent(zt)}`)}}return dt.length>0?`${st}?${dt.join("&")}`:st};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:s==null?void 0:s.filter(Ce=>Ce.active).map(Ce=>{const Ie=Ve(Ce.icon),Ze=(n==null?void 0:n[Ce.id])||0,De=y===Ce.id,Ke=$3t[Ce.name]||"bg-secondary text-secondary-foreground";return r.jsxs("button",{onClick:()=>{De?(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 ${De?Ke:"bg-card hover:bg-accent"} `,children:[r.jsx(Ie,{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 ${De?"opacity-90":"text-muted-foreground"}`,children:[Ze," Contacts"]})]})]},Ce.id)})})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[r.jsxs(X,{onClick:()=>e("/mission-control/video/record"),className:"w-full bg-gradient-to-r from-primary to-primary/80",children:[r.jsx(Id,{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(Zi,{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(Bn,{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(pp,{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(fp,{className:"h-4 w-4"})})]})]}),r.jsx(He,{children:r.jsx(Xe,{className:"p-4",children:xt.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(O3t,{actions:xt,onMarkComplete:Ee,onViewScript:et,isLoading:x.isPending,buildSmsLink:je,buildEmailLink:lt,onGmailCompose:xe?Ce=>{se(Ce),ie(!0)}:void 0}):r.jsxs("div",{className:"flex gap-3 overflow-x-auto pb-2",children:[xt.map((Ce,Ie)=>{var ir,Tr,Zr,$r,ns,Xs,Ot;const Ze=Ce.isSpecialDate,De=Ce.specialDateType,Ke=Ze?De==="birthday"?fm:sa:le(((ir=Ce.actionType)==null?void 0:ir.icon)||null),st=Ce.contact.phone,dt=Ce.contact.email,ct=Ze?De==="birthday"?"#EC4899":"#8B5CF6":((Tr=Ce.actionType)==null?void 0:Tr.color)||"#3B82F6",zt=Ze?De==="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 ${Ze?"ring-2 ring-offset-2":""}`,style:Ze?{"--tw-ring-color":ct}:void 0,children:[r.jsxs("div",{className:"p-3 text-white flex items-center gap-2",style:{backgroundColor:ct},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:[st&&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(Pi,{className:"h-3 w-3"}),"Call"]}),r.jsxs("a",{href:je(Ce.contact.phone,($r=Ce.script)==null?void 0:$r.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(Bo,{className:"h-3 w-3"}),"Text"]})]}),dt&&(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}),ie(!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(Nn,{className:"h-3 w-3"}),"Email"]}):r.jsxs("a",{href:lt(Ce.contact.email,(ns=Ce.script)==null?void 0:ns.script_body,(Xs=Ce.script)==null?void 0:Xs.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(Nn,{className:"h-3 w-3"}),"Email"]}))]}),!st&&!dt&&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:()=>et(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:()=>{oe(Ce.contact.id),de(`${Ce.contact.first_name} ${Ce.contact.last_name||""}`.trim())},children:[r.jsx(_m,{className:"h-3.5 w-3.5"}),"Snooze"]}),r.jsx(X,{size:"sm",className:"flex-1",onClick:()=>{var Hr;return Ee(Ce.contact.id,Ce.actionType.id,(Hr=Ce.script)==null?void 0:Hr.id)},disabled:x.isPending,children:"Mark Complete"})]})]})]},Ce.contact.id+Ie)}),r.jsx("div",{className:"flex-shrink-0 w-[100px] border rounded-lg flex items-center justify-center",children:r.jsxs(uh,{children:[r.jsx(hh,{asChild:!0,children:r.jsxs(X,{variant:"ghost",className:"h-full w-full",children:[r.jsx(xf,{className:"h-5 w-5 mr-2"}),"More"]})}),r.jsx(Cu,{children:r.jsx(Wa,{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(Vt,{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:R,children:[r.jsx(vo,{asChild:!0,children:r.jsx("button",{onClick:be,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(Pr,{className:"sm:max-w-[360px]",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Set Weekly Goal"}),r.jsx(Zs,{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(ot,{id:"weekly-goal-ic",type:"number",min:"1",value:D,onChange:Ce=>U(Ce.target.value),placeholder:"20",onKeyDown:Ce=>{Ce.key==="Enter"&&ve()}})]}),r.jsx(X,{onClick:ve,className:"w-full",children:"Save Goal"})]})]})]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsx(lc,{value:Math.min(u.actionsThisWeek/q*100,100),className:"h-3 w-full max-w-full"}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(gm,{className:"h-5 w-5 text-orange-500"}),r.jsxs("span",{className:"font-medium",children:[u.actionsThisWeek," / ",q]}),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(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-lg",children:"Upcoming Reminders"})}),r.jsxs(Xe,{className:"space-y-3",children:[Ue.length>0?Ue.map(Ce=>{const Ie=Ce.birthday,Ze=Ce.home_anniversary;return r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[Ie?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:[" ",Ie?"Birthday":"Home Anniversary"]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[Ie&&Ce.birthday&&(()=>{const De=Ce.birthday.split(/[-/T]/);return rs(new Date(new Date().getFullYear(),parseInt(De[1],10)-1,parseInt(De[2],10)),"MMM d")})(),Ie&&Ze&&" · ",Ze&&Ce.home_anniversary&&(()=>{const De=Ce.home_anniversary.split(/[-/T]/);return rs(new Date(new Date().getFullYear(),parseInt(De[1],10)-1,parseInt(De[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(Ra,{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(Zi,{className:"h-4 w-4 text-muted-foreground ml-auto mt-0.5"})]})]})]}),r.jsx(GRe,{})]})]}),r.jsx(Or,{open:k,onOpenChange:M,children:r.jsxs(Pr,{className:"max-w-md",children:[r.jsx(zr,{children:r.jsx(Rr,{className:"flex items-center gap-2",children:b&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:b.actionType.color||"#3B82F6"}}),b.actionType.name," Script"]})})}),b&&b.script&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["For: ",r.jsxs("span",{className:"font-medium text-foreground",children:[b.contact.first_name," ",b.contact.last_name]})]}),r.jsx("div",{className:"bg-muted p-4 rounded-lg",children:r.jsx("p",{className:"whitespace-pre-wrap",children:Je(b.script.script_body,b.contact)})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(X,{variant:"outline",className:"flex-1",onClick:()=>M(!1),children:"Close"}),r.jsx(X,{className:"flex-1",onClick:()=>{var Ce;return Ee(b.contact.id,b.actionType.id,(Ce=b.script)==null?void 0:Ce.id)},disabled:x.isPending,children:"Mark Complete"})]})]})]})}),r.jsx(T3t,{})]}),xe&&he&&r.jsx(qae,{open:ne,onOpenChange:ie,contact:he,gmailEmail:Me}),r.jsx(Uae,{open:!!fe,onOpenChange:Ce=>!Ce&&oe(null),contactId:fe||"",contactName:ce})]})}const _Be=()=>{const{user:e}=Yr();return Kt({queryKey:["popby-items",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:s}=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(s)throw s;return t},enabled:!!e})},Vae=e=>{const{user:t}=Yr();return Kt({queryKey:["popby-logs",t==null?void 0:t.id,e],queryFn:async()=>{let s=Y.from("popby_logs").select("*").order("completed_at",{ascending:!1});if(e){const o=new Date;o.setDate(o.getDate()-e),s=s.gte("completed_at",o.toISOString())}const{data:n,error:a}=await s;if(a)throw a;return n},enabled:!!t})},e1e=()=>{const{user:e}=Yr();return Kt({queryKey:["relationship-type-popby-defaults",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:s}=await Y.from("relationship_type_popby_defaults").select("*");if(s)throw s;return t},enabled:!!e})},bBe=()=>{const{user:e}=Yr();return Kt({queryKey:["contact-popby-settings",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:s}=await Y.from("contact_popby_settings").select("*");if(s)throw s;return t},enabled:!!e})},wBe=()=>{const{data:e}=Np(),{data:t}=Vf(),{data:s}=Vae(),{data:n}=bBe(),{data:a}=e1e(),o=new Map;s==null||s.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;n==null||n.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(E=>l.get(E.relationship_type_id)).filter(E=>E!==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)},jBe=()=>wBe().filter(t=>t.isDue),q3t=()=>{const e=Br(),{user:t}=Yr();return ar({mutationFn:async s=>{const{error:n}=await Y.from("popby_items").insert({...s,owner_user_id:t==null?void 0:t.id});if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["popby-items"]}),Wn({title:"Popby item created!"})},onError:s=>{Wn({title:"Error creating popby item",description:s.message,variant:"destructive"})}})},kBe=()=>{const e=Br(),{user:t}=Yr();return ar({mutationFn:async s=>{const{error:n}=await Y.from("popby_logs").insert({...s,owner_user_id:t==null?void 0:t.id});if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["popby-logs"]}),Wn({title:"Popby logged!"})},onError:s=>{Wn({title:"Error logging popby",description:s.message,variant:"destructive"})}})},V3t=()=>{const e=Br(),{user:t}=Yr();return ar({mutationFn:async s=>{const{error:n}=await Y.from("relationship_type_popby_defaults").upsert({...s,owner_user_id:t==null?void 0:t.id},{onConflict:"relationship_type_id,owner_user_id"});if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["relationship-type-popby-defaults"]}),Wn({title:"Frequency updated!"})},onError:s=>{Wn({title:"Error updating frequency",description:s.message,variant:"destructive"})}})},H3t=()=>{const{data:e}=Vae(30),t=jBe(),s=new Date;s.setDate(s.getDate()-7);const n=(e==null?void 0:e.filter(o=>new Date(o.completed_at)>=s).length)||0,a=(e==null?void 0:e.length)||0;return{thisWeekCount:n,thisMonthCount:a,dueCount:t.length}};function W3t(){const{user:e}=Yr();return Kt({queryKey:["contact-touch-logs",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:s}=await Y.from("contact_touch_logs").select("*").order("completed_at",{ascending:!1});if(s)throw s;return t},enabled:!!e})}function NBe(e){const{data:t}=W3t(),{data:s}=bBe(),{data:n}=e1e(),{data:a}=A3t();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&&!Kne(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,E)=>new Date(E.completed_at).getTime()-new Date(M.completed_at).getTime())[0],x=m?new Date(m.completed_at):null;let y=90;const v=s==null?void 0:s.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(E=>{const T=n==null?void 0:n.find(P=>P.relationship_type_id===E.relationship_type_id);return T==null?void 0:T.frequency_days}).filter(E=>E!==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=Jl(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,s,n,a])}function Npe({contact:e}){const t=NBe(e),n=(()=>{switch(t.status){case"overdue":return{variant:"destructive",icon:vl,text:`${Math.abs(t.daysUntil)} days overdue`,className:""};case"due-soon":return{variant:"secondary",icon:Ra,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:Ki,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:_m,text:`Snoozed until ${rs(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:jn,text:"Never touched",className:"border-dashed"}}})(),a=n.icon;return r.jsxs(Tt,{variant:n.variant,className:Ut("gap-1",n.className),children:[r.jsx(a,{className:"h-3 w-3"}),n.text]})}function G3t({contact:e,onLogTouch:t,onSnooze:s}){const n=NBe(e),a=I3t(),[o,l]=A.useState(!1),i=()=>{switch(n.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(n.status){case"overdue":return r.jsx(vl,{className:"h-5 w-5 text-destructive"});case"due-soon":return r.jsx(Ra,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"});case"on-track":return r.jsx(Ki,{className:"h-5 w-5 text-emerald-600 dark:text-emerald-400"});case"snoozed":return r.jsx(_m,{className:"h-5 w-5 text-slate-600 dark:text-slate-400"});case"never-touched":return r.jsx(jn,{className:"h-5 w-5 text-muted-foreground"})}},m=()=>{switch(n.status){case"overdue":return`${Math.abs(n.daysUntil)} days overdue`;case"due-soon":return n.daysUntil===0?"Due today!":`Due in ${n.daysUntil} days`;case"on-track":return`On track - ${n.daysUntil} days remaining`;case"snoozed":return`Snoozed for ${n.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(Vt,{className:"pb-2",children:r.jsxs(Gt,{className:"text-sm font-medium flex items-center gap-2",children:[r.jsx(jn,{className:"h-4 w-4"}),"Next Touch"]})}),r.jsxs(Xe,{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[u(),r.jsx("span",{className:Ut("font-medium",i()),children:m()})]}),n.status==="snoozed"&&n.snoozedUntil&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Snoozed until:"})," ",rs(n.snoozedUntil,"MMMM d, yyyy")]}),n.status!=="snoozed"&&n.nextTouchDate&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Scheduled:"})," ",rs(n.nextTouchDate,"MMMM d, yyyy")]}),n.lastTouchDate&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Last touch:"})," ",rs(n.lastTouchDate,"MMM d, yyyy")]}),n.status!=="snoozed"&&r.jsxs("div",{className:"text-xs text-muted-foreground border-t pt-2",children:["Touch frequency: Every ",n.frequencyDays," days"]}),n.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(en,{className:"h-4 w-4 mr-1"}),"Cancel Snooze"]}),t&&r.jsx(X,{size:"sm",className:"flex-1",onClick:t,children:"Log Touch"})]}),n.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(_m,{className:"h-4 w-4 mr-1"}),"Snooze"]}),(n.status==="overdue"||n.status==="due-soon"||n.status==="never-touched")&&t&&r.jsx(X,{size:"sm",className:"flex-1",variant:n.status==="overdue"?"default":"outline",onClick:t,children:"Log Touch"})]})]})]}),r.jsx(Uae,{open:o,onOpenChange:l,contactId:e.id,contactName:`${e.first_name} ${e.last_name||""}`.trim()})]})}const $de=768;function H3(){const[e,t]=A.useState(void 0);return A.useEffect(()=>{const s=window.matchMedia(`(max-width: ${$de-1}px)`),n=()=>{t(window.innerWidth<$de)};return s.addEventListener("change",n),t(window.innerWidth<$de),()=>s.removeEventListener("change",n)},[]),!!e}const K3t={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"}},Z3t={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 Ude({score:e,showScore:t=!1,showTooltip:s=!0,size:n="sm",className:a}){const o=K3t[e.status],l=Z3t[n],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 s?r.jsx(sP,{children:r.jsxs(Gg,{children:[r.jsx(Kg,{asChild:!0,children:i}),r.jsx(Of,{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(lc,{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 Y3t=[{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}],X3t=({open:e,onOpenChange:t,relationshipTypes:s,onSuccess:n})=>{const{user:a}=Yr(),{toast:o}=ci(),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([]),[E,T]=A.useState([]),[P,R]=A.useState(!1),[D,U]=A.useState(null),q=()=>{u("upload"),x([]),v([]),N({}),M([]),T([]),U(null),l.current&&(l.current.value="")},H=()=>{q(),t(!1)},G=ce=>{const de=ce.split(` `).map(be=>be.trim()).filter(be=>be);if(de.length===0)return{headers:[],data:[]};const xe=be=>{const we=[];let tt="",Ae=!1;for(let Le=0;Le{var Me;const de=(Me=ce.target.files)==null?void 0:Me[0];if(!de)return;const xe=new FileReader;xe.onload=ve=>{var Le;const be=(Le=ve.target)==null?void 0:Le.result,{headers:we,data:tt}=G(be);if(we.length===0){o({title:"No data found",description:"The CSV file appears to be empty.",variant:"destructive"});return}x(we),v(tt);const Ae={};we.forEach(Ue=>{const Pe=Ue.toLowerCase().replace(/[_\s-]/g,"");Pe.includes("firstname")||Pe==="first"?Ae.first_name=Ue:Pe.includes("lastname")||Pe==="last"?Ae.last_name=Ue:Pe.includes("email")?Ae.email=Ue:Pe.includes("phone")||Pe.includes("mobile")||Pe.includes("cell")?Ae.phone=Ue:Pe.includes("address")||Pe.includes("street")?Ae.address=Ue:Pe==="city"?Ae.city=Ue:Pe==="state"||Pe==="province"?Ae.state=Ue:Pe==="zip"||Pe==="zipcode"||Pe==="postalcode"?Ae.zip=Ue:Pe.includes("spouse")&&Pe.includes("email")?Ae.spouse_email=Ue:Pe.includes("spouse")||Pe.includes("partner")?Ae.spouse_name=Ue:Pe.includes("company")||Pe.includes("organization")||Pe.includes("business")?Ae.company_name=Ue:Pe.includes("jobtitle")||Pe.includes("title")||Pe.includes("position")?Ae.job_title=Ue:Pe.includes("birthday")||Pe.includes("dob")||Pe.includes("birthdate")?Ae.birthday=Ue:Pe.includes("anniversary")||Pe.includes("homeanniversary")?Ae.home_anniversary=Ue:(Pe.includes("notes")||Pe.includes("comment"))&&(Ae.notes=Ue)}),N(Ae),u("mapping")},xe.readAsText(de)},ne=(ce,de)=>{N(xe=>{if(de==="none"){const{[ce]:Me,...ve}=xe;return ve}return{...xe,[ce]:de}})},ie=ce=>{M(de=>de.includes(ce)?de.filter(xe=>xe!==ce):[...de,ce])},he=()=>{const ce=y.map(de=>{const xe=be=>{const we=b[be];if(!we)return"";const tt=m.indexOf(we);return tt>=0?(de[tt]||"").trim():""},Me=xe("first_name"),ve=Me.length>0;return{first_name:Me,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:ve,error:ve?void 0:"First name is required"}});T(ce),u("preview")},se=async()=>{if(!(a!=null&&a.id))return;const ce=E.filter(ve=>ve.isValid);if(ce.length===0){o({title:"No valid contacts",description:"There are no valid contacts to import.",variant:"destructive"});return}R(!0);let de=0,xe=0,Me=0;try{for(const ve of ce)try{let be=null;if(ve.email){const{data:tt}=await Y.from("innercircle_contacts").select("id").eq("owner_user_id",a.id).eq("email",ve.email).maybeSingle();be=tt}if(!be&&ve.phone){const{data:tt}=await Y.from("innercircle_contacts").select("id").eq("owner_user_id",a.id).eq("phone",ve.phone).maybeSingle();be=tt}const we={owner_user_id:a.id,first_name:ve.first_name,last_name:ve.last_name||null,email:ve.email||null,phone:ve.phone||null,address:ve.address||null,city:ve.city||null,state:ve.state||null,zip:ve.zip||null,spouse_name:ve.spouse_name||null,spouse_email:ve.spouse_email||null,company_name:ve.company_name||null,job_title:ve.job_title||null,birthday:ve.birthday||null,home_anniversary:ve.home_anniversary||null,notes:ve.notes||null};if(be)await Y.from("innercircle_contacts").update(we).eq("id",be.id),xe++;else{const{data:tt}=await Y.from("innercircle_contacts").insert(we).select("id").single();tt&&k.length>0&&await Y.from("innercircle_contact_tags").insert(k.map(Ae=>({contact_id:tt.id,relationship_type_id:Ae}))),de++}}catch(be){console.error("Error importing contact:",be),Me++}U({created:de,updated:xe,failed:Me}),u("result"),(de>0||xe>0)&&n(),o({title:"Import Complete",description:`${de} created, ${xe} updated${Me>0?`, ${Me} failed`:""}.`})}catch(ve){console.error("Import error:",ve),o({title:"Import Failed",description:ve.message||"Failed to import contacts",variant:"destructive"})}finally{R(!1)}},fe=E.filter(ce=>ce.isValid).length,oe=E.filter(ce=>!ce.isValid).length;return r.jsx(Or,{open:e,onOpenChange:H,children:r.jsxs(Pr,{className:"max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{className:"flex items-center gap-2",children:[r.jsx(W1,{className:"h-5 w-5"}),"Import Contacts from CSV"]}),r.jsx(Zs,{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(so,{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 ce;return(ce=l.current)==null?void 0:ce.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 ce=`First Name,Last Name,Email,Phone,Street Address,City,State,Zip,Spouse Name,Company,Job Title,Birthday,Home Anniversary,Notes John,Doe,john@example.com,555-123-4567,123 Main St,Austin,TX,78701,Jane Doe,ABC Realty,Real Estate Agent,1985-06-15,2020-03-22,Met at open house`,de=new Blob([ce],{type:"text/csv"}),xe=URL.createObjectURL(de),Me=document.createElement("a");Me.href=xe,Me.download="contact_import_template.csv",Me.click(),URL.revokeObjectURL(xe)},children:[r.jsx($i,{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:Y3t.map(ce=>r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs(ze,{className:"w-40 text-sm",children:[ce.label,ce.required&&r.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),r.jsxs(us,{value:b[ce.key]||"none",onValueChange:de=>ne(ce.key,de),children:[r.jsx(cs,{className:"w-48",children:r.jsx(ms,{placeholder:"Select column..."})}),r.jsxs(ds,{children:[r.jsx($t,{value:"none",children:"-- Not mapped --"}),m.map(de=>r.jsx($t,{value:de,children:de},de))]})]})]},ce.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:s.map(ce=>r.jsx(Tt,{variant:k.includes(ce.id)?"default":"outline",className:"cursor-pointer",onClick:()=>ie(ce.id),children:ce.name},ce.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(Ki,{className:"h-4 w-4 text-green-500"}),r.jsxs("span",{children:[fe," valid"]})]}),oe>0&&r.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[r.jsx(vl,{className:"h-4 w-4"}),r.jsxs("span",{children:[oe," invalid"]})]})]}),r.jsxs("div",{className:"flex-1 overflow-auto border rounded-lg",children:[r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:E.slice(0,100).map((ce,de)=>r.jsxs(kr,{children:[r.jsx(gt,{children:ce.first_name}),r.jsx(gt,{children:ce.last_name}),r.jsx(gt,{children:ce.email}),r.jsx(gt,{children:ce.phone}),r.jsx(gt,{children:ce.isValid?r.jsx(Tt,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):r.jsx(Tt,{variant:"destructive",children:ce.error||"Invalid"})})]},de))})]}),E.length>100&&r.jsxs("p",{className:"text-sm text-muted-foreground text-center py-2",children:["Showing first 100 of ",E.length," contacts"]})]})]}),i==="result"&&D&&r.jsxs("div",{className:"space-y-4 py-4 text-center",children:[r.jsx(Ki,{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(zn,{children:[i==="upload"&&r.jsx(X,{variant:"outline",onClick:H,children:"Cancel"}),i==="mapping"&&r.jsxs(r.Fragment,{children:[r.jsx(X,{variant:"outline",onClick:q,children:"Back"}),r.jsx(X,{onClick:he,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||fe===0,children:P?r.jsxs(r.Fragment,{children:[r.jsx(Vr,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${fe} Contact${fe!==1?"s":""}`})]}),i==="result"&&r.jsx(X,{onClick:H,children:"Done"})]})]})})};function Q3t(){return"contacts"in navigator&&"ContactsManager"in window}function J3t(e){const t=[],s=e.split("BEGIN:VCARD").filter(n=>n.trim());for(const n of s){const a=n.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 e5t({open:e,onOpenChange:t,onComplete:s}){const{user:n}=Yr(),{data:a}=Np(),o=Fye(),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),E=Q3t(),T=A.useCallback(ne=>{if(!a)return ne;const ie=new Set(a.filter(se=>se.email).map(se=>se.email.toLowerCase())),he=new Set(a.filter(se=>se.phone).map(se=>se.phone.replace(/\D/g,"")));return ne.map(se=>{var ce,de;const fe=(ce=se.email)==null?void 0:ce.toLowerCase(),oe=(de=se.phone)==null?void 0:de.replace(/\D/g,"");return fe&&ie.has(fe)?{...se,isDuplicate:!0,duplicateField:"email"}:oe&&oe.length>=7&&he.has(oe)?{...se,isDuplicate:!0,duplicateField:"phone"}:se})},[a]),P=async()=>{try{const ne=["name","email","tel","address"],ie=await navigator.contacts.select(ne,{multiple:!0});if(!ie||ie.length===0)return;const he=ie.map(oe=>{var xe,Me,ve,be;const de=(((xe=oe.name)==null?void 0:xe[0])||"").split(" ");return{first_name:de[0]||"",last_name:de.slice(1).join(" "),email:((Me=oe.email)==null?void 0:Me[0])||"",phone:((ve=oe.tel)==null?void 0:ve[0])||"",address:(be=oe.address)!=null&&be[0]?[oe.address[0].streetAddress,oe.address[0].city,oe.address[0].region,oe.address[0].postalCode].filter(Boolean).join(", "):""}}),se=T(he);x(se);const fe=new Set;se.forEach((oe,ce)=>{oe.isDuplicate||fe.add(ce)}),v(fe),u("preview")}catch(ne){console.error("Contact Picker error:",ne),Wn({title:"Could not access contacts",description:"Please try the file upload option instead.",variant:"destructive"})}},R=ne=>{var se;const ie=(se=ne.target.files)==null?void 0:se[0];if(!ie)return;const he=new FileReader;he.onload=fe=>{var Me;const oe=(Me=fe.target)==null?void 0:Me.result,ce=J3t(oe);if(ce.length===0){Wn({title:"No contacts found",description:"The file didn't contain any valid contacts.",variant:"destructive"});return}const de=T(ce);x(de);const xe=new Set;de.forEach((ve,be)=>{ve.isDuplicate||xe.add(be)}),v(xe),u("preview")},he.readAsText(ie),l.current&&(l.current.value="")},D=async()=>{const ne=m.filter((he,se)=>y.has(se));if(ne.length===0)return;u("importing");let ie=0;for(const he of ne)try{await o.mutateAsync({first_name:he.first_name,last_name:he.last_name||void 0,email:he.email||void 0,phone:he.phone||void 0,address:he.address||void 0}),ie++,M(Math.round(ie/ne.length*100))}catch(se){console.error(`Failed to import ${he.first_name} ${he.last_name}:`,se)}N(ie),u("done")},U=ne=>{v(ie=>{const he=new Set(ie);return he.has(ne)?he.delete(ne):he.add(ne),he})},q=()=>{y.size===m.length?v(new Set):v(new Set(m.map((ne,ie)=>ie)))},H=ne=>{ne||(u("choose"),x([]),v(new Set),N(0),M(0),i==="done"&&s()),t(ne)},G=m.filter(ne=>ne.isDuplicate).length,Q=y.size;return r.jsx(Or,{open:e,onOpenChange:H,children:r.jsxs(Pr,{className:"sm:max-w-lg max-h-[90vh]",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{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(Zs,{children:"Add contacts from your phone directly into Agent OS."})]}),i==="choose"&&r.jsxs("div",{className:"space-y-4 pt-2",children:[E&&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:[E&&r.jsx("div",{className:"absolute inset-0 flex items-center",children:r.jsx("span",{className:"w-full border-t"})}),E&&r.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:r.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"or"})})]}),r.jsxs(X,{variant:E?"outline":"default",onClick:()=>{var ne;return(ne=l.current)==null?void 0:ne.click()},className:"w-full h-auto py-4 flex flex-col items-center gap-2",children:[r.jsx(so,{className:"h-6 w-6"}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"font-semibold",children:"Upload Contact File"}),r.jsx("div",{className:"text-xs opacity-80",children:E?"Import a .vcf file exported from your Contacts app":"Export contacts from your phone as a .vcf file, then upload here"})]})]}),r.jsx("input",{ref:l,type:"file",accept:".vcf,.vcard",onChange:R,className:"hidden"}),!E&&r.jsxs("div",{className:"rounded-lg bg-muted p-3 text-sm text-muted-foreground space-y-2",children:[r.jsx("p",{className:"font-medium",children:"How to export contacts:"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-xs",children:"iPhone:"}),r.jsx("p",{className:"text-xs",children:'Open Contacts → select contacts → Share → choose "Export vCard"'})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-xs",children:"Android:"}),r.jsx("p",{className:"text-xs",children:"Open Contacts → Menu → Export → save as .vcf file"})]})]})]}),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:q,children:y.size===m.length?"Deselect All":"Select All"})]}),r.jsx(Yo,{className:"h-[350px] rounded-md border",children:r.jsx("div",{className:"divide-y",children:m.map((ne,ie)=>r.jsxs("div",{className:`flex items-start gap-3 p-3 cursor-pointer hover:bg-accent/50 transition-colors ${ne.isDuplicate?"opacity-60":""}`,onClick:()=>U(ie),children:[r.jsx(bl,{checked:y.has(ie),onCheckedChange:()=>U(ie),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:[ne.first_name," ",ne.last_name]}),ne.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 (",ne.duplicateField,")"]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-0.5 mt-0.5",children:[ne.phone&&r.jsx("div",{children:ne.phone}),ne.email&&r.jsx("div",{className:"truncate",children:ne.email})]})]})]},ie))})}),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(Vr,{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:()=>H(!1),className:"mt-2",children:"Done"})]})]})})}function t5t({selectedIds:e,contacts:t,onClearSelection:s}){const{data:n}=Vf(),a=zye(),o=Br(),{isGmailConnected:l}=MP(),[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 E=Array.from(e).map(P=>({contact_id:P,relationship_type_id:k})),{error:T}=await Y.from("innercircle_contact_tags").upsert(E,{onConflict:"contact_id,relationship_type_id",ignoreDuplicates:!0});if(T)throw T;o.invalidateQueries({queryKey:["innercircle-contacts"]}),o.invalidateQueries({queryKey:["innercircle-contact-counts"]}),Wn({title:`Assigned type to ${y} contacts`}),s()}catch(M){Wn({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"],E=k.map(U=>{var q;return[U.first_name,U.last_name||"",U.email||"",U.phone||"",U.address||"",U.birthday||"",U.home_anniversary||"",U.notes||"",((q=U.tags)==null?void 0:q.map(H=>{var G;return(G=H.relationship_type)==null?void 0:G.name}).join("; "))||""]}),T=[M.join(","),...E.map(U=>U.map(q=>`"${(q||"").replace(/"/g,'""')}"`).join(","))].join(` `),P=new Blob([T],{type:"text/csv"}),R=URL.createObjectURL(P),D=document.createElement("a");D.href=R,D.download=`contacts-export-${new Date().toISOString().slice(0,10)}.csv`,D.click(),URL.revokeObjectURL(R),Wn({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);s()}catch(k){Wn({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(us,{onValueChange:v,disabled:i,children:[r.jsx(cs,{className:"w-[180px] h-8",children:r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Vg,{className:"h-3.5 w-3.5"}),r.jsx("span",{className:"text-sm",children:"Assign Type"})]})}),r.jsx(ds,{children:n==null?void 0:n.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(Nn,{className:"h-3.5 w-3.5 mr-1"}),"Email"]}),r.jsxs(X,{variant:"outline",size:"sm",onClick:b,disabled:i,children:[r.jsx($i,{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(Bs,{className:"h-3.5 w-3.5 mr-1"}),"Delete"]}),r.jsxs(X,{variant:"ghost",size:"sm",onClick:s,className:"ml-auto",children:[r.jsx(en,{className:"h-3.5 w-3.5 mr-1"}),"Clear"]})]}),r.jsx(qae,{open:m,onOpenChange:x,bulkContacts:Array.from(e).map(k=>{const M=t.find(E=>E.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),s()}})]})}function yCe({contact:e,onEdit:t,onDelete:s,onSnooze:n}){const a=Hs(),o=`${e.first_name} ${e.last_name||""}`.trim();return r.jsxs(uh,{children:[r.jsx(hh,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:l=>l.stopPropagation(),children:r.jsx(xf,{className:"h-4 w-4"})})}),r.jsxs(Cu,{align:"end",onClick:l=>l.stopPropagation(),children:[r.jsxs(Wa,{onClick:()=>a(`/mission-control/contacts/${e.id}?tab=activity&action=log`),children:[r.jsx(Pi,{className:"h-4 w-4 mr-2"}),"Log Touch"]}),r.jsxs(Wa,{onClick:()=>a(`/mission-control/video?contactId=${e.id}`),children:[r.jsx(Ta,{className:"h-4 w-4 mr-2"}),"Send Video"]}),r.jsxs(Wa,{onClick:()=>a(`/mission-control/popbys?contactId=${e.id}`),children:[r.jsx(po,{className:"h-4 w-4 mr-2"}),"Schedule Pop-by"]}),r.jsxs(Wa,{onClick:()=>n(e.id,o),children:[r.jsx(_m,{className:"h-4 w-4 mr-2"}),"Snooze"]}),r.jsxs(Wa,{onClick:()=>t(e),children:[r.jsx(Ja,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(Wa,{onClick:()=>s(e.id),className:"text-destructive focus:text-destructive",children:[r.jsx(Bs,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})}function r5t(){const{user:e}=Yr();return Kt({queryKey:["contact-smart-lists",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:s}=await Y.from("contact_smart_lists").select("*").order("created_at",{ascending:!1});if(s)throw s;return t},enabled:!!e})}function s5t(){const e=Br(),{user:t}=Yr();return ar({mutationFn:async({name:s,filters:n,sort_by:a})=>{const{data:o,error:l}=await Y.from("contact_smart_lists").insert({owner_user_id:t.id,name:s,filters:n,sort_by:a}).select().single();if(l)throw l;return o},onSuccess:()=>{e.invalidateQueries({queryKey:["contact-smart-lists"]}),Wn({title:"Smart filter saved"})},onError:s=>{Wn({title:"Error saving smart filter",description:s.message,variant:"destructive"})}})}function n5t(){const e=Br();return ar({mutationFn:async t=>{const{error:s}=await Y.from("contact_smart_lists").delete().eq("id",t);if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["contact-smart-lists"]}),Wn({title:"Smart filter deleted"})}})}function a5t({currentFilters:e,currentSortBy:t,onApplySmartList:s}){const{data:n}=r5t(),a=s5t(),o=n5t(),[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(uh,{children:[r.jsx(hh,{asChild:!0,children:r.jsxs(X,{variant:"outline",size:"sm",className:"gap-1.5",children:[r.jsx(G1,{className:"h-3.5 w-3.5"}),"Smart Filters",n&&n.length>0&&r.jsx(Tt,{variant:"secondary",className:"h-5 px-1.5 text-[10px]",children:n.length}),r.jsx(gd,{className:"h-3.5 w-3.5"})]})}),r.jsxs(Cu,{align:"start",className:"w-56",children:[n&&n.length>0?r.jsxs(r.Fragment,{children:[n.map(v=>r.jsxs(Wa,{className:"flex items-center justify-between group",children:[r.jsx("span",{className:"flex-1 cursor-pointer",onClick:()=>s(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(Bs,{className:"h-3 w-3 text-destructive"})})]},v.id)),r.jsx(dk,{})]}):r.jsx(Wa,{disabled:!0,className:"text-muted-foreground text-xs",children:"No saved filters yet"}),x&&r.jsxs(Wa,{onClick:()=>i(!0),children:[r.jsx(aA,{className:"h-4 w-4 mr-2"}),"Save Current Filter"]})]})]}),r.jsx(Or,{open:l,onOpenChange:i,children:r.jsxs(Pr,{className:"max-w-sm",children:[r.jsx(zr,{children:r.jsx(Rr,{children:"Save Smart Filter"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(ot,{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 HT(e){if(!e)return null;try{const t=e.split(/[-/T]/);if(t.length<3)return null;const s=parseInt(t[1],10)-1,n=parseInt(t[2],10);if(isNaN(s)||isNaN(n))return null;const a=new Date;a.setHours(0,0,0,0);let o=new Date(a.getFullYear(),s,n);return o.setHours(0,0,0,0),os)return null;const a=t==="birthday"?"🎂":"🏡",o=n===0?t==="birthday"?"Birthday today!":"Anniversary today!":n===1?t==="birthday"?"Birthday tomorrow":"Anniversary tomorrow":`${a} in ${n}d`;return{emoji:a,label:o,daysUntil:n}}function _Ce({birthday:e,homeAnniversary:t,className:s}){const n=vCe(e,"birthday",7),a=vCe(t,"anniversary",7);return!n&&!a?null:r.jsxs("div",{className:Ut("flex flex-wrap gap-1",s),children:[n&&r.jsx(Tt,{variant:"secondary",className:Ut("text-[10px] gap-0.5 font-medium",n.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:n.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 bCe({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 i5t(){const e=Pc();return Kt({queryKey:["contact-deals-map",e],queryFn:async()=>{const{data:t,error:s}=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(s)throw s;const n={};return(t||[]).forEach(a=>{a.contact_id&&!n[a.contact_id]&&(n[a.contact_id]=a)}),n},enabled:!!e})}function o5t(){const e=Hs(),[t]=Ic(),{user:s}=Yr(),n=H3(),a=Br(),o=t.get("type"),l=t.get("filter")??t.get("status"),i=t.get("new")==="true",{contactsWithScores:u,isLoading:m}=Uye(),{data:x}=Vf(),{data:y}=i5t(),v=Fye(),b=NRe(),N=zye(),[k,M]=A.useState(""),[E,T]=A.useState(o||"all"),[P,R]=A.useState(l||"all"),[D,U]=A.useState("date-added"),[q,H]=A.useState(i),[G,Q]=A.useState(null),[ne,ie]=A.useState(!1),[he,se]=A.useState(!1),[fe,oe]=A.useState(null),[ce,de]=A.useState(""),[xe,Me]=A.useState(new Set),[ve,be]=A.useState(!1),[we,tt]=A.useState(1),[Ae,Le]=A.useState(50),Ue=A.useCallback(Ie=>{be(!1),Me(Ze=>{const De=new Set(Ze);return De.has(Ie)?De.delete(Ie):De.add(Ie),De})},[]);A.useEffect(()=>{if(!(s!=null&&s.id))return;const Ie=Y.channel(`innercircle_contacts_inserts_${s.id}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"innercircle_contacts",filter:`owner_user_id=eq.${s.id}`},()=>{a.invalidateQueries({queryKey:["innercircle-contacts"]}),a.invalidateQueries({queryKey:["innercircle-contact-counts"]})}).subscribe();return()=>{Y.removeChannel(Ie)}},[a,s==null?void 0:s.id]),A.useEffect(()=>{l&&R(l)},[l]);const[Pe,$e]=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&&H(!0)},[i]),A.useEffect(()=>{var Ie;G&&$e({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:((Ie=G.tags)==null?void 0:Ie.map(Ze=>Ze.relationship_type_id))||[]})},[G]);const it=A.useMemo(()=>{if(!u)return[];let Ie=u.filter(Ze=>{var st,dt,ct;const De=k===""||`${Ze.first_name} ${Ze.last_name}`.toLowerCase().includes(k.toLowerCase())||((st=Ze.email)==null?void 0:st.toLowerCase().includes(k.toLowerCase()))||((dt=Ze.phone)==null?void 0:dt.includes(k)),Ke=E==="all"||((ct=Ze.tags)==null?void 0:ct.some(zt=>zt.relationship_type_id===E));return De&&Ke});return P==="not-touched-90"?Ie=Ie.filter(Ze=>{const De=Ze.relationshipScore.daysSinceTouch;return De===null||De>90}):P==="at-risk"?Ie=Ie.filter(Ze=>Ze.relationshipScore.status==="at-risk"):P==="cooling"?Ie=Ie.filter(Ze=>Ze.relationshipScore.status==="cooling"):P==="warm"?Ie=Ie.filter(Ze=>Ze.relationshipScore.status==="warm"):P==="has-deal"?Ie=Ie.filter(Ze=>y&&y[Ze.id]):P==="no-deal"?Ie=Ie.filter(Ze=>!y||!y[Ze.id]):P==="open-house"&&(Ie=Ie.filter(Ze=>Ze.lead_source==="Open House")),Ie=[...Ie].sort((Ze,De)=>{switch(D){case"important-dates":{const Ke=HT(Ze.birthday),st=HT(De.birthday),dt=HT(Ze.home_anniversary),ct=HT(De.home_anniversary),zt=[Ke,dt].filter(Tr=>Tr!==null).sort((Tr,Zr)=>(Tr??1/0)-(Zr??1/0))[0]??1/0,ir=[st,ct].filter(Tr=>Tr!==null).sort((Tr,Zr)=>(Tr??1/0)-(Zr??1/0))[0]??1/0;return zt-ir}case"last-touched":{const Ke=Ze.relationshipScore.lastTouchDate,st=De.relationshipScore.lastTouchDate;return!Ke&&!st?0:Ke?st?new Date(Ke).getTime()-new Date(st).getTime():1:-1}case"next-touch":{const Ke=Ze.relationshipScore.daysSinceTouch,st=De.relationshipScore.daysSinceTouch;return Ke===null&&st===null?0:Ke===null?-1:st===null?1:st-Ke}case"score":return Ze.relationshipScore.score-De.relationshipScore.score;case"date-added":{const Ke=Ze.created_at,st=De.created_at;return!Ke&&!st?0:Ke?st?new Date(st).getTime()-new Date(Ke).getTime():-1:1}case"name":default:{const Ke=`${Ze.first_name||""} ${Ze.last_name||""}`.toLowerCase(),st=`${De.first_name||""} ${De.last_name||""}`.toLowerCase();return Ke.localeCompare(st)}}}),Ie},[u,k,E,P,D,y]),xt=it.length,Ee=Math.max(1,Math.ceil(xt/Ae)),et=Math.min(we,Ee),le=A.useMemo(()=>{const Ie=(et-1)*Ae;return it.slice(Ie,Ie+Ae)},[it,et,Ae]);A.useEffect(()=>{tt(1)},[k,E,P,D]);const Ve=A.useCallback(()=>{be(!1),Me(Ie=>Ie.size>0?new Set:new Set(le.map(Ze=>Ze.id)))},[le]),Je=A.useCallback(()=>{be(!0),Me(new Set(it.map(Ie=>Ie.id)))},[it]),rt=A.useCallback((Ie,Ze)=>{M(Ie.search||""),T(Ie.type||"all"),R(Ie.status||"all"),U(Ze||"name")},[]),je=()=>{$e({first_name:"",last_name:"",email:"",phone:"",address:"",city:"",state:"",zip_code:"",birthday:"",home_anniversary:"",spouse_name:"",spouse_email:"",notes:"",tagIds:[]})},lt=async Ie=>{Ie.preventDefault(),G?(await b.mutateAsync({id:G.id,...Pe}),Q(null)):(await v.mutateAsync(Pe),H(!1)),je()},Ce=async Ie=>{confirm("Are you sure you want to delete this contact?")&&await N.mutateAsync(Ie)};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(Sc,{className:"h-4 w-4 mr-1"}),"Back"]})}),r.jsx(He,{children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by name, email, or phone...",value:k,onChange:Ie=>M(Ie.target.value),className:"pl-9"})]}),r.jsxs(us,{value:E,onValueChange:T,children:[r.jsx(cs,{className:"w-[160px]",children:r.jsx(ms,{placeholder:"Filter by type"})}),r.jsxs(ds,{children:[r.jsx($t,{value:"all",children:"All Types"}),x==null?void 0:x.filter(Ie=>Ie.active).map(Ie=>r.jsx($t,{value:Ie.id,children:Ie.name},Ie.id))]})]}),r.jsxs(us,{value:P,onValueChange:R,children:[r.jsx(cs,{className:"w-[160px]",children:r.jsx(ms,{placeholder:"Filter by status"})}),r.jsxs(ds,{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.jsx($t,{value:"has-deal",children:"📋 Has Deal"}),r.jsx($t,{value:"no-deal",children:"📭 No Deal"}),r.jsx($t,{value:"open-house",children:"🏠 Open House"})]})]}),r.jsxs(us,{value:D,onValueChange:U,children:[r.jsx(cs,{className:"w-[180px]",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Dg,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ms,{placeholder:"Sort by"})]})}),r.jsxs(ds,{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(a5t,{currentFilters:{search:k,type:E,status:P},currentSortBy:D,onApplySmartList:rt}),r.jsxs(X,{onClick:()=>H(!0),children:[r.jsx(vs,{className:"h-4 w-4 mr-1"}),"Add Contact"]}),r.jsxs(X,{variant:"outline",onClick:()=>ie(!0),children:[r.jsx(so,{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(t5t,{selectedIds:xe,contacts:it,onClearSelection:()=>{Me(new Set),be(!1)}}),xe.size>0&&xe.size===le.length&&!ve&&xt>Ae&&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:Je,children:["Select all ",xt.toLocaleString()," matching contacts"]})]}),ve&&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 ",xt.toLocaleString()," matching contacts are selected.",r.jsx(X,{variant:"link",size:"sm",className:"h-auto p-0",onClick:()=>{Me(new Set),be(!1)},children:"Clear selection"})]}),n?r.jsx("div",{className:"space-y-3",children:m?r.jsx(He,{className:"p-6 text-center text-muted-foreground",children:"Loading contacts..."}):it.length===0?r.jsx(He,{className:"p-6 text-center text-muted-foreground",children:k||E!=="all"||P!=="all"?"No contacts match your search":"No contacts yet. Add your first contact!"}):le.map(Ie=>{var De;const{relationshipScore:Ze}=Ie;return r.jsx(He,{className:"cursor-pointer hover:bg-accent/50 transition-colors",onClick:()=>{const Ke=new URLSearchParams;k&&Ke.set("search",k),E!=="all"&&Ke.set("type",E),P!=="all"&&Ke.set("filter",P);const st=Ke.toString();e(`/mission-control/contacts/${Ie.id}${st?`?${st}`:""}`)},children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsxs("h3",{className:"font-semibold text-base truncate",children:[Ie.first_name," ",Ie.last_name]}),r.jsx(Zi,{className:"h-4 w-4 text-muted-foreground shrink-0"})]}),r.jsxs("div",{className:"space-y-1 text-sm mb-3",children:[Ie.email&&r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(Nn,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:"truncate",children:Ie.email})]}),Ie.phone&&r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(Pi,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{children:Ie.phone})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1 mb-2",children:[r.jsx(Ude,{score:Ze,size:"sm"}),r.jsx(Npe,{contact:Ie}),Ie.lead_source&&r.jsx(Tt,{variant:"outline",className:"text-xs gap-1 border-primary/30 text-primary",children:Ie.lead_source}),(De=Ie.tags)==null?void 0:De.map(Ke=>{var st;return r.jsx(Tt,{variant:"secondary",className:"text-xs",children:(st=Ke.relationship_type)==null?void 0:st.name},Ke.id)}),r.jsx(bCe,{deal:y==null?void 0:y[Ie.id]})]}),r.jsx(_Ce,{birthday:Ie.birthday,homeAnniversary:Ie.home_anniversary,className:"mb-2"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[Ze.lastTouchDate?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Ra,{className:"h-3 w-3"}),rs(new Date(Ze.lastTouchDate),"MMM d")]}):r.jsx("span",{className:"italic",children:"Never contacted"}),Ie.birthday&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(jn,{className:"h-3 w-3"}),rs(new Date(Ie.birthday),"MMM d")]}),Ie.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(sa,{className:"h-3 w-3"}),rs(new Date(Ie.home_anniversary),"MMM d")]})]})]}),r.jsx("div",{className:"ml-2",onClick:Ke=>Ke.stopPropagation(),children:r.jsx(yCe,{contact:Ie,onEdit:Q,onDelete:Ce,onSnooze:(Ke,st)=>{oe(Ke),de(st)}})})]})})},Ie.id)})}):r.jsx(He,{children:r.jsx(Xe,{className:"p-0 overflow-x-auto",children:r.jsxs(Pn,{className:"min-w-[800px]",children:[r.jsx(Ln,{children:r.jsxs(kr,{children:[r.jsx(Mt,{className:"w-[40px]",children:r.jsx(bl,{checked:le.length>0&&le.every(Ie=>xe.has(Ie.id)),onCheckedChange:()=>Ve()})}),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(On,{children:m?r.jsx(kr,{children:r.jsx(gt,{colSpan:9,className:"text-center py-8",children:"Loading contacts..."})}):it.length===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:9,className:"text-center py-8 text-muted-foreground",children:k||E!=="all"||P!=="all"?"No contacts match your search":"No contacts yet. Add your first contact!"})}):le.map(Ie=>{var Ke;const{relationshipScore:Ze}=Ie,De=y==null?void 0:y[Ie.id];return r.jsxs(kr,{className:`cursor-pointer hover:bg-accent/50 ${xe.has(Ie.id)?"bg-accent/30":""}`,onClick:()=>{const st=new URLSearchParams;k&&st.set("search",k),E!=="all"&&st.set("type",E),P!=="all"&&st.set("status",P);const dt=st.toString();e(`/mission-control/contacts/${Ie.id}${dt?`?${dt}`:""}`)},children:[r.jsx(gt,{onClick:st=>st.stopPropagation(),children:r.jsx(bl,{checked:xe.has(Ie.id),onCheckedChange:()=>Ue(Ie.id)})}),r.jsxs(gt,{className:"font-medium",children:[Ie.first_name," ",Ie.last_name]}),r.jsx(gt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(Ude,{score:Ze,size:"sm"}),r.jsx(Npe,{contact:Ie})]})}),r.jsx(gt,{children:r.jsx(Ude,{score:Ze,size:"sm",showScore:!0})}),r.jsx(gt,{children:r.jsxs("div",{className:"space-y-1 text-sm",children:[Ie.email&&r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Nn,{className:"h-3 w-3"}),Ie.email]}),Ie.phone&&r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Pi,{className:"h-3 w-3"}),Ie.phone]})]})}),r.jsx(gt,{children:r.jsxs("div",{className:"flex flex-wrap gap-1",children:[Ie.lead_source&&r.jsx(Tt,{variant:"outline",className:"text-xs border-primary/30 text-primary",children:Ie.lead_source}),(Ke=Ie.tags)==null?void 0:Ke.map(st=>{var dt;return r.jsx(Tt,{variant:"secondary",className:"text-xs",children:(dt=st.relationship_type)==null?void 0:dt.name},st.id)}),r.jsx(bCe,{deal:De})]})}),r.jsx(gt,{children:r.jsx("div",{className:"text-sm",children:Ze.lastTouchDate?r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Ra,{className:"h-3 w-3"}),rs(new Date(Ze.lastTouchDate),"MMM d, yyyy")]}):r.jsx("span",{className:"text-muted-foreground text-xs italic",children:"Never contacted"})})}),r.jsx(gt,{children:r.jsxs("div",{className:"space-y-1",children:[r.jsx(_Ce,{birthday:Ie.birthday,homeAnniversary:Ie.home_anniversary}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Ie.birthday&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(jn,{className:"h-3 w-3"}),rs(new Date(Ie.birthday),"MMM d")]}),Ie.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(sa,{className:"h-3 w-3"}),rs(new Date(Ie.home_anniversary),"MMM d")]})]})]})}),r.jsx(gt,{children:r.jsx(yCe,{contact:Ie,onEdit:Q,onDelete:Ce,onSnooze:(st,dt)=>{oe(st),de(dt)}})})]},Ie.id)})})]})})}),xt>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 ",(et-1)*Ae+1,"–",Math.min(et*Ae,xt)," of ",xt.toLocaleString()," contacts"]}),r.jsxs(us,{value:String(Ae),onValueChange:Ie=>{Le(Number(Ie)),tt(1)},children:[r.jsx(cs,{className:"w-[80px] h-8",children:r.jsx(ms,{})}),r.jsxs(ds,{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:et<=1,onClick:()=>tt(1),children:"First"}),r.jsx(X,{variant:"outline",size:"sm",disabled:et<=1,onClick:()=>tt(Ie=>Ie-1),children:r.jsx(Sc,{className:"h-4 w-4"})}),r.jsxs("span",{className:"px-3 text-sm font-medium",children:["Page ",et," of ",Ee]}),r.jsx(X,{variant:"outline",size:"sm",disabled:et>=Ee,onClick:()=>tt(Ie=>Ie+1),children:r.jsx(Zi,{className:"h-4 w-4"})}),r.jsx(X,{variant:"outline",size:"sm",disabled:et>=Ee,onClick:()=>tt(Ee),children:"Last"})]})]}),r.jsx(Or,{open:q||!!G,onOpenChange:Ie=>{Ie||(H(!1),Q(null),je())},children:r.jsxs(Pr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Rr,{children:G?"Edit Contact":"Add Contact"})}),r.jsxs("form",{onSubmit:lt,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(ot,{id:"first_name",value:Pe.first_name,onChange:Ie=>$e({...Pe,first_name:Ie.target.value}),required:!0})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"last_name",children:"Last Name"}),r.jsx(ot,{id:"last_name",value:Pe.last_name,onChange:Ie=>$e({...Pe,last_name:Ie.target.value})})]})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"email",children:"Email"}),r.jsx(ot,{id:"email",type:"email",value:Pe.email,onChange:Ie=>$e({...Pe,email:Ie.target.value})})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"phone",children:"Phone"}),r.jsx(ot,{id:"phone",value:Pe.phone,onChange:Ie=>$e({...Pe,phone:Ie.target.value})})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"address",children:"Address"}),r.jsx(ot,{id:"address",value:Pe.address,onChange:Ie=>$e({...Pe,address:Ie.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(ot,{id:"city",value:Pe.city,onChange:Ie=>$e({...Pe,city:Ie.target.value})})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"state",children:"State"}),r.jsx(ot,{id:"state",value:Pe.state,onChange:Ie=>$e({...Pe,state:Ie.target.value})})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"zip_code",children:"Zip"}),r.jsx(ot,{id:"zip_code",value:Pe.zip_code,onChange:Ie=>$e({...Pe,zip_code:Ie.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(ot,{id:"birthday",type:"date",value:Pe.birthday,onChange:Ie=>$e({...Pe,birthday:Ie.target.value})})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"home_anniversary",children:"Home Anniversary"}),r.jsx(ot,{id:"home_anniversary",type:"date",value:Pe.home_anniversary,onChange:Ie=>$e({...Pe,home_anniversary:Ie.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(ot,{id:"spouse_name",value:Pe.spouse_name,onChange:Ie=>$e({...Pe,spouse_name:Ie.target.value}),placeholder:"Spouse/partner name"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"spouse_email",children:"Spouse/Partner Email"}),r.jsx(ot,{id:"spouse_email",type:"email",value:Pe.spouse_email,onChange:Ie=>$e({...Pe,spouse_email:Ie.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(Ie=>Ie.active).map(Ie=>r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx(bl,{checked:Pe.tagIds.includes(Ie.id),onCheckedChange:Ze=>{$e(Ze?{...Pe,tagIds:[...Pe.tagIds,Ie.id]}:{...Pe,tagIds:Pe.tagIds.filter(De=>De!==Ie.id)})}}),r.jsx("span",{className:"text-sm",children:Ie.name})]},Ie.id))})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"notes",children:"Notes"}),r.jsx(Ys,{id:"notes",value:Pe.notes,onChange:Ie=>$e({...Pe,notes:Ie.target.value}),rows:3})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(X,{type:"button",variant:"outline",onClick:()=>{H(!1),Q(null),je()},children:"Cancel"}),r.jsxs(X,{type:"submit",disabled:v.isPending||b.isPending,children:[G?"Update":"Create"," Contact"]})]})]})]})}),r.jsx(X3t,{open:ne,onOpenChange:ie,relationshipTypes:(x==null?void 0:x.filter(Ie=>Ie.active))||[],onSuccess:()=>{ie(!1)}}),r.jsx(e5t,{open:he,onOpenChange:se,onComplete:()=>se(!1)}),r.jsx(Uae,{open:!!fe,onOpenChange:Ie=>{Ie||oe(null)},contactId:fe||"",contactName:ce})]})})}function l5t(){return Kt({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 c5t(e){return Kt({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:s,error:n}=await t;if(n)throw n;return s}})}function d5t(){const{user:e}=Yr();return Kt({queryKey:["user-video-scripts",e==null?void 0:e.id],queryFn:async()=>{if(!(e!=null&&e.id))return[];const{data:t,error:s}=await Y.from("user_video_scripts").select("*, category:video_script_categories(*)").eq("owner_user_id",e.id).order("title");if(s)throw s;return t},enabled:!!(e!=null&&e.id)})}function u5t(){const{user:e}=Yr(),t=Br();return ar({mutationFn:async s=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const{data:n,error:a}=await Y.from("user_video_scripts").insert([{owner_user_id:e.id,source_script_id:s.id,category_id:s.category_id,title:s.title,script_text:s.script_text,tags:s.tags,is_custom:!1}]).select().single();if(a)throw a;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["user-video-scripts"]})}})}function h5t(e){const{user:t}=Yr();return Kt({queryKey:["agent-videos",t==null?void 0:t.id,e],queryFn:async()=>{if(!(t!=null&&t.id))return[];let s=Y.from("agent_videos").select("*, contact:innercircle_contacts(id, first_name, last_name)").eq("owner_user_id",t.id).order("created_at",{ascending:!1});s=s.eq("is_deleted",!1);const{data:n,error:a}=await s;if(a)throw a;return n},enabled:!!(t!=null&&t.id)})}function m5t(e){return Kt({queryKey:["agent-video",e],queryFn:async()=>{const{data:t,error:s}=await Y.from("agent_videos").select("*, contact:innercircle_contacts(id, first_name, last_name)").eq("id",e).single();if(s)throw s;return t},enabled:!!e})}function Hae(){const{user:e}=Yr(),t=Br();return ar({mutationFn:async s=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const{data:n,error:a}=await Y.from("agent_videos").insert([{owner_user_id:e.id,contact_id:s.contact_id,bunny_video_id:s.bunny_video_id,playback_url:s.playback_url,thumbnail_url:s.thumbnail_url,preview_url:s.preview_url,duration_seconds:s.duration_seconds,file_size_mb:s.file_size_mb||0,title:s.title,notes:s.notes,task_id:s.task_id,status:s.status||"processing",touch_type:s.touch_type||"video",page_template:"default"}]).select("*, share_token").single();if(a)throw a;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["agent-videos"]}),t.invalidateQueries({queryKey:["storage-usage"]})}})}function p5t(){const e=Br();return ar({mutationFn:async({id:t,...s})=>{const{data:n,error:a}=await Y.from("agent_videos").update(s).eq("id",t).select().single();if(a)throw a;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["agent-videos"]}),e.invalidateQueries({queryKey:["agent-video",t.id]})}})}function f5t(){const e=Br();return ar({mutationFn:async({id:t,bunnyVideoId:s,hardDelete:n=!1})=>{if(console.log("Deleting video:",{id:t,bunnyVideoId:s,hardDelete:n}),s){console.log("Calling bunny-upload delete for videoId:",s);const{data:a,error:o}=await Y.functions.invoke("bunny-upload",{body:{action:"delete",videoId:s,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(n){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 Wae(){const{user:e}=Yr();return Kt({queryKey:["storage-usage",e==null?void 0:e.id],queryFn:async()=>{if(!(e!=null&&e.id))return null;const{data:t,error:s}=await Y.from("agent_storage_usage").select("*").eq("user_id",e.id).maybeSingle();if(s)throw s;return t||{user_id:e.id,total_storage_mb:0,storage_tier:"basic",max_storage_mb:1024}},enabled:!!(e!=null&&e.id)})}function SBe(){const{data:e,isLoading:t}=Wae(),s=e?e.total_storage_mb0?e.total_storage_mb/e.max_storage_mb*100:0,o=a>=80;return{canRecord:s,remainingMb:n,usagePercent:a,isNearLimit:o,storage:e,isLoading:t}}async function CBe(e){const{data:t,error:s}=await Y.functions.invoke("bunny-upload",{body:{action:"create",title:e,isAgentVideo:!0}});if(s)throw s;return t}async function MBe(e){const{data:t,error:s}=await Y.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:e,isAgentVideo:!0}});if(s)throw s;return t}async function TBe(e){const{data:t,error:s}=await Y.functions.invoke("bunny-upload",{body:{action:"status",videoId:e,isAgentVideo:!0}});if(s)throw s;return t}function g5t(){const{user:e}=Yr(),t=Br();return ar({mutationFn:async({contactId:s,videoId:n,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:s,action_type_id:o.id,notes:a||`Quick Video Touch - Video ID: ${n}`}]).select().single();if(i)throw i;return l},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-touch-logs"]}),t.invalidateQueries({queryKey:["contacts"]})}})}function x5t(e){return Kt({queryKey:["contact-video-replies",e],queryFn:async()=>{if(!e)return[];const{data:t,error:s}=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(s)throw s;return t},enabled:!!e})}function y5t({videoId:e}){var l;const{data:t,isLoading:s,error:n}=m5t(e);if(s)return r.jsxs("div",{className:"space-y-4",children:[r.jsx(Cr,{className:"w-full aspect-video rounded-lg"}),r.jsx(Cr,{className:"h-4 w-1/3"})]});if(n||!t||t.is_deleted)return r.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[r.jsx(Zu,{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 v5t({contactId:e}){const t=Hs(),{data:s,isLoading:n}=Kt({queryKey:["contact-linked-deals",e],queryFn:async()=>{const{data:a,error:o}=await Y.from("deal_pipeline").select(` id, deal_name, deal_type, expected_price, property_address, stage:deal_pipeline_stages(id, name, color, icon, is_won_stage, is_lost_stage) `).eq("contact_id",e).order("updated_at",{ascending:!1});if(o)throw o;return a},enabled:!!e});return n||!s||s.length===0?null:r.jsxs(He,{children:[r.jsx(Vt,{className:"pb-2",children:r.jsxs(Gt,{className:"text-base flex items-center gap-2",children:[r.jsx(rh,{className:"h-4 w-4"}),"Linked Deals"]})}),r.jsx(Xe,{className:"space-y-2",children:s.map(a=>{const o=a.stage;return r.jsx("button",{onClick:()=>t(`/mission-control/pipeline?deal=${a.id}`),className:"w-full text-left p-3 rounded-lg border hover:bg-accent transition-colors group",children:r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"font-medium text-sm truncate",children:a.deal_name}),a.property_address&&r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:a.property_address}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx(Tt,{variant:"outline",className:"text-[10px] capitalize",children:a.deal_type}),o&&r.jsxs(Tt,{variant:"outline",className:"text-[10px] gap-1",style:{borderColor:o.color,color:o.color,backgroundColor:`${o.color}10`},children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full inline-block",style:{backgroundColor:o.color}}),o.name]})]})]}),r.jsx(to,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors flex-shrink-0"})]})},a.id)})})]})}function _5t(){var et,le;const{contactId:e}=hc(),t=Hs(),[s]=Ic(),n=s.get("search")||"",a=s.get("type")||"all",o=s.get("status")||"all",{data:l,isLoading:i}=$gt(e||""),{data:u}=Vf(),{data:m}=Bye(),{data:x}=uae(365),{data:y}=Vae(365),{data:v}=x5t(e),{contactsWithScores:b}=Uye(),N=NRe(),k=zye(),M=CRe(),[E,T]=A.useState(!1),[P,R]=A.useState({}),[D,U]=A.useState(!1),[q,H]=A.useState(null),[G,Q]=A.useState(""),[ne,ie]=A.useState(null),[he,se]=A.useState(!1),[fe,oe]=A.useState(null),{isGmailConnected:ce,gmailEmail:de}=MP(),{data:xe}=Kt({queryKey:["gmail-sent-emails",e],queryFn:async()=>{const{data:Ve,error:Je}=await Y.from("gmail_sent_emails").select("*").eq("contact_id",e).order("sent_at",{ascending:!1});if(Je)throw Je;return Ve},enabled:!!e}),Me=Ve=>{if(!Ve)return null;const Je=Ve.match(/Video ID:\s*([a-f0-9-]+)/i);return Je?Je[1]:null},ve=A.useMemo(()=>{if(!b)return[];let Ve=b.filter(Je=>{var lt,Ce,Ie;const rt=n===""||`${Je.first_name} ${Je.last_name}`.toLowerCase().includes(n.toLowerCase())||((lt=Je.email)==null?void 0:lt.toLowerCase().includes(n.toLowerCase()))||((Ce=Je.phone)==null?void 0:Ce.includes(n)),je=a==="all"||((Ie=Je.tags)==null?void 0:Ie.some(Ze=>Ze.relationship_type_id===a));return rt&&je});return o==="not-touched-90"?Ve=Ve.filter(Je=>{const rt=Je.relationshipScore.daysSinceTouch;return rt===null||rt>90}):o==="at-risk"?Ve=Ve.filter(Je=>Je.relationshipScore.status==="at-risk"):o==="cooling"?Ve=Ve.filter(Je=>Je.relationshipScore.status==="cooling"):o==="warm"&&(Ve=Ve.filter(Je=>Je.relationshipScore.status==="warm")),Ve.map(Je=>Je.id)},[b,n,a,o]),be=ve.indexOf(e||""),we=be>0?ve[be-1]:null,tt=be1&&be!==-1,Le=Ve=>{const Je=new URLSearchParams;n&&Je.set("search",n),a!=="all"&&Je.set("type",a),o!=="all"&&Je.set("status",o);const rt=Je.toString();return`/mission-control/contacts/${Ve}${rt?`?${rt}`:""}`},Ue=A.useMemo(()=>{const Ve=((x==null?void 0:x.filter(rt=>rt.contact_id===e))||[]).map(rt=>{var lt,Ce;const je=Me(rt.notes);return{id:rt.id,type:"touch",completed_at:rt.completed_at,name:((lt=rt.action_type)==null?void 0:lt.name)||"Touch",color:((Ce=rt.action_type)==null?void 0:Ce.color)||"#3B82F6",notes:rt.notes,videoId:je}}),Je=((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[...Ve,...Je].sort((rt,je)=>new Date(je.completed_at).getTime()-new Date(rt.completed_at).getTime())},[x,y,e]),Pe=()=>{var Ve;l&&(R({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:((Ve=l.tags)==null?void 0:Ve.map(Je=>Je.relationship_type_id))||[]}),T(!0))},$e=async()=>{await N.mutateAsync({id:e,...P}),T(!1)},it=async()=>{confirm("Are you sure you want to delete this contact?")&&(await k.mutateAsync(e),t("/mission-control/contacts"))},xt=async()=>{q&&(await M.mutateAsync({contactId:e,actionTypeId:q,notes:G}),U(!1),H(null),Q(""))},Ee=(Ve,Je)=>{ce&&l?(oe({email:Ve,name:Je||`${l.first_name} ${l.last_name||""}`.trim()}),se(!0)):window.location.href=`mailto:${Ve}`};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(Sc,{className:"h-4 w-4 mr-1"}),"Back to Contacts"]}),Ae&&r.jsxs("div",{className:"flex items-center gap-1 ml-2 border-l pl-2",children:[r.jsxs(X,{variant:"ghost",size:"sm",onClick:()=>we&&t(Le(we)),disabled:!we,className:"px-2",children:[r.jsx(Sc,{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:[be+1," of ",ve.length]}),r.jsxs(X,{variant:"ghost",size:"sm",onClick:()=>tt&&t(Le(tt)),disabled:!tt,className:"px-2",children:[r.jsx("span",{className:"sr-only sm:not-sr-only sm:mr-1",children:"Next"}),r.jsx(Zi,{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:()=>Ee(l.email,`${l.first_name} ${l.last_name||""}`.trim()),children:[r.jsx(Nn,{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(Ta,{className:"h-4 w-4 mr-1"}),"Quick Video Touch"]}),r.jsxs(Or,{open:D,onOpenChange:U,children:[r.jsx(vo,{asChild:!0,children:r.jsxs(X,{variant:"outline",children:[r.jsx(vs,{className:"h-4 w-4 mr-1"}),"Log Action"]})}),r.jsxs(Pr,{children:[r.jsx(zr,{children:r.jsx(Rr,{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(Ve=>Ve.active).map(Ve=>r.jsxs("button",{onClick:()=>H(Ve.id),className:` p-3 rounded-lg border text-left transition-all ${q===Ve.id?"border-primary bg-primary/10":"hover:bg-accent"} `,children:[r.jsx("div",{className:"font-medium",children:Ve.name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:Ve.description})]},Ve.id))})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"action-notes",children:"Notes (optional)"}),r.jsx(Ys,{id:"action-notes",value:G,onChange:Ve=>Q(Ve.target.value),placeholder:"Add any notes about this interaction...",rows:3})]}),r.jsxs(X,{onClick:xt,disabled:!q||M.isPending,className:"w-full",children:[r.jsx(fi,{className:"h-4 w-4 mr-1"}),"Complete Action"]})]})]})]}),r.jsxs(X,{variant:"outline",onClick:Pe,children:[r.jsx(vc,{className:"h-4 w-4 mr-1"}),"Edit"]}),r.jsx(X,{variant:"destructive",size:"icon",onClick:it,children:r.jsx(Bs,{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:()=>Ee(l.email),className:"flex items-center gap-1 hover:text-primary transition-colors",children:[r.jsx(Nn,{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(Pi,{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(Npe,{contact:l}),(et=l.tags)==null?void 0:et.map(Ve=>{const Je=u==null?void 0:u.find(rt=>rt.id===Ve.relationship_type_id);return Je?r.jsx(Tt,{variant:"secondary",className:"text-xs",children:Je.name},Ve.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(Vt,{children:r.jsx(Gt,{children:"Contact Information"})}),r.jsx(Xe,{children:E?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"first_name",children:"First Name"}),r.jsx(ot,{id:"first_name",value:P.first_name,onChange:Ve=>R({...P,first_name:Ve.target.value})})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"last_name",children:"Last Name"}),r.jsx(ot,{id:"last_name",value:P.last_name,onChange:Ve=>R({...P,last_name:Ve.target.value})})]})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"email",children:"Email"}),r.jsx(ot,{id:"email",type:"email",value:P.email,onChange:Ve=>R({...P,email:Ve.target.value})})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"phone",children:"Phone"}),r.jsx(ot,{id:"phone",value:P.phone,onChange:Ve=>R({...P,phone:Ve.target.value})})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"address",children:"Street Address"}),r.jsx(ot,{id:"address",value:P.address,onChange:Ve=>R({...P,address:Ve.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(ot,{id:"city",value:P.city,onChange:Ve=>R({...P,city:Ve.target.value}),placeholder:"City"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"state",children:"State"}),r.jsx(ot,{id:"state",value:P.state,onChange:Ve=>R({...P,state:Ve.target.value}),placeholder:"TX",maxLength:2})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"zip_code",children:"Zip Code"}),r.jsx(ot,{id:"zip_code",value:P.zip_code,onChange:Ve=>R({...P,zip_code:Ve.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(ot,{id:"birthday",type:"date",value:P.birthday,onChange:Ve=>R({...P,birthday:Ve.target.value})})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"home_anniversary",children:"Home Anniversary"}),r.jsx(ot,{id:"home_anniversary",type:"date",value:P.home_anniversary,onChange:Ve=>R({...P,home_anniversary:Ve.target.value})})]})]}),r.jsx(pd,{}),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(ot,{id:"spouse_name",value:P.spouse_name,onChange:Ve=>R({...P,spouse_name:Ve.target.value}),placeholder:"Enter spouse name"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"spouse_email",children:"Spouse/Partner Email"}),r.jsx(ot,{id:"spouse_email",type:"email",value:P.spouse_email,onChange:Ve=>R({...P,spouse_email:Ve.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(ot,{id:"company_name",value:P.company_name,onChange:Ve=>R({...P,company_name:Ve.target.value}),placeholder:"Enter company name"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"job_title",children:"Job Title"}),r.jsx(ot,{id:"job_title",value:P.job_title,onChange:Ve=>R({...P,job_title:Ve.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(Ve=>Ve.active).map(Ve=>{var Je;return r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx(bl,{checked:(Je=P.tagIds)==null?void 0:Je.includes(Ve.id),onCheckedChange:rt=>{var je;R(rt?{...P,tagIds:[...P.tagIds||[],Ve.id]}:{...P,tagIds:(je=P.tagIds)==null?void 0:je.filter(lt=>lt!==Ve.id)})}}),r.jsx("span",{className:"text-sm",children:Ve.name})]},Ve.id)})})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"notes",children:"Notes"}),r.jsx(Ys,{id:"notes",value:P.notes,onChange:Ve=>R({...P,notes:Ve.target.value}),rows:4})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(X,{onClick:$e,disabled:N.isPending,children:"Save Changes"}),r.jsx(X,{variant:"outline",onClick:()=>T(!1),children:"Cancel"})]})]}):r.jsxs("div",{className:"space-y-4",children:[Ue.length>0&&r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 flex items-center gap-2",children:[r.jsx(jn,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"text-sm",children:[r.jsx("span",{className:"font-medium",children:"Last Contacted:"})," ",rs(new Date(Ue[0].completed_at),"MMM d, yyyy")," ","(",Ue[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(Nn,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx("button",{onClick:()=>Ee(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(Pi,{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(po,{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(jn,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Birthday: ",rs(new Date(l.birthday),"MMMM d")]})]}),l.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(sa,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Home Anniversary: ",rs(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(pd,{}),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(oc,{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(Nn,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("button",{onClick:()=>Ee(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(pi,{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(pd,{}),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(Ve=>{var Je;return r.jsx(Tt,{variant:"secondary",children:(Je=Ve.relationship_type)==null?void 0:Je.name},Ve.id)}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"No relationship types assigned"})})]}),l.notes&&r.jsxs(r.Fragment,{children:[r.jsx(pd,{}),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(G3t,{contact:l,onLogTouch:()=>U(!0)}),r.jsx(v5t,{contactId:e}),r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsx(Gt,{children:"Activity Log"})}),r.jsx(Xe,{children:Ue.length>0?r.jsx("div",{className:"space-y-4",children:Ue.map(Ve=>{var Je;return r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0",children:[r.jsx("div",{className:"h-8 w-8 rounded-full flex items-center justify-center text-white text-xs",style:{backgroundColor:Ve.color},children:Ve.type==="popby"?r.jsx(oo,{className:"h-4 w-4"}):(Je=Ve.name)==null?void 0:Je.charAt(0)}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"font-medium text-sm",children:Ve.name}),Ve.videoId&&r.jsxs(X,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>ie(Ve.videoId),children:[r.jsx(Hl,{className:"h-3 w-3 mr-1"}),"Preview"]})]}),r.jsx("div",{className:"text-xs text-muted-foreground",children:rs(new Date(Ve.completed_at),"MMM d, yyyy h:mm a")}),Ve.notes&&!Ve.videoId&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:Ve.notes})]})]},Ve.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(Vt,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Bo,{className:"h-5 w-5 text-primary"}),"Video Replies"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"space-y-4",children:v.map(Ve=>{var Je,rt;return r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0",children:[(Je=Ve.video)!=null&&Je.thumbnail_url?r.jsx("img",{src:Ve.video.thumbnail_url,alt:Ve.video.title||"Video",className:"h-12 w-16 object-cover rounded cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>ie(Ve.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:()=>ie(Ve.video_id),children:r.jsx(Ta,{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=Ve.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:()=>ie(Ve.video_id),children:[r.jsx(Hl,{className:"h-3 w-3 mr-1"}),"Watch"]})]}),r.jsx("div",{className:"text-xs text-muted-foreground",children:rs(new Date(Ve.created_at),"MMM d, yyyy h:mm a")}),Ve.message&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:['"',Ve.message,'"']})]})]},Ve.id)})})})]}),xe&&xe.length>0&&r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(ro,{className:"h-5 w-5 text-sky-500"}),"Sent Emails"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"space-y-4",children:xe.map(Ve=>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(Nn,{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:Ve.subject}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["To: ",Ve.to_email," · ",rs(new Date(Ve.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:Ve.body})]},Ve.id))})})]})]}),r.jsx(Or,{open:!!ne,onOpenChange:Ve=>!Ve&&ie(null),children:r.jsxs(Pr,{className:"max-w-2xl",children:[r.jsx(zr,{children:r.jsx(Rr,{children:"Video Preview"})}),ne&&r.jsx(y5t,{videoId:ne})]})})]})]})}),ce&&l&&fe&&r.jsx(qae,{open:he,onOpenChange:se,contact:{id:l.id,first_name:l.first_name,last_name:l.last_name,email:fe.email},gmailEmail:de})]}):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 wCe={Crown:V1,FileText:ga,Users:qs,Globe:uy,Star:Mn,Phone:Pi,MessageSquare:Bo,PenTool:Vj,Video:Ta,Gift:oo},qde=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function b5t(){var Ke,st;const e=Hs(),{user:t}=Yr(),{data:s}=Vf(),{data:n}=qgt(),{data:a}=Ygt(),{data:o}=kRe(),{data:l}=Bye(),{data:i}=Ugt(),u=Xgt(),m=Vgt(),x=Wgt(),y=Ggt(),v=Kgt(),b=Zgt(),N=Hgt(),[k,M]=A.useState(null),[E,T]=A.useState(!1),[P,R]=A.useState(null),[D,U]=A.useState(""),[q,H]=A.useState(""),[G,Q]=A.useState([]),[ne,ie]=A.useState(null),[he,se]=A.useState(null),[fe,oe]=A.useState(!1),[ce,de]=A.useState(""),[xe,Me]=A.useState(""),[ve,be]=A.useState(""),[we,tt]=A.useState(""),Ae=(dt,ct)=>a==null?void 0:a.some(zt=>zt.plan_id===dt&&zt.relationship_type_id===ct&&zt.active),Le=dt=>a==null?void 0:a.find(ct=>ct.relationship_type_id===dt&&ct.active),Ue=async(dt,ct)=>{const zt=Ae(dt,ct);await u.mutateAsync({planId:dt,relationshipTypeId:ct,active:!zt})},Pe=(n==null?void 0:n.filter(dt=>dt.active&&!dt.owner_user_id))||[],$e=(n==null?void 0:n.filter(dt=>dt.owner_user_id===(t==null?void 0:t.id)))||[],it=s==null?void 0:s.find(dt=>dt.id===k),xt=k?Le(k):null,Ee=n==null?void 0:n.find(dt=>dt.id===(xt==null?void 0:xt.plan_id)),et=async()=>{if(!D.trim())return;const dt=await m.mutateAsync({name:D,description:q});dt&&G.length>0&&await v.mutateAsync({planId:dt.id,items:G}),Je()},le=async()=>{!D.trim()||!P||(await x.mutateAsync({id:P,name:D,description:q}),await v.mutateAsync({planId:P,items:G}),Je())},Ve=dt=>{var ct;R(dt.id),U(dt.name),H(dt.description||""),Q(((ct=dt.items)==null?void 0:ct.map(zt=>({month_number:zt.month_number,action_type_id:zt.action_type_id,default_script_id:zt.default_script_id||void 0,notes:zt.notes||void 0})))||[]),T(!0)},Je=()=>{T(!1),R(null),U(""),H(""),Q([])},rt=(dt,ct)=>{se(ct)},je=(dt,ct,zt)=>{Q(ir=>[...ir.filter(Zr=>Zr.month_number!==dt),{month_number:dt,action_type_id:ct,default_script_id:zt}]),ie(null),se(null)},lt=dt=>{Q(ct=>ct.filter(zt=>zt.month_number!==dt))},Ce=async()=>{if(!ce.trim()||!xe.trim()||!he)return;const dt=await b.mutateAsync({actionTypeId:he,title:ce,scriptBody:xe,emailSubject:ve||void 0,tone:we||void 0});dt&&ne!==null&&je(ne,he,dt.id),oe(!1),de(""),Me(""),be(""),tt("")},Ie=he?i==null?void 0:i.filter(dt=>dt.action_type_id===he&&dt.active):[],Ze=dt=>wCe[dt||"Phone"]||Pi,De=dt=>wCe[dt||"Users"]||qs;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(Sc,{className:"h-4 w-4 mr-1"}),"Back"]}),r.jsxs(X,{onClick:()=>T(!0),className:"w-full sm:w-auto",children:[r.jsx(vs,{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"}),s==null?void 0:s.filter(dt=>dt.active).map(dt=>{const ct=De(dt.icon),zt=(o==null?void 0:o[dt.id])||0,ir=Le(dt.id),Tr=n==null?void 0:n.find($r=>$r.id===(ir==null?void 0:ir.plan_id)),Zr=k===dt.id;return r.jsxs("button",{onClick:()=>M(dt.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(ct,{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:dt.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[zt," contacts"]})]}),Tr?r.jsxs(Tt,{variant:"secondary",className:"text-xs",children:[r.jsx(ii,{className:"h-3 w-3 mr-1"}),Tr.name.split(" ")[0]]}):r.jsx(Tt,{variant:"outline",className:"text-xs text-muted-foreground",children:"No plan"})]},dt.id)})]}),r.jsx("div",{className:"lg:col-span-2",children:k&&it?r.jsxs(He,{children:[r.jsxs(Vt,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[(()=>{const dt=De(it.icon);return r.jsx(dt,{className:"h-5 w-5"})})(),it.name," Touchpoint Plan"]}),r.jsxs(Ns,{children:["Choose a plan for your ",it.name," contacts"]})]}),r.jsxs(Xe,{className:"space-y-6",children:[Ee&&r.jsxs("div",{className:"p-4 bg-primary/5 rounded-lg border border-primary/20",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"font-medium flex items-center gap-2",children:[r.jsx(ii,{className:"h-4 w-4 text-green-500"}),"Currently using: ",Ee.name]}),Ee.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:Ee.description})]}),r.jsx(X,{variant:"outline",size:"sm",onClick:()=>Ue(Ee.id,k),children:"Disable"})]}),Ee.items&&Ee.items.length>0&&r.jsxs("div",{className:"mt-4",children:[r.jsxs("div",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[r.jsx(jn,{className:"h-4 w-4"}),"12-Month Schedule"]}),r.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-6 gap-2",children:qde.map((dt,ct)=>{var Zr,$r;const zt=((Zr=Ee.items)==null?void 0:Zr.filter(ns=>ns.month_number===ct+1))||[],ir=($r=zt[0])==null?void 0:$r.action_type,Tr=ir?Ze(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:dt}),Tr&&r.jsx(Tr,{className:"h-4 w-4 mx-auto mt-1",style:{color:(ir==null?void 0:ir.color)||"#3B82F6"}})]},ct)})})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-3",children:Ee?"Switch to a Different Plan":"Choose a Plan"}),Pe.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"}),Pe.map(dt=>{var zt;const ct=(Ee==null?void 0:Ee.id)===dt.id;return r.jsxs("div",{className:` flex items-center justify-between p-3 rounded-lg border ${ct?"opacity-50":"hover:bg-accent"} `,children:[r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:dt.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[((zt=dt.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=`${dt.name} (Copy)`;N.mutate({sourcePlanId:dt.id,newName:ir})},children:r.jsx(Mo,{className:"h-4 w-4"})}),r.jsx(X,{size:"sm",variant:ct?"outline":"default",disabled:ct||u.isPending,onClick:()=>Ue(dt.id,k),children:ct?"Active":"Use This"})]})]},dt.id)})]}),$e.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"My Custom Plans"}),$e.map(dt=>{var zt;const ct=(Ee==null?void 0:Ee.id)===dt.id;return r.jsxs("div",{className:` flex items-center justify-between p-3 rounded-lg border ${ct?"opacity-50":"hover:bg-accent"} `,children:[r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:dt.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[((zt=dt.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:()=>Ve(dt),children:r.jsx(Y0,{className:"h-4 w-4"})}),r.jsx(X,{size:"sm",variant:"ghost",title:"Delete plan",onClick:()=>y.mutate(dt.id),children:r.jsx(Bs,{className:"h-4 w-4 text-destructive"})}),r.jsx(X,{size:"sm",variant:ct?"outline":"default",disabled:ct||u.isPending,onClick:()=>Ue(dt.id,k),children:ct?"Active":"Use This"})]})]},dt.id)})]}),Pe.length===0&&$e.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(Xe,{className:"py-12 text-center text-muted-foreground",children:[r.jsx(jn,{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(Xe,{className:"py-4",children:r.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.jsx("strong",{children:"How it works:"})," When you assign a plan to a contact group, those contacts will appear in your daily suggested actions based on the plan's schedule."]})})})]}),r.jsx(Or,{open:E,onOpenChange:dt=>{dt?T(!0):Je()},children:r.jsxs(Pr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Rr,{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(ot,{id:"plan-name",value:D,onChange:dt=>U(dt.target.value),placeholder:"e.g., My VIP Plan"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"plan-description",children:"Description (optional)"}),r.jsx(Ys,{id:"plan-description",value:q,onChange:dt=>H(dt.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:qde.map((dt,ct)=>{const zt=ct+1,ir=G.find($r=>$r.month_number===zt),Tr=ir?l==null?void 0:l.find($r=>$r.id===ir.action_type_id):null,Zr=Tr?Ze(Tr.icon):null;return r.jsxs("div",{className:"relative",children:[r.jsxs("button",{type:"button",onClick:()=>ie(ne===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"} ${ne===zt?"ring-2 ring-primary":""} `,children:[r.jsx("div",{className:"text-xs text-muted-foreground font-medium",children:dt}),Zr?r.jsx(Zr,{className:"h-5 w-5 mx-auto mt-1",style:{color:(Tr==null?void 0:Tr.color)||"#3B82F6"}}):r.jsx(vs,{className:"h-5 w-5 mx-auto mt-1 text-muted-foreground/50"})]}),ir&&r.jsx("button",{type:"button",onClick:$r=>{$r.stopPropagation(),lt(zt)},className:"absolute -top-1 -right-1 p-1 bg-destructive text-destructive-foreground rounded-full",children:r.jsx(en,{className:"h-3 w-3"})})]},ct)})}),ne!==null&&!he&&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 ",qde[ne-1],":"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:l==null?void 0:l.filter(dt=>dt.active).map(dt=>{const ct=Ze(dt.icon);return r.jsxs("button",{type:"button",onClick:()=>rt(ne,dt.id),className:"flex items-center gap-2 px-3 py-2 rounded-lg border bg-background hover:bg-accent transition-colors",children:[r.jsx(ct,{className:"h-4 w-4",style:{color:dt.color||"#3B82F6"}}),r.jsx("span",{className:"text-sm",children:dt.name})]},dt.id)})})]}),ne!==null&&he&&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(Sc,{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(ne,he),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"})]})}),Ie==null?void 0:Ie.map(dt=>r.jsx("button",{type:"button",onClick:()=>je(ne,he,dt.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:dt.title}),dt.tone&&r.jsx(Tt,{variant:"secondary",className:"text-xs mt-1",children:dt.tone}),r.jsxs("div",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:[dt.script_body.substring(0,100),"..."]})]})},dt.id)),r.jsxs("button",{type:"button",onClick:()=>oe(!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(vs,{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(zn,{children:[r.jsx(X,{variant:"outline",onClick:Je,children:"Cancel"}),r.jsxs(X,{onClick:P?le:et,disabled:!D.trim()||m.isPending||x.isPending,children:[r.jsx(Lf,{className:"h-4 w-4 mr-2"}),P?"Save Changes":"Create Plan"]})]})]})}),r.jsx(Or,{open:fe,onOpenChange:oe,children:r.jsxs(Pr,{className:"max-w-lg",children:[r.jsx(zr,{children:r.jsx(Rr,{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(ot,{id:"script-title",value:ce,onChange:dt=>de(dt.target.value),placeholder:"e.g., Friendly Check-in Call"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"script-tone",children:"Tone (optional)"}),r.jsxs(us,{value:we,onValueChange:tt,children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select tone..."})}),r.jsxs(ds,{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"})]})]})]}),((st=(Ke=l==null?void 0:l.find(dt=>dt.id===he))==null?void 0:Ke.name)==null?void 0:st.toLowerCase().includes("email"))&&r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"script-email-subject",children:"Email Subject"}),r.jsx(ot,{id:"script-email-subject",value:ve,onChange:dt=>be(dt.target.value),placeholder:"e.g., Quick Hello!"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"script-body",children:"Script Content"}),r.jsx(Ys,{id:"script-body",value:xe,onChange:dt=>Me(dt.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(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>oe(!1),children:"Cancel"}),r.jsxs(X,{onClick:Ce,disabled:!ce.trim()||!xe.trim()||b.isPending,children:[r.jsx(Lf,{className:"h-4 w-4 mr-2"}),"Create & Use Script"]})]})]})})]})}const w5t="0dde5abb-0005-4c8c-a471-30d0cbc9e280",j5t=[{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 k5t(){const e=Hs(),t=jBe(),{data:s}=_Be(),{data:n}=Vf(),{data:a}=e1e(),{data:o}=Vae(90),{data:l}=Np(),i=H3t(),u=kBe(),m=q3t(),x=V3t(),{data:y=[],isLoading:v}=Kt({queryKey:["popby-templates"],queryFn:async()=>{const{data:fe,error:oe}=await Y.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).eq("category_id",w5t).order("publish_date",{ascending:!1});if(oe)throw oe;const{data:ce}=await Y.from("template_likes").select("template_id"),{data:de}=await Y.from("template_comments").select("template_id"),xe=new Map;ce==null||ce.forEach(ve=>{xe.set(ve.template_id,(xe.get(ve.template_id)||0)+1)});const Me=new Map;return de==null||de.forEach(ve=>{Me.set(ve.template_id,(Me.get(ve.template_id)||0)+1)}),(fe||[]).map(ve=>({...ve,likesCount:xe.get(ve.id)||0,commentsCount:Me.get(ve.id)||0}))}}),b=fe=>{const oe=l==null?void 0:l.find(ce=>ce.id===fe);return oe?`${oe.first_name} ${oe.last_name||""}`.trim():"Unknown"},N=fe=>{if(!fe)return null;const oe=s==null?void 0:s.find(ce=>ce.id===fe);return(oe==null?void 0:oe.name)||null},[k,M]=A.useState(null),[E,T]=A.useState(!1),[P,R]=A.useState(!1),[D,U]=A.useState(!1),[q,H]=A.useState({popby_item_id:"",notes:""}),[G,Q]=A.useState({name:"",description:""}),ne=async()=>{k&&(await u.mutateAsync({contact_id:k.id,popby_item_id:q.popby_item_id||void 0,notes:q.notes||void 0}),T(!1),M(null),H({popby_item_id:"",notes:""}))},ie=async()=>{G.name.trim()&&(await m.mutateAsync({name:G.name.trim(),description:G.description.trim()||void 0}),U(!1),Q({name:"",description:""}))},he=async(fe,oe)=>{await x.mutateAsync({relationship_type_id:fe,frequency_days:parseInt(oe)})},se=fe=>{var ce;const oe=a==null?void 0:a.find(de=>de.relationship_type_id===fe);return((ce=oe==null?void 0:oe.frequency_days)==null?void 0:ce.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(Xe,{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(Xe,{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(Xe,{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(po,{className:"h-4 w-4 mr-2"}),"View Map"]}),r.jsxs(X,{variant:"outline",onClick:()=>R(!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(vs,{className:"h-4 w-4 mr-2"}),"Add Popby Idea"]})]}),r.jsxs(Si,{defaultValue:"due",children:[r.jsxs(ki,{children:[r.jsx(is,{value:"due",children:"Due for Popby"}),r.jsx(is,{value:"activity",children:"Recent Activity"}),r.jsx(is,{value:"library",children:"Popby Library"}),r.jsx(is,{value:"templates",children:"Popby Templates"})]}),r.jsx(Ss,{value:"due",className:"space-y-4 mt-4",children:!t||t.length===0?r.jsx(He,{children:r.jsxs(Xe,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(oo,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No contacts due for a popby right now!"}),r.jsx("p",{className:"text-sm mt-1",children:"Great job staying connected."})]})}):r.jsx("div",{className:"space-y-3",children:t.map(fe=>r.jsx(He,{className:"hover:shadow-md transition-shadow",children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"font-medium",children:[fe.first_name," ",fe.last_name]}),fe.daysOverdue>0&&r.jsxs(Tt,{variant:"destructive",className:"text-xs",children:[fe.daysOverdue,"+ days overdue"]}),fe.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:[fe.address&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(po,{className:"h-3 w-3"}),fe.city||fe.address]}),fe.tags&&fe.tags.length>0&&r.jsx("span",{children:fe.tags.map(oe=>{var ce;return(ce=oe.relationship_type)==null?void 0:ce.name}).join(", ")})]}),fe.lastPopby&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Last popby: ",rs(new Date(fe.lastPopby),"MMM d, yyyy")]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[fe.phone&&r.jsx(X,{size:"sm",variant:"ghost",asChild:!0,children:r.jsx("a",{href:`tel:${fe.phone}`,children:r.jsx(Pi,{className:"h-4 w-4"})})}),r.jsxs(X,{size:"sm",onClick:()=>{M(fe),T(!0)},children:[r.jsx(ii,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})})},fe.id))})}),r.jsx(Ss,{value:"activity",className:"space-y-4 mt-4",children:!o||o.length===0?r.jsx(He,{children:r.jsxs(Xe,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(Ra,{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(Vt,{children:r.jsx(Gt,{className:"text-lg",children:"Recent Popby Log"})}),r.jsx(Xe,{className:"space-y-3",children:o.map(fe=>r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0 last:pb-0",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-orange-500/10 flex items-center justify-center",children:r.jsx(oo,{className:"h-5 w-5 text-orange-500"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:"font-medium",children:b(fe.contact_id)}),N(fe.popby_item_id)&&r.jsx(Tt,{variant:"secondary",className:"text-xs",children:N(fe.popby_item_id)})]}),r.jsx("div",{className:"text-sm text-muted-foreground",children:rs(new Date(fe.completed_at),"MMM d, yyyy h:mm a")}),fe.notes&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:fe.notes})]})]},fe.id))})]})}),r.jsx(Ss,{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:[s==null?void 0:s.map(fe=>r.jsx(He,{children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(oo,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-medium",children:fe.name}),fe.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:fe.description}),!fe.owner_user_id&&r.jsx(Tt,{variant:"secondary",className:"mt-2 text-xs",children:"Shared"})]})]})})},fe.id)),r.jsx(He,{className:"border-dashed cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>U(!0),children:r.jsx(Xe,{className:"p-4 flex items-center justify-center h-full min-h-[100px]",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(vs,{className:"h-8 w-8 mx-auto mb-2"}),r.jsx("p",{children:"Add New Popby Idea"})]})})})]})}),r.jsxs(Ss,{value:"templates",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:[y.length," template",y.length!==1?"s":""," found"]}),v&&r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:[...Array(4)].map((fe,oe)=>r.jsx(He,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx(Cr,{className:"aspect-[3/2] w-full rounded-lg mb-4"}),r.jsx(Cr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Cr,{className:"h-4 w-full mb-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Cr,{className:"h-5 w-16"}),r.jsx(Cr,{className:"h-5 w-20"})]})]})},oe))}),!v&&y.length===0&&r.jsx(He,{children:r.jsxs(Xe,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(Vl,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No popby templates available yet!"}),r.jsx("p",{className:"text-sm mt-1",children:"Check back soon for new templates."})]})}),!v&&y.length>0&&r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:y.map(fe=>r.jsxs(He,{className:"group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer",onClick:()=>e(`/templates/${fe.id}`),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:fe.preview_image_url?r.jsx("img",{src:fe.preview_image_url,alt:fe.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No Preview"})}),r.jsxs(Xe,{className:"p-4 flex flex-col",children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:fe.name}),fe.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:vne(fe.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(xd,{className:"h-3.5 w-3.5"}),fe.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ql,{className:"h-3.5 w-3.5"}),fe.commentsCount]})]}),r.jsxs(X,{size:"sm",className:"w-full gap-2",onClick:oe=>{oe.stopPropagation(),e(`/templates/${fe.id}`)},children:[r.jsx(Sn,{className:"h-4 w-4"}),"View Template"]})]})]},fe.id))})]})]}),r.jsx(Or,{open:E,onOpenChange:T,children:r.jsxs(Pr,{children:[r.jsx(zr,{children:r.jsxs(Rr,{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(us,{value:q.popby_item_id,onValueChange:fe=>H(oe=>({...oe,popby_item_id:fe})),children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select a popby item..."})}),r.jsx(ds,{children:s==null?void 0:s.map(fe=>r.jsx($t,{value:fe.id,children:fe.name},fe.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Notes (optional)"}),r.jsx(Ys,{placeholder:"Any notes about this popby...",value:q.notes,onChange:fe=>H(oe=>({...oe,notes:fe.target.value}))})]})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>T(!1),children:"Cancel"}),r.jsx(X,{onClick:ne,disabled:u.isPending,children:"Log Popby"})]})]})}),r.jsx(Or,{open:P,onOpenChange:R,children:r.jsxs(Pr,{className:"max-w-md",children:[r.jsx(zr,{children:r.jsx(Rr,{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."}),n==null?void 0:n.map(fe=>r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsx(ze,{className:"font-medium",children:fe.name}),r.jsxs(us,{value:se(fe.id),onValueChange:oe=>he(fe.id,oe),children:[r.jsx(cs,{className:"w-[180px]",children:r.jsx(ms,{})}),r.jsx(ds,{children:j5t.map(oe=>r.jsx($t,{value:oe.value,children:oe.label},oe.value))})]})]},fe.id))]}),r.jsx(zn,{children:r.jsx(X,{onClick:()=>R(!1),children:"Done"})})]})}),r.jsx(Or,{open:D,onOpenChange:U,children:r.jsxs(Pr,{children:[r.jsx(zr,{children:r.jsx(Rr,{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(ot,{placeholder:"e.g., Homemade cookies",value:G.name,onChange:fe=>Q(oe=>({...oe,name:fe.target.value}))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Description"}),r.jsx(Ys,{placeholder:"Optional description...",value:G.description,onChange:fe=>Q(oe=>({...oe,description:fe.target.value}))})]})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>U(!1),children:"Cancel"}),r.jsx(X,{onClick:ie,disabled:!G.name.trim()||m.isPending,children:"Add Item"})]})]})})]})})}function N5t(){const e=Hs(),{isAdmin:t}=Yr(),s=A.useRef(null),n=A.useRef(null),a=A.useRef([]),o=wBe(),{data:l}=_Be(),i=kBe(),[u,m]=A.useState(""),[x,y]=A.useState(""),[v,b]=A.useState(!0),[N,k]=A.useState(null),[M,E]=A.useState(null),[T,P]=A.useState(!1),[R,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:ne}=await Y.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();ne!=null&&ne.value&&m(ne.value)}catch(ne){console.error("Error fetching mapbox token:",ne)}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(!(!s.current||!u||n.current))return sc.accessToken=u,n.current=new sc.Map({container:s.current,style:"mapbox://styles/mapbox/streets-v12",zoom:N?12:4,center:N||[-98.5795,39.8283]}),n.current.addControl(new sc.NavigationControl,"top-right"),()=>{var Q;(Q=n.current)==null||Q.remove(),n.current=null}},[u,N]),A.useEffect(()=>{!n.current||!u||(a.current.forEach(Q=>Q.remove()),a.current=[],U.forEach(async Q=>{var ie;const ne=[Q.address,Q.city,Q.state,Q.zip].filter(Boolean).join(", ");if(ne)try{const se=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(ne)}.json?access_token=${u}`)).json();if(se.features&&se.features.length>0){const[fe,oe]=se.features[0].center,ce=document.createElement("div");ce.className="cursor-pointer",ce.innerHTML=`
${Q.first_name[0]}${((ie=Q.last_name)==null?void 0:ie[0])||""}
${Q.isDue?'
':""}
`;const de=new sc.Marker(ce).setLngLat([fe,oe]).addTo(n.current);ce.addEventListener("click",()=>{E(Q)}),a.current.push(de)}}catch(he){console.error("Geocoding error for",Q.first_name,he)}}))},[U,u]);const q=()=>{N&&n.current?n.current.flyTo({center:N,zoom:13}):Wn({title:"Location not available",description:"Please enable location services",variant:"destructive"})},H=async()=>{M&&(await i.mutateAsync({contact_id:M.id,popby_item_id:R.popby_item_id||void 0,notes:R.notes||void 0,latitude:N==null?void 0:N[1],longitude:N==null?void 0:N[0]}),P(!1),E(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()),Wn({title:"Mapbox token saved!"})}catch{Wn({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:q,children:[r.jsx(mA,{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:s,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(vl,{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(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold",children:[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:()=>E(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: ",rs(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(Pi,{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(_A,{className:"h-4 w-4 mr-1"}),"Navigate"]}),r.jsxs(X,{size:"sm",className:"flex-1",onClick:()=>P(!0),children:[r.jsx(oo,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})}),r.jsx(Or,{open:T,onOpenChange:P,children:r.jsxs(Pr,{children:[r.jsx(zr,{children:r.jsxs(Rr,{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(us,{value:R.popby_item_id,onValueChange:Q=>D(ne=>({...ne,popby_item_id:Q})),children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select a popby item..."})}),r.jsx(ds,{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(Ys,{placeholder:"Any notes about this popby...",value:R.notes,onChange:Q=>D(ne=>({...ne,notes:Q.target.value}))})]}),N&&r.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(po,{className:"h-3 w-3"}),"Your current location will be recorded"]})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>P(!1),children:"Cancel"}),r.jsxs(X,{onClick:H,disabled:i.isPending,children:[r.jsx(ii,{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(Xe,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"text-center mb-4",children:[r.jsx(po,{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(ot,{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(Xe,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx(vl,{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 S5t=Ev({property_address:Oo().min(1,"Property address is required"),city:Oo().optional(),state:Oo().optional(),zip:Oo().optional(),transaction_type:tDe(["buyer","seller"]),close_date:Oo().min(1,"Close date is required"),sale_price:$A().min(0,"Sale price must be positive"),commission_amount:$A().optional(),lead_source_id:Oo().optional(),client_type_id:Oo().optional(),contact_id:Oo().optional(),notes:Oo().optional(),is_win:imt()});function ABe({open:e,onOpenChange:t,transaction:s}){const[n,a]=A.useState(!1),[o,l]=A.useState(""),[i,u]=A.useState(!1),[m,x]=A.useState(""),y=mae(),v=bxt(),{data:b}=hae(),{data:N}=Vf(),{data:k}=Np(),M=Fye(),E=_xt(),{data:T}=pae(),P=(T==null?void 0:T.show_commission)??!0,R=sae({resolver:nae(S5t),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(()=>{s?R.reset({property_address:s.property_address,city:s.city||"",state:s.state||"",zip:s.zip||"",transaction_type:s.transaction_type,close_date:s.close_date,sale_price:Number(s.sale_price),commission_amount:s.commission_amount?Number(s.commission_amount):void 0,lead_source_id:s.lead_source_id||void 0,client_type_id:s.client_type_id||void 0,contact_id:s.contact_id||void 0,notes:s.notes||"",is_win:s.is_win}):R.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})},[s,R]);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};s?await v.mutateAsync({id:s.id,...Q}):await y.mutateAsync(Q),t(!1)},U=async()=>{if(!o.trim())return;const[G,...Q]=o.trim().split(" "),ne=Q.join(" ")||null,ie=await M.mutateAsync({first_name:G,last_name:ne,tagIds:[]});ie&&(R.setValue("contact_id",ie.id),l(""),u(!1),a(!1))},q=async()=>{if(!m.trim())return;const G=await E.mutateAsync(m.trim());G&&(R.setValue("lead_source_id",G.id),x(""))},H=k==null?void 0:k.find(G=>G.id===R.watch("contact_id"));return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Pr,{className:"max-w-lg max-h-[90vh]",children:[r.jsx(zr,{children:r.jsx(Rr,{children:s?"Edit Transaction":"Add Transaction"})}),r.jsx(Yo,{className:"max-h-[70vh] pr-4",children:r.jsx(aae,{...R,children:r.jsxs("form",{onSubmit:R.handleSubmit(D),className:"space-y-4",children:[r.jsx(Rl,{control:R.control,name:"property_address",render:({field:G})=>r.jsxs(Cl,{children:[r.jsx(Ml,{children:"Property Address *"}),r.jsx(Tl,{children:r.jsx(ot,{placeholder:"123 Main St",...G})}),r.jsx(Yu,{})]})}),r.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[r.jsx(Rl,{control:R.control,name:"city",render:({field:G})=>r.jsxs(Cl,{children:[r.jsx(Ml,{children:"City"}),r.jsx(Tl,{children:r.jsx(ot,{placeholder:"City",...G})})]})}),r.jsx(Rl,{control:R.control,name:"state",render:({field:G})=>r.jsxs(Cl,{children:[r.jsx(Ml,{children:"State"}),r.jsx(Tl,{children:r.jsx(ot,{placeholder:"TX",...G})})]})}),r.jsx(Rl,{control:R.control,name:"zip",render:({field:G})=>r.jsxs(Cl,{children:[r.jsx(Ml,{children:"Zip"}),r.jsx(Tl,{children:r.jsx(ot,{placeholder:"75001",...G})})]})})]}),r.jsx(Rl,{control:R.control,name:"transaction_type",render:({field:G})=>r.jsxs(Cl,{children:[r.jsx(Ml,{children:"Transaction Type *"}),r.jsxs(us,{onValueChange:G.onChange,value:G.value,children:[r.jsx(Tl,{children:r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select type"})})}),r.jsxs(ds,{children:[r.jsx($t,{value:"buyer",children:"Buyer"}),r.jsx($t,{value:"seller",children:"Seller"})]})]}),r.jsx(Yu,{})]})}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsx(Rl,{control:R.control,name:"close_date",render:({field:G})=>r.jsxs(Cl,{children:[r.jsx(Ml,{children:"Close Date *"}),r.jsx(Tl,{children:r.jsx(ot,{type:"date",...G})}),r.jsx(Yu,{})]})}),r.jsx(Rl,{control:R.control,name:"sale_price",render:({field:G})=>r.jsxs(Cl,{children:[r.jsx(Ml,{children:"Sale Price *"}),r.jsx(Tl,{children:r.jsx(ot,{type:"number",placeholder:"0",...G,onChange:Q=>G.onChange(Number(Q.target.value))})}),r.jsx(Yu,{})]})})]}),P&&r.jsx(Rl,{control:R.control,name:"commission_amount",render:({field:G})=>r.jsxs(Cl,{children:[r.jsx(Ml,{children:"Commission"}),r.jsx(Tl,{children:r.jsx(ot,{type:"number",placeholder:"0",...G,value:G.value??"",onChange:Q=>G.onChange(Q.target.value?Number(Q.target.value):void 0)})})]})}),r.jsx(Rl,{control:R.control,name:"lead_source_id",render:({field:G})=>r.jsxs(Cl,{children:[r.jsx(Ml,{children:"Lead Source"}),r.jsxs(us,{onValueChange:G.onChange,value:G.value||"",children:[r.jsx(Tl,{children:r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select source"})})}),r.jsx(ds,{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(ot,{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:q,disabled:!m.trim(),children:r.jsx(vs,{className:"h-4 w-4"})})]}),r.jsx(Rl,{control:R.control,name:"client_type_id",render:({field:G})=>r.jsxs(Cl,{children:[r.jsx(Ml,{children:"Client Type"}),r.jsxs(us,{onValueChange:G.onChange,value:G.value||"",children:[r.jsx(Tl,{children:r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select client type"})})}),r.jsx(ds,{children:N==null?void 0:N.map(Q=>r.jsx($t,{value:Q.id,children:Q.name},Q.id))})]})]})}),r.jsx(Rl,{control:R.control,name:"contact_id",render:({field:G})=>r.jsxs(Cl,{children:[r.jsx(Ml,{children:"Client Contact"}),r.jsxs(Kc,{open:n,onOpenChange:a,children:[r.jsx(Zc,{asChild:!0,children:r.jsx(Tl,{children:r.jsxs(X,{variant:"outline",role:"combobox",className:Ut("w-full justify-between",!G.value&&"text-muted-foreground"),children:[H?`${H.first_name} ${H.last_name||""}`.trim():"Select contact",r.jsx(cy,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})})}),r.jsxs(Ac,{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(vs,{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(ot,{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(Rl,{control:R.control,name:"notes",render:({field:G})=>r.jsxs(Cl,{children:[r.jsx(Ml,{children:"Notes"}),r.jsx(Tl,{children:r.jsx(Ys,{placeholder:"Any notes about this transaction...",...G})})]})}),r.jsx(Rl,{control:R.control,name:"is_win",render:({field:G})=>r.jsxs(Cl,{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Ml,{children:"Mark as Win 🏆"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Highlight this as a notable success"})]}),r.jsx(Tl,{children:r.jsx(In,{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:[s?"Update":"Add"," Transaction"]})]})]})})})]})})}function EBe({transactions:e,showCommission:t,isLoading:s}){const[n,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),E=wxt(),T=mae(),{data:P}=hae(),{data:R}=Vf(),D=H3(),U=G=>{const{id:Q,created_at:ne,updated_at:ie,lead_source:he,client_type:se,contact:fe,...oe}=G;T.mutate(oe)},q=()=>{o&&(E.mutate(o),l(null))},H=e.filter(G=>{var fe,oe,ce,de;const Q=i===""||G.property_address.toLowerCase().includes(i.toLowerCase())||((oe=(fe=G.contact)==null?void 0:fe.first_name)==null?void 0:oe.toLowerCase().includes(i.toLowerCase()))||((de=(ce=G.contact)==null?void 0:ce.last_name)==null?void 0:de.toLowerCase().includes(i.toLowerCase())),ne=m==="all"||G.transaction_type===m,ie=y==="all"||G.lead_source_id===y,he=b==="all"||G.client_type_id===b,se=!k||G.is_win;return Q&&ne&&ie&&he&&se});return s?r.jsx(He,{children:r.jsx(Xe,{className:"p-6 space-y-4",children:[1,2,3].map(G=>r.jsx(Cr,{className:"h-16 w-full"},G))})}):r.jsxs(r.Fragment,{children:[r.jsxs(He,{children:[r.jsx(Vt,{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 (",H.length,")"]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("div",{className:"relative",children:[r.jsx(ua,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search...",value:i,onChange:G=>u(G.target.value),className:"pl-8 w-[150px]"})]}),r.jsxs(us,{value:m,onValueChange:x,children:[r.jsx(cs,{className:"w-[100px]",children:r.jsx(ms,{placeholder:"Type"})}),r.jsxs(ds,{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(us,{value:y,onValueChange:v,children:[r.jsx(cs,{className:"w-[130px]",children:r.jsx(ms,{placeholder:"Lead Source"})}),r.jsxs(ds,{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($l,{className:"h-4 w-4 mr-1"}),"Wins"]})]})]})}),r.jsx(Xe,{children:H.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:H.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($l,{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: "}),Cje(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(vc,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>U(G),children:r.jsx(Mo,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>l(G.id),children:r.jsx(Bs,{className:"h-4 w-4 text-destructive"})})]})]},G.id))}):r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:H.map(G=>{var Q;return r.jsxs(kr,{children:[r.jsx(gt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[G.is_win&&r.jsx($l,{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(gt,{children:r.jsx(Tt,{variant:G.transaction_type==="buyer"?"default":"secondary",children:G.transaction_type})}),r.jsx(gt,{children:Cje(G.close_date)}),r.jsx(gt,{children:tu(G.sale_price)}),t&&r.jsx(gt,{children:G.commission_amount?tu(G.commission_amount):"-"}),r.jsx(gt,{children:((Q=G.lead_source)==null?void 0:Q.name)||"-"}),r.jsx(gt,{children:G.contact?`${G.contact.first_name} ${G.contact.last_name||""}`.trim():"-"}),r.jsx(gt,{children:r.jsxs(uh,{children:[r.jsx(hh,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",children:r.jsx(Ng,{className:"h-4 w-4"})})}),r.jsxs(Cu,{align:"end",children:[r.jsxs(Wa,{onClick:()=>a(G),children:[r.jsx(vc,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(Wa,{onClick:()=>U(G),children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Duplicate"]}),r.jsxs(Wa,{onClick:()=>l(G.id),className:"text-destructive",children:[r.jsx(Bs,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},G.id)})})]})})})]}),r.jsx(ABe,{open:!!n,onOpenChange:G=>!G&&a(null),transaction:n||void 0}),r.jsx(Dd,{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(Vc,{onClick:q,className:"bg-destructive text-destructive-foreground",children:"Delete"})]})]})})]})}function IBe({goals:e,stats:t,year:s,showCommission:n}){const a=new Date().getMonth()+1,o=new Date().getFullYear()===s?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,E=o/12*100,T=N>=E?"ahead":N>=E*.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=n?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(bu,{className:"h-3 w-3 mr-1"}),"Ahead"]});case"on-track":return r.jsxs(Tt,{variant:"secondary",children:[r.jsx(Y1,{className:"h-3 w-3 mr-1"}),"On Track"]});case"behind":return r.jsxs(Tt,{variant:"destructive",children:[r.jsx(Gj,{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(Vt,{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:[s," Goals Progress"]})]})}),r.jsx(Xe,{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(lc,{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(lc,{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"]})]}),n&&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(lc,{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 C5t=Array.isArray,qh=C5t,M5t=typeof Jx=="object"&&Jx&&Jx.Object===Object&&Jx,PBe=M5t,T5t=PBe,A5t=typeof self=="object"&&self&&self.Object===Object&&self,E5t=T5t||A5t||Function("return this")(),dx=E5t,I5t=dx,P5t=I5t.Symbol,TP=P5t,jCe=TP,LBe=Object.prototype,L5t=LBe.hasOwnProperty,O5t=LBe.toString,bT=jCe?jCe.toStringTag:void 0;function D5t(e){var t=L5t.call(e,bT),s=e[bT];try{e[bT]=void 0;var n=!0}catch{}var a=O5t.call(e);return n&&(t?e[bT]=s:delete e[bT]),a}var R5t=D5t,F5t=Object.prototype,z5t=F5t.toString;function B5t(e){return z5t.call(e)}var $5t=B5t,kCe=TP,U5t=R5t,q5t=$5t,V5t="[object Null]",H5t="[object Undefined]",NCe=kCe?kCe.toStringTag:void 0;function W5t(e){return e==null?e===void 0?H5t:V5t:NCe&&NCe in Object(e)?U5t(e):q5t(e)}var Wy=W5t;function G5t(e){return e!=null&&typeof e=="object"}var Gy=G5t,K5t=Wy,Z5t=Gy,Y5t="[object Symbol]";function X5t(e){return typeof e=="symbol"||Z5t(e)&&K5t(e)==Y5t}var W3=X5t,Q5t=qh,J5t=W3,eMt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,tMt=/^\w*$/;function rMt(e,t){if(Q5t(e))return!1;var s=typeof e;return s=="number"||s=="symbol"||s=="boolean"||e==null||J5t(e)?!0:tMt.test(e)||!eMt.test(e)||t!=null&&e in Object(t)}var t1e=rMt;function sMt(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Dv=sMt;const G3=no(Dv);var nMt=Wy,aMt=Dv,iMt="[object AsyncFunction]",oMt="[object Function]",lMt="[object GeneratorFunction]",cMt="[object Proxy]";function dMt(e){if(!aMt(e))return!1;var t=nMt(e);return t==oMt||t==lMt||t==iMt||t==cMt}var r1e=dMt;const Xa=no(r1e);var uMt=dx,hMt=uMt["__core-js_shared__"],mMt=hMt,Vde=mMt,SCe=function(){var e=/[^.]+$/.exec(Vde&&Vde.keys&&Vde.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function pMt(e){return!!SCe&&SCe in e}var fMt=pMt,gMt=Function.prototype,xMt=gMt.toString;function yMt(e){if(e!=null){try{return xMt.call(e)}catch{}try{return e+""}catch{}}return""}var OBe=yMt,vMt=r1e,_Mt=fMt,bMt=Dv,wMt=OBe,jMt=/[\\^$.*+?()[\]{}|]/g,kMt=/^\[object .+?Constructor\]$/,NMt=Function.prototype,SMt=Object.prototype,CMt=NMt.toString,MMt=SMt.hasOwnProperty,TMt=RegExp("^"+CMt.call(MMt).replace(jMt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function AMt(e){if(!bMt(e)||_Mt(e))return!1;var t=vMt(e)?TMt:kMt;return t.test(wMt(e))}var EMt=AMt;function IMt(e,t){return e==null?void 0:e[t]}var PMt=IMt,LMt=EMt,OMt=PMt;function DMt(e,t){var s=OMt(e,t);return LMt(s)?s:void 0}var Dk=DMt,RMt=Dk,FMt=RMt(Object,"create"),Gae=FMt,CCe=Gae;function zMt(){this.__data__=CCe?CCe(null):{},this.size=0}var BMt=zMt;function $Mt(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var UMt=$Mt,qMt=Gae,VMt="__lodash_hash_undefined__",HMt=Object.prototype,WMt=HMt.hasOwnProperty;function GMt(e){var t=this.__data__;if(qMt){var s=t[e];return s===VMt?void 0:s}return WMt.call(t,e)?t[e]:void 0}var KMt=GMt,ZMt=Gae,YMt=Object.prototype,XMt=YMt.hasOwnProperty;function QMt(e){var t=this.__data__;return ZMt?t[e]!==void 0:XMt.call(t,e)}var JMt=QMt,eTt=Gae,tTt="__lodash_hash_undefined__";function rTt(e,t){var s=this.__data__;return this.size+=this.has(e)?0:1,s[e]=eTt&&t===void 0?tTt:t,this}var sTt=rTt,nTt=BMt,aTt=UMt,iTt=KMt,oTt=JMt,lTt=sTt;function K3(e){var t=-1,s=e==null?0:e.length;for(this.clear();++t-1}var NTt=kTt,STt=Kae;function CTt(e,t){var s=this.__data__,n=STt(s,e);return n<0?(++this.size,s.push([e,t])):s[n][1]=t,this}var MTt=CTt,TTt=uTt,ATt=vTt,ETt=wTt,ITt=NTt,PTt=MTt;function Z3(e){var t=-1,s=e==null?0:e.length;for(this.clear();++t0?1:-1},fj=function(t){return wk(t)&&t.indexOf("%")===t.length-1},Fs=function(t){return JAt(t)&&!AP(t)},sEt=function(t){return Ii(t)},fd=function(t){return Fs(t)||wk(t)},nEt=0,EP=function(t){var s=++nEt;return"".concat(t||"").concat(s)},Ju=function(t,s){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Fs(t)&&!wk(t))return n;var o;if(fj(t)){var l=t.indexOf("%");o=s*parseFloat(t.slice(0,l))/100}else o=+t;return AP(o)&&(o=n),a&&o>s&&(o=s),o},m1=function(t){if(!t)return null;var s=Object.keys(t);return s&&s.length?t[s[0]]:null},aEt=function(t){if(!Array.isArray(t))return!1;for(var s=t.length,n={},a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function hEt(e,t){if(e==null)return{};var s={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;s[n]=e[n]}return s}var LCe={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},wy=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},OCe=null,Wde=null,h1e=function e(t){if(t===OCe&&Array.isArray(Wde))return Wde;var s=[];return A.Children.forEach(t,function(n){Ii(n)||(KAt.isFragment(n)?s=s.concat(e(n.props.children)):s.push(n))}),Wde=s,OCe=t,s};function vp(e,t){var s=[],n=[];return Array.isArray(t)?n=t.map(function(a){return wy(a)}):n=[wy(t)],h1e(e).forEach(function(a){var o=km(a,"type.displayName")||km(a,"type.name");n.indexOf(o)!==-1&&s.push(a)}),s}function am(e,t){var s=vp(e,t);return s&&s[0]}var DCe=function(t){if(!t||!t.props)return!1;var s=t.props,n=s.width,a=s.height;return!(!Fs(n)||n<=0||!Fs(a)||a<=0)},mEt=["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"],pEt=function(t){return t&&t.type&&wk(t.type)&&mEt.indexOf(t.type)>=0},fEt=function(t,s,n,a){var o,l=(o=Hde==null?void 0:Hde[a])!==null&&o!==void 0?o:[];return s.startsWith("data-")||!Xa(t)&&(a&&l.includes(s)||lEt.includes(s))||n&&u1e.includes(s)},qa=function(t,s,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var a=t;if(A.isValidElement(t)&&(a=t.props),!G3(a))return null;var o={};return Object.keys(a).forEach(function(l){var i;fEt((i=a)===null||i===void 0?void 0:i[l],l,s,n)&&(o[l]=a[l])}),o},Mpe=function e(t,s){if(t===s)return!0;var n=A.Children.count(t);if(n!==A.Children.count(s))return!1;if(n===0)return!0;if(n===1)return RCe(Array.isArray(t)?t[0]:t,Array.isArray(s)?s[0]:s);for(var a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function _Et(e,t){if(e==null)return{};var s={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;s[n]=e[n]}return s}function Ape(e){var t=e.children,s=e.width,n=e.height,a=e.viewBox,o=e.className,l=e.style,i=e.title,u=e.desc,m=vEt(e,yEt),x=a||{width:s,height:n,x:0,y:0},y=mi("recharts-surface",o);return ut.createElement("svg",Tpe({},qa(m,!0,"svg"),{className:y,width:s,height:n,style:l,viewBox:"".concat(x.x," ").concat(x.y," ").concat(x.width," ").concat(x.height)}),ut.createElement("title",null,i),ut.createElement("desc",null,u),t)}var bEt=["children","className"];function Epe(){return Epe=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function jEt(e,t){if(e==null)return{};var s={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;s[n]=e[n]}return s}var Ro=ut.forwardRef(function(e,t){var s=e.children,n=e.className,a=wEt(e,bEt),o=mi("recharts-layer",n);return ut.createElement("g",Epe({className:o},qa(a,!0),{ref:t}),s)}),Rf=function(t,s){for(var n=arguments.length,a=new Array(n>2?n-2:0),o=2;oa?0:a+t),s=s>a?a:s,s<0&&(s+=a),a=t>s?0:s-t>>>0,t>>>=0;for(var o=Array(a);++n=n?e:SEt(e,t,s)}var MEt=CEt,TEt="\\ud800-\\udfff",AEt="\\u0300-\\u036f",EEt="\\ufe20-\\ufe2f",IEt="\\u20d0-\\u20ff",PEt=AEt+EEt+IEt,LEt="\\ufe0e\\ufe0f",OEt="\\u200d",DEt=RegExp("["+OEt+TEt+PEt+LEt+"]");function REt(e){return DEt.test(e)}var HBe=REt;function FEt(e){return e.split("")}var zEt=FEt,WBe="\\ud800-\\udfff",BEt="\\u0300-\\u036f",$Et="\\ufe20-\\ufe2f",UEt="\\u20d0-\\u20ff",qEt=BEt+$Et+UEt,VEt="\\ufe0e\\ufe0f",HEt="["+WBe+"]",Ipe="["+qEt+"]",Ppe="\\ud83c[\\udffb-\\udfff]",WEt="(?:"+Ipe+"|"+Ppe+")",GBe="[^"+WBe+"]",KBe="(?:\\ud83c[\\udde6-\\uddff]){2}",ZBe="[\\ud800-\\udbff][\\udc00-\\udfff]",GEt="\\u200d",YBe=WEt+"?",XBe="["+VEt+"]?",KEt="(?:"+GEt+"(?:"+[GBe,KBe,ZBe].join("|")+")"+XBe+YBe+")*",ZEt=XBe+YBe+KEt,YEt="(?:"+[GBe+Ipe+"?",Ipe,KBe,ZBe,HEt].join("|")+")",XEt=RegExp(Ppe+"(?="+Ppe+")|"+YEt+ZEt,"g");function QEt(e){return e.match(XEt)||[]}var JEt=QEt,eIt=zEt,tIt=HBe,rIt=JEt;function sIt(e){return tIt(e)?rIt(e):eIt(e)}var nIt=sIt,aIt=MEt,iIt=HBe,oIt=nIt,lIt=zBe;function cIt(e){return function(t){t=lIt(t);var s=iIt(t)?oIt(t):void 0,n=s?s[0]:t.charAt(0),a=s?aIt(s,1).join(""):t.slice(1);return n[e]()+a}}var dIt=cIt,uIt=dIt,hIt=uIt("toUpperCase"),mIt=hIt;const lie=no(mIt);function il(e){return function(){return e}}const QBe=Math.cos,sse=Math.sin,Gf=Math.sqrt,nse=Math.PI,cie=2*nse,Lpe=Math.PI,Ope=2*Lpe,Xw=1e-6,pIt=Ope-Xw;function JBe(e){this._+=e[0];for(let t=1,s=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return JBe;const s=10**t;return function(n){this._+=n[0];for(let a=1,o=n.length;aXw)if(!(Math.abs(y*u-m*x)>Xw)||!o)this._append`L${this._x1=t},${this._y1=s}`;else{let b=n-l,N=a-i,k=u*u+m*m,M=b*b+N*N,E=Math.sqrt(k),T=Math.sqrt(v),P=o*Math.tan((Lpe-Math.acos((k+v-M)/(2*E*T)))/2),R=P/T,D=P/E;Math.abs(R-1)>Xw&&this._append`L${t+R*x},${s+R*y}`,this._append`A${o},${o},0,0,${+(y*b>x*N)},${this._x1=t+D*u},${this._y1=s+D*m}`}}arc(t,s,n,a,o,l){if(t=+t,s=+s,n=+n,l=!!l,n<0)throw new Error(`negative radius: ${n}`);let i=n*Math.cos(a),u=n*Math.sin(a),m=t+i,x=s+u,y=1^l,v=l?a-o:o-a;this._x1===null?this._append`M${m},${x}`:(Math.abs(this._x1-m)>Xw||Math.abs(this._y1-x)>Xw)&&this._append`L${m},${x}`,n&&(v<0&&(v=v%Ope+Ope),v>pIt?this._append`A${n},${n},0,1,${y},${t-i},${s-u}A${n},${n},0,1,${y},${this._x1=m},${this._y1=x}`:v>Xw&&this._append`A${n},${n},0,${+(v>=Lpe)},${y},${this._x1=t+n*Math.cos(o)},${this._y1=s+n*Math.sin(o)}`)}rect(t,s,n,a){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+s}h${n=+n}v${+a}h${-n}Z`}toString(){return this._}}function m1e(e){let t=3;return e.digits=function(s){if(!arguments.length)return t;if(s==null)t=null;else{const n=Math.floor(s);if(!(n>=0))throw new RangeError(`invalid digits: ${s}`);t=n}return e},()=>new gIt(t)}function p1e(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function e$e(e){this._context=e}e$e.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 die(e){return new e$e(e)}function t$e(e){return e[0]}function r$e(e){return e[1]}function s$e(e,t){var s=il(!0),n=null,a=die,o=null,l=m1e(i);e=typeof e=="function"?e:e===void 0?t$e:il(e),t=typeof t=="function"?t:t===void 0?r$e:il(t);function i(u){var m,x=(u=p1e(u)).length,y,v=!1,b;for(n==null&&(o=a(b=l())),m=0;m<=x;++m)!(m=b;--N)i.point(P[N],R[N]);i.lineEnd(),i.areaEnd()}E&&(P[v]=+e(M,v,y),R[v]=+t(M,v,y),i.point(n?+n(M,v,y):P[v],s?+s(M,v,y):R[v]))}if(T)return i=null,T+""||null}function x(){return s$e().defined(a).curve(l).context(o)}return m.x=function(y){return arguments.length?(e=typeof y=="function"?y:il(+y),n=null,m):e},m.x0=function(y){return arguments.length?(e=typeof y=="function"?y:il(+y),m):e},m.x1=function(y){return arguments.length?(n=y==null?null:typeof y=="function"?y:il(+y),m):n},m.y=function(y){return arguments.length?(t=typeof y=="function"?y:il(+y),s=null,m):t},m.y0=function(y){return arguments.length?(t=typeof y=="function"?y:il(+y),m):t},m.y1=function(y){return arguments.length?(s=y==null?null:typeof y=="function"?y:il(+y),m):s},m.lineX0=m.lineY0=function(){return x().x(e).y(t)},m.lineY1=function(){return x().x(e).y(s)},m.lineX1=function(){return x().x(n).y(t)},m.defined=function(y){return arguments.length?(a=typeof y=="function"?y:il(!!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 n$e{constructor(t,s){this._context=t,this._x=s}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,s){switch(t=+t,s=+s,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,s):this._context.moveTo(t,s);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,s,t,s):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+s)/2,t,this._y0,t,s);break}}this._x0=t,this._y0=s}}function xIt(e){return new n$e(e,!0)}function yIt(e){return new n$e(e,!1)}const f1e={draw(e,t){const s=Gf(t/nse);e.moveTo(s,0),e.arc(0,0,s,0,cie)}},vIt={draw(e,t){const s=Gf(t/5)/2;e.moveTo(-3*s,-s),e.lineTo(-s,-s),e.lineTo(-s,-3*s),e.lineTo(s,-3*s),e.lineTo(s,-s),e.lineTo(3*s,-s),e.lineTo(3*s,s),e.lineTo(s,s),e.lineTo(s,3*s),e.lineTo(-s,3*s),e.lineTo(-s,s),e.lineTo(-3*s,s),e.closePath()}},a$e=Gf(1/3),_It=a$e*2,bIt={draw(e,t){const s=Gf(t/_It),n=s*a$e;e.moveTo(0,-s),e.lineTo(n,0),e.lineTo(0,s),e.lineTo(-n,0),e.closePath()}},wIt={draw(e,t){const s=Gf(t),n=-s/2;e.rect(n,n,s,s)}},jIt=.8908130915292852,i$e=sse(nse/10)/sse(7*nse/10),kIt=sse(cie/10)*i$e,NIt=-QBe(cie/10)*i$e,SIt={draw(e,t){const s=Gf(t*jIt),n=kIt*s,a=NIt*s;e.moveTo(0,-s),e.lineTo(n,a);for(let o=1;o<5;++o){const l=cie*o/5,i=QBe(l),u=sse(l);e.lineTo(u*s,-i*s),e.lineTo(i*n-u*a,u*n+i*a)}e.closePath()}},Gde=Gf(3),CIt={draw(e,t){const s=-Gf(t/(Gde*3));e.moveTo(0,s*2),e.lineTo(-Gde*s,-s),e.lineTo(Gde*s,-s),e.closePath()}},Km=-.5,Zm=Gf(3)/2,Dpe=1/Gf(12),MIt=(Dpe/2+1)*3,TIt={draw(e,t){const s=Gf(t/MIt),n=s/2,a=s*Dpe,o=n,l=s*Dpe+s,i=-o,u=l;e.moveTo(n,a),e.lineTo(o,l),e.lineTo(i,u),e.lineTo(Km*n-Zm*a,Zm*n+Km*a),e.lineTo(Km*o-Zm*l,Zm*o+Km*l),e.lineTo(Km*i-Zm*u,Zm*i+Km*u),e.lineTo(Km*n+Zm*a,Km*a-Zm*n),e.lineTo(Km*o+Zm*l,Km*l-Zm*o),e.lineTo(Km*i+Zm*u,Km*u-Zm*i),e.closePath()}};function AIt(e,t){let s=null,n=m1e(a);e=typeof e=="function"?e:il(e||f1e),t=typeof t=="function"?t:il(t===void 0?64:+t);function a(){let o;if(s||(s=o=n()),e.apply(this,arguments).draw(s,+t.apply(this,arguments)),o)return s=null,o+""||null}return a.type=function(o){return arguments.length?(e=typeof o=="function"?o:il(o),a):e},a.size=function(o){return arguments.length?(t=typeof o=="function"?o:il(+o),a):t},a.context=function(o){return arguments.length?(s=o??null,a):s},a}function ase(){}function ise(e,t,s){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+s)/6)}function o$e(e){this._context=e}o$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:ise(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:ise(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function EIt(e){return new o$e(e)}function l$e(e){this._context=e}l$e.prototype={areaStart:ase,areaEnd:ase,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:ise(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function IIt(e){return new l$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._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 s=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(s,n):this._context.moveTo(s,n);break;case 3:this._point=4;default:ise(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function PIt(e){return new c$e(e)}function d$e(e){this._context=e}d$e.prototype={areaStart:ase,areaEnd:ase,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 LIt(e){return new d$e(e)}function zCe(e){return e<0?-1:1}function BCe(e,t,s){var n=e._x1-e._x0,a=t-e._x1,o=(e._y1-e._y0)/(n||a<0&&-0),l=(s-e._y1)/(a||n<0&&-0),i=(o*a+l*n)/(n+a);return(zCe(o)+zCe(l))*Math.min(Math.abs(o),Math.abs(l),.5*Math.abs(i))||0}function $Ce(e,t){var s=e._x1-e._x0;return s?(3*(e._y1-e._y0)/s-t)/2:t}function Kde(e,t,s){var n=e._x0,a=e._y0,o=e._x1,l=e._y1,i=(o-n)/3;e._context.bezierCurveTo(n+i,a+i*t,o-i,l-i*s,o,l)}function ose(e){this._context=e}ose.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:Kde(this,this._t0,$Ce(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var s=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,Kde(this,$Ce(this,s=BCe(this,e,t)),s);break;default:Kde(this,this._t0,s=BCe(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=s}}};function u$e(e){this._context=new h$e(e)}(u$e.prototype=Object.create(ose.prototype)).point=function(e,t){ose.prototype.point.call(this,t,e)};function h$e(e){this._context=e}h$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,s,n,a,o){this._context.bezierCurveTo(t,e,n,s,o,a)}};function OIt(e){return new ose(e)}function DIt(e){return new u$e(e)}function m$e(e){this._context=e}m$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,s=e.length;if(s)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),s===2)this._context.lineTo(e[1],t[1]);else for(var n=UCe(e),a=UCe(t),o=0,l=1;l=0;--t)a[t]=(l[t]-a[t+1])/o[t];for(o[s-1]=(e[s]+a[s-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 s=this._x*(1-this._t)+e*this._t;this._context.lineTo(s,this._y),this._context.lineTo(s,t)}break}}this._x=e,this._y=t}};function FIt(e){return new uie(e,.5)}function zIt(e){return new uie(e,0)}function BIt(e){return new uie(e,1)}function ZC(e,t){if((l=e.length)>1)for(var s=1,n,a,o=e[t[0]],l,i=o.length;s=0;)s[t]=t;return s}function $It(e,t){return e[t]}function UIt(e){const t=[];return t.key=e,t}function qIt(){var e=il([]),t=Rpe,s=ZC,n=$It;function a(o){var l=Array.from(e.apply(this,arguments),UIt),i,u=l.length,m=-1,x;for(const y of o)for(i=0,++m;i0){for(var s,n,a=0,o=e[0].length,l;a0){for(var s=0,n=e[t[0]],a,o=n.length;s0)||!((o=(a=e[t[0]]).length)>0))){for(var s=0,n=1,a,o,l;n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function QIt(e,t){if(e==null)return{};var s={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;s[n]=e[n]}return s}var p$e={symbolCircle:f1e,symbolCross:vIt,symbolDiamond:bIt,symbolSquare:wIt,symbolStar:SIt,symbolTriangle:CIt,symbolWye:TIt},JIt=Math.PI/180,ePt=function(t){var s="symbol".concat(lie(t));return p$e[s]||f1e},tPt=function(t,s,n){if(s==="area")return t;switch(n){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*JIt;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}},rPt=function(t,s){p$e["symbol".concat(lie(t))]=s},g1e=function(t){var s=t.type,n=s===void 0?"circle":s,a=t.size,o=a===void 0?64:a,l=t.sizeType,i=l===void 0?"area":l,u=XIt(t,GIt),m=VCe(VCe({},u),{},{type:n,size:o,sizeType:i}),x=function(){var M=ePt(n),E=AIt().type(M).size(tPt(o,i,n));return E()},y=m.className,v=m.cx,b=m.cy,N=qa(m,!0);return v===+v&&b===+b&&o===+o?ut.createElement("path",Fpe({},N,{className:mi("recharts-symbols",y),transform:"translate(".concat(v,", ").concat(b,")"),d:x()})):null};g1e.registerSymbol=rPt;function YC(e){"@babel/helpers - typeof";return YC=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},YC(e)}function zpe(){return zpe=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var T=b.inactive?m:b.color;return ut.createElement("li",zpe({className:M,style:y,key:"legend-item-".concat(N)},jk(n.props,b,N)),ut.createElement(Ape,{width:l,height:l,viewBox:x,style:v},n.renderIcon(b)),ut.createElement("span",{className:"recharts-legend-item-text",style:{color:T}},k?k(E,b,N):E))})}},{key:"render",value:function(){var n=this.props,a=n.payload,o=n.layout,l=n.align;if(!a||!a.length)return null;var i={padding:0,margin:0,textAlign:o==="horizontal"?l:"left"};return ut.createElement("ul",{className:"recharts-default-legend",style:i},this.renderItems())}}])}(A.PureComponent);oI(x1e,"displayName","Legend");oI(x1e,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var hPt=Zae;function mPt(){this.__data__=new hPt,this.size=0}var pPt=mPt;function fPt(e){var t=this.__data__,s=t.delete(e);return this.size=t.size,s}var gPt=fPt;function xPt(e){return this.__data__.get(e)}var yPt=xPt;function vPt(e){return this.__data__.has(e)}var _Pt=vPt,bPt=Zae,wPt=n1e,jPt=a1e,kPt=200;function NPt(e,t){var s=this.__data__;if(s instanceof bPt){var n=s.__data__;if(!wPt||n.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=s&GPt?new qPt:void 0;for(o.set(e,t),o.set(t,e);++y-1&&e%1==0&&e-1&&e%1==0&&e<=X6t}var b1e=Q6t,J6t=Wy,eLt=b1e,tLt=Gy,rLt="[object Arguments]",sLt="[object Array]",nLt="[object Boolean]",aLt="[object Date]",iLt="[object Error]",oLt="[object Function]",lLt="[object Map]",cLt="[object Number]",dLt="[object Object]",uLt="[object RegExp]",hLt="[object Set]",mLt="[object String]",pLt="[object WeakMap]",fLt="[object ArrayBuffer]",gLt="[object DataView]",xLt="[object Float32Array]",yLt="[object Float64Array]",vLt="[object Int8Array]",_Lt="[object Int16Array]",bLt="[object Int32Array]",wLt="[object Uint8Array]",jLt="[object Uint8ClampedArray]",kLt="[object Uint16Array]",NLt="[object Uint32Array]",gl={};gl[xLt]=gl[yLt]=gl[vLt]=gl[_Lt]=gl[bLt]=gl[wLt]=gl[jLt]=gl[kLt]=gl[NLt]=!0;gl[rLt]=gl[sLt]=gl[fLt]=gl[nLt]=gl[gLt]=gl[aLt]=gl[iLt]=gl[oLt]=gl[lLt]=gl[cLt]=gl[dLt]=gl[uLt]=gl[hLt]=gl[mLt]=gl[pLt]=!1;function SLt(e){return tLt(e)&&eLt(e.length)&&!!gl[J6t(e)]}var CLt=SLt;function MLt(e){return function(t){return e(t)}}var N$e=MLt,use={exports:{}};use.exports;(function(e,t){var s=PBe,n=t&&!t.nodeType&&t,a=n&&!0&&e&&!e.nodeType&&e,o=a&&a.exports===n,l=o&&s.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})(use,use.exports);var TLt=use.exports,ALt=CLt,ELt=N$e,XCe=TLt,QCe=XCe&&XCe.isTypedArray,ILt=QCe?ELt(QCe):ALt,S$e=ILt,PLt=D6t,LLt=v1e,OLt=qh,DLt=k$e,RLt=_1e,FLt=S$e,zLt=Object.prototype,BLt=zLt.hasOwnProperty;function $Lt(e,t){var s=OLt(e),n=!s&&LLt(e),a=!s&&!n&&DLt(e),o=!s&&!n&&!a&&FLt(e),l=s||n||a||o,i=l?PLt(e.length,String):[],u=i.length;for(var m in e)(t||BLt.call(e,m))&&!(l&&(m=="length"||a&&(m=="offset"||m=="parent")||o&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||RLt(m,u)))&&i.push(m);return i}var ULt=$Lt,qLt=Object.prototype;function VLt(e){var t=e&&e.constructor,s=typeof t=="function"&&t.prototype||qLt;return e===s}var HLt=VLt;function WLt(e,t){return function(s){return e(t(s))}}var C$e=WLt,GLt=C$e,KLt=GLt(Object.keys,Object),ZLt=KLt,YLt=HLt,XLt=ZLt,QLt=Object.prototype,JLt=QLt.hasOwnProperty;function eOt(e){if(!YLt(e))return XLt(e);var t=[];for(var s in Object(e))JLt.call(e,s)&&s!="constructor"&&t.push(s);return t}var tOt=eOt,rOt=r1e,sOt=b1e;function nOt(e){return e!=null&&sOt(e.length)&&!rOt(e)}var IP=nOt,aOt=ULt,iOt=tOt,oOt=IP;function lOt(e){return oOt(e)?aOt(e):iOt(e)}var hie=lOt,cOt=k6t,dOt=L6t,uOt=hie;function hOt(e){return cOt(e,uOt,dOt)}var mOt=hOt,JCe=mOt,pOt=1,fOt=Object.prototype,gOt=fOt.hasOwnProperty;function xOt(e,t,s,n,a,o){var l=s&pOt,i=JCe(e),u=i.length,m=JCe(t),x=m.length;if(u!=x&&!l)return!1;for(var y=u;y--;){var v=i[y];if(!(l?v in t:gOt.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 fDt=pDt;function gDt(e,t,s){for(var n=-1,a=e==null?0:e.length;++n=EDt){var m=t?null:TDt(e);if(m)return ADt(m);l=!1,a=MDt,u=new NDt}else u=t?[]:i;e:for(;++n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function GDt(e,t){if(e==null)return{};var s={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;s[n]=e[n]}return s}function KDt(e){return e.value}function ZDt(e,t){if(ut.isValidElement(e))return ut.cloneElement(e,t);if(typeof e=="function")return ut.createElement(e,t);t.ref;var s=WDt(t,FDt);return ut.createElement(x1e,s)}var f3e=1,oC=function(e){function t(){var s;zDt(this,t);for(var n=arguments.length,a=new Array(n),o=0;of3e||Math.abs(a.height-this.lastBoundingBox.height)>f3e)&&(this.lastBoundingBox.width=a.width,this.lastBoundingBox.height=a.height,n&&n(a)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Bx({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){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(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.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(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.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 Bx(Bx({},y),v)}},{key:"render",value:function(){var n=this,a=this.props,o=a.content,l=a.width,i=a.height,u=a.wrapperStyle,m=a.payloadUniqBy,x=a.payload,y=Bx(Bx({position:"absolute",width:l||"auto",height:i||"auto"},this.getDefaultPosition(u)),u);return ut.createElement("div",{className:"recharts-legend-wrapper",style:y,ref:function(b){n.wrapperNode=b}},ZDt(o,Bx(Bx({},this.props),{},{payload:L$e(x,m,KDt)})))}}],[{key:"getWithHeight",value:function(n,a){var o=Bx(Bx({},this.defaultProps),n.props),l=o.layout;return l==="vertical"&&Fs(n.props.height)?{height:n.props.height}:l==="horizontal"?{width:n.props.width||a}:null}}])}(A.PureComponent);mie(oC,"displayName","Legend");mie(oC,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var g3e=TP,YDt=v1e,XDt=qh,x3e=g3e?g3e.isConcatSpreadable:void 0;function QDt(e){return XDt(e)||YDt(e)||!!(x3e&&e&&e[x3e])}var JDt=QDt,eRt=w$e,tRt=JDt;function R$e(e,t,s,n,a){var o=-1,l=e.length;for(s||(s=tRt),a||(a=[]);++o0&&s(i)?t>1?R$e(i,t-1,s,n,a):eRt(a,i):n||(a[a.length]=i)}return a}var F$e=R$e;function rRt(e){return function(t,s,n){for(var a=-1,o=Object(t),l=n(t),i=l.length;i--;){var u=l[e?i:++a];if(s(o[u],u,o)===!1)break}return t}}var sRt=rRt,nRt=sRt,aRt=nRt(),iRt=aRt,oRt=iRt,lRt=hie;function cRt(e,t){return e&&oRt(e,t,lRt)}var z$e=cRt,dRt=IP;function uRt(e,t){return function(s,n){if(s==null)return s;if(!dRt(s))return e(s,n);for(var a=s.length,o=t?a:-1,l=Object(s);(t?o--:++ot||o&&l&&u&&!i&&!m||n&&l&&u||!s&&u||!a)return 1;if(!n&&!o&&!m&&e=i)return u;var m=s[n];return u*(m=="desc"?-1:1)}}return e.index-t.index}var NRt=kRt,Qde=o1e,SRt=l1e,CRt=ux,MRt=B$e,TRt=_Rt,ARt=N$e,ERt=NRt,IRt=J3,PRt=qh;function LRt(e,t,s){t.length?t=Qde(t,function(o){return PRt(o)?function(l){return SRt(l,o.length===1?o[0]:o)}:o}):t=[IRt];var n=-1;t=Qde(t,ARt(CRt));var a=MRt(e,function(o,l,i){var u=Qde(t,function(m){return m(o)});return{criteria:u,index:++n,value:o}});return TRt(a,function(o,l){return ERt(o,l,s)})}var ORt=LRt;function DRt(e,t,s){switch(s.length){case 0:return e.call(t);case 1:return e.call(t,s[0]);case 2:return e.call(t,s[0],s[1]);case 3:return e.call(t,s[0],s[1],s[2])}return e.apply(t,s)}var RRt=DRt,FRt=RRt,v3e=Math.max;function zRt(e,t,s){return t=v3e(t===void 0?e.length-1:t,0),function(){for(var n=arguments,a=-1,o=v3e(n.length-t,0),l=Array(o);++a0){if(++t>=ZRt)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var JRt=QRt,eFt=KRt,tFt=JRt,rFt=tFt(eFt),sFt=rFt,nFt=J3,aFt=BRt,iFt=sFt;function oFt(e,t){return iFt(aFt(e,t,nFt),e+"")}var lFt=oFt,cFt=s1e,dFt=IP,uFt=_1e,hFt=Dv;function mFt(e,t,s){if(!hFt(s))return!1;var n=typeof t;return(n=="number"?dFt(s)&&uFt(t,s.length):n=="string"&&t in s)?cFt(s[t],e):!1}var pie=mFt,pFt=F$e,fFt=ORt,gFt=lFt,b3e=pie,xFt=gFt(function(e,t){if(e==null)return[];var s=t.length;return s>1&&b3e(e,t[0],t[1])?t=[]:s>2&&b3e(t[0],t[1],t[2])&&(t=[t[0]]),fFt(e,pFt(t,1),[])}),yFt=xFt;const k1e=no(yFt);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 Gpe(){return Gpe=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var s=0,n=new Array(t);s=t.x),"".concat(wT,"-left"),Fs(s)&&t&&Fs(t.x)&&s=t.y),"".concat(wT,"-top"),Fs(n)&&t&&Fs(t.y)&&nk?Math.max(x,u[n]):Math.max(y,u[n])}function PFt(e){var t=e.translateX,s=e.translateY,n=e.useTranslate3d;return{transform:n?"translate3d(".concat(t,"px, ").concat(s,"px, 0)"):"translate(".concat(t,"px, ").concat(s,"px)")}}function LFt(e){var t=e.allowEscapeViewBox,s=e.coordinate,n=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&&s?(x=k3e({allowEscapeViewBox:t,coordinate:s,key:"x",offsetTopLeft:n,position:a,reverseDirection:o,tooltipDimension:l.width,viewBox:u,viewBoxDimension:u.width}),y=k3e({allowEscapeViewBox:t,coordinate:s,key:"y",offsetTopLeft:n,position:a,reverseDirection:o,tooltipDimension:l.height,viewBox:u,viewBoxDimension:u.height}),m=PFt({translateX:x,translateY:y,useTranslate3d:i})):m=EFt,{cssProperties:m,cssClasses:IFt({translateX:x,translateY:y,coordinate:s})}}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 N3e(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),s.push.apply(s,n)}return s}function S3e(e){for(var t=1;tC3e||Math.abs(n.height-this.state.lastBoundingBox.height)>C3e)&&this.setState({lastBoundingBox:{width:n.width,height:n.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 n,a;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.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 n=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,E=a.viewBox,T=a.wrapperStyle,P=LFt({allowEscapeViewBox:l,coordinate:x,offsetTopLeft:b,position:N,reverseDirection:k,tooltipBox:this.state.lastBoundingBox,useTranslate3d:M,viewBox:E}),R=P.cssClasses,D=P.cssProperties,U=S3e(S3e({transition:v&&o?"transform ".concat(i,"ms ").concat(u):void 0},D),{},{pointerEvents:"none",visibility:!this.state.dismissed&&o&&y?"visible":"hidden",position:"absolute",top:0,left:0},T);return ut.createElement("div",{tabIndex:-1,className:R,style:U,ref:function(H){n.wrapperNode=H}},m)}}])}(A.PureComponent),VFt=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},e5={isSsr:VFt()};function JC(e){"@babel/helpers - typeof";return JC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},JC(e)}function M3e(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),s.push.apply(s,n)}return s}function T3e(e){for(var t=1;t0;return ut.createElement(qFt,{allowEscapeViewBox:l,animationDuration:i,animationEasing:u,isAnimationActive:v,active:o,coordinate:x,hasPayload:U,offset:b,position:M,reverseDirection:E,useTranslate3d:T,viewBox:P,wrapperStyle:R},ezt(m,T3e(T3e({},this.props),{},{payload:D})))}}])}(A.PureComponent);N1e(pf,"displayName","Tooltip");N1e(pf,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!e5.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 tzt=dx,rzt=function(){return tzt.Date.now()},szt=rzt,nzt=/\s/;function azt(e){for(var t=e.length;t--&&nzt.test(e.charAt(t)););return t}var izt=azt,ozt=izt,lzt=/^\s+/;function czt(e){return e&&e.slice(0,ozt(e)+1).replace(lzt,"")}var dzt=czt,uzt=dzt,A3e=Dv,hzt=W3,E3e=NaN,mzt=/^[-+]0x[0-9a-f]+$/i,pzt=/^0b[01]+$/i,fzt=/^0o[0-7]+$/i,gzt=parseInt;function xzt(e){if(typeof e=="number")return e;if(hzt(e))return E3e;if(A3e(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=A3e(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=uzt(e);var s=pzt.test(e);return s||fzt.test(e)?gzt(e.slice(2),s?2:8):mzt.test(e)?E3e:+e}var W$e=xzt,yzt=Dv,eue=szt,I3e=W$e,vzt="Expected a function",_zt=Math.max,bzt=Math.min;function wzt(e,t,s){var n,a,o,l,i,u,m=0,x=!1,y=!1,v=!0;if(typeof e!="function")throw new TypeError(vzt);t=I3e(t)||0,yzt(s)&&(x=!!s.leading,y="maxWait"in s,o=y?_zt(I3e(s.maxWait)||0,t):o,v="trailing"in s?!!s.trailing:v);function b(U){var q=n,H=a;return n=a=void 0,m=U,l=e.apply(H,q),l}function N(U){return m=U,i=setTimeout(E,t),x?b(U):l}function k(U){var q=U-u,H=U-m,G=t-q;return y?bzt(G,o-H):G}function M(U){var q=U-u,H=U-m;return u===void 0||q>=t||q<0||y&&H>=o}function E(){var U=eue();if(M(U))return T(U);i=setTimeout(E,k(U))}function T(U){return i=void 0,v&&n?b(U):(n=a=void 0,l)}function P(){i!==void 0&&clearTimeout(i),m=0,n=u=a=i=void 0}function R(){return i===void 0?l:T(eue())}function D(){var U=eue(),q=M(U);if(n=arguments,a=this,u=U,q){if(i===void 0)return N(u);if(y)return clearTimeout(i),i=setTimeout(E,t),b(u)}return i===void 0&&(i=setTimeout(E,t)),l}return D.cancel=P,D.flush=R,D}var jzt=wzt,kzt=jzt,Nzt=Dv,Szt="Expected a function";function Czt(e,t,s){var n=!0,a=!0;if(typeof e!="function")throw new TypeError(Szt);return Nzt(s)&&(n="leading"in s?!!s.leading:n,a="trailing"in s?!!s.trailing:a),kzt(e,t,{leading:n,maxWait:t,trailing:a})}var Mzt=Czt;const G$e=no(Mzt);function dI(e){"@babel/helpers - typeof";return dI=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},dI(e)}function P3e(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),s.push.apply(s,n)}return s}function FO(e){for(var t=1;te.length)&&(t=e.length);for(var s=0,n=new Array(t);s0&&(he=G$e(he,k,{trailing:!0,leading:!1}));var se=new ResizeObserver(he),fe=D.current.getBoundingClientRect(),oe=fe.width,ce=fe.height;return ne(oe,ce),se.observe(D.current),function(){se.disconnect()}},[ne,k]);var ie=A.useMemo(function(){var he=G.containerWidth,se=G.containerHeight;if(he<0||se<0)return null;Rf(fj(l)||fj(u),`The width(%s) and height(%s) are both fixed numbers, maybe you don't need to use a ResponsiveContainer.`,l,u),Rf(!s||s>0,"The aspect(%s) must be greater than zero.",s);var fe=fj(l)?he:l,oe=fj(u)?se:u;s&&s>0&&(fe?oe=fe/s:oe&&(fe=oe*s),v&&oe>v&&(oe=v)),Rf(fe>0||oe>0,`The width(%s) and height(%s) of chart should be greater than 0, please check the style of container, or the props width(%s) and height(%s), or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the height and width.`,fe,oe,l,u,x,y,s);var ce=!Array.isArray(b)&&wy(b.type).endsWith("Chart");return ut.Children.map(b,function(de){return ut.isValidElement(de)?A.cloneElement(de,FO({width:fe,height:oe},ce?{style:FO({height:"100%",width:"100%",maxHeight:oe,maxWidth:fe},de.props.style)}:{})):de})},[s,b,u,v,y,x,G,l]);return ut.createElement("div",{id:M?"".concat(M):void 0,className:mi("recharts-responsive-container",E),style:FO(FO({},R),{},{width:l,height:u,minWidth:x,minHeight:y,maxHeight:v}),ref:D},ie)}),fie=function(t){return null};fie.displayName="Cell";function uI(e){"@babel/helpers - typeof";return uI=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},uI(e)}function O3e(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),s.push.apply(s,n)}return s}function Qpe(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||e5.isSsr)return{width:0,height:0};var n=Uzt(s),a=JSON.stringify({text:t,copyStyle:n});if(z4.widthCache[a])return z4.widthCache[a];try{var o=document.getElementById(D3e);o||(o=document.createElement("span"),o.setAttribute("id",D3e),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var l=Qpe(Qpe({},$zt),n);Object.assign(o.style,l),o.textContent="".concat(t);var i=o.getBoundingClientRect(),u={width:i.width,height:i.height};return z4.widthCache[a]=u,++z4.cacheCount>Bzt&&(z4.cacheCount=0,z4.widthCache={}),u}catch{return{width:0,height:0}}},qzt=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function hI(e){"@babel/helpers - typeof";return hI=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},hI(e)}function fse(e,t){return Gzt(e)||Wzt(e,t)||Hzt(e,t)||Vzt()}function Vzt(){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 Hzt(e,t){if(e){if(typeof e=="string")return R3e(e,t);var s=Object.prototype.toString.call(e).slice(8,-1);if(s==="Object"&&e.constructor&&(s=e.constructor.name),s==="Map"||s==="Set")return Array.from(e);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return R3e(e,t)}}function R3e(e,t){(t==null||t>e.length)&&(t=e.length);for(var s=0,n=new Array(t);s=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function o7t(e,t){if(e==null)return{};var s={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;s[n]=e[n]}return s}function q3e(e,t){return u7t(e)||d7t(e,t)||c7t(e,t)||l7t()}function l7t(){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 c7t(e,t){if(e){if(typeof e=="string")return V3e(e,t);var s=Object.prototype.toString.call(e).slice(8,-1);if(s==="Object"&&e.constructor&&(s=e.constructor.name),s==="Map"||s==="Set")return Array.from(e);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return V3e(e,t)}}function V3e(e,t){(t==null||t>e.length)&&(t=e.length);for(var s=0,n=new Array(t);s0&&arguments[0]!==void 0?arguments[0]:[];return fe.reduce(function(oe,ce){var de=ce.word,xe=ce.width,Me=oe[oe.length-1];if(Me&&(a==null||o||Me.width+xe+nce.width?oe:ce})};if(!x)return b;for(var k="…",M=function(fe){var oe=y.slice(0,fe),ce=X$e({breakAll:m,style:u,children:oe+k}).wordsWithComputedWidth,de=v(ce),xe=de.length>l||N(de).width>Number(a);return[xe,de]},E=0,T=y.length-1,P=0,R;E<=T&&P<=y.length-1;){var D=Math.floor((E+T)/2),U=D-1,q=M(U),H=q3e(q,2),G=H[0],Q=H[1],ne=M(D),ie=q3e(ne,1),he=ie[0];if(!G&&!he&&(E=D+1),G&&he&&(T=D-1),!G&&he){R=Q;break}P++}return R||b},H3e=function(t){var s=Ii(t)?[]:t.toString().split(Y$e);return[{words:s}]},m7t=function(t){var s=t.width,n=t.scaleToFit,a=t.children,o=t.style,l=t.breakAll,i=t.maxLines;if((s||n)&&!e5.isSsr){var u,m,x=X$e({breakAll:l,children:a,style:o});if(x){var y=x.wordsWithComputedWidth,v=x.spaceWidth;u=y,m=v}else return H3e(a);return h7t({breakAll:l,children:a,maxLines:i,style:o},u,m,s,n)}return H3e(a)},W3e="#808080",kk=function(t){var s=t.x,n=s===void 0?0:s,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,E=M===void 0?W3e:M,T=U3e(t,a7t),P=A.useMemo(function(){return m7t({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]),R=T.dx,D=T.dy,U=T.angle,q=T.className,H=T.breakAll,G=U3e(T,i7t);if(!fd(n)||!fd(o))return null;var Q=n+(Fs(R)?R:0),ne=o+(Fs(D)?D:0),ie;switch(k){case"start":ie=tue("calc(".concat(m,")"));break;case"middle":ie=tue("calc(".concat((P.length-1)/2," * -").concat(i," + (").concat(m," / 2))"));break;default:ie=tue("calc(".concat(P.length-1," * -").concat(i,")"));break}var he=[];if(y){var se=P[0].width,fe=T.width;he.push("scale(".concat((Fs(fe)?fe/se:1)/se,")"))}return U&&he.push("rotate(".concat(U,", ").concat(Q,", ").concat(ne,")")),he.length&&(G.transform=he.join(" ")),ut.createElement("text",Jpe({},qa(G,!0),{x:Q,y:ne,className:mi("recharts-text",q),textAnchor:b,fill:E.includes("url")?W3e:E}),P.map(function(oe,ce){var de=oe.words.join(H?"":" ");return ut.createElement("tspan",{x:Q,dy:ce===0?ie:i,key:"".concat(de,"-").concat(ce)},de)}))};function cv(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function p7t(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function S1e(e){let t,s,n;e.length!==2?(t=cv,s=(i,u)=>cv(e(i),u),n=(i,u)=>e(i)-u):(t=e===cv||e===p7t?e:f7t,s=e,n=e);function a(i,u,m=0,x=i.length){if(m>>1;s(i[y],u)<0?m=y+1:x=y}while(m>>1;s(i[y],u)<=0?m=y+1:x=y}while(mm&&n(i[y-1],u)>-n(i[y],u)?y-1:y}return{left:a,center:l,right:o}}function f7t(){return 0}function Q$e(e){return e===null?NaN:+e}function*g7t(e,t){for(let s of e)s!=null&&(s=+s)>=s&&(yield s)}const x7t=S1e(cv),PP=x7t.right;S1e(Q$e).center;class G3e extends Map{constructor(t,s=_7t){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:s}}),t!=null)for(const[n,a]of t)this.set(n,a)}get(t){return super.get(K3e(this,t))}has(t){return super.has(K3e(this,t))}set(t,s){return super.set(y7t(this,t),s)}delete(t){return super.delete(v7t(this,t))}}function K3e({_intern:e,_key:t},s){const n=t(s);return e.has(n)?e.get(n):s}function y7t({_intern:e,_key:t},s){const n=t(s);return e.has(n)?e.get(n):(e.set(n,s),s)}function v7t({_intern:e,_key:t},s){const n=t(s);return e.has(n)&&(s=e.get(n),e.delete(n)),s}function _7t(e){return e!==null&&typeof e=="object"?e.valueOf():e}function b7t(e=cv){if(e===cv)return J$e;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,s)=>{const n=e(t,s);return n||n===0?n:(e(s,s)===0)-(e(t,t)===0)}}function J$e(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const w7t=Math.sqrt(50),j7t=Math.sqrt(10),k7t=Math.sqrt(2);function gse(e,t,s){const n=(t-e)/Math.max(0,s),a=Math.floor(Math.log10(n)),o=n/Math.pow(10,a),l=o>=w7t?10:o>=j7t?5:o>=k7t?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 n=t=a))return[];const i=o-a+1,u=new Array(i);if(n)if(l<0)for(let m=0;m=n)&&(s=n);return s}function Y3e(e,t){let s;for(const n of e)n!=null&&(s>n||s===void 0&&n>=n)&&(s=n);return s}function eUe(e,t,s=0,n=1/0,a){if(t=Math.floor(t),s=Math.floor(Math.max(0,s)),n=Math.floor(Math.min(e.length-1,n)),!(s<=t&&t<=n))return e;for(a=a===void 0?J$e:b7t(a);n>s;){if(n-s>600){const u=n-s+1,m=t-s+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(s,Math.floor(t-m*y/u+v)),N=Math.min(n,Math.floor(t+(u-m)*y/u+v));eUe(e,t,b,N,a)}const o=e[t];let l=s,i=n;for(jT(e,s,t),a(e[n],o)>0&&jT(e,s,n);l0;)--i}a(e[s],o)===0?jT(e,s,i):(++i,jT(e,i,n)),i<=t&&(s=i+1),t<=i&&(n=i-1)}return e}function jT(e,t,s){const n=e[t];e[t]=e[s],e[s]=n}function N7t(e,t,s){if(e=Float64Array.from(g7t(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return Y3e(e);if(t>=1)return Z3e(e);var n,a=(n-1)*t,o=Math.floor(a),l=Z3e(eUe(e,o).subarray(0,o+1)),i=Y3e(e.subarray(o+1));return l+(i-l)*(a-o)}}function S7t(e,t,s=Q$e){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+s(e[0],0,e);if(t>=1)return+s(e[n-1],n-1,e);var n,a=(n-1)*t,o=Math.floor(a),l=+s(e[o],o,e),i=+s(e[o+1],o+1,e);return l+(i-l)*(a-o)}}function C7t(e,t,s){e=+e,t=+t,s=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+s;for(var n=-1,a=Math.max(0,Math.ceil((t-e)/s))|0,o=new Array(a);++n>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):s===8?BO(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):s===4?BO(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=T7t.exec(e))?new Ph(t[1],t[2],t[3],1):(t=A7t.exec(e))?new Ph(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=E7t.exec(e))?BO(t[1],t[2],t[3],t[4]):(t=I7t.exec(e))?BO(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=P7t.exec(e))?s5e(t[1],t[2]/100,t[3]/100,1):(t=L7t.exec(e))?s5e(t[1],t[2]/100,t[3]/100,t[4]):X3e.hasOwnProperty(e)?e5e(X3e[e]):e==="transparent"?new Ph(NaN,NaN,NaN,0):null}function e5e(e){return new Ph(e>>16&255,e>>8&255,e&255,1)}function BO(e,t,s,n){return n<=0&&(e=t=s=NaN),new Ph(e,t,s,n)}function R7t(e){return e instanceof LP||(e=gI(e)),e?(e=e.rgb(),new Ph(e.r,e.g,e.b,e.opacity)):new Ph}function nfe(e,t,s,n){return arguments.length===1?R7t(e):new Ph(e,t,s,n??1)}function Ph(e,t,s,n){this.r=+e,this.g=+t,this.b=+s,this.opacity=+n}M1e(Ph,nfe,rUe(LP,{brighter(e){return e=e==null?xse:Math.pow(xse,e),new Ph(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?pI:Math.pow(pI,e),new Ph(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ph(ek(this.r),ek(this.g),ek(this.b),yse(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:t5e,formatHex:t5e,formatHex8:F7t,formatRgb:r5e,toString:r5e}));function t5e(){return`#${gj(this.r)}${gj(this.g)}${gj(this.b)}`}function F7t(){return`#${gj(this.r)}${gj(this.g)}${gj(this.b)}${gj((isNaN(this.opacity)?1:this.opacity)*255)}`}function r5e(){const e=yse(this.opacity);return`${e===1?"rgb(":"rgba("}${ek(this.r)}, ${ek(this.g)}, ${ek(this.b)}${e===1?")":`, ${e})`}`}function yse(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ek(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function gj(e){return e=ek(e),(e<16?"0":"")+e.toString(16)}function s5e(e,t,s,n){return n<=0?e=t=s=NaN:s<=0||s>=1?e=t=NaN:t<=0&&(e=NaN),new bf(e,t,s,n)}function sUe(e){if(e instanceof bf)return new bf(e.h,e.s,e.l,e.opacity);if(e instanceof LP||(e=gI(e)),!e)return new bf;if(e instanceof bf)return e;e=e.rgb();var t=e.r/255,s=e.g/255,n=e.b/255,a=Math.min(t,s,n),o=Math.max(t,s,n),l=NaN,i=o-a,u=(o+a)/2;return i?(t===o?l=(s-n)/i+(s0&&u<1?0:l,new bf(l,i,u,e.opacity)}function z7t(e,t,s,n){return arguments.length===1?sUe(e):new bf(e,t,s,n??1)}function bf(e,t,s,n){this.h=+e,this.s=+t,this.l=+s,this.opacity=+n}M1e(bf,z7t,rUe(LP,{brighter(e){return e=e==null?xse:Math.pow(xse,e),new bf(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?pI:Math.pow(pI,e),new bf(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,s=this.l,n=s+(s<.5?s:1-s)*t,a=2*s-n;return new Ph(rue(e>=240?e-240:e+120,a,n),rue(e,a,n),rue(e<120?e+240:e-120,a,n),this.opacity)},clamp(){return new bf(n5e(this.h),$O(this.s),$O(this.l),yse(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=yse(this.opacity);return`${e===1?"hsl(":"hsla("}${n5e(this.h)}, ${$O(this.s)*100}%, ${$O(this.l)*100}%${e===1?")":`, ${e})`}`}}));function n5e(e){return e=(e||0)%360,e<0?e+360:e}function $O(e){return Math.max(0,Math.min(1,e||0))}function rue(e,t,s){return(e<60?t+(s-t)*e/60:e<180?s:e<240?t+(s-t)*(240-e)/60:t)*255}const T1e=e=>()=>e;function B7t(e,t){return function(s){return e+s*t}}function $7t(e,t,s){return e=Math.pow(e,s),t=Math.pow(t,s)-e,s=1/s,function(n){return Math.pow(e+n*t,s)}}function U7t(e){return(e=+e)==1?nUe:function(t,s){return s-t?$7t(t,s,e):T1e(isNaN(t)?s:t)}}function nUe(e,t){var s=t-e;return s?B7t(e,s):T1e(isNaN(e)?t:e)}const a5e=function e(t){var s=U7t(t);function n(a,o){var l=s((a=nfe(a)).r,(o=nfe(o)).r),i=s(a.g,o.g),u=s(a.b,o.b),m=nUe(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 n.gamma=e,n}(1);function q7t(e,t){t||(t=[]);var s=e?Math.min(t.length,e.length):0,n=t.slice(),a;return function(o){for(a=0;as&&(o=t.slice(s,o),i[l]?i[l]+=o:i[++l]=o),(n=n[0])===(a=a[0])?i[l]?i[l]+=a:i[++l]=a:(i[++l]=null,u.push({i:l,x:vse(n,a)})),s=sue.lastIndex;return st&&(s=e,e=t,t=s),function(n){return Math.max(e,Math.min(t,n))}}function e9t(e,t,s){var n=e[0],a=e[1],o=t[0],l=t[1];return a2?t9t:e9t,u=m=null,y}function y(v){return v==null||isNaN(v=+v)?o:(u||(u=i(e.map(n),t,s)))(n(l(v)))}return y.invert=function(v){return l(a((m||(m=i(t,e.map(n),vse)))(v)))},y.domain=function(v){return arguments.length?(e=Array.from(v,_se),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),s=A1e,x()},y.clamp=function(v){return arguments.length?(l=v?!0:eh,x()):l!==eh},y.interpolate=function(v){return arguments.length?(s=v,x()):s},y.unknown=function(v){return arguments.length?(o=v,y):o},function(v,b){return n=v,a=b,x()}}function E1e(){return gie()(eh,eh)}function r9t(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function bse(e,t){if((s=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var s,n=e.slice(0,s);return[n.length>1?n[0]+n.slice(2):n,+e.slice(s+1)]}function e3(e){return e=bse(Math.abs(e)),e?e[1]:NaN}function s9t(e,t){return function(s,n){for(var a=s.length,o=[],l=0,i=e[0],u=0;a>0&&i>0&&(u+i+1>n&&(i=Math.max(1,n-u)),o.push(s.substring(a-=i,a+i)),!((u+=i+1)>n));)i=e[l=(l+1)%e.length];return o.reverse().join(t)}}function n9t(e){return function(t){return t.replace(/[0-9]/g,function(s){return e[+s]})}}var a9t=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xI(e){if(!(t=a9t.exec(e)))throw new Error("invalid format: "+e);var t;return new I1e({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]})}xI.prototype=I1e.prototype;function I1e(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+""}I1e.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 i9t(e){e:for(var t=e.length,s=1,n=-1,a;s0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(a+1):e}var aUe;function o9t(e,t){var s=bse(e,t);if(!s)return e+"";var n=s[0],a=s[1],o=a-(aUe=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,l=n.length;return o===l?n:o>l?n+new Array(o-l+1).join("0"):o>0?n.slice(0,o)+"."+n.slice(o):"0."+new Array(1-o).join("0")+bse(e,Math.max(0,t+o-1))[0]}function o5e(e,t){var s=bse(e,t);if(!s)return e+"";var n=s[0],a=s[1];return a<0?"0."+new Array(-a).join("0")+n:n.length>a+1?n.slice(0,a+1)+"."+n.slice(a+1):n+new Array(a-n.length+2).join("0")}const l5e={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:r9t,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>o5e(e*100,t),r:o5e,s:o9t,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function c5e(e){return e}var d5e=Array.prototype.map,u5e=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function l9t(e){var t=e.grouping===void 0||e.thousands===void 0?c5e:s9t(d5e.call(e.grouping,Number),e.thousands+""),s=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",a=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?c5e:n9t(d5e.call(e.numerals,String)),l=e.percent===void 0?"%":e.percent+"",i=e.minus===void 0?"−":e.minus+"",u=e.nan===void 0?"NaN":e.nan+"";function m(y){y=xI(y);var v=y.fill,b=y.align,N=y.sign,k=y.symbol,M=y.zero,E=y.width,T=y.comma,P=y.precision,R=y.trim,D=y.type;D==="n"?(T=!0,D="g"):l5e[D]||(P===void 0&&(P=12),R=!0,D="g"),(M||v==="0"&&b==="=")&&(M=!0,v="0",b="=");var U=k==="$"?s:k==="#"&&/[boxX]/.test(D)?"0"+D.toLowerCase():"",q=k==="$"?n:/[%p]/.test(D)?l:"",H=l5e[D],G=/[defgprs%]/.test(D);P=P===void 0?6:/[gprs]/.test(D)?Math.max(1,Math.min(21,P)):Math.max(0,Math.min(20,P));function Q(ne){var ie=U,he=q,se,fe,oe;if(D==="c")he=H(ne)+he,ne="";else{ne=+ne;var ce=ne<0||1/ne<0;if(ne=isNaN(ne)?u:H(Math.abs(ne),P),R&&(ne=i9t(ne)),ce&&+ne==0&&N!=="+"&&(ce=!1),ie=(ce?N==="("?N:i:N==="-"||N==="("?"":N)+ie,he=(D==="s"?u5e[8+aUe/3]:"")+he+(ce&&N==="("?")":""),G){for(se=-1,fe=ne.length;++seoe||oe>57){he=(oe===46?a+ne.slice(se+1):ne.slice(se))+he,ne=ne.slice(0,se);break}}}T&&!M&&(ne=t(ne,1/0));var de=ie.length+ne.length+he.length,xe=de>1)+ie+ne+he+xe.slice(de);break;default:ne=xe+ie+ne+he;break}return o(ne)}return Q.toString=function(){return y+""},Q}function x(y,v){var b=m((y=xI(y),y.type="f",y)),N=Math.max(-8,Math.min(8,Math.floor(e3(v)/3)))*3,k=Math.pow(10,-N),M=u5e[8+N/3];return function(E){return b(k*E)+M}}return{format:m,formatPrefix:x}}var UO,P1e,iUe;c9t({thousands:",",grouping:[3],currency:["$",""]});function c9t(e){return UO=l9t(e),P1e=UO.format,iUe=UO.formatPrefix,UO}function d9t(e){return Math.max(0,-e3(Math.abs(e)))}function u9t(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(e3(t)/3)))*3-e3(Math.abs(e)))}function h9t(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,e3(t)-e3(e))+1}function oUe(e,t,s,n){var a=rfe(e,t,s),o;switch(n=xI(n??",f"),n.type){case"s":{var l=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(o=u9t(a,l))&&(n.precision=o),iUe(n,l)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(o=h9t(a,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=o-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(o=d9t(a))&&(n.precision=o-(n.type==="%")*2);break}}return P1e(n)}function Rv(e){var t=e.domain;return e.ticks=function(s){var n=t();return efe(n[0],n[n.length-1],s??10)},e.tickFormat=function(s,n){var a=t();return oUe(a[0],a[a.length-1],s??10,n)},e.nice=function(s){s==null&&(s=10);var n=t(),a=0,o=n.length-1,l=n[a],i=n[o],u,m,x=10;for(i0;){if(m=tfe(l,i,s),m===u)return n[a]=l,n[o]=i,t(n);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 wse(){var e=E1e();return e.copy=function(){return OP(e,wse())},Cp.apply(e,arguments),Rv(e)}function lUe(e){var t;function s(n){return n==null||isNaN(n=+n)?t:n}return s.invert=s,s.domain=s.range=function(n){return arguments.length?(e=Array.from(n,_se),s):e.slice()},s.unknown=function(n){return arguments.length?(t=n,s):t},s.copy=function(){return lUe(e).unknown(t)},e=arguments.length?Array.from(e,_se):[0,1],Rv(s)}function cUe(e,t){e=e.slice();var s=0,n=e.length-1,a=e[s],o=e[n],l;return oMath.pow(e,t)}function x9t(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 p5e(e){return(t,s)=>-e(-t,s)}function L1e(e){const t=e(h5e,m5e),s=t.domain;let n=10,a,o;function l(){return a=x9t(n),o=g9t(n),s()[0]<0?(a=p5e(a),o=p5e(o),e(m9t,p9t)):e(h5e,m5e),t}return t.base=function(i){return arguments.length?(n=+i,l()):n},t.domain=function(i){return arguments.length?(s(i),l()):s()},t.ticks=i=>{const u=s();let m=u[0],x=u[u.length-1];const y=x0){for(;v<=b;++v)for(N=1;Nx)break;E.push(k)}}else for(;v<=b;++v)for(N=n-1;N>=1;--N)if(k=v>0?N/o(-v):N*o(v),!(kx)break;E.push(k)}E.length*2{if(i==null&&(i=10),u==null&&(u=n===10?"s":","),typeof u!="function"&&(!(n%1)&&(u=xI(u)).precision==null&&(u.trim=!0),u=P1e(u)),i===1/0)return u;const m=Math.max(1,n*i/t.ticks().length);return x=>{let y=x/o(Math.round(a(x)));return y*ns(cUe(s(),{floor:i=>o(Math.floor(a(i))),ceil:i=>o(Math.ceil(a(i)))})),t}function dUe(){const e=L1e(gie()).domain([1,10]);return e.copy=()=>OP(e,dUe()).base(e.base()),Cp.apply(e,arguments),e}function f5e(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function g5e(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function O1e(e){var t=1,s=e(f5e(t),g5e(t));return s.constant=function(n){return arguments.length?e(f5e(t=+n),g5e(t)):t},Rv(s)}function uUe(){var e=O1e(gie());return e.copy=function(){return OP(e,uUe()).constant(e.constant())},Cp.apply(e,arguments)}function x5e(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function y9t(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function v9t(e){return e<0?-e*e:e*e}function D1e(e){var t=e(eh,eh),s=1;function n(){return s===1?e(eh,eh):s===.5?e(y9t,v9t):e(x5e(s),x5e(1/s))}return t.exponent=function(a){return arguments.length?(s=+a,n()):s},Rv(t)}function R1e(){var e=D1e(gie());return e.copy=function(){return OP(e,R1e()).exponent(e.exponent())},Cp.apply(e,arguments),e}function _9t(){return R1e.apply(null,arguments).exponent(.5)}function y5e(e){return Math.sign(e)*e*e}function b9t(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function hUe(){var e=E1e(),t=[0,1],s=!1,n;function a(o){var l=b9t(e(o));return isNaN(l)?n:s?Math.round(l):l}return a.invert=function(o){return e.invert(y5e(o))},a.domain=function(o){return arguments.length?(e.domain(o),a):e.domain()},a.range=function(o){return arguments.length?(e.range((t=Array.from(o,_se)).map(y5e)),a):t.slice()},a.rangeRound=function(o){return a.range(o).round(!0)},a.round=function(o){return arguments.length?(s=!!o,a):s},a.clamp=function(o){return arguments.length?(e.clamp(o),a):e.clamp()},a.unknown=function(o){return arguments.length?(n=o,a):n},a.copy=function(){return hUe(e.domain(),t).round(s).clamp(e.clamp()).unknown(n)},Cp.apply(a,arguments),Rv(a)}function mUe(){var e=[],t=[],s=[],n;function a(){var l=0,i=Math.max(1,t.length);for(s=new Array(i-1);++l0?s[i-1]:e[0],i=s?[n[s-1],t]:[n[m-1],n[m]]},l.unknown=function(u){return arguments.length&&(o=u),l},l.thresholds=function(){return n.slice()},l.copy=function(){return pUe().domain([e,t]).range(a).unknown(o)},Cp.apply(Rv(l),arguments)}function fUe(){var e=[.5],t=[0,1],s,n=1;function a(o){return o!=null&&o<=o?t[PP(e,o,0,n)]:s}return a.domain=function(o){return arguments.length?(e=Array.from(o),n=Math.min(e.length,t.length-1),a):e.slice()},a.range=function(o){return arguments.length?(t=Array.from(o),n=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?(s=o,a):s},a.copy=function(){return fUe().domain(e).range(t).unknown(s)},Cp.apply(a,arguments)}const nue=new Date,aue=new Date;function _d(e,t,s,n){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(m_d(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););}),s&&(a.count=(o,l)=>(nue.setTime(+o),aue.setTime(+l),e(nue),e(aue),Math.floor(s(nue,aue))),a.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?a.filter(n?l=>n(l)%o===0:l=>a.count(0,l)%o===0):a)),a}const jse=_d(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);jse.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?_d(t=>{t.setTime(Math.floor(t/e)*e)},(t,s)=>{t.setTime(+t+s*e)},(t,s)=>(s-t)/e):jse);jse.range;const ny=1e3,dp=ny*60,ay=dp*60,By=ay*24,F1e=By*7,v5e=By*30,iue=By*365,xj=_d(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*ny)},(e,t)=>(t-e)/ny,e=>e.getUTCSeconds());xj.range;const z1e=_d(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ny)},(e,t)=>{e.setTime(+e+t*dp)},(e,t)=>(t-e)/dp,e=>e.getMinutes());z1e.range;const B1e=_d(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*dp)},(e,t)=>(t-e)/dp,e=>e.getUTCMinutes());B1e.range;const $1e=_d(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ny-e.getMinutes()*dp)},(e,t)=>{e.setTime(+e+t*ay)},(e,t)=>(t-e)/ay,e=>e.getHours());$1e.range;const U1e=_d(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*ay)},(e,t)=>(t-e)/ay,e=>e.getUTCHours());U1e.range;const DP=_d(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*dp)/By,e=>e.getDate()-1);DP.range;const xie=_d(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/By,e=>e.getUTCDate()-1);xie.range;const gUe=_d(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/By,e=>Math.floor(e/By));gUe.range;function Rk(e){return _d(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,s)=>{t.setDate(t.getDate()+s*7)},(t,s)=>(s-t-(s.getTimezoneOffset()-t.getTimezoneOffset())*dp)/F1e)}const yie=Rk(0),kse=Rk(1),w9t=Rk(2),j9t=Rk(3),t3=Rk(4),k9t=Rk(5),N9t=Rk(6);yie.range;kse.range;w9t.range;j9t.range;t3.range;k9t.range;N9t.range;function Fk(e){return _d(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,s)=>{t.setUTCDate(t.getUTCDate()+s*7)},(t,s)=>(s-t)/F1e)}const vie=Fk(0),Nse=Fk(1),S9t=Fk(2),C9t=Fk(3),r3=Fk(4),M9t=Fk(5),T9t=Fk(6);vie.range;Nse.range;S9t.range;C9t.range;r3.range;M9t.range;T9t.range;const q1e=_d(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());q1e.range;const V1e=_d(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());V1e.range;const $y=_d(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:_d(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,s)=>{t.setFullYear(t.getFullYear()+s*e)});$y.range;const Uy=_d(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:_d(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,s)=>{t.setUTCFullYear(t.getUTCFullYear()+s*e)});Uy.range;function xUe(e,t,s,n,a,o){const l=[[xj,1,ny],[xj,5,5*ny],[xj,15,15*ny],[xj,30,30*ny],[o,1,dp],[o,5,5*dp],[o,15,15*dp],[o,30,30*dp],[a,1,ay],[a,3,3*ay],[a,6,6*ay],[a,12,12*ay],[n,1,By],[n,2,2*By],[s,1,F1e],[t,1,v5e],[t,3,3*v5e],[e,1,iue]];function i(m,x,y){const v=xM).right(l,v);if(b===l.length)return e.every(rfe(m/iue,x/iue,y));if(b===0)return jse.every(Math.max(rfe(m,x,y),1));const[N,k]=l[v/l[b-1][2]53)return null;"w"in Ee||(Ee.w=1),"Z"in Ee?(le=lue(kT(Ee.y,0,1)),Ve=le.getUTCDay(),le=Ve>4||Ve===0?Nse.ceil(le):Nse(le),le=xie.offset(le,(Ee.V-1)*7),Ee.y=le.getUTCFullYear(),Ee.m=le.getUTCMonth(),Ee.d=le.getUTCDate()+(Ee.w+6)%7):(le=oue(kT(Ee.y,0,1)),Ve=le.getDay(),le=Ve>4||Ve===0?kse.ceil(le):kse(le),le=DP.offset(le,(Ee.V-1)*7),Ee.y=le.getFullYear(),Ee.m=le.getMonth(),Ee.d=le.getDate()+(Ee.w+6)%7)}else("W"in Ee||"U"in Ee)&&("w"in Ee||(Ee.w="u"in Ee?Ee.u%7:"W"in Ee?1:0),Ve="Z"in Ee?lue(kT(Ee.y,0,1)).getUTCDay():oue(kT(Ee.y,0,1)).getDay(),Ee.m=0,Ee.d="W"in Ee?(Ee.w+6)%7+Ee.W*7-(Ve+5)%7:Ee.w+Ee.U*7-(Ve+6)%7);return"Z"in Ee?(Ee.H+=Ee.Z/100|0,Ee.M+=Ee.Z%100,lue(Ee)):oue(Ee)}}function H($e,it,xt,Ee){for(var et=0,le=it.length,Ve=xt.length,Je,rt;et=Ve)return-1;if(Je=it.charCodeAt(et++),Je===37){if(Je=it.charAt(et++),rt=D[Je in _5e?it.charAt(et++):Je],!rt||(Ee=rt($e,xt,Ee))<0)return-1}else if(Je!=xt.charCodeAt(Ee++))return-1}return Ee}function G($e,it,xt){var Ee=m.exec(it.slice(xt));return Ee?($e.p=x.get(Ee[0].toLowerCase()),xt+Ee[0].length):-1}function Q($e,it,xt){var Ee=b.exec(it.slice(xt));return Ee?($e.w=N.get(Ee[0].toLowerCase()),xt+Ee[0].length):-1}function ne($e,it,xt){var Ee=y.exec(it.slice(xt));return Ee?($e.w=v.get(Ee[0].toLowerCase()),xt+Ee[0].length):-1}function ie($e,it,xt){var Ee=E.exec(it.slice(xt));return Ee?($e.m=T.get(Ee[0].toLowerCase()),xt+Ee[0].length):-1}function he($e,it,xt){var Ee=k.exec(it.slice(xt));return Ee?($e.m=M.get(Ee[0].toLowerCase()),xt+Ee[0].length):-1}function se($e,it,xt){return H($e,t,it,xt)}function fe($e,it,xt){return H($e,s,it,xt)}function oe($e,it,xt){return H($e,n,it,xt)}function ce($e){return l[$e.getDay()]}function de($e){return o[$e.getDay()]}function xe($e){return u[$e.getMonth()]}function Me($e){return i[$e.getMonth()]}function ve($e){return a[+($e.getHours()>=12)]}function be($e){return 1+~~($e.getMonth()/3)}function we($e){return l[$e.getUTCDay()]}function tt($e){return o[$e.getUTCDay()]}function Ae($e){return u[$e.getUTCMonth()]}function Le($e){return i[$e.getUTCMonth()]}function Ue($e){return a[+($e.getUTCHours()>=12)]}function Pe($e){return 1+~~($e.getUTCMonth()/3)}return{format:function($e){var it=U($e+="",P);return it.toString=function(){return $e},it},parse:function($e){var it=q($e+="",!1);return it.toString=function(){return $e},it},utcFormat:function($e){var it=U($e+="",R);return it.toString=function(){return $e},it},utcParse:function($e){var it=q($e+="",!0);return it.toString=function(){return $e},it}}}var _5e={"-":"",_:" ",0:"0"},Vd=/^\s*\d+/,O9t=/^%/,D9t=/[\\^$*+?|[\]().{}]/g;function _o(e,t,s){var n=e<0?"-":"",a=(n?-e:e)+"",o=a.length;return n+(o[t.toLowerCase(),s]))}function F9t(e,t,s){var n=Vd.exec(t.slice(s,s+1));return n?(e.w=+n[0],s+n[0].length):-1}function z9t(e,t,s){var n=Vd.exec(t.slice(s,s+1));return n?(e.u=+n[0],s+n[0].length):-1}function B9t(e,t,s){var n=Vd.exec(t.slice(s,s+2));return n?(e.U=+n[0],s+n[0].length):-1}function $9t(e,t,s){var n=Vd.exec(t.slice(s,s+2));return n?(e.V=+n[0],s+n[0].length):-1}function U9t(e,t,s){var n=Vd.exec(t.slice(s,s+2));return n?(e.W=+n[0],s+n[0].length):-1}function b5e(e,t,s){var n=Vd.exec(t.slice(s,s+4));return n?(e.y=+n[0],s+n[0].length):-1}function w5e(e,t,s){var n=Vd.exec(t.slice(s,s+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),s+n[0].length):-1}function q9t(e,t,s){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(s,s+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),s+n[0].length):-1}function V9t(e,t,s){var n=Vd.exec(t.slice(s,s+1));return n?(e.q=n[0]*3-3,s+n[0].length):-1}function H9t(e,t,s){var n=Vd.exec(t.slice(s,s+2));return n?(e.m=n[0]-1,s+n[0].length):-1}function j5e(e,t,s){var n=Vd.exec(t.slice(s,s+2));return n?(e.d=+n[0],s+n[0].length):-1}function W9t(e,t,s){var n=Vd.exec(t.slice(s,s+3));return n?(e.m=0,e.d=+n[0],s+n[0].length):-1}function k5e(e,t,s){var n=Vd.exec(t.slice(s,s+2));return n?(e.H=+n[0],s+n[0].length):-1}function G9t(e,t,s){var n=Vd.exec(t.slice(s,s+2));return n?(e.M=+n[0],s+n[0].length):-1}function K9t(e,t,s){var n=Vd.exec(t.slice(s,s+2));return n?(e.S=+n[0],s+n[0].length):-1}function Z9t(e,t,s){var n=Vd.exec(t.slice(s,s+3));return n?(e.L=+n[0],s+n[0].length):-1}function Y9t(e,t,s){var n=Vd.exec(t.slice(s,s+6));return n?(e.L=Math.floor(n[0]/1e3),s+n[0].length):-1}function X9t(e,t,s){var n=O9t.exec(t.slice(s,s+1));return n?s+n[0].length:-1}function Q9t(e,t,s){var n=Vd.exec(t.slice(s));return n?(e.Q=+n[0],s+n[0].length):-1}function J9t(e,t,s){var n=Vd.exec(t.slice(s));return n?(e.s=+n[0],s+n[0].length):-1}function N5e(e,t){return _o(e.getDate(),t,2)}function eBt(e,t){return _o(e.getHours(),t,2)}function tBt(e,t){return _o(e.getHours()%12||12,t,2)}function rBt(e,t){return _o(1+DP.count($y(e),e),t,3)}function yUe(e,t){return _o(e.getMilliseconds(),t,3)}function sBt(e,t){return yUe(e,t)+"000"}function nBt(e,t){return _o(e.getMonth()+1,t,2)}function aBt(e,t){return _o(e.getMinutes(),t,2)}function iBt(e,t){return _o(e.getSeconds(),t,2)}function oBt(e){var t=e.getDay();return t===0?7:t}function lBt(e,t){return _o(yie.count($y(e)-1,e),t,2)}function vUe(e){var t=e.getDay();return t>=4||t===0?t3(e):t3.ceil(e)}function cBt(e,t){return e=vUe(e),_o(t3.count($y(e),e)+($y(e).getDay()===4),t,2)}function dBt(e){return e.getDay()}function uBt(e,t){return _o(kse.count($y(e)-1,e),t,2)}function hBt(e,t){return _o(e.getFullYear()%100,t,2)}function mBt(e,t){return e=vUe(e),_o(e.getFullYear()%100,t,2)}function pBt(e,t){return _o(e.getFullYear()%1e4,t,4)}function fBt(e,t){var s=e.getDay();return e=s>=4||s===0?t3(e):t3.ceil(e),_o(e.getFullYear()%1e4,t,4)}function gBt(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+_o(t/60|0,"0",2)+_o(t%60,"0",2)}function S5e(e,t){return _o(e.getUTCDate(),t,2)}function xBt(e,t){return _o(e.getUTCHours(),t,2)}function yBt(e,t){return _o(e.getUTCHours()%12||12,t,2)}function vBt(e,t){return _o(1+xie.count(Uy(e),e),t,3)}function _Ue(e,t){return _o(e.getUTCMilliseconds(),t,3)}function _Bt(e,t){return _Ue(e,t)+"000"}function bBt(e,t){return _o(e.getUTCMonth()+1,t,2)}function wBt(e,t){return _o(e.getUTCMinutes(),t,2)}function jBt(e,t){return _o(e.getUTCSeconds(),t,2)}function kBt(e){var t=e.getUTCDay();return t===0?7:t}function NBt(e,t){return _o(vie.count(Uy(e)-1,e),t,2)}function bUe(e){var t=e.getUTCDay();return t>=4||t===0?r3(e):r3.ceil(e)}function SBt(e,t){return e=bUe(e),_o(r3.count(Uy(e),e)+(Uy(e).getUTCDay()===4),t,2)}function CBt(e){return e.getUTCDay()}function MBt(e,t){return _o(Nse.count(Uy(e)-1,e),t,2)}function TBt(e,t){return _o(e.getUTCFullYear()%100,t,2)}function ABt(e,t){return e=bUe(e),_o(e.getUTCFullYear()%100,t,2)}function EBt(e,t){return _o(e.getUTCFullYear()%1e4,t,4)}function IBt(e,t){var s=e.getUTCDay();return e=s>=4||s===0?r3(e):r3.ceil(e),_o(e.getUTCFullYear()%1e4,t,4)}function PBt(){return"+0000"}function C5e(){return"%"}function M5e(e){return+e}function T5e(e){return Math.floor(+e/1e3)}var B4,wUe,jUe;LBt({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 LBt(e){return B4=L9t(e),wUe=B4.format,B4.parse,jUe=B4.utcFormat,B4.utcParse,B4}function OBt(e){return new Date(e)}function DBt(e){return e instanceof Date?+e:+new Date(+e)}function H1e(e,t,s,n,a,o,l,i,u,m){var x=E1e(),y=x.invert,v=x.domain,b=m(".%L"),N=m(":%S"),k=m("%I:%M"),M=m("%I %p"),E=m("%a %d"),T=m("%b %d"),P=m("%B"),R=m("%Y");function D(U){return(u(U)t(a/(e.length-1)))},s.quantiles=function(n){return Array.from({length:n+1},(a,o)=>N7t(e,o/n))},s.copy=function(){return CUe(t).domain(e)},Ky.apply(s,arguments)}function bie(){var e=0,t=.5,s=1,n=1,a,o,l,i,u,m=eh,x,y=!1,v;function b(k){return isNaN(k=+k)?v:(k=.5+((k=+x(k))-o)*(n*kt}var EUe=qBt,VBt=wie,HBt=EUe,WBt=J3;function GBt(e){return e&&e.length?VBt(e,WBt,HBt):void 0}var KBt=GBt;const jie=no(KBt);function ZBt(e,t){return ee.e^o.s<0?1:-1;for(n=o.d.length,a=e.d.length,t=0,s=ne.d[t]^o.s<0?1:-1;return n===a?0:n>a^o.s<0?1:-1};Tn.decimalPlaces=Tn.dp=function(){var e=this,t=e.d.length-1,s=(t-e.e)*yl;if(t=e.d[t],t)for(;t%10==0;t/=10)s--;return s<0?0:s};Tn.dividedBy=Tn.div=function(e){return jy(this,new this.constructor(e))};Tn.dividedToIntegerBy=Tn.idiv=function(e){var t=this,s=t.constructor;return Zo(jy(t,new s(e),0,1),s.precision)};Tn.equals=Tn.eq=function(e){return!this.cmp(e)};Tn.exponent=function(){return Yc(this)};Tn.greaterThan=Tn.gt=function(e){return this.cmp(e)>0};Tn.greaterThanOrEqualTo=Tn.gte=function(e){return this.cmp(e)>=0};Tn.isInteger=Tn.isint=function(){return this.e>this.d.length-2};Tn.isNegative=Tn.isneg=function(){return this.s<0};Tn.isPositive=Tn.ispos=function(){return this.s>0};Tn.isZero=function(){return this.s===0};Tn.lessThan=Tn.lt=function(e){return this.cmp(e)<0};Tn.lessThanOrEqualTo=Tn.lte=function(e){return this.cmp(e)<1};Tn.logarithm=Tn.log=function(e){var t,s=this,n=s.constructor,a=n.precision,o=a+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(hm))throw Error(wp+"NaN");if(s.s<1)throw Error(wp+(s.s?"NaN":"-Infinity"));return s.eq(hm)?new n(0):(Il=!1,t=jy(yI(s,o),yI(e,o),o),Il=!0,Zo(t,a))};Tn.minus=Tn.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?DUe(t,e):LUe(t,(e.s=-e.s,e))};Tn.modulo=Tn.mod=function(e){var t,s=this,n=s.constructor,a=n.precision;if(e=new n(e),!e.s)throw Error(wp+"NaN");return s.s?(Il=!1,t=jy(s,e,0,1).times(e),Il=!0,s.minus(t)):Zo(new n(s),a)};Tn.naturalExponential=Tn.exp=function(){return OUe(this)};Tn.naturalLogarithm=Tn.ln=function(){return yI(this)};Tn.negated=Tn.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Tn.plus=Tn.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?LUe(t,e):DUe(t,(e.s=-e.s,e))};Tn.precision=Tn.sd=function(e){var t,s,n,a=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(tk+e);if(t=Yc(a)+1,n=a.d.length-1,s=n*yl+1,n=a.d[n],n){for(;n%10==0;n/=10)s--;for(n=a.d[0];n>=10;n/=10)s++}return e&&t>s?t:s};Tn.squareRoot=Tn.sqrt=function(){var e,t,s,n,a,o,l,i=this,u=i.constructor;if(i.s<1){if(!i.s)return new u(0);throw Error(wp+"NaN")}for(e=Yc(i),Il=!1,a=Math.sqrt(+i),a==0||a==1/0?(t=Ig(i.d),(t.length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=s5((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),n=new u(t)):n=new u(a.toString()),s=u.precision,a=l=s+3;;)if(o=n,n=o.plus(jy(i,o,l+2)).times(.5),Ig(o.d).slice(0,l)===(t=Ig(n.d)).slice(0,l)){if(t=t.slice(l-3,l+1),a==l&&t=="4999"){if(Zo(o,s+1,0),o.times(o).eq(i)){n=o;break}}else if(t!="9999")break;l+=4}return Il=!0,Zo(n,s)};Tn.times=Tn.mul=function(e){var t,s,n,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,s=x.e+e.e,u=v.length,m=b.length,u=0;){for(t=0,a=u+n;a>n;)i=o[a]+b[n]*v[a-n-1]+t,o[a--]=i%Ad|0,t=i/Ad|0;o[a]=(o[a]+t)%Ad|0}for(;!o[--l];)o.pop();return t?++s:o.shift(),e.d=o,e.e=s,Il?Zo(e,y.precision):e};Tn.toDecimalPlaces=Tn.todp=function(e,t){var s=this,n=s.constructor;return s=new n(s),e===void 0?s:(nx(e,0,r5),t===void 0?t=n.rounding:nx(t,0,8),Zo(s,e+Yc(s)+1,t))};Tn.toExponential=function(e,t){var s,n=this,a=n.constructor;return e===void 0?s=Nk(n,!0):(nx(e,0,r5),t===void 0?t=a.rounding:nx(t,0,8),n=Zo(new a(n),e+1,t),s=Nk(n,!0,e+1)),s};Tn.toFixed=function(e,t){var s,n,a=this,o=a.constructor;return e===void 0?Nk(a):(nx(e,0,r5),t===void 0?t=o.rounding:nx(t,0,8),n=Zo(new o(a),e+Yc(a)+1,t),s=Nk(n.abs(),!1,e+Yc(n)+1),a.isneg()&&!a.isZero()?"-"+s:s)};Tn.toInteger=Tn.toint=function(){var e=this,t=e.constructor;return Zo(new t(e),Yc(e)+1,t.rounding)};Tn.toNumber=function(){return+this};Tn.toPower=Tn.pow=function(e){var t,s,n,a,o,l,i=this,u=i.constructor,m=12,x=+(e=new u(e));if(!e.s)return new u(hm);if(i=new u(i),!i.s){if(e.s<1)throw Error(wp+"Infinity");return i}if(i.eq(hm))return i;if(n=u.precision,e.eq(hm))return Zo(i,n);if(t=e.e,s=e.d.length-1,l=t>=s,o=i.s,l){if((s=x<0?-x:x)<=PUe){for(a=new u(hm),t=Math.ceil(n/yl+4),Il=!1;s%2&&(a=a.times(i),I5e(a.d,t)),s=s5(s/2),s!==0;)i=i.times(i),I5e(i.d,t);return Il=!0,e.s<0?new u(hm).div(a):Zo(a,n)}}else if(o<0)throw Error(wp+"NaN");return o=o<0&&e.d[Math.max(t,s)]&1?-1:1,i.s=1,Il=!1,a=e.times(yI(i,n+m)),Il=!0,a=OUe(a),a.s=o,a};Tn.toPrecision=function(e,t){var s,n,a=this,o=a.constructor;return e===void 0?(s=Yc(a),n=Nk(a,s<=o.toExpNeg||s>=o.toExpPos)):(nx(e,1,r5),t===void 0?t=o.rounding:nx(t,0,8),a=Zo(new o(a),e,t),s=Yc(a),n=Nk(a,e<=s||s<=o.toExpNeg,e)),n};Tn.toSignificantDigits=Tn.tosd=function(e,t){var s=this,n=s.constructor;return e===void 0?(e=n.precision,t=n.rounding):(nx(e,1,r5),t===void 0?t=n.rounding:nx(t,0,8)),Zo(new n(s),e,t)};Tn.toString=Tn.valueOf=Tn.val=Tn.toJSON=Tn[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Yc(e),s=e.constructor;return Nk(e,t<=s.toExpNeg||t>=s.toExpPos)};function LUe(e,t){var s,n,a,o,l,i,u,m,x=e.constructor,y=x.precision;if(!e.s||!t.s)return t.s||(t=new x(e)),Il?Zo(t,y):t;if(u=e.d,m=t.d,l=e.e,a=t.e,u=u.slice(),o=l-a,o){for(o<0?(n=u,o=-o,i=m.length):(n=m,a=l,i=u.length),l=Math.ceil(y/yl),i=l>i?l+1:i+1,o>i&&(o=i,n.length=1),n.reverse();o--;)n.push(0);n.reverse()}for(i=u.length,o=m.length,i-o<0&&(o=i,n=m,m=u,u=n),s=0;o;)s=(u[--o]=u[o]+m[o]+s)/Ad|0,u[o]%=Ad;for(s&&(u.unshift(s),++a),i=u.length;u[--i]==0;)u.pop();return t.d=u,t.e=a,Il?Zo(t,y):t}function nx(e,t,s){if(e!==~~e||es)throw Error(tk+e)}function Ig(e){var t,s,n,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 s(n,a,o){for(var l=0;o--;)n[o]-=l,l=n[o]1;)n.shift()}return function(n,a,o,l){var i,u,m,x,y,v,b,N,k,M,E,T,P,R,D,U,q,H,G=n.constructor,Q=n.s==a.s?1:-1,ne=n.d,ie=a.d;if(!n.s)return new G(n);if(!a.s)throw Error(wp+"Division by zero");for(u=n.e-a.e,q=ie.length,D=ne.length,b=new G(Q),N=b.d=[],m=0;ie[m]==(ne[m]||0);)++m;if(ie[m]>(ne[m]||0)&&--u,o==null?T=o=G.precision:l?T=o+(Yc(n)-Yc(a))+1:T=o,T<0)return new G(0);if(T=T/yl+2|0,m=0,q==1)for(x=0,ie=ie[0],T++;(m1&&(ie=e(ie,x),ne=e(ne,x),q=ie.length,D=ne.length),R=q,k=ne.slice(0,q),M=k.length;M=Ad/2&&++U;do x=0,i=t(ie,k,q,M),i<0?(E=k[0],q!=M&&(E=E*Ad+(k[1]||0)),x=E/U|0,x>1?(x>=Ad&&(x=Ad-1),y=e(ie,x),v=y.length,M=k.length,i=t(y,k,v,M),i==1&&(x--,s(y,q16)throw Error(K1e+Yc(e));if(!e.s)return new x(hm);for(Il=!1,i=y,l=new x(.03125);e.abs().gte(.1);)e=e.times(l),m+=5;for(n=Math.log(Jw(2,m))/Math.LN10*2+5|0,i+=n,s=a=o=new x(hm),x.precision=i;;){if(a=Zo(a.times(e),i),s=s.times(++u),l=o.plus(jy(a,s,i)),Ig(l.d).slice(0,i)===Ig(o.d).slice(0,i)){for(;m--;)o=Zo(o.times(o),i);return x.precision=y,t==null?(Il=!0,Zo(o,y)):o}o=l}}function Yc(e){for(var t=e.e*yl,s=e.d[0];s>=10;s/=10)t++;return t}function cue(e,t,s){if(t>e.LN10.sd())throw Il=!0,s&&(e.precision=s),Error(wp+"LN10 precision limit exceeded");return Zo(new e(e.LN10),t)}function i1(e){for(var t="";e--;)t+="0";return t}function yI(e,t){var s,n,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(wp+(b.s?"NaN":"-Infinity"));if(b.eq(hm))return new k(0);if(t==null?(Il=!1,m=M):m=t,b.eq(10))return t==null&&(Il=!0),cue(k,m);if(m+=v,k.precision=m,s=Ig(N),n=s.charAt(0),o=Yc(b),Math.abs(o)<15e14){for(;n<7&&n!=1||n==1&&s.charAt(1)>3;)b=b.times(e),s=Ig(b.d),n=s.charAt(0),y++;o=Yc(b),n>1?(b=new k("0."+s),o++):b=new k(n+"."+s.slice(1))}else return u=cue(k,m+2,M).times(o+""),b=yI(new k(n+"."+s.slice(1)),m-v).plus(u),k.precision=M,t==null?(Il=!0,Zo(b,M)):b;for(i=l=b=jy(b.minus(hm),b.plus(hm),m),x=Zo(b.times(b),m),a=3;;){if(l=Zo(l.times(x),m),u=i.plus(jy(l,new k(a),m)),Ig(u.d).slice(0,m)===Ig(i.d).slice(0,m))return i=i.times(2),o!==0&&(i=i.plus(cue(k,m+2,M).times(o+""))),i=jy(i,new k(y),m),k.precision=M,t==null?(Il=!0,Zo(i,M)):i;i=u,a+=2}}function E5e(e,t){var s,n,a;for((s=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(s<0&&(s=n),s+=+t.slice(n+1),t=t.substring(0,n)):s<0&&(s=t.length),n=0;t.charCodeAt(n)===48;)++n;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(n,a),t){if(a-=n,s=s-n-1,e.e=s5(s/yl),e.d=[],n=(s+1)%yl,s<0&&(n+=yl),nSse||e.e<-Sse))throw Error(K1e+s)}else e.s=0,e.e=0,e.d=[0];return e}function Zo(e,t,s){var n,a,o,l,i,u,m,x,y=e.d;for(l=1,o=y[0];o>=10;o/=10)l++;if(n=t-l,n<0)n+=yl,a=t,m=y[x=0];else{if(x=Math.ceil((n+1)/yl),o=y.length,x>=o)return e;for(m=o=y[x],l=1;o>=10;o/=10)l++;n%=yl,a=n-yl+l}if(s!==void 0&&(o=Jw(10,l-a-1),i=m/o%10|0,u=t<0||y[x+1]!==void 0||m%o,u=s<4?(i||u)&&(s==0||s==(e.s<0?3:2)):i>5||i==5&&(s==4||u||s==6&&(n>0?a>0?m/Jw(10,l-a):0:y[x-1])%10&1||s==(e.s<0?8:7))),t<1||!y[0])return u?(o=Yc(e),y.length=1,t=t-o-1,y[0]=Jw(10,(yl-t%yl)%yl),e.e=s5(-t/yl)||0):(y.length=1,y[0]=e.e=e.s=0),e;if(n==0?(y.length=x,o=1,x--):(y.length=x+1,o=Jw(10,yl-n),y[x]=a>0?(m/Jw(10,l-a)%Jw(10,a)|0)*o:0),u)for(;;)if(x==0){(y[0]+=o)==Ad&&(y[0]=1,++e.e);break}else{if(y[x]+=o,y[x]!=Ad)break;y[x--]=0,o=1}for(n=y.length;y[--n]===0;)y.pop();if(Il&&(e.e>Sse||e.e<-Sse))throw Error(K1e+Yc(e));return e}function DUe(e,t){var s,n,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),Il?Zo(t,b):t;if(u=e.d,y=t.d,n=t.e,m=e.e,u=u.slice(),l=m-n,l){for(x=l<0,x?(s=u,l=-l,i=y.length):(s=y,n=m,i=u.length),a=Math.max(Math.ceil(b/yl),i)+2,l>a&&(l=a,s.length=1),s.reverse(),a=l;a--;)s.push(0);s.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(n):l>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(a<0?"e":"e+")+a):a<0?(o="0."+i1(-a-1)+o,s&&(n=s-l)>0&&(o+=i1(n))):a>=l?(o+=i1(a+1-l),s&&(n=s-a-1)>0&&(o=o+"."+i1(n))):((n=a+1)0&&(a+1===l&&(o+="."),o+=i1(n))),e.s<0?"-"+o:o}function I5e(e,t){if(e.length>t)return e.length=t,!0}function RUe(e){var t,s,n;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(tk+o);if(o>0)l.s=1;else if(o<0)o=-o,l.s=-1;else{l.s=0,l.e=0,l.d=[0];return}if(o===~~o&&o<1e7){l.e=0,l.d=[o];return}return E5e(l,o.toString())}else if(typeof o!="string")throw Error(tk+o);if(o.charCodeAt(0)===45?(o=o.slice(1),l.s=-1):l.s=1,g$t.test(o))E5e(l,o);else throw Error(tk+o)}if(a.prototype=Tn,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=RUe,a.config=a.set=x$t,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=a[t+1]&&n<=a[t+2])this[s]=n;else throw Error(tk+s+": "+n);if((n=e[s="LN10"])!==void 0)if(n==Math.LN10)this[s]=new this(n);else throw Error(tk+s+": "+n);return this}var Z1e=RUe(f$t);hm=new Z1e(1);const Ho=Z1e;function y$t(e){return w$t(e)||b$t(e)||_$t(e)||v$t()}function v$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 _$t(e,t){if(e){if(typeof e=="string")return ofe(e,t);var s=Object.prototype.toString.call(e).slice(8,-1);if(s==="Object"&&e.constructor&&(s=e.constructor.name),s==="Map"||s==="Set")return Array.from(e);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return ofe(e,t)}}function b$t(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function w$t(e){if(Array.isArray(e))return ofe(e)}function ofe(e,t){(t==null||t>e.length)&&(t=e.length);for(var s=0,n=new Array(t);s=t?s.apply(void 0,a):e(t-l,P5e(function(){for(var i=arguments.length,u=new Array(i),m=0;me.length)&&(t=e.length);for(var s=0,n=new Array(t);s"u"||!(Symbol.iterator in Object(e)))){var s=[],n=!0,a=!1,o=void 0;try{for(var l=e[Symbol.iterator](),i;!(n=(i=l.next()).done)&&(s.push(i.value),!(t&&s.length===t));n=!0);}catch(u){a=!0,o=u}finally{try{!n&&l.return!=null&&l.return()}finally{if(a)throw o}}return s}}function R$t(e){if(Array.isArray(e))return e}function UUe(e){var t=vI(e,2),s=t[0],n=t[1],a=s,o=n;return s>n&&(a=n,o=s),[a,o]}function qUe(e,t,s){if(e.lte(0))return new Ho(0);var n=Cie.getDigitCount(e.toNumber()),a=new Ho(10).pow(n),o=e.div(a),l=n!==1?.05:.1,i=new Ho(Math.ceil(o.div(l).toNumber())).add(s).mul(l),u=i.mul(a);return t?u:new Ho(Math.ceil(u))}function F$t(e,t,s){var n=1,a=new Ho(e);if(!a.isint()&&s){var o=Math.abs(e);o<1?(n=new Ho(10).pow(Cie.getDigitCount(e)-1),a=new Ho(Math.floor(a.div(n).toNumber())).mul(n)):o>1&&(a=new Ho(Math.floor(e)))}else e===0?a=new Ho(Math.floor((t-1)/2)):s||(a=new Ho(Math.floor(e)));var l=Math.floor((t-1)/2),i=S$t(N$t(function(u){return a.add(new Ho(u-l).mul(n)).toNumber()}),lfe);return i(0,t)}function VUe(e,t,s,n){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(s-1)))return{step:new Ho(0),tickMin:new Ho(0),tickMax:new Ho(0)};var o=qUe(new Ho(t).sub(e).div(s-1),n,a),l;e<=0&&t>=0?l=new Ho(0):(l=new Ho(e).add(t).div(2),l=l.sub(new Ho(l).mod(o)));var i=Math.ceil(l.sub(e).div(o).toNumber()),u=Math.ceil(new Ho(t).sub(l).div(o).toNumber()),m=i+u+1;return m>s?VUe(e,t,s,n,a+1):(m0?u+(s-m):u,i=t>0?i:i+(s-m)),{step:o,tickMin:l.sub(new Ho(i).mul(o)),tickMax:l.add(new Ho(u).mul(o))})}function z$t(e){var t=vI(e,2),s=t[0],n=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=UUe([s,n]),u=vI(i,2),m=u[0],x=u[1];if(m===-1/0||x===1/0){var y=x===1/0?[m].concat(dfe(lfe(0,a-1).map(function(){return 1/0}))):[].concat(dfe(lfe(0,a-1).map(function(){return-1/0})),[x]);return s>n?cfe(y):y}if(m===x)return F$t(m,a,o);var v=VUe(m,x,l,o),b=v.step,N=v.tickMin,k=v.tickMax,M=Cie.rangeStep(N,k.add(new Ho(.1).mul(b)),b);return s>n?cfe(M):M}function B$t(e,t){var s=vI(e,2),n=s[0],a=s[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=UUe([n,a]),i=vI(l,2),u=i[0],m=i[1];if(u===-1/0||m===1/0)return[n,a];if(u===m)return[u];var x=Math.max(t,2),y=qUe(new Ho(m).sub(u).div(x-1),o,0),v=[].concat(dfe(Cie.rangeStep(new Ho(u),new Ho(m).sub(new Ho(.99).mul(y)),y)),[m]);return n>a?cfe(v):v}var $$t=BUe(z$t),U$t=BUe(B$t),q$t="Invariant failed";function Sk(e,t){throw new Error(q$t)}var V$t=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function s3(e){"@babel/helpers - typeof";return s3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s3(e)}function Cse(){return Cse=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var s=0,n=new Array(t);s=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function X$t(e,t){if(e==null)return{};var s={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;s[n]=e[n]}return s}function Q$t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function J$t(e,t){for(var s=0;se.length)&&(t=e.length);for(var s=0,n=new Array(t);s1&&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=(s=n==null?void 0:n.length)!==null&&s!==void 0?s: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(Qu(y-x)!==Qu(v-y)){var N=[];if(Qu(v-y)===Qu(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 E=[Math.min(y,(b+y)/2),Math.max(y,(b+y)/2)];if(t>E[0]&&t<=E[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 R=0;R0&&R(n[R].coordinate+n[R-1].coordinate)/2&&t<=(n[R].coordinate+n[R+1].coordinate)/2||R===i-1&&t>(n[R].coordinate+n[R-1].coordinate)/2){l=n[R].index;break}return l},Y1e=function(t){var s,n=t,a=n.type.displayName,o=(s=t.type)!==null&&s!==void 0&&s.defaultProps?ec(ec({},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},gUt=function(t){var s=t.barSize,n=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(E&&E.length){var T=E[0].type.defaultProps,P=T!==void 0?ec(ec({},T),E[0].props):E[0].props,R=P.barSize,D=P[M];l[D]||(l[D]=[]);var U=Ii(R)?s:R;l[D].push({item:E[0],stackList:E.slice(1),barSize:Ii(U)?void 0:Ju(U,n,0)})}}return l},xUt=function(t){var s=t.barGap,n=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=Ju(s,a,0,!0),x,y=[];if(l[0].barSize===+l[0].barSize){var v=!1,b=a/u,N=l.reduce(function(R,D){return R+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(R,D){var U={item:D.item,position:{offset:M.offset+M.size+m,size:v?b:D.barSize}},q=[].concat(D5e(R),[U]);return M=q[q.length-1].position,D.stackList&&D.stackList.length&&D.stackList.forEach(function(H){q.push({item:H,position:M})}),q},y)}else{var E=Ju(n,a,0,!0);a-2*E-(u-1)*m<=0&&(m=0);var T=(a-2*E-(u-1)*m)/u;T>1&&(T>>=0);var P=i===+i?Math.min(T,i):T;x=l.reduce(function(R,D,U){var q=[].concat(D5e(R),[{item:D.item,position:{offset:E+(T+m)*U+(T-P)/2,size:P}}]);return D.stackList&&D.stackList.length&&D.stackList.forEach(function(H){q.push({item:H,position:q[q.length-1].position})}),q},y)}return x},yUt=function(t,s,n,a){var o=n.children,l=n.width,i=n.margin,u=l-(i.left||0)-(i.right||0),m=KUe({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"&&Fs(t[b]))return ec(ec({},t),{},cC({},b,t[b]+(y||0)));if((k==="horizontal"||k==="vertical"&&b==="center")&&N!=="middle"&&Fs(t[N]))return ec(ec({},t),{},cC({},N,t[N]+(v||0)))}return t},vUt=function(t,s,n){return Ii(s)?!0:t==="horizontal"?s==="yAxis":t==="vertical"||n==="x"?s==="xAxis":n==="y"?s==="yAxis":!0},ZUe=function(t,s,n,a,o){var l=s.props.children,i=vp(l,Mie).filter(function(m){return vUt(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,n);if(Ii(y))return m;var v=Array.isArray(y)?[kie(y),jie(y)]:[y,y],b=u.reduce(function(N,k){var M=vu(x,k,0),E=v[0]-Math.abs(Array.isArray(M)?M[0]:M),T=v[1]+Math.abs(Array.isArray(M)?M[1]:M);return[Math.min(E,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},_Ut=function(t,s,n,a,o){var l=s.map(function(i){return ZUe(t,i,n,o,a)}).filter(function(i){return!Ii(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},YUe=function(t,s,n,a,o){var l=s.map(function(u){var m=u.props.dataKey;return n==="number"&&m&&ZUe(t,u,m,a)||iE(t,m,n,o)});if(n==="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?Qu(i[0]-i[1])*2*m:m,s&&(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!AP(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&&!n?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}})},due=new WeakMap,qO=function(t,s){if(typeof s!="function")return t;due.has(t)||due.set(t,new WeakMap);var n=due.get(t);if(n.has(s))return n.get(s);var a=function(){t.apply(void 0,arguments),s.apply(void 0,arguments)};return n.set(s,a),a},JUe=function(t,s,n){var a=t.scale,o=t.type,l=t.layout,i=t.axisType;if(a==="auto")return l==="radial"&&i==="radiusAxis"?{scale:mI(),realScaleType:"band"}:l==="radial"&&i==="angleAxis"?{scale:wse(),realScaleType:"linear"}:o==="category"&&s&&(s.indexOf("LineChart")>=0||s.indexOf("AreaChart")>=0||s.indexOf("ComposedChart")>=0&&!n)?{scale:aE(),realScaleType:"point"}:o==="category"?{scale:mI(),realScaleType:"band"}:{scale:wse(),realScaleType:"linear"};if(wk(a)){var u="scale".concat(lie(a));return{scale:(A5e[u]||aE)(),realScaleType:A5e[u]?u:"point"}}return Xa(a)?{scale:a}:{scale:aE(),realScaleType:"point"}},F5e=1e-4,eqe=function(t){var s=t.domain();if(!(!s||s.length<=2)){var n=s.length,a=t.range(),o=Math.min(a[0],a[1])-F5e,l=Math.max(a[0],a[1])+F5e,i=t(s[0]),u=t(s[n-1]);(il||ul)&&t.domain([s[0],s[n-1]])}},bUt=function(t,s){if(!t)return null;for(var n=0,a=t.length;na)&&(o[1]=a),o[0]>a&&(o[0]=a),o[1]=0?(t[i][n][0]=o,t[i][n][1]=o+u,o=t[i][n][1]):(t[i][n][0]=l,t[i][n][1]=l+u,l=t[i][n][1])}},kUt=function(t){var s=t.length;if(!(s<=0))for(var n=0,a=t[0].length;n=0?(t[l][n][0]=o,t[l][n][1]=o+i,o=t[l][n][1]):(t[l][n][0]=0,t[l][n][1]=0)}},NUt={sign:jUt,expand:VIt,none:ZC,silhouette:HIt,wiggle:WIt,positive:kUt},SUt=function(t,s,n){var a=s.map(function(i){return i.props.dataKey}),o=NUt[n],l=qIt().keys(a).value(function(i,u){return+vu(i,u,0)}).order(Rpe).offset(o);return l(t)},CUt=function(t,s,n,a,o,l){if(!t)return null;var i=l?s.reverse():s,u={},m=i.reduce(function(y,v){var b,N=(b=v.type)!==null&&b!==void 0&&b.defaultProps?ec(ec({},v.type.defaultProps),v.props):v.props,k=N.stackId,M=N.hide;if(M)return y;var E=N[n],T=y[E]||{hasStack:!1,stackGroups:{}};if(fd(k)){var P=T.stackGroups[k]||{numericAxisId:n,cateAxisId:a,items:[]};P.items.push(v),T.hasStack=!0,T.stackGroups[k]=P}else T.stackGroups[EP("_stackId_")]={numericAxisId:n,cateAxisId:a,items:[v]};return ec(ec({},y),{},cC({},E,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 E=b.stackGroups[M];return ec(ec({},k),{},cC({},M,{numericAxisId:n,cateAxisId:a,items:E.items,stackedData:SUt(t,E.items,o)}))},N)}return ec(ec({},y),{},cC({},v,b))},x)},tqe=function(t,s){var n=s.realScaleType,a=s.type,o=s.tickCount,l=s.originalDomain,i=s.allowDecimals,u=n||s.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=$$t(m,o,i);return t.domain([kie(x),jie(x)]),{niceTicks:x}}if(o&&a==="number"){var y=t.domain(),v=U$t(y,o,i);return{niceTicks:v}}return null},z5e=function(t){var s=t.axis,n=t.ticks,a=t.offset,o=t.bandSize,l=t.entry,i=t.index;if(s.type==="category")return n[i]?n[i].coordinate+a:null;var u=vu(l,s.dataKey,s.domain[i]);return Ii(u)?null:s.scale(u)-o/2+a},MUt=function(t){var s=t.numericAxis,n=s.scale.domain();if(s.type==="number"){var a=Math.min(n[0],n[1]),o=Math.max(n[0],n[1]);return a<=0&&o>=0?0:o<0?o:a}return n[0]},TUt=function(t,s){var n,a=(n=t.type)!==null&&n!==void 0&&n.defaultProps?ec(ec({},t.type.defaultProps),t.props):t.props,o=a.stackId;if(fd(o)){var l=s[o];if(l){var i=l.items.indexOf(t);return i>=0?l.stackedData[i]:null}}return null},AUt=function(t){return t.reduce(function(s,n){return[kie(n.concat([s[0]]).filter(Fs)),jie(n.concat([s[1]]).filter(Fs))]},[1/0,-1/0])},rqe=function(t,s,n){return Object.keys(t).reduce(function(a,o){var l=t[o],i=l.stackedData,u=i.reduce(function(m,x){var y=AUt(x.slice(s,n+1));return[Math.min(m[0],y[0]),Math.max(m[1],y[1])]},[1/0,-1/0]);return[Math.min(u[0],a[0]),Math.max(u[1],a[1])]},[1/0,-1/0]).map(function(a){return a===1/0||a===-1/0?0:a})},B5e=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,$5e=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,pfe=function(t,s,n){if(Xa(t))return t(s,n);if(!Array.isArray(t))return s;var a=[];if(Fs(t[0]))a[0]=n?t[0]:Math.min(t[0],s[0]);else if(B5e.test(t[0])){var o=+B5e.exec(t[0])[1];a[0]=s[0]-o}else Xa(t[0])?a[0]=t[0](s[0]):a[0]=s[0];if(Fs(t[1]))a[1]=n?t[1]:Math.max(t[1],s[1]);else if($5e.test(t[1])){var l=+$5e.exec(t[1])[1];a[1]=s[1]+l}else Xa(t[1])?a[1]=t[1](s[1]):a[1]=s[1];return a},Tse=function(t,s,n){if(t&&t.scale&&t.scale.bandwidth){var a=t.scale.bandwidth();if(!n||a>0)return a}if(t&&s&&s.length>=2){for(var o=k1e(s,function(y){return y.coordinate}),l=1/0,i=1,u=o.length;ie.length)&&(t=e.length);for(var s=0,n=new Array(t);s2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(n.left||0)-(n.right||0)),Math.abs(s-(n.top||0)-(n.bottom||0)))/2},zUt=function(t,s,n,a,o){var l=t.width,i=t.height,u=t.startAngle,m=t.endAngle,x=Ju(t.cx,l,l/2),y=Ju(t.cy,i,i/2),v=aqe(l,i,n),b=Ju(t.innerRadius,v,0),N=Ju(t.outerRadius,v,v*.8),k=Object.keys(s);return k.reduce(function(M,E){var T=s[E],P=T.domain,R=T.reversed,D;if(Ii(T.range))a==="angleAxis"?D=[u,m]:a==="radiusAxis"&&(D=[b,N]),R&&(D=[D[1],D[0]]);else{D=T.range;var U=D,q=PUt(U,2);u=q[0],m=q[1]}var H=JUe(T,o),G=H.realScaleType,Q=H.scale;Q.domain(P).range(D),eqe(Q);var ne=tqe(Q,Gx(Gx({},T),{},{realScaleType:G})),ie=Gx(Gx(Gx({},T),ne),{},{range:D,radius:N,realScaleType:G,scale:Q,cx:x,cy:y,innerRadius:b,outerRadius:N,startAngle:u,endAngle:m});return Gx(Gx({},M),{},nqe({},E,ie))},{})},BUt=function(t,s){var n=t.x,a=t.y,o=s.x,l=s.y;return Math.sqrt(Math.pow(n-o,2)+Math.pow(a-l,2))},$Ut=function(t,s){var n=t.x,a=t.y,o=s.cx,l=s.cy,i=BUt({x:n,y:a},{x:o,y:l});if(i<=0)return{radius:i};var u=(n-o)/i,m=Math.acos(u);return a>l&&(m=2*Math.PI-m),{radius:i,angle:FUt(m),angleInRadian:m}},UUt=function(t){var s=t.startAngle,n=t.endAngle,a=Math.floor(s/360),o=Math.floor(n/360),l=Math.min(a,o);return{startAngle:s-l*360,endAngle:n-l*360}},qUt=function(t,s){var n=s.startAngle,a=s.endAngle,o=Math.floor(n/360),l=Math.floor(a/360),i=Math.min(o,l);return t+i*360},H5e=function(t,s){var n=t.x,a=t.y,o=$Ut({x:n,y:a},s),l=o.radius,i=o.angle,u=s.innerRadius,m=s.outerRadius;if(lm)return!1;if(l===0)return!0;var x=UUt(s),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?Gx(Gx({},s),{},{radius:l,angle:qUt(b,s)}):null},iqe=function(t){return!A.isValidElement(t)&&!Xa(t)&&typeof t!="boolean"?t.className:""};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)}var VUt=["offset"];function HUt(e){return ZUt(e)||KUt(e)||GUt(e)||WUt()}function WUt(){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 GUt(e,t){if(e){if(typeof e=="string")return ffe(e,t);var s=Object.prototype.toString.call(e).slice(8,-1);if(s==="Object"&&e.constructor&&(s=e.constructor.name),s==="Map"||s==="Set")return Array.from(e);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return ffe(e,t)}}function KUt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ZUt(e){if(Array.isArray(e))return ffe(e)}function ffe(e,t){(t==null||t>e.length)&&(t=e.length);for(var s=0,n=new Array(t);s=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function XUt(e,t){if(e==null)return{};var s={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;s[n]=e[n]}return s}function W5e(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),s.push.apply(s,n)}return s}function td(e){for(var t=1;t=0?1:-1,P,R;a==="insideStart"?(P=b+T*l,R=k):a==="insideEnd"?(P=N-T*l,R=!k):a==="end"&&(P=N+T*l,R=k),R=E<=0?R:!R;var D=ll(m,x,M,P),U=ll(m,x,M,P+(R?1:-1)*359),q="M".concat(D.x,",").concat(D.y,` A`).concat(M,",").concat(M,",0,1,").concat(R?0:1,`, `).concat(U.x,",").concat(U.y),H=Ii(t.id)?EP("recharts-radial-line-"):t.id;return ut.createElement("text",kI({},n,{dominantBaseline:"central",className:mi("recharts-radial-bar-label",i)}),ut.createElement("defs",null,ut.createElement("path",{id:H,d:q})),ut.createElement("textPath",{xlinkHref:"#".concat(H)},s))},nqt=function(t){var s=t.viewBox,n=t.offset,a=t.position,o=s,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=ll(l,i,m+n,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,E=ll(l,i,M,v),T=E.x,P=E.y;return{x:T,y:P,textAnchor:"middle",verticalAnchor:"middle"}},aqt=function(t){var s=t.viewBox,n=t.parentViewBox,a=t.offset,o=t.position,l=s,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,E=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),n?{height:Math.max(u-n.y,0),width:m}:{})}if(o==="bottom"){var R={x:i+m/2,y:u+x+v,textAnchor:"middle",verticalAnchor:N};return td(td({},R),n?{height:Math.max(n.y+n.height-(u+x),0),width:m}:{})}if(o==="left"){var D={x:i-M,y:u+x/2,textAnchor:E,verticalAnchor:"middle"};return td(td({},D),n?{width:Math.max(D.x-n.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),n?{width:Math.max(n.x+n.width-U.x,0),height:x}:{})}var q=n?{width:m,height:x}:{};return o==="insideLeft"?td({x:i+M,y:u+x/2,textAnchor:T,verticalAnchor:"middle"},q):o==="insideRight"?td({x:i+m-M,y:u+x/2,textAnchor:E,verticalAnchor:"middle"},q):o==="insideTop"?td({x:i+m/2,y:u+v,textAnchor:"middle",verticalAnchor:N},q):o==="insideBottom"?td({x:i+m/2,y:u+x-v,textAnchor:"middle",verticalAnchor:b},q):o==="insideTopLeft"?td({x:i+M,y:u+v,textAnchor:T,verticalAnchor:N},q):o==="insideTopRight"?td({x:i+m-M,y:u+v,textAnchor:E,verticalAnchor:N},q):o==="insideBottomLeft"?td({x:i+M,y:u+x-v,textAnchor:T,verticalAnchor:b},q):o==="insideBottomRight"?td({x:i+m-M,y:u+x-v,textAnchor:E,verticalAnchor:b},q):G3(o)&&(Fs(o.x)||fj(o.x))&&(Fs(o.y)||fj(o.y))?td({x:i+Ju(o.x,m),y:u+Ju(o.y,x),textAnchor:"end",verticalAnchor:"end"},q):td({x:i+m/2,y:u+x/2,textAnchor:"middle",verticalAnchor:"middle"},q)},iqt=function(t){return"cx"in t&&Fs(t.cx)};function Od(e){var t=e.offset,s=t===void 0?5:t,n=YUt(e,VUt),a=td({offset:s},n),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||Ii(i)&&Ii(u)&&!A.isValidElement(m)&&!Xa(m))return null;if(A.isValidElement(m))return A.cloneElement(m,a);var b;if(Xa(m)){if(b=A.createElement(m,a),A.isValidElement(b))return b}else b=tqt(a);var N=iqt(o),k=qa(a,!0);if(N&&(l==="insideStart"||l==="insideEnd"||l==="end"))return sqt(a,b,k);var M=N?nqt(a):aqt(a);return ut.createElement(kk,kI({className:mi("recharts-label",y)},k,M,{breakAll:v}),b)}Od.displayName="Label";var oqe=function(t){var s=t.cx,n=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,E=t.clockWise,T=t.labelViewBox;if(T)return T;if(Fs(k)&&Fs(M)){if(Fs(y)&&Fs(v))return{x:y,y:v,width:k,height:M};if(Fs(b)&&Fs(N))return{x:b,y:N,width:k,height:M}}return Fs(y)&&Fs(v)?{x:y,y:v,width:0,height:0}:Fs(s)&&Fs(n)?{cx:s,cy:n,startAngle:o||a||0,endAngle:l||a||0,innerRadius:m||0,outerRadius:x||u||i||0,clockWise:E}:t.viewBox?t.viewBox:{}},oqt=function(t,s){return t?t===!0?ut.createElement(Od,{key:"label-implicit",viewBox:s}):fd(t)?ut.createElement(Od,{key:"label-implicit",viewBox:s,value:t}):A.isValidElement(t)?t.type===Od?A.cloneElement(t,{key:"label-implicit",viewBox:s}):ut.createElement(Od,{key:"label-implicit",content:t,viewBox:s}):Xa(t)?ut.createElement(Od,{key:"label-implicit",content:t,viewBox:s}):G3(t)?ut.createElement(Od,kI({viewBox:s},t,{key:"label-implicit"})):null:null},lqt=function(t,s){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var a=t.children,o=oqe(t),l=vp(a,Od).map(function(u,m){return A.cloneElement(u,{viewBox:s||o,key:"label-".concat(m)})});if(!n)return l;var i=oqt(t.label,s||o);return[i].concat(HUt(l))};Od.parseViewBox=oqe;Od.renderCallByParent=lqt;function cqt(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var dqt=cqt;const uqt=no(dqt);function NI(e){"@babel/helpers - typeof";return NI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},NI(e)}var hqt=["valueAccessor"],mqt=["data","dataKey","clockWise","id","textBreakAll"];function pqt(e){return yqt(e)||xqt(e)||gqt(e)||fqt()}function fqt(){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 gqt(e,t){if(e){if(typeof e=="string")return gfe(e,t);var s=Object.prototype.toString.call(e).slice(8,-1);if(s==="Object"&&e.constructor&&(s=e.constructor.name),s==="Map"||s==="Set")return Array.from(e);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return gfe(e,t)}}function xqt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function yqt(e){if(Array.isArray(e))return gfe(e)}function gfe(e,t){(t==null||t>e.length)&&(t=e.length);for(var s=0,n=new Array(t);s=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function wqt(e,t){if(e==null)return{};var s={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;s[n]=e[n]}return s}var jqt=function(t){return Array.isArray(t.value)?uqt(t.value):t.value};function dv(e){var t=e.valueAccessor,s=t===void 0?jqt:t,n=Z5e(e,hqt),a=n.data,o=n.dataKey,l=n.clockWise,i=n.id,u=n.textBreakAll,m=Z5e(n,mqt);return!a||!a.length?null:ut.createElement(Ro,{className:"recharts-label-list"},a.map(function(x,y){var v=Ii(o)?s(x,y):vu(x&&x.payload,o),b=Ii(i)?{}:{id:"".concat(i,"-").concat(y)};return ut.createElement(Od,Ese({},qa(x,!0),m,b,{parentViewBox:x.parentViewBox,value:v,textBreakAll:u,viewBox:Od.parseViewBox(Ii(l)?x:K5e(K5e({},x),{},{clockWise:l})),key:"label-".concat(y),index:y}))}))}dv.displayName="LabelList";function kqt(e,t){return e?e===!0?ut.createElement(dv,{key:"labelList-implicit",data:t}):ut.isValidElement(e)||Xa(e)?ut.createElement(dv,{key:"labelList-implicit",data:t,content:e}):G3(e)?ut.createElement(dv,Ese({data:t},e,{key:"labelList-implicit"})):null:null}function Nqt(e,t){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&s&&!e.label)return null;var n=e.children,a=vp(n,dv).map(function(l,i){return A.cloneElement(l,{data:t,key:"labelList-".concat(i)})});if(!s)return a;var o=kqt(e.label,t);return[o].concat(pqt(a))}dv.renderCallByParent=Nqt;function SI(e){"@babel/helpers - typeof";return SI=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},SI(e)}function xfe(){return xfe=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=ll(s,n,a,l),N=ll(s,n,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(s,",").concat(n," Z");return v},Aqt=function(t){var s=t.cx,n=t.cy,a=t.innerRadius,o=t.outerRadius,l=t.cornerRadius,i=t.forceCornerRadius,u=t.cornerIsExternal,m=t.startAngle,x=t.endAngle,y=Qu(x-m),v=VO({cx:s,cy:n,radius:o,angle:m,sign:y,cornerRadius:l,cornerIsExternal:u}),b=v.circleTangency,N=v.lineTangency,k=v.theta,M=VO({cx:s,cy:n,radius:o,angle:x,sign:-y,cornerRadius:l,cornerIsExternal:u}),E=M.circleTangency,T=M.lineTangency,P=M.theta,R=u?Math.abs(m-x):Math.abs(m-x)-k-P;if(R<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 `):lqe({cx:s,cy:n,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(+(R>180),",").concat(+(y<0),",").concat(E.x,",").concat(E.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(T.x,",").concat(T.y,` `);if(a>0){var U=VO({cx:s,cy:n,radius:a,angle:m,sign:y,isExternal:!0,cornerRadius:l,cornerIsExternal:u}),q=U.circleTangency,H=U.lineTangency,G=U.theta,Q=VO({cx:s,cy:n,radius:a,angle:x,sign:-y,isExternal:!0,cornerRadius:l,cornerIsExternal:u}),ne=Q.circleTangency,ie=Q.lineTangency,he=Q.theta,se=u?Math.abs(m-x):Math.abs(m-x)-G-he;if(se<0&&l===0)return"".concat(D,"L").concat(s,",").concat(n,"Z");D+="L".concat(ie.x,",").concat(ie.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(ne.x,",").concat(ne.y,` A`).concat(a,",").concat(a,",0,").concat(+(se>180),",").concat(+(y>0),",").concat(q.x,",").concat(q.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(H.x,",").concat(H.y,"Z")}else D+="L".concat(s,",").concat(n,"Z");return D},Eqt={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},cqe=function(t){var s=X5e(X5e({},Eqt),t),n=s.cx,a=s.cy,o=s.innerRadius,l=s.outerRadius,i=s.cornerRadius,u=s.forceCornerRadius,m=s.cornerIsExternal,x=s.startAngle,y=s.endAngle,v=s.className;if(l0&&Math.abs(x-y)<360?M=Aqt({cx:n,cy:a,innerRadius:o,outerRadius:l,cornerRadius:Math.min(k,N/2),forceCornerRadius:u,cornerIsExternal:m,startAngle:x,endAngle:y}):M=lqe({cx:n,cy:a,innerRadius:o,outerRadius:l,startAngle:x,endAngle:y}),ut.createElement("path",xfe({},qa(s,!0),{className:b,d:M,role:"img"}))};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 yfe(){return yfe=Object.assign?Object.assign.bind():function(e){for(var t=1;t0;)if(!s.equals(e[n],t[n],n,n,e,t,s))return!1;return!0}function Yqt(e,t){return zk(e.getTime(),t.getTime())}function Xqt(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Qqt(e,t){return e===t}function aMe(e,t,s){var n=e.size;if(n!==t.size)return!1;if(!n)return!0;for(var a=new Array(n),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(s.equals(v[0],b[0],u,y,e,t,s)&&s.equals(v[1],b[1],v[0],b[0],e,t,s)){x=a[y]=!0;break}y++}if(!x)return!1;u++}return!0}var Jqt=zk;function eVt(e,t,s){var n=nMe(e),a=n.length;if(nMe(t).length!==a)return!1;for(;a-- >0;)if(!mqe(e,t,s,n[a]))return!1;return!0}function TT(e,t,s){var n=rMe(e),a=n.length;if(rMe(t).length!==a)return!1;for(var o,l,i;a-- >0;)if(o=n[a],!mqe(e,t,s,o)||(l=sMe(e,o),i=sMe(t,o),(l||i)&&(!l||!i||l.configurable!==i.configurable||l.enumerable!==i.enumerable||l.writable!==i.writable)))return!1;return!0}function tVt(e,t){return zk(e.valueOf(),t.valueOf())}function rVt(e,t){return e.source===t.source&&e.flags===t.flags}function iMe(e,t,s){var n=e.size;if(n!==t.size)return!1;if(!n)return!0;for(var a=new Array(n),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]&&s.equals(l.value,i.value,l.value,i.value,e,t,s)){m=a[x]=!0;break}x++}if(!m)return!1}return!0}function sVt(e,t){var s=e.length;if(t.length!==s)return!1;for(;s-- >0;)if(e[s]!==t[s])return!1;return!0}function nVt(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 mqe(e,t,s,n){return(n===Kqt||n===Gqt||n===Wqt)&&(e.$$typeof||t.$$typeof)?!0:Hqt(t,n)&&s.equals(e[n],t[n],n,n,e,t,s)}var aVt="[object Arguments]",iVt="[object Boolean]",oVt="[object Date]",lVt="[object Error]",cVt="[object Map]",dVt="[object Number]",uVt="[object Object]",hVt="[object RegExp]",mVt="[object Set]",pVt="[object String]",fVt="[object URL]",gVt=Array.isArray,oMe=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,lMe=Object.assign,xVt=Object.prototype.toString.call.bind(Object.prototype.toString);function yVt(e){var t=e.areArraysEqual,s=e.areDatesEqual,n=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 E=typeof N;if(E!==typeof k)return!1;if(E!=="object")return E==="number"?l(N,k,M):E==="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(gVt(N))return t(N,k,M);if(oMe!=null&&oMe(N))return y(N,k,M);if(T===Date)return s(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=xVt(N);return P===oVt?s(N,k,M):P===hVt?m(N,k,M):P===cVt?o(N,k,M):P===mVt?x(N,k,M):P===uVt?typeof N.then!="function"&&typeof k.then!="function"&&i(N,k,M):P===fVt?v(N,k,M):P===lVt?n(N,k,M):P===aVt?i(N,k,M):P===iVt||P===dVt||P===pVt?u(N,k,M):!1}}function vVt(e){var t=e.circular,s=e.createCustomConfig,n=e.strict,a={areArraysEqual:n?TT:Zqt,areDatesEqual:Yqt,areErrorsEqual:Xqt,areFunctionsEqual:Qqt,areMapsEqual:n?tMe(aMe,TT):aMe,areNumbersEqual:Jqt,areObjectsEqual:n?TT:eVt,arePrimitiveWrappersEqual:tVt,areRegExpsEqual:rVt,areSetsEqual:n?tMe(iMe,TT):iMe,areTypedArraysEqual:n?TT:sVt,areUrlsEqual:nVt};if(s&&(a=lMe({},a,s(a))),t){var o=WO(a.areArraysEqual),l=WO(a.areMapsEqual),i=WO(a.areObjectsEqual),u=WO(a.areSetsEqual);a=lMe({},a,{areArraysEqual:o,areMapsEqual:l,areObjectsEqual:i,areSetsEqual:u})}return a}function _Vt(e){return function(t,s,n,a,o,l,i){return e(t,s,i)}}function bVt(e){var t=e.circular,s=e.comparator,n=e.createState,a=e.equals,o=e.strict;if(n)return function(u,m){var x=n(),y=x.cache,v=y===void 0?t?new WeakMap:void 0:y,b=x.meta;return s(u,m,{cache:v,equals:a,meta:b,strict:o})};if(t)return function(u,m){return s(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 s(u,m,l)}}var wVt=zv();zv({strict:!0});zv({circular:!0});zv({circular:!0,strict:!0});zv({createInternalComparator:function(){return zk}});zv({strict:!0,createInternalComparator:function(){return zk}});zv({circular:!0,createInternalComparator:function(){return zk}});zv({circular:!0,createInternalComparator:function(){return zk},strict:!0});function zv(e){e===void 0&&(e={});var t=e.circular,s=t===void 0?!1:t,n=e.createInternalComparator,a=e.createState,o=e.strict,l=o===void 0?!1:o,i=vVt(e),u=yVt(i),m=n?n(u):_Vt(u);return bVt({circular:s,comparator:u,createState:a,equals:m,strict:l})}function jVt(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function cMe(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=-1,n=function a(o){s<0&&(s=o),o-s>t?(e(o),s=-1):jVt(a)};requestAnimationFrame(n)}function _fe(e){"@babel/helpers - typeof";return _fe=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},_fe(e)}function kVt(e){return MVt(e)||CVt(e)||SVt(e)||NVt()}function NVt(){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 SVt(e,t){if(e){if(typeof e=="string")return dMe(e,t);var s=Object.prototype.toString.call(e).slice(8,-1);if(s==="Object"&&e.constructor&&(s=e.constructor.name),s==="Map"||s==="Set")return Array.from(e);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return dMe(e,t)}}function dMe(e,t){(t==null||t>e.length)&&(t=e.length);for(var s=0,n=new Array(t);se.length)&&(t=e.length);for(var s=0,n=new Array(t);s1?1:E<0?0:E},k=function(E){for(var T=E>1?1:E,P=T,R=0;R<8;++R){var D=y(P)-T,U=b(P);if(Math.abs(D-T)0&&arguments[0]!==void 0?arguments[0]:{},s=t.stiff,n=s===void 0?100:s,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)*n,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 s=0,n=new Array(t);s=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function aHt(e,t){if(e==null)return{};var s={},n=Object.keys(e),a,o;for(o=0;o=0)&&(s[a]=e[a]);return s}function uue(e){return cHt(e)||lHt(e)||oHt(e)||iHt()}function iHt(){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 oHt(e,t){if(e){if(typeof e=="string")return Nfe(e,t);var s=Object.prototype.toString.call(e).slice(8,-1);if(s==="Object"&&e.constructor&&(s=e.constructor.name),s==="Map"||s==="Set")return Array.from(e);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return Nfe(e,t)}}function lHt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function cHt(e){if(Array.isArray(e))return Nfe(e)}function Nfe(e,t){(t==null||t>e.length)&&(t=e.length);for(var s=0,n=new Array(t);s"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 Lse(e){return Lse=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(s){return s.__proto__||Object.getPrototypeOf(s)},Lse(e)}var qy=function(e){pHt(s,e);var t=fHt(s);function s(n,a){var o;dHt(this,s),o=t.call(this,n,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(Mfe(o)),o.changeStyle=o.changeStyle.bind(Mfe(o)),!i||b<=0)return o.state={style:{}},typeof v=="function"&&(o.state={style:x}),Cfe(o);if(y&&y.length)o.state={style:y[0].style};else if(m){if(typeof v=="function")return o.state={style:m},Cfe(o);o.state={style:u?WT({},u,m):m}}else o.state={style:{}};return o}return hHt(s,[{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?WT({},u,x):x};this.state&&v&&(u&&v[u]!==x||!u&&v!==x)&&this.setState(b);return}if(!(wVt(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?WT({},u,k):k};(u&&v[u]!==k||!u&&v!==k)&&this.setState(M)}this.runAnimation(rf(rf({},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=rHt(l,i,HVt(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,E){if(E===0)return k;var T=M.duration,P=M.easing,R=P===void 0?"ease":P,D=M.style,U=M.properties,q=M.onAnimationEnd,H=E>0?l[E-1]:M,G=U||Object.keys(D);if(typeof R=="function"||R==="spring")return[].concat(uue(k),[o.runJSAnimation.bind(o,{from:H.style,to:D,duration:T,easing:R}),T]);var Q=mMe(G,T,R),ne=rf(rf(rf({},H.style),D),{},{transition:Q});return[].concat(uue(k),[ne,T,q]).filter(PVt)};return this.manager.start([u].concat(uue(l.reduce(b,[x,Math.max(v,i)])),[a.onAnimationEnd]))}},{key:"runAnimation",value:function(a){this.manager||(this.manager=TVt());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?WT({},i,u):u,M=mMe(Object.keys(k),l,m);N.start([x,o,rf(rf({},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=nHt(a,sHt),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,E=N.className,T=A.cloneElement(b,rf(rf({},u),{},{style:rf(rf({},M),x),className:E}));return T};return m===1?y(A.Children.only(o)):ut.createElement("div",null,A.Children.map(o,function(v){return y(v)}))}}]),s}(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:Co.oneOfType([Co.object,Co.string]),to:Co.oneOfType([Co.object,Co.string]),attributeName:Co.string,duration:Co.number,begin:Co.number,easing:Co.oneOfType([Co.string,Co.func]),steps:Co.arrayOf(Co.shape({duration:Co.number.isRequired,style:Co.object.isRequired,easing:Co.oneOfType([Co.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),Co.func]),properties:Co.arrayOf("string"),onAnimationEnd:Co.func})),children:Co.oneOfType([Co.node,Co.func]),isActive:Co.bool,canBegin:Co.bool,onAnimationEnd:Co.func,shouldReAnimate:Co.bool,onAnimationStart:Co.func,onAnimationReStart:Co.func};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 Ose(){return Ose=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var s=0,n=new Array(t);s=0?1:-1,u=n>=0?1:-1,m=a>=0&&n>=0||a<0&&n<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(s+i*y[0]),y[0]>0&&(x+="A ".concat(y[0],",").concat(y[0],",0,0,").concat(m,",").concat(t+u*y[0],",").concat(s)),x+="L ".concat(t+n-u*y[1],",").concat(s),y[1]>0&&(x+="A ".concat(y[1],",").concat(y[1],",0,0,").concat(m,`, `).concat(t+n,",").concat(s+i*y[1])),x+="L ".concat(t+n,",").concat(s+a-i*y[2]),y[2]>0&&(x+="A ".concat(y[2],",").concat(y[2],",0,0,").concat(m,`, `).concat(t+n-u*y[2],",").concat(s+a)),x+="L ".concat(t+u*y[3],",").concat(s+a),y[3]>0&&(x+="A ".concat(y[3],",").concat(y[3],",0,0,").concat(m,`, `).concat(t,",").concat(s+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(s+i*N,` A `).concat(N,",").concat(N,",0,0,").concat(m,",").concat(t+u*N,",").concat(s,` L `).concat(t+n-u*N,",").concat(s,` A `).concat(N,",").concat(N,",0,0,").concat(m,",").concat(t+n,",").concat(s+i*N,` L `).concat(t+n,",").concat(s+a-i*N,` A `).concat(N,",").concat(N,",0,0,").concat(m,",").concat(t+n-u*N,",").concat(s+a,` L `).concat(t+u*N,",").concat(s+a,` A `).concat(N,",").concat(N,",0,0,").concat(m,",").concat(t,",").concat(s+a-i*N," Z")}else x="M ".concat(t,",").concat(s," h ").concat(n," v ").concat(a," h ").concat(-n," Z");return x},NHt=function(t,s){if(!t||!s)return!1;var n=t.x,a=t.y,o=s.x,l=s.y,i=s.width,u=s.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 n>=m&&n<=x&&a>=y&&a<=v}return!1},SHt={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},X1e=function(t){var s=bMe(bMe({},SHt),t),n=A.useRef(),a=A.useState(-1),o=xHt(a,2),l=o[0],i=o[1];A.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var R=n.current.getTotalLength();R&&i(R)}catch{}},[]);var u=s.x,m=s.y,x=s.width,y=s.height,v=s.radius,b=s.className,N=s.animationEasing,k=s.animationDuration,M=s.animationBegin,E=s.isAnimationActive,T=s.isUpdateAnimationActive;if(u!==+u||m!==+m||x!==+x||y!==+y||x===0||y===0)return null;var P=mi("recharts-rectangle",b);return T?ut.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(R){var D=R.width,U=R.height,q=R.x,H=R.y;return ut.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:E,easing:N},ut.createElement("path",Ose({},qa(s,!0),{className:P,d:wMe(q,H,D,U,v),ref:n})))}):ut.createElement("path",Ose({},qa(s,!0),{className:P,d:wMe(u,m,x,y,v)}))},CHt=["points","className","baseLinePoints","connectNulls"];function uS(){return uS=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function THt(e,t){if(e==null)return{};var s={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;s[n]=e[n]}return s}function jMe(e){return PHt(e)||IHt(e)||EHt(e)||AHt()}function AHt(){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 EHt(e,t){if(e){if(typeof e=="string")return Tfe(e,t);var s=Object.prototype.toString.call(e).slice(8,-1);if(s==="Object"&&e.constructor&&(s=e.constructor.name),s==="Map"||s==="Set")return Array.from(e);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return Tfe(e,t)}}function IHt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function PHt(e){if(Array.isArray(e))return Tfe(e)}function Tfe(e,t){(t==null||t>e.length)&&(t=e.length);for(var s=0,n=new Array(t);s0&&arguments[0]!==void 0?arguments[0]:[],s=[[]];return t.forEach(function(n){kMe(n)?s[s.length-1].push(n):s[s.length-1].length>0&&s.push([])}),kMe(t[0])&&s[s.length-1].push(t[0]),s[s.length-1].length<=0&&(s=s.slice(0,-1)),s},lE=function(t,s){var n=LHt(t);s&&(n=[n.reduce(function(o,l){return[].concat(jMe(o),jMe(l))},[])]);var a=n.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 n.length===1?"".concat(a,"Z"):a},OHt=function(t,s,n){var a=lE(t,n);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(lE(s.reverse(),n).slice(1))},DHt=function(t){var s=t.points,n=t.className,a=t.baseLinePoints,o=t.connectNulls,l=MHt(t,CHt);if(!s||!s.length)return null;var i=mi("recharts-polygon",n);if(a&&a.length){var u=l.stroke&&l.stroke!=="none",m=OHt(s,a,o);return ut.createElement("g",{className:i},ut.createElement("path",uS({},qa(l,!0),{fill:m.slice(-1)==="Z"?l.fill:"none",stroke:"none",d:m})),u?ut.createElement("path",uS({},qa(l,!0),{fill:"none",d:lE(s,o)})):null,u?ut.createElement("path",uS({},qa(l,!0),{fill:"none",d:lE(a,o)})):null)}var x=lE(s,o);return ut.createElement("path",uS({},qa(l,!0),{fill:x.slice(-1)==="Z"?l.fill:"none",className:i,d:x}))};function Afe(){return Afe=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function qHt(e,t){if(e==null)return{};var s={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;s[n]=e[n]}return s}var VHt=function(t,s,n,a,o,l){return"M".concat(t,",").concat(o,"v").concat(a,"M").concat(l,",").concat(s,"h").concat(n)},HHt=function(t){var s=t.x,n=s===void 0?0:s,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=UHt(t,RHt),M=FHt({x:n,y:o,top:i,left:m,width:y,height:b},k);return!Fs(n)||!Fs(o)||!Fs(y)||!Fs(b)||!Fs(i)||!Fs(m)?null:ut.createElement("path",Efe({},qa(M,!0),{className:mi("recharts-cross",N),d:VHt(n,o,y,b,i,m)}))},WHt=wie,GHt=EUe,KHt=ux;function ZHt(e,t){return e&&e.length?WHt(e,KHt(t),GHt):void 0}var YHt=ZHt;const XHt=no(YHt);var QHt=wie,JHt=ux,eWt=IUe;function tWt(e,t){return e&&e.length?QHt(e,JHt(t),eWt):void 0}var rWt=tWt;const sWt=no(rWt);var nWt=["cx","cy","angle","ticks","axisLine"],aWt=["ticks","tick","angle","tickFormatter","stroke"];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 cE(){return cE=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function iWt(e,t){if(e==null)return{};var s={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;s[n]=e[n]}return s}function oWt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function MMe(e,t){for(var s=0;sEMe?l=a==="outer"?"start":"end":o<-EMe?l=a==="outer"?"end":"start":l="middle",l}},{key:"renderAxisLine",value:function(){var n=this.props,a=n.cx,o=n.cy,l=n.radius,i=n.axisLine,u=n.axisLineType,m=L_(L_({},qa(this.props,!1)),{},{fill:"none"},qa(i,!1));if(u==="circle")return ut.createElement(Q1e,nj({className:"recharts-polar-angle-axis-line"},m,{cx:a,cy:o,r:l}));var x=this.props.ticks,y=x.map(function(v){return ll(a,o,l,v.coordinate)});return ut.createElement(DHt,nj({className:"recharts-polar-angle-axis-line"},m,{points:y}))}},{key:"renderTicks",value:function(){var n=this,a=this.props,o=a.ticks,l=a.tick,i=a.tickLine,u=a.tickFormatter,m=a.stroke,x=qa(this.props,!1),y=qa(l,!1),v=L_(L_({},x),{},{fill:"none"},qa(i,!1)),b=o.map(function(N,k){var M=n.getTickLineCoord(N),E=n.getTickTextAnchor(N),T=L_(L_(L_({textAnchor:E},x),{},{stroke:"none",fill:m},y),{},{index:k,payload:N,x:M.x2,y:M.y2});return ut.createElement(Ro,nj({className:mi("recharts-polar-angle-axis-tick",iqe(l)),key:"tick-".concat(N.coordinate)},jk(n.props,N,k)),i&&ut.createElement("line",nj({className:"recharts-polar-angle-axis-tick-line"},v,M)),l&&t.renderTickItem(l,T,u?u(N.value,k):N.value))});return ut.createElement(Ro,{className:"recharts-polar-angle-axis-ticks"},b)}},{key:"render",value:function(){var n=this.props,a=n.ticks,o=n.radius,l=n.axisLine;return o<=0||!a||!a.length?null:ut.createElement(Ro,{className:mi("recharts-polar-angle-axis",this.props.className)},l&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(n,a,o){var l;return ut.isValidElement(n)?l=ut.cloneElement(n,a):Xa(n)?l=n(a):l=ut.createElement(kk,nj({},a,{className:"recharts-polar-angle-axis-tick-value"}),o),l}}])}(A.PureComponent);Eie(Iie,"displayName","PolarAngleAxis");Eie(Iie,"axisType","angleAxis");Eie(Iie,"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 wWt=C$e,jWt=wWt(Object.getPrototypeOf,Object),kWt=jWt,NWt=Wy,SWt=kWt,CWt=Gy,MWt="[object Object]",TWt=Function.prototype,AWt=Object.prototype,kqe=TWt.toString,EWt=AWt.hasOwnProperty,IWt=kqe.call(Object);function PWt(e){if(!CWt(e)||NWt(e)!=MWt)return!1;var t=SWt(e);if(t===null)return!0;var s=EWt.call(t,"constructor")&&t.constructor;return typeof s=="function"&&s instanceof s&&kqe.call(s)==IWt}var LWt=PWt;const OWt=no(LWt);var DWt=Wy,RWt=Gy,FWt="[object Boolean]";function zWt(e){return e===!0||e===!1||RWt(e)&&DWt(e)==FWt}var BWt=zWt;const $Wt=no(BWt);function II(e){"@babel/helpers - typeof";return II=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},II(e)}function Fse(){return Fse=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var s=0,n=new Array(t);s0,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:E},function(P){var R=P.upperWidth,D=P.lowerWidth,U=P.height,q=P.x,H=P.y;return ut.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},ut.createElement("path",Fse({},qa(s,!0),{className:T,d:OMe(q,H,R,D,U),ref:n})))}):ut.createElement("g",null,ut.createElement("path",Fse({},qa(s,!0),{className:T,d:OMe(u,m,x,y,v)})))},QWt=["option","shapeType","propTransformer","activeClassName","isActive"];function PI(e){"@babel/helpers - typeof";return PI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},PI(e)}function JWt(e,t){if(e==null)return{};var s=eGt(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function eGt(e,t){if(e==null)return{};var s={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;s[n]=e[n]}return s}function DMe(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),s.push.apply(s,n)}return s}function zse(e){for(var t=1;t0?km(P,"paddingAngle",0):0;if(D){var q=a1(D.endAngle-D.startAngle,P.endAngle-P.startAngle),H=al(al({},P),{},{startAngle:T+U,endAngle:T+q(k)+U});M.push(H),T=H.endAngle}else{var G=P.endAngle,Q=P.startAngle,ne=a1(0,G-Q),ie=ne(k),he=al(al({},P),{},{startAngle:T+U,endAngle:T+ie+U});M.push(he),T=he.endAngle}}),ut.createElement(Ro,null,n.renderSectorsStatically(M))})}},{key:"attachKeyboardHandlers",value:function(n){var a=this;n.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 n=this.props,a=n.sectors,o=n.isAnimationActive,l=this.state.prevSectors;return o&&a&&a.length&&(!l||!Nie(l,a))?this.renderSectorsWithAnimation():this.renderSectorsStatically(a)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var n=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||!Fs(m)||!Fs(x)||!Fs(y)||!Fs(v))return null;var k=mi("recharts-pie",i);return ut.createElement(Ro,{tabIndex:this.props.rootTabIndex,className:k,ref:function(E){n.pieRef=E}},this.renderSectors(),u&&this.renderLabels(l),Od.renderCallByParent(this.props,null,!1),(!b||N)&&dv.renderCallByParent(this.props,l,!1))}}],[{key:"getDerivedStateFromProps",value:function(n,a){return a.prevIsAnimationActive!==n.isAnimationActive?{prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:[],isAnimationFinished:!0}:n.isAnimationActive&&n.animationId!==a.prevAnimationId?{prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:a.curSectors,isAnimationFinished:!0}:n.sectors!==a.curSectors?{curSectors:n.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(n,a){return n>a?"start":n=360?T:T-1)*u,R=M-T*b-P,D=a.reduce(function(H,G){var Q=vu(G,E,0);return H+(Fs(Q)?Q:0)},0),U;if(D>0){var q;U=a.map(function(H,G){var Q=vu(H,E,0),ne=vu(H,x,G),ie=(Fs(Q)?Q:0)/D,he;G?he=q.endAngle+Qu(k)*u*(Q!==0?1:0):he=l;var se=he+Qu(k)*((Q!==0?b:0)+ie*R),fe=(he+se)/2,oe=(N.innerRadius+N.outerRadius)/2,ce=[{name:ne,value:Q,payload:H,dataKey:E,type:v}],de=ll(N.cx,N.cy,oe,fe);return q=al(al(al({percent:ie,cornerRadius:o,name:ne,tooltipPayload:ce,midAngle:fe,middleRadius:oe,tooltipPosition:de},H),N),{},{value:vu(H,E),startAngle:he,endAngle:se,payload:H,paddingAngle:Qu(k)*u}),q})}return al(al({},N),{},{sectors:U,data:a})});var bGt=Math.ceil,wGt=Math.max;function jGt(e,t,s,n){for(var a=-1,o=wGt(bGt((t-e)/(s||1)),0),l=Array(o);o--;)l[n?o:++a]=e,e+=s;return l}var kGt=jGt,NGt=W$e,BMe=1/0,SGt=17976931348623157e292;function CGt(e){if(!e)return e===0?e:0;if(e=NGt(e),e===BMe||e===-BMe){var t=e<0?-1:1;return t*SGt}return e===e?e:0}var Mqe=CGt,MGt=kGt,TGt=pie,hue=Mqe;function AGt(e){return function(t,s,n){return n&&typeof n!="number"&&TGt(t,s,n)&&(s=n=void 0),t=hue(t),s===void 0?(s=t,t=0):s=hue(s),n=n===void 0?t0&&n.handleDrag(a.changedTouches[0])}),rm(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var a=n.props,o=a.endIndex,l=a.onDragEnd,i=a.startIndex;l==null||l({endIndex:o,startIndex:i})}),n.detachDragEndListener()}),rm(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),rm(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),rm(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),rm(n,"handleSlideDragStart",function(a){var o=HMe(a)?a.changedTouches[0]:a;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:o.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return VGt(t,e),BGt(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var a=n.startX,o=n.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(n){var a=this.props,o=a.data,l=a.tickFormatter,i=a.dataKey,u=vu(o[n],i,n);return Xa(l)?l(u,n):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(n){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=n.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:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,a){var o=HMe(a)?a.changedTouches[0]:a;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:o.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){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,E={startX:this.state.startX,endX:this.state.endX},T=n.pageX-o;T>0?T=Math.min(T,y+v-b-m):T<0&&(T=Math.max(T,y-m)),E[l]=m+T;var P=this.getIndex(E),R=P.startIndex,D=P.endIndex,U=function(){var H=M.length-1;return l==="startX"&&(i>u?R%k===0:D%k===0)||iu?D%k===0:R%k===0)||i>u&&D===H};this.setState(rm(rm({},l,m+T),"brushMoveStartX",n.pageX),function(){N&&U()&&N(P)})}},{key:"handleTravellerMoveKeyboard",value:function(n,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+n;if(!(v===-1||v>=i.length)){var b=i[v];a==="startX"&&b>=m||a==="endX"&&b<=u||this.setState(rm({},a,b),function(){o.props.onChange(o.getIndex({startX:o.state.startX,endX:o.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,a=n.x,o=n.y,l=n.width,i=n.height,u=n.fill,m=n.stroke;return ut.createElement("rect",{stroke:m,fill:u,x:a,y:o,width:l,height:i})}},{key:"renderPanorama",value:function(){var n=this.props,a=n.x,o=n.y,l=n.width,i=n.height,u=n.data,m=n.children,x=n.padding,y=A.Children.only(m);return y?ut.cloneElement(y,{x:a,y:o,width:l,height:i,margin:x,compact:!0,data:u}):null}},{key:"renderTravellerLayer",value:function(n,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,E=Math.max(n,this.props.x),T=mue(mue({},qa(this.props,!1)),{},{x:E,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 ut.createElement(Ro,{tabIndex:0,role:"slider","aria-label":P,"aria-valuenow":n,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(n,a){var o=this.props,l=o.y,i=o.height,u=o.stroke,m=o.travellerWidth,x=Math.min(n,a)+m,y=Math.max(Math.abs(a-n)-m,0);return ut.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 n=this.props,a=n.startIndex,o=n.endIndex,l=n.y,i=n.height,u=n.travellerWidth,m=n.stroke,x=this.state,y=x.startX,v=x.endX,b=5,N={pointerEvents:"none",fill:m};return ut.createElement(Ro,{className:"recharts-brush-texts"},ut.createElement(kk,Use({textAnchor:"end",verticalAnchor:"middle",x:Math.min(y,v)-b,y:l+i/2},N),this.getTextOfTick(a)),ut.createElement(kk,Use({textAnchor:"start",verticalAnchor:"middle",x:Math.max(y,v)+u+b,y:l+i/2},N),this.getTextOfTick(o)))}},{key:"render",value:function(){var n=this.props,a=n.data,o=n.className,l=n.children,i=n.x,u=n.y,m=n.width,x=n.height,y=n.alwaysShowText,v=this.state,b=v.startX,N=v.endX,k=v.isTextActive,M=v.isSlideMoving,E=v.isTravellerMoving,T=v.isTravellerFocused;if(!a||!a.length||!Fs(i)||!Fs(u)||!Fs(m)||!Fs(x)||m<=0||x<=0)return null;var P=mi("recharts-brush",o),R=ut.Children.count(l)===1,D=FGt("userSelect","none");return ut.createElement(Ro,{className:P,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:D},this.renderBackground(),R&&this.renderPanorama(),this.renderSlide(b,N),this.renderTravellerLayer(b,"startX"),this.renderTravellerLayer(N,"endX"),(k||M||E||T||y)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var a=n.x,o=n.y,l=n.width,i=n.height,u=n.stroke,m=Math.floor(o+i/2)-1;return ut.createElement(ut.Fragment,null,ut.createElement("rect",{x:a,y:o,width:l,height:i,fill:u,stroke:"none"}),ut.createElement("line",{x1:a+1,y1:m,x2:a+l-1,y2:m,fill:"none",stroke:"#fff"}),ut.createElement("line",{x1:a+1,y1:m+2,x2:a+l-1,y2:m+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,a){var o;return ut.isValidElement(n)?o=ut.cloneElement(n,a):Xa(n)?o=n(a):o=t.renderDefaultTraveller(a),o}},{key:"getDerivedStateFromProps",value:function(n,a){var o=n.data,l=n.width,i=n.x,u=n.travellerWidth,m=n.updateId,x=n.startIndex,y=n.endIndex;if(o!==a.prevData||m!==a.prevUpdateId)return mue({prevData:o,prevTravellerWidth:u,prevUpdateId:m,prevX:i,prevWidth:l},o&&o.length?WGt({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(n.startIndex),endX:a.scale(n.endIndex),scaleValues:v}}return null}},{key:"getIndexInRange",value:function(n,a){for(var o=n.length,l=0,i=o-1;i-l>1;){var u=Math.floor((l+i)/2);n[u]>a?i=u:l=u}return a>=n[i]?i:l}}])}(A.PureComponent);rm(c3,"displayName","Brush");rm(c3,"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 GGt=j1e;function KGt(e,t){var s;return GGt(e,function(n,a,o){return s=t(n,a,o),!s}),!!s}var ZGt=KGt,YGt=v$e,XGt=ux,QGt=ZGt,JGt=qh,eKt=pie;function tKt(e,t,s){var n=JGt(e)?YGt:QGt;return s&&eKt(e,t,s)&&(t=void 0),n(e,XGt(t))}var rKt=tKt;const sKt=no(rKt);var Xg=function(t,s){var n=t.alwaysShow,a=t.ifOverflow;return n&&(a="extendDomain"),a===s},WMe=$$e;function nKt(e,t,s){t=="__proto__"&&WMe?WMe(e,t,{configurable:!0,enumerable:!0,value:s,writable:!0}):e[t]=s}var aKt=nKt,iKt=aKt,oKt=z$e,lKt=ux;function cKt(e,t){var s={};return t=lKt(t),oKt(e,function(n,a,o){iKt(s,a,t(n,a,o))}),s}var dKt=cKt;const uKt=no(dKt);function hKt(e,t){for(var s=-1,n=e==null?0:e.length;++s=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function TKt(e,t){if(e==null)return{};var s={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;s[n]=e[n]}return s}function AKt(e,t){var s=e.x,n=e.y,a=MKt(e,kKt),o="".concat(s),l=parseInt(o,10),i="".concat(n),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 AT(AT(AT(AT(AT({},t),a),l?{x:l}:{}),u?{y:u}:{}),{},{height:x,width:v,name:t.name,radius:t.radius})}function KMe(e){return ut.createElement(Nqe,Dfe({shapeType:"rectangle",propTransformer:AKt,activeClassName:"recharts-active-bar"},e))}var EKt=function(t){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,a){if(typeof t=="number")return t;var o=Fs(n)||sEt(n);return o?t(n,a):(o||Sk(),s)}},IKt=["value","background"],Pqe;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 PKt(e,t){if(e==null)return{};var s=LKt(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function LKt(e,t){if(e==null)return{};var s={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;s[n]=e[n]}return s}function Vse(){return Vse=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(fe)0&&Math.abs(se)0&&(he=Math.min((tt||0)-(se[Ae-1]||0),he))}),Number.isFinite(he)){var fe=he/ie,oe=k.layout==="vertical"?n.height:n.width;if(k.padding==="gap"&&(q=fe*oe/2),k.padding==="no-gap"){var ce=Ju(t.barCategoryGap,fe*oe),de=fe*oe/2;q=de-ce-(de-ce)/oe*ce}}}a==="xAxis"?H=[n.left+(P.left||0)+(q||0),n.left+n.width-(P.right||0)-(q||0)]:a==="yAxis"?H=u==="horizontal"?[n.top+n.height-(P.bottom||0),n.top+(P.top||0)]:[n.top+(P.top||0)+(q||0),n.top+n.height-(P.bottom||0)-(q||0)]:H=k.range,D&&(H=[H[1],H[0]]);var xe=JUe(k,o,v),Me=xe.scale,ve=xe.realScaleType;Me.domain(E).range(H),eqe(Me);var be=tqe(Me,ff(ff({},k),{},{realScaleType:ve}));a==="xAxis"?(ne=M==="top"&&!R||M==="bottom"&&R,G=n.left,Q=y[U]-ne*k.height):a==="yAxis"&&(ne=M==="left"&&!R||M==="right"&&R,G=y[U]-ne*k.width,Q=n.top);var we=ff(ff(ff({},k),be),{},{realScaleType:ve,x:G,y:Q,scale:Me,width:a==="xAxis"?n.width:k.width,height:a==="yAxis"?n.height:k.height});return we.bandSize=Tse(we,be),!k.hide&&a==="xAxis"?y[U]+=(ne?-1:1)*we.height:k.hide||(y[U]+=(ne?-1:1)*we.width),ff(ff({},b),{},Oie({},N,we))},{})},Rqe=function(t,s){var n=t.x,a=t.y,o=s.x,l=s.y;return{x:Math.min(n,o),y:Math.min(a,l),width:Math.abs(o-n),height:Math.abs(l-a)}},WKt=function(t){var s=t.x1,n=t.y1,a=t.x2,o=t.y2;return Rqe({x:s,y:n},{x:a,y:o})},Fqe=function(){function e(t){UKt(this,e),this.scale=t}return qKt(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(s){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=n.bandAware,o=n.position;if(s!==void 0){if(o)switch(o){case"start":return this.scale(s);case"middle":{var l=this.bandwidth?this.bandwidth()/2:0;return this.scale(s)+l}case"end":{var i=this.bandwidth?this.bandwidth():0;return this.scale(s)+i}default:return this.scale(s)}if(a){var u=this.bandwidth?this.bandwidth()/2:0;return this.scale(s)+u}return this.scale(s)}}},{key:"isInRange",value:function(s){var n=this.range(),a=n[0],o=n[n.length-1];return a<=o?s>=a&&s<=o:s>=o&&s<=a}}],[{key:"create",value:function(s){return new e(s)}}])}();Oie(Fqe,"EPS",1e-4);var J1e=function(t){var s=Object.keys(t).reduce(function(n,a){return ff(ff({},n),{},Oie({},a,Fqe.create(t[a])))},{});return ff(ff({},s),{},{apply:function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=o.bandAware,i=o.position;return uKt(a,function(u,m){return s[m].apply(u,{bandAware:l,position:i})})},isInRange:function(a){return Iqe(a,function(o,l){return s[l].isInRange(o)})}})};function GKt(e){return(e%180+180)%180}var KKt=function(t){var s=t.width,n=t.height,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=GKt(a),l=o*Math.PI/180,i=Math.atan(n/s),u=l>i&&l-1?a[o?t[l]:l]:void 0}}var JKt=QKt,eZt=Mqe;function tZt(e){var t=eZt(e),s=t%1;return t===t?s?t-s:t:0}var rZt=tZt,sZt=P$e,nZt=ux,aZt=rZt,iZt=Math.max;function oZt(e,t,s){var n=e==null?0:e.length;if(!n)return-1;var a=s==null?0:aZt(s);return a<0&&(a=iZt(n+a,0)),sZt(e,nZt(t),a)}var lZt=oZt,cZt=JKt,dZt=lZt,uZt=cZt(dZt),hZt=uZt;const mZt=no(hZt);var pZt=cAt(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("")}),eve=A.createContext(void 0),tve=A.createContext(void 0),zqe=A.createContext(void 0),Bqe=A.createContext({}),$qe=A.createContext(void 0),Uqe=A.createContext(0),qqe=A.createContext(0),JMe=function(t){var s=t.state,n=s.xAxisMap,a=s.yAxisMap,o=s.offset,l=t.clipPathId,i=t.children,u=t.width,m=t.height,x=pZt(o);return ut.createElement(eve.Provider,{value:n},ut.createElement(tve.Provider,{value:a},ut.createElement(Bqe.Provider,{value:o},ut.createElement(zqe.Provider,{value:x},ut.createElement($qe.Provider,{value:l},ut.createElement(Uqe.Provider,{value:m},ut.createElement(qqe.Provider,{value:u},i)))))))},fZt=function(){return A.useContext($qe)},Vqe=function(t){var s=A.useContext(eve);s==null&&Sk();var n=s[t];return n==null&&Sk(),n},gZt=function(){var t=A.useContext(eve);return m1(t)},xZt=function(){var t=A.useContext(tve),s=mZt(t,function(n){return Iqe(n.domain,Number.isFinite)});return s||m1(t)},Hqe=function(t){var s=A.useContext(tve);s==null&&Sk();var n=s[t];return n==null&&Sk(),n},yZt=function(){var t=A.useContext(zqe);return t},vZt=function(){return A.useContext(Bqe)},rve=function(){return A.useContext(qqe)},sve=function(){return A.useContext(Uqe)};function u3(e){"@babel/helpers - typeof";return u3=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},u3(e)}function _Zt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bZt(e,t){for(var s=0;se.length)&&(t=e.length);for(var s=0,n=new Array(t);se*a)return!1;var o=s();return e*(t-e*o/2-n)>=0&&e*(t+e*o/2-a)<=0}function rYt(e,t){return Qqe(e,t+1)}function sYt(e,t,s,n,a){for(var o=(n||[]).slice(),l=t.start,i=t.end,u=0,m=1,x=l,y=function(){var N=n==null?void 0:n[u];if(N===void 0)return{v:Qqe(n,m)};var k=u,M,E=function(){return M===void 0&&(M=s(N,k)),M},T=N.coordinate,P=u===0||Zse(e,T,E,x,i);P||(u=0,x=l,m+=1),P&&(x=T+e*(E()/2+a),u+=m)},v;m<=o.length;)if(v=y(),v)return v.v;return[]}function FI(e){"@babel/helpers - typeof";return FI=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},FI(e)}function oTe(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),s.push.apply(s,n)}return s}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 E=Zse(e,b.tickCoord,k,i,u);E&&(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 lYt(e,t,s,n,a,o){var l=(n||[]).slice(),i=l.length,u=t.start,m=t.end;if(o){var x=n[i-1],y=s(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=Zse(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],R,D=function(){return R===void 0&&(R=s(P,T)),R};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 q=Zse(e,P.tickCoord,D,u,m);q&&(u=P.tickCoord+e*(D()/2+a),l[T]=gu(gu({},P),{},{isShow:!0}))},M=0;M=2?Qu(a[1].coordinate-a[0].coordinate):1,E=tYt(o,M,b);return u==="equidistantPreserveStart"?sYt(M,E,k,a,l):(u==="preserveStart"||u==="preserveStartEnd"?v=lYt(M,E,k,a,l,u==="preserveStartEnd"):v=oYt(M,E,k,a,l),v.filter(function(T){return T.isShow}))}var cYt=["viewBox"],dYt=["viewBox"],uYt=["ticks"];function p3(e){"@babel/helpers - typeof";return p3=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},p3(e)}function mS(){return mS=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function hYt(e,t){if(e==null)return{};var s={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;s[n]=e[n]}return s}function mYt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cTe(e,t){for(var s=0;s0?u(this.props):u(b)),l<=0||i<=0||!N||!N.length?null:ut.createElement(Ro,{className:mi("recharts-cartesian-axis",m),ref:function(M){n.layerReference=M}},o&&this.renderAxisLine(),this.renderTicks(N,this.state.fontSize,this.state.letterSpacing),Od.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,a,o){var l,i=mi(a.className,"recharts-cartesian-axis-tick-value");return ut.isValidElement(n)?l=ut.cloneElement(n,ed(ed({},a),{},{className:i})):Xa(n)?l=n(ed(ed({},a),{},{className:i})):l=ut.createElement(kk,mS({},a,{className:"recharts-cartesian-axis-tick-value"}),o),l}}])}(A.Component);ove(n5,"displayName","CartesianAxis");ove(n5,"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 _Yt=["x1","y1","x2","y2","key"],bYt=["offset"];function Ck(e){"@babel/helpers - typeof";return Ck=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},Ck(e)}function dTe(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),s.push.apply(s,n)}return s}function yu(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function NYt(e,t){if(e==null)return{};var s={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;s[n]=e[n]}return s}var SYt=function(t){var s=t.fill;if(!s||s==="none")return null;var n=t.fillOpacity,a=t.x,o=t.y,l=t.width,i=t.height,u=t.ry;return ut.createElement("rect",{x:a,y:o,ry:u,width:l,height:i,stroke:"none",fill:s,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function tVe(e,t){var s;if(ut.isValidElement(e))s=ut.cloneElement(e,t);else if(Xa(e))s=e(t);else{var n=t.x1,a=t.y1,o=t.x2,l=t.y2,i=t.key,u=uTe(t,_Yt),m=qa(u,!1);m.offset;var x=uTe(m,bYt);s=ut.createElement("line",yj({},x,{x1:n,y1:a,x2:o,y2:l,fill:"none",key:i}))}return s}function CYt(e){var t=e.x,s=e.width,n=e.horizontal,a=n===void 0?!0:n,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+s,y2:i,key:"line-".concat(u),index:u});return tVe(a,m)});return ut.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function MYt(e){var t=e.y,s=e.height,n=e.vertical,a=n===void 0?!0:n,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+s,key:"line-".concat(u),index:u});return tVe(a,m)});return ut.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function TYt(e){var t=e.horizontalFill,s=e.fillOpacity,n=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 ut.createElement("rect",{key:"react-".concat(b),y:v,x:n,height:k,width:o,stroke:"none",fill:t[M],fillOpacity:s,className:"recharts-cartesian-grid-bg"})});return ut.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},y)}function AYt(e){var t=e.vertical,s=t===void 0?!0:t,n=e.verticalFill,a=e.fillOpacity,o=e.x,l=e.y,i=e.width,u=e.height,m=e.verticalPoints;if(!s||!n||!n.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%n.length;return ut.createElement("rect",{key:"react-".concat(b),x:v,y:l,width:k,height:u,stroke:"none",fill:n[M],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return ut.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},y)}var EYt=function(t,s){var n=t.xAxis,a=t.width,o=t.height,l=t.offset;return QUe(ive(yu(yu(yu({},n5.defaultProps),n),{},{ticks:iy(n,!0),viewBox:{x:0,y:0,width:a,height:o}})),l.left,l.left+l.width,s)},IYt=function(t,s){var n=t.yAxis,a=t.width,o=t.height,l=t.offset;return QUe(ive(yu(yu(yu({},n5.defaultProps),n),{},{ticks:iy(n,!0),viewBox:{x:0,y:0,width:a,height:o}})),l.top,l.top+l.height,s)},$4={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function rVe(e){var t,s,n,a,o,l,i=rve(),u=sve(),m=vZt(),x=yu(yu({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:$4.stroke,fill:(s=e.fill)!==null&&s!==void 0?s:$4.fill,horizontal:(n=e.horizontal)!==null&&n!==void 0?n:$4.horizontal,horizontalFill:(a=e.horizontalFill)!==null&&a!==void 0?a:$4.horizontalFill,vertical:(o=e.vertical)!==null&&o!==void 0?o:$4.vertical,verticalFill:(l=e.verticalFill)!==null&&l!==void 0?l:$4.verticalFill,x:Fs(e.x)?e.x:m.left,y:Fs(e.y)?e.y:m.top,width:Fs(e.width)?e.width:m.width,height:Fs(e.height)?e.height:m.height}),y=x.x,v=x.y,b=x.width,N=x.height,k=x.syncWithTicks,M=x.horizontalValues,E=x.verticalValues,T=gZt(),P=xZt();if(!Fs(b)||b<=0||!Fs(N)||N<=0||!Fs(y)||y!==+y||!Fs(v)||v!==+v)return null;var R=x.verticalCoordinatesGenerator||EYt,D=x.horizontalCoordinatesGenerator||IYt,U=x.horizontalPoints,q=x.verticalPoints;if((!U||!U.length)&&Xa(D)){var H=M&&M.length,G=D({yAxis:P?yu(yu({},P),{},{ticks:H?M:P.ticks}):void 0,width:i,height:u,offset:m},H?!0:k);Rf(Array.isArray(G),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Ck(G),"]")),Array.isArray(G)&&(U=G)}if((!q||!q.length)&&Xa(R)){var Q=E&&E.length,ne=R({xAxis:T?yu(yu({},T),{},{ticks:Q?E:T.ticks}):void 0,width:i,height:u,offset:m},Q?!0:k);Rf(Array.isArray(ne),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Ck(ne),"]")),Array.isArray(ne)&&(q=ne)}return ut.createElement("g",{className:"recharts-cartesian-grid"},ut.createElement(SYt,{fill:x.fill,fillOpacity:x.fillOpacity,x:x.x,y:x.y,width:x.width,height:x.height,ry:x.ry}),ut.createElement(CYt,yj({},x,{offset:m,horizontalPoints:U,xAxis:T,yAxis:P})),ut.createElement(MYt,yj({},x,{offset:m,verticalPoints:q,xAxis:T,yAxis:P})),ut.createElement(TYt,yj({},x,{horizontalPoints:U})),ut.createElement(AYt,yj({},x,{verticalPoints:q})))}rVe.displayName="CartesianGrid";function f3(e){"@babel/helpers - typeof";return f3=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},f3(e)}function PYt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function LYt(e,t){for(var s=0;se.length)&&(t=e.length);for(var s=0,n=new Array(t);s=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function _Xt(e,t){if(e==null)return{};var s={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;s[n]=e[n]}return s}function bXt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wXt(e,t){for(var s=0;se.length)&&(t=e.length);for(var s=0,n=new Array(t);s0?l:t&&t.length&&Fs(a)&&Fs(o)?t.slice(a,o+1):[]};function gVe(e){return e==="number"?[0,"auto"]:void 0}var Jfe=function(t,s,n,a){var o=t.graphicalItems,l=t.tooltipAxis,i=Uie(s,t);return n<0||!o||!o.length||n>=i.length?null:o.reduce(function(u,m){var x,y=(x=m.props.data)!==null&&x!==void 0?x:s;y&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=n&&(y=y.slice(t.dataStartIndex,t.dataEndIndex+1));var v;if(l.dataKey&&!l.allowDuplicatedCategory){var b=y===void 0?i:y;v=Spe(b,l.dataKey,a)}else v=y&&y[n]||i[n];return v?[].concat(y3(u),[sqe(m,v)]):u},[])},xTe=function(t,s,n,a){var o=a||{x:t.chartX,y:t.chartY},l=LXt(o,n),i=t.orderedTooltipTicks,u=t.tooltipAxis,m=t.tooltipTicks,x=fUt(l,i,m,u);if(x>=0&&m){var y=m[x]&&m[x].value,v=Jfe(t,s,x,y),b=OXt(n,i,x,o);return{activeTooltipIndex:x,activeLabel:y,activePayload:v,activeCoordinate:b}}return null},DXt=function(t,s){var n=s.axes,a=s.graphicalItems,o=s.axisType,l=s.axisIdKey,i=s.stackGroups,u=s.dataStartIndex,m=s.dataEndIndex,x=t.layout,y=t.children,v=t.stackOffset,b=XUe(x,o);return n.reduce(function(N,k){var M,E=k.type.defaultProps!==void 0?ts(ts({},k.type.defaultProps),k.props):k.props,T=E.type,P=E.dataKey,R=E.allowDataOverflow,D=E.allowDuplicatedCategory,U=E.scale,q=E.ticks,H=E.includeHidden,G=E[l];if(N[G])return N;var Q=Uie(t.data,{graphicalItems:a.filter(function(be){var we,tt=l in be.props?be.props[l]:(we=be.type.defaultProps)===null||we===void 0?void 0:we[l];return tt===G}),dataStartIndex:u,dataEndIndex:m}),ne=Q.length,ie,he,se;lXt(E.domain,R,T)&&(ie=pfe(E.domain,null,R),b&&(T==="number"||U!=="auto")&&(se=iE(Q,P,"category")));var fe=gVe(T);if(!ie||ie.length===0){var oe,ce=(oe=E.domain)!==null&&oe!==void 0?oe:fe;if(P){if(ie=iE(Q,P,T),T==="category"&&b){var de=aEt(ie);D&&de?(he=ie,ie=$se(0,ne)):D||(ie=U5e(ce,ie,k).reduce(function(be,we){return be.indexOf(we)>=0?be:[].concat(y3(be),[we])},[]))}else if(T==="category")D?ie=ie.filter(function(be){return be!==""&&!Ii(be)}):ie=U5e(ce,ie,k).reduce(function(be,we){return be.indexOf(we)>=0||we===""||Ii(we)?be:[].concat(y3(be),[we])},[]);else if(T==="number"){var xe=_Ut(Q,a.filter(function(be){var we,tt,Ae=l in be.props?be.props[l]:(we=be.type.defaultProps)===null||we===void 0?void 0:we[l],Le="hide"in be.props?be.props.hide:(tt=be.type.defaultProps)===null||tt===void 0?void 0:tt.hide;return Ae===G&&(H||!Le)}),P,o,x);xe&&(ie=xe)}b&&(T==="number"||U!=="auto")&&(se=iE(Q,P,"category"))}else b?ie=$se(0,ne):i&&i[G]&&i[G].hasStack&&T==="number"?ie=v==="expand"?[0,1]:rqe(i[G].stackGroups,u,m):ie=YUe(Q,a.filter(function(be){var we=l in be.props?be.props[l]:be.type.defaultProps[l],tt="hide"in be.props?be.props.hide:be.type.defaultProps.hide;return we===G&&(H||!tt)}),T,x,!0);if(T==="number")ie=Yfe(y,ie,G,o,q),ce&&(ie=pfe(ce,ie,R));else if(T==="category"&&ce){var Me=ce,ve=ie.every(function(be){return Me.indexOf(be)>=0});ve&&(ie=Me)}}return ts(ts({},N),{},Pa({},G,ts(ts({},E),{},{axisType:o,domain:ie,categoricalDomain:se,duplicateDomain:he,originalDomain:(M=E.domain)!==null&&M!==void 0?M:fe,isCategorical:b,layout:x})))},{})},RXt=function(t,s){var n=s.graphicalItems,a=s.Axis,o=s.axisType,l=s.axisIdKey,i=s.stackGroups,u=s.dataStartIndex,m=s.dataEndIndex,x=t.layout,y=t.children,v=Uie(t.data,{graphicalItems:n,dataStartIndex:u,dataEndIndex:m}),b=v.length,N=XUe(x,o),k=-1;return n.reduce(function(M,E){var T=E.type.defaultProps!==void 0?ts(ts({},E.type.defaultProps),E.props):E.props,P=T[l],R=gVe("number");if(!M[P]){k++;var D;return N?D=$se(0,b):i&&i[P]&&i[P].hasStack?(D=rqe(i[P].stackGroups,u,m),D=Yfe(y,D,P,o)):(D=pfe(R,YUe(v,n.filter(function(U){var q,H,G=l in U.props?U.props[l]:(q=U.type.defaultProps)===null||q===void 0?void 0:q[l],Q="hide"in U.props?U.props.hide:(H=U.type.defaultProps)===null||H===void 0?void 0:H.hide;return G===P&&!Q}),"number",x),a.defaultProps.allowDataOverflow),D=Yfe(y,D,P,o)),ts(ts({},M),{},Pa({},P,ts(ts({axisType:o},a.defaultProps),{},{hide:!0,orientation:km(IXt,"".concat(o,".").concat(k%2),null),domain:D,originalDomain:R,isCategorical:N,layout:x})))}return M},{})},FXt=function(t,s){var n=s.axisType,a=n===void 0?"xAxis":n,o=s.AxisComp,l=s.graphicalItems,i=s.stackGroups,u=s.dataStartIndex,m=s.dataEndIndex,x=t.children,y="".concat(a,"Id"),v=vp(x,o),b={};return v&&v.length?b=DXt(t,{axes:v,graphicalItems:l,axisType:a,axisIdKey:y,stackGroups:i,dataStartIndex:u,dataEndIndex:m}):l&&l.length&&(b=RXt(t,{Axis:o,graphicalItems:l,axisType:a,axisIdKey:y,stackGroups:i,dataStartIndex:u,dataEndIndex:m})),b},zXt=function(t){var s=m1(t),n=iy(s,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:k1e(n,function(a){return a.coordinate}),tooltipAxis:s,tooltipAxisBandSize:Tse(s,n)}},yTe=function(t){var s=t.children,n=t.defaultShowTooltip,a=am(s,c3),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:!!n}},BXt=function(t){return!t||!t.length?!1:t.some(function(s){var n=wy(s&&s.type);return n&&n.indexOf("Bar")>=0})},vTe=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},$Xt=function(t,s){var n=t.props,a=t.graphicalItems,o=t.xAxisMap,l=o===void 0?{}:o,i=t.yAxisMap,u=i===void 0?{}:i,m=n.width,x=n.height,y=n.children,v=n.margin||{},b=am(y,c3),N=am(y,oC),k=Object.keys(u).reduce(function(D,U){var q=u[U],H=q.orientation;return!q.mirror&&!q.hide?ts(ts({},D),{},Pa({},H,D[H]+q.width)):D},{left:v.left||0,right:v.right||0}),M=Object.keys(l).reduce(function(D,U){var q=l[U],H=q.orientation;return!q.mirror&&!q.hide?ts(ts({},D),{},Pa({},H,km(D,"".concat(H))+q.height)):D},{top:v.top||0,bottom:v.bottom||0}),E=ts(ts({},M),k),T=E.bottom;b&&(E.bottom+=b.props.height||c3.defaultProps.height),N&&s&&(E=yUt(E,a,n,s));var P=m-E.left-E.right,R=x-E.top-E.bottom;return ts(ts({brushBottom:T},E),{},{width:Math.max(P,0),height:Math.max(R,0)})},UXt=function(t,s){if(s==="xAxis")return t[s].width;if(s==="yAxis")return t[s].height},xVe=function(t){var s=t.chartName,n=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(E,T){var P=T.graphicalItems,R=T.stackGroups,D=T.offset,U=T.updateId,q=T.dataStartIndex,H=T.dataEndIndex,G=E.barSize,Q=E.layout,ne=E.barGap,ie=E.barCategoryGap,he=E.maxBarSize,se=vTe(Q),fe=se.numericAxisName,oe=se.cateAxisName,ce=BXt(P),de=[];return P.forEach(function(xe,Me){var ve=Uie(E.data,{graphicalItems:[xe],dataStartIndex:q,dataEndIndex:H}),be=xe.type.defaultProps!==void 0?ts(ts({},xe.type.defaultProps),xe.props):xe.props,we=be.dataKey,tt=be.maxBarSize,Ae=be["".concat(fe,"Id")],Le=be["".concat(oe,"Id")],Ue={},Pe=u.reduce(function(Ie,Ze){var De=T["".concat(Ze.axisType,"Map")],Ke=be["".concat(Ze.axisType,"Id")];De&&De[Ke]||Ze.axisType==="zAxis"||Sk();var st=De[Ke];return ts(ts({},Ie),{},Pa(Pa({},Ze.axisType,st),"".concat(Ze.axisType,"Ticks"),iy(st)))},Ue),$e=Pe[oe],it=Pe["".concat(oe,"Ticks")],xt=R&&R[Ae]&&R[Ae].hasStack&&TUt(xe,R[Ae].stackGroups),Ee=wy(xe.type).indexOf("Bar")>=0,et=Tse($e,it),le=[],Ve=ce&&gUt({barSize:G,stackGroups:R,totalSize:UXt(Pe,oe)});if(Ee){var Je,rt,je=Ii(tt)?he:tt,lt=(Je=(rt=Tse($e,it,!0))!==null&&rt!==void 0?rt:je)!==null&&Je!==void 0?Je:0;le=xUt({barGap:ne,barCategoryGap:ie,bandSize:lt!==et?lt:et,sizeList:Ve[Le],maxBarSize:je}),lt!==et&&(le=le.map(function(Ie){return ts(ts({},Ie),{},{position:ts(ts({},Ie.position),{},{offset:Ie.position.offset-lt/2})})}))}var Ce=xe&&xe.type&&xe.type.getComposedData;Ce&&de.push({props:ts(ts({},Ce(ts(ts({},Pe),{},{displayedData:ve,props:E,dataKey:we,item:xe,bandSize:et,barPosition:le,offset:D,stackedData:xt,layout:Q,dataStartIndex:q,dataEndIndex:H}))),{},Pa(Pa(Pa({key:xe.key||"item-".concat(Me)},fe,Pe[fe]),oe,Pe[oe]),"animationId",U)),childIndex:xEt(xe,E.children),item:xe})}),de},b=function(E,T){var P=E.props,R=E.dataStartIndex,D=E.dataEndIndex,U=E.updateId;if(!DCe({props:P}))return null;var q=P.children,H=P.layout,G=P.stackOffset,Q=P.data,ne=P.reverseStackOrder,ie=vTe(H),he=ie.numericAxisName,se=ie.cateAxisName,fe=vp(q,n),oe=CUt(Q,fe,"".concat(he,"Id"),"".concat(se,"Id"),G,ne),ce=u.reduce(function(be,we){var tt="".concat(we.axisType,"Map");return ts(ts({},be),{},Pa({},tt,FXt(P,ts(ts({},we),{},{graphicalItems:fe,stackGroups:we.axisType===he&&oe,dataStartIndex:R,dataEndIndex:D}))))},{}),de=$Xt(ts(ts({},ce),{},{props:P,graphicalItems:fe}),T==null?void 0:T.legendBBox);Object.keys(ce).forEach(function(be){ce[be]=x(P,ce[be],de,be.replace("Map",""),s)});var xe=ce["".concat(se,"Map")],Me=zXt(xe),ve=v(P,ts(ts({},ce),{},{dataStartIndex:R,dataEndIndex:D,updateId:U,graphicalItems:fe,stackGroups:oe,offset:de}));return ts(ts({formattedGraphicalItems:ve,graphicalItems:fe,offset:de,stackGroups:oe},Me),ce)},N=function(M){function E(T){var P,R,D;return bXt(this,E),D=kXt(this,E,[T]),Pa(D,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Pa(D,"accessibilityManager",new oXt),Pa(D,"handleLegendBBoxUpdate",function(U){if(U){var q=D.state,H=q.dataStartIndex,G=q.dataEndIndex,Q=q.updateId;D.setState(ts({legendBBox:U},b({props:D.props,dataStartIndex:H,dataEndIndex:G,updateId:Q},ts(ts({},D.state),{},{legendBBox:U}))))}}),Pa(D,"handleReceiveSyncEvent",function(U,q,H){if(D.props.syncId===U){if(H===D.eventEmitterSymbol&&typeof D.props.syncMethod!="function")return;D.applySyncEvent(q)}}),Pa(D,"handleBrushChange",function(U){var q=U.startIndex,H=U.endIndex;if(q!==D.state.dataStartIndex||H!==D.state.dataEndIndex){var G=D.state.updateId;D.setState(function(){return ts({dataStartIndex:q,dataEndIndex:H},b({props:D.props,dataStartIndex:q,dataEndIndex:H,updateId:G},D.state))}),D.triggerSyncEvent({dataStartIndex:q,dataEndIndex:H})}}),Pa(D,"handleMouseEnter",function(U){var q=D.getMouseInfo(U);if(q){var H=ts(ts({},q),{},{isTooltipActive:!0});D.setState(H),D.triggerSyncEvent(H);var G=D.props.onMouseEnter;Xa(G)&&G(H,U)}}),Pa(D,"triggeredAfterMouseMove",function(U){var q=D.getMouseInfo(U),H=q?ts(ts({},q),{},{isTooltipActive:!0}):{isTooltipActive:!1};D.setState(H),D.triggerSyncEvent(H);var G=D.props.onMouseMove;Xa(G)&&G(H,U)}),Pa(D,"handleItemMouseEnter",function(U){D.setState(function(){return{isTooltipActive:!0,activeItem:U,activePayload:U.tooltipPayload,activeCoordinate:U.tooltipPosition||{x:U.cx,y:U.cy}}})}),Pa(D,"handleItemMouseLeave",function(){D.setState(function(){return{isTooltipActive:!1}})}),Pa(D,"handleMouseMove",function(U){U.persist(),D.throttleTriggeredAfterMouseMove(U)}),Pa(D,"handleMouseLeave",function(U){D.throttleTriggeredAfterMouseMove.cancel();var q={isTooltipActive:!1};D.setState(q),D.triggerSyncEvent(q);var H=D.props.onMouseLeave;Xa(H)&&H(q,U)}),Pa(D,"handleOuterEvent",function(U){var q=gEt(U),H=km(D.props,"".concat(q));if(q&&Xa(H)){var G,Q;/.*touch.*/i.test(q)?Q=D.getMouseInfo(U.changedTouches[0]):Q=D.getMouseInfo(U),H((G=Q)!==null&&G!==void 0?G:{},U)}}),Pa(D,"handleClick",function(U){var q=D.getMouseInfo(U);if(q){var H=ts(ts({},q),{},{isTooltipActive:!0});D.setState(H),D.triggerSyncEvent(H);var G=D.props.onClick;Xa(G)&&G(H,U)}}),Pa(D,"handleMouseDown",function(U){var q=D.props.onMouseDown;if(Xa(q)){var H=D.getMouseInfo(U);q(H,U)}}),Pa(D,"handleMouseUp",function(U){var q=D.props.onMouseUp;if(Xa(q)){var H=D.getMouseInfo(U);q(H,U)}}),Pa(D,"handleTouchMove",function(U){U.changedTouches!=null&&U.changedTouches.length>0&&D.throttleTriggeredAfterMouseMove(U.changedTouches[0])}),Pa(D,"handleTouchStart",function(U){U.changedTouches!=null&&U.changedTouches.length>0&&D.handleMouseDown(U.changedTouches[0])}),Pa(D,"handleTouchEnd",function(U){U.changedTouches!=null&&U.changedTouches.length>0&&D.handleMouseUp(U.changedTouches[0])}),Pa(D,"handleDoubleClick",function(U){var q=D.props.onDoubleClick;if(Xa(q)){var H=D.getMouseInfo(U);q(H,U)}}),Pa(D,"handleContextMenu",function(U){var q=D.props.onContextMenu;if(Xa(q)){var H=D.getMouseInfo(U);q(H,U)}}),Pa(D,"triggerSyncEvent",function(U){D.props.syncId!==void 0&&fue.emit(gue,D.props.syncId,U,D.eventEmitterSymbol)}),Pa(D,"applySyncEvent",function(U){var q=D.props,H=q.layout,G=q.syncMethod,Q=D.state.updateId,ne=U.dataStartIndex,ie=U.dataEndIndex;if(U.dataStartIndex!==void 0||U.dataEndIndex!==void 0)D.setState(ts({dataStartIndex:ne,dataEndIndex:ie},b({props:D.props,dataStartIndex:ne,dataEndIndex:ie,updateId:Q},D.state)));else if(U.activeTooltipIndex!==void 0){var he=U.chartX,se=U.chartY,fe=U.activeTooltipIndex,oe=D.state,ce=oe.offset,de=oe.tooltipTicks;if(!ce)return;if(typeof G=="function")fe=G(de,U);else if(G==="value"){fe=-1;for(var xe=0;xe=0){var xt,Ee;if(he.dataKey&&!he.allowDuplicatedCategory){var et=typeof he.dataKey=="function"?it:"payload.".concat(he.dataKey.toString());xt=Spe(xe,et,fe),Ee=Me&&ve&&Spe(ve,et,fe)}else xt=xe==null?void 0:xe[se],Ee=Me&&ve&&ve[se];if(Le||Ae){var le=U.props.activeIndex!==void 0?U.props.activeIndex:se;return[A.cloneElement(U,ts(ts(ts({},G.props),Pe),{},{activeIndex:le})),null,null]}if(!Ii(xt))return[$e].concat(y3(D.renderActivePoints({item:G,activePoint:xt,basePoint:Ee,childIndex:se,isRange:Me})))}else{var Ve,Je=(Ve=D.getItemByXY(D.state.activeCoordinate))!==null&&Ve!==void 0?Ve:{graphicalItem:$e},rt=Je.graphicalItem,je=rt.item,lt=je===void 0?U:je,Ce=rt.childIndex,Ie=ts(ts(ts({},G.props),Pe),{},{activeIndex:Ce});return[A.cloneElement(lt,Ie),null,null]}return Me?[$e,null,null]:[$e,null]}),Pa(D,"renderCustomized",function(U,q,H){return A.cloneElement(U,ts(ts({key:"recharts-customized-".concat(H)},D.props),D.state))}),Pa(D,"renderMap",{CartesianGrid:{handler:KO,once:!0},ReferenceArea:{handler:D.renderReferenceElement},ReferenceLine:{handler:KO},ReferenceDot:{handler:D.renderReferenceElement},XAxis:{handler:KO},YAxis:{handler:KO},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:EP("recharts"),"-clip"),D.throttleTriggeredAfterMouseMove=G$e(D.triggeredAfterMouseMove,(R=T.throttleDelay)!==null&&R!==void 0?R:1e3/60),D.state={},D}return CXt(E,M),jXt(E,[{key:"componentDidMount",value:function(){var P,R;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(P=this.props.margin.left)!==null&&P!==void 0?P:0,top:(R=this.props.margin.top)!==null&&R!==void 0?R:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var P=this.props,R=P.children,D=P.data,U=P.height,q=P.layout,H=am(R,pf);if(H){var G=H.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,ne=Jfe(this.state,D,G,Q),ie=this.state.tooltipTicks[G].coordinate,he=(this.state.offset.top+U)/2,se=q==="horizontal",fe=se?{x:ie,y:he}:{y:ie,x:he},oe=this.state.formattedGraphicalItems.find(function(de){var xe=de.item;return xe.type.name==="Scatter"});oe&&(fe=ts(ts({},fe),oe.props.points[G].tooltipPosition),ne=oe.props.points[G].tooltipPayload);var ce={activeTooltipIndex:G,isTooltipActive:!0,activeLabel:Q,activePayload:ne,activeCoordinate:fe};this.setState(ce),this.renderCursor(H),this.accessibilityManager.setIndex(G)}}}},{key:"getSnapshotBeforeUpdate",value:function(P,R){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==R.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){Mpe([am(P.children,pf)],[am(this.props.children,pf)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var P=am(this.props.children,pf);if(P&&typeof P.props.shared=="boolean"){var R=P.props.shared?"axis":"item";return i.indexOf(R)>=0?R:o}return o}},{key:"getMouseInfo",value:function(P){if(!this.container)return null;var R=this.container,D=R.getBoundingClientRect(),U=qzt(D),q={chartX:Math.round(P.pageX-U.left),chartY:Math.round(P.pageY-U.top)},H=D.width/R.offsetWidth||1,G=this.inRange(q.chartX,q.chartY,H);if(!G)return null;var Q=this.state,ne=Q.xAxisMap,ie=Q.yAxisMap,he=this.getTooltipEventType(),se=xTe(this.state,this.props.data,this.props.layout,G);if(he!=="axis"&&ne&&ie){var fe=m1(ne).scale,oe=m1(ie).scale,ce=fe&&fe.invert?fe.invert(q.chartX):null,de=oe&&oe.invert?oe.invert(q.chartY):null;return ts(ts({},q),{},{xValue:ce,yValue:de},se)}return se?ts(ts({},q),se):null}},{key:"inRange",value:function(P,R){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,U=this.props.layout,q=P/D,H=R/D;if(U==="horizontal"||U==="vertical"){var G=this.state.offset,Q=q>=G.left&&q<=G.left+G.width&&H>=G.top&&H<=G.top+G.height;return Q?{x:q,y:H}:null}var ne=this.state,ie=ne.angleAxisMap,he=ne.radiusAxisMap;if(ie&&he){var se=m1(ie);return H5e({x:q,y:H},se)}return null}},{key:"parseEventsOfWrapper",value:function(){var P=this.props.children,R=this.getTooltipEventType(),D=am(P,pf),U={};D&&R==="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 q=rse(this.props,this.handleOuterEvent);return ts(ts({},q),U)}},{key:"addListener",value:function(){fue.on(gue,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){fue.removeListener(gue,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(P,R,D){for(var U=this.state.formattedGraphicalItems,q=0,H=U.length;q");return e}const _Ve=A.forwardRef(({id:e,className:t,children:s,config:n,...a},o)=>{const l=A.useId(),i=`chart-${e||l.replace(/:/g,"")}`;return r.jsx(yVe.Provider,{value:{config:n},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(WXt,{id:i,config:n}),r.jsx(Xpe,{children:s})]})})});_Ve.displayName="Chart";const WXt=({id:e,config:t})=>{const s=Object.entries(t).filter(([n,a])=>a.theme||a.color);return s.length?r.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(HXt).map(([n,a])=>` ${a} [data-chart=${e}] { ${s.map(([o,l])=>{var u;const i=((u=l.theme)==null?void 0:u[n])||l.color;return i?` --color-${o}: ${i};`:null}).join(` `)} } `).join(` `)}}):null},bVe=A.forwardRef(({active:e,payload:t,className:s,indicator:n="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}=vVe(),k=A.useMemo(()=>{var D;if(a||!(t!=null&&t.length))return null;const[E]=t,T=`${v||E.dataKey||E.name||"value"}`,P=ege(N,E,T),R=!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(R,t)}):R?r.jsx("div",{className:Ut("font-medium",u),children:R}):null},[l,i,t,a,u,N,v]);if(!e||!(t!=null&&t.length))return null;const M=t.length===1&&n!=="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",s),children:[M?null:k,r.jsx("div",{className:"grid gap-1.5",children:t.map((E,T)=>{const P=`${y||E.name||E.dataKey||"value"}`,R=ege(N,E,P),D=x||E.payload.fill||E.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",n==="dot"&&"items-center"),children:m&&(E==null?void 0:E.value)!==void 0&&E.name?m(E.value,E.name,E,T,E.payload):r.jsxs(r.Fragment,{children:[R!=null&&R.icon?r.jsx(R.icon,{}):!o&&r.jsx("div",{className:Ut("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":n==="dot","w-1":n==="line","w-0 border-[1.5px] border-dashed bg-transparent":n==="dashed","my-0.5":M&&n==="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:(R==null?void 0:R.label)||E.name})]}),E.value&&r.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:E.value.toLocaleString()})]})]})},E.dataKey)})})]})});bVe.displayName="ChartTooltip";const GXt=A.forwardRef(({className:e,hideIcon:t=!1,payload:s,verticalAlign:n="bottom",nameKey:a},o)=>{const{config:l}=vVe();return s!=null&&s.length?r.jsx("div",{ref:o,className:Ut("flex items-center justify-center gap-4",n==="top"?"pb-3":"pt-3",e),children:s.map(i=>{const u=`${a||i.dataKey||"value"}`,m=ege(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});GXt.displayName="ChartLegend";function ege(e,t,s){if(typeof t!="object"||t===null)return;const n="payload"in t&&typeof t.payload=="object"&&t.payload!==null?t.payload:void 0;let a=s;return s in t&&typeof t[s]=="string"?a=t[s]:n&&s in n&&typeof n[s]=="string"&&(a=n[s]),a in e?e[a]:e[s]}const ZO=["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 wVe({stats:e,year:t}){const s=e.transactionsByMonth.some(a=>a.count>0),n=e.leadSourceBreakdown.length>0;return!s&&!n?r.jsx(He,{children:r.jsx(Xe,{className:"py-12 text-center text-muted-foreground",children:"Add transactions to see your performance charts"})}):r.jsxs("div",{className:"grid gap-6",children:[s&&r.jsxs(He,{className:"overflow-hidden",children:[r.jsx(Vt,{children:r.jsx(Gt,{className:"text-base",children:"Transactions by Month"})}),r.jsx(Xe,{className:"overflow-hidden",children:r.jsx(_Ve,{config:{count:{label:"Transactions",color:"hsl(var(--primary))"}},className:"h-[250px]",children:r.jsx(Xpe,{width:"100%",height:"100%",children:r.jsxs(qXt,{data:e.transactionsByMonth,margin:{top:5,right:10,left:0,bottom:5},children:[r.jsx(rVe,{strokeDasharray:"3 3",className:"stroke-muted"}),r.jsx(Bie,{dataKey:"month",tick:{fontSize:11},className:"fill-muted-foreground",interval:0}),r.jsx($ie,{allowDecimals:!1,tick:{fontSize:12},className:"fill-muted-foreground",width:30}),r.jsx(pf,{content:r.jsx(bVe,{})}),r.jsx(Bk,{dataKey:"count",fill:"hsl(var(--primary))",radius:[4,4,0,0],name:"Transactions"})]})})})})]}),n&&r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsx(Gt,{className:"text-base",children:"Lead Sources"})}),r.jsxs(Xe,{children:[r.jsx("div",{className:"h-[250px]",children:r.jsx(Xpe,{width:"100%",height:"100%",children:r.jsxs(VXt,{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(fie,{fill:ZO[o%ZO.length]},`cell-${o}`))}),r.jsx(pf,{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:ZO[o%ZO.length]}}),r.jsx("span",{className:"text-muted-foreground",children:a.name})]},a.name))})]})]})]})}function KXt(e){if(!e||!e.trim())return null;const t=e.trim(),s=["yyyy-MM-dd","M/d/yyyy","MM/dd/yyyy","M-d-yyyy","MM-dd-yyyy","MM/dd/yy","M/d/yy"];for(const n of s)try{const a=hye(t,n,new Date);if(gme(a))return rs(a,"yyyy-MM-dd")}catch{}try{const n=new Date(t);if(gme(n))return rs(n,"yyyy-MM-dd")}catch{}return null}const ZXt=["property_address","city","state","zip","transaction_type","close_date","sale_price","commission_amount","lead_source","client_type","is_win","notes"];function YXt({open:e,onOpenChange:t}){const[s,n]=A.useState([]),[a,o]=A.useState(!1),[l,i]=A.useState(0),{data:u}=hae(),{data:m}=Vf(),x=mae(),y=()=>{const E=ZXt.join(","),T=["123 Main St","Dallas","TX","75001","buyer","2024-06-15","450000","13500","Referral","Past Client","yes","Great transaction!"].join(","),P=`${E} ${T}`,R=new Blob([P],{type:"text/csv"}),D=URL.createObjectURL(R),U=document.createElement("a");U.href=D,U.download="transaction-import-template.csv",U.click(),URL.revokeObjectURL(D)},v=E=>{const T=E.split(` `).filter(R=>R.trim());if(T.length<2)return[];const P=T[0].split(",").map(R=>R.trim().toLowerCase().replace(/['"]/g,""));return T.slice(1).map((R,D)=>{var ce,de,xe,Me;const U=[];let q="",H=!1;for(const ve of R)ve==='"'?H=!H:ve===","&&!H?(U.push(q.trim()),q=""):q+=ve;U.push(q.trim());const G=ve=>{var we;const be=P.indexOf(ve);return be>=0?(we=U[be])==null?void 0:we.replace(/^["']|["']$/g,"").trim():""},Q=(ce=G("transaction_type"))==null?void 0:ce.toLowerCase(),ne=(de=G("sale_price"))==null?void 0:de.replace(/[$,]/g,""),ie=(xe=G("commission_amount"))==null?void 0:xe.replace(/[$,]/g,""),he=(Me=G("is_win"))==null?void 0:Me.toLowerCase(),se=G("close_date"),fe=KXt(se);let oe;return G("property_address")?["buyer","seller"].includes(Q)?fe?(!ne||isNaN(Number(ne)))&&(oe="Invalid sale price"):oe=`Invalid date format: "${se}" - use MM/DD/YYYY or YYYY-MM-DD`:oe='Transaction type must be "buyer" or "seller"':oe="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:fe||"",sale_price:Number(ne)||0,commission_amount:ie?Number(ie):null,lead_source_name:G("lead_source"),client_type_name:G("client_type"),is_win:["yes","true","1"].includes(he),notes:G("notes"),error:oe}})},b=E=>{var R;const T=(R=E.target.files)==null?void 0:R[0];if(!T)return;const P=new FileReader;P.onload=D=>{var H;const U=(H=D.target)==null?void 0:H.result,q=v(U);n(q)},P.readAsText(T)},N=async()=>{const E=s.filter(R=>!R.error);if(E.length===0){Te.error("No valid transactions to import");return}o(!0),i(0);let T=0,P=0;for(let R=0;RH.name.toLowerCase()===D.lead_source_name.toLowerCase()),q=m==null?void 0:m.find(H=>H.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:(q==null?void 0:q.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((R+1)/E.length*100))}o(!1),T>0&&Te.success(`Imported ${T} transaction${T>1?"s":""}`),P>0&&Te.error(`Failed to import ${P} transaction${P>1?"s":""}`),n([]),t(!1)},k=s.filter(E=>!E.error).length,M=s.filter(E=>E.error).length;return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Pr,{className:"max-w-2xl max-h-[90vh]",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Import Transactions"}),r.jsx(Zs,{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($i,{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(ot,{id:"csv-file",type:"file",accept:".csv",onChange:b})]}),s.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:[s.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(vl,{className:"h-3 w-3 mr-1"}),M," errors"]})]}),r.jsx(Yo,{className:"h-[200px] border rounded-lg",children:r.jsxs("div",{className:"p-2 space-y-2",children:[s.slice(0,10).map((E,T)=>r.jsxs("div",{className:`p-2 rounded text-sm ${E.error?"bg-destructive/10":"bg-muted/50"}`,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-medium",children:E.property_address||"(no address)"}),r.jsx(Tt,{variant:E.transaction_type==="buyer"?"default":"secondary",children:E.transaction_type})]}),r.jsxs("div",{className:"text-muted-foreground",children:[E.close_date," • $",E.sale_price.toLocaleString()]}),E.error&&r.jsx(B0e,{variant:"destructive",className:"mt-1 py-1",children:r.jsx($0e,{className:"text-xs",children:E.error})})]},T)),s.length>10&&r.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["...and ",s.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(so,{className:"h-4 w-4 mr-2"}),"Import ",k," Transaction",k!==1?"s":""]})]})]})]})})}const XXt=Ev({transactions_goal:$A().min(0).optional(),volume_goal:$A().min(0).optional(),gci_goal:$A().min(0).optional()});function QXt({open:e,onOpenChange:t,year:s,existingGoals:n}){const a=jxt(),{data:o}=pae(),l=(o==null?void 0:o.show_commission)??!0,i=sae({resolver:nae(XXt),defaultValues:{transactions_goal:void 0,volume_goal:void 0,gci_goal:void 0}});A.useEffect(()=>{n?i.reset({transactions_goal:n.transactions_goal??void 0,volume_goal:n.volume_goal?Number(n.volume_goal):void 0,gci_goal:n.gci_goal?Number(n.gci_goal):void 0}):i.reset({transactions_goal:void 0,volume_goal:void 0,gci_goal:void 0})},[n,i,e]);const u=async m=>{await a.mutateAsync({year:s,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(Pr,{className:"max-w-md",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{children:[s," Goals"]}),r.jsx(Zs,{children:"Set your annual targets to track your progress throughout the year."})]}),r.jsx(aae,{...i,children:r.jsxs("form",{onSubmit:i.handleSubmit(u),className:"space-y-4",children:[r.jsx(Rl,{control:i.control,name:"transactions_goal",render:({field:m})=>r.jsxs(Cl,{children:[r.jsx(Ml,{children:"Transactions Goal"}),r.jsx(Tl,{children:r.jsx(ot,{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(Wee,{children:"Total number of deals you want to close"}),r.jsx(Yu,{})]})}),r.jsx(Rl,{control:i.control,name:"volume_goal",render:({field:m})=>r.jsxs(Cl,{children:[r.jsx(Ml,{children:"Volume Goal ($)"}),r.jsx(Tl,{children:r.jsx(ot,{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(Wee,{children:"Total sales volume you want to achieve"}),r.jsx(Yu,{})]})}),l&&r.jsx(Rl,{control:i.control,name:"gci_goal",render:({field:m})=>r.jsxs(Cl,{children:[r.jsx(Ml,{children:"GCI Goal ($)"}),r.jsx(Tl,{children:r.jsx(ot,{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(Wee,{children:"Gross commission income target"}),r.jsx(Yu,{})]})}),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 jVe({transactions:e,isLoading:t}){const s=A.useRef(null),n=A.useRef(null),a=A.useRef([]),o=A.useRef(null),{isAdmin:l}=Yr(),[i,u]=A.useState(""),[m,x]=A.useState(!0),[y,v]=A.useState(0),[b,N]=A.useState(!1),k=e.filter(E=>E.latitude!=null&&E.longitude!=null),M=e.filter(E=>E.latitude==null||E.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 R of M){const D=[R.property_address,R.city,R.state,R.zip].filter(Boolean).join(", ");if(D)try{const q=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(D)}.json?access_token=${i}&limit=1`)).json();if((P=q.features)!=null&&P[0]){const[H,G]=q.features[0].center;await Y.from("scorecard_transactions").update({latitude:G,longitude:H}).eq("id",R.id),R.latitude=G,R.longitude=H,T++}}catch(U){console.error("Geocode error:",U)}}v(T),N(!1)})()},[i,e]),A.useEffect(()=>{if(!s.current||!i||n.current)return;sc.accessToken=i;const E=e.filter(R=>R.latitude!=null&&R.longitude!=null);let T=[-98.5795,39.8283],P=4;if(E.length>0){const R=E.reduce((U,q)=>U+q.longitude,0)/E.length,D=E.reduce((U,q)=>U+q.latitude,0)/E.length;T=[R,D],P=E.length===1?12:10}return n.current=new sc.Map({container:s.current,style:"mapbox://styles/mapbox/light-v11",zoom:P,center:T}),n.current.addControl(new sc.NavigationControl,"top-right"),()=>{var R;(R=n.current)==null||R.remove(),n.current=null}},[i]),A.useEffect(()=>{var T;if(!n.current||!i)return;a.current.forEach(P=>P.remove()),a.current=[],(T=o.current)==null||T.remove();const E=e.filter(P=>P.latitude!=null&&P.longitude!=null);if(E.forEach(P=>{var G;const R=P.transaction_type==="buyer",D=R?"#3B82F6":"#10B981",U=document.createElement("div");U.className="cursor-pointer",U.innerHTML=`
${R?'':''}
`;const q=new sc.Popup({offset:25,closeButton:!0}).setHTML(`
${P.property_address}
${P.city?`
${P.city}${P.state?", "+P.state:""} ${P.zip||""}
`:""}
${R?"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||""}
`:""}
`),H=new sc.Marker(U).setLngLat([P.longitude,P.latitude]).setPopup(q).addTo(n.current);a.current.push(H)}),E.length>1){const P=new sc.LngLatBounds;E.forEach(R=>P.extend([R.longitude,R.latitude])),n.current.fitBounds(P,{padding:60,maxZoom:13})}else E.length===1&&n.current.flyTo({center:[E[0].longitude,E[0].latitude],zoom:12})},[e,i,b]),m||t?r.jsx(He,{children:r.jsx(Xe,{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(Xe,{className:"flex flex-col items-center justify-center h-[50vh] text-center gap-3",children:[r.jsx(po,{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:s,className:"w-full h-[55vh] rounded-lg shadow-lg border"})]}):r.jsx(He,{children:r.jsxs(Xe,{className:"flex flex-col items-center justify-center h-[50vh] text-center gap-3",children:[r.jsx(vl,{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 kVe=new Date().getFullYear(),JXt=Array.from({length:10},(e,t)=>kVe-t);function eQt(){var D;const[e,t]=A.useState(kVe),[s,n]=A.useState(!1),[a,o]=A.useState(!1),[l,i]=A.useState(!1),[u,m]=A.useState(!1),{data:x,isLoading:y}=$ye(e),{yearStats:v,lifetimeStats:b,showCommission:N}=WRe(e),{data:k,isLoading:M}=HRe(e),{data:E}=pae(),T=kxt(),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"],q=x.map(ie=>{var he,se;return[ie.property_address,ie.city||"",ie.state||"",ie.zip||"",ie.transaction_type,ie.close_date,ie.sale_price,...N?[ie.commission_amount||""]:[],((he=ie.lead_source)==null?void 0:he.name)||"",((se=ie.client_type)==null?void 0:se.name)||"",ie.contact?`${ie.contact.first_name} ${ie.contact.last_name||""}`.trim():"",ie.is_win?"Yes":"No",ie.notes||""]}),H=[U,...q].map(ie=>ie.map(he=>`"${String(he).replace(/"/g,'""')}"`).join(",")).join(` `),G=new Blob([H],{type:"text/csv"}),Q=URL.createObjectURL(G),ne=document.createElement("a");ne.href=Q,ne.download=`transactions-${e}.csv`,ne.click(),URL.revokeObjectURL(Q)},R=!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(us,{value:String(e),onValueChange:U=>t(Number(U)),children:[r.jsx(cs,{className:"w-[120px]",children:r.jsx(ms,{})}),r.jsx(ds,{children:JXt.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(Vt,{className:"pb-3",children:r.jsx(Gt,{className:"text-lg",children:"Settings"})}),r.jsx(Xe,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(ze,{children:"Show Commission"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Display commission fields and include in stats"})]}),r.jsx(In,{checked:(E==null?void 0:E.show_commission)??!0,onCheckedChange:U=>T.mutate({show_commission:U})})]})})]}),R&&!y?r.jsx(He,{className:"py-12",children:r.jsxs(Xe,{className:"text-center space-y-4",children:[r.jsx("div",{className:"w-16 h-16 mx-auto rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(wc,{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:()=>n(!0),children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Add Your First Transaction"]}),r.jsxs(X,{variant:"outline",onClick:()=>o(!0),children:[r.jsx(so,{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($i,{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:()=>n(!0),children:[r.jsx(vs,{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(so,{className:"h-4 w-4 mr-2"}),"Import"]}),r.jsxs(X,{variant:"outline",onClick:P,disabled:R,children:[r.jsx($i,{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($i,{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(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(sa,{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(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(qs,{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(Xe,{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(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(bu,{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(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx($l,{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(Xe,{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(IBe,{goals:k,stats:v,year:e,showCommission:N}),r.jsxs(Si,{defaultValue:"transactions",className:"space-y-4",children:[r.jsxs(ki,{children:[r.jsx(is,{value:"transactions",children:"Transactions"}),r.jsx(is,{value:"charts",children:"Charts"}),r.jsxs(is,{value:"map",children:[r.jsx(po,{className:"h-4 w-4 mr-1"}),"Map"]})]}),r.jsx(Ss,{value:"transactions",children:r.jsx(EBe,{transactions:x||[],showCommission:N,isLoading:y})}),r.jsx(Ss,{value:"charts",children:r.jsx(wVe,{stats:v,year:e})}),r.jsx(Ss,{value:"map",children:r.jsx(jVe,{transactions:x||[],isLoading:y})})]})]})]}),r.jsx(ABe,{open:s,onOpenChange:n}),r.jsx(YXt,{open:a,onOpenChange:o}),r.jsx(QXt,{open:l,onOpenChange:i,year:e,existingGoals:k})]})}function NVe({open:e,onOpenChange:t,listingId:s,listingSlug:n,listingTitle:a}){const{user:o}=Yr(),[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:E}=await Y.from("listing_shares").select("id, share_token, click_count, lead_count").eq("listing_id",s).eq("sharing_agent_id",o.id).order("created_at",{ascending:!1}).limit(1).maybeSingle();if(E)throw E;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:s,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),Te.error("Failed to generate share link")}finally{m(!1)}}})()},[e,o,s]);const v=l!=null&&l.share_token?`https://listings.relevelup.com/${n||s}?ref=${l.share_token}`:"",b=async()=>{try{await navigator.clipboard.writeText(v),y(!0),Te.success("Link copied to clipboard!"),setTimeout(()=>y(!1),2e3)}catch{Te.error("Failed to copy link")}},N=k=>{const M=encodeURIComponent(v),E=encodeURIComponent(`Check out this listing: ${a}`);switch(k){case"email":window.open(`mailto:?subject=${E}&body=${M}`);break;case"text":window.open(`sms:?body=${E}%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(Pr,{className:"sm:max-w-md",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5 text-amber-500"}),"Share & Earn Leads"]}),r.jsx(Zs,{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(ot,{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(Mo,{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(Nn,{className:"h-4 w-4 mr-2"}),"Email"]}),r.jsxs(X,{variant:"outline",className:"flex-1",onClick:()=>N("text"),disabled:u,children:[r.jsx(Bo,{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(mo,{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(qs,{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 tQt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},rQt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},sQt={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function YO({listing:e,onClick:t,onEdit:s,onDelete:n,showActions:a}){var k,M;const{user:o}=Yr(),{data:l}=FRe(e.id),i=RRe(),[u,m]=A.useState(!1),x=E=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(E),y=((k=e.photos)==null?void 0:k.find(E=>E.is_primary))||((M=e.photos)==null?void 0:M[0]),v=(o==null?void 0:o.id)===e.agent_id,b=async E=>{E.stopPropagation();try{const T=await i.mutateAsync(e.id);Te.success(T.saved?"Listing saved!":"Listing removed from saved")}catch{Te.error("Failed to save listing")}},N=E=>{if(E.stopPropagation(),o)m(!0);else{const T=`https://listings.relevelup.com/${e.slug||e.id}`;navigator.clipboard.writeText(T),Te.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(qg,{className:"h-12 w-12"})}),r.jsx(Tt,{className:`absolute top-2 left-2 ${tQt[e.status]} text-white border-0`,children:rQt[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(Mn,{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(Cc,{className:"h-4 w-4"}):r.jsx(Bn,{className:"h-4 w-4 text-amber-500"})})]})]}),r.jsx(NVe,{open:u,onOpenChange:m,listingId:e.id,listingSlug:e.slug||null,listingTitle:e.property_address||`${e.city}, ${e.state}`}),r.jsxs(Xe,{className:"p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-xl font-bold text-primary",children:x(e.price)}),e.open_to_referrals&&r.jsxs(Tt,{variant:"outline",className:"text-xs",children:[r.jsx(qs,{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(po,{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(qg,{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:sQt[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(mo,{className:"h-3 w-3"}),e.view_count]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Cc,{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&&(s||n)&&r.jsxs("div",{className:"flex gap-2",children:[s&&r.jsxs(X,{variant:"outline",size:"sm",className:"flex-1",onClick:E=>{E.stopPropagation(),s()},children:[r.jsx(vc,{className:"h-4 w-4 mr-2"}),"Edit"]}),n&&r.jsx(X,{variant:"destructive",size:"sm",onClick:E=>{E.stopPropagation(),n()},children:r.jsx(Bs,{className:"h-4 w-4"})})]})]})]})}const nQt=[{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"}],aQt=[{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 iQt({filters:e,onFiltersChange:t,onClose:s}){const n=()=>{t({sortBy:"newest"})};return r.jsxs(He,{children:[r.jsxs(Vt,{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:n,children:"Clear All"}),r.jsx(X,{variant:"ghost",size:"icon",onClick:s,children:r.jsx(en,{className:"h-4 w-4"})})]})]}),r.jsxs(Xe,{children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Status"}),r.jsxs(us,{value:e.status||"all",onValueChange:a=>t({...e,status:a==="all"?void 0:a}),children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"All statuses"})}),r.jsxs(ds,{children:[r.jsx($t,{value:"all",children:"All Statuses"}),nQt.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(us,{value:e.propertyType||"all",onValueChange:a=>t({...e,propertyType:a==="all"?void 0:a}),children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"All types"})}),r.jsxs(ds,{children:[r.jsx($t,{value:"all",children:"All Types"}),aQt.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(ot,{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(ot,{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(In,{checked:e.openToReferrals||!1,onCheckedChange:a=>t({...e,openToReferrals:a||void 0})})]})]})]})}function oQt({leaderboard:e}){const t=n=>{switch(n){case 0:return r.jsx(lo,{className:"h-5 w-5 text-amber-500"});case 1:return r.jsx(py,{className:"h-5 w-5 text-gray-400"});case 2:return r.jsx($l,{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:n+1})}},s=(n,a)=>!n||n.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:n.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(Vt,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(lo,{className:"h-5 w-5 text-amber-500"}),"Community Badges"]})}),r.jsx(Xe,{children:r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"text-center p-4 rounded-lg bg-gradient-to-br from-emerald-500/10 to-emerald-500/5 border border-emerald-500/20",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-emerald-500/20 flex items-center justify-center",children:r.jsx(Cc,{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(sa,{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(py,{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(lo,{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(Vt,{children:r.jsx(Gt,{children:"Community Leaderboard"})}),r.jsx(Xe,{children:r.jsxs(Si,{defaultValue:"sharers",children:[r.jsxs(ki,{className:"w-full",children:[r.jsxs(is,{value:"sharers",className:"flex-1",children:[r.jsx(Cc,{className:"h-4 w-4 mr-2"}),"Top Sharers"]}),r.jsxs(is,{value:"listers",className:"flex-1",children:[r.jsx(sa,{className:"h-4 w-4 mr-2"}),"Top Contributors"]})]}),r.jsx(Ss,{value:"sharers",className:"mt-4",children:s(e==null?void 0:e.topSharers,"shares")}),r.jsx(Ss,{value:"listers",className:"mt-4",children:s(e==null?void 0:e.topListers,"listings")})]})})]})]})}const _Te={coming_soon:"#F59E0B",active:"#10B981",price_improvement:"#8B5CF6",under_contract:"#3B82F6",sold:"#A855F7"},bTe={coming_soon:"Coming Soon",active:"Active",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"};function lQt(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:`$${(e/1e3).toFixed(0)}K`}function cQt({listings:e,isLoading:t}){const s=Hs(),n=A.useRef(null),a=A.useRef(null),o=A.useRef([]),{isAdmin:l}=Yr(),[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 E of N){const T=[E.property_address,E.city,E.state].filter(Boolean).join(", ");if(T)try{const R=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(T)}.json?access_token=${i}&limit=1`)).json();if((M=R.features)!=null&&M[0]){const[D,U]=R.features[0].center;await Y.from("listings").update({latitude:U,longitude:D}).eq("id",E.id),E.latitude=U,E.longitude=D}}catch(P){console.error("Geocode error:",P)}}v(!1)})()},[i,e]),A.useEffect(()=>{if(!n.current||!i||a.current)return;sc.accessToken=i;const k=e.filter(T=>T.latitude!=null&&T.longitude!=null);let M=[-98.5795,39.8283],E=4;if(k.length>0){const T=k.reduce((R,D)=>R+D.longitude,0)/k.length,P=k.reduce((R,D)=>R+D.latitude,0)/k.length;M=[T,P],E=k.length===1?12:10}return a.current=new sc.Map({container:n.current,style:"mapbox://styles/mapbox/light-v11",zoom:E,center:M}),a.current.addControl(new sc.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,q,H;const E=_Te[M.status]||"#10B981",T=((U=M.photos)==null?void 0:U.find(G=>G.is_primary))||((q=M.photos)==null?void 0:q[0]),P=document.createElement("div");P.className="cursor-pointer",P.innerHTML=`
`;const R=new sc.Popup({offset:25,closeButton:!0,maxWidth:"280px"}).setHTML(`
${T!=null&&T.photo_url?``:""}
${lQt(M.price)}
${M.property_address||""}
${M.city}, ${M.state}
${bTe[M.status]||M.status} ${M.bedrooms?`${M.bedrooms} bed`:""} ${M.bathrooms?`${M.bathrooms} bath`:""}
${(H=M.agent)!=null&&H.name?`
Listed by ${M.agent.name}
`:""}
Click to view details →
`),D=new sc.Marker(P).setLngLat([M.longitude,M.latitude]).setPopup(R).addTo(a.current);o.current.push(D)}),k.length>1){const M=new sc.LngLatBounds;k.forEach(E=>M.extend([E.longitude,E.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=>{s(`/mission-control/listings/${k}`)},()=>{delete window.__navigateToListing__}),[s]),m||t?r.jsx(He,{children:r.jsx(Xe,{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(Xe,{className:"flex flex-col items-center justify-center h-[60vh] text-center gap-3",children:[r.jsx(po,{className:"h-12 w-12 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"No Listings Yet"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Add listings to see them on the map."})]})]})}):r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm",children:[Object.entries(_Te).map(([k,M])=>r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("div",{className:"w-3 h-3 rounded-full border-2 border-white shadow",style:{background:M}}),r.jsx("span",{className:"text-xs",children:bTe[k]})]},k)),r.jsxs("span",{className:"text-muted-foreground ml-auto text-xs",children:[b.length," of ",e.length," mapped",y&&" · Geocoding..."]})]}),r.jsx("div",{ref:n,className:"w-full h-[60vh] rounded-lg shadow-lg border"})]}):r.jsx(He,{children:r.jsxs(Xe,{className:"flex flex-col items-center justify-center h-[60vh] text-center gap-3",children:[r.jsx(vl,{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 dQt(){var G,Q,ne,ie,he,se,fe,oe;const e=Hs(),{brokerageId:t}=Yr(),{data:s,isLoading:n}=IRe(),[a,o]=A.useState("feed"),[l,i]=A.useState(!1),[u,m]=A.useState(""),[x,y]=A.useState({sortBy:"newest"}),{data:v,isLoading:b}=PRe({...x,city:u||x.city}),{data:N,isLoading:k}=oxt(),{data:M,isLoading:E}=LRe(),{data:T,isLoading:P}=uxt(),{data:R,isLoading:D}=pxt(),{data:U}=mxt(),q=DRe(),H=async ce=>{if(confirm("Are you sure you want to delete this listing? This action cannot be undone."))try{await q.mutateAsync(ce),Te.success("Listing deleted successfully")}catch{Te.error("Failed to delete listing")}};return n?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"})})}):s?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(vs,{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(Xe,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(sa,{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(Xe,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-pink-500/10 rounded-lg",children:r.jsx(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(Xe,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-emerald-500/10 rounded-lg",children:r.jsx(Ij,{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(Xe,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-sky-500/10 rounded-lg",children:r.jsx(qs,{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(Si,{value:a,onValueChange:o,children:[r.jsxs(ki,{className:"w-full justify-start overflow-x-auto",children:[r.jsx(is,{value:"feed",children:"Community Feed"}),t&&r.jsx(is,{value:"brokerage",children:"Brokerage"}),r.jsx(is,{value:"my-listings",children:"My Listings"}),r.jsx(is,{value:"saved",children:"Saved"}),r.jsx(is,{value:"referrals",children:"Referrals"}),r.jsx(is,{value:"map",children:"Map"}),r.jsx(is,{value:"leaderboard",children:"Leaderboard"})]}),r.jsxs(Ss,{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(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by city or neighborhood...",value:u,onChange:ce=>m(ce.target.value),className:"pl-9"})]}),r.jsxs(us,{value:x.sortBy,onValueChange:ce=>y({...x,sortBy:ce}),children:[r.jsx(cs,{className:"w-[180px]",children:r.jsx(ms,{placeholder:"Sort by"})}),r.jsxs(ds,{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(G1,{className:"h-4 w-4 mr-2"}),"Filters"]})]}),l&&r.jsx(iQt,{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((ce,de)=>r.jsxs(He,{children:[r.jsx(Cr,{className:"h-48 w-full"}),r.jsxs(Xe,{className:"p-4 space-y-2",children:[r.jsx(Cr,{className:"h-5 w-3/4"}),r.jsx(Cr,{className:"h-4 w-1/2"}),r.jsx(Cr,{className:"h-4 w-1/4"})]})]},de))}):(v==null?void 0:v.length)===0?r.jsx(He,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx(sa,{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(vs,{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(ce=>r.jsx(YO,{listing:ce,onClick:()=>e(`/mission-control/listings/${ce.id}`)},ce.id))})]}),r.jsx(Ss,{value:"my-listings",className:"space-y-4",children:E?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((ce,de)=>r.jsxs(He,{children:[r.jsx(Cr,{className:"h-48 w-full"}),r.jsxs(Xe,{className:"p-4 space-y-2",children:[r.jsx(Cr,{className:"h-5 w-3/4"}),r.jsx(Cr,{className:"h-4 w-1/2"})]})]},de))}):(M==null?void 0:M.length)===0?r.jsx(He,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx(Ij,{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(vs,{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(ce=>r.jsx(YO,{listing:ce,showActions:!0,onClick:()=>e(`/mission-control/listings/${ce.id}`),onEdit:()=>e(`/mission-control/listings/${ce.id}/edit`),onDelete:()=>H(ce.id)},ce.id))})}),r.jsx(Ss,{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((ce,de)=>r.jsxs(He,{children:[r.jsx(Cr,{className:"h-48 w-full"}),r.jsxs(Xe,{className:"p-4 space-y-2",children:[r.jsx(Cr,{className:"h-5 w-3/4"}),r.jsx(Cr,{className:"h-4 w-1/2"})]})]},de))}):(N==null?void 0:N.length)===0?r.jsx(He,{children:r.jsxs(Xe,{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(ce=>r.jsx(YO,{listing:ce.listing,onClick:()=>e(`/mission-control/listings/${ce.listing.id}`)},ce.id))})}),r.jsx(Ss,{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(Cc,{className:"h-4 w-4"}),"Referrals Sent (",((ne=T==null?void 0:T.sent)==null?void 0:ne.length)||0,")"]}),((ie=T==null?void 0:T.sent)==null?void 0:ie.length)===0?r.jsx(He,{children:r.jsx(Xe,{className:"py-8 text-center text-muted-foreground",children:"No referrals sent yet"})}):r.jsx("div",{className:"space-y-3",children:(he=T==null?void 0:T.sent)==null?void 0:he.map(ce=>{var de,xe;return r.jsx(He,{children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:ce.buyer_name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:((de=ce.listing)==null?void 0:de.property_address)||((xe=ce.listing)==null?void 0:xe.city)})]}),r.jsx(Tt,{variant:ce.status==="closed"?"default":"secondary",children:ce.status.replace("_"," ")})]})})},ce.id)})})]}),r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold mb-3 flex items-center gap-2",children:[r.jsx(qs,{className:"h-4 w-4"}),"Referrals Received (",((se=T==null?void 0:T.received)==null?void 0:se.length)||0,")"]}),((fe=T==null?void 0:T.received)==null?void 0:fe.length)===0?r.jsx(He,{children:r.jsx(Xe,{className:"py-8 text-center text-muted-foreground",children:"No referrals received yet"})}):r.jsx("div",{className:"space-y-3",children:(oe=T==null?void 0:T.received)==null?void 0:oe.map(ce=>{var de;return r.jsx(He,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:ce.buyer_name}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["From: ",(de=ce.sender)==null?void 0:de.name]})]}),r.jsx(Tt,{variant:ce.status==="closed"?"default":"secondary",children:ce.status.replace("_"," ")})]}),r.jsx(X,{size:"sm",variant:"outline",className:"w-full mt-2",onClick:()=>e(`/mission-control/listings/${ce.listing_id}`),children:"View Listing"})]})},ce.id)})})]})]})}),t&&r.jsx(Ss,{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((ce,de)=>r.jsxs(He,{children:[r.jsx(Cr,{className:"h-48 w-full"}),r.jsxs(Xe,{className:"p-4 space-y-2",children:[r.jsx(Cr,{className:"h-5 w-3/4"}),r.jsx(Cr,{className:"h-4 w-1/2"})]})]},de))}):(R==null?void 0:R.length)===0?r.jsx(He,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx(Ij,{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(vs,{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:R==null?void 0:R.map(ce=>r.jsx(YO,{listing:ce,onClick:()=>e(`/mission-control/listings/${ce.id}`)},ce.id))})}),r.jsx(Ss,{value:"map",children:r.jsx(cQt,{listings:v||[],isLoading:b})}),r.jsx(Ss,{value:"leaderboard",children:r.jsx(oQt,{leaderboard:U})})]})]})}):r.jsx(Dr,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:r.jsx(He,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx(sa,{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 lve(){const e=Pc();return Kt({queryKey:["deal-pipeline-stages",e],queryFn:async()=>{if(!e)return[];const{data:t,error:s}=await Y.from("deal_pipeline_stages").select("*").eq("owner_user_id",e).order("sort_order",{ascending:!0});if(s)throw s;return t},enabled:!!e})}function SVe(){const e=Pc(),t=Br();return ar({mutationFn:async()=>{if(!e)throw new Error("Not authenticated");const{error:s}=await Y.rpc("initialize_deal_pipeline_stages",{p_user_id:e});if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-stages"]})}})}function CVe(){const e=Pc();return Kt({queryKey:["deal-pipeline-deals",e],queryFn:async()=>{if(!e)return[];const{data:t,error:s}=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(s)throw s;return t},enabled:!!e})}function MVe(){const e=Pc(),t=Br();return ar({mutationFn:async s=>{if(!e)throw new Error("Not authenticated");const{data:n,error:a}=await Y.from("deal_pipeline").insert({deal_name:s.deal_name,deal_type:s.deal_type,stage_id:s.stage_id||null,contact_id:s.contact_id||null,listing_id:s.listing_id||null,property_address:s.property_address||null,city:s.city||null,state:s.state||null,zip_code:s.zip_code||null,expected_price:s.expected_price||null,expected_commission:s.expected_commission||null,commission_percentage:s.commission_percentage||3,target_close_date:s.target_close_date||null,contract_date:s.contract_date||null,listing_date:s.listing_date||null,priority:s.priority||"medium",probability:s.probability||50,notes:s.notes||null,owner_user_id:e}).select().single();if(a)throw a;return await Y.from("deal_activities").insert([{deal_id:n.id,activity_type:"system",title:"Deal created",description:`Deal "${s.deal_name}" was created`}]),n},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function TVe(){const e=Br();return ar({mutationFn:async({id:t,...s})=>{const{data:n,error:a}=await Y.from("deal_pipeline").update(s).eq("id",t).select().single();if(a)throw a;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function uQt(){const e=Br();return ar({mutationFn:async({dealId:t,stageId:s,stageName:n})=>{const{data:a,error:o}=await Y.from("deal_pipeline").update({stage_id:s}).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 ${n}`,metadata:{new_stage_id:s,new_stage_name:n}}),a},onSuccess:()=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-activities"]})}})}function hQt(){const e=Br();return ar({mutationFn:async t=>{const{error:s}=await Y.from("deal_pipeline").delete().eq("id",t);if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function mQt(e){return Kt({queryKey:["deal-activities",e],queryFn:async()=>{const{data:t,error:s}=await Y.from("deal_activities").select("*").eq("deal_id",e).order("created_at",{ascending:!1});if(s)throw s;return t},enabled:!!e})}function pQt(){const e=Br();return ar({mutationFn:async t=>{const{data:s,error:n}=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(n)throw n;return s},onSuccess:(t,s)=>{e.invalidateQueries({queryKey:["deal-activities",s.deal_id]})}})}function fQt(e){return Kt({queryKey:["deal-checklist",e],queryFn:async()=>{const{data:t,error:s}=await Y.from("deal_checklist_items").select("*").eq("deal_id",e).order("sort_order",{ascending:!0});if(s)throw s;return t},enabled:!!e})}function gQt(){const e=Br();return ar({mutationFn:async({id:t,is_completed:s,deal_id:n})=>{const{data:a,error:o}=await Y.from("deal_checklist_items").update({is_completed:s,completed_at:s?new Date().toISOString():null}).eq("id",t).select().single();if(o)throw o;return a},onSuccess:(t,s)=>{e.invalidateQueries({queryKey:["deal-checklist",s.deal_id]})}})}function xQt(){const e=Br();return ar({mutationFn:async t=>{const{data:s,error:n}=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(n)throw n;return s},onSuccess:(t,s)=>{e.invalidateQueries({queryKey:["deal-checklist",s.deal_id]})}})}function yQt(){const e=Pc();return Kt({queryKey:["deal-pipeline-stats",e],queryFn:async()=>{if(!e)return null;const{data:t,error:s}=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(s)throw s;const n=(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:n.length,wonDeals:a.length,pipelineValue:n.reduce((o,l)=>o+(l.expected_price||0),0),expectedCommission:n.reduce((o,l)=>o+(l.expected_commission||0),0),wonValue:a.reduce((o,l)=>o+(l.expected_price||0),0)}},enabled:!!e})}function vQt(e){const t=Pc();return Kt({queryKey:["deal-by-listing",e,t],queryFn:async()=>{if(!t||!e)return null;const{data:s,error:n}=await Y.from("deal_pipeline").select(` *, deal_pipeline_stages(id, name, color) `).eq("owner_user_id",t).eq("listing_id",e).maybeSingle();if(n)throw n;return s},enabled:!!t&&!!e})}function _Qt(){const e=Br();return ar({mutationFn:async({dealId:t,listingId:s})=>{const{data:n,error:a}=await Y.from("deal_pipeline").update({listing_id:s}).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:s}}),n},onSuccess:(t,s)=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-by-listing",s.listingId]})}})}function bQt(){const e=Br();return ar({mutationFn:async({dealId:t,listingId:s})=>{const{data:n,error:a}=await Y.from("deal_pipeline").update({listing_id:null}).eq("id",t).select().single();if(a)throw a;return{data:n,listingId:s}},onSuccess:t=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-by-listing",t.listingId]})}})}function wQt({listing:e}){const t=Hs(),[s,n]=A.useState(""),[a,o]=A.useState(!1),{data:l,isLoading:i}=vQt(e.id),{data:u,isLoading:m}=lve(),{data:x,isLoading:y}=CVe(),v=SVe(),b=_Qt(),N=bQt(),k=MVe(),M=(x==null?void 0:x.filter(D=>!D.listing_id))||[],E=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=E(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}),Te.success("Deal created and linked to listing!")}catch(D){console.error("Failed to create deal:",D),Te.error("Failed to create deal")}finally{o(!1)}},P=async()=>{if(!s){Te.error("Please select a deal");return}try{await b.mutateAsync({dealId:s,listingId:e.id}),Te.success("Listing linked to deal!"),n("")}catch{Te.error("Failed to link listing")}},R=async()=>{if(l)try{await N.mutateAsync({dealId:l.id,listingId:e.id}),Te.success("Listing unlinked from deal")}catch{Te.error("Failed to unlink listing")}};return i||m?r.jsxs(He,{children:[r.jsx(Vt,{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(Xe,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(Vr,{className:"h-5 w-5 animate-spin text-muted-foreground"})})})]}):l?r.jsxs(He,{className:"border-primary/20 bg-primary/5",children:[r.jsx(Vt,{className:"pb-2",children:r.jsxs(Gt,{className:"flex items-center gap-2 text-base",children:[r.jsx(ym,{className:"h-4 w-4 text-primary"}),"Linked to Pipeline"]})}),r.jsxs(Xe,{className:"space-y-3",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:l.deal_name}),r.jsx("div",{className:"flex items-center gap-2 mt-1",children:l.deal_pipeline_stages&&r.jsx(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(to,{className:"h-3 w-3 ml-1"})]}),r.jsx(X,{variant:"ghost",size:"sm",onClick:R,disabled:N.isPending,children:N.isPending?r.jsx(Vr,{className:"h-4 w-4 animate-spin"}):r.jsx(LA,{className:"h-4 w-4"})})]})]})]}):r.jsxs(He,{children:[r.jsx(Vt,{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(Xe,{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Link this listing to your pipeline to track the deal and sync status changes."}),r.jsxs(X,{onClick:T,disabled:a||k.isPending,className:"w-full",size:"sm",children:[a||k.isPending?r.jsx(Vr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(vs,{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(us,{value:s,onValueChange:n,children:[r.jsx(cs,{className:"flex-1 text-sm",children:r.jsx(ms,{placeholder:"Link to existing deal..."})}),r.jsx(ds,{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:!s||b.isPending,children:b.isPending?r.jsx(Vr,{className:"h-4 w-4 animate-spin"}):r.jsx(ym,{className:"h-4 w-4"})})]})]})]})]})}const jQt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},kQt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},wTe={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function NQt(){var he,se,fe,oe,ce,de,xe,Me,ve;const{listingId:e}=hc(),t=Hs(),{user:s}=Yr(),{data:n,isLoading:a}=ORe(e||""),{data:o}=FRe(e||""),{data:l}=cxt(e||""),i=RRe(),u=lxt(),m=dxt(),x=DRe(),y=hxt(),[v,b]=A.useState(!1),[N,k]=A.useState(!1),[M,E]=A.useState(!1),[T,P]=A.useState(null),[R,D]=A.useState({buyerName:"",buyerType:"",notes:""}),U=(s==null?void 0:s.id)===(n==null?void 0:n.agent_id),q=be=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(be),H=async be=>{const we=`https://listings.relevelup.com/${(n==null?void 0:n.slug)||(n==null?void 0:n.id)}`,tt=`Check out this listing: ${(n==null?void 0:n.property_address)||(n==null?void 0:n.city)}`;m.mutate({listingId:n.id,shareType:be});try{switch(be){case"facebook":window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(we)}`,"_blank");break;case"copy":await navigator.clipboard.writeText(we),Te.success("Link copied to clipboard!");break;case"text":window.open(`sms:?body=${encodeURIComponent(`${tt} ${we}`)}`);break;case"email":window.open(`mailto:?subject=${encodeURIComponent(tt)}&body=${encodeURIComponent(`Check out this listing: ${we}`)}`);break}}catch(Ae){console.error("Share error:",Ae),Te.error("Failed to share")}},G=async()=>{try{await x.mutateAsync(n.id),Te.success("Listing deleted"),t("/mission-control/listings")}catch{Te.error("Failed to delete listing")}},Q=async()=>{if(!R.buyerName.trim()){Te.error("Please enter buyer name");return}try{await y.mutateAsync({listingId:n.id,listingAgentId:n.agent_id,buyerName:R.buyerName,buyerType:R.buyerType||void 0,notes:R.notes||void 0}),Te.success("Referral sent successfully!"),k(!1),D({buyerName:"",buyerType:"",notes:""})}catch{Te.error("Failed to send referral")}},ne=be=>{var $e,it;const we=(n==null?void 0:n.property_address)||`${n==null?void 0:n.city}, ${n==null?void 0:n.state}`,tt=q((n==null?void 0:n.price)||0),Ae=n!=null&&n.bedrooms?`${n.bedrooms}BD`:"",Le=n!=null&&n.bathrooms?`${n.bathrooms}BA`:"",Ue=n!=null&&n.square_footage?`${n.square_footage.toLocaleString()}SF`:"",Pe=[Ae,Le,Ue].filter(Boolean).join(" | ");switch(be){case"just_listed":return`🏡 JUST LISTED! ${we} ${tt} ${Pe} ${(n==null?void 0:n.description)||"Schedule your showing today!"} #JustListed #RealEstate #HomeForSale #${($e=n==null?void 0:n.city)==null?void 0:$e.replace(/\s/g,"")}`;case"price_improvement":return`📣 PRICE IMPROVEMENT! ${we} Now ${tt}! ${Pe} Don't miss this opportunity! #PriceReduced #RealEstate #HomeForSale`;case"teaser":return`Looking for a ${wTe[(n==null?void 0:n.property_type)||"single_family"].toLowerCase()} in ${n==null?void 0:n.city}? 👀 I've got just the one for you! ${Pe} DM me for details! 📩 #ComingSoon #RealEstate #${(it=n==null?void 0:n.city)==null?void 0:it.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(Cr,{className:"h-10 w-32"}),r.jsx(Cr,{className:"h-[400px] w-full"}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsx(Cr,{className:"h-48"}),r.jsx(Cr,{className:"h-48"}),r.jsx(Cr,{className:"h-48"})]})]})});if(!n)return r.jsx(Dr,{title:"Listing Not Found",description:"",children:r.jsx(He,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing could not be found."}),r.jsx(X,{onClick:()=>t("/mission-control/listings"),children:"Back to Listings"})]})})});const ie=((he=n.photos)==null?void 0:he.find(be=>be.is_primary))||((se=n.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:()=>ie&&P(ie.photo_url),children:ie?r.jsx("img",{src:ie.photo_url,alt:"Primary",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No photos"})})}),r.jsx("div",{className:"grid grid-cols-2 gap-2",children:(fe=n.photos)==null?void 0:fe.slice(1,5).map((be,we)=>r.jsx("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>P(be.photo_url),children:r.jsx("img",{src:be.photo_url,alt:`Photo ${we+2}`,className:"w-full h-full object-cover"})},be.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(Xe,{className:"p-6",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 mb-6",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Tt,{className:`${jQt[n.status]} text-white border-0`,children:kQt[n.status]}),n.is_featured&&r.jsxs(Tt,{variant:"outline",className:"border-amber-500 text-amber-500",children:[r.jsx(Mn,{className:"h-3 w-3 mr-1 fill-amber-500"}),"Featured"]}),n.open_to_referrals&&r.jsxs(Tt,{variant:"outline",children:[r.jsx(qs,{className:"h-3 w-3 mr-1"}),"Open to Referrals"]})]}),r.jsx("h1",{className:"text-3xl font-bold text-primary mb-2",children:q(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(po,{className:"h-4 w-4"}),n.city,", ",n.state,n.neighborhood&&` • ${n.neighborhood}`]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(X,{variant:"outline",size:"icon",onClick:()=>i.mutate(n.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(n.id),children:l?r.jsx(Ej,{className:"h-4 w-4"}):r.jsx(Rg,{className:"h-4 w-4"})}),!U&&r.jsxs(X,{variant:"outline",className:"border-amber-500 text-amber-600 hover:bg-amber-50",onClick:()=>E(!0),children:[r.jsx(Bn,{className:"h-4 w-4 mr-2"}),"Share & Earn Leads"]}),r.jsxs(uh,{children:[r.jsx(hh,{asChild:!0,children:r.jsxs(X,{variant:"outline",children:[r.jsx(Cc,{className:"h-4 w-4 mr-2"}),"Share"]})}),r.jsxs(Cu,{children:[r.jsxs(Wa,{onClick:()=>H("copy"),children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Copy Link"]}),r.jsxs(Wa,{onClick:()=>H("facebook"),children:[r.jsx(au,{className:"h-4 w-4 mr-2"}),"Facebook"]}),r.jsxs(Wa,{onClick:()=>H("text"),children:[r.jsx(Bo,{className:"h-4 w-4 mr-2"}),"Text"]}),r.jsxs(Wa,{onClick:()=>H("email"),children:[r.jsx(Nn,{className:"h-4 w-4 mr-2"}),"Email"]})]})]}),U&&r.jsxs(r.Fragment,{children:[r.jsxs(X,{variant:"outline",onClick:()=>t(`/mission-control/listings/${n.id}/edit`),children:[r.jsx(vc,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsx(X,{variant:"destructive",size:"icon",onClick:()=>b(!0),children:r.jsx(Bs,{className:"h-4 w-4"})})]})]})]}),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-5 w-5 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"font-semibold",children:n.bedrooms}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Beds"})]}),n.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:n.bathrooms}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Baths"})]}),n.square_footage&&r.jsxs("div",{className:"text-center",children:[r.jsx(qg,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"font-semibold",children:n.square_footage.toLocaleString()}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Sq Ft"})]}),n.year_built&&r.jsxs("div",{className:"text-center",children:[r.jsx(jn,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"font-semibold",children:n.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(pi,{className:"h-3 w-3 mr-1"}),wTe[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("h3",{className:"font-medium mb-2",children:"Description"}),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("h3",{className:"font-medium 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(Sn,{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(mo,{className:"h-4 w-4"}),n.view_count," views"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Cc,{className:"h-4 w-4"}),n.share_count," shares"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(bi,{className:"h-4 w-4"}),n.save_count," saves"]})]})]})}),n.allow_sharing&&r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsx(Gt,{className:"text-lg",children:"Share Content"})}),r.jsx(Xe,{className:"space-y-4",children:["just_listed","price_improvement","teaser"].map(be=>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:[be.replace("_"," ")," Caption"]}),r.jsx(X,{size:"sm",variant:"ghost",onClick:()=>{navigator.clipboard.writeText(ne(be)),Te.success("Caption copied!")},children:r.jsx(Mo,{className:"h-3 w-3"})})]}),r.jsx("p",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:ne(be)})]},be))})]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsx(Gt,{className:"text-lg",children:"Listing Agent"})}),r.jsxs(Xe,{children:[r.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx("span",{className:"text-lg font-semibold text-primary",children:((ce=(oe=n.agent)==null?void 0:oe.name)==null?void 0:ce.charAt(0))||"?"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((de=n.agent)==null?void 0:de.name)||"Unknown"}),((Me=(xe=n.agent)==null?void 0:xe.brokerage)==null?void 0:Me.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:n.agent.brokerage.name})]})]}),!U&&r.jsx("div",{className:"space-y-2",children:((ve=n.agent)==null?void 0:ve.email)&&r.jsx(X,{variant:"outline",className:"w-full",asChild:!0,children:r.jsxs("a",{href:`mailto:${n.agent.email}`,children:[r.jsx(Nn,{className:"h-4 w-4 mr-2"}),"Email Agent"]})})})]})]}),U&&r.jsx(wQt,{listing:n}),!U&&n.open_to_referrals&&r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsxs(Gt,{className:"text-lg flex items-center gap-2",children:[r.jsx(qs,{className:"h-5 w-5"}),"Send a Buyer"]})}),r.jsxs(Xe,{children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Have a buyer interested in this property? Send a referral to the listing agent."}),r.jsx(X,{className:"w-full",onClick:()=>k(!0),children:"Send Referral"})]})]})]})]})]}),r.jsx(Or,{open:!!T,onOpenChange:()=>P(null),children:r.jsx(Pr,{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(Pr,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Delete Listing"}),r.jsx(Zs,{children:"Are you sure you want to delete this listing? This action cannot be undone."})]}),r.jsxs(zn,{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(Pr,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Send Buyer Referral"}),r.jsx(Zs,{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(ot,{value:R.buyerName,onChange:be=>D({...R,buyerName:be.target.value}),placeholder:"Enter buyer's name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Buyer Type"}),r.jsxs(us,{value:R.buyerType,onValueChange:be=>D({...R,buyerType:be}),children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select type"})}),r.jsxs(ds,{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(Ys,{value:R.notes,onChange:be=>D({...R,notes:be.target.value}),placeholder:"Any additional information..."})]})]}),r.jsxs(zn,{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(NVe,{open:M,onOpenChange:E,listingId:(n==null?void 0:n.id)||"",listingSlug:(n==null?void 0:n.slug)||null,listingTitle:(n==null?void 0:n.property_address)||`${n==null?void 0:n.city}, ${n==null?void 0:n.state}`})]})}function SQt({selectedVideoId:e,onVideoSelect:t,listingId:s}){const n=Hs(),{user:a}=Yr(),[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:ne}=await Y.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:G.bunny_video_id,isAgentVideo:!0}});!ne&&(Q!=null&&Q.thumbnailUrl)&&N(ie=>({...ie,[G.id]:{thumbnailUrl:Q.thumbnailUrl}}))}catch(Q){console.warn("Failed to get signed URL",Q)}},E=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),Te.error("Failed to load videos")}finally{x(!1)}}},T=async G=>{var Q;try{const ne=G.map(oe=>oe.bunny_video_id),{data:ie,error:he}=await Y.functions.invoke("bunny-upload",{body:{action:"bulk-asset-urls",videoIds:ne,isAgentVideo:!0}});if(he)throw he;const se=(ie==null?void 0:ie.assets)||{},fe={};for(const oe of G)(Q=se[oe.bunny_video_id])!=null&&Q.thumbnailUrl&&(fe[oe.id]={thumbnailUrl:se[oe.bunny_video_id].thumbnailUrl});N(oe=>({...oe,...fe}))}catch(ne){console.warn("Failed to bulk-fetch signed URLs",ne)}},P=()=>{l(!0),E()},R=G=>{t(G.id),v(G),l(!1),Te.success("Video selected")},D=()=>{t(null),v(null)},U=()=>{const G=s?`/mission-control/listings/${s}/edit`:"/mission-control/listings/new";n(`/mission-control/video?returnUrl=${encodeURIComponent(G)}`)},q=G=>{if(!G)return"0:00";const Q=Math.floor(G/60),ne=G%60;return`${Q}:${ne.toString().padStart(2,"0")}`},H=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(Xe,{className:"p-0",children:r.jsxs("div",{className:"flex items-start gap-4 p-4",children:[r.jsxs("div",{className:"relative w-32 h-20 bg-muted rounded-lg overflow-hidden flex-shrink-0",children:[H(y)?r.jsx("img",{src:H(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(Ta,{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(Hl,{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:q(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(en,{className:"h-4 w-4"})})]})]})})}):r.jsx(He,{className:"border-dashed",children:r.jsx(Xe,{className:"p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Ta,{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(IS,{className:"h-4 w-4"}),"Select from Library"]}),r.jsxs(X,{type:"button",variant:"outline",onClick:U,className:"gap-2",children:[r.jsx(Fg,{className:"h-4 w-4"}),"Record New Video"]})]})]})})}),r.jsx(Or,{open:o,onOpenChange:l,children:r.jsxs(Pr,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsx(zr,{children:r.jsxs(Rr,{className:"flex items-center gap-2",children:[r.jsx(IS,{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(Vr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):i.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Ta,{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(Fg,{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:()=>R(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:[H(G)?r.jsx("img",{src:H(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(Ta,{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(Hl,{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:q(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(Fg,{className:"h-4 w-4"}),"Record New Video"]}),r.jsx(X,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"})]})]})})]})}const CQt=[{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 jTe(){var fe;const{listingId:e}=hc(),[t]=Ic(),s=t.get("brokerage"),n=Hs(),{user:a}=Yr(),o=!!e&&e!=="new",l=!!s&&!o,{data:i,isLoading:u}=ORe(o?e:""),m=rxt(),x=sxt(),y=nxt(),v=axt(),b=ixt(),{data:N=[]}=Kt({queryKey:["brokerage-agents",s],queryFn:async()=>{if(!s)return[];const{data:oe,error:ce}=await Y.from("profiles").select("id, name, email").eq("brokerage_id",s).order("name");if(ce)throw ce;return oe||[]},enabled:l}),[k,M]=A.useState(""),[E,T]=A.useState(!1),[P,R]=A.useState([]),[D,U]=A.useState([]),[q,H]=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 oe,ce,de,xe,Me;i&&o&&H({property_address:i.property_address||"",city:i.city||"",state:i.state||"",neighborhood:i.neighborhood||"",price:((oe=i.price)==null?void 0:oe.toString())||"",property_type:i.property_type,status:i.status,bedrooms:((ce=i.bedrooms)==null?void 0:ce.toString())||"",bathrooms:((de=i.bathrooms)==null?void 0:de.toString())||"",square_footage:((xe=i.square_footage)==null?void 0:xe.toString())||"",lot_size:i.lot_size||"",year_built:((Me=i.year_built)==null?void 0:Me.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=oe=>{if(!oe)return;const ce=Array.from(oe);R(xe=>[...xe,...ce]);const de=ce.map(xe=>URL.createObjectURL(xe));U(xe=>[...xe,...de])},Q=oe=>{URL.revokeObjectURL(D[oe]),R(ce=>ce.filter((de,xe)=>xe!==oe)),U(ce=>ce.filter((de,xe)=>xe!==oe))},ne=async oe=>{var ce;if(!(!oe||!i)){T(!0);try{for(const de of Array.from(oe)){const xe=de.name.split(".").pop(),Me=`${a==null?void 0:a.id}/${i.id}/${Date.now()}.${xe}`,{error:ve}=await Y.storage.from("listing-photos").upload(Me,de);if(ve)throw ve;const{data:{publicUrl:be}}=Y.storage.from("listing-photos").getPublicUrl(Me);await v.mutateAsync({listingId:i.id,photoUrl:be,isPrimary:!((ce=i.photos)!=null&&ce.length)})}Te.success("Photos uploaded!")}catch(de){console.error("Upload error:",de),Te.error("Failed to upload photos")}finally{T(!1)}}},ie=async oe=>{for(let ce=0;ce{if(i)try{await b.mutateAsync({photoId:oe,listingId:i.id}),Te.success("Photo removed")}catch{Te.error("Failed to remove photo")}},se=async oe=>{if(oe.preventDefault(),!q.city.trim()||!q.state.trim()||!q.price){Te.error("Please fill in required fields (City, State, Price)");return}if(l&&!k){Te.error("Please select an agent to assign this listing to");return}try{const ce={property_address:q.property_address||null,city:q.city,state:q.state,neighborhood:q.neighborhood||null,price:Number(q.price),property_type:q.property_type,status:q.status,bedrooms:q.bedrooms?Number(q.bedrooms):null,bathrooms:q.bathrooms?Number(q.bathrooms):null,square_footage:q.square_footage?Number(q.square_footage):null,lot_size:q.lot_size||null,year_built:q.year_built?Number(q.year_built):null,has_hoa:q.has_hoa,description:q.description||null,agent_notes:q.agent_notes||null,agent_notes_public:q.agent_notes_public,mls_link:q.mls_link||null,video_link:q.video_link||null,video_id:q.video_id||null,allow_sharing:q.allow_sharing,open_to_referrals:q.open_to_referrals,open_to_social_promotion:q.open_to_social_promotion,share_with_brokerage:q.share_with_brokerage,is_public:q.is_public};if(o)await y.mutateAsync({id:e,...ce}),Te.success("Listing updated!"),n(`/mission-control/listings/${e}`);else{T(!0);let de;if(l&&k?de=await x.mutateAsync({agentId:k,...ce}):de=await m.mutateAsync(ce),P.length>0)try{await ie(de.id),D.forEach(xe=>URL.revokeObjectURL(xe)),R([]),U([])}catch(xe){console.error("Photo upload error:",xe),Te.error("Listing created but some photos failed to upload")}T(!1),Te.success("Listing created!"),n(l?"/my-brokerage":`/mission-control/listings/${de.id}`)}}catch(ce){console.error("Save error:",ce),Te.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(Cr,{className:"h-10 w-32"}),r.jsx(Cr,{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:()=>n(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(Vt,{children:r.jsx(Gt,{children:"Assign to Agent *"})}),r.jsxs(Xe,{children:[r.jsxs(us,{value:k,onValueChange:M,children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select an agent..."})}),r.jsx(ds,{children:N.map(oe=>r.jsx($t,{value:oe.id,children:oe.name||oe.email},oe.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(Vt,{children:r.jsx(Gt,{children:"Property Details"})}),r.jsx(Xe,{className:"space-y-4",children:r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"sm:col-span-2 space-y-2",children:[r.jsx(ze,{children:"Property Address"}),r.jsx(ot,{value:q.property_address,onChange:oe=>H({...q,property_address:oe.target.value}),placeholder:"123 Main St"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"City *"}),r.jsx(ot,{value:q.city,onChange:oe=>H({...q,city:oe.target.value}),placeholder:"City",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"State *"}),r.jsx(ot,{value:q.state,onChange:oe=>H({...q,state:oe.target.value}),placeholder:"State",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Neighborhood"}),r.jsx(ot,{value:q.neighborhood,onChange:oe=>H({...q,neighborhood:oe.target.value}),placeholder:"Neighborhood"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Price *"}),r.jsx(ot,{type:"number",value:q.price,onChange:oe=>H({...q,price:oe.target.value}),placeholder:"500000",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Property Type"}),r.jsxs(us,{value:q.property_type,onValueChange:oe=>H({...q,property_type:oe}),children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsx(ds,{children:MQt.map(oe=>r.jsx($t,{value:oe.value,children:oe.label},oe.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Status"}),r.jsxs(us,{value:q.status,onValueChange:oe=>H({...q,status:oe}),children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsx(ds,{children:CQt.map(oe=>r.jsx($t,{value:oe.value,children:oe.label},oe.value))})]})]})]})})]}),r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsx(Gt,{children:"Property Specs (Optional)"})}),r.jsx(Xe,{children:r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Bedrooms"}),r.jsx(ot,{type:"number",value:q.bedrooms,onChange:oe=>H({...q,bedrooms:oe.target.value}),placeholder:"3"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Bathrooms"}),r.jsx(ot,{type:"number",step:"0.5",value:q.bathrooms,onChange:oe=>H({...q,bathrooms:oe.target.value}),placeholder:"2"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Sq Ft"}),r.jsx(ot,{type:"number",value:q.square_footage,onChange:oe=>H({...q,square_footage:oe.target.value}),placeholder:"2000"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Lot Size"}),r.jsx(ot,{value:q.lot_size,onChange:oe=>H({...q,lot_size:oe.target.value}),placeholder:"0.25 acres"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Year Built"}),r.jsx(ot,{type:"number",value:q.year_built,onChange:oe=>H({...q,year_built:oe.target.value}),placeholder:"2005"})]}),r.jsxs("div",{className:"flex items-center gap-2 pt-6",children:[r.jsx(In,{checked:q.has_hoa,onCheckedChange:oe=>H({...q,has_hoa:oe})}),r.jsx(ze,{children:"Has HOA"})]})]})})]}),r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsx(Gt,{children:"Description & Links"})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Description"}),r.jsx(Ys,{value:q.description,onChange:oe=>H({...q,description:oe.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(Ys,{value:q.agent_notes,onChange:oe=>H({...q,agent_notes:oe.target.value}),placeholder:"Notes for other agents...",rows:2}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(In,{checked:q.agent_notes_public,onCheckedChange:oe=>H({...q,agent_notes_public:oe})}),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(ot,{value:q.mls_link,onChange:oe=>H({...q,mls_link:oe.target.value}),placeholder:"https://..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Video Link"}),r.jsx(ot,{value:q.video_link,onChange:oe=>H({...q,video_link:oe.target.value}),placeholder:"YouTube or Vimeo URL"})]})]})]})]}),r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Ta,{className:"h-5 w-5"}),"Property Video"]})}),r.jsx(Xe,{children:r.jsx(SQt,{selectedVideoId:q.video_id,onVideoSelect:oe=>H({...q,video_id:oe}),listingId:o?e:void 0})})]}),r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsx(Gt,{children:"Photos"})}),r.jsxs(Xe,{children:[r.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-4",children:[o&&((fe=i==null?void 0:i.photos)==null?void 0:fe.map(oe=>r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:oe.photo_url,alt:"",className:"w-full h-full object-cover"}),r.jsx("button",{type:"button",onClick:()=>he(oe.id),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:r.jsx(en,{className:"h-3 w-3"})}),oe.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"})]},oe.id))),!o&&D.map((oe,ce)=>r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:oe,alt:"",className:"w-full h-full object-cover"}),r.jsx("button",{type:"button",onClick:()=>Q(ce),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:r.jsx(en,{className:"h-3 w-3"})}),ce===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"})]},ce)),r.jsxs("label",{className:"aspect-square rounded-lg border-2 border-dashed border-muted-foreground/25 hover:border-muted-foreground/50 cursor-pointer flex flex-col items-center justify-center gap-2 text-muted-foreground",children:[E?r.jsx(Vr,{className:"h-8 w-8 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(so,{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:oe=>o?ne(oe.target.files):G(oe.target.files),disabled:E})]})]}),!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(Vt,{children:r.jsx(Gt,{children:"Sharing & Collaboration"})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"Allow Sharing"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Other agents can share this listing"})]}),r.jsx(In,{checked:q.allow_sharing,onCheckedChange:oe=>H({...q,allow_sharing:oe})})]}),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(In,{checked:q.open_to_referrals,onCheckedChange:oe=>H({...q,open_to_referrals:oe})})]}),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(In,{checked:q.open_to_social_promotion,onCheckedChange:oe=>H({...q,open_to_social_promotion:oe})})]}),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(In,{checked:q.share_with_brokerage,onCheckedChange:oe=>H({...q,share_with_brokerage:oe})})]}),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(In,{checked:q.is_public,onCheckedChange:oe=>H({...q,is_public:oe})})]})]})]}),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(Vr,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):o?"Update Listing":"Create Listing"})]})]})]})})}function AVe({maxDurationSeconds:e=30,onRecordingComplete:t,onError:s,onRecordingStateChange:n,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=H3(),[k,M]=A.useState(!0),[E,T]=A.useState(!0),[P,R]=A.useState(null),[D,U]=A.useState(!1),[q,H]=A.useState(!1),[G,Q]=A.useState(null),[ne,ie]=A.useState(null),[he,se]=A.useState(0),[fe,oe]=A.useState("user"),[ce,de]=A.useState(0),[xe,Me]=A.useState(!1),[ve,be]=A.useState(!0),[we,tt]=A.useState(null),[Ae,Le]=A.useState(!1),[Ue,Pe]=A.useState(null),$e=A.useRef(null),it=A.useRef(s);it.current=s;const xt=A.useCallback(dt=>{M(dt)},[]),Ee=A.useRef(k),et=A.useCallback(async()=>{var ct,zt;T(!0),tt(null);const dt=N&&k;console.log("[VideoRecorder] initCamera start",{isMobile:N,usePortraitMode:k,shouldBePortrait:dt,facingMode:fe});try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Error("Camera not available in this browser or context. Try opening in a new tab.");u.current&&(console.log("[VideoRecorder] stopping existing stream"),u.current.getTracks().forEach(ns=>ns.stop()));const ir=N&&dt?{facingMode:{ideal:fe},width:{ideal:720},height:{ideal:1280}}:{facingMode:{ideal:fe},width:{ideal:1280},height:{ideal:720}};console.log("[VideoRecorder] requesting getUserMedia",ir);const Tr=await navigator.mediaDevices.getUserMedia({video:ir,audio:{echoCancellation:!0,noiseSuppression:!0}});if(console.log("[VideoRecorder] getUserMedia success"),Tr.getVideoTracks().length===0)throw new Error("Camera stream started but no video track was provided.");u.current=Tr,R(!0);const $r=Tr.getVideoTracks()[0].getSettings();if(console.log("[VideoRecorder] Camera initialized with dimensions:",$r.width,"x",$r.height),l.current){const ns=l.current;ns.srcObject=Tr,ns.muted=!0,ns.playsInline=!0,ns.autoplay=!0,ns.setAttribute("muted",""),ns.setAttribute("playsinline",""),ns.setAttribute("autoplay","");try{(ct=ns.load)==null||ct.call(ns)}catch(Ot){console.warn("[VideoRecorder] videoEl.load failed",Ot)}const Xs=async()=>{try{return await ns.play(),console.log("[VideoRecorder] preview play ok"),Le(!1),setTimeout(()=>{console.debug("[VideoRecorder] preview metrics",{readyState:ns.readyState,videoWidth:ns.videoWidth,videoHeight:ns.videoHeight})},300),!0}catch(Ot){return console.warn("[VideoRecorder] preview play blocked",Ot),Le(!0),!1}};await new Promise(Ot=>{let Hr=!1;const Ts=()=>{Hr||(Hr=!0,Ot())},zs=()=>{Xs().finally(Ts)};ns.onloadedmetadata=zs,ns.onloadeddata=zs,setTimeout(Ts,1500)})}try{y.current=new AudioContext;const ns=y.current.createMediaStreamSource(Tr);v.current=y.current.createAnalyser(),v.current.fftSize=256,ns.connect(v.current);const Xs=()=>{if(v.current){const Ot=new Uint8Array(v.current.frequencyBinCount);v.current.getByteFrequencyData(Ot);const Hr=Ot.reduce((Ts,zs)=>Ts+zs)/Ot.length;de(Math.min(100,Hr/128*100))}b.current=requestAnimationFrame(Xs)};Xs()}catch(ns){console.warn("Audio context not available:",ns)}}catch(ir){console.error("Camera initialization error:",ir),R(!1);let Tr="Failed to access camera or microphone.";ir.name==="NotAllowedError"?Tr="Camera permission denied. Please allow camera access in your browser settings.":ir.name==="NotFoundError"?Tr="No camera found. Please connect a camera and try again.":ir.name==="NotReadableError"?Tr="Camera is in use by another application. Please close other apps using the camera.":ir.message&&(Tr=ir.message),tt(Tr),(zt=it.current)==null||zt.call(it,Tr)}finally{T(!1)}},[fe,N,k]);A.useEffect(()=>{Ee.current!==k&&P&&!D&&!ne&&(Ee.current=k,et())},[k,P,D,ne,et]),A.useEffect(()=>(et(),()=>{u.current&&u.current.getTracks().forEach(dt=>dt.stop()),x.current&&clearInterval(x.current),b.current&&cancelAnimationFrame(b.current),y.current&&y.current.close(),$e.current&&clearInterval($e.current),ne&&URL.revokeObjectURL(ne)}),[et,ne]),A.useEffect(()=>{if(E||P!==!0||ne)return;const dt=u.current,ct=l.current;!dt||!ct||(ct.srcObject!==dt&&(ct.srcObject=dt,ct.muted=!0,ct.playsInline=!0,ct.autoplay=!0,ct.setAttribute("muted",""),ct.setAttribute("playsinline",""),ct.setAttribute("autoplay","")),ct.play().then(()=>Le(!1)).catch(zt=>{Le(!0),console.warn("Live preview play blocked on mount:",zt)}))},[P,E,ne]),A.useEffect(()=>{n==null||n(D)},[D,n]);const le=A.useCallback(async()=>{if(ne)return;const dt=l.current;if(dt)try{await dt.play(),Le(!1)}catch(ct){Le(!0),console.warn("Live preview still blocked (needs user gesture):",ct)}},[ne]),Ve=A.useCallback(()=>{i.current&&i.current.state!=="inactive"&&i.current.stop(),x.current&&(clearInterval(x.current),x.current=null),U(!1),H(!1)},[]),Je=A.useCallback(()=>{if(!u.current)return;le(),m.current=[],se(0);const ct=["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,ct?{mimeType:ct,videoBitsPerSecond:25e5}:{videoBitsPerSecond:25e5});zt.ondataavailable=ir=>{ir.data.size>0&&m.current.push(ir.data)},zt.onstop=()=>{var $r;const ir=zt.mimeType||ct||(($r=m.current[0])==null?void 0:$r.type)||"video/webm",Tr=new Blob(m.current,{type:ir});Q(Tr);const Zr=URL.createObjectURL(Tr);ie(Zr)},i.current=zt,zt.start(100),U(!0),x.current=setInterval(()=>{se(ir=>ir>=e-1?(Ve(),e):ir+1)},1e3)},[le,e,Ve]),rt=A.useCallback(()=>{if(Ue!==null)return;Pe(3);let dt=3;$e.current=setInterval(()=>{dt-=1,dt<=0?($e.current&&clearInterval($e.current),$e.current=null,Pe(null),Je()):Pe(dt)},1e3)},[Ue,Je]),je=A.useCallback(()=>{i.current&&i.current.state==="recording"&&(i.current.pause(),H(!0),x.current&&clearInterval(x.current))},[]),lt=A.useCallback(()=>{i.current&&i.current.state==="paused"&&(i.current.resume(),H(!1),x.current=setInterval(()=>{se(dt=>dt>=e-1?(Ve(),e):dt+1)},1e3))},[e,Ve]),Ce=A.useCallback(()=>{ne&&URL.revokeObjectURL(ne),Q(null),ie(null),se(0),Me(!1),be(!0),l.current&&u.current&&(l.current.srcObject=u.current,l.current.muted=!0,le())},[le,ne]),Ie=A.useCallback(()=>{oe(dt=>dt==="user"?"environment":"user")},[]),Ze=A.useCallback(()=>{G&&t(G,he)},[G,he,t]),De=A.useCallback(()=>{l.current&&ne&&(xe?l.current.pause():(be(!1),l.current.muted=!1,l.current.play()),Me(!xe))},[ne,xe]);A.useEffect(()=>{if(!ne)return;const dt=l.current;if(!dt)return;be(!1),dt.pause(),dt.removeAttribute("src"),dt.srcObject=null,dt.load(),dt.src=ne,dt.currentTime=0,dt.playsInline=!0,dt.muted=!1,dt.onended=()=>Me(!1);const ct=()=>{var Tr;const zt=dt.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),(Tr=it.current)==null||Tr.call(it,ir)};return dt.addEventListener("error",ct),dt.load(),()=>{dt.removeEventListener("error",ct)}},[ne]);const Ke=dt=>{const ct=Math.floor(dt/60),zt=dt%60;return`${ct}:${zt.toString().padStart(2,"0")}`},st=N&&k?"aspect-[9/16]":"aspect-video";return E?r.jsx("div",{className:Ut("flex items-center justify-center bg-black rounded-lg",st,a),children:r.jsxs("div",{className:"text-center text-white",children:[r.jsx(Vr,{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",st,a),children:r.jsxs("div",{className:"text-center text-white p-8 max-w-md",children:[r.jsx(vl,{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:we||"Please allow camera and microphone access to record videos."}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(X,{onClick:()=>et(),variant:"secondary",className:"w-full",children:[r.jsx(Go,{className:"h-4 w-4 mr-2"}),"Try Again"]}),r.jsx("p",{className:"text-xs text-gray-500 mt-3",children:"💡 Tip: If you're viewing this in an embedded preview, try opening the app in a new browser tab for full camera access."})]})]})}):r.jsxs("div",{className:Ut("flex flex-col gap-2",a),children:[N&&!D&&!ne&&r.jsxs("div",{className:"flex items-center justify-center gap-3 py-2 bg-muted/50 rounded-lg",children:[r.jsx(Uj,{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(In,{id:"orientation-toggle",checked:k,onCheckedChange:xt}),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:ne??void 0,className:Ut("w-full bg-black",k&&!ne?"object-contain":"object-cover",st,fe==="user"&&!ne&&"scale-x-[-1]"),playsInline:!0,controls:!!ne,muted:ne?ve:!0,autoPlay:!ne},ne??"live"),!ne&&Ae&&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&&!ne&&r.jsx("div",{className:"absolute inset-0 pointer-events-none",children:o}),Ue!==null&&!ne&&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:Ue},Ue),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",q?"bg-yellow-500":"bg-red-500 animate-pulse")}),r.jsxs("span",{className:"text-white text-sm font-medium",children:[Ke(he)," / ",Ke(e)]})]}),D&&r.jsx("div",{className:"absolute top-0 left-0 right-0",children:r.jsx(lc,{value:he/e*100,className:"h-1 rounded-none"})}),!ne&&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(vA,{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:`${ce}%`}})})]}),r.jsx("div",{className:"absolute bottom-4 left-0 right-0 flex justify-center gap-3 px-4",children:ne?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(Go,{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:De,children:xe?r.jsx(_m,{className:"h-5 w-5"}):r.jsx(Hl,{className:"h-5 w-5"})}),r.jsxs(X,{size:"lg",className:"bg-green-500 hover:bg-green-600 text-white",onClick:Ze,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:Ie,disabled:D||Ue!==null,children:r.jsx(BS,{className:"h-5 w-5"})}),!D&&Ue===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(Ta,{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:q?lt:je,children:q?r.jsx(Hl,{className:"h-5 w-5"}):r.jsx(_m,{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:Ve,children:r.jsx(qg,{className:"h-6 w-6 fill-current"})})]}),r.jsx("div",{className:"h-12 w-12"})]})})]})]})}const EVe="teleprompter_settings",yue={scrollSpeed:30,fontSize:24,lineHeight:1.6,opacity:.85,position:"top",isMirrored:!1};function TQt(){try{const e=localStorage.getItem(EVe);return e?{...yue,...JSON.parse(e)}:yue}catch{return yue}}function AQt(e){try{localStorage.setItem(EVe,JSON.stringify(e))}catch{}}function IVe({text:e,isVisible:t,onToggleVisibility:s,isRecording:n=!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(TQt),{scrollSpeed:b,fontSize:N,lineHeight:k,opacity:M,position:E,isMirrored:T}=y,P=A.useCallback((ie,he)=>{v(se=>{const fe={...se,[ie]:he};return AQt(fe),fe})},[]),[R,D]=A.useState(!1),[U,q]=A.useState(null),H=A.useCallback(ie=>{if(!i.current)return;m.current===0&&(m.current=ie);const he=ie-m.current;m.current=ie,x.current+=b*he/1e3;const se=Math.floor(x.current);se>0&&(i.current.scrollTop+=se,x.current-=se);const{scrollTop:fe,scrollHeight:oe,clientHeight:ce}=i.current;if(fe+ce>=oe){D(!1);return}u.current=requestAnimationFrame(H)},[b]);A.useEffect(()=>(R?(m.current=0,x.current=0,u.current=requestAnimationFrame(H)):u.current&&cancelAnimationFrame(u.current),()=>{u.current&&cancelAnimationFrame(u.current)}),[R,H]),A.useEffect(()=>{if(n&&t)if(i.current&&(i.current.scrollTop=0),a){q(3);let ie=3;const he=setInterval(()=>{ie-=1,ie<=0?(clearInterval(he),q(null),o==null||o(),D(!0)):q(ie)},1e3);return()=>clearInterval(he)}else setTimeout(()=>D(!0),100);else n||(D(!1),q(null))},[n,t,a,o]);const G=A.useCallback(()=>{i.current&&(i.current.scrollTop=0),D(!1)},[]),Q=A.useCallback(()=>{D(ie=>!ie)},[]);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:s,className:"bg-black/50 hover:bg-black/70 text-white border-0",children:[r.jsx(mo,{className:"h-4 w-4 mr-2"}),"Show Script"]})});const ne={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",ne[E],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(Kc,{children:[r.jsx(Zc,{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(Ac,{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(Sf,{value:[b],onValueChange:([ie])=>P("scrollSpeed",ie),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(Sf,{value:[N],onValueChange:([ie])=>P("fontSize",ie),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(Sf,{value:[k*10],onValueChange:([ie])=>P("lineHeight",ie/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(Sf,{value:[M*100],onValueChange:([ie])=>P("opacity",ie/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:E==="top"?"default":"outline",size:"sm",onClick:()=>P("position","top"),children:r.jsx(zg,{className:"h-4 w-4"})}),r.jsx(X,{variant:E==="center"?"default":"outline",size:"sm",onClick:()=>P("position","center"),children:r.jsx(Y1,{className:"h-4 w-4"})}),r.jsx(X,{variant:E==="bottom"?"default":"outline",size:"sm",onClick:()=>P("position","bottom"),children:r.jsx(gd,{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(In,{checked:T,onCheckedChange:ie=>P("isMirrored",ie)})]})]})})]}),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:R?r.jsx(_m,{className:"h-4 w-4"}):r.jsx(Hl,{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(BS,{className:"h-4 w-4"})}),r.jsxs(X,{variant:"secondary",size:"sm",onClick:s,className:"bg-black/50 hover:bg-black/70 text-white border-0",children:[r.jsx(Ef,{className:"h-4 w-4 mr-2"}),"Hide"]})]})]})}function EQt({onSelectScript:e,onCreateNew:t,selectedScriptId:s,className:n}){const{toast:a}=ci(),[o,l]=A.useState(""),[i,u]=A.useState(null),[m,x]=A.useState("levelup"),{data:y,isLoading:v}=l5t(),{data:b,isLoading:N}=c5t(),{data:k,isLoading:M}=d5t(),E=u5t(),T=A.useMemo(()=>b?b.filter(q=>{const H=!o||q.title.toLowerCase().includes(o.toLowerCase())||q.script_text.toLowerCase().includes(o.toLowerCase())||q.tags.some(Q=>Q.toLowerCase().includes(o.toLowerCase())),G=!i||q.category_id===i;return H&&G}):[],[b,o,i]),P=A.useMemo(()=>k?k.filter(q=>!o||q.title.toLowerCase().includes(o.toLowerCase())||q.script_text.toLowerCase().includes(o.toLowerCase())):[],[k,o]),R=q=>{e({title:q.title,text:q.script_text})},D=async q=>{try{await E.mutateAsync(q),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",n),children:[r.jsx("div",{className:"p-4 border-b",children:r.jsxs("div",{className:"relative",children:[r.jsx(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search scripts...",value:o,onChange:q=>l(q.target.value),className:"pl-9"})]})}),r.jsxs(Si,{value:m,onValueChange:q=>x(q),className:"flex-1 flex flex-col",children:[r.jsxs(ki,{className:"mx-4 mt-4 grid grid-cols-2",children:[r.jsxs(is,{value:"levelup",children:[r.jsx(ga,{className:"h-4 w-4 mr-2"}),"LevelUp Scripts"]}),r.jsxs(is,{value:"my-scripts",children:[r.jsx(Tf,{className:"h-4 w-4 mr-2"}),"My Scripts"]})]}),r.jsxs(Ss,{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(q=>r.jsx(Tt,{variant:i===q.id?"default":"outline",className:"cursor-pointer",onClick:()=>u(q.id),children:q.name},q.id))]}),r.jsx(Yo,{className:"flex-1 max-h-[50vh]",children:U?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Vr,{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(ga,{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(q=>r.jsxs(He,{className:Ut("cursor-pointer hover:bg-accent/50 transition-colors",s===q.id&&"ring-2 ring-primary"),onClick:()=>R(q),children:[r.jsx(Vt,{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:q.title}),q.category&&r.jsx(Tt,{variant:"secondary",className:"mt-1 text-xs",children:q.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:H=>{H.stopPropagation(),D(q)},children:r.jsx(Tf,{className:"h-4 w-4"})}),r.jsx(Zi,{className:"h-4 w-4 text-muted-foreground"})]})]})}),r.jsx(Xe,{className:"p-3 pt-0",children:r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:q.script_text})})]},q.id))})})]}),r.jsxs(Ss,{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(vs,{className:"h-4 w-4 mr-2"}),"Create New Script"]}),r.jsx(Yo,{className:"flex-1 max-h-[50vh]",children:M?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Vr,{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(Tf,{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(q=>r.jsxs(He,{className:Ut("cursor-pointer hover:bg-accent/50 transition-colors",s===q.id&&"ring-2 ring-primary"),onClick:()=>R(q),children:[r.jsx(Vt,{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:q.title}),r.jsx("div",{className:"flex items-center gap-2 mt-1",children:q.is_custom?r.jsx(Tt,{variant:"outline",className:"text-xs",children:"Custom"}):r.jsx(Tt,{variant:"secondary",className:"text-xs",children:"Saved"})})]}),r.jsx(Zi,{className:"h-4 w-4 text-muted-foreground ml-2"})]})}),r.jsx(Xe,{className:"p-3 pt-0",children:r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:q.script_text})})]},q.id))})})]})]})]})}function IQt({selectedTemplate:e,onSelect:t,contactName:s,saving:n=!1}){const[a,o]=A.useState(()=>{const i=eC(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"}),n&&r.jsx(Vr,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),r.jsx("div",{className:"space-y-3",children:vgt.map(i=>{const u=_gt(i.id),m=a.has(i.id),x=u.some(y=>y.id===e);return r.jsxs(XS,{open:m,onOpenChange:()=>l(i.id),children:[r.jsxs(QS,{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(gd,{className:Ut("h-4 w-4 text-muted-foreground transition-transform",m&&"rotate-180")})]}),r.jsx(JS,{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:n,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)})}),s&&e!=="default"&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Will show: "',eC(e).headerText(s),'"']})]})}function PVe({open:e,onOpenChange:t,video:s,contactName:n,onTemplateUpdated:a}){const[o,l]=A.useState(s.page_template||"default"),[i,u]=A.useState(!1),[m,x]=A.useState(!1),[y,v]=A.useState(s.page_template||"default"),[b,N]=A.useState([]),[k,M]=A.useState(s.contact_id&&n?{id:s.contact_id,name:n,email:null}:null),[E,T]=A.useState(!1),[P,R]=A.useState(!1),D=s.share_token?`https://video.relevelup.com/${s.share_token}`:"";A.useEffect(()=>{e&&b.length===0&&U()},[e]);const U=async()=>{R(!0);try{const{data:fe,error:oe}=await Y.from("innercircle_contacts").select("id, first_name, last_name, email").order("first_name",{ascending:!0}).limit(500);if(oe)throw oe;const ce=(fe||[]).map(de=>({id:de.id,name:[de.first_name,de.last_name].filter(Boolean).join(" ")||"Unnamed",email:de.email||null}));N(ce)}catch(fe){console.error("Failed to fetch contacts:",fe)}finally{R(!1)}},q=async fe=>{M(fe),T(!1),u(!0);try{const{error:oe}=await Y.from("agent_videos").update({contact_id:(fe==null?void 0:fe.id)||null,recipient_name:(fe==null?void 0:fe.name)||null}).eq("id",s.id);if(oe)throw oe;Te.success(fe?`Assigned to ${fe.name}`:"Contact removed"),a==null||a()}catch(oe){console.error("Failed to update contact:",oe),Te.error("Failed to update contact")}finally{u(!1)}},H=async fe=>{l(fe),u(!0);try{const{error:oe}=await Y.from("agent_videos").update({page_template:fe}).eq("id",s.id);if(oe)throw oe;v(fe),Te.success("Template saved!"),a==null||a()}catch(oe){console.error("Failed to save template:",oe),Te.error("Failed to save template"),l(y)}finally{u(!1)}},G=(k==null?void 0:k.name)||null,Q=()=>{const fe=s.title||"Video Message",oe=s.share_token?`https://video.relevelup.com/thumb/${s.share_token}`:s.thumbnail_url||"";return``},ne=async()=>{if(!s.thumbnail_url){Te.error("Video thumbnail not available yet");return}const fe=Q(),oe=`Watch: ${s.title||"Video Message"} ${D}`;try{const ce=new Blob([fe],{type:"text/html"}),de=new Blob([oe],{type:"text/plain"}),xe=new ClipboardItem({"text/html":ce,"text/plain":de});await navigator.clipboard.write([xe]),Te.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(oe+` `+fe),Te.success("Copied! Paste into your email.")}},ie=async()=>{await navigator.clipboard.writeText(D),x(!0),Te.success("Share link copied!"),setTimeout(()=>x(!1),2e3)},he=()=>{const oe=eC(o).headerText(G),ce=o==="default"?`Check out this video: ${D}`:`${oe} Check out this special video: ${D}`;window.open(`sms:?body=${encodeURIComponent(ce)}`,"_self")},se=()=>{const fe=eC(o),oe=fe.headerText(G),ce=o==="default"?s.title||"Video Message":oe,de=`${fe.subText} Watch the video: ${D}`,xe=k!=null&&k.email?encodeURIComponent(k.email):"";window.open(`mailto:${xe}?subject=${encodeURIComponent(ce)}&body=${encodeURIComponent(de)}`,"_self")};return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Pr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{className:"flex items-center gap-2",children:[r.jsx(zo,{className:"h-5 w-5"}),"Share Video"]}),r.jsx(Zs,{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(Kc,{open:E,onOpenChange:T,children:[r.jsx(Zc,{asChild:!0,children:r.jsxs(X,{variant:"outline",role:"combobox","aria-expanded":E,className:"flex-1 justify-between",disabled:i,children:[k?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(oc,{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(Ac,{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(fe=>r.jsxs(zy,{value:fe.name,onSelect:()=>q(fe),children:[r.jsx(fi,{className:Ut("mr-2 h-4 w-4",(k==null?void 0:k.id)===fe.id?"opacity-100":"opacity-0")}),fe.name]},fe.id))})]})]})})]}),k&&r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>q(null),disabled:i,className:"shrink-0",children:r.jsx(en,{className:"h-4 w-4"})})]}),k&&o!=="default"&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Page will show: "',eC(o).headerText(k.name),'"']})]}),r.jsx(IQt,{selectedTemplate:o,onSelect:H,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(ot,{value:D,readOnly:!0,className:"font-mono text-sm"}),r.jsx(X,{onClick:ie,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(Mo,{className:"h-4 w-4"}),"Copy"]})})]})]}),s.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:ne,children:[r.jsx(El,{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:he,children:[r.jsx(Bo,{className:"h-4 w-4"}),"Text"]}),r.jsxs(X,{variant:"outline",className:"flex-1 gap-2",onClick:se,children:[r.jsx(Nn,{className:"h-4 w-4"}),"Email"]})]})]})]}),r.jsx(zn,{children:r.jsx(X,{variant:"outline",onClick:()=>t(!1),children:"Done"})})]})})}function PQt(){var rt;const e=Hs(),[t]=Ic(),{toast:s}=ci(),n=t.get("contact_id"),a=t.get("task_id"),{canRecord:o,remainingMb:l,usagePercent:i,isNearLimit:u}=SBe(),{data:m}=Np(),x=Hae(),y=g5t(),[v,b]=A.useState("record"),[N,k]=A.useState(""),[M,E]=A.useState(!1),[T,P]=A.useState(!1),[R,D]=A.useState(!1),[U,q]=A.useState(null),[H,G]=A.useState(0),[Q,ne]=A.useState(0),[ie,he]=A.useState(null),[se,fe]=A.useState(null),[oe,ce]=A.useState(n||""),[de,xe]=A.useState(""),[Me,ve]=A.useState(""),[be,we]=A.useState(null),[tt,Ae]=A.useState(null),[Le,Ue]=A.useState(null),[Pe,$e]=A.useState(!1),it=A.useCallback(async(je,lt)=>{q(je),b("uploading");try{const{videoId:Ce,uploadUrl:Ie}=await CBe(de||"Quick Video Touch");he(Ce);const{apiKey:Ze}=await MBe(Ce),De=new XMLHttpRequest;De.upload.onprogress=ct=>{ct.lengthComputable&&G(ct.loaded/ct.total*100)},await new Promise((ct,zt)=>{De.onload=()=>{De.status>=200&&De.status<300?ct():zt(new Error(`Upload failed: ${De.status}`))},De.onerror=()=>zt(new Error("Upload failed")),De.open("PUT",Ie),De.setRequestHeader("AccessKey",Ze),De.send(je)}),b("processing");let Ke=0;const st=Date.now(),dt=90*1e3;for(;Ke<4;){if(await new Promise(zt=>setTimeout(zt,3e3)),Date.now()-st>dt){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:de||"Quick Video Touch",notes:Me||void 0,contact_id:oe&&oe!=="none"?oe:void 0,status:"processing",touch_type:"video_touch"}),s({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 ct=await TBe(Ce);if(Ke=ct.status,ne(ct.encodeProgress||0),Ke===4)fe({playbackUrl:ct.directPlayUrl,thumbnailUrl:ct.thumbnailUrl,previewUrl:ct.previewUrl||null,duration:ct.length||lt,fileSizeMb:(ct.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),s({title:"Upload failed",description:"Please try recording again.",variant:"destructive"}),b("record")}},[de,s]),xt=async()=>{if(!(!ie||!se))try{const je=oe&&oe!=="none"?oe:null,lt=await x.mutateAsync({bunny_video_id:ie,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:de||"Quick Video Touch",notes:Me,task_id:a||null,status:"ready"});we(lt.id),Ae(lt.share_token||null),je&&await y.mutateAsync({contactId:je,videoId:lt.id,notes:Me}),s({title:"Video saved successfully!"}),b("share")}catch(je){console.error("Save video error:",je),s({title:"Failed to save video",description:(je==null?void 0:je.message)||"Please try again.",variant:"destructive"})}},Ee=(je,lt)=>{navigator.clipboard.writeText(lt),Ue(je),setTimeout(()=>Ue(null),2e3),s({title:"Copied to clipboard!"})},et=()=>tt?`https://video.relevelup.com/${tt}`:(se==null?void 0:se.playbackUrl)||"",le=()=>{const je=m==null?void 0:m.find(De=>De.id===oe),lt=je?`${je.first_name}`:"",Ce=(je==null?void 0:je.phone)||"",Ie=(je==null?void 0:je.email)||"",Ze=et();return{text:`Hey${lt?` ${lt}`:""}! I recorded a quick video for you: ${Ze}`,link:Ze,contactPhone:Ce,contactEmail:Ie}},Ve=()=>{const{text:je,contactPhone:lt}=le(),Ce=lt?`sms:${lt}?body=${encodeURIComponent(je)}`:`sms:?body=${encodeURIComponent(je)}`;window.open(Ce,"_self")},Je=()=>{const{link:je,contactEmail:lt}=le(),Ce="Check out this video",Ie=`I recorded a quick video for you: ${je}`,Ze=lt?`mailto:${lt}?subject=${encodeURIComponent(Ce)}&body=${encodeURIComponent(Ie)}`:`mailto:?subject=${encodeURIComponent(Ce)}&body=${encodeURIComponent(Ie)}`;window.open(Ze,"_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(AVe,{maxDurationSeconds:60,onRecordingComplete:it,onRecordingStateChange:D,className:"w-full",teleprompterContent:M&&N&&r.jsx(IVe,{text:N,isVisible:M,onToggleVisibility:()=>E(!1),isRecording:R,startCountdown:!0})}),!M&&N&&r.jsxs(X,{variant:"outline",className:"mt-4",onClick:()=>E(!0),children:[r.jsx(ga,{className:"h-4 w-4 mr-2"}),"Show Teleprompter"]})]}),r.jsxs(He,{className:"lg:col-span-1",children:[r.jsx(Vt,{className:"pb-2",children:r.jsx(Gt,{className:"text-lg",children:"Teleprompter Script"})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsx(Ys,{placeholder:"Type or paste your script here...",value:N,onChange:je=>k(je.target.value),rows:6}),r.jsxs(Zne,{open:T,onOpenChange:P,children:[r.jsx(fye,{asChild:!0,children:r.jsxs(X,{variant:"outline",className:"w-full",children:[r.jsx(ga,{className:"h-4 w-4 mr-2"}),"Browse Scripts"]})}),r.jsxs(mP,{side:"right",className:"w-[400px] sm:w-[540px] p-0",children:[r.jsx(Yne,{className:"p-4 border-b",children:r.jsx(Xne,{children:"Select a Script"})}),r.jsx(EQt,{onSelectScript:je=>{k(je.text),P(!1),E(!0)},className:"h-[calc(100vh-80px)]"})]})]}),N&&r.jsx(X,{className:"w-full",onClick:()=>E(!0),children:"Use Script"})]})]})]}),v==="uploading"&&r.jsx(He,{className:"max-w-md mx-auto",children:r.jsxs(Xe,{className:"pt-6 text-center",children:[r.jsx(so,{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(lc,{value:H,className:"mb-2"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[H.toFixed(0),"%"]})]})}),v==="processing"&&r.jsx(He,{className:"max-w-md mx-auto",children:r.jsxs(Xe,{className:"pt-6 text-center space-y-4",children:[r.jsx(Vr,{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(lc,{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(Vt,{children:r.jsx(Gt,{children:"Video Details"})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"Title"}),r.jsx(ot,{value:de,onChange:je=>xe(je.target.value),placeholder:"Quick Video Touch"})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Attach to Contact (Optional)"}),r.jsxs(us,{value:oe,onValueChange:ce,children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"No contact - use anywhere"})}),r.jsxs(ds,{children:[r.jsx($t,{value:"none",children:r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(zo,{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(oc,{className:"h-4 w-4"}),je.first_name," ",je.last_name]})},je.id))]})]})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Notes"}),r.jsx(Ys,{value:Me,onChange:je=>ve(je.target.value),placeholder:"Add notes about this video...",rows:3})]}),r.jsxs(X,{className:"w-full",onClick:xt,disabled:x.isPending,children:[x.isPending&&r.jsx(Vr,{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(Vt,{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(Xe,{className:"space-y-4",children:[r.jsx("p",{className:"text-muted-foreground",children:"Share your video with one click:"}),r.jsxs("div",{className:"grid gap-3",children:[r.jsxs(X,{variant:"outline",className:"justify-start",onClick:Ve,children:[r.jsx(Bo,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),r.jsxs(X,{variant:"outline",className:"justify-start",onClick:Je,children:[r.jsx(Nn,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),r.jsxs(X,{variant:"outline",className:"justify-start",onClick:()=>Ee("link",le().link),children:[r.jsx(zo,{className:"h-4 w-4 mr-2"}),"Copy Video Link",Le==="link"&&r.jsx(fi,{className:"h-4 w-4 ml-auto text-green-500"})]}),r.jsxs(X,{variant:"outline",className:"justify-start",onClick:()=>$e(!0),children:[r.jsx(Wc,{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"),q(null),he(null),fe(null)},children:"Record Another"})]})]})]}),be&&tt&&r.jsx(PVe,{open:Pe,onOpenChange:$e,video:{id:be,share_token:tt,title:de||null,contact_id:oe||null,thumbnail_url:(se==null?void 0:se.thumbnailUrl)||null},contactName:((rt=m==null?void 0:m.find(je=>je.id===oe))==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(Zu,{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 LQt({open:e,onOpenChange:t}){const{data:s}=Np(),{data:n}=Wae(),a=Hae(),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,E]=A.useState(0),[T,P]=A.useState("idle"),R=(n==null?void 0:n.total_storage_mb)||0,U=((n==null?void 0:n.max_storage_mb)||1024)-R,q=ne=>{var se;const ie=(se=ne.target.files)==null?void 0:se[0];if(!ie)return;if(!ie.type.startsWith("video/")){Te.error("Please select a video file");return}const he=ie.size/(1024*1024);if(he>500){Te.error("Video file must be less than 500MB");return}if(he>U){Te.error(`Not enough storage. You have ${U.toFixed(1)} MB remaining.`);return}i(ie),u||m(ie.name.replace(/\.[^/.]+$/,""))},H=async()=>{if(!l){Te.error("Please select a video file");return}k(!0),E(0),P("creating");try{const{data:ne,error:ie}=await Y.functions.invoke("bunny-upload",{body:{action:"create",title:u||l.name,isAgentVideo:!0}});if(ie)throw new Error(ie.message);const{videoId:he,libraryId:se}=ne;P("uploading");const{data:fe,error:oe}=await Y.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:he,isAgentVideo:!0}});if(oe)throw new Error(oe.message);await new Promise((xe,Me)=>{const ve=new XMLHttpRequest;ve.upload.addEventListener("progress",be=>{if(be.lengthComputable){const we=Math.round(be.loaded/be.total*100);E(we)}}),ve.addEventListener("load",()=>{ve.status>=200&&ve.status<300?xe():Me(new Error(`Upload failed with status ${ve.status}`))}),ve.addEventListener("error",()=>Me(new Error("Upload failed"))),ve.open("PUT",fe.uploadUrl),ve.setRequestHeader("AccessKey",fe.apiKey),ve.send(l)}),P("processing");const ce=l.size/(1024*1024),de=`https://iframe.mediadelivery.net/embed/${se}/${he}`;await a.mutateAsync({bunny_video_id:he,playback_url:de,file_size_mb:ce,title:u||l.name,notes:x||void 0,contact_id:v||void 0,status:"processing",touch_type:"video_upload"}),Te.success("Video uploaded successfully! Processing may take a few minutes."),G()}catch(ne){console.error("Upload error:",ne),Te.error(ne instanceof Error?ne.message:"Failed to upload video")}finally{k(!1),P("idle")}},G=()=>{N||(i(null),m(""),y(""),b(""),E(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(Pr,{className:"sm:max-w-md",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Upload Video"}),r.jsx(Zs,{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(Ta,{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:ne=>{ne.stopPropagation(),i(null)},children:r.jsx(en,{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 ne;return(ne=o.current)==null?void 0:ne.click()},children:[r.jsx(so,{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:q,disabled:N})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"title",children:"Title"}),r.jsx(ot,{id:"title",value:u,onChange:ne=>m(ne.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(us,{value:v||"__none__",onValueChange:ne=>b(ne==="__none__"?"":ne),disabled:N,children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select a contact"})}),r.jsxs(ds,{children:[r.jsx($t,{value:"__none__",children:"No contact"}),s==null?void 0:s.map(ne=>r.jsxs($t,{value:ne.id,children:[ne.first_name," ",ne.last_name||""]},ne.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"notes",children:"Notes (optional)"}),r.jsx(Ys,{id:"notes",value:x,onChange:ne=>y(ne.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(Vr,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{children:Q()})]}),r.jsx(lc,{value:T==="uploading"?M:T==="processing"?100:10})]})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:G,disabled:N,children:"Cancel"}),r.jsx(X,{onClick:H,disabled:!l||N,children:N?r.jsxs(r.Fragment,{children:[r.jsx(Vr,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Upload Video"]})})]})]})})}function OQt({open:e,onOpenChange:t,video:s,gmailEmail:n,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,E]=A.useState(""),[T,P]=A.useState(""),[R,D]=A.useState(!1),U=s.share_token?`https://video.relevelup.com/${s.share_token}`:"",q=s.share_token?`https://video.relevelup.com/thumb/${s.share_token}`:a||s.thumbnail_url||"",H=s.title||"Video Message";A.useEffect(()=>{e&&l.length===0&&G()},[e]),A.useEffect(()=>{if(e&&(E(`I recorded a video for you — ${H}`),P("Hey! I recorded a quick video just for you. Click below to watch it:"),m(null),k(""),s.contact_id)){const fe=l.find(oe=>oe.id===s.contact_id);fe&&(m(fe),k(fe.email||""))}},[e,s.contact_id,l]);const G=async()=>{b(!0);try{const{data:fe,error:oe}=await Y.from("innercircle_contacts").select("id, first_name, last_name, email").order("first_name",{ascending:!0}).limit(500);if(oe)throw oe;i(fe||[])}catch{console.error("Failed to fetch contacts")}finally{b(!1)}},Q=fe=>{m(fe),y(!1),k(fe.email||""),P(`Hey ${fe.first_name}! I recorded a quick video just for you. Click below to watch it:`),E(`I recorded a video for you — ${H}`)},ne=()=>{m(null),k(""),P("Hey! I recorded a quick video just for you. Click below to watch it:")},ie=fe=>`${fe.first_name} ${fe.last_name||""}`.trim(),he=()=>`
${T.split(/\n\n+/).map(oe=>`

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

`).join("")}

▶ Watch Video

`,se=async()=>{if(!N){Te.error("Please enter a recipient email");return}if(!U){Te.error("Video does not have a share link");return}D(!0);try{const fe=he(),{data:oe,error:ce}=await Y.functions.invoke("gmail-send",{body:{to:N,subject:M,body:fe,contactId:(u==null?void 0:u.id)||null}});if(ce)throw ce;if(!(oe!=null&&oe.success))throw new Error((oe==null?void 0:oe.error)||"Failed to send");Te.success("Video email sent!"),t(!1),o==null||o()}catch(fe){console.error("Gmail send error:",fe),Te.error("Failed to send: "+(fe instanceof Error?fe.message:"Unknown error"))}finally{D(!1)}};return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Pr,{className:"sm:max-w-[560px] max-h-[90vh] overflow-y-auto",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{className:"flex items-center gap-2",children:[r.jsx(Nn,{className:"h-5 w-5 text-red-500"}),"Send Video via Gmail"]}),n&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sending from ",r.jsx("span",{className:"font-medium",children:n})]})]}),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(Kc,{open:x,onOpenChange:y,children:[r.jsx(Zc,{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(oc,{className:"h-4 w-4 text-muted-foreground"}),ie(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(Ac,{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(fe=>fe.email).map(fe=>r.jsxs(zy,{value:`${fe.first_name} ${fe.last_name||""} ${fe.email||""}`,onSelect:()=>Q(fe),children:[r.jsx(fi,{className:Ut("mr-2 h-4 w-4",(u==null?void 0:u.id)===fe.id?"opacity-100":"opacity-0")}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:ie(fe)}),r.jsx("div",{className:"text-xs text-muted-foreground",children:fe.email})]})]},fe.id))})]})]})})]}),u&&r.jsx(X,{variant:"ghost",size:"icon",onClick:ne,className:"shrink-0",children:r.jsx(en,{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(ot,{id:"video-to",value:N,onChange:fe=>k(fe.target.value),placeholder:"recipient@example.com",type:"email"})]}),r.jsx(pd,{}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{htmlFor:"video-subject",children:"Subject"}),r.jsx(ot,{id:"video-subject",value:M,onChange:fe=>E(fe.target.value)})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{htmlFor:"video-message",children:"Personal Message"}),r.jsx(Ys,{id:"video-message",value:T,onChange:fe=>P(fe.target.value),rows:4,className:"resize-y"})]}),r.jsxs("div",{className:"rounded-lg border bg-muted/30 p-3 space-y-2",children:[r.jsx(ze,{className:"text-xs text-muted-foreground",children:"Video Preview (embedded in email)"}),r.jsxs("div",{className:"relative rounded-lg overflow-hidden bg-black",style:{maxWidth:320},children:[q?r.jsx("img",{src:q,alt:H,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(Hl,{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(Hl,{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:R,children:"Cancel"}),r.jsxs(X,{onClick:se,disabled:R||!N||!M,className:"gap-2",children:[R?r.jsx(Vr,{className:"h-4 w-4 animate-spin"}):r.jsx(ro,{className:"h-4 w-4"}),R?"Sending...":"Send Video Email"]})]})]})]})})}function DQt({previewSrc:e,thumbnailSrc:t,alt:s,isHovered:n}){const[a,o]=A.useState(!1),[l,i]=A.useState(!1),u=n&&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(Ta,{className:"h-12 w-12 text-muted-foreground"})}):r.jsxs(r.Fragment,{children:[m&&r.jsx("img",{src:t,alt:s,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:s,className:"w-full h-full object-cover absolute inset-0",onError:()=>o(!0)})]})}function RQt({video:e,previewSrc:t,thumbnailSrc:s,onOpen:n,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[E,T]=A.useState(!1);return r.jsxs(He,{className:"overflow-hidden group cursor-pointer",onClick:n,onMouseEnter:()=>T(!0),onMouseLeave:()=>T(!1),children:[r.jsxs("div",{className:"relative aspect-video bg-muted overflow-hidden",children:[r.jsx(DQt,{previewSrc:t,thumbnailSrc:s,alt:e.title||"Video preview",isHovered:E}),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(Hl,{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(Xe,{className:"p-3",children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h3",{className:"font-medium truncate",children:e.title||"Untitled Video"}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mt-1",children:[r.jsx(oc,{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(Ra,{className:"h-3 w-3"}),r.jsx("span",{children:rs(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(mo,{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(Nn,{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(oc,{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(Ra,{className:"h-3 w-3"}),r.jsx("span",{children:rs(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(mo,{className:"h-3 w-3"}),r.jsxs("span",{children:[e.view_count," ",e.view_count===1?"view":"views"]})]})]})]}),r.jsxs(uh,{children:[r.jsx(hh,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:P=>P.stopPropagation(),children:r.jsx(Ng,{className:"h-4 w-4"})})}),r.jsxs(Cu,{align:"end",className:"bg-popover",children:[r.jsxs(Wa,{onClick:P=>{P.stopPropagation(),n()},children:[r.jsx(mo,{className:"h-4 w-4 mr-2"}),"Watch"]}),r.jsx(dk,{}),r.jsxs(Wa,{onClick:P=>{P.stopPropagation(),x()},children:[r.jsx(Wc,{className:"h-4 w-4 mr-2"}),"Share with Template"]}),r.jsxs(Wa,{onClick:P=>{P.stopPropagation(),k(N(e),"Share link")},children:[r.jsx(zo,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),r.jsxs(Wa,{onClick:P=>{P.stopPropagation(),i()},children:[r.jsx(Lj,{className:"h-4 w-4 mr-2"}),"Get Embed Code"]}),r.jsxs(Wa,{onClick:P=>{P.stopPropagation(),u()},children:[r.jsx(Nn,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),r.jsxs(Wa,{onClick:P=>{P.stopPropagation(),m()},children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Embed to CRM"]}),v&&e.share_token&&r.jsxs(Wa,{onClick:P=>{P.stopPropagation(),y==null||y()},children:[r.jsx(ro,{className:"h-4 w-4 mr-2"}),"Send via Gmail"]}),r.jsxs(Wa,{onClick:P=>{P.stopPropagation(),o()},children:[r.jsx(Ja,{className:"h-4 w-4 mr-2"}),"Rename"]}),r.jsx(dk,{}),e.contact_id&&r.jsxs(Wa,{onClick:P=>{P.stopPropagation(),l()},children:[r.jsx(oc,{className:"h-4 w-4 mr-2"}),"View Contact"]}),r.jsxs(Wa,{onClick:P=>{P.stopPropagation(),a()},className:"text-destructive",children:[r.jsx(Bs,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})})]})}function FQt(){var Ze;const e=Hs(),{data:t,isLoading:s,refetch:n}=h5t(),{data:a}=Wae(),{data:o}=Np(),l=f5t(),i=p5t(),{isGmailConnected:u,gmailEmail:m}=MP(),[x,y]=A.useState(""),[v,b]=A.useState(null),[N,k]=A.useState(!1),[M,E]=A.useState(!1),[T,P]=A.useState(!1),[R,D]=A.useState(!1),[U,q]=A.useState(!1),[H,G]=A.useState(""),[Q,ne]=A.useState(!1),[ie,he]=A.useState(!1),[se,fe]=A.useState(!1),[oe,ce]=A.useState(!1),[de,xe]=A.useState(""),[Me,ve]=A.useState({}),be=De=>{if(!De)return"Unassigned";const Ke=o==null?void 0:o.find(st=>st.id===De);return Ke?`${Ke.first_name} ${Ke.last_name||""}`.trim():"Unknown"},we=De=>{if(!De)return"0:00";const Ke=Math.floor(De/60),st=De%60;return`${Ke}:${st.toString().padStart(2,"0")}`},tt=t==null?void 0:t.filter(De=>{if(!x)return!0;const Ke=be(De.contact_id).toLowerCase(),st=(De.title||"").toLowerCase(),dt=(De.notes||"").toLowerCase();return Ke.includes(x.toLowerCase())||st.includes(x.toLowerCase())||dt.includes(x.toLowerCase())}),[Ae,Le]=A.useState(!1);A.useEffect(()=>{if(Ae)return;(async()=>{if(!(t!=null&&t.length))return;const Ke=t.filter(dt=>dt.status==="processing"&&dt.bunny_video_id);if(!Ke.length)return;let st=!1;for(const dt of Ke)try{const{data:ct,error:zt}=await Y.functions.invoke("bunny-upload",{body:{action:"status",videoId:dt.bunny_video_id,isAgentVideo:!0}});if(zt||!ct)continue;ct.status===4&&(await Y.from("agent_videos").update({status:"ready",playback_url:ct.directPlayUrl,thumbnail_url:ct.thumbnailUrl,preview_url:ct.previewUrl,duration_seconds:ct.length||dt.duration_seconds,updated_at:new Date().toISOString()}).eq("id",dt.id),st=!0)}catch(ct){console.warn("Reconcile check failed for video",dt.id,ct)}Le(!0),st&&n()})()},[t,Ae,n]),A.useEffect(()=>{(async()=>{if(!(t!=null&&t.length))return;const Ke=t.filter(ir=>(ir==null?void 0:ir.bunny_video_id)&&!Me[ir.id]);if(!Ke.length)return;const st=Ke.map(ir=>ir.bunny_video_id),{data:dt,error:ct}=await Y.functions.invoke("bunny-upload",{body:{action:"bulk-asset-urls",videoIds:st,isAgentVideo:!0}});if(ct)throw ct;const zt=(dt==null?void 0:dt.assets)||{};ve(ir=>{const Tr={...ir};for(const Zr of Ke)zt[Zr.bunny_video_id]&&(Tr[Zr.id]={previewUrl:zt[Zr.bunny_video_id].previewUrl,thumbnailUrl:zt[Zr.bunny_video_id].thumbnailUrl});return Tr})})().catch(Ke=>console.warn("Failed to load signed Bunny asset URLs",Ke))},[t,Me]);const Ue=(a==null?void 0:a.total_storage_mb)||0,Pe=(a==null?void 0:a.max_storage_mb)||1024,$e=Ue/Pe*100,it=$e>=80,xt=$e>=100,Ee=async(De,Ke)=>{await navigator.clipboard.writeText(De),Te.success(`${Ke} copied to clipboard`)},et=De=>De.share_token?`https://video.relevelup.com/${De.share_token}`:De.playback_url||"",le=De=>{const Ke=et(De),st=o==null?void 0:o.find(Zr=>Zr.id===De.contact_id),dt=be(De.contact_id),ct=dt!=="Unassigned"?dt.split(" ")[0]:"",zt=(st==null?void 0:st.phone)||"",ir=`Hey${ct?` ${ct}`:""}! I recorded a quick video message for you. Check it out: ${Ke}`,Tr=zt?`sms:${zt}?body=${encodeURIComponent(ir)}`:`sms:?body=${encodeURIComponent(ir)}`;window.open(Tr,"_self")},Ve=De=>{const Ke=o==null?void 0:o.find(Tr=>Tr.id===De.contact_id),st=(Ke==null?void 0:Ke.email)||"",dt=et(De),ct="Check out this video",zt=`I recorded a quick video for you: ${dt}`,ir=st?`mailto:${st}?subject=${encodeURIComponent(ct)}&body=${encodeURIComponent(zt)}`:`mailto:?subject=${encodeURIComponent(ct)}&body=${encodeURIComponent(zt)}`;window.open(ir,"_self")},Je=De=>{var ct;const Ke=et(De),st=De.title||"Video Message",dt=De.share_token?`https://video.relevelup.com/thumb/${De.share_token}`:((ct=Me[De.id])==null?void 0:ct.thumbnailUrl)||De.thumbnail_url||"";return``},rt=async De=>{if(!De.thumbnail_url&&!De.share_token){Te.error("Video thumbnail not available yet");return}const Ke=Je(De),st=et(De),dt=`Watch: ${De.title||"Video Message"} ${st}`;try{const ct=new Blob([Ke],{type:"text/html"}),zt=new Blob([dt],{type:"text/plain"}),ir=new ClipboardItem({"text/html":ct,"text/plain":zt});await navigator.clipboard.write([ir]),Te.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(dt+` `+Ke),Te.success("Copied! Paste into your email.")}},je=async De=>{try{Te.loading("Preparing download...",{id:"download"});const{data:Ke,error:st}=await Y.functions.invoke("bunny-upload",{body:{action:"download-url",videoId:De.bunny_video_id,isAgentVideo:!0}});if(st||!(Ke!=null&&Ke.downloadUrl))throw new Error((st==null?void 0:st.message)||"Failed to get download URL");const ct=`${((De.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(),Tr=URL.createObjectURL(ir),Zr=document.createElement("a");Zr.href=Tr,Zr.download=ct,Zr.rel="noreferrer",document.body.appendChild(Zr),Zr.click(),Zr.remove(),URL.revokeObjectURL(Tr),Te.success("Download started",{id:"download"})}catch(Ke){console.error("Download error:",Ke),Te.error("Could not force download (your browser may block it).",{id:"download"})}},lt=async De=>{b(De),ne(!0),G(""),q(!0);try{const{data:Ke,error:st}=await Y.functions.invoke("bunny-upload",{body:{action:"crm-embed",videoId:De.bunny_video_id,title:De.title,isAgentVideo:!0,shareToken:De.share_token}});if(st||!(Ke!=null&&Ke.html))throw new Error("Failed to generate CRM embed code");G(Ke.html)}catch(Ke){console.error("CRM embed error:",Ke),Te.error("Failed to generate CRM embed code"),q(!1)}finally{ne(!1)}},Ce=De=>{b(De),k(!0)},Ie=async()=>{if(v)try{await l.mutateAsync({id:v.id,bunnyVideoId:v.bunny_video_id,hardDelete:!0}),E(!1),b(null),Te.success("Video deleted successfully")}catch{Te.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(so,{className:"h-4 w-4 mr-2"}),"Upload Video"]}),r.jsxs(X,{onClick:()=>e("/mission-control/video/record"),children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Record New Video"]})]})]}),r.jsx(He,{className:it?"border-amber-500":xt?"border-destructive":"",children:r.jsxs(Xe,{className:"py-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(dA,{className:`h-5 w-5 ${xt?"text-destructive":it?"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:[Ue.toFixed(1)," MB / ",Pe>=1024?`${(Pe/1024).toFixed(0)} GB`:`${Pe} MB`]})]}),r.jsx(lc,{value:Math.min($e,100),className:`h-2 ${xt?"[&>div]:bg-destructive":it?"[&>div]:bg-amber-500":""}`})]}),it&&!xt&&r.jsxs(Tt,{variant:"outline",className:"border-amber-500 text-amber-600",children:[r.jsx(vl,{className:"h-3 w-3 mr-1"}),"Near Limit"]}),xt&&r.jsxs(Tt,{variant:"destructive",children:[r.jsx(vl,{className:"h-3 w-3 mr-1"}),"At Limit"]})]}),xt&&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(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search videos by contact, title, or notes...",value:x,onChange:De=>y(De.target.value),className:"pl-10"})]}),s?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"})}):(tt==null?void 0:tt.length)===0?r.jsx(He,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx(Ta,{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(vs,{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:tt==null?void 0:tt.map(De=>{var Ke,st;return r.jsx(RQt,{video:De,previewSrc:(Ke=Me[De.id])==null?void 0:Ke.previewUrl,thumbnailSrc:(st=Me[De.id])==null?void 0:st.thumbnailUrl,onOpen:()=>Ce(De),onDelete:()=>{b(De),E(!0)},onRename:()=>{b(De),xe(De.title||""),ce(!0)},onNavigateToContact:()=>e(`/mission-control/contacts/${De.contact_id}`),onGetEmbedCode:()=>{b(De),D(!0)},onCopyEmailHtml:()=>rt(De),onEmbedToCrm:()=>lt(De),onShareWithTemplate:()=>{b(De),he(!0)},onSendViaGmail:()=>{b(De),fe(!0)},isGmailConnected:u,getContactName:be,getShareUrl:et,copyToClipboard:Ee,formatDuration:we},De.id)})}),r.jsx(Or,{open:N,onOpenChange:k,children:r.jsxs(Pr,{className:"max-w-2xl",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:(v==null?void 0:v.title)||"Video Preview"}),r.jsx(Zs,{children:(v==null?void 0:v.contact_id)&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(oc,{className:"h-3 w-3"}),be(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(Vr,{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),n()},children:[r.jsx(Go,{className:"h-4 w-4 mr-2"}),"Refresh Library"]})]}):r.jsx("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:v.playback_url?(()=>{let De=v.playback_url;return De.includes("iframe.mediadelivery.net/play/")&&(De=De.replace("/play/","/embed/"),De+=(De.includes("?")?"&":"?")+"autoplay=false&responsive=true"),De.includes("iframe.mediadelivery.net")?r.jsx("iframe",{src:De,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:()=>Te.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(Ta,{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(Bo,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),!u&&r.jsxs(X,{variant:"outline",onClick:()=>Ve(v),children:[r.jsx(Nn,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),r.jsxs(X,{variant:"outline",onClick:()=>Ee(et(v),"Share link"),children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),r.jsxs(X,{variant:"outline",onClick:()=>rt(v),children:[r.jsx(Nn,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),r.jsxs(X,{variant:"outline",onClick:()=>je(v),children:[r.jsx($i,{className:"h-4 w-4 mr-2"}),"Download Video"]}),r.jsxs(X,{variant:"outline",onClick:()=>{k(!1),lt(v)},children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Embed to CRM"]}),r.jsxs(X,{variant:"outline",onClick:()=>{k(!1),he(!0)},children:[r.jsx(Wc,{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),fe(!0)},children:[r.jsx(ro,{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),E(!0)},children:[r.jsx(Bs,{className:"h-4 w-4 mr-2"}),"Delete Video"]})})]})]})}),r.jsx(Or,{open:M,onOpenChange:E,children:r.jsxs(Pr,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Delete Video"}),r.jsx(Zs,{children:"Are you sure you want to delete this video? This action cannot be undone."})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>E(!1),children:"Cancel"}),r.jsx(X,{variant:"destructive",onClick:Ie,disabled:l.isPending,children:l.isPending?"Deleting...":"Delete"})]})]})}),r.jsx(LQt,{open:T,onOpenChange:P}),r.jsx(Or,{open:R,onOpenChange:D,children:r.jsxs(Pr,{className:"sm:max-w-lg",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Embed Video"}),r.jsx(Zs,{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(Ys,{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 De=``;Ee(De,"Embed code")},children:[r.jsx(Mo,{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(PVe,{open:ie,onOpenChange:he,video:v,contactName:be(v.contact_id)}),v&&r.jsx(OQt,{open:se,onOpenChange:fe,video:v,gmailEmail:m,signedThumbnailUrl:(Ze=Me[v.id])==null?void 0:Ze.thumbnailUrl}),r.jsx(Or,{open:oe,onOpenChange:ce,children:r.jsxs(Pr,{className:"max-w-sm",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Rename Video"}),r.jsx(Zs,{children:"Enter a new title for this video."})]}),r.jsx(ot,{value:de,onChange:De=>xe(De.target.value),placeholder:"Video title",autoFocus:!0,onKeyDown:De=>{De.key==="Enter"&&de.trim()&&i.mutate({id:v.id,title:de.trim()},{onSuccess:()=>{Te.success("Video renamed"),ce(!1)}})}}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>ce(!1),children:"Cancel"}),r.jsx(X,{disabled:!de.trim()||i.isPending,onClick:()=>{i.mutate({id:v.id,title:de.trim()},{onSuccess:()=>{Te.success("Video renamed"),ce(!1)}})},children:i.isPending?"Saving...":"Save"})]})]})}),r.jsx(Or,{open:U,onOpenChange:q,children:r.jsxs(Pr,{className:"sm:max-w-lg",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{className:"flex items-center gap-2",children:[r.jsx(Sn,{className:"h-5 w-5"}),"Embed to CRM"]}),r.jsx(Zs,{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(Vr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):H?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(Ys,{readOnly:!0,rows:12,value:H,className:"font-mono text-xs"})]}),r.jsxs(X,{className:"w-full",onClick:()=>{Ee(H,"CRM embed code")},children:[r.jsx(Mo,{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 LVe({stages:e,currentStageId:t,onStageSelect:s,disabled:n}){const[a,o]=A.useState(!1),l=e.find(u=>u.id===t),i=u=>{u.id!==t&&s(u.id,u.name),o(!1)};return r.jsxs(uh,{open:a,onOpenChange:o,children:[r.jsx(hh,{asChild:!0,children:r.jsxs(X,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",disabled:n,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(Zi,{className:"h-3 w-3 shrink-0"})]})}),r.jsx(Cu,{align:"end",className:"w-48 z-50 bg-popover",onClick:u=>u.stopPropagation(),children:e.map(u=>{const m=u.icon&&IIe[u.icon]||sh,x=u.id===t;return r.jsxs(Wa,{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 zQt={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"}},BQt={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 OVe({deal:e,onClick:t,isDragging:s,stages:n,onStageChange:a,showStagePicker:o=!1,isWonStage:l=!1}){var E,T;const i=H3(),u=zQt[e.deal_type],m=BQt[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 R=e.contract_date?new Date(e.contract_date):new Date;return Py(R,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",s&&"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(Xe,{className:"p-3 space-y-2.5",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("h4",{className:"font-medium text-sm leading-tight line-clamp-2 group-hover:text-primary transition-colors",children:e.deal_name})}),r.jsx(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(Xn,{className:"h-5 w-5",children:r.jsxs(Qn,{className:"text-[10px] bg-primary/10 text-primary",children:[(E=e.contact.first_name)==null?void 0:E[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(ym,{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(lo,{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(Ki,{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(oA,{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(sa,{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&&n&&a?r.jsx(LVe,{stages:n,currentStageId:e.stage_id||"",onStageSelect:(P,R)=>a(e.id,P,R)}):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(vl,{className:"h-3 w-3"}):r.jsx(jn,{className:"h-3 w-3"}),r.jsx("span",{children:y?`${Math.abs(x)}d overdue`:v?`${x}d left`:rs(new Date(e.target_close_date),"MMM d")})]}):null]})]})})}function $Qt({stage:e,deals:t,onDealClick:s,onAddDeal:n,onDragStart:a,onDragOver:o,onDrop:l,isDragOver:i,isWonStage:u=!1}){const m=A.useRef(null),x=t.reduce((N,k)=>N+(k.expected_price||0),0),y=t.reduce((N,k)=>N+(k.expected_commission||0),0),v=N=>N>=1e6?`$${(N/1e6).toFixed(1)}M`:N>=1e3?`$${(N/1e3).toFixed(0)}K`:`$${N.toFixed(0)}`,b=e.icon&&IIe[e.icon]||sh;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(Yo,{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(OVe,{deal:N,onClick:()=>s(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:()=>n(e.id),children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Add Deal"]})})]})}function UQt({stats:e,isLoading:t}){const s=a=>a>=1e6?`$${(a/1e6).toFixed(1)}M`:a>=1e3?`$${(a/1e3).toFixed(0)}K`:`$${a.toLocaleString()}`,n=[{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:s((e==null?void 0:e.pipelineValue)||0),icon:wc,color:"text-purple-500",bgColor:"bg-purple-500/10"},{label:"Expected GCI",value:s((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:lo,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(Xe,{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:n.map(a=>r.jsx(He,{className:"border-border/50 hover:shadow-sm transition-shadow",children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className: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 qQt=[{value:"buyer",label:"Buyer"},{value:"seller",label:"Seller"},{value:"dual",label:"Dual Agency"},{value:"referral",label:"Referral"},{value:"lease",label:"Lease"}],VQt=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"urgent",label:"Urgent"}];function HQt({open:e,onOpenChange:t,deal:s,defaultStageId:n}){const{data:a}=lve(),{data:o}=Np(),{data:l}=LRe(),i=MVe(),u=TVe(),[m,x]=A.useState(""),[y,v]=A.useState(!1),b=(l==null?void 0:l.filter(R=>((s==null?void 0:s.listing_id)===R.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 R,D,U;e&&(s?(k({deal_name:s.deal_name,deal_type:s.deal_type,stage_id:s.stage_id||"",contact_id:s.contact_id||"",listing_id:s.listing_id||"",property_address:s.property_address||"",city:s.city||"",state:s.state||"",zip_code:s.zip_code||"",expected_price:((R=s.expected_price)==null?void 0:R.toString())||"",commission_percentage:((D=s.commission_percentage)==null?void 0:D.toString())||"3",target_close_date:s.target_close_date?new Date(s.target_close_date):void 0,contract_date:s.contract_date?new Date(s.contract_date):void 0,listing_date:s.listing_date?new Date(s.listing_date):void 0,priority:s.priority,probability:s.probability.toString(),notes:s.notes||""}),s.contact&&x(`${s.contact.first_name} ${s.contact.last_name}`)):(k({deal_name:"",deal_type:"buyer",stage_id:n||((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,s,n,a]);const M=o==null?void 0:o.filter(R=>{var U,q,H;const D=m.toLowerCase();return((U=R.first_name)==null?void 0:U.toLowerCase().includes(D))||((q=R.last_name)==null?void 0:q.toLowerCase().includes(D))||((H=R.email)==null?void 0:H.toLowerCase().includes(D))}).slice(0,5),E=()=>{const R=parseFloat(N.expected_price)||0,D=parseFloat(N.commission_percentage)||0;return R*(D/100)},T=async R=>{var D,U,q;if(R.preventDefault(),!N.deal_name.trim()){Te.error("Please enter a deal name");return}try{const H={deal_name:N.deal_name,deal_type:N.deal_type,stage_id:N.stage_id||null,contact_id:N.contact_id||null,listing_id:N.listing_id||null,property_address:N.property_address||null,city:N.city||null,state:N.state||null,zip_code:N.zip_code||null,expected_price:N.expected_price?parseFloat(N.expected_price):null,expected_commission:E()||null,commission_percentage:N.commission_percentage?parseFloat(N.commission_percentage):3,target_close_date:((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:((q=N.listing_date)==null?void 0:q.toISOString().split("T")[0])||null,priority:N.priority,probability:parseInt(N.probability)||50,notes:N.notes||null};s?(await u.mutateAsync({id:s.id,...H}),Te.success("Deal updated successfully")):(await i.mutateAsync(H),Te.success("Deal created successfully")),t(!1)}catch{Te.error("Failed to save deal")}},P=i.isPending||u.isPending;return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Pr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:s?"Edit Deal":"Add New Deal"}),r.jsx(Zs,{children:s?"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(ot,{id:"deal_name",value:N.deal_name,onChange:R=>k(D=>({...D,deal_name:R.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(us,{value:N.deal_type,onValueChange:R=>k(D=>({...D,deal_type:R})),children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsx(ds,{children:qQt.map(R=>r.jsx($t,{value:R.value,children:R.label},R.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Stage"}),r.jsxs(us,{value:N.stage_id||"none",onValueChange:R=>k(D=>({...D,stage_id:R==="none"?"":R})),children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select stage"})}),r.jsxs(ds,{children:[r.jsx($t,{value:"none",children:"No Stage"}),a==null?void 0:a.map(R=>r.jsx($t,{value:R.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:R.color}}),R.name]})},R.id))]})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Link to Contact"}),r.jsxs("div",{className:"relative",children:[r.jsx(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{value:m,onChange:R=>{x(R.target.value),v(!0),R.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(R=>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:R.id})),x(`${R.first_name} ${R.last_name}`),v(!1)},children:[r.jsx(oc,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:[R.first_name," ",R.last_name]}),R.email&&r.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:R.email})]},R.id))})]})]}),b.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ze,{className:"flex items-center gap-2",children:[r.jsx(ym,{className:"h-4 w-4"}),"Link to Listing Exchange"]}),r.jsxs(us,{value:N.listing_id||"none",onValueChange:R=>{const D=R==="none"?"":R,U=b.find(q=>q.id===D);k(U?q=>{var H;return{...q,listing_id:D,deal_type:"seller",property_address:U.property_address||q.property_address,city:U.city||q.city,state:U.state||q.state,expected_price:((H=U.price)==null?void 0:H.toString())||q.expected_price}}:q=>({...q,listing_id:D}))},children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select a listing to sync status..."})}),r.jsxs(ds,{children:[r.jsx($t,{value:"none",children:"None"}),b.map(R=>r.jsx($t,{value:R.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:R.property_address||`${R.city}, ${R.state}`}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["$",(R.price/1e3).toFixed(0),"K"]})]})},R.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(ot,{id:"property_address",value:N.property_address,onChange:R=>k(D=>({...D,property_address:R.target.value})),placeholder:"123 Main Street"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"city",children:"City"}),r.jsx(ot,{id:"city",value:N.city,onChange:R=>k(D=>({...D,city:R.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(ot,{id:"state",value:N.state,onChange:R=>k(D=>({...D,state:R.target.value})),maxLength:2,placeholder:"TX"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"zip_code",children:"ZIP"}),r.jsx(ot,{id:"zip_code",value:N.zip_code,onChange:R=>k(D=>({...D,zip_code:R.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(ot,{id:"expected_price",type:"number",value:N.expected_price,onChange:R=>k(D=>({...D,expected_price:R.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(ot,{id:"commission_percentage",type:"number",step:"0.1",value:N.commission_percentage,onChange:R=>k(D=>({...D,commission_percentage:R.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(ot,{value:E()?`$${E().toLocaleString()}`:"-",disabled:!0,className:"bg-muted"})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium text-sm",children:"Dates & Status"}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Target Close Date"}),r.jsxs(Kc,{children:[r.jsx(Zc,{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(jn,{className:"mr-2 h-4 w-4"}),N.target_close_date?rs(N.target_close_date,"PPP"):"Pick a date"]})}),r.jsx(Ac,{className:"w-auto p-0",align:"start",children:r.jsx(Df,{mode:"single",selected:N.target_close_date,onSelect:R=>k(D=>({...D,target_close_date:R})),initialFocus:!0,className:"pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Contract Date"}),r.jsxs(Kc,{children:[r.jsx(Zc,{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(jn,{className:"mr-2 h-4 w-4"}),N.contract_date?rs(N.contract_date,"PPP"):"Pick a date"]})}),r.jsx(Ac,{className:"w-auto p-0",align:"start",children:r.jsx(Df,{mode:"single",selected:N.contract_date,onSelect:R=>k(D=>({...D,contract_date:R})),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(Kc,{children:[r.jsx(Zc,{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(jn,{className:"mr-2 h-4 w-4"}),N.listing_date?rs(N.listing_date,"PPP"):"Pick a date"]})}),r.jsx(Ac,{className:"w-auto p-0",align:"start",children:r.jsx(Df,{mode:"single",selected:N.listing_date,onSelect:R=>k(D=>({...D,listing_date:R})),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(us,{value:N.priority,onValueChange:R=>k(D=>({...D,priority:R})),children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsx(ds,{children:VQt.map(R=>r.jsx($t,{value:R.value,children:R.label},R.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Win Probability"}),r.jsxs("div",{className:"relative",children:[r.jsx(ot,{type:"number",min:"0",max:"100",value:N.probability,onChange:R=>k(D=>({...D,probability:R.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(Ys,{id:"notes",value:N.notes,onChange:R=>k(D=>({...D,notes:R.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(Vr,{className:"h-4 w-4 mr-2 animate-spin"}),s?"Update Deal":"Create Deal"]})]})]})]})})}function WQt(e){return Kt({queryKey:["deal-files",e],queryFn:async()=>{const{data:t,error:s}=await Y.from("deal_files").select("*").eq("deal_id",e).order("created_at",{ascending:!1});if(s)throw s;return t},enabled:!!e})}function GQt(){const e=Pc(),t=Br();return ar({mutationFn:async({dealId:s,file:n})=>{if(!e)throw new Error("Not authenticated");const a=n.name.split(".").pop(),o=`${e}/${s}/${crypto.randomUUID()}.${a}`,{error:l}=await Y.storage.from("deal-files").upload(o,n);if(l)throw l;const{data:i,error:u}=await Y.from("deal_files").insert({deal_id:s,owner_user_id:e,file_name:n.name,file_size:n.size,file_type:n.type||null,storage_path:o}).select().single();if(u)throw u;return i},onSuccess:(s,n)=>{t.invalidateQueries({queryKey:["deal-files",n.dealId]})}})}function KQt(){const e=Br();return ar({mutationFn:async({fileId:t,storagePath:s,dealId:n})=>{await Y.storage.from("deal-files").remove([s]);const{error:a}=await Y.from("deal_files").delete().eq("id",t);if(a)throw a;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["deal-files",t]})}})}async function ZQt(e){const{data:t,error:s}=await Y.storage.from("deal-files").createSignedUrl(e,3600);if(s)throw s;return t.signedUrl}const YQt={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"}},XQt={note:Bo,call:Pi,email:Nn,meeting:jn,stage_change:Sn,task_completed:Ki,document:sa,system:Ra};function QQt({deal:e,open:t,onOpenChange:s,onEdit:n,onAddToScorecard:a,isWonStage:o}){var Le,Ue;const{data:l,isLoading:i}=mQt((e==null?void 0:e.id)||""),{data:u,isLoading:m}=fQt((e==null?void 0:e.id)||""),x=pQt(),y=xQt(),v=gQt(),b=hQt(),{data:N,isLoading:k}=WQt((e==null?void 0:e.id)||""),M=GQt(),E=KQt(),T=A.useRef(null),[P,R]=A.useState(""),[D,U]=A.useState(""),[q,H]=A.useState(!1),[G,Q]=A.useState(!1);if(!e)return null;const ne=YQt[e.deal_type],ie=(()=>{var it;if(e.deal_type!=="seller"&&e.deal_type!=="dual")return null;const Pe=((it=e.listing)==null?void 0:it.created_at)||e.listing_date;if(!Pe)return null;const $e=e.contract_date?new Date(e.contract_date):new Date;return Py($e,new Date(Pe))})(),he=Pe=>Pe?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(Pe):"-",se=async()=>{if(P.trim())try{await x.mutateAsync({deal_id:e.id,activity_type:"note",title:"Note added",description:P}),R(""),Te.success("Note added")}catch{Te.error("Failed to add note")}},fe=async()=>{if(D.trim())try{await y.mutateAsync({deal_id:e.id,title:D,sort_order:((u==null?void 0:u.length)||0)+1}),U(""),Te.success("Task added")}catch{Te.error("Failed to add task")}},oe=async(Pe,$e)=>{try{await v.mutateAsync({id:Pe,is_completed:$e,deal_id:e.id})}catch{Te.error("Failed to update task")}},ce=async()=>{try{await b.mutateAsync(e.id),Te.success("Deal deleted"),s(!1)}catch{Te.error("Failed to delete deal")}},de=(u==null?void 0:u.filter(Pe=>Pe.is_completed).length)||0,xe=(u==null?void 0:u.length)||0,Me=(N==null?void 0:N.length)||0,ve=Pe=>Pe<1024?`${Pe} B`:Pe<1024*1024?`${(Pe/1024).toFixed(1)} KB`:`${(Pe/(1024*1024)).toFixed(1)} MB`,be=Pe=>Pe?Pe.startsWith("image/")?El:Pe.includes("pdf")?ga:MS:MS,we=async Pe=>{const $e=Pe.target.files;if(!(!$e||!e)){Q(!0);try{for(const it of Array.from($e)){if(it.size>20*1024*1024){Te.error(`${it.name} exceeds 20MB limit`);continue}await M.mutateAsync({dealId:e.id,file:it})}Te.success("File(s) uploaded")}catch{Te.error("Failed to upload file")}finally{Q(!1),T.current&&(T.current.value="")}}},tt=async(Pe,$e)=>{if(e)try{await E.mutateAsync({fileId:Pe,storagePath:$e,dealId:e.id}),Te.success("File deleted")}catch{Te.error("Failed to delete file")}},Ae=async(Pe,$e)=>{try{const it=await ZQt(Pe),xt=document.createElement("a");xt.href=it,xt.download=$e,xt.target="_blank",document.body.appendChild(xt),xt.click(),document.body.removeChild(xt)}catch{Te.error("Failed to download file")}};return r.jsxs(r.Fragment,{children:[r.jsx(Zne,{open:t,onOpenChange:s,children:r.jsxs(mP,{className:"w-full sm:max-w-xl p-0 flex flex-col",children:[r.jsx(Yne,{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",ne.color),children:ne.label}),r.jsxs(Tt,{variant:"secondary",className:"text-xs capitalize",children:[e.priority," priority"]})]}),r.jsx(Xne,{className:"text-xl",children:e.deal_name})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(X,{variant:"outline",size:"icon",onClick:()=>n(e),children:r.jsx(vc,{className:"h-4 w-4"})}),r.jsx(X,{variant:"outline",size:"icon",className:"text-destructive hover:bg-destructive/10",onClick:()=>H(!0),children:r.jsx(Bs,{className:"h-4 w-4"})})]})]})}),r.jsx(Yo,{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(Xn,{className:"h-10 w-10",children:r.jsxs(Qn,{className:"bg-primary/10 text-primary",children:[(Le=e.contact.first_name)==null?void 0:Le[0],(Ue=e.contact.last_name)==null?void 0:Ue[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(Pi,{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(Nn,{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(sa,{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:he(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:he(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(lo,{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(Ki,{className:"h-4 w-4 text-green-600"}),r.jsx("span",{children:"Synced to Scorecard"})]}),ie!==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",ie>90?"text-red-600":ie>60?"text-amber-600":"text-foreground"),children:[ie," ",e.contract_date?"(final)":"days"]})]}),e.target_close_date&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(jn,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Close: ",rs(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(Si,{defaultValue:"tasks",className:"w-full",children:[r.jsxs(ki,{className:"w-full grid grid-cols-3",children:[r.jsxs(is,{value:"tasks",className:"gap-1",children:[r.jsx(Ki,{className:"h-4 w-4"}),"Tasks ",xe>0&&`(${de}/${xe})`]}),r.jsxs(is,{value:"files",className:"gap-1",children:[r.jsx(qj,{className:"h-4 w-4"}),"Files ",Me>0&&`(${Me})`]}),r.jsxs(is,{value:"activity",className:"gap-1",children:[r.jsx(Ra,{className:"h-4 w-4"}),"Activity"]})]}),r.jsxs(Ss,{value:"tasks",className:"mt-4 space-y-3",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ot,{placeholder:"Add a new task...",value:D,onChange:Pe=>U(Pe.target.value),onKeyDown:Pe=>Pe.key==="Enter"&&fe()}),r.jsx(X,{onClick:fe,disabled:!D.trim(),children:r.jsx(vs,{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(bl,{checked:Pe.is_completed,onCheckedChange:$e=>oe(Pe.id,!!$e)}),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:rs(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(Ss,{value:"files",className:"mt-4 space-y-3",children:[r.jsx("input",{type:"file",ref:T,className:"hidden",multiple:!0,onChange:we,accept:".pdf,.doc,.docx,.xls,.xlsx,.jpg,.jpeg,.png,.webp,.gif,.txt,.csv"}),r.jsxs(X,{variant:"outline",className:"w-full border-dashed",onClick:()=>{var Pe;return(Pe=T.current)==null?void 0:Pe.click()},disabled:G,children:[G?r.jsx(Vr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(so,{className:"h-4 w-4 mr-2"}),G?"Uploading...":"Upload Files"]}),r.jsxs("div",{className:"space-y-2",children:[N==null?void 0:N.map(Pe=>{const $e=be(Pe.file_type);return r.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg border bg-background",children:[r.jsx("div",{className:"w-8 h-8 rounded bg-muted flex items-center justify-center shrink-0",children:r.jsx($e,{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 truncate",children:Pe.file_name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[ve(Pe.file_size)," · ",rs(new Date(Pe.created_at),"MMM d, yyyy")]})]}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(X,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>Ae(Pe.storage_path,Pe.file_name),children:r.jsx($i,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>tt(Pe.id,Pe.storage_path),children:r.jsx(en,{className:"h-4 w-4"})})]})]},Pe.id)}),(N==null?void 0:N.length)===0&&r.jsx("p",{className:"text-center text-muted-foreground text-sm py-4",children:"No files yet. Upload contracts, disclosures, or other documents."})]})]}),r.jsxs(Ss,{value:"activity",className:"mt-4 space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ys,{placeholder:"Add a note...",value:P,onChange:Pe=>R(Pe.target.value),rows:2}),r.jsxs(X,{onClick:se,disabled:!P.trim(),size:"sm",className:"w-full",children:[r.jsx(ro,{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 $e=XQt[Pe.activity_type]||Ra;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($e,{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:ju(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(Dd,{open:q,onOpenChange:H,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(Vc,{onClick:ce,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function JQt({open:e,onOpenChange:t,deal:s,onComplete:n}){const a=mae(),o=TVe(),{data:l}=hae(),{data:i}=Vf(),[u,m]=A.useState({property_address:"",city:"",state:"",zip:"",transaction_type:"buyer",close_date:rs(new Date,"yyyy-MM-dd"),sale_price:0,commission_amount:0,lead_source_id:"",client_type_id:"",notes:""});A.useEffect(()=>{if(s&&e){const v=s.deal_type==="seller"?"seller":"buyer",b=s.expected_price||0,N=s.commission_percentage||3,k=s.expected_commission||b*N/100;m({property_address:s.property_address||s.deal_name||"",city:s.city||"",state:s.state||"",zip:s.zip_code||"",transaction_type:v,close_date:s.actual_close_date||s.target_close_date||rs(new Date,"yyyy-MM-dd"),sale_price:b,commission_amount:k,lead_source_id:"",client_type_id:"",notes:s.notes||""})}},[s,e]);const x=async v=>{if(v.preventDefault(),!!s)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:s.contact_id||null,notes:u.notes||null,is_win:!0});await o.mutateAsync({id:s.id,scorecard_transaction_id:b.id,actual_close_date:u.close_date}),Te.success("Deal added to Scorecard! 🎉"),t(!1),n==null||n()}catch(b){console.error("Error syncing to scorecard:",b),Te.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(Pr,{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(lo,{className:"h-6 w-6 text-green-600 dark:text-green-400"})}),r.jsx(Rr,{className:"text-center text-xl",children:"Congratulations on Closing! 🎉"}),r.jsx(Zs,{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(sa,{className:"h-4 w-4 text-muted-foreground"}),"Property Address *"]}),r.jsx(ot,{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(ot,{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(ot,{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(ot,{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(us,{value:u.transaction_type,onValueChange:v=>m(b=>({...b,transaction_type:v})),children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsxs(ds,{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(jn,{className:"h-4 w-4 text-muted-foreground"}),"Close Date *"]}),r.jsx(ot,{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(ot,{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(FS,{className:"h-4 w-4 text-muted-foreground"}),"GCI (Commission)"]}),r.jsx(ot,{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(us,{value:u.lead_source_id,onValueChange:v=>m(b=>({...b,lead_source_id:v})),children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select source"})}),r.jsx(ds,{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(us,{value:u.client_type_id,onValueChange:v=>m(b=>({...b,client_type_id:v})),children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select type"})}),r.jsx(ds,{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(Ys,{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(zn,{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(to,{className:"ml-2 h-4 w-4"})]})})]})]})]})})}const eJt={buyer:{label:"Buyer",color:"bg-blue-500/10 text-blue-600 border-blue-200"},seller:{label:"Seller",color:"bg-emerald-500/10 text-emerald-600 border-emerald-200"},dual:{label:"Dual",color:"bg-purple-500/10 text-purple-600 border-purple-200"},referral:{label:"Referral",color:"bg-orange-500/10 text-orange-600 border-orange-200"},lease:{label:"Lease",color:"bg-cyan-500/10 text-cyan-600 border-cyan-200"}},kTe={urgent:0,high:1,medium:2,low:3};function tJt({deals:e,stages:t,onDealClick:s,onStageChange:n}){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,E;let k=0;switch(a){case"deal_name":k=b.deal_name.localeCompare(N.deal_name);break;case"stage":{const T=((M=t.find(R=>R.id===b.stage_id))==null?void 0:M.sort_order)||0,P=((E=t.find(R=>R.id===N.stage_id))==null?void 0:E.sort_order)||0;k=T-P;break}case"expected_price":k=(b.expected_price||0)-(N.expected_price||0);break;case"expected_commission":k=(b.expected_commission||0)-(N.expected_commission||0);break;case"target_close_date":{const T=b.target_close_date?new Date(b.target_close_date).getTime():1/0,P=N.target_close_date?new Date(N.target_close_date).getTime():1/0;k=T-P;break}case"priority":k=kTe[b.priority]-kTe[N.priority];break}return l==="asc"?k:-k}),[e,t,a,l]),x=b=>b?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(b):"—",y=b=>b?t.find(N=>N.id===b):null,v=({field:b,children:N})=>r.jsxs(X,{variant:"ghost",size:"sm",className:"h-8 -ml-3 font-medium",onClick:()=>u(b),children:[N,a===b?l==="asc"?r.jsx(hp,{className:"ml-2 h-4 w-4"}):r.jsx(ly,{className:"ml-2 h-4 w-4"}):r.jsx(Dg,{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(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:m.map(b=>{y(b.stage_id);const N=eJt[b.deal_type],k=b.target_close_date?Py(new Date(b.target_close_date),new Date):null,M=k!==null&&k<0,E=k!==null&&k<=7&&k>=0;return r.jsxs(kr,{className:Ut("cursor-pointer hover:bg-muted/50 transition-colors",M&&"bg-red-50/50"),onClick:()=>s(b),children:[r.jsx(gt,{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(gt,{onClick:T=>T.stopPropagation(),children:r.jsx(LVe,{stages:t,currentStageId:b.stage_id||"",onStageSelect:(T,P)=>n(b.id,T,P)})}),r.jsx(gt,{children:r.jsx(Tt,{variant:"outline",className:Ut("text-xs",N.color),children:N.label})}),r.jsx(gt,{children:r.jsx("span",{className:"font-medium",children:x(b.expected_price)})}),r.jsx(gt,{children:r.jsx("span",{className:"text-emerald-600",children:x(b.expected_commission)})}),r.jsx(gt,{children:b.target_close_date?r.jsxs("div",{className:Ut("flex items-center gap-1 text-sm",M&&"text-red-600",E&&!M&&"text-amber-600"),children:[M&&r.jsx(vl,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:rs(new Date(b.target_close_date),"MMM d, yyyy")})]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(gt,{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 rJt extends A.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,s){console.error("DealPipeline error:",t,s)}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 sJt(){var it;const e=H3(),{data:t,isLoading:s}=lve(),{data:n,isLoading:a,refetch:o}=CVe(),{data:l,isLoading:i}=yQt(),u=SVe(),m=uQt(),[x,y]=A.useState("board"),[v,b]=A.useState(!1),[N,k]=A.useState(!1),[M,E]=A.useState(null),[T,P]=A.useState(null),[R,D]=A.useState(null),[U,q]=A.useState(null),[H,G]=A.useState(!1),[Q,ne]=A.useState(null),[ie,he]=A.useState(""),[se,fe]=A.useState("all");A.useEffect(()=>{!s&&t&&t.length===0&&u.mutate()},[s,t]);const[oe,ce]=Ic(),de=A.useRef(!1);A.useEffect(()=>{const xt=oe.get("deal");if(xt&&n&&n.length>0&&!de.current){const Ee=n.find(et=>et.id===xt);Ee&&(de.current=!0,E(Ee),k(!0),oe.delete("deal"),ce(oe,{replace:!0}))}},[n,oe]);const xe=(n==null?void 0:n.filter(xt=>{var Ve,Je,rt,je,lt,Ce;const Ee=ie.toLowerCase(),et=!Ee||xt.deal_name.toLowerCase().includes(Ee)||((Je=(Ve=xt.contact)==null?void 0:Ve.first_name)==null?void 0:Je.toLowerCase().includes(Ee))||((je=(rt=xt.contact)==null?void 0:rt.last_name)==null?void 0:je.toLowerCase().includes(Ee))||((lt=xt.property_address)==null?void 0:lt.toLowerCase().includes(Ee))||((Ce=xt.city)==null?void 0:Ce.toLowerCase().includes(Ee)),le=se==="all"||xt.deal_type===se;return et&&le}))||[],Me=xt=>{E(xt),k(!0)},ve=xt=>{P(xt||null),E(null),b(!0)},be=xt=>{E(xt),k(!1),b(!0)},we=(xt,Ee)=>{D(xt)},tt=(xt,Ee)=>{xt.preventDefault(),xt.dataTransfer.dropEffect="move",q(Ee)},Ae=async(xt,Ee)=>{if(xt.preventDefault(),q(null),!R)return;const et=n==null?void 0:n.find(Ve=>Ve.id===R),le=t==null?void 0:t.find(Ve=>Ve.id===Ee);if(!et||!le||et.stage_id===Ee){D(null);return}try{if(await m.mutateAsync({dealId:R,stageId:Ee,stageName:le.name}),Te.success(`Moved to ${le.name}`),le.is_won_stage&&!et.scorecard_transaction_id){const Ve={...et,stage_id:Ee};ne(Ve),G(!0)}}catch{Te.error("Failed to move deal")}D(null)},Le=A.useCallback(async(xt,Ee,et)=>{const le=n==null?void 0:n.find(Je=>Je.id===xt),Ve=t==null?void 0:t.find(Je=>Je.id===Ee);if(!(!le||!Ve||le.stage_id===Ee))try{if(await m.mutateAsync({dealId:xt,stageId:Ee,stageName:et}),Te.success(`Moved to ${et}`),Ve.is_won_stage&&!le.scorecard_transaction_id){const Je={...le,stage_id:Ee};ne(Je),G(!0)}}catch{Te.error("Failed to move deal")}},[n,t,m]),Ue=xt=>xe.filter(Ee=>Ee.stage_id===xt),Pe=s||a,$e=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(Go,{className:"h-4 w-4"})}),!e&&r.jsx(sP,{children:r.jsxs("div",{className:"flex bg-muted rounded-lg p-1 gap-0.5",children:[r.jsxs(Gg,{children:[r.jsx(Kg,{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(pp,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"Board"})]})}),r.jsx(Of,{children:"Kanban board view"})]}),r.jsxs(Gg,{children:[r.jsx(Kg,{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(fp,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"List"})]})}),r.jsx(Of,{children:"Grouped list view"})]}),r.jsxs(Gg,{children:[r.jsx(Kg,{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($S,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"Table"})]})}),r.jsx(Of,{children:"Sortable table view"})]})]})}),r.jsxs(X,{onClick:()=>ve(),children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Add Deal"]})]})]}),r.jsx(UQt,{stats:l||null,isLoading:i}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search deals, contacts, addresses...",value:ie,onChange:xt=>he(xt.target.value),className:"pl-9 pr-8"}),ie&&r.jsx("button",{onClick:()=>he(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:r.jsx(en,{className:"h-4 w-4"})})]}),r.jsxs(us,{value:se,onValueChange:fe,children:[r.jsx(cs,{className:"w-[140px]",children:r.jsx(ms,{placeholder:"All Types"})}),r.jsxs(ds,{children:[r.jsx($t,{value:"all",children:"All Types"}),r.jsx($t,{value:"buyer",children:"Buyer"}),r.jsx($t,{value:"seller",children:"Seller"}),r.jsx($t,{value:"dual",children:"Dual"}),r.jsx($t,{value:"referral",children:"Referral"}),r.jsx($t,{value:"lease",children:"Lease"})]})]}),(ie||se!=="all")&&r.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[xe.length," of ",(n==null?void 0:n.length)||0," deals"]})]})]}),r.jsx("div",{className:"flex-1 min-h-0 p-4 md:p-6 pt-4",children:Pe?r.jsx("div",{className:"flex gap-4 h-full",children:[1,2,3,4].map(xt=>r.jsx("div",{className:"min-w-[280px] max-w-[320px] flex-shrink-0",children:r.jsx(Cr,{className:"h-full rounded-xl"})},xt))}):$e==="board"?r.jsxs(Yo,{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(xt=>r.jsx($Qt,{stage:xt,deals:Ue(xt.id),onDealClick:Me,onAddDeal:ve,onDragStart:we,onDragOver:tt,onDrop:Ae,isDragOver:U===xt.id,isWonStage:xt.is_won_stage},xt.id))}),r.jsx(_ye,{orientation:"horizontal"})]}):$e==="table"?r.jsx(Yo,{className:"h-full",children:r.jsx(tJt,{deals:xe,stages:t||[],onDealClick:Me,onStageChange:Le})}):r.jsx(Yo,{className:"h-full",children:r.jsxs("div",{className:"space-y-6",children:[t==null?void 0:t.map(xt=>{const Ee=Ue(xt.id);return Ee.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:xt.color}}),r.jsx("h3",{className:"font-semibold",children:xt.name}),r.jsxs("span",{className:"text-muted-foreground text-sm",children:["(",Ee.length,")"]})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:Ee.map(et=>r.jsx(OVe,{deal:et,onClick:()=>Me(et),stages:t,onStageChange:Le,showStagePicker:!0,isWonStage:xt.is_won_stage},et.id))})]},xt.id)}),(n==null?void 0:n.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(pp,{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:()=>ve(),children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Add Your First Deal"]})]}),((n==null?void 0:n.length)||0)>0&&xe.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(ua,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("h3",{className:"font-semibold text-lg mb-2",children:"No matching deals"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Try adjusting your search or filters"}),r.jsx(X,{variant:"outline",onClick:()=>{he(""),fe("all")},children:"Clear Filters"})]})]})})})]}),r.jsx(HQt,{open:v,onOpenChange:b,deal:M,defaultStageId:T}),r.jsx(QQt,{deal:M,open:N,onOpenChange:k,onEdit:be,isWonStage:M?(it=t==null?void 0:t.find(xt=>xt.id===M.stage_id))==null?void 0:it.is_won_stage:!1,onAddToScorecard:xt=>{ne(xt),G(!0),k(!1)}}),r.jsx(JQt,{open:H,onOpenChange:G,deal:Q,onComplete:()=>{o(),ne(null)}})]})}function nJt(){return r.jsx(rJt,{children:r.jsx(sJt,{})})}const tge=[{value:"video_intro",label:"Video Intro",icon:Ta,description:"Add an intro video"},{value:"testimonials",label:"Testimonials",icon:yA,description:"Client testimonials carousel"},{value:"specialties",label:"Specialties",icon:Vg,description:"Tags for your specialties"},{value:"custom_links",label:"Custom Links",icon:ym,description:"Custom CTA buttons"},{value:"social_media",label:"Social Media",icon:Cc,description:"Links to your social profiles"}],aJt=["First-Time Buyers","Luxury Homes","Investment Properties","Relocation","New Construction","Condos & Townhomes","Waterfront","Commercial","Land & Lots","Senior Living","Military/VA","Short Sales & Foreclosures"],iJt={video_intro:{video_url:""},testimonials:{testimonials:[{name:"",quote:"",role:""}]},specialties:{tags:[]},custom_links:{links:[{label:"",url:""}]},social_media:{platforms:[]}};function DVe({cardId:e}){const{data:t,isLoading:s}=Vct(e),n=Hct(),a=Wct(),o=Gct(),[l,i]=A.useState(!1),[u,m]=A.useState(""),[x,y]=A.useState(null);if(s)return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Cr,{className:"h-16 w-full"}),r.jsx(Cr,{className:"h-16 w-full"})]});const v=()=>{u&&n.mutate({card_id:e,block_type:u,sort_order:(t==null?void 0:t.length)||0,config:iJt[u]||{}},{onSuccess:()=>{i(!1),m("")}})},b=T=>{a.mutate({id:T.id,is_visible:!T.is_visible})},N=(T,P)=>{if(!t)return;const R=t.findIndex(q=>q.id===T.id),D=P==="up"?R-1:R+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)})},E=T=>tge.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(vs,{className:"h-4 w-4 mr-1"})," Add Block"]})]}):r.jsxs(r.Fragment,{children:[t.map((T,P)=>{const R=E(T.block_type),D=(R==null?void 0:R.icon)||Vg;return r.jsx(He,{className:T.is_visible?"":"opacity-50",children:r.jsx(Xe,{className:"p-3",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Bg,{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:(R==null?void 0:R.label)||T.block_type}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:oJt(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(hp,{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(ly,{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(mo,{className:"h-3 w-3"}):r.jsx(Ef,{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(Bs,{className:"h-3 w-3"})})]})]})})},T.id)}),r.jsxs(X,{variant:"outline",size:"sm",className:"w-full",onClick:()=>i(!0),children:[r.jsx(vs,{className:"h-4 w-4 mr-1"})," Add Block"]})]}),r.jsx(Or,{open:l,onOpenChange:i,children:r.jsxs(Pr,{children:[r.jsx(zr,{children:r.jsx(Rr,{children:"Add Block"})}),r.jsx("div",{className:"grid gap-3",children:tge.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(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(X,{onClick:v,disabled:!u||n.isPending,children:"Add Block"})]})]})}),x&&r.jsx(lJt,{block:x,onSave:T=>M(x,T),onClose:()=>y(null)})]})}function oJt(e){var s;const t=e.config;switch(e.block_type){case"video_intro":return t.video_url?"Video configured":"No video set";case"testimonials":{const n=((s=t.testimonials)==null?void 0:s.length)||0;return`${n} testimonial${n!==1?"s":""}`}case"specialties":{const n=t.tags||[];return n.length?n.slice(0,3).join(", ")+(n.length>3?"...":""):"No tags"}case"custom_links":{const n=t.links||[];return`${n.length} link${n.length!==1?"s":""}`}case"social_media":{const n=t.platforms||[];return n.length?n.map(a=>a.platform).join(", "):"No platforms"}default:return""}}function lJt({block:e,onSave:t,onClose:s}){const[n,a]=A.useState(e.config),o=tge.find(l=>l.value===e.block_type);return r.jsx(Or,{open:!0,onOpenChange:s,children:r.jsxs(Pr,{className:"max-w-lg max-h-[80vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsxs(Rr,{children:["Edit ",o==null?void 0:o.label]})}),e.block_type==="video_intro"&&r.jsx(cJt,{config:n,onChange:a,cardId:e.card_id}),e.block_type==="testimonials"&&r.jsx(dJt,{config:n,onChange:a}),e.block_type==="specialties"&&r.jsx(uJt,{config:n,onChange:a}),e.block_type==="custom_links"&&r.jsx(hJt,{config:n,onChange:a}),e.block_type==="social_media"&&r.jsx(mJt,{config:n,onChange:a}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:s,children:"Cancel"}),r.jsx(X,{onClick:()=>t(n),children:"Save"})]})]})})}function cJt({config:e,onChange:t,cardId:s}){var b,N;const[n,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}=Kt({queryKey:["card-owner",s],queryFn:async()=>{const{data:k}=await Y.from("agent_cards").select("user_id").eq("id",s).single();return k==null?void 0:k.user_id},enabled:!!s}),{data:u,isLoading:m}=Kt({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=>!n||(k.title||"").toLowerCase().includes(n.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(Si,{value:o,onValueChange:l,children:[r.jsxs(ki,{className:"w-full",children:[r.jsx(is,{value:"library",className:"flex-1",children:"Video Library"}),r.jsx(is,{value:"youtube",className:"flex-1",children:"YouTube URL"})]}),r.jsxs(Ss,{value:"library",className:"space-y-3 mt-3",children:[r.jsxs("div",{className:"relative",children:[r.jsx(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search videos...",value:n,onChange:k=>a(k.target.value),className:"pl-9"})]}),r.jsx(Yo,{className:"h-[240px]",children:m?r.jsxs("div",{className:"space-y-2",children:[r.jsx(Cr,{className:"h-14 w-full"}),r.jsx(Cr,{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 E;M.currentTarget.style.display="none",(E=M.currentTarget.nextElementSibling)==null||E.classList.remove("hidden")}}):null,r.jsx("div",{className:`h-10 w-16 rounded bg-muted flex items-center justify-center flex-shrink-0 ${k.thumbnail_url?"hidden":""}`,children:r.jsx(Ta,{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(Ss,{value:"youtube",className:"space-y-3 mt-3",children:r.jsxs("div",{children:[r.jsx(ze,{children:"YouTube URL"}),r.jsx(ot,{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 dJt({config:e,onChange:t}){const s=e.testimonials||[],n=(l,i,u)=>{const m=[...s];m[l]={...m[l],[i]:u},t({...e,testimonials:m})},a=()=>t({...e,testimonials:[...s,{name:"",quote:"",role:""}]}),o=l=>t({...e,testimonials:s.filter((i,u)=>u!==l)});return r.jsxs("div",{className:"space-y-4",children:[s.map((l,i)=>r.jsx(He,{children:r.jsxs(Xe,{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]}),s.length>1&&r.jsx(X,{variant:"ghost",size:"icon",className:"h-6 w-6 text-destructive",onClick:()=>o(i),children:r.jsx(Bs,{className:"h-3 w-3"})})]}),r.jsx(ot,{placeholder:"Client name",value:l.name,onChange:u=>n(i,"name",u.target.value)}),r.jsx(ot,{placeholder:"Role/title (optional)",value:l.role||"",onChange:u=>n(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=>n(i,"quote",u.target.value)})]})},i)),r.jsxs(X,{variant:"outline",size:"sm",onClick:a,className:"w-full",children:[r.jsx(vs,{className:"h-4 w-4 mr-1"})," Add Testimonial"]})]})}function uJt({config:e,onChange:t}){const s=e.tags||[],[n,a]=A.useState(""),o=i=>{t({...e,tags:s.includes(i)?s.filter(u=>u!==i):[...s,i]})},l=()=>{n.trim()&&!s.includes(n.trim())&&(t({...e,tags:[...s,n.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:aJt.map(i=>r.jsx("button",{onClick:()=>o(i),className:`px-3 py-1.5 text-xs rounded-full border transition-colors ${s.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(ot,{placeholder:"Add your own...",value:n,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"})]})]}),s.length>0&&r.jsxs("div",{children:[r.jsxs(ze,{className:"text-xs text-muted-foreground mb-1 block",children:["Selected (",s.length,")"]}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.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 hJt({config:e,onChange:t}){const s=e.links||[],n=(l,i,u)=>{const m=[...s];m[l]={...m[l],[i]:u},t({...e,links:m})},a=()=>t({...e,links:[...s,{label:"",url:""}]}),o=l=>t({...e,links:s.filter((i,u)=>u!==l)});return r.jsxs("div",{className:"space-y-3",children:[s.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(ot,{placeholder:"Button label",value:l.label,onChange:u=>n(i,"label",u.target.value)}),r.jsx(ot,{placeholder:"https://...",value:l.url,onChange:u=>n(i,"url",u.target.value)})]}),s.length>1&&r.jsx(X,{variant:"ghost",size:"icon",className:"h-8 w-8 mt-1 text-destructive",onClick:()=>o(i),children:r.jsx(Bs,{className:"h-3 w-3"})})]},i)),r.jsxs(X,{variant:"outline",size:"sm",onClick:a,className:"w-full",children:[r.jsx(vs,{className:"h-4 w-4 mr-1"})," Add Link"]})]})}const NTe=[{value:"instagram",label:"Instagram"},{value:"facebook",label:"Facebook"},{value:"linkedin",label:"LinkedIn"},{value:"twitter",label:"X (Twitter)"},{value:"youtube",label:"YouTube"},{value:"tiktok",label:"TikTok"},{value:"zillow",label:"Zillow"},{value:"realtor",label:"Realtor.com"},{value:"spotify",label:"Spotify"},{value:"apple_music",label:"Apple Music"}];function mJt({config:e,onChange:t}){const s=e.platforms||[],n=u=>{s.find(m=>m.platform===u)||t({...e,platforms:[...s,{platform:u,url:""}]})},a=(u,m)=>{const x=[...s];x[u]={...x[u],url:m},t({...e,platforms:x})},o=u=>{t({...e,platforms:s.filter((m,x)=>x!==u)})},l=NTe.filter(u=>!s.find(m=>m.platform===u.value)),i=u=>{const m=fme[u],x=NTe.find(y=>y.value===u);return{label:(x==null?void 0:x.label)||u,color:(m==null?void 0:m.color)||"#666",iconPath:m==null?void 0:m.icon}};return r.jsxs("div",{className:"space-y-4",children:[s.length>0&&r.jsx("div",{className:"space-y-3",children:s.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(ot,{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(Bs,{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=fme[u.value];return r.jsxs("button",{onClick:()=>n(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)})})]}),s.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 pJt=Object.defineProperty,ene=Object.getOwnPropertySymbols,RVe=Object.prototype.hasOwnProperty,FVe=Object.prototype.propertyIsEnumerable,STe=(e,t,s)=>t in e?pJt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,rge=(e,t)=>{for(var s in t||(t={}))RVe.call(t,s)&&STe(e,s,t[s]);if(ene)for(var s of ene(t))FVe.call(t,s)&&STe(e,s,t[s]);return e},sge=(e,t)=>{var s={};for(var n in e)RVe.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(e!=null&&ene)for(var n of ene(e))t.indexOf(n)<0&&FVe.call(e,n)&&(s[n]=e[n]);return s};/** * @license QR Code generator library (TypeScript) * Copyright (c) Project Nayuki. * SPDX-License-Identifier: MIT */var Mk;(e=>{const t=class zi{constructor(u,m,x,y){if(this.version=u,this.errorCorrectionLevel=m,this.modules=[],this.isFunction=[],uzi.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=zi.getNumDataCodewords(N,m)*8,R=l.getTotalBits(u,N);if(R<=P){k=R;break}if(N>=y)throw new RangeError("Data too long")}for(const P of[zi.Ecc.MEDIUM,zi.Ecc.QUARTILE,zi.Ecc.HIGH])b&&k<=zi.getNumDataCodewords(N,P)*8&&(m=P);let M=[];for(const P of u){s(P.mode.modeBits,4,M),s(P.numChars,P.mode.numCharCountBits(N),M);for(const R of P.getData())M.push(R)}a(M.length==k);const E=zi.getNumDataCodewords(N,m)*8;a(M.length<=E),s(0,Math.min(4,E-M.length),M),s(0,(8-M.length%8)%8,M),a(M.length%8==0);for(let P=236;M.lengthT[R>>>3]|=P<<7-(R&7)),new zi(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,n(y,v));this.setFunctionModule(8,7,n(y,6)),this.setFunctionModule(8,8,n(y,7)),this.setFunctionModule(7,8,n(y,8));for(let v=9;v<15;v++)this.setFunctionModule(14-v,8,n(y,v));for(let v=0;v<8;v++)this.setFunctionModule(this.size-1-v,8,n(y,v));for(let v=8;v<15;v++)this.setFunctionModule(8,this.size-15+v,n(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=n(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(R[P])});return a(T.length==b),T}drawCodewords(u){if(u.length!=Math.floor(zi.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)*zi.PENALTY_N3),b=this.modules[v][M],N=1);u+=this.finderPenaltyTerminateAndCount(b,N,k)*zi.PENALTY_N3}for(let v=0;v5&&u++):(this.finderPenaltyAddHistory(N,k),b||(u+=this.finderPenaltyCountPatterns(k)*zi.PENALTY_N3),b=this.modules[M][v],N=1);u+=this.finderPenaltyTerminateAndCount(b,N,k)*zi.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*zi.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.lengthzi.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(zi.getNumRawDataModules(u)/8)-zi.ECC_CODEWORDS_PER_BLOCK[m.ordinal][u]*zi.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]^=zi.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 s(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 n(i,u){return(i>>>u&1)!=0}function a(i){if(!i)throw new Error("Assertion error")}const o=class Yl{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)s(x,8,m);return new Yl(Yl.Mode.BYTE,u.length,m)}static makeNumeric(u){if(!Yl.isNumeric(u))throw new RangeError("String contains non-numeric characters");let m=[];for(let x=0;x=1<{(t=>{const s=class{constructor(a,o){this.ordinal=a,this.formatBits=o}};s.LOW=new s(0,1),s.MEDIUM=new s(1,0),s.QUARTILE=new s(2,3),s.HIGH=new s(3,2),t.Ecc=s})(e.QrCode||(e.QrCode={}))})(Mk||(Mk={}));(e=>{(t=>{const s=class{constructor(a,o){this.modeBits=a,this.numBitsCharCount=o}numCharCountBits(a){return this.numBitsCharCount[Math.floor((a+7)/17)]}};s.NUMERIC=new s(1,[10,12,14]),s.ALPHANUMERIC=new s(2,[9,11,13]),s.BYTE=new s(4,[8,16,16]),s.KANJI=new s(8,[8,10,12]),s.ECI=new s(7,[0,0,0]),t.Mode=s})(e.QrSegment||(e.QrSegment={}))})(Mk||(Mk={}));var fS=Mk;/** * @license qrcode.react * Copyright (c) Paul O'Shannessy * SPDX-License-Identifier: ISC */var fJt={L:fS.QrCode.Ecc.LOW,M:fS.QrCode.Ecc.MEDIUM,Q:fS.QrCode.Ecc.QUARTILE,H:fS.QrCode.Ecc.HIGH},zVe=128,BVe="L",$Ve="#FFFFFF",UVe="#000000",qVe=!1,VVe=1,gJt=4,xJt=0,yJt=.1;function HVe(e,t=0){const s=[];return e.forEach(function(n,a){let o=null;n.forEach(function(l,i){if(!l&&o!==null){s.push(`M${o+t} ${a+t}h${i-o}v1H${o+t}z`),o=null;return}if(i===n.length-1){if(!l)return;o===null?s.push(`M${i+t},${a+t} h1v1H${i+t}z`):s.push(`M${o+t},${a+t} h${i+1-o}v1H${o+t}z`);return}l&&o===null&&(o=i)})}),s.join("")}function WVe(e,t){return e.slice().map((s,n)=>n=t.y+t.h?s:s.map((a,o)=>o=t.x+t.w?a:!1))}function vJt(e,t,s,n){if(n==null)return null;const a=e.length+s*2,o=Math.floor(t*yJt),l=a/t,i=(n.width||o)*l,u=(n.height||o)*l,m=n.x==null?e.length/2-i/2:n.x*l,x=n.y==null?e.length/2-u/2:n.y*l,y=n.opacity==null?1:n.opacity;let v=null;if(n.excavate){let N=Math.floor(m),k=Math.floor(x),M=Math.ceil(i+m-N),E=Math.ceil(u+x-k);v={x:N,y:k,w:M,h:E}}const b=n.crossOrigin;return{x:m,y:x,h:u,w:i,excavation:v,opacity:y,crossOrigin:b}}function _Jt(e,t){return t!=null?Math.max(Math.floor(t),0):e?gJt:xJt}function GVe({value:e,level:t,minVersion:s,includeMargin:n,marginSize:a,imageSettings:o,size:l,boostLevel:i}){let u=ut.useMemo(()=>{const N=(Array.isArray(e)?e:[e]).reduce((k,M)=>(k.push(...fS.QrSegment.makeSegments(M)),k),[]);return fS.QrCode.encodeSegments(N,fJt[t],s,void 0,void 0,i)},[e,t,s,i]);const{cells:m,margin:x,numCells:y,calculatedImageSettings:v}=ut.useMemo(()=>{let b=u.getModules();const N=_Jt(n,a),k=b.length+N*2,M=vJt(b,l,N,o);return{cells:b,margin:N,numCells:k,calculatedImageSettings:M}},[u,l,o,n,a]);return{qrcode:u,margin:x,cells:m,numCells:y,calculatedImageSettings:v}}var bJt=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),wJt=ut.forwardRef(function(t,s){const n=t,{value:a,size:o=zVe,level:l=BVe,bgColor:i=$Ve,fgColor:u=UVe,includeMargin:m=qVe,minVersion:x=VVe,boostLevel:y,marginSize:v,imageSettings:b}=n,k=sge(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:M}=k,E=sge(k,["style"]),T=b==null?void 0:b.src,P=ut.useRef(null),R=ut.useRef(null),D=ut.useCallback(se=>{P.current=se,typeof s=="function"?s(se):s&&(s.current=se)},[s]),[U,q]=ut.useState(!1),{margin:H,cells:G,numCells:Q,calculatedImageSettings:ne}=GVe({value:a,level:l,minVersion:x,boostLevel:y,includeMargin:m,marginSize:v,imageSettings:b,size:o});ut.useEffect(()=>{if(P.current!=null){const se=P.current,fe=se.getContext("2d");if(!fe)return;let oe=G;const ce=R.current,de=ne!=null&&ce!==null&&ce.complete&&ce.naturalHeight!==0&&ce.naturalWidth!==0;de&&ne.excavation!=null&&(oe=WVe(G,ne.excavation));const xe=window.devicePixelRatio||1;se.height=se.width=o*xe;const Me=o/Q*xe;fe.scale(Me,Me),fe.fillStyle=i,fe.fillRect(0,0,Q,Q),fe.fillStyle=u,bJt?fe.fill(new Path2D(HVe(oe,H))):G.forEach(function(ve,be){ve.forEach(function(we,tt){we&&fe.fillRect(tt+H,be+H,1,1)})}),ne&&(fe.globalAlpha=ne.opacity),de&&fe.drawImage(ce,ne.x+H,ne.y+H,ne.w,ne.h)}}),ut.useEffect(()=>{q(!1)},[T]);const ie=rge({height:o,width:o},M);let he=null;return T!=null&&(he=ut.createElement("img",{src:T,key:T,style:{display:"none"},onLoad:()=>{q(!0)},ref:R,crossOrigin:ne==null?void 0:ne.crossOrigin})),ut.createElement(ut.Fragment,null,ut.createElement("canvas",rge({style:ie,height:o,width:o,ref:D,role:"img"},E)),he)});wJt.displayName="QRCodeCanvas";var cve=ut.forwardRef(function(t,s){const n=t,{value:a,size:o=zVe,level:l=BVe,bgColor:i=$Ve,fgColor:u=UVe,includeMargin:m=qVe,minVersion:x=VVe,boostLevel:y,title:v,marginSize:b,imageSettings:N}=n,k=sge(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:M,cells:E,numCells:T,calculatedImageSettings:P}=GVe({value:a,level:l,minVersion:x,boostLevel:y,includeMargin:m,marginSize:b,imageSettings:N,size:o});let R=E,D=null;N!=null&&P!=null&&(P.excavation!=null&&(R=WVe(E,P.excavation)),D=ut.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=HVe(R,M);return ut.createElement("svg",rge({height:o,width:o,viewBox:`0 0 ${T} ${T}`,ref:s,role:"img"},k),!!v&&ut.createElement("title",null,v),ut.createElement("path",{fill:i,d:`M0,0 h${T}v${T}H0z`,shapeRendering:"crispEdges"}),ut.createElement("path",{fill:u,d:U,shapeRendering:"crispEdges"}),D)});cve.displayName="QRCodeSVG";function jJt({slug:e,agentName:t}){const s=A.useRef(null),n=`https://cards.relevelup.com/${e}`,a=A.useCallback(()=>{var y;const o=(y=s.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(),Te.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:s,className:"bg-white p-3 rounded-lg border shadow-sm shrink-0",children:r.jsx(cve,{value:n,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($i,{className:"h-3.5 w-3.5"}),"Download PNG"]})]})]})]})}function vue(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 kJt(){const{user:e}=Yr(),{data:t,isLoading:s}=$ct(e==null?void 0:e.id),n=H3(),[a,o]=A.useState(null),l=A.useMemo(()=>a||(t?vue(t):null),[a,t]);if(s)return r.jsx(Dr,{children:r.jsxs("div",{className:"max-w-2xl mx-auto p-4 space-y-4",children:[r.jsx(Cr,{className:"h-8 w-48"}),r.jsx(Cr,{className:"h-32 w-full"}),r.jsx(Cr,{className:"h-32 w-full"})]})});if(!t)return r.jsx(Dr,{children:r.jsx(SJt,{userId:e==null?void 0:e.id})});const i=l||vue(t),u=m=>{o(x=>{const y=x||vue(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:`${n?"w-full":"flex-1 min-w-0"} max-w-2xl mx-auto p-4 space-y-6 animate-fade-in`,children:[r.jsx(CJt,{card:t}),r.jsx(EJt,{card:t,form:i,setForm:u})]}),!n&&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(Uj,{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(NJt,{card:t,form:i})})]})})]})})}function NJt({card:e,form:t}){const{data:s}=Kt({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}}}),n=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:(s==null?void 0:s.name)||null,email:(s==null?void 0:s.email)||null,phone:(s==null?void 0:s.phone)||null,brokerage_id:(s==null?void 0:s.brokerage_id)||null},brokerage_name:t.brokerage_display_name||null,avatar_url:(s==null?void 0:s.avatar_url)||null}),[e,t,s]);return r.jsx("div",{className:"transform scale-[0.85] origin-top",children:r.jsx(sye,{card:n})})}function SJt({userId:e}){var u;const[t,s]=A.useState(""),n=E8e(),{data:a}=Kt({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){Te.error("Please enter a URL slug for your card");return}n.mutate({user_id:e,slug:m,is_published:!0},{onSuccess:()=>Te.success("Your digital card has been created!")})},i=[{icon:uy,title:"Shareable Link",desc:"One link that works everywhere"},{icon:Hg,title:"Lead Capture",desc:"Collect leads automatically"},{icon:bm,title:"Always Up-to-Date",desc:"Edit anytime, changes are instant"},{icon:Wc,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(Bn,{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(Vt,{className:"text-center pb-2",children:[r.jsx(Gt,{className:"text-xl",children:"Set Up Your Card"}),r.jsx(Ns,{children:"Choose a URL slug — this is the link you'll share with clients"})]}),r.jsxs(Xe,{className:"p-6 pt-2 space-y-5",children:[r.jsxs("div",{children:[r.jsx(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(ot,{value:t||o,onChange:m=>s(m.target.value),placeholder:"your-name",className:"rounded-l-none"})]})]}),r.jsxs(X,{onClick:l,disabled:n.isPending,className:"w-full h-11 text-base font-semibold",size:"lg",children:[r.jsx(Bn,{className:"h-4 w-4 mr-2"}),n.isPending?"Creating...":"Create My Card"]})]})]})]})}function CJt({card:e}){const s=`https://cards.relevelup.com/${e.slug}`,n=()=>{navigator.clipboard.writeText(s),Te.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:n,className:"gap-1.5",children:[r.jsx(Mo,{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:s,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Sn,{className:"h-3.5 w-3.5"})," Preview"]})})]})]})})}function MJt({userId:e}){const t=Br(),s=A.useRef(null),[n,a]=A.useState(!1),[o,l]=A.useState(""),{data:i,isLoading:u}=Kt({queryKey:["card-editor-profile",e],queryFn:async()=>{const{data:ne}=await Y.from("profiles").select("name, email, phone, avatar_url").eq("id",e).single();let ie=(ne==null?void 0:ne.avatar_url)||null;if(!ie){const{data:he}=await Y.storage.from("avatars").list(`${e}`);if(he&&he.length>0){const{data:se}=Y.storage.from("avatars").getPublicUrl(`${e}/${he[0].name}`);ie=`${se.publicUrl}?t=${Date.now()}`,await Y.from("profiles").update({avatar_url:ie}).eq("id",e)}}return{...ne,avatar_url:ie}}}),[m,x]=A.useState(null),[y,v]=A.useState(null),[b,N]=A.useState(null),[k,M]=A.useState(!1),E=m??(i==null?void 0:i.name)??"",T=y??(i==null?void 0:i.phone)??"",P=b??(i==null?void 0:i.email)??"",R=i==null?void 0:i.avatar_url,D=((i==null?void 0:i.name)||"A").split(" ").map(ne=>ne[0]).join("").toUpperCase().slice(0,2),U=!(i!=null&&i.avatar_url)||!(i!=null&&i.phone),q=ar({mutationFn:async ne=>{const{error:ie}=await Y.from("profiles").update(ne).eq("id",e);if(ie)throw ie},onSuccess:()=>{t.invalidateQueries({queryKey:["card-editor-profile",e]}),t.invalidateQueries({queryKey:["card-preview-profile",e]}),t.invalidateQueries({queryKey:["agent-card-user"]}),Te.success("Profile updated!")},onError:()=>Te.error("Failed to update profile")}),H=()=>{const ne={};if(m!==null&&m!==(i==null?void 0:i.name)&&(ne.name=m),y!==null&&y!==(i==null?void 0:i.phone)&&(ne.phone=y||null),b!==null&&b!==(i==null?void 0:i.email)&&(ne.email=b),Object.keys(ne).length===0){Te.info("No changes to save");return}q.mutate(ne)},G=ne=>{var se;const ie=(se=ne.target.files)==null?void 0:se[0];if(!ie)return;if(!ie.type.startsWith("image/")){Te.error("Please select an image file");return}const he=new FileReader;he.onloadend=()=>{l(he.result),a(!0)},he.readAsDataURL(ie),ne.target.value=""},Q=async ne=>{M(!0);try{const{data:ie}=await Y.storage.from("avatars").list(`${e}`);ie&&ie.length>0&&await Y.storage.from("avatars").remove(ie.map(ce=>`${e}/${ce.name}`));const he=`${e}/avatar.jpg`,{error:se}=await Y.storage.from("avatars").upload(he,ne,{upsert:!0,contentType:"image/jpeg"});if(se)throw se;const{data:fe}=Y.storage.from("avatars").getPublicUrl(he),oe=fe.publicUrl+"?t="+Date.now();await Y.from("profiles").update({avatar_url:oe}).eq("id",e),t.invalidateQueries({queryKey:["card-editor-profile",e]}),t.invalidateQueries({queryKey:["card-preview-profile",e]}),t.invalidateQueries({queryKey:["agent-card-user"]}),Te.success("Photo updated!")}catch{Te.error("Failed to upload photo")}finally{M(!1)}};return u?r.jsx(Cr,{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(Xe,{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(vl,{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 ne;return(ne=s.current)==null?void 0:ne.click()},children:[r.jsxs(Xn,{className:"h-16 w-16 ring-2 ring-muted",children:[r.jsx(ji,{src:R||void 0,alt:E}),r.jsx(Qn,{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(Fg,{className:"h-5 w-5 text-white"})}),r.jsx("input",{ref:s,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...":R?"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(ot,{value:E,onChange:ne=>x(ne.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(ot,{value:T,onChange:ne=>v(ne.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(ot,{value:P,onChange:ne=>N(ne.target.value),placeholder:"you@example.com",className:"h-10",type:"email"})]})]})]}),r.jsx(X,{variant:"outline",size:"sm",onClick:H,disabled:q.isPending,className:"w-full",children:q.isPending?"Saving...":"Update Profile Info"})]})}),r.jsx(A0e,{open:n,onClose:()=>a(!1),imageSrc:o,onCropComplete:Q,aspectRatio:1})]})}function TJt({form:e,setForm:t,userId:s}){const[n,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/")){Te.error("Please select an image file");return}a(N);try{const E=k.name.split(".").pop()||"png",P=`${s}/${N==="brokerage_logo_url"?"brokerage-logo":"team-logo"}.${E}`,{error:R}=await Y.storage.from("card-logos").upload(P,k,{upsert:!0});if(R)throw R;const{data:D}=Y.storage.from("card-logos").getPublicUrl(P),U=D.publicUrl+"?t="+Date.now();t(N==="brokerage_logo_url"?q=>({...q,[N]:U,brokerage_display_name:""}):q=>({...q,[N]:U,team_name:""})),Te.success("Logo uploaded!")}catch{Te.error("Failed to upload logo")}finally{a(null),b.target.value=""}}},v=b=>{t(N=>({...N,[b]:""}))};return r.jsx(He,{children:r.jsxs(Xe,{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(ot,{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(Fg,{className:"h-3.5 w-3.5"}),n==="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:n!==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(Sf,{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(ot,{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(Fg,{className:"h-3.5 w-3.5"}),n==="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:n!==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(Sf,{value:[e.team_logo_size||56],onValueChange:([b])=>t(N=>({...N,team_logo_size:b})),min:24,max:120,step:4})]})]})]})]})})}function AJt({form:e,setForm:t}){const s={accent:"#ff5722",dark:"#1a1a2e",button:"#ff5722"},n=e.bold_theme_colors||s,a=(i,u)=>{t(m=>({...m,bold_theme_colors:{...s,...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(Wc,{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:n[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:n[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(ot,{value:n[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:n.accent}}),r.jsx("div",{className:"h-6 w-12 rounded",style:{backgroundColor:n.dark}}),r.jsx("div",{className:"h-6 w-12 rounded",style:{backgroundColor:n.button}})]})]})]})}function EJt({card:e,form:t,setForm:s}){var v;const n=I8e(),a=Br(),{data:o}=P8e(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){Te.error("Please enter a valid URL");return}if(b===e.slug){Te.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){Te.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"]}),Te.success("Card address updated!")}catch{Te.error("Failed to update card address")}finally{m(!1)}},y=()=>{n.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:()=>Te.success("Card saved!")})};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs(Si,{defaultValue:"content",children:[r.jsxs(ki,{className:"w-full h-11 p-1",children:[r.jsxs(is,{value:"content",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(mp,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Content"]}),r.jsxs(is,{value:"sections",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(mo,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Sections"]}),r.jsxs(is,{value:"blocks",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(Hg,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Blocks"]}),r.jsxs(is,{value:"qrcode",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(Hj,{className:"h-3.5 w-3.5 hidden sm:inline"}),"QR Code"]}),r.jsxs(is,{value:"analytics",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(X1,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Analytics"]})]}),r.jsxs(Ss,{value:"content",className:"mt-4 space-y-4",children:[r.jsx(MJt,{userId:e.user_id}),r.jsx(TJt,{form:t,setForm:s,userId:e.user_id}),r.jsx(He,{children:r.jsxs(Xe,{className:"p-5 space-y-5",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/50",children:[r.jsxs("div",{children:[r.jsx(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(In,{checked:t.is_published,onCheckedChange:b=>s(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(ot,{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(us,{value:t.theme,onValueChange:b=>s(N=>({...N,theme:b})),children:[r.jsx(cs,{className:"h-11",children:r.jsx(ms,{})}),r.jsxs(ds,{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(AJt,{form:t,setForm:s}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{className:"text-sm font-medium",children:"Title / Tagline"}),r.jsx(ot,{value:t.title,onChange:b=>s(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(ot,{value:t.positioning_statement,onChange:b=>s(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(Ys,{value:t.bio,onChange:b=>s(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(ot,{value:t.review_snippet,onChange:b=>s(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(ot,{value:t.review_source_url,onChange:b=>s(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(ot,{value:t.booking_url,onChange:b=>s(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(ot,{value:t.custom_cta_label,onChange:b=>s(N=>({...N,custom_cta_label:b.target.value})),placeholder:"Book a Call",className:"h-11"})]})]})})]}),r.jsx(Ss,{value:"sections",className:"mt-4",children:r.jsx(He,{children:r.jsx(Xe,{className:"p-5 divide-y",children:[{key:"show_photo",label:"Photo",desc:"Uses the photo from your Profile Info above"},{key:"show_bio",label:"Bio Section",desc:"Display your bio on the card"},{key:"show_credentials",label:"Credentials",desc:"Show star rating and reviews"},{key:"show_social_links",label:"Social Links",desc:"Display your social media links"},{key:"show_save_contact",label:"Save Contact",desc:"Let visitors save you as a contact"},{key:"show_leave_review",label:"Leave Review",desc:"Link to your review page"},{key:"show_refer_friend",label:"Refer a Friend",desc:"Enable referral submissions"}].map(({key: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(In,{checked:t[b],onCheckedChange:M=>s(E=>({...E,[b]:M}))})]},b))})})}),r.jsx(Ss,{value:"blocks",className:"mt-4",children:r.jsx(DVe,{cardId:e.id})}),r.jsx(Ss,{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:mo,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:X1,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:wu,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(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:`p-1.5 rounded-md ${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(Vt,{className:"pb-3",children:r.jsx(Gt,{className:"text-base",children:"Recent Leads"})}),r.jsx(Xe,{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(Xe,{className:"p-8 text-center",children:[r.jsx(X1,{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(Ss,{value:"qrcode",className:"mt-4 space-y-4",children:r.jsx(He,{children:r.jsx(Xe,{className:"p-6",children:r.jsx(jJt,{slug:e.slug})})})})]}),r.jsx(X,{onClick:y,disabled:n.isPending,className:"w-full h-11 text-base font-semibold",size:"lg",children:n.isPending?"Saving...":"Save Changes"})]})}function IJt(){const{isAdmin:e}=Yr(),t=Br(),[s,n]=A.useState(!1),[a,o]=A.useState(!1),[l,i]=A.useState(!1),{data:u,isLoading:m}=Kt({queryKey:["gmail-integration"],queryFn:async()=>{const{data:R,error:D}=await Y.from("gmail_integrations").select("*").maybeSingle();if(D)throw D;return R}}),{data:x}=Kt({queryKey:["social-accounts"],queryFn:async()=>{const{data:{user:R}}=await Y.auth.getUser();if(!R)return[];const{data:D,error:U}=await Y.from("social_accounts").select("*").eq("user_id",R.id).order("created_at",{ascending:!1});if(U)throw U;return D}}),y=async()=>{n(!0);try{const{data:R,error:D}=await Y.functions.invoke("gmail-oauth",{body:{action:"get_auth_url"}});if(D)throw D;if(R!=null&&R.authUrl)window.location.href=R.authUrl;else throw new Error("Failed to get authorization URL")}catch(R){console.error("Gmail OAuth error:",R),Te.error("Failed to start Gmail connection"),n(!1)}},v=async()=>{o(!0);try{const{data:R,error:D}=await Y.functions.invoke("meta-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/callback"}});if(D)throw D;if(R!=null&&R.authUrl)window.location.href=R.authUrl;else throw new Error("Failed to get authorization URL")}catch(R){console.error("Meta OAuth error:",R),Te.error("Failed to start connection. Make sure Meta App credentials are configured."),o(!1)}},b=async()=>{i(!0);try{const{data:R,error:D}=await Y.functions.invoke("linkedin-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/linkedin-callback"}});if(D)throw D;if(R!=null&&R.authUrl)window.location.href=R.authUrl;else throw new Error("Failed to get LinkedIn authorization URL")}catch(R){console.error("LinkedIn OAuth error:",R),Te.error("Failed to start LinkedIn connection. Please try again."),i(!1)}},N=ar({mutationFn:async R=>{const{error:D}=await Y.from("gmail_integrations").delete().eq("id",R);if(D)throw D},onSuccess:()=>{t.invalidateQueries({queryKey:["gmail-integration"]}),Te.success("Gmail disconnected")},onError:()=>{Te.error("Failed to disconnect Gmail")}}),k=ar({mutationFn:async R=>{const{error:D}=await Y.from("social_accounts").delete().eq("id",R);if(D)throw D},onSuccess:()=>{t.invalidateQueries({queryKey:["social-accounts"]}),Te.success("Account disconnected")},onError:()=>{Te.error("Failed to disconnect account")}}),M=!!(u!=null&&u.is_active),E=(x==null?void 0:x.filter(R=>R.platform==="facebook"))||[],T=(x==null?void 0:x.filter(R=>R.platform==="instagram"))||[],P=(x==null?void 0:x.filter(R=>R.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(Vt,{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(Nn,{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(Ns,{children:"Send emails directly from your contact pages and auto-log them as touchpoints."})]})]})}),r.jsx(Xe,{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(ii,{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(ii,{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(ii,{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(Dd,{children:[r.jsx(Nf,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bs,{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(Vc,{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:s||m,children:[s?r.jsx(Go,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(Nn,{className:"h-4 w-4 mr-2"}),"Connect Gmail",r.jsx(to,{className:"h-4 w-4 ml-2"})]})]})})]}),r.jsxs(He,{className:e?"":"opacity-70",children:[r.jsx(Vt,{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?E.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(nh,{className:"h-3 w-3"}),"Coming Soon"]})]}),r.jsx(Ns,{children:"Connect Facebook Pages to post content and reach your audience."})]})]})}),e&&r.jsxs(Xe,{className:"space-y-3",children:[E.length>0&&r.jsx("div",{className:"space-y-2",children:E.map(R=>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(Xn,{className:"h-8 w-8",children:[r.jsx(ji,{src:R.profile_picture_url||""}),r.jsx(Qn,{children:r.jsx(au,{className:"h-4 w-4"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:R.page_name||R.platform_username||"Facebook Page"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected Facebook Page"})]})]}),r.jsxs(Dd,{children:[r.jsx(Nf,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bs,{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(Vc,{onClick:()=>k.mutate(R.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},R.id))}),r.jsxs(X,{onClick:v,disabled:a,variant:"outline",className:"gap-2",children:[a?r.jsx(Go,{className:"h-4 w-4 animate-spin"}):r.jsx(vs,{className:"h-4 w-4"}),"Connect Facebook Page"]})]})]}),r.jsxs(He,{className:e?"":"opacity-70",children:[r.jsx(Vt,{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(nh,{className:"h-3 w-3"}),"Coming Soon"]})]}),r.jsx(Ns,{children:"Connect Instagram Business accounts to schedule and publish posts."})]})]})}),e&&r.jsxs(Xe,{className:"space-y-3",children:[T.length>0&&r.jsx("div",{className:"space-y-2",children:T.map(R=>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(Xn,{className:"h-8 w-8",children:[r.jsx(ji,{src:R.profile_picture_url||""}),r.jsx(Qn,{children:r.jsx(_u,{className:"h-4 w-4"})})]}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium text-sm",children:["@",R.platform_username||"Instagram Account"]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected Instagram account"})]})]}),r.jsxs(Dd,{children:[r.jsx(Nf,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bs,{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(Vc,{onClick:()=>k.mutate(R.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},R.id))}),r.jsxs(X,{onClick:v,disabled:a,variant:"outline",className:"gap-2",children:[a?r.jsx(Go,{className:"h-4 w-4 animate-spin"}):r.jsx(vs,{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(Vt,{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(vm,{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(nh,{className:"h-3 w-3"}),"Coming Soon"]})]}),r.jsx(Ns,{children:"Connect your LinkedIn profile to share content and grow your professional network."})]})]})}),e&&r.jsxs(Xe,{className:"space-y-3",children:[P.length>0&&r.jsx("div",{className:"space-y-2",children:P.map(R=>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(Xn,{className:"h-8 w-8",children:[r.jsx(ji,{src:R.profile_picture_url||""}),r.jsx(Qn,{children:r.jsx(vm,{className:"h-4 w-4"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:R.platform_username||"LinkedIn Account"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected LinkedIn profile"})]})]}),r.jsxs(Dd,{children:[r.jsx(Nf,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bs,{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(Vc,{onClick:()=>k.mutate(R.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},R.id))}),r.jsxs(X,{onClick:b,disabled:l,variant:"outline",className:"gap-2",children:[l?r.jsx(Go,{className:"h-4 w-4 animate-spin"}):r.jsx(vs,{className:"h-4 w-4"}),"Connect LinkedIn"]})]})]})]})})}function PJt(){const[e]=Ic(),t=Hs(),[s,n]=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){n("error"),o(m||"Authorization was denied"),Te.error("Connection failed: "+(m||u));return}if(!i){n("error"),o("No authorization code received"),Te.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)n("success"),o(y.message||"Gmail connected successfully!"),Te.success("Gmail connected!");else throw new Error((y==null?void 0:y.error)||"Unknown error")}catch(y){console.error("Gmail OAuth callback error:",y),n("error"),o(y instanceof Error?y.message:"Failed to connect Gmail"),Te.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(Vt,{className:"text-center",children:[s==="loading"&&r.jsx(Vr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),s==="success"&&r.jsx(ii,{className:"h-12 w-12 mx-auto text-green-500"}),s==="error"&&r.jsx(jc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Gt,{className:"mt-4",children:[s==="loading"&&"Connecting...",s==="success"&&"Connected!",s==="error"&&"Connection Failed"]}),r.jsx(Ns,{children:a})]}),r.jsx(Xe,{className:"flex justify-center",children:s!=="loading"&&r.jsx(X,{onClick:()=>t("/mission-control/integrations"),children:s==="success"?"Back to Integrations":"Try Again"})})]})})}function LJt(){const e=Hs();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 OJt(){const[e]=Ic(),t=Hs(),[s,n]=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){n("error"),o(m||"Authorization was denied"),Te.error("Connection failed: "+(m||u));return}if(!i){n("error"),o("No authorization code received"),Te.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)n("success"),o(`Successfully connected ${((y=v.accounts)==null?void 0:y.length)||0} account(s)!`),Te.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),n("error"),o(v instanceof Error?v.message:"Failed to connect accounts"),Te.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(Vt,{className:"text-center",children:[s==="loading"&&r.jsx(Vr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),s==="success"&&r.jsx(ii,{className:"h-12 w-12 mx-auto text-green-500"}),s==="error"&&r.jsx(jc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Gt,{className:"mt-4",children:[s==="loading"&&"Connecting...",s==="success"&&"Connected!",s==="error"&&"Connection Failed"]}),r.jsx(Ns,{children:a})]}),r.jsx(Xe,{className:"flex justify-center",children:s!=="loading"&&r.jsx(X,{onClick:()=>t("/mission-control/integrations"),children:s==="success"?"View Integrations":"Try Again"})})]})})}const KVe=new Date().getFullYear(),DJt=Array.from({length:5},(e,t)=>KVe-t);function RJt(){const[e,t]=A.useState(KVe),s=Hs(),{data:n,isLoading:a}=Nxt();return a?r.jsx(Dr,{title:"Scorecard Admin",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Cr,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4].map(o=>r.jsx(Cr,{className:"h-24"},o))}),r.jsx(Cr,{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(us,{value:String(e),onValueChange:o=>t(Number(o)),children:[r.jsx(cs,{className:"w-[120px]",children:r.jsx(ms,{})}),r.jsx(ds,{children:DJt.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(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(qs,{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:(n==null?void 0:n.length)||0})]})}),r.jsx(He,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(wc,{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:(n==null?void 0:n.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"with transactions"})]})})]}),r.jsxs(He,{children:[r.jsxs(Vt,{children:[r.jsx(Gt,{children:"Agents with Scorecards"}),r.jsx(Ns,{children:"Click to view individual agent scorecards"})]}),r.jsx(Xe,{children:!n||n.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(wc,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No agents have added transactions yet"})]}):r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{children:[r.jsx(Mt,{children:"Agent"}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(On,{children:n.map(o=>r.jsxs(kr,{children:[r.jsx(gt,{className:"font-medium",children:o.name}),r.jsx(gt,{className:"text-muted-foreground",children:o.email}),r.jsx(gt,{className:"text-right",children:r.jsxs(X,{variant:"ghost",size:"sm",onClick:()=>s(`/admin/scorecard/${o.id}`),children:[r.jsx(mo,{className:"h-4 w-4 mr-2"}),"View Scorecard"]})})]},o.id))})]})})]})]})})}const ZVe=new Date().getFullYear(),FJt=Array.from({length:10},(e,t)=>ZVe-t);function zJt(){var v;const{userId:e}=hc(),t=Hs(),[s,n]=A.useState(ZVe),{data:a,isLoading:o}=Kt({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}=$ye(s,e),{yearStats:u,lifetimeStats:m,showCommission:x}=WRe(s,e),{data:y}=HRe(s,e);return o?r.jsx(Dr,{title:"Agent Scorecard",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Cr,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4].map(b=>r.jsx(Cr,{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(us,{value:String(s),onValueChange:b=>n(Number(b)),children:[r.jsx(cs,{className:"w-[120px]",children:r.jsx(ms,{})}),r.jsx(ds,{children:FJt.map(b=>r.jsx($t,{value:String(b),children:b},b))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-4",children:[r.jsx(He,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(sa,{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(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(qs,{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(Xe,{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(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(bu,{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(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx($l,{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(IBe,{goals:y,stats:u,year:s,showCommission:x}),r.jsxs(Si,{defaultValue:"transactions",className:"space-y-4",children:[r.jsxs(ki,{children:[r.jsx(is,{value:"transactions",children:"Transactions"}),r.jsx(is,{value:"charts",children:"Charts"}),r.jsxs(is,{value:"map",children:[r.jsx(po,{className:"h-4 w-4 mr-1"}),"Map"]})]}),r.jsx(Ss,{value:"transactions",children:r.jsx(EBe,{transactions:l||[],showCommission:x,isLoading:i})}),r.jsx(Ss,{value:"charts",children:r.jsx(wVe,{stats:u,year:s})}),r.jsx(Ss,{value:"map",children:r.jsx(jVe,{transactions:l||[],isLoading:i})})]})]})})}function BJt(){const e=Br(),[t,s]=A.useState(""),[n,a]=A.useState("all");nDe();const{data:o,refetch:l}=Kt({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}=Kt({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}=Kt({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:R}=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:(R==null?void 0:R.length)||0}}}),x=ar({mutationFn:async({id:T,approved:P})=>{const{error:R}=await Y.from("listings").update({is_approved:P}).eq("id",T);if(R)throw R},onSuccess:(T,{approved:P})=>{e.invalidateQueries({queryKey:["admin-listings"]}),e.invalidateQueries({queryKey:["admin-listing-stats"]}),Te.success(P?"Listing approved":"Listing unapproved")}}),y=ar({mutationFn:async({id:T,featured:P})=>{const{error:R}=await Y.from("listings").update({is_featured:P}).eq("id",T);if(R)throw R},onSuccess:(T,{featured:P})=>{e.invalidateQueries({queryKey:["admin-listings"]}),Te.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"]}),Te.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(),Te.success("Feature flag updated")}}),N=o??!1,k=i==null?void 0:i.filter(T=>{var D,U,q,H;const P=((D=T.city)==null?void 0:D.toLowerCase().includes(t.toLowerCase()))||((q=(U=T.agent)==null?void 0:U.name)==null?void 0:q.toLowerCase().includes(t.toLowerCase()))||((H=T.property_address)==null?void 0:H.toLowerCase().includes(t.toLowerCase())),R=n==="all"||n==="pending"&&!T.is_approved||n==="approved"&&T.is_approved;return P&&R}),M=T=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(T),E=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(In,{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(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(pi,{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(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(bu,{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(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(qs,{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(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(mo,{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(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Cc,{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(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by city, address, or agent...",value:t,onChange:T=>s(T.target.value),className:"pl-9"})]}),r.jsx(Si,{value:n,onValueChange:T=>a(T),children:r.jsxs(ki,{children:[r.jsx(is,{value:"all",children:"All"}),r.jsx(is,{value:"pending",children:"Pending"}),r.jsx(is,{value:"approved",children:"Approved"})]})})]})})}),r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsxs(Gt,{children:["Listings (",(k==null?void 0:k.length)||0,")"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:u?r.jsx(kr,{children:r.jsx(gt,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:"Loading..."})}):(k==null?void 0:k.length)===0?r.jsx(kr,{children:r.jsx(gt,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:"No listings found"})}):k==null?void 0:k.map(T=>{var P,R,D,U,q;return r.jsxs(kr,{children:[r.jsx(gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[(R=(P=T.photos)==null?void 0:P[0])!=null&&R.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(pi,{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(gt,{children:r.jsx("p",{className:"text-sm",children:((U=T.agent)==null?void 0:U.name)||"Unknown"})}),r.jsx(gt,{className:"font-medium",children:M(T.price)}),r.jsx(gt,{children:r.jsx(Tt,{variant:"outline",className:E(T.status),children:(q=T.status)==null?void 0:q.replace("_"," ")})}),r.jsx(gt,{className:"text-center",children:r.jsx(In,{checked:T.is_approved??!1,onCheckedChange:H=>x.mutate({id:T.id,approved:H})})}),r.jsx(gt,{className:"text-center",children:r.jsx(In,{checked:T.is_featured??!1,onCheckedChange:H=>y.mutate({id:T.id,featured:H})})}),r.jsx(gt,{children:T.view_count||0}),r.jsx(gt,{children:T.share_count||0}),r.jsx(gt,{className:"text-sm text-muted-foreground",children:rs(new Date(T.created_at),"MMM d, yyyy")}),r.jsx(gt,{children:r.jsxs(uh,{children:[r.jsx(hh,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",children:r.jsx(xf,{className:"h-4 w-4"})})}),r.jsxs(Cu,{align:"end",children:[r.jsxs(Wa,{onClick:()=>window.open(`/mission-control/listings/${T.id}`,"_blank"),children:[r.jsx(mo,{className:"h-4 w-4 mr-2"}),"View Listing"]}),r.jsxs(Wa,{onClick:()=>y.mutate({id:T.id,featured:!T.is_featured}),children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),T.is_featured?"Unfeature":"Feature"]}),r.jsxs(Wa,{className:"text-destructive",onClick:()=>{confirm("Are you sure you want to delete this listing?")&&v.mutate(T.id)},children:[r.jsx(en,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},T.id)})})]})})})]})]})})}const $Jt=()=>{var y,v;const[e,t]=A.useState(""),[s,n]=A.useState(null),{data:a,isLoading:o}=Kt({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,E,T,P;const N=e.toLowerCase();return((M=(k=b.profiles)==null?void 0:k.name)==null?void 0:M.toLowerCase().includes(N))||((T=(E=b.profiles)==null?void 0:E.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(Mn,{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(Eu,{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(Vt,{className:"pb-2",children:[r.jsx(Ns,{children:"Total Reviews"}),r.jsx(Gt,{className:"text-3xl",children:(a==null?void 0:a.length)||0})]})}),r.jsx(He,{children:r.jsxs(Vt,{className:"pb-2",children:[r.jsx(Ns,{children:"Average Rating"}),r.jsxs(Gt,{className:"flex items-center gap-2 text-3xl",children:[i,r.jsx(Mn,{className:"h-6 w-6 fill-yellow-400 text-yellow-400"})]})]})}),r.jsx(He,{children:r.jsxs(Vt,{className:"pb-2",children:[r.jsx(Ns,{children:"5-Star Reviews"}),r.jsx(Gt,{className:"text-3xl",children:(u==null?void 0:u[5])||0})]})}),r.jsx(He,{children:r.jsxs(Vt,{className:"pb-2",children:[r.jsx(Ns,{children:"Posted to Google"}),r.jsxs(Gt,{className:"flex items-center gap-2 text-3xl",children:[m,r.jsx(Sn,{className:"h-5 w-5 text-muted-foreground"})]})]})})]}),r.jsxs("div",{className:"relative max-w-sm",children:[r.jsx(ua,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by name, email, or review...",value:e,onChange:b=>t(b.target.value),className:"pl-9"})]}),r.jsx(He,{children:r.jsx(Xe,{className:"p-0",children:r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:o?r.jsx(kr,{children:r.jsx(gt,{colSpan:5,className:"text-center py-8",children:"Loading reviews..."})}):(l==null?void 0:l.length)===0?r.jsx(kr,{children:r.jsx(gt,{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(kr,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>n(b),children:[r.jsx(gt,{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(gt,{children:x(b.rating)}),r.jsx(gt,{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(gt,{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(gt,{className:"text-sm text-muted-foreground",children:rs(new Date(b.created_at),"MMM d, yyyy")})]},b.id)})})]})})}),r.jsx(Or,{open:!!s,onOpenChange:()=>n(null),children:r.jsxs(Pr,{className:"max-w-lg",children:[r.jsx(zr,{children:r.jsx(Rr,{children:"Review Details"})}),s&&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=s.profiles)==null?void 0:y.name)||"Unknown Member"}),((v=s.profiles)==null?void 0:v.email)&&r.jsxs("a",{href:`mailto:${s.profiles.email}`,className:"flex items-center gap-1 text-sm text-muted-foreground hover:text-primary",children:[r.jsx(Nn,{className:"h-3 w-3"}),s.profiles.email]})]}),r.jsxs("div",{className:"text-right",children:[x(s.rating),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[s.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:s.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(jn,{className:"h-4 w-4"}),rs(new Date(s.created_at),"MMMM d, yyyy 'at' h:mm a")]}),s.posted_to_google?r.jsxs(Tt,{variant:"secondary",className:"bg-green-100 text-green-800",children:[r.jsx(Sn,{className:"h-3 w-3 mr-1"}),"Posted to Google"]}):r.jsx(Tt,{variant:"outline",children:"Not posted to Google"})]})]})]})})]})})},UJt=[{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"}],qJt=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 VJt(){const e=Br(),{user:t}=Yr(),[s,n]=A.useState(!1),[a,o]=A.useState(!1),[l,i]=A.useState(!1),{data:u,isLoading:m}=Kt({queryKey:["weekly-digest-settings"],queryFn:async()=>{const{data:H,error:G}=await Y.from("weekly_digest_settings").select("*").single();if(G)throw G;return H}}),{data:x,isLoading:y}=Kt({queryKey:["weekly-digest-logs"],queryFn:async()=>{const{data:H,error:G}=await Y.from("weekly_digest_logs").select("*").order("sent_at",{ascending:!1}).limit(100);if(G)throw G;return H}}),{data:v}=Kt({queryKey:["digest-subscriber-count"],queryFn:async()=>{const{count:H,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 H||0}}),{data:b,refetch:N}=Kt({queryKey:["digest-queue-status"],queryFn:async()=>{const H=new Date;H.setUTCHours(0,0,0,0);const[G,Q,ne,ie]=await Promise.all([Y.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","pending").gte("created_at",H.toISOString()),Y.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","processing").gte("created_at",H.toISOString()),Y.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","sent").gte("created_at",H.toISOString()),Y.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","failed").gte("created_at",H.toISOString())]);return{pending:G.count||0,processing:Q.count||0,sent:ne.count||0,failed:ie.count||0,total:(G.count||0)+(Q.count||0)+(ne.count||0)+(ie.count||0)}},refetchInterval:5e3});A.useEffect(()=>{if(b&&(b.pending>0||b.processing>0)){const H=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(H)}},[b,N,e]);const{data:k=0}=Kt({queryKey:["digest-today-failed-count"],queryFn:async()=>{const H=new Date;H.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",H.toISOString());if(Q)throw Q;return G||0}}),M=ar({mutationFn:async H=>{const{error:G}=await Y.from("weekly_digest_settings").update(H).eq("id",u==null?void 0:u.id);if(G)throw G},onSuccess:()=>{e.invalidateQueries({queryKey:["weekly-digest-settings"]}),Te.success("Settings updated")},onError:H=>{Te.error("Failed to update settings: "+H.message)}}),E=async()=>{n(!0);try{const{data:H,error:G}=await Y.functions.invoke("send-weekly-digest",{body:{manual:!0}});if(G)throw G;H.queued?Te.success(`${H.queued.toLocaleString()} emails queued! They'll be sent automatically (~80/minute).`):H.sent!==void 0&&Te.success(`Digest sent! ${H.sent} emails delivered, ${H.failed} failed`),N(),e.invalidateQueries({queryKey:["weekly-digest-logs"]})}catch(H){Te.error("Failed to send digest: "+H.message)}finally{n(!1)}},T=async()=>{var H,G,Q,ne,ie,he;if(!(t!=null&&t.email)){Te.error("No email found for your account");return}o(!0);try{const{data:se,error:fe}=await Y.functions.invoke("send-weekly-digest",{body:{preview:!0,previewEmail:t.email}});if(fe)throw fe;const oe=se==null?void 0:se.resendId,ce=se==null?void 0:se.resendDetails,de=ce==null?void 0:ce.status,xe=((H=ce==null?void 0:ce.body)==null?void 0:H.status)||((Q=(G=ce==null?void 0:ce.body)==null?void 0:G.data)==null?void 0:Q.status),Me=((ie=(ne=ce==null?void 0:ce.body)==null?void 0:ne.error)==null?void 0:ie.message)||((he=ce==null?void 0:ce.body)==null?void 0:he.message);Te.success(oe?`Preview accepted by email provider (id: ${oe})${de?`, status check: ${de}`:""}${xe?`, provider: ${xe}`:""}${Me?` (${Me})`:""}. 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){Te.error("Failed to send preview: "+se.message)}finally{o(!1)}},P=async()=>{i(!0);try{const{data:H,error:G}=await Y.functions.invoke("send-weekly-digest",{body:{retryFailed:!0}});if(G)throw G;H.queued===0||H.sent===0&&H.failed===0&&!H.queued?Te.info("No failed emails to retry"):H.queued?Te.success(`${H.queued} emails queued for retry!`):Te.success(`Retry complete! ${H.sent} emails delivered, ${H.failed} failed`),N(),e.invalidateQueries({queryKey:["weekly-digest-logs"]}),e.invalidateQueries({queryKey:["digest-today-failed-count"]}),e.invalidateQueries({queryKey:["digest-today-missing-count"]})}catch(H){Te.error("Failed to retry: "+H.message)}finally{i(!1)}},R=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}=Kt({queryKey:["digest-delivery-stats"],queryFn:async()=>{var he,se;const H=new Date;H.setUTCHours(0,0,0,0);const[G,Q,ne,ie]=await Promise.all([Y.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","sent").gte("sent_at",H.toISOString()),Y.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","failed").gte("sent_at",H.toISOString()),Y.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("has_agent_os_activity",!0).gte("sent_at",H.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:ne.count||0,lastSent:((se=(he=ie.data)==null?void 0:he[0])==null?void 0:se.sent_at)||null}},refetchInterval:D?5e3:!1}),q={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(Si,{defaultValue:"settings",className:"space-y-6",children:[r.jsxs(ki,{children:[r.jsxs(is,{value:"settings",className:"flex items-center gap-2",children:[r.jsx(Bd,{className:"h-4 w-4"}),"Settings"]}),r.jsxs(is,{value:"stats",className:"flex items-center gap-2",children:[r.jsx(wc,{className:"h-4 w-4"}),"Delivery Stats"]})]}),r.jsxs(Ss,{value:"settings",className:"space-y-6",children:[D&&b&&r.jsx(He,{className:"border-primary/50 bg-primary/5",children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[r.jsx(Vr,{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:[R,"%"]})]}),r.jsx(lc,{value:R,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(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-primary/10",children:r.jsx(qs,{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(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-emerald-500/10",children:r.jsx(Ki,{className:"h-5 w-5 text-emerald-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:q.totalSent}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Delivered"})]})]})})}),r.jsx(He,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-destructive/10",children:r.jsx(jc,{className:"h-5 w-5 text-destructive"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:q.totalFailed}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed"})]})]})})}),r.jsx(He,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-primary/10",children:r.jsx(Ra,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:q.lastSent?rs(new Date(q.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(Vt,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Ra,{className:"h-5 w-5"}),"Schedule"]}),r.jsx(Ns,{children:"Configure when the digest is sent"})]}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"Enable Weekly Digest"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Send automated weekly emails to members"})]}),r.jsx(In,{checked:u==null?void 0:u.is_enabled,onCheckedChange:H=>M.mutate({is_enabled:H})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Cron Frequency"}),r.jsxs(us,{value:(u==null?void 0:u.cron_frequency)||"daily",onValueChange:H=>M.mutate({cron_frequency:H}),children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsxs(ds,{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(us,{value:String(u==null?void 0:u.send_day),onValueChange:H=>M.mutate({send_day:parseInt(H)}),children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsx(ds,{children:UJt.map(H=>r.jsx($t,{value:H.value,children:H.label},H.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Time (UTC)"}),r.jsxs(us,{value:String(u==null?void 0:u.send_hour),onValueChange:H=>M.mutate({send_hour:parseInt(H)}),disabled:(u==null?void 0:u.cron_frequency)==="daily",children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsx(ds,{children:qJt.map(H=>r.jsx($t,{value:H.value,children:H.label},H.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(mo,{className:"h-4 w-4 mr-2"}),a?"Sending...":"Send Preview to Me"]}),r.jsxs(X,{onClick:E,disabled:s,className:"flex-1",children:[r.jsx(ro,{className:"h-4 w-4 mr-2"}),s?"Sending...":"Send to All"]})]}),k>0&&r.jsxs(X,{onClick:P,disabled:l,variant:"outline",className:"w-full",children:[r.jsx(Go,{className:`h-4 w-4 mr-2 ${l?"animate-spin":""}`}),l?"Retrying...":`Retry ${k} Failed`]})]})]})]}),r.jsxs(He,{children:[r.jsxs(Vt,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(ga,{className:"h-5 w-5"}),"Content Sections"]}),r.jsx(Ns,{children:"Choose what to include in the digest"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ga,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ze,{children:"New Resources"})]}),r.jsx(In,{checked:u==null?void 0:u.include_new_resources,onCheckedChange:H=>M.mutate({include_new_resources:H})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(qs,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ze,{children:"Community Highlights"})]}),r.jsx(In,{checked:u==null?void 0:u.include_community_posts,onCheckedChange:H=>M.mutate({include_community_posts:H})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(wc,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ze,{children:"Agent OS Stats"})]}),r.jsx(In,{checked:u==null?void 0:u.include_agent_os_stats,onCheckedChange:H=>M.mutate({include_agent_os_stats:H})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(jn,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ze,{children:"Upcoming Events"})]}),r.jsx(In,{checked:u==null?void 0:u.include_upcoming_events,onCheckedChange:H=>M.mutate({include_upcoming_events:H})})]}),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(In,{checked:u==null?void 0:u.include_goals_progress,onCheckedChange:H=>M.mutate({include_goals_progress:H})})]})]})]})]}),r.jsxs(He,{children:[r.jsxs(Vt,{children:[r.jsx(Gt,{children:"Custom Introduction"}),r.jsx(Ns,{children:"Personalize the intro message (optional)"})]}),r.jsx(Xe,{children:r.jsx(Ys,{placeholder:"Here's what's new this week to help you grow your business...",value:(u==null?void 0:u.custom_intro_text)||"",onChange:H=>M.mutate({custom_intro_text:H.target.value||null}),rows:3})})]})]}),r.jsx(Ss,{value:"stats",children:r.jsxs(He,{children:[r.jsxs(Vt,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Nn,{className:"h-5 w-5"}),"Delivery History"]}),r.jsx(Ns,{children:"Recent digest emails sent to members"})]}),r.jsx(Xe,{children:y?r.jsx("div",{className:"animate-pulse space-y-2",children:[1,2,3,4,5].map(H=>r.jsx("div",{className:"h-12 bg-muted rounded"},H))}):x&&x.length>0?r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:x.map(H=>r.jsxs(kr,{children:[r.jsx(gt,{className:"font-medium",children:H.email_sent_to}),r.jsx(gt,{children:rs(new Date(H.sent_at),"MMM d, yyyy h:mm a")}),r.jsx(gt,{children:r.jsx(Tt,{variant:H.delivery_status==="sent"?"default":"destructive",children:H.delivery_status})}),r.jsx(gt,{children:H.resources_count}),r.jsx(gt,{children:H.has_agent_os_activity?r.jsx(Tt,{variant:"secondary",children:"Active"}):r.jsx(Tt,{variant:"outline",children:"Not Started"})})]},H.id))})]}):r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Nn,{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 HJt={first_event:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900 dark:text-emerald-200",streak_3:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",streak_5:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",events_5:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",events_10:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",events_25:"bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200"};function WJt(){var be,we,tt;const e=Br(),[t,s]=A.useState(""),[n,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),[E,T]=A.useState(""),[P,R]=A.useState(null),{data:D,isLoading:U}=Kt({queryKey:["admin-agent-points"],queryFn:async()=>{const{data:Ae,error:Le}=await Y.from("agent_attendance_stats").select("*").order("total_points",{ascending:!1});if(Le)throw Le;const Ue=(Ae==null?void 0:Ae.map(it=>it.user_id))||[],{data:Pe}=await Y.from("profiles").select("id, name, email").in("id",Ue),$e=new Map((Pe==null?void 0:Pe.map(it=>[it.id,{name:it.name,email:it.email}]))||[]);return Ae==null?void 0:Ae.map(it=>({...it,profile:$e.get(it.user_id)||null}))}}),{data:q}=Kt({queryKey:["all-profiles-for-points",D],queryFn:async()=>{const{data:Ae,error:Le}=await Y.from("profiles").select("id, name, email").order("name");if(Le)throw Le;return Ae}}),G=((q==null?void 0:q.filter(Ae=>!(D!=null&&D.some(Le=>Le.user_id===Ae.id))))||[]).filter(Ae=>{var Ue,Pe;if(!E)return!0;const Le=E.toLowerCase();return((Ue=Ae.name)==null?void 0:Ue.toLowerCase().includes(Le))||((Pe=Ae.email)==null?void 0:Pe.toLowerCase().includes(Le))}),{data:Q,isLoading:ne}=Kt({queryKey:["agent-point-history",n==null?void 0:n.user_id],queryFn:async()=>{if(!(n!=null&&n.user_id))return[];const{data:Ae,error:Le}=await Y.from("agent_points").select("*").eq("user_id",n.user_id).order("created_at",{ascending:!1});if(Le)throw Le;return Ae},enabled:!!(n!=null&&n.user_id)&&i}),{data:ie}=Kt({queryKey:["agent-badges",n==null?void 0:n.user_id],queryFn:async()=>{if(!(n!=null&&n.user_id))return[];const{data:Ae,error:Le}=await Y.from("agent_badges").select("*").eq("user_id",n.user_id).order("earned_at",{ascending:!1});if(Le)throw Le;return Ae},enabled:!!(n!=null&&n.user_id)}),he=ar({mutationFn:async({userId:Ae,points:Le,reason:Ue})=>{const{error:Pe}=await Y.from("agent_points").insert({user_id:Ae,points:Le,reason:Ue});if(Pe)throw Pe;const{data:$e}=await Y.from("agent_attendance_stats").select("total_points, spendable_points").eq("user_id",Ae).maybeSingle(),it=(($e==null?void 0:$e.total_points)||0)+Le,xt=(($e==null?void 0:$e.spendable_points)||0)+Le,{error:Ee}=await Y.from("agent_attendance_stats").upsert({user_id:Ae,total_points:Math.max(0,it),spendable_points:Math.max(0,xt),updated_at:new Date().toISOString()},{onConflict:"user_id"});if(Ee)throw Ee},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-agent-points"]}),e.invalidateQueries({queryKey:["agent-point-history"]}),l(!1),x(""),v(""),Te.success(b?"Points awarded successfully!":"Points deducted successfully!")},onError:Ae=>{console.error("Error modifying points:",Ae),Te.error("Failed to modify points")}}),se=()=>{if(!n||!m||!y){Te.error("Please fill in all fields");return}const Ae=parseInt(m);if(isNaN(Ae)||Ae<=0){Te.error("Please enter a valid positive number");return}he.mutate({userId:n.user_id,points:b?Ae:-Ae,reason:y})},fe=()=>{if(!P||!m||!y){Te.error("Please fill in all fields");return}const Ae=parseInt(m);if(isNaN(Ae)||Ae<=0){Te.error("Please enter a valid positive number");return}he.mutate({userId:P.id,points:Ae,reason:y},{onSuccess:()=>{M(!1),R(null),T("")}})},oe=(Ae,Le)=>{a(Ae),N(Le),l(!0)},ce=Ae=>{a(Ae),u(!0)},de=D==null?void 0:D.filter(Ae=>{var $e,it,xt,Ee;const Le=((it=($e=Ae.profile)==null?void 0:$e.name)==null?void 0:it.toLowerCase())||"",Ue=((Ee=(xt=Ae.profile)==null?void 0:xt.email)==null?void 0:Ee.toLowerCase())||"",Pe=t.toLowerCase();return Le.includes(Pe)||Ue.includes(Pe)}),xe=(D==null?void 0:D.reduce((Ae,Le)=>Ae+Le.total_points,0))||0,Me=(D==null?void 0:D.length)||0,ve=Me>0?Math.round(xe/Me):0;return U?r.jsx(Dr,{title:"Agent Points",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Cr,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-3 gap-4",children:[1,2,3].map(Ae=>r.jsx(Cr,{className:"h-24"},Ae))}),r.jsx(Cr,{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(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(qs,{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:Me}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"with points tracked"})]})}),r.jsx(He,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(lo,{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(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(bu,{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:ve}),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(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search agents...",value:t,onChange:Ae=>s(Ae.target.value),className:"pl-10"})]}),r.jsxs(X,{onClick:()=>M(!0),children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Award Points to New Agent"]})]}),r.jsxs(He,{children:[r.jsxs(Vt,{children:[r.jsx(Gt,{children:"Agent Leaderboard"}),r.jsx(Ns,{children:"All agents with their points, events, and streaks"})]}),r.jsx(Xe,{children:!de||de.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(lo,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No agents with points yet"})]}):r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:de.map((Ae,Le)=>{var Ue,Pe,$e,it;return r.jsxs(kr,{children:[r.jsx(gt,{className:"font-medium",children:Le<3?r.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center ${Le===0?"bg-yellow-100 text-yellow-700":Le===1?"bg-gray-100 text-gray-600":"bg-amber-100 text-amber-700"}`,children:Le+1}):r.jsx("span",{className:"text-muted-foreground",children:Le+1})}),r.jsx(gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Xn,{className:"h-8 w-8",children:r.jsx(Qn,{children:((Pe=(Ue=Ae.profile)==null?void 0:Ue.name)==null?void 0:Pe.charAt(0))||"?"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:(($e=Ae.profile)==null?void 0:$e.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(it=Ae.profile)==null?void 0:it.email})]})]})}),r.jsx(gt,{className:"text-center",children:r.jsxs(Tt,{variant:"secondary",className:"font-bold",children:[r.jsx(Mn,{className:"h-3 w-3 mr-1"}),Ae.total_points]})}),r.jsx(gt,{className:"text-center",children:r.jsxs(Tt,{variant:"outline",className:"font-bold text-primary",children:[r.jsx(oo,{className:"h-3 w-3 mr-1"}),Ae.spendable_points||0]})}),r.jsx(gt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(jn,{className:"h-3 w-3 text-muted-foreground"}),Ae.total_events_attended]})}),r.jsx(gt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(gm,{className:"h-3 w-3 text-orange-500"}),Ae.current_streak]})}),r.jsx(gt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>oe(Ae,!0),title:"Award points",children:r.jsx(vs,{className:"h-4 w-4 text-green-600"})}),r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>oe(Ae,!1),title:"Deduct points",children:r.jsx(Y1,{className:"h-4 w-4 text-red-600"})}),r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>ce(Ae),title:"View history",children:r.jsx(AS,{className:"h-4 w-4"})})]})})]},Ae.user_id)})})]})})]}),r.jsx(Or,{open:o,onOpenChange:l,children:r.jsxs(Pr,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:b?"Award Points":"Deduct Points"}),r.jsxs(Zs,{children:[b?"Award":"Deduct"," points ",b?"to":"from"," ",((be=n==null?void 0:n.profile)==null?void 0:be.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(ot,{id:"points",type:"number",min:"1",placeholder:"Enter points...",value:m,onChange:Ae=>x(Ae.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"reason",children:"Reason"}),r.jsx(Ys,{id:"reason",placeholder:"Enter reason for this adjustment...",value:y,onChange:Ae=>v(Ae.target.value)})]})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsx(X,{onClick:se,disabled:he.isPending,className:b?"bg-green-600 hover:bg-green-700":"bg-red-600 hover:bg-red-700",children:he.isPending?"Saving...":b?"Award Points":"Deduct Points"})]})]})}),r.jsx(Or,{open:i,onOpenChange:u,children:r.jsxs(Pr,{className:"max-w-2xl",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{children:["Point History: ",(we=n==null?void 0:n.profile)==null?void 0:we.name]}),r.jsx(Zs,{children:"View all point transactions and badges for this agent"})]}),r.jsxs(Si,{defaultValue:"history",className:"w-full",children:[r.jsxs(ki,{className:"grid w-full grid-cols-2",children:[r.jsx(is,{value:"history",children:"Point History"}),r.jsx(is,{value:"badges",children:"Badges"})]}),r.jsx(Ss,{value:"history",className:"mt-4",children:ne?r.jsx("div",{className:"space-y-2",children:[1,2,3].map(Ae=>r.jsx(Cr,{className:"h-12"},Ae))}):!Q||Q.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(AS,{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(Ae=>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:Ae.reason}),r.jsx("p",{className:"text-xs text-muted-foreground",children:rs(new Date(Ae.created_at),"MMM d, yyyy h:mm a")})]}),r.jsxs(Tt,{variant:Ae.points>=0?"default":"destructive",className:Ae.points>=0?"bg-green-100 text-green-800":"",children:[Ae.points>=0?"+":"",Ae.points]})]},Ae.id))})}),r.jsx(Ss,{value:"badges",className:"mt-4",children:!ie||ie.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx($l,{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:ie.map(Ae=>r.jsxs("div",{className:`p-3 rounded-lg ${HJt[Ae.badge_type]||"bg-gray-100"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($l,{className:"h-5 w-5"}),r.jsx("span",{className:"font-medium",children:Ae.badge_name})]}),Ae.badge_description&&r.jsx("p",{className:"text-xs mt-1 opacity-80",children:Ae.badge_description}),r.jsxs("p",{className:"text-xs mt-1 opacity-60",children:["Earned ",rs(new Date(Ae.earned_at),"MMM d, yyyy")]})]},Ae.id))})})]})]})}),r.jsx(Or,{open:k,onOpenChange:Ae=>{M(Ae),Ae||(R(null),T(""),x(""),v(""))},children:r.jsxs(Pr,{className:"max-w-md",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Award Points to New Agent"}),r.jsx(Zs,{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(Xn,{className:"h-10 w-10",children:r.jsx(Qn,{children:((tt=P.name)==null?void 0:tt.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:()=>R(null),children:"Change"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"new-points",children:"Points Amount"}),r.jsx(ot,{id:"new-points",type:"number",min:"1",placeholder:"Enter points...",value:m,onChange:Ae=>x(Ae.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"new-reason",children:"Reason"}),r.jsx(Ys,{id:"new-reason",placeholder:"Enter reason for awarding points...",value:y,onChange:Ae=>v(Ae.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(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by name or email...",value:E,onChange:Ae=>T(Ae.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(qs,{className:"h-6 w-6 mx-auto mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:E?"No matching agents found":"All agents already have points"})]}):G.slice(0,20).map(Ae=>{var Le;return r.jsxs("button",{onClick:()=>R(Ae),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(Xn,{className:"h-8 w-8",children:r.jsx(Qn,{children:((Le=Ae.name)==null?void 0:Le.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium truncate",children:Ae.name||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Ae.email})]})]},Ae.id)})})]})}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),P&&r.jsxs(X,{onClick:fe,disabled:he.isPending,className:"bg-green-600 hover:bg-green-700",children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Award Points"]})]})]})})]})})}function GJt(){const{data:e,isLoading:t}=Bct(),[s,n]=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}=Kt({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),R={};return P==null||P.forEach(D=>{R[D.id]={name:D.name||"",email:D.email||""}}),R},enabled:N.length>0}),{data:E}=Kt({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:R}=await Y.from("agent_card_interactions").select("card_id").in("card_id",k).eq("interaction_type","card_view");R==null||R.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(R=>R.is_published):u==="draft"&&(P=P.filter(R=>!R.is_published)),l.trim()){const R=l.toLowerCase();P=P.filter(D=>{var q,H;const U=M==null?void 0:M[D.user_id];return D.slug.toLowerCase().includes(R)||((q=U==null?void 0:U.name)==null?void 0:q.toLowerCase().includes(R))||((H=U==null?void 0:U.email)==null?void 0:H.toLowerCase().includes(R))})}return x==="newest"?P.sort((R,D)=>new Date(D.created_at).getTime()-new Date(R.created_at).getTime()):x==="oldest"?P.sort((R,D)=>new Date(R.created_at).getTime()-new Date(D.created_at).getTime()):x==="name"?P.sort((R,D)=>{var U,q;return(((U=M==null?void 0:M[R.user_id])==null?void 0:U.name)||"").localeCompare(((q=M==null?void 0:M[D.user_id])==null?void 0:q.name)||"")}):x==="slug"?P.sort((R,D)=>R.slug.localeCompare(D.slug)):x==="views_desc"?P.sort((R,D)=>{var U,q;return(((U=E==null?void 0:E[D.id])==null?void 0:U.views)||0)-(((q=E==null?void 0:E[R.id])==null?void 0:q.views)||0)}):x==="views_asc"?P.sort((R,D)=>{var U,q;return(((U=E==null?void 0:E[R.id])==null?void 0:U.views)||0)-(((q=E==null?void 0:E[D.id])==null?void 0:q.views)||0)}):x==="leads_desc"?P.sort((R,D)=>{var U,q;return(((U=E==null?void 0:E[D.id])==null?void 0:U.leads)||0)-(((q=E==null?void 0:E[R.id])==null?void 0:q.leads)||0)}):x==="leads_asc"&&P.sort((R,D)=>{var U,q;return(((U=E==null?void 0:E[R.id])==null?void 0:U.leads)||0)-(((q=E==null?void 0:E[D.id])==null?void 0:q.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(vs,{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(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by name, email, or slug...",value:l,onChange:P=>i(P.target.value),className:"pl-9"})]}),r.jsxs(us,{value:u,onValueChange:m,children:[r.jsx(cs,{className:"w-full sm:w-36",children:r.jsx(ms,{placeholder:"Status"})}),r.jsxs(ds,{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(us,{value:x,onValueChange:y,children:[r.jsx(cs,{className:"w-full sm:w-44",children:r.jsx(ms,{placeholder:"Sort by"})}),r.jsxs(ds,{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($S,{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(pp,{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(Cr,{className:"h-48"},P))}):T.length>0?v==="table"?r.jsx(KJt,{cards:T,cardProfiles:M,cardStats:E,onEdit:n,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(ZJt,{card:P,onEdit:()=>n(P),stats:E==null?void 0:E[P.id]},P.id))}):e&&e.length>0?r.jsx(He,{children:r.jsxs(Xe,{className:"flex flex-col items-center justify-center py-12",children:[r.jsx(ua,{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(Xe,{className:"flex flex-col items-center justify-center py-12",children:[r.jsx(qs,{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(vs,{className:"h-4 w-4 mr-2"}),"Create Card"]})]})})]}),r.jsx(YJt,{open:a,onOpenChange:o}),s&&r.jsx(XJt,{card:s,open:!!s,onOpenChange:P=>!P&&n(null)})]})}function KJt({cards:e,cardProfiles:t,cardStats:s,onEdit:n,sortBy:a,setSortBy:o}){const l=u=>{a===`${u}_desc`?o(`${u}_asc`):o(`${u}_desc`)},i=({field:u})=>a===`${u}_desc`?r.jsx(ly,{className:"h-3 w-3"}):a===`${u}_asc`?r.jsx(hp,{className:"h-3 w-3"}):r.jsx(Dg,{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(hp,{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=s==null?void 0:s[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:()=>n(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),Te.success("Link copied!")},children:r.jsx(Mo,{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(Sn,{className:"h-3.5 w-3.5"})})})]})})]},u.id)})})]})})})}function ZJt({card:e,onEdit:t,stats:s}){const[n,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),Te.success("Link copied!")};return r.jsx(He,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[r.jsxs(Xn,{className:"h-10 w-10",children:[r.jsx(ji,{src:(n==null?void 0:n.avatar_url)||void 0}),r.jsx(Qn,{children:((n==null?void 0:n.name)||"U")[0]})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold truncate",children:(n==null?void 0:n.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(mo,{className:"h-3.5 w-3.5"}),(s==null?void 0:s.views)??0," views"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(qs,{className:"h-3.5 w-3.5"}),(s==null?void 0:s.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(Mo,{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(Sn,{className:"h-3 w-3"})})})]})]})})}function YJt({open:e,onOpenChange:t}){const[s,n]=A.useState(""),[a,o]=A.useState(""),[l,i]=A.useState(""),[u,m]=A.useState(!1),x=E8e(),y=l.trim(),{data:v}=Kt({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===s))||b,M=()=>{if(!s||!a.trim()){Te.error("Select an agent and enter a slug");return}x.mutate({user_id:s,slug:a.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-"),is_published:!0},{onSuccess:()=>{t(!1),n(""),o(""),i("")}})},E=T=>{var R;n(T),m(!1);const P=v==null?void 0:v.find(D=>D.id===T);P&&(N(P),o(((R=P.name)==null?void 0:R.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""))||""))};return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Pr,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Create Agent Card"}),r.jsx(Zs,{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(Kc,{open:u,onOpenChange:m,children:[r.jsx(Zc,{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(Ac,{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:E,children:[r.jsx(fi,{className:Ut("mr-2 h-4 w-4",s===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(ot,{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 XJt({card:e,open:t,onOpenChange:s}){const n=I8e(),{data:a}=P8e(e.id),o=Br(),[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,E]=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:ne}=Y.storage.from("avatars").getPublicUrl(`${e.user_id}/${Q[0].name}`);i(`${ne.publicUrl}?t=${Date.now()}`)}}catch{}})()},[e.user_id,t]);const R=G=>{var ie;const Q=(ie=G.target.files)==null?void 0:ie[0];if(!Q)return;if(!Q.type.startsWith("image/")){Te.error("Please select an image file");return}if(Q.size>5*1024*1024){Te.error("Image must be under 5MB");return}const ne=new FileReader;ne.onloadend=()=>{b(ne.result),y(!0)},ne.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(fe=>`${e.user_id}/${fe.name}`));const ne=`${e.user_id}/avatar.jpg`,{error:ie}=await Y.storage.from("avatars").upload(ne,G,{upsert:!0,contentType:"image/jpeg"});if(ie)throw ie;const{data:he}=Y.storage.from("avatars").getPublicUrl(ne),se=`${he.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"]}),Te.success("Photo updated!")}catch(Q){Te.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){Te.error("Please enter a valid URL");return}if(G===e.slug){Te.info("No changes to save");return}E(!0);try{const{data:Q}=await Y.from("agent_cards").select("id").eq("slug",G).neq("id",e.id).maybeSingle();if(Q){Te.error("This URL is already taken. Try another one.");return}const{error:ne}=await Y.from("agent_cards").update({slug:G}).eq("id",e.id);if(ne)throw ne;k(G),o.invalidateQueries({queryKey:["agent-cards-admin"]}),Te.success("Card address updated!")}catch{Te.error("Failed to update card address")}finally{E(!1)}},q=async(G,Q)=>{var ie;const ne=(ie=G.target.files)==null?void 0:ie[0];if(ne){if(!ne.type.startsWith("image/")){Te.error("Please select an image file");return}try{const he=ne.name.split(".").pop()||"png",se=Q==="brokerage_logo_url"?"brokerage-logo":"team-logo",fe=`${e.user_id}/${se}.${he}`,{error:oe}=await Y.storage.from("card-logos").upload(fe,ne,{upsert:!0});if(oe)throw oe;const{data:ce}=Y.storage.from("card-logos").getPublicUrl(fe),de=ce.publicUrl+"?t="+Date.now();P(Q==="brokerage_logo_url"?xe=>({...xe,[Q]:de,brokerage_display_name:""}):xe=>({...xe,[Q]:de,team_name:""})),Te.success("Logo uploaded!")}catch{Te.error("Failed to upload logo")}finally{G.target.value=""}}},H=()=>{n.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:()=>s(!1)})};return r.jsxs(r.Fragment,{children:[r.jsx(Or,{open:t,onOpenChange:s,children:r.jsxs(Pr,{className:"max-w-2xl max-h-[85vh] overflow-y-auto",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Edit Agent Card"}),r.jsxs(Zs,{children:["/card/",e.slug]})]}),r.jsxs(Si,{defaultValue:"content",children:[r.jsxs(ki,{className:"w-full",children:[r.jsx(is,{value:"content",className:"flex-1",children:"Content"}),r.jsx(is,{value:"sections",className:"flex-1",children:"Sections"}),r.jsx(is,{value:"blocks",className:"flex-1",children:"Blocks"}),r.jsx(is,{value:"analytics",className:"flex-1",children:"Analytics"})]}),r.jsxs(Ss,{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(In,{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(Xn,{className:"h-16 w-16",children:[r.jsx(ji,{src:l||void 0}),r.jsx(Qn,{children:"?"})]}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:R,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(Vr,{className:"h-3 w-3 mr-1 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(so,{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(ot,{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(us,{value:T.theme,onValueChange:G=>P(Q=>({...Q,theme:G})),children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsxs(ds,{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(ot,{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(ot,{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(Ys,{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(ot,{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(ot,{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(ot,{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(ot,{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(ot,{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(ot,{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(so,{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=>q(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(Sf,{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(ot,{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(so,{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=>q(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(Sf,{value:[T.team_logo_size||56],onValueChange:([G])=>P(Q=>({...Q,team_logo_size:G})),min:24,max:120,step:4})]})]})]})]}),r.jsx(Ss,{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:ne})=>r.jsxs("div",{className:"flex items-center justify-between py-2",children:[r.jsxs("div",{children:[r.jsx(ze,{children:Q}),ne&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[ne," ",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(In,{checked:T[G],onCheckedChange:ie=>P(he=>({...he,[G]:ie}))})]},G))}),r.jsx(Ss,{value:"blocks",className:"mt-4",children:r.jsx(DVe,{cardId:e.id})}),r.jsx(Ss,{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(Xe,{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(Xe,{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(Xe,{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:H,disabled:n.isPending,className:"w-full mt-4",children:n.isPending?"Saving...":"Save Changes"})]})}),r.jsx(A0e,{open:x,onClose:()=>y(!1),imageSrc:v,onCropComplete:D,aspectRatio:1})]})}const dC={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"},dve={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 uve(e=!0){return Kt({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:s,error:n}=await t;if(n)throw n;return s}})}function QJt(){const e=Br();return ar({mutationFn:async t=>{const{data:s,error:n}=await Y.from("marketplace_categories").insert([t]).select().single();if(n)throw n;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-categories"]}),Te.success("Category created successfully")},onError:t=>{Te.error("Failed to create category: "+t.message)}})}function JJt(){const e=Br();return ar({mutationFn:async({id:t,...s})=>{const{data:n,error:a}=await Y.from("marketplace_categories").update(s).eq("id",t).select().single();if(a)throw a;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-categories"]}),Te.success("Category updated successfully")},onError:t=>{Te.error("Failed to update category: "+t.message)}})}function eer(){const e=Br();return ar({mutationFn:async t=>{const{error:s}=await Y.from("marketplace_categories").delete().eq("id",t);if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-categories"]}),Te.success("Category deleted successfully")},onError:t=>{Te.error("Failed to delete category: "+t.message)}})}function YVe(e,t=!0){return Kt({queryKey:["marketplace-products",e,t],queryFn:async()=>{let s=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&&(s=s.eq("category_id",e)),t&&(s=s.eq("is_active",!0));const{data:n,error:a}=await s;if(a)throw a;return n}})}function ter(e){return Kt({queryKey:["marketplace-product",e],queryFn:async()=>{const{data:t,error:s}=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(s)throw s;return t},enabled:!!e})}function rer(){const e=Br();return ar({mutationFn:async t=>{const{data:s,error:n}=await Y.from("marketplace_products").insert([t]).select().single();if(n)throw n;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-products"]}),Te.success("Product created successfully")},onError:t=>{Te.error("Failed to create product: "+t.message)}})}function ser(){const e=Br();return ar({mutationFn:async({id:t,...s})=>{const{data:n,error:a}=await Y.from("marketplace_products").update(s).eq("id",t).select().single();if(a)throw a;return n},onSuccess:(t,s)=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",s.id]}),Te.success("Product updated successfully")},onError:t=>{Te.error("Failed to update product: "+t.message)}})}function ner(){const e=Br();return ar({mutationFn:async t=>{const{error:s}=await Y.from("marketplace_products").delete().eq("id",t);if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-products"]}),Te.success("Product deleted successfully")},onError:t=>{Te.error("Failed to delete product: "+t.message)}})}function aer(){const e=Br();return ar({mutationFn:async t=>{const{data:s,error:n}=await Y.from("marketplace_product_images").insert([t]).select().single();if(n)throw n;return s},onSuccess:(t,s)=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",s.product_id]})}})}function ier(){const e=Br();return ar({mutationFn:async({id:t,productId:s})=>{const{error:n}=await Y.from("marketplace_product_images").delete().eq("id",t);if(n)throw n;return s},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",t]}),Te.success("Image deleted successfully")},onError:t=>{Te.error("Failed to delete image: "+t.message)}})}function oer(){const e=Br();return ar({mutationFn:async({imageId:t,productId:s})=>{const{error:n}=await Y.from("marketplace_product_images").update({is_primary:!1}).eq("product_id",s);if(n)throw n;const{error:a}=await Y.from("marketplace_product_images").update({is_primary:!0}).eq("id",t);if(a)throw a;return s},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",t]}),Te.success("Primary image updated")},onError:t=>{Te.error("Failed to set primary image: "+t.message)}})}function ler(){const e=Br();return ar({mutationFn:async t=>{const{data:s,error:n}=await Y.from("marketplace_product_variants").insert([t]).select().single();if(n)throw n;return s},onSuccess:(t,s)=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",s.product_id]}),Te.success("Variant added successfully")}})}function cer(){const e=Br();return ar({mutationFn:async({id:t,productId:s})=>{const{error:n}=await Y.from("marketplace_product_variants").delete().eq("id",t);if(n)throw n;return s},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",t]}),Te.success("Variant deleted successfully")}})}function der(){const e=Br();return ar({mutationFn:async({productId:t,videoUrl:s})=>{await Y.from("marketplace_product_videos").delete().eq("product_id",t);const{data:n,error:a}=await Y.from("marketplace_product_videos").insert({product_id:t,video_url:s}).select().single();if(a)throw a;return n},onSuccess:(t,s)=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",s.productId]}),Te.success("Video updated successfully")}})}function uer(e){const{isAdmin:t}=Yr();return Kt({queryKey:["marketplace-orders",e,t],queryFn:async()=>{let s=Y.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).order("created_at",{ascending:!1});const{data:n,error:a}=await s;if(a)throw a;if(t&&n){const o=[...new Set(n.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 n.map(u=>({...u,user:i.get(u.user_id)}))}return n}})}function her(){const{user:e}=Yr();return Kt({queryKey:["my-marketplace-orders",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:s}=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(s)throw s;return t},enabled:!!(e!=null&&e.id)})}function mer(e){return Kt({queryKey:["marketplace-order",e],queryFn:async()=>{const{data:t,error:s}=await Y.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).eq("id",e).single();if(s)throw s;return t},enabled:!!e})}function per(){const e=Br(),{user:t}=Yr();return ar({mutationFn:async({orderId:s,status:n,notes:a,trackingNumber:o,trackingUrl:l,previousStatus:i})=>{const u={status:n};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",s);if(m)throw m;const{error:x}=await Y.from("marketplace_order_status_history").insert({order_id:s,status:n,notes:a,created_by:t==null?void 0:t.id});if(x)throw x;if(["shipped","in_production","processing","completed"].includes(n)&&n!==i)try{await Y.functions.invoke("marketplace-order-notify",{body:{orderId:s,notificationType:n==="shipped"?"shipped":"status_update",newStatus:n,trackingNumber:o,trackingUrl:l}})}catch(v){console.error("Failed to send notification email:",v)}},onSuccess:(s,n)=>{e.invalidateQueries({queryKey:["marketplace-orders"]}),e.invalidateQueries({queryKey:["marketplace-order",n.orderId]}),e.invalidateQueries({queryKey:["my-marketplace-orders"]}),Te.success("Order status updated")},onError:s=>{Te.error("Failed to update order: "+s.message)}})}function fer(){const e=Br();return ar({mutationFn:async({itemId:t,proofUrl:s,proofNotes:n,orderId:a})=>{const{error:o}=await Y.from("marketplace_order_items").update({proof_url:s,proof_notes:n,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"]}),Te.success("Proof uploaded & customer notified")}})}function ger(){const e=Br();return ar({mutationFn:async({itemId:t,orderId:s})=>{const{error:n}=await Y.from("marketplace_order_items").update({proof_status:"approved"}).eq("id",t);if(n)throw n;return s},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-orders"]}),e.invalidateQueries({queryKey:["marketplace-order",t]}),e.invalidateQueries({queryKey:["my-marketplace-orders"]}),Te.success("Proof approved")}})}function xer(){const e=Br();return ar({mutationFn:async({itemId:t,orderId:s,reason:n})=>{const{error:a}=await Y.from("marketplace_order_items").update({proof_status:"rejected",proof_notes:n}).eq("id",t);if(a)throw a;return s},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-orders"]}),e.invalidateQueries({queryKey:["marketplace-order",t]}),e.invalidateQueries({queryKey:["my-marketplace-orders"]}),Te.success("Proof rejected - please upload a new proof")}})}function yer(){const{data:e,isLoading:t}=uve(!1),s=QJt(),n=JJt(),a=eer(),[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 n.mutateAsync({id:i.id,...m}):await s.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(Vt,{children:r.jsx(Cr,{className:"h-8 w-48"})}),r.jsx(Xe,{children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(k=>r.jsx(Cr,{className:"h-12 w-full"},k))})})]}):r.jsxs(He,{children:[r.jsxs(Vt,{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(vo,{asChild:!0,children:r.jsxs(X,{children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Add Category"]})}),r.jsxs(Pr,{children:[r.jsx(zr,{children:r.jsx(Rr,{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(ot,{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(Ys,{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(ot,{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(ot,{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(In,{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:s.isPending||n.isPending,children:i?"Update Category":"Create Category"})]})]})]})]}),r.jsx(Xe,{children:e&&e.length>0?r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:e.map(k=>r.jsxs(kr,{children:[r.jsx(gt,{className:"font-medium",children:k.name}),r.jsx(gt,{className:"max-w-xs truncate",children:k.description}),r.jsx(gt,{children:k.sort_order}),r.jsx(gt,{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(gt,{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(Bs,{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 ver(){var ve,be;const{data:e,isLoading:t}=YVe(void 0,!1),{data:s}=uve(!1),n=rer(),a=ser(),o=ner(),l=aer(),i=ier(),u=oer(),m=ler(),x=cer(),y=der(),[v,b]=A.useState(!1),[N,k]=A.useState(!1),[M,E]=A.useState(!1),[T,P]=A.useState(null),[R,D]=A.useState(null),[U,q]=A.useState(!1),[H,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,ne]=A.useState({name:"",price_adjustment:0}),[ie,he]=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)},fe=we=>{P(we),G({name:we.name,description:we.description||"",base_price:Number(we.base_price),shipping_fee:Number(we.shipping_fee),category_id:we.category_id||"",allow_artwork_upload:we.allow_artwork_upload,requires_proof_approval:we.requires_proof_approval,is_active:we.is_active,sort_order:we.sort_order}),b(!0)},oe=async we=>{we.preventDefault();const tt={...H,category_id:H.category_id||null};T?await a.mutateAsync({id:T.id,...tt}):await n.mutateAsync(tt),b(!1),se()},ce=async we=>{confirm("Are you sure you want to delete this product?")&&await o.mutateAsync(we)},de=async we=>{if(!R||!we.target.files||we.target.files.length===0)return;q(!0);const tt=we.target.files[0],Ae=tt.name.split(".").pop(),Le=`products/${R.id}/${Date.now()}.${Ae}`;try{const{error:Ue}=await Y.storage.from("marketplace").upload(Le,tt);if(Ue)throw Ue;const{data:{publicUrl:Pe}}=Y.storage.from("marketplace").getPublicUrl(Le);await l.mutateAsync({product_id:R.id,image_url:Pe,is_primary:!R.images||R.images.length===0}),Te.success("Image uploaded successfully")}catch(Ue){Te.error("Failed to upload image: "+Ue.message)}finally{q(!1)}},xe=async we=>{we.preventDefault(),R&&(await m.mutateAsync({product_id:R.id,name:Q.name,price_adjustment:Q.price_adjustment}),ne({name:"",price_adjustment:0}))},Me=async()=>{!R||!ie||(await y.mutateAsync({productId:R.id,videoUrl:ie}),he(""))};return t?r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsx(Cr,{className:"h-8 w-48"})}),r.jsx(Xe,{children:r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(we=>r.jsx(Cr,{className:"h-64 w-full"},we))})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(He,{children:[r.jsxs(Vt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Gt,{children:"Products"}),r.jsxs(Or,{open:v,onOpenChange:we=>{b(we),we||se()},children:[r.jsx(vo,{asChild:!0,children:r.jsxs(X,{children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Add Product"]})}),r.jsxs(Pr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsx(Rr,{children:T?"Edit Product":"Add Product"})}),r.jsxs("form",{onSubmit:oe,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(ot,{id:"name",value:H.name,onChange:we=>G({...H,name:we.target.value}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"category",children:"Category"}),r.jsxs(us,{value:H.category_id,onValueChange:we=>G({...H,category_id:we}),children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select category"})}),r.jsx(ds,{children:s==null?void 0:s.map(we=>r.jsx($t,{value:we.id,children:we.name},we.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"description",children:"Description"}),r.jsx(Ys,{id:"description",value:H.description,onChange:we=>G({...H,description:we.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(ot,{id:"base_price",type:"number",step:"0.01",min:"0",value:H.base_price,onChange:we=>G({...H,base_price:parseFloat(we.target.value)||0}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"shipping_fee",children:"Shipping Fee ($)"}),r.jsx(ot,{id:"shipping_fee",type:"number",step:"0.01",min:"0",value:H.shipping_fee,onChange:we=>G({...H,shipping_fee:parseFloat(we.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(ot,{id:"sort_order",type:"number",value:H.sort_order,onChange:we=>G({...H,sort_order:parseInt(we.target.value)||0})})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(In,{id:"allow_artwork_upload",checked:H.allow_artwork_upload,onCheckedChange:we=>G({...H,allow_artwork_upload:we})}),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(In,{id:"requires_proof_approval",checked:H.requires_proof_approval,onCheckedChange:we=>G({...H,requires_proof_approval:we})}),r.jsx(ze,{htmlFor:"requires_proof_approval",children:"Requires proof approval"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(In,{id:"is_active",checked:H.is_active,onCheckedChange:we=>G({...H,is_active:we})}),r.jsx(ze,{htmlFor:"is_active",children:"Active"})]})]}),r.jsx(X,{type:"submit",className:"w-full",disabled:n.isPending||a.isPending,children:T?"Update Product":"Create Product"})]})]})]})]}),r.jsx(Xe,{children:e&&e.length>0?r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:e.map(we=>{var tt,Ae;return r.jsxs(He,{className:"overflow-hidden",children:[r.jsxs("div",{className:"aspect-video bg-muted relative",children:[we.images&&we.images.length>0?r.jsx("img",{src:((tt=we.images.find(Le=>Le.is_primary))==null?void 0:tt.image_url)||we.images[0].image_url,alt:we.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"}),!we.is_active&&r.jsx(Tt,{variant:"secondary",className:"absolute top-2 right-2",children:"Inactive"})]}),r.jsxs(Xe,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold mb-1",children:we.name}),r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:((Ae=we.category)==null?void 0:Ae.name)||"No category"}),r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("span",{className:"font-bold",children:["$",Number(we.base_price).toFixed(2)]}),Number(we.shipping_fee)>0&&r.jsxs("span",{className:"text-sm text-muted-foreground",children:["+$",Number(we.shipping_fee).toFixed(2)," shipping"]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1 mb-3",children:[we.allow_artwork_upload&&r.jsx(Tt,{variant:"outline",className:"text-xs",children:"Artwork Upload"}),we.requires_proof_approval&&r.jsx(Tt,{variant:"outline",className:"text-xs",children:"Proof Required"}),we.variants&&we.variants.length>0&&r.jsxs(Tt,{variant:"outline",className:"text-xs",children:[we.variants.length," Variants"]})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(X,{variant:"outline",size:"sm",onClick:()=>fe(we),children:[r.jsx(Ja,{className:"h-3 w-3 mr-1"}),"Edit"]}),r.jsxs(X,{variant:"outline",size:"sm",onClick:()=>{D(we),k(!0)},children:[r.jsx(Z1,{className:"h-3 w-3 mr-1"}),"Images"]}),r.jsxs(X,{variant:"outline",size:"sm",onClick:()=>{D(we),E(!0)},children:[r.jsx(Vg,{className:"h-3 w-3 mr-1"}),"Variants"]}),r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>ce(we.id),children:r.jsx(Bs,{className:"h-3 w-3 text-destructive"})})]})]})]},we.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(Pr,{className:"max-w-2xl",children:[r.jsx(zr,{children:r.jsxs(Rr,{children:["Manage Images - ",R==null?void 0:R.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"grid grid-cols-3 gap-4",children:(ve=R==null?void 0:R.images)==null?void 0:ve.map(we=>r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:we.image_url,alt:"",className:"w-full aspect-square object-cover rounded-lg"}),we.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:[!we.is_primary&&r.jsx(X,{variant:"secondary",size:"icon",onClick:async()=>{var tt;await u.mutateAsync({imageId:we.id,productId:R.id}),D({...R,images:(tt=R.images)==null?void 0:tt.map(Ae=>({...Ae,is_primary:Ae.id===we.id}))})},disabled:u.isPending,title:"Set as primary",children:r.jsx(Mn,{className:"h-4 w-4"})}),r.jsx(X,{variant:"destructive",size:"icon",onClick:async()=>{var Ae;await i.mutateAsync({id:we.id,productId:R.id});const tt=e==null?void 0:e.find(Le=>Le.id===R.id);tt&&D({...tt,images:(Ae=tt.images)==null?void 0:Ae.filter(Le=>Le.id!==we.id)})},disabled:i.isPending,children:r.jsx(Bs,{className:"h-4 w-4"})})]})]},we.id))}),r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 text-center",children:[r.jsx("input",{type:"file",accept:"image/*",onChange:de,className:"hidden",id:"image-upload",disabled:U}),r.jsxs("label",{htmlFor:"image-upload",className:"cursor-pointer",children:[r.jsx(Z1,{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(ot,{placeholder:"Enter video URL (YouTube, Vimeo, etc.)",value:ie,onChange:we=>he(we.target.value)}),r.jsxs(X,{onClick:Me,disabled:!ie,children:[r.jsx(Ta,{className:"h-4 w-4 mr-2"}),"Set Video"]})]}),(R==null?void 0:R.video)&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:["Current video: ",R.video.video_url]})]})]})]})}),r.jsx(Or,{open:M,onOpenChange:E,children:r.jsxs(Pr,{children:[r.jsx(zr,{children:r.jsxs(Rr,{children:["Manage Variants - ",R==null?void 0:R.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("form",{onSubmit:xe,className:"flex gap-2",children:[r.jsx(ot,{placeholder:"Variant name (e.g., 500 count)",value:Q.name,onChange:we=>ne({...Q,name:we.target.value}),required:!0}),r.jsx(ot,{type:"number",step:"0.01",placeholder:"Price adj.",value:Q.price_adjustment,onChange:we=>ne({...Q,price_adjustment:parseFloat(we.target.value)||0}),className:"w-32"}),r.jsx(X,{type:"submit",children:"Add"})]}),r.jsxs("div",{className:"space-y-2",children:[(be=R==null?void 0:R.variants)==null?void 0:be.map(we=>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:we.name}),r.jsxs("span",{className:"text-sm text-muted-foreground ml-2",children:[Number(we.price_adjustment)>=0?"+":"","$",Number(we.price_adjustment).toFixed(2)]})]}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>x.mutateAsync({id:we.id,productId:R.id}),children:r.jsx(Bs,{className:"h-4 w-4 text-destructive"})})]},we.id)),(!(R!=null&&R.variants)||R.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 _er=["pending_payment","order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed","cancelled","refunded"];function ber(){var k,M,E;const{data:e,isLoading:t}=uer(),s=per(),n=fer(),[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 s.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 R=T.target.files[0],D=R.name.split(".").pop(),U=`proofs/${a.id}/${P}/${Date.now()}.${D}`;try{const{error:q}=await Y.storage.from("marketplace").upload(U,R);if(q)throw q;const{data:{publicUrl:H}}=Y.storage.from("marketplace").getPublicUrl(U);await n.mutateAsync({itemId:P,proofUrl:H,orderId:a.id}),Te.success("Proof uploaded successfully")}catch(q){Te.error("Failed to upload proof: "+q.message)}finally{y(!1)}};return t?r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsx(Cr,{className:"h-8 w-48"})}),r.jsx(Xe,{children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(T=>r.jsx(Cr,{className:"h-16 w-full"},T))})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsx(Gt,{children:"Orders"})}),r.jsx(Xe,{children:e&&e.length>0?r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:e.map(T=>{var P,R;return r.jsxs(kr,{children:[r.jsx(gt,{className:"font-mono",children:T.order_number}),r.jsx(gt,{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:(R=T.user)==null?void 0:R.email})]})}),r.jsx(gt,{children:rs(new Date(T.created_at),"MMM d, yyyy")}),r.jsxs(gt,{className:"font-bold",children:["$",Number(T.total).toFixed(2)]}),r.jsx(gt,{children:r.jsx(Tt,{className:dve[T.status],children:dC[T.status]})}),r.jsx(gt,{className:"text-right",children:r.jsxs(X,{variant:"ghost",size:"sm",onClick:()=>v(T),children:[r.jsx(mo,{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(Pr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsxs(Rr,{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:(E=a.items)==null?void 0:E.map(T=>r.jsxs("div",{className:"border rounded-lg p-4",children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:T.product_name}),T.variant_name&&r.jsx("p",{className:"text-sm text-muted-foreground",children:T.variant_name})]}),r.jsxs("p",{className:"font-bold",children:["$",Number(T.unit_price).toFixed(2)," x ",T.quantity]})]}),T.artwork_url&&r.jsxs("div",{className:"mt-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Customer Artwork:"}),r.jsx("a",{href:T.artwork_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-sm",children:"View Artwork"})]}),r.jsx("div",{className:"mt-3 pt-3 border-t",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"Proof Status: "}),r.jsx(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(so,{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(us,{value:u.status,onValueChange:T=>m({...u,status:T}),children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsx(ds,{children:_er.map(T=>r.jsx($t,{value:T,children:dC[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(ot,{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(ot,{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(Ys,{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:s.isPending,className:"w-full",children:[r.jsx(Vl,{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:dC[T.status]}),T.notes&&r.jsx("p",{className:"text-muted-foreground mt-1",children:T.notes})]}),r.jsx("span",{className:"text-muted-foreground",children:rs(new Date(T.created_at),"MMM d, h:mm a")})]},T.id))})]})]})]})})]})}function wer(){const[e,t]=A.useState("products"),s=Hs();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:()=>s("/marketplace"),children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"View Store"]})]}),r.jsxs(Si,{value:e,onValueChange:t,children:[r.jsxs(ki,{className:"grid w-full grid-cols-3",children:[r.jsxs(is,{value:"products",className:"flex items-center gap-2",children:[r.jsx(Vl,{className:"h-4 w-4"}),"Products"]}),r.jsxs(is,{value:"categories",className:"flex items-center gap-2",children:[r.jsx(If,{className:"h-4 w-4"}),"Categories"]}),r.jsxs(is,{value:"orders",className:"flex items-center gap-2",children:[r.jsx(Ih,{className:"h-4 w-4"}),"Orders"]})]}),r.jsx(Ss,{value:"products",children:r.jsx(ver,{})}),r.jsx(Ss,{value:"categories",children:r.jsx(yer,{})}),r.jsx(Ss,{value:"orders",children:r.jsx(ber,{})})]})]})})}function XVe(){return Kt({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 jer(e){return Kt({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:s,error:n}=await t;if(n)throw n;return s}})}function ker(e){return Kt({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:s,error:n}=await t;if(n)throw n;return s}})}function Ner(e){return Kt({queryKey:["user-purchases",e],queryFn:async()=>{if(!e)return[];const{data:t,error:s}=await Y.from("reward_store_purchases").select(` *, item:reward_store_items(*) `).eq("user_id",e).order("purchased_at",{ascending:!1});if(s)throw s;return t},enabled:!!e})}function Ser(){return Kt({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 s=[...new Set(e.map(l=>l.user_id))],{data:n,error:a}=await Y.from("profiles").select("id, name, email").in("id",s);if(a)throw a;const o=new Map((n==null?void 0:n.map(l=>[l.id,l]))||[]);return e.map(l=>({...l,user:o.get(l.user_id)||null}))}})}function Cer(e){return Kt({queryKey:["spendable-points",e],queryFn:async()=>{if(!e)return 0;const{data:t,error:s}=await Y.from("agent_attendance_stats").select("spendable_points").eq("user_id",e).single();if(s&&s.code!=="PGRST116")throw s;return(t==null?void 0:t.spendable_points)||0},enabled:!!e})}function Mer(){const e=Br();return ar({mutationFn:async t=>{const{data:s,error:n}=await Y.rpc("purchase_reward_item",{p_item_id:t});if(n)throw n;const a=s;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 Ter(){const e=Br();return ar({mutationFn:async t=>{const{data:s,error:n}=await Y.from("reward_store_categories").insert([t]).select().single();if(n)throw n;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-categories"]})}})}function Aer(){const e=Br();return ar({mutationFn:async({id:t,...s})=>{const{data:n,error:a}=await Y.from("reward_store_categories").update(s).eq("id",t).select().single();if(a)throw a;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-categories"]})}})}function Eer(){const e=Br();return ar({mutationFn:async t=>{const{error:s}=await Y.from("reward_store_categories").delete().eq("id",t);if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-categories"]})}})}function Ier(){const e=Br();return ar({mutationFn:async t=>{const{data:s,error:n}=await Y.from("reward_store_items").insert([t]).select().single();if(n)throw n;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-items"]}),e.invalidateQueries({queryKey:["active-reward-items"]})}})}function Per(){const e=Br();return ar({mutationFn:async({id:t,...s})=>{const{data:n,error:a}=await Y.from("reward_store_items").update(s).eq("id",t).select().single();if(a)throw a;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-items"]}),e.invalidateQueries({queryKey:["active-reward-items"]})}})}function Ler(){const e=Br();return ar({mutationFn:async t=>{const{error:s}=await Y.from("reward_store_items").delete().eq("id",t);if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-items"]}),e.invalidateQueries({queryKey:["active-reward-items"]})}})}function Oer(e){const t=e.match(/\/storage\/v1\/object\/public\/([^/]+)\/(.+)$/);return t?{bucket:t[1],path:t[2]}:null}async function _ue(e,t){const s=Oer(e);if(s)try{const{data:n,error:a}=await Y.storage.from(s.bucket).download(s.path);if(a){console.error("Error downloading file:",a),Te.error("Failed to download file");return}const o=URL.createObjectURL(n),l=document.createElement("a");l.href=o,l.download=t||s.path.split("/").pop()||"download",document.body.appendChild(l),l.click(),document.body.removeChild(l),setTimeout(()=>URL.revokeObjectURL(o),100)}catch(n){console.error("Download error:",n),Te.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(n){console.error("External download error:",n),Te.error("Failed to download file")}}function QVe(){return Kt({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 Der(){const e=Br();return ar({mutationFn:async({id:t,points:s,is_active:n})=>{const a={points:s};n!==void 0&&(a.is_active=n);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 Rer(){const{user:e}=Yr(),[t,s]=A.useState("items"),[n,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),[E,T]=A.useState(null),[P,R]=A.useState(""),[D,U]=A.useState(""),[q,H]=A.useState(null),[G,Q]=A.useState(""),[ne,ie]=A.useState("file"),[he,se]=A.useState(""),[fe,oe]=A.useState(""),[ce,de]=A.useState(""),[xe,Me]=A.useState(!0),[ve,be]=A.useState(null),[we,tt]=A.useState(!1),[Ae,Le]=A.useState(!1),Ue=A.useRef(null),Pe=A.useRef(null),{data:$e,isLoading:it}=XVe(),{data:xt,isLoading:Ee}=jer(),{data:et,isLoading:le}=Ser(),{data:Ve,isLoading:Je}=QVe(),rt=Ter(),je=Aer(),lt=Eer(),Ce=Ier(),Ie=Per(),Ze=Ler(),De=Der(),[Ke,st]=A.useState({}),dt=Ot=>{Ot?(l(Ot),u(Ot.name),x(Ot.description||""),v(Ot.icon||"")):(l(null),u(""),x(""),v("")),a(!0)},ct=async()=>{if(!i.trim()){Te.error("Please enter a category name");return}try{o?(await je.mutateAsync({id:o.id,name:i,description:m||null,icon:y||null}),Te.success("Category updated successfully")):(await rt.mutateAsync({name:i,description:m||null,icon:y||null,sort_order:(($e==null?void 0:$e.length)||0)+1}),Te.success("Category created successfully")),a(!1)}catch(Ot){console.error("Error saving category:",Ot),Te.error("Failed to save category")}},zt=async()=>{if(b)try{await lt.mutateAsync(b),Te.success("Category deleted successfully"),N(null)}catch(Ot){console.error("Error deleting category:",Ot),Te.error("Failed to delete category")}},ir=Ot=>{var Hr;Ot?(T(Ot),R(Ot.name),U(Ot.description||""),H(Ot.category_id),Q(Ot.points_cost.toString()),ie(Ot.item_type),se(Ot.file_url||""),oe(Ot.preview_image_url||""),de(((Hr=Ot.max_quantity)==null?void 0:Hr.toString())||""),Me(Ot.is_active)):(T(null),R(""),U(""),H(null),Q(""),ie("file"),se(""),oe(""),de(""),Me(!0)),M(!0)},Tr=async(Ot,Hr)=>{Hr==="file"?tt(!0):Le(!0);try{const Ts=Ot.name.split(".").pop(),zs=`${Date.now()}-${Math.random().toString(36).substring(7)}.${Ts}`,wa=`${Hr==="file"?"items":"previews"}/${zs}`,{error:gi}=await Y.storage.from("reward-store").upload(wa,Ot);if(gi)throw gi;const{data:{publicUrl:Ao}}=Y.storage.from("reward-store").getPublicUrl(wa);Hr==="file"?se(Ao):oe(Ao),Te.success("File uploaded successfully")}catch(Ts){console.error("Error uploading file:",Ts),Te.error("Failed to upload file")}finally{Hr==="file"?tt(!1):Le(!1)}},Zr=async()=>{if(!P.trim()){Te.error("Please enter an item name");return}if(!G||parseInt(G)<0){Te.error("Please enter a valid points cost");return}try{const Ot={name:P,description:D||null,category_id:q,points_cost:parseInt(G),item_type:ne,file_url:he||null,preview_image_url:fe||null,max_quantity:ce?parseInt(ce):null,current_quantity:ce?parseInt(ce):null,is_active:xe,created_by:e==null?void 0:e.id};E?(await Ie.mutateAsync({id:E.id,...Ot,current_quantity:E.max_quantity!==(ce?parseInt(ce):null)?ce?parseInt(ce):null:E.current_quantity}),Te.success("Item updated successfully")):(await Ce.mutateAsync(Ot),Te.success("Item created successfully")),M(!1)}catch(Ot){console.error("Error saving item:",Ot),Te.error("Failed to save item")}},$r=async()=>{if(ve)try{await Ze.mutateAsync(ve),Te.success("Item deleted successfully"),be(null)}catch(Ot){console.error("Error deleting item:",Ot),Te.error("Failed to delete item")}},ns=async(Ot,Hr)=>{const Ts=Ke[Ot];if(Ts===void 0||Ts===Hr.toString())return;const zs=parseInt(Ts);if(isNaN(zs)||zs<0){Te.error("Please enter a valid positive number");return}try{await De.mutateAsync({id:Ot,points:zs}),Te.success("Points updated successfully"),st(wa=>{const gi={...wa};return delete gi[Ot],gi})}catch(wa){console.error("Error updating points:",wa),Te.error("Failed to update points")}};return it||Ee||le||Je?r.jsx(Dr,{title:"Reward Store",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Cr,{className:"h-8 w-64"}),r.jsx(Cr,{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(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Vl,{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:(xt==null?void 0:xt.length)||0}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(xt==null?void 0:xt.filter(Ot=>Ot.is_active).length)||0," active"]})]})}),r.jsx(He,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(If,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Categories"})]}),r.jsx("p",{className:"text-2xl font-bold",children:($e==null?void 0:$e.length)||0})]})}),r.jsx(He,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Mn,{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:[xt&&xt.length>0?Math.round(xt.reduce((Ot,Hr)=>Ot+Hr.points_cost,0)/xt.length):0," pts"]})]})})]}),r.jsxs(Si,{value:t,onValueChange:s,children:[r.jsxs(ki,{children:[r.jsx(is,{value:"items",children:"Items"}),r.jsx(is,{value:"categories",children:"Categories"}),r.jsx(is,{value:"purchases",children:"Purchases"}),r.jsx(is,{value:"point-settings",children:"Point Settings"})]}),r.jsx(Ss,{value:"items",className:"mt-4",children:r.jsxs(He,{children:[r.jsxs(Vt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Gt,{children:"Store Items"}),r.jsx(Ns,{children:"Manage rewards that agents can purchase"})]}),r.jsxs(X,{onClick:()=>ir(),children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Add Item"]})]}),r.jsx(Xe,{children:!xt||xt.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(oo,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No items yet. Add your first reward item!"})]}):r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:xt.map(Ot=>r.jsxs(kr,{children:[r.jsx(gt,{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(oo,{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(gt,{children:Ot.category?r.jsx(Tt,{variant:"outline",children:Ot.category.name}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(gt,{className:"text-center",children:r.jsxs(Tt,{variant:"secondary",className:"font-bold",children:[r.jsx(Mn,{className:"h-3 w-3 mr-1"}),Ot.points_cost]})}),r.jsx(gt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[Ot.item_type==="file"?r.jsx(ga,{className:"h-4 w-4 text-muted-foreground"}):r.jsx(zo,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-xs capitalize",children:Ot.item_type})]})}),r.jsx(gt,{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(gt,{className:"text-center",children:r.jsx(Tt,{variant:Ot.is_active?"default":"secondary",children:Ot.is_active?"Active":"Inactive"})}),r.jsx(gt,{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:()=>be(Ot.id),children:r.jsx(Bs,{className:"h-4 w-4 text-destructive"})})]})})]},Ot.id))})]})})]})}),r.jsx(Ss,{value:"categories",className:"mt-4",children:r.jsxs(He,{children:[r.jsxs(Vt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Gt,{children:"Categories"}),r.jsx(Ns,{children:"Organize your store items into categories"})]}),r.jsxs(X,{onClick:()=>dt(),children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),r.jsx(Xe,{children:!$e||$e.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(If,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No categories yet. Add your first category!"})]}):r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:$e.map(Ot=>r.jsxs(kr,{children:[r.jsxs(gt,{className:"font-medium",children:[Ot.icon&&r.jsx("span",{className:"mr-2",children:Ot.icon}),Ot.name]}),r.jsx(gt,{className:"text-muted-foreground",children:Ot.description||"—"}),r.jsx(gt,{className:"text-center",children:(xt==null?void 0:xt.filter(Hr=>Hr.category_id===Ot.id).length)||0}),r.jsx(gt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>dt(Ot),children:r.jsx(Ja,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>N(Ot.id),children:r.jsx(Bs,{className:"h-4 w-4 text-destructive"})})]})})]},Ot.id))})]})})]})}),r.jsx(Ss,{value:"purchases",className:"mt-4",children:r.jsxs(He,{children:[r.jsxs(Vt,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Ih,{className:"h-5 w-5"}),"Purchase History"]}),r.jsx(Ns,{children:"View all reward redemptions by agents"})]}),r.jsx(Xe,{children:!et||et.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Ih,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No purchases yet."})]}):r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:et.map(Ot=>{var Hr,Ts,zs,wa;return r.jsxs(kr,{children:[r.jsx(gt,{className:"text-muted-foreground",children:rs(new Date(Ot.purchased_at),"MMM d, yyyy 'at' h:mm a")}),r.jsx(gt,{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(oc,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((Hr=Ot.user)==null?void 0:Hr.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:((Ts=Ot.user)==null?void 0:Ts.email)||"—"})]})]})}),r.jsx(gt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[(zs=Ot.item)!=null&&zs.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(oo,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{children:((wa=Ot.item)==null?void 0:wa.name)||"Deleted item"})]})}),r.jsx(gt,{className:"text-center",children:r.jsxs(Tt,{variant:"secondary",className:"font-bold",children:[r.jsx(Mn,{className:"h-3 w-3 mr-1"}),Ot.points_spent]})})]},Ot.id)})})]})})]})})]})]}),r.jsx(Or,{open:n,onOpenChange:a,children:r.jsxs(Pr,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:o?"Edit Category":"Add Category"}),r.jsx(Zs,{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(ot,{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(Ys,{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(ot,{id:"categoryIcon",value:y,onChange:Ot=>v(Ot.target.value),placeholder:"e.g., 📄, 🎁"})]})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(X,{onClick:ct,disabled:rt.isPending||je.isPending,children:rt.isPending||je.isPending?"Saving...":"Save"})]})]})}),r.jsx(Or,{open:k,onOpenChange:M,children:r.jsxs(Pr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:E?"Edit Item":"Add Item"}),r.jsx(Zs,{children:E?"Update the item details":"Create a new reward item for agents to purchase"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"itemName",children:"Name *"}),r.jsx(ot,{id:"itemName",value:P,onChange:Ot=>R(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(Ys,{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(us,{value:q||"none",onValueChange:Ot=>H(Ot==="none"?null:Ot),children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select category"})}),r.jsxs(ds,{children:[r.jsx($t,{value:"none",children:"No category"}),$e==null?void 0:$e.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(ot,{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(us,{value:ne,onValueChange:ie,children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsxs(ds,{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(ot,{id:"itemMaxQuantity",type:"number",min:"1",value:ce,onChange:Ot=>de(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(ot,{value:he,onChange:Ot=>se(Ot.target.value),placeholder:ne==="file"?"Upload a file or paste URL":"Paste external link"}),ne==="file"&&r.jsxs(r.Fragment,{children:[r.jsx(X,{type:"button",variant:"outline",size:"icon",onClick:()=>{var Ot;return(Ot=Ue.current)==null?void 0:Ot.click()},disabled:we,children:r.jsx(so,{className:"h-4 w-4"})}),r.jsx("input",{ref:Ue,type:"file",className:"hidden",onChange:Ot=>{var Ts;const Hr=(Ts=Ot.target.files)==null?void 0:Ts[0];Hr&&Tr(Hr,"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(ot,{value:fe,onChange:Ot=>oe(Ot.target.value),placeholder:"Upload an image or paste URL"}),r.jsx(X,{type:"button",variant:"outline",size:"icon",onClick:()=>{var Ot;return(Ot=Pe.current)==null?void 0:Ot.click()},disabled:Ae,children:r.jsx(El,{className:"h-4 w-4"})}),r.jsx("input",{ref:Pe,type:"file",accept:"image/*",className:"hidden",onChange:Ot=>{var Ts;const Hr=(Ts=Ot.target.files)==null?void 0:Ts[0];Hr&&Tr(Hr,"preview")}})]}),fe&&r.jsx("img",{src:fe,alt:"Preview",className:"mt-2 h-24 rounded object-cover"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(In,{id:"itemIsActive",checked:xe,onCheckedChange:Me}),r.jsx(ze,{htmlFor:"itemIsActive",children:"Active (visible to agents)"})]})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),r.jsx(X,{onClick:Zr,disabled:Ce.isPending||Ie.isPending,children:Ce.isPending||Ie.isPending?"Saving...":"Save"})]})]})}),r.jsx(Dd,{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(Vc,{onClick:zt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),r.jsx(Dd,{open:!!ve,onOpenChange:()=>be(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(Vc,{onClick:$r,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),t==="point-settings"&&r.jsxs(He,{className:"mt-4",children:[r.jsx(Vt,{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(Ns,{children:"Configure how many points agents earn for various actions. Adjust these values to run double-points promotions."})]})]})}),r.jsx(Xe,{children:!Ve||Ve.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(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{children:Ve.map(Ot=>r.jsxs(kr,{children:[r.jsx(gt,{children:r.jsx("p",{className:"font-medium",children:Ot.action_name})}),r.jsx(gt,{children:r.jsx("p",{className:"text-sm text-muted-foreground",children:Ot.description})}),r.jsx(gt,{className:"text-center",children:r.jsx(ot,{type:"number",min:"0",className:"w-20 mx-auto text-center",value:Ke[Ot.id]??Ot.points.toString(),onChange:Hr=>st(Ts=>({...Ts,[Ot.id]:Hr.target.value}))})}),r.jsx(gt,{className:"text-right",children:r.jsx(X,{size:"sm",variant:"outline",disabled:Ke[Ot.id]===void 0||Ke[Ot.id]===Ot.points.toString()||De.isPending,onClick:()=>ns(Ot.id,Ot.points),children:r.jsx(Lf,{className:"h-4 w-4"})})})]},Ot.id))})]})})]})]})}const CTe=()=>r.jsxs("svg",{viewBox:"0 0 100 100",className:"h-5 w-5",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("rect",{width:"100",height:"100",rx:"20",fill:"#7D2AE8"}),r.jsx("path",{d:"M50 20C33.43 20 20 33.43 20 50C20 66.57 33.43 80 50 80C66.57 80 80 66.57 80 50C80 33.43 66.57 20 50 20ZM63.5 63.5C58.3 68.7 50 70.6 43.1 67.6C36.2 64.6 32 57.6 32 50C32 42.4 36.2 35.4 43.1 32.4C50 29.4 58.3 31.3 63.5 36.5L59.3 40.7C55.8 37.2 50.7 35.8 46 37.3C41.3 38.8 37.7 42.8 36.6 47.6C35.5 52.4 37 57.4 40.4 60.8C43.8 64.2 48.8 65.7 53.6 64.6C58.4 63.5 62.4 59.9 63.9 55.2L68.7 56.7C66.9 61.3 65.5 61.5 63.5 63.5Z",fill:"white"})]}),MTe=[{value:"template",label:"Templates"},{value:"brand",label:"Brand Assets"},{value:"listing",label:"Listing Assets"},{value:"social",label:"Social Media"},{value:"general",label:"General"}];function Fer(){const e=Br(),[t,s]=A.useState(!1),[n,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}=Kt({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}=Kt({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}=Kt({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;s(!0);try{const{data:P}=await Y.auth.getSession(),R=(T=P==null?void 0:P.session)==null?void 0:T.access_token;if(!R)throw new Error("Not authenticated");const q=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/canva-oauth",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${R}`,apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJlbHplamlzd25vdGlramd2amh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE5NTAzNDQsImV4cCI6MjA3NzUyNjM0NH0.dzIkIr_oFSbFE3oWS0ktIr83iKHHkZxt40Gc7SpC_mM"},body:JSON.stringify({action:"get_auth_url"})}),H=await q.json();if(!q.ok||H!=null&&H.error)throw new Error((H==null?void 0:H.error)||"Failed to get authorization URL");if(H!=null&&H.authUrl){localStorage.setItem("canva_code_verifier",H.codeVerifier),localStorage.setItem("canva_oauth_state",H.state);const G=window.open(H.authUrl,"canva-oauth","width=600,height=700,scrollbars=yes,resizable=yes");if(!G){Te.error("Popup was blocked. Please allow popups for this site and try again."),s(!1);return}const Q=ie=>{var he,se;ie.origin===window.location.origin&&(((he=ie.data)==null?void 0:he.type)==="canva-oauth-success"?(window.removeEventListener("message",Q),Te.success("Canva connected successfully!"),e.invalidateQueries({queryKey:["canva-integration"]}),s(!1)):((se=ie.data)==null?void 0:se.type)==="canva-oauth-error"&&(window.removeEventListener("message",Q),Te.error("Canva connection failed: "+(ie.data.error||"Unknown error")),s(!1)))};window.addEventListener("message",Q);const ne=setInterval(()=>{G.closed&&(clearInterval(ne),window.removeEventListener("message",Q),e.invalidateQueries({queryKey:["canva-integration"]}),s(!1))},500)}else throw new Error("Failed to get authorization URL")}catch(P){console.error("Canva connect error:",P);const R=(P==null?void 0:P.message)||"";R.includes("CANVA_CLIENT_ID")?Te.error("Canva app credentials not configured yet."):Te.error(R||"Failed to start Canva connection"),s(!1)}},N=ar({mutationFn:async T=>{var G;const{data:P}=await Y.auth.getSession(),R=(G=P==null?void 0:P.session)==null?void 0:G.access_token;if(!R)throw new Error("Not authenticated");const q=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/canva-oauth",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${R}`,apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJlbHplamlzd25vdGlramd2amh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE5NTAzNDQsImV4cCI6MjA3NzUyNjM0NH0.dzIkIr_oFSbFE3oWS0ktIr83iKHHkZxt40Gc7SpC_mM"},body:JSON.stringify({action:"disconnect",integrationId:T})}),H=await q.json();if(!q.ok||H!=null&&H.error)throw new Error((H==null?void 0:H.error)||"Failed to disconnect")},onSuccess:()=>{e.invalidateQueries({queryKey:["canva-integration"]}),Te.success("Canva disconnected")},onError:T=>{Te.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"]}),Te.success("Folder added"),l(!1),u({brokerage_id:"",folder_id:"",folder_name:"",folder_type:"template",description:""})},onError:()=>Te.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"]}),Te.success("Folder removed")},onError:()=>Te.error("Failed to remove folder")}),E=!!m;return r.jsxs(r.Fragment,{children:[r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-10 w-10 rounded-lg bg-accent flex items-center justify-center",children:r.jsx(CTe,{})}),r.jsxs("div",{children:[r.jsxs(Gt,{className:"text-lg flex items-center gap-2",children:["Canva Connect",E&&r.jsx(Tt,{variant:"default",className:"text-xs",children:"Connected"}),r.jsx(Tt,{variant:"outline",className:"text-xs",children:"Admin Only"})]}),r.jsx(Ns,{children:"Auto-share brokerage asset folders with agents when they connect their Canva accounts."})]})]})})}),r.jsx(Xe,{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(ii,{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(ii,{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(ii,{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"})]}),E?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(Dd,{children:[r.jsx(Nf,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bs,{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(Vc,{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(!n),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(If,{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})]}),n?r.jsx(zg,{className:"h-4 w-4"}):r.jsx(gd,{className:"h-4 w-4"})]}),n&&r.jsxs("div",{className:"border-t p-3 space-y-2",children:[v&&v.length>0?v.map(T=>{var P,R;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=MTe.find(D=>D.value===T.folder_type))==null?void 0:P.label)||T.folder_type})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(R=T.brokerages)==null?void 0:R.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(en,{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(vs,{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(Go,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx("div",{className:"mr-2",children:r.jsx(CTe,{})}),"Connect Canva",r.jsx(to,{className:"h-4 w-4 ml-2"})]})]})})]}),r.jsx(Or,{open:o,onOpenChange:l,children:r.jsxs(Pr,{children:[r.jsx(zr,{children:r.jsx(Rr,{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(us,{value:i.brokerage_id,onValueChange:T=>u(P=>({...P,brokerage_id:T})),children:[r.jsx(cs,{children:r.jsx(ms,{placeholder:"Select a brokerage…"})}),r.jsx(ds,{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(ot,{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(ot,{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(us,{value:i.folder_type,onValueChange:T=>u(P=>({...P,folder_type:T})),children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsx(ds,{children:MTe.map(T=>r.jsx($t,{value:T.value,children:T.label},T.value))})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs(ze,{children:["Description ",r.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),r.jsx(ot,{placeholder:"What's in this folder?",value:i.description,onChange:T=>u(P=>({...P,description:T.target.value}))})]})]}),r.jsxs(zn,{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(Go,{className:"h-4 w-4 mr-2 animate-spin"}):null,"Add Folder"]})]})]})})]})}function zer(){return r.jsx(Dr,{children:r.jsxs("div",{className:"space-y-6 p-4 md:p-8",children:[r.jsx(Eu,{title:"Integrations",description:"Manage platform-level service connections"}),r.jsx(Fer,{})]})})}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 ET(e,t=18,s=10){return e.length<=t+s+3?e:`${e.slice(0,t)}…${e.slice(-s)}`}function $er(){var ne,ie,he,se,fe;const e=Br(),[t,s]=A.useState("Test Push"),[n,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:E,isLoading:T}=Kt({queryKey:["push-notification-settings"],queryFn:async()=>{const{data:oe,error:ce}=await Y.from("push_notification_settings").select("*").order("setting_key");if(ce)throw ce;return oe}}),{data:P,isLoading:R}=Kt({queryKey:["push-subscription-stats"],queryFn:async()=>{const{count:oe,error:ce}=await Y.from("push_subscriptions").select("*",{count:"exact",head:!0});if(ce)throw ce;return{totalSubscriptions:oe||0}}}),D=ar({mutationFn:async({settingKey:oe,isEnabled:ce})=>{const{error:de}=await Y.from("push_notification_settings").update({is_enabled:ce}).eq("setting_key",oe);if(de)throw de},onSuccess:()=>{e.invalidateQueries({queryKey:["push-notification-settings"]}),Te.success("Notification setting updated")},onError:oe=>{Te.error("Failed to update setting: "+oe.message)}}),U=A.useMemo(()=>{var oe,ce;return y.isSupported?`perm=${y.permission??"unknown"} · controller=${y.controllerPresent?"yes":"no"} · sw=${((oe=y.serviceWorker)==null?void 0:oe.activeState)??"unknown"} · sub=${(ce=y.subscription)!=null&&ce.endpoint?"yes":"no"}`:"Push not supported in this browser."},[y]);A.useEffect(()=>{let oe=!0;const ce=async()=>{var ve,be,we,tt,Ae,Le,Ue;const xe="serviceWorker"in navigator&&"PushManager"in window,Me={isSupported:xe,permission:typeof Notification<"u"?Notification.permission:void 0,controllerPresent:!!((ve=navigator.serviceWorker)!=null&&ve.controller)};if(!xe){oe&&v(Me);return}try{const{data:Pe,error:$e}=await Y.functions.invoke("get-vapid-public-key",{body:{}});if($e)throw $e;Me.vapidPublicKey=Pe==null?void 0:Pe.vapidPublicKey;const xt=(await navigator.serviceWorker.getRegistrations()).find(Ee=>{var le,Ve,Je;return(((le=Ee.active)==null?void 0:le.scriptURL)||((Ve=Ee.waiting)==null?void 0:Ve.scriptURL)||((Je=Ee.installing)==null?void 0:Je.scriptURL)||"").includes("/sw.js")});if(xt){Me.pushWorkerScriptUrl=((be=xt.active)==null?void 0:be.scriptURL)||((we=xt.waiting)==null?void 0:we.scriptURL)||((tt=xt.installing)==null?void 0:tt.scriptURL),Me.serviceWorker={scope:xt.scope,activeState:(Ae=xt.active)==null?void 0:Ae.state};const Ee=await xt.pushManager.getSubscription();if(Ee){const et=Ee.toJSON();Me.subscription={endpoint:et.endpoint,p256dh:(Le=et.keys)==null?void 0:Le.p256dh,auth:(Ue=et.keys)==null?void 0:Ue.auth}}}}catch(Pe){Me.error=(Pe==null?void 0:Pe.message)||String(Pe)}oe&&v(Me)};ce();const de=window.setInterval(ce,4e3);return()=>{oe=!1,window.clearInterval(de)}},[]);const q=async()=>{if(typeof Notification>"u"){Te.error("Notifications API not available in this browser.");return}try{if(Notification.permission!=="granted"&&await Notification.requestPermission()!=="granted"){Te.error("Notification permission not granted.");return}new Notification("Local notification test",{body:"If you see this, OS/browser notifications can display."}),Te.success("Triggered a local notification (not push).")}catch(oe){Te.error(`Local notification failed: ${(oe==null?void 0:oe.message)||String(oe)}`)}},H=async()=>{u(!0),N(null);try{const{data:oe,error:ce}=await Y.functions.invoke("send-push-notification",{body:{title:t,body:n,url:o}});if(ce)throw ce;N({sent:oe==null?void 0:oe.sent,failed:oe==null?void 0:oe.failed,expiredCleaned:oe==null?void 0:oe.expiredCleaned,vapidPublicKey:oe==null?void 0:oe.vapidPublicKey}),(oe==null?void 0:oe.sent)>0?Te.success(`Test notification sent to ${oe.sent} subscriber(s)`):(oe==null?void 0:oe.failed)>0?Te.warning(`Notification failed for ${oe.failed} subscriber(s). ${oe.expired||0} expired subscriptions cleaned up.`):Te.info("No active subscriptions to send to")}catch(oe){console.error("Error sending test notification:",oe),N({error:(oe==null?void 0:oe.message)||String(oe)}),Te.error("Failed to send test notification: "+(oe.message||"Unknown error"))}finally{u(!1)}},G=async()=>{x(!0),M(null);try{const{data:oe,error:ce}=await Y.functions.invoke("generate-vapid-keys",{body:{}});if(ce)throw ce;const de=oe==null?void 0:oe.publicKey,xe=oe==null?void 0:oe.privateKey;if(!de||!xe)throw new Error("generate-vapid-keys did not return keys");M({publicKey:de,privateKey:xe}),Te.success("Generated new VAPID keys. Update backend secrets, then clear + re-subscribe.")}catch(oe){console.error("Error generating VAPID keys:",oe),Te.error("Failed to generate VAPID keys: "+((oe==null?void 0:oe.message)||"Unknown error"))}finally{x(!1)}},Q=ar({mutationFn:async()=>{const{error:oe}=await Y.from("push_subscriptions").delete().neq("id","00000000-0000-0000-0000-000000000000");if(oe)throw oe},onSuccess:()=>{Te.success("All subscriptions cleared. Users will need to re-enable notifications."),e.invalidateQueries({queryKey:["push-subscription-stats"]})},onError:oe=>{Te.error("Failed to clear subscriptions: "+oe.message)}});return r.jsx(Dr,{title:"Notification Settings",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Eu,{title:"Notification Settings",description:"Manage push notifications and test the notification system"}),r.jsxs(He,{children:[r.jsxs(Vt,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(qs,{className:"h-5 w-5"}),"Push Notification Subscribers"]}),r.jsx(Ns,{children:"Current active push notification subscriptions"})]}),r.jsx(Xe,{children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"text-4xl font-bold",children:R?"...":(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(Vt,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Bd,{className:"h-5 w-5"}),"Notification Types"]}),r.jsx(Ns,{children:"Control which types of push notifications are sent to users"})]}),r.jsx(Xe,{children:T?r.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading settings..."}):r.jsx("div",{className:"space-y-4",children:E==null?void 0:E.map(oe=>{const ce=Ber[oe.setting_key]||{label:oe.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:ce.icon}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:ce.label}),r.jsx("div",{className:"text-sm text-muted-foreground",children:oe.description})]})]}),r.jsx(In,{checked:oe.is_enabled,onCheckedChange:de=>D.mutate({settingKey:oe.setting_key,isEnabled:de}),disabled:D.isPending})]},oe.id)})})})]}),r.jsxs(He,{children:[r.jsxs(Vt,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Rg,{className:"h-5 w-5"}),"Send Test Notification"]}),r.jsx(Ns,{children:"Send a test push notification to all subscribed users"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 text-sm",children:[r.jsx("div",{className:"font-medium",children:"Client push debug"}),r.jsx("div",{className:"mt-1 text-muted-foreground",children: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?ET(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: ",(ne=y.serviceWorker)!=null&&ne.scope?ET(y.serviceWorker.scope,24,8):"none"]}),r.jsxs("div",{children:["active: ",((ie=y.serviceWorker)==null?void 0:ie.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: ",(he=y.subscription)!=null&&he.endpoint?ET(y.subscription.endpoint,40,12):"none"]}),r.jsxs("div",{children:["p256dh: ",(se=y.subscription)!=null&&se.p256dh?ET(y.subscription.p256dh,22,10):"none"]}),r.jsxs("div",{children:["auth: ",(fe=y.subscription)!=null&&fe.auth?ET(y.subscription.auth,22,10):"none"]})]})]})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[r.jsx(X,{variant:"outline",onClick:q,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(ot,{id:"test-title",value:t,onChange:oe=>s(oe.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(Ys,{id:"test-body",value:n,onChange:oe=>a(oe.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(ot,{id:"test-url",value:o,onChange:oe=>l(oe.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:H,disabled:i||!t||!n,className:"w-full sm:w-auto",children:[r.jsx(ro,{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(Vt,{children:[r.jsxs(Gt,{className:"flex items-center gap-2 text-destructive",children:[r.jsx(Bs,{className:"h-5 w-5"}),"Subscription Maintenance"]}),r.jsx(Ns,{children:"Clear all push subscriptions if VAPID keys were changed or subscriptions are invalid"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"If you've recently updated the VAPID keys, existing subscriptions will no longer work. Use this to clear all subscriptions so users can re-subscribe with the new keys."}),r.jsxs(X,{variant:"destructive",onClick:()=>Q.mutate(),disabled:Q.isPending,children:[r.jsx(Bs,{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 Uer(){const{toast:e}=ci(),[t,s]=A.useState([]),[n,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 E=N.get(M.owner_user_id);return{owner_user_id:M.owner_user_id,name:(E==null?void 0:E.name)||"Unknown",email:(E==null?void 0:E.email)||"",avatar_url:(E==null?void 0:E.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,E)=>E.presentation_count-M.presentation_count),s(k),a({totalPresentations:k.reduce((M,E)=>M+E.presentation_count,0),totalViews:k.reduce((M,E)=>M+E.total_views,0),totalLeads:k.reduce((M,E)=>M+E.total_leads,0),totalCtaClicks:k.reduce((M,E)=>M+E.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:n.agentsUsing,icon:qs,color:"text-blue-600"},{label:"Total Presentations",value:n.totalPresentations,icon:gy,color:"text-violet-600"},{label:"Total Views",value:n.totalViews,icon:mo,color:"text-emerald-600"},{label:"Total Leads",value:n.totalLeads,icon:wu,color:"text-amber-600"},{label:"CTA Clicks",value:n.totalCtaClicks,icon:X1,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(Vt,{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(Xe,{children:o?r.jsx(Cr,{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(Vt,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(bu,{className:"h-5 w-5"}),"Agent Breakdown"]})}),r.jsx(Xe,{children:o?r.jsx("div",{className:"space-y-3",children:[...Array(5)].map((m,x)=>r.jsx(Cr,{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(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{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(On,{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(kr,{children:[r.jsx(gt,{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(gt,{className:"text-center font-medium",children:m.presentation_count}),r.jsx(gt,{className:"text-center",children:m.total_views.toLocaleString()}),r.jsx(gt,{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(gt,{className:"text-center",children:m.total_cta_clicks}),r.jsx(gt,{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 qer(){const{toast:e}=ci(),[t,s]=A.useState([]),[n,a]=A.useState({totalOpenHouses:0,totalVisitors:0,totalLeads:0,activeOpenHouses: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_guest_book_stats");if(x)throw x;if(!m||m.length===0){l(!1);return}const y=m.map(M=>M.agent_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 E=N.get(M.agent_id);return{agent_id:M.agent_id,name:(E==null?void 0:E.name)||"Unknown",email:(E==null?void 0:E.email)||"",avatar_url:(E==null?void 0:E.avatar_url)||null,open_house_count:Number(M.open_house_count),total_visitors:Number(M.total_visitors),total_leads:Number(M.total_leads),active_count:Number(M.active_count)}});k.sort((M,E)=>E.total_visitors-M.total_visitors),s(k),a({totalOpenHouses:k.reduce((M,E)=>M+E.open_house_count,0),totalVisitors:k.reduce((M,E)=>M+E.total_visitors,0),totalLeads:k.reduce((M,E)=>M+E.total_leads,0),activeOpenHouses:k.reduce((M,E)=>M+E.active_count,0),agentsUsing:k.length})}catch(m){console.error("Error loading guest book stats:",m),e({title:"Error",description:"Failed to load guest book analytics",variant:"destructive"})}finally{l(!1)}},u=[{label:"Agents Using",value:n.agentsUsing,icon:qs,color:"text-blue-600"},{label:"Total Open Houses",value:n.totalOpenHouses,icon:sa,color:"text-violet-600"},{label:"Active Now",value:n.activeOpenHouses,icon:ii,color:"text-emerald-600"},{label:"Total Visitors",value:n.totalVisitors,icon:mo,color:"text-amber-600"},{label:"Leads Created",value:n.totalLeads,icon:wu,color:"text-rose-600"}];return r.jsx(Dr,{title:"Guest Book 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:"Guest Book Analytics"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Track open house sign-in usage and lead generation 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(Vt,{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(Xe,{children:o?r.jsx(Cr,{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(Vt,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(bu,{className:"h-5 w-5"}),"Agent Breakdown"]})}),r.jsx(Xe,{children:o?r.jsx("div",{className:"space-y-3",children:[...Array(5)].map((m,x)=>r.jsx(Cr,{className:"h-12 w-full"},x))}):t.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No open houses created yet."}):r.jsxs(Pn,{children:[r.jsx(Ln,{children:r.jsxs(kr,{children:[r.jsx(Mt,{children:"Agent"}),r.jsx(Mt,{className:"text-center",children:"Open Houses"}),r.jsx(Mt,{className:"text-center",children:"Active"}),r.jsx(Mt,{className:"text-center",children:"Visitors"}),r.jsx(Mt,{className:"text-center",children:"Leads"}),r.jsx(Mt,{className:"text-center",children:"Conversion"})]})}),r.jsx(On,{children:t.map(m=>{var y,v;const x=m.total_visitors>0?(m.total_leads/m.total_visitors*100).toFixed(1):"0.0";return r.jsxs(kr,{children:[r.jsx(gt,{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(gt,{className:"text-center font-medium",children:m.open_house_count}),r.jsx(gt,{className:"text-center",children:m.active_count>0?r.jsx(Tt,{variant:"secondary",className:"bg-emerald-100 text-emerald-700",children:m.active_count}):r.jsx("span",{className:"text-muted-foreground",children:"0"})}),r.jsx(gt,{className:"text-center",children:m.total_visitors.toLocaleString()}),r.jsx(gt,{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(gt,{className:"text-center",children:r.jsxs("span",{className:Number(x)>0?"text-emerald-600 font-medium":"text-muted-foreground",children:[x,"%"]})})]},m.agent_id)})})]})})]})]})})}function Ver(){const[e]=Ic(),t=Hs(),[s,n]=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){n("error"),o(m||"Authorization was denied"),Te.error("Failed to connect: "+(m||u));return}if(!i){n("error"),o("No authorization code received"),Te.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)n("success"),o(y.message||"Accounts connected successfully!"),Te.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),n("error"),o(y.message||"Failed to complete connection"),Te.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(Vt,{className:"text-center",children:[r.jsxs("div",{className:"mx-auto mb-4",children:[s==="loading"&&r.jsx(Vr,{className:"h-12 w-12 animate-spin text-primary"}),s==="success"&&r.jsx(ii,{className:"h-12 w-12 text-green-500"}),s==="error"&&r.jsx(jc,{className:"h-12 w-12 text-destructive"})]}),r.jsxs(Gt,{children:[s==="loading"&&"Connecting...",s==="success"&&"Connected!",s==="error"&&"Connection Failed"]}),r.jsx(Ns,{children:a})]}),r.jsx(Xe,{className:"flex justify-center",children:r.jsx(X,{onClick:()=>t("/admin/integrations"),children:s==="success"?"View Integrations":"Back to Integrations"})})]})})}function Her(){const e=Hs(),t=Br(),{isAdmin:s}=Yr(),[n,a]=A.useState(!1),[o,l]=A.useState(null),[i,u]=A.useState(null),{data:m,isLoading:x}=Kt({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:q,error:H}=await Y.from("social_accounts").select("*").eq("user_id",D.id).order("created_at",{ascending:!1});if(H)throw H;return q}}),y=ar({mutationFn:async D=>{const{data:{user:U},error:q}=await Y.auth.getUser();if(q)throw q;if(!U)throw new Error("Not authenticated");const{error:H}=await Y.from("social_accounts").delete().eq("id",D).eq("user_id",U.id);if(H)throw H},onSuccess:()=>{t.invalidateQueries({queryKey:["my-social-accounts"]}),t.invalidateQueries({queryKey:["social-accounts-for-post"]}),Te.success("Account disconnected successfully")},onError:()=>{Te.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),Te.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),Te.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),Te.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"))||[],E=(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,R=async(D,U)=>{l(D),u(null);try{const{data:q,error:H}=await Y.functions.invoke("meta-api-test",{body:{testType:"all",accountId:D}});if(H)throw H;u(q.results||[]),Te.success(q.summary||"API tests completed")}catch(q){console.error("Meta API test error:",q),Te.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(Bn,{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"]}),!s&&r.jsx(He,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-800",children:r.jsxs(Xe,{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx("div",{className:"rounded-full bg-amber-100 dark:bg-amber-900/30 p-4 mb-4",children:r.jsx(Ra,{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."})]})}),s&&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(Xe,{className:"flex items-center gap-4 p-4",children:[r.jsx("div",{className:"rounded-full bg-green-500 p-2",children:r.jsx(ii,{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(Vt,{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(Ns,{children:"Connect your Facebook Pages"})]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Go,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):k.length>0?r.jsx("div",{className:"space-y-3",children:k.map(D=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Xn,{className:"h-10 w-10",children:[r.jsx(ji,{src:D.profile_picture_url||""}),r.jsx(Qn,{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(Dd,{children:[r.jsx(Nf,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bs,{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(Vc,{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:n,className:"w-full gap-2",variant:k.length>0?"outline":"default",children:[n?r.jsx(Go,{className:"h-4 w-4 animate-spin"}):r.jsx(vs,{className:"h-4 w-4"}),k.length>0?"Connect Another Page":"Connect Facebook Page"]})]})]}),r.jsxs(He,{children:[r.jsx(Vt,{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(Ns,{children:"Connect Instagram Business accounts"})]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Go,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):M.length>0?r.jsx("div",{className:"space-y-3",children:M.map(D=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Xn,{className:"h-10 w-10",children:[r.jsx(ji,{src:D.profile_picture_url||""}),r.jsx(Qn,{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(Dd,{children:[r.jsx(Nf,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bs,{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(Vc,{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:n,className:"w-full gap-2",variant:M.length>0?"outline":"default",children:[n?r.jsx(Go,{className:"h-4 w-4 animate-spin"}):r.jsx(vs,{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(Vt,{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(vm,{className:"h-6 w-6 text-blue-700"})}),r.jsxs("div",{children:[r.jsx(Gt,{className:"text-lg",children:"LinkedIn"}),r.jsx(Ns,{children:"Connect your LinkedIn profile"})]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Go,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):E.length>0?r.jsx("div",{className:"space-y-3",children:E.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(Xn,{className:"h-10 w-10",children:[r.jsx(ji,{src:D.profile_picture_url||""}),r.jsx(Qn,{children:r.jsx(vm,{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(Dd,{children:[r.jsx(Nf,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bs,{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(Vc,{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:n,className:"w-full gap-2",variant:E.length>0?"outline":"default",children:[n?r.jsx(Go,{className:"h-4 w-4 animate-spin"}):r.jsx(vs,{className:"h-4 w-4"}),E.length>0?"Reconnect LinkedIn":"Connect LinkedIn"]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Share content directly to your LinkedIn profile"})]})]}),r.jsxs(He,{className:`relative overflow-hidden ${s?"":"opacity-75"}`,children:[!s&&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"})}),s&&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(Vt,{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(po,{className:"h-6 w-6 text-red-600"})}),r.jsxs("div",{children:[r.jsx(Gt,{className:"text-lg",children:"Google Business"}),r.jsx(Ns,{children:"Connect your Google Business Profile"})]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Go,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):T.length>0?r.jsx("div",{className:"space-y-3",children:T.map(D=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Xn,{className:"h-10 w-10",children:[r.jsx(ji,{src:D.profile_picture_url||""}),r.jsx(Qn,{children:r.jsx(po,{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(Dd,{children:[r.jsx(Nf,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bs,{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(Vc,{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:s?"No Google Business account connected yet":"Google Business Profile integration is coming soon!"}),r.jsxs(X,{onClick:s?N:void 0,disabled:!s||n,className:"w-full gap-2",variant:T.length>0?"outline":"default",children:[n?r.jsx(Go,{className:"h-4 w-4 animate-spin"}):r.jsx(vs,{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"})]})]})]}),s&&(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(Vt,{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(Rj,{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(Ns,{children:"Run API tests to trigger all required permissions for Meta App Review"})]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("p",{className:"text-sm text-muted-foreground",children:['Click "Run Tests" on an account to trigger API calls for: ',r.jsx("strong",{children:"public_profile"}),", ",r.jsx("strong",{children:"pages_show_list"}),", ",r.jsx("strong",{children:"pages_read_engagement"}),", ",r.jsx("strong",{children:"instagram_basic"}),", ",r.jsx("strong",{children:"pages_manage_posts"}),", and ",r.jsx("strong",{children:"instagram_content_publish"}),"."]}),r.jsxs("div",{className:"space-y-3",children:[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:()=>R(D.id),disabled:o===D.id,children:o===D.id?r.jsxs(r.Fragment,{children:[r.jsx(Vr,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Rj,{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:()=>R(D.id),disabled:o===D.id,children:o===D.id?r.jsxs(r.Fragment,{children:[r.jsx(Vr,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Rj,{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(Ki,{className:"h-4 w-4 text-green-600 mt-0.5 shrink-0"}):D.status==="pending"?r.jsx(Vr,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}):r.jsx(jc,{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(Vt,{children:r.jsx(Gt,{className:"text-lg",children:"How it works"})}),r.jsx(Xe,{children:r.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-medium",children:"1"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Connect your accounts"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Link your Facebook, Instagram, or LinkedIn account"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-medium",children:"2"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Browse Social Swag"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Find the perfect image and caption for your post"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-medium",children:"3"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Post with one click"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:'Click "Create Post" to share directly to your accounts'})]})]})]})})]})]})]})})}function Wer(){const[e]=Ic(),t=Hs(),[s,n]=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){n("error"),o(m||"Authorization was denied"),Te.error("Connection failed: "+(m||u));return}if(!i){n("error"),o("No authorization code received"),Te.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)n("success"),o(`Successfully connected ${((y=v.accounts)==null?void 0:y.length)||0} account(s)!`),Te.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),n("error"),o(v instanceof Error?v.message:"Failed to connect accounts"),Te.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(Vt,{className:"text-center",children:[s==="loading"&&r.jsx(Vr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),s==="success"&&r.jsx(ii,{className:"h-12 w-12 mx-auto text-green-500"}),s==="error"&&r.jsx(jc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Gt,{className:"mt-4",children:[s==="loading"&&"Connecting...",s==="success"&&"Connected!",s==="error"&&"Connection Failed"]}),r.jsx(Ns,{children:a})]}),r.jsx(Xe,{className:"flex justify-center",children:s!=="loading"&&r.jsx(X,{onClick:()=>t("/mission-control/integrations"),children:s==="success"?"View Connected Accounts":"Try Again"})})]})})}function Ger(){const[e]=Ic(),t=Hs(),[s,n]=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){n("error"),o(m||"Authorization was denied"),Te.error("Connection failed: "+(m||u));return}if(!i){n("error"),o("No authorization code received"),Te.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)n("success"),o(y.message||"Successfully connected Google Business Profile!"),Te.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),n("error"),o(y instanceof Error?y.message:"Failed to connect Google Business Profile"),Te.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(Vt,{className:"text-center",children:[s==="loading"&&r.jsx(Vr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),s==="success"&&r.jsx(ii,{className:"h-12 w-12 mx-auto text-green-500"}),s==="error"&&r.jsx(jc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Gt,{className:"mt-4",children:[s==="loading"&&"Connecting...",s==="success"&&"Connected!",s==="error"&&"Connection Failed"]}),r.jsx(Ns,{children:a})]}),r.jsx(Xe,{className:"flex justify-center",children:s!=="loading"&&r.jsx(X,{onClick:()=>t("/social-connections"),children:s==="success"?"View Connected Accounts":"Try Again"})})]})})}function Ker(){const[e]=Ic(),t=Hs(),[s,n]=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),n("error"),o(x||"Failed to connect LinkedIn account"),Te.error(x||"Failed to connect LinkedIn");return}if(!i){n("error"),o("No authorization code received"),Te.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)n("success"),o(`Successfully connected ${((y=v.accounts)==null?void 0:y.length)||1} LinkedIn account`),Te.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),n("error"),o(v instanceof Error?v.message:"Failed to connect LinkedIn account"),Te.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(Vt,{className:"text-center",children:[r.jsxs("div",{className:"mx-auto mb-4 rounded-full bg-blue-600/10 p-4 w-fit",children:[s==="loading"&&r.jsx(Vr,{className:"h-8 w-8 animate-spin text-blue-600"}),s==="success"&&r.jsx(ii,{className:"h-8 w-8 text-green-600"}),s==="error"&&r.jsx(jc,{className:"h-8 w-8 text-red-600"})]}),r.jsxs(Gt,{className:"flex items-center justify-center gap-2",children:[r.jsx(vm,{className:"h-5 w-5 text-blue-600"}),s==="loading"&&"Connecting...",s==="success"&&"Connected!",s==="error"&&"Connection Failed"]}),r.jsx(Ns,{children:a})]}),r.jsx(Xe,{className:"flex justify-center",children:r.jsx(X,{onClick:()=>t("/social-connections"),disabled:s==="loading",children:s==="success"?"Continue":"Back to Connections"})})]})})}function Zer(){const e=Hs(),[t,s]=A.useState(null),{data:n,isLoading:a}=YVe(t||void 0,!0),{data:o,isLoading:l}=uve(!0),{cartItems:i}=dae(),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(Cr,{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(Cr,{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(Ih,{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:()=>s(null),children:"All"}),o.map(x=>r.jsx(X,{variant:t===x.id?"default":"outline",size:"sm",onClick:()=>s(x.id),children:x.name},x.id))]}),n&&n.length>0?r.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:n.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(Vl,{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(Xe,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold mb-1 line-clamp-1",children:x.name}),x.description&&r.jsx("p",{className:"text-sm text-muted-foreground mb-2 line-clamp-2",children:x.description}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"font-bold text-lg",children:["$",Number(x.base_price).toFixed(2)]}),x.variants&&x.variants.length>0&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:[x.variants.length," options"]})]})]})]},x.id)})}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Vl,{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 JVe=A.forwardRef(({...e},t)=>r.jsx("nav",{ref:t,"aria-label":"breadcrumb",...e}));JVe.displayName="Breadcrumb";const eHe=A.forwardRef(({className:e,...t},s)=>r.jsx("ol",{ref:s,className:Ut("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...t}));eHe.displayName="BreadcrumbList";const ste=A.forwardRef(({className:e,...t},s)=>r.jsx("li",{ref:s,className:Ut("inline-flex items-center gap-1.5",e),...t}));ste.displayName="BreadcrumbItem";const nge=A.forwardRef(({asChild:e,className:t,...s},n)=>{const a=e?sxe:"a";return r.jsx(a,{ref:n,className:Ut("transition-colors hover:text-foreground",t),...s})});nge.displayName="BreadcrumbLink";const tHe=A.forwardRef(({className:e,...t},s)=>r.jsx("span",{ref:s,role:"link","aria-disabled":"true","aria-current":"page",className:Ut("font-normal text-foreground",e),...t}));tHe.displayName="BreadcrumbPage";const age=({children:e,className:t,...s})=>r.jsx("li",{role:"presentation","aria-hidden":"true",className:Ut("[&>svg]:size-3.5",t),...s,children:e??r.jsx(Zi,{})});age.displayName="BreadcrumbSeparator";function Yer(){var he,se;const{productId:e}=hc(),t=Hs(),{data:s,isLoading:n}=ter(e||""),{addToCart:a,cartItems:o}=dae(),[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,E]=A.useState(!1),T=(he=s==null?void 0:s.variants)==null?void 0:he.find(fe=>fe.id===l),P=((se=s==null?void 0:s.variants)==null?void 0:se.filter(fe=>fe.is_active))||[],R=Number((s==null?void 0:s.base_price)||0),D=T?Number(T.price_adjustment):0,U=R+D,q=Number((s==null?void 0:s.shipping_fee)||0),H=o.reduce((fe,oe)=>fe+oe.quantity,0),G=async fe=>{if(!fe.target.files||fe.target.files.length===0)return;k(!0);const oe=fe.target.files[0],ce=oe.name.split(".").pop(),de=`artwork/${Date.now()}-${Math.random().toString(36).substring(7)}.${ce}`;try{const{error:xe}=await Y.storage.from("marketplace").upload(de,oe);if(xe)throw xe;const{data:{publicUrl:Me}}=Y.storage.from("marketplace").getPublicUrl(de);b(Me),Te.success("Artwork uploaded successfully")}catch(xe){Te.error("Failed to upload artwork: "+xe.message)}finally{k(!1)}},Q=()=>{if(s){if(P.length>0&&!l){Te.error("Please select an option");return}a(s,T||void 0,u,v||void 0),E(!0),Te.success("Added to cart!"),setTimeout(()=>E(!1),2e3)}},ne=()=>{s!=null&&s.images&&y(fe=>(fe+1)%s.images.length)},ie=()=>{s!=null&&s.images&&y(fe=>(fe-1+s.images.length)%s.images.length)};return n?r.jsx(Dr,{title:"Product",children:r.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[r.jsx(Cr,{className:"aspect-square w-full"}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(Cr,{className:"h-8 w-3/4"}),r.jsx(Cr,{className:"h-6 w-1/4"}),r.jsx(Cr,{className:"h-24 w-full"}),r.jsx(Cr,{className:"h-12 w-full"})]})]})}):s?r.jsxs(Dr,{title:s.name,children:[r.jsx(JVe,{className:"mb-6",children:r.jsxs(eHe,{children:[r.jsx(ste,{children:r.jsx(nge,{asChild:!0,children:r.jsx(ho,{to:"/marketplace",children:"Marketplace"})})}),s.category&&r.jsxs(r.Fragment,{children:[r.jsx(age,{}),r.jsx(ste,{children:r.jsx(nge,{asChild:!0,children:r.jsx(ho,{to:`/marketplace?category=${s.category.id}`,children:s.category.name})})})]}),r.jsx(age,{}),r.jsx(ste,{children:r.jsx(tHe,{children:s.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:s.images&&s.images.length>0?r.jsxs(r.Fragment,{children:[r.jsx("img",{src:s.images[x].image_url,alt:s.name,className:"max-w-full max-h-full object-contain"}),s.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:ie,children:r.jsx(Sc,{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:ne,children:r.jsx(Zi,{className:"h-6 w-6"})})]})]}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(Vl,{className:"h-24 w-24 text-muted-foreground"})})}),s.images&&s.images.length>1&&r.jsx("div",{className:"flex gap-2 overflow-x-auto pb-2",children:s.images.map((fe,oe)=>r.jsx("button",{onClick:()=>y(oe),className:`w-16 h-16 flex-shrink-0 rounded-md overflow-hidden border-2 ${oe===x?"border-primary":"border-transparent"}`,children:r.jsx("img",{src:fe.image_url,alt:"",className:"w-full h-full object-cover"})},fe.id))}),s.video&&r.jsx(He,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx("h4",{className:"font-medium mb-2",children:"Product Video"}),r.jsx("div",{className:"aspect-video",children:r.jsx("iframe",{src:s.video.video_url,className:"w-full h-full rounded-lg",allowFullScreen:!0})})]})})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[s.category&&r.jsx(Tt,{variant:"secondary",className:"mb-2",children:s.category.name}),r.jsx("h1",{className:"text-3xl font-bold mb-2",children:s.name}),r.jsxs("div",{className:"flex items-baseline gap-2",children:[r.jsxs("span",{className:"text-3xl font-bold",children:["$",U.toFixed(2)]}),q>0&&r.jsxs("span",{className:"text-muted-foreground",children:["+ $",q.toFixed(2)," shipping"]})]})]}),s.description&&r.jsx("div",{className:"prose prose-sm max-w-none",children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:s.description})}),P.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsx(ze,{children:"Select Option"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:P.map(fe=>r.jsxs(X,{variant:l===fe.id?"default":"outline",onClick:()=>i(fe.id),children:[fe.name,Number(fe.price_adjustment)!==0&&r.jsxs("span",{className:"ml-1 opacity-70",children:["(",Number(fe.price_adjustment)>0?"+":"","$",Number(fe.price_adjustment).toFixed(2),")"]})]},fe.id))})]}),s.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(so,{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(fe=>Math.max(1,fe-1)),children:"-"}),r.jsx(ot,{type:"number",value:u,onChange:fe=>m(Math.max(1,parseInt(fe.target.value)||1)),className:"w-20 text-center",min:"1"}),r.jsx(X,{variant:"outline",size:"icon",onClick:()=>m(fe=>fe+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(Ih,{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(Ih,{className:"h-5 w-5"}),H>0&&r.jsx(Tt,{className:"absolute -top-2 -right-2 h-5 w-5 flex items-center justify-center p-0 text-xs",children:H})]})]}),s.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(Vl,{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 Xer(){const e=Hs(),{cartItems:t,removeFromCart:s,updateQuantity:n,getItemPrice:a,getSubtotal:o,getShippingTotal:l,getTotal:i,clearCart:u}=dae(),[m,x]=A.useState(!1),[y,v]=A.useState(""),b=async()=>{if(t.length===0){Te.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 E;return{product_id:M.product.id,variant_id:((E=M.variant)==null?void 0:E.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){Te.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(Ug,{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(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex gap-4",children:[r.jsx("div",{className:"w-24 h-24 flex-shrink-0 bg-muted rounded-lg overflow-hidden",children:N.product.images&&N.product.images.length>0?r.jsx("img",{src:((k=N.product.images.find(E=>E.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(Ug,{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 E;return s(N.product.id,(E=N.variant)==null?void 0:E.id)},children:r.jsx(Bs,{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 E;return n(N.product.id,(E=N.variant)==null?void 0:E.id,N.quantity-1)},disabled:N.quantity<=1,children:r.jsx(Y1,{className:"h-3 w-3"})}),r.jsx(ot,{type:"number",value:N.quantity,onChange:E=>{var T;return n(N.product.id,(T=N.variant)==null?void 0:T.id,parseInt(E.target.value)||1)},className:"w-14 h-8 text-center text-sm",min:"1"}),r.jsx(X,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>{var E;return n(N.product.id,(E=N.variant)==null?void 0:E.id,N.quantity+1)},children:r.jsx(vs,{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(Vt,{children:r.jsx(Gt,{children:"Order Summary"})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsxs("span",{children:["Subtotal (",t.reduce((N,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(pd,{}),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(pd,{}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"orderNotes",children:"Order Notes (Optional)"}),r.jsx(Ys,{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(Vr,{className:"h-5 w-5 mr-2 animate-spin"}),"Processing..."]}):r.jsxs(r.Fragment,{children:["Checkout",r.jsx(to,{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 Qer(){const e=Hs(),{data:t,isLoading:s}=her();return s?r.jsx(Dr,{title:"My Orders",children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(n=>r.jsx(Cr,{className:"h-32 w-full"},n))})}):!t||t.length===0?r.jsx(Dr,{title:"My Orders",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Vl,{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(n=>{var a,o,l;return r.jsx(He,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>e(`/marketplace/orders/${n.id}`),children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-semibold",children:n.order_number}),r.jsx("span",{className:"text-muted-foreground text-sm ml-2",children:rs(new Date(n.created_at),"MMM d, yyyy")})]}),r.jsx(Tt,{className:dve[n.status],children:dC[n.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=n.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)),n.items&&n.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:["+",n.items.length-3]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm",children:((o=n.items)==null?void 0:o.length)===1?n.items[0].product_name:`${(l=n.items)==null?void 0:l.length} items`}),r.jsxs("p",{className:"font-semibold",children:["$",Number(n.total).toFixed(2)]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[n.tracking_url&&r.jsxs(X,{variant:"outline",size:"sm",onClick:i=>{i.stopPropagation(),window.open(n.tracking_url,"_blank")},children:[r.jsx(Sn,{className:"h-4 w-4 mr-1"}),"Track"]}),r.jsx(Zi,{className:"h-5 w-5 text-muted-foreground"})]})]})]})},n.id)})})})}const TTe=["order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed"];function Jer({currentStatus:e,statusHistory:t}){const s=TTe.indexOf(e);return r.jsx("div",{className:"space-y-3",children:TTe.map((n,a)=>{const o=t==null?void 0:t.find(m=>m.status===n),l=as;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(Ki,{className:"h-4 w-4"}):i?r.jsx(Ra,{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:dC[n]}),o&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[rs(new Date(o.created_at),"MMM d, yyyy h:mm a"),o.notes&&` — ${o.notes}`]})]})]},n)})})}function etr(){var E;const{orderId:e}=hc(),t=Hs(),{data:s,isLoading:n,refetch:a}=mer(e||""),o=ger(),l=xer(),[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}),Te.success("Proof approved!"),a()}catch{Te.error("Failed to approve proof")}finally{N(null)}},M=async()=>{if(m){N(m);try{await l.mutateAsync({orderId:e,itemId:m,reason:y}),Te.success("Revision requested"),u(!1),v(""),x(null),a()}catch{Te.error("Failed to request revision")}finally{N(null)}}};return n?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(Cr,{className:"h-64 w-full"}),r.jsx(Cr,{className:"h-48 w-full"})]}),r.jsx(Cr,{className:"h-96 w-full"})]})}):s?r.jsxs(Dr,{title:`Order ${s.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(Vt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Gt,{children:"Order Status"}),r.jsx(Tt,{className:dve[s.status],children:dC[s.status]})]}),r.jsx(Xe,{children:r.jsx(Jer,{currentStatus:s.status,statusHistory:s.status_history})})]}),r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsx(Gt,{children:"Items"})}),r.jsx(Xe,{className:"space-y-4",children:(E=s.items)==null?void 0:E.map(T=>r.jsxs("div",{className:"border rounded-lg p-4",children:[r.jsxs("div",{className:"flex justify-between items-start mb-3",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold",children:T.product_name}),T.variant_name&&r.jsx("p",{className:"text-sm text-muted-foreground",children:T.variant_name}),r.jsxs("p",{className:"text-sm",children:["Qty: ",T.quantity," × $",Number(T.unit_price).toFixed(2)]})]}),r.jsxs("p",{className:"font-semibold",children:["$",(Number(T.unit_price)*T.quantity).toFixed(2)]})]}),T.artwork_url&&r.jsxs("div",{className:"mb-3",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Your Artwork:"}),r.jsxs("a",{href:T.artwork_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-primary hover:underline",children:[r.jsx(H1,{className:"h-4 w-4"}),"View Artwork",r.jsx(Sn,{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(H1,{className:"h-4 w-4"}),"View Proof",r.jsx(Sn,{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(Vr,{className:"h-4 w-4 mr-1 animate-spin"}):r.jsx(xd,{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(EA,{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(Ki,{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))})]}),s.shipping_name&&r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(PA,{className:"h-5 w-5"}),"Shipping"]})}),r.jsxs(Xe,{children:[r.jsx("p",{className:"font-medium",children:s.shipping_name}),r.jsxs("p",{className:"text-muted-foreground",children:[s.shipping_address,r.jsx("br",{}),s.shipping_city,", ",s.shipping_state," ",s.shipping_zip]}),s.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:s.tracking_number}),s.tracking_url&&r.jsxs(X,{variant:"link",className:"p-0 h-auto mt-1",onClick:()=>window.open(s.tracking_url,"_blank"),children:["Track Package",r.jsx(Sn,{className:"h-3 w-3 ml-1"})]})]})]})]})]}),r.jsx("div",{children:r.jsxs(He,{className:"sticky top-4",children:[r.jsx(Vt,{children:r.jsx(Gt,{children:"Order Summary"})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Placed on ",rs(new Date(s.created_at),"MMMM d, yyyy")]}),r.jsx(pd,{}),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(s.subtotal).toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Shipping"}),r.jsxs("span",{children:["$",Number(s.shipping_total).toFixed(2)]})]})]}),r.jsx(pd,{}),r.jsxs("div",{className:"flex justify-between font-bold text-lg",children:[r.jsx("span",{children:"Total"}),r.jsxs("span",{children:["$",Number(s.total).toFixed(2)]})]}),s.notes&&r.jsxs(r.Fragment,{children:[r.jsx(pd,{}),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:s.notes})]})]})]})]})})]}),r.jsx(Or,{open:i,onOpenChange:u,children:r.jsxs(Pr,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Request Changes"}),r.jsx(Zs,{children:"Please describe what changes you'd like made to the proof."})]}),r.jsx(Ys,{placeholder:"Describe the changes needed...",value:y,onChange:T=>v(T.target.value),rows:4}),r.jsxs(zn,{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(Vr,{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(Vl,{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 ttr(){const e=Hs(),[t]=Ic();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(Xe,{className:"pt-8 pb-6",children:[r.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-6",children:r.jsx(Ki,{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(Vl,{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(to,{className:"h-4 w-4 ml-2"})]}),r.jsx(X,{variant:"outline",className:"flex-1",onClick:()=>e("/marketplace"),children:"Continue Shopping"})]})]})})})})}function rtr(){const{user:e}=Yr(),[t,s]=A.useState("store"),[n,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),[E,T]=A.useState(""),[P,R]=A.useState(null),[D,U]=A.useState(!1),{hasSubmittedReview:q,submitReview:H,markPostedToGoogle:G}=fRe(),{data:Q}=QVe(),{data:ne,isLoading:ie}=XVe(),{data:he,isLoading:se}=ker(n),{data:fe,isLoading:oe}=Ner(e==null?void 0:e.id),{data:ce=0}=Cer(e==null?void 0:e.id),de=Mer(),xe=new Set((fe==null?void 0:fe.map(Le=>Le.item_id))||[]),Me=async()=>{if(o)try{await de.mutateAsync(o.id),Te.success(`Successfully purchased "${o.name}"!`),l(null)}catch(Le){Te.error(Le.message||"Failed to purchase item")}},ve=async()=>{if(!y.trim()){Te.error("Please write a review");return}N(!0);const Le=await H(m,y);N(!1),Le.success?(Te.success("Thank you for your review! You earned 25 points!"),T(y),M(!0),v(""),x(5)):Te.error(Le.error||"Failed to submit review")},be=()=>{navigator.clipboard.writeText(E),Te.success("Review copied to clipboard!")},we=()=>{G(),window.open("https://g.page/r/CT8bqTBTm7nJEBM/review","_blank")},tt=()=>{M(!1),u(!1),T("")};return ie||se||oe?r.jsx(Dr,{title:"Reward Store",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Cr,{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(Le=>r.jsx(Cr,{className:"h-64"},Le))})]})}):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(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/20 flex items-center justify-center",children:r.jsx(Mn,{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:ce.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(lo,{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(gm,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{children:"Streak bonuses add extra points!"})]})]})]})})}),r.jsx(XS,{open:D,onOpenChange:U,children:r.jsxs(He,{className:"border-primary/20",children:[r.jsx(QS,{asChild:!0,children:r.jsx(Vt,{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(lo,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Gt,{className:"text-base",children:"How to Earn Points"}),r.jsx(Ns,{children:"See all the ways you can earn spendable points"})]})]}),D?r.jsx(zg,{className:"h-5 w-5 text-muted-foreground"}):r.jsx(gd,{className:"h-5 w-5 text-muted-foreground"})]})})}),r.jsx(JS,{children:r.jsx(Xe,{className:"pt-0",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:[Q==null?void 0:Q.filter(Le=>Le.is_active).map(Le=>{const Ue=Pe=>{switch(Pe){case"event_attendance":return r.jsx(jn,{className:"h-5 w-5"});case"leave_review":return r.jsx(Mn,{className:"h-5 w-5"});case"add_listing":return r.jsx(sa,{className:"h-5 w-5"});case"first_contact":return r.jsx(qs,{className:"h-5 w-5"});case"first_video":return r.jsx(Ta,{className:"h-5 w-5"});case"first_community_post":return r.jsx(Bo,{className:"h-5 w-5"});default:return r.jsx(oo,{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:Ue(Le.action_key)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm",children:Le.action_name}),Le.description&&r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Le.description})]}),r.jsxs(Tt,{variant:"secondary",className:"font-bold shrink-0",children:["+",Le.points]})]},Le.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(gm,{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"})]})]})})})]})}),!q&&r.jsx(He,{className:"bg-gradient-to-r from-yellow-500/10 to-orange-500/10 border-yellow-500/20",children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-yellow-500/20 flex items-center justify-center",children:r.jsx(Bo,{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(Mn,{className:"h-4 w-4 mr-2"}),"Leave Review"]})]})})}),r.jsxs(Si,{value:t,onValueChange:s,children:[r.jsxs(ki,{children:[r.jsxs(is,{value:"store",className:"flex items-center gap-2",children:[r.jsx(Ug,{className:"h-4 w-4"}),"Store"]}),r.jsxs(is,{value:"my-rewards",className:"flex items-center gap-2",children:[r.jsx(Vl,{className:"h-4 w-4"}),"My Rewards",fe&&fe.length>0&&r.jsx(Tt,{variant:"secondary",className:"ml-1",children:fe.length})]})]}),r.jsxs(Ss,{value:"store",className:"mt-6",children:[ne&&ne.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[r.jsx(X,{variant:n===null?"default":"outline",size:"sm",onClick:()=>a(null),children:"All"}),ne.map(Le=>r.jsxs(X,{variant:n===Le.id?"default":"outline",size:"sm",onClick:()=>a(Le.id),children:[Le.icon&&`${Le.icon} `,Le.name]},Le.id))]}),!he||he.length===0?r.jsx(He,{children:r.jsx(Xe,{className:"py-12",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(oo,{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:he.map(Le=>{const Ue=xe.has(Le.id),Pe=Le.max_quantity!==null&&Le.current_quantity===0,$e=ce>=Le.points_cost;return r.jsxs(He,{className:`overflow-hidden transition-all cursor-pointer hover:shadow-lg ${Ue?"ring-2 ring-green-500/50 bg-green-500/5":""}`,onClick:()=>R(Le),children:[Le.preview_image_url?r.jsxs("div",{className:"aspect-video relative overflow-hidden bg-muted",children:[r.jsx("img",{src:Le.preview_image_url,alt:Le.name,className:"w-full h-full object-cover"}),Ue&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Tt,{className:"bg-green-500 text-white",children:[r.jsx(Ki,{className:"h-3 w-3 mr-1"}),"Owned"]})}),Pe&&!Ue&&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(oo,{className:"h-12 w-12 text-muted-foreground/50"}),Ue&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Tt,{className:"bg-green-500 text-white",children:[r.jsx(Ki,{className:"h-3 w-3 mr-1"}),"Owned"]})})]}),r.jsxs(Vt,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsx(Gt,{className:"text-lg",children:Le.name}),r.jsxs(Tt,{variant:"secondary",className:"font-bold shrink-0",children:[r.jsx(Mn,{className:"h-3 w-3 mr-1"}),Le.points_cost]})]}),Le.category&&r.jsxs(Tt,{variant:"outline",className:"w-fit",children:[Le.category.icon&&`${Le.category.icon} `,Le.category.name]})]}),r.jsxs(Xe,{children:[r.jsx(Ns,{className:"mb-4 line-clamp-2",children:Le.description||"No description available"}),Le.max_quantity!==null&&!Ue&&r.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:[Le.current_quantity," of ",Le.max_quantity," remaining"]}),Ue?r.jsx(X,{className:"w-full",onClick:it=>{it.stopPropagation(),Le.file_url&&_ue(Le.file_url,Le.name)},disabled:!Le.file_url,children:Le.item_type==="file"?r.jsxs(r.Fragment,{children:[r.jsx($i,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Access"]})}):r.jsx(X,{className:"w-full",onClick:it=>{it.stopPropagation(),l(Le)},disabled:Pe||!$e,children:Pe?"Sold Out":$e?r.jsxs(r.Fragment,{children:[r.jsx(Ug,{className:"h-4 w-4 mr-2"}),"Purchase"]}):`Need ${Le.points_cost-ce} more pts`})]})]},Le.id)})})]}),r.jsx(Ss,{value:"my-rewards",className:"mt-6",children:!fe||fe.length===0?r.jsx(He,{children:r.jsx(Xe,{className:"py-12",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(Vl,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{className:"font-medium",children:"No rewards yet"}),r.jsx("p",{className:"text-sm",children:"Purchase items from the store to see them here!"})]})})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:fe.map(Le=>{var Ue,Pe,$e,it,xt;return r.jsxs(He,{className:"overflow-hidden",children:[(Ue=Le.item)!=null&&Ue.preview_image_url?r.jsx("div",{className:"aspect-video relative overflow-hidden bg-muted",children:r.jsx("img",{src:Le.item.preview_image_url,alt:((Pe=Le.item)==null?void 0:Pe.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(oo,{className:"h-12 w-12 text-muted-foreground/50"})}),r.jsxs(Vt,{className:"pb-2",children:[r.jsx(Gt,{className:"text-lg",children:(($e=Le.item)==null?void 0:$e.name)||"Unknown Item"}),r.jsxs(Ns,{className:"text-xs",children:["Purchased for ",Le.points_spent," points • ",new Date(Le.purchased_at).toLocaleDateString()]})]}),r.jsx(Xe,{children:r.jsx(X,{className:"w-full",onClick:()=>{var Ee,et;(Ee=Le.item)!=null&&Ee.file_url&&_ue(Le.item.file_url,(et=Le.item)==null?void 0:et.name)},disabled:!((it=Le.item)!=null&&it.file_url),children:((xt=Le.item)==null?void 0:xt.item_type)==="file"?r.jsxs(r.Fragment,{children:[r.jsx($i,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Access"]})})})]},Le.id)})})})]})]}),r.jsx(Dd,{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:[ce," points"]}),". After this purchase, you'll have"," ",r.jsxs("strong",{children:[ce-((o==null?void 0:o.points_cost)||0)," points"]})," remaining."]})]}),r.jsxs(dd,{children:[r.jsx(md,{children:"Cancel"}),r.jsx(Vc,{onClick:Me,disabled:de.isPending,children:de.isPending?"Purchasing...":"Confirm Purchase"})]})]})}),r.jsx(Or,{open:i,onOpenChange:Le=>{!Le&&k?tt():u(Le)},children:r.jsx(Pr,{children:k?r.jsxs(r.Fragment,{children:[r.jsxs(zr,{children:[r.jsxs(Rr,{className:"flex items-center gap-2",children:[r.jsx(Ki,{className:"h-5 w-5 text-green-500"}),"Thank You for Your Review!"]}),r.jsx(Zs,{children:"Would you also share your review on Google? It helps other agents discover LevelUp!"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"bg-muted p-4 rounded-lg",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Your review:"}),r.jsxs("p",{className:"text-sm italic",children:['"',E,'"']})]}),r.jsxs(X,{variant:"outline",className:"w-full",onClick:be,children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Copy Review to Clipboard"]})]}),r.jsxs(zn,{className:"flex-col sm:flex-row gap-2",children:[r.jsx(X,{variant:"outline",onClick:tt,children:"Maybe Later"}),r.jsxs(X,{onClick:we,className:"bg-blue-600 hover:bg-blue-700",children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Leave Google Review"]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Leave a Review"}),r.jsx(Zs,{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(Le=>r.jsx("button",{type:"button",onClick:()=>x(Le),className:"focus:outline-none",children:r.jsx(Mn,{className:`h-8 w-8 transition-colors ${m>=Le?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-400"}`})},Le))})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Your Review"}),r.jsx(Ys,{placeholder:"What do you love about LevelUp? How has it helped your business?",value:y,onChange:Le=>v(Le.target.value),rows:4})]})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsx(X,{onClick:ve,disabled:b,className:"bg-yellow-600 hover:bg-yellow-700",children:b?"Submitting...":"Submit & Earn 25 Points"})]})]})})}),r.jsx(Or,{open:!!P,onOpenChange:()=>R(null),children:r.jsxs(Pr,{className:"max-w-lg",children:[r.jsxs(zr,{children:[r.jsxs(Rr,{className:"flex items-center gap-2",children:[P==null?void 0:P.name,r.jsxs(Tt,{variant:"secondary",className:"font-bold",children:[r.jsx(Mn,{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(zn,{children:P&&xe.has(P.id)?r.jsx(X,{className:"w-full",onClick:()=>{P.file_url&&_ue(P.file_url,P.name)},disabled:!P.file_url,children:P.item_type==="file"?r.jsxs(r.Fragment,{children:[r.jsx($i,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Access"]})}):P&&r.jsx(X,{className:"w-full",onClick:()=>{R(null),l(P)},disabled:P.max_quantity!==null&&P.current_quantity===0||ce{const{user:e}=Yr(),t=Br(),s=Kt({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}),n=Kt({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"]}),Te.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"]}),Te.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"]}),Te.success("Saved as template!")}});return{presentations:s.data||[],templates:n.data||[],isLoading:s.isLoading,templatesLoading:n.isLoading,createPresentation:a,updatePresentation:o,publishPresentation:l,archivePresentation:i,saveAsTemplate:u}},str=[{value:"positive",label:"Love it",icon:xd,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:Zu,color:"bg-red-100 text-red-700 border-red-300"}],ntr=({feature:e,children:t})=>{const{user:s}=Yr(),[n,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()){Te.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=s==null?void 0:s.user_metadata)==null?void 0:v.name)||(s==null?void 0:s.email)||"Unknown",userEmail:(s==null?void 0:s.email)||"unknown"}});if(b)throw b;Te.success("Thank you for your feedback!"),a(!1),l(null),u("")}catch(b){console.error("Feedback error:",b),Te.error("Failed to send feedback. Please try again.")}finally{x(!1)}};return r.jsxs(Or,{open:n,onOpenChange:a,children:[r.jsx(vo,{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(xA,{className:"h-3.5 w-3.5"}),"Feedback"]})}),r.jsxs(Pr,{className:"sm:max-w-md",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Share Your Feedback"}),r.jsx(Zs,{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:str.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(Ys,{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"})]})]})]})]})},atr=()=>{const e=Hs(),{presentations:t,isLoading:s,archivePresentation:n,saveAsTemplate:a}=rHe(),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),Te.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(zRe,{}),r.jsx(ntr,{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(vs,{className:"h-4 w-4"}),"Create Presentation"]})]}),s?r.jsx("div",{className:"space-y-3",children:[1,2,3].map(i=>r.jsx(Cr,{className:"h-20 w-full rounded-lg"},i))}):t.length===0?r.jsx(He,{children:r.jsxs(Xe,{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(vs,{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.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:r.jsx(ga,{className:"h-5 w-5 text-primary"})}),r.jsx("div",{className:"min-w-0 flex-1",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("h3",{className:"font-semibold truncate",children:i.title}),o(i)]}),r.jsxs("div",{className:"flex items-center gap-x-3 gap-y-0.5 flex-wrap text-sm text-muted-foreground mt-0.5",children:[i.client_name&&r.jsx("span",{children:i.client_name}),r.jsxs("span",{children:["Created ",rs(new Date(i.created_at),"MMM d, yyyy")]}),i.view_count>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(mo,{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 flex-wrap sm:flex-nowrap sm:shrink-0",children:[i.status==="published"&&i.share_token&&r.jsxs(X,{variant:"outline",size:"sm",onClick:()=>l(i.share_token),children:[r.jsx(Mo,{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(uh,{children:[r.jsx(hh,{asChild:!0,children:r.jsx(X,{variant:"ghost",size:"icon",className:"h-8 w-8",children:r.jsx(Ng,{className:"h-4 w-4"})})}),r.jsxs(Cu,{align:"end",children:[i.status==="published"&&i.share_token&&r.jsxs(Wa,{onClick:()=>window.open(`https://presentations.relevelup.com/${i.share_token}`,"_blank"),children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Preview Link"]}),r.jsxs(Wa,{onClick:()=>a.mutate(i),children:[r.jsx(ga,{className:"h-4 w-4 mr-2"}),"Save as Template"]}),r.jsxs(Wa,{onClick:()=>n.mutate(i.id),className:"text-destructive",children:[r.jsx(nA,{className:"h-4 w-4 mr-2"}),"Archive"]})]})]})]})]})})]})})},i.id))})]})})},ATe={Welcome:[{label:"Warm & Personal",text:"Hey there! I'm so glad you're here. I put this presentation together just for you because I truly believe we'd make a great team. Over the next few minutes, I'll walk you through exactly how I can help you achieve your real estate goals. Let's dive in!"},{label:"Professional & Confident",text:"Welcome! Thank you for taking the time to check this out. I've prepared this presentation specifically with your needs in mind. I want to show you what sets me apart, the results I've delivered, and how I plan to make your experience smooth and successful. Let's get started!"}],"About Me":[{label:"Relatable Story",text:"Let me tell you a little about myself. I didn't just fall into real estate — I chose it because I love helping people with one of the biggest decisions of their lives. Every client I work with gets my full attention, my honest advice, and someone who truly has their back from start to finish."},{label:"Results-Focused",text:"Here's what I want you to know about me: I'm not just another agent. I've helped dozens of families find their perfect home and get top dollar for their properties. I stay on top of the market, I communicate constantly, and I don't stop until we hit your goals."}],"Market Update":[{label:"Engaging Overview",text:"Let's talk about what's happening in the market right now. I want you to feel confident and informed, so here's the honest picture. I'll break down the key numbers, what they mean for you, and how we can use current conditions to your advantage. Knowledge is power!"},{label:"Buyer-Focused",text:"The market is always moving, and I want to make sure you're in the best position possible. Here's what the latest data tells us, what opportunities are out there for you, and why timing matters. Let me walk you through it."}],"My Process":[{label:"Step-by-Step",text:"I want you to know exactly what to expect when we work together. My process is simple, clear, and designed to take the stress out of the equation. From our first conversation all the way to closing day, I'll be right there guiding you every step of the way. Here's how it works."},{label:"Client-Centered",text:"One thing my clients always tell me is how easy and stress-free the process was. That's not by accident — I've refined my approach over the years to make sure you always know what's happening, what's next, and that someone's got your back. Let me show you how."}],Testimonials:[{label:"Social Proof",text:"Don't just take my word for it — let me share what some of my past clients have said. These are real people, real experiences, and real results. I'm proud of the relationships I've built and the outcomes we've achieved together."}],Pricing:[{label:"Transparent & Value-Driven",text:"Let's talk about the investment. I believe in being completely transparent about pricing because trust is everything. Here's what you get when you work with me, and why my clients say it's the best decision they made. Let me walk you through it."}],"Call to Action":[{label:"Warm Close",text:"So here's my ask — let's connect! I'd love to hop on a quick call, answer any questions you have, and see how I can help. No pressure, no obligation — just a real conversation about your goals. Click the button below and let's make it happen!"},{label:"Urgency Close",text:"The market waits for no one, and neither should you. Let's get started today! Click the link below to schedule a quick chat. I promise — this could be the best 15 minutes you invest in your real estate journey."}]},itr=[{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 otr(e){const t=ATe[e];if(t)return t;const s=e.toLowerCase();for(const[n,a]of Object.entries(ATe))if(s.includes(n.toLowerCase())||n.toLowerCase().includes(s))return a;return itr}function ltr({sectionTitle:e,contactId:t,onVideoReady:s}){const[n,a]=A.useState(!1),[o,l]=A.useState("script"),[i,u]=A.useState(0),[m,x]=A.useState(0),{canRecord:y}=SBe(),v=Hae(),[b,N]=A.useState(""),[k,M]=A.useState(!1),[E,T]=A.useState(!0),[P,R]=A.useState(!1),[D,U]=A.useState(null),q=otr(e),H=()=>{l("script"),u(0),x(0),N(""),M(!1),T(!0),R(!1),U(null)},G=se=>{!se&&(o==="uploading"||o==="processing")||(a(se),se||H())},Q=se=>{U(se),N(q[se].text),M(!1)},ne=()=>{l("record"),T(b.trim().length>0)},ie=()=>{N(""),T(!1),l("record")},he=A.useCallback(async(se,fe)=>{l("uploading");try{const oe=e||"Presentation Video",{videoId:ce,uploadUrl:de,libraryId:xe}=await CBe(oe),{apiKey:Me}=await MBe(ce),ve=new XMLHttpRequest;ve.upload.onprogress=Le=>{Le.lengthComputable&&u(Le.loaded/Le.total*100)},await new Promise((Le,Ue)=>{ve.onload=()=>ve.status>=200&&ve.status<300?Le():Ue(new Error("Upload failed")),ve.onerror=()=>Ue(new Error("Upload failed")),ve.open("PUT",de),ve.setRequestHeader("AccessKey",Me),ve.send(se)}),l("processing");let be=0;const we=Date.now(),tt=9e4;let Ae=null;for(;be<4;){if(await new Promise(Ue=>setTimeout(Ue,3e3)),Date.now()-we>tt){const Ue=se.size/1048576,Pe=`https://iframe.mediadelivery.net/embed/${xe}/${ce}?responsive=true`;await v.mutateAsync({bunny_video_id:ce,playback_url:Pe,file_size_mb:Ue,title:oe,contact_id:t||void 0,status:"processing",touch_type:"presentation"}),s(Pe),Te.success("Video saved — still encoding. It will be ready shortly."),l("done"),setTimeout(()=>a(!1),1500);return}const Le=await TBe(ce);if(be=Le.status,x(Le.encodeProgress||0),be===4)Ae={playbackUrl:Le.directPlayUrl,thumbnailUrl:Le.thumbnailUrl,previewUrl:Le.previewUrl||null,duration:Le.length||fe,fileSizeMb:(Le.storageSize||se.size)/(1024*1024)};else if(be===5||be===6)throw new Error("Video processing failed")}if(!Ae)throw new Error("No video data");await v.mutateAsync({bunny_video_id:ce,contact_id:t||void 0,playback_url:Ae.playbackUrl,thumbnail_url:Ae.thumbnailUrl,preview_url:Ae.previewUrl,duration_seconds:Ae.duration,file_size_mb:Ae.fileSizeMb,title:oe,status:"ready",touch_type:"presentation"}),s(Ae.playbackUrl),Te.success("Video recorded, saved to library & attached!"),l("done"),setTimeout(()=>a(!1),1500)}catch(oe){console.error("Recording upload error:",oe),Te.error("Failed to process video. Please try again."),l("record")}},[e,t,s,v]);return r.jsxs(Or,{open:n,onOpenChange:G,children:[r.jsx(vo,{asChild:!0,children:r.jsxs(X,{variant:"outline",size:"sm",className:"gap-1.5 shrink-0",title:"Record a video",children:[r.jsx(Ta,{className:"h-3.5 w-3.5"}),"Record"]})}),r.jsxs(Pr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(zr,{children:r.jsxs(Rr,{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:q.map((se,fe)=>r.jsxs("button",{onClick:()=>Q(fe),className:Ut("text-left p-3 rounded-lg border transition-all hover:bg-accent/50",D===fe?"border-primary bg-primary/5 ring-1 ring-primary":"border-border"),children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(ga,{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})]},fe))})]}),b&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Your Script"}),!k&&r.jsxs(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(Ys,{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(Ys,{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:ie,className:"text-muted-foreground",children:"Skip — no teleprompter"}),r.jsx(X,{onClick:ne,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(Zu,{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(!E),className:"h-7 text-xs gap-1",children:[E?r.jsx(Ef,{className:"h-3 w-3"}):r.jsx(mo,{className:"h-3 w-3"}),E?"Hide Script":"Show Script"]})]}),r.jsx(AVe,{maxDurationSeconds:60,onRecordingComplete:he,onRecordingStateChange:R,onError:se=>Te.error(se),teleprompterContent:b.trim()?r.jsx(IVe,{text:b,isVisible:E,onToggleVisibility:()=>T(!E),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(Vr,{className:"h-10 w-10 animate-spin text-primary"}),r.jsxs("div",{className:"w-full max-w-xs space-y-2",children:[r.jsx(lc,{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(Vr,{className:"h-10 w-10 animate-spin text-primary"}),r.jsxs("div",{className:"w-full max-w-xs space-y-2",children:[r.jsx(lc,{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(ii,{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]})]})}function ctr({sectionTitle:e,contactId:t,onVideoReady:s}){const[n,a]=A.useState(!1),[o,l]=A.useState(null),[i,u]=A.useState("idle"),[m,x]=A.useState(0),y=A.useRef(null),v=Hae(),{data:b}=Wae(),N=(b==null?void 0:b.total_storage_mb)||0,M=((b==null?void 0:b.max_storage_mb)||1024)-N,E=()=>{l(null),u("idle"),x(0)},T=q=>{!q&&i!=="idle"&&i!=="done"||(a(q),q||E())},P=q=>{var Q;const H=(Q=q.target.files)==null?void 0:Q[0];if(!H)return;if(!H.type.startsWith("video/")){Te.error("Please select a video file");return}const G=H.size/(1024*1024);if(G>500){Te.error("Video file must be less than 500MB");return}if(G>M){Te.error(`Not enough storage. You have ${M.toFixed(1)} MB remaining.`);return}l(H)},R=A.useCallback(async()=>{if(o){u("creating"),x(0);try{const q=e||o.name,{data:H,error:G}=await Y.functions.invoke("bunny-upload",{body:{action:"create",title:q,isAgentVideo:!0}});if(G)throw new Error(G.message);const{videoId:Q,libraryId:ne}=H;u("uploading");const{data:ie,error:he}=await Y.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:Q,isAgentVideo:!0}});if(he)throw new Error(he.message);await new Promise((oe,ce)=>{const de=new XMLHttpRequest;de.upload.addEventListener("progress",xe=>{xe.lengthComputable&&x(Math.round(xe.loaded/xe.total*100))}),de.addEventListener("load",()=>de.status>=200&&de.status<300?oe():ce(new Error(`Upload failed (${de.status})`))),de.addEventListener("error",()=>ce(new Error("Upload failed"))),de.open("PUT",ie.uploadUrl),de.setRequestHeader("AccessKey",ie.apiKey),de.send(o)}),u("processing");const se=o.size/(1024*1024),fe=`https://iframe.mediadelivery.net/embed/${ne}/${Q}`;await v.mutateAsync({bunny_video_id:Q,playback_url:fe,file_size_mb:se,title:q,contact_id:t||void 0,status:"processing",touch_type:"presentation"}),s(fe),u("done"),Te.success("Video uploaded & attached to section!"),setTimeout(()=>a(!1),1200)}catch(q){console.error("Upload error:",q),Te.error(q instanceof Error?q.message:"Failed to upload video"),u("idle")}}},[o,e,t,s,v]),D=()=>{switch(i){case"creating":return"Preparing upload...";case"uploading":return`Uploading... ${m}%`;case"processing":return"Saving video...";case"done":return"Done!";default:return""}},U=i!=="idle"&&i!=="done";return r.jsxs(Or,{open:n,onOpenChange:T,children:[r.jsx(vo,{asChild:!0,children:r.jsxs(X,{variant:"outline",size:"sm",className:"gap-1.5 shrink-0",title:"Upload a video file",children:[r.jsx(so,{className:"h-3.5 w-3.5"}),"Upload"]})}),r.jsxs(Pr,{className:"sm:max-w-md",children:[r.jsx(zr,{children:r.jsxs(Rr,{children:['Upload Video for "',e,'"']})}),r.jsxs("div",{className:"space-y-4 py-2",children:[o?r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted rounded-lg",children:[r.jsx(Ta,{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:o.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(o.size/(1024*1024)).toFixed(1)," MB"]})]}),!U&&r.jsx(X,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>l(null),children:r.jsx(en,{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 q;return(q=y.current)==null?void 0:q.click()},children:[r.jsx(so,{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:y,type:"file",accept:"video/*",className:"hidden",onChange:P,disabled:U}),U&&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(Vr,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{children:D()})]}),r.jsx(lc,{value:i==="uploading"?m:i==="processing"?100:10})]})]}),r.jsxs(zn,{children:[r.jsx(X,{variant:"outline",onClick:()=>T(!1),disabled:U,children:"Cancel"}),r.jsx(X,{onClick:R,disabled:!o||U,children:U?r.jsxs(r.Fragment,{children:[r.jsx(Vr,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Upload & Attach"]})})]})]})]})}const ETe=[{value:"schedule_call",label:"Schedule a Call"},{value:"ready_to_list",label:"Ready to List"},{value:"request_pricing",label:"Request Pricing Update"},{value:"sign_agreement",label:"Sign Buyer Agreement"},{value:"text_questions",label:"Text Me Questions"}],ITe=()=>{const e=Hs(),{id:t}=hc(),{user:s}=Yr(),{templates:n,templatesLoading:a,createPresentation:o,updatePresentation:l,publishPresentation:i}=rHe(),{isGmailConnected:u,gmailEmail:m}=MP(),[x,y]=A.useState(!1),[v,b]=A.useState("client"),[N,k]=A.useState(!1),[M,E]=A.useState(""),[T,P]=A.useState([]),[R,D]=A.useState(!1),[U,q]=A.useState(null),[H,G]=A.useState(!1),[Q,ne]=A.useState(""),[ie,he]=A.useState(""),[se,fe]=A.useState(""),[oe,ce]=A.useState("buyer"),[de,xe]=A.useState(""),[Me,ve]=A.useState(null),[be,we]=A.useState(""),[tt,Ae]=A.useState([]),[Le,Ue]=A.useState("schedule_call"),[Pe,$e]=A.useState("Schedule a Call"),[it,xt]=A.useState(""),[Ee,et]=A.useState(""),[le,Ve]=A.useState(null),[Je,rt]=A.useState(t||null),[je,lt]=A.useState(null),[Ce,Ie]=A.useState(!1),Ze=async(Ot,Hr)=>{if(!s)return;const Ts=5*1024*1024;if(Ot.size>Ts){Te.error("Image must be under 5MB");return}if(!Ot.type.startsWith("image/")){Te.error("Please upload an image file");return}Ve(Hr);try{const zs=Ot.name.split(".").pop()||"jpg",wa=`${s.id}/${Date.now()}.${zs}`,{error:gi}=await Y.storage.from("listing-photos").upload(wa,Ot);if(gi)throw gi;const{data:{publicUrl:Ao}}=Y.storage.from("listing-photos").getPublicUrl(wa);zt(Hr,{image_url:Ao}),Te.success("Image uploaded")}catch{Te.error("Failed to upload image")}finally{Ve(null)}};A.useEffect(()=>{t&&De(t)},[t]);const De=async Ot=>{const{data:Hr,error:Ts}=await Y.from("smart_presentations").select("*").eq("id",Ot).single();if(Ts||!Hr)return;const zs=Hr;if(k(!0),we(zs.title),ne(zs.client_name||""),xe(zs.property_address||""),Ae(zs.sections||[]),Ue(zs.cta_type||"schedule_call"),$e(zs.cta_label||"Schedule a Call"),xt(zs.cta_url||""),et(zs.heading||""),lt(zs.share_token),Ie(zs.status==="published"),rt(zs.id),b("builder"),zs.contact_id){const{data:wa}=await Y.from("innercircle_contacts").select("id, first_name, last_name, email, phone").eq("id",zs.contact_id).maybeSingle();wa&&(q(wa),he(wa.email||""),fe(wa.phone||""))}};A.useEffect(()=>{if(!s||M.length<1){P([]);return}const Ot=setTimeout(async()=>{D(!0);const{data:Hr}=await Y.from("innercircle_contacts").select("id, first_name, last_name, email, phone, lead_source").eq("owner_user_id",s.id).or(`first_name.ilike.%${M}%,last_name.ilike.%${M}%,email.ilike.%${M}%`).limit(10);P(Hr||[]),D(!1)},300);return()=>clearTimeout(Ot)},[M,s]);const Ke=Ot=>{q(Ot),ne(`${Ot.first_name} ${Ot.last_name||""}`.trim()),he(Ot.email||""),fe(Ot.phone||""),G(!1)},st=async()=>{if(!Q.trim()){Te.error("Client name is required");return}const Ot=Q.trim().split(" "),Hr=Ot[0],Ts=Ot.slice(1).join(" ")||null,{data:zs,error:wa}=await Y.from("innercircle_contacts").insert({owner_user_id:s.id,first_name:Hr,last_name:Ts,email:ie||null,phone:se||null,lead_source:"Smart Presentation"}).select().single();if(wa){Te.error("Failed to create client");return}q(zs),Te.success("Client created & saved to Agent OS"),b("template")},dt=Ot=>{ve(Ot);const Hr=(Ot.sections||[]).map(Ts=>({...Ts,is_visible:!0,video_url:"",text:""}));if(Ae(Hr),we(Ot.name+(Q?` for ${Q}`:"")),Ot.cta_config){const Ts=Ot.cta_config;Ue(Ts.type||"schedule_call"),$e(Ts.label||"Schedule a Call")}b("builder")},ct=()=>{Ae([{title:"Welcome",description:"A personal welcome",type:"video",icon:"👋",is_visible:!0}]),we(Q?`Presentation for ${Q}`:"New Presentation"),b("builder")},zt=(Ot,Hr)=>{Ae(Ts=>Ts.map((zs,wa)=>wa===Ot?{...zs,...Hr}:zs))},ir=Ot=>{zt(Ot,{is_visible:!tt[Ot].is_visible})},Tr=()=>{Ae(Ot=>[...Ot,{title:"New Section",description:"",type:"video",icon:"📝",is_visible:!0}])},Zr=Ot=>{Ae(Hr=>Hr.filter((Ts,zs)=>zs!==Ot))},$r=async()=>{if(!be.trim()){Te.error("Title is required");return}try{if(Je){const Ot=await l.mutateAsync({id:Je,title:be,sections:tt,client_name:Q,property_address:de||null,cta_type:Le,cta_label:Pe,cta_url:it||null,heading:Ee||null});Te.success("Saved")}else{const Ot=await o.mutateAsync({title:be,contact_id:(U==null?void 0:U.id)||void 0,client_name:Q,property_address:de||void 0,template_id:(Me==null?void 0:Me.id)||void 0,sections:tt,cta_type:Le,cta_label:Pe,cta_url:it||void 0,heading:Ee||void 0});rt(Ot.id),lt(Ot.share_token),Te.success("Presentation created!")}}catch{Te.error("Failed to save")}},ns=async()=>{await $r();const Ot=Je;if(Ot){const Hr=await i.mutateAsync(Ot);lt(Hr.share_token),Ie(!0),b("share")}},Xs=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,Hr)=>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":Hr<["client","template","builder","share"].indexOf(v)?"bg-emerald-100 text-emerald-700":"bg-muted text-muted-foreground"),children:Hr<["client","template","builder","share"].indexOf(v)?r.jsx(fi,{className:"h-4 w-4"}):Hr+1}),r.jsx("span",{className:"text-sm font-medium capitalize hidden sm:inline",children:Ot}),Hr<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:()=>{q(null),ne(""),he(""),fe(""),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(ro,{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(to,{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(Vt,{className:"pb-3",children:r.jsxs(Gt,{className:"text-base flex items-center gap-2",children:[r.jsx(ua,{className:"h-4 w-4 text-muted-foreground"}),"Select Existing Client"]})}),r.jsxs(Xe,{className:"space-y-3",children:[r.jsxs("div",{className:"relative",children:[r.jsx(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{placeholder:"Search by name or email...",value:M,onChange:Ot=>E(Ot.target.value),className:"pl-10"})]}),r.jsxs("div",{className:"space-y-2 max-h-56 overflow-y-auto",children:[R&&r.jsx(Cr,{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&&!R&&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(to,{className:"h-4 w-4"})]})]})]}),r.jsxs(He,{children:[r.jsx(Vt,{className:"pb-3",children:r.jsxs(Gt,{className:"text-base flex items-center gap-2",children:[r.jsx(wu,{className:"h-4 w-4 text-muted-foreground"}),"Add New Client"]})}),r.jsxs(Xe,{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(ot,{value:Q,onChange:Ot=>{ne(Ot.target.value),G(!0),q(null)},placeholder:"Sarah & Mike Johnson"})]}),r.jsxs("div",{children:[r.jsx(ze,{className:"text-xs",children:"Email"}),r.jsx(ot,{value:ie,onChange:Ot=>he(Ot.target.value),placeholder:"Optional",type:"email"})]}),r.jsxs("div",{children:[r.jsx(ze,{className:"text-xs",children:"Phone"}),r.jsx(ot,{value:se,onChange:Ot=>fe(Ot.target.value),placeholder:"Optional"})]}),r.jsxs("div",{children:[r.jsx(ze,{className:"text-xs",children:"Client Type"}),r.jsxs(us,{value:oe,onValueChange:ce,children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsxs(ds,{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(ot,{value:de,onChange:Ot=>xe(Ot.target.value),placeholder:"Optional"})]})]}),H&&Q&&r.jsxs(X,{onClick:st,className:"w-full gap-2",children:["Create Client & Continue",r.jsx(to,{className:"h-4 w-4"})]})]})]})]})]}),v==="template"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Si,{defaultValue:"system",children:[r.jsxs(ki,{children:[r.jsx(is,{value:"mine",children:"My Core Templates"}),r.jsx(is,{value:"system",children:"LevelUp Smart Templates"}),r.jsx(is,{value:"blank",children:"+ Start Blank"})]}),r.jsx(Ss,{value:"mine",className:"mt-4",children:a?r.jsx("div",{className:"grid grid-cols-2 gap-4",children:[1,2].map(Ot=>r.jsx(Cr,{className:"h-32"},Ot))}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:n.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!"}):n.filter(Ot=>!Ot.is_system).map(Ot=>r.jsx(PTe,{template:Ot,onSelect:dt},Ot.id))})}),r.jsx(Ss,{value:"system",className:"mt-4",children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:n.filter(Ot=>Ot.is_system).map(Ot=>r.jsx(PTe,{template:Ot,onSelect:dt},Ot.id))})}),r.jsx(Ss,{value:"blank",className:"mt-4",children:r.jsx(He,{children:r.jsxs(Xe,{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:ct,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(Xe,{className:"pt-6 space-y-4",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"Presentation Title"}),r.jsx(ot,{value:be,onChange:Ot=>we(Ot.target.value)})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Page Heading"}),r.jsx(ot,{value:Ee,onChange:Ot=>et(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(ot,{value:Q,onChange:Ot=>ne(Ot.target.value)})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Property Address"}),r.jsx(ot,{value:de,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:Tr,children:"+ Add Section"})]}),r.jsx("div",{className:"space-y-3",children:tt.map((Ot,Hr)=>r.jsx(He,{className:Ut(!Ot.is_visible&&"opacity-50"),children:r.jsx(Xe,{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(Bg,{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(ot,{value:Ot.title,onChange:Ts=>zt(Hr,{title:Ts.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(Hr),children:Ot.is_visible?r.jsx(mo,{className:"h-4 w-4"}):r.jsx(Ef,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>Zr(Hr),className:"text-destructive hover:text-destructive",children:r.jsx(Bs,{className:"h-4 w-4"})})]})]}),r.jsx(ot,{value:Ot.description||"",onChange:Ts=>zt(Hr,{description:Ts.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(ot,{value:Ot.video_url||"",onChange:Ts=>zt(Hr,{video_url:Ts.target.value}),placeholder:"Paste a YouTube or video URL...",className:"text-sm"})]}),r.jsx(ltr,{sectionTitle:Ot.title,contactId:U==null?void 0:U.id,onVideoReady:Ts=>zt(Hr,{video_url:Ts})}),r.jsx(ctr,{sectionTitle:Ot.title,contactId:U==null?void 0:U.id,onVideoReady:Ts=>zt(Hr,{video_url:Ts})}),r.jsx(dtr,{userId:s==null?void 0:s.id,onSelect:Ts=>zt(Hr,{video_url:Ts})})]}),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(Hr,{image_url:""}),children:r.jsx(en,{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===Hr?r.jsx(Vr,{className:"h-4 w-4 animate-spin text-muted-foreground"}):r.jsx(Z1,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:le===Hr?"Uploading...":"Click to upload an image"}),r.jsx("input",{type:"file",accept:"image/*",className:"hidden",disabled:le===Hr,onChange:Ts=>{var wa;const zs=(wa=Ts.target.files)==null?void 0:wa[0];zs&&Ze(zs,Hr),Ts.target.value=""}})]})]}),r.jsxs("div",{children:[r.jsx(ze,{className:"text-xs",children:"Text (optional)"}),r.jsx(Wf,{content:Ot.text||"",onChange:Ts=>zt(Hr,{text:Ts}),placeholder:"Add supporting text...",minHeight:"80px",compact:!0})]})]})]})})},Hr))})]}),r.jsxs(He,{children:[r.jsx(Vt,{children:r.jsx(Gt,{className:"text-base",children:"Call to Action"})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"CTA Type"}),r.jsxs(us,{value:Le,onValueChange:Ot=>{Ue(Ot);const Hr=ETe.find(Ts=>Ts.value===Ot);Hr&&$e(Hr.label)},children:[r.jsx(cs,{children:r.jsx(ms,{})}),r.jsx(ds,{children:ETe.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(ot,{value:Pe,onChange:Ot=>$e(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(ot,{value:it,onChange:Ot=>xt(Ot.target.value),placeholder:"https://calendly.com/..."}),!it&&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:$r,disabled:o.isPending||l.isPending,children:"Save Draft"}),r.jsxs(X,{onClick:ns,disabled:i.isPending,className:"gap-2",children:[r.jsx(ro,{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(Xe,{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(ot,{value:Xs,readOnly:!0,className:"text-center font-mono text-sm"}),r.jsx(X,{onClick:()=>{navigator.clipboard.writeText(Xs),Te.success("Link copied!")},children:r.jsx(Mo,{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: ${Xs}`;navigator.clipboard.writeText(Ot),Te.success("Message copied!")},children:[r.jsx(Bo,{className:"h-4 w-4"}),"Copy Text Message"]}),r.jsxs(X,{variant:"outline",className:"gap-2",onClick:()=>{u?y(!0):window.open(`mailto:${ie||""}?subject=${encodeURIComponent(be)}&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: ${Xs} Looking forward to connecting!`)}`)},children:[r.jsx(Nn,{className:"h-4 w-4"}),"Send Email"]})]}),u&&r.jsx(qae,{open:x,onOpenChange:y,contact:U?{id:U.id,first_name:U.first_name,last_name:U.last_name,email:ie||U.email||""}:ie?{id:"",first_name:(Q==null?void 0:Q.split(" ")[0])||"",last_name:(Q==null?void 0:Q.split(" ").slice(1).join(" "))||"",email:ie}:void 0,defaultSubject:be,defaultBody:`Hi ${(U==null?void 0:U.first_name)||(Q==null?void 0:Q.split(" ")[0])||""}, I put together a personalized presentation for you: ${Xs} 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"})]})]})]})})},PTe=({template:e,onSelect:t})=>r.jsx(He,{className:"hover:shadow-sm transition-shadow",children:r.jsxs(Xe,{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"})]})}),dtr=({userId:e,onSelect:t})=>{const[s,n]=A.useState(!1),[a,o]=A.useState([]),[l,i]=A.useState(!1),[u,m]=A.useState("");A.useEffect(()=>{!s||!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)}))},[s,e]);const x=a.filter(y=>!u||(y.title||y.recipient_name||"").toLowerCase().includes(u.toLowerCase()));return r.jsxs(Or,{open:s,onOpenChange:n,children:[r.jsx(vo,{asChild:!0,children:r.jsxs(X,{variant:"outline",size:"sm",className:"gap-1.5 shrink-0",children:[r.jsx(Id,{className:"h-3.5 w-3.5"}),"Library"]})}),r.jsxs(Pr,{className:"max-w-lg max-h-[70vh] flex flex-col",children:[r.jsxs(zr,{children:[r.jsx(Rr,{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(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ot,{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(Cr,{className:"h-16 w-full"}),r.jsx(Cr,{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||""),n(!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(Ta,{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))})]})]})},utr=()=>{var k;const{shareToken:e}=hc(),[t,s]=A.useState(null),[n,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:E}=await Y.from("smart_presentations").select("*").eq("share_token",e).eq("status","published").single();if(E||!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 R=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();R=D}s({...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:R?[R.first_name,R.last_name].filter(Boolean).join(" "):void 0,contact_email:(R==null?void 0:R.email)||void 0,contact_phone:(R==null?void 0:R.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(n)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(Cr,{className:"h-12 w-3/4 mx-auto"}),r.jsx(Cr,{className:"h-64 w-full"}),r.jsx(Cr,{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 E=M.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]+)/);if(E)return`https://www.youtube.com/embed/${E[1]}?rel=0`;if(M.includes("iframe.mediadelivery.net/play/")){const R=M.replace("/play/","/embed/"),D=R.includes("?")?"&":"?";return`${R}${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,E)=>r.jsx("button",{onClick:()=>l(E),className:Ut("w-full text-left p-4 rounded-xl border transition-all",o===E?"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(E+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})]})]})},E))})]}),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(Sn,{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(L8e,{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"})]})},ige="guestbook.relevelup.com";function htr(){const{data:e,isLoading:t}=ydt(),s=_dt(),n=bdt(),a=wdt(),[o,l]=A.useState(!1),[i,u]=A.useState(null),{user:m}=Yr(),[x,y]=A.useState(null),[v,b]=A.useState(null),[N,k]=A.useState(!1),M=A.useRef(null),[E,T]=A.useState({property_address:"",city:"",state:"",zip:"",event_date:rs(new Date,"yyyy-MM-dd"),start_time:"10:00",end_time:"14:00",agent_greeting:"Welcome! Please sign in below."}),P=q=>{var G;const H=(G=q.target.files)==null?void 0:G[0];if(H){if(H.size>5*1024*1024){Wn({title:"Photo must be under 5MB",variant:"destructive"});return}y(H),b(URL.createObjectURL(H))}},R=()=>{y(null),b(null),M.current&&(M.current.value="")},D=async()=>{if(!E.property_address){Wn({title:"Address is required",variant:"destructive"});return}let q;if(x&&m){k(!0);const H=x.name.split(".").pop(),G=`${m.id}/${Date.now()}.${H}`,{error:Q}=await Y.storage.from("open-house-photos").upload(G,x,{upsert:!0});if(Q){Wn({title:"Photo upload failed",description:Q.message,variant:"destructive"}),k(!1);return}const{data:ne}=Y.storage.from("open-house-photos").getPublicUrl(G);q=ne.publicUrl,k(!1)}await s.mutateAsync({...E,photo_url:q}),l(!1),T({property_address:"",city:"",state:"",zip:"",event_date:rs(new Date,"yyyy-MM-dd"),start_time:"10:00",end_time:"14:00",agent_greeting:"Welcome! Please sign in below."}),R()},U=q=>{navigator.clipboard.writeText(`https://${ige}/${q}`),Wn({title:"Link copied!"})};return r.jsxs(Dr,{title:"Guest Book",children:[r.jsx(Bh,{children:r.jsx("title",{children:"Guest Book | LevelUp"})}),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 font-serif text-foreground",children:"Guest Book"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:"The modern open house sign-in experience"})]}),r.jsxs(Or,{open:o,onOpenChange:l,children:[r.jsx(vo,{asChild:!0,children:r.jsxs(X,{children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"New Open House"]})}),r.jsxs(Pr,{className:"sm:max-w-lg",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"Create Open House"}),r.jsx(Zs,{children:"Set up a new open house sign-in page"})]}),r.jsxs("div",{className:"space-y-4 pt-2",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"Property Address *"}),r.jsx(ot,{value:E.property_address,onChange:q=>T(H=>({...H,property_address:q.target.value})),placeholder:"123 Main Street"})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"City"}),r.jsx(ot,{value:E.city,onChange:q=>T(H=>({...H,city:q.target.value})),placeholder:"Austin"})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"State"}),r.jsx(ot,{value:E.state,onChange:q=>T(H=>({...H,state:q.target.value})),placeholder:"TX",maxLength:2})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"ZIP"}),r.jsx(ot,{value:E.zip,onChange:q=>T(H=>({...H,zip:q.target.value})),placeholder:"78701"})]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"Date"}),r.jsx(ot,{type:"date",value:E.event_date,onChange:q=>T(H=>({...H,event_date:q.target.value}))})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Start Time"}),r.jsx(ot,{type:"time",value:E.start_time,onChange:q=>T(H=>({...H,start_time:q.target.value}))})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"End Time"}),r.jsx(ot,{type:"time",value:E.end_time,onChange:q=>T(H=>({...H,end_time:q.target.value}))})]})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Welcome Message"}),r.jsx(Ys,{value:E.agent_greeting,onChange:q=>T(H=>({...H,agent_greeting:q.target.value})),placeholder:"Welcome! Please sign in below."})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Property Photo"}),r.jsx("input",{ref:M,type:"file",accept:"image/*",onChange:P,className:"hidden"}),v?r.jsxs("div",{className:"relative mt-1 rounded-xl overflow-hidden border border-border",children:[r.jsx("img",{src:v,alt:"Property preview",className:"w-full h-40 object-cover"}),r.jsx("button",{type:"button",onClick:R,className:"absolute top-2 right-2 bg-black/60 hover:bg-black/80 text-white rounded-full p-1 transition-colors",children:r.jsx(en,{className:"h-4 w-4"})})]}):r.jsxs("button",{type:"button",onClick:()=>{var q;return(q=M.current)==null?void 0:q.click()},className:"mt-1 w-full h-32 rounded-xl border-2 border-dashed border-muted-foreground/25 hover:border-muted-foreground/50 flex flex-col items-center justify-center gap-2 text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx(Z1,{className:"h-6 w-6"}),r.jsx("span",{className:"text-sm",children:"Add a property photo"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Max 5MB"})]})]}),r.jsx(X,{onClick:D,disabled:s.isPending||N,className:"w-full",children:N?"Uploading photo...":s.isPending?"Creating...":"Create Open House"})]})]})]})]}),t?r.jsx("div",{className:"grid gap-4",children:[1,2].map(q=>r.jsx(He,{className:"animate-pulse",children:r.jsxs(Vt,{children:[r.jsx("div",{className:"h-5 bg-muted rounded w-48"}),r.jsx("div",{className:"h-4 bg-muted rounded w-32 mt-2"})]})},q))}):e!=null&&e.length?r.jsx("div",{className:"space-y-4",children:e.map(q=>r.jsx(mtr,{openHouse:q,isExpanded:i===q.id,onToggle:()=>u(i===q.id?null:q.id),onCopyLink:()=>U(q.slug||""),onToggleActive:()=>n.mutate({id:q.id,is_active:!q.is_active}),onDelete:()=>a.mutate(q.id)},q.id))}):r.jsx(He,{className:"border-dashed",children:r.jsxs(Xe,{className:"flex flex-col items-center justify-center py-16 text-center",children:[r.jsx("div",{className:"w-16 h-16 rounded-2xl bg-primary/10 flex items-center justify-center mb-4",children:r.jsx(Hj,{className:"h-8 w-8 text-primary"})}),r.jsx("h3",{className:"text-lg font-semibold mb-1",children:"No Open Houses Yet"}),r.jsx("p",{className:"text-muted-foreground text-sm max-w-sm mb-6",children:"Create your first open house to get a beautiful, mobile-friendly sign-in page with a shareable link and QR code."}),r.jsxs(X,{onClick:()=>l(!0),children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Create Your First Open House"]})]})})]})]})}function mtr({openHouse:e,isExpanded:t,onToggle:s,onCopyLink:n,onToggleActive:a,onDelete:o}){const{data:l}=vdt(t?e.id:void 0),[i,u]=A.useState(!1),[m,x]=A.useState(!1),y=A.useRef(null),v=`https://${ige}/${e.slug}`,b=T=>{if(!T)return"";const[P,R]=T.split(":"),D=parseInt(P),U=D>=12?"PM":"AM";return`${D>12?D-12:D||12}:${R} ${U}`},N=()=>{if(!(l!=null&&l.length))return;const T=["First Name","Last Name","Email","Phone","Intent","Wants Market Updates","Message","Signed In"],P=l.map(H=>[H.first_name,H.last_name||"",H.email||"",H.phone||"",H.visitor_intent||"",H.wants_market_updates?"Yes":"No",(H.message||"").replace(/"/g,'""'),rs(new Date(H.created_at),"MM/dd/yyyy h:mm a")]),R=[T,...P].map(H=>H.map(G=>`"${G}"`).join(",")).join(` `),D=new Blob([R],{type:"text/csv"}),U=URL.createObjectURL(D),q=document.createElement("a");q.href=U,q.download=`${e.property_address.replace(/[^a-zA-Z0-9]/g,"-")}-visitors.csv`,q.click(),URL.revokeObjectURL(U)},k=A.useCallback(()=>{if(!y.current)return;const T=y.current.querySelector("svg");if(!T)return;const P=new XMLSerializer().serializeToString(T),R=document.createElement("canvas");R.width=1024,R.height=1024;const D=R.getContext("2d"),U=new Image;U.onload=()=>{D==null||D.drawImage(U,0,0,1024,1024);const q=document.createElement("a");q.download=`${e.property_address.replace(/[^a-zA-Z0-9]/g,"-")}-qr.png`,q.href=R.toDataURL("image/png"),q.click()},U.src="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(P)))},[e.property_address]),M=A.useCallback(()=>{if(!y.current)return;const T=y.current.querySelector("svg");if(!T)return;const P=new XMLSerializer().serializeToString(T),R="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(P))),D=rs(new Date(e.event_date+"T00:00:00"),"EEEE, MMMM d, yyyy"),U=e.start_time?`${b(e.start_time)}${e.end_time?" – "+b(e.end_time):""}`:"",q=[e.city,e.state].filter(Boolean).join(", "),H=e.agent_greeting||"Welcome! Please sign in below.",G=window.open("","_blank");G&&(G.document.write(` Open House – ${e.property_address}
Open House
${e.property_address}
${q?`
${q}${e.zip?" "+e.zip:""}
`:""}
Date
${D}
${U?`
Time
${U}
`:""}
${H}
QR Code
Scan to Sign In
Point your phone camera at the QR code
`),G.document.close(),setTimeout(()=>{G.focus(),G.print()},500))},[e,v]),E=async()=>{x(!0);try{const{error:T}=await Y.functions.invoke("guestbook-email-link",{body:{openHouseId:e.id}});if(T)throw T;Wn({title:"Email sent!",description:"Check your inbox for the guest book link."})}catch(T){Wn({title:"Failed to send",description:T.message,variant:"destructive"})}finally{x(!1)}};return r.jsxs(He,{className:`transition-all ${e.is_active?"border-primary/30":"opacity-75"}`,children:[r.jsx(Vt,{className:"pb-3",children:r.jsxs("div",{className:"flex items-start justify-between gap-4",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(Gt,{className:"text-base truncate",children:e.property_address}),r.jsx(Tt,{variant:e.is_active?"default":"secondary",className:"shrink-0",children:e.is_active?"Active":"Inactive"})]}),r.jsxs(Ns,{className:"flex flex-wrap items-center gap-3 text-xs",children:[e.city&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(po,{className:"h-3 w-3"}),e.city,e.state?`, ${e.state}`:""]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(jn,{className:"h-3 w-3"}),rs(new Date(e.event_date+"T00:00:00"),"MMM d, yyyy")]}),e.start_time&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ra,{className:"h-3 w-3"}),b(e.start_time),e.end_time?` - ${b(e.end_time)}`:""]}),r.jsxs("span",{className:"flex items-center gap-1 font-medium",children:[r.jsx(qs,{className:"h-3 w-3"}),e.visitor_count," visitors"]})]})]}),r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.jsx(X,{variant:"ghost",size:"icon",onClick:n,title:"Copy link",children:r.jsx(Mo,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>u(!0),title:"QR Code",children:r.jsx(Hj,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:()=>window.open(v,"_blank"),title:"Preview",children:r.jsx(Sn,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:a,title:e.is_active?"Deactivate":"Activate",children:e.is_active?r.jsx(Ef,{className:"h-4 w-4"}):r.jsx(mo,{className:"h-4 w-4"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:o,title:"Delete",children:r.jsx(Bs,{className:"h-4 w-4 text-destructive"})}),r.jsx(X,{variant:"ghost",size:"icon",onClick:s,children:t?r.jsx(zg,{className:"h-4 w-4"}):r.jsx(gd,{className:"h-4 w-4"})})]})]})}),t&&r.jsxs(Xe,{className:"pt-0",children:[r.jsx(pd,{className:"mb-4"}),r.jsxs("div",{className:"mb-3",children:[r.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Share Link"}),r.jsxs("code",{className:"text-xs bg-muted/50 px-2 py-1 rounded block truncate",children:["https://",ige,"/",e.slug]})]}),l!=null&&l.length?r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:[l.length," Visitor",l.length!==1?"s":""]}),r.jsxs(X,{variant:"outline",size:"sm",onClick:N,className:"h-7 text-xs gap-1",children:[r.jsx($i,{className:"h-3 w-3"}),"Export CSV"]})]}),r.jsx("div",{className:"rounded-lg border overflow-hidden",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"bg-muted/30 text-xs text-muted-foreground",children:[r.jsx("th",{className:"text-left p-2 font-medium",children:"Name"}),r.jsx("th",{className:"text-left p-2 font-medium hidden sm:table-cell",children:"Contact"}),r.jsx("th",{className:"text-left p-2 font-medium hidden md:table-cell",children:"Intent"}),r.jsx("th",{className:"text-left p-2 font-medium",children:"Time"})]})}),r.jsx("tbody",{children:l.map(T=>r.jsxs("tr",{className:"border-t border-border/50",children:[r.jsxs("td",{className:"p-2 font-medium",children:[T.first_name,T.last_name?` ${T.last_name}`:""]}),r.jsxs("td",{className:"p-2 text-muted-foreground hidden sm:table-cell",children:[T.email&&r.jsx("div",{className:"truncate max-w-[180px]",children:T.email}),T.phone&&r.jsx("div",{className:"text-xs",children:T.phone})]}),r.jsx("td",{className:"p-2 hidden md:table-cell",children:T.visitor_intent&&r.jsx(Tt,{variant:"outline",className:"text-xs capitalize",children:T.visitor_intent})}),r.jsx("td",{className:"p-2 text-xs text-muted-foreground",children:rs(new Date(T.created_at),"h:mm a")})]},T.id))})]})})]}):r.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:"No visitors yet. Share the link to start collecting sign-ins!"})]}),r.jsx(Or,{open:i,onOpenChange:u,children:r.jsxs(Pr,{className:"sm:max-w-sm",children:[r.jsxs(zr,{children:[r.jsx(Rr,{children:"QR Code"}),r.jsx(Zs,{className:"truncate",children:e.property_address})]}),r.jsxs("div",{className:"flex flex-col items-center gap-4 py-4",children:[r.jsx("div",{ref:y,className:"bg-white p-4 rounded-xl",children:r.jsx(cve,{value:v,size:240,level:"H"})}),r.jsx("p",{className:"text-xs text-muted-foreground text-center break-all",children:v}),r.jsxs("div",{className:"flex gap-2 w-full",children:[r.jsxs(X,{variant:"outline",className:"flex-1",onClick:k,children:[r.jsx($i,{className:"h-4 w-4 mr-2"}),"Download"]}),r.jsxs(X,{variant:"outline",className:"flex-1",onClick:M,children:[r.jsx(jA,{className:"h-4 w-4 mr-2"}),"Print Flyer"]})]}),r.jsxs(X,{variant:"default",className:"w-full",onClick:E,disabled:m,children:[r.jsx(Nn,{className:"h-4 w-4 mr-2"}),m?"Sending...":"Email Link to Me"]})]})]})})]})}const ptr=Ev({first_name:Oo().trim().min(1,"First name is required").max(50),last_name:Oo().trim().max(50).optional(),email:Oo().trim().email("Please enter a valid email").max(255).optional().or($C("")),phone:Oo().trim().max(20).optional().or($C(""))}),ftr=[{value:"buying",label:"Looking to Buy",emoji:"🏠"},{value:"selling",label:"Thinking of Selling",emoji:"📋"},{value:"browsing",label:"Just Browsing",emoji:"👀"},{value:"neighbor",label:"I'm a Neighbor",emoji:"👋"}];function gtr(){var R;const{slug:e}=hc(),{data:t,isLoading:s,error:n}=O8e(e),a=D8e(),[o,l]=A.useState("welcome"),[i,u]=A.useState({first_name:"",last_name:"",email:"",phone:""}),[m,x]=A.useState(""),[y,v]=A.useState(!1),[b,N]=A.useState(""),k=D=>{if(!D)return"";const[U,q]=D.split(":"),H=parseInt(U),G=H>=12?"PM":"AM";return`${H>12?H-12:H||12}:${q} ${G}`},M=()=>{N("");const D=ptr.safeParse(i);if(!D.success){N(D.error.issues[0].message);return}if(!i.email&&!i.phone){N("Please provide either an email or phone number");return}l("intent")},E=async D=>{x(D);try{await a.mutateAsync({open_house_id:t.id,first_name:i.first_name.trim(),last_name:i.last_name.trim()||void 0,email:i.email.trim()||void 0,phone:i.phone.trim()||void 0,visitor_intent:D,wants_market_updates:y}),l("done")}catch{N("Something went wrong. Please try again.")}};if(s)return r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center",children:r.jsx("div",{className:"w-10 h-10 border-4 border-white/20 border-t-white rounded-full animate-spin"})});if(n||!t)return r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center p-6",children:r.jsxs("div",{className:"text-center text-white",children:[r.jsx(sa,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Open House Not Found"}),r.jsx("p",{className:"text-white/60",children:"This sign-in page doesn't exist or is no longer active."})]})});const T=t.profiles,P=((R=T==null?void 0:T.name)==null?void 0:R.split(" ").map(D=>D[0]).join("").slice(0,2))||"?";return r.jsxs(r.Fragment,{children:[r.jsxs(Bh,{children:[r.jsxs("title",{children:["Open House | ",t.property_address]}),r.jsx("meta",{name:"description",content:`Sign in to the open house at ${t.property_address}`}),r.jsx("meta",{name:"robots",content:"noindex, nofollow"})]}),r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center p-4",children:r.jsxs("div",{className:"w-full max-w-md",children:[r.jsxs("div",{className:"text-center mb-6",children:[r.jsxs(Xn,{className:"h-16 w-16 mx-auto mb-3 ring-2 ring-white/20",children:[r.jsx(ji,{src:(T==null?void 0:T.avatar_url)||"",alt:(T==null?void 0:T.name)||""}),r.jsx(Qn,{className:"bg-white/10 text-white text-lg",children:P})]}),r.jsx("p",{className:"text-white/60 text-sm",children:T==null?void 0:T.name}),(T==null?void 0:T.title)&&r.jsx("p",{className:"text-white/40 text-xs",children:T.title})]}),r.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl overflow-hidden",children:[t.photo_url&&r.jsxs("div",{className:"relative h-44 sm:h-52 overflow-hidden",children:[r.jsx("img",{src:t.photo_url,alt:t.property_address,className:"w-full h-full object-cover"}),r.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-slate-900/80 via-slate-900/20 to-transparent"}),r.jsxs("div",{className:"absolute bottom-0 left-0 right-0 px-6 pb-4",children:[r.jsx("h1",{className:"text-white font-bold text-lg leading-tight drop-shadow-md",children:t.property_address}),r.jsxs("div",{className:"flex flex-wrap gap-3 mt-1.5 text-white/70 text-xs",children:[t.city&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(po,{className:"h-3 w-3"}),t.city,t.state?`, ${t.state}`:""," ",t.zip]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(jn,{className:"h-3 w-3"}),rs(new Date(t.event_date+"T00:00:00"),"MMM d, yyyy")]}),t.start_time&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ra,{className:"h-3 w-3"}),k(t.start_time),t.end_time?` – ${k(t.end_time)}`:""]})]})]})]}),!t.photo_url&&r.jsx("div",{className:"bg-gradient-to-r from-slate-800 to-slate-700 px-6 py-5",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-white/10 flex items-center justify-center shrink-0 mt-0.5",children:r.jsx(sa,{className:"h-5 w-5 text-white"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-white font-bold text-lg leading-tight",children:t.property_address}),r.jsxs("div",{className:"flex flex-wrap gap-3 mt-2 text-white/60 text-xs",children:[t.city&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(po,{className:"h-3 w-3"}),t.city,t.state?`, ${t.state}`:""," ",t.zip]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(jn,{className:"h-3 w-3"}),rs(new Date(t.event_date+"T00:00:00"),"MMM d, yyyy")]}),t.start_time&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ra,{className:"h-3 w-3"}),k(t.start_time),t.end_time?` – ${k(t.end_time)}`:""]})]})]})]})}),r.jsxs("div",{className:"p-6",children:[o==="welcome"&&r.jsxs("div",{className:"text-center space-y-6",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-xl font-bold text-slate-900 mb-2",children:"Welcome!"}),r.jsx("p",{className:"text-slate-500 text-sm",children:t.agent_greeting||"Please sign in below."})]}),r.jsxs(X,{onClick:()=>l("info"),className:"w-full h-14 text-base bg-slate-900 hover:bg-slate-800 text-white rounded-xl",children:["Sign In ",r.jsx(to,{className:"h-5 w-5 ml-2"})]}),r.jsx("p",{className:"text-xs text-slate-400",children:"Quick & easy — takes 30 seconds"})]}),o==="info"&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("button",{onClick:()=>l("welcome"),className:"text-slate-400 hover:text-slate-600",children:r.jsx(wi,{className:"h-4 w-4"})}),r.jsx("h2",{className:"text-lg font-bold text-slate-900",children:"Your Info"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx(ze,{className:"text-slate-600 text-xs",children:"First Name *"}),r.jsx(ot,{value:i.first_name,onChange:D=>u(U=>({...U,first_name:D.target.value})),placeholder:"First",className:"mt-1 h-12 rounded-xl border-slate-200 text-base",autoFocus:!0})]}),r.jsxs("div",{children:[r.jsx(ze,{className:"text-slate-600 text-xs",children:"Last Name"}),r.jsx(ot,{value:i.last_name,onChange:D=>u(U=>({...U,last_name:D.target.value})),placeholder:"Last",className:"mt-1 h-12 rounded-xl border-slate-200 text-base"})]})]}),r.jsxs("div",{children:[r.jsx(ze,{className:"text-slate-600 text-xs",children:"Email"}),r.jsx(ot,{type:"email",value:i.email,onChange:D=>u(U=>({...U,email:D.target.value})),placeholder:"your@email.com",className:"mt-1 h-12 rounded-xl border-slate-200 text-base"})]}),r.jsxs("div",{children:[r.jsx(ze,{className:"text-slate-600 text-xs",children:"Phone"}),r.jsx(ot,{type:"tel",value:i.phone,onChange:D=>u(U=>({...U,phone:D.target.value})),placeholder:"(555) 123-4567",className:"mt-1 h-12 rounded-xl border-slate-200 text-base"})]}),r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer pt-1",children:[r.jsx("input",{type:"checkbox",checked:y,onChange:D=>v(D.target.checked),className:"rounded border-slate-300 text-slate-900 focus:ring-slate-500"}),r.jsx("span",{className:"text-sm text-slate-600",children:"Send me market updates for this area"})]}),b&&r.jsx("p",{className:"text-destructive text-sm",children:b}),r.jsxs(X,{onClick:M,className:"w-full h-14 text-base bg-slate-900 hover:bg-slate-800 text-white rounded-xl",children:["Continue ",r.jsx(to,{className:"h-5 w-5 ml-2"})]})]}),o==="intent"&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("button",{onClick:()=>l("info"),className:"text-slate-400 hover:text-slate-600",children:r.jsx(wi,{className:"h-4 w-4"})}),r.jsx("h2",{className:"text-lg font-bold text-slate-900",children:"What brings you here?"})]}),r.jsx("div",{className:"grid grid-cols-2 gap-3",children:ftr.map(D=>r.jsxs("button",{onClick:()=>E(D.value),disabled:a.isPending,className:"flex flex-col items-center gap-2 p-5 rounded-xl border-2 border-slate-200 hover:border-slate-900 hover:bg-slate-50 transition-all text-center group",children:[r.jsx("span",{className:"text-2xl",children:D.emoji}),r.jsx("span",{className:"text-sm font-medium text-slate-700 group-hover:text-slate-900",children:D.label})]},D.value))}),b&&r.jsx("p",{className:"text-destructive text-sm text-center",children:b})]}),o==="done"&&r.jsxs("div",{className:"text-center space-y-4 py-4",children:[r.jsx("div",{className:"w-16 h-16 rounded-full bg-green-100 flex items-center justify-center mx-auto",children:r.jsx(Ki,{className:"h-8 w-8 text-green-600"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-xl font-bold text-slate-900",children:"You're all set!"}),r.jsxs("p",{className:"text-slate-500 text-sm mt-1",children:["Thanks for signing in, ",i.first_name,". Enjoy the open house!"]})]}),(T==null?void 0:T.name)&&r.jsxs("p",{className:"text-sm text-slate-400",children:["Your host today: ",r.jsx("strong",{className:"text-slate-600",children:T.name})]})]})]})]}),r.jsx("p",{className:"text-center text-white/30 text-xs mt-6",children:"Powered by LevelUp Guest Book"})]})})]})}const xtr=()=>{const e=Em();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"})]})})},ytr=new Mtt,vtr=()=>{const e=window.location.hostname;return e==="listings.relevelup.com"||e.startsWith("listings.")},_tr=()=>{const e=window.location.hostname;return e==="cards.relevelup.com"||e.startsWith("cards.")},btr=()=>{const e=window.location.hostname;return e==="presentations.relevelup.com"||e.startsWith("presentations.")},wtr=()=>{const e=window.location.hostname;return e==="guestbook.relevelup.com"||e.startsWith("guestbook.")},jtr=()=>r.jsx(Ptt,{client:ytr,children:r.jsx(YPe,{children:r.jsxs(sP,{children:[r.jsx(WQe,{}),r.jsx(kJe,{}),r.jsx(Wrt,{children:r.jsx(Xat,{children:r.jsx(Qat,{children:r.jsxs(eit,{children:[r.jsx(Jat,{}),r.jsx(Ilt,{}),r.jsx(Klt,{}),_tr()?r.jsx(mdt,{}):vtr()?r.jsx(Oct,{}):btr()?r.jsx(gdt,{}):wtr()?r.jsx(omt,{}):r.jsxs(Frt,{children:[r.jsx(ss,{path:"/",element:r.jsx(bmt,{})}),r.jsx(ss,{path:"/privacy-policy",element:r.jsx(wmt,{})}),r.jsx(ss,{path:"/terms-of-service",element:r.jsx(jmt,{})}),r.jsx(ss,{path:"/data-deletion",element:r.jsx(kmt,{})}),r.jsx(ss,{path:"/public/listings",element:r.jsx(C8e,{})}),r.jsx(ss,{path:"/public/listing/:slugOrId",element:r.jsx(Sgt,{})}),r.jsx(ss,{path:"/card/:slug",element:r.jsx(Cgt,{})}),r.jsx(ss,{path:"/auth",element:r.jsx(Smt,{})}),r.jsx(ss,{path:"/subscription-success",element:r.jsx(Cmt,{})}),r.jsx(ss,{path:"/subscription",element:r.jsx(ks,{children:r.jsx(Lft,{})})}),r.jsx(ss,{path:"/share/video",element:r.jsx(wgt,{}),children:r.jsx(ss,{path:":shareToken",element:r.jsx(bgt,{})})}),r.jsx(ss,{path:"/p/:shareToken",element:r.jsx(utr,{})}),r.jsx(ss,{path:"/og/video/:token",element:r.jsx(jgt,{})}),r.jsx(ss,{path:"/setup-brokerage",element:r.jsx(ks,{children:r.jsx(Oft,{})})}),r.jsx(ss,{path:"/claim-account",element:r.jsx(HNe,{})}),r.jsx(ss,{path:"/claim",element:r.jsx(HNe,{})}),r.jsx(ss,{path:"/join",element:r.jsx(Dft,{})}),r.jsx(ss,{path:"/trial",element:r.jsx(Gft,{})}),r.jsx(ss,{path:"/trial/success",element:r.jsx(Kft,{})}),r.jsx(ss,{path:"/dashboard",element:r.jsx(ks,{children:r.jsx(Ext,{})})}),r.jsx(ss,{path:"/profile",element:r.jsx(ks,{children:r.jsx(_jt,{})})}),r.jsx(ss,{path:"/apps",element:r.jsx(ks,{children:r.jsx(Pjt,{})})}),r.jsx(ss,{path:"/admin",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(y4t,{})})}),r.jsx(ss,{path:"/admin/apps",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(b4t,{})})}),r.jsx(ss,{path:"/admin/members",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(S4t,{})})}),r.jsx(ss,{path:"/admin/invite-codes",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(C4t,{})})}),r.jsx(ss,{path:"/admin/events",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(I4t,{})})}),r.jsx(ss,{path:"/events",element:r.jsx(ks,{children:r.jsx(Ajt,{})})}),r.jsx(ss,{path:"/events/:eventId",element:r.jsx(ks,{children:r.jsx(Ijt,{})})}),r.jsx(ss,{path:"/templates",element:r.jsx(ks,{children:r.jsx(Ljt,{})})}),r.jsx(ss,{path:"/templates/:templateId",element:r.jsx(ks,{children:r.jsx(Fjt,{})})}),r.jsx(ss,{path:"/admin/templates",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(P4t,{})})}),r.jsx(ss,{path:"/academy",element:r.jsx(ks,{children:r.jsx(zjt,{})})}),r.jsx(ss,{path:"/academy/:videoId",element:r.jsx(ks,{children:r.jsx($jt,{})})}),r.jsx(ss,{path:"/admin/academy",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(O4t,{})})}),r.jsx(ss,{path:"/toolbox",element:r.jsx(ks,{children:r.jsx(Ujt,{})})}),r.jsx(ss,{path:"/toolbox/:kitId",element:r.jsx(ks,{children:r.jsx(qjt,{})})}),r.jsx(ss,{path:"/admin/toolbox",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(D4t,{})})}),r.jsx(ss,{path:"/social-swag",element:r.jsx(ks,{children:r.jsx(Vjt,{})})}),r.jsx(ss,{path:"/social-swag-2",element:r.jsx(ks,{children:r.jsx(UNt,{})})}),r.jsx(ss,{path:"/social-swag/:swagId",element:r.jsx(ks,{children:r.jsx(qNt,{})})}),r.jsx(ss,{path:"/social-connections",element:r.jsx(ks,{children:r.jsx(Her,{})})}),r.jsx(ss,{path:"/social-connections/callback",element:r.jsx(ks,{children:r.jsx(Wer,{})})}),r.jsx(ss,{path:"/social-connections/linkedin-callback",element:r.jsx(ks,{children:r.jsx(Ker,{})})}),r.jsx(ss,{path:"/social-connections/google-callback",element:r.jsx(ks,{children:r.jsx(Ger,{})})}),r.jsx(ss,{path:"/admin/social-swag",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(R4t,{})})}),r.jsx(ss,{path:"/admin/social-swag-2",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(kCt,{})})}),r.jsx(ss,{path:"/community",element:r.jsx(ks,{children:r.jsx(l4t,{})})}),r.jsx(ss,{path:"/support",element:r.jsx(ks,{children:r.jsx(c4t,{})})}),r.jsx(ss,{path:"/admin/community",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(NCt,{})})}),r.jsx(ss,{path:"/admin/support-tickets",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(PCt,{})})}),r.jsx(ss,{path:"/admin/email-templates",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(DCt,{})})}),r.jsx(ss,{path:"/admin/agent-email-templates",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(RCt,{})})}),r.jsx(ss,{path:"/admin/analytics",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(ACt,{})})}),r.jsx(ss,{path:"/admin/brokerage-resources",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(ECt,{})})}),r.jsx(ss,{path:"/admin/dashboard-management",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(ICt,{})})}),r.jsx(ss,{path:"/brokerage/dashboard",element:r.jsx(ks,{requireBrokerageManager:!0,children:r.jsx(KCt,{})})}),r.jsx(ss,{path:"/my-brokerage",element:r.jsx(ks,{children:r.jsx(e3t,{})})}),r.jsx(ss,{path:"/brokerage-resources",element:r.jsx(ks,{requireBrokerageManager:!0,children:r.jsx(f4t,{})})}),r.jsx(ss,{path:"/brokerage-resources/:resourceId",element:r.jsx(ks,{requireBrokerageManager:!0,children:r.jsx(g4t,{})})}),r.jsx(ss,{path:"/newsletters",element:r.jsx(ks,{children:r.jsx(t3t,{})})}),r.jsx(ss,{path:"/newsletters/:id",element:r.jsx(ks,{children:r.jsx(s3t,{})})}),r.jsx(ss,{path:"/wishlist",element:r.jsx(ks,{children:r.jsx(i3t,{})})}),r.jsx(ss,{path:"/wishlist/:itemId",element:r.jsx(ks,{children:r.jsx(o3t,{})})}),r.jsx(ss,{path:"/admin/wishlist",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(l3t,{})})}),r.jsx(ss,{path:"/admin/levelup-brief",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(c3t,{})})}),r.jsx(ss,{path:"/admin/newsletters",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(a3t,{})})}),r.jsx(ss,{path:"/admin/additional-services",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(d3t,{})})}),r.jsx(ss,{path:"/admin/discounts",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(u3t,{})})}),r.jsx(ss,{path:"/admin/subscriptions",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(h3t,{})})}),r.jsx(ss,{path:"/admin/referrals",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(m3t,{})})}),r.jsx(ss,{path:"/admin/onboarding-checklist",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(f3t,{})})}),r.jsx(ss,{path:"/admin/marketplace",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(wer,{})})}),r.jsx(ss,{path:"/admin/agent-points",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(WJt,{})})}),r.jsx(ss,{path:"/admin/reward-store",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(Rer,{})})}),r.jsx(ss,{path:"/admin/integrations",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(zer,{})})}),r.jsx(ss,{path:"/admin/integrations/callback",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(Ver,{})})}),r.jsx(ss,{path:"/reward-store",element:r.jsx(ks,{children:r.jsx(rtr,{})})}),r.jsx(ss,{path:"/additional-services",element:r.jsx(ks,{children:r.jsx(S3t,{})})}),r.jsx(ss,{path:"/additional-services/:serviceId",element:r.jsx(ks,{children:r.jsx(C3t,{})})}),r.jsx(ss,{path:"/ai-toolkit",element:r.jsx(ks,{children:r.jsx(M3t,{})})}),r.jsx(ss,{path:"/mission-control",element:r.jsx(ks,{children:r.jsx(U3t,{})})}),r.jsx(ss,{path:"/mission-control/contacts",element:r.jsx(ks,{children:r.jsx(o5t,{})})}),r.jsx(ss,{path:"/mission-control/contacts/:contactId",element:r.jsx(ks,{children:r.jsx(_5t,{})})}),r.jsx(ss,{path:"/mission-control/plans",element:r.jsx(ks,{children:r.jsx(b5t,{})})}),r.jsx(ss,{path:"/mission-control/popbys",element:r.jsx(ks,{children:r.jsx(k5t,{})})}),r.jsx(ss,{path:"/mission-control/popbys/map",element:r.jsx(ks,{children:r.jsx(N5t,{})})}),r.jsx(ss,{path:"/admin/notification-settings",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx($er,{})})}),r.jsx(ss,{path:"/admin/agent-os",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(x3t,{})})}),r.jsx(ss,{path:"/mission-control/listings",element:r.jsx(ks,{children:r.jsx(dQt,{})})}),r.jsx(ss,{path:"/mission-control/listings/new",element:r.jsx(ks,{children:r.jsx(jTe,{})})}),r.jsx(ss,{path:"/mission-control/listings/:listingId",element:r.jsx(ks,{children:r.jsx(NQt,{})})}),r.jsx(ss,{path:"/mission-control/listings/:listingId/edit",element:r.jsx(ks,{children:r.jsx(jTe,{})})}),r.jsx(ss,{path:"/admin/listing-exchange",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(BJt,{})})}),r.jsx(ss,{path:"/mission-control/pipeline",element:r.jsx(ks,{children:r.jsx(nJt,{})})}),r.jsx(ss,{path:"/mission-control/my-card",element:r.jsx(ks,{children:r.jsx(kJt,{})})}),r.jsx(ss,{path:"/mission-control/integrations",element:r.jsx(ks,{children:r.jsx(IJt,{})})}),r.jsx(ss,{path:"/mission-control/integrations/gmail/callback",element:r.jsx(ks,{children:r.jsx(PJt,{})})}),r.jsx(ss,{path:"/mission-control/integrations/canva/callback",element:r.jsx(LJt,{})}),r.jsx(ss,{path:"/mission-control/integrations/meta/callback",element:r.jsx(ks,{children:r.jsx(OJt,{})})}),r.jsx(ss,{path:"/mission-control/scorecard",element:r.jsx(ks,{children:r.jsx(eQt,{})})}),r.jsx(ss,{path:"/admin/scorecard",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(RJt,{})})}),r.jsx(ss,{path:"/admin/scorecard/:userId",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(zJt,{})})}),r.jsx(ss,{path:"/admin/membership-reviews",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx($Jt,{})})}),r.jsx(ss,{path:"/admin/weekly-digest",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(VJt,{})})}),r.jsx(ss,{path:"/mission-control/video/record",element:r.jsx(ks,{children:r.jsx(PQt,{})})}),r.jsx(ss,{path:"/mission-control/video-library",element:r.jsx(ks,{children:r.jsx(FQt,{})})}),r.jsx(ss,{path:"/marketplace",element:r.jsx(ks,{children:r.jsx(Zer,{})})}),r.jsx(ss,{path:"/marketplace/:productId",element:r.jsx(ks,{children:r.jsx(Yer,{})})}),r.jsx(ss,{path:"/marketplace/cart",element:r.jsx(ks,{children:r.jsx(Xer,{})})}),r.jsx(ss,{path:"/marketplace/orders",element:r.jsx(ks,{children:r.jsx(Qer,{})})}),r.jsx(ss,{path:"/marketplace/orders/:orderId",element:r.jsx(ks,{children:r.jsx(etr,{})})}),r.jsx(ss,{path:"/marketplace/success",element:r.jsx(ks,{children:r.jsx(ttr,{})})}),r.jsx(ss,{path:"/admin/agent-cards",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(GJt,{})})}),r.jsx(ss,{path:"/admin/presentation-analytics",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(Uer,{})})}),r.jsx(ss,{path:"/admin/guest-book-analytics",element:r.jsx(ks,{requireAdmin:!0,children:r.jsx(qer,{})})}),r.jsx(ss,{path:"/mission-control/presentations",element:r.jsx(ks,{children:r.jsx(atr,{})})}),r.jsx(ss,{path:"/mission-control/presentations/new",element:r.jsx(ks,{children:r.jsx(ITe,{})})}),r.jsx(ss,{path:"/mission-control/presentations/:id",element:r.jsx(ks,{children:r.jsx(ITe,{})})}),r.jsx(ss,{path:"/mission-control/guest-book",element:r.jsx(ks,{children:r.jsx(htr,{})})}),r.jsx(ss,{path:"/guestbook/:slug",element:r.jsx(gtr,{})}),r.jsx(ss,{path:"*",element:r.jsx(xtr,{})})]}),")"]})})})})]})})});sIe(document.getElementById("root")).render(r.jsx(jtr,{}));