@rubytech/create-maxy-code 0.1.537 → 0.1.539
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +121 -7
- package/payload/platform/plugins/admin/skills/whats-new/SKILL.md +12 -0
- package/payload/platform/plugins/docs/PLUGIN.md +2 -0
- package/payload/platform/plugins/docs/references/admin-ui.md +40 -6
- package/payload/platform/plugins/docs/references/channel-wake-and-prompt.md +75 -0
- package/payload/platform/plugins/scheduling/PLUGIN.md +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-get-description.test.d.ts +2 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-get-description.test.d.ts.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-get-description.test.js +59 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-get-description.test.js.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-get.d.ts.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-get.js +6 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-get.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-update.d.ts.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-update.js +10 -6
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-update.js.map +1 -1
- package/payload/platform/plugins/whatsapp/PLUGIN.md +2 -0
- package/payload/platform/plugins/whatsapp/mcp/dist/index.js +17 -2
- package/payload/platform/plugins/whatsapp/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/whatsapp/references/channels-whatsapp.md +16 -0
- package/payload/platform/plugins/whatsapp/skills/connect-whatsapp/SKILL.md +1 -1
- package/payload/platform/plugins/whatsapp/skills/manage-whatsapp-config/SKILL.md +29 -9
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +15 -2
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
- package/payload/platform/services/webchat-channel/dist/notification.d.ts +31 -0
- package/payload/platform/services/webchat-channel/dist/notification.d.ts.map +1 -1
- package/payload/platform/services/webchat-channel/dist/notification.js +31 -1
- package/payload/platform/services/webchat-channel/dist/notification.js.map +1 -1
- package/payload/platform/services/webchat-channel/dist/server.d.ts.map +1 -1
- package/payload/platform/services/webchat-channel/dist/server.js +15 -1
- package/payload/platform/services/webchat-channel/dist/server.js.map +1 -1
- package/payload/platform/services/whatsapp-channel/dist/notification.d.ts +1 -1
- package/payload/platform/services/whatsapp-channel/dist/notification.d.ts.map +1 -1
- package/payload/platform/services/whatsapp-channel/dist/targets.d.ts +1 -1
- package/payload/platform/services/whatsapp-channel/dist/targets.d.ts.map +1 -1
- package/payload/platform/services/whatsapp-channel/dist/targets.js +5 -1
- package/payload/platform/services/whatsapp-channel/dist/targets.js.map +1 -1
- package/payload/server/{chunk-44Z4ZFYS.js → chunk-S4FIEM3L.js} +62 -10
- package/payload/server/{manager-AJSPM6X2.js → manager-5QV2EAZ2.js} +1 -1
- package/payload/server/public/activity.html +5 -5
- package/payload/server/public/agents.html +4 -4
- package/payload/server/public/assets/{AdminLoginScreens-CYFf2awh.js → AdminLoginScreens-BpHnjHp_.js} +1 -1
- package/payload/server/public/assets/AdminLoginScreens-BpHnjHp_.js.br +0 -0
- package/payload/server/public/assets/AdminLoginScreens-BpHnjHp_.js.gz +0 -0
- package/payload/server/public/assets/AdminShell-D24evn4t.js +2 -0
- package/payload/server/public/assets/AdminShell-D24evn4t.js.br +0 -0
- package/payload/server/public/assets/AdminShell-D24evn4t.js.gz +0 -0
- package/payload/server/public/assets/{activity-BH65sm9Q.js → activity-ZVUTB5uZ.js} +1 -1
- package/payload/server/public/assets/activity-ZVUTB5uZ.js.br +0 -0
- package/payload/server/public/assets/activity-ZVUTB5uZ.js.gz +0 -0
- package/payload/server/public/assets/{admin-CQtEjRGU.js → admin-XJqQz3QJ.js} +1 -1
- package/payload/server/public/assets/admin-XJqQz3QJ.js.br +0 -0
- package/payload/server/public/assets/admin-XJqQz3QJ.js.gz +0 -0
- package/payload/server/public/assets/{agents-CjhOWwl5.js → agents-Dc9SNC9N.js} +1 -1
- package/payload/server/public/assets/agents-Dc9SNC9N.js.br +0 -0
- package/payload/server/public/assets/agents-Dc9SNC9N.js.gz +0 -0
- package/payload/server/public/assets/{browser-DGXpfL99.js → browser-CCedMIga.js} +1 -1
- package/payload/server/public/assets/browser-CCedMIga.js.br +0 -0
- package/payload/server/public/assets/browser-CCedMIga.js.gz +0 -0
- package/payload/server/public/assets/calendar-BDoMLP2j.js +1 -0
- package/payload/server/public/assets/calendar-BDoMLP2j.js.br +0 -0
- package/payload/server/public/assets/calendar-BDoMLP2j.js.gz +0 -0
- package/payload/server/public/assets/chat-BAhoqTY9.js +1 -0
- package/payload/server/public/assets/chat-BAhoqTY9.js.br +0 -0
- package/payload/server/public/assets/chat-BAhoqTY9.js.gz +0 -0
- package/payload/server/public/assets/chevron-left-NGLHgPjF.js +1 -0
- package/payload/server/public/assets/chevron-right-B4B7OkG8.js +1 -0
- package/payload/server/public/assets/chevron-right-B4B7OkG8.js.br +0 -0
- package/payload/server/public/assets/clock-7IMwxJdH.js +1 -0
- package/payload/server/public/assets/clock-7IMwxJdH.js.br +0 -0
- package/payload/server/public/assets/clock-7IMwxJdH.js.gz +0 -0
- package/payload/server/public/assets/copy-PkR4EFD6.js +1 -0
- package/payload/server/public/assets/copy-PkR4EFD6.js.br +0 -0
- package/payload/server/public/assets/copy-PkR4EFD6.js.gz +0 -0
- package/payload/server/public/assets/data-yQYhw2IR.js +1 -0
- package/payload/server/public/assets/data-yQYhw2IR.js.br +1 -0
- package/payload/server/public/assets/data-yQYhw2IR.js.gz +0 -0
- package/payload/server/public/assets/{file-text-CbQoZfJD.js → file-text-BA9p7TLU.js} +1 -1
- package/payload/server/public/assets/file-text-BA9p7TLU.js.br +0 -0
- package/payload/server/public/assets/file-text-BA9p7TLU.js.gz +0 -0
- package/payload/server/public/assets/graph-C8cQ6Nqf.js +51 -0
- package/payload/server/public/assets/graph-C8cQ6Nqf.js.br +0 -0
- package/payload/server/public/assets/graph-C8cQ6Nqf.js.gz +0 -0
- package/payload/server/public/assets/{graph-labels-D695CsC9.js → graph-labels-CiK412vE.js} +1 -1
- package/payload/server/public/assets/graph-labels-CiK412vE.js.br +0 -0
- package/payload/server/public/assets/graph-labels-CiK412vE.js.gz +0 -0
- package/payload/server/public/assets/operator-CaQAEUBu.js +1 -0
- package/payload/server/public/assets/operator-CaQAEUBu.js.br +0 -0
- package/payload/server/public/assets/operator-CaQAEUBu.js.gz +0 -0
- package/payload/server/public/assets/page-CpJpyoPS.js +32 -0
- package/payload/server/public/assets/page-CpJpyoPS.js.br +0 -0
- package/payload/server/public/assets/page-CpJpyoPS.js.gz +0 -0
- package/payload/server/public/assets/page-D0ShNyGE.js +1 -0
- package/payload/server/public/assets/page-D0ShNyGE.js.br +0 -0
- package/payload/server/public/assets/page-D0ShNyGE.js.gz +0 -0
- package/payload/server/public/assets/{play-CbRU6q0T.js → play-huZpq9ra.js} +1 -1
- package/payload/server/public/assets/play-huZpq9ra.js.br +0 -0
- package/payload/server/public/assets/play-huZpq9ra.js.gz +0 -0
- package/payload/server/public/assets/{public-CqbKJ-Q3.js → public--8RWWGjF.js} +1 -1
- package/payload/server/public/assets/public--8RWWGjF.js.br +0 -0
- package/payload/server/public/assets/public--8RWWGjF.js.gz +0 -0
- package/payload/server/public/assets/{rotate-ccw-CjliWBou.js → rotate-ccw-g7l4ZSR3.js} +1 -1
- package/payload/server/public/assets/rotate-ccw-g7l4ZSR3.js.br +0 -0
- package/payload/server/public/assets/rotate-ccw-g7l4ZSR3.js.gz +0 -0
- package/payload/server/public/assets/routines-DzFcPNMb.js +2 -0
- package/payload/server/public/assets/routines-DzFcPNMb.js.br +0 -0
- package/payload/server/public/assets/routines-DzFcPNMb.js.gz +0 -0
- package/payload/server/public/assets/{skills-ipK9BJFb.js → skills-5vl_Bt9U.js} +1 -1
- package/payload/server/public/assets/skills-5vl_Bt9U.js.br +0 -0
- package/payload/server/public/assets/skills-5vl_Bt9U.js.gz +0 -0
- package/payload/server/public/assets/{tasks-CGcJHQ3X.js → tasks-DQHtJ8Pq.js} +2 -2
- package/payload/server/public/assets/tasks-DQHtJ8Pq.js.br +0 -0
- package/payload/server/public/assets/tasks-DQHtJ8Pq.js.gz +0 -0
- package/payload/server/public/assets/{triangle-alert-CjsLPsBD.js → triangle-alert-Cy4Z0uFv.js} +1 -1
- package/payload/server/public/assets/triangle-alert-Cy4Z0uFv.js.br +0 -0
- package/payload/server/public/assets/triangle-alert-Cy4Z0uFv.js.gz +0 -0
- package/payload/server/public/assets/{useCopyFeedback-umIgCxI_.js → useCopyFeedback-BwK1RhmF.js} +1 -1
- package/payload/server/public/assets/useCopyFeedback-BwK1RhmF.js.br +0 -0
- package/payload/server/public/assets/useCopyFeedback-BwK1RhmF.js.gz +0 -0
- package/payload/server/public/assets/useSubAccountSwitcher-C7TtIbR3.js +14 -0
- package/payload/server/public/assets/useSubAccountSwitcher-C7TtIbR3.js.br +0 -0
- package/payload/server/public/assets/useSubAccountSwitcher-C7TtIbR3.js.gz +0 -0
- package/payload/server/public/assets/{useSubAccountSwitcher-D8jXV7R5.css → useSubAccountSwitcher-DCkivCBS.css} +1 -1
- package/payload/server/public/assets/useSubAccountSwitcher-DCkivCBS.css.br +0 -0
- package/payload/server/public/assets/{useSubAccountSwitcher-D8jXV7R5.css.gz → useSubAccountSwitcher-DCkivCBS.css.gz} +0 -0
- package/payload/server/public/assets/useVoiceRecorder-DgyAGgmF.js +2 -0
- package/payload/server/public/assets/useVoiceRecorder-DgyAGgmF.js.br +0 -0
- package/payload/server/public/assets/useVoiceRecorder-DgyAGgmF.js.gz +0 -0
- package/payload/server/public/assets/{wrench-DtfKfR4s.js → wrench-CICORrSc.js} +1 -1
- package/payload/server/public/assets/wrench-CICORrSc.js.br +0 -0
- package/payload/server/public/assets/wrench-CICORrSc.js.gz +0 -0
- package/payload/server/public/browser.html +4 -4
- package/payload/server/public/calendar.html +8 -7
- package/payload/server/public/chat.html +13 -13
- package/payload/server/public/data.html +11 -11
- package/payload/server/public/graph.html +9 -9
- package/payload/server/public/index.html +14 -14
- package/payload/server/public/operator.html +14 -14
- package/payload/server/public/public.html +13 -13
- package/payload/server/public/routines.html +6 -6
- package/payload/server/public/skills.html +5 -5
- package/payload/server/public/tasks.html +6 -6
- package/payload/server/server.js +436 -108
- package/payload/server/public/assets/AdminLoginScreens-CYFf2awh.js.br +0 -0
- package/payload/server/public/assets/AdminLoginScreens-CYFf2awh.js.gz +0 -0
- package/payload/server/public/assets/AdminShell-7l3ubYFZ.js +0 -2
- package/payload/server/public/assets/AdminShell-7l3ubYFZ.js.br +0 -0
- package/payload/server/public/assets/AdminShell-7l3ubYFZ.js.gz +0 -0
- package/payload/server/public/assets/activity-BH65sm9Q.js.br +0 -0
- package/payload/server/public/assets/activity-BH65sm9Q.js.gz +0 -0
- package/payload/server/public/assets/admin-CQtEjRGU.js.br +0 -0
- package/payload/server/public/assets/admin-CQtEjRGU.js.gz +0 -0
- package/payload/server/public/assets/agents-CjhOWwl5.js.br +0 -0
- package/payload/server/public/assets/agents-CjhOWwl5.js.gz +0 -0
- package/payload/server/public/assets/browser-DGXpfL99.js.br +0 -0
- package/payload/server/public/assets/browser-DGXpfL99.js.gz +0 -0
- package/payload/server/public/assets/calendar-Cu4yjEuX.js +0 -1
- package/payload/server/public/assets/calendar-Cu4yjEuX.js.br +0 -0
- package/payload/server/public/assets/calendar-Cu4yjEuX.js.gz +0 -0
- package/payload/server/public/assets/chat-0na4XVZC.js +0 -1
- package/payload/server/public/assets/chat-0na4XVZC.js.br +0 -0
- package/payload/server/public/assets/chat-0na4XVZC.js.gz +0 -0
- package/payload/server/public/assets/chevron-left-DHzJobWp.js +0 -1
- package/payload/server/public/assets/chevron-left-DHzJobWp.js.br +0 -0
- package/payload/server/public/assets/chevron-right-yg4DMfLT.js +0 -1
- package/payload/server/public/assets/chevron-right-yg4DMfLT.js.br +0 -0
- package/payload/server/public/assets/clock-BIDzihvp.js +0 -1
- package/payload/server/public/assets/clock-BIDzihvp.js.br +0 -0
- package/payload/server/public/assets/clock-BIDzihvp.js.gz +0 -0
- package/payload/server/public/assets/data-Ql9qG3YO.js +0 -1
- package/payload/server/public/assets/data-Ql9qG3YO.js.br +0 -0
- package/payload/server/public/assets/data-Ql9qG3YO.js.gz +0 -0
- package/payload/server/public/assets/file-text-CbQoZfJD.js.br +0 -0
- package/payload/server/public/assets/file-text-CbQoZfJD.js.gz +0 -0
- package/payload/server/public/assets/graph-7414Kjn9.js +0 -51
- package/payload/server/public/assets/graph-7414Kjn9.js.br +0 -0
- package/payload/server/public/assets/graph-7414Kjn9.js.gz +0 -0
- package/payload/server/public/assets/graph-labels-D695CsC9.js.br +0 -0
- package/payload/server/public/assets/graph-labels-D695CsC9.js.gz +0 -0
- package/payload/server/public/assets/maximize-2-CD0gTjW_.js +0 -1
- package/payload/server/public/assets/maximize-2-CD0gTjW_.js.br +0 -0
- package/payload/server/public/assets/maximize-2-CD0gTjW_.js.gz +0 -0
- package/payload/server/public/assets/operator-CLw4PZs5.js +0 -1
- package/payload/server/public/assets/operator-CLw4PZs5.js.br +0 -0
- package/payload/server/public/assets/operator-CLw4PZs5.js.gz +0 -0
- package/payload/server/public/assets/page-BNRFmFc-.js +0 -32
- package/payload/server/public/assets/page-BNRFmFc-.js.br +0 -0
- package/payload/server/public/assets/page-BNRFmFc-.js.gz +0 -0
- package/payload/server/public/assets/page-BRr295G2.js +0 -1
- package/payload/server/public/assets/page-BRr295G2.js.br +0 -0
- package/payload/server/public/assets/page-BRr295G2.js.gz +0 -0
- package/payload/server/public/assets/play-CbRU6q0T.js.br +0 -0
- package/payload/server/public/assets/play-CbRU6q0T.js.gz +0 -0
- package/payload/server/public/assets/public-CqbKJ-Q3.js.br +0 -0
- package/payload/server/public/assets/public-CqbKJ-Q3.js.gz +0 -0
- package/payload/server/public/assets/rotate-ccw-CjliWBou.js.br +0 -0
- package/payload/server/public/assets/rotate-ccw-CjliWBou.js.gz +0 -0
- package/payload/server/public/assets/routines-yJuRuBfn.js +0 -2
- package/payload/server/public/assets/routines-yJuRuBfn.js.br +0 -0
- package/payload/server/public/assets/routines-yJuRuBfn.js.gz +0 -0
- package/payload/server/public/assets/skills-ipK9BJFb.js.br +0 -0
- package/payload/server/public/assets/skills-ipK9BJFb.js.gz +0 -0
- package/payload/server/public/assets/tasks-CGcJHQ3X.js.br +0 -0
- package/payload/server/public/assets/tasks-CGcJHQ3X.js.gz +0 -0
- package/payload/server/public/assets/triangle-alert-CjsLPsBD.js.br +0 -0
- package/payload/server/public/assets/triangle-alert-CjsLPsBD.js.gz +0 -0
- package/payload/server/public/assets/useCopyFeedback-umIgCxI_.js.br +0 -0
- package/payload/server/public/assets/useCopyFeedback-umIgCxI_.js.gz +0 -0
- package/payload/server/public/assets/useSubAccountSwitcher-D8jXV7R5.css.br +0 -0
- package/payload/server/public/assets/useSubAccountSwitcher-UMg53kKF.js +0 -14
- package/payload/server/public/assets/useSubAccountSwitcher-UMg53kKF.js.br +0 -0
- package/payload/server/public/assets/useSubAccountSwitcher-UMg53kKF.js.gz +0 -0
- package/payload/server/public/assets/useVoiceRecorder-tzfqfXni.js +0 -2
- package/payload/server/public/assets/useVoiceRecorder-tzfqfXni.js.br +0 -0
- package/payload/server/public/assets/useVoiceRecorder-tzfqfXni.js.gz +0 -0
- package/payload/server/public/assets/wrench-DtfKfR4s.js.br +0 -0
- package/payload/server/public/assets/wrench-DtfKfR4s.js.gz +0 -0
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CltuBf4Z.js";import{A as t,B as n,D as r,E as i,G as a,I as o,L as s,M as c,N as l,O as u,P as d,R as f,S as p,T as m,U as h,V as g,W as _,X as v,Y as y,_ as b,b as x,g as ee,h as te,i as S,j as C,k as w,m as T,o as ne,p as re,r as E,s as ie,t as ae,w as oe,x as se,y as ce,z as D}from"./useSubAccountSwitcher-UMg53kKF.js";async function le(){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 O=_();function ue({checked:e,onChange:t,label:n,disabled:r,ariaLabel:i=n}){return(0,O.jsxs)(`label`,{className:`maxy-checkbox${r?` maxy-checkbox--disabled`:``}`,children:[(0,O.jsx)(`input`,{type:`checkbox`,"aria-label":i,checked:e,onChange:e=>t(e.target.checked),disabled:r}),(0,O.jsx)(`span`,{className:`maxy-checkbox__box`,children:`✱`}),n&&(0,O.jsx)(`span`,{className:`maxy-checkbox__label`,children:n})]})}var k=e(v(),1),A={sm:14,md:16,lg:18},j={sm:30,md:38,lg:46};function M({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=A[t],g={...e===`send`?{width:j[t],height:j[t]}:{},...d},_=Object.keys(g).length>0;return(0,O.jsxs)(`button`,{type:s,className:m,disabled:i||o,onClick:c,"aria-label":l,"aria-pressed":u,style:_?g:void 0,children:[(0,O.jsxs)(`span`,{className:`btn__content`,style:{visibility:i?`hidden`:`visible`},children:[n&&r===`leading`&&(0,O.jsx)(n,{size:h}),p,n&&r===`trailing`&&(0,O.jsx)(n,{size:h})]}),i&&(0,O.jsx)(`span`,{className:`btn__spinner`,children:`✱`})]})}var de=D(`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`}]]),fe=D(`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`}]]),N=D(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),pe=D(`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`}]]),me=D(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),he=D(`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`}]]),ge=D(`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`}]]),_e=D(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),ve=D(`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`}]]),ye=D(`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`}]]),P=D(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),F=D(`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`}]]),be=D(`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`}]]),xe=D(`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`}]]),Se=D(`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`}]]),Ce=`/cdp-screencast`;function we(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}}function I(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 Te(e){return e===0?`left`:e===1?`middle`:e===2?`right`:`none`}function Ee(e,t){let n=Te(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 De(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 Oe={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},ke={Enter:`\r`,Tab:` `};function Ae(e,t){let n=t.key.length===1,r=n&&/[a-z0-9]/i.test(t.key)?t.key.toUpperCase().charCodeAt(0):Oe[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:ke[t.key];e!==void 0&&(i.text=e,i.unmodifiedText=e)}return i}function je(e){let t=e.trim();return t?/^[a-z][a-z0-9+.-]*:/i.test(t)?t:`https://${t}`:``}function Me(e){try{return new URL(je(e)).host}catch{return``}}function Ne(e,t,n){return`${e.protocol===`https:`?`wss`:`ws`}://${e.host}${Ce}?targetId=${encodeURIComponent(t)}&sid=${encodeURIComponent(n)}`}var Pe=class{nextId=1;startId=null;frames=0;stopped=!1;lastMetadata=null;lastInputLogAtMs=null;inputsSinceLog=0;pending=new Map;constructor(e,t){this.ws=e,this.opts=t}frameCount(){return this.frames}start(e){this.send(`Page.enable`,{}),e&&this.setPaneSize(e);let t=we(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=we();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`||typeof n?.metadata!=`object`||n.metadata===null)return;let r=n.metadata;typeof n.sessionId==`number`&&this.send(`Page.screencastFrameAck`,{sessionId:n.sessionId}),this.frames+=1,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=I(t.canvasX,t.canvasY,t.rendered,n);this.send(`Input.dispatchMouseEvent`,Ee(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=I(e.canvasX,e.canvasY,e.rendered,t);this.send(`Input.dispatchMouseEvent`,De({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`,Ae(e,t)),this.logInput(`key`)}insertText(e){e&&(this.send(`Input.insertText`,{text:e}),this.logInput(`paste`))}navigate(e){let t=je(e);t&&(this.send(`Page.navigate`,{url:t}),this.opts.onLog(`navigate`,{host:Me(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.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 Fe(e){let{targets:t,activeId:n,url:r,busy:i}=e,[a,o]=(0,k.useState)(r),c=(0,k.useRef)(null);return(0,k.useEffect)(()=>{c.current&&document.activeElement===c.current||o(r)},[r]),(0,k.useEffect)(()=>{o(e.url)},[n]),(0,O.jsxs)(`div`,{className:`browser-chrome`,children:[(0,O.jsxs)(`div`,{className:`browser-chrome__tabs`,role:`tablist`,children:[t.map(t=>(0,O.jsxs)(`div`,{className:t.id===n?`browser-chrome__tab is-active`:`browser-chrome__tab`,role:`tab`,"aria-selected":t.id===n,children:[(0,O.jsx)(`button`,{type:`button`,className:`browser-chrome__tab-label`,onClick:()=>e.onSelect(t.id),title:t.url,children:t.title}),(0,O.jsx)(`button`,{type:`button`,className:`browser-chrome__tab-close`,"aria-label":`Close ${t.title}`,onClick:()=>e.onClose(t.id),disabled:i,children:(0,O.jsx)(x,{size:12,strokeWidth:2})})]},t.id)),(0,O.jsx)(`button`,{type:`button`,className:`browser-chrome__new`,"aria-label":`New tab`,title:`New tab`,onClick:e.onNew,disabled:i,children:(0,O.jsx)(m,{size:14,strokeWidth:2})})]}),(0,O.jsxs)(`form`,{className:`browser-chrome__bar`,onSubmit:t=>{t.preventDefault(),e.onNavigate(a)},children:[(0,O.jsx)(`button`,{type:`button`,className:`browser-chrome__nav`,"aria-label":`Back`,title:`Back`,onClick:e.onBack,children:(0,O.jsx)(s,{size:16,strokeWidth:1.75})}),(0,O.jsx)(`button`,{type:`button`,className:`browser-chrome__nav`,"aria-label":`Forward`,title:`Forward`,onClick:e.onForward,children:(0,O.jsx)(N,{size:16,strokeWidth:1.75})}),(0,O.jsx)(`input`,{ref:c,className:`browser-chrome__url`,"aria-label":`Address`,placeholder:`Type a URL`,value:a,onChange:e=>o(e.target.value)})]})]})}function Ie(e){return(e.altKey?1:0)|(e.ctrlKey?2:0)|(e.metaKey?4:0)|(e.shiftKey?8:0)}function L({preferTargetId:e=null,cacheKey:t=null,chrome:n=!0,surface:r=`browser`}={}){let[i,a]=(0,k.useState)(`probing`),[o,s]=(0,k.useState)([]),[c,l]=(0,k.useState)(null),[u,d]=(0,k.useState)(!1),[f,p]=(0,k.useState)(null),[m,h]=(0,k.useState)(!1),[g,_]=(0,k.useState)(``),v=ce(t),y=(0,k.useRef)(null),b=(0,k.useRef)(null),x=(0,k.useRef)(null),ee=(0,k.useRef)(``),te=(0,k.useRef)(e);te.current=e,ee.current||=`sc-${Math.random().toString(36).slice(2,10)}`;let S=(0,k.useCallback)((e,t={})=>{v(`/api/admin/browser/screencast-event`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({sid:ee.current,op:e,...t})}).catch(()=>{})},[v]),T=(0,k.useCallback)(async()=>{try{let e=await v(`/api/admin/browser/screencast-targets`);if(!e.ok){a(`unavailable`);return}let t=await e.json().catch(()=>({})),n=Array.isArray(t.targets)?t.targets:[];if(s(n),n.length===0){l(null),a(`no-tabs`);return}let r=te.current;l(e=>r&&n.some(e=>e.id===r)?r:e&&n.some(t=>t.id===e)?e:n[0].id),a(`live`)}catch{a(`unavailable`)}},[v]);(0,k.useEffect)(()=>{S(`request`),T()},[T,S]),(0,k.useEffect)(()=>{n&&S(`chrome-mounted`,{surface:r,chrome:`v1`})},[n,r,S]),(0,k.useEffect)(()=>{_(o.find(e=>e.id===c)?.url??``)},[o,c]);let ne=(0,k.useRef)(null);(0,k.useEffect)(()=>{if(e){if(o.some(t=>t.id===e)){l(e);return}ne.current!==e&&(ne.current=e,T())}},[e,o,T]);let re=(0,k.useCallback)(e=>{let t=y.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}`},[]),E=(0,k.useCallback)(()=>{let e=b.current;if(!e)return;let t=e.getBoundingClientRect();if(!(t.width<1||t.height<1))return{width:t.width,height:t.height}},[]);(0,k.useEffect)(()=>{let e=b.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>{let e=E();e&&x.current?.setPaneSize(e)});return t.observe(e),()=>t.disconnect()},[i,E]),(0,k.useEffect)(()=>{if(i!==`live`||!c)return;let e=Ne({protocol:window.location.protocol,host:window.location.host},c,ee.current),t=new WebSocket(e),n=new Pe(t,{onFrame:re,onLog:S,onUrlChange:_});return x.current=n,t.addEventListener(`open`,()=>n.start(E())),t.addEventListener(`message`,e=>{typeof e.data==`string`&&n.handleMessage(e.data)}),()=>{n.stop(),t.close(),x.current=null}},[i,c,re,S]);let ie=(0,k.useCallback)(e=>t=>{let n=y.current;if(!n)return;let r=n.getBoundingClientRect();x.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:Ie(t)})},[]);(0,k.useEffect)(()=>{let e=y.current;if(!e)return;let t=t=>{t.preventDefault();let n=e.getBoundingClientRect();x.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:Ie(t)})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[i]);let ae=(0,k.useCallback)(e=>t=>{t.preventDefault(),x.current?.dispatchKey(e,{key:t.key,code:t.code,modifiers:Ie(t)})},[]),oe=(0,k.useCallback)(e=>{e.preventDefault();let t=e.clipboardData.getData(`text`);t&&x.current?.insertText(t)},[]),se=(0,k.useCallback)(async()=>{d(!0),p(null);try{let e=await v(`/api/admin/browser/launch`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||`Launch failed (${e.status})`)}await T()}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}},[v,T]),D=(0,k.useCallback)(async()=>{h(!0),p(null);try{i===`no-tabs`&&await v(`/api/admin/browser/launch`,{method:`POST`});let e=await v(`/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 T(),t.id&&l(t.id)}catch(e){p(e instanceof Error?e.message:String(e))}finally{h(!1)}},[v,T,i]),le=(0,k.useCallback)(async e=>{h(!0),p(null);try{let t=await v(`/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 T()}catch(e){p(e instanceof Error?e.message:String(e))}finally{h(!1)}},[v,T]),ue=(0,k.useCallback)(e=>{x.current?.navigate(e)},[]),A=(0,k.useCallback)(e=>{x.current?.goHistory(e)},[]);return i===`probing`?(0,O.jsx)(`div`,{className:`cdp-screencast`,children:(0,O.jsxs)(`div`,{className:`data-loading`,children:[(0,O.jsx)(w,{size:18,className:`spin`}),` Connecting to the device browser…`]})}):i===`unavailable`?(0,O.jsx)(`div`,{className:`cdp-screencast`,children:(0,O.jsxs)(`div`,{className:`cdp-screencast__unavailable`,children:[(0,O.jsx)(C,{size:28,strokeWidth:1.75}),(0,O.jsx)(`p`,{children:`The device browser is not reachable.`})]})}):(0,O.jsxs)(`div`,{className:`cdp-screencast`,children:[n&&(0,O.jsx)(Fe,{targets:o,activeId:c,url:g,busy:m,onSelect:l,onClose:le,onNew:D,onBack:()=>A(-1),onForward:()=>A(1),onNavigate:ue}),f&&(0,O.jsx)(`div`,{className:`cdp-screencast__toolbar`,children:(0,O.jsx)(`span`,{className:`cdp-screencast__error`,children:f})}),i===`no-tabs`?(0,O.jsxs)(`div`,{className:`cdp-screencast__unavailable`,children:[(0,O.jsx)(C,{size:28,strokeWidth:1.75}),(0,O.jsx)(`p`,{children:`No open tabs on the device browser.`}),(0,O.jsxs)(`button`,{type:`button`,className:`cdp-screencast__btn`,onClick:se,disabled:u,children:[u?(0,O.jsx)(w,{size:14,className:`spin`}):(0,O.jsx)(C,{size:14}),` Launch browser`]})]}):(0,O.jsxs)(O.Fragment,{children:[!n&&(0,O.jsx)(`div`,{className:`cdp-screencast__tabs`,children:o.map(e=>(0,O.jsx)(`button`,{type:`button`,className:e.id===c?`cdp-screencast__tab is-active`:`cdp-screencast__tab`,onClick:()=>l(e.id),title:e.url,children:e.title},e.id))}),(0,O.jsx)(`div`,{className:`cdp-screencast__viewport`,ref:b,children:(0,O.jsx)(`canvas`,{ref:y,className:`cdp-screencast__canvas`,tabIndex:0,onMouseDown:ie(`mousePressed`),onMouseUp:ie(`mouseReleased`),onMouseMove:ie(`mouseMoved`),onKeyDown:ae(`keyDown`),onKeyUp:ae(`keyUp`),onPaste:oe})})]})]})}var Le=5e3,R=1200;function z(e){return Math.max(R,Math.round(Le/(e<1?1:e)))}var Re=500,B=new Set;function ze(e,t,n){let r=n??(typeof globalThis.fetch==`function`?globalThis.fetch:void 0);if(B.has(e)||!r)return!1;if(B.size>=Re){for(let e of B)if(B.delete(e),B.size<Re)break}B.add(e);try{Promise.resolve(r(`/api/admin/events`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({event:`wa-notify:rendered`,fields:{msgId:e,senderType:t}})})).catch(()=>{})}catch{}return!0}function Be({type:e}){return e===`admin`?(0,O.jsx)(`svg`,{className:`wa-notify-icon`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,O.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,O.jsx)(`svg`,{className:`wa-notify-icon`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,O.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,O.jsx)(`svg`,{className:`wa-notify-icon`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,O.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,O.jsx)(`svg`,{className:`wa-notify-icon`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,O.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 V({frames:e,onExpire:t}){let n=(0,k.useRef)(new Map),r=(0,k.useRef)(new Map);return(0,k.useEffect)(()=>{let i=Date.now(),a=z(e.length),o=new Set(e.map(e=>e.waMessageId));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.waMessageId;n.current.has(e)||(n.current.set(e,i),ze(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,O.jsx)(`div`,{className:`wa-notify-host`,children:[...e].reverse().map(e=>(0,O.jsxs)(`div`,{className:`wa-notify-card`,role:`status`,children:[(0,O.jsxs)(`div`,{className:`wa-notify-head`,children:[(0,O.jsx)(`span`,{className:`wa-notify-pill wa-notify-pill-${e.senderType}`,children:(0,O.jsx)(Be,{type:e.senderType})}),(0,O.jsx)(`span`,{className:`wa-notify-account`,children:e.accountName})]}),(0,O.jsx)(`div`,{className:`wa-notify-sender`,children:e.senderDisplay}),(0,O.jsxs)(`div`,{className:`wa-notify-body`,children:[e.body,e.truncated?`…`:``]})]},e.waMessageId))})}var Ve=`wa-notify`;function He({connected:e,onConnectClaude:t}){return e?(0,O.jsxs)(`span`,{className:`claude-status-pill`,"data-connected":`true`,title:`Claude is connected`,children:[(0,O.jsx)(`img`,{src:`/brand/claude.png`,alt:``,className:`claude-status-pill__mark`}),(0,O.jsx)(`span`,{className:`claude-status-pill__label`,children:`Connected`}),(0,O.jsx)(`span`,{className:`claude-status-pill__dot claude-status-pill__dot--live`,"aria-hidden":`true`})]}):(0,O.jsxs)(`button`,{type:`button`,className:`claude-status-pill claude-status-pill--action`,"data-connected":`false`,onClick:t,title:`Connect Claude`,children:[(0,O.jsx)(`img`,{src:`/brand/claude.png`,alt:``,className:`claude-status-pill__mark`}),(0,O.jsx)(`span`,{className:`claude-status-pill__label`,children:`Connect`}),(0,O.jsx)(`span`,{className:`claude-status-pill__dot claude-status-pill__dot--down`,"aria-hidden":`true`})]})}function Ue(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 We({title:e,sidebarOpen:t,onToggleSidebar:n,claudeConnected:r,onConnectClaude:i,browserOpen:a,onToggleBrowser:o}){let s=e??Ue(typeof window<`u`?window.location.pathname:`/`),c=r!==void 0&&i!==void 0,l=a!==void 0&&o!==void 0;return(0,O.jsxs)(`header`,{className:`admin-page-header`,children:[(0,O.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,O.jsx)(P,{className:`admin-page-header__toggle-desktop`,size:18,strokeWidth:1.75}),(0,O.jsx)(u,{className:`admin-page-header__toggle-mobile`,size:22,strokeWidth:1.75})]}),(0,O.jsx)(`h1`,{className:`admin-page-header__title`,children:s}),(c||l)&&(0,O.jsxs)(`div`,{className:`admin-page-header__right`,children:[l&&(0,O.jsx)(`button`,{type:`button`,className:a?`admin-page-header__icon is-active`:`admin-page-header__icon`,"aria-label":a?`Hide browser`:`Show browser`,title:a?`Hide browser`:`Show browser`,"aria-pressed":a,onClick:o,children:(0,O.jsx)(C,{size:18,strokeWidth:1.75})}),c&&(0,O.jsx)(He,{connected:r,onConnectClaude:i})]})]})}var Ge=[{label:`Home`,href:`/`,Icon:t,match:e=>e===`/`||e===``},{label:`Chat`,href:`/chat`,Icon:r,match:e=>e.startsWith(`/chat`)},{label:`Tasks`,href:`/tasks`,Icon:ve,match:e=>e.startsWith(`/tasks`)},{label:`Data`,href:`/data`,Icon:d,match:e=>e.startsWith(`/data`)},{label:`Calendar`,href:`/calendar`,Icon:o,match:e=>e.startsWith(`/calendar`)}],Ke=[{label:`Chat`,href:`/`,Icon:r,match:e=>e===`/`||e===``||e.startsWith(`/chat`)},{label:`Data`,href:`/data`,Icon:d,match:e=>e.startsWith(`/data`)}];function qe(e){let t=Ge.find(t=>t.match(e));return t?t.href:`/`}function Je({variant:e=`admin`,onOpenConversations:t}={}){let n=typeof window<`u`?window.location.pathname:`/`,i=e===`operator`?Ke:Ge,a=e===`operator`?Ke.find(e=>e.match(n))?.href??`/`:qe(n),o=e=>{let t=e.href===a,{Icon:n}=e;return(0,O.jsxs)(`a`,{href:e.href,className:`bottom-tab${t?` is-active`:``}`,"aria-current":t?`page`:void 0,children:[(0,O.jsx)(n,{size:19,strokeWidth:1.75}),(0,O.jsx)(`span`,{className:`bottom-tab__label`,children:e.label})]},e.href)};return(0,O.jsxs)(`nav`,{className:`bottom-tab-bar`,"aria-label":`Primary`,children:[i.slice(0,1).map(o),e===`operator`&&t&&(0,O.jsxs)(`button`,{type:`button`,className:`bottom-tab`,onClick:t,children:[(0,O.jsx)(r,{size:19,strokeWidth:1.75}),(0,O.jsx)(`span`,{className:`bottom-tab__label`,children:`Conversations`})]}),i.slice(1).map(o)]})}var H=`maxy-shell-side-px`;function Ye(){if(typeof window>`u`)return 0;let e=document.querySelector(`.platform > .artefact`)?.getBoundingClientRect();return e&&e.width>0?Math.round(e.width):0}function U(e){if(typeof window>`u`)return e;let t=window.innerWidth,n=Math.max(248,t-480-Ye());return Math.min(Math.max(e,248),n)}function Xe(){if(typeof window>`u`)return 264;try{let e=window.localStorage.getItem(H);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 U(t)}catch{}return 264}function Ze({targetSelector:e=`.platform`}){let t=(0,k.useRef)(null),[n,r]=(0,k.useState)(()=>Xe()),i=(0,k.useRef)(n);(0,k.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,k.useCallback)(()=>{r(e=>{let t=U(e);return t===e?e:t})},[]);(0,k.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(U(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(H,String(t))}catch{}};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s)},s=()=>{r(U(264));try{window.localStorage.removeItem(H)}catch{}};return(0,O.jsx)(`div`,{ref:t,className:`side-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,onPointerDown:o,onDoubleClick:s})}var Qe=y();function $e(e){return Math.max(14,e/2-386)}function et(e){return e.left===0&&e.top===0&&e.width===0&&e.height===0}var tt={position:`fixed`,visibility:`hidden`};function W({anchorRef:e,onClose:t,className:n,role:r,ariaLabel:i,anchorId:a,children:o}){let s=(0,k.useRef)(null),[c,l]=(0,k.useState)(tt),u=(0,k.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-$e(c)),top:Math.max(4,u-o.height-14),visibility:`visible`});return}if(d&&et(f)){l(tt),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,v=o.height+8<=g?!1:o.height+8<=_?!0:_>g,y=Math.max(0,v?_:g),b=v?Math.max(4,f.top-Math.min(o.height,y)):f.bottom;l({position:`fixed`,left:m,top:b,maxHeight:y,visibility:`visible`});let x=Math.min(o.height,y);d&&(m+o.width<=0||m>=c||b+x<=0||b>=u)&&p(m,b)},[e,a,n]);return(0,k.useLayoutEffect)(()=>{if(u(),typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>u());return s.current&&e.observe(s.current),()=>e.disconnect()},[u]),(0,k.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,Qe.createPortal)((0,O.jsx)(`div`,{ref:s,className:n,role:r,"aria-label":i,style:c,children:o}),document.body)}function nt({actions:e,disabled:t,label:n=`Session actions`}){let[r,i]=(0,k.useState)(!1),[a,o]=(0,k.useState)(null),s=(0,k.useRef)(null),c=(0,k.useCallback)(()=>{i(!1),o(null)},[]);return(0,O.jsxs)(`div`,{className:`conv-actions`,children:[(0,O.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,O.jsx)(u,{size:12})}),r&&(0,O.jsx)(W,{anchorRef:s,onClose:c,className:`conv-actions-menu`,role:`menu`,children:e.map(e=>e.panel?(0,O.jsxs)(`div`,{className:`conv-actions-menu-disclosure`,children:[(0,O.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,O.jsx)(`span`,{children:e.menuLabel})]}),a===e.key&&(0,O.jsx)(`div`,{className:`conv-actions-menu-panel`,children:e.panel()})]},e.key):(0,O.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,O.jsx)(`span`,{children:e.menuLabel})]},e.key))})]})}var G=`claude-opus-5[1m]`,K=`claude-sonnet-5`,q=`claude-haiku-4-5`,rt={[G]:`Opus 5 (1M context)`,[K]:`Sonnet 5`,[q]:`Haiku 4.5`};function it(e){return rt[e]??e}var at=[G,K,q];function J(e){return e.replace(/\[1m\]$/,``)}function ot(e){return at.find(t=>J(t)===J(e))??e}var st=[`default`,`acceptEdits`,`plan`,`auto`,`bypassPermissions`],ct=[`low`,`medium`,`high`,`xhigh`];[...st],[...ct],[...ct];var lt=[G,K,q],ut={default:`Ask permissions`,acceptEdits:`Accept edits`,plan:`Plan mode`,auto:`Auto mode`,bypassPermissions:`Bypass permissions`},dt=st.map(e=>({value:e,label:ut[e]??e})),ft={low:`Low`,medium:`Medium`,high:`High`,xhigh:`Highest`},pt=ct.map(e=>({value:e,label:ft[e]??e}));function mt(e){if(e){let t=lt.find(t=>J(t)===J(e));if(t)return t}return G}function ht({row:e,adminFetch:t,onError:n}){let[r,i]=(0,k.useState)(()=>mt(e.model)),[a,o]=(0,k.useState)(``),[s,c]=(0,k.useState)(``),[l,u]=(0,k.useState)(!1),d=(0,k.useRef)(!1);(0,k.useEffect)(()=>{i(mt(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,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`label`,{className:`reseat-field`,children:[(0,O.jsx)(`span`,{children:`Model`}),(0,O.jsx)(`select`,{"data-kind":`model`,value:r,disabled:l,onChange:e=>i(e.target.value),children:lt.map(e=>(0,O.jsx)(`option`,{value:e,children:it(e)},e))})]}),(0,O.jsxs)(`label`,{className:`reseat-field`,children:[(0,O.jsx)(`span`,{children:`Mode`}),(0,O.jsxs)(`select`,{"data-kind":`mode`,value:a,disabled:l,onChange:e=>o(e.target.value),children:[(0,O.jsx)(`option`,{value:``,children:`Keep current`}),dt.map(e=>(0,O.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(0,O.jsxs)(`label`,{className:`reseat-field`,children:[(0,O.jsx)(`span`,{children:`Effort`}),(0,O.jsxs)(`select`,{"data-kind":`effort`,value:s,disabled:l,onChange:e=>c(e.target.value),children:[(0,O.jsx)(`option`,{value:``,children:`Keep current`}),pt.map(e=>(0,O.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(0,O.jsx)(`button`,{type:`button`,className:`reseat-apply`,disabled:l,"aria-busy":l,onClick:()=>void f(),children:l?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(w,{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 gt(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function _t({target:e,anchorEl:t,onConfirm:n,onCancel:r}){let i=(0,k.useRef)(null);return i.current=t,e?(0,O.jsxs)(W,{anchorRef:i,onClose:r,className:`conv-delete-confirm`,role:`alertdialog`,ariaLabel:`Confirm delete session`,children:[(0,O.jsxs)(`div`,{className:`claude-info-header`,children:[(0,O.jsx)(`span`,{children:`Delete this conversation?`}),(0,O.jsx)(`button`,{className:`claude-info-close`,onClick:r,"aria-label":`Close`,children:`✕`})]}),(0,O.jsxs)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`,fontSize:`11px`,color:`var(--text-secondary)`},children:[(0,O.jsxs)(`div`,{className:`conv-delete-target`,children:[(0,O.jsx)(`span`,{className:`conv-delete-label`,title:e.title,children:e.title||`Untitled session`}),(0,O.jsx)(`code`,{className:`conv-delete-id`,title:e.sessionId,children:e.sessionId.slice(0,8)})]}),(0,O.jsx)(`div`,{style:{marginTop:`8px`},children:`This permanently removes the transcript. It is not moved to Archive and cannot be recovered.`}),e.live&&(0,O.jsx)(`div`,{style:{marginTop:`8px`},children:`This session is running; deleting stops it first.`})]}),(0,O.jsxs)(`div`,{className:`claude-info-section`,style:{display:`flex`,gap:`8px`,padding:`10px 14px`},children:[(0,O.jsx)(M,{variant:`danger`,size:`sm`,style:{flex:1},onClick:n,children:`Delete`}),(0,O.jsx)(M,{variant:`secondary`,size:`sm`,style:{flex:1},onClick:r,children:`Cancel`})]})]}):null}function vt({target:e,anchorEl:t,onConfirm:n,onCancel:r}){let i=(0,k.useRef)(null);return i.current=t,e?(0,O.jsxs)(W,{anchorRef:i,onClose:r,className:`conv-delete-confirm`,role:`alertdialog`,ariaLabel:`Confirm delete task`,children:[(0,O.jsxs)(`div`,{className:`claude-info-header`,children:[(0,O.jsx)(`span`,{children:`Delete this task?`}),(0,O.jsx)(`button`,{className:`claude-info-close`,onClick:r,"aria-label":`Close`,children:`✕`})]}),(0,O.jsxs)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`,fontSize:`11px`,color:`var(--text-secondary)`},children:[(0,O.jsxs)(`div`,{className:`conv-delete-target`,children:[(0,O.jsx)(`span`,{className:`conv-delete-label`,title:e.name,children:e.name}),(0,O.jsx)(`code`,{className:`conv-delete-id`,children:S(e.secondsLogged)})]}),(0,O.jsx)(`div`,{style:{marginTop:`8px`},children:`This permanently removes the task and every time record on it. It cannot be recovered.`})]}),(0,O.jsxs)(`div`,{className:`claude-info-section`,style:{display:`flex`,gap:`8px`,padding:`10px 14px`},children:[(0,O.jsx)(M,{variant:`danger`,size:`sm`,style:{flex:1},onClick:n,children:`Delete`}),(0,O.jsx)(M,{variant:`secondary`,size:`sm`,style:{flex:1},onClick:r,children:`Cancel`})]})]}):null}function yt({open:e,count:t,liveCount:n,onConfirm:r,onCancel:i}){if(!e)return null;let a=t===1?``:`s`;return(0,O.jsx)(`div`,{className:`claude-info-overlay`,onClick:i,children:(0,O.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),role:`alertdialog`,"aria-label":`Confirm delete sessions`,children:[(0,O.jsxs)(`div`,{className:`claude-info-header`,children:[(0,O.jsxs)(`span`,{children:[`Delete `,t,` conversation`,a,`?`]}),(0,O.jsx)(`button`,{className:`claude-info-close`,onClick:i,"aria-label":`Close`,children:`✕`})]}),(0,O.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,O.jsxs)(`div`,{style:{marginTop:`8px`},children:[n,` `,n===1?`is`:`are`,` running and will be stopped first.`]})]}),(0,O.jsxs)(`div`,{className:`claude-info-section`,style:{display:`flex`,gap:`8px`,padding:`10px 14px`},children:[(0,O.jsxs)(M,{variant:`danger`,size:`sm`,style:{flex:1},onClick:r,children:[`Delete `,t]}),(0,O.jsx)(M,{variant:`secondary`,size:`sm`,style:{flex:1},onClick:i,children:`Cancel`})]})]})})}function bt(e){return`New session: ${e.toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}`}function xt({open:e,pending:t,onConfirm:n,onCancel:r,now:i}){let[a,o]=(0,k.useState)(``),s=(0,k.useRef)(null),c=(0,k.useRef)(null),l=(0,k.useRef)(!1);if((0,k.useEffect)(()=>{if(!e){c.current=null,l.current=!1;return}if(c.current!==null)return;let t=bt(i?i():new Date);c.current=t,o(t)},[e,i]),(0,k.useEffect)(()=>{if(!e||l.current||c.current===null||a!==c.current)return;let t=s.current;t&&(l.current=!0,t.focus(),t.setSelectionRange(0,t.value.length))},[e,a]),!e)return null;let u=a.trim(),d=u.length>0&&u.length<=200,f=()=>{d&&!t&&n(u)},p=e=>{t||r(e)};return(0,O.jsx)(`div`,{className:`claude-info-overlay`,onClick:()=>p(`backdrop`),children:(0,O.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),role:`dialog`,"aria-label":`Name this session`,children:[(0,O.jsxs)(`div`,{className:`claude-info-header`,children:[(0,O.jsx)(`span`,{children:`Name this session`}),(0,O.jsx)(`button`,{className:`claude-info-close`,onClick:()=>p(`cancel`),"aria-label":`Close`,disabled:t,children:`✕`})]}),(0,O.jsxs)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`},children:[(0,O.jsx)(`input`,{ref:s,className:`new-session-name-input`,"aria-label":`Session name`,value:a,disabled:t,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),f()),e.key===`Escape`&&(e.preventDefault(),p(`escape`))}}),(0,O.jsx)(`div`,{className:`new-session-name-hint`,children:u.length>200?`Too long by ${u.length-200}`:`You can rename it later from the session menu.`})]}),(0,O.jsxs)(`div`,{className:`claude-info-section`,style:{display:`flex`,gap:`8px`,padding:`10px 14px`},children:[(0,O.jsx)(M,{variant:`primary`,size:`sm`,style:{flex:1},disabled:!d||t,onClick:f,children:t?`Starting…`:`Start session`}),(0,O.jsx)(M,{variant:`secondary`,size:`sm`,style:{flex:1},disabled:t,onClick:()=>p(`cancel`),children:`Cancel`})]})]})})}var St=`auth-refresh-failed`;function Ct({error:e,onClose:t}){if(!e)return null;let n=e.reason===St,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,O.jsx)(`div`,{className:`claude-info-overlay`,onClick:t,children:(0,O.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),role:`alertdialog`,"aria-label":`Session could not be opened`,children:[(0,O.jsxs)(`div`,{className:`claude-info-header`,children:[(0,O.jsx)(`span`,{children:r}),(0,O.jsx)(`button`,{className:`claude-info-close`,onClick:t,"aria-label":`Close`,children:`✕`})]}),(0,O.jsxs)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`,fontSize:`11px`,color:`var(--text-secondary)`},children:[i,(0,O.jsxs)(`div`,{className:`claude-info-row`,style:{marginTop:`8px`},children:[(0,O.jsx)(`span`,{className:`claude-info-label`,children:`Reason`}),(0,O.jsx)(`span`,{className:`claude-info-value`,children:e.reason})]}),e.sessionId&&(0,O.jsxs)(`div`,{className:`claude-info-row`,children:[(0,O.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,O.jsxs)(`span`,{className:`claude-info-value`,children:[e.sessionId.slice(0,8),`…`]})]})]})]})})}function wt(e){let{show:t,onClose:n,claudeInfo:r,messages:i,sessionElapsed:a,sessionId:o,cacheKey:s}=e,[c,l]=(0,k.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,O.jsx)(`div`,{className:`claude-info-overlay`,onClick:n,children:(0,O.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),children:[(0,O.jsxs)(`div`,{className:`claude-info-header`,children:[(0,O.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`claude-info-icon`}),(0,O.jsx)(`span`,{children:`Claude Code`}),(0,O.jsx)(`button`,{className:`claude-info-close`,onClick:n,"aria-label":`Close`,children:`✕`})]}),(0,O.jsxs)(`div`,{className:`claude-info-section`,children:[(0,O.jsxs)(`div`,{className:`claude-info-row`,children:[(0,O.jsx)(`span`,{className:`claude-info-label`,children:`Version`}),(0,O.jsx)(`span`,{className:`claude-info-value`,children:r?r.version:`…`})]}),(0,O.jsxs)(`div`,{className:`claude-info-row`,children:[(0,O.jsx)(`span`,{className:`claude-info-label`,children:`Email`}),(0,O.jsx)(`span`,{className:`claude-info-value`,children:r?.account?.email??`…`})]})]}),(g||m||h>0)&&(0,O.jsxs)(`div`,{className:`claude-info-section`,children:[g&&(0,O.jsxs)(`div`,{className:`claude-info-row`,children:[(0,O.jsx)(`span`,{className:`claude-info-label`,children:`Plan`}),(0,O.jsx)(`span`,{className:`claude-info-value`,style:{textTransform:`capitalize`},children:g})]}),m&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`claude-info-row`,children:[(0,O.jsx)(`span`,{className:`claude-info-label`,children:`Usage`}),(0,O.jsxs)(`span`,{className:`claude-info-value`,children:[Math.round(m.utilization*100),`%`]})]}),(0,O.jsxs)(`div`,{className:`claude-info-row`,children:[(0,O.jsx)(`span`,{className:`claude-info-label`,children:`Resets in`}),(0,O.jsx)(`span`,{className:`claude-info-value`,children:_(m.resetsAt)})]}),m.isUsingOverage&&(0,O.jsxs)(`div`,{className:`claude-info-row`,children:[(0,O.jsx)(`span`,{className:`claude-info-label`,children:`Overage`}),(0,O.jsx)(`span`,{className:`claude-info-value`,children:`Active`})]})]}),h>0&&(0,O.jsxs)(`div`,{className:`claude-info-row`,children:[(0,O.jsx)(`span`,{className:`claude-info-label`,children:`Session cost`}),(0,O.jsxs)(`span`,{className:`claude-info-value`,children:[`$`,h<.01?h.toFixed(4):h.toFixed(2)]})]})]}),(0,O.jsxs)(`div`,{className:`claude-info-section`,children:[(0,O.jsxs)(`div`,{className:`claude-info-row`,children:[(0,O.jsx)(`span`,{className:`claude-info-label`,children:`Model`}),(0,O.jsx)(`span`,{className:`claude-info-value`,children:r?.model??`…`})]}),(0,O.jsxs)(`div`,{className:`claude-info-row`,children:[(0,O.jsx)(`span`,{className:`claude-info-label`,children:`Context used`}),(0,O.jsx)(`span`,{className:`claude-info-value`,children:f>0?`${f}%`:`—`})]}),(0,O.jsxs)(`div`,{className:`claude-info-row`,children:[(0,O.jsx)(`span`,{className:`claude-info-label`,children:`Tokens`}),(0,O.jsx)(`span`,{className:`claude-info-value`,children:p>0?gt(p):`—`})]}),(0,O.jsxs)(`div`,{className:`claude-info-row`,children:[(0,O.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,O.jsx)(`span`,{className:`claude-info-value`,children:Y(a)})]}),(o||s)&&(()=>{let e=o??s??``;return(0,O.jsxs)(`div`,{className:`claude-info-row`,children:[(0,O.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,O.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 E(e)?`copied`:`failed`),setTimeout(()=>l(null),1200)},children:c===`copied`?`copied ✓`:c===`failed`?`copy failed ✕`:`${e.slice(0,8)}…`})]})})()]})]})})}function Tt({open:e,onConnect:t,onClose:n}){return e?(0,O.jsx)(`div`,{className:`claude-info-overlay`,onClick:n,children:(0,O.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),role:`alertdialog`,"aria-label":`Claude is not connected`,children:[(0,O.jsxs)(`div`,{className:`claude-info-header`,children:[(0,O.jsx)(`span`,{children:`Claude isn’t connected`}),(0,O.jsx)(`button`,{className:`claude-info-close`,onClick:n,"aria-label":`Close`,children:`✕`})]}),(0,O.jsxs)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`,fontSize:`11px`,color:`var(--text-secondary)`,display:`flex`,flexDirection:`column`,gap:`10px`},children:[(0,O.jsx)(`span`,{children:`This needs Claude, which is currently disconnected. Connect to continue — the rest of the dashboard stays available either way.`}),(0,O.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,alignItems:`center`},children:[(0,O.jsx)(M,{variant:`primary`,size:`sm`,onClick:t,children:`Connect Claude`}),(0,O.jsx)(`button`,{type:`button`,className:`claude-info-close`,style:{fontSize:`11px`},onClick:n,children:`Not now`})]})]})]})}):null}function Et(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 Dt(e){return e.activeMs.thinking+e.activeMs.messaging+e.activeMs.toolUse}function Ot(e){return e.toLocaleString(`en-GB`)}function kt(e){return`£${e.toFixed(2)}`}function At(e){let t=[`Day`,`Active`,`Output tokens`,`Input tokens`,`Cache write`,`Cache read`,`Opus 5 (GBP)`,`Sonnet 5 (GBP)`],n=(e,t)=>[e,Et(Dt(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(`
|
|
2
|
-
`)}function X({label:e,d:t,bold:n}){let r=n?`th`:`td`;return(0,O.jsxs)(`tr`,{className:n?`usage-total-row`:void 0,children:[(0,O.jsx)(r,{className:`usage-day`,children:e}),(0,O.jsx)(r,{children:Et(Dt(t))}),(0,O.jsx)(r,{children:Ot(t.tokens.output)}),(0,O.jsx)(r,{children:Ot(t.tokens.input)}),(0,O.jsx)(r,{children:Ot(t.tokens.cacheWrite)}),(0,O.jsx)(r,{children:Ot(t.tokens.cacheRead)}),(0,O.jsx)(r,{children:kt(t.costGBP.opus)}),(0,O.jsx)(r,{children:kt(t.costGBP.sonnet)})]})}function jt({show:e,onClose:t,anchorEl:n,sessionId:r,summary:i,loading:a,error:o}){let s=(0,k.useRef)(null);if(s.current=n,!e)return null;let c=!!i&&i.days.length>0;return(0,O.jsxs)(W,{anchorRef:s,onClose:t,className:`usage-popover`,role:`dialog`,ariaLabel:`Session usage and cost`,anchorId:r??void 0,children:[(0,O.jsxs)(`div`,{className:`claude-info-header`,children:[(0,O.jsxs)(`span`,{children:[`Usage & cost`,r?` · ${r.slice(0,8)}`:``]}),c&&(0,O.jsx)(`button`,{className:`usage-download`,onClick:()=>{if(!i)return;let e=new Blob([At(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,O.jsx)(l,{size:14})}),(0,O.jsx)(`button`,{className:`claude-info-close`,onClick:t,"aria-label":`Close`,children:(0,O.jsx)(x,{size:14})})]}),(0,O.jsxs)(`div`,{className:`claude-info-section usage-body`,children:[a&&(0,O.jsx)(`div`,{className:`usage-note`,children:`Computing usage…`}),!a&&o&&(0,O.jsx)(`div`,{className:`usage-note usage-error`,children:o}),!a&&!o&&i&&i.days.length===0&&(0,O.jsx)(`div`,{className:`usage-note`,children:`No usage recorded for this session yet.`}),!a&&!o&&i&&i.days.length>0&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`div`,{className:`usage-table-scroll`,children:(0,O.jsxs)(`table`,{className:`usage-table`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{className:`usage-day`,children:`Day`}),(0,O.jsx)(`th`,{children:`Active`}),(0,O.jsx)(`th`,{children:`Output tok`}),(0,O.jsx)(`th`,{children:`Input tok`}),(0,O.jsx)(`th`,{children:`Cache write`}),(0,O.jsx)(`th`,{children:`Cache read`}),(0,O.jsx)(`th`,{children:`Opus 5 (£)`}),(0,O.jsx)(`th`,{children:`Sonnet 5 (£)`})]})}),(0,O.jsxs)(`tbody`,{children:[i.days.map(e=>(0,O.jsx)(X,{label:e.date,d:e},e.date)),(0,O.jsx)(X,{label:`TOTAL (${i.days.length} d)`,d:i.totals,bold:!0})]})]})}),(0,O.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 Mt=`https://claude.ai/code`,Nt=200,Pt=[500,1e3,1500,2e3,2500,3e3,3e3];function Ft(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:`${Mt}/${r}`,sameOrigin:!1};let i=n.reason||n.error||`status ${t}`;return{kind:`error`,sessionId:n.sessionId??null,reason:i}}function It(e){if(!e)return``;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`}):``}function Lt(e){let{businessName:a,cacheKey:s,onConnectClaude:l,role:u,userName:_,userAvatar:v,onSelectProjects:y,onSelectTasks:b,onCloseMobileDrawer:x,collapsed:S,onSelectData:T,initialDataSurface:E=!1,onLogout:ae,onDisconnect:D,disconnecting:le,claudeConnected:A=!0,subAccounts:j,activeAccountId:M,switchingAccount:N,onSwitchAccount:P,refreshAccounts:Ce,onOpenConversations:we}=e,I=ce(s),Te=(0,k.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,O.jsx)(F,{size:12}),panel:()=>(0,O.jsx)(ht,{row:e,adminFetch:I,onError:e=>z({message:e,failed:!0})})}),[I]),Ee=n.productName,De=a||Ee,Oe=typeof _==`string`?_:_===null?`name unavailable`:De,ke=(Oe.trim().charAt(0)||`?`).toUpperCase(),[Ae,je]=(0,k.useState)(E?`data`:`sessions`),[Me,Ne]=(0,k.useState)(!1),[Pe,Fe]=(0,k.useState)(!1),Ie=!S&&(j?.length??0)>1&&!!P,L=j?.find(e=>e.isHouse)??null,Le=(0,k.useCallback)(()=>{L&&L.accountId!==M&&(Fe(!1),P?.(L.accountId,`/`))},[L,M,P]),[R,z]=(0,k.useState)(null),[Re,B]=(0,k.useState)(null),[ze,Be]=(0,k.useState)(!1),[V,Ve]=(0,k.useState)([]),[He]=(0,k.useState)(()=>typeof window>`u`?null:new URLSearchParams(window.location.search).get(`session`)),[Ue,We]=(0,k.useState)(!1),[Ge,Ke]=(0,k.useState)(null),[qe,Je]=(0,k.useState)(!1),[H,Ye]=(0,k.useState)(!1),[U,Xe]=(0,k.useState)(!1),[Ze,Qe]=(0,k.useState)(null),[$e,et]=(0,k.useState)(new Set),tt=(0,k.useRef)(new Map),[W,G]=(0,k.useState)(!1),[K,q]=(0,k.useState)(new Set),[rt,it]=(0,k.useState)(!1),[at,J]=(0,k.useState)(null),[ot,st]=(0,k.useState)(new Set),[ct,lt]=(0,k.useState)(new Set),[ut,dt]=(0,k.useState)(new Set),[ft,pt]=(0,k.useState)(null),[mt,Y]=(0,k.useState)(``),[gt,vt]=(0,k.useState)(!1),[bt,St]=(0,k.useState)(null),[wt,Et]=(0,k.useState)(null),[Dt,Ot]=(0,k.useState)(!1),[kt,At]=(0,k.useState)(null),[X,Mt]=(0,k.useState)(!1),[Lt,Rt]=(0,k.useState)(!1),Vt=(0,k.useRef)(0);(0,k.useEffect)(()=>{if(!R)return;let e=setTimeout(()=>z(null),2500);return()=>clearTimeout(e)},[R]);let Z=(0,k.useCallback)(async()=>{if(!s)return null;let e=++Vt.current;Je(!0),Ke(null);try{let t=await I(`/api/admin/sidebar-sessions`);if(!t.ok)throw Error(`status ${t.status}`);let n=await t.json(),r=n.sessions??[];return e===Vt.current?(Ve(r),Qe(n.accountId??null),We(!0),r):r}catch(t){let n=t instanceof Error?t.message:String(t);return e===Vt.current&&Ke(`Failed to load sessions: ${n}`),console.error(`[admin-ui] sidebar-sessions fetch failed: ${n}`),null}finally{e===Vt.current&&Je(!1)}},[s,I]);(0,k.useEffect)(()=>{!s||Ue||Z()},[s,Ue,Z]),(0,k.useEffect)(()=>{if(!s)return;let e=null;function t(){Z()}function n(){e===null&&(e=setInterval(t,zt))}function r(){e!==null&&(clearInterval(e),e=null)}function i(){document.hidden?r():(t(),n())}return document.hidden||n(),document.addEventListener(`visibilitychange`,i),()=>{r(),document.removeEventListener(`visibilitychange`,i)}},[s,Z]);let Ht=()=>{Z()},Ut=()=>{je(`data`),T(),x()},Q=typeof window<`u`&&window.location?.pathname||`/`,Wt=Ae===`data`,Gt=typeof window<`u`&&window.location?.search||``,Kt=new URLSearchParams(Gt),qt=Kt.has(`label`)&&!Kt.has(`nodeId`),$=e=>{x(),window.location.href=e},Jt=[{key:`dashboard`,label:`Dashboard`,icon:(0,O.jsx)(t,{size:17,strokeWidth:1.75}),active:Q===`/`&&!Wt,onClick:()=>$(`/`)},{key:`chat`,label:`Chat`,icon:(0,O.jsx)(r,{size:17,strokeWidth:1.75}),active:Q.startsWith(`/chat`),onClick:()=>$(`/chat`)},{key:`tasks`,label:`Tasks`,icon:(0,O.jsx)(ve,{size:17,strokeWidth:1.75}),active:Q.startsWith(`/tasks`),onClick:()=>{b(),x()}},{key:`calendar`,label:`Calendar`,icon:(0,O.jsx)(o,{size:17,strokeWidth:1.75}),active:Q.startsWith(`/calendar`),onClick:()=>$(`/calendar`)},{key:`routines`,label:`Routines`,icon:(0,O.jsx)(Se,{size:17,strokeWidth:1.75}),active:Q.startsWith(`/routines`),onClick:()=>$(`/routines`)},{key:`skills`,label:`Skills`,icon:(0,O.jsx)(be,{size:17,strokeWidth:1.75}),active:Q.startsWith(`/skills`),onClick:()=>$(`/skills`)},{key:`agents`,label:`Agents`,icon:(0,O.jsx)(pe,{size:17,strokeWidth:1.75}),active:Q.startsWith(`/agents`),onClick:()=>$(`/agents`)},{key:`data`,label:`Data`,icon:(0,O.jsx)(d,{size:17,strokeWidth:1.75}),active:Wt,onClick:Ut},{key:`container`,label:h().term,icon:(0,O.jsx)(c,{size:17,strokeWidth:1.75}),active:Q.startsWith(`/graph`)&&qt,onClick:()=>{y(),x()}},{key:`graph`,label:`Graph`,icon:(0,O.jsx)(xe,{size:17,strokeWidth:1.75}),active:Q.startsWith(`/graph`)&&!qt,onClick:()=>$(`/graph`)},{key:`activity`,label:`Activity`,icon:(0,O.jsx)(f,{size:17,strokeWidth:1.75}),active:Q.startsWith(`/activity`),onClick:()=>$(`/activity`)},{key:`browser`,label:`Browser`,icon:(0,O.jsx)(C,{size:17,strokeWidth:1.75}),active:Q.startsWith(`/browser`),onClick:()=>$(`/browser`)}],Yt=(0,k.useCallback)(async e=>{if(ot.has(e.sessionId))return;st(t=>{let n=new Set(t);return n.add(e.sessionId),n});let t=window.open(``,`_blank`);try{let n=await I(`/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=Ft(n.ok,n.status,{...r,sessionId:r.sessionId??e.sessionId});i.kind===`navigate`?(x(),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}`),B(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}`),B({sessionId:e.sessionId,reason:r})}finally{st(t=>{let n=new Set(t);return n.delete(e.sessionId),n})}},[I,x,ot]),Xt=(0,k.useCallback)(async e=>{let t=e.slice(0,8);for(let t=1;t<=Pt.length;t++){await new Promise(e=>setTimeout(e,Pt[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]),Zt=(0,k.useCallback)(async e=>{if(!X){Mt(!0);try{let t=await I(`/api/admin/session-rc-spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:e})}),n=await t.json().catch(()=>({})),r=Ft(t.ok,t.status,n);r.kind===`navigate`?r.sameOrigin?window.location.assign(r.url):(window.open(r.url,`_blank`),n.sessionId?Xt(n.sessionId):console.error(`[admin-ui] sidebar-new-session-converge-skipped reason=no-session-id`)):t.status===503||r.reason===`claude-auth-dead`?(Rt(!1),Be(!0)):(console.error(`[admin-ui] sidebar-new-session-failed status=${t.status} reason=${r.reason}`),Rt(!1),B(r))}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[admin-ui] sidebar-new-session-failed error=${t}`),Rt(!1),B({sessionId:null,reason:t})}finally{Mt(!1)}}},[I,X,Xt]),Qt=(0,k.useCallback)((e,t)=>{e.stopPropagation(),J(t)},[]),$t=(0,k.useCallback)(async(e,t)=>{e.stopPropagation(),St(t),Et(null),At(null),Ot(!0);try{let e=await I(`/api/admin/session-usage?sessionId=${encodeURIComponent(t.sessionId)}`),n=await e.json().catch(()=>({}));e.ok?Et(n):At(n.error??`status ${e.status}`)}catch(e){At(e instanceof Error?e.message:String(e))}finally{Ot(!1)}},[I]),en=(0,k.useCallback)(async(e,t={})=>{let n=t.refresh??!0;if($e.has(e.sessionId))return!1;et(t=>{let n=new Set(t);return n.add(e.sessionId),n});try{let t=await I(`/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`}`),z({message:`Delete failed: ${n.error??`status ${t.status}`}`,failed:!0}),!1}return await t.json(),Ve(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}`),z({message:`Delete failed: ${n}`,failed:!0}),!1}finally{et(t=>{let n=new Set(t);return n.delete(e.sessionId),n})}},[I,$e,Z]),tn=(0,k.useCallback)(e=>{q(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),nn=(0,k.useCallback)(()=>{G(!1),q(new Set)},[]),rn=(0,k.useCallback)(async()=>{let e=[...K].map(e=>V.find(t=>t.sessionId===e)).filter(e=>!!e),t=(await Promise.all(e.map(e=>en(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(),nn()},[K,V,en,Z,nn]),an=(0,k.useCallback)(async(e,t)=>{if(e.stopPropagation(),!ct.has(t.sessionId)){lt(e=>{let n=new Set(e);return n.add(t.sessionId),n});try{let e=await I(`/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`}`),z({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}`),z({message:`Stop failed: ${n}`,failed:!0})}finally{lt(e=>{let n=new Set(e);return n.delete(t.sessionId),n})}}},[I,ct,Z]),on=(0,k.useCallback)(async(e,t,n)=>{if(e.stopPropagation(),!ut.has(t.sessionId)){dt(e=>{let n=new Set(e);return n.add(t.sessionId),n});try{let e=await I(`/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`}`),z({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}`),z({message:`${n===`archive`?`Archive`:`Unarchive`} failed: ${r}`,failed:!0})}finally{dt(e=>{let n=new Set(e);return n.delete(t.sessionId),n})}}},[I,ut,Z]),sn=(0,k.useCallback)(async e=>{let t=mt.trim();if(!t){z({message:`Title can’t be empty`,failed:!0});return}if(t.length>Nt){z({message:`Title too long (max ${Nt})`,failed:!0});return}vt(!0);try{let n=await I(`/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}`),z({message:`Rename failed: ${r}`,failed:!0});return}pt(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}`),z({message:`Rename failed: ${n}`,failed:!0})}finally{vt(!1)}},[I,mt,Z]);return(0,O.jsxs)(`aside`,{className:`side`,children:[(0,O.jsxs)(`div`,{className:`side-brand`,children:[Ie?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`button`,{type:`button`,className:`side-brand-icon-btn`,"aria-label":`Switch to house account`,disabled:!L,onClick:Le,children:(0,O.jsx)(`img`,{className:`side-brand-icon`,src:g,alt:``,"aria-hidden":`true`})}),(0,O.jsxs)(`button`,{type:`button`,className:`side-brand-trigger`,"aria-haspopup":`menu`,"aria-expanded":Pe,"aria-label":`Switch sub-account`,onClick:()=>{let e=!Pe;Fe(e),e&&Ce?.()},children:[(0,O.jsxs)(`span`,{className:`side-brand-lockup`,children:[(0,O.jsx)(`span`,{className:`side-brand-business`,children:De}),(0,O.jsx)(`span`,{className:`side-brand-product`,children:n.productName})]}),(0,O.jsx)(me,{size:14,className:`side-brand-caret`,"aria-hidden":`true`})]})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`img`,{className:`side-brand-icon`,src:g,alt:``,"aria-hidden":`true`}),(0,O.jsxs)(`span`,{className:`side-brand-lockup`,children:[(0,O.jsx)(`span`,{className:`side-brand-business`,children:De}),(0,O.jsx)(`span`,{className:`side-brand-product`,children:n.productName})]})]}),Pe&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`div`,{className:`side-brand-scrim`,"aria-hidden":`true`,onClick:()=>Fe(!1)}),(0,O.jsx)(ee,{open:Pe,accounts:j??[],activeAccountId:M??null,switching:N??!1,onSelect:e=>P?.(e),onClose:()=>Fe(!1)})]})]}),(0,O.jsx)(`nav`,{className:`side-nav`,children:Jt.map(e=>(0,O.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,O.jsx)(`span`,{className:`label`,children:e.label}),(0,O.jsx)(`span`,{className:`kbd`})]},e.key))}),(()=>{let e=V.filter(e=>H?!0:!e.isSubagent).filter(e=>U?!0:!e.archived),t=V.some(e=>e.isSubagent),n=V.some(e=>e.archived);return(0,O.jsx)(`div`,{className:`side-sessions`,children:(0,O.jsxs)(`div`,{className:`side-list`,children:[(0,O.jsxs)(`div`,{className:`group-head`,children:[(0,O.jsx)(`span`,{children:`Sessions`}),(0,O.jsxs)(`span`,{className:`group-head-meta`,children:[(0,O.jsx)(`button`,{type:`button`,className:`group-head-select${W?` active`:``}`,"aria-pressed":W,title:W?`Exit select mode`:`Select multiple sessions to delete`,onClick:()=>{G(e=>!e),q(new Set),pt(null),Y(``)},children:`Select`}),(0,O.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh sessions`,"aria-label":`Refresh sessions`,onClick:Ht,disabled:qe,children:(0,O.jsx)(oe,{size:12,className:qe?`spinning`:void 0})}),(0,O.jsx)(`span`,{children:qe?`…`:String(e.length)}),(0,O.jsxs)(`button`,{type:`button`,className:`admin-btn-cta side-sessions-new`,onClick:()=>{Rt(!0)},disabled:X,"aria-busy":X,"aria-label":X?`Spawning session`:`New session`,title:X?`Spawning session`:`New session`,children:[X?(0,O.jsx)(w,{size:13,className:`spinning`}):(0,O.jsx)(m,{size:13}),(0,O.jsx)(`span`,{children:X?`Spawning…`:`New session`})]})]})]}),W&&(0,O.jsxs)(`div`,{className:`session-select-bar`,children:[(0,O.jsxs)(`span`,{className:`session-select-count`,children:[K.size,` selected`]}),(0,O.jsxs)(`button`,{type:`button`,className:`session-select-delete`,disabled:K.size===0,onClick:()=>it(!0),children:[`Delete `,K.size]}),(0,O.jsx)(`button`,{type:`button`,className:`session-select-cancel`,onClick:nn,children:`Cancel`})]}),Ze&&(0,O.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,O.jsx)(`code`,{children:Ze})}),(t||n)&&(0,O.jsxs)(`div`,{className:`artefact-filter-chips`,children:[t&&(0,O.jsx)(`button`,{type:`button`,className:`artefact-filter-chip${H?` active`:``}`,"aria-pressed":H,onClick:()=>Ye(e=>!e),title:H?`Hide subagent sessions`:`Show subagent sessions`,children:`Subagents`}),n&&(0,O.jsx)(`button`,{type:`button`,className:`artefact-filter-chip${U?` active`:``}`,"aria-pressed":U,onClick:()=>Xe(e=>!e),title:U?`Hide archived sessions`:`Show archived sessions`,children:`Archived`})]}),Ge&&(0,O.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:Ge}),Ue&&!Ge&&e.length===0&&(0,O.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:`No sessions yet`}),e.map(e=>{let t=It(e.startedAt),n=ot.has(e.sessionId),r=$e.has(e.sessionId),a=ct.has(e.sessionId),o=ut.has(e.sessionId),s=n||r||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,O.jsx)(ge,{size:12}),busy:n,onClick:()=>{Yt(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,O.jsx)(ye,{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,O.jsx)(_e,{size:12}),onClick:t=>{$t(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,O.jsx)(p,{size:12}),busy:a,onClick:t=>{an(t,e)}}]:[],e.archived?{key:`unarchive`,label:`Unarchive session ${e.title}`,menuLabel:`Unarchive`,title:`Unarchive (move back to the active list)`,icon:(0,O.jsx)(de,{size:12}),busy:o,onClick:t=>{on(t,e,`unarchive`)}}:{key:`archive`,label:`Archive session ${e.title}`,menuLabel:`Archive`,title:`Archive (hide from the list, keeps the conversation resumable)`,icon:(0,O.jsx)(fe,{size:12}),busy:o,onClick:t=>{on(t,e,`archive`)}},{key:`rename`,label:`Rename session ${e.title}`,menuLabel:`Rename`,title:`Rename this session`,icon:(0,O.jsx)(i,{size:12}),busy:gt&&ft===e.sessionId,onClick:t=>{t.stopPropagation(),pt(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,O.jsx)(se,{size:12}),danger:!0,busy:r,onClick:t=>{Qt(t,e)}},Te({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=ie.includes(e.channel??``)&&e.senderId&&e.titleSource===`prefix`?ne({operatorName:e.personName??null,whatsappName:e.whatsappName??null,senderId:e.senderId,title:e.title,channel:e.channel}):e.personName??e.title;return(0,O.jsxs)(`div`,{ref:t=>{let n=tt.current;t?n.set(e.sessionId,t):n.delete(e.sessionId)},className:`conv conv-with-actions${u}${e.sessionId===He?` active`:``}`,children:[(0,O.jsxs)(`div`,{className:`conv-main-static conv-main-clickable`,role:`button`,tabIndex:0,"aria-label":`Open ${f} in webchat`,onClick:()=>{if(ft!==e.sessionId){if(W){tn(e.sessionId);return}c()}},onKeyDown:t=>{ft!==e.sessionId&&(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),W?tn(e.sessionId):c())},children:[W&&(0,O.jsx)(`span`,{className:`conv-select-check`,onClick:e=>e.stopPropagation(),children:(0,O.jsx)(ue,{checked:K.has(e.sessionId),ariaLabel:`Select ${f}`,onChange:()=>tn(e.sessionId)})}),(0,O.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,O.jsxs)(`span`,{className:`conv-stack`,children:[(0,O.jsxs)(`span`,{className:`conv-name-line`,children:[d&&(0,O.jsx)(re,{channel:e.channel,size:13}),ft===e.sessionId?(0,O.jsx)(`input`,{className:`conv-name conv-name-edit`,autoFocus:!0,onFocus:e=>e.currentTarget.select(),value:mt,disabled:gt,"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(),sn(e)):t.key===`Escape`&&(t.preventDefault(),pt(null),Y(``))},onBlur:()=>{ft===e.sessionId&&!gt&&(pt(null),Y(``))}}):(0,O.jsx)(`span`,{className:`conv-name`,title:f,children:f})]}),(0,O.jsxs)(`span`,{className:`conv-timestamp`,children:[(0,O.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)}),t&&(0,O.jsxs)(`span`,{children:[` · `,t]})]})]})]}),!W&&(0,O.jsx)(nt,{actions:l,disabled:s})]},e.sessionId)})]})})})(),(0,O.jsxs)(`div`,{className:`side-foot`,children:[(0,O.jsx)(`div`,{className:`avatar`,children:v?(0,O.jsx)(`img`,{src:v,alt:Oe}):ke}),(0,O.jsxs)(`div`,{className:`who`,children:[(0,O.jsx)(`span`,{className:`name`,children:Oe}),(0,O.jsx)(Bt,{})]}),(0,O.jsx)(`button`,{type:`button`,className:`side-foot-kebab`,"aria-label":`Account menu`,"aria-haspopup":`menu`,"aria-expanded":Me,onClick:()=>Ne(e=>!e),children:(0,O.jsx)(he,{size:16})}),Me&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`div`,{className:`side-foot-menu-scrim`,"aria-hidden":`true`,onClick:()=>Ne(!1)}),(0,O.jsx)(`div`,{className:`side-foot-menu`,role:`menu`,children:(0,O.jsx)(te,{variant:`admin`,onCloseMenu:()=>Ne(!1),onLogout:ae??(()=>{}),onDisconnect:D,disconnecting:le,claudeConnected:A,onConnectClaude:l,cacheKey:s,onOpenConversations:we})})]})]}),R&&(0,O.jsx)(`div`,{className:`copy-toast${R.failed?` copy-toast-failed`:``}`,role:`status`,children:R.message}),(0,O.jsx)(xt,{open:Lt,pending:X,onConfirm:e=>{Zt(e)},onCancel:e=>{Rt(!1)}}),(0,O.jsx)(Ct,{error:Re,onClose:()=>B(null)}),(0,O.jsx)(Tt,{open:ze,onConnect:()=>{Be(!1),l?.()},onClose:()=>Be(!1)}),(0,O.jsx)(_t,{target:at,anchorEl:at?tt.current.get(at.sessionId)??null:null,onCancel:()=>J(null),onConfirm:()=>{let e=at;J(null),e&&en(e)}},at?.sessionId??`none`),(0,O.jsx)(yt,{open:rt,count:K.size,liveCount:V.filter(e=>K.has(e.sessionId)&&e.live).length,onConfirm:()=>{it(!1),rn()},onCancel:()=>it(!1)}),(0,O.jsx)(jt,{show:bt!==null,onClose:()=>{St(null),Et(null),At(null)},anchorEl:bt?tt.current.get(bt.sessionId)??null:null,sessionId:bt?.sessionId??null,summary:wt,loading:Dt,error:kt},bt?.sessionId??`none`)]})}var Rt=5e3,zt=3e4;function Bt(){let[e,t]=(0,k.useState)(null);if((0,k.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()},Rt))}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,O.jsxs)(`span`,{className:d.join(` `),role:`status`,"aria-label":`host CPU and RAM`,children:[(0,O.jsxs)(`span`,{className:i?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`CPU `,u(n)]}),` · `,(0,O.jsxs)(`span`,{className:o?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`RAM `,u(r)]})]})}function Vt(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 Z(){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 Ht=500,Ut=new Set,Q=new Set;function Wt(e,t){if(e.size>=Ht){for(let t of e)if(e.delete(t),e.size<Ht)break}e.add(t)}function Gt(e){return e??(typeof globalThis.fetch==`function`?globalThis.fetch:void 0)}function Kt(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 qt(e,t){let n=Gt(t);return n?(Kt(n,`wa-notify:desktop-capability`,{supported:e.supported,secure:e.secureContext,permission:e.permission}),!0):!1}function $(e,t,n,r){if(Ut.has(e))return!1;let i=Gt(r);return i?(Wt(Ut,e),Kt(i,`wa-notify:desktop-outcome`,{msgId:e,senderType:t,reason:n}),!0):!1}function Jt(e,t,n){try{if(Q.has(e.waMessageId))return;Wt(Q,e.waMessageId);let r=Vt(Z());if(!r.show){$(e.waMessageId,e.senderType,r.reason,n);return}new Notification(`${e.accountName} · ${e.senderDisplay}`,{body:e.body+(e.truncated?`…`:``),icon:t,tag:e.waMessageId}),$(e.waMessageId,e.senderType,`shown`,n)}catch{$(e.waMessageId,e.senderType,`construct-failed`,n)}}var Yt=`admin-sidebar-collapsed`,Xt=`admin-sidebar-drawer-open`,Zt=1080;function Qt(){if(typeof window>`u`)return!1;let e=null;try{e=window.sessionStorage.getItem(Yt)}catch{e=null}return e===null?typeof window.matchMedia==`function`?window.matchMedia(`(min-width: 721px) and (max-width: ${Zt}px)`).matches:!1:e===`1`}function $t(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(Yt,`1`):window.sessionStorage.removeItem(Yt)}catch{}}function en(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(Xt)===`1`}catch{return!1}}function tn(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(Xt,`1`):window.sessionStorage.removeItem(Xt)}catch{}}function nn(e){let[t,n]=(0,k.useState)(()=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(e).matches);return(0,k.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}var rn=720;function an(e,t){return e===`/`?{via:`in-place`}:{via:`navigate`,href:`/?wa=${encodeURIComponent(t.remoteJid??``)}&acct=${encodeURIComponent(t.accountId??``)}`}}function on(e){return e===`/`?{via:`in-place`}:{via:`navigate`,href:`/?data=1`}}function sn(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 cn(e,t){return e===`/`?new URLSearchParams(t).has(`data`):!1}function ln(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 un=`maxy-webchat-browser-open`;function dn(){return typeof window<`u`&&window.location.pathname.startsWith(`/chat`)}function fn(e){let{cacheKey:t,businessName:n,variant:r=`admin`,onLogout:i,onDisconnect:o,disconnecting:s,claudeConnected:c,onConnectClaude:l,userName:u,userAvatar:d,role:f,onOpenConversations:p,children:m,footer:_}=e,{subAccounts:v,activeAccountId:y,switching:x,switchAccount:ee,refreshAccounts:te}=ae(t),[S,C]=(0,k.useState)([]),[w,ne]=(0,k.useState)(!1),[re,E]=(0,k.useState)(!1);(0,k.useEffect)(()=>{let e=dn();if(ne(e),e)try{E(window.localStorage.getItem(un)!==`0`)}catch{}},[]);let ie=(0,k.useCallback)(()=>{E(e=>{let t=!e;try{window.localStorage.setItem(un,t?`1`:`0`)}catch{}return t})},[]),oe=w&&re,se=(0,k.useCallback)(e=>{C(t=>t.filter(t=>t.waMessageId!==e))},[]);(0,k.useEffect)(()=>{if(!t)return;let e=null;try{e=new EventSource(a(`/api/admin/events`,t)),e.addEventListener(Ve,e=>{try{let t=JSON.parse(e.data);if(!t||typeof t.waMessageId!=`string`)return;C(e=>e.some(e=>e.waMessageId===t.waMessageId)?e:[...e,t]),Jt(t,g)}catch{}}),e.onerror=()=>{console.error(`[admin-ui] wa-notify stream error`)}}catch(e){console.error(`[admin-ui] wa-notify unavailable reason=${e instanceof Error?e.message:String(e)}`)}return()=>{e?.close()}},[t]),(0,k.useEffect)(()=>{qt(Z())},[]);let[ce,D]=(0,k.useState)(!0);(0,k.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||D(n.auth_status!==`dead`&&n.auth_status!==`missing`)}catch{}};t();let n=setInterval(t,6e4);return()=>{e=!0,clearInterval(n)}},[c,r]);let le=c??ce,ue=l??(()=>{window.location.assign(`/?connect=claude`)}),[A,j]=(0,k.useState)(()=>Qt()),[M,de]=(0,k.useState)(!1),fe=(0,k.useRef)(!0);(0,k.useEffect)(()=>{if(fe.current){fe.current=!1;return}de(!0);let e=setTimeout(()=>de(!1),260);return()=>clearTimeout(e)},[A]);let[N,pe]=(0,k.useState)(()=>en()),me=nn(`(max-width: ${rn}px)`),[he,ge]=(0,k.useState)(()=>typeof window>`u`||cn(window.location.pathname,window.location.search)?null:sn(window.location.pathname,window.location.search)),[_e,ve]=(0,k.useState)(()=>typeof window>`u`?!1:cn(window.location.pathname,window.location.search)),[ye]=(0,k.useState)(()=>_e),P=(0,k.useCallback)(e=>{$t(e),j(e)},[]),F=(0,k.useCallback)(e=>{tn(e),pe(e)},[]);(0,k.useEffect)(()=>{typeof window>`u`||window.location?.pathname},[]),(0,k.useEffect)(()=>{typeof window>`u`||!he||window.history.replaceState(null,``,`/`)},[]),(0,k.useEffect)(()=>{typeof window>`u`||!_e||window.history.replaceState(null,``,`/`)},[]);let be=(0,k.useCallback)(e=>{if(ve(!1),e===null){ge(null);return}let t=an(typeof window<`u`?window.location.pathname:`/`,e);t.via===`in-place`?ge(e):window.location.href=t.href},[]),xe=(0,k.useCallback)(()=>{let e=on(typeof window<`u`?window.location.pathname:`/`);if(e.via===`navigate`){window.location.href=e.href;return}ge(null),ve(!0)},[]),Se=me?N:!A,Ce=(0,k.useCallback)(()=>{typeof window>`u`||(window.matchMedia(`(max-width: ${rn}px)`).matches?F(!N):P(!A))},[A,N,P,F]),we=(0,k.useCallback)(e=>{let t=ln(e,r);window.location.href=t},[r]),I={collapsed:A,mobileDrawerOpen:N,sidebarOpen:Se,onToggleSidebar:Ce,setMobileDrawerOpen:F,selectedWhatsapp:he,onClearWhatsapp:()=>ge(null),onSelectWhatsappConversation:be,dataOpen:_e};return r===`operator`?(0,O.jsxs)(`div`,{className:`admin-shell admin-page admin-shell-root`,children:[x&&(0,O.jsx)(b,{surface:`switch`}),(0,O.jsx)(T,{businessName:n,variant:r,onNavigate:we,onOpenConversations:p,onToggleSidebar:Ce,sidebarOpen:Se,onLogout:i,onDisconnect:o,disconnecting:s,cacheKey:t,subAccounts:v,activeAccountId:y,switchingAccount:x,onSwitchAccount:ee,refreshAccounts:te}),(0,O.jsx)(`div`,{className:`platform platform-operator`,children:typeof m==`function`?m(I):m}),(0,O.jsx)(Je,{variant:`operator`,onOpenConversations:p}),_,(0,O.jsx)(V,{frames:S,onExpire:se})]}):(0,O.jsxs)(`div`,{className:`admin-shell admin-page admin-shell-root`,children:[x&&(0,O.jsx)(b,{surface:`switch`}),(0,O.jsxs)(`div`,{className:`platform${N?` menu-open`:``}${!me&&A?` sidebar-collapsed`:``}${M?` sidebar-animating`:``}`,"data-artefact":oe?`browser`:`closed`,children:[(0,O.jsx)(Lt,{businessName:n,cacheKey:t,onConnectClaude:ue,role:f??null,userName:u,userAvatar:d??null,onSelectProjects:()=>{window.location.href=`/graph?label=${h().label}`},onSelectTasks:()=>{window.location.href=`/tasks`},onCloseMobileDrawer:()=>F(!1),collapsed:A,mobileDrawerOpen:N,onSelectData:xe,onCloseData:()=>ve(!1),initialDataSurface:ye,onLogout:i,onDisconnect:o,disconnecting:s,claudeConnected:le,subAccounts:v,activeAccountId:y,switchingAccount:x,onSwitchAccount:ee,refreshAccounts:te,onOpenConversations:p}),!me&&(0,O.jsx)(Ze,{}),(0,O.jsx)(We,{sidebarOpen:Se,onToggleSidebar:Ce,claudeConnected:le,onConnectClaude:ue,browserOpen:w?re:void 0,onToggleBrowser:w?ie:void 0}),typeof m==`function`?m(I):m,oe&&(0,O.jsx)(`div`,{className:`webchat-browser-pane`,children:(0,O.jsx)(L,{cacheKey:e.cacheKey,surface:`webchat`})})]}),N&&(0,O.jsx)(`div`,{className:`sidebar-backdrop menu-open`,"aria-hidden":`true`,onClick:()=>F(!1)}),(0,O.jsx)(Je,{}),_,(0,O.jsx)(V,{frames:S,onExpire:se})]})}export{me as C,M as D,de as E,ue as O,he as S,fe as T,F as _,wt as a,_e as b,q as c,ot as d,it as f,be as g,Se as h,Tt as i,le as k,G as l,L as m,nn as n,vt as o,nt as p,Ft as r,xt as s,fn as t,K as u,ye as v,pe as w,ge as x,ve as y};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CltuBf4Z.js";import{E as t,J as n,N as r,T as i,W as a,X as o,_ as s,b as c,k as l,q as u,v as d,x as f,z as p}from"./useSubAccountSwitcher-UMg53kKF.js";import{k as m,t as h,x as g}from"./AdminShell-7l3ubYFZ.js";import{t as _}from"./chevron-left-DHzJobWp.js";import{t as v}from"./chevron-right-yg4DMfLT.js";import{t as y}from"./clock-BIDzihvp.js";var b=p(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),x=p(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),S=p(`sticky-note`,[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]),C=p(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),w=p(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),T=n(),E=e(o(),1);function D(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function O(e,t){let n=new Date(e);return n.setDate(n.getDate()+t),n}function k(e){let t=D(e),n=t.getDay();return O(t,n===0?-6:1-n)}function A(e,t){switch(e){case`day`:{let e=D(t);return{from:e,to:O(e,1)}}case`week`:{let e=k(t);return{from:e,to:O(e,7)}}case`month`:return{from:new Date(t.getFullYear(),t.getMonth(),1),to:new Date(t.getFullYear(),t.getMonth()+1,1)};case`year`:return{from:new Date(t.getFullYear(),0,1),to:new Date(t.getFullYear()+1,0,1)}}}function j(e,t,n){switch(e){case`day`:return O(t,n);case`week`:return O(t,n*7);case`month`:return new Date(t.getFullYear(),t.getMonth()+n,1);case`year`:return new Date(t.getFullYear()+n,t.getMonth(),1)}}function M(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}var ee=[`day`,`week`,`month`,`year`],N=`month`;function P(e){return e.toLocaleDateString([],{day:`numeric`,month:`short`})}function F(e){return e.toLocaleDateString([],{day:`numeric`,month:`short`,year:`numeric`})}function te(e,t){switch(e){case`day`:return t.toLocaleDateString([],{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`});case`week`:{let{from:e,to:n}=A(`week`,t);return`${P(e)} – ${F(new Date(n.getTime()-1))}`}case`month`:return t.toLocaleDateString([],{month:`long`,year:`numeric`});case`year`:return String(t.getFullYear())}}function I(e,t){return{role:`button`,tabIndex:0,onClick:()=>t(e),onKeyDown:n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),t(e))}}}var L=a(),R={meeting:`Meeting`,event:`Event`,task:`Task`};function z(e){return R[e.kind??`meeting`]}function B(e){return e.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}function V(e){if(e.isAllDay)return`All day`;let t=B(new Date(e.startsAt));return e.endsAt?`${t} – ${B(new Date(e.endsAt))}`:t}function H(e){if(!e)return``;let t=new Date(e);if(Number.isNaN(t.getTime()))return``;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function ne(e){let t=new Date(e.startsAt);if(e.isAllDay)return t.toLocaleDateString([],{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`});let n=t.toLocaleDateString([],{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`}),r=B(t);return e.endsAt?`${n} · ${r} – ${B(new Date(e.endsAt))}`:`${n} · ${r}`}function re(e,t){return e.email??`${e.name??`unknown`}-${t}`}function U(e){return e.map(e=>e.name||e.email||`Unknown`).join(`, `)}function W({a:e}){let t=e.name||e.email||`Unknown`,n=e.name&&e.email?e.email:null;return(0,L.jsxs)(`span`,{className:`cal-attendee-lines`,children:[(0,L.jsx)(`span`,{className:`cal-attendee-name`,children:t}),n&&(0,L.jsx)(`span`,{className:`cal-attendee-email`,children:n})]})}function G(e){let t=[...e].sort((e,t)=>e.start.localeCompare(t.start)),n=[];for(let e of t){let t=n[n.length-1];t&&t.end===e.start?(t.end=e.end,t.slots+=1):n.push({start:e.start,end:e.end,slots:1})}return n}function K(e){let t=e.slots===1?`slot`:`slots`;return`free ${B(new Date(e.start))} – ${B(new Date(e.end))} · ${e.slots} ${t}`}function q(e,t,n,r=[]){let i=D(t),a=[];for(let t=0;t<n;t++){let n=O(i,t),o=e.filter(e=>M(new Date(e.startsAt),n)).sort((e,t)=>e.startsAt.localeCompare(t.startsAt)),s=r.some(e=>M(new Date(e.start),n));(o.length>0||s)&&a.push({day:n,meetings:o})}return a}function J(e,t){return Math.round((D(t).getTime()-D(e).getTime())/864e5)}function Y(e,t){let n=e.toLocaleDateString([],{weekday:`long`,day:`numeric`,month:`long`});return M(e,t)?`${n} · today`:n}function ie({from:e,to:t,meetings:n,stretches:r,gapSource:i,showAllKinds:a,onToggleKinds:o,onSelect:s,onAddAt:c}){let l=a?n:n.filter(e=>(e.kind??`meeting`)===`meeting`),u=n.length-l.length,d=q(l,e,J(e,t),r),f=new Date,p=(0,L.jsxs)(`div`,{className:`cal-list-controls`,children:[(0,L.jsx)(`button`,{type:`button`,className:`cal-kind-toggle${a?` cal-kind-toggle-on`:``}`,onClick:o,"aria-pressed":a,children:a?`Meetings only`:`Show reminders and tasks`}),u>0&&(0,L.jsxs)(`span`,{className:`cal-hidden-count`,children:[u,` hidden`]}),i===`none`&&(0,L.jsx)(`span`,{className:`cal-no-hours`,children:`Free time is not shown: working hours are not set.`})]});return d.length===0?(0,L.jsxs)(`div`,{className:`cal-schedule`,children:[p,(0,L.jsx)(`div`,{className:`cal-schedule-empty`,children:`No events in this period.`})]}):(0,L.jsxs)(`div`,{className:`cal-schedule`,children:[p,d.map(e=>{let t=r.filter(t=>M(new Date(t.start),e.day));return(0,L.jsxs)(`section`,{className:`cal-sched-group`,children:[(0,L.jsx)(`h3`,{className:`cal-sched-day${M(e.day,f)?` cal-sched-day-today`:``}`,children:Y(e.day,f)}),e.meetings.map(e=>{let t=[e.location,U(e.attendees)||null,z(e)].filter(Boolean);return(0,L.jsxs)(`div`,{className:`cal-sched-row`,"data-testid":`row-${e.meetingId}`,"data-meeting-id":e.meetingId,"data-kind":e.kind??`meeting`,...I(e,s),children:[(0,L.jsx)(`span`,{className:`cal-sched-time`,children:V(e)}),(0,L.jsxs)(`span`,{className:`cal-sched-detail`,children:[(0,L.jsx)(`span`,{className:`cal-sched-title`,children:e.title??`Untitled`}),(0,L.jsx)(`span`,{className:`cal-sched-meta`,children:t.join(` · `)})]})]},e.meetingId)}),t.map(e=>(0,L.jsx)(`button`,{type:`button`,className:`cal-gap`,"data-gap-start":e.start,onClick:()=>c(e.start,e.end),children:K(e)},e.start))]},e.day.toISOString())})]})}function X({initialStart:e,initialEnd:t,adminFetch:n,onClose:r,onCreated:i}){let[a,o]=(0,E.useState)(``),[s,u]=(0,E.useState)(e),[d,f]=(0,E.useState)(t),[p,m]=(0,E.useState)(``),[h,g]=(0,E.useState)(``),[_,v]=(0,E.useState)(!1),[y,b]=(0,E.useState)(null),x=(0,E.useCallback)(async()=>{if(!a.trim()){b(`Title is required`);return}if(!s){b(`Start time is required`);return}v(!0),b(null);try{let e=await n(`/api/admin/calendar/meetings`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({title:a.trim(),startsAt:new Date(s).toISOString(),endsAt:d?new Date(d).toISOString():null,location:p.trim()||null,privateNote:h.trim()||null})}),t=await e.json();if(!e.ok){b(t.error??`Create failed (HTTP ${e.status})`);return}t.meeting&&i(t.meeting)}catch(e){b(e instanceof Error?e.message:`Create failed`)}finally{v(!1)}},[a,s,d,p,h,n,i]);return(0,L.jsx)(`div`,{className:`cal-modal-overlay`,onClick:()=>{_||r()},children:(0,L.jsxs)(`div`,{className:`cal-modal cal-modal-wide`,role:`dialog`,"aria-modal":`true`,"aria-label":`Add meeting`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`div`,{className:`cal-modal-header`,children:[(0,L.jsx)(`span`,{className:`cal-modal-kind`,children:`New meeting`}),(0,L.jsx)(`button`,{type:`button`,className:`cal-modal-close`,onClick:r,"aria-label":`Close`,disabled:_,children:(0,L.jsx)(c,{size:16})})]}),(0,L.jsxs)(`div`,{className:`cal-modal-body`,children:[(0,L.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,L.jsx)(`span`,{children:`Title`}),(0,L.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),disabled:_,autoFocus:!0})]}),(0,L.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,L.jsx)(`span`,{children:`Starts`}),(0,L.jsx)(`input`,{type:`datetime-local`,value:s,onChange:e=>u(e.target.value),disabled:_})]}),(0,L.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,L.jsx)(`span`,{children:`Ends`}),(0,L.jsx)(`input`,{type:`datetime-local`,value:d,onChange:e=>f(e.target.value),disabled:_})]}),(0,L.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,L.jsx)(`span`,{children:`Location`}),(0,L.jsx)(`input`,{type:`text`,value:p,onChange:e=>m(e.target.value),disabled:_})]}),(0,L.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,L.jsx)(`span`,{children:`Private note`}),(0,L.jsx)(`textarea`,{value:h,onChange:e=>g(e.target.value),disabled:_,rows:2})]}),y&&(0,L.jsx)(`div`,{className:`cal-modal-error`,children:y})]}),(0,L.jsxs)(`div`,{className:`cal-modal-actions`,children:[(0,L.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:r,disabled:_,children:`Cancel`}),(0,L.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-primary`,onClick:x,disabled:_,children:[_?(0,L.jsx)(l,{size:14,className:`spin`}):null,` Create`]})]})]})})}function ae(e){return new Date(e).toISOString()}function Z(e){return Math.floor(new Date(e).getTime()/6e4)}function oe(e){if(!e)return null;let t=e.match(/filename="([^"]+)"/);return t?t[1]:null}function Q({meeting:e,adminFetch:n,onClose:i,onSaved:a,onDeleted:o}){let s=e.kind===`meeting`,[u,d]=(0,E.useState)(!1),[p,m]=(0,E.useState)(!1),[h,g]=(0,E.useState)(!1),[_,v]=(0,E.useState)(!1),[T,D]=(0,E.useState)(null),[O,k]=(0,E.useState)(e),[A,j]=(0,E.useState)(e.title??``),[M,ee]=(0,E.useState)(H(e.startsAt)),[N,P]=(0,E.useState)(e.endsAt?H(e.endsAt):``),[F,te]=(0,E.useState)(e.location??``),[I,z]=(0,E.useState)(e.privateNote??``),[B,V]=(0,E.useState)(``),[U,G]=(0,E.useState)(``);(0,E.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!_&&i()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[_,i]);let K=(0,E.useCallback)(()=>{let e={},t=A.trim();t!==(O.title??``)&&(e.title=t);let n=ae(M);Z(n)!==Z(O.startsAt)&&(e.startsAt=n);let r=N?ae(N):null;(r===null?O.endsAt!==null:O.endsAt===null||Z(r)!==Z(O.endsAt))&&(e.endsAt=r);let i=F.trim()||null;i!==(O.location??null)&&(e.location=i);let a=I.trim()||null;return a!==(O.privateNote??null)&&(e.privateNote=a),e},[A,M,N,F,I,O]),q=(0,E.useCallback)(async()=>{let t=K();if(Object.keys(t).length===0){d(!1);return}v(!0),D(null);try{let r=await n(`/api/admin/calendar/meetings/${encodeURIComponent(e.meetingId)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});if(!r.ok)throw Error(`HTTP ${r.status}`);let i=await r.json();k(i.meeting),a(i.meeting),d(!1)}catch(e){D(e instanceof Error?e.message:`Save failed`)}finally{v(!1)}},[n,K,e.meetingId,a]),J=(0,E.useCallback)(async()=>{let t=B.trim(),r=U.trim();if(!(!t&&!r)){v(!0),D(null);try{let i=await n(`/api/admin/calendar/meetings/${encodeURIComponent(e.meetingId)}/attendees`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({name:t||void 0,email:r||void 0})});if(!i.ok)throw Error(`HTTP ${i.status}`);let o=await i.json();k(o.meeting),a(o.meeting),V(``),G(``)}catch(e){D(e instanceof Error?e.message:`Add failed`)}finally{v(!1)}}},[n,B,U,e.meetingId,a]),Y=(0,E.useCallback)(async t=>{let r=t.email?{email:t.email}:{name:t.name};v(!0),D(null);try{let t=await n(`/api/admin/calendar/meetings/${encodeURIComponent(e.meetingId)}/attendees`,{method:`DELETE`,headers:{"content-type":`application/json`},body:JSON.stringify(r)});if(!t.ok)throw Error(`HTTP ${t.status}`);let i=await t.json();k(i.meeting),a(i.meeting)}catch(e){D(e instanceof Error?e.message:`Remove failed`)}finally{v(!1)}},[n,e.meetingId,a]),ie=(0,E.useCallback)(async()=>{v(!0),D(null);try{let t=await n(`/api/admin/calendar/meetings/${encodeURIComponent(e.meetingId)}`,{method:`DELETE`});if(!t.ok)throw Error(`HTTP ${t.status}`);o(e.meetingId)}catch(e){D(e instanceof Error?e.message:`Delete failed`),v(!1)}},[n,e.meetingId,o]),X=(0,E.useCallback)(async t=>{g(!1),v(!0),D(null);try{let r=await n(`/api/admin/calendar/meetings/${encodeURIComponent(e.meetingId)}/ics?attendees=${t?`1`:`0`}`);if(!r.ok)throw Error(`HTTP ${r.status}`);let i=await r.blob(),a=oe(r.headers.get(`content-disposition`))??`meeting.ics`,o=URL.createObjectURL(i),s=document.createElement(`a`);s.href=o,s.download=a,document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(o)}catch(e){D(e instanceof Error?e.message:`Download failed`)}finally{v(!1)}},[n,e.meetingId]),Q=R[e.kind??`meeting`],se=B.trim().length>0||U.trim().length>0;return(0,L.jsx)(`div`,{className:`cal-modal-overlay`,onClick:()=>{_||i()},children:(0,L.jsxs)(`div`,{className:`cal-modal cal-modal-wide`,role:`dialog`,"aria-modal":`true`,"aria-label":u?`Edit meeting`:`Meeting detail`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`div`,{className:`cal-modal-header`,children:[(0,L.jsx)(`span`,{className:`cal-modal-kind`,children:Q}),(0,L.jsx)(`button`,{type:`button`,className:`cal-modal-close`,onClick:i,"aria-label":`Close`,autoFocus:!0,disabled:_,children:(0,L.jsx)(c,{size:16})})]}),!u&&(0,L.jsxs)(`div`,{className:`cal-modal-body`,children:[(0,L.jsx)(`div`,{className:`cal-modal-title`,children:O.title??`Untitled`}),(0,L.jsxs)(`div`,{className:`cal-modal-row`,children:[(0,L.jsx)(y,{size:14}),(0,L.jsx)(`span`,{children:ne(O)})]}),O.location&&(0,L.jsxs)(`div`,{className:`cal-modal-row`,children:[(0,L.jsx)(x,{size:14}),(0,L.jsx)(`span`,{children:O.location})]}),O.attendees.length>0&&(0,L.jsxs)(`div`,{className:`cal-modal-row cal-modal-row-top`,children:[(0,L.jsx)(w,{size:14}),(0,L.jsx)(`div`,{className:`cal-modal-attendees`,children:O.attendees.map((e,t)=>(0,L.jsx)(`div`,{className:`cal-attendee-row`,children:(0,L.jsx)(W,{a:e})},re(e,t)))})]}),O.privateNote&&(0,L.jsxs)(`div`,{className:`cal-modal-row cal-modal-row-top`,children:[(0,L.jsx)(S,{size:14}),(0,L.jsx)(`span`,{className:`cal-modal-note`,children:O.privateNote})]}),(0,L.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,L.jsx)(b,{size:14}),(0,L.jsx)(`span`,{children:Q})]})]}),u&&(0,L.jsxs)(`div`,{className:`cal-modal-body`,children:[(0,L.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,L.jsx)(`span`,{children:`Title`}),(0,L.jsx)(`input`,{type:`text`,value:A,onChange:e=>j(e.target.value),disabled:_})]}),(0,L.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,L.jsx)(`span`,{children:`Start`}),(0,L.jsx)(`input`,{type:`datetime-local`,value:M,onChange:e=>ee(e.target.value),disabled:_})]}),(0,L.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,L.jsx)(`span`,{children:`End`}),(0,L.jsx)(`input`,{type:`datetime-local`,value:N,onChange:e=>P(e.target.value),disabled:_})]}),(0,L.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,L.jsx)(`span`,{children:`Location`}),(0,L.jsx)(`input`,{type:`text`,value:F,onChange:e=>te(e.target.value),disabled:_})]}),(0,L.jsxs)(`div`,{className:`cal-modal-field`,children:[(0,L.jsx)(`span`,{children:`Attendees`}),(0,L.jsxs)(`div`,{className:`cal-modal-attendees cal-modal-attendees-edit`,children:[O.attendees.length===0&&(0,L.jsx)(`div`,{className:`cal-attendee-empty`,children:`No attendees yet.`}),O.attendees.map((e,t)=>(0,L.jsxs)(`div`,{className:`cal-attendee-row cal-attendee-row-edit`,children:[(0,L.jsx)(W,{a:e}),(0,L.jsx)(`button`,{type:`button`,className:`cal-attendee-remove`,onClick:()=>Y(e),disabled:_,"aria-label":`Remove ${e.name||e.email||`attendee`}`,children:(0,L.jsx)(c,{size:13})})]},re(e,t)))]}),(0,L.jsxs)(`div`,{className:`cal-attendee-add`,children:[(0,L.jsx)(`input`,{type:`text`,placeholder:`Name`,value:B,onChange:e=>V(e.target.value),disabled:_,"aria-label":`Attendee name`}),(0,L.jsx)(`input`,{type:`email`,placeholder:`Email`,value:U,onChange:e=>G(e.target.value),disabled:_,"aria-label":`Attendee email`}),(0,L.jsx)(`button`,{type:`button`,className:`cal-modal-btn cal-attendee-add-btn`,onClick:J,disabled:_||!se,"aria-label":`Add attendee`,children:_?(0,L.jsx)(l,{size:13,className:`spin`}):(0,L.jsx)(C,{size:13})})]})]}),(0,L.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,L.jsx)(`span`,{children:`Private note`}),(0,L.jsx)(`textarea`,{className:`cal-modal-textarea`,value:I,onChange:e=>z(e.target.value),disabled:_,rows:3,placeholder:`Only you and your team can see this.`})]})]}),T&&(0,L.jsx)(`div`,{className:`cal-modal-error`,children:T}),s&&(0,L.jsxs)(`div`,{className:`cal-modal-actions`,children:[!u&&!p&&!h&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>d(!0),disabled:_,children:[(0,L.jsx)(t,{size:14}),` Edit`]}),(0,L.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:()=>m(!0),disabled:_,children:[(0,L.jsx)(f,{size:14}),` Delete`]}),(0,L.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-download`,onClick:()=>{O.attendees.length>0?g(!0):X(!1)},disabled:_,children:[_?(0,L.jsx)(l,{size:14,className:`spin`}):(0,L.jsx)(r,{size:14}),` Download`]})]}),h&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`cal-modal-confirm-text`,children:`Include attendees in the file?`}),(0,L.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-primary`,onClick:()=>X(!0),disabled:_,children:[_?(0,L.jsx)(l,{size:14,className:`spin`}):null,` Yes`]}),(0,L.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>X(!1),disabled:_,children:`No`}),(0,L.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>g(!1),disabled:_,children:`Cancel`})]}),u&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-primary`,onClick:q,disabled:_,children:[_?(0,L.jsx)(l,{size:14,className:`spin`}):null,` Save`]}),(0,L.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>{d(!1),D(null)},disabled:_,children:`Cancel`})]}),p&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`cal-modal-confirm-text`,children:`Delete this meeting?`}),(0,L.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:ie,disabled:_,children:[_?(0,L.jsx)(l,{size:14,className:`spin`}):null,` Delete`]}),(0,L.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>m(!1),disabled:_,children:`Cancel`})]})]})]})})}var se=8;function ce(e,t){return t?{op:`view-census`,range:e,nodes:t.nodes.length,clippedV:t.nodes.filter(e=>e.clippedV).length,clippedH:t.nodes.filter(e=>e.clippedH).length,hidden:t.hidden,fields:t.fields.length>0?t.fields.join(`,`):`-`,minBlockPx:t.minBlockPx??`-`,lineBoxPx:t.lineBoxPx??`-`,gapSource:t.gapSource??`-`,gaps:t.gaps??`-`,shownKinds:t.shownKinds??`-`,hiddenKinds:t.hiddenKinds??`-`,source:`measured`}:{op:`view-census`,range:e,nodes:`-`,clippedV:`-`,clippedH:`-`,hidden:`-`,fields:`-`,minBlockPx:`-`,lineBoxPx:`-`,gapSource:`-`,gaps:`-`,shownKinds:`-`,hiddenKinds:`-`,source:`unavailable`}}var le=5;function ue(e,t){if(!t)return[];let n=[];for(let r of t.nodes)for(let t of[`v`,`h`])(t===`v`?r.clippedV:r.clippedH)&&n.push({op:`node-clipped`,view:e,meetingId:r.meetingId,axis:t,renderedPx:r.renderedPx,neededPx:r.neededPx,durationMin:r.durationMin??`-`});if(n.length<=le)return n;let r=n.slice(0,le);return r[r.length-1]={...r[r.length-1],truncated:n.length-le},r}function de(e){let t=(e.textContent??``).length;if(t===0||e.scrollWidth===0||e.clientWidth>=e.scrollWidth-1)return!0;let n=e.scrollWidth/t;return e.clientWidth/n>=se}function fe(e){if(!e||typeof window>`u`||typeof window.getComputedStyle!=`function`)return null;let t=Array.from(e.querySelectorAll(`[data-meeting-id]`)),n=t.map(e=>e.getBoundingClientRect());if(t.length>0&&n.every(e=>e.height===0&&e.width===0))return null;let r=t.length>0?parseFloat(window.getComputedStyle(t[0]).lineHeight):null,i=t.map((e,t)=>{let r=e.querySelector(`.cal-sched-title`),i=e.querySelector(`.cal-event-title`)??r??e,a=i.scrollWidth>i.clientWidth+1,o=e.getAttribute(`data-duration-min`);return{meetingId:e.getAttribute(`data-meeting-id`)??`unknown`,clippedV:e.scrollHeight>e.clientHeight+1,clippedH:r?a:a&&!de(i),durationMin:o?Number(o):null,renderedPx:Math.round(n[t].height*10)/10,neededPx:Math.round(e.scrollHeight*10)/10}}),a=[];e.querySelector(`.cal-event-title, .cal-chip, .cal-sched-title`)&&a.push(`title`),e.querySelector(`.cal-event-time, .cal-sched-time`)&&a.push(`time`),e.querySelector(`.cal-sched-meta`)&&a.push(`meta`);let o=0;for(let t of Array.from(e.querySelectorAll(`.cal-more`)))o+=Number(t.getAttribute(`data-hidden-count`)??0);return{nodes:i,hidden:o,fields:a,minBlockPx:i.length>0?Math.min(...i.map(e=>e.renderedPx)):null,lineBoxPx:Number.isFinite(r)?r:null}}function pe(e,t){for(let n of[ce(e,t),...ue(e,t)])try{fetch(`/api/_client-error`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({kind:`event`,source:`calendar-legibility`,...n}),keepalive:!0}).catch(()=>{})}catch{}}var $=`maxy-admin-session-key`,me=`maxy-calendar-show-all-kinds`;function he(){let[e,t]=(0,E.useState)(null),[n,r]=(0,E.useState)(!1),[i,a]=(0,E.useState)(void 0),[o,c]=(0,E.useState)(null),[l,u]=(0,E.useState)(void 0),[f,p]=(0,E.useState)(null),[g,_]=(0,E.useState)(null);(0,E.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem($)}catch{}if(!n){r(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(async i=>{if(!e){if(i.status===401){try{sessionStorage.removeItem($)}catch{}window.location.href=`/`;return}if(i.ok)try{let e=await i.json();typeof e.businessName==`string`&&a(e.businessName),e.sessionId!==void 0&&c(e.sessionId??null),_(e.role??null),u(e.userName===void 0?null:e.userName),p(e.avatar??null)}catch{}t(n),r(!0)}}).catch(()=>{e||(t(n),r(!0))}),()=>{e=!0}},[]);let v=(0,E.useCallback)(()=>{try{sessionStorage.removeItem($)}catch{}window.location.href=`/`},[]),[y,b]=(0,E.useState)(!1),x=(0,E.useCallback)(async()=>{b(!0);try{let e=await m();if(e){try{sessionStorage.removeItem($)}catch{}window.location.href=`/`}return e}finally{b(!1)}},[]);return n?e?(0,L.jsx)(d,{cacheKey:e,surface:`calendar`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=calendar`);try{sessionStorage.removeItem($)}catch{}window.location.href=`/`},children:(0,L.jsx)(h,{cacheKey:e,businessName:i,sessionId:o,onLogout:v,onDisconnect:x,disconnecting:y,userName:l,userAvatar:f,role:g,children:(0,L.jsx)(ge,{cacheKey:e})})}):(0,L.jsx)(`div`,{className:`cal-page`,children:(0,L.jsxs)(`div`,{className:`cal-empty`,children:[(0,L.jsx)(`p`,{children:`You are not signed in.`}),(0,L.jsxs)(`p`,{children:[`Open the `,(0,L.jsx)(`a`,{href:`/`,className:`cal-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,L.jsx)(s,{surface:`gate`})}function ge({cacheKey:e}){let{adminFetch:t,sessionRefetchNonce:n}=u({initialCacheKey:e,surface:`calendar`}),[r,a]=(0,E.useState)(N),[o,c]=(0,E.useState)(()=>new Date),[d,f]=(0,E.useState)([]),[p,m]=(0,E.useState)(!1),[h,y]=(0,E.useState)(!1),[b,x]=(0,E.useState)(null),[S,C]=(0,E.useState)(null),[w,T]=(0,E.useState)([]),[D,O]=(0,E.useState)(`none`),[k,M]=(0,E.useState)(()=>{try{return sessionStorage.getItem(me)===`1`}catch{return!1}}),[P,F]=(0,E.useState)(null),[I,R]=(0,E.useState)(0),[z,B]=(0,E.useState)(null);(0,E.useEffect)(()=>{let e=!1;return t(`/api/admin/calendar/booking-link`).then(async t=>{if(e||!t.ok)return;let n=await t.json();typeof n.bookingDomain==`string`&&n.bookingDomain&&B(n.bookingDomain)}).catch(()=>{}),()=>{e=!0}},[t]),(0,E.useEffect)(()=>{let e=!1,{from:n,to:i}=A(r,o);return m(!0),x(null),t(`/api/admin/calendar/meetings?from=${encodeURIComponent(n.toISOString())}&to=${encodeURIComponent(i.toISOString())}`).then(async t=>{if(e)return;if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();f(Array.isArray(n.meetings)?n.meetings:[])}).catch(t=>{e||(x(t instanceof Error?t.message:`Failed to load`),f([]))}).finally(()=>{e||(m(!1),y(!0))}),()=>{e=!0}},[r,o,n,t]),(0,E.useEffect)(()=>{let e=!1,{from:n,to:i}=A(r,o);return t(`/api/admin/calendar/free-busy?from=${encodeURIComponent(n.toISOString())}&to=${encodeURIComponent(i.toISOString())}`).then(async t=>{if(e)return;if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();T(G(Array.isArray(n.slots)?n.slots:[])),O(n.gapSource===`config`?`config`:`none`)}).catch(()=>{e||(T([]),O(`none`))}),()=>{e=!0}},[r,o,n,t,I]);let V=(0,E.useCallback)(()=>c(new Date),[]),ne=(0,E.useCallback)(()=>c(e=>j(r,e,-1)),[r]),re=(0,E.useCallback)(()=>c(e=>j(r,e,1)),[r]),U=(0,E.useCallback)(()=>{M(e=>{let t=!e;try{sessionStorage.setItem(me,t?`1`:`0`)}catch{}return t})},[]),W=(0,E.useCallback)((e,t)=>F({startsAt:H(e),endsAt:H(t)}),[]),K=(0,E.useCallback)(e=>{f(t=>[...t,e]),R(e=>e+1),F(null)},[]);(0,E.useEffect)(()=>{C(null)},[r,o]);let q=(0,E.useRef)(null);(0,E.useEffect)(()=>{if(p)return;let e=requestAnimationFrame(()=>{let e=fe(q.current);pe(r,e&&{...e,gapSource:D,gaps:w.length,shownKinds:k?`meeting,event,task`:`meeting`,hiddenKinds:k?0:d.filter(e=>(e.kind??`meeting`)!==`meeting`).length})});return()=>cancelAnimationFrame(e)},[r,d,p,D,w,k]);let J=(0,E.useCallback)(e=>{f(t=>t.map(t=>t.meetingId===e.meetingId?e:t)),C(e)},[]),Y=(0,E.useCallback)(e=>{f(t=>t.filter(t=>t.meetingId!==e)),C(null)},[]);return h?(0,L.jsxs)(`div`,{className:`cal-page`,children:[(0,L.jsxs)(`header`,{className:`cal-header`,children:[(0,L.jsxs)(`div`,{className:`cal-nav`,children:[(0,L.jsx)(`span`,{className:`cal-range-label`,children:te(r,o)}),(0,L.jsx)(`button`,{type:`button`,className:`cal-nav-btn`,onClick:ne,"aria-label":`Previous`,children:(0,L.jsx)(_,{size:18})}),(0,L.jsx)(`button`,{type:`button`,className:`cal-nav-btn`,onClick:re,"aria-label":`Next`,children:(0,L.jsx)(v,{size:18})}),(0,L.jsx)(`button`,{type:`button`,className:`cal-today-btn`,onClick:V,children:`Today`}),p&&(0,L.jsx)(l,{size:16,className:`spin`})]}),(0,L.jsxs)(`button`,{type:`button`,className:`cal-add-btn`,onClick:()=>F({startsAt:``,endsAt:``}),children:[(0,L.jsx)(i,{size:14}),` Add`]}),(0,L.jsx)(`div`,{className:`cal-views`,children:ee.map(e=>(0,L.jsx)(`button`,{type:`button`,className:`cal-view-btn${e===r?` cal-view-btn-active`:``}`,onClick:()=>a(e),children:e.charAt(0).toUpperCase()+e.slice(1)},e))}),z&&(0,L.jsxs)(`a`,{className:`cal-booking-link`,href:`https://${z}`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,L.jsx)(g,{size:14}),` Booking page`]})]}),(0,L.jsxs)(`div`,{className:`cal-body`,ref:q,children:[b&&(0,L.jsxs)(`div`,{className:`cal-error`,children:[`Could not load the calendar: `,b]}),(0,L.jsx)(ie,{from:A(r,o).from,to:A(r,o).to,meetings:d,stretches:w,gapSource:D,showAllKinds:k,onToggleKinds:U,onSelect:C,onAddAt:W})]}),P&&(0,L.jsx)(X,{initialStart:P.startsAt,initialEnd:P.endsAt,adminFetch:t,onClose:()=>F(null),onCreated:K}),S&&(0,L.jsx)(Q,{meeting:S,adminFetch:t,onClose:()=>C(null),onSaved:J,onDeleted:Y})]}):(0,L.jsx)(s,{surface:`gate`})}(0,T.createRoot)(document.getElementById(`root`)).render((0,L.jsx)(he,{}));
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{J as e,W as t}from"./useSubAccountSwitcher-UMg53kKF.js";import"./useVoiceRecorder-tzfqfXni.js";import"./AdminShell-7l3ubYFZ.js";import{n}from"./page-BNRFmFc-.js";import"./useCopyFeedback-umIgCxI_.js";var r=e(),i=t();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{z as e}from"./useSubAccountSwitcher-UMg53kKF.js";var t=e(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]);export{t};
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{z as e}from"./useSubAccountSwitcher-UMg53kKF.js";var t=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t};
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{z as e}from"./useSubAccountSwitcher-UMg53kKF.js";var t=e(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]);export{t};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{J as e,W as t}from"./useSubAccountSwitcher-UMg53kKF.js";import"./useVoiceRecorder-tzfqfXni.js";import{t as n}from"./page-BRr295G2.js";import"./graph-labels-D695CsC9.js";var r=e(),i=t();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|