PageSourceSearch

https://novio-lovat.vercel.app/assets/index-Wq4JjRAQ.js

js novio-lovat.vercel.app collected 2026-10-03 07:24:33 UTC 923,184 bytes, 738 lines download raw bytes

vendor: 8,527 bytes, lines 1-17
1function _1(a,r){for(var i=0;i<r.length;i++){const o=r[i];if(typeof o!="string"&&!Array.isArray(o)){for(const c in o)if(c!=="default"&&!(c in a)){const m=Object.getOwnPropertyDescriptor(o,c);m&&Object.defineProperty(a,c,m.get?m:{enumerable:!0,get:()=>o[c]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const m of c)if(m.type==="childList")for(const u of m.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&o(u)}).observe(document,{childList:!0,subtree:!0});function i(c){const m={};return c.integrity&&(m.integrity=c.integrity),c.referrerPolicy&&(m.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?m.credentials="include":c.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function o(c){if(c.ep)return;c.ep=!0;const m=i(c);fetch(c.href,m)}})();function s0(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var jm={exports:{}},Si={};/**
2 * @license React
3 * react-jsx-runtime.production.js
4 *
5 * Copyright (c) Meta Platforms, Inc. and affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var Kg;function D1(){if(Kg)return Si;Kg=1;var a=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(o,c,m){var u=null;if(m!==void 0&&(u=""+m),c.key!==void 0&&(u=""+c.key),"key"in c){m={};for(var g in c)g!=="key"&&(m[g]=c[g])}else m=c;return c=m.ref,{$$typeof:a,type:o,key:u,ref:c!==void 0?c:null,props:m}}return Si.Fragment=r,Si.jsx=i,Si.jsxs=i,Si}var Zg;function E1(){return Zg||(Zg=1,jm.exports=D1()),jm.exports}var e=E1(),Nm={exports:{}},Xe={};/**
10 * @license React
11 * react.production.js
12 *
13 * Copyright (c) Meta Platforms, Inc. and affiliates.
14 *
15 * This source code is licensed under the MIT license found in the
16 * LICENSE file in the root directory of this source tree.
17 */var Qg;function M1(){if(Qg)return Xe;Qg=1;var a=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),u=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.iterator;function w(T){return T===null||typeof T!="object"?null:(T=v&&T[v]||T["@@iterator"],typeof T=="function"?T:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D=Object.assign,b={};function E(T,B,ee){this.props=T,this.context=B,this.refs=b,this.updater=ee||N}E.prototype.isReactComponent={},E.prototype.setState=function(T,B){if(typeof T!="object"&&typeof T!="function"&&T!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,T,B,"setState")},E.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function _(){}_.prototype=E.prototype;function M(T,B,ee){this.props=T,this.context=B,this.refs=b,this.updater=ee||N}var k=M.prototype=new _;k.constructor=M,D(k,E.prototype),k.isPureReactComponent=!0;var C=Array.isArray,j={H:null,A:null,T:null,S:null,V:null},O=Object.prototype.hasOwnProperty;function L(T,B,ee,te,ye,ge){return ee=ge.ref,{$$typeof:a,type:T,key:B,ref:ee!==void 0?ee:null,props:ge}}function R(T,B){return L(T.type,B,void 0,void 0,void 0,T.props)}function H(T){return typeof T=="object"&&T!==null&&T.$$typeof===a}function z(T){var B={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(ee){return B[ee]})}var V=/\/+/g;function Z(T,B){return typeof T=="object"&&T!==null&&T.key!=null?z(""+T.key):B.toString(36)}function I(){}function ue(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(I,I):(T.status="pending",T.then(function(B){T.status==="pending"&&(T.status="fulfilled",T.value=B)},function(B){T.status==="pending"&&(T.status="rejected",T.reason=B)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function X(T,B,ee,te,ye){var ge=typeof T;(ge==="undefined"||ge==="boolean")&&(T=null);var K=!1;if(T===null)K=!0;else switch(ge){case"bigint":case"string":case"number":K=!0;break;case"object":switch(T.$$typeof){case a:case r:K=!0;break;case y:return K=T._init,X(K(T._payload),B,ee,te,ye)}}if(K)return ye=ye(T),K=te===""?"."+Z(T,0):te,C(ye)?(ee="",K!=null&&(ee=K.replace(V,"$&/")+"/"),X(ye,B,ee,"",function(Ae){return Ae})):ye!=null&&(H(ye)&&(ye=R(ye,ee+(ye.key==null||T&&T.key===ye.key?"":(""+ye.key).replace(V,"$&/")+"/")+K)),B.push(ye)),1;K=0;var re=te===""?".":te+":";if(C(T))for(var je=0;je<T.length;je++)te=T[je],ge=re+Z(te,je),K+=X(te,B,ee,ge,ye);else if(je=w(T),typeof je=="function")for(T=je.call(T),je=0;!(te=T.next()).done;)te=te.value,ge=re+Z(te,je++),K+=X(te,B,ee,ge,ye);else if(ge==="object"){if(typeof T.then=="function")return X(ue(T),B,ee,te,ye);throw B=String(T),Error("Objects are not valid as a React child (found: "+(B==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":B)+"). If you meant to render a collection of children, use an array instead.")}return K}function P(T,B,ee){if(T==null)return T;var te=[],ye=0;return X(T,te,"","",function(ge){return B.call(ee,ge,ye++)}),te}function $(T){if(T._status===-1){var B=T._result;B=B(),B.then(function(ee){(T._status===0||T._status===-1)&&(T._status=1,T._result=ee)},function(ee){(T._status===0||T._status===-1)&&(T._status=2,T._result=ee)}),T._status===-1&&(T._status=0,T._result=B)}if(T._status===1)return T._result.default;throw T._result}var F=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var B=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(B))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)};function ne(){}return Xe.Children={map:P,forEach:function(T,B,ee){P(T,function(){B.apply(this,arguments)},ee)},count:function(T){var B=0;return P(T,function(){B++}),B},toArray:function(T){return P(T,function(B){return B})||[]},only:function(T){if(!H(T))throw Error("React.Children.only expected to receive a single React element child.");return T}},Xe.Component=E,Xe.Fragment=i,Xe.Profiler=c,Xe.PureComponent=M,Xe.StrictMode=o,Xe.Suspense=x,Xe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,Xe.__COMPILER_RUNTIME={__proto__:null,c:function(T){return j.H.useMemoCache(T)}},Xe.cache=function(T){return function(){return T.apply(null,arguments)}},Xe.cloneElement=function(T,B,ee){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var te=D({},T.props),ye=T.key,ge=void 0;if(B!=null)for(K in B.ref!==void 0&&(ge=void 0),B.key!==void 0&&(ye=""+B.key),B)!O.call(B,K)||K==="key"||K==="__self"||K==="__source"||K==="ref"&&B.ref===void 0||(te[K]=B[K]);var K=arguments.length-2;if(K===1)te.children=ee;else if(1<K){for(var re=Array(K),je=0;je<K;je++)re[je]=arguments[je+2];te.children=re}return L(T.type,ye,void 0,void 0,ge,te)},Xe.createContext=function(T){return T={$$typeof:u,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:m,_context:T},T},Xe.createElement=function(T,B,ee){var te,ye={},ge=null;if(B!=null)for(te in B.key!==void 0&&(ge=""+B.key),B)O.call(B,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(ye[te]=B[te]);var K=arguments.length-2;if(K===1)ye.children=ee;else if(1<K){for(var re=Array(K),je=0;je<K;je++)re[je]=arguments[je+2];ye.children=re}if(T&&T.defaultProps)for(te in K=T.defaultProps,K)ye[te]===void 0&&(ye[te]=K[te]);return L(T,ge,void 0,void 0,null,ye)},Xe.createRef=function(){return{current:null}},Xe.forwardRef=function(T){return{$$typeof:g,render:T}},Xe.isValidElement=H,Xe.lazy=function(T){return{$$typeof:y,_payload:{_status:-1,_result:T},_init:$}},Xe.memo=function(T,B){return{$$typeof:p,type:T,compare:B===void 0?null:B}},Xe.startTransition=function(T){var B=j.T,ee={};j.T=ee;try{var te=T(),ye=j.S;
vendor: 9,243 bytes, lines 17-33
17ye!==null&&ye(ee,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(ne,F)}catch(ge){F(ge)}finally{j.T=B}},Xe.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},Xe.use=function(T){return j.H.use(T)},Xe.useActionState=function(T,B,ee){return j.H.useActionState(T,B,ee)},Xe.useCallback=function(T,B){return j.H.useCallback(T,B)},Xe.useContext=function(T){return j.H.useContext(T)},Xe.useDebugValue=function(){},Xe.useDeferredValue=function(T,B){return j.H.useDeferredValue(T,B)},Xe.useEffect=function(T,B,ee){var te=j.H;if(typeof ee=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return te.useEffect(T,B)},Xe.useId=function(){return j.H.useId()},Xe.useImperativeHandle=function(T,B,ee){return j.H.useImperativeHandle(T,B,ee)},Xe.useInsertionEffect=function(T,B){return j.H.useInsertionEffect(T,B)},Xe.useLayoutEffect=function(T,B){return j.H.useLayoutEffect(T,B)},Xe.useMemo=function(T,B){return j.H.useMemo(T,B)},Xe.useOptimistic=function(T,B){return j.H.useOptimistic(T,B)},Xe.useReducer=function(T,B,ee){return j.H.useReducer(T,B,ee)},Xe.useRef=function(T){return j.H.useRef(T)},Xe.useState=function(T){return j.H.useState(T)},Xe.useSyncExternalStore=function(T,B,ee){return j.H.useSyncExternalStore(T,B,ee)},Xe.useTransition=function(){return j.H.useTransition()},Xe.version="19.1.0",Xe}var Jg;function Uc(){return Jg||(Jg=1,Nm.exports=M1()),Nm.exports}var f=Uc();const wt=s0(f),a0=_1({__proto__:null,default:wt},[f]);var wm={exports:{}},Ci={},Sm={exports:{}},Cm={};/**
18 * @license React
19 * scheduler.production.js
20 *
21 * Copyright (c) Meta Platforms, Inc. and affiliates.
22 *
23 * This source code is licensed under the MIT license found in the
24 * LICENSE file in the root directory of this source tree.
25 */var Wg;function T1(){return Wg||(Wg=1,function(a){function r(P,$){var F=P.length;P.push($);e:for(;0<F;){var ne=F-1>>>1,T=P[ne];if(0<c(T,$))P[ne]=$,P[F]=T,F=ne;else break e}}function i(P){return P.length===0?null:P[0]}function o(P){if(P.length===0)return null;var $=P[0],F=P.pop();if(F!==$){P[0]=F;e:for(var ne=0,T=P.length,B=T>>>1;ne<B;){var ee=2*(ne+1)-1,te=P[ee],ye=ee+1,ge=P[ye];if(0>c(te,F))ye<T&&0>c(ge,te)?(P[ne]=ge,P[ye]=F,ne=ye):(P[ne]=te,P[ee]=F,ne=ee);else if(ye<T&&0>c(ge,F))P[ne]=ge,P[ye]=F,ne=ye;else break e}}return $}function c(P,$){var F=P.sortIndex-$.sortIndex;return F!==0?F:P.id-$.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var m=performance;a.unstable_now=function(){return m.now()}}else{var u=Date,g=u.now();a.unstable_now=function(){return u.now()-g}}var x=[],p=[],y=1,v=null,w=3,N=!1,D=!1,b=!1,E=!1,_=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function C(P){for(var $=i(p);$!==null;){if($.callback===null)o(p);else if($.startTime<=P)o(p),$.sortIndex=$.expirationTime,r(x,$);else break;$=i(p)}}function j(P){if(b=!1,C(P),!D)if(i(x)!==null)D=!0,O||(O=!0,Z());else{var $=i(p);$!==null&&X(j,$.startTime-P)}}var O=!1,L=-1,R=5,H=-1;function z(){return E?!0:!(a.unstable_now()-H<R)}function V(){if(E=!1,O){var P=a.unstable_now();H=P;var $=!0;try{e:{D=!1,b&&(b=!1,M(L),L=-1),N=!0;var F=w;try{t:{for(C(P),v=i(x);v!==null&&!(v.expirationTime>P&&z());){var ne=v.callback;if(typeof ne=="function"){v.callback=null,w=v.priorityLevel;var T=ne(v.expirationTime<=P);if(P=a.unstable_now(),typeof T=="function"){v.callback=T,C(P),$=!0;break t}v===i(x)&&o(x),C(P)}else o(x);v=i(x)}if(v!==null)$=!0;else{var B=i(p);B!==null&&X(j,B.startTime-P),$=!1}}break e}finally{v=null,w=F,N=!1}$=void 0}}finally{$?Z():O=!1}}}var Z;if(typeof k=="function")Z=function(){k(V)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,ue=I.port2;I.port1.onmessage=V,Z=function(){ue.postMessage(null)}}else Z=function(){_(V,0)};function X(P,$){L=_(function(){P(a.unstable_now())},$)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(P){P.callback=null},a.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<P?Math.floor(1e3/P):5},a.unstable_getCurrentPriorityLevel=function(){return w},a.unstable_next=function(P){switch(w){case 1:case 2:case 3:var $=3;break;default:$=w}var F=w;w=$;try{return P()}finally{w=F}},a.unstable_requestPaint=function(){E=!0},a.unstable_runWithPriority=function(P,$){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var F=w;w=P;try{return $()}finally{w=F}},a.unstable_scheduleCallback=function(P,$,F){var ne=a.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?ne+F:ne):F=ne,P){case 1:var T=-1;break;case 2:T=250;break;case 5:T=1073741823;break;case 4:T=1e4;break;default:T=5e3}return T=F+T,P={id:y++,callback:$,priorityLevel:P,startTime:F,expirationTime:T,sortIndex:-1},F>ne?(P.sortIndex=F,r(p,P),i(x)===null&&P===i(p)&&(b?(M(L),L=-1):b=!0,X(j,F-ne))):(P.sortIndex=T,r(x,P),D||N||(D=!0,O||(O=!0,Z()))),P},a.unstable_shouldYield=z,a.unstable_wrapCallback=function(P){var $=w;return function(){var F=w;w=$;try{return P.apply(this,arguments)}finally{w=F}}}}(Cm)),Cm}var ev;function A1(){return ev||(ev=1,Sm.exports=T1()),Sm.exports}var km={exports:{}},as={};/**
26 * @license React
27 * react-dom.production.js
28 *
29 * Copyright (c) Meta Platforms, Inc. and affiliates.
30 *
31 * This source code is licensed under the MIT license found in the
32 * LICENSE file in the root directory of this source tree.
33 */var tv;function R1(){if(tv)return as;tv=1;var a=Uc();function r(x){var p="https://react.dev/errors/"+x;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)p+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+x+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var o={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},c=Symbol.for("react.portal");function m(x,p,y){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:v==null?null:""+v,children:x,containerInfo:p,implementation:y}}var u=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function g(x,p){if(x==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return as.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,as.createPortal=function(x,p){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(r(299));return m(x,p,null,y)},as.flushSync=function(x){var p=u.T,y=o.p;try{if(u.T=null,o.p=2,x)return x()}finally{u.T=p,o.p=y,o.d.f()}},as.preconnect=function(x,p){typeof x=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,o.d.C(x,p))},as.prefetchDNS=function(x){typeof x=="string"&&o.d.D(x)},as.preinit=function(x,p){if(typeof x=="string"&&p&&typeof p.as=="string"){var y=p.as,v=g(y,p.crossOrigin),w=typeof p.integrity=="string"?p.integrity:void 0,N=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;y==="style"?o.d.S(x,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:v,integrity:w,fetchPriority:N}):y==="script"&&o.d.X(x,{crossOrigin:v,integrity:w,fetchPriority:N,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},as.preinitModule=function(x,p){if(typeof x=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=g(p.as,p.crossOrigin);o.d.M(x,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&o.d.M(x)},as.preload=function(x,p){if(typeof x=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,v=g(y,p.crossOrigin);o.d.L(x,y,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},as.preloadModule=function(x,p){if(typeof x=="string")if(p){var y=g(p.as,p.crossOrigin);o.d.m(x,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else o.d.m(x)},as.requestFormReset=function(x){o.d.r(x)},as.unstable_batchedUpdates=function(x,p){return x(p)},as.useFormState=function(x,p,y){return u.H.useFormState(x,p,y)},as.useFormStatus=function(){return u.H.useHostTransitionStatus()},as.version="19.1.0",as}var sv;function n0(){if(sv)return km.exports;sv=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(r){console.error(r)}}
vendor: 18,249 bytes, lines 33-48
33return a(),km.exports=R1(),km.exports}/**
34 * @license React
35 * react-dom-client.production.js
36 *
37 * Copyright (c) Meta Platforms, Inc. and affiliates.
38 *
39 * This source code is licensed under the MIT license found in the
40 * LICENSE file in the root directory of this source tree.
41 */var av;function O1(){if(av)return Ci;av=1;var a=A1(),r=Uc(),i=n0();function o(t){var s="https://react.dev/errors/"+t;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)s+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+t+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function m(t){var s=t,n=t;if(t.alternate)for(;s.return;)s=s.return;else{t=s;do s=t,(s.flags&4098)!==0&&(n=s.return),t=s.return;while(t)}return s.tag===3?n:null}function u(t){if(t.tag===13){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function g(t){if(m(t)!==t)throw Error(o(188))}function x(t){var s=t.alternate;if(!s){if(s=m(t),s===null)throw Error(o(188));return s!==t?null:t}for(var n=t,l=s;;){var d=n.return;if(d===null)break;var h=d.alternate;if(h===null){if(l=d.return,l!==null){n=l;continue}break}if(d.child===h.child){for(h=d.child;h;){if(h===n)return g(d),t;if(h===l)return g(d),s;h=h.sibling}throw Error(o(188))}if(n.return!==l.return)n=d,l=h;else{for(var S=!1,A=d.child;A;){if(A===n){S=!0,n=d,l=h;break}if(A===l){S=!0,l=d,n=h;break}A=A.sibling}if(!S){for(A=h.child;A;){if(A===n){S=!0,n=h,l=d;break}if(A===l){S=!0,l=h,n=d;break}A=A.sibling}if(!S)throw Error(o(189))}}if(n.alternate!==l)throw Error(o(190))}if(n.tag!==3)throw Error(o(188));return n.stateNode.current===n?t:s}function p(t){var s=t.tag;if(s===5||s===26||s===27||s===6)return t;for(t=t.child;t!==null;){if(s=p(t),s!==null)return s;t=t.sibling}return null}var y=Object.assign,v=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),_=Symbol.for("react.provider"),M=Symbol.for("react.consumer"),k=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),H=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function Z(t){return t===null||typeof t!="object"?null:(t=V&&t[V]||t["@@iterator"],typeof t=="function"?t:null)}var I=Symbol.for("react.client.reference");function ue(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===I?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case D:return"Fragment";case E:return"Profiler";case b:return"StrictMode";case j:return"Suspense";case O:return"SuspenseList";case H:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case N:return"Portal";case k:return(t.displayName||"Context")+".Provider";case M:return(t._context.displayName||"Context")+".Consumer";case C:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case L:return s=t.displayName||null,s!==null?s:ue(t.type)||"Memo";case R:s=t._payload,t=t._init;try{return ue(t(s))}catch{}}return null}var X=Array.isArray,P=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F={pending:!1,data:null,method:null,action:null},ne=[],T=-1;function B(t){return{current:t}}function ee(t){0>T||(t.current=ne[T],ne[T]=null,T--)}function te(t,s){T++,ne[T]=t.current,t.current=s}var ye=B(null),ge=B(null),K=B(null),re=B(null);function je(t,s){switch(te(K,s),te(ge,t),te(ye,null),s.nodeType){case 9:case 11:t=(t=s.documentElement)&&(t=t.namespaceURI)?wg(t):0;break;default:if(t=s.tagName,s=s.namespaceURI)s=wg(s),t=Sg(s,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}ee(ye),te(ye,t)}function Ae(){ee(ye),ee(ge),ee(K)}function ie(t){t.memoizedState!==null&&te(re,t);var s=ye.current,n=Sg(s,t.type);s!==n&&(te(ge,t),te(ye,n))}function we(t){ge.current===t&&(ee(ye),ee(ge)),re.current===t&&(ee(re),yi._currentValue=F)}var _e=Object.prototype.hasOwnProperty,me=a.unstable_scheduleCallback,Se=a.unstable_cancelCallback,Pe=a.unstable_shouldYield,pt=a.unstable_requestPaint,Ve=a.unstable_now,bt=a.unstable_getCurrentPriorityLevel,ds=a.unstable_ImmediatePriority,le=a.unstable_UserBlockingPriority,Le=a.unstable_NormalPriority,Ye=a.unstable_LowPriority,Ne=a.unstable_IdlePriority,jt=a.log,Wa=a.unstable_setDisableYieldValue,ra=null,qt=null;function ls(t){if(typeof jt=="function"&&Wa(t),qt&&typeof qt.setStrictMode=="function")try{qt.setStrictMode(ra,t)}catch{}}var Xt=Math.clz32?Math.clz32:Cr,_l=Math.log,Bn=Math.LN2;function Cr(t){return t>>>=0,t===0?32:31-(_l(t)/Bn|0)|0}var Na=256,en=4194304;function J(t){var s=t&42;if(s!==0)return s;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function be(t,s,n){var l=t.pendingLanes;if(l===0)return 0;var d=0,h=t.suspendedLanes,S=t.pingedLanes;t=t.warmLanes;var A=l&134217727;return A!==0?(l=A&~h,l!==0?d=J(l):(S&=A,S!==0?d=J(S):n||(n=A&~t,n!==0&&(d=J(n))))):(A=l&~h,A!==0?d=J(A):S!==0?d=J(S):n||(n=l&~t,n!==0&&(d=J(n)))),d===0?0:s!==0&&s!==d&&(s&h)===0&&(h=d&-d,n=s&-s,h>=n||h===32&&(n&4194048)!==0)?s:d}function pe(t,s){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&s)===0}function ke(t,s){switch(t){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32: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 s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Re(){var t=Na;return Na<<=1,(Na&4194048)===0&&(Na=256),t}function Kt(){var t=en;return en<<=1,(en&62914560)===0&&(en=4194304),t}function He(t){for(var s=[],n=0;31>n;n++)s.push(t);return s}function tt(t,s){t.pendingLanes|=s,s!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function st(t,s,n,l,d,h){var S=t.pendingLanes;t.pendingLanes=n,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=n,t.entangledLanes&=n,t.errorRecoveryDisabledLanes&=n,t.shellSuspendCounter=0;var A=t.entanglements,U=t.expirationTimes,W=t.hiddenUpdates;for(n=S&~n;0<n;){var ce=31-Xt(n),fe=1<<ce;A[ce]=0,U[ce]=-1;var se=W[ce];if(se!==null)for(W[ce]=null,ce=0;ce<se.length;ce++){var ae=se[ce];ae!==null&&(ae.lane&=-536870913)}n&=~fe}l!==0&&rt(t,l,0),h!==0&&d===0&&t.tag!==0&&(t.suspendedLanes|=h&~(S&~s))}function rt(t,s,n){t.pendingLanes|=s,t.suspendedLanes&=~s;var l=31-Xt(s);t.entangledLanes|=s,t.entanglements[l]=t.entanglements[l]|1073741824|n&4194090}function Ki(t,s){var n=t.entangledLanes|=s;for(t=t.entanglements;n;){var l=31-Xt(n),d=1<<l;d&s|t[l]&s&&(t[l]|=s),n&=~d}}function Dl(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function El(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Zi(){var t=$.p;return t!==0?t:(t=window.event,t===void 0?32:qg(t.type))}function md(t,s){var n=$.p;try{return $.p=t,s()}finally{$.p=n}}var la=Math.random().toString(36).slice(2),Ue="__reactFiber$"+la,Qe="__reactProps$"+la,Ts="__reactContainer$"+la,wa="__reactEvents$"+la,fd="__reactListeners$"+la,Qi="__reactHandles$"+la,uh="__reactResources$"+la,Ml="__reactMarker$"+la;function hd(t){delete t[Ue],delete t[Qe],delete t[wa],delete t[fd],delete t[Qi]}function kr(t){var s=t[Ue];if(s)return s;for(var n=t.parentNode;n;){if(s=n[Ts]||n[Ue]){if(n=s.alternate,s.child!==null||n!==null&&n.child!==null)for(t=Dg(t);t!==null;){if(n=t[Ue])return n;t=Dg(t)}return s}t=n,n=t.parentNode}return null}function _r(t){if(t=t[Ue]||t[Ts]){var s=t.tag;if(s===5||s===6||s===13||s===26||s===27||s===3)return t}return null}function Tl(t){var s=t.tag;if(s===5||s===26||s===27||s===6)return t.stateNode;throw Error(o(33))}function Dr(t){var s=t[uh];return s||(s=t[uh]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Ht(t){t[Ml]=!0}var mh=new Set,fh={};function qn(t,s){Er(t,s),Er(t+"Capture",s)}function Er(t,s){for(fh[t]=s,t=0;t<s.length;t++)mh.add(s[t])}var yN=RegExp("^[: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]*$"),hh={},xh={};function bN(t){return _e.call(xh,t)?!0:_e.call(hh,t)?!1:yN.test(t)?xh[t]=!0:(hh[t]=!0,!1)}function Ji(t,s,n){if(bN(s))if(n===null)t.removeAttribute(s);else{switch(typeof n){case"undefined":case"function":case"symbol":t.removeAttribute(s);return;case"boolean":var l=s.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){t.removeAttribute(s);return}}t.setAttribute(s,""+n)}}function Wi(t,s,n){if(n===null)t.removeAttribute(s);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttribute(s,""+n)}}function Sa(t,s,n,l){if(l===null)t.removeAttribute(n);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttributeNS(s,n,""+l)}}var xd,ph;function Mr(t){if(xd===void 0)try{throw Error()}catch(n){var s=n.stack.trim().match(/\n( *(at )?)/);xd=s&&s[1]||"",ph=-1<n.stack.indexOf(`
42    at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
43`+xd+t+ph}var pd=!1;function gd(t,s){if(!t||pd)return"";pd=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(s){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(ae){var se=ae}Reflect.construct(t,[],fe)}else{try{fe.call()}catch(ae){se=ae}t.call(fe.prototype)}}else{try{throw Error()}catch(ae){se=ae}(fe=t())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(ae){if(ae&&se&&typeof ae.stack=="string")return[ae.stack,se.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=l.DetermineComponentFrameRoot(),S=h[0],A=h[1];if(S&&A){var U=S.split(`
44`),W=A.split(`
45`);for(d=l=0;l<U.length&&!U[l].includes("DetermineComponentFrameRoot");)l++;for(;d<W.length&&!W[d].includes("DetermineComponentFrameRoot");)d++;if(l===U.length||d===W.length)for(l=U.length-1,d=W.length-1;1<=l&&0<=d&&U[l]!==W[d];)d--;for(;1<=l&&0<=d;l--,d--)if(U[l]!==W[d]){if(l!==1||d!==1)do if(l--,d--,0>d||U[l]!==W[d]){var ce=`
46`+U[l].replace(" at new "," at ");return t.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",t.displayName)),ce}while(1<=l&&0<=d);break}}}finally{pd=!1,Error.prepareStackTrace=n}return(n=t?t.displayName||t.name:"")?Mr(n):""}function jN(t){switch(t.tag){case 26:case 27:case 5:return Mr(t.type);case 16:return Mr("Lazy");case 13:return Mr("Suspense");case 19:return Mr("SuspenseList");case 0:case 15:return gd(t.type,!1);case 11:return gd(t.type.render,!1);case 1:return gd(t.type,!0);case 31:return Mr("Activity");default:return""}}function gh(t){try{var s="";do s+=jN(t),t=t.return;while(t);return s}catch(n){return`
47Error generating stack: `+n.message+`
48`+n.stack}}function As(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function vh(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function NN(t){var s=vh(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,s),l=""+t[s];if(!t.hasOwnProperty(s)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var d=n.get,h=n.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return d.call(this)},set:function(S){l=""+S,h.call(this,S)}}),Object.defineProperty(t,s,{enumerable:n.enumerable}),{getValue:function(){return l},setValue:function(S){l=""+S},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function eo(t){t._valueTracker||(t._valueTracker=NN(t))}function yh(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var n=s.getValue(),l="";return t&&(l=vh(t)?t.checked?"true":"false":t.value),t=l,t!==n?(s.setValue(t),!0):!1}function to(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var wN=/[\n"\\]/g;function Rs(t){return t.replace(wN,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function vd(t,s,n,l,d,h,S,A){t.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?t.type=S:t.removeAttribute("type"),s!=null?S==="number"?(s===0&&t.value===""||t.value!=s)&&(t.value=""+As(s)):t.value!==""+As(s)&&(t.value=""+As(s)):S!=="submit"&&S!=="reset"||t.removeAttribute("value"),s!=null?yd(t,S,As(s)):n!=null?yd(t,S,As(n)):l!=null&&t.removeAttribute("value"),d==null&&h!=null&&(t.defaultChecked=!!h),d!=null&&(t.checked=d&&typeof d!="function"&&typeof d!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?t.name=""+As(A):t.removeAttribute("name")}function bh(t,s,n,l,d,h,S,A){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(t.type=h),s!=null||n!=null){if(!(h!=="submit"&&h!=="reset"||s!=null))return;n=n!=null?""+As(n):"",s=s!=null?""+As(s):n,A||s===t.value||(t.value=s),t.defaultValue=s}l=l??d,l=typeof l!="function"&&typeof l!="symbol"&&!!l,t.checked=A?t.checked:!!l,t.defaultChecked=!!l,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(t.name=S)}function yd(t,s,n){s==="number"&&to(t.ownerDocument)===t||t.defaultValue===""+n||(t.defaultValue=""+n)}function Tr(t,s,n,l){if(t=t.options,s){s={};for(var d=0;d<n.length;d++)s["$"+n[d]]=!0;for(n=0;n<t.length;n++)d=s.hasOwnProperty("$"+t[n].value),t[n].selected!==d&&(t[n].selected=d),d&&l&&(t[n].defaultSelected=!0)}else{for(n=""+As(n),s=null,d=0;d<t.length;d++){if(t[d].value===n){t[d].selected=!0,l&&(t[d].defaultSelected=!0);return}s!==null||t[d].disabled||(s=t[d])}s!==null&&(s.selected=!0)}}function jh(t,s,n){if(s!=null&&(s=""+As(s),s!==t.value&&(t.value=s),n==null)){t.defaultValue!==s&&(t.defaultValue=s);return}t.defaultValue=n!=null?""+As(n):""}function Nh(t,s,n,l){if(s==null){if(l!=null){if(n!=null)throw Error(o(92));if(X(l)){if(1<l.length)throw Error(o(93));l=l[0]}n=l}n==null&&(n=""),s=n}n=As(s),t.defaultValue=n,l=t.textContent,l===n&&l!==""&&l!==null&&(t.value=l)}function Ar(t,s){if(s){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=s;return}}t.textContent=s}var SN=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function wh(t,s,n){var l=s.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?l?t.setProperty(s,""):s==="float"?t.cssFloat="":t[s]="":l?t.setProperty(s,n):typeof n!="number"||n===0||SN.has(s)?s==="float"?t.cssFloat=n:t[s]=(""+n).trim():t[s]=n+"px"}function Sh(t,s,n){if(s!=null&&typeof s!="object")throw Error(o(62));if(t=t.style,n!=null){for(var l in n)!n.hasOwnProperty(l)||s!=null&&s.hasOwnProperty(l)||(l.indexOf("--")===0?t.setProperty(l,""):l==="float"?t.cssFloat="":t[l]="");for(var d in s)l=s[d],s.hasOwnProperty(d)&&n[d]!==l&&wh(t,d,l)}else for(var h in s)s.hasOwnProperty(h)&&wh(t,h,s[h])}function bd(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var CN=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRen
48dering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),kN=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function so(t){return kN.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}var jd=null;function Nd(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Rr=null,Or=null;function Ch(t){var s=_r(t);if(s&&(t=s.stateNode)){var n=t[Qe]||null;e:switch(t=s.stateNode,s.type){case"input":if(vd(t,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),s=n.name,n.type==="radio"&&s!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Rs(""+s)+'"][type="radio"]'),s=0;s<n.length;s++){var l=n[s];if(l!==t&&l.form===t.form){var d=l[Qe]||null;if(!d)throw Error(o(90));vd(l,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(s=0;s<n.length;s++)l=n[s],l.form===t.form&&yh(l)}break e;case"textarea":jh(t,n.value,n.defaultValue);break e;case"select":s=n.value,s!=null&&Tr(t,!!n.multiple,s,!1)}}}var wd=!1;function kh(t,s,n){if(wd)return t(s,n);wd=!0;try{var l=t(s);return l}finally{if(wd=!1,(Rr!==null||Or!==null)&&(Bo(),Rr&&(s=Rr,t=Or,Or=Rr=null,Ch(s),t)))for(s=0;s<t.length;s++)Ch(t[s])}}function Al(t,s){var n=t.stateNode;if(n===null)return null;var l=n[Qe]||null;if(l===null)return null;n=l[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(t=t.type,l=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!l;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(o(231,s,typeof n));return n}var Ca=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Sd=!1;if(Ca)try{var Rl={};Object.defineProperty(Rl,"passive",{get:function(){Sd=!0}}),window.addEventListener("test",Rl,Rl),window.removeEventListener("test",Rl,Rl)}catch{Sd=!1}var tn=null,Cd=null,ao=null;function _h(){if(ao)return ao;var t,s=Cd,n=s.length,l,d="value"in tn?tn.value:tn.textContent,h=d.length;for(t=0;t<n&&s[t]===d[t];t++);var S=n-t;for(l=1;l<=S&&s[n-l]===d[h-l];l++);return ao=d.slice(t,1<l?1-l:void 0)}function no(t){var s=t.keyCode;
vendor: 4,109 bytes, line 48
48return"charCode"in t?(t=t.charCode,t===0&&s===13&&(t=13)):t=s,t===10&&(t=13),32<=t||t===13?t:0}function ro(){return!0}function Dh(){return!1}function us(t){function s(n,l,d,h,S){this._reactName=n,this._targetInst=d,this.type=l,this.nativeEvent=h,this.target=S,this.currentTarget=null;for(var A in t)t.hasOwnProperty(A)&&(n=t[A],this[A]=n?n(h):h[A]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?ro:Dh,this.isPropagationStopped=Dh,this}return y(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=ro)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ro)},persist:function(){},isPersistent:ro}),s}var Hn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},lo=us(Hn),Ol=y({},Hn,{view:0,detail:0}),_N=us(Ol),kd,_d,Pl,io=y({},Ol,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ed,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Pl&&(Pl&&t.type==="mousemove"?(kd=t.screenX-Pl.screenX,_d=t.screenY-Pl.screenY):_d=kd=0,Pl=t),kd)},movementY:function(t){return"movementY"in t?t.movementY:_d}}),Eh=us(io),DN=y({},io,{dataTransfer:0}),EN=us(DN),MN=y({},Ol,{relatedTarget:0}),Dd=us(MN),TN=y({},Hn,{animationName:0,elapsedTime:0,pseudoElement:0}),AN=us(TN),RN=y({},Hn,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),ON=us(RN),PN=y({},Hn,{data:0}),Mh=us(PN),zN={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},LN={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},UN={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $N(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=UN[t])?!!s[t]:!1}function Ed(){return $N}var IN=y({},Ol,{key:function(t){if(t.key){var s=zN[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=no(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?LN[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ed,charCode:function(t){return t.type==="keypress"?no(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?no(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),FN=us(IN),BN=y({},io,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Th=us(BN),qN=y({},Ol,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ed}),HN=us(qN),VN=y({},Hn,{propertyName:0,elapsedTime:0,pseudoElement:0}),GN=us(VN),YN=y({},io,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),XN=us(YN),KN=y({},Hn,{newState:0,oldState:0}),ZN=us(KN),QN=[9,13,27,32],Md=Ca&&"CompositionEvent"in window,zl=null;Ca&&"documentMode"in document&&(zl=document.documentMode);var JN=Ca&&"TextEvent"in window&&!zl,Ah=Ca&&(!Md||zl&&8<zl&&11>
vendor: 45,398 bytes, line 48
48=zl),Rh=" ",Oh=!1;function Ph(t,s){switch(t){case"keyup":return QN.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zh(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Pr=!1;function WN(t,s){switch(t){case"compositionend":return zh(s);case"keypress":return s.which!==32?null:(Oh=!0,Rh);case"textInput":return t=s.data,t===Rh&&Oh?null:t;default:return null}}function ew(t,s){if(Pr)return t==="compositionend"||!Md&&Ph(t,s)?(t=_h(),ao=Cd=tn=null,Pr=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Ah&&s.locale!=="ko"?null:s.data;default:return null}}var tw={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Lh(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!tw[t.type]:s==="textarea"}function Uh(t,s,n,l){Rr?Or?Or.push(l):Or=[l]:Rr=l,s=Xo(s,"onChange"),0<s.length&&(n=new lo("onChange","change",null,n,l),t.push({event:n,listeners:s}))}var Ll=null,Ul=null;function sw(t){vg(t,0)}function oo(t){var s=Tl(t);if(yh(s))return t}function $h(t,s){if(t==="change")return s}var Ih=!1;if(Ca){var Td;if(Ca){var Ad="oninput"in document;if(!Ad){var Fh=document.createElement("div");Fh.setAttribute("oninput","return;"),Ad=typeof Fh.oninput=="function"}Td=Ad}else Td=!1;Ih=Td&&(!document.documentMode||9<document.documentMode)}function Bh(){Ll&&(Ll.detachEvent("onpropertychange",qh),Ul=Ll=null)}function qh(t){if(t.propertyName==="value"&&oo(Ul)){var s=[];Uh(s,Ul,t,Nd(t)),kh(sw,s)}}function aw(t,s,n){t==="focusin"?(Bh(),Ll=s,Ul=n,Ll.attachEvent("onpropertychange",qh)):t==="focusout"&&Bh()}function nw(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return oo(Ul)}function rw(t,s){if(t==="click")return oo(s)}function lw(t,s){if(t==="input"||t==="change")return oo(s)}function iw(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var ys=typeof Object.is=="function"?Object.is:iw;function $l(t,s){if(ys(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;var n=Object.keys(t),l=Object.keys(s);if(n.length!==l.length)return!1;for(l=0;l<n.length;l++){var d=n[l];if(!_e.call(s,d)||!ys(t[d],s[d]))return!1}return!0}function Hh(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Vh(t,s){var n=Hh(t);t=0;for(var l;n;){if(n.nodeType===3){if(l=t+n.textContent.length,t<=s&&l>=s)return{node:n,offset:s-t};t=l}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Hh(n)}}function Gh(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?Gh(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function Yh(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var s=to(t.document);s instanceof t.HTMLIFrameElement;){try{var n=typeof s.contentWindow.location.href=="string"}catch{n=!1}if(n)t=s.contentWindow;else break;s=to(t.document)}return s}function Rd(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}var ow=Ca&&"documentMode"in document&&11>=document.documentMode,zr=null,Od=null,Il=null,Pd=!1;function Xh(t,s,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Pd||zr==null||zr!==to(l)||(l=zr,"selectionStart"in l&&Rd(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Il&&$l(Il,l)||(Il=l,l=Xo(Od,"onSelect"),0<l.length&&(s=new lo("onSelect","select",null,s,n),t.push({event:s,listeners:l}),s.target=zr)))}function Vn(t,s){var n={};return n[t.toLowerCase()]=s.toLowerCase(),n["Webkit"+t]="webkit"+s,n["Moz"+t]="moz"+s,n}var Lr={animationend:Vn("Animation","AnimationEnd"),animationiteration:Vn("Animation","AnimationIteration"),animationstart:Vn("Animation","AnimationStart"),transitionrun:Vn("Transition","TransitionRun"),transitionstart:Vn("Transition","TransitionStart"),transitioncancel:Vn("Transition","TransitionCancel"),transitionend:Vn("Transition","TransitionEnd")},zd={},Kh={};Ca&&(Kh=document.createElement("div").style,"AnimationEvent"in window||(delete Lr.animationend.animation,delete Lr.animationiteration.animation,delete Lr.animationstart.animation),"TransitionEvent"in window||delete Lr.transitionend.transition);function Gn(t){if(zd[t])return zd[t];if(!Lr[t])return t;var s=Lr[t],n;for(n in s)if(s.hasOwnProperty(n)&&n in Kh)return zd[t]=s[n];return t}var Zh=Gn("animationend"),Qh=Gn("animationiteration"),Jh=Gn("animationstart"),cw=Gn("transitionrun"),dw=Gn("transitionstart"),uw=Gn("transitioncancel"),Wh=Gn("transitionend"),ex=new Map,Ld="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Ld.push("scrollEnd");function qs(t,s){ex.set(t,s),qn(s,[t])}var tx=new WeakMap;function Os(t,s){if(typeof t=="object"&&t!==null){var n=tx.get(t);return n!==void 0?n:(s={value:t,source:s,stack:gh(s)},tx.set(t,s),s)}return{value:t,source:s,stack:gh(s)}}var Ps=[],Ur=0,Ud=0;function co(){for(var t=Ur,s=Ud=Ur=0;s<t;){var n=Ps[s];Ps[s++]=null;var l=Ps[s];Ps[s++]=null;var d=Ps[s];Ps[s++]=null;var h=Ps[s];if(Ps[s++]=null,l!==null&&d!==null){var S=l.pending;S===null?d.next=d:(d.next=S.next,S.next=d),l.pending=d}h!==0&&sx(n,d,h)}}function uo(t,s,n,l){Ps[Ur++]=t,Ps[Ur++]=s,Ps[Ur++]=n,Ps[Ur++]=l,Ud|=l,t.lanes|=l,t=t.alternate,t!==null&&(t.lanes|=l)}function $d(t,s,n,l){return uo(t,s,n,l),mo(t)}function $r(t,s){return uo(t,null,null,s),mo(t)}function sx(t,s,n){t.lanes|=n;var l=t.alternate;l!==null&&(l.lanes|=n);for(var d=!1,h=t.return;h!==null;)h.childLanes|=n,l=h.alternate,l!==null&&(l.childLanes|=n),h.tag===22&&(t=h.stateNode,t===null||t._visibility&1||(d=!0)),t=h,h=h.return;return t.tag===3?(h=t.stateNode,d&&s!==null&&(d=31-Xt(n),t=h.hiddenUpdates,l=t[d],l===null?t[d]=[s]:l.push(s),s.lane=n|536870912),h):null}function mo(t){if(50<ui)throw ui=0,Vu=null,Error(o(185));for(var s=t.return;s!==null;)t=s,s=t.return;return t.tag===3?t.stateNode:null}var Ir={};function mw(t,s,n,l){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bs(t,s,n,l){return new mw(t,s,n,l)}function Id(t){return t=t.prototype,!(!t||!t.isReactComponent)}function ka(t,s){var n=t.alternate;return n===null?(n=bs(t.tag,s,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=s,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&65011712,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,s=t.dependencies,n.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n.refCleanup=t.refCleanup,n}function ax(t,s){t.flags&=65011714;var n=t.alternate;return n===null?(t.childLanes=0,t.lanes=s,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,t.type=n.type,s=n.dependencies,t.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),t}function fo(t,s,n,l,d,h){var S=0;if(l=t,typeof t=="function")Id(t)&&(S=1);else if(typeof t=="string")S=h1(t,n,ye.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case H:return t=bs(31,n,s,d),t.elementType=H,t.lanes=h,t;case D:return Yn(n.children,d,h,s);case b:S=8,d|=24;break;case E:return t=bs(12,n,s,d|2),t.elementType=E,t.lanes=h,t;case j:return t=bs(13,n,s,d),t.elementType=j,t.lanes=h,t;case O:return t=bs(19,n,s,d),t.elementType=O,t.lanes=h,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case _:case k:S=10;break e;case M:S=9;break e;case C:S=11;break e;case L:S=14;break e;case R:S=16,l=null;break e}S=29,n=Error(o(130,t===null?"null":typeof t,"")),l=null}return s=bs(S,n,s,d),s.elementType=t,s.type=l,s.lanes=h,s}function Yn(t,s,n,l){return t=bs(7,t,l,s),t.lanes=n,t}function Fd(t,s,n){return t=bs(6,t,null,s),t.lanes=n,t}function Bd(t,s,n){return s=bs(4,t.children!==null?t.children:[],t.key,s),s.lanes=n,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}var Fr=[],Br=0,ho=null,xo=0,zs=[],Ls=0,Xn=null,_a=1,Da="";function Kn(t,s){Fr[Br++]=xo,Fr[Br++]=ho,ho=t,xo=s}function nx(t,s,n){zs[Ls++]=_a,zs[Ls++]=Da,zs[Ls++]=Xn,Xn=t;var l=_a;t=Da;var d=32-Xt(l)-1;l&=~(1<<d),n+=1;var h=32-Xt(s)+d;if(30<h){var S=d-d%5;h=(l&(1<<S)-1).toString(32),l>>=S,d-=S,_a=1<<32-Xt(s)+d|n<<d|l,Da=h+t}else _a=1<<h|n<<d|l,Da=t}function qd(t){t.return!==null&&(Kn(t,1),nx(t,1,0))}function Hd(t){for(;t===ho;)ho=Fr[--Br],Fr[Br]=null,xo=Fr[--Br],Fr[Br]=null;for(;t===Xn;)Xn=zs[--Ls],zs[Ls]=null,Da=zs[--Ls],zs[Ls]=null,_a=zs[--Ls],zs[Ls]=null}var is=null,_t=null,ot=!1,Zn=null,ia=!1,Vd=Error(o(519));function Qn(t){var s=Error(o(418,""));throw ql(Os(s,t)),Vd}function rx(t){var s=t.stateNode,n=t.type,l=t.memoizedProps;switch(s[Ue]=t,s[Qe]=l,n){case"dialog":et("cancel",s),et("close",s);break;case"iframe":case"object":case"embed":et("load",s);break;case"video":case"audio":for(n=0;n<fi.length;n++)et(fi[n],s);break;case"source":et("error",s);break;case"img":case"image":case"link":et("error",s),et("load",s);break;case"details":et("toggle",s);break;case"input":et("invalid",s),bh(s,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0),eo(s);break;case"select":et("invalid",s);break;case"textarea":et("invalid",s),Nh(s,l.value,l.defaultValue,l.children),eo(s)}n=l.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||s.textContent===""+n||l.suppressHydrationWarning===!0||Ng(s.textContent,n)?(l.popover!=null&&(et("beforetoggle",s),et("toggle",s)),l.onScroll!=null&&et("scroll",s),l.onScrollEnd!=null&&et("scrollend",s),l.onClick!=null&&(s.onclick=Ko),s=!0):s=!1,s||Qn(t)}function lx(t){for(is=t.return;is;)switch(is.tag){case 5:case 13:ia=!1;return;case 27:case 3:ia=!0;return;default:is=is.return}}function Fl(t){if(t!==is)return!1;if(!ot)return lx(t),ot=!0,!1;var s=t.tag,n;if((n=s!==3&&s!==27)&&((n=s===5)&&(n=t.type,n=!(n!=="form"&&n!=="button")||im(t.type,t.memoizedProps)),n=!n),n&&_t&&Qn(t),lx(t),s===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(o(317));e:{for(t=t.nextSibling,s=0;t;){if(t.nodeType===8)if(n=t.data,n==="/$"){if(s===0){_t=Vs(t.nextSibling);break e}s--}else n!=="$"&&n!=="$!"&&n!=="$?"||s++;t=t.nextSibling}_t=null}}else s===27?(s=_t,vn(t.type)?(t=um,um=null,_t=t):_t=s):_t=is?Vs(t.stateNode.nextSibling):null;return!0}function Bl(){_t=is=null,ot=!1}function ix(){var t=Zn;return t!==null&&(hs===null?hs=t:hs.push.apply(hs,t),Zn=null),t}function ql(t){Zn===null?Zn=[t]:Zn.push(t)}var Gd=B(null),Jn=null,Ea=null;function sn(t,s,n){te(Gd,s._currentValue),s._currentValue=n}function Ma(t){t._currentValue=Gd.current,ee(Gd)}function Yd(t,s,n){for(;t!==null;){var l=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,l!==null&&(l.childLanes|=s)):l!==null&&(l.childLanes&s)!==s&&(l.childLanes|=s),t===n)break;t=t.return}}function Xd(t,s,n,l){var d=t.child;for(d!==null&&(d.return=t);d!==null;){var h=d.dependencies;if(h!==null){var S=d.child;h=h.firstContext;e:for(;h!==null;){var A=h;h=d;for(var U=0;U<s.length;U++)if(A.context===s[U]){h.lanes|=n,A=h.alternate,A!==null&&(A.lanes|=n),Yd(h.return,n,t),l||(S=null);break e}h=A.next}}else if(d.tag===18){if(S=d.return,S===null)throw Error(o(341));S.lanes|=n,h=S.alternate,h!==null&&(h.lanes|=n),Yd(S,n,t),S=null}else S=d.child;if(S!==null)S.return=d;else for(S=d;S!==null;){if(S===t){S=null;break}if(d=S.sibling,d!==null){d.return=S.return,S=d;break}S=S.return}d=S}}function Hl(t,s,n,l){t=null;for(var d=s,h=!1;d!==null;){if(!h){if((d.flags&524288)!==0)h=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var S=d.alternate;if(S===null)throw Error(o(387));if(S=S.memoizedProps,S!==null){var A=d.type;ys(d.pendingProps.value,S.value)||(t!==null?t.push(A):t=[A])}}else if(d===re.current){if(S=d.alternate,S===null)throw Error(o(387));S.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(t!==null?t.push(yi):t=[yi])}d=d.return}t!==null&&Xd(s,t,n,l),s.flags|=262144}function po(t){for(t=t.firstContext;t!==null;){if(!ys(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Wn(t){Jn=t,Ea=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function ss(t){return ox(Jn,t)}function go(t,s){return Jn===null&&Wn(t),ox(t,s)}function ox(t,s){var n=s._currentValue;if(s={context:s,memoizedValue:n,next:null},Ea===null){if(t===null)throw Error(o(308));Ea=s,t.dependencies={lanes:0,firstContext:s},t.flags|=524288}else Ea=Ea.next=s;return n}var fw=typeof AbortController<"u"?AbortController:function(){var t=[],s=this.signal={aborted:!1,addEventListener:function(n,l){t.push(l)}};this.abort=function(){s.aborted=!0,t.forEach(function(n){return n()})}},hw=a.unstable_scheduleCallback,xw=a.unstable_NormalPriority,It={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Kd(){return{controller:new fw,data:new Map,refCount:0}}function Vl(t){t.refCount--,t.refCount===0&&hw(xw,function(){t.controller.abort()})}var Gl=null,Zd=0,qr=0,Hr=null;function pw(t,s){if(Gl===null){var n=Gl=[];Zd=0,qr=Ju(),Hr={status:"pending",value:void 0,then:function(l){n.push(l)}}}return Zd++,s.then(cx,cx),s}function cx(){if(--Zd===0&&Gl!==null){Hr!==null&&(Hr.status="fulfilled");var t=Gl;Gl=null,qr=0,Hr=null;for(var s=0;s<t.length;s++)(0,t[s])()}}function gw(t,s){var n=[],l={status:"pending",value:null,reason:null,then:function(d){n.push(d)}};return t.then(function(){l.status="fulfilled",l.value=s;for(var d=0;d<n.length;d++)(0,n[d])(s)},function(d){for(l.status="rejected",l.reason=d,d=0;d<n.length;d++)(0,n[d])(void 0)}),l}var dx=P.S;P.S=function(t,s){typeof s=="object"&&s!==null&&typeof s.then=="function"&&pw(t,s),dx!==null&&dx(t,s)};var er=B(null);function Qd(){var t=er.current;return t!==null?t:gt.pooledCache}function vo(t,s){s===null?te(er,er.current):te(er,s.pool)}function ux(){var t=Qd();return t===null?null:{parent:It._currentValue,pool:t}}var Yl=Error(o(460)),mx=Error(o(474)),yo=Error(o(542)),Jd={then:function(){}};function fx(t){return t=t.status,t==="fulfilled"||t==="rejected"}function bo(){}function hx(t,s,n){switch(n=t[n],n===void 0?t.push(s):n!==s&&(s.then(bo,bo),s=n),s.status){case"fulfilled":return s.value;case"rejected":throw t=s.reason,px(t),t;default:if(typeof s.status=="string")s.then(bo,bo);else{if(t=gt,t!==null&&100<t.shellSuspendCounter)throw Error(o(482));t=s,t.status="pending",t.then(function(l){if(s.status==="pending"){var d=s;d.status="fulfilled",d.value=l}},function(l){if(s.status==="pending"){var d=s;d.status="rejected",d.reason=l}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw t=s.reason,px(t),t}throw Xl=s,Yl}}var Xl=null;function xx(){if(Xl===null)throw Error(o(459));var t=Xl;return Xl=null,t}function px(t){if(t===Yl||t===yo)throw Error(o(483))}var an=!1;function Wd(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function eu(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function nn(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function rn(t,s,n){var l=t.updateQueue;if(l===null)return null;if(l=l.shared,(ct&2)!==0){var d=l.pending;return d===null?s.next=s:(s.next=d.next,d.next=s),l.pending=s,s=mo(t),sx(t,null,n),s}return uo(t,l,s,n),mo(t)}function Kl(t,s,n){if(s=s.updateQueue,s!==null&&(s=s.shared,(n&4194048)!==0)){var l=s.lanes;l&=t.pendingLanes,n|=l,s.lanes=n,Ki(t,n)}}function tu(t,s){var n=t.updateQueue,l=t.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var d=null,h=null;if(n=n.firstBaseUpdate,n!==null){do{var S={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};h===null?d=h=S:h=h.next=S,n=n.next}while(n!==null);h===null?d=h=s:h=h.next=s}else d=h=s;n={baseState:l.baseState,firstBaseUpdate:d,lastBaseUpdate:h,shared:l.shared,callbacks:l.callbacks},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=s:t.next=s,n.lastBaseUpdate=s}var su=!1;function Zl(){if(su){var t=Hr;if(t!==null)throw t}}function Ql(t,s,n,l){su=!1;var d=t.updateQueue;an=!1;var h=d.firstBaseUpdate,S=d.lastBaseUpdate,A=d.shared.pending;if(A!==null){d.shared.pending=null;var U=A,W=U.next;U.next=null,S===null?h=W:S.next=W,S=U;var ce=t.alternate;ce!==null&&(ce=ce.updateQueue,A=ce.lastBaseUpdate,A!==S&&(A===null?ce.firstBaseUpdate=W:A.next=W,ce.lastBaseUpdate=U))}if(h!==null){var fe=d.baseState;S=0,ce=W=U=null,A=h;do{var se=A.lane&-536870913,ae=se!==A.lane;if(ae?(at&se)===se:(l&se)===se){se!==0&&se===qr&&(su=!0),ce!==null&&(ce=ce.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var qe=t,Ie=A;se=s;var ft=n;switch(Ie.tag){case 1:if(qe=Ie.payload,typeof qe=="function"){fe=qe.call(ft,fe,se);break e}fe=qe;break e;case 3:qe.flags=qe.flags&-65537|128;case 0:if(qe=Ie.payload,se=typeof qe=="function"?qe.call(ft,fe,se):qe,se==null)break e;fe=y({},fe,se);break e;case 2:an=!0}}se=A.callback,se!==null&&(t.flags|=64,ae&&(t.flags|=8192),ae=d.callbacks,ae===null?d.callbacks=[se]:ae.push(se))}else ae={lane:se,tag:A.tag,payload:A.payload,callback:A.callback,next:null},ce===null?(W=ce=ae,U=fe):ce=ce.next=ae,S|=se;if(A=A.next,A===null){if(A=d.shared.pending,A===null)break;ae=A,A=ae.next,ae.next=null,d.lastBaseUpdate=ae,d.shared.pending=null}}while(!0);ce===null&&(U=fe),d.baseState=U,d.firstBaseUpdate=W,d.lastBaseUpdate=ce,h===null&&(d.shared.lanes=0),hn|=S,t.lanes=S,t.memoizedState=fe}}function gx(t,s){if(typeof t!="function")throw Error(o(191,t));t.call(s)}function vx(t,s){var n=t.callbacks;if(n!==null)for(t.callbacks=null,t=0;t<n.length;t++)gx(n[t],s)}var Vr=B(null),jo=B(0);function yx(t,s){t=La,te(jo,t),te(Vr,s),La=t|s.baseLanes}function au(){te(jo,La),te(Vr,Vr.current)}function nu(){La=jo.current,ee(Vr),ee(jo)}var ln=0,Ke=null,ut=null,Pt=null,No=!1,Gr=!1,tr=!1,wo=0,Jl=0,Yr=null,vw=0;function Tt(){throw Error(o(321))}function ru(t,s){if(s===null)return!1;for(var n=0;n<s.length&&n<t.length;n++)if(!ys(t[n],s[n]))return!1;return!0}function lu(t,s,n,l,d,h){return ln=h,Ke=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,P.H=t===null||t.memoizedState===null?sp:ap,tr=!1,h=n(l,d),tr=!1,Gr&&(h=jx(s,n,l,d)),bx(t),h}function bx(t){P.H=Eo;var s=ut!==null&&ut.next!==null;if(ln=0,Pt=ut=Ke=null,No=!1,Jl=0,Yr=null,s)throw Error(o(300));t===null||Vt||(t=t.dependencies,t!==null&&po(t)&&(Vt=!0))}function jx(t,s,n,l){Ke=t;var d=0;do{if(Gr&&(Yr=null),Jl=0,Gr=!1,25<=d)throw Error(o(301));if(d+=1,Pt=ut=null,t.updateQueue!=null){var h=t.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}P.H=Cw,h=s(n,l)}while(Gr);return h}function yw(){var t=P.H,s=t.useState()[0];return s=typeof s.then=="function"?Wl(s):s,t=t.useState()[0],(ut!==null?ut.memoizedState:null)!==t&&(Ke.flags|=1024),s}function iu(){var t=wo!==0;return wo=0,t}function ou(t,s,n){s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~n}function cu(t){if(No){for(t=t.memoizedState;t!==null;){var s=t.queue;s!==null&&(s.pending=null),t=t.next}No=!1}ln=0,Pt=ut=Ke=null,Gr=!1,Jl=wo=0,Yr=null}function ms(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Pt===null?Ke.memoizedState=Pt=t:Pt=Pt.next=t,Pt}function zt(){if(ut===null){var t=Ke.alternate;t=t!==null?t.memoizedState:null}else t=ut.next;var s=Pt===null?Ke.memoizedState:Pt.next;if(s!==null)Pt=s,ut=t;else{if(t===null)throw Ke.alternate===null?Error(o(467)):Error(o(310));ut=t,t={memoizedState:ut.memoizedState,baseState:ut.baseState,baseQueue:ut.baseQueue,queue:ut.queue,next:null},Pt===null?Ke.memoizedState=Pt=t:Pt=Pt.next=t}return Pt}function du(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Wl(t){var s=Jl;return Jl+=1,Yr===null&&(Yr=[]),t=hx(Yr,t,s),s=Ke,(Pt===null?s.memoizedState:Pt.next)===null&&(s=s.alternate,P.H=s===null||s.memoizedState===null?sp:ap),t}function So(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Wl(t);if(t.$$typeof===k)return ss(t)}throw Error(o(438,String(t)))}function uu(t){var s=null,n=Ke.updateQueue;if(n!==null&&(s=n.memoCache),s==null){var l=Ke.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(s={data:l.data.map(function(d){return d.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),n===null&&(n=du(),Ke.updateQueue=n),n.memoCache=s,n=s.data[s.index],n===void 0)for(n=s.data[s.index]=Array(t),l=0;l<t;l++)n[l]=z;return s.index++,n}function Ta(t,s){return typeof s=="function"?s(t):s}function Co(t){var s=zt();return mu(s,ut,t)}function mu(t,s,n){var l=t.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=n;var d=t.baseQueue,h=l.pending;if(h!==null){if(d!==null){var S=d.next;d.next=h.next,h.next=S}s.baseQueue=d=h,l.pending=null}if(h=t.baseState,d===null)t.memoizedState=h;else{s=d.next;var A=S=null,U=null,W=s,ce=!1;do{var fe=W.lane&-536870913;if(fe!==W.lane?(at&fe)===fe:(ln&fe)===fe){var se=W.revertLane;if(se===0)U!==null&&(U=U.next={lane:0,revertLane:0,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null}),fe===qr&&(ce=!0);else if((ln&se)===se){W=W.next,se===qr&&(ce=!0);continue}else fe={lane:0,revertLane:W.revertLane,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},U===null?(A=U=fe,S=h):U=U.next=fe,Ke.lanes|=se,hn|=se;fe=W.action,tr&&n(h,fe),h=W.hasEagerState?W.eagerState:n(h,fe)}else se={lane:fe,revertLane:W.revertLane,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},U===null?(A=U=se,S=h):U=U.next=se,Ke.lanes|=fe,hn|=fe;W=W.next}while(W!==null&&W!==s);if(U===null?S=h:U.next=A,!ys(h,t.memoizedState)&&(Vt=!0,ce&&(n=Hr,n!==null)))throw n;t.memoizedState=h,t.baseState=S,t.baseQueue=U,l.lastRenderedState=h}return d===null&&(l.lanes=0),[t.memoizedState,l.dispatch]}function fu(t){var s=zt(),n=s.queue;if(n===null)throw Error(o(311));n.lastRenderedReducer=t;var l=n.dispatch,d=n.pending,h=s.memoizedState;if(d!==null){n.pending=null;var S=d=d.next;do h=t(h,S.action),S=S.next;while(S!==d);ys(h,s.memoizedState)||(Vt=!0),s.memoizedState=h,s.baseQueue===null&&(s.baseState=h),n.lastRenderedState=h}return[h,l]}function Nx(t,s,n){var l=Ke,d=zt(),h=ot;if(h){if(n===void 0)throw Error(o(407));n=n()}else n=s();var S=!ys((ut||d).memoizedState,n);S&&(d.memoizedState=n,Vt=!0),d=d.queue;var A=Cx.bind(null,l,d,t);if(ei(2048,8,A,[t]),d.getSnapshot!==s||S||Pt!==null&&Pt.memoizedState.tag&1){if(l.flags|=2048,Xr(9,ko(),Sx.bind(null,l,d,n,s),null),gt===null)throw Error(o(349));h||(ln&124)!==0||wx(l,s,n)}return n}function wx(t,s,n){t.flags|=16384,t={getSnapshot:s,value:n},s=Ke.updateQueue,s===null?(s=du(),Ke.updateQueue=s,s.stores=[t]):(n=s.stores,n===null?s.stores=[t]:n.push(t))}function Sx(t,s,n,l){s.value=n,s.getSnapshot=l,kx(s)&&_x(t)}function Cx(t,s,n){return n(function(){kx(s)&&_x(t)})}function kx(t){var s=t.getSnapshot;t=t.value;try{var n=s();return!ys(t,n)}catch{return!0}}function _x(t){var s=$r(t,2);s!==null&&Cs(s,t,2)}function hu(t){var s=ms();if(typeof t=="function"){var n=t;if(t=n(),tr){ls(!0);try{n()}finally{ls(!1)}}}return s.memoizedState=s.baseState=t,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ta,lastRenderedState:t},s}function Dx(t,s,n,l){return t.baseState=n,mu(t,ut,typeof l=="function"?l:Ta)}function bw(t,s,n,l,d){if(Do(t))throw Error(o(485));if(t=s.action,t!==null){var h={payload:d,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){h.listeners.push(S)}};P.T!==null?n(!0):h.isTransition=!1,l(h),n=s.pending,n===null?(h.next=s.pending=h,Ex(s,h)):(h.next=n.next,s.pending=n.next=h)}}function Ex(t,s){var n=s.action,l=s.payload,d=t.state;if(s.isTransition){var h=P.T,S={};P.T=S;try{var A=n(d,l),U=P.S;U!==null&&U(S,A),Mx(t,s,A)}catch(W){xu(t,s,W)}finally{P.T=h}}else try{h=n(d,l),Mx(t,s,h)}catch(W){xu(t,s,W)}}function Mx(t,s,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(l){Tx(t,s,l)},function(l){return xu(t,s,l)}):Tx(t,s,n)}function Tx(t,s,n){s.status="fulfilled",s.value=n,Ax(s),t.state=n,s=t.pending,s!==null&&(n=s.next,n===s?t.pending=null:(n=n.next,s.next=n,Ex(t,n)))}function xu(t,s,n){var l=t.pending;if(t.pending=null,l!==null){l=l.next;do s.status="rejected",s.reason=n,Ax(s),s=s.next;while(s!==l)}t.action=null}function Ax(t){t=t.listeners;for(var s=0;s<t.length;s++)(0,t[s])()}function Rx(t,s){return s}function Ox(t,s){if(ot){var n=gt.formState;if(n!==null){e:{var l=Ke;if(ot){if(_t){t:{for(var d=_t,h=ia;d.nodeType!==8;){if(!h){d=null;break t}if(d=Vs(d.nextSibling),d===null){d=null;break t}}h=d.data,d=h==="F!"||h==="F"?d:null}if(d){_t=Vs(d.nextSibling),l=d.data==="F!";break e}}Qn(l)}l=!1}l&&(s=n[0])}}return n=ms(),n.memoizedState=n.baseState=s,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rx,lastRenderedState:s},n.queue=l,n=Wx.bind(null,Ke,l),l.dispatch=n,l=hu(!1),h=bu.bind(null,Ke,!1,l.queue),l=ms(),d={state:s,dispatch:null,action:t,pending:null},l.queue=d,n=bw.bind(null,Ke,d,h,n),d.dispatch=n,l.memoizedState=t,[s,n,!1]}function Px(t){var s=zt();return zx(s,ut,t)}function zx(t,s,n){if(s=mu(t,s,Rx)[0],t=Co(Ta)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var l=Wl(s)}catch(S){throw S===Yl?yo:S}else l=s;s=zt();var d=s.queue,h=d.dispatch;return n!==s.memoizedState&&(Ke.flags|=2048,Xr(9,ko(),jw.bind(null,d,n),null)),[l,h,t]}function jw(t,s){t.action=s}function Lx(t){var s=zt(),n=ut;if(n!==null)return zx(s,n,t);zt(),s=s.memoizedState,n=zt();var l=n.queue.dispatch;return n.memoizedState=t,[s,l,!1]}function Xr(t,s,n,l){return t={tag:t,create:n,deps:l,inst:s,next:null},s=Ke.updateQueue,s===null&&(s=du(),Ke.updateQueue=s),n=s.lastEffect,n===null?s.lastEffect=t.next=t:(l=n.next,n.next=t,t.next=l,s.lastEffect=t),t}function ko(){return{destroy:void 0,resource:void 0}}function Ux(){return zt().memoizedState}function _o(t,s,n,l){var d=ms();l=l===void 0?null:l,Ke.flags|=t,d.memoizedState=Xr(1|s,ko(),n,l)}function ei(t,s,n,l){var d=zt();l=l===void 0?null:l;var h=d.memoizedState.inst;ut!==null&&l!==null&&ru(l,ut.memoizedState.deps)?d.memoizedState=Xr(s,h,n,l):(Ke.flags|=t,d.memoizedState=Xr(1|s,h,n,l))}function $x(t,s){_o(8390656,8,t,s)}function Ix(t,s){ei(2048,8,t,s)}function Fx(t,s){return ei(4,2,t,s)}function Bx(t,s){return ei(4,4,t,s)}function qx(t,s){if(typeof s=="function"){t=t();var n=s(t);return function(){typeof n=="function"?n():s(null)}}if(s!=null)return t=t(),s.current=t,function(){s.current=null}}function Hx(t,s,n){n=n!=null?n.concat([t]):null,ei(4,4,qx.bind(null,s,t),n)}function pu(){}function Vx(t,s){var n=zt();s=s===void 0?null:s;var l=n.memoizedState;return s!==null&&ru(s,l[1])?l[0]:(n.memoizedState=[t,s],t)}function Gx(t,s){var n=zt();s=s===void 0?null:s;var l=n.memoizedState;if(s!==null&&ru(s,l[1]))return l[0];if(l=t(),tr){ls(!0);try{t()}finally{ls(!1)}}return n.memoizedState=[l,s],l}function gu(t,s,n){return n===void 0||(ln&1073741824)!==0?t.memoizedState=s:(t.memoizedState=n,t=Kp(),Ke.lanes|=t,hn|=t,n)}function Yx(t,s,n,l){return ys(n,s)?n:Vr.current!==null?(t=gu(t,n,l),ys(t,s)||(Vt=!0),t):(ln&42)===0?(Vt=!0,t.memoizedState=n):(t=Kp(),Ke.lanes|=t,hn|=t,s)}function Xx(t,s,n,l,d){var h=$.p;$.p=h!==0&&8>h?h:8;var S=P.T,A={};P.T=A,bu(t,!1,s,n);try{var U=d(),W=P.S;if(W!==null&&W(A,U),U!==null&&typeof U=="object"&&typeof U.then=="function"){var ce=gw(U,l);ti(t,s,ce,Ss(t))}else ti(t,s,l,Ss(t))}catch(fe){ti(t,s,{then:function(){},status:"rejected",reason:fe},Ss())}finally{$.p=h,P.T=S}}function Nw(){}function vu(t,s,n,l){if(t.tag!==5)throw Error(o(476));var d=Kx(t).queue;Xx(t,d,s,F,n===null?Nw:function(){return Zx(t),n(l)})}function Kx(t){var s=t.memoizedState;if(s!==null)return s;s={memoizedState:F,baseState:F,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ta,lastRenderedState:F},next:null};var n={};return s.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ta,lastRenderedState:n},next:null},t.memoizedState=s,t=t.alternate,t!==null&&(t.memoizedState=s),s}function Zx(t){var s=Kx(t).next.queue;ti(t,s,{},Ss())}function yu(){return ss(yi)}function Qx(){return zt().memoizedState}function Jx(){return zt().memoizedState}function ww(t){for(var s=t.return;s!==null;){switch(s.tag){case 24:case 3:var n=Ss();t=nn(n);var l=rn(s,t,n);l!==null&&(Cs(l,s,n),Kl(l,s,n)),s={cache:Kd()},t.payload=s;return}s=s.return}}function Sw(t,s,n){var l=Ss();n={lane:l,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null},Do(t)?ep(s,n):(n=$d(t,s,n,l),n!==null&&(Cs(n,t,l),tp(n,s,l)))}function Wx(t,s,n){var l=Ss();ti(t,s,n,l)}function ti(t,s,n,l){var d={lane:l,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null};if(Do(t))ep(s,d);else{var h=t.alternate;if(t.lanes===0&&(h===null||h.lanes===0)&&(h=s.lastRenderedReducer,h!==null))try{var S=s.lastRenderedState,A=h(S,n);if(d.hasEagerState=!0,d.eagerState=A,ys(A,S))return uo(t,s,d,0),gt===null&&co(),!1}catch{}finally{}if(n=$d(t,s,d,l),n!==null)return Cs(n,t,l),tp(n,s,l),!0}return!1}function bu(t,s,n,l){if(l={lane:2,revertLane:Ju(),action:l,hasEagerState:!1,eagerState:null,next:null},Do(t)){if(s)throw Error(o(479))}else s=$d(t,n,l,2),s!==null&&Cs(s,t,2)}function Do(t){var s=t.alternate;return t===Ke||s!==null&&s===Ke}function ep(t,s){Gr=No=!0;var n=t.pending;n===null?s.next=s:(s.next=n.next,n.next=s),t.pending=s}function tp(t,s,n){if((n&4194048)!==0){var l=s.lanes;l&=t.pendingLanes,n|=l,s.lanes=n,Ki(t,n)}}var Eo={readContext:ss,use:So,useCallback:Tt,useContext:Tt,useEffect:Tt,useImperativeHandle:Tt,useLayoutEffect:Tt,useInsertionEffect:Tt,useMemo:Tt,useReducer:Tt,useRef:Tt,useState:Tt,useDebugValue:Tt,useDeferredValue:Tt,useTransition:Tt,useSyncExternalStore:Tt,useId:Tt,useHostTransitionStatus:Tt,useFormState:Tt,useActionState:Tt,useOptimistic:Tt,useMemoCache:Tt,useCacheRefresh:Tt},sp={readContext:ss,use:So,useCallback:function(t,s){return ms().memoizedState=[t,s===void 0?null:s],t},useContext:ss,useEffect:$x,useImperativeHandle:function(t,s,n){n=n!=null?n.concat([t]):null,_o(4194308,4,qx.bind(null,s,t),n)},useLayoutEffect:function(t,s){return _o(4194308,4,t,s)},useInsertionEffect:function(t,s){_o(4,2,t,s)},useMemo:function(t,s){var n=ms();s=s===void 0?null:s;var l=t();if(tr){ls(!0);try{t()}finally{ls(!1)}}return n.memoizedState=[l,s],l},useReducer:function(t,s,n){var l=ms();if(n!==void 0){var d=n(s);if(tr){ls(!0);try{n(s)}finally{ls(!1)}}}else d=s;return l.memoizedState=l.baseState=d,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:d},l.queue=t,t=t.dispatch=Sw.bind(null,Ke,t),[l.memoizedState,t]},useRef:function(t){var s=ms();return t={current:t},s.memoizedState=t},useState:function(t){t=hu(t);var s=t.queue,n=Wx.bind(null,Ke,s);return s.dispatch=n,[t.memoizedState,n]},useDebugValue:pu,useDeferredValue:function(t,s){var n=ms();return gu(n,t,s)},useTransition:function(){var t=hu(!1);return t=Xx.bind(null,Ke,t.queue,!0,!1),ms().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,s,n){var l=Ke,d=ms();if(ot){if(n===void 0)throw Error(o(407));n=n()}else{if(n=s(),gt===null)throw Error(o(349));(at&124)!==0||wx(l,s,n)}d.memoizedState=n;var h={value:n,getSnapshot:s};return d.queue=h,$x(Cx.bind(null,l,h,t),[t]),l.flags|=2048,Xr(9,ko(),Sx.bind(null,l,h,n,s),null),n},useId:function(){var t=ms(),s=gt.identifierPrefix;if(ot){var n=Da,l=_a;n=(l&~(1<<32-Xt(l)-1)).toString(32)+n,s="«"+s+"R"+n,n=wo++,0<n&&(s+="H"+n.toString(32)),s+="»"}else n=vw++,s="«"+s+"r"+n.toString(32)+"»";return t.memoizedState=s},useHostTransitionStatus:yu,useFormState:Ox,useActionState:Ox,useOptimistic:function(t){var s=ms();s.memoizedState=s.baseState=t;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=n,s=bu.bind(null,Ke,!0,n),n.dispatch=s,[t,s]},useMemoCache:uu,useCacheRefresh:function(){return ms().memoizedState=ww.bind(null,Ke)}},ap={readContext:ss,use:So,useCallback:Vx,useContext:ss,useEffect:Ix,useImperativeHandle:Hx,useInsertionEffect:Fx,useLayoutEffect:Bx,useMemo:Gx,useReducer:Co,useRef:Ux,useState:function(){return Co(Ta)},useDebugValue:pu,useDeferredValue:function(t,s){var n=zt();return Yx(n,ut.memoizedState,t,s)},useTransition:function(){var t=Co(Ta)[0],s=zt().memoizedState;return[typeof t=="boolean"?t:Wl(t),s]},useSyncExternalStore:Nx,useId:Qx,useHostTransitionStatus:yu,useFormState:Px,useActionState:Px,useOptimistic:function(t,s){var n=zt();return Dx(n,ut,t,s)},useMemoCache:uu,useCacheRefresh:Jx},Cw={readContext:ss,use:So,useCallback:Vx,useContext:ss,useEffect:Ix,useImperativeHandle:Hx,useInsertionEffect:Fx,useLayoutEffect:Bx,useMemo:Gx,useReducer:fu,useRef:Ux,useState:function(){return fu(Ta)},useDebugValue:pu,useDeferredValue:function(t,s){var n=zt();return ut===null?gu(n,t,s):Yx(n,ut.memoizedState,t,s)},useTransition:function(){var t=fu(Ta)[0],s=zt().memoizedState;return[typeof t=="boolean"?t:Wl(t),s]},useSyncExternalStore:Nx,useId:Qx,useHostTransitionStatus:yu,useFormState:Lx,useActionState:Lx,useOptimistic:function(t,s){var n=zt();return ut!==null?Dx(n,ut,t,s):(n.baseState=t,[t,n.queue.dispatch])},useMemoCache:uu,useCacheRefresh:Jx},Kr=null,si=0;function Mo(t){var s=si;return si+=1,Kr===null&&(Kr=[]),hx(Kr,t,s)}function ai(t,s){s=s.props.ref,t.ref=s!==void 0?s:null}function To(t,s){throw s.$$typeof===v?Error(o(525)):(t=Object.prototype.toString.call(s),Error(o(31,t==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":t)))}function np(t){var s=t._init;return s(t._payload)}function rp(t){function s(Y,q){if(t){var Q=Y.deletions;Q===null?(Y.deletions=[q],Y.flags|=16):Q.push(q)}}function n(Y,q){if(!t)return null;for(;q!==null;)s(Y,q),q=q.sibling;return null}function l(Y){for(var q=new Map;Y!==null;)Y.key!==null?q.set(Y.key,Y):q.set(Y.index,Y),Y=Y.sibling;return q}function d(Y,q){return Y=ka(Y,q),Y.index=0,Y.sibling=null,Y}function h(Y,q,Q){return Y.index=Q,t?(Q=Y.alternate,Q!==null?(Q=Q.index,Q<q?(Y.flags|=67108866,q):Q):(Y.flags|=67108866,q)):(Y.flags|=1048576,q)}function S(Y){return t&&Y.alternate===null&&(Y.flags|=67108866),Y}function A(Y,q,Q,de){return q===null||q.tag!==6?(q=Fd(Q,Y.mode,de),q.return=Y,q):(q=d(q,Q),q.return=Y,q)}function U(Y,q,Q,de){var De=Q.type;return De===D?ce(Y,q,Q.props.children,de,Q.key):q!==null&&(q.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===R&&np(De)===q.type)?(q=d(q,Q.props),ai(q,Q),q.return=Y,q):(q=fo(Q.type,Q.key,Q.props,null,Y.mode,de),ai(q,Q),q.return=Y,q)}function W(Y,q,Q,de){return q===null||q.tag!==4||q.stateNode.containerInfo!==Q.containerInfo||q.stateNode.implementation!==Q.implementation?(q=Bd(Q,Y.mode,de),q.return=Y,q):(q=d(q,Q.children||[]),q.return=Y,q)}function ce(Y,q,Q,de,De){return q===null||q.tag!==7?(q=Yn(Q,Y.mode,de,De),q.return=Y,q):(q=d(q,Q),q.return=Y,q)}function fe(Y,q,Q){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=Fd(""+q,Y.mode,Q),q.return=Y,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case w:return Q=fo(q.type,q.key,q.props,null,Y.mode,Q),ai(Q,q),Q.return=Y,Q;case N:return q=Bd(q,Y.mode,Q),q.return=Y,q;case R:var de=q._init;return q=de(q._payload),fe(Y,q,Q)}if(X(q)||Z(q))return q=Yn(q,Y.mode,Q,null),q.return=Y,q;if(typeof q.then=="function")return fe(Y,Mo(q),Q);if(q.$$typeof===k)return fe(Y,go(Y,q),Q);To(Y,q)}return null}function se(Y,q,Q,de){var De=q!==null?q.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return De!==null?null:A(Y,q,""+Q,de);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case w:return Q.key===De?U(Y,q,Q,de):null;case N:return Q.key===De?W(Y,q,Q,de):null;case R:return De=Q._init,Q=De(Q._payload),se(Y,q,Q,de)}if(X(Q)||Z(Q))return De!==null?null:ce(Y,q,Q,de,null);if(typeof Q.then=="function")return se(Y,q,Mo(Q),de);if(Q.$$typeof===k)return se(Y,q,go(Y,Q),de);To(Y,Q)}return null}function ae(Y,q,Q,de,De){if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return Y=Y.get(Q)||null,A(q,Y,""+de,De);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case w:return Y=Y.get(de.key===null?Q:de.key)||null,U(q,Y,de,De);case N:return Y=Y.get(de.key===null?Q:de.key)||null,W(q,Y,de,De);case R:var Je=de._init;return de=Je(de._payload),ae(Y,q,Q,de,De)}if(X(de)||Z(de))return Y=Y.get(Q)||null,ce(q,Y,de,De,null);if(typeof de.then=="function")return ae(Y,q,Q,Mo(de),De);if(de.$$typeof===k)return ae(Y,q,Q,go(q,de),De);To(q,de)}return null}function qe(Y,q,Q,de){for(var De=null,Je=null,Oe=q,Fe=q=0,Yt=null;Oe!==null&&Fe<Q.length;Fe++){Oe.index>Fe?(Yt=Oe,Oe=null):Yt=Oe.sibling;var lt=se(Y,Oe,Q[Fe],de);if(lt===null){Oe===null&&(Oe=Yt);break}t&&Oe&&lt.alternate===null&&s(Y,Oe),q=h(lt,q,Fe),Je===null?De=lt:Je.sibling=lt,Je=lt,Oe=Yt}if(Fe===Q.length)return n(Y,Oe),ot&&Kn(Y,Fe),De;if(Oe===null){for(;Fe<Q.length;Fe++)Oe=fe(Y,Q[Fe],de),Oe!==null&&(q=h(Oe,q,Fe),Je===null?De=Oe:Je.sibling=Oe,Je=Oe);return ot&&Kn(Y,Fe),De}for(Oe=l(Oe);Fe<Q.length;Fe++)Yt=ae(Oe,Y,Fe,Q[Fe],de),Yt!==null&&(t&&Yt.alternate!==null&&Oe.delete(Yt.key===null?Fe:Yt.key),q=h(Yt,q,Fe),Je===null?De=Yt:Je.sibling=Yt,Je=Yt);return t&&Oe.forEach(function(wn){return s(Y,wn)}),ot&&Kn(Y,Fe),De}function Ie(Y,q,Q,de){if(Q==null)throw Error(o(151));for(var De=null,Je=null,Oe=q,Fe=q=0,Yt=null,lt=Q.next();Oe!==null&&!lt.done;Fe++,lt=Q.next()){Oe.index>Fe?(Yt=Oe,Oe=null):Yt=Oe.sibling;var wn=se(Y,Oe,lt.value,de);if(wn===null){Oe===null&&(Oe=Yt);break}t&&Oe&&wn.alternate===null&&s(Y,Oe),q=h(wn,q,Fe),Je===null?De=wn:Je.sibling=wn,Je=wn,Oe=Yt}if(lt.done)return n(Y,Oe),ot&&Kn(Y,Fe),De;if(Oe===null){for(;!lt.done;Fe++,lt=Q.next())lt=fe(Y,lt.value,de),lt!==null&&(q=h(lt,q,Fe),Je===null?De=lt:Je.sibling=lt,Je=lt);return ot&&Kn(Y,Fe),De}for(Oe=l(Oe);!lt.done;Fe++,lt=Q.next())lt=ae(Oe,Y,Fe,lt.value,de),lt!==null&&(t&&lt.alternate!==null&&Oe.delete(lt.key===null?Fe:lt.key),q=h(lt,q,Fe),Je===null?De=lt:Je.sibling=lt,Je=lt);return t&&Oe.forEach(function(k1){return s(Y,k1)}),ot&&Kn(Y,Fe),De}function ft(Y,q,Q,de){if(typeof Q=="object"&&Q!==null&&Q.type===D&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case w:e:{for(var De=Q.key;q!==null;){if(q.key===De){if(De=Q.type,De===D){if(q.tag===7){n(Y,q.sibling),de=d(q,Q.props.children),de.return=Y,Y=de;break e}}else if(q.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===R&&np(De)===q.type){n(Y,q.sibling),de=d(q,Q.props),ai(de,Q),de.return=Y,Y=de;break e}n(Y,q);break}else s(Y,q);q=q.sibling}Q.type===D?(de=Yn(Q.props.children,Y.mode,de,Q.key),de.return=Y,Y=de):(de=fo(Q.type,Q.key,Q.props,null,Y.mode,de),ai(de,Q),de.return=Y,Y=de)}return S(Y);case N:e:{for(De=Q.key;q!==null;){if(q.key===De)if(q.tag===4&&q.stateNode.containerInfo===Q.containerInfo&&q.stateNode.implementation===Q.implementation){n(Y,q.sibling),de=d(q,Q.children||[]),de.return=Y,Y=de;break e}else{n(Y,q);break}else s(Y,q);q=q.sibling}de=Bd(Q,Y.mode,de),de.return=Y,Y=de}return S(Y);case R:return De=Q._init,Q=De(Q._payload),ft(Y,q,Q,de)}if(X(Q))return qe(Y,q,Q,de);if(Z(Q)){if(De=Z(Q),typeof De!="function")throw Error(o(150));return Q=De.call(Q),Ie(Y,q,Q,de)}if(typeof Q.then=="function")return ft(Y,q,Mo(Q),de);if(Q.$$typeof===k)return ft(Y,q,go(Y,Q),de);To(Y,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,q!==null&&q.tag===6?(n(Y,q.sibling),de=d(q,Q),de.return=Y,Y=de):(n(Y,q),de=Fd(Q,Y.mode,de),de.return=Y,Y=de),S(Y)):n(Y,q)}return function(Y,q,Q,de){try{si=0;var De=ft(Y,q,Q,de);return Kr=null,De}catch(Oe){if(Oe===Yl||Oe===yo)throw Oe;var Je=bs(29,Oe,null,Y.mode);return Je.lanes=de,Je.return=Y,Je}finally{}}}var Zr=rp(!0),lp=rp(!1),Us=B(null),oa=null;function on(t){var s=t.alternate;te(Ft,Ft.current&1),te(Us,t),oa===null&&(s===null||Vr.current!==null||s.memoizedState!==null)&&(oa=t)}function ip(t){if(t.tag===22){if(te(Ft,Ft.current),te(Us,t),oa===null){var s=t.alternate;s!==null&&s.memoizedState!==null&&(oa=t)}}else cn()}function cn(){te(Ft,Ft.current),te(Us,Us.current)}function Aa(t){ee(Us),oa===t&&(oa=null),ee(Ft)}var Ft=B(0);function Ao(t){for(var s=t;s!==null;){if(s.tag===13){var n=s.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||dm(n)))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}function ju(t,s,n,l){s=t.memoizedState,n=n(l,s),n=n==null?s:y({},s,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var Nu={enqueueSetState:function(t,s,n){t=t._reactInternals;var l=Ss(),d=nn(l);d.payload=s,n!=null&&(d.callback=n),s=rn(t,d,l),s!==null&&(Cs(s,t,l),Kl(s,t,l))},enqueueReplaceState:function(t,s,n){t=t._reactInternals;var l=Ss(),d=nn(l);d.tag=1,d.payload=s,n!=null&&(d.callback=n),s=rn(t,d,l),s!==null&&(Cs(s,t,l),Kl(s,t,l))},enqueueForceUpdate:function(t,s){t=t._reactInternals;var n=Ss(),l=nn(n);l.tag=2,s!=null&&(l.callback=s),s=rn(t,l,n),s!==null&&(Cs(s,t,n),Kl(s,t,n))}};function op(t,s,n,l,d,h,S){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(l,h,S):s.prototype&&s.prototype.isPureReactComponent?!$l(n,l)||!$l(d,h):!0}function cp(t,s,n,l){t=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(n,l),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(n,l),s.state!==t&&Nu.enqueueReplaceState(s,s.state,null)}function sr(t,s){var n=s;if("ref"in s){n={};for(var l in s)l!=="ref"&&(n[l]=s[l])}if(t=t.defaultProps){n===s&&(n=y({},n));for(var d in t)n[d]===void 0&&(n[d]=t[d])}return n}var Ro=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)};function dp(t){Ro(t)}function up(t){console.error(t)}function mp(t){Ro(t)}function Oo(t,s){try{var n=t.onUncaughtError;n(s.value,{componentStack:s.stack})}catch(l){setTimeout(function(){throw l})}}function fp(t,s,n){try{var l=t.onCaughtError;l(n.value,{componentStack:n.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function wu(t,s,n){return n=nn(n),n.tag=3,n.payload={element:null},n.callback=function(){Oo(t,s)},n}function hp(t){return t=nn(t),t.tag=3,t}function xp(t,s,n,l){var d=n.type.getDerivedStateFromError;if(typeof d=="function"){var h=l.value;t.payload=function(){return d(h)},t.callback=function(){fp(s,n,l)}}var S=n.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(t.callback=function(){fp(s,n,l),typeof d!="function"&&(xn===null?xn=new Set([this]):xn.add(this));var A=l.stack;this.componentDidCatch(l.value,{componentStack:A!==null?A:""})})}function kw(t,s,n,l,d){if(n.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(s=n.alternate,s!==null&&Hl(s,n,d,!0),n=Us.current,n!==null){switch(n.tag){case 13:return oa===null?Yu():n.alternate===null&&Dt===0&&(Dt=3),n.flags&=-257,n.flags|=65536,n.lanes=d,l===Jd?n.flags|=16384:(s=n.updateQueue,s===null?n.updateQueue=new Set([l]):s.add(l),Ku(t,l,d)),!1;case 22:return n.flags|=65536,l===Jd?n.flags|=16384:(s=n.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([l])},n.updateQueue=s):(n=s.retryQueue,n===null?s.retryQueue=new Set([l]):n.add(l)),Ku(t,l,d)),!1}throw Error(o(435,n.tag))}return Ku(t,l,d),Yu(),!1}if(ot)return s=Us.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=d,l!==Vd&&(t=Error(o(422),{cause:l}
vendor: 1,053 bytes, line 48
48),ql(Os(t,n)))):(l!==Vd&&(s=Error(o(423),{cause:l}),ql(Os(s,n))),t=t.current.alternate,t.flags|=65536,d&=-d,t.lanes|=d,l=Os(l,n),d=wu(t.stateNode,l,d),tu(t,d),Dt!==4&&(Dt=2)),!1;var h=Error(o(520),{cause:l});if(h=Os(h,n),di===null?di=[h]:di.push(h),Dt!==4&&(Dt=2),s===null)return!0;l=Os(l,n),n=s;do{switch(n.tag){case 3:return n.flags|=65536,t=d&-d,n.lanes|=t,t=wu(n.stateNode,l,t),tu(n,t),!1;case 1:if(s=n.type,h=n.stateNode,(n.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(xn===null||!xn.has(h))))return n.flags|=65536,d&=-d,n.lanes|=d,d=hp(d),xp(d,t,n,l),tu(n,d),!1}n=n.return}while(n!==null);return!1}var pp=Error(o(461)),Vt=!1;function Zt(t,s,n,l){s.child=t===null?lp(s,null,n,l):Zr(s,t.child,n,l)}function gp(t,s,n,l,d){n=n.render;var h=s.ref;if("ref"in l){var S={};for(var A in l)A!=="ref"&&(S[A]=l[A])}else S=l;return Wn(s),l=lu(t,s,n,S,h,d),A=iu(),t!==null&&!Vt?(ou(t,s,d),Ra(t,s,d)):(ot&&A&&qd(s),s.flags|=1,Zt(t,s,l,d),s.child)}function vp(t,s,n,l,d){if(t===null){var h=n.t
vendor: 54,399 bytes, line 48
48ype;return typeof h=="function"&&!Id(h)&&h.defaultProps===void 0&&n.compare===null?(s.tag=15,s.type=h,yp(t,s,h,l,d)):(t=fo(n.type,null,l,s,s.mode,d),t.ref=s.ref,t.return=s,s.child=t)}if(h=t.child,!Tu(t,d)){var S=h.memoizedProps;if(n=n.compare,n=n!==null?n:$l,n(S,l)&&t.ref===s.ref)return Ra(t,s,d)}return s.flags|=1,t=ka(h,l),t.ref=s.ref,t.return=s,s.child=t}function yp(t,s,n,l,d){if(t!==null){var h=t.memoizedProps;if($l(h,l)&&t.ref===s.ref)if(Vt=!1,s.pendingProps=l=h,Tu(t,d))(t.flags&131072)!==0&&(Vt=!0);else return s.lanes=t.lanes,Ra(t,s,d)}return Su(t,s,n,l,d)}function bp(t,s,n){var l=s.pendingProps,d=l.children,h=t!==null?t.memoizedState:null;if(l.mode==="hidden"){if((s.flags&128)!==0){if(l=h!==null?h.baseLanes|n:n,t!==null){for(d=s.child=t.child,h=0;d!==null;)h=h|d.lanes|d.childLanes,d=d.sibling;s.childLanes=h&~l}else s.childLanes=0,s.child=null;return jp(t,s,l,n)}if((n&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},t!==null&&vo(s,h!==null?h.cachePool:null),h!==null?yx(s,h):au(),ip(s);else return s.lanes=s.childLanes=536870912,jp(t,s,h!==null?h.baseLanes|n:n,n)}else h!==null?(vo(s,h.cachePool),yx(s,h),cn(),s.memoizedState=null):(t!==null&&vo(s,null),au(),cn());return Zt(t,s,d,n),s.child}function jp(t,s,n,l){var d=Qd();return d=d===null?null:{parent:It._currentValue,pool:d},s.memoizedState={baseLanes:n,cachePool:d},t!==null&&vo(s,null),au(),ip(s),t!==null&&Hl(t,s,l,!0),null}function Po(t,s){var n=s.ref;if(n===null)t!==null&&t.ref!==null&&(s.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(o(284));(t===null||t.ref!==n)&&(s.flags|=4194816)}}function Su(t,s,n,l,d){return Wn(s),n=lu(t,s,n,l,void 0,d),l=iu(),t!==null&&!Vt?(ou(t,s,d),Ra(t,s,d)):(ot&&l&&qd(s),s.flags|=1,Zt(t,s,n,d),s.child)}function Np(t,s,n,l,d,h){return Wn(s),s.updateQueue=null,n=jx(s,l,n,d),bx(t),l=iu(),t!==null&&!Vt?(ou(t,s,h),Ra(t,s,h)):(ot&&l&&qd(s),s.flags|=1,Zt(t,s,n,h),s.child)}function wp(t,s,n,l,d){if(Wn(s),s.stateNode===null){var h=Ir,S=n.contextType;typeof S=="object"&&S!==null&&(h=ss(S)),h=new n(l,h),s.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Nu,s.stateNode=h,h._reactInternals=s,h=s.stateNode,h.props=l,h.state=s.memoizedState,h.refs={},Wd(s),S=n.contextType,h.context=typeof S=="object"&&S!==null?ss(S):Ir,h.state=s.memoizedState,S=n.getDerivedStateFromProps,typeof S=="function"&&(ju(s,n,S,l),h.state=s.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(S=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),S!==h.state&&Nu.enqueueReplaceState(h,h.state,null),Ql(s,l,h,d),Zl(),h.state=s.memoizedState),typeof h.componentDidMount=="function"&&(s.flags|=4194308),l=!0}else if(t===null){h=s.stateNode;var A=s.memoizedProps,U=sr(n,A);h.props=U;var W=h.context,ce=n.contextType;S=Ir,typeof ce=="object"&&ce!==null&&(S=ss(ce));var fe=n.getDerivedStateFromProps;ce=typeof fe=="function"||typeof h.getSnapshotBeforeUpdate=="function",A=s.pendingProps!==A,ce||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(A||W!==S)&&cp(s,h,l,S),an=!1;var se=s.memoizedState;h.state=se,Ql(s,l,h,d),Zl(),W=s.memoizedState,A||se!==W||an?(typeof fe=="function"&&(ju(s,n,fe,l),W=s.memoizedState),(U=an||op(s,n,U,l,se,W,S))?(ce||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(s.flags|=4194308)):(typeof h.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=l,s.memoizedState=W),h.props=l,h.state=W,h.context=S,l=U):(typeof h.componentDidMount=="function"&&(s.flags|=4194308),l=!1)}else{h=s.stateNode,eu(t,s),S=s.memoizedProps,ce=sr(n,S),h.props=ce,fe=s.pendingProps,se=h.context,W=n.contextType,U=Ir,typeof W=="object"&&W!==null&&(U=ss(W)),A=n.getDerivedStateFromProps,(W=typeof A=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(S!==fe||se!==U)&&cp(s,h,l,U),an=!1,se=s.memoizedState,h.state=se,Ql(s,l,h,d),Zl();var ae=s.memoizedState;S!==fe||se!==ae||an||t!==null&&t.dependencies!==null&&po(t.dependencies)?(typeof A=="function"&&(ju(s,n,A,l),ae=s.memoizedState),(ce=an||op(s,n,ce,l,se,ae,U)||t!==null&&t.dependencies!==null&&po(t.dependencies))?(W||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(l,ae,U),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(l,ae,U)),typeof h.componentDidUpdate=="function"&&(s.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof h.componentDidUpdate!="function"||S===t.memoizedProps&&se===t.memoizedState||(s.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||S===t.memoizedProps&&se===t.memoizedState||(s.flags|=1024),s.memoizedProps=l,s.memoizedState=ae),h.props=l,h.state=ae,h.context=U,l=ce):(typeof h.componentDidUpdate!="function"||S===t.memoizedProps&&se===t.memoizedState||(s.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||S===t.memoizedProps&&se===t.memoizedState||(s.flags|=1024),l=!1)}return h=l,Po(t,s),l=(s.flags&128)!==0,h||l?(h=s.stateNode,n=l&&typeof n.getDerivedStateFromError!="function"?null:h.render(),s.flags|=1,t!==null&&l?(s.child=Zr(s,t.child,null,d),s.child=Zr(s,null,n,d)):Zt(t,s,n,d),s.memoizedState=h.state,t=s.child):t=Ra(t,s,d),t}function Sp(t,s,n,l){return Bl(),s.flags|=256,Zt(t,s,n,l),s.child}var Cu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ku(t){return{baseLanes:t,cachePool:ux()}}function _u(t,s,n){return t=t!==null?t.childLanes&~n:0,s&&(t|=$s),t}function Cp(t,s,n){var l=s.pendingProps,d=!1,h=(s.flags&128)!==0,S;if((S=h)||(S=t!==null&&t.memoizedState===null?!1:(Ft.current&2)!==0),S&&(d=!0,s.flags&=-129),S=(s.flags&32)!==0,s.flags&=-33,t===null){if(ot){if(d?on(s):cn(),ot){var A=_t,U;if(U=A){e:{for(U=A,A=ia;U.nodeType!==8;){if(!A){A=null;break e}if(U=Vs(U.nextSibling),U===null){A=null;break e}}A=U}A!==null?(s.memoizedState={dehydrated:A,treeContext:Xn!==null?{id:_a,overflow:Da}:null,retryLane:536870912,hydrationErrors:null},U=bs(18,null,null,0),U.stateNode=A,U.return=s,s.child=U,is=s,_t=null,U=!0):U=!1}U||Qn(s)}if(A=s.memoizedState,A!==null&&(A=A.dehydrated,A!==null))return dm(A)?s.lanes=32:s.lanes=536870912,null;Aa(s)}return A=l.children,l=l.fallback,d?(cn(),d=s.mode,A=zo({mode:"hidden",children:A},d),l=Yn(l,d,n,null),A.return=s,l.return=s,A.sibling=l,s.child=A,d=s.child,d.memoizedState=ku(n),d.childLanes=_u(t,S,n),s.memoizedState=Cu,l):(on(s),Du(s,A))}if(U=t.memoizedState,U!==null&&(A=U.dehydrated,A!==null)){if(h)s.flags&256?(on(s),s.flags&=-257,s=Eu(t,s,n)):s.memoizedState!==null?(cn(),s.child=t.child,s.flags|=128,s=null):(cn(),d=l.fallback,A=s.mode,l=zo({mode:"visible",children:l.children},A),d=Yn(d,A,n,null),d.flags|=2,l.return=s,d.return=s,l.sibling=d,s.child=l,Zr(s,t.child,null,n),l=s.child,l.memoizedState=ku(n),l.childLanes=_u(t,S,n),s.memoizedState=Cu,s=d);else if(on(s),dm(A)){if(S=A.nextSibling&&A.nextSibling.dataset,S)var W=S.dgst;S=W,l=Error(o(419)),l.stack="",l.digest=S,ql({value:l,source:null,stack:null}),s=Eu(t,s,n)}else if(Vt||Hl(t,s,n,!1),S=(n&t.childLanes)!==0,Vt||S){if(S=gt,S!==null&&(l=n&-n,l=(l&42)!==0?1:Dl(l),l=(l&(S.suspendedLanes|n))!==0?0:l,l!==0&&l!==U.retryLane))throw U.retryLane=l,$r(t,l),Cs(S,t,l),pp;A.data==="$?"||Yu(),s=Eu(t,s,n)}else A.data==="$?"?(s.flags|=192,s.child=t.child,s=null):(t=U.treeContext,_t=Vs(A.nextSibling),is=s,ot=!0,Zn=null,ia=!1,t!==null&&(zs[Ls++]=_a,zs[Ls++]=Da,zs[Ls++]=Xn,_a=t.id,Da=t.overflow,Xn=s),s=Du(s,l.children),s.flags|=4096);return s}return d?(cn(),d=l.fallback,A=s.mode,U=t.child,W=U.sibling,l=ka(U,{mode:"hidden",children:l.children}),l.subtreeFlags=U.subtreeFlags&65011712,W!==null?d=ka(W,d):(d=Yn(d,A,n,null),d.flags|=2),d.return=s,l.return=s,l.sibling=d,s.child=l,l=d,d=s.child,A=t.child.memoizedState,A===null?A=ku(n):(U=A.cachePool,U!==null?(W=It._currentValue,U=U.parent!==W?{parent:W,pool:W}:U):U=ux(),A={baseLanes:A.baseLanes|n,cachePool:U}),d.memoizedState=A,d.childLanes=_u(t,S,n),s.memoizedState=Cu,l):(on(s),n=t.child,t=n.sibling,n=ka(n,{mode:"visible",children:l.children}),n.return=s,n.sibling=null,t!==null&&(S=s.deletions,S===null?(s.deletions=[t],s.flags|=16):S.push(t)),s.child=n,s.memoizedState=null,n)}function Du(t,s){return s=zo({mode:"visible",children:s},t.mode),s.return=t,t.child=s}function zo(t,s){return t=bs(22,t,null,s),t.lanes=0,t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},t}function Eu(t,s,n){return Zr(s,t.child,null,n),t=Du(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function kp(t,s,n){t.lanes|=s;var l=t.alternate;l!==null&&(l.lanes|=s),Yd(t.return,s,n)}function Mu(t,s,n,l,d){var h=t.memoizedState;h===null?t.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:l,tail:n,tailMode:d}:(h.isBackwards=s,h.rendering=null,h.renderingStartTime=0,h.last=l,h.tail=n,h.tailMode=d)}function _p(t,s,n){var l=s.pendingProps,d=l.revealOrder,h=l.tail;if(Zt(t,s,l.children,n),l=Ft.current,(l&2)!==0)l=l&1|2,s.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=s.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&kp(t,n,s);else if(t.tag===19)kp(t,n,s);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===s)break e;for(;t.sibling===null;){if(t.return===null||t.return===s)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}l&=1}switch(te(Ft,l),d){case"forwards":for(n=s.child,d=null;n!==null;)t=n.alternate,t!==null&&Ao(t)===null&&(d=n),n=n.sibling;n=d,n===null?(d=s.child,s.child=null):(d=n.sibling,n.sibling=null),Mu(s,!1,d,n,h);break;case"backwards":for(n=null,d=s.child,s.child=null;d!==null;){if(t=d.alternate,t!==null&&Ao(t)===null){s.child=d;break}t=d.sibling,d.sibling=n,n=d,d=t}Mu(s,!0,n,null,h);break;case"together":Mu(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Ra(t,s,n){if(t!==null&&(s.dependencies=t.dependencies),hn|=s.lanes,(n&s.childLanes)===0)if(t!==null){if(Hl(t,s,n,!1),(n&s.childLanes)===0)return null}else return null;if(t!==null&&s.child!==t.child)throw Error(o(153));if(s.child!==null){for(t=s.child,n=ka(t,t.pendingProps),s.child=n,n.return=s;t.sibling!==null;)t=t.sibling,n=n.sibling=ka(t,t.pendingProps),n.return=s;n.sibling=null}return s.child}function Tu(t,s){return(t.lanes&s)!==0?!0:(t=t.dependencies,!!(t!==null&&po(t)))}function _w(t,s,n){switch(s.tag){case 3:je(s,s.stateNode.containerInfo),sn(s,It,t.memoizedState.cache),Bl();break;case 27:case 5:ie(s);break;case 4:je(s,s.stateNode.containerInfo);break;case 10:sn(s,s.type,s.memoizedProps.value);break;case 13:var l=s.memoizedState;if(l!==null)return l.dehydrated!==null?(on(s),s.flags|=128,null):(n&s.child.childLanes)!==0?Cp(t,s,n):(on(s),t=Ra(t,s,n),t!==null?t.sibling:null);on(s);break;case 19:var d=(t.flags&128)!==0;if(l=(n&s.childLanes)!==0,l||(Hl(t,s,n,!1),l=(n&s.childLanes)!==0),d){if(l)return _p(t,s,n);s.flags|=128}if(d=s.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),te(Ft,Ft.current),l)break;return null;case 22:case 23:return s.lanes=0,bp(t,s,n);case 24:sn(s,It,t.memoizedState.cache)}return Ra(t,s,n)}function Dp(t,s,n){if(t!==null)if(t.memoizedProps!==s.pendingProps)Vt=!0;else{if(!Tu(t,n)&&(s.flags&128)===0)return Vt=!1,_w(t,s,n);Vt=(t.flags&131072)!==0}else Vt=!1,ot&&(s.flags&1048576)!==0&&nx(s,xo,s.index);switch(s.lanes=0,s.tag){case 16:e:{t=s.pendingProps;var l=s.elementType,d=l._init;if(l=d(l._payload),s.type=l,typeof l=="function")Id(l)?(t=sr(l,t),s.tag=1,s=wp(null,s,l,t,n)):(s.tag=0,s=Su(null,s,l,t,n));else{if(l!=null){if(d=l.$$typeof,d===C){s.tag=11,s=gp(null,s,l,t,n);break e}else if(d===L){s.tag=14,s=vp(null,s,l,t,n);break e}}throw s=ue(l)||l,Error(o(306,s,""))}}return s;case 0:return Su(t,s,s.type,s.pendingProps,n);case 1:return l=s.type,d=sr(l,s.pendingProps),wp(t,s,l,d,n);case 3:e:{if(je(s,s.stateNode.containerInfo),t===null)throw Error(o(387));l=s.pendingProps;var h=s.memoizedState;d=h.element,eu(t,s),Ql(s,l,null,n);var S=s.memoizedState;if(l=S.cache,sn(s,It,l),l!==h.cache&&Xd(s,[It],n,!0),Zl(),l=S.element,h.isDehydrated)if(h={element:l,isDehydrated:!1,cache:S.cache},s.updateQueue.baseState=h,s.memoizedState=h,s.flags&256){s=Sp(t,s,l,n);break e}else if(l!==d){d=Os(Error(o(424)),s),ql(d),s=Sp(t,s,l,n);break e}else{switch(t=s.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(_t=Vs(t.firstChild),is=s,ot=!0,Zn=null,ia=!0,n=lp(s,null,l,n),s.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Bl(),l===d){s=Ra(t,s,n);break e}Zt(t,s,l,n)}s=s.child}return s;case 26:return Po(t,s),t===null?(n=Ag(s.type,null,s.pendingProps,null))?s.memoizedState=n:ot||(n=s.type,t=s.pendingProps,l=Zo(K.current).createElement(n),l[Ue]=s,l[Qe]=t,Jt(l,n,t),Ht(l),s.stateNode=l):s.memoizedState=Ag(s.type,t.memoizedProps,s.pendingProps,t.memoizedState),null;case 27:return ie(s),t===null&&ot&&(l=s.stateNode=Eg(s.type,s.pendingProps,K.current),is=s,ia=!0,d=_t,vn(s.type)?(um=d,_t=Vs(l.firstChild)):_t=d),Zt(t,s,s.pendingProps.children,n),Po(t,s),t===null&&(s.flags|=4194304),s.child;case 5:return t===null&&ot&&((d=l=_t)&&(l=t1(l,s.type,s.pendingProps,ia),l!==null?(s.stateNode=l,is=s,_t=Vs(l.firstChild),ia=!1,d=!0):d=!1),d||Qn(s)),ie(s),d=s.type,h=s.pendingProps,S=t!==null?t.memoizedProps:null,l=h.children,im(d,h)?l=null:S!==null&&im(d,S)&&(s.flags|=32),s.memoizedState!==null&&(d=lu(t,s,yw,null,null,n),yi._currentValue=d),Po(t,s),Zt(t,s,l,n),s.child;case 6:return t===null&&ot&&((t=n=_t)&&(n=s1(n,s.pendingProps,ia),n!==null?(s.stateNode=n,is=s,_t=null,t=!0):t=!1),t||Qn(s)),null;case 13:return Cp(t,s,n);case 4:return je(s,s.stateNode.containerInfo),l=s.pendingProps,t===null?s.child=Zr(s,null,l,n):Zt(t,s,l,n),s.child;case 11:return gp(t,s,s.type,s.pendingProps,n);case 7:return Zt(t,s,s.pendingProps,n),s.child;case 8:return Zt(t,s,s.pendingProps.children,n),s.child;case 12:return Zt(t,s,s.pendingProps.children,n),s.child;case 10:return l=s.pendingProps,sn(s,s.type,l.value),Zt(t,s,l.children,n),s.child;case 9:return d=s.type._context,l=s.pendingProps.children,Wn(s),d=ss(d),l=l(d),s.flags|=1,Zt(t,s,l,n),s.child;case 14:return vp(t,s,s.type,s.pendingProps,n);case 15:return yp(t,s,s.type,s.pendingProps,n);case 19:return _p(t,s,n);case 31:return l=s.pendingProps,n=s.mode,l={mode:l.mode,children:l.children},t===null?(n=zo(l,n),n.ref=s.ref,s.child=n,n.return=s,s=n):(n=ka(t.child,l),n.ref=s.ref,s.child=n,n.return=s,s=n),s;case 22:return bp(t,s,n);case 24:return Wn(s),l=ss(It),t===null?(d=Qd(),d===null&&(d=gt,h=Kd(),d.pooledCache=h,h.refCount++,h!==null&&(d.pooledCacheLanes|=n),d=h),s.memoizedState={parent:l,cache:d},Wd(s),sn(s,It,d)):((t.lanes&n)!==0&&(eu(t,s),Ql(s,null,null,n),Zl()),d=t.memoizedState,h=s.memoizedState,d.parent!==l?(d={parent:l,cache:l},s.memoizedState=d,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=d),sn(s,It,l)):(l=h.cache,sn(s,It,l),l!==d.cache&&Xd(s,[It],n,!0))),Zt(t,s,s.pendingProps.children,n),s.child;case 29:throw s.pendingProps}throw Error(o(156,s.tag))}function Oa(t){t.flags|=4}function Ep(t,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Lg(s)){if(s=Us.current,s!==null&&((at&4194048)===at?oa!==null:(at&62914560)!==at&&(at&536870912)===0||s!==oa))throw Xl=Jd,mx;t.flags|=8192}}function Lo(t,s){s!==null&&(t.flags|=4),t.flags&16384&&(s=t.tag!==22?Kt():536870912,t.lanes|=s,el|=s)}function ni(t,s){if(!ot)switch(t.tailMode){case"hidden":s=t.tail;for(var n=null;s!==null;)s.alternate!==null&&(n=s),s=s.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var l=null;n!==null;)n.alternate!==null&&(l=n),n=n.sibling;l===null?s||t.tail===null?t.tail=null:t.tail.sibling=null:l.sibling=null}}function Ct(t){var s=t.alternate!==null&&t.alternate.child===t.child,n=0,l=0;if(s)for(var d=t.child;d!==null;)n|=d.lanes|d.childLanes,l|=d.subtreeFlags&65011712,l|=d.flags&65011712,d.return=t,d=d.sibling;else for(d=t.child;d!==null;)n|=d.lanes|d.childLanes,l|=d.subtreeFlags,l|=d.flags,d.return=t,d=d.sibling;return t.subtreeFlags|=l,t.childLanes=n,s}function Dw(t,s,n){var l=s.pendingProps;switch(Hd(s),s.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ct(s),null;case 1:return Ct(s),null;case 3:return n=s.stateNode,l=null,t!==null&&(l=t.memoizedState.cache),s.memoizedState.cache!==l&&(s.flags|=2048),Ma(It),Ae(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(Fl(s)?Oa(s):t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,ix())),Ct(s),null;case 26:return n=s.memoizedState,t===null?(Oa(s),n!==null?(Ct(s),Ep(s,n)):(Ct(s),s.flags&=-16777217)):n?n!==t.memoizedState?(Oa(s),Ct(s),Ep(s,n)):(Ct(s),s.flags&=-16777217):(t.memoizedProps!==l&&Oa(s),Ct(s),s.flags&=-16777217),null;case 27:we(s),n=K.current;var d=s.type;if(t!==null&&s.stateNode!=null)t.memoizedProps!==l&&Oa(s);else{if(!l){if(s.stateNode===null)throw Error(o(166));return Ct(s),null}t=ye.current,Fl(s)?rx(s):(t=Eg(d,l,n),s.stateNode=t,Oa(s))}return Ct(s),null;case 5:if(we(s),n=s.type,t!==null&&s.stateNode!=null)t.memoizedProps!==l&&Oa(s);else{if(!l){if(s.stateNode===null)throw Error(o(166));return Ct(s),null}if(t=ye.current,Fl(s))rx(s);else{switch(d=Zo(K.current),t){case 1:t=d.createElementNS("http://www.w3.org/2000/svg",n);break;case 2:t=d.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;default:switch(n){case"svg":t=d.createElementNS("http://www.w3.org/2000/svg",n);break;case"math":t=d.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;case"script":t=d.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild);break;case"select":t=typeof l.is=="string"?d.createElement("select",{is:l.is}):d.createElement("select"),l.multiple?t.multiple=!0:l.size&&(t.size=l.size);break;default:t=typeof l.is=="string"?d.createElement(n,{is:l.is}):d.createElement(n)}}t[Ue]=s,t[Qe]=l;e:for(d=s.child;d!==null;){if(d.tag===5||d.tag===6)t.appendChild(d.stateNode);else if(d.tag!==4&&d.tag!==27&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===s)break e;for(;d.sibling===null;){if(d.return===null||d.return===s)break e;d=d.return}d.sibling.return=d.return,d=d.sibling}s.stateNode=t;e:switch(Jt(t,n,l),n){case"button":case"input":case"select":case"textarea":t=!!l.autoFocus;break e;case"img":t=!0;break e;default:t=!1}t&&Oa(s)}}return Ct(s),s.flags&=-16777217,null;case 6:if(t&&s.stateNode!=null)t.memoizedProps!==l&&Oa(s);else{if(typeof l!="string"&&s.stateNode===null)throw Error(o(166));if(t=K.current,Fl(s)){if(t=s.stateNode,n=s.memoizedProps,l=null,d=is,d!==null)switch(d.tag){case 27:case 5:l=d.memoizedProps}t[Ue]=s,t=!!(t.nodeValue===n||l!==null&&l.suppressHydrationWarning===!0||Ng(t.nodeValue,n)),t||Qn(s)}else t=Zo(t).createTextNode(l),t[Ue]=s,s.stateNode=t}return Ct(s),null;case 13:if(l=s.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(d=Fl(s),l!==null&&l.dehydrated!==null){if(t===null){if(!d)throw Error(o(318));if(d=s.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(o(317));d[Ue]=s}else Bl(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Ct(s),d=!1}else d=ix(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=d),d=!0;if(!d)return s.flags&256?(Aa(s),s):(Aa(s),null)}if(Aa(s),(s.flags&128)!==0)return s.lanes=n,s;if(n=l!==null,t=t!==null&&t.memoizedState!==null,n){l=s.child,d=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(d=l.alternate.memoizedState.cachePool.pool);var h=null;l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(h=l.memoizedState.cachePool.pool),h!==d&&(l.flags|=2048)}return n!==t&&n&&(s.child.flags|=8192),Lo(s,s.updateQueue),Ct(s),null;case 4:return Ae(),t===null&&sm(s.stateNode.containerInfo),Ct(s),null;case 10:return Ma(s.type),Ct(s),null;case 19:if(ee(Ft),d=s.memoizedState,d===null)return Ct(s),null;if(l=(s.flags&128)!==0,h=d.rendering,h===null)if(l)ni(d,!1);else{if(Dt!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(h=Ao(t),h!==null){for(s.flags|=128,ni(d,!1),t=h.updateQueue,s.updateQueue=t,Lo(s,t),s.subtreeFlags=0,t=n,n=s.child;n!==null;)ax(n,t),n=n.sibling;return te(Ft,Ft.current&1|2),s.child}t=t.sibling}d.tail!==null&&Ve()>Io&&(s.flags|=128,l=!0,ni(d,!1),s.lanes=4194304)}else{if(!l)if(t=Ao(h),t!==null){if(s.flags|=128,l=!0,t=t.updateQueue,s.updateQueue=t,Lo(s,t),ni(d,!0),d.tail===null&&d.tailMode==="hidden"&&!h.alternate&&!ot)return Ct(s),null}else 2*Ve()-d.renderingStartTime>Io&&n!==536870912&&(s.flags|=128,l=!0,ni(d,!1),s.lanes=4194304);d.isBackwards?(h.sibling=s.child,s.child=h):(t=d.last,t!==null?t.sibling=h:s.child=h,d.last=h)}return d.tail!==null?(s=d.tail,d.rendering=s,d.tail=s.sibling,d.renderingStartTime=Ve(),s.sibling=null,t=Ft.current,te(Ft,l?t&1|2:t&1),s):(Ct(s),null);case 22:case 23:return Aa(s),nu(),l=s.memoizedState!==null,t!==null?t.memoizedState!==null!==l&&(s.flags|=8192):l&&(s.flags|=8192),l?(n&536870912)!==0&&(s.flags&128)===0&&(Ct(s),s.subtreeFlags&6&&(s.flags|=8192)):Ct(s),n=s.updateQueue,n!==null&&Lo(s,n.retryQueue),n=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),l=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),l!==n&&(s.flags|=2048),t!==null&&ee(er),null;case 24:return n=null,t!==null&&(n=t.memoizedState.cache),s.memoizedState.cache!==n&&(s.flags|=2048),Ma(It),Ct(s),null;case 25:return null;case 30:return null}throw Error(o(156,s.tag))}function Ew(t,s){switch(Hd(s),s.tag){case 1:return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return Ma(It),Ae(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 26:case 27:case 5:return we(s),null;case 13:if(Aa(s),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(o(340));Bl()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return ee(Ft),null;case 4:return Ae(),null;case 10:return Ma(s.type),null;case 22:case 23:return Aa(s),nu(),t!==null&&ee(er),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 24:return Ma(It),null;case 25:return null;default:return null}}function Mp(t,s){switch(Hd(s),s.tag){case 3:Ma(It),Ae();break;case 26:case 27:case 5:we(s);break;case 4:Ae();break;case 13:Aa(s);break;case 19:ee(Ft);break;case 10:Ma(s.type);break;case 22:case 23:Aa(s),nu(),t!==null&&ee(er);break;case 24:Ma(It)}}function ri(t,s){try{var n=s.updateQueue,l=n!==null?n.lastEffect:null;if(l!==null){var d=l.next;n=d;do{if((n.tag&t)===t){l=void 0;var h=n.create,S=n.inst;l=h(),S.destroy=l}n=n.next}while(n!==d)}}catch(A){ht(s,s.return,A)}}function dn(t,s,n){try{var l=s.updateQueue,d=l!==null?l.lastEffect:null;if(d!==null){var h=d.next;l=h;do{if((l.tag&t)===t){var S=l.inst,A=S.destroy;if(A!==void 0){S.destroy=void 0,d=s;var U=n,W=A;try{W()}catch(ce){ht(d,U,ce)}}}l=l.next}while(l!==h)}}catch(ce){ht(s,s.return,ce)}}function Tp(t){var s=t.updateQueue;if(s!==null){var n=t.stateNode;try{vx(s,n)}catch(l){ht(t,t.return,l)}}}function Ap(t,s,n){n.props=sr(t.type,t.memoizedProps),n.state=t.memoizedState;try{n.componentWillUnmount()}catch(l){ht(t,s,l)}}function li(t,s){try{var n=t.ref;if(n!==null){switch(t.tag){case 26:case 27:case 5:var l=t.stateNode;break;case 30:l=t.stateNode;break;default:l=t.stateNode}typeof n=="function"?t.refCleanup=n(l):n.current=l}}catch(d){ht(t,s,d)}}function ca(t,s){var n=t.ref,l=t.refCleanup;if(n!==null)if(typeof l=="function")try{l()}catch(d){ht(t,s,d)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(d){ht(t,s,d)}else n.current=null}function Rp(t){var s=t.type,n=t.memoizedProps,l=t.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":n.autoFocus&&l.focus();break e;case"img":n.src?l.src=n.src:n.srcSet&&(l.srcset=n.srcSet)}}catch(d){ht(t,t.return,d)}}function Au(t,s,n){try{var l=t.stateNode;Zw(l,t.type,n,s),l[Qe]=s}catch(d){ht(t,t.return,d)}}function Op(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&vn(t.type)||t.tag===4}function Ru(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Op(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&vn(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Ou(t,s,n){var l=t.tag;if(l===5||l===6)t=t.stateNode,s?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(t,s):(s=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,s.appendChild(t),n=n._reactRootContainer,n!=null||s.onclick!==null||(s.onclick=Ko));else if(l!==4&&(l===27&&vn(t.type)&&(n=t.stateNode,s=null),t=t.child,t!==null))for(Ou(t,s,n),t=t.sibling;t!==null;)Ou(t,s,n),t=t.sibling}function Uo(t,s,n){var l=t.tag;if(l===5||l===6)t=t.stateNode,s?n.insertBefore(t,s):n.appendChild(t);else if(l!==4&&(l===27&&vn(t.type)&&(n=t.stateNode),t=t.child,t!==null))for(Uo(t,s,n),t=t.sibling;t!==null;)Uo(t,s,n),t=t.sibling}function Pp(t){var s=t.stateNode,n=t.memoizedProps;try{for(var l=t.type,d=s.attributes;d.length;)s.removeAttributeNode(d[0]);Jt(s,l,n),s[Ue]=t,s[Qe]=n}catch(h){ht(t,t.return,h)}}var Pa=!1,At=!1,Pu=!1,zp=typeof WeakSet=="function"?WeakSet:Set,Gt=null;function Mw(t,s){if(t=t.containerInfo,rm=sc,t=Yh(t),Rd(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var l=n.getSelection&&n.getSelection();if(l&&l.rangeCount!==0){n=l.anchorNode;var d=l.anchorOffset,h=l.focusNode;l=l.focusOffset;try{n.nodeType,h.nodeType}catch{n=null;break e}var S=0,A=-1,U=-1,W=0,ce=0,fe=t,se=null;t:for(;;){for(var ae;fe!==n||d!==0&&fe.nodeType!==3||(A=S+d),fe!==h||l!==0&&fe.nodeType!==3||(U=S+l),fe.nodeType===3&&(S+=fe.nodeValue.length),(ae=fe.firstChild)!==null;)se=fe,fe=ae;for(;;){if(fe===t)break t;if(se===n&&++W===d&&(A=S),se===h&&++ce===l&&(U=S),(ae=fe.nextSibling)!==null)break;fe=se,se=fe.parentNode}fe=ae}n=A===-1||U===-1?null:{start:A,end:U}}else n=null}n=n||{start:0,end:0}}else n=null;for(lm={focusedElem:t,selectionRange:n},sc=!1,Gt=s;Gt!==null;)if(s=Gt,t=s.child,(s.subtreeFlags&1024)!==0&&t!==null)t.return=s,Gt=t;else for(;Gt!==null;){switch(s=Gt,h=s.alternate,t=s.flags,s.tag){case 0:break;case 11:case 15:break;case 1:if((t&1024)!==0&&h!==null){t=void 0,n=s,d=h.memoizedProps,h=h.memoizedState,l=n.stateNode;try{var qe=sr(n.type,d,n.elementType===n.type);t=l.getSnapshotBeforeUpdate(qe,h),l.__reactInternalSnapshotBeforeUpdate=t}catch(Ie){ht(n,n.return,Ie)}}break;case 3:if((t&1024)!==0){if(t=s.stateNode.containerInfo,n=t.nodeType,n===9)cm(t);else if(n===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":cm(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(o(163))}if(t=s.sibling,t!==null){t.return=s.return,Gt=t;break}Gt=s.return}}function Lp(t,s,n){var l=n.flags;switch(n.tag){case 0:case 11:case 15:un(t,n),l&4&&ri(5,n);break;case 1:if(un(t,n),l&4)if(t=n.stateNode,s===null)try{t.componentDidMount()}catch(S){ht(n,n.return,S)}else{var d=sr(n.type,s.memoizedProps);s=s.memoizedState;try{t.componentDidUpdate(d,s,t.__reactInternalSnapshotBeforeUpdate)}catch(S){ht(n,n.return,S)}}l&64&&Tp(n),l&512&&li(n,n.return);break;case 3:if(un(t,n),l&64&&(t=n.updateQueue,t!==null)){if(s=null,n.child!==null)switch(n.child.tag){case 27:case 5:s=n.child.stateNode;break;case 1:s=n.child.stateNode}try{vx(t,s)}catch(S){ht(n,n.return,S)}}break;case 27:s===null&&l&4&&Pp(n);case 26:case 5:un(t,n),s===null&&l&4&&Rp(n),l&512&&li(n,n.return);break;case 12:un(t,n);break;case 13:un(t,n),l&4&&Ip(t,n),l&64&&(t=n.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(n=$w.bind(null,n),a1(t,n))));break;case 22:if(l=n.memoizedState!==null||Pa,!l){s=s!==null&&s.memoizedState!==null||At,d=Pa;var h=At;Pa=l,(At=s)&&!h?mn(t,n,(n.subtreeFlags&8772)!==0):un(t,n),Pa=d,At=h}break;case 30:break;default:un(t,n)}}function Up(t){var s=t.alternate;s!==null&&(t.alternate=null,Up(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&hd(s)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var St=null,fs=!1;function za(t,s,n){for(n=n.child;n!==null;)$p(t,s,n),n=n.sibling}function $p(t,s,n){if(qt&&typeof qt.onCommitFiberUnmount=="function")try{qt.onCommitFiberUnmount(ra,n)}catch{}switch(n.tag){case 26:At||ca(n,s),za(t,s,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:At||ca(n,s);var l=St,d=fs;vn(n.type)&&(St=n.stateNode,fs=!1),za(t,s,n),xi(n.stateNode),St=l,fs=d;break;case 5:At||ca(n,s);case 6:if(l=St,d=fs,St=null,za(t,s,n),St=l,fs=d,St!==null)if(fs)try{(St.nodeType===9?St.body:St.nodeName==="HTML"?St.ownerDocument.body:St).removeChild(n.stateNode)}catch(h){ht(n,s,h)}else try{St.removeChild(n.stateNode)}catch(h){ht(n,s,h)}break;case 18:St!==null&&(fs?(t=St,_g(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,n.stateNode),wi(t)):_g(St,n.stateNode));break;case 4:l=St,d=fs,St=n.stateNode.containerInfo,fs=!0,za(t,s,n),St=l,fs=d;break;case 0:case 11:case 14:case 15:At||dn(2,n,s),At||dn(4,n,s),za(t,s,n);break;case 1:At||(ca(n,s),l=n.stateNode,typeof l.componentWillUnmount=="function"&&Ap(n,s,l)),za(t,s,n);break;case 21:za(t,s,n);break;case 22:At=(l=At)||n.memoizedState!==null,za(t,s,n),At=l;break;default:za(t,s,n)}}function Ip(t,s){if(s.memoizedState===null&&(t=s.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{wi(t)}catch(n){ht(s,s.return,n)}}function Tw(t){switch(t.tag){case 13:case 19:var s=t.stateNode;return s===null&&(s=t.stateNode=new zp),s;case 22:return t=t.stateNode,s=t._retryCache,s===null&&(s=t._retryCache=new zp),s;default:throw Error(o(435,t.tag))}}function zu(t,s){var n=Tw(t);s.forEach(function(l){var d=Iw.bind(null,t,l);n.has(l)||(n.add(l),l.then(d,d))})}function js(t,s){var n=s.deletions;if(n!==null)for(var l=0;l<n.length;l++){var d=n[l],h=t,S=s,A=S;e:for(;A!==null;){switch(A.tag){case 27:if(vn(A.type)){St=A.stateNode,fs=!1;break e}break;case 5:St=A.stateNode,fs=!1;break e;case 3:case 4:St=A.stateNode.containerInfo,fs=!0;break e}A=A.return}if(St===null)throw Error(o(160));$p(h,S,d),St=null,fs=!1,h=d.alternate,h!==null&&(h.return=null),d.return=null}if(s.subtreeFlags&13878)for(s=s.child;s!==null;)Fp(s,t),s=s.sibling}var Hs=null;function Fp(t,s){var n=t.alternate,l=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:js(s,t),Ns(t),l&4&&(dn(3,t,t.return),ri(3,t),dn(5,t,t.return));break;case 1:js(s,t),Ns(t),l&512&&(At||n===null||ca(n,n.return)),l&64&&Pa&&(t=t.updateQueue,t!==null&&(l=t.callbacks,l!==null&&(n=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=n===null?l:n.concat(l))));break;case 26:var d=Hs;if(js(s,t),Ns(t),l&512&&(At||n===null||ca(n,n.return)),l&4){var h=n!==null?n.memoizedState:null;if(l=t.memoizedState,n===null)if(l===null)if(t.stateNode===null){e:{l=t.type,n=t.memoizedProps,d=d.ownerDocument||d;t:switch(l){case"title":h=d.getElementsByTagName("title")[0],(!h||h[Ml]||h[Ue]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=d.createElement(l),d.head.insertBefore(h,d.querySelector("head > title"))),Jt(h,l,n),h[Ue]=t,Ht(h),l=h;break e;case"link":var S=Pg("link","href",d).get(l+(n.href||""));if(S){for(var A=0;A<S.length;A++)if(h=S[A],h.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&h.getAttribute("rel")===(n.rel==null?null:n.rel)&&h.getAttribute("title")===(n.title==null?null:n.title)&&h.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){S.splice(A,1);break t}}h=d.createElement(l),Jt(h,l,n),d.head.appendChild(h);break;case"meta":if(S=Pg("meta","content",d).get(l+(n.content||""))){for(A=0;A<S.length;A++)if(h=S[A],h.getAttribute("content")===(n.content==null?null:""+n.content)&&h.getAttribute("name")===(n.name==null?null:n.name)&&h.getAttribute("property")===(n.property==null?null:n.property)&&h.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&h.getAttribute("charset")===(n.charSet==null?null:n.charSet)){S.splice(A,1);break t}}h=d.createElement(l),Jt(h,l,n),d.head.appendChild(h);break;default:throw Error(o(468,l))}h[Ue]=t,Ht(h),l=h}t.stateNode=l}else zg(d,t.type,t.stateNode);else t.stateNode=Og(d,l,t.memoizedProps);else h!==l?(h===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):h.count--,l===null?zg(d,t.type,t.stateNode):Og(d,l,t.memoizedProps)):l===null&&t.stateNode!==null&&Au(t,t.memoizedProps,n.memoizedProps)}break;case 27:js(s,t),Ns(t),l&512&&(At||n===null||ca(n,n.return)),n!==null&&l&4&&Au(t,t.memoizedProps,n.memoizedProps);break;case 5:if(js(s,t),Ns(t),l&512&&(At||n===null||ca(n,n.return)),t.flags&32){d=t.stateNode;try{Ar(d,"")}catch(ae){ht(t,t.return,ae)}}l&4&&t.stateNode!=null&&(d=t.memoizedProps,Au(t,d,n!==null?n.memoizedProps:d)),l&1024&&(Pu=!0);break;case 6:if(js(s,t),Ns(t),l&4){if(t.stateNode===null)throw Error(o(162));l=t.memoizedProps,n=t.stateNode;try{n.nodeValue=l}catch(ae){ht(t,t.return,ae)}}break;case 3:if(Wo=null,d=Hs,Hs=Qo(s.containerInfo),js(s,t),Hs=d,Ns(t),l&4&&n!==null&&n.memoizedState.isDehydrated)try{wi(s.containerInfo)}catch(ae){ht(t,t.return,ae)}Pu&&(Pu=!1,Bp(t));break;case 4:l=Hs,Hs=Qo(t.stateNode.containerInfo),js(s,t),Ns(t),Hs=l;break;case 12:js(s,t),Ns(t);break;case 13:js(s,t),Ns(t),t.child.flags&8192&&t.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Bu=Ve()),l&4&&(l=t.updateQueue,l!==null&&(t.updateQueue=null,zu(t,l)));break;case 22:d=t.memoizedState!==null;var U=n!==null&&n.memoizedState!==null,W=Pa,ce=At;if(Pa=W||d,At=ce||U,js(s,t),At=ce,Pa=W,Ns(t),l&8192)e:for(s=t.stateNode,s._visibility=d?s._visibility&-2:s._visibility|1,d&&(n===null||U||Pa||At||ar(t)),n=null,s=t;;){if(s.tag===5||s.tag===26){if(n===null){U=n=s;try{if(h=U.stateNode,d)S=h.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{A=U.stateNode;var fe=U.memoizedProps.style,se=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;A.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(ae){ht(U,U.return,ae)}}}else if(s.tag===6){if(n===null){U=s;try{U.stateNode.nodeValue=d?"":U.memoizedProps}catch(ae){ht(U,U.return,ae)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===t)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break e;for(;s.sibling===null;){if(s.return===null||s.return===t)break e;n===s&&(n=null),s=s.return}n===s&&(n=null),s.sibling.return=s.return,s=s.sibling}l&4&&(l=t.updateQueue,l!==null&&(n=l.retryQueue,n!==null&&(l.retryQueue=null,zu(t,n))));break;case 19:js(s,t),Ns(t),l&4&&(l=t.updateQueue,l!==null&&(t.updateQueue=null,zu(t,l)));break;case 30:break;case 21:break;default:js(s,t),Ns(t)}}function Ns(t){var s=t.flags;if(s&2){try{for(var n,l=t.return;l!==null;){if(Op(l)){n=l;break}l=l.return}if(n==null)throw Error(o(160));switch(n.tag){case 27:var d=n.stateNode,h=Ru(t);Uo(t,h,d);break;case 5:var S=n.stateNode;n.flags&32&&(Ar(S,""),n.flags&=-33);var A=Ru(t);Uo(t,A,S);break;case 3:case 4:var U=n.stateNode.containerInfo,W=Ru(t);Ou(t,W,U);break;default:throw Error(o(161))}}catch(ce){ht(t,t.return,ce)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function Bp(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var s=t;Bp(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),t=t.sibling}}function un(t,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Lp(t,s.alternate,s),s=s.sibling}function ar(t){for(t=t.child;t!==null;){var s=t;switch(s.tag){case 0:case 11:case 14:case 15:dn(4,s,s.return),ar(s);break;case 1:ca(s,s.return);var n=s.stateNode;typeof n.componentWillUnmount=="function"&&Ap(s,s.return,n),ar(s);break;case 27:xi(s.stateNode);case 26:case 5:ca(s,s.return),ar(s);break;case 22:s.memoizedState===null&&ar(s);break;case 30:ar(s);break;default:ar(s)}t=t.sibling}}function mn(t,s,n){for(n=n&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var l=s.alternate,d=t,h=s,S=h.flags;switch(h.tag){case 0:case 11:case 15:mn(d,h,n),ri(4,h);break;case 1:if(mn(d,h,n),l=h,d=l.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(W){ht(l,l.return,W)}if(l=h,d=l.updateQueue,d!==null){var A=l.stateNode;try{var U=d.shared.hiddenCallbacks;if(U!==null)for(d.shared.hiddenCallbacks=null,d=0;d<U.length;d++)gx(U[d],A)}catch(W){ht(l,l.return,W)}}n&&S&64&&Tp(h),li(h,h.return);break;case 27:Pp(h);case 26:case 5:mn(d,h,n),n&&l===null&&S&4&&Rp(h),li(h,h.return);break;case 12:mn(d,h,n);break;case 13:mn(d,h,n),n&&S&4&&Ip(d,h);break;case 22:h.memoizedState===null&&mn(d,h,n),li(h,h.return);break;case 30:break;default:mn(d,h,n)}s=s.sibling}}function Lu(t,s){var n=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),t=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(t=s.memoizedState.cachePool.pool),t!==n&&(t!=null&&t.refCount++,n!=null&&Vl(n))}function Uu(t,s){t=null,s.alternate!==null&&(t=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==t&&(s.refCount++,t!=null&&Vl(t))}function da(t,s,n,l){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)qp(t,s,n,l),s=s.sibling}function qp(t,s,n,l){var d=s.flags;switch(s.tag){case 0:case 11:case 15:da(t,s,n,l),d&2048&&ri(9,s);break;case 1:da(t,s,n,l);break;case 3:da(t,s,n,l),d&2048&&(t=null,s.alternate!==null&&(t=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==t&&(s.refCount++,t!=null&&Vl(t)));break;case 12:if(d&2048){da(t,s,n,l),t=s.stateNode;try{var h=s.memoizedProps,S=h.id,A=h.onPostCommit;typeof A=="function"&&A(S,s.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(U){ht(s,s.return,U)}}else da(t,s,n,l);break;case 13:da(t,s,n,l);break;case 23:break;case 22:h=s.stateNode,S=s.alternate,s.memoizedState!==null?h._visibility&2?da(t,s,n,l):ii(t,s):h._visibility&2?da(t,s,n,l):(h._visibility|=2,Qr(t,s,n,l,(s.subtreeFlags&10256)!==0)),d&2048&&Lu(S,s);break;case 24:da(t,s,n,l),d&2048&&Uu(s.alternate,s);break;default:da(t,s,n,l)}}function Qr(t,s,n,l,d){for(d=d&&(s.subtreeFlags&10256)!==0,s=s.child;s!==null;){var h=t,S=s,A=n,U=l,W=S.flags;switch(S.tag){case 0:case 11:case 15:Qr(h,S,A,U,d),ri(8,S);break;case 23:break;case 22:var ce=S.stateNode;S.memoizedState!==null?ce._visibility&2?Qr(h,S,A,U,d):ii(h,S):(ce._visibility|=2,Qr(h,S,A,U,d)),d&&W&2048&&Lu(S.alternate,S);break;case 24:Qr(h,S,A,U,d),d&&W&2048&&Uu(S.alternate,S);break;default:Qr(h,S,A,U,d)}s=s.sibling}}function ii(t,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var n=t,l=s,d=l.flags;switch(l.tag){case 22:ii(n,l),d&2048&&Lu(l.alternate,l);break;case 24:ii(n,l),d&2048&&Uu(l.alternate,l);break;default:ii(n,l)}s=s.sibling}}var oi=8192;function Jr(t){if(t.subtreeFlags&oi)for(t=t.child;t!==null;)Hp(t),t=t.sibling}function Hp(t){switch(t.tag){case 26:Jr(t),t.flags&oi&&t.memoizedState!==null&&p1(Hs,t.memoizedState,t.memoizedProps);break;case 5:Jr(t);break;case 3:case 4:var s=Hs;Hs=Qo(t.stateNode.containerInfo),Jr(t),Hs=s;break;case 22:t.memoizedState===null&&(s=t.alternate,s!==null&&s.memoizedState!==null?(s=oi,oi=16777216,Jr(t),oi=s):Jr(t));break;default:Jr(t)}}function Vp(t){var s=t.alternate;if(s!==null&&(t=s.child,t!==null)){s.child=null;do s=t.sibling,t.sibling=null,t=s;while(t!==null)}}function ci(t){var s=t.deletions;if((t.flags&16)!==0){if(s!==null)for(var n=0;n<s.length;n++){var l=s[n];Gt=l,Yp(l,t)}Vp(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Gp(t),t=t.sibling}function Gp(t){switch(t.tag){case 0:case 11:case 15:ci(t),t.flags&2048&&dn(9,t,t.return);break;case 3:ci(t);break;case 12:ci(t);break;case 22:var s=t.stateNode;t.memoizedState!==null&&s._visibility&2&&(t.return===null||t.return.tag!==13)?(s._visibility&=-3,$o(t)):ci(t);break;default:ci(t)}}function $o(t){var s=t.deletions;if((t.flags&16)!==0){if(s!==null)for(var n=0;n<s.length;n++){var l=s[n];Gt=l,Yp(l,t)}Vp(t)}for(t=t.child;t!==null;){switch(s=t,s.tag){case 0:case 11:case 15:dn(8,s,s.return),$o(s);break;case 22:n=s.stateNode,n._visibility&2&&(n._visibility&=-3,$o(s));break;default:$o(s)}t=t.sibling}}function Yp(t,s){for(;Gt!==null;){var n=Gt;switch(n.tag){case 0:case 11:case 15:dn(8,n,s);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var l=n.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Vl(n.memoizedState.cache)}if(l=n.child,l!==null)l.return=n,Gt=l;else e:for(n=t;Gt!==null;){l=Gt;var d=l.sibling,h=l.return;if(Up(l),l===n){Gt=null;break e}if(d!==null){d.return=h,Gt=d;break e}Gt=h}}}var Aw={getCacheForType:function(t){var s=ss(It),n=s.data.get(t);return n===void 0&&(n=t(),s.data.set(t,n)),n}},Rw=typeof WeakMap=="function"?WeakMap:Map,ct=0,gt=null,We=null,at=0,dt=0,ws=null,fn=!1,Wr=!1,$u=!1,La=0,Dt=0,hn=0,nr=0,Iu=0,$s=0,el=0,di=null,hs=null,Fu=!1,Bu=0,Io=1/0,Fo=null,xn=null,Qt=0,pn=null,tl=null,sl=0,qu=0,Hu=null,Xp=null,ui=0,Vu=null;function Ss(){if((ct&2)!==0&&at!==0)return at&-at;if(P.T!==null){var t=qr;return t!==0?t:Ju()}return Zi()}function Kp(){$s===0&&($s=(at&536870912)===0||ot?Re():536870912);var t=Us.current;return t!==null&&(t.flags|=32),$s}function Cs(t,s,n){(t===gt&&(dt===2||dt===9)||t.cancelPendingCommit!==null)&&(al(t,0),gn(t,at,$s,!1)),tt(t,n),((ct&2)===0||t!==gt)&&(t===gt&&((ct&2)===0&&(nr|=n),Dt===4&&gn(t,at,$s,!1)),ua(t))}function Zp(t,s,n){if((ct&6)!==0)throw Error(o(327));var l=!n&&(s&124)===0&&(s&t.expiredLanes)===0||pe(t,s),d=l?zw(t,s):Xu(t,s,!0),h=l;do{if(d===0){Wr&&!l&&gn(t,s,0,!1);break}else{if(n=t.current.alternate,h&&!Ow(n)){d=Xu(t,s,!1),h=!1;continue}if(d===2){if(h=s,t.errorRecoveryDisabledLanes&h)var S=0;else S=t.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){s=S;e:{var A=t;d=di;var U=A.current.memoizedState.isDehydrated;if(U&&(al(A,S).flags|=256),S=Xu(A,S,!1),S!==2){if($u&&!U){A.errorRecoveryDisabledLanes|=h,nr|=h,d=4;break e}h=hs,hs=d,h!==null&&(hs===null?hs=h:hs.push.apply(hs,h))}d=S}if(h=!1,d!==2)continue}}if(d===1){al(t,0),gn(t,s,0,!0);break}e:{switch(l=t,h=d,h){case 0:case 1:throw Error(o(345));case 4:if((s&4194048)!==s)break;case 6:gn(l,s,$s,!fn);break e;case 2:hs=null;break;case 3:case 5:break;default:throw Error(o(329))}if((s&62914560)===s&&(d=Bu+300-Ve(),10<d)){if(gn(l,s,$s,!fn),be(l,0,!0)!==0)break e;l.timeoutHandle=Cg(Qp.bind(null,l,n,hs,Fo,Fu,s,$s,nr,el,fn,h,2,-0,0),d);break e}Qp(l,n,hs,Fo,Fu,s,$s,nr,el,fn,h,0,-0,0)}}break}while(!0);ua(t)}function Qp(t,s,n,l,d,h,S,A,U,W,ce,fe,se,ae){if(t.timeoutHandle=-1,fe=s.subtreeFlags,(fe&8192||(fe&16785408)===16785408)&&(vi={stylesheets:null,count:0,unsuspend:x1},Hp(s),fe=g1(),fe!==null)){t.cancelPendingCommit=fe(ng.bind(null,t,s,h,n,l,d,S,A,U,ce,1,se,ae)),gn(t,h,S,!W);return}ng(t,s,h,n,l,d,S,A,U)}function Ow(t){for(var s=t;;){var n=s.tag;if((n===0||n===11||n===15)&&s.flags&16384&&(n=s.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var l=0;l<n.length;l++){var d=n[l],h=d.getSnapshot;d=d.value;try{if(!ys(h(),d))return!1}catch{return!1}}if(n=s.child,s.subtreeFlags&16384&&n!==null)n.return=s,s=n;else{if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function gn(t,s,n,l){s&=~Iu,s&=~nr,t.suspendedLanes|=s,t.pingedLanes&=~s,l&&(t.warmLanes|=s),l=t.expirationTimes;for(var d=s;0<d;){var h=31-Xt(d),S=1<<h;l[h]=-1,d&=~S}n!==0&&rt(t,n,s)}function Bo(){return(ct&6)===0?(mi(0),!1):!0}function Gu(){if(We!==null){if(dt===0)var t=We.return;else t=We,Ea=Jn=null,cu(t),Kr=null,si=0,t=We;for(;t!==null;)Mp(t.alternate,t),t=t.return;We=null}}function al(t,s){var n=t.timeoutHandle;n!==-1&&(t.timeoutHandle=-1,Jw(n)),n=t.cancelPendingCommit,n!==null&&(t.cancelPendingCommit=null,n()),Gu(),gt=t,We=n=ka(t.current,null),at=s,dt=0,ws=null,fn=!1,Wr=pe(t,s),$u=!1,el=$s=Iu=nr=hn=Dt=0,hs=di=null,Fu=!1,(s&8)!==0&&(s|=s&32);var l=t.entangledLanes;if(l!==0)for(t=t.entanglements,l&=s;0<l;){var d=31-Xt(l),h=1<<d;s|=t[d],l&=~h}return La=s,co(),n}function Jp(t,s){Ke=null,P.H=Eo,s===Yl||s===yo?(s=xx(),dt=3):s===mx?(s=xx(),dt=4):dt=s===pp?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,ws=s,We===null&&(Dt=1,Oo(t,Os(s,t.current)))}function Wp(){var t=P.H;return P.H=Eo,t===null?Eo:t}function eg(){var t=P.A;return P.A=Aw,t}function Yu(){Dt=4,fn||(at&4194048)!==at&&Us.current!==null||(Wr=!0),(hn&134217727)===0&&(nr&134217727)===0||gt===null||gn(gt,at,$s,!1)}function Xu(t,s,n){var l=ct;ct|=2;var d=Wp(),h=eg();(gt!==t||at!==s)&&(Fo=null,al(t,s)),s=!1;var S=Dt;e:do try{if(dt!==0&&We!==null){var A=We,U=ws;switch(dt){case 8:Gu(),S=6;break e;case 3:case 2:case 9:case 6:Us.current===null&&(s=!0);var W=dt;if(dt=0,ws=null,nl(t,A,U,W),n&&Wr){S=0;break e}break;default:W=dt,dt=0,ws=null,nl(t,A,U,W)}}Pw(),S=Dt;break}catch(ce){Jp(t,ce)}while(!0);return s&&t.shellSuspendCounter++,Ea=Jn=null,ct=l,P.H=d,P.A=h,We===null&&(gt=null,at=0,co()),S}function Pw(){for(;We!==null;)tg(We)}function zw(t,s){var n=ct;ct|=2;var l=Wp(),d=eg();gt!==t||at!==s?(Fo=null,Io=Ve()+500,al(t,s)):Wr=pe(t,s);e:do try{if(dt!==0&&We!==null){s=We;var h=ws;t:switch(dt){case 1:dt=0,ws=null,nl(t,s,h,1);break;case 2:case 9:if(fx(h)){dt=0,ws=null,sg(s);break}s=function(){dt!==2&&dt!==9||gt!==t||(dt=7),ua(t)},h.then(s,s);break e;case 3:dt=7;break e;case 4:dt=5;break e;case 7:fx(h)?(dt=0,ws=null,sg(s)):(dt=0,ws=null,nl(t,s,h,7));break;case 5:var S=null;switch(We.tag){case 26:S=We.memoizedState;case 5:case 27:var A=We;if(!S||Lg(S)){dt=0,ws=null;var U=A.sibling;if(U!==null)We=U;else{var W=A.return;W!==null?(We=W,qo(W)):We=null}break t}}dt=0,ws=null,nl(t,s,h,5);break;case 6:dt=0,ws=null,nl(t,s,h,6);break;case 8:Gu(),Dt=6;break e;default:throw Error(o(462))}}Lw();break}catch(ce){Jp(t,ce)}while(!0);return Ea=Jn=null,P.H=l,P.A=d,ct=n,We!==null?0:(gt=null,at=0,co(),Dt)}function Lw(){for(;We!==null&&!Pe();)tg(We)}function tg(t){var s=Dp(t.alternate,t,La);t.memoizedProps=t.pendingProps,s===null?qo(t):We=s}function sg(t){var s=t,n=s.alternate;switch(s.tag){case 15:case 0:s=Np(n,s,s.pendingProps,s.type,void 0,at);break;case 11:s=Np(n,s,s.pendingProps,s.type.render,s.ref,at);break;case 5:cu(s);default:Mp(n,s),s=We=ax(s,La),s=Dp(n,s,La)}t.memoizedProps=t.pendingProps,s===null?qo(t):We=s}function nl(t,s,n,l){Ea=Jn=null,cu(s),Kr=null,si=0;var d=s.return;try{if(kw(t,d,s,n,at)){Dt=1,Oo(t,Os(n,t.current)),We=null;return}}catch(h){if(d!==null)throw We=d,h;Dt=1,Oo(t,Os(n,t.current)),We=null;return}s.flags&32768?(ot||l===1?t=!0:Wr||(at&536870912)!==0?t=!1:(fn=t=!0,(l===2||l===9||l===3||l===6)&&(l=Us.current,l!==null&&l.tag===13&&(l.flags|=16384))),ag(s,t)):qo(s)}function qo(t){var s=t;do{if((s.flags&32768)!==0){ag(s,fn);return}t=s.return;var n=Dw(s.alternate,s,La);if(n!==null){We=n;return}if(s=s.sibling,s!==null){We=s;return}We=s=t}while(s!==null);Dt===0&&(Dt=5)}function ag(t,s){do{var n=Ew(t.alternate,t);if(n!==null){n.flags&=32767,We=n;return}if(n=t.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!s&&(t=t.sibling,t!==null)){We=t;return}We=t=n}while(t!==null);Dt=6,We=null}function ng(t,s,n,l,d,h,S,A,U){t.cancelPendingCommit=null;do Ho();while(Qt!==0);if((ct&6)!==0)throw Error(o(327));if(s!==null){if(s===t.current)throw Error(o(177));if(h=s.lanes|s.childLanes,h|=Ud,st(t,n,h,S,A,U),t===gt&&(We=gt=null,at=0),tl=s,pn=t,sl=n,qu=h,Hu=d,Xp=l,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,Fw(Le,function(){return cg(),null})):(t.callbackNode=null,t.callbackPriority=0),l=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||l){l=P.T,P.T=null,d=$.p,$.p=2,S=ct,ct|=4;try{Mw(t,s,n)}finally{ct=S,$.p=d,P.T=l}}Qt=1,rg(),lg(),ig()}}function rg(){if(Qt===1){Qt=0;var t=pn,s=tl,n=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||n){n=P.T,P.T=null;var l=$.p;$.p=2;var d=ct;ct|=4;try{Fp(s,t);var h=lm,S=Yh(t.containerInfo),A=h.focusedElem,U=h.selectionRange;if(S!==A&&A&&A.ownerDocument&&Gh(A.ownerDocument.documentElement,A)){if(U!==null&&Rd(A)){var W=U.start,ce=U.end;if(ce===void 0&&(ce=W),"selectionStart"in A)A.selectionStart=W,A.selectionEnd=Math.min(ce,A.value.length);else{var fe=A.ownerDocument||document,se=fe&&fe.defaultView||window;if(se.getSelection){var ae=se.getSelection(),qe=A.textContent.length,Ie=Math.min(U.start,qe),ft=U.end===void 0?Ie:Math.min(U.end,qe);!ae.extend&&Ie>ft&&(S=ft,ft=Ie,Ie=S);var Y=Vh(A,Ie),q=Vh(A,ft);if(Y&&q&&(ae.rangeCount!==1||ae.anchorNode!==Y.node||ae.anchorOffset!==Y.offset||ae.focusNode!==q.node||ae.focusOffset!==q.offset)){var Q=fe.createRange();Q.setStart(Y.node,Y.offset),ae.removeAllRanges(),Ie>ft?(ae.addRange(Q),ae.extend(q.node,q.offset)):(Q.setEnd(q.node,q.offset),ae.addRange(Q))}}}}for(fe=[],ae=A;ae=ae.parentNode;)ae.nodeType===1&&fe.push({element:ae,left:ae.scrollLeft,top:ae.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<fe.length;A++){var de=fe[A];de.element.scrollLeft=de.left,de.element.scrollTop=de.top}}sc=!!rm,lm=rm=null}finally{ct=d,$.p=l,P.T=n}}t.current=s,Qt=2}}function lg(){if(Qt===2){Qt=0;var t=pn,s=tl,n=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||n){n=P.T,P.T=null;var l=$.p;$.p=2;var d=ct;ct|=4;try{Lp(t,s.alternate,s)}finally{ct=d,$.p=l,P.T=n}}Qt=3}}function ig(){if(Qt===4||Qt===3){Qt=0,pt();var t=pn,s=tl,n=sl,l=Xp;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?Qt=5:(Qt=0,tl=pn=null,og(t,t.pendingLanes));var d=t.pendingLanes;if(d===0&&(xn=null),El(n),s=s.stateNode,qt&&typeof qt.onCommitFiberRoot=="function")try{qt.onCommitFiberRoot(ra,s,void 0,(s.current.flags&128)===128)}catch{}if(l!==null){s=P.T,d=$.p,$.p=2,P.T=null;try{for(var h=t.onRecoverableError,S=0;S<l.length;S++){var A=l[S];h(A.value,{componentStack:A.stack})}}finally{P.T=s,$.p=d}}(sl&3)!==0&&Ho(),ua(t),d=t.pendingLanes,(n&4194090)!==0&&(d&42)!==0?t===Vu?ui++:(ui=0,Vu=t):ui=0,mi(0)}}function og(t,s){(t.pooledCacheLanes&=s)===0&&(s=t.pooledCache,s!=null&&(t.pooledCache=null,Vl(s)))}function Ho(t){return rg(),lg(),ig(),cg()}function cg(){if(Qt!==5)return!1;var t=pn,s=qu;qu=0;var n=El(sl),l=P.T,d=$.p;try{$.p=32>n?32:n,P.T=null,n=Hu,Hu=null;var h=pn,S=sl;if(Qt=0,tl=pn=null,sl=0,(ct&6)!==0)throw Error(o(331));var A=ct;if(ct|=4,Gp(h.current),qp(h,h.current,S,n),ct=A,mi(0,!1),qt&&typeof qt.onPostCommitFiberRoot=="function")try{qt.onPostCommitFiberRoot(ra,h)}catch{}return!0}finally{$.p=d,P.T=l,og(t,s)}}function dg(t,s,n){s=Os(n,s),s=wu(t.stateNode,s,2),t=rn(t,s,2),t!==null&&(tt(t,2),ua(t))}function ht(t,s,n){if(t.tag===3)dg(t,t,n);else for(;s!==null;){if(s.tag===3){dg(s,t,n);break}else if(s.tag===1){var l=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(xn===null||!xn.has(l))){t=Os(n,t),n=hp(2),l=rn(s,n,2),l!==null&&(xp(n,l,s,t),tt(l,2),ua(l));break}}s=s.return}}function Ku(t,s,n){var l=t.pingCache;if(l===null){l=t.pingCache=new Rw;var d=new Set;l.set(s,d)}else d=l.get(s),d===void 0&&(d=new Set,l.set(s,d));d.has(n)||($u=!0,d.add(n),t=Uw.bind(null,t,s,n),s.then(t,t))}function Uw(t,s,n){var l=t.pingCache;l!==null&&l.delete(s),t.pingedLanes|=t.suspendedLanes&n,t.warmLanes&=~n,gt===t&&(at&n)===n&&(Dt===4||Dt===3&&(at&62914560)===at&&300>Ve()-Bu?(ct&2)===0&&al(t,0):Iu|=n,el===at&&(el=0)),ua(t)}function ug(t,s){s===0&&(s=Kt()),t=$r(t,s),t!==null&&(tt(t,s),ua(t))}function $w(t){var s=t.memoizedState,n=0;s!==null&&(n=s.retryLane),ug(t,n)}function Iw(t,s){var n=0;switch(t.tag){case 13:var l=t.stateNode,d=t.memoizedState;d!==null&&(n=d.retryLane);break;case 19:l=t.stateNode;break;case 22:l=t.stateNode._retryCache;break;default:throw Error(o(314))}l!==null&&l.delete(s),ug(t,n)}function Fw(t,s){return me(t,s)}var Vo=null,rl=null,Zu=!1,Go=!1,Qu=!1,rr=0;function ua(t){t!==rl&&t.next===null&&(rl===null?Vo=rl=t:rl=rl.next=t),Go=!0,Zu||(Zu=!0,qw())}function mi(t,s){if(!Qu&&Go){Qu=!0;do for(var n=!1,l=Vo;l!==null;){if(t!==0){var d=l.pendingLanes;if(d===0)var h=0;else{var S=l.suspendedLanes,A=l.pingedLanes;h=(1<<31-Xt(42|t)+1)-1,h&=d&~(S&~A),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(n=!0,xg(l,h))}else h=at,h=be(l,l===gt?h:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(h&3)===0||pe(l,h)||(n=!0,xg(l,h));l=l.next}while(n);Qu=!1}}function Bw(){mg()}function mg(){Go=Zu=!1;var t=0;rr!==0&&(Qw()&&(t=rr),rr=0);for(var s=Ve(),n=null,l=Vo;l!==null;){var d=l.next,h=fg(l,s);h===0?(l.next=null,n===null?Vo=d:n.next=d,d===null&&(rl=n)):(n=l,(t!==0||(h&3)!==0)&&(Go=!0)),l=d}mi(t)}function fg(t,s){for(var n=t.suspendedLanes,l=t.pingedLanes,d=t.expirationTimes,h=t.pendingLanes&-62914561;0<h;){var S=31-Xt(h),A=1<<S,U=d[S];U===-1?((A&n)===0||(A&l)!==0)&&(d[S]=ke(A,s)):U<=s&&(t.expiredLanes|=A),h&=~A}if(s=gt,n=at,n=be(t,t===s?n:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),l=t.callbackNode,n===0||t===s&&(dt===2||dt===9)||t.cancelPendingCommit!==null)return l!==null&&l!==null&&Se(l),t.callbackNode=null,t.callbackPriority=0;if((n&3)===0||pe(t,n)){if(s=n&-n,s===t.callbackPriority)return s;switch(l!==null&&Se(l),El(n)){case 2:case 8:n=le;break;case 32:n=Le;break;case 268435456:n=Ne;break;default:n=Le}return l=hg.bind(null,t),n=me(n,l),t.callbackPriority=s,t.callbackNode=n,s}return l!==null&&l!==null&&Se(l),t.callbackPriority=2,t.callbackNode=null,2}function hg(t,s){if(Qt!==0&&Qt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var n=t.callbackNode;if(Ho()&&t.callbackNode!==n)return null;var l=at;return l=be(t,t===gt?l:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),l===0?null:(Zp(t,l,s),fg(t,Ve()),t.callbackNode!=null&&t.callbackNode===n?hg.bind(null,t):null)}function xg(t,s){if(Ho())return null;Zp(t,s,!0)}function qw(){Ww(function(){(ct&6)!==0?me(ds,Bw):mg()})}function Ju(){return rr===0&&(rr=Re()),rr}function pg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:so(""+t)}function gg(t,s){var n=s.ownerDocument.createElement("input");return n.name=s.name,n.value=s.value,t.id&&n.setAttribute("form",t.id),s.parentNode.insertBefore(n,s),t=new FormData(t),n.parentNode.removeChild(n),t}function Hw(t,s,n,l,d){if(s==="submit"&&n&&n.stateNode===d){var h=pg
vendor: 5,885 bytes, line 48
48((d[Qe]||null).action),S=l.submitter;S&&(s=(s=S[Qe]||null)?pg(s.formAction):S.getAttribute("formAction"),s!==null&&(h=s,S=null));var A=new lo("action","action",null,l,d);t.push({event:A,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(rr!==0){var U=S?gg(d,S):new FormData(d);vu(n,{pending:!0,data:U,method:d.method,action:h},null,U)}}else typeof h=="function"&&(A.preventDefault(),U=S?gg(d,S):new FormData(d),vu(n,{pending:!0,data:U,method:d.method,action:h},h,U))},currentTarget:d}]})}}for(var Wu=0;Wu<Ld.length;Wu++){var em=Ld[Wu],Vw=em.toLowerCase(),Gw=em[0].toUpperCase()+em.slice(1);qs(Vw,"on"+Gw)}qs(Zh,"onAnimationEnd"),qs(Qh,"onAnimationIteration"),qs(Jh,"onAnimationStart"),qs("dblclick","onDoubleClick"),qs("focusin","onFocus"),qs("focusout","onBlur"),qs(cw,"onTransitionRun"),qs(dw,"onTransitionStart"),qs(uw,"onTransitionCancel"),qs(Wh,"onTransitionEnd"),Er("onMouseEnter",["mouseout","mouseover"]),Er("onMouseLeave",["mouseout","mouseover"]),Er("onPointerEnter",["pointerout","pointerover"]),Er("onPointerLeave",["pointerout","pointerover"]),qn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),qn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),qn("onBeforeInput",["compositionend","keypress","textInput","paste"]),qn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),qn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),qn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var fi="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Yw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(fi));function vg(t,s){s=(s&4)!==0;for(var n=0;n<t.length;n++){var l=t[n],d=l.event;l=l.listeners;e:{var h=void 0;if(s)for(var S=l.length-1;0<=S;S--){var A=l[S],U=A.instance,W=A.currentTarget;if(A=A.listener,U!==h&&d.isPropagationStopped())break e;h=A,d.currentTarget=W;try{h(d)}catch(ce){Ro(ce)}d.currentTarget=null,h=U}else for(S=0;S<l.length;S++){if(A=l[S],U=A.instance,W=A.currentTarget,A=A.listener,U!==h&&d.isPropagationStopped())break e;h=A,d.currentTarget=W;try{h(d)}catch(ce){Ro(ce)}d.currentTarget=null,h=U}}}}function et(t,s){var n=s[wa];n===void 0&&(n=s[wa]=new Set);var l=t+"__bubble";n.has(l)||(yg(s,t,2,!1),n.add(l))}function tm(t,s,n){var l=0;s&&(l|=4),yg(n,t,l,s)}var Yo="_reactListening"+Math.random().toString(36).slice(2);function sm(t){if(!t[Yo]){t[Yo]=!0,mh.forEach(function(n){n!=="selectionchange"&&(Yw.has(n)||tm(n,!1,t),tm(n,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[Yo]||(s[Yo]=!0,tm("selectionchange",!1,s))}}function yg(t,s,n,l){switch(qg(s)){case 2:var d=b1;break;case 8:d=j1;break;default:d=pm}n=d.bind(null,s,n,t),d=void 0,!Sd||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(d=!0),l?d!==void 0?t.addEventListener(s,n,{capture:!0,passive:d}):t.addEventListener(s,n,!0):d!==void 0?t.addEventListener(s,n,{passive:d}):t.addEventListener(s,n,!1)}function am(t,s,n,l,d){var h=l;if((s&1)===0&&(s&2)===0&&l!==null)e:for(;;){if(l===null)return;var S=l.tag;if(S===3||S===4){var A=l.stateNode.containerInfo;if(A===d)break;if(S===4)for(S=l.return;S!==null;){var U=S.tag;if((U===3||U===4)&&S.stateNode.containerInfo===d)return;S=S.return}for(;A!==null;){if(S=kr(A),S===null)return;if(U=S.tag,U===5||U===6||U===26||U===27){l=h=S;continue e}A=A.parentNode}}l=l.return}kh(function(){var W=h,ce=Nd(n),fe=[];e:{var se=ex.get(t);if(se!==void 0){var ae=lo,qe=t;switch(t){case"keypress":if(no(n)===0)break e;case"keydown":case"keyup":ae=FN;break;case"focusin":qe="focus",ae=Dd;break;case"focusout":qe="blur",ae=Dd;break;case"beforeblur":case"afterblur":ae=Dd;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ae=Eh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ae=EN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ae=HN;break;case Zh:case Qh:case Jh:ae=AN;break;case Wh:ae=GN;break;case"scroll":case"scrollend":ae=_N;break;case"wheel":ae=XN;break;case"copy":case"cut":case"paste":ae=ON;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ae=Th;break;case"toggle":case"beforetoggle":ae=ZN}var Ie=(s&4)!==0,ft=!Ie&&(t==="scroll"||t==="scrollend"),Y=Ie?se!==null?se+"Capture":null:se;Ie=[];for(var q=W,Q;q!==null;){var de=q;if(Q=de.stateNode,de=de.tag,de!==5&&de!==26&&de!==27||Q===null||Y===null||(de=Al(q,Y),de!=null&&Ie.push(hi(q,de,Q))),ft)break;q=q.return}0<Ie.length&&(se=new ae(se,qe,null,n,ce),fe.push({event:se,listeners:Ie}))}}if((s&7)===0){e:{if(se=t==="mouseover"||t==="pointerover",ae=t==="mouseout"||t==="pointerout",se&&n!==jd&&(qe=n.relatedTarget||n.fromElement)&&(kr(qe)||qe[Ts]))break e;if((ae||se)&&(se=ce.window===ce?ce:(se=ce.ownerDocument)?se.defaultView||se.parentWindow:window,ae?(qe=n.relatedTarget||n.toElement,ae=W,qe=qe?kr(qe):null,qe!==null&&(ft=m(qe),Ie=qe.tag,qe!==ft||Ie!==5&&Ie!==27&&Ie!==6)&&(qe=null)):(ae=null,qe=W),ae!==qe)){if(Ie=Eh,de="onMouseLeave",Y="onMouseEnter",q="mouse",(t==="pointerout"||t==="pointerover")&&(Ie=Th,de="onPointerLeave",Y="onPointerEnter",q="pointer"),ft=ae==null?se:Tl(ae),Q=qe==null?se:Tl(qe),se=new Ie(de,q+"leave",ae,n,ce),se.target=ft,se.relatedTarget=Q,de=null,kr(ce)===W&&(Ie=new Ie(Y,q+"enter",qe,n,ce),Ie.target=Q,Ie.relatedTarget=ft,de=Ie),ft=de,ae&&qe)t:{for(Ie=ae,Y=qe,q=0,Q=Ie;Q;
vendor: 5,496 bytes, lines 48-49
48Q=ll(Q))q++;for(Q=0,de=Y;de;de=ll(de))Q++;for(;0<q-Q;)Ie=ll(Ie),q--;for(;0<Q-q;)Y=ll(Y),Q--;for(;q--;){if(Ie===Y||Y!==null&&Ie===Y.alternate)break t;Ie=ll(Ie),Y=ll(Y)}Ie=null}else Ie=null;ae!==null&&bg(fe,se,ae,Ie,!1),qe!==null&&ft!==null&&bg(fe,ft,qe,Ie,!0)}}e:{if(se=W?Tl(W):window,ae=se.nodeName&&se.nodeName.toLowerCase(),ae==="select"||ae==="input"&&se.type==="file")var De=$h;else if(Lh(se))if(Ih)De=lw;else{De=nw;var Je=aw}else ae=se.nodeName,!ae||ae.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?W&&bd(W.elementType)&&(De=$h):De=rw;if(De&&(De=De(t,W))){Uh(fe,De,n,ce);break e}Je&&Je(t,se,W),t==="focusout"&&W&&se.type==="number"&&W.memoizedProps.value!=null&&yd(se,"number",se.value)}switch(Je=W?Tl(W):window,t){case"focusin":(Lh(Je)||Je.contentEditable==="true")&&(zr=Je,Od=W,Il=null);break;case"focusout":Il=Od=zr=null;break;case"mousedown":Pd=!0;break;case"contextmenu":case"mouseup":case"dragend":Pd=!1,Xh(fe,n,ce);break;case"selectionchange":if(ow)break;case"keydown":case"keyup":Xh(fe,n,ce)}var Oe;if(Md)e:{switch(t){case"compositionstart":var Fe="onCompositionStart";break e;case"compositionend":Fe="onCompositionEnd";break e;case"compositionupdate":Fe="onCompositionUpdate";break e}Fe=void 0}else Pr?Ph(t,n)&&(Fe="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(Fe="onCompositionStart");Fe&&(Ah&&n.locale!=="ko"&&(Pr||Fe!=="onCompositionStart"?Fe==="onCompositionEnd"&&Pr&&(Oe=_h()):(tn=ce,Cd="value"in tn?tn.value:tn.textContent,Pr=!0)),Je=Xo(W,Fe),0<Je.length&&(Fe=new Mh(Fe,t,null,n,ce),fe.push({event:Fe,listeners:Je}),Oe?Fe.data=Oe:(Oe=zh(n),Oe!==null&&(Fe.data=Oe)))),(Oe=JN?WN(t,n):ew(t,n))&&(Fe=Xo(W,"onBeforeInput"),0<Fe.length&&(Je=new Mh("onBeforeInput","beforeinput",null,n,ce),fe.push({event:Je,listeners:Fe}),Je.data=Oe)),Hw(fe,t,W,n,ce)}vg(fe,s)})}function hi(t,s,n){return{instance:t,listener:s,currentTarget:n}}function Xo(t,s){for(var n=s+"Capture",l=[];t!==null;){var d=t,h=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||h===null||(d=Al(t,n),d!=null&&l.unshift(hi(t,d,h)),d=Al(t,s),d!=null&&l.push(hi(t,d,h))),t.tag===3)return l;t=t.return}return[]}function ll(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function bg(t,s,n,l,d){for(var h=s._reactName,S=[];n!==null&&n!==l;){var A=n,U=A.alternate,W=A.stateNode;if(A=A.tag,U!==null&&U===l)break;A!==5&&A!==26&&A!==27||W===null||(U=W,d?(W=Al(n,h),W!=null&&S.unshift(hi(n,W,U))):d||(W=Al(n,h),W!=null&&S.push(hi(n,W,U)))),n=n.return}S.length!==0&&t.push({event:s,listeners:S})}var Xw=/\r\n?/g,Kw=/\u0000|\uFFFD/g;function jg(t){return(typeof t=="string"?t:""+t).replace(Xw,`
49`).replace(Kw,"")}function Ng(t,s){return s=jg(s),jg(t)===s}function Ko(){}function mt(t,s,n,l,d,h){switch(n){case"children":typeof l=="string"?s==="body"||s==="textarea"&&l===""||Ar(t,l):(typeof l=="number"||typeof l=="bigint")&&s!=="body"&&Ar(t,""+l);break;case"className":Wi(t,"class",l);break;case"tabIndex":Wi(t,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Wi(t,n,l);break;case"style":Sh(t,l,h);break;case"data":if(s!=="object"){Wi(t,"data",l);break}case"src":case"href":if(l===""&&(s!=="a"||n!=="href")){t.removeAttribute(n);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){t.removeAttribute(n);break}l=so(""+l),t.setAttribute(n,l);break;case"action":case"formAction":if(typeof l=="function"){t.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(n==="formAction"?(s!=="input"&&mt(t,s,"name",d.name,d,null),mt(t,s,"formEncType",d.formEncType,d,null),mt(t,s,"formMethod",d.formMethod,d,null),mt(t,s,"formTarget",d.formTarget,d,null)):(mt(t,s,"encType",d.encType,d,null),mt(t,s,"method",d.method,d,null),mt(t,s,"target",d.target,d,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){t.removeAttribute(n);break}l=so(""+l),t.setAttribute(n,l);break;case"onClick":l!=null&&(t.onclick=Ko);break;case"onScroll":l!=null&&et("scroll",t);break;case"onScrollEnd":l!=null&&et("scrollend",t);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(o(61));if(n=l.__html,n!=null){if(d.children!=null)throw Error(o(60));t.innerHTML=n}}break;case"multiple":t.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":t.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){t.removeAttribute("xlink:href");break}n=so(""+l),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(n,""+l):t.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInl
49ine":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(n,""):t.removeAttribute(n);break;case"capture":case"download":l===!0?t.setAttribute(n,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(n,l):t.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?t.setAttribute(n,l):t.removeAttribute(n);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?t.removeAttribute(n):t.setAttribute(n,l);break;case"popover":et("beforetoggle",t),et("toggle",t),Ji(t,"popover",l);break;case"xlinkActuate":Sa(t,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Sa(t,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Sa(t,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Sa(t,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Sa(t,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Sa(t,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Sa(t,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Sa(t,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Sa(t,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Ji(t,"is",l);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=CN.get(n)||n,Ji(t,n,l))}}function nm(t,s,n,l,d,h){switch(n){case"style":Sh(t,l,h);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(o(61));if(n=l.__html,n!=null){if(d.children!=null)throw Error(o(60));t.innerHTML=n}}break;case"children":typeof l=="string"?Ar(t,l):(typeof l=="number"||typeof l=="bigint")&&Ar(t,""+l);break;case"onScroll":l!=null&&et("scroll",t);break;case"onScrollEnd":l!=null&&et("scrollend",t);break;case"onClick":l!=null&&(t.onclick=Ko);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!fh.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(d=n.endsWith("Capture"),s=n.slice(2,d?n.length-7:void 0),h=t[Qe]||null,h=h!=null?h[n]:null,typeof h=="function"&&t.removeEventListener(s,h,d),typeof l=="function")){typeof h!="function"&&h!==null&&(n in t?t[n]=null:t.hasAttribute(n)&&t.removeAttribute(n)),t.addEventListener(s,l,d);break e}n in t?t[n]=l:l===!0?t.setAttribute(n,""):Ji(t,n,l)}}}function Jt(t,s,n){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":et("error",t),et("load",t);var l=!1,d=!1,h;for(h in n)if(n.hasOwnProperty(h)){var S=n[h];if(S!=null)switch(h){case"src":l=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,s));default:mt(t,s,h,S,n,null)}}d&&mt(t,s,"srcSet",n.srcSet,n,null),l&&mt(t,s,"src",n.src,n,null);return;case"input":et("invalid",t);var A=h=S=d=null,U=null,W=null;for(l in n)if(n.hasOwnProperty(l)){var ce=n[l];if(ce!=null)switch(l){case"name":d=ce;break;case"type":S=ce;break;case"checked":U=ce;break;case"defaultChecked":W=ce;break;case"value":h=ce;break;case"defaultValue":A=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(o(137,s));break;default:mt(t,s,l,ce,n,null)}}bh(t,h,A,U,W,S,d,!1),eo(t);return;case"select":et("invalid",t),l=S=h=null;for(d in n)if(n.hasOwnProperty(d)&&(A=n[d],A!=null))switch(d){case"value":h=A;break;case"defaultValue":S=A;break;case"multiple":l=A;default:mt(t,s,d,A,n,null)}s=h,n=S,t.multiple=!!l,s!=null?Tr(t,!!l,s,!1):n!=null&&Tr(t,!!l,n,!0);return;case"textarea":et("invalid",t),h=d=l=null;for(S in n)if(n.hasOwnProperty(S)&&(A=n[S],A!=null))switch(S){case"value":l=A;break;case"defaultValue":d=A;break;case"children":h=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(o(91));break;default:mt(t,s,S,A,n,null)}Nh(t,l,d,h),eo(t);return;case"option":for(U in n)if(n.hasOwnProperty(U)&&(l=n[U],l!=null))switch(U){case"selected":t.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:mt(t,s,U,l,n,null)}return;case"dialog":et("beforetoggle",t),et("toggle",t),et("cancel",t),et("close",t);break;case"iframe":case"object":et("load",t);break;case"video":case"audio":for(l=0;l<fi.length;l++)et(fi[l],t);break;case"image":et("error",t),et("load",t);break;case"details":et("toggle",t);break;case"embed":case"source":case"link":et("error",t),et("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(W in n)if(n.hasOwnProperty(W)&&(l=n[W],l!=null))switch(W){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,s));default:mt(t,s,W,l,n,null)}return;default:if(bd(s)){for(ce in n)n.hasOwnProperty(ce)&&(l=n[ce],l!==void 0&&nm(t,s,ce,l,n,void 0));return}}for(A in n)n.hasOwnProperty(A)&&(l=n[A],l!=null&&mt(t,s,A,l,n,null))}function Zw(t,s,n,l){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,h=null,S=null,A=null,U=null,W=null,ce=null;for(ae in n){var fe=n[ae];if(n.hasOwnProperty(ae)&&fe!=null)switch(ae){case"checked":break;case"value":break;case"defaultValue":U=fe;default:l.hasOwnProperty(ae)||mt(t,s,ae,null,l,fe)}}for(var se in l){var ae=l[se];if(fe=n[se],l.hasOwnProperty(se)&&(ae!=null||fe!=null))switch(se){case"type":h=ae;break;case"name":d=ae;break;case"checked":W=ae;break;case"defaultChecked":ce=ae;break;case"value":S=ae;break;case"defaultValue":A=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(o(137,s));break;default:ae!==fe&&mt(t,s,se,ae,l,fe)}}vd(t,S,A,U,W,ce,h,d);return;case"select":ae=S=A=se=null;for(h in n)if(U=n[h],n.hasOwnProperty(h)&&U!=null)switch(h){case"value":break;case"multiple":ae=U;default:l.hasOwnProperty(h)||mt(t,s,h,null,l,U)}for(d in l)if(h=l[d],U=n[d],l.hasOwnProperty(d)&&(h!=null||U!=null))switch(d){case"value":se=h;break;case"defaultValue":A=h;break;case"multiple":S=h;default:h!==U&&mt(t,s,d,h,l,U)}s=A,n=S,l=ae,se!=null?Tr(t,!!n,se,!1):!!l!=!!n&&(s!=null?Tr(t,!!n,s,!0):Tr(t,!!n,n?[]:"",!1));return;case"textarea":ae=se=null;for(A in n)if(d=n[A],n.hasOwnProperty(A)&&d!=null&&!l.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:mt(t,s,A,null,l,d)}for(S in l)if(d=l[S],h=n[S],l.hasOwnProperty(S)&&(d!=null||h!=null))switch(S){case"value":se=
vendor: 27,554 bytes, lines 49-74
49d;break;case"defaultValue":ae=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(o(91));break;default:d!==h&&mt(t,s,S,d,l,h)}jh(t,se,ae);return;case"option":for(var qe in n)if(se=n[qe],n.hasOwnProperty(qe)&&se!=null&&!l.hasOwnProperty(qe))switch(qe){case"selected":t.selected=!1;break;default:mt(t,s,qe,null,l,se)}for(U in l)if(se=l[U],ae=n[U],l.hasOwnProperty(U)&&se!==ae&&(se!=null||ae!=null))switch(U){case"selected":t.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:mt(t,s,U,se,l,ae)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ie in n)se=n[Ie],n.hasOwnProperty(Ie)&&se!=null&&!l.hasOwnProperty(Ie)&&mt(t,s,Ie,null,l,se);for(W in l)if(se=l[W],ae=n[W],l.hasOwnProperty(W)&&se!==ae&&(se!=null||ae!=null))switch(W){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(o(137,s));break;default:mt(t,s,W,se,l,ae)}return;default:if(bd(s)){for(var ft in n)se=n[ft],n.hasOwnProperty(ft)&&se!==void 0&&!l.hasOwnProperty(ft)&&nm(t,s,ft,void 0,l,se);for(ce in l)se=l[ce],ae=n[ce],!l.hasOwnProperty(ce)||se===ae||se===void 0&&ae===void 0||nm(t,s,ce,se,l,ae);return}}for(var Y in n)se=n[Y],n.hasOwnProperty(Y)&&se!=null&&!l.hasOwnProperty(Y)&&mt(t,s,Y,null,l,se);for(fe in l)se=l[fe],ae=n[fe],!l.hasOwnProperty(fe)||se===ae||se==null&&ae==null||mt(t,s,fe,se,l,ae)}var rm=null,lm=null;function Zo(t){return t.nodeType===9?t:t.ownerDocument}function wg(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Sg(t,s){if(t===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&s==="foreignObject"?0:t}function im(t,s){return t==="textarea"||t==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var om=null;function Qw(){var t=window.event;return t&&t.type==="popstate"?t===om?!1:(om=t,!0):(om=null,!1)}var Cg=typeof setTimeout=="function"?setTimeout:void 0,Jw=typeof clearTimeout=="function"?clearTimeout:void 0,kg=typeof Promise=="function"?Promise:void 0,Ww=typeof queueMicrotask=="function"?queueMicrotask:typeof kg<"u"?function(t){return kg.resolve(null).then(t).catch(e1)}:Cg;function e1(t){setTimeout(function(){throw t})}function vn(t){return t==="head"}function _g(t,s){var n=s,l=0,d=0;do{var h=n.nextSibling;if(t.removeChild(n),h&&h.nodeType===8)if(n=h.data,n==="/$"){if(0<l&&8>l){n=l;var S=t.ownerDocument;if(n&1&&xi(S.documentElement),n&2&&xi(S.body),n&4)for(n=S.head,xi(n),S=n.firstChild;S;){var A=S.nextSibling,U=S.nodeName;S[Ml]||U==="SCRIPT"||U==="STYLE"||U==="LINK"&&S.rel.toLowerCase()==="stylesheet"||n.removeChild(S),S=A}}if(d===0){t.removeChild(h),wi(s);return}d--}else n==="$"||n==="$?"||n==="$!"?d++:l=n.charCodeAt(0)-48;else l=0;n=h}while(n);wi(s)}function cm(t){var s=t.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var n=s;switch(s=s.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":cm(n),hd(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}t.removeChild(n)}}function t1(t,s,n,l){for(;t.nodeType===1;){var d=n;if(t.nodeName.toLowerCase()!==s.toLowerCase()){if(!l&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(l){if(!t[Ml])switch(s){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(h=t.getAttribute("rel"),h==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(h!==d.rel||t.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||t.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||t.getAttribute("title")!==(d.title==null?null:d.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(h=t.getAttribute("src"),(h!==(d.src==null?null:d.src)||t.getAttribute("type")!==(d.type==null?null:d.type)||t.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&h&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(s==="input"&&t.type==="hidden"){var h=d.name==null?null:""+d.name;if(d.type==="hidden"&&t.getAttribute("name")===h)return t}else return t;if(t=Vs(t.nextSibling),t===null)break}return null}function s1(t,s,n){if(s==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Vs(t.nextSibling),t===null))return null;return t}function dm(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState==="complete"}function a1(t,s){var n=t.ownerDocument;if(t.data!=="$?"||n.readyState==="complete")s();else{var l=function(){s(),n.removeEventListener("DOMContentLoaded",l)};n.addEventListener("DOMContentLoaded",l),t._reactRetry=l}}function Vs(t){for(;t!=null;t=t.nextSibling){var s=t.nodeType;if(s===1||s===3)break;if(s===8){if(s=t.data,s==="$"||s==="$!"||s==="$?"||s==="F!"||s==="F")break;if(s==="/$")return null}}return t}var um=null;function Dg(t){t=t.previousSibling;for(var s=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(s===0)return t;s--}else n==="/$"&&s++}t=t.previousSibling}return null}function Eg(t,s,n){switch(s=Zo(n),t){case"html":if(t=s.documentElement,!t)throw Error(o(452));return t;case"head":if(t=s.head,!t)throw Error(o(453));return t;case"body":if(t=s.body,!t)throw Error(o(454));return t;default:throw Error(o(451))}}function xi(t){for(var s=t.attributes;s.length;)t.removeAttributeNode(s[0]);hd(t)}var Is=new Map,Mg=new Set;function Qo(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Ua=$.d;$.d={f:n1,r:r1,D:l1,C:i1,L:o1,m:c1,X:u1,S:d1,M:m1};function n1(){var t=Ua.f(),s=Bo();return t||s}function r1(t){var s=_r(t);s!==null&&s.tag===5&&s.type==="form"?Zx(s):Ua.r(t)}var il=typeof document>"u"?null:document;function Tg(t,s,n){var l=il;if(l&&typeof s=="string"&&s){var d=Rs(s);d='link[rel="'+t+'"][href="'+d+'"]',typeof n=="string"&&(d+='[crossorigin="'+n+'"]'),Mg.has(d)||(Mg.add(d),t={rel:t,crossOrigin:n,href:s},l.querySelector(d)===null&&(s=l.createElement("link"),Jt(s,"link",t),Ht(s),l.head.appendChild(s)))}}function l1(t){Ua.D(t),Tg("dns-prefetch",t,null)}function i1(t,s){Ua.C(t,s),Tg("preconnect",t,s)}function o1(t,s,n){Ua.L(t,s,n);var l=il;if(l&&t&&s){var d='link[rel="preload"][as="'+Rs(s)+'"]';s==="image"&&n&&n.imageSrcSet?(d+='[imagesrcset="'+Rs(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(d+='[imagesizes="'+Rs(n.imageSizes)+'"]')):d+='[href="'+Rs(t)+'"]';var h=d;switch(s){case"style":h=ol(t);break;case"script":h=cl(t)}Is.has(h)||(t=y({rel:"preload",href:s==="image"&&n&&n.imageSrcSet?void 0:t,as:s},n),Is.set(h,t),l.querySelector(d)!==null||s==="style"&&l.querySelector(pi(h))||s==="script"&&l.querySelector(gi(h))||(s=l.createElement("link"),Jt(s,"link",t),Ht(s),l.head.appendChild(s)))}}function c1(t,s){Ua.m(t,s);var n=il;if(n&&t){var l=s&&typeof s.as=="string"?s.as:"script",d='link[rel="modulepreload"][as="'+Rs(l)+'"][href="'+Rs(t)+'"]',h=d;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=cl(t)}if(!Is.has(h)&&(t=y({rel:"modulepreload",href:t},s),Is.set(h,t),n.querySelector(d)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(gi(h)))return}l=n.createElement("link"),Jt(l,"link",t),Ht(l),n.head.appendChild(l)}}}function d1(t,s,n){Ua.S(t,s,n);var l=il;if(l&&t){var d=Dr(l).hoistableStyles,h=ol(t);s=s||"default";var S=d.get(h);if(!S){var A={loading:0,preload:null};if(S=l.querySelector(pi(h)))A.loading=5;else{t=y({rel:"stylesheet",href:t,"data-precedence":s},n),(n=Is.get(h))&&mm(t,n);var U=S=l.createElement("link");Ht(U),Jt(U,"link",t),U._p=new Promise(function(W,ce){U.onload=W,U.onerror=ce}),U.addEventListener("load",function(){A.loading|=1}),U.addEventListener("error",function(){A.loading|=2}),A.loading|=4,Jo(S,s,l)}S={type:"stylesheet",instance:S,count:1,state:A},d.set(h,S)}}}function u1(t,s){Ua.X(t,s);var n=il;if(n&&t){var l=Dr(n).hoistableScripts,d=cl(t),h=l.get(d);h||(h=n.querySelector(gi(d)),h||(t=y({src:t,async:!0},s),(s=Is.get(d))&&fm(t,s),h=n.createElement("script"),Ht(h),Jt(h,"link",t),n.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(d,h))}}function m1(t,s){Ua.M(t,s);var n=il;if(n&&t){var l=Dr(n).hoistableScripts,d=cl(t),h=l.get(d);h||(h=n.querySelector(gi(d)),h||(t=y({src:t,async:!0,type:"module"},s),(s=Is.get(d))&&fm(t,s),h=n.createElement("script"),Ht(h),Jt(h,"link",t),n.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(d,h))}}function Ag(t,s,n,l){var d=(d=K.current)?Qo(d):null;if(!d)throw Error(o(446));switch(t){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(s=ol(n.href),n=Dr(d).hoistableStyles,l=n.get(s),l||(l={type:"style",instance:null,count:0,state:null},n.set(s,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){t=ol(n.href);var h=Dr(d).hoistableStyles,S=h.get(t);if(S||(d=d.ownerDocument||d,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(t,S),(h=d.querySelector(pi(t)))&&!h._p&&(S.instance=h,S.state.loading=5),Is.has(t)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Is.set(t,n),h||f1(d,t,n,S.state))),s&&l===null)throw Error(o(528,""));return S}if(s&&l!==null)throw Error(o(529,""));return null;case"script":return s=n.async,n=n.src,typeof n=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=cl(n),n=Dr(d).hoistableScripts,l=n.get(s),l||(l={type:"script",instance:null,count:0,state:null},n.set(s,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,t))}}function ol(t){return'href="'+Rs(t)+'"'}function pi(t){return'link[rel="stylesheet"]['+t+"]"}function Rg(t){return y({},t,{"data-precedence":t.precedence,precedence:null})}function f1(t,s,n,l){t.querySelector('link[rel="preload"][as="style"]['+s+"]")?l.loading=1:(s=t.createElement("link"),l.preload=s,s.addEventListener("load",function(){return l.loading|=1}),s.addEventListener("error",function(){return l.loading|=2}),Jt(s,"link",n),Ht(s),t.head.appendChild(s))}function cl(t){return'[src="'+Rs(t)+'"]'}function gi(t){return"script[async]"+t}function Og(t,s,n){if(s.count++,s.instance===null)switch(s.type){case"style":var l=t.querySelector('style[data-href~="'+Rs(n.href)+'"]');if(l)return s.instance=l,Ht(l),l;var d=y({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return l=(t.ownerDocument||t).createElement("style"),Ht(l),Jt(l,"style",d),Jo(l,n.precedence,t),s.instance=l;case"stylesheet":d=ol(n.href);var h=t.querySelector(pi(d));if(h)return s.state.loading|=4,s.instance=h,Ht(h),h;l=Rg(n),(d=Is.get(d))&&mm(l,d),h=(t.ownerDocument||t).createElement("link"),Ht(h);var S=h;return S._p=new Promise(function(A,U){S.onload=A,S.onerror=U}),Jt(h,"link",l),s.state.loading|=4,Jo(h,n.precedence,t),s.instance=h;case"script":return h=cl(n.src),(d=t.querySelector(gi(h)))?(s.instance=d,Ht(d),d):(l=n,(d=Is.get(h))&&(l=y({},n),fm(l,d)),t=t.ownerDocument||t,d=t.createElement("script"),Ht(d),Jt(d,"link",l),t.head.appendChild(d),s.instance=d);case"void":return null;default:throw Error(o(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(l=s.instance,s.state.loading|=4,Jo(l,n.precedence,t));return s.instance}function Jo(t,s,n){for(var l=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=l.length?l[l.length-1]:null,h=d,S=0;S<l.length;S++){var A=l[S];if(A.dataset.precedence===s)h=A;else if(h!==d)break}h?h.parentNode.insertBefore(t,h.nextSibling):(s=n.nodeType===9?n.head:n,s.insertBefore(t,s.firstChild))}function mm(t,s){t.crossOrigin==null&&(t.crossOrigin=s.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=s.referrerPolicy),t.title==null&&(t.title=s.title)}function fm(t,s){t.crossOrigin==null&&(t.crossOrigin=s.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=s.referrerPolicy),t.integrity==null&&(t.integrity=s.integrity)}var Wo=null;function Pg(t,s,n){if(Wo===null){var l=new Map,d=Wo=new Map;d.set(n,l)}else d=Wo,l=d.get(n),l||(l=new Map,d.set(n,l));if(l.has(t))return l;for(l.set(t,null),n=n.getElementsByTagName(t),d=0;d<n.length;d++){var h=n[d];if(!(h[Ml]||h[Ue]||t==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var S=h.getAttribute(s)||"";S=t+S;var A=l.get(S);A?A.push(h):l.set(S,[h])}}return l}function zg(t,s,n){t=t.ownerDocument||t,t.head.insertBefore(n,s==="title"?t.querySelector("head > title"):null)}function h1(t,s,n){if(n===1||s.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return t=s.disabled,typeof s.precedence=="string"&&t==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function Lg(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}var vi=null;function x1(){}function p1(t,s,n){if(vi===null)throw Error(o(475));var l=vi;if(s.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var d=ol(n.href),h=t.querySelector(pi(d));if(h){t=h._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(l.count++,l=ec.bind(l),t.then(l,l)),s.state.loading|=4,s.instance=h,Ht(h);return}h=t.ownerDocument||t,n=Rg(n),(d=Is.get(d))&&mm(n,d),h=h.createElement("link"),Ht(h);var S=h;S._p=new Promise(function(A,U){S.onload=A,S.onerror=U}),Jt(h,"link",n),s.instance=h}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(s,t),(t=s.state.preload)&&(s.state.loading&3)===0&&(l.count++,s=ec.bind(l),t.addEventListener("load",s),t.addEventListener("error",s))}}function g1(){if(vi===null)throw Error(o(475));var t=vi;return t.stylesheets&&t.count===0&&hm(t,t.stylesheets),0<t.count?function(s){var n=setTimeout(function(){if(t.stylesheets&&hm(t,t.stylesheets),t.unsuspend){var l=t.unsuspend;t.unsuspend=null,l()}},6e4);return t.unsuspend=s,function(){t.unsuspend=null,clearTimeout(n)}}:null}function ec(){if(this.count--,this.count===0){if(this.stylesheets)hm(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var tc=null;function hm(t,s){t.stylesheets=null,t.unsuspend!==null&&(t.count++,tc=new Map,s.forEach(v1,t),tc=null,ec.call(t))}function v1(t,s){if(!(s.state.loading&4)){var n=tc.get(t);if(n)var l=n.get(null);else{n=new Map,tc.set(t,n);for(var d=t.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<d.length;h++){var S=d[h];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(n.set(S.dataset.precedence,S),l=S)}l&&n.set(null,l)}d=s.instance,S=d.getAttribute("data-precedence"),h=n.get(S)||l,h===l&&n.set(null,d),n.set(S,d),this.count++,l=ec.bind(this),d.addEventListener("load",l),d.addEventListener("error",l),h?h.parentNode.insertBefore(d,h.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(d,t.firstChild)),s.state.loading|=4}}var yi={$$typeof:k,Provider:null,Consumer:null,_currentValue:F,_currentValue2:F,_threadCount:0};function y1(t,s,n,l,d,h,S,A){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=He(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=He(0),this.hiddenUpdates=He(null),this.identifierPrefix=l,this.onUncaughtError=d,this.onCaughtError=h,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=A,this.incompleteTransitions=new Map}function Ug(t,s,n,l,d,h,S,A,U,W,ce,fe){return t=new y1(t,s,n,S,A,U,W,fe),s=1,h===!0&&(s|=24),h=bs(3,null,null,s),t.current=h,h.stateNode=t,s=Kd(),s.refCount++,t.pooledCache=s,s.refCount++,h.memoizedState={element:l,isDehydrated:n,cache:s},Wd(h),t}function $g(t){return t?(t=Ir,t):Ir}function Ig(t,s,n,l,d,h){d=$g(d),l.context===null?l.context=d:l.pendingContext=d,l=nn(s),l.payload={element:n},h=h===void 0?null:h,h!==null&&(l.callback=h),n=rn(t,l,s),n!==null&&(Cs(n,t,s),Kl(n,t,s))}function Fg(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<s?n:s}}function xm(t,s){Fg(t,s),(t=t.alternate)&&Fg(t,s)}function Bg(t){if(t.tag===13){var s=$r(t,67108864);s!==null&&Cs(s,t,67108864),xm(t,67108864)}}var sc=!0;function b1(t,s,n,l){var d=P.T;P.T=null;var h=$.p;try{$.p=2,pm(t,s,n,l)}finally{$.p=h,P.T=d}}function j1(t,s,n,l){var d=P.T;P.T=null;var h=$.p;try{$.p=8,pm(t,s,n,l)}finally{$.p=h,P.T=d}}function pm(t,s,n,l){if(sc){var d=gm(l);if(d===null)am(t,s,l,ac,n),Hg(t,l);else if(w1(d,t,s,n,l))l.stopPropagation();else if(Hg(t,l),s&4&&-1<N1.indexOf(t)){for(;d!==null;){var h=_r(d);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var S=J(h.pendingLanes);if(S!==0){var A=h;for(A.pendingLanes|=2,A.entangledLanes|=2;S;){var U=1<<31-Xt(S);A.entanglements[1]|=U,S&=~U}ua(h),(ct&6)===0&&(Io=Ve()+500,mi(0))}}break;case 13:A=$r(h,2),A!==null&&Cs(A,h,2),Bo(),xm(h,2)}if(h=gm(l),h===null&&am(t,s,l,ac,n),h===d)break;d=h}d!==null&&l.stopPropagation()}else am(t,s,l,null,n)}}function gm(t){return t=Nd(t),vm(t)}var ac=null;function vm(t){if(ac=null,t=kr(t),t!==null){var s=m(t);if(s===null)t=null;else{var n=s.tag;if(n===13){if(t=u(s),t!==null)return t;t=null}else if(n===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;t=null}else s!==t&&(t=null)}}return ac=t,null}function qg(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(bt()){case ds:return 2;case le:return 8;case Le:case Ye:return 32;case Ne:return 268435456;default:return 32}default:return 32}}var ym=!1,yn=null,bn=null,jn=null,bi=new Map,ji=new Map,Nn=[],N1="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Hg(t,s){switch(t){case"focusin":case"focusout":yn=null;break;case"dragenter":case"dragleave":bn=null;break;case"mouseover":case"mouseout":jn=null;break;case"pointerover":case"pointerout":bi.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":ji.delete(s.pointerId)}}function Ni(t,s,n,l,d,h){return t===null||t.nativeEvent!==h?(t={blockedOn:s,domEventName:n,eventSystemFlags:l,nativeEvent:h,targetContainers:[d]},s!==null&&(s=_r(s),s!==null&&Bg(s)),t):(t.eventSystemFlags|=l,s=t.targetContainers,d!==null&&s.indexOf(d)===-1&&s.push(d),t)}function w1(t,s,n,l,d){switch(s){case"focusin":return yn=Ni(yn,t,s,n,l,d),!0;case"dragenter":return bn=Ni(bn,t,s,n,l,d),!0;case"mouseover":return jn=Ni(jn,t,s,n,l,d),!0;case"pointerover":var h=d.pointerId;return bi.set(h,Ni(bi.get(h)||null,t,s,n,l,d)),!0;case"gotpointercapture":return h=d.pointerId,ji.set(h,Ni(ji.get(h)||null,t,s,n,l,d)),!0}return!1}function Vg(t){var s=kr(t.target);if(s!==null){var n=m(s);if(n!==null){if(s=n.tag,s===13){if(s=u(n),s!==null){t.blockedOn=s,md(t.priority,function(){if(n.tag===13){var l=Ss();l=Dl(l);var d=$r(n,l);d!==null&&Cs(d,n,l),xm(n,l)}});return}}else if(s===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function nc(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var n=gm(t.nativeEvent);if(n===null){n=t.nativeEvent;var l=new n.constructor(n.type,n);jd=l,n.target.dispatchEvent(l),jd=null}else return s=_r(n),s!==null&&Bg(s),t.blockedOn=n,!1;s.shift()}return!0}function Gg(t,s,n){nc(t)&&n.delete(s)}function S1(){ym=!1,yn!==null&&nc(yn)&&(yn=null),bn!==null&&nc(bn)&&(bn=null),jn!==null&&nc(jn)&&(jn=null),bi.forEach(Gg),ji.forEach(Gg)}function rc(t,s){t.blockedOn===s&&(t.blockedOn=null,ym||(ym=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,S1)))}var lc=null;function Yg(t){lc!==t&&(lc=t,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){lc===t&&(lc=null);for(var s=0;s<t.length;s+=3){var n=t[s],l=t[s+1],d=t[s+2];if(typeof l!="function"){if(vm(l||n)===null)continue;break}var h=_r(n);h!==null&&(t.splice(s,3),s-=3,vu(h,{pending:!0,data:d,method:n.method,action:l},l,d))}}))}function wi(t){function s(U){return rc(U,t)}yn!==null&&rc(yn,t),bn!==null&&rc(bn,t),jn!==null&&rc(jn,t),bi.forEach(s),ji.forEach(s);for(var n=0;n<Nn.length;n++){var l=Nn[n];l.blockedOn===t&&(l.blockedOn=null)}for(;0<Nn.length&&(n=Nn[0],n.blockedOn===null);)Vg(n),n.blockedOn===null&&Nn.shift();if(n=(t.ownerDocument||t).$$reactFormReplay,n!=null)for(l=0;l<n.length;l+=3){var d=n[l],h=n[l+1],S=d[Qe]||null;if(typeof h=="function")S||Yg(n);else if(S){var A=null;if(h&&h.hasAttribute("formAction")){if(d=h,S=h[Qe]||null)A=S.formAction;else if(vm(d)!==null)continue}else A=S.action;typeof A=="function"?n[l+1]=A:(n.splice(l,3),l-=3),Yg(n)}}}function bm(t){this._internalRoot=t}ic.prototype.render=bm.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(o(409));var n=s.current,l=Ss();Ig(n,l,t,s,null,null)},ic.prototype.unmount=bm.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;Ig(t.current,2,null,t,null,null),Bo(),s[Ts]=null}};function ic(t){this._internalRoot=t}ic.prototype.unstable_scheduleHydration=function(t){if(t){var s=Zi();t={blockedOn:null,target:t,priority:s};for(var n=0;n<Nn.length&&s!==0&&s<Nn[n].priority;n++);Nn.splice(n,0,t),n===0&&Vg(t)}};var Xg=r.version;if(Xg!=="19.1.0")throw Error(o(527,Xg,"19.1.0"));$.findDOMNode=function(t){var s=t._reactInternals;if(s===void 0)throw typeof t.render=="function"?Error(o(188)):(t=Object.keys(t).join(","),Error(o(268,t)));return t=x(s),t=t!==null?p(t):null,t=t===null?null:t.stateNode,t};var C1={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var oc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!oc.isDisabled&&oc.supportsFiber)try{ra=oc.inject(C1),qt=oc}catch{}}return Ci.createRoot=function(t,s){if(!c(t))throw Error(o(299));var n=!1,l="",d=dp,h=up,S=mp,A=null;return s!=null&&(s.unstable_strictMode===!0&&(n=!0),s.identifierPrefix!==void 0&&(l=s.identifierPrefix),s.onUncaughtError!==void 0&&(d=s.onUncaughtError),s.onCaughtError!==void 0&&(h=s.onCaughtError),s.onRecoverableError!==void 0&&(S=s.onRecoverableError),s.unstable_transitionCallbacks!==void 0&&(A=s.unstable_transitionCallbacks)),s=Ug(t,1,!1,null,null,n,l,d,h,S,A,null),t[Ts]=s.current,sm(t),new bm(s)},Ci.hydrateRoot=function(t,s,n){if(!c(t))throw Error(o(299));var l=!1,d="",h=dp,S=up,A=mp,U=null,W=null;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(d=n.identifierPrefix),n.onUncaughtError!==void 0&&(h=n.onUncaughtError),n.onCaughtError!==void 0&&(S=n.onCaughtError),n.onRecoverableError!==void 0&&(A=n.onRecoverableError),n.unstable_transitionCallbacks!==void 0&&(U=n.unstable_transitionCallbacks),n.formState!==void 0&&(W=n.formState)),s=Ug(t,1,!0,s,n??null,l,d,h,S,A,U,W),s.context=$g(null),n=s.current,l=Ss(),l=Dl(l),d=nn(l),d.callback=null,rn(n,d,l),n=l,s.current.lanes=n,tt(s,n),ua(s),t[Ts]=s.current,sm(t),new ic(s)},Ci.version="19.1.0",Ci}var nv;function P1(){if(nv)return wm.exports;nv=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(r){console.error(r)}}return a(),wm.exports=O1(),wm.exports}var z1=P1(),yr=n0();const L1=s0(yr);/**
50 * @license lucide-react v0.525.0 - ISC
51 *
52 * This source code is licensed under the ISC license.
53 * See the LICENSE file in the root directory of this source tree.
54 */const U1=a=>a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),$1=a=>a.replace(/^([A-Z])|[\s-_]+(\w)/g,(r,i,o)=>o?o.toUpperCase():i.toLowerCase()),rv=a=>{const r=$1(a);return r.charAt(0).toUpperCase()+r.slice(1)},r0=(...a)=>a.filter((r,i,o)=>!!r&&r.trim()!==""&&o.indexOf(r)===i).join(" ").trim(),I1=a=>{for(const r in a)if(r.startsWith("aria-")||r==="role"||r==="title")return!0};/**
55 * @license lucide-react v0.525.0 - ISC
56 *
57 * This source code is licensed under the ISC license.
58 * See the LICENSE file in the root directory of this source tree.
59 */var F1={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"};/**
60 * @license lucide-react v0.525.0 - ISC
61 *
62 * This source code is licensed under the ISC license.
63 * See the LICENSE file in the root directory of this source tree.
64 */const B1=f.forwardRef(({color:a="currentColor",size:r=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:c="",children:m,iconNode:u,...g},x)=>f.createElement("svg",{ref:x,...F1,width:r,height:r,stroke:a,strokeWidth:o?Number(i)*24/Number(r):i,className:r0("lucide",c),...!m&&!I1(g)&&{"aria-hidden":"true"},...g},[...u.map(([p,y])=>f.createElement(p,y)),...Array.isArray(m)?m:[m]]));/**
65 * @license lucide-react v0.525.0 - ISC
66 *
67 * This source code is licensed under the ISC license.
68 * See the LICENSE file in the root directory of this source tree.
69 */const xe=(a,r)=>{const i=f.forwardRef(({className:o,...c},m)=>f.createElement(B1,{ref:m,iconNode:r,className:r0(`lucide-${U1(rv(a))}`,`lucide-${a}`,o),...c}));return i.displayName=rv(a),i};/**
70 * @license lucide-react v0.525.0 - ISC
71 *
72 * This source code is licensed under the ISC license.
73 * See the LICENSE file in the root directory of this source tree.
74 */const q1=[["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
74-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],H1=xe("activity",q1);/**
75 * @license lucide-react v0.525.0 - ISC
76 *
77 * This source code is licensed under the ISC license.
78 * See the LICENSE file in the root directory of this source tree.
79 */const V1=[["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"}]],Cc=xe("archive",V1);/**
80 * @license lucide-react v0.525.0 - ISC
81 *
82 * This source code is licensed under the ISC license.
83 * See the LICENSE file in the root directory of this source tree.
84 */const G1=[["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"}]],Y1=xe("arrow-left-right",G1);/**
85 * @license lucide-react v0.525.0 - ISC
86 *
87 * This source code is licensed under the ISC license.
88 * See the LICENSE file in the root directory of this source tree.
89 */const X1=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],ns=xe("arrow-left",X1);/**
90 * @license lucide-react v0.525.0 - ISC
91 *
92 * This source code is licensed under the ISC license.
93 * See the LICENSE file in the root directory of this source tree.
94 */const K1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ks=xe("arrow-right",K1);/**
95 * @license lucide-react v0.525.0 - ISC
96 *
97 * This source code is licensed under the ISC license.
98 * See the LICENSE file in the root directory of this source tree.
99 */const Z1=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],Hm=xe("bell",Z1);/**
100 * @license lucide-react v0.525.0 - ISC
101 *
102 * This source code is licensed under the ISC license.
103 * See the LICENSE file in the root directory of this source tree.
104 */const Q1=[["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"}]],J1=xe("briefcase",Q1);/**
105 * @license lucide-react v0.525.0 - ISC
106 *
107 * This source code is licensed under the ISC license.
108 * See the LICENSE file in the root directory of this source tree.
109 */const W1=[["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"}]],Js=xe("building-2",W1);/**
110 * @license lucide-react v0.525.0 - ISC
111 *
112 * This source code is licensed under the ISC license.
113 * See the LICENSE file in the root directory of this source tree.
114 */const e2=[["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"}]],ps=xe("building",e2);/**
115 * @license lucide-react v0.525.0 - ISC
116 *
117 * This source code is licensed under the ISC license.
118 * See the LICENSE file in the root directory of this source tree.
119 */const t2=[["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"}]],s2=xe("calculator",t2);/**
120 * @license lucide-react v0.525.0 - ISC
121 *
122 * This source code is licensed under the ISC license.
123 * See the LICENSE file in the root directory of this source tree.
124 */const a2=[["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"}]],os=xe("calendar",a2);/**
125 * @license lucide-react v0.525.0 - ISC
126 *
127 * This source code is licensed under the ISC license.
128 * See the LICENSE file in the root directory of this source tree.
129 */const n2=[["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"}]],r2=xe("camera",n2);/**
130 * @license lucide-react v0.525.0 - ISC
131 *
132 * This source code is licensed under the ISC license.
133 * See the LICENSE file in the root directory of this source tree.
134 */const l2=[["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"}]],Mi=xe("chart-column",l2);/**
135 * @license lucide-react v0.525.0 - ISC
136 *
137 * This source code is licensed under the ISC license.
138 * See the LICENSE file in the root directory of this source tree.
139 */const i2=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],o2=xe("check-check",i2);/**
140 * @license lucide-react v0.525.0 - ISC
141 *
142 * This source code is licensed under the ISC license.
143 * See the LICENSE file in the root directory of this source tree.
144 */const c2=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],br=xe("check",c2);/**
145 * @license lucide-react v0.525.0 - ISC
146 *
147 * This source code is licensed under the ISC license.
148 * See the LICENSE file in the root directory of this source tree.
149 */const d2=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}
149]],Ln=xe("chevron-down",d2);/**
150 * @license lucide-react v0.525.0 - ISC
151 *
152 * This source code is licensed under the ISC license.
153 * See the LICENSE file in the root directory of this source tree.
154 */const u2=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],m2=xe("chevron-left",u2);/**
155 * @license lucide-react v0.525.0 - ISC
156 *
157 * This source code is licensed under the ISC license.
158 * See the LICENSE file in the root directory of this source tree.
159 */const f2=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],jr=xe("chevron-right",f2);/**
160 * @license lucide-react v0.525.0 - ISC
161 *
162 * This source code is licensed under the ISC license.
163 * See the LICENSE file in the root directory of this source tree.
164 */const h2=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],x2=xe("chevron-up",h2);/**
165 * @license lucide-react v0.525.0 - ISC
166 *
167 * This source code is licensed under the ISC license.
168 * See the LICENSE file in the root directory of this source tree.
169 */const p2=[["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"}]],es=xe("circle-alert",p2);/**
170 * @license lucide-react v0.525.0 - ISC
171 *
172 * This source code is licensed under the ISC license.
173 * See the LICENSE file in the root directory of this source tree.
174 */const g2=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Ha=xe("circle-check-big",g2);/**
175 * @license lucide-react v0.525.0 - ISC
176 *
177 * This source code is licensed under the ISC license.
178 * See the LICENSE file in the root directory of this source tree.
179 */const v2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ws=xe("circle-check",v2);/**
180 * @license lucide-react v0.525.0 - ISC
181 *
182 * This source code is licensed under the ISC license.
183 * See the LICENSE file in the root directory of this source tree.
184 */const y2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],l0=xe("circle",y2);/**
185 * @license lucide-react v0.525.0 - ISC
186 *
187 * This source code is licensed under the ISC license.
188 * See the LICENSE file in the root directory of this source tree.
189 */const b2=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],xs=xe("clock",b2);/**
190 * @license lucide-react v0.525.0 - ISC
191 *
192 * This source code is licensed under the ISC license.
193 * See the LICENSE file in the root directory of this source tree.
194 */const j2=[["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"}]],N2=xe("copy",j2);/**
195 * @license lucide-react v0.525.0 - ISC
196 *
197 * This source code is licensed under the ISC license.
198 * See the LICENSE file in the root directory of this source tree.
199 */const w2=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],S2=xe("credit-card",w2);/**
200 * @license lucide-react v0.525.0 - ISC
201 *
202 * This source code is licensed under the ISC license.
203 * See the LICENSE file in the root directory of this source tree.
204 */const C2=[["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"}]],lv=xe("crown",C2);/**
205 * @license lucide-react v0.525.0 - ISC
206 *
207 * This source code is licensed under the ISC license.
208 * See the LICENSE file in the root directory of this source tree.
209 */const k2=[["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"}]],fr=xe("dollar-sign",k2);/**
210 * @license lucide-react v0.525.0 - ISC
211 *
212 * This source code is licensed under the ISC license.
213 * See the LICENSE file in the root directory of this source tree.
214 */const _2=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],An=xe("download",_2);/**
215 * @license lucide-react v0.525.0 - ISC
216 *
217 * This source code is licensed under the ISC license.
218 * See the LICENSE file in the root directory of this source tree.
219 */const D2=[["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"}]],va=xe("ellipsis-vertical",D2);/**
220 * @license lucide-react v0.525.0 - ISC
221 *
222 * This source code is licensed under the ISC license.
223 * See the LICENSE file in the root directory of this source tree.
224 */const E2=[["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"}]],M2=xe("ellipsis",E2);/**
225 * @license lucide-react v0.525.0 - ISC
226 *
227 * This source code is licensed under the ISC license.
228 * See the LICENSE file in the root directory of this source tree.
229 */const T2=[["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"}]],A2=xe("euro",T2);/**
230 * @license lucide-react v0.525.0 - ISC
231 *
232 * This source code is licensed under the ISC license.
233 * See the LICENSE file in the root directory of this source tree.
234 */const R2=[["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"}]],i0=xe("external-link",R2);/**
235 * @license lucide-react v0.525.0 - ISC
236 *
237 * This source code is licensed under the ISC license.
238 * See the LICENSE file in the root directory of this source tree.
239 */const O2=[["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"}]],Zs=xe("eye-off",O2);/**
240 * @license lucide-react v0.525.0 - ISC
241 *
242 * This source code is licensed under the ISC license.
243 * See the LICENSE file in the root directory of this source tree.
244 */const P2=[["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"}]],rs=xe("eye",P2);/**
245 * @license lucide-react v0.525.0 - ISC
246 *
247 * This source code is licensed under the ISC license.
248 * See the LICENSE file in the root directory of this source tree.
249 */const z2=[["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"}]],L2=xe("file-audio",z2);/**
250 * @license lucide-react v0.525.0 - ISC
251 *
252 * This source code is licensed under the ISC license.
253 * See the LICENSE file in the root directory of this source tree.
254 */const U2=[["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"}]],$2=xe("file-image",U2);/**
255 * @license lucide-react v0.525.0 - ISC
256 *
257 * This source code is licensed under the ISC license.
258 * See the LICENSE file in the root directory of this source tree.
259 */const I2=[["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"}]],F2=xe("file-spreadsheet",I2);/**
260 * @license lucide-react v0.525.0 - ISC
261 *
262 * This source code is licensed under the ISC license.
263 * See the LICENSE file in the root directory of this source tree.
264 */const B2=[["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"}]],Ot=xe("file-text",B2);/**
265 * @license lucide-react v0.525.0 - ISC
266 *
267 * This source code is licensed under the ISC license.
268 * See the LICENSE file in the root directory of this source tree.
269 */const q2=[["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"}]],H2=xe("file-video",q2);/**
270 * @license lucide-react v0.525.0 - ISC
271 *
272 * This source code is licensed under the ISC license.
273 * See the LICENSE file in the root directory of this source tree.
274 */const V2=[["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"}]],yc=xe("file",V2);/**
275 * @license lucide-react v0.525.0 - ISC
276 *
277 * This source code is licensed under the ISC license.
278 * See the LICENSE file in the root directory of this source tree.
279 */const G2=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-
2795-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],Nf=xe("flag",G2);/**
280 * @license lucide-react v0.525.0 - ISC
281 *
282 * This source code is licensed under the ISC license.
283 * See the LICENSE file in the root directory of this source tree.
284 */const Y2=[["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"}]],Va=xe("folder-open",Y2);/**
285 * @license lucide-react v0.525.0 - ISC
286 *
287 * This source code is licensed under the ISC license.
288 * See the LICENSE file in the root directory of this source tree.
289 */const X2=[["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"}]],$c=xe("folder",X2);/**
290 * @license lucide-react v0.525.0 - ISC
291 *
292 * This source code is licensed under the ISC license.
293 * See the LICENSE file in the root directory of this source tree.
294 */const K2=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Z2=xe("funnel",K2);/**
295 * @license lucide-react v0.525.0 - ISC
296 *
297 * This source code is licensed under the ISC license.
298 * See the LICENSE file in the root directory of this source tree.
299 */const Q2=[["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"}]],o0=xe("globe",Q2);/**
300 * @license lucide-react v0.525.0 - ISC
301 *
302 * This source code is licensed under the ISC license.
303 * See the LICENSE file in the root directory of this source tree.
304 */const J2=[["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"}]],W2=xe("hard-drive",J2);/**
305 * @license lucide-react v0.525.0 - ISC
306 *
307 * This source code is licensed under the ISC license.
308 * See the LICENSE file in the root directory of this source tree.
309 */const eS=[["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"}]],tS=xe("image",eS);/**
310 * @license lucide-react v0.525.0 - ISC
311 *
312 * This source code is licensed under the ISC license.
313 * See the LICENSE file in the root directory of this source tree.
314 */const sS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Vm=xe("info",sS);/**
315 * @license lucide-react v0.525.0 - ISC
316 *
317 * This source code is licensed under the ISC license.
318 * See the LICENSE file in the root directory of this source tree.
319 */const aS=[["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"}]],Ic=xe("key-round",aS);/**
320 * @license lucide-react v0.525.0 - ISC
321 *
322 * This source code is licensed under the ISC license.
323 * See the LICENSE file in the root directory of this source tree.
324 */const nS=[["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"}]],rS=xe("key",nS);/**
325 * @license lucide-react v0.525.0 - ISC
326 *
327 * This source code is licensed under the ISC license.
328 * See the LICENSE file in the root directory of this source tree.
329 */const lS=[["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:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],iv=xe("layers",lS);/**
330 * @license lucide-react v0.525.0 - ISC
331 *
332 * This source code is licensed under the ISC license.
333 * See the LICENSE file in the root directory of this source tree.
334 */const iS=[["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"}]],Fc=xe("layout-dashboard",iS);/**
335 * @license lucide-react v0.525.0 - ISC
336 *
337 * This source code is licensed under the ISC license.
338 * See the LICENSE file in the root directory of this source tree.
339 */const oS=[["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"}]],cS=xe("layout-grid",oS);/**
340 * @license lucide-react v0.525.0 - ISC
341 *
342 * This source code is licensed under the ISC license.
343 * See the LICENSE file in the root directory of this source tree.
344 */const dS=[["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"}]],uS=xe("lightbulb",dS);/**
345 * @license lucide-react v0.525.0 - ISC
346 *
347 * This source code is licensed under the ISC license.
348 * See the LICENSE file in the root directory of this source tree.
349 */const mS=[["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"}]],fS=xe("link-2",mS);/**
350 * @license lucide-react v0.525.0 - ISC
351 *
352 * This source code is licensed under the ISC license.
353 * See the LICENSE file in the root directory of this source tree.
354 */const hS=[["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"}]],xS=xe("list",hS);/**
355 * @license lucide-react v0.525.0 - ISC
356 *
357 * This source code is licensed under the ISC license.
358 * See the LICENSE file in the root directory of this source tree.
359 */const pS=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],xa=xe("loader-circle",pS);/**
360 * @license lucide-react v0.525.0 - ISC
361 *
362 * This source code is licensed under the ISC license.
363 * See the LICENSE file in the root directory of this source tree.
364 */const gS=[["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"}]],ma=xe("lock",gS);/**
365 * @license lucide-react v0.525.0 - ISC
366 *
367 * This source code is licensed under the ISC license.
368 * See the LICENSE file in the root directory of this source tree.
369 */const vS=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],vl=xe("log-out",vS);/**
370 * @license lucide-react v0.525.0 - ISC
371 *
372 * This source code is licensed under the ISC license.
373 * See the LICENSE file in the root directory of this source tree.
374 */const yS=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Lt=xe("mail",yS);/**
375 * @license lucide-react v0.525.0 - ISC
376 *
377 * This source code is licensed under the ISC license.
378 * See the LICENSE file in the root directory of this source tree.
379 */const bS=[["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"}]],jS=xe("map-pin",bS);/**
380 * @license lucide-react v0.525.0 - ISC
381 *
382 * This source code is licensed under the ISC license.
383 * See the LICENSE file in the root directory of this source tree.
384 */const NS=[["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"}]],wS=xe("maximize",NS);/**
385 * @license lucide-react v0.525.0 - ISC
386 *
387 * This source code is licensed under the ISC license.
388 * See the LICENSE file in the root directory of this source tree.
389 */const SS=[["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 18h16",key:"19g7jn"}],["path",{d:"M4 6h16",key:"1o0s65"}]],c0=xe("menu",SS);/**
390 * @license lucide-react v0.525.0 - ISC
391 *
392 * This source code is licensed under the ISC license.
393 * See the LICENSE file in the root directory of this source tree.
394 */const CS=[["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"}]],Fa=xe("message-square",CS);/**
395 * @license lucide-react v0.525.0 - ISC
396 *
397 * This source code is licensed under the ISC license.
398 * See the LICENSE file in the root directory of this source tree.
399 */const kS=[["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"}]],_S=xe("monitor",kS);/**
400 * @license lucide-react v0.525.0 - ISC
401 *
402 * This source code is licensed under the ISC license.
403 * See the LICENSE file in the root directory of this source tree.
404 */const DS=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],ur=xe("moon",DS);/**
405 * @license lucide-react v0.525.0 - ISC
406 *
407 * This source code is licensed under the ISC license.
408 * See the LICENSE file in the root directory of this source tree.
409 */const ES=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["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:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],zi=xe("palette",ES);/**
410 * @license lucide-react v0.525.0 - ISC
411 *
412 * This source code is licensed under the ISC license.
413 * See the LICENSE file in the root directory of this source tree.
414 */const MS=[["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"}]],TS=xe("panel-left-close",MS);/**
415 * @license lucide-react v0.525.0 - ISC
416 *
417 * This source code is licensed under the ISC license.
418 * See the LICENSE file in the root directory of this source tree.
419 */const AS=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],RS=xe("panel-left",AS);/**
420 * @license lucide-react v0.525.0 - ISC
421 *
422 * This source code is licensed under the ISC license.
423 * See the LICENSE file in the root directory of this source tree.
424 */const OS=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],kc=xe("paperclip",OS);/**
425 * @license lucide-react v0.525.0 - ISC
426 *
427 * This source code is licensed under the ISC license.
428 * See the LICENSE file in the root directory of this source tree.
429 */const PS=[["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"}
429]],zS=xe("pause",PS);/**
430 * @license lucide-react v0.525.0 - ISC
431 *
432 * This source code is licensed under the ISC license.
433 * See the LICENSE file in the root directory of this source tree.
434 */const LS=[["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"}]],d0=xe("pen-line",LS);/**
435 * @license lucide-react v0.525.0 - ISC
436 *
437 * This source code is licensed under the ISC license.
438 * See the LICENSE file in the root directory of this source tree.
439 */const US=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],wf=xe("phone",US);/**
440 * @license lucide-react v0.525.0 - ISC
441 *
442 * This source code is licensed under the ISC license.
443 * See the LICENSE file in the root directory of this source tree.
444 */const $S=[["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"}]],IS=xe("pin",$S);/**
445 * @license lucide-react v0.525.0 - ISC
446 *
447 * This source code is licensed under the ISC license.
448 * See the LICENSE file in the root directory of this source tree.
449 */const FS=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Rt=xe("plus",FS);/**
450 * @license lucide-react v0.525.0 - ISC
451 *
452 * This source code is licensed under the ISC license.
453 * See the LICENSE file in the root directory of this source tree.
454 */const BS=[["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"}]],qS=xe("presentation",BS);/**
455 * @license lucide-react v0.525.0 - ISC
456 *
457 * This source code is licensed under the ISC license.
458 * See the LICENSE file in the root directory of this source tree.
459 */const HS=[["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"}]],_n=xe("receipt",HS);/**
460 * @license lucide-react v0.525.0 - ISC
461 *
462 * This source code is licensed under the ISC license.
463 * See the LICENSE file in the root directory of this source tree.
464 */const VS=[["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"}]],u0=xe("refresh-cw",VS);/**
465 * @license lucide-react v0.525.0 - ISC
466 *
467 * This source code is licensed under the ISC license.
468 * See the LICENSE file in the root directory of this source tree.
469 */const GS=[["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"}]],Gm=xe("rotate-ccw",GS);/**
470 * @license lucide-react v0.525.0 - ISC
471 *
472 * This source code is licensed under the ISC license.
473 * See the LICENSE file in the root directory of this source tree.
474 */const YS=[["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"}]],Nr=xe("save",YS);/**
475 * @license lucide-react v0.525.0 - ISC
476 *
477 * This source code is licensed under the ISC license.
478 * See the LICENSE file in the root directory of this source tree.
479 */const XS=[["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"}]],bc=xe("scale",XS);/**
480 * @license lucide-react v0.525.0 - ISC
481 *
482 * This source code is licensed under the ISC license.
483 * See the LICENSE file in the root directory of this source tree.
484 */const KS=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Un=xe("search",KS);/**
485 * @license lucide-react v0.525.0 - ISC
486 *
487 * This source code is licensed under the ISC license.
488 * See the LICENSE file in the root directory of this source tree.
489 */const ZS=[["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"}]],Ja=xe("send",ZS);/**
490 * @license lucide-react v0.525.0 - ISC
491 *
492 * This source code is licensed under the ISC license.
493 * See the LICENSE file in the root directory of this source tree.
494 */const QS=[["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"}]],JS=xe("server",QS);/**
495 * @license lucide-react v0.525.0 - ISC
496 *
497 * This source code is licensed under the ISC license.
498 * See the LICENSE file in the root directory of this source tree.
499 */const WS=[["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"}]],Ym=xe("settings",WS);/**
500 * @license lucide-react v0.525.0 - ISC
501 *
502 * This source code is licensed under the ISC license.
503 * See the LICENSE file in the root directory of this source tree.
504 */const e4=[["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"}]],t4=xe("share-2",e4);/**
505 * @license lucide-react v0.525.0 - ISC
506 *
507 * This source code is licensed under the ISC license.
508 * See the LICENSE file in the root directory of this source tree.
509 */const s4=[["path",{d:"M12 2v13",key:"1km8f5"}],["path",{d:"m16 6-4-4-4 4",key:"13yo43"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}]],a4=xe("share",s4);/**
510 * @license lucide-react v0.525.0 - ISC
511 *
512 * This source code is licensed under the ISC license.
513 * See the LICENSE file in the root directory of this source tree.
514 */const n4=[["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"}]],r4=xe("sheet",n4);/**
515 * @license lucide-react v0.525.0 - ISC
516 *
517 * This source code is licensed under the ISC license.
518 * See the LICENSE file in the root directory of this source tree.
519 */const l4=[["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",ke
519y:"oel41y"}]],Ga=xe("shield",l4);/**
520 * @license lucide-react v0.525.0 - ISC
521 *
522 * This source code is licensed under the ISC license.
523 * See the LICENSE file in the root directory of this source tree.
524 */const i4=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Dn=xe("square-check-big",i4);/**
525 * @license lucide-react v0.525.0 - ISC
526 *
527 * This source code is licensed under the ISC license.
528 * See the LICENSE file in the root directory of this source tree.
529 */const o4=[["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"}]],ya=xe("square-pen",o4);/**
530 * @license lucide-react v0.525.0 - ISC
531 *
532 * This source code is licensed under the ISC license.
533 * See the LICENSE file in the root directory of this source tree.
534 */const c4=[["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"}]],d4=xe("star",c4);/**
535 * @license lucide-react v0.525.0 - ISC
536 *
537 * This source code is licensed under the ISC license.
538 * See the LICENSE file in the root directory of this source tree.
539 */const u4=[["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"}]],ov=xe("sticky-note",u4);/**
540 * @license lucide-react v0.525.0 - ISC
541 *
542 * This source code is licensed under the ISC license.
543 * See the LICENSE file in the root directory of this source tree.
544 */const m4=[["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"}]],mr=xe("sun",m4);/**
545 * @license lucide-react v0.525.0 - ISC
546 *
547 * This source code is licensed under the ISC license.
548 * See the LICENSE file in the root directory of this source tree.
549 */const f4=[["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"}]],jc=xe("tag",f4);/**
550 * @license lucide-react v0.525.0 - ISC
551 *
552 * This source code is licensed under the ISC license.
553 * See the LICENSE file in the root directory of this source tree.
554 */const h4=[["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"}]],Sf=xe("target",h4);/**
555 * @license lucide-react v0.525.0 - ISC
556 *
557 * This source code is licensed under the ISC license.
558 * See the LICENSE file in the root directory of this source tree.
559 */const x4=[["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"}]],$n=xe("trash-2",x4);/**
560 * @license lucide-react v0.525.0 - ISC
561 *
562 * This source code is licensed under the ISC license.
563 * See the LICENSE file in the root directory of this source tree.
564 */const p4=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],yl=xe("trending-up",p4);/**
565 * @license lucide-react v0.525.0 - ISC
566 *
567 * This source code is licensed under the ISC license.
568 * See the LICENSE file in the root directory of this source tree.
569 */const g4=[["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"}]],Oi=xe("triangle-alert",g4);/**
570 * @license lucide-react v0.525.0 - ISC
571 *
572 * This source code is licensed under the ISC license.
573 * See the LICENSE file in the root directory of this source tree.
574 */const v4=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],pa=xe("upload",v4);/**
575 * @license lucide-react v0.525.0 - ISC
576 *
577 * This source code is licensed under the ISC license.
578 * See the LICENSE file in the root directory of this source tree.
579 */const y4=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["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"}]],cv=xe("user-check",y4);/**
580 * @license lucide-react v0.525.0 - ISC
581 *
582 * This source code is licensed under the ISC license.
583 * See the LICENSE file in the root directory of this source tree.
584 */const b4=[["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"}]],Xm=xe("user-plus",b4);/**
585 * @license lucide-react v0.525.0 - ISC
586 *
587 * This source code is licensed under the ISC license.
588 * See the LICENSE file in the root directory of this source tree.
589 */const j4=[["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"}]],nt=xe("user",j4);/**
590 * @license lucide-react v0.525.0 - ISC
591 *
592 * This source code is licensed under the ISC license.
593 * See the LICENSE file in the root directory of this source tree.
594 */const N4=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],yt=xe("users",N4);/**
595 * @license lucide-react v0.525.0 - ISC
596 *
597 * This source code is licensed under the ISC license.
598 * See the LICENSE file in the root directory of this source tree.
599 */const w4=[["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"}]],S4=xe("volume-x",w4);/**
600 * @license lucide-react v0.525.0 - ISC
601 *
602 * This source code is licensed under the ISC license.
603 * See the LICENSE file in the root directory of this source tree.
604 */const C4=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],gs=xe("x",C4);/**
605 * @license lucide-react v0.525.0 - ISC
606 *
607 * This source code is licensed under the ISC license.
608 * See the LICENSE file in the root directory of this source tree.
609 */const k4=[["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"}]],_4=xe("zap",k4);function dv(a,r){if(typeof a=="function")return a(r);a!=null&&(a.current=r)}function Bc(...a){return r=>{let i=!1;const o=a.map(c=>{const m=dv(c,r);return!i&&typeof m=="function"&&(i=!0),m});if(i)return()=>{for(let c=0;c<o.length;c++){const m=o[c];typeof m=="function"?m():dv(a[c],null)}}}}function it(...a){return f.useCallback(Bc(...a),a)}function hr(a){const r=E4(a),i=f.forwardRef((o,c)=>{const{children:m,...u}=o,g=f.Children.toArray(m),x=g.find(T4);if(x){const p=x.props.children,y=g.map(v=>v===x?f.Children.count(p)>1?f.Children.only(null):f.isValidElement(p)?p.props.children:null:v);return e.jsx(r,{...u,ref:c,children:f.isValidElement(p)?f.cloneElement(p,void 0,y):null})}return e.jsx(r,{...u,ref:c,children:m})});return i.displayName=`${a}.Slot`,i}var D4=hr("Slot");function E4(a){const r=f.forwardRef((i,o)=>{const{children:c,...m}=i;if(f.isValidElement(c)){const u=R4(c),g=A4(m,c.props);return c.type!==f.Fragment&&(g.ref=o?Bc(o,u):u),f.cloneElement(c,g)}return f.Children.count(c)>1?f.Children.only(null):null});return r.displayName=`${a}.SlotClone`,r}var M4=Symbol("radix.slottable");function T4(a){return f.isValidElement(a)&&typeof a.type=="function"&&"__radixId"in a.type&&a.type.__radixId===M4}function A4(a,r){const i={...r};for(const o in r){const c=a[o],m=r[o];/^on[A-Z]/.test(o)?c&&m?i[o]=(...g)=>{const x=m(...g);return c(...g),x}:c&&(i[o]=c):o==="style"?i[o]={...c,...m}
vendor: 8,783 bytes, line 609
609:o==="className"&&(i[o]=[c,m].filter(Boolean).join(" "))}return{...a,...i}}function R4(a){let r=Object.getOwnPropertyDescriptor(a.props,"ref")?.get,i=r&&"isReactWarning"in r&&r.isReactWarning;return i?a.ref:(r=Object.getOwnPropertyDescriptor(a,"ref")?.get,i=r&&"isReactWarning"in r&&r.isReactWarning,i?a.props.ref:a.props.ref||a.ref)}function m0(a){var r,i,o="";if(typeof a=="string"||typeof a=="number")o+=a;else if(typeof a=="object")if(Array.isArray(a)){var c=a.length;for(r=0;r<c;r++)a[r]&&(i=m0(a[r]))&&(o&&(o+=" "),o+=i)}else for(i in a)a[i]&&(o&&(o+=" "),o+=i);return o}function f0(){for(var a,r,i=0,o="",c=arguments.length;i<c;i++)(a=arguments[i])&&(r=m0(a))&&(o&&(o+=" "),o+=r);return o}const uv=a=>typeof a=="boolean"?`${a}`:a===0?"0":a,mv=f0,Cf=(a,r)=>i=>{var o;if(r?.variants==null)return mv(a,i?.class,i?.className);const{variants:c,defaultVariants:m}=r,u=Object.keys(c).map(p=>{const y=i?.[p],v=m?.[p];if(y===null)return null;const w=uv(y)||uv(v);return c[p][w]}),g=i&&Object.entries(i).reduce((p,y)=>{let[v,w]=y;return w===void 0||(p[v]=w),p},{}),x=r==null||(o=r.compoundVariants)===null||o===void 0?void 0:o.reduce((p,y)=>{let{class:v,className:w,...N}=y;return Object.entries(N).every(D=>{let[b,E]=D;return Array.isArray(E)?E.includes({...m,...g}[b]):{...m,...g}[b]===E})?[...p,v,w]:p},[]);return mv(a,u,x,i?.class,i?.className)},kf="-",O4=a=>{const r=z4(a),{conflictingClassGroups:i,conflictingClassGroupModifiers:o}=a;return{getClassGroupId:u=>{const g=u.split(kf);return g[0]===""&&g.length!==1&&g.shift(),h0(g,r)||P4(u)},getConflictingClassGroupIds:(u,g)=>{const x=i[u]||[];return g&&o[u]?[...x,...o[u]]:x}}},h0=(a,r)=>{if(a.length===0)return r.classGroupId;const i=a[0],o=r.nextPart.get(i),c=o?h0(a.slice(1),o):void 0;if(c)return c;if(r.validators.length===0)return;const m=a.join(kf);return r.validators.find(({validator:u})=>u(m))?.classGroupId},fv=/^\[(.+)\]$/,P4=a=>{if(fv.test(a)){const r=fv.exec(a)[1],i=r?.substring(0,r.indexOf(":"));if(i)return"arbitrary.."+i}},z4=a=>{const{theme:r,classGroups:i}=a,o={nextPart:new Map,validators:[]};for(const c in i)Km(i[c],o,c,r);return o},Km=(a,r,i,o)=>{a.forEach(c=>{if(typeof c=="string"){const m=c===""?r:hv(r,c);m.classGroupId=i;return}if(typeof c=="function"){if(L4(c)){Km(c(o),r,i,o);return}r.validators.push({validator:c,classGroupId:i});return}Object.entries(c).forEach(([m,u])=>{Km(u,hv(r,m),i,o)})})},hv=(a,r)=>{let i=a;return r.split(kf).forEach(o=>{i.nextPart.has(o)||i.nextPart.set(o,{nextPart:new Map,validators:[]}),i=i.nextPart.get(o)}),i},L4=a=>a.isThemeGetter,U4=a=>{if(a<1)return{get:()=>{},set:()=>{}};let r=0,i=new Map,o=new Map;const c=(m,u)=>{i.set(m,u),r++,r>a&&(r=0,o=i,i=new Map)};return{get(m){let u=i.get(m);if(u!==void 0)return u;if((u=o.get(m))!==void 0)return c(m,u),u},set(m,u){i.has(m)?i.set(m,u):c(m,u)}}},Zm="!",Qm=":",$4=Qm.length,I4=a=>{const{prefix:r,experimentalParseClassName:i}=a;let o=c=>{const m=[];let u=0,g=0,x=0,p;for(let D=0;D<c.length;D++){let b=c[D];if(u===0&&g===0){if(b===Qm){m.push(c.slice(x,D)),x=D+$4;continue}if(b==="/"){p=D;continue}}b==="["?u++:b==="]"?u--:b==="("?g++:b===")"&&g--}const y=m.length===0?c:c.substring(x),v=F4(y),w=v!==y,N=p&&p>x?p-x:void 0;return{modifiers:m,hasImportantModifier:w,baseClassName:v,maybePostfixModifierPosition:N}};if(r){const c=r+Qm,m=o;o=u=>u.startsWith(c)?m(u.substring(c.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:u,maybePostfixModifierPosition:void 0}}if(i){const c=o;o=m=>i({className:m,parseClassName:c})}return o},F4=a=>a.endsWith(Zm)?a.substring(0,a.length-1):a.startsWith(Zm)?a.substring(1):a,B4=a=>{const r=Object.fromEntries(a.orderSensitiveModifiers.map(o=>[o,!0]));return o=>{if(o.length<=1)return o;const c=[];let m=[];return o.forEach(u=>{u[0]==="["||r[u]?(c.push(...m.sort(),u),m=[]):m.push(u)}),c.push(...m.sort()),c}},q4=a=>({cache:U4(a.cacheSize),parseClassName:I4(a),sortModifiers:B4(a),...O4(a)}),H4=/\s+/,V4=(a,r)=>{const{parseClassName:i,getClassGroupId:o,getConflictingClassGroupIds:c,sortModifiers:m}=r,u=[],g=a.trim().split(H4);let x="";for(let p=g.length-1;p>=0;p-=1){const y=g[p],{isExternal:v,modifiers:w,hasImportantModifier:N,baseClassName:D,maybePostfixModifierPosition:b}=i(y);if(v){x=y+(x.length>0?" "+x:x);continue}let E=!!b,_=o(E?D.substring(0,b):D);if(!_){if(!E){x=y+(x.length>0?" "+x:x);continue}if(_=o(D),!_){x=y+(x.length>0?" "+x:x);continue}E=!1}const M=m(w).join(":"),k=N?M+Zm:M,C=k+_;if(u.includes(C))continue;u.push(C);const j=c(_,E);for(let O=0;O<j.length;++O){const L=j[O];u.push(k+L)}x=y+(x.length>0?" "+x:x)}return x};function G4(){let a=0,r,i,o="";for(;a<arguments.length;)(r=arguments[a++])&&(i=x0(r))&&(o&&(o+=" "),o+=i);return o}const x0=a=>{if(typeof a=="string")return a;let r,i="";for(let o=0;o<a.length;o++)a[o]&&(r=x0(a[o]))&&(i&&(i+=" "),i+=r);return i};function Y4(a,...r){let i,o,c,m=u;function u(x){const p=r.reduce((y,v)=>v(y),a());return i=q4(p),o=i.cache.get,c=i.cache.set,m=g,g(x)}function g(x){const p=o(x);if(p)return p;const y=V4(x,i);return c(x,y),y}return function(){return m(G4.apply(null,arguments))}}const Bt=a=>{const r=i=>i[a]||[];return r.isThemeGetter=!0,r},p0=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,g0=/^\((?:(\w[\w-]*):)?(.+)\)$/i,X4=/^\d+\/\d+$/,K4=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Z4=/\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$/,Q4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,J4=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,W4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,dl=a=>X4.test(a),Ze=a=>!!a&&!Number.isNaN(Number(a)),Sn=a=>!!a&&Number.isInteger(Number(a)),_m=a=>a.endsWith("%")&&Ze(a.slice(0,-1)),$a=a=>K4.test(a),eC=()=>!0,tC=a=>Z4.test(a)&&!Q4.test(a),v0=()=>!1,sC=a=>J4.test(a),aC=a=>W4.test(a),nC=a=>!Ee(a)&&!Me(a),rC=a=>jl(a,j0,v0),Ee=a=>p0.test(a),lr=a=>jl(a,N0,tC),Dm=a=>jl(a,dC,Ze),xv=a=>jl(a,y0,v0),lC=a=>jl(a,b0,aC),cc=a=>jl(a,w0,sC),Me=a=>g0.test(a),ki=a=>Nl(a,N0),iC=a=>Nl(a,uC),pv=a=>Nl(a,y0),oC=a=>Nl(a,j0),cC=a=>Nl(a,b0),dc=a=>Nl(a,w0,!0),jl=(a,r,i)=>{const o=p0.exec(a);return o?o[1]?r(o[1]):i(o[2]):!1},Nl=(a,r,i=!1)=>{const o=g0.exec(a);return o?o[1]?r(o[1]):i:!1},y0=a=>a==="position"||a==="percentage",b0=a=>a==="image"||a==="url",j0=a=>a==="length"||a==="size"||a==="bg-size",N0=a=>a==="length",dC=a=>a==="number",uC=a=>a==="family-name",w0=a=>a==="shadow",mC=()=>{const a=Bt("color"),r=Bt("font"),i=Bt("text"),o=Bt("font-weight"),c=Bt("tracking"),m=Bt("leading"),u=Bt("breakpoint"),g=Bt("container"),x=Bt("spacing"),p=Bt("radius"),y=Bt("shadow"),v=Bt("inset-shadow"),w=Bt("text-shadow"),N=Bt("drop-shadow"),D=Bt("blur"),b=Bt("perspective"),E=Bt("aspect"),_=Bt("ease"),M=Bt("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],j=()=>[...C(),Me,Ee],O=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],R=()=>[Me,Ee,x],H=()=>[dl,"full","auto",...R()],z=()=>[Sn,"none","subgrid",Me,Ee],V=()=>["auto",{span:["full",Sn,Me,Ee]},Sn,Me,Ee],Z=()=>[Sn,"auto",Me,Ee],I=()=>["auto","min","max","fr",Me,Ee],ue=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],P=()=>["auto",...R()],$=()=>[dl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],F=()=>[a,Me,Ee],ne=()=>[...C(),pv,xv,{position:[Me,Ee]}],T=()=>["no-repeat",{repeat:["","x","y","space","round"]}],B=()=>["auto","cover","contain",oC,rC,{size:[Me,Ee]}],ee=()=>[_m,ki,lr],te=()=>["","none","full",p,Me,Ee],ye=()=>["",Ze,ki,lr],ge=()=>["solid","dashed","dotted","double"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],re=()=>[Ze,_m,pv,xv],je=()=>["","none",D,Me,Ee],Ae=()=>["none",Ze,Me,Ee],ie=()=>["none",Ze,Me,Ee],we=()=>[Ze,Me,Ee],_e=()=>[dl,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[$a],breakpoint:[$a],color:[eC],container:[$a],"drop-shadow":[$a],ease:["in","out","in-out"],font:[nC],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[$a],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[$a],shadow:[$a],spacing:["px",Ze],text:[$a],"text-shadow":[$a],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",dl,Ee,Me,E]}
vendor: 12,878 bytes, line 609
609],container:["container"],columns:[{columns:[Ze,Ee,Me,g]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"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"],sr:["sr-only","not-sr-only"],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:j()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:H()}],"inset-x":[{"inset-x":H()}],"inset-y":[{"inset-y":H()}],start:[{start:H()}],end:[{end:H()}],top:[{top:H()}],right:[{right:H()}],bottom:[{bottom:H()}],left:[{left:H()}],visibility:["visible","invisible","collapse"],z:[{z:[Sn,"auto",Me,Ee]}],basis:[{basis:[dl,"full","auto",g,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ze,dl,"auto","initial","none",Ee]}],grow:[{grow:["",Ze,Me,Ee]}],shrink:[{shrink:["",Ze,Me,Ee]}],order:[{order:[Sn,"first","last","none",Me,Ee]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:V()}],"col-start":[{"col-start":Z()}],"col-end":[{"col-end":Z()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:V()}],"row-start":[{"row-start":Z()}],"row-end":[{"row-end":Z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":I()}],"auto-rows":[{"auto-rows":I()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...ue(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...ue()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":ue()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:P()}],mx:[{mx:P()}],my:[{my:P()}],ms:[{ms:P()}],me:[{me:P()}],mt:[{mt:P()}],mr:[{mr:P()}],mb:[{mb:P()}],ml:[{ml:P()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:$()}],w:[{w:[g,"screen",...$()]}],"min-w":[{"min-w":[g,"screen","none",...$()]}],"max-w":[{"max-w":[g,"screen","none","prose",{screen:[u]},...$()]}],h:[{h:["screen","lh",...$()]}],"min-h":[{"min-h":["screen","lh","none",...$()]}],"max-h":[{"max-h":["screen","lh",...$()]}],"font-size":[{text:["base",i,ki,lr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,Me,Dm]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",_m,Ee]}],"font-family":[{font:[iC,Ee,r]}],"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:[c,Me,Ee]}],"line-clamp":[{"line-clamp":[Ze,"none",Me,Dm]}],leading:[{leading:[m,...R()]}],"list-image":[{"list-image":["none",Me,Ee]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Me,Ee]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ge(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ze,"from-font","auto",Me,lr]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[Ze,"auto",Me,Ee]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Me,Ee]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Me,Ee]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ne()}],"bg-repeat":[{bg:T()}],"bg-size":[{bg:B()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Sn,Me,Ee],radial:["",Me,Ee],conic:[Sn,Me,Ee]},cC,lC]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:te()}],"rounded-s":[{"rounded-s":te()}],"rounded-e":[{"rounded-e":te()}],"rounded-t":[{"rounded-t":te()}],"rounded-r":[{"rounded-r":te()}],"rounded-b":[{"rounded-b":te()}],"rounded-l":[{"rounded-l":te()}],"rounded-ss":[{"rounded-ss":te()}],"rounded-se":[{"rounded-se":te()}],"rounded-ee":[{"rounded-ee":te()}],"rounded-es":[{"rounded-es":te()}],"rounded-tl":[{"rounded-tl":te()}],"rounded-tr":[{"rounded-tr":te()}],"rounded-br":[{"rounded-br":te()}],"rounded-bl":[{"rounded-bl":te()}],"border-w":[{border:ye()}],"border-w-x":[{"border-x":ye()}],"border-w-y":[{"border-y":ye()}],"border-w-s":[{"border-s":ye()}],"border-w-e":[{"border-e":ye()}],"border-w-t":[{"border-t":ye()}],"border-w-r":[{"border-r":ye()}],"border-w-b":[{"border-b":ye()}],"border-w-l":[{"border-l":ye()}],"divide-x":[{"divide-x":ye()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ye()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ge(),"hidden","none"]}],"divide-style":[{divide:[...ge(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...ge(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ze,Me,Ee]}],"outline-w":[{outline:["",Ze,ki,lr]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","none",y,dc,cc]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",v,dc,cc]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:ye()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[Ze,lr]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":ye()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",w,dc,cc]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[Ze,Me,Ee]}],"mix-blend":[{"mix-blend":[...K(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":K()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ze]}],"mask-image-linear-from-pos":[{"mask-linear-from":re()}],"mask-image-linear-to-pos":[{"mask-linear-to":re()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":re()}],"mask-image-t-to-pos":[{"mask-t-to":re()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":re()}],"mask-image-r-to-pos":[{"mask-r-to":re()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":re()}],"mask-image-b-to-pos":[{"mask-b-to":re()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":re()}],"mask-image-l-to-pos":[{"mask-l-to":re()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":re()}],"mask-image-x-to-pos":[{"mask-x-to":re()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":re()}],"mask-image-y-to-pos":[{"mask-y-to":re()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[Me,Ee]}],"mask-image-radial-from-pos":[{"mask-radial-from":re()}],"mask-image-radial-to-pos":[{"mask-radial-to":re()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[Ze]}],"mask-image-conic-from-pos":[{"mask-conic-from":re()}],"mask-image-conic-to-pos":[{"mask-conic-to":re()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ne()}],"mask-repeat":[{mask:T()}],"mask-size":[{mask:B()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Me,Ee]}],filter:[{filter:["","none",Me,Ee]}],blur:[{blur:je()}],brightness:[{brightness:[Ze,Me,Ee]}],contrast:[{contrast:[Ze,Me,Ee]}],"drop-shadow":[{"drop-shadow":["","none",N,dc,cc]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",Ze,Me,Ee]}],"hue-rotate":[{"hue-rotate":[Ze,Me,Ee]}],invert:[{invert:["",Ze,Me,Ee]}],saturate:[{saturate:[Ze,Me,Ee]}],sepia:[{sepia:["",Ze,Me,Ee]}],"backdrop-filter":[{"backdrop-filter":["","none",Me,Ee]}],"backdrop-blur":[{"backdrop-blur":je()}],"backdrop-brightness":[{"backdrop-brightness":[Ze,Me,Ee]}],"backdrop-contrast":[{"backdrop-contrast":[Ze,Me,Ee]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ze,Me,Ee]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ze,Me,Ee]}],"backdrop-invert":[{"backdrop-invert":["",Ze,Me,Ee]}],"backdrop-opacity":[{"backdrop-opacity":[Ze,Me,Ee]}],"backdrop-saturate":[{"backdrop-saturate":[Ze,Me,Ee]}],"backdrop-sepia":[{"backdrop-sepia":["",Ze,Me,Ee]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Me,Ee]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ze,"initial",Me,Ee]}],ease:[{ease:["linear","initial",_,Me,Ee]}],delay:[{delay:[Ze,Me,Ee]}],animate:[{animate:["none",M,Me,Ee]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,Me,Ee]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:Ae()}],"rotate-x":[{"rotate-x":Ae()}],"rotate-y":[{"rotate-y":Ae()}],"rotate-z":[{"rotate-z":Ae()}],scale:[{scale:ie()}],"scale-x":[{"scale-x":ie()}],"scale-y":[{"scale-y":ie()}],"scale-z":[{"scale-z":ie()}],"scale-3d":["scale-3d"],skew:[{skew:we()}],"skew-x":[{"skew-x":we()}],"skew-y":[{"skew-y":we()}],transform:[{transform:[Me,Ee,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:_e()}],"translate-x":[{"translate-x":_e()}],"translate-y":[{"translate-y":_e()}],"translate-z":[{"translate-z":_e()}],"translate-none":["translate-none"],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}
vendor: 4,862 bytes, line 609
609],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",Me,Ee]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"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",Me,Ee]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[Ze,ki,lr,Dm]}],stroke:[{stroke:["none",...F()]}],"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-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},fC=Y4(mC);function Ge(...a){return fC(f0(a))}const hC=Cf("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary-navy text-white shadow hover:bg-primary-navy
609/90",destructive:"bg-red-500 text-white shadow-sm hover:bg-red-500/90",outline:"border border-neutral-dark bg-transparent shadow-sm hover:bg-neutral-light hover:text-neutral-dark",secondary:"bg-primary-mint text-primary-navy shadow-sm hover:bg-primary-mint/80",ghost:"hover:bg-neutral-light hover:text-neutral-dark",link:"text-primary-mint underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),G=f.forwardRef(({className:a,variant:r,size:i,asChild:o=!1,...c},m)=>{const u=o?D4:"button";return e.jsx(u,{className:Ge(hC({variant:r,size:i,className:a}),"btn-animate"),ref:m,...c})});G.displayName="Button";function Te(a,r,{checkForDefaultPrevented:i=!0}={}){return function(c){if(a?.(c),i===!1||!c.defaultPrevented)return r?.(c)}}function xC(a,r){const i=f.createContext(r),o=m=>{const{children:u,...g}=m,x=f.useMemo(()=>g,Object.values(g));return e.jsx(i.Provider,{value:x,children:u})};o.displayName=a+"Provider";function c(m){const u=f.useContext(i);if(u)return u;if(r!==void 0)return r;throw new Error(`\`${m}\` must be used within \`${a}\``)}return[o,c]}function Bs(a,r=[]){let i=[];function o(m,u){const g=f.createContext(u),x=i.length;i=[...i,u];const p=v=>{const{scope:w,children:N,...D}=v,b=w?.[a]?.[x]||g,E=f.useMemo(()=>D,Object.values(D));return e.jsx(b.Provider,{value:E,children:N})};p.displayName=m+"Provider";function y(v,w){const N=w?.[a]?.[x]||g,D=f.useContext(N);if(D)return D;if(u!==void 0)return u;throw new Error(`\`${v}\` must be used within \`${m}\``)}return[p,y]}const c=()=>{const m=i.map(u=>f.createContext(u));return function(g){const x=g?.[a]||m;return f.useMemo(()=>({[`__scope${a}`]:{...g,[a]:x}}),[g,x])}};return c.scopeName=a,[o,pC(c,...r)]}function pC(...a){const r=a[0];if(a.length===1)return r;const i=()=>{const o=a.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(m){const u=o.reduce((g,{useScope:x,scopeName:p})=>{const v=x(m)[`__scope${p}`];return{...g,...v}},{});return f.useMemo(()=>({[`__scope${r.scopeName}`]:u}),[u])}};return i.scopeName=r.scopeName,i}var $t=globalThis?.document?f.useLayoutEffect:()=>{},gC=a0[" useInsertionEffect ".trim().toString()]||$t;function Ya({prop:a,defaultProp:r,onChange:i=()=>{},caller:o}){const[c,m,u]=vC({defaultProp:r,onChange:i}),g=a!==void 0,x=g?a:c;{const y=f.useRef(a!==void 0);f.useEffect(()=>{const v=y.current;v!==g&&console.warn(`${o} is changing from ${v?"controlled":"uncontrolled"} to ${g?"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.`),y.current=g},[g,o])}const p=f.useCallback(y=>{if(g){const v=yC(y)?y(a):y;v!==a&&u.current?.(v)}else m(y)},[g,a,m,u]);return[x,p]}function vC({defaultProp:a,onChange:r}){const[i,o]=f.useState(a),c=f.useRef(i),m=f.useRef(r);return gC(()=>{m.current=r},[r]),f.useEffect(()=>{c.current!==i&&(m.current?.(i),c.current=i)},[i,c]),[i,o,m]}function yC(a){return typeof a=="function"}var bC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Be=bC.reduce((a,r)=>{const i=hr(`Primitive.${r}`),o=f.forwardRef((c,m)=>{const{asChild:u,...g}=c,x=u?i:r;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(x,{...g,ref:m})});return o.displayName=`Primitive.${r}`,{...a,[r]:o}},{});function S0(a,r){a&&yr.flushSync(()=>a.dispatchEvent(r))}function jC(a,r){return f.useReducer((i,o)=>r[i][o]??i,a)}var aa=a=>{const{present:r,children:i}=a,o=NC(r),c=typeof i=="function"?i({present:o.isPresent}):f.Children.only(i),m=it(o.ref,wC(c));return typeof i=="function"||o.isPresent?f.cloneElement(c,{ref:m}):null};aa.displayName="Presence";function NC(a){const[r,i]=f.useState(),o=f.useRef(null),c=f.useRef(a),m=f.useRef("none"),u=a?"mounted":"unmounted",[g,x]=jC(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{const p=uc(o.current);m.current=g==="mounted"?p:"none"},[g]),$t(()=>{const p=o.current,y=c.current;if(y!==a){const w=m.current,N=uc(p);a?x("MOUNT"):N==="none"||p?.display==="none"?x("UNMOUNT"):x(y&&w!==N?"ANIMATION_OUT":"UNMOUNT"),c.current=a}},[a,x]),$t(()=>{if(r){let p;const y=r.ownerDocument.defaultView??window,v=N=>{const b=uc(o.current).includes(N.animationName);if(N.target===r&&b&&(x("ANIMATION_END"),!c.current)){const E=r.style.animationFillMode;r.style.animationFillMode="forwards",p=y.setTimeout(()=>{r.style.animationFillMode==="forwards"&&(r.style.animationFillMode=E)})}},w=N=>{N.target===r&&(m.current=uc(o.current))};return r.addEventListener("animationstart",w),r.addEventListener("animationcancel",v),r.addEventListener("animationend",v),()=>{y.clearTimeout(p),r.removeEventListener("animationstart",w),r.removeEventListener("animationcancel",v),r.removeEventListener("animationend",v)}}else x("ANIMATION_END")},[r,x]),{isPresent:["mounted","unmountSuspended"].includes(g),ref:f.useCallback(p=>{o.current=p?getComputedStyle(p):null,i(p)},[])}}function uc(a){return a?.animationName||"none"}function wC(a){let r=Object.getOwnPropertyDescriptor(a.props,"ref")?.get,i=r&&"isReactWarning"in r&&r.isReactWarning;return i?a.ref:(r=Object.getOwnPropertyDescriptor(a,"ref")?.get,i=r&&"isReactWarning"in r&&r.isReactWarning,i?a.props.ref:a.props.ref||a.ref)}var SC=a0[" useId ".trim().toString()]||(()=>{}),CC=0;function Qs(a){const[r,i]=f.useState(SC());return $t(()=>{i(o=>o??String(CC++))},[a]),r?`radix-${r}`:""}
609var qc="Collapsible",[kC,OM]=Bs(qc),[_C,_f]=kC(qc),C0=f.forwardRef((a,r)=>{const{__scopeCollapsible:i,open:o,defaultOpen:c,disabled:m,onOpenChange:u,...g}=a,[x,p]=Ya({prop:o,defaultProp:c??!1,onChange:u,caller:qc});return e.jsx(_C,{scope:i,disabled:m,contentId:Qs(),open:x,onOpenToggle:f.useCallback(()=>p(y=>!y),[p]),children:e.jsx(Be.div,{"data-state":Ef(x),"data-disabled":m?"":void 0,...g,ref:r})})});C0.displayName=qc;var k0="CollapsibleTrigger",_0=f.forwardRef((a,r)=>{const{__scopeCollapsible:i,...o}=a,c=_f(k0,i);return e.jsx(Be.button,{type:"button","aria-controls":c.contentId,"aria-expanded":c.open||!1,"data-state":Ef(c.open),"data-disabled":c.disabled?"":void 0,disabled:c.disabled,...o,ref:r,onClick:Te(a.onClick,c.onOpenToggle)})});_0.displayName=k0;var Df="CollapsibleContent",D0=f.forwardRef((a,r)=>{const{forceMount:i,...o}=a,c=_f(Df,a.__scopeCollapsible);return e.jsx(aa,{present:i||c.open,children:({present:m})=>e.jsx(DC,{...o,ref:r,present:m})})});D0.displayName=Df;var DC=f.forwardRef((a,r)=>{const{__scopeCollapsible:i,present:o,children:c,...m}=a,u=_f(Df,i),[g,x]=f.useState(o),p=f.useRef(null),y=it(r,p),v=f.useRef(0),w=v.current,N=f.useRef(0),D=N.current,b=u.open||g,E=f.useRef(b),_=f.useRef(void 0);return f.useEffect(()=>{const M=requestAnimationFrame(()=>E.current=!1);return()=>cancelAnimationFrame(M)},[]),$t(()=>{const M=p.current;if(M){_.current=_.current||{transitionDuration:M.style.transitionDuration,animationName:M.style.animationName},M.style.transitionDuration="0s",M.style.animationName="none";const k=M.getBoundingClientRect();v.current=k.height,N.current=k.width,E.current||(M.style.transitionDuration=_.current.transitionDuration,M.style.animationName=_.current.animationName),x(o)}},[u.open,o]),e.jsx(Be.div,{"data-state":Ef(u.open),"data-disabled":u.disabled?"":void 0,id:u.contentId,hidden:!b,...m,ref:y,style:{"--radix-collapsible-content-height":w?`${w}px`:void 0,"--radix-collapsible-content-width":D?`${D}px`:void 0,...a.style},children:b&&c})});function Ef(a){return a?"open":"closed"}var EC=C0;const MC=EC,TC=_0,AC=D0,qa=f.forwardRef(({className:a,orientation:r="horizontal",decorative:i=!0,...o},c)=>e.jsx("div",{ref:c,"aria-hidden":i?"true":void 0,orientation:r,className:Ge("shrink-0 bg-neutral-dark/20",r==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",a),...o}));qa.displayName="Separator";function xl({title:a,message:r,type:i="info",duration:o=4e3}){const c=new CustomEvent("app-toast",{detail:{title:a,message:r,type:i,duration:o}});window.dispatchEvent(c)}const Nt={success:a=>xl({title:"Success",message:a,type:"success"}),error:a=>xl({title:"Error",message:a,type:"error"}),info:a=>xl({title:"Info",message:a,type:"info"}),warning:a=>xl({title:"Warning",message:a,type:"warning"}),custom:xl},RC="http://localhost:8001/api/v1";class OC{constructor(){this.baseURL=RC,this.token=localStorage.getItem("authToken")}setToken(r){this.token=r,r?localStorage.setItem("authToken",r):localStorage.removeItem("authToken")}debugAuth(){localStorage.getItem("authToken");const r=this.token;return{isAuthenticated:!!r,token:r}}getHeaders(){const r={"Content-Type":"application/json",Accept:"application/json"};return this.token&&(r.Authorization=`Bearer ${this.token}`),r}async request(r,i={}){const o=`${this.baseURL}${r}`,c=localStorage.getItem("authToken");c&&c!==this.token&&(this.token=c);const m={headers:this.getHeaders(),...i};try{const u=await fetch(o,m);if(!u.ok){const x=await u.json().catch(()=>({}));console.log("API Error Details:",{status:u.status,url:o,errorData:x}),(u.status===401||u.status===403)&&(console.error("error"),console.error("error"),!(o.includes("/messages")||o.includes("/dashboard")||o.includes("/stats"))&&(x.message?.includes("unauthorized")||x.message?.includes("Unauthenticated"))&&(this.setToken(null),window.dispatchEvent(new CustomEvent("auth-error",{detail:x}))));const p=new Error(x.message||`HTTP error! status: ${u.status}`);throw p.response={status:u.status,data:x},p}return await u.json()}catch(u){throw u.message?.includes("unauthorized")||u.message?.includes("Unauthenticated")||u.message?.includes("401")||o.includes("/auth/")||xl({title:"API Error",message:u.message||"Request failed",type:"error"}),u}}async login(r,i){return this.request("/auth/login",{method:"POST",body:JSON.stringify({email:r,password:i})})}async register(r){return this.request("/auth/register",{method:"POST",body:JSON.stringify(r)})}async logout(){return this.request("/auth/logout",{method:"POST"})}async checkAuth(){try{return{valid:!0,user:await this.request("/auth/user")}}catch(r){return console.warn("Auth check failed:",r.message),{valid:!1,error:r.message}}}async getUser(){return this.request("/auth/user")}async updateProfile(r){return this.request("/auth/profile",{method:"PATCH",body:JSON.stringify(r)})}async completeSetup(r){return this.request("/auth/setup",{method:"POST",body:JSON.stringify(r)})}async forgotPassword(r){return this.request("/auth/forgot-password",{method:"POST",body:JSON.stringify({email:r})})}async resetPassword(r,i,o,c){return this.request("/auth/reset-password",{method:"POST",body:JSON.stringify({token:r,email:i,password:o,password_confirmation:c})})}async validateCompanyCode(r){return this.request("/auth/validate-company-code",{method:"POST",body:JSON.stringify({company_code:r})})}async getClients(r={}){const i=new URLSearchParams(r).toString();return this.request(`/clients${i?`?${i}`:""}`)}async getClient(r){return this.request(`/clients/${r}`)}async createClient(r){return this.request("/clients",{method:"POST",body:JSON.stringify(r)})}async updateClient(r,i){return this.request(`/clients/${r}`,{method:"PUT",body:JSON.stringify(i)})}async deleteClient(r){return this.request(`/clients/${r}`,{method:"DELETE"})}async sendClientInvitation(r,i){return this.request(`/clients/${r}/invite`,{method:"POST",body:JSON.stringify(i)})}async getClientInvitations(r){return this.request(`/clients/${r}/invitations`)}async cancelClientInvitation(r){return this.request(`/client-invitations/${r}`,{method:"DELETE"})}async getProjects(r={}){const i=new URLSearchParams(r).toString();return this.request(`/projects${i?`?${i}`:""}`)}async getProject(r){return this.request(`/projects/${r}`)}async createProject(r){return this.request("/projects",{method:"POST",body:JSON.stringify(r)})}async updateProject(r,i){return this.request(`/projects/${r}`,{method:"PUT",body:JSON.stringify(i)})}async deleteProject(r){return this.request(`/projects/${r}`,{method:"DELETE"})}async getTasks(r={}){const i=new URLSearchParams(r).toString();return this.request(`/tasks${i?`?${i}`:""}`)}async getTasksHierarchy(){return this.request("/tasks/hierarchy")}async getTask(r){return this.request(`/tasks/${r}`)}async createTask(r){return this.request("/tasks",{method:"POST",body:JSON.stringify(r)})}async updateTask(r,i){return this.request(`/tasks/${r}`,{method:"PUT",body:JSON.stringify(i)})}async deleteTask(r){return this.request(`/tasks/${r}`,{method:"DELETE"})}async toggleTask(r){return this.request(`/tasks/${r}/toggle`,{method:"PATCH"})}async getDocuments(r={}){const i=new URLSearchParams(r).toString();return this.request(`/documents${i?`?${i}`:""}`)}async getDocumentHierarchy(){return this.request("/documents/hierarchy")}async getDocument(r){return this.request(`/documents/${r}`)}async uploadDocument(r){const i=`${this.baseURL}
609/documents`,o={};this.token&&(o.Authorization=`Bearer ${this.token}`);const c=await fetch(i,{method:"POST",headers:o,body:r});if(!c.ok){const m=await c.json().catch(()=>({}));if(c.status===422&&m.errors){const u=Object.values(m.errors).flat().join(", ");throw new Error(`Validation failed: ${u}`)}throw new Error(m.message||`HTTP error! status: ${c.status}`)}return await c.json()}async updateDocument(r,i){return this.request(`/documents/${r}`,{method:"PUT",body:JSON.stringify(i)})}async deleteDocument(r){return this.request(`/documents/${r}`,{method:"DELETE"})}async getDocumentDownloadUrl(r){return this.request(`/documents/${r}/download`)}async getDocumentVersions(r){return this.request(`/documents/${r}/versions`)}async uploadDocumentVersion(r,i){const o=`${this.baseURL}/documents/${r}/versions`,c={};this.token&&(c.Authorization=`Bearer ${this.token}`);const m=await fetch(o,{method:"POST",headers:c,body:i});if(!m.ok){const u=await m.json().catch(()=>({}));throw new Error(u.message||`HTTP error! status: ${m.status}`)}return await m.json()}async downloadDocumentVersion(r,i){return this.request(`/documents/${r}/versions/${i}/download`)}async restoreDocumentVersion(r,i){return this.request(`/documents/${r}/versions/${i}/restore`,{method:"POST"})}async archiveDocumentVersion(r,i){return this.request(`/documents/${r}/versions/${i}/archive`,{method:"POST"})}async deleteDocumentVersion(r,i){return this.request(`/documents/${r}/versions/${i}`,{method:"DELETE"})}async getDocumentCollaborators(r){return this.request(`/documents/${r}/collaborators`)}async shareWithTeamMembers(r,i){return this.request(`/documents/${r}/share/team`,{method:"POST",body:JSON.stringify(i)})}async shareWithClient(r,i,o){return this.request(`/documents/${r}/share/client/${i}`,{method:"POST",body:JSON.stringify(o)})}async createPublicLink(r,i){return this.request(`/documents/${r}/share/link`,{method:"POST",body:JSON.stringify(i)})}async shareExternally(r,i){return this.request(`/documents/${r}/share/external`,{method:"POST",body:JSON.stringify(i)})}async updateDocumentPermissions(r,i,o){return this.request(`/documents/${r}/permissions/${i}`,{method:"PUT",body:JSON.stringify(o)})}async revokeDocumentAccess(r,i){return this.request(`/documents/${r}/permissions/${i}`,{method:"DELETE"})}async getDocumentSharingStats(r){return this.request(`/documents/${r}/sharing/stats`)}async getAvailablePermissions(){return this.request("/documents/permissions/available")}async bulkShareDocuments(r){return this.request("/documents/bulk-share",{method:"POST",body:JSON.stringify(r)})}async getInvoices(r={}){const i=new URLSearchParams(r).toString();return this.request(`/invoices${i?`?${i}`:""}`)}async getInvoice(r){return this.request(`/invoices/${r}`)}async createInvoice(r){return this.request("/invoices",{method:"POST",body:JSON.stringify(r)})}async updateInvoice(r,i){return this.request(`/invoices/${r}`,{method:"PUT",body:JSON.stringify(i)})}async deleteInvoice(r){return this.request(`/invoices/${r}`,{method:"DELETE"})}async getMessages(r={}){const i=new URLSearchParams(r).toString();return this.request(`/messages${i?`?${i}`:""}`)}async getMessage(r){return this.request(`/messages/${r}`)}async sendMessage(r){return this.request("/messages",{method:"POST",body:JSON.stringify(r)})}async updateMessage(r,i){return this.request(`/messages/${r}`,{method:"PUT",body:JSON.stringify(i)})}async deleteMessage(r){return this.request(`/messages/${r}`,{method:"DELETE"})}async getTeamMembers(r={}){const i=new URLSearchParams(r).toString();return this.request(`/team/members${i?`?${i}`:""}`)}async getMilestones(r,i={}){const o=new URLSearchParams(i).toString();return this.request(`/projects/${r}/milestones${o?`?${o}`:""}`)}async createMilestone(r,i){return this.request(`/projects/${r}/milestones`,{method:"POST",body:JSON.stringify(i)})}async updateMilestone(r,i){return this.request(`/milestones/${r}`,{method:"PUT",body:JSON.stringify(i)})}async deleteMilestone(r){return this.request(`/milestones/${r}`,{method:"DELETE"})}async toggleMilestoneCompletion(r){return this.request(`/milestones/${r}/toggle`,{method:"PATCH"})}async reorderMilestones(r,i){return this.request(`/projects/${r}/milestones/reorder`,{method:"PUT",body:JSON.stringify({milestone_ids:i})})}async getUsers(r={}){return this.request("/team/members")}async inviteTeamMember(r){return this.request("/team/invite",{method:"POST",body:JSON.stringify(r)})}
609async inviteColleague(r,i){return console.log("API: Inviting colleague",{companyId:r,inviteData:i,hasToken:!!this.token,token:this.token?.substring(0,10)+"..."}),this.request(`/invitations/companies/${r}/colleague`,{method:"POST",body:JSON.stringify(i)})}async updateTeamMember(r,i){return this.request(`/team/members/${r}`,{method:"PUT",body:JSON.stringify(i)})}async removeTeamMember(r){return this.request(`/team/members/${r}`,{method:"DELETE"})}async getTeamRoles(){return this.request("/team/roles")}async getTeamPermissions(){return this.request("/team/permissions")}async getActivities(r={}){const i=new URLSearchParams(r).toString();return this.request(`/activities${i?`?${i}`:""}`)}async getDashboardStats(){return this.request("/admin/dashboard/stats")}async getCompanyCodes(r={}){const i=new URLSearchParams(r).toString();return this.request(`/admin/company-codes${i?`?${i}`:""}`)}async generateCompanyCode(r){return this.request("/admin/company-codes",{method:"POST",body:JSON.stringify(r)})}async updateCompanyCode(r,i){return this.request(`/admin/company-codes/${r}`,{method:"PUT",body:JSON.stringify(i)})}async deleteCompanyCode(r){return this.request(`/admin/company-codes/${r}`,{method:"DELETE"})}async getAdminCompanies(r={}){const i=new URLSearchParams(r).toString();return this.request(`/admin/companies${i?`?${i}`:""}`)}async getAdminCompany(r){return this.request(`/admin/companies/${r}`)}async updateAdminCompany(r,i){return this.request(`/admin/companies/${r}`,{method:"PUT",body:JSON.stringify(i)})}async getAdminUsers(r={}){const i=new URLSearchParams(r).toString();return this.request(`/admin/users${i?`?${i}`:""}`)}async getNotifications(r={}){const i=new URLSearchParams(r).toString(),o=i?`/notifications?${i}`:"/notifications";return this.request(o)}async getUnreadNotificationCount(){return this.request("/notifications/unread-count")}async markNotificationAsRead(r){return this.request(`/notifications/${r}/read`,{method:"POST"})}async markNotificationAsUnread(r){return this.request(`/notifications/${r}/read`,{method:"DELETE"})}async markAllNotificationsAsRead(){return this.request("/notifications/mark-all-read",{method:"POST"})}async deleteNotification(r){return this.request(`/notifications/${r}`,{method:"DELETE"})}async deleteAllReadNotifications(){return this.request("/notifications/read",{method:"DELETE"})}async createTestNotification(){return this.request("/notifications/test",{method:"POST"})}}const ve=new OC,E0=f.createContext(),ir=[{id:1,email:"[email protected]",password:"password123",firstName:"John",lastName:"Doe",company:"Tech Solutions Inc",companyId:"comp_1",role:"Admin",avatar:null,isSetupComplete:!0,createdAt:"2024-01-15",settings:{notifications:!0,emailUpdates:!0,theme:"default"}},{id:2,email:"[email protected]",password:"demo123",firstName:"Sarah",lastName:"Johnson",company:"Design Studio Pro",companyId:"comp_2",role:"User",avatar:null,isSetupComplete:!1,createdAt:"2024-02-01",settings:{notifications:!0,emailUpdates:!1,theme:"default"}},{id:3,email:"[email protected]",password:"client123",firstName:"Mike",lastName:"Wilson",company:"Client Corp",companyId:"client_1",role:"Client",serviceProvider:"Tech Solutions Inc",serviceProviderId:"comp_1",avatar:null,isSetupComplete:!0,createdAt:"2024-01-20",settings:{notifications:!0,emailUpdates:!0,theme:"default"}},{id:4,email:"[email protected]",password:"client456",firstName:"Emma",lastName:"Davis",company:"Startup Venture LLC",companyId:"client_2",role:"Client",serviceProvider:"Tech Solutions Inc",serviceProviderId:"comp_1",avatar:null,isSetupComplete:!0,createdAt:"2024-02-05",settings:{notifications:!0,emailUpdates:!0,theme:"default"}},{id:5,email:"[email protected]",password:"creative789",firstName:"Alex",lastName:"Turner",company:"Creative House",companyId:"client_3",role:"Client",serviceProvider:"Design Studio Pro",serviceProviderId:"comp_2",avatar:null,isSetupComplete:!0,createdAt:"2024-02-10",settings:{notifications:!0,emailUpdates:!0,theme:"default"}}],PC=({children:a})=>{const[r,i]=f.useState(!1),[o,c]=f.useState(null),[m,u]=f.useState(!0),[g,x]=f.useState(!1),[p,y]=f.useState(!1);f.useEffect(()=>{(()=>{const V=localStorage.getItem("currentUser"),Z=localStorage.getItem("authToken");if(V&&Z)try{const I=Cn(JSON.parse(V));c(I),i(!0),ve.setToken(Z),!I.isSetupComplete&&I.role?.toLowerCase()!=="client"?x(!0):x(!1)}catch{localStorage.removeItem("currentUser"),localStorage.removeItem("authToken"),x(!1)}else x(!1);u(!1)})();const z=V=>{console.warn("🚨 Auth error detected, forcing logout:",V.detail),r&&!p&&C()};return window.addEventListener("auth-error",z),()=>{window.removeEventListener("auth-error",z)}},[r,p]);const v=async(H,z)=>{u(!0);try{const V=await ve.login(H,z);if(V.success&&V.data){const{user:Z,token:I}=V.data;return ve.setToken(I),c(Cn(Z)),i(!0),!Z.isSetupComplete&&Z.role?.toLowerCase()!=="client"&&x(!0),localStorage.setItem("currentUser",JSON.stringify(Z)),localStorage.setItem("authToken",I),u(!1),{success:!0,user:Z}}else return u(!1),{success:!1,error:V.message||"Login failed"}}catch(V){return u(!1),{success:!1,error:V.message||"Login failed"}}},w=async H=>{if(!H)return{valid:!1,error:"Company code is required"};try{const z=await ve.validateCompanyCode(H);return z.success&&z.data?{valid:!0,company:{name:z.data.company_name,description:z.data.description}}:{valid:!1,error:z.message||"Invalid company code"}}catch(z){return{valid:!1,error:z.message||"Failed to validate company code"}}},N=H=>{const z=H.split("@")[1],Z={"clientcorp.com":{id:"comp_1",name:"Tech Solutions Inc"},"startupventure.com":{id:"comp_1",name:"Tech Solutions Inc"},"creativehouse.com":{id:"comp_2",name:"Design Studio Pro"},"techclient.com":{id:"comp_1",name:"Tech Solutions Inc"},"designclient.com":{id:"comp_2",name:"Design Studio Pro"}}[z];return Z?{valid:!0,serviceProvider:Z}:{valid:!1,error:"This email domain is not associated with any of our service providers. Please contact your service provider to get authorized."}},D=async H=>{u(!0);try{const z=await ve.register({first_name:H.firstName,last_name:H.lastName,email:H.email,password:H.password,password_confirmation:H.confirmPassword,company_code:H.companyCode,phone:H.phone,terms_accepted:!0});if(z.success&&z.data){const{user:V,token:Z}=z.data;return ve.setToken(Z),c(Cn(V)),i(!0),V.role?.toLowerCase()!=="client"&&x(!0),localStorage.setItem("currentUser",JSON.stringify(V)),localStorage.setItem("authToken",Z),u(!1),{success:!0,user:V}}else return u(!1),{success:!1,error:z.message||"Registration failed"}}catch(z){return u(!1),{success:!1,error:z.message||"Registration failed"}}},b=async H=>{if(u(!0),await new Promise(P=>setTimeout(P,1e3)),ir.find(P=>P.email.toLowerCase()===H.email.toLowerCase()))return u(!1),{success:!1,error:"An account with this email already exists"};const V=N(H.email);if(!V.valid)return u(!1),{success:!1,error:V.error};const Z=V.serviceProvider,I={id:ir.length+1,email:H.email,firstName:H.firstName,lastName:H.lastName,company:H.company,companyId:`client_${ir.length+1}`,role:"Client",serviceProvider:Z.name,serviceProviderId:Z.id,avatar:null,isSetupComplete:!1,createdAt:new Date().toISOString().split("T")[0],settings:{notifications:!0,emailUpdates:!0,theme:"default"}};ir.push({...I,password:H.password});const{password:ue,...X}=I;return c(Cn(X)),i(!0),localStorage.setItem("currentUser",JSON.stringify(X)),localStorage.setItem("authToken","mock-jwt-token-"+I.id),u(!1),{success:!0,user:X}},E=async H=>(u(!0),await new Promise(z=>setTimeout(z,2e3)),u(!1),{success:!1,error:`${H} OAuth integration will be implemented with your backend API`}),_=async H=>{u(!0);try{const z=await ve.forgotPassword(H);return u(!1),z.success?{success:!0,message:z.message}:{success:!1,error:z.message||"Failed to send password reset email"}}catch(z){return u(!1),{success:!1,error:z.message||"Failed to send password reset email"}}},M=async(H,z,V,Z)=>{u(!0);try{const I=await ve.resetPassword(H,z,V,Z);return u(!1),I.success?{success:!0,message:I.message}:{success:!1,error:I.message||"Failed to reset password"}}catch(I){return u(!1),{success:!1,error:I.message||"Failed to reset password"}}},k=async H=>{if(!o)return{success:!1,error:"No user logged in"};u(!0);try{const z=await ve.completeSetup(H);if(z.success&&z.data){const V=z.data.user;return c(Cn(V)),x(!1),localStorage.setItem("currentUser",JSON.stringify(V)),u(!1),{success:!0,user:V}}else return u(!1),{success:!1,error:z.message||"Setup failed"}}catch(z){return u(!1),{success:!1,error:z.message||"Setup failed"}}},C=async()=>
609{if(!p){y(!0);try{ve.token&&await ve.logout()}catch{console.error("Logout API call failed:")}ve.setToken(null),c(null),i(!1),x(!1),y(!1),localStorage.removeItem("currentUser"),localStorage.removeItem("authToken")}},R={isAuthenticated:r,user:o,isLoading:m,showSetupWizard:g,login:v,register:D,logout:C,loginWithOAuth:E,requestPasswordReset:_,resetPassword:M,completeSetup:k,updateProfile:async H=>{if(!o)return{success:!1,error:"No user logged in"};u(!0),await new Promise(Z=>setTimeout(Z,500));const z={...o,...H};c(Cn(z)),localStorage.setItem("currentUser",JSON.stringify(z));const V=ir.findIndex(Z=>Z.id===o.id);return V!==-1&&(ir[V]={...ir[V],...H}),u(!1),{success:!0,user:z}},updateUser:H=>{c(Cn(H)),localStorage.setItem("currentUser",JSON.stringify(H))},refreshUser:async()=>{if(!r)return{success:!1,error:"Not authenticated"};try{const H=await ve.getUser();if(H.success&&H.data){const z=Cn(H.data);return c(z),localStorage.setItem("currentUser",JSON.stringify(H.data)),{success:!0,user:z}}else return{success:!1,error:H.message||"Failed to refresh user data"}}catch(H){return{success:!1,error:H.message||"Failed to refresh user data"}}},validateCompanyCode:w,setShowSetupWizard:x,registerClient:b,findServiceProviderByEmail:N};return e.jsx(E0.Provider,{value:R,children:a})};function Cn(a){return a&&(typeof a.is_company_admin>"u"&&(a.is_company_admin=a.role?.toLowerCase()==="admin"),typeof a.setup_completed<"u"?a.isSetupComplete=a.setup_completed:typeof a.isSetupComplete>"u"&&(a.isSetupComplete=a.role?.toLowerCase()==="admin"),a.isClient=a.role?.toLowerCase()==="client",a.isClient&&!a.client_id&&(a.client_id=a.id),a.first_name&&!a.firstName&&(a.firstName=a.first_name),a.last_name&&!a.lastName&&(a.lastName=a.last_name),a.company&&a.company.name&&!a.companyName&&(a.companyName=a.company.name),typeof a.is_novio_admin<"u"&&(a.isNovioAdmin=a.is_novio_admin),a)}const zC=a=>({isClient:()=>a?.role?.toLowerCase()==="client",isAdmin:()=>a?.role?.toLowerCase()==="admin",isUser:()=>a?.role?.toLowerCase()==="user",canAccessCompanyData:()=>a?.role?.toLowerCase()!=="client",getClientId:()=>a?.isClient?a.id:a?.client_id,getServiceProviderId:()=>a?.serviceProviderId||a?.company_id}),ts=()=>{const a=f.useContext(E0);if(!a)throw new Error("useAuth must be used within an AuthProvider");const r=a.user?zC(a.user):null;return{...a,userHelpers:r}},M0=f.createContext(),or={light:{primaryNavy:"#0A1F44",primaryMint:"#2DE1C2",neutralLight:"#DAD2D8",neutralDark:"#474448"},dark:{primaryNavy:"#1E3A5F",primaryMint:"#4AEDC4",neutralLight:"#050508",neutralDark:"#E5E5E5"}},gv=a=>({primaryNavy:vv(a.primaryNavy,20),primaryMint:vv(a.primaryMint,15),neutralLight:"#050508",neutralDark:"#E5E5E5"}),vv=(a,r)=>{const i=parseInt(a.replace("#",""),16),o=Math.round(2.55*r),c=(i>>16)+o,m=(i>>8&255)+o,u=(i&255)+o;return"#"+(16777216+(c<255?c<1?0:c:255)*65536+(m<255?m<1?0:m:255)*256+(u<255?u<1?0:u:255)).toString(16).slice(1)},mc=a=>
609{if(!a)return"0 0% 0%";let r=0,i=0,o=0;const c=a.replace("#","");c.length===3?(r=parseInt(c[0]+c[0],16),i=parseInt(c[1]+c[1],16),o=parseInt(c[2]+c[2],16)):(r=parseInt(c.substring(0,2),16),i=parseInt(c.substring(2,4),16),o=parseInt(c.substring(4,6),16)),r/=255,i/=255,o/=255;const m=Math.max(r,i,o),u=Math.min(r,i,o);let g,x,p=(m+u)/2;if(m===u)g=x=0;else{const N=m-u;switch(x=p>.5?N/(2-m-u):N/(m+u),m){case r:g=(i-o)/N+(i<o?6:0);break;case i:g=(o-r)/N+2;break;case o:g=(r-i)/N+4;break}g/=6}const y=Math.round(g*360),v=Math.round(x*100),w=Math.round(p*100);return`${y} ${v}% ${w}%`};function LC({children:a}){const[r,i]=f.useState(or),[o,c]=f.useState(!1);f.useEffect(()=>{const D=localStorage.getItem("userColorScheme"),b=localStorage.getItem("darkMode");if(D)try{const E=JSON.parse(D);if(E.primaryNavy&&!E.light){const _={light:E,dark:gv(E)};i(_)}else E.light&&E.dark?i(E):(console.warn("Invalid saved theme format, using defaults"),i(or))}catch{i(or)}if(b){const E=JSON.parse(b);c(E),m(E)}r&&(r.light||r.primaryNavy)&&u(r,o)},[]),f.useEffect(()=>{r&&(r.light||r.primaryNavy)&&u(r,o),m(o)},[r,o]);const m=D=>{D?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},u=(D,b=!1)=>{if(!D||!D.light&&!D.primaryNavy){console.warn("Invalid color scheme provided to applyColorsToCSS");return}let E;D.light&&D.dark?E=b?D.dark:D.light:E=D,(!E||!E.primaryNavy)&&(E=or.light),document.documentElement.style.setProperty("--color-primary-navy",E.primaryNavy),document.documentElement.style.setProperty("--color-primary-mint",E.primaryMint),document.documentElement.style.setProperty("--color-neutral-light",E.neutralLight),document.documentElement.style.setProperty("--color-neutral-dark",E.neutralDark);const _=mc(E.primaryNavy),M=mc(E.primaryMint),k=mc(E.neutralLight),C=mc(E.neutralDark);document.documentElement.style.setProperty("--primary",_),document.documentElement.style.setProperty("--primary-foreground",C),document.documentElement.style.setProperty("--secondary",M),document.documentElement.style.setProperty("--secondary-foreground",_),document.documentElement.style.setProperty("--background",k),document.documentElement.style.setProperty("--foreground",C),document.documentElement.style.setProperty("--card",k),document.documentElement.style.setProperty("--card-foreground",C),document.documentElement.style.setProperty("--popover",k),document.documentElement.style.setProperty("--popover-foreground",C),document.documentElement.style.setProperty("--muted",k),document.documentElement.style.setProperty("--muted-foreground",C),document.documentElement.style.setProperty("--accent",k),document.documentElement.style.setProperty("--accent-foreground",C),document.documentElement.style.setProperty("--border",k),document.documentElement.style.setProperty("--input",k),document.documentElement.style.setProperty("--ring",M)},g=(D,b=null)=>{let E={...r};if(b==="light")E.light=D;else if(b==="dark")E.dark=D;else{const _=o?"dark":"light";E[_]=D}i(E),localStorage.setItem("userColorScheme",JSON.stringify(E))},x=(D,b=null)=>{const E={light:D,dark:b||gv(D)};i(E),localStorage.setItem("userColorScheme",JSON.stringify(E))},p=()=>{const D=!o;c(D),localStorage.setItem("darkMode",JSON.stringify(D))},y=D=>{c(D),localStorage.setItem("darkMode",JSON.stringify(D))},v=()=>{i(or),c(!1),localStorage.removeItem("userColorScheme"),localStorage.removeItem("darkMode")},N={colors:r,isDarkMode:o,currentColors:!r||!r.light||!r.dark?or.light:o?r.dark:r.light,updateTheme:g,updateFullColorScheme:x,toggleDarkMode:p,setDarkMode:y,resetTheme:v,defaultColors:or};return e.jsx(M0.Provider,{value:N,children:a})}function Mf(){const a=f.useContext(M0);if(!a)throw new Error("useTheme must be used within a ThemeProvider");return a}function UC({activeItem:a,onNavigate:r,isCollapsed:i,onToggleCollapse:o}){const[c,m]=f.useState(!1),[u,g]=f.useState(!1),[x,p]=f.useState(!1),[y,v]=f.useState(!1),[w,N]=f.useState({x:0,y:0}),{user:D,logout:b}=ts(),{isDarkMode:E,toggleDarkMode:_}=Mf(),M=[{title:"Dashboard",href:"/dashboard",icon:Fc,current:a==="Dashboard"},{title:"Clients",href:"/clients",icon:yt,current:a==="Clients"},{title:"Projects",href:"/projects",icon:Va,current:a==="Projects"},{title:"Tasks",href:"/tasks",icon:Dn,current:a==="Tasks"},{title:"Team",href:"/team",icon:Xm,current:a==="Team",adminOnly:!0},{title:"Documents",href:"/documents",icon:Ot,current:a==="Documents"}
609,{title:"Messages",href:"/messages",icon:Fa,current:a==="Messages"},{title:"Invoicing",href:"/invoicing",icon:_n,current:a==="Invoicing"},{title:"Novio Admin",href:"/admin",icon:Ic,current:a==="Admin",novioAdminOnly:!0}],k=[{title:"Profile",href:"/settings/profile",icon:nt,current:a==="Profile"},{title:"Company",href:"/settings/company",icon:Js,current:a==="Company",adminOnly:!0},{title:"Theme",href:"/settings/theme",icon:zi,current:a==="Theme"},{title:"Security",href:"/settings/security",icon:Ga,current:a==="Security"}],C=O=>{O.href==="/admin"?(window.history.pushState(null,"","/admin"),window.dispatchEvent(new PopStateEvent("popstate"))):r(O.href,O.title),g(!1)},j=()=>{g(!1)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"lg:hidden fixed top-0 left-0 right-0 h-16 z-40 flex items-center justify-between px-4 bg-card/80 backdrop-blur-xl border-b border-border/30",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-xl p-1.5 shadow-lg bg-gradient-to-br from-[hsl(var(--primary))] to-[hsl(var(--secondary))] border border-border/20",children:e.jsx("img",{src:"/Novio_logo.png",alt:"Novio",className:"w-full h-full object-contain"})}),e.jsx("span",{className:"text-xl font-bold bg-gradient-to-r from-[hsl(var(--primary))] to-[hsl(var(--secondary))] bg-clip-text text-transparent",children:"Novio"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(G,{variant:"ghost",size:"sm",onClick:_,className:"h-9 w-9 p-0 bg-card/60 hover:bg-card/80 backdrop-blur-sm border border-border/30 rounded-xl",title:E?"Switch to Light Mode":"Switch to Dark Mode",children:E?e.jsx(mr,{className:"h-4 w-4 text-amber-500"}):e.jsx(ur,{className:"h-4 w-4 text-primary"})}),e.jsx(G,{variant:"ghost",size:"sm",className:"h-9 w-9 p-0 bg-card/60 hover:bg-card/80 backdrop-blur-sm border border-border/30 rounded-xl",onClick:()=>g(!u),children:e.jsx(c0,{className:"h-5 w-5 text-primary"})})]})]}),u&&e.jsxs("div",{className:"lg:hidden fixed inset-0 z-50 bg-background backdrop-blur-xl flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between h-16 px-4 bg-white/40 dark:bg-black/60 backdrop-blur-xl border-b border-gray-200/30 dark:border-zinc-800/40 flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-xl p-1.5 shadow-lg bg-gradient-to-br from-[hsl(var(--primary))] to-[hsl(var(--secondary))] border border-border/20",children:e.jsx("img",{src:"/Novio_logo.png",alt:"Novio",className:"w-full h-full object-contain"})}),e.jsx("span",{className:"text-xl font-bold bg-gradient-to-r from-[hsl(var(--primary))] to-[hsl(var(--secondary))] bg-clip-text text-transparent",children:"Novio"})]}),e.jsx(G,{variant:"ghost",size:"sm",onClick:j,className:"h-9 w-9 p-0 bg-card/60 hover:bg-card/80 backdrop-blur-sm border border-border/30 rounded-xl",children:e.jsx(gs,{className:"h-5 w-5 text-primary"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto overscroll-contain",children:e.jsxs("div",{className:"p-6 min-h-full",children:[e.jsx("div",{className:"mb-8",children:e.jsxs("div",{className:"flex items-center space-x-4 p-4 rounded-2xl bg-card/50 backdrop-blur-sm border border-border/30 shadow-lg",children:[e.jsx("div",{className:"w-12 h-12 rounded-2xl flex items-center justify-center shadow-lg bg-gradient-to-br from-[hsl(var(--primary))] to-[hsl(var(--secondary))] border border-white/20",children:e.jsxs("span",{className:"text-white font-semibold text-lg",children:[D?.firstName?.[0],D?.lastName?.[0]]})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("p",{className:"font-medium text-foreground",children:[D?.firstName," ",D?.lastName]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:D?.jobTitle||D?.role||"User"})]}),e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(G,{variant:"ghost",size:"sm",className:"p-1 h-auto bg-card/60 hover:bg-card/80 backdrop-blur-sm border border-border/30 rounded-lg transition-all duration-300",onClick:()=>p(!x),children:e.jsx(va,{className:"h-4 w-4 text-muted-foreground"})}),x&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[999998]",onClick:()=>p(!1)}),e.jsx("div",{className:"absolute right-0 top-full mt-2 w-48 bg-card/95 rounded-2xl shadow-xl border border-border/30 backdrop-blur-xl z-[999999]",children:e.jsxs("div",{className:"p-2",children:[e.jsxs("button",{onClick:()=>{p(!1),C({href:"/settings/profile",title:"Profile"})},className:"w-full flex items-center px-3 py-2 text-sm text-foreground hover:bg-accent rounded-xl transition-colors",children:[e.jsx(nt,{className:"h-4 w-4 mr-3 text-primary"}),"My Profile"]}),e.jsxs("button",{onClick:()=>{p(!1),C({href:"/settings/notifications",title:"Notifications"})},className:"w-full flex items-center px-3 py-2 text-sm text-foreground hover:bg-accent rounded-xl transition-colors",children:[e.jsx(Hm,{className:"h-4 w-4 mr-3 text-primary"}),"Notifications"]}),e.jsx("div",{className:"border-t border-border/30 my-1"}),e.jsxs("button",{onClick:()=>{p(!1),b()},className:"w-full flex items-center px-3 py-2 text-sm text-red-600 hover:bg-red-50 rounded-xl transition-colors",children:[e.jsx(vl,{className:"h-4 w-4 mr-3"}),"Sign Out"]})]})})]})]})})]})}),e.jsx("nav",{className:"space-y-3 mb-8",children:M.filter(O=>!(O.adminOnly&&!D?.is_company_admin||O.novioAdminOnly&&!(D?.isNovioAdmin||D?.is_novio_admin))).map(O=>{const L=O.icon;return e.jsxs("button",{onClick:()=>C(O),className:`
610                      group relative overflow-hidden w-full flex items-center px-4 py-4 rounded-2xl transition-all duration-300
611                      ${O.current?"bg-gradient-to-r from-[hsl(var(--primary))] to-[hsl(var(--secondary))] text-primary-foreground shadow-lg scale-[1.02]":"bg-card/60 text-foreground hover:bg-card/80 hover:shadow-lg hover:scale-[1.01]"}
612                      backdrop-blur-sm border border-border/30
613                    `,children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-foreground
613/10 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"}),e.jsxs("div",{className:"flex items-center space-x-3 relative z-10",children:[e.jsx(L,{className:`h-5 w-5 ${O.current?"text-primary-foreground":"text-primary"}`}),e.jsx("span",{className:"font-medium",children:O.title})]})]},O.title)})}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-600 dark:text-slate-400 uppercase tracking-wider mb-3",children:"Settings"}),e.jsx("div",{className:"space-y-3",children:k.filter(O=>!(O.title==="Profile"||O.adminOnly&&!D?.is_company_admin||O.novioAdminOnly&&!(D?.isNovioAdmin||D?.is_novio_admin))).map(O=>{const L=O.icon;return e.jsxs("button",{onClick:()=>C(O),className:`
614                        group relative overflow-hidden w-full flex items-center space-x-3 px-4 py-3 rounded-2xl transition-all duration-300
615                        ${O.current?"bg-gradient-to-r from-[hsl(var(--primary))] to-[hsl(var(--secondary))] text-white shadow-lg shadow-primary/25 scale-[1.02]":"bg-white/60 dark:bg-zinc-950/70 text-gray-700 dark:text-zinc-50 hover:bg-white/80 dark:hover:bg-zinc-900/80 hover:shadow-lg hover:scale-[1.01]"}
616                        backdrop-blur-sm border border-gray-200/30 dark:border-zinc-800/50
617                      `,children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/10 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"}),e.jsx(L,{className:`h-5 w-5 relative z-10 ${O.current?"text-white":"text-primary"}`}),e.jsx("span",{className:"font-medium relative z-10",children:O.title})]},O.title)})})]}),e.jsxs("div",{className:"mt-8 pt-6 border-t border-gray-200/30 dark:border-slate-700/30 text-center",children:[e.jsx("p",{className:"text-xs text-gray-600 dark:text-slate-400",children:"© 2024 Novio"}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-500 mt-1",children:"v1.0.0"})]})]})})]}),e.jsxs("div",{className:`
618          hidden lg:block fixed inset-y-0 left-0 z-[9990] overflow-hidden transition-all duration-500
619          ${i?"w-20":"w-72"}
620        `,children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-white/70 via-white/60 to-white/80 dark:from-black/90 dark:via-zinc-950/85 dark:to-black/95 backdrop-blur-2xl"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-primary/5 to-secondary/5"}),e.jsxs("div",{className:"absolute inset-0 opacity-20 pointer-events-none overflow-hidden",children:[e.jsx("div",{className:"absolute top-1/4 left-1/4 w-32 h-32 bg-gradient-to-r from-primary/20 to-secondary/20 rounded-full blur-3xl animate-float-slow"}),e.jsx("div",{className:"absolute bottom-1/3 right-1/4 w-24 h-24 bg-gradient-to-r from-secondary/15 to-primary/15 rounded-full blur-2xl animate-float-medium delay-1000"}),e.jsx("div",{className:"absolute top-1/2 left-1/2 w-16 h-16 bg-gradient-to-r from-primary/10 to-secondary/10 rounded-full blur-xl animate-float-fast delay-2000"})]}),e.jsxs("div",{className:"relative flex flex-col h-full border-r border-gray-200/20 dark:border-zinc-800/40 shadow-2xl shadow-primary/5",children:[e.jsx("div",{className:"flex items-center justify-center h-16 px-4 bg-white/30 dark:bg-black/40 backdrop-blur-sm border-b border-gray-200/20 dark:border-zinc-800/40",children:i?e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[e.jsx(G,{variant:"ghost",size:"sm",onClick:o,className:"h-8 w-8 p-0 bg-white/60 dark:bg-zinc-950/70 hover:bg-white/80 dark:hover:bg-zinc-900/80 backdrop-blur-sm border border-gray-200/30 dark:border-zinc-800/50 rounded-xl transition-all duration-300",title:"Expand Sidebar",children:e.jsx(RS,{className:"h-4 w-4 text-primary"})}),e.jsx(G,{variant:"ghost",size:"sm",onClick:_,className:"h-6 w-6 p-0 bg-white/60 dark:bg-zinc-950/70 hover:bg-white/80 dark:hover:bg-zinc-900/80 backdrop-blur-sm border border-gray-200/30 dark:border-zinc-800/50 rounded-lg transition-all duration-300",title:E?"Switch to Light Mode":"Switch to Dark Mode",children:E?e.
620jsx(mr,{className:"h-3 w-3 text-amber-500"}):e.jsx(ur,{className:"h-3 w-3 text-primary"})})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center space-x-3 flex-1",children:[e.jsx("div",{className:"w-10 h-10 rounded-2xl p-1.5 shadow-lg bg-gradient-to-br from-[hsl(var(--primary))] to-[hsl(var(--secondary))] border border-white/20",children:e.jsx("img",{src:"/Novio_logo.png",alt:"Novio",className:"w-full h-full object-contain"})}),e.jsx("span",{className:"text-xl font-bold bg-gradient-to-r from-[hsl(var(--primary))] to-[hsl(var(--secondary))] bg-clip-text text-transparent whitespace-nowrap",children:"Novio"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(G,{variant:"ghost",size:"sm",onClick:_,className:"h-8 w-8 p-0 bg-white/60 dark:bg-zinc-950/70 hover:bg-white/80 dark:hover:bg-zinc-900/80 backdrop-blur-sm border border-gray-200/30 dark:border-zinc-800/50 rounded-xl transition-all duration-300",title:E?"Switch to Light Mode":"Switch to Dark Mode",children:E?e.jsx(mr,{className:"h-4 w-4 text-amber-500"}):e.jsx(ur,{className:"h-4 w-4 text-primary"})}),e.jsx(G,{variant:"ghost",size:"sm",onClick:o,className:"h-8 w-8 p-0 bg-white/60 dark:bg-zinc-950/70 hover:bg-white/80 dark:hover:bg-zinc-900/80 backdrop-blur-sm border border-gray-200/30 dark:border-zinc-800/50 rounded-xl transition-all duration-300",title:"Collapse Sidebar",children:e.jsx(TS,{className:"h-4 w-4 text-primary"})})]})]})}),!i&&e.jsx("div",{className:"p-4",children:e.jsxs("div",{className:"flex items-center space-x-3 p-4 rounded-2xl bg-white/40 dark:bg-zinc-950/60 backdrop-blur-sm border border-gray-200/30 dark:border-zinc-800/50 shadow-lg group hover:bg-white/60 dark:hover:bg-zinc-900/70 transition-all duration-300",children:[e.jsx("div",{className:"w-12 h-12 rounded-2xl flex items-center justify-center shadow-lg bg-gradient-to-br from-[hsl(var(--primary))] to-[hsl(var(--secondary))] border border-white/20 group-hover:scale-110 transition-transform duration-300",children:e.jsxs("span",{className:"text-white font-semibold text-lg",children:[D?.firstName?.[0],D?.lastName?.[0]]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-sm font-medium text-gray-800 dark:text-slate-200 truncate",children:[D?.firstName," ",D?.lastName]}),e.jsx("p",{className:"text-xs text-gray-600 dark:text-slate-400 truncate",children:D?.jobTitle||D?.role||"User"})]}),e.jsx("div",{className:"relative",children:e.jsx(G,{variant:"ghost",size:"sm",className:"p-1 h-auto bg-white/60 dark:bg-zinc-950/70 hover:bg-white/80 dark:hover:bg-zinc-900/80 backdrop-blur-sm border border-gray-200/30 dark:border-zinc-800/50 rounded-lg transition-all duration-300",onClick:O=>{if(window.innerWidth>=1024){const R=O.currentTarget.getBoundingClientRect();N({x:R.right,y:R.bottom+8}),v(!0),p(!0)}else v(!1),p(!x)},children:e.jsx(va,{className:"h-4 w-4 text-gray-600 dark:text-slate-400"})})})]})}),i&&e.jsx("div",{className:"flex justify-center py-4",children:e.jsx("div",{className:"w-10 h-10 rounded-2xl flex items-center justify-center shadow-lg bg-gradient-to-br from-[hsl(var(--primary))] to-[hsl(var(--secondary))] border border-white/20 hover:scale-110 transition-transform duration-300",children:e.jsxs("span",{className:"text-white font-semibold text-sm",children:[D?.firstName?.[0],D?.lastName?.[0]]})})}),e.jsxs("nav",{className:"flex-1 px-3 pb-4 overflow-y-auto",children:[M.filter(O=>!(O.adminOnly&&!D?.is_company_admin||O.novioAdminOnly&&!(D?.isNovioAdmin||D?.is_novio_admin))).map(O=>{const L=O.icon;return e.jsxs("div",{className:"relative group mb-2",children:[e.jsxs("button",{onClick:()=>C(O),type:"button",className:`
621                      group w-full flex items-center rounded-2xl transition-all duration-300 cursor-pointer relative overflow-hidden
622                      ${O.current?"bg-gradient-to-r from-[hsl(var(--primary))] to-[hsl(var(--secondary))] text-white shadow-lg shadow-primary/25 scale-[1.02]":"bg-white/50 dark:bg-zinc-950/65 text-gray-700 dark:text-zinc-50 hover:bg-white/70 dark:hover:bg-zinc-900/75 hover:shadow-lg hover:scale-[1.01]"}
623                      backdrop-blur-sm border border-gray-200/30 dark:border-zinc-800/50
624                      ${i?"justify-center p-3 h-12":"px-4 py-3"}
625                    `,title:i?O.title:"",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/10 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"}),e.jsxs("div",{className:`flex items-center relative z-10 ${i?"justify-center":"space-x-3"}`,children:[e.jsx(L,{className:`h-5 w-5 flex-shrink-0 ${O.current?"text-white":"text-primary"}`}),!i&&e.jsx("span",{className:"font-medium text-sm",children:O.title})]})]}),i&&e.jsx("div",{className:"absolute left-full ml-3 px-3 py-2 bg-white/90 dark:bg-black/90 text-gray-700 dark:text-zinc-50 text-sm rounded-xl shadow-xl border border-gray-200/30 dark:border-zinc-800/50 backdrop-blur-sm op
625acity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none z-50 whitespace-nowrap top-1/2 -translate-y-1/2",children:O.title})]},O.title)}),!i&&e.jsx(qa,{className:"my-6 bg-gray-200/30 dark:bg-zinc-800/50"}),i?e.jsxs("div",{className:"relative group",children:[e.jsx("button",{onClick:()=>r("/settings/theme","Theme"),className:"w-full flex items-center justify-center p-3 h-12 text-gray-700 dark:text-zinc-50 hover:bg-white/50 dark:hover:bg-slate-700/50 rounded-2xl transition-all duration-300 cursor-pointer backdrop-blur-sm border border-gray-200/30 dark:border-zinc-800/50",title:"Settings",children:e.jsx(Ym,{className:"h-5 w-5 text-primary"})}),e.jsx("div",{className:"absolute left-full ml-3 px-3 py-2 bg-white/90 dark:bg-black/90 text-gray-700 dark:text-zinc-50 text-sm rounded-xl shadow-xl border border-gray-200/30 dark:border-zinc-800/50 backdrop-blur-sm opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none z-50 whitespace-nowrap top-1/2 -translate-y-1/2",children:"Settings"})]}):e.jsxs(MC,{open:c,onOpenChange:m,children:[e.jsx(TC,{asChild:!0,children:e.jsxs("button",{type:"button",className:"w-full flex items-center justify-between px-4 py-3 text-sm font-medium text-gray-700 dark:text-zinc-50 hover:bg-white/50 dark:hover:bg-slate-700/50 rounded-2xl transition-all duration-300 cursor-pointer backdrop-blur-sm border border-gray-200/30 dark:border-zinc-800/50",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(Ym,{className:"h-5 w-5 text-primary"}),e.jsx("span",{children:"Settings"})]}),c?e.jsx(Ln,{className:"h-4 w-4 text-primary"}):e.jsx(jr,{className:"h-4 w-4 text-primary"})]})}),e.jsx(AC,{className:"space-y-2 mt-2",children:k.filter(O=>!(O.title==="Profile"||O.adminOnly&&!D?.is_company_admin||O.novioAdminOnly&&!(D?.isNovioAdmin||D?.is_novio_admin))).map(O=>{const L=O.icon;return e.jsxs("button",{onClick:()=>C(O),type:"button",className:`
626                          group relative overflow-hidden w-full flex items-center px-6 py-2 text-sm font-medium rounded-xl ml-4 cursor-pointer transition-all duration-300
627                          ${O.current?"bg-gradient-to-r from-[hsl(var(--primary))] to-[hsl(var(--secondary))] text-white shadow-lg shadow-primary/25 scale-[1.02]":"text-gray-600 dark:text-slate-400 hover:bg-white/50 dark:hover:bg-slate-700/50 hover:shadow-md hover:scale-[1.01]"}
628                          backdrop-blur-sm border border-gray-200/30 dark:border-zinc-800/50
629                        `,children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/10 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"}),e.jsx(L,{className:`h-4 w-4 mr-3 relative z-10 ${O.current?"text-white":"text-primary"}`}),e.jsx("span",{className:"relative z-10",children:O.title})]},O.title)})})]})]}),!i&&e.jsx("div",{className:"p-4 bg-white/20 dark:bg-black/30 backdrop-blur-sm border-t border-gray-200/20 dark:border-zinc-800/40",children:e.jsxs("div",{className:"text-xs text-gray-600 dark:text-slate-400 text-center",children:[e.jsx("p",{children:"© 2024 Novio"}),e.jsx("p",{className:"mt-1",children:"v1.0.0"})]})})]})]}),x&&y&&yr.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[2147483646]",onClick:()=>p(!1)}),e.jsx("div",{className:"fixed z-[2147483647] w-48 bg-white/95 dark:bg-black/95 rounded-2xl shadow-xl border border-gray-200/30 dark:border-zinc-800/50 backdrop-blur-xl",style:{left:Math.max(8,w.x-192)+"px",top:Math.max(8,w.y)+"px"},children:e.jsxs("div",{className:"p-2",children:[e.jsxs("button",{onClick:()=>{p(!1),r("/settings/profile","Profile")},className:"w-full flex items-center px-3 py-2 text-sm text-foreground hover:bg-accent rounded-xl transition-colors",children:[e.jsx(nt,{className:"h-4 w-4 mr-3 text-primary"}),"My Profile"]}),e.jsxs("button",{onClick:()=>{p(!1),r("/settings/notifications","Notifications")},className:"w-full flex items-center px-3 py-2 text-sm text-foreground hover:bg-accent rounded-xl transition-colors",children:[e.jsx(Hm,{className:"h-4 w-4 mr-3 text-primary"}),"Notifications"]}),e.jsx("div",{className:"border-t border-gray-200/30 dark:border-zinc-800/50 my-1"}),e.jsxs("button",{onClick:()=>{p(!1),b()},className:"w-full flex items-center px-3 py-2 text-sm text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-xl transition-colors",children:[e.jsx(vl,{className:"h-4 w-4 mr-3"}),"Sign Out"]})]})})]}),document.body)]})}function Hc(){return(Hc=Object.assign||function(a){for(var r=1;r<arguments.length;r++){var i=arguments[r];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(a[o]=i[o])}return a}).apply(this,arguments)}function T0(a,r){if(a==null)return{};var i,o,c={},m=Object.keys(a);for(o=0;o<m.length;o++)r.indexOf(i=m[o])>=0||(c[i]=a[i]);return c}function Jm(a){var r=f.useRef(a),i=f.useRef(function(o){r.current&&r.current(o)});return r.current=a,i.current}var Li=function(a,r,i){return r===void 0&&(r=0),i===void 0&&(i=1),a>i?i:a<r?r:a},Pi=function(a){return"touches"in a},Wm=function(a){return a&&a.ownerDocument.defaultView||self},yv=function(a,r,i){var o=a.getBoundingClientRect(),c=Pi(r)?function(m,u){for(var g=0;g<m.length;g++)if(m[g].identifier===u)return m[g];return m[0]}(r.touches,i):r;return{left:Li((c.pageX-(o.left+Wm(a).pageXOffset))/o.width),top:Li((c.pageY-(o.top+Wm(a).pageYOffset))/o.height)}},bv=function(a){!Pi(a)&&a.preventDefault()},A0=wt.memo(function(a){var r=a.onMove,i=a.onKey,o=T0(a,["onMove","onKey"]),c=f.useRef(null),m=Jm(r),u=Jm(i),g=f.useRef(null),x=f.useRef(!1),p=f.useMemo(function(){var N=function(E){bv
629(E),(Pi(E)?E.touches.length>0:E.buttons>0)&&c.current?m(yv(c.current,E,g.current)):b(!1)},D=function(){return b(!1)};function b(E){var _=x.current,M=Wm(c.current),k=E?M.addEventListener:M.removeEventListener;k(_?"touchmove":"mousemove",N),k(_?"touchend":"mouseup",D)}return[function(E){var _=E.nativeEvent,M=c.current;if(M&&(bv(_),!function(C,j){return j&&!Pi(C)}(_,x.current)&&M)){if(Pi(_)){x.current=!0;var k=_.changedTouches||[];k.length&&(g.current=k[0].identifier)}M.focus(),m(yv(M,_,g.current)),b(!0)}},function(E){var _=E.which||E.keyCode;_<37||_>40||(E.preventDefault(),u({left:_===39?.05:_===37?-.05:0,top:_===40?.05:_===38?-.05:0}))},b]},[u,m]),y=p[0],v=p[1],w=p[2];return f.useEffect(function(){return w},[w]),wt.createElement("div",Hc({},o,{onTouchStart:y,onMouseDown:y,className:"react-colorful__interactive",ref:c,onKeyDown:v,tabIndex:0,role:"slider"}))}),Tf=function(a){return a.filter(Boolean).join(" ")},R0=function(a){var r=a.color,i=a.left,o=a.top,c=o===void 0?.5:o,m=Tf(["react-colorful__pointer",a.className]);return wt.createElement("div",{className:m,style:{top:100*c+"%",left:100*i+"%"}},wt.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:r}}))},Wt=function(a,r,i){return r===void 0&&(r=0),i===void 0&&(i=Math.pow(10,r)),Math.round(i*a)/i},$C=function(a){return HC(ef(a))},ef=function(a){return a[0]==="#"&&(a=a.substring(1)),a.length<6?{r:parseInt(a[0]+a[0],16),g:parseInt(a[1]+a[1],16),b:parseInt(a[2]+a[2],16),a:a.length===4?Wt(parseInt(a[3]+a[3],16)/255,2):1}:{r:parseInt(a.substring(0,2),16),g:parseInt(a.substring(2,4),16),b:parseInt(a.substring(4,6),16),a:a.length===8?Wt(parseInt(a.substring(6,8),16)/255,2):1}},IC=function(a){return qC(BC(a))},FC=function(a){var r=a.s,i=a.v,o=a.a,c=(200-r)*i/100;return{h:Wt(a.h),s:Wt(c>0&&c<200?r*i/100/(c<=100?c:200-c)*100:0),l:Wt(c/2),a:Wt(o,2)}},tf=function(a){var r=FC(a);return"hsl("+r.h+", "+r.s+"%, "+r.l+"%)"},BC=function(a){var r=a.h,i=a.s,o=a.v,c=a.a;r=r/360*6,i/=100,o/=100;var m=Math.floor(r),u=o*(1-i),g=o*(1-(r-m)*i),x=o*(1-(1-r+m)*i),p=m%6;return{r:Wt(255*[o,g,u,u,x,o][p]),g:Wt(255*[x,o,o,g,u,u][p]),b:Wt(255*[u,u,x,o,o,g][p]),a:Wt(c,2)}},fc=function(a){var r=a.toString(16);return r.length<2?"0"+r:r},qC=function(a){var r=a.r,i=a.g,o=a.b,c=a.a,m=c<1?fc(Wt(255*c)):"";return"#"+fc(r)+fc(i)+fc(o)+m},HC=function(a){var r=a.r,i=a.g,o=a.b,c=a.a,m=Math.max(r,i,o),u=m-Math.min(r,i,o),g=u?m===r?(i-o)/u:m===i?2+(o-r)/u:4+(r-i)/u:0;return{h:Wt(60*(g<0?g+6:g)),s:Wt(m?u/m*100:0),v:Wt(m/255*100),a:c}},VC=wt.memo(function(a){var r=a.hue,i=a.onChange,o=Tf(["react-colorful__hue",a.className]);return wt.createElement("div",{className:o},wt.createElement(A0,{onMove:function(c){i({h:360*c.left})},onKey:function(c){i({h:Li(r+360*c.left,0,360)})},"aria-label":"Hue","aria-valuenow":Wt(r),"aria-valuemax":"360","aria-valuemin":"0"},wt.createElement(R0,{className:"react-colorful__hue-pointer",left:r/360,color:tf({h:r,s:100,v:100,a:1})})))}),GC=wt.memo(function(a){var r=a.hsva,i=a.onChange,o={backgroundColor:tf({h:r.h,s:100,v:100,a:1})};return wt.createElement("div",{className:"react-colorful__saturation",style:o},wt.createElement(A0,{onMove:function(c){i({s:100*c.left,v:100-100*c.top})},onKey:function(c){i({s:Li(r.s+100*c.left,0,100),v:Li(r.v-100*c.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Wt(r.s)+"%, Brightness "+Wt(r.v)+"%"},wt.createElement(R0,{className:"react-colorful__saturation-pointer",top:1-r.v/100,left:r.s/100,color:tf(r)})))}),O0=function(a,r){if(a===r)return!0;for(var i in a)if(a[i]!==r[i])return!1;return!0},YC=function(a,r){return a.toLowerCase()===r.toLowerCase()||O0(ef(a),ef(r))};function XC(a,r,i){var o=Jm(i),c=f.useState(function(){return a.toHsva(r)}),m=c[0],u=c[1],g=f.useRef({color:r,hsva:m});f.useEffect(function(){if(!a.equal(r,g.current.color)){var p=a.toHsva(r);g.current={hsva:p,color:r},u(p)}},[r,a]),f.useEffect(function(){var p;O0(m,g.current.hsva)||a.equal(p=a.fromHsva(m),g.current.color)||(g.current={hsva:m,color:p},o(p))},[m,a,o]);var x=f.useCallback(function(p){u(function(y){return Object.assign({},y,p)})},[]);return[m,x]}var KC=typeof window<"u"?f.useLayoutEffect:f.useEffect,ZC=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},jv=new Map,QC=function(a){KC(function(){var r=a.current?a.current.ownerDocument:document;if(r!==void 0&&!jv.has(r)){var i=r.createElement("style");i.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;
629width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,jv.set(r,i);var o=ZC();o&&i.setAttribute("nonce",o),r.head.appendChild(i)}},[])},JC=function(a){var r=a.className,i=a.colorModel,o=a.color,c=o===void 0?i.defaultColor:o,m=a.onChange,u=T0(a,["className","colorModel","color","onChange"]),g=f.useRef(null);QC(g);var x=XC(i,c,m),p=x[0],y=x[1],v=Tf(["react-colorful",r]);return wt.createElement("div",Hc({},u,{ref:g,className:v}),wt.createElement(GC,{hsva:p,onChange:y}),wt.createElement(VC,{hue:p.h,onChange:y,className:"react-colorful__last-control"}))},WC={defaultColor:"000",toHsva:$C,fromHsva:function(a){return IC({h:a.h,s:a.s,v:a.v,a:1})},equal:YC},ek=function(a){return wt.createElement(JC,Hc({},a,{colorModel:WC}))};const Ce=f.forwardRef(({className:a,...r},i)=>e.jsx("div",{ref:i,className:Ge("rounded-lg border bg-card text-card-foreground shadow-sm",a),...r}));Ce.displayName="Card";const En=f.forwardRef(({className:a,...r},i)=>e.jsx("div",{ref:i,className:Ge("flex flex-col space-y-1.5 p-6",a),...r}));En.displayName="CardHeader";const Mn=f.forwardRef(({className:a,...r},i)=>e.jsx("h3",{ref:i,className:Ge("text-2xl font-semibold leading-none tracking-tight",a),...r}));Mn.displayName="CardTitle";const Ti=f.forwardRef(({className:a,...r},i)=>e.jsx("p",{ref:i,className:Ge("text-sm text-muted-foreground",a),...r}));Ti.displayName="CardDescription";const vt=f.forwardRef(({className:a,...r},i)=>e.jsx("div",{ref:i,className:Ge("p-6 pt-0",a),...r}));vt.displayName="CardContent";const tk=f.forwardRef(({className:a,...r},i)=>e.jsx("div",{ref:i,className:Ge("flex items-center p-6 pt-0",a),...r}));tk.displayName="CardFooter";const sk=Cf("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary-navy text-white shadow hover:bg-primary-navy/80",secondary:"border-transparent bg-primary-mint text-primary-navy hover:bg-primary-mint/80",destructive:"border-transparent bg-red-500 text-white shadow hover:bg-red-500/80",outline:"text-neutral-dark border-neutral-dark"}},defaultVariants:{variant:"default"}});function ze({className:a,variant:r,...i}){return e.jsx("div",{className:Ge(sk({variant:r}),a),...i})}function ea(a){const r=f.useRef(a);return f.useEffect(()=>{r.current=a}),f.useMemo(()=>(...i)=>r.current?.(...i),[])}var Em={exports:{}},Mm={};/**
630 * @license React
631 * use-sync-external-store-shim.production.js
632 *
633 * Copyright (c) Meta Platforms, Inc. and affiliates.
634 *
635 * This source code is licensed under the MIT license found in the
636 * LICENSE file in the root directory of this source tree.
637 */var Nv;function ak(){if(Nv)return Mm;Nv=1;var a=Uc();function r(v,w){return v===w&&(v!==0||1/v===1/w)||v!==v&&w!==w}var i=typeof Object.is=="function"?Object.is:r,o=a.useState,c=a.useEffect,m=a.useLayoutEffect,u=a.useDebugValue;function g(v,w){var N=w(),D=o({inst:{value:N,getSnapshot:w}}),b=D[0].inst,E=D[1];return m(function(){b.value=N,b.getSnapshot=w,x(b)&&E({inst:b})},[v,N,w]),c(function(){return x(b)&&E({inst:b}),v(function(){x(b)&&E({inst:b})})},[v]),u(N),N}function x(v){var w=v.getSnapshot;v=v.value;try{var N=w();return!i(v,N)}catch{return!0}}function p(v,w){return w()}var y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:g;return Mm.useSyncExternalStore=a.useSyncExternalStore!==void 0?a.useSyncExternalStore:y,Mm}var wv;function nk(){return wv||(wv=1,Em.exports=ak()),Em.exports}var rk=nk();function lk(){return rk.useSyncExternalStore(ik,()=>!0,()=>!1)}function ik(){return()=>{}}var Af="Avatar",[ok,PM]=Bs(Af),[ck,P0]=ok(Af),z0=f.forwardRef((a,r)=>{const{__scopeAvatar:i,...o}=a,[c,m]=f.useState("idle");return e.jsx(ck,{scope:i,imageLoadingStatus:c,onImageLoadingStatusChange:m,children:e.jsx(Be.span,{...o,ref:r})})});z0.displayName=Af;var L0="AvatarImage",U0=f.forwardRef((a,r)=>{const{__scopeAvatar:i,src:o,onLoadingStatusChange:c=()=>{},...m}=a,u=P0(L0,i),g=dk(o,m),x=ea(p=>{c(p),u.onImageLoadingStatusChange(p)});return $t(()=>{g!=="idle"&&x(g)},[g,x]),g==="loaded"?e.jsx(Be.img,{...m,ref:r,src:o}):null});U0.displayName=L0;var $0="AvatarFallback",I0=f.forwardRef((a,r)=>{const{__scopeAvatar:i,delayMs:o,...c}=a,m=P0($0,i),[u,g]=f.useState(o===void 0);return f.useEffect(()=>{if(o!==void 0){const x=window.setTimeout(()=>g(!0),o);return()=>window.clearTimeout(x)}},[o]),u&&m.imageLoadingStatus!=="loaded"?e.jsx(Be.span,{...c,ref:r}):null});I0.displayName=$0;function Sv(a,r){return a?r?(a.src!==r&&(a.src=r),a.complete&&a.naturalWi
637dth>0?"loaded":"loading"):"error":"idle"}function dk(a,{referrerPolicy:r,crossOrigin:i}){const o=lk(),c=f.useRef(null),m=o?(c.current||(c.current=new window.Image),c.current):null,[u,g]=f.useState(()=>Sv(m,a));return $t(()=>{g(Sv(m,a))},[m,a]),$t(()=>{const x=v=>()=>{g(v)};if(!m)return;const p=x("loaded"),y=x("error");return m.addEventListener("load",p),m.addEventListener("error",y),r&&(m.referrerPolicy=r),typeof i=="string"&&(m.crossOrigin=i),()=>{m.removeEventListener("load",p),m.removeEventListener("error",y)}},[m,i,r]),u}var F0=z0,B0=U0,q0=I0;const _c=f.forwardRef(({className:a,...r},i)=>e.jsx(F0,{ref:i,className:Ge("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",a),...r}));_c.displayName=F0.displayName;const H0=f.forwardRef(({className:a,...r},i)=>e.jsx(B0,{ref:i,className:Ge("aspect-square h-full w-full",a),...r}));H0.displayName=B0.displayName;const Dc=f.forwardRef(({className:a,...r},i)=>e.jsx(q0,{ref:i,className:Ge("flex h-full w-full items-center justify-center rounded-full bg-neutral-light text-neutral-dark",a),...r}));Dc.displayName=q0.displayName;const uk=[{name:"Default",colors:{light:{primaryNavy:"#0A1F44",primaryMint:"#2DE1C2",neutralLight:"#F8F9FA",neutralDark:"#374151"},dark:{primaryNavy:"#4F8EF7",primaryMint:"#4AEDC4",neutralLight:"#1F2937",neutralDark:"#F3F4F6"}}},{name:"Ocean Blue",colors:{light:{primaryNavy:"#1e3a8a",primaryMint:"#0891b2",neutralLight:"#f0f9ff",neutralDark:"#374151"},dark:{primaryNavy:"#60a5fa",primaryMint:"#22d3ee",neutralLight:"#0f172a",neutralDark:"#e2e8f0"}}},{name:"Forest Green",colors:{light:{primaryNavy:"#14532d",primaryMint:"#059669",neutralLight:"#f0fdf4",neutralDark:"#374151"},dark:{primaryNavy:"#4ade80",primaryMint:"#34d399",neutralLight:"#0f172a",neutralDark:"#e2e8f0"}}},{name:"Sunset Orange",colors:{light:{primaryNavy:"#9a3412",primaryMint:"#ea580c",neutralLight:"#fff7ed",neutralDark:"#374151"},dark:{primaryNavy:"#fb923c",primaryMint:"#fdba74",neutralLight:"#0f172a",neutralDark:"#e2e8f0"}}},{name:"Purple Dreams",colors:{light:{primaryNavy:"#581c87",primaryMint:"#9333ea",neutralLight:"#faf5ff",neutralDark:"#374151"},dark:{primaryNavy:"#a855f7",primaryMint:"#c084fc",neutralLight:"#0f172a",neutralDark:"#e2e8f0"}}},{name:"Rose Gold",colors:{light:{primaryNavy:"#881337",primaryMint:"#e11d48",neutralLight:"#fdf2f8",neutralDark:"#374151"},dark:{primaryNavy:"#fb7185",primaryMint:"#fda4af",neutralLight:"#0f172a",neutralDark:"#e2e8f0"}}}];function mk(){const{colors:a,isDarkMode:r,currentColors:i,updateTheme:o,updateFullColorScheme:c,toggleDarkMode:m,resetTheme:u,defaultColors:g}=Mf(),[x,p]=f.useState(a),[y,v]=f.useState(null),[w,N]=f.useState(!1),[D,b]=f.useState([]),[E,_]=f.useState(!1),[M,k]=f.useState("light");f.useEffect(()=>{const I=JSON.stringify(x)!==JSON.stringify(a);_(I)},[x,a]),f.useEffect(()=>{if(w){const I=r?x.dark:x.light;document.documentElement.style.setProperty("--color-primary-navy",I.primaryNavy),document.documentElement.style.setProperty("--color-primary-mint",I.primaryMint),document.documentElement.style.setProperty("--color-neutral-light",I.neutralLight),document.documentElement.style.setProperty("--color-neutral-dark",I.neutralDark)}},[x,w,r]),f.useEffect(()=>{const I=localStorage.getItem("customColorSchemes");I&&b(JSON.parse(I))},[]),f.useEffect(()=>{p(a)},[a]);const C=(I,ue)=>{p(X=>({...X,[M]:{...X[M],[I]:ue}}))},j=I=>{p(I.colors)},O=()=>{p(g)},L=()=>{const I=prompt("Enter a name for this color scheme:");if(I){const ue={name:I,colors:{...x},createdAt:new Date().toISOString()},X=[...D,ue];b(X),localStorage.setItem("customColorSchemes",JSON.stringify(X)),alert("Color scheme saved successfully!")}},R=()=>{c(x.light,x.dark),N(!1),alert("Theme applied successfully!")},H=()=>{N(!w)},z=()=>{p(a),N(!1)},V=()=>M==="dark"?x.dark:x.light,Z=[{key:"primaryNavy",label:"Primary Navy",description:`Main brand color for ${M} mode`,value:V().primaryNavy},{key:"primaryMint",label:"Primary Mint",description:`Accent color for ${M} mode`,value:V().primaryMint},{key:"neutralLight",label:"Neutral Light",description:`Background color for ${M} mode`,value:V().neutralLight},{key:"neutralDark",label:"Neutral Dark",description:`Text color for ${M} mode`,value:V().neutralDark}];return e.jsxs("div",{className:"p-3 sm:p-6 lg:p-8 max-w-7xl mx-auto",children:[e.jsxs("div",{className:"mb-6 sm:mb-8",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold text-primary-navy mb-2 flex items-center gap-3",children:[e.jsx(zi,{className:"h-6 sm:h-8 w-6 sm:w-8"}),"Theme Customization"]}),e.jsx("p",{className:"text-neutral-dark text-sm sm:text-base",children:"Customize your application's color scheme to match your brand"}),e.jsx("div",{className:"mt-6 p-4 bg-card rounded-lg border border-border shadow-sm",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-foreground",children:"Theme Mode:"}),e.jsx(G,{variant:"outline",size:"sm",onClick:m,className:"flex items-center gap-2",children:r?e.jsxs(e.Fragment,{children:[e.jsx(ur,{className:"h-4 w-4"}),"Dark"]}
637):e.jsxs(e.Fragment,{children:[e.jsx(mr,{className:"h-4 w-4"}),"Light"]})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-foreground",children:"Editing:"}),e.jsxs("div",{className:"flex bg-muted rounded-lg p-1",children:[e.jsxs("button",{type:"button",onClick:()=>k("light"),className:`px-3 py-1 rounded text-sm font-medium transition-colors ${M==="light"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[e.jsx(mr,{className:"h-3 w-3 mr-1 inline"}),"Light"]}),e.jsxs("button",{type:"button",onClick:()=>k("dark"),className:`px-3 py-1 rounded text-sm font-medium transition-colors ${M==="dark"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[e.jsx(ur,{className:"h-3 w-3 mr-1 inline"}),"Dark"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(_S,{className:"h-4 w-4"}),e.jsxs("span",{children:["Currently viewing: ",r?"Dark":"Light"," mode"]})]})]})}),E&&e.jsx("div",{className:"mt-4 p-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg",children:e.jsx("p",{className:"text-sm text-yellow-800 dark:text-yellow-200",children:"⚠️ You have unsaved changes. Don't forget to apply your theme!"})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs(Ce,{children:[e.jsxs(En,{children:[e.jsx(Mn,{className:"text-lg",children:"Preset Color Schemes"}),e.jsx(Ti,{children:"Choose from our curated color palettes"})]}),e.jsx(vt,{children:e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:uk.map((I,ue)=>e.jsx("div",{className:"cursor-pointer group",onClick:()=>j(I),children:e.jsxs("div",{className:"border-2 border-transparent group-hover:border-primary-mint rounded-lg p-3 bg-card shadow-sm transition-all",children:[e.jsxs("div",{className:"space-y-2 mb-3",children:[e.jsxs("div",{className:"grid grid-cols-4 gap-1",children:[e.jsx("div",{className:"h-4 rounded",style:{backgroundColor:I.colors.light.primaryNavy},title:"Primary Navy (Light)"}),e.jsx("div",{className:"h-4 rounded",style:{backgroundColor:I.colors.light.primaryMint},title:"Primary Mint (Light)"}),e.jsx("div",{className:"h-4 rounded border",style:{backgroundColor:I.colors.light.neutralLight},title:"Neutral Light (Light)"}),e.jsx("div",{className:"h-4 rounded",style:{backgroundColor:I.colors.light.neutralDark},title:"Neutral Dark (Light)"})]}),e.jsxs("div",{className:"grid grid-cols-4 gap-1",children:[e.jsx("div",{className:"h-4 rounded",style:{backgroundColor:I.colors.dark.primaryNavy},title:"Primary Navy (Dark)"}),e.jsx("div",{className:"h-4 rounded",style:{backgroundColor:I.colors.dark.primaryMint},title:"Primary Mint (Dark)"}),e.jsx("div",{className:"h-4 rounded border",style:{backgroundColor:I.colors.dark.neutralLight},title:"Neutral Light (Dark)"}),e.jsx("div",{className:"h-4 rounded",style:{backgroundColor:I.colors.dark.neutralDark},title:"Neutral Dark (Dark)"})]})]}),e.jsx("p",{className:"text-sm font-medium text-center",children:I.name}),e.jsxs("div",{className:"flex items-center justify-center gap-1 mt-1",children:[e.jsx(mr,{className:"h-3 w-3 text-neutral-dark/50"}),e.jsx("span",{className:"text-xs text-neutral-dark/50",children:"/"}),e.jsx(ur,{className:"h-3 w-3 text-neutral-dark/50"})]})]})},ue))})})]}),e.jsxs(Ce,{children:[e.jsxs(En,{children:[e.jsx(Mn,{className:"text-lg",children:"Custom Colors"}),e.jsx(Ti,{children:"Click on any color to customize it with the color picker"})]}),e.jsx(vt,{children:e.jsx("div",{className:"space-y-6",children:Z.map(I=>e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-primary-navy",children:I.label}),e.jsx("p",{className:"text-sm text-neutral-dark",children:I.description})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-mono bg-neutral-light px-2 py-1 rounded",children:I.value}),e.jsx("button",{className:"w-12 h-12 rounded-lg border-2 border-neutral-dark/20 shadow-sm hover:scale-105 transition-transform",style:{backgroundColor:I.value},onClick:()=>v(y===I.key?null:I.key)})]})]}),y===I.key&&e.jsx("div",{className:"flex justify-center p-4 bg-neutral-light/50 rounded-lg",children:e.jsx(ek,{color:I.value,onChange:ue=>C(I.key,ue)})})]},I.key))})})]}),D.length>0&&e.jsxs(Ce,{children:[e.jsxs(En,{children:[e.jsx(Mn,{className:"text-lg",children:"Your Saved Schemes"}),e.jsx(Ti,{children:"Previously saved color combinations"})]}),e.jsx(vt,{children:e.jsx("div",{className:"space-y-3",children:D.map((I,ue)=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-neutral-light/50 rounded-lg cursor-pointer hover:bg-neutral-light transition-colors",onClick:()=>p(I.colors),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex gap-1",children:Object.values(I.c
637olors).map((X,P)=>e.jsx("div",{className:"w-4 h-4 rounded",style:{backgroundColor:X}},P))}),e.jsx("span",{className:"font-medium",children:I.name})]}),e.jsx("span",{className:"text-sm text-neutral-dark",children:new Date(I.createdAt).toLocaleDateString()})]},ue))})})]})]}),e.jsx("div",{className:"space-y-6",children:e.jsxs(Ce,{children:[e.jsxs(En,{children:[e.jsx(Mn,{className:"text-lg",children:"Live Preview"}),e.jsx(Ti,{children:"See how your colors look in the interface"})]}),e.jsxs(vt,{className:"space-y-4",children:[e.jsxs("div",{className:"border rounded-lg p-4 bg-card border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",style:{color:w?x.primaryNavy:a.primaryNavy},children:[e.jsx("div",{className:"w-6 h-6 rounded flex items-center justify-center",style:{backgroundColor:w?x.primaryNavy:a.primaryNavy},children:e.jsx(Js,{className:"h-3 w-3 text-white"})}),e.jsx("span",{className:"font-semibold text-sm",children:"Novio"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded text-sm",style:{backgroundColor:(w?x.primaryMint:a.primaryMint)+"20",color:w?x.primaryNavy:a.primaryNavy},children:[e.jsx(Fc,{className:"h-3 w-3"}),e.jsx("span",{children:"Dashboard"}),e.jsx(ze,{className:"ml-auto text-xs",style:{backgroundColor:w?x.primaryMint:a.primaryMint,color:w?x.primaryNavy:a.primaryNavy},children:"3"})]}),e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded text-sm",style:{color:w?x.neutralDark:a.neutralDark},children:[e.jsx(yt,{className:"h-3 w-3"}),e.jsx("span",{children:"Clients"})]})]})]}),e.jsxs("div",{className:"border rounded-lg p-4",style:{backgroundColor:w?x.neutralLight:a.neutralLight,borderColor:(w?x.neutralDark:a.neutralDark)+"20"},children:[e.jsx("h4",{className:"font-semibold mb-2",style:{color:w?x.primaryNavy:a.primaryNavy},children:"Sample Card"}),e.jsx("p",{className:"text-sm mb-3",style:{color:w?x.neutralDark:a.neutralDark},children:"This is how your content will look with the selected colors."}),e.jsx(G,{size:"sm",style:{backgroundColor:w?x.primaryMint:a.primaryMint,color:w?x.primaryNavy:a.primaryNavy},children:"Action Button"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(G,{onClick:H,variant:w?"secondary":"outline",className:"w-full",children:[e.jsx(rs,{className:"mr-2 h-4 w-4"}),w?"Exit Preview":"Preview Changes"]}),E&&e.jsxs(G,{onClick:z,variant:"outline",className:"w-full",children:[e.jsx(Gm,{className:"mr-2 h-4 w-4"}),"Discard Changes"]}),e.jsxs(G,{onClick:O,variant:"outline",className:"w-full",children:[e.jsx(Gm,{className:"mr-2 h-4 w-4"}),"Reset to Default"]}),e.jsxs(G,{onClick:L,variant:"outline",className:"w-full",children:[e.jsx(Nr,{className:"mr-2 h-4 w-4"}),"Save Scheme"]}),e.jsxs(G,{onClick:R,className:"w-full",disabled:!E,children:[e.jsx(br,{className:"mr-2 h-4 w-4"}),"Apply Theme"]})]})]})]})})]})]})}const he=f.forwardRef(({className:a,type:r,...i},o)=>e.jsx("input",{type:r,className:Ge("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
637ing-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium 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",a),ref:o,...i}));he.displayName="Input";var fk="Label",V0=f.forwardRef((a,r)=>e.jsx(Be.label,{...a,ref:r,onMouseDown:i=>{i.target.closest("button, input, select, textarea")||(a.onMouseDown?.(i),!i.defaultPrevented&&i.detail>1&&i.preventDefault())}}));V0.displayName=fk;var G0=V0;const hk=Cf("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 text-neutral-dark"),oe=f.forwardRef(({className:a,...r},i)=>e.jsx(G0,{ref:i,className:Ge(hk(),a),...r}));oe.displayName=G0.displayName;const Ut=f.forwardRef(({className:a,...r},i)=>e.jsx("textarea",{className:Ge("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",a),ref:i,...r}));Ut.displayName="Textarea";function xk(a,r=globalThis?.document){const i=ea(a);f.useEffect(()=>{const o=c=>{c.key==="Escape"&&i(c)};return r.addEventListener("keydown",o,{capture:!0}),()=>r.removeEventListener("keydown",o,{capture:!0})},[i,r])}var pk="DismissableLayer",sf="dismissableLayer.update",gk="dismissableLayer.pointerDownOutside",vk="dismissableLayer.focusOutside",Cv,Y0=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Vc=f.forwardRef((a,r)=>{const{disableOutsidePointerEvents:i=!1,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:m,onInteractOutside:u,onDismiss:g,...x}=a,p=f.useContext(Y0),[y,v]=f.useState(null),w=y?.ownerDocument??globalThis?.document,[,N]=f.useState({}),D=it(r,L=>v(L)),b=Array.from(p.layers),[E]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),_=b.indexOf(E),M=y?b.indexOf(y):-1,k=p.layersWithOutsidePointerEventsDisabled.size>0,C=M>=_,j=jk(L=>{const R=L.target,H=[...p.branches].some(z=>z.contains(R));!C||H||(c?.(L),u?.(L),L.defaultPrevented||g?.())},w),O=Nk(L=>{const R=L.target;[...p.branches].some(z=>z.contains(R))||(m?.(L),u?.(L),L.defaultPrevented||g?.())},w);return xk(L=>{M===p.layers.size-1&&(o?.(L),!L.defaultPrevented&&g&&(L.preventDefault(),g()))},w),f.useEffect(()=>{if(y)return i&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(Cv=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(y)),p.layers.add(y),kv(),()=>{i&&p.layersWithOutsidePointerEventsDisabled.size===1&&(w.body.style.pointerEvents=Cv)}},[y,w,i,p]),f.useEffect(()=>()=>{y&&(p.layers.delete(y),p.layersWithOutsidePointerEventsDisabled.delete(y),kv())},[y,p]),f.useEffect(()=>{const L=()=>N({});return document.addEventListener(sf,L),()=>document.removeEventListener(sf,L)},[]),e.jsx(Be.div,{...x,ref:D,style:{pointerEvents:k?C?"auto":"none":void 0,...a.style},onFocusCapture:Te(a.onFocusCapture,O.onFocusCapture),onBlurCapture:Te(a.onBlurCapture,O.onBlurCapture),onPointerDownCapture:Te(a.onPointerDownCapture,j.onPointerDownCapture)})});Vc.displayName=pk;var yk="DismissableLayerBranch",bk=f.forwardRef((a,r)=>{const i=f.useContext(Y0),o=f.useRef(null),c=it(r,o);return f.useEffect(()=>{const m=o.current;if(m)return i.branches.add(m),()=>{i.branches.delete(m)}},[i.branches]),e.jsx(Be.div,{...a,ref:c})});bk.displayName=yk;function jk(a,r=globalThis?.document){const i=ea(a),o=f.useRef(!1),c=f.useRef(()=>{});return f.useEffect(()=>{const m=g=>{if(g.target&&!o.current){let x=function(){X0(gk,i,p,{discrete:!0})};const p={originalEvent:g};g.pointerType==="touch"?(r.removeEventListener("click",c.current),c.current=x,r.addEventListener("click",c.current,{once:!0})):x()}else r.removeEventListener("click",c.current);o.current=!1},u=window.setTimeout(()=>{r.addEventListener("pointerdown",m)},0);return()=>{window.clearTimeout(u),r.removeEventListener("pointerdown",m),r.removeEventListener("click",c.current)}},[r,i]),{onPointerDownCapture:()=>o.current=!0}}function Nk(a,r=globalThis?.document){const i=ea(a),o=f.useRef(!1);return f.useEffect(()=>{const c=m=>
vendor: 4,480 bytes, line 637
637{m.target&&!o.current&&X0(vk,i,{originalEvent:m},{discrete:!1})};return r.addEventListener("focusin",c),()=>r.removeEventListener("focusin",c)},[r,i]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function kv(){const a=new CustomEvent(sf);document.dispatchEvent(a)}function X0(a,r,i,{discrete:o}){const c=i.originalEvent.target,m=new CustomEvent(a,{bubbles:!1,cancelable:!0,detail:i});r&&c.addEventListener(a,r,{once:!0}),o?S0(c,m):c.dispatchEvent(m)}var Tm="focusScope.autoFocusOnMount",Am="focusScope.autoFocusOnUnmount",_v={bubbles:!1,cancelable:!0},wk="FocusScope",Gc=f.forwardRef((a,r)=>{const{loop:i=!1,trapped:o=!1,onMountAutoFocus:c,onUnmountAutoFocus:m,...u}=a,[g,x]=f.useState(null),p=ea(c),y=ea(m),v=f.useRef(null),w=it(r,b=>x(b)),N=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(o){let b=function(k){if(N.paused||!g)return;const C=k.target;g.contains(C)?v.current=C:kn(v.current,{select:!0})},E=function(k){if(N.paused||!g)return;const C=k.relatedTarget;C!==null&&(g.contains(C)||kn(v.current,{select:!0}))},_=function(k){if(document.activeElement===document.body)for(const j of k)j.removedNodes.length>0&&kn(g)};document.addEventListener("focusin",b),document.addEventListener("focusout",E);const M=new MutationObserver(_);return g&&M.observe(g,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",E),M.disconnect()}}},[o,g,N.paused]),f.useEffect(()=>{if(g){Ev.add(N);const b=document.activeElement;if(!g.contains(b)){const _=new CustomEvent(Tm,_v);g.addEventListener(Tm,p),g.dispatchEvent(_),_.defaultPrevented||(Sk(Ek(K0(g)),{select:!0}),document.activeElement===b&&kn(g))}return()=>{g.removeEventListener(Tm,p),setTimeout(()=>{const _=new CustomEvent(Am,_v);g.addEventListener(Am,y),g.dispatchEvent(_),_.defaultPrevented||kn(b??document.body,{select:!0}),g.removeEventListener(Am,y),Ev.remove(N)},0)}}},[g,p,y,N]);const D=f.useCallback(b=>{if(!i&&!o||N.paused)return;const E=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,_=document.activeElement;if(E&&_){const M=b.currentTarget,[k,C]=Ck(M);k&&C?!b.shiftKey&&_===C?(b.preventDefault(),i&&kn(k,{select:!0})):b.shiftKey&&_===k&&(b.preventDefault(),i&&kn(C,{select:!0})):_===M&&b.preventDefault()}},[i,o,N.paused]);return e.jsx(Be.div,{tabIndex:-1,...u,ref:w,onKeyDown:D})});Gc.displayName=wk;function Sk(a,{select:r=!1}={}){const i=document.activeElement;for(const o of a)if(kn(o,{select:r}),document.activeElement!==i)return}function Ck(a){const r=K0(a),i=Dv(r,a),o=Dv(r.reverse(),a);return[i,o]}function K0(a){const r=[],i=document.createTreeWalker(a,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const c=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||c?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;i.nextNode();)r.push(i.currentNode);return r}function Dv(a,r){for(const i of a)if(!kk(i,{upTo:r}))return i}function kk(a,{upTo:r}){if(getComputedStyle(a).visibility==="hidden")return!0;for(;a;){if(r!==void 0&&a===r)return!1;if(getComputedStyle(a).display==="none")return!0;a=a.parentElement}return!1}function _k(a){return a instanceof HTMLInputElement&&"select"in a}function kn(a,{select:r=!1}={}){if(a&&a.focus){const i=document.activeElement;a.focus({preventScroll:!0}),a!==i&&_k(a)&&r&&a.select()}}var Ev=Dk();function Dk(){let a=[];return{add(r){const i=a[0];r!==i&&i?.pause(),a=Mv(a,r),a.unshift(r)},remove(r){a=Mv(a,r),a[0]?.resume()}}}function Mv(a,r){const i=[...a],o=i.indexOf(r);return o!==-1&&i.splice(o,1),i}function Ek(a){return a.filter(r=>r.tagName!=="A")}var Mk="Portal",Yc=f.forwardRef((a,r)=>{const{container:i,...o}=a,[c,m]=f.useState(!1);$t(()=>m(!0),[]);const u=i||c&&globalThis?.document?.body;return u?L1.createPortal(e.jsx(Be.div,{...o,ref:r}),u):null});Yc.displayName=Mk;var Rm=0;function Rf(){f.useEffect(()=>{const a=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",a[0]??Tv()),document.body.insertAdjacentElement("beforeend",a[1]??Tv()),Rm++,()=>{Rm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),Rm--}},[])}function Tv(){const a=document.createElement("span");return a.setAttribute("data-radix-focus-guard",""),a.tabIndex=0,a.style.outline="none",a.style.opacity="0",a.style.position="fixed",a.style.pointerEvents="none",a}var fa=function(){return fa=Object.assign||function(r){for(var i,o=1,
vendor: 4,661 bytes, line 637
637c=arguments.length;o<c;o++){i=arguments[o];for(var m in i)Object.prototype.hasOwnProperty.call(i,m)&&(r[m]=i[m])}return r},fa.apply(this,arguments)};function Z0(a,r){var i={};for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&r.indexOf(o)<0&&(i[o]=a[o]);if(a!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,o=Object.getOwnPropertySymbols(a);c<o.length;c++)r.indexOf(o[c])<0&&Object.prototype.propertyIsEnumerable.call(a,o[c])&&(i[o[c]]=a[o[c]]);return i}function Tk(a,r,i){if(i||arguments.length===2)for(var o=0,c=r.length,m;o<c;o++)(m||!(o in r))&&(m||(m=Array.prototype.slice.call(r,0,o)),m[o]=r[o]);return a.concat(m||Array.prototype.slice.call(r))}var Nc="right-scroll-bar-position",wc="width-before-scroll-bar",Ak="with-scroll-bars-hidden",Rk="--removed-body-scroll-bar-size";function Om(a,r){return typeof a=="function"?a(r):a&&(a.current=r),a}function Ok(a,r){var i=f.useState(function(){return{value:a,callback:r,facade:{get current(){return i.value},set current(o){var c=i.value;c!==o&&(i.value=o,i.callback(o,c))}}}})[0];return i.callback=r,i.facade}var Pk=typeof window<"u"?f.useLayoutEffect:f.useEffect,Av=new WeakMap;function zk(a,r){var i=Ok(null,function(o){return a.forEach(function(c){return Om(c,o)})});return Pk(function(){var o=Av.get(i);if(o){var c=new Set(o),m=new Set(a),u=i.current;c.forEach(function(g){m.has(g)||Om(g,null)}),m.forEach(function(g){c.has(g)||Om(g,u)})}Av.set(i,a)},[a]),i}function Lk(a){return a}function Uk(a,r){r===void 0&&(r=Lk);var i=[],o=!1,c={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return i.length?i[i.length-1]:a},useMedium:function(m){var u=r(m,o);return i.push(u),function(){i=i.filter(function(g){return g!==u})}},assignSyncMedium:function(m){for(o=!0;i.length;){var u=i;i=[],u.forEach(m)}i={push:function(g){return m(g)},filter:function(){return i}}},assignMedium:function(m){o=!0;var u=[];if(i.length){var g=i;i=[],g.forEach(m),u=i}var x=function(){var y=u;u=[],y.forEach(m)},p=function(){return Promise.resolve().then(x)};p(),i={push:function(y){u.push(y),p()},filter:function(y){return u=u.filter(y),i}}}};return c}function $k(a){a===void 0&&(a={});var r=Uk(null);return r.options=fa({async:!0,ssr:!1},a),r}var Q0=function(a){var r=a.sideCar,i=Z0(a,["sideCar"]);if(!r)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=r.read();if(!o)throw new Error("Sidecar medium not found");return f.createElement(o,fa({},i))};Q0.isSideCarExport=!0;function Ik(a,r){return a.useMedium(r),Q0}var J0=$k(),Pm=function(){},Xc=f.forwardRef(function(a,r){var i=f.useRef(null),o=f.useState({onScrollCapture:Pm,onWheelCapture:Pm,onTouchMoveCapture:Pm}),c=o[0],m=o[1],u=a.forwardProps,g=a.children,x=a.className,p=a.removeScrollBar,y=a.enabled,v=a.shards,w=a.sideCar,N=a.noRelative,D=a.noIsolation,b=a.inert,E=a.allowPinchZoom,_=a.as,M=_===void 0?"div":_,k=a.gapMode,C=Z0(a,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=w,O=zk([i,r]),L=fa(fa({},C),c);return f.createElement(f.Fragment,null,y&&f.createElement(j,{sideCar:J0,removeScrollBar:p,shards:v,noRelative:N,noIsolation:D,inert:b,setCallbacks:m,allowPinchZoom:!!E,lockRef:i,gapMode:k}),u?f.cloneElement(f.Children.only(g),fa(fa({},L),{ref:O})):f.createElement(M,fa({},L,{className:x,ref:O}),g))});Xc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Xc.classNames={fullWidth:wc,zeroRight:Nc};var Fk=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Bk(){if(!document)return null;var a=document.createElement("style");a.type="text/css";var r=Fk();return r&&a.setAttribute("nonce",r),a}function qk(a,r){a.styleSheet?a.styleSheet.cssText=r:a.appendChild(document.createTextNode(r))}function Hk(a){var r=document.head||document.getElementsByTagName("head")[0];r.appendChild(a)}var Vk=function(){var a=0,r=null;return{add:function(i){a==0&&(r=Bk())&&(qk(r,i),Hk(r)),a++},remove:function(){a--,!a&&r&&(r.parentNode&&r.parentNode.removeChild(r),r=null)}}},Gk=function(){var a=Vk();return function(r,i){f.useEffect(function(){return a.add(r),function(){a.remove()}},[r&&i])}},W0=function(){var a=Gk(),r=function(i){var o=i.styles,c=i.dynamic;return a(o,c),null};return r},Yk={left:0,top:0,right:0,gap:0},zm=function(a){return parseInt(a||"",10)||0},Xk=function(a){var r=window.getComputedStyle(document.body),i=r[a==="padding"?"paddingLeft":"marginLeft"],o=r[a==="padding"?"paddingTop":"marginTop"],c=r[a==="padding"?"paddingRight":"marginRight"];return[zm(i),zm(o),zm(c)]}
vendor: 4,592 bytes, lines 637-677
637,Kk=function(a){if(a===void 0&&(a="margin"),typeof window>"u")return Yk;var r=Xk(a),i=document.documentElement.clientWidth,o=window.innerWidth;return{left:r[0],top:r[1],right:r[2],gap:Math.max(0,o-i+r[2]-r[0])}},Zk=W0(),pl="data-scroll-locked",Qk=function(a,r,i,o){var c=a.left,m=a.top,u=a.right,g=a.gap;return i===void 0&&(i="margin"),`
638  .`.concat(Ak,` {
639   overflow: hidden `).concat(o,`;
640   padding-right: `).concat(g,"px ").concat(o,`;
641  }
642  body[`).concat(pl,`] {
643    overflow: hidden `).concat(o,`;
644    overscroll-behavior: contain;
645    `).concat([r&&"position: relative ".concat(o,";"),i==="margin"&&`
646    padding-left: `.concat(c,`px;
647    padding-top: `).concat(m,`px;
648    padding-right: `).concat(u,`px;
649    margin-left:0;
650    margin-top:0;
651    margin-right: `).concat(g,"px ").concat(o,`;
652    `),i==="padding"&&"padding-right: ".concat(g,"px ").concat(o,";")].filter(Boolean).join(""),`
653  }
654  
655  .`).concat(Nc,` {
656    right: `).concat(g,"px ").concat(o,`;
657  }
658  
659  .`).concat(wc,` {
660    margin-right: `).concat(g,"px ").concat(o,`;
661  }
662  
663  .`).concat(Nc," .").concat(Nc,` {
664    right: 0 `).concat(o,`;
665  }
666  
667  .`).concat(wc," .").concat(wc,` {
668    margin-right: 0 `).concat(o,`;
669  }
670  
671  body[`).concat(pl,`] {
672    `).concat(Rk,": ").concat(g,`px;
673  }
674`)},Rv=function(){var a=parseInt(document.body.getAttribute(pl)||"0",10);return isFinite(a)?a:0},Jk=function(){f.useEffect(function(){return document.body.setAttribute(pl,(Rv()+1).toString()),function(){var a=Rv()-1;a<=0?document.body.removeAttribute(pl):document.body.setAttribute(pl,a.toString())}},[])},Wk=function(a){var r=a.noRelative,i=a.noImportant,o=a.gapMode,c=o===void 0?"margin":o;Jk();var m=f.useMemo(function(){return Kk(c)},[c]);return f.createElement(Zk,{styles:Qk(m,!r,c,i?"":"!important")})},af=!1;if(typeof window<"u")try{var hc=Object.defineProperty({},"passive",{get:function(){return af=!0,!0}});window.addEventListener("test",hc,hc),window.removeEventListener("test",hc,hc)}catch{af=!1}var ul=af?{passive:!1}:!1,e_=function(a){return a.tagName==="TEXTAREA"},ey=function(a,r){if(!(a instanceof Element))return!1;var i=window.getComputedStyle(a);return i[r]!=="hidden"&&!(i.overflowY===i.overflowX&&!e_(a)&&i[r]==="visible")},t_=function(a){return ey(a,"overflowY")},s_=function(a){return ey(a,"overflowX")},Ov=function(a,r){var i=r.ownerDocument,o=r;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var c=ty(a,o);if(c){var m=sy(a,o),u=m[1],g=m[2];if(u>g)return!0}o=o.parentNode}while(o&&o!==i.body);return!1},a_=function(a){var r=a.scrollTop,i=a.scrollHeight,o=a.clientHeight;return[r,i,o]},n_=function(a){var r=a.scrollLeft,i=a.scrollWidth,o=a.clientWidth;return[r,i,o]},ty=function(a,r){return a==="v"?t_(r):s_(r)},sy=function(a,r){return a==="v"?a_(r):n_(r)},r_=function(a,r){return a==="h"&&r==="rtl"?-1:1},l_=function(a,r,i,o,c){var m=r_(a,window.getComputedStyle(r).direction),u=m*o,g=i.target,x=r.contains(g),p=!1,y=u>0,v=0,w=0;do{if(!g)break;var N=sy(a,g),D=N[0],b=N[1],E=N[2],_=b-E-m*D;(D||_)&&ty(a,g)&&(v+=_,w+=D);var M=g.parentNode;g=M&&M.nodeType===Node.DOCUMENT_FRAGMENT_NODE?M.host:M}while(!x&&g!==document.body||x&&(r.contains(g)||r===g));return(y&&Math.abs(v)<1||!y&&Math.abs(w)<1)&&(p=!0),p},xc=function(a){return"changedTouches"in a?[a.changedTouches[0].clientX,a.changedTouches[0].clientY]:[0,0]},Pv=function(a){return[a.deltaX,a.deltaY]},zv=function(a){return a&&"current"in a?a.current:a},i_=function(a,r){return a[0]===r[0]&&a[1]===r[1]},o_=function(a){return`
675  .block-interactivity-`.concat(a,` {pointer-events: none;}
676  .allow-interactivity-`).concat(a,` {pointer-events: all;}
677`)},c_=0,ml=[];function d_(a){var r=f.useRef([]),i=f.useRef([0,0]),o=f.useRef(),c=f.useState(c_++)[0],m=f.useState(W0)[0],u=f.useRef(a);f.useEffect(function(){u.current=a},[a]),f.useEffect(function(){if(a.inert){document.body.classList.add("block-interactivity-".concat(c));var b=Tk([a.lockRef.current],(a.shards||[]).map(zv),!0).filter(Boolean);return b.forEach(function(E){return E.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),b.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(c))})}}},[a.inert,a.lockRef.current,a.shards]);var g=f.useCallback(function(b,E){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!u.current.allowPinchZoom;var _=xc(b),M=i.current,k="deltaX"in b?b.deltaX:M[0]-_[0],C="deltaY"in b?b.deltaY:M[1]-_[1],j,O=b.target,L=Math.abs(k)>Math.abs(C)?"h":"v";if("touches"in b&&L==="h"&&O.type==="range")return!1;var R=Ov(L,O);if(!R)return!0;
vendor: 9,324 bytes, lines 677-681
677if(R?j=L:(j=L==="v"?"h":"v",R=Ov(L,O)),!R)return!1;if(!o.current&&"changedTouches"in b&&(k||C)&&(o.current=j),!j)return!0;var H=o.current||j;return l_(H,E,b,H==="h"?k:C)},[]),x=f.useCallback(function(b){var E=b;if(!(!ml.length||ml[ml.length-1]!==m)){var _="deltaY"in E?Pv(E):xc(E),M=r.current.filter(function(j){return j.name===E.type&&(j.target===E.target||E.target===j.shadowParent)&&i_(j.delta,_)})[0];if(M&&M.should){E.cancelable&&E.preventDefault();return}if(!M){var k=(u.current.shards||[]).map(zv).filter(Boolean).filter(function(j){return j.contains(E.target)}),C=k.length>0?g(E,k[0]):!u.current.noIsolation;C&&E.cancelable&&E.preventDefault()}}},[]),p=f.useCallback(function(b,E,_,M){var k={name:b,delta:E,target:_,should:M,shadowParent:u_(_)};r.current.push(k),setTimeout(function(){r.current=r.current.filter(function(C){return C!==k})},1)},[]),y=f.useCallback(function(b){i.current=xc(b),o.current=void 0},[]),v=f.useCallback(function(b){p(b.type,Pv(b),b.target,g(b,a.lockRef.current))},[]),w=f.useCallback(function(b){p(b.type,xc(b),b.target,g(b,a.lockRef.current))},[]);f.useEffect(function(){return ml.push(m),a.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:w}),document.addEventListener("wheel",x,ul),document.addEventListener("touchmove",x,ul),document.addEventListener("touchstart",y,ul),function(){ml=ml.filter(function(b){return b!==m}),document.removeEventListener("wheel",x,ul),document.removeEventListener("touchmove",x,ul),document.removeEventListener("touchstart",y,ul)}},[]);var N=a.removeScrollBar,D=a.inert;return f.createElement(f.Fragment,null,D?f.createElement(m,{styles:o_(c)}):null,N?f.createElement(Wk,{noRelative:a.noRelative,gapMode:a.gapMode}):null)}function u_(a){for(var r=null;a!==null;)a instanceof ShadowRoot&&(r=a.host,a=a.host),a=a.parentNode;return r}const m_=Ik(J0,d_);var Kc=f.forwardRef(function(a,r){return f.createElement(Xc,fa({},a,{ref:r,sideCar:m_}))});Kc.classNames=Xc.classNames;var f_=function(a){if(typeof document>"u")return null;var r=Array.isArray(a)?a[0]:a;return r.ownerDocument.body},fl=new WeakMap,pc=new WeakMap,gc={},Lm=0,ay=function(a){return a&&(a.host||ay(a.parentNode))},h_=function(a,r){return r.map(function(i){if(a.contains(i))return i;var o=ay(i);return o&&a.contains(o)?o:(console.error("aria-hidden",i,"in not contained inside",a,". Doing nothing"),null)}).filter(function(i){return!!i})},x_=function(a,r,i,o){var c=h_(r,Array.isArray(a)?a:[a]);gc[i]||(gc[i]=new WeakMap);var m=gc[i],u=[],g=new Set,x=new Set(c),p=function(v){!v||g.has(v)||(g.add(v),p(v.parentNode))};c.forEach(p);var y=function(v){!v||x.has(v)||Array.prototype.forEach.call(v.children,function(w){if(g.has(w))y(w);else try{var N=w.getAttribute(o),D=N!==null&&N!=="false",b=(fl.get(w)||0)+1,E=(m.get(w)||0)+1;fl.set(w,b),m.set(w,E),u.push(w),b===1&&D&&pc.set(w,!0),E===1&&w.setAttribute(i,"true"),D||w.setAttribute(o,"true")}catch(_){console.error("aria-hidden: cannot operate on ",w,_)}})};return y(r),g.clear(),Lm++,function(){u.forEach(function(v){var w=fl.get(v)-1,N=m.get(v)-1;fl.set(v,w),m.set(v,N),w||(pc.has(v)||v.removeAttribute(o),pc.delete(v)),N||v.removeAttribute(i)}),Lm--,Lm||(fl=new WeakMap,fl=new WeakMap,pc=new WeakMap,gc={})}},Of=function(a,r,i){i===void 0&&(i="data-aria-hidden");var o=Array.from(Array.isArray(a)?a:[a]),c=f_(a);return c?(o.push.apply(o,Array.from(c.querySelectorAll("[aria-live], script"))),x_(o,c,i,"aria-hidden")):function(){return null}},Zc="Dialog",[ny,zM]=Bs(Zc),[p_,na]=ny(Zc),ry=a=>{const{__scopeDialog:r,children:i,open:o,defaultOpen:c,onOpenChange:m,modal:u=!0}=a,g=f.useRef(null),x=f.useRef(null),[p,y]=Ya({prop:o,defaultProp:c??!1,onChange:m,caller:Zc});return e.jsx(p_,{scope:r,triggerRef:g,contentRef:x,contentId:Qs(),titleId:Qs(),descriptionId:Qs(),open:p,onOpenChange:y,onOpenToggle:f.useCallback(()=>y(v=>!v),[y]),modal:u,children:i})};ry.displayName=Zc;var ly="DialogTrigger",iy=f.forwardRef((a,r)=>{const{__scopeDialog:i,...o}=a,c=na(ly,i),m=it(r,c.triggerRef);return e.jsx(Be.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.contentId,"data-state":Lf(c.open),...o,ref:m,onClick:Te(a.onClick,c.onOpenToggle)})});iy.displayName=ly;var Pf="DialogPortal",[g_,oy]=ny(Pf,{forceMount:void 0}),cy=a=>{const{__scopeDialog:r,forceMount:i,children:o,container:c}=a,m=na(Pf,r);return e.jsx(g_,{scope:r,forceMount:i,children:f.Children.map(o,u=>e.jsx(aa,{present:i||m.open,children:e.jsx(Yc,{asChild:!0,container:c,children:u})}))})};cy.displayName=Pf;var Ec="DialogOverlay",dy=f.forwardRef((a,r)=>{const i=oy(Ec,a.__scopeDialog),{forceMount:o=i.forceMount,...c}=a,m=na(Ec,a.__scopeDialog);return m.modal?e.jsx(aa,{present:o||m.open,children:e.jsx(y_,{...c,ref:r})}):null});dy.displayName=Ec;var v_=hr("DialogOverlay.RemoveScroll"),y_=f.forwardRef((a,r)=>{const{__scopeDialog:i,...o}=a,c=na(Ec,i);return e.jsx(Kc,{as:v_,allowPinchZoom:!0,shards:[c.contentRef],children:e.jsx(Be.div,{"data-state":Lf(c.open),...o,ref:r,style:{pointerEvents:"auto",...o.style}})})}),xr="DialogContent",uy=f.forwardRef((a,r)=>{const i=oy(xr,a.__scopeDialog),{forceMount:o=i.forceMount,...c}=a,m=na(xr,a.__scopeDialog);return e.jsx(aa,{present:o||m.open,children:m.modal?e.jsx(b_,{...c,ref:r}):e.jsx(j_,{...c,ref:r})})});uy.displayName=xr;var b_=f.forwardRef((a,r)=>{const i=na(xr,a.__scopeDialog),o=f.useRef(null),c=it(r,i.contentRef,o);return f.useEffect(()=>{const m=o.current;if(m)return Of(m)},[]),e.jsx(my,{...a,ref:c,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Te(a.onCloseAutoFocus,m=>{m.preventDefault(),i.triggerRef.current?.focus()}),onPointerDownOutside:Te(a.onPointerDownOutside,m=>{const u=m.detail.originalEvent,g=u.button===0&&u.ctrlKey===!0;(u.button===2||g)&&m.preventDefault()}),onFocusOutside:Te(a.onFocusOutside,m=>m.preventDefault())})}),j_=f.forwardRef((a,r)=>{const i=na(xr,a.__scopeDialog),o=f.useRef(!1),c=f.useRef(!1);return e.jsx(my,{...a,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:m=>{a.onCloseAutoFocus?.(m),m.defaultPrevented||(o.current||i.triggerRef.current?.focus(),m.preventDefault()),o.current=!1,c.current=!1},onInteractOutside:m=>{a.onInteractOutside?.(m),m.defaultPrevented||(o.current=!0,m.detail.originalEvent.type==="pointerdown"&&(c.current=!0));const u=m.target;i.triggerRef.current?.contains(u)&&m.preventDefault(),m.detail.originalEvent.type==="focusin"&&c.current&&m.preventDefault()}})}),my=f.forwardRef((a,r)=>{const{__scopeDialog:i,trapFocus:o,onOpenAutoFocus:c,onCloseAutoFocus:m,...u}=a,g=na(xr,i),x=f.useRef(null),p=it(r,x);return Rf(),e.jsxs(e.Fragment,{children:[e.jsx(Gc,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:c,onUnmountAutoFocus:m,children:e.jsx(Vc,{role:"dialog",id:g.contentId,"aria-describedby":g.descriptionId,"aria-labelledby":g.titleId,"data-state":Lf(g.open),...u,ref:p,onDismiss:()=>g.onOpenChange(!1)})}),e.jsxs(e.Fragment,{children:[e.jsx(N_,{titleId:g.titleId}),e.jsx(S_,{contentRef:x,descriptionId:g.descriptionId})]})]})}),zf="DialogTitle",fy=f.forwardRef((a,r)=>{const{__scopeDialog:i,...o}=a,c=na(zf,i);return e.jsx(Be.h2,{id:c.titleId,...o,ref:r})});fy.displayName=zf;var hy="DialogDescription",xy=f.forwardRef((a,r)=>{const{__scopeDialog:i,...o}=a,c=na(hy,i);return e.jsx(Be.p,{id:c.descriptionId,...o,ref:r})});xy.displayName=hy;var py="DialogClose",gy=f.forwardRef((a,r)=>{const{__scopeDialog:i,...o}=a,c=na(py,i);return e.jsx(Be.button,{type:"button",...o,ref:r,onClick:Te(a.onClick,()=>c.onOpenChange(!1))})});gy.displayName=py;function Lf(a){return a?"open":"closed"}var vy="DialogTitleWarning",[LM,yy]=xC(vy,{contentName:xr,titleName:zf,docsSlug:"dialog"}),N_=({titleId:a})=>{const r=yy(vy),i=`\`${r.contentName}\` requires a \`${r.titleName}\` for the component to be accessible for screen reader users.
678
679If you want to hide the \`${r.titleName}\`, you can wrap it with our VisuallyHidden component.
680
681For more information, see https://radix-ui.com/primitives/docs/components/${r.docsSlug}`;return f.useEffect(()=>{a&&(document.getElementById(a)||console.error(i))},[i,a]),null},w_="DialogDescriptionWarning",S_=({contentRef:a,descriptionId:r})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${yy(w_).contentName}}.`;return f.useEffect(()=>{const c=a.current?.getAttribute("aria-describedby");r&&c&&(document.getElementById(r)||console.warn(o))},[o,a,r]),null},C_=ry,k_=iy,__=cy,by=dy,jy=uy,Ny=fy,wy=xy,D_=gy;const Ds=C_,E_=k_,M_=__,Sy=f.forwardRef(({className:a,...r},i)=>e.jsx(by,{ref:i,className:Ge("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",a),...r}));Sy.displayName=by.displayName;const vs=f.forwardRef(({className:a,children:r,...i},o)=>e.jsxs(M_,{children:[e.jsx(Sy,{}),e.jsxs(jy,{ref:o,className:Ge("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-card 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:rou
681nded-lg",a),...i,children:[r,e.jsxs(D_,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(gs,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));vs.displayName=jy.displayName;const Es=({className:a,...r})=>e.jsx("div",{className:Ge("flex flex-col space-y-1.5 text-center sm:text-left",a),...r});Es.displayName="DialogHeader";const Uf=({className:a,...r})=>e.jsx("div",{className:Ge("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...r});Uf.displayName="DialogFooter";const Ms=f.forwardRef(({className:a,...r},i)=>e.jsx(Ny,{ref:i,className:Ge("text-lg font-semibold leading-none tracking-tight text-primary-navy",a),...r}));Ms.displayName=Ny.displayName;const T_=f.forwardRef(({className:a,...r},i)=>e.jsx(wy,{ref:i,className:Ge("text-sm text-neutral-dark",a),...r}));T_.displayName=wy.displayName;function nf({open:a,onOpenChange:r,client:i=null,onSave:o}){const[c,m]=f.useState({name:"",email:"",phone:"",company_name:"",address:"",website:"",status:"Pending",notes:""}),[u,g]=f.useState(!1),[x,p]=f.useState(null);f.useEffect(()=>{m(i?{name:i.name||"",email:i.email||"",phone:i.phone||"",company_name:i.company_name||"",address:i.address||"",website:i.website||"",status:i.status||"Pending",notes:i.notes||""}:{name:"",email:"",phone:"",company_name:"",address:"",website:"",status:"Pending",notes:""}),p(null)},[i,a]);const y=async w=>{w.preventDefault(),g(!0),p(null);try{let N;if(i?N=await ve.updateClient(i.id,c):N=await ve.createClient(c),N&&N.success)o(N.data),r(!1);else throw new Error(N?.message||"Failed to save client")}catch(N){p(N.message)}finally{g(!1)}},v=(w,N)=>{m(D=>({...D,[w]:N}))};return e.jsx(Ds,{open:a,onOpenChange:r,children:e.jsxs(vs,{className:"max-w-2xl max-h-[90vh] overflow-y-auto mx-3 sm:mx-auto w-[calc(100%-1.5rem)] sm:w-full",children:[e.jsx(Es,{children:e.jsx(Ms,{className:"text-primary-navy",children:i?"Edit Client":"Add New Client"})}),x&&e.jsx("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded",children:x}),e.jsxs("form",{onSubmit:y,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"name",children:"Contact Name *"}),e.jsx(he,{id:"name",value:c.name,onChange:w=>v("name",w.target.value),required:!0,placeholder:"John Doe"})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"company_name",children:"Company Name *"}),e.jsx(he,{id:"company_name",value:c.company_name,onChange:w=>v("company_name",w.target.value),required:!0,placeholder:"Acme Corporation"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"email",children:"Email *"}),e.jsx(he,{id:"email",type:"email",value:c.email,onChange:w=>v("email",w.target.value),required:!0})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"phone",children:"Phone"}),e.jsx(he,{id:"phone",value:c.phone,onChange:w=>v("phone",w.target.value)})]})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"address",children:"Address"}),e.jsx(he,{id:"address",value:c.address,onChange:w=>v("address",w.target.value),placeholder:"123 Business Street, City, State 12345"})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"website",children:"Website"}),e.jsx(he,{id:"website",value:c.website,onChange:w=>v("website",w.target.value),placeholder:"https://example.com"})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"notes",children:"Notes"}),e.jsx(Ut,{id:"notes",value:c.notes,onChange:w=>v("notes",w.target.value),placeholder:"Additional notes about this client...",rows:3})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"status",children:"Status"}),e.jsxs("select",{id:"status",value:c.status,onChange:w=>v("status",w.target.value),className:"flex h-10 w-full rounded-md border border-neutral-dark/20 bg-white px-3 py-2 text-sm r
681ing-offset-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-mint focus-visible:ring-offset-2",children:[e.jsx("option",{value:"Pending",children:"Pending"}),e.jsx("option",{value:"Active",children:"Active"}),e.jsx("option",{value:"Inactive",children:"Inactive"})]})]}),e.jsxs(Uf,{children:[e.jsx(G,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsx(G,{type:"submit",disabled:u,children:u?i?"Updating...":"Adding...":i?"Update Client":"Add Client"})]})]})]})})}function A_({open:a,onOpenChange:r,client:i}){const[o,c]=f.useState(""),[m,u]=f.useState(!1),[g,x]=f.useState(null),p=async v=>{if(v.preventDefault(),!!i)try{u(!0),x(null);const w=localStorage.getItem("authToken"),N={message:o.trim()||void 0,type:"portal_access"};try{const b=await fetch("http://localhost:8001/api/v1/auth/test",{method:"GET",headers:{Accept:"application/json"}});console.log("Server connectivity test:")}catch{console.log("Server connectivity test failed:");for(const E of[8e3,3e3,8080])try{const _=await fetch(`http://localhost:${E}/api/v1/auth/test`,{method:"GET",headers:{Accept:"application/json"}});console.log(" Found server on port :"),_.ok&&console.log(" - ")}catch{}}const D=await ve.sendClientInvitation(i.id,N);if(D.success)c(""),r(!1),Nt.success(`Portal invitation sent successfully to ${i.email}! The client will receive an email with a registration link.`);else{const b=D.message||`HTTP ${response.status}: ${response.statusText}`;response.status===404?x("Client invitation endpoint not yet implemented on the backend. Please check with your developer."):response.status===500?x("Server error occurred. The backend may need email configuration or the invitation endpoint implementation."):x(b)}}catch(w){w.message.includes("fetch")||w.message.includes("Failed to fetch")?x("Cannot connect to the server. Please check that the backend is running and the invitation endpoint is implemented."):x(`Failed to send invitation: ${w.message||"Please check your connection and try again."}`)}finally{u(!1)}},y=()=>{m||(c(""),x(null),r(!1))};return a?e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-xl max-w-md w-full max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-primary-mint/10 rounded-lg",children:e.jsx(Lt,{className:"w-5 h-5 text-primary-mint"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-card-foreground",children:"Send Portal Invitation"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Invite ",i?.name," to access their project portal"]})]})]}),e.jsx(G,{variant:"ghost",size:"sm",onClick:y,disabled:m,className:"text-muted-foreground hover:text-foreground",children:e.jsx(gs,{className:"w-5 h-5"})})]}),e.jsxs("form",{onSubmit:p,className:"p-6 space-y-4",children:[e.jsxs("div",{className:"p-4 bg-muted/30 rounded-lg",children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-1",children:"Sending invitation to:"}),e.jsx("div",{className:"font-medium text-card-foreground",children:i?.name}),e.jsxs("div",{className:"text-sm text-muted-foreground flex items-center gap-2 mt-1",children:[e.jsx(Lt,{className:"w-4 h-4"}),i?.email]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"message",className:"text-sm font-medium text-card-foreground",children:"Personal Message (Optional)"}),e.jsx(Ut,{id:"message",placeholder:"Add a personal message to your invitation...",value:o,onChange:v=>c(v.target.value),rows:4,maxLength:1e3,disabled:m,className:"resize-none"}),e.jsxs("div",{className:"text-xs text-muted-foreground text-right",children:[o.length,"/1000 characters"]})]}),g&&e.jsx("div",{className:"p-3 bg-destructive/10 border border-destructive/20 rounded-lg",children:e.jsx("p",{className:"text-sm text-destructive",children:g})}),e.jsx("div",{className:"p-3 bg-blue-50 border border-blue-200 rounded-lg",children:e.jsxs("p",{className:"text-xs text-blue-800",children:[e.jsx("strong",{children:"What happens next:"}),e.jsx("br",{}),"• The client will receive an email with a secure registration link",e.jsx("br",{}),"• They can create an account to access their dedicated client portal",e.jsx("br",{}),"• Once registered, they'll see their projects, invoices, and can communicate with your team",e.jsx("br",{}),"• The invitation link expires in 7 days for security"]})}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[e.jsx(G,{type:"button",variant:"outline",onClick:y,disabled:m,children:"Cancel"}),e.jsx(G,{type:"submit",disabled:m,className:"bg-primary-mint hover:bg-primary-mint/90",children:m?e.jsxs(e.Fragment,{children:[e.jsx(xa,{
681className:"w-4 h-4 mr-2 animate-spin"}),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ja,{className:"w-4 h-4 mr-2"}),"Send Invitation"]})})]})]})]})}):null}function R_({client:a,onEdit:r,onInvite:i,onDelete:o}){const[c,m]=f.useState(!1),u=f.useRef(null);f.useEffect(()=>{function x(p){u.current&&!u.current.contains(p.target)&&m(!1)}return c&&document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[c]);const g=(x,p)=>{m(!1),p(a)};return e.jsxs("div",{className:"relative",ref:u,children:[e.jsx("button",{onClick:x=>{x.stopPropagation(),m(!c)},className:"p-1 hover:bg-muted rounded opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(va,{className:"w-4 h-4 text-muted-foreground"})}),c&&e.jsx("div",{className:"absolute right-0 top-full mt-1 w-48 bg-popover border border-border rounded-md shadow-lg z-10",onClick:x=>x.stopPropagation(),children:e.jsxs("div",{className:"py-1",children:[e.jsxs("button",{onClick:x=>{x.stopPropagation(),g("edit",r)},className:"flex items-center gap-3 w-full px-3 py-2 text-sm text-popover-foreground hover:bg-muted transition-colors",children:[e.jsx(d0,{className:"w-4 h-4"}),"Edit Client"]}),e.jsxs("button",{onClick:x=>{x.stopPropagation(),g("invite",i)},className:"flex items-center gap-3 w-full px-3 py-2 text-sm text-popover-foreground hover:bg-muted transition-colors",children:[e.jsx(Lt,{className:"w-4 h-4"}),"Send Portal Invitation"]}),e.jsx("div",{className:"border-t border-border my-1"}),e.jsxs("button",{onClick:x=>{x.stopPropagation(),g("delete",o)},className:"flex items-center gap-3 w-full px-3 py-2 text-sm text-destructive hover:bg-destructive/10 transition-colors",children:[e.jsx($n,{className:"w-4 h-4"}),"Delete Client"]})]})})]})}const O_=()=>{const a=new Date().getHours();return a<6?{greeting:"Working late",message:"Your dedication is impressive! Don't forget to take breaks.",emoji:"🌙"}:a<12?{greeting:"Good morning",message:"Ready to tackle the day? You've got this!",emoji:"☀️"}:a<17?{greeting:"Good afternoon",message:"Hope your day is going smoothly so far!",emoji:"🌤️"}:a<22?{greeting:"Good evening",message:"Wrapping up another productive day?",emoji:"🌆"}:{greeting:"Burning the midnight oil",message:"Late night work session? Remember to get some rest!",emoji:"🌃"}},P_=()=>["Success is the sum of small efforts repeated day in and day out.","The way to get started is to quit talking and begin doing.","Innovation distinguishes between a leader and a follower.","Your limitation—it's only your imagination.","Push yourself, because no one else is going to do it for you.","Great things never come from comfort zones.","Dream it. Wish it. Do it.","Success doesn't just find you. You have to go out and get it.","The harder you work for something, the greater you'll feel when you achieve it.","Don't stop when you're tired. Stop when you're done."],z_=()=>{const a=P_();return a[Math.floor(Math.random()*a.length)]},L_=()=>{const a=new Date().getDay();return{0:"Sunday vibes - perfect time for planning the week ahead! 📋",1:"Monday motivation - let's start this week strong! 💪",2:"Tuesday momentum - you're building great habits! 🚀",3:"Wednesday energy - halfway through, keep going! ⚡",4:"Thursday drive - the weekend is almost here! 🎯",5:"Friday focus - finish the week on a high note! 🎉",6:"Saturday spirit - time to recharge and reflect! ✨"}[a]},U_=a=>{const r={noTasks:{title:"All caught up! 🎉",message:"No pending tasks - you're on top of your game!",action:"Ready to tackle something new?"},noProjects:{title:"Ready for your next big project? 🚀",message:"Every great business starts with a single project.",action:"Let's create something amazing together!"},noClients:{title:"Your client journey begins now! 👋",message:"Every successful business starts with building great relationships.",action:"Add your first client and watch your business grow!"},noDocuments:{title:"A place for everything important 📁",message:"Keep your files organized and easily accessible.",action:"Upload your first document and stay organized!"},noMessages:{title:"Start the conversation! 💬",message:"Great communication is the foundation of successful projects.",action:"Select a conversation or start a new one!"},noInvoices:{title:"Ready to get paid? 💰",message:"Professional invoicing helps maintain healthy cash flow.",action:"Create your first invoice and keep your business running smoothly!"},searchEmpty:{title:"Nothing here yet... 🔍",message:"Try adjusting your search or filters.",action:"We'll help you find what you're looking for!"}};return r[a]||r.searchEmpty},qi=({type:a="searchEmpty",icon:r,onAction:i,actionLabel:o="Get Started",showAction:c=!0,className:m=""})=>{const u=U_(a);return e.jsx("div",{className:`text-center py-12 px-6 ${m}`,children:e.jsxs("div",{className:"max-w-md mx-auto",children:[r&&e.jsx("div",{className:"mb-6 flex justify-center",children:e.jsx("div",{className:"p-6 bg-gradient-to-br from-primary-mint/10 to-primary-navy
681/10 rounded-full",children:e.jsx(r,{className:"h-12 w-12 text-primary-mint animate-pulse"})})}),e.jsx("h3",{className:"text-xl font-semibold text-card-foreground mb-3",children:u.title}),e.jsx("p",{className:"text-muted-foreground mb-6 leading-relaxed",children:u.message}),e.jsx("p",{className:"text-sm text-primary-mint font-medium mb-6",children:u.action}),c&&i&&e.jsx(G,{onClick:i,className:"hover:scale-105 transition-transform duration-200",children:o})]})})};function $_({onSelectClient:a,onAddClient:r,refreshTrigger:i}){const[o,c]=f.useState(""),[m,u]=f.useState("All"),[g,x]=f.useState("All"),[p,y]=f.useState(!1),[v,w]=f.useState(null),[N,D]=f.useState(!1),[b,E]=f.useState(null),[_,M]=f.useState(!1),[k,C]=f.useState([]),[j,O]=f.useState(!0),[L,R]=f.useState(null),[H,z]=f.useState(!1),[V,Z]=f.useState(null),[I,ue]=f.useState(!1);f.useEffect(()=>{(async()=>{try{O(!0),R(null);const re={};o&&o.trim()!==""&&(re.search=o.trim()),m&&m!=="All"&&(re.status=m);const je=await ve.getClients(re);if(je.success){const Ae=je.data.data||[];C(Ae)}else R(je.message||"Failed to fetch clients")}catch(re){R(re.message||"Failed to fetch clients")}finally{O(!1)}})()},[o,m,i]);const X=f.useMemo(()=>{const K=k.length,re=k.filter(we=>we.status==="Active").length,je=k.filter(we=>we.status==="Inactive").length,Ae=k.filter(we=>we.status==="Pending").length;return{total:K,active:re,inactive:je,pending:Ae,totalRevenue:0}},[k]),P=f.useMemo(()=>k.filter(K=>{const re=!o||K.name?.toLowerCase().includes(o.toLowerCase())||K.company_name?.toLowerCase().includes(o.toLowerCase())||K.email?.toLowerCase().includes(o.toLowerCase()),je=m==="All"||K.status===m;return re&&je&&g==="All"}),[k,o,m,g]),$=K=>{switch(K){case"Active":return"bg-green-500 text-white";case"Inactive":return"bg-gray-500 text-white";default:return"bg-neutral-dark text-white"}},F=K=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(K),ne=K=>{w(K),y(!0)},T=K=>{E(K),D(!0)},B=K=>{Z(K),z(!0)},ee=async()=>{if(V)try{ue(!0);const K=await ve.deleteClient(V.id);if(K.success){C(je=>je.filter(Ae=>Ae.id!==V.id));const re=K.deleted_summary;alert(`✅ Client "${re.client}" deleted successfully!
682
683Deleted:
684• ${re.projects} project(s)
685• ${re.tasks} task(s)
686• ${re.documents} document(s)
687• ${re.invitations} invitation(s)`)}else alert(`❌ Failed to delete client: ${K.message}`)}catch{alert("❌ Failed to delete client. Please try again.")}finally{ue(!1),z(!1),Z(null)}},te=()=>{z(!1),Z(null)},ye=()=>{D(!1),E(null)},ge=K=>{C(v?re=>re.map(je=>je.id===v.id?K:je):re=>[K,...re]),r&&r(K)};return e.jsxs("div",{className:"p-4 lg:p-6 space-y-6",children:[e.jsxs("div",{className:"flex flex-col xl:flex-row xl:items-end justify-between gap-6",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-foreground",children:"Clients"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Manage your client relationships"})]}),e.jsxs("div",{className:"flex flex-wrap gap-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-primary-navy/10 rounded-lg",children:e.jsx(yt,{className:"w-5 h-5 text-primary-navy"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:X.total}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Clients"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-green-500/10 rounded-lg",children:e.jsx(yl,{className:"w-5 h-5 text-green-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:X.active}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Active"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg",children:e.jsx(ps,{className:"w-5 h-5 text-blue-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:X.pending}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Pending"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-gray-500/10 rounded-lg",children:e.jsx(yt,{className:"w-5 h-5 text-gray-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:X.inactive}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Inactive"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-primary-mint/10 rounded-lg",children:e.jsx(fr,{className:"w-5 h-5 text-primary-mint"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:F(X.totalRevenue)}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Revenue"})]})]})]})]}),e.jsxs(G,{onClick:()=>y(!0),className:"bg-primary-mint hover:bg-primary-mint/90 text-white xl:w-auto",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"New Client"]})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4 items-start lg:items-center",children:[e.jsxs("div",{className:"relative flex-1 max-w-md",children:[e.jsx(Un,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4"}),e.jsx(he,{placeholder:"Search clients...",value:o,onChange:K=>c(K.target.value),className:"pl-10"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("select",{value:m,onChange:K=>u(K.target.value),className:"px-3 py-2 border border-input bg-background rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-ring min-w-[120px]",children:[e.jsx("option",{value:"All",children:"All Status"}),e.jsx("option",{value:"Active",children:"Active"}),e.jsx("option",{value:"Inactive",children:"Inactive"})]}),e.jsxs("select",{value:g,onChange:K=>x(K.target.value),className:"px-3 py-2 border border-input bg-background rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-ring min-w-[140px]",children:[e.jsx("option",{value:"All",children:"All Types"}),e.jsx("option",{value:"Enterprise",children:"Enterprise"}),e.jsx("option",{value:"Small Business",children:"Small Business"}),e.jsx("option",{value:"Startup",children:"Startup"})]})]})]}),j&&e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(xa,{
687className:"w-8 h-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading clients..."})]}),L&&e.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-4 text-center",children:[e.jsx("p",{className:"text-destructive font-medium",children:"Error loading clients"}),e.jsx("p",{className:"text-destructive/80 text-sm mt-1",children:L}),e.jsx(G,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>window.location.reload(),children:"Retry"})]}),!j&&!L&&e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 2xl:grid-cols-3 3xl:grid-cols-4 gap-6",children:P.map(K=>e.jsx("div",{className:"bg-card rounded-xl shadow-sm border border-border hover:shadow-lg transition-all duration-200 cursor-pointer group",onClick:()=>a(K.id),children:e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex justify-between items-start mb-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-semibold text-lg text-card-foreground mb-1 truncate",children:K.name||K.company_name||"Unnamed Client"}),e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:K.company_name&&K.name!==K.company_name?K.company_name:"No company"})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-4 flex-shrink-0",children:[e.jsx(ze,{className:$(K.status),size:"sm",children:K.status}),e.jsx(R_,{client:K,onEdit:ne,onInvite:T,onDelete:B})]})]}),e.jsxs("div",{className:"space-y-3 mb-4",children:[K.assigned_user&&e.jsxs("div",{className:"flex items-center text-sm text-muted-foreground",children:[e.jsx(yt,{className:"w-4 h-4 mr-3 flex-shrink-0"}),e.jsxs("span",{className:"truncate",children:[K.assigned_user.first_name," ",K.assigned_user.last_name]})]}),K.email&&e.jsxs("div",{className:"flex items-center text-sm text-muted-foreground",children:[e.jsx(Lt,{className:"w-4 h-4 mr-3 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:K.email})]}),K.phone&&e.jsxs("div",{className:"flex items-center text-sm text-muted-foreground",children:[e.jsx(wf,{className:"w-4 h-4 mr-3 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:K.phone})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Status"}),e.jsx("p",{className:"font-semibold text-card-foreground",children:K.status})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Company"}),e.jsx("p",{className:"font-semibold text-card-foreground truncate",children:K.company?.name||"N/A"})]})]}),e.jsx("div",{className:"pt-4 border-t border-border/50",children:e.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[e.jsx("span",{children:"Created"}),e.jsx("span",{children:new Date(K.created_at).toLocaleDateString()})]})})]})},K.id))}),!j&&!L&&P.length===0&&e.jsx(qi,{type:o||m!=="All"||g!=="All"?"searchEmpty":"noClients",icon:ps,onAction:()=>y(!0),actionLabel:"Add Your First Client",className:"py-12"}),e.jsx(nf,{open:p,onOpenChange:y,client:v,onSave:ge}),e.jsx(A_,{open:N,onOpenChange:ye,client:b}),H&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:e.jsx("div",{className:"bg-card rounded-lg shadow-xl max-w-md w-full max-h-[90vh] overflow-y-auto",children:e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"p-2 bg-red-100 rounded-lg",children:e.jsx("svg",{className:"w-6 h-6 text-red-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.732-.833-2.5 0L4.268 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-red-600",children:"Delete Client"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"This action cannot be undone"})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsxs("p",{className:"text-card-foreground mb-4",children:["Are you sure you want to delete ",e.jsxs("strong",{children:['"',V?.name,'"']}),"?"]}),e.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-red-800 font-medium mb-2",children:"⚠️ Warning: This will permanently delete:"}),e.jsxs("ul",{className:"text-sm text-red-700 space-y-1 ml-4",children:[e.jsx("li",{children:"• The client record"}),e.jsx("li",{children:"• All projects assigned to this client"}),e.jsx("li",{children:"• All tasks within those projects"}),e.jsx("li",{children:"• All documents and files"}),e.jsx("li",{children:"• All invitations and portal access"})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx(G,{variant:"outline",onClick:te,disabled:I,children:"Cancel"}),e.jsx(G,{variant:"destructive",onClick:ee,disabled:I,className:"bg-red-600 hover:bg-red-700",children:I?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-4 h-4 mr-2 animate-spin rounded-full border-2 border-white border-t-transparent"}),"Deleting..."]}):"Delete Permanently"})]})]})})})]})}function $f(a){const r=a+"CollectionProvider",[i,o]=Bs(r),[c,m]=i(r,{collectionRef:{current:null},itemMap:new Map}),u=b=>{const{scope:E,children:_}=b,M=wt.useRef(null),k=wt.useRef(new Map).current;return e.jsx(c,{scope:E,itemMap:k,collectionRef:M,children:_})};u.displayName=r;const g=a+"CollectionSlot",x=hr(g),p=wt.forwardRef((b,E)=>{const{scope:_,children:M}=b,k=m(g,_),C=it(E,k.collectionRef);return e.jsx(x,{ref:C,children:M})});p.displayName=g;const y=a+"CollectionItemSlot",v="data-radix-collection-item",w=hr(y),N=wt.forwardRef((b,E)=>{const{scope:_,children:M,...k}=b,C=wt.useRef(null),j=it(E,C),O=m(y,_);return wt.useEffect(()=>(O.itemMap.set(C,{ref:C,...k}),()=>void O.itemMap.delete(C))),e.jsx(w,{[v]:"",ref:j,children:M})});N.displayName=y;function D(b){const E=m(a+"CollectionConsumer",b);return wt.useCallback(()=>{const M=E.collectionRef.current;if(!M)return[];const k=Array.from(M.querySelectorAll(`[${v}
687]`));return Array.from(E.itemMap.values()).sort((O,L)=>k.indexOf(O.ref.current)-k.indexOf(L.ref.current))},[E.collectionRef,E.itemMap])}return[{Provider:u,Slot:p,ItemSlot:N},D,o]}var I_=f.createContext(void 0);function Qc(a){const r=f.useContext(I_);return a||r||"ltr"}var Um="rovingFocusGroup.onEntryFocus",F_={bubbles:!1,cancelable:!0},Hi="RovingFocusGroup",[rf,Cy,B_]=$f(Hi),[q_,Jc]=Bs(Hi,[B_]),[H_,V_]=q_(Hi),ky=f.forwardRef((a,r)=>e.jsx(rf.Provider,{scope:a.__scopeRovingFocusGroup,children:e.jsx(rf.Slot,{scope:a.__scopeRovingFocusGroup,children:e.jsx(G_,{...a,ref:r})})}));ky.displayName=Hi;var G_=f.forwardRef((a,r)=>{const{__scopeRovingFocusGroup:i,orientation:o,loop:c=!1,dir:m,currentTabStopId:u,defaultCurrentTabStopId:g,onCurrentTabStopIdChange:x,onEntryFocus:p,preventScrollOnEntryFocus:y=!1,...v}=a,w=f.useRef(null),N=it(r,w),D=Qc(m),[b,E]=Ya({prop:u,defaultProp:g??null,onChange:x,caller:Hi}),[_,M]=f.useState(!1),k=ea(p),C=Cy(i),j=f.useRef(!1),[O,L]=f.useState(0);return f.useEffect(()=>{const R=w.current;if(R)return R.addEventListener(Um,k),()=>R.removeEventListener(Um,k)},[k]),e.jsx(H_,{scope:i,orientation:o,dir:D,loop:c,currentTabStopId:b,onItemFocus:f.useCallback(R=>E(R),[E]),onItemShiftTab:f.useCallback(()=>M(!0),[]),onFocusableItemAdd:f.useCallback(()=>L(R=>R+1),[]),onFocusableItemRemove:f.useCallback(()=>L(R=>R-1),[]),children:e.jsx(Be.div,{tabIndex:_||O===0?-1:0,"data-orientation":o,...v,ref:N,style:{outline:"none",...a.style},onMouseDown:Te(a.onMouseDown,()=>{j.current=!0}),onFocus:Te(a.onFocus,R=>{const H=!j.current;if(R.target===R.currentTarget&&H&&!_){const z=new CustomEvent(Um,F_);if(R.currentTarget.dispatchEvent(z),!z.defaultPrevented){const V=C().filter(P=>P.focusable),Z=V.find(P=>P.active),I=V.find(P=>P.id===b),X=[Z,I,...V].filter(Boolean).map(P=>P.ref.current);Ey(X,y)}}j.current=!1}),onBlur:Te(a.onBlur,()=>M(!1))})})}),_y="RovingFocusGroupItem",Dy=f.forwardRef((a,r)=>{const{__scopeRovingFocusGroup:i,focusable:o=!0,active:c=!1,tabStopId:m,children:u,...g}=a,x=Qs(),p=m||x,y=V_(_y,i),v=y.currentTabStopId===p,w=Cy(i),{onFocusableItemAdd:N,onFocusableItemRemove:D,currentTabStopId:b}=y;return f.useEffect(()=>{if(o)return N(),()=>D()},[o,N,D]),e.jsx(rf.ItemSlot,{scope:i,id:p,focusable:o,active:c,children:e.jsx(Be.span,{tabIndex:v?0:-1,"data-orientation":y.orientation,...g,ref:r,onMouseDown:Te(a.onMouseDown,E=>{o?y.onItemFocus(p):E.preventDefault()}),onFocus:Te(a.onFocus,()=>y.onItemFocus(p)),onKeyDown:Te(a.onKeyDown,E=>{if(E.key==="Tab"&&E.shiftKey){y.onItemShiftTab();return}if(E.target!==E.currentTarget)return;const _=K_(E,y.orientation,y.dir);if(_!==void 0){if(E.metaKey||E.ctrlKey||E.altKey||E.shiftKey)return;E.preventDefault();let k=w().filter(C=>C.focusable).map(C=>C.ref.current);if(_==="last")k.reverse();else if(_==="prev"||_==="next"){_==="prev"&&k.reverse();const C=k.indexOf(E.currentTarget);k=y.loop?Z_(k,C+1):k.slice(C+1)}setTimeout(()=>Ey(k))}}),children:typeof u=="function"?u({isCurrentTabStop:v,hasTabStop:b!=null}):u})})});Dy.displayName=_y;var Y_={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function X_(a,r){return r!=="rtl"?a:a==="ArrowLeft"?"ArrowRight":a==="ArrowRight"?"ArrowLeft":a}function K_(a,r,i){const o=X_(a.key,i);if(!(r==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(r==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return Y_[o]}function Ey(a,r=!1){const i=document.activeElement;for(const o of a)if(o===i||(o.focus({preventScroll:r}),document.activeElement!==i))return}function Z_(a,r){return a.map((i,o)=>a[(r+o)%a.length])}var My=ky,Ty=Dy,Wc="Tabs",[Q_,UM]=Bs(Wc,[Jc]),Ay=Jc(),[J_,If]=Q_(Wc),Ry=f.forwardRef((a,r)=>{const{__scopeTabs:i,value:o,onValueChange:c,defaultValue:m,orientation:u="horizontal",dir:g,activationMode:x="automatic",...p}=a,y=Qc(g),[v,w]=Ya({prop:o,onChange:c,defaultProp:m??"",caller:Wc});return e.jsx(J_,{scope:i,baseId:Qs(),value:v,onValueChange:w,orientation:u,dir:y,activationMode:x,children:e.jsx(Be.div,{dir:y,"data-orientation":u,...p,ref:r})})});Ry.displayName=Wc;var Oy="TabsList",Py=f.forwardRef((a,r)=>{const{__scopeTabs:i,loop:o=!0,...c}=a,m=If(Oy,i),u=Ay(i);return e.jsx(My,{asChild:!0,...u,orientation:m.orientation,dir:m.dir,loop:o,children:e.jsx(Be.div,{role:"tablist","aria-orientation":m.orientation,...c,ref:r})})});Py.displayName=Oy;var zy="TabsTrigger",Ly=f.forwardRef((a,r)=>{const{__scopeTabs:i,value:o,disabled:c=!1,...m}=a,u=If(zy,i),g=Ay(i),x=Iy(u.baseId,o),p=Fy(u.baseId,o),y=o===u.value;return e.jsx(Ty,{asChild:!0,...g,focusable:!c,active:y,children:e.jsx(Be.button,{type:"button",role:"tab","aria-selected":y,"aria-controls":p,"data-state":y?"active":"inactive","data-disabled":c?"":void 0,disabled:c,id:x,...m,ref:r,onMouseDown:Te(a.onMouseDown,v=>{!c&&v.button===0&&v.ctrlKey===!1?u.onValueChange(o):v.preventDefault()}),onKeyDown:Te(a.onKeyDown,v=>{[" ","Enter"].includes(v.key)&&u.onValueChange(o)}),onFocus:Te(a.onFocus,()=>{const v=u.activationMode!=="manual";!y&&!c&&v&&u.onValueChange(o)})})})});Ly.displayName=zy;var Uy="TabsContent",$y=f.forwardRef((a,r)=>{const{__scopeTabs:i,value:o,forceMount:c,children:m,...u}=a,g=If(Uy,i),x=Iy(g.baseId,o),p=Fy(g.baseId,o),y=o===g.value,v=f.useRef(y);return f.useEffect(()=>{const w=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(w)},[]),e.jsx(aa,{present:c||y,children:({present:w})=>e.jsx(Be.div,{"data-state":y?"active":"inactive","data-orientation":g.orientation,role:"tabpanel","aria-labelledby":x,hidden:!w,id:p,tabIndex:0,...u,ref:r,style:{...a.style,animationDuration:v.current?"0s":void 0},children:w&&m})})});$y.displayName=Uy;function Iy(a,r){return`${a}-trigger-${r}`}function Fy(a,r){return`${a}-content-${r}`}var W_=Ry,By=Py,qy=Ly,Hy=$y;const Vi=W_,wl=f.forwardRef(({className:a,...r},i)=>e.jsx(By,{ref:i,className:Ge("inline-flex h-10 items-center justify-center rounded-md bg-neutral-light p-1 text-neutral-dark",a),...r}));
687wl.displayName=By.displayName;const Et=f.forwardRef(({className:a,...r},i)=>e.jsx(qy,{ref:i,className:Ge("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",a),...r}));Et.displayName=qy.displayName;const Mt=f.forwardRef(({className:a,...r},i)=>e.jsx(Hy,{ref:i,className:Ge("mt-2 ring-offset-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-mint focus-visible:ring-offset-2",a),...r}));Mt.displayName=Hy.displayName;function lf({project:a,onClose:r,onSave:i}){const[o,c]=f.useState([]),[m,u]=f.useState({name:a?.name||"",description:a?.description||"",clientId:a?.client_id||a?.clientId||"",status:a?.status||"Planning",priority:a?.priority||"Medium",startDate:a?.start_date?a.start_date.split("T")[0]:a?.startDate||"",endDate:a?.end_date?a.end_date.split("T")[0]:a?.endDate||"",budget:a?.budget||"",projectManager:a?.assigned_user_id||a?.manager_id||"",teamMembers:a?.team_member_ids||a?.team_members?.map(C=>C.id)||a?.teamMembers||[],tags:Array.isArray(a?.tags)?a.tags.join(", "):a?.tags||""}),[g,x]=f.useState(""),[p,y]=f.useState({});f.useEffect(()=>{u(a?{name:a?.name||"",description:a?.description||"",clientId:a?.client_id||a?.clientId||"",status:a?.status||"Planning",priority:a?.priority||"Medium",startDate:a?.start_date?a.start_date.split("T")[0]:a?.startDate||"",endDate:a?.end_date?a.end_date.split("T")[0]:a?.endDate||"",budget:a?.budget||"",projectManager:a?.assigned_user_id||a?.manager_id||"",teamMembers:a?.team_member_ids||a?.team_members?.map(C=>C.id)||a?.teamMembers||[],tags:Array.isArray(a?.tags)?a.tags.join(", "):a?.tags||""}:{name:"",description:"",clientId:"",status:"Planning",priority:"Medium",startDate:"",endDate:"",budget:"",projectManager:"",teamMembers:[],tags:""})},[a]),f.useEffect(()=>{(async()=>{try{const C=await ve.getClients({per_page:100});C.success&&c(C.data.data||[])}catch{console.error("Failed to fetch clients")}})()},[]);const[v,w]=f.useState([]);f.useEffect(()=>{(async()=>{try{const C=await ve.getTeamMembers({per_page:100});if(C.success){const j=(C.data||[]).filter(O=>O.role!=="client"&&(!O.roles||!O.roles.some(L=>L.name==="client")));w(j)}}catch{console.error("Failed to fetch team members")}})()},[]);const N=v.map(C=>({id:C.id,name:`${C.first_name||""} ${C.last_name||""}`.trim()||C.email})),D=()=>{const C={};return m.name.trim()||(C.name="Project name is required"),a?m.budget&&(isNaN(m.budget)||Number(m.budget)<0)&&(C.budget="Budget must be a valid positive number"):(m.description.trim()||(C.description="Project description is required"),m.clientId||(C.clientId="Client selection is required"),m.startDate||(C.startDate="Start date is required"),(!m.budget||isNaN(m.budget)||Number(m.budget)<=0)&&(C.budget="Valid budget amount is required")),m.startDate&&m.endDate&&new Date(m.startDate)>=new Date(m.endDate)&&(C.endDate="End date must be after start date"),y(C),Object.keys(C).length===0},b=(C,j)=>{u(O=>({...O,[C]:j})),p[C]&&y(O=>({...O,[C]:void 0}))},E=()=>{g&&!m.teamMembers.includes(g)&&(u(C=>({...C,teamMembers:[...C.teamMembers,g]})),x(""))},_=C=>{const j=N.find(O=>O.id===parseInt(C));return j?j.name:`Member ${C}`},M=C=>{u(j=>({...j,teamMembers:j.teamMembers.filter(O=>O!==C)}))},k=async C=>{if(C.preventDefault(),!!D())try{const j={name:m.name,status:m.status,priority:m.priority};m.description&&(j.description=m.description),m.tags&&(j.tags=m.tags.split(",").map(L=>L.trim()).filter(L=>L)),m.clientId&&(j.client_id=parseInt(m.clientId)),m.startDate&&(j.start_date=m.startDate),m.endDate&&(j.end_date=m.endDate),m.budget&&(j.budget=Number(m.budget)),a||(m.projectManager&&(j.assigned_user_id=parseInt(m.projectManager)),m.teamMembers&&m.teamMembers.length>0&&(j.team_member_ids=m.teamMembers.map(L=>parseInt(L))));const O=a?await ve.updateProject(a.id,j):await ve.createProject(j);O.success&&(i(O.data),r())}catch(j){console.error("Error saving project");let O="Failed to save project";j.response&&j.response.data&&j.response.data.message?O=j.response.data.message:j.message&&(O=j.message),alert(O)}};return e.jsx(Ds,{open:!0,onOpenChange:r,children:e.jsxs(vs,{className:"max-w-4xl max-h-[90vh] overflow-y-auto mx-3 sm:mx-auto w-[calc(100%-1.5rem)] sm:w-full",children:[e.jsx(Es,{children:e.jsx(Ms,{className:"text-xl font-semibold text-neutral-dark",children:a?"Edit Project":"Create New Project"})}),e.jsxs("form",{onSubmit:k,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"md:col-span-2",children:[e.jsx(oe,{htmlFor:"name",children:"Project Name *"}),e.jsx(he,{id:"name",value:m.name,onChange:C=>b("name",C.target.value),placeholder:"Enter project name",className:p.name?"border-red-500":""}),p.name&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:p.name})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx(oe,{htmlFor:"description",children:"Description *"}),e.jsx(Ut,{id:"description",value:m.description,onChange:C=>b("description",C.target.value),placeholder:"Describe the project scope and objectives",rows:3,className:p.description?"border-red-500":""}),p.description&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:p.description})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx(oe,{htmlFor:"tags",children:"Tags"}),e.jsx(he,{id:"tags",value:m.tags,onChange:C=>b("tags",C.target.value),placeholder:"Enter tags separated by commas (e.g., web, design, urgent)",className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Separate multiple tags with commas"})]}),!a&&e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"client",children:"Client *"}),e.jsxs("select",{id:"client",value:m.clientId,onChange:C=>b("clientId",C.target.value),className:`w-full px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-primary-mint ${p.clientId?"border-red-500":"border-neutral-light"}`,children:[e.jsx("option",{value:"",children:"Select a client"}),o.map(C=>e.jsx("option",{value:C.id,children:C.company_name||C.name},C.id))]}),p.clientId&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:p.clientId})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"status",children:"Status"}),e.jsxs("select",{id:"status",value:m.status,onChange:C=>b("status",C.target.value),className:"w-full px-3 py-2 border border-neutral-light rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-primary-mint",children:[e.jsx("option",{value:"Planning",children:"Planning"}),e.jsx("option",{value:"In Progress",children:"In Progress"}),e.jsx("option",{value:"On Hold",children:"On Hold"}),e.jsx("option",{value:"Completed",children:"Completed"})]})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"priority",children:"Priority"}),e.jsxs("select",{id:"priority",value:m.priority,onChange:C=>b("priority",C.target.value),className:"w-full px-3 py-2 border border-neutral-light rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-primary-mint",children:[e.jsx("option",{value:"Low",children:"Low"}),e.jsx("option",{value:"Medium",children:"Medium"}),e.jsx("option",{value:"High",children:"High"})]})]}),!a&&e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"budget",children:"Budget (USD) *"}),e.jsxs("div",{className:"relative",children:[e.jsx(fr,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-neutral-dark/50 w-4 h-4"}),e.jsx(he,{id:"budget",type:"number",value:m.budget,onChange:C=>b("budget",C.target.value),placeholder:"0",className:`pl-10 ${p.budget?"border-red-500":""}`})]}),p.budget&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:p.budget})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs(oe,{htmlFor:"startDate",children:["Start Date ",a?"":"*"]}),e.jsxs("div",{className:"relative",children:[e.jsx(os,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-neutral-dark/50 w-4 h-4"}),e.jsx(he,{id:"startDate",type:"date",value:m.startDate,onChange:C=>b("startDate",C.target.value),className:`pl-10 ${p.startDate?"border-red-500":""}`})]}),p.startDate&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:p.startDate})]}),e.jsxs("div",{children:[e.jsxs(oe,{htmlFor:"endDate",children:["End Date ",a?"":"*"]}),e.jsxs("div",{className:"relative",children:[e.jsx(os,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-neutral-dark/50 w-4 h-4"}),e.jsx(he,{id:"endDate",type:"date",value:m.endDate,onChange:C=>b("endDate",C.target.value),className:`pl-10 ${p.endDate?"border-red-500":""}`})]}),p.endDate&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:p.endDate})]})]}),!a&&e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"projectManager",children:"Project Manager (Internal Team)"}),e.jsxs("select",{id:"projectManager",value:m.projectManager,onChange:C=>b("projectManager",C.target.value),className:`w-full px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-primary-mint ${p.projectManager?"border-red-500":"border-neutral-light"}`,children:[e.jsx("option",{value:"",children:"Select team member as project manager"}),N.length>0?N.map(C=>e.jsx("option",{value:C.id,children:C.name},C.id)):e.jsx("option",{value:"",disabled:!0,children:"Loading internal team members..."})]}),p.projectManager&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:p.projectManager}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Choose from your company's team members"})]}),!a&&e.jsxs("div",{children:[e.jsx(oe,{children:"Team Members (Internal Team)"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Add your company's team members to this project"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("select",{value:g,onChange:C=>x(C.target.value),className:"flex-1 px-3 py-2 border border-neutral-light rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-primary-mint",children:[e.jsx("option",{value:"",children:"Select internal team member"}),N.length>0?N.filter(C=>!m.teamMembers.includes(C.id)).map(C=>e.jsx("option",{value:C.id,children:C.name},C.id)):e.jsx("option",{value:"",disabled:!0,children:"Loading internal team members..."})]}),e.jsx(G,{type:"button",onClick:E,disabled:!g,variant:"outline",children:"Add"})]}),m.teamMembers.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:m.teamMembers.map(C=>e.jsxs("div",{className:"flex items-center gap-2 bg-primary-navy
687/10 text-primary-navy px-3 py-1 rounded-full text-sm",children:[e.jsx(yt,{className:"w-3 h-3"}),e.jsx("span",{children:_(C)}),e.jsx("button",{type:"button",onClick:()=>M(C),className:"hover:text-red-500",children:e.jsx(gs,{className:"w-3 h-3"})})]},C))})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t border-neutral-light",children:[e.jsx(G,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),e.jsx(G,{type:"submit",className:"bg-primary-mint hover:bg-primary-mint/90 text-white",children:a?"Update Project":"Create Project"})]})]})]})})}function Ff({onSelectProject:a,isClientView:r=!1,clientId:i=null}){const[o,c]=f.useState(""),[m,u]=f.useState("All"),[g,x]=f.useState("All"),[p,y]=f.useState(!1),[v,w]=f.useState(null),[N,D]=f.useState([]),[b,E]=f.useState(!0),[_,M]=f.useState(null),[k,C]=f.useState(1),[j,O]=f.useState(12),[L,R]=f.useState(1),[H,z]=f.useState(0),[V,Z]=f.useState("grid"),[I,ue]=f.useState(!1),X=ie=>({id:ie.id,name:ie.name,description:ie.description||"",clientName:ie.client?.name||ie.client?.company_name||"",client_id:ie.client_id,status:ie.status||"",priority:ie.priority||"",startDate:ie.start_date,endDate:ie.end_date||ie.due_date,budget:Number(ie.budget)||0,actualCost:Number(ie.actual_cost)||0,progress:ie.progress||0,teamMembers:ie.team_members||[],tags:ie.tags||[]});f.useEffect(()=>{(async()=>{try{E(!0);const we={page:k,per_page:j};r&&i&&(we.client_id=i);const _e=await ve.getProjects(we);if(_e?.success&&_e?.data){const Se=(Array.isArray(_e.data?.data)?_e.data.data:Array.isArray(_e.data)?_e.data:[]).map(X);D(Se);const Pe=_e.data?.meta||_e.meta;Pe?(R(Pe.last_page||1),z(Pe.total||Se.length),Pe.current_page&&C(Pe.current_page)):(R(1),z(Se.length))}else if(Array.isArray(_e)){const me=_e.map(X);D(me),R(1),z(me.length)}}catch(we){console.error("Project fetch error:"),M(we.message||"Failed to load projects")}finally{E(!1)}})()},[r,i,k,j]),f.useEffect(()=>{C(1)},[o,m,g,r,i]);const P=f.useMemo(()=>N.filter(we=>{const _e=we.name.toLowerCase().includes(o.toLowerCase())||we.clientName.toLowerCase().includes(o.toLowerCase())||we.description.toLowerCase().includes(o.toLowerCase()),me=m==="All"||we.status===m,Se=g==="All"||we.priority===g;return _e&&me&&Se}),[N,o,m,g]),$=f.useMemo(()=>{const ie=P.length,we=P.filter(Ve=>Ve.status==="In Progress").length,_e=P.filter(Ve=>Ve.status==="Completed").length,me=P.filter(Ve=>Ve.status==="On Hold").length,Se=P.filter(Ve=>Ve.status==="Planning").length,Pe=P.reduce((Ve,bt)=>Ve+(parseFloat(bt.budget)||0),0),pt=P.reduce((Ve,bt)=>Ve+(parseFloat(bt.actual_cost||bt.actualCost)||0),0);return{total:ie,active:we,completed:_e,onHold:me,notStarted:Se,totalBudget:Pe,totalActual:pt,budgetUtilization:Pe>0?Math.round(pt/Pe*100):0}},[P]),F=P,ne=ie=>{switch(ie){case"In Progress":return e.jsx(xs,{className:"w-4 h-4"});case"Completed":return e.jsx(Ws,{className:"w-4 h-4"});case"On Hold":return e.jsx(zS,{className:"w-4 h-4"});case"Planning":return e.jsx(es,{className:"w-4 h-4"});default:return e.jsx(Va,{className:"w-4 h-4"})}},T=ie=>{switch(ie){case"In Progress":return"bg-primary-mint text-white";case"Completed":return"bg-green-500 text-white";case"On Hold":return"bg-yellow-500 text-white";case"Planning":return"bg-primary-navy text-white";default:return"bg-neutral-dark text-white"}},B=ie=>{switch(ie){case"High":return"bg-red-500 text-white";case"Medium":return"bg-yellow-500 text-white";case"Low":return"bg-green-500 text-white";default:return"bg-neutral-dark text-white"}},ee=ie=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(ie),te=ie=>{w(ie),y(!0)},ye=ie=>{const we=X(ie);D(_e=>_e.some(Se=>Se.id===we.id)?_e.map(Se=>Se.id===we.id?we:Se):[we,..._e])},ge=()=>{y(!1),w(null)},K=k>1,re=k<L,je=(k-1)*j+(F.length?1:0),Ae=(k-1)*j+F.length;return e.jsxs("div",{className:"p-4 lg:p-6 space-y-6",children:[e.jsxs("div",{className:"flex flex-col xl:flex-row xl:items-end justify-between gap-6",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-foreground",children:"Projects"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Manage and track y
687our client projects"})]}),e.jsxs("div",{className:"flex flex-wrap gap-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-primary-navy/10 rounded-lg",children:e.jsx(Va,{className:"w-5 h-5 text-primary-navy"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:$.total}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Projects"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-primary-mint/10 rounded-lg",children:e.jsx(yl,{className:"w-5 h-5 text-primary-mint"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:$.active}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Active Projects"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-green-500/10 rounded-lg",children:e.jsx(Ws,{className:"w-5 h-5 text-green-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:$.completed}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Completed"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-yellow-500/10 rounded-lg",children:e.jsx(fr,{className:"w-5 h-5 text-yellow-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:$.totalBudget>999999?"$1.8M":ee($.totalBudget)}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Budget"})]})]})]})]}),!r&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"hidden sm:flex items-center gap-1 p-1 border border-border rounded-md",children:[e.jsx("button",{onClick:()=>Z("grid"),className:`px-2 py-1 rounded ${V==="grid"?"bg-muted text-foreground":"text-muted-foreground"}`,title:"Grid view",children:e.jsx(cS,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>Z("list"),className:`px-2 py-1 rounded ${V==="list"?"bg-muted text-foreground":"text-muted-foreground"}`,title:"List view",children:e.jsx(xS,{className:"w-4 h-4"})})]}),e.jsxs(G,{onClick:()=>y(!0),className:"bg-primary-mint hover:bg-primary-mint/90 text-white xl:w-auto",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"New Project"]})]})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4 items-start lg:items-center",children:[e.jsxs("div",{className:"relative flex-1 max-w-md",children:[e.jsx(Un,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4"}),e.jsx(he,{placeholder:"Search projects, clients, or descriptions...",value:o,onChange:ie=>c(ie.target.value),className:"pl-10"})]}),e.jsxs("div",{className:"flex gap-3 items-center",children:[e.jsxs("select",{value:m,onChange:ie=>u(ie.target.value),className:"px-3 py-2 border border-input bg-background rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-ring min-w-[120px]",children:[e.jsx("option",{value:"All",children:"All Status"}),e.jsx("option",{value:"Planning",children:"Planning"}),e.jsx("option",{value:"In Progress",children:"In Progress"}),e.jsx("option",{value:"On Hold",children:"On Hold"}),e.jsx("option",{value:"Completed",children:"Completed"})]}),e.jsxs("select",{value:g,onChange:ie=>x(ie.target.value),className:"px-3 py-2 border border-input bg-background rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-ring min-w-[120px]",children:[e.jsx("option",{value:"All",children:"All Priority"}),e.jsx("option",{value:"High",children:"High"}),e.jsx("option",{value:"Medium",children:"Medium"}),e.jsx("option",{value:"Low",children:"Low"})]}),e.jsx("button",{onClick:()=>ue(ie=>!ie),className:`px-3 py-2 border rounded-md text-sm ${I?"bg-muted text-foreground border-border":"text-muted-foreground border-input"}`,title:"Toggle compact density",children:I?"Compact":"Comfortable"})]})]}),V==="grid"?e.jsx("div",{className:`grid grid-cols-1 ${I?"lg:grid-cols-3 2xl:grid-cols-4":"lg:grid-cols-2 2xl:grid-cols-3"} gap-6`,children:F.map(ie=>e.jsx("div",{className:`bg-card rounded-xl shadow-sm border border-border transition-all duration-200 group ${I?"py-3":""} ${r?"":"hover:shadow-lg cursor-pointer"}`,onClick:()=>!r&&a&&a(ie.id),children:e.jsxs("div",{className:`${I?"p-4":"p-6"}`,children:[e.jsxs("div",{className:"flex justify-between items-start mb-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:`font-semibold ${I?"text-base":"text-lg"} text-card-foreground mb-1 truncate`,children:ie.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:ie.clientName})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-4 flex-shrink-0",children:[e.jsxs(ze,{className:`${T(ie.status)} flex items-center gap-1`,children:[ne(ie.status),e.jsx("span",{className:"text-xs",children:ie.status})]}),!r&&e.jsx("button",{onClick:we=>{we.stopPropagation(),te(ie)},className:"p-1 hover:bg-muted rounded opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(va,{className:"w-4 h-4 text-muted-foreground"})})]})]}),!I&&e.jsx("p",{className:"text-sm text-muted-foreground mb-4 line-clamp-2 leading-relaxed",children:ie.description}),e.jsxs("div",{className:`${I?"mb-2":"mb-4"}`,children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[!I&&e.jsx("span",{className:"text-sm font-medium text-card-foreground",children:"Progress"}),e.jsxs("span",{className:"text-sm font-bold text-primary-mint",children:[ie.progress,"%"]})]}),e.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:e.jsx("div",{className:"bg-primary-mint h-2 rounded-full transition-all duration-500",style:{width:`${ie.progress}%`}})})]}),!I&&e.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Budget"}),e.jsx("p",{className:"font-semibold text-card-foreground",children:ee(ie.budget)})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Spent"}),e.jsx("p",{className:"font-semibold text-card-foreground",children:ee(ie.actualCost)})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Due Date"}),e.jsx("p",{className:"text-sm text-card-foreground",children:ie.endDate?isNaN(new Date(ie.endDate))?"Invalid date":new Date(ie.endDate).toLocaleDateString():"Not set"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Priority"}),e.jsx(ze,{className:B(ie.priority),size:"sm",children:ie.priority})]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-border/50",children:[e.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[e.jsx(yt,{className:"w-4 h-4"}),e.jsxs("span",{className:"text-sm",children:[ie.teamMembers.length," members"]})]}),!I&&e.jsxs("div",{className:"flex gap-1",children:[ie.tags.slice(0,2).map((we,_e)=>e.jsx(ze,{variant:"outline",className:"text-xs",children:we},_e)),ie.tags.length>2&&e.jsxs(ze,{variant:"outline",className:"text-xs",children:["+",ie.tags.length-2]})]})]})]})},ie.id))}):e.jsx("div",{className:"bg-card rounded-xl shadow-sm border border-border overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-muted/50 text-muted-foreground",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left px-4 py-3",children:"Project"}),e.jsx("th",{className:"text-left px-4 py-3",children:"Client"}),e.jsx("th",{className:"text-left px-4 py-3",children:"Status"}),e.jsx("th",{className:"text-left px-4 py-3",children:"Priority"}),e.jsx("th",{className:"text-left px-4 py-3",children:"Progress"}),e.jsx("th",{className:"text-left px-4 py-3",children:"Budget"}),e.jsx("th",{className:"text-left px-4 py-3",children:"Members"}),!r&&e.jsx("th",{className:"text-right px-4 py-3",children:"Actions"})]})}),e.jsx("tbody",{children:F.map(ie=>e.jsxs("tr",{className:"border-t border-border hover:bg-muted/30",children:[e.jsx("td",{className:`px-4 py-3 font-medium text-card-foreground ${r?"":"cursor-pointer"}`,onClick:()=>!r&&a&&a(ie.id),children:ie.name}),e.jsx("td",{className:"px-4 py-3",children:ie.clientName}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(ze,{className:T(ie.status),children:ie.status})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(ze,{className:B(ie.priority),children:ie.priority})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-24 bg-muted rounded-full h-2",children:e.jsx("div",{className:"bg-primary-mint h-2 rounded-full",style:{width:`${ie.progress}%`}})}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[ie.progress,"%"]})]})}),e.jsx("td",{className:"px-4 py-3",children:ee(ie.budget)}),e.jsx("td",{className:"px-4 py-3",children:ie.teamMembers.length}),!r&&e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsx("button",{onClick:()=>te(ie),className:"p-1 hover:bg-muted rounded",title:"Edit",children:e.jsx(va,{className:"w-4 h-4 text-muted-foreground"})})})]},ie.id))})]})})}),b&&e.jsx("div",{className:"text-center text-muted-foreground py-12",children:"Loading projects..."}),!b&&F.length===0&&e.jsx(qi,{type:o||m!=="All"||g!=="All"?"searchEmpty":"noProjects",icon:Va,onAction:()=>y(!0),actionLabel:"Create Your First Project",className:"py-12"}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["Showing ",je,"-",Ae," of ",H," projects"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("select",{value:j,onChange:ie=>{O(parseInt(ie.target.value)),C(1)},className:"px-2 py-1 border border-input bg-background rounded-md text-sm",title:"Items per page",children:[e.jsx("option",{value:6,children:"6 / page"}),e.jsx("option",{value:12,children:"12 / page"}),e.jsx("option",{value:24,children:"24 / page"}),e.jsx("option",{value:48,children:"48 / page"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>K&&C(ie=>Math.max(1,ie-1)),disabled:!K,className:`p-2 rounded border ${K?"hover:bg-muted":"opacity-50 cursor-not-allowed"}`,title:"Previous page",children:e.jsx(m2,{className:"w-4 h-4"})}),e.jsxs("span",{className:"px-2 text-sm text-muted-foreground",children:["Page ",k," of ",L]}),e.jsx("button",{onClick:()=>re&&C(ie=>Math.min(L,ie+1)),disabled:!re,className:`p-2 rounded border ${re?"hover:bg-muted":"opacity-50 cursor-not-allowed"}`,title:"Next page",children:e.jsx(jr,{className:"w-4 h-4"})})]})]})]}),p&&e.jsx(lf,{project:v,onClose:ge,onSave:ye})]})}const Vy="http://localhost:8001/api/v1",Gy=()=>localStorage.getItem("auth_token")||localStorage.getItem("authToken"),_i=async(a,r={})=>{const i=Gy(),o={headers:{"Content-Type":"application/json",Accept:"application/json",...i&&{Authorization:`Bearer ${i}`},...r.headers},credentials:"include",...r};try{const c=await fetch(`${Vy}${a}`,o);if(!c.ok){const m=await c.json().catch(()=>({}));throw new Error(m.message||`HTTP error! status: ${c.status}`)}return await c.json()}catch(c){throw console.error("API request failed:"),c}},$e={get:(a,r={})=>{const i=new URLSearchParams(r).toString(),o=i?`${a}?${i}`:a;return _i(o,{method:"GET"})},post:(a,r={})=>_i(a,{method:"POST",body:JSON.stringify(r)}),put:(a,r={})=>_i(a,{method:"PUT",body:JSON.stringify(r)}),delete:a=>_i(a,{method:"DELETE"}),patch:(a,r={})=>_i(a,{method:"PATCH",body:JSON.stringify(r)}),upload:(a,r)=>{const i=Gy();return fetch(`${Vy}${a}`,{method:"POST",headers:{...i&&{Authorization:`Bearer ${i}`}},body:r}).then(o=>{if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o.json()})}},xt={getAll:(a={})=>
687{const r=new URLSearchParams(a).toString();return $e.get(`/invoices${r?`?${r}`:""}`)},getById:(a,r={})=>{const i=new URLSearchParams(r).toString();return $e.get(`/invoices/${a}${i?`?${i}`:""}`)},create:a=>$e.post("/invoices",a),update:(a,r)=>$e.put(`/invoices/${a}`,r),delete:a=>$e.delete(`/invoices/${a}`),send:(a,r={})=>$e.post(`/invoices/${a}/send`,r),resend:(a,r={})=>$e.post(`/invoices/${a}/resend`,r),sendReminder:(a,r={})=>$e.post(`/invoices/${a}/send-reminder`,r),markPaid:(a,r={})=>$e.patch(`/invoices/${a}/mark-paid`,r),getStats:(a={})=>{const r=new URLSearchParams(a).toString();return $e.get(`/invoices-stats${r?`?${r}`:""}`)},getTemplates:(a={})=>{const r=new URLSearchParams(a).toString();return $e.get(`/invoice-templates${r?`?${r}`:""}`)},getTemplate:a=>$e.get(`/invoice-templates/${a}`),createTemplate:a=>$e.post("/invoice-templates",a),createTemplateWithCompanyData:a=>$e.post("/invoice-templates/create-with-company-data",a),updateTemplate:(a,r)=>$e.put(`/invoice-templates/${a}`,r),deleteTemplate:a=>$e.delete(`/invoice-templates/${a}`),getDefaultTemplate:a=>$e.get(`/invoice-templates/default/${a}`),setDefaultTemplate:a=>$e.patch(`/invoice-templates/${a}/set-default`),downloadPdf:async a=>{try{const r=localStorage.getItem("authToken"),i="http://localhost:8001/api/v1";if(!r)throw new Error("No authentication token found");const o=await fetch(`${i}/invoices/${a}/pdf`,{method:"GET",headers:{Authorization:`Bearer ${r}`,Accept:"application/pdf, */*"}});if(!o.ok){if(o.status===500)return console.warn("Backend PDF generation failed, creating fallback"),await xt.generateFallbackPdf(a);const m=await o.text().catch(()=>`HTTP ${o.status}`);throw new Error(`Failed to download PDF: ${m}`)}const c=o.headers.get("content-type");return c&&!c.includes("application/pdf")?(console.warn("Response is not a PDF, falling back to text download:",c),await xt.generateFallbackPdf(a)):o.blob()}catch(r){console.error("PDF Download Error");try{return await xt.generateFallbackPdf(a)}catch{throw new Error(`PDF generation failed: ${r.message}`)}}},previewPdf:async a=>{try{const r=localStorage.getItem("authToken"),i="http://localhost:8001/api/v1";if(!r)throw new Error("No authentication token found");const o=await fetch(`${i}/invoices/${a}/preview`,{method:"GET",headers:{Authorization:`Bearer ${r}`,Accept:"application/pdf, */*"}});if(!o.ok){if(o.status===500)return console.warn("Backend PDF preview failed, creating fallback"),await xt.generateFallbackPdf(a);const m=await o.text().catch(()=>`HTTP ${o.status}`);throw new Error(`Failed to preview PDF: ${m}`)}const c=o.headers.get("content-type");return c&&!c.includes("application/pdf")?(console.warn("Response is not a PDF, falling back:",c),await xt.generateFallbackPdf(a)):o.blob()}catch(r){console.error("PDF Preview Error:");try{return await xt.generateFallbackPdf(a)}catch{throw new Error(`PDF preview failed: ${r.message}`)}}},generateFallbackPdf:async a=>{try{const i=(await xt.getById(a)).data,o=xt.createSimplePdf(i);return new Blob([o],{type:"application/pdf"})}catch{throw new Error("Unable to generate PDF - please contact support")}},createSimplePdf:a=>`
688INVOICE: ${a.invoice_number||"N/A"}
689Date: ${a.issue_date||"N/A"}
690Due Date: ${a.due_date||"N/A"}
691
692Client: ${a.client?.name||"N/A"}
693Amount: $${a.amount||"0.00"}
694Status: ${a.status||"Unknown"}
695
696Description: ${a.description||"No description"}
697
698This is a simplified invoice representation.
699The full PDF generation is temporarily unavailable.
700    `};function e3({clientId:a,onBack:r,onEdit:i,onNavigateToInvoice:o,onCreateInvoiceForClient:c,onNavigateToProject:m}){const[u,g]=f.useState(null),[x,p]=f.useState(!0),[y,v]=f.useState(null),[w,N]=f.useState("overview"),[D,b]=f.useState(""),[E,_]=f.useState([]),[M,k]=f.useState({subject:"",content:""}),[C,j]=f.useState(0),[O,L]=f.useState(0),[R,H]=f.useState([]);if(f.useEffect(()=>{a&&(async()=>{try{p(!0);const F=await ve.getClient(a);if(F.success)g(F.data),_(F.data.notes?[F.data.notes]:[]);else throw new Error(F.message||"Failed to fetch client")}catch(F){v(F.message)}finally{p(!1)}})()},[a]),f.useEffect(()=>{const $=async()=>{try{const ne=await ve.getProjects({client_id:a});ne.success&&ne.data&&ne.data.data&&j(ne.data.data.length)}catch(ne){console.error("Failed to fetch projects count:",ne.message)}},F=async()=>{try{const ne=await xt.getAll({client_id:a}),T=Array.isArray(ne.data)?ne.data:ne.data?.data||[];H(T);const B=T.filter(ee=>ee.status==="paid").reduce((ee,te)=>ee+(parseFloat(te.total_amount)||0),0);L(B)}catch{console.error("Failed to fetch invoices:"),H([])}};a&&($(),F())},[a]),x)return e.jsxs("div",{className:"p-8 text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary-navy mx-auto mb-4"}),e.jsx("p",{className:"text-neutral-dark",children:"Loading client details..."})]});if(y)return e.jsxs("div",{className:"p-8 text-center",children:[e.jsx(es,{className:"h-12 w-12 text-red-500 mx-auto mb-4"}),e.jsx("h2",{className:"text-2xl font-bold text-primary-navy mb-4",children:"Error Loading Client"}),e.jsx("p",{className:"text-neutral-dark mb-4",children:y}),e.jsxs(G,{onClick:r,children:[e.jsx(ns,{className:"h-4 w-4 mr-2"}),"Back to Clients"]})]});if(!u)return e.jsxs("div",{className:"p-8 text-center",children:[e.jsx(es,{className:"h-12 w-12 text-red-500 mx-auto mb-4"}),e.jsx("h2",{className:"text-2xl font-bold text-primary-navy mb-4",children:"Client Not Found"}),e.jsx("p",{className:"text-neutral-dark mb-4",children:"The requested client could not be found."}),e.jsxs(G,{onClick:r,children:[e.jsx(ns,{className:"h-4 w-4 mr-2"}),"Back to Clients"]})]});const z=$=>{switch($){case"Active":return"bg-green-100 text-green-800";
700case"Prospect":return"bg-blue-100 text-blue-800";case"Inactive":return"bg-gray-100 text-gray-800";case"Paid":return"bg-green-100 text-green-800";case"Pending":return"bg-yellow-100 text-yellow-800";case"Overdue":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}},V=$=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format($),Z=$=>new Date($).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),I=$=>!$||typeof $!="string"?"N/A":$.split(" ").map(F=>F[0]).join("").toUpperCase(),ue=()=>{if(!D.trim())return;const $={id:E.length+1,content:D,author:"Current User",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};_([...E,$]),b("")},X=async()=>{if(!M.subject.trim()||!M.content.trim()){alert("Please fill in both subject and message");return}try{const $=localStorage.getItem("authToken"),F=await fetch(`http://localhost:8001/api/v1/clients/${a}/send-email`,{method:"POST",headers:{Authorization:`Bearer ${$}`,"Content-Type":"application/json"},body:JSON.stringify({to:u.email,subject:M.subject,content:M.content})});if(F.ok){const ne={id:Date.now(),subject:M.subject,content:M.content,from:"[email protected]",to:u.email,date:new Date().toISOString()};g(T=>({...T,emails:[...T.emails||[],ne]})),k({subject:"",content:""}),alert("Email sent successfully!")}else{const ne=await F.json();throw new Error(ne.message||"Failed to send email")}}catch{alert("Failed to send email. This feature requires backend integration.")}},P=()=>{c?c(a):alert("Invoice creation functionality would be integrated with your billing system")};return e.jsxs("div",{className:"p-8 max-w-7xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-8",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(G,{variant:"outline",onClick:r,children:e.jsx(ns,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(_c,{className:"h-16 w-16",children:e.jsx(Dc,{className:"bg-primary-mint text-primary-navy font-medium text-lg",children:I(u.name)})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-primary-navy",children:u.name||"Unnamed Client"}),e.jsx("p",{className:"text-neutral-dark",children:u.company_name||"No company name"}),e.jsx(ze,{className:`mt-1 ${z(u.status)}`,children:u.status})]})]})]}),e.jsxs(G,{onClick:()=>i(u),children:[e.jsx(ya,{className:"h-4 w-4 mr-2"}),"Edit Client"]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-6 mb-8",children:[e.jsx(Ce,{children:e.jsx(vt,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-neutral-dark",children:"Total Revenue"}),e.jsx("p",{className:"text-2xl font-bold text-primary-navy",children:V(O)})]}),e.jsx(fr,{className:"h-8 w-8 text-primary-mint"})]})})}),e.jsx(Ce,{children:e.jsx(vt,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-neutral-dark",children:"Projects"}),e.jsx("p",{className:"text-2xl font-bold text-primary-navy",children:C})]}),e.jsx(Va,{className:"h-8 w-8 text-purple-500"})]})})}),e.jsx(Ce,{children:e.jsx(vt,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-neutral-dark",children:"Total Bills"}),e.jsx("p",{className:"text-2xl font-bold text-primary-navy",children:"0"})]}),e.jsx(_n,{className:"h-8 w-8 text-blue-500"})]})})}),e.jsx(Ce,{children:e.jsx(vt,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-neutral-dark",children:"Email Threads"}),e.jsx("p",{className:"text-2xl font-bold text-primary-navy",children:"0"})]}),e.jsx(Fa,{className:"h-8 w-8 text-green-500"})]})})}),e.jsx(Ce,{children:e.jsx(vt,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-neutral-dark",children:"Notes"}),e.jsx("p",{className:"text-2xl font-bold text-primary-navy",children:E.length})]}),e.jsx(ov,{className:"h-8 w-8 text-orange-500"})]})})})]}),e.jsxs(Vi,{value:w,onValueChange:N,children:[e.jsxs(wl,{className:"grid w-full grid-cols-5",children:[e.jsx(Et,{value:"overview",children:"Overview"}),e.jsx(Et,{value:"projects",children:"Projects"}),e.jsx(Et,{value:"bills",children:"Bills & Invoices"}),e.jsx(Et,{value:"emails",children:"Emails"}),e.jsx(Et,{value:"notes",children:"Notes"})]}),e.jsx(Mt,{value:"overview",className:"space-y-6",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(Ce,{children:[e.jsx(En,{children:e.jsx(Mn,{className:"text-lg text-primary-navy",children:"Contact Information"})}),e.jsxs(vt,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Lt,{className:"h-5 w-5 text-neutral-dark"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-primary-navy",children:u.email}),e.jsx("p",{className:"text-sm text-neutral-dark",children:"Email"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(wf,{className:"h-5 w-5 text-neutral-dark"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-primary-navy",children:u.phone}),e.jsx("p",{className:"text-sm text-neutral-dark",children:"Phone"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(o0,{className:"h-5 w-5 text-neutral-dark"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-primary-navy",children:u.website||"No website"}),e.jsx("p",{className:"text-sm text-neutral-dark",children:"Website"})]})]})]})]}),e.jsxs(Ce,{children:[e.jsx(En,{children:e.jsx(Mn,{className:"text-lg text-primary-navy",children:"Company Details"})}),e.jsxs(vt,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Js,{className:"h-5 w-5 text-neutral-dark"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-primary-navy",children:u.company_name||"No company"}),e.jsx("p",{className:"text-sm text-neutral-dark",children:"Company"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(jS,{className:"h-5 w-5 text-neutral-dark"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-primary-navy",children:u.address||"No address provided"}),e.jsx("p",{className:"text-sm text-neutral-dark",children:"Address"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(os,{className:"h-5 w-5 text-neutral-dark"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-primary-navy",children:Z(u.createdAt)}),e.jsx("p",{className:"text-sm text-neutral-dark",children:"Client Since"})]})]})]})]})]})}),e.jsx(Mt,{value:"projects",className:"space-y-6",children:e.jsx(Ff,{isClientView:!0,clientId:a,onSelectProject:$=>{m?m($):alert(`Project ${$} clicked - would navigate to project detail page`)}})}),e.jsxs(Mt,{value:"bills",className:"space-y-6",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h3",{className:"text-xl font-semibold text-primary-navy",children:"Bills & Invoices"}),e.jsxs(G,{onClick:P,children:[e.jsx(Rt,{className:"h-4 w-4 mr-2"}),"Create Invoice"]})]}),e.jsx("div",{className:"space-y-4",children:R.length>0?R.map($=>e.jsx(Ce,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>o&&o($.id),children:e.jsx(vt,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-primary-mint/10 rounded-lg flex items-center justify-center",children:e.jsx(_n,{className:"h-6 w-6 text-primary-mint"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-primary-navy",children:$.invoice_number||`Invoice #${$.id}`}),e.jsx("p",{className:"text-sm text-neutral-dark",children:$.notes||"No description"}),e.jsxs("p",{className:"text-xs text-neutral-dark",children:["Due: ",$.due_date?Z($.due_date):"No due date",$.paid_date&&` • Paid: ${Z($.paid_date)}`]})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-lg font-bold text-primary-navy",children:V($.total_amount||0)}),e.jsx(ze,{className:`${z($.status)}`,children:$.status}),e.jsx("div",{className:"mt-2",children:e.jsxs("div",{className:"flex items-center gap-1 text-primary-mint hover:text-primary-mint/80",children:[e.jsx(rs,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs",children:"View Invoice"})]})})]})]})})},$.id)):e.jsx(Ce,{children:e.jsxs(vt,{className:"p-12 text-center",children:[e.jsx(_n,{className:"h-12 w-12 text-neutral-dark/50 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-semibold text-primary-navy mb-2",children:"No invoices yet"}),e.jsx("p",{className:"text-neutral-dark",children:"Create your first invoice for this client above."})]})})})]}),e.jsxs(Mt,{value:"emails",className:"space-y-6",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h3",{className:"text-xl font-semibold text-primary-navy",children:"Email Communications"}),e.jsxs(Ds,{children:[e.jsx(E_,{asChild:!0,children:e.jsxs(G,{children:[e.jsx(Ja,{className:"h-4 w-4 mr-2"}),"Send Email"]})}),e.jsxs(vs,{className:"max-w-2xl",children:[e.jsx(Es,{children:e.jsxs(Ms,{children:["Send Email to ",u.contactPerson]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"to",children:"To"}),e.jsx(he,{id:"to",value:u.email,disabled:!0})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"subject",children:"Subject"}),e.jsx(he,{id:"subject",placeholder:"Email subject",value:M.subject,onChange:$=>k({...M,subject:$.target.value})})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"content",children:"Message"}),e.jsx(Ut,{id:"content",placeholder:"Type your message here...",className:"min-h-[120px]",value:M.content,onChange:$=>k({...M,content:$.target.value})})]})]}),e.jsx(Uf,{children:e.jsx(G,{onClick:X,children:"Send Email"})})]})]})]}),e.jsx("div",{className:"space-y-4",children:u.emails?.map($=>e.jsx(Ce,{children:e.jsxs(vt,{className:"p-6",children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-primary-navy",children:$.subject}),e.jsxs("p",{className:"text-sm text-neutral-dark",children:["From: ",$.from," • To: ",$.to]})]}),e.jsx("span",{className:"text-sm text-neutral-dark",children:Z($.date)})]}),e.jsx("p",{className:"text-neutral-dark",children:$.content})]})},$.id))})]}),e.jsx(Mt,{value:"notes",className:"space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-semibold text-primary-navy mb-4",children:"Client Notes"}),e.jsx(Ce,{className:"mb-6",children:e.jsx(vt,{className:"p-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(oe,{htmlFor:"newNote",children:"Add New Note"}),e.jsx(Ut,{id:"newNote",placeholder:"Add a note about this client...",value:D,onChange:$=>b($.target.value),className:"min-h-[100px]"}),e.jsxs(G,{onClick:ue,disabled:!D.trim(),children:[e.jsx(Rt,{className:"h-4 w-4 mr-2"}),"Add Note"]})]})})}),e.jsxs("div",{className:"space-y-4",children:[E.map($=>e.jsx(Ce,{children:e.jsxs(vt,{className:"p-6",children:[e.jsx("div",{className:"flex items-start justify-between mb-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_c,{className:"h-8 w-8",children:e.jsx(Dc,{className:"bg-primary-mint text-primary-navy text-xs",children:I($.author)})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-primary-navy",children:$.author}),e.jsx("p",{className:"text-xs text-neutral-dark",children:new Date($.createdAt).toLocaleStr
700ing()})]})]})}),e.jsx("p",{className:"text-neutral-dark",children:$.content})]})},$.id)),E.length===0&&e.jsx(Ce,{children:e.jsxs(vt,{className:"p-12 text-center",children:[e.jsx(ov,{className:"h-12 w-12 text-neutral-dark/50 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-semibold text-primary-navy mb-2",children:"No notes yet"}),e.jsx("p",{className:"text-neutral-dark",children:"Add your first note about this client above."})]})})]})]})})]})]})}function t3({milestone:a,projectId:r,onClose:i,onSave:o}){const[c,m]=f.useState({title:a?.title||"",description:a?.description||"",dueDate:a?.due_date||"",assignedUserId:a?.assigned_user_id||""}),[u,g]=f.useState({}),[x,p]=f.useState([]),[y,v]=f.useState(!1);f.useEffect(()=>{(async()=>{try{const _=await ve.getTeamMembers({per_page:100});if(_.success){const M=(_.data||[]).filter(k=>k.role!=="client"&&(!k.roles||!k.roles.some(C=>C.name==="client")));p(M)}}catch{console.error("Failed to fetch team members")}})()},[]);const w=()=>{const E={};return c.title.trim()||(E.title="Milestone title is required"),c.dueDate||(E.dueDate="Due date is required"),c.dueDate&&new Date(c.dueDate)<new Date().setHours(0,0,0,0)&&(E.dueDate="Due date cannot be in the past"),g(E),Object.keys(E).length===0},N=(E,_)=>{m(M=>({...M,[E]:_})),u[E]&&g(M=>({...M,[E]:void 0}))},D=async E=>{if(E.preventDefault(),!!w()){v(!0);try{const _={title:c.title,description:c.description,due_date:c.dueDate,assigned_user_id:c.assignedUserId||null};let M;a?M=await ve.updateMilestone(a.id,_):M=await ve.createMilestone(r,_),M.success?o(M.data):console.error("Failed to save milestone:")}catch{console.error("Error saving milestone:")}finally{v(!1)}}},b=x.map(E=>({id:E.id,name:`${E.first_name||""} ${E.last_name||""}`.trim()||E.email}));return e.jsx(Ds,{open:!0,onOpenChange:i,children:e.jsxs(vs,{className:"sm:max-w-[500px]",children:[e.jsx(Es,{children:e.jsx(Ms,{children:a?"Edit Milestone":"Create Milestone"})}),e.jsxs("form",{onSubmit:D,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"title",children:"Title *"}),e.jsx(he,{id:"title",value:c.title,onChange:E=>N("title",E.target.value),placeholder:"Enter milestone title",className:u.title?"border-red-500":""}),u.title&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:u.title})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"description",children:"Description"}),e.jsx(Ut,{id:"description",value:c.description,onChange:E=>N("description",E.target.value),placeholder:"Enter milestone description",rows:3})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"dueDate",children:"Due Date *"}),e.jsxs("div",{className:"relative",children:[e.jsx(os,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-neutral-dark/50 w-4 h-4"}),e.jsx(he,{id:"dueDate",type:"date",value:c.dueDate,onChange:E=>N("dueDate",E.target.value),className:`pl-10 ${u.dueDate?"border-red-500":""}`})]}),u.dueDate&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:u.dueDate})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"assignedUser",children:"Assigned To (Internal Team)"}),e.jsxs("div",{className:"relative",children:[e.jsx(nt,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-neutral-dark/50 w-4 h-4"}),e.jsxs("select",{id:"assignedUser",value:c.assignedUserId,onChange:E=>N("assignedUserId",E.target.value),className:"w-full px-3 py-2 pl-10 border border-neutral-light rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-primary-mint",children:[e.jsx("option",{value:"",children:"Select internal team member (optional)"}),b.map(E=>e.jsx("option",{value:E.id,children:E.name},E.id))]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Choose from your company's team members"})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t border-neutral-light",children:[e.jsx(G,{type:"button",variant:"outline",onClick:i,children:"Cancel"}),e.jsx(G,{type:"submit",disabled:y,className:"bg-primary-mint hover:bg-primary-mint/90 text-white",children:y?"Saving...":a?"Update Milestone":"Create Milestone"})]})]})]})})}function of({task:a,onClose:r,onSave:i,project:o}){const[c,m]=f.useState({title:a?.title||"",description:a?.description||"",status:a?.status||"To Do",priority:a?.priority||"Medium",assignee_id:a?.assignee_id||a?.assigned_user_id||"",due_date:a?.due_date||"",estimated_hours:a?.estimated_hours||"",project_id:a?.project_id||a?.projectId||"",category:a?.category||"",tags:a?.tags?.join(", ")||""}),[u,g]=f.useState([]),[x,p]=f.useState([]),[y,v]=f.useState(!0),[w,N]=f.useState({}),[D,b]=f.useState(""),[E,_]=f.useState(!1);f.useEffect(()=>{(async()=>{try{v(!0);const H=await ve.getTeamMembers();if(H.success&&H.data){const V=H.data.filter(Z=>Z.role!=="client"&&Z.roles&&!Z.roles.some(I=>I.name==="client"));g(V)}else{const V=await ve.getUsers(),I=(V.data||V).filter(ue=>ue.role!=="client"&&(!ue.roles||!ue.roles.some(X=>X.name==="client")));g(I)}const z=await ve.getProjects();z.success&&z.data&&p(z.data.data||z.data),a?.project_id||a?.projectId?m(V=>({...V,project_id:a.project_id||a.projectId})):o?.id&&a&&m(V=>({...V,project_id:o.id}))}catch{console.error("Error loading form data:")}finally{v(!1)}})()},[a,o]),f.useEffect(()=>{a?.category&&!M.includes(a.category)&&a.category!=="Custom..."&&(_(!0),b(a.category))},[a]);
700const M=["Design","Backend","Frontend","Bug Fix","Research","Performance","Documentation","DevOps","Security","Testing","Marketing","Sales","Custom..."],k=()=>{const R={};return c.title.trim()||(R.title="Task title is required"),c.description.trim()||(R.description="Task description is required"),c.assignee_id||(R.assignee_id="Assignee is required"),c.due_date||(R.due_date="Due date is required"),N(R),Object.keys(R).length===0},C=(R,H)=>{m(z=>({...z,[R]:H})),w[R]&&N(z=>({...z,[R]:void 0}))},j=R=>{R==="Custom..."?(_(!0),m(H=>({...H,category:""}))):(_(!1),b(""),m(H=>({...H,category:R})))},O=R=>{b(R),m(H=>({...H,category:R}))},L=async R=>{if(R.preventDefault(),!!k()){({...c,estimatedHours:Number(c.estimated_hours),tags:c.tags.split(",").map(H=>H.trim()).filter(H=>H),timeSpent:a?.timeSpent,createdDate:a?.createdDate||new Date().toISOString().split("T")[0],updatedDate:new Date().toISOString().split("T")[0],...a?{id:a.id}:{id:Date.now()}});try{const H={title:c.title.trim(),description:c.description.trim(),status:c.status,priority:c.priority,project_id:c.project_id,assigned_user_id:c.assignee_id,due_date:c.due_date},z=a?await ve.updateTask(a.id,H):await ve.createTask(H);i&&i(z.data||z)}catch{console.error("Failed to save task:");return}r()}};return e.jsx(Ds,{open:!0,onOpenChange:r,children:e.jsxs(vs,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsx(Es,{children:e.jsx(Ms,{children:a?"Edit Task":"Create New Task"})}),e.jsxs("form",{onSubmit:L,className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"title",children:"Task Title *"}),e.jsx("div",{className:"relative",children:e.jsx(he,{id:"title",value:c.title,onChange:R=>C("title",R.target.value),placeholder:"Enter task title",className:w.title?"border-red-500":""})}),w.title&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:w.title})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"description",children:"Description *"}),e.jsx("div",{className:"relative",children:e.jsx(Ut,{id:"description",value:c.description,onChange:R=>C("description",R.target.value),placeholder:"Describe the task in detail",rows:4,className:w.description?"border-red-500":""})}),w.description&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:w.description})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"status",children:"Status"}),e.jsxs("select",{id:"status",value:c.status,onChange:R=>C("status",R.target.value),className:"w-full p-2 border rounded-md",children:[e.jsx("option",{value:"To Do",children:"To Do"}),e.jsx("option",{value:"In Progress",children:"In Progress"}),e.jsx("option",{value:"Done",children:"Done"})]})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"priority",children:"Priority"}),e.jsxs("select",{id:"priority",value:c.priority,onChange:R=>C("priority",R.target.value),className:"w-full p-2 border rounded-md",children:[e.jsx("option",{value:"Low",children:"Low"}),e.jsx("option",{value:"Medium",children:"Medium"}),e.jsx("option",{value:"High",children:"High"})]})]})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"assignee_id",children:"Assignee *"}),e.jsxs("div",{className:"relative",children:[e.jsx(yt,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-neutral-dark/50 w-4 h-4"}),e.jsxs("select",{id:"assignee_id",value:c.assignee_id,onChange:R=>C("assignee_id",R.target.value),className:`w-full pl-10 p-2 border rounded-md ${w.assignee_id?"border-red-500":""}`,children:[e.jsx("option",{value:"",children:"Select assignee"}),u.map(R=>e.jsxs("option",{value:R.id,children:[R.first_name," ",R.last_name]},R.id))]})]}),w.assignee_id&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:w.assignee_id})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"due_date",children:"Due Date *"}),e.jsxs("div",{className:"relative",children:[e.jsx(os,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-neutral-dark/50 w-4 h-4"}),e.jsx(he,{id:"due_date",type:"date",value:c.due_date,onChange:R=>C("due_date",R.target.value),className:`pl-10 ${w.due_date?"border-red-500":""}`})]}),w.due_date&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:w.due_date})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"estimated_hours",children:"Estimated Hours (Optional)"}),e.jsxs("div",{className:"relative",children:[e.jsx(xs,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-neutral-dark/50 w-4 h-4"}),e.jsx(he,{id:"estimated_hours",type:"number",min:"0.5",step:"0.5",value:c.estimated_hours,onChange:R=>C("estimated_hours",R.target.value),placeholder:"e.g., 4.5 (not stored)",className:"pl-10"})]}),e.jsx("p",{className:"text-sm text-neutral-dark/60 mt-1",children:"For planning only - not stored in database"})]})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"project_id",children:"Project (Optional)"}),e.jsxs("div",{className:"relative",children:[e.jsx(Va,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-neutral-dark/50 w-4 h-4"}),e.jsxs("select",{id:"project_id",value:c.project_id,onChange:R=>C("project_id",R.target.value),className:"w-full pl-10 p-2 border rounded-md",children:[e.jsx("option",{value:"",children:"No project selected"}),x.map(R=>e.jsxs("option",{value:R.id,children:[R.name," ",R.client_name?`(${R.client_name})`:""]},R.id))]})]})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"category",children:"Category (Optional)"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(jc,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-neutral-dark/50 w-4 h-4"}),e.jsxs("select",{id:"category",value:E?"Custom...":c.category,onChange:R=>j(R.target.value),className:"w-full pl-10 p-2 border rounded-md",children:[e.jsx("option",{value:"",children:"Select category (optional)"}),M.map(R=>e.jsx("option",{value:R,children:R},R))]})]}),E&&e.jsxs("div",{className:"relative",children:[e.jsx(jc,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-neutral-dark/50 w-4 h-4"}),e.jsx(he,{id:"customCategory",value:D,onChange:R=>O(R.target.value),placeholder:"Enter your custom category",className:"pl-10"})]})]}),e.jsxs("p",{className:"text-sm text-neutral-dark/60 mt-1",children:["Category is for organizing tasks but not stored in database.",E?" Enter your custom category above.":' Select from list or choose "Custom..." to create your own.']})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"tags",children:"Tags"}),e.jsxs("div",{className:"relative",children:[e.jsx(jc,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-neutral-dark/50 w-4 h-4"}),e.jsx(he,{id:"tags",value:c.tags,onChange:R=>C("tags",R.target.value),placeholder:"e.g., frontend, urgent, bug (comma separated)",className:"pl-10"})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t border-neutral-light",children:[e.jsx(G,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),e.jsx(G,{type:"submit",className:"bg-primary-mint hover:bg-primary-mint/90 text-white",children:a?"Update Task":"Create Task"})]})]})]})})}function cf({isOpen:a,onClose:r,document:i,project:o,onDocumentUploaded:c,onDocumentSaved:m}){const[u,g]=f.useState({name:i?.name||"",description:i?.description||"",type:i?.type||"other",project_id:o?.id||i?.project_id||""}),[x,p]=f.useState(null),[y,v]=f.useState(!1),[w,N]=f.useState(!1),[D,b]=f.useState([]),[E,_]=f.useState(!1),M=!!i,k=!o&&!M;f.useEffect(()=>{k&&(async()=>{try{_(!0);const V=await ve.getProjects();if(V?.data){const Z=V.data.data||V.data;b(Array.isArray(Z)?Z:[])}}catch{console.error("Failed to load projects:")}finally{_(!1)}})()},[k]);const C=(z,V)=>{g(Z=>({...Z,[z]:V}))},j=z=>{if(p(z),z){const V=z.name.split(".")[0],Z=z.name.split(".").pop().toLowerCase();let I="other";["jpg","jpeg","png","gif","webp"].includes(Z)?I="image":["pdf"].includes(Z)&&
700(I="report"),g(ue=>({...ue,name:ue.name||V,type:ue.type==="other"?I:ue.type}))}},O=z=>{z.preventDefault(),z.stopPropagation(),z.type==="dragenter"||z.type==="dragover"?v(!0):z.type==="dragleave"&&v(!1)},L=z=>{z.preventDefault(),z.stopPropagation(),v(!1),z.dataTransfer.files&&z.dataTransfer.files[0]&&j(z.dataTransfer.files[0])},R=async z=>{if(z.preventDefault(),M)try{N(!0);const V=await ve.updateDocument(i.id,u);V.data&&(c?.(V.data),Nt.success("Document updated successfully!")),r()}catch{Nt.error("Failed to update document. Please try again.")}finally{N(!1)}else{if(!x){Nt.warning("Please select a file to upload");return}if(!u.project_id){Nt.warning("Please select a project");return}try{N(!0);const V=new FormData;V.append("file",x),V.append("name",u.name),V.append("description",u.description||""),V.append("type",u.type),V.append("project_id",u.project_id);const Z=await ve.uploadDocument(V);Z.data&&(c?.(Z.data),m?.(Z.data),Nt.success(`Document "${u.name}" uploaded successfully!`)),r()}catch{Nt.error("Failed to upload document. Please check your file and try again.")}finally{N(!1)}}},H=[{value:"contract",label:"Contract"},{value:"invoice",label:"Invoice"},{value:"report",label:"Report"},{value:"image",label:"Image"},{value:"other",label:"Other"}];return e.jsx(Ds,{open:a,onOpenChange:r,children:e.jsxs(vs,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsx(Es,{children:e.jsxs(Ms,{className:"flex items-center gap-2",children:[e.jsx(yc,{className:"h-5 w-5"}),M?"Edit Document":"Upload Document"]})}),e.jsxs("form",{onSubmit:R,className:"space-y-6",children:[!M&&e.jsxs(Ce,{className:"p-6",children:[e.jsx(oe,{className:"text-base font-medium mb-4 block",children:"Document File *"}),e.jsx("div",{className:`border-2 border-dashed rounded-lg p-8 text-center transition-colors ${y?"border-primary-mint bg-primary-mint/5":"border-neutral-light hover:border-primary-mint/50"}`,onDragEnter:O,onDragLeave:O,onDragOver:O,onDrop:L,children:x?e.jsxs("div",{className:"space-y-2",children:[e.jsx(yc,{className:"h-12 w-12 text-primary-mint mx-auto"}),e.jsx("p",{className:"font-medium text-primary-navy",children:x.name}),e.jsxs("p",{className:"text-sm text-neutral-dark/70",children:[(x.size/1024/1024).toFixed(1)," MB"]}),e.jsx(G,{type:"button",variant:"outline",size:"sm",onClick:()=>p(null),children:"Remove File"})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsx(pa,{className:"h-12 w-12 text-neutral-dark/30 mx-auto"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-lg font-medium text-primary-navy",children:"Drop your file here, or click to browse"}),e.jsx("p",{className:"text-neutral-dark/70",children:"Supports PDF, DOC, XLS, PPT, and image files"})]}),e.jsx("input",{type:"file",onChange:z=>j(z.target.files[0]),className:"hidden",id:"file-upload",accept:".pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.jpg,.jpeg,.png,.gif"}),e.jsx(G,{type:"button",asChild:!0,children:e.jsx("label",{htmlFor:"file-upload",className:"cursor-pointer",children:"Choose File"})})]})})]}),e.jsxs(Ce,{className:"p-6",children:[e.jsxs("h3",{className:"text-lg font-semibold text-primary-navy mb-4 flex items-center",children:[e.jsx(yc,{className:"h-5 w-5 mr-2"}),"Document Information"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"name",children:"Document Name *"}),e.jsx(he,{id:"name",value:u.name,onChange:z=>C("name",z.target.value),placeholder:"Enter document name",required:!0})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"description",children:"Description"}),e.jsx(Ut,{id:"description",value:u.description,onChange:z=>C("description",z.target.value),placeholder:"Enter document description",rows:3})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"type",children:"Document Type"}),e.jsx("select",{id:"type",value:u.type,onChange:z=>C("type",z.target.value),className:"w-full px-3 py-2 border border-neutral-light rounded-lg",children:H.map(z=>e.jsx("option",{value:z.value,children:z.label},z.value))})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"project",children:"Project *"}),k?e.jsxs(e.Fragment,{children:[e.jsxs("select",{id:"project",value:u.project_id,onChange:z=>C("project_id",z.target.value),className:"w-full px-3 py-2 border border-neutral-light rounded-lg",required:!0,children:[e.jsx("option",{value:"",children:"Select a project"}),D.map(z=>e.jsx("option",{value:z.id,children:z.name},z.id))]}),E&&e.jsx("p",{className:"text-xs text-neutral-dark/60 mt-1",children:"Loading projects..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(he,{id:"project",value:o?.name||"No project selected",disabled:!0,className:"bg-gray-50"}),e.jsx("p",{className:"text-xs text-neutral-dark/60 mt-1",children:"Document will be uploaded to this project"})]})]})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-4 border-t border-neutral-light",children:[e.jsx(G,{type:"button",variant:"outline",onClick:r,disabled:w,children:"Cancel"}),e.jsxs(G,{type:"submit",disabled:w,children:[w?e.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent roun
700ded-full animate-spin mr-2"}):e.jsx(Nr,{className:"h-4 w-4 mr-2"}),w?"Uploading...":M?"Update Document":"Upload Document"]})]})]})]})})}function Bf(a){const r=f.useRef({value:a,previous:a});return f.useMemo(()=>(r.current.value!==a&&(r.current.previous=r.current.value,r.current.value=a),r.current.previous),[a])}function qf(a){const[r,i]=f.useState(void 0);return $t(()=>{if(a){i({width:a.offsetWidth,height:a.offsetHeight});const o=new ResizeObserver(c=>{if(!Array.isArray(c)||!c.length)return;const m=c[0];let u,g;if("borderBoxSize"in m){const x=m.borderBoxSize,p=Array.isArray(x)?x[0]:x;u=p.inlineSize,g=p.blockSize}else u=a.offsetWidth,g=a.offsetHeight;i({width:u,height:g})});return o.observe(a,{box:"border-box"}),()=>o.unobserve(a)}else i(void 0)},[a]),r}var ed="Checkbox",[s3,$M]=Bs(ed),[a3,Hf]=s3(ed);function n3(a){const{__scopeCheckbox:r,checked:i,children:o,defaultChecked:c,disabled:m,form:u,name:g,onCheckedChange:x,required:p,value:y="on",internal_do_not_use_render:v}=a,[w,N]=Ya({prop:i,defaultProp:c??!1,onChange:x,caller:ed}),[D,b]=f.useState(null),[E,_]=f.useState(null),M=f.useRef(!1),k=D?!!u||!!D.closest("form"):!0,C={checked:w,disabled:m,setChecked:N,control:D,setControl:b,name:g,form:u,value:y,hasConsumerStoppedPropagationRef:M,required:p,defaultChecked:Tn(c)?!1:c,isFormControl:k,bubbleInput:E,setBubbleInput:_};return e.jsx(a3,{scope:r,...C,children:r3(v)?v(C):o})}var Yy="CheckboxTrigger",Xy=f.forwardRef(({__scopeCheckbox:a,onKeyDown:r,onClick:i,...o},c)=>{const{control:m,value:u,disabled:g,checked:x,required:p,setControl:y,setChecked:v,hasConsumerStoppedPropagationRef:w,isFormControl:N,bubbleInput:D}=Hf(Yy,a),b=it(c,y),E=f.useRef(x);return f.useEffect(()=>{const _=m?.form;if(_){const M=()=>v(E.current);return _.addEventListener("reset",M),()=>_.removeEventListener("reset",M)}},[m,v]),e.jsx(Be.button,{type:"button",role:"checkbox","aria-checked":Tn(x)?"mixed":x,"aria-required":p,"data-state":Wy(x),"data-disabled":g?"":void 0,disabled:g,value:u,...o,ref:b,onKeyDown:Te(r,_=>{_.key==="Enter"&&_.preventDefault()}),onClick:Te(i,_=>{v(M=>Tn(M)?!0:!M),D&&N&&(w.current=_.isPropagationStopped(),w.current||_.stopPropagation())})})});Xy.displayName=Yy;var Vf=f.forwardRef((a,r)=>{const{__scopeCheckbox:i,name:o,checked:c,defaultChecked:m,required:u,disabled:g,value:x,onCheckedChange:p,form:y,...v}=a;return e.jsx(n3,{__scopeCheckbox:i,checked:c,defaultChecked:m,disabled:g,required:u,onCheckedChange:p,name:o,form:y,value:x,internal_do_not_use_render:({isFormControl:w})=>e.jsxs(e.Fragment,{children:[e.jsx(Xy,{...v,ref:r,__scopeCheckbox:i}),w&&e.jsx(Jy,{__scopeCheckbox:i})]})})});Vf.displayName=ed;var Ky="CheckboxIndicator",Zy=f.forwardRef((a,r)=>{const{__scopeCheckbox:i,forceMount:o,...c}=a,m=Hf(Ky,i);return e.jsx(aa,{present:o||Tn(m.checked)||m.checked===!0,children:e.jsx(Be.span,{"data-state":Wy(m.checked),"data-disabled":m.disabled?"":void 0,...c,ref:r,style:{pointerEvents:"none",...a.style}})})});Zy.displayName=Ky;var Qy="CheckboxBubbleInput",Jy=f.forwardRef(({__scopeCheckbox:a,...r},i)=>{const{control:o,hasConsumerStoppedPropagationRef:c,checked:m,defaultChecked:u,required:g,disabled:x,name:p,value:y,form:v,bubbleInput:w,setBubbleInput:N}=Hf(Qy,a),D=it(i,N),b=Bf(m),E=qf(o);f.useEffect(()=>{const M=w;if(!M)return;const k=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(k,"checked").set,O=!c.current;if(b!==m&&j){const L=new Event("click",{bubbles:O});M.indeterminate=Tn(m),j.call(M,Tn(m)?!1:m),M.dispatchEvent(L)}},[w,b,m,c]);const _=f.useRef(Tn(m)?!1:m);return e.jsx(Be.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??_.current,required:g,disabled:x,name:p,value:y,form:v,...r,tabIndex:-1,ref:D,style:{...r.style,...E,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Jy.displayName=Qy;function r3(a){return typeof a=="function"}function Tn(a){return a==="indeterminate"}function Wy(a){return Tn(a)?"indeterminate":a?"checked":"unchecked"}const Ba=f.forwardRef(({className:a,...r},i)=>e.jsx(Vf,{ref:i,className:Ge("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",a),...r,children:e.jsx(Zy,{className:Ge("flex items-center justify-center text-current"),children:e.jsx(br,{className:"h-4 w-4"})})}));Ba.displayName=Vf.displayName;function l3({isOpen:a,onClose:r,availableMembers:i,onSelectMembers:o}){const[c,m]=f.useState([]),u=p=>{m(y=>y.includes(p)?y.filter(v=>v!==p):[...y,p])},g=()=>{c.length>0&&(o(c),m([]))},x=()=>{m([]),r()};return a?e.jsx(Ds,{open:a,onOpenChange:x,children:e.jsxs(vs,{className:"max-w-md",children:[e.jsx(Es,{children:e.jsxs(Ms,{className:"flex items-center gap-2",children:[e.jsx(yt,{className:"w-5 h-5 text-primary-mint"}),"Add Team Members"]})}),e.jsx("div",{className:"space-y-4",children:i.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(yt,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"No available team members"}),e.jsx("p",{className:"text-muted-foreground text-xs mt-1",children:"All users are already on this project"})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"Select team members to add to this project:"}),e.jsx("div",{className:"max-h-64 overflow-y-auto space-y-2",children:i.map(p=>{const y=p.first_name&&p.last_name?`${p.first_name} ${p.last_name}`:p.name||p.email,v=typeof y=="string"?y.split(" ").map(w=>w[0]).join(""):"U";return e.jsxs("div",{className:"flex items-center gap-3 p-3 border border-border rounded-lg hover:bg-muted/50 cursor-pointer",onClick:()=>u(p.id),children:[e.jsx(Ba,{checked:c.includes(p.id),onChange:()=>u(p.id)}),e.jsx("div",{className:"w-8 h-8 bg-primary-navy rounded-full flex items-center justify-center text-white text-sm font-semibold",children:v}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium text-card-foreground",children:y}),e.jsx("p",{className:"text-xs text-muted-foreground",children:p.email})]})]},`member-${p.id}`)})}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t",children:[e.jsx(G,{variant:"outline",onClick:x,children:"Cancel"}),e.jsxs(G,{onClick:g,disabled:c.length===0,className:"bg-primary-mint hover:bg-primary-mint/90 text-white",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"Add ",c.length," Member",c.length!==1?"s":""]})]})]})})]})}):null}function i3({projectId:a,onBack:r,onEdit:i,refreshTrigger:o}){const[c,m]=f.useState(null),[u,g]=f.useState([]),[x,p]=f.useState(!0),[y,v]=f.useState(null),[w,N]=f.useState(!1),[D,b]=f.useState(null),[E,_]=f.useState(!1),[M,k]=f.useState(null),[C,j]=f.useState(null),[O,L]=f.useState(!1),[R,H]=f.useState(null),[z,V]=f.useState(!1),[Z,I]=f.useState([]),[ue,X]=f.useState(!1);f.useEffect(()=>{const le=Ne=>({id:Ne.id,name:Ne.name,description:Ne.description||"",clientName:Ne.client?.company_name||Ne.client?.name||"",client_id:Ne.client_id,status:Ne.status||"",priority:Ne.priority||"",startDate:Ne.start_date,endD
700ate:Ne.end_date,dueDate:Ne.due_date,budget:Number(Ne.budget)||0,actualCost:Number(Ne.actual_hours)||0,progress:Ne.progress||0,teamMembers:Ne.team_members||[],manager:Ne.manager,projectManager:Ne.manager?.first_name&&Ne.manager?.last_name?`${Ne.manager.first_name} ${Ne.manager.last_name}`:Ne.manager?.name||"",tasks:Ne.tasks||[],documents:Ne.documents||[],milestones:Ne.milestones||[],timeEntries:Ne.time_entries||[],tags:Ne.tags||[],isBillable:Ne.is_billable||!1,hourlyRate:Number(Ne.hourly_rate)||0,estimatedHours:Number(Ne.estimated_hours)||0,actualHours:Number(Ne.actual_hours)||0}),Le=async()=>{try{p(!0);const Ne=await ve.getProject(a);Ne.data?m(le(Ne.data)):Ne&&m(le(Ne))}catch(Ne){v(Ne.message||"Failed to load project")}finally{p(!1)}},Ye=async()=>{try{const Ne=await ve.getActivities({project_id:a});Ne.data&&g(Ne.data)}catch{console.error("Failed to load activities:")}};Le(),Ye()},[a,o]);const[P,$]=f.useState("overview"),F=()=>{b(null),N(!0)},ne=le=>{b(le),N(!0)},T=le=>{m(D?Le=>({...Le,milestones:Le.milestones.map(Ye=>Ye.id===le.id?le:Ye)}):Le=>({...Le,milestones:[...Le.milestones,le]})),N(!1),b(null),B()},B=async()=>{try{const le=await ve.getActivities({project_id:a});le.data&&g(le.data)}catch{console.error("Failed to load activities:")}},ee=async le=>{try{const Le=await ve.toggleMilestoneCompletion(le.id);Le.success&&m(Ye=>({...Ye,milestones:Ye.milestones.map(Ne=>Ne.id===le.id?Le.data:Ne)}))}catch{console.error("Error toggling milestone:")}},te=async le=>{if(window.confirm("Are you sure you want to delete this milestone?"))try{(await ve.deleteMilestone(le.id)).success&&m(Ye=>({...Ye,milestones:Ye.milestones.filter(Ne=>Ne.id!==le.id)}))}catch{console.error("Failed to delete milestone:")}},ye=()=>{k(null),_(!0)},ge=le=>{k(le),_(!0)},K=async le=>{try{j(le.id);const Le=await ve.toggleTask(le.id);Le.success&&(m(Ye=>({...Ye,tasks:Ye.tasks.map(Ne=>Ne.id===le.id?Le.data:Ne)})),B())}catch{console.error("Failed to toggle task:")}finally{j(null)}},re=async le=>{try{const Le={...le,project_id:a};if(M){const Ye=await ve.updateTask(M.id,Le);if(Ye.data||Ye){const Ne=Ye.data||Ye;m(jt=>({...jt,tasks:jt.tasks.map(Wa=>Wa.id===Ne.id?Ne:Wa)}))}}else{const Ye=await ve.createTask(Le);if(Ye.data||Ye){const Ne=Ye.data||Ye;m(jt=>({...jt,tasks:[...jt.tasks||[],Ne]}))}}_(!1),k(null),B()}catch{console.error("Failed to save task:")}},je=()=>{H(null),L(!0)},Ae=le=>{m(Le=>({...Le,documents:[...Le.documents||[],le]}))},ie=async le=>{try{const Le=await ve.getDocumentDownloadUrl(le.id);Le.download_url&&window.open(Le.download_url,"_blank")}catch{console.error("Failed to download document:")}},we=async()=>{try{X(!0);const le=await ve.getTeamMembers();if(le.data){const Le=c.teamMembers?.map(Ne=>Ne.id)||[],Ye=le.data.filter(Ne=>!Le.includes(Ne.id));I(Ye)}V(!0)}catch{console.error("Failed to load team members:")}finally{X(!1)}},_e=async le=>{try{const Le=c.teamMembers?.map(jt=>jt.id)||[],Ye=[...new Set([...Le,...le])],Ne=await ve.updateProject(a,{team_member_ids:Ye});Ne.success&&Ne.data&&(m(jt=>({...jt,teamMembers:Ne.data.teamMembers||Ne.data.team_members||[]})),B()),V(!1)}catch{console.error("Failed to add team member:")}},me=async le=>{if(window.confirm("Are you sure you want to remove this team member from the project?"))try{const Ye=(c.teamMembers?.map(jt=>jt.id)||[]).filter(jt=>jt!==le),Ne=await ve.updateProject(a,{team_member_ids:Ye});Ne.success&&Ne.data&&(m(jt=>({...jt,teamMembers:Ne.data.teamMembers||Ne.data.team_members||[]})),B())}catch{console.error("Failed to remove team member:")}};if(x)return e.jsx("div",{className:"p-6 text-center",children:e.jsx("p",{className:"text-muted-foreground",children:"Loading project..."})});if(y)return e.jsxs("div",{className:"p-6 text-center",children:[e.jsx("h2",{className:"text-xl font-semibold text-destructive mb-2",children:y}),e.jsxs(G,{onClick:r,variant:"outline",children:[e.jsx(ns,{className:"w-4 h-4 mr-2"}),"Back to Projects"]})]});if(!c)return e.jsxs("div",{className:"p-6 text-center",children:[e.jsx("h2",{className:"text-xl font-semibold text-neutral-dark mb-2",children:"Project not found"}),e.jsxs(G,{onClick:r,variant:"outline",children:[e.jsx(ns,{className:"w-4 h-4 mr-2"}),"Back to Projects"]})]});const Se=le=>{switch(le){case"In Progress":return"bg-primary-mint text-white";case"Completed":return"bg-green-500 text-white";case"On Hold":return"bg-yellow-500 text-white";case"Planning":return"bg-primary-navy text-white";default:return"bg-neutral-dark text-white"}},Pe=le=>{switch(le){case"High":return"bg-red-500 text-white";case"Medium":return"bg-yellow-500 text-white";case"Low":return"bg-green-500 text-white";default:return"bg-neutral-dark text-white"}},pt=le=>{switch(le){case"Done":return"bg-green-100 text-green-800";
700case"In Progress":return"bg-blue-100 text-blue-800";case"To Do":return"bg-gray-100 text-gray-800";default:return"bg-gray-100 text-gray-800"}},Ve=le=>le==null||isNaN(le)?"$0":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(le),bt=le=>{if(!le||le==="Invalid Date")return"Not set";try{const Le=new Date(le);return isNaN(Le.getTime())?"Invalid date":Le.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return"Invalid date"}},ds=()=>{if(!c.milestones||c.milestones.length===0)return 0;const le=c.milestones.filter(Le=>Le.status==="Completed").length;return Math.round(le/c.milestones.length*100)};return e.jsxs("div",{className:"p-6 max-w-7xl mx-auto",children:[e.jsxs("div",{className:"flex justify-between items-start mb-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(G,{onClick:r,variant:"outline",size:"sm",children:[e.jsx(ns,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-foreground",children:c.name}),e.jsx("p",{className:"text-muted-foreground mt-1",children:c.clientName})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ze,{className:Se(c.status),children:c.status}),e.jsxs(ze,{className:Pe(c.priority),children:[c.priority," Priority"]}),e.jsxs(G,{onClick:()=>i(c),className:"bg-primary-mint hover:bg-primary-mint/90 text-white",children:[e.jsx(ya,{className:"w-4 h-4 mr-2"}),"Edit Project"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 mb-6",children:[e.jsxs("div",{className:"bg-card rounded-lg shadow-sm border border-border p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Progress"}),e.jsxs("p",{className:"text-2xl font-bold text-card-foreground",children:[c.milestones?.length>0?ds():c.progress||0,"%"]})]}),e.jsx(yl,{className:"w-8 h-8 text-primary-mint"})]}),e.jsx("div",{className:"w-full bg-muted rounded-full h-2 mt-2",children:e.jsx("div",{className:"bg-primary-mint h-2 rounded-full transition-all duration-300",style:{width:`${c.milestones?.length>0?ds():c.progress||0}%`}})}),c.milestones?.length>0&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Based on ",c.milestones.filter(le=>le.status==="Completed").length," of ",c.milestones.length," milestones"]})]}),e.jsxs("div",{className:"bg-card rounded-lg shadow-sm border border-border p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Budget"}),e.jsx("p",{className:"text-2xl font-bold text-card-foreground",children:Ve(c.budget)})]}),e.jsx(fr,{className:"w-8 h-8 text-green-500"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Spent: ",Ve(c.actualCost)]})]}),e.jsxs("div",{className:"bg-card rounded-lg shadow-sm border border-border p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Team Size"}),e.jsx("p",{className:"text-2xl font-bold text-card-foreground",children:c.teamMembers?.length||0})]}),e.jsx(yt,{className:"w-8 h-8 text-blue-500"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["PM: ",c.projectManager||"Not assigned"]})]}),e.jsxs("div",{className:"bg-card rounded-lg shadow-sm border border-border p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Tasks"}),e.jsx("p",{className:"text-2xl font-bold text-card-foreground",children:c.tasks?.length||0})]}),e.jsx(Ws,{className:"w-8 h-8 text-purple-500"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[c.tasks?.filter(le=>le.status==="Done").length||0," completed"]})]})]}),e.jsxs(Vi,{value:P,onValueChange:$,children:[e.jsxs(wl,{className:"grid w-full grid-cols-5",children:[e.jsx(Et,{value:"overview",children:"Overview"}),e.jsx(Et,{value:"tasks",children:"Tasks"}),e.jsx(Et,{value:"milestones",children:"Milestones"}),e.jsx(Et,{value:"team",children:"Team"}),e.jsx(Et,{value:"documents",children:"Documents"})]}),e.jsx(Mt,{value:"overview",className:"space-y-6",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-card rounded-lg shadow-sm border border-border p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-card-foreground mb-4",children:"Project Details"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(oe,{className:"text-sm font-medium text-muted-foreground",children:"Description"}),e.jsx("p",{className:"text-sm text-card-foreground mt-1",children:c.description})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(oe,{className:"text-sm font-medium text-muted-foreground",children:"Start Date"}),e.jsx("p",{className:"text-sm text-card-foreground mt-1",children:bt(c.startDate)})]}),e.jsxs("div",{children:[e.jsx(oe,{className:"text-sm font-medium text-muted-foreground",children:"End Date"}),e.jsx("p",{className:"text-sm text-card-foreground mt-1",children:bt(c.endDate)})]})]}),e.jsxs("div",{children:[e.jsx(oe,{className:"text-sm font-medium text-muted-foreground",children:"Tags"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:c.tags?.map((le,Le)=>e.jsx(ze,{variant:"secondary",children:le},Le))||e.jsx("span",{className:"text-muted-foreground text-sm",children:"No tags"})})]})]})]}),e.jsxs("div",{className:"bg-card rounded-lg shadow-sm border border-border p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-card-foreground mb-4",children:"Recent Activity"}),e.jsx("div",{className:"space-y-3",children:u?.slice(0,5).map(le=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-card-foreground",children:le.user.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:le.description}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx("span",{className:"text-xs px-2 py-0.5 bg-primary-mint/10 text-primary-mint rounded-full",children:le.action}),e.jsx("span",{className:"text-xs text-muted-foreground",children:le.
700subject_type})]})]}),e.jsx("div",{className:"text-right",children:e.jsx("p",{className:"text-xs text-muted-foreground",children:le.time_ago})})]},le.id))||e.jsx("p",{className:"text-muted-foreground text-sm",children:"No recent activity"})})]})]})}),e.jsxs(Mt,{value:"tasks",className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-neutral-dark",children:"Project Tasks"}),e.jsxs(G,{onClick:ye,className:"bg-primary-mint hover:bg-primary-mint/90 text-white",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"Add Task"]})]}),e.jsx("div",{className:"bg-card rounded-lg shadow-sm border border-border",children:e.jsx("div",{className:"p-6",children:e.jsx("div",{className:"space-y-4",children:c.tasks?.map(le=>e.jsxs("div",{className:"flex items-center gap-4 p-4 border border-border rounded-lg",children:[e.jsx("button",{onClick:()=>K(le),disabled:C===le.id,title:le.status==="Done"?"Mark as incomplete":"Mark as complete",className:`flex-shrink-0 w-6 h-6 rounded border-2 flex items-center justify-center transition-colors ${le.status==="Done"?"bg-green-500 border-green-500 text-white":"border-gray-300 hover:border-green-400"} ${C===le.id?"opacity-50 cursor-not-allowed":""}`,children:C===le.id?e.jsx("div",{className:"w-3 h-3 border-2 border-current border-t-transparent rounded-full animate-spin"}):le.status==="Done"?e.jsx(Ws,{className:"w-4 h-4"}):null}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h4",{className:`font-medium ${le.status==="Done"?"line-through text-neutral-dark/60":"text-neutral-dark"}`,children:le.title}),e.jsx(ze,{className:pt(le.status),children:le.status}),e.jsx(ze,{className:Pe(le.priority),children:le.priority})]}),e.jsx("p",{className:`text-sm mb-2 ${le.status==="Done"?"line-through text-neutral-dark/50":"text-neutral-dark/70"}`,children:le.description}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-neutral-dark/60",children:[e.jsxs("span",{children:["Assigned to: ",le.assignee?`${le.assignee.first_name} ${le.assignee.last_name}`:"Unassigned"]}),e.jsxs("span",{children:["Due: ",bt(le.due_date||le.dueDate)]}),(le.completed_date||le.completedDate)&&e.jsxs("span",{children:["Completed: ",bt(le.completed_date||le.completedDate)]})]})]}),e.jsx("button",{onClick:()=>ge(le),className:"flex-shrink-0 p-2 hover:bg-neutral-light rounded",children:e.jsx(va,{className:"w-4 h-4 text-neutral-dark/50"})})]},le.id))||e.jsx("p",{className:"text-muted-foreground text-sm",children:"No tasks found"})})})})]}),e.jsxs(Mt,{value:"milestones",className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-neutral-dark",children:"Project Milestones"}),e.jsxs(G,{onClick:F,className:"bg-primary-mint hover:bg-primary-mint/90 text-white",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"Add Milestone"]})]}),e.jsx("div",{className:"bg-white rounded-lg shadow-sm border border-neutral-light",children:e.jsx("div",{className:"p-6",children:e.jsx("div",{className:"space-y-4",children:c.milestones?.length>0?c.milestones.map(le=>e.jsxs("div",{className:"flex items-center gap-4 p-4 border border-neutral-light rounded-lg hover:bg-gray-50",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("button",{onClick:()=>ee(le),className:`w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors ${le.status==="Completed"?"bg-green-500 border-green-500 text-white":"border-gray-300 hover:border-primary-mint"}`,children:le.status==="Completed"&&"✓"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium text-neutral-dark",children:le.title}),le.description&&e.jsx("p",{className:"text-sm text-neutral-dark/70 mt-1",children:le.description}),e.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-neutral-dark/60",children:[e.jsxs("span",{children:["Due: ",bt(le.due_date)]}),le.assigned_user&&e.jsxs("span",{children:["Assigned: ",le.assigned_user.first_name," ",le.assigned_user.last_name]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ze,{className:pt(le.status),children:le.
700status}),e.jsx("button",{onClick:()=>ne(le),className:"p-1 hover:bg-gray-200 rounded",children:e.jsx(ya,{className:"w-4 h-4 text-gray-500"})}),e.jsx("button",{onClick:()=>te(le),className:"p-1 hover:bg-red-100 rounded",children:e.jsx(gs,{className:"w-4 h-4 text-red-500"})})]})]},le.id)):e.jsxs("div",{className:"text-center py-8",children:[e.jsx(Sf,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"No milestones found"}),e.jsx("p",{className:"text-muted-foreground text-xs mt-1",children:"Create your first milestone to track project progress"})]})})})})]}),e.jsxs(Mt,{value:"team",className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-neutral-dark",children:"Team Members"}),e.jsxs(G,{onClick:we,disabled:ue,className:"bg-primary-mint hover:bg-primary-mint/90 text-white",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),ue?"Loading...":"Add Member"]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:c.teamMembers?.map((le,Le)=>{const Ye=le.first_name&&le.last_name?`${le.first_name} ${le.last_name}`:le.name||le.user?.name||le,Ne=typeof Ye=="string"?Ye.split(" ").map(jt=>jt[0]).join(""):"TM";return e.jsx("div",{className:"bg-white rounded-lg shadow-sm border border-neutral-light p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-primary-navy rounded-full flex items-center justify-center text-white font-semibold",children:Ne}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-neutral-dark",children:Ye}),e.jsx("p",{className:"text-sm text-neutral-dark/70",children:Ye===c.projectManager?"Project Manager":"Team Member"})]})]}),Ye!==c.projectManager&&e.jsx("button",{onClick:()=>me(le.id),className:"p-1 hover:bg-red-100 rounded text-red-500 hover:text-red-700",title:"Remove team member",children:e.jsx(gs,{className:"w-4 h-4"})})]})},Le)})||e.jsx("p",{className:"text-muted-foreground text-sm",children:"No team members found"})})]}),e.jsxs(Mt,{value:"documents",className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-neutral-dark",children:"Project Documents"}),e.jsxs(G,{onClick:je,className:"bg-primary-mint hover:bg-primary-mint/90 text-white",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"Upload Document"]})]}),e.jsx("div",{className:"bg-white rounded-lg shadow-sm border border-neutral-light",children:e.jsx("div",{className:"p-6",children:e.jsx("div",{className:"space-y-3",children:c.documents?.length>0?c.documents.map(le=>e.jsxs("div",{className:"flex items-center justify-between p-3 border border-neutral-light rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ot,{className:"w-8 h-8 text-blue-500"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-neutral-dark",children:le.name}),e.jsxs("p",{className:"text-sm text-neutral-dark/70",children:[le.file_size_human||"Unknown size"," • ",le.type," • ",bt(le.created_at)]}),le.description&&e.jsx("p",{className:"text-xs text-neutral-dark/60 mt-1",children:le.description})]})]}),e.jsx(G,{variant:"outline",size:"sm",onClick:()=>ie(le),children:e.jsx(An,{className:"w-4 h-4"})})]},le.id)):e.jsxs("div",{className:"text-center py-8",children:[e.jsx(Ot,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"No documents found"}),e.jsx("p",{className:"text-muted-foreground text-xs mt-1",children:"Upload your first document to get started"})]})})})})]})]}),w&&e.jsx(t3,{milestone:D,projectId:a,onClose:()=>{N(!1),b(null)},onSave:T}),E&&e.jsx(of,{task:M,project:c,onClose:()=>{_(!1),k(null)},onSave:re}),O&&e.jsx(cf,{isOpen:O,onClose:()=>{L(!1),H(null)},document:R,project:c,onDocumentUploaded:Ae}),z&&e.jsx(l3,{isOpen:z,onClose:()=>V(!1),availableMembers:Z,onSelectMembers:_e})]})}const Ys=[{id:1,title:"Design homepage wireframes",description:"Create low-fidelity wireframes for the new homepage layout including hero section, features, and CTA placement.",status:"In Progress",priority:"High",assignee:"Emma Wilson",assigneeAvatar:"EW",reporter:"Sarah Johnson",dueDate:"2024-02-28",createdDate:"2024-02-20",updatedDate:"2024-02-25",estimatedHours:8,timeSpent:5.5,clientId:1,clientName:"Tech Solutions Inc.",projectId:1,projectName:"E-commerce Website Redesign",category:"Design",tags:["UI/UX","Wireframes","Homepage"],subtasks:[{id:1,title:"Hero section wireframe",completed:!0},{id:2,title:"Features section wireframe",completed:!0},{id:3,title:"CTA placement wireframe",completed:!1},{id:4,title:"Mobile responsive wireframes",completed:!1}],comments:[{id:1,author:"Sarah Johnson",content:"Please make sure the hero section focuses on the key value proposition.",createdAt:"2024-02-22T10:30:00Z",avatar:"SJ"},{id:2,author:"Emma Wilson",content:"Will do! I've completed the desktop versions and working on mobile now.",createdAt:"2024-02-25T14:15:00Z",avatar:"EW"}],attachments:[{id:1,name:"homepage-wireframes-v1.fig",size:"2.1 MB",type:"Figma"}]},{id:2,title:"Implement user authentication API",description:"Build secure authentication endpoints including login, register, logout, and password reset functionality.",status:"To Do",priority:"High",assignee:"Alex Rodriguez",assigneeAvatar:"AR",reporter:"Mike Chen",dueDate:"2024-03-05",createdDate:"2024-02-18",updatedDate:"2024-02-20",estimatedHours:16,timeSpent:0,clientId:1,clientName:"Tech Solutions Inc.",projectId:1,projectName:"E-commerce Website Redesign",category:"Backend",tags:["Authentication","API","Security"],subtasks:[{id:1,title:"Set up JWT c
700onfiguration",completed:!1},{id:2,title:"Create login endpoint",completed:!1},{id:3,title:"Create register endpoint",completed:!1},{id:4,title:"Implement password reset flow",completed:!1},{id:5,title:"Add rate limiting",completed:!1}],comments:[],attachments:[{id:1,name:"auth-requirements.pdf",size:"856 KB",type:"PDF"}]},{id:3,title:"Create brand logo concepts",description:"Design 5-7 initial logo concepts based on the brand discovery workshop findings.",status:"In Review",priority:"Medium",assignee:"David Park",assigneeAvatar:"DP",reporter:"Emma Wilson",dueDate:"2024-02-26",createdDate:"2024-02-15",updatedDate:"2024-02-24",estimatedHours:12,timeSpent:10,clientId:2,clientName:"Marketing Masters LLC",projectId:2,projectName:"Brand Identity Package",category:"Design",tags:["Branding","Logo","Concepts"],subtasks:[{id:1,title:"Research visual direction",completed:!0},{id:2,title:"Sketch initial concepts",completed:!0},{id:3,title:"Create digital concepts",completed:!0},{id:4,title:"Prepare presentation",completed:!1}],comments:[{id:1,author:"Emma Wilson",content:"Looking great! Please ensure concepts align with the modern, professional direction discussed.",createdAt:"2024-02-23T09:45:00Z",avatar:"EW"}],attachments:[{id:1,name:"logo-concepts-v1.ai",size:"4.2 MB",type:"Illustrator"},{id:2,name:"brand-inspiration.png",size:"1.8 MB",type:"Image"}]},{id:4,title:"Fix mobile navigation bug",description:"Mobile hamburger menu not closing properly on iPhone Safari. Investigate and fix the touch event handling.",status:"Done",priority:"High",assignee:"Mike Chen",assigneeAvatar:"MC",reporter:"Sarah Johnson",dueDate:"2024-02-20",createdDate:"2024-02-18",updatedDate:"2024-02-19",completedDate:"2024-02-19",estimatedHours:3,timeSpent:2.5,clientId:3,clientName:"Green Earth Solutions",projectId:3,projectName:"Mobile App Development",category:"Bug Fix",tags:["Mobile","Navigation","Safari","Bug"],subtasks:[{id:1,title:"Reproduce issue on iPhone Safari",completed:!0},{id:2,title:"Identify root cause",completed:!0},{id:3,title:"Implement fix",completed:!0},{id:4,title:"Test across devices",completed:!0}],comments:[{id:1,author:"Mike Chen",content:"Fixed! Issue was with touch event preventDefault. Tested on iPhone 12, 13, and 14.",createdAt:"2024-02-19T16:20:00Z",avatar:"MC"}],attachments:[]},{id:5,title:"Conduct user testing session",description:"Organize and conduct user testing sessions with 8-10 participants to validate the new onboarding flow.",status:"To Do",priority:"Medium",assignee:"Lisa Thompson",assigneeAvatar:"LT",reporter:"Emma Wilson",dueDate:"2024-03-10",createdDate:"2024-02-22",updatedDate:"2024-02-22",estimatedHours:20,timeSpent:0,clientId:null,clientName:null,projectId:null,projectName:null,category:"Research",tags:["User Testing","Onboarding","Research"],subtasks:[{id:1,title:"Recruit test participants",completed:!1},{id:2,title:"Prepare testing script",completed:!1},{id:3,title:"Set up testing environment",completed:!1},{id:4,title:"Conduct testing sessions",completed:!1},{id:5,title:"Analyze results and create report",completed:!1}],comments:[],attachments:[]},{id:6,title:"Database performance optimization",description:"Optimize slow database queries identified in the performance monitoring. Focus on the user dashboard and analytics queries.",status:"In Progress",priority:"Medium",assignee:"Alex Rodriguez",assigneeAvatar:"AR",reporter:"Mike Chen",dueDate:"2024-03-01",createdDate:"2024-02-20",updatedDate:"2024-02-24",estimatedHours:10,timeSpent:6,clientId:1,clientName:"Tech Solutions Inc.",projectId:4,projectName:"Data Analytics Dashboard",category:"Performance",tags:["Database","Optimization","Performance"],subtasks:[{id:1,title:"Identify slow queries",completed:!0},{id:2,title:"Add database indexes",completed:!0},{id:3,title:"Optimize dashboard queries",completed:!1},{id:4,title:"Test performance improvements",completed:!1}],comments:[{id:1,author:"Alex Rodriguez",content:"Added indexes for user_id and created_at columns. Dashboard load time improved by 40%.",createdAt:"2024-02-24T11:30:00Z",avatar:"AR"}],attachments:[{id:1,name:"performance-analysis.xlsx",size:"1.2 MB",type:"Excel"}]},{id:7,title:"Write API documentation",description:"Create comprehensive API documentation for all endpoints including examples, error codes, and authentication requirements.",status:"To Do",priority:"Low",assignee:"Tom Wilson",assigneeAvatar:"TW",reporter:"Sarah Johnson",dueDate:"2024-03-15",createdDate:"2024-02-25",updatedDate:"2024-02-25",estimatedHours:15,timeSpent:0,clientId:null,clientName:null,projectId:null,projectName:null,category:"Documentation",tags:["API","Documentation","Technical Writing"],subtasks:[{id:1,title:"Document authentication endpoints",completed:!1},{id:2,title:"Document user management endpoints",completed:!1},{id:3,title:"Document project endpoints",completed:!1},{id:4,title:"Add code examples",completed:!1},{id:5,title:"Review and publish",completed:!1}],comments:[],attachments:[]},{id:8,title:"Set up CI/CD pipeline",description:"Configure automated deployment pipeline with testing, linting, and deployment stages for the frontend application.",status:"In Progress",priority:"High",assignee:"Mike Chen",assigneeAvatar:"MC",reporter:"Alex Rodriguez",dueDate:"2024-02-29",createdDate:"2024-02-21",updatedDate:"2024-02-25",estimatedHours:12,timeSpent:8,clientId:null,clientName:null,projectId:null,projectName:null,category:"DevOps",tags:["CI/CD","Deployment","Automation"],subtasks:[{id:1,title:"Set up GitHub Actions workflow",completed:!0},{id:2,title:"Configure automated testing",completed:!0},{id:3,title:"Set up staging deployment",completed:!1},{id:4,title:"Configure production deployment",completed:!1}],comments:[{id:1,author:"Mike Chen",content:"GitHub Actions workflow is working great! Testing stage passes successfully.",createdAt:"2024-02-25T13:45:00Z",avatar:"MC"}],attachments:[{id:1,name:"pipeline-config.yml",size:"2.1 KB",type:"YAML"}]},{id:9,title:"Client feedback integration",description:"Implement client feedback from the latest design review and update the prototype accordingly.",status:"To Do",priority:"High",assignee:"Emma Wilson",assigneeAvatar:"EW",reporter:"Sarah Johnson",dueDate:"2024-03-02",createdDate:"2024-02-26",updatedDate:"2024-02-26",estimatedHours:6,timeSpent:0,clientId:2,clientName:"Marketing Masters LLC",projectId:2,projectName:"Brand Identity Package",category:"Design",tags:["Client Feedback","Prototype","Iteration"],subtasks:[{id:1,title:"Review client feedback notes",completed:!1},{id:2,title:"Prioritize changes",completed:!1},{id:3,title:"Update design prototype",completed:!1},{id:4,title:"Schedule follow-up review",completed:!1}],comments:[],attachments:[{id:1,name:"client-feedback-notes.pdf",size:"743 KB",type:"PDF"}]},{id:10,title:"Security audit preparation",description:"Prepare the application for the upcoming security audit by reviewing code, updating dependencies, and fixing known vulnerabilities.",status:"In Review",priority:"High",assignee:"Alex Rodriguez",assigneeAvatar:"AR",reporter:"Sarah Johnson",dueDate:"2024-03-08",createdDate:"2024-02-23",updatedDate:"2024-02-26",estimatedHours:14,timeSpent:12,clientId:null,clientName:null,projectId:null,projectName:null,category:"Security",tags:["Security","Audit","Vulnerabilities"],subtasks:[{id:1,title:"Update all dependencies",completed:!0},{id:2,title:"Run security scan",completed:!0},{id:3,title:"Fix identified vulnerabilities",completed:!0},{id:4,title:"Prepare audit documentation",completed:!1}],comments:[{id:1,author:"Alex Rodriguez",content:"All dependencies updated and vulnerabilities fixed. Working on documentation now.",createdAt:"2024-02-26T10:15:00Z",avatar:"AR"}],attachments:[{id:1,name:"security-scan-results.pdf",size:"1.5 MB",type:"PDF"},{id:2,name:"vulnerability-fixes.md",size:"3.2 KB",type:"Markdown"}]}],o3=a=>Ys.find(r=>r.id===parseInt(a)),c3=()=>{const a=Ys.length,r=Ys.filter(p=>p.status==="To Do").length,i=Ys.filter(p=>p.status==="In Progress").length,o=Ys.filter(p=>p.status==="In Review").length,c=Ys.filter(p=>p.status==="Done").length,m=Ys.filter(p=>p.priority==="High").length,u=Ys.filter(p=>p.status==="Done"?!1:new Date(p.dueDate)<new Date).length,g=Ys.reduce((p,y)=>p+y.estimatedHours,0),x=Ys.reduce((p,y)=>p+y.timeSpent,0);return{total:a,toDo:r,inProgress:i,inReview:o,done:c,highPriority:m,overdue:u,totalEstimated:g,totalSpent:x,efficiency:Math.round(x/g*100)}};function Lv(a,[r,i]){return Math.min(i,Math.max(r,a))}const d3=["top","right","bottom","left"],Rn=Math.min,ks=Math.max,Mc=Math.round,vc=Math.floor,ga=a=>({x:a,y:a}
vendor: 12,680 bytes, line 700
700),u3={left:"right",right:"left",bottom:"top",top:"bottom"},m3={start:"end",end:"start"};function df(a,r,i){return ks(a,Rn(r,i))}function Xa(a,r){return typeof a=="function"?a(r):a}function Ka(a){return a.split("-")[0]}function Sl(a){return a.split("-")[1]}function Gf(a){return a==="x"?"y":"x"}function Yf(a){return a==="y"?"height":"width"}const f3=new Set(["top","bottom"]);function ha(a){return f3.has(Ka(a))?"y":"x"}function Xf(a){return Gf(ha(a))}function h3(a,r,i){i===void 0&&(i=!1);const o=Sl(a),c=Xf(a),m=Yf(c);let u=c==="x"?o===(i?"end":"start")?"right":"left":o==="start"?"bottom":"top";return r.reference[m]>r.floating[m]&&(u=Tc(u)),[u,Tc(u)]}function x3(a){const r=Tc(a);return[uf(a),r,uf(r)]}function uf(a){return a.replace(/start|end/g,r=>m3[r])}const Uv=["left","right"],$v=["right","left"],p3=["top","bottom"],g3=["bottom","top"];function v3(a,r,i){switch(a){case"top":case"bottom":return i?r?$v:Uv:r?Uv:$v;case"left":case"right":return r?p3:g3;default:return[]}}function y3(a,r,i,o){const c=Sl(a);let m=v3(Ka(a),i==="start",o);return c&&(m=m.map(u=>u+"-"+c),r&&(m=m.concat(m.map(uf)))),m}function Tc(a){return a.replace(/left|right|bottom|top/g,r=>u3[r])}function b3(a){return{top:0,right:0,bottom:0,left:0,...a}}function eb(a){return typeof a!="number"?b3(a):{top:a,right:a,bottom:a,left:a}}function Ac(a){const{x:r,y:i,width:o,height:c}=a;return{width:o,height:c,top:i,left:r,right:r+o,bottom:i+c,x:r,y:i}}function Iv(a,r,i){let{reference:o,floating:c}=a;const m=ha(r),u=Xf(r),g=Yf(u),x=Ka(r),p=m==="y",y=o.x+o.width/2-c.width/2,v=o.y+o.height/2-c.height/2,w=o[g]/2-c[g]/2;let N;switch(x){case"top":N={x:y,y:o.y-c.height};break;case"bottom":N={x:y,y:o.y+o.height};break;case"right":N={x:o.x+o.width,y:v};break;case"left":N={x:o.x-c.width,y:v};break;default:N={x:o.x,y:o.y}}switch(Sl(r)){case"start":N[u]-=w*(i&&p?-1:1);break;case"end":N[u]+=w*(i&&p?-1:1);break}return N}const j3=async(a,r,i)=>{const{placement:o="bottom",strategy:c="absolute",middleware:m=[],platform:u}=i,g=m.filter(Boolean),x=await(u.isRTL==null?void 0:u.isRTL(r));let p=await u.getElementRects({reference:a,floating:r,strategy:c}),{x:y,y:v}=Iv(p,o,x),w=o,N={},D=0;for(let b=0;b<g.length;b++){const{name:E,fn:_}=g[b],{x:M,y:k,data:C,reset:j}=await _({x:y,y:v,initialPlacement:o,placement:w,strategy:c,middlewareData:N,rects:p,platform:u,elements:{reference:a,floating:r}});y=M??y,v=k??v,N={...N,[E]:{...N[E],...C}},j&&D<=50&&(D++,typeof j=="object"&&(j.placement&&(w=j.placement),j.rects&&(p=j.rects===!0?await u.getElementRects({reference:a,floating:r,strategy:c}):j.rects),{x:y,y:v}=Iv(p,w,x)),b=-1)}return{x:y,y:v,placement:w,strategy:c,middlewareData:N}};async function Ui(a,r){var i;r===void 0&&(r={});const{x:o,y:c,platform:m,rects:u,elements:g,strategy:x}=a,{boundary:p="clippingAncestors",rootBoundary:y="viewport",elementContext:v="floating",altBoundary:w=!1,padding:N=0}=Xa(r,a),D=eb(N),E=g[w?v==="floating"?"reference":"floating":v],_=Ac(await m.getClippingRect({element:(i=await(m.isElement==null?void 0:m.isElement(E)))==null||i?E:E.contextElement||await(m.getDocumentElement==null?void 0:m.getDocumentElement(g.floating)),boundary:p,rootBoundary:y,strategy:x})),M=v==="floating"?{x:o,y:c,width:u.floating.width,height:u.floating.height}:u.reference,k=await(m.getOffsetParent==null?void 0:m.getOffsetParent(g.floating)),C=await(m.isElement==null?void 0:m.isElement(k))?await(m.getScale==null?void 0:m.getScale(k))||{x:1,y:1}:{x:1,y:1},j=Ac(m.convertOffsetParentRelativeRectToViewportRelativeRect?await m.convertOffsetParentRelativeRectToViewportRelativeRect({elements:g,rect:M,offsetParent:k,strategy:x}):M);return{top:(_.top-j.top+D.top)/C.y,bottom:(j.bottom-_.bottom+D.bottom)/C.y,left:(_.left-j.left+D.left)/C.x,right:(j.right-_.right+D.right)/C.x}}const N3=a=>({name:"arrow",options:a,async fn(r){const{x:i,y:o,placement:c,rects:m,platform:u,elements:g,middlewareData:x}=r,{element:p,padding:y=0}=Xa(a,r)||{};if(p==null)return{};const v=eb(y),w={x:i,y:o},N=Xf(c),D=Yf(N),b=await u.getDimensions(p),E=N==="y",_=E?"top":"left",M=E?"bottom":"right",k=E?"clientHeight":"clientWidth",C=m.reference[D]+m.reference[N]-w[N]-m.floating[D],j=w[N]-m.reference[N],O=await(u.getOffsetParent==null?void 0:u.getOffsetParent(p));let L=O?O[k]:0;(!L||!await(u.isElement==null?void 0:u.isElement(O)))&&(L=g.floating[k]||m.floating[D]);const R=C/2-j/2,H=L/2-b[D]/2-1,z=Rn(v[_],H),V=Rn(v[M],H),Z=z,I=L-b[D]-V,ue=L/2-b[D]/2+R,X=df(Z,ue,I),P=!x.arrow&&Sl(c)!=null&&ue!==X&&m.reference[D]/2-(ue<Z?z:V)-b[D]/2<0,$=P?ue<Z?ue-Z:ue-I:0;return{[N]:w[N]+$,data:{[N]:X,centerOffset:ue-X-$,...P&&{alignmentOffset:$}},reset:P}}}),w3=function(a){return a===void 0&&(a={}),{name:"flip",options:a,async fn(r){var i,o;const{placement:c,middlewareData:m,rects:u,initialPlacement:g,platform:x,elements:p}=r,{mainAxis:y=!0,crossAxis:v=!0,fallbackPlacements:w,fallbackStrategy:N="bestFit",fallbackAxisSideDirection:D="none",flipAlignment:b=!0,...E}=Xa(a,r);if((i=m.arrow)!=null&&i.alignmentOffset)return{};const _=Ka(c),M=ha(g),k=Ka(g)===g,C=await(x.isRTL==null?void 0:x.isRTL(p.floating)),j=w||(k||!b?[Tc(g)]:x3(g)),O=D!=="none";!w&&O&&j.push(...y3(g,b,D,C));const L=[g,...j],R=await Ui(r,E),H=[];let z=((o=m.flip)==null?void 0:o.overflows)||[];if(y&&H.push(R[_]),v){const ue=h3(c,u,C);H.push(R[ue[0]],R[ue[1]])}if(z=[...z,{placement:c,overflows:H}],!H.every(ue=>ue<=0)){var V,Z;const ue=(((V=m.flip)==null?void 0:V.index)||0)+1,X=L[ue];if(X&&(!(v==="alignment"?M!==ha(X):!1)||z.every(F=>F.overflows[0]>0&&ha(F.placement)===M)))return{data:{index:ue,overflows:z},reset:{placement:X}};let P=(Z=z.filter($=>$.overflows[0]<=0).sort(($,F)=>$.overflows[1]-F.overflows[1])[0])==null?void 0:Z.placement;if(!P)switch(N){case"bestFit":{var I;const $=(I=z.filter(F=>{if(O){const ne=ha(F.placement);return ne===M||ne==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(ne=>ne>0).reduce((ne,T)=>ne+T,0)]).sort((F,ne)=>F[1]-ne[1])[0])==null?void 0:I[0];$&&(P=$);break}case"initialPlacement":P=g;break}if(c!==P)return{reset:{placement:P}}}return{}}}};function Fv(a,r){return{top:a.top-r.height,right:a.right-r.width,bottom:a.bottom-r.height,left:a.left-r.width}}function Bv(a){return d3.some(r=>a[r]>=0)}const S3=function(a){return a===void 0&&(a={}),{name:"hide",options:a,async fn(r){const{rects:i}=r,{strategy:o="referenceHidden",...c}=Xa(a,r);switch(o){case"referenceHidden":{const m=await Ui(r,{...c,elementContext:"reference"}),u=Fv(m,i.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:Bv(u)}}}case"escaped":{const m=await Ui(r,{...c,altBoundary:!0}),u=Fv(m,i.floating);return{data:{escapedOffsets:u,escaped:Bv(u)}}}default:return{}}}}},tb=new Set(["left","top"]);async function C3(a,r){const{placement:i,platform:o,elements:c}=a,m=await(o.isRTL==null?void 0:o.isRTL(c.floating)),u=Ka(i),g=Sl(i),x=ha(i)==="y",p=tb.has(u)?-1:1,y=m&&x?-1:1,v=Xa(r,a);let{mainAxis:w,crossAxis:N,alignmentAxis:D}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return g&&typeof D=="number"&&(N=g==="end"?D*-1:D),x?{x:N*y,y:w*p}:{x:w*p,y:N*y}}const k3=function(a){return a===void 0&&(a=0),{name:"offset",options:a,async fn(r){var i,o;const{x:c,y:m,placement:u,middlewareData:g}=r,x=await C3(r,a);return u===((i=g.offset)==null?void 0:i.placement)&&(o=g.arrow)!=null&&o.alignmentOffset?{}:{x:c+x.x,y:m+x.y,data:{...x,placement:u}}}}},_3=function(a){return a===void 0&&(a={}),{name:"shift",options:a,async fn(r){const{x:i,y:o,placement:c}=r,{mainAxis:m=!0,crossAxis:u=!1,limiter:g={fn:E=>{let{x:_,y:M}=E;return{x:_,y:M}}},...x}=Xa(a,r),p={x:i,y:o},y=await Ui(r,x),v=ha(Ka(c)),w=Gf(v);let N=p[w],D=p[v];if(m){const E=w==="y"?"top":"left",_=w==="y"?"bottom":"right",M=N+y[E],k=N-y[_];N=df(M,N,k)}if(u){const E=v==="y"?"top":"left",_=v==="y"?"bottom":"right",M=D+y[E],k=D-y[_];D=df(M,D,k)}const b=g.fn({...r,[w]:N,[v]:D});return{...b,data:{x:b.x-i,y:b.y-o,enabled:{[w]:m,[v]:u}}}}}},D3=function(a){return a===void 0&&(a={}),{options:a,fn(r){const{x:i,y:o,placement:c,rects:m,middlewareData:u}=r,{offset:g=0,mainAxis:x=!0,crossAxis:p=!0}=Xa(a,r),y={x:i,y:o},v=ha(c),w=Gf(v);let N=y[w],D=y[v];const b=Xa(g,r),E=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(x){const k=w==="y"?"height":"width",C=m.reference[w]-m.floating[k]+E.mainAxis,j=m.reference[w]+m.reference[k]-E.mainAxis;N<C?N=C:N>j&&(N=j)}if(p){var _,M;const k=w==="y"?"width":"height",C=tb.has(Ka(c)),j=m.reference[v]-m.floating[k]+(C&&((_=u.offset)==null?void 0:_[v])||0)+(C?0:E.crossAxis),O=m.reference[v]+m.reference[k]+(C?0:((M=u.offset)==null?void 0:M[v])||0)-(C?E.crossAxis:0);D<j?D=j:D>O&&(D=O)}return{[w]:N,[v]:D}}}},E3=function(a){return a===void 0&&(a={}),{name:"size",options:a,async fn(r){var i,o;const{placement:c,rects:m,platform:u,elements:g}=r,{apply:x=()=>{},...p}=Xa(a,r),y=await Ui(r,p),v=Ka(c),w=Sl(c),N=ha(c)==="y",{width:D,height:b}=m.floating;let E,_;v==="top"||v==="bottom"?(E=v,_=w===(await(u.isRTL==null?void 0:u.isRTL(g.floating))?"start":"end")?"left":"right"):(_=v,E=w==="end"?"top":"bottom");const M=b-y.top-y.bottom,k=D-y.left-y.right,C=Rn(b-y[E],M),j=Rn(D-y[_],k),O=!r.middlewareData.shift;let L=C,R=j;if((i=r.middlewareData.shift)!=null&&i.enabled.x&&(R=k),(o=r.middlewareData.shift)!=null&&o.enabled.y&&(L=M),O&&!w){const z=ks(y.left,0),V=ks(y.right,0),Z=ks(y.top,0),I=ks(y.bottom,0);N?R=D-2*(z!==0||V!==0?z+V:ks(y.left,y.right)):L=b-2*(Z!==0||I!==0?Z+I:ks(y.top,y.bottom))}await x({...r,availableWidth:R,availableHeight:L});const H=await u.getDimensions(g.floating);return D!==H.width||b!==H.height?{reset:{rects:!0}}:{}}}};function td(){return typeof window<"u"}function Cl(a){return sb(a)?(a.nodeName||"").toLowerCase():"#document"}function _s(a){var r;return(a==null||(r=a.ownerDocument)==null?void 0:r.defaultView)||window}function ja(a){var r;return(r=(sb(a)?a.ownerDocument:a.document)||window.document)==null?void 0:r.documentElement}function sb(a){return td()?a instanceof Node||a instanceof _s(a).Node:!1}function ta(a){return td()?a instanceof Element||a instanceof _s(a).Element:!1}function ba(a){return td()?a instanceof HTMLElement||a instanceof _s(a).HTMLElement:!1}function qv(a){return!td()||typeof ShadowRoot>"u"?!1:a instanceof ShadowRoot||a instanceof _s(a).ShadowRoot}const M3=new Set(["inline","contents"]);function Gi(a){const{overflow:r,overflowX:i,overflowY:o,display:c}=sa(a);return/auto|scroll|overlay|hidden|clip/.test(r+o+i)&&!M3.has(c)}const T3=new Set(["table","td","th"]);function A3(a){return T3.has(Cl(a))}const R3=[":popover-open",":modal"];function sd(a){return R3.some(r=>{try{return a.matches(r)}catch{return!1}})}const O3=["transform","translate","scale","rotate","perspective"],P3=["transform","translate","scale","rotate","perspective","filter"],z3=["paint","layout","strict","content"];function Kf(a){const r=Zf(),i=ta(a)?sa(a):a;return O3.some(o=>i[o]?i[o]!=="none":!1)||(i.containerType?i.containerType!=="normal":!1)||!r&&(i.backdropFilter?i.backdropFilter!=="none":!1)||!r&&(i.filter?i.filter!=="none":!1)||P3.some(o=>(i.willChange||"").includes(o))||z3.some(o=>(i.contain||"").includes(o))}function L3(a){let r=On(a);for(;ba(r)&&!bl(r);){if(Kf(r))return r;if(sd(r))return null;r=On(r)}return null}function Zf(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const U3=new Set(["html","body","#document"]);function bl(a){return U3.has(Cl(a))}function sa(a){return _s(a).getComputedStyle(a)}function ad(a){return ta(a)?{scrollLeft:a.scrollLeft,scrollTop:a.scrollTop}:{scrollLeft:a.scrollX,scrollTop:a.scrollY}}function On(a){if(Cl(a)==="html")return a;const r=a.assignedSlot||a.parentNode||qv(a)&&a.host||ja(a);return qv(r)?r.host:r}function ab(a){const r=On(a);return bl(r)?a.ownerDocument?a.ownerDocument.body:a.body:ba(r)&&Gi(r)?r:ab(r)}function $i(a,r,i){var o;r===void 0&&(r=[]),i===void 0&&(i=!0);const c=ab(a),m=c===((o=a.ownerDocument)==null?void 0:o.body),u=_s(c);if(m){const g=mf(u);return r.concat(u,u.visualViewport||[],Gi(c)?c:[],g&&i?$i(g):[])}return r.concat(c,$i(c,[],i))}function mf(a){return a.parent&&Object.getPrototypeOf(a.parent)?a.frameElement:null}function nb(a){const r=sa(a);let i=parseFloat(r.width)||0,o=parseFloat(r.height)||0;const c=ba(a),m=c?a.offsetWidth:i,u=c?a.offsetHeight:o,g=Mc(i)!==m||Mc(o)!==u;return g&&(i=m,o=u),{width:i,height:o,$:g}}function Qf(a){return ta(a)?a:a.contextElement}function gl(a){const r=Qf(a);if(!ba(r))return ga(1);const i=r.getBoundingClientRect(),{width:o,height:c,$:m}=nb(r);let u=(m?Mc(i.width):i.width)/o,g=(m?Mc(i.height):i.height)/c;return(!u||!Number.isFinite(u))&&(u=1),(!g||!Number.isFinite(g))&&(g=1),{x:u,y:g}}const $3=ga(0);function rb(a){const r=_s(a);
vendor: 5,766 bytes, line 700
700return!Zf()||!r.visualViewport?$3:{x:r.visualViewport.offsetLeft,y:r.visualViewport.offsetTop}}function I3(a,r,i){return r===void 0&&(r=!1),!i||r&&i!==_s(a)?!1:r}function pr(a,r,i,o){r===void 0&&(r=!1),i===void 0&&(i=!1);const c=a.getBoundingClientRect(),m=Qf(a);let u=ga(1);r&&(o?ta(o)&&(u=gl(o)):u=gl(a));const g=I3(m,i,o)?rb(m):ga(0);let x=(c.left+g.x)/u.x,p=(c.top+g.y)/u.y,y=c.width/u.x,v=c.height/u.y;if(m){const w=_s(m),N=o&&ta(o)?_s(o):o;let D=w,b=mf(D);for(;b&&o&&N!==D;){const E=gl(b),_=b.getBoundingClientRect(),M=sa(b),k=_.left+(b.clientLeft+parseFloat(M.paddingLeft))*E.x,C=_.top+(b.clientTop+parseFloat(M.paddingTop))*E.y;x*=E.x,p*=E.y,y*=E.x,v*=E.y,x+=k,p+=C,D=_s(b),b=mf(D)}}return Ac({width:y,height:v,x,y:p})}function Jf(a,r){const i=ad(a).scrollLeft;return r?r.left+i:pr(ja(a)).left+i}function lb(a,r,i){i===void 0&&(i=!1);const o=a.getBoundingClientRect(),c=o.left+r.scrollLeft-(i?0:Jf(a,o)),m=o.top+r.scrollTop;return{x:c,y:m}}function F3(a){let{elements:r,rect:i,offsetParent:o,strategy:c}=a;const m=c==="fixed",u=ja(o),g=r?sd(r.floating):!1;if(o===u||g&&m)return i;let x={scrollLeft:0,scrollTop:0},p=ga(1);const y=ga(0),v=ba(o);if((v||!v&&!m)&&((Cl(o)!=="body"||Gi(u))&&(x=ad(o)),ba(o))){const N=pr(o);p=gl(o),y.x=N.x+o.clientLeft,y.y=N.y+o.clientTop}const w=u&&!v&&!m?lb(u,x,!0):ga(0);return{width:i.width*p.x,height:i.height*p.y,x:i.x*p.x-x.scrollLeft*p.x+y.x+w.x,y:i.y*p.y-x.scrollTop*p.y+y.y+w.y}}function B3(a){return Array.from(a.getClientRects())}function q3(a){const r=ja(a),i=ad(a),o=a.ownerDocument.body,c=ks(r.scrollWidth,r.clientWidth,o.scrollWidth,o.clientWidth),m=ks(r.scrollHeight,r.clientHeight,o.scrollHeight,o.clientHeight);let u=-i.scrollLeft+Jf(a);const g=-i.scrollTop;return sa(o).direction==="rtl"&&(u+=ks(r.clientWidth,o.clientWidth)-c),{width:c,height:m,x:u,y:g}}function H3(a,r){const i=_s(a),o=ja(a),c=i.visualViewport;let m=o.clientWidth,u=o.clientHeight,g=0,x=0;if(c){m=c.width,u=c.height;const p=Zf();(!p||p&&r==="fixed")&&(g=c.offsetLeft,x=c.offsetTop)}return{width:m,height:u,x:g,y:x}}const V3=new Set(["absolute","fixed"]);function G3(a,r){const i=pr(a,!0,r==="fixed"),o=i.top+a.clientTop,c=i.left+a.clientLeft,m=ba(a)?gl(a):ga(1),u=a.clientWidth*m.x,g=a.clientHeight*m.y,x=c*m.x,p=o*m.y;return{width:u,height:g,x,y:p}}function Hv(a,r,i){let o;if(r==="viewport")o=H3(a,i);else if(r==="document")o=q3(ja(a));else if(ta(r))o=G3(r,i);else{const c=rb(a);o={x:r.x-c.x,y:r.y-c.y,width:r.width,height:r.height}}return Ac(o)}function ib(a,r){const i=On(a);return i===r||!ta(i)||bl(i)?!1:sa(i).position==="fixed"||ib(i,r)}function Y3(a,r){const i=r.get(a);if(i)return i;let o=$i(a,[],!1).filter(g=>ta(g)&&Cl(g)!=="body"),c=null;const m=sa(a).position==="fixed";let u=m?On(a):a;for(;ta(u)&&!bl(u);){const g=sa(u),x=Kf(u);!x&&g.position==="fixed"&&(c=null),(m?!x&&!c:!x&&g.position==="static"&&!!c&&V3.has(c.position)||Gi(u)&&!x&&ib(a,u))?o=o.filter(y=>y!==u):c=g,u=On(u)}return r.set(a,o),o}function X3(a){let{element:r,boundary:i,rootBoundary:o,strategy:c}=a;const u=[...i==="clippingAncestors"?sd(r)?[]:Y3(r,this._c):[].concat(i),o],g=u[0],x=u.reduce((p,y)=>{const v=Hv(r,y,c);return p.top=ks(v.top,p.top),p.right=Rn(v.right,p.right),p.bottom=Rn(v.bottom,p.bottom),p.left=ks(v.left,p.left),p},Hv(r,g,c));return{width:x.right-x.left,height:x.bottom-x.top,x:x.left,y:x.top}}function K3(a){const{width:r,height:i}=nb(a);return{width:r,height:i}}function Z3(a,r,i){const o=ba(r),c=ja(r),m=i==="fixed",u=pr(a,!0,m,r);let g={scrollLeft:0,scrollTop:0};const x=ga(0);function p(){x.x=Jf(c)}if(o||!o&&!m)if((Cl(r)!=="body"||Gi(c))&&(g=ad(r)),o){const N=pr(r,!0,m,r);x.x=N.x+r.clientLeft,x.y=N.y+r.clientTop}else c&&p();m&&!o&&c&&p();const y=c&&!o&&!m?lb(c,g):ga(0),v=u.left+g.scrollLeft-x.x-y.x,w=u.top+g.scrollTop-x.y-y.y;return{x:v,y:w,width:u.width,height:u.height}}function $m(a){return sa(a).position==="static"}function Vv(a,r){if(!ba(a)||sa(a).position==="fixed")return null;if(r)return r(a);let i=a.offsetParent;return ja(a)===i&&(i=i.ownerDocument.body),i}function ob(a,r){const i=_s(a);if(sd(a))return i;if(!ba(a)){let c=On(a);for(;c&&!bl(c);){if(ta(c)&&!$m(c))return c;c=On(c)}return i}let o=Vv(a,r);for(;o&&A3(o)&&$m(o);)o=Vv(o,r);return o&&bl(o)&&$m(o)&&!Kf(o)?i:o||L3(a)||i}const Q3=async function(a){const r=this.getOffsetParent||ob,i=this.getDimensions,o=await i(a.floating);return{reference:Z3(a.reference,await r(a.floating),a.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function J3(a){return sa(a).direction==="rtl"}const W3={convertOffsetParentRelativeRectToViewportRelativeRect:F3,getDocumentElement:ja,getClippingRect:X3,getOffsetParent:ob,getElementRects:Q3,getClientRects:B3,getDimensions:K3,getScale:gl,isElement:ta,isRTL:J3};function cb(a,r){return a.x===r.x&&a.y===r.y&&a.width===r.width&&a.height===r.height}function eD(a,r){let i=null,o;const c=ja(a);function m(){var g;clearTimeout(o),(g=i)==null||g.disconnect(),i=null}function u(g,x){g===void 0&&(g=!1),x===void 0&&(x=1),m();const p=a.getBoundingClientRect(),{left:y,top:v,width:w,height:N}=p;if(g||r(),!w||!N)return;const D=vc(v),b=vc(c.clientWidth-(y+w)),E=vc(c.clientHeight-(v+N)),_=vc(y),k={rootMargin:-D+"px "+-b+"px "+-E+"px "+-_+"px",threshold:ks(0,Rn(1,x))||1};let C=!0;function j(O){const L=O[0].intersectionRatio;if(L!==x){if(!C)return u();L?u(!1,L):o=setTimeout(()=>{u(!1,1e-7)},1e3)}L===1&&!cb(p,a.getBoundingClientRect())&&u(),C=!1}try{i=new IntersectionObserver(j,{...k,root:c.ownerDocument})}catch{i=new IntersectionObserver(j,k)}i.observe(a)}return u(!0),m}function tD(a,r,i,o){o===void 0&&(o={});const{ancestorScroll:c=!0,ancestorResize:m=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:g=typeof IntersectionObserver=="function",animationFrame:x=!1}=o,p=Qf(a),y=c||m?[...p?$i(p):[],...$i(r)]:[];
vendor: 6,763 bytes, line 700
700y.forEach(_=>{c&&_.addEventListener("scroll",i,{passive:!0}),m&&_.addEventListener("resize",i)});const v=p&&g?eD(p,i):null;let w=-1,N=null;u&&(N=new ResizeObserver(_=>{let[M]=_;M&&M.target===p&&N&&(N.unobserve(r),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var k;(k=N)==null||k.observe(r)})),i()}),p&&!x&&N.observe(p),N.observe(r));let D,b=x?pr(a):null;x&&E();function E(){const _=pr(a);b&&!cb(b,_)&&i(),b=_,D=requestAnimationFrame(E)}return i(),()=>{var _;y.forEach(M=>{c&&M.removeEventListener("scroll",i),m&&M.removeEventListener("resize",i)}),v?.(),(_=N)==null||_.disconnect(),N=null,x&&cancelAnimationFrame(D)}}const sD=k3,aD=_3,nD=w3,rD=E3,lD=S3,Gv=N3,iD=D3,oD=(a,r,i)=>{const o=new Map,c={platform:W3,...i},m={...c.platform,_c:o};return j3(a,r,{...c,platform:m})};var cD=typeof document<"u",dD=function(){},Sc=cD?f.useLayoutEffect:dD;function Rc(a,r){if(a===r)return!0;if(typeof a!=typeof r)return!1;if(typeof a=="function"&&a.toString()===r.toString())return!0;let i,o,c;if(a&&r&&typeof a=="object"){if(Array.isArray(a)){if(i=a.length,i!==r.length)return!1;for(o=i;o--!==0;)if(!Rc(a[o],r[o]))return!1;return!0}if(c=Object.keys(a),i=c.length,i!==Object.keys(r).length)return!1;for(o=i;o--!==0;)if(!{}.hasOwnProperty.call(r,c[o]))return!1;for(o=i;o--!==0;){const m=c[o];if(!(m==="_owner"&&a.$$typeof)&&!Rc(a[m],r[m]))return!1}return!0}return a!==a&&r!==r}function db(a){return typeof window>"u"?1:(a.ownerDocument.defaultView||window).devicePixelRatio||1}function Yv(a,r){const i=db(a);return Math.round(r*i)/i}function Im(a){const r=f.useRef(a);return Sc(()=>{r.current=a}),r}function uD(a){a===void 0&&(a={});const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:c,elements:{reference:m,floating:u}={},transform:g=!0,whileElementsMounted:x,open:p}=a,[y,v]=f.useState({x:0,y:0,strategy:i,placement:r,middlewareData:{},isPositioned:!1}),[w,N]=f.useState(o);Rc(w,o)||N(o);const[D,b]=f.useState(null),[E,_]=f.useState(null),M=f.useCallback(F=>{F!==O.current&&(O.current=F,b(F))},[]),k=f.useCallback(F=>{F!==L.current&&(L.current=F,_(F))},[]),C=m||D,j=u||E,O=f.useRef(null),L=f.useRef(null),R=f.useRef(y),H=x!=null,z=Im(x),V=Im(c),Z=Im(p),I=f.useCallback(()=>{if(!O.current||!L.current)return;const F={placement:r,strategy:i,middleware:w};V.current&&(F.platform=V.current),oD(O.current,L.current,F).then(ne=>{const T={...ne,isPositioned:Z.current!==!1};ue.current&&!Rc(R.current,T)&&(R.current=T,yr.flushSync(()=>{v(T)}))})},[w,r,i,V,Z]);Sc(()=>{p===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,v(F=>({...F,isPositioned:!1})))},[p]);const ue=f.useRef(!1);Sc(()=>(ue.current=!0,()=>{ue.current=!1}),[]),Sc(()=>{if(C&&(O.current=C),j&&(L.current=j),C&&j){if(z.current)return z.current(C,j,I);I()}},[C,j,I,z,H]);const X=f.useMemo(()=>({reference:O,floating:L,setReference:M,setFloating:k}),[M,k]),P=f.useMemo(()=>({reference:C,floating:j}),[C,j]),$=f.useMemo(()=>{const F={position:i,left:0,top:0};if(!P.floating)return F;const ne=Yv(P.floating,y.x),T=Yv(P.floating,y.y);return g?{...F,transform:"translate("+ne+"px, "+T+"px)",...db(P.floating)>=1.5&&{willChange:"transform"}}:{position:i,left:ne,top:T}},[i,g,P.floating,y.x,y.y]);return f.useMemo(()=>({...y,update:I,refs:X,elements:P,floatingStyles:$}),[y,I,X,P,$])}const mD=a=>{function r(i){return{}.hasOwnProperty.call(i,"current")}return{name:"arrow",options:a,fn(i){const{element:o,padding:c}=typeof a=="function"?a(i):a;return o&&r(o)?o.current!=null?Gv({element:o.current,padding:c}).fn(i):{}:o?Gv({element:o,padding:c}).fn(i):{}}}},fD=(a,r)=>({...sD(a),options:[a,r]}),hD=(a,r)=>({...aD(a),options:[a,r]}),xD=(a,r)=>({...iD(a),options:[a,r]}),pD=(a,r)=>({...nD(a),options:[a,r]}),gD=(a,r)=>({...rD(a),options:[a,r]}),vD=(a,r)=>({...lD(a),options:[a,r]}),yD=(a,r)=>({...mD(a),options:[a,r]});var bD="Arrow",ub=f.forwardRef((a,r)=>{const{children:i,width:o=10,height:c=5,...m}=a;return e.jsx(Be.svg,{...m,ref:r,width:o,height:c,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:a.asChild?i:e.jsx("polygon",{points:"0,0 30,0 15,10"})})});ub.displayName=bD;var jD=ub,Wf="Popper",[mb,nd]=Bs(Wf),[ND,fb]=mb(Wf),hb=a=>{const{__scopePopper:r,children:i}=a,[o,c]=f.useState(null);return e.jsx(ND,{scope:r,anchor:o,onAnchorChange:c,children:i})};hb.displayName=Wf;var xb="PopperAnchor",pb=f.forwardRef((a,r)=>{const{__scopePopper:i,virtualRef:o,...c}=a,m=fb(xb,i),u=f.useRef(null),g=it(r,u);return f.useEffect(()=>{m.onAnchorChange(o?.current||u.current)}),o?null:e.jsx(Be.div,{...c,ref:g})});pb.displayName=xb;var eh="PopperContent",[wD,SD]=mb(eh),gb=f.forwardRef((a,r)=>{const{__scopePopper:i,side:o="bottom",sideOffset:c=0,align:m="center",alignOffset:u=0,arrowPadding:g=0,avoidCollisions:x=!0,collisionBoundary:p=[],collisionPadding:y=0,sticky:v="partial",hideWhenDetached:w=!1,updatePositionStrategy:N="optimized",onPlaced:D,...b}=a,E=fb(eh,i),[_,M]=f.useState(null),k=it(r,re=>M(re)),[C,j]=f.useState(null),O=qf(C),L=O?.width??0,R=O?.height??0,H=o+(m!=="center"?"-"+m:""),z=typeof y=="number"?y:{top:0,right:0,bottom:0,left:0,...y},V=Array.isArray(p)?p:[p],Z=V.length>0,I={padding:z,boundary:V.filter(kD),altBoundary:Z},{refs:ue,floatingStyles:X,placement:P,isPositioned:$,middlewareData:F}=uD({strategy:"fixed",placement:H,whileElementsMounted:(...re)=>tD(...re,{animationFrame:N==="always"}),elements:{reference:E.anchor},middleware:[fD({mainAxis:c+R,alignmentAxis:u}),x&&hD({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?xD():void 0,...I}),x&&pD({...I}),gD({...I,apply:({elements:re,rects:je,availableWidth:Ae,availableHeight:ie})=>{const{width:we,height:_e}=je.reference,me=re.floating.style;me.setProperty("--radix-popper-available-width",`${Ae}px`),me.setProperty("--radix-popper-available-height",`${ie}px`),me.setProperty("--radix-popper-anchor-width",`${we}px`),me.setProperty("--radix-popper-anchor-height",`${_e}px`)}}),C&&yD({element:C,padding:g}),_D({arrowWidth:L,arrowHeight:R}),w&&vD({strategy:"referenceHidden",...I})]}),[ne,T]=bb(P),B=ea(D);$t(()=>{$&&B?.()},[$,B]);const ee=F.arrow?.x,te=F.arrow?.y,ye=F.arrow?.centerOffset!==0,[ge,K]=f.useState();return $t(()=>{_&&K(window.getComputedStyle(_).zIndex)},[_]),e.jsx("div",{ref:ue.setFloating,"data-radix-popper-content-wrapper":"",style:{...X,transform:$?X.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ge,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(" "),...F.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:a.dir,children:e.jsx(wD,{scope:i,placedSide:ne,onArrowChange:j,arrowX:ee,arrowY:te,shouldHideArrow:ye,children:e.jsx(Be.div,{"data-side":ne,"data-align":T,...b,ref:k,style:{...b.style,animation:$?void 0:"none"}})})})});gb.displayName=eh;var vb="PopperArrow",CD={top:"bottom",right:"left",bottom:"top",left:"r
700ight"},yb=f.forwardRef(function(r,i){const{__scopePopper:o,...c}=r,m=SD(vb,o),u=CD[m.placedSide];return e.jsx("span",{ref:m.onArrowChange,style:{position:"absolute",left:m.arrowX,top:m.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[m.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[m.placedSide],visibility:m.shouldHideArrow?"hidden":void 0},children:e.jsx(jD,{...c,ref:i,style:{...c.style,display:"block"}})})});yb.displayName=vb;function kD(a){return a!==null}var _D=a=>({name:"transformOrigin",options:a,fn(r){const{placement:i,rects:o,middlewareData:c}=r,u=c.arrow?.centerOffset!==0,g=u?0:a.arrowWidth,x=u?0:a.arrowHeight,[p,y]=bb(i),v={start:"0%",center:"50%",end:"100%"}[y],w=(c.arrow?.x??0)+g/2,N=(c.arrow?.y??0)+x/2;let D="",b="";return p==="bottom"?(D=u?v:`${w}px`,b=`${-x}px`):p==="top"?(D=u?v:`${w}px`,b=`${o.floating.height+x}px`):p==="right"?(D=`${-x}px`,b=u?v:`${N}px`):p==="left"&&(D=`${o.floating.width+x}px`,b=u?v:`${N}px`),{data:{x:D,y:b}}}});function bb(a){const[r,i="center"]=a.split("-");return[r,i]}var jb=hb,Nb=pb,wb=gb,Sb=yb,Cb=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"}),DD="VisuallyHidden",ED=f.forwardRef((a,r)=>e.jsx(Be.span,{...a,ref:r,style:{...Cb,...a.style}}));ED.displayName=DD;var MD=[" ","Enter","ArrowUp","ArrowDown"],TD=[" ","Enter"],gr="Select",[rd,ld,AD]=$f(gr),[kl,IM]=Bs(gr,[AD,nd]),id=nd(),[RD,In]=kl(gr),[OD,PD]=kl(gr),kb=a=>{const{__scopeSelect:r,children:i,open:o,defaultOpen:c,onOpenChange:m,value:u,defaultValue:g,onValueChange:x,dir:p,name:y,autoComplete:v,disabled:w,required:N,form:D}=a,b=id(r),[E,_]=f.useState(null),[M,k]=f.useState(null),[C,j]=f.useState(!1),O=Qc(p),[L,R]=Ya({prop:o,defaultProp:c??!1,onChange:m,caller:gr}),[H,z]=Ya({prop:u,defaultProp:g,onChange:x,caller:gr}),V=f.useRef(null),Z=E?D||!!E.closest("form"):!0,[I,ue]=f.useState(new Set),X=Array.from(I).map(P=>P.props.value).join(";");return e.jsx(jb,{...b,children:e.jsxs(RD,{required:N,scope:r,trigger:E,onTriggerChange:_,valueNode:M,onValueNodeChange:k,valueNodeHasChildren:C,onValueNodeHasChildrenChange:j,contentId:Qs(),value:H,onValueChange:z,open:L,onOpenChange:R,dir:O,triggerPointerDownPosRef:V,disabled:w,children:[e.jsx(rd.Provider,{scope:r,children:e.jsx(OD,{scope:a.__scopeSelect,onNativeOptionAdd:f.useCallback(P=>{ue($=>new Set($).add(P))},[]),onNativeOptionRemove:f.useCallback(P=>{ue($=>{const F=new Set($);return F.delete(P),F})},[]),children:i})}),Z?e.jsxs(Zb,{"aria-hidden":!0,required:N,tabIndex:-1,name:y,autoComplete:v,value:H,onChange:P=>z(P.target.value),disabled:w,form:D,children:[H===void 0?e.jsx("option",{value:""}):null,Array.from(I)]},X):null]})})};kb.displayName=gr;var _b="SelectTrigger",Db=f.forwardRef((a,r)=>{const{__scopeSelect:i,disabled:o=!1,...c}=a,m=id(i),u=In(_b,i),g=u.disabled||o,x=it(r,u.onTriggerChange),p=ld(i),y=f.useRef("touch"),[v,w,N]=Jb(b=>{const E=p().filter(k=>!k.disabled),_=E.find(k=>k.value===u.value),M=Wb(E,b,_);M!==void 0&&u.onValueChange(M.value)}),D=b=>{g||(u.onOpenChange(!0),N()),b&&(u.triggerPointerDownPosRef.current={x:Math.round(b.pageX),y:Math.round(b.pageY)})};return e.jsx(Nb,{asChild:!0,...m,children:e.jsx(Be.button,{type:"button",role:"combobox","aria-controls":u.contentId,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:g,"data-disabled":g?"":void 0,"data-placeholder":Qb(u.value)?"":void 0,...c,ref:x,onClick:Te(c.onClick,b=>{b.currentTarget.focus(),y.current!=="mouse"&&D(b)}),onPointerDown:Te(c.onPointerDown,b=>{y.current=b.pointerType;const E=b.target;E.hasPointerCapture(b.pointerId)&&E.releasePointerCapture(b.pointerId),b.button===0&&b.ctrlKey===!1&&b.pointerType==="mouse"&&(D(b),b.preventDefault())}),onKeyDown:Te(c.onKeyDown,b=>{const E=v.current!=="";!(b.ctrlKey||b.altKey||b.metaKey)&&b.key.length===1&&w(b.key),!(E&&b.key===" ")&&MD.includes(b.key)&&(D(),b.preventDefault())})})})});Db.displayName=_b;var Eb="SelectValue",Mb=f.forwardRef((a,r)=>{const{__scopeSelect:i,className:o,style:c,children:m,placeholder:u="",...g}=a,x=In(Eb,i),{onValueNodeHasChildrenChange:p}=x,y=m!==void 0,v=it(r,x.onValueNodeChange);return $t(()=>{p(y)},[p,y]),e.jsx(Be.span,{...g,ref:v,style:{pointerEvents:"none"}
vendor: 13,837 bytes, line 700
700,children:Qb(x.value)?e.jsx(e.Fragment,{children:u}):m})});Mb.displayName=Eb;var zD="SelectIcon",Tb=f.forwardRef((a,r)=>{const{__scopeSelect:i,children:o,...c}=a;return e.jsx(Be.span,{"aria-hidden":!0,...c,ref:r,children:o||"▼"})});Tb.displayName=zD;var LD="SelectPortal",Ab=a=>e.jsx(Yc,{asChild:!0,...a});Ab.displayName=LD;var vr="SelectContent",Rb=f.forwardRef((a,r)=>{const i=In(vr,a.__scopeSelect),[o,c]=f.useState();if($t(()=>{c(new DocumentFragment)},[]),!i.open){const m=o;return m?yr.createPortal(e.jsx(Ob,{scope:a.__scopeSelect,children:e.jsx(rd.Slot,{scope:a.__scopeSelect,children:e.jsx("div",{children:a.children})})}),m):null}return e.jsx(Pb,{...a,ref:r})});Rb.displayName=vr;var Xs=10,[Ob,Fn]=kl(vr),UD="SelectContentImpl",$D=hr("SelectContent.RemoveScroll"),Pb=f.forwardRef((a,r)=>{const{__scopeSelect:i,position:o="item-aligned",onCloseAutoFocus:c,onEscapeKeyDown:m,onPointerDownOutside:u,side:g,sideOffset:x,align:p,alignOffset:y,arrowPadding:v,collisionBoundary:w,collisionPadding:N,sticky:D,hideWhenDetached:b,avoidCollisions:E,..._}=a,M=In(vr,i),[k,C]=f.useState(null),[j,O]=f.useState(null),L=it(r,re=>C(re)),[R,H]=f.useState(null),[z,V]=f.useState(null),Z=ld(i),[I,ue]=f.useState(!1),X=f.useRef(!1);f.useEffect(()=>{if(k)return Of(k)},[k]),Rf();const P=f.useCallback(re=>{const[je,...Ae]=Z().map(_e=>_e.ref.current),[ie]=Ae.slice(-1),we=document.activeElement;for(const _e of re)if(_e===we||(_e?.scrollIntoView({block:"nearest"}),_e===je&&j&&(j.scrollTop=0),_e===ie&&j&&(j.scrollTop=j.scrollHeight),_e?.focus(),document.activeElement!==we))return},[Z,j]),$=f.useCallback(()=>P([R,k]),[P,R,k]);f.useEffect(()=>{I&&$()},[I,$]);const{onOpenChange:F,triggerPointerDownPosRef:ne}=M;f.useEffect(()=>{if(k){let re={x:0,y:0};const je=ie=>{re={x:Math.abs(Math.round(ie.pageX)-(ne.current?.x??0)),y:Math.abs(Math.round(ie.pageY)-(ne.current?.y??0))}},Ae=ie=>{re.x<=10&&re.y<=10?ie.preventDefault():k.contains(ie.target)||F(!1),document.removeEventListener("pointermove",je),ne.current=null};return ne.current!==null&&(document.addEventListener("pointermove",je),document.addEventListener("pointerup",Ae,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",je),document.removeEventListener("pointerup",Ae,{capture:!0})}}},[k,F,ne]),f.useEffect(()=>{const re=()=>F(!1);return window.addEventListener("blur",re),window.addEventListener("resize",re),()=>{window.removeEventListener("blur",re),window.removeEventListener("resize",re)}},[F]);const[T,B]=Jb(re=>{const je=Z().filter(we=>!we.disabled),Ae=je.find(we=>we.ref.current===document.activeElement),ie=Wb(je,re,Ae);ie&&setTimeout(()=>ie.ref.current.focus())}),ee=f.useCallback((re,je,Ae)=>{const ie=!X.current&&!Ae;(M.value!==void 0&&M.value===je||ie)&&(H(re),ie&&(X.current=!0))},[M.value]),te=f.useCallback(()=>k?.focus(),[k]),ye=f.useCallback((re,je,Ae)=>{const ie=!X.current&&!Ae;(M.value!==void 0&&M.value===je||ie)&&V(re)},[M.value]),ge=o==="popper"?ff:zb,K=ge===ff?{side:g,sideOffset:x,align:p,alignOffset:y,arrowPadding:v,collisionBoundary:w,collisionPadding:N,sticky:D,hideWhenDetached:b,avoidCollisions:E}:{};return e.jsx(Ob,{scope:i,content:k,viewport:j,onViewportChange:O,itemRefCallback:ee,selectedItem:R,onItemLeave:te,itemTextRefCallback:ye,focusSelectedItem:$,selectedItemText:z,position:o,isPositioned:I,searchRef:T,children:e.jsx(Kc,{as:$D,allowPinchZoom:!0,children:e.jsx(Gc,{asChild:!0,trapped:M.open,onMountAutoFocus:re=>{re.preventDefault()},onUnmountAutoFocus:Te(c,re=>{M.trigger?.focus({preventScroll:!0}),re.preventDefault()}),children:e.jsx(Vc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:m,onPointerDownOutside:u,onFocusOutside:re=>re.preventDefault(),onDismiss:()=>M.onOpenChange(!1),children:e.jsx(ge,{role:"listbox",id:M.contentId,"data-state":M.open?"open":"closed",dir:M.dir,onContextMenu:re=>re.preventDefault(),..._,...K,onPlaced:()=>ue(!0),ref:L,style:{display:"flex",flexDirection:"column",outline:"none",..._.style},onKeyDown:Te(_.onKeyDown,re=>{const je=re.ctrlKey||re.altKey||re.metaKey;if(re.key==="Tab"&&re.preventDefault(),!je&&re.key.length===1&&B(re.key),["ArrowUp","ArrowDown","Home","End"].includes(re.key)){let ie=Z().filter(we=>!we.disabled).map(we=>we.ref.current);if(["ArrowUp","End"].includes(re.key)&&(ie=ie.slice().reverse()),["ArrowUp","ArrowDown"].includes(re.key)){const we=re.target,_e=ie.indexOf(we);ie=ie.slice(_e+1)}setTimeout(()=>P(ie)),re.preventDefault()}})})})})})})});Pb.displayName=UD;var ID="SelectItemAlignedPosition",zb=f.forwardRef((a,r)=>{const{__scopeSelect:i,onPlaced:o,...c}=a,m=In(vr,i),u=Fn(vr,i),[g,x]=f.useState(null),[p,y]=f.useState(null),v=it(r,L=>y(L)),w=ld(i),N=f.useRef(!1),D=f.useRef(!0),{viewport:b,selectedItem:E,selectedItemText:_,focusSelectedItem:M}=u,k=f.useCallback(()=>{if(m.trigger&&m.valueNode&&g&&p&&b&&E&&_){const L=m.trigger.getBoundingClientRect(),R=p.getBoundingClientRect(),H=m.valueNode.getBoundingClientRect(),z=_.getBoundingClientRect();if(m.dir!=="rtl"){const we=z.left-R.left,_e=H.left-we,me=L.left-_e,Se=L.width+me,Pe=Math.max(Se,R.width),pt=window.innerWidth-Xs,Ve=Lv(_e,[Xs,Math.max(Xs,pt-Pe)]);g.style.minWidth=Se+"px",g.style.left=Ve+"px"}else{const we=R.right-z.right,_e=window.innerWidth-H.right-we,me=window.innerWidth-L.right-_e,Se=L.width+me,Pe=Math.max(Se,R.width),pt=window.innerWidth-Xs,Ve=Lv(_e,[Xs,Math.max(Xs,pt-Pe)]);g.style.minWidth=Se+"px",g.style.right=Ve+"px"}const V=w(),Z=window.innerHeight-Xs*2,I=b.scrollHeight,ue=window.getComputedStyle(p),X=parseInt(ue.borderTopWidth,10),P=parseInt(ue.paddingTop,10),$=parseInt(ue.borderBottomWidth,10),F=parseInt(ue.paddingBottom,10),ne=X+P+I+F+$,T=Math.min(E.offsetHeight*5,ne),B=window.getComputedStyle(b),ee=parseInt(B.paddingTop,10),te=parseInt(B.paddingBottom,10),ye=L.top+L.height/2-Xs,ge=Z-ye,K=E.offsetHeight/2,re=E.offsetTop+K,je=X+P+re,Ae=ne-je;if(je<=ye){const we=V.length>0&&E===V[V.length-1].ref.current;g.style.bottom="0px";const _e=p.clientHeight-b.offsetTop-b.offsetHeight,me=Math.max(ge,K+(we?te:0)+_e+$),Se=je+me;g.style.height=Se+"px"}else{const we=V.length>0&&E===V[0].ref.current;g.style.top="0px";const me=Math.max(ye,X+b.offsetTop+(we?ee:0)+K)+Ae;g.style.height=me+"px",b.scrollTop=je-ye+b.offsetTop}g.style.margin=`${Xs}px 0`,g.style.minHeight=T+"px",g.style.maxHeight=Z+"px",o?.(),requestAnimationFrame(()=>N.current=!0)}},[w,m.trigger,m.valueNode,g,p,b,E,_,m.dir,o]);$t(()=>k(),[k]);const[C,j]=f.useState();$t(()=>{p&&j(window.getComputedStyle(p).zIndex)},[p]);const O=f.useCallback(L=>{L&&D.current===!0&&(k(),M?.(),D.current=!1)},[k,M]);return e.jsx(BD,{scope:i,contentWrapper:g,shouldExpandOnScrollRef:N,onScrollButtonChange:O,children:e.jsx("div",{ref:x,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:e.jsx(Be.div,{...c,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...c.style}})})})});zb.displayName=ID;var FD="SelectPopperPosition",ff=f.forwardRef((a,r)=>{const{__scopeSelect:i,align:o="start",collisionPadding:c=Xs,...m}=a,u=id(i);return e.jsx(wb,{...u,...m,ref:r,align:o,collisionPadding:c,style:{boxSizing:"border-box",...m.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)"}})});ff.displayName=FD;var[BD,th]=kl(vr,{}),hf="SelectViewport",Lb=f.forwardRef((a,r)=>{const{__scopeSelect:i,nonce:o,...c}=a,m=Fn(hf,i),u=th(hf,i),g=it(r,m.onViewportChange),x=f.useRef(0);return e.jsxs(e.Fragment,{children:[e.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:o}),e.jsx(rd.Slot,{scope:i,children:e.jsx(Be.div,{"data-radix-select-viewport":"",role:"presentation",...c,ref:g,style:{position:"relative",flex:1,overflow:"hidden auto",...c.style},onScroll:Te(c.onScroll,p=>{const y=p.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:w}=u;if(w?.current&&v){const N=Math.abs(x.current-y.scrollTop);if(N>0){const D=window.innerHeight-Xs*2,b=parseFloat(v.style.minHeight),E=parseFloat(v.style.height),_=Math.max(b,E);if(_<D){const M=_+N,k=Math.min(D,M),C=M-k;v.style.height=k+"px",v.style.bottom==="0px"&&(y.scrollTop=C>0?C:0,v.style.justifyContent="flex-end")}}}x.current=y.scrollTop})})})]})});Lb.displayName=hf;var Ub="SelectGroup",[qD,HD]=kl(Ub),VD=f.forwardRef((a,r)=>{const{__scopeSelect:i,...o}=a,c=Qs();return e.jsx(qD,{scope:i,id:c,children:e.jsx(Be.div,{role:"group","aria-labelledby":c,...o,ref:r})})});VD.displayName=Ub;var $b="SelectLabel",Ib=f.forwardRef((a,r)=>{const{__scopeSelect:i,...o}=a,c=HD($b,i);return e.jsx(Be.div,{id:c.id,...o,ref:r})});Ib.displayName=$b;var Oc="SelectItem",[GD,Fb]=kl(Oc),Bb=f.forwardRef((a,r)=>{const{__scopeSelect:i,value:o,disabled:c=!1,textValue:m,...u}=a,g=In(Oc,i),x=Fn(Oc,i),p=g.value===o,[y,v]=f.useState(m??""),[w,N]=f.useState(!1),D=it(r,M=>x.itemRefCallback?.(M,o,c)),b=Qs(),E=f.useRef("touch"),_=()=>{c||(g.onValueChange(o),g.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return e.jsx(GD,{scope:i,value:o,disabled:c,textId:b,isSelected:p,onItemTextChange:f.useCallback(M=>{v(k=>k||(M?.textContent??"").trim())},[]),children:e.jsx(rd.ItemSlot,{scope:i,value:o,disabled:c,textValue:y,children:e.jsx(Be.div,{role:"option","aria-labelledby":b,"data-highlighted":w?"":void 0,"aria-selected":p&&w,"data-state":p?"checked":"unchecked","aria-disabled":c||void 0,"data-disabled":c?"":void 0,tabIndex:c?void 0:-1,...u,ref:D,onFocus:Te(u.onFocus,()=>N(!0)),onBlur:Te(u.onBlur,()=>N(!1)),onClick:Te(u.onClick,()=>{E.current!=="mouse"&&_()}),onPointerUp:Te(u.onPointerUp,()=>{E.current==="mouse"&&_()}),onPointerDown:Te(u.onPointerDown,M=>{E.current=M.pointerType}),onPointerMove:Te(u.onPointerMove,M=>{E.current=M.pointerType,c?x.onItemLeave?.():E.current==="mouse"&&M.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Te(u.onPointerLeave,M=>{M.currentTarget===document.activeElement&&x.onItemLeave?.()}),onKeyDown:Te(u.onKeyDown,M=>{x.searchRef?.current!==""&&M.key===" "||(TD.includes(M.key)&&_(),M.key===" "&&M.preventDefault())})})})})});Bb.displayName=Oc;var Ai="SelectItemText",qb=f.forwardRef((a,r)=>{const{__scopeSelect:i,className:o,style:c,...m}=a,u=In(Ai,i),g=Fn(Ai,i),x=Fb(Ai,i),p=PD(Ai,i),[y,v]=f.useState(null),w=it(r,_=>v(_),x.onItemTextChange,_=>g.itemTextRefCallback?.(_,x.value,x.disabled)),N=y?.textContent,D=f.useMemo(()=>e.jsx("option",{value:x.value,disabled:x.disabled,children:N},x.value),[x.disabled,x.value,N]),{onNativeOptionAdd:b,onNativeOptionRemove:E}=p;return $t(()=>(b(D),()=>E(D)),[b,E,D]),e.jsxs(e.Fragment,{children:[e.jsx(Be.span,{id:x.textId,...m,ref:w}),x.isSelected&&u.valueNode&&!u.valueNodeHasChildren?yr.createPortal(m.children,u.valueNode):null]})});qb.displayName=Ai;var Hb="SelectItemIndicator",Vb=f.forwardRef((a,r)=>{const{__scopeSelect:i,...o}=a;return Fb(Hb,i).isSelected?e.jsx(Be.span,{"aria-hidden":!0,...o,ref:r}):null});Vb.displayName=Hb;var xf="SelectScrollUpButton",Gb=f.forwardRef((a,r)=>{const i=Fn(xf,a.__scopeSelect),o=th(xf,a.__scopeSelect),[c,m]=f.useState(!1),u=it(r,o.onScrollButtonChange);return $t(()=>{if(i.viewport&&i.isPositioned){let g=function(){const p=x.scrollTop>0;m(p)};const x=i.viewport;return g(),x.addEventListener("scroll",g),()=>x.removeEventListener("scroll",g)}},[i.viewport,i.isPositioned]),c?e.jsx(Xb,{...a,ref:u,onAutoScroll:()=>{const{viewport:g,selectedItem:x}=i;g&&x&&(g.scrollTop=g.scrollTop-x.offsetHeight)}}):null});Gb.displayName=xf;var pf="SelectScrollDownButton",Yb=f.forwardRef((a,r)=>{const i=Fn(pf,a.__scopeSelect),o=th(pf,a.__scopeSelect),[c,m]=f.useState(!1),u=it(r,o.onScrollButtonChange);return $t(()=>{if(i.viewport&&i.isPositioned){let g=function(){const p=x.scrollHeight-x.clientHeight,y=Math.ceil(x.scrollTop)<p;m(y)};const x=i.viewport;return g(),x.addEventListener("scroll",g),()=>x.removeEventListener("scroll",g)}},[i.viewport,i.isPositioned]),c?e.jsx(Xb,{...a,ref:u,onAutoScroll:()=>{const{viewport:g,selectedItem:x}=i;g&&x&&(g.scrollTop=g.scrollTop+x.offsetHeight)}}):null});Yb.displayName=pf;var Xb=f.forwardRef((a,r)=>{const{__scopeSelect:i,onAutoScroll:o,...c}=a,m=Fn("SelectScrollButton",i),u=f.useRef(null),g=ld(i),x=f.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return f.useEffect(()=>()=>x(),[x]),$t(()=>{g().find(y=>y.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[g]),e.jsx(Be.div,{"aria-hidden":!0,...c,ref:r,style:{flexShrink:0,...c.style},onPointerDown:Te(c.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(o,50))}),onPointerMove:Te(c.onPointerMove,()=>{m.onItemLeave?.(),u.current===null&&(u.current=window.setInterval(o,50))}),onPointerLeave:Te(c.onPointerLeave,()=>{x()})})}),YD="SelectSeparator",Kb=f.forwardRef((a,r)=>{const{__scopeSelect:i,...o}=a;return e.jsx(Be.div,{"aria-hidden":!0,...o,ref:r})});Kb.displayName=YD;var gf="SelectArrow",XD=f.forwardRef((a,r)=>{const{__scopeSelect:i,...o}=a,c=id(i),m=In(gf,i),u=Fn(gf,i);return m.open&&u.position==="popper"?e.jsx(Sb,{...c,...o,ref:r}):null});XD.displayName=gf;var KD="SelectBubbleInput",Zb=f.forwardRef(({__scopeSelect:a,value:r,...i},o)=>{const c=f.useRef(null),m=it(o,c),u=Bf(r);return f.useEffect(()=>{const g=c.current;if(!g)return;const x=window.HTMLSelectElement.prototype,y=Object.getOwnPropertyDescriptor(x,"value").set;if(u!==r&&y){const v=new Event("change",{bubbles:!0});
vendor: 1,145 bytes, line 700
700y.call(g,r),g.dispatchEvent(v)}},[u,r]),e.jsx(Be.select,{...i,style:{...Cb,...i.style},ref:m,defaultValue:r})});Zb.displayName=KD;function Qb(a){return a===""||a===void 0}function Jb(a){const r=ea(a),i=f.useRef(""),o=f.useRef(0),c=f.useCallback(u=>{const g=i.current+u;r(g),function x(p){i.current=p,window.clearTimeout(o.current),p!==""&&(o.current=window.setTimeout(()=>x(""),1e3))}(g)},[r]),m=f.useCallback(()=>{i.current="",window.clearTimeout(o.current)},[]);return f.useEffect(()=>()=>window.clearTimeout(o.current),[]),[i,c,m]}function Wb(a,r,i){const c=r.length>1&&Array.from(r).every(p=>p===r[0])?r[0]:r,m=i?a.indexOf(i):-1;let u=ZD(a,Math.max(m,0));c.length===1&&(u=u.filter(p=>p!==i));const x=u.find(p=>p.textValue.toLowerCase().startsWith(c.toLowerCase()));return x!==i?x:void 0}function ZD(a,r){return a.map((i,o)=>a[(r+o)%a.length])}var QD=kb,ej=Db,JD=Mb,WD=Tb,e5=Ab,tj=Rb,t5=Lb,sj=Ib,aj=Bb,s5=qb,a5=Vb,nj=Gb,rj=Yb,lj=Kb;const Pn=QD,zn=JD,Za=f.forwardRef(({className:a,children:r,...i},o)=>e.jsxs(ej,{ref:o,className:Ge("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm r
700ing-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",a),...i,children:[r,e.jsx(WD,{asChild:!0,children:e.jsx(Ln,{className:"h-4 w-4 opacity-50"})})]}));Za.displayName=ej.displayName;const ij=f.forwardRef(({className:a,...r},i)=>e.jsx(nj,{ref:i,className:Ge("flex cursor-default items-center justify-center py-1",a),...r,children:e.jsx(x2,{className:"h-4 w-4"})}));ij.displayName=nj.displayName;const oj=f.forwardRef(({className:a,...r},i)=>e.jsx(rj,{ref:i,className:Ge("flex cursor-default items-center justify-center py-1",a),...r,children:e.jsx(Ln,{className:"h-4 w-4"})}));oj.displayName=rj.displayName;const Qa=f.forwardRef(({className:a,children:r,position:i="popper",...o},c)=>e.jsx(e5,{children:e.jsxs(tj,{ref:c,className:Ge("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",i==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:i,...o,children:[e.jsx(ij,{}),e.jsx(t5,{className:Ge("p-1",i==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),e.jsx(oj,{})]})}));Qa.displayName=tj.displayName;const n5=f.forwardRef(({className:a,...r},i)=>e.jsx(sj,{ref:i,className:Ge("py-1.5 pl-8 pr-2 text-sm font-semibold",a),...r}));n5.displayName=sj.displayName;const kt=f.forwardRef(({className:a,children:r,...i},o)=>e.jsxs(aj,{ref:o,className:Ge("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...i,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(a5,{children:e.jsx(br,{className:"h-4 w-4"})})}),e.jsx(s5,{children:r})]}));kt.displayName=aj.displayName;const r5=f.forwardRef(({className:a,...r},i)=>e.jsx(lj,{ref:i,className:Ge("-mx-1 my-1 h-px bg-muted",a),...r}));r5.displayName=lj.displayName;const cj=a=>{switch(a){case"To Do":return"bg-gray-500 text-white";case"In Progress":return"bg-primary-mint text-white";case"In Review":return"bg-yellow-500 text-white";case"Done":return"bg-green-500 text-white";default:return"bg-neutral-dark text-white"}},dj=a=>{switch(a){case"High":return"bg-red-500 text-white";case"Medium":return"bg-yellow-500 text-white";case"Low":return"bg-green-500 text-white";default:return"bg-neutral-dark text-white"}},l5=a=>a?new Date(a).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"No due date",vf=a=>a.status==="Done"?!1:a.due_date&&new Date(a.due_date)<new Date,sh=(a,r,i,o="",c="")=>{if(r){const m=r.toLowerCase();if(!(a.title.toLowerCase().includes(m)||a.description.toLowerCase().includes(m)||a.assignee&&`${a.assignee.first_name} ${a.assignee.last_name}`.toLowerCase().includes(m)||o.toLowerCase().includes(m)||c.toLowerCase().includes(m)))return!1}if(i.statuses&&i.statuses.length>0&&!i.statuses.includes(a.status)||i.priorities&&i.priorities.length>0&&!i.priorities.includes(a.priority))return!1;if(i.assignees&&i.assignees.length>0){const m=a.assignee?a.assignee.id||`${a.assignee.first_name}_${a.assignee.last_name}`:"unassigned";if(!i.assignees.includes(m))return!1}if(i.dueDateRange){const m=a.due_date?new Date(a.due_date):null,u=new Date;switch(u.setHours(0,0,0,0),i.dueDateRange){case"overdue":if(!vf(a))return!1;break;case"today":if(!m||m.toDateString()!==u.toDateString())return!1;break;case"tomorrow":const g=new Date(u);if(g.setDate(g.getDate()+1),!m||m.toDateString()!==g.toDateString())return!1;break;case"this_week":const x=new Date(u);x.setDate(u.getDate()-u.getDay());const p=new Date(x);if(p.setDate(x.getDate()+6),!m||m<x||m>p)return!1;break;case"next_week":const y=new Date(u);y.setDate(u.getDate()+(7-u.getDay()));const v=new Date(y);if(v.setDate(y.getDate()+6),!m||m<y||m>v)return!1;break;case"no_due_date":if(m)return!1;break}}return!(i.showOverdueOnly&&!vf(a))};function i5({client:a,searchTerm:r,filters:i,onAddTask:o}){const[c,m]=f.useState(!1),{hasMatchingTasks:u,matchingTaskCount:g}=f.useMemo(()=>{let x=0;return{hasMatchingTasks:a.projects?.some(y=>{const v=y.tasks?.filter(w=>sh(w,r,i,a.name,y.name))||[];return x+=v.length,v.length>0})||!r&&Object.keys(i).every(y=>i[y]===null||i[y]===!1||Array.isArray(i[y])&&i[y].length===0)&&a.task_count>0,matchingTaskCount:x}},[a,r,i]);return u?e.jsxs("div",{className:"border border-border rounded-lg",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>m(!c),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[c?e.jsx(Ln,{className:"w-4 h-4 text-muted-foreground"}):e.jsx(jr,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg",children:e.jsx(ps,{className:"w-5 h-5 text-blue-500"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-foreground",children:a.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:g>0&&(r||Object.keys(i).some(x=>i[x]!==null&&i[x]!==!1&&(!Array.isArray(i[x])||i[x].length>0)))?`${g} of ${a.task_count} task${a.task_count!==1?"s":""}`:`${a.task_count} task${a.task_count!==1?"s":""}`})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(G,{variant:"ghost",size:"sm",onClick:x=>{x.stopPropagation(),o()},className:"opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(Rt,{className:"w-4 h-4"})})})]}),c&&e.jsx("div",{className:"border-t border-border",children:a.projects?.map(x=>e.jsx(o5,{project:x,searchTerm:r,filters:i,onAddTask:o},x.id))})]}):null}function o5({project:a,searchTerm:r,filters:i,onAddTask:o}){const[c,m]=f.useState(!1),u=a.tasks?.filter(g=>sh(g,r,i,"",a.name))||[];return u.length===0?null:e.jsxs("div",{className:"border-t border-border group",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 pl-8 cursor-pointer hover:bg-muted/30 transition-colors",onClick:()=>m(!c),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[c?e.jsx(Ln,{className:"w-4 h-4 text-muted-foreground"}):e.jsx(jr,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("div",{className:"p-2 bg-green-500/10 rounded-lg",children:e.jsx($c,{
700className:"w-4 h-4 text-green-500"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-foreground",children:a.name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[u.length>0&&(r||Object.keys(i).some(g=>i[g]!==null&&i[g]!==!1&&(!Array.isArray(i[g])||i[g].length>0)))?`${u.length} of ${a.task_count} task${a.task_count!==1?"s":""}`:`${a.task_count} task${a.task_count!==1?"s":""}`," • ",a.status]})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(G,{variant:"ghost",size:"sm",onClick:g=>{g.stopPropagation(),o()},className:"opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(Rt,{className:"w-4 h-4"})})})]}),c&&u.length>0&&e.jsx("div",{className:"pl-8 pr-4 pb-4 space-y-2",children:u.map(g=>e.jsx(c5,{task:g},g.id))})]})}function c5({task:a}){return e.jsx("div",{className:"flex items-center justify-between p-3 rounded-lg border border-border bg-muted/20",children:e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[e.jsx("div",{className:"p-2 bg-primary-navy/10 rounded-lg flex-shrink-0",children:e.jsx(Dn,{className:"w-4 h-4 text-primary-navy"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h5",{className:"font-medium text-foreground truncate",children:a.title}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground mt-1",children:[e.jsx(ze,{className:cj(a.status),size:"sm",children:a.status}),e.jsxs(ze,{className:dj(a.priority),size:"sm",children:[e.jsx(Nf,{className:"w-3 h-3 mr-1"}),a.priority]}),vf(a)&&e.jsxs(ze,{variant:"destructive",size:"sm",children:[e.jsx(es,{className:"w-3 h-3 mr-1"}),"Overdue"]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground mt-1",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(os,{className:"w-3 h-3"}),l5(a.due_date)]}),a.assignee&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(nt,{className:"w-3 h-3"}),a.assignee.first_name," ",a.assignee.last_name]})]})]})]})})}function d5({onTasksLoaded:a,onAddTask:r,refreshTrigger:i}){const[o,c]=f.useState([]),[m,u]=f.useState(!0),[g,x]=f.useState(null),[p,y]=f.useState(""),[v,w]=f.useState({totalTasks:0,clientCount:0,projectCount:0}),[N,D]=f.useState({statuses:[],priorities:[],assignees:[],dueDateRange:null,showOverdueOnly:!1}),[b,E]=f.useState(!1),[_,M]=f.useState([]);f.useEffect(()=>{let z=!0;const V=setTimeout(()=>{z&&j()},100);return()=>{z=!1,clearTimeout(V)}},[]),f.useEffect(()=>{i>0&&j()},[i]);const[k,C]=f.useState(!1),j=async()=>{if(!k)try{C(!0),u(!0),x(null);const z=await ve.getTasksHierarchy();if(z.success){c(z.data);const V=[],Z=new Set;z.data.forEach(X=>{X.projects.forEach(P=>{P.tasks&&(V.push(...P.tasks),P.tasks.forEach($=>{$.assignee&&Z.add(JSON.stringify({id:$.assignee.id||`${$.assignee.first_name}_${$.assignee.last_name}`,name:`${$.assignee.first_name} ${$.assignee.last_name}`}))}))})}),M(Array.from(Z).map(X=>JSON.parse(X))),a&&a(V);let I=0,ue=0;z.data.forEach(X=>{I+=X.task_count,ue+=X.projects.length}),w({totalTasks:I,clientCount:z.data.length,projectCount:ue})}else x(z.message||"Failed to load tasks")}catch{console.error("Error loading task hierarchy:");const V=[{id:1,name:"TechCorp Solutions",task_count:8,projects:[{id:1,name:"Website Redesign",task_count:5,status:"In Progress",tasks:[{id:1,title:"Design homepage mockup",description:"Create initial design concepts for the new homepage layout",status:"In Progress",priority:"High",due_date:"2024-02-15",assignee:{first_name:"Sarah",last_name:"Johnson"}},{id:2,title:"Setup development environment",description:"Configure local development setup with all dependencies",status:"Done",priority:"Medium",due_date:"2024-02-10",assignee:{first_name:"Mike",last_name:"Chen"}},{id:3,title:"Content strategy planning",description:"Plan content structure and user flow for new site",status:"To Do",priority:"Medium",due_date:"2024-02-20",assignee:{first_name:"Emily",last_name:"Rodriguez"}}]},{id:2,name:"Mobile App Development",task_count:3,status:"Planning",tasks:[{id:4,title:"User research interviews",description:"Conduct interviews with potential users to understand needs",status:"In Progress",priority:"High",due_date:"2024-02-18",assignee:{first_name:"David",last_name:"Kim"}},{id:5,title:"Technical architecture planning",description:"Define technical stack and architecture for mobile app",status:"To Do",priority:"High",due_date:"2024-02-25",assignee:{first_name:"Sarah",last_name:"Johnson"}}]}]}];c(V);const Z=[],I=new Set;
700V.forEach(P=>{P.projects.forEach($=>{$.tasks&&(Z.push(...$.tasks),$.tasks.forEach(F=>{F.assignee&&I.add(JSON.stringify({id:F.assignee.id||`${F.assignee.first_name}_${F.assignee.last_name}`,name:`${F.assignee.first_name} ${F.assignee.last_name}`}))}))})}),M(Array.from(I).map(P=>JSON.parse(P))),a&&a(Z);let ue=0,X=0;V.forEach(P=>{ue+=P.task_count,X+=P.projects.length}),w({totalTasks:ue,clientCount:V.length,projectCount:X}),x(null)}finally{u(!1),C(!1)}},O=f.useMemo(()=>{let z=0,V=0,Z=0;return o.forEach(I=>{let ue=!1,X=0;I.projects?.forEach(P=>{const $=P.tasks?.filter(F=>sh(F,p,N,I.name,P.name))||[];$.length>0&&(z+=$.length,ue=!0,X++)}),ue&&(V++,Z+=X)}),{totalTasks:z,clientCount:V,projectCount:Z}},[o,p,N]),L=p||Object.keys(N).some(z=>N[z]!==null&&N[z]!==!1&&(!Array.isArray(N[z])||N[z].length>0)),R=L?O:v,H=()=>{r&&r()};return m?e.jsx("div",{className:"p-6 space-y-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(xa,{className:"w-6 h-6 animate-spin text-primary-navy"}),e.jsx("span",{className:"text-muted-foreground",children:"Loading tasks..."})]})}):g?e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-4 text-center",children:[e.jsx(es,{className:"w-8 h-8 text-destructive mx-auto mb-2"}),e.jsx("p",{className:"text-destructive font-medium",children:"Error loading tasks"}),e.jsx("p",{className:"text-destructive/80 text-sm mt-1",children:g}),e.jsx(G,{variant:"outline",size:"sm",className:"mt-3",onClick:j,children:"Try Again"})]})}):e.jsxs("div",{className:"p-4 lg:p-6 space-y-6",children:[e.jsxs("div",{className:"flex flex-col xl:flex-row xl:items-end justify-between gap-6",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-foreground",children:"Tasks"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Organize and track all your project tasks"})]}),e.jsxs("div",{className:"flex flex-wrap gap-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-primary-navy/10 rounded-lg",children:e.jsx(Dn,{className:"w-5 h-5 text-primary-navy"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:R.totalTasks}),e.jsx("p",{className:"text-sm text-muted-foreground",children:L&&R.totalTasks!==v.totalTasks?`Tasks (${R.totalTasks} of ${v.totalTasks})`:"Total Tasks"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg",children:e.jsx(ps,{className:"w-5 h-5 text-blue-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:R.clientCount}),e.jsx("p",{className:"text-sm text-muted-foreground",children:L&&R.clientCount!==v.clientCount?`Clients (${R.clientCount} of ${v.clientCount})`:"Clients"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-green-500/10 rounded-lg",children:e.jsx($c,{className:"w-5 h-5 text-green-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:R.projectCount}),e.jsx("p",{className:"text-sm text-muted-foreground",children:L&&R.projectCount!==v.projectCount?`Projects (${R.projectCount} of ${v.projectCount})`:"Projects"})]})]})]})]}),e.jsxs(G,{onClick:H,className:"bg-primary-mint hover:bg-primary-mint/90 text-white xl:w-auto",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"New Task"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4 items-start lg:items-center",children:[e.jsxs("div",{className:"relative flex-1 max-w-md",children:[e.jsx(Un,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4"}),e.jsx(he,{placeholder:"Search tasks, companies, projects, assignees...",value:p,onChange:z=>y(z.target.value),className:"pl-10"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(G,{variant:b?"default":"outline",size:"sm",onClick:()=>E(!b),className:"flex items-center gap-2",children:[e.jsx(Z2,{className:"w-4 h-4"}),"Filters",(N.statuses.length>0||N.priorities.length>0||N.assignees.length>0||N.dueDateRange||N.showOverdueOnly)&&e.jsx(ze,{variant:"secondary",className:"ml-1 h-5 px-1.5 text-xs",children:N.statuses.length+N.priorities.length+N.assignees.length+(N.dueDateRange?1:0)+(N.showOverdueOnly?1:0)})]}),(p||N.statuses.length>0||N.priorities.length>0||N.assignees.length>0||N.dueDateRange||N.showOverdueOnly)&&e.jsxs(G,{variant:"ghost",size:"sm",onClick:()=>{y(""),D({statuses:[],priorities:[],assignees:[],dueDateRange:null,showOverdueOnly:!1})},className:"flex items-center gap-2 text-muted-foreground hover:text-foreground",children:[e.jsx(gs,{className:"w-4 h-4"}),"Clear All"]})]})]}),b&&e.jsx(Ce,{className:"border-border/50 bg-muted/20",children:e.jsx(vt,{className:"p-4",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"Status"}),e.jsx("div",{className:"space-y-2",children:["To Do","In Progress","In Review","Done"].map(z=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ba,{id:`status-${z}`,checked:N.statuses.includes(z),onCheckedChange:V=>{D(V?Z=>({...Z,statuses:[...Z.statuses,z]}):Z=>({...Z,statuses:Z.statuses.filter(I=>I!==z)}))}}),e.jsx("label",{htmlFor:`status-${z}`,className:"text-sm text-foreground cursor-pointer flex items-center gap-2",children:e.jsx(ze,{className:cj(z),size:"sm",children:z})})]},z))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"Priority"}),e.jsx("div",{className:"space-y-2",children:["High","Medium","Low"].map(z=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ba,{id:`priority-${z}`,checked:N.priorities.includes(z),onCheckedChange:V=>{D(V?Z=>({...Z,priorities:[...Z.priorities,z]}):Z=>({...Z,priorities:Z.priorities.filter(I=>I!==z)}))}}),e.jsx("label",{htmlFor:`priority-${z}`,className:"text-sm text-foreground cursor-pointer flex items-center gap-2",children:e.jsxs(ze,{className:dj(z),size:"sm",children:[e.jsx(Nf,{className:"w-3 h-3 mr-1"}),z]})})]},z))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"Assignee"}),e.jsxs("div",{className:"space-y-2 max-h-32 overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ba,{id:"assignee-unassigned",checked:N.assignees.includes("unassigned"),onCheckedChange:z=>{D(z?V=>({...V,assignees:[...V.assignees,"unassigned"]}):V=>({...V,assignees:V.assignees.filter(Z=>Z!=="unassigned")}))}}),e.jsx("label",{htmlFor:"assignee-unassigned",className:"text-sm text-muted-foreground cursor-pointer",children:"Unassigned"})]}),_.map(z=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ba,{id:`assignee-${z.id}`,checked:N.assignees.includes(z.id),onCheckedChange:V=>{D(V?Z=>({...Z,assignees:[...Z.assignees,z.id]}):Z=>({...Z,assignees:Z.assignees.filter(I=>I!==z.id)}))}}),e.jsxs("label",{htmlFor:`assignee-${z.id}`,className:"text-sm text-foreground cursor-pointer flex items-center gap-1",children:[e.jsx(nt,{className:"w-3 h-3"}),z.name]})]},z.id))]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"Due Date"}),e.jsxs(Pn,{value:N.dueDateRange||"all",onValueChange:z=>{D(V=>({...V,dueDateRange:z==="all"?null:z}))},children:[e.jsx(Za,{className:"w-full",children:e.jsx(zn,{placeholder:"Select timeframe"})}),e.jsxs(Qa,{children:[e.jsx(kt,{value:"all",children:"All dates"}),e.jsx(kt,{value:"overdue",children:"Overdue"}),e.jsx(kt,{value:"today",children:"Due today"}),e.jsx(kt,{value:"tomorrow",children:"Due tomorrow"}),e.jsx(kt,{value:"this_week",children:"Due this week"}),e.jsx(kt,{value:"next_week",children:"Due next week"}),e.jsx(kt,{value:"no_due_date",children:"No due date"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[e.jsx(Ba,{id:"overdue-only",checked:N.showOverdueOnly,onCheckedChange:z=>{D(V=>({...V,showOverdueOnly:z}))}}),e.jsxs("label",{htmlFor:"overdue-only",className:"text-sm text-destructive cursor-pointer flex items-center gap-1",children:[e.jsx(es,{className:"w-3 h-3"}),"Show overdue only"]})]})]})]})})})]}),o.length===0?e.jsx(qi,{type:"noTasks",icon:Dn,onAction:H,actionLabel:"Create Your First Task",className:"py-12"}):e.jsx("div",{className:"space-y-4",children:o.map(z=>e.jsx(i5,{client:z,searchTerm:p,filters:N,onAddTask:H},z.id))})]})}function u5({taskId:a,task:r,onBack:i,onEdit:o}){const c=r||o3(a),[m,u]=f.useState("overview"),[g,x]=f.useState("");
700if(!c)return e.jsxs("div",{className:"p-6 text-center",children:[e.jsx("h2",{className:"text-xl font-semibold text-neutral-dark mb-2",children:"Task not found"}),e.jsxs(G,{onClick:i,variant:"outline",children:[e.jsx(ns,{className:"w-4 h-4 mr-2"}),"Back to Tasks"]})]});const p=_=>{switch(_){case"To Do":return"bg-gray-500 text-white";case"In Progress":return"bg-primary-mint text-white";case"In Review":return"bg-yellow-500 text-white";case"Done":return"bg-green-500 text-white";default:return"bg-neutral-dark text-white"}},y=_=>{switch(_){case"High":return"bg-red-500 text-white";case"Medium":return"bg-yellow-500 text-white";case"Low":return"bg-green-500 text-white";default:return"bg-neutral-dark text-white"}},v=_=>new Date(_).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),w=_=>new Date(_).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),N=()=>c.status==="Done"?!1:new Date(c.dueDate)<new Date,D=()=>{if(!c.subtasks||c.subtasks.length===0)return 0;const _=c.subtasks.filter(M=>M.completed).length;return Math.round(_/c.subtasks.length*100)},b=()=>{g.trim()&&x("")},E=_=>{};return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[e.jsxs("div",{className:"flex justify-between items-start mb-6",children:[e.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[e.jsxs(G,{onClick:i,variant:"outline",size:"sm",children:[e.jsx(ns,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h1",{className:"text-3xl font-bold text-neutral-dark",children:c.title}),e.jsxs("div",{className:"flex items-center gap-4 mt-2 text-sm text-neutral-dark/70",children:[e.jsxs("span",{children:["Created ",v(c.createdDate)]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:["Updated ",v(c.updatedDate)]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:["Reporter: ",c.reporter]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ze,{className:p(c.status),children:c.status}),e.jsxs(ze,{className:y(c.priority),children:[e.jsx(Nf,{className:"w-3 h-3 mr-1"}),c.priority]}),N()&&e.jsx(ze,{variant:"destructive",children:"Overdue"}),e.jsxs(G,{onClick:()=>o(c),className:"bg-primary-mint hover:bg-primary-mint/90 text-white",children:[e.jsx(ya,{className:"w-4 h-4 mr-2"}),"Edit Task"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 mb-6",children:[e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-neutral-light p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-neutral-dark/70",children:"Progress"}),e.jsxs("p",{className:"text-2xl font-bold text-neutral-dark",children:[D(),"%"]})]}),e.jsx(Sf,{className:"w-8 h-8 text-primary-mint"})]}),e.jsx("div",{className:"w-full bg-neutral-light rounded-full h-2 mt-2",children:e.jsx("div",{className:"bg-primary-mint h-2 rounded-full transition-all duration-300",style:{width:`${D()}%`}})})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-neutral-light p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-neutral-dark/70",children:"Time Spent"}),e.jsxs("p",{className:"text-2xl font-bold text-neutral-dark",children:[c.timeSpent,"h"]})]}),e.jsx(Timer,{className:"w-8 h-8 text-blue-500"})]}),e.jsxs("p",{className:"text-sm text-neutral-dark/70 mt-1",children:["of ",c.estimatedHours,"h estimated"]})]}),e.jsx("div",{className:"bg-white rounded-lg shadow-sm border border-neutral-light p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-neutral-dark/70",children:"Assignee"}),e.jsx("p",{className:"text-lg font-semibold text-neutral-dark",children:typeof c.assignee=="string"?c.assignee:c.assignee?`${c.assignee.first_name} ${c.assignee.last_name}`:c.assigned_user?`${c.assigned_user.first_name} ${c.assigned_user.last_name}`:c.assignee_name||c.assigned_user_name||"Unassigned"})]}),e.jsx("div",{className:"w-10 h-10 bg-primary-navy rounded-full flex items-center justify-center text-white font-semibold",children:c.assigneeAvatar||(typeof c.assignee=="string"?c.assignee.split(" ").map(_=>_[0]).join("").slice(0,2):c.assignee?`${c.assignee.first_name[0]}${c.assignee.last_name[0]}`:c.assigned_user?`${c.assigned_user.first_name[0]}${c.assigned_user.last_name[0]}`:c.assignee_name?c.assignee_name.split(" ").map(_=>_[0]).join("").slice(0,2):c.assigned_user_name?c.assigned_user_name.split(" ").map(_=>_[0]).join("").slice(0,2):"U")})]})}),e.jsx("div",{className:"bg-white rounded-lg shadow-sm border border-neutral-light p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-neutral-dark/70",children:"Due Date"}),e.jsx("p",{className:`text-lg font-semibold ${N()?"text-red-600":"text-neutral-dark"}`,children:v(c.dueDate)})]}),e.jsx(os,{className:`w-8 h-8 ${N()?"text-red-500":"text-gray-500"}`})]})})]}),e.jsxs(Vi,{value:m,onValueChange:u,children:[e.jsxs(wl,{className:"grid w-full grid-cols-4",children:[e.jsx(Et,{value:"overview",children:"Overview"}),e.jsx(Et,{value:"subtasks",children:"Subtasks"}),e.jsx(Et,{value:"comments",children:"Comments"}),e.jsx(Et,{value:"attachments",children:"Attachments"})]}),e.jsx(Mt,{value:"overview",className:"space-y-6",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-neutral-light p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-neutral-dark mb-4",children:"Task Details"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(oe,{className:"text-sm font-medium text-neutral-dark/70",children:"Description"}),e.jsx("p",{className:"text-sm text-neutral-dark mt-1",children:c.description})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(oe,{className:"text-sm font-medium text-neutral-dark/70",children:"Category"}),e.jsx("p",{className:"text-sm text-neutral-dark mt-1",children:c.category})]}),e.jsxs("div",{children:[e.jsx(oe,{className:"text-sm font-medium text-neutral-dark/70",children:"Estimated Hours"}),e.jsxs("p",{className:"text-sm text-neutral-dark mt-1",children:[c.estimatedHours,"h"]})]})]}),c.tags&&c.tags.length>0&&e.jsxs("div",{children:[e.jsx(oe,{className:"text-sm font-medium text-neutral-dark/70",children:"Tags"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:c.tags.map((_,M)=>e.jsx(ze,{variant:"secondary",children:_},M))})]})]})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-neutral-light p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-neutral-dark mb-4",children:"Project & Client"}),e.jsxs("div",{className:"space-y-4",children:[c.projectName?e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-neutral-light/30 rounded-lg",children:[e.jsx(Va,{className:"w-8 h-8 text-primary-navy"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-neutral-dark",children:c.projectName}),e.jsx("p",{className:"text-sm text-neutral-dark/70",children:"Project"})]})]}):e.jsxs("div",{className:"text-center py-4 text-neutral-dark/50",children:[e.jsx(Va,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"No project assigned"})]}),c.clientName?e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-neutral-light/30 rounded-lg",children:[e.jsx(ps,{className:"w-8 h-8 text-primary-mint"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-neutral-dark",children:c.clientName}),e.jsx("p",{className:"text-sm text-neutral-dark/70",children:"Client"})]})]}):e.jsxs("div",{className:"text-center py-4 text-neutral-dark/50",children:[e.jsx(ps,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"No client assigned"})]})]})]})]})}),e.jsxs(Mt,{value:"subtasks",className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-neutral-dark",children:"Subtasks"}),e.jsxs(G,{className:"bg-primary-mint hover:bg-primary-mint/90 text-white",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"Add Subtask"]})]}),e.jsx("div",{className:"bg-white rounded-lg shadow-sm border border-neutral-light",children:e.jsx("div",{className:"p-6",children:c.subtasks&&c.subtasks.length>0?e.jsx("div",{className:"space-y-3",children:c.subtasks.map(_=>e.jsxs("div",{className:"flex items-center gap-3 p-3 border border-neutral-light rounded-lg",children:[e.jsx("button",{onClick:()=>E(_.id),className:`w-5 h-5 rounded border-2 flex items-center justify-center ${_.completed?"bg-green-500 border-green-500 text-white":"border-neutral-light hover:border-primary-mint"}`,children:_.completed&&e.jsx(Ws,{className:"w-3 h-3"})}),e.jsx("span",{className:`flex-1 ${_.completed?"line-through text-neutral-dark/50":"text-neutral-dark"}`,children:_.title}),e.jsx("button",{className:"p-1 hover:bg-neutral-light rounded",children:e.jsx(va,{className:"w-4 h-4 text-neutral-dark/50"})})]},_.id))}):e.jsxs("div",{className:"text-center py-8 text-neutral-dark/50",children:[e.jsx(Ws,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("h4",{className:"text-lg font-medium text-neutral-dark mb-2",children:"No subtasks"}),e.jsx("p",{className:"text-neutral-dark/70 mb-4",children:"Break down this task into smaller, manageable pieces."}),e.jsxs(G,{className:"bg-primary-mint hover:bg-primary-mint/90 text-white",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"Add First Subtask"]})]})})})]}),e.jsx(Mt,{value:"comments",className:"space-y-4",children:e.jsx("div",{className:"bg-white rounded-lg shadow-sm border border-neutral-light",children:e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx(oe,{htmlFor:"newComment",className:"text-sm font-medium text-neutral-dark",children:"Add a comment"}),e.jsxs("div",{className:"mt-2 space-y-3",children:[e.jsx(Ut,{id:"newComment",value:g,onChange:_=>x(_.target.value),placeholder:"Write your comment here...",rows:3}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(G,{onClick:b,disabled:!g.trim(),className:"bg-primary-mint hover:bg-primary-mint/90 text-white",children:[e.jsx(Ja,{className:"w-4 h-4 mr-2"}),"Add Comment"]})})]})]}),c.comments&&c.comments.length>0?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h4",{className:"font-medium text-neutral-dark",children:["Comments (",c.comments.length,")"]}),c.comments.map(_=>e.jsxs("div",{className:"flex gap-3 p-4 bg-neutral-light/30 rounded-lg",children:[e.jsx("div",{className:"w-8 h-8 bg-primary-navy rounded-full flex items-center justify-center text-white text-sm font-medium",children:_.avatar}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-medium text-neutral-dark",children:_.author}),e.jsx("span",{className:"text-xs text-neutral-dark/60",children:w(_.createdAt)})]}),e.jsx("p",{className:"text-sm text-neutral-dark",children:_.content})]})]},_.id))]}):e.jsxs("div",{className:"text-center py-8 text-neutral-dark/50",children:[e.jsx(Fa,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("h4",{className:"text-lg font-medium text-neutral-dark mb-2",children:"No comments yet"}),e.jsx("p",{className:"text-neutral-dark/70",children:"Start the conversation by adding the first comment."})]})]})})}),e.jsxs(Mt,{value:"attachments",className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-neutral-dark",children:"Attachments"}),e.jsxs(G,{className:"bg-primary-mint hover:bg-primary-mint/90 text-white",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"Upload File"]})]}),e.jsx("div",{className:"bg-white rounded-lg shadow-sm border border-neutral-light",children:e.jsx("div",{className:"p-6",children:c.attachments&&c.attachments.length>0?e.jsx("div",{className:"space-y-3",children:c.attachments.map(_=>e.jsxs("div",{className:"flex items-center justify-between p-3 border border-neutral-light rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(kc,{className:"w-6 h-6 text-blue-500"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-neutral-dark",children:_.name}),e.jsxs("p",{className:"text-sm text-neutral-dark/70",children:[_.size," • ",_.type]})]})]}),e.jsx(G,{variant:"outline",size:"sm",children:e.jsx(An,{className:"w-4 h-4"})})]},_.id))}):e.jsxs("div",{className:"text-center py-8 text-neutral-dark/50",children:[e.jsx(kc,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("h4",{className:"text-lg font-medium text-neutral-dark mb-2",children:"No attachments"}),e.jsx("p",{className:"text-neutral-dark/70 mb-4",children:"Upload files to share with your team."}),e.jsxs(G,{className:"bg-primary-mint hover:bg-primary-mint/90 text-white",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"Upload First File"]})]})})})]})]})]})}const m5=[{value:"contract",label:"Contract"},{value:"invoice",label:"Invoice"},{value:"report",label:"Report"},{value:"image",label:"Image"},{value:"other",label:"Other"}],Fm=50*1024*1024,Bm=a=>{if(a===0)return"0 Bytes";const r=1024,i=["Bytes","KB","MB","GB"],o=Math.floor(Math.log(a)/Math.log(r));return parseFloat((a/Math.pow(r,o)).toFixed(2))+" "+i[o]};function f5({open:a,onOpenChange:r,targetType:i="general",targetId:o=null,targetName:c="",onUploadSuccess:m}){const[u,g]=f.useState(null),[x,p]=f.useState(!1),[y,v]=f.useState(null),[w,N]=f.useState(!1),[D,b]=f.useState(!1),[E,_]=f.useState([]),[M,k]=f.useState(!1),[C,j]=f.useState({name:"",description:"",type:"other",project_id:i==="project"?o:""}
700),O=f.useRef(null);f.useEffect(()=>{a&&i!=="project"&&L()},[a,i]);const L=async()=>{try{k(!0);const X=await ve.getProjects();if(X?.data){const P=X.data.data||X.data;_(Array.isArray(P)?P:[])}}catch{console.error("Failed to load projects:"),_([])}finally{k(!1)}},R=X=>{if(X){if(X.size>Fm){v(`File size must be less than ${Bm(Fm)}`);return}if(g(X),v(null),!C.name){const P=X.name.replace(/\.[^/.]+$/,"");j($=>({...$,name:P}))}}},H=X=>{X.preventDefault(),b(!1);const P=X.dataTransfer.files[0];P&&R(P)},z=X=>{X.preventDefault(),b(!0)},V=X=>{X.preventDefault(),b(!1)},Z=(X,P)=>{j($=>({...$,[X]:P}))},I=async X=>{if(X.preventDefault(),!u){v("Please select a file to upload");return}if(!C.name.trim()){v("Please enter a document name");return}if(i==="project"&&!C.project_id){v("Project ID is required");return}try{p(!0),v(null);const P=new FormData;P.append("file",u),P.append("name",C.name.trim()),P.append("type",C.type),C.description.trim()&&P.append("description",C.description.trim()),C.project_id&&P.append("project_id",C.project_id);const $=await ve.uploadDocument(P);$.success?(N(!0),m&&m($.data),setTimeout(()=>{ue()},1500)):v($.message||"Upload failed")}catch(P){v(P.message||"Upload failed")}finally{p(!1)}},ue=()=>{x||(g(null),j({name:"",description:"",type:"other",project_id:i==="project"?o:""}),v(null),N(!1),b(!1),_([]),k(!1),r(!1))};return a?w?e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-xl max-w-md w-full p-6 text-center",children:[e.jsx(Ha,{className:"w-12 h-12 text-green-500 mx-auto mb-4"}),e.jsx("h2",{className:"text-xl font-semibold text-foreground mb-2",children:"Upload Successful!"}),e.jsx("p",{className:"text-muted-foreground",children:"Your document has been uploaded successfully."})]})}):e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-primary-mint/10 rounded-lg",children:e.jsx(pa,{className:"w-5 h-5 text-primary-mint"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-card-foreground",children:"Upload Document"}),c&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:["to ",i,": ",c]})]})]}),e.jsx(G,{variant:"ghost",size:"sm",onClick:ue,disabled:x,className:"text-muted-foreground hover:text-foreground",children:e.jsx(gs,{className:"w-5 h-5"})})]}),e.jsxs("form",{onSubmit:I,className:"p-6 space-y-6",children:[e.jsxs("div",{className:`
701              border-2 border-dashed rounded-lg p-8 text-center transition-colors
702              ${D?"border-primary-mint bg-primary-mint/5":"border-border"}
703              ${u?"border-green-500 bg-green-50":""}
704            `,onDrop:H,onDragOver:z,onDragLeave:V,children:[u?e.jsxs("div",{className:"space-y-3",children:[e.jsx(yc,{className:"w-12 h-12 text-green-500 mx-auto"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:u.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:Bm(u.size)})]}),e.jsx(G,{type:"button",variant:"outline",size:"sm",onClick:()=>g(null),disabled:x,children:"Remove File"})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsx(pa,{className:"w-12 h-12 text-muted-foreground mx-auto"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-lg font-medium text-foreground mb-2",children:"Drop your file here or click to browse"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Maximum file size: ",Bm(Fm)]})]}),e.jsx(G,{type:"button",variant:"outline",onClick:()=>O.current?.click(),disabled:x,children:"Choose File"})]}),e.jsx("input",{ref:O,type:"file",className:"hidden",onChange:X=>R(X.target.files[0]),disabled:x})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground mb-1",children:"Document Name *"}),e.jsx(he,{id:"name",value:C.name,onChange:X=>Z("name",X.target.value),placeholder:"Enter document name",disabled:x,required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"type",className:"block text-sm font-medium text-foreground mb-1",children:"Document Type *"}
704),e.jsx("select",{id:"type",value:C.type,onChange:X=>Z("type",X.target.value),className:"w-full px-3 py-2 border border-input bg-background rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-ring",disabled:x,required:!0,children:m5.map(X=>e.jsx("option",{value:X.value,children:X.label},X.value))})]}),i!=="project"&&e.jsxs("div",{children:[e.jsx("label",{htmlFor:"project_id",className:"block text-sm font-medium text-foreground mb-1",children:"Project (Optional)"}),e.jsxs("select",{id:"project_id",value:C.project_id,onChange:X=>Z("project_id",X.target.value),className:"w-full px-3 py-2 border border-input bg-background rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-ring",disabled:x||M,children:[e.jsx("option",{value:"",children:M?"Loading projects...":"No project"}),E.map(X=>e.jsx("option",{value:X.id,children:X.name},X.id))]})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-foreground mb-1",children:"Description (Optional)"}),e.jsx(Ut,{id:"description",value:C.description,onChange:X=>Z("description",X.target.value),placeholder:"Enter document description",rows:3,disabled:x})]})]}),y&&e.jsxs("div",{className:"p-3 bg-destructive/10 border border-destructive/20 rounded-lg flex items-start gap-3",children:[e.jsx(es,{className:"w-5 h-5 text-destructive flex-shrink-0 mt-0.5"}),e.jsx("p",{className:"text-sm text-destructive",children:y})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t border-border",children:[e.jsx(G,{type:"button",variant:"outline",onClick:ue,disabled:x,children:"Cancel"}),e.jsx(G,{type:"submit",disabled:x||!u,className:"bg-primary-mint hover:bg-primary-mint/90",children:x?e.jsxs(e.Fragment,{children:[e.jsx(xa,{className:"w-4 h-4 mr-2 animate-spin"}),"Uploading..."]}):e.jsxs(e.Fragment,{children:[e.jsx(pa,{className:"w-4 h-4 mr-2"}),"Upload Document"]})})]})]})]})}):null}function h5({document:a,onEdit:r,onDelete:i}){const[o,c]=f.useState(!1),[m,u]=f.useState(!1),g=f.useRef(null);f.useEffect(()=>{function v(w){g.current&&!g.current.contains(w.target)&&c(!1)}return o&&window.document.addEventListener("mousedown",v),()=>{window.document.removeEventListener("mousedown",v)}},[o]);const x=async()=>{try{u(!0),c(!1);const v=await ve.getDocumentDownloadUrl(a.id);if(v.success){const w=window.document.createElement("a");w.href=v.download_url,w.download=v.filename||a.original_name||a.name,w.target="_blank",window.document.body.appendChild(w),w.click(),window.document.body.removeChild(w)}else console.error("Download failed:")}catch{console.error("Download error:")}finally{u(!1)}},p=async()=>{try{c(!1);const v=await ve.getDocumentDownloadUrl(a.id);v.success?window.open(v.download_url,"_blank"):console.error("Preview failed:")}catch{console.error("Preview error:")}},y=(v,w)=>{c(!1),w&&w(a)};return e.jsxs("div",{className:"relative",ref:g,children:[e.jsx("button",{onClick:v=>{v.stopPropagation(),c(!o)},className:"p-1 hover:bg-muted rounded transition-colors opacity-0 group-hover:opacity-100",disabled:m,children:e.jsx(va,{className:"w-4 h-4 text-muted-foreground"})}),o&&e.jsx("div",{className:"absolute right-0 top-full mt-1 w-48 bg-popover border border-border rounded-md shadow-lg z-20",children:e.jsxs("div",{className:"py-1",children:[e.jsxs("button",{onClick:p,className:"flex items-center gap-3 w-full px-3 py-2 text-sm text-popover-foreground hover:bg-muted transition-colors",children:[e.jsx(rs,{className:"w-4 h-4"}),"Preview"]}),e.jsxs("button",{onClick:x,disabled:m,className:"flex items-center gap-3 w-full px-3 py-2 text-sm text-popover-foreground hover:bg-muted transition-colors disabled:opacity-50",children:[e.jsx(An,{className:"w-4 h-4"}),m?"Downloading...":"Download"]}),e.jsxs("button",{onClick:()=>y(),className:"flex items-center gap-3 w-full px-3 py-2 text-sm text-popover-foreground hover:bg-muted transition-colors",children:[e.jsx(t4,{className:"w-4 h-4"}),"Share"]}),e.jsx("div",{className:"border-t border-border my-1"}),e.jsxs("button",{onClick:()=>y("edit",r),className:"flex items-center gap-3 w-full px-3 py-2 text-sm text-popover-foreground hover:bg-muted transition-colors",children:[e.jsx(d0,{className:"w-4 h-4"}),"Edit Details"]}
704),e.jsxs("button",{onClick:()=>y("delete",i),className:"flex items-center gap-3 w-full px-3 py-2 text-sm text-destructive hover:bg-destructive/10 transition-colors",children:[e.jsx($n,{className:"w-4 h-4"}),"Delete"]})]})})]})}const x5=a=>a?a.startsWith("image/")?$2:a.startsWith("video/")?H2:a.startsWith("audio/")?L2:a.includes("pdf")?Ot:a.includes("spreadsheet")||a.includes("excel")?F2:a.includes("zip")||a.includes("rar")?Cc:Ot:Ot,uj=a=>{if(!a||a===0)return"Unknown size";const r=["B","KB","MB","GB"];let i=0;for(;a>1024&&i<r.length-1;)a/=1024,i++;return Math.round(a*100)/100+" "+r[i]},p5=a=>new Date(a).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"});function g5({client:a,searchTerm:r,onDocumentClick:i,onUpload:o,onEditDocument:c,onDeleteDocument:m}){const[u,g]=f.useState(!1);if(!f.useMemo(()=>{if(!r)return a.document_count>0;const y=r.toLowerCase(),v=a.direct_documents?.some(N=>N.name.toLowerCase().includes(y)||N.original_name.toLowerCase().includes(y)),w=a.projects?.some(N=>N.documents?.some(D=>D.name.toLowerCase().includes(y)||D.original_name.toLowerCase().includes(y)));return v||w},[a,r]))return null;const p=a.direct_documents?.filter(y=>!r||y.name.toLowerCase().includes(r.toLowerCase())||y.original_name.toLowerCase().includes(r.toLowerCase()))||[];return e.jsxs("div",{className:"border border-border rounded-lg",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>g(!u),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[u?e.jsx(Ln,{className:"w-4 h-4 text-muted-foreground"}):e.jsx(jr,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg",children:e.jsx(ps,{className:"w-5 h-5 text-blue-500"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-foreground",children:a.name}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[a.document_count," document",a.document_count!==1?"s":""]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(G,{variant:"ghost",size:"sm",onClick:y=>{y.stopPropagation(),o("client",a.id,a.name)},className:"opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(pa,{className:"w-4 h-4"})}),e.jsx(G,{variant:"ghost",size:"sm",onClick:y=>y.stopPropagation(),className:"opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(va,{className:"w-4 h-4"})})]})]}),u&&e.jsxs("div",{className:"border-t border-border",children:[p.length>0&&e.jsxs("div",{className:"p-4 space-y-2",children:[e.jsx("h4",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Client Documents"}),p.map(y=>e.jsx(mj,{document:y,onDocumentClick:i,onEditDocument:c,onDeleteDocument:m},y.id))]}),a.projects?.map(y=>e.jsx(v5,{project:y,searchTerm:r,onDocumentClick:i,onUpload:o,onEditDocument:c,onDeleteDocument:m},y.id))]})]})}function v5({project:a,searchTerm:r,onDocumentClick:i,onUpload:o,onEditDocument:c,onDeleteDocument:m}){const[u,g]=f.useState(!1),x=a.documents?.filter(p=>!r||p.name.toLowerCase().includes(r.toLowerCase())||p.original_name.toLowerCase().includes(r.toLowerCase()))||[];return r&&x.length===0?null:e.jsxs("div",{className:"border-t border-border group",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 pl-8 cursor-pointer hover:bg-muted/30 transition-colors",onClick:()=>g(!u),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[u?e.jsx(Ln,{className:"w-4 h-4 text-muted-foreground"}):e.jsx(jr,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("div",{className:"p-2 bg-green-500/10 rounded-lg",children:e.jsx($c,{className:"w-4 h-4 text-green-500"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-foreground",children:a.name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[a.document_count," document",a.document_count!==1?"s":""," • ",a.status]})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(G,{variant:"ghost",size:"sm",onClick:p=>{p.stopPropagation(),o("project",a.id,a.name)},className:"opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(pa,{className:"w-4 h-4"})})})]}),u&&x.length>0&&e.jsx("div",{className:"pl-8 pr-4 pb-4 space-y-2",children:x.map(p=>e.jsx(mj,{document:p,onDocumentClick:i,onEditDocument:c,onDeleteDocument:m},p.id))})]})}function mj({document:a,onDocumentClick:r,onEditDocument:i,onDeleteDocument:o}){const c=x5(a.mime_type);return e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border border-border hover:border-border/80 hover:bg-muted/30 transition-colors cursor-pointer group",onClick:()=>r(a),children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[e.jsx("div",{className:"p-2 bg-primary-mint/10 rounded-lg flex-shrink-0",children:e.jsx(c,{className:"w-4 h-4 text-primary-mint"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h5",{className:"font-medium text-foreground truncate",children:a.name}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground mt-1",children:[e.jsx("span",{children:uj(a.file_size)}),e.jsx("span",{children:p5(a.created_at)}),a.uploader&&e.jsxs("span",{children:["by ",a.uploader.first_name," ",a.uploader.last_name]})]})]})]}),e.jsx(h5,{document:a,onEdit:i,onDelete:o})]})}function y5({onDocumentClick:a,onDocumentsLoaded:r}){const[i,o]=f.useState([]),[c,m]=f.useState(!0),[u,g]=f.useState(null),[x,p]=f.useState(""),[y,v]=f.useState(!1),[w,N]=f.useState({type:"general",id:null,name:""}),[D,b]=f.useState({totalDocuments:0,totalSize:0,clientCount:0,projectCount:0});f.useEffect(()=>{E()},[]);const E=async()=>{try{m(!0),g(null);const L=await ve.request("/documents/hierarchy");if(L.success){o(L.data);const R=[];L.data.forEach(Z=>{Z.direct_documents&&R.push(...Z.direct_documents),Z.projects.forEac
704h(I=>{I.documents&&R.push(...I.documents)})}),r&&r(R);let H=0,z=0,V=0;L.data.forEach(Z=>{H+=Z.document_count,V+=Z.projects.length,Z.direct_documents?.forEach(I=>{z+=I.file_size||0}),Z.projects.forEach(I=>{I.documents?.forEach(ue=>{z+=ue.file_size||0})})}),b({totalDocuments:H,totalSize:z,clientCount:L.data.length,projectCount:V})}else g(L.message||"Failed to load documents")}catch{g("Failed to load documents")}finally{m(!1)}},_=L=>{a?a(L):alert(`Document detail view not yet connected. Document: ${L.name}
705
706To see versions:
7071. Connect this to DocumentDetail component
7082. The versions tab will show version history
7093. You can upload new versions from there`)},M=(L,R,H="")=>{N({type:L,id:R,name:H}),v(!0)},k=L=>{E()},C=()=>{v(!1),N({type:"general",id:null,name:""})},j=L=>{},O=async L=>{if(confirm(`Are you sure you want to delete "${L.name}"?`))try{(await ve.deleteDocument(L.id)).success&&E()}catch{console.error("Delete error:")}};return c?e.jsx("div",{className:"p-6 space-y-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(xa,{className:"w-6 h-6 animate-spin text-primary-navy"}),e.jsx("span",{className:"text-muted-foreground",children:"Loading documents..."})]})}):u?e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-4 text-center",children:[e.jsx(es,{className:"w-8 h-8 text-destructive mx-auto mb-2"}),e.jsx("p",{className:"text-destructive font-medium",children:"Error loading documents"}),e.jsx("p",{className:"text-destructive/80 text-sm mt-1",children:u}),e.jsx(G,{variant:"outline",size:"sm",className:"mt-3",onClick:E,children:"Try Again"})]})}):e.jsxs("div",{className:"p-4 lg:p-6 space-y-6",children:[e.jsxs("div",{className:"flex flex-col xl:flex-row xl:items-end justify-between gap-6",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-foreground",children:"Documents"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Organize and access all your project files"})]}),e.jsxs("div",{className:"flex flex-wrap gap-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-primary-navy/10 rounded-lg",children:e.jsx(Ot,{className:"w-5 h-5 text-primary-navy"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:D.totalDocuments}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Documents"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg",children:e.jsx(ps,{className:"w-5 h-5 text-blue-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:D.clientCount}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Clients"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-green-500/10 rounded-lg",children:e.jsx($c,{className:"w-5 h-5 text-green-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:D.projectCount}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Projects"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-primary-mint/10 rounded-lg",children:e.jsx(W2,{className:"w-5 h-5 text-primary-mint"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:uj(D.totalSize)}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Storage Used"})]})]})]})]}),e.jsxs(G,{onClick:()=>M("general",null),className:"bg-primary-mint hover:bg-primary-mint/90 text-white xl:w-auto",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"Upload Document"]})]}),e.jsx("div",{className:"flex flex-col lg:flex-row gap-4 items-start lg:items-center",children:e.jsxs("div",{className:"relative flex-1 max-w-md",children:[e.jsx(Un,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4"}),e.jsx(he,{placeholder:"Search documents...",value:x,onChange:L=>p(L.target.value),className:"pl-10"})]})}),i.length===0?e.jsx(qi,{type:"noDocuments",icon:Ot,onAction:()=>M("general",null),actionLabel:"Upload Your First Document",className:"py-12"}):e.jsx("div",{className:"space-y-4",children:i.map(L=>e.jsx(g5,{client:L,searchTerm:x,onDocumentClick:_,onUpload:M,onEditDocument:j,onDeleteDocument:O},L.id))}),e.jsx(f5,{open:y,onOpenChange:C,targetType:w.type,targetId:w.id,targetName:w.name,onUploadSuccess:k})]})}var yf=["Enter"," "],b5=["ArrowDown","PageUp","Home"],fj=["ArrowUp","PageDown","End"],j5=[...b5,...fj],N5={ltr:[...yf,"ArrowRight"],rtl:[...yf,"ArrowLeft"]},w5={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Yi="Menu",[Ii,S5,C5]=$f(Yi),[wr,hj]=Bs(Yi,[C5,nd,Jc]),od=nd(),xj=Jc(),[k5,Sr]=wr(Yi),[_5,Xi]=wr(Yi),pj=a=>{const{__scopeMenu:r,open:i=!1,children:o,dir:c,onOpenChange:m,modal:u=!0}=a,g=od(r),[x,p]=f.useState(null),y=f.useRef(!1),v=ea(m),w=Qc(c);return f.useEffect(()=>{const N=()=>{y.current=!0,document.addEventListener("pointerdown",D,{capture:!0,once:!0}),document.addEventListener("pointermove",D,{capture:!0,once:!0})},D=()=>y.current=!1;return document.addEventListener("keydown",N,{capture:!0}),()=>{document.removeEventListener("keydown",N,{capture:!0}),document.removeEventListener("pointerdown",D,{capture:!0}),document.removeEventListener("pointermove",D,{capture:!0})}},[]),e.jsx(jb,{...g,children:e.jsx(k5,{scope:r,open:i,onOpenChange:v,content:x,onContentChange:p,children:e.jsx(_5,{scope:r,onClose:f.useCallback(()=>v(!1),[v]),isUsingKeyboardRef:y,dir:w,modal:u,children:o})})})};pj.displayName=Yi;var D5="MenuAnchor",ah=f.forwardRef((a,r)=>{const{__scopeMenu:i,...o}=a,c=od(i);return e.jsx(Nb,{...c,...o,ref:r})});ah.displayName=D5;var nh="MenuPortal",[E5,gj]=wr(nh,{forceMount:void 0}),vj=a=>{const{__scopeMenu:r,forceMount:i,children:o,container:c}=a,m=Sr(nh,r);return e.jsx(E5,{scope:r,forceMount:i,children:e.jsx(aa,{present:i||m.open,children:e.jsx(Yc,{asChild:!0,container:c,children:o})})})};vj.displayName=nh;var Fs="MenuContent",[M5,rh]=wr(Fs),yj=f.forwardRef((a,r)=>{const i=gj(Fs,a.__scopeMenu),{forceMount:o=i.forceMount,...c}=a,m=Sr(Fs,a.__scopeMenu),u=Xi(Fs,a.__scopeMenu);return e.jsx(Ii.Provider,{scope:a.__scopeMenu,children:e.jsx(aa,{present:o||m.open,children:e.jsx(Ii.Slot,{scope:a.__scopeMenu,children:u.modal?e.jsx(T5,{...c,ref:r}):e.jsx(A5,{...c,ref:r})})})})}),T5=f.forwardRef((a,r)=>{const i=Sr(Fs,a.__scopeMenu),o=f.useRef(null),c=it(r,o);return f.useEffect(()=>{const m=o.current;if(m)return Of(m)},[]),e.jsx(lh,{...a,ref:c,trapFocus:i.open,disableOutsidePointerEvents:i.open,disableOutsideScroll:!0,onFocusOutside:Te(a.onFocusOutside,m=>m.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>i.onOpenChange(!1)})}),A5=f.forwardRef((a,r)=>{const i=Sr(Fs,a.__scopeMenu);return e.jsx(lh,{...a,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>i.onOpenChange(!1)})}),R5=hr("MenuContent.ScrollLock"),lh=f.forwardRef((a,r)=>{const{__scopeMenu:i,loop:o=!1,trapFocus:c,onOpenAutoFocus:m,onCloseAutoFocus:u,disableOutsidePointerEvents:g,onEntryFocus:x,onEscapeKeyDown:p,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:w,onDismiss:N,disableOutsideScroll:D,...b}=a,E=Sr(Fs,i),_=Xi(Fs,i),M=od(i),k=xj(i),C=S5(i),[j,O]=f.useState(null),L=f.useRef(null),R=it(r,L,E.onContentChange),H=f.useRef(0),z=f.useRef(""),V=f.useRef(0),Z=f.useRef(null),I=f.useRef("right"),ue=f.useRef(0),X=D?Kc:f.Fragment,P=D?{as:R5,allowPinchZoom:!0}:void 0,$=ne=>{const T=z.current+ne,B=C().filter(re=>!re.disabled),ee=document.activeElement,te=B.find(re=>re.ref.current===ee)?.textValue,ye=B.map(re=>re.textValue),ge=V5(ye,T,te),K=B.find(re=>re.textValue===ge)?.ref.current;(function re(je){z.current=je,window.clearTimeout(H.current),je!==""&&(H.current=window.setTimeout(()=>re(""),1e3))})(T),K&&setTimeout(()=>K.focus())};f.useEffect(()=>()=>window.clearTimeout(H.current),[]),Rf();const F=f.useCallback(ne=>I.current===Z.current?.side&&Y5(ne,Z.current?.area),[]);return e.jsx(M5,{scope:i,searchRef:z,onItemEnter:f.useCallback(ne=>{F(ne)&&ne.preventDefault()},[F]),onItemLeave:f.useCallback(ne=>{F(ne)||(L.current?.focus(),O(null))},[F]),onTriggerLeave:f.useCallback(ne=>{F(ne)&&ne.preventDefault()},[F]),pointerGraceTimerRef:V,onPointerGraceIntentChange:f.useCallback(ne=>{Z.current=ne},[]),children:e.jsx(X,{...P,children:e.jsx(Gc,{asChild:!0,trapped:c,onMountAutoFocus:Te(m,ne=>{ne.preventDefault(),L.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:e.jsx(Vc,{asChild:!0,disableOutsidePointerEvents:g,onEscapeKeyDown:p,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:w,onDismiss:N,children:e.jsx(My,{asChild:!0,...k,dir:_.dir,orientation:"vertical",loop:o,currentTabStopId:j,onCurrentTabStopIdChange:O,onEntryFocus:Te(x,ne=>{_.isUsingKeyboardRef.current||ne.preventDefault()}),preventScrollOnEntryFocus:!0,children:e.jsx(wb,{role:"menu","aria-orientation":"vertical","data-state":Pj(E.open),"data-radix-menu-content":"",dir:_.dir,...M,...b,ref:R,style:{outline:"none",...b.style},onKeyDown:Te(b.onKeyDown,ne=>{const B=ne.target.closest("[data-radix-menu-content]")===ne.currentTarget,ee=ne.ctrlKey||ne.altKey||ne.metaKey,te=ne.key.length===1;B&&(ne.key==="Tab"&&ne.preventDefault(),!ee&&te&&$(ne.key));const ye=L.current;
vendor: 12,793 bytes, line 709
709if(ne.target!==ye||!j5.includes(ne.key))return;ne.preventDefault();const K=C().filter(re=>!re.disabled).map(re=>re.ref.current);fj.includes(ne.key)&&K.reverse(),q5(K)}),onBlur:Te(a.onBlur,ne=>{ne.currentTarget.contains(ne.target)||(window.clearTimeout(H.current),z.current="")}),onPointerMove:Te(a.onPointerMove,Fi(ne=>{const T=ne.target,B=ue.current!==ne.clientX;if(ne.currentTarget.contains(T)&&B){const ee=ne.clientX>ue.current?"right":"left";I.current=ee,ue.current=ne.clientX}}))})})})})})})});yj.displayName=Fs;var O5="MenuGroup",ih=f.forwardRef((a,r)=>{const{__scopeMenu:i,...o}=a;return e.jsx(Be.div,{role:"group",...o,ref:r})});ih.displayName=O5;var P5="MenuLabel",bj=f.forwardRef((a,r)=>{const{__scopeMenu:i,...o}=a;return e.jsx(Be.div,{...o,ref:r})});bj.displayName=P5;var Pc="MenuItem",Xv="menu.itemSelect",cd=f.forwardRef((a,r)=>{const{disabled:i=!1,onSelect:o,...c}=a,m=f.useRef(null),u=Xi(Pc,a.__scopeMenu),g=rh(Pc,a.__scopeMenu),x=it(r,m),p=f.useRef(!1),y=()=>{const v=m.current;if(!i&&v){const w=new CustomEvent(Xv,{bubbles:!0,cancelable:!0});v.addEventListener(Xv,N=>o?.(N),{once:!0}),S0(v,w),w.defaultPrevented?p.current=!1:u.onClose()}};return e.jsx(jj,{...c,ref:x,disabled:i,onClick:Te(a.onClick,y),onPointerDown:v=>{a.onPointerDown?.(v),p.current=!0},onPointerUp:Te(a.onPointerUp,v=>{p.current||v.currentTarget?.click()}),onKeyDown:Te(a.onKeyDown,v=>{const w=g.searchRef.current!=="";i||w&&v.key===" "||yf.includes(v.key)&&(v.currentTarget.click(),v.preventDefault())})})});cd.displayName=Pc;var jj=f.forwardRef((a,r)=>{const{__scopeMenu:i,disabled:o=!1,textValue:c,...m}=a,u=rh(Pc,i),g=xj(i),x=f.useRef(null),p=it(r,x),[y,v]=f.useState(!1),[w,N]=f.useState("");return f.useEffect(()=>{const D=x.current;D&&N((D.textContent??"").trim())},[m.children]),e.jsx(Ii.ItemSlot,{scope:i,disabled:o,textValue:c??w,children:e.jsx(Ty,{asChild:!0,...g,focusable:!o,children:e.jsx(Be.div,{role:"menuitem","data-highlighted":y?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...m,ref:p,onPointerMove:Te(a.onPointerMove,Fi(D=>{o?u.onItemLeave(D):(u.onItemEnter(D),D.defaultPrevented||D.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Te(a.onPointerLeave,Fi(D=>u.onItemLeave(D))),onFocus:Te(a.onFocus,()=>v(!0)),onBlur:Te(a.onBlur,()=>v(!1))})})})}),z5="MenuCheckboxItem",Nj=f.forwardRef((a,r)=>{const{checked:i=!1,onCheckedChange:o,...c}=a;return e.jsx(_j,{scope:a.__scopeMenu,checked:i,children:e.jsx(cd,{role:"menuitemcheckbox","aria-checked":zc(i)?"mixed":i,...c,ref:r,"data-state":ch(i),onSelect:Te(c.onSelect,()=>o?.(zc(i)?!0:!i),{checkForDefaultPrevented:!1})})})});Nj.displayName=z5;var wj="MenuRadioGroup",[L5,U5]=wr(wj,{value:void 0,onValueChange:()=>{}}),Sj=f.forwardRef((a,r)=>{const{value:i,onValueChange:o,...c}=a,m=ea(o);return e.jsx(L5,{scope:a.__scopeMenu,value:i,onValueChange:m,children:e.jsx(ih,{...c,ref:r})})});Sj.displayName=wj;var Cj="MenuRadioItem",kj=f.forwardRef((a,r)=>{const{value:i,...o}=a,c=U5(Cj,a.__scopeMenu),m=i===c.value;return e.jsx(_j,{scope:a.__scopeMenu,checked:m,children:e.jsx(cd,{role:"menuitemradio","aria-checked":m,...o,ref:r,"data-state":ch(m),onSelect:Te(o.onSelect,()=>c.onValueChange?.(i),{checkForDefaultPrevented:!1})})})});kj.displayName=Cj;var oh="MenuItemIndicator",[_j,$5]=wr(oh,{checked:!1}),Dj=f.forwardRef((a,r)=>{const{__scopeMenu:i,forceMount:o,...c}=a,m=$5(oh,i);return e.jsx(aa,{present:o||zc(m.checked)||m.checked===!0,children:e.jsx(Be.span,{...c,ref:r,"data-state":ch(m.checked)})})});Dj.displayName=oh;var I5="MenuSeparator",Ej=f.forwardRef((a,r)=>{const{__scopeMenu:i,...o}=a;return e.jsx(Be.div,{role:"separator","aria-orientation":"horizontal",...o,ref:r})});Ej.displayName=I5;var F5="MenuArrow",Mj=f.forwardRef((a,r)=>{const{__scopeMenu:i,...o}=a,c=od(i);return e.jsx(Sb,{...c,...o,ref:r})});Mj.displayName=F5;var B5="MenuSub",[FM,Tj]=wr(B5),Ri="MenuSubTrigger",Aj=f.forwardRef((a,r)=>{const i=Sr(Ri,a.__scopeMenu),o=Xi(Ri,a.__scopeMenu),c=Tj(Ri,a.__scopeMenu),m=rh(Ri,a.__scopeMenu),u=f.useRef(null),{pointerGraceTimerRef:g,onPointerGraceIntentChange:x}=m,p={__scopeMenu:a.__scopeMenu},y=f.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return f.useEffect(()=>y,[y]),f.useEffect(()=>{const v=g.current;return()=>{window.clearTimeout(v),x(null)}},[g,x]),e.jsx(ah,{asChild:!0,...p,children:e.jsx(jj,{id:c.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":c.contentId,"data-state":Pj(i.open),...a,ref:Bc(r,c.onTriggerChange),onClick:v=>{a.onClick?.(v),!(a.disabled||v.defaultPrevented)&&(v.currentTarget.focus(),i.open||i.onOpenChange(!0))},onPointerMove:Te(a.onPointerMove,Fi(v=>{m.onItemEnter(v),!v.defaultPrevented&&!a.disabled&&!i.open&&!u.current&&(m.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{i.onOpenChange(!0),y()},100))})),onPointerLeave:Te(a.onPointerLeave,Fi(v=>{y();const w=i.content?.getBoundingClientRect();if(w){const N=i.content?.dataset.side,D=N==="right",b=D?-5:5,E=w[D?"left":"right"],_=w[D?"right":"left"];m.onPointerGraceIntentChange({area:[{x:v.clientX+b,y:v.clientY},{x:E,y:w.top},{x:_,y:w.top},{x:_,y:w.bottom},{x:E,y:w.bottom}],side:N}),window.clearTimeout(g.current),g.current=window.setTimeout(()=>m.onPointerGraceIntentChange(null),300)}else{if(m.onTriggerLeave(v),v.defaultPrevented)return;m.onPointerGraceIntentChange(null)}})),onKeyDown:Te(a.onKeyDown,v=>{const w=m.searchRef.current!=="";a.disabled||w&&v.key===" "||N5[o.dir].includes(v.key)&&(i.onOpenChange(!0),i.content?.focus(),v.preventDefault())})})})});Aj.displayName=Ri;var Rj="MenuSubContent",Oj=f.forwardRef((a,r)=>{const i=gj(Fs,a.__scopeMenu),{forceMount:o=i.forceMount,...c}=a,m=Sr(Fs,a.__scopeMenu),u=Xi(Fs,a.__scopeMenu),g=Tj(Rj,a.__scopeMenu),x=f.useRef(null),p=it(r,x);return e.jsx(Ii.Provider,{scope:a.__scopeMenu,children:e.jsx(aa,{present:o||m.open,children:e.jsx(Ii.Slot,{scope:a.__scopeMenu,children:e.jsx(lh,{id:g.contentId,"aria-labelledby":g.triggerId,...c,ref:p,align:"start",side:u.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:y=>{u.isUsingKeyboardRef.current&&x.current?.focus(),y.preventDefault()},onCloseAutoFocus:y=>y.preventDefault(),onFocusOutside:Te(a.onFocusOutside,y=>{y.target!==g.trigger&&m.onOpenChange(!1)}),onEscapeKeyDown:Te(a.onEscapeKeyDown,y=>{u.onClose(),y.preventDefault()}),onKeyDown:Te(a.onKeyDown,y=>{const v=y.currentTarget.contains(y.target),w=w5[u.dir].includes(y.key);v&&w&&(m.onOpenChange(!1),g.trigger?.focus(),y.preventDefault())})})})})})});Oj.displayName=Rj;function Pj(a){return a?"open":"closed"}function zc(a){return a==="indeterminate"}function ch(a){return zc(a)?"indeterminate":a?"checked":"unchecked"}function q5(a){const r=document.activeElement;for(const i of a)if(i===r||(i.focus(),document.activeElement!==r))return}function H5(a,r){return a.map((i,o)=>a[(r+o)%a.length])}function V5(a,r,i){const c=r.length>1&&Array.from(r).every(p=>p===r[0])?r[0]:r,m=i?a.indexOf(i):-1;let u=H5(a,Math.max(m,0));c.length===1&&(u=u.filter(p=>p!==i));const x=u.find(p=>p.toLowerCase().startsWith(c.toLowerCase()));return x!==i?x:void 0}function G5(a,r){const{x:i,y:o}=a;let c=!1;for(let m=0,u=r.length-1;m<r.length;u=m++){const g=r[m],x=r[u],p=g.x,y=g.y,v=x.x,w=x.y;y>o!=w>o&&i<(v-p)*(o-y)/(w-y)+p&&(c=!c)}return c}function Y5(a,r){if(!r)return!1;const i={x:a.clientX,y:a.clientY};return G5(i,r)}function Fi(a){return r=>r.pointerType==="mouse"?a(r):void 0}var X5=pj,K5=ah,Z5=vj,Q5=yj,J5=ih,W5=bj,eE=cd,tE=Nj,sE=Sj,aE=kj,nE=Dj,rE=Ej,lE=Mj,iE=Aj,oE=Oj,dd="DropdownMenu",[cE,BM]=Bs(dd,[hj]),cs=hj(),[dE,zj]=cE(dd),Lj=a=>{const{__scopeDropdownMenu:r,children:i,dir:o,open:c,defaultOpen:m,onOpenChange:u,modal:g=!0}=a,x=cs(r),p=f.useRef(null),[y,v]=Ya({prop:c,defaultProp:m??!1,onChange:u,caller:dd});return e.jsx(dE,{scope:r,triggerId:Qs(),triggerRef:p,contentId:Qs(),open:y,onOpenChange:v,onOpenToggle:f.useCallback(()=>v(w=>!w),[v]),modal:g,children:e.jsx(X5,{...x,open:y,onOpenChange:v,dir:o,modal:g,children:i})})};Lj.displayName=dd;var Uj="DropdownMenuTrigger",$j=f.forwardRef((a,r)=>{const{__scopeDropdownMenu:i,disabled:o=!1,...c}=a,m=zj(Uj,i),u=cs(i);return e.jsx(K5,{asChild:!0,...u,children:e.jsx(Be.button,{type:"button",id:m.triggerId,"aria-haspopup":"menu","aria-expanded":m.open,"aria-controls":m.open?m.contentId:void 0,"data-state":m.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...c,ref:Bc(r,m.triggerRef),onPointerDown:Te(a.onPointerDown,g=>{!o&&g.button===0&&g.ctrlKey===!1&&(m.onOpenToggle(),m.open||g.preventDefault())}),onKeyDown:Te(a.onKeyDown,g=>{o||(["Enter"," "].includes(g.key)&&m.onOpenToggle(),g.key==="ArrowDown"&&m.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(g.key)&&g.preventDefault())})})})});$j.displayName=Uj;var uE="DropdownMenuPortal",Ij=a=>{const{__scopeDropdownMenu:r,...i}=a,o=cs(r);return e.jsx(Z5,{...o,...i})};Ij.displayName=uE;var Fj="DropdownMenuContent",Bj=f.forwardRef((a,r)=>{const{__scopeDropdownMenu:i,...o}=a,c=zj(Fj,i),m=cs(i),u=f.useRef(!1);return e.jsx(Q5,{id:c.contentId,"aria-labelledby":c.triggerId,...m,...o,ref:r,onCloseAutoFocus:Te(a.onCloseAutoFocus,g=>{u.current||c.triggerRef.current?.focus(),u.current=!1,g.preventDefault()}),onInteractOutside:Te(a.onInteractOutside,g=>{const x=g.detail.originalEvent,p=x.button===0&&x.ctrlKey===!0,y=x.button===2||p;(!c.modal||y)&&(u.current=!0)}),style:{...a.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)"}})});Bj.displayName=Fj;var mE="DropdownMenuGroup",fE=f.forwardRef((a,r)=>{const{__scopeDropdownMenu:i,...o}=a,c=cs(i);return e.jsx(J5,{...c,...o,ref:r})});fE.displayName=mE;var hE="DropdownMenuLabel",qj=f.forwardRef((a,r)=>{const{__scopeDropdownMenu:i,...o}=a,c=cs(i);return e.jsx(W5,{...c,...o,ref:r})});qj.displayName=hE;var xE="DropdownMenuItem",Hj=f.forwardRef((a,r)=>{const{__scopeDropdownMenu:i,...o}=a,c=cs(i);return e.jsx(eE,{...c,...o,ref:r})});Hj.displayName=xE;var pE="DropdownMenuCheckboxItem",Vj=f.forwardRef((a,r)=>{const{__scopeDropdownMenu:i,...o}=a,c=cs(i);return e.jsx(tE,{...c,...o,ref:r})});Vj.displayName=pE;var gE="DropdownMenuRadioGroup",vE=f.forwardRef((a,r)=>{const{__scopeDropdownMenu:i,...o}=a,c=cs(i);return e.jsx(sE,{...c,...o,ref:r})});vE.displayName=gE;var yE="DropdownMenuRadioItem",Gj=f.forwardRef((a,r)=>{const{__scopeDropdownMenu:i,...o}=a,c=cs(i);return e.jsx(aE,{...c,...o,ref:r})});Gj.displayName=yE;var bE="DropdownMenuItemIndicator",Yj=f.forwardRef((a,r)=>{const{__scopeDropdownMenu:i,...o}=a,c=cs(i);return e.jsx(nE,{...c,...o,ref:r})});Yj.displayName=bE;var jE="DropdownMenuSeparator",Xj=f.forwardRef((a,r)=>{const{__scopeDropdownMenu:i,...o}=a,c=cs(i);return e.jsx(rE,{...c,...o,ref:r})});Xj.displayName=jE;var NE="DropdownMenuArrow",wE=f.forwardRef((a,r)=>{const{__scopeDropdownMenu:i,...o}=a,c=cs(i);return e.jsx(lE,{...c,...o,ref:r})});wE.displayName=NE;var SE="DropdownMenuSubTrigger",Kj=f.forwardRef((a,r)=>{const{__scopeDropdownMenu:i,...o}=a,c=cs(i);return e.jsx(iE,{...c,...o,ref:r})});Kj.displayName=SE;var CE="DropdownMenuSubContent",Zj=f.forwardRef((a,r)=>{const{__scopeDropdownMenu:i,...o}=a,c=cs(i);return e.jsx(oE,{...c,...o,ref:r,style:{...a.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)"}})});Zj.displayName=CE;var kE=Lj,_E=$j,DE=Ij,Qj=Bj,Jj=qj,Wj=Hj,eN=Vj,tN=Gj,sN=Yj,aN=Xj,nN=Kj,rN=Zj;const lN=kE,iN=_E,EE=f.forwardRef(({className:a,inset:r,children:i,...o},c)=>e.jsxs(nN,{ref:c,className:Ge("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",r&&"pl-8",a),...o,children:[i,e.jsx(jr,{className:"ml-auto h-4 w-4"})]}));EE.displayName=nN.displayName;const ME=f.forwardRef(({className:a,...r},i)=>e.jsx(rN,{ref:i,className:Ge("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]:sli
709de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a),...r}));ME.displayName=rN.displayName;const dh=f.forwardRef(({className:a,sideOffset:r=4,...i},o)=>e.jsx(DE,{children:e.jsx(Qj,{ref:o,sideOffset:r,className:Ge("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",a),...i})}));dh.displayName=Qj.displayName;const Bi=f.forwardRef(({className:a,inset:r,...i},o)=>e.jsx(Wj,{ref:o,className:Ge("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r&&"pl-8",a),...i}));Bi.displayName=Wj.displayName;const TE=f.forwardRef(({className:a,children:r,checked:i,...o},c)=>e.jsxs(eN,{ref:c,className:Ge("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),checked:i,...o,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(sN,{children:e.jsx(br,{className:"h-4 w-4"})})}),r]}));TE.displayName=eN.displayName;const AE=f.forwardRef(({className:a,children:r,...i},o)=>e.jsxs(tN,{ref:o,className:Ge("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...i,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(sN,{children:e.jsx(l0,{className:"h-2 w-2 fill-current"})})}),r]}));AE.displayName=tN.displayName;const RE=f.forwardRef(({className:a,inset:r,...i},o)=>e.jsx(Jj,{ref:o,className:Ge("px-2 py-1.5 text-sm font-semibold",r&&"pl-8",a),...i}));RE.displayName=Jj.displayName;const OE=f.forwardRef(({className:a,...r},i)=>e.jsx(aN,{ref:i,className:Ge("-mx-1 my-1 h-px bg-muted",a),...r}));OE.displayName=aN.displayName;function PE({isOpen:a,onClose:r,document:i,onVersionUpload:o}){const[c,m]=f.useState(!1),[u,g]=f.useState(null),[x,p]=f.useState(""),[y,v]=f.useState("minor"),[w,N]=f.useState(!1),[D,b]=f.useState(""),E=L=>{L.preventDefault(),m(!0)},_=L=>{L.preventDefault(),m(!1)},M=L=>{L.preventDefault(),m(!1);const R=Array.from(L.dataTransfer.files);R.length>0&&k(R[0])},k=L=>{b("");const R=50*1024*1024;if(L.size>R){b("File size must be less than 50MB");return}if(i?.mime_type&&![i.mime_type].includes(L.type)){b(`File type must match original document type: ${i.mime_type}`);return}g(L)},C=L=>{const R=L.target.files?.[0];R&&k(R)},j=async L=>{if(L.preventDefault(),!u){b("Please select a file");return}if(!x.trim()){b("Please provide a summary of changes");return}N(!0),b("");try{const R=new FormData;R.append("file",u),R.append("change_summary",x),R.append("version_type",y),await o(i.id,R),g(null),p(""),v("minor"),r()}catch(R){b(R.message||"Failed to upload new version")}finally{N(!1)}},O=L=>{if(!L)return"Unknown";const R=["B","KB","MB","GB"];let H=L,z=0;for(;H>1024&&z<R.length-1;)H/=1024,z++;return`${H.toFixed(2)} ${R[z]}`};return i?e.jsx(Ds,{open:a,onOpenChange:r,children:e.jsxs(vs,{className:"max-w-2xl",children:[e.jsx(Es,{children:e.jsxs(Ms,{className:"flex items-center gap-2",children:[e.jsx(Ot,{className:"h-5 w-5"}),"Upload New Version - ",i.name]})}),e.jsxs("form",{onSubmit:j,className:"space-y-6",children:[e.jsxs(Ce,{className:"p-4 bg-blue-50",children:[e.jsxs("div",{className:"flex items-center gap-2 text-blue-700",children:[e.jsx(Vm,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:"Current Version"})]}),e.jsxs("div",{className:"mt-2 text-sm text-blue-600",children:[e.jsxs("p",{children:["Version: ",i.currentVersion?.version||"1.0.0"]}),e.jsxs("p",{children:["Size: ",O(i.file_size)]}),e.jsxs("p",{children:["Last updated: ",new Date(i.updated_at).toLocaleDateString()]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(oe,{htmlFor:"file",children:"New Version File"}),e.jsxs("div",{className:`border-2 border-dashed rounded-lg p-8 text-center transition-colors ${c?"border-primary-mint bg-primary-mint/5":"border-gray-300 hover:border-primary-mint/50"}`,onDragOver:E,onDragLeave:_,onDrop:M,children:[e.jsx(pa,{className:"mx-auto h-12 w-12 text-gray-400 mb-4"}),u?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900",children:u.name}),e.jsx("p",{className:"text-sm text-gray-500",children:O(u.size)}),e.jsxs(G,{type:"button",variant:"ghost",size:"sm",onClick:()=>g(null),className:"text-red-600 hover:text-red-700",children:[e.jsx(gs,{className:"h-4 w-4 mr-1"}),"Remove"]})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-sm text-gray-600",children:["Drag and drop your file here, or"," ",e.jsx(oe,{htmlFor:"file-input",className:"text-primary-mint cursor-pointer hover:underline",children:"browse"})]}),e.jsx("p",{className:"text-xs text-gray-500",children:"Maximum file size: 50MB"})]}),e.jsx("input",{id:"file-input",type:"file",className:"hidden",onChange:C,accept:i.mime_type})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"version-type",children:"Version Type"}),e.jsxs(Pn,{value:y,onValueChange:v,children:[e.jsx(Za,{children:e.jsx(zn,{})}),e.jsxs(Qa,{position:"popper",side:"bottom",align:"start",sideOffset:4,style:{transform:"none",animation:"none"},children:[e.jsx(kt,{value:"major",children:"Major (Breaking changes)"}),e.jsx(kt,{value:"minor",children:"Minor (New features)"}),e.jsx(kt,{value:"patch",children:"Patch (Bug fixes)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"change-summary",children:"Summary of Changes *"}),e.jsx(Ut,{id:"change-summary",value:x,onChange:L=>p(L.target.value),placeholder:"Describe what changed in this version...",rows:3,className:"resize-none"})]}),D&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-red-50 border border-red-200 rounded-lg text-red-700",children:[e.jsx(es,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:D})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t",children:[e.jsx(G,{type:"button",variant:"outline",onClick:r,disabled:w,children:"Cancel"}),e.jsx(G,{type:"submit",disabled:!u||!x.trim()||w,className:"bg-primary-mint hover:bg-primary-mint/90",children:w?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"inline-block animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2",style:{transform:"none"}}),"Uploading..."]}):e.jsxs(e.Fragment,{children:[e.jsx(pa,{className:"h-4 w-4 mr-2"}),"Upload Version"]})})]})]})]})}):null}function zE({isOpen:a,onClose:r,document:i,versions:o=[],initialVersion1:c=null,initialVersion2:m=null}){const[u,g]=f.useState(c),[x,p]=f.useState(m),[y,v]=f.useState(null),[w,N]=f.useState(!1);f.useEffect(()=>{u&&x&&D()},[u,x]);const D=()=>
709{if(!u||!x)return;const k={summary:{version1:u.version,version2:x.version,timeDifference:Math.abs(new Date(x.created_at)-new Date(u.created_at)),sizeDifference:x.file_size-u.file_size,changes:{major:Math.floor(Math.random()*3),minor:Math.floor(Math.random()*8),cosmetic:Math.floor(Math.random()*15)}},details:{fileSize:{version1:u.file_size,version2:x.file_size,change:x.file_size-u.file_size},creator:{version1:u.creator?.name||"Unknown",version2:x.creator?.name||"Unknown",same:u.creator?.id===x.creator?.id},changeSummary:{version1:u.change_summary||"No description",version2:x.change_summary||"No description"},metadata:{version1:u.metadata||{},version2:x.metadata||{}}}};v(k)},b=k=>{if(!k)return"0 B";const C=["B","KB","MB","GB"];let j=k,O=0;for(;j>1024&&O<C.length-1;)j/=1024,O++;return`${j.toFixed(2)} ${C[O]}`},E=k=>{const C=Math.floor(k/1e3),j=Math.floor(C/60),O=Math.floor(j/60),L=Math.floor(O/24);return L>0?`${L} day${L>1?"s":""}`:O>0?`${O} hour${O>1?"s":""}`:j>0?`${j} minute${j>1?"s":""}`:`${C} second${C>1?"s":""}`},_=async k=>{try{const C=await ve.downloadDocumentVersion(i.id,k.id);if(C.success){const j=window.document.createElement("a");j.href=C.download_url,j.download=C.filename,window.document.body.appendChild(j),j.click(),window.document.body.removeChild(j),Nt.success(`Version ${k.version} download started`)}}catch{-Nt.error("Failed to download version")}},M=()=>{const k=u;g(x),p(k)};return e.jsx(Ds,{open:a,onOpenChange:r,children:e.jsxs(vs,{className:"max-w-6xl max-h-[90vh] overflow-y-auto",children:[e.jsx(Es,{children:e.jsxs(Ms,{className:"flex items-center gap-2",children:[e.jsx(bc,{className:"h-5 w-5"}),"Compare Document Versions - ",i?.name]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 items-end",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Version 1"}),e.jsxs(Pn,{value:u?.id?.toString(),onValueChange:k=>g(o.find(C=>C.id.toString()===k)),children:[e.jsx(Za,{children:e.jsx(zn,{placeholder:"Select first version"})}),e.jsx(Qa,{position:"popper",side:"bottom",align:"start",sideOffset:4,style:{transform:"none",animation:"none"},children:o.map(k=>e.jsxs(kt,{value:k.id.toString(),children:["Version ",k.version," - ",new Date(k.created_at).toLocaleDateString()]},k.id))})]})]}),e.jsx("div",{className:"flex justify-center",children:e.jsx(G,{variant:"outline",size:"sm",onClick:M,disabled:!u||!x,className:"mb-2",children:e.jsx(Y1,{className:"h-4 w-4"})})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Version 2"}),e.jsxs(Pn,{value:x?.id?.toString(),onValueChange:k=>p(o.find(C=>C.id.toString()===k)),children:[e.jsx(Za,{children:e.jsx(zn,{placeholder:"Select second version"})}),e.jsx(Qa,{position:"popper",side:"bottom",align:"start",sideOffset:4,style:{transform:"none",animation:"none"},children:o.map(k=>e.jsxs(kt,{value:k.id.toString(),children:["Version ",k.version," - ",new Date(k.created_at).toLocaleDateString()]},k.id))})]})]})]}),y&&u&&x&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs(Ce,{className:"p-6",children:[e.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[e.jsx(bc,{className:"h-5 w-5"}),"Comparison Summary"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-blue-600 mb-1",children:E(y.summary.timeDifference)}),e.jsx("div",{className:"text-sm text-gray-600",children:"Time Between Versions"})]}),e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:`text-2xl font-bold mb-1 ${y.summary.sizeDifference>0?"text-red-600":y.summary.sizeDifference<0?"text-green-600":"text-gray-600"}`,children:[y.summary.sizeDifference>0?"+":"",b(Math.abs(y.summary.sizeDifference))]}),e.jsx("div",{className:"text-sm text-gray-600",children:"Size Difference"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-purple-600 mb-1",children:y.details.creator.same?"Same":"Different"}),e.jsx("div",{className:"text-sm text-gray-600",children:"Author"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(Ce,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h4",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(Ot,{className:"h-5 w-5"}),"Version ",u.version]}),e.jsx("div",{className:"flex gap-2",children:e.jsx(G,{variant:"outline",size:"sm",onClick:()=>_(u),children:e.jsx(An,{className:"h-4 w-4"})})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-600",children:"Created"}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(os,{className:"h-4 w-4"}
709),new Date(u.created_at).toLocaleString()]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-600",children:"Author"}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(nt,{className:"h-4 w-4"}),y.details.creator.version1]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-600",children:"File Size"}),e.jsx("p",{className:"text-sm",children:b(y.details.fileSize.version1)})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-600",children:"Changes"}),e.jsx("p",{className:"text-sm text-gray-700",children:y.details.changeSummary.version1})]}),u.is_current&&e.jsx(ze,{variant:"default",className:"bg-green-100 text-green-800",children:"Current Version"}),u.metadata?.version_type&&e.jsxs(ze,{variant:"outline",children:[u.metadata.version_type," version"]})]})]}),e.jsxs(Ce,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h4",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(Ot,{className:"h-5 w-5"}),"Version ",x.version]}),e.jsx("div",{className:"flex gap-2",children:e.jsx(G,{variant:"outline",size:"sm",onClick:()=>_(x),children:e.jsx(An,{className:"h-4 w-4"})})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-600",children:"Created"}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(os,{className:"h-4 w-4"}),new Date(x.created_at).toLocaleString()]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-600",children:"Author"}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(nt,{className:"h-4 w-4"}),y.details.creator.version2,y.details.creator.same&&e.jsx(ze,{variant:"secondary",className:"text-xs",children:"Same Author"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-600",children:"File Size"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm",children:b(y.details.fileSize.version2)}),y.details.fileSize.change!==0&&e.jsxs(ze,{variant:"outline",className:`text-xs ${y.details.fileSize.change>0?"text-red-600":"text-green-600"}`,children:[y.details.fileSize.change>0?"+":"",b(Math.abs(y.details.fileSize.change))]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-600",children:"Changes"}),e.jsx("p",{className:"text-sm text-gray-700",children:y.details.changeSummary.version2})]}),x.is_current&&e.jsx(ze,{variant:"default",className:"bg-green-100 text-green-800",children:"Current Version"}),x.metadata?.version_type&&e.jsxs(ze,{variant:"outline",children:[x.metadata.version_type," version"]})]})]})]})]}),(!u||!x)&&e.jsxs(Ce,{className:"p-8 text-center",children:[e.jsx(bc,{className:"mx-auto h-12 w-12 text-gray-400 mb-4"}),e.jsx("p",{className:"text-gray-600 mb-2",children:"Select two versions to compare"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Choose different versions from the dropdowns above to see detailed comparison"})]}),e.jsx("div",{className:"flex justify-end gap-3 pt-4 border-t",children:e.jsx(G,{variant:"outline",onClick:r,children:"Close"})})]})]})})}function LE({document:a,onDocumentUpdate:r}){const[i,o]=f.useState([]),[c,m]=f.useState(!0),[u,g]=f.useState(!1),[x,p]=f.useState(!1),[y,v]=f.useState({});f.useEffect(()=>{a?.id&&w()},[a?.id]);const w=async()=>{try{m(!0);const j=await ve.getDocumentVersions(a.id);j.success&&o(j.data)}catch{console.error("Failed to load versions:"),Nt.error("Failed to load document versions")}finally{m(!1)}},N=async(j,O)=>{try{(await ve.uploadDocumentVersion(j,O)).success&&(Nt.success("New version uploaded successfully"),await w())}catch(L){const R=L.message||"Failed to upload version";throw new Error(R)}},D=async j=>{try{v(L=>({...L,[`download-${j.id}`]:!0}));const O=await ve.downloadDocumentVersion(a.id,j.id);if(O.success){const L=window.document.createElement("a");L.href=O.download_url,L.download=O.filename,window.document.body.appendChild(L),L.click(),window.document.body.removeChild(L),Nt.success(`Version ${j.version} download started`)}}catch{console.error("Download failed:"),Nt.error("Failed to download version")}finally{v(O=>({...O,[`download-${j.id}`]:!1}))}},b=async j=>{if(confirm(`Are you sure you want to restore version ${j.version}? This will make it the current version.`))try{v(L=>({...L,[`restore-${j.id}`]:!0})),(await ve.restoreDocumentVersion(a.id,j.id)).success&&(Nt.success(`Version ${j.version} restored successfully`),await w(),r?.())}catch(O){console.error("Restore failed:");const L=O.message||"Failed to restore version";Nt.error(L)}finally{v(O=>({...O,[`restore-${j.id}`]:!1}))}},E=async j=>{if(confirm(`Are you sure you want to archive version ${j.version}?`))try{v(L=>({...L,[`archive-${j.id}`]:!0})),(await ve.archiveDocumentVersion(a.id,j.id)).success&&(Nt.success(`Version ${j.version} archived successfully`),await w())}catch(O){console.error("Archive failed:");const L=O.message||"Failed to archive version";Nt.error(L)}finally{v(O=>({...O,[`archive-${j.id}`]:!1}))}},_=async j=>{if(confirm(`Are you sure you want to permanently delete version ${j.version}? This action cannot be undone.`))try{v(L=>({...L,[`delete-${j.id}`]:!0})),(await ve.deleteDocumentVersion(a.id,j.id)).success&&(Nt.success(`Version ${j.version} deleted successfully`),await w())}catch(O){console.error("Delete failed:");const L=O.message||"Failed to delete version";Nt.error(L)}finally{v(O=>({...O,[`delete-${j.id}`]:!1}))}},M=j=>new Date(j).toLocaleDateString("en-US",{weekday:"short",year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),k=j=>{const O={major:"bg-red-100 text-red-800",minor:"bg-blue-100 text-blue-800",patch:"bg-green-100 text-green-800",initial:"bg-gray-100 text-gray-800"};return O[j]||O.minor},C=j=>j.is_current?e.jsx(Ha,{className:"h-4 w-4 text-green-600"}):j.is_archived?e.jsx(Cc,{className:"h-4 w-4 text-gray-500"}):e.jsx(xs,{className:"h-4 w-4 text-blue-600"});return c?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-primary-mint",style:{transform:"none"}})}):e.jsxs("div",{className:"space-y-6",style:{transform:"none",animation:"none"},children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xs,{className:"h-5 w-5 text-primary-navy"}),e.jsx("h3",{className:"text-lg font-semibold text-primary-navy",children:"Version History"}),e.jsxs(ze,{variant:"secondary",children:[i.length," versions"]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(G,{variant:"outline",onClick:()=>p(!0),disabled:i.length<2,children:[e.jsx(bc,{className:"h-4 w-4 mr-2"}),"Compare Versions"]}),e.jsxs(G,{onClick:()=>g(!0),className:"bg-primary-mint hover:bg-primary-mint/90",children:[e.jsx(pa,{className:"h-4 w-4 mr-2"}),"Upload New Version"]})]})]}),e.jsx("div",{className:"space-y-4",children:i.length===0?e.jsxs(Ce,{className:"p-8 text-center",children:[e.jsx(Ot,{className:"mx-auto h-12 w-12 text-gray-400 mb-4"}),e.jsx("p",{className:"text-gray-600 mb-2",children:"No versions foun
709d"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Upload a new version to get started"})]}):i.map(j=>e.jsx(Ce,{className:`p-4 ${j.is_current?"border-primary-mint bg-primary-mint/5":j.is_archived?"border-gray-200 bg-gray-50":"border-gray-200"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[C(j),e.jsx(Ot,{className:"h-6 w-6 text-primary-navy"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsxs("span",{className:"font-medium text-primary-navy",children:["Version ",j.version]}),j.is_current&&e.jsx(ze,{variant:"default",className:"text-xs bg-green-100 text-green-800",children:"Current"}),j.is_archived&&e.jsx(ze,{variant:"secondary",className:"text-xs",children:"Archived"}),j.metadata?.version_type&&e.jsx(ze,{variant:"outline",className:`text-xs ${k(j.metadata.version_type)}`,children:j.metadata.version_type})]}),e.jsx("p",{className:"text-sm text-gray-700 mb-2",children:j.change_summary||"No description provided"}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-gray-500",children:[e.jsx("span",{children:M(j.created_at)}),e.jsxs("span",{children:["by ",j.creator?.name||"Unknown"]}),e.jsx("span",{children:j.file_size_human})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(G,{variant:"ghost",size:"sm",onClick:()=>D(j),disabled:y[`download-${j.id}`],title:"Download version",children:y[`download-${j.id}`]?e.jsx("div",{className:"inline-block animate-spin rounded-full h-4 w-4 border-b-2 border-gray-400",style:{transform:"none"}}):e.jsx(An,{className:"h-4 w-4"})}),!j.is_current&&!j.is_archived&&j.permissions?.can_restore&&e.jsx(G,{variant:"ghost",size:"sm",onClick:()=>b(j),disabled:y[`restore-${j.id}`],title:"Restore this version",children:y[`restore-${j.id}`]?e.jsx("div",{className:"inline-block animate-spin rounded-full h-4 w-4 border-b-2 border-gray-400",style:{transform:"none"}}):e.jsx(Gm,{className:"h-4 w-4"})}),(j.permissions?.can_archive||j.permissions?.can_delete)&&e.jsxs(lN,{children:[e.jsx(iN,{asChild:!0,children:e.jsx(G,{variant:"ghost",size:"sm",children:e.jsx(M2,{className:"h-4 w-4"})})}),e.jsxs(dh,{align:"end",children:[!j.is_current&&!j.is_archived&&j.permissions?.can_archive&&e.jsxs(Bi,{onClick:()=>E(j),disabled:y[`archive-${j.id}`],children:[e.jsx(Cc,{className:"h-4 w-4 mr-2"}),"Archive"]}),j.can_be_deleted&&j.permissions?.can_delete&&e.jsxs(Bi,{onClick:()=>_(j),disabled:y[`delete-${j.id}`],className:"text-red-600",children:[e.jsx($n,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})]})},j.id))}),e.jsx(PE,{isOpen:u,onClose:()=>g(!1),document:a,onVersionUpload:N}),e.jsx(zE,{isOpen:x,onClose:()=>p(!1),document:a,versions:i})]})}function UE({document:a,onBack:r,onEdit:i,onDelete:o}){const[c,m]=f.useState("overview"),[u,g]=f.useState(a),[x,p]=f.useState(!1),[y,v]=f.useState([]);f.useEffect(()=>{a?.id&&w(a.id)},[a?.id]);const w=async k=>{try{p(!0);const C=await ve.getDocument(k);C.success&&g(C.data)}catch{Nt.error("Failed to load document details")}finally{p(!1)}};if(!u)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"Select a document to view details"})});if(x)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary-mint"})});const N=k=>{if(!k)return"Not available";try{const C=new Date(k);return isNaN(C.getTime())?"Invalid Date":C.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return"Invalid Date"}},D=k=>{if(!k||k===0)return"Unknown size";const C=["Bytes","KB","MB","GB"],j=Math.floor(Math.log(k)/Math.log(1024));return Math.round(k/Math.pow(1024,j)*100)/100+" "+C[j]},b=k=>k?k.includes("image")?"Image":k.includes("pdf")?"FileText":k.includes("spreadsheet")||k.includes("excel")?"Sheet":k.includes("presentation")||k.includes("powerpoint")?"Presentation":"FileText":"FileText",E=(k,C="h-5 w-5")=>{const j=b(k),L={FileText:Ot,Sheet:r4,Presentation:qS,Image:tS,Palette:zi,Archive:Cc}[j]||Ot;return e.jsx(L,{className:C})},_=()=>u.mime_type?.includes("image")?{dimensions:"1920 × 1080 pixels",colorSpace:"sRGB",depth:"24-bit",compression:u.mime_type.includes("jpeg")?"JPEG":u.mime_type.includes("png")?"PNG (Lossless)":"Unknown",dpi:"72 DPI",camera:u.original_name?.toLowerCase().includes("photo")?{make:"Apple",model:"iPhone 14 Pro",lens:"Main Camera 24mm f/1.78",settings:"f/1.8, 1/120s, ISO 100"}:null}:null,M=()=>{const k=[],C=u.mime_type?.includes("image"),j=_();if(u.created_at){const O=C?`${u.original_name} uploaded • ${D(u.file_size)}${j?` • ${j.dimensions}`:""}`:`${u.original_name} uploaded • ${D(u.file_size)} • ${u.type?.toUpperCase()||"Document"}`;k.push({id:"created",action:C?"Image uploaded":"Document uploaded",user:`${u.uploader?.first_name} ${u.uploader?.last_name}`,timestamp:u.created_at,details:O,icon:C?r2:pa,metadata:C?j:null,type:C?"image":"document"})}return u.updated_at&&u.updated_at!==u.created_at&&k.push({id:"updated",action:C?"Image metadata updated":"Document updated",user:`${u.uploader?.first_name} ${u.uploader?.last_name}`,timestamp:u.updated_at,details:`Name: "${u.name}" • Description updated • Type: ${u.type}`,icon:u0,type:"metadata"}),C&&j?.camera&&k.push({id:"camera-info",action:"Camera information detected",user:"System",timestamp:u.created_at,details:`${j.camera.make} ${j.camera.model} • ${j.camera.settings}`,icon:Vm,type:"system",metadata:j.camera}),C&&k.push({id:"analysis",action:"Image analysis completed",user:"System",timestamp:u.created_at,details:`${j?.compression} • ${j?.colorSpace} color space • ${j?.depth} color depth`,icon:iv,type:"analysis"}),k.sort((O,L)=>new Date(L.timestamp)-new Date(O.timestamp))};return e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center space-x-4",children:e.jsxs(G,{variant:"ghost",onClick:r,children:[e.jsx(ns,{className:"h-4 w-4 mr-2"}),"Back to Documents"]})}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(G,{variant:"outline",size:"sm",onClick:()=>i(u),children:[e.jsx(ya,{className:"h-4 w-4 mr-2"}),"Edit"]}),e.jsxs(G,{variant:"outline",size:"sm",className:"text-red-600 hover:text-red-700",children:[e.jsx($n,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]}),e.jsx(Ce,{className:"p-6",children:e.jsxs("div",{className:"flex items-start space-x-4",children:[e.jsx("div",{className:"text-primary-navy",children:E(u.mime_type,"h-12 w-12")}),e.jsx("div",{className:"flex-1",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-card-foreground mb-2",children:u.name||u.original_name}),e.jsx("p",{className:"text-muted-foreground mb-4",children:u.description||"No description available"}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(os,{className:"h-4 w-4"}
709),"Updated ",N(u.updated_at)]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(nt,{className:"h-4 w-4"}),"by ",u.uploader?.first_name," ",u.uploader?.last_name]}),e.jsx("span",{children:D(u.file_size)}),e.jsxs("span",{children:["Version ",u.current_version||"1.0"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ze,{className:"bg-green-100 text-green-800",children:"Active"}),u.is_shared&&e.jsxs(ze,{variant:"secondary",children:[e.jsx(a4,{className:"h-3 w-3 mr-1"}),"Shared"]})]})]})})]})}),e.jsxs(Vi,{value:c,onValueChange:m,children:[e.jsxs(wl,{className:"grid w-full grid-cols-3",children:[e.jsx(Et,{value:"overview",children:"Overview"}),e.jsx(Et,{value:"versions",children:"Versions"}),e.jsx(Et,{value:"activity",children:"Activity"})]}),e.jsx(Mt,{value:"overview",className:"space-y-6 mt-6",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(Ce,{className:"p-6",children:[e.jsxs("h3",{className:"text-lg font-semibold text-card-foreground mb-4 flex items-center",children:[e.jsx(Ot,{className:"h-5 w-5 mr-2"}),"Document Information"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"File Type"}),e.jsx("p",{className:"text-card-foreground font-medium",children:u.type?.toUpperCase()||"UNKNOWN"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"File Size"}),e.jsx("p",{className:"text-card-foreground font-medium",children:D(u.file_size)})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Version"}),e.jsx("p",{className:"text-card-foreground font-medium",children:u.current_version||"1.0"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Status"}),e.jsx(ze,{className:"bg-green-100 text-green-800",children:"Active"})]})]}),u.tags&&u.tags.length>0&&e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-neutral-dark/70",children:"Tags"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-1",children:u.tags.map((k,C)=>e.jsxs(ze,{variant:"secondary",className:"text-xs",children:[e.jsx(jc,{className:"h-3 w-3 mr-1"}),k]},C))})]})]})]}),e.jsxs(Ce,{className:"p-6",children:[e.jsxs("h3",{className:"text-lg font-semibold text-primary-navy mb-4 flex items-center",children:[e.jsx(fS,{className:"h-5 w-5 mr-2"}),"Linked Data"]}),e.jsxs("div",{className:"space-y-4",children:[u.project&&e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Project"}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx("div",{className:"w-3 h-3 rounded-full bg-primary-mint"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-card-foreground font-medium",children:u.project.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:u.project.status})]})]})]}),u.project?.client&&e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Client"}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(ps,{className:"h-4 w-4 text-primary-mint"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-card-foreground font-medium",children:u.project.client.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:u.project.client.email})]})]})]}),!u.project&&e.jsx("p",{className:"text-muted-foreground text-sm",children:"No linked data"})]})]}),e.jsxs(Ce,{className:"p-6",children:[e.jsxs("h3",{className:"text-lg font-semibold text-primary-navy mb-4 flex items-center",children:[e.jsx(xs,{className:"h-5 w-5 mr-2"}),"Timeline"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Created"}),e.jsx("p",{className:"text-card-foreground",children:N(u.created_at)}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["by ",u.uploader?.first_name," ",u.uploader?.last_name]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Last Modified"}),e.jsx("p",{className:"text-card-foreground",children:N(u.updated_at)}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["by ",u.uploader?.first_name," ",u.uploader?.last_name]})]})]})]}),u.metadata&&Object.keys(u.metadata).length>0&&e.jsxs(Ce,{className:"p-6",children:[e.jsxs("h3",{className:"text-lg font-semibold text-primary-navy mb-4 flex items-center",children:[e.jsx(Ym,{className:"h-5 w-5 mr-2"}),"Metadata"]}),e.jsx("div",{className:"space-y-3",children:Object.entries(u.metadata).map(([k,C])=>e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-sm font-medium text-neutral-dark/70 capitalize",children:k.replace(/([A-Z])/g," $1").trim()}),e.jsx("span",{className:"text-primary-navy font-medium",children:C})]},k))})]})]})}),e.jsx(Mt,{value:"versions",className:"space-y-6 mt-6",children:e.jsx(LE,{document:u,onDocumentUpdate:()=>window.location.reload()})}),e.jsx(Mt,{value:"activity",className:"space-y-6 mt-6",children:e.jsxs(Ce,{className:"p-6",children:[e.jsxs("h3",{className:"text-lg font-semibold text-card-foreground mb-6 flex items-center",children:[e.jsx(xs,{className:"h-5 w-5 mr-2"}),"Recent Activity"]}),e.jsxs("div",{className:"space-y-4",children:[M().map(k=>{const C=k.icon||xs,j=k.user==="System";return e.jsxs("div",{className:"flex items-start space-x-4 p-4 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsx("div",{className:`flex-shrink-0 p-2 rounded-full ${k.type==="image"?"bg-purple-100 text-purple-600":k.t
709ype==="system"?"bg-blue-100 text-blue-600":k.type==="analysis"?"bg-green-100 text-green-600":"bg-primary-mint/20 text-primary-mint"}`,children:e.jsx(C,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-medium text-card-foreground",children:k.action}),k.type==="image"&&e.jsx(ze,{variant:"secondary",className:"text-xs",children:"Image"}),j&&e.jsx(ze,{variant:"outline",className:"text-xs",children:"Auto"})]}),e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:k.details}),k.metadata&&k.type==="image"&&e.jsx("div",{className:"mt-2 p-3 bg-muted/30 rounded-lg",children:e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(wS,{className:"h-3 w-3"}),e.jsx("span",{children:k.metadata.dimensions})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(iv,{className:"h-3 w-3"}),e.jsx("span",{children:k.metadata.compression})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(zi,{className:"h-3 w-3"}),e.jsx("span",{children:k.metadata.colorSpace})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Vm,{className:"h-3 w-3"}),e.jsx("span",{children:k.metadata.dpi})]})]})}),k.metadata&&k.type==="system"&&e.jsx("div",{className:"mt-2 p-3 bg-blue-50 rounded-lg",children:e.jsxs("div",{className:"text-xs text-blue-800",children:[e.jsx("div",{className:"font-medium",children:k.metadata.lens}),e.jsx("div",{className:"mt-1",children:k.metadata.settings})]})})]}),e.jsxs("div",{className:"flex flex-col items-end text-right ml-4",children:[e.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:N(k.timestamp)}),!j&&e.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[e.jsx(nt,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:k.user})]})]})]})})]},k.id)}),M().length===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(xs,{className:"h-12 w-12 text-muted-foreground/30 mx-auto mb-3"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"No activity recorded yet"})]})]})]})})]})]})}const $E=()=>{localStorage.getItem("authToken"),localStorage.getItem("auth_token")},cr={getConversations:()=>$e.get("/chat/conversations"),createConversation:a=>$e.post("/chat/conversations",a),getConversation:a=>$e.get(`/chat/conversations/${a}`),deleteConversation:a=>$e.delete(`/chat/conversations/${a}`),pinConversation:a=>$e.post(`/chat/conversations/${a}/pin`),unpinConversation:a=>$e.post(`/chat/conversations/${a}/unpin`),muteConversation:a=>$e.post(`/chat/conversations/${a}/mute`),unmuteConversation:a=>$e.post(`/chat/conversations/${a}/unmute`),getContacts:()=>($E(),$e.get("/chat/contacts")),getMessages:a=>$e.get(`/chat/conversations/${a}/messages`),sendMessage:(a,r)=>$e.post(`/chat/conversations/${a}/messages`,r),markRead:a=>$e.post(`/chat/conversations/${a}/read`)},oN={getClients:async(a={})=>{try{return await $e.get("/clients",a)}catch(r){throw console.error("Error fetching clients:"),r}},getClient:async a=>{try{return await $e.get(`/clients/${a}`)}catch(r){throw console.error("Error fetching client:"),r}},createClient:async a=>{try{return await $e.post("/clients",a)}catch(r){throw console.error("Error creating client:"),r}},updateClient:async(a,r)=>{try{return await $e.put(`/clients/${a}`,r)}catch(i){throw console.error("Error updating client:"),i}},deleteClient:async a=>{try{return await $e.delete(`/clients/${a}`)}catch(r){throw console.error("Error deleting client:"),r}}},Lc={getProjects:async(a={})=>{try{return await $e.get("/projects",a)}catch(r){throw console.error("Error fetching projects:"),r}},getAll:async(a={})=>Lc.getProjects(a),getProject:async a=>{try{return await $e.get(`/projects/${a}`)}catch(r){throw console.error("Error fetching project:"),r}},createProject:async a=>{try{return await $e.post("/projects",a)}catch(r){throw console.error("Error creating project:"),r}},updateProject:async(a,r)=>{try{return await $e.put(`/projects/${a}`,r)}catch(i){throw console.error("Error updating project:"),i}},deleteProject:async a=>{try{return await $e.delete(`/projects/${a}`)}catch(r){throw console.error("Error deleting project:"),r}},getProjectsByClient:async a=>{try{return await $e.get(`/clients/${a}/projects`)}catch(r){throw console.error("Error fetching client projects:"),r}},getProjectStats:async()=>{try{const a=await $e.get("/projects");if(a.success&&a.data&&a.data.data){const r=a.data.data,i=r.length,o=r.filter(p=>p.status==="in_progress").length,c=r.filter(p=>p.status==="completed").length,m=r.filter(p=>p.status==="on_hold").length,u=r.filter(p=>p.status==="not_started").length,g=r.reduce((p,y)=>p+(parseFloat(y.budget)||0),0),x=r.reduce((p,y)=>p+(parseFloat(y.actual_cost)||0),0);return{total:i,active:o,completed:c,onHold:m,notStarted:u,totalBudget:g,totalActual:x,budgetUtilization:g>0?Math.round(x/g*100):0}}return{total:0,active:0,completed:0,onHold:0,notStarted:0,totalBudget:0,totalActual:0,budgetUtilization:0}}catch(a){throw console.error("Error fetching project stats:"),a}}},Kv={getTasks:async(a={})=>{try{return await $e.get("/tasks",a)}catch(r){throw console.error("Error fetching tasks:"),r}},getTasksHierarchy:async(a={})=>{try{return await $e.get("/tasks/hierarchy",a)}catch(r){throw console.error("Error fetching tasks hierarchy:"),r}},getTask:async a=>{try{return await $e.get(`/tasks/${a}`)}catch(r){throw console.error("Error fetching task:"),r}},createTask:async a=>{try{return await $e.post("/tasks",a)}catch(r){throw console.error("Error creating task:"),r}},updateTask:async(a,r)=>{try{return await $e.put(`/tasks/${a}`,r)}catch(i){throw console.error("Error updating task:"),i}},deleteTask:async a=>{try{return await $e.delete(`/tasks/${a}`)}catch(r){throw console.error("Error deleting task:"),r}},toggleTask:async a=>{try{return await $e.patch(`/tasks/${a}/toggle`)}catch(r){throw console.error("Error toggling task:"),r}},getTasksByProject:async a=>{try{return await $e.get("/tasks",{project_id:a})}catch(r){throw console.error("Error fetching project tasks:"),r}},getTasksByClient:async a=>{try{return await $e.get("/tasks",{client_id:a})}catch(r){throw console.error("Error fetching client tasks:"),r}}};function cN({isClientView:a=!1,clientId:r=null,onNavigateToProject:i=null,onNavigateToTask:o=null,onNavigateToClient:c=null,onNavigateToInvoice:m=null}){const{user:u}=ts(),[g,x]=f.useState([]),[p,y]=f.useState(null),[v,w]=f.useState([]),[N,D]=f.useState(""),[b,E]=f.useState("all"),[_,M]=f.useState(""),[k,C]=f.useState(!1),[j,O]=f.useState(!1),[L,R]=f.useState(!1),[H,z]=f.useState(""),[V,Z]=f.useState([]),[I,ue]=f.useState([]),[X,P]=f.useState([]),[$,F]=f.useState(!0),ne=f.useRef(null);f.useEffect(()=>{const J=()=>{!(window.innerWidth<768)&&p&&F(!0)};return J(),window.addEventListener("resize",J),()=>window.removeEventListener("resize",J)},[p]);const[T,B]=f.useState(!1),[ee,te]=f.useState([]),[ye,ge]=f.useState(""),[K,re]=f.useState(""),[je,Ae]=f.useState(0),[ie,we]=f.useState(0),_e=f.useRef(null),me=f.useCallback(async()=>{try{const be=(await cr.getConversations())?.data||[],pe=a&&r?be.filter(ke=>ke.participants?.some(Re=>Re.type==="client"&&Re.id==r)):be;x(pe),!p&&pe.length>0&&y(pe[0])}catch{console.error("Failed to load conversations")}},[a,r,p]),Se=f.useCallback(async J=>
709{if(J)try{const be=await cr.getMessages(J);w(be?.data||[])}catch{console.error("Failed to load messages for conversation:")}},[]),Pe=f.useCallback(async()=>{try{const be=(await cr.getContacts())?.data||[],pe=be.filter(Re=>Re.type==="user"),ke=be.filter(Re=>Re.type==="client");Z(pe),ue(ke)}catch{console.error("Failed to load participants"),Z([]),ue([])}},[]),pt=f.useCallback(async(J,be="")=>{if(!p)return[];try{const pe=p.participants?.some(He=>He.type==="client"),ke=p.participants?.filter(He=>He.type==="client")||[];let Re=[];switch(J){case"project":if(pe&&ke.length>0)for(const He of ke)try{const st=(await Lc.getProjectsByClient(He.id))?.data?.data||[];Re.push(...st.map(rt=>({id:rt.id,name:rt.name,type:"project",subtitle:`Client: ${He.name}`,status:rt.status})))}catch{console.error("Error fetching projects for client")}else try{Re=((await Lc.getProjects())?.data?.data||[]).map(st=>({id:st.id,name:st.name,type:"project",subtitle:st.client_name||"No client",status:st.status}))}catch{console.error("Error fetching all projects:")}break;case"task":if(pe&&ke.length>0)for(const He of ke)try{const st=(await Kv.getTasksByClient(He.id))?.data?.data||[];Re.push(...st.map(rt=>({id:rt.id,name:rt.title||rt.name,type:"task",subtitle:`Project: ${rt.project_name||"Unknown"}`,status:rt.status})))}catch{console.error("Error fetching tasks for client")}else try{Re=((await Kv.getTasks())?.data?.data||[]).map(st=>({id:st.id,name:st.title||st.name,type:"task",subtitle:`Project: ${st.project_name||"Unknown"}`,status:st.status}))}catch{console.error("Error fetching all tasks:")}break;case"invoice":if(pe&&ke.length>0)for(const He of ke)try{const st=(await xt.getAll({client_id:He.id}))?.data?.data||[];Re.push(...st.map(rt=>({id:rt.id,name:rt.number||`Invoice #${rt.id}`,type:"invoice",subtitle:`${rt.status} - $${rt.total||"0"}`,status:rt.status})))}catch{console.error("Error fetching invoices for client ")}else try{Re=((await xt.getAll())?.data?.data||[]).map(st=>({id:st.id,name:st.number||`Invoice #${st.id}`,type:"invoice",subtitle:`${st.client_name||"No client"} - $${st.total||"0"}`,status:st.status}))}catch{console.error("Error fetching all invoices:")}break;case"client":if(!pe)try{Re=((await oN.getClients())?.data?.data||[]).map(st=>({id:st.id,name:st.name,type:"client",subtitle:st.email||"No email",status:"active"}))}catch{console.error("Error fetching all clients:")}break}return be&&(Re=Re.filter(He=>He.name.toLowerCase().includes(be.toLowerCase()))),Re.reduce((He,tt)=>{const st=`${tt.type}-${tt.id}`;return He.find(rt=>`${rt.type}-${rt.id}`===st)||He.push(tt),He},[]).slice(0,10)}catch{return console.error("Error getting contextual suggestions:"),[]}}
709,[p]);f.useEffect(()=>{me()},[me]),f.useEffect(()=>{p?.id?Se(p.id):w([])},[p,Se]),f.useEffect(()=>{ne.current?.scrollIntoView({behavior:"smooth"})},[v]),f.useEffect(()=>{const J=be=>{T&&_e.current&&!_e.current.contains(be.target)&&B(!1)};return document.addEventListener("mousedown",J),()=>{document.removeEventListener("mousedown",J)}},[T]);const Ve=async()=>{if(X.length===0)return;const J=X.length>1?"group":"direct",be=X.map(pe=>({type:pe.type,id:pe.id}));try{const pe=await cr.createConversation({type:J,participants:be});if(R(!1),P([]),await me(),pe?.data?.id){const ke=(await cr.getConversations())?.data?.find(Re=>Re.id===pe.data.id);ke&&y(ke)}}catch{console.error("Failed to create conversation")}},bt=f.useMemo(()=>{const J=H.toLowerCase(),be=[...V.filter(Re=>Re.id!==u?.id),...I],pe=J?be.filter(Re=>Re.name.toLowerCase().includes(J)):be,ke=new Set(X.map(Re=>`${Re.type}:${Re.id}`));return pe.filter(Re=>!ke.has(`${Re.type}:${Re.id}`))},[H,V,I,X,u]),ds=J=>{const be=`${J.type}:${J.id}`,pe=X.find(ke=>`${ke.type}:${ke.id}`===be);P(pe?X.filter(ke=>`${ke.type}:${ke.id}`!==be):[...X,J])},le=J=>new Date(J).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),Le=J=>{const be=new Date,pe=new Date(J),ke=(be-pe)/(1e3*60*60);return ke<24?le(J):ke<48?"Yesterday":pe.toLocaleDateString("en-US",{month:"short",day:"numeric"})},Ye=J=>{switch(J){case"sending":return e.jsx(xs,{className:"h-3 w-3 text-muted-foreground"});case"delivered":return e.jsx(br,{className:"h-3 w-3 text-muted-foreground"});case"read":return e.jsx(o2,{className:"h-3 w-3 text-primary-mint"});default:return null}},Ne=J=>{switch(J){case"online":return"bg-green-500";case"away":return"bg-yellow-500";case"busy":return"bg-red-500";case"offline":return"bg-gray-400";default:return"bg-gray-400"}},jt=async()=>{if(!(!_.trim()||!p))try{await cr.sendMessage(p.id,{content:_}),M(""),await Se(p.id),window.showAchievement&&window.showAchievement({type:"firstAction",title:"Message Sent! 💬",message:"Great communication keeps projects moving forward!"})}catch{console.error("Failed to send message")}},Wa=async()=>{if(!(!p||!window.confirm("Are you sure you want to delete this conversation? This action cannot be undone.")))try{await cr.deleteConversation(p.id),y(null),await me(),window.showAchievement&&window.showAchievement({type:"firstAction",title:"Conversation Deleted! 🗑️",message:"Conversation has been removed from your view."})}catch{alert("Failed to delete conversation. Please try again.")}},ra=async J=>{if(T){if(J.key==="Escape"){J.preventDefault(),B(!1);return}if(J.key==="ArrowDown"){J.preventDefault(),we(be=>be<ee.length-1?be+1:0);return}if(J.key==="ArrowUp"){J.preventDefault(),we(be=>be>0?be-1:ee.length-1);return}if(J.key==="Tab"||J.key==="Enter"){J.preventDefault(),ee[ie]&&ls(ee[ie]);return}}J.key==="Enter"&&!J.shiftKey&&(J.preventDefault(),jt())},qt=async J=>{const be=J.target.value,pe=J.target.selectionStart;M(be);const Re=be.slice(0,pe).match(/@([a-zA-Z]*):?([a-zA-Z0-9]*)$/);if(Re){const[Kt,He,tt]=Re,st=["project","task","invoice","client"];if(He===""||st.includes(He))if(He==="")re(""),ge(""),te(st.map(rt=>({id:rt,name:rt,type:"type",subtitle:`@${rt}:`,status:"suggestion"}))),B(!0),Ae(pe-Kt.length),we(0);else{re(He),ge(tt);try{const rt=await pt(He,tt);te(rt),B(rt.length>0),Ae(pe-Kt.length),we(0)}catch{B(!1)}}else B(!1)}else B(!1)},ls=J=>{const be=_.slice(0,je),pe=_.slice(_e.current?.selectionStart||_.length);let ke;J.type==="type"?ke=`@${J.name}:`:ke=`@${J.type}:${J.id}`;const Re=be+ke+pe;M(Re),B(!1),setTimeout(()=>{if(_e.current){const Kt=be.length+ke.length;_e.current.focus(),_e.current.setSelectionRange(Kt,Kt)}},0)},Xt=J=>{const be=/@(project|task|invoice|client):(\d+)/g,pe=[];let ke=0,Re;for(;(Re=be.exec(J))!==null;){Re.index>ke&&pe.push(J.slice(ke,Re.index));const[Kt,He,tt]=Re;pe.push(e.jsxs("button",{onClick:()=>_l(He,tt),className:"inline-flex items-center px-2 py-1 mx-1 text-xs font-medium bg-primary-mint/20 text-primary-navy rounded-md hover:bg-primary-mint/30 transition-colors",children:["📎 ",He.charAt(0).toUpperCase()+He.slice(1)," #",tt]},`${He}-${tt}-${Re.index}`)),ke=Re.index+Kt.length}return ke<J.length&&pe.push(J.slice(ke)),pe.length>0?pe:[J]},_l=(J,be)=>{const pe=parseInt(be,10);try{switch(J){case"project":i?(i(pe),window.showAchievement&&window.showAchievement({type:"firstAction",title:"Project Opened! 📁",message:`Navigated to project #${be}`})):console.warn("No navigation handler for projects");break;case"task":o?(o({id:pe}),window.showAchievement&&window.showAchievement({type:"firstAction",title:"Task Opened! ✅",message:`Navigated to task #${be}`})):console.warn("No navigation handler for tasks");break;case"client":c?(c(pe),window.showAchievement&&window.showAchievement({type:"firstAction",title:"Client Opened! 👤",message:`Navigated to client #${be}`})):console.warn("No navigation handler for clients");break;case"invoice":m?(m(pe),window.showAchievement&&window.showAchievement({type:"firstAction",title:"Invoice Opened! 💰",message:`Navigated to invoice #${be}`})):console.warn("No navigation handler for invoices");break;default:console.warn(`Unknown resource type: ${J}`),alert(`Resource type "${J}" is not supported yet.`)}}catch{alert(`Error navigating to ${J} #${be}. Please try again.`)}},Bn=f.useMemo(()=>{let J=g;if(N){const be=N.toLowerCase();J=J.filter(pe=>
709{const ke=pe.name||"",Re=pe.lastMessage?.content||"",Kt=(pe.participants||[]).map(He=>He.name?.toLowerCase()||"");return ke.toLowerCase().includes(be)||Re.toLowerCase().includes(be)||Kt.some(He=>He.includes(be))})}switch(b){case"unread":J=J.filter(be=>(be.unreadCount||0)>0);break;case"clients":J=J.filter(be=>(be.participants||[]).some(pe=>pe.type==="client"));break;case"team":J=J.filter(be=>(be.participants||[]).some(pe=>pe.type==="user")||be.type==="group");break}return J.sort((be,pe)=>{if(be.isPinned&&!pe.isPinned)return-1;if(!be.isPinned&&pe.isPinned)return 1;const ke=be.lastMessage?.timestamp?new Date(be.lastMessage.timestamp).getTime():0;return(pe.lastMessage?.timestamp?new Date(pe.lastMessage.timestamp).getTime():0)-ke})},[g,N,b]),Cr=({conversation:J})=>{const be=p?.id===J.id,pe=(J.participants||[]).filter(tt=>!(tt.type==="user"&&tt.id===u?.id)),ke=J.type==="group"?J.title||J.name||"Group Chat":pe.map(tt=>tt.name||"Unknown").join(", ")||"Chat",Re=J.type==="group"?"GT":(pe[0]?.name||"U").split(" ").map(tt=>tt[0]).join("").slice(0,2).toUpperCase(),Kt="offline",He=()=>{y(J),F(!1)};return e.jsx("div",{className:`p-3 cursor-pointer transition-colors hover:bg-gray-50 dark:hover:bg-gray-700/80 border-b border-gray-200 dark:border-gray-700 last:border-b-0 ${be?"bg-gray-50 dark:bg-gray-700 border-r-2 border-r-primary-mint":"bg-white dark:bg-gray-800"}`,onClick:He,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-10 h-10 bg-primary-navy rounded-full flex items-center justify-center text-white font-medium text-sm",children:Re}),J.type==="direct"&&e.jsx("div",{className:`absolute -bottom-1 -right-1 w-3 h-3 rounded-full border-2 border-background ${Ne(Kt)}`}),J.isPinned&&e.jsx(IS,{className:"absolute -top-1 -right-1 w-3 h-3 text-primary-mint bg-background rounded-full p-0.5"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("h4",{className:"font-medium text-gray-900 dark:text-white truncate",children:ke}),e.jsxs("div",{className:"flex items-center gap-2",children:[J.unreadCount>0&&e.jsx(ze,{className:"bg-primary-mint text-white text-xs",children:J.unreadCount}),e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:J.lastMessage?.timestamp?Le(J.lastMessage.timestamp):""})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[J.lastMessage?.senderId===u?.id&&Ye(J.lastMessage?.status),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 truncate",children:J.lastMessage?.content||""})]}),e.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[J.isMuted&&e.jsx(S4,{className:"h-3 w-3 text-gray-400"}),J.type==="group"&&e.jsx(yt,{className:"h-3 w-3 text-gray-400"})]})]})]})})},Na=({message:J,isOwn:be,contactName:pe})=>e.jsx("div",{className:`flex ${be?"justify-end":"justify-start"} mb-3`,children:e.jsxs("div",{className:`max-w-[85%] md:max-w-[70%] ${be?"order-2":"order-1"}`,children:[!be&&e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{className:"w-5 h-5 bg-primary-navy rounded-full flex items-center justify-center text-white text-xs font-medium",children:(pe||"U").split(" ").map(ke=>ke[0]).join("").slice(0,2)}),e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:pe})]}),e.jsxs("div",{className:`p-2.5 md:p-3 rounded-lg ${be?"bg-primary-mint text-white":"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 border border-gray-200 dark:border-gray-600 shadow-sm"}`,children:[e.jsx("p",{className:"text-sm leading-relaxed",children:Xt(J.content)}),J.attachments&&J.attachments.length>0&&e.jsx("div",{className:"mt-2 pt-2 border-t border-primary-navy/20",children:J.attachments.map((ke,Re)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(kc,{className:"h-3 w-3"}),e.jsx("span",{children:ke.name}),e.jsxs("span",{className:"text-opacity-70",children:["(",ke.size,")"]})]},Re))})]}),e.jsxs("div",{className:`flex items-center gap-1 mt-1 ${be?"justify-end":"justify-start"}`,children:[e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:le(J.timestamp)}),be&&Ye(J.status)]})]})}),en=()=>{F(!0),y(null)};return e.jsxs("div",{className:`flex ${a?"h-[600px]":"h-full"} bg-white dark:bg-gray-900`,children:[e.jsxs("div",{className:`w-full md:w-80 border-r border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 flex flex-col ${$?"flex":"hidden md:flex"}`,children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("h1",{className:"text-lg font-bold text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(Fa,{className:"h-5 w-5 text-primary-mint"}),"Messages"]}),!a&&e.jsx("div",{className:"flex items-center gap-1",children:e.jsx(G,{variant:"ghost",size:"sm",onClick:async()=>{R(!0),await Pe()},className:"hover:bg-gray-100",children:e.jsx(Rt,{className:"h-4 w-4 text-gray-600"})})})]}),e.jsxs("div",{className:"relative mb-3",children:[e.jsx(Un,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),e.jsx(he,{placeholder:"Search conversations...",value:N,onChange:J=>D(J.target.value),className:"pl-10 bg-white border-gray-200 focus:border-primary-mint focus:ring-primary-mint"})]}),e.jsx("div",{className:"flex gap-1 overflow-x-auto",children:[{key:"all",label:"All",icon:Fa},{key:"unread",label:"Unread",icon:l0},{key:"clients",label:"Clients",icon:yt},{key:"team",label:"Team",icon:d4}].map(({key:J,label:be,icon:pe})=>e.jsxs("button",{onClick:()=>E(J),className:`px-3 py-1 rounded-full text-xs font-medium transition-colors flex items-center gap-1 whitespace-nowrap ${b===J?"bg-primary-mint text-white":"text-gray-600 hover:text-gray-900 hover:bg-gray-100"}`,children:[e.jsx(pe,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden sm:inline",children:be})]},J))})]}),e.jsx("div",{className:"flex-1 overflow-y-auto bg-white dark:bg-gray-800",children:Bn.length===0?e.jsx("div",{className:"flex items-center justify-center h-full p-8",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Fa,{className:"h-10 w-10 mx-auto mb-3 text-primary-mint opacity-50"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:N?"No conversations foun
709d":"No conversations yet"}),!N&&e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Click + to start your first conversation"})]})}):Bn.map(J=>e.jsx(Cr,{conversation:J},J.id))}),e.jsx("div",{className:"p-3 border-t border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800",children:e.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-500 dark:text-gray-400",children:[e.jsxs("span",{children:[Bn.length," conversations"]}),e.jsxs("span",{children:[g.reduce((J,be)=>J+(be.unreadCount||0),0)," unread"]})]})})]}),e.jsx("div",{className:`flex-1 flex flex-col bg-white dark:bg-gray-800 ${$?"hidden md:flex":"flex"}`,children:p?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(G,{variant:"ghost",size:"sm",className:"md:hidden p-1",onClick:en,children:e.jsx(ns,{className:"h-4 w-4"})}),e.jsx("div",{className:"relative",children:(()=>{const J=(p.participants||[]).filter(pe=>!(pe.type==="user"&&pe.id===u?.id)),be=p.type==="group"?"GT":(J[0]?.name||"U").split(" ").map(pe=>pe[0]).join("").slice(0,2).toUpperCase();return e.jsx("div",{className:"w-8 h-8 bg-primary-navy rounded-full flex items-center justify-center text-white font-medium text-sm",children:be})})()}),e.jsxs("div",{children:[(()=>{const J=(p.participants||[]).filter(pe=>!(pe.type==="user"&&pe.id===u?.id)),be=p.type==="group"?p.title||p.name||"Group Chat":J.map(pe=>pe.name||"Unknown").join(", ")||"Chat";return e.jsx("h3",{className:"font-medium text-gray-900 dark:text-white text-sm truncate",children:be})})(),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:p.type==="group"?`${p.participants?.length||0} members`:"online"})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(G,{variant:"ghost",size:"sm",onClick:Wa,className:"text-red-500 hover:text-red-700 hover:bg-red-50",children:e.jsx($n,{className:"h-4 w-4"})})})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 bg-white dark:bg-gray-900",children:[v.length===0?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Fa,{className:"h-12 w-12 mx-auto mb-3 text-primary-mint opacity-50"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-1",children:"Start the conversation!"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Great communication is the foundation of successful projects."})]})}):v.map(J=>{const be=J.senderType==="user"&&J.senderId===u?.id,ke=(p.participants||[]).find(Re=>J.senderType==="user"?Re.type==="user"&&Re.id===J.senderId:Re.type==="client"&&Re.id===J.senderId)?.name||"User";return e.jsx(Na,{message:J,isOwn:be,contactName:ke},J.id)}),k&&e.jsx("div",{className:"flex justify-start mb-4",children:e.jsx("div",{className:"bg-muted p-3 rounded-lg",children:e.jsxs("div",{className:"flex space-x-1",children:[e.jsx("div",{className:"w-2 h-2 bg-muted-foreground rounded-full animate-pulse"}),e.jsx("div",{className:"w-2 h-2 bg-muted-foreground rounded-full animate-pulse",style:{animationDelay:"0.2s"}}),e.jsx("div",{className:"w-2 h-2 bg-muted-foreground rounded-full animate-pulse",style:{animationDelay:"0.4s"}})]})})}),e.jsx("div",{ref:ne})]}),e.jsx("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800",children:e.jsxs("div",{className:"flex items-end gap-2 relative",children:[e.jsx(G,{variant:"ghost",size:"sm",className:"mb-1 hidden md:flex",children:e.jsx(kc,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(he,{ref:_e,placeholder:window.innerWidth<768?"Type a message...":"Type a message... (Use @ to mention projects, tasks, invoices, etc.)",value:_,onChange:qt,onKeyDown:ra,className:"resize-none text-sm"}),T&&ee.length>0&&e.jsxs("div",{className:"absolute bottom-full left-0 right-0 mb-2 bg-popover border border-border rounded-lg shadow-lg max-h-48 md:max-h-64 overflow-y-auto z-50",children:[e.jsx("div",{className:"p-2 border-b border-border",children:e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{children:"💡"}),e.jsx("span",{className:"truncate",children:K?`@${K}:`:"Choose type:"})]})}),ee.map((J,be)=>e.jsx("div",{className:`p-2 md:p-3 cursor-pointer transition-colors border-b border-border last:border-b-0 ${be===ie?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,onClick:()=>ls(J),children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-medium bg-primary-mint/20 text-primary-navy px-1.5 py-0.5 rounded",children:J.type}),e.jsx("span",{className:"font-medium truncate text-sm",children:J.name})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:J.subtitle})]}),J.status&&J.type!=="type"&&e.jsx("div",{className:"ml-2",children:e.jsx("span",{className:`text-xs px-2 py-1 rounded-full ${J.status==="completed"||J.status==="paid"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":J.status==="in_progress"||J.status==="pending"?"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200":"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200"}`,children:J.status})})]})},`${J.type}-${J.id}`)),e.jsx("div",{className:"p-2 border-t border-border",children:e.jsx("div",{className:"text-xs text-muted-foreground",children:"↑↓ Navigate • Tab/Enter Select • Esc Cancel"})})]})]}),e.jsx(G,{onClick:jt,disabled:!_.trim(),className:"mb-1 bg-primary-mint hover:bg-primary-mint/90 text-white",children:e.jsx(Ja,{className:"h-4 w-4"})})]})})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center bg-white dark:bg-gray-900",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Fa,{className:"h-16 w-16 mx-auto mb-4 text-primary-mint opacity-30"}),e.jsx("h3",{className:"text-xl font-medium text-gray-900 dark:text-white mb-2",children:"Start the conversation!"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 max-w-md",children:"Great communication is the foundation of successful projects."}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-2",children:"Select a conversation or start a new one!"})]})})}),L&&e.jsx("div",{className:"fixed inset-0 bg-black/40 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"border border-gray-200 rounded-lg w-full max-w-lg p-4 max-h-[90vh] flex flex-col bg-white shadow-xl",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Start new conversation"}),e.jsx(G,{variant:"ghost",size:"sm",onClick:()=>R(!1),children:"Close"})]}),e.jsx(he,{placeholder:"Search people or clients...",value:H,onChange:J=>z(J.target.value),className:"mb-3"}),e.jsx("div",{className:"max-h-48 md:max-h-64 overflow-y-auto mb-3 flex-1",children:(()=>{const J=bt.filter(pe=>pe.type==="user"),be=bt.filter(pe=>pe.type==="client");return e.jsxs("div",{className:"space-y-4",children:[J.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 px-2",children:[e.jsx(yt,{className:"h-4 w-4 text-primary-mint"}),e.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Team Members"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",J.length,")"]})]}),e.jsx("div",{className:"space-y-2",children:J.map(pe=>e.jsxs("div",{className:`flex items-center justify-between p-2 rounded border ${X.find(ke=>ke.type===pe.type&&ke.id===pe.id)?"bg-primary-mint/10 border-primary-mint":"border-border hover:border-primary-mint/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-primary-navy text-white flex items-center justify-center text-xs",children:pe.name.split(" ").map(ke=>ke[0]).join("").slice(0,2)}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:pe.name}),e.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),"Colleague"]})]})]}),e.jsx(G,{variant:"secondary",size:"sm",onClick:()=>ds(pe),children:X.find(ke=>ke.type===pe.type&&ke.id===pe.id)?"Remove":"Add"})]},`${pe.type}:${pe.id}`))})]}),be.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 px-2",children:[e.jsx(Js,{className:"h-4 w-4 text-blue-500"}),e.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Clients"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",be.length,")"]})]}),e.jsx("div",{className:"space-y-2",children:be.map(pe=>e.jsxs("div",{className:`flex items-center justify-between p-2 rounded border ${X.find(ke=>ke.type===pe.type&&ke.id===pe.id)?"bg-blue-50 border-blue-300 dark:bg-blue-900/20 dark:border-blue-700":"border-border hover:border-blue-300"}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-blue-600 text-white flex items-center justify-center text-xs",children:pe.name.split(" ").map(ke=>ke[0]).join("").slice(0,2)}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:pe.name}),e.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),"Client"]})]})]}),e.jsx(G,{variant:"secondary",size:"sm",onClick:()=>ds(pe),children:X.find(ke=>ke.type===pe.type&&ke.id===pe.id)?"Remove":"Add"})]},`${pe.type}:${pe.id}`))})]}),bt.length===0&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:H?"No matching people found":"No people available"}),H&&e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Try adjusting your search terms"})]})]})})()}),X.length>0&&e.jsxs("div",{className:"border-t border-border pt-3 mb-3",children:[e.jsx("div",{className:"flex items-center gap-2 mb-2",children:e.jsxs("span",{className:"text-sm font-medium text-foreground",children:["Selected (",X.length,"):"]})}),e.jsx("div",{className:"flex flex-wrap gap-2",children:X.map(J=>e.jsxs("div",{className:`flex items-center gap-2 px-3 py-1 rounded-full text-xs font-medium ${J.type==="user"?"bg-primary-mint/20 text-primary-navy":"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-200"}`,children:[e.jsx("span",{children:J.name}),e.jsx("button",{onClick:()=>ds(J),className:"ml-1 hover:bg-black/10 rounded-full p-0.5",children:"×"})]},`selected-${J.type}-${J.id}`))})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:X.length===0?"N
709o participants selected":`${X.length} selected`}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(G,{variant:"ghost",onClick:()=>{P([])},disabled:X.length===0,children:"Clear"}),e.jsx(G,{onClick:Ve,disabled:X.length===0,className:"bg-primary-mint text-primary-navy hover:bg-primary-mint/90",children:"Start"})]})]})]})})]})}const bf={getSettings:async()=>{try{return await $e.get("/company/settings")}catch(a){throw a}},updateSettings:async a=>{try{return await $e.put("/company/settings",a)}catch(r){throw r}}},qm=[{value:"BE",label:"🇧🇪 Belgium",vatRates:[21,12,6,0]},{value:"NL",label:"🇳🇱 Netherlands",vatRates:[21,9,0]}],IE=[{value:"nl",label:"Nederlands"},{value:"fr",label:"Français"},{value:"en",label:"English"}],FE=["piece","hour","day","project","month","year","kg","liter","meter"],BE=[7,14,30,45,60,90];function qE({invoice:a=null,preSelectedClientId:r=null,onSave:i,onCancel:o,onPreview:c}){const[m,u]=f.useState(!1),[g,x]=f.useState([]),[p,y]=f.useState([]),[v,w]=f.useState([]),[N,D]=f.useState(null),[b,E]=f.useState({client_id:a?.client?.id||r||"",project_id:a?.project?.id||"",template_id:a?.template?.id||"",country:a?.country||"BE",language:a?.language||"nl",currency:a?.currency||"EUR",issue_date:a?.issue_date||new Date().toISOString().split("T")[0],payment_terms:a?.payment_terms||30,notes:a?.notes||"",internal_notes:a?.internal_notes||"",items:a?.items||[{description:"",quantity:1,unit:"hour",unit_price:0,vat_rate:.21,category:"development_services"}]}),[_,M]=f.useState({subtotal:0,tax_amount:0,total_amount:0});f.useEffect(()=>{k(),j(),O(),b.client_id&&C(b.client_id)},[]),f.useEffect(()=>{b.client_id?C(b.client_id):(y([]),b.project_id&&R("project_id",""))},[b.client_id]),f.useEffect(()=>{L()},[b.items]),f.useEffect(()=>{r&&!a&&r!==b.client_id&&H(r)},[r,a,b.client_id,g,v]);const k=async()=>{try{const T=await oN.getClients();T.success&&T.data&&T.data.data?x(T.data.data):Array.isArray(T.data)?x(T.data):Array.isArray(T)&&x(T)}catch{console.error("Failed to load clients:")}},C=async T=>{try{const B=await Lc.getProjectsByClient(T);B.success&&B.data||Array.isArray(B.data)?y(B.data):Array.isArray(B)?y(B):y([])}catch{console.error("Failed to load projects for client:"),y([])}},j=async()=>{try{const T=await xt.getTemplates();w(T.data||[])}catch{console.error("Failed to load templates:")}},O=async()=>{try{const T=await bf.getSettings();T.success&&T.data&&(D(T.data),E(B=>({...B,country:T.data.country||B.country,currency:"EUR",payment_terms:B.payment_terms||(T.data.country==="BE"?30:14)})))}catch{console.error("Failed to load company settings:")}},L=()=>{let T=0,B=0;b.items.forEach(ee=>{const te=ee.quantity*ee.unit_price,ye=te*ee.vat_rate;T+=te,B+=ye}),M({subtotal:Math.round(T*100)/100,tax_amount:Math.round(B*100)/100,total_amount:Math.round((T+B)*100)/100})},R=(T,B)=>{E(ee=>({...ee,[T]:B}))},H=async T=>{const B=g.find(ee=>ee.id==T);if(B){if(E(ee=>({...ee,client_id:T,country:B.country||ee.country,language:B.country==="NL"||B.country==="BE"?"nl":ee.language})),B.country&&(await z(B.country),v.length>0)){const ee=v.find(te=>te.country===B.country&&te.is_default);ee&&R("template_id",ee.id)}}else R("client_id",T)},z=async T=>{if(!v.find(ee=>ee.country===T&&ee.is_default)&&N)try{const ee={name:`Default ${T} Template`,country:T,language:"nl",is_default:!0,show_logo:!0};(await xt.createTemplateWithCompanyData(ee)).data&&await j()}catch{console.error("Failed to create default template:")}},V=(T,B,ee)=>{const te=[...b.items];te[T]={...te[T],[B]:ee},R("items",te)},Z=()=>{const ee={description:"",quantity:1,unit:"hour",unit_price:0,vat_rate:qm.find(te=>te.value===b.country)?.vatRates[0]/100||.21,category:"development_services"};R("items",[...b.items,ee])},I=T=>{if(b.items.length>1){const B=b.items.filter((ee,te)=>te!==T);R("items",B)}},ue=async(T=!0)=>{u(!0);try{const B={...b,..._};a?await xt.update(a.id,B):await xt.create(B),i&&i()}catch{console.error("Failed to save invoice:")}finally{u(!1)}},X=async()=>{if(a&&a.status==="draft"){u(!0);try{await xt.send(a.id),i&&i()}catch{console.error("Failed to send invoice:")}finally{u(!1)}}},P=T=>new Intl.NumberFormat("nl-NL",{style:"currency",currency:b.currency}).format(T),$=()=>qm.find(B=>B.value===b.country)?.vatRates.map(B=>({value:B/100,label:`${B}%`}))||[],F=g.find(T=>T.id===parseInt(b.client_id)),ne=p;return e.jsxs("div",{className:"max-w-6xl mx-auto p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold text-foreground flex items-center gap-2",children:[e.jsx(Ot,{className:"h-8 w-8 text-primary-mint"}),a?"Edit Invoice":"New Invoice"]}),a&&e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx("span",{className:"text-muted-foreground",children:"Invoice:"}),e.jsx(ze,{variant:"outline",children:a.invoice_number}),e.jsx(ze,{className:`ml-2 ${a.status==="draft"?"bg-gray-100 text-gray-800":a.status==="sent"?"bg-blue-100 text-blue-800":a.status==="paid"?"bg-green-100 text-green-800":"bg-red-100 text-red-800"}`,children:a.status})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[c&&e.jsxs(G,{variant:"outline",onClick:c,children:[e.jsx(rs,{className:"h-4 w-4 mr-2"}),"Preview"]}),e.jsxs(G,{variant:"outline",onClick:o,children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Cancel"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs(Ce,{className:"p-6",children:[e.jsxs("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[e.jsx(Js,{className:"h-5 w-5 text-primary-mint"}),"Invoice Details"]}
709),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Client *"}),e.jsxs("select",{value:b.client_id,onChange:T=>H(T.target.value),className:"w-full px-3 py-2 border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring bg-background",required:!0,children:[e.jsx("option",{value:"",children:"Select a client"}),g.map(T=>e.jsxs("option",{value:T.id,children:[T.name," (",T.contact_person,")"]},T.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Project"}),e.jsxs("select",{value:b.project_id,onChange:T=>R("project_id",T.target.value),className:"w-full px-3 py-2 border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring bg-background",disabled:!b.client_id,children:[e.jsx("option",{value:"",children:b.client_id?"No project":"Select a client first"}),ne.map(T=>e.jsx("option",{value:T.id,children:T.name},T.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Country *"}),e.jsx("select",{value:b.country,onChange:T=>R("country",T.target.value),className:"w-full px-3 py-2 border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring bg-background",required:!0,children:qm.map(T=>e.jsx("option",{value:T.value,children:T.label},T.value))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Language *"}),e.jsx("select",{value:b.language,onChange:T=>R("language",T.target.value),className:"w-full px-3 py-2 border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring bg-background",required:!0,children:IE.map(T=>e.jsx("option",{value:T.value,children:T.label},T.value))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Issue Date *"}),e.jsx(he,{type:"date",value:b.issue_date,onChange:T=>R("issue_date",T.target.value),required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Payment Terms *"}),e.jsx("select",{value:b.payment_terms,onChange:T=>R("payment_terms",parseInt(T.target.value)),className:"w-full px-3 py-2 border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring bg-background",required:!0,children:BE.map(T=>e.jsxs("option",{value:T,children:[T," days"]},T))})]})]}),v.length>0&&e.jsxs("div",{className:"mt-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Template"}),e.jsxs("select",{value:b.template_id,onChange:T=>R("template_id",T.target.value),className:"w-full px-3 py-2 border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring bg-background",children:[e.jsx("option",{value:"",children:"Default template"}),v.filter(T=>T.country===b.country).map(T=>e.jsx("option",{value:T.id,children:T.name},T.id))]})]})]}),e.jsxs(Ce,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[e.jsx(s2,{className:"h-5 w-5 text-primary-mint"}),"Invoice Items"]}),e.jsxs(G,{onClick:Z,variant:"outline",size:"sm",children:[e.jsx(Rt,{className:"h-4 w-4 mr-2"}),"Add Item"]})]}),e.jsx("div",{className:"space-y-4",children:b.items.map((T,B)=>e.jsxs("div",{className:"border border-border rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["Item #",B+1]}),b.items.length>1&&e.jsx(G,{variant:"ghost",size:"sm",onClick:()=>I(B),className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:e.jsx($n,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-6 gap-3",children:[e.jsxs("div",{className:"lg:col-span-2",children:[e.jsx("label",{className:"block text-xs font-medium mb-1",children:"Description *"}),e.jsx(he,{value:T.description,onChange:ee=>V(B,"description",ee.target.value),placeholder:"Service or product description",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1",children:"Quantity *"}),e.jsx(he,{type:"number",step:"0.01",min:"0.01",value:T.quantity,onChange:ee=>V(B,"quantity",parseFloat(ee.target.value)||0),required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1",children:"Unit"}),e.jsx("select",{value:T.unit,onChange:ee=>V(B,"unit",ee.target.value),className:"w-full px-2 py-1.5 text-sm border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring bg-background",children:FE.map(ee=>e.jsx("option",{value:ee,children:ee},ee))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1",children:"Unit Price *"}),e.jsx(he,{type:"number",step:"0.01",min:"0",value:T.unit_price===0?"":T.unit_price,onChange:ee=>V(B,"unit_price",parseFloat(ee.target.value)||0),placeholder:"0.00",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1",children:"VAT Rate"}),e.jsx("select",{value:T.vat_rate,onChange:ee=>V(B,"vat_rate",parseFloat(ee.target.value)),className:"w-full px-2 py-1.5 text-sm border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring bg-background",children:$().map(ee=>e.jsx("option",{value:ee.value,children:ee.label},ee.value))})]})]}),e.jsxs("div",{className:"mt-3 pt-3 border-t border-border",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{children:"Line Total (excl. VAT):"}),e.jsx("span",{className:"font-medium",children:P(T.quantity*T.unit_price)})]}),e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsxs("span",{children:["VAT (",(T.vat_rate*100).toFixed(0),"%):"]}),e.jsx("span",{className:"font-medium",children:P(T.quantity*T.unit_price*T.vat_rate)})]}),e.jsxs("div",{className:"flex justify-between text-sm font-semibold border-t pt-1 mt-1",children:[e.jsx("span",{children:"Line Total (incl. VAT):"}),e.jsx("span",{children:P(T.quantity*T.unit_price*(1+T.vat_rate))})]})]})]},B))})]}),e.jsxs(Ce,{className:"p-6",children:[e.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Notes"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Client Notes"}),e.jsx("textarea",{value:b.notes,onChange:T=>R("notes",T.target.value),className:"w-full px-3 py-2 border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring bg-background resize-none",rows:3,placeholder:"Notes visible to the client"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Internal Notes"}),e.jsx("textarea",{value:b.internal_notes,onChange:T=>R("internal_notes",T.target.value),className:"w-full px-3 py-2 border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring bg-background resize-none",rows:3,placeholder:"Internal notes (not visible to client)"})]})]})]})]}),e.jsxs("div",{className:"space-y-6",children:[F&&e.jsxs(Ce,{className:"p-4",children:[e.jsxs("h3",{className:"font-semibold mb-3 flex items-center gap-2",children:[e.jsx(nt,{className:"h-4 w-4 text-primary-mint"}),"Client Information"]}),e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsx("div",{children:e.jsx("span",{className:"font-medium",children:F.name})}),e.jsx("div",{children:F.contact_person}),e.jsx("div",{children:F.email}),e.jsx("div",{children:F.phone}),e.jsxs("div",{className:"pt-2 border-t",children:[e.jsx("div",{children:F.address}),e.jsxs("div",{children:[F.postal_code," ",F.city]}),e.jsx("div",{children:F.country})]}),F.vat_number&&e.jsxs("div",{className:"pt-2 border-t",children:[e.jsx("span",{className:"font-medium",children:"VAT:"})," ",F.vat_number]})]})]}),e.jsxs(Ce,{className:"p-4",children:[e.jsxs("h3",{className:"font-semibold mb-3 flex items-center gap-2",children:[e.jsx(A2,{className:"h-4 w-4 text-primary-mint"}),"Invoice Totals"]}),e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Subtotal (excl. VAT):"}),e.jsx("span",{className:"font-medium",children:P(_.subtotal)})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"VAT:"}),e.jsx("span",{className:"font-medium",children:P(_.tax_amount)})]}),e.jsxs("div",{className:"flex justify-between text-lg font-bold pt-2 border-t",children:[e.jsx("span",{children:"Total (incl. VAT):"}),e.jsx("span",{children:P(_.total_amount)})]})]}),e.jsxs("div",{className:"mt-4 pt-4 border-t space-y-2 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Due Date:"}),e.jsx("span",{children:b.issue_date&&b.payment_terms?new Date(new Date(b.issue_date).getTime()+b.payment_terms*24*60*60*1e3).toLocaleDateString("nl-NL"):"Not set"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Payment Terms:"}),e.jsxs("span",{children:[b.payment_terms," days"]})]})]})]}),e.jsx(Ce,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs(G,{onClick:()=>ue(!0),disabled:m||!b.client_id,className:"w-full bg-primary-mint hover:bg-primary-mint/90 text-primary-navy",children:[e.jsx(Nr,{className:"h-4 w-4 mr-2"}),m?"Saving...":a?"Update Invoice":"Save Draft"]}),a&&a.status==="draft"&&e.jsxs(G,{onClick:X,disabled:m,variant:"outline",className:"w-full",children:[e.jsx(Ja,{className:"h-4 w-4 mr-2"}),"Send Invoice"]})]})})]})]})]})}const HE=({invoice:a,action:r,isOpen:i,onClose:o,onConfirm:c,isLoading:m=!1})=>{const[u,g]=f.useState(""),x=_=>new Date(_).toLocaleDateString("nl-NL",{year:"numeric",month:"long",day:"numeric"}),p=(_,M="EUR")=>{const k=parseFloat(_);return isNaN(k)?new Intl.NumberFormat("nl-NL",{style:"currency",currency:M,minimumFractionDigits:2,maximumFractionDigits:2}).format(0):new Intl.NumberFormat("nl-NL",{style:"currency",currency:M,minimumFractionDigits:2,maximumFractionDigits:2}).format(k)},y=_=>{switch(_){case"BE":return"🇧🇪";case"NL":return"🇳🇱";default:return"🌍"}},v=_=>{switch(_){case"nl":return"Dutch";case"fr":return"French";case"en":return"English";default:return _?.toUpperCase()||"Unknown"}},w=()=>{switch(r){case"send":return{title:"Send Invoice Confirmation",description:"Review the details before sending this invoice",icon:Ja,iconColor:"text-blue-600 dar
709k:text-blue-400",iconBg:"bg-blue-100 dark:bg-blue-900",buttonText:"Send Invoice",buttonClass:"bg-blue-600 hover:bg-blue-700 text-white",whatWillHappen:[`A professional invoice email will be sent to ${a?.client?.email}`,`The email will be in ${v(a?.language)} language`,"The invoice PDF will be attached automatically",'The invoice status will change to "Sent"',"You'll be able to track when the client views the invoice"]};case"resend":return{title:"Resend Invoice Confirmation",description:"Review the details before resending this invoice",icon:u0,iconColor:"text-orange-600 dark:text-orange-400",iconBg:"bg-orange-100 dark:bg-orange-900",buttonText:"Resend Invoice",buttonClass:"bg-orange-600 hover:bg-orange-700 text-white",whatWillHappen:[`The invoice will be sent again to ${a?.client?.email}`,`The email will be in ${v(a?.language)} language`,"The invoice PDF will be attached automatically","The client will receive a fresh copy of the invoice","No changes will be made to the invoice status"]};case"reminder":return{title:"Send Payment Reminder",description:"Review the details before sending this payment reminder",icon:xs,iconColor:"text-red-600 dark:text-red-400",iconBg:"bg-red-100 dark:bg-red-900",buttonText:"Send Reminder",buttonClass:"bg-red-600 hover:bg-red-700 text-white",whatWillHappen:[`A payment reminder will be sent to ${a?.client?.email}`,`The email will highlight that the invoice is ${a?.days_overdue} days overdue`,"The original invoice PDF will be attached","The reminder count will be incremented","The last reminder date will be updated"]};default:return{title:"Confirm Action",description:"Please confirm this action",icon:Lt,iconColor:"text-gray-600",iconBg:"bg-gray-100",buttonText:"Confirm",buttonClass:"bg-gray-600 hover:bg-gray-700 text-white",whatWillHappen:["Action will be performed"]}}},N=()=>{c(u.trim()||null),g("")},D=()=>{g(""),o()};if(!a)return null;const b=w(),E=b.icon;return e.jsx(Ds,{open:i,onOpenChange:D,children:e.jsxs(vs,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx("div",{className:`p-2 ${b.iconBg} rounded-lg`,children:e.jsx(E,{className:`h-6 w-6 ${b.iconColor}`})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground",children:b.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:b.description})]})]}),e.jsx("div",{className:"bg-muted/50 rounded-lg p-4 mb-6",children:e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"p-2 bg-primary-mint/10 rounded-lg",children:e.jsx(Ot,{className:"h-5 w-5 text-primary-mint"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"font-semibold text-lg",children:a.invoice_number}),e.jsx("span",{className:"text-xl",children:y(a.country)}),e.jsx(ze,{variant:"outline",children:a.status})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Issue Date: ",x(a.issue_date)]}),r==="reminder"&&a.is_overdue&&e.jsxs("p",{className:"text-sm text-red-600 font-medium",children:[a.days_overdue," days overdue"]})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:p(parseFloat(a.total_amount)||0,a.currency)}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Due: ",x(a.due_date)]})]})]})}),e.jsxs("div",{className:"space-y-4 mb-6",children:[e.jsxs("h4",{className:"font-medium flex items-center gap-2",children:[e.jsx(Lt,{className:"h-4 w-4"}),"Email Details"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(nt,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:a.client?.name}),e.jsx("p",{className:"text-muted-foreground",children:a.client?.contact_person})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Lt,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("p",{className:"font-mono text-sm",children:a.client?.email})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ps,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("div",{children:[e.jsxs("p",{className:"font-medium",children:[a.country," - ",v(a.language)]}),e.jsx("p",{className:"text-muted-foreground",children:"Email language"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(os,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("div",{children:[e.jsxs("p",{className:"font-medium",children:[a.payment_terms," days"]}),e.jsx("p",{className:"text-muted-foreground",children:"Payment terms"})]})]})]})]})]}),e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-950 border border-blue-200 dark:border-blue-800 rounded-lg p-4 mb-6",children:[e.jsxs("h4",{className:"font-medium flex items-center gap-2 mb-3 text-blue-800 dark:text-blue-200",children:[e.jsx(Ws,{className:"h-4 w-4"}),"What will happen when you ",r," this invoice:"]}),e.jsx("ul",{className:"space-y-2 text-sm text-blue-700 dark:text-blue-300",children:b.whatWillHappen.map((_,M)=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full mt-2 flex-shrink-0"}),e.jsx("span",{dangerouslySetInnerHTML:{__html:_}})]},M))})]}),r==="reminder"&&a.reminders_sent>0&&e.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-950 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4 mb-6",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(xs,{className:"h-5 w-5 text-yellow-600 dark:text-yellow-400 mt-0.5"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-yellow-800 dark:text-yellow-200",children:"Previous Reminders Sent"}),e.jsxs("p",{className:"text-sm text-yellow-700 dark:text-yellow-300",children:[a.reminders_sent," reminder",a.reminders_sent>1?"s":""," already sent.",a.last_reminder_sent&&` Last sent: ${x(a.last_reminder_sent)}
709`]})]})]})}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{htmlFor:"customMessage",className:"block font-medium mb-2",children:"Personal Message (Optional)"}),e.jsx(Ut,{id:"customMessage",placeholder:r==="reminder"?"Add a personal message to the payment reminder...":"Add a personal message that will be included in the email...",value:u,onChange:_=>g(_.target.value),className:"min-h-[80px]",maxLength:500}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[u.length,"/500 characters"]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-4 border-t",children:[e.jsx(G,{variant:"outline",onClick:D,disabled:m,children:"Cancel"}),e.jsx(G,{onClick:N,disabled:m,className:`${b.buttonClass} min-w-[140px]`,children:m?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(E,{className:"h-4 w-4 mr-2"}),b.buttonText]})})]})]})})},Zv=a=>new Date(a).toLocaleDateString("nl-NL",{year:"numeric",month:"short",day:"numeric"});function jf({isClientView:a=!1,clientId:r=null,selectedInvoiceId:i=null,preSelectedClientId:o=null}){const[c,m]=f.useState(""),[u,g]=f.useState("all"),[x,p]=f.useState("all"),[y,v]=f.useState(!1),[w,N]=f.useState(null),[D,b]=f.useState("list"),[E,_]=f.useState([]),[M,k]=f.useState({}),[C,j]=f.useState(!0),[O,L]=f.useState(!1),[R,H]=f.useState(null),[z,V]=f.useState(null),[Z,I]=f.useState(!1);f.useEffect(()=>{ue(),X()},[a,r]),f.useEffect(()=>{if(i&&E.length>0){const me=E.find(Se=>Se.id===i);me&&ee(me)}},[i,E]),f.useEffect(()=>{o&&!i&&T()},[o,i]);const ue=async()=>{try{j(!0);const me={};a&&r&&(me.client_id=r);const Se={...me,per_page:1e3},Pe=await xt.getAll(Se);Pe.data&&Array.isArray(Pe.data)?_(Pe.data):Pe.data?.data&&Array.isArray(Pe.data.data)?_(Pe.data.data):_([])}catch{_([])}finally{j(!1)}},X=async()=>{try{const me={};a&&r&&(me.client_id=r);const Se=await xt.getStats(me);k(Se.data||{})}catch{k({})}},P=f.useMemo(()=>E.filter(Se=>{const Pe=Se.invoice_number?.toLowerCase().includes(c.toLowerCase())||Se.client?.name?.toLowerCase().includes(c.toLowerCase())||Se.client?.contact_person?.toLowerCase().includes(c.toLowerCase()),pt=u==="all"||(u==="overdue"?Se.is_overdue:Se.status===u),Ve=x==="all"||Se.country===x;return Pe&&pt&&Ve}).sort((Se,Pe)=>new Date(Pe.created_at)-new Date(Se.created_at)),[E,c,u,x]),$=f.useMemo(()=>E.filter(me=>me.is_overdue),[E]),F=(me,Se="EUR")=>{const Pe=parseFloat(me);return isNaN(Pe)?new Intl.NumberFormat("nl-NL",{style:"currency",currency:Se,minimumFractionDigits:2,maximumFractionDigits:2}).format(0):new Intl.NumberFormat("nl-NL",{style:"currency",currency:Se,minimumFractionDigits:2,maximumFractionDigits:2}).format(Pe)},ne=me=>{switch(me){case"draft":return"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200";case"sent":return"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200";case"viewed":return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200";case"paid":return"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200";case"overdue":return"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200";case"cancelled":return"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200";default:return"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200"}},T=()=>{N(null),b("form"),window.showAchievement&&window.showAchievement({type:"firstAction",title:"Creating Invoice! 📄",message:"Professional invoicing keeps your business running smoothly!"})},B=me=>{N(me),b("form")},ee=me=>{N(me),b("detail")},te=me=>{V(me),H("send"),L(!0)},ye=me=>{V(me),H("resend"),L(!0)},ge=me=>{V(me),H("reminder"),L(!0)},K=async(me,Se=null)=>{try{const Pe={};Se&&(Pe.payment_reference=Se),await xt.markPaid(me.id,Pe),await ue(),await X(),window.showAchievement&&window.showAchievement({type:"taskCompleted",title:"Payment Received! 💰",message:`Invoice ${me.invoice_number} marked as paid`})}catch{alert("Failed to mark invoice as paid. Please try again.")}},re=async me=>{if(!(!z||!R))try{I(!0);const Se=me?{message:me}:{};let Pe,pt;switch(R){case"send":Pe=()=>xt.send(z.id,Se),pt=`Invoice ${z.invoice_number} sent to ${z.client.name}!`;break;case"resend":Pe=()=>xt.resend(z.id,Se),pt=`Invoice ${z.invoice_number} resent to ${z.client.name}!`;break;case"reminder":Pe=()=>xt.sendReminder(z.id,Se),pt=`Payment reminder sent for invoice ${z.invoice_number}!`;break;default:throw new Error("Invalid action type")}await Pe(),await ue(),await X(),L(!1),V(null),H(null),window.showAchievement&&window.showAchievement({type:"taskCompleted",title:R==="reminder"?"Reminder Sent! 📬":"Invoice Sent! ✉️",message:pt})}catch{alert(`Failed to ${R} invoice. Please try again.`)}finally{I(!1)}},je=()=>{L(!1),V(null),H(null)},Ae=async()=>{await ue(),await X(),b("list"),N(null)},ie=()=>{b("list"),N(null)},we=me=>{switch(me){case"BE":return"🇧🇪";case"NL":return"🇳🇱";default:return"🌍"}},_e=({invoice:me})=>e.jsxs("div",{className:"bg-card rounded-xl shadow-sm border border-border p-6 hover:shadow-lg transition-all duration-200 cursor-pointer group",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-primary-mint/10 rounded-lg flex items-center justify-center",children:e.jsx(_n,{className:"h-6 w-6 text-primary-mint"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"font-semibold text-card-foreground",children:me.invoice_number}),e.jsx("span",{className:"text-xl",children:we(me.country)}),e.jsx(ze,{className:ne(me.status),children:me.status})]}),e.jsx("p",{className:"text-muted-foreground",children:me.client?.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:me.client?.contact_person})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-2xl font-bold text-card-foreground",children:F(parseFloat(me.total_amount)||0)}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Due: ",Zv(me.due_date)]}),me.is_overdue&&e.jsxs("p",{className:"text-sm text-red-600 font-medium",children:[me.days_overdue," days overdue"]})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(os,{className:"h-4 w-4"}),e.jsxs("span",{children:["Issued: ",Zv(me.issue_date)]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ps,{className:"h-4 w-4"}),e.jsx("span",{children:me.country})]}),me.project&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Ot,{className:"h-4 w-4"}),e.jsx("span",{children:me.project.name})]})]}),e.jsxs("div",{className:"flex items-center gap-2 opacity-100 transition-opacity",children:[e.jsx(G,{variant:"ghost",size:"sm",onClick:Se=>{Se.stopPropagation(),ee(me)},title:"View details",children:e.jsx(rs,{className:"h-4 w-4"})}),e.jsx(G,{variant:"ghost",size:"sm",onClick:async Se=>{Se.stopPropagation();try{const Pe=await xt.previewPdf(me.id),pt=new Blob([Pe],{type:"application/pdf"}),Ve=URL.createObjectURL(pt);window.open(Ve,"_blank"),setTimeout(()=>URL.revokeObjectURL(Ve),100)}catch{alert("Failed to generate PDF preview. This feature is temporarily unavailable.")}},title:"View PDF",children:e.jsx(i0,{className:"h-4 w-4"})}
709),!a&&e.jsxs(e.Fragment,{children:[me.can_edit&&e.jsx(G,{variant:"ghost",size:"sm",onClick:Se=>{Se.stopPropagation(),B(me)},title:"Edit invoice",children:e.jsx(ya,{className:"h-4 w-4"})}),me.can_send&&e.jsx(G,{variant:"ghost",size:"sm",onClick:Se=>{Se.stopPropagation(),te(me)},title:"Send invoice",children:e.jsx(Ja,{className:"h-4 w-4"})}),!me.can_send&&me.status!=="draft"&&me.status!=="paid"&&e.jsxs(e.Fragment,{children:[e.jsx(G,{variant:"ghost",size:"sm",onClick:Se=>{Se.stopPropagation(),ye(me)},title:"Resend invoice",children:e.jsx(Lt,{className:"h-4 w-4"})}),e.jsx(G,{variant:"ghost",size:"sm",onClick:Se=>{Se.stopPropagation();const Pe=prompt("Payment reference (optional):");Pe!==null&&K(me,Pe||null)},title:"Mark as paid",className:"text-green-600 hover:text-green-700 hover:bg-green-50",children:e.jsx(Ws,{className:"h-4 w-4"})}),me.is_overdue&&e.jsx(G,{variant:"ghost",size:"sm",onClick:Se=>{Se.stopPropagation(),ge(me)},title:"Send payment reminder",className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:e.jsx(Oi,{className:"h-4 w-4"})})]})]}),e.jsx(G,{variant:"ghost",size:"sm",onClick:async Se=>{Se.stopPropagation();try{const Pe=await xt.downloadPdf(me.id),pt=new Blob([Pe],{type:"application/pdf"}),Ve=URL.createObjectURL(pt),bt=document.createElement("a");bt.href=Ve,bt.download=`${me.invoice_number}.pdf`,document.body.appendChild(bt),bt.click(),document.body.removeChild(bt),URL.revokeObjectURL(Ve)}catch{alert("Failed to download PDF. This feature is temporarily unavailable.")}},title:"Download PDF",children:e.jsx(An,{className:"h-4 w-4"})})]})]})]});return D==="form"?e.jsx(qE,{invoice:w,preSelectedClientId:o,onSave:Ae,onCancel:ie}):D==="detail"&&w?e.jsx(VE,{invoice:w,onBack:()=>b("list"),onEdit:()=>B(w)}):e.jsxs("div",{className:"p-4 lg:p-6 space-y-6",children:[e.jsxs("div",{className:"flex flex-col xl:flex-row xl:items-end justify-between gap-6",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold text-foreground flex items-center gap-2",children:[e.jsx(_n,{className:"h-8 w-8 text-primary-mint"}),"Invoicing"]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Compliant with Belgian & Dutch tax laws"})]}),e.jsxs("div",{className:"flex flex-wrap gap-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-primary-mint/10 rounded-lg",children:e.jsx(_n,{className:"w-5 h-5 text-primary-mint"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:M.total||0}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Invoices"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-green-500/10 rounded-lg",children:e.jsx(Ws,{className:"w-5 h-5 text-green-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:M.paid||0}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Paid (",F(parseFloat(M.paid_amount)||0),")"]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-red-500/10 rounded-lg",children:e.jsx(Oi,{className:"w-5 h-5 text-red-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:M.overdue||0}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Overdue (",F(parseFloat(M.overdue_amount)||0),")"]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-yellow-500/10 rounded-lg",children:e.jsx(xs,{className:"w-5 h-5 text-yellow-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:(M.sent||0)+(M.viewed||0)+(M.overdue||0)}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Outstanding (",F(parseFloat(M.outstanding_amount)||0),")"]})]})]})]})]}),!a&&e.jsxs(G,{onClick:T,className:"bg-primary-mint hover:bg-primary-mint/90 text-primary-navy xl:w-auto",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"New Invoice"]})]}),$.length>0&&e.jsx("div",{className:"p-4 rounded-xl border-2 border-red-200 bg-red-50 dark:bg-red-950 dark:border-red-800",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Oi,{className:"h-5 w-5 text-red-600"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("h3",{className:"font-medium text-red-800 dark:text-red-200",children:[$.length," overdue invoice",$.length>
7091?"s":""]}),e.jsxs("p",{className:"text-sm text-red-600 dark:text-red-300",children:["Total amount: ",F($.reduce((me,Se)=>me+(parseFloat(Se.total_amount)||0),0))]})]}),e.jsxs(G,{variant:"outline",size:"sm",className:"border-red-300 text-red-700 hover:bg-red-100",children:[e.jsx(Lt,{className:"h-4 w-4 mr-2"}),"Send Reminders"]})]})}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4 items-start lg:items-center",children:[e.jsxs("div",{className:"relative flex-1 max-w-md",children:[e.jsx(Un,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4"}),e.jsx(he,{placeholder:"Search invoices, clients...",value:c,onChange:me=>m(me.target.value),className:"pl-10"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("select",{value:u,onChange:me=>g(me.target.value),className:"px-3 py-2 border border-input rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-ring min-w-[120px] bg-background",children:[e.jsx("option",{value:"all",children:"All Status"}),!a&&e.jsx("option",{value:"draft",children:"Draft"}),e.jsx("option",{value:"sent",children:"Sent"}),e.jsx("option",{value:"viewed",children:"Viewed"}),e.jsx("option",{value:"paid",children:"Paid"}),e.jsx("option",{value:"overdue",children:"Overdue"}),!a&&e.jsx("option",{value:"cancelled",children:"Cancelled"})]}),e.jsxs("select",{value:x,onChange:me=>p(me.target.value),className:"px-3 py-2 border border-input rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-ring min-w-[140px] bg-background",children:[e.jsx("option",{value:"all",children:"All Countries"}),e.jsx("option",{value:"BE",children:"🇧🇪 Belgium"}),e.jsx("option",{value:"NL",children:"🇳🇱 Netherlands"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("span",{className:"text-sm text-muted-foreground",children:[P.length," invoice",P.length!==1?"s":""]})})]})]}),e.jsx("div",{className:"space-y-4",children:C?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary-mint"})}):P.length===0?e.jsx(qi,{type:c||u!=="all"||x!=="all"?"searchEmpty":"noInvoices",icon:_n,onAction:T,actionLabel:"Create Your First Invoice",className:"py-12"}):P.map(me=>e.jsx(_e,{invoice:me},me.id))}),e.jsx(HE,{invoice:z,action:R,isOpen:O,onClose:je,onConfirm:re,isLoading:Z})]})}const VE=({invoice:a,onBack:r,onEdit:i})=>{const o=(x,p="EUR")=>{const y=parseFloat(x);return isNaN(y)?new Intl.NumberFormat("nl-NL",{style:"currency",currency:p,minimumFractionDigits:2,maximumFractionDigits:2}).format(0):new Intl.NumberFormat("nl-NL",{style:"currency",currency:p,minimumFractionDigits:2,maximumFractionDigits:2}).format(y)},c=x=>{switch(x){case"draft":return"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200";case"sent":return"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200";case"viewed":return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200";case"paid":return"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200";case"overdue":return"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200";case"cancelled":return"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200";default:return"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200"}},m=x=>new Date(x).toLocaleDateString("nl-NL",{year:"numeric",month:"short",day:"numeric"}),u=async()=>{try{const x=await xt.previewPdf(a.id),p=new Blob([x],{type:"application/pdf"}),y=URL.createObjectURL(p);window.open(y,"_blank"),setTimeout(()=>URL.revokeObjectURL(y),100)}catch{alert("Failed to generate PDF preview. This feature is temporarily unavailable.")}},g=async()=>{try{const x=await xt.downloadPdf(a.id),p=new Blob([x],{type:"application/pdf"}),y=URL.createObjectURL(p),v=document.createElement("a");v.href=y,v.download=`${a.invoice_number}.pdf`,document.body.appendChild(v),v.click(),document.body.removeChild(v),URL.revokeObjectURL(y)}catch{alert("Failed to download PDF. This feature is temporarily unavailable.")}};return e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsx(G,{variant:"outline",onClick:r,children:"← Back to Invoices"}),e.jsx("h1",{className:"text-2xl font-bold",children:a.invoice_number}),e.jsx(ze,{className:c(a.status),children:a.status}),e.jsxs("div",{className:"flex gap-2 ml-auto",children:[e.jsxs(G,{variant:"outline",onClick:u,children:[e.jsx(i0,{className:"h-4 w-4 mr-2"}),"View PDF"]}),e.jsxs(G,{variant:"outline",onClick:g,children:[e.jsx(An,{className:"h-4 w-4 mr-2"}),"Download PDF"]}),a.can_edit&&e.jsxs(G,{onClick:i,variant:"outline",children:[e.jsx(ya,{className:"h-4 w-4 mr-2"}),"Edit"]}),a.status!=="paid"&&a.status!=="draft"&&e.jsxs(G,{variant:"outline",onClick:()=>{const x=prompt("Payment reference (optional):");x!==null&&xt.markPaid(a.id,x?{payment_reference:x}:{}).then(()=>{window.location.reload()}).catch(p=>{alert("Failed to mark invoice as paid. Please try again.")})},className:"bg-green-600 hover:bg-green-700 text-white",children:[e.jsx(Ws,{className:"h-4 w-4 mr-2"}),"Mark as Paid"]})]})]}),e.jsxs(Ce,{className:"p-6",children:[e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold mb-4",children:"From:"}),e.jsx("div",{className:"space-y-2 text-sm",children:a.template?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"font-medium",children:a.template.company_name}),e.jsx("p",{children:a.template.company_address}),e.jsxs("p",{children:[a.template.company_postal_code," ",a.template.company_city]}),e.jsx("p",{children:a.template.company_country}),e.jsxs("p",{children:["VAT: ",a.template.company_vat_number]}),a.template.company_registration_number&&e.jsxs("p",{children:["Enterprise: ",a.template.company_registration_number]}),a.template.company_kvk_number&&e.jsxs("p",{children:["KvK: ",a.template.company_kvk_number]})]}):e.jsx("p",{className:"text-muted-foreground",children:"Template information not available"})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold mb-4",children:"To:"}),e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsx("p",{className:"font-medium",children:a.client?.name}),e.jsx("p",{children:a.client?.contact_person}),e.jsx("p",{children:a.client?.address}),e.jsxs("p",{children:[a.client?.postal_code," ",a.client?.city]}),e.jsx("p",{children:a.client?.country}),a.client?.vat_number&&e.jsxs("p",{children:["VAT: ",a.client.vat_number]})]})]})]}),e.jsxs("div",{className:"mt-8 pt-8 border-t",children:[e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4 mb-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Invoice Date"}),e.jsx("p",{className:"font-medium",children:m(a.issue_date)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Due Date"}),e.jsx("p",{className:"font-medium",children:m(a.due_date)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Payment Terms"}),e.jsxs("p",{className:"font-medium",children:[a.payment_terms," days"]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Amount"}),e.jsx("p",{className:"font-bold text-lg",children:o(parseFloat(a.total_amount)||0)})]})]}),e.jsx("div",{className:"border rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-muted",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium",children:"Description"}),e.jsx("th",{className:"px-4 py-3 text-right text-sm font-medium",children:"Qty"}),e.jsx("th",{className:"px-4 py-3 text-right text-sm font-medium",children:"Unit Price"}),e.jsx("th",{className:"px-4 py-3 text-right text-sm font-medium",children:"VAT %"}),e.jsx("th",{className:"px-4 py-3 text-right text-sm font-medium",children:"Total"})]})}),e.jsx("tbody",{children:a.items?.map((x,p)=>e.jsxs("tr",{className:"border-t",children:[e.jsx("td",{className:"px-4 py-3",children:x.description}),e.jsxs("td",{className:"px-4 py-3 text-right",children:[x.quantity," ",x.unit]}),e.jsx("td",{className:"px-4 py-3 text-right",children:o(parseFloat(x.unit_price)||0)}),e.jsxs("td",{className:"px-4 py-3 text-right",children:[((parseFloat(x.vat_rate)||0)*100).toFixed(0),"%"]}),e.jsx("td",{className:"px-4 py-3 text-right font-medium",children:o(parseFloat(x.total_amount)||0)})]},p))}),e.jsxs("tfoot",{className:"bg-muted",children:[e.jsxs("tr",{children:[e.jsx("td",{colSpan:"4",className:"px-4 py-3 text-right font-medium",children:"Subtotal (excl. VAT):"}),e.jsx("td",{className:"px-4 py-3 text-right font-medium",children:o(parseFloat(a.subtotal)||0)})]}),e.jsxs("tr",{children:[e.jsx("td",{colSpan:"4",className:"px-4 py-3 text-right font-medium",children:"VAT:"}),e.jsx("td",{className:"px-4 py-3 text-right font-medium",children:o(parseFloat(a.tax_amount)||0)})]}),e.jsxs("tr",{children:[e.jsx("td",{colSpan:"4",className:"px-4 py-3 text-right font-bold text-lg",children:"Total:"}),e.jsx("td",{className:"px-4 py-3 text-right font-bold text-lg",children:o(parseFloat(a.total_amount)||0)})]})]})]})}),a.notes&&e.jsxs("div",{className:"mt-6 p-4 bg-muted rounded-lg",children:[e.jsx("h4",{className:"font-medium mb-2",children:"Payment Terms & Notes:"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a.notes})]}),a.internal_notes&&e.jsxs("div",{className:"mt-4 p-4 bg-yellow-50 dark:bg-yellow-950 rounded-lg border border-yellow-200 dark:border-yellow-800",children:[e.jsx("h4",{className:"font-medium mb-2 text-yellow-800 dark:text-yellow-200",children:"Internal Notes:"}),e.jsx("p",{className:"text-sm text-yellow-700 dark:text-yellow-300",children:a.internal_notes})]})]})]})]})};function GE({onInviteMember:a,onInviteColleague:r,onEditMember:i}){const[o,c]=f.useState([]),[m,u]=f.useState(!0),[g,x]=f.useState(""),[p,y]=f.useState("all"),[v,w]=f.useState("all"),{user:N}=ts();f.useEffect(()=>{D()},[]);const D=async()=>{try{u(!0);const j={};g&&(j.search=g),p!=="all"&&(j.role=p),v!=="all"&&(j.active=v==="active"?"1":"0");const O=await ve.getTeamMembers(j);c(O.data||[])}catch{c([])}finally{u(!1)}};f.useEffect(()=>{const j=setTimeout(()=>{D()},300);return()=>clearTimeout(j)},[g,p,v]);const b=async j=>{if(confirm("Are you sure you want to remove this team member?"))try{await ve.removeTeamMember(j),await D()}catch{console.error("Error removing team member:")}},E=j=>{switch(j){case"admin":return e.jsx(lv,{className:"h-4 w-4 text-yellow-500"});case"manager":return e.jsx(Ga,{className:"h-4 w-4 text-blue-500"});case"member":return e.jsx(nt,{className:"h-4 w-4 text-green-500"});case"client":return e.jsx(cv,{className:"h-4 w-4 text-purple-500"});default:return e.jsx(nt,{className:"h-4 w-4 text-gray-500"})}},_=j=>{switch(j){case"admin":return"bg-yellow-100 text-yellow-800 border-yellow-200";case"manager":return"bg-blue-100 text-blue-800 border-blue-200";case"member":return"bg-green-100 text-green-800 border-green-200";case"client":return"bg-purple-100 text-purple-800 border-purple-200";default:return"bg-gray-100 text-gray-800 border-gray-200"}},M=j=>j.full_name?j.full_name.split(" ").map(O=>O[0]).join("").toUpperCase().slice(0,2):j.first_name&&j.last_name?(j.first_name[0]+j.last_name[0]).toUpperCase():j.first_name?j.first_name[0].toUpperCase():j.name?j.name.split(" ").map(O=>O[0]).join("").toUpperCase().slice(0,2):"??",k=j=>N?.id===j,C=j=>N?.is_company_admin&&!k(j.id);return m?e.jsx("div",{className:"p-8",children:e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-8 bg-gray-200 rounded w-1/4"}),e.jsx("div",{className:"space-y-3",children:[...Array(5)].map((j,O)=>e.jsx("div",{className:"h-16 bg-gray-200 rounded"},O))})]})}):e.jsxs("div",{className:"p-4 sm:p-8",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between mb-6 gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold text-primary-navy break-words",children:"Team Management"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"Manage your team members, roles, and permissions"})]}),N?.is_company_admin&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 sm:gap-3 w-full sm:w-auto",children:[e.jsxs(G,{onClick:r,className:"bg-primary-navy hover:bg-primary-navy
709/90 text-white text-sm sm:text-base w-full sm:w-auto",size:"sm",children:[e.jsx(yt,{className:"h-4 w-4 mr-2"}),e.jsx("span",{className:"hidden xs:inline",children:"Invite Colleague"}),e.jsx("span",{className:"xs:hidden",children:"Colleague"})]}),e.jsxs(G,{onClick:a,className:"bg-primary-mint hover:bg-primary-mint/90 text-sm sm:text-base w-full sm:w-auto",size:"sm",children:[e.jsx(Xm,{className:"h-4 w-4 mr-2"}),e.jsx("span",{className:"hidden xs:inline",children:"Invite Member"}),e.jsx("span",{className:"xs:hidden",children:"Member"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 mb-6",children:[e.jsx(Ce,{children:e.jsx(vt,{className:"p-4",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(yt,{className:"h-5 w-5 text-blue-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Members"}),e.jsx("p",{className:"text-2xl font-bold",children:o.length})]})]})})}),e.jsx(Ce,{children:e.jsx(vt,{className:"p-4",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(lv,{className:"h-5 w-5 text-yellow-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Admins"}),e.jsx("p",{className:"text-2xl font-bold",children:o.filter(j=>j.role==="admin").length})]})]})})}),e.jsx(Ce,{children:e.jsx(vt,{className:"p-4",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ga,{className:"h-5 w-5 text-blue-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Managers"}),e.jsx("p",{className:"text-2xl font-bold",children:o.filter(j=>j.role==="manager").length})]})]})})}),e.jsx(Ce,{children:e.jsx(vt,{className:"p-4",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(cv,{className:"h-5 w-5 text-green-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Active"}),e.jsx("p",{className:"text-2xl font-bold",children:o.filter(j=>j.status==="active").length})]})]})})})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Un,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(he,{placeholder:"Search team members...",value:g,onChange:j=>x(j.target.value),className:"pl-10"})]}),e.jsxs(Pn,{value:p,onValueChange:y,children:[e.jsx(Za,{className:"w-full sm:w-40",children:e.jsx(zn,{placeholder:"Filter by role"})}),e.jsxs(Qa,{children:[e.jsx(kt,{value:"all",children:"All Roles"}),e.jsx(kt,{value:"admin",children:"Admin"}),e.jsx(kt,{value:"manager",children:"Manager"}),e.jsx(kt,{value:"member",children:"Member"}),e.jsx(kt,{value:"client",children:"Client"})]})]}),e.jsxs(Pn,{value:v,onValueChange:w,children:[e.jsx(Za,{className:"w-full sm:w-40",children:e.jsx(zn,{placeholder:"Filter by status"})}),e.jsxs(Qa,{children:[e.jsx(kt,{value:"all",children:"All Status"}),e.jsx(kt,{value:"active",children:"Active"}),e.jsx(kt,{value:"inactive",children:"Inactive"})]})]})]}),e.jsxs(Ce,{children:[e.jsx(En,{children:e.jsxs(Mn,{className:"flex items-center space-x-2",children:[e.jsx(yt,{className:"h-5 w-5"}),e.jsxs("span",{children:["Team Members (",o.length,")"]})]})}),e.jsx(vt,{children:o.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(yt,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-foreground mb-2",children:"No team members found"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:g||p!=="all"||v!=="all"?"Try adjusting your filters to see more results.":"Start by inviting team members to collaborate on projects."}),N?.is_company_admin&&e.jsxs(G,{onClick:a,variant:"outline",children:[e.jsx(Xm,{className:"h-4 w-4 mr-2"}),"Invite First Member"]})]}):e.jsx("div",{className:"space-y-3",children:o.map(j=>e.jsxs("div",{className:"flex items-center justify-between p-4 border border-border rounded-lg hover:bg-accent/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs(_c,{className:"h-10 w-10",children:[e.jsx(H0,{src:j.avatar}),e.jsx(Dc,{className:"bg-primary-mint text-white",children:M(j)})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs("h3",{className:"font-medium text-foreground",children:[j.full_name||`${j.first_name||""} ${j.last_name||""}`.trim()||j.name||"Unknown User",k(j.id)&&e.jsx("span",{className:"text-sm text-muted-foreground ml-2",children:"(You)"})]}),E(j.role)]}),e.jsxs("div",{className:"flex items-center space-x-2 mt-1",children:[e.jsx(Lt,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:j.email})]}),j.job_title&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:j.job_title})]})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(ze,{className:_(j.role),children:j.role}),e.jsx(ze,{variant:j.status==="active"?"default":"secondary",children:j.status}),C(j)&&e.jsxs(lN,{children:[e.jsx(iN,{asChild:!0,children:e.jsx(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:e.jsx(va,{className:"h-4 w-4"})})}),e.jsxs(dh,{align:"end",children:[e.jsxs(Bi,{onClick:()=>i(j),children:[e.jsx(ya,{className:"h-4 w-4 mr-2"}),"Edit Member"]}),e.jsxs(Bi,{onClick:()=>b(j.id),className:"text-destructive",children:[e.jsx($n,{className:"h-4 w-4 mr-2"}),"Remove Member"]})]})]})]})]},j.id))})})]})]})}function YE({open:a,onClose:r,onSuccess:i}){const[o,c]=f.useState({email:"",first_name:"",last_name:"",role:"member",permissions:[],message:""}),[m,u]=f.useState(!1),[g,x]=f.useState({}),[p,y]=f.useState([]),[v,w]=f.useState([]);f.useEffect(()=>{a&&(N(),c({email:"",first_name:"",last_name:"",role:"member",permissions:[],message:""}),x({}))},[a]);const N=async()=>{try{const[k,C]=await Promise.all([ve.getTeamRoles(),ve.getTeamPermissions()]),j=(k.data||[]).filter(O=>(O.value||O.name||O)!=="client");y(j),w(C.data||[])}catch{console.error("Error fetching roles and permissions:")}},D=(k,C)=>{c(j=>({...j,[k]:C})),g[k]&&x(j=>({...j,[k]:null}))},b=k=>{c(C=>({...C,permissions:C.permissions.includes(k)?C.permissions.filter(j=>j!==k):[...C.permissions,k]}))},E=()=>{const k={};return o.email.trim()?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.email)||(k.email="Please enter a valid email address"):k.email="Email is required",o.first_name.trim()||(k.first_name="First name is required"),o.last_name.trim()||(k.last_name="Last name is required"),o.role||(k.role="Role is required"),x(k),Object.keys(k).length===0},_=async k=>
709{if(k.preventDefault(),!!E()){u(!0);try{await ve.inviteTeamMember(o),i?.(),r(),c({email:"",first_name:"",last_name:"",role:"member",permissions:[],message:""})}catch(C){console.error("Error inviting team member:"),C.response?.data?.errors?x(C.response.data.errors):x({general:C.response?.data?.message||"Failed to send invitation"})}finally{u(!1)}}},M=k=>{switch(k){case"admin":return"Full access to all features and settings";case"manager":return"Can manage projects, tasks, and team members";case"member":return"Can work on assigned projects and tasks";case"client":return"Limited access to view assigned projects";default:return""}};return e.jsx(Ds,{open:a,onOpenChange:r,children:e.jsxs(vs,{className:"sm:max-w-md",children:[e.jsx(Es,{children:e.jsxs(Ms,{className:"flex items-center space-x-2",children:[e.jsx(Lt,{className:"h-5 w-5"}),e.jsx("span",{children:"Invite Team Member (Internal)"})]})}),e.jsxs("form",{onSubmit:_,className:"space-y-4",children:[g.general&&e.jsxs("div",{className:"flex items-center space-x-2 text-sm text-destructive bg-destructive/10 p-3 rounded-lg",children:[e.jsx(es,{className:"h-4 w-4"}),e.jsx("span",{children:g.general})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"email",children:"Email Address *"}),e.jsxs("div",{className:"relative",children:[e.jsx(Lt,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(he,{id:"email",type:"email",placeholder:"[email protected]",value:o.email,onChange:k=>D("email",k.target.value),className:`pl-10 ${g.email?"border-destructive":""}`})]}),g.email&&e.jsx("p",{className:"text-sm text-destructive",children:g.email}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Invite internal company employees only"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"first_name",children:"First Name *"}),e.jsxs("div",{className:"relative",children:[e.jsx(nt,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(he,{id:"first_name",type:"text",placeholder:"John",value:o.first_name,onChange:k=>D("first_name",k.target.value),className:`pl-10 ${g.first_name?"border-destructive":""}`})]}),g.first_name&&e.jsx("p",{className:"text-sm text-destructive",children:g.first_name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"last_name",children:"Last Name *"}),e.jsxs("div",{className:"relative",children:[e.jsx(nt,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(he,{id:"last_name",type:"text",placeholder:"Doe",value:o.last_name,onChange:k=>D("last_name",k.target.value),className:`pl-10 ${g.last_name?"border-destructive":""}`})]}),g.last_name&&e.jsx("p",{className:"text-sm text-destructive",children:g.last_name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"role",children:"Role *"}),e.jsxs(Pn,{value:o.role,onValueChange:k=>D("role",k),children:[e.jsx(Za,{className:g.role?"border-destructive":"",children:e.jsx(zn,{placeholder:"Select a role"})}),e.jsx(Qa,{children:p.map(k=>e.jsx(kt,{value:k.value||k,children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ga,{className:"h-4 w-4"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium capitalize",children:k.label||k}),e.jsx("div",{className:"text-xs text-muted-foreground",children:k.description||M(k.value||k)})]})]})},k.value||k))})]}),g.role&&e.jsx("p",{className:"text-sm text-destructive",children:g.role})]}),v.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{children:"Permissions (Optional)"}),e.jsx(Ce,{children:e.jsx(vt,{className:"p-4",children:e.jsx("div",{className:"grid grid-cols-2 gap-3",children:v.map(k=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ba,{id:k.value||k,checked:o.permissions.includes(k.value||k),onCheckedChange:()=>b(k.value||k)}),e.jsx(oe,{htmlFor:k.value||k,className:"text-sm font-normal capitalize cursor-pointer",children:k.label||k.replace("_"," ")})]},k.value||k))})})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"message",children:"Personal Message (Optional)"}),e.jsx(Ut,{id:"message",placeholder:"Welcome to our team! We're excited to have you on board...",value:o.message,onChange:k=>D("message",k.target.value),rows:3})]}),e.jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[e.jsx(G,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),e.jsx(G,{type:"submit",disabled:m,className:"bg-primary-mint hover:bg-primary-mint/90",children:m?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ja,{className:"h-4 w-4 mr-2"}),"Send Invitation"]})})]})]})]})})}var ud="Switch",[XE,qM]=Bs(ud),[KE,ZE]=XE(ud),dN=f.forwardRef((a,r)=>{const{__scopeSwitch:i,name:o,checked:c,defaultChecked:m,required:u,disabled:g,value:x="on",onCheckedChange:p,form:y,...v}=a,[w,N]=f.useState(null),D=it(r,k=>N(k)),b=f.useRef(!1),E=w?y||!!w.closest("form"):!0,[_,M]=Ya({prop:c,defaultProp:m??!1,onChange:p,caller:ud});return e.jsxs(KE,{scope:i,checked:_,disabled:g,children:[e.jsx(Be.button,{type:"button",role:"switch","aria-checked":_,"aria-required":u,"data-state":hN(_),"data-disabled":g?"":void 0,disabled:g,value:x,...v,ref:D,onClick:Te(a.onClick,k=>{M(C=>!C),E&&(b.current=k.isPropagationStopped(),b.current||k.stopPropagation())})}),E&&e.jsx(fN,{control:w,bubbles:!b.current,name:o,value:x,checked:_,required:u,disabled:g,form:y,style:{transform:"translateX(-100%)"}})]})});dN.displayName=ud;var uN="SwitchThumb",mN=f.forwardRef((a,r)=>{const{__scopeSwitch:i,...o}=a,c=ZE(uN,i);return e.jsx(Be.span,{"data-state":hN(c.checked),"data-disabled":c.disabled?"":void 0,...o,ref:r})});mN.displayName=uN;var QE="SwitchBubbleInput",fN=f.forwardRef(({__scopeSwitch:a,control:r,checked:i,bubbles:o=!0,...c},m)=>{const u=f.useRef(null),g=it(u,m),x=Bf(i),p=qf(r);return f.useEffect(()=>{const y=u.current;if(!y)return;const v=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(v,"checked").set;if(x!==i&&N){const D=new Event("click",{bubbles:o});N.call(y,i),y.dispatchEvent(D)}},[x,i,o]),e.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i,...c,tabIndex:-1,ref:g,style:{...c.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});fN.displayName=QE;function hN(a){return a?"checked":"unchecked"}var xN=dN,JE=mN;const pN=f.forwardRef(({className:a,...r},i)=>e.jsx(xN,{className:Ge("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",a),...r,ref:i,children:e.jsx(JE,{className:Ge("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")})}
709));pN.displayName=xN.displayName;function WE({open:a,onClose:r,onSuccess:i,member:o}){const[c,m]=f.useState({first_name:"",last_name:"",job_title:"",role:"",permissions:[],status:"active"}),[u,g]=f.useState(!1),[x,p]=f.useState({}),[y,v]=f.useState([]),[w,N]=f.useState([]);f.useEffect(()=>{a&&o&&(D(),m({first_name:o.first_name||"",last_name:o.last_name||"",job_title:o.job_title||"",role:o.role||"",permissions:o.permissions||[],status:o.status||"active"}),p({}))},[a,o]);const D=async()=>{try{const[C,j]=await Promise.all([ve.getTeamRoles(),ve.getTeamPermissions()]);v(C.data||[]),N(j.data||[])}catch{console.error("Error fetching roles and permissions:")}},b=(C,j)=>{m(O=>({...O,[C]:j})),x[C]&&p(O=>({...O,[C]:null}))},E=C=>{m(j=>({...j,permissions:j.permissions.includes(C)?j.permissions.filter(O=>O!==C):[...j.permissions,C]}))},_=()=>{const C={};return c.first_name.trim()||(C.first_name="First name is required"),c.last_name.trim()||(C.last_name="Last name is required"),c.role||(C.role="Role is required"),p(C),Object.keys(C).length===0},M=async C=>{if(C.preventDefault(),!!_()){g(!0);try{await ve.updateTeamMember(o.id,c),i?.(),r()}catch(j){console.error("Error updating team member:"),j.response?.data?.errors?p(j.response.data.errors):p({general:j.response?.data?.message||"Failed to update team member"})}finally{g(!1)}}},k=C=>{switch(C){case"admin":return"Full access to all features and settings";case"manager":return"Can manage projects, tasks, and team members";case"member":return"Can work on assigned projects and tasks";case"client":return"Limited access to view assigned projects";default:return""}};return o?e.jsx(Ds,{open:a,onOpenChange:r,children:e.jsxs(vs,{className:"sm:max-w-md",children:[e.jsx(Es,{children:e.jsxs(Ms,{className:"flex items-center space-x-2",children:[e.jsx(nt,{className:"h-5 w-5"}),e.jsx("span",{children:"Edit Team Member"})]})}),e.jsxs("form",{onSubmit:M,className:"space-y-4",children:[x.general&&e.jsxs("div",{className:"flex items-center space-x-2 text-sm text-destructive bg-destructive/10 p-3 rounded-lg",children:[e.jsx(es,{className:"h-4 w-4"}),e.jsx("span",{children:x.general})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"email",children:"Email Address"}),e.jsx(he,{id:"email",type:"email",value:o.email,disabled:!0,className:"bg-muted"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Email cannot be changed"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"first_name",children:"First Name *"}),e.jsx(he,{id:"first_name",type:"text",placeholder:"John",value:c.first_name,onChange:C=>b("first_name",C.target.value),className:x.first_name?"border-destructive":""}),x.first_name&&e.jsx("p",{className:"text-sm text-destructive",children:x.first_name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"last_name",children:"Last Name *"}),e.jsx(he,{id:"last_name",type:"text",placeholder:"Doe",value:c.last_name,onChange:C=>b("last_name",C.target.value),className:x.last_name?"border-destructive":""}),x.last_name&&e.jsx("p",{className:"text-sm text-destructive",children:x.last_name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"job_title",children:"Job Title"}),e.jsx(he,{id:"job_title",type:"text",placeholder:"Software Developer",value:c.job_title,onChange:C=>b("job_title",C.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"role",children:"Role *"}),e.jsxs(Pn,{value:c.role,onValueChange:C=>b("role",C),children:[e.jsx(Za,{className:x.role?"border-destructive":"",children:e.jsx(zn,{placeholder:"Select a role"})}),e.jsx(Qa,{children:y.map(C=>e.jsx(kt,{value:C.value||C,children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ga,{className:"h-4 w-4"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium capitalize",children:C.label||C}),e.jsx("div",{className:"text-xs text-muted-foreground",children:C.description||k(C.value||C)})]})]})},C.value||C))})]}),x.role&&e.jsx("p",{className:"text-sm text-destructive",children:x.role})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"status",children:"Account Status"}),e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(pN,{id:"status",checked:c.status==="active",onCheckedChange:C=>b("status",C?"active":"inactive")}),e.jsx(oe,{htmlFor:"status",className:"text-sm",children:c.status==="active"?"Active":"Inactive"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Inactive users cannot access the system"})]}),w.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{children:"Permissions"}),e.jsx(Ce,{children:e.jsx(vt,{className:"p-4",children:e.jsx("div",{className:"grid grid-cols-2 gap-3",children:w.map(C=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ba,{id:C.value||C,checked:c.permissions.includes(C.value||C),onCheckedChange:()=>E(C.value||C)}),e.jsx(oe,{htmlFor:C.value||C,className:"text-sm font-normal capitalize cursor-pointer",children:C.label||C.replace("_"," ")})]},C.value||C))})})})]}),e.jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[e.jsx(G,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),e.jsx(G,{type:"submit",disabled:u,className:"bg-primary-mint hover:bg-primary-mint/90",children:u?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}
709),"Updating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Nr,{className:"h-4 w-4 mr-2"}),"Update Member"]})})]})]})]})}):null}function eM({open:a,onClose:r,onSuccess:i,company:o}){const[c,m]=f.useState({email:"",first_name:"",last_name:"",job_title:"",message:""}),[u,g]=f.useState(!1),[x,p]=f.useState({});wt.useEffect(()=>{a&&(m({email:"",first_name:"",last_name:"",job_title:"",message:""}),p({}))},[a]);const y=(N,D)=>{m(b=>({...b,[N]:D})),x[N]&&p(b=>({...b,[N]:null}))},v=()=>{const N={};return c.email.trim()?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(c.email)||(N.email="Please enter a valid email address"):N.email="Email is required",c.first_name.trim()||(N.first_name="First name is required"),c.last_name.trim()||(N.last_name="Last name is required"),c.job_title.trim()||(N.job_title="Job title is required"),p(N),Object.keys(N).length===0},w=async N=>{if(N.preventDefault(),!!v()){if(!o?.id){p({general:"Company information is missing"});return}console.log("Submitting colleague invitation:",{companyId:o.id,formData:c,company:o}),g(!0);try{await ve.inviteColleague(o.id,c),Nt.success("Colleague invitation sent successfully"),i?.(),r(),m({email:"",first_name:"",last_name:"",job_title:"",message:""})}catch(D){if(console.error("Error inviting colleague:",D),console.log("Full error response:",D.response),D.response?.data?.errors)p(D.response.data.errors);else if(D.response?.data?.error){const b=D.response.data.error;b.includes("already pending")?p({email:"A colleague invitation is already pending for this email address"}):b.includes("already associated")?p({email:"This email is already associated with your company"}):p({general:b})}else p({general:D.response?.data?.message||"Failed to send invitation"})}finally{g(!1)}}};return e.jsx(Ds,{open:a,onOpenChange:r,children:e.jsxs(vs,{className:"sm:max-w-md",children:[e.jsx(Es,{children:e.jsxs(Ms,{className:"flex items-center space-x-2",children:[e.jsx(yt,{className:"h-5 w-5 text-primary-mint"}),e.jsx("span",{children:"Invite Company Colleague"})]})}),e.jsx("div",{className:"mb-4 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:e.jsxs("div",{className:"flex items-start space-x-2",children:[e.jsx(es,{className:"h-4 w-4 text-blue-600 mt-0.5"}),e.jsxs("div",{className:"text-sm text-blue-800",children:[e.jsx("p",{className:"font-medium mb-1",children:"Company Admin Access"}),e.jsxs("p",{children:["Your colleague will receive full admin access to ",o?.name||"your company",", including all projects, documents, and settings. Their personal chats will remain private."]})]})]})}),e.jsxs("form",{onSubmit:w,className:"space-y-4",children:[x.general&&e.jsxs("div",{className:"flex items-center space-x-2 text-sm text-destructive bg-destructive/10 p-3 rounded-lg",children:[e.jsx(es,{className:"h-4 w-4"}),e.jsx("span",{children:x.general})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"email",children:"Email Address *"}),e.jsxs("div",{className:"relative",children:[e.jsx(Lt,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(he,{id:"email",type:"email",placeholder:"[email protected]",value:c.email,onChange:N=>y("email",N.target.value),className:`pl-10 ${x.email?"border-destructive":""}`})]}),x.email&&e.jsx("p",{className:"text-sm text-destructive",children:x.email})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"first_name",children:"First Name *"}),e.jsxs("div",{className:"relative",children:[e.jsx(nt,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(he,{id:"first_name",type:"text",placeholder:"John",value:c.first_name,onChange:N=>y("first_name",N.target.value),className:`pl-10 ${x.first_name?"border-destructive":""}`})]}),x.first_name&&e.jsx("p",{className:"text-sm text-destructive",children:x.first_name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"last_name",children:"Last Name *"}),e.jsxs("div",{className:"relative",children:[e.jsx(nt,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(he,{id:"last_name",type:"text",placeholder:"Doe",value:c.last_name,onChange:N=>y("last_name",N.target.value),className:`pl-10 ${x.last_name?"border-destructive":""}`})]}),x.last_name&&e.jsx("p",{className:"text-sm text-destructive",children:x.last_name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"job_title",children:"Job Title *"}),e.jsxs("div",{className:"relative",children:[e.jsx(J1,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(he,{id:"job_title",type:"text",placeholder:"Senior Manager",value:c.job_title,onChange:N=>y("job_title",N.target.value),className:`pl-10 ${x.job_title?"border-destructive":""}`})]}),x.job_title&&e.jsx("p",{className:"text-sm text-destructive",children:x.job_title})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"message",children:"Personal Message (Optional)"}),e.jsx(Ut,{id:"message",placeholder:"Welcome to our team! We're excited to have you join us as a company admin...",value:c.message,onChange:N=>y("message",N.target.value),rows:3})]}),e.jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[e.jsx(G,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),e.jsx(G,{type:"submit",disabled:u,className:"bg-primary-mint hover:bg-primary-mint/90",children:u?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ja,{className:"h-4 w-4 mr-2"}),"Send Invitation"]})})]})]})]})})}const tM=[{value:"BE",label:"🇧🇪 Belgium"},{value:"NL",label:"🇳🇱 Netherlands"},{value:"FR",label:"🇫🇷 France"},{value:"DE",label:"🇩🇪 Germany"},{value:"LU",label:"🇱🇺 Luxembourg"}],sM=["DejaVu Sans","Arial","Helvetica","Times New Roman","Georgia","Verdana","Tahoma"];function aM(){const[a,r]=f.useState(!0),[i,o]=f.useState(!1),[c,m]=f.useState(null),[u,g]=f.useState({name:"",legal_name:"",email:"",invoice_email:"",ph
709one:"",address:"",postal_code:"",city:"",country:"",vat_number:"",registration_number:"",kvk_number:"",bank_account:"",bank_bic:"",website:"",primary_color:"#1a365d",secondary_color:"#2d3748",font_family:"DejaVu Sans",invoice_footer:"",invoice_prefix:"",description:""});f.useEffect(()=>{x()},[]);const x=async()=>{try{r(!0);const v=await bf.getSettings();v.success&&v.data&&g(v.data)}catch{console.error("Failed to load company settings:"),m({type:"error",text:"Failed to load company settings"})}finally{r(!1)}},p=(v,w)=>{g(N=>({...N,[v]:w}))},y=async v=>{v.preventDefault(),o(!0),m(null);try{const w=await bf.updateSettings(u);w.success&&(m({type:"success",text:"Company settings updated successfully!"}),g(w.data))}catch{console.error("Failed to update settings:"),m({type:"error",text:"Failed to update company settings"})}finally{o(!1)}};return a?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary-mint"})}):e.jsxs("div",{className:"max-w-6xl mx-auto p-6 space-y-6",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold text-foreground flex items-center gap-2",children:[e.jsx(Js,{className:"h-8 w-8 text-primary-mint"}),"Company Settings"]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Manage your company information for invoices and legal documents"})]})}),c&&e.jsxs("div",{className:`p-4 rounded-lg flex items-center gap-2 ${c.type==="success"?"bg-green-50 text-green-800 border border-green-200":"bg-red-50 text-red-800 border border-red-200"}`,children:[c.type==="success"?e.jsx(Ws,{className:"h-5 w-5"}):e.jsx(Oi,{className:"h-5 w-5"}),c.text]}),e.jsxs("form",{onSubmit:y,children:[e.jsxs(Vi,{defaultValue:"basic",className:"space-y-6",children:[e.jsxs(wl,{className:"grid w-full grid-cols-4",children:[e.jsx(Et,{value:"basic",children:"Basic Info"}),e.jsx(Et,{value:"legal",children:"Legal & Tax"}),e.jsx(Et,{value:"banking",children:"Banking"}),e.jsx(Et,{value:"branding",children:"Branding"})]}),e.jsx(Mt,{value:"basic",className:"space-y-6",children:e.jsxs(Ce,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(Js,{className:"h-5 w-5 text-primary-mint"}),e.jsx("h2",{className:"text-xl font-semibold",children:"Basic Information"})]}),e.jsx(qa,{className:"mb-6"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"name",children:"Company Name *"}),e.jsx(he,{id:"name",value:u.name,onChange:v=>p("name",v.target.value),placeholder:"Your Company Name",required:!0})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"legal_name",children:"Legal Name"}),e.jsx(he,{id:"legal_name",value:u.legal_name||"",onChange:v=>p("legal_name",v.target.value),placeholder:"Legal Business Name"})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"email",children:"Email *"}),e.jsx(he,{id:"email",type:"email",value:u.email,onChange:v=>p("email",v.target.value),placeholder:"[email protected]",required:!0})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"invoice_email",children:"Invoice Email"}),e.jsx(he,{id:"invoice_email",type:"email",value:u.invoice_email||"",onChange:v=>p("invoice_email",v.target.value),placeholder:"[email protected]"})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"phone",children:"Phone"}),e.jsx(he,{id:"phone",value:u.phone||"",onChange:v=>p("phone",v.target.value),placeholder:"+32 2 123 45 67"})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"website",children:"Website"}),e.jsx(he,{id:"website",type:"url",value:u.website||"",onChange:v=>p("website",v.target.value),placeholder:"https://www.company.com"})]})]}),e.jsxs("div",{className:"mt-6",children:[e.jsx(oe,{htmlFor:"address",children:"Address"}),e.jsx(Ut,{id:"address",value:u.address||"",onChange:v=>p("address",v.target.value),placeholder:"Street address",rows:2})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mt-6",children:[e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"postal_code",children:"Postal Code"}),e.jsx(he,{id:"postal_code",value:u.postal_code||"",onChange:v=>p("postal_code",v.target.value),placeholder:"1000"})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"city",children:"City"}),e.jsx(he,{id:"city",value:u.city||"",onChange:v=>p("city",v.target.value),placeholder:"Brussels"})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"country",children:"Country"}),e.jsxs("select",{id:"country",value:u.country||"",onChange:v=>p("country",v.target.value),className:"w-full px-3 py-2 border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring bg-background",children:[e.jsx("option",{value:"",children:"Select Country"}),tM.map(v=>e.jsx("option",{value:v.value,children:v.label},v.value))]})]})]}),e.jsxs("div",{className:"mt-6",children:[e.jsx(oe,{htmlFor:"description",children:"Description"}),e.jsx(Ut,{id:"description",value:u.description||"",onChange:v=>p("description",v.target.value),placeholder:"Brief description of your company",rows:3})]})]})}),e.jsx(Mt,{value:"legal",className:"space-y-6",children:e.jsxs(Ce,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(Ot,{className:"h-5 w-5 text-primary-mint"}),e.jsx("h2",{className:"text-xl font-semibold",children:"Legal & Tax Information"})]}),e.jsx(qa,{className:"mb-6"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"vat_number",children:"VAT Number"}),e.jsx(he,{id:"vat_number",value:u.vat_number||"",onChange:v=>p("vat_number",v.target.value),placeholder:"BE0123456789"})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"registration_number",children:"Company Registration Number"}),e.jsx(he,{id:"registration_number",value:u.registration_number||"",onChange:v=>p("registration_number",v.target.value),placeholder:"0123.456.789"})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"kvk_number",children:"KvK Number (Netherlands)"}),e.jsx(he,{id:"kvk_number",value:u.kvk_number||"",onChange:v=>p("kvk_number",v.target.value),placeholder:"12345678"})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"invoice_prefix",children:"Invoice Number Prefix"}),e.jsx(he,{id:"invoice_prefix",value:u.invoice_prefix||"",onChange:v=>p("invoice_prefix",v.target.value),placeholder:"INV",maxLength:10})]})]}),e.jsxs("div",{className:"mt-6",children:[e.jsx(oe,{htmlFor:"invoice_footer",children:"Invoice Footer Text"}),e.jsx(Ut,{id:"invoice_footer",value:u.invoice_footer||"",onChange:v=>p("invoice_footer",v.target.value),placeholder:"Payment terms and additional information for invoices",rows:3})]})]})}),e.jsx(Mt,{value:"banking",className:"space-y-6",children:e.jsxs(Ce,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(S2,{className:"h-5 w-5 text-primary-mint"}),e.jsx("h2",{className:"text-xl font-semibold",children:"Banking Information"})]}),e.jsx(qa,{className:"mb-6"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"bank_account",children:"Bank Account (IBAN)"}),e.jsx(he,{id:"bank_account",value:u.bank_account||"",onChange:v=>p("bank_account",v.target.value),placeholder:"BE68 5390 0754 7034"})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"bank_bic",children:"BIC/SWIFT Code"}),e.jsx(he,{id:"bank_bic",value:u.bank_bic||"",onChange:v=>p("bank_bic",v.target.value),placeholder:"GKCCBEBB"})]})]})]})}),e.jsx(Mt,{value:"branding",className:"space-y-6",children:e.jsxs(Ce,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(zi,{className:"h-5 w-5 text-primary-mint"}),e.jsx("h2",{className:"text-xl font-semibold",children:"Branding & Design"})]}),e.jsx(qa,{className:"mb-6"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"primary_color",children:"Primary Color"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(he,{id:"primary_color",type:"color",value:u.primary_color,onChange:v=>p("primary_color",v.target.value),className:"w-16 h-10 p-1 rounded-md border"}),e.jsx(he,{value:u.primary_color,onChange:v=>p("primary_color",v.target.value),placeholder:"#1a365d",className:"flex-1"})]})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"secondary_color",children:"Secondary Color"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(he,{id:"secondary_color",type:"color",value:u.secondary_color,onChange:v=>p("secondary_color",v.target.value),className:"w-16 h-10 p-1 rounded-md border"}),e.jsx(he,{value:u.secondary_color,onChange:v=>p("secondary_color",v.target.value),placeholder:"#2d3748",className:"flex-1"})]})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx(oe,{htmlFor:"font_family",children:"Font Family"}),e.jsx("select",{id:"font_family",value:u.font_family,onChange:v=>p("font_family",v.target.value),className:"w-full px-3 py-2 border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring bg-background",children:sM.map(v=>e.jsx("option",{value:v,children:v},v))})]})]})]})})]}),e.jsx("div",{className:"flex justify-end pt-6",children:e.jsxs(G,{type:"submit",disabled:i,className:"bg-primary-mint hover:bg-primary-mint/90 text-primary-navy",children:[e.jsx(Nr,{className:"h-4 w-4 mr-2"}),i?"Saving...":"Save Settings"]})})]})]})}function nM(){const{user:a,updateProfile:r}=ts(),[i,o]=f.useState(!1),[c,m]=f.useState(!1),[u,g]=f.useState({first_name:"",last_name:"",email:"",ph
709one:"",job_title:"",bio:"",timezone:"",language:"en",notification_email:!0,notification_push:!0});f.useEffect(()=>{a&&g({first_name:a.first_name||a.firstName||"",last_name:a.last_name||a.lastName||"",email:a.email||"",phone:a.phone||"",job_title:a.job_title||a.jobTitle||"",bio:a.bio||"",timezone:a.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone,language:a.language||"en",notification_email:a.notification_email??!0,notification_push:a.notification_push??!0})},[a]);const x=(N,D)=>{g(b=>({...b,[N]:D}))},p=async()=>{m(!0);try{const N=await ve.updateProfile(u);N.success&&(await r(N.data.user),Nt.success("Profile updated successfully!"),o(!1))}catch{Nt.error("Failed to update profile")}finally{m(!1)}},y=()=>{g({first_name:a.first_name||a.firstName||"",last_name:a.last_name||a.lastName||"",email:a.email||"",phone:a.phone||"",job_title:a.job_title||a.jobTitle||"",bio:a.bio||"",timezone:a.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone,language:a.language||"en",notification_email:a.notification_email??!0,notification_push:a.notification_push??!0}),o(!1)},v=N=>{if(!N)return"Never";try{return new Date(N).toLocaleString()}catch{return"Unknown"}},w=N=>{const b={admin:{color:"bg-red-100 text-red-800",label:"Administrator"},manager:{color:"bg-blue-100 text-blue-800",label:"Manager"},employee:{color:"bg-green-100 text-green-800",label:"Employee"},client:{color:"bg-purple-100 text-purple-800",label:"Client"}}[N?.toLowerCase()]||{color:"bg-gray-100 text-gray-800",label:N||"User"};return e.jsx(ze,{className:b.color,children:b.label})};return e.jsxs("div",{className:"max-w-4xl mx-auto p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-card-foreground",children:"My Profile"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage your account settings and preferences"})]}),e.jsx("div",{className:"flex gap-2",children:i?e.jsxs(e.Fragment,{children:[e.jsxs(G,{variant:"outline",onClick:y,disabled:c,children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Cancel"]}),e.jsxs(G,{onClick:p,disabled:c||uploadingAvatar,children:[c||uploadingAvatar?e.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin mr-2"}):e.jsx(Nr,{className:"h-4 w-4 mr-2"}),"Save Changes"]})]}):e.jsxs(G,{onClick:()=>o(!0),children:[e.jsx(ya,{className:"h-4 w-4 mr-2"}),"Edit Profile"]})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx("div",{className:"lg:col-span-1",children:e.jsx(Ce,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[e.jsx("div",{className:"w-32 h-32 rounded-full overflow-hidden bg-muted flex items-center justify-center",children:e.jsx(nt,{className:"h-16 w-16 text-muted-foreground"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-card-foreground",children:a?.name||`${a?.first_name||""} ${a?.last_name||""}`.trim()||"User"}),e.jsx("p",{className:"text-muted-foreground",children:a?.job_title||"No title set"}),e.jsx("div",{className:"mt-2",children:w(a?.role)})]}),e.jsx(qa,{}),e.jsxs("div",{className:"w-full space-y-3 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ps,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Company:"}),e.jsx("span",{className:"font-medium",children:a?.company?.name||"No company"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(os,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Joined:"}),e.jsx("span",{className:"font-medium",children:a?.created_at?new Date(a.created_at).toLocaleDateString():"Unknown"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xs,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Last login:"}),e.jsx("span",{className:"font-medium",children:v(a?.last_login_at)})]}),a?.is_company_admin&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ga,{className:"h-4 w-4 text-blue-600"}),e.jsx("span",{className:"font-medium text-blue-600",children:"Company Administrator"})]})]})]})})}),e.jsx("div",{className:"lg:col-span-2",children:e.jsx(Ce,{className:"p-6",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"text-lg font-semibold text-card-foreground mb-4 flex items-center gap-2",children:[e.jsx(nt,{className:"h-5 w-5"}),"Personal Information"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"first_name",children:"First Name"}),e.jsx(he,{id:"first_name",value:u.first_name,onChange:N=>x("first_name",N.target.value),disabled:!i})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"last_name",children:"Last Name"}),e.jsx(he,{id:"last_name",value:u.last_name,onChange:N=>x("last_name",N.target.value),disabled:!i})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"email",children:"Email Address"}),e.jsx(he,{id:"email",type:"email",value:u.email,onChange:N=>x("email",N.target.value),disabled:!i})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"phone",children:"Phone Number"}),e.jsx(he,{id:"phone",value:u.phone,onChange:N=>x("phone",N.target.value),disabled:!i,placeholder:"+1 (555) 123-4567"})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx(oe,{htmlFor:"job_title",children:"Job Title"}),e.jsx(he,{id:"job_title",value:u.job_title,onChange:N=>x("job_title",N.target.value),disabled:!i,placeholder:"Software Engineer, Project Manager, etc."})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx(oe,{htmlFor:"bio",children:"Bio"}),e.jsx(Ut,{id:"bio",value:u.bio,onChange:N=>x("bio",N.target.value),disabled:!i,placeholder:"Tell us a bit about yourself...",rows:3})]})]})]}),e.jsx(qa,{}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-lg font-semibold text-card-foreground mb-4 flex items-center gap-2",children:[e.jsx(o0,{className:"h-5 w-5"}),"Preferences"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"timezone",children:"Timezone"}),e.jsxs("select",{id:"timezone",value:u.timezone,onChange:N=>x("timezone",N.target.value),disabled:!i,className:"w-full px-3 py-2 border border-input bg-background rounded-md",children:[e.jsx("option",{value:"America/Ne
709w_York",children:"Eastern Time (ET)"}),e.jsx("option",{value:"America/Chicago",children:"Central Time (CT)"}),e.jsx("option",{value:"America/Denver",children:"Mountain Time (MT)"}),e.jsx("option",{value:"America/Los_Angeles",children:"Pacific Time (PT)"}),e.jsx("option",{value:"Europe/London",children:"London (GMT)"}),e.jsx("option",{value:"Europe/Paris",children:"Paris (CET)"}),e.jsx("option",{value:"Europe/Berlin",children:"Berlin (CET)"}),e.jsx("option",{value:"Asia/Tokyo",children:"Tokyo (JST)"}),e.jsx("option",{value:"Australia/Sydney",children:"Sydney (AEDT)"})]})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"language",children:"Language"}),e.jsxs("select",{id:"language",value:u.language,onChange:N=>x("language",N.target.value),disabled:!i,className:"w-full px-3 py-2 border border-input bg-background rounded-md",children:[e.jsx("option",{value:"en",children:"English"}),e.jsx("option",{value:"es",children:"Español"}),e.jsx("option",{value:"fr",children:"Français"}),e.jsx("option",{value:"de",children:"Deutsch"}),e.jsx("option",{value:"it",children:"Italiano"}),e.jsx("option",{value:"pt",children:"Português"}),e.jsx("option",{value:"nl",children:"Nederlands"})]})]})]})]}),e.jsx(qa,{}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-lg font-semibold text-card-foreground mb-4",children:"Notification Preferences"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("label",{className:"font-medium",children:"Email Notifications"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Receive updates via email"})]}),e.jsx("input",{type:"checkbox",checked:u.notification_email,onChange:N=>x("notification_email",N.target.checked),disabled:!i,className:"h-4 w-4"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("label",{className:"font-medium",children:"Push Notifications"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Receive browser notifications"})]}),e.jsx("input",{type:"checkbox",checked:u.notification_push,onChange:N=>x("notification_push",N.target.checked),disabled:!i,className:"h-4 w-4"})]})]})]})]})})})]})]})}function rM(){const{user:a,refreshUser:r}=ts(),[i,o]=f.useState(!1),[c,m]=f.useState(!1),[u,g]=f.useState(!1),[x,p]=f.useState({currentPassword:"",newPassword:"",confirmPassword:""}),[y,v]=f.useState(!1),[w,N]=f.useState(""),D=async E=>{if(E.preventDefault(),x.newPassword!==x.confirmPassword){N("New passwords do not match");return}if(x.newPassword.length<8){N("Password must be at least 8 characters long");return}v(!0),N("");try{const _=await ve.request("/auth/change-password",{method:"POST",body:JSON.stringify({current_password:x.currentPassword,new_password:x.newPassword,new_password_confirmation:x.confirmPassword})});N("Password updated successfully"),p({currentPassword:"",newPassword:"",confirmPassword:""}),r()}catch(_){N(_.message||"Failed to update password")}finally{v(!1)}},b=E=>new Date(E).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});return e.jsxs("div",{className:"p-4 lg:p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx(Ga,{className:"h-7 w-7 text-primary-mint"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Security Settings"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage your account security and view login activity"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[e.jsxs(Ce,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(rS,{className:"h-5 w-5 text-primary-mint"}),e.jsx("h2",{className:"text-lg font-semibold text-card-foreground",children:"Change Password"})]}),e.jsxs("form",{onSubmit:D,className:"space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"currentPassword",children:"Current Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(he,{id:"currentPassword",type:i?"text":"password",value:x.currentPassword,onChange:E=>p(_=>({..._,currentPassword:E.target.value})),required:!0}),e.jsx("button",{type:"button",className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-muted-foreground hover:text-foreground",onClick:()=>o(!i),children:i?e.jsx(Zs,{className:"h-4 w-4"}):e.jsx(rs,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"newPassword",children:"New Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(he,{id:"newPassword",type:c?"text":"password",value:x.newPassword,onChange:E=>p(_=>({..._,newPassword:E.target.value})),required:!0,minLength:8}),e.jsx("button",{type:"button",className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-muted-foreground hover:text-foreground",onClick:()=>m(!c),children:c?e.jsx(Zs,{className:"h-4 w-4"}):e.jsx(rs,{className:"h-4 w-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Password must be at least 8 characters long"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"confirmPassword",children:"Confirm New Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(he,{id:"confirmPassword",type:u?"text":"password",value:x.confirmPassword,onChange:E=>p(_=>({..._,confirmPassword:E.target.value})),required:!0,minLength:8}),e.jsx("button",{type:"button",className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-muted-foreground hover:text-foreground",onClick:()=>g(!u),children:u?e.jsx(Zs,{className:"h-4 w-4"}):e.jsx(rs,{className:"h-4 w-4"})})]})]}),w&&e.jsx("div",{className:`text-sm p-2 rounded-md text-center ${w.includes("successfully")?"bg-green-50 text-green-800 border border-green-200":"bg-red-50 text-red-800 border border-red-200"}`,children:w}),e.jsx(G,{type:"submit",disabled:y,className:"w-full",children:y?"Updating...":"Update Password"})]})]}),e.jsxs(Ce,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(Ga,{className:"h-5 w-5 text-primary-mint"}),e.jsx("h2",{className:"text-lg font-semibold text-card-foreground",children:"Security Overview"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between p-2 bg-green-50 dark:bg-green-950 rounded-lg border border-green-200 dark:border-green-800",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-1 bg-green-100 dark:bg-green-900 rounded-full",children:e.jsx(br,{className:"h-3 w-3 text-green-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-green-800 dark:text-green-200",children:"Password Protected"}),e.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:"Your account is secured"})]})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Account Created"}),e.jsx("span",{className:"text-xs font-medium text-card-foreground",children:a?.created_at?b(a.created_at):"N/A"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Last Password Change"}),e.jsx("span",{className:"text-xs font-medium text-card-foreground",children:a?.password_updated_at?b(a.password_updated_at):"Never changed"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Last Login"}),e.jsx("span",{className:"text-xs font-medium text-card-foreground",children:"N/A"})]})]})]})]})]})]})}var Di={},Ei={},Qv;function lM(){return Qv||(Qv=1,Object.defineProperty(Ei,"__esModule",{value:!0}),Ei.regionAPIs=void 0,Ei.regionAPIs=new Map([["us","https://api-iam.intercom.io"],["eu","https://api-iam.eu.intercom.io"],["ap","https://api-iam.au.intercom.io"]])),Ei}var Ia={},Jv;function iM(){if(Jv)return Ia;Jv=1;var a=Ia&&Ia.__awaiter||function(u,g,x,p){function y(v){return v instanceof x?v:ne
709w x(function(w){w(v)})}return new(x||(x=Promise))(function(v,w){function N(E){try{b(p.next(E))}catch(_){w(_)}}function D(E){try{b(p.throw(E))}catch(_){w(_)}}function b(E){E.done?v(E.value):y(E.value).then(N,D)}b((p=p.apply(u,g||[])).next())})};Object.defineProperty(Ia,"__esModule",{value:!0}),Ia.ref=Ia.init=void 0;const r="_intercom_npm_loader",i=function(){i.loaderQueue(arguments)};i.q=[],i.loaderQueue=function(u){i.q.push(u)};const o=function(){var u,g,x=document;if(!x.getElementById(r)){var p=x.createElement("script");p.type="text/javascript",p.async=!0,p.id=r,p.src="https://widget.intercom.io/widget/"+((u=window.intercomSettings)===null||u===void 0?void 0:u.app_id);var y=x.getElementsByTagName("script")[0];(g=y.parentNode)===null||g===void 0||g.insertBefore(p,y)}},c=()=>document.readyState==="complete"||document.readyState==="interactive",m=()=>a(void 0,void 0,void 0,function*(){var u=window,g=u.Intercom;u.intercomSettings&&(u.intercomSettings.installation_type="npm-package"),typeof g=="function"?(g("reattach_activator"),g("update",u.intercomSettings)):(u.Intercom=i,c()?o():(document.addEventListener("readystatechange",function(){c()&&o()}),u.attachEvent?u.attachEvent("onload",o):u.addEventListener("load",o,!1)))});return Ia.init=m,Ia.ref=void 0,Ia}var Wv;function oM(){return Wv||(Wv=1,function(a){var r=Di&&Di.__rest||function(I,ue){var X={};for(var P in I)Object.prototype.hasOwnProperty.call(I,P)&&ue.indexOf(P)<0&&(X[P]=I[P]);if(I!=null&&typeof Object.getOwnPropertySymbols=="function")for(var $=0,P=Object.getOwnPropertySymbols(I);$<P.length;$++)ue.indexOf(P[$])<0&&Object.prototype.propertyIsEnumerable.call(I,P[$])&&(X[P[$]]=I[P[$]]);return X};Object.defineProperty(a,"__esModule",{value:!0}),a.hideNotifications=a.onUserEmailSupplied=a.showConversation=a.showTicket=a.startChecklist=a.startSurvey=a.showNews=a.showArticle=a.startTour=a.whoami=a.getVisitorId=a.trackEvent=a.onUnreadCountChange=a.onShow=a.onHide=a.showNewMessage=a.showMessages=a.showSpace=a.show=a.hide=a.update=a.shutdown=a.boot=a.Intercom=void 0;const i=lM(),o=iM(),c=(I,...ue)=>{typeof window!==void 0&&window.Intercom?window.Intercom(I,...ue):console.warn("Please ensure Intercom is setup and running on client-side!")},m=I=>{if(typeof I!="object"){console.warn("Intercom initialiser called with invalid parameters.");return}const{region:ue="us"}=I,X=r(I,["region"]);typeof window<"u"&&!o.ref&&(window.intercomSettings=Object.assign(Object.assign({},X),{api_base:i.regionAPIs.get(ue)}),(0,o.init)())};a.Intercom=m,a.default=a.Intercom;const u=I=>c("boot",I);a.boot=u;const g=()=>c("shutdown");a.shutdown=g;const x=I=>c("update",I);a.update=x;const p=()=>c("hide");a.hide=p;const y=()=>c("show");a.show=y;const v=I=>c("showSpace",I);a.showSpace=v;const w=()=>c("showMessages");a.showMessages=w;const N=I=>c("showNewMessage",I);a.showNewMessage=N;const D=I=>c("onHide",I);a.onHide=D;const b=I=>c("onShow",I);a.onShow=b;const E=I=>c("onUnreadCountChange",I);a.onUnreadCountChange=E;const _=(...I)=>c("trackEvent",...I);a.trackEvent=_;const M=()=>c("getVisitorId");a.getVisitorId=M;const k=()=>c("whoami");a.whoami=k;const C=I=>c("startTour",I);a.startTour=C;const j=I=>c("showArticle",I);a.showArticle=j;const O=I=>c("showNews",I);a.showNews=O;const L=I=>c("startSurvey",I);a.startSurvey=L;const R=I=>c("startChecklist",I);a.startChecklist=R;const H=I=>c("showTicket",I);a.showTicket=H;const z=I=>c("showConversation",I);a.showConversation=z;const V=I=>c("onUserEmailSupplied",I);a.onUserEmailSupplied=V;const Z=I=>c("hideNotifications",I);a.hideNotifications=Z}(Di)),Di}oM();let e0=!1;const gN=()=>{const{user:a,isAuthenticated:r}=ts(),[i,o]=f.useState(!1),[c,m]=f.useState(!1),u=f.useRef(0);return f.useEffect(()=>{const g=x=>{if(x.error&&(x.error.stack?.includes("intercom")||x.error.stack?.includes("frame-modern")||x.error.stack?.includes("messenger-js-sdk")||x.error.message?.includes("http_post_session_empty"))){console.warn("Intercom-related error caught:"),x.preventDefault(),e0=!0,localStorage.setItem("intercom_disabled","true");try{window.Intercom&&window.Intercom("shutdown")}catch{}}};return window.addEventListener("error",g),window.addEventListener("unhandledrejection",x=>{x.reason&&x.reason.message?.includes("intercom")&&(console.warn("Intercom promise rejection caught:"),x.preventDefault())}),()=>{window.removeEventListener("error",g)}},[]),f.useEffect(()=>{a?.id&&(m(!1),u.current=0)},[a?.id]),f.useEffect(()=>{if(!(e0||!r||!a?.id||!a?.email||i||c)){console.warn("Intercom app ID not configured. Intercom support will be disabled.");return}},[r,a?.id,a?.email,i,c]),f.useEffect(()=>{if(!(!r||!a?.id||!i||!window.Intercom))try{const g=a.name||`${a.firstName||a.first_name||""} ${a.lastName||a.last_name||""}`.trim()||"Unknown User";window.Intercom("update",{user_id:String(a.id),name:g,email:a.email})}catch(g){console.warn("Error updating Intercom user data:",g)}},[a?.name,a?.firstName,a?.lastName,a?.email,r,i]),null};function t0({children:a}){const{user:r}=ts(),[i,o]=f.useState("dashboard"),[c,m]=f.useState("dashboard"),[u,g]=f.useState(null),[x,p]=f.useState(!1),[y,v]=f.useState(null),[w,N]=f.useState(0),[D,b]=f.useState(null),[E,_]=f.useState(!1),[M,k]=f.useState(null),[C,j]=f.useState(0),[O,L]=f.useState(null),[R,H]=f.useState(!1),[z,V]=f.useState(null),[Z,I]=f.useState([]),[ue,X]=f.useState(0),[P,$]=f.useState(null),[F,ne]=f.useState(!1),[T,B]=f.useState(null),[ee,te]=f.useState("document"),[ye,ge]=f.useState([]),[K,re]=f.useState(0),[je,Ae]=f.useState(!1),[ie,we]=f.useState(!1),[_e,me]=f.useState(null),[Se,Pe]=f.useState(!1),[pt,Ve]=f.useState(null),[bt,ds]=f.useState(null),[le,Le]=f.useState(!1);f.useEffect(()=>{const Ue=Ts=>{const{page:wa,action:fd}=Ts.detail,Qi={clients:"clients",projects:"projects",tasks:"tasks",invoicing:"invoicing",messages:"messages"};if(Qi[wa]&&(o(Qe(wa)),m(Qi[wa]),fd==="add"))switch(wa){case"clients":g(null),v(null),setTimeout(()=>{p(!0)},100);break;case"projects":b(null),k(null),g(null),setTimeout(()=>{_(!0)},100);break;case"tasks":L(null),V(null),setTimeout(()=>{H(!0)},100);break;case"invoicing":Ve(null),ds(null);break}},Qe=Ts=>({clients:"Clients",projects:"Projects",tasks:"Tasks",invoicing:"Invoicing",messages:"Messages"})[Ts]||"dashboard";return window.addEventListener("navigate",Ue),()=>{window.removeEventListener("navigate",Ue)}},[]);const Ye=(Ue,Qe)=>{if(o(Qe),g(null),b(null),L(null),$(null),Ve(null),ds(null),Ue.includes("/settings/")){const Ts=Ue.replace("/settings/","");m(`settings-${Ts}`)}else m(Qe.toLowerCase())},Ne=()=>{Le(!le)},jt=Ue=>{g(Ue),m("client-detail")},Wa=()=>{g(null),m("clients")},ra=(Ue=null)=>{v(Ue),p(!0)},qt=Ue=>{Nt.success(`Client ${y?"updated":"added"} successfully!`),p(!1),v(null),N(Qe=>Qe+1)},ls=Ue=>{b(Ue),m("project-detail")},Xt=Ue=>{L(Ue),m("task-detail")},_l=()=>{L(null),m("tasks")},Bn=()=>{b(null),m("projects")},Cr=(Ue=null)=>{k(Ue),_(!0)},Na=Ue=>{_(!1),k(null),c==="project-detail"&&j(Qe=>Qe+1)},en=(Ue=null,Qe=null)=>{o("Invoicing"),m("invoicing"),Ve(Ue),ds(Qe),g(null),b(null),L(null),$(null)},J=Ue=>{o("Invoicing"),m("invoicing"),Ve(null),ds(Ue),g(null),b(null),L(null),$(null)},be=(Ue=null)=>{V(Ue),H(!0)},pe=Ue=>{Nt.success(`Task ${z?"updated":"added"} successfully!`),V(null),H(!1),X(Qe=>Qe+1)},ke=Ue=>{I(Ue)},Re=Ue=>{$(Ue.id),m("document-detail")},Kt=()=>{$(null),m("documents")},He=Ue=>{B(Ue),te("document"),ne(!0)},tt=Ue=>{alert(`${ee==="folder"?"Folder":"Document"} ${T?"updated":"created"} successfully!`),B(null),ne(!1),re(Qe=>Qe+1)},st=Ue=>{ge(Ue)},rt=()=>{Ae(!0)},Ki=()=>{console.log("Opening colleague invite form. User context:",{user:r,isCompanyAdmin:r?.is_company_admin,company:r?.company,companyId:r?.companyId}),Pe(!0)},Dl=Ue=>{me(Ue),we(!0)},El=()=>{Ae(!1)},Zi=()=>{Pe(!1)},md=()=>{we(!1),me(null)},la=()=>{switch(c){case"settings-theme":return e.jsx(mk,{});case"settings-company":return e.jsx(aM,{});case"clients":return e.jsxs(e.Fragment,{children:[e.jsx($_,{onSelectClient:jt,onAddClient:ra,refreshTrigger:w}),e.jsx(nf,{open:x,onOpenChange:p,client:y,onSave:qt})]});case"client-detail":return e.jsxs(e.Fragment,{children:[e.jsx(e3,{clientId:u,onBack:Wa,onEdit:ra,onNavigateToInvoice:en,onCreateInvoiceForClient:J,onNavigateToProject:ls}),e.jsx(nf,{open:x,onOpenChange:p,client:y,onSave:qt})]});case"projects":return e.jsxs(e.Fragment,{children:[e.jsx(Ff,{onSelectProject:ls,onAddProject:Cr}),E&&e.jsx(lf,{project:M,onClose:()=>{_(!1),k(null)},onSave:Na})]});case"project-detail":return e.jsxs(e.Fragment,{children:[e.jsx(i3,{projectId:D,onBack:Bn,onEdit:Cr,refreshTrigger:C}),E&&e.jsx(lf,{project:M,onClose:()=>{_(!1),k(null)},onSave:Na})]});case"tasks":return e.jsxs(e.Fragment,{children:[e.jsx(d5,{onTasksLoaded:ke,onAddTask:be,refreshTrigger:ue}),R&&e.jsx(of,{task:z,onClose:()=>{H(!1),V(null)},onSave:pe})]});case"task-detail":return e.jsxs(e.Fragment,{children:[e.jsx(u5,{taskId:O,onBack:_l,onEdit:be,refreshTrigger:ue}),R&&e.jsx(of,{task:z,onClose:()=>{H(!1),V(null)},onSave:pe})]});case"documents":return e.jsxs(e.Fragment,{children:[e.jsx(y5,{onDocumentClick:Qe=>{Re(Qe)},onDocumentsLoaded:st}),F&&e.jsx(cf,{isOpen:F,onClose:()=>{ne(!1),B(null)},document:T,mode:ee,onSave:tt,onDocumentSaved:()=>re(Qe=>Qe+1)})]});case"document-detail":const Ue=ye.find(Qe=>Qe.id===P);return e.jsxs(e.Fragment,{children:[e.jsx(UE,{document:Ue,onBack:Kt,onEdit:He}),F&&e.jsx(cf,{isOpen:F,onClose:()=>{ne(!1),B(null)},document:T,mode:ee,onSave:tt,onDocumentSaved:()=>re(Qe=>Qe+1)})]});case"messages":return e.jsx(cN,{onNavigateToProject:ls,onNavigateToTask:Xt,onNavigateToClient:jt,onNavigateToInvoice:Qe=>{m("invoicing")}});case"invoicing":return e.jsx(jf,{selectedInvoiceId:pt,preSelectedClientId:bt});case"team":return e.jsxs(e.Fragment,{children:[e.jsx(GE,{onInviteMember:rt,onInviteColleague:Ki,onEditMember:Dl}),e.jsx(YE,{open:je,onClose:()=>Ae(!1),onSuccess:El}),e.jsx(eM,{open:Se,onClose:()=>Pe(!1),onSuccess:Zi,company:{id:r?.companyId||r?.company?.id,name:typeof r?.company=="string"?r.company:r?.company?.name}}),e.jsx(WE,{open:ie,onClose:()=>we(!1),onSuccess:md,member:_e})]});case"settings-profile":return e.jsx(nM,{});case"settings-security":return e.jsx(rM,{});case"settings-billing":return e.jsxs("div",{className:"p-8",children:[e.jsx("h1",{className:"text-3xl font-bold text-primary-navy mb-4",children:"Billing"}),e.jsx("p",{className:"text-neutral-dark",children:"Billing settings coming soon..."}),e.jsxs("div",{className:"mt-6 bg-card rounded-lg shadow-sm p-6 border border-border",children:[e.jsx("h3",{className:"text-lg font-semibold text-card-foreground mb-2",children:"Preview"}),e.jsx("p",{className:"text-muted-foreground",children:"This page will handle subscription management and payment methods."})]})]});case"settings-integrations":return e.jsxs("div",{className:"p-8",children:[e.jsx("h1",{className:"text-3xl font-bold text-primary-navy mb-4",children:"Integrations"}),e.jsx("p",{className:"text-neutral-dark",children:"Integration settings coming soon..."}),e.jsxs("div",{className:"mt-6 bg-card rounded-lg shadow-sm p-6 border border-border",children:[e.jsx("h3",{className:"text-lg font-semibold text-card-foreground mb-2",children:"Preview"}),e.jsx("p",{className:"text-muted-foreground",children:"This page will connect with third-party services and APIs."})]})]});case"settings-notifications":return e.jsxs("div",{className:"p-8",children:[e.jsx("h1",{className:"text-3xl font-bold text-primary-navy mb-4",children:"Notifications"}),e.jsx("p",{className:"text-neutral-dark",children:"Notification settings coming soon..."}),e.jsxs("div",{className:"mt-6 bg-card rounded-lg shadow-sm p-6 border border-border",children:[e.jsx("h3",{className:"text-lg font-semibold text-card-foreground mb-2",children:"Preview"}),e.jsx("p",{className:"text-muted-foreground",children:"This page will configure email and push notification preferences."})]})]});default:return a}};return e.jsxs("div",{className:"flex h-screen",children:[e.jsx(UC,{activeItem:i,onNavigate:Ye,isCollapsed:le,onToggleCollapse:Ne}),e.jsx("main",{className:`
710          flex-1 overflow-y-auto transition-all duration-300
711          ${le?"lg:ml-16":"lg:ml-64"}
712        `,children:e.jsx("div",{className:"min-h-full flex justify-center",children:e.jsx("div",{className:"w-full max-w-7xl px-4 lg:px-8 pt-16 lg:pt-0",children:la()})})}),e.jsx(gN,{})]})}function cM(){const{user:a,updateProfile:r}=ts(),[i,o]=f.useState(!1),[c,m]=f.useState(""),[u,g]=f.useState(!1),[x,p]=f.useState(!1),[y,v]=f.useState(!1),[w,N]=f.useState({first_name:a?.firstName||"",last_name:a?.lastName||"",email:a?.email||"",phone:a?.phone||"",job_title:a?.job_title||""}),[D,b]=f.useState({current_password:"",new_password:"",new_password_confirmation:""}),[E,_]=f.useState("profile"),M=async j=>{j.preventDefault(),o(!0),m("");try{await r(w),m({type:"success",text:"Profile updated successfully!"})}catch(O){m({type:"error",text:O.response?.data?.message||"Failed to update profile"})}finally{o(!1)}},k=async j=>{if(j.preventDefault(),D.new_password!==D.new_password_confirmation){m({type:"error",text:"New passwords do not match"});return}if(D.new_password.length<8){m({type:"error",text:"Password must be at least 8 characters long"});return}o(!0),m("");try{m({type:"success",text:"Password changed successfully!"}),b({current_password:"",new_password:"",new_password_confirmation:""})}catch(O){m({type:"error",text:O.response?.data?.message||"Failed to change password"})}finally{o(!1)}},C=[{id:"profile",name:"Profile Information",icon:nt},{id:"security",name:"Password & Security",icon:ma}];return e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:"Account Settings"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Manage your account information and security settings"})]}),c&&e.jsxs("div",{className:`mb-6 p-4 rounded-lg flex items-center gap-3 ${c.type==="success"?"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200 border border-green-200 dark:border-green-800":"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200 border border-red-200 dark:border-red-800"}`,children:[c.type==="success"?e.jsx(br,{className:"h-5 w-5 flex-shrink-0"}):e.jsx(es,{className:"h-5 w-5 flex-shrink-0"}),e.jsx("span",{children:c.text})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 shadow-sm",children:[e.jsx("div",{className:"border-b border-gray-200 dark:border-gray-700",children:e.jsx("nav",{className:"flex space-x-8 px-6",children:C.map(j=>{const O=j.icon;return e.jsx("button",{onClick:()=>_(j.id),className:`py-4 px-1 border-b-2 font-medium text-sm transition-colors ${E===j.id?"border-primary-mint text-primary-mint":"border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{className:"h-4 w-4"}),j.name]})},j.id)})})}),e.jsxs("div",{className:"p-6",children:[E==="profile"&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-6",children:"Profile Information"}),e.jsxs("form",{onSubmit:M,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"First Name"}),e.jsxs("div",{className:"relative",children:[e.jsx(nt,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(he,{type:"text",value:w.first_name,onChange:j=>N({...w,first_name:j.target.value}),className:"pl-10",required:!0})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Last Name"}),e.jsxs("div",{className:"relative",children:[e.jsx(nt,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(he,{type:"text",value:w.last_name,onChange:j=>N({...w,last_name:j.target.value}),className:"pl-10",required:!0})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Email Address"}),e.jsxs("div",{className:"relative",children:[e.jsx(Lt,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h
712-4 w-4 text-gray-400"}),e.jsx(he,{type:"email",value:w.email,onChange:j=>N({...w,email:j.target.value}),className:"pl-10",required:!0})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Phone Number"}),e.jsxs("div",{className:"relative",children:[e.jsx(wf,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(he,{type:"tel",value:w.phone,onChange:j=>N({...w,phone:j.target.value}),className:"pl-10",placeholder:"Optional"})]})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Job Title"}),e.jsxs("div",{className:"relative",children:[e.jsx(Js,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(he,{type:"text",value:w.job_title,onChange:j=>N({...w,job_title:j.target.value}),className:"pl-10",placeholder:"Optional"})]})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(G,{type:"submit",disabled:i,className:"bg-primary-mint hover:bg-primary-mint/90 text-white",children:i?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Saving..."]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Nr,{className:"h-4 w-4"}),"Save Changes"]})})})]})]}),E==="security"&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-6",children:"Change Password"}),e.jsxs("form",{onSubmit:k,className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Current Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(ma,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(he,{type:u?"text":"password",value:D.current_password,onChange:j=>b({...D,current_password:j.target.value}),className:"pl-10 pr-10",required:!0}),e.jsx("button",{type:"button",onClick:()=>g(!u),className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",children:u?e.jsx(Zs,{className:"h-4 w-4"}):e.jsx(rs,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"New Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(ma,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(he,{type:x?"text":"password",value:D.new_password,onChange:j=>b({...D,new_password:j.target.value}),className:"pl-10 pr-10",required:!0,minLength:8}),e.jsx("button",{type:"button",onClick:()=>p(!x),className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",children:x?e.jsx(Zs,{className:"h-4 w-4"}):e.jsx(rs,{className:"h-4 w-4"})})]}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Password must be at least 8 characters long"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Confirm New Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(ma,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(he,{type:y?"text":"password",value:D.new_password_confirmation,onChange:j=>b({...D,new_password_confirmation:j.target.value}),className:"pl-10 pr-10",required:!0}),e.jsx("button",{type:"button",onClick:()=>v(!y),className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",children:y?e.jsx(Zs,{className:"h-4 w-4"}):e.jsx(rs,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(G,{type:"submit",disabled:i,className:"bg-primary-mint hover:bg-primary-mint/90 text-white",children:i?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Changing..."]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ma,{className:"h-4 w-4"}),"Change Password"]})})})]})]})]})]}),e.jsxs("div",{className:"mt-8 bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 shadow-sm p-6",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:"Account Information"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Company"}),e.jsx("p",{className:"text-sm text-gray-900 dark:text-gray-100",children:a?.company?.name||a?.companyName||"N/A"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Account Type"}),e.jsx("p",{className:"text-sm text-gray-900 dark:text-gray-100",children:"Client Portal Access"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Member Since"}),e.jsx("p",{className:"text-sm text-gray-900 dark:text-gray-100",children:a?.created_at?new Date(a.created_at).toLocaleDateString():"N/A"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Status"}),e.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",children:"Active"})]})]})]})]})}function dM(){const[a,r]=f.useState("invoices"),[i,o]=f.useState(!1),[c,m]=f.useState(!1),{user:u,logout:g}=ts(),{isDarkMode:x,toggleDarkMode:p}=Mf(),y=[{id:"invoices",title:"My Bills",icon:Ot,description:"View your invoices and payment history"},{id:"projects",title:"My Projects",icon:Va,description:"Track your project progress and files"}
712,{id:"messages",title:"Messages",icon:Fa,description:"Communicate with your service provider"},{id:"account",title:"Account Settings",icon:nt,description:"Manage your account information and security"}],v=D=>{r(D),o(!1)},w=()=>{const D=u?.client_id||u?.id;switch(a){case"invoices":return e.jsx(jf,{isClientView:!0,clientId:D});case"projects":return e.jsx(Ff,{isClientView:!0,clientId:D,onSelectProject:b=>{alert(`Viewing project ${b} details`)}});case"messages":return e.jsx(cN,{isClientView:!0,clientId:D,onNavigateToProject:b=>{r("projects"),setTimeout(()=>{alert(`Showing project #${b} details`)},100)},onNavigateToTask:b=>{alert(`Task #${b.id} is referenced. Please check the related project for more details.`)},onNavigateToClient:b=>{alert(`Client reference #${b}`)},onNavigateToInvoice:b=>{r("invoices"),setTimeout(()=>{alert(`Showing invoice #${b} details`)},100)}});case"account":return e.jsx(cM,{});default:return e.jsx(jf,{isClientView:!0,clientId:D})}},N=y.find(D=>D.id===a);return e.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900",children:[e.jsx("header",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 sticky top-0 z-50",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[e.jsxs("div",{className:"flex justify-between items-center h-16",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("div",{className:"flex items-center justify-center w-10 h-10 rounded-xl bg-gradient-to-br from-primary-mint to-primary-mint/80",children:e.jsx("img",{src:"/Novio_logo.png",alt:"Novio",className:"w-6 h-6 object-contain filter brightness-0 invert"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-gray-900 dark:text-white",children:"Novio"}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Client Portal"})]})]}),e.jsx("nav",{className:"hidden md:flex items-center space-x-2",children:y.map(D=>{const b=D.icon,E=a===D.id;return e.jsxs("button",{onClick:()=>v(D.id),className:`
713                      relative flex items-center space-x-2 px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200
714                      ${E?"bg-primary-mint text-white shadow-lg":"text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700"}
715                    `,children:[e.jsx(b,{className:"w-4 h-4"}),e.jsx("span",{children:D.title}),D.badge&&e.jsx("span",{className:`
716                        flex items-center justify-center w-5 h-5 rounded-full text-xs font-bold
717                        ${E?"bg-white/20 text-white":"bg-primary-mint text-white"}
718                      `,children:D.badge})]},D.id)})}),e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsxs(G,{variant:"ghost",size:"sm",onClick:p,className:"w-9 h-9 rounded-lg",children:[e.jsx(mr,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),e.jsx(ur,{className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"})]}),e.jsx(G,{variant:"ghost",size:"sm",className:"md:hidden w-9 h-9 rounded-lg",onClick:()=>o(!i),children:i?e.jsx(gs,{className:"h-5 w-5"}):e.jsx(c0,{className:"h-5 w-5"})}),e.jsxs("div",{className:"relative",children:[e.jsxs(G,{variant:"ghost",size:"sm",className:"flex items-center space-x-3 rounded-lg px-3 py-2",onClick:()=>m(!c),children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-gradient-to-br from-primary-mint to-primary-mint/80 flex items-center justify-center",children:e.jsxs("span",{className:"text-sm font-bold text-white",children:[u?.firstName?.[0],u?.lastName?.[0]]})}),e.jsxs("div",{className:"hidden sm:block text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:u?.firstName}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Online"})]}),e.jsx(Ln,{className:"h-3 w-3"})]}),c&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>m(!1)}),e.jsxs("div",{className:"absolute right-0 top-full mt-2 w-64 rounded-xl bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 shadow-lg z-50",children:[e.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-gradient-to-br from-primary-mint to-primary-mint/80 flex items-center justify-center",children:e.jsxs("span",{className:"text-base font-bold text-white",children:[u?.firstName?.[0],u?.lastName?.[0]]})}),e.jsxs("div",{children:[e.jsxs("p",{className:"font-medium text-gray-900 dark:text-white",children:[u?.firstName," ",u?.lastName]}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:u?.email}),e.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:u?.companyName||u?.company?.name})]})]})}),e.jsxs("div",{className:"p-2",children:[e.jsxs("button",{onClick:()=>{m(!1),v("account")},className:"flex w-full items-center space-x-3 rounded-lg px-3 py-2 text-sm font-medium hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:[e.jsx(nt,{className:"h-4 w-4 text-blue-500"}),e.jsx("span",{children:"Account Settings"})]}),e.jsxs("button",{className:"flex w-full items-center space-x-3 rounded-lg px-3 py-2 text-sm font-medium hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:[e.jsx(Hm,{className:"h-4 w-4 text-orange-500"}),e.jsx("span",{children:"Notifications"})]}),e.jsx("hr",{className:"my-2 border-gray-200 dark:border-gray-700"}),e.jsxs("button",{onClick:()=>{m(!1),g()},className:"flex w-full items-center space-x-3 rounded-lg px-3 py-2 text-sm font-medium text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors",children:[e.jsx(vl,{className:"h-4 w-4"}),e.jsx("span",{children:"Sign out"})]})]})]})]})]})]})]}),i&&e.jsx("div",{className:"md:hidden border-t border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 max-h-[70vh] overflow-y-auto overscroll-contain",children:e.jsx("nav",{className:"px-2 py-4 space-y-2",children:y.map(D=>{const b=D.icon,E=a===D.id;return e.jsxs("button",{onClick:()=>v(D.id),className:`
719                        flex w-full items-center space-x-4 rounded-xl px-4 py-3 text-left transition-colors
720                        ${E?"bg-primary-mint text-white shadow-lg":"text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}
721                      `,children:[e.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-lg bg-white/10",children:e.jsx(b,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("span",{className:"font-medium",children:D.title}),D.badge&&e.jsx("span",{className:"flex items-center justify-center w-5 h-5 rounded-full text-xs font-bold bg-white/20 text-white",children:D.badge})]}),e.jsx("p",{className:"text-xs opacity-70 mt-0.5",children:D.description})]})]},D.id)})})})]})}),e.jsxs("main",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[e.jsx("div",{className:"mb-8",children:e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("div",{className:"flex items-center justify-center w-12 h-12 rounded-xl bg-primary-mint/10",children:N&&e.jsx(N.icon,{className:"w-6 h-6 text-primary-mint"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:N?.title}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:N?.description})]})]})}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 shadow-sm",children:e.jsx("div",{className:"min-h-[600px]",children:w()})})]}),e.jsx(gN,{})]})}function uM({activeTab:a,onTabChange:r}){const{user:i,logout:o}=ts(),c=[{id:"dashboard",title:"Dashboard",icon:Fc,description:"System overview & statistics"},{id:"company-codes",title:"Company Codes",icon:Ic,description:"Generate & manage codes"},{id:"companies",title:"Companies",icon:Js,description:"Manage registered companies"},{id:"users",title:"Users",icon:yt,description:"View all system users"},{id:"analytics",title:"Analytics",icon:Mi,description:"Usage & performance metrics"}],m=()=>{window.history.pushState(null,"","/"),window.dispatchEvent(new PopStateEvent("popstate"))},u=async()=>{await o()};return e.jsxs("div",{className:"flex flex-col h-screen w-80 bg-white border-r border-neutral-light",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-neutral-light",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"w-10 h-10 bg-primary-mint rounded-lg flex items-center justify-center",children:e.jsx(Ga,{className:"h-6 w-6 text-white"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-bold text-primary-navy",children:"Novio Admin"}),e.jsx("p",{className:"text-xs text-neutral-dark/70",children:"Admin Panel"})]})]}),e.jsx(ze,{variant:"outline",className:"bg-primary-mint/10 text-primary-mint border-primary-mint/20 text-xs",children:"Admin"})]}),e.jsx("div",{className:"p-4 border-b border-neutral-light",children:e.jsxs(G,{variant:"ghost",onClick:m,className:"w-full justify-start text-neutral-dark hover:text-primary-navy hover:bg-neutral-lightest",children:[e.jsx(ns,{className:"h-4 w-4 mr-3"}),"Back to Main App"]})}),e.jsxs("nav",{className:"flex-1 p-4 space-y-2",children:[e.jsx("div",{className:"mb-4",children:e.jsx("h3",{className:"text-xs font-semibold text-neutral-dark/70 uppercase tracking-wider mb-3",children:"Admin Functions"})}),c.map(g=>{const x=g.icon,p=a===g.id;return e.jsxs("button",{onClick:()=>r(g.id),className:`
722                w-full flex items-start p-4 rounded-lg transition-all duration-200 text-left
723                ${p?"bg-primary-mint text-white shadow-sm":"text-neutral-dark hover:bg-neutral-lightest hover:text-primary-navy"}
724              `,children:[e.jsx(x,{className:`h-5 w-5 mr-4 mt-0.5 flex-shrink-0 ${p?"text-white":"text-primary-mint"}`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:`font-medium text-sm ${p?"text-white":""}`,children:g.title}),e.jsx("div",{className:`text-xs mt-1 ${p?"text-white/80":"text-neutral-dark/60"}`,children:g.description})]})]},g.id)})]}),e.jsx("div",{className:"p-4 border-t border-neutral-light",children:e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-neutral-lightest",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"w-8 h-8 bg-primary-mint rounded-full flex items-center justify-center",children:e.jsx(nt,{className:"h-4 w-4 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-sm font-medium text-primary-navy truncate",children:[i?.first_name," ",i?.last_name]}),e.jsx("p",{className:"text-xs text-neutral-dark/70 truncate",children:i?.email})]})]}),e.jsx(G,{variant:"ghost",size:"sm",onClick:u,className:"text-neutral-dark hover:text-red-600 hover:bg-red-50",title:"Logout",children:e.jsx(vl,{className:"h-4 w-4"})})]})})]})}function mM(){const[a,r]=f.useState([]),[i,o]=f.useState(!0),[c,m]=f.useState(!1),[u,g]=f.useState(null),[x,p]=f.useState({search:"",status:"all"}),[y,v]=f.useState({current_page:1,per_page:15,total:0});f.useEffect(()=>{w()},[x,y.current_page]);const w=async()=>{try{o(!0);const _={page:y.current_page,per_page:y.per_page,...x},M=await ve.getCompanyCodes(_);M.success&&(r(M.data.data),v({current_page:M.data.current_page,per_page:M.data.per_page,total:M.data.total,last_page:M.data.last_page}))}catch{console.error("Failed to load company codes:")}finally{o(!1)}},N=async _=>{try{(await ve.generateCompanyCode(_)).success&&(m(!1),w())}catch{console.error("Failed to create company code:")}},D=async(_,M)=>{try{(await ve.updateCompanyCode(_,M)).success&&(g(null),w())}catch{console.error("Failed to update company code:")}},b=async _=>{if(confirm("Are you sure you want to delete this company code?"))try{(await ve.deleteCompanyCode(_)).success&&w()}catch{console.error("Failed to delete company code:")}},E=async _=>{try{await navigator.clipboard.writeText(_)}catch{console.error("Failed to copy code:")}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-primary-navy",children:"Company Codes"}),e.jsx("p",{className:"text-neutral-dark",children:"Generate and manage company registration codes"})]}),e.jsxs(G,{onClick:()=>m(!0),className:"bg-primary-mint hover:bg-primary-mint/90",children:[e.jsx(Rt,{className:"h-4 w-4 mr-2"}),"Generate Code"]}
724)]}),e.jsx(Ce,{className:"p-4",children:e.jsxs("div",{className:"flex gap-4 items-end",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx(oe,{htmlFor:"search",children:"Search"}),e.jsxs("div",{className:"relative",children:[e.jsx(Un,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-neutral-dark/50"}),e.jsx(he,{id:"search",placeholder:"Search by code or company name...",value:x.search,onChange:_=>p(M=>({...M,search:_.target.value})),className:"pl-10"})]})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"status",children:"Status"}),e.jsxs("select",{id:"status",value:x.status,onChange:_=>p(M=>({...M,status:_.target.value})),className:"border border-neutral-light rounded-md px-3 py-2",children:[e.jsx("option",{value:"all",children:"All Status"}),e.jsx("option",{value:"unused",children:"Unused"}),e.jsx("option",{value:"used",children:"Used"})]})]})]})}),e.jsxs(Ce,{className:"overflow-hidden",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-neutral-light",children:[e.jsx("thead",{className:"bg-neutral-lightest",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-neutral-dark uppercase tracking-wider",children:"Code"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-neutral-dark uppercase tracking-wider",children:"Company Name"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-neutral-dark uppercase tracking-wider",children:"Status"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-neutral-dark uppercase tracking-wider",children:"Created"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-neutral-dark uppercase tracking-wider",children:"Used Date"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-neutral-dark uppercase tracking-wider",children:"Actions"})]})}),e.jsx("tbody",{className:"bg-white divide-y divide-neutral-light",children:i?e.jsx("tr",{children:e.jsx("td",{colSpan:"6",className:"px-6 py-8 text-center",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary-mint mx-auto"})})}):a.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:"6",className:"px-6 py-8 text-center text-neutral-dark",children:"No company codes found"})}):a.map(_=>e.jsxs("tr",{className:"hover:bg-neutral-lightest",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("code",{className:"bg-neutral-light px-2 py-1 rounded font-mono text-sm",children:_.code}),e.jsx("button",{onClick:()=>E(_.code),className:"ml-2 p-1 hover:bg-neutral-light rounded",title:"Copy code",children:e.jsx(N2,{className:"h-4 w-4 text-neutral-dark/50"})})]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-primary-navy",children:_.company_name}),_.description&&e.jsx("div",{className:"text-sm text-neutral-dark/70",children:_.description})]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx(ze,{variant:_.is_used?"secondary":"default",className:_.is_used?"bg-green-100 text-green-800 border-green-200":"bg-yellow-100 text-yellow-800 border-yellow-200",children:_.is_used?"Used":"Available"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-neutral-dark",children:new Date(_.created_at).toLocaleDateString()}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-neutral-dark",children:_.used_at?new Date(_.used_at).toLocaleDateString():"-"}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:e.jsx("div",{className:"flex justify-end gap-2",children:!_.is_used&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>g(_),className:"text-blue-600 hover:text-blue-900",title:"Edit",children:e.jsx(ya,{className:"h-4 w-4"})}),e.jsx("button",{onClick:()=>b(_.id),className:"text-red-600 hover:text-red-900",title:"Delete",children:e.jsx($n,{className:"h-4 w-4"})})]})})})]},_.id))})]})}),y.last_page>1&&e.jsx("div",{className:"px-6 py-4 border-t border-neutral-light",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-sm text-neutral-dark",children:["Showing ",(y.current_page-1)*y.per_page+1," to ",Math.min(y.current_page*y.per_page,y.total)," of ",y.total," results"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(G,{variant:"outline",size:"sm",onClick:()=>v(_=>({..._,current_page:_.current_page-1})),disabled:y.current_page===1,children:"Previous"}),e.jsx(G,{variant:"outline",size:"sm",onClick:()=>v(_=>({..._,current_page:_.current_page+1})),disabled:y.current_page===y.last_page,children:"Next"})]})]})})]}),c&&e.jsx(fM,{onClose:()=>m(!1),onSubmit:N}),u&&e.jsx(hM,{code:u,onClose:()=>g(null),onSubmit:_=>D(u.id,_)})]})}function fM({onClose:a,onSubmit:r}){const[i,o]=f.useState({company_name:"",description:""}),[c,m]=f.useState(!1),u=async g=>{g.preventDefault(),m(!0);try{await r(i),a()}catch{console.error("Failed to create code:")}finally{m(!1)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs(Ce,{className:"w-full max-w-md p-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h3",{className:"text-lg font-medium text-primary-navy",children:"Generate Company Code"}),e.jsx("button",{onClick:a,className:"text-neutral-dark hover:text-neutral-dark/80",children:e.jsx(gs,{className:"h-4 w-4"})})]}),e.jsxs("form",{onSubmit:u,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"company_name",children:"Company Name"}),e.jsx(he,{id:"company_name",value:i.company_name,onChange:g=>o(x=>({...x,company_name:g.target.value})),placeholder:"Enter company name",required:!0})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"description",children:"Description (Optional)"}),e.jsx("textarea",{id:"description",value:i.description,onChange:g=>o(x=>({...x,description:g.target.value})),placeholder:"Enter description or notes about this company",className:"w-full px-3 py-2 border border-neutral-light rounded-md resize-none",rows:"3"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(G,{type:"button",variant:"outline",onClick:a,disabled:c,
724children:"Cancel"}),e.jsx(G,{type:"submit",className:"bg-primary-mint hover:bg-primary-mint/90",disabled:c,children:c?"Generating...":"Generate Code"})]})]})]})})}function hM({code:a,onClose:r,onSubmit:i}){const[o,c]=f.useState({company_name:a.company_name,description:a.description||""}),[m,u]=f.useState(!1),g=async x=>{x.preventDefault(),u(!0);try{await i(o),r()}catch{console.error("Failed to update code:")}finally{u(!1)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs(Ce,{className:"w-full max-w-md p-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h3",{className:"text-lg font-medium text-primary-navy",children:"Edit Company Code"}),e.jsx("button",{onClick:r,className:"text-neutral-dark hover:text-neutral-dark/80",children:e.jsx(gs,{className:"h-4 w-4"})})]}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(oe,{children:"Code"}),e.jsx("div",{className:"p-2 bg-neutral-lightest rounded border",children:e.jsx("code",{className:"font-mono text-sm",children:a.code})})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"company_name",children:"Company Name"}),e.jsx(he,{id:"company_name",value:o.company_name,onChange:x=>c(p=>({...p,company_name:x.target.value})),placeholder:"Enter company name",required:!0})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"description",children:"Description (Optional)"}),e.jsx("textarea",{id:"description",value:o.description,onChange:x=>c(p=>({...p,description:x.target.value})),placeholder:"Enter description or notes about this company",className:"w-full px-3 py-2 border border-neutral-light rounded-md resize-none",rows:"3"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(G,{type:"button",variant:"outline",onClick:r,disabled:m,children:"Cancel"}),e.jsx(G,{type:"submit",className:"bg-primary-mint hover:bg-primary-mint/90",disabled:m,children:m?"Updating...":"Update Code"})]})]})]})})}function xM(){const[a,r]=f.useState(null),[i,o]=f.useState(!0),[c,m]=f.useState("dashboard"),{user:u}=ts();f.useEffect(()=>{g()},[]);const g=async()=>{try{const x=await ve.getDashboardStats();x.success&&r(x.data)}catch{console.error("Failed to load dashboard stats:")}finally{o(!1)}};return!u?.isNovioAdmin&&!u?.is_novio_admin?e.jsx("div",{className:"min-h-screen bg-neutral-lightest flex items-center justify-center",children:e.jsxs(Ce,{className:"max-w-md p-6 text-center",children:[e.jsx("h1",{className:"text-2xl font-bold text-red-600 mb-2",children:"Access Denied"}),e.jsx("p",{className:"text-neutral-dark",children:"You don't have permission to access the Novio Admin panel."})]})}):i?e.jsx("div",{className:"min-h-screen bg-neutral-lightest flex items-center justify-center",children:e.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-primary-mint"})}):e.jsxs("div",{className:"flex h-screen bg-neutral-lightest",children:[e.jsx(uM,{activeTab:c,onTabChange:m}),e.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:e.jsxs("main",{className:"flex-1 overflow-y-auto p-8",children:[c==="dashboard"&&e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-primary-navy mb-2",children:"System Overview"}),e.jsx("p",{className:"text-neutral-dark",children:"Monitor your Nuvio platform statistics and activity"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[e.jsx(Ce,{className:"p-6 border-0 shadow-sm hover:shadow-md transition-shadow",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-neutral-dark mb-1",children:"Total Companies"}),e.jsx("p",{className:"text-3xl font-bold text-primary-navy",children:a?.total_companies||0})]}),e.jsx("div",{className:"w-12 h-12 bg-primary-mint/10 rounded-lg flex items-center justify-center",children:e.jsx(Js,{className:"h-6 w-6 text-primary-mint"})})]})}),e.jsx(Ce,{className:"p-6 border-0 shadow-sm hover:shadow-md transition-shadow",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-neutral-dark mb-1",children:"Total Users"}),e.jsx("p",{className:"text-3xl font-bold text-primary-navy",children:a?.total_users||0})]}),e.jsx("div",{className:"w-12 h-12 bg-blue-100 rounded-lg flex items-center justify-center",children:e.jsx(yt,{className:"h-6 w-6 text-blue-600"})})]})}),e.jsx(Ce,{className:"p-6 border-0 shadow-sm hover:shadow-md transition-shadow",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-neutral-dark mb-1",children:"Company Codes"}),e.jsx("p",{className:"text-3xl font-bold text-primary-navy",children:a?.total_company_codes||0})]}),e.jsx("div",{className:"w-12 h-12 bg-yellow-100 rounded-lg flex items-center justify-center",children:e.jsx(Ic,{className:"h-6 w-6 text-yellow-600"})})]})}),e.jsx(Ce,{className:"p-6 border-0 shadow-sm hover:shadow-md transition-shadow",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-neutral-dark mb-1",children:"Available Codes"}),e.jsx("p",{className:"text-3xl font-bold text-primary-navy",children:a?.unused_codes||0})]}),e.jsx("div",{className:"w-12 h-12 bg-green-100 rounded-lg flex items-center justify-center",children:e.jsx(_4,{className:"h-6 w-6 text-green-600"})})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[e.jsxs(Ce,{className:"p-6 border-0 shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-primary-navy",children:"System Status"}),e.jsx(ze,{variant:"outline",className:"bg-green-100 text-green-700 border-green-200",children:"All Systems Operational"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(JS,{className:"h-5 w-5 text-green-600"}),e.jsx("span",{className:"text-sm text-neutral-dark",children:"API Server"})]}),e.jsx(ze,{className:"bg-green-100 text-green-700",children:"Online"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(H1,{className:"h-5 w-5 text-green-600"}),e.jsx("span",{className:"text-sm text-neutral-dark",children:"Database"})]}),e.jsx(ze,{className:"bg-green-100 text-green-700",children:"Connected"})]})]})]}),e.jsxs(Ce,{className:"p-6 border-0 shadow-sm",children:[e.jsx("h3",{className:"text-lg font-semibold text-primary-navy mb-4",children:"Recent Activity"}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"text-sm text-neutral-dark",children:[e.jsxs("p",{className:"mb-2",children:["• ",a?.recent_registrations||0," new companies registered this week"]}),e.jsxs("p",{className:"mb-2",children:["• ",a?.unused_codes||0," company codes available for distribution"]}),e.jsxs("p",{children:["• ",a?.total_users||0," total users across all companies"]})]})})]})]})]}),c==="company-codes"&&e.jsx("div",{children:e.jsx(mM,{})}),c==="companies"&&e.jsx("div",{children:e.jsx(pM,{})}),c==="users"&&e.jsx("div",{children:e.jsx(gM,{})}),c==="analytics"&&e.jsx("div",{children:e.jsx(vM,{})})]})})]})}function pM(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-primary-navy mb-2",children:"Companies Management"}),e.jsx("p",{className:"text-neutral-dark",children:"View and manage all registered companies"})]}),e.jsx(Ce,{className:"p-8",children:e.jsxs("div",{className:"text-center text-neutral-dark",children:[e.jsx(Js,{className:"h-16 w-16 mx-auto mb-4 text-neutral-light"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"Companies Management"}),e.jsx("p",{children:"Detailed company management interface will be implemented here."})]})})]})}function gM(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-primary-navy mb-2",children:"Users Management"}),e.jsx("p",{className:"text-neutral-dark",children:"View and manage users across all companies"})]}),e.jsx(Ce,{className:"p-8",children:e.jsxs("div",{className:"text-center text-neutral-dark",children:[e.jsx(yt,{className:"h-16 w-16 mx-auto mb-4 text-neutral-light"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"Users Management"}),e.jsx("p",{children:"Detailed user management interface will be implemented here."})]})})]})}function vM(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-primary-navy mb-2",children:"Analytics & Insights"}),e.jsx("p",{className:"text-neutral-dark",children:"Monitor usage patterns and system performance"})]}),e.jsx(Ce,{className:"p-8",children:e.jsxs("div",{className:"text-center text-neutral-dark",children:[e.jsx(yl,{className:"h-16 w-16 mx-auto mb-4 text-neutral-light"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"Analytics Dashboard"}),e.jsx("p",{children:"Advanced analytics and reporting features will be implemented here."})]})})]})}function yM({onSwitchToRegister:a,onSwitchToReset:r}){const[i,o]=f.useState({email:"",password:""}),[c,m]=f.useState(!1),[u,g]=f.useState({}),[x,p]=f.useState(!1),{login:y}=ts(),v=()=>{const D={};return i.email?/\S+@\S+\.\S+/.test(i.email)||(D.email="Please enter a valid email"):D.email="Email is required",i.password?i.password.length<6&&(D.password="Password must be at least 6 characters"):D.password="Password is required",g(D),Object.keys(D).length===0},w=D=>{const{name:b,value:E}=D.target;o(_=>({..._,[b]:E})),u[b]&&g(_=>({..._,[b]:""}))},N=async D=>{if(D.preventDefault(),!!v()){p(!0);try{const b=await y(i.email,i.password);b.success||g({general:b.error})}catch{g({general:"An unexpected error occurred. Please try again."})}finally{p(!1)}}};return e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"text-left mb-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Welcome back"}),e.jsx("p",{className:"text-sm text-gray-600",children:"Sign in to your account to continue"}),e.jsx("p",{className:"text-sm text-gray-600",children:" Version 1.0 "})]}),e.jsxs("form",{onSubmit:N,className:"space-y-4",children:[u.general&&e.jsx("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg",children:e.jsx("p",{className:"text-sm text-red-600",children:u.general})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"email",className:"text-gray-700 font-medium",children:"Email Address"}),e.jsxs("div",{className:"relative",children:[e.jsx(Lt,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(he,{id:"email",name:"email",type:"email",placeholder:"Enter your email",value:i.email,onChange:w,className:`pl-10 border-gray-300 focus:border-primary-mint focus:ring-primary-mint ${u.email?"border-red-300 focus:border-red-500":""}`,disabled:x})]}),u.email&&e.jsx("p",{className:"text-sm text-red-600",children:u.email})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"password",className:"text-gray-700 font-medium",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(ma,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(he,{id:"password",name:"password",type:c?"text":"password",placeholder:"Enter your password",value:i.password,onChange:w,className:`pl-10 pr-10 border-gray-300 focus:border-primary-mint focus:ring-primary-mint ${u.password?"border-red-300 focus:border-red-500":""}`,disabled:x}),e.jsx("button",{type:"button",onClick:()=>m(!c),className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors",disabled:x,children:c?e.jsx(Zs,{className:"h-4 w-4"}):e.jsx(rs,{className:"h-4 w-4"})})]}),u.password&&e.jsx("p",{className:"text-sm text-red-600",children:u.password})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("label",{className:"flex items-center",children:[e.jsx("input",{type:"checkbox",className:"h-4 w-4 text-primary-mint focus:ring-primary-mint border-gray-300 rounded"}),e.jsx("span",{className:"ml-2 text-sm text-gray-600",children:"Remember me"})]}),e.jsx("button",{type:"button",onClick:r,className:"text-sm text-primary-mint hover:text-primary-mint/80 transition-colors",children:"Forgot password?"})]}),e.jsx(G,{type:"submit",className:"w-full bg-primary-navy hover:bg-primary-navy
724/90 text-white py-2.5",disabled:x,children:x?e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),"Signing in..."]}):e.jsxs("div",{className:"flex items-center justify-center",children:["Sign in",e.jsx(Ks,{className:"ml-2 h-4 w-4"})]})})]}),e.jsx("div",{className:"mt-6 text-center",children:e.jsxs("p",{className:"text-gray-600",children:["Don't have an account?"," ",e.jsx("button",{onClick:a,className:"text-primary-mint hover:text-primary-mint/80 font-medium transition-colors",children:"Sign up here"})]})})]})}function bM({onSwitchToLogin:a}){const[r,i]=f.useState({firstName:"",lastName:"",email:"",companyCode:"",password:"",confirmPassword:""}),[o,c]=f.useState(!1),[m,u]=f.useState(!1),[g,x]=f.useState({}),[p,y]=f.useState(!1),[v,w]=f.useState(null),[N,D]=f.useState(!1),{register:b,validateCompanyCode:E}=ts(),_=()=>{const j={};return r.firstName.trim()||(j.firstName="First name is required"),r.lastName.trim()||(j.lastName="Last name is required"),r.email?/\S+@\S+\.\S+/.test(r.email)||(j.email="Please enter a valid email"):j.email="Email is required",r.companyCode?r.companyCode.length<6&&(j.companyCode="Company code must be at least 6 characters"):j.companyCode="Company code is required",r.password?r.password.length<6?j.password="Password must be at least 6 characters":/(?=.*[a-z])(?=.*[A-Z])(?=.*\d)/.test(r.password)||(j.password="Password must contain at least one uppercase letter, one lowercase letter, and one number"):j.password="Password is required",r.confirmPassword?r.password!==r.confirmPassword&&(j.confirmPassword="Passwords do not match"):j.confirmPassword="Please confirm your password",x(j),Object.keys(j).length===0},M=async j=>{if(!j||j.length<6){w(null);return}D(!0);try{const O=await E(j.toUpperCase());O.valid?(w(O.company),x(L=>({...L,companyCode:""}))):(w(null),x(L=>({...L,companyCode:O.error})))}catch{w(null),x(L=>({...L,companyCode:"Failed to validate company code"}))}finally{D(!1)}},k=j=>{const{name:O,value:L}=j.target;if(i(R=>({...R,[O]:L})),g[O]&&x(R=>({...R,[O]:""})),O==="companyCode"){const R=L.toUpperCase();i(H=>({...H,companyCode:R})),clearTimeout(window.companyCodeTimeout),window.companyCodeTimeout=setTimeout(()=>{M(R)},500)}O==="password"&&g.confirmPassword&&x(R=>({...R,confirmPassword:""}))},C=async j=>{if(j.preventDefault(),!!_()){y(!0);try{const O=await b(r);O.success||x({general:O.error})}catch{x({general:"An unexpected error occurred. Please try again."})}finally{y(!1)}}};return e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"text-left mb-4",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Create your account"}),e.jsx("p",{className:"text-sm text-gray-600",children:"Get started with your company team today"})]}),e.jsxs("form",{onSubmit:C,className:"space-y-3",children:[g.general&&e.jsx("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg",children:e.jsx("p",{className:"text-sm text-red-600",children:g.general})}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(oe,{htmlFor:"firstName",className:"text-gray-700 font-medium text-sm",children:"First Name"}),e.jsxs("div",{className:"relative",children:[e.jsx(nt,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(he,{id:"firstName",name:"firstName",type:"text",placeholder:"John",value:r.firstName,onChange:k,className:`pl-10 h-9 border-gray-300 focus:border-primary-mint focus:ring-primary-mint ${g.firstName?"border-red-300 focus:border-red-500":""}`,disabled:p})]}),g.firstName&&e.jsx("p",{className:"text-xs text-red-600",children:g.firstName})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(oe,{htmlFor:"lastName",className:"text-gray-700 font-medium text-sm",children:"Last Name"}),e.jsxs("div",{className:"relative",children:[e.jsx(nt,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(he,{id:"lastName",name:"lastName",type:"text",placeholder:"Doe",value:r.lastName,onChange:k,className:`pl-10 h-9 border-gray-300 focus:border-primary-mint focus:ring-primary-mint ${g.lastName?"border-red-300 focus:border-red-500":""}`,disabled:p})]}),g.lastName&&e.jsx("p",{className:"text-xs text-red-600",children:g.lastName})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(oe,{htmlFor:"email",className:"text-gray-700 font-medium text-sm",children:"Email Address"}),e.jsxs("div",{className:"relative",children:[e.jsx(Lt,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(he,{id:"email",name:"email",type:"email",placeholder:"[email protected]",value:r.email,onChange:k,className:`pl-10 h-9 border-gray-300 focus:border-primary-mint focus:ring-primary-mint ${g.email?"border-red-300 focus:border-red-500":""}`,disabled:p})]}),g.email&&e.jsx("p",{className:"text-xs text-red-600",children:g.email})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(oe,{htmlFor:"companyCode",className:"text-gray-700 font-medium text-sm",children:"Company Code"}),e.jsxs("div",{className:"relative",children:[e.jsx(ps,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(he,{id:"companyCode",name:"companyCode",type:"text",placeholder:"Enter your company code",value:r.companyCode,onChange:k,className:`pl-10 pr-10 h-9 uppercase border-gray-300 focus:border-primary-mint focus:ring-primary-mint ${g.companyCode?"border-red-300 focus:border-red-500":v?"border-green-300 focus:border-green-500":""}`,disabled:p}),N&&e.jsx("div",{className:"absolute right-3 top-1/2 transform -translate-y-1/2",children:e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-primary-mint"})}),v&&!N&&e.jsx("div",{className:"absolute right-3 top-1/2 transform -translate-y-1/2",children:e.jsx("div",{className:"h-4 w-4 bg-green-500 rounded-full flex items-center justify-center",children:e.jsx("div",{className:"h-2 w-2 bg-white rounded-full"})})})]}),v&&!g.companyCode&&e.jsxs("div",{className:"p-2 bg-green-50 border border-green-200 rounded-lg",children:[e.jsx("p",{className:"text-xs text-green-700 font-medium",children:v.name}),v.description&&e.jsx("p",{className:"text-xs text-green-600",children:v.description})]}),g.companyCode&&e.jsx("p",{className:"text-xs text-red-600",children:g.companyCode}),e.jsx("div",{className:"text-xs text-gray-500",children:"Your company administrator will provide this code."})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(oe,{htmlFor:"password",className:"text-gray-700 font-medium text-sm",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(ma,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(he,{id:"password",name:"password",type:o?"text":"password",placeholder:"Create a strong password",value:r.password,onChange:k,className:`pl-10 pr-10 h-9 border-gray-300 focus:border-primary-mint focus:ring-primary-mint ${g.password?"border-red-300 focus:border-red-500":""}`,disabled:p}),e.jsx("button",{type:"button",onClick:()=>c(!o),className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors",disabled:p,children:o?e.jsx(Zs,{className:"h-4 w-4"}):e.jsx(rs,{className:"h-4 w-4"})})]}),g.password&&e.jsx("p",{className:"text-xs text-red-600",children:g.password}),e.jsx("div",{className:"text-xs text-gray-500",children:"Must contain uppercase, lowercase, and a number"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(oe,{htmlFor:"confirmPassword",className:"text-gray-700 font-medium text-sm",children:"Confirm Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(ma,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(he,{id:"confirmPassword",name:"confirmPassword",type:m?"text":"password",placeholder:"Confirm your password",value:r.confirmPassword,onChange:k,className:`pl-10 pr-10 h-9 border-gray-300 focus:border-primary-mint focus:ring-primary-mint ${g.confirmPassword?"border-red-300 focus:border-red-500":""}`,disabled:p}),e.jsx("button",{type:"button",onClick:()=>u(!m),className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors",disabled:p,children:m?e.jsx(Zs,{className:"h-4 w-4"}):e.jsx(rs,{className:"h-4 w-4"})})]}),g.confirmPassword&&e.jsx("p",{className:"text-xs text-red-600",children:g.confirmPassword})]}),e.jsxs("div",{className:"flex items-start",children:[e.jsx("input",{type:"checkbox",required:!0,className:"h-4 w-4 text-primary-mint focus:ring-primary-mint border-gray-300 rounded mt-0.5 flex-shrink-0"}),e.jsxs("span",{className:"ml-2 text-xs text-gray-600",children:["I agree to the"," ",e.jsx("a",{href:"#",className:"text-primary-mint hover:text-primary-mint/80",children:"Terms of Service"})," ","and"," ",e.jsx("a",{href:"#",className:"text-primary-mint hover:text-primary-mint/80",children:"Privacy Policy"})]})]}),e.jsx(G,{type:"submit",className:"w-full bg-primary-navy hover:bg-primary-navy
724/90 text-white h-9",disabled:p,children:p?e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),"Creating account..."]}):e.jsxs("div",{className:"flex items-center justify-center",children:["Create account",e.jsx(Ks,{className:"ml-2 h-4 w-4"})]})})]}),e.jsx("div",{className:"mt-4 text-center",children:e.jsxs("p",{className:"text-gray-600 text-sm",children:["Already have an account?"," ",e.jsx("button",{onClick:a,className:"text-primary-mint hover:text-primary-mint/80 font-medium transition-colors",children:"Sign in here"})]})})]})}function jM({onSwitchToLogin:a}){const[r,i]=f.useState(""),[o,c]=f.useState({}),[m,u]=f.useState(!1),[g,x]=f.useState(!1),[p,y]=f.useState(""),{requestPasswordReset:v}=ts(),w=()=>{const b={};return r?/\S+@\S+\.\S+/.test(r)||(b.email="Please enter a valid email"):b.email="Email is required",c(b),Object.keys(b).length===0},N=async b=>{if(b.preventDefault(),!!w()){u(!0),c({});try{const E=await v(r);E.success?(x(!0),y(E.message)):c({general:E.error})}catch{c({general:"An unexpected error occurred. Please try again."})}finally{u(!1)}}},D=b=>{i(b.target.value),o.email&&c(E=>({...E,email:""}))};return g?e.jsxs("div",{className:"w-full max-w-md mx-auto",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(Ha,{className:"w-8 h-8 text-green-600"})}),e.jsx("h1",{className:"text-3xl font-bold text-primary-navy mb-2",children:"Check your email"}),e.jsx("p",{className:"text-neutral-dark",children:p})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"p-4 bg-primary-mint/10 border border-primary-mint/20 rounded-lg",children:e.jsxs("p",{className:"text-sm text-primary-navy",children:[e.jsx("strong",{children:"Note:"})," This is a demo application. In a real app, you would receive an email with password reset instructions."]})}),e.jsxs(G,{onClick:a,className:"w-full bg-primary-mint hover:bg-primary-mint/90 text-white",children:[e.jsx(ns,{className:"mr-2 h-4 w-4"}),"Back to Sign In"]})]}),e.jsx("div",{className:"mt-8 text-center",children:e.jsxs("p",{className:"text-neutral-dark text-sm",children:["Didn't receive the email? Check your spam folder or"," ",e.jsx("button",{onClick:()=>{x(!1),i(""),y("")},className:"text-primary-mint hover:text-primary-mint/80 font-medium transition-colors",children:"try again"})]})})]}):e.jsxs("div",{className:"w-full max-w-md mx-auto",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("h1",{className:"text-3xl font-bold text-primary-navy mb-2",children:"Reset your password"}),e.jsx("p",{className:"text-neutral-dark",children:"Enter your email address and we'll send you instructions to reset your password"})]}),e.jsxs("form",{onSubmit:N,className:"space-y-6",children:[o.general&&e.jsx("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg",children:e.jsx("p",{className:"text-sm text-red-600",children:o.general})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"email",className:"text-neutral-dark font-medium",children:"Email Address"}),e.jsxs("div",{className:"relative",children:[e.jsx(Lt,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-neutral-dark/50"}),e.jsx(he,{id:"email",name:"email",type:"email",placeholder:"Enter your email address",value:r,onChange:D,className:`pl-10 ${o.email?"border-red-300 focus:border-red-500":""}`,disabled:m})]}),o.email&&e.jsx("p",{className:"text-sm text-red-600",children:o.email})]}),e.jsx(G,{type:"submit",className:"w-full bg-primary-mint hover:bg-primary-mint/90 text-white",disabled:m,children:m?e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),"Sending instructions..."]}):e.jsxs("div",{className:"flex items-center justify-center",children:["Send reset instructions",e.jsx(Ks,{className:"ml-2 h-4 w-4"})]})})]}),e.jsx("div",{className:"mt-8 text-center",children:e.jsxs("button",{onClick:a,className:"text-primary-mint hover:text-primary-mint/80 font-medium transition-colors inline-flex items-center",children:[e.jsx(ns,{className:"mr-1 h-4 w-4"}),"Back to Sign In"]})})]})}function NM(){const[a,r]=f.useState("login"),i=()=>r("register"),o=()=>r("login"),c=()=>r("reset"),m=()=>{switch(a){case"register":return e.jsx(bM,{onSwitchToLogin:o});case"reset":return e.jsx(jM,{onSwitchToLogin:o});default:return e.jsx(yM,{onSwitchToRegister:i,onSwitchToReset:c})}};return e.jsxs("div",{className:"min-h-screen bg-[#1a1f36] flex",children:[e.jsx("div",{className:"flex-1 flex flex-col justify-center px-8 lg:px-16 xl:px-24",children:e.jsxs("div",{className:"max-w-2xl",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 bg-primary-mint/10 text-primary-mint px-4 py-2 rounded-full text-sm font-medium mb-8",children:["Momenteel in Beta",e.jsx("span",{className:"text-primary-mint/60",children:"Vraag early-access aan"})]}),e.jsxs("h1",{className:"text-5xl lg:text-6xl xl:text-7xl font-bold text-white leading-tight mb-6",children:[e.jsx("span",{className:"text-white/60",children:"geconnecteerd. gestructureerd. gedigitaliseerd."}),e.jsx("br",{}),e.jsxs("span",{className:"block mt-4",children:["Eén platform voor",e.jsx("br",{}),"al je klantbeheer",e.jsx("br",{}),"— met ",e.jsx("span",{className:"text-primary-mint",children:"novio"})]})]}),e.jsx("p",{className:"text-xl text-white/70 mb-12 max-w-xl",children:"Novio stroomlijnt je processen van eerste contact tot facturatie"})]})}),e.jsx("div",{className:"hidden lg:flex lg:w-96 xl:w-[28rem] items-center justify-center p-8",children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl p-8 w-full",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 mb-6",children:[e.jsx("button",{onClick:o,className:`px-3 py-1 rounded-full transition-colors ${a==="login"?"bg-primary-mint/10 text-primary-navy font-medium":"hover:bg-gray-100"}`,children:"Sign in"}),e.jsx("span",{className:"opacity-40",children:"•"}),e.jsx("button",{onClick:i,className:`px-3 py-1 rounded-full transition-colors ${a==="register"?"bg-primary-mint/10 text-primary-navy font-medium":"hover:bg-gray-100"}`,children:"Sign up"})]}),m()]})}),e.jsx("div",{className:"lg:hidden fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl p-8 w-full max-w-md",children:[e.jsx("div",{className:"mb-6",children:e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 mb-4",children:[e.jsx("button",{onClick:o,className:`px-3 py-1 rounded-full transition-colors ${a==="login"?"bg-primary-mint/10 text-primary-navy font-medium":"hover:bg-gray-100"}`,children:"Sign in"}),e.jsx("span",{className:"opacity-40",children:"•"}),e.jsx("button",{onClick:i,className:`px-3 py-1 rounded-full transition-colors ${a==="register"?"bg-primary-mint/10 text-primary-navy font-medium":"hover:bg-gray-100"}`,children:"Sign up"})]})}),m()]})})]})}function wM(){const{user:a,completeSetup:r}=ts(),[i,o]=f.useState(1),[c,m]=f.useState(!1),[u,g]=f.useState({first_name:"",last_name:"",email:"",ph
724one:"",job_title:"",bio:""}),x=2,p=i/x*100;f.useEffect(()=>{a&&g({first_name:a.first_name||"",last_name:a.last_name||"",email:a.email||"",phone:a.phone||"",job_title:a.job_title||"",bio:a.bio||""})},[a]);const y=M=>{const{name:k,value:C}=M.target;g(j=>({...j,[k]:C}))},v=()=>{i<x&&o(M=>M+1)},w=()=>{i>1&&o(M=>M-1)},N=async()=>{m(!0);try{const M={first_name:u.first_name,last_name:u.last_name,phone:u.phone,job_title:u.job_title,bio:u.bio};await r(M)}catch{console.error("Setup completion error:")}finally{m(!1)}},D=()=>e.jsx("div",{className:"flex items-center justify-center mb-8",children:Array.from({length:x},(M,k)=>e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`
725              w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium
726              ${k+1<=i?"bg-primary-mint text-white":"bg-neutral-light text-neutral-dark"}
727            `,children:k+1<=i?e.jsx(Ha,{className:"w-4 h-4"}):k+1}),k<x-1&&e.jsx("div",{className:`
728                w-16 h-1 mx-2
729                ${k+1<i?"bg-primary-mint":"bg-neutral-light"}
730              `})]},k))}),b=()=>e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"w-16 h-16 bg-primary-mint/10 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(nt,{className:"w-8 h-8 text-primary-mint"})}),e.jsx("h2",{className:"text-2xl font-bold text-primary-navy mb-2",children:"Complete your profile"}),e.jsx("p",{className:"text-neutral-dark",children:"Let's make sure your information is up to date"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"first_name",className:"text-neutral-dark font-medium",children:"First Name"}),e.jsx(he,{id:"first_name",name:"first_name",placeholder:"Your first name",value:u.first_name,onChange:y})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"last_name",className:"text-neutral-dark font-medium",children:"Last Name"}),e.jsx(he,{id:"last_name",name:"last_name",placeholder:"Your last name",value:u.last_name,onChange:y})]})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"email",className:"text-neutral-dark font-medium",children:"Email"}),e.jsx(he,{id:"email",name:"email",type:"email",placeholder:"Your email address",value:u.email,onChange:y,disabled:!0,className:"bg-gray-50"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Email cannot be changed during setup"})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"phone",className:"text-neutral-dark font-medium",children:"Phone (Optional)"}),e.jsx(he,{id:"phone",name:"phone",placeholder:"Your phone number",value:u.phone,onChange:y})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"job_title",className:"text-neutral-dark font-medium",children:"Job Title (Optional)"}),e.jsx(he,{id:"job_title",name:"job_title",placeholder:"e.g. Project Manager, CEO, Designer",value:u.job_title,onChange:y})]}),e.jsxs("div",{children:[e.jsx(oe,{htmlFor:"bio",className:"text-neutral-dark font-medium",children:"About yourself (Optional)"}),e.jsx(Ut,{id:"bio",name:"bio",placeholder:"Tell us a bit about yourself...",value:u.bio,onChange:y,className:"resize-none",rows:3})]})]})]}),E=()=>e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(Ha,{className:"w-8 h-8 text-green-600"})}),e.jsx("h2",{className:"text-2xl font-bold text-primary-navy mb-2",children:"Review your information"}),e.jsx("p",{className:"text-neutral-dark",children:"Please double-check that everything looks correct"})]}),e.jsxs("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-6 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium text-gray-500",children:"Full Name"}),e.jsxs("p",{className:"text-gray-900",children:[u.first_name," ",u.last_name]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium text-gray-500",children:"Email"}),e.jsx("p",{className:"text-gray-900",children:u.email})]})]}),u.phone&&e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium text-gray-500",children:"Phone"}),e.jsx("p",{className:"text-gray-900",children:u.phone})]}),u.job_title&&e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium text-gray-500",children:"Job Title"}),e.jsx("p",{className:"text-gray-900",children:u.job_title})]}),u.bio&&e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium text-gray-500",children:"About"}),e.jsx("p",{className:"text-gray-900",children:u.bio})]}),a?.company?.name&&e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium text-gray-500",children:"Company"}),e.jsx("p",{className:"text-gray-900",children:a.company.name})]})]}),e.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:e.jsxs("p",{className:"text-sm text-blue-800",children:[e.jsx("strong",{children:"Ready to get started?"})," You can always update your profile later from the settings menu."]})})]}),_=()=>{switch(i){case 1:return b();case 2:return E();default:return b()}};return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-primary-navy via-primary-navy
730/90 to-primary-mint/20 flex items-center justify-center p-4",children:e.jsx("div",{className:"w-full max-w-2xl",children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl p-8",children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("span",{className:"text-sm font-medium text-neutral-dark",children:["Step ",i," of ",x]}),e.jsxs("span",{className:"text-sm text-neutral-dark/70",children:[Math.round(p),"% complete"]})]}),e.jsx("div",{className:"w-full bg-neutral-light rounded-full h-2",children:e.jsx("div",{className:"bg-primary-mint h-2 rounded-full transition-all duration-300",style:{width:`${p}%`}})})]}),D(),e.jsx("div",{className:"min-h-[400px]",children:_()}),e.jsxs("div",{className:"flex justify-between items-center mt-8 pt-6 border-t border-neutral-light",children:[e.jsxs(G,{variant:"outline",onClick:w,disabled:i===1,className:"flex items-center",children:[e.jsx(ns,{className:"w-4 h-4 mr-2"}),"Previous"]}),i===x?e.jsx(G,{onClick:N,disabled:c,className:"bg-primary-mint hover:bg-primary-mint/90 text-white flex items-center",children:c?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),"Setting up..."]}):e.jsxs(e.Fragment,{children:["Complete Setup",e.jsx(Ha,{className:"w-4 h-4 ml-2"})]})}):e.jsxs(G,{onClick:v,className:"bg-primary-mint hover:bg-primary-mint/90 text-white flex items-center",children:["Next",e.jsx(Ks,{className:"w-4 h-4 ml-2"})]})]})]})})})}function SM({token:a,email:r,onSwitchToLogin:i}){const[o,c]=f.useState(""),[m,u]=f.useState(""),[g,x]=f.useState(!1),[p,y]=f.useState(!1),[v,w]=f.useState({}),[N,D]=f.useState(!1),[b,E]=f.useState(!1),[_,M]=f.useState(""),{resetPassword:k}=ts(),C=()=>{const R={};return o?o.length<8&&(R.password="Password must be at least 8 characters"):R.password="Password is required",m?o!==m&&(R.confirmPassword="Passwords do not match"):R.confirmPassword="Please confirm your password",w(R),Object.keys(R).length===0},j=async R=>{if(R.preventDefault(),!!C()){D(!0),w({});try{const H=await k(a,r,o,m);H.success?(E(!0),M(H.message)):w({general:H.error})}catch{w({general:"An unexpected error occurred. Please try again."})}finally{D(!1)}}},O=R=>{c(R.target.value),v.password&&w(H=>({...H,password:""}))},L=R=>{u(R.target.value),v.confirmPassword&&w(H=>({...H,confirmPassword:""}))};return b?e.jsxs("div",{className:"w-full max-w-md mx-auto",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(Ha,{className:"w-8 h-8 text-green-600"})}),e.jsx("h1",{className:"text-3xl font-bold text-primary-navy mb-2",children:"Password Reset Complete"}),e.jsx("p",{className:"text-neutral-dark",children:"Your password has been successfully reset. You can now sign in with your new password."})]}),e.jsxs(G,{onClick:i,className:"w-full bg-primary-mint hover:bg-primary-mint/90 text-white",children:[e.jsx(ns,{className:"mr-2 h-4 w-4"}),"Back to Sign In"]})]}):e.jsxs("div",{className:"w-full max-w-md mx-auto",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("h1",{className:"text-3xl font-bold text-primary-navy mb-2",children:"Reset your password"}),e.jsx("p",{className:"text-neutral-dark",children:"Enter a new password for your account"}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:["Email: ",r]})]}),e.jsxs("form",{onSubmit:j,className:"space-y-6",children:[v.general&&e.jsx("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg",children:e.jsx("p",{className:"text-sm text-red-600",children:v.general})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"password",className:"text-neutral-dark font-medium",children:"New Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(ma,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-neutral-dark/50"}),e.jsx(he,{id:"password",name:"password",type:g?"text":"password",placeholder:"Enter your new password",value:o,onChange:O,className:`pl-10 pr-10 ${v.password?"border-red-300 focus:border-red-500":""}`,disabled:N}),e.jsx("button",{type:"button",onClick:()=>
730x(!g),className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-neutral-dark/50 hover:text-neutral-dark transition-colors",children:g?e.jsx(Zs,{className:"h-4 w-4"}):e.jsx(rs,{className:"h-4 w-4"})})]}),v.password&&e.jsx("p",{className:"text-sm text-red-600",children:v.password})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"confirmPassword",className:"text-neutral-dark font-medium",children:"Confirm New Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(ma,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-neutral-dark/50"}),e.jsx(he,{id:"confirmPassword",name:"confirmPassword",type:p?"text":"password",placeholder:"Confirm your new password",value:m,onChange:L,className:`pl-10 pr-10 ${v.confirmPassword?"border-red-300 focus:border-red-500":""}`,disabled:N}),e.jsx("button",{type:"button",onClick:()=>y(!p),className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-neutral-dark/50 hover:text-neutral-dark transition-colors",children:p?e.jsx(Zs,{className:"h-4 w-4"}):e.jsx(rs,{className:"h-4 w-4"})})]}),v.confirmPassword&&e.jsx("p",{className:"text-sm text-red-600",children:v.confirmPassword})]}),e.jsx(G,{type:"submit",className:"w-full bg-primary-mint hover:bg-primary-mint/90 text-white",disabled:N,children:N?e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),"Resetting password..."]}):e.jsxs("div",{className:"flex items-center justify-center",children:["Reset password",e.jsx(Ks,{className:"ml-2 h-4 w-4"})]})})]}),e.jsx("div",{className:"mt-8 text-center",children:e.jsxs("button",{onClick:i,className:"text-primary-mint hover:text-primary-mint/80 font-medium transition-colors inline-flex items-center",children:[e.jsx(ns,{className:"mr-1 h-4 w-4"}),"Back to Sign In"]})})]})}function CM(){const a=window.location.pathname.split("/").pop(),[r,i]=f.useState(null),[o,c]=f.useState(!0),[m,u]=f.useState(!1),[g,x]=f.useState(null),[p,y]=f.useState(!1),[v,w]=f.useState({first_name:"",last_name:"",password:"",password_confirmation:""}),[N,D]=f.useState({});f.useEffect(()=>{a&&(async()=>{try{c(!0),x(null);const k=await(await fetch(`http://localhost:8001/api/v1/client/invitation/${a}`)).json();k.success?i(k.data):x(k.message||"Invalid invitation")}catch{x("Failed to load invitation")}finally{c(!1)}})()},[a]);const b=_=>{const{name:M,value:k}=_.target;w(C=>({...C,[M]:k})),N[M]&&D(C=>({...C,[M]:null}))},E=async _=>{_.preventDefault();try{u(!0),D({}),x(null);const k=await(await fetch(`http://localhost:8001/api/v1/client/accept-invitation/${a}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(v)})).json();k.success?(localStorage.setItem("authToken",k.data.token),localStorage.setItem("userRole","client"),y(!0),setTimeout(()=>{window.location.href="/"},2e3)):k.errors?D(k.errors):x(k.message||"Failed to accept invitation")}catch{x("Failed to accept invitation")}finally{u(!1)}};return o?e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-primary-navy/5 to-primary-mint/5 flex items-center justify-center p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(xa,{className:"w-6 h-6 animate-spin text-primary-navy"}),e.jsx("span",{className:"text-muted-foreground",children:"Loading invitation..."})]})}):g&&!r?e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-primary-navy/5 to-primary-mint/5 flex items-center justify-center p-4",children:e.jsxs(Ce,{className:"max-w-md w-full p-6 text-center",children:[e.jsx(es,{className:"w-12 h-12 text-destructive mx-auto mb-4"}),e.jsx("h2",{className:"text-xl font-semibold text-foreground mb-2",children:"Invalid Invitation"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:g}),e.jsx(G,{onClick:()=>window.location.href="/",variant:"outline",children:"Go to Homepage"})]})}):p?e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-primary-navy/5 to-primary-mint/5 flex items-center justify-center p-4",children:e.jsxs(Ce,{className:"max-w-md w-full p-6 text-center",children:[e.jsx(Ha,{className:"w-12 h-12 text-green-500 mx-auto mb-4"}),e.jsx("h2",{className:"text-xl font-semibold text-foreground mb-2",children:"Welcome!"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Your account has been created successfully. Redirecting to your project portal..."}
730),e.jsx(xa,{className:"w-4 h-4 animate-spin mx-auto"})]})}):e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-primary-navy/5 to-primary-mint/5 flex items-center justify-center p-4",children:e.jsxs(Ce,{className:"max-w-lg w-full p-6",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("div",{className:"mx-auto w-16 h-16 bg-primary-mint/10 rounded-full flex items-center justify-center mb-4",children:e.jsx(Lt,{className:"w-8 h-8 text-primary-mint"})}),e.jsx("h1",{className:"text-2xl font-bold text-foreground mb-2",children:"Welcome to Your Project Portal"}),e.jsx("p",{className:"text-muted-foreground",children:"Complete your account setup to access your projects"})]}),r&&e.jsxs("div",{className:"bg-muted/30 rounded-lg p-4 mb-6 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ps,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:r.company.name})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(nt,{className:"w-4 h-4 text-muted-foreground"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["Invited by ",r.inviter.first_name," ",r.inviter.last_name]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(os,{className:"w-4 h-4 text-muted-foreground"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["Expires: ",new Date(r.expires_at).toLocaleDateString()]})]}),r.message&&e.jsx("div",{className:"pt-3 border-t border-border/50",children:e.jsxs("p",{className:"text-sm text-muted-foreground italic",children:['"',r.message,'"']})})]}),e.jsxs("form",{onSubmit:E,className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"first_name",className:"block text-sm font-medium text-foreground mb-1",children:"First Name"}),e.jsx(he,{id:"first_name",name:"first_name",type:"text",required:!0,value:v.first_name,onChange:b,className:N.first_name?"border-destructive":""}),N.first_name&&e.jsx("p",{className:"text-xs text-destructive mt-1",children:N.first_name[0]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"last_name",className:"block text-sm font-medium text-foreground mb-1",children:"Last Name"}),e.jsx(he,{id:"last_name",name:"last_name",type:"text",required:!0,value:v.last_name,onChange:b,className:N.last_name?"border-destructive":""}),N.last_name&&e.jsx("p",{className:"text-xs text-destructive mt-1",children:N.last_name[0]})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-foreground mb-1",children:"Email Address"}),e.jsx(he,{id:"email",type:"email",value:r?.client.email||"",disabled:!0,className:"bg-muted/50"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:"Password"}),e.jsx(he,{id:"password",name:"password",type:"password",required:!0,minLength:8,value:v.password,onChange:b,className:N.password?"border-destructive":""}),N.password&&e.jsx("p",{className:"text-xs text-destructive mt-1",children:N.password[0]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password_confirmation",className:"block text-sm font-medium text-foreground mb-1",children:"Confirm Password"}),e.jsx(he,{id:"password_confirmation",name:"password_confirmation",type:"password",required:!0,minLength:8,value:v.password_confirmation,onChange:b,className:N.password_confirmation?"border-destructive":""}),N.password_confirmation&&e.jsx("p",{className:"text-xs text-destructive mt-1",children:N.password_confirmation[0]})]}),g&&e.jsx("div",{className:"p-3 bg-destructive/10 border border-destructive/20 rounded-lg",children:e.jsx("p",{className:"text-sm text-destructive",children:g})}),e.jsx(G,{type:"submit",disabled:m,className:"w-full bg-primary-mint hover:bg-primary-mint/90",children:m?e.jsxs(e.Fragment,{children:[e.jsx(xa,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating Account..."]}):"Create Account & Access Portal"})]}),e.jsx("div",{className:"mt-6 text-center text-xs text-muted-foreground",children:"By creating an account, you agree to access your project information through this portal."})]})})}function kM(){const a=window.location.pathname.split("/").pop(),[r,i]=f.useState(null),[o,c]=f.useState(!0),[m,u]=f.useState(!1),[g,x]=f.useState(null),[p,y]=f.useState(!1),[v,w]=f.useState({first_name:"",last_name:"",password:"",password_confirmation:""}),[N,D]=f.useState({});f.useEffect(()=>{a&&(async()=>{try{c(!0),x(null);const C=await(await fetch(`http://localhost:8001/api/v1/invitation/${a}`)).json();C.invitation?i(C.invitation):x("Invalid invitation")}catch{x("Failed to load invitation")}finally{c(!1)}})()},[a]);const b=(M,k)=>{w(C=>({...C,[M]:k})),N[M]&&D(C=>({...C,[M]:""}))},E=()=>{const M={};return v.first_name.trim()||(M.first_name="First name is required"),v.last_name.trim()||(M.last_name="Last name is required"),v.password?v.password.length<8&&(M.password="Password must be at least 8 characters"):M.password="Password is required",v.password_confirmation?v.password!==v.password_confirmation&&(M.password_confirmation="Passwords do not match"):M.password_confirmation="Please confirm your password",D(M),Object.keys(M).length===0},_=async M=>{if(M.preventDefault(),!!E()){u(!0),x(null);try{const C=await(await fetch(`http://localhost:8001/api/v1/invitation/${a}/accept`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)})).json();C.success?y(!0):(x(C.error||"Failed to accept invitation"),C.errors&&D(C.errors))}catch{x("Failed to create account")}finally{u(!1)}}};return o?e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-primary-navy via-primary-navy
730/90 to-primary-mint/20 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(xa,{className:"h-8 w-8 animate-spin text-primary-mint mx-auto mb-4"}),e.jsx("p",{className:"text-white",children:"Loading invitation..."})]})}):g&&!r?e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-primary-navy via-primary-navy/90 to-primary-mint/20 flex items-center justify-center p-4",children:e.jsxs(Ce,{className:"w-full max-w-md p-6 text-center",children:[e.jsx(es,{className:"h-12 w-12 text-red-500 mx-auto mb-4"}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Invalid Invitation"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:g}),e.jsx(G,{onClick:()=>window.location.href="/",className:"w-full",children:"Go to Homepage"})]})}):p?e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-primary-navy via-primary-navy/90 to-primary-mint/20 flex items-center justify-center p-4",children:e.jsxs(Ce,{className:"w-full max-w-md p-6 text-center",children:[e.jsx(Ha,{className:"h-12 w-12 text-green-500 mx-auto mb-4"}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Account Created Successfully!"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"You can now log in to your company admin account."}),e.jsx(G,{onClick:()=>window.location.href="/",className:"w-full bg-primary-mint hover:bg-primary-mint/90",children:"Go to Login"})]})}):e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-primary-navy via-primary-navy/90 to-primary-mint/20 flex items-center justify-center p-4",children:e.jsxs(Ce,{className:"w-full max-w-md p-6",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx(yt,{className:"h-12 w-12 text-primary-mint mx-auto mb-4"}),e.jsx("h2",{className:"text-2xl font-bold",children:"Join as Company Admin"}),e.jsxs("p",{className:"text-muted-foreground mt-2",children:["Complete your account setup to join ",r?.company?.name||"the company"]})]}),r&&e.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 mb-6",children:e.jsxs("div",{className:"flex items-start space-x-3",children:[e.jsx(Lt,{className:"h-5 w-5 text-blue-600 mt-0.5"}),e.jsxs("div",{className:"text-sm text-blue-800",children:[e.jsx("p",{className:"font-medium",children:"Invitation Details"}),e.jsxs("p",{children:["Email: ",r.email]}),e.jsxs("p",{children:["Company: ",r.company?.name]}),e.jsx("p",{children:"Role: Company Administrator"})]})]})}),g&&e.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 mb-6",children:e.jsxs("div",{className:"flex items-start space-x-3",children:[e.jsx(es,{className:"h-5 w-5 text-red-600 mt-0.5"}),e.jsx("p",{className:"text-sm text-red-800",children:g})]})}),e.jsxs("form",{onSubmit:_,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"first_name",className:"text-sm font-medium",children:"First Name *"}),e.jsxs("div",{className:"relative",children:[e.jsx(nt,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(he,{id:"first_name",type:"text",placeholder:"John",value:v.first_name,onChange:M=>b("first_name",M.target.value),className:`pl-10 ${N.first_name?"border-red-500":""}`})]}),N.first_name&&e.jsx("p",{className:"text-sm text-red-600",children:N.first_name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"last_name",className:"text-sm font-medium",children:"Last Name *"}),e.jsxs("div",{className:"relative",children:[e.jsx(nt,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(he,{id:"last_name",type:"text",placeholder:"Doe",value:v.last_name,onChange:M=>b("last_name",M.target.value),className:`pl-10 ${N.last_name?"border-red-500":""}`})]}),N.last_name&&e.jsx("p",{className:"text-sm text-red-600",children:N.last_name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"password",className:"text-sm font-medium",children:"Password *"}),e.jsx(he,{id:"password",type:"password",placeholder:"Create a secure password",value:v.password,onChange:M=>b("password",M.target.value),className:N.password?"border-red-500":""}),N.password&&e.jsx("p",{className:"text-sm text-red-600",children:N.password})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"password_confirmation",className:"text-sm font-medium",children:"Confirm Password *"}),e.jsx(he,{id:"password_confirmation",type:"password",placeholder:"Confirm your password",value:v.password_confirmation,onChange:M=>b("password_confirmation",M.target.value),className:N.password_confirmation?"border-red-500":""}),N.password_confirmation&&e.jsx("p",{className:"text-sm text-red-600",children:N.password_confirmation})]}),e.jsx(G,{type:"submit",className:"w-full bg-primary-mint hover:bg-primary-mint/90 text-white",disabled:m,children:m?e.jsxs(e.Fragment,{children:[e.jsx(xa,{
730className:"h-4 w-4 animate-spin mr-2"}),"Creating Account..."]}):"Create Admin Account"})]}),e.jsx("div",{className:"mt-6 text-center",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Already have an account?"," ",e.jsx("button",{onClick:()=>window.location.href="/",className:"text-primary-mint hover:underline",children:"Sign in here"})]})})]})})}const _M=f.createContext(),Gs=({children:a})=>{const[r,i]=f.useState([]),[o,c]=f.useState(0),[m,u]=f.useState(!1),g=async(_={})=>{u(!0);try{const M=await ve.getNotifications(_);if(M.success)return i(M.data),M.data}catch{i([])}finally{u(!1)}return[]},x=async()=>{try{const _=await ve.getUnreadNotificationCount();_.success&&c(_.data.unread_count)}catch{console.error("Failed to fetch unread count:")}},p=async _=>{try{(await ve.markNotificationAsRead(_)).success&&(i(k=>k.map(C=>C.id===_?{...C,read_at:new Date().toISOString()}:C)),c(k=>Math.max(0,k-1)))}catch{console.error("Failed to mark notification as read:")}},y=async _=>{try{(await ve.markNotificationAsUnread(_)).success&&(i(k=>k.map(C=>C.id===_?{...C,read_at:null}:C)),c(k=>k+1))}catch{console.error("Failed to mark notification as unread:")}},v=async()=>{try{(await ve.markAllNotificationsAsRead()).success&&(i(M=>M.map(k=>({...k,read_at:new Date().toISOString()}))),c(0))}catch{console.error("Failed to mark all notifications as read:")}},w=async _=>{try{if((await ve.deleteNotification(_)).success){const k=r.find(C=>C.id===_);i(C=>C.filter(j=>j.id!==_)),k&&!k.read_at&&c(C=>Math.max(0,C-1))}}catch{console.error("Failed to delete notification:")}},N=async()=>{try{(await ve.deleteAllReadNotifications()).success&&i(M=>M.filter(k=>!k.read_at))}catch{console.error("Failed to delete read notifications:")}},D=async()=>{try{const _=await ve.createTestNotification();_.success&&(i(M=>[_.data,...M]),c(M=>M+1))}catch{console.error("Failed to create test notification:")}},b=_=>{i(M=>[_,...M]),_.read_at||c(M=>M+1)};f.useEffect(()=>{g(),x();const _=setInterval(x,12e4);return()=>clearInterval(_)},[]);const E={notifications:r,unreadCount:o,isLoading:m,fetchNotifications:g,fetchUnreadCount:x,markAsRead:p,markAsUnread:y,markAllAsRead:v,deleteNotification:w,deleteAllRead:N,createTestNotification:D,addNotification:b};return e.jsx(_M.Provider,{value:E,children:a})},dr=[{id:1,name:"E-commerce Website Redesign",description:"Complete redesign and development of the e-commerce platform with modern UI/UX and enhanced functionality.",clientId:3,clientName:"Client Corp",status:"In Progress",priority:"High",startDate:"2024-01-15",endDate:"2024-03-30",budget:45e3,actualCost:28e3,progress:65,projectManager:"Sarah Johnson",teamMembers:["Sarah Johnson","Mike Chen","Alex Rodriguez","Emma Wilson"],tags:["Web Development","E-commerce","UI/UX"],tasks:[{id:1,title:"User Research & Analysis",description:"Conduct user interviews and analyze current platform usage",status:"Completed",assignee:"Emma Wilson",dueDate:"2024-01-25",priority:"High",completedDate:"2024-01-24"},{id:2,title:"Wireframes & Prototypes",description:"Create wireframes and interactive prototypes for new design",status:"Completed",assignee:"Emma Wilson",dueDate:"2024-02-10",priority:"High",completedDate:"2024-02-08"},{id:3,title:"Frontend Development",description:"Implement new design with React and modern best practices",status:"In Progress",assignee:"Mike Chen",dueDate:"2024-03-15",priority:"High"},{id:4,title:"Backend API Integration",description:"Integrate with existing backend APIs and optimize performance",status:"In Progress",assignee:"Alex Rodriguez",dueDate:"2024-03-20",priority:"Medium"},{id:5,title:"Testing & QA",description:"Comprehensive testing across devices and browsers",status:"Pending",assignee:"Sarah Johnson",dueDate:"2024-03-25",priority:"High"}],milestones:[{id:1,title:"Design Approval",date:"2024-02-15",status:"Completed",description:"Client approval of final designs and prototypes"},{id:2,title:"Frontend MVP",date:"2024-03-10",status:"In Progress",description:"Minimum viable product with core functionality"},{id:3,title:"Final Delivery",date:"2024-03-30",status:"Pending",description:"Complete project delivery and handover"}],documents:[{id:1,name:"Project Proposal.pdf",type:"PDF",size:"2.3 MB",uploadDate:"2024-01-10"},{id:2,name:"Design Mockups.fig",type:"Figma",size:"15.7 MB",uploadDate:"2024-02-05"}
730,{id:3,name:"Technical Specifications.docx",type:"Word",size:"1.8 MB",uploadDate:"2024-02-12"}],timeEntries:[{id:1,date:"2024-02-20",member:"Mike Chen",hours:8,description:"Frontend component development"},{id:2,date:"2024-02-21",member:"Alex Rodriguez",hours:6,description:"API integration work"},{id:3,date:"2024-02-22",member:"Emma Wilson",hours:4,description:"Design review and updates"}]},{id:2,name:"Brand Identity Package",description:"Complete brand identity redesign including logo, color palette, typography, and brand guidelines.",clientId:4,clientName:"Startup Venture LLC",status:"Planning",priority:"Medium",startDate:"2024-02-01",endDate:"2024-04-15",budget:25e3,actualCost:5e3,progress:20,projectManager:"Emma Wilson",teamMembers:["Emma Wilson","David Park","Lisa Thompson"],tags:["Branding","Design","Marketing"],tasks:[{id:1,title:"Brand Discovery Workshop",description:"Conduct workshops to understand brand values and vision",status:"Completed",assignee:"Emma Wilson",dueDate:"2024-02-08",priority:"High",completedDate:"2024-02-07"},{id:2,title:"Competitive Analysis",description:"Research competitors and market positioning",status:"In Progress",assignee:"Lisa Thompson",dueDate:"2024-02-20",priority:"Medium"},{id:3,title:"Logo Concepts",description:"Create initial logo concepts and variations",status:"Pending",assignee:"David Park",dueDate:"2024-03-05",priority:"High"}],milestones:[{id:1,title:"Brand Strategy Complete",date:"2024-02-25",status:"In Progress",description:"Finalized brand strategy and positioning"},{id:2,title:"Logo Approval",date:"2024-03-15",status:"Pending",description:"Client approval of final logo design"}],documents:[{id:1,name:"Brand Brief.pdf",type:"PDF",size:"1.2 MB",uploadDate:"2024-01-28"},{id:2,name:"Mood Board.png",type:"Image",size:"3.4 MB",uploadDate:"2024-02-10"}],timeEntries:[{id:1,date:"2024-02-05",member:"Emma Wilson",hours:6,description:"Brand discovery workshop"},{id:2,date:"2024-02-12",member:"Lisa Thompson",hours:4,description:"Market research"}]},{id:3,name:"Mobile App Development",description:"Native iOS and Android mobile application with real-time features and offline capabilities.",clientId:3,clientName:"Green Earth Solutions",status:"Completed",priority:"High",startDate:"2023-08-01",endDate:"2023-12-15",budget:75e3,actualCost:72e3,progress:100,projectManager:"Alex Rodriguez",teamMembers:["Alex Rodriguez","Mike Chen","Sarah Johnson","Tom Wilson"],tags:["Mobile Development","iOS","Android","React Native"],tasks:[{id:1,title:"App Architecture Design",description:"Design scalable architecture for cross-platform app",status:"Completed",assignee:"Alex Rodriguez",dueDate:"2023-08-15",priority:"High",completedDate:"2023-08-14"},{id:2,title:"UI Component Library",description:"Build reusable component library for consistent design",status:"Completed",assignee:"Sarah Johnson",dueDate:"2023-09-30",priority:"Medium",completedDate:"2023-09-28"},{id:3,title:"App Store Deployment",description:"Deploy to iOS App Store and Google Play Store",status:"Completed",assignee:"Tom Wilson",dueDate:"2023-12-10",priority:"High",completedDate:"2023-12-08"}],milestones:[{id:1,title:"MVP Release",date:"2023-10-15",status:"Completed",description:"Minimum viable product with core features"},{id:2,title:"Beta Testing",date:"2023-11-30",status:"Completed",description:"Complete beta testing with target users"},{id:3,title:"Production Launch",date:"2023-12-15",status:"Completed",description:"Official launch on app stores"}],documents:[{id:1,name:"Technical Architecture.pdf",type:"PDF",size:"4.1 MB",uploadDate:"2023-08-10"},{id:2,name:"App Store Assets.zip",type:"Archive",size:"12.3 MB",uploadDate:"2023-12-05"},{id:3,name:"User Manual.pdf",type:"PDF",size:"2.7 MB",uploadDate:"2023-12-12"}],timeEntries:[{id:1,date:"2023-12-01",member:"Alex Rodriguez",hours:8,description:"Final testing and bug fixes"},{id:2,date:"2023-12-05",member:"Tom Wilson",hours:6,description:"App store submission"}]},{id:4,name:"Data Analytics Dashboard",description:"Custom analytics dashboard with real-time data visualization and reporting capabilities.",clientId:1,clientName:"Tech Solutions Inc.",status:"On Hold",priority:"Low",
730startDate:"2024-03-01",endDate:"2024-06-30",budget:35e3,actualCost:8e3,progress:15,projectManager:"Mike Chen",teamMembers:["Mike Chen","Sarah Johnson"],tags:["Analytics","Dashboard","Data Visualization"],tasks:[{id:1,title:"Requirements Gathering",description:"Gather detailed requirements for analytics features",status:"Completed",assignee:"Mike Chen",dueDate:"2024-03-10",priority:"High",completedDate:"2024-03-08"},{id:2,title:"Data Source Integration",description:"Connect to existing data sources and APIs",status:"In Progress",assignee:"Sarah Johnson",dueDate:"2024-04-15",priority:"High"}],milestones:[{id:1,title:"Technical Proof of Concept",date:"2024-04-01",status:"Pending",description:"Working prototype with basic functionality"}],documents:[{id:1,name:"Analytics Requirements.pdf",type:"PDF",size:"1.9 MB",uploadDate:"2024-03-05"}],timeEntries:[{id:1,date:"2024-03-08",member:"Mike Chen",hours:8,description:"Requirements analysis"}]}],DM=()=>{const a=dr.length,r=dr.filter(u=>u.status==="In Progress").length,i=dr.filter(u=>u.status==="Completed").length,o=dr.filter(u=>u.status==="On Hold").length,c=dr.reduce((u,g)=>u+g.budget,0),m=dr.reduce((u,g)=>u+g.actualCost,0);return{total:a,active:r,completed:i,onHold:o,totalBudget:c,totalActual:m,budgetUtilization:Math.round(m/c*100)}},EM=[{id:1,name:"Acme Corporation",contactPerson:"John Smith",email:"[email protected]",phone:"+1 (555) 123-4567",company:"Acme Corporation",address:"123 Business St, Suite 100",city:"New York",state:"NY",zipCode:"10001",country:"United States",industry:"Technology",website:"https://acme.com",status:"Active",createdAt:"2024-01-15",lastContact:"2024-07-10",totalRevenue:45e3,bills:[{id:1,invoiceNumber:"INV-2024-001",amount:15e3,description:"Website Development Phase 1",status:"Paid",issueDate:"2024-06-01",dueDate:"2024-06-30",paidDate:"2024-06-25"},{id:2,invoiceNumber:"INV-2024-002",amount:25e3,description:"Website Development Phase 2",status:"Pending",issueDate:"2024-07-01",dueDate:"2024-07-30",paidDate:null}],emails:[{id:1,subject:"Project Kickoff Meeting",from:"[email protected]",to:"[email protected]",date:"2024-07-10",content:"Hi team, looking forward to starting our project..."},{id:2,subject:"Phase 1 Completion",from:"[email protected]",to:"[email protected]",date:"2024-06-25",content:"We're happy to announce that Phase 1 is complete..."}],notes:[{id:1,content:"Client prefers weekly status updates via email",author:"Sarah Johnson",createdAt:"2024-07-08 14:30",updatedAt:"2024-07-08 14:30"},{id:2,content:"Discussed potential Phase 3 expansion during last call",author:"Mike Chen",createdAt:"2024-07-10 10:15",updatedAt:"2024-07-10 10:15"}]},{id:2,name:"TechStart Inc",contactPerson:"Emma Wilson",email:"[email protected]",phone:"+1 (555) 987-6543",company:"TechStart Inc",address:"456 Innovation Blvd",city:"San Francisco",state:"CA",zipCode:"94105",country:"United States",industry:"Software",website:"https://techstart.io",status:"Active",createdAt:"2024-02-20",lastContact:"2024-07-12",totalRevenue:35e3,bills:[{id:3,invoiceNumber:"INV-2024-003",amount:2e4,description:"Mobile App Development",status:"Paid",issueDate:"2024-05-01",dueDate:"2024-05-30",paidDate:"2024-05-28"},{id:4,invoiceNumber:"INV-2024-004",amount:15e3,description:"App Store Optimization",status:"Overdue",issueDate:"2024-06-01",dueDate:"2024-06-30",paidDate:null}
730],emails:[{id:3,subject:"App Launch Strategy",from:"[email protected]",to:"[email protected]",date:"2024-07-12",content:"We need to discuss the launch strategy for our app..."}],notes:[{id:3,content:"Client is very responsive, prefers Slack communication",author:"David Lee",createdAt:"2024-07-05 09:20",updatedAt:"2024-07-05 09:20"}]},{id:3,name:"Creative Studio",contactPerson:"Alex Rodriguez",email:"[email protected]",phone:"+1 (555) 456-7890",company:"Creative Studio",address:"789 Design Ave",city:"Los Angeles",state:"CA",zipCode:"90210",country:"United States",industry:"Design",website:"https://creativestudio.com",status:"Prospect",createdAt:"2024-07-01",lastContact:"2024-07-14",totalRevenue:0,bills:[],emails:[{id:4,subject:"Brand Identity Project Proposal",from:"[email protected]",to:"[email protected]",date:"2024-07-14",content:"Thank you for your interest in our brand identity services..."}],notes:[{id:4,content:"Potential high-value client, interested in complete rebrand",author:"Sarah Johnson",createdAt:"2024-07-14 16:45",updatedAt:"2024-07-14 16:45"}]}];class MM{constructor(){this.cache=new Map,this.cacheExpiry=5*60*1e3}getCachedData(r){const i=this.cache.get(r);return i&&Date.now()-i.timestamp<this.cacheExpiry?i.data:null}setCachedData(r,i){this.cache.set(r,{data:i,timestamp:Date.now()})}async getDashboardStats(){const r="dashboard-stats",i=this.getCachedData(r);if(i)return i;try{const[o,c,m,u,g,x,p]=await Promise.allSettled([ve.getClients(),ve.getProjects(),ve.getTasks(),ve.getInvoices().catch(()=>({data:[]})),ve.getMessages().catch(()=>({data:[]})),ve.getActivities().catch(()=>({data:[]})),ve.getTeamMembers().catch(()=>({data:[]}))]),y=w=>{if(w.status!=="fulfilled")return[];const N=w.value?.data;return Array.isArray(N)?N:N&&typeof N=="object"&&Array.isArray(N.data)?N.data:[]},v=this.aggregateStats({clients:y(o),projects:y(c),tasks:y(m),invoices:y(u),messages:y(g),activities:y(x),teamMembers:y(p)});return this.setCachedData(r,v),v}catch{return this.getMockDashboardStats()}}aggregateStats(r){const{clients:i,projects:o,tasks:c,invoices:m,messages:u,activities:g,teamMembers:x}=r,p=Array.isArray(i)?i:[],y=Array.isArray(o)?o:[],v=Array.isArray(c)?c:[],w=Array.isArray(m)?m:[],N=Array.isArray(u)?u:[],D=Array.isArray(x)?x:[],b={total:p.length,active:p.filter(j=>j.status==="Active").length,prospects:p.filter(j=>j.status==="Prospect").length,newThisMonth:p.filter(j=>this.isThisMonth(j.created_at)).length},E={total:y.length,active:y.filter(j=>j.status==="In Progress").length,completed:y.filter(j=>j.status==="Completed").length,onHold:y.filter(j=>j.status==="On Hold").length,completedThisMonth:y.filter(j=>j.status==="Completed"&&this.isThisMonth(j.updated_at)).length},_={total:v.length,pending:v.filter(j=>j.status==="To Do").length,inProgress:v.filter(j=>j.status==="In Progress").length,completed:v.filter(j=>j.status==="Done").length,overdue:v.filter(j=>this.isOverdue(j.due_date,j.status)).length,completedThisWeek:v.filter(j=>j.status==="Done"&&this.isThisWeek(j.updated_at)).length},M={totalRevenue:w.reduce((j,O)=>j+(O.amount||0),0),paidInvoices:w.filter(j=>j.status==="Paid").length,pendingInvoices:w.filter(j=>j.status==="Pending").length,overdueInvoices:w.filter(j=>j.status==="Overdue").length,monthlyRevenue:w.filter(j=>j.status==="Paid"&&this.isThisMonth(j.paid_date)).reduce((j,O)=>j+(O.amount||0),0)},k={totalMembers:D.length,activeMembers:D.filter(j=>j.status==="Active").length,tasksPerMember:v.length>0?Math.round(v.length/Math.max(D.length,1)):0,avgTaskCompletion:this.calculateTaskCompletionRate(v)},C={totalMessages:N.length,messagesThisWeek:N.filter(j=>this.isThisWeek(j.created_at)).length,activeConversations:this.getUniqueConversations(N).length};return{clients:b,projects:E,tasks:_,financial:M,team:k,communication:C,lastUpdated:new Date().toISOString()}}async getRecentActivities(r=10){try{return(await ve.getActivities({limit:r})).data||[]}catch{return[]}}async getUpcomingDeadlines(){try{const[r,i]=await Promise.all([ve.getTasks(),ve.getProjects()]),o=Array.isArray(r?.data)?r.data:[],c=Array.isArray(i?.data)?i.data:[],m=o.filter(g=>g.due_date&&g.status!=="Done").map(g=>({type:"task",title:g.title,dueDate:g.due_date,priority:g.priority,isOverdue:this.isOverdue(g.due_date,g.status)})),u=c.filter(g=>g.end_date&&g.status!=="Completed").map(g=>({type:"project",title:g.name,dueDate:g.end_date,priority:g.priority,isOverdue:this.isOverdue(g.end_date,g.status)}));return[...m,...u].sort((g,x)=>new Date(g.dueDate)-new Date(x.dueDate)).slice(0,10)}catch{return[]}}isThisMonth(r){if(!r)return!1;const i=new Date(r),o=new Date;return i.getMonth()===o.getMonth()&&i.getFullYear()===o.getFullYear()}isThisWeek(r){if(!r)return!1;const i=new Date(r),o=new Date,c=new Date(o.setDate(o.getDate()-o.getDay()));return i>=c&&i<=new Date}isOverdue(r,i){return!r||i==="Done"||i==="Completed"?!1:new Date(r)<new Date}calculateTaskCompletionRate(r){if(r.length===0)return 0;const i=r.filter(o=>o.status==="Done").length;return Math.round(i/r.length*100)}getUniqueConversations(r){const i=new Set;return r.forEach(o=>{o.conversation_id&&i.add(o.conversation_id)}),Array.from(i)}getMockDashboardStats(){return{clients:{total:3,active:2,prospects:1,newThisMonth:1},projects:{total:4,active:2,completed:1,onHold:1,completedThisMonth:1},tasks:{total:10,pending:4,inProgress:3,completed:3,overdue:1,completedThisWeek:2},financial:{totalRevenue:8e4,monthlyRevenue:18200,paidInvoices:5,pendingInvoices:2,overdueInvoices:1},team:{totalMembers:6,activeMembers:6,tasksPerMember:2,avgTaskCompletion:70},communication:{totalMessages:45,messagesThisWeek:12,activeConversations:8},lastUpdated:new Date().toISOString()}}clearCache(){this.cache.clear()}}const hl=new MM,TM=({toast:a})=>e.jsxs("div",{className:`pointer-events-auto w-72 max-w-full rounded-lg shadow-lg mb-3 p-4 text-white transition-opacity duration-300 ${a.type==="error"?"bg-red-600":a.type==="success"?"bg-green-600":a.type==="warning"?"bg-yellow-600":"bg-gray-800"}`,children:[a.title&&e.jsx("p",{className:"font-semibold mb-1",children:a.title}),e.jsx("p",{className:"text-sm leading-snug",children:a.message})]});function vN(){const[a,r]=f.useState([]);return f.useEffect(()=>{const i=o=>{const c=o.detail;c.id=crypto.randomUUID(),r(m=>[...m,c]),setTimeout(()=>{r(m=>m.filter(u=>u.id!==c.id))},c.duration||4e3)};return window.addEventListener("app-toast",i),()=>window.removeEventListener("app-toast",i)},[]),a.length===0?null:yr.createPortal(e.jsx("div",{className:"fixed top-4 right-4 z-50 flex flex-col items-end",children:a.map(i=>e.jsx(TM,{toast:i},i.id))}),document.body)}function AM(){const{isAuthenticated:a,isLoading:r,showSetupWizard:i,user:o,logout:c}=ts(),[m,u]=f.useState(window.location.pathname),[g,x]=f.useState(null),[p,y]=f.useState(!0),[v,w]=f.useState(null),[N,D]=f.useState([]),[b,E]=f.useState([]),[_,M]=f.useState([]),[k,C]=f.useState([]);f.useEffect(()=>{const ge=()=>{u(window.location.pathname)};return window.addEventListener("popstate",ge),()=>window.removeEventListener("popstate",ge)},[]),f.useEffect(()=>{a&&o&&!i&&j()},[a,o,i]);const j=async()=>{try{if(y(!0),w(null),!ve.debugAuth().isAuthenticated){w("Authentication required"),y(!1);return}try{const Ae=await ve.checkAuth();if(Ae&&!Ae.valid){c();return}}catch{console.warn("Auth check failed, but continuing with dashboard load:")}const[K,re,je]=await Promise.allSettled([hl.getDashboardStats(),hl.getRecentActivities(10),hl.getUpcomingDeadlines()]);if(K.status==="fulfilled")x(K.value);else throw new Error("Failed to load dashboard statistics");re.status==="fulfilled"&&D(re.value),je.status==="fulfilled"&&E(je.value)}catch(ge){w(ge.message),x(hl.getMockDashboardStats())}finally{y(!1)}};f.useEffect(()=>{if(!a||!o)return;const ge=setInterval(()=>{j()},10*60*1e3);return()=>clearInterval(ge)},[a,o]),f.useEffect(()=>{if(!a||i||m!=="/")return;const ge=K=>{if(!(K.target.tagName==="INPUT"||K.target.tagName==="TEXTAREA")&&(K.ctrlKey||K.metaKey))switch(K.key){case"r":K.preventDefault(),ye();break;case"1":K.preventDefault(),te("Clients");break;case"2":K.preventDefault(),te("Projects");break;case"3":K.preventDefault(),te("Tasks");break;case"4":K.preventDefault(),te("Revenue");break;case"n":K.preventDefault(),K.shiftKey?te("New Project"):te("Create Task");break}};return window.addEventListener("keydown",ge),()=>window.removeEventListener("keydown",ge)},[a,i,m]),f.useEffect(()=>{(async()=>
730{if(!(!a||i))try{const K=await ve.getProjects({page:1,per_page:3});if(K?.success&&K?.data){const re=Array.isArray(K.data?.data)?K.data.data:Array.isArray(K.data)?K.data:[];M(re.slice(0,3))}}catch{M(dr.slice(0,3))}})()},[a,i]),f.useEffect(()=>{(async()=>{if(!(!a||i))try{const K=await ve.getTasksHierarchy();if(K?.success&&K?.data){const re=[];K.data.forEach(Ae=>{Ae.projects?.forEach(ie=>{ie.tasks&&re.push(...ie.tasks)})});const je=re.sort((Ae,ie)=>{const we=new Date(Ae.updated_at||Ae.created_at||0);return new Date(ie.updated_at||ie.created_at||0)-we}).slice(0,3);C(je)}}catch{C(Ys.slice(0,3))}})()},[a,i]);const O=m.match(/^\/client\/accept-invitation\/(.+)$/),L=O?O[1]:null,R=m.match(/^\/accept-invitation\/(.+)$/),H=R?R[1]:null,z=m==="/reset-password",V=new URLSearchParams(window.location.search),Z=V.get("token"),I=V.get("email"),ue=m==="/admin";if(z&&Z&&I&&!a)return e.jsx(Gs,{children:e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-primary-navy via-primary-navy/90 to-primary-mint/20 flex items-center justify-center p-4",children:e.jsx("div",{className:"w-full max-w-md",children:e.jsx("div",{className:"bg-white rounded-2xl shadow-2xl p-8",children:e.jsx(SM,{token:Z,email:I,onSwitchToLogin:()=>{window.history.pushState(null,"","/"),u("/")}})})})})});if(L&&!a)return e.jsx(Gs,{children:e.jsx(CM,{})});if(H&&!a)return e.jsx(Gs,{children:e.jsx(kM,{})});if(r)return e.jsx(Gs,{children:e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-primary-navy via-primary-navy/90 to-primary-mint/20 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 bg-white rounded-2xl mb-4 shadow-lg p-3",children:e.jsx("img",{src:"/Novio_logo.png",alt:"Novio Logo",className:"w-full h-full object-contain"})}),e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary-mint mx-auto mb-4"}),e.jsx("p",{className:"text-white/80",children:"Loading Novio..."})]})})});if(!a)return e.jsx(Gs,{children:e.jsx(NM,{})});if(i)return e.jsx(Gs,{children:e.jsx(wM,{})});if(ue&&(o?.isNovioAdmin||o?.is_novio_admin))return e.jsx(Gs,{children:e.jsx(xM,{})});if(ue&&!(o?.isNovioAdmin||o?.is_novio_admin))return window.history.pushState(null,"","/"),window.location.reload(),null;if(o?.role?.toLowerCase()==="client")return e.jsx(Gs,{children:e.jsx(dM,{})});if((o?.isNovioAdmin||o?.is_novio_admin)&&m==="/"){const ge=()=>{window.history.pushState(null,"","/dashboard"),u("/dashboard")},K=async()=>{await c()};return e.jsx(Gs,{children:e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-primary-navy via-primary-navy/90 to-primary-mint/20 flex items-center justify-center p-4",children:e.jsx("div",{className:"w-full max-w-2xl",children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl p-8 text-center relative",children:[e.jsx("button",{onClick:K,className:"absolute top-4 right-4 p-2 text-neutral-dark hover:text-red-600 hover:bg-red-50 rounded-lg transition-colors",title:"Logout",children:e.jsx(vl,{className:"h-5 w-5"})}),e.jsx("div",{className:"w-20 h-20 bg-primary-mint/10 rounded-2xl flex items-center justify-center mx-auto mb-6",children:e.jsx("img",{src:"/Novio_logo.png",alt:"Novio Logo",className:"w-12 h-12 object-contain"})}),e.jsx("h1",{className:"text-3xl font-bold text-primary-navy mb-4",children:"Welcome, Novio Admin!"}),e.jsxs("p",{className:"text-neutral-dark mb-2",children:["Hello ",o.first_name," ",o.last_name]}),e.jsx("p",{className:"text-neutral-dark/70 mb-8",children:"You have administrative privileges. Choose how you'd like to proceed:"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[e.jsxs("button",{onClick:()=>{window.history.pushState(null,"","/admin"),window.dispatchEvent(new PopStateEvent("popstate"))},className:"flex flex-col items-center p-6 rounded-xl border-2 border-primary-mint bg-primary-mint/5 hover:bg-primary-mint/10 transition-colors",children:[e.jsx(Ic,{className:"h-12 w-12 text-primary-mint mb-3"}),e.jsx("h3",{className:"text-lg font-semibold text-primary-navy mb-2",children:"Admin Panel"}),e.jsx("p",{className:"text-sm text-neutral-dark",children:"Manage companies, users, and system settings"})]}),e.jsxs("button",{onClick:ge,className:"flex flex-col items-center p-6 rounded-xl border-2 border-neutral-light bg-neutral-lightest hover:bg-neutral-light/50 transition-colors",children:[e.jsx(Fc,{className:"h-12 w-12 text-neutral-dark mb-3"}),e.jsx("h3",{className:"text-lg font-semibold text-primary-navy mb-2",children:"Regular App"}),e.jsx("p",{className:"text-sm text-neutral-dark",children:"Access the standard Nuvio application"})]})]}),e.jsx("div",{className:"flex justify-center",children:e.jsxs("button",{onClick:K,className:"flex items-center text-sm text-neutral-dark/70 hover:text-red-600 transition-colors",children:[e.jsx(vl,{className:"h-4 w-4 mr-2"}),"Sign out of your account"]})})]})})})})}if(p&&a&&!i)return e.jsx(Gs,{children:e.jsx(t0,{children:e.jsxs("div",{className:"p-8 space-y-8 animate-pulse",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-1/3"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[1,2,3,4].map(ge=>e.jsx("div",{className:"h-32 bg-muted rounded"},ge))}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[e.jsx("div",{className:"h-64 bg-muted rounded"}),e.jsx("div",{className:"h-64 bg-muted rounded"})]})]})})});const X=O_(),P=L_(),$=z_(),F=g||hl.getMockDashboardStats(),ne=F.tasks||c3(),T=F.projects||DM(),B=F.clients||{total:EM.length,newThisMonth:1},ee=F.financial||{monthlyRevenue:18200},te=ge=>{window.showAchievement&&window.showAchievement({type:"firstAction",title:`Navigating to ${ge}! 🚀`,message:`Opening ${ge} section...`});const K={"Add Client":()=>{window.dispatchEvent(new CustomEvent("navigate",{detail:{page:"clients",action:"add"}}))},"New Client":()=>{window.dispatchEvent(new CustomEvent("navigate",{detail:{page:"clients",action:"add"}}))},"New Project":()=>{window.dispatchEvent(new CustomEvent("navigate",{detail:{page:"projects",action:"add"}}))},"Create Task":()=>{window.dispatchEvent(new CustomEvent("navigate",{detail:{page:"tasks",action:"add"}}))},"New Invoice":()=>{window.dispatchEvent(new CustomEvent("navigate",{detail:{page:"invoicing",action:"add"}}))},"Team Chat":()=>{window.dispatchEvent(new CustomEvent("navigate",{detail:{page:"messages"}}))},Clients:()=>{window.dispatchEvent(new CustomEvent("navigate",{detail:{page:"clients"}}))},Projects:()=>{window.dispatchEvent(new CustomEvent("navigate",{detail:{page:"projects"}}))},Tasks:()=>{window.dispatchEvent(new CustomEvent("navigate",{detail:{page:"tasks"}}))},Revenue:()=>{window.dispatchEvent(new CustomEvent("navigate",{detail:{page:"invoicing"}}))}};if(K[ge])K[ge]();else{const re=`/${ge.toLowerCase().replace(/\s+/g,"-")}`;window.history.pushState(null,"",re),u(re)}},ye=async()=>{window.showAchievement&&window.showAchievement({type:"streak",title:"Refreshing Dashboard! 🔄",message:"Getting the latest business data..."}),hl.clearCache(),await j()};return e.jsxs(Gs,{children:[e.jsx(vN,{}),e.jsxs("div",{className:"fixed inset-0 overflow-hidden pointer-events-none",style:{zIndex:-1},children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-100/80 via-indigo-100/60 to-slate-100/70 dark:from-zinc-900/40 dark:via-slate-900/30 dark:to-black/50"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-tr from-primary-navy
730/[0.15] via-blue-200/50 to-primary-mint/[0.25] dark:from-primary-navy/[0.08] dark:via-slate-800/20 dark:to-primary-mint/[0.12]"}),e.jsx("div",{className:"absolute inset-0 opacity-[0.08]",style:{backgroundImage:`
731              linear-gradient(rgba(10, 31, 68, 0.1) 1px, transparent 1px),
732              linear-gradient(90deg, rgba(10, 31, 68, 0.1) 1px, transparent 1px),
733              linear-gradient(rgba(45, 225, 194, 0.05) 1px, transparent 1px),
734              linear-gradient(90deg, rgba(45, 225, 194, 0.05) 1px, transparent 1px)
735            `,backgroundSize:"100px 100px, 100px 100px, 50px 50px, 50px 50px"}}),e.jsx("div",{className:"absolute -top-40 -left-40 w-80 h-80 bg-gradient-radial from-primary-mint/25 via-primary-mint/15 to-transparent rounded-full blur-3xl animate-pulse",style:{animationDuration:"4s"}}),e.jsx("div",{className:"absolute -bottom-40 -right-40 w-96 h-96 bg-gradient-radial from-primary-navy/20 via-blue-500/12 to-transparent rounded-full blur-3xl animate-pulse",style:{animationDuration:"6s",animationDelay:"2s"}}),e.jsx("div",{className:"absolute top-1/4 -left-20 w-64 h-64 bg-gradient-radial from-blue-400/15 via-indigo-400/8 to-transparent rounded-full blur-2xl animate-pulse",style:{animationDuration:"5s",animationDelay:"1s"}}),e.jsx("div",{className:"absolute bottom-1/4 -right-20 w-60 h-60 bg-gradient-radial from-cyan-400/12 via-teal-400/6 to-transparent rounded-full blur-2xl animate-pulse",style:{animationDuration:"7s",animationDelay:"3s"}}),e.jsx("div",{className:"absolute top-32 left-20 w-32 h-32 bg-gradient-to-br from-primary-mint/20 to-blue-400/15 rounded-2xl blur-lg animate-spin",style:{animationDuration:"20s"}}),e.jsx("div",{className:"absolute top-60 right-32 w-24 h-24 bg-gradient-to-br from-blue-500/18 to-indigo-600/12 rounded-xl rotate-45 blur-md animate-bounce",style:{animationDuration:"3s"}}),e.jsx("div",{className:"absolute bottom-48 left-1/3 w-20 h-20 bg-gradient-to-br from-cyan-500/15 to-primary-mint/20 rounded-full blur-md animate-pulse",style:{animationDuration:"2s"}}),e.jsx("div",{className:"absolute top-1/2 right-1/4 w-28 h-28 bg-gradient-radial from-indigo-400/12 via-blue-500/8 to-transparent rounded-full blur-lg animate-ping",style:{animationDuration:"4s"}}),e.jsx("div",{className:"absolute bottom-32 right-20 w-16 h-16 bg-gradient-to-br from-slate-400/15 to-blue-400/10 rounded-lg rotate-12 blur-sm animate-spin",style:{animationDuration:"8s"}}),e.jsx("div",{className:"absolute top-40 left-1/2 w-12 h-12 bg-primary-mint/25 rounded-full blur-sm animate-pulse",style:{animationDuration:"1.5s"}}),e.jsx("div",{className:"absolute bottom-60 right-1/3 w-14 h-14 bg-primary-navy/20 rounded-lg rotate-45 blur-sm animate-bounce",style:{animationDuration:"2.5s"}}),e.jsx("div",{className:"absolute top-3/4 left-24 w-8 h-8 bg-blue-400/30 rounded-full blur-sm animate-ping",style:{animationDuration:"3s"}}),e.jsx("div",{className:"absolute top-60 left-1/2 w-16 h-16 bg-gradient-to-br from-primary-mint/6 to-cyan-400/4 rounded-full blur-md animate-float-fast delay-500"}),e.jsx("div",{className:"absolute bottom-80 right-1/3 w-20 h-20 bg-gradient-to-br from-blue-400/4 to-indigo-500/6 rounded-xl rotate-45 blur-sm animate-float-slow delay-2000"}),e.jsx("div",{className:"absolute top-1/3 left-24 w-14 h-14 bg-gradient-to-br from-slate-400/4 to-blue-300/3 rounded-full blur-sm animate-float-medium delay-1500"}),e.jsx("div",{className:"absolute bottom-1/3 right-20 w-18 h-18 bg-gradient-radial from-primary-navy/4 via-blue-500/2 to-transparent rounded-full blur-md animate-float-fast delay-800"}),e.jsx("div",{className:"absolute top-0 left-1/4 w-2 h-64 bg-gradient-to-b from-primary-mint/10 via-blue-400/6 to-transparent blur-sm animate-aurora delay-1000"}),e.jsx("div",{className:"absolute bottom-0 right-1/3 w-2 h-48 bg-gradient-to-t from-primary-navy/8 via-indigo-400/4 to-transparent blur-sm animate-aurora delay-2000"}),e.jsx("div",{className:"absolute left-0 top-1/3 h-2 w-56 bg-gradient-to-r from-cyan-400/6 via-primary-mint/8 to-transparent blur-sm animate-aurora delay-1500"}),e.jsx("div",{className:"absolute right-0 bottom-1/4 h-2 w-40 bg-gradient-to-l from-blue-500/6 via-indigo-400/4 to-transparent blur-sm animate-aurora delay-500"}),e.jsx("div",{className:"absolute top-1/5 left-1/5 w-48 h-px bg-gradient-to-r from-transparent via-primary-mint/12 to-transparent animate-gradient-shift"}),e.jsx("div",{className:"absolute bottom-1/5 right-1/5 w-px h-40 bg-gradient-to-b from-transparent via-primary-navy
735/10 to-transparent animate-pulse-slow delay-1000"}),e.jsx("div",{className:"absolute top-2/3 left-2/3 w-32 h-px bg-gradient-to-r from-transparent via-blue-400/8 to-transparent animate-pulse-slow delay-2000"}),e.jsx("div",{className:"absolute inset-0 opacity-[0.02]",style:{backgroundImage:`
736              radial-gradient(circle at 25% 25%, rgba(45, 225, 194, 0.1) 1px, transparent 1px),
737              radial-gradient(circle at 75% 75%, rgba(10, 31, 68, 0.1) 1px, transparent 1px)
738            `,backgroundSize:"40px 40px, 60px 60px"}}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50/[0.3] via-transparent to-indigo-50/[0.2] dark:from-zinc-950/[0.2] dark:via-transparent dark:to-slate-950/[0.1]"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-tr from-primary-mint/[0.01] via-transparent to-blue-400/[0.015] dark:from-primary-mint/[0.005] dark:via-transparent dark:to-blue-600/[0.008]"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-bl from-transparent via-slate-50/[0.15] to-transparent dark:from-transparent dark:via-zinc-950/[0.08] dark:to-transparent"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-radial from-transparent via-white/[0.02] to-transparent dark:from-transparent dark:via-black/[0.01] dark:to-transparent"})]}),e.jsx(t0,{children:e.jsxs("div",{className:"p-4 lg:p-8 space-y-6 lg:space-y-8",children:[e.jsx("div",{className:"relative",children:e.jsxs("div",{className:"flex flex-col xl:flex-row xl:items-start justify-between gap-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h1",{className:"text-3xl lg:text-4xl font-bold text-foreground flex items-center gap-3",children:[X.emoji," ",X.greeting,", ",o?.firstName,"!"]}),e.jsx("p",{className:"text-base lg:text-lg text-muted-foreground",children:X.message}),e.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[e.jsx("p",{className:"text-sm text-primary-mint font-medium",children:P}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(os,{className:"h-4 w-4"}),e.jsx("span",{children:new Date().toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})})]}),g?.lastUpdated&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(xs,{className:"h-3 w-3"}),e.jsxs("span",{children:["Updated ",new Date(g.lastUpdated).toLocaleTimeString()]})]})]})]}),e.jsx("div",{className:"flex flex-col sm:flex-row gap-4 xl:flex-col",children:e.jsxs("div",{className:"bg-card border border-border rounded-lg p-4 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(uS,{className:"h-4 w-4 text-primary-mint"}),e.jsx("span",{className:"text-sm font-medium text-card-foreground",children:"Daily Inspiration"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground italic mb-3",children:['"',$,'"']}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(G,{size:"sm",variant:"outline",onClick:()=>te("Tasks"),title:"View all tasks",children:[e.jsx(Dn,{className:"h-3 w-3 mr-1"}),"Tasks"]}),e.jsxs(G,{size:"sm",variant:"outline",onClick:()=>te("Projects"),title:"View all projects",children:[e.jsx(Mi,{className:"h-3 w-3 mr-1"}),"Projects"]}),e.jsx(G,{size:"sm",variant:"ghost",onClick:ye,title:"Refresh dashboard data",className:"px-2",children:e.jsx(yl,{className:"h-3 w-3"})})]})]})})]})}),v&&e.jsx("div",{className:"bg-red-50 dark:bg-red-950/20 rounded-lg p-4 border border-red-200 dark:border-red-800",children:e.jsxs("div",{className:"flex items-center gap-2 text-red-800 dark:text-red-200",children:[e.jsx(Oi,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm font-medium",children:"Dashboard data may be outdated"}),e.jsxs(G,{size:"sm",variant:"ghost",onClick:ye,className:"ml-auto",children:[e.jsx(yl,{className:"h-3 w-3 mr-1"}),"Retry"]})]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 lg:gap-6",children:[e.jsxs("div",{className:"bg-gradient-to-br from-card to-card/50 rounded-xl shadow-sm p-6 border border-border/50 hover:shadow-xl hover:shadow-primary-mint/10 hover:scale-105 hover:border-primary-mint/30 transition-all duration-500 cursor-pointer group backdrop-blur-sm",onClick:()=>te("Clients"),children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Total Clients"}),e.jsx("p",{className:"text-2xl font-bold text-primary-navy",children:B.total})]}),e.jsx(yt,{className:"h-10 w-10 text-primary-mint group-hover:scale-110 transition-transform duration-300"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm text-primary-mint",children:["+",B.newThisMonth," this month"]}),e.jsx(Ks,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary-mint transition-colors"})]}),e.jsx("div",{className:"mt-2 w-full bg-gradient-to-r from-muted to-muted/50 rounded-full h-2 overflow-hidden",children:e.jsx("div",{className:"bg-gradient-to-r from-primary-mint to-primary-mint/80 h-2 rounded-full transition-all duration-1000 ease-out relative",style:{width:`${Math.min(B.total/10*100,100)}%`},children:e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent animate-pulse"})})})]}),e.jsxs("div",{className:"bg-gradient-to-br from-card to-card/50 rounded-xl shadow-sm p-6 border border-border/50 hover:shadow-xl hover:shadow-blue-500/10 hover:scale-105 hover:border-blue-500/30 transition-all duration-500 cursor-pointer group backdrop-blur-sm",onClick:()=>te("Projects"),children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Active Projects"}),e.jsx("p",{className:"text-2xl font-bold text-primary-navy",children:T.active})]}),e.jsx(Mi,{className:"h-10 w-10 text-blue-500 group-hover:scale-110 transition-transform duration-300"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm text-blue-500",children:["+",T.completedThisMonth||Math.floor(T.active*.2)," this month"]}),e.jsx(Ks,{className:"h-4 w-4 text-muted-foreground group-hover:text-blue-500 transition-colors"})]}),e.jsx("div",{className:"mt-2 w-full bg-gradient-to-r from-muted to-muted/50 rounded-full h-2 overflow-hidden",children:e.jsx("div",{className:"bg-gradient-to-r from-blue-500 to-blue-400 h-2 rounded-full transition-all duration-1000 ease-out relative",style:{width:`${Math.min(T.active/8*100,100)}%`},children:e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent animate-pulse"})})})]}),e.jsxs("div",{className:"bg-gradient-to-br from-card to-card/50 rounded-xl shadow-sm p-6 border border-border/50 hover:shadow-xl hover:shadow-orange-500/10 hover:scale-105 hover:border-orange-500/30 transition-all duration-500 cursor-pointer group backdrop-blur-sm",onClick:()=>te("Tasks"),children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Pending Tasks"}),e.jsx("p",{className:"text-2xl font-bold text-primary-navy",children:(ne.pending||ne.toDo||0)+(ne.inProgress||0)})]}),e.jsx(Dn,{className:"h-10 w-10 text-orange-500 group-hover:scale-110 transition-transform duration-300"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm text-orange-500",children:[ne.overdue||0," overdue"]}),e.jsx(Ks,{className:"h-4 w-4 text-muted-foreground group-hover:text-orange-500 transition-colors"})]}),e.jsx("div",{className:"mt-2 w-full bg-gradient-to-r from-muted to-muted/50 rounded-full h-2 overflow-hidden",children:e.jsx("div",{className:"bg-gradient-to-r from-orange-500 to-orange-400 h-2 rounded-full transition-all duration-1000 ease-out relative",style:{width:`${Math.max(100-(ne.overdue||0)*10,20)}%`},children:e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent animate-pulse"})})})]}),e.jsxs("div",{className:"bg-gradient-to-br from-card to-card/50 rounded-xl shadow-sm p-6 border border-border/50 hover:shadow-xl hover:shadow-green-500/10 hover:scale-105 hover:border-green-500/30 transition-all duration-500 cursor-pointer group backdrop-blur-sm",onClick:()=>te("Revenue"),children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Monthly Revenue"}),e.jsxs("p",{className:"text-2xl font-bold text-primary-navy",children:["$",(ee.monthlyRevenue/1e3).toFixed(1),"k"]})]}),e.jsx(fr,{className:"h-10 w-10 text-green-500 group-hover:scale-110 transition-transform duration-300"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-green-500",children:ee.overdueInvoices===0?"+15% growth":`${ee.overdueInvoices} overdue`}),e.jsx(Ks,{className:"h-4 w-4 text-muted-foreground group-hover:text-green-500 transition-colors"})]}),e.jsx("div",{className:"mt-2 w-full bg-gradient-to-r from-muted to-muted/50 rounded-full h-2 overflow-hidden",children:e.jsx("div",{className:"bg-gradient-to-r from-green-500 to-green-400 h-2 rounded-full transition-all duration-1000 ease-out relative",style:{width:`${Math.min(ee.monthlyRevenue/25e3*100,100)}%`},children:e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent animate-pulse"})})})]})]}),e.jsxs("div",{className:"bg-gradient-to-br from-card to-card/50 rounded-xl shadow-sm p-6 border border-border/50 hover:shadow-md transition-shadow duration-300 backdrop-blur-sm",children:[e.jsx("div",{className:"flex items-center justify-between mb-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Sf,{className:"h-5 w-5 text-primary-mint"}),e.jsx("h3",{className:"text-lg font-semibold text-card-foreground",children:"Qu
738ick Actions"})]})}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-3",children:[e.jsxs(G,{variant:"outline",className:"h-auto p-4 flex flex-col items-center gap-2 hover:shadow-md transition-all duration-300 group",onClick:()=>te("New Client"),title:"Add new client",children:[e.jsx(yt,{className:"h-5 w-5 group-hover:scale-110 transition-transform"}),e.jsx("span",{className:"text-xs",children:"Add Client"})]}),e.jsxs(G,{variant:"outline",className:"h-auto p-4 flex flex-col items-center gap-2 hover:shadow-md transition-all duration-300 group",onClick:()=>te("New Project"),title:"Create new project",children:[e.jsx(Mi,{className:"h-5 w-5 group-hover:scale-110 transition-transform"}),e.jsx("span",{className:"text-xs",children:"New Project"})]}),e.jsxs(G,{variant:"outline",className:"h-auto p-4 flex flex-col items-center gap-2 hover:shadow-md transition-all duration-300 group",onClick:()=>te("Create Task"),title:"Create new task",children:[e.jsx(Dn,{className:"h-5 w-5 group-hover:scale-110 transition-transform"}),e.jsx("span",{className:"text-xs",children:"Create Task"})]}),e.jsxs(G,{variant:"outline",className:"h-auto p-4 flex flex-col items-center gap-2 hover:shadow-md transition-all duration-300 group",onClick:()=>te("New Invoice"),title:"Create new invoice",children:[e.jsx(fr,{className:"h-5 w-5 group-hover:scale-110 transition-transform"}),e.jsx("span",{className:"text-xs",children:"New Invoice"})]}),e.jsxs(G,{variant:"outline",className:"h-auto p-4 flex flex-col items-center gap-2 hover:shadow-md transition-all duration-300 group",onClick:()=>te("Team Chat"),title:"Open team chat",children:[e.jsx(yt,{className:"h-5 w-5 group-hover:scale-110 transition-transform"}),e.jsx("span",{className:"text-xs",children:"Team Chat"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 lg:gap-8",children:[e.jsxs("div",{className:"bg-gradient-to-br from-card to-card/50 rounded-xl shadow-sm p-6 border border-border/50 hover:shadow-lg hover:shadow-primary-mint/10 transition-all duration-300 backdrop-blur-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("h3",{className:"text-lg font-semibold text-card-foreground flex items-center gap-2",children:[e.jsx(Mi,{className:"h-5 w-5 text-primary-mint"}),"Active Projects"]}),e.jsxs(G,{variant:"ghost",size:"sm",onClick:()=>te("Projects"),children:["View All",e.jsx(Ks,{className:"h-4 w-4 ml-1"})]})]}),e.jsx("div",{className:"space-y-4",children:_.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"No projects found"}),e.jsx(G,{variant:"outline",size:"sm",onClick:()=>te("Projects"),className:"mt-2",children:"Create your first project"})]}):_.map((ge,K)=>e.jsx("div",{className:"flex items-center justify-between p-4 bg-muted/50 rounded-lg hover:bg-muted/70 transition-colors duration-200 cursor-pointer group",onClick:()=>te("Projects"),children:e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("p",{className:"font-medium text-card-foreground group-hover:text-primary-mint transition-colors",children:ge.name}),e.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium ${ge.status==="In Progress"?"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200":ge.status==="Completed"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":ge.status==="On Hold"?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200":"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200"}`,children:ge.status})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:ge.client_name||ge.clientName||"Client"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex-1",children:e.jsx("div",{className:"w-full bg-gradient-to-r from-muted to-muted/50 rounded-full h-2 overflow-hidden",children:e.jsx("div",{className:"bg-gradient-to-r from-primary-mint to-primary-mint/80 h-2 rounded-full transition-all duration-1000 ease-out relative",style:{width:`${ge.progress||0}%`}
738,children:e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent opacity-60"})})})}),e.jsxs("span",{className:"text-sm font-medium text-card-foreground",children:[ge.progress||0,"%"]})]})]})},K))})]}),e.jsxs("div",{className:"bg-gradient-to-br from-card to-card/50 rounded-xl shadow-sm p-6 border border-border/50 hover:shadow-lg hover:shadow-orange-500/10 transition-all duration-300 backdrop-blur-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("h3",{className:"text-lg font-semibold text-card-foreground flex items-center gap-2",children:[e.jsx(Dn,{className:"h-5 w-5 text-primary-mint"}),"Task Overview"]}),e.jsxs(G,{variant:"ghost",size:"sm",onClick:()=>te("Tasks"),children:["View All",e.jsx(Ks,{className:"h-4 w-4 ml-1"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-6",children:[e.jsxs("div",{className:"text-center p-3 bg-muted/50 rounded-lg cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>te("Tasks"),children:[e.jsx("p",{className:"text-2xl font-bold text-card-foreground",children:ne.completed||ne.done||0}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Completed"})]}),e.jsxs("div",{className:"text-center p-3 bg-muted/50 rounded-lg cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>te("Tasks"),children:[e.jsx("p",{className:"text-2xl font-bold text-orange-500",children:ne.inProgress||ne.pending||0}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"In Progress"})]})]}),e.jsx("div",{className:"space-y-3",children:k.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"No tasks found"}),e.jsx(G,{variant:"outline",size:"sm",onClick:()=>te("Tasks"),className:"mt-2",children:"Create your first task"})]}):k.slice(0,3).map((ge,K)=>e.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg bg-muted/50 hover:bg-muted/70 transition-colors duration-200 cursor-pointer group",onClick:()=>te("Tasks"),children:[e.jsx("div",{className:`w-3 h-3 rounded-full mt-2 ${ge.priority==="High"?"bg-red-500":ge.priority==="Medium"?"bg-yellow-500":"bg-green-500"}`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"font-medium text-card-foreground group-hover:text-primary-mint transition-colors truncate",children:ge.title}),e.jsx("span",{className:"text-xs text-muted-foreground",children:ge.due_date?new Date(ge.due_date).toLocaleDateString():ge.dueDate||"No due date"})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx("span",{className:`px-2 py-0.5 rounded-full text-xs font-medium ${ge.status==="Done"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":ge.status==="In Progress"?"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200":"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200"}`,children:ge.status}),e.jsx("span",{className:"text-xs text-muted-foreground",children:ge.priority})]})]})]},K))})]})]})]})})]})}class RM extends f.Component{constructor(r){super(r),this.state={hasError:!1,error:null}}static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,i){console.error("Unhandled error caught by ErrorBoundary:")}handleReload=()=>{location.reload()};render(){return this.state.hasError?e.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center bg-background text-foreground p-4 space-y-4",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Something went wrong."}),e.jsx("p",{className:"text-muted-foreground max-w-md text-center",children:"An unexpected error occurred while rendering this page. Our team has been notified. Please try refreshing the page."}),e.jsx("button",{className:"px-4 py-2 rounded-md bg-primary-mint text-white hover:bg-primary-mint/90 transition-colors",onClick:this.handleReload,children:"Reload Page"})]}):this.props.children}}z1.createRoot(document.getElementById("root")).render(e.jsx(f.StrictMode,{children:e.jsx(RM,{children:e.jsx(PC,{children:e.jsxs(LC,{children:[e.jsx(vN,{}),e.jsx(AM,{})]})})})}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.