@bpinhosilva/agent-orchestrator 1.1.3 → 1.2.0

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.
Files changed (93) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +7 -0
  3. package/dist/cli/commands/run.command.js +20 -1
  4. package/dist/cli/commands/setup.command.js +13 -0
  5. package/dist/cli/constants.js +2 -1
  6. package/dist/cli/env.js +2 -0
  7. package/dist/cli/preload.js +12 -0
  8. package/dist/cli/process-manager.js +33 -29
  9. package/dist/cli/setup/index.js +24 -0
  10. package/dist/cli/setup/validators.js +14 -0
  11. package/dist/config/env.validation.js +6 -0
  12. package/dist/config/runtime-logger.js +214 -0
  13. package/dist/main.js +8 -0
  14. package/dist/ui/assets/{AgentFleet-BarfEwcK.js → AgentFleet-B8p5vbKK.js} +1 -1
  15. package/dist/ui/assets/{AttachmentItem-Cerhbyya.js → AttachmentItem-C_uUACPz.js} +1 -1
  16. package/dist/ui/assets/{ConfirmDialog-y3vTcqFR.js → ConfirmDialog-BltdtevE.js} +1 -1
  17. package/dist/ui/assets/{CreateRecurrentTaskModal-BgfnJ1n8.js → CreateRecurrentTaskModal-CGSdgNAf.js} +1 -1
  18. package/dist/ui/assets/{CreateTaskModal-BH9lOLYT.js → CreateTaskModal-XNvIWKz3.js} +1 -1
  19. package/dist/ui/assets/{ExecLogModal-ShacCOOV.js → ExecLogModal-BYTGF04P.js} +1 -1
  20. package/dist/ui/assets/{MarkdownField--1gpyapw.js → MarkdownField-DR6tHsei.js} +1 -1
  21. package/dist/ui/assets/{Profile-qnuRN5Qv.js → Profile-ByioVLM8.js} +1 -1
  22. package/dist/ui/assets/{ProjectDetail-ZYQG9yn2.js → ProjectDetail-dwZDzb0m.js} +1 -1
  23. package/dist/ui/assets/{Providers-DR7srJHq.js → Providers-JAClEFt0.js} +1 -1
  24. package/dist/ui/assets/{Scheduler-Bs3DC0re.js → Scheduler-C1HQNxQ6.js} +2 -2
  25. package/dist/ui/assets/{Settings-C3ad44vP.js → Settings-Cjn2xdo1.js} +1 -1
  26. package/dist/ui/assets/{TaskDetail-D-f_Ao2a.js → TaskDetail-Blphf9tw.js} +1 -1
  27. package/dist/ui/assets/{TaskExecutions-BeodRIz1.js → TaskExecutions-ydR4KPCY.js} +3 -3
  28. package/dist/ui/assets/{TaskManager-BA2Y31ut.js → TaskManager-DrFbuAwN.js} +3 -3
  29. package/dist/ui/assets/{UserDetail-BvWm-U4y.js → UserDetail-mWjJPTzO.js} +1 -1
  30. package/dist/ui/assets/{Users-CQNcXLyV.js → Users-FaX0thJx.js} +1 -1
  31. package/dist/ui/assets/{activity-CmAajKmR.js → activity-B_2QSywM.js} +1 -1
  32. package/dist/ui/assets/{agents-b8btewki.js → agents-YQJ7JNfI.js} +1 -1
  33. package/dist/ui/assets/{auth-dROenHXk.js → auth-Lh2N3iYN.js} +1 -1
  34. package/dist/ui/assets/{bot-QVmnxPf4.js → bot-DadO9w3D.js} +1 -1
  35. package/dist/ui/assets/{box-Bw_pyYzU.js → box-CFDcDxHv.js} +1 -1
  36. package/dist/ui/assets/{brain-C6vlLcg3.js → brain-DWTpby6b.js} +1 -1
  37. package/dist/ui/assets/{briefcase-DtHlat45.js → briefcase-mFWNV6w9.js} +1 -1
  38. package/dist/ui/assets/check-BiORptL3.js +1 -0
  39. package/dist/ui/assets/chevron-down-BUOg3vvd.js +1 -0
  40. package/dist/ui/assets/chevron-left-B0NmQyxK.js +1 -0
  41. package/dist/ui/assets/chevron-right-Bm_d1KKk.js +1 -0
  42. package/dist/ui/assets/{circle-alert-pUx6yhcF.js → circle-alert-sCcf7ANF.js} +1 -1
  43. package/dist/ui/assets/circle-check-Jz8IOE4h.js +1 -0
  44. package/dist/ui/assets/client-B553SX3l.js +9 -0
  45. package/dist/ui/assets/clock-CSNFJjo4.js +1 -0
  46. package/dist/ui/assets/{cpu-8Sbc9Dk0.js → cpu-C2_GFeSH.js} +1 -1
  47. package/dist/ui/assets/{database-D6O4hvbm.js → database-zXW48-_N.js} +1 -1
  48. package/dist/ui/assets/{download-DHcd5oLD.js → download-DZdOdijy.js} +1 -1
  49. package/dist/ui/assets/{eye-Cc-vy4Zu.js → eye-CjrFwZG_.js} +1 -1
  50. package/dist/ui/assets/{file-text-DWBSXx5l.js → file-text-CX_Yqfjf.js} +1 -1
  51. package/dist/ui/assets/{index-BvUv9Lzq.js → index-IcLlFUZs.js} +3 -3
  52. package/dist/ui/assets/{info-1jA6X-_e.js → info-DGHChFI6.js} +1 -1
  53. package/dist/ui/assets/{layers-BcHXXg-4.js → layers-CVf8_Byb.js} +1 -1
  54. package/dist/ui/assets/loader-circle-CB6PQwdc.js +1 -0
  55. package/dist/ui/assets/{panels-top-left-Vk8FzAxf.js → panels-top-left-Cp169WzB.js} +1 -1
  56. package/dist/ui/assets/{paperclip-DWJjaP8B.js → paperclip-5Y367YTj.js} +1 -1
  57. package/dist/ui/assets/plus-CkteVqhM.js +1 -0
  58. package/dist/ui/assets/{projects-CUOthD8N.js → projects-DoalTI7c.js} +1 -1
  59. package/dist/ui/assets/{providers-CNrSTcdc.js → providers-AawjMy3x.js} +1 -1
  60. package/dist/ui/assets/{recurrent-tasks-CKT47N2l.js → recurrent-tasks-7thk45mk.js} +1 -1
  61. package/dist/ui/assets/{refresh-cw-DQW6jR7M.js → refresh-cw-BgDsJOC_.js} +1 -1
  62. package/dist/ui/assets/{rocket-CMSwBl_C.js → rocket-B9Iexkcw.js} +1 -1
  63. package/dist/ui/assets/{save-DycJmlX0.js → save-Cmqi1IkN.js} +1 -1
  64. package/dist/ui/assets/{send-BZjwSrJW.js → send-iK1X7WSe.js} +1 -1
  65. package/dist/ui/assets/{server-CJE2K1Vt.js → server-BBmM-vrg.js} +1 -1
  66. package/dist/ui/assets/{settings-at7JqFrc.js → settings-BpKLGxm8.js} +1 -1
  67. package/dist/ui/assets/{shield-alert-CP5GVXxa.js → shield-alert-Do_Sg9SX.js} +1 -1
  68. package/dist/ui/assets/{shield-check-Cr4SHjdR.js → shield-check-YKs9kUNq.js} +1 -1
  69. package/dist/ui/assets/{sparkles-v57Nc-z-.js → sparkles-krUpxie4.js} +1 -1
  70. package/dist/ui/assets/{taskFormSchemas-dl1t1OyX.js → taskFormSchemas-B6YlRxrx.js} +1 -1
  71. package/dist/ui/assets/{tasks-DEUQCNoH.js → tasks-DHsBE-ea.js} +1 -1
  72. package/dist/ui/assets/{terminal-a6AV2mPO.js → terminal-B6iyNuAm.js} +1 -1
  73. package/dist/ui/assets/{trash-2-DJpTXgEP.js → trash-2-CphQfk35.js} +1 -1
  74. package/dist/ui/assets/{trending-up-DlrXEXE6.js → trending-up-ClGbkbN9.js} +1 -1
  75. package/dist/ui/assets/user-Brcjlps5.js +1 -0
  76. package/dist/ui/assets/{user-plus-nDkwsBT1.js → user-plus-0Y0M1GKi.js} +1 -1
  77. package/dist/ui/assets/{users-C6WiDiuN.js → users-BcnlUG5N.js} +1 -1
  78. package/dist/ui/assets/{users-Ef6Sh2iR.js → users-tdyaGZbx.js} +1 -1
  79. package/dist/ui/assets/x-CCZGYGDC.js +1 -0
  80. package/dist/ui/assets/{zap-BmhZqgvm.js → zap-BDAytXMX.js} +1 -1
  81. package/dist/ui/index.html +17 -17
  82. package/package.json +1 -1
  83. package/dist/ui/assets/check-DTei8Qlg.js +0 -1
  84. package/dist/ui/assets/chevron-down-LTeQHW9O.js +0 -1
  85. package/dist/ui/assets/chevron-left-CJc_eQid.js +0 -1
  86. package/dist/ui/assets/chevron-right-G5-HRo_C.js +0 -1
  87. package/dist/ui/assets/circle-check-B9kyRki5.js +0 -1
  88. package/dist/ui/assets/client-BGOBXkO8.js +0 -9
  89. package/dist/ui/assets/clock-BY4rrypg.js +0 -1
  90. package/dist/ui/assets/loader-circle-Cl6yIkPK.js +0 -1
  91. package/dist/ui/assets/plus-Dx6G8SOZ.js +0 -1
  92. package/dist/ui/assets/user--KOoEB9m.js +0 -1
  93. package/dist/ui/assets/x-wDy15QMx.js +0 -1
@@ -1,9 +1,9 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CreateTaskModal-BH9lOLYT.js","assets/vendor-query-xpDrc4rM.js","assets/rolldown-runtime-COnpUsM8.js","assets/vendor-dnd-CfaHPvi0.js","assets/vendor-markdown-DoJbQ1of.js","assets/vendor-forms-DHyqHeyd.js","assets/client-BGOBXkO8.js","assets/vendor-motion-CMGWJcqR.js","assets/chevron-down-LTeQHW9O.js","assets/MarkdownField--1gpyapw.js","assets/eye-Cc-vy4Zu.js","assets/sparkles-v57Nc-z-.js","assets/file-text-DWBSXx5l.js","assets/trash-2-DJpTXgEP.js","assets/user--KOoEB9m.js","assets/x-wDy15QMx.js","assets/agents-b8btewki.js","assets/projects-CUOthD8N.js","assets/tasks-DEUQCNoH.js","assets/useNotification-DQayTSUL.js","assets/taskFormSchemas-dl1t1OyX.js","assets/agentEmojis-BQA0jC3z.js"])))=>i.map(i=>d[i]);
2
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{a as t,c as n,d as r,f as i,g as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m,u as h}from"./vendor-dnd-CfaHPvi0.js";import{l as g,r as _,s as v}from"./vendor-react-BmVaKUwY.js";import{i as y,n as b}from"./vendor-query-xpDrc4rM.js";import{r as x}from"./vendor-markdown-DoJbQ1of.js";import{i as S}from"./client-BGOBXkO8.js";import{t as C}from"./check-DTei8Qlg.js";import{t as w}from"./clock-BY4rrypg.js";import{t as T}from"./paperclip-DWJjaP8B.js";import{t as ee}from"./panels-top-left-Vk8FzAxf.js";import{t as E}from"./shield-alert-CP5GVXxa.js";import{t as D}from"./sparkles-v57Nc-z-.js";import{t as te}from"./ConfirmDialog-y3vTcqFR.js";import{t as ne}from"./useProject-DhK9Ze6F.js";import{t as O}from"./projects-CUOthD8N.js";import{t as k}from"./useNotification-DQayTSUL.js";import{t as re}from"./AppErrorBoundary-BwnK_K-O.js";import{a as A}from"./agentEmojis-BQA0jC3z.js";import{i as j,n as M}from"./tasks-DEUQCNoH.js";import{t as N}from"./cn-CWOQtFh4.js";import{t as ie}from"./usePersistentFlag-R3_SXL_2.js";var P=S(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),ae=S(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),F=S(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),oe=S(`list-plus`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]),I=S(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),L=e(a(),1),R=x(),z=e=>e===0?`bg-error text-white shadow-[0_0_10px_rgba(255,107,107,0.3)]`:e===1?`bg-error-container/40 font-black text-error`:e===2?`bg-secondary-container/40 font-black text-secondary`:`bg-surface-container-highest font-black text-on-surface-variant`,B=e=>e===0?`Critical`:e===1?`High`:e===2?`Medium`:`Low`,V=e=>e===0?`CRIT`:e===1?`HIGH`:e===2?`MED`:`LOW`,H=e=>{switch(e){case`schedule`:return(0,R.jsx)(w,{size:14,className:`mr-1`,"aria-hidden":`true`});case`attach_file`:return(0,R.jsx)(T,{size:14,className:`mr-1`,"aria-hidden":`true`});case`comment`:return(0,R.jsx)(I,{size:14,className:`mr-1`,"aria-hidden":`true`});default:return null}},U=(0,L.memo)(({task:e,isOverlay:t})=>{let n=v(),{attributes:r,listeners:i,setNodeRef:a,transform:s,transition:l,isDragging:u}=o({id:t?`overlay-${e.id}`:e.id,data:{...e}}),d=t?!1:u,f=e.status===`done`,p=e.isActive,m=p||t,h=B(e.priority),g={transform:c.Transform.toString(s),transition:l},_=()=>{t||n(`/projects/${e.projectId}/tasks/${e.id}`)};return(0,R.jsxs)(`div`,{ref:a,style:g,...r,...i,className:N(`group relative flex h-full cursor-grab flex-col overflow-hidden rounded-xl border p-4 shadow-xl transition-all duration-300 active:cursor-grabbing`,d&&`scale-[0.98] border-outline-variant/20 bg-surface-container-low opacity-40 grayscale`,t&&`z-[100] scale-[1.05] cursor-grabbing border-primary/60 bg-surface-container-high shadow-[0_20px_50px_rgba(173,198,255,0.3)] ring-2 ring-primary/40 antialiased`,!d&&!t&&f&&`border-outline-variant/10 bg-surface-container-low opacity-70 shadow-sm grayscale hover:opacity-100 hover:grayscale-0`,!d&&!t&&!f&&`border-outline-variant/10 bg-surface-container-low hover:border-primary/30 hover:shadow-primary/5`,!d&&!t&&!f&&p&&`border-primary/40 bg-surface-container-high/50 shadow-lg`),onClick:_,"aria-label":`Task ${e.code}: ${e.title}. ${h} priority. Status ${e.status}.${t?` Drag preview active.`:` Drag to move or open details.`}`,"aria-roledescription":`Draggable task card`,children:[(0,R.jsx)(`span`,{className:`sr-only`,children:t?`Dragging preview.`:`Press space to start dragging this task, then use arrow keys to move it.`}),(0,R.jsxs)(`div`,{className:`mb-3 flex items-start justify-between`,children:[(0,R.jsx)(`span`,{className:N(`rounded px-2 py-0.5 font-headline text-[10px] font-black uppercase tracking-widest transition-colors`,m?`border border-primary/20 bg-primary-container/30 text-primary`:`bg-surface-container-highest/30 text-on-surface-variant/40`),children:e.code}),f?(0,R.jsx)(`div`,{"aria-label":`Completed task`,className:`flex h-4 w-4 items-center justify-center rounded-full bg-secondary-container/30`,children:(0,R.jsx)(C,{size:10,className:`font-bold text-secondary`,"aria-hidden":`true`})}):(0,R.jsx)(`span`,{"aria-label":`${h} priority`,className:N(`rounded px-2 py-0.5 text-[10px] font-black uppercase tracking-widest transition-colors`,m||t?z(e.priority):`bg-transparent text-on-surface-variant/60`),children:V(e.priority)})]}),(0,R.jsx)(`h4`,{className:N(`mb-4 text-base font-headline font-extrabold leading-tight transition-colors`,f?`text-outline line-through`:`text-on-surface group-hover:text-primary`),children:e.title}),(0,R.jsxs)(`div`,{className:`mt-auto flex items-center justify-between`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,R.jsx)(`div`,{className:N(`rounded border border-outline-variant/10 bg-surface-container-highest/50 p-1`,m&&`border-primary/30`),children:(0,R.jsx)(`span`,{className:N(`flex h-5 w-5 items-center justify-center rounded-sm text-sm`,f&&`grayscale`),"aria-label":`${e.agent.name} emoji`,children:A(e.agent.emoji)})}),(0,R.jsx)(`span`,{className:N(`text-[11px] font-bold tracking-tight`,m?`text-on-surface`:`text-on-surface-variant/40`),children:e.agent.name})]}),f?(0,R.jsx)(`span`,{className:`text-[10px] font-black tracking-widest text-secondary`,children:`COMPLETED`}):e.timeIcon&&!m&&(0,R.jsxs)(`div`,{className:`flex items-center text-[10px] font-black uppercase tracking-widest text-on-surface-variant/30`,"aria-label":`${e.timeLabel??`Task detail`} ${e.timeValue??``}`.trim(),children:[H(e.timeIcon),e.timeValue]})]})]})}),W=(0,L.memo)(({id:e,title:n,tasks:i,dotColorClass:a,badgeBgClass:o,badgeTextClass:s})=>{let{setNodeRef:c,isOver:l}=r({id:e}),u=(0,L.useId)(),d=(0,L.useMemo)(()=>i.map(e=>e.id),[i]);return(0,R.jsxs)(`section`,{"aria-labelledby":u,className:`flex flex-col gap-5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between px-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{"aria-hidden":`true`,className:N(`h-2 w-2 rounded-full`,a)}),(0,R.jsx)(`h3`,{id:u,className:N(`font-headline text-sm font-bold uppercase tracking-widest`,s),children:n}),(0,R.jsx)(`span`,{"aria-label":`${i.length} tasks`,className:N(`rounded px-1.5 py-0.5 text-[10px] font-bold`,o,s),children:i.length})]}),(0,R.jsx)(`button`,{type:`button`,disabled:!0,"aria-label":`${n} column options unavailable`,title:`${n} column options unavailable`,className:N(`transition-colors`,`text-outline hover:text-primary`,`disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:text-outline`),children:(0,R.jsx)(F,{size:18,"aria-hidden":`true`})})]}),(0,R.jsxs)(`div`,{ref:c,role:`list`,"aria-labelledby":u,className:N(`flex min-h-[300px] flex-col gap-5 rounded-xl transition-colors duration-200`,l&&`bg-surface-container-high/30 ring-2 ring-outline-variant/20`),children:[(0,R.jsx)(m,{items:d,strategy:t,children:i.map(e=>(0,R.jsx)(U,{task:e},e.id))}),i.length===0?(0,R.jsxs)(`p`,{className:`sr-only`,children:[n,` column is empty.`]}):null]})]})}),G=[{id:`backlog`,title:`Backlog`,dotColorClass:`bg-outline`,badgeBgClass:`bg-surface-container-high`,badgeTextClass:`text-outline-variant`},{id:`in-progress`,title:`In Progress`,dotColorClass:`bg-primary animate-pulse`,badgeBgClass:`bg-primary-container`,badgeTextClass:`text-primary`},{id:`review`,title:`Review`,dotColorClass:`bg-tertiary`,badgeBgClass:`bg-tertiary-container`,badgeTextClass:`text-tertiary`},{id:`done`,title:`Done`,dotColorClass:`bg-secondary`,badgeBgClass:`bg-secondary-container/20`,badgeTextClass:`text-secondary`}],K=(0,L.memo)(({tasks:e})=>{let t=(0,L.useMemo)(()=>{let t={backlog:[],"in-progress":[],review:[],done:[]};return e.forEach(e=>{e.status!==`archived`&&t[e.status].push(e)}),t},[e]);return(0,R.jsx)(`section`,{"aria-label":`Kanban task board`,className:N(`grid grid-cols-1 items-start gap-6 md:grid-cols-2 lg:grid-cols-4`),children:G.map(e=>(0,R.jsx)(W,{id:e.id,title:e.title,dotColorClass:e.dotColorClass,badgeBgClass:e.badgeBgClass,badgeTextClass:e.badgeTextClass,tasks:t[e.id]},e.id))})}),se=({tasks:e,taskCounts:t,projectTitle:n})=>(0,R.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-6`,children:[(0,R.jsxs)(`div`,{className:`glass-card p-6 rounded-2xl border border-outline-variant/10 col-span-1 md:col-span-2 flex flex-col md:flex-row justify-between items-center gap-6`,style:{background:`rgba(34, 42, 61, 0.4)`,backdropFilter:`blur(12px)`},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-headline font-bold text-lg text-on-surface`,children:`Efficiency Matrix`}),(0,R.jsx)(`p`,{className:`text-outline text-sm`,children:`System performance metrics for the active project.`}),(0,R.jsxs)(`div`,{className:`mt-4 flex gap-6`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col`,children:[(0,R.jsx)(`span`,{className:`text-2xl font-extrabold text-primary`,children:t.done}),(0,R.jsx)(`span`,{className:`text-[10px] font-bold text-outline uppercase tracking-wider`,children:`Completed`})]}),(0,R.jsxs)(`div`,{className:`flex flex-col`,children:[(0,R.jsx)(`span`,{className:`text-2xl font-extrabold text-secondary`,children:t[`in-progress`]}),(0,R.jsx)(`span`,{className:`text-[10px] font-bold text-outline uppercase tracking-wider`,children:`Active Nodes`})]})]})]}),(0,R.jsxs)(`div`,{className:`w-full md:w-48 h-24 bg-surface-container-highest/30 rounded-lg relative overflow-hidden flex items-end px-2 gap-1`,children:[[`backlog`,`in-progress`,`review`,`done`].map((n,r)=>{let i=t[n],a=e.length>0?i/e.length*100:10;return(0,R.jsx)(`div`,{className:`w-full bg-primary/40 rounded-t transition-all duration-500`,style:{height:`${Math.max(a,5)}%`,opacity:.3+r*.2}},n)}),(0,R.jsx)(`div`,{className:`absolute inset-0 pointer-events-none opacity-30 flex items-center justify-center`,children:(0,R.jsx)(`span`,{className:`text-primary text-[8px] font-mono uppercase tracking-[0.5em]`,children:`Live Stats`})})]})]}),(0,R.jsxs)(`div`,{className:`bg-tertiary-container/10 p-6 rounded-2xl border border-tertiary/10 relative overflow-hidden group`,children:[(0,R.jsx)(`div`,{className:`absolute -right-4 -top-4 text-tertiary/5 text-8xl transition-transform group-hover:scale-110`,children:(0,R.jsx)(D,{size:80})}),(0,R.jsx)(`h3`,{className:`font-headline font-bold text-tertiary`,children:`Orchestration Info`}),(0,R.jsx)(`p`,{className:`text-on-surface-variant text-sm mt-2 relative z-10`,children:e.length>0?`Managing ${e.length} tasks across ${n}. Drag tasks between columns to update their operational status.`:`Create new tasks to begin project orchestration. Tasks will automatically be mapped to assigned intelligence nodes.`})]})]}),ce=({isDragging:e})=>{let{setNodeRef:t,isOver:n}=r({id:`archive`});return(0,R.jsxs)(`div`,{ref:t,className:`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CreateTaskModal-XNvIWKz3.js","assets/vendor-query-xpDrc4rM.js","assets/rolldown-runtime-COnpUsM8.js","assets/vendor-dnd-CfaHPvi0.js","assets/vendor-markdown-DoJbQ1of.js","assets/vendor-forms-DHyqHeyd.js","assets/client-B553SX3l.js","assets/vendor-motion-CMGWJcqR.js","assets/chevron-down-BUOg3vvd.js","assets/MarkdownField-DR6tHsei.js","assets/eye-CjrFwZG_.js","assets/sparkles-krUpxie4.js","assets/file-text-CX_Yqfjf.js","assets/trash-2-CphQfk35.js","assets/user-Brcjlps5.js","assets/x-CCZGYGDC.js","assets/agents-YQJ7JNfI.js","assets/projects-DoalTI7c.js","assets/tasks-DHsBE-ea.js","assets/useNotification-DQayTSUL.js","assets/taskFormSchemas-B6YlRxrx.js","assets/agentEmojis-BQA0jC3z.js"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{a as t,c as n,d as r,f as i,g as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m,u as h}from"./vendor-dnd-CfaHPvi0.js";import{l as g,r as _,s as v}from"./vendor-react-BmVaKUwY.js";import{i as y,n as b}from"./vendor-query-xpDrc4rM.js";import{r as x}from"./vendor-markdown-DoJbQ1of.js";import{i as S}from"./client-B553SX3l.js";import{t as C}from"./check-BiORptL3.js";import{t as w}from"./clock-CSNFJjo4.js";import{t as T}from"./paperclip-5Y367YTj.js";import{t as ee}from"./panels-top-left-Cp169WzB.js";import{t as E}from"./shield-alert-Do_Sg9SX.js";import{t as D}from"./sparkles-krUpxie4.js";import{t as te}from"./ConfirmDialog-BltdtevE.js";import{t as ne}from"./useProject-DhK9Ze6F.js";import{t as O}from"./projects-DoalTI7c.js";import{t as k}from"./useNotification-DQayTSUL.js";import{t as re}from"./AppErrorBoundary-BwnK_K-O.js";import{a as A}from"./agentEmojis-BQA0jC3z.js";import{i as j,n as M}from"./tasks-DHsBE-ea.js";import{t as N}from"./cn-CWOQtFh4.js";import{t as ie}from"./usePersistentFlag-R3_SXL_2.js";var P=S(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),ae=S(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),F=S(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),oe=S(`list-plus`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]),I=S(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),L=e(a(),1),R=x(),z=e=>e===0?`bg-error text-white shadow-[0_0_10px_rgba(255,107,107,0.3)]`:e===1?`bg-error-container/40 font-black text-error`:e===2?`bg-secondary-container/40 font-black text-secondary`:`bg-surface-container-highest font-black text-on-surface-variant`,B=e=>e===0?`Critical`:e===1?`High`:e===2?`Medium`:`Low`,V=e=>e===0?`CRIT`:e===1?`HIGH`:e===2?`MED`:`LOW`,H=e=>{switch(e){case`schedule`:return(0,R.jsx)(w,{size:14,className:`mr-1`,"aria-hidden":`true`});case`attach_file`:return(0,R.jsx)(T,{size:14,className:`mr-1`,"aria-hidden":`true`});case`comment`:return(0,R.jsx)(I,{size:14,className:`mr-1`,"aria-hidden":`true`});default:return null}},U=(0,L.memo)(({task:e,isOverlay:t})=>{let n=v(),{attributes:r,listeners:i,setNodeRef:a,transform:s,transition:l,isDragging:u}=o({id:t?`overlay-${e.id}`:e.id,data:{...e}}),d=t?!1:u,f=e.status===`done`,p=e.isActive,m=p||t,h=B(e.priority),g={transform:c.Transform.toString(s),transition:l},_=()=>{t||n(`/projects/${e.projectId}/tasks/${e.id}`)};return(0,R.jsxs)(`div`,{ref:a,style:g,...r,...i,className:N(`group relative flex h-full cursor-grab flex-col overflow-hidden rounded-xl border p-4 shadow-xl transition-all duration-300 active:cursor-grabbing`,d&&`scale-[0.98] border-outline-variant/20 bg-surface-container-low opacity-40 grayscale`,t&&`z-[100] scale-[1.05] cursor-grabbing border-primary/60 bg-surface-container-high shadow-[0_20px_50px_rgba(173,198,255,0.3)] ring-2 ring-primary/40 antialiased`,!d&&!t&&f&&`border-outline-variant/10 bg-surface-container-low opacity-70 shadow-sm grayscale hover:opacity-100 hover:grayscale-0`,!d&&!t&&!f&&`border-outline-variant/10 bg-surface-container-low hover:border-primary/30 hover:shadow-primary/5`,!d&&!t&&!f&&p&&`border-primary/40 bg-surface-container-high/50 shadow-lg`),onClick:_,"aria-label":`Task ${e.code}: ${e.title}. ${h} priority. Status ${e.status}.${t?` Drag preview active.`:` Drag to move or open details.`}`,"aria-roledescription":`Draggable task card`,children:[(0,R.jsx)(`span`,{className:`sr-only`,children:t?`Dragging preview.`:`Press space to start dragging this task, then use arrow keys to move it.`}),(0,R.jsxs)(`div`,{className:`mb-3 flex items-start justify-between`,children:[(0,R.jsx)(`span`,{className:N(`rounded px-2 py-0.5 font-headline text-[10px] font-black uppercase tracking-widest transition-colors`,m?`border border-primary/20 bg-primary-container/30 text-primary`:`bg-surface-container-highest/30 text-on-surface-variant/40`),children:e.code}),f?(0,R.jsx)(`div`,{"aria-label":`Completed task`,className:`flex h-4 w-4 items-center justify-center rounded-full bg-secondary-container/30`,children:(0,R.jsx)(C,{size:10,className:`font-bold text-secondary`,"aria-hidden":`true`})}):(0,R.jsx)(`span`,{"aria-label":`${h} priority`,className:N(`rounded px-2 py-0.5 text-[10px] font-black uppercase tracking-widest transition-colors`,m||t?z(e.priority):`bg-transparent text-on-surface-variant/60`),children:V(e.priority)})]}),(0,R.jsx)(`h4`,{className:N(`mb-4 text-base font-headline font-extrabold leading-tight transition-colors`,f?`text-outline line-through`:`text-on-surface group-hover:text-primary`),children:e.title}),(0,R.jsxs)(`div`,{className:`mt-auto flex items-center justify-between`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,R.jsx)(`div`,{className:N(`rounded border border-outline-variant/10 bg-surface-container-highest/50 p-1`,m&&`border-primary/30`),children:(0,R.jsx)(`span`,{className:N(`flex h-5 w-5 items-center justify-center rounded-sm text-sm`,f&&`grayscale`),"aria-label":`${e.agent.name} emoji`,children:A(e.agent.emoji)})}),(0,R.jsx)(`span`,{className:N(`text-[11px] font-bold tracking-tight`,m?`text-on-surface`:`text-on-surface-variant/40`),children:e.agent.name})]}),f?(0,R.jsx)(`span`,{className:`text-[10px] font-black tracking-widest text-secondary`,children:`COMPLETED`}):e.timeIcon&&!m&&(0,R.jsxs)(`div`,{className:`flex items-center text-[10px] font-black uppercase tracking-widest text-on-surface-variant/30`,"aria-label":`${e.timeLabel??`Task detail`} ${e.timeValue??``}`.trim(),children:[H(e.timeIcon),e.timeValue]})]})]})}),W=(0,L.memo)(({id:e,title:n,tasks:i,dotColorClass:a,badgeBgClass:o,badgeTextClass:s})=>{let{setNodeRef:c,isOver:l}=r({id:e}),u=(0,L.useId)(),d=(0,L.useMemo)(()=>i.map(e=>e.id),[i]);return(0,R.jsxs)(`section`,{"aria-labelledby":u,className:`flex flex-col gap-5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between px-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{"aria-hidden":`true`,className:N(`h-2 w-2 rounded-full`,a)}),(0,R.jsx)(`h3`,{id:u,className:N(`font-headline text-sm font-bold uppercase tracking-widest`,s),children:n}),(0,R.jsx)(`span`,{"aria-label":`${i.length} tasks`,className:N(`rounded px-1.5 py-0.5 text-[10px] font-bold`,o,s),children:i.length})]}),(0,R.jsx)(`button`,{type:`button`,disabled:!0,"aria-label":`${n} column options unavailable`,title:`${n} column options unavailable`,className:N(`transition-colors`,`text-outline hover:text-primary`,`disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:text-outline`),children:(0,R.jsx)(F,{size:18,"aria-hidden":`true`})})]}),(0,R.jsxs)(`div`,{ref:c,role:`list`,"aria-labelledby":u,className:N(`flex min-h-[300px] flex-col gap-5 rounded-xl transition-colors duration-200`,l&&`bg-surface-container-high/30 ring-2 ring-outline-variant/20`),children:[(0,R.jsx)(m,{items:d,strategy:t,children:i.map(e=>(0,R.jsx)(U,{task:e},e.id))}),i.length===0?(0,R.jsxs)(`p`,{className:`sr-only`,children:[n,` column is empty.`]}):null]})]})}),G=[{id:`backlog`,title:`Backlog`,dotColorClass:`bg-outline`,badgeBgClass:`bg-surface-container-high`,badgeTextClass:`text-outline-variant`},{id:`in-progress`,title:`In Progress`,dotColorClass:`bg-primary animate-pulse`,badgeBgClass:`bg-primary-container`,badgeTextClass:`text-primary`},{id:`review`,title:`Review`,dotColorClass:`bg-tertiary`,badgeBgClass:`bg-tertiary-container`,badgeTextClass:`text-tertiary`},{id:`done`,title:`Done`,dotColorClass:`bg-secondary`,badgeBgClass:`bg-secondary-container/20`,badgeTextClass:`text-secondary`}],K=(0,L.memo)(({tasks:e})=>{let t=(0,L.useMemo)(()=>{let t={backlog:[],"in-progress":[],review:[],done:[]};return e.forEach(e=>{e.status!==`archived`&&t[e.status].push(e)}),t},[e]);return(0,R.jsx)(`section`,{"aria-label":`Kanban task board`,className:N(`grid grid-cols-1 items-start gap-6 md:grid-cols-2 lg:grid-cols-4`),children:G.map(e=>(0,R.jsx)(W,{id:e.id,title:e.title,dotColorClass:e.dotColorClass,badgeBgClass:e.badgeBgClass,badgeTextClass:e.badgeTextClass,tasks:t[e.id]},e.id))})}),se=({tasks:e,taskCounts:t,projectTitle:n})=>(0,R.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-6`,children:[(0,R.jsxs)(`div`,{className:`glass-card p-6 rounded-2xl border border-outline-variant/10 col-span-1 md:col-span-2 flex flex-col md:flex-row justify-between items-center gap-6`,style:{background:`rgba(34, 42, 61, 0.4)`,backdropFilter:`blur(12px)`},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-headline font-bold text-lg text-on-surface`,children:`Efficiency Matrix`}),(0,R.jsx)(`p`,{className:`text-outline text-sm`,children:`System performance metrics for the active project.`}),(0,R.jsxs)(`div`,{className:`mt-4 flex gap-6`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col`,children:[(0,R.jsx)(`span`,{className:`text-2xl font-extrabold text-primary`,children:t.done}),(0,R.jsx)(`span`,{className:`text-[10px] font-bold text-outline uppercase tracking-wider`,children:`Completed`})]}),(0,R.jsxs)(`div`,{className:`flex flex-col`,children:[(0,R.jsx)(`span`,{className:`text-2xl font-extrabold text-secondary`,children:t[`in-progress`]}),(0,R.jsx)(`span`,{className:`text-[10px] font-bold text-outline uppercase tracking-wider`,children:`Active Nodes`})]})]})]}),(0,R.jsxs)(`div`,{className:`w-full md:w-48 h-24 bg-surface-container-highest/30 rounded-lg relative overflow-hidden flex items-end px-2 gap-1`,children:[[`backlog`,`in-progress`,`review`,`done`].map((n,r)=>{let i=t[n],a=e.length>0?i/e.length*100:10;return(0,R.jsx)(`div`,{className:`w-full bg-primary/40 rounded-t transition-all duration-500`,style:{height:`${Math.max(a,5)}%`,opacity:.3+r*.2}},n)}),(0,R.jsx)(`div`,{className:`absolute inset-0 pointer-events-none opacity-30 flex items-center justify-center`,children:(0,R.jsx)(`span`,{className:`text-primary text-[8px] font-mono uppercase tracking-[0.5em]`,children:`Live Stats`})})]})]}),(0,R.jsxs)(`div`,{className:`bg-tertiary-container/10 p-6 rounded-2xl border border-tertiary/10 relative overflow-hidden group`,children:[(0,R.jsx)(`div`,{className:`absolute -right-4 -top-4 text-tertiary/5 text-8xl transition-transform group-hover:scale-110`,children:(0,R.jsx)(D,{size:80})}),(0,R.jsx)(`h3`,{className:`font-headline font-bold text-tertiary`,children:`Orchestration Info`}),(0,R.jsx)(`p`,{className:`text-on-surface-variant text-sm mt-2 relative z-10`,children:e.length>0?`Managing ${e.length} tasks across ${n}. Drag tasks between columns to update their operational status.`:`Create new tasks to begin project orchestration. Tasks will automatically be mapped to assigned intelligence nodes.`})]})]}),ce=({isDragging:e})=>{let{setNodeRef:t,isOver:n}=r({id:`archive`});return(0,R.jsxs)(`div`,{ref:t,className:`
3
3
  flex-1 flex items-center gap-4 px-6 py-3 rounded-2xl border-2 border-dashed transition-all duration-500 min-w-[240px]
4
4
  ${n?`bg-error/20 border-error text-error scale-[1.02] shadow-xl shadow-error/10 z-50`:e?`bg-article-container/40 border-primary/40 text-primary animate-pulse shadow-lg`:`bg-surface-container-low/20 border-outline-variant/10 text-on-surface-variant/40 hover:bg-surface-container-low/40 hover:border-outline-variant/30`}
5
5
  `,children:[(0,R.jsx)(`div`,{className:`
6
6
  w-10 h-10 rounded-xl flex items-center justify-center transition-all duration-500
7
7
  ${n?`bg-error text-white rotate-12`:e?`bg-primary/20 text-primary`:`bg-surface-container-highest/50`}
8
8
  `,children:(0,R.jsx)(P,{size:20})}),(0,R.jsxs)(`div`,{className:`flex flex-col flex-1`,children:[(0,R.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-[0.2em] leading-none transition-colors ${n?`text-error`:e?`text-primary`:`text-on-surface-variant/60`}`,children:n?`Authorization Required`:`Archival Logic Sink`}),(0,R.jsx)(`span`,{className:`text-[9px] font-bold opacity-40 uppercase tracking-widest mt-1.5 whitespace-nowrap`,children:n?`Release to decommissioning`:e?`Drag node here to decommission`:`Project dormant`})]}),e&&!n&&(0,R.jsx)(`div`,{className:`flex gap-1`,children:[1,2,3].map(e=>(0,R.jsx)(`div`,{className:`w-1 h-1 rounded-full bg-primary/40 animate-ping`,style:{animationDelay:`${e*.2}s`}},e))})]})};async function le(e,t){let n=e.getReader(),r;for(;!(r=await n.read()).done;)t(r.value)}function ue(e){let t,n,r,i=!1;return function(a){t===void 0?(t=a,n=0,r=-1):t=fe(t,a);let o=t.length,s=0;for(;n<o;){i&&(t[n]===10&&(s=++n),i=!1);let a=-1;for(;n<o&&a===-1;++n)switch(t[n]){case 58:r===-1&&(r=n-s);break;case 13:i=!0;case 10:a=n;break}if(a===-1)break;e(t.subarray(s,a),r),s=n,r=-1}s===o?t=void 0:s!==0&&(t=t.subarray(s),n-=s)}}function de(e,t,n){let r=q(),i=new TextDecoder;return function(a,o){if(a.length===0)n?.(r),r=q();else if(o>0){let n=i.decode(a.subarray(0,o)),s=o+(a[o+1]===32?2:1),c=i.decode(a.subarray(s));switch(n){case`data`:r.data=r.data?r.data+`
9
- `+c:c;break;case`event`:r.event=c;break;case`id`:e(r.id=c);break;case`retry`:let n=parseInt(c,10);isNaN(n)||t(r.retry=n);break}}}}function fe(e,t){let n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function q(){return{data:``,event:``,id:``,retry:void 0}}var pe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},J=`text/event-stream`,me=1e3,Y=`last-event-id`;function he(e,t){var{signal:n,headers:r,onopen:i,onmessage:a,onclose:o,onerror:s,openWhenHidden:c,fetch:l}=t,u=pe(t,[`signal`,`headers`,`onopen`,`onmessage`,`onclose`,`onerror`,`openWhenHidden`,`fetch`]);return new Promise((t,d)=>{let f=Object.assign({},r);f.accept||(f.accept=J);let p;function m(){p.abort(),document.hidden||b()}c||document.addEventListener(`visibilitychange`,m);let h=me,g=0;function _(){document.removeEventListener(`visibilitychange`,m),window.clearTimeout(g),p.abort()}n?.addEventListener(`abort`,()=>{_(),t()});let v=l??window.fetch,y=i??ge;async function b(){p=new AbortController;try{let n=await v(e,Object.assign(Object.assign({},u),{headers:f,signal:p.signal}));await y(n),await le(n.body,ue(de(e=>{e?f[Y]=e:delete f[Y]},e=>{h=e},a))),o?.(),_(),t()}catch(e){if(!p.signal.aborted)try{let t=s?.(e)??h;window.clearTimeout(g),g=window.setTimeout(b,t)}catch(e){_(),d(e)}}}b()})}function ge(e){let t=e.headers.get(`content-type`);if(!t?.startsWith(`text/event-stream`))throw Error(`Expected content-type to be ${J}, Actual: ${t}`)}var _e=(e,t)=>{let n=(0,L.useRef)(null),r=(0,L.useRef)(t);(0,L.useEffect)(()=>{r.current=t},[t]),(0,L.useEffect)(()=>e?(n.current=new AbortController,(async()=>{try{await he(`/api/v1/projects/${e}/tasks/events`,{method:`GET`,headers:{Accept:`text/event-stream`},credentials:`include`,signal:n.current?.signal,onmessage(e){if(e.data)try{let t=JSON.parse(e.data);t&&t.task&&t.event&&r.current(t.event,t.task)}catch{}},onclose(){},onerror(){}})}catch{}})(),()=>{n.current&&n.current.abort()}):void 0,[e])};function ve({tasks:e,setTasks:t,onStatusChange:r,skipArchiveConfirm:a}){let[o,c]=(0,L.useState)(null),[u,p]=(0,L.useState)(null),[m,g]=(0,L.useState)(!1),[_,v]=(0,L.useState)(null);return{activeId:o,sensors:d(i(s,{activationConstraint:{distance:5}}),i(n,{coordinateGetter:f})),collisionDetection:h,handleDragStart:(0,L.useCallback)(t=>{let n=t.active.id;c(n);let r=e.find(e=>e.id===n);r&&p(r.status)},[e]),handleDragOver:(0,L.useCallback)(n=>{let{active:r,over:i}=n;if(!i)return;let a=r.id,o=i.id;if(a===o)return;let s=e.findIndex(e=>e.id===a),c=e.findIndex(e=>e.id===o);if(s===-1)return;let u=o===`backlog`||o===`in-progress`||o===`review`||o===`done`;if(!u&&c>=0){if(e[s].status!==e[c].status){let n=[...e],r=e[c].status;n[s]={...n[s],status:r,isActive:r===`in-progress`},t(l(n,s,c))}}else if(u&&e[s].status!==o){let n=[...e],r=o;n[s]={...n[s],status:r,isActive:r===`in-progress`},t(l(n,s,e.length-1))}},[e,t]),handleDragEnd:(0,L.useCallback)(async n=>{let{active:i,over:o}=n;if(c(null),!o)return;let s=i.id,d=o.id;if(!e.find(e=>e.id===s))return;if(d===`archive`){a?await r(s,`archived`):(v(s),g(!0)),p(null);return}let f=d===`backlog`||d===`in-progress`||d===`review`||d===`done`?d:e.find(e=>e.id===d)?.status;if(f&&u!==f&&await r(s,f),p(null),s===d)return;let m=e.findIndex(e=>e.id===s),h=e.findIndex(e=>e.id===d);m!==-1&&!(d===`backlog`||d===`in-progress`||d===`review`||d===`done`)&&h>=0&&e[m].status===e[h].status&&t(l(e,m,h))},[e,t,u,a,r]),isConfirmOpen:m,setIsConfirmOpen:g,pendingArchiveId:_,setPendingArchiveId:v}}var ye=`bg-surface-container-highest border-outline-variant/30`,X=e=>e===`done`?100:e===`in-progress`?50:0,Z=e=>{switch(e){case`backlog`:return 0;case`in-progress`:return 1;case`review`:return 2;case`done`:return 3;case`archived`:return 4}};function Q(e,t){let n=e.status;return{id:e.id,status:n,code:`#TASK-${e.id.substring(0,4).toUpperCase()}`,title:e.title,priority:e.priority,agent:{name:e.assignee?.name||`Unassigned`,emoji:e.assignee?.emoji,colorClass:ye},isActive:n===`in-progress`,progress:X(n),projectId:t,updatedAt:e.updatedAt}}function $(e,t){let n=Z(e.status)-Z(t.status);if(n!==0)return n;if(e.status===`backlog`&&t.status===`backlog`){let n=(e.priority||0)-(t.priority||0);return n===0?e.id.localeCompare(t.id):n}let r=new Date(t.updatedAt||0).getTime()-new Date(e.updatedAt||0).getTime();return r===0?e.id.localeCompare(t.id):r}function be(e,t,n,r){if(t===`deleted`||n.status===M.ARCHIVED)return e.filter(e=>e.id!==n.id);let i=Q(n,r);return e.findIndex(e=>e.id===n.id)===-1?[...e,i].sort($):e.map(e=>e.id===n.id?i:e).sort($)}function xe(e,t,n){return n===`archived`?e.filter(e=>e.id!==t):e.map(e=>e.id===t?{...e,status:n,isActive:n===`in-progress`,progress:X(n)}:e).sort($)}var Se=(0,L.lazy)(()=>g(()=>import(`./CreateTaskModal-BH9lOLYT.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]))),Ce=()=>{let{activeProject:e,loading:t}=ne(),{notifyError:n}=k(),r=y(),[i,a]=(0,L.useState)(!1),[o,s]=ie(`skipArchiveConfirm`,!1),[c,l]=(0,L.useState)(!1),d=(0,L.useMemo)(()=>[`tasks`,e?.id],[e?.id]),{data:f=[],isLoading:m}=b({queryKey:d,queryFn:async()=>(await j.fetchAll(e.id)).filter(e=>e.status!==`archived`).map(t=>Q(t,e.id)).sort($),enabled:!!e?.id,staleTime:1/0,refetchOnWindowFocus:!1}),h=(0,L.useCallback)((t,n)=>{!e||n.projectId!==e.id||r.setQueryData(d,(r=[])=>be(r,t,n,e.id))},[e,r,d]);_e(e?.id,h);let g=(0,L.useCallback)(()=>{r.invalidateQueries({queryKey:d})},[r,d]),v=(0,L.useCallback)(async(t,i)=>{if(e)try{await j.update(e.id,t,{status:i}),r.setQueryData(d,(e=[])=>xe(e,t,i))}catch{n(`Status Update Failed`,`Failed to update task status in the neural mesh.`),r.invalidateQueries({queryKey:d})}},[e,n,r,d]),{activeId:x,sensors:S,collisionDetection:C,handleDragStart:w,handleDragOver:T,handleDragEnd:D,isConfirmOpen:A,setIsConfirmOpen:M,pendingArchiveId:P,setPendingArchiveId:F}=ve({tasks:f,setTasks:(0,L.useCallback)(e=>{r.setQueryData(d,(t=[])=>typeof e==`function`?e(t):e)},[r,d]),onStatusChange:v,skipArchiveConfirm:o}),I=(0,L.useCallback)(async()=>{P&&(c&&s(!0),await v(P,`archived`)),M(!1),F(null)},[c,v,P,M,F,s]),z=(0,L.useMemo)(()=>f.find(e=>e.id===x),[f,x]),B=(0,L.useMemo)(()=>f.reduce((e,t)=>(e[t.status]+=1,e),{backlog:0,"in-progress":0,review:0,done:0,archived:0}),[f]);if(t)return(0,R.jsx)(`div`,{className:`w-full h-[60vh] flex items-center justify-center`,children:(0,R.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,R.jsx)(`div`,{className:`w-16 h-16 border-4 border-primary border-t-transparent rounded-full animate-spin`}),(0,R.jsx)(`p`,{className:`text-on-surface-variant text-sm font-black uppercase tracking-[0.3em] animate-pulse`,children:`Initializing Neural Mesh`})]})});if(!e)return(0,R.jsx)(`div`,{className:`w-full h-[60vh] flex items-center justify-center`,children:(0,R.jsxs)(`div`,{className:`text-center space-y-6 max-w-md`,children:[(0,R.jsx)(`div`,{className:`w-20 h-20 bg-surface-container-highest rounded-3xl flex items-center justify-center text-on-surface-variant/20 mx-auto border border-outline-variant/10 shadow-xl`,children:(0,R.jsx)(ee,{size:40})}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`h2`,{className:`text-2xl font-black font-headline text-white tracking-tight`,children:`No Active Projects Found`}),(0,R.jsx)(`p`,{className:`text-on-surface-variant text-sm leading-relaxed`,children:`The orchestration grid is currently offline. Please create a project in the sidebar to begin commissioning agentic tasks.`})]}),(0,R.jsxs)(_,{to:`/`,className:`inline-flex items-center gap-2 px-8 py-3 bg-primary text-on-primary rounded-xl font-black text-xs uppercase tracking-widest hover:scale-105 active:scale-95 transition-all shadow-lg shadow-primary/20`,children:[`Go to Dashboard`,(0,R.jsx)(ae,{size:16})]})]})});let V=!e.ownerAgent,H=e.status!==O.ACTIVE;return(0,R.jsxs)(u,{sensors:S,collisionDetection:C,onDragStart:w,onDragOver:T,onDragEnd:D,children:[(0,R.jsxs)(`div`,{className:`space-y-10 animate-in fade-in duration-700`,children:[V&&(0,R.jsxs)(`div`,{className:`bg-error/10 border border-error/20 p-4 rounded-2xl flex flex-col md:flex-row items-center justify-between gap-4 animate-in fade-in slide-in-from-top-4 duration-500 shadow-lg shadow-error/5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,R.jsx)(`div`,{className:`w-12 h-12 rounded-2xl bg-error/20 flex items-center justify-center text-error border border-error/30`,children:(0,R.jsx)(E,{size:24})}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h4`,{className:`text-sm font-black text-white uppercase tracking-tight`,children:`Administrative Protocol Warning`}),(0,R.jsxs)(`p`,{className:`text-xs text-on-surface-variant max-w-2xl leading-relaxed mt-0.5`,children:[`The `,(0,R.jsxs)(`span`,{className:`text-error font-bold italic`,children:[`"`,e.title,`"`]}),` project currently lacks a Designated Lead Agent. A lead is required to oversee autonomous task assignment, token allocation, and critical project operations.`]})]})]}),(0,R.jsx)(_,{to:`/projects/${e.id}`,className:`w-full md:w-auto px-6 py-2.5 rounded-xl bg-error text-on-error text-xs font-black uppercase tracking-widest hover:scale-[1.02] active:scale-[0.98] transition-all whitespace-nowrap text-center shadow-lg shadow-error/20`,children:`Assign Protocol Lead`})]}),H&&(0,R.jsxs)(`div`,{className:`bg-amber-500/10 border border-amber-500/20 p-4 rounded-2xl flex flex-col md:flex-row items-center justify-between gap-4 animate-in fade-in slide-in-from-top-4 duration-500 shadow-lg shadow-amber-500/5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,R.jsx)(`div`,{className:`w-12 h-12 rounded-2xl bg-amber-500/20 flex items-center justify-center text-amber-400 border border-amber-500/30`,children:(0,R.jsx)(E,{size:24})}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h4`,{className:`text-sm font-black text-white uppercase tracking-tight`,children:`Administrative Protocol Warning`}),(0,R.jsxs)(`p`,{className:`text-xs text-on-surface-variant max-w-2xl leading-relaxed mt-0.5`,children:[`Project `,(0,R.jsxs)(`span`,{className:`text-amber-400 font-bold italic`,children:[`"`,e.title,`"`]}),` is currently in`,` `,(0,R.jsx)(`span`,{className:`text-amber-400 font-bold uppercase`,children:e.status.replace(`_`,` `)}),` mode. The agent scheduler will not execute tasks until the project is set to`,` `,(0,R.jsx)(`span`,{className:`text-amber-400 font-bold uppercase`,children:`Active`}),`.`]})]})]}),(0,R.jsx)(_,{to:`/projects/${e.id}`,className:`w-full md:w-auto px-6 py-2.5 rounded-xl bg-amber-500 text-black text-xs font-black uppercase tracking-widest hover:scale-[1.02] active:scale-[0.98] transition-all whitespace-nowrap text-center shadow-lg shadow-amber-500/20`,children:`Activate Project`})]}),(0,R.jsxs)(`div`,{className:`flex flex-col md:flex-row justify-between items-start md:items-center gap-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3 mb-1`,children:[(0,R.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-[0.3em] text-primary/60`,children:`Fleet Command`}),(0,R.jsx)(`div`,{className:`h-1 w-1 rounded-full bg-outline-variant/30`}),(0,R.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-[0.3em] text-on-surface-variant/40`,children:e.title})]}),(0,R.jsx)(`h1`,{className:`text-4xl font-extrabold font-headline tracking-tight text-white`,children:`Agentic Task Canvas`}),(0,R.jsxs)(`p`,{className:`text-outline text-sm mt-1`,children:[`Orchestrating `,(0,R.jsx)(`span`,{className:`text-primary font-bold`,children:f.length}),` parallel node operations`]})]}),(0,R.jsxs)(`div`,{className:`flex-1 flex items-center justify-end gap-6 max-w-4xl`,children:[(0,R.jsx)(ce,{isDragging:!!x}),(0,R.jsxs)(`button`,{onClick:()=>a(!0),className:`bg-primary hover:bg-primary/90 text-on-primary px-8 py-3.5 rounded-2xl flex items-center gap-2 font-black text-xs uppercase tracking-widest transition-all shadow-lg shadow-primary/20 hover:scale-[1.02] active:scale-[0.98] whitespace-nowrap`,children:[(0,R.jsx)(oe,{size:18}),`Commission Task`]})]})]}),(0,R.jsx)(L.Suspense,{fallback:null,children:(0,R.jsx)(Se,{isOpen:i,onClose:()=>a(!1),onCreated:g})}),(0,R.jsx)(re,{title:`Unable to render task board`,description:`The Kanban board hit an unexpected error. You can still use the rest of Task Manager while retrying this section.`,children:(0,R.jsx)(`section`,{"aria-label":`Task board panel`,"aria-busy":m,className:N(`space-y-4`,m&&f.length===0&&`min-h-96`),children:m&&f.length===0?(0,R.jsx)(`div`,{className:`flex h-96 w-full items-center justify-center`,children:(0,R.jsx)(`div`,{className:`h-12 w-12 animate-spin rounded-full border-4 border-outline-variant/30 border-t-primary`})}):(0,R.jsx)(K,{tasks:f})})}),(0,R.jsx)(se,{tasks:f,taskCounts:B,projectTitle:e.title})]}),(0,R.jsx)(p,{children:z?(0,R.jsx)(U,{task:z,isOverlay:!0}):null}),(0,R.jsx)(te,{isOpen:A,onClose:()=>M(!1),onConfirm:I,title:`Archive Protocol Task`,message:`Are you sure you want to transfer this task to the archive? This operation will remove the task node from the active grid.`,confirmText:`Archive Task`,variant:`warning`,showCheckbox:!0,onCheckboxChange:l})]})};export{Ce as default};
9
+ `+c:c;break;case`event`:r.event=c;break;case`id`:e(r.id=c);break;case`retry`:let n=parseInt(c,10);isNaN(n)||t(r.retry=n);break}}}}function fe(e,t){let n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function q(){return{data:``,event:``,id:``,retry:void 0}}var pe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},J=`text/event-stream`,me=1e3,Y=`last-event-id`;function he(e,t){var{signal:n,headers:r,onopen:i,onmessage:a,onclose:o,onerror:s,openWhenHidden:c,fetch:l}=t,u=pe(t,[`signal`,`headers`,`onopen`,`onmessage`,`onclose`,`onerror`,`openWhenHidden`,`fetch`]);return new Promise((t,d)=>{let f=Object.assign({},r);f.accept||(f.accept=J);let p;function m(){p.abort(),document.hidden||b()}c||document.addEventListener(`visibilitychange`,m);let h=me,g=0;function _(){document.removeEventListener(`visibilitychange`,m),window.clearTimeout(g),p.abort()}n?.addEventListener(`abort`,()=>{_(),t()});let v=l??window.fetch,y=i??ge;async function b(){p=new AbortController;try{let n=await v(e,Object.assign(Object.assign({},u),{headers:f,signal:p.signal}));await y(n),await le(n.body,ue(de(e=>{e?f[Y]=e:delete f[Y]},e=>{h=e},a))),o?.(),_(),t()}catch(e){if(!p.signal.aborted)try{let t=s?.(e)??h;window.clearTimeout(g),g=window.setTimeout(b,t)}catch(e){_(),d(e)}}}b()})}function ge(e){let t=e.headers.get(`content-type`);if(!t?.startsWith(`text/event-stream`))throw Error(`Expected content-type to be ${J}, Actual: ${t}`)}var _e=(e,t)=>{let n=(0,L.useRef)(null),r=(0,L.useRef)(t);(0,L.useEffect)(()=>{r.current=t},[t]),(0,L.useEffect)(()=>e?(n.current=new AbortController,(async()=>{try{await he(`/api/v1/projects/${e}/tasks/events`,{method:`GET`,headers:{Accept:`text/event-stream`},credentials:`include`,signal:n.current?.signal,onmessage(e){if(e.data)try{let t=JSON.parse(e.data);t&&t.task&&t.event&&r.current(t.event,t.task)}catch{}},onclose(){},onerror(){}})}catch{}})(),()=>{n.current&&n.current.abort()}):void 0,[e])};function ve({tasks:e,setTasks:t,onStatusChange:r,skipArchiveConfirm:a}){let[o,c]=(0,L.useState)(null),[u,p]=(0,L.useState)(null),[m,g]=(0,L.useState)(!1),[_,v]=(0,L.useState)(null);return{activeId:o,sensors:d(i(s,{activationConstraint:{distance:5}}),i(n,{coordinateGetter:f})),collisionDetection:h,handleDragStart:(0,L.useCallback)(t=>{let n=t.active.id;c(n);let r=e.find(e=>e.id===n);r&&p(r.status)},[e]),handleDragOver:(0,L.useCallback)(n=>{let{active:r,over:i}=n;if(!i)return;let a=r.id,o=i.id;if(a===o)return;let s=e.findIndex(e=>e.id===a),c=e.findIndex(e=>e.id===o);if(s===-1)return;let u=o===`backlog`||o===`in-progress`||o===`review`||o===`done`;if(!u&&c>=0){if(e[s].status!==e[c].status){let n=[...e],r=e[c].status;n[s]={...n[s],status:r,isActive:r===`in-progress`},t(l(n,s,c))}}else if(u&&e[s].status!==o){let n=[...e],r=o;n[s]={...n[s],status:r,isActive:r===`in-progress`},t(l(n,s,e.length-1))}},[e,t]),handleDragEnd:(0,L.useCallback)(async n=>{let{active:i,over:o}=n;if(c(null),!o)return;let s=i.id,d=o.id;if(!e.find(e=>e.id===s))return;if(d===`archive`){a?await r(s,`archived`):(v(s),g(!0)),p(null);return}let f=d===`backlog`||d===`in-progress`||d===`review`||d===`done`?d:e.find(e=>e.id===d)?.status;if(f&&u!==f&&await r(s,f),p(null),s===d)return;let m=e.findIndex(e=>e.id===s),h=e.findIndex(e=>e.id===d);m!==-1&&!(d===`backlog`||d===`in-progress`||d===`review`||d===`done`)&&h>=0&&e[m].status===e[h].status&&t(l(e,m,h))},[e,t,u,a,r]),isConfirmOpen:m,setIsConfirmOpen:g,pendingArchiveId:_,setPendingArchiveId:v}}var ye=`bg-surface-container-highest border-outline-variant/30`,X=e=>e===`done`?100:e===`in-progress`?50:0,Z=e=>{switch(e){case`backlog`:return 0;case`in-progress`:return 1;case`review`:return 2;case`done`:return 3;case`archived`:return 4}};function Q(e,t){let n=e.status;return{id:e.id,status:n,code:`#TASK-${e.id.substring(0,4).toUpperCase()}`,title:e.title,priority:e.priority,agent:{name:e.assignee?.name||`Unassigned`,emoji:e.assignee?.emoji,colorClass:ye},isActive:n===`in-progress`,progress:X(n),projectId:t,updatedAt:e.updatedAt}}function $(e,t){let n=Z(e.status)-Z(t.status);if(n!==0)return n;if(e.status===`backlog`&&t.status===`backlog`){let n=(e.priority||0)-(t.priority||0);return n===0?e.id.localeCompare(t.id):n}let r=new Date(t.updatedAt||0).getTime()-new Date(e.updatedAt||0).getTime();return r===0?e.id.localeCompare(t.id):r}function be(e,t,n,r){if(t===`deleted`||n.status===M.ARCHIVED)return e.filter(e=>e.id!==n.id);let i=Q(n,r);return e.findIndex(e=>e.id===n.id)===-1?[...e,i].sort($):e.map(e=>e.id===n.id?i:e).sort($)}function xe(e,t,n){return n===`archived`?e.filter(e=>e.id!==t):e.map(e=>e.id===t?{...e,status:n,isActive:n===`in-progress`,progress:X(n)}:e).sort($)}var Se=(0,L.lazy)(()=>g(()=>import(`./CreateTaskModal-XNvIWKz3.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]))),Ce=()=>{let{activeProject:e,loading:t}=ne(),{notifyError:n}=k(),r=y(),[i,a]=(0,L.useState)(!1),[o,s]=ie(`skipArchiveConfirm`,!1),[c,l]=(0,L.useState)(!1),d=(0,L.useMemo)(()=>[`tasks`,e?.id],[e?.id]),{data:f=[],isLoading:m}=b({queryKey:d,queryFn:async()=>(await j.fetchAll(e.id)).filter(e=>e.status!==`archived`).map(t=>Q(t,e.id)).sort($),enabled:!!e?.id,staleTime:1/0,refetchOnWindowFocus:!1}),h=(0,L.useCallback)((t,n)=>{!e||n.projectId!==e.id||r.setQueryData(d,(r=[])=>be(r,t,n,e.id))},[e,r,d]);_e(e?.id,h);let g=(0,L.useCallback)(()=>{r.invalidateQueries({queryKey:d})},[r,d]),v=(0,L.useCallback)(async(t,i)=>{if(e)try{await j.update(e.id,t,{status:i}),r.setQueryData(d,(e=[])=>xe(e,t,i))}catch{n(`Status Update Failed`,`Failed to update task status in the neural mesh.`),r.invalidateQueries({queryKey:d})}},[e,n,r,d]),{activeId:x,sensors:S,collisionDetection:C,handleDragStart:w,handleDragOver:T,handleDragEnd:D,isConfirmOpen:A,setIsConfirmOpen:M,pendingArchiveId:P,setPendingArchiveId:F}=ve({tasks:f,setTasks:(0,L.useCallback)(e=>{r.setQueryData(d,(t=[])=>typeof e==`function`?e(t):e)},[r,d]),onStatusChange:v,skipArchiveConfirm:o}),I=(0,L.useCallback)(async()=>{P&&(c&&s(!0),await v(P,`archived`)),M(!1),F(null)},[c,v,P,M,F,s]),z=(0,L.useMemo)(()=>f.find(e=>e.id===x),[f,x]),B=(0,L.useMemo)(()=>f.reduce((e,t)=>(e[t.status]+=1,e),{backlog:0,"in-progress":0,review:0,done:0,archived:0}),[f]);if(t)return(0,R.jsx)(`div`,{className:`w-full h-[60vh] flex items-center justify-center`,children:(0,R.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,R.jsx)(`div`,{className:`w-16 h-16 border-4 border-primary border-t-transparent rounded-full animate-spin`}),(0,R.jsx)(`p`,{className:`text-on-surface-variant text-sm font-black uppercase tracking-[0.3em] animate-pulse`,children:`Initializing Neural Mesh`})]})});if(!e)return(0,R.jsx)(`div`,{className:`w-full h-[60vh] flex items-center justify-center`,children:(0,R.jsxs)(`div`,{className:`text-center space-y-6 max-w-md`,children:[(0,R.jsx)(`div`,{className:`w-20 h-20 bg-surface-container-highest rounded-3xl flex items-center justify-center text-on-surface-variant/20 mx-auto border border-outline-variant/10 shadow-xl`,children:(0,R.jsx)(ee,{size:40})}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`h2`,{className:`text-2xl font-black font-headline text-white tracking-tight`,children:`No Active Projects Found`}),(0,R.jsx)(`p`,{className:`text-on-surface-variant text-sm leading-relaxed`,children:`The orchestration grid is currently offline. Please create a project in the sidebar to begin commissioning agentic tasks.`})]}),(0,R.jsxs)(_,{to:`/`,className:`inline-flex items-center gap-2 px-8 py-3 bg-primary text-on-primary rounded-xl font-black text-xs uppercase tracking-widest hover:scale-105 active:scale-95 transition-all shadow-lg shadow-primary/20`,children:[`Go to Dashboard`,(0,R.jsx)(ae,{size:16})]})]})});let V=!e.ownerAgent,H=e.status!==O.ACTIVE;return(0,R.jsxs)(u,{sensors:S,collisionDetection:C,onDragStart:w,onDragOver:T,onDragEnd:D,children:[(0,R.jsxs)(`div`,{className:`space-y-10 animate-in fade-in duration-700`,children:[V&&(0,R.jsxs)(`div`,{className:`bg-error/10 border border-error/20 p-4 rounded-2xl flex flex-col md:flex-row items-center justify-between gap-4 animate-in fade-in slide-in-from-top-4 duration-500 shadow-lg shadow-error/5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,R.jsx)(`div`,{className:`w-12 h-12 rounded-2xl bg-error/20 flex items-center justify-center text-error border border-error/30`,children:(0,R.jsx)(E,{size:24})}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h4`,{className:`text-sm font-black text-white uppercase tracking-tight`,children:`Administrative Protocol Warning`}),(0,R.jsxs)(`p`,{className:`text-xs text-on-surface-variant max-w-2xl leading-relaxed mt-0.5`,children:[`The `,(0,R.jsxs)(`span`,{className:`text-error font-bold italic`,children:[`"`,e.title,`"`]}),` project currently lacks a Designated Lead Agent. A lead is required to oversee autonomous task assignment, token allocation, and critical project operations.`]})]})]}),(0,R.jsx)(_,{to:`/projects/${e.id}`,className:`w-full md:w-auto px-6 py-2.5 rounded-xl bg-error text-on-error text-xs font-black uppercase tracking-widest hover:scale-[1.02] active:scale-[0.98] transition-all whitespace-nowrap text-center shadow-lg shadow-error/20`,children:`Assign Protocol Lead`})]}),H&&(0,R.jsxs)(`div`,{className:`bg-amber-500/10 border border-amber-500/20 p-4 rounded-2xl flex flex-col md:flex-row items-center justify-between gap-4 animate-in fade-in slide-in-from-top-4 duration-500 shadow-lg shadow-amber-500/5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,R.jsx)(`div`,{className:`w-12 h-12 rounded-2xl bg-amber-500/20 flex items-center justify-center text-amber-400 border border-amber-500/30`,children:(0,R.jsx)(E,{size:24})}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h4`,{className:`text-sm font-black text-white uppercase tracking-tight`,children:`Administrative Protocol Warning`}),(0,R.jsxs)(`p`,{className:`text-xs text-on-surface-variant max-w-2xl leading-relaxed mt-0.5`,children:[`Project `,(0,R.jsxs)(`span`,{className:`text-amber-400 font-bold italic`,children:[`"`,e.title,`"`]}),` is currently in`,` `,(0,R.jsx)(`span`,{className:`text-amber-400 font-bold uppercase`,children:e.status.replace(`_`,` `)}),` mode. The agent scheduler will not execute tasks until the project is set to`,` `,(0,R.jsx)(`span`,{className:`text-amber-400 font-bold uppercase`,children:`Active`}),`.`]})]})]}),(0,R.jsx)(_,{to:`/projects/${e.id}`,className:`w-full md:w-auto px-6 py-2.5 rounded-xl bg-amber-500 text-black text-xs font-black uppercase tracking-widest hover:scale-[1.02] active:scale-[0.98] transition-all whitespace-nowrap text-center shadow-lg shadow-amber-500/20`,children:`Activate Project`})]}),(0,R.jsxs)(`div`,{className:`flex flex-col md:flex-row justify-between items-start md:items-center gap-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3 mb-1`,children:[(0,R.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-[0.3em] text-primary/60`,children:`Fleet Command`}),(0,R.jsx)(`div`,{className:`h-1 w-1 rounded-full bg-outline-variant/30`}),(0,R.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-[0.3em] text-on-surface-variant/40`,children:e.title})]}),(0,R.jsx)(`h1`,{className:`text-4xl font-extrabold font-headline tracking-tight text-white`,children:`Agentic Task Canvas`}),(0,R.jsxs)(`p`,{className:`text-outline text-sm mt-1`,children:[`Orchestrating `,(0,R.jsx)(`span`,{className:`text-primary font-bold`,children:f.length}),` parallel node operations`]})]}),(0,R.jsxs)(`div`,{className:`flex-1 flex items-center justify-end gap-6 max-w-4xl`,children:[(0,R.jsx)(ce,{isDragging:!!x}),(0,R.jsxs)(`button`,{onClick:()=>a(!0),className:`bg-primary hover:bg-primary/90 text-on-primary px-8 py-3.5 rounded-2xl flex items-center gap-2 font-black text-xs uppercase tracking-widest transition-all shadow-lg shadow-primary/20 hover:scale-[1.02] active:scale-[0.98] whitespace-nowrap`,children:[(0,R.jsx)(oe,{size:18}),`Commission Task`]})]})]}),(0,R.jsx)(L.Suspense,{fallback:null,children:(0,R.jsx)(Se,{isOpen:i,onClose:()=>a(!1),onCreated:g})}),(0,R.jsx)(re,{title:`Unable to render task board`,description:`The Kanban board hit an unexpected error. You can still use the rest of Task Manager while retrying this section.`,children:(0,R.jsx)(`section`,{"aria-label":`Task board panel`,"aria-busy":m,className:N(`space-y-4`,m&&f.length===0&&`min-h-96`),children:m&&f.length===0?(0,R.jsx)(`div`,{className:`flex h-96 w-full items-center justify-center`,children:(0,R.jsx)(`div`,{className:`h-12 w-12 animate-spin rounded-full border-4 border-outline-variant/30 border-t-primary`})}):(0,R.jsx)(K,{tasks:f})})}),(0,R.jsx)(se,{tasks:f,taskCounts:B,projectTitle:e.title})]}),(0,R.jsx)(p,{children:z?(0,R.jsx)(U,{task:z,isOverlay:!0}):null}),(0,R.jsx)(te,{isOpen:A,onClose:()=>M(!1),onConfirm:I,title:`Archive Protocol Task`,message:`Are you sure you want to transfer this task to the archive? This operation will remove the task node from the active grid.`,confirmText:`Archive Task`,variant:`warning`,showCheckbox:!0,onCheckboxChange:l})]})};export{Ce as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{c as n,n as r,s as i}from"./vendor-react-BmVaKUwY.js";import{r as a}from"./vendor-markdown-DoJbQ1of.js";import{t as o}from"./chevron-left-CJc_eQid.js";import{t as s}from"./circle-alert-pUx6yhcF.js";import{t as c}from"./circle-check-B9kyRki5.js";import{n as l,t as u}from"./users-C6WiDiuN.js";import{t as d}from"./plus-Dx6G8SOZ.js";import{t as f}from"./save-DycJmlX0.js";import{t as p}from"./shield-check-Cr4SHjdR.js";import{t as m}from"./trash-2-DJpTXgEP.js";import{t as h}from"./user--KOoEB9m.js";import{t as g}from"./x-wDy15QMx.js";import{n as _}from"./AuthContextInstance-DiFo9Qb2.js";import{n as v}from"./projects-CUOthD8N.js";import{t as y}from"./UserAvatar-Z5W8S1dG.js";var b=e(t(),1),x=a();function S({label:e,id:t,type:n=`text`,value:r,onChange:i,placeholder:a,disabled:o=!1,className:s=``,error:c}){return(0,x.jsxs)(`div`,{className:`flex flex-col gap-2 ${s}`,children:[(0,x.jsx)(`label`,{htmlFor:t,className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:e}),(0,x.jsx)(`input`,{id:t,type:n,value:r,onChange:e=>i(e.target.value),placeholder:a,disabled:o,className:`w-full bg-surface-container-lowest rounded-lg px-4 py-3 text-sm text-on-surface border focus:outline-none focus:ring-2 transition-all disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-on-surface-variant/40 ${c?`border-error/60 focus:ring-error/40`:`border-outline-variant/20 focus:ring-primary/40`}`}),c&&(0,x.jsx)(`p`,{className:`text-[11px] text-error mt-0.5`,children:c})]})}var C=()=>{let{id:e}=n(),t=i(),{user:a}=_(),C=a?.role===`admin`,[w,T]=(0,b.useState)(null),[E,D]=(0,b.useState)([]),[O,k]=(0,b.useState)([]),[A,j]=(0,b.useState)(!0),[M,N]=(0,b.useState)(!1),[P,F]=(0,b.useState)(!1),[I,L]=(0,b.useState)(``),[R,z]=(0,b.useState)(``),[B,V]=(0,b.useState)(``),[H,U]=(0,b.useState)(``),[W,G]=(0,b.useState)(`user`),K=(0,b.useCallback)(async()=>{if(e){j(!0);try{let[t,n,r]=await Promise.all([u.findOne(e),v.findAll(void 0,!0),v.findAll(e)]);T(t),D(n.data),k(r.data),z(t.name),V(t.lastName),U(t.email),G(t.role||`user`)}catch(e){L(e instanceof Error?e.message:`Failed to fetch user data`)}finally{j(!1)}}},[e]);(0,b.useEffect)(()=>{K()},[K]);let q=async()=>{if(e){N(!0),L(``),F(!1);try{await u.updateRole(e,W),F(!0),setTimeout(()=>F(!1),3e3),await K()}catch(e){L(e instanceof Error?e.message:`Failed to save user changes`)}finally{N(!1)}}},J=async(t,n)=>{if(e)try{n?await v.removeMember(t,e):await v.addMember(t,e),await K()}catch(e){L(e instanceof Error?e.message:`Failed to update project membership`)}};if(!C)return(0,x.jsxs)(`div`,{className:`flex flex-col items-center justify-center min-h-[60vh] text-center px-4`,children:[(0,x.jsx)(`div`,{className:`w-16 h-16 rounded-full bg-error/10 flex items-center justify-center text-error mb-4`,children:(0,x.jsx)(p,{size:32})}),(0,x.jsx)(`h2`,{className:`text-2xl font-bold text-on-surface mb-2`,children:`Access Restricted`}),(0,x.jsx)(`p`,{className:`text-on-surface-variant max-w-md`,children:`This area is only accessible to system administrators.`}),(0,x.jsx)(`button`,{onClick:()=>t(`/`),className:`mt-6 px-6 py-2 rounded-lg bg-surface-container-high text-on-surface hover:bg-surface-container-highest transition-colors font-bold text-sm`,children:`Return to Dashboard`})]});if(A)return(0,x.jsx)(`div`,{className:`flex items-center justify-center min-h-[60vh]`,children:(0,x.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,x.jsx)(`div`,{className:`w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin`}),(0,x.jsx)(`p`,{className:`text-sm font-medium text-on-surface-variant animate-pulse`,children:`Initializing user matrix...`})]})});if(!w)return(0,x.jsxs)(`div`,{className:`flex flex-col items-center justify-center min-h-[60vh] text-center px-4`,children:[(0,x.jsx)(s,{size:48,className:`text-error mb-4 opacity-20`}),(0,x.jsx)(`h2`,{className:`text-2xl font-bold text-on-surface mb-2`,children:`User Not Found`}),(0,x.jsx)(`button`,{onClick:()=>t(`/users`),className:`mt-6 px-6 py-2 rounded-lg bg-surface-container-high text-on-surface hover:bg-surface-container-highest transition-colors font-bold text-sm`,children:`Back to Directory`})]});let Y=`${R} ${B}`.trim()||`Agent`;return(0,x.jsxs)(`div`,{className:`min-h-full pb-16`,children:[(0,x.jsxs)(`header`,{className:`mb-10 flex flex-col sm:flex-row items-center sm:items-end gap-6`,children:[(0,x.jsx)(`div`,{className:`flex-shrink-0`,children:(0,x.jsx)(y,{name:Y,avatar:w.avatar,className:`h-28 w-28 sm:h-32 sm:w-32 rounded-full border-4 border-surface ring-2 ring-outline-variant/10 shadow-xl`})}),(0,x.jsxs)(`div`,{className:`text-center sm:text-left flex-1`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-center sm:justify-start gap-2 mb-1`,children:[(0,x.jsx)(r,{to:`/users`,className:`text-on-surface-variant hover:text-primary transition-colors`,children:(0,x.jsx)(o,{size:20})}),(0,x.jsx)(`h1`,{className:`font-headline text-3xl sm:text-4xl font-extrabold text-on-surface tracking-tight`,children:Y})]}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mt-1 justify-center sm:justify-start`,children:[(0,x.jsx)(`span`,{className:`bg-secondary/10 text-secondary border border-secondary/20 px-3 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-widest`,children:W.toUpperCase()}),(0,x.jsx)(`span`,{className:`text-on-surface-variant text-sm font-body`,children:w.email})]})]}),(0,x.jsxs)(`div`,{className:`flex gap-3 sm:ml-auto flex-shrink-0`,children:[(0,x.jsxs)(`button`,{onClick:()=>t(`/users`),className:`px-5 py-2 rounded-lg font-bold text-on-surface-variant hover:bg-surface-container-high border border-outline-variant/20 transition-colors text-sm flex items-center gap-1.5`,children:[(0,x.jsx)(g,{size:15}),` Cancel`]}),(0,x.jsxs)(`button`,{onClick:q,disabled:M,className:`px-6 py-2 rounded-lg font-bold bg-primary text-on-primary hover:brightness-110 active:scale-95 transition-all shadow-lg text-sm disabled:opacity-60 flex items-center gap-1.5`,children:[M?(0,x.jsx)(`span`,{className:`w-4 h-4 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,x.jsx)(f,{size:15}),`Save Changes`]})]})]}),P&&(0,x.jsxs)(`div`,{className:`mb-6 px-4 py-3 rounded-lg bg-secondary/10 border border-secondary/30 text-secondary text-sm font-medium flex items-center gap-2`,children:[(0,x.jsx)(c,{size:16}),` User updated successfully.`]}),I&&(0,x.jsxs)(`div`,{className:`mb-6 px-4 py-3 rounded-lg bg-error/10 border border-error/30 text-error text-sm font-medium flex items-center gap-2`,children:[(0,x.jsx)(s,{size:16}),` `,I]}),(0,x.jsx)(`div`,{className:`grid grid-cols-1 lg:grid-cols-12 gap-6`,children:(0,x.jsxs)(`div`,{className:`lg:col-span-12 flex flex-col gap-6`,children:[(0,x.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,x.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3 mb-7 font-headline`,children:[(0,x.jsx)(`div`,{className:`p-2 rounded-lg bg-primary/10 text-primary`,children:(0,x.jsx)(h,{size:18})}),(0,x.jsx)(`h2`,{className:`text-base font-bold text-on-surface`,children:`Identity Matrix`})]}),(0,x.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-5`,children:[(0,x.jsx)(S,{label:`Name`,id:`user-name`,value:R,onChange:z,disabled:!0}),(0,x.jsx)(S,{label:`Last Name`,id:`user-lastname`,value:B,onChange:V,disabled:!0}),(0,x.jsx)(`div`,{className:`sm:col-span-2`,children:(0,x.jsx)(S,{label:`Email`,id:`user-email`,value:H,onChange:U,disabled:!0})})]})]}),(0,x.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3 mb-7 font-headline`,children:[(0,x.jsx)(`div`,{className:`p-2 rounded-lg bg-secondary/10 text-secondary`,children:(0,x.jsx)(p,{size:18})}),(0,x.jsx)(`h2`,{className:`text-base font-bold text-on-surface`,children:`Administrative Clearance`})]}),(0,x.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,x.jsx)(`label`,{className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:`Clearance Level`}),(0,x.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,x.jsxs)(`button`,{onClick:()=>G(`user`),className:`flex items-center justify-between px-4 py-3 rounded-xl border transition-all ${W===`user`?`bg-surface-container-highest border-primary/40 ring-1 ring-primary/20`:`bg-surface-container-lowest border-outline-variant/10 hover:border-outline-variant/30`}`,children:[(0,x.jsxs)(`div`,{className:`text-left`,children:[(0,x.jsx)(`p`,{className:`text-sm font-bold text-on-surface`,children:`Member`}),(0,x.jsx)(`p`,{className:`text-[10px] text-on-surface-variant`,children:`Standard access`})]}),W===`user`&&(0,x.jsx)(c,{size:16,className:`text-primary`})]}),(0,x.jsxs)(`button`,{onClick:()=>G(`admin`),className:`flex items-center justify-between px-4 py-3 rounded-xl border transition-all ${W===`admin`?`bg-surface-container-highest border-primary/40 ring-1 ring-primary/20`:`bg-surface-container-lowest border-outline-variant/10 hover:border-outline-variant/30`}`,children:[(0,x.jsxs)(`div`,{className:`text-left`,children:[(0,x.jsx)(`p`,{className:`text-sm font-bold text-on-surface`,children:`Admin`}),(0,x.jsx)(`p`,{className:`text-[10px] text-on-surface-variant`,children:`Full privileges`})]}),W===`admin`&&(0,x.jsx)(c,{size:16,className:`text-primary`})]})]}),(0,x.jsx)(`p`,{className:`text-[11px] text-on-surface-variant mt-2 italic leading-relaxed`,children:`* Administrators can manage all projects, members, and system settings.`})]})]})]}),(0,x.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between mb-7 font-headline`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,x.jsx)(`div`,{className:`p-2 rounded-lg bg-tertiary/10 text-tertiary`,children:(0,x.jsx)(l,{size:18})}),(0,x.jsx)(`h2`,{className:`text-base font-bold text-on-surface`,children:`Project Vector Assignments`})]}),(0,x.jsxs)(`span`,{className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-widest px-3 py-1 rounded bg-surface-container-high border border-outline-variant/10`,children:[O.length,` / `,E.length,` Assigned`]})]}),E.length===0?(0,x.jsxs)(`div`,{className:`py-20 flex flex-col items-center justify-center text-center opacity-40`,children:[(0,x.jsx)(l,{size:48,strokeWidth:1}),(0,x.jsx)(`p`,{className:`mt-4 text-sm font-medium`,children:`No projects found in the orchestrator.`})]}):(0,x.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4`,children:E.map(e=>{let t=O.some(t=>t.id===e.id);return(0,x.jsxs)(`div`,{className:`group flex flex-col h-full rounded-xl border transition-all duration-300 p-5 ${t?`bg-surface-container-highest border-primary/30 shadow-[0_8px_32px_rgba(173,198,255,0.05)]`:`bg-surface-container-lowest border-outline-variant/10 opacity-70 hover:opacity-100 hover:border-outline-variant/30`}`,children:[(0,x.jsxs)(`div`,{className:`flex justify-between items-start mb-4`,children:[(0,x.jsx)(`div`,{className:`p-2 rounded-lg ${t?`bg-primary/20 text-primary`:`bg-surface-container-highest text-on-surface-variant`}`,children:(0,x.jsx)(l,{size:16})}),(0,x.jsx)(`button`,{onClick:()=>J(e.id,t),className:`w-10 h-10 rounded-full flex items-center justify-center transition-all ${t?`bg-error/10 text-error hover:bg-error hover:text-on-error`:`bg-primary/10 text-primary hover:bg-primary hover:text-on-primary shadow-sm shadow-primary/20`}`,title:t?`Remove from project`:`Assign to project`,children:t?(0,x.jsx)(m,{size:16}):(0,x.jsx)(d,{size:16})})]}),(0,x.jsx)(`h3`,{className:`text-sm font-bold text-on-surface mb-1`,children:e.title}),(0,x.jsx)(`p`,{className:`text-[11px] text-on-surface-variant line-clamp-2 leading-relaxed flex-grow`,children:e.description||`No project scope defined.`}),(0,x.jsxs)(`div`,{className:`mt-4 pt-4 border-t border-outline-variant/10 flex items-center justify-between`,children:[(0,x.jsx)(`span`,{className:`text-[9px] font-bold uppercase tracking-widest px-2 py-0.5 rounded ${e.status===`active`?`bg-secondary/10 text-secondary`:`bg-surface-container-high text-on-surface-variant`}`,children:e.status}),t&&(0,x.jsxs)(`div`,{className:`flex items-center gap-1.5 text-primary text-[10px] font-bold`,children:[(0,x.jsx)(c,{size:12}),` Assigned`]})]})]},e.id)})})]})]})})]})};export{C as default};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{c as n,n as r,s as i}from"./vendor-react-BmVaKUwY.js";import{r as a}from"./vendor-markdown-DoJbQ1of.js";import{t as o}from"./chevron-left-B0NmQyxK.js";import{t as s}from"./circle-alert-sCcf7ANF.js";import{t as c}from"./circle-check-Jz8IOE4h.js";import{n as l,t as u}from"./users-BcnlUG5N.js";import{t as d}from"./plus-CkteVqhM.js";import{t as f}from"./save-Cmqi1IkN.js";import{t as p}from"./shield-check-YKs9kUNq.js";import{t as m}from"./trash-2-CphQfk35.js";import{t as h}from"./user-Brcjlps5.js";import{t as g}from"./x-CCZGYGDC.js";import{n as _}from"./AuthContextInstance-DiFo9Qb2.js";import{n as v}from"./projects-DoalTI7c.js";import{t as y}from"./UserAvatar-Z5W8S1dG.js";var b=e(t(),1),x=a();function S({label:e,id:t,type:n=`text`,value:r,onChange:i,placeholder:a,disabled:o=!1,className:s=``,error:c}){return(0,x.jsxs)(`div`,{className:`flex flex-col gap-2 ${s}`,children:[(0,x.jsx)(`label`,{htmlFor:t,className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:e}),(0,x.jsx)(`input`,{id:t,type:n,value:r,onChange:e=>i(e.target.value),placeholder:a,disabled:o,className:`w-full bg-surface-container-lowest rounded-lg px-4 py-3 text-sm text-on-surface border focus:outline-none focus:ring-2 transition-all disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-on-surface-variant/40 ${c?`border-error/60 focus:ring-error/40`:`border-outline-variant/20 focus:ring-primary/40`}`}),c&&(0,x.jsx)(`p`,{className:`text-[11px] text-error mt-0.5`,children:c})]})}var C=()=>{let{id:e}=n(),t=i(),{user:a}=_(),C=a?.role===`admin`,[w,T]=(0,b.useState)(null),[E,D]=(0,b.useState)([]),[O,k]=(0,b.useState)([]),[A,j]=(0,b.useState)(!0),[M,N]=(0,b.useState)(!1),[P,F]=(0,b.useState)(!1),[I,L]=(0,b.useState)(``),[R,z]=(0,b.useState)(``),[B,V]=(0,b.useState)(``),[H,U]=(0,b.useState)(``),[W,G]=(0,b.useState)(`user`),K=(0,b.useCallback)(async()=>{if(e){j(!0);try{let[t,n,r]=await Promise.all([u.findOne(e),v.findAll(void 0,!0),v.findAll(e)]);T(t),D(n.data),k(r.data),z(t.name),V(t.lastName),U(t.email),G(t.role||`user`)}catch(e){L(e instanceof Error?e.message:`Failed to fetch user data`)}finally{j(!1)}}},[e]);(0,b.useEffect)(()=>{K()},[K]);let q=async()=>{if(e){N(!0),L(``),F(!1);try{await u.updateRole(e,W),F(!0),setTimeout(()=>F(!1),3e3),await K()}catch(e){L(e instanceof Error?e.message:`Failed to save user changes`)}finally{N(!1)}}},J=async(t,n)=>{if(e)try{n?await v.removeMember(t,e):await v.addMember(t,e),await K()}catch(e){L(e instanceof Error?e.message:`Failed to update project membership`)}};if(!C)return(0,x.jsxs)(`div`,{className:`flex flex-col items-center justify-center min-h-[60vh] text-center px-4`,children:[(0,x.jsx)(`div`,{className:`w-16 h-16 rounded-full bg-error/10 flex items-center justify-center text-error mb-4`,children:(0,x.jsx)(p,{size:32})}),(0,x.jsx)(`h2`,{className:`text-2xl font-bold text-on-surface mb-2`,children:`Access Restricted`}),(0,x.jsx)(`p`,{className:`text-on-surface-variant max-w-md`,children:`This area is only accessible to system administrators.`}),(0,x.jsx)(`button`,{onClick:()=>t(`/`),className:`mt-6 px-6 py-2 rounded-lg bg-surface-container-high text-on-surface hover:bg-surface-container-highest transition-colors font-bold text-sm`,children:`Return to Dashboard`})]});if(A)return(0,x.jsx)(`div`,{className:`flex items-center justify-center min-h-[60vh]`,children:(0,x.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,x.jsx)(`div`,{className:`w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin`}),(0,x.jsx)(`p`,{className:`text-sm font-medium text-on-surface-variant animate-pulse`,children:`Initializing user matrix...`})]})});if(!w)return(0,x.jsxs)(`div`,{className:`flex flex-col items-center justify-center min-h-[60vh] text-center px-4`,children:[(0,x.jsx)(s,{size:48,className:`text-error mb-4 opacity-20`}),(0,x.jsx)(`h2`,{className:`text-2xl font-bold text-on-surface mb-2`,children:`User Not Found`}),(0,x.jsx)(`button`,{onClick:()=>t(`/users`),className:`mt-6 px-6 py-2 rounded-lg bg-surface-container-high text-on-surface hover:bg-surface-container-highest transition-colors font-bold text-sm`,children:`Back to Directory`})]});let Y=`${R} ${B}`.trim()||`Agent`;return(0,x.jsxs)(`div`,{className:`min-h-full pb-16`,children:[(0,x.jsxs)(`header`,{className:`mb-10 flex flex-col sm:flex-row items-center sm:items-end gap-6`,children:[(0,x.jsx)(`div`,{className:`flex-shrink-0`,children:(0,x.jsx)(y,{name:Y,avatar:w.avatar,className:`h-28 w-28 sm:h-32 sm:w-32 rounded-full border-4 border-surface ring-2 ring-outline-variant/10 shadow-xl`})}),(0,x.jsxs)(`div`,{className:`text-center sm:text-left flex-1`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-center sm:justify-start gap-2 mb-1`,children:[(0,x.jsx)(r,{to:`/users`,className:`text-on-surface-variant hover:text-primary transition-colors`,children:(0,x.jsx)(o,{size:20})}),(0,x.jsx)(`h1`,{className:`font-headline text-3xl sm:text-4xl font-extrabold text-on-surface tracking-tight`,children:Y})]}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mt-1 justify-center sm:justify-start`,children:[(0,x.jsx)(`span`,{className:`bg-secondary/10 text-secondary border border-secondary/20 px-3 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-widest`,children:W.toUpperCase()}),(0,x.jsx)(`span`,{className:`text-on-surface-variant text-sm font-body`,children:w.email})]})]}),(0,x.jsxs)(`div`,{className:`flex gap-3 sm:ml-auto flex-shrink-0`,children:[(0,x.jsxs)(`button`,{onClick:()=>t(`/users`),className:`px-5 py-2 rounded-lg font-bold text-on-surface-variant hover:bg-surface-container-high border border-outline-variant/20 transition-colors text-sm flex items-center gap-1.5`,children:[(0,x.jsx)(g,{size:15}),` Cancel`]}),(0,x.jsxs)(`button`,{onClick:q,disabled:M,className:`px-6 py-2 rounded-lg font-bold bg-primary text-on-primary hover:brightness-110 active:scale-95 transition-all shadow-lg text-sm disabled:opacity-60 flex items-center gap-1.5`,children:[M?(0,x.jsx)(`span`,{className:`w-4 h-4 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,x.jsx)(f,{size:15}),`Save Changes`]})]})]}),P&&(0,x.jsxs)(`div`,{className:`mb-6 px-4 py-3 rounded-lg bg-secondary/10 border border-secondary/30 text-secondary text-sm font-medium flex items-center gap-2`,children:[(0,x.jsx)(c,{size:16}),` User updated successfully.`]}),I&&(0,x.jsxs)(`div`,{className:`mb-6 px-4 py-3 rounded-lg bg-error/10 border border-error/30 text-error text-sm font-medium flex items-center gap-2`,children:[(0,x.jsx)(s,{size:16}),` `,I]}),(0,x.jsx)(`div`,{className:`grid grid-cols-1 lg:grid-cols-12 gap-6`,children:(0,x.jsxs)(`div`,{className:`lg:col-span-12 flex flex-col gap-6`,children:[(0,x.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,x.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3 mb-7 font-headline`,children:[(0,x.jsx)(`div`,{className:`p-2 rounded-lg bg-primary/10 text-primary`,children:(0,x.jsx)(h,{size:18})}),(0,x.jsx)(`h2`,{className:`text-base font-bold text-on-surface`,children:`Identity Matrix`})]}),(0,x.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-5`,children:[(0,x.jsx)(S,{label:`Name`,id:`user-name`,value:R,onChange:z,disabled:!0}),(0,x.jsx)(S,{label:`Last Name`,id:`user-lastname`,value:B,onChange:V,disabled:!0}),(0,x.jsx)(`div`,{className:`sm:col-span-2`,children:(0,x.jsx)(S,{label:`Email`,id:`user-email`,value:H,onChange:U,disabled:!0})})]})]}),(0,x.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3 mb-7 font-headline`,children:[(0,x.jsx)(`div`,{className:`p-2 rounded-lg bg-secondary/10 text-secondary`,children:(0,x.jsx)(p,{size:18})}),(0,x.jsx)(`h2`,{className:`text-base font-bold text-on-surface`,children:`Administrative Clearance`})]}),(0,x.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,x.jsx)(`label`,{className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:`Clearance Level`}),(0,x.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,x.jsxs)(`button`,{onClick:()=>G(`user`),className:`flex items-center justify-between px-4 py-3 rounded-xl border transition-all ${W===`user`?`bg-surface-container-highest border-primary/40 ring-1 ring-primary/20`:`bg-surface-container-lowest border-outline-variant/10 hover:border-outline-variant/30`}`,children:[(0,x.jsxs)(`div`,{className:`text-left`,children:[(0,x.jsx)(`p`,{className:`text-sm font-bold text-on-surface`,children:`Member`}),(0,x.jsx)(`p`,{className:`text-[10px] text-on-surface-variant`,children:`Standard access`})]}),W===`user`&&(0,x.jsx)(c,{size:16,className:`text-primary`})]}),(0,x.jsxs)(`button`,{onClick:()=>G(`admin`),className:`flex items-center justify-between px-4 py-3 rounded-xl border transition-all ${W===`admin`?`bg-surface-container-highest border-primary/40 ring-1 ring-primary/20`:`bg-surface-container-lowest border-outline-variant/10 hover:border-outline-variant/30`}`,children:[(0,x.jsxs)(`div`,{className:`text-left`,children:[(0,x.jsx)(`p`,{className:`text-sm font-bold text-on-surface`,children:`Admin`}),(0,x.jsx)(`p`,{className:`text-[10px] text-on-surface-variant`,children:`Full privileges`})]}),W===`admin`&&(0,x.jsx)(c,{size:16,className:`text-primary`})]})]}),(0,x.jsx)(`p`,{className:`text-[11px] text-on-surface-variant mt-2 italic leading-relaxed`,children:`* Administrators can manage all projects, members, and system settings.`})]})]})]}),(0,x.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between mb-7 font-headline`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,x.jsx)(`div`,{className:`p-2 rounded-lg bg-tertiary/10 text-tertiary`,children:(0,x.jsx)(l,{size:18})}),(0,x.jsx)(`h2`,{className:`text-base font-bold text-on-surface`,children:`Project Vector Assignments`})]}),(0,x.jsxs)(`span`,{className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-widest px-3 py-1 rounded bg-surface-container-high border border-outline-variant/10`,children:[O.length,` / `,E.length,` Assigned`]})]}),E.length===0?(0,x.jsxs)(`div`,{className:`py-20 flex flex-col items-center justify-center text-center opacity-40`,children:[(0,x.jsx)(l,{size:48,strokeWidth:1}),(0,x.jsx)(`p`,{className:`mt-4 text-sm font-medium`,children:`No projects found in the orchestrator.`})]}):(0,x.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4`,children:E.map(e=>{let t=O.some(t=>t.id===e.id);return(0,x.jsxs)(`div`,{className:`group flex flex-col h-full rounded-xl border transition-all duration-300 p-5 ${t?`bg-surface-container-highest border-primary/30 shadow-[0_8px_32px_rgba(173,198,255,0.05)]`:`bg-surface-container-lowest border-outline-variant/10 opacity-70 hover:opacity-100 hover:border-outline-variant/30`}`,children:[(0,x.jsxs)(`div`,{className:`flex justify-between items-start mb-4`,children:[(0,x.jsx)(`div`,{className:`p-2 rounded-lg ${t?`bg-primary/20 text-primary`:`bg-surface-container-highest text-on-surface-variant`}`,children:(0,x.jsx)(l,{size:16})}),(0,x.jsx)(`button`,{onClick:()=>J(e.id,t),className:`w-10 h-10 rounded-full flex items-center justify-center transition-all ${t?`bg-error/10 text-error hover:bg-error hover:text-on-error`:`bg-primary/10 text-primary hover:bg-primary hover:text-on-primary shadow-sm shadow-primary/20`}`,title:t?`Remove from project`:`Assign to project`,children:t?(0,x.jsx)(m,{size:16}):(0,x.jsx)(d,{size:16})})]}),(0,x.jsx)(`h3`,{className:`text-sm font-bold text-on-surface mb-1`,children:e.title}),(0,x.jsx)(`p`,{className:`text-[11px] text-on-surface-variant line-clamp-2 leading-relaxed flex-grow`,children:e.description||`No project scope defined.`}),(0,x.jsxs)(`div`,{className:`mt-4 pt-4 border-t border-outline-variant/10 flex items-center justify-between`,children:[(0,x.jsx)(`span`,{className:`text-[9px] font-bold uppercase tracking-widest px-2 py-0.5 rounded ${e.status===`active`?`bg-secondary/10 text-secondary`:`bg-surface-container-high text-on-surface-variant`}`,children:e.status}),t&&(0,x.jsxs)(`div`,{className:`flex items-center gap-1.5 text-primary text-[10px] font-bold`,children:[(0,x.jsx)(c,{size:12}),` Assigned`]})]})]},e.id)})})]})]})})]})};export{C as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{i as n,s as r}from"./vendor-react-BmVaKUwY.js";import{r as i}from"./vendor-markdown-DoJbQ1of.js";import{i as a}from"./client-BGOBXkO8.js";import{t as o}from"./chevron-down-LTeQHW9O.js";import{t as s}from"./chevron-left-CJc_eQid.js";import{t as c}from"./chevron-right-G5-HRo_C.js";import{t as l}from"./circle-alert-pUx6yhcF.js";import{t as u}from"./circle-check-B9kyRki5.js";import{n as d,t as f}from"./user-plus-nDkwsBT1.js";import{t as p}from"./eye-Cc-vy4Zu.js";import{n as m,t as h}from"./users-C6WiDiuN.js";import{t as g}from"./loader-circle-Cl6yIkPK.js";import{t as _}from"./refresh-cw-DQW6jR7M.js";import{t as v}from"./shield-alert-CP5GVXxa.js";import{t as y}from"./shield-check-Cr4SHjdR.js";import{t as b}from"./trash-2-DJpTXgEP.js";import{t as x}from"./ConfirmDialog-y3vTcqFR.js";import{t as S}from"./user--KOoEB9m.js";import{t as C}from"./users-Ef6Sh2iR.js";import{t as w}from"./x-wDy15QMx.js";import{n as T}from"./AuthContextInstance-DiFo9Qb2.js";import{n as E}from"./projects-CUOthD8N.js";import{t as D}from"./UserAvatar-Z5W8S1dG.js";var O=a(`crown`,[[`path`,{d:`M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z`,key:`1vdc57`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),k=a(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),A=e(t(),1),j=i();function M({label:e,id:t,type:n=`text`,value:r,onChange:i,placeholder:a,error:o,autoComplete:s,suffix:c}){return(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsx)(`label`,{htmlFor:t,className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:e}),(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(`input`,{id:t,type:n,value:r,onChange:e=>i(e.target.value),placeholder:a,autoComplete:s,className:`w-full bg-surface-container-lowest rounded-lg px-4 py-3 text-sm text-on-surface border focus:outline-none focus:ring-2 transition-all placeholder:text-on-surface-variant/40 ${o?`border-error/60 focus:ring-error/40`:`border-outline-variant/20 focus:ring-primary/40`}`}),c&&(0,j.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2`,children:c})]}),o&&(0,j.jsx)(`p`,{className:`text-[11px] text-error`,children:o})]})}function N({label:e,id:t,value:n,onChange:r,placeholder:i,error:a}){let[o,s]=(0,A.useState)(!1);return(0,j.jsx)(M,{label:e,id:t,type:o?`text`:`password`,value:n,onChange:r,autoComplete:`new-password`,placeholder:i??`••••••••`,error:a,suffix:(0,j.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`text-on-surface-variant hover:text-primary transition-colors`,"aria-label":o?`Hide password`:`Show password`,children:o?(0,j.jsx)(d,{size:16}):(0,j.jsx)(p,{size:16})})})}var P=({isOpen:e,onClose:t,onCreated:n})=>{let[r,i]=(0,A.useState)(``),[a,o]=(0,A.useState)(``),[s,c]=(0,A.useState)(``),[l,d]=(0,A.useState)(``),[p,_]=(0,A.useState)(``),[v,b]=(0,A.useState)(`user`),[x,C]=(0,A.useState)([]),[T,D]=(0,A.useState)(new Set),[k,P]=(0,A.useState)(!1),[F,I]=(0,A.useState)(!1),[L,R]=(0,A.useState)(``),[z,B]=(0,A.useState)({}),V=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;(0,A.useEffect)(()=>{e&&(P(!0),E.findAll().then(e=>C(e.data)).catch(()=>C([])).finally(()=>P(!1)))},[e]),(0,A.useEffect)(()=>{e&&(i(``),o(``),c(``),d(``),_(``),b(`user`),D(new Set),R(``),B({}))},[e]);let H=()=>{let e={};return r.trim()?r.length>100&&(e.firstName=`Maximum 100 characters.`):e.firstName=`First name is required.`,a.trim()?a.length>100&&(e.lastName=`Maximum 100 characters.`):e.lastName=`Last name is required.`,s.trim()?V.test(s)?s.length>255&&(e.email=`Maximum 255 characters.`):e.email=`Must be a valid email.`:e.email=`Email is required.`,l?l.length<8?e.password=`Minimum 8 characters.`:l.length>72&&(e.password=`Maximum 72 characters.`):e.password=`Password is required.`,p?l!==p&&(e.confirmPassword=`Passwords do not match.`):e.confirmPassword=`Please confirm the password.`,e},U=e=>{D(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,A.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&!F&&t()};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,F,t]),e?(0,j.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4 bg-surface/80 backdrop-blur-md`,onClick:e=>{e.target===e.currentTarget&&!F&&t()},role:`dialog`,"aria-modal":`true`,"aria-label":`Create new user`,children:(0,j.jsxs)(`div`,{className:`glass-panel ghost-border rounded-2xl w-full max-w-3xl max-h-[90vh] overflow-y-auto shadow-2xl custom-scrollbar`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between px-7 py-5 border-b border-outline-variant/15 sticky top-0 bg-surface-container/95 backdrop-blur-md z-10`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(`div`,{className:`p-2 rounded-lg bg-primary/10 text-primary`,children:(0,j.jsx)(f,{size:18})}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{className:`font-headline font-bold text-on-surface text-lg`,children:`Provision New User`}),(0,j.jsx)(`p`,{className:`text-xs text-on-surface-variant mt-0.5`,children:`Create a new identity node within the network`})]})]}),(0,j.jsx)(`button`,{id:`create-user-modal-close`,type:`button`,onClick:()=>!F&&t(),disabled:F,className:`p-2 rounded-lg text-on-surface-variant hover:text-on-surface hover:bg-surface-container-high transition-colors disabled:opacity-50`,"aria-label":`Close modal`,children:(0,j.jsx)(w,{size:18})})]}),(0,j.jsxs)(`form`,{id:`create-user-form`,onSubmit:async e=>{e.preventDefault();let i=H();if(Object.keys(i).length>0){B(i);return}B({}),R(``),I(!0);try{let e=await h.createUser({name:r.trim(),lastName:a.trim(),email:s.trim(),password:l});v===`admin`&&e.id&&await h.updateRole(e.id,`admin`);let i=Array.from(T).map(t=>E.addMember(t,e.id));i.length>0&&await Promise.allSettled(i),n(),t()}catch(e){R(e instanceof Error?e.message:`Failed to create user. Please try again.`)}finally{I(!1)}},noValidate:!0,children:[(0,j.jsxs)(`div`,{className:`px-7 py-6 grid grid-cols-1 md:grid-cols-12 gap-6`,children:[(0,j.jsxs)(`div`,{className:`md:col-span-7 space-y-6`,children:[(0,j.jsxs)(`section`,{className:`bg-surface-container-high/40 rounded-xl p-5 border border-outline-variant/10`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2.5 mb-5`,children:[(0,j.jsx)(`div`,{className:`p-1.5 rounded bg-primary/10 text-primary`,children:(0,j.jsx)(S,{size:14})}),(0,j.jsx)(`h3`,{className:`font-headline font-bold text-sm text-on-surface`,children:`Personal Information`})]}),(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,j.jsx)(M,{label:`First Name`,id:`create-user-first-name`,value:r,onChange:i,placeholder:`Julian`,error:z.firstName}),(0,j.jsx)(M,{label:`Last Name`,id:`create-user-last-name`,value:a,onChange:o,placeholder:`Vane`,error:z.lastName})]}),(0,j.jsx)(M,{label:`Email Address`,id:`create-user-email`,type:`email`,value:s,onChange:c,placeholder:`j.vane@example.com`,autoComplete:`off`,error:z.email}),(0,j.jsx)(N,{label:`Initial Password`,id:`create-user-password`,value:l,onChange:d,placeholder:`Min. 8 characters`,error:z.password}),(0,j.jsx)(N,{label:`Confirm Password`,id:`create-user-confirm-password`,value:p,onChange:_,placeholder:`Repeat password`,error:z.confirmPassword})]})]}),(0,j.jsxs)(`section`,{className:`bg-surface-container-high/40 rounded-xl p-5 border border-outline-variant/10`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2.5 mb-5`,children:[(0,j.jsx)(`div`,{className:`p-1.5 rounded bg-secondary/10 text-secondary`,children:(0,j.jsx)(y,{size:14})}),(0,j.jsx)(`h3`,{className:`font-headline font-bold text-sm text-on-surface`,children:`Role Assignment`})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,j.jsxs)(`label`,{htmlFor:`create-user-role-user`,className:`relative flex flex-col p-4 rounded-xl cursor-pointer transition-all border ${v===`user`?`bg-secondary/10 border-secondary/30 shadow-[0_0_16px_rgba(78,222,163,0.1)]`:`bg-surface-container-lowest border-outline-variant/20 hover:border-outline-variant/40`}`,children:[(0,j.jsx)(`input`,{id:`create-user-role-user`,type:`radio`,name:`create-user-role`,value:`user`,checked:v===`user`,onChange:()=>b(`user`),className:`sr-only`}),(0,j.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(S,{size:14,className:v===`user`?`text-secondary`:`text-on-surface-variant`}),(0,j.jsx)(`span`,{className:`font-bold text-sm ${v===`user`?`text-secondary`:`text-on-surface`}`,children:`Member`})]}),(0,j.jsx)(`div`,{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center transition-all ${v===`user`?`border-secondary`:`border-outline-variant`}`,children:v===`user`&&(0,j.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-secondary`})})]}),(0,j.jsx)(`p`,{className:`text-[11px] text-on-surface-variant leading-relaxed`,children:`Scoped access limited to assigned project environments.`})]}),(0,j.jsxs)(`label`,{htmlFor:`create-user-role-admin`,className:`relative flex flex-col p-4 rounded-xl cursor-pointer transition-all border ${v===`admin`?`bg-primary/10 border-primary/30 shadow-[0_0_16px_rgba(173,198,255,0.1)]`:`bg-surface-container-lowest border-outline-variant/20 hover:border-outline-variant/40`}`,children:[(0,j.jsx)(`input`,{id:`create-user-role-admin`,type:`radio`,name:`create-user-role`,value:`admin`,checked:v===`admin`,onChange:()=>b(`admin`),className:`sr-only`}),(0,j.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(O,{size:14,className:v===`admin`?`text-primary`:`text-on-surface-variant`}),(0,j.jsx)(`span`,{className:`font-bold text-sm ${v===`admin`?`text-primary`:`text-on-surface`}`,children:`Admin`})]}),(0,j.jsx)(`div`,{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center transition-all ${v===`admin`?`border-primary`:`border-outline-variant`}`,children:v===`admin`&&(0,j.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-primary`})})]}),(0,j.jsx)(`p`,{className:`text-[11px] text-on-surface-variant leading-relaxed`,children:`Full administrative access across all projects and governance.`})]})]})]})]}),(0,j.jsx)(`div`,{className:`md:col-span-5 space-y-6`,children:(0,j.jsxs)(`section`,{className:`bg-surface-container-high/40 rounded-xl p-5 border border-outline-variant/10`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2.5 mb-5`,children:[(0,j.jsx)(`div`,{className:`p-1.5 rounded bg-tertiary/10 text-tertiary`,children:(0,j.jsx)(m,{size:14})}),(0,j.jsx)(`h3`,{className:`font-headline font-bold text-sm text-on-surface`,children:`Project Access`})]}),k?(0,j.jsx)(`div`,{className:`space-y-2`,children:[1,2,3].map(e=>(0,j.jsx)(`div`,{className:`h-12 rounded-lg bg-surface-container-highest/30 animate-pulse`},e))}):x.length===0?(0,j.jsxs)(`div`,{className:`text-center py-8`,children:[(0,j.jsx)(m,{size:32,className:`text-on-surface-variant/30 mx-auto mb-2`}),(0,j.jsx)(`p`,{className:`text-xs text-on-surface-variant/60`,children:`No projects available`})]}):(0,j.jsx)(`div`,{className:`space-y-2 max-h-64 overflow-y-auto custom-scrollbar pr-1`,children:x.map(e=>{let t=T.has(e.id);return(0,j.jsxs)(`button`,{type:`button`,onClick:()=>U(e.id),className:`w-full flex items-center justify-between p-3 rounded-lg text-left transition-all border ${t?`bg-tertiary/10 border-tertiary/30`:`bg-surface-container-lowest border-outline-variant/15 hover:border-outline-variant/40`}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,j.jsx)(`div`,{className:`w-7 h-7 rounded-lg bg-tertiary/10 flex items-center justify-center flex-shrink-0`,children:(0,j.jsx)(m,{size:13,className:`text-tertiary`})}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`text-xs font-semibold text-on-surface truncate`,children:e.title}),(0,j.jsx)(`p`,{className:`text-[10px] text-on-surface-variant capitalize`,children:e.status.replace(`_`,` `)})]})]}),(0,j.jsx)(`div`,{className:`w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 ml-2 transition-all ${t?`bg-tertiary border-tertiary`:`border-outline-variant`}`,children:t&&(0,j.jsx)(u,{size:10,className:`text-on-tertiary`})})]},e.id)})}),T.size>0&&(0,j.jsxs)(`p`,{className:`text-[10px] text-tertiary font-medium mt-3 flex items-center gap-1`,children:[(0,j.jsx)(u,{size:11}),T.size,` project`,T.size>1?`s`:``,` selected`]})]})})]}),L&&(0,j.jsx)(`div`,{className:`mx-7 mb-4 px-4 py-3 rounded-lg bg-error/10 border border-error/30 text-error text-sm`,children:L}),(0,j.jsxs)(`div`,{className:`flex items-center justify-end gap-3 px-7 py-5 border-t border-outline-variant/15 sticky bottom-0 bg-surface-container/95 backdrop-blur-md`,children:[(0,j.jsx)(`button`,{id:`create-user-modal-cancel`,type:`button`,onClick:()=>!F&&t(),disabled:F,className:`px-5 py-2.5 rounded-lg text-sm font-bold text-on-surface-variant hover:bg-surface-container-high border border-outline-variant/20 transition-colors disabled:opacity-50`,children:`Cancel`}),(0,j.jsxs)(`button`,{id:`create-user-modal-submit`,type:`submit`,disabled:F,className:`px-6 py-2.5 rounded-lg text-sm font-bold bg-primary text-on-primary hover:brightness-110 active:scale-95 transition-all shadow-[0_8px_24px_rgba(173,198,255,0.2)] disabled:opacity-60 flex items-center gap-2`,children:[F?(0,j.jsx)(g,{size:15,className:`animate-spin`}):(0,j.jsx)(f,{size:15}),F?`Provisioning…`:`Provision User`]})]})]})]})}):null},F=15,I=300;function L({role:e}){let t=e===`admin`;return(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-widest ${t?`bg-primary/10 text-primary border border-primary/20`:`bg-surface-container-highest text-on-surface-variant border border-outline-variant/20`}`,children:[t?(0,j.jsx)(O,{size:9}):(0,j.jsx)(S,{size:9}),t?`Admin`:`Member`]})}function R(){return(0,j.jsxs)(`div`,{className:`flex items-center gap-4 px-6 py-4 border-b border-outline-variant/10 animate-pulse`,children:[(0,j.jsx)(`div`,{className:`w-10 h-10 rounded-full bg-surface-container-highest/50`}),(0,j.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,j.jsx)(`div`,{className:`h-3 bg-surface-container-highest/50 rounded w-36`}),(0,j.jsx)(`div`,{className:`h-2.5 bg-surface-container-highest/40 rounded w-52`})]}),(0,j.jsx)(`div`,{className:`h-5 bg-surface-container-highest/40 rounded-full w-16`}),(0,j.jsx)(`div`,{className:`h-3 bg-surface-container-highest/30 rounded w-20`}),(0,j.jsxs)(`div`,{className:`flex gap-2`,children:[(0,j.jsx)(`div`,{className:`h-8 w-24 bg-surface-container-highest/30 rounded-lg`}),(0,j.jsx)(`div`,{className:`h-8 w-8 bg-surface-container-highest/30 rounded-lg`})]})]})}function z(e){return e?new Date(e).toLocaleDateString(`en-US`,{year:`numeric`,month:`short`,day:`numeric`}):`—`}var B=()=>{let{user:e}=T(),t=r(),i=e?.role===`admin`,[a,d]=(0,A.useState)([]),[p,m]=(0,A.useState)(0),[g,y]=(0,A.useState)(!0),[w,E]=(0,A.useState)(``),[M,N]=(0,A.useState)(``),[B,V]=(0,A.useState)(``),[H,U]=(0,A.useState)(1),[ee,W]=(0,A.useState)(null),[te,G]=(0,A.useState)(null),[ne,K]=(0,A.useState)(null),[q,J]=(0,A.useState)(null),[re,ie]=(0,A.useState)(!1),[ae,Y]=(0,A.useState)(!1),[oe,se]=(0,A.useState)(``),[ce,le]=(0,A.useState)(`success`),X=(e,t=`success`)=>{se(e),le(t),setTimeout(()=>se(``),4e3)},Z=(0,A.useCallback)(async(e,t)=>{y(!0),E(``);try{let n=await h.findAll({page:e,limit:F,search:t||void 0});d(n.items),m(n.total)}catch(e){E(e instanceof Error?e.message:`Failed to load users.`)}finally{y(!1)}},[]);if((0,A.useEffect)(()=>{let e=window.setTimeout(()=>{V(M.trim())},I);return()=>window.clearTimeout(e)},[M]),(0,A.useEffect)(()=>{i&&Z(H,B)},[H,B,Z,i]),!i)return(0,j.jsx)(n,{to:`/`,replace:!0});let ue=a.filter(e=>e.role===`admin`).length,de=a.filter(e=>e.role!==`admin`).length,Q=Math.max(1,Math.ceil(p/F)),$=Math.min(H,Q),fe=p===0?0:($-1)*F+1,pe=p===0?0:Math.min($*F,p),me=e=>{N(e),U(1)},he=async(e,t)=>{G(e);try{await h.updateRole(e,t),d(n=>n.map(n=>n.id===e?{...n,role:t}:n)),K(e),W(null),setTimeout(()=>K(null),2500),X(`Role updated successfully.`)}catch{X(`Failed to update role.`,`error`)}finally{G(null)}},ge=async()=>{if(q){ie(!0);try{await h.deleteUser(q.id),J(null);let e=a.length===1&&H>1?H-1:H;U(e),e===H&&await Z(e,B),X(`${q.name} ${q.lastName} removed successfully.`)}catch{X(`Failed to delete user.`,`error`)}finally{ie(!1)}}};return(0,j.jsxs)(`div`,{className:`min-h-full pb-16 relative`,children:[(0,j.jsx)(`div`,{className:`pointer-events-none fixed top-0 right-0 w-[600px] h-[600px] bg-primary/3 blur-[160px] rounded-full -z-0`}),(0,j.jsx)(`div`,{className:`pointer-events-none fixed bottom-0 left-64 w-[400px] h-[400px] bg-tertiary/3 blur-[120px] rounded-full -z-0`}),(0,j.jsxs)(`header`,{className:`mb-8 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 relative z-10`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3 mb-1`,children:[(0,j.jsx)(`div`,{className:`p-2 rounded-xl bg-primary/10 text-primary`,children:(0,j.jsx)(C,{size:20})}),(0,j.jsx)(`h1`,{className:`font-headline text-3xl font-extrabold text-on-surface tracking-tight`,children:`User Directory`})]}),(0,j.jsx)(`p`,{className:`text-sm text-on-surface-variant ml-14`,children:`Manage identity nodes and access clearances across the network.`})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-3 flex-shrink-0`,children:[(0,j.jsx)(`button`,{id:`users-refresh-btn`,type:`button`,onClick:()=>void Z(H,B),disabled:g,className:`p-2.5 rounded-lg text-on-surface-variant hover:bg-surface-container-high border border-outline-variant/20 transition-all disabled:opacity-50`,title:`Refresh`,children:(0,j.jsx)(_,{size:16,className:g?`animate-spin`:``})}),(0,j.jsxs)(`button`,{id:`users-create-btn`,type:`button`,onClick:()=>Y(!0),className:`flex items-center gap-2 px-5 py-2.5 rounded-lg text-sm font-bold bg-primary text-on-primary hover:brightness-110 active:scale-95 transition-all shadow-[0_8px_24px_rgba(173,198,255,0.2)]`,children:[(0,j.jsx)(f,{size:16}),`Provision User`]})]})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 mb-6 relative z-10`,children:[(0,j.jsxs)(`div`,{className:`glass-panel ghost-border rounded-xl p-4 flex items-center gap-3`,children:[(0,j.jsx)(`div`,{className:`p-2 rounded-lg bg-primary/10 text-primary`,children:(0,j.jsx)(C,{size:16})}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-widest`,children:`Total Users`}),(0,j.jsx)(`p`,{className:`font-headline font-extrabold text-xl text-on-surface`,children:g?`…`:p})]})]}),(0,j.jsxs)(`div`,{className:`glass-panel ghost-border rounded-xl p-4 flex items-center gap-3`,children:[(0,j.jsx)(`div`,{className:`p-2 rounded-lg bg-secondary/10 text-secondary`,children:(0,j.jsx)(O,{size:16})}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-widest`,children:`Admins on Page`}),(0,j.jsx)(`p`,{className:`font-headline font-extrabold text-xl text-on-surface`,children:g?`…`:ue})]})]}),(0,j.jsxs)(`div`,{className:`glass-panel ghost-border rounded-xl p-4 flex items-center gap-3`,children:[(0,j.jsx)(`div`,{className:`p-2 rounded-lg bg-tertiary/10 text-tertiary`,children:(0,j.jsx)(S,{size:16})}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-widest`,children:`Members on Page`}),(0,j.jsx)(`p`,{className:`font-headline font-extrabold text-xl text-on-surface`,children:g?`…`:de})]})]})]}),(0,j.jsxs)(`div`,{className:`relative mb-4 z-10`,children:[(0,j.jsx)(k,{size:16,className:`absolute left-4 top-1/2 -translate-y-1/2 text-on-surface-variant/50`}),(0,j.jsx)(`input`,{id:`users-search`,type:`text`,value:M,onChange:e=>me(e.target.value),placeholder:`Search by name or email…`,className:`w-full bg-surface-container-low rounded-xl pl-10 pr-4 py-3 text-sm text-on-surface border border-outline-variant/15 focus:outline-none focus:ring-2 focus:ring-primary/40 placeholder:text-on-surface-variant/40 transition-all`})]}),(0,j.jsxs)(`div`,{className:`glass-panel ghost-border rounded-2xl overflow-hidden relative z-10`,children:[g&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(R,{}),(0,j.jsx)(R,{}),(0,j.jsx)(R,{}),(0,j.jsx)(R,{})]}),!g&&w&&(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 gap-3 text-center`,children:[(0,j.jsx)(`div`,{className:`p-3 rounded-full bg-error/10 text-error`,children:(0,j.jsx)(l,{size:24})}),(0,j.jsx)(`p`,{className:`text-sm font-semibold text-on-surface`,children:w}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>void Z(H,B),className:`text-xs text-primary hover:underline`,children:`Try again`})]}),!g&&!w&&a.length===0&&(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 gap-3 text-center`,children:[(0,j.jsx)(`div`,{className:`p-3 rounded-full bg-surface-container-high text-on-surface-variant`,children:(0,j.jsx)(C,{size:24})}),(0,j.jsx)(`p`,{className:`text-sm font-semibold text-on-surface`,children:B?`No users match your search.`:`No users found.`}),!B&&(0,j.jsxs)(`button`,{type:`button`,onClick:()=>Y(!0),className:`text-xs text-primary hover:underline flex items-center gap-1`,children:[(0,j.jsx)(f,{size:12}),` Provision the first user`]})]}),!g&&!w&&a.length>0&&(0,j.jsxs)(`table`,{className:`w-full table-fixed border-collapse`,children:[(0,j.jsxs)(`colgroup`,{children:[(0,j.jsx)(`col`,{style:{width:`28%`}}),(0,j.jsx)(`col`,{style:{width:`28%`}}),(0,j.jsx)(`col`,{style:{width:`14%`}}),(0,j.jsx)(`col`,{style:{width:`14%`}}),(0,j.jsx)(`col`,{style:{width:`16%`}})]}),(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{className:`border-b border-outline-variant/10 bg-surface-container-high/40`,children:[(0,j.jsx)(`th`,{scope:`col`,className:`px-6 py-3 text-left text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:`Name`}),(0,j.jsx)(`th`,{scope:`col`,className:`px-6 py-3 text-left text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:`Email`}),(0,j.jsx)(`th`,{scope:`col`,className:`px-6 py-3 text-left text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:`Role`}),(0,j.jsx)(`th`,{scope:`col`,className:`px-6 py-3 text-left text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:`Joined`}),(0,j.jsx)(`th`,{scope:`col`,className:`px-6 py-3 text-left text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:`Actions`})]})}),(0,j.jsx)(`tbody`,{children:a.map(n=>{let r=n.id===e?.id,i=ee===n.id,a=te===n.id,s=ne===n.id,c=`${n.name} ${n.lastName}`.trim();return(0,j.jsxs)(`tr`,{onClick:()=>t(`/users/${n.id}`),className:`group border-b border-outline-variant/10 hover:bg-surface-container-high/30 transition-colors last:border-b-0 cursor-pointer`,children:[(0,j.jsx)(`td`,{className:`px-6 py-4`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(D,{name:c,avatar:n.avatar,avatarUrl:n.avatarUrl,alt:c,className:`w-9 h-9 rounded-full overflow-hidden ring-2 ring-outline-variant/20 flex-shrink-0`}),(0,j.jsxs)(`p`,{className:`text-sm font-semibold text-on-surface truncate`,children:[c,r&&(0,j.jsx)(`span`,{className:`ml-2 text-[9px] font-bold bg-primary/10 text-primary border border-primary/20 px-1.5 py-0.5 rounded-full uppercase tracking-widest`,children:`You`})]})]})}),(0,j.jsx)(`td`,{className:`px-6 py-4`,children:(0,j.jsx)(`p`,{className:`text-xs text-on-surface-variant truncate`,children:n.email})}),(0,j.jsx)(`td`,{className:`px-6 py-4`,children:s?(0,j.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-secondary font-medium`,children:[(0,j.jsx)(u,{size:13}),` Updated`]}):i?(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsxs)(`select`,{id:`users-role-select-${n.id}`,defaultValue:n.role??`user`,disabled:r||a,onClick:e=>e.stopPropagation(),onChange:e=>{he(n.id,e.target.value)},className:`w-full bg-surface-container-lowest text-on-surface text-xs rounded-lg border border-outline-variant/20 focus:outline-none focus:ring-2 focus:ring-primary/40 pl-3 pr-7 py-1.5 appearance-none cursor-pointer disabled:opacity-50`,children:[(0,j.jsx)(`option`,{value:`user`,children:`Member`}),(0,j.jsx)(`option`,{value:`admin`,children:`Admin`})]}),(0,j.jsx)(o,{size:12,className:`absolute right-2 top-1/2 -translate-y-1/2 text-on-surface-variant pointer-events-none`})]}):(0,j.jsx)(L,{role:n.role})}),(0,j.jsx)(`td`,{className:`px-6 py-4`,children:(0,j.jsx)(`p`,{className:`text-[11px] text-on-surface-variant`,children:z(n.createdAt)})}),(0,j.jsx)(`td`,{className:`px-6 py-4`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity`,children:[!r&&(0,j.jsx)(`button`,{id:`users-edit-role-${n.id}`,type:`button`,onClick:e=>{e.stopPropagation(),W(i?null:n.id)},disabled:a,title:i?`Cancel role edit`:`Change role`,className:`px-3 py-1.5 rounded-lg text-[11px] font-bold border transition-all disabled:opacity-50 ${i?`bg-surface-container-high text-on-surface border-outline-variant/30`:`bg-primary/10 text-primary border-primary/20 hover:bg-primary/20`}`,children:i?`Cancel`:`Edit Role`}),!r&&(0,j.jsx)(`button`,{id:`users-delete-${n.id}`,type:`button`,onClick:e=>{e.stopPropagation(),J(n)},title:`Remove user`,className:`p-1.5 rounded-lg text-on-surface-variant hover:text-error hover:bg-error/10 border border-transparent hover:border-error/20 transition-all`,children:(0,j.jsx)(b,{size:14})}),r&&(0,j.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] text-on-surface-variant/50 font-medium`,children:[(0,j.jsx)(v,{size:11}),`Current session`]})]})})]},n.id)})})]}),!g&&!w&&p>F&&(0,j.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-t border-outline-variant/10 bg-surface-container-high/20`,children:[(0,j.jsxs)(`p`,{className:`text-xs text-on-surface-variant`,children:[`Showing`,` `,(0,j.jsxs)(`span`,{className:`font-semibold text-on-surface`,children:[fe,`–`,pe]}),` `,`of`,` `,(0,j.jsx)(`span`,{className:`font-semibold text-on-surface`,children:p}),` `,B?`matching users`:`users`]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`button`,{id:`users-page-prev`,type:`button`,onClick:()=>U(e=>Math.max(1,e-1)),disabled:$===1,className:`p-1.5 rounded-lg text-on-surface-variant hover:text-on-surface hover:bg-surface-container-high border border-outline-variant/20 transition-all disabled:opacity-30 disabled:cursor-not-allowed`,"aria-label":`Previous page`,children:(0,j.jsx)(s,{size:15})}),Array.from({length:Q},(e,t)=>t+1).filter(e=>e===1||e===Q||Math.abs(e-$)<=1).reduce((e,t,n,r)=>(n>0&&t-r[n-1]>1&&e.push(`ellipsis`),e.push(t),e),[]).map((e,t)=>e===`ellipsis`?(0,j.jsx)(`span`,{className:`px-2 text-on-surface-variant/50 text-xs`,children:`…`},`ellipsis-${t}`):(0,j.jsx)(`button`,{id:`users-page-${e}`,type:`button`,onClick:()=>U(e),className:`w-8 h-8 rounded-lg text-xs font-bold transition-all ${$===e?`bg-primary text-on-primary shadow-[0_0_12px_rgba(173,198,255,0.2)]`:`text-on-surface-variant hover:text-on-surface hover:bg-surface-container-high border border-outline-variant/20`}`,children:e},e)),(0,j.jsx)(`button`,{id:`users-page-next`,type:`button`,onClick:()=>U(e=>Math.min(Q,e+1)),disabled:$===Q,className:`p-1.5 rounded-lg text-on-surface-variant hover:text-on-surface hover:bg-surface-container-high border border-outline-variant/20 transition-all disabled:opacity-30 disabled:cursor-not-allowed`,"aria-label":`Next page`,children:(0,j.jsx)(c,{size:15})})]})]})]}),oe&&(0,j.jsxs)(`div`,{className:`fixed bottom-6 right-6 z-50 flex items-center gap-2 px-5 py-3 rounded-xl shadow-lg text-sm font-medium transition-all ${ce===`success`?`bg-secondary/15 text-secondary border border-secondary/30`:`bg-error/15 text-error border border-error/30`}`,children:[ce===`success`?(0,j.jsx)(u,{size:15}):(0,j.jsx)(l,{size:15}),oe]}),(0,j.jsx)(x,{isOpen:!!q,onClose:()=>J(null),onConfirm:()=>void ge(),loading:re,title:`Remove User`,message:q?`Are you sure you want to permanently remove ${q.name} ${q.lastName}? This action cannot be undone.`:``,confirmText:`Remove`,variant:`danger`}),(0,j.jsx)(P,{isOpen:ae,onClose:()=>Y(!1),onCreated:()=>{U(1),Z(1,B),X(`User provisioned successfully.`)}})]})};export{B as default};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{i as n,s as r}from"./vendor-react-BmVaKUwY.js";import{r as i}from"./vendor-markdown-DoJbQ1of.js";import{i as a}from"./client-B553SX3l.js";import{t as o}from"./chevron-down-BUOg3vvd.js";import{t as s}from"./chevron-left-B0NmQyxK.js";import{t as c}from"./chevron-right-Bm_d1KKk.js";import{t as l}from"./circle-alert-sCcf7ANF.js";import{t as u}from"./circle-check-Jz8IOE4h.js";import{n as d,t as f}from"./user-plus-0Y0M1GKi.js";import{t as p}from"./eye-CjrFwZG_.js";import{n as m,t as h}from"./users-BcnlUG5N.js";import{t as g}from"./loader-circle-CB6PQwdc.js";import{t as _}from"./refresh-cw-BgDsJOC_.js";import{t as v}from"./shield-alert-Do_Sg9SX.js";import{t as y}from"./shield-check-YKs9kUNq.js";import{t as b}from"./trash-2-CphQfk35.js";import{t as x}from"./ConfirmDialog-BltdtevE.js";import{t as S}from"./user-Brcjlps5.js";import{t as C}from"./users-tdyaGZbx.js";import{t as w}from"./x-CCZGYGDC.js";import{n as T}from"./AuthContextInstance-DiFo9Qb2.js";import{n as E}from"./projects-DoalTI7c.js";import{t as D}from"./UserAvatar-Z5W8S1dG.js";var O=a(`crown`,[[`path`,{d:`M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z`,key:`1vdc57`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),k=a(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),A=e(t(),1),j=i();function M({label:e,id:t,type:n=`text`,value:r,onChange:i,placeholder:a,error:o,autoComplete:s,suffix:c}){return(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsx)(`label`,{htmlFor:t,className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:e}),(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(`input`,{id:t,type:n,value:r,onChange:e=>i(e.target.value),placeholder:a,autoComplete:s,className:`w-full bg-surface-container-lowest rounded-lg px-4 py-3 text-sm text-on-surface border focus:outline-none focus:ring-2 transition-all placeholder:text-on-surface-variant/40 ${o?`border-error/60 focus:ring-error/40`:`border-outline-variant/20 focus:ring-primary/40`}`}),c&&(0,j.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2`,children:c})]}),o&&(0,j.jsx)(`p`,{className:`text-[11px] text-error`,children:o})]})}function N({label:e,id:t,value:n,onChange:r,placeholder:i,error:a}){let[o,s]=(0,A.useState)(!1);return(0,j.jsx)(M,{label:e,id:t,type:o?`text`:`password`,value:n,onChange:r,autoComplete:`new-password`,placeholder:i??`••••••••`,error:a,suffix:(0,j.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`text-on-surface-variant hover:text-primary transition-colors`,"aria-label":o?`Hide password`:`Show password`,children:o?(0,j.jsx)(d,{size:16}):(0,j.jsx)(p,{size:16})})})}var P=({isOpen:e,onClose:t,onCreated:n})=>{let[r,i]=(0,A.useState)(``),[a,o]=(0,A.useState)(``),[s,c]=(0,A.useState)(``),[l,d]=(0,A.useState)(``),[p,_]=(0,A.useState)(``),[v,b]=(0,A.useState)(`user`),[x,C]=(0,A.useState)([]),[T,D]=(0,A.useState)(new Set),[k,P]=(0,A.useState)(!1),[F,I]=(0,A.useState)(!1),[L,R]=(0,A.useState)(``),[z,B]=(0,A.useState)({}),V=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;(0,A.useEffect)(()=>{e&&(P(!0),E.findAll().then(e=>C(e.data)).catch(()=>C([])).finally(()=>P(!1)))},[e]),(0,A.useEffect)(()=>{e&&(i(``),o(``),c(``),d(``),_(``),b(`user`),D(new Set),R(``),B({}))},[e]);let H=()=>{let e={};return r.trim()?r.length>100&&(e.firstName=`Maximum 100 characters.`):e.firstName=`First name is required.`,a.trim()?a.length>100&&(e.lastName=`Maximum 100 characters.`):e.lastName=`Last name is required.`,s.trim()?V.test(s)?s.length>255&&(e.email=`Maximum 255 characters.`):e.email=`Must be a valid email.`:e.email=`Email is required.`,l?l.length<8?e.password=`Minimum 8 characters.`:l.length>72&&(e.password=`Maximum 72 characters.`):e.password=`Password is required.`,p?l!==p&&(e.confirmPassword=`Passwords do not match.`):e.confirmPassword=`Please confirm the password.`,e},U=e=>{D(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,A.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&!F&&t()};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,F,t]),e?(0,j.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4 bg-surface/80 backdrop-blur-md`,onClick:e=>{e.target===e.currentTarget&&!F&&t()},role:`dialog`,"aria-modal":`true`,"aria-label":`Create new user`,children:(0,j.jsxs)(`div`,{className:`glass-panel ghost-border rounded-2xl w-full max-w-3xl max-h-[90vh] overflow-y-auto shadow-2xl custom-scrollbar`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between px-7 py-5 border-b border-outline-variant/15 sticky top-0 bg-surface-container/95 backdrop-blur-md z-10`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(`div`,{className:`p-2 rounded-lg bg-primary/10 text-primary`,children:(0,j.jsx)(f,{size:18})}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{className:`font-headline font-bold text-on-surface text-lg`,children:`Provision New User`}),(0,j.jsx)(`p`,{className:`text-xs text-on-surface-variant mt-0.5`,children:`Create a new identity node within the network`})]})]}),(0,j.jsx)(`button`,{id:`create-user-modal-close`,type:`button`,onClick:()=>!F&&t(),disabled:F,className:`p-2 rounded-lg text-on-surface-variant hover:text-on-surface hover:bg-surface-container-high transition-colors disabled:opacity-50`,"aria-label":`Close modal`,children:(0,j.jsx)(w,{size:18})})]}),(0,j.jsxs)(`form`,{id:`create-user-form`,onSubmit:async e=>{e.preventDefault();let i=H();if(Object.keys(i).length>0){B(i);return}B({}),R(``),I(!0);try{let e=await h.createUser({name:r.trim(),lastName:a.trim(),email:s.trim(),password:l});v===`admin`&&e.id&&await h.updateRole(e.id,`admin`);let i=Array.from(T).map(t=>E.addMember(t,e.id));i.length>0&&await Promise.allSettled(i),n(),t()}catch(e){R(e instanceof Error?e.message:`Failed to create user. Please try again.`)}finally{I(!1)}},noValidate:!0,children:[(0,j.jsxs)(`div`,{className:`px-7 py-6 grid grid-cols-1 md:grid-cols-12 gap-6`,children:[(0,j.jsxs)(`div`,{className:`md:col-span-7 space-y-6`,children:[(0,j.jsxs)(`section`,{className:`bg-surface-container-high/40 rounded-xl p-5 border border-outline-variant/10`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2.5 mb-5`,children:[(0,j.jsx)(`div`,{className:`p-1.5 rounded bg-primary/10 text-primary`,children:(0,j.jsx)(S,{size:14})}),(0,j.jsx)(`h3`,{className:`font-headline font-bold text-sm text-on-surface`,children:`Personal Information`})]}),(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,j.jsx)(M,{label:`First Name`,id:`create-user-first-name`,value:r,onChange:i,placeholder:`Julian`,error:z.firstName}),(0,j.jsx)(M,{label:`Last Name`,id:`create-user-last-name`,value:a,onChange:o,placeholder:`Vane`,error:z.lastName})]}),(0,j.jsx)(M,{label:`Email Address`,id:`create-user-email`,type:`email`,value:s,onChange:c,placeholder:`j.vane@example.com`,autoComplete:`off`,error:z.email}),(0,j.jsx)(N,{label:`Initial Password`,id:`create-user-password`,value:l,onChange:d,placeholder:`Min. 8 characters`,error:z.password}),(0,j.jsx)(N,{label:`Confirm Password`,id:`create-user-confirm-password`,value:p,onChange:_,placeholder:`Repeat password`,error:z.confirmPassword})]})]}),(0,j.jsxs)(`section`,{className:`bg-surface-container-high/40 rounded-xl p-5 border border-outline-variant/10`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2.5 mb-5`,children:[(0,j.jsx)(`div`,{className:`p-1.5 rounded bg-secondary/10 text-secondary`,children:(0,j.jsx)(y,{size:14})}),(0,j.jsx)(`h3`,{className:`font-headline font-bold text-sm text-on-surface`,children:`Role Assignment`})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,j.jsxs)(`label`,{htmlFor:`create-user-role-user`,className:`relative flex flex-col p-4 rounded-xl cursor-pointer transition-all border ${v===`user`?`bg-secondary/10 border-secondary/30 shadow-[0_0_16px_rgba(78,222,163,0.1)]`:`bg-surface-container-lowest border-outline-variant/20 hover:border-outline-variant/40`}`,children:[(0,j.jsx)(`input`,{id:`create-user-role-user`,type:`radio`,name:`create-user-role`,value:`user`,checked:v===`user`,onChange:()=>b(`user`),className:`sr-only`}),(0,j.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(S,{size:14,className:v===`user`?`text-secondary`:`text-on-surface-variant`}),(0,j.jsx)(`span`,{className:`font-bold text-sm ${v===`user`?`text-secondary`:`text-on-surface`}`,children:`Member`})]}),(0,j.jsx)(`div`,{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center transition-all ${v===`user`?`border-secondary`:`border-outline-variant`}`,children:v===`user`&&(0,j.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-secondary`})})]}),(0,j.jsx)(`p`,{className:`text-[11px] text-on-surface-variant leading-relaxed`,children:`Scoped access limited to assigned project environments.`})]}),(0,j.jsxs)(`label`,{htmlFor:`create-user-role-admin`,className:`relative flex flex-col p-4 rounded-xl cursor-pointer transition-all border ${v===`admin`?`bg-primary/10 border-primary/30 shadow-[0_0_16px_rgba(173,198,255,0.1)]`:`bg-surface-container-lowest border-outline-variant/20 hover:border-outline-variant/40`}`,children:[(0,j.jsx)(`input`,{id:`create-user-role-admin`,type:`radio`,name:`create-user-role`,value:`admin`,checked:v===`admin`,onChange:()=>b(`admin`),className:`sr-only`}),(0,j.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(O,{size:14,className:v===`admin`?`text-primary`:`text-on-surface-variant`}),(0,j.jsx)(`span`,{className:`font-bold text-sm ${v===`admin`?`text-primary`:`text-on-surface`}`,children:`Admin`})]}),(0,j.jsx)(`div`,{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center transition-all ${v===`admin`?`border-primary`:`border-outline-variant`}`,children:v===`admin`&&(0,j.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-primary`})})]}),(0,j.jsx)(`p`,{className:`text-[11px] text-on-surface-variant leading-relaxed`,children:`Full administrative access across all projects and governance.`})]})]})]})]}),(0,j.jsx)(`div`,{className:`md:col-span-5 space-y-6`,children:(0,j.jsxs)(`section`,{className:`bg-surface-container-high/40 rounded-xl p-5 border border-outline-variant/10`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2.5 mb-5`,children:[(0,j.jsx)(`div`,{className:`p-1.5 rounded bg-tertiary/10 text-tertiary`,children:(0,j.jsx)(m,{size:14})}),(0,j.jsx)(`h3`,{className:`font-headline font-bold text-sm text-on-surface`,children:`Project Access`})]}),k?(0,j.jsx)(`div`,{className:`space-y-2`,children:[1,2,3].map(e=>(0,j.jsx)(`div`,{className:`h-12 rounded-lg bg-surface-container-highest/30 animate-pulse`},e))}):x.length===0?(0,j.jsxs)(`div`,{className:`text-center py-8`,children:[(0,j.jsx)(m,{size:32,className:`text-on-surface-variant/30 mx-auto mb-2`}),(0,j.jsx)(`p`,{className:`text-xs text-on-surface-variant/60`,children:`No projects available`})]}):(0,j.jsx)(`div`,{className:`space-y-2 max-h-64 overflow-y-auto custom-scrollbar pr-1`,children:x.map(e=>{let t=T.has(e.id);return(0,j.jsxs)(`button`,{type:`button`,onClick:()=>U(e.id),className:`w-full flex items-center justify-between p-3 rounded-lg text-left transition-all border ${t?`bg-tertiary/10 border-tertiary/30`:`bg-surface-container-lowest border-outline-variant/15 hover:border-outline-variant/40`}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,j.jsx)(`div`,{className:`w-7 h-7 rounded-lg bg-tertiary/10 flex items-center justify-center flex-shrink-0`,children:(0,j.jsx)(m,{size:13,className:`text-tertiary`})}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`text-xs font-semibold text-on-surface truncate`,children:e.title}),(0,j.jsx)(`p`,{className:`text-[10px] text-on-surface-variant capitalize`,children:e.status.replace(`_`,` `)})]})]}),(0,j.jsx)(`div`,{className:`w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 ml-2 transition-all ${t?`bg-tertiary border-tertiary`:`border-outline-variant`}`,children:t&&(0,j.jsx)(u,{size:10,className:`text-on-tertiary`})})]},e.id)})}),T.size>0&&(0,j.jsxs)(`p`,{className:`text-[10px] text-tertiary font-medium mt-3 flex items-center gap-1`,children:[(0,j.jsx)(u,{size:11}),T.size,` project`,T.size>1?`s`:``,` selected`]})]})})]}),L&&(0,j.jsx)(`div`,{className:`mx-7 mb-4 px-4 py-3 rounded-lg bg-error/10 border border-error/30 text-error text-sm`,children:L}),(0,j.jsxs)(`div`,{className:`flex items-center justify-end gap-3 px-7 py-5 border-t border-outline-variant/15 sticky bottom-0 bg-surface-container/95 backdrop-blur-md`,children:[(0,j.jsx)(`button`,{id:`create-user-modal-cancel`,type:`button`,onClick:()=>!F&&t(),disabled:F,className:`px-5 py-2.5 rounded-lg text-sm font-bold text-on-surface-variant hover:bg-surface-container-high border border-outline-variant/20 transition-colors disabled:opacity-50`,children:`Cancel`}),(0,j.jsxs)(`button`,{id:`create-user-modal-submit`,type:`submit`,disabled:F,className:`px-6 py-2.5 rounded-lg text-sm font-bold bg-primary text-on-primary hover:brightness-110 active:scale-95 transition-all shadow-[0_8px_24px_rgba(173,198,255,0.2)] disabled:opacity-60 flex items-center gap-2`,children:[F?(0,j.jsx)(g,{size:15,className:`animate-spin`}):(0,j.jsx)(f,{size:15}),F?`Provisioning…`:`Provision User`]})]})]})]})}):null},F=15,I=300;function L({role:e}){let t=e===`admin`;return(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-widest ${t?`bg-primary/10 text-primary border border-primary/20`:`bg-surface-container-highest text-on-surface-variant border border-outline-variant/20`}`,children:[t?(0,j.jsx)(O,{size:9}):(0,j.jsx)(S,{size:9}),t?`Admin`:`Member`]})}function R(){return(0,j.jsxs)(`div`,{className:`flex items-center gap-4 px-6 py-4 border-b border-outline-variant/10 animate-pulse`,children:[(0,j.jsx)(`div`,{className:`w-10 h-10 rounded-full bg-surface-container-highest/50`}),(0,j.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,j.jsx)(`div`,{className:`h-3 bg-surface-container-highest/50 rounded w-36`}),(0,j.jsx)(`div`,{className:`h-2.5 bg-surface-container-highest/40 rounded w-52`})]}),(0,j.jsx)(`div`,{className:`h-5 bg-surface-container-highest/40 rounded-full w-16`}),(0,j.jsx)(`div`,{className:`h-3 bg-surface-container-highest/30 rounded w-20`}),(0,j.jsxs)(`div`,{className:`flex gap-2`,children:[(0,j.jsx)(`div`,{className:`h-8 w-24 bg-surface-container-highest/30 rounded-lg`}),(0,j.jsx)(`div`,{className:`h-8 w-8 bg-surface-container-highest/30 rounded-lg`})]})]})}function z(e){return e?new Date(e).toLocaleDateString(`en-US`,{year:`numeric`,month:`short`,day:`numeric`}):`—`}var B=()=>{let{user:e}=T(),t=r(),i=e?.role===`admin`,[a,d]=(0,A.useState)([]),[p,m]=(0,A.useState)(0),[g,y]=(0,A.useState)(!0),[w,E]=(0,A.useState)(``),[M,N]=(0,A.useState)(``),[B,V]=(0,A.useState)(``),[H,U]=(0,A.useState)(1),[ee,W]=(0,A.useState)(null),[te,G]=(0,A.useState)(null),[ne,K]=(0,A.useState)(null),[q,J]=(0,A.useState)(null),[re,ie]=(0,A.useState)(!1),[ae,Y]=(0,A.useState)(!1),[oe,se]=(0,A.useState)(``),[ce,le]=(0,A.useState)(`success`),X=(e,t=`success`)=>{se(e),le(t),setTimeout(()=>se(``),4e3)},Z=(0,A.useCallback)(async(e,t)=>{y(!0),E(``);try{let n=await h.findAll({page:e,limit:F,search:t||void 0});d(n.items),m(n.total)}catch(e){E(e instanceof Error?e.message:`Failed to load users.`)}finally{y(!1)}},[]);if((0,A.useEffect)(()=>{let e=window.setTimeout(()=>{V(M.trim())},I);return()=>window.clearTimeout(e)},[M]),(0,A.useEffect)(()=>{i&&Z(H,B)},[H,B,Z,i]),!i)return(0,j.jsx)(n,{to:`/`,replace:!0});let ue=a.filter(e=>e.role===`admin`).length,de=a.filter(e=>e.role!==`admin`).length,Q=Math.max(1,Math.ceil(p/F)),$=Math.min(H,Q),fe=p===0?0:($-1)*F+1,pe=p===0?0:Math.min($*F,p),me=e=>{N(e),U(1)},he=async(e,t)=>{G(e);try{await h.updateRole(e,t),d(n=>n.map(n=>n.id===e?{...n,role:t}:n)),K(e),W(null),setTimeout(()=>K(null),2500),X(`Role updated successfully.`)}catch{X(`Failed to update role.`,`error`)}finally{G(null)}},ge=async()=>{if(q){ie(!0);try{await h.deleteUser(q.id),J(null);let e=a.length===1&&H>1?H-1:H;U(e),e===H&&await Z(e,B),X(`${q.name} ${q.lastName} removed successfully.`)}catch{X(`Failed to delete user.`,`error`)}finally{ie(!1)}}};return(0,j.jsxs)(`div`,{className:`min-h-full pb-16 relative`,children:[(0,j.jsx)(`div`,{className:`pointer-events-none fixed top-0 right-0 w-[600px] h-[600px] bg-primary/3 blur-[160px] rounded-full -z-0`}),(0,j.jsx)(`div`,{className:`pointer-events-none fixed bottom-0 left-64 w-[400px] h-[400px] bg-tertiary/3 blur-[120px] rounded-full -z-0`}),(0,j.jsxs)(`header`,{className:`mb-8 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 relative z-10`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3 mb-1`,children:[(0,j.jsx)(`div`,{className:`p-2 rounded-xl bg-primary/10 text-primary`,children:(0,j.jsx)(C,{size:20})}),(0,j.jsx)(`h1`,{className:`font-headline text-3xl font-extrabold text-on-surface tracking-tight`,children:`User Directory`})]}),(0,j.jsx)(`p`,{className:`text-sm text-on-surface-variant ml-14`,children:`Manage identity nodes and access clearances across the network.`})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-3 flex-shrink-0`,children:[(0,j.jsx)(`button`,{id:`users-refresh-btn`,type:`button`,onClick:()=>void Z(H,B),disabled:g,className:`p-2.5 rounded-lg text-on-surface-variant hover:bg-surface-container-high border border-outline-variant/20 transition-all disabled:opacity-50`,title:`Refresh`,children:(0,j.jsx)(_,{size:16,className:g?`animate-spin`:``})}),(0,j.jsxs)(`button`,{id:`users-create-btn`,type:`button`,onClick:()=>Y(!0),className:`flex items-center gap-2 px-5 py-2.5 rounded-lg text-sm font-bold bg-primary text-on-primary hover:brightness-110 active:scale-95 transition-all shadow-[0_8px_24px_rgba(173,198,255,0.2)]`,children:[(0,j.jsx)(f,{size:16}),`Provision User`]})]})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 mb-6 relative z-10`,children:[(0,j.jsxs)(`div`,{className:`glass-panel ghost-border rounded-xl p-4 flex items-center gap-3`,children:[(0,j.jsx)(`div`,{className:`p-2 rounded-lg bg-primary/10 text-primary`,children:(0,j.jsx)(C,{size:16})}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-widest`,children:`Total Users`}),(0,j.jsx)(`p`,{className:`font-headline font-extrabold text-xl text-on-surface`,children:g?`…`:p})]})]}),(0,j.jsxs)(`div`,{className:`glass-panel ghost-border rounded-xl p-4 flex items-center gap-3`,children:[(0,j.jsx)(`div`,{className:`p-2 rounded-lg bg-secondary/10 text-secondary`,children:(0,j.jsx)(O,{size:16})}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-widest`,children:`Admins on Page`}),(0,j.jsx)(`p`,{className:`font-headline font-extrabold text-xl text-on-surface`,children:g?`…`:ue})]})]}),(0,j.jsxs)(`div`,{className:`glass-panel ghost-border rounded-xl p-4 flex items-center gap-3`,children:[(0,j.jsx)(`div`,{className:`p-2 rounded-lg bg-tertiary/10 text-tertiary`,children:(0,j.jsx)(S,{size:16})}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-widest`,children:`Members on Page`}),(0,j.jsx)(`p`,{className:`font-headline font-extrabold text-xl text-on-surface`,children:g?`…`:de})]})]})]}),(0,j.jsxs)(`div`,{className:`relative mb-4 z-10`,children:[(0,j.jsx)(k,{size:16,className:`absolute left-4 top-1/2 -translate-y-1/2 text-on-surface-variant/50`}),(0,j.jsx)(`input`,{id:`users-search`,type:`text`,value:M,onChange:e=>me(e.target.value),placeholder:`Search by name or email…`,className:`w-full bg-surface-container-low rounded-xl pl-10 pr-4 py-3 text-sm text-on-surface border border-outline-variant/15 focus:outline-none focus:ring-2 focus:ring-primary/40 placeholder:text-on-surface-variant/40 transition-all`})]}),(0,j.jsxs)(`div`,{className:`glass-panel ghost-border rounded-2xl overflow-hidden relative z-10`,children:[g&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(R,{}),(0,j.jsx)(R,{}),(0,j.jsx)(R,{}),(0,j.jsx)(R,{})]}),!g&&w&&(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 gap-3 text-center`,children:[(0,j.jsx)(`div`,{className:`p-3 rounded-full bg-error/10 text-error`,children:(0,j.jsx)(l,{size:24})}),(0,j.jsx)(`p`,{className:`text-sm font-semibold text-on-surface`,children:w}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>void Z(H,B),className:`text-xs text-primary hover:underline`,children:`Try again`})]}),!g&&!w&&a.length===0&&(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 gap-3 text-center`,children:[(0,j.jsx)(`div`,{className:`p-3 rounded-full bg-surface-container-high text-on-surface-variant`,children:(0,j.jsx)(C,{size:24})}),(0,j.jsx)(`p`,{className:`text-sm font-semibold text-on-surface`,children:B?`No users match your search.`:`No users found.`}),!B&&(0,j.jsxs)(`button`,{type:`button`,onClick:()=>Y(!0),className:`text-xs text-primary hover:underline flex items-center gap-1`,children:[(0,j.jsx)(f,{size:12}),` Provision the first user`]})]}),!g&&!w&&a.length>0&&(0,j.jsxs)(`table`,{className:`w-full table-fixed border-collapse`,children:[(0,j.jsxs)(`colgroup`,{children:[(0,j.jsx)(`col`,{style:{width:`28%`}}),(0,j.jsx)(`col`,{style:{width:`28%`}}),(0,j.jsx)(`col`,{style:{width:`14%`}}),(0,j.jsx)(`col`,{style:{width:`14%`}}),(0,j.jsx)(`col`,{style:{width:`16%`}})]}),(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{className:`border-b border-outline-variant/10 bg-surface-container-high/40`,children:[(0,j.jsx)(`th`,{scope:`col`,className:`px-6 py-3 text-left text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:`Name`}),(0,j.jsx)(`th`,{scope:`col`,className:`px-6 py-3 text-left text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:`Email`}),(0,j.jsx)(`th`,{scope:`col`,className:`px-6 py-3 text-left text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:`Role`}),(0,j.jsx)(`th`,{scope:`col`,className:`px-6 py-3 text-left text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:`Joined`}),(0,j.jsx)(`th`,{scope:`col`,className:`px-6 py-3 text-left text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:`Actions`})]})}),(0,j.jsx)(`tbody`,{children:a.map(n=>{let r=n.id===e?.id,i=ee===n.id,a=te===n.id,s=ne===n.id,c=`${n.name} ${n.lastName}`.trim();return(0,j.jsxs)(`tr`,{onClick:()=>t(`/users/${n.id}`),className:`group border-b border-outline-variant/10 hover:bg-surface-container-high/30 transition-colors last:border-b-0 cursor-pointer`,children:[(0,j.jsx)(`td`,{className:`px-6 py-4`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(D,{name:c,avatar:n.avatar,avatarUrl:n.avatarUrl,alt:c,className:`w-9 h-9 rounded-full overflow-hidden ring-2 ring-outline-variant/20 flex-shrink-0`}),(0,j.jsxs)(`p`,{className:`text-sm font-semibold text-on-surface truncate`,children:[c,r&&(0,j.jsx)(`span`,{className:`ml-2 text-[9px] font-bold bg-primary/10 text-primary border border-primary/20 px-1.5 py-0.5 rounded-full uppercase tracking-widest`,children:`You`})]})]})}),(0,j.jsx)(`td`,{className:`px-6 py-4`,children:(0,j.jsx)(`p`,{className:`text-xs text-on-surface-variant truncate`,children:n.email})}),(0,j.jsx)(`td`,{className:`px-6 py-4`,children:s?(0,j.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-secondary font-medium`,children:[(0,j.jsx)(u,{size:13}),` Updated`]}):i?(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsxs)(`select`,{id:`users-role-select-${n.id}`,defaultValue:n.role??`user`,disabled:r||a,onClick:e=>e.stopPropagation(),onChange:e=>{he(n.id,e.target.value)},className:`w-full bg-surface-container-lowest text-on-surface text-xs rounded-lg border border-outline-variant/20 focus:outline-none focus:ring-2 focus:ring-primary/40 pl-3 pr-7 py-1.5 appearance-none cursor-pointer disabled:opacity-50`,children:[(0,j.jsx)(`option`,{value:`user`,children:`Member`}),(0,j.jsx)(`option`,{value:`admin`,children:`Admin`})]}),(0,j.jsx)(o,{size:12,className:`absolute right-2 top-1/2 -translate-y-1/2 text-on-surface-variant pointer-events-none`})]}):(0,j.jsx)(L,{role:n.role})}),(0,j.jsx)(`td`,{className:`px-6 py-4`,children:(0,j.jsx)(`p`,{className:`text-[11px] text-on-surface-variant`,children:z(n.createdAt)})}),(0,j.jsx)(`td`,{className:`px-6 py-4`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity`,children:[!r&&(0,j.jsx)(`button`,{id:`users-edit-role-${n.id}`,type:`button`,onClick:e=>{e.stopPropagation(),W(i?null:n.id)},disabled:a,title:i?`Cancel role edit`:`Change role`,className:`px-3 py-1.5 rounded-lg text-[11px] font-bold border transition-all disabled:opacity-50 ${i?`bg-surface-container-high text-on-surface border-outline-variant/30`:`bg-primary/10 text-primary border-primary/20 hover:bg-primary/20`}`,children:i?`Cancel`:`Edit Role`}),!r&&(0,j.jsx)(`button`,{id:`users-delete-${n.id}`,type:`button`,onClick:e=>{e.stopPropagation(),J(n)},title:`Remove user`,className:`p-1.5 rounded-lg text-on-surface-variant hover:text-error hover:bg-error/10 border border-transparent hover:border-error/20 transition-all`,children:(0,j.jsx)(b,{size:14})}),r&&(0,j.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] text-on-surface-variant/50 font-medium`,children:[(0,j.jsx)(v,{size:11}),`Current session`]})]})})]},n.id)})})]}),!g&&!w&&p>F&&(0,j.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-t border-outline-variant/10 bg-surface-container-high/20`,children:[(0,j.jsxs)(`p`,{className:`text-xs text-on-surface-variant`,children:[`Showing`,` `,(0,j.jsxs)(`span`,{className:`font-semibold text-on-surface`,children:[fe,`–`,pe]}),` `,`of`,` `,(0,j.jsx)(`span`,{className:`font-semibold text-on-surface`,children:p}),` `,B?`matching users`:`users`]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`button`,{id:`users-page-prev`,type:`button`,onClick:()=>U(e=>Math.max(1,e-1)),disabled:$===1,className:`p-1.5 rounded-lg text-on-surface-variant hover:text-on-surface hover:bg-surface-container-high border border-outline-variant/20 transition-all disabled:opacity-30 disabled:cursor-not-allowed`,"aria-label":`Previous page`,children:(0,j.jsx)(s,{size:15})}),Array.from({length:Q},(e,t)=>t+1).filter(e=>e===1||e===Q||Math.abs(e-$)<=1).reduce((e,t,n,r)=>(n>0&&t-r[n-1]>1&&e.push(`ellipsis`),e.push(t),e),[]).map((e,t)=>e===`ellipsis`?(0,j.jsx)(`span`,{className:`px-2 text-on-surface-variant/50 text-xs`,children:`…`},`ellipsis-${t}`):(0,j.jsx)(`button`,{id:`users-page-${e}`,type:`button`,onClick:()=>U(e),className:`w-8 h-8 rounded-lg text-xs font-bold transition-all ${$===e?`bg-primary text-on-primary shadow-[0_0_12px_rgba(173,198,255,0.2)]`:`text-on-surface-variant hover:text-on-surface hover:bg-surface-container-high border border-outline-variant/20`}`,children:e},e)),(0,j.jsx)(`button`,{id:`users-page-next`,type:`button`,onClick:()=>U(e=>Math.min(Q,e+1)),disabled:$===Q,className:`p-1.5 rounded-lg text-on-surface-variant hover:text-on-surface hover:bg-surface-container-high border border-outline-variant/20 transition-all disabled:opacity-30 disabled:cursor-not-allowed`,"aria-label":`Next page`,children:(0,j.jsx)(c,{size:15})})]})]})]}),oe&&(0,j.jsxs)(`div`,{className:`fixed bottom-6 right-6 z-50 flex items-center gap-2 px-5 py-3 rounded-xl shadow-lg text-sm font-medium transition-all ${ce===`success`?`bg-secondary/15 text-secondary border border-secondary/30`:`bg-error/15 text-error border border-error/30`}`,children:[ce===`success`?(0,j.jsx)(u,{size:15}):(0,j.jsx)(l,{size:15}),oe]}),(0,j.jsx)(x,{isOpen:!!q,onClose:()=>J(null),onConfirm:()=>void ge(),loading:re,title:`Remove User`,message:q?`Are you sure you want to permanently remove ${q.name} ${q.lastName}? This action cannot be undone.`:``,confirmText:`Remove`,variant:`danger`}),(0,j.jsx)(P,{isOpen:ae,onClose:()=>Y(!1),onCreated:()=>{U(1),Z(1,B),X(`User provisioned successfully.`)}})]})};export{B as default};
@@ -1 +1 @@
1
- import{i as e}from"./client-BGOBXkO8.js";var t=e(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]);export{t};
1
+ import{i as e}from"./client-B553SX3l.js";var t=e(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]);export{t};
@@ -1 +1 @@
1
- import{t as e}from"./client-BGOBXkO8.js";var t={creativity:3,strictness:3.5},n={findAll:()=>e.get(`/agents`),findOne:t=>e.get(`/agents/${t}`),create:t=>e.post(`/agents`,t),update:(t,n)=>e.patch(`/agents/${t}`,n),delete:t=>e.delete(`/agents/${t}`),probe:(t,n)=>e.post(`/agents/probe`,{agentId:t,input:n})};export{n,t};
1
+ import{t as e}from"./client-B553SX3l.js";var t={creativity:3,strictness:3.5},n={findAll:()=>e.get(`/agents`),findOne:t=>e.get(`/agents/${t}`),create:t=>e.post(`/agents`,t),update:(t,n)=>e.patch(`/agents/${t}`,n),delete:t=>e.delete(`/agents/${t}`),probe:(t,n)=>e.post(`/agents/probe`,{agentId:t,input:n})};export{n,t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{r as n}from"./vendor-markdown-DoJbQ1of.js";import{i as r,t as i}from"./client-BGOBXkO8.js";import{t as a}from"./chevron-down-LTeQHW9O.js";import{t as o}from"./x-wDy15QMx.js";import{n as s,t as c}from"./vendor-motion-CMGWJcqR.js";import{n as l,t as u}from"./projects-CUOthD8N.js";import{n as d}from"./agents-b8btewki.js";import{t as f}from"./useNotification-DQayTSUL.js";var p=r(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),m=r(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),h=e(t(),1),g=n(),_=({isOpen:e,onClose:t,onCreated:n,canCreate:r=!0,blockedReason:i})=>{let{notifyError:_}=f(),[v,y]=(0,h.useState)(!1),[b,x]=(0,h.useState)([]),[S,C]=(0,h.useState)(``),[w,T]=(0,h.useState)(``),[E,D]=(0,h.useState)(u.PLANNING),[O,k]=(0,h.useState)(``);(0,h.useEffect)(()=>{let n=e=>{e.key===`Escape`&&t()};return e&&(window.addEventListener(`keydown`,n),A()),()=>window.removeEventListener(`keydown`,n)},[e,t]);let A=async()=>{try{x((await d.findAll()).data)}catch{}};return e?(0,g.jsx)(s,{mode:`wait`,children:(0,g.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4`,children:[(0,g.jsx)(c.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`absolute inset-0 bg-surface/80 backdrop-blur-xl`}),(0,g.jsxs)(c.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:`relative w-full max-w-lg bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden flex flex-col ring-1 ring-outline-variant/10`,children:[(0,g.jsxs)(`div`,{className:`px-6 py-5 border-b border-outline-variant/10 flex items-center justify-between bg-surface-container-low/50 backdrop-blur-md`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-secondary/10 flex items-center justify-center text-secondary`,children:(0,g.jsx)(p,{size:22})}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h2`,{className:`text-xl font-black font-headline text-white tracking-tight`,children:`Init Project`}),(0,g.jsx)(`p`,{className:`text-[10px] uppercase tracking-widest text-on-surface-variant/60 font-bold`,children:`New Project`})]})]}),(0,g.jsx)(`button`,{onClick:t,className:`w-8 h-8 rounded-full flex items-center justify-center text-on-surface-variant hover:bg-surface-container-highest transition-colors`,children:(0,g.jsx)(o,{size:18})})]}),(0,g.jsxs)(`div`,{className:`p-8 space-y-6`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Project Title`}),(0,g.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 focus-within:bg-surface-container-highest/50 transition-all`,children:(0,g.jsx)(`input`,{type:`text`,placeholder:`e.g. Market Dynamics Alpha`,value:S,onChange:e=>C(e.target.value),disabled:!r,className:`w-full bg-transparent border-none text-sm text-on-surface h-12 px-4 focus:outline-none placeholder:text-on-surface-variant/30 font-medium`})})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Project Description`}),(0,g.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all`,children:(0,g.jsx)(`textarea`,{placeholder:`Define the scope and strategic goals...`,value:w,onChange:e=>T(e.target.value),disabled:!r,className:`w-full bg-transparent border-none text-sm text-on-surface h-24 p-4 focus:outline-none placeholder:text-on-surface-variant/30 font-medium resize-none custom-scrollbar`})})]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Status Protocol`}),(0,g.jsxs)(`div`,{className:`bg-surface-container-highest/30 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all relative`,children:[(0,g.jsx)(`select`,{value:E,onChange:e=>D(e.target.value),disabled:!r,className:`w-full bg-transparent border-none text-[11px] font-black text-on-surface h-10 px-4 focus:outline-none appearance-none cursor-pointer uppercase tracking-widest`,children:Object.entries(u).map(([e,t])=>(0,g.jsx)(`option`,{value:t,className:`bg-surface-container-low text-on-surface uppercase`,children:e},t))}),(0,g.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,g.jsx)(a,{size:14})})]})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Project Lead (Optional)`}),(0,g.jsxs)(`div`,{className:`bg-surface-container-highest/30 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all relative`,children:[(0,g.jsxs)(`select`,{value:O,onChange:e=>k(e.target.value),disabled:!r,className:`w-full bg-transparent border-none text-[11px] font-black text-on-surface h-10 px-4 focus:outline-none appearance-none cursor-pointer`,children:[(0,g.jsx)(`option`,{value:``,className:`bg-surface-container-low text-on-surface uppercase`,children:`No Lead assigned`}),b.map(e=>(0,g.jsx)(`option`,{value:e.id,className:`bg-surface-container-low text-on-surface`,children:e.name},e.id))]}),(0,g.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,g.jsx)(a,{size:14})})]})]})]})]}),(0,g.jsxs)(`div`,{className:`px-8 py-6 bg-surface-container-low/80 backdrop-blur-md border-t border-outline-variant/10 flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] font-bold text-on-surface-variant/50 uppercase tracking-widest`,children:[(0,g.jsx)(m,{size:12,className:`text-secondary animate-pulse`}),r?`Initializing Network Node`:`Project creation unavailable`]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,g.jsx)(`button`,{onClick:t,className:`px-6 py-2 rounded-lg text-sm font-bold text-on-surface-variant hover:text-white transition-all hover:bg-surface-container-highest`,children:`Abort`}),(0,g.jsxs)(`button`,{onClick:async()=>{if(!S){_(`Validation Error`,`Project title is required`);return}if(!r){_(`Project Creation Blocked`,i??`Project creation is unavailable right now`);return}try{y(!0),await l.create({title:S,description:w||void 0,status:E,ownerAgentId:O||void 0}),await n?.(),t(),C(``),T(``),D(u.PLANNING),k(``)}catch{}finally{y(!1)}},disabled:v||!r,className:`px-10 py-2.5 rounded-lg bg-secondary text-surface text-sm font-black shadow-[0_8px_20px_rgba(78,222,163,0.2)] hover:scale-[1.02] active:scale-[0.98] transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed group relative overflow-hidden`,children:[(0,g.jsx)(`div`,{className:`absolute inset-0 bg-white/10 translate-x-[-100%] group-hover:translate-x-[100%] transition-transform duration-700 skew-x-12`}),v?`Initializing...`:`Create Project`]})]})]}),!r&&i&&(0,g.jsx)(`div`,{className:`px-8 pb-6 text-xs text-error`,children:i})]})]})}):null},v={login:async(e,t)=>{await i.post(`/auth/login`,{email:e,password:t})},register:async(e,t,n,r,a)=>(await i.post(`/auth/register`,{name:e,lastName:t,email:n,password:r,avatar:a})).data,me:async()=>(await i.get(`/auth/me`)).data,updateProfile:async e=>(await i.patch(`/auth/me`,e)).data,refresh:async()=>(await i.post(`/auth/refresh`,void 0,{skipAuthRefresh:!0})).data,logout:async()=>{await i.post(`/auth/logout`)}};export{_ as n,v as t};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{r as n}from"./vendor-markdown-DoJbQ1of.js";import{i as r,t as i}from"./client-B553SX3l.js";import{t as a}from"./chevron-down-BUOg3vvd.js";import{t as o}from"./x-CCZGYGDC.js";import{n as s,t as c}from"./vendor-motion-CMGWJcqR.js";import{n as l,t as u}from"./projects-DoalTI7c.js";import{n as d}from"./agents-YQJ7JNfI.js";import{t as f}from"./useNotification-DQayTSUL.js";var p=r(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),m=r(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),h=e(t(),1),g=n(),_=({isOpen:e,onClose:t,onCreated:n,canCreate:r=!0,blockedReason:i})=>{let{notifyError:_}=f(),[v,y]=(0,h.useState)(!1),[b,x]=(0,h.useState)([]),[S,C]=(0,h.useState)(``),[w,T]=(0,h.useState)(``),[E,D]=(0,h.useState)(u.PLANNING),[O,k]=(0,h.useState)(``);(0,h.useEffect)(()=>{let n=e=>{e.key===`Escape`&&t()};return e&&(window.addEventListener(`keydown`,n),A()),()=>window.removeEventListener(`keydown`,n)},[e,t]);let A=async()=>{try{x((await d.findAll()).data)}catch{}};return e?(0,g.jsx)(s,{mode:`wait`,children:(0,g.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4`,children:[(0,g.jsx)(c.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`absolute inset-0 bg-surface/80 backdrop-blur-xl`}),(0,g.jsxs)(c.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:`relative w-full max-w-lg bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden flex flex-col ring-1 ring-outline-variant/10`,children:[(0,g.jsxs)(`div`,{className:`px-6 py-5 border-b border-outline-variant/10 flex items-center justify-between bg-surface-container-low/50 backdrop-blur-md`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-secondary/10 flex items-center justify-center text-secondary`,children:(0,g.jsx)(p,{size:22})}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h2`,{className:`text-xl font-black font-headline text-white tracking-tight`,children:`Init Project`}),(0,g.jsx)(`p`,{className:`text-[10px] uppercase tracking-widest text-on-surface-variant/60 font-bold`,children:`New Project`})]})]}),(0,g.jsx)(`button`,{onClick:t,className:`w-8 h-8 rounded-full flex items-center justify-center text-on-surface-variant hover:bg-surface-container-highest transition-colors`,children:(0,g.jsx)(o,{size:18})})]}),(0,g.jsxs)(`div`,{className:`p-8 space-y-6`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Project Title`}),(0,g.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 focus-within:bg-surface-container-highest/50 transition-all`,children:(0,g.jsx)(`input`,{type:`text`,placeholder:`e.g. Market Dynamics Alpha`,value:S,onChange:e=>C(e.target.value),disabled:!r,className:`w-full bg-transparent border-none text-sm text-on-surface h-12 px-4 focus:outline-none placeholder:text-on-surface-variant/30 font-medium`})})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Project Description`}),(0,g.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all`,children:(0,g.jsx)(`textarea`,{placeholder:`Define the scope and strategic goals...`,value:w,onChange:e=>T(e.target.value),disabled:!r,className:`w-full bg-transparent border-none text-sm text-on-surface h-24 p-4 focus:outline-none placeholder:text-on-surface-variant/30 font-medium resize-none custom-scrollbar`})})]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Status Protocol`}),(0,g.jsxs)(`div`,{className:`bg-surface-container-highest/30 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all relative`,children:[(0,g.jsx)(`select`,{value:E,onChange:e=>D(e.target.value),disabled:!r,className:`w-full bg-transparent border-none text-[11px] font-black text-on-surface h-10 px-4 focus:outline-none appearance-none cursor-pointer uppercase tracking-widest`,children:Object.entries(u).map(([e,t])=>(0,g.jsx)(`option`,{value:t,className:`bg-surface-container-low text-on-surface uppercase`,children:e},t))}),(0,g.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,g.jsx)(a,{size:14})})]})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Project Lead (Optional)`}),(0,g.jsxs)(`div`,{className:`bg-surface-container-highest/30 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all relative`,children:[(0,g.jsxs)(`select`,{value:O,onChange:e=>k(e.target.value),disabled:!r,className:`w-full bg-transparent border-none text-[11px] font-black text-on-surface h-10 px-4 focus:outline-none appearance-none cursor-pointer`,children:[(0,g.jsx)(`option`,{value:``,className:`bg-surface-container-low text-on-surface uppercase`,children:`No Lead assigned`}),b.map(e=>(0,g.jsx)(`option`,{value:e.id,className:`bg-surface-container-low text-on-surface`,children:e.name},e.id))]}),(0,g.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,g.jsx)(a,{size:14})})]})]})]})]}),(0,g.jsxs)(`div`,{className:`px-8 py-6 bg-surface-container-low/80 backdrop-blur-md border-t border-outline-variant/10 flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] font-bold text-on-surface-variant/50 uppercase tracking-widest`,children:[(0,g.jsx)(m,{size:12,className:`text-secondary animate-pulse`}),r?`Initializing Network Node`:`Project creation unavailable`]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,g.jsx)(`button`,{onClick:t,className:`px-6 py-2 rounded-lg text-sm font-bold text-on-surface-variant hover:text-white transition-all hover:bg-surface-container-highest`,children:`Abort`}),(0,g.jsxs)(`button`,{onClick:async()=>{if(!S){_(`Validation Error`,`Project title is required`);return}if(!r){_(`Project Creation Blocked`,i??`Project creation is unavailable right now`);return}try{y(!0),await l.create({title:S,description:w||void 0,status:E,ownerAgentId:O||void 0}),await n?.(),t(),C(``),T(``),D(u.PLANNING),k(``)}catch{}finally{y(!1)}},disabled:v||!r,className:`px-10 py-2.5 rounded-lg bg-secondary text-surface text-sm font-black shadow-[0_8px_20px_rgba(78,222,163,0.2)] hover:scale-[1.02] active:scale-[0.98] transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed group relative overflow-hidden`,children:[(0,g.jsx)(`div`,{className:`absolute inset-0 bg-white/10 translate-x-[-100%] group-hover:translate-x-[100%] transition-transform duration-700 skew-x-12`}),v?`Initializing...`:`Create Project`]})]})]}),!r&&i&&(0,g.jsx)(`div`,{className:`px-8 pb-6 text-xs text-error`,children:i})]})]})}):null},v={login:async(e,t)=>{await i.post(`/auth/login`,{email:e,password:t})},register:async(e,t,n,r,a)=>(await i.post(`/auth/register`,{name:e,lastName:t,email:n,password:r,avatar:a})).data,me:async()=>(await i.get(`/auth/me`)).data,updateProfile:async e=>(await i.patch(`/auth/me`,e)).data,refresh:async()=>(await i.post(`/auth/refresh`,void 0,{skipAuthRefresh:!0})).data,logout:async()=>{await i.post(`/auth/logout`)}};export{_ as n,v as t};
@@ -1 +1 @@
1
- import{i as e}from"./client-BGOBXkO8.js";var t=e(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]);export{t};
1
+ import{i as e}from"./client-B553SX3l.js";var t=e(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]);export{t};
@@ -1 +1 @@
1
- import{i as e}from"./client-BGOBXkO8.js";var t=e(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]);export{t};
1
+ import{i as e}from"./client-B553SX3l.js";var t=e(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]);export{t};
@@ -1 +1 @@
1
- import{i as e}from"./client-BGOBXkO8.js";var t=e(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]);export{t};
1
+ import{i as e}from"./client-B553SX3l.js";var t=e(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]);export{t};
@@ -1 +1 @@
1
- import{i as e}from"./client-BGOBXkO8.js";var t=e(`briefcase`,[[`path`,{d:`M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16`,key:`jecpp`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]);export{t};
1
+ import{i as e}from"./client-B553SX3l.js";var t=e(`briefcase`,[[`path`,{d:`M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16`,key:`jecpp`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./client-B553SX3l.js";var t=e(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./client-B553SX3l.js";var t=e(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./client-B553SX3l.js";var t=e(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./client-B553SX3l.js";var t=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t};
@@ -1 +1 @@
1
- import{i as e}from"./client-BGOBXkO8.js";var t=e(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]);export{t};
1
+ import{i as e}from"./client-B553SX3l.js";var t=e(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./client-B553SX3l.js";var t=e(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]);export{t};
@@ -0,0 +1,9 @@
1
+ import{a as e,r as t}from"./rolldown-runtime-COnpUsM8.js";import{g as n}from"./vendor-dnd-CfaHPvi0.js";var r=e(n()),i=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),a=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),o=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),s=e=>{let t=o(e);return t.charAt(0).toUpperCase()+t.slice(1)},c={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},l=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},u=(0,r.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:o=``,children:s,iconNode:u,...d},f)=>(0,r.createElement)(`svg`,{ref:f,...c,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:i(`lucide`,o),...!s&&!l(d)&&{"aria-hidden":`true`},...d},[...u.map(([e,t])=>(0,r.createElement)(e,t)),...Array.isArray(s)?s:[s]])),d=(e,t)=>{let n=(0,r.forwardRef)(({className:n,...o},c)=>(0,r.createElement)(u,{ref:c,iconNode:t,className:i(`lucide-${a(s(e))}`,`lucide-${e}`,n),...o}));return n.displayName=s(e),n};function f(e,t){return function(){return e.apply(t,arguments)}}var{toString:p}=Object.prototype,{getPrototypeOf:m}=Object,{iterator:h,toStringTag:g}=Symbol,_=(e=>t=>{let n=p.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),v=e=>(e=e.toLowerCase(),t=>_(t)===e),y=e=>t=>typeof t===e,{isArray:b}=Array,x=y(`undefined`);function S(e){return e!==null&&!x(e)&&e.constructor!==null&&!x(e.constructor)&&T(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var C=v(`ArrayBuffer`);function w(e){let t;return t=typeof ArrayBuffer<`u`&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&C(e.buffer),t}var ee=y(`string`),T=y(`function`),E=y(`number`),D=e=>typeof e==`object`&&!!e,O=e=>e===!0||e===!1,k=e=>{if(_(e)!==`object`)return!1;let t=m(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(g in e)&&!(h in e)},A=e=>{if(!D(e)||S(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},te=v(`Date`),ne=v(`File`),re=e=>!!(e&&e.uri!==void 0),ie=e=>e&&e.getParts!==void 0,ae=v(`Blob`),oe=v(`FileList`),se=e=>D(e)&&T(e.pipe);function ce(){return typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{}}var le=ce(),ue=le.FormData===void 0?void 0:le.FormData,de=e=>{if(!e)return!1;if(ue&&e instanceof ue)return!0;let t=m(e);if(!t||t===Object.prototype||!T(e.append))return!1;let n=_(e);return n===`formdata`||n===`object`&&T(e.toString)&&e.toString()===`[object FormData]`},fe=v(`URLSearchParams`),[pe,me,he,ge]=[`ReadableStream`,`Request`,`Response`,`Headers`].map(v),_e=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,``);function j(e,t,{allOwnKeys:n=!1}={}){if(e==null)return;let r,i;if(typeof e!=`object`&&(e=[e]),b(e))for(r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else{if(S(e))return;let i=n?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length,o;for(r=0;r<a;r++)o=i[r],t.call(null,e[o],o,e)}}function ve(e,t){if(S(e))return null;t=t.toLowerCase();let n=Object.keys(e),r=n.length,i;for(;r-- >0;)if(i=n[r],t===i.toLowerCase())return i;return null}var M=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:global,ye=e=>!x(e)&&e!==M;function be(...e){let{caseless:t,skipUndefined:n}=ye(this)&&this||{},r={},i=(e,i)=>{if(i===`__proto__`||i===`constructor`||i===`prototype`)return;let a=t&&ve(r,i)||i,o=Me(r,a)?r[a]:void 0;k(o)&&k(e)?r[a]=be(o,e):k(e)?r[a]=be({},e):b(e)?r[a]=e.slice():(!n||!x(e))&&(r[a]=e)};for(let t=0,n=e.length;t<n;t++)e[t]&&j(e[t],i);return r}var xe=(e,t,n,{allOwnKeys:r}={})=>(j(t,(t,r)=>{n&&T(t)?Object.defineProperty(e,r,{__proto__:null,value:f(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),Se=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Ce=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,`constructor`,{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,`super`,{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},we=(e,t,n,r)=>{let i,a,o,s={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],(!r||r(o,e,t))&&!s[o]&&(t[o]=e[o],s[o]=!0);e=n!==!1&&m(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Te=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;let r=e.indexOf(t,n);return r!==-1&&r===n},Ee=e=>{if(!e)return null;if(b(e))return e;let t=e.length;if(!E(t))return null;let n=Array(t);for(;t-- >0;)n[t]=e[t];return n},De=(e=>t=>e&&t instanceof e)(typeof Uint8Array<`u`&&m(Uint8Array)),Oe=(e,t)=>{let n=(e&&e[h]).call(e),r;for(;(r=n.next())&&!r.done;){let n=r.value;t.call(e,n[0],n[1])}},ke=(e,t)=>{let n,r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Ae=v(`HTMLFormElement`),je=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),Me=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Ne=v(`RegExp`),Pe=(e,t)=>{let n=Object.getOwnPropertyDescriptors(e),r={};j(n,(n,i)=>{let a;(a=t(n,i,e))!==!1&&(r[i]=a||n)}),Object.defineProperties(e,r)},Fe=e=>{Pe(e,(t,n)=>{if(T(e)&&[`arguments`,`caller`,`callee`].includes(n))return!1;let r=e[n];if(T(r)){if(t.enumerable=!1,`writable`in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error(`Can not rewrite read-only method '`+n+`'`)})}})},Ie=(e,t)=>{let n={},r=e=>{e.forEach(e=>{n[e]=!0})};return b(e)?r(e):r(String(e).split(t)),n},Le=()=>{},Re=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function ze(e){return!!(e&&T(e.append)&&e[g]===`FormData`&&e[h])}var Be=e=>{let t=new WeakSet,n=e=>{if(D(e)){if(t.has(e))return;if(S(e))return e;if(!(`toJSON`in e)){t.add(e);let r=b(e)?[]:{};return j(e,(e,t)=>{let i=n(e);!x(i)&&(r[t]=i)}),t.delete(e),r}}return e};return n(e)},Ve=v(`AsyncFunction`),He=e=>e&&(D(e)||T(e))&&T(e.then)&&T(e.catch),Ue=((e,t)=>e?setImmediate:t?((e,t)=>(M.addEventListener(`message`,({source:n,data:r})=>{n===M&&r===e&&t.length&&t.shift()()},!1),n=>{t.push(n),M.postMessage(e,`*`)}))(`axios@${Math.random()}`,[]):e=>setTimeout(e))(typeof setImmediate==`function`,T(M.postMessage)),N={isArray:b,isArrayBuffer:C,isBuffer:S,isFormData:de,isArrayBufferView:w,isString:ee,isNumber:E,isBoolean:O,isObject:D,isPlainObject:k,isEmptyObject:A,isReadableStream:pe,isRequest:me,isResponse:he,isHeaders:ge,isUndefined:x,isDate:te,isFile:ne,isReactNativeBlob:re,isReactNative:ie,isBlob:ae,isRegExp:Ne,isFunction:T,isStream:se,isURLSearchParams:fe,isTypedArray:De,isFileList:oe,forEach:j,merge:be,extend:xe,trim:_e,stripBOM:Se,inherits:Ce,toFlatObject:we,kindOf:_,kindOfTest:v,endsWith:Te,toArray:Ee,forEachEntry:Oe,matchAll:ke,isHTMLForm:Ae,hasOwnProperty:Me,hasOwnProp:Me,reduceDescriptors:Pe,freezeMethods:Fe,toObjectSet:Ie,toCamelCase:je,noop:Le,toFiniteNumber:Re,findKey:ve,global:M,isContextDefined:ye,isSpecCompliantForm:ze,toJSONObject:Be,isAsyncFn:Ve,isThenable:He,setImmediate:Ue,asap:typeof queueMicrotask<`u`?queueMicrotask.bind(M):typeof process<`u`&&process.nextTick||Ue,isIterable:e=>e!=null&&T(e[h])},We=N.toObjectSet([`age`,`authorization`,`content-length`,`content-type`,`etag`,`expires`,`from`,`host`,`if-modified-since`,`if-unmodified-since`,`last-modified`,`location`,`max-forwards`,`proxy-authorization`,`referer`,`retry-after`,`user-agent`]),Ge=e=>{let t={},n,r,i;return e&&e.split(`
2
+ `).forEach(function(e){i=e.indexOf(`:`),n=e.substring(0,i).trim().toLowerCase(),r=e.substring(i+1).trim(),!(!n||t[n]&&We[n])&&(n===`set-cookie`?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+`, `+r:r)}),t};function Ke(e){let t=0,n=e.length;for(;t<n;){let n=e.charCodeAt(t);if(n!==9&&n!==32)break;t+=1}for(;n>t;){let t=e.charCodeAt(n-1);if(t!==9&&t!==32)break;--n}return t===0&&n===e.length?e:e.slice(t,n)}var qe=RegExp(`[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+`,`g`),Je=RegExp(`[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+`,`g`);function Ye(e,t){return N.isArray(e)?e.map(e=>Ye(e,t)):Ke(String(e).replace(t,``))}var Xe=e=>Ye(e,qe),Ze=e=>Ye(e,Je);function Qe(e){let t=Object.create(null);return N.forEach(e.toJSON(),(e,n)=>{t[n]=Ze(e)}),t}var $e=Symbol(`internals`);function P(e){return e&&String(e).trim().toLowerCase()}function F(e){return e===!1||e==null?e:N.isArray(e)?e.map(F):Xe(String(e))}function et(e){let t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}var tt=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function I(e,t,n,r,i){if(N.isFunction(r))return r.call(this,t,n);if(i&&(t=n),N.isString(t)){if(N.isString(r))return t.indexOf(r)!==-1;if(N.isRegExp(r))return r.test(t)}}function nt(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function rt(e,t){let n=N.toCamelCase(` `+t);[`get`,`set`,`has`].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(e,n,i){return this[r].call(this,t,e,n,i)},configurable:!0})})}var L=class{constructor(e){e&&this.set(e)}set(e,t,n){let r=this;function i(e,t,n){let i=P(t);if(!i)throw Error(`header name must be a non-empty string`);let a=N.findKey(r,i);(!a||r[a]===void 0||n===!0||n===void 0&&r[a]!==!1)&&(r[a||t]=F(e))}let a=(e,t)=>N.forEach(e,(e,n)=>i(e,n,t));if(N.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(N.isString(e)&&(e=e.trim())&&!tt(e))a(Ge(e),t);else if(N.isObject(e)&&N.isIterable(e)){let n={},r,i;for(let t of e){if(!N.isArray(t))throw TypeError(`Object iterator must return a key-value pair`);n[i=t[0]]=(r=n[i])?N.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}a(n,t)}else e!=null&&i(t,e,n);return this}get(e,t){if(e=P(e),e){let n=N.findKey(this,e);if(n){let e=this[n];if(!t)return e;if(t===!0)return et(e);if(N.isFunction(t))return t.call(this,e,n);if(N.isRegExp(t))return t.exec(e);throw TypeError(`parser must be boolean|regexp|function`)}}}has(e,t){if(e=P(e),e){let n=N.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||I(this,this[n],n,t)))}return!1}delete(e,t){let n=this,r=!1;function i(e){if(e=P(e),e){let i=N.findKey(n,e);i&&(!t||I(n,n[i],i,t))&&(delete n[i],r=!0)}}return N.isArray(e)?e.forEach(i):i(e),r}clear(e){let t=Object.keys(this),n=t.length,r=!1;for(;n--;){let i=t[n];(!e||I(this,this[i],i,e,!0))&&(delete this[i],r=!0)}return r}normalize(e){let t=this,n={};return N.forEach(this,(r,i)=>{let a=N.findKey(n,i);if(a){t[a]=F(r),delete t[i];return}let o=e?nt(i):String(i).trim();o!==i&&delete t[i],t[o]=F(r),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return N.forEach(this,(n,r)=>{n!=null&&n!==!1&&(t[r]=e&&N.isArray(n)?n.join(`, `):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+`: `+t).join(`
3
+ `)}getSetCookie(){return this.get(`set-cookie`)||[]}get[Symbol.toStringTag](){return`AxiosHeaders`}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){let t=(this[$e]=this[$e]={accessors:{}}).accessors,n=this.prototype;function r(e){let r=P(e);t[r]||(rt(n,e),t[r]=!0)}return N.isArray(e)?e.forEach(r):r(e),this}};L.accessor([`Content-Type`,`Content-Length`,`Accept`,`Accept-Encoding`,`User-Agent`,`Authorization`]),N.reduceDescriptors(L.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),N.freezeMethods(L);var it=`[REDACTED ****]`;function at(e){if(N.hasOwnProp(e,`toJSON`))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(N.hasOwnProp(t,`toJSON`))return!0;t=Object.getPrototypeOf(t)}return!1}function ot(e,t){let n=new Set(t.map(e=>String(e).toLowerCase())),r=[],i=e=>{if(typeof e!=`object`||!e||N.isBuffer(e))return e;if(r.indexOf(e)!==-1)return;e instanceof L&&(e=e.toJSON()),r.push(e);let t;if(N.isArray(e))t=[],e.forEach((e,n)=>{let r=i(e);N.isUndefined(r)||(t[n]=r)});else{if(!N.isPlainObject(e)&&at(e))return r.pop(),e;t=Object.create(null);for(let[r,a]of Object.entries(e)){let e=n.has(r.toLowerCase())?it:i(a);N.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return i(e)}var R=class e extends Error{static from(t,n,r,i,a,o){let s=new e(t.message,n||t.code,r,i,a);return s.cause=t,s.name=t.name,t.status!=null&&s.status==null&&(s.status=t.status),o&&Object.assign(s,o),s}constructor(e,t,n,r,i){super(e),Object.defineProperty(this,`message`,{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name=`AxiosError`,this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status)}toJSON(){let e=this.config,t=e&&N.hasOwnProp(e,`redact`)?e.redact:void 0,n=N.isArray(t)&&t.length>0?ot(e,t):N.toJSONObject(e);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}};R.ERR_BAD_OPTION_VALUE=`ERR_BAD_OPTION_VALUE`,R.ERR_BAD_OPTION=`ERR_BAD_OPTION`,R.ECONNABORTED=`ECONNABORTED`,R.ETIMEDOUT=`ETIMEDOUT`,R.ECONNREFUSED=`ECONNREFUSED`,R.ERR_NETWORK=`ERR_NETWORK`,R.ERR_FR_TOO_MANY_REDIRECTS=`ERR_FR_TOO_MANY_REDIRECTS`,R.ERR_DEPRECATED=`ERR_DEPRECATED`,R.ERR_BAD_RESPONSE=`ERR_BAD_RESPONSE`,R.ERR_BAD_REQUEST=`ERR_BAD_REQUEST`,R.ERR_CANCELED=`ERR_CANCELED`,R.ERR_NOT_SUPPORT=`ERR_NOT_SUPPORT`,R.ERR_INVALID_URL=`ERR_INVALID_URL`,R.ERR_FORM_DATA_DEPTH_EXCEEDED=`ERR_FORM_DATA_DEPTH_EXCEEDED`;function st(e){return N.isPlainObject(e)||N.isArray(e)}function ct(e){return N.endsWith(e,`[]`)?e.slice(0,-2):e}function lt(e,t,n){return e?e.concat(t).map(function(e,t){return e=ct(e),!n&&t?`[`+e+`]`:e}).join(n?`.`:``):t}function ut(e){return N.isArray(e)&&!e.some(st)}var dt=N.toFlatObject(N,{},null,function(e){return/^is[A-Z]/.test(e)});function z(e,t,n){if(!N.isObject(e))throw TypeError(`target must be an object`);t=t||new FormData,n=N.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!N.isUndefined(t[e])});let r=n.metaTokens,i=n.visitor||d,a=n.dots,o=n.indexes,s=n.Blob||typeof Blob<`u`&&Blob,c=n.maxDepth===void 0?100:n.maxDepth,l=s&&N.isSpecCompliantForm(t);if(!N.isFunction(i))throw TypeError(`visitor must be a function`);function u(e){if(e===null)return``;if(N.isDate(e))return e.toISOString();if(N.isBoolean(e))return e.toString();if(!l&&N.isBlob(e))throw new R(`Blob is not supported. Use a Buffer instead.`);return N.isArrayBuffer(e)||N.isTypedArray(e)?l&&typeof Blob==`function`?new Blob([e]):Buffer.from(e):e}function d(e,n,i){let s=e;if(N.isReactNative(t)&&N.isReactNativeBlob(e))return t.append(lt(i,n,a),u(e)),!1;if(e&&!i&&typeof e==`object`){if(N.endsWith(n,`{}`))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(N.isArray(e)&&ut(e)||(N.isFileList(e)||N.endsWith(n,`[]`))&&(s=N.toArray(e)))return n=ct(n),s.forEach(function(e,r){!(N.isUndefined(e)||e===null)&&t.append(o===!0?lt([n],r,a):o===null?n:n+`[]`,u(e))}),!1}return st(e)?!0:(t.append(lt(i,n,a),u(e)),!1)}let f=[],p=Object.assign(dt,{defaultVisitor:d,convertValue:u,isVisitable:st});function m(e,n,r=0){if(!N.isUndefined(e)){if(r>c)throw new R(`Object is too deeply nested (`+r+` levels). Max depth: `+c,R.ERR_FORM_DATA_DEPTH_EXCEEDED);if(f.indexOf(e)!==-1)throw Error(`Circular reference detected in `+n.join(`.`));f.push(e),N.forEach(e,function(e,a){(!(N.isUndefined(e)||e===null)&&i.call(t,e,N.isString(a)?a.trim():a,n,p))===!0&&m(e,n?n.concat(a):[a],r+1)}),f.pop()}}if(!N.isObject(e))throw TypeError(`data must be an object`);return m(e),t}function ft(e){let t={"!":`%21`,"'":`%27`,"(":`%28`,")":`%29`,"~":`%7E`,"%20":`+`};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function pt(e,t){this._pairs=[],e&&z(e,this,t)}var mt=pt.prototype;mt.append=function(e,t){this._pairs.push([e,t])},mt.toString=function(e){let t=e?function(t){return e.call(this,t,ft)}:ft;return this._pairs.map(function(e){return t(e[0])+`=`+t(e[1])},``).join(`&`)};function ht(e){return encodeURIComponent(e).replace(/%3A/gi,`:`).replace(/%24/g,`$`).replace(/%2C/gi,`,`).replace(/%20/g,`+`)}function gt(e,t,n){if(!t)return e;let r=n&&n.encode||ht,i=N.isFunction(n)?{serialize:n}:n,a=i&&i.serialize,o;if(o=a?a(t,i):N.isURLSearchParams(t)?t.toString():new pt(t,i).toString(r),o){let t=e.indexOf(`#`);t!==-1&&(e=e.slice(0,t)),e+=(e.indexOf(`?`)===-1?`?`:`&`)+o}return e}var _t=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){N.forEach(this.handlers,function(t){t!==null&&e(t)})}},vt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},yt={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<`u`?URLSearchParams:pt,FormData:typeof FormData<`u`?FormData:null,Blob:typeof Blob<`u`?Blob:null},protocols:[`http`,`https`,`file`,`blob`,`url`,`data`]},bt=t({hasBrowserEnv:()=>xt,hasStandardBrowserEnv:()=>Ct,hasStandardBrowserWebWorkerEnv:()=>wt,navigator:()=>St,origin:()=>Tt}),xt=typeof window<`u`&&typeof document<`u`,St=typeof navigator==`object`&&navigator||void 0,Ct=xt&&(!St||[`ReactNative`,`NativeScript`,`NS`].indexOf(St.product)<0),wt=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope&&typeof self.importScripts==`function`,Tt=xt&&window.location.href||`http://localhost`,B={...bt,...yt};function Et(e,t){return z(e,new B.classes.URLSearchParams,{visitor:function(e,t,n,r){return B.isNode&&N.isBuffer(e)?(this.append(t,e.toString(`base64`)),!1):r.defaultVisitor.apply(this,arguments)},...t})}function Dt(e){return N.matchAll(/\w+|\[(\w*)]/g,e).map(e=>e[0]===`[]`?``:e[1]||e[0])}function Ot(e){let t={},n=Object.keys(e),r,i=n.length,a;for(r=0;r<i;r++)a=n[r],t[a]=e[a];return t}function kt(e){function t(e,n,r,i){let a=e[i++];if(a===`__proto__`)return!0;let o=Number.isFinite(+a),s=i>=e.length;return a=!a&&N.isArray(r)?r.length:a,s?(N.hasOwnProp(r,a)?r[a]=N.isArray(r[a])?r[a].concat(n):[r[a],n]:r[a]=n,!o):((!N.hasOwnProp(r,a)||!N.isObject(r[a]))&&(r[a]=[]),t(e,n,r[a],i)&&N.isArray(r[a])&&(r[a]=Ot(r[a])),!o)}if(N.isFormData(e)&&N.isFunction(e.entries)){let n={};return N.forEachEntry(e,(e,r)=>{t(Dt(e),r,n,0)}),n}return null}var V=(e,t)=>e!=null&&N.hasOwnProp(e,t)?e[t]:void 0;function At(e,t,n){if(N.isString(e))try{return(t||JSON.parse)(e),N.trim(e)}catch(e){if(e.name!==`SyntaxError`)throw e}return(n||JSON.stringify)(e)}var H={transitional:vt,adapter:[`xhr`,`http`,`fetch`],transformRequest:[function(e,t){let n=t.getContentType()||``,r=n.indexOf(`application/json`)>-1,i=N.isObject(e);if(i&&N.isHTMLForm(e)&&(e=new FormData(e)),N.isFormData(e))return r?JSON.stringify(kt(e)):e;if(N.isArrayBuffer(e)||N.isBuffer(e)||N.isStream(e)||N.isFile(e)||N.isBlob(e)||N.isReadableStream(e))return e;if(N.isArrayBufferView(e))return e.buffer;if(N.isURLSearchParams(e))return t.setContentType(`application/x-www-form-urlencoded;charset=utf-8`,!1),e.toString();let a;if(i){let t=V(this,`formSerializer`);if(n.indexOf(`application/x-www-form-urlencoded`)>-1)return Et(e,t).toString();if((a=N.isFileList(e))||n.indexOf(`multipart/form-data`)>-1){let n=V(this,`env`),r=n&&n.FormData;return z(a?{"files[]":e}:e,r&&new r,t)}}return i||r?(t.setContentType(`application/json`,!1),At(e)):e}],transformResponse:[function(e){let t=V(this,`transitional`)||H.transitional,n=t&&t.forcedJSONParsing,r=V(this,`responseType`),i=r===`json`;if(N.isResponse(e)||N.isReadableStream(e))return e;if(e&&N.isString(e)&&(n&&!r||i)){let n=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,V(this,`parseReviver`))}catch(e){if(n)throw e.name===`SyntaxError`?R.from(e,R.ERR_BAD_RESPONSE,this,null,V(this,`response`)):e}}return e}],timeout:0,xsrfCookieName:`XSRF-TOKEN`,xsrfHeaderName:`X-XSRF-TOKEN`,maxContentLength:-1,maxBodyLength:-1,env:{FormData:B.classes.FormData,Blob:B.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:`application/json, text/plain, */*`,"Content-Type":void 0}}};N.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`query`],e=>{H.headers[e]={}});function jt(e,t){let n=this||H,r=t||n,i=L.from(r.headers),a=r.data;return N.forEach(e,function(e){a=e.call(n,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function Mt(e){return!!(e&&e.__CANCEL__)}var U=class extends R{constructor(e,t,n){super(e??`canceled`,R.ERR_CANCELED,t,n),this.name=`CanceledError`,this.__CANCEL__=!0}};function Nt(e,t,n){let r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new R(`Request failed with status code `+n.status,n.status>=400&&n.status<500?R.ERR_BAD_REQUEST:R.ERR_BAD_RESPONSE,n.config,n.request,n))}function Pt(e){let t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||``}function Ft(e,t){e=e||10;let n=Array(e),r=Array(e),i=0,a=0,o;return t=t===void 0?1e3:t,function(s){let c=Date.now(),l=r[a];o||(o=c),n[i]=s,r[i]=c;let u=a,d=0;for(;u!==i;)d+=n[u++],u%=e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),c-o<t)return;let f=l&&c-l;return f?Math.round(d*1e3/f):void 0}}function It(e,t){let n=0,r=1e3/t,i,a,o=(t,r=Date.now())=>{n=r,i=null,a&&(clearTimeout(a),a=null),e(...t)};return[(...e)=>{let t=Date.now(),s=t-n;s>=r?o(e,t):(i=e,a||(a=setTimeout(()=>{a=null,o(i)},r-s)))},()=>i&&o(i)]}var W=(e,t,n=3)=>{let r=0,i=Ft(50,250);return It(n=>{if(!n||typeof n.loaded!=`number`)return;let a=n.loaded,o=n.lengthComputable?n.total:void 0,s=o==null?a:Math.min(a,o),c=Math.max(0,s-r),l=i(c);r=Math.max(r,s),e({loaded:s,total:o,progress:o?s/o:void 0,bytes:c,rate:l||void 0,estimated:l&&o?(o-s)/l:void 0,event:n,lengthComputable:o!=null,[t?`download`:`upload`]:!0})},n)},Lt=(e,t)=>{let n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Rt=e=>(...t)=>N.asap(()=>e(...t)),zt=B.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,B.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(B.origin),B.navigator&&/(msie|trident)/i.test(B.navigator.userAgent)):()=>!0,Bt=B.hasStandardBrowserEnv?{write(e,t,n,r,i,a,o){if(typeof document>`u`)return;let s=[`${e}=${encodeURIComponent(t)}`];N.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),N.isString(r)&&s.push(`path=${r}`),N.isString(i)&&s.push(`domain=${i}`),a===!0&&s.push(`secure`),N.isString(o)&&s.push(`SameSite=${o}`),document.cookie=s.join(`; `)},read(e){if(typeof document>`u`)return null;let t=document.cookie.split(`;`);for(let n=0;n<t.length;n++){let r=t[n].replace(/^\s+/,``),i=r.indexOf(`=`);if(i!==-1&&r.slice(0,i)===e)return decodeURIComponent(r.slice(i+1))}return null},remove(e){this.write(e,``,Date.now()-864e5,`/`)}}:{write(){},read(){return null},remove(){}};function Vt(e){return typeof e==`string`?/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e):!1}function Ht(e,t){return t?e.replace(/\/?\/$/,``)+`/`+t.replace(/^\/+/,``):e}function Ut(e,t,n){let r=!Vt(t);return e&&(r||n===!1)?Ht(e,t):t}var Wt=e=>e instanceof L?{...e}:e;function G(e,t){t=t||{};let n=Object.create(null);Object.defineProperty(n,`hasOwnProperty`,{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(e,t,n,r){return N.isPlainObject(e)&&N.isPlainObject(t)?N.merge.call({caseless:r},e,t):N.isPlainObject(t)?N.merge({},t):N.isArray(t)?t.slice():t}function i(e,t,n,i){if(!N.isUndefined(t))return r(e,t,n,i);if(!N.isUndefined(e))return r(void 0,e,n,i)}function a(e,t){if(!N.isUndefined(t))return r(void 0,t)}function o(e,t){if(!N.isUndefined(t))return r(void 0,t);if(!N.isUndefined(e))return r(void 0,e)}function s(n,i,a){if(N.hasOwnProp(t,a))return r(n,i);if(N.hasOwnProp(e,a))return r(void 0,n)}let c={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:s,headers:(e,t,n)=>i(Wt(e),Wt(t),n,!0)};return N.forEach(Object.keys({...e,...t}),function(r){if(r===`__proto__`||r===`constructor`||r===`prototype`)return;let a=N.hasOwnProp(c,r)?c[r]:i,o=a(N.hasOwnProp(e,r)?e[r]:void 0,N.hasOwnProp(t,r)?t[r]:void 0,r);N.isUndefined(o)&&a!==s||(n[r]=o)}),n}var Gt=[`content-type`,`content-length`];function Kt(e,t,n){if(n!==`content-only`){e.set(t);return}Object.entries(t).forEach(([t,n])=>{Gt.includes(t.toLowerCase())&&e.set(t,n)})}var qt=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))),Jt=e=>{let t=G({},e),n=e=>N.hasOwnProp(t,e)?t[e]:void 0,r=n(`data`),i=n(`withXSRFToken`),a=n(`xsrfHeaderName`),o=n(`xsrfCookieName`),s=n(`headers`),c=n(`auth`),l=n(`baseURL`),u=n(`allowAbsoluteUrls`),d=n(`url`);if(t.headers=s=L.from(s),t.url=gt(Ut(l,d,u),e.params,e.paramsSerializer),c&&s.set(`Authorization`,`Basic `+btoa((c.username||``)+`:`+(c.password?qt(c.password):``))),N.isFormData(r)&&(B.hasStandardBrowserEnv||B.hasStandardBrowserWebWorkerEnv?s.setContentType(void 0):N.isFunction(r.getHeaders)&&Kt(s,r.getHeaders(),n(`formDataHeaderPolicy`))),B.hasStandardBrowserEnv&&(N.isFunction(i)&&(i=i(t)),i===!0||i==null&&zt(t.url))){let e=a&&o&&Bt.read(o);e&&s.set(a,e)}return t},Yt=typeof XMLHttpRequest<`u`&&function(e){return new Promise(function(t,n){let r=Jt(e),i=r.data,a=L.from(r.headers).normalize(),{responseType:o,onUploadProgress:s,onDownloadProgress:c}=r,l,u,d,f,p;function m(){f&&f(),p&&p(),r.cancelToken&&r.cancelToken.unsubscribe(l),r.signal&&r.signal.removeEventListener(`abort`,l)}let h=new XMLHttpRequest;h.open(r.method.toUpperCase(),r.url,!0),h.timeout=r.timeout;function g(){if(!h)return;let r=L.from(`getAllResponseHeaders`in h&&h.getAllResponseHeaders());Nt(function(e){t(e),m()},function(e){n(e),m()},{data:!o||o===`text`||o===`json`?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:r,config:e,request:h}),h=null}`onloadend`in h?h.onloadend=g:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.startsWith(`file:`))||setTimeout(g)},h.onabort=function(){h&&(n(new R(`Request aborted`,R.ECONNABORTED,e,h)),m(),h=null)},h.onerror=function(t){let r=new R(t&&t.message?t.message:`Network Error`,R.ERR_NETWORK,e,h);r.event=t||null,n(r),m(),h=null},h.ontimeout=function(){let t=r.timeout?`timeout of `+r.timeout+`ms exceeded`:`timeout exceeded`,i=r.transitional||vt;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new R(t,i.clarifyTimeoutError?R.ETIMEDOUT:R.ECONNABORTED,e,h)),m(),h=null},i===void 0&&a.setContentType(null),`setRequestHeader`in h&&N.forEach(Qe(a),function(e,t){h.setRequestHeader(t,e)}),N.isUndefined(r.withCredentials)||(h.withCredentials=!!r.withCredentials),o&&o!==`json`&&(h.responseType=r.responseType),c&&([d,p]=W(c,!0),h.addEventListener(`progress`,d)),s&&h.upload&&([u,f]=W(s),h.upload.addEventListener(`progress`,u),h.upload.addEventListener(`loadend`,f)),(r.cancelToken||r.signal)&&(l=t=>{h&&(n(!t||t.type?new U(null,e,h):t),h.abort(),m(),h=null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener(`abort`,l)));let _=Pt(r.url);if(_&&!B.protocols.includes(_)){n(new R(`Unsupported protocol `+_+`:`,R.ERR_BAD_REQUEST,e));return}h.send(i||null)})},Xt=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;let n=new AbortController,r=!1,i=function(e){if(!r){r=!0,o();let t=e instanceof Error?e:this.reason;n.abort(t instanceof R?t:new U(t instanceof Error?t.message:t))}},a=t&&setTimeout(()=>{a=null,i(new R(`timeout of ${t}ms exceeded`,R.ETIMEDOUT))},t),o=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener(`abort`,i)}),e=null)};e.forEach(e=>e.addEventListener(`abort`,i));let{signal:s}=n;return s.unsubscribe=()=>N.asap(o),s},Zt=function*(e,t){let n=e.byteLength;if(!t||n<t){yield e;return}let r=0,i;for(;r<n;)i=r+t,yield e.slice(r,i),r=i},Qt=async function*(e,t){for await(let n of $t(e))yield*Zt(n,t)},$t=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},en=(e,t,n,r)=>{let i=Qt(e,t),a=0,o,s=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{let{done:t,value:r}=await i.next();if(t){s(),e.close();return}let o=r.byteLength;n&&n(a+=o),e.enqueue(new Uint8Array(r))}catch(e){throw s(e),e}},cancel(e){return s(e),i.return()}},{highWaterMark:2})};function tn(e){if(!e||typeof e!=`string`||!e.startsWith(`data:`))return 0;let t=e.indexOf(`,`);if(t<0)return 0;let n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let e=r.length,t=r.length;for(let n=0;n<t;n++)if(r.charCodeAt(n)===37&&n+2<t){let t=r.charCodeAt(n+1),i=r.charCodeAt(n+2);(t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)&&(i>=48&&i<=57||i>=65&&i<=70||i>=97&&i<=102)&&(e-=2,n+=2)}let n=0,i=t-1,a=e=>e>=2&&r.charCodeAt(e-2)===37&&r.charCodeAt(e-1)===51&&(r.charCodeAt(e)===68||r.charCodeAt(e)===100);i>=0&&(r.charCodeAt(i)===61?(n++,i--):a(i)&&(n++,i-=3)),n===1&&i>=0&&(r.charCodeAt(i)===61||a(i))&&n++;let o=Math.floor(e/4)*3-(n||0);return o>0?o:0}if(typeof Buffer<`u`&&typeof Buffer.byteLength==`function`)return Buffer.byteLength(r,`utf8`);let i=0;for(let e=0,t=r.length;e<t;e++){let n=r.charCodeAt(e);if(n<128)i+=1;else if(n<2048)i+=2;else if(n>=55296&&n<=56319&&e+1<t){let t=r.charCodeAt(e+1);t>=56320&&t<=57343?(i+=4,e++):i+=3}else i+=3}return i}var nn=`1.16.1`,rn=64*1024,{isFunction:K}=N,an=(e,...t)=>{try{return!!e(...t)}catch{return!1}},on=e=>{let t=N.global!==void 0&&N.global!==null?N.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=N.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);let{fetch:i,Request:a,Response:o}=e,s=i?K(i):typeof fetch==`function`,c=K(a),l=K(o);if(!s)return!1;let u=s&&K(n),d=s&&(typeof r==`function`?(e=>t=>e.encode(t))(new r):async e=>new Uint8Array(await new a(e).arrayBuffer())),f=c&&u&&an(()=>{let e=!1,t=new a(B.origin,{body:new n,method:`POST`,get duplex(){return e=!0,`half`}}),r=t.headers.has(`Content-Type`);return t.body!=null&&t.body.cancel(),e&&!r}),p=l&&u&&an(()=>N.isReadableStream(new o(``).body)),m={stream:p&&(e=>e.body)};s&&[`text`,`arrayBuffer`,`blob`,`formData`,`stream`].forEach(e=>{!m[e]&&(m[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new R(`Response type '${e}' is not supported`,R.ERR_NOT_SUPPORT,n)})});let h=async e=>{if(e==null)return 0;if(N.isBlob(e))return e.size;if(N.isSpecCompliantForm(e))return(await new a(B.origin,{method:`POST`,body:e}).arrayBuffer()).byteLength;if(N.isArrayBufferView(e)||N.isArrayBuffer(e))return e.byteLength;if(N.isURLSearchParams(e)&&(e+=``),N.isString(e))return(await d(e)).byteLength},g=async(e,t)=>N.toFiniteNumber(e.getContentLength())??h(t);return async e=>{let{url:t,method:n,data:s,signal:l,cancelToken:u,timeout:d,onDownloadProgress:h,onUploadProgress:_,responseType:v,headers:y,withCredentials:b=`same-origin`,fetchOptions:x,maxContentLength:S,maxBodyLength:C}=Jt(e),w=N.isNumber(S)&&S>-1,ee=N.isNumber(C)&&C>-1,T=i||fetch;v=v?(v+``).toLowerCase():`text`;let E=Xt([l,u&&u.toAbortSignal()],d),D=null,O=E&&E.unsubscribe&&(()=>{E.unsubscribe()}),k;try{if(w&&typeof t==`string`&&t.startsWith(`data:`)&&tn(t)>S)throw new R(`maxContentLength size of `+S+` exceeded`,R.ERR_BAD_RESPONSE,e,D);if(ee&&n!==`get`&&n!==`head`){let t=await g(y,s);if(typeof t==`number`&&isFinite(t)&&t>C)throw new R(`Request body larger than maxBodyLength limit`,R.ERR_BAD_REQUEST,e,D)}if(_&&f&&n!==`get`&&n!==`head`&&(k=await g(y,s))!==0){let e=new a(t,{method:`POST`,body:s,duplex:`half`}),n;if(N.isFormData(s)&&(n=e.headers.get(`content-type`))&&y.setContentType(n),e.body){let[t,n]=Lt(k,W(Rt(_)));s=en(e.body,rn,t,n)}}N.isString(b)||(b=b?`include`:`omit`);let i=c&&`credentials`in a.prototype;if(N.isFormData(s)){let e=y.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&y.delete(`content-type`)}y.set(`User-Agent`,`axios/`+nn,!1);let l={...x,signal:E,method:n.toUpperCase(),headers:Qe(y.normalize()),body:s,duplex:`half`,credentials:i?b:void 0};D=c&&new a(t,l);let u=await(c?T(D,x):T(t,l));if(w){let t=N.toFiniteNumber(u.headers.get(`content-length`));if(t!=null&&t>S)throw new R(`maxContentLength size of `+S+` exceeded`,R.ERR_BAD_RESPONSE,e,D)}let d=p&&(v===`stream`||v===`response`);if(p&&u.body&&(h||w||d&&O)){let t={};[`status`,`statusText`,`headers`].forEach(e=>{t[e]=u[e]});let n=N.toFiniteNumber(u.headers.get(`content-length`)),[r,i]=h&&Lt(n,W(Rt(h),!0))||[],a=0;u=new o(en(u.body,rn,t=>{if(w&&(a=t,a>S))throw new R(`maxContentLength size of `+S+` exceeded`,R.ERR_BAD_RESPONSE,e,D);r&&r(t)},()=>{i&&i(),O&&O()}),t)}v=v||`text`;let A=await m[N.findKey(m,v)||`text`](u,e);if(w&&!p&&!d){let t;if(A!=null&&(typeof A.byteLength==`number`?t=A.byteLength:typeof A.size==`number`?t=A.size:typeof A==`string`&&(t=typeof r==`function`?new r().encode(A).byteLength:A.length)),typeof t==`number`&&t>S)throw new R(`maxContentLength size of `+S+` exceeded`,R.ERR_BAD_RESPONSE,e,D)}return!d&&O&&O(),await new Promise((t,n)=>{Nt(t,n,{data:A,headers:L.from(u.headers),status:u.status,statusText:u.statusText,config:e,request:D})})}catch(t){if(O&&O(),E&&E.aborted&&E.reason instanceof R){let n=E.reason;throw n.config=e,D&&(n.request=D),t!==n&&(n.cause=t),n}throw t&&t.name===`TypeError`&&/Load failed|fetch/i.test(t.message)?Object.assign(new R(`Network Error`,R.ERR_NETWORK,e,D,t&&t.response),{cause:t.cause||t}):R.from(t,t&&t.code,e,D,t&&t.response)}}},sn=new Map,cn=e=>{let t=e&&e.env||{},{fetch:n,Request:r,Response:i}=t,a=[r,i,n],o=a.length,s,c,l=sn;for(;o--;)s=a[o],c=l.get(s),c===void 0&&l.set(s,c=o?new Map:on(t)),l=c;return c};cn();var ln={http:null,xhr:Yt,fetch:{get:cn}};N.forEach(ln,(e,t)=>{if(e){try{Object.defineProperty(e,`name`,{__proto__:null,value:t})}catch{}Object.defineProperty(e,`adapterName`,{__proto__:null,value:t})}});var un=e=>`- ${e}`,dn=e=>N.isFunction(e)||e===null||e===!1;function fn(e,t){e=N.isArray(e)?e:[e];let{length:n}=e,r,i,a={};for(let o=0;o<n;o++){r=e[o];let n;if(i=r,!dn(r)&&(i=ln[(n=String(r)).toLowerCase()],i===void 0))throw new R(`Unknown adapter '${n}'`);if(i&&(N.isFunction(i)||(i=i.get(t))))break;a[n||`#`+o]=i}if(!i){let e=Object.entries(a).map(([e,t])=>`adapter ${e} `+(t===!1?`is not supported by the environment`:`is not available in the build`));throw new R(`There is no suitable adapter to dispatch the request `+(n?e.length>1?`since :
4
+ `+e.map(un).join(`
5
+ `):` `+un(e[0]):`as no adapter specified`),`ERR_NOT_SUPPORT`)}return i}var pn={getAdapter:fn,adapters:ln};function mn(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new U(null,e)}function hn(e){return mn(e),e.headers=L.from(e.headers),e.data=jt.call(e,e.transformRequest),[`post`,`put`,`patch`].indexOf(e.method)!==-1&&e.headers.setContentType(`application/x-www-form-urlencoded`,!1),pn.getAdapter(e.adapter||H.adapter,e)(e).then(function(t){mn(e),e.response=t;try{t.data=jt.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=L.from(t.headers),t},function(t){if(!Mt(t)&&(mn(e),t&&t.response)){e.response=t.response;try{t.response.data=jt.call(e,e.transformResponse,t.response)}finally{delete e.response}t.response.headers=L.from(t.response.headers)}return Promise.reject(t)})}var q={};[`object`,`boolean`,`number`,`function`,`string`,`symbol`].forEach((e,t)=>{q[e]=function(n){return typeof n===e||`a`+(t<1?`n `:` `)+e}});var gn={};q.transitional=function(e,t,n){function r(e,t){return`[Axios v`+nn+`] Transitional option '`+e+`'`+t+(n?`. `+n:``)}return(n,i,a)=>{if(e===!1)throw new R(r(i,` has been removed`+(t?` in `+t:``)),R.ERR_DEPRECATED);return t&&!gn[i]&&(gn[i]=!0,console.warn(r(i,` has been deprecated since v`+t+` and will be removed in the near future`))),e?e(n,i,a):!0}},q.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function _n(e,t,n){if(typeof e!=`object`)throw new R(`options must be an object`,R.ERR_BAD_OPTION_VALUE);let r=Object.keys(e),i=r.length;for(;i-- >0;){let a=r[i],o=Object.prototype.hasOwnProperty.call(t,a)?t[a]:void 0;if(o){let t=e[a],n=t===void 0||o(t,a,e);if(n!==!0)throw new R(`option `+a+` must be `+n,R.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new R(`Unknown option `+a,R.ERR_BAD_OPTION)}}var J={assertOptions:_n,validators:q},Y=J.validators,X=class{constructor(e){this.defaults=e||{},this.interceptors={request:new _t,response:new _t}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=Error();let n=(()=>{if(!t.stack)return``;let e=t.stack.indexOf(`
6
+ `);return e===-1?``:t.stack.slice(e+1)})();try{if(!e.stack)e.stack=n;else if(n){let t=n.indexOf(`
7
+ `),r=t===-1?-1:n.indexOf(`
8
+ `,t+1),i=r===-1?``:n.slice(r+1);String(e.stack).endsWith(i)||(e.stack+=`
9
+ `+n)}}catch{}}throw e}}_request(e,t){typeof e==`string`?(t=t||{},t.url=e):t=e||{},t=G(this.defaults,t);let{transitional:n,paramsSerializer:r,headers:i}=t;n!==void 0&&J.assertOptions(n,{silentJSONParsing:Y.transitional(Y.boolean),forcedJSONParsing:Y.transitional(Y.boolean),clarifyTimeoutError:Y.transitional(Y.boolean),legacyInterceptorReqResOrdering:Y.transitional(Y.boolean)},!1),r!=null&&(N.isFunction(r)?t.paramsSerializer={serialize:r}:J.assertOptions(r,{encode:Y.function,serialize:Y.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls===void 0?t.allowAbsoluteUrls=!0:t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls),J.assertOptions(t,{baseUrl:Y.spelling(`baseURL`),withXsrfToken:Y.spelling(`withXSRFToken`)},!0),t.method=(t.method||this.defaults.method||`get`).toLowerCase();let a=i&&N.merge(i.common,i[t.method]);i&&N.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`query`,`common`],e=>{delete i[e]}),t.headers=L.concat(a,i);let o=[],s=!0;this.interceptors.request.forEach(function(e){if(typeof e.runWhen==`function`&&e.runWhen(t)===!1)return;s=s&&e.synchronous;let n=t.transitional||vt;n&&n.legacyInterceptorReqResOrdering?o.unshift(e.fulfilled,e.rejected):o.push(e.fulfilled,e.rejected)});let c=[];this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,u=0,d;if(!s){let e=[hn.bind(this),void 0];for(e.unshift(...o),e.push(...c),d=e.length,l=Promise.resolve(t);u<d;)l=l.then(e[u++],e[u++]);return l}d=o.length;let f=t;for(;u<d;){let e=o[u++],t=o[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=hn.call(this,f)}catch(e){return Promise.reject(e)}for(u=0,d=c.length;u<d;)l=l.then(c[u++],c[u++]);return l}getUri(e){return e=G(this.defaults,e),gt(Ut(e.baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};N.forEach([`delete`,`get`,`head`,`options`],function(e){X.prototype[e]=function(t,n){return this.request(G(n||{},{method:e,url:t,data:(n||{}).data}))}}),N.forEach([`post`,`put`,`patch`,`query`],function(e){function t(t){return function(n,r,i){return this.request(G(i||{},{method:e,headers:t?{"Content-Type":`multipart/form-data`}:{},url:n,data:r}))}}X.prototype[e]=t(),e!==`query`&&(X.prototype[e+`Form`]=t(!0))});var vn=class e{constructor(e){if(typeof e!=`function`)throw TypeError(`executor must be a function.`);let t;this.promise=new Promise(function(e){t=e});let n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t,r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,i){n.reason||(n.reason=new U(e,r,i),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}};function yn(e){return function(t){return e.apply(null,t)}}function bn(e){return N.isObject(e)&&e.isAxiosError===!0}var xn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(xn).forEach(([e,t])=>{xn[t]=e});function Sn(e){let t=new X(e),n=f(X.prototype.request,t);return N.extend(n,X.prototype,t,{allOwnKeys:!0}),N.extend(n,t,null,{allOwnKeys:!0}),n.create=function(t){return Sn(G(e,t))},n}var Z=Sn(H);Z.Axios=X,Z.CanceledError=U,Z.CancelToken=vn,Z.isCancel=Mt,Z.VERSION=nn,Z.toFormData=z,Z.AxiosError=R,Z.Cancel=Z.CanceledError,Z.all=function(e){return Promise.all(e)},Z.spread=yn,Z.isAxiosError=bn,Z.mergeConfig=G,Z.AxiosHeaders=L,Z.formToJSON=e=>kt(N.isHTMLForm(e)?new FormData(e):e),Z.getAdapter=pn.getAdapter,Z.HttpStatusCode=xn,Z.default=Z;var Cn=null,wn=null,Q=null,$=Z.create({baseURL:`/api/v1`,headers:{"Content-Type":`application/json`},withCredentials:!0}),Tn=e=>e?.skipAuthRefresh===!0||e?.url===`/auth/refresh`||e?.url===`/auth/login`,En=async()=>{await $.post(`/auth/refresh`,void 0,{skipAuthRefresh:!0})},Dn=e=>{Cn=e},On=e=>{wn!==null&&$.interceptors.response.eject(wn),wn=$.interceptors.response.use(e=>e,async t=>{let n=t.config,r=t.response?.status;if(r===401&&n&&!n._retry&&!Tn(n)){n._retry=!0;try{return Q??(Q=En().finally(()=>{Q=null})),await Q,$(n)}catch(e){return Cn?.(),Promise.reject(e)}}if(r===401)return Cn?.(),Promise.reject(t);let i=t.response?.data?.message||t.message||`An unexpected error occurred`;return Array.isArray(i)&&(i=i.join(`. `)),e(t.response?.data?.error||t.response?.statusText||`Backend Error`,i),Promise.reject(t)})};export{d as i,Dn as n,On as r,$ as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./client-B553SX3l.js";var t=e(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]);export{t};
@@ -1 +1 @@
1
- import{i as e}from"./client-BGOBXkO8.js";var t=e(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]);export{t};
1
+ import{i as e}from"./client-B553SX3l.js";var t=e(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]);export{t};
@@ -1 +1 @@
1
- import{i as e}from"./client-BGOBXkO8.js";var t=e(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]);export{t};
1
+ import{i as e}from"./client-B553SX3l.js";var t=e(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]);export{t};
@@ -1 +1 @@
1
- import{i as e}from"./client-BGOBXkO8.js";var t=e(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]);export{t};
1
+ import{i as e}from"./client-B553SX3l.js";var t=e(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]);export{t};
@@ -1 +1 @@
1
- import{i as e}from"./client-BGOBXkO8.js";var t=e(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);export{t};
1
+ import{i as e}from"./client-B553SX3l.js";var t=e(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);export{t};