@rubytech/create-maxy-code 0.1.586 → 0.1.587

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 (90) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/plugins/admin/skills/whats-new/SKILL.md +4 -0
  3. package/payload/server/public/activity.html +2 -2
  4. package/payload/server/public/agents.html +2 -2
  5. package/payload/server/public/assets/{AdminLoginScreens-C9-USB3F.js → AdminLoginScreens-CMAyLnQq.js} +1 -1
  6. package/payload/server/public/assets/AdminLoginScreens-CMAyLnQq.js.br +0 -0
  7. package/payload/server/public/assets/AdminLoginScreens-CMAyLnQq.js.gz +0 -0
  8. package/payload/server/public/assets/AdminShell-jAKPnp6N.js +3 -0
  9. package/payload/server/public/assets/AdminShell-jAKPnp6N.js.br +0 -0
  10. package/payload/server/public/assets/AdminShell-jAKPnp6N.js.gz +0 -0
  11. package/payload/server/public/assets/{activity-qTF3J92s.js → activity-Gc-ptk9S.js} +1 -1
  12. package/payload/server/public/assets/activity-Gc-ptk9S.js.br +0 -0
  13. package/payload/server/public/assets/activity-Gc-ptk9S.js.gz +0 -0
  14. package/payload/server/public/assets/{admin-PBRDZ8OG.js → admin-B957HlQ7.js} +1 -1
  15. package/payload/server/public/assets/admin-B957HlQ7.js.br +0 -0
  16. package/payload/server/public/assets/admin-B957HlQ7.js.gz +0 -0
  17. package/payload/server/public/assets/{agents-DNSBvEgj.js → agents-Q-YwzgPr.js} +1 -1
  18. package/payload/server/public/assets/agents-Q-YwzgPr.js.br +0 -0
  19. package/payload/server/public/assets/agents-Q-YwzgPr.js.gz +0 -0
  20. package/payload/server/public/assets/{browser-D68qFX85.js → browser-DWCkS_d-.js} +1 -1
  21. package/payload/server/public/assets/browser-DWCkS_d-.js.br +0 -0
  22. package/payload/server/public/assets/browser-DWCkS_d-.js.gz +0 -0
  23. package/payload/server/public/assets/{calendar-DiyBcrbJ.js → calendar-I1w-tA-Z.js} +1 -1
  24. package/payload/server/public/assets/calendar-I1w-tA-Z.js.br +0 -0
  25. package/payload/server/public/assets/calendar-I1w-tA-Z.js.gz +0 -0
  26. package/payload/server/public/assets/{chat-BgmAjdkp.js → chat-CXHjXPn1.js} +1 -1
  27. package/payload/server/public/assets/chat-CXHjXPn1.js.br +2 -0
  28. package/payload/server/public/assets/chat-CXHjXPn1.js.gz +0 -0
  29. package/payload/server/public/assets/{graph-fZwMrLTq.js → graph-B2vvA_LE.js} +1 -1
  30. package/payload/server/public/assets/graph-B2vvA_LE.js.br +0 -0
  31. package/payload/server/public/assets/graph-B2vvA_LE.js.gz +0 -0
  32. package/payload/server/public/assets/{operator-BuRF6qBf.js → operator-dKgHXOTJ.js} +1 -1
  33. package/payload/server/public/assets/operator-dKgHXOTJ.js.br +0 -0
  34. package/payload/server/public/assets/operator-dKgHXOTJ.js.gz +0 -0
  35. package/payload/server/public/assets/{page-C4NwxoSJ.js → page-DS9ao-4m.js} +1 -1
  36. package/payload/server/public/assets/page-DS9ao-4m.js.br +0 -0
  37. package/payload/server/public/assets/page-DS9ao-4m.js.gz +0 -0
  38. package/payload/server/public/assets/{public-CBrcZ2Sz.js → public-Cx8N6Ljl.js} +1 -1
  39. package/payload/server/public/assets/public-Cx8N6Ljl.js.br +0 -0
  40. package/payload/server/public/assets/public-Cx8N6Ljl.js.gz +0 -0
  41. package/payload/server/public/assets/{routines-Cf1PwvDn.js → routines-DwnD80GN.js} +1 -1
  42. package/payload/server/public/assets/routines-DwnD80GN.js.br +0 -0
  43. package/payload/server/public/assets/routines-DwnD80GN.js.gz +0 -0
  44. package/payload/server/public/assets/{skills-5s3kkr0j.js → skills-DVvnpnjG.js} +1 -1
  45. package/payload/server/public/assets/skills-DVvnpnjG.js.br +0 -0
  46. package/payload/server/public/assets/skills-DVvnpnjG.js.gz +0 -0
  47. package/payload/server/public/assets/{tasks-DBRSqw5m.js → tasks-QcKXNXda.js} +1 -1
  48. package/payload/server/public/assets/tasks-QcKXNXda.js.br +0 -0
  49. package/payload/server/public/assets/tasks-QcKXNXda.js.gz +0 -0
  50. package/payload/server/public/browser.html +2 -2
  51. package/payload/server/public/calendar.html +2 -2
  52. package/payload/server/public/chat.html +3 -3
  53. package/payload/server/public/graph.html +2 -2
  54. package/payload/server/public/index.html +3 -3
  55. package/payload/server/public/operator.html +5 -5
  56. package/payload/server/public/public.html +3 -3
  57. package/payload/server/public/routines.html +2 -2
  58. package/payload/server/public/skills.html +2 -2
  59. package/payload/server/public/tasks.html +2 -2
  60. package/payload/server/public/assets/AdminLoginScreens-C9-USB3F.js.br +0 -0
  61. package/payload/server/public/assets/AdminLoginScreens-C9-USB3F.js.gz +0 -0
  62. package/payload/server/public/assets/AdminShell-BtWb0_Gm.js +0 -3
  63. package/payload/server/public/assets/AdminShell-BtWb0_Gm.js.br +0 -0
  64. package/payload/server/public/assets/AdminShell-BtWb0_Gm.js.gz +0 -0
  65. package/payload/server/public/assets/activity-qTF3J92s.js.br +0 -0
  66. package/payload/server/public/assets/activity-qTF3J92s.js.gz +0 -0
  67. package/payload/server/public/assets/admin-PBRDZ8OG.js.br +0 -0
  68. package/payload/server/public/assets/admin-PBRDZ8OG.js.gz +0 -0
  69. package/payload/server/public/assets/agents-DNSBvEgj.js.br +0 -0
  70. package/payload/server/public/assets/agents-DNSBvEgj.js.gz +0 -0
  71. package/payload/server/public/assets/browser-D68qFX85.js.br +0 -0
  72. package/payload/server/public/assets/browser-D68qFX85.js.gz +0 -0
  73. package/payload/server/public/assets/calendar-DiyBcrbJ.js.br +0 -0
  74. package/payload/server/public/assets/calendar-DiyBcrbJ.js.gz +0 -0
  75. package/payload/server/public/assets/chat-BgmAjdkp.js.br +0 -1
  76. package/payload/server/public/assets/chat-BgmAjdkp.js.gz +0 -0
  77. package/payload/server/public/assets/graph-fZwMrLTq.js.br +0 -0
  78. package/payload/server/public/assets/graph-fZwMrLTq.js.gz +0 -0
  79. package/payload/server/public/assets/operator-BuRF6qBf.js.br +0 -0
  80. package/payload/server/public/assets/operator-BuRF6qBf.js.gz +0 -0
  81. package/payload/server/public/assets/page-C4NwxoSJ.js.br +0 -0
  82. package/payload/server/public/assets/page-C4NwxoSJ.js.gz +0 -0
  83. package/payload/server/public/assets/public-CBrcZ2Sz.js.br +0 -0
  84. package/payload/server/public/assets/public-CBrcZ2Sz.js.gz +0 -0
  85. package/payload/server/public/assets/routines-Cf1PwvDn.js.br +0 -0
  86. package/payload/server/public/assets/routines-Cf1PwvDn.js.gz +0 -0
  87. package/payload/server/public/assets/skills-5s3kkr0j.js.br +0 -0
  88. package/payload/server/public/assets/skills-5s3kkr0j.js.gz +0 -0
  89. package/payload/server/public/assets/tasks-DBRSqw5m.js.br +0 -0
  90. package/payload/server/public/assets/tasks-DBRSqw5m.js.gz +0 -0
@@ -5,17 +5,17 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Maxy</title>
7
7
  <link rel="icon" href="/favicon.ico">
8
- <script type="module" crossorigin src="/assets/admin-PBRDZ8OG.js"></script>
8
+ <script type="module" crossorigin src="/assets/admin-B957HlQ7.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-BycB0eMI.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-BmNepPEn.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/useMediaQuery-B469O83-.js">
12
12
  <link rel="modulepreload" crossorigin href="/assets/graph-labels-kneGnsHB.js">
13
- <link rel="modulepreload" crossorigin href="/assets/AdminShell-BtWb0_Gm.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/AdminShell-jAKPnp6N.js">
14
14
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-eAV8hweq.js">
15
15
  <link rel="modulepreload" crossorigin href="/assets/copy-C87QIN_o.js">
16
16
  <link rel="modulepreload" crossorigin href="/assets/play-DgP7vl0r.js">
17
17
  <link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-Bb-51cJv.js">
18
- <link rel="modulepreload" crossorigin href="/assets/AdminLoginScreens-C9-USB3F.js">
18
+ <link rel="modulepreload" crossorigin href="/assets/AdminLoginScreens-CMAyLnQq.js">
19
19
  <link rel="modulepreload" crossorigin href="/assets/file-download-B7zwa78w.js">
20
20
  <link rel="modulepreload" crossorigin href="/assets/chevron-left-0tVo23Dh.js">
21
21
  <link rel="modulepreload" crossorigin href="/assets/file-text-rWowl9RN.js">
@@ -5,25 +5,25 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Operator — Maxy</title>
7
7
  <link rel="icon" href="/favicon.ico">
8
- <script type="module" crossorigin src="/assets/operator-BuRF6qBf.js"></script>
8
+ <script type="module" crossorigin src="/assets/operator-dKgHXOTJ.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-BycB0eMI.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-BmNepPEn.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/useMediaQuery-B469O83-.js">
12
- <link rel="modulepreload" crossorigin href="/assets/AdminShell-BtWb0_Gm.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/AdminShell-jAKPnp6N.js">
13
13
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-eAV8hweq.js">
14
14
  <link rel="modulepreload" crossorigin href="/assets/copy-C87QIN_o.js">
15
15
  <link rel="modulepreload" crossorigin href="/assets/play-DgP7vl0r.js">
16
16
  <link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-Bb-51cJv.js">
17
- <link rel="modulepreload" crossorigin href="/assets/AdminLoginScreens-C9-USB3F.js">
17
+ <link rel="modulepreload" crossorigin href="/assets/AdminLoginScreens-CMAyLnQq.js">
18
18
  <link rel="modulepreload" crossorigin href="/assets/useCopyFeedback-DfNAu8hQ.js">
19
19
  <link rel="modulepreload" crossorigin href="/assets/chevron-left-0tVo23Dh.js">
20
20
  <link rel="modulepreload" crossorigin href="/assets/file-text-rWowl9RN.js">
21
21
  <link rel="modulepreload" crossorigin href="/assets/rotate-ccw-Dnn7gbPh.js">
22
22
  <link rel="modulepreload" crossorigin href="/assets/wrench-Ck4phkdB.js">
23
- <link rel="modulepreload" crossorigin href="/assets/page-C4NwxoSJ.js">
23
+ <link rel="modulepreload" crossorigin href="/assets/page-DS9ao-4m.js">
24
24
  <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-rMaiYjNu.css">
25
- <link rel="stylesheet" crossorigin href="/assets/AdminLoginScreens-CWMpccrR.css">
26
25
  <link rel="stylesheet" crossorigin href="/assets/useMediaQuery-DXAuc8G-.css">
26
+ <link rel="stylesheet" crossorigin href="/assets/AdminLoginScreens-CWMpccrR.css">
27
27
  <link rel="stylesheet" href="/brand-defaults.css">
28
28
  </head>
29
29
  <body>
@@ -5,11 +5,11 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Maxy</title>
7
7
  <link rel="icon" href="/favicon.ico">
8
- <script type="module" crossorigin src="/assets/public-CBrcZ2Sz.js"></script>
8
+ <script type="module" crossorigin src="/assets/public-Cx8N6Ljl.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-BycB0eMI.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-BmNepPEn.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/useMediaQuery-B469O83-.js">
12
- <link rel="modulepreload" crossorigin href="/assets/AdminShell-BtWb0_Gm.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/AdminShell-jAKPnp6N.js">
13
13
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-eAV8hweq.js">
14
14
  <link rel="modulepreload" crossorigin href="/assets/copy-C87QIN_o.js">
15
15
  <link rel="modulepreload" crossorigin href="/assets/play-DgP7vl0r.js">
@@ -19,7 +19,7 @@
19
19
  <link rel="modulepreload" crossorigin href="/assets/file-text-rWowl9RN.js">
20
20
  <link rel="modulepreload" crossorigin href="/assets/rotate-ccw-Dnn7gbPh.js">
21
21
  <link rel="modulepreload" crossorigin href="/assets/wrench-Ck4phkdB.js">
22
- <link rel="modulepreload" crossorigin href="/assets/page-C4NwxoSJ.js">
22
+ <link rel="modulepreload" crossorigin href="/assets/page-DS9ao-4m.js">
23
23
  <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-rMaiYjNu.css">
24
24
  <link rel="stylesheet" crossorigin href="/assets/useMediaQuery-DXAuc8G-.css">
25
25
  <link rel="stylesheet" href="/brand-defaults.css">
@@ -5,11 +5,11 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Routines — Maxy</title>
7
7
  <link rel="icon" href="/favicon.ico">
8
- <script type="module" crossorigin src="/assets/routines-Cf1PwvDn.js"></script>
8
+ <script type="module" crossorigin src="/assets/routines-DwnD80GN.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-BycB0eMI.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-BmNepPEn.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/useMediaQuery-B469O83-.js">
12
- <link rel="modulepreload" crossorigin href="/assets/AdminShell-BtWb0_Gm.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/AdminShell-jAKPnp6N.js">
13
13
  <link rel="modulepreload" crossorigin href="/assets/file-download-B7zwa78w.js">
14
14
  <link rel="modulepreload" crossorigin href="/assets/clock-D2cZ0sge.js">
15
15
  <link rel="modulepreload" crossorigin href="/assets/triangle-alert-el772yUQ.js">
@@ -5,11 +5,11 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Skills — Maxy</title>
7
7
  <link rel="icon" href="/favicon.ico">
8
- <script type="module" crossorigin src="/assets/skills-5s3kkr0j.js"></script>
8
+ <script type="module" crossorigin src="/assets/skills-DVvnpnjG.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-BycB0eMI.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-BmNepPEn.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/useMediaQuery-B469O83-.js">
12
- <link rel="modulepreload" crossorigin href="/assets/AdminShell-BtWb0_Gm.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/AdminShell-jAKPnp6N.js">
13
13
  <link rel="modulepreload" crossorigin href="/assets/file-text-rWowl9RN.js">
14
14
  <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-rMaiYjNu.css">
15
15
  <link rel="stylesheet" crossorigin href="/assets/useMediaQuery-DXAuc8G-.css">
@@ -5,11 +5,11 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Tasks — Maxy</title>
7
7
  <link rel="icon" href="/favicon.ico">
8
- <script type="module" crossorigin src="/assets/tasks-DBRSqw5m.js"></script>
8
+ <script type="module" crossorigin src="/assets/tasks-QcKXNXda.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-BycB0eMI.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-BmNepPEn.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/useMediaQuery-B469O83-.js">
12
- <link rel="modulepreload" crossorigin href="/assets/AdminShell-BtWb0_Gm.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/AdminShell-jAKPnp6N.js">
13
13
  <link rel="modulepreload" crossorigin href="/assets/play-DgP7vl0r.js">
14
14
  <link rel="modulepreload" crossorigin href="/assets/rotate-ccw-Dnn7gbPh.js">
15
15
  <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-rMaiYjNu.css">
@@ -1,3 +0,0 @@
1
- import{o as e}from"./chunk-BycB0eMI.js";import{i as t,r as n,t as r}from"./jsx-runtime-BmNepPEn.js";import{$ as i,A as a,B as o,D as s,E as c,F as l,G as u,H as d,I as f,J as p,K as m,L as h,M as g,N as _,O as ee,Q as v,R as y,T as b,U as x,V as te,W as S,X as ne,Y as re,Z as C,_ as w,a as T,c as ie,g as ae,h as oe,j as E,l as se,m as D,n as O,nt as k,o as ce,t as le,tt as ue,v as A,z as j}from"./useMediaQuery-B469O83-.js";async function de(){try{let e=await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`logout`})});return e.ok?(await e.json().catch(()=>({})))?.logged_out===!0:(console.error(`[admin-ui] claude-logout http-status=${e.status}`),!1)}catch(e){return console.error(`[admin-ui] claude-logout fetch failed: ${e instanceof Error?e.message:String(e)}`),!1}}var M=r();function fe({checked:e,onChange:t,label:n,disabled:r,ariaLabel:i=n}){return(0,M.jsxs)(`label`,{className:`maxy-checkbox${r?` maxy-checkbox--disabled`:``}`,children:[(0,M.jsx)(`input`,{type:`checkbox`,"aria-label":i,checked:e,onChange:e=>t(e.target.checked),disabled:r}),(0,M.jsx)(`span`,{className:`maxy-checkbox__box`,children:`✱`}),n&&(0,M.jsx)(`span`,{className:`maxy-checkbox__label`,children:n})]})}var N=e(t(),1),P={sm:14,md:16,lg:18},F={sm:30,md:38,lg:46};function I({variant:e=`primary`,size:t=`md`,icon:n,iconPosition:r=`leading`,loading:i=!1,fullWidth:a=!1,disabled:o=!1,type:s=`button`,onClick:c,"aria-label":l,"aria-pressed":u,style:d,className:f,children:p}){let m=[`btn`,`btn--${e}`,t===`md`?``:`btn--${t}`,a?`btn--full`:``,f].filter(Boolean).join(` `),h=P[t],g={...e===`send`?{width:F[t],height:F[t]}:{},...d},_=Object.keys(g).length>0;return(0,M.jsxs)(`button`,{type:s,className:m,disabled:i||o,onClick:c,"aria-label":l,"aria-pressed":u,style:_?g:void 0,children:[(0,M.jsxs)(`span`,{className:`btn__content`,style:{visibility:i?`hidden`:`visible`},children:[n&&r===`leading`&&(0,M.jsx)(n,{size:h}),p,n&&r===`trailing`&&(0,M.jsx)(n,{size:h})]}),i&&(0,M.jsx)(`span`,{className:`btn__spinner`,children:`✱`})]})}var pe=C(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),me=C(`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`}]]),L=C(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),R=C(`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`}]]),he=C(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),ge=C(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),_e=C(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),ve=C(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),ye=C(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),be=C(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),xe=C(`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`}]]),Se=C(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),z=C(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Ce=C(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),we=C(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),Te=C(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),Ee=C(`waypoints`,[[`path`,{d:`m10.586 5.414-5.172 5.172`,key:`4mc350`}],[`path`,{d:`m18.586 13.414-5.172 5.172`,key:`8c96vv`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`circle`,{cx:`12`,cy:`20`,r:`2`,key:`144qzu`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}],[`circle`,{cx:`20`,cy:`12`,r:`2`,key:`1xzzfp`}],[`circle`,{cx:`4`,cy:`12`,r:`2`,key:`1hvhnz`}]]),De=C(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),Oe=`/cdp-screencast`;function ke(e){return{format:`jpeg`,quality:60,maxWidth:e?Math.max(320,Math.round(e.width)):1280,maxHeight:e?Math.max(320,Math.round(e.height)):800,everyNthFrame:1}}var Ae=1e3,je=3e4,Me=[0,1e3,2e3,4e3];function Ne(e,t,n,r){return n.width<=0||n.height<=0?{x:0,y:0}:{x:e/n.width*r.deviceWidth,y:t/n.height*r.deviceHeight}}function B(e){return e===0?`left`:e===1?`middle`:e===2?`right`:`none`}function Pe(e,t){let n=B(t.button);return{type:e,x:t.x,y:t.y,button:n,buttons:t.buttons,clickCount:e===`mouseMoved`?0:1,modifiers:t.modifiers}}function Fe(e){return{type:`mouseWheel`,x:e.x,y:e.y,button:`none`,buttons:0,clickCount:0,modifiers:e.modifiers,deltaX:e.deltaX,deltaY:e.deltaY}}var Ie={Backspace:8,Tab:9,Enter:13,Escape:27,PageUp:33,PageDown:34,End:35,Home:36,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Delete:46},Le={Enter:`\r`,Tab:` `};function Re(e,t){let n=t.key.length===1,r=n&&/[a-z0-9]/i.test(t.key)?t.key.toUpperCase().charCodeAt(0):Ie[t.key]??0,i={type:e,key:t.key,code:t.code,modifiers:t.modifiers,windowsVirtualKeyCode:r,nativeVirtualKeyCode:r};if(e===`keyDown`){let e=n?t.key:Le[t.key];e!==void 0&&(i.text=e,i.unmodifiedText=e)}return i}function ze(e){let t=e.trim();return t?/^[a-z][a-z0-9+.-]*:/i.test(t)?t:`https://${t}`:``}function Be(e){try{return new URL(ze(e)).host}catch{return``}}function Ve(e,t,n){return`${e.protocol===`https:`?`wss`:`ws`}://${e.host}${Oe}?targetId=${encodeURIComponent(t)}&sid=${encodeURIComponent(n)}`}var He=class{nextId=1;startId=null;frames=0;stopped=!1;lastMetadata=null;lastInputLogAtMs=null;inputsSinceLog=0;lastFrameAtMs=null;inputsSinceFrame=0;pending=new Map;constructor(e,t){this.ws=e,this.opts=t}frameCount(){return this.frames}sinceLastFrameMs(){return this.lastFrameAtMs===null?null:(this.opts.now??Date.now)()-this.lastFrameAtMs}inputsSinceLastFrame(){return this.inputsSinceFrame}reload(){this.send(`Page.reload`,{})}start(e){this.send(`Page.enable`,{}),e&&this.setPaneSize(e);let t=ke(e);this.startId=this.send(`Page.startScreencast`,t)}setPaneSize(e){let t=Math.max(1,Math.round(e.width)),n=Math.max(1,Math.round(e.height));this.send(`Emulation.setDeviceMetricsOverride`,{width:t,height:n,deviceScaleFactor:0,mobile:!1})}stop(){if(this.stopped)return;this.stopped=!0;let e=this.send(`Page.stopScreencast`,{})!==null;this.send(`Emulation.clearDeviceMetricsOverride`,{}),this.opts.onLog(`teardown`,{stopSent:e})}handleMessage(e){let t;try{t=JSON.parse(e)}catch{return}if(typeof t.id==`number`){let e=this.pending.get(t.id);if(e){this.pending.delete(t.id),e(t.error?null:t.result);return}}if(typeof t.id==`number`&&t.id===this.startId){if(t.error)this.opts.onLog(`start-failed`,{err:t.error.message??`unknown`});else{let e=ke();this.opts.onLog(`screencast-started`,{format:e.format,everyNthFrame:e.everyNthFrame})}return}if(t.method===`Page.frameNavigated`){let e=t.params?.frame;e&&e.parentId===void 0&&typeof e.url==`string`&&this.opts.onUrlChange?.(e.url);return}if(t.method!==`Page.screencastFrame`||this.stopped)return;let n=t.params;if(typeof n?.data!=`string`){this.opts.onLog(`frame-dropped`,{reason:`no-data`});return}if(typeof n?.metadata!=`object`||n.metadata===null){this.opts.onLog(`frame-dropped`,{reason:`no-metadata`});return}let r=n.metadata;typeof n.sessionId==`number`?this.send(`Page.screencastFrameAck`,{sessionId:n.sessionId}):this.opts.onLog(`frame-unacked`,{}),this.frames+=1,this.lastFrameAtMs=(this.opts.now??Date.now)(),this.inputsSinceFrame=0,this.lastMetadata=r,this.frames%30==0&&this.opts.onLog(`frame`,{seq:this.frames}),this.opts.onFrame({data:n.data,metadata:r})}dispatchMouse(e,t){let n=this.lastMetadata;if(!n)return;let r=Ne(t.canvasX,t.canvasY,t.rendered,n);this.send(`Input.dispatchMouseEvent`,Pe(e,{x:r.x,y:r.y,button:t.button,buttons:t.buttons,modifiers:t.modifiers})),this.logInput(`mouse`)}dispatchWheel(e){let t=this.lastMetadata;if(!t)return;let n=Ne(e.canvasX,e.canvasY,e.rendered,t);this.send(`Input.dispatchMouseEvent`,Fe({x:n.x,y:n.y,deltaX:e.deltaX,deltaY:e.deltaY,modifiers:e.modifiers})),this.logInput(`wheel`)}dispatchKey(e,t){this.send(`Input.dispatchKeyEvent`,Re(e,t)),this.logInput(`key`)}insertText(e){e&&(this.send(`Input.insertText`,{text:e}),this.logInput(`paste`))}navigate(e){let t=ze(e);t&&(this.send(`Page.navigate`,{url:t}),this.opts.onLog(`navigate`,{host:Be(t)}))}async goHistory(e){let t=e<0?`back`:`forward`,n=await this.command(`Page.getNavigationHistory`,{});if(!n){this.opts.onLog(`history`,{dir:t,outcome:`no-result`});return}let{currentIndex:r,entries:i}=n,a=typeof r==`number`?i?.[r+e]:void 0;if(!a||typeof a.id!=`number`){this.opts.onLog(`history`,{dir:t,outcome:`no-entry`});return}this.send(`Page.navigateToHistoryEntry`,{entryId:a.id}),this.opts.onLog(`history`,{dir:t})}command(e,t){let n=this.send(e,t);return n===null?Promise.resolve(null):new Promise(e=>this.pending.set(n,e))}logInput(e){this.inputsSinceFrame+=1,this.inputsSinceLog+=1;let t=(this.opts.now??Date.now)();if(this.lastInputLogAtMs!==null&&t-this.lastInputLogAtMs<1e3)return;this.lastInputLogAtMs=t;let n=this.inputsSinceLog;this.inputsSinceLog=0,this.opts.onLog(`input`,{kind:e,count:n})}send(e,t){let n=this.nextId++;try{return this.ws.send(JSON.stringify({id:n,method:e,params:t})),n}catch(t){return this.opts.onLog(`send-failed`,{method:e,err:t instanceof Error?t.message:String(t)}),null}}};function Ue(e){let{targets:t,activeId:n,url:r,busy:i}=e,[a,s]=(0,N.useState)(r),c=(0,N.useRef)(null);return(0,N.useEffect)(()=>{c.current&&document.activeElement===c.current||s(r)},[r]),(0,N.useEffect)(()=>{s(e.url)},[n]),(0,M.jsxs)(`div`,{className:`browser-chrome`,children:[(0,M.jsxs)(`div`,{className:`browser-chrome__tabs`,role:`tablist`,children:[t.map(t=>(0,M.jsxs)(`div`,{className:t.id===n?`browser-chrome__tab is-active`:`browser-chrome__tab`,role:`tab`,"aria-selected":t.id===n,children:[(0,M.jsx)(`button`,{type:`button`,className:`browser-chrome__tab-label`,onClick:()=>e.onSelect(t.id),title:t.url,children:t.title}),(0,M.jsx)(`button`,{type:`button`,className:`browser-chrome__tab-close`,"aria-label":`Close ${t.title}`,onClick:()=>e.onClose(t.id),disabled:i,children:(0,M.jsx)(E,{size:12,strokeWidth:2})})]},t.id)),(0,M.jsx)(`button`,{type:`button`,className:`browser-chrome__new`,"aria-label":`New tab`,title:`New tab`,onClick:e.onNew,disabled:i,children:(0,M.jsx)(f,{size:14,strokeWidth:2})}),(e.onToggleFull||e.onClosePane)&&(0,M.jsxs)(`div`,{className:`browser-chrome__window`,children:[e.onToggleFull&&(0,M.jsx)(`button`,{type:`button`,className:`browser-chrome__nav`,"aria-label":e.isFull?`Exit full screen`:`Full screen`,title:e.isFull?`Exit full screen`:`Full screen`,onClick:e.onToggleFull,children:e.isFull?(0,M.jsx)(Se,{size:15,strokeWidth:1.75}):(0,M.jsx)(o,{size:15,strokeWidth:1.75})}),e.onClosePane&&(0,M.jsx)(`button`,{type:`button`,className:`browser-chrome__nav`,"aria-label":`Close browser`,title:`Close browser`,onClick:e.onClosePane,children:(0,M.jsx)(E,{size:16,strokeWidth:1.75})})]})]}),(0,M.jsxs)(`form`,{className:`browser-chrome__bar`,onSubmit:t=>{t.preventDefault(),e.onNavigate(a)},children:[(0,M.jsx)(`button`,{type:`button`,className:`browser-chrome__nav`,"aria-label":`Back`,title:`Back`,onClick:e.onBack,children:(0,M.jsx)(re,{size:16,strokeWidth:1.75})}),(0,M.jsx)(`button`,{type:`button`,className:`browser-chrome__nav`,"aria-label":`Forward`,title:`Forward`,onClick:e.onForward,children:(0,M.jsx)(L,{size:16,strokeWidth:1.75})}),(0,M.jsx)(`button`,{type:`button`,className:`browser-chrome__nav`,"aria-label":`Reload`,title:`Reload`,onClick:e.onReload,children:(0,M.jsx)(Ce,{size:15,strokeWidth:1.75})}),(0,M.jsx)(`input`,{ref:c,className:`browser-chrome__url`,"aria-label":`Address`,placeholder:`Type a URL`,value:a,onChange:e=>s(e.target.value)})]})]})}function V(e){return(e.altKey?1:0)|(e.ctrlKey?2:0)|(e.metaKey?4:0)|(e.shiftKey?8:0)}function H({preferTargetId:e=null,cacheKey:t=null,chrome:n=!0,surface:r=`browser`,onToggleFull:i,onClosePane:o,isFull:s=!1}={}){let[c,l]=(0,N.useState)(`probing`),[u,d]=(0,N.useState)([]),[f,p]=(0,N.useState)(null),[m,h]=(0,N.useState)(!1),[g,_]=(0,N.useState)(null),[ee,v]=(0,N.useState)(!1),[y,b]=(0,N.useState)(``),S=a(t),[ne,re]=(0,N.useState)(0),C=(0,N.useRef)(null),w=(0,N.useRef)(null),T=(0,N.useRef)(null),ie=(0,N.useRef)(null),ae=(0,N.useRef)(``),oe=(0,N.useRef)(0),E=(0,N.useRef)(null),se=(0,N.useRef)(!1),D=(0,N.useRef)(e);D.current=e,ae.current||=`sc-${Math.random().toString(36).slice(2,10)}`;let O=(0,N.useCallback)((e,t={})=>{S(`/api/admin/browser/screencast-event`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({sid:ae.current,op:e,...t})}).catch(()=>{})},[S]),k=(0,N.useCallback)(async()=>{try{let e=await S(`/api/admin/browser/screencast-targets`);if(!e.ok){l(`unavailable`);return}let t=await e.json().catch(()=>({})),n=Array.isArray(t.targets)?t.targets:[];if(d(n),n.length===0){p(null),l(`no-tabs`);return}let r=D.current;p(e=>r&&n.some(e=>e.id===r)?r:e&&n.some(t=>t.id===e)?e:n[0].id),l(`live`)}catch{l(`unavailable`)}},[S]);(0,N.useEffect)(()=>{O(`request`),k()},[k,O]),(0,N.useEffect)(()=>{n&&O(`chrome-mounted`,{surface:r,chrome:`v2`})},[n,r,O]),(0,N.useEffect)(()=>{b(u.find(e=>e.id===f)?.url??``)},[u,f]);let ce=(0,N.useRef)(null);(0,N.useEffect)(()=>{if(e){if(u.some(t=>t.id===e)){p(e);return}ce.current!==e&&(ce.current=e,k())}},[e,u,k]);let le=(0,N.useCallback)(e=>{let t=C.current;if(!t)return;let n=new Image;n.onload=()=>{t.width=n.naturalWidth,t.height=n.naturalHeight,t.getContext(`2d`)?.drawImage(n,0,0)},n.src=`data:image/jpeg;base64,${e.data}`},[]),ue=(0,N.useCallback)(()=>{let e=w.current;if(!e)return;let t=e.getBoundingClientRect(),n=getComputedStyle(e),r=e=>Number.parseFloat(e)||0,i=t.width-r(n.paddingLeft)-r(n.paddingRight),a=t.height-r(n.paddingTop)-r(n.paddingBottom);if(!(i<1||a<1))return{width:i,height:a}},[]);(0,N.useEffect)(()=>{let e=w.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>{let e=ue();e&&T.current?.setPaneSize(e)});return t.observe(e),()=>t.disconnect()},[c,ue]);let A=(0,N.useCallback)(e=>{if(E.current!==null)return;let t=oe.current;if(t>=Me.length){O(`reconnect-exhausted`,{attempt:t}),l(`unavailable`);return}oe.current=t+1,O(`reconnect`,{attempt:t+1,reason:e}),E.current=setTimeout(()=>{E.current=null,re(e=>e+1)},Me[t])},[O]);(0,N.useEffect)(()=>()=>{E.current!==null&&clearTimeout(E.current)},[]),(0,N.useEffect)(()=>{if(c!==`live`||!f)return;let e=Ve({protocol:window.location.protocol,host:window.location.host},f,ae.current),t=new WebSocket(e),n=new He(t,{onFrame:e=>{oe.current=0,le(e)},onLog:O,onUrlChange:b});T.current=n,ie.current=t;let r=!1;t.addEventListener(`open`,()=>{n.start(ue()),se.current&&(se.current=!1,n.reload())}),t.addEventListener(`message`,e=>{typeof e.data==`string`&&n.handleMessage(e.data)});let i=e=>()=>{r||A(e)};return t.addEventListener(`close`,i(`close`)),t.addEventListener(`error`,i(`error`)),()=>{r=!0,n.stop(),t.close(),T.current=null,ie.current=null}},[c,f,ne,le,O,ue,A]),(0,N.useEffect)(()=>{if(c!==`live`)return;let e=setInterval(()=>{let e=T.current;if(!e)return;let t=e.sinceLastFrameMs();if(t===null)return;let n=e.inputsSinceLastFrame();n===0||t<5e3||E.current===null&&(O(`frame-stall`,{sinceLastFrameMs:t,inputsSince:n}),A(`stall`))},Ae);return()=>clearInterval(e)},[c,ne,O,A]),(0,N.useEffect)(()=>{if(c!==`live`)return;let e=e=>e===0?`connecting`:e===1?`open`:e===2?`closing`:`closed`,t=setInterval(()=>{O(`viewer-census`,{socketState:e(ie.current?.readyState),sinceLastFrameMs:T.current?.sinceLastFrameMs()??-1})},je);return()=>clearInterval(t)},[c,O]);let j=(0,N.useCallback)(e=>t=>{let n=C.current;if(!n)return;let r=n.getBoundingClientRect();T.current?.dispatchMouse(e,{canvasX:t.clientX-r.left,canvasY:t.clientY-r.top,rendered:{width:r.width,height:r.height},button:e===`mouseMoved`?-1:t.button,buttons:t.buttons,modifiers:V(t)})},[]);(0,N.useEffect)(()=>{let e=C.current;if(!e)return;let t=t=>{t.preventDefault();let n=e.getBoundingClientRect();T.current?.dispatchWheel({canvasX:t.clientX-n.left,canvasY:t.clientY-n.top,rendered:{width:n.width,height:n.height},deltaX:t.deltaX,deltaY:t.deltaY,modifiers:V(t)})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[c]);let de=(0,N.useCallback)(e=>t=>{t.preventDefault(),T.current?.dispatchKey(e,{key:t.key,code:t.code,modifiers:V(t)})},[]),fe=(0,N.useCallback)(e=>{e.preventDefault();let t=e.clipboardData.getData(`text`);t&&T.current?.insertText(t)},[]),P=(0,N.useCallback)(async()=>{h(!0),_(null);try{let e=await S(`/api/admin/browser/launch`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||`Launch failed (${e.status})`)}await k()}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(!1)}},[S,k]),F=(0,N.useCallback)(async()=>{v(!0),_(null);try{c===`no-tabs`&&await S(`/api/admin/browser/launch`,{method:`POST`});let e=await S(`/api/admin/browser/tabs`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||`New tab failed (${e.status})`)}let t=await e.json().catch(()=>({}));await k(),t.id&&p(t.id)}catch(e){_(e instanceof Error?e.message:String(e))}finally{v(!1)}},[S,k,c]),I=(0,N.useCallback)(async e=>{v(!0),_(null);try{let t=await S(`/api/admin/browser/tabs/${encodeURIComponent(e)}`,{method:`DELETE`});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error||`Close failed (${t.status})`)}await k()}catch(e){_(e instanceof Error?e.message:String(e))}finally{v(!1)}},[S,k]),pe=(0,N.useCallback)(e=>{T.current?.navigate(e)},[]),me=(0,N.useCallback)(e=>{T.current?.goHistory(e)},[]),L=(0,N.useCallback)(()=>{O(`reload`,{}),c===`live`&&(se.current=!0),oe.current=0,re(e=>e+1)},[O,c]);return c===`probing`?(0,M.jsx)(`div`,{className:`cdp-screencast`,children:(0,M.jsxs)(`div`,{className:`data-loading`,children:[(0,M.jsx)(te,{size:18,className:`spin`}),` Connecting to the device browser…`]})}):c===`unavailable`?(0,M.jsx)(`div`,{className:`cdp-screencast`,children:(0,M.jsxs)(`div`,{className:`cdp-screencast__unavailable`,children:[(0,M.jsx)(x,{size:28,strokeWidth:1.75}),(0,M.jsx)(`p`,{children:`The device browser is not reachable.`})]})}):(0,M.jsxs)(`div`,{className:`cdp-screencast`,children:[n&&(0,M.jsx)(Ue,{targets:u,activeId:f,url:y,busy:ee,onSelect:p,onClose:I,onNew:F,onBack:()=>me(-1),onForward:()=>me(1),onNavigate:pe,onReload:L,onToggleFull:i,onClosePane:o,isFull:s}),g&&(0,M.jsx)(`div`,{className:`cdp-screencast__toolbar`,children:(0,M.jsx)(`span`,{className:`cdp-screencast__error`,children:g})}),c===`no-tabs`?(0,M.jsxs)(`div`,{className:`cdp-screencast__unavailable`,children:[(0,M.jsx)(x,{size:28,strokeWidth:1.75}),(0,M.jsx)(`p`,{children:`No open tabs on the device browser.`}),(0,M.jsxs)(`button`,{type:`button`,className:`cdp-screencast__btn`,onClick:P,disabled:m,children:[m?(0,M.jsx)(te,{size:14,className:`spin`}):(0,M.jsx)(x,{size:14}),` Launch browser`]})]}):(0,M.jsxs)(M.Fragment,{children:[!n&&(0,M.jsx)(`div`,{className:`cdp-screencast__tabs`,children:u.map(e=>(0,M.jsx)(`button`,{type:`button`,className:e.id===f?`cdp-screencast__tab is-active`:`cdp-screencast__tab`,onClick:()=>p(e.id),title:e.url,children:e.title},e.id))}),(0,M.jsx)(`div`,{className:`cdp-screencast__viewport`,ref:w,children:(0,M.jsx)(`canvas`,{ref:C,className:`cdp-screencast__canvas`,tabIndex:0,onMouseDown:j(`mousePressed`),onMouseUp:j(`mouseReleased`),onMouseMove:j(`mouseMoved`),onKeyDown:de(`keyDown`),onKeyUp:de(`keyUp`),onPaste:fe})})]})]})}var We=5e3,Ge=1200;function Ke(e){return Math.max(Ge,Math.round(We/(e<1?1:e)))}var qe=500,U=new Set;function Je(e,t,n){let r=n??(typeof globalThis.fetch==`function`?globalThis.fetch:void 0);if(U.has(e)||!r)return!1;if(U.size>=qe){for(let e of U)if(U.delete(e),U.size<qe)break}U.add(e);try{Promise.resolve(r(`/api/admin/events`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({event:`channel-notify:rendered`,fields:{msgId:e,senderType:t}})})).catch(()=>{})}catch{}return!0}function Ye({type:e}){return e===`admin`?(0,M.jsx)(`svg`,{className:`channel-notify-icon`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,M.jsx)(`path`,{d:`M8 1.5 13 3.5v4c0 3-2.1 5.8-5 7-2.9-1.2-5-4-5-7v-4z`})}):e===`manager-active`?(0,M.jsx)(`svg`,{className:`channel-notify-icon`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,M.jsx)(`path`,{d:`M2 5.5h9l-2.5-2.5 1-1L14 6l-4.5 4-1-1L11 6.5H2zM14 10.5H5l2.5 2.5-1 1L2 10l4.5-4 1 1L5 9.5h9z`})}):e===`manager-passive`?(0,M.jsx)(`svg`,{className:`channel-notify-icon`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,M.jsx)(`path`,{d:`M8 3C4.5 3 1.7 5.4 1 8c.7 2.6 3.5 5 7 5s6.3-2.4 7-5c-.7-2.6-3.5-5-7-5m0 8a3 3 0 1 1 0-6 3 3 0 0 1 0 6`})}):(0,M.jsx)(`svg`,{className:`channel-notify-icon`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,M.jsx)(`path`,{d:`M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6m0 1.5c-3 0-5.5 1.6-5.5 3.5v1h11v-1c0-1.9-2.5-3.5-5.5-3.5`})})}function Xe({frames:e,onExpire:t}){let n=(0,N.useRef)(new Map),r=(0,N.useRef)(new Map);return(0,N.useEffect)(()=>{let i=Date.now(),a=Ke(e.length),o=new Set(e.map(e=>e.messageId));for(let e of[...n.current.keys()])o.has(e)||(n.current.delete(e),r.current.delete(e));let s=[];for(let o of e){let e=o.messageId;n.current.has(e)||(n.current.set(e,i),Je(e,o.senderType));let c=r.current.get(e),l=c===void 0?a:Math.min(c,a);r.current.set(e,l);let u=i-(n.current.get(e)??i);s.push(setTimeout(()=>t(e),Math.max(0,l-u)))}return()=>{for(let e of s)clearTimeout(e)}},[e,t]),e.length===0?null:(0,M.jsx)(`div`,{className:`channel-notify-host`,children:[...e].reverse().map(e=>(0,M.jsxs)(`div`,{className:`channel-notify-card channel-notify-card-${e.channel}`,role:`status`,children:[(0,M.jsxs)(`div`,{className:`channel-notify-head`,children:[(0,M.jsx)(`span`,{className:`channel-notify-pill channel-notify-pill-${e.channel}-${e.senderType}`,children:(0,M.jsx)(Ye,{type:e.senderType})}),(0,M.jsx)(`span`,{className:`channel-notify-account`,children:e.accountName})]}),(0,M.jsx)(`div`,{className:`channel-notify-sender`,children:e.senderDisplay}),(0,M.jsxs)(`div`,{className:`channel-notify-body`,children:[e.body,e.truncated?`…`:``]})]},e.messageId))})}var Ze=`channel-notify`;function Qe({connected:e,onConnectClaude:t}){return e?(0,M.jsxs)(`span`,{className:`claude-status-pill`,"data-connected":`true`,title:`Claude is connected`,children:[(0,M.jsx)(`img`,{src:`/brand/claude.png`,alt:``,className:`claude-status-pill__mark`}),(0,M.jsx)(`span`,{className:`claude-status-pill__label`,children:`Connected`}),(0,M.jsx)(`span`,{className:`claude-status-pill__dot claude-status-pill__dot--live`,"aria-hidden":`true`})]}):(0,M.jsxs)(`button`,{type:`button`,className:`claude-status-pill claude-status-pill--action`,"data-connected":`false`,onClick:t,title:`Connect Claude`,children:[(0,M.jsx)(`img`,{src:`/brand/claude.png`,alt:``,className:`claude-status-pill__mark`}),(0,M.jsx)(`span`,{className:`claude-status-pill__label`,children:`Connect`}),(0,M.jsx)(`span`,{className:`claude-status-pill__dot claude-status-pill__dot--down`,"aria-hidden":`true`})]})}function $e(e){return e===`/`||e===``?`Dashboard`:e.startsWith(`/chat`)?`Chat`:e.startsWith(`/tasks`)?`Tasks`:e.startsWith(`/data`)?`Data`:e.startsWith(`/calendar`)?`Calendar`:e.startsWith(`/graph`)?`Graph`:e.startsWith(`/activity`)?`Activity`:e.startsWith(`/browser`)?`Browser`:e.startsWith(`/routines`)?`Routines`:e.startsWith(`/skills`)?`Skills`:e.startsWith(`/agents`)?`Agents`:`Dashboard`}function et({title:e,sidebarOpen:t,onToggleSidebar:n,claudeConnected:r,onConnectClaude:i,onOpenBrowser:a}){let o=e??$e(typeof window<`u`?window.location.pathname:`/`),s=r!==void 0&&i!==void 0,c=a!==void 0;return(0,M.jsxs)(`header`,{className:`admin-page-header`,children:[(0,M.jsxs)(`button`,{type:`button`,className:`admin-page-header__toggle`,"aria-label":t?`Hide sidebar`:`Show sidebar`,title:t?`Hide sidebar`:`Show sidebar`,"aria-expanded":t,onClick:n,children:[(0,M.jsx)(z,{className:`admin-page-header__toggle-desktop`,size:18,strokeWidth:1.75}),(0,M.jsx)(j,{className:`admin-page-header__toggle-mobile`,size:22,strokeWidth:1.75})]}),(0,M.jsx)(`h1`,{className:`admin-page-header__title`,children:o}),(0,M.jsxs)(`div`,{className:`admin-page-header__right`,children:[(0,M.jsx)(oe,{}),s&&(0,M.jsx)(Qe,{connected:r,onConnectClaude:i}),c&&(0,M.jsx)(`button`,{type:`button`,className:`admin-page-header__icon`,"aria-label":`Show browser`,title:`Show browser`,onClick:a,children:(0,M.jsx)(x,{size:18,strokeWidth:1.75})})]})]})}var tt=[{label:`Home`,href:`/`,Icon:d,match:e=>e===`/`||e===``},{label:`Chat`,href:`/chat`,Icon:y,match:e=>e.startsWith(`/chat`)},{label:`Tasks`,href:`/tasks`,Icon:be,match:e=>e.startsWith(`/tasks`)},{label:`Data`,href:`/data`,Icon:m,match:e=>e.startsWith(`/data`)},{label:`Calendar`,href:`/calendar`,Icon:p,match:e=>e.startsWith(`/calendar`)}],nt=[{label:`Chat`,href:`/`,Icon:y,match:e=>e===`/`||e===``||e.startsWith(`/chat`)},{label:`Data`,href:`/data`,Icon:m,match:e=>e.startsWith(`/data`)}];function rt(e){let t=tt.find(t=>t.match(e));return t?t.href:`/`}function it({variant:e=`admin`,onOpenConversations:t}={}){let n=typeof window<`u`?window.location.pathname:`/`,r=e===`operator`?nt:tt,i=e===`operator`?nt.find(e=>e.match(n))?.href??`/`:rt(n),a=e=>{let t=e.href===i,{Icon:n}=e;return(0,M.jsxs)(`a`,{href:e.href,className:`bottom-tab${t?` is-active`:``}`,"aria-current":t?`page`:void 0,children:[(0,M.jsx)(n,{size:19,strokeWidth:1.75}),(0,M.jsx)(`span`,{className:`bottom-tab__label`,children:e.label})]},e.href)};return(0,M.jsxs)(`nav`,{className:`bottom-tab-bar`,"aria-label":`Primary`,children:[r.slice(0,1).map(a),e===`operator`&&t&&(0,M.jsxs)(`button`,{type:`button`,className:`bottom-tab`,onClick:t,children:[(0,M.jsx)(y,{size:19,strokeWidth:1.75}),(0,M.jsx)(`span`,{className:`bottom-tab__label`,children:`Conversations`})]}),r.slice(1).map(a)]})}var at=`maxy-shell-side-px`;function W(){if(typeof window>`u`)return 0;let e=document.querySelector(`.platform > .artefact`)?.getBoundingClientRect();return e&&e.width>0?Math.round(e.width):0}function ot(e){if(typeof window>`u`)return e;let t=window.innerWidth,n=Math.max(248,t-480-W());return Math.min(Math.max(e,248),n)}function st(){if(typeof window>`u`)return 264;try{let e=window.localStorage.getItem(at);if(!e)return 264;let t=parseInt(e,10);if(!Number.isFinite(t))return console.warn(`[admin-ui] sidebar-width-parse-failed stored=${JSON.stringify(e)} fallback=264`),264;if(t>=248)return ot(t)}catch{}return 264}function ct({targetSelector:e=`.platform`}){let t=(0,N.useRef)(null),[n,r]=(0,N.useState)(()=>st()),i=(0,N.useRef)(n);(0,N.useLayoutEffect)(()=>{let t=document.querySelector(e);!t||!(t instanceof HTMLElement)||(t.style.setProperty(`--side-px`,`${n}px`),i.current=n)},[n,e]);let a=(0,N.useCallback)(()=>{r(e=>{let t=ot(e);return t===e?e:t})},[]);(0,N.useEffect)(()=>{a(),window.addEventListener(`resize`,a);let t=document.querySelector(e),n=null;return t instanceof HTMLElement&&(n=new MutationObserver(a),n.observe(t,{attributes:!0,attributeFilter:[`data-artefact`,`class`]})),()=>{window.removeEventListener(`resize`,a),n?.disconnect()}},[a,e]);let o=e=>{e.preventDefault();let n=t.current;if(!n)return;n.setPointerCapture(e.pointerId),n.classList.add(`dragging`);let a=!1,o=e=>{a=!0,r(ot(Math.round(e.clientX)))},s=()=>{if(n.releasePointerCapture(e.pointerId),n.classList.remove(`dragging`),window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),!a)return;let t=i.current;try{window.localStorage.setItem(at,String(t))}catch{}};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s)},s=()=>{r(ot(264));try{window.localStorage.removeItem(at)}catch{}};return(0,M.jsx)(`div`,{ref:t,className:`side-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,onPointerDown:o,onDoubleClick:s})}var lt=n();function ut(e){return Math.max(14,e/2-386)}function dt(e){return e.left===0&&e.top===0&&e.width===0&&e.height===0}var ft={position:`fixed`,visibility:`hidden`};function G({anchorRef:e,onClose:t,className:n,role:r,ariaLabel:i,anchorId:a,children:o}){let s=(0,N.useRef)(null),[c,l]=(0,N.useState)(ft),u=(0,N.useCallback)(()=>{let t=s.current;if(!t)return;let r=e.current,i=[n,a].filter(Boolean).join(`:`)||`unknown`,o=t.getBoundingClientRect(),c=window.innerWidth,u=window.innerHeight,d=o.width>0&&o.height>0,f=r?r.getBoundingClientRect():null,p=(e,t)=>console.error(`[anchored-popover] op=offscreen id=${i} left=${e} top=${t} w=${o.width} h=${o.height} viewport=${c},${u}`);if(!f){l({position:`fixed`,left:Math.max(4,c-o.width-ut(c)),top:Math.max(4,u-o.height-14),visibility:`visible`});return}if(d&&dt(f)){l(ft),p(f.left,f.top);return}let m=f.right-o.width,h=c-o.width-4;m>h&&(m=h),m<4&&(m=4);let g=u-f.bottom-4,_=f.top-4,ee=o.height+8<=g?!1:o.height+8<=_?!0:_>g,v=Math.max(0,ee?_:g),y=ee?Math.max(4,f.top-Math.min(o.height,v)):f.bottom;l({position:`fixed`,left:m,top:y,maxHeight:v,visibility:`visible`});let b=Math.min(o.height,v);d&&(m+o.width<=0||m>=c||y+b<=0||y>=u)&&p(m,y)},[e,a,n]);return(0,N.useLayoutEffect)(()=>{if(u(),typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>u());return s.current&&e.observe(s.current),()=>e.disconnect()},[u]),(0,N.useEffect)(()=>{let n=e=>{e.key===`Escape`&&t()},r=n=>{let r=n.target;e.current?.contains(r)||s.current?.contains(r)||t()},i=n=>{let r=e.current;r&&n.target instanceof Node&&n.target.contains(r)&&t()},a=()=>t();return document.addEventListener(`keydown`,n),document.addEventListener(`pointerdown`,r),window.addEventListener(`scroll`,i,!0),window.addEventListener(`resize`,a),()=>{document.removeEventListener(`keydown`,n),document.removeEventListener(`pointerdown`,r),window.removeEventListener(`scroll`,i,!0),window.removeEventListener(`resize`,a)}},[e,t]),(0,lt.createPortal)((0,M.jsx)(`div`,{ref:s,className:n,role:r,"aria-label":i,style:c,children:o}),document.body)}function pt({actions:e,disabled:t,label:n=`Session actions`}){let[r,i]=(0,N.useState)(!1),[a,o]=(0,N.useState)(null),s=(0,N.useRef)(null),c=(0,N.useCallback)(()=>{i(!1),o(null)},[]);return(0,M.jsxs)(`div`,{className:`conv-actions`,children:[(0,M.jsx)(`button`,{ref:s,type:`button`,className:`conv-action conv-actions-overflow`,onClick:()=>i(e=>!e),disabled:t,"aria-haspopup":`menu`,"aria-expanded":r,"aria-label":n,title:n,children:(0,M.jsx)(j,{size:12})}),r&&(0,M.jsx)(G,{anchorRef:s,onClose:c,className:`conv-actions-menu`,role:`menu`,children:e.map(e=>e.panel?(0,M.jsxs)(`div`,{className:`conv-actions-menu-disclosure`,children:[(0,M.jsxs)(`button`,{type:`button`,role:`menuitem`,"aria-haspopup":`dialog`,"aria-expanded":a===e.key,title:e.title,disabled:t||e.disabled,onClick:()=>o(t=>t===e.key?null:e.key),children:[e.icon,(0,M.jsx)(`span`,{children:e.menuLabel})]}),a===e.key&&(0,M.jsx)(`div`,{className:`conv-actions-menu-panel`,children:e.panel()})]},e.key):(0,M.jsxs)(`button`,{type:`button`,role:`menuitem`,className:e.danger?`conv-action-danger`:void 0,"aria-busy":e.busy,title:e.title,disabled:t||e.disabled,onClick:t=>{e.onClick?.(t),c()},children:[e.icon,(0,M.jsx)(`span`,{children:e.menuLabel})]},e.key))})]})}var mt=`claude-opus-5[1m]`,K=`claude-sonnet-5`,q=`claude-haiku-4-5`,ht={[mt]:`Opus 5 (1M context)`,[K]:`Sonnet 5`,[q]:`Haiku 4.5`};function gt(e){return ht[e]??e}var _t=[mt,K,q];function J(e){return e.replace(/\[1m\]$/,``)}function vt(e){return _t.find(t=>J(t)===J(e))??e}var yt=[`default`,`acceptEdits`,`plan`,`auto`,`bypassPermissions`],bt=[`low`,`medium`,`high`,`xhigh`];[...yt],[...bt],[...bt];var xt=[mt,K,q],St={default:`Ask permissions`,acceptEdits:`Accept edits`,plan:`Plan mode`,auto:`Auto mode`,bypassPermissions:`Bypass permissions`},Ct=yt.map(e=>({value:e,label:St[e]??e})),wt={low:`Low`,medium:`Medium`,high:`High`,xhigh:`Highest`},Tt=bt.map(e=>({value:e,label:wt[e]??e}));function Et(e){if(e){let t=xt.find(t=>J(t)===J(e));if(t)return t}return mt}function Dt({row:e,adminFetch:t,onError:n}){let[r,i]=(0,N.useState)(()=>Et(e.model)),[a,o]=(0,N.useState)(``),[s,c]=(0,N.useState)(``),[l,u]=(0,N.useState)(!1),d=(0,N.useRef)(!1);(0,N.useEffect)(()=>{i(Et(e.model))},[e.model]);let f=async()=>{if(!d.current){d.current=!0,u(!0);try{let i=await t(`/api/admin/session-reseat`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({fromSessionId:e.sessionId,model:r,...a?{permissionMode:a}:{},...s?{effort:s}:{}})});if(!i.ok){n(`Could not reset ${e.title} (status ${i.status})`),console.error(`[admin-ui] dashboard-reseat-failed sessionId=${e.sessionId} status=${i.status}`),d.current=!1,u(!1);return}let o=await i.json().catch(()=>({}));o.target?window.location.assign(o.target):(n(`Reset of ${e.title} returned no target`),d.current=!1,u(!1))}catch(t){n(`Could not reset ${e.title} (network error)`),console.error(`[admin-ui] dashboard-reseat-failed sessionId=${e.sessionId} error=${t instanceof Error?t.message:String(t)}`),d.current=!1,u(!1)}}};return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`label`,{className:`reseat-field`,children:[(0,M.jsx)(`span`,{children:`Model`}),(0,M.jsx)(`select`,{"data-kind":`model`,value:r,disabled:l,onChange:e=>i(e.target.value),children:xt.map(e=>(0,M.jsx)(`option`,{value:e,children:gt(e)},e))})]}),(0,M.jsxs)(`label`,{className:`reseat-field`,children:[(0,M.jsx)(`span`,{children:`Mode`}),(0,M.jsxs)(`select`,{"data-kind":`mode`,value:a,disabled:l,onChange:e=>o(e.target.value),children:[(0,M.jsx)(`option`,{value:``,children:`Keep current`}),Ct.map(e=>(0,M.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(0,M.jsxs)(`label`,{className:`reseat-field`,children:[(0,M.jsx)(`span`,{children:`Effort`}),(0,M.jsxs)(`select`,{"data-kind":`effort`,value:s,disabled:l,onChange:e=>c(e.target.value),children:[(0,M.jsx)(`option`,{value:``,children:`Keep current`}),Tt.map(e=>(0,M.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(0,M.jsx)(`button`,{type:`button`,className:`reseat-apply`,disabled:l,"aria-busy":l,onClick:()=>void f(),children:l?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(te,{size:12,className:`spin`,"aria-hidden":`true`}),`Resetting…`]}):`Reset`})]})}function Y(e){if(e<60)return`${e}s`;let t=Math.floor(e/60),n=e%60;return n>0?`${t}m ${n}s`:`${t}m`}function Ot(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function kt({target:e,anchorEl:t,onConfirm:n,onCancel:r}){let i=(0,N.useRef)(null);return i.current=t,e?(0,M.jsxs)(G,{anchorRef:i,onClose:r,className:`conv-delete-confirm`,role:`alertdialog`,ariaLabel:`Confirm delete session`,children:[(0,M.jsxs)(`div`,{className:`claude-info-header`,children:[(0,M.jsx)(`span`,{children:`Delete this conversation?`}),(0,M.jsx)(`button`,{className:`claude-info-close`,onClick:r,"aria-label":`Close`,children:`✕`})]}),(0,M.jsxs)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`,fontSize:`11px`,color:`var(--text-secondary)`},children:[(0,M.jsxs)(`div`,{className:`conv-delete-target`,children:[(0,M.jsx)(`span`,{className:`conv-delete-label`,title:e.title,children:e.title||`Untitled session`}),(0,M.jsx)(`code`,{className:`conv-delete-id`,title:e.sessionId,children:e.sessionId.slice(0,8)})]}),(0,M.jsx)(`div`,{style:{marginTop:`8px`},children:`This permanently removes the transcript. It is not moved to Archive and cannot be recovered.`}),e.live&&(0,M.jsx)(`div`,{style:{marginTop:`8px`},children:`This session is running; deleting stops it first.`})]}),(0,M.jsxs)(`div`,{className:`claude-info-section`,style:{display:`flex`,gap:`8px`,padding:`10px 14px`},children:[(0,M.jsx)(I,{variant:`danger`,size:`sm`,style:{flex:1},onClick:n,children:`Delete`}),(0,M.jsx)(I,{variant:`secondary`,size:`sm`,style:{flex:1},onClick:r,children:`Cancel`})]})]}):null}function At({target:e,anchorEl:t,onConfirm:n,onCancel:r}){let i=(0,N.useRef)(null);return i.current=t,e?(0,M.jsxs)(G,{anchorRef:i,onClose:r,className:`conv-delete-confirm`,role:`alertdialog`,ariaLabel:`Confirm delete task`,children:[(0,M.jsxs)(`div`,{className:`claude-info-header`,children:[(0,M.jsx)(`span`,{children:`Delete this task?`}),(0,M.jsx)(`button`,{className:`claude-info-close`,onClick:r,"aria-label":`Close`,children:`✕`})]}),(0,M.jsxs)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`,fontSize:`11px`,color:`var(--text-secondary)`},children:[(0,M.jsxs)(`div`,{className:`conv-delete-target`,children:[(0,M.jsx)(`span`,{className:`conv-delete-label`,title:e.name,children:e.name}),(0,M.jsx)(`code`,{className:`conv-delete-id`,children:ce(e.secondsLogged)})]}),(0,M.jsx)(`div`,{style:{marginTop:`8px`},children:`This permanently removes the task and every time record on it. It cannot be recovered.`})]}),(0,M.jsxs)(`div`,{className:`claude-info-section`,style:{display:`flex`,gap:`8px`,padding:`10px 14px`},children:[(0,M.jsx)(I,{variant:`danger`,size:`sm`,style:{flex:1},onClick:n,children:`Delete`}),(0,M.jsx)(I,{variant:`secondary`,size:`sm`,style:{flex:1},onClick:r,children:`Cancel`})]})]}):null}function jt({open:e,count:t,liveCount:n,onConfirm:r,onCancel:i}){if(!e)return null;let a=t===1?``:`s`;return(0,M.jsx)(`div`,{className:`claude-info-overlay`,onClick:i,children:(0,M.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),role:`alertdialog`,"aria-label":`Confirm delete sessions`,children:[(0,M.jsxs)(`div`,{className:`claude-info-header`,children:[(0,M.jsxs)(`span`,{children:[`Delete `,t,` conversation`,a,`?`]}),(0,M.jsx)(`button`,{className:`claude-info-close`,onClick:i,"aria-label":`Close`,children:`✕`})]}),(0,M.jsxs)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`,fontSize:`11px`,color:`var(--text-secondary)`},children:[`This permanently removes `,t,` transcript`,a,`. `,t===1?`It is`:`They are`,` not moved to Archive and cannot be recovered.`,n>0&&(0,M.jsxs)(`div`,{style:{marginTop:`8px`},children:[n,` `,n===1?`is`:`are`,` running and will be stopped first.`]})]}),(0,M.jsxs)(`div`,{className:`claude-info-section`,style:{display:`flex`,gap:`8px`,padding:`10px 14px`},children:[(0,M.jsxs)(I,{variant:`danger`,size:`sm`,style:{flex:1},onClick:r,children:[`Delete `,t]}),(0,M.jsx)(I,{variant:`secondary`,size:`sm`,style:{flex:1},onClick:i,children:`Cancel`})]})]})})}function Mt(e,t){return`New session: ${w(e.toISOString(),t)}`}function Nt({open:e,pending:t,onConfirm:n,onCancel:r,now:i}){let{zone:a}=A(),[o,s]=(0,N.useState)(``),c=(0,N.useRef)(null),l=(0,N.useRef)(null),u=(0,N.useRef)(!1);if((0,N.useEffect)(()=>{if(!e){l.current=null,u.current=!1;return}if(l.current!==null)return;let t=Mt(i?i():new Date,a);l.current=t,s(t)},[e,i]),(0,N.useEffect)(()=>{if(!e||u.current||l.current===null||o!==l.current)return;let t=c.current;t&&(u.current=!0,t.focus(),t.setSelectionRange(0,t.value.length))},[e,o]),!e)return null;let d=o.trim(),f=d.length>0&&d.length<=200,p=()=>{f&&!t&&n(d)},m=e=>{t||r(e)};return(0,M.jsx)(`div`,{className:`claude-info-overlay`,onClick:()=>m(`backdrop`),children:(0,M.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),role:`dialog`,"aria-label":`Name this session`,children:[(0,M.jsxs)(`div`,{className:`claude-info-header`,children:[(0,M.jsx)(`span`,{children:`Name this session`}),(0,M.jsx)(`button`,{className:`claude-info-close`,onClick:()=>m(`cancel`),"aria-label":`Close`,disabled:t,children:`✕`})]}),(0,M.jsxs)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`},children:[(0,M.jsx)(`input`,{ref:c,className:`new-session-name-input`,"aria-label":`Session name`,value:o,disabled:t,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),p()),e.key===`Escape`&&(e.preventDefault(),m(`escape`))}}),(0,M.jsx)(`div`,{className:`new-session-name-hint`,children:d.length>200?`Too long by ${d.length-200}`:`You can rename it later from the session menu.`})]}),(0,M.jsxs)(`div`,{className:`claude-info-section`,style:{display:`flex`,gap:`8px`,padding:`10px 14px`},children:[(0,M.jsx)(I,{variant:`primary`,size:`sm`,style:{flex:1},disabled:!f||t,onClick:p,children:t?`Starting…`:`Start session`}),(0,M.jsx)(I,{variant:`secondary`,size:`sm`,style:{flex:1},disabled:t,onClick:()=>m(`cancel`),children:`Cancel`})]})]})})}var Pt=`auth-refresh-failed`;function Ft({error:e,onClose:t}){if(!e)return null;let n=e.reason===Pt,r=n?`Claude sign-in expired`:`Session didn’t open`,i=n?`Your claude.ai login has expired. Re-authenticate to resume sessions.`:`The session did not bind within 60 seconds, so there is no live conversation to open.`;return(0,M.jsx)(`div`,{className:`claude-info-overlay`,onClick:t,children:(0,M.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),role:`alertdialog`,"aria-label":`Session could not be opened`,children:[(0,M.jsxs)(`div`,{className:`claude-info-header`,children:[(0,M.jsx)(`span`,{children:r}),(0,M.jsx)(`button`,{className:`claude-info-close`,onClick:t,"aria-label":`Close`,children:`✕`})]}),(0,M.jsxs)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`,fontSize:`11px`,color:`var(--text-secondary)`},children:[i,(0,M.jsxs)(`div`,{className:`claude-info-row`,style:{marginTop:`8px`},children:[(0,M.jsx)(`span`,{className:`claude-info-label`,children:`Reason`}),(0,M.jsx)(`span`,{className:`claude-info-value`,children:e.reason})]}),e.sessionId&&(0,M.jsxs)(`div`,{className:`claude-info-row`,children:[(0,M.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,M.jsxs)(`span`,{className:`claude-info-value`,children:[e.sessionId.slice(0,8),`…`]})]})]})]})})}function It(e){let{show:t,onClose:n,claudeInfo:r,messages:i,sessionElapsed:a,sessionId:o,cacheKey:s}=e,[c,l]=(0,N.useState)(null);if(!t)return null;let u=i.flatMap(e=>e.events?.filter(e=>e.type===`usage`)??[]),d=u.at(-1),f=d?.peak_request_pct==null?d?.context_window?Math.round((d.input_tokens+d.cache_creation_tokens+d.cache_read_tokens)/d.context_window*100):0:Math.round(d.peak_request_pct*100),p=u.reduce((e,t)=>e+t.input_tokens+t.cache_creation_tokens+t.cache_read_tokens+t.output_tokens,0),m=i.flatMap(e=>e.events?.filter(e=>e.type===`rate_limit`)??[]).at(-1),h=u.reduce((e,t)=>e+(t.total_cost_usd??0),0),g=r?.account?.subscriptionType,_=e=>{let t=e*1e3-Date.now();if(t<=0)return`now`;let n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4);return n>0?`${n}h ${r}m`:`${r}m`};return(0,M.jsx)(`div`,{className:`claude-info-overlay`,onClick:n,children:(0,M.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),children:[(0,M.jsxs)(`div`,{className:`claude-info-header`,children:[(0,M.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`claude-info-icon`}),(0,M.jsx)(`span`,{children:`Claude Code`}),(0,M.jsx)(`button`,{className:`claude-info-close`,onClick:n,"aria-label":`Close`,children:`✕`})]}),(0,M.jsxs)(`div`,{className:`claude-info-section`,children:[(0,M.jsxs)(`div`,{className:`claude-info-row`,children:[(0,M.jsx)(`span`,{className:`claude-info-label`,children:`Version`}),(0,M.jsx)(`span`,{className:`claude-info-value`,children:r?r.version:`…`})]}),(0,M.jsxs)(`div`,{className:`claude-info-row`,children:[(0,M.jsx)(`span`,{className:`claude-info-label`,children:`Email`}),(0,M.jsx)(`span`,{className:`claude-info-value`,children:r?.account?.email??`…`})]})]}),(g||m||h>0)&&(0,M.jsxs)(`div`,{className:`claude-info-section`,children:[g&&(0,M.jsxs)(`div`,{className:`claude-info-row`,children:[(0,M.jsx)(`span`,{className:`claude-info-label`,children:`Plan`}),(0,M.jsx)(`span`,{className:`claude-info-value`,style:{textTransform:`capitalize`},children:g})]}),m&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`claude-info-row`,children:[(0,M.jsx)(`span`,{className:`claude-info-label`,children:`Usage`}),(0,M.jsxs)(`span`,{className:`claude-info-value`,children:[Math.round(m.utilization*100),`%`]})]}),(0,M.jsxs)(`div`,{className:`claude-info-row`,children:[(0,M.jsx)(`span`,{className:`claude-info-label`,children:`Resets in`}),(0,M.jsx)(`span`,{className:`claude-info-value`,children:_(m.resetsAt)})]}),m.isUsingOverage&&(0,M.jsxs)(`div`,{className:`claude-info-row`,children:[(0,M.jsx)(`span`,{className:`claude-info-label`,children:`Overage`}),(0,M.jsx)(`span`,{className:`claude-info-value`,children:`Active`})]})]}),h>0&&(0,M.jsxs)(`div`,{className:`claude-info-row`,children:[(0,M.jsx)(`span`,{className:`claude-info-label`,children:`Session cost`}),(0,M.jsxs)(`span`,{className:`claude-info-value`,children:[`$`,h<.01?h.toFixed(4):h.toFixed(2)]})]})]}),(0,M.jsxs)(`div`,{className:`claude-info-section`,children:[(0,M.jsxs)(`div`,{className:`claude-info-row`,children:[(0,M.jsx)(`span`,{className:`claude-info-label`,children:`Model`}),(0,M.jsx)(`span`,{className:`claude-info-value`,children:r?.model??`…`})]}),(0,M.jsxs)(`div`,{className:`claude-info-row`,children:[(0,M.jsx)(`span`,{className:`claude-info-label`,children:`Context used`}),(0,M.jsx)(`span`,{className:`claude-info-value`,children:f>0?`${f}%`:`—`})]}),(0,M.jsxs)(`div`,{className:`claude-info-row`,children:[(0,M.jsx)(`span`,{className:`claude-info-label`,children:`Tokens`}),(0,M.jsx)(`span`,{className:`claude-info-value`,children:p>0?Ot(p):`—`})]}),(0,M.jsxs)(`div`,{className:`claude-info-row`,children:[(0,M.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,M.jsx)(`span`,{className:`claude-info-value`,children:Y(a)})]}),(o||s)&&(()=>{let e=o??s??``;return(0,M.jsxs)(`div`,{className:`claude-info-row`,children:[(0,M.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,M.jsx)(`button`,{type:`button`,className:`claude-info-value claude-info-id-copy`,title:`${e} (${o?`flushed`:`pre-flush`}) — click to copy`,onClick:async()=>{l(await T(e)?`copied`:`failed`),setTimeout(()=>l(null),1200)},children:c===`copied`?`copied ✓`:c===`failed`?`copy failed ✕`:`${e.slice(0,8)}…`})]})})()]})]})})}function Lt({open:e,installed:t,latest:n,initialActionId:r,onClose:i}){let[a,o]=(0,N.useState)(r),[s,c]=(0,N.useState)(``),[l,u]=(0,N.useState)(!1),[d,f]=(0,N.useState)(!1),[p,m]=(0,N.useState)(null),[h,g]=(0,N.useState)(null),_=(0,N.useRef)(null);(0,N.useEffect)(()=>{o(r)},[r]),(0,N.useEffect)(()=>{if(!e||!a)return;let t=new EventSource(`/api/admin/actions/${a}/stream`);return t.onmessage=e=>{f(!1),c(t=>t+e.data+`
2
- `)},t.addEventListener(`done`,e=>{m(JSON.parse(e.data)),t.close()}),t.onerror=()=>{f(!0)},()=>{t.close()}},[e,a]),(0,N.useEffect)(()=>{let e=_.current;e&&(e.scrollTop=e.scrollHeight)},[s]);let ee=(0,N.useCallback)(async()=>{u(!0),g(null);try{let e=await fetch(`/api/admin/actions/upgrade`,{method:`POST`}),t=await e.json().catch(()=>({}));if(!e.ok){g(t?.reason===`systemd-run-absent`?`This host has no systemd, so the installer cannot be started from here.`:`Could not start the update (HTTP ${e.status}).`);return}o(t.actionId)}catch(e){console.error(`[admin-ui] update-start failed:`,e),g(e instanceof Error?e.message:String(e))}finally{u(!1)}},[]);return e?(0,M.jsx)(`div`,{className:`claude-info-overlay`,onClick:i,children:(0,M.jsxs)(`div`,{className:`claude-info-modal update-modal`,onClick:e=>e.stopPropagation(),role:`dialog`,"aria-label":`Software update`,children:[(0,M.jsxs)(`div`,{className:`claude-info-header`,children:[(0,M.jsx)(`span`,{children:`Software update`}),(0,M.jsx)(`button`,{className:`claude-info-close`,onClick:i,"aria-label":`Close`,children:`✕`})]}),(0,M.jsxs)(`div`,{className:`update-modal-body`,children:[(0,M.jsxs)(`div`,{className:`update-modal-versions`,children:[(0,M.jsxs)(`div`,{className:`claude-info-row`,children:[(0,M.jsx)(`span`,{className:`claude-info-label`,children:`Installed`}),(0,M.jsx)(`span`,{className:`claude-info-value`,children:t})]}),(0,M.jsxs)(`div`,{className:`claude-info-row`,children:[(0,M.jsx)(`span`,{className:`claude-info-label`,children:`Latest`}),(0,M.jsx)(`span`,{className:`claude-info-value update-version-new`,children:n??`unknown`})]})]}),h&&(0,M.jsx)(`div`,{className:`update-modal-launch-error`,children:h}),!a&&(0,M.jsx)(I,{variant:`primary`,size:`sm`,className:`update-modal-btn`,disabled:l,onClick:()=>{ee()},children:l?`Starting…`:`Update`}),a&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`pre`,{className:`update-modal-output`,ref:_,children:s}),d&&!p&&(0,M.jsx)(`div`,{className:`update-modal-reconnecting`,children:`Reconnecting. The update restarts the server, so this gap is expected and the install keeps running.`}),p&&(0,M.jsx)(`div`,{className:`update-modal-result`,children:p.code===0&&p.changed?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{className:`update-success-icon`,children:`✓`}),` Updated to `,p.versionAfter,`.`]}):p.code===0?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{className:`update-error-icon`,children:`!`}),` The installer finished but the version is still `,p.versionAfter,`.`]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{className:`update-error-icon`,children:`!`}),` The installer exited with code `,p.code,`.`]})})]})]})]})}):null}function Rt({open:e,onConnect:t,onClose:n}){return e?(0,M.jsx)(`div`,{className:`claude-info-overlay`,onClick:n,children:(0,M.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),role:`alertdialog`,"aria-label":`Claude is not connected`,children:[(0,M.jsxs)(`div`,{className:`claude-info-header`,children:[(0,M.jsx)(`span`,{children:`Claude isn’t connected`}),(0,M.jsx)(`button`,{className:`claude-info-close`,onClick:n,"aria-label":`Close`,children:`✕`})]}),(0,M.jsxs)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`,fontSize:`11px`,color:`var(--text-secondary)`,display:`flex`,flexDirection:`column`,gap:`10px`},children:[(0,M.jsx)(`span`,{children:`This needs Claude, which is currently disconnected. Connect to continue — the rest of the dashboard stays available either way.`}),(0,M.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,alignItems:`center`},children:[(0,M.jsx)(I,{variant:`primary`,size:`sm`,onClick:t,children:`Connect Claude`}),(0,M.jsx)(`button`,{type:`button`,className:`claude-info-close`,style:{fontSize:`11px`},onClick:n,children:`Not now`})]})]})]})}):null}function zt(e){let t=Math.round(e/6e4),n=Math.floor(t/60),r=t%60;return`${n}h ${String(r).padStart(2,`0`)}m`}function Bt(e){return e.activeMs.thinking+e.activeMs.messaging+e.activeMs.toolUse}function Vt(e){return e.toLocaleString(`en-GB`)}function Ht(e){return`£${e.toFixed(2)}`}function Ut(e){let t=[`Day`,`Active`,`Output tokens`,`Input tokens`,`Cache write`,`Cache read`,`Opus 5 (GBP)`,`Sonnet 5 (GBP)`],n=(e,t)=>[e,zt(Bt(t)),String(t.tokens.output),String(t.tokens.input),String(t.tokens.cacheWrite),String(t.tokens.cacheRead),t.costGBP.opus.toFixed(2),t.costGBP.sonnet.toFixed(2)];return[t,...e.days.map(e=>n(e.date,e)),n(`TOTAL (${e.days.length} d)`,e.totals)].map(e=>e.join(`,`)).join(`
3
- `)}function X({label:e,d:t,bold:n}){let r=n?`th`:`td`;return(0,M.jsxs)(`tr`,{className:n?`usage-total-row`:void 0,children:[(0,M.jsx)(r,{className:`usage-day`,children:e}),(0,M.jsx)(r,{children:zt(Bt(t))}),(0,M.jsx)(r,{children:Vt(t.tokens.output)}),(0,M.jsx)(r,{children:Vt(t.tokens.input)}),(0,M.jsx)(r,{children:Vt(t.tokens.cacheWrite)}),(0,M.jsx)(r,{children:Vt(t.tokens.cacheRead)}),(0,M.jsx)(r,{children:Ht(t.costGBP.opus)}),(0,M.jsx)(r,{children:Ht(t.costGBP.sonnet)})]})}function Wt({show:e,onClose:t,anchorEl:n,sessionId:r,summary:i,loading:a,error:o}){let s=(0,N.useRef)(null);if(s.current=n,!e)return null;let c=!!i&&i.days.length>0;return(0,M.jsxs)(G,{anchorRef:s,onClose:t,className:`usage-popover`,role:`dialog`,ariaLabel:`Session usage and cost`,anchorId:r??void 0,children:[(0,M.jsxs)(`div`,{className:`claude-info-header`,children:[(0,M.jsxs)(`span`,{children:[`Usage & cost`,r?` · ${r.slice(0,8)}`:``]}),c&&(0,M.jsx)(`button`,{className:`usage-download`,onClick:()=>{if(!i)return;let e=new Blob([Ut(i)],{type:`text/csv;charset=utf-8`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`usage-${r?r.slice(0,8):`session`}.csv`,document.body.appendChild(n),n.click(),n.remove(),URL.revokeObjectURL(t)},"aria-label":`Download as CSV`,title:`Download as CSV`,children:(0,M.jsx)(u,{size:14})}),(0,M.jsx)(`button`,{className:`claude-info-close`,onClick:t,"aria-label":`Close`,children:(0,M.jsx)(E,{size:14})})]}),(0,M.jsxs)(`div`,{className:`claude-info-section usage-body`,children:[a&&(0,M.jsx)(`div`,{className:`usage-note`,children:`Computing usage…`}),!a&&o&&(0,M.jsx)(`div`,{className:`usage-note usage-error`,children:o}),!a&&!o&&i&&i.days.length===0&&(0,M.jsx)(`div`,{className:`usage-note`,children:`No usage recorded for this session yet.`}),!a&&!o&&i&&i.days.length>0&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{className:`usage-table-scroll`,children:(0,M.jsxs)(`table`,{className:`usage-table`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{className:`usage-day`,children:`Day`}),(0,M.jsx)(`th`,{children:`Active`}),(0,M.jsx)(`th`,{children:`Output tok`}),(0,M.jsx)(`th`,{children:`Input tok`}),(0,M.jsx)(`th`,{children:`Cache write`}),(0,M.jsx)(`th`,{children:`Cache read`}),(0,M.jsx)(`th`,{children:`Opus 5 (£)`}),(0,M.jsx)(`th`,{children:`Sonnet 5 (£)`})]})}),(0,M.jsxs)(`tbody`,{children:[i.days.map(e=>(0,M.jsx)(X,{label:e.date,d:e},e.date)),(0,M.jsx)(X,{label:`TOTAL (${i.days.length} d)`,d:i.totals,bold:!0})]})]})}),(0,M.jsxs)(`div`,{className:`usage-note usage-caveats`,children:[`Prices dated `,i.pricing.opusPriceDate,` · £/$ `,i.pricing.usdPerGbp,` · Sonnet tokenizer factor `,i.pricing.tokenizerFactor,`. Idle human-wait dominates the calendar span; cache-read tokens dominate cost.`]})]})]})]})}var Gt=`https://claude.ai/code`,Kt=200,qt=[500,1e3,1500,2e3,2500,3e3,3e3];function Jt(e,t,n){if(e&&n.target)return{kind:`navigate`,url:n.target,sameOrigin:!0};let r=n.slug??n.bridgeSessionId??null;if(e&&r)return{kind:`navigate`,url:`${Gt}/${r}`,sameOrigin:!1};let i=n.reason||n.error||`status ${t}`;return{kind:`error`,sessionId:n.sessionId??null,reason:i}}var Yt=`maxy:sidebar:nav-collapsed`;function Xt(e,t){return w(e,t)}function Zt(e){let{zone:t}=A(),{businessName:n,cacheKey:r,onConnectClaude:o,role:ee,userName:b,userAvatar:x,onSelectProjects:re,onSelectTasks:C,onCloseMobileDrawer:w,collapsed:T,onSelectData:ae,initialDataSurface:oe=!1,onLogout:E,onDisconnect:O,disconnecting:k,claudeConnected:ce=!0,subAccounts:le,activeAccountId:j,switchingAccount:de,onSwitchAccount:P,refreshAccounts:F,onOpenConversations:I}=e,L=a(r),Se=(0,N.useCallback)(e=>({key:`reseat`,label:`Reset session ${e.title} (model, mode, effort)`,menuLabel:`Reset`,title:`Reset — move this session onto a chosen model, mode, and effort`,icon:(0,M.jsx)(we,{size:12}),panel:()=>(0,M.jsx)(Dt,{row:e,adminFetch:L,onError:e=>H({message:e,failed:!0})})}),[L]),z=v.productName,Ce=n||z,Oe=typeof b==`string`?b:b===null?`name unavailable`:Ce,ke=(Oe.trim().charAt(0)||`?`).toUpperCase(),[Ae,je]=(0,N.useState)(oe?`data`:`sessions`),[Me,Ne]=(0,N.useState)(!1),[B,Pe]=(0,N.useState)(null),[Fe,Ie]=(0,N.useState)(!1),[Le,Re]=(0,N.useState)(null);(0,N.useEffect)(()=>{let e=!1;return L(`/api/admin/version`).then(e=>e.json()).then(t=>{e||Pe(t)}).catch(e=>console.error(`[admin-ui] sidebar-version fetch failed:`,e)),L(`/api/admin/actions/latest`).then(e=>e.json()).then(t=>{e||Re(t?.action?.running?t.action.actionId:null)}).catch(e=>console.error(`[admin-ui] sidebar-latest-action fetch failed:`,e)),()=>{e=!0}},[L]);let[ze,Be]=(0,N.useState)(!1),Ve=!T&&(le?.length??0)>1&&!!P,He=le?.find(e=>e.isHouse)??null,Ue=(0,N.useCallback)(()=>{He&&He.accountId!==j&&(Be(!1),P?.(He.accountId,`/`))},[He,j,P]),[V,H]=(0,N.useState)(null),[We,Ge]=(0,N.useState)(null),[Ke,qe]=(0,N.useState)(!1),[U,Je]=(0,N.useState)([]),[Ye]=(0,N.useState)(()=>typeof window>`u`?null:new URLSearchParams(window.location.search).get(`session`)),[Xe,Ze]=(0,N.useState)(!1),[Qe,$e]=(0,N.useState)(null),[et,tt]=(0,N.useState)(!1),[nt,rt]=(0,N.useState)(!1),[it,at]=(0,N.useState)(!1),[W,ot]=(0,N.useState)(!1);(0,N.useEffect)(()=>{let e=null;try{e=window.localStorage.getItem(Yt)}catch{e=null}ot(e===`1`)},[]);let st=(0,N.useCallback)(()=>{let e=!W;try{window.localStorage.setItem(Yt,e?`1`:`0`)}catch(e){console.warn(`[admin-ui] sidebar-nav-collapse op=persist-failed error=${e instanceof Error?e.message:String(e)}`)}ot(e)},[W]),[ct,lt]=(0,N.useState)(null),[ut,dt]=(0,N.useState)(new Set),ft=(0,N.useRef)(new Map),[G,mt]=(0,N.useState)(!1),[K,q]=(0,N.useState)(new Set),[ht,gt]=(0,N.useState)(!1),[_t,J]=(0,N.useState)(null),[vt,yt]=(0,N.useState)(new Set),[bt,xt]=(0,N.useState)(new Set),[St,Ct]=(0,N.useState)(new Set),[wt,Tt]=(0,N.useState)(null),[Et,Y]=(0,N.useState)(``),[Ot,At]=(0,N.useState)(!1),[Mt,Pt]=(0,N.useState)(null),[It,zt]=(0,N.useState)(null),[Bt,Vt]=(0,N.useState)(!1),[Ht,Ut]=(0,N.useState)(null),[X,Gt]=(0,N.useState)(!1),[Zt,Qt]=(0,N.useState)(!1),tn=(0,N.useRef)(0);(0,N.useEffect)(()=>{if(!V)return;let e=setTimeout(()=>H(null),2500);return()=>clearTimeout(e)},[V]);let Z=(0,N.useCallback)(async()=>{if(!r)return null;let e=++tn.current;tt(!0),$e(null);try{let t=await L(`/api/admin/sidebar-sessions`);if(!t.ok)throw Error(`status ${t.status}`);let n=await t.json(),r=n.sessions??[];return e===tn.current?(Je(r),lt(n.accountId??null),Ze(!0),r):r}catch(t){let n=t instanceof Error?t.message:String(t);return e===tn.current&&$e(`Failed to load sessions: ${n}`),console.error(`[admin-ui] sidebar-sessions fetch failed: ${n}`),null}finally{e===tn.current&&tt(!1)}},[r,L]);(0,N.useEffect)(()=>{!r||Xe||Z()},[r,Xe,Z]),(0,N.useEffect)(()=>{if(!r)return;let e=null;function t(){Z()}function n(){e===null&&(e=setInterval(t,$t))}function i(){e!==null&&(clearInterval(e),e=null)}function a(){document.hidden?i():(t(),n())}return document.hidden||n(),document.addEventListener(`visibilitychange`,a),()=>{i(),document.removeEventListener(`visibilitychange`,a)}},[r,Z]);let nn=()=>{Z()},rn=()=>{je(`data`),ae(),w()},Q=typeof window<`u`&&window.location?.pathname||`/`,an=Ae===`data`,on=typeof window<`u`&&window.location?.search||``,sn=new URLSearchParams(on),cn=sn.has(`label`)&&!sn.has(`nodeId`),$=e=>{w(),window.location.href=e},ln=[{key:`dashboard`,label:`Dashboard`,icon:(0,M.jsx)(d,{size:17,strokeWidth:1.75}),active:Q===`/`&&!an,onClick:()=>$(`/`)},{key:`chat`,label:`Chat`,icon:(0,M.jsx)(y,{size:17,strokeWidth:1.75}),active:Q.startsWith(`/chat`),onClick:()=>$(`/chat`)},{key:`tasks`,label:`Tasks`,icon:(0,M.jsx)(be,{size:17,strokeWidth:1.75}),active:Q.startsWith(`/tasks`),onClick:()=>{C(),w()}},{key:`calendar`,label:`Calendar`,icon:(0,M.jsx)(p,{size:17,strokeWidth:1.75}),active:Q.startsWith(`/calendar`),onClick:()=>$(`/calendar`)},{key:`routines`,label:`Routines`,icon:(0,M.jsx)(De,{size:17,strokeWidth:1.75}),active:Q.startsWith(`/routines`),onClick:()=>$(`/routines`)},{key:`skills`,label:`Skills`,icon:(0,M.jsx)(Te,{size:17,strokeWidth:1.75}),active:Q.startsWith(`/skills`),onClick:()=>$(`/skills`)},{key:`agents`,label:`Agents`,icon:(0,M.jsx)(R,{size:17,strokeWidth:1.75}),active:Q.startsWith(`/agents`),onClick:()=>$(`/agents`)},{key:`data`,label:`Data`,icon:(0,M.jsx)(m,{size:17,strokeWidth:1.75}),active:an,onClick:rn},{key:`container`,label:ue().term,icon:(0,M.jsx)(S,{size:17,strokeWidth:1.75}),active:Q.startsWith(`/graph`)&&cn,onClick:()=>{re(),w()}},{key:`graph`,label:`Graph`,icon:(0,M.jsx)(Ee,{size:17,strokeWidth:1.75}),active:Q.startsWith(`/graph`)&&!cn,onClick:()=>$(`/graph`)},{key:`activity`,label:`Activity`,icon:(0,M.jsx)(ne,{size:17,strokeWidth:1.75}),active:Q.startsWith(`/activity`),onClick:()=>$(`/activity`)}],un=(0,N.useCallback)(async e=>{if(vt.has(e.sessionId))return;yt(t=>{let n=new Set(t);return n.add(e.sessionId),n});let t=window.open(``,`_blank`);try{let n=await L(`/api/admin/session-rc-spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:e.sessionId,name:e.title||e.sessionId,...e.accountId?{targetAccountId:e.accountId}:{}})}),r=await n.json().catch(()=>({})),i=Jt(n.ok,n.status,{...r,sessionId:r.sessionId??e.sessionId});i.kind===`navigate`?(w(),t?t.location.href=i.url:window.open(i.url,`_blank`)):(t?.close(),console.error(`[admin-ui] sidebar-session-resume-failed sessionId=${e.sessionId} status=${n.status} reason=${i.reason}`),Ge(i))}catch(n){t?.close();let r=n instanceof Error?n.message:String(n);console.error(`[admin-ui] sidebar-session-resume-failed sessionId=${e.sessionId} error=${r}`),Ge({sessionId:e.sessionId,reason:r})}finally{yt(t=>{let n=new Set(t);return n.delete(e.sessionId),n})}},[L,w,vt]),dn=(0,N.useCallback)(async e=>{let t=e.slice(0,8);for(let t=1;t<=qt.length;t++){await new Promise(e=>setTimeout(e,qt[t-1]));let n=await Z();if(n&&n.some(t=>t.sessionId===e))return}console.error(`[admin-ui] sidebar-new-session-converge-timeout sessionId=${t}`)},[Z]),fn=(0,N.useCallback)(async e=>{if(!X){Gt(!0);try{let t=await L(`/api/admin/session-rc-spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:e})}),n=await t.json().catch(()=>({})),r=Jt(t.ok,t.status,n);r.kind===`navigate`?r.sameOrigin?window.location.assign(r.url):(window.open(r.url,`_blank`),n.sessionId?dn(n.sessionId):console.error(`[admin-ui] sidebar-new-session-converge-skipped reason=no-session-id`)):t.status===503||r.reason===`claude-auth-dead`?(Qt(!1),qe(!0)):(console.error(`[admin-ui] sidebar-new-session-failed status=${t.status} reason=${r.reason}`),Qt(!1),Ge(r))}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[admin-ui] sidebar-new-session-failed error=${t}`),Qt(!1),Ge({sessionId:null,reason:t})}finally{Gt(!1)}}},[L,X,dn]),pn=(0,N.useCallback)((e,t)=>{e.stopPropagation(),J(t)},[]),mn=(0,N.useCallback)(async(e,t)=>{e.stopPropagation(),Pt(t),zt(null),Ut(null),Vt(!0);try{let e=await L(`/api/admin/session-usage?sessionId=${encodeURIComponent(t.sessionId)}`),n=await e.json().catch(()=>({}));e.ok?zt(n):Ut(n.error??`status ${e.status}`)}catch(e){Ut(e instanceof Error?e.message:String(e))}finally{Vt(!1)}},[L]),hn=(0,N.useCallback)(async(e,t={})=>{let n=t.refresh??!0;if(ut.has(e.sessionId))return!1;dt(t=>{let n=new Set(t);return n.add(e.sessionId),n});try{let t=await L(`/api/admin/session-delete`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:e.sessionId})});if(!t.ok){let n=await t.json().catch(()=>({}));return console.error(`[admin-ui] sidebar-session-delete-failed sessionId=${e.sessionId} status=${t.status} error=${n.error??`unknown`}`),H({message:`Delete failed: ${n.error??`status ${t.status}`}`,failed:!0}),!1}return await t.json(),Je(t=>t.filter(t=>t.sessionId!==e.sessionId)),n&&Z(),!0}catch(t){let n=t instanceof Error?t.message:String(t);return console.error(`[admin-ui] sidebar-session-delete-failed sessionId=${e.sessionId} error=${n}`),H({message:`Delete failed: ${n}`,failed:!0}),!1}finally{dt(t=>{let n=new Set(t);return n.delete(e.sessionId),n})}},[L,ut,Z]),gn=(0,N.useCallback)(e=>{q(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),_n=(0,N.useCallback)(()=>{mt(!1),q(new Set)},[]),vn=(0,N.useCallback)(async()=>{let e=[...K].map(e=>U.find(t=>t.sessionId===e)).filter(e=>!!e),t=(await Promise.all(e.map(e=>hn(e,{refresh:!1})))).filter(Boolean).length,n=e.length-t;n>0&&console.warn(`[admin-ui] sidebar-bulk-delete op=done requested=${e.length} ok=${t} failed=${n}`),Z(),_n()},[K,U,hn,Z,_n]),yn=(0,N.useCallback)(async(e,t)=>{if(e.stopPropagation(),!bt.has(t.sessionId)){xt(e=>{let n=new Set(e);return n.add(t.sessionId),n});try{let e=await L(`/api/admin/session-stop`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:t.sessionId})});if(!e.ok){let n=await e.json().catch(()=>({}));console.error(`[admin-ui] sidebar-session-stop-failed sessionId=${t.sessionId} status=${e.status} error=${n.error??`unknown`}`),H({message:`Stop failed: ${n.error??`status ${e.status}`}`,failed:!0});return}Z()}catch(e){let n=e instanceof Error?e.message:String(e);console.error(`[admin-ui] sidebar-session-stop-failed sessionId=${t.sessionId} error=${n}`),H({message:`Stop failed: ${n}`,failed:!0})}finally{xt(e=>{let n=new Set(e);return n.delete(t.sessionId),n})}}},[L,bt,Z]),bn=(0,N.useCallback)(async(e,t,n)=>{if(e.stopPropagation(),!St.has(t.sessionId)){Ct(e=>{let n=new Set(e);return n.add(t.sessionId),n});try{let e=await L(`/api/admin/session-archive`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:t.sessionId,mode:n})});if(!e.ok){let r=await e.json().catch(()=>({})),i=r.detail??r.error??`status ${e.status}`;console.error(`[admin-ui] sidebar-session-archive-failed sessionId=${t.sessionId} mode=${n} status=${e.status} error=${r.error??`unknown`}`),H({message:`${n===`archive`?`Archive`:`Unarchive`} failed: ${i}`,failed:!0});return}Z()}catch(e){let r=e instanceof Error?e.message:String(e);console.error(`[admin-ui] sidebar-session-archive-failed sessionId=${t.sessionId} mode=${n} error=${r}`),H({message:`${n===`archive`?`Archive`:`Unarchive`} failed: ${r}`,failed:!0})}finally{Ct(e=>{let n=new Set(e);return n.delete(t.sessionId),n})}}},[L,St,Z]),xn=(0,N.useCallback)(async e=>{let t=Et.trim();if(!t){H({message:`Title can’t be empty`,failed:!0});return}if(t.length>Kt){H({message:`Title too long (max ${Kt})`,failed:!0});return}At(!0);try{let n=await L(`/api/admin/session-rename`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:e.sessionId,title:t})});if(!n.ok){let t=await n.json().catch(()=>({})),r=t.reason??t.error??`status ${n.status}`;console.error(`[admin-ui] sidebar-session-rename sessionId=${e.sessionId.slice(0,8)} outcome=rejected reason=${r}`),H({message:`Rename failed: ${r}`,failed:!0});return}Tt(null),Y(``),Z()}catch(t){let n=t instanceof Error?t.message:String(t);console.error(`[admin-ui] sidebar-session-rename sessionId=${e.sessionId.slice(0,8)} outcome=rejected reason=${n}`),H({message:`Rename failed: ${n}`,failed:!0})}finally{At(!1)}},[L,Et,Z]);return(0,M.jsxs)(`aside`,{className:`side`,children:[(0,M.jsxs)(`div`,{className:`side-brand`,children:[Ve?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,className:`side-brand-icon-btn`,"aria-label":`Switch to house account`,disabled:!He,onClick:Ue,children:(0,M.jsx)(`img`,{className:`side-brand-icon`,src:i,alt:``,"aria-hidden":`true`})}),(0,M.jsxs)(`button`,{type:`button`,className:`side-brand-trigger`,"aria-haspopup":`menu`,"aria-expanded":ze,"aria-label":`Switch sub-account`,onClick:()=>{let e=!ze;Be(e),e&&F?.()},children:[(0,M.jsxs)(`span`,{className:`side-brand-lockup`,children:[(0,M.jsx)(`span`,{className:`side-brand-business`,children:Ce}),(0,M.jsx)(`span`,{className:`side-brand-product`,children:v.productName}),B&&(0,M.jsxs)(`span`,{className:`side-brand-version`,children:[`v`,B.installed]})]}),(0,M.jsx)(he,{size:14,className:`side-brand-caret`,"aria-hidden":`true`})]})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`img`,{className:`side-brand-icon`,src:i,alt:``,"aria-hidden":`true`}),(0,M.jsxs)(`span`,{className:`side-brand-lockup`,children:[(0,M.jsx)(`span`,{className:`side-brand-business`,children:Ce}),(0,M.jsx)(`span`,{className:`side-brand-product`,children:v.productName}),B&&(0,M.jsxs)(`span`,{className:`side-brand-version`,children:[`v`,B.installed]})]})]}),B?.updateAvailable&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,className:`side-brand-update`,"aria-label":`Software update available`,title:`Software update available`,onClick:()=>Ie(!0),children:(0,M.jsx)(u,{size:14})}),(0,M.jsx)(`span`,{className:`side-brand-icon-dot`,"aria-hidden":`true`})]}),ze&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{className:`side-brand-scrim`,"aria-hidden":`true`,onClick:()=>Be(!1)}),(0,M.jsx)(s,{open:ze,accounts:le??[],activeAccountId:j??null,switching:de??!1,onSelect:e=>P?.(e),onClose:()=>Be(!1)})]})]}),(0,M.jsxs)(`nav`,{className:`side-nav${W?` side-nav--collapsed`:``}`,children:[(0,M.jsxs)(`div`,{className:`group-head`,children:[(0,M.jsx)(`span`,{children:`Menu`}),(0,M.jsx)(`button`,{type:`button`,className:`side-nav-toggle`,"aria-expanded":!W,"aria-controls":`side-nav-rows`,"aria-label":W?`Expand the menu`:`Collapse the menu`,title:W?`Expand the menu`:`Collapse the menu`,onClick:st,children:W?(0,M.jsx)(ge,{size:12}):(0,M.jsx)(he,{size:12})})]}),(0,M.jsx)(`div`,{id:`side-nav-rows`,children:ln.map(e=>(0,M.jsxs)(`button`,{type:`button`,className:`admin-row nav-row${e.active?` active`:``}`,"aria-current":e.active?`page`:void 0,onClick:e.onClick,children:[e.icon,(0,M.jsx)(`span`,{className:`label`,children:e.label}),(0,M.jsx)(`span`,{className:`kbd`})]},e.key))})]}),(()=>{let e=U.filter(e=>nt?!0:!e.isSubagent).filter(e=>it?!0:!e.archived),n=U.some(e=>e.isSubagent),r=U.some(e=>e.archived);return(0,M.jsx)(`div`,{className:`side-sessions`,children:(0,M.jsxs)(`div`,{className:`side-list`,children:[(0,M.jsxs)(`div`,{className:`group-head`,children:[(0,M.jsx)(`span`,{children:`Sessions`}),(0,M.jsxs)(`span`,{className:`group-head-meta`,children:[(0,M.jsx)(`button`,{type:`button`,className:`group-head-select${G?` active`:``}`,"aria-pressed":G,title:G?`Exit select mode`:`Select multiple sessions to delete`,onClick:()=>{mt(e=>!e),q(new Set),Tt(null),Y(``)},children:`Select`}),(0,M.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh sessions`,"aria-label":`Refresh sessions`,onClick:nn,disabled:et,children:(0,M.jsx)(l,{size:12,className:et?`spinning`:void 0})}),(0,M.jsx)(`span`,{children:et?`…`:String(e.length)}),(0,M.jsxs)(`button`,{type:`button`,className:`admin-btn-cta side-sessions-new`,onClick:()=>{Qt(!0)},disabled:X,"aria-busy":X,"aria-label":X?`Spawning session`:`New session`,title:X?`Spawning session`:`New session`,children:[X?(0,M.jsx)(te,{size:13,className:`spinning`}):(0,M.jsx)(f,{size:13}),(0,M.jsx)(`span`,{children:X?`Spawning…`:`New session`})]})]})]}),G&&(0,M.jsxs)(`div`,{className:`session-select-bar`,children:[(0,M.jsxs)(`span`,{className:`session-select-count`,children:[K.size,` selected`]}),(0,M.jsxs)(`button`,{type:`button`,className:`session-select-delete`,disabled:K.size===0,onClick:()=>gt(!0),children:[`Delete `,K.size]}),(0,M.jsx)(`button`,{type:`button`,className:`session-select-cancel`,onClick:_n,children:`Cancel`})]}),ct&&(0,M.jsx)(`div`,{className:`side-account-id`,title:`This install's accountId. The first 8 characters match the truncated UUID label on the live Remote Control daemon entry in claude.ai/code.`,children:(0,M.jsx)(`code`,{children:ct})}),(n||r)&&(0,M.jsxs)(`div`,{className:`artefact-filter-chips`,children:[n&&(0,M.jsx)(`button`,{type:`button`,className:`artefact-filter-chip${nt?` active`:``}`,"aria-pressed":nt,onClick:()=>rt(e=>!e),title:nt?`Hide subagent sessions`:`Show subagent sessions`,children:`Subagents`}),r&&(0,M.jsx)(`button`,{type:`button`,className:`artefact-filter-chip${it?` active`:``}`,"aria-pressed":it,onClick:()=>at(e=>!e),title:it?`Hide archived sessions`:`Show archived sessions`,children:`Archived`})]}),Qe&&(0,M.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:Qe}),Xe&&!Qe&&e.length===0&&(0,M.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:`No sessions yet`}),e.map(e=>{let n=Xt(e.startedAt,t),r=vt.has(e.sessionId),i=ut.has(e.sessionId),a=bt.has(e.sessionId),o=St.has(e.sessionId),s=r||i||a||o,c=()=>{window.location.assign(`/chat?session=${e.sessionId}`)},l=[{key:`open`,label:`Resume session ${e.title} in claude.ai/code`,menuLabel:`Resume in claude.ai/code`,title:`Resume in a fresh local Remote Control PTY`,icon:(0,M.jsx)(ve,{size:12}),busy:r,onClick:()=>{un(e)}},{key:`message`,label:`Open session ${e.title} in admin webchat`,menuLabel:`Open in webchat`,title:`Open in admin webchat (/chat) — sending resumes this session`,icon:(0,M.jsx)(xe,{size:12}),onClick:()=>{c()}},{key:`usage`,label:`Usage and cost for session ${e.title}`,menuLabel:`Usage & cost`,title:`Per-day active time, tokens, and estimated GBP cost`,icon:(0,M.jsx)(ye,{size:12}),onClick:t=>{mn(t,e)}},...e.live?[{key:`stop`,label:`Stop session ${e.title}`,menuLabel:`Stop`,title:`Stop session process (keeps the conversation, can resume later)`,icon:(0,M.jsx)(_,{size:12}),busy:a,onClick:t=>{yn(t,e)}}]:[],e.archived?{key:`unarchive`,label:`Unarchive session ${e.title}`,menuLabel:`Unarchive`,title:`Unarchive (move back to the active list)`,icon:(0,M.jsx)(pe,{size:12}),busy:o,onClick:t=>{bn(t,e,`unarchive`)}}:{key:`archive`,label:`Archive session ${e.title}`,menuLabel:`Archive`,title:`Archive (hide from the list, keeps the conversation resumable)`,icon:(0,M.jsx)(me,{size:12}),busy:o,onClick:t=>{bn(t,e,`archive`)}},{key:`rename`,label:`Rename session ${e.title}`,menuLabel:`Rename`,title:`Rename this session`,icon:(0,M.jsx)(h,{size:12}),busy:Ot&&wt===e.sessionId,onClick:t=>{t.stopPropagation(),Tt(e.sessionId),Y(e.personName??e.title)}},{key:`delete`,label:`Delete session ${e.title}`,menuLabel:`Delete`,title:`Delete session (stops the process, removes the conversation)`,icon:(0,M.jsx)(g,{size:12}),danger:!0,busy:i,onClick:t=>{pn(t,e)}},Se({sessionId:e.sessionId,model:e.model??null,title:e.personName??e.title})],u=e.channel===`whatsapp`?` conv-channel-whatsapp`:e.channel===`telegram`?` conv-channel-telegram`:``,d=e.channel===`whatsapp`||e.channel===`telegram`||e.channel===`webchat`,f=se.includes(e.channel??``)&&e.senderId&&e.titleSource===`prefix`?ie({operatorName:e.personName??null,whatsappName:e.whatsappName??null,senderId:e.senderId,title:e.title,channel:e.channel}):e.personName??e.title;return(0,M.jsxs)(`div`,{ref:t=>{let n=ft.current;t?n.set(e.sessionId,t):n.delete(e.sessionId)},className:`conv conv-with-actions${u}${e.sessionId===Ye?` active`:``}`,children:[(0,M.jsxs)(`div`,{className:`conv-main-static conv-main-clickable`,role:`button`,tabIndex:0,"aria-label":`Open ${f} in webchat`,onClick:()=>{if(wt!==e.sessionId){if(G){gn(e.sessionId);return}c()}},onKeyDown:t=>{wt!==e.sessionId&&(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),G?gn(e.sessionId):c())},children:[G&&(0,M.jsx)(`span`,{className:`conv-select-check`,onClick:e=>e.stopPropagation(),children:(0,M.jsx)(fe,{checked:K.has(e.sessionId),ariaLabel:`Select ${f}`,onChange:()=>gn(e.sessionId)})}),(0,M.jsx)(`span`,{className:`conv-live-dot`,"data-live":e.live?`1`:`0`,"data-archived":e.archived?`1`:`0`,"aria-label":e.archived?`archived session`:e.live?`live session`:`ended session`}),(0,M.jsxs)(`span`,{className:`conv-stack`,children:[(0,M.jsxs)(`span`,{className:`conv-name-line`,children:[d&&(0,M.jsx)(D,{channel:e.channel,size:13}),wt===e.sessionId?(0,M.jsx)(`input`,{className:`conv-name conv-name-edit`,autoFocus:!0,onFocus:e=>e.currentTarget.select(),value:Et,disabled:Ot,"aria-label":`New title for session ${e.title}`,onChange:e=>Y(e.target.value),onClick:e=>e.stopPropagation(),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),xn(e)):t.key===`Escape`&&(t.preventDefault(),Tt(null),Y(``))},onBlur:()=>{wt===e.sessionId&&!Ot&&(Tt(null),Y(``))}}):(0,M.jsx)(`span`,{className:`conv-name`,title:f,children:f})]}),(0,M.jsxs)(`span`,{className:`conv-timestamp`,children:[(0,M.jsx)(`code`,{className:`conv-session-id`,title:`First 8 characters of this session's id — distinguishes rows with identical auto-titles. The resume/delete buttons act on the full id.`,children:e.sessionId.slice(0,8)}),n&&(0,M.jsxs)(`span`,{children:[` · `,n]})]})]})]}),!G&&(0,M.jsx)(pt,{actions:l,disabled:s})]},e.sessionId)})]})})})(),(0,M.jsxs)(`div`,{className:`side-foot`,children:[(0,M.jsx)(`div`,{className:`avatar`,children:x?(0,M.jsx)(`img`,{src:x,alt:Oe}):ke}),(0,M.jsxs)(`div`,{className:`who`,children:[(0,M.jsx)(`span`,{className:`name`,children:Oe}),(0,M.jsx)(en,{})]}),(0,M.jsx)(`button`,{type:`button`,className:`side-foot-kebab`,"aria-label":`Account menu`,"aria-haspopup":`menu`,"aria-expanded":Me,onClick:()=>Ne(e=>!e),children:(0,M.jsx)(_e,{size:16})}),Me&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{className:`side-foot-menu-scrim`,"aria-hidden":`true`,onClick:()=>Ne(!1)}),(0,M.jsx)(`div`,{className:`side-foot-menu`,role:`menu`,children:(0,M.jsx)(c,{variant:`admin`,onCloseMenu:()=>Ne(!1),onLogout:E??(()=>{}),onDisconnect:O,disconnecting:k,claudeConnected:ce,onConnectClaude:o,cacheKey:r,onOpenConversations:I})})]})]}),V&&(0,M.jsx)(`div`,{className:`copy-toast${V.failed?` copy-toast-failed`:``}`,role:`status`,children:V.message}),(0,M.jsx)(Nt,{open:Zt,pending:X,onConfirm:e=>{fn(e)},onCancel:e=>{Qt(!1)}}),(0,M.jsx)(Ft,{error:We,onClose:()=>Ge(null)}),(0,M.jsx)(Lt,{open:Fe,installed:B?.installed??`unknown`,latest:B?.latest??null,initialActionId:Le,onClose:()=>Ie(!1)}),(0,M.jsx)(Rt,{open:Ke,onConnect:()=>{qe(!1),o?.()},onClose:()=>qe(!1)}),(0,M.jsx)(kt,{target:_t,anchorEl:_t?ft.current.get(_t.sessionId)??null:null,onCancel:()=>J(null),onConfirm:()=>{let e=_t;J(null),e&&hn(e)}},_t?.sessionId??`none`),(0,M.jsx)(jt,{open:ht,count:K.size,liveCount:U.filter(e=>K.has(e.sessionId)&&e.live).length,onConfirm:()=>{gt(!1),vn()},onCancel:()=>gt(!1)}),(0,M.jsx)(Wt,{show:Mt!==null,onClose:()=>{Pt(null),zt(null),Ut(null)},anchorEl:Mt?ft.current.get(Mt.sessionId)??null:null,sessionId:Mt?.sessionId??null,summary:It,loading:Bt,error:Ht},Mt?.sessionId??`none`)]})}var Qt=5e3,$t=3e4;function en(){let[e,t]=(0,N.useState)(null);if((0,N.useEffect)(()=>{let e=!1,n=null;async function r(){try{let n=await fetch(`/api/admin/system-stats`);if(!n.ok){console.error(`[admin-ui] system-stats-fetch-failed status=${n.status}`);return}let r=await n.json();e||t(r)}catch(e){console.error(`[admin-ui] system-stats-fetch-failed reason=${e instanceof Error?e.message:String(e)}`)}}function i(){n===null&&(r(),n=setInterval(()=>{r()},Qt))}function a(){n!==null&&(clearInterval(n),n=null)}function o(){document.hidden?a():i()}return document.hidden||i(),document.addEventListener(`visibilitychange`,o),()=>{e=!0,a(),document.removeEventListener(`visibilitychange`,o)}},[]),!e||e.platform===`darwin`)return null;let n=e.cpuPct,r=e.memUsedPct,i=n!==null&&n>=.9,a=n!==null&&n>=.98,o=r!==null&&r>=.9,s=r!==null&&r>=.98,c=i||o,l=a||s,u=e=>e===null?`—`:`${Math.round(e*100)}%`,d=[`system-stats`];return c&&d.push(`system-stats--warn`),l&&d.push(`system-stats--crit`),(0,M.jsxs)(`span`,{className:d.join(` `),role:`status`,"aria-label":`host CPU and RAM`,children:[(0,M.jsxs)(`span`,{className:i?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`CPU `,u(n)]}),` · `,(0,M.jsxs)(`span`,{className:o?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`RAM `,u(r)]})]})}var tn=`maxy-shell-browser-px`;function Z(){if(typeof window>`u`)return 0;let e=document.querySelector(`.platform > .side`)?.getBoundingClientRect();return e&&e.width>0?Math.round(e.width):0}function nn(){return typeof window>`u`?360:rn(Math.round((window.innerWidth-Z())/2))}function rn(e){if(typeof window>`u`)return e;let t=Math.max(360,window.innerWidth-Z()-480);return Math.min(Math.max(e,360),t)}function Q(){if(typeof window>`u`)return 360;try{let e=window.localStorage.getItem(tn);if(!e)return nn();let t=parseInt(e,10);return Number.isFinite(t)?rn(t):(console.warn(`[admin-ui] browser-width-parse-failed stored=${JSON.stringify(e)}`),nn())}catch{return nn()}}function an({targetSelector:e=`.platform`}={}){let t=(0,N.useRef)(null),n=(0,N.useRef)(360),[,r]=(0,N.useState)(0),i=(0,N.useCallback)(t=>{n.current=t;let i=document.querySelector(e);i instanceof HTMLElement&&i.style.setProperty(`--artefact-px`,`${t}px`),r(e=>e+1)},[e]);(0,N.useLayoutEffect)(()=>{i(Q())},[i]),(0,N.useEffect)(()=>{let e=()=>i(rn(n.current));return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[i]);let a=e=>{e.preventDefault();let r=t.current;if(!r)return;r.setPointerCapture(e.pointerId),r.classList.add(`dragging`);let a=!1,o=e=>{a=!0,i(rn(Math.round(window.innerWidth-e.clientX)))},s=()=>{if(r.releasePointerCapture(e.pointerId),r.classList.remove(`dragging`),window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),a)try{window.localStorage.setItem(tn,String(n.current))}catch{}};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s)},o=()=>{i(nn());try{window.localStorage.removeItem(tn)}catch{}};return(0,M.jsx)(`div`,{ref:t,className:`browser-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize browser`,onPointerDown:a,onDoubleClick:o})}var on=1;function sn(e){let t=e.className,n=(typeof t==`string`?t:t?.baseVal??``).trim().split(/\s+/).filter(Boolean);return[e.tagName.toUpperCase(),...n].join(`.`)}function cn(e,t){let n=t.extent-t.vw;return n<on?null:{op:`layout-overflow`,route:e,vw:t.vw,extent:Math.round(t.extent),delta:Math.round(n),offender:t.offender??``}}function $(e,t){if(!e||!t)return null;let n=e.documentElement?.clientWidth??0;if(n<=0)return null;let r=n,i=null;for(let t of Array.from(e.body?.querySelectorAll(`*`)??[])){let e=t.getBoundingClientRect().right;e>=r&&e>n+.5&&(r=e,i=sn(t))}return{vw:n,extent:r,offender:i}}function ln(e){return e?`${e.route}|${e.delta}|${e.offender}`:null}function un(e,t){if(!t)return;let n=cn(e,t);if(n)try{fetch(`/api/_client-error`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({kind:`event`,source:`layout-overflow`,...n}),keepalive:!0}).catch(()=>{})}catch{}}function dn(e,t,n=400){let r=0,i,a=0,o=null,s=()=>{if(a>=5)return;let n=t.location.pathname,r=$(e,t),i=ln(r&&cn(n,r));if(!i){o=null;return}i!==o&&(o=i,a+=1,un(n,r))},c=()=>{t.cancelAnimationFrame(r),r=t.requestAnimationFrame(s)},l=()=>{i!==void 0&&clearTimeout(i),i=setTimeout(c,n)};c(),t.addEventListener(`resize`,c);let u=new MutationObserver(l);return e.body&&u.observe(e.body,{childList:!0,subtree:!0}),()=>{t.cancelAnimationFrame(r),i!==void 0&&clearTimeout(i),t.removeEventListener(`resize`,c),u.disconnect()}}function fn(e){return e.supported?e.secureContext?e.permission===`denied`?{show:!1,reason:`permission-denied`}:e.permission===`granted`?e.focused?{show:!1,reason:`focused`}:{show:!0}:{show:!1,reason:`permission-default`}:{show:!1,reason:`insecure-context`}:{show:!1,reason:`unsupported`}}function pn(){let e=typeof window<`u`&&`Notification`in window;return{supported:e,secureContext:typeof window<`u`&&window.isSecureContext===!0,permission:e?Notification.permission:`default`,focused:typeof document<`u`&&typeof document.hasFocus==`function`?document.hasFocus():!0}}var mn=500,hn=new Set,gn=new Set;function _n(e,t){if(e.size>=mn){for(let t of e)if(e.delete(t),e.size<mn)break}e.add(t)}function vn(e){return e??(typeof globalThis.fetch==`function`?globalThis.fetch:void 0)}function yn(e,t,n){try{Promise.resolve(e(`/api/admin/events`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({event:t,fields:n})})).catch(()=>{})}catch{}}function bn(e,t){let n=vn(t);return n?(yn(n,`channel-notify:desktop-capability`,{supported:e.supported,secure:e.secureContext,permission:e.permission}),!0):!1}function xn(e,t,n,r){if(hn.has(e))return!1;let i=vn(r);return i?(_n(hn,e),yn(i,`channel-notify:desktop-outcome`,{msgId:e,senderType:t,reason:n}),!0):!1}function Sn(e,t,n){try{if(gn.has(e.messageId))return;_n(gn,e.messageId);let r=fn(pn());if(!r.show){xn(e.messageId,e.senderType,r.reason,n);return}new Notification(`${e.accountName} · ${e.senderDisplay}`,{body:e.body+(e.truncated?`…`:``),icon:t,tag:e.messageId}),xn(e.messageId,e.senderType,`shown`,n)}catch{xn(e.messageId,e.senderType,`construct-failed`,n)}}var Cn=`admin-sidebar-collapsed`,wn=`admin-sidebar-drawer-open`,Tn=1080;function En(){if(typeof window>`u`)return!1;let e=null;try{e=window.sessionStorage.getItem(Cn)}catch{e=null}return e===null?typeof window.matchMedia==`function`?window.matchMedia(`(min-width: 721px) and (max-width: ${Tn}px)`).matches:!1:e===`1`}function Dn(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(Cn,`1`):window.sessionStorage.removeItem(Cn)}catch{}}function On(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(wn)===`1`}catch{return!1}}function kn(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(wn,`1`):window.sessionStorage.removeItem(wn)}catch{}}var An=720;function jn(e,t){return e===`/`?{via:`in-place`}:{via:`navigate`,href:`/?wa=${encodeURIComponent(t.remoteJid??``)}&acct=${encodeURIComponent(t.accountId??``)}`}}function Mn(e){return e===`/`?{via:`in-place`}:{via:`navigate`,href:`/?data=1`}}function Nn(e,t){if(e!==`/`)return null;let n=new URLSearchParams(t),r=n.get(`wa`),i=n.get(`acct`);return!r||!i?null:{sessionId:``,projectDir:``,title:``,senderId:null,startedAt:``,channel:`whatsapp`,role:`public`,operatorName:null,whatsappName:null,lastMessageAt:null,modelGated:!1,model:null,source:`store`,accountId:i,remoteJid:r}}function Pn(e,t){return e===`/`?new URLSearchParams(t).has(`data`):!1}function Fn(e,t){return t===`operator`&&e===`chat`||e===`dashboard`?`/`:e===`data`?`/data`:e===`graph`?`/graph`:e===`calendar`?`/calendar`:e===`chat`?`/chat`:e===`activity`?`/activity`:`/browser`}var In=`maxy-webchat-browser-pane`;function Ln(){try{let e=window.localStorage.getItem(In);return e===`split`||e===`full`?e:`closed`}catch{return`closed`}}function Rn(){return typeof window<`u`&&window.location.pathname.startsWith(`/chat`)}function zn(e){let{cacheKey:t,businessName:n,variant:r=`admin`,onLogout:a,onDisconnect:o,disconnecting:s,claudeConnected:c,onConnectClaude:l,userName:u,userAvatar:d,role:f,onOpenConversations:p,children:m,footer:h}=e,{subAccounts:g,activeAccountId:_,switching:v,switchAccount:y,refreshAccounts:x}=O(t),[te,S]=(0,N.useState)([]),[ne,re]=(0,N.useState)(!1),[C,w]=(0,N.useState)(`closed`);(0,N.useEffect)(()=>{let e=Rn();re(e),e&&w(Ln())},[]);let T=(0,N.useCallback)(e=>{w(e);try{window.localStorage.setItem(In,e)}catch{}},[]),ie=(0,N.useCallback)(()=>T(`split`),[T]),E=(0,N.useCallback)(()=>{T(C===`full`?`split`:`full`)},[C,T]),se=(0,N.useCallback)(()=>T(`closed`),[T]),D=ne?C:`closed`,ce=D!==`closed`,A=(0,N.useCallback)(e=>{S(t=>t.filter(t=>t.messageId!==e))},[]);(0,N.useEffect)(()=>{if(!t)return;let e=null;try{e=new EventSource(k(`/api/admin/events`,t)),e.addEventListener(Ze,e=>{try{let t=JSON.parse(e.data);if(!t||typeof t.messageId!=`string`)return;S(e=>e.some(e=>e.messageId===t.messageId)?e:[...e,t]),Sn(t,i)}catch{}}),e.onerror=()=>{console.error(`[admin-ui] channel-notify stream error`)}}catch(e){console.error(`[admin-ui] channel-notify unavailable reason=${e instanceof Error?e.message:String(e)}`)}return()=>{e?.close()}},[t]),(0,N.useEffect)(()=>{bn(pn())},[]);let[j,de]=(0,N.useState)(!0);(0,N.useEffect)(()=>{if(c!==void 0||r!==`admin`)return;let e=!1,t=async()=>{try{let t=await fetch(`/api/health`);if(!t.ok)return;let n=await t.json();e||de(n.auth_status!==`dead`&&n.auth_status!==`missing`)}catch{}};t();let n=setInterval(t,6e4);return()=>{e=!0,clearInterval(n)}},[c,r]);let fe=c??j,P=l??(()=>{window.location.assign(`/?connect=claude`)}),[F,I]=(0,N.useState)(()=>En()),[pe,me]=(0,N.useState)(!1),L=(0,N.useRef)(!0);(0,N.useEffect)(()=>{if(L.current){L.current=!1;return}me(!0);let e=setTimeout(()=>me(!1),260);return()=>clearTimeout(e)},[F]);let[R,he]=(0,N.useState)(()=>On()),ge=le(`(max-width: ${An}px)`),[_e,ve]=(0,N.useState)(()=>typeof window>`u`||Pn(window.location.pathname,window.location.search)?null:Nn(window.location.pathname,window.location.search)),[ye,be]=(0,N.useState)(()=>typeof window>`u`?!1:Pn(window.location.pathname,window.location.search)),[xe]=(0,N.useState)(()=>ye),Se=(0,N.useCallback)(e=>{Dn(e),I(e)},[]),z=(0,N.useCallback)(e=>{kn(e),he(e)},[]);(0,N.useEffect)(()=>{typeof window>`u`||window.location?.pathname},[]),(0,N.useEffect)(()=>{typeof window>`u`||!_e||window.history.replaceState(null,``,`/`)},[]),(0,N.useEffect)(()=>{typeof window>`u`||!ye||window.history.replaceState(null,``,`/`)},[]);let Ce=(0,N.useCallback)(e=>{if(be(!1),e===null){ve(null);return}let t=jn(typeof window<`u`?window.location.pathname:`/`,e);t.via===`in-place`?ve(e):window.location.href=t.href},[]),we=(0,N.useCallback)(()=>{let e=Mn(typeof window<`u`?window.location.pathname:`/`);if(e.via===`navigate`){window.location.href=e.href;return}ve(null),be(!0)},[]),Te=ge?R:!F,Ee=(0,N.useCallback)(()=>{typeof window>`u`||(window.matchMedia(`(max-width: ${An}px)`).matches?z(!R):Se(!F))},[F,R,Se,z]);(0,N.useEffect)(()=>{if(!(typeof window>`u`))return dn(document,window)},[]);let De=(0,N.useCallback)(e=>{let t=Fn(e,r);window.location.href=t},[r]),Oe={collapsed:F,mobileDrawerOpen:R,sidebarOpen:Te,onToggleSidebar:Ee,setMobileDrawerOpen:z,selectedWhatsapp:_e,onClearWhatsapp:()=>ve(null),onSelectWhatsappConversation:Ce,dataOpen:ye};return r===`operator`?(0,M.jsx)(ae,{cacheKey:t,children:(0,M.jsxs)(`div`,{className:`admin-shell admin-page admin-shell-root`,children:[v&&(0,M.jsx)(ee,{surface:`switch`}),(0,M.jsx)(b,{businessName:n,variant:r,onNavigate:De,onOpenConversations:p,onToggleSidebar:Ee,sidebarOpen:Te,onLogout:a,onDisconnect:o,disconnecting:s,cacheKey:t,subAccounts:g,activeAccountId:_,switchingAccount:v,onSwitchAccount:y,refreshAccounts:x}),(0,M.jsxs)(`div`,{className:`platform platform-operator`,children:[(0,M.jsx)(oe,{}),typeof m==`function`?m(Oe):m]}),(0,M.jsx)(it,{variant:`operator`,onOpenConversations:p}),h,(0,M.jsx)(Xe,{frames:te,onExpire:A})]})}):(0,M.jsx)(ae,{cacheKey:t,children:(0,M.jsxs)(`div`,{className:`admin-shell admin-page admin-shell-root`,children:[v&&(0,M.jsx)(ee,{surface:`switch`}),(0,M.jsxs)(`div`,{className:`platform${R?` menu-open`:``}${!ge&&F?` sidebar-collapsed`:``}${pe?` sidebar-animating`:``}`,"data-artefact":ce?`browser`:`closed`,"data-browser-pane":D,children:[(0,M.jsx)(Zt,{businessName:n,cacheKey:t,onConnectClaude:P,role:f??null,userName:u,userAvatar:d??null,onSelectProjects:()=>{window.location.href=`/graph?label=${ue().label}`},onSelectTasks:()=>{window.location.href=`/tasks`},onCloseMobileDrawer:()=>z(!1),collapsed:F,mobileDrawerOpen:R,onSelectData:we,onCloseData:()=>be(!1),initialDataSurface:xe,onLogout:a,onDisconnect:o,disconnecting:s,claudeConnected:fe,subAccounts:g,activeAccountId:_,switchingAccount:v,onSwitchAccount:y,refreshAccounts:x,onOpenConversations:p}),!ge&&(0,M.jsx)(ct,{}),(0,M.jsx)(et,{sidebarOpen:Te,onToggleSidebar:Ee,claudeConnected:fe,onConnectClaude:P,onOpenBrowser:ne&&!ce?ie:void 0}),typeof m==`function`?m(Oe):m,ce&&(0,M.jsxs)(`div`,{className:`webchat-browser-pane`,children:[D===`split`&&(0,M.jsx)(an,{}),(0,M.jsx)(H,{cacheKey:e.cacheKey,surface:`webchat`,onToggleFull:E,onClosePane:se,isFull:D===`full`})]})]}),R&&(0,M.jsx)(`div`,{className:`sidebar-backdrop menu-open`,"aria-hidden":`true`,onClick:()=>z(!1)}),(0,M.jsx)(it,{}),h,(0,M.jsx)(Xe,{frames:te,onExpire:A})]})})}export{de as A,ge as C,pe as D,me as E,I as O,_e as S,R as T,Se as _,At as a,ye as b,mt as c,gt as d,pt as f,we as g,Te as h,It as i,fe as k,K as l,De as m,Jt as n,Nt as o,H as p,Rt as r,q as s,zn as t,vt as u,xe as v,he as w,ve as x,be as y};
@@ -1 +0,0 @@
1
- =`<��䵫o��N�S������.�F�Ju���n�RM�._��:eDže���%J�\ҕ�5KLϜ�B3�j7��DQH��b��2+f}��x�t�y�5�ê