@vertesia/ui 1.5.0-dev.20260713.151751Z → 1.5.0-dev.20260717.131047Z
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/env/index.d.ts +19 -0
- package/lib/env/index.d.ts.map +1 -1
- package/lib/env/index.js +6 -0
- package/lib/env/index.js.map +1 -1
- package/lib/features/agent/chat/ArtifactsTab.d.ts.map +1 -1
- package/lib/features/agent/chat/ArtifactsTab.js +65 -11
- package/lib/features/agent/chat/ArtifactsTab.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentConversation.js +51 -48
- package/lib/features/agent/chat/ModernAgentConversation.js.map +1 -1
- package/lib/features/agent/chat/hooks/useArtifacts.d.ts +8 -1
- package/lib/features/agent/chat/hooks/useArtifacts.d.ts.map +1 -1
- package/lib/features/agent/chat/hooks/useArtifacts.js +28 -10
- package/lib/features/agent/chat/hooks/useArtifacts.js.map +1 -1
- package/lib/features/document-viewer/UniversalDocumentViewer.d.ts +73 -0
- package/lib/features/document-viewer/UniversalDocumentViewer.d.ts.map +1 -0
- package/lib/features/document-viewer/UniversalDocumentViewer.js +415 -0
- package/lib/features/document-viewer/UniversalDocumentViewer.js.map +1 -0
- package/lib/features/document-viewer/index.d.ts +2 -0
- package/lib/features/document-viewer/index.d.ts.map +1 -0
- package/lib/features/document-viewer/index.js +2 -0
- package/lib/features/document-viewer/index.js.map +1 -0
- package/lib/features/index.d.ts +1 -0
- package/lib/features/index.d.ts.map +1 -1
- package/lib/features/index.js +1 -0
- package/lib/features/index.js.map +1 -1
- package/lib/features/permissions/UserPermissionsProvider.d.ts +2 -3
- package/lib/features/permissions/UserPermissionsProvider.d.ts.map +1 -1
- package/lib/features/permissions/UserPermissionsProvider.js +31 -38
- package/lib/features/permissions/UserPermissionsProvider.js.map +1 -1
- package/lib/features/store/objects/components/ContentOverview.d.ts.map +1 -1
- package/lib/features/store/objects/components/ContentOverview.js +73 -13
- package/lib/features/store/objects/components/ContentOverview.js.map +1 -1
- package/lib/i18n/locales/ar.json +2 -0
- package/lib/i18n/locales/de.json +2 -0
- package/lib/i18n/locales/en.json +2 -0
- package/lib/i18n/locales/es.json +2 -0
- package/lib/i18n/locales/fr.json +2 -0
- package/lib/i18n/locales/it.json +2 -0
- package/lib/i18n/locales/ja.json +2 -0
- package/lib/i18n/locales/ko.json +2 -0
- package/lib/i18n/locales/pt.json +2 -0
- package/lib/i18n/locales/ru.json +2 -0
- package/lib/i18n/locales/tr.json +2 -0
- package/lib/i18n/locales/zh-TW.json +2 -0
- package/lib/i18n/locales/zh.json +2 -0
- package/lib/router/HistoryNavigator.d.ts.map +1 -1
- package/lib/router/HistoryNavigator.js +4 -1
- package/lib/router/HistoryNavigator.js.map +1 -1
- package/lib/router/Nav.d.ts.map +1 -1
- package/lib/router/Nav.js +7 -1
- package/lib/router/Nav.js.map +1 -1
- package/lib/router/Router.d.ts.map +1 -1
- package/lib/router/Router.js +19 -4
- package/lib/router/Router.js.map +1 -1
- package/lib/router/path.d.ts +15 -0
- package/lib/router/path.d.ts.map +1 -1
- package/lib/router/path.js +43 -0
- package/lib/router/path.js.map +1 -1
- package/lib/session/UserSession.d.ts +6 -0
- package/lib/session/UserSession.d.ts.map +1 -1
- package/lib/session/UserSession.js +31 -9
- package/lib/session/UserSession.js.map +1 -1
- package/lib/session/UserSessionProvider.d.ts.map +1 -1
- package/lib/session/UserSessionProvider.js +111 -49
- package/lib/session/UserSessionProvider.js.map +1 -1
- package/lib/session/auth/composable.d.ts.map +1 -1
- package/lib/session/auth/composable.js +52 -3
- package/lib/session/auth/composable.js.map +1 -1
- package/lib/session/auth/domainRouting.d.ts +25 -0
- package/lib/session/auth/domainRouting.d.ts.map +1 -1
- package/lib/session/auth/domainRouting.js +36 -0
- package/lib/session/auth/domainRouting.js.map +1 -1
- package/lib/shell/login/SignInRestrictedEnvStep.d.ts +1 -1
- package/lib/shell/login/SignInRestrictedEnvStep.js +1 -1
- package/lib/shell/login/SigninScreen.js +9 -1
- package/lib/shell/login/SigninScreen.js.map +1 -1
- package/lib/shell/login/productionUrl.d.ts +0 -14
- package/lib/shell/login/productionUrl.d.ts.map +1 -1
- package/lib/shell/login/productionUrl.js +14 -5
- package/lib/shell/login/productionUrl.js.map +1 -1
- package/lib/vertesia-ui-core.js +3 -3
- package/lib/vertesia-ui-core.js.map +1 -1
- package/lib/vertesia-ui-env.js +1 -1
- package/lib/vertesia-ui-env.js.map +1 -1
- package/lib/vertesia-ui-features.js +28 -28
- package/lib/vertesia-ui-features.js.map +1 -1
- package/lib/vertesia-ui-i18n.js +13 -13
- package/lib/vertesia-ui-router.js +1 -1
- package/lib/vertesia-ui-router.js.map +1 -1
- package/lib/vertesia-ui-session.js +1 -1
- package/lib/vertesia-ui-session.js.map +1 -1
- package/lib/vertesia-ui-shell.js +1 -1
- package/lib/vertesia-ui-shell.js.map +1 -1
- package/lib/vertesia-ui-widgets.js +2 -2
- package/lib/vertesia-ui-widgets.js.map +1 -1
- package/llms.txt +70 -70
- package/package.json +8 -7
- package/src/env/index.ts +24 -0
- package/src/features/agent/chat/ArtifactsTab.tsx +155 -21
- package/src/features/agent/chat/ModernAgentConversation.tsx +53 -49
- package/src/features/agent/chat/hooks/useArtifacts.ts +44 -11
- package/src/features/document-viewer/UniversalDocumentViewer.test.tsx +123 -0
- package/src/features/document-viewer/UniversalDocumentViewer.tsx +746 -0
- package/src/features/document-viewer/index.ts +1 -0
- package/src/features/index.ts +1 -0
- package/src/features/permissions/UserPermissionsProvider.tsx +36 -39
- package/src/features/store/objects/components/ContentOverview.tsx +99 -26
- package/src/i18n/locales/ar.json +2 -0
- package/src/i18n/locales/de.json +2 -0
- package/src/i18n/locales/en.json +2 -0
- package/src/i18n/locales/es.json +2 -0
- package/src/i18n/locales/fr.json +2 -0
- package/src/i18n/locales/it.json +2 -0
- package/src/i18n/locales/ja.json +2 -0
- package/src/i18n/locales/ko.json +2 -0
- package/src/i18n/locales/pt.json +2 -0
- package/src/i18n/locales/ru.json +2 -0
- package/src/i18n/locales/tr.json +2 -0
- package/src/i18n/locales/zh-TW.json +2 -0
- package/src/i18n/locales/zh.json +2 -0
- package/src/router/HistoryNavigator.ts +4 -1
- package/src/router/Nav.tsx +7 -1
- package/src/router/Router.tsx +18 -4
- package/src/router/path.test.ts +87 -0
- package/src/router/path.ts +38 -0
- package/src/session/UserSession.ts +32 -9
- package/src/session/UserSessionProvider.tsx +138 -62
- package/src/session/auth/composable.test.ts +111 -0
- package/src/session/auth/composable.ts +58 -3
- package/src/session/auth/domainRouting.test.ts +28 -1
- package/src/session/auth/domainRouting.ts +38 -0
- package/src/shell/login/SignInRestrictedEnvStep.tsx +1 -1
- package/src/shell/login/SigninScreen.tsx +9 -1
- package/src/shell/login/productionUrl.test.ts +8 -5
- package/src/shell/login/productionUrl.ts +15 -5
|
@@ -4,16 +4,25 @@
|
|
|
4
4
|
* they do have access — in their own region, never another one (an EU user must not land on the US
|
|
5
5
|
* site, and vice versa).
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* Every production region follows one URL pattern — `https://cloud.{region}.vertesia.io/` (e.g.
|
|
8
|
+
* `us1`, `us2`, `eu1`, `jp1`) — with no region special-cased. Only the legacy non-regional
|
|
9
|
+
* deployment has no region and falls back to the apex `https://cloud.vertesia.io/`.
|
|
10
|
+
*
|
|
11
|
+
* Dev/ephemeral regions have no production site of their own — they mirror a production region — so
|
|
12
|
+
* they are mapped to it first. Sending a rejected user to the dev host (e.g. `cloud.dev1.vertesia.io`)
|
|
13
|
+
* would just bounce them back to the same restricted environment. `dev1` (us-central1) mirrors the
|
|
14
|
+
* `us1` production region.
|
|
10
15
|
*
|
|
11
16
|
* Region is preferred over parsing the current hostname because it is well-defined for every serving
|
|
12
17
|
* pattern (including the direct-routing `*.ui.{region}.vertesia.io` hosts, which carry no
|
|
13
18
|
* `preview.`/`preprod.` prefix to strip). Callers pass `Env.region` from `@vertesia/ui/env`.
|
|
14
19
|
*/
|
|
20
|
+
const DEV_REGION_TO_PRODUCTION_REGION = {
|
|
21
|
+
// dev1 (us-central1) is a dev mirror of the us1 production region.
|
|
22
|
+
dev1: 'us1',
|
|
23
|
+
};
|
|
15
24
|
export function getProductionAppUrl(region) {
|
|
16
|
-
const
|
|
17
|
-
return
|
|
25
|
+
const prodRegion = (region && DEV_REGION_TO_PRODUCTION_REGION[region]) || region;
|
|
26
|
+
return prodRegion ? `https://cloud.${prodRegion}.vertesia.io/` : 'https://cloud.vertesia.io/';
|
|
18
27
|
}
|
|
19
28
|
//# sourceMappingURL=productionUrl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"productionUrl.js","sourceRoot":"","sources":["../../../src/shell/login/productionUrl.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"productionUrl.js","sourceRoot":"","sources":["../../../src/shell/login/productionUrl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,+BAA+B,GAA2B;IAC5D,mEAAmE;IACnE,IAAI,EAAE,KAAK;CACd,CAAC;AAEF,MAAM,UAAU,mBAAmB,CAAC,MAAe;IAC/C,MAAM,UAAU,GAAG,CAAC,MAAM,IAAI,+BAA+B,CAAC,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC;IACjF,OAAO,UAAU,CAAC,CAAC,CAAC,iBAAiB,UAAU,eAAe,CAAC,CAAC,CAAC,4BAA4B,CAAC;AAClG,CAAC"}
|
package/lib/vertesia-ui-core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Fragment as e,jsx as t,jsxs as n}from"react/jsx-runtime";import r,{clsx as i}from"clsx";import{AlertTriangle as a,Check as o,CheckIcon as s,ChevronDown as c,ChevronDownIcon as l,ChevronRight as u,ChevronRightIcon as d,ChevronUp as f,ChevronUpIcon as p,ChevronsUpDown as m,CircleCheck as h,CircleX as g,Computer as _,CopyIcon as v,Info as y,ListFilter as b,Loader2 as x,LoaderCircle as S,Minus as C,Moon as w,MoreHorizontal as T,Plus as E,Search as D,SearchIcon as O,SquarePlus as k,Sun as A,TriangleAlert as ee,X as j,XIcon as te}from"lucide-react";import*as M from"react";import N,{Children as ne,Fragment as re,cloneElement as ie,createContext as ae,forwardRef as oe,isValidElement as se,useCallback as ce,useContext as P,useEffect as F,useId as le,useLayoutEffect as ue,useMemo as de,useRef as I,useState as L}from"react";import{createPortal as fe}from"react-dom";import{Slot as pe}from"@radix-ui/react-slot";import{SUPPORTED_LANGUAGES as me,useLanguage as he,useUITranslation as R}from"@vertesia/ui/i18n";import{cva as z}from"class-variance-authority";import{twMerge as ge}from"tailwind-merge";import*as B from"@radix-ui/react-tooltip";import{Env as _e}from"@vertesia/ui/env";import{AnimatePresence as ve,motion as ye}from"framer-motion";import*as be from"@radix-ui/react-checkbox";import*as xe from"@radix-ui/react-collapsible";import{Command as V}from"cmdk";import*as H from"@radix-ui/react-dialog";import*as U from"@radix-ui/react-dropdown-menu";import W from"dayjs";import Se from"react-calendar";import*as G from"@radix-ui/react-popover";import{isEqual as Ce}from"lodash-es";import*as we from"@radix-ui/react-label";import*as Te from"@radix-ui/react-radio-group";import*as Ee from"react-resizable-panels";import*as De from"@radix-ui/react-separator";import*as Oe from"@radix-ui/react-slider";import*as ke from"@radix-ui/react-switch";import*as K from"@radix-ui/react-tabs";function Ae(e){switch(e){case`xs`:return`size-4`;case`sm`:return`size-6`;case`md`:return`size-8`;case`lg`:return`size-10`;case`xl`:return`size-12`;case`2xl`:return`size-14`;default:throw Error(`Unexpected size: ${e}`)}}function je({size:e,src:n,name:r,shape:i=`circle`,color:a=`bg-gray-500`,className:o}){let s=i===`circle`?`rounded-full`:`rounded-md`,c=Ae(e||`md`);if(n)return t(`img`,{className:`inline-block ${c} ${s} ${a} ${o}`,src:n,alt:r||n,title:r});if(r){let[n,i]=r.split(` `),l=i?`${n[0]}${i[0]}`:`${n[0]}${n[1]}`;return t(`span`,{className:`inline-flex ${c} items-center justify-center ${s} ${a} ${o}`,title:r,children:t(`span`,{className:`${e===`xs`?`text-[0.6rem]`:`text-xs`} font-medium leading-none text-white`,children:l})})}return t(`span`,{className:`inline-block ${c} overflow-hidden ${s} ${a}`,children:t(`svg`,{className:`h-full w-full text-gray-300`,fill:`currentColor`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:t(`path`,{d:`M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z`})})})}function Me({size:e,shape:n=`circle`,color:r=`bg-gray-500`,className:i,children:a}){let o=n===`circle`?`rounded-full`:`rounded-md`;return t(`span`,{className:`inline-block ${Ae(e||`md`)} overflow-hidden ${o} ${r} ${i}`,children:a})}function Ne({className:e,children:n}){return t(`div`,{className:r(`flex items-center justify-center`,e),children:n})}function Pe(e){switch(e){case`top`:return`bottom`;case`bottom`:return`top`;case`left`:return`right`;case`right`:return`left`;case`ne`:return`sw`;case`nw`:return`se`;case`se`:return`nw`;case`sw`:return`ne`;default:return e}}function Fe(e){switch(e){case`start`:return`end`;case`end`:return`start`;default:return e}}var Ie=class{left;top;width;height;alignAxis;gap;constructor(e=0){this.gap=e}position(e,t,n){switch(e){case`top`:this.top=t.top-n.height-this.gap,this.alignAxis=`x`;break;case`bottom`:this.top=t.bottom+this.gap,this.alignAxis=`x`;break;case`left`:this.left=t.left-n.width-this.gap,this.alignAxis=`y`;break;case`right`:this.left=t.right+this.gap,this.alignAxis=`y`;break;case`ne`:this.top=t.top-n.height-this.gap,this.left=t.right+this.gap;break;case`nw`:this.top=t.top-n.height-this.gap,this.left=t.left-n.width-this.gap;break;case`se`:this.top=t.bottom+this.gap,this.left=t.right+this.gap;break;case`sw`:this.top=t.bottom+this.gap,this.left=t.left-n.width-this.gap;break}}align(e,t,n){if(this.alignAxis)switch(e){case`start`:this.alignAxis===`x`?this.left=t.left:this.top=t.top;break;case`end`:this.alignAxis===`x`?this.left=t.right-n.width:this.top=t.bottom-n.height;break;case`center`:this.alignAxis===`x`?this.left=t.left+t.width/2-n.width/2:this.top=t.top+t.height/2-n.height/2;break;case`fill`:this.alignAxis===`x`?(this.left=t.left,this.width=t.right-t.left):(this.top=t.top,this.height=t.bottom-t.top);break}}computePosition(e,t,n){if(this.position(e.position,n,t),e.align&&this.align(e.align,n,t),!this.left&&!this.top)throw Error(`Invalid position. Cannot compute x,y coordinates`);let r=this.width!=null,i=this.height!=null,a=this.width??t.width,o=this.height??t.height;return{rect:new DOMRect(this.left??0,this.top??0,a,o),constrainWidth:r,constrainHeight:i,position:e.position,align:e.align}}flipAxis(e,t){if(this.alignAxis===t){if(e.align){let t=Fe(e.align);if(t!==e.align)return{...e,align:t}}}else{let t=Pe(e.position);if(t!==e.position)return{...e,position:t}}return null}};function Le(e,t){return e.left>=t.left&&e.right<=t.right&&e.top>=t.top&&e.bottom<=t.bottom}function Re(e,t,n){return n===`x`?e.left>=t.left&&e.right<=t.right:e.top>=t.top&&e.bottom<=t.bottom}function ze(e,t,n,r){let i=new Ie(e.gap),a=i.computePosition(e,t,n),o=Re(a.rect,r,`x`),s=Re(a.rect,r,`y`);if(o&&s)return a;let c=null;return o||(c=i.flipAxis(e,`x`)),s||(c=i.flipAxis(c||e,`y`)),c?(a=new Ie(i.gap).computePosition(c,t,n),Le(a.rect,r)?a:null):null}function Be(e,t){let n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),i=Math.min(e.right,t.right),a=Math.min(e.bottom,t.bottom);return i<=n||a<=r?null:new DOMRect(n,r,i-n,a-r)}function Ve(e){if(e.length===0)return null;let t=e[0].getBoundingClientRect();for(let n=1,r=e.length;n<r;n++)if(t=Be(e[n].getBoundingClientRect(),t),!t)return null;return t}function He(e){let t=e.scrollHeight>e.clientHeight,n=e.scrollWidth>e.clientWidth;if(t||n){let r=getComputedStyle(e);if(t&&r.overflowY!==`visible`||n&&r.overflowX!==`visible`)return!0}return!1}function Ue(e,t=document.documentElement){let n=[],r=e.parentElement;for(;r&&r!==t;)He(r)&&n.push(r),r=r.parentElement;return n.push(t),n}var We=class{options;root;scrollableParents;visibleClientRect;context;constructor(e){this.options=e,this.root=e.root||document.documentElement,this.scrollableParents=Ue(this.anchor,this.root),this.visibleClientRect=Ve(this.scrollableParents)}get anchor(){return this.options.anchor}registerListeners(e){let t=this.scrollableParents,n=()=>{this.update()};window.addEventListener(`resize`,n);for(let e of t)e.addEventListener(`scroll`,n);let r;this.options.closeOnClick&&(r=t=>{e.contains(t.target)||this.tryClose()},window.setTimeout(()=>{r&&document.addEventListener(`click`,r)},0));let i;this.options.closeOnEsc&&(i=e=>{e.key===`Escape`&&this.tryClose()},window.setTimeout(()=>{i&&document.addEventListener(`keydown`,i)},0));let a=this.options.blockPageScroll;return a&&(document.body.style.overflow=`hidden`,document.body.style.height=`100%`),()=>{window.removeEventListener(`resize`,n);for(let e of t)e.removeEventListener(`scroll`,n);r&&document.removeEventListener(`click`,r),i&&document.removeEventListener(`keydown`,i),a&&(document.body.style.overflow=``,document.body.style.height=``)}}open(e,t){if(this.context)throw Error(`The popup controller is already bound to an element`);this.tryOpen(e,t)}tryOpen(e,t){this.context||(this.context={element:e,constraints:t,cleanup:this.registerListeners(e)},e.style.display=``,e.style.visibility=`hidden`,this.update(),this.options.onOpen?.(this))}close(){if(!this.context)throw Error(`The popup controller is not bound to an element`);this.tryClose()}tryClose(){this.context&&=(this.options.onClose?.(this),this.context.cleanup(),this.context.element.style.display=`none`,void 0)}get isOpen(){return!!this.context}update(){if(!this.context)return;let e=this.context.element,t=this.context.constraints,n=e.getBoundingClientRect(),r=this.anchor.getBoundingClientRect(),i=this.visibleClientRect;if(!i)return;let a=ze(t,n,r,i);this.context.position=a||void 0,a&&(a.constrainHeight&&(e.style.height=`${a.rect.height}px`),a.constrainWidth&&(e.style.width=`${a.rect.width}px`),e.style.left=`${a.rect.left}px`,e.style.top=`${a.rect.top}px`,e.style.visibility=`visible`)}createPopupElement(){let e=document.createElement(`div`);return e.style.margin=`0`,e.style.padding=`0`,e.style.border=`none`,e.style.background=`transparent`,e.className=`composable-Popup`,e}};const Ge=ae(void 0);function Ke(){let e=P(Ge);if(!e)throw Error(`usePopupController must be used inside a Popup component`);return e}function qe({ctrlRef:e,id:n,constraints:r,isOpen:i,children:a,className:o,onClose:s,onOpen:c,zIndex:l,position:u,anchor:d,root:f,closeOnClick:p,closeOnEsc:m,blockPageScroll:h}){let g=I(null),[_,v]=L(),y=I(s),b=I(c);return y.current=s,b.current=c,F(()=>{if(!d)throw Error(`Anchor element is required`);let e=new We({anchor:d,root:f,closeOnClick:p,closeOnEsc:m,blockPageScroll:h,onClose:()=>y.current?.(),onOpen:()=>b.current?.()});return v(e),()=>{e.tryClose()}},[d,h,p,m,f]),F(()=>{e&&(e.current=_)},[_,e]),F(()=>{_&&g.current?_.isOpen!==i&&(i?_.open(g.current,r):_.close()):_?.isOpen&&!i&&_.close()},[r,i,_]),t(Ge.Provider,{value:_,children:i&&fe(t(`div`,{id:n,style:{visibility:`hidden`,position:u||`absolute`,zIndex:l||100},ref:g,className:o,children:a}),document.body)})}function Je({anchor:e,root:n,children:r,...i}){let a=e.current;return a&&(!n||n.current)?t(qe,{anchor:a,root:n?.current||void 0,...i,children:r}):null}function Ye(){return`combobox-popup-${Math.floor(Math.random()*1e6)}`}var Xe=class{filter(e,t){let n=t.toLowerCase();return e.filter(e=>this.valueOf(e).toLowerCase().includes(n))}renderOption(e){return this.valueOf(e)}findById(e,t){return e.find(e=>this.idOf(e)===t)}createItem(e){return null}},Ze=class e extends Xe{valueOf(e){return String(e)}idOf(e){return String(e)}static instance=new e},Qe=class e extends Ze{createItem(e){return e}static instance=new e};function $e(e,t){return{buttonRight:4,buttonWidth:24,maxMenuHeight:240,menuClass:`w-72 mt-1 border-popover bg-popover text-popover-foreground shadow-md overflow-auto p-0 z-10`,inputClass:r(t?`block m-0 p-0 border-0 focus:outline-none focus:ring-0`:`block sm:text-sm sm:leading-6 bg-muted rounded-md border-0 shadow-sm ring-1 ring-inset ring-muted placeholder:text-muted focus:ring-2 focus:ring-inset focus:ring-primary py-1.5`,e?`w-full`:`!w-auto`),optionClass:`py-2 px-3 shadow-sm flex flex-col [&.option-selected]:font-semibold [&.option-highlighted]:bg-blue-300`,Input:tt,Menu:rt,Toggle:nt}}function et({menuAlign:r=`fill`,menuGap:i,focusOnMount:a,onSelect:o,value:s,zIndex:c,unstyledInput:l,fullWidth:u,api:d,layout:f,adapter:p,items:m,placeholder:h,clearable:g,noMatchMessage:_,openOnFocus:v}){let[y]=L(Ye()),b=I(void 0),x=I(null),S=f?Object.assign($e(u,l),f):$e(u,l),C=N.useRef(null),w=it({adapter:p,items:m,value:s,popupId:y});F(()=>{x.current&&a&&x.current.focus()},[a]),F(()=>{w.onSelect=o,w.popupCtrl=b.current},[w,o]),F(()=>{if(d&&w&&x.current)return d.current={open:()=>w.openMenu(),close:()=>w.closeMenu(),toggle:()=>w.toggleMenu(),setInputValue:e=>w.inputText=e,inputValue:w.inputText||``,selectedItem:w.selectedItem,focus:()=>x.current?.focus()},()=>{d.current=null}},[d,w]);let T=w.isMenuOpen&&(w.filteredItems.length>0||!!_);return n(e,{children:[t(S.Input,{boxRef:C,inputRef:x,ctrl:w,layout:S,placeholder:h,clearable:g,openOnFocus:v}),t(Je,{id:y,ctrlRef:b,className:`combobox-popup`,closeOnClick:!0,closeOnEsc:!0,onClose:()=>w.closeMenu(),isOpen:T,anchor:C,zIndex:c,constraints:{position:`bottom`,align:r,gap:i??4},children:t(S.Menu,{fillWidth:r===`fill`,items:w.filteredItems,ctrl:w,layout:S,adapter:p,noMatchMessage:_})})]})}function tt({inputRef:e,placeholder:r,boxRef:i,ctrl:a,layout:o,clearable:s,openOnFocus:c}){let l=o.Toggle,u=s&&a.selectedItem!=null,d=+!!l+ +!!u,f=d>0?{paddingRight:`${o.buttonWidth*d+o.buttonRight}px`}:void 0;return n(`div`,{className:`relative`,ref:i,children:[t(`input`,{ref:e,placeholder:r,...a.getInputProps(),onFocus:c?()=>a.openMenu():void 0,style:f,className:o.inputClass}),n(`div`,{style:{position:`absolute`,right:`${o.buttonRight}px`,top:0,bottom:0,display:`flex`,alignItems:`center`,gap:`2px`},children:[u&&t(`button`,{type:`button`,style:{border:`none`,padding:0,margin:0,backgroundColor:`transparent`,cursor:`pointer`,display:`flex`,alignItems:`center`,width:`${o.buttonWidth}px`},onClick:()=>{a.selectedItem=null},children:t(te,{className:`w-4 h-4`})}),l&&t(`button`,{type:`button`,style:{width:`${o.buttonWidth}px`,border:`none`,padding:0,margin:0,backgroundColor:`transparent`,display:`flex`,alignItems:`center`,justifyContent:`center`},...a.getToggleButtonProps(),children:t(l,{ctrl:a,layout:o})})]})]})}function nt({ctrl:e}){return e.isMenuOpen?t(p,{className:`w-4 h-4`}):t(l,{className:`w-4 h-4`})}function rt({fillWidth:e,items:n,layout:i,ctrl:a,adapter:o,noMatchMessage:s}){let{highlightedIndex:c,selectedItem:l}=a;return n.length===0?s?t(`div`,{style:{width:e?`100%`:void 0},className:i.menuClass,children:s}):null:t(`ul`,{style:{width:e?`100%`:void 0,maxHeight:i.maxMenuHeight?`${i.maxMenuHeight}px`:`240px`},className:i.menuClass,...a.getMenuProps(),children:n.map((e,n)=>t(`li`,{"data-index":n,className:r(i.optionClass,c===n&&`option-highlighted`,l===e&&`option-selected`),...a.getItemProps(e,n),children:o.renderOption(e)},o.idOf(e)))})}function it(e){let[t,n]=L(new at(e));return F(()=>{t?.withState(n)},[t]),t}var at=class e{popupId;items;adapter;onSelect;setState;_selectedItem=null;_filteredItems;_inputText=``;_highlightedIndex=null;_isMenuOpen=!1;popupCtrl;constructor({adapter:e,items:t,value:n,popupId:r}){this.adapter=e,this.items=t,this.popupId=r,typeof n==`string`?this._inputText=n:n&&(this._selectedItem=e.findById(t,e.idOf(n))||null,this._selectedItem&&(this._inputText=e.valueOf(n))),this._inputText?this._filteredItems=this.adapter.filter(this.items,this._inputText):this._filteredItems=this.items}withState(e){return this.setState=e,this}clone(){let t=new e({adapter:this.adapter,items:this.items,popupId:this.popupId});return t.setState=this.setState,t.onSelect=this.onSelect,t._inputText=this._inputText,t._highlightedIndex=this._highlightedIndex,t._selectedItem=this._selectedItem,t._isMenuOpen=this._isMenuOpen,t._filteredItems=this._filteredItems,t.popupCtrl=this.popupCtrl,t}updateState(){this.setState?.(this.clone())}get filteredItems(){return this._inputText?this.adapter.filter(this.items,this._inputText):this.items}get selectedItem(){return this._selectedItem}set selectedItem(e){this._selectedItem=e,this._inputText=e?this.adapter.valueOf(e):``,this._filteredItems=this._inputText?this.adapter.filter(this.items,this._inputText):this.items,this.updateState(),this.onSelect?.(e)}get isMenuOpen(){return this._isMenuOpen}set inputText(e){if(this._inputText=e,e?this._filteredItems=this.adapter.filter(this.items,e):this._filteredItems=this.items,this._highlightedIndex=null,this._selectedItem=null,this.updateState(),this.isMenuOpen&&this.popupCtrl){let e=this.popupCtrl,t=e.context?.position?.position;t&&t===`top`&&window.setTimeout(()=>{e.update()},100)}}get inputText(){return this._inputText}set highlightedIndex(e){this._highlightedIndex=e,this.updateState()}get highlightedIndex(){return this._highlightedIndex}openMenu(){this._filteredItems.length>0&&(this._isMenuOpen=!0,this.updateState())}closeMenu(e){this._isMenuOpen&&(this._highlightedIndex=null,this._isMenuOpen=!1,this.updateState())}toggleMenu(){this._isMenuOpen?this.closeMenu():this.openMenu()}highlightIndex(e,t=!1){this.highlightedIndex=e;let n=document.getElementById(this.popupId);n&&n.querySelector(`li[data-index="${e}"]`)?.scrollIntoView(t)}getMenuProps(){return{}}getToggleButtonProps(){return{onClick:()=>{this._isMenuOpen=!this._isMenuOpen,this.updateState()}}}getItemProps(e,t){return{"aria-selected":this._highlightedIndex===t,onClick:()=>{this.selectedItem=e,this.closeMenu()},onMouseEnter:()=>{this.highlightedIndex!==t&&(this.highlightedIndex=t)},onMouseLeave:()=>{this.highlightedIndex===t&&(this.highlightedIndex=null)}}}getInputProps(){let e=this._filteredItems;return{onClick:()=>{this.openMenu()},onChange:e=>{let t=e.target.value;this.inputText=t,this.openMenu()},value:this.inputText,onKeyDown:t=>{let n=t.key;if(n===`Enter`){if(this.highlightedIndex!=null)this.selectedItem=e[this.highlightedIndex||0];else if(this.inputText){let e=this.adapter.createItem(this.inputText);e&&(this.items.push(e),this.selectedItem=e)}this.closeMenu()}else n===`ArrowDown`?this.isMenuOpen?this.highlightIndex(this.highlightedIndex===null?0:ot(this.highlightedIndex,e.length),!1):this.openMenu():n===`ArrowUp`&&this.isMenuOpen&&this.highlightIndex(this.highlightedIndex===null?0:st(this.highlightedIndex,e.length),!0)}}}};function ot(e,t){return(e+1)%t}function st(e,t){return(e-1+t)%t}function ct({options:e,creatable:n,...r}){return t(et,{adapter:n?Qe.instance:Ze.instance,items:e,...r})}function lt({className:e}){return t(`hr`,{className:r(`w-full h-0.5 border-t-0 bg-border`,e)})}function q(...e){return ge(i(e))}const ut=N.createContext(void 0);function dt(e,t=`plugin-portal-container`){let n=e instanceof Document?e.body:e;for(let e of Array.from(n.children))if(e instanceof HTMLElement&&e.id===t)return e;let r=document.createElement(`div`);return r.id=t,n.appendChild(r),r}function ft({children:e,id:n=`plugin-portal-container`}){let r=N.useContext(ut),i=N.useRef(null),[a,o]=N.useState(r||void 0);return N.useEffect(()=>{if(r){o(r);return}if(i.current){let e=i.current.getRootNode();e instanceof ShadowRoot||e instanceof Document?o(dt(e,n)):o(null)}},[n,r]),a===void 0?t(`div`,{ref:i,style:{display:`none`}}):t(ut.Provider,{value:a||void 0,children:e})}function pt(){return N.useContext(ut)}const mt=B.Provider,ht=B.Root,gt=B.Trigger,_t=M.forwardRef(({className:e,sideOffset:n=4,side:r=`top`,...i},a)=>{let o=pt();return t(B.Portal,{container:o,children:t(B.Content,{ref:a,sideOffset:n,side:r,style:{zIndex:100},className:q(`max-w-[90vw]`,`z-50 overflow-hidden rounded-md bg-tooltips border border-border px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...i})})});_t.displayName=B.Content.displayName;function vt({description:e,children:r,size:i=`sm`,placement:a=`top`,className:o,asChild:s}){let[c,l]=M.useState(!1),u=M.useRef(!1);return M.useEffect(()=>{let e=()=>{l(!1),u.current=!0,requestAnimationFrame(()=>{u.current=!1})};return window.addEventListener(`blur`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`blur`,e),document.removeEventListener(`visibilitychange`,e)}},[]),t(mt,{delayDuration:0,children:n(ht,{open:c,onOpenChange:e=>{u.current||l(e)},children:[t(gt,{className:`cursor-pointer`,asChild:s,children:r}),t(_t,{side:a,className:`px-3 py-1.5 max-w-${i} text-${i} px-3 ${o}`,children:e})]})})}const yt=new Set;function bt(e,t,n){F(()=>{t&&!yt.has(e)&&(yt.add(e),console.warn(`[@vertesia/ui] ${e} is deprecated: ${n}`))},[t,n,e])}const xt=z(`hover:cursor-pointer inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-hidden 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:{destructive:`bg-destructive dark:bg-destructive/10 text-destructive ring-1 ring-inset ring-destructive-muted/50 dark:ring-destructive-muted/50 shadow-xs hover:bg-destructive/50`,outline:`border border-input bg-background shadow-xs hover:bg-muted ring-inset`,secondary:`bg-primary/5 dark:bg-primary/10 text-primary shadow-xs hover:bg-primary/10 dark:hover:bg-primary/20 ring-inset`,ghost:`hover:bg-muted/50 dark:hover:bg-muted/20 ring-inset`,link:`text-foreground underline-offset-4 hover:underline ring-inset`,primary:`bg-primary text-white shadow-xs hover:bg-primary/90 ring-inset`,unstyled:``},size:{xs:`h-7 rounded px-2 py-1 text-xs gap-x-1`,sm:`h-8 rounded px-3 text-xs`,md:`h-9 rounded-md px-4 py-2`,lg:`h-10 rounded-md px-3`,xl:`rounded-md px-3.5 py-2.5 text-sm gap-x-2`,icon:`p-0 m-0 rounded-full`,none:``}},defaultVariants:{variant:`primary`,size:`md`}}),J=M.forwardRef(({className:i,variant:a,size:o,asChild:s=!1,alt:c,isDisabled:l,isLoading:u,title:d,onClick:f,type:p,...m},h)=>{bt(`Button.alt`,c!==void 0,"use aria-label for the accessible name and wrap in <VTooltip> for a visual tooltip. `alt` is forwarded to both for one release.");let g=s?pe:`button`,_=s?p:p??`button`,v=m[`aria-label`]??c,y=s?m.children:n(e,{children:[u&&t(x,{className:`animate-spin`}),m.children]}),b=t(g,{className:r(q(xt({variant:a,size:o})),i),disabled:l||u||m.disabled,ref:h,onClick:f,type:_,autoFocus:!1,...m,"aria-label":v,children:y});return c||d?t(vt,{description:c||d,asChild:!0,className:`cursor-pointer`,size:`xs`,placement:`top`,children:b}):b});J.displayName=`Button`;const St=M.forwardRef(({size:e,content:n,toast:r,className:i,alt:a,"aria-label":s,...c},l)=>{let[u,d]=L(!1),{t:f}=R();bt(`CopyButton.alt`,a!==void 0,"use aria-label for the accessible name. `alt` is forwarded for one release.");let p=e=>{e.stopPropagation(),navigator.clipboard.writeText(n).then(()=>{d(!0),setTimeout(()=>d(!1),2e3),r?.toast&&r.toast({status:`success`,title:r.message||f(`misc.copiedToClipboard`),duration:2e3})}).catch(e=>{console.error(`Failed to copy text: `,e),r?.toast&&r.toast({status:`error`,title:f(`misc.failedToCopy`),duration:2e3})})},m=s??a??f(`misc.copy`);return t(J,{ref:l,className:q(i),variant:`unstyled`,size:e||`sm`,onClick:p,...c,"aria-label":m,title:m,children:u?t(o,{className:`text-success`}):t(v,{className:`size-4`})})});St.displayName=`CopyButton`;function Ct({buttonLabel:e,title:r,children:i,onClick:a}){return t(`div`,{className:`flex items-center justify-center h-full text-center`,children:n(`div`,{className:`py-12`,children:[t(`svg`,{className:`mx-auto size-12`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,"aria-hidden":`true`,children:t(`path`,{vectorEffect:`non-scaling-stroke`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M9 13h6m-3-3v6m-9 1V7a2 2 0 012-2h6l2 2h6a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2z`})}),t(`h3`,{className:`mt-2 text-sm font-semibold`,children:r}),t(`p`,{className:`mt-1 text-sm text-muted`,children:i}),t(`div`,{className:`mt-6`,children:n(J,{onClick:a,children:[t(E,{className:`-ms-0.5 me-1.5 size-5`,"aria-hidden":`true`}),e]})})]})})}function wt(e){return e.isFile}function Tt(e){return e.isDirectory}function Et(e){let t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}function Dt({children:e,onUpload:r}){let i=I(null);return n(`label`,{style:{cursor:`pointer`},children:[e,t(`input`,{ref:i,type:`file`,style:{display:`none`},onChange:()=>{i.current?.files&&r(Et(i.current.files))}})]})}function Ot({onUpload:e}){return t(`div`,{...Mt({onUpload:e}),className:`flex items-center justify-center w-full h-64 border-2 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-bray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600`,children:n(`label`,{htmlFor:`dropzone-file`,className:`flex flex-col items-center justify-center w-full h-full`,children:[n(`div`,{className:`flex flex-col items-center justify-center pt-5 pb-6`,children:[t(`svg`,{className:`w-8 h-8 mb-4 text-gray-500 dark:text-gray-400`,"aria-hidden":`true`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 20 16`,children:t(`path`,{stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2`})}),n(`p`,{className:`mb-2 text-sm text-gray-500 dark:text-gray-400`,children:[t(`span`,{className:`font-semibold`,children:`Click to upload`}),` or drag and drop`]}),t(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:`SVG, PNG, JPG or GIF (MAX. 800x400px)`})]}),t(`input`,{id:`dropzone-file`,type:`file`,className:`hidden`})]})})}function kt(e){if(!e)return!1;let t=e.__dragOver_cnt__||0;return e.__dragOver_cnt__=t+1,!t}function At(e){if(!e)return!1;let t=e.__dragOver_cnt__;return t?(e.__dragOver_cnt__=t-1,t===1):!1}function jt(e){e&&delete e.__dragOver_cnt__}function Mt({onUpload:e,dragOverClass:t=`is-drag-over-on`,dropEffect:n=`copy`}){let r=I(null);return{onDrop:n=>{n.preventDefault(),jt(r.current),r.current?.classList.remove(t);let i=n.dataTransfer.items;if(i){let t=[],n=(e,t=``)=>new Promise(r=>{if(wt(e))e.file(e=>{Object.defineProperty(e,"webkitRelativePath",{value:t+e.name}),r([e])});else if(Tt(e)){let i=e.createReader(),a=[],o=()=>{i.readEntries(i=>{if(!i.length)Promise.all(a).then(e=>r(e.flat()));else{for(let r of i)a.push(n(r,`${t+e.name}/`));o()}})};o()}});for(let e=0;e<i.length;e++){let r=i[e].webkitGetAsEntry();r&&t.push(n(r))}Promise.all(t).then(t=>{let n=t.flat();n.length&&e(n)})}},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=n},onDragEnter:()=>{kt(r.current)&&r.current?.classList.add(t)},onDragLeave:()=>{At(r.current)&&r.current?.classList.remove(t)},ref:r}}function Nt(...e){let t=e.filter(e=>typeof e==`string`&&e.length>0);return t.length>0?t.join(` `):void 0}function Pt(){try{return _e.isDev}catch{return!1}}function Ft({description:e,helpText:i,error:a,required:o,label:s,className:c,direction:l=`column`,children:u,disabled:d=!1,fullWidthLabel:f=!1,childrenId:p}){let m=le(),h=le(),g=le(),_=p??m,v=I(!1),b=ne.toArray(u).filter(se),x=b.length===1?b[0]:void 0,S=x?.type===re,C=!!x&&!S,w=!1,T=u;if(C&&x){let e=x,t=e.props??{},n=Nt(t[`aria-describedby`],i?h:void 0,a?g:void 0),r=t[`aria-invalid`]??(a?!0:void 0);T=ie(e,{id:t.id??_,"aria-describedby":n,"aria-invalid":r}),w=!0}else Pt()&&!v.current&&(i||a||p===void 0)&&(v.current=!0,console.warn("[@vertesia/ui] FormItem received zero, multiple, or a fragment as element children. ARIA wiring skipped. Pass `childrenId` and set `id` / `aria-describedby` / `aria-invalid` on your input manually, or wrap the input in a single non-fragment element."));let E=w||p?_:void 0;return n(`div`,{className:r(`flex w-full space-y-1`,c,l===`row`?`flex-row justify-between items-center gap-2`:l===`row-reverse`?`flex-row-reverse justify-between items-center gap-2`:`flex-col`),children:[n(`div`,{className:r(`flex items-center gap-1 mb-0`,f&&`w-full`),children:[n(`label`,{htmlFor:E,className:`text-sm font-medium mb-1 ${d?`text-muted`:``} ${f&&`flex-1`}`,children:[s,o?t(`span`,{className:`text-destructive -mt-4 ms-1`,children:`*`}):``]}),e&&t(`div`,{className:`mx-2 flex w-4 items-center`,children:t(vt,{description:e,children:t(y,{className:`size-3 text-muted`})})})]}),T,i&&t(`p`,{id:h,className:`text-xs text-muted`,children:i}),a&&t(`p`,{id:g,className:`text-xs text-destructive`,children:a})]})}function It(e){return t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e(t))}}const Lt=z(`inline-flex items-center rounded-md px-2 py-1 text-xs font-medium`,{variants:{variant:{default:`text-foreground bg-muted`,secondary:`bg-secondary text-primary`,destructive:`bg-destructive text-destructive`,attention:`bg-attention text-attention`,success:`bg-success text-success`,info:`bg-info text-info`,done:`bg-done text-done`,outline:`bg-transparent border border-border text-foreground`}},defaultVariants:{variant:`default`}});function Rt({className:e,variant:n,children:r,onClick:i,...a}){let o=i?{role:`button`,tabIndex:0,onClick:i,onKeyDown:It(i)}:{};return t(`span`,{className:q(Lt({variant:n}),e),...o,...a,children:r})}const zt=z(`inline-flex items-center gap-x-1.5 rounded-md px-2 py-1 text-xs font-medium ring-1 ring-inset ring-border`,{variants:{variant:{default:``,success:``,destructive:``,attention:``,done:``,info:``,outline:``}},defaultVariants:{variant:`default`}}),Bt=z(`h-1.5 w-1.5`,{variants:{variant:{default:`fill-foreground`,success:`fill-success`,destructive:`fill-destructive`,attention:`fill-attention`,done:`fill-done`,info:`fill-info`,outline:`fill-foreground`}},defaultVariants:{variant:`default`}});function Vt({variant:e,className:r,dotClassName:i,children:a,...o}){return n(`span`,{className:q(zt({variant:e}),r),...o,children:[t(`div`,{className:`flex-shrink-0`,children:t(`svg`,{className:q(Bt({variant:e}),i),viewBox:`0 0 6 6`,"aria-hidden":`true`,children:t(`circle`,{cx:3,cy:3,r:3})})}),t(`span`,{className:`truncate`,children:a})]})}function Ht({value:e=[],onChange:i,className:a,delimiters:o=`, `,placeholder:s,autoFocus:c,disabled:l=!1}){let[u,d]=L(``),f=t=>{if(l)return;let n=t.currentTarget.value;n?.trim()&&(i([...e,n.trim()]),d(``))},p=t=>{if(l)return;let n=t.currentTarget.value,r=!n.trim(),a=t.key;a===`Enter`||o.indexOf(a)>-1?(t.preventDefault(),e&&!r&&(i([...e,n.trim()]),d(``))):a===`Backspace`&&r&&e&&e.length>0&&(e.pop(),i([...e]))},m=t=>{if(l)return;let n=t.clipboardData.getData(`text`);if(n){t.preventDefault();let r=o.split(``).map(e=>e===` `?`\\s`:e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),a=RegExp(`[${r}]+`),s=n.split(a).map(e=>e.trim()).filter(e=>e.length>0);s.length>0&&i([...e,...s]),d(``)}},h=t=>{l||e&&e.length>0&&(e.splice(t,1),i([...e]))};return n(`div`,{className:r(a,`w-full flex flex-wrap items-center gap-1 p-2 py-1.5`,`rounded-md text-sm rounded-md border border-input bg-background ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,l&&`opacity-50 cursor-not-allowed`),children:[e&&e.length>0&&e.map((e,n)=>t(vt,{description:`click to remove`,children:t(Rt,{variant:`secondary`,onClick:()=>h(n),className:r(`flex-shrink-0 transition-colors`,l?`cursor-not-allowed`:`cursor-pointer hover:bg-destructive hover:text-destructive`),title:e,children:t(`span`,{className:`break-all`,children:e})})},`item-${n}`)),t(`input`,{className:`flex-1 min-w-[80px] m-0 p-0 px-1 border-0 bg-transparent text-sm placeholder:text-muted focus:outline-none focus:ring-0 disabled:cursor-not-allowed`,type:`text`,value:u,onBlur:f,onKeyDown:p,onPaste:m,onChange:e=>d(e.currentTarget.value),placeholder:!e||e.length===0?s:``,autoFocus:c,disabled:l})]})}function Ut({underline:e=`always`,className:n,children:i,...a}){let o;return e===`always`?o=`underline`:e===`hover`&&(o=`hover:underline`),t(`a`,{className:r(`text-indigo-800 dark:text-indigo-300`,n,o),...a,children:i})}function Wt({className:e,children:n}){return t(`ul`,{className:`${e} space-y-1 flex flex-col items-start`,children:n})}Wt.Item=oe(function(e,n){let{current:i,children:a,className:o,href:s=`#`,onClick:c,...l}=e;return t(`li`,{className:r(o,i?`bg-muted`:``,`w-full p-2 ps-3 text-sm leading-6 font-semibold hover:bg-muted`),children:t(`a`,{ref:n,href:s,onClick:e=>{c?(e.preventDefault(),c(e)):s===`#`&&e.preventDefault()},className:`w-full flex items-center gap-x-3`,...l,children:a})})});const Gt=`rounded-md text-sm flex w-full rounded-md border border-input bg-background ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,Kt={INPUT_UNSTYLED:`block m-0 p-0 w-full border-0 focus:outline-hidden focus:ring-0 bg-transparent`,INPUT_NO_PADDING:Gt,INPUT:`${Gt} py-1.5`};function qt(e){return e==null||Number.isNaN(e)?``:e.toString()}const Jt=N.forwardRef(({value:e,onChange:n,className:i,noScroll:a=!1,noSpinners:o=!1,...s},c)=>{let[l,u]=N.useState(qt(e));return F(()=>{(e==null||!Number.isNaN(e))&&u(qt(e))},[e]),t(`input`,{onWheel:a?e=>{e.currentTarget.blur()}:s.onWheel,type:`number`,value:l,onChange:e=>{let t=e.target.value;u(t),t===``?n?.(void 0,t):n?.(parseFloat(t),t)},className:r(i,Kt.INPUT,{"no-spinners":o},o&&`[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`),ref:c,...s})});function Yt({children:e,overlayContent:r,className:i=``,overlayClassName:a=``,position:o=`right`,width:s,height:c,showCloseButton:l=!0,onOpen:u,onClose:d,triggerClassName:f=``,backdropClassName:p=``,animationConfig:m={type:`spring`,stiffness:300,damping:30}}){let[h,g]=L(!1),_=()=>{g(!0),u?.()},v=()=>{g(!1),d?.()},y=Xt(o),b=Zt(o,s,c);return n(`div`,{className:`flex items-center justify-center w-full ${i}`,children:[t(J,{variant:`unstyled`,size:`none`,onClick:_,className:`w-full align-left cursor-pointer ${f}`,children:e}),h&&t(`div`,{className:`z-45 fixed inset-0 bg-black bg-opacity-50 ${p}`,children:n(ye.div,{...y,transition:m,className:`${b} ${a}`,children:[l&&t(`div`,{className:`absolute top-2 end-2 z-10`,children:t(J,{onClick:v,variant:`primary`,children:t(j,{})})}),t(`div`,{className:l?`mt-8`:``,children:r})]})})]})}function Xt(e){switch(e){case`left`:return{initial:{x:`-100%`},animate:{x:0},exit:{x:`-100%`}};case`right`:return{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`}};case`top`:return{initial:{y:`-100%`},animate:{y:0},exit:{y:`-100%`}};case`bottom`:return{initial:{y:`100%`},animate:{y:0},exit:{y:`100%`}};case`center`:return{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8}};default:return{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`}}}}function Zt(e,t,n){let r=`fixed bg-white shadow-lg p-4 relative`;switch(e){case`left`:return`${r} left-0 top-[var(--header-height)] h-full ${t||`w-80`}`;case`right`:return`${r} right-0 top-[var(--header-height)] h-full ${t||`w-80`}`;case`top`:return`${r} top-[var(--header-height)] start-0 end-0 ${n||`h-80`}`;case`bottom`:return`${r} bottom-0 start-0 end-0 ${n||`h-80`}`;case`center`:return`${r} top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 ${t||`w-96`} ${n||`max-h-96`}`;default:return`${r} right-0 top-[var(--header-height)] h-full ${t||`w-80`}`}}const Qt=`--tailwind-portal`;function $t({children:e}){let n=I(null),[r,i]=L(null);return F(()=>{if(n.current){let e=n.current.ownerDocument,t=e.getElementById(Qt);t||(t=e.createElement(`DIV`),t.id=Qt,e.body.appendChild(t)),i(t)}},[]),r?fe(e,r):t(`span`,{ref:n})}function en({path:e,maxItems:r=3,className:i,separator:a}){let o=e||[],s=e=>{let n=typeof e.label==`string`&&e.label.length>20?`${e.label.slice(0,17)}...`:e.label;return e.onClick?t(on,{onClick:e.onClick,href:e.href,title:typeof e.label==`string`?e.label:void 0,children:n}):e.href?t(on,{href:e.href,title:typeof e.label==`string`?e.label:void 0,children:n}):t(sn,{children:n})};if(o.length<=r)return t(tn,{className:q(`w-full flex items-center`,i),children:t(nn,{children:o.map((e,r)=>n(M.Fragment,{children:[t(rn,{children:s(e)}),r<o.length-1&&t(cn,{children:a??t(u,{className:`cn-rtl-flip`})})]},`crumb-${r}`))})});let c=o.slice(-(r-1));return t(tn,{className:q(`w-full flex items-center`,i),children:n(nn,{children:[t(rn,{children:t(ln,{})}),t(cn,{children:a??t(u,{className:`cn-rtl-flip`})}),c.map((e,r)=>n(M.Fragment,{children:[t(rn,{children:s(e)}),r<c.length-1&&t(cn,{children:a??t(u,{className:`cn-rtl-flip`})})]},`crumb-${r}`))]})})}const tn=M.forwardRef(({...e},n)=>t(`nav`,{ref:n,"aria-label":`breadcrumb`,...e}));tn.displayName=`Breadcrumb`;const nn=M.forwardRef(({className:e,...n},r)=>t(`ol`,{ref:r,className:q(`flex flex-wrap items-center gap-1.5 break-words text-sm text-muted sm:gap-2.5`,e),...n}));nn.displayName=`BreadcrumbList`;const rn=M.forwardRef(({className:e,...n},r)=>t(`li`,{ref:r,className:q(`inline-flex items-center gap-1.5 text-muted`,e),...n}));rn.displayName=`BreadcrumbItem`;const an=M.forwardRef(({asChild:e,className:n,...r},i)=>t(`a`,{ref:i,className:q(`transition-colors hover:text-muted`,n),...r}));an.displayName=`BreadcrumbLink`;const on=M.forwardRef(({className:e,href:n,onClick:r,...i},a)=>t(J,{variant:`ghost`,size:`md`,ref:a,className:q(`p-0! hover:underline! hover:bg-background!`,e),onClick:e=>{e.preventDefault(),r&&r(e)},...i}));on.displayName=`BreadcrumbButton`;const sn=M.forwardRef(({className:e,...n},r)=>t(`span`,{ref:r,"aria-current":`page`,className:q(`font-normal text-foreground`,e),...n}));sn.displayName=`BreadcrumbPage`;const cn=({children:e,className:n,...r})=>t(`li`,{role:`presentation`,"aria-hidden":`true`,className:q(`[&>svg]:w-3.5 [&>svg]:h-3.5`,n),...r,children:e??t(u,{className:`cn-rtl-flip`})});cn.displayName=`BreadcrumbSeparator`;const ln=({className:e,...r})=>n(`span`,{role:`presentation`,"aria-hidden":`true`,className:q(`flex h-9 w-9 items-center justify-center`,e),...r,children:[t(T,{className:`h-4 w-4`}),t(`span`,{className:`sr-only`,children:`More`})]});ln.displayName=`BreadcrumbEllipsis`;const un=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`rounded-xl border bg-card text-card-foreground shadow`,e),...n}));un.displayName=`Card`;const dn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`flex flex-col p-6`,e),...n}));dn.displayName=`CardHeader`;const fn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`font-semibold leading-none tracking-tight`,e),...n}));fn.displayName=`CardTitle`;const pn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`text-sm text-muted-foreground`,e),...n}));pn.displayName=`CardDescription`;const mn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`p-6 pt-0`,e),...n}));mn.displayName=`CardContent`;const hn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`flex items-center p-6 pt-0`,e),...n}));hn.displayName=`CardFooter`;const gn=M.forwardRef(({className:e,...n},r)=>t(be.Root,{ref:r,className:q(`peer size-4 shrink-0 rounded-sm border border-1 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-white`,e),...n,children:t(be.Indicator,{className:q(`flex items-center justify-center text-current`),children:t(o,{className:`size-4`})})}));gn.displayName=be.Root.displayName;function _n({...e}){return t(xe.Root,{"data-slot":`collapsible`,...e})}function vn({...e}){return t(xe.Trigger,{"data-slot":`collapsible-trigger`,...e})}function yn({...e}){return t(xe.Content,{"data-slot":`collapsible-content`,...e})}function bn({children:e}){return t(`span`,{style:{border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`,wordWrap:`normal`},children:e})}const xn=ae(!1);function Sn(){return!!P(xn)}function Cn({children:e}){return t(xn.Provider,{value:!0,children:e})}function wn({className:e,children:r,isOpen:i,onClose:a,description:o=`Modal Description`,noCloseButton:s=!1,allowOverflow:c=!1,disableCloseOnClickOutside:l=!1,size:u=`md`,action:d}){let f=e=>{e||a()};function p(){switch(u){case`sm`:return`max-w-[20vw]`;case`md`:return`max-w-[60vw] lg:max-w-[40vw]`;case`lg`:return`max-w-[80vw] md:max-w-[60vw]`;case`xl`:return`max-w-[95vw] lg:max-w-[80vw]`;default:return`max-w-[60vw] lg:max-w-[40vw]`}}return n(On,{open:i,onOpenChange:e=>{(!l||e)&&f(e)},children:[c&&t(Mn,{className:`z-50 fixed inset-0 bg-black/80`}),t(bn,{children:t(Pn,{children:o})}),n(Nn,{className:q(`min-h-20 p-4`,`fixed left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] border bg-background shadow-lg duration-200 sm:rounded-lg`,p(),e),children:[t(`div`,{className:`top-4 end-4 absolute`,children:n(`div`,{className:`flex gap-2`,children:[d&&d,!s&&t(jn,{onClick:()=>f(!1),asChild:!0,autoFocus:!1,children:t(J,{variant:`outline`,alt:`Close`,className:`data-[state=open]:bg-accent opacity-70 hover:opacity-100 rounded-sm focus:outline-none focus:ring-2 focus:ring-ring ring-offset-background focus:ring-offset-2 data-[state=open]:text-muted-foreground transition-opacity disabled:pointer-events-none`,children:t(j,{className:`size-4`})})})]})}),t(Cn,{children:r})]})]})}const Tn=({children:e,show:r=!0,className:i,description:a,showDivider:o=!1,...s})=>r?n(Fn,{className:q(o?`border-b-solid border-b border-b-1 pb-2 mb-4`:``,`text-lg font-semibold leading-6 tracking-tight`,{"py-2":!a},i),...s,children:[e,a&&t(Pn,{className:`text-sm !font-normal text-muted-foreground pb-2`,children:a})]}):n(bn,{children:[t(Fn,{children:e}),a&&t(Pn,{children:a})]}),En=({children:e,className:n,...r})=>t(`div`,{className:q(`text-sm max-h-[80vh] overflow-y-auto`,n),...r,children:e}),Dn=({align:e=`right`,children:n,className:r,...i})=>t(`div`,{className:q(`w-full flex py-3 sm:py-2 sm:flex sm:flex-row-reverse sm:flex-row sm:justify-end gap-2`,{left:`justify-start`,center:`justify-center`,right:`justify-end`}[e],r),...i,children:n}),On=H.Root,kn=H.Trigger,An=H.Portal,jn=H.Close,Mn=M.forwardRef(({className:e,...n},r)=>t(H.Overlay,{ref:r,className:q(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...n}));Mn.displayName=H.Overlay.displayName;const Nn=M.forwardRef(({className:e,children:r,...i},a)=>n(An,{container:pt(),children:[t(Mn,{}),t(H.Content,{ref:a,autoFocus:!1,onOpenAutoFocus:e=>{e.preventDefault()},className:q(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] border bg-background shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...i,children:r})]}));Nn.displayName=H.Content.displayName;const Pn=M.forwardRef(({className:e,...n},r)=>t(H.Description,{ref:r,className:q(`text-sm text-muted`,e),...n}));Pn.displayName=H.Description.displayName;const Fn=M.forwardRef(({className:e,...n},r)=>t(H.Title,{ref:r,className:q(`text-lg font-semibold leading-none tracking-tight`,e),...n}));Fn.displayName=H.Title.displayName;const In=M.forwardRef(({className:e,...n},r)=>t(V,{ref:r,className:q(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...n}));In.displayName=V.displayName;const Ln=({children:e,...n})=>t(On,{...n,children:t(Nn,{className:`shadow-lg p-0 overflow-hidden`,children:t(In,{className:`[&_[cmdk-group]]:px-2 [&_[cmdk-item]]:px-2 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-item]_svg]:w-5 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,children:e})})}),Rn=M.forwardRef(({className:e,...r},i)=>n(`div`,{className:`flex items-center px-3 border-b`,"cmdk-input-wrapper":``,children:[t(D,{className:`opacity-50 size-4 shrink-0`}),t(V.Input,{ref:i,className:q(`focus:ring-0`,`border-0 flex h-8 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...r})]}));Rn.displayName=V.Input.displayName;const zn=M.forwardRef(({className:e,...n},r)=>t(V.List,{ref:r,className:q(`overflow-y-auto overflow-x-hidden`,e),...n}));zn.displayName=V.List.displayName;const Bn=M.forwardRef((e,n)=>t(V.Empty,{ref:n,className:`py-2 text-sm text-center`,...e}));Bn.displayName=V.Empty.displayName;const Y=M.forwardRef(({className:e,...n},r)=>t(V.Group,{ref:r,className:q(`overflow-y-auto overflow-x-hidden p-1 text-foreground`,`[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...n}));Y.displayName=V.Group.displayName;const Vn=M.forwardRef(({className:e,...n},r)=>t(V.Separator,{ref:r,className:q(`-mx-1 h-px bg-border`,e),...n}));Vn.displayName=V.Separator.displayName;const X=M.forwardRef(({className:e,...n},r)=>t(V.Item,{ref:r,className:q(`hover:bg-muted cursor-pointer relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,e),...n}));X.displayName=V.Item.displayName;const Hn=({className:e,...n})=>t(`span`,{className:q(`ms-auto text-xs tracking-widest text-muted-foreground`,e),...n});Hn.displayName=`CommandShortcut`;const Un=M.createContext(!1);function Wn({...e}){return t(U.Root,{"data-slot":`dropdown-menu`,...e})}function Gn({...e}){return t(U.Portal,{"data-slot":`dropdown-menu-portal`,...e})}function Kn({...e}){return t(U.Trigger,{"data-slot":`dropdown-menu-trigger`,...e})}function qn({className:e,align:n=`start`,sideOffset:r=4,...i}){return t(U.Portal,{children:t(U.Content,{"data-slot":`dropdown-menu-content`,sideOffset:r,align:n,className:q(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-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 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto data-[state=closed]:overflow-hidden`,e),...i})})}function Jn({...e}){return t(U.Group,{"data-slot":`dropdown-menu-group`,...e})}function Yn({className:e,inset:n,variant:r=`default`,...i}){return t(U.Item,{"data-slot":`dropdown-menu-item`,"data-inset":n,"data-variant":r,className:q(`hover:bg-muted focus:bg-muted data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive gap-2 rounded-md px-1.5 py-1 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...i})}function Xn({className:e,children:r,checked:i,inset:a,...o}){return n(U.CheckboxItem,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":a,className:q(`focus:bg-muted focus:text-muted focus:**:text-muted gap-2 rounded-md py-1 pe-8 ps-1.5 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),checked:i,...o,children:[t(`span`,{className:`absolute end-2 flex items-center justify-center pointer-events-none`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:t(U.ItemIndicator,{children:t(s,{})})}),r]})}function Zn({...e}){return t(U.RadioGroup,{"data-slot":`dropdown-menu-radio-group`,...e})}function Qn({className:e,children:r,inset:i,...a}){return n(U.RadioItem,{"data-slot":`dropdown-menu-radio-item`,"data-inset":i,className:q(`focus:bg-muted focus:text-muted focus:**:text-muted gap-2 rounded-md py-1 pe-8 ps-1.5 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...a,children:[t(`span`,{className:`absolute end-2 flex items-center justify-center pointer-events-none`,"data-slot":`dropdown-menu-radio-item-indicator`,children:t(U.ItemIndicator,{children:t(s,{})})}),r]})}function $n({className:e,inset:n,...r}){return t(U.Label,{"data-slot":`dropdown-menu-label`,"data-inset":n,className:q(`text-muted px-1.5 py-1 text-xs font-medium data-inset:ps-7`,e),...r})}function er({className:e,...n}){return t(U.Separator,{"data-slot":`dropdown-menu-separator`,className:q(`bg-border -mx-1 my-1 h-px`,e),...n})}function tr({className:e,...n}){return t(`span`,{"data-slot":`dropdown-menu-shortcut`,className:q(`text-muted group-focus/dropdown-menu-item:text-muted ms-auto text-xs tracking-widest`,e),...n})}function nr({...e}){return t(U.Sub,{"data-slot":`dropdown-menu-sub`,...e})}function rr({className:e,inset:r,children:i,...a}){return n(U.SubTrigger,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":r,className:q(`focus:bg-muted focus:text-muted data-open:bg-muted data-open:text-muted not-data-[variant=destructive]:focus:**:text-muted gap-2 rounded-md px-1.5 py-1 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 flex cursor-default items-center outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...a,children:[i,t(d,{className:`cn-rtl-flip ms-auto`})]})}function ir({className:e,...n}){return t(U.SubContent,{"data-slot":`dropdown-menu-sub-content`,className:q(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-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 ring-foreground/10 bg-popover text-popover-foreground min-w-[96px] rounded-lg p-1 shadow-lg ring-1 duration-100 z-50 origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden`,e),...n})}const ar={left:`start`,center:`center`,right:`end`};function or({trigger:e,children:r,align:i=`right`,hover:a}){let[o,s]=M.useState(!1),c=M.useRef(null);return a?n(`div`,{className:`relative inline-flex`,onMouseEnter:()=>{c.current&&clearTimeout(c.current),s(!0)},onMouseLeave:()=>{c.current=setTimeout(()=>s(!1),80)},children:[e,o&&t(`div`,{className:q(`absolute top-full pt-1 z-50`,i===`right`?`end-0`:i===`center`?`left-1/2 -translate-x-1/2`:`start-0`),children:t(`div`,{className:`min-w-32 rounded-lg p-1 shadow-md ring-1 ring-foreground/10 bg-popover text-popover-foreground`,children:t(Un.Provider,{value:!0,children:r})})})]}):n(Wn,{children:[t(Kn,{asChild:!0,children:t(`span`,{className:`-m-1.5 flex items-center p-1.5`,children:e})}),t(qn,{align:ar[i],className:`w-max`,children:r})]})}function sr({children:e,label:r}){return n(Jn,{children:[r&&t($n,{children:r}),e]})}function cr({children:e,href:n,onClick:r,isDisabled:i=!1,variant:a=`default`,className:o}){let s=M.useContext(Un),c=q(`w-full gap-2 rounded-md px-1.5 py-1 text-sm text-nowrap [&_svg:not([class*='size-'])]:size-4 flex cursor-default items-center select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,a===`destructive`?`text-destructive`:``,i?`pointer-events-none opacity-50`:`hover:bg-muted focus:bg-muted`,o);return s?n?t(`a`,{href:n,className:c,children:e}):t(`button`,{type:`button`,className:c,disabled:i,onClick:e=>{e.stopPropagation(),r?.(e)},children:e}):t(Yn,{className:q(`data-[disabled]:pointer-events-none data-[disabled]:opacity-50 text-nowrap`,o),disabled:i,variant:a,onClick:e=>{e.stopPropagation(),r?.(e)},asChild:!!n,children:n?t(`a`,{href:n,children:e}):e})}const lr=({children:e,className:n})=>{let r=I(null),[i,a]=L(`auto`);return F(()=>{if(r.current){let e=new ResizeObserver(e=>{let t=e[0].contentRect.height;a(t)});return e.observe(r.current),()=>{e.disconnect()}}},[]),t(`div`,{className:q(n,`overflow-hidden transition-all duration-100 ease-in`),style:{height:i},children:t(`div`,{ref:r,children:e})})},ur=M.createContext(null),Z=({hover:e=!1,click:n=!1,modal:r,children:i,_open:a,onOpenChange:o})=>{let[s,c]=M.useState(a||!1);return t(ur.Provider,{value:{open:s,setOpen:c,hover:e,click:n},children:t(G.Root,{open:s,onOpenChange:e=>{c(e),o&&o(e)},modal:r,children:i})})};function dr(e=!1,t=()=>{},n){e&&t(n===`enter`)}const Q=M.forwardRef(({children:e,...n},r)=>{let i=M.useContext(ur);if(!i)throw Error(`PopoverTrigger must be used within a Popover`);let{setOpen:a,hover:o,click:s}=i;return t(G.Trigger,{ref:r,asChild:!0,onMouseEnter:()=>dr(o,a,`enter`),onMouseLeave:()=>dr(o,a,`leave`),onClick:()=>{s&&a(e=>!e)},...n,children:e})});Q.displayName=G.Trigger.displayName;const fr=G.Anchor,$=M.forwardRef(({className:e,align:n=`center`,side:r=`bottom`,...i},a)=>{let o=M.useContext(ur);if(!o)throw Error(`PopoverContent must be used within a Popover`);let{setOpen:s,hover:c}=o,l=pt();return t(G.Portal,{container:l,children:t(G.Content,{ref:a,align:n,side:r,onMouseEnter:()=>dr(c,s,`enter`),onMouseLeave:()=>dr(c,s,`leave`),className:q(`z-50 w-72 rounded-md border-popover bg-popover text-popover-foreground ring-1 ring-gray-200 dark:ring-slate-700 shadow-md focus:outline-none animate-in`,`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...i})})});$.displayName=G.Content.displayName;const pr=G.Close;pr.displayName=G.Close.displayName;function mr(){let e=M.useContext(ur);if(!e)throw Error(`usePopoverContext must be used within a Popover`);return{...e,close:()=>e.setOpen(!1)}}const hr=`
|
|
1
|
+
import{Fragment as e,jsx as t,jsxs as n}from"react/jsx-runtime";import r,{clsx as i}from"clsx";import{AlertTriangle as a,Check as o,CheckIcon as s,ChevronDown as c,ChevronDownIcon as l,ChevronRight as u,ChevronRightIcon as d,ChevronUp as f,ChevronUpIcon as p,ChevronsUpDown as m,CircleCheck as h,CircleX as g,Computer as _,CopyIcon as v,Info as y,ListFilter as b,Loader2 as x,LoaderCircle as S,Minus as C,Moon as w,MoreHorizontal as T,Plus as E,Search as D,SearchIcon as O,SquarePlus as k,Sun as A,TriangleAlert as ee,X as j,XIcon as te}from"lucide-react";import*as M from"react";import N,{Children as ne,Fragment as re,cloneElement as ie,createContext as ae,forwardRef as oe,isValidElement as se,useCallback as ce,useContext as P,useEffect as F,useId as le,useLayoutEffect as ue,useMemo as de,useRef as I,useState as L}from"react";import{createPortal as fe}from"react-dom";import{Slot as pe}from"@radix-ui/react-slot";import{SUPPORTED_LANGUAGES as me,useLanguage as he,useUITranslation as R}from"@vertesia/ui/i18n";import{cva as z}from"class-variance-authority";import{twMerge as ge}from"tailwind-merge";import*as B from"@radix-ui/react-tooltip";import{Env as _e}from"@vertesia/ui/env";import{AnimatePresence as ve,motion as ye}from"framer-motion";import*as be from"@radix-ui/react-checkbox";import*as xe from"@radix-ui/react-collapsible";import{Command as V}from"cmdk";import*as H from"@radix-ui/react-dialog";import*as U from"@radix-ui/react-dropdown-menu";import W from"dayjs";import Se from"react-calendar";import*as G from"@radix-ui/react-popover";import{isEqual as Ce}from"lodash-es";import*as we from"@radix-ui/react-label";import*as Te from"@radix-ui/react-radio-group";import*as Ee from"react-resizable-panels";import*as De from"@radix-ui/react-separator";import*as Oe from"@radix-ui/react-slider";import*as ke from"@radix-ui/react-switch";import*as K from"@radix-ui/react-tabs";function Ae(e){switch(e){case`xs`:return`size-4`;case`sm`:return`size-6`;case`md`:return`size-8`;case`lg`:return`size-10`;case`xl`:return`size-12`;case`2xl`:return`size-14`;default:throw Error(`Unexpected size: ${e}`)}}function je({size:e,src:n,name:r,shape:i=`circle`,color:a=`bg-gray-500`,className:o}){let s=i===`circle`?`rounded-full`:`rounded-md`,c=Ae(e||`md`);if(n)return t(`img`,{className:`inline-block ${c} ${s} ${a} ${o}`,src:n,alt:r||n,title:r});if(r){let[n,i]=r.split(` `),l=i?`${n[0]}${i[0]}`:`${n[0]}${n[1]}`;return t(`span`,{className:`inline-flex ${c} items-center justify-center ${s} ${a} ${o}`,title:r,children:t(`span`,{className:`${e===`xs`?`text-[0.6rem]`:`text-xs`} font-medium leading-none text-white`,children:l})})}return t(`span`,{className:`inline-block ${c} overflow-hidden ${s} ${a}`,children:t(`svg`,{className:`h-full w-full text-gray-300`,fill:`currentColor`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:t(`path`,{d:`M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z`})})})}function Me({size:e,shape:n=`circle`,color:r=`bg-gray-500`,className:i,children:a}){let o=n===`circle`?`rounded-full`:`rounded-md`;return t(`span`,{className:`inline-block ${Ae(e||`md`)} overflow-hidden ${o} ${r} ${i}`,children:a})}function Ne({className:e,children:n}){return t(`div`,{className:r(`flex items-center justify-center`,e),children:n})}function Pe(e){switch(e){case`top`:return`bottom`;case`bottom`:return`top`;case`left`:return`right`;case`right`:return`left`;case`ne`:return`sw`;case`nw`:return`se`;case`se`:return`nw`;case`sw`:return`ne`;default:return e}}function Fe(e){switch(e){case`start`:return`end`;case`end`:return`start`;default:return e}}var Ie=class{left;top;width;height;alignAxis;gap;constructor(e=0){this.gap=e}position(e,t,n){switch(e){case`top`:this.top=t.top-n.height-this.gap,this.alignAxis=`x`;break;case`bottom`:this.top=t.bottom+this.gap,this.alignAxis=`x`;break;case`left`:this.left=t.left-n.width-this.gap,this.alignAxis=`y`;break;case`right`:this.left=t.right+this.gap,this.alignAxis=`y`;break;case`ne`:this.top=t.top-n.height-this.gap,this.left=t.right+this.gap;break;case`nw`:this.top=t.top-n.height-this.gap,this.left=t.left-n.width-this.gap;break;case`se`:this.top=t.bottom+this.gap,this.left=t.right+this.gap;break;case`sw`:this.top=t.bottom+this.gap,this.left=t.left-n.width-this.gap;break}}align(e,t,n){if(this.alignAxis)switch(e){case`start`:this.alignAxis===`x`?this.left=t.left:this.top=t.top;break;case`end`:this.alignAxis===`x`?this.left=t.right-n.width:this.top=t.bottom-n.height;break;case`center`:this.alignAxis===`x`?this.left=t.left+t.width/2-n.width/2:this.top=t.top+t.height/2-n.height/2;break;case`fill`:this.alignAxis===`x`?(this.left=t.left,this.width=t.right-t.left):(this.top=t.top,this.height=t.bottom-t.top);break}}computePosition(e,t,n){if(this.position(e.position,n,t),e.align&&this.align(e.align,n,t),!this.left&&!this.top)throw Error(`Invalid position. Cannot compute x,y coordinates`);let r=this.width!=null,i=this.height!=null,a=this.width??t.width,o=this.height??t.height;return{rect:new DOMRect(this.left??0,this.top??0,a,o),constrainWidth:r,constrainHeight:i,position:e.position,align:e.align}}flipAxis(e,t){if(this.alignAxis===t){if(e.align){let t=Fe(e.align);if(t!==e.align)return{...e,align:t}}}else{let t=Pe(e.position);if(t!==e.position)return{...e,position:t}}return null}};function Le(e,t){return e.left>=t.left&&e.right<=t.right&&e.top>=t.top&&e.bottom<=t.bottom}function Re(e,t,n){return n===`x`?e.left>=t.left&&e.right<=t.right:e.top>=t.top&&e.bottom<=t.bottom}function ze(e,t,n,r){let i=new Ie(e.gap),a=i.computePosition(e,t,n),o=Re(a.rect,r,`x`),s=Re(a.rect,r,`y`);if(o&&s)return a;let c=null;return o||(c=i.flipAxis(e,`x`)),s||(c=i.flipAxis(c||e,`y`)),c?(a=new Ie(i.gap).computePosition(c,t,n),Le(a.rect,r)?a:null):null}function Be(e,t){let n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),i=Math.min(e.right,t.right),a=Math.min(e.bottom,t.bottom);return i<=n||a<=r?null:new DOMRect(n,r,i-n,a-r)}function Ve(e){if(e.length===0)return null;let t=e[0].getBoundingClientRect();for(let n=1,r=e.length;n<r;n++)if(t=Be(e[n].getBoundingClientRect(),t),!t)return null;return t}function He(e){let t=e.scrollHeight>e.clientHeight,n=e.scrollWidth>e.clientWidth;if(t||n){let r=getComputedStyle(e);if(t&&r.overflowY!==`visible`||n&&r.overflowX!==`visible`)return!0}return!1}function Ue(e,t=document.documentElement){let n=[],r=e.parentElement;for(;r&&r!==t;)He(r)&&n.push(r),r=r.parentElement;return n.push(t),n}var We=class{options;root;scrollableParents;visibleClientRect;context;constructor(e){this.options=e,this.root=e.root||document.documentElement,this.scrollableParents=Ue(this.anchor,this.root),this.visibleClientRect=Ve(this.scrollableParents)}get anchor(){return this.options.anchor}registerListeners(e){let t=this.scrollableParents,n=()=>{this.update()};window.addEventListener(`resize`,n);for(let e of t)e.addEventListener(`scroll`,n);let r;this.options.closeOnClick&&(r=t=>{e.contains(t.target)||this.tryClose()},window.setTimeout(()=>{r&&document.addEventListener(`click`,r)},0));let i;this.options.closeOnEsc&&(i=e=>{e.key===`Escape`&&this.tryClose()},window.setTimeout(()=>{i&&document.addEventListener(`keydown`,i)},0));let a=this.options.blockPageScroll;return a&&(document.body.style.overflow=`hidden`,document.body.style.height=`100%`),()=>{window.removeEventListener(`resize`,n);for(let e of t)e.removeEventListener(`scroll`,n);r&&document.removeEventListener(`click`,r),i&&document.removeEventListener(`keydown`,i),a&&(document.body.style.overflow=``,document.body.style.height=``)}}open(e,t){if(this.context)throw Error(`The popup controller is already bound to an element`);this.tryOpen(e,t)}tryOpen(e,t){this.context||(this.context={element:e,constraints:t,cleanup:this.registerListeners(e)},e.style.display=``,e.style.visibility=`hidden`,this.update(),this.options.onOpen?.(this))}close(){if(!this.context)throw Error(`The popup controller is not bound to an element`);this.tryClose()}tryClose(){this.context&&=(this.options.onClose?.(this),this.context.cleanup(),this.context.element.style.display=`none`,void 0)}get isOpen(){return!!this.context}update(){if(!this.context)return;let e=this.context.element,t=this.context.constraints,n=e.getBoundingClientRect(),r=this.anchor.getBoundingClientRect(),i=this.visibleClientRect;if(!i)return;let a=ze(t,n,r,i);this.context.position=a||void 0,a&&(a.constrainHeight&&(e.style.height=`${a.rect.height}px`),a.constrainWidth&&(e.style.width=`${a.rect.width}px`),e.style.left=`${a.rect.left}px`,e.style.top=`${a.rect.top}px`,e.style.visibility=`visible`)}createPopupElement(){let e=document.createElement(`div`);return e.style.margin=`0`,e.style.padding=`0`,e.style.border=`none`,e.style.background=`transparent`,e.className=`composable-Popup`,e}};const Ge=ae(void 0);function Ke(){let e=P(Ge);if(!e)throw Error(`usePopupController must be used inside a Popup component`);return e}function qe({ctrlRef:e,id:n,constraints:r,isOpen:i,children:a,className:o,onClose:s,onOpen:c,zIndex:l,position:u,anchor:d,root:f,closeOnClick:p,closeOnEsc:m,blockPageScroll:h}){let g=I(null),[_,v]=L(),y=I(s),b=I(c);return y.current=s,b.current=c,F(()=>{if(!d)throw Error(`Anchor element is required`);let e=new We({anchor:d,root:f,closeOnClick:p,closeOnEsc:m,blockPageScroll:h,onClose:()=>y.current?.(),onOpen:()=>b.current?.()});return v(e),()=>{e.tryClose()}},[d,h,p,m,f]),F(()=>{e&&(e.current=_)},[_,e]),F(()=>{_&&g.current?_.isOpen!==i&&(i?_.open(g.current,r):_.close()):_?.isOpen&&!i&&_.close()},[r,i,_]),t(Ge.Provider,{value:_,children:i&&fe(t(`div`,{id:n,style:{visibility:`hidden`,position:u||`absolute`,zIndex:l||100},ref:g,className:o,children:a}),document.body)})}function Je({anchor:e,root:n,children:r,...i}){let a=e.current;return a&&(!n||n.current)?t(qe,{anchor:a,root:n?.current||void 0,...i,children:r}):null}function Ye(){return`combobox-popup-${Math.floor(Math.random()*1e6)}`}var Xe=class{filter(e,t){let n=t.toLowerCase();return e.filter(e=>this.valueOf(e).toLowerCase().includes(n))}renderOption(e){return this.valueOf(e)}findById(e,t){return e.find(e=>this.idOf(e)===t)}createItem(e){return null}},Ze=class e extends Xe{valueOf(e){return String(e)}idOf(e){return String(e)}static instance=new e},Qe=class e extends Ze{createItem(e){return e}static instance=new e};function $e(e,t){return{buttonRight:4,buttonWidth:24,maxMenuHeight:240,menuClass:`w-72 mt-1 border-popover bg-popover text-popover-foreground shadow-md overflow-auto p-0 z-10`,inputClass:r(t?`block m-0 p-0 border-0 focus:outline-none focus:ring-0`:`block sm:text-sm sm:leading-6 bg-muted rounded-md border-0 shadow-sm ring-1 ring-inset ring-muted placeholder:text-muted focus:ring-2 focus:ring-inset focus:ring-primary py-1.5`,e?`w-full`:`!w-auto`),optionClass:`py-2 px-3 shadow-sm flex flex-col [&.option-selected]:font-semibold [&.option-highlighted]:bg-blue-300`,Input:tt,Menu:rt,Toggle:nt}}function et({menuAlign:r=`fill`,menuGap:i,focusOnMount:a,onSelect:o,value:s,zIndex:c,unstyledInput:l,fullWidth:u,api:d,layout:f,adapter:p,items:m,placeholder:h,clearable:g,noMatchMessage:_,openOnFocus:v}){let[y]=L(Ye()),b=I(void 0),x=I(null),S=f?Object.assign($e(u,l),f):$e(u,l),C=N.useRef(null),w=it({adapter:p,items:m,value:s,popupId:y});F(()=>{x.current&&a&&x.current.focus()},[a]),F(()=>{w.onSelect=o,w.popupCtrl=b.current},[w,o]),F(()=>{if(d&&w&&x.current)return d.current={open:()=>w.openMenu(),close:()=>w.closeMenu(),toggle:()=>w.toggleMenu(),setInputValue:e=>w.inputText=e,inputValue:w.inputText||``,selectedItem:w.selectedItem,focus:()=>x.current?.focus()},()=>{d.current=null}},[d,w]);let T=w.isMenuOpen&&(w.filteredItems.length>0||!!_);return n(e,{children:[t(S.Input,{boxRef:C,inputRef:x,ctrl:w,layout:S,placeholder:h,clearable:g,openOnFocus:v}),t(Je,{id:y,ctrlRef:b,className:`combobox-popup`,closeOnClick:!0,closeOnEsc:!0,onClose:()=>w.closeMenu(),isOpen:T,anchor:C,zIndex:c,constraints:{position:`bottom`,align:r,gap:i??4},children:t(S.Menu,{fillWidth:r===`fill`,items:w.filteredItems,ctrl:w,layout:S,adapter:p,noMatchMessage:_})})]})}function tt({inputRef:e,placeholder:r,boxRef:i,ctrl:a,layout:o,clearable:s,openOnFocus:c}){let l=o.Toggle,u=s&&a.selectedItem!=null,d=+!!l+ +!!u,f=d>0?{paddingRight:`${o.buttonWidth*d+o.buttonRight}px`}:void 0;return n(`div`,{className:`relative`,ref:i,children:[t(`input`,{ref:e,placeholder:r,...a.getInputProps(),onFocus:c?()=>a.openMenu():void 0,style:f,className:o.inputClass}),n(`div`,{style:{position:`absolute`,right:`${o.buttonRight}px`,top:0,bottom:0,display:`flex`,alignItems:`center`,gap:`2px`},children:[u&&t(`button`,{type:`button`,style:{border:`none`,padding:0,margin:0,backgroundColor:`transparent`,cursor:`pointer`,display:`flex`,alignItems:`center`,width:`${o.buttonWidth}px`},onClick:()=>{a.selectedItem=null},children:t(te,{className:`w-4 h-4`})}),l&&t(`button`,{type:`button`,style:{width:`${o.buttonWidth}px`,border:`none`,padding:0,margin:0,backgroundColor:`transparent`,display:`flex`,alignItems:`center`,justifyContent:`center`},...a.getToggleButtonProps(),children:t(l,{ctrl:a,layout:o})})]})]})}function nt({ctrl:e}){return e.isMenuOpen?t(p,{className:`w-4 h-4`}):t(l,{className:`w-4 h-4`})}function rt({fillWidth:e,items:n,layout:i,ctrl:a,adapter:o,noMatchMessage:s}){let{highlightedIndex:c,selectedItem:l}=a;return n.length===0?s?t(`div`,{style:{width:e?`100%`:void 0},className:i.menuClass,children:s}):null:t(`ul`,{style:{width:e?`100%`:void 0,maxHeight:i.maxMenuHeight?`${i.maxMenuHeight}px`:`240px`},className:i.menuClass,...a.getMenuProps(),children:n.map((e,n)=>t(`li`,{"data-index":n,className:r(i.optionClass,c===n&&`option-highlighted`,l===e&&`option-selected`),...a.getItemProps(e,n),children:o.renderOption(e)},o.idOf(e)))})}function it(e){let[t,n]=L(new at(e));return F(()=>{t?.withState(n)},[t]),t}var at=class e{popupId;items;adapter;onSelect;setState;_selectedItem=null;_filteredItems;_inputText=``;_highlightedIndex=null;_isMenuOpen=!1;popupCtrl;constructor({adapter:e,items:t,value:n,popupId:r}){this.adapter=e,this.items=t,this.popupId=r,typeof n==`string`?this._inputText=n:n&&(this._selectedItem=e.findById(t,e.idOf(n))||null,this._selectedItem&&(this._inputText=e.valueOf(n))),this._inputText?this._filteredItems=this.adapter.filter(this.items,this._inputText):this._filteredItems=this.items}withState(e){return this.setState=e,this}clone(){let t=new e({adapter:this.adapter,items:this.items,popupId:this.popupId});return t.setState=this.setState,t.onSelect=this.onSelect,t._inputText=this._inputText,t._highlightedIndex=this._highlightedIndex,t._selectedItem=this._selectedItem,t._isMenuOpen=this._isMenuOpen,t._filteredItems=this._filteredItems,t.popupCtrl=this.popupCtrl,t}updateState(){this.setState?.(this.clone())}get filteredItems(){return this._inputText?this.adapter.filter(this.items,this._inputText):this.items}get selectedItem(){return this._selectedItem}set selectedItem(e){this._selectedItem=e,this._inputText=e?this.adapter.valueOf(e):``,this._filteredItems=this._inputText?this.adapter.filter(this.items,this._inputText):this.items,this.updateState(),this.onSelect?.(e)}get isMenuOpen(){return this._isMenuOpen}set inputText(e){if(this._inputText=e,e?this._filteredItems=this.adapter.filter(this.items,e):this._filteredItems=this.items,this._highlightedIndex=null,this._selectedItem=null,this.updateState(),this.isMenuOpen&&this.popupCtrl){let e=this.popupCtrl,t=e.context?.position?.position;t&&t===`top`&&window.setTimeout(()=>{e.update()},100)}}get inputText(){return this._inputText}set highlightedIndex(e){this._highlightedIndex=e,this.updateState()}get highlightedIndex(){return this._highlightedIndex}openMenu(){this._filteredItems.length>0&&(this._isMenuOpen=!0,this.updateState())}closeMenu(e){this._isMenuOpen&&(this._highlightedIndex=null,this._isMenuOpen=!1,this.updateState())}toggleMenu(){this._isMenuOpen?this.closeMenu():this.openMenu()}highlightIndex(e,t=!1){this.highlightedIndex=e;let n=document.getElementById(this.popupId);n&&n.querySelector(`li[data-index="${e}"]`)?.scrollIntoView(t)}getMenuProps(){return{}}getToggleButtonProps(){return{onClick:()=>{this._isMenuOpen=!this._isMenuOpen,this.updateState()}}}getItemProps(e,t){return{"aria-selected":this._highlightedIndex===t,onClick:()=>{this.selectedItem=e,this.closeMenu()},onMouseEnter:()=>{this.highlightedIndex!==t&&(this.highlightedIndex=t)},onMouseLeave:()=>{this.highlightedIndex===t&&(this.highlightedIndex=null)}}}getInputProps(){let e=this._filteredItems;return{onClick:()=>{this.openMenu()},onChange:e=>{let t=e.target.value;this.inputText=t,this.openMenu()},value:this.inputText,onKeyDown:t=>{let n=t.key;if(n===`Enter`){if(this.highlightedIndex!=null)this.selectedItem=e[this.highlightedIndex||0];else if(this.inputText){let e=this.adapter.createItem(this.inputText);e&&(this.items.push(e),this.selectedItem=e)}this.closeMenu()}else n===`ArrowDown`?this.isMenuOpen?this.highlightIndex(this.highlightedIndex===null?0:ot(this.highlightedIndex,e.length),!1):this.openMenu():n===`ArrowUp`&&this.isMenuOpen&&this.highlightIndex(this.highlightedIndex===null?0:st(this.highlightedIndex,e.length),!0)}}}};function ot(e,t){return(e+1)%t}function st(e,t){return(e-1+t)%t}function ct({options:e,creatable:n,...r}){return t(et,{adapter:n?Qe.instance:Ze.instance,items:e,...r})}function lt({className:e}){return t(`hr`,{className:r(`w-full h-0.5 border-t-0 bg-border`,e)})}function q(...e){return ge(i(e))}const ut=N.createContext(void 0);function dt(e,t=`plugin-portal-container`){let n=e instanceof Document?e.body:e;for(let e of Array.from(n.children))if(e instanceof HTMLElement&&e.id===t)return e;let r=document.createElement(`div`);return r.id=t,n.appendChild(r),r}function ft({children:e,id:n=`plugin-portal-container`}){let r=N.useContext(ut),i=N.useRef(null),[a,o]=N.useState(r||void 0);return N.useEffect(()=>{if(r){o(r);return}if(i.current){let e=i.current.getRootNode();if(e instanceof ShadowRoot||e instanceof Document){let t=dt(e,n);o(t)}else o(null)}},[n,r]),a===void 0?t(`div`,{ref:i,style:{display:`none`}}):t(ut.Provider,{value:a||void 0,children:e})}function pt(){return N.useContext(ut)}const mt=B.Provider,ht=B.Root,gt=B.Trigger,_t=M.forwardRef(({className:e,sideOffset:n=4,side:r=`top`,...i},a)=>{let o=pt();return t(B.Portal,{container:o,children:t(B.Content,{ref:a,sideOffset:n,side:r,style:{zIndex:100},className:q(`max-w-[90vw]`,`z-50 overflow-hidden rounded-md bg-tooltips border border-border px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...i})})});_t.displayName=B.Content.displayName;function vt({description:e,children:r,size:i=`sm`,placement:a=`top`,className:o,asChild:s}){let[c,l]=M.useState(!1),u=M.useRef(!1);return M.useEffect(()=>{let e=()=>{l(!1),u.current=!0,requestAnimationFrame(()=>{u.current=!1})};return window.addEventListener(`blur`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`blur`,e),document.removeEventListener(`visibilitychange`,e)}},[]),t(mt,{delayDuration:0,children:n(ht,{open:c,onOpenChange:e=>{u.current||l(e)},children:[t(gt,{className:`cursor-pointer`,asChild:s,children:r}),t(_t,{side:a,className:`px-3 py-1.5 max-w-${i} text-${i} px-3 ${o}`,children:e})]})})}const yt=new Set;function bt(e,t,n){F(()=>{t&&!yt.has(e)&&(yt.add(e),console.warn(`[@vertesia/ui] ${e} is deprecated: ${n}`))},[t,n,e])}const xt=z(`hover:cursor-pointer inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-hidden 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:{destructive:`bg-destructive dark:bg-destructive/10 text-destructive ring-1 ring-inset ring-destructive-muted/50 dark:ring-destructive-muted/50 shadow-xs hover:bg-destructive/50`,outline:`border border-input bg-background shadow-xs hover:bg-muted ring-inset`,secondary:`bg-primary/5 dark:bg-primary/10 text-primary shadow-xs hover:bg-primary/10 dark:hover:bg-primary/20 ring-inset`,ghost:`hover:bg-muted/50 dark:hover:bg-muted/20 ring-inset`,link:`text-foreground underline-offset-4 hover:underline ring-inset`,primary:`bg-primary text-white shadow-xs hover:bg-primary/90 ring-inset`,unstyled:``},size:{xs:`h-7 rounded px-2 py-1 text-xs gap-x-1`,sm:`h-8 rounded px-3 text-xs`,md:`h-9 rounded-md px-4 py-2`,lg:`h-10 rounded-md px-3`,xl:`rounded-md px-3.5 py-2.5 text-sm gap-x-2`,icon:`p-0 m-0 rounded-full`,none:``}},defaultVariants:{variant:`primary`,size:`md`}}),J=M.forwardRef(({className:i,variant:a,size:o,asChild:s=!1,alt:c,isDisabled:l,isLoading:u,title:d,onClick:f,type:p,...m},h)=>{bt(`Button.alt`,c!==void 0,"use aria-label for the accessible name and wrap in <VTooltip> for a visual tooltip. `alt` is forwarded to both for one release.");let g=s?pe:`button`,_=s?p:p??`button`,v=m[`aria-label`]??c,y=s?m.children:n(e,{children:[u&&t(x,{className:`animate-spin`}),m.children]}),b=t(g,{className:r(q(xt({variant:a,size:o})),i),disabled:l||u||m.disabled,ref:h,onClick:f,type:_,autoFocus:!1,...m,"aria-label":v,children:y});return c||d?t(vt,{description:c||d,asChild:!0,className:`cursor-pointer`,size:`xs`,placement:`top`,children:b}):b});J.displayName=`Button`;const St=M.forwardRef(({size:e,content:n,toast:r,className:i,alt:a,"aria-label":s,...c},l)=>{let[u,d]=L(!1),{t:f}=R();bt(`CopyButton.alt`,a!==void 0,"use aria-label for the accessible name. `alt` is forwarded for one release.");let p=e=>{e.stopPropagation(),navigator.clipboard.writeText(n).then(()=>{d(!0),setTimeout(()=>d(!1),2e3),r?.toast&&r.toast({status:`success`,title:r.message||f(`misc.copiedToClipboard`),duration:2e3})}).catch(e=>{console.error(`Failed to copy text: `,e),r?.toast&&r.toast({status:`error`,title:f(`misc.failedToCopy`),duration:2e3})})},m=s??a??f(`misc.copy`);return t(J,{ref:l,className:q(i),variant:`unstyled`,size:e||`sm`,onClick:p,...c,"aria-label":m,title:m,children:u?t(o,{className:`text-success`}):t(v,{className:`size-4`})})});St.displayName=`CopyButton`;function Ct({buttonLabel:e,title:r,children:i,onClick:a}){return t(`div`,{className:`flex items-center justify-center h-full text-center`,children:n(`div`,{className:`py-12`,children:[t(`svg`,{className:`mx-auto size-12`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,"aria-hidden":`true`,children:t(`path`,{vectorEffect:`non-scaling-stroke`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M9 13h6m-3-3v6m-9 1V7a2 2 0 012-2h6l2 2h6a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2z`})}),t(`h3`,{className:`mt-2 text-sm font-semibold`,children:r}),t(`p`,{className:`mt-1 text-sm text-muted`,children:i}),t(`div`,{className:`mt-6`,children:n(J,{onClick:a,children:[t(E,{className:`-ms-0.5 me-1.5 size-5`,"aria-hidden":`true`}),e]})})]})})}function wt(e){return e.isFile}function Tt(e){return e.isDirectory}function Et(e){let t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}function Dt({children:e,onUpload:r}){let i=I(null);return n(`label`,{style:{cursor:`pointer`},children:[e,t(`input`,{ref:i,type:`file`,style:{display:`none`},onChange:()=>{i.current?.files&&r(Et(i.current.files))}})]})}function Ot({onUpload:e}){return t(`div`,{...Mt({onUpload:e}),className:`flex items-center justify-center w-full h-64 border-2 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-bray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600`,children:n(`label`,{htmlFor:`dropzone-file`,className:`flex flex-col items-center justify-center w-full h-full`,children:[n(`div`,{className:`flex flex-col items-center justify-center pt-5 pb-6`,children:[t(`svg`,{className:`w-8 h-8 mb-4 text-gray-500 dark:text-gray-400`,"aria-hidden":`true`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 20 16`,children:t(`path`,{stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2`})}),n(`p`,{className:`mb-2 text-sm text-gray-500 dark:text-gray-400`,children:[t(`span`,{className:`font-semibold`,children:`Click to upload`}),` or drag and drop`]}),t(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:`SVG, PNG, JPG or GIF (MAX. 800x400px)`})]}),t(`input`,{id:`dropzone-file`,type:`file`,className:`hidden`})]})})}function kt(e){if(!e)return!1;let t=e.__dragOver_cnt__||0;return e.__dragOver_cnt__=t+1,!t}function At(e){if(!e)return!1;let t=e.__dragOver_cnt__;return t?(e.__dragOver_cnt__=t-1,t===1):!1}function jt(e){e&&delete e.__dragOver_cnt__}function Mt({onUpload:e,dragOverClass:t=`is-drag-over-on`,dropEffect:n=`copy`}){let r=I(null);return{onDrop:n=>{n.preventDefault(),jt(r.current),r.current?.classList.remove(t);let i=n.dataTransfer.items;if(i){let t=[],n=(e,t=``)=>new Promise(r=>{if(wt(e))e.file(e=>{Object.defineProperty(e,"webkitRelativePath",{value:t+e.name}),r([e])});else if(Tt(e)){let i=e.createReader(),a=[],o=()=>{i.readEntries(i=>{if(!i.length)Promise.all(a).then(e=>r(e.flat()));else{for(let r of i)a.push(n(r,`${t+e.name}/`));o()}})};o()}});for(let e=0;e<i.length;e++){let r=i[e].webkitGetAsEntry();r&&t.push(n(r))}Promise.all(t).then(t=>{let n=t.flat();n.length&&e(n)})}},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=n},onDragEnter:()=>{kt(r.current)&&r.current?.classList.add(t)},onDragLeave:()=>{At(r.current)&&r.current?.classList.remove(t)},ref:r}}function Nt(...e){let t=e.filter(e=>typeof e==`string`&&e.length>0);return t.length>0?t.join(` `):void 0}function Pt(){try{return _e.isDev}catch{return!1}}function Ft({description:e,helpText:i,error:a,required:o,label:s,className:c,direction:l=`column`,children:u,disabled:d=!1,fullWidthLabel:f=!1,childrenId:p}){let m=le(),h=le(),g=le(),_=p??m,v=I(!1),b=ne.toArray(u).filter(se),x=b.length===1?b[0]:void 0,S=x?.type===re,C=!!x&&!S,w=!1,T=u;if(C&&x){let e=x,t=e.props??{},n=Nt(t[`aria-describedby`],i?h:void 0,a?g:void 0),r=t[`aria-invalid`]??(a?!0:void 0);T=ie(e,{id:t.id??_,"aria-describedby":n,"aria-invalid":r}),w=!0}else Pt()&&!v.current&&(i||a||p===void 0)&&(v.current=!0,console.warn("[@vertesia/ui] FormItem received zero, multiple, or a fragment as element children. ARIA wiring skipped. Pass `childrenId` and set `id` / `aria-describedby` / `aria-invalid` on your input manually, or wrap the input in a single non-fragment element."));let E=w||p?_:void 0;return n(`div`,{className:r(`flex w-full space-y-1`,c,l===`row`?`flex-row justify-between items-center gap-2`:l===`row-reverse`?`flex-row-reverse justify-between items-center gap-2`:`flex-col`),children:[n(`div`,{className:r(`flex items-center gap-1 mb-0`,f&&`w-full`),children:[n(`label`,{htmlFor:E,className:`text-sm font-medium mb-1 ${d?`text-muted`:``} ${f&&`flex-1`}`,children:[s,o?t(`span`,{className:`text-destructive -mt-4 ms-1`,children:`*`}):``]}),e&&t(`div`,{className:`mx-2 flex w-4 items-center`,children:t(vt,{description:e,children:t(y,{className:`size-3 text-muted`})})})]}),T,i&&t(`p`,{id:h,className:`text-xs text-muted`,children:i}),a&&t(`p`,{id:g,className:`text-xs text-destructive`,children:a})]})}function It(e){return t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e(t))}}const Lt=z(`inline-flex items-center rounded-md px-2 py-1 text-xs font-medium`,{variants:{variant:{default:`text-foreground bg-muted`,secondary:`bg-secondary text-primary`,destructive:`bg-destructive text-destructive`,attention:`bg-attention text-attention`,success:`bg-success text-success`,info:`bg-info text-info`,done:`bg-done text-done`,outline:`bg-transparent border border-border text-foreground`}},defaultVariants:{variant:`default`}});function Rt({className:e,variant:n,children:r,onClick:i,...a}){let o=i?{role:`button`,tabIndex:0,onClick:i,onKeyDown:It(i)}:{};return t(`span`,{className:q(Lt({variant:n}),e),...o,...a,children:r})}const zt=z(`inline-flex items-center gap-x-1.5 rounded-md px-2 py-1 text-xs font-medium ring-1 ring-inset ring-border`,{variants:{variant:{default:``,success:``,destructive:``,attention:``,done:``,info:``,outline:``}},defaultVariants:{variant:`default`}}),Bt=z(`h-1.5 w-1.5`,{variants:{variant:{default:`fill-foreground`,success:`fill-success`,destructive:`fill-destructive`,attention:`fill-attention`,done:`fill-done`,info:`fill-info`,outline:`fill-foreground`}},defaultVariants:{variant:`default`}});function Vt({variant:e,className:r,dotClassName:i,children:a,...o}){return n(`span`,{className:q(zt({variant:e}),r),...o,children:[t(`div`,{className:`flex-shrink-0`,children:t(`svg`,{className:q(Bt({variant:e}),i),viewBox:`0 0 6 6`,"aria-hidden":`true`,children:t(`circle`,{cx:3,cy:3,r:3})})}),t(`span`,{className:`truncate`,children:a})]})}function Ht({value:e=[],onChange:i,className:a,delimiters:o=`, `,placeholder:s,autoFocus:c,disabled:l=!1}){let[u,d]=L(``),f=t=>{if(l)return;let n=t.currentTarget.value;n?.trim()&&(i([...e,n.trim()]),d(``))},p=t=>{if(l)return;let n=t.currentTarget.value,r=!n.trim(),a=t.key;a===`Enter`||o.indexOf(a)>-1?(t.preventDefault(),e&&!r&&(i([...e,n.trim()]),d(``))):a===`Backspace`&&r&&e&&e.length>0&&(e.pop(),i([...e]))},m=t=>{if(l)return;let n=t.clipboardData.getData(`text`);if(n){t.preventDefault();let r=o.split(``).map(e=>e===` `?`\\s`:e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),a=RegExp(`[${r}]+`),s=n.split(a).map(e=>e.trim()).filter(e=>e.length>0);s.length>0&&i([...e,...s]),d(``)}},h=t=>{l||e&&e.length>0&&(e.splice(t,1),i([...e]))};return n(`div`,{className:r(a,`w-full flex flex-wrap items-center gap-1 p-2 py-1.5`,`rounded-md text-sm rounded-md border border-input bg-background ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,l&&`opacity-50 cursor-not-allowed`),children:[e&&e.length>0&&e.map((e,n)=>t(vt,{description:`click to remove`,children:t(Rt,{variant:`secondary`,onClick:()=>h(n),className:r(`flex-shrink-0 transition-colors`,l?`cursor-not-allowed`:`cursor-pointer hover:bg-destructive hover:text-destructive`),title:e,children:t(`span`,{className:`break-all`,children:e})})},`item-${n}`)),t(`input`,{className:`flex-1 min-w-[80px] m-0 p-0 px-1 border-0 bg-transparent text-sm placeholder:text-muted focus:outline-none focus:ring-0 disabled:cursor-not-allowed`,type:`text`,value:u,onBlur:f,onKeyDown:p,onPaste:m,onChange:e=>d(e.currentTarget.value),placeholder:!e||e.length===0?s:``,autoFocus:c,disabled:l})]})}function Ut({underline:e=`always`,className:n,children:i,...a}){let o;return e===`always`?o=`underline`:e===`hover`&&(o=`hover:underline`),t(`a`,{className:r(`text-indigo-800 dark:text-indigo-300`,n,o),...a,children:i})}function Wt({className:e,children:n}){return t(`ul`,{className:`${e} space-y-1 flex flex-col items-start`,children:n})}Wt.Item=oe(function(e,n){let{current:i,children:a,className:o,href:s=`#`,onClick:c,...l}=e;return t(`li`,{className:r(o,i?`bg-muted`:``,`w-full p-2 ps-3 text-sm leading-6 font-semibold hover:bg-muted`),children:t(`a`,{ref:n,href:s,onClick:e=>{c?(e.preventDefault(),c(e)):s===`#`&&e.preventDefault()},className:`w-full flex items-center gap-x-3`,...l,children:a})})});const Gt=`rounded-md text-sm flex w-full rounded-md border border-input bg-background ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,Kt={INPUT_UNSTYLED:`block m-0 p-0 w-full border-0 focus:outline-hidden focus:ring-0 bg-transparent`,INPUT_NO_PADDING:Gt,INPUT:`${Gt} py-1.5`};function qt(e){return e==null||Number.isNaN(e)?``:e.toString()}const Jt=N.forwardRef(({value:e,onChange:n,className:i,noScroll:a=!1,noSpinners:o=!1,...s},c)=>{let[l,u]=N.useState(qt(e));return F(()=>{if(e==null||!Number.isNaN(e)){let t=qt(e);u(t)}},[e]),t(`input`,{onWheel:a?e=>{e.currentTarget.blur()}:s.onWheel,type:`number`,value:l,onChange:e=>{let t=e.target.value;u(t),t===``?n?.(void 0,t):n?.(parseFloat(t),t)},className:r(i,Kt.INPUT,{"no-spinners":o},o&&`[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`),ref:c,...s})});function Yt({children:e,overlayContent:r,className:i=``,overlayClassName:a=``,position:o=`right`,width:s,height:c,showCloseButton:l=!0,onOpen:u,onClose:d,triggerClassName:f=``,backdropClassName:p=``,animationConfig:m={type:`spring`,stiffness:300,damping:30}}){let[h,g]=L(!1),_=()=>{g(!0),u?.()},v=()=>{g(!1),d?.()},y=Xt(o),b=Zt(o,s,c);return n(`div`,{className:`flex items-center justify-center w-full ${i}`,children:[t(J,{variant:`unstyled`,size:`none`,onClick:_,className:`w-full align-left cursor-pointer ${f}`,children:e}),h&&t(`div`,{className:`z-45 fixed inset-0 bg-black bg-opacity-50 ${p}`,children:n(ye.div,{...y,transition:m,className:`${b} ${a}`,children:[l&&t(`div`,{className:`absolute top-2 end-2 z-10`,children:t(J,{onClick:v,variant:`primary`,children:t(j,{})})}),t(`div`,{className:l?`mt-8`:``,children:r})]})})]})}function Xt(e){switch(e){case`left`:return{initial:{x:`-100%`},animate:{x:0},exit:{x:`-100%`}};case`right`:return{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`}};case`top`:return{initial:{y:`-100%`},animate:{y:0},exit:{y:`-100%`}};case`bottom`:return{initial:{y:`100%`},animate:{y:0},exit:{y:`100%`}};case`center`:return{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8}};default:return{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`}}}}function Zt(e,t,n){let r=`fixed bg-white shadow-lg p-4 relative`;switch(e){case`left`:return`${r} left-0 top-[var(--header-height)] h-full ${t||`w-80`}`;case`right`:return`${r} right-0 top-[var(--header-height)] h-full ${t||`w-80`}`;case`top`:return`${r} top-[var(--header-height)] start-0 end-0 ${n||`h-80`}`;case`bottom`:return`${r} bottom-0 start-0 end-0 ${n||`h-80`}`;case`center`:return`${r} top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 ${t||`w-96`} ${n||`max-h-96`}`;default:return`${r} right-0 top-[var(--header-height)] h-full ${t||`w-80`}`}}const Qt=`--tailwind-portal`;function $t({children:e}){let n=I(null),[r,i]=L(null);return F(()=>{if(n.current){let e=n.current.ownerDocument,t=e.getElementById(Qt);t||(t=e.createElement(`DIV`),t.id=Qt,e.body.appendChild(t)),i(t)}},[]),r?fe(e,r):t(`span`,{ref:n})}function en({path:e,maxItems:r=3,className:i,separator:a}){let o=e||[],s=e=>{let n=typeof e.label==`string`&&e.label.length>20?`${e.label.slice(0,17)}...`:e.label;return e.onClick?t(on,{onClick:e.onClick,href:e.href,title:typeof e.label==`string`?e.label:void 0,children:n}):e.href?t(on,{href:e.href,title:typeof e.label==`string`?e.label:void 0,children:n}):t(sn,{children:n})};if(o.length<=r)return t(tn,{className:q(`w-full flex items-center`,i),children:t(nn,{children:o.map((e,r)=>n(M.Fragment,{children:[t(rn,{children:s(e)}),r<o.length-1&&t(cn,{children:a??t(u,{className:`cn-rtl-flip`})})]},`crumb-${r}`))})});let c=o.slice(-(r-1));return t(tn,{className:q(`w-full flex items-center`,i),children:n(nn,{children:[t(rn,{children:t(ln,{})}),t(cn,{children:a??t(u,{className:`cn-rtl-flip`})}),c.map((e,r)=>n(M.Fragment,{children:[t(rn,{children:s(e)}),r<c.length-1&&t(cn,{children:a??t(u,{className:`cn-rtl-flip`})})]},`crumb-${r}`))]})})}const tn=M.forwardRef(({...e},n)=>t(`nav`,{ref:n,"aria-label":`breadcrumb`,...e}));tn.displayName=`Breadcrumb`;const nn=M.forwardRef(({className:e,...n},r)=>t(`ol`,{ref:r,className:q(`flex flex-wrap items-center gap-1.5 break-words text-sm text-muted sm:gap-2.5`,e),...n}));nn.displayName=`BreadcrumbList`;const rn=M.forwardRef(({className:e,...n},r)=>t(`li`,{ref:r,className:q(`inline-flex items-center gap-1.5 text-muted`,e),...n}));rn.displayName=`BreadcrumbItem`;const an=M.forwardRef(({asChild:e,className:n,...r},i)=>t(`a`,{ref:i,className:q(`transition-colors hover:text-muted`,n),...r}));an.displayName=`BreadcrumbLink`;const on=M.forwardRef(({className:e,href:n,onClick:r,...i},a)=>t(J,{variant:`ghost`,size:`md`,ref:a,className:q(`p-0! hover:underline! hover:bg-background!`,e),onClick:e=>{e.preventDefault(),r&&r(e)},...i}));on.displayName=`BreadcrumbButton`;const sn=M.forwardRef(({className:e,...n},r)=>t(`span`,{ref:r,"aria-current":`page`,className:q(`font-normal text-foreground`,e),...n}));sn.displayName=`BreadcrumbPage`;const cn=({children:e,className:n,...r})=>t(`li`,{role:`presentation`,"aria-hidden":`true`,className:q(`[&>svg]:w-3.5 [&>svg]:h-3.5`,n),...r,children:e??t(u,{className:`cn-rtl-flip`})});cn.displayName=`BreadcrumbSeparator`;const ln=({className:e,...r})=>n(`span`,{role:`presentation`,"aria-hidden":`true`,className:q(`flex h-9 w-9 items-center justify-center`,e),...r,children:[t(T,{className:`h-4 w-4`}),t(`span`,{className:`sr-only`,children:`More`})]});ln.displayName=`BreadcrumbEllipsis`;const un=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`rounded-xl border bg-card text-card-foreground shadow`,e),...n}));un.displayName=`Card`;const dn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`flex flex-col p-6`,e),...n}));dn.displayName=`CardHeader`;const fn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`font-semibold leading-none tracking-tight`,e),...n}));fn.displayName=`CardTitle`;const pn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`text-sm text-muted-foreground`,e),...n}));pn.displayName=`CardDescription`;const mn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`p-6 pt-0`,e),...n}));mn.displayName=`CardContent`;const hn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`flex items-center p-6 pt-0`,e),...n}));hn.displayName=`CardFooter`;const gn=M.forwardRef(({className:e,...n},r)=>t(be.Root,{ref:r,className:q(`peer size-4 shrink-0 rounded-sm border border-1 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-white`,e),...n,children:t(be.Indicator,{className:q(`flex items-center justify-center text-current`),children:t(o,{className:`size-4`})})}));gn.displayName=be.Root.displayName;function _n({...e}){return t(xe.Root,{"data-slot":`collapsible`,...e})}function vn({...e}){return t(xe.Trigger,{"data-slot":`collapsible-trigger`,...e})}function yn({...e}){return t(xe.Content,{"data-slot":`collapsible-content`,...e})}function bn({children:e}){return t(`span`,{style:{border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`,wordWrap:`normal`},children:e})}const xn=ae(!1);function Sn(){return!!P(xn)}function Cn({children:e}){return t(xn.Provider,{value:!0,children:e})}function wn({className:e,children:r,isOpen:i,onClose:a,description:o=`Modal Description`,noCloseButton:s=!1,allowOverflow:c=!1,disableCloseOnClickOutside:l=!1,size:u=`md`,action:d}){let f=e=>{e||a()};function p(){switch(u){case`sm`:return`max-w-[20vw]`;case`md`:return`max-w-[60vw] lg:max-w-[40vw]`;case`lg`:return`max-w-[80vw] md:max-w-[60vw]`;case`xl`:return`max-w-[95vw] lg:max-w-[80vw]`;default:return`max-w-[60vw] lg:max-w-[40vw]`}}return n(On,{open:i,onOpenChange:e=>{(!l||e)&&f(e)},children:[c&&t(Mn,{className:`z-50 fixed inset-0 bg-black/80`}),t(bn,{children:t(Pn,{children:o})}),n(Nn,{className:q(`min-h-20 p-4`,`fixed left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] border bg-background shadow-lg duration-200 sm:rounded-lg`,p(),e),children:[t(`div`,{className:`top-4 end-4 absolute`,children:n(`div`,{className:`flex gap-2`,children:[d&&d,!s&&t(jn,{onClick:()=>f(!1),asChild:!0,autoFocus:!1,children:t(J,{variant:`outline`,alt:`Close`,className:`data-[state=open]:bg-accent opacity-70 hover:opacity-100 rounded-sm focus:outline-none focus:ring-2 focus:ring-ring ring-offset-background focus:ring-offset-2 data-[state=open]:text-muted-foreground transition-opacity disabled:pointer-events-none`,children:t(j,{className:`size-4`})})})]})}),t(Cn,{children:r})]})]})}const Tn=({children:e,show:r=!0,className:i,description:a,showDivider:o=!1,...s})=>r?n(Fn,{className:q(o?`border-b-solid border-b border-b-1 pb-2 mb-4`:``,`text-lg font-semibold leading-6 tracking-tight`,{"py-2":!a},i),...s,children:[e,a&&t(Pn,{className:`text-sm !font-normal text-muted-foreground pb-2`,children:a})]}):n(bn,{children:[t(Fn,{children:e}),a&&t(Pn,{children:a})]}),En=({children:e,className:n,...r})=>t(`div`,{className:q(`text-sm max-h-[80vh] overflow-y-auto`,n),...r,children:e}),Dn=({align:e=`right`,children:n,className:r,...i})=>t(`div`,{className:q(`w-full flex py-3 sm:py-2 sm:flex sm:flex-row-reverse sm:flex-row sm:justify-end gap-2`,{left:`justify-start`,center:`justify-center`,right:`justify-end`}[e],r),...i,children:n}),On=H.Root,kn=H.Trigger,An=H.Portal,jn=H.Close,Mn=M.forwardRef(({className:e,...n},r)=>t(H.Overlay,{ref:r,className:q(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...n}));Mn.displayName=H.Overlay.displayName;const Nn=M.forwardRef(({className:e,children:r,...i},a)=>{let o=pt();return n(An,{container:o,children:[t(Mn,{}),t(H.Content,{ref:a,autoFocus:!1,onOpenAutoFocus:e=>{e.preventDefault()},className:q(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] border bg-background shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...i,children:r})]})});Nn.displayName=H.Content.displayName;const Pn=M.forwardRef(({className:e,...n},r)=>t(H.Description,{ref:r,className:q(`text-sm text-muted`,e),...n}));Pn.displayName=H.Description.displayName;const Fn=M.forwardRef(({className:e,...n},r)=>t(H.Title,{ref:r,className:q(`text-lg font-semibold leading-none tracking-tight`,e),...n}));Fn.displayName=H.Title.displayName;const In=M.forwardRef(({className:e,...n},r)=>t(V,{ref:r,className:q(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...n}));In.displayName=V.displayName;const Ln=({children:e,...n})=>t(On,{...n,children:t(Nn,{className:`shadow-lg p-0 overflow-hidden`,children:t(In,{className:`[&_[cmdk-group]]:px-2 [&_[cmdk-item]]:px-2 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-item]_svg]:w-5 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,children:e})})}),Rn=M.forwardRef(({className:e,...r},i)=>n(`div`,{className:`flex items-center px-3 border-b`,"cmdk-input-wrapper":``,children:[t(D,{className:`opacity-50 size-4 shrink-0`}),t(V.Input,{ref:i,className:q(`focus:ring-0`,`border-0 flex h-8 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...r})]}));Rn.displayName=V.Input.displayName;const zn=M.forwardRef(({className:e,...n},r)=>t(V.List,{ref:r,className:q(`overflow-y-auto overflow-x-hidden`,e),...n}));zn.displayName=V.List.displayName;const Bn=M.forwardRef((e,n)=>t(V.Empty,{ref:n,className:`py-2 text-sm text-center`,...e}));Bn.displayName=V.Empty.displayName;const Y=M.forwardRef(({className:e,...n},r)=>t(V.Group,{ref:r,className:q(`overflow-y-auto overflow-x-hidden p-1 text-foreground`,`[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...n}));Y.displayName=V.Group.displayName;const Vn=M.forwardRef(({className:e,...n},r)=>t(V.Separator,{ref:r,className:q(`-mx-1 h-px bg-border`,e),...n}));Vn.displayName=V.Separator.displayName;const X=M.forwardRef(({className:e,...n},r)=>t(V.Item,{ref:r,className:q(`hover:bg-muted cursor-pointer relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,e),...n}));X.displayName=V.Item.displayName;const Hn=({className:e,...n})=>t(`span`,{className:q(`ms-auto text-xs tracking-widest text-muted-foreground`,e),...n});Hn.displayName=`CommandShortcut`;const Un=M.createContext(!1);function Wn({...e}){return t(U.Root,{"data-slot":`dropdown-menu`,...e})}function Gn({...e}){return t(U.Portal,{"data-slot":`dropdown-menu-portal`,...e})}function Kn({...e}){return t(U.Trigger,{"data-slot":`dropdown-menu-trigger`,...e})}function qn({className:e,align:n=`start`,sideOffset:r=4,...i}){return t(U.Portal,{children:t(U.Content,{"data-slot":`dropdown-menu-content`,sideOffset:r,align:n,className:q(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-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 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto data-[state=closed]:overflow-hidden`,e),...i})})}function Jn({...e}){return t(U.Group,{"data-slot":`dropdown-menu-group`,...e})}function Yn({className:e,inset:n,variant:r=`default`,...i}){return t(U.Item,{"data-slot":`dropdown-menu-item`,"data-inset":n,"data-variant":r,className:q(`hover:bg-muted focus:bg-muted data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive gap-2 rounded-md px-1.5 py-1 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...i})}function Xn({className:e,children:r,checked:i,inset:a,...o}){return n(U.CheckboxItem,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":a,className:q(`focus:bg-muted focus:text-muted focus:**:text-muted gap-2 rounded-md py-1 pe-8 ps-1.5 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),checked:i,...o,children:[t(`span`,{className:`absolute end-2 flex items-center justify-center pointer-events-none`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:t(U.ItemIndicator,{children:t(s,{})})}),r]})}function Zn({...e}){return t(U.RadioGroup,{"data-slot":`dropdown-menu-radio-group`,...e})}function Qn({className:e,children:r,inset:i,...a}){return n(U.RadioItem,{"data-slot":`dropdown-menu-radio-item`,"data-inset":i,className:q(`focus:bg-muted focus:text-muted focus:**:text-muted gap-2 rounded-md py-1 pe-8 ps-1.5 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...a,children:[t(`span`,{className:`absolute end-2 flex items-center justify-center pointer-events-none`,"data-slot":`dropdown-menu-radio-item-indicator`,children:t(U.ItemIndicator,{children:t(s,{})})}),r]})}function $n({className:e,inset:n,...r}){return t(U.Label,{"data-slot":`dropdown-menu-label`,"data-inset":n,className:q(`text-muted px-1.5 py-1 text-xs font-medium data-inset:ps-7`,e),...r})}function er({className:e,...n}){return t(U.Separator,{"data-slot":`dropdown-menu-separator`,className:q(`bg-border -mx-1 my-1 h-px`,e),...n})}function tr({className:e,...n}){return t(`span`,{"data-slot":`dropdown-menu-shortcut`,className:q(`text-muted group-focus/dropdown-menu-item:text-muted ms-auto text-xs tracking-widest`,e),...n})}function nr({...e}){return t(U.Sub,{"data-slot":`dropdown-menu-sub`,...e})}function rr({className:e,inset:r,children:i,...a}){return n(U.SubTrigger,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":r,className:q(`focus:bg-muted focus:text-muted data-open:bg-muted data-open:text-muted not-data-[variant=destructive]:focus:**:text-muted gap-2 rounded-md px-1.5 py-1 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 flex cursor-default items-center outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...a,children:[i,t(d,{className:`cn-rtl-flip ms-auto`})]})}function ir({className:e,...n}){return t(U.SubContent,{"data-slot":`dropdown-menu-sub-content`,className:q(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-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 ring-foreground/10 bg-popover text-popover-foreground min-w-[96px] rounded-lg p-1 shadow-lg ring-1 duration-100 z-50 origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden`,e),...n})}const ar={left:`start`,center:`center`,right:`end`};function or({trigger:e,children:r,align:i=`right`,hover:a}){let[o,s]=M.useState(!1),c=M.useRef(null);return a?n(`div`,{className:`relative inline-flex`,onMouseEnter:()=>{c.current&&clearTimeout(c.current),s(!0)},onMouseLeave:()=>{c.current=setTimeout(()=>s(!1),80)},children:[e,o&&t(`div`,{className:q(`absolute top-full pt-1 z-50`,i===`right`?`end-0`:i===`center`?`left-1/2 -translate-x-1/2`:`start-0`),children:t(`div`,{className:`min-w-32 rounded-lg p-1 shadow-md ring-1 ring-foreground/10 bg-popover text-popover-foreground`,children:t(Un.Provider,{value:!0,children:r})})})]}):n(Wn,{children:[t(Kn,{asChild:!0,children:t(`span`,{className:`-m-1.5 flex items-center p-1.5`,children:e})}),t(qn,{align:ar[i],className:`w-max`,children:r})]})}function sr({children:e,label:r}){return n(Jn,{children:[r&&t($n,{children:r}),e]})}function cr({children:e,href:n,onClick:r,isDisabled:i=!1,variant:a=`default`,className:o}){let s=M.useContext(Un),c=q(`w-full gap-2 rounded-md px-1.5 py-1 text-sm text-nowrap [&_svg:not([class*='size-'])]:size-4 flex cursor-default items-center select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,a===`destructive`?`text-destructive`:``,i?`pointer-events-none opacity-50`:`hover:bg-muted focus:bg-muted`,o);return s?n?t(`a`,{href:n,className:c,children:e}):t(`button`,{type:`button`,className:c,disabled:i,onClick:e=>{e.stopPropagation(),r?.(e)},children:e}):t(Yn,{className:q(`data-[disabled]:pointer-events-none data-[disabled]:opacity-50 text-nowrap`,o),disabled:i,variant:a,onClick:e=>{e.stopPropagation(),r?.(e)},asChild:!!n,children:n?t(`a`,{href:n,children:e}):e})}const lr=({children:e,className:n})=>{let r=I(null),[i,a]=L(`auto`);return F(()=>{if(r.current){let e=new ResizeObserver(e=>{let t=e[0].contentRect.height;a(t)});return e.observe(r.current),()=>{e.disconnect()}}},[]),t(`div`,{className:q(n,`overflow-hidden transition-all duration-100 ease-in`),style:{height:i},children:t(`div`,{ref:r,children:e})})},ur=M.createContext(null),Z=({hover:e=!1,click:n=!1,modal:r,children:i,_open:a,onOpenChange:o})=>{let[s,c]=M.useState(a||!1);return t(ur.Provider,{value:{open:s,setOpen:c,hover:e,click:n},children:t(G.Root,{open:s,onOpenChange:e=>{c(e),o&&o(e)},modal:r,children:i})})};function dr(e=!1,t=()=>{},n){e&&t(n===`enter`)}const Q=M.forwardRef(({children:e,...n},r)=>{let i=M.useContext(ur);if(!i)throw Error(`PopoverTrigger must be used within a Popover`);let{setOpen:a,hover:o,click:s}=i;return t(G.Trigger,{ref:r,asChild:!0,onMouseEnter:()=>dr(o,a,`enter`),onMouseLeave:()=>dr(o,a,`leave`),onClick:()=>{s&&a(e=>!e)},...n,children:e})});Q.displayName=G.Trigger.displayName;const fr=G.Anchor,$=M.forwardRef(({className:e,align:n=`center`,side:r=`bottom`,...i},a)=>{let o=M.useContext(ur);if(!o)throw Error(`PopoverContent must be used within a Popover`);let{setOpen:s,hover:c}=o,l=pt();return t(G.Portal,{container:l,children:t(G.Content,{ref:a,align:n,side:r,onMouseEnter:()=>dr(c,s,`enter`),onMouseLeave:()=>dr(c,s,`leave`),className:q(`z-50 w-72 rounded-md border-popover bg-popover text-popover-foreground ring-1 ring-gray-200 dark:ring-slate-700 shadow-md focus:outline-none animate-in`,`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...i})})});$.displayName=G.Content.displayName;const pr=G.Close;pr.displayName=G.Close.displayName;function mr(){let e=M.useContext(ur);if(!e)throw Error(`usePopoverContext must be used within a Popover`);return{...e,close:()=>e.setOpen(!1)}}const hr=`
|
|
2
2
|
.calendar-wrapper .react-calendar__navigation {
|
|
3
3
|
display: flex !important;
|
|
4
4
|
justify-content: space-between !important;
|
|
@@ -84,9 +84,9 @@ import{Fragment as e,jsx as t,jsxs as n}from"react/jsx-runtime";import r,{clsx a
|
|
|
84
84
|
text-align: center !important;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
`,gr=({filterValues:r,setFilterValues:i,isRange:a=!1})=>{let[o,s]=L(!1),[c,l]=L([null,null]),{t:u}=R(),d=r[0]?W(r[0]).toDate():void 0,f=a?[c[0]||(r[0]?W(r[0]).toDate():null),c[1]||(r[1]?W(r[1]).toDate():null)]:[null,null];F(()=>{a&&l([r[0]?W(r[0]).toDate():null,r[1]?W(r[1]).toDate():null])},[r,a]);let p=()=>a?f[0]&&f[1]?n(`span`,{className:`flex items-center gap-1.5`,children:[t(`span`,{className:`font-medium`,children:W(f[0]).format(`MMMM DD, YYYY`)}),t(`span`,{className:`text-xs text-muted-foreground`,children:`-`}),t(`span`,{className:`font-medium`,children:W(f[1]).format(`MMMM DD, YYYY`)})]}):f[0]?n(`span`,{className:`flex items-center gap-1.5`,children:[t(`span`,{className:`font-medium`,children:W(f[0]).format(`MMMM DD, YYYY`)}),t(`span`,{className:`text-xs text-muted-foreground`,children:`- Select end`})]}):t(`span`,{className:`text-muted-foreground`,children:u(`filter.selectRange`)}):d?W(d).format(`MMMM DD, YYYY`):`Pick a date`,m=e=>{if(a)Array.isArray(e)&&(l([e[0],e[1]]),e[0]&&e[1]?i([W(e[0]).format(`YYYY-MM-DD`),W(e[1]).format(`YYYY-MM-DD`)]):e[0]&&i([W(e[0]).format(`YYYY-MM-DD`)]));else if(e){let t=Array.isArray(e)?e[0]:e;t&&(i([W(t).format(`YYYY-MM-DD`)]),s(!1))}};return n(Z,{_open:o,onOpenChange:s,children:[t(Q,{className:`rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition`,children:t(`div`,{className:`flex gap-1.5 items-center min-h-[20px]`,children:p()})}),t($,{className:`w-auto p-0`,align:`start`,side:`bottom`,alignOffset:-4,sideOffset:6,children:t(`div`,{className:`p-2`,children:a?n(e,{children:[n(`div`,{className:`calendar-wrapper`,children:[t(`style`,{children:hr}),t(Se,{value:f,onChange:m,selectRange:!0,returnValue:`range`,maxDate:(()=>{let e=new Date;return e.setHours(23,59,59,999),e})(),className:`mb-2 border-0`,tileClassName:({date:e,view:t})=>{if(t===`month`){let t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return`text-muted/20 cursor-not-allowed`;if(f[0]){let e=f[0].getTime();if(f[1]){let n=f[1].getTime();if(t===e)return`bg-primary text-primary-foreground rounded-s-md font-semibold`;if(t===n)return`bg-primary text-primary-foreground rounded-e-md font-semibold`;if(t>e&&t<n)return`bg-primary/20 text-primary font-medium`}else if(t===e)return`bg-primary text-primary-foreground rounded-md font-semibold`}}return``}})]}),f[0]&&f[1]&&t(`div`,{className:`border-t pt-2`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:()=>s(!1),children:`Cancel`}),t(J,{size:`sm`,onClick:()=>s(!1),children:`Apply`})]})})]}):n(`div`,{className:`calendar-wrapper`,children:[t(`style`,{children:hr}),t(Se,{value:d,onChange:m,selectRange:!1,maxDate:(()=>{let e=new Date;return e.setHours(23,59,59,999),e})(),className:`mb-2 border-0`,tileClassName:({date:e,view:t})=>{if(t===`month`){let t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return`text-muted/20 cursor-not-allowed`;if(d&&t===d.getTime())return`bg-primary text-primary-foreground rounded-md font-semibold`}return``}})]})})})]})};function _r({value:n,labelRenderer:r,fallbackLabel:i}){let[a,o]=L(i||n),[s,c]=L(!1);return F(()=>{if(!r){o(i||n);return}(async()=>{c(!0);try{let e=r(n);e instanceof Promise
|
|
87
|
+
`,gr=({filterValues:r,setFilterValues:i,isRange:a=!1})=>{let[o,s]=L(!1),[c,l]=L([null,null]),{t:u}=R(),d=r[0]?W(r[0]).toDate():void 0,f=a?[c[0]||(r[0]?W(r[0]).toDate():null),c[1]||(r[1]?W(r[1]).toDate():null)]:[null,null];F(()=>{a&&l([r[0]?W(r[0]).toDate():null,r[1]?W(r[1]).toDate():null])},[r,a]);let p=()=>a?f[0]&&f[1]?n(`span`,{className:`flex items-center gap-1.5`,children:[t(`span`,{className:`font-medium`,children:W(f[0]).format(`MMMM DD, YYYY`)}),t(`span`,{className:`text-xs text-muted-foreground`,children:`-`}),t(`span`,{className:`font-medium`,children:W(f[1]).format(`MMMM DD, YYYY`)})]}):f[0]?n(`span`,{className:`flex items-center gap-1.5`,children:[t(`span`,{className:`font-medium`,children:W(f[0]).format(`MMMM DD, YYYY`)}),t(`span`,{className:`text-xs text-muted-foreground`,children:`- Select end`})]}):t(`span`,{className:`text-muted-foreground`,children:u(`filter.selectRange`)}):d?W(d).format(`MMMM DD, YYYY`):`Pick a date`,m=e=>{if(a)Array.isArray(e)&&(l([e[0],e[1]]),e[0]&&e[1]?i([W(e[0]).format(`YYYY-MM-DD`),W(e[1]).format(`YYYY-MM-DD`)]):e[0]&&i([W(e[0]).format(`YYYY-MM-DD`)]));else if(e){let t=Array.isArray(e)?e[0]:e;t&&(i([W(t).format(`YYYY-MM-DD`)]),s(!1))}};return n(Z,{_open:o,onOpenChange:s,children:[t(Q,{className:`rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition`,children:t(`div`,{className:`flex gap-1.5 items-center min-h-[20px]`,children:p()})}),t($,{className:`w-auto p-0`,align:`start`,side:`bottom`,alignOffset:-4,sideOffset:6,children:t(`div`,{className:`p-2`,children:a?n(e,{children:[n(`div`,{className:`calendar-wrapper`,children:[t(`style`,{children:hr}),t(Se,{value:f,onChange:m,selectRange:!0,returnValue:`range`,maxDate:(()=>{let e=new Date;return e.setHours(23,59,59,999),e})(),className:`mb-2 border-0`,tileClassName:({date:e,view:t})=>{if(t===`month`){let t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return`text-muted/20 cursor-not-allowed`;if(f[0]){let e=f[0].getTime();if(f[1]){let n=f[1].getTime();if(t===e)return`bg-primary text-primary-foreground rounded-s-md font-semibold`;if(t===n)return`bg-primary text-primary-foreground rounded-e-md font-semibold`;if(t>e&&t<n)return`bg-primary/20 text-primary font-medium`}else if(t===e)return`bg-primary text-primary-foreground rounded-md font-semibold`}}return``}})]}),f[0]&&f[1]&&t(`div`,{className:`border-t pt-2`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:()=>s(!1),children:`Cancel`}),t(J,{size:`sm`,onClick:()=>s(!1),children:`Apply`})]})})]}):n(`div`,{className:`calendar-wrapper`,children:[t(`style`,{children:hr}),t(Se,{value:d,onChange:m,selectRange:!1,maxDate:(()=>{let e=new Date;return e.setHours(23,59,59,999),e})(),className:`mb-2 border-0`,tileClassName:({date:e,view:t})=>{if(t===`month`){let t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return`text-muted/20 cursor-not-allowed`;if(d&&t===d.getTime())return`bg-primary text-primary-foreground rounded-md font-semibold`}return``}})]})})})]})};function _r({value:n,labelRenderer:r,fallbackLabel:i}){let[a,o]=L(i||n),[s,c]=L(!1);return F(()=>{if(!r){o(i||n);return}(async()=>{c(!0);try{let e=r(n);if(e instanceof Promise){let t=await e;o(t)}else o(e)}catch(e){console.error(`Error rendering label:`,e),o(i||n)}finally{c(!1)}})()},[n,r,i]),s?t(`span`,{className:`text-muted-foreground`,children:`Loading...`}):t(e,{children:a})}const vr=({filterType:r,filterValues:i,setFilterValues:a,options:o,labelRenderer:s,multiple:c=!0})=>{let[l,u]=L(!1),[d,f]=L(``),p=I(null),{t:m}=R(),h=o?.filter(e=>!i.some(t=>t.value===e.value));return n(Z,{_open:l,onOpenChange:e=>{u(e),e||setTimeout(()=>{f(``)},200)},children:[t(Q,{className:`rounded-none p-1 h-8 bg-muted hover:bg-muted/50 transition text-muted hover:text-primary shrink-0`,children:t(`div`,{className:`flex gap-1.5 items-center`,children:i?.length===1?(()=>{let e=i[0];return t(_r,{value:e.value||``,labelRenderer:s,fallbackLabel:e.label})})():`${i?.length} selected`})}),t($,{className:`w-[300px] p-0`,children:t(lr,{children:n(In,{children:[t(Rn,{placeholder:r,className:`h-9`,value:d,onInputCapture:e=>{f(e.currentTarget.value)},ref:p}),n(zn,{children:[t(Bn,{children:m(`filter.noResultsFound`)}),t(Y,{children:i.map(e=>n(X,{className:`group flex gap-2 items-center`,onSelect:()=>{a(i.filter(t=>t.value!==e.value)),setTimeout(()=>{f(``)},200),u(!1)},children:[c&&t(`input`,{type:`checkbox`,checked:!0,onChange:()=>{}}),t(_r,{value:e.value||``,labelRenderer:s,fallbackLabel:e.label})]},e.value))}),h?.length>0&&n(e,{children:[t(Vn,{}),t(Y,{children:h.filter(e=>String(e.label||e.value).toLowerCase().includes(d.toLowerCase())).map(e=>n(X,{className:`group flex gap-2 items-center`,value:String(e.label||e.value),onSelect:()=>{let t={value:e.value,label:e.label};a(c?[...i,t]:[t]),setTimeout(()=>{f(``)},200),u(!1)},children:[c&&t(gn,{checked:!1,className:`opacity-0 group-data-[selected=true]:opacity-100`}),t(`span`,{className:`text-muted`,children:t(_r,{value:e.value||``,labelRenderer:e.labelRenderer||s,fallbackLabel:e.label})})]},e.value))})]})]})]})})})]})},yr=({filterType:e,filterValues:r,setFilterValues:i})=>{let[a,o]=L(!1),[s,c]=L(r);return n(Z,{_open:a,onOpenChange:e=>{o(e),!e&&JSON.stringify(s)!==JSON.stringify(r)&&c(r)},children:[t(Q,{className:`rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition`,children:t(`div`,{className:`flex gap-1.5 items-center`,children:r.length>0?r.length===1?r[0]:`${r.length} tags`:`Add tags...`})}),t($,{className:`w-[300px] p-3`,children:n(`div`,{className:`flex flex-col gap-3`,children:[t(`div`,{className:`flex items-center p-1.5 text-xs text-muted`,children:t(`span`,{children:e})}),t(Ht,{value:s,onChange:c,placeholder:`Add ${e.toLowerCase()}...`}),n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{size:`sm`,variant:`ghost`,onClick:()=>{c(r),o(!1)},children:`Cancel`}),t(J,{size:`sm`,onClick:()=>{i(s),o(!1)},children:`Apply`})]})]})})]})},br=z(``,{variants:{size:{xs:`rounded py-1 text-xs rounded-xs`,sm:`rounded text-xs rounded-sm`,md:`rounded-md py-2 text-sm`,lg:`rounded-md text-base`,xl:`rounded-md py-2.5 text-lg`},variant:{default:`flex w-full rounded-md border border-input bg-background ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,unstyled:`block m-0 p-0 w-full border-0 focus:outline-hidden focus:ring-0 bg-transparent`,noPadding:`block rounded-md border-0 bg-background shadow-2xs ring-1 ring-inset ring-ring placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-ring ring-offset-background`,legacy:`py-1.5 block rounded-md border-0 bg-background shadow-2xs ring-1 ring-inset ring-ring placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-ring ring-offset-background`}},defaultVariants:{size:`md`,variant:`default`}}),xr=M.forwardRef(({className:e,type:r,size:i=`md`,variant:a=`default`,clearable:o=!0,onChange:s,value:c,invalid:l,...u},d)=>{let f=()=>{s?.(``)},p=e=>{s?.(e.target.value)},m=u[`aria-invalid`]??(l?!0:void 0);return n(`div`,{className:`w-full relative inline-block [&:hover_.clear-button]:opacity-100`,children:[t(`input`,{type:r,className:q(br({size:i,variant:a}),e,o&&c?`pe-8`:``),ref:d,value:c??``,onChange:p,...u,"aria-invalid":m}),o&&c&&!u.readOnly&&!u.disabled&&t(J,{variant:`link`,size:`icon`,type:`button`,onClick:f,className:`clear-button opacity-0 transition-opacity duration-200
|
|
88
88
|
absolute top-1/2 -translate-y-1/2 text-muted !hover:text-destructive cursor-pointer
|
|
89
|
-
flex items-center justify-center size-6 rounded end-2`,"aria-label":`Clear input`,children:t(j,{size:16})})]})});xr.displayName=`Input`;const Sr=({filterType:e,filterValue:r,setFilterValue:i})=>{let[a,o]=L(!1),[s,c]=L(r);return n(Z,{_open:a,onOpenChange:e=>{o(e),!e&&s!==r&&c(r)},children:[t(Q,{className:`rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition`,children:t(`div`,{className:`flex gap-1.5 items-center`,children:r||`Enter text...`})}),t($,{className:`w-[300px] p-3`,children:n(`div`,{className:`flex flex-col gap-1`,children:[t(`div`,{className:`flex items-center p-1.5 text-xs text-muted`,children:t(`span`,{children:e})}),t(xr,{autoFocus:!0,type:`text`,size:`sm`,value:s,onChange:c,onKeyDown:e=>{e.key===`Enter`&&(i(s),o(!1))},placeholder:`Enter text...`}),t(`div`,{className:`mt-2 p-2 border-t`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:()=>{c(r),o(!1)},children:`Cancel`}),t(J,{size:`sm`,onClick:()=>{i(s),o(!1)},children:`Apply`})]})})]})})]})};function Cr({selectedView:r,selectedDate:i,setSelectedDate:a,setFilters:o,filters:s,handleClose:c,filterGroups:l}){let{t:u}=R(),[d,f]=L([null,null]),[p,m]=L([null,null]),h=l.find(e=>e.name===r),g=h?.multiple,_=new Date;_.setHours(23,59,59,999);let v=[p[0]||d[0],p[1]||d[1]],y=e=>{if(g)Array.isArray(e)?(m([e[0],e[1]]),f([e[0],e[1]])):(m([e,null]),f([e,null]));else{let t=Array.isArray(e)?e[0]:e;if(a(t||void 0),t){let e=new Date(t);e.setHours(0,0,0,0),o([...s,{name:r||``,placeholder:h?.placeholder,value:[{value:e.toISOString(),label:W(e).format(`LLL dd, y`)}],type:h?.type||`date`,multiple:h?.multiple||!1}]),c()}}};return t(`div`,{className:`p-2`,children:g?n(e,{children:[t(`div`,{children:g?v[0]&&v[1]?n(`span`,{className:`flex items-center gap-2`,children:[t(`span`,{className:`text-xs text-muted`,children:u(`filter.from`)}),t(`span`,{className:`text-xs font-medium`,children:W(v[0]).format(`MMMM DD, YYYY`)}),t(`span`,{className:`text-xs text-muted`,children:u(`filter.to`)}),t(`span`,{className:`text-xs font-medium`,children:W(v[1]).format(`MMMM DD, YYYY`)})]}):v[0]?n(`span`,{className:`flex items-center gap-2`,children:[t(`span`,{className:`text-xs text-muted`,children:u(`filter.from`)}),t(`span`,{className:`text-xs font-medium`,children:W(v[0]).format(`MMMM DD, YYYY`)}),t(`span`,{className:`text-xs text-muted`,children:`→ Select end date`})]}):t(`span`,{className:`text-muted text-xs`,children:h?.placeholder||h?.name||r||`Select date range`}):i?W(i).format(`MMMM DD, YYYY`):`Pick a date`}),n(`div`,{className:`calendar-wrapper`,children:[t(`style`,{children:hr}),t(Se,{value:v,onChange:y,selectRange:!0,returnValue:`range`,maxDate:_,className:`mb-2 border-0`,tileClassName:({date:e,view:t})=>{if(t===`month`){let t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return`text-muted/20 cursor-not-allowed`;if(v[0]){let e=v[0].getTime();if(v[1]){let n=v[1].getTime();if(t===e)return`bg-primary text-primary-foreground rounded-s-md font-semibold`;if(t===n)return`bg-primary text-primary-foreground rounded-e-md font-semibold`;if(t>e&&t<n)return`bg-primary/20 text-primary font-medium`}else if(t===e)return`bg-primary text-primary-foreground rounded-md font-semibold`}}return``}},`${v[0]?.getTime()}-${v[1]?.getTime()}`)]}),t(`div`,{className:`border-t pt-2`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:c,children:`Cancel`}),t(J,{size:`sm`,onClick:()=>{if(d[0]){let e=new Date(d[0]),t=d[1]?new Date(d[1]):new Date(d[0]);e.setHours(0,0,0,0),t.setHours(23,59,59,999);let n=[];n.push({value:e.toISOString(),label:W(e).format(`LLL dd, y`)}),d[1]&&d[0].getTime()!==d[1].getTime()&&n.push({value:t.toISOString(),label:W(t).format(`LLL dd, y`)}),o([...s,{name:r||``,placeholder:h?.placeholder,value:n,type:h?.type||`date`,multiple:h?.multiple||!1}]),c()}},disabled:!v[0],children:`Apply`})]})})]}):n(`div`,{className:`calendar-wrapper`,children:[t(`style`,{children:hr}),t(Se,{value:i,onChange:y,selectRange:!1,maxDate:_,className:`mb-2 border-0`,tileClassName:({date:e,view:t})=>{if(t===`month`){let t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return`text-muted/20 cursor-not-allowed`;if(i&&t===i.getTime())return`bg-primary text-primary-foreground rounded-md font-semibold`}return``}})]})})}function wr({selectedView:e,commandInput:r,setFilters:i,handleClose:a,filterGroups:o}){let[s,c]=L([]),l=e=>{let t=o.find(t=>t.name===e);if(!t)return[];let n=t.options||[];if(!r.trim())return n;if(t.filterBy){let e=r.toLowerCase();return n.filter(n=>n.value===void 0?!1:t.filterBy?.(n.value,e))}let i=r.toLowerCase();return n.filter(e=>String(e.value||``).toLowerCase().includes(i))};if(!e)return null;let u=l(e),d=o.find(t=>t.name===e),f=d?.placeholder||d?.name,p=()=>{s.length>0&&i(t=>[...t.filter(t=>t.name!==e),{name:e||``,placeholder:d?.placeholder||``,value:s,type:d?.type||`select`,multiple:d?.multiple||!1}]),a()},m=t=>{let n={value:t.value,label:t.label};d?.multiple?s.some(e=>e.value===t.value)?c(e=>e.filter(e=>e.value!==t.value)):c(e=>[...e,n]):(i(t=>{let r=t.findIndex(t=>t.name===e);if(r>=0){let e=[...t];return e[r]={...e[r],value:[n]},e}else return[...t,{name:e||``,placeholder:d?.placeholder||``,value:[n],type:d?.type||`select`,multiple:d?.multiple||!1}]}),a())};return n(`div`,{className:`flex flex-col h-full`,children:[t(`div`,{className:`flex items-center p-1.5 text-xs text-muted shrink-0`,children:t(`span`,{children:f})}),t(`div`,{className:`flex-1 overflow-hidden min-h-0`,children:t(`div`,{className:`max-h-[200px] overflow-y-auto`,children:u.length>0&&u.map(e=>{let r=s.some(t=>t.value===e.value);return n(X,{className:`group flex gap-2 items-center w-full hover:bg-muted ${d?.multiple&&r?`bg-muted`:``}`,onSelect:()=>m(e),children:[t(_r,{value:e.value||``,labelRenderer:e.labelRenderer||d?.labelRenderer,fallbackLabel:e.label}),d?.multiple&&r&&t(`span`,{className:`ms-auto text-xs text-success`,children:`✓`})]},e.value||`option-${Math.random()}`)})})}),d?.multiple&&t(`div`,{className:`p-2 border-t shrink-0`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:a,children:`Cancel`}),t(J,{size:`sm`,onClick:p,disabled:s.length===0,children:`Apply`})]})})]})}function Tr({selectedView:e,setFilters:r,handleClose:i,filterGroups:a}){let[o,s]=L([]),c=a.find(t=>t.name===e);return n(`div`,{className:`p-2 space-y-3`,children:[t(`div`,{className:`space-y-2`,children:t(Ht,{value:o,onChange:s,placeholder:c?.placeholder||`Add ${e}...`,autoFocus:!0})}),n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:i,children:`Cancel`}),t(J,{size:`sm`,onClick:()=>{o.length>0&&r(t=>[...t.filter(t=>t.name!==e),{name:e,placeholder:c?.placeholder,value:o,type:`stringList`}]),i()},disabled:o.length===0,children:`Apply`})]})]})}function Er({selectedView:e,textValue:r,setTextValue:i,setFilters:a,handleClose:o,filterGroups:s}){let c=()=>{a(t=>[...t,{name:e||``,placeholder:s.find(t=>t.name===e)?.placeholder,value:[{value:r,label:r}],type:`text`}]),o()};return n(`div`,{className:`p-2 flex flex-col gap-1`,children:[t(`div`,{className:`flex items-center p-1.5 text-xs text-muted`,children:t(`span`,{children:s.find(t=>t.name===e)?.placeholder})}),t(xr,{autoFocus:!0,type:`text`,size:`sm`,value:r,onChange:i,onKeyDown:e=>e.key===`Enter`&&c(),placeholder:`Enter text...`}),t(`div`,{className:`mt-2 p-2 border-t`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:o,children:`Cancel`}),t(J,{size:`sm`,onClick:c,disabled:!r.trim(),children:`Apply`})]})})]})}function Dr(e,n,r){switch(e.type){case`date`:return t(gr,{filterValues:Array.isArray(e.value)&&typeof e.value[0]==`object`?e.value.map(e=>e.value||``):[],isRange:e.multiple,setFilterValues:t=>{n(n=>n.map(n=>n===e?{...n,value:t.length>0?t.map(e=>({value:e,label:W(e).format(`LLL dd, y`)})):[]}:n))}});case`text`:return t(Sr,{filterType:e.placeholder||e.name,filterValue:Array.isArray(e.value)&&e.value[0]&&typeof e.value[0]==`object`&&e.value[0].value||``,setFilterValue:t=>{n(n=>n.map(n=>n===e?{...n,value:[{value:t,label:t}]}:n))}});case`stringList`:return t(yr,{filterType:e.placeholder||e.name,filterValues:Array.isArray(e.value)&&typeof e.value[0]==`string`?e.value:[],setFilterValues:t=>{n(n=>n.map(n=>n===e?{...n,value:t}:n))}});default:{let i=r.find(t=>t.name===e.name);return t(vr,{filterType:e.placeholder||e.name,filterValues:Array.isArray(e.value)&&typeof e.value[0]==`object`?e.value:[],setFilterValues:t=>{n(n=>n.map(n=>n===e?{...n,value:t}:n))},options:i?.options||[],labelRenderer:i?.labelRenderer,multiple:e.multiple??i?.multiple})}}}function Or({filters:e,setFilters:r,filterGroups:i}){return t(`div`,{className:`flex gap-2 flex-wrap justify-start`,children:e.filter(e=>e.value?.length>0).map(e=>n(`div`,{className:`flex gap-[1px] items-center text-sm`,children:[t(`div`,{className:`flex gap-1.5 shrink-0 rounded-s bg-muted p-1.5 h-8 items-center`,children:e.placeholder||e.name}),Dr(e,r,i),t(J,{variant:`ghost`,size:`icon`,onClick:()=>{r(t=>t.filter(t=>t!==e))},className:`bg-muted rounded-s-none rounded-e-sm size-8 hover:text-primary hover:bg-muted/50 transition shrink-0`,children:t(j,{className:`size-6`})})]},`${e.name}-${e.type===`date`?`date`:e.type===`stringList`&&typeof e.value[0]==`string`?e.value.join(`,`):Array.isArray(e.value)?e.value.map(e=>e.value).join(`,`):``}`))})}const kr=N.createContext({filters:[],setFilters:()=>void 0,filterGroups:[]}),Ar=({filters:e,setFilters:n,filterGroups:r,children:i,inModal:a})=>{let o=new URL(window.location.href).searchParams.toString(),[s]=N.useState(()=>new URLSearchParams(window.location.search).get(`filters`)),c=N.useRef(new Set),l=N.useRef(a||!s);return F(()=>{if(!a&&l.current)try{let t=new URLSearchParams(o);if(e.length>0){let n=e.map(e=>{let t;if(e.type===`stringList`&&Array.isArray(e.value)&&typeof e.value[0]==`string`)t=`[${e.value.map(e=>encodeURIComponent(e)).join(`,`)}]`;else if(Array.isArray(e.value))if(e.multiple)t=`[${e.value.map(e=>encodeURIComponent(Pr(e))).join(`,`)}]`;else if(e.value.length>1)t=`[${e.value.map(e=>encodeURIComponent(Pr(e))).join(`,`)}]`;else{let n=e.value[0];t=typeof n==`string`?encodeURIComponent(n):typeof n==`object`&&n?.value!==void 0?encodeURIComponent(String(n.value)):encodeURIComponent(String(n||``))}else t=encodeURIComponent(e.value||``);return`${encodeURIComponent(e.name)}:${t}`}).join(`;`);t.set(`filters`,n)}else t.delete(`filters`);let n=`${window.location.pathname}?${t.toString()}${window.location.hash}`;window.history.replaceState(window.history.state||{},``,n)}catch(e){console.error(`Failed to update URL with filters:`,e)}},[e,a,o]),F(()=>{if(!(a||!s||r.length===0))try{let e=s.split(`;`),t=[];for(let n of e){let e=n.indexOf(`:`);if(e===-1)continue;let i=n.slice(0,e),a=n.slice(e+1),o=decodeURIComponent(i);if(c.current.has(o))continue;let s=r.find(e=>e.name===o);if(!s)continue;c.current.add(o);let l;if(a.startsWith(`[`)&&a.endsWith(`]`)){let e=a.slice(1,-1);l=e?e.split(`,`).map(e=>decodeURIComponent(e)):[]}else l=[decodeURIComponent(a)];let u;u=s.type===`stringList`?l:s.type===`text`?l.length===1?[{value:l[0],label:l[0]}]:l.map(e=>({value:e,label:e})):l.map(e=>{let t=s.options?.find(t=>t.value===e),n=e;return t?.label?n=String(t.label):t?.labelRenderer?n=String(t.labelRenderer(e)):s.labelRenderer&&(n=String(s.labelRenderer(e))),{value:e,label:n}}),s.multiple&&!a.startsWith(`[`)&&!a.endsWith(`]`)&&(s.type===`stringList`?u=l:Array.isArray(u)||(u=[u])),t.push({name:o,type:s.type,placeholder:s.placeholder,value:u,multiple:s.multiple})}t.length>0&&n(e=>{let n=new Set(t.map(e=>e.name));return[...e.filter(e=>!n.has(e.name)),...t]}),l.current=!0}catch{}},[r,a,s,n]),t(kr.Provider,{value:{filters:e,setFilters:n,filterGroups:r},children:i})},jr=({className:e})=>{let{filters:r,setFilters:i,filterGroups:a}=N.useContext(kr),{t:o}=R(),[s,c]=N.useState(!1),[l,u]=N.useState(null),[d,f]=N.useState(``),p=N.useRef(null),[m,h]=N.useState(),[g,_]=N.useState(``),v=e=>{u(e),f(``),p.current?.focus()},y=()=>{let e=a.map(e=>({...e,options:(e.options??[]).filter(t=>!r.some(n=>n.type===`date`?n.name===e.name:n.name===e.name&&(Array.isArray(n.value)&&typeof n.value[0]==`string`?n.value.some(e=>e===t.value):n.value.some(e=>Pr(e)===t.value))))})).filter(e=>(e.options??[]).length>0||e.type===`date`&&!r.some(t=>t.name===e.name)||e.type===`text`&&!r.some(t=>t.name===e.name)||e.type===`stringList`&&!r.some(t=>t.name===e.name));return e.length===0?t(Bn,{children:o(`filter.noAvailableFilters`)}):e.map(e=>t(X,{onSelect:()=>v(e.name),className:`group flex gap-2 items-center hover:bg-muted`,children:t(`span`,{children:e.placeholder??e.name})},e.name))},x=()=>{c(!1),setTimeout(()=>{u(null),f(``),h(void 0)},200)};return n(Z,{_open:s,onOpenChange:e=>{c(e),e||setTimeout(()=>{u(null),f(``),_(``)},200)},children:[t(Q,{asChild:!0,children:n(J,{variant:`outline`,role:`combobox`,"aria-expanded":s,size:`md`,className:q(`transition group flex gap-1.5`,e),children:[t(b,{className:`size-4 shrink-0 transition-all text-muted`}),o(`filter.filter`)]})}),t($,{className:`w-[300px] p-0`,align:`start`,sideOffset:4,children:n(In,{children:[a.find(e=>e.name===l)?.type===`select`&&t(Rn,{placeholder:l?o(`filter.filterBy`,{view:l}):o(`filter.filterPlaceholder`),className:`h-9 ring-0`,value:d,onValueChange:e=>{f(e)},ref:p,autoFocus:!0}),t(zn,{children:t(Y,{children:l?(()=>{if(!l)return null;switch(a.find(e=>e.name===l)?.type){case`date`:return t(Cr,{selectedView:l,selectedDate:m,setSelectedDate:h,setFilters:i,filters:r,handleClose:x,filterGroups:a});case`text`:return t(Er,{selectedView:l,textValue:g,setTextValue:_,setFilters:i,handleClose:x,filterGroups:a});case`stringList`:return t(Tr,{selectedView:l,setFilters:i,handleClose:x,filterGroups:a});default:return t(wr,{selectedView:l,commandInput:d,setFilters:i,handleClose:x,filterGroups:a})}})():y()})})]})})]})},Mr=({className:e})=>{let{filters:n,setFilters:r,filterGroups:i}=N.useContext(kr);return t(`div`,{className:q(e),children:t(Or,{filters:n,setFilters:r,filterGroups:i})})},Nr=({className:e})=>{let{filters:n,setFilters:r}=N.useContext(kr),{t:i}=R();return n.filter(e=>e.value?.length>0).length>0?t(J,{variant:`outline`,size:`md`,className:q(`transition group`,e),onClick:()=>r([]),children:i(`filter.clearAll`)}):null};function Pr(e){return typeof e==`string`?e:e.value||``}var Fr;(function(e){e.IS=`is`,e.IS_NOT=`is_not`,e.CONTAINS=`contains`,e.BEFORE=`before`,e.AFTER=`after`,e.IS_ANY_OF=`is_any_of`})(Fr||={});const Ir=oe(({className:e,level:n=3,...r},i)=>t(`h${n}`,{ref:i,className:q({h1:`text-2xl font-medium tracking-tight`,h2:`text-xl font-medium tracking-tight`,h3:`text-lg font-medium`,h4:`text-base font-medium`,h5:`text-sm font-medium`,h6:`text-xs font-medium`}[`h${n}`],`mb-2`,e),...r}));Ir.displayName=`Heading`;function Lr({options:i,optionLabel:s,groupBy:c,value:l,onChange:u,addNew:d,addNewLabel:f,disabled:p,filterBy:h,label:g,placeholder:_,className:v,popupClass:y,isClearable:b,border:x=!0,multiple:C=!1,by:w,inline:T=!1,isLoading:E=!1,warnOnMissingValue:D=!0,missingValueWarning:A=`Value not in options list, may not be valid`,clearIcon:ee,clearTitle:te,"aria-label":M,"aria-labelledby":N,id:ne,"aria-describedby":re,"aria-invalid":ie}){let ae=I(null),[oe,se]=L(!1),[ce,P]=L(0),[ue,fe]=L(``),pe=le(),me=le(),he=de(()=>!D||C||l==null||!i?!1:!i.some(e=>typeof w==`string`?Rr(e,w)===Rr(l,w):typeof w==`function`?w(e,l):Ce(e,l)),[D,C,l,i,w]);F(()=>{let e=ae.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect().width;P(t)},n=new ResizeObserver(()=>{t()});return t(),n.observe(e),()=>{n.disconnect()}},[]);let R=e=>{if(C){let t=Array.isArray(l)?l:[];z(e,t)?u(t.filter(t=>!ge(t,e))):u([...t,e])}else u(e)},z=(e,t)=>!t||t.length===0?!1:t.some(t=>ge(t,e)),ge=(e,t)=>e==null||t==null?e===t:typeof w==`string`?Rr(e,w)===Rr(t,w):typeof w==`function`?w(e,t):Ce(e,t),B=i||[];function _e(e){return e?typeof e==`string`?t=>String(Rr(t,e)).toLowerCase():e:e=>String(e).toLowerCase()}let ve=ue.toLowerCase(),ye=_e(h);B=B.filter(e=>ye(e).includes(ve));let be=()=>{if(!l||Array.isArray(l)&&l.length===0)return t(`span`,{className:`text-muted`,children:_});let e=Array.isArray(l)?l[0]:l;return s?s(e):e},xe=()=>{let e=Array.isArray(l)?l:l?[l]:[];return e.length===0?t(`span`,{className:`text-muted`,children:_}):e.length===1?s?s(e[0]):e[0]:n(`div`,{className:`flex flex-wrap gap-1`,children:[e.slice(0,1).map((e,n)=>t(`span`,{className:`inline-flex items-center gap-1 px-2 py-1 text-xs bg-muted rounded`,children:s?s(e):e},`chip-${n}`)),e.length>1&&n(`span`,{className:`inline-flex items-center px-2 py-1 text-xs bg-muted rounded`,children:[`+`,e.length-1,` more`]})]})},V=(e,r)=>{let i=C?z(e,Array.isArray(l)?l:[]):l==null?!1:ge(l,e);return t(X,{onSelect:()=>R(e),className:`w-full`,children:C||T?n(`div`,{className:`w-full flex justify-between items-center cursor-pointer`,children:[t(`div`,{className:`w-full truncate text-start`,children:s?s(e):e}),i&&t(o,{className:`size-4`})]}):n(pr,{className:`w-full flex justify-between items-center`,children:[t(`div`,{className:`w-full truncate text-start`,children:s?s(e):e}),i&&t(o,{className:`size-4`})]})},`option-${r}`)},H=(()=>{if(!c)return null;let e=[],t=new Map;for(let n of B){let r=c(n),i=t.get(r);i||(i=[],t.set(r,i),e.push({key:r,items:i})),i.push(n)}return e})(),U=()=>n(e,{children:[h&&n(`div`,{className:`flex justify-start items-center mb-1`,children:[t(`div`,{className:`mx-2`,children:t(O,{className:`size-4`})}),t(xr,{variant:`unstyled`,value:ue,onChange:fe,className:`w-full p-1 rounded-md`,placeholder:`Search...`})]}),t(In,{className:`overflow-hidden`,children:n(zn,{className:T?`max-h-full overflow-y-auto`:`max-h-[200px] overflow-y-auto`,onWheel:e=>{e.currentTarget.scrollTop+=e.deltaY},children:[t(Bn,{children:`No result found.`}),H?H.map(e=>t(Y,{heading:e.key,className:`[&_[cmdk-group-heading]]:text-muted [&_[cmdk-group-heading]]:border-b [&_[cmdk-group-heading]]:border-border [&_[cmdk-group-heading]]:ml-[-0.5rem] [&_[cmdk-group-heading]]:text-xs`,children:e.items.map((t,n)=>V(t,`${e.key}-${n}`))},e.key)):t(Y,{children:B?.map((e,t)=>V(e,t))})]})}),d&&t(`div`,{className:`p-1`,children:n(`button`,{type:`button`,onClick:d,className:r(`w-full text-start gap-x-2 px-2 py-1.5 truncate group flex rounded-md items-center text-sm cursor-pointer hover:bg-accent bg-transparent border-0`),children:[t(k,{size:16,strokeWidth:1.25,absoluteStrokeWidth:!0}),f]})})]});if(T)return t(`div`,{className:r(v,x&&`border border-border rounded-md`,`bg-popover p-1`,y),children:E?t(`div`,{className:`flex justify-center items-center p-2 text-muted text-sm`,children:t(S,{className:`size-4 animate-spin`})}):U()});let W=!!g,Se=M??(W?void 0:typeof _==`string`?_:void 0),G=N??(W?me:void 0),we=!!b&&!!l&&(Array.isArray(l)?l.length>0:!0),Te=ie===!0||ie===`true`||he?!0:ie===!1||ie===`false`?!1:void 0;return n(Z,{onOpenChange:se,children:[n(`div`,{ref:ae,className:r(`relative`,v),children:[t(Q,{asChild:!0,children:t(`button`,{type:`button`,id:ne,disabled:p||E,"aria-haspopup":`dialog`,"aria-expanded":oe,"aria-controls":pe,"aria-label":Se,"aria-labelledby":G,"aria-describedby":re,"aria-invalid":Te,className:r(E?`flex w-full justify-center items-center gap-2 border border-border rounded-md p-2 text-muted text-sm bg-transparent`:r(x&&(he||Te?`border border-destructive`:`border border-border`),`flex w-full flex-row gap-2 items-center justify-between p-2 rounded-md group bg-transparent text-inherit text-start`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,p?`cursor-not-allowed text-muted`:`cursor-pointer hover:bg-muted`,we&&`pe-10`)),children:E?t(S,{className:`size-4 animate-spin`}):n(e,{children:[n(`div`,{className:r(`flex flex-col w-full rounded-md text-sm min-h-6 items-center justify-center truncate`),children:[g&&t(`div`,{id:me,className:`w-full text-start text-xs font-semibold`,children:g}),n(`div`,{className:r(`w-full text-start `,he&&`text-destructive`),children:[he&&t(vt,{description:A,placement:`top`,asChild:!0,children:t(a,{className:`inline-block size-4 me-1 -mt-0.5 cursor-help`})}),C?xe():be()]})]}),!p&&t(m,{className:`size-4 opacity-50 shrink-0`,"aria-hidden":`true`})]})})}),we&&!E&&t(J,{variant:`link`,size:`icon`,disabled:p,"aria-label":te||`Clear selection`,onClick:e=>{e.stopPropagation(),u(C?[]:void 0)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},className:`absolute end-8 top-1/2 -translate-y-1/2 hover:bg-muted/20 rounded p-1`,children:ee||t(j,{className:`size-4`})})]}),t($,{id:pe,style:{width:`${ce}px`,zIndex:1e6},className:r(`min-w-[8rem] w-64 bg-popover p-1 border shadow`,`divide-y divide-border`,y),children:U()})]})}function Rr(e,t){return typeof e==`object`&&e?e[t]:void 0}const zr={ar:`العربية`,de:`Deutsch`,en:`English`,es:`Español`,fr:`Français`,it:`Italiano`,ja:`日本語`,ko:`한국어`,pt:`Português`,ru:`Русский`,tr:`Türkçe`,zh:`中文`,"zh-TW":`繁體中文`};function Br({label:e,className:r}={}){let{language:i,setLanguage:a}=he(),{t:o}=R(),s=e===!1?!1:e??o(`language.label`);return n(`div`,{className:r??(s?`flex justify-between px-2 items-center gap-3`:`flex items-center`),children:[s&&t(`p`,{className:`text-sm font-semibold`,children:s}),t(Lr,{options:me,value:i,onChange:e=>a(e),optionLabel:e=>zr[e],placeholder:o(`language.placeholder`),isClearable:!1,warnOnMissingValue:!1,className:`min-w-40`})]})}const Vr=z(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),Hr=M.forwardRef(({className:e,required:r,...i},a)=>n(we.Root,{ref:a,className:q(Vr(),e),...i,children:[i.children,r&&t(`span`,{className:`text-destructive-foreground ms-1`,children:`*`})]}));Hr.displayName=we.Root.displayName;function Ur({icon:e,status:r,title:i,children:o,className:s}){let c,l,u,d;switch(r){case`error`:c=t(g,{className:`size-5 text-destructive`,"aria-hidden":`true`}),l=`text-destructive`,u=`text-foreground`,d=`bg-destructive border border-destructive`;break;case`warning`:c=t(a,{className:`size-5 text-attention`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-attention border border-attention`;break;case`success`:c=t(h,{className:`size-5 text-success`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-success border border-success`;break;case`info`:c=t(y,{className:`size-5 text-info`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-info border border-info`;break;case`default`:c=t(y,{className:`size-5 text-muted`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-muted border border-muted`;break;case`done`:c=t(y,{className:`size-5 text-done`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-done border border-done`;break}return t(`div`,{className:`rounded-md p-4 ${d} ${s}`,children:n(`div`,{className:`flex`,children:[t(`div`,{className:`shrink-0`,children:e??c}),n(`div`,{className:`w-full ms-2 px-1`,children:[i&&t(`h3`,{className:`text-md font-medium mb-2 ${l}`,children:i}),t(`div`,{className:`text-sm ${u} break-words`,children:o})]})]})})}function Wr({title:e,className:r,children:i,action:a,actionLabel:o}){return n(Ur,{status:`error`,title:e,className:`${r} flex flex-col items-center justify-center text-center`,children:[t(`pre`,{className:`whitespace-pre-wrap break-words`,children:i}),a&&o&&t(J,{onClick:a,variant:`ghost`,size:`sm`,className:`mt-4`,children:o})]})}function Gr({title:e,className:n,children:r}){return t(Ur,{status:`info`,title:e,className:n,children:r})}function Kr({title:e,className:n,children:r}){return t(Ur,{status:`warning`,title:e,className:n,children:r})}function qr({title:e,className:n,children:r}){return t(Ur,{status:`success`,title:e,className:n,children:r})}function Jr({title:e,className:n,children:r}){return t(Ur,{status:`default`,title:e,className:n,children:r})}function Yr({title:e,content:r,onConfirm:i,onCancel:a,isOpen:o,isLoading:s,confirmationValue:c,confirmationLabel:l,confirmationPlaceholder:u}){let{t:d}=R(),f=I(null),[p,m]=L(``);F(()=>{o||m(``)},[o]);let h=!!c,g=!c||p.trim()===c.trim(),_=()=>{!g||s||i()};return n(wn,{isOpen:o,onClose:a,description:`Confirm Modal`,children:[n(`div`,{className:`sm:flex sm:items-start p-2`,children:[t(`div`,{className:`mx-auto flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10`,children:t(ee,{className:`size-6 text-red-600`,"aria-hidden":`true`})}),n(`div`,{className:`mt-3 text-center sm:ms-4 sm:mt-0 sm:text-start`,children:[t(Tn,{className:`leading-6`,show:!0,children:e}),t(`div`,{className:`mt-2`,children:t(`div`,{className:`prose text-sm text-gray-500`,children:r})})]})]}),h&&t(`div`,{className:`px-2 pb-2 text-start`,children:t(Ft,{label:l??u,children:t(xr,{autoFocus:!0,value:p,onChange:m,placeholder:u,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),_())}})})}),n(Dn,{align:`right`,children:[t(J,{variant:`destructive`,onClick:_,isLoading:s,disabled:!g,children:d(`modal.confirm`)}),t(J,{variant:`outline`,onClick:a,ref:f,children:d(`modal.cancel`)})]})]})}function Xr(){return P(Zr)}const Zr=ae(()=>{}),Qr={success:h,error:g,warning:a,info:y},$r={success:`text-success`,error:`text-destructive`,warning:`text-attention`,info:`text-info`};function ei({data:e,onClose:r}){let[i,a]=L(!0),o=I(null),s=ce(()=>{o.current&&=(globalThis.clearTimeout(o.current),null)},[]),c=ce(()=>{s(),e.duration&&(o.current=setTimeout(()=>a(!1),e.duration))},[s,e.duration]);F(()=>(c(),s),[s,c]);let l=Qr[e.status]||y,u=$r[e.status]||`text-info`;return t(`div`,{"aria-live":`assertive`,className:`pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6 z-100`,children:t(`div`,{className:`flex w-full flex-col items-center space-y-4 sm:items-end`,children:t(ve,{onExitComplete:r,children:i&&t(ye.div,{className:`pointer-events-auto w-full max-w-md overflow-hidden rounded-lg bg-muted shadow-lg ring-1 ring-border`,initial:{opacity:0,x:8},animate:{opacity:1,x:0,transition:{ease:`easeOut`,duration:.7}},exit:{opacity:0,transition:{ease:`easeIn`,duration:.3}},onMouseEnter:s,onMouseLeave:c,children:t(`div`,{className:`p-5`,children:n(`div`,{className:`flex items-start`,children:[t(`div`,{className:`shrink-0`,children:t(l,{className:`size-6 ${u}`,"aria-hidden":`true`})}),n(`div`,{className:`ms-3 flex-1 pt-0.5 min-w-0`,children:[t(`p`,{className:`text-sm font-semibold text-foreground break-words`,children:e.title}),e.description&&t(`p`,{className:`mt-2 text-sm text-muted break-words whitespace-pre-wrap leading-relaxed`,children:e.description})]}),t(`div`,{className:`ms-4 flex shrink-0`,children:n(`button`,{type:`button`,className:`inline-flex rounded-md bg-muted text-muted hover:text-foreground focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background`,onClick:()=>a(!1),children:[t(`span`,{className:`sr-only`,children:`Close`}),t(j,{className:`size-5`,"aria-hidden":`true`})]})})]})})})})})})}function ti({children:r}){let[i,a]=L(null),o=ce(e=>{a(e)},[]);return n(e,{children:[t(Zr.Provider,{value:o,children:r}),i&&t($t,{children:t(ei,{data:i,onClose:()=>o(null)})})]})}function ni({idToDelete:e,title:n,content:r,setIdToDelete:i,deleteApi:a}){let{t:o}=R(),s=Xr();return t(Yr,{title:n,content:r,isOpen:!!e,onConfirm:async()=>{if(e)return a(e).then(()=>{s({title:o(`modal.delete.succeeded`),status:`success`})}).catch(e=>{s({title:o(`modal.delete.failed`),description:e instanceof Error?e.message:o(`modal.delete.error`),status:`error`})}).finally(()=>{i(void 0)})},onCancel:()=>{i(void 0)}})}function ri({children:r,action:i,title:a,description:o,footer:s,className:l,collapsible:u,defaultCollapsed:d=!1,size:p=`md`,clickableHeader:m=!1}){let[h,g]=L(d),_=u&&m,v=p===`sm`,b=v||_,x=t(h?c:f,{className:`size-4 text-muted`}),S=n(e,{children:[n(`div`,{className:`flex items-center gap-2`,children:[t(`div`,{className:`font-semibold ${v?`text-sm`:`text-lg`}`,children:a}),o&&t(vt,{description:o,children:t(y,{className:`size-4 text-muted`})})]}),n(`div`,{className:`flex gap-2 items-center`,children:[i,u&&(_?x:t(J,{variant:`ghost`,size:`icon`,onClick:()=>g(!h),children:x}))]})]}),C=v?`px-4 py-2`:`px-4 py-3`,w=v?`px-4 pt-3 pb-3`:`p-4`,T=v?`px-4 pb-3`:`px-4 pb-4`;return n(`div`,{className:`flex flex-col ${b?``:`p-4 gap-2`} rounded-sm border bg-card ${_?`overflow-hidden`:``} ${l??``}`,children:[_?t(`button`,{type:`button`,className:`w-full flex items-center justify-between ${C} hover:bg-muted/50 transition-colors`,onClick:()=>g(!h),children:S}):t(`div`,{className:`flex items-center justify-between ${b?C:``}`,children:S}),!h&&(b?t(`div`,{className:w,children:r}):r),s&&t(`div`,{className:`border-t border-muted flex flex-col-2 text-sm pt-4 ${b?T:``}`,children:s})]})}function ii({className:e,...n}){return t(Te.Item,{"data-slot":`radio-group-item`,className:q(`border-input dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 dark:aria-invalid:border-destructive/50 flex size-4 rounded-full focus-visible:ring-3 aria-invalid:ring-3 group/radio-group-item peer relative aspect-square shrink-0 border outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50`,e),...n,children:t(Te.Indicator,{"data-slot":`radio-group-indicator`,className:`flex size-4 items-center justify-center`,children:t(`span`,{className:`bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full`})})})}var ai=class{descriptionOf(e){}selectedClassName(e){return`border-accent-foreground`}};function oi({onSelect:e,selected:r,options:i,adapter:a}){let o=e=>a?a.idOf(e):e.id,s=e=>a?a.labelOf(e):e.label,c=e=>a?a.descriptionOf(e):e.description,l=e=>a?a.selectedClassName(e):`border-primary`;return t(Te.Root,{"data-slot":`radio-group`,value:r?o(r):void 0,onValueChange:t=>{let n=i.find(e=>o(e)===t);n&&e(n)},className:`space-y-4`,children:i.map(e=>{let i=r?o(r)===o(e):!1;return t(Te.Item,{value:o(e),className:q(`relative block w-full cursor-pointer rounded-lg border border-border bg-accent px-6 py-4 shadow-2xs text-start`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`sm:flex sm:justify-between`,i&&l(e)),children:t(`span`,{className:`flex items-center`,children:n(`span`,{className:`flex flex-col text-sm`,children:[t(`span`,{className:`font-medium text-text`,children:s(e)}),c(e)&&t(`span`,{className:`text-muted-foreground`,children:c(e)})]})})},o(e))})})}function si({className:e,direction:n=`horizontal`,orientation:r,...i}){let a=r??n;return t(Ee.Group,{"data-slot":`resizable-panel-group`,"data-panel-group-direction":a,orientation:a,className:q(`flex h-full w-full data-[panel-group-direction=vertical]:flex-col`,e),...i})}function ci(e){return typeof e==`number`?`${e}%`:e}function li({defaultSize:e,minSize:n,maxSize:r,collapsedSize:i,...a}){return t(Ee.Panel,{"data-slot":`resizable-panel`,defaultSize:ci(e),minSize:ci(n),maxSize:ci(r),collapsedSize:ci(i),...a})}function ui({withHandle:e,className:n,...r}){return t(Ee.Separator,{"data-slot":`resizable-handle`,className:q(`bg-muted focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:start-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),...r,children:e&&t(`div`,{className:`z-10 flex size-4 items-center justify-center rounded-xs font-semibold`,children:t(C,{className:`size-4 rotate-90`})})})}const di=M.forwardRef(({className:e,orientation:n=`horizontal`,decorative:r=!0,...i},a)=>t(De.Root,{ref:a,decorative:r,orientation:n,className:q(`shrink-0 bg-border`,n===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...i}));di.displayName=De.Root.displayName;const fi=M.forwardRef(({className:e,trackClassName:r,rangeClassName:i,thumbClassName:a,value:o,defaultValue:s,min:c=0,max:l=100,"aria-label":u,...d},f)=>{let p=M.useId(),m=Array.isArray(o)?o.length:Array.isArray(s)?s.length:1,h=M.useMemo(()=>Array.from({length:Math.max(1,m)},(e,t)=>`${p}-thumb-${t}`),[p,m]);return n(Oe.Root,{ref:f,"data-slot":`slider`,value:o,defaultValue:s,min:c,max:l,...d,className:q(`relative flex w-full touch-none select-none items-center data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col`,e),children:[t(Oe.Track,{"data-slot":`slider-track`,className:q(`relative h-1.5 w-full grow overflow-hidden rounded-full bg-muted data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5`,r),children:t(Oe.Range,{"data-slot":`slider-range`,className:q(`absolute h-full bg-primary data-[orientation=vertical]:w-full`,i)})}),h.map(e=>t(Oe.Thumb,{"data-slot":`slider-thumb`,"aria-label":u,className:q(`block size-3.5 rounded-full border border-primary bg-background shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,a)},e))]})});fi.displayName=Oe.Root.displayName;const pi={sm:[`h-5 w-8`,`size-3`,`translate-x-4 rtl:-translate-x-4`],md:[`h-6 w-11`,`size-4`,`translate-x-6 rtl:-translate-x-6`],lg:[`h-8 w-16`,`size-6`,`translate-x-9 rtl:-translate-x-9`]};function mi({className:e,size:r=`md`,value:i,onChange:a,children:o,disabled:s,...c}){let[l,u,d]=pi[r],f=t(ke.Root,{"data-slot":`switch`,checked:i,onCheckedChange:a,disabled:s,...c,className:q(`data-[state=checked]:bg-primary data-[state=unchecked]:bg-muted focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 shrink-0 rounded-full border focus-visible:ring-3 aria-invalid:ring-3 peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,l,!o&&e),children:t(ke.Thumb,{"data-slot":`switch-thumb`,className:q(`bg-white rounded-full pointer-events-none block ring-0 transition-transform`,u,i?d:`translate-x-1 rtl:-translate-x-1`)})});return o?n(`div`,{className:q(`flex items-center`,e),children:[f,t(`span`,{className:`px-2`,children:o})]}):f}const hi=M.createContext({size:void 0,tabs:void 0,current:void 0,setTab:void 0,responsive:!1,variant:`tabs`,updateHash:!0}),gi=({tabs:e,defaultValue:n,current:r,className:i,fullWidth:a,fullHeight:o,children:s,onTabChange:c,responsive:l=!1,variant:u=`tabs`,updateHash:d=!0})=>{let f=M.useMemo(()=>e.filter(e=>e.is_allowed===void 0||e.is_allowed===!0),[e]),[p,m]=M.useState(()=>{let e=typeof r==`function`?r():r;if(e)return e;let t=window.location.hash,i=t?t.substring(1):void 0;return i&&f.some(e=>e.name===i)?i:n||f[0]?.name});M.useEffect(()=>{let e=typeof r==`function`?r():r;e&&e!==p&&m(e)},[r,p]),M.useEffect(()=>{if(r)return;let e=()=>{let e=window.location.hash,t=e?e.substring(1):void 0;t&&f.some(e=>e.name===t)?m(t):!e&&n&&m(n)};return e(),window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[r,f,n]);let h=M.useCallback(e=>{if(m(e),d&&!r){let t=window.history.state,n=`${window.location.pathname+window.location.search}#${e}`;window.history.pushState(t,``,n)}c&&c(e)},[r,c,d]),g=M.useCallback(e=>{h(e)},[h]);return t(hi.Provider,{value:{tabs:f,size:a?f.length:0,current:p,setTab:g,responsive:l,variant:u,updateHash:d},children:t(K.Root,{defaultValue:p||f[0]?.name,value:p,onValueChange:h,className:q(`flex-1 flex flex-col min-h-0 px-2`,o&&`h-full`,i),children:s})})},_i=({className:r,sticky:i,direction:a})=>{let{tabs:o,size:s,current:c,setTab:l,responsive:u,variant:d,updateHash:f}=M.useContext(hi),p=s!==0,m=M.useCallback(e=>{if(!o||!l)return;let t=o.find(t=>t.name===e);if(t?.href&&f){let e=window.history.state;window.history.pushState(e,``,t.href)}l(e)},[o,l,f]);return!o||!l?(console.warn(`TabsBar: No tabs provided or setTab not available`),null):n(e,{children:[u&&t(`div`,{className:`px-2 block lg:hidden`,children:t(Lr,{label:`Tab`,className:q(i&&`sticky top-0 bg-background z-10`,r),options:o,optionLabel:e=>typeof e.label==`string`?e.label:String(e.label),value:o.find(e=>e.name===c),onChange:e=>{m(e.name)}})}),t(yi,{size:s,variant:d,className:q(p?`w-full`:``,i&&`sticky top-0 bg-background z-10`,a===`vertical`?`flex-col items-start`:`flex-row`,u?`hidden lg:flex`:``,r),children:o.map(e=>t(bi,{className:q(a===`vertical`?`w-full text-start`:``),value:e.name,disabled:e.disabled,href:e.href,variant:d,onClick:()=>m(e.name),children:e.label},e.name))})]})},vi=({className:n})=>{let{tabs:r}=M.useContext(hi);return r?t(e,{children:r.map(e=>t(xi,{value:e.name,className:n,children:e.content},e.name))}):null},yi=M.forwardRef(({className:e,size:n,variant:r=`tabs`,...i},a)=>t(hi.Provider,{value:{size:n,variant:r},children:t(K.List,{ref:a,className:q(r===`tabs`?`border-b -mb-px flex gap-4`:`flex gap-2 p-1 rounded-md`,e),...i})}));yi.displayName=K.List.displayName;const bi=M.forwardRef(({className:e,href:n,variant:r=`tabs`,...i},a)=>{let{size:o}=M.useContext(hi),s=M.useCallback(e=>{if(n){e.preventDefault();let t=window.history.state;window.history.pushState(t,``,n)}i.onClick&&i.onClick(e)},[n,i.onClick]);return t(K.Trigger,{ref:a,className:q(r===`tabs`?q(`border-b-2 px-2 py-1.5 text-sm font-medium whitespace-nowrap cursor-pointer`,`border-transparent text-muted-foreground hover:border-border hover:text-foreground`,`data-[state=active]:border-primary data-[state=active]:text-primary`,`disabled:pointer-events-none disabled:opacity-50`):q(`px-3 py-1.5 text-sm font-medium whitespace-nowrap cursor-pointer rounded-sm transition-colors`,`tborder border-input bg-muted shadow-xs hover:bg-muted ring-inset`,`data-[state=active]:bg-primary data-[state=active]:text-white data-[state=active]:shadow-sm`,`disabled:pointer-events-none disabled:opacity-50`),e,o?`w-1/${o}`:``),onClick:s,...i})});bi.displayName=K.Trigger.displayName;const xi=M.forwardRef(({className:e,...n},r)=>t(K.Content,{ref:r,className:q(`focus-visible:outline-none`,`flex-1 overflow-y-auto min-h-0 pt-2 pb-4`,e),...n}));xi.displayName=K.Content.displayName;const Si=z(`text-foreground`,{variants:{size:{xl:`text-base md:text-lg leading-relaxed`,lg:`text-base leading-relaxed`,default:`text-sm leading-normal`,sm:`text-sm leading-normal`,xs:`text-xs leading-normal`},weight:{normal:`font-normal`,medium:`font-medium`,semibold:`font-semibold`}},defaultVariants:{size:`default`,weight:`normal`}}),Ci=oe(({className:e,size:n,weight:r,...i},a)=>t(`p`,{ref:a,className:q(Si({size:n,weight:r,className:e})),...i}));Ci.displayName=`Text`;function wi({className:e,minLines:n,maxLines:r,value:i,...a}){let o=I(null),s=n!==void 0||r!==void 0,c=ce(()=>{let e=o.current;if(!e)return;let t=getComputedStyle(e),i=parseFloat(t.lineHeight)||parseFloat(t.fontSize)*1.5,a=(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0),s=(parseFloat(t.borderTopWidth)||0)+(parseFloat(t.borderBottomWidth)||0),c=n??1,l=r??1/0,u=c*i+a+s,d=l===1/0?1/0:l*i+a+s;e.style.height=`auto`;let f=Math.min(Math.max(e.scrollHeight,u),d);e.style.height=`${f}px`,e.style.overflowY=d!==1/0&&e.scrollHeight>d?`auto`:`hidden`},[n,r]);return ue(()=>{s&&c()}),t(`textarea`,{ref:o,"data-slot":`textarea`,value:i,className:q(`py-2 text-sm`,`flex w-full rounded-md border border-input bg-background ring-offset-background`,`placeholder:text-muted focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,s&&`resize-none`,e),...a})}const Ti=ae({theme:`system`,setTheme:()=>null});function Ei({children:e,defaultTheme:n=`system`,storageKey:r=`vite-ui-theme`,...i}){let[a,o]=L(()=>localStorage.getItem(r)||n);F(()=>{let e=window.document.documentElement;if(e.classList.remove(`light`,`dark`),a===`system`){let t=window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`;e.classList.add(t);return}e.classList.add(a)},[a]);let s={theme:a,setTheme:e=>{localStorage.setItem(r,e),o(e)}};return t(Ti.Provider,{...i,value:s,children:e})}const Di=()=>{let e=P(Ti);if(e===void 0)throw Error(`useTheme must be used within a ThemeProvider`);return e};function Oi({option:e,current:n,setTheme:r,icon:i,alt:a}){return t(J,{variant:n===e?`secondary`:`outline`,size:`sm`,onClick:()=>r(e),alt:a,children:i})}function ki({label:e,className:r}={}){let{setTheme:i,theme:a}=Di(),{t:o}=R(),s=e===!1?!1:e??o(`theme.label`);return n(`div`,{className:r??(s?`flex justify-between px-2 items-center`:`flex items-center gap-1`),children:[s&&t(`p`,{className:`text-sm font-semibold`,children:s}),n(`div`,{className:`flex gap-2`,children:[t(Oi,{current:a,option:`system`,setTheme:i,icon:t(_,{}),alt:o(`theme.system`)}),t(Oi,{current:a,option:`light`,setTheme:i,icon:t(A,{}),alt:o(`theme.light`)}),t(Oi,{current:a,option:`dark`,setTheme:i,icon:t(w,{}),alt:o(`theme.dark`)})]})]})}function Ai(e,n){return{label:String(e),check:t(n?o:`div`,{className:`size-4`}),reverse:!1,className:`flex-1 px-2 py-2 hover:bg-accent nowrap`}}function ji({value:e,options:i,onChange:a,className:o,optionLayout:s,by:c,noCheck:l,filterBy:u}){let{t:d}=R(),[f,p]=L(e),[m,h]=L(``),g=e=>{p(e),a(e)},_=de(()=>typeof c==`string`?(e,t)=>e[c]===t[c]:c||((e,t)=>e===t),[c]);return n(`div`,{className:r(``,o),children:[u&&t(xr,{type:`text`,placeholder:d(`form.filter`),value:m,onChange:e=>h(e)}),i.map((e,n)=>{if(u&&!u(m)(e))return null;let r=f?_(f,e):!1,i;return s?(i=s(e,r),i=Object.assign(Ai(e,r),i)):i=Ai(e,r),t(Mi,{option:e,onSelect:g,layout:i,noCheck:l},`option-${n}`)})]})}function Mi({option:e,onSelect:i,layout:a,noCheck:o}){return n(J,{variant:`unstyled`,size:`none`,className:r(`group !flex w-full items-center cursor-pointer gap-x-2 hover:bg-muted`,a.reverse&&`flex-row-reverse`,a.className),onClick:()=>i(e),children:[o?null:t(`div`,{className:``,children:a.check}),t(`div`,{className:`flex-1`,children:a.label})]})}function Ni({isOpen:e,title:r,onClose:i,children:a,panelWidth:o=768,backdrop:s=!1,side:c=`right`,resizable:l=!0,className:u,contentClassName:d}){let[f,p]=L(o),m=e=>{e.preventDefault();let t=!0,n=e.pageX,r=f,i=e=>{if(t){let t=n-e.pageX;p(Math.max(r+t,480))}},a=()=>{t=!1,document.removeEventListener(`mousemove`,i),document.removeEventListener(`mouseup`,a)};document.addEventListener(`mousemove`,i),document.addEventListener(`mouseup`,a)},h=c===`left`,g=h?`left-0`:`right-0`,_=h?`pr-10 sm:pr-16`:`pl-10 sm:pl-16`,v=h?`border-r`:`border-l`,y=h?`-right-1`:`-left-1`,b=h?`-100%`:`100%`;return t(ve,{children:e&&n(`div`,{className:`relative z-20`,children:[s&&t(ye.div,{className:`fixed inset-0 bg-black/70`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:i}),t(`div`,{className:`fixed inset-y-0 ${g} overflow-hidden`,children:t(`div`,{className:`absolute inset-0 overflow-hidden`,children:t(`div`,{className:`pointer-events-none fixed inset-y-0 ${g} flex max-w-full ${_}`,children:t(ye.div,{className:`pointer-events-auto ${v}`,style:{width:`${f}px`},initial:{x:b},animate:{x:0},exit:{x:b},transition:{type:`spring`,stiffness:300,damping:30},children:n(`div`,{className:`relative flex h-full`,children:[l&&t(`div`,{"aria-label":`Resize panel`,className:`absolute ${y} top-0 bottom-0 w-3 z-25 cursor-ew-resize hover:bg-indigo-500 transition-colors flex items-center justify-center`,onMouseDown:m,children:t(C,{className:`rotate-90 font-semibold`,strokeWidth:4})}),n(`div`,{className:`flex-1 min-w-0 flex flex-col bg-background shadow-xl ${u}`,children:[r&&t(`div`,{className:`sticky top-0 z-10 bg-background px-2 sm:px-4 py-2 border-b`,children:n(`div`,{className:`flex items-start justify-between`,children:[t(`h2`,{className:`w-full text-base font-semibold leading-6`,children:t(`div`,{className:`text-2xl`,children:r??``})}),t(`div`,{className:`ms-3 flex h-7 items-center`,children:t(Pi,{onClose:i})})]})}),t(`div`,{className:d??`flex-1 overflow-auto px-2 sm:px-4 py-4`,children:t(`div`,{className:`w-full h-full flex-1 flex flex-col`,children:a})})]})]})})})})})]})})}function Pi({onClose:e}){return t(J,{alt:`Close panel`,variant:`ghost`,onClick:e,children:t(j,{className:`size-6`,"aria-hidden":`true`})})}function Fi(e){switch(e){case`xs`:return`size-2`;case`sm`:return`size-3`;case`md`:return`size-4`;case`lg`:return`size-5`;case`xl`:return`size-7`;case`2xl`:return`size-10`;default:throw Error(`Unexpected size: ${e}`)}}function Ii({size:e,className:i}){return n(`svg`,{className:r(`animate-[spin_0.8s_linear_infinite] text-indigo-500`,Fi(e||`md`),i),xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,role:`img`,"aria-label":`Loading`,children:[t(`title`,{children:`Loading`}),t(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),t(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z`})]})}function Li({options:i,value:a,onChange:o,onOptionsChange:s,placeholder:c,className:l,disabled:u,layout:d=`horizontal`,creatable:f=!1,createText:p=`Create "%value%"`,maxDropdownHeight:m=200}){let h=P(ur),[g,_]=L(``),[v,y]=L(0),[b,x]=L(0),[S,C]=L(null),w=I(null),T=I(null),E=I(null),D=I(null),O=h?.open??!1,k=h?.setOpen??(()=>{});F(()=>{let e=T.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect().width;x(t)},n=new ResizeObserver(()=>{t()});return t(),n.observe(e),()=>{n.disconnect()}},[]);let A=i.filter(e=>!a.includes(e)&&e.toLowerCase().includes(g.toLowerCase())),ee=f&&g&&!a.includes(g)&&!i.includes(g),te=A.length+ +!!ee;F(()=>{g!==``&&C(null)},[g]),F(()=>{O&&v>=0&&D.current&&E.current&&D.current.scrollIntoView({block:`nearest`,behavior:`smooth`})},[v,O]),F(()=>{O?w.current?.focus():_(``)},[O]),F(()=>{if(!O)return;let e=e=>e instanceof Node&&(T.current?.contains(e)===!0||E.current?.contains(e)===!0),t=t=>{e(t.target)||k(!1)},n=t=>{e(t.target)||k(!1)},r=()=>{k(!1)};return document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`focusin`,n,!0),window.addEventListener(`blur`,r),document.addEventListener(`visibilitychange`,r),()=>{document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`focusin`,n,!0),window.removeEventListener(`blur`,r),document.removeEventListener(`visibilitychange`,r)}},[O,k]);let M=e=>{o([...a,e]),_(``),k(!1),y(0),C(null)},N=e=>{o([...a,e]),s&&!i.includes(e)&&s([...i,e]),_(``),k(!1),y(0),C(null)},ne=(e,t)=>{t.stopPropagation(),o(a.filter(t=>t!==e)),C(null)};return n(`div`,{className:r(`relative`,l),children:[t(Q,{asChild:!0,children:n(`div`,{ref:T,className:r(`min-h-[40px] w-full rounded-md border border-input bg-background px-3 py-2`,`flex items-center gap-1`,d===`horizontal`?`flex-wrap`:`flex-col items-stretch`,`cursor-text`,`ring-offset-background`,u&&`opacity-50 cursor-not-allowed`,O?`ring-1 ring-inset ring-ring`:``),onClick:()=>{u||w.current?.focus()},children:[d===`vertical`&&a.length>0&&t(`div`,{className:`flex flex-col gap-1 w-full`,children:a.map((e,i)=>n(`span`,{className:r(`inline-flex items-center justify-between gap-2 px-2 py-1 text-sm bg-primary/20 text-foreground ring-1 ring-primary/30 rounded-md w-full transition-all`,S===i&&`ring-2 ring-red-300 shadow-[0_0_8px_rgba(252,165,165,0.5)]`),children:[t(`span`,{className:`truncate`,children:e}),t(`button`,{type:`button`,onClick:t=>ne(e,t),disabled:u,className:`hover:bg-primary/30 rounded-sm transition-colors flex-shrink-0`,children:t(j,{className:`h-3 w-3`})})]},e))}),d===`horizontal`&&a.map((e,i)=>n(`span`,{className:r(`inline-flex items-center gap-1 px-2 py-1 text-sm bg-primary/20 text-foreground ring-1 ring-primary/30 rounded-md transition-all`,S===i&&`ring-2 ring-red-300 shadow-[0_0_8px_rgba(252,165,165,0.5)]`),children:[e,t(`button`,{type:`button`,onClick:t=>ne(e,t),disabled:u,className:`hover:bg-primary/30 rounded-sm transition-colors`,children:t(j,{className:`h-3 w-3`})})]},e)),t(`input`,{ref:w,type:`text`,value:g,onChange:e=>{_(e.target.value),y(0)},onKeyDown:e=>{if(e.key===`Enter`&&O&&te>0){e.preventDefault(),e.stopPropagation(),v===A.length&&ee?N(g):v<A.length&&M(A[v]);return}if(e.key===`ArrowDown`){e.preventDefault(),e.stopPropagation(),O?y(e=>e<te-1?e+1:e):k(!0);return}if(e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation(),O?y(e=>e>0?e-1:0):k(!0);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),k(!1);return}if(e.key===`Backspace`&&g===``&&a.length>0){e.stopPropagation();let t=a.length-1;S===t?(o(a.slice(0,-1)),C(null)):C(t);return}!O&&e.key.length===1&&k(!0)},onClick:e=>{e.stopPropagation(),u||k(!0)},onFocus:()=>{u||k(!0)},disabled:u,placeholder:a.length===0?c:``,className:r(`flex-1 min-w-[120px] bg-transparent text-sm`,`placeholder:text-muted-foreground`,`border-none outline-none focus:outline-none focus:ring-0 p-0 m-0`,d===`vertical`&&`w-full`)})]})}),t($,{style:{width:`${b}px`},className:`p-0 bg-popover border border-border shadow-lg`,align:`start`,side:`bottom`,onOpenAutoFocus:e=>{e.preventDefault()},children:t(`div`,{ref:E,className:`overflow-y-auto`,style:{maxHeight:`${m}px`},children:A.length===0&&!ee?t(`div`,{className:`px-3 py-2 text-sm text-muted-foreground`,children:g?`No options found`:`No more options available`}):n(e,{children:[A.length>0&&t(`ul`,{className:`py-1`,children:A.map((e,n)=>t(`li`,{ref:e=>{n===v&&(D.current=e)},role:`option`,"aria-selected":n===v,tabIndex:0,onClick:()=>M(e),onKeyDown:It(()=>M(e)),onMouseEnter:()=>y(n),className:r(`px-3 py-2 text-sm cursor-pointer transition-colors`,n===v?`bg-blue-500/20 text-foreground`:`hover:bg-accent/50`),children:e},e))}),ee&&n(e,{children:[A.length>0&&t(`div`,{className:`border-t border-border`}),t(J,{ref:e=>{v===A.length&&(D.current=e)},variant:`unstyled`,size:`none`,onClick:()=>N(g),onMouseEnter:()=>y(A.length),className:r(`!flex w-full justify-start px-3 py-2 text-sm cursor-pointer transition-colors text-primary`,v===A.length?`bg-blue-500/20`:`hover:bg-accent/50`),children:p.replace(`%value%`,g)})]})]})})})]})}function Ri(e){return t(Z,{click:!0,children:t(Li,{...e})})}function zi({className:e,children:n,...i}){return t(`table`,{className:r(`
|
|
89
|
+
flex items-center justify-center size-6 rounded end-2`,"aria-label":`Clear input`,children:t(j,{size:16})})]})});xr.displayName=`Input`;const Sr=({filterType:e,filterValue:r,setFilterValue:i})=>{let[a,o]=L(!1),[s,c]=L(r);return n(Z,{_open:a,onOpenChange:e=>{o(e),!e&&s!==r&&c(r)},children:[t(Q,{className:`rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition`,children:t(`div`,{className:`flex gap-1.5 items-center`,children:r||`Enter text...`})}),t($,{className:`w-[300px] p-3`,children:n(`div`,{className:`flex flex-col gap-1`,children:[t(`div`,{className:`flex items-center p-1.5 text-xs text-muted`,children:t(`span`,{children:e})}),t(xr,{autoFocus:!0,type:`text`,size:`sm`,value:s,onChange:c,onKeyDown:e=>{e.key===`Enter`&&(i(s),o(!1))},placeholder:`Enter text...`}),t(`div`,{className:`mt-2 p-2 border-t`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:()=>{c(r),o(!1)},children:`Cancel`}),t(J,{size:`sm`,onClick:()=>{i(s),o(!1)},children:`Apply`})]})})]})})]})};function Cr({selectedView:r,selectedDate:i,setSelectedDate:a,setFilters:o,filters:s,handleClose:c,filterGroups:l}){let{t:u}=R(),[d,f]=L([null,null]),[p,m]=L([null,null]),h=l.find(e=>e.name===r),g=h?.multiple,_=new Date;_.setHours(23,59,59,999);let v=[p[0]||d[0],p[1]||d[1]],y=e=>{if(g)Array.isArray(e)?(m([e[0],e[1]]),f([e[0],e[1]])):(m([e,null]),f([e,null]));else{let t=Array.isArray(e)?e[0]:e;if(a(t||void 0),t){let e=new Date(t);e.setHours(0,0,0,0),o([...s,{name:r||``,placeholder:h?.placeholder,value:[{value:e.toISOString(),label:W(e).format(`LLL dd, y`)}],type:h?.type||`date`,multiple:h?.multiple||!1}]),c()}}};return t(`div`,{className:`p-2`,children:g?n(e,{children:[t(`div`,{children:g?v[0]&&v[1]?n(`span`,{className:`flex items-center gap-2`,children:[t(`span`,{className:`text-xs text-muted`,children:u(`filter.from`)}),t(`span`,{className:`text-xs font-medium`,children:W(v[0]).format(`MMMM DD, YYYY`)}),t(`span`,{className:`text-xs text-muted`,children:u(`filter.to`)}),t(`span`,{className:`text-xs font-medium`,children:W(v[1]).format(`MMMM DD, YYYY`)})]}):v[0]?n(`span`,{className:`flex items-center gap-2`,children:[t(`span`,{className:`text-xs text-muted`,children:u(`filter.from`)}),t(`span`,{className:`text-xs font-medium`,children:W(v[0]).format(`MMMM DD, YYYY`)}),t(`span`,{className:`text-xs text-muted`,children:`→ Select end date`})]}):t(`span`,{className:`text-muted text-xs`,children:h?.placeholder||h?.name||r||`Select date range`}):i?W(i).format(`MMMM DD, YYYY`):`Pick a date`}),n(`div`,{className:`calendar-wrapper`,children:[t(`style`,{children:hr}),t(Se,{value:v,onChange:y,selectRange:!0,returnValue:`range`,maxDate:_,className:`mb-2 border-0`,tileClassName:({date:e,view:t})=>{if(t===`month`){let t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return`text-muted/20 cursor-not-allowed`;if(v[0]){let e=v[0].getTime();if(v[1]){let n=v[1].getTime();if(t===e)return`bg-primary text-primary-foreground rounded-s-md font-semibold`;if(t===n)return`bg-primary text-primary-foreground rounded-e-md font-semibold`;if(t>e&&t<n)return`bg-primary/20 text-primary font-medium`}else if(t===e)return`bg-primary text-primary-foreground rounded-md font-semibold`}}return``}},`${v[0]?.getTime()}-${v[1]?.getTime()}`)]}),t(`div`,{className:`border-t pt-2`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:c,children:`Cancel`}),t(J,{size:`sm`,onClick:()=>{if(d[0]){let e=new Date(d[0]),t=d[1]?new Date(d[1]):new Date(d[0]);e.setHours(0,0,0,0),t.setHours(23,59,59,999);let n=[];n.push({value:e.toISOString(),label:W(e).format(`LLL dd, y`)}),d[1]&&d[0].getTime()!==d[1].getTime()&&n.push({value:t.toISOString(),label:W(t).format(`LLL dd, y`)}),o([...s,{name:r||``,placeholder:h?.placeholder,value:n,type:h?.type||`date`,multiple:h?.multiple||!1}]),c()}},disabled:!v[0],children:`Apply`})]})})]}):n(`div`,{className:`calendar-wrapper`,children:[t(`style`,{children:hr}),t(Se,{value:i,onChange:y,selectRange:!1,maxDate:_,className:`mb-2 border-0`,tileClassName:({date:e,view:t})=>{if(t===`month`){let t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return`text-muted/20 cursor-not-allowed`;if(i&&t===i.getTime())return`bg-primary text-primary-foreground rounded-md font-semibold`}return``}})]})})}function wr({selectedView:e,commandInput:r,setFilters:i,handleClose:a,filterGroups:o}){let[s,c]=L([]),l=e=>{let t=o.find(t=>t.name===e);if(!t)return[];let n=t.options||[];if(!r.trim())return n;if(t.filterBy){let e=r.toLowerCase();return n.filter(n=>n.value===void 0?!1:t.filterBy?.(n.value,e))}let i=r.toLowerCase();return n.filter(e=>String(e.value||``).toLowerCase().includes(i))};if(!e)return null;let u=l(e),d=o.find(t=>t.name===e),f=d?.placeholder||d?.name,p=()=>{s.length>0&&i(t=>[...t.filter(t=>t.name!==e),{name:e||``,placeholder:d?.placeholder||``,value:s,type:d?.type||`select`,multiple:d?.multiple||!1}]),a()},m=t=>{let n={value:t.value,label:t.label};d?.multiple?s.some(e=>e.value===t.value)?c(e=>e.filter(e=>e.value!==t.value)):c(e=>[...e,n]):(i(t=>{let r=t.findIndex(t=>t.name===e);if(r>=0){let e=[...t];return e[r]={...e[r],value:[n]},e}else return[...t,{name:e||``,placeholder:d?.placeholder||``,value:[n],type:d?.type||`select`,multiple:d?.multiple||!1}]}),a())};return n(`div`,{className:`flex flex-col h-full`,children:[t(`div`,{className:`flex items-center p-1.5 text-xs text-muted shrink-0`,children:t(`span`,{children:f})}),t(`div`,{className:`flex-1 overflow-hidden min-h-0`,children:t(`div`,{className:`max-h-[200px] overflow-y-auto`,children:u.length>0&&u.map(e=>{let r=s.some(t=>t.value===e.value);return n(X,{className:`group flex gap-2 items-center w-full hover:bg-muted ${d?.multiple&&r?`bg-muted`:``}`,onSelect:()=>m(e),children:[t(_r,{value:e.value||``,labelRenderer:e.labelRenderer||d?.labelRenderer,fallbackLabel:e.label}),d?.multiple&&r&&t(`span`,{className:`ms-auto text-xs text-success`,children:`✓`})]},e.value||`option-${Math.random()}`)})})}),d?.multiple&&t(`div`,{className:`p-2 border-t shrink-0`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:a,children:`Cancel`}),t(J,{size:`sm`,onClick:p,disabled:s.length===0,children:`Apply`})]})})]})}function Tr({selectedView:e,setFilters:r,handleClose:i,filterGroups:a}){let[o,s]=L([]),c=a.find(t=>t.name===e);return n(`div`,{className:`p-2 space-y-3`,children:[t(`div`,{className:`space-y-2`,children:t(Ht,{value:o,onChange:s,placeholder:c?.placeholder||`Add ${e}...`,autoFocus:!0})}),n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:i,children:`Cancel`}),t(J,{size:`sm`,onClick:()=>{o.length>0&&r(t=>[...t.filter(t=>t.name!==e),{name:e,placeholder:c?.placeholder,value:o,type:`stringList`}]),i()},disabled:o.length===0,children:`Apply`})]})]})}function Er({selectedView:e,textValue:r,setTextValue:i,setFilters:a,handleClose:o,filterGroups:s}){let c=()=>{a(t=>[...t,{name:e||``,placeholder:s.find(t=>t.name===e)?.placeholder,value:[{value:r,label:r}],type:`text`}]),o()};return n(`div`,{className:`p-2 flex flex-col gap-1`,children:[t(`div`,{className:`flex items-center p-1.5 text-xs text-muted`,children:t(`span`,{children:s.find(t=>t.name===e)?.placeholder})}),t(xr,{autoFocus:!0,type:`text`,size:`sm`,value:r,onChange:i,onKeyDown:e=>e.key===`Enter`&&c(),placeholder:`Enter text...`}),t(`div`,{className:`mt-2 p-2 border-t`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:o,children:`Cancel`}),t(J,{size:`sm`,onClick:c,disabled:!r.trim(),children:`Apply`})]})})]})}function Dr(e,n,r){switch(e.type){case`date`:return t(gr,{filterValues:Array.isArray(e.value)&&typeof e.value[0]==`object`?e.value.map(e=>e.value||``):[],isRange:e.multiple,setFilterValues:t=>{n(n=>n.map(n=>n===e?{...n,value:t.length>0?t.map(e=>({value:e,label:W(e).format(`LLL dd, y`)})):[]}:n))}});case`text`:return t(Sr,{filterType:e.placeholder||e.name,filterValue:Array.isArray(e.value)&&e.value[0]&&typeof e.value[0]==`object`&&e.value[0].value||``,setFilterValue:t=>{n(n=>n.map(n=>n===e?{...n,value:[{value:t,label:t}]}:n))}});case`stringList`:return t(yr,{filterType:e.placeholder||e.name,filterValues:Array.isArray(e.value)&&typeof e.value[0]==`string`?e.value:[],setFilterValues:t=>{n(n=>n.map(n=>n===e?{...n,value:t}:n))}});default:{let i=r.find(t=>t.name===e.name);return t(vr,{filterType:e.placeholder||e.name,filterValues:Array.isArray(e.value)&&typeof e.value[0]==`object`?e.value:[],setFilterValues:t=>{n(n=>n.map(n=>n===e?{...n,value:t}:n))},options:i?.options||[],labelRenderer:i?.labelRenderer,multiple:e.multiple??i?.multiple})}}}function Or({filters:e,setFilters:r,filterGroups:i}){return t(`div`,{className:`flex gap-2 flex-wrap justify-start`,children:e.filter(e=>e.value?.length>0).map(e=>n(`div`,{className:`flex gap-[1px] items-center text-sm`,children:[t(`div`,{className:`flex gap-1.5 shrink-0 rounded-s bg-muted p-1.5 h-8 items-center`,children:e.placeholder||e.name}),Dr(e,r,i),t(J,{variant:`ghost`,size:`icon`,onClick:()=>{r(t=>t.filter(t=>t!==e))},className:`bg-muted rounded-s-none rounded-e-sm size-8 hover:text-primary hover:bg-muted/50 transition shrink-0`,children:t(j,{className:`size-6`})})]},`${e.name}-${e.type===`date`?`date`:e.type===`stringList`&&typeof e.value[0]==`string`?e.value.join(`,`):Array.isArray(e.value)?e.value.map(e=>e.value).join(`,`):``}`))})}const kr=N.createContext({filters:[],setFilters:()=>void 0,filterGroups:[]}),Ar=({filters:e,setFilters:n,filterGroups:r,children:i,inModal:a})=>{let o=new URL(window.location.href).searchParams.toString(),[s]=N.useState(()=>new URLSearchParams(window.location.search).get(`filters`)),c=N.useRef(new Set),l=N.useRef(a||!s);return F(()=>{if(!a&&l.current)try{let t=new URLSearchParams(o);if(e.length>0){let n=e.map(e=>{let t;if(e.type===`stringList`&&Array.isArray(e.value)&&typeof e.value[0]==`string`)t=`[${e.value.map(e=>encodeURIComponent(e)).join(`,`)}]`;else if(Array.isArray(e.value))if(e.multiple)t=`[${e.value.map(e=>encodeURIComponent(Pr(e))).join(`,`)}]`;else if(e.value.length>1)t=`[${e.value.map(e=>encodeURIComponent(Pr(e))).join(`,`)}]`;else{let n=e.value[0];t=typeof n==`string`?encodeURIComponent(n):typeof n==`object`&&n?.value!==void 0?encodeURIComponent(String(n.value)):encodeURIComponent(String(n||``))}else t=encodeURIComponent(e.value||``);return`${encodeURIComponent(e.name)}:${t}`}).join(`;`);t.set(`filters`,n)}else t.delete(`filters`);let n=`${window.location.pathname}?${t.toString()}${window.location.hash}`;window.history.replaceState(window.history.state||{},``,n)}catch(e){console.error(`Failed to update URL with filters:`,e)}},[e,a,o]),F(()=>{if(!(a||!s||r.length===0))try{let e=s.split(`;`),t=[];for(let n of e){let e=n.indexOf(`:`);if(e===-1)continue;let i=n.slice(0,e),a=n.slice(e+1),o=decodeURIComponent(i);if(c.current.has(o))continue;let s=r.find(e=>e.name===o);if(!s)continue;c.current.add(o);let l;if(a.startsWith(`[`)&&a.endsWith(`]`)){let e=a.slice(1,-1);l=e?e.split(`,`).map(e=>decodeURIComponent(e)):[]}else l=[decodeURIComponent(a)];let u;u=s.type===`stringList`?l:s.type===`text`?l.length===1?[{value:l[0],label:l[0]}]:l.map(e=>({value:e,label:e})):l.map(e=>{let t=s.options?.find(t=>t.value===e),n=e;return t?.label?n=String(t.label):t?.labelRenderer?n=String(t.labelRenderer(e)):s.labelRenderer&&(n=String(s.labelRenderer(e))),{value:e,label:n}}),s.multiple&&!a.startsWith(`[`)&&!a.endsWith(`]`)&&(s.type===`stringList`?u=l:Array.isArray(u)||(u=[u])),t.push({name:o,type:s.type,placeholder:s.placeholder,value:u,multiple:s.multiple})}t.length>0&&n(e=>{let n=new Set(t.map(e=>e.name));return[...e.filter(e=>!n.has(e.name)),...t]}),l.current=!0}catch{}},[r,a,s,n]),t(kr.Provider,{value:{filters:e,setFilters:n,filterGroups:r},children:i})},jr=({className:e})=>{let{filters:r,setFilters:i,filterGroups:a}=N.useContext(kr),{t:o}=R(),[s,c]=N.useState(!1),[l,u]=N.useState(null),[d,f]=N.useState(``),p=N.useRef(null),[m,h]=N.useState(),[g,_]=N.useState(``),v=e=>{u(e),f(``),p.current?.focus()},y=()=>{let e=a.map(e=>({...e,options:(e.options??[]).filter(t=>!r.some(n=>n.type===`date`?n.name===e.name:n.name===e.name&&(Array.isArray(n.value)&&typeof n.value[0]==`string`?n.value.some(e=>e===t.value):n.value.some(e=>Pr(e)===t.value))))})).filter(e=>(e.options??[]).length>0||e.type===`date`&&!r.some(t=>t.name===e.name)||e.type===`text`&&!r.some(t=>t.name===e.name)||e.type===`stringList`&&!r.some(t=>t.name===e.name));return e.length===0?t(Bn,{children:o(`filter.noAvailableFilters`)}):e.map(e=>t(X,{onSelect:()=>v(e.name),className:`group flex gap-2 items-center hover:bg-muted`,children:t(`span`,{children:e.placeholder??e.name})},e.name))},x=()=>{c(!1),setTimeout(()=>{u(null),f(``),h(void 0)},200)};return n(Z,{_open:s,onOpenChange:e=>{c(e),e||setTimeout(()=>{u(null),f(``),_(``)},200)},children:[t(Q,{asChild:!0,children:n(J,{variant:`outline`,role:`combobox`,"aria-expanded":s,size:`md`,className:q(`transition group flex gap-1.5`,e),children:[t(b,{className:`size-4 shrink-0 transition-all text-muted`}),o(`filter.filter`)]})}),t($,{className:`w-[300px] p-0`,align:`start`,sideOffset:4,children:n(In,{children:[a.find(e=>e.name===l)?.type===`select`&&t(Rn,{placeholder:l?o(`filter.filterBy`,{view:l}):o(`filter.filterPlaceholder`),className:`h-9 ring-0`,value:d,onValueChange:e=>{f(e)},ref:p,autoFocus:!0}),t(zn,{children:t(Y,{children:l?(()=>{if(!l)return null;switch(a.find(e=>e.name===l)?.type){case`date`:return t(Cr,{selectedView:l,selectedDate:m,setSelectedDate:h,setFilters:i,filters:r,handleClose:x,filterGroups:a});case`text`:return t(Er,{selectedView:l,textValue:g,setTextValue:_,setFilters:i,handleClose:x,filterGroups:a});case`stringList`:return t(Tr,{selectedView:l,setFilters:i,handleClose:x,filterGroups:a});default:return t(wr,{selectedView:l,commandInput:d,setFilters:i,handleClose:x,filterGroups:a})}})():y()})})]})})]})},Mr=({className:e})=>{let{filters:n,setFilters:r,filterGroups:i}=N.useContext(kr);return t(`div`,{className:q(e),children:t(Or,{filters:n,setFilters:r,filterGroups:i})})},Nr=({className:e})=>{let{filters:n,setFilters:r}=N.useContext(kr),{t:i}=R();return n.filter(e=>e.value?.length>0).length>0?t(J,{variant:`outline`,size:`md`,className:q(`transition group`,e),onClick:()=>r([]),children:i(`filter.clearAll`)}):null};function Pr(e){return typeof e==`string`?e:e.value||``}var Fr;(function(e){e.IS=`is`,e.IS_NOT=`is_not`,e.CONTAINS=`contains`,e.BEFORE=`before`,e.AFTER=`after`,e.IS_ANY_OF=`is_any_of`})(Fr||={});const Ir=oe(({className:e,level:n=3,...r},i)=>t(`h${n}`,{ref:i,className:q({h1:`text-2xl font-medium tracking-tight`,h2:`text-xl font-medium tracking-tight`,h3:`text-lg font-medium`,h4:`text-base font-medium`,h5:`text-sm font-medium`,h6:`text-xs font-medium`}[`h${n}`],`mb-2`,e),...r}));Ir.displayName=`Heading`;function Lr({options:i,optionLabel:s,groupBy:c,value:l,onChange:u,addNew:d,addNewLabel:f,disabled:p,filterBy:h,label:g,placeholder:_,className:v,popupClass:y,isClearable:b,border:x=!0,multiple:C=!1,by:w,inline:T=!1,isLoading:E=!1,warnOnMissingValue:D=!0,missingValueWarning:A=`Value not in options list, may not be valid`,clearIcon:ee,clearTitle:te,"aria-label":M,"aria-labelledby":N,id:ne,"aria-describedby":re,"aria-invalid":ie}){let ae=I(null),[oe,se]=L(!1),[ce,P]=L(0),[ue,fe]=L(``),pe=le(),me=le(),he=de(()=>!D||C||l==null||!i?!1:!i.some(e=>typeof w==`string`?Rr(e,w)===Rr(l,w):typeof w==`function`?w(e,l):Ce(e,l)),[D,C,l,i,w]);F(()=>{let e=ae.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect().width;P(t)},n=new ResizeObserver(()=>{t()});return t(),n.observe(e),()=>{n.disconnect()}},[]);let R=e=>{if(C){let t=Array.isArray(l)?l:[];z(e,t)?u(t.filter(t=>!ge(t,e))):u([...t,e])}else u(e)},z=(e,t)=>!t||t.length===0?!1:t.some(t=>ge(t,e)),ge=(e,t)=>e==null||t==null?e===t:typeof w==`string`?Rr(e,w)===Rr(t,w):typeof w==`function`?w(e,t):Ce(e,t),B=i||[];function _e(e){return e?typeof e==`string`?t=>String(Rr(t,e)).toLowerCase():e:e=>String(e).toLowerCase()}let ve=ue.toLowerCase(),ye=_e(h);B=B.filter(e=>ye(e).includes(ve));let be=()=>{if(!l||Array.isArray(l)&&l.length===0)return t(`span`,{className:`text-muted`,children:_});let e=Array.isArray(l)?l[0]:l;return s?s(e):e},xe=()=>{let e=Array.isArray(l)?l:l?[l]:[];return e.length===0?t(`span`,{className:`text-muted`,children:_}):e.length===1?s?s(e[0]):e[0]:n(`div`,{className:`flex flex-wrap gap-1`,children:[e.slice(0,1).map((e,n)=>t(`span`,{className:`inline-flex items-center gap-1 px-2 py-1 text-xs bg-muted rounded`,children:s?s(e):e},`chip-${n}`)),e.length>1&&n(`span`,{className:`inline-flex items-center px-2 py-1 text-xs bg-muted rounded`,children:[`+`,e.length-1,` more`]})]})},V=(e,r)=>{let i=C?z(e,Array.isArray(l)?l:[]):l==null?!1:ge(l,e);return t(X,{onSelect:()=>R(e),className:`w-full`,children:C||T?n(`div`,{className:`w-full flex justify-between items-center cursor-pointer`,children:[t(`div`,{className:`w-full truncate text-start`,children:s?s(e):e}),i&&t(o,{className:`size-4`})]}):n(pr,{className:`w-full flex justify-between items-center`,children:[t(`div`,{className:`w-full truncate text-start`,children:s?s(e):e}),i&&t(o,{className:`size-4`})]})},`option-${r}`)},H=(()=>{if(!c)return null;let e=[],t=new Map;for(let n of B){let r=c(n),i=t.get(r);i||(i=[],t.set(r,i),e.push({key:r,items:i})),i.push(n)}return e})(),U=()=>n(e,{children:[h&&n(`div`,{className:`flex justify-start items-center mb-1`,children:[t(`div`,{className:`mx-2`,children:t(O,{className:`size-4`})}),t(xr,{variant:`unstyled`,value:ue,onChange:fe,className:`w-full p-1 rounded-md`,placeholder:`Search...`})]}),t(In,{className:`overflow-hidden`,children:n(zn,{className:T?`max-h-full overflow-y-auto`:`max-h-[200px] overflow-y-auto`,onWheel:e=>{e.currentTarget.scrollTop+=e.deltaY},children:[t(Bn,{children:`No result found.`}),H?H.map(e=>t(Y,{heading:e.key,className:`[&_[cmdk-group-heading]]:text-muted [&_[cmdk-group-heading]]:border-b [&_[cmdk-group-heading]]:border-border [&_[cmdk-group-heading]]:ml-[-0.5rem] [&_[cmdk-group-heading]]:text-xs`,children:e.items.map((t,n)=>V(t,`${e.key}-${n}`))},e.key)):t(Y,{children:B?.map((e,t)=>V(e,t))})]})}),d&&t(`div`,{className:`p-1`,children:n(`button`,{type:`button`,onClick:d,className:r(`w-full text-start gap-x-2 px-2 py-1.5 truncate group flex rounded-md items-center text-sm cursor-pointer hover:bg-accent bg-transparent border-0`),children:[t(k,{size:16,strokeWidth:1.25,absoluteStrokeWidth:!0}),f]})})]});if(T)return t(`div`,{className:r(v,x&&`border border-border rounded-md`,`bg-popover p-1`,y),children:E?t(`div`,{className:`flex justify-center items-center p-2 text-muted text-sm`,children:t(S,{className:`size-4 animate-spin`})}):U()});let W=!!g,Se=M??(W?void 0:typeof _==`string`?_:void 0),G=N??(W?me:void 0),we=!!b&&!!l&&(Array.isArray(l)?l.length>0:!0),Te=ie===!0||ie===`true`||he?!0:ie===!1||ie===`false`?!1:void 0;return n(Z,{onOpenChange:se,children:[n(`div`,{ref:ae,className:r(`relative`,v),children:[t(Q,{asChild:!0,children:t(`button`,{type:`button`,id:ne,disabled:p||E,"aria-haspopup":`dialog`,"aria-expanded":oe,"aria-controls":pe,"aria-label":Se,"aria-labelledby":G,"aria-describedby":re,"aria-invalid":Te,className:r(E?`flex w-full justify-center items-center gap-2 border border-border rounded-md p-2 text-muted text-sm bg-transparent`:r(x&&(he||Te?`border border-destructive`:`border border-border`),`flex w-full flex-row gap-2 items-center justify-between p-2 rounded-md group bg-transparent text-inherit text-start`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,p?`cursor-not-allowed text-muted`:`cursor-pointer hover:bg-muted`,we&&`pe-10`)),children:E?t(S,{className:`size-4 animate-spin`}):n(e,{children:[n(`div`,{className:r(`flex flex-col w-full rounded-md text-sm min-h-6 items-center justify-center truncate`),children:[g&&t(`div`,{id:me,className:`w-full text-start text-xs font-semibold`,children:g}),n(`div`,{className:r(`w-full text-start `,he&&`text-destructive`),children:[he&&t(vt,{description:A,placement:`top`,asChild:!0,children:t(a,{className:`inline-block size-4 me-1 -mt-0.5 cursor-help`})}),C?xe():be()]})]}),!p&&t(m,{className:`size-4 opacity-50 shrink-0`,"aria-hidden":`true`})]})})}),we&&!E&&t(J,{variant:`link`,size:`icon`,disabled:p,"aria-label":te||`Clear selection`,onClick:e=>{e.stopPropagation(),u(C?[]:void 0)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},className:`absolute end-8 top-1/2 -translate-y-1/2 hover:bg-muted/20 rounded p-1`,children:ee||t(j,{className:`size-4`})})]}),t($,{id:pe,style:{width:`${ce}px`,zIndex:1e6},className:r(`min-w-[8rem] w-64 bg-popover p-1 border shadow`,`divide-y divide-border`,y),children:U()})]})}function Rr(e,t){return typeof e==`object`&&e?e[t]:void 0}const zr={ar:`العربية`,de:`Deutsch`,en:`English`,es:`Español`,fr:`Français`,it:`Italiano`,ja:`日本語`,ko:`한국어`,pt:`Português`,ru:`Русский`,tr:`Türkçe`,zh:`中文`,"zh-TW":`繁體中文`};function Br({label:e,className:r}={}){let{language:i,setLanguage:a}=he(),{t:o}=R(),s=e===!1?!1:e??o(`language.label`);return n(`div`,{className:r??(s?`flex justify-between px-2 items-center gap-3`:`flex items-center`),children:[s&&t(`p`,{className:`text-sm font-semibold`,children:s}),t(Lr,{options:me,value:i,onChange:e=>a(e),optionLabel:e=>zr[e],placeholder:o(`language.placeholder`),isClearable:!1,warnOnMissingValue:!1,className:`min-w-40`})]})}const Vr=z(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),Hr=M.forwardRef(({className:e,required:r,...i},a)=>n(we.Root,{ref:a,className:q(Vr(),e),...i,children:[i.children,r&&t(`span`,{className:`text-destructive-foreground ms-1`,children:`*`})]}));Hr.displayName=we.Root.displayName;function Ur({icon:e,status:r,title:i,children:o,className:s}){let c,l,u,d;switch(r){case`error`:c=t(g,{className:`size-5 text-destructive`,"aria-hidden":`true`}),l=`text-destructive`,u=`text-foreground`,d=`bg-destructive border border-destructive`;break;case`warning`:c=t(a,{className:`size-5 text-attention`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-attention border border-attention`;break;case`success`:c=t(h,{className:`size-5 text-success`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-success border border-success`;break;case`info`:c=t(y,{className:`size-5 text-info`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-info border border-info`;break;case`default`:c=t(y,{className:`size-5 text-muted`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-muted border border-muted`;break;case`done`:c=t(y,{className:`size-5 text-done`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-done border border-done`;break}return t(`div`,{className:`rounded-md p-4 ${d} ${s}`,children:n(`div`,{className:`flex`,children:[t(`div`,{className:`shrink-0`,children:e??c}),n(`div`,{className:`w-full ms-2 px-1`,children:[i&&t(`h3`,{className:`text-md font-medium mb-2 ${l}`,children:i}),t(`div`,{className:`text-sm ${u} break-words`,children:o})]})]})})}function Wr({title:e,className:r,children:i,action:a,actionLabel:o}){return n(Ur,{status:`error`,title:e,className:`${r} flex flex-col items-center justify-center text-center`,children:[t(`pre`,{className:`whitespace-pre-wrap break-words`,children:i}),a&&o&&t(J,{onClick:a,variant:`ghost`,size:`sm`,className:`mt-4`,children:o})]})}function Gr({title:e,className:n,children:r}){return t(Ur,{status:`info`,title:e,className:n,children:r})}function Kr({title:e,className:n,children:r}){return t(Ur,{status:`warning`,title:e,className:n,children:r})}function qr({title:e,className:n,children:r}){return t(Ur,{status:`success`,title:e,className:n,children:r})}function Jr({title:e,className:n,children:r}){return t(Ur,{status:`default`,title:e,className:n,children:r})}function Yr({title:e,content:r,onConfirm:i,onCancel:a,isOpen:o,isLoading:s,confirmationValue:c,confirmationLabel:l,confirmationPlaceholder:u}){let{t:d}=R(),f=I(null),[p,m]=L(``);F(()=>{o||m(``)},[o]);let h=!!c,g=!c||p.trim()===c.trim(),_=()=>{!g||s||i()};return n(wn,{isOpen:o,onClose:a,description:`Confirm Modal`,children:[n(`div`,{className:`sm:flex sm:items-start p-2`,children:[t(`div`,{className:`mx-auto flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10`,children:t(ee,{className:`size-6 text-red-600`,"aria-hidden":`true`})}),n(`div`,{className:`mt-3 text-center sm:ms-4 sm:mt-0 sm:text-start`,children:[t(Tn,{className:`leading-6`,show:!0,children:e}),t(`div`,{className:`mt-2`,children:t(`div`,{className:`prose text-sm text-gray-500`,children:r})})]})]}),h&&t(`div`,{className:`px-2 pb-2 text-start`,children:t(Ft,{label:l??u,children:t(xr,{autoFocus:!0,value:p,onChange:m,placeholder:u,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),_())}})})}),n(Dn,{align:`right`,children:[t(J,{variant:`destructive`,onClick:_,isLoading:s,disabled:!g,children:d(`modal.confirm`)}),t(J,{variant:`outline`,onClick:a,ref:f,children:d(`modal.cancel`)})]})]})}function Xr(){return P(Zr)}const Zr=ae(()=>{}),Qr={success:h,error:g,warning:a,info:y},$r={success:`text-success`,error:`text-destructive`,warning:`text-attention`,info:`text-info`};function ei({data:e,onClose:r}){let[i,a]=L(!0),o=I(null),s=ce(()=>{o.current&&=(globalThis.clearTimeout(o.current),null)},[]),c=ce(()=>{s(),e.duration&&(o.current=setTimeout(()=>a(!1),e.duration))},[s,e.duration]);F(()=>(c(),s),[s,c]);let l=Qr[e.status]||y,u=$r[e.status]||`text-info`;return t(`div`,{"aria-live":`assertive`,className:`pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6 z-100`,children:t(`div`,{className:`flex w-full flex-col items-center space-y-4 sm:items-end`,children:t(ve,{onExitComplete:r,children:i&&t(ye.div,{className:`pointer-events-auto w-full max-w-md overflow-hidden rounded-lg bg-muted shadow-lg ring-1 ring-border`,initial:{opacity:0,x:8},animate:{opacity:1,x:0,transition:{ease:`easeOut`,duration:.7}},exit:{opacity:0,transition:{ease:`easeIn`,duration:.3}},onMouseEnter:s,onMouseLeave:c,children:t(`div`,{className:`p-5`,children:n(`div`,{className:`flex items-start`,children:[t(`div`,{className:`shrink-0`,children:t(l,{className:`size-6 ${u}`,"aria-hidden":`true`})}),n(`div`,{className:`ms-3 flex-1 pt-0.5 min-w-0`,children:[t(`p`,{className:`text-sm font-semibold text-foreground break-words`,children:e.title}),e.description&&t(`p`,{className:`mt-2 text-sm text-muted break-words whitespace-pre-wrap leading-relaxed`,children:e.description})]}),t(`div`,{className:`ms-4 flex shrink-0`,children:n(`button`,{type:`button`,className:`inline-flex rounded-md bg-muted text-muted hover:text-foreground focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background`,onClick:()=>a(!1),children:[t(`span`,{className:`sr-only`,children:`Close`}),t(j,{className:`size-5`,"aria-hidden":`true`})]})})]})})})})})})}function ti({children:r}){let[i,a]=L(null),o=ce(e=>{a(e)},[]);return n(e,{children:[t(Zr.Provider,{value:o,children:r}),i&&t($t,{children:t(ei,{data:i,onClose:()=>o(null)})})]})}function ni({idToDelete:e,title:n,content:r,setIdToDelete:i,deleteApi:a}){let{t:o}=R(),s=Xr();return t(Yr,{title:n,content:r,isOpen:!!e,onConfirm:async()=>{if(e)return a(e).then(()=>{s({title:o(`modal.delete.succeeded`),status:`success`})}).catch(e=>{s({title:o(`modal.delete.failed`),description:e instanceof Error?e.message:o(`modal.delete.error`),status:`error`})}).finally(()=>{i(void 0)})},onCancel:()=>{i(void 0)}})}function ri({children:r,action:i,title:a,description:o,footer:s,className:l,collapsible:u,defaultCollapsed:d=!1,size:p=`md`,clickableHeader:m=!1}){let[h,g]=L(d),_=u&&m,v=p===`sm`,b=v||_,x=t(h?c:f,{className:`size-4 text-muted`}),S=n(e,{children:[n(`div`,{className:`flex items-center gap-2`,children:[t(`div`,{className:`font-semibold ${v?`text-sm`:`text-lg`}`,children:a}),o&&t(vt,{description:o,children:t(y,{className:`size-4 text-muted`})})]}),n(`div`,{className:`flex gap-2 items-center`,children:[i,u&&(_?x:t(J,{variant:`ghost`,size:`icon`,onClick:()=>g(!h),children:x}))]})]}),C=v?`px-4 py-2`:`px-4 py-3`,w=v?`px-4 pt-3 pb-3`:`p-4`,T=v?`px-4 pb-3`:`px-4 pb-4`;return n(`div`,{className:`flex flex-col ${b?``:`p-4 gap-2`} rounded-sm border bg-card ${_?`overflow-hidden`:``} ${l??``}`,children:[_?t(`button`,{type:`button`,className:`w-full flex items-center justify-between ${C} hover:bg-muted/50 transition-colors`,onClick:()=>g(!h),children:S}):t(`div`,{className:`flex items-center justify-between ${b?C:``}`,children:S}),!h&&(b?t(`div`,{className:w,children:r}):r),s&&t(`div`,{className:`border-t border-muted flex flex-col-2 text-sm pt-4 ${b?T:``}`,children:s})]})}function ii({className:e,...n}){return t(Te.Item,{"data-slot":`radio-group-item`,className:q(`border-input dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 dark:aria-invalid:border-destructive/50 flex size-4 rounded-full focus-visible:ring-3 aria-invalid:ring-3 group/radio-group-item peer relative aspect-square shrink-0 border outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50`,e),...n,children:t(Te.Indicator,{"data-slot":`radio-group-indicator`,className:`flex size-4 items-center justify-center`,children:t(`span`,{className:`bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full`})})})}var ai=class{descriptionOf(e){}selectedClassName(e){return`border-accent-foreground`}};function oi({onSelect:e,selected:r,options:i,adapter:a}){let o=e=>a?a.idOf(e):e.id,s=e=>a?a.labelOf(e):e.label,c=e=>a?a.descriptionOf(e):e.description,l=e=>a?a.selectedClassName(e):`border-primary`;return t(Te.Root,{"data-slot":`radio-group`,value:r?o(r):void 0,onValueChange:t=>{let n=i.find(e=>o(e)===t);n&&e(n)},className:`space-y-4`,children:i.map(e=>{let i=r?o(r)===o(e):!1;return t(Te.Item,{value:o(e),className:q(`relative block w-full cursor-pointer rounded-lg border border-border bg-accent px-6 py-4 shadow-2xs text-start`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`sm:flex sm:justify-between`,i&&l(e)),children:t(`span`,{className:`flex items-center`,children:n(`span`,{className:`flex flex-col text-sm`,children:[t(`span`,{className:`font-medium text-text`,children:s(e)}),c(e)&&t(`span`,{className:`text-muted-foreground`,children:c(e)})]})})},o(e))})})}function si({className:e,direction:n=`horizontal`,orientation:r,...i}){let a=r??n;return t(Ee.Group,{"data-slot":`resizable-panel-group`,"data-panel-group-direction":a,orientation:a,className:q(`flex h-full w-full data-[panel-group-direction=vertical]:flex-col`,e),...i})}function ci(e){return typeof e==`number`?`${e}%`:e}function li({defaultSize:e,minSize:n,maxSize:r,collapsedSize:i,...a}){return t(Ee.Panel,{"data-slot":`resizable-panel`,defaultSize:ci(e),minSize:ci(n),maxSize:ci(r),collapsedSize:ci(i),...a})}function ui({withHandle:e,className:n,...r}){return t(Ee.Separator,{"data-slot":`resizable-handle`,className:q(`bg-muted focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:start-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),...r,children:e&&t(`div`,{className:`z-10 flex size-4 items-center justify-center rounded-xs font-semibold`,children:t(C,{className:`size-4 rotate-90`})})})}const di=M.forwardRef(({className:e,orientation:n=`horizontal`,decorative:r=!0,...i},a)=>t(De.Root,{ref:a,decorative:r,orientation:n,className:q(`shrink-0 bg-border`,n===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...i}));di.displayName=De.Root.displayName;const fi=M.forwardRef(({className:e,trackClassName:r,rangeClassName:i,thumbClassName:a,value:o,defaultValue:s,min:c=0,max:l=100,"aria-label":u,...d},f)=>{let p=M.useId(),m=Array.isArray(o)?o.length:Array.isArray(s)?s.length:1,h=M.useMemo(()=>Array.from({length:Math.max(1,m)},(e,t)=>`${p}-thumb-${t}`),[p,m]);return n(Oe.Root,{ref:f,"data-slot":`slider`,value:o,defaultValue:s,min:c,max:l,...d,className:q(`relative flex w-full touch-none select-none items-center data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col`,e),children:[t(Oe.Track,{"data-slot":`slider-track`,className:q(`relative h-1.5 w-full grow overflow-hidden rounded-full bg-muted data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5`,r),children:t(Oe.Range,{"data-slot":`slider-range`,className:q(`absolute h-full bg-primary data-[orientation=vertical]:w-full`,i)})}),h.map(e=>t(Oe.Thumb,{"data-slot":`slider-thumb`,"aria-label":u,className:q(`block size-3.5 rounded-full border border-primary bg-background shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,a)},e))]})});fi.displayName=Oe.Root.displayName;const pi={sm:[`h-5 w-8`,`size-3`,`translate-x-4 rtl:-translate-x-4`],md:[`h-6 w-11`,`size-4`,`translate-x-6 rtl:-translate-x-6`],lg:[`h-8 w-16`,`size-6`,`translate-x-9 rtl:-translate-x-9`]};function mi({className:e,size:r=`md`,value:i,onChange:a,children:o,disabled:s,...c}){let[l,u,d]=pi[r],f=t(ke.Root,{"data-slot":`switch`,checked:i,onCheckedChange:a,disabled:s,...c,className:q(`data-[state=checked]:bg-primary data-[state=unchecked]:bg-muted focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 shrink-0 rounded-full border focus-visible:ring-3 aria-invalid:ring-3 peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,l,!o&&e),children:t(ke.Thumb,{"data-slot":`switch-thumb`,className:q(`bg-white rounded-full pointer-events-none block ring-0 transition-transform`,u,i?d:`translate-x-1 rtl:-translate-x-1`)})});return o?n(`div`,{className:q(`flex items-center`,e),children:[f,t(`span`,{className:`px-2`,children:o})]}):f}const hi=M.createContext({size:void 0,tabs:void 0,current:void 0,setTab:void 0,responsive:!1,variant:`tabs`,updateHash:!0}),gi=({tabs:e,defaultValue:n,current:r,className:i,fullWidth:a,fullHeight:o,children:s,onTabChange:c,responsive:l=!1,variant:u=`tabs`,updateHash:d=!0})=>{let f=M.useMemo(()=>e.filter(e=>e.is_allowed===void 0||e.is_allowed===!0),[e]),[p,m]=M.useState(()=>{let e=typeof r==`function`?r():r;if(e)return e;let t=window.location.hash,i=t?t.substring(1):void 0;return i&&f.some(e=>e.name===i)?i:n||f[0]?.name});M.useEffect(()=>{let e=typeof r==`function`?r():r;e&&e!==p&&m(e)},[r,p]),M.useEffect(()=>{if(r)return;let e=()=>{let e=window.location.hash,t=e?e.substring(1):void 0;t&&f.some(e=>e.name===t)?m(t):!e&&n&&m(n)};return e(),window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[r,f,n]);let h=M.useCallback(e=>{if(m(e),d&&!r){let t=window.history.state,n=`${window.location.pathname+window.location.search}#${e}`;window.history.pushState(t,``,n)}c&&c(e)},[r,c,d]),g=M.useCallback(e=>{h(e)},[h]);return t(hi.Provider,{value:{tabs:f,size:a?f.length:0,current:p,setTab:g,responsive:l,variant:u,updateHash:d},children:t(K.Root,{defaultValue:p||f[0]?.name,value:p,onValueChange:h,className:q(`flex-1 flex flex-col min-h-0 px-2`,o&&`h-full`,i),children:s})})},_i=({className:r,sticky:i,direction:a})=>{let{tabs:o,size:s,current:c,setTab:l,responsive:u,variant:d,updateHash:f}=M.useContext(hi),p=s!==0,m=M.useCallback(e=>{if(!o||!l)return;let t=o.find(t=>t.name===e);if(t?.href&&f){let e=window.history.state;window.history.pushState(e,``,t.href)}l(e)},[o,l,f]);return!o||!l?(console.warn(`TabsBar: No tabs provided or setTab not available`),null):n(e,{children:[u&&t(`div`,{className:`px-2 block lg:hidden`,children:t(Lr,{label:`Tab`,className:q(i&&`sticky top-0 bg-background z-10`,r),options:o,optionLabel:e=>typeof e.label==`string`?e.label:String(e.label),value:o.find(e=>e.name===c),onChange:e=>{m(e.name)}})}),t(yi,{size:s,variant:d,className:q(p?`w-full`:``,i&&`sticky top-0 bg-background z-10`,a===`vertical`?`flex-col items-start`:`flex-row`,u?`hidden lg:flex`:``,r),children:o.map(e=>t(bi,{className:q(a===`vertical`?`w-full text-start`:``),value:e.name,disabled:e.disabled,href:e.href,variant:d,onClick:()=>m(e.name),children:e.label},e.name))})]})},vi=({className:n})=>{let{tabs:r}=M.useContext(hi);return r?t(e,{children:r.map(e=>t(xi,{value:e.name,className:n,children:e.content},e.name))}):null},yi=M.forwardRef(({className:e,size:n,variant:r=`tabs`,...i},a)=>t(hi.Provider,{value:{size:n,variant:r},children:t(K.List,{ref:a,className:q(r===`tabs`?`border-b -mb-px flex gap-4`:`flex gap-2 p-1 rounded-md`,e),...i})}));yi.displayName=K.List.displayName;const bi=M.forwardRef(({className:e,href:n,variant:r=`tabs`,...i},a)=>{let{size:o}=M.useContext(hi),s=M.useCallback(e=>{if(n){e.preventDefault();let t=window.history.state;window.history.pushState(t,``,n)}i.onClick&&i.onClick(e)},[n,i.onClick]);return t(K.Trigger,{ref:a,className:q(r===`tabs`?q(`border-b-2 px-2 py-1.5 text-sm font-medium whitespace-nowrap cursor-pointer`,`border-transparent text-muted-foreground hover:border-border hover:text-foreground`,`data-[state=active]:border-primary data-[state=active]:text-primary`,`disabled:pointer-events-none disabled:opacity-50`):q(`px-3 py-1.5 text-sm font-medium whitespace-nowrap cursor-pointer rounded-sm transition-colors`,`tborder border-input bg-muted shadow-xs hover:bg-muted ring-inset`,`data-[state=active]:bg-primary data-[state=active]:text-white data-[state=active]:shadow-sm`,`disabled:pointer-events-none disabled:opacity-50`),e,o?`w-1/${o}`:``),onClick:s,...i})});bi.displayName=K.Trigger.displayName;const xi=M.forwardRef(({className:e,...n},r)=>t(K.Content,{ref:r,className:q(`focus-visible:outline-none`,`flex-1 overflow-y-auto min-h-0 pt-2 pb-4`,e),...n}));xi.displayName=K.Content.displayName;const Si=z(`text-foreground`,{variants:{size:{xl:`text-base md:text-lg leading-relaxed`,lg:`text-base leading-relaxed`,default:`text-sm leading-normal`,sm:`text-sm leading-normal`,xs:`text-xs leading-normal`},weight:{normal:`font-normal`,medium:`font-medium`,semibold:`font-semibold`}},defaultVariants:{size:`default`,weight:`normal`}}),Ci=oe(({className:e,size:n,weight:r,...i},a)=>t(`p`,{ref:a,className:q(Si({size:n,weight:r,className:e})),...i}));Ci.displayName=`Text`;function wi({className:e,minLines:n,maxLines:r,value:i,...a}){let o=I(null),s=n!==void 0||r!==void 0,c=ce(()=>{let e=o.current;if(!e)return;let t=getComputedStyle(e),i=parseFloat(t.lineHeight)||parseFloat(t.fontSize)*1.5,a=(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0),s=(parseFloat(t.borderTopWidth)||0)+(parseFloat(t.borderBottomWidth)||0),c=n??1,l=r??1/0,u=c*i+a+s,d=l===1/0?1/0:l*i+a+s;e.style.height=`auto`;let f=Math.min(Math.max(e.scrollHeight,u),d);e.style.height=`${f}px`,e.style.overflowY=d!==1/0&&e.scrollHeight>d?`auto`:`hidden`},[n,r]);return ue(()=>{s&&c()}),t(`textarea`,{ref:o,"data-slot":`textarea`,value:i,className:q(`py-2 text-sm`,`flex w-full rounded-md border border-input bg-background ring-offset-background`,`placeholder:text-muted focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,s&&`resize-none`,e),...a})}const Ti=ae({theme:`system`,setTheme:()=>null});function Ei({children:e,defaultTheme:n=`system`,storageKey:r=`vite-ui-theme`,...i}){let[a,o]=L(()=>localStorage.getItem(r)||n);F(()=>{let e=window.document.documentElement;if(e.classList.remove(`light`,`dark`),a===`system`){let t=window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`;e.classList.add(t);return}e.classList.add(a)},[a]);let s={theme:a,setTheme:e=>{localStorage.setItem(r,e),o(e)}};return t(Ti.Provider,{...i,value:s,children:e})}const Di=()=>{let e=P(Ti);if(e===void 0)throw Error(`useTheme must be used within a ThemeProvider`);return e};function Oi({option:e,current:n,setTheme:r,icon:i,alt:a}){return t(J,{variant:n===e?`secondary`:`outline`,size:`sm`,onClick:()=>r(e),alt:a,children:i})}function ki({label:e,className:r}={}){let{setTheme:i,theme:a}=Di(),{t:o}=R(),s=e===!1?!1:e??o(`theme.label`);return n(`div`,{className:r??(s?`flex justify-between px-2 items-center`:`flex items-center gap-1`),children:[s&&t(`p`,{className:`text-sm font-semibold`,children:s}),n(`div`,{className:`flex gap-2`,children:[t(Oi,{current:a,option:`system`,setTheme:i,icon:t(_,{}),alt:o(`theme.system`)}),t(Oi,{current:a,option:`light`,setTheme:i,icon:t(A,{}),alt:o(`theme.light`)}),t(Oi,{current:a,option:`dark`,setTheme:i,icon:t(w,{}),alt:o(`theme.dark`)})]})]})}function Ai(e,n){return{label:String(e),check:t(n?o:`div`,{className:`size-4`}),reverse:!1,className:`flex-1 px-2 py-2 hover:bg-accent nowrap`}}function ji({value:e,options:i,onChange:a,className:o,optionLayout:s,by:c,noCheck:l,filterBy:u}){let{t:d}=R(),[f,p]=L(e),[m,h]=L(``),g=e=>{p(e),a(e)},_=de(()=>typeof c==`string`?(e,t)=>e[c]===t[c]:c||((e,t)=>e===t),[c]);return n(`div`,{className:r(``,o),children:[u&&t(xr,{type:`text`,placeholder:d(`form.filter`),value:m,onChange:e=>h(e)}),i.map((e,n)=>{if(u&&!u(m)(e))return null;let r=f?_(f,e):!1,i;return s?(i=s(e,r),i=Object.assign(Ai(e,r),i)):i=Ai(e,r),t(Mi,{option:e,onSelect:g,layout:i,noCheck:l},`option-${n}`)})]})}function Mi({option:e,onSelect:i,layout:a,noCheck:o}){return n(J,{variant:`unstyled`,size:`none`,className:r(`group !flex w-full items-center cursor-pointer gap-x-2 hover:bg-muted`,a.reverse&&`flex-row-reverse`,a.className),onClick:()=>i(e),children:[o?null:t(`div`,{className:``,children:a.check}),t(`div`,{className:`flex-1`,children:a.label})]})}function Ni({isOpen:e,title:r,onClose:i,children:a,panelWidth:o=768,backdrop:s=!1,side:c=`right`,resizable:l=!0,className:u,contentClassName:d}){let[f,p]=L(o),m=e=>{e.preventDefault();let t=!0,n=e.pageX,r=f,i=e=>{if(t){let t=n-e.pageX,i=Math.max(r+t,480);p(i)}},a=()=>{t=!1,document.removeEventListener(`mousemove`,i),document.removeEventListener(`mouseup`,a)};document.addEventListener(`mousemove`,i),document.addEventListener(`mouseup`,a)},h=c===`left`,g=h?`left-0`:`right-0`,_=h?`pr-10 sm:pr-16`:`pl-10 sm:pl-16`,v=h?`border-r`:`border-l`,y=h?`-right-1`:`-left-1`,b=h?`-100%`:`100%`;return t(ve,{children:e&&n(`div`,{className:`relative z-20`,children:[s&&t(ye.div,{className:`fixed inset-0 bg-black/70`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:i}),t(`div`,{className:`fixed inset-y-0 ${g} overflow-hidden`,children:t(`div`,{className:`absolute inset-0 overflow-hidden`,children:t(`div`,{className:`pointer-events-none fixed inset-y-0 ${g} flex max-w-full ${_}`,children:t(ye.div,{className:`pointer-events-auto ${v}`,style:{width:`${f}px`},initial:{x:b},animate:{x:0},exit:{x:b},transition:{type:`spring`,stiffness:300,damping:30},children:n(`div`,{className:`relative flex h-full`,children:[l&&t(`div`,{"aria-label":`Resize panel`,className:`absolute ${y} top-0 bottom-0 w-3 z-25 cursor-ew-resize hover:bg-indigo-500 transition-colors flex items-center justify-center`,onMouseDown:m,children:t(C,{className:`rotate-90 font-semibold`,strokeWidth:4})}),n(`div`,{className:`flex-1 min-w-0 flex flex-col bg-background shadow-xl ${u}`,children:[r&&t(`div`,{className:`sticky top-0 z-10 bg-background px-2 sm:px-4 py-2 border-b`,children:n(`div`,{className:`flex items-start justify-between`,children:[t(`h2`,{className:`w-full text-base font-semibold leading-6`,children:t(`div`,{className:`text-2xl`,children:r??``})}),t(`div`,{className:`ms-3 flex h-7 items-center`,children:t(Pi,{onClose:i})})]})}),t(`div`,{className:d??`flex-1 overflow-auto px-2 sm:px-4 py-4`,children:t(`div`,{className:`w-full h-full flex-1 flex flex-col`,children:a})})]})]})})})})})]})})}function Pi({onClose:e}){return t(J,{alt:`Close panel`,variant:`ghost`,onClick:e,children:t(j,{className:`size-6`,"aria-hidden":`true`})})}function Fi(e){switch(e){case`xs`:return`size-2`;case`sm`:return`size-3`;case`md`:return`size-4`;case`lg`:return`size-5`;case`xl`:return`size-7`;case`2xl`:return`size-10`;default:throw Error(`Unexpected size: ${e}`)}}function Ii({size:e,className:i}){return n(`svg`,{className:r(`animate-[spin_0.8s_linear_infinite] text-indigo-500`,Fi(e||`md`),i),xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,role:`img`,"aria-label":`Loading`,children:[t(`title`,{children:`Loading`}),t(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),t(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z`})]})}function Li({options:i,value:a,onChange:o,onOptionsChange:s,placeholder:c,className:l,disabled:u,layout:d=`horizontal`,creatable:f=!1,createText:p=`Create "%value%"`,maxDropdownHeight:m=200}){let h=P(ur),[g,_]=L(``),[v,y]=L(0),[b,x]=L(0),[S,C]=L(null),w=I(null),T=I(null),E=I(null),D=I(null),O=h?.open??!1,k=h?.setOpen??(()=>{});F(()=>{let e=T.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect().width;x(t)},n=new ResizeObserver(()=>{t()});return t(),n.observe(e),()=>{n.disconnect()}},[]);let A=i.filter(e=>!a.includes(e)&&e.toLowerCase().includes(g.toLowerCase())),ee=f&&g&&!a.includes(g)&&!i.includes(g),te=A.length+ +!!ee;F(()=>{g!==``&&C(null)},[g]),F(()=>{O&&v>=0&&D.current&&E.current&&D.current.scrollIntoView({block:`nearest`,behavior:`smooth`})},[v,O]),F(()=>{O?w.current?.focus():_(``)},[O]),F(()=>{if(!O)return;let e=e=>e instanceof Node&&(T.current?.contains(e)===!0||E.current?.contains(e)===!0),t=t=>{e(t.target)||k(!1)},n=t=>{e(t.target)||k(!1)},r=()=>{k(!1)};return document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`focusin`,n,!0),window.addEventListener(`blur`,r),document.addEventListener(`visibilitychange`,r),()=>{document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`focusin`,n,!0),window.removeEventListener(`blur`,r),document.removeEventListener(`visibilitychange`,r)}},[O,k]);let M=e=>{o([...a,e]),_(``),k(!1),y(0),C(null)},N=e=>{o([...a,e]),s&&!i.includes(e)&&s([...i,e]),_(``),k(!1),y(0),C(null)},ne=(e,t)=>{t.stopPropagation(),o(a.filter(t=>t!==e)),C(null)};return n(`div`,{className:r(`relative`,l),children:[t(Q,{asChild:!0,children:n(`div`,{ref:T,className:r(`min-h-[40px] w-full rounded-md border border-input bg-background px-3 py-2`,`flex items-center gap-1`,d===`horizontal`?`flex-wrap`:`flex-col items-stretch`,`cursor-text`,`ring-offset-background`,u&&`opacity-50 cursor-not-allowed`,O?`ring-1 ring-inset ring-ring`:``),onClick:()=>{u||w.current?.focus()},children:[d===`vertical`&&a.length>0&&t(`div`,{className:`flex flex-col gap-1 w-full`,children:a.map((e,i)=>n(`span`,{className:r(`inline-flex items-center justify-between gap-2 px-2 py-1 text-sm bg-primary/20 text-foreground ring-1 ring-primary/30 rounded-md w-full transition-all`,S===i&&`ring-2 ring-red-300 shadow-[0_0_8px_rgba(252,165,165,0.5)]`),children:[t(`span`,{className:`truncate`,children:e}),t(`button`,{type:`button`,onClick:t=>ne(e,t),disabled:u,className:`hover:bg-primary/30 rounded-sm transition-colors flex-shrink-0`,children:t(j,{className:`h-3 w-3`})})]},e))}),d===`horizontal`&&a.map((e,i)=>n(`span`,{className:r(`inline-flex items-center gap-1 px-2 py-1 text-sm bg-primary/20 text-foreground ring-1 ring-primary/30 rounded-md transition-all`,S===i&&`ring-2 ring-red-300 shadow-[0_0_8px_rgba(252,165,165,0.5)]`),children:[e,t(`button`,{type:`button`,onClick:t=>ne(e,t),disabled:u,className:`hover:bg-primary/30 rounded-sm transition-colors`,children:t(j,{className:`h-3 w-3`})})]},e)),t(`input`,{ref:w,type:`text`,value:g,onChange:e=>{_(e.target.value),y(0)},onKeyDown:e=>{if(e.key===`Enter`&&O&&te>0){e.preventDefault(),e.stopPropagation(),v===A.length&&ee?N(g):v<A.length&&M(A[v]);return}if(e.key===`ArrowDown`){e.preventDefault(),e.stopPropagation(),O?y(e=>e<te-1?e+1:e):k(!0);return}if(e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation(),O?y(e=>e>0?e-1:0):k(!0);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),k(!1);return}if(e.key===`Backspace`&&g===``&&a.length>0){e.stopPropagation();let t=a.length-1;S===t?(o(a.slice(0,-1)),C(null)):C(t);return}!O&&e.key.length===1&&k(!0)},onClick:e=>{e.stopPropagation(),u||k(!0)},onFocus:()=>{u||k(!0)},disabled:u,placeholder:a.length===0?c:``,className:r(`flex-1 min-w-[120px] bg-transparent text-sm`,`placeholder:text-muted-foreground`,`border-none outline-none focus:outline-none focus:ring-0 p-0 m-0`,d===`vertical`&&`w-full`)})]})}),t($,{style:{width:`${b}px`},className:`p-0 bg-popover border border-border shadow-lg`,align:`start`,side:`bottom`,onOpenAutoFocus:e=>{e.preventDefault()},children:t(`div`,{ref:E,className:`overflow-y-auto`,style:{maxHeight:`${m}px`},children:A.length===0&&!ee?t(`div`,{className:`px-3 py-2 text-sm text-muted-foreground`,children:g?`No options found`:`No more options available`}):n(e,{children:[A.length>0&&t(`ul`,{className:`py-1`,children:A.map((e,n)=>t(`li`,{ref:e=>{n===v&&(D.current=e)},role:`option`,"aria-selected":n===v,tabIndex:0,onClick:()=>M(e),onKeyDown:It(()=>M(e)),onMouseEnter:()=>y(n),className:r(`px-3 py-2 text-sm cursor-pointer transition-colors`,n===v?`bg-blue-500/20 text-foreground`:`hover:bg-accent/50`),children:e},e))}),ee&&n(e,{children:[A.length>0&&t(`div`,{className:`border-t border-border`}),t(J,{ref:e=>{v===A.length&&(D.current=e)},variant:`unstyled`,size:`none`,onClick:()=>N(g),onMouseEnter:()=>y(A.length),className:r(`!flex w-full justify-start px-3 py-2 text-sm cursor-pointer transition-colors text-primary`,v===A.length?`bg-blue-500/20`:`hover:bg-accent/50`),children:p.replace(`%value%`,g)})]})]})})})]})}function Ri(e){return t(Z,{click:!0,children:t(Li,{...e})})}function zi({className:e,children:n,...i}){return t(`table`,{className:r(`
|
|
90
90
|
divide-y divide-border
|
|
91
91
|
[&>tbody]:divide-y [&>tbody]:divide-border
|
|
92
92
|
[&_th]:text-start [&_th]:px-3 [&_th]:py-3.5 [&_th]:text-sm [&_th]:font-normal [&_th]:text-muted-foreground
|