mirror of
https://github.com/GlueOps/autoglue.git
synced 2026-02-13 12:50:05 +01:00
2 lines
59 KiB
JavaScript
2 lines
59 KiB
JavaScript
import{t as ht,m as ft,r as u,j as e,n as Ge,z as Ke,F as gt,C as pt,p as jt,q as bt,v as K,w as X,x as U,y as H,A as p,B as $,_ as ye,D as vt,T as wt,J as yt,E as Nt}from"./vendor-Cnbx_Mrt.js";import{S as me,R as St,a as qe,C as Je,b as We,T as Ye,D as Xe,P as Qe,O as Ze,c as Ct,d as kt,e as It,f as Et,g as _t,A as Ot,h as zt,i as Dt,j as At,k as Tt,l as Lt,m as Mt,n as Ft,I as $t,o as Rt,p as Pt,q as Vt,r as Bt,s as Ut,t as Ht,u as Gt,v as Kt,w as qt,x as Jt,y as Wt,z as Yt,B as Xt,E as Qt,V as Zt,F as es,G as ts,H as ss,J as as,K as ns,L as rs,M as is,N as os}from"./radix-DN_DrUzo.js";import{X as et,S as ls,M as ds,L as cs,C as re,H as us,A as ms,B as xs,a as hs,T as fs,b as gs,c as ps,d as js,K as bs,F as vs,e as ws,f as ys,g as Ns,U as $e,h as Ss,i as Cs,j as ks,k as Ne,l as Is,m as Es,n as Re,o as Se,P as _s,p as Os}from"./icons-CHRYRpwL.js";import{u as xe,L as J,O as Ce,N as ke,a as ne,b as tt,R as zs,c as N,B as Ds}from"./router-CyXg69m3.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const x of l.addedNodes)x.tagName==="LINK"&&x.rel==="modulepreload"&&n(x)}).observe(document,{childList:!0,subtree:!0});function a(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function n(o){if(o.ep)return;o.ep=!0;const l=a(o);fetch(o.href,l)}})();function c(...t){return ht(ft(t))}function Pe(t){return t.toLowerCase().trim().replace(/['"]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)+/g,"")}const fe=768;function As(){const[t,s]=u.useState(void 0);return u.useEffect(()=>{const a=window.matchMedia(`(max-width: ${fe-1}px)`),n=()=>{s(window.innerWidth<fe)};return a.addEventListener("change",n),s(window.innerWidth<fe),()=>a.removeEventListener("change",n)},[]),!!t}const Ie=Ge("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function g({className:t,variant:s,size:a,asChild:n=!1,...o}){const l=n?me:"button";return e.jsx(l,{"data-slot":"button",className:c(Ie({variant:s,size:a,className:t})),...o})}function z({className:t,type:s,...a}){return e.jsx("input",{type:s,"data-slot":"input",className:c("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...a})}function Z({className:t,orientation:s="horizontal",decorative:a=!0,...n}){return e.jsx(St,{"data-slot":"separator",decorative:a,orientation:s,className:c("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...n})}function Ts({...t}){return e.jsx(qe,{"data-slot":"sheet",...t})}function Ls({...t}){return e.jsx(Qe,{"data-slot":"sheet-portal",...t})}function Ms({className:t,...s}){return e.jsx(Ze,{"data-slot":"sheet-overlay",className:c("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...s})}function Fs({className:t,children:s,side:a="right",...n}){return e.jsxs(Ls,{children:[e.jsx(Ms,{}),e.jsxs(Je,{"data-slot":"sheet-content",className:c("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",a==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",a==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",a==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",a==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",t),...n,children:[s,e.jsxs(We,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[e.jsx(et,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function $s({className:t,...s}){return e.jsx("div",{"data-slot":"sheet-header",className:c("flex flex-col gap-1.5 p-4",t),...s})}function Rs({className:t,...s}){return e.jsx(Ye,{"data-slot":"sheet-title",className:c("text-foreground font-semibold",t),...s})}function Ps({className:t,...s}){return e.jsx(Xe,{"data-slot":"sheet-description",className:c("text-muted-foreground text-sm",t),...s})}function B({className:t,...s}){return e.jsx("div",{"data-slot":"skeleton",className:c("bg-accent animate-pulse rounded-md",t),...s})}function st({delayDuration:t=0,...s}){return e.jsx(Ct,{"data-slot":"tooltip-provider",delayDuration:t,...s})}function Vs({...t}){return e.jsx(st,{children:e.jsx(kt,{"data-slot":"tooltip",...t})})}function Bs({...t}){return e.jsx(It,{"data-slot":"tooltip-trigger",...t})}function Us({className:t,sideOffset:s=0,children:a,...n}){return e.jsx(Et,{children:e.jsxs(_t,{"data-slot":"tooltip-content",sideOffset:s,className:c("bg-primary text-primary-foreground 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 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...n,children:[a,e.jsx(Ot,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const Hs="sidebar_state",Gs=3600*24*7,Ks="16rem",qs="18rem",Js="3rem",Ws="b",at=u.createContext(null);function nt(){const t=u.useContext(at);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function Ys({defaultOpen:t=!0,open:s,onOpenChange:a,className:n,style:o,children:l,...x}){const m=As(),[j,f]=u.useState(!1),[b,y]=u.useState(t),w=s??b,v=u.useCallback(d=>{const i=typeof d=="function"?d(w):d;a?a(i):y(i),document.cookie=`${Hs}=${i}; path=/; max-age=${Gs}`},[a,w]),M=u.useCallback(()=>m?f(d=>!d):v(d=>!d),[m,v,f]);u.useEffect(()=>{const d=i=>{i.key===Ws&&(i.metaKey||i.ctrlKey)&&(i.preventDefault(),M())};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[M]);const F=w?"expanded":"collapsed",q=u.useMemo(()=>({state:F,open:w,setOpen:v,isMobile:m,openMobile:j,setOpenMobile:f,toggleSidebar:M}),[F,w,v,m,j,f,M]);return e.jsx(at.Provider,{value:q,children:e.jsx(st,{delayDuration:0,children:e.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Ks,"--sidebar-width-icon":Js,...o},className:c("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",n),...x,children:l})})})}function Xs({side:t="left",variant:s="sidebar",collapsible:a="offcanvas",className:n,children:o,...l}){const{isMobile:x,state:m,openMobile:j,setOpenMobile:f}=nt();return a==="none"?e.jsx("div",{"data-slot":"sidebar",className:c("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",n),...l,children:o}):x?e.jsx(Ts,{open:j,onOpenChange:f,...l,children:e.jsxs(Fs,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":qs},side:t,children:[e.jsxs($s,{className:"sr-only",children:[e.jsx(Rs,{children:"Sidebar"}),e.jsx(Ps,{children:"Displays the mobile sidebar."})]}),e.jsx("div",{className:"flex h-full w-full flex-col",children:o})]})}):e.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":m,"data-collapsible":m==="collapsed"?a:"","data-variant":s,"data-side":t,"data-slot":"sidebar",children:[e.jsx("div",{"data-slot":"sidebar-gap",className:c("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",s==="floating"||s==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),e.jsx("div",{"data-slot":"sidebar-container",className:c("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",t==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",s==="floating"||s==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",n),...l,children:e.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:o})})]})}function Qs({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:c("flex flex-col gap-2 p-2",t),...s})}function Zs({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:c("flex flex-col gap-2 p-2",t),...s})}function ea({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:c("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...s})}function ta({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:c("relative flex w-full min-w-0 flex-col p-2",t),...s})}function sa({className:t,asChild:s=!1,...a}){const n=s?me:"div";return e.jsx(n,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:c("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",t),...a})}function aa({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:c("w-full text-sm",t),...s})}function na({className:t,...s}){return e.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:c("flex w-full min-w-0 flex-col gap-1",t),...s})}function ra({className:t,...s}){return e.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:c("group/menu-item relative",t),...s})}const ia=Ge("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function oa({asChild:t=!1,isActive:s=!1,variant:a="default",size:n="default",tooltip:o,className:l,...x}){const m=t?me:"button",{isMobile:j,state:f}=nt(),b=e.jsx(m,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":n,"data-active":s,className:c(ia({variant:a,size:n}),l),...x});return o?(typeof o=="string"&&(o={children:o}),e.jsxs(Vs,{children:[e.jsx(Bs,{asChild:!0,children:b}),e.jsx(Us,{side:"right",align:"center",hidden:f!=="collapsed"||j,...o})]})):b}function la({...t}){return e.jsx(zt,{"data-slot":"collapsible",...t})}function da({...t}){return e.jsx(Dt,{"data-slot":"collapsible-trigger",...t})}function ca({...t}){return e.jsx(At,{"data-slot":"collapsible-content",...t})}function rt({...t}){return e.jsx(Tt,{"data-slot":"dropdown-menu",...t})}function it({...t}){return e.jsx(Lt,{"data-slot":"dropdown-menu-trigger",...t})}function ot({className:t,sideOffset:s=4,...a}){return e.jsx(Mt,{children:e.jsx(Ft,{"data-slot":"dropdown-menu-content",sideOffset:s,className:c("bg-popover text-popover-foreground 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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",t),...a})})}function ee({className:t,inset:s,variant:a="default",...n}){return e.jsx($t,{"data-slot":"dropdown-menu-item","data-inset":s,"data-variant":a,className:c("focus:bg-accent focus:text-accent-foreground 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 [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n})}function ua(){const{setTheme:t,theme:s}=Ke();return e.jsxs(rt,{children:[e.jsx(it,{asChild:!0,children:e.jsx(g,{variant:"outline",size:"icon","aria-label":"Toggle theme",children:s==="light"?e.jsx(ls,{className:"h-5 w-5"}):s==="dark"?e.jsx(ds,{className:"h-5 w-5"}):e.jsx(cs,{className:"h-5 w-5"})})}),e.jsxs(ot,{align:"end",children:[e.jsxs(ee,{onClick:()=>t("light"),children:[s==="light"&&e.jsx(re,{}),"Light"]}),e.jsxs(ee,{onClick:()=>t("dark"),children:[s==="dark"&&e.jsx(re,{}),"Dark"]}),e.jsxs(ee,{onClick:()=>t("system"),children:[s==="system"&&e.jsx(re,{}),"System"]})]})]})}const ge="";class D extends Error{status;body;constructor(s,a,n){super(a),this.status=s,this.body=n}}function ma(t){const s={};if(!t)return s;if(t instanceof Headers)t.forEach((a,n)=>s[n]=a);else if(Array.isArray(t))for(const[a,n]of t)s[a]=n;else Object.assign(s,t);return s}function xa(){const t={},s=localStorage.getItem("access_token");return s&&(t.Authorization=`Bearer ${s}`),t}function ha(){const t=localStorage.getItem("active_org_id");return t?{"X-Org-ID":t}:{}}async function Q(t,s,a,n={}){const l={...{"Content-Type":"application/json"},...n.auth===!1?{}:xa(),...ha(),...ma(n.headers)},x=await fetch(`${ge}${t}`,{method:s,headers:l,body:a===void 0?void 0:JSON.stringify(a),...n}),j=(x.headers.get("content-type")||"").includes("application/json"),f=j?await x.json().catch(()=>{}):await x.text().catch(()=>"");if(!x.ok){const b=j&&f&&typeof f=="object"&&"error"in f&&f.error||j&&f&&typeof f=="object"&&"message"in f&&f.message||typeof f=="string"&&f||`HTTP ${x.status}`;throw new D(x.status,String(b),f)}return console.debug("API ->",s,`${ge}${t}`,l),j?f:void 0}const O={get:(t,s)=>Q(t,"GET",void 0,s),post:(t,s,a)=>Q(t,"POST",s,a),put:(t,s,a)=>Q(t,"PUT",s,a),patch:(t,s,a)=>Q(t,"PATCH",s,a),delete:(t,s)=>Q(t,"DELETE",void 0,s)},pe="active_org_id",W="active-org-changed",se="orgs-changed";function V(){return localStorage.getItem(pe)}function te(t){t?localStorage.setItem(pe,t):localStorage.removeItem(pe),window.dispatchEvent(new CustomEvent(W,{detail:t}))}function Ve(){window.dispatchEvent(new Event(se))}const fa=()=>{const[t,s]=u.useState([]),[a,n]=u.useState(null);async function o(){try{const m=await O.get("/api/v1/orgs");s(m),!V()&&m.length>0&&(te(m[0].id),n(m[0].id))}catch(m){const j=m instanceof D?m.message:"Failed to load organizations";console.error(j)}}u.useEffect(()=>{n(V()),o();const m=b=>{b.key==="active_org_id"&&n(b.newValue)};window.addEventListener("storage",m);const j=b=>n(b.detail??null),f=()=>void o();return window.addEventListener(W,j),window.addEventListener(se,f),()=>{window.removeEventListener("storage",m),window.removeEventListener(W,j),window.removeEventListener(se,f)}},[]);const l=m=>{te(m),n(m)},x=t.find(m=>m.id===a)?.name??"Select Org";return e.jsxs(rt,{children:[e.jsx(it,{asChild:!0,children:e.jsx(g,{variant:"outline",className:"w-full justify-start",children:x})}),e.jsx(ot,{className:"w-48",children:t.length===0?e.jsx(ee,{disabled:!0,children:"No organizations"}):t.map(m=>e.jsx(ee,{onClick:()=>l(m.id),className:m.id===a?"font-semibold":void 0,children:m.name},m.id))})]})},Be=[{label:"Dashboard",icon:us,to:"/dashboard"},{label:"Core",icon:js,items:[{label:"Cluster",to:"/core/cluster",icon:ms},{label:"Node Pools",icon:xs,to:"/core/node-pools"},{label:"Annotations",icon:hs,to:"/core/annotations"},{label:"Labels",icon:fs,to:"/core/labels"},{label:"Taints",icon:gs,to:"/core/taints"},{label:"Servers",icon:ps,to:"/core/servers"}]},{label:"Security",icon:ws,items:[{label:"Keys & Tokens",icon:bs,to:"/security/keys"},{label:"SSH Keys",to:"/security/ssh",icon:vs}]},{label:"Tasks",icon:ys,items:[]},{label:"Settings",icon:Cs,items:[{label:"Organizations",to:"/settings/orgs",icon:Ns},{label:"Members",to:"/settings/members",icon:$e},{label:"Profile",to:"/settings/me",icon:Ss}]},{label:"Admin",icon:ks,requiresAdmin:!0,items:[{label:"Users",to:"/admin/users",icon:$e,requiresAdmin:!0}]}];function ga(t){return t&&(t.user||t.user_id)}function lt(t){return ga(t)?.role==="admin"}function pa(t){return(t?.org_role??"")==="admin"}const R={isAuthenticated(){return!!localStorage.getItem("access_token")},async login(t,s){const a=await O.post("/api/v1/auth/login",{email:t,password:s});localStorage.setItem("access_token",a.access_token),localStorage.setItem("refresh_token",a.refresh_token)},async register(t,s,a){await O.post("/api/v1/auth/register",{name:t,email:s,password:a})},async me(){return await O.get("/api/v1/auth/me")},async logout(){const t=localStorage.getItem("refresh_token");if(t)try{await O.post("/api/v1/auth/logout",{refresh_token:t})}catch{}localStorage.removeItem("access_token"),localStorage.removeItem("refresh_token")},async forgot(t){await O.post("/api/v1/auth/password/forgot",{email:t})},async reset(t,s){await O.post("/api/v1/auth/password/reset",{token:t,new_password:s})},async verify(t){const s=await fetch(`${ge}/api/v1/auth/verify?token=${encodeURIComponent(t)}`);if(!s.ok){const a=await s.text();throw new Error(a)}}};function dt(t,s,a){return t.filter(n=>!(n.requiresAdmin&&!s||n.requiresOrgAdmin&&!a)).map(n=>({...n,items:n.items?dt(n.items,s,a):void 0})).filter(n=>!n.items||n.items.length>0)}const ct=({item:t})=>{const s=xe(),a=t.icon;return t.to?e.jsxs(J,{to:t.to,className:`hover:bg-accent hover:text-accent-foreground flex items-center space-x-2 rounded-md px-4 py-2 text-sm ${s.pathname===t.to?"bg-accent text-accent-foreground":""}`,children:[e.jsx(a,{className:"mr-4 h-4 w-4"}),t.label]}):t.items?e.jsx(la,{defaultOpen:!0,className:"group/collapsible",children:e.jsxs(ta,{children:[e.jsx(sa,{asChild:!0,children:e.jsxs(da,{children:[e.jsx(a,{className:"mr-4 h-4 w-4"}),t.label,e.jsx(Ne,{className:"ml-auto transition-transform group-data-[state=open]/collapsible:rotate-180"})]})}),e.jsx(ca,{children:e.jsx(aa,{children:e.jsx(na,{children:t.items.map((n,o)=>e.jsx(ra,{children:e.jsx(oa,{asChild:!0,children:e.jsx(ct,{item:n})})},o))})})})]})}):null},ja=()=>{const[t,s]=u.useState(null),[a,n]=u.useState(!0);u.useEffect(()=>{let l=!0;return(async()=>{try{const x=await R.me();if(!l)return;s(x)}catch{}finally{if(!l)return;n(!1)}})(),()=>{l=!1}},[]);const o=u.useMemo(()=>{const l=lt(t),x=pa(t);return dt(Be,l,x)},[t]);return e.jsxs(Xs,{children:[e.jsx(Qs,{className:"flex items-center justify-between p-4",children:e.jsx("h1",{className:"text-xl font-bold",children:"AutoGlue"})}),e.jsx(ea,{children:(a?Be:o).map((l,x)=>e.jsx(ct,{item:l},x))}),e.jsxs(Zs,{className:"space-y-2 p-4",children:[e.jsx(fa,{}),e.jsx(ua,{}),e.jsx(g,{onClick:()=>{localStorage.clear(),window.location.reload()},className:"w-full",children:"Logout"})]})]})};function ba(){return e.jsx("footer",{className:"border-t",children:e.jsxs("div",{className:"container flex flex-col items-center justify-between gap-4 py-10 md:h-24 md:flex-row md:py-0",children:[e.jsx("div",{className:"flex flex-col items-center gap-4 px-8 md:flex-row md:gap-2 md:px-0",children:e.jsxs("p",{className:"text-muted-foreground text-center text-sm leading-loose md:text-left",children:["Built for"," ",e.jsx("a",{href:"https://www.glueops.dev/",target:"_blank",rel:"noreferrer",className:"font-medium underline underline-offset-4",children:"GlueOps"}),". The source code is available on"," ",e.jsx("a",{href:"https://github.com/GlueOps/autoglue",target:"_blank",rel:"noreferrer",className:"font-medium underline underline-offset-4",children:"GitHub"}),"."]})}),e.jsx("div",{className:"flex items-center space-x-4",children:e.jsx("a",{href:"https://github.com/GlueOps/autoglue",target:"_blank",rel:"noreferrer",children:e.jsx(Is,{className:"h-5 w-5"})})})]})})}function va(){return e.jsx("div",{className:"flex h-screen",children:e.jsxs(Ys,{children:[e.jsx(ja,{}),e.jsxs("div",{className:"flex flex-1 flex-col",children:[e.jsx("main",{className:"flex-1 overflow-auto p-4",children:e.jsx(Ce,{})}),e.jsx(ba,{})]})]})})}function wa({children:t}){const s=xe();return R.isAuthenticated()?t?e.jsx(e.Fragment,{children:t}):e.jsx(Ce,{}):e.jsx(ke,{to:"/auth/login",state:{from:s},replace:!0})}function A({className:t,...s}){return e.jsx("div",{"data-slot":"card",className:c("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...s})}function T({className:t,...s}){return e.jsx("div",{"data-slot":"card-header",className:c("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...s})}function P({className:t,...s}){return e.jsx("div",{"data-slot":"card-title",className:c("leading-none font-semibold",t),...s})}function L({className:t,...s}){return e.jsx("div",{"data-slot":"card-content",className:c("px-6",t),...s})}function ae({className:t,...s}){return e.jsx("div",{"data-slot":"card-footer",className:c("flex items-center px-6 [.border-t]:pt-6",t),...s})}function ya({className:t,...s}){return e.jsx(Rt,{"data-slot":"label",className:c("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...s})}const G=gt,ut=u.createContext({}),S=({...t})=>e.jsx(ut.Provider,{value:{name:t.name},children:e.jsx(pt,{...t})}),he=()=>{const t=u.useContext(ut),s=u.useContext(mt),{getFieldState:a}=jt(),n=bt({name:t.name}),o=a(t.name,n);if(!t)throw new Error("useFormField should be used within <FormField>");const{id:l}=s;return{id:l,name:t.name,formItemId:`${l}-form-item`,formDescriptionId:`${l}-form-item-description`,formMessageId:`${l}-form-item-message`,...o}},mt=u.createContext({});function C({className:t,...s}){const a=u.useId();return e.jsx(mt.Provider,{value:{id:a},children:e.jsx("div",{"data-slot":"form-item",className:c("grid gap-2",t),...s})})}function k({className:t,...s}){const{error:a,formItemId:n}=he();return e.jsx(ya,{"data-slot":"form-label","data-error":!!a,className:c("data-[error=true]:text-destructive",t),htmlFor:n,...s})}function I({...t}){const{error:s,formItemId:a,formDescriptionId:n,formMessageId:o}=he();return e.jsx(me,{"data-slot":"form-control",id:a,"aria-describedby":s?`${n} ${o}`:`${n}`,"aria-invalid":!!s,...t})}function Ue({className:t,...s}){const{formDescriptionId:a}=he();return e.jsx("p",{"data-slot":"form-description",id:a,className:c("text-muted-foreground text-sm",t),...s})}function E({className:t,...s}){const{error:a,formMessageId:n}=he(),o=a?String(a?.message??""):s.children;return o?e.jsx("p",{"data-slot":"form-message",id:n,className:c("text-destructive text-sm",t),...s,children:o}):null}const Na=K({email:X()});function Sa(){const t=U({resolver:H(Na),defaultValues:{email:""}});async function s(a){try{await R.forgot(a.email),p.success("If that email exists, we've sent instructions.")}catch(n){p.error(n.message||"Something went wrong")}}return e.jsx("div",{className:"mx-auto max-w-md",children:e.jsxs(A,{children:[e.jsx(T,{children:e.jsx(P,{children:"Forgot password"})}),e.jsx(L,{children:e.jsx(G,{...t,children:e.jsxs("form",{onSubmit:t.handleSubmit(s),className:"space-y-4",children:[e.jsx(S,{name:"email",control:t.control,render:({field:a})=>e.jsxs(C,{children:[e.jsx(k,{children:"Email"}),e.jsx(I,{children:e.jsx(z,{placeholder:"you@example.com",...a})}),e.jsx(E,{})]})}),e.jsx(g,{type:"submit",className:"w-full",children:"Send reset link"})]})})})]})})}const Ca=K({email:X(),password:$().min(6)});function ka(){const t=ne(),s=xe(),a=U({resolver:H(Ca),defaultValues:{email:"",password:""}});async function n(o){try{await R.login(o.email,o.password),p.success("Welcome back!");const l=s.state?.from?.pathname??"/settings/me";t(l,{replace:!0})}catch(l){p.error(l.message||"Login failed")}}return e.jsx("div",{className:"mx-auto max-w-md",children:e.jsxs(A,{children:[e.jsx(T,{children:e.jsx(P,{children:"Sign in"})}),e.jsxs(L,{children:[e.jsx(G,{...a,children:e.jsxs("form",{onSubmit:a.handleSubmit(n),className:"space-y-4",children:[e.jsx(S,{name:"email",control:a.control,render:({field:o})=>e.jsxs(C,{children:[e.jsx(k,{children:"Email"}),e.jsx(I,{children:e.jsx(z,{placeholder:"you@example.com",...o})}),e.jsx(E,{})]})}),e.jsx(S,{name:"password",control:a.control,render:({field:o})=>e.jsxs(C,{children:[e.jsx(k,{children:"Password"}),e.jsx(I,{children:e.jsx(z,{type:"password",placeholder:"••••••••",...o})}),e.jsx(E,{})]})}),e.jsx(g,{type:"submit",className:"w-full",children:"Sign in"})]})}),e.jsxs("div",{className:"mt-4 flex justify-between text-sm",children:[e.jsx(J,{to:"/auth/forgot",className:"underline",children:"Forgot password?"}),e.jsx(J,{to:"/auth/register",className:"underline",children:"Create an account"})]})]})]})})}function Ia(){const[t,s]=u.useState(null),a=ne();u.useEffect(()=>{(async()=>{try{const o=await R.me();s(o)}catch(o){p.error(o.message||"Failed to load profile")}})()},[]);async function n(){await R.logout(),a("/auth/login")}return e.jsx("div",{className:"mx-auto max-w-xl",children:e.jsxs(A,{children:[e.jsx(T,{children:e.jsx(P,{children:"My Account"})}),e.jsxs(L,{className:"space-y-3",children:[t?e.jsx("pre",{className:"bg-muted overflow-auto rounded p-3 text-sm",children:JSON.stringify(t,null,2)}):e.jsx("p",{children:"Loading…"}),e.jsx(g,{onClick:n,children:"Sign out"})]})]})})}const Ea=K({name:$().min(2),email:X(),password:$().min(6)});function _a(){const t=ne(),s=U({resolver:H(Ea),defaultValues:{name:"",email:"",password:""}});async function a(n){try{await R.register(n.name,n.email,n.password),p.success("Account created! Check your email to verify."),t("/auth/login")}catch(o){p.error(o.message||"Registration failed")}}return e.jsx("div",{className:"mx-auto max-w-md",children:e.jsxs(A,{children:[e.jsx(T,{children:e.jsx(P,{children:"Create account"})}),e.jsxs(L,{children:[e.jsx(G,{...s,children:e.jsxs("form",{onSubmit:s.handleSubmit(a),className:"space-y-4",children:[e.jsx(S,{name:"name",control:s.control,render:({field:n})=>e.jsxs(C,{children:[e.jsx(k,{children:"Name"}),e.jsx(I,{children:e.jsx(z,{placeholder:"Jane Doe",...n})}),e.jsx(E,{})]})}),e.jsx(S,{name:"email",control:s.control,render:({field:n})=>e.jsxs(C,{children:[e.jsx(k,{children:"Email"}),e.jsx(I,{children:e.jsx(z,{placeholder:"you@example.com",...n})}),e.jsx(E,{})]})}),e.jsx(S,{name:"password",control:s.control,render:({field:n})=>e.jsxs(C,{children:[e.jsx(k,{children:"Password"}),e.jsx(I,{children:e.jsx(z,{type:"password",placeholder:"••••••••",...n})}),e.jsx(E,{})]})}),e.jsx(g,{type:"submit",className:"w-full",children:"Create account"})]})}),e.jsxs("div",{className:"mt-4 text-sm",children:["Already have an account?"," ",e.jsx(J,{to:"/auth/login",className:"underline",children:"Sign in"})]})]})]})})}const Oa=K({new_password:$().min(6)});function za(){const[t]=tt(),s=t.get("token"),a=U({resolver:H(Oa),defaultValues:{new_password:""}}),n=ne();async function o(l){if(!s){p.error("Missing token");return}try{await R.reset(s,l.new_password),p.success("Password updated. Please sign in."),n("/auth/login")}catch(x){p.error(x.message||"Reset failed")}}return e.jsx("div",{className:"mx-auto max-w-md",children:e.jsxs(A,{children:[e.jsx(T,{children:e.jsx(P,{children:"Reset password"})}),e.jsxs(L,{children:[e.jsx(G,{...a,children:e.jsxs("form",{onSubmit:a.handleSubmit(o),className:"space-y-4",children:[e.jsx(S,{name:"new_password",control:a.control,render:({field:l})=>e.jsxs(C,{children:[e.jsx(k,{children:"New password"}),e.jsx(I,{children:e.jsx(z,{type:"password",placeholder:"••••••••",...l})}),e.jsx(E,{})]})}),e.jsx(g,{type:"submit",className:"w-full",children:"Update password"})]})}),e.jsx("div",{className:"mt-4 text-sm",children:e.jsx(J,{to:"/auth/login",className:"underline",children:"Back to sign in"})})]})]})})}function Da(){const[t]=tt(),s=t.get("token"),[a,n]=u.useState("idle");return u.useEffect(()=>{async function o(){if(!s){n("error");return}try{await R.verify(s),n("ok")}catch(l){p.error(l.message||"Verification failed"),n("error")}}o()},[s]),e.jsx("div",{className:"mx-auto max-w-md",children:e.jsxs(A,{children:[e.jsx(T,{children:e.jsx(P,{children:"Email verification"})}),e.jsxs(L,{className:"space-y-3",children:[a==="idle"&&e.jsx("p",{children:"Verifying…"}),a==="ok"&&e.jsxs("div",{children:[e.jsx("p",{children:"Your email has been verified. You can now sign in."}),e.jsx(g,{asChild:!0,className:"mt-3",children:e.jsx(J,{to:"/auth/login",children:"Go to sign in"})})]}),a==="error"&&e.jsxs("div",{children:[e.jsx("p",{children:"Verification failed. Please request a new verification email."}),e.jsx(g,{asChild:!0,className:"mt-3",children:e.jsx(J,{to:"/auth/login",children:"Back to sign in"})})]})]})]})})}const He=()=>{const t=ne();return e.jsxs("div",{className:"bg-background text-foreground flex min-h-screen flex-col items-center justify-center",children:[e.jsx("h1",{className:"mb-4 text-6xl font-bold",children:"404"}),e.jsx("p",{className:"mb-8 text-2xl",children:"Oops! Page not found"}),e.jsx(g,{onClick:()=>t("/dashboard"),children:"Go back to Dashboard"})]})};function Ee({...t}){return e.jsx(Pt,{"data-slot":"alert-dialog",...t})}function _e({...t}){return e.jsx(Vt,{"data-slot":"alert-dialog-trigger",...t})}function Aa({...t}){return e.jsx(qt,{"data-slot":"alert-dialog-portal",...t})}function Ta({className:t,...s}){return e.jsx(Jt,{"data-slot":"alert-dialog-overlay",className:c("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...s})}function Oe({className:t,...s}){return e.jsxs(Aa,{children:[e.jsx(Ta,{}),e.jsx(Bt,{"data-slot":"alert-dialog-content",className:c("bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...s})]})}function ze({className:t,...s}){return e.jsx("div",{"data-slot":"alert-dialog-header",className:c("flex flex-col gap-2 text-center sm:text-left",t),...s})}function De({className:t,...s}){return e.jsx("div",{"data-slot":"alert-dialog-footer",className:c("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...s})}function Ae({className:t,...s}){return e.jsx(Ut,{"data-slot":"alert-dialog-title",className:c("text-lg font-semibold",t),...s})}function Te({className:t,...s}){return e.jsx(Ht,{"data-slot":"alert-dialog-description",className:c("text-muted-foreground text-sm",t),...s})}function Le({className:t,...s}){return e.jsx(Kt,{className:c(Ie(),t),...s})}function Me({className:t,...s}){return e.jsx(Gt,{className:c(Ie({variant:"outline"}),t),...s})}function ie({...t}){return e.jsx(qe,{"data-slot":"dialog",...t})}function La({...t}){return e.jsx(Wt,{"data-slot":"dialog-trigger",...t})}function Ma({...t}){return e.jsx(Qe,{"data-slot":"dialog-portal",...t})}function Fa({className:t,...s}){return e.jsx(Ze,{"data-slot":"dialog-overlay",className:c("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...s})}function oe({className:t,children:s,showCloseButton:a=!0,...n}){return e.jsxs(Ma,{"data-slot":"dialog-portal",children:[e.jsx(Fa,{}),e.jsxs(Je,{"data-slot":"dialog-content",className:c("bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...n,children:[s,a&&e.jsxs(We,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[e.jsx(et,{}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function le({className:t,...s}){return e.jsx("div",{"data-slot":"dialog-header",className:c("flex flex-col gap-2 text-center sm:text-left",t),...s})}function de({className:t,...s}){return e.jsx("div",{"data-slot":"dialog-footer",className:c("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...s})}function ce({className:t,...s}){return e.jsx(Ye,{"data-slot":"dialog-title",className:c("text-lg leading-none font-semibold",t),...s})}function ue({className:t,...s}){return e.jsx(Xe,{"data-slot":"dialog-description",className:c("text-muted-foreground text-sm",t),...s})}function je({...t}){return e.jsx(Yt,{"data-slot":"select",...t})}function be({...t}){return e.jsx(Zt,{"data-slot":"select-value",...t})}function ve({className:t,size:s="default",children:a,...n}){return e.jsxs(Xt,{"data-slot":"select-trigger","data-size":s,className:c("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground 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:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n,children:[a,e.jsx(Qt,{asChild:!0,children:e.jsx(Ne,{className:"size-4 opacity-50"})})]})}function we({className:t,children:s,position:a="popper",...n}){return e.jsx(es,{children:e.jsxs(ts,{"data-slot":"select-content",className:c("bg-popover text-popover-foreground 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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,...n,children:[e.jsx($a,{}),e.jsx(ss,{className:c("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:s}),e.jsx(Ra,{})]})})}function Y({className:t,children:s,...a}){return e.jsxs(as,{"data-slot":"select-item",className:c("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...a,children:[e.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:e.jsx(ns,{children:e.jsx(re,{className:"size-4"})})}),e.jsx(rs,{children:s})]})}function $a({className:t,...s}){return e.jsx(is,{"data-slot":"select-scroll-up-button",className:c("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(Es,{className:"size-4"})})}function Ra({className:t,...s}){return e.jsx(os,{"data-slot":"select-scroll-down-button",className:c("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(Ne,{className:"size-4"})})}function Pa(t){const s=t?.user_id??t?.UserID??t?.user?.id??t?.User?.ID??"",a=t?.email??t?.Email??t?.user?.email??t?.User?.Email,n=t?.name??t?.Name??t?.user?.name??t?.User?.Name,o=t?.role??t?.Role??"member",l=t?.created_at??t?.CreatedAt;return{userId:String(s),email:a,name:n,role:String(o),joinedAt:l}}const Va=K({email:X("Enter a valid email"),role:ye(["member","admin"])}),Ba=()=>{const[t,s]=u.useState(!0),[a,n]=u.useState([]),[o,l]=u.useState(null),[x,m]=u.useState(!1),[j,f]=u.useState(!1),[b,y]=u.useState(null),w=u.useMemo(()=>V(),[]),v=U({resolver:H(Va),defaultValues:{email:"",role:"member"},mode:"onChange"});async function M(){try{const i=await O.get("/api/v1/auth/me");l(i)}catch{}}async function F(i){if(!i){n([]),s(!1);return}s(!0);try{const r=await O.get("/api/v1/orgs/members");n((r??[]).map(Pa))}catch(r){const h=r instanceof D?r.message:"Failed to load members";p.error(h)}finally{s(!1)}}u.useEffect(()=>{M(),F(w)},[w]),u.useEffect(()=>{const i=()=>void F(V()),r=h=>{h.key==="active_org_id"&&i()};return window.addEventListener(W,i),window.addEventListener("storage",r),()=>{window.removeEventListener(W,i),window.removeEventListener("storage",r)}},[]);async function q(i){const r=V();if(!r){p.error("Select an organization first");return}try{f(!0),await O.post("/api/v1/orgs/invite",i),p.success(`Invited ${i.email}`),m(!1),v.reset({email:"",role:"member"}),F(r)}catch(h){const _=h instanceof D?h.message:"Failed to invite member";p.error(_)}finally{f(!1)}}async function d(i){const r=V();if(!r){p.error("Select an organization first");return}try{y(i),await O.delete(`/api/v1/orgs/members/${i}`,{headers:{"X-Org-ID":r}}),n(h=>h.filter(_=>_.userId!==i)),p.success("Member removed")}catch(h){const _=h instanceof D?h.message:"Failed to remove member";p.error(_)}finally{y(null)}}return t?e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Members"}),e.jsxs(g,{disabled:!0,children:[e.jsx(Re,{className:"mr-2 h-4 w-4"}),"Invite"]})]}),e.jsx(Z,{}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[...Array(6)].map((i,r)=>e.jsxs(A,{children:[e.jsx(T,{children:e.jsx(B,{className:"h-5 w-40"})}),e.jsxs(L,{className:"space-y-2",children:[e.jsx(B,{className:"h-4 w-56"}),e.jsx(B,{className:"h-4 w-40"})]}),e.jsx(ae,{children:e.jsx(B,{className:"h-9 w-24"})})]},r))})]}):V()?e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Members"}),e.jsxs(ie,{open:x,onOpenChange:m,children:[e.jsx(La,{asChild:!0,children:e.jsxs(g,{children:[e.jsx(Re,{className:"mr-2 h-4 w-4"}),"Invite"]})}),e.jsxs(oe,{className:"sm:max-w-[520px]",children:[e.jsxs(le,{children:[e.jsx(ce,{children:"Invite member"}),e.jsx(ue,{children:"Send an invite to join this organization."})]}),e.jsx(G,{...v,children:e.jsxs("form",{onSubmit:v.handleSubmit(q),className:"grid gap-4 py-2",children:[e.jsx(S,{control:v.control,name:"email",render:({field:i})=>e.jsxs(C,{children:[e.jsx(k,{children:"Email"}),e.jsx(I,{children:e.jsx(z,{type:"email",placeholder:"jane@example.com",...i})}),e.jsx(E,{})]})}),e.jsx(S,{control:v.control,name:"role",render:({field:i})=>e.jsxs(C,{children:[e.jsx(k,{children:"Role"}),e.jsxs(je,{onValueChange:i.onChange,defaultValue:i.value,children:[e.jsx(I,{children:e.jsx(ve,{className:"w-[200px]",children:e.jsx(be,{placeholder:"Select role"})})}),e.jsxs(we,{children:[e.jsx(Y,{value:"member",children:"Member"}),e.jsx(Y,{value:"admin",children:"Admin"})]})]}),e.jsx(E,{})]})}),e.jsxs(de,{className:"mt-2 flex-col-reverse gap-2 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>m(!1),children:"Cancel"}),e.jsx(g,{type:"submit",disabled:!v.formState.isValid||j,children:j?"Sending…":"Send invite"})]})]})})]})]})]}),e.jsx(Z,{}),a.length===0?e.jsx("div",{className:"text-sm text-muted-foreground",children:"No members yet."}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 pr-2",children:a.map(i=>{const r=o?.id&&i.userId===o.id;return e.jsxs(A,{className:"flex flex-col",children:[e.jsx(T,{children:e.jsx(P,{className:"text-base",children:i.name||i.email||i.userId})}),e.jsxs(L,{className:"text-sm text-muted-foreground space-y-1",children:[i.email&&e.jsxs("div",{children:["Email: ",i.email]}),e.jsxs("div",{children:["Role: ",i.role]}),i.joinedAt&&e.jsxs("div",{children:["Joined: ",new Date(i.joinedAt).toLocaleString()]})]}),e.jsxs(ae,{className:"mt-auto w-full flex-col-reverse gap-2 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("div",{}),e.jsxs(Ee,{children:[e.jsx(_e,{asChild:!0,children:e.jsxs(g,{variant:"destructive",disabled:r||b===i.userId,className:"ml-auto",children:[e.jsx(Se,{className:"h-5 w-5 mr-2"}),b===i.userId?"Removing…":"Remove"]})}),e.jsxs(Oe,{children:[e.jsxs(ze,{children:[e.jsx(Ae,{children:"Remove member?"}),e.jsxs(Te,{children:["This will remove ",e.jsx("b",{children:i.name||i.email||i.userId})," from the organization."]})]}),e.jsxs(De,{className:"sm:justify-between",children:[e.jsx(Me,{disabled:b===i.userId,children:"Cancel"}),e.jsx(Le,{asChild:!0,disabled:b===i.userId,children:e.jsx(g,{variant:"destructive",onClick:()=>d(i.userId),children:"Confirm remove"})})]})]})]})]})]},i.userId)})})]}):e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("h1",{className:"text-2xl font-bold",children:"Members"})}),e.jsx(Z,{}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No organization selected. Choose an organization to manage its members."})]})},Ua=K({name:$().min(2).max(100),slug:$().min(2).max(50).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/,"Use lowercase letters, numbers, and hyphens.")}),Ha=()=>{const[t,s]=u.useState([]),[a,n]=u.useState(!0),[o,l]=u.useState(!1),[x,m]=u.useState(null),[j,f]=u.useState(null),b=u.useRef(!1),y=U({resolver:H(Ua),mode:"onChange",defaultValues:{name:"",slug:""}}),w=y.watch("name");u.useEffect(()=>{b.current||y.setValue("slug",Pe(w||""),{shouldValidate:!0})},[w,y]);const v=async()=>{n(!0);try{const d=await O.get("/api/v1/orgs");s(d),l(d.length===0)}catch(d){const i=d instanceof D?d.message:"Failed to load organizations";p.error(i)}finally{n(!1)}};u.useEffect(()=>{m(V()),v();const d=h=>{h.key==="active_org_id"&&m(h.newValue)};window.addEventListener("storage",d);const i=h=>{const _=h.detail??null;m(_)};window.addEventListener(W,i);const r=()=>void v();return window.addEventListener(se,r),()=>{window.removeEventListener("storage",d),window.removeEventListener(W,i),window.removeEventListener(se,r)}},[]);async function M(d){try{const i=await O.post("/api/v1/orgs",d);s(r=>[i,...r]),te(i.id),m(i.id),Ve(),p.success(`Created ${i.name}`),l(!1),y.reset({name:"",slug:""}),b.current=!1}catch(i){const r=i instanceof D?i.message:"Failed to create organization";p.error(r)}}function F(d){te(d.id),m(d.id),p.success(`Switched to ${d.name}`)}async function q(d){try{f(d.id),await O.delete(`/api/v1/orgs/${d.id}`),s(i=>{const r=i.filter(h=>h.id!==d.id);if(x===d.id){const h=r[0]?.id??null;te(h),m(h)}return r}),Ve(),p.success(`Deleted ${d.name}`)}catch(i){const r=i instanceof D?i.message:"Failed to delete organization";p.error(r)}finally{f(null)}}return a?e.jsxs("div",{className:"space-y-4 p-6",children:[e.jsx("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:e.jsx("h1",{className:"mb-4 text-2xl font-bold",children:"Organizations"})}),e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3",children:[...Array(6)].map((d,i)=>e.jsxs(A,{children:[e.jsx(T,{children:e.jsx(B,{className:"h-5 w-40"})}),e.jsxs(L,{children:[e.jsx(B,{className:"mb-2 h-4 w-24"}),e.jsx(B,{className:"h-4 w-48"})]}),e.jsx(ae,{children:e.jsx(B,{className:"h-9 w-24"})})]},i))})]}):e.jsxs("div",{className:"space-y-4 p-6",children:[e.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[e.jsx("h1",{className:"mb-4 text-2xl font-bold",children:"Organizations"}),e.jsx(g,{onClick:()=>l(!0),children:"New organization"})]}),e.jsx(Z,{}),t.length===0?e.jsx("div",{className:"text-muted-foreground text-sm",children:"No organizations yet."}):e.jsx("div",{className:"grid grid-cols-1 gap-4 pr-2 sm:grid-cols-2 lg:grid-cols-3",children:t.map(d=>e.jsxs(A,{className:"flex flex-col",children:[e.jsx(T,{children:e.jsx(P,{className:"text-base",children:d.name})}),e.jsxs(L,{className:"text-muted-foreground text-sm",children:[e.jsxs("div",{children:["Slug: ",d.slug]}),e.jsxs("div",{className:"mt-1",children:["ID: ",d.id]})]}),e.jsxs(ae,{className:"mt-auto w-full flex-col-reverse gap-2 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx(g,{onClick:()=>F(d),children:d.id===x?"Selected":"Select"}),e.jsxs(Ee,{children:[e.jsx(_e,{asChild:!0,children:e.jsxs(g,{variant:"destructive",className:"ml-auto",disabled:j===d.id,children:[e.jsx(Se,{className:"mr-2 h-5 w-5"}),j===d.id?"Deleting…":"Delete"]})}),e.jsxs(Oe,{children:[e.jsxs(ze,{children:[e.jsx(Ae,{children:"Delete organization?"}),e.jsxs(Te,{children:["This will permanently delete ",e.jsx("b",{children:d.name}),". This action cannot be undone."]})]}),e.jsxs(De,{className:"sm:justify-between",children:[e.jsx(Me,{disabled:j===d.id,children:"Cancel"}),e.jsx(Le,{asChild:!0,disabled:j===d.id,children:e.jsx(g,{variant:"destructive",onClick:()=>q(d),children:"Confirm delete"})})]})]})]})]})]},d.id))}),e.jsx(ie,{open:o,onOpenChange:l,children:e.jsxs(oe,{className:"sm:max-w-[480px]",children:[e.jsxs(le,{children:[e.jsx(ce,{children:"Create organization"}),e.jsx(ue,{children:"Set a name and a URL-friendly slug."})]}),e.jsx(G,{...y,children:e.jsxs("form",{onSubmit:y.handleSubmit(M),className:"space-y-4",children:[e.jsx(S,{control:y.control,name:"name",render:({field:d})=>e.jsxs(C,{children:[e.jsx(k,{children:"Name"}),e.jsx(I,{children:e.jsx(z,{placeholder:"Acme Inc",autoFocus:!0,...d})}),e.jsx(Ue,{children:"This is your organization’s display name."}),e.jsx(E,{})]})}),e.jsx(S,{control:y.control,name:"slug",render:({field:d})=>e.jsxs(C,{children:[e.jsx(k,{children:"Slug"}),e.jsx(I,{children:e.jsx(z,{placeholder:"acme-inc",...d,onChange:i=>{b.current=!0,d.onChange(i)},onBlur:i=>{const r=Pe(i.target.value);y.setValue("slug",r,{shouldValidate:!0}),d.onBlur()}})}),e.jsx(Ue,{children:"Lowercase, numbers and hyphens only."}),e.jsx(E,{})]})}),e.jsxs(de,{className:"flex-col-reverse gap-2 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>{y.reset(),l(!1),b.current=!1},children:"Cancel"}),e.jsx(g,{type:"submit",disabled:!y.formState.isValid||y.formState.isSubmitting,children:y.formState.isSubmitting?"Creating...":"Create"})]})]})})]})})]})};function Ga(){return e.jsxs("div",{className:"p-6",children:[e.jsx("h1",{className:"text-2xl font-bold",children:"403 — Forbidden"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"You don’t have access to this area."})]})}function Ka({children:t}){const[s,a]=u.useState(!0),[n,o]=u.useState(!1),l=xe();return u.useEffect(()=>{let x=!0;return(async()=>{try{const m=await R.me();if(!x)return;o(lt(m))}catch{if(!x)return;o(!1)}finally{if(!x)return;a(!1)}})(),()=>{x=!1}},[]),s?null:n?t?e.jsx(e.Fragment,{children:t}):e.jsx(Ce,{}):e.jsx(ke,{to:"/403",replace:!0,state:{from:l}})}const qa=K({name:$().min(1,"Name required"),email:X("Enter a valid email"),role:ye(["user","admin"]),password:$().min(8,"Min 8 characters")}),Ja=K({name:$().min(1,"Name required"),email:X("Enter a valid email"),role:ye(["user","admin"]),password:$().min(8,"Min 8 characters").optional().or(vt(""))});function Wa(){const[t,s]=u.useState([]),[a,n]=u.useState(!0),[o,l]=u.useState(!1),[x,m]=u.useState(!1),[j,f]=u.useState(null),[b,y]=u.useState(null),w=U({resolver:H(qa),mode:"onChange",defaultValues:{name:"",email:"",role:"user",password:""}}),v=U({resolver:H(Ja),mode:"onChange",defaultValues:{name:"",email:"",role:"user",password:""}});async function M(){n(!0);try{const r=await O.get("/api/v1/admin/users?page=1&page_size=100");s(r.users??[])}catch(r){p.error(r instanceof D?r.message:"Failed to load users")}finally{n(!1)}}u.useEffect(()=>{M()},[]);async function F(r){try{const h=await O.post("/api/v1/admin/users",r);s(_=>[h,..._]),l(!1),w.reset({name:"",email:"",role:"user",password:""}),p.success(`Created ${h.email}`)}catch(h){p.error(h instanceof D?h.message:"Failed to create user")}}function q(r){f(r),v.reset({name:r.name||"",email:r.email,role:r.role??"user",password:""}),m(!0)}async function d(r){if(!j)return;const h={name:r.name,email:r.email,role:r.role};r.password&&r.password.length>=8&&(h.password=r.password);try{const _=await O.patch(`/api/v1/admin/users/${j.id}`,h);s(xt=>xt.map(Fe=>Fe.id===_.id?_:Fe)),m(!1),f(null),p.success(`Updated ${_.email}`)}catch(_){p.error(_ instanceof D?_.message:"Failed to update user")}}async function i(r){try{y(r),await O.delete(`/api/v1/admin/users/${r}`),s(h=>h.filter(_=>_.id!==r)),p.success("User deleted")}catch(h){p.error(h instanceof D?h.message:"Failed to delete user")}finally{y(null)}}return e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Users"}),e.jsxs(g,{onClick:()=>l(!0),children:[e.jsx(_s,{className:"mr-2 h-4 w-4"}),"New user"]})]}),e.jsx(Z,{}),a?e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading…"}):t.length===0?e.jsx("div",{className:"text-sm text-muted-foreground",children:"No users yet."}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 pr-2",children:t.map(r=>e.jsxs(A,{className:"flex flex-col",children:[e.jsx(T,{children:e.jsx(P,{className:"text-base",children:r.name||r.email})}),e.jsxs(L,{className:"text-sm text-muted-foreground space-y-1",children:[e.jsxs("div",{children:["Email: ",r.email]}),e.jsxs("div",{children:["Role: ",r.role]}),e.jsxs("div",{children:["Verified: ",r.email_verified?"Yes":"No"]}),e.jsxs("div",{children:["Joined: ",new Date(r.created_at).toLocaleString()]})]}),e.jsxs(ae,{className:"mt-auto w-full flex-col-reverse gap-2 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs(g,{variant:"outline",onClick:()=>q(r),children:[e.jsx(Os,{className:"mr-2 h-4 w-4"})," Edit"]}),e.jsxs(Ee,{children:[e.jsx(_e,{asChild:!0,children:e.jsxs(g,{variant:"destructive",disabled:b===r.id,children:[e.jsx(Se,{className:"mr-2 h-4 w-4"}),b===r.id?"Deleting…":"Delete"]})}),e.jsxs(Oe,{children:[e.jsxs(ze,{children:[e.jsx(Ae,{children:"Delete user?"}),e.jsxs(Te,{children:["This will permanently delete ",e.jsx("b",{children:r.email}),"."]})]}),e.jsxs(De,{className:"sm:justify-between",children:[e.jsx(Me,{disabled:b===r.id,children:"Cancel"}),e.jsx(Le,{asChild:!0,disabled:b===r.id,children:e.jsx(g,{variant:"destructive",onClick:()=>i(r.id),children:"Confirm delete"})})]})]})]})]})]},r.id))}),e.jsx(ie,{open:o,onOpenChange:l,children:e.jsxs(oe,{className:"sm:max-w-[520px]",children:[e.jsxs(le,{children:[e.jsx(ce,{children:"Create user"}),e.jsx(ue,{children:"Add a new user account."})]}),e.jsx(G,{...w,children:e.jsxs("form",{onSubmit:w.handleSubmit(F),className:"grid gap-4 py-2",children:[e.jsx(S,{name:"name",control:w.control,render:({field:r})=>e.jsxs(C,{children:[e.jsx(k,{children:"Name"}),e.jsx(I,{children:e.jsx(z,{...r,placeholder:"Jane Doe"})}),e.jsx(E,{})]})}),e.jsx(S,{name:"email",control:w.control,render:({field:r})=>e.jsxs(C,{children:[e.jsx(k,{children:"Email"}),e.jsx(I,{children:e.jsx(z,{type:"email",...r,placeholder:"jane@example.com"})}),e.jsx(E,{})]})}),e.jsx(S,{name:"role",control:w.control,render:({field:r})=>e.jsxs(C,{children:[e.jsx(k,{children:"Role"}),e.jsxs(je,{value:r.value,onValueChange:r.onChange,children:[e.jsx(I,{children:e.jsx(ve,{className:"w-[200px]",children:e.jsx(be,{placeholder:"Select role"})})}),e.jsxs(we,{children:[e.jsx(Y,{value:"user",children:"User"}),e.jsx(Y,{value:"admin",children:"Admin"})]})]}),e.jsx(E,{})]})}),e.jsx(S,{name:"password",control:w.control,render:({field:r})=>e.jsxs(C,{children:[e.jsx(k,{children:"Password"}),e.jsx(I,{children:e.jsx(z,{type:"password",...r,placeholder:"••••••••"})}),e.jsx(E,{})]})}),e.jsxs(de,{className:"mt-2 flex-col-reverse gap-2 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(g,{type:"submit",disabled:!w.formState.isValid||w.formState.isSubmitting,children:w.formState.isSubmitting?"Creating…":"Create"})]})]})})]})}),e.jsx(ie,{open:x,onOpenChange:m,children:e.jsxs(oe,{className:"sm:max-w-[520px]",children:[e.jsxs(le,{children:[e.jsx(ce,{children:"Edit user"}),e.jsx(ue,{children:"Update user details. Leave password blank to keep it unchanged."})]}),e.jsx(G,{...v,children:e.jsxs("form",{onSubmit:v.handleSubmit(d),className:"grid gap-4 py-2",children:[e.jsx(S,{name:"name",control:v.control,render:({field:r})=>e.jsxs(C,{children:[e.jsx(k,{children:"Name"}),e.jsx(I,{children:e.jsx(z,{...r})}),e.jsx(E,{})]})}),e.jsx(S,{name:"email",control:v.control,render:({field:r})=>e.jsxs(C,{children:[e.jsx(k,{children:"Email"}),e.jsx(I,{children:e.jsx(z,{type:"email",...r})}),e.jsx(E,{})]})}),e.jsx(S,{name:"role",control:v.control,render:({field:r})=>e.jsxs(C,{children:[e.jsx(k,{children:"Role"}),e.jsxs(je,{value:r.value,onValueChange:r.onChange,children:[e.jsx(I,{children:e.jsx(ve,{className:"w-[200px]",children:e.jsx(be,{placeholder:"Select role"})})}),e.jsxs(we,{children:[e.jsx(Y,{value:"user",children:"User"}),e.jsx(Y,{value:"admin",children:"Admin"})]})]}),e.jsx(E,{})]})}),e.jsx(S,{name:"password",control:v.control,render:({field:r})=>e.jsxs(C,{children:[e.jsx(k,{children:"New password (optional)"}),e.jsx(I,{children:e.jsx(z,{type:"password",...r,placeholder:"Leave blank to keep"})}),e.jsx(E,{})]})}),e.jsxs(de,{className:"mt-2 flex-col-reverse gap-2 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>m(!1),children:"Cancel"}),e.jsx(g,{type:"submit",disabled:!v.formState.isValid||v.formState.isSubmitting,children:v.formState.isSubmitting?"Saving…":"Save changes"})]})]})})]})})]})}function Ya(){return e.jsxs(zs,{children:[e.jsx(N,{path:"/403",element:e.jsx(Ga,{})}),e.jsx(N,{path:"/",element:e.jsx(ke,{to:"/auth/login",replace:!0})}),e.jsxs(N,{path:"/auth",children:[e.jsx(N,{path:"login",element:e.jsx(ka,{})}),e.jsx(N,{path:"register",element:e.jsx(_a,{})}),e.jsx(N,{path:"forgot",element:e.jsx(Sa,{})}),e.jsx(N,{path:"reset",element:e.jsx(za,{})}),e.jsx(N,{path:"verify",element:e.jsx(Da,{})})]}),e.jsx(N,{element:e.jsx(wa,{}),children:e.jsxs(N,{element:e.jsx(va,{}),children:[e.jsx(N,{element:e.jsx(Ka,{}),children:e.jsx(N,{path:"/admin",children:e.jsx(N,{path:"users",element:e.jsx(Wa,{})})})}),e.jsx(N,{path:"/core"}),e.jsx(N,{path:"/security"}),e.jsxs(N,{path:"/settings",children:[e.jsx(N,{path:"orgs",element:e.jsx(Ha,{})}),e.jsx(N,{path:"members",element:e.jsx(Ba,{})}),e.jsx(N,{path:"me",element:e.jsx(Ia,{})})]}),e.jsx(N,{path:"*",element:e.jsx(He,{})})]})}),e.jsx(N,{path:"*",element:e.jsx(He,{})})]})}const Xa=({...t})=>{const{theme:s="system"}=Ke();return e.jsx(wt,{theme:s,className:"toaster group",style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)"},...t})};function Qa({children:t,defaultTheme:s="system",storageKey:a="vite-ui-theme"}){return e.jsx(yt,{attribute:"class",defaultTheme:s,enableSystem:!0,storageKey:a,disableTransitionOnChange:!0,children:t})}Nt.createRoot(document.getElementById("root")).render(e.jsx(u.StrictMode,{children:e.jsx(Ds,{children:e.jsxs(Qa,{defaultTheme:"system",storageKey:"dragon-theme",children:[e.jsx(Ya,{}),e.jsx(Xa,{richColors:!0,position:"top-right"})]})})}));
|