@hienlh/ppm 0.19.4 → 0.19.6
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/CHANGELOG.md +17 -0
- package/README.md +54 -1
- package/assets/skills/ppm/SKILL.md +1 -1
- package/assets/skills/ppm/references/cli-reference.md +4 -4
- package/assets/skills/ppm/references/http-api.md +6 -1
- package/dist/web/assets/accounts-settings-section-DGsB-ynw.js +1 -0
- package/dist/web/assets/{ai-resource-editor-BTWds-aC.js → ai-resource-editor-BeoI2Jp8.js} +1 -1
- package/dist/web/assets/{ai-settings-section-CmoBsSpY.js → ai-settings-section-Bc91w0K4.js} +1 -1
- package/dist/web/assets/{ai-settings-section-DjbYj4wK.js → ai-settings-section-edmjpNtG.js} +1 -1
- package/dist/web/assets/{appearance-settings-section-vLmakLtA.js → appearance-settings-section-CvX5XncT.js} +1 -1
- package/dist/web/assets/{chat-tab-CLRlS8Jc.js → chat-tab-BHO6ceZp.js} +3 -3
- package/dist/web/assets/{code-editor-CCwVu5F5.js → code-editor-1ZV6iSCc.js} +2 -2
- package/dist/web/assets/{conflict-editor-CvWYcbwD.js → conflict-editor-Dwogm7g8.js} +1 -1
- package/dist/web/assets/{csv-preview-DzuDuyE_.js → csv-preview-CcgWfErD.js} +1 -1
- package/dist/web/assets/{database-viewer-D4XGEDHm.js → database-viewer-DXlx5CrZ.js} +1 -1
- package/dist/web/assets/{diff-viewer-B5N1X61R.js → diff-viewer-tYKO0wXX.js} +1 -1
- package/dist/web/assets/{explorer-body-BxLLjthF.js → explorer-body-BPnA8ztG.js} +1 -1
- package/dist/web/assets/{explorer-window-content-CL1Cipj3.js → explorer-window-content-BMPhgAnl.js} +1 -1
- package/dist/web/assets/{extension-manager-section-BpyGq15A.js → extension-manager-section-Cepy9w0W.js} +1 -1
- package/dist/web/assets/{extension-webview-BM8FXhuN.js → extension-webview-83orjfAz.js} +1 -1
- package/dist/web/assets/{files-settings-section-B0_aR1nL.js → files-settings-section-A_5QWv4b.js} +1 -1
- package/dist/web/assets/{general-settings-section-C1EJzjhU.js → general-settings-section-CFDRUc2E.js} +1 -1
- package/dist/web/assets/{git-log-panel-D1yGTUE_.js → git-log-panel-D9iuuwL4.js} +1 -1
- package/dist/web/assets/{glide-data-grid-Cu0STKML.js → glide-data-grid-Ch5Ap1WP.js} +1 -1
- package/dist/web/assets/{group-chat-tab-BfcvkRX5.js → group-chat-tab-CfTivWze.js} +1 -1
- package/dist/web/assets/{index-B1bzKRjJ.js → index-LEL-8oU_.js} +4 -4
- package/dist/web/assets/{jira-watcher-section-DZh-Z2MK.js → jira-watcher-section-DznCP9IR.js} +1 -1
- package/dist/web/assets/{keybindings-store-CFwgcnpZ.js → keybindings-store-BUeQf1S6.js} +1 -1
- package/dist/web/assets/{keyboard-shortcuts-section-JBtcJGM3.js → keyboard-shortcuts-section-C-BeYTwO.js} +1 -1
- package/dist/web/assets/{markdown-renderer-Bo8GgGXl.js → markdown-renderer-B47WcMMs.js} +1 -1
- package/dist/web/assets/{markdown-renderer-DY60UZNW.js → markdown-renderer-Dcq0J7Yw.js} +1 -1
- package/dist/web/assets/{mobile-explorer-sheet-C59rPw7Z.js → mobile-explorer-sheet-RG64iGIe.js} +1 -1
- package/dist/web/assets/{notification-store-Bd6L0K_Q.js → notification-store-CmvMzpl2.js} +1 -1
- package/dist/web/assets/{notifications-settings-section-ARQlF-6E.js → notifications-settings-section--zzeoLfi.js} +1 -1
- package/dist/web/assets/{pdf-preview-CRShdbBS.js → pdf-preview-CGn99JWL.js} +1 -1
- package/dist/web/assets/{postgres-viewer-BNT-4yYl.js → postgres-viewer-D-mPRQRC.js} +1 -1
- package/dist/web/assets/{ppmbot-settings-section-Bq4YAcFW.js → ppmbot-settings-section-Dy1CBG9d.js} +1 -1
- package/dist/web/assets/{process-table-CjiXW0rg.js → process-table-DSLrAJC5.js} +1 -1
- package/dist/web/assets/proxy-settings-section-COr2LOQV.js +1 -0
- package/dist/web/assets/{query-audit-section-C5RmhRSu.js → query-audit-section-CShd9Vo1.js} +1 -1
- package/dist/web/assets/{remote-desktop-mobile-sheet-BF-75_03.js → remote-desktop-mobile-sheet-yFKdq8Cb.js} +2 -2
- package/dist/web/assets/{remote-desktop-mobile-view-C9KR9I9G.js → remote-desktop-mobile-view-Dj3n_7MA.js} +1 -1
- package/dist/web/assets/{remote-desktop-readiness-gate-BnKJicB2.js → remote-desktop-readiness-gate-CR2jZ4pW.js} +1 -1
- package/dist/web/assets/{remote-desktop-window-content-awXsNw_R.js → remote-desktop-window-content-BhQizWi0.js} +1 -1
- package/dist/web/assets/{schedules-settings-section-BOecKJzl.js → schedules-settings-section-f6VP9Mde.js} +1 -1
- package/dist/web/assets/{settings-body-DGi5DXY6.js → settings-body-BRJapYD0.js} +2 -2
- package/dist/web/assets/{settings-tab-GM9zTRul.js → settings-tab-hHtSuYDb.js} +1 -1
- package/dist/web/assets/{settings-window-content-Dvhxo4_H.js → settings-window-content-CUrGhhKI.js} +1 -1
- package/dist/web/assets/{sql-query-editor-BmkGFzcL.js → sql-query-editor-DxS_r9dM.js} +1 -1
- package/dist/web/assets/{sqlite-viewer-DbziVQXQ.js → sqlite-viewer-Gi8hYwKJ.js} +1 -1
- package/dist/web/assets/{system-monitor-body-CbHW5aYm.js → system-monitor-body-CdWv_LBB.js} +2 -2
- package/dist/web/assets/{system-monitor-tab-C7EZLMIo.js → system-monitor-tab-DBMjRETL.js} +1 -1
- package/dist/web/assets/{system-monitor-window-content-C_w4w81e.js → system-monitor-window-content-BUHL5rX-.js} +1 -1
- package/dist/web/assets/{tab-host-window-content-BSP1SEXS.js → tab-host-window-content-2gwUy-OA.js} +1 -1
- package/dist/web/assets/{team-member-sheet-C9N0iA1-.js → team-member-sheet-B-3ri_oc.js} +2 -2
- package/dist/web/assets/{team-member-window-content-CM2QFv-s.js → team-member-window-content-BvqhkPjH.js} +1 -1
- package/dist/web/assets/{terminal-tab-jWYELm8y.js → terminal-tab-CbHDqCBe.js} +1 -1
- package/dist/web/assets/{tool-cards-jefdOWVJ.js → tool-cards-DIoAqDka.js} +2 -2
- package/dist/web/assets/{use-accounts-data-MhMl0Y4Z.js → use-accounts-data-B8ltBkBj.js} +1 -1
- package/dist/web/assets/{use-monaco-theme-BbAd7DXr.js → use-monaco-theme-2YgX5HEz.js} +1 -1
- package/dist/web/assets/{use-remote-desktop-display-choice-DlfMIWq3.js → use-remote-desktop-display-choice--W-pnzPS.js} +1 -1
- package/dist/web/assets/{use-websocket-Bq8X_SUI.js → use-websocket-Dek_fwOD.js} +1 -1
- package/dist/web/assets/{video-preview-BGh3B0Lu.js → video-preview-DijwhDXk.js} +1 -1
- package/dist/web/index.html +1 -1
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
- package/src/providers/codex-app-server/codex-event-mapper.ts +42 -1
- package/src/providers/codex-app-server/codex-provider.ts +22 -4
- package/src/server/routes/proxy.ts +66 -4
- package/src/services/codex-account.service.ts +4 -2
- package/src/services/edge-forwarder.ts +191 -191
- package/src/services/proxy-agent-anthropic-bridge.ts +14 -3
- package/src/services/proxy-agent-bridge.ts +51 -4
- package/src/services/proxy-agent-turn.ts +12 -1
- package/src/services/proxy-image-bridge.ts +186 -0
- package/src/services/proxy-openai-bridge.ts +4 -38
- package/src/services/proxy-openai-format.ts +29 -3
- package/src/services/proxy.service.ts +54 -0
- package/src/services/windows-process-tree.ts +351 -351
- package/src/web/components/settings/accounts/account-bucket-row.tsx +4 -4
- package/src/web/components/settings/accounts/codex-accounts-section.tsx +2 -8
- package/src/web/components/settings/accounts/codex-usage-rows.tsx +26 -0
- package/src/web/components/settings/accounts/use-codex-accounts.ts +12 -1
- package/src/web/components/settings/proxy-settings-section.tsx +73 -27
- package/src/web/components/settings/proxy-test-section.tsx +45 -17
- package/src/web/lib/proxy-endpoints.ts +39 -0
- package/dist/web/assets/accounts-settings-section-CCFQV-RB.js +0 -1
- package/dist/web/assets/proxy-settings-section-wRbiyQiA.js +0 -3
- package/packages/vscode-compat/node_modules/.bin/tsc.bunx +0 -0
- package/packages/vscode-compat/node_modules/.bin/tsc.exe +0 -0
- package/packages/vscode-compat/node_modules/.bin/tsserver.bunx +0 -0
- package/packages/vscode-compat/node_modules/.bin/tsserver.exe +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{c as r,n as i,o as a,r as o,s,t as c}from"./use-remote-desktop-display-choice-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{c as r,n as i,o as a,r as o,s,t as c}from"./use-remote-desktop-display-choice--W-pnzPS.js";import"./api-client-oY1tC3tM.js";import"./vendor-mermaid-BKWscKt0.js";import{t as l}from"./settings-store-Brjd0QnO.js";import{n as u}from"./utils-C9OjCrou.js";import"./panel-store-BRrnDO_i.js";import{t as d}from"./window-store-DGKf9rPG.js";import"./ws-auth-Dawx17PM.js";import{Wn as f}from"./index-LEL-8oU_.js";import"./run-in-terminal-bKRwuO2z.js";import{n as p,t as m}from"./remote-desktop-readiness-gate-CR2jZ4pW.js";var h=e(t(),1);function g(e,t,n){let r=(0,h.useCallback)((n,r,i,a)=>{let s=e.current;if(!s)return;let{xFrac:c,yFrac:l}=o(n,r,s.getBoundingClientRect());t({type:`pointer`,xFrac:c,yFrac:l,button:i,down:a})},[e,t]);(0,h.useEffect)(()=>{let i=e.current;if(!i||!n)return;let a=e=>e===0?`left`:e===2?`right`:null,o=()=>t({type:`releaseAll`}),s=null,c=0,l=()=>{c=0,s&&=(r(s.x,s.y,null,null),null)},u=()=>{c&&=(cancelAnimationFrame(c),0),s&&=(r(s.x,s.y,null,null),null)},d=e=>{e.preventDefault(),i.setPointerCapture(e.pointerId),i.focus(),u(),r(e.clientX,e.clientY,a(e.button),!0)},f=e=>{s={x:e.clientX,y:e.clientY},c||=requestAnimationFrame(l)},p=e=>{u(),r(e.clientX,e.clientY,a(e.button),!1)},m=e=>e.preventDefault(),h=e=>{e.preventDefault(),t({type:`key`,code:e.code,down:!0})},g=e=>{e.preventDefault(),t({type:`key`,code:e.code,down:!1})},_=()=>{document.hidden&&o()};return i.tabIndex=0,i.addEventListener(`pointerdown`,d),i.addEventListener(`pointermove`,f),i.addEventListener(`pointerup`,p),i.addEventListener(`contextmenu`,m),i.addEventListener(`keydown`,h),i.addEventListener(`keyup`,g),i.addEventListener(`blur`,o),document.addEventListener(`visibilitychange`,_),()=>{c&&cancelAnimationFrame(c),i.removeEventListener(`pointerdown`,d),i.removeEventListener(`pointermove`,f),i.removeEventListener(`pointerup`,p),i.removeEventListener(`contextmenu`,m),i.removeEventListener(`keydown`,h),i.removeEventListener(`keyup`,g),i.removeEventListener(`blur`,o),document.removeEventListener(`visibilitychange`,_)}},[e,n,r,t])}var _=n();function v({id:e}){let t=d(e=>e.close),n=(0,h.useCallback)(()=>t(e),[t,e]);return(0,_.jsx)(p,{onCancel:n,children:(0,_.jsx)(m,{onCancel:n,children:(0,_.jsx)(y,{})})})}function y(){let e=(0,h.useRef)(null),t=c(),{connState:n,errorMessage:o,decoderStatus:d,decoderErrorMessage:p,sendMessage:m,reconnect:v,getFrameCount:y,getTotalBytes:b}=a(e,{displayId:t.displayId}),x=l(e=>e.remoteDesktopStatsVisible),S=l(e=>e.toggleRemoteDesktopStatsVisible);g(e,m,n===`streaming`);let C=d===`unsupported`?p:n===`error`?o:n===`closed`?`Disconnected`:n===`connecting`?`Connecting…`:null;return(0,_.jsxs)(`div`,{className:`relative flex h-full w-full items-center justify-center bg-black`,"data-testid":`remote-desktop-window`,"data-conn-state":n,children:[(0,_.jsx)(`canvas`,{ref:e,"data-testid":`remote-desktop-canvas`,className:`max-h-full max-w-full outline-none`}),(0,_.jsx)(i,{canvasRef:e,getFrameCount:y,getTotalBytes:b}),t.displays.length>1&&(0,_.jsx)(`select`,{value:t.current?.id??``,onChange:e=>t.select(e.target.value),"aria-label":`Display`,className:`absolute right-8 top-1 z-40 h-6 max-w-[45%] rounded bg-black/40 px-1.5 text-xs text-white/80 hover:bg-black/60`,"data-testid":`remote-desktop-display-select`,children:t.displays.map(e=>(0,_.jsxs)(`option`,{value:e.id,children:[e.label,e.primary?` (main)`:``,` · `,e.width,`×`,e.height]},e.id))}),(0,_.jsx)(`button`,{type:`button`,onClick:S,"aria-label":`Toggle stats overlay`,"aria-pressed":x,className:u(`absolute right-1 top-1 z-40 flex size-6 items-center justify-center rounded bg-black/40 text-white/70 hover:bg-black/60 hover:text-white`,x&&`bg-primary/70 text-primary-foreground hover:bg-primary/80`),children:(0,_.jsx)(r,{className:`size-3.5`})}),C&&(0,_.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 bg-black/70 text-sm text-white`,children:[(0,_.jsx)(s,{className:`size-6 opacity-70`}),(0,_.jsx)(`span`,{className:`max-w-sm text-center px-4`,children:C}),(n===`error`||n===`closed`)&&d!==`unsupported`&&(0,_.jsxs)(`button`,{onClick:v,className:`flex items-center gap-1.5 rounded-md bg-white/10 px-3 py-1.5 hover:bg-white/20`,children:[(0,_.jsx)(f,{className:`size-3.5`}),` Reconnect`]})]})]})}export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./calendar-clock-C1asT-gk.js";import{t as i}from"./chevron-down-Dp0rpHb8.js";import{t as a}from"./chevron-right-De-Wz5Lz.js";import{t as o}from"./power-CriQkeK5.js";import{n as s,s as c}from"./api-client-oY1tC3tM.js";import{n as l}from"./utils-C9OjCrou.js";import"./portal-container-context-a399Hd9F.js";import"./context-menu-C13b1uT3.js";import{n as u}from"./use-is-mobile-CYW3FJFE.js";import{t as d}from"./button-BZtEJcUv.js";import{t as f}from"./mobile-bottom-sheet-BD5b7KJF.js";import"./use-visual-viewport-rnvuooQZ.js";import{$t as p,B as m,Et as h,H as g,Jn as _,Jt as v,Nt as y,Pn as b,Qn as x,Qt as ee,Tt as S,U as C,V as w,W as T,Y as E,Yn as D,Yt as te,kt as O,q as k,wt as A,z as j}from"./index-B1bzKRjJ.js";var M=e(t(),1),N=1e4;function P(){let[e,t]=(0,M.useState)([]),[n,r]=(0,M.useState)(!0),i=(0,M.useCallback)(async()=>{try{t(await s.get(`/api/schedules`))}catch{}finally{r(!1)}},[]);return(0,M.useEffect)(()=>{i();let e=setInterval(()=>{document.visibilityState===`visible`&&i()},N);return()=>clearInterval(e)},[i]),{schedules:e,loading:n,refetch:i}}function F(e){let[t,n]=(0,M.useState)([]),[r,i]=(0,M.useState)(!1),a=(0,M.useCallback)(async()=>{if(e!=null){i(!0);try{n(await s.get(`/api/schedules/${e}/runs?limit=20`))}catch{n([])}finally{i(!1)}}},[e]);return(0,M.useEffect)(()=>{a()},[a]),{runs:t,loading:r,refetch:a}}var I=n(),ne={done:`bg-success/10 text-success`,error:`bg-error/10 text-error`,running:`bg-warning/10 text-warning`,skipped:`bg-muted text-muted-foreground`};function re({scheduleId:e}){let{runs:t,loading:n}=F(e);return n&&t.length===0?(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`Loading runs…`}):t.length===0?(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`No runs yet.`}):(0,I.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,I.jsx)(ie,{run:e},e.id))})}function L(e){return new Date(e.includes(`T`)?e:e.replace(` `,`T`)+`Z`)}function ie({run:e}){let[t,n]=(0,M.useState)(!1),r=!!(e.output_truncated||e.error),i=e.ended_at?`${Math.round((L(e.ended_at).getTime()-L(e.started_at).getTime())/1e3)}s`:`…`;return(0,I.jsxs)(`div`,{className:`rounded border border-border text-[11px]`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:()=>r&&n(!t),className:l(`w-full flex items-center gap-2 px-2 py-2 min-h-11 text-left`,r&&`cursor-pointer hover:bg-accent/30`),children:[(0,I.jsx)(`span`,{className:l(`rounded px-1.5 py-0.5 font-medium shrink-0`,ne[e.status]),children:e.status}),(0,I.jsxs)(`span`,{className:`text-muted-foreground truncate flex-1`,children:[L(e.started_at).toLocaleString(),` · `,i,e.cost_usd!=null&&` · $${e.cost_usd.toFixed(4)}`,e.context_window_pct!=null&&` · ctx ${e.context_window_pct}%`]})]}),t&&(0,I.jsxs)(`div`,{className:`px-2 pb-2 space-y-1`,children:[e.error&&(0,I.jsx)(`p`,{className:`text-error break-all`,children:e.error}),e.output_truncated&&(0,I.jsx)(`pre`,{className:`overflow-auto max-h-96 whitespace-pre-wrap break-all text-muted-foreground font-mono text-[10px]`,children:e.output_truncated})]})]})}function ae({schedule:e,onEdit:t,onChanged:n}){let[r,u]=(0,M.useState)(!1),[d,f]=(0,M.useState)(0);return(0,I.jsxs)(`div`,{className:`rounded-lg border border-border`,children:[(0,I.jsxs)(A,{children:[(0,I.jsx)(y,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,onClick:()=>u(!r),className:`w-full flex items-center gap-2 px-2.5 py-2.5 min-h-11 text-left cursor-pointer hover:bg-accent/30`,children:[r?(0,I.jsx)(i,{className:`size-3.5 shrink-0 text-muted-foreground`}):(0,I.jsx)(a,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,I.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,I.jsx)(`p`,{className:`text-xs font-medium truncate`,children:e.name}),(0,I.jsxs)(`p`,{className:`text-[11px] text-muted-foreground truncate`,children:[(0,I.jsx)(`span`,{className:`font-mono`,children:e.cron_expr}),` · `,e.next_fire_at&&e.enabled?`next ${new Date(e.next_fire_at).toLocaleString()}`:`—`]})]}),(0,I.jsx)(`span`,{className:l(`rounded px-1.5 py-0.5 text-[10px] font-medium shrink-0`,e.enabled?`bg-success/10 text-success`:`bg-muted text-muted-foreground`),children:e.enabled?`Enabled`:`Disabled`})]})}),(0,I.jsxs)(S,{children:[(0,I.jsxs)(h,{onClick:async()=>{try{let t=await s.post(`/api/schedules/${e.id}/run-now`);c.success(`Run #${t.runId} started${t.wasRunning?` (previous run still active)`:``}`),u(!0),f(e=>e+1)}catch(e){c.error(e instanceof Error?e.message:`Run failed`)}},children:[(0,I.jsx)(D,{className:`size-3.5`}),` Run now`]}),(0,I.jsxs)(h,{onClick:async()=>{try{await s.patch(`/api/schedules/${e.id}`,{enabled:!e.enabled}),n()}catch(e){c.error(e instanceof Error?e.message:`Update failed`)}},children:[(0,I.jsx)(o,{className:`size-3.5`}),` `,e.enabled?`Disable`:`Enable`]}),(0,I.jsxs)(h,{onClick:t,children:[(0,I.jsx)(x,{className:`size-3.5`}),` Edit`]}),(0,I.jsx)(O,{}),(0,I.jsxs)(h,{variant:`destructive`,onClick:async()=>{try{await s.del(`/api/schedules/${e.id}`),c.success(`Schedule deleted`),n()}catch(e){c.error(e instanceof Error?e.message:`Delete failed`)}},children:[(0,I.jsx)(b,{className:`size-3.5`}),` Delete`]})]})]}),r&&(0,I.jsxs)(`div`,{className:`px-2.5 pb-2.5 space-y-1.5`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground break-all line-clamp-3`,children:e.prompt}),(0,I.jsx)(re,{scheduleId:e.id},d)]})]})}function R(e,t,n,r,i,a,o,s){return R.fromTZ(R.tp(e,t,n,r,i,a,o),s)}R.fromTZISO=(e,t,n)=>R.fromTZ(B(e,t),n),R.fromTZ=function(e,t){let n=new Date(Date.UTC(e.y,e.m-1,e.d,e.h,e.i,e.s)),r=z(e.tz,n),i=new Date(n.getTime()-r),a=z(e.tz,i);if(a-r===0)return i;{let r=new Date(n.getTime()-a),o=z(e.tz,r);if(o-a===0||!t&&o-a>0)return r;if(t)throw Error(`Invalid date passed to fromTZ()`);return i}},R.toTZ=function(e,t){let n=e.toLocaleString(`en-US`,{timeZone:t}).replace(/[\u202f]/,` `),r=new Date(n);return{y:r.getFullYear(),m:r.getMonth()+1,d:r.getDate(),h:r.getHours(),i:r.getMinutes(),s:r.getSeconds(),tz:t}},R.tp=(e,t,n,r,i,a,o)=>({y:e,m:t,d:n,h:r,i,s:a,tz:o});function z(e,t=new Date){let n=t.toLocaleString(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).split(` `).slice(-1)[0],r=t.toLocaleString(`en-US`).replace(/[\u202f]/,` `);return Date.parse(`${r} GMT`)-Date.parse(`${r} ${n}`)}function B(e,t){let n=new Date(Date.parse(e));if(isNaN(n))throw Error(`minitz: Invalid ISO8601 passed to parser.`);let r=e.substring(9);return e.includes(`Z`)||r.includes(`-`)||r.includes(`+`)?R.tp(n.getUTCFullYear(),n.getUTCMonth()+1,n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),`Etc/UTC`):R.tp(n.getFullYear(),n.getMonth()+1,n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),t)}R.minitz=R;var V=32,H=31|V,U=[1,2,4,8,16],W=class{pattern;timezone;second;minute;hour;day;month;dayOfWeek;lastDayOfMonth;starDOM;starDOW;constructor(e,t){this.pattern=e,this.timezone=t,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.lastDayOfMonth=!1,this.starDOM=!1,this.starDOW=!1,this.parse()}parse(){if(!(typeof this.pattern==`string`||this.pattern instanceof String))throw TypeError(`CronPattern: Pattern has to be of type string.`);this.pattern.indexOf(`@`)>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let e=this.pattern.replace(/\s+/g,` `).split(` `);if(e.length<5||e.length>6)throw TypeError(`CronPattern: invalid configuration format ('`+this.pattern+`'), exactly five or six space separated parts are required.`);if(e.length===5&&e.unshift(`0`),e[3].indexOf(`L`)>=0&&(e[3]=e[3].replace(`L`,``),this.lastDayOfMonth=!0),e[3]==`*`&&(this.starDOM=!0),e[4].length>=3&&(e[4]=this.replaceAlphaMonths(e[4])),e[5].length>=3&&(e[5]=this.replaceAlphaDays(e[5])),e[5]==`*`&&(this.starDOW=!0),this.pattern.indexOf(`?`)>=0){let t=new q(new Date,this.timezone).getDate(!0);e[0]=e[0].replace(`?`,t.getSeconds().toString()),e[1]=e[1].replace(`?`,t.getMinutes().toString()),e[2]=e[2].replace(`?`,t.getHours().toString()),this.starDOM||(e[3]=e[3].replace(`?`,t.getDate().toString())),e[4]=e[4].replace(`?`,(t.getMonth()+1).toString()),this.starDOW||(e[5]=e[5].replace(`?`,t.getDay().toString()))}this.throwAtIllegalCharacters(e),this.partToArray(`second`,e[0],0,1),this.partToArray(`minute`,e[1],0,1),this.partToArray(`hour`,e[2],0,1),this.partToArray(`day`,e[3],-1,1),this.partToArray(`month`,e[4],-1,1),this.partToArray(`dayOfWeek`,e[5],0,H),this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(e,t,n,r){let i=this[e],a=e===`day`&&this.lastDayOfMonth;if(t===``&&!a)throw TypeError(`CronPattern: configuration entry `+e+` (`+t+`) is empty, check for trailing spaces.`);if(t===`*`)return i.fill(r);let o=t.split(`,`);if(o.length>1)for(let t=0;t<o.length;t++)this.partToArray(e,o[t],n,r);else t.indexOf(`-`)!==-1&&t.indexOf(`/`)!==-1?this.handleRangeWithStepping(t,e,n,r):t.indexOf(`-`)===-1?t.indexOf(`/`)===-1?t!==``&&this.handleNumber(t,e,n,r):this.handleStepping(t,e,n,r):this.handleRange(t,e,n,r)}throwAtIllegalCharacters(e){for(let t=0;t<e.length;t++)if((t===5?/[^/*0-9,\-#L]+/:/[^/*0-9,-]+/).test(e[t]))throw TypeError(`CronPattern: configuration entry `+t+` (`+e[t]+`) contains illegal characters.`)}handleNumber(e,t,n,r){let i=this.extractNth(e,t),a=parseInt(i[0],10)+n;if(isNaN(a))throw TypeError(`CronPattern: `+t+` is not a number: '`+e+`'`);this.setPart(t,a,i[1]||r)}setPart(e,t,n){if(!Object.prototype.hasOwnProperty.call(this,e))throw TypeError(`CronPattern: Invalid part specified: `+e);if(e===`dayOfWeek`){if(t===7&&(t=0),t<0||t>6)throw RangeError(`CronPattern: Invalid value for dayOfWeek: `+t);this.setNthWeekdayOfMonth(t,n);return}if(e===`second`||e===`minute`){if(t<0||t>=60)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`hour`){if(t<0||t>=24)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`day`){if(t<0||t>=31)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`month`&&(t<0||t>=12))throw RangeError(`CronPattern: Invalid value for `+e+`: `+t);this[e][t]=n}handleRangeWithStepping(e,t,n,r){let i=this.extractNth(e,t),a=i[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(a===null)throw TypeError(`CronPattern: Syntax error, illegal range with stepping: '`+e+`'`);let[,o,s,c]=a,l=parseInt(o,10)+n,u=parseInt(s,10)+n,d=parseInt(c,10);if(isNaN(l))throw TypeError(`CronPattern: Syntax error, illegal lower range (NaN)`);if(isNaN(u))throw TypeError(`CronPattern: Syntax error, illegal upper range (NaN)`);if(isNaN(d))throw TypeError(`CronPattern: Syntax error, illegal stepping: (NaN)`);if(d===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(d>this[t].length)throw TypeError(`CronPattern: Syntax error, steps cannot be greater than maximum value of part (`+this[t].length+`)`);if(l>u)throw TypeError(`CronPattern: From value is larger than to value: '`+e+`'`);for(let e=l;e<=u;e+=d)this.setPart(t,e,i[1]||r)}extractNth(e,t){let n=e,r;if(n.includes(`#`)){if(t!==`dayOfWeek`)throw Error(`CronPattern: nth (#) only allowed in day-of-week field`);r=n.split(`#`)[1],n=n.split(`#`)[0]}return[n,r]}handleRange(e,t,n,r){let i=this.extractNth(e,t),a=i[0].split(`-`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal range: '`+e+`'`);let o=parseInt(a[0],10)+n,s=parseInt(a[1],10)+n;if(isNaN(o))throw TypeError(`CronPattern: Syntax error, illegal lower range (NaN)`);if(isNaN(s))throw TypeError(`CronPattern: Syntax error, illegal upper range (NaN)`);if(o>s)throw TypeError(`CronPattern: From value is larger than to value: '`+e+`'`);for(let e=o;e<=s;e++)this.setPart(t,e,i[1]||r)}handleStepping(e,t,n,r){let i=this.extractNth(e,t),a=i[0].split(`/`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal stepping: '`+e+`'`);a[0]===``&&(a[0]=`*`);let o=0;a[0]!==`*`&&(o=parseInt(a[0],10)+n);let s=parseInt(a[1],10);if(isNaN(s))throw TypeError(`CronPattern: Syntax error, illegal stepping: (NaN)`);if(s===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(s>this[t].length)throw TypeError(`CronPattern: Syntax error, max steps for part is (`+this[t].length+`)`);for(let e=o;e<this[t].length;e+=s)this.setPart(t,e,i[1]||r)}replaceAlphaDays(e){return e.replace(/-sun/gi,`-7`).replace(/sun/gi,`0`).replace(/mon/gi,`1`).replace(/tue/gi,`2`).replace(/wed/gi,`3`).replace(/thu/gi,`4`).replace(/fri/gi,`5`).replace(/sat/gi,`6`)}replaceAlphaMonths(e){return e.replace(/jan/gi,`1`).replace(/feb/gi,`2`).replace(/mar/gi,`3`).replace(/apr/gi,`4`).replace(/may/gi,`5`).replace(/jun/gi,`6`).replace(/jul/gi,`7`).replace(/aug/gi,`8`).replace(/sep/gi,`9`).replace(/oct/gi,`10`).replace(/nov/gi,`11`).replace(/dec/gi,`12`)}handleNicknames(e){let t=e.trim().toLowerCase();return t===`@yearly`||t===`@annually`?`0 0 1 1 *`:t===`@monthly`?`0 0 1 * *`:t===`@weekly`?`0 0 * * 0`:t===`@daily`?`0 0 * * *`:t===`@hourly`?`0 * * * *`:e}setNthWeekdayOfMonth(e,t){if(typeof t!=`number`&&t===`L`)this.dayOfWeek[e]=this.dayOfWeek[e]|V;else if(t===H)this.dayOfWeek[e]=H;else if(t<6&&t>0)this.dayOfWeek[e]=this.dayOfWeek[e]|U[t-1];else throw TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${t}, Type: ${typeof t}`)}},G=[31,28,31,30,31,30,31,31,30,31,30,31],K=[[`month`,`year`,0],[`day`,`month`,-1],[`hour`,`day`,0],[`minute`,`hour`,0],[`second`,`minute`,0]],q=class e{tz;ms;second;minute;hour;day;month;year;constructor(t,n){if(this.tz=n,t&&t instanceof Date)if(!isNaN(t))this.fromDate(t);else throw TypeError(`CronDate: Invalid date passed to CronDate constructor`);else if(t===void 0)this.fromDate(new Date);else if(t&&typeof t==`string`)this.fromString(t);else if(t instanceof e)this.fromCronDate(t);else throw TypeError(`CronDate: Invalid type (`+typeof t+`) passed to CronDate constructor`)}isNthWeekdayOfMonth(e,t,n,r){let i=new Date(Date.UTC(e,t,n)).getUTCDay(),a=0;for(let r=1;r<=n;r++)new Date(Date.UTC(e,t,r)).getUTCDay()===i&&a++;if(r&H&&U[a-1]&r)return!0;if(r&V){let r=new Date(Date.UTC(e,t+1,0)).getUTCDate();for(let a=n+1;a<=r;a++)if(new Date(Date.UTC(e,t,a)).getUTCDay()===i)return!1;return!0}return!1}fromDate(e){if(this.tz!==void 0)if(typeof this.tz==`number`)this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes()+this.tz,this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),this.apply();else{let t=R.toTZ(e,this.tz);this.ms=e.getMilliseconds(),this.second=t.s,this.minute=t.i,this.hour=t.h,this.day=t.d,this.month=t.m-1,this.year=t.y}else this.ms=e.getMilliseconds(),this.second=e.getSeconds(),this.minute=e.getMinutes(),this.hour=e.getHours(),this.day=e.getDate(),this.month=e.getMonth(),this.year=e.getFullYear()}fromCronDate(e){this.tz=e.tz,this.year=e.year,this.month=e.month,this.day=e.day,this.hour=e.hour,this.minute=e.minute,this.second=e.second,this.ms=e.ms}apply(){if(this.month>11||this.day>G[this.month]||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let e=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes(),this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),!0}else return!1}fromString(e){if(typeof this.tz==`number`){let t=R.fromTZISO(e);this.ms=t.getUTCMilliseconds(),this.second=t.getUTCSeconds(),this.minute=t.getUTCMinutes(),this.hour=t.getUTCHours(),this.day=t.getUTCDate(),this.month=t.getUTCMonth(),this.year=t.getUTCFullYear(),this.apply()}else return this.fromDate(R.fromTZISO(e,this.tz))}findNext(e,t,n,r){let i=this[t],a;n.lastDayOfMonth&&(a=this.month===1?new Date(Date.UTC(this.year,this.month+1,0,0,0,0,0)).getUTCDate():G[this.month]);let o=!n.starDOW&&t==`day`?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0;for(let s=this[t]+r;s<n[t].length;s++){let c=n[t][s];if(t===`day`&&n.lastDayOfMonth&&s-r==a&&(c=1),t===`day`&&!n.starDOW){let t=n.dayOfWeek[(o+(s-r-1))%7];if(t&&t&H)t=this.isNthWeekdayOfMonth(this.year,this.month,s-r,t)?1:0;else if(t)throw Error(`CronDate: Invalid value for dayOfWeek encountered. ${t}`);e.legacyMode&&!n.starDOM?c||=t:c&&=t}if(c)return this[t]=s-r,i===this[t]?1:2}return 3}recurse(e,t,n){let r=this.findNext(t,K[n][0],e,K[n][2]);if(r>1){let i=n+1;for(;i<K.length;)this[K[i][0]]=-K[i][2],i++;if(r===3)return this[K[n][1]]++,this[K[n][0]]=-K[n][2],this.apply(),this.recurse(e,t,0);if(this.apply())return this.recurse(e,t,n-1)}return n+=1,n>=K.length?this:this.year>=3e3?null:this.recurse(e,t,n)}increment(e,t,n){return this.second+=t.interval!==void 0&&t.interval>1&&n?t.interval:1,this.ms=0,this.apply(),this.recurse(e,t,0)}getDate(e){return e||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz==`number`?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):R.fromTZ(R.tp(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}};function oe(e){if(e===void 0&&(e={}),delete e.name,e.legacyMode=e.legacyMode===void 0?!0:e.legacyMode,e.paused=e.paused===void 0?!1:e.paused,e.maxRuns=e.maxRuns===void 0?1/0:e.maxRuns,e.catch=e.catch===void 0?!1:e.catch,e.interval=e.interval===void 0?0:parseInt(e.interval.toString(),10),e.utcOffset=e.utcOffset===void 0?void 0:parseInt(e.utcOffset.toString(),10),e.unref=e.unref===void 0?!1:e.unref,e.startAt&&=new q(e.startAt,e.timezone),e.stopAt&&=new q(e.stopAt,e.timezone),e.interval!==null){if(isNaN(e.interval))throw Error(`CronOptions: Supplied value for interval is not a number`);if(e.interval<0)throw Error(`CronOptions: Supplied value for interval can not be negative`)}if(e.utcOffset!==void 0){if(isNaN(e.utcOffset))throw Error(`CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.`);if(e.utcOffset<-870||e.utcOffset>870)throw Error(`CronOptions: utcOffset out of bounds.`);if(e.utcOffset!==void 0&&e.timezone)throw Error(`CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.`)}if(e.unref!==!0&&e.unref!==!1)throw Error(`CronOptions: Unref should be either true, false or undefined(false).`);return e}function J(e){return Object.prototype.toString.call(e)===`[object Function]`||typeof e==`function`||e instanceof Function}function se(e){return J(e)}function ce(e){typeof Deno<`u`&&typeof Deno.unrefTimer<`u`?Deno.unrefTimer(e):e&&typeof e.unref<`u`&&e.unref()}var Y=30*1e3,X=[],Z=class{name;options;_states;fn;constructor(e,t,n){let r,i;if(J(t))i=t;else if(typeof t==`object`)r=t;else if(t!==void 0)throw Error(`Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).`);if(J(n))i=n;else if(typeof n==`object`)r=n;else if(n!==void 0)throw Error(`Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).`);if(this.name=r?.name,this.options=oe(r),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:r?r.maxRuns:void 0,paused:r?r.paused:!1,pattern:new W(`* * * * *`)},e&&(e instanceof Date||typeof e==`string`&&e.indexOf(`:`)>0)?this._states.once=new q(e,this.options.timezone||this.options.utcOffset):this._states.pattern=new W(e,this.options.timezone),this.name){if(X.find(e=>e.name===this.name))throw Error(`Cron: Tried to initialize new named job '`+this.name+`', but name already taken.`);X.push(this)}return i!==void 0&&se(i)&&(this.fn=i,this.schedule()),this}nextRun(e){let t=this._next(e);return t?t.getDate(!1):null}nextRuns(e,t){this._states.maxRuns!==void 0&&e>this._states.maxRuns&&(e=this._states.maxRuns);let n=[],r=t||this._states.currentRun||void 0;for(;e--&&(r=this.nextRun(r));)n.push(r);return n}getPattern(){return this._states.pattern?this._states.pattern.pattern:void 0}isRunning(){let e=this.nextRun(this._states.currentRun),t=!this._states.paused,n=this.fn!==void 0,r=!this._states.kill;return t&&n&&r&&e!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(e){let t=this._next(e);return t?e instanceof q||e instanceof Date?t.getTime()-e.getTime():t.getTime()-new q(e).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let e=X.indexOf(this);e>=0&&X.splice(e,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(e){if(e&&this.fn)throw Error(`Cron: It is not allowed to schedule two functions using the same Croner instance.`);e&&(this.fn=e);let t=this.msToNext(),n=this.nextRun(this._states.currentRun);return t==null||isNaN(t)||n===null?this:(t>Y&&(t=Y),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(n),t),this._states.currentTimeout&&this.options.unref&&ce(this._states.currentTimeout),this)}async _trigger(e){if(this._states.blocking=!0,this._states.currentRun=new q(void 0,this.options.timezone||this.options.utcOffset),this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(e){J(this.options.catch)&&this.options.catch(e,this)}else this.fn!==void 0&&await this.fn(this,this.options.context);this._states.previousRun=new q(e,this.options.timezone||this.options.utcOffset),this._states.blocking=!1}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(e){let t=new Date,n=!this._states.paused&&t.getTime()>=e.getTime(),r=this._states.blocking&&this.options.protect;n&&!r?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):n&&r&&J(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(e){let t=!!(e||this._states.currentRun),n=!1;!e&&this.options.startAt&&this.options.interval&&([e,t]=this._calculatePreviousRun(e,t),n=!e),e=new q(e,this.options.timezone||this.options.utcOffset),this.options.startAt&&e&&e.getTime()<this.options.startAt.getTime()&&(e=this.options.startAt);let r=this._states.once||new q(e,this.options.timezone||this.options.utcOffset);return!n&&r!==this._states.once&&(r=r.increment(this._states.pattern,this.options,t)),this._states.once&&this._states.once.getTime()<=e.getTime()||r===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&r.getTime()>=this.options.stopAt.getTime()?null:r}_calculatePreviousRun(e,t){let n=new q(void 0,this.options.timezone||this.options.utcOffset),r=e;if(this.options.startAt.getTime()<=n.getTime()){r=this.options.startAt;let e=r.getTime()+this.options.interval*1e3;for(;e<=n.getTime();)r=new q(r,this.options.timezone||this.options.utcOffset).increment(this._states.pattern,this.options,!0),e=r.getTime()+this.options.interval*1e3;t=!0}return r===null&&(r=void 0),[r,t]}},le=[`bypassPermissions`,`acceptEdits`,`default`,`plan`];function ue({open:e,schedule:t,onClose:n,onSaved:r}){let i=u(),[a,o]=(0,M.useState)(()=>$(t)),[c,l]=(0,M.useState)([]),[h,_]=(0,M.useState)(!1),[y,b]=(0,M.useState)(null);(0,M.useEffect)(()=>{e&&(o($(t)),b(null),s.get(`/api/projects`).then(l).catch(()=>l([])))},[e,t]);let x=(0,M.useMemo)(()=>{try{return new Z(a.cron_expr).nextRuns(3).map(e=>e.toLocaleString())}catch{return null}},[a.cron_expr]),S=(e,t)=>o(n=>({...n,[e]:t})),D=(0,I.jsxs)(`div`,{className:`space-y-3 px-1`,children:[(0,I.jsx)(Q,{label:`Name`,children:(0,I.jsx)(E,{value:a.name,onChange:e=>S(`name`,e.target.value),placeholder:`Morning PR review`,className:`h-11 md:h-9 text-xs`})}),(0,I.jsxs)(Q,{label:`Cron expression (local timezone)`,children:[(0,I.jsx)(E,{value:a.cron_expr,onChange:e=>S(`cron_expr`,e.target.value),placeholder:`0 7 * * *`,className:`h-11 md:h-9 text-xs font-mono`}),(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:x?`Next: ${x.join(` · `)}`:`—`})]}),(0,I.jsx)(Q,{label:`Project`,children:(0,I.jsxs)(j,{value:a.project_path,onValueChange:e=>S(`project_path`,e),children:[(0,I.jsx)(g,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(C,{placeholder:`Select project`})}),(0,I.jsx)(m,{children:c.map(e=>(0,I.jsx)(w,{value:e.path,children:e.name},e.path))})]})}),(0,I.jsx)(Q,{label:`Prompt (do not embed secrets)`,children:(0,I.jsx)(`textarea`,{value:a.prompt,onChange:e=>S(`prompt`,e.target.value),placeholder:`Check open PRs and summarize. If nothing to do, finish immediately.`,rows:4,className:`w-full rounded-md border border-input bg-transparent px-3 py-2 text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring/50 resize-y`})}),(0,I.jsxs)(Q,{label:`Permission mode`,children:[(0,I.jsxs)(j,{value:a.permission_mode,onValueChange:e=>S(`permission_mode`,e),children:[(0,I.jsx)(g,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(C,{})}),(0,I.jsx)(m,{children:le.map(e=>(0,I.jsx)(w,{value:e,children:e},e))})]}),a.permission_mode===`bypassPermissions`&&(0,I.jsx)(`p`,{className:`text-[11px] text-warning`,children:`⚠ Unattended writes — agent can modify code and run commands`})]}),(0,I.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,I.jsx)(Q,{label:`Max turns (optional)`,children:(0,I.jsx)(E,{type:`number`,min:1,value:a.max_turns,onChange:e=>S(`max_turns`,e.target.value),placeholder:`∞`,className:`h-11 md:h-9 text-xs`})}),(0,I.jsx)(Q,{label:`Timeout (ms)`,children:(0,I.jsx)(E,{type:`number`,min:1e4,value:a.timeout_ms,onChange:e=>S(`timeout_ms`,e.target.value),className:`h-11 md:h-9 text-xs`})})]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between min-h-11`,children:[(0,I.jsx)(`span`,{className:`text-xs font-medium`,children:`Enabled`}),(0,I.jsx)(T,{checked:a.enabled,onCheckedChange:e=>S(`enabled`,e)})]}),y&&(0,I.jsx)(`p`,{className:`text-[11px] text-error`,children:y}),(0,I.jsx)(d,{onClick:async()=>{if(!a.name.trim()||!a.project_path||!a.prompt.trim()){b(`Name, project, and prompt are required`);return}if(!x){b(`Invalid cron expression`);return}_(!0),b(null);try{let e={name:a.name.trim(),cron_expr:a.cron_expr,project_path:a.project_path,prompt:a.prompt,permission_mode:a.permission_mode,max_turns:a.max_turns===``?null:Number(a.max_turns),timeout_ms:Number(a.timeout_ms)||18e5,enabled:a.enabled};t?await s.patch(`/api/schedules/${t.id}`,e):await s.post(`/api/schedules`,e),r(),n()}catch(e){b(e instanceof Error?e.message:String(e))}finally{_(!1)}},disabled:h,className:`w-full min-h-11 cursor-pointer`,children:h?`Saving…`:t?`Save changes`:`Create schedule`})]}),O=t?`Edit: ${t.name}`:`New schedule`;return i?(0,I.jsxs)(f,{open:e,onClose:n,className:`max-h-[85vh] flex flex-col`,children:[(0,I.jsx)(`p`,{className:`text-sm font-semibold text-center pb-2`,children:O}),(0,I.jsx)(k,{className:`flex-1 min-h-0 px-3 pb-3`,children:D})]}):(0,I.jsx)(v,{open:e,onOpenChange:e=>!e&&n(),children:(0,I.jsxs)(te,{className:`max-w-md max-h-[85vh] overflow-y-auto`,children:[(0,I.jsx)(ee,{children:(0,I.jsx)(p,{className:`text-sm`,children:O})}),D]})})}function Q({label:e,children:t}){return(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:e}),t]})}function $(e){return{name:e?.name??``,cron_expr:e?.cron_expr??`0 7 * * *`,project_path:e?.project_path??``,prompt:e?.prompt??``,permission_mode:e?.permission_mode??`bypassPermissions`,max_turns:e?.max_turns==null?``:String(e.max_turns),timeout_ms:String(e?.timeout_ms??18e5),enabled:e?!!e.enabled:!0}}function de(){let{schedules:e,loading:t,refetch:n}=P(),[i,a]=(0,M.useState)(!1),[o,s]=(0,M.useState)(null),c=()=>{s(null),a(!0)},l=e=>{s(e),a(!0)};return(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Periodically wake Claude to work on a project unattended.`}),(0,I.jsxs)(d,{size:`sm`,onClick:c,className:`min-h-11 md:min-h-8 text-xs gap-1 cursor-pointer shrink-0`,children:[(0,I.jsx)(_,{className:`size-3.5`}),` Add`]})]}),t&&e.length===0?(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:`Loading…`}):e.length===0?(0,I.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,I.jsx)(r,{className:`size-8 text-muted-foreground/50`}),(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No schedules yet. Add one to run Claude periodically.`}),(0,I.jsxs)(d,{size:`sm`,onClick:c,className:`min-h-11 text-xs gap-1 cursor-pointer`,children:[(0,I.jsx)(_,{className:`size-3.5`}),` Add schedule`]})]}):(0,I.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,I.jsx)(ae,{schedule:e,onEdit:()=>l(e),onChanged:n},e.id))}),(0,I.jsx)(ue,{open:i,schedule:o,onClose:()=>a(!1),onSaved:n})]})}export{de as SchedulesSettingsSection};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./calendar-clock-C1asT-gk.js";import{t as i}from"./chevron-down-Dp0rpHb8.js";import{t as a}from"./chevron-right-De-Wz5Lz.js";import{t as o}from"./power-CriQkeK5.js";import{n as s,s as c}from"./api-client-oY1tC3tM.js";import{n as l}from"./utils-C9OjCrou.js";import"./portal-container-context-a399Hd9F.js";import"./context-menu-C13b1uT3.js";import{n as u}from"./use-is-mobile-CYW3FJFE.js";import{t as d}from"./button-BZtEJcUv.js";import{t as f}from"./mobile-bottom-sheet-BD5b7KJF.js";import"./use-visual-viewport-rnvuooQZ.js";import{$t as p,B as m,Et as h,H as g,Jn as _,Jt as v,Nt as y,Pn as b,Qn as x,Qt as ee,Tt as S,U as C,V as w,W as T,Y as E,Yn as D,Yt as te,kt as O,q as k,wt as A,z as j}from"./index-LEL-8oU_.js";var M=e(t(),1),N=1e4;function P(){let[e,t]=(0,M.useState)([]),[n,r]=(0,M.useState)(!0),i=(0,M.useCallback)(async()=>{try{t(await s.get(`/api/schedules`))}catch{}finally{r(!1)}},[]);return(0,M.useEffect)(()=>{i();let e=setInterval(()=>{document.visibilityState===`visible`&&i()},N);return()=>clearInterval(e)},[i]),{schedules:e,loading:n,refetch:i}}function F(e){let[t,n]=(0,M.useState)([]),[r,i]=(0,M.useState)(!1),a=(0,M.useCallback)(async()=>{if(e!=null){i(!0);try{n(await s.get(`/api/schedules/${e}/runs?limit=20`))}catch{n([])}finally{i(!1)}}},[e]);return(0,M.useEffect)(()=>{a()},[a]),{runs:t,loading:r,refetch:a}}var I=n(),ne={done:`bg-success/10 text-success`,error:`bg-error/10 text-error`,running:`bg-warning/10 text-warning`,skipped:`bg-muted text-muted-foreground`};function re({scheduleId:e}){let{runs:t,loading:n}=F(e);return n&&t.length===0?(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`Loading runs…`}):t.length===0?(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`No runs yet.`}):(0,I.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,I.jsx)(ie,{run:e},e.id))})}function L(e){return new Date(e.includes(`T`)?e:e.replace(` `,`T`)+`Z`)}function ie({run:e}){let[t,n]=(0,M.useState)(!1),r=!!(e.output_truncated||e.error),i=e.ended_at?`${Math.round((L(e.ended_at).getTime()-L(e.started_at).getTime())/1e3)}s`:`…`;return(0,I.jsxs)(`div`,{className:`rounded border border-border text-[11px]`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:()=>r&&n(!t),className:l(`w-full flex items-center gap-2 px-2 py-2 min-h-11 text-left`,r&&`cursor-pointer hover:bg-accent/30`),children:[(0,I.jsx)(`span`,{className:l(`rounded px-1.5 py-0.5 font-medium shrink-0`,ne[e.status]),children:e.status}),(0,I.jsxs)(`span`,{className:`text-muted-foreground truncate flex-1`,children:[L(e.started_at).toLocaleString(),` · `,i,e.cost_usd!=null&&` · $${e.cost_usd.toFixed(4)}`,e.context_window_pct!=null&&` · ctx ${e.context_window_pct}%`]})]}),t&&(0,I.jsxs)(`div`,{className:`px-2 pb-2 space-y-1`,children:[e.error&&(0,I.jsx)(`p`,{className:`text-error break-all`,children:e.error}),e.output_truncated&&(0,I.jsx)(`pre`,{className:`overflow-auto max-h-96 whitespace-pre-wrap break-all text-muted-foreground font-mono text-[10px]`,children:e.output_truncated})]})]})}function ae({schedule:e,onEdit:t,onChanged:n}){let[r,u]=(0,M.useState)(!1),[d,f]=(0,M.useState)(0);return(0,I.jsxs)(`div`,{className:`rounded-lg border border-border`,children:[(0,I.jsxs)(A,{children:[(0,I.jsx)(y,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,onClick:()=>u(!r),className:`w-full flex items-center gap-2 px-2.5 py-2.5 min-h-11 text-left cursor-pointer hover:bg-accent/30`,children:[r?(0,I.jsx)(i,{className:`size-3.5 shrink-0 text-muted-foreground`}):(0,I.jsx)(a,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,I.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,I.jsx)(`p`,{className:`text-xs font-medium truncate`,children:e.name}),(0,I.jsxs)(`p`,{className:`text-[11px] text-muted-foreground truncate`,children:[(0,I.jsx)(`span`,{className:`font-mono`,children:e.cron_expr}),` · `,e.next_fire_at&&e.enabled?`next ${new Date(e.next_fire_at).toLocaleString()}`:`—`]})]}),(0,I.jsx)(`span`,{className:l(`rounded px-1.5 py-0.5 text-[10px] font-medium shrink-0`,e.enabled?`bg-success/10 text-success`:`bg-muted text-muted-foreground`),children:e.enabled?`Enabled`:`Disabled`})]})}),(0,I.jsxs)(S,{children:[(0,I.jsxs)(h,{onClick:async()=>{try{let t=await s.post(`/api/schedules/${e.id}/run-now`);c.success(`Run #${t.runId} started${t.wasRunning?` (previous run still active)`:``}`),u(!0),f(e=>e+1)}catch(e){c.error(e instanceof Error?e.message:`Run failed`)}},children:[(0,I.jsx)(D,{className:`size-3.5`}),` Run now`]}),(0,I.jsxs)(h,{onClick:async()=>{try{await s.patch(`/api/schedules/${e.id}`,{enabled:!e.enabled}),n()}catch(e){c.error(e instanceof Error?e.message:`Update failed`)}},children:[(0,I.jsx)(o,{className:`size-3.5`}),` `,e.enabled?`Disable`:`Enable`]}),(0,I.jsxs)(h,{onClick:t,children:[(0,I.jsx)(x,{className:`size-3.5`}),` Edit`]}),(0,I.jsx)(O,{}),(0,I.jsxs)(h,{variant:`destructive`,onClick:async()=>{try{await s.del(`/api/schedules/${e.id}`),c.success(`Schedule deleted`),n()}catch(e){c.error(e instanceof Error?e.message:`Delete failed`)}},children:[(0,I.jsx)(b,{className:`size-3.5`}),` Delete`]})]})]}),r&&(0,I.jsxs)(`div`,{className:`px-2.5 pb-2.5 space-y-1.5`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground break-all line-clamp-3`,children:e.prompt}),(0,I.jsx)(re,{scheduleId:e.id},d)]})]})}function R(e,t,n,r,i,a,o,s){return R.fromTZ(R.tp(e,t,n,r,i,a,o),s)}R.fromTZISO=(e,t,n)=>R.fromTZ(B(e,t),n),R.fromTZ=function(e,t){let n=new Date(Date.UTC(e.y,e.m-1,e.d,e.h,e.i,e.s)),r=z(e.tz,n),i=new Date(n.getTime()-r),a=z(e.tz,i);if(a-r===0)return i;{let r=new Date(n.getTime()-a),o=z(e.tz,r);if(o-a===0||!t&&o-a>0)return r;if(t)throw Error(`Invalid date passed to fromTZ()`);return i}},R.toTZ=function(e,t){let n=e.toLocaleString(`en-US`,{timeZone:t}).replace(/[\u202f]/,` `),r=new Date(n);return{y:r.getFullYear(),m:r.getMonth()+1,d:r.getDate(),h:r.getHours(),i:r.getMinutes(),s:r.getSeconds(),tz:t}},R.tp=(e,t,n,r,i,a,o)=>({y:e,m:t,d:n,h:r,i,s:a,tz:o});function z(e,t=new Date){let n=t.toLocaleString(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).split(` `).slice(-1)[0],r=t.toLocaleString(`en-US`).replace(/[\u202f]/,` `);return Date.parse(`${r} GMT`)-Date.parse(`${r} ${n}`)}function B(e,t){let n=new Date(Date.parse(e));if(isNaN(n))throw Error(`minitz: Invalid ISO8601 passed to parser.`);let r=e.substring(9);return e.includes(`Z`)||r.includes(`-`)||r.includes(`+`)?R.tp(n.getUTCFullYear(),n.getUTCMonth()+1,n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),`Etc/UTC`):R.tp(n.getFullYear(),n.getMonth()+1,n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),t)}R.minitz=R;var V=32,H=31|V,U=[1,2,4,8,16],W=class{pattern;timezone;second;minute;hour;day;month;dayOfWeek;lastDayOfMonth;starDOM;starDOW;constructor(e,t){this.pattern=e,this.timezone=t,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.lastDayOfMonth=!1,this.starDOM=!1,this.starDOW=!1,this.parse()}parse(){if(!(typeof this.pattern==`string`||this.pattern instanceof String))throw TypeError(`CronPattern: Pattern has to be of type string.`);this.pattern.indexOf(`@`)>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let e=this.pattern.replace(/\s+/g,` `).split(` `);if(e.length<5||e.length>6)throw TypeError(`CronPattern: invalid configuration format ('`+this.pattern+`'), exactly five or six space separated parts are required.`);if(e.length===5&&e.unshift(`0`),e[3].indexOf(`L`)>=0&&(e[3]=e[3].replace(`L`,``),this.lastDayOfMonth=!0),e[3]==`*`&&(this.starDOM=!0),e[4].length>=3&&(e[4]=this.replaceAlphaMonths(e[4])),e[5].length>=3&&(e[5]=this.replaceAlphaDays(e[5])),e[5]==`*`&&(this.starDOW=!0),this.pattern.indexOf(`?`)>=0){let t=new q(new Date,this.timezone).getDate(!0);e[0]=e[0].replace(`?`,t.getSeconds().toString()),e[1]=e[1].replace(`?`,t.getMinutes().toString()),e[2]=e[2].replace(`?`,t.getHours().toString()),this.starDOM||(e[3]=e[3].replace(`?`,t.getDate().toString())),e[4]=e[4].replace(`?`,(t.getMonth()+1).toString()),this.starDOW||(e[5]=e[5].replace(`?`,t.getDay().toString()))}this.throwAtIllegalCharacters(e),this.partToArray(`second`,e[0],0,1),this.partToArray(`minute`,e[1],0,1),this.partToArray(`hour`,e[2],0,1),this.partToArray(`day`,e[3],-1,1),this.partToArray(`month`,e[4],-1,1),this.partToArray(`dayOfWeek`,e[5],0,H),this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(e,t,n,r){let i=this[e],a=e===`day`&&this.lastDayOfMonth;if(t===``&&!a)throw TypeError(`CronPattern: configuration entry `+e+` (`+t+`) is empty, check for trailing spaces.`);if(t===`*`)return i.fill(r);let o=t.split(`,`);if(o.length>1)for(let t=0;t<o.length;t++)this.partToArray(e,o[t],n,r);else t.indexOf(`-`)!==-1&&t.indexOf(`/`)!==-1?this.handleRangeWithStepping(t,e,n,r):t.indexOf(`-`)===-1?t.indexOf(`/`)===-1?t!==``&&this.handleNumber(t,e,n,r):this.handleStepping(t,e,n,r):this.handleRange(t,e,n,r)}throwAtIllegalCharacters(e){for(let t=0;t<e.length;t++)if((t===5?/[^/*0-9,\-#L]+/:/[^/*0-9,-]+/).test(e[t]))throw TypeError(`CronPattern: configuration entry `+t+` (`+e[t]+`) contains illegal characters.`)}handleNumber(e,t,n,r){let i=this.extractNth(e,t),a=parseInt(i[0],10)+n;if(isNaN(a))throw TypeError(`CronPattern: `+t+` is not a number: '`+e+`'`);this.setPart(t,a,i[1]||r)}setPart(e,t,n){if(!Object.prototype.hasOwnProperty.call(this,e))throw TypeError(`CronPattern: Invalid part specified: `+e);if(e===`dayOfWeek`){if(t===7&&(t=0),t<0||t>6)throw RangeError(`CronPattern: Invalid value for dayOfWeek: `+t);this.setNthWeekdayOfMonth(t,n);return}if(e===`second`||e===`minute`){if(t<0||t>=60)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`hour`){if(t<0||t>=24)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`day`){if(t<0||t>=31)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`month`&&(t<0||t>=12))throw RangeError(`CronPattern: Invalid value for `+e+`: `+t);this[e][t]=n}handleRangeWithStepping(e,t,n,r){let i=this.extractNth(e,t),a=i[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(a===null)throw TypeError(`CronPattern: Syntax error, illegal range with stepping: '`+e+`'`);let[,o,s,c]=a,l=parseInt(o,10)+n,u=parseInt(s,10)+n,d=parseInt(c,10);if(isNaN(l))throw TypeError(`CronPattern: Syntax error, illegal lower range (NaN)`);if(isNaN(u))throw TypeError(`CronPattern: Syntax error, illegal upper range (NaN)`);if(isNaN(d))throw TypeError(`CronPattern: Syntax error, illegal stepping: (NaN)`);if(d===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(d>this[t].length)throw TypeError(`CronPattern: Syntax error, steps cannot be greater than maximum value of part (`+this[t].length+`)`);if(l>u)throw TypeError(`CronPattern: From value is larger than to value: '`+e+`'`);for(let e=l;e<=u;e+=d)this.setPart(t,e,i[1]||r)}extractNth(e,t){let n=e,r;if(n.includes(`#`)){if(t!==`dayOfWeek`)throw Error(`CronPattern: nth (#) only allowed in day-of-week field`);r=n.split(`#`)[1],n=n.split(`#`)[0]}return[n,r]}handleRange(e,t,n,r){let i=this.extractNth(e,t),a=i[0].split(`-`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal range: '`+e+`'`);let o=parseInt(a[0],10)+n,s=parseInt(a[1],10)+n;if(isNaN(o))throw TypeError(`CronPattern: Syntax error, illegal lower range (NaN)`);if(isNaN(s))throw TypeError(`CronPattern: Syntax error, illegal upper range (NaN)`);if(o>s)throw TypeError(`CronPattern: From value is larger than to value: '`+e+`'`);for(let e=o;e<=s;e++)this.setPart(t,e,i[1]||r)}handleStepping(e,t,n,r){let i=this.extractNth(e,t),a=i[0].split(`/`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal stepping: '`+e+`'`);a[0]===``&&(a[0]=`*`);let o=0;a[0]!==`*`&&(o=parseInt(a[0],10)+n);let s=parseInt(a[1],10);if(isNaN(s))throw TypeError(`CronPattern: Syntax error, illegal stepping: (NaN)`);if(s===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(s>this[t].length)throw TypeError(`CronPattern: Syntax error, max steps for part is (`+this[t].length+`)`);for(let e=o;e<this[t].length;e+=s)this.setPart(t,e,i[1]||r)}replaceAlphaDays(e){return e.replace(/-sun/gi,`-7`).replace(/sun/gi,`0`).replace(/mon/gi,`1`).replace(/tue/gi,`2`).replace(/wed/gi,`3`).replace(/thu/gi,`4`).replace(/fri/gi,`5`).replace(/sat/gi,`6`)}replaceAlphaMonths(e){return e.replace(/jan/gi,`1`).replace(/feb/gi,`2`).replace(/mar/gi,`3`).replace(/apr/gi,`4`).replace(/may/gi,`5`).replace(/jun/gi,`6`).replace(/jul/gi,`7`).replace(/aug/gi,`8`).replace(/sep/gi,`9`).replace(/oct/gi,`10`).replace(/nov/gi,`11`).replace(/dec/gi,`12`)}handleNicknames(e){let t=e.trim().toLowerCase();return t===`@yearly`||t===`@annually`?`0 0 1 1 *`:t===`@monthly`?`0 0 1 * *`:t===`@weekly`?`0 0 * * 0`:t===`@daily`?`0 0 * * *`:t===`@hourly`?`0 * * * *`:e}setNthWeekdayOfMonth(e,t){if(typeof t!=`number`&&t===`L`)this.dayOfWeek[e]=this.dayOfWeek[e]|V;else if(t===H)this.dayOfWeek[e]=H;else if(t<6&&t>0)this.dayOfWeek[e]=this.dayOfWeek[e]|U[t-1];else throw TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${t}, Type: ${typeof t}`)}},G=[31,28,31,30,31,30,31,31,30,31,30,31],K=[[`month`,`year`,0],[`day`,`month`,-1],[`hour`,`day`,0],[`minute`,`hour`,0],[`second`,`minute`,0]],q=class e{tz;ms;second;minute;hour;day;month;year;constructor(t,n){if(this.tz=n,t&&t instanceof Date)if(!isNaN(t))this.fromDate(t);else throw TypeError(`CronDate: Invalid date passed to CronDate constructor`);else if(t===void 0)this.fromDate(new Date);else if(t&&typeof t==`string`)this.fromString(t);else if(t instanceof e)this.fromCronDate(t);else throw TypeError(`CronDate: Invalid type (`+typeof t+`) passed to CronDate constructor`)}isNthWeekdayOfMonth(e,t,n,r){let i=new Date(Date.UTC(e,t,n)).getUTCDay(),a=0;for(let r=1;r<=n;r++)new Date(Date.UTC(e,t,r)).getUTCDay()===i&&a++;if(r&H&&U[a-1]&r)return!0;if(r&V){let r=new Date(Date.UTC(e,t+1,0)).getUTCDate();for(let a=n+1;a<=r;a++)if(new Date(Date.UTC(e,t,a)).getUTCDay()===i)return!1;return!0}return!1}fromDate(e){if(this.tz!==void 0)if(typeof this.tz==`number`)this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes()+this.tz,this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),this.apply();else{let t=R.toTZ(e,this.tz);this.ms=e.getMilliseconds(),this.second=t.s,this.minute=t.i,this.hour=t.h,this.day=t.d,this.month=t.m-1,this.year=t.y}else this.ms=e.getMilliseconds(),this.second=e.getSeconds(),this.minute=e.getMinutes(),this.hour=e.getHours(),this.day=e.getDate(),this.month=e.getMonth(),this.year=e.getFullYear()}fromCronDate(e){this.tz=e.tz,this.year=e.year,this.month=e.month,this.day=e.day,this.hour=e.hour,this.minute=e.minute,this.second=e.second,this.ms=e.ms}apply(){if(this.month>11||this.day>G[this.month]||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let e=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes(),this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),!0}else return!1}fromString(e){if(typeof this.tz==`number`){let t=R.fromTZISO(e);this.ms=t.getUTCMilliseconds(),this.second=t.getUTCSeconds(),this.minute=t.getUTCMinutes(),this.hour=t.getUTCHours(),this.day=t.getUTCDate(),this.month=t.getUTCMonth(),this.year=t.getUTCFullYear(),this.apply()}else return this.fromDate(R.fromTZISO(e,this.tz))}findNext(e,t,n,r){let i=this[t],a;n.lastDayOfMonth&&(a=this.month===1?new Date(Date.UTC(this.year,this.month+1,0,0,0,0,0)).getUTCDate():G[this.month]);let o=!n.starDOW&&t==`day`?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0;for(let s=this[t]+r;s<n[t].length;s++){let c=n[t][s];if(t===`day`&&n.lastDayOfMonth&&s-r==a&&(c=1),t===`day`&&!n.starDOW){let t=n.dayOfWeek[(o+(s-r-1))%7];if(t&&t&H)t=this.isNthWeekdayOfMonth(this.year,this.month,s-r,t)?1:0;else if(t)throw Error(`CronDate: Invalid value for dayOfWeek encountered. ${t}`);e.legacyMode&&!n.starDOM?c||=t:c&&=t}if(c)return this[t]=s-r,i===this[t]?1:2}return 3}recurse(e,t,n){let r=this.findNext(t,K[n][0],e,K[n][2]);if(r>1){let i=n+1;for(;i<K.length;)this[K[i][0]]=-K[i][2],i++;if(r===3)return this[K[n][1]]++,this[K[n][0]]=-K[n][2],this.apply(),this.recurse(e,t,0);if(this.apply())return this.recurse(e,t,n-1)}return n+=1,n>=K.length?this:this.year>=3e3?null:this.recurse(e,t,n)}increment(e,t,n){return this.second+=t.interval!==void 0&&t.interval>1&&n?t.interval:1,this.ms=0,this.apply(),this.recurse(e,t,0)}getDate(e){return e||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz==`number`?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):R.fromTZ(R.tp(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}};function oe(e){if(e===void 0&&(e={}),delete e.name,e.legacyMode=e.legacyMode===void 0?!0:e.legacyMode,e.paused=e.paused===void 0?!1:e.paused,e.maxRuns=e.maxRuns===void 0?1/0:e.maxRuns,e.catch=e.catch===void 0?!1:e.catch,e.interval=e.interval===void 0?0:parseInt(e.interval.toString(),10),e.utcOffset=e.utcOffset===void 0?void 0:parseInt(e.utcOffset.toString(),10),e.unref=e.unref===void 0?!1:e.unref,e.startAt&&=new q(e.startAt,e.timezone),e.stopAt&&=new q(e.stopAt,e.timezone),e.interval!==null){if(isNaN(e.interval))throw Error(`CronOptions: Supplied value for interval is not a number`);if(e.interval<0)throw Error(`CronOptions: Supplied value for interval can not be negative`)}if(e.utcOffset!==void 0){if(isNaN(e.utcOffset))throw Error(`CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.`);if(e.utcOffset<-870||e.utcOffset>870)throw Error(`CronOptions: utcOffset out of bounds.`);if(e.utcOffset!==void 0&&e.timezone)throw Error(`CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.`)}if(e.unref!==!0&&e.unref!==!1)throw Error(`CronOptions: Unref should be either true, false or undefined(false).`);return e}function J(e){return Object.prototype.toString.call(e)===`[object Function]`||typeof e==`function`||e instanceof Function}function se(e){return J(e)}function ce(e){typeof Deno<`u`&&typeof Deno.unrefTimer<`u`?Deno.unrefTimer(e):e&&typeof e.unref<`u`&&e.unref()}var Y=30*1e3,X=[],Z=class{name;options;_states;fn;constructor(e,t,n){let r,i;if(J(t))i=t;else if(typeof t==`object`)r=t;else if(t!==void 0)throw Error(`Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).`);if(J(n))i=n;else if(typeof n==`object`)r=n;else if(n!==void 0)throw Error(`Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).`);if(this.name=r?.name,this.options=oe(r),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:r?r.maxRuns:void 0,paused:r?r.paused:!1,pattern:new W(`* * * * *`)},e&&(e instanceof Date||typeof e==`string`&&e.indexOf(`:`)>0)?this._states.once=new q(e,this.options.timezone||this.options.utcOffset):this._states.pattern=new W(e,this.options.timezone),this.name){if(X.find(e=>e.name===this.name))throw Error(`Cron: Tried to initialize new named job '`+this.name+`', but name already taken.`);X.push(this)}return i!==void 0&&se(i)&&(this.fn=i,this.schedule()),this}nextRun(e){let t=this._next(e);return t?t.getDate(!1):null}nextRuns(e,t){this._states.maxRuns!==void 0&&e>this._states.maxRuns&&(e=this._states.maxRuns);let n=[],r=t||this._states.currentRun||void 0;for(;e--&&(r=this.nextRun(r));)n.push(r);return n}getPattern(){return this._states.pattern?this._states.pattern.pattern:void 0}isRunning(){let e=this.nextRun(this._states.currentRun),t=!this._states.paused,n=this.fn!==void 0,r=!this._states.kill;return t&&n&&r&&e!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(e){let t=this._next(e);return t?e instanceof q||e instanceof Date?t.getTime()-e.getTime():t.getTime()-new q(e).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let e=X.indexOf(this);e>=0&&X.splice(e,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(e){if(e&&this.fn)throw Error(`Cron: It is not allowed to schedule two functions using the same Croner instance.`);e&&(this.fn=e);let t=this.msToNext(),n=this.nextRun(this._states.currentRun);return t==null||isNaN(t)||n===null?this:(t>Y&&(t=Y),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(n),t),this._states.currentTimeout&&this.options.unref&&ce(this._states.currentTimeout),this)}async _trigger(e){if(this._states.blocking=!0,this._states.currentRun=new q(void 0,this.options.timezone||this.options.utcOffset),this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(e){J(this.options.catch)&&this.options.catch(e,this)}else this.fn!==void 0&&await this.fn(this,this.options.context);this._states.previousRun=new q(e,this.options.timezone||this.options.utcOffset),this._states.blocking=!1}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(e){let t=new Date,n=!this._states.paused&&t.getTime()>=e.getTime(),r=this._states.blocking&&this.options.protect;n&&!r?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):n&&r&&J(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(e){let t=!!(e||this._states.currentRun),n=!1;!e&&this.options.startAt&&this.options.interval&&([e,t]=this._calculatePreviousRun(e,t),n=!e),e=new q(e,this.options.timezone||this.options.utcOffset),this.options.startAt&&e&&e.getTime()<this.options.startAt.getTime()&&(e=this.options.startAt);let r=this._states.once||new q(e,this.options.timezone||this.options.utcOffset);return!n&&r!==this._states.once&&(r=r.increment(this._states.pattern,this.options,t)),this._states.once&&this._states.once.getTime()<=e.getTime()||r===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&r.getTime()>=this.options.stopAt.getTime()?null:r}_calculatePreviousRun(e,t){let n=new q(void 0,this.options.timezone||this.options.utcOffset),r=e;if(this.options.startAt.getTime()<=n.getTime()){r=this.options.startAt;let e=r.getTime()+this.options.interval*1e3;for(;e<=n.getTime();)r=new q(r,this.options.timezone||this.options.utcOffset).increment(this._states.pattern,this.options,!0),e=r.getTime()+this.options.interval*1e3;t=!0}return r===null&&(r=void 0),[r,t]}},le=[`bypassPermissions`,`acceptEdits`,`default`,`plan`];function ue({open:e,schedule:t,onClose:n,onSaved:r}){let i=u(),[a,o]=(0,M.useState)(()=>$(t)),[c,l]=(0,M.useState)([]),[h,_]=(0,M.useState)(!1),[y,b]=(0,M.useState)(null);(0,M.useEffect)(()=>{e&&(o($(t)),b(null),s.get(`/api/projects`).then(l).catch(()=>l([])))},[e,t]);let x=(0,M.useMemo)(()=>{try{return new Z(a.cron_expr).nextRuns(3).map(e=>e.toLocaleString())}catch{return null}},[a.cron_expr]),S=(e,t)=>o(n=>({...n,[e]:t})),D=(0,I.jsxs)(`div`,{className:`space-y-3 px-1`,children:[(0,I.jsx)(Q,{label:`Name`,children:(0,I.jsx)(E,{value:a.name,onChange:e=>S(`name`,e.target.value),placeholder:`Morning PR review`,className:`h-11 md:h-9 text-xs`})}),(0,I.jsxs)(Q,{label:`Cron expression (local timezone)`,children:[(0,I.jsx)(E,{value:a.cron_expr,onChange:e=>S(`cron_expr`,e.target.value),placeholder:`0 7 * * *`,className:`h-11 md:h-9 text-xs font-mono`}),(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:x?`Next: ${x.join(` · `)}`:`—`})]}),(0,I.jsx)(Q,{label:`Project`,children:(0,I.jsxs)(j,{value:a.project_path,onValueChange:e=>S(`project_path`,e),children:[(0,I.jsx)(g,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(C,{placeholder:`Select project`})}),(0,I.jsx)(m,{children:c.map(e=>(0,I.jsx)(w,{value:e.path,children:e.name},e.path))})]})}),(0,I.jsx)(Q,{label:`Prompt (do not embed secrets)`,children:(0,I.jsx)(`textarea`,{value:a.prompt,onChange:e=>S(`prompt`,e.target.value),placeholder:`Check open PRs and summarize. If nothing to do, finish immediately.`,rows:4,className:`w-full rounded-md border border-input bg-transparent px-3 py-2 text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring/50 resize-y`})}),(0,I.jsxs)(Q,{label:`Permission mode`,children:[(0,I.jsxs)(j,{value:a.permission_mode,onValueChange:e=>S(`permission_mode`,e),children:[(0,I.jsx)(g,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(C,{})}),(0,I.jsx)(m,{children:le.map(e=>(0,I.jsx)(w,{value:e,children:e},e))})]}),a.permission_mode===`bypassPermissions`&&(0,I.jsx)(`p`,{className:`text-[11px] text-warning`,children:`⚠ Unattended writes — agent can modify code and run commands`})]}),(0,I.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,I.jsx)(Q,{label:`Max turns (optional)`,children:(0,I.jsx)(E,{type:`number`,min:1,value:a.max_turns,onChange:e=>S(`max_turns`,e.target.value),placeholder:`∞`,className:`h-11 md:h-9 text-xs`})}),(0,I.jsx)(Q,{label:`Timeout (ms)`,children:(0,I.jsx)(E,{type:`number`,min:1e4,value:a.timeout_ms,onChange:e=>S(`timeout_ms`,e.target.value),className:`h-11 md:h-9 text-xs`})})]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between min-h-11`,children:[(0,I.jsx)(`span`,{className:`text-xs font-medium`,children:`Enabled`}),(0,I.jsx)(T,{checked:a.enabled,onCheckedChange:e=>S(`enabled`,e)})]}),y&&(0,I.jsx)(`p`,{className:`text-[11px] text-error`,children:y}),(0,I.jsx)(d,{onClick:async()=>{if(!a.name.trim()||!a.project_path||!a.prompt.trim()){b(`Name, project, and prompt are required`);return}if(!x){b(`Invalid cron expression`);return}_(!0),b(null);try{let e={name:a.name.trim(),cron_expr:a.cron_expr,project_path:a.project_path,prompt:a.prompt,permission_mode:a.permission_mode,max_turns:a.max_turns===``?null:Number(a.max_turns),timeout_ms:Number(a.timeout_ms)||18e5,enabled:a.enabled};t?await s.patch(`/api/schedules/${t.id}`,e):await s.post(`/api/schedules`,e),r(),n()}catch(e){b(e instanceof Error?e.message:String(e))}finally{_(!1)}},disabled:h,className:`w-full min-h-11 cursor-pointer`,children:h?`Saving…`:t?`Save changes`:`Create schedule`})]}),O=t?`Edit: ${t.name}`:`New schedule`;return i?(0,I.jsxs)(f,{open:e,onClose:n,className:`max-h-[85vh] flex flex-col`,children:[(0,I.jsx)(`p`,{className:`text-sm font-semibold text-center pb-2`,children:O}),(0,I.jsx)(k,{className:`flex-1 min-h-0 px-3 pb-3`,children:D})]}):(0,I.jsx)(v,{open:e,onOpenChange:e=>!e&&n(),children:(0,I.jsxs)(te,{className:`max-w-md max-h-[85vh] overflow-y-auto`,children:[(0,I.jsx)(ee,{children:(0,I.jsx)(p,{className:`text-sm`,children:O})}),D]})})}function Q({label:e,children:t}){return(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:e}),t]})}function $(e){return{name:e?.name??``,cron_expr:e?.cron_expr??`0 7 * * *`,project_path:e?.project_path??``,prompt:e?.prompt??``,permission_mode:e?.permission_mode??`bypassPermissions`,max_turns:e?.max_turns==null?``:String(e.max_turns),timeout_ms:String(e?.timeout_ms??18e5),enabled:e?!!e.enabled:!0}}function de(){let{schedules:e,loading:t,refetch:n}=P(),[i,a]=(0,M.useState)(!1),[o,s]=(0,M.useState)(null),c=()=>{s(null),a(!0)},l=e=>{s(e),a(!0)};return(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Periodically wake Claude to work on a project unattended.`}),(0,I.jsxs)(d,{size:`sm`,onClick:c,className:`min-h-11 md:min-h-8 text-xs gap-1 cursor-pointer shrink-0`,children:[(0,I.jsx)(_,{className:`size-3.5`}),` Add`]})]}),t&&e.length===0?(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:`Loading…`}):e.length===0?(0,I.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,I.jsx)(r,{className:`size-8 text-muted-foreground/50`}),(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No schedules yet. Add one to run Claude periodically.`}),(0,I.jsxs)(d,{size:`sm`,onClick:c,className:`min-h-11 text-xs gap-1 cursor-pointer`,children:[(0,I.jsx)(_,{className:`size-3.5`}),` Add schedule`]})]}):(0,I.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,I.jsx)(ae,{schedule:e,onEdit:()=>l(e),onChanged:n},e.id))}),(0,I.jsx)(ue,{open:i,schedule:o,onClose:()=>a(!1),onSaved:n})]})}export{de as SchedulesSettingsSection};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/general-settings-section-
|
|
2
|
-
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import{t as r}from"./createLucideIcon-D8pyde1A.js";import{t as i}from"./arrow-left-CyFcsyzD.js";import{t as a}from"./bot-D6sx11y0.js";import{t as o}from"./calendar-clock-C1asT-gk.js";import{t as s}from"./chevron-right-De-Wz5Lz.js";import{t as c}from"./key-round-CQpDrDxg.js";import{t as l}from"./keyboard-DiOYrs6C.js";import{t as u}from"./loader-circle-DPMrnLQ2.js";import{q as d}from"./vendor-mermaid-BKWscKt0.js";import{n as f}from"./utils-C9OjCrou.js";import{t as p}from"./button-BZtEJcUv.js";import{$n as m,Hn as h,Mr as g,Nr as _,pr as v,q as y,qn as b}from"./index-B1bzKRjJ.js";import{t as x}from"./separator-DqGg3f9c.js";var S=r(`bell-ring`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M22 8c0-2.3-.8-4.3-2-6`,key:`5bb3ad`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}],[`path`,{d:`M4 2C2.8 3.7 2 5.7 2 8`,key:`tap9e0`}]]),C=r(`database-zap`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 15 21.84`,key:`14ibmq`}],[`path`,{d:`M21 5V8`,key:`1marbg`}],[`path`,{d:`M21 12L18 17H22L19 22`,key:`zafso`}],[`path`,{d:`M3 12A9 3 0 0 0 14.59 14.87`,key:`1y4wr8`}]]),w=r(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),T=[{id:`core`,label:null},{id:`ai`,label:`AI & Accounts`},{id:`integrations`,label:`Integrations`},{id:`advanced`,label:`Advanced`}],E=[{id:`general`,group:`core`,label:`General`,subtitle:`Device name, password, version`,icon:h},{id:`appearance`,group:`core`,label:`Appearance`,subtitle:`Theme, tabs, explorer skin`,icon:m},{id:`ai-provider`,group:`ai`,label:`AI Provider`,subtitle:`Model, execution mode, limits`,icon:a},{id:`accounts`,group:`ai`,label:`Accounts`,subtitle:`Claude and Codex sign-ins, rotation`,icon:c},{id:`ppmbot`,group:`integrations`,label:`PPMBot`,subtitle:`Telegram AI bot`,icon:_},{id:`notifications`,group:`integrations`,label:`Notifications`,subtitle:`Push & Telegram alerts`,icon:S},{id:`jira`,group:`integrations`,label:`Jira Watcher`,subtitle:`Auto-debug Jira tickets`,icon:g},{id:`extensions`,group:`integrations`,label:`Extensions`,subtitle:`Install and manage extensions`,icon:b},{id:`proxy`,group:`integrations`,label:`API Proxy`,subtitle:`Expose accounts as Anthropic API`,icon:v},{id:`schedules`,group:`advanced`,label:`Scheduled Agents`,subtitle:`Run Claude on a cron schedule`,icon:o},{id:`shortcuts`,group:`advanced`,label:`Keyboard Shortcuts`,subtitle:`Customize key bindings`,icon:l},{id:`files`,group:`advanced`,label:`File Filters`,subtitle:`Exclude patterns, ignore files`,icon:w},{id:`query-audit`,group:`advanced`,label:`Query Audit Log`,subtitle:`SQL history retention and size`,icon:C}];function D(e){return typeof e==`string`&&E.some(t=>t.id===e)}function O(e){return E.find(t=>t.id===e)}function k(e){return E.filter(t=>t.group===e)}var A=n();function j({active:e,onSelect:t}){return(0,A.jsx)(y,{className:`h-full`,children:(0,A.jsx)(`nav`,{className:`p-2 space-y-4`,"aria-label":`Settings categories`,children:T.map(n=>{let r=k(n.id);return r.length===0?null:(0,A.jsxs)(`div`,{className:`space-y-1`,children:[n.label&&(0,A.jsx)(`h3`,{className:`px-2 pt-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:n.label}),r.map(n=>{let r=n.icon,i=n.id===e;return(0,A.jsxs)(`button`,{onClick:()=>t(n.id),"data-testid":`settings-rail-${n.id}`,"aria-current":i?`page`:void 0,className:f(`w-full flex items-center gap-2.5 px-2.5 py-2 rounded-md text-left cursor-pointer transition-colors`,i?`bg-accent text-accent-foreground`:`hover:bg-accent/50 active:bg-accent`),children:[(0,A.jsx)(r,{className:f(`size-4 shrink-0`,i?`text-foreground`:`text-muted-foreground`)}),(0,A.jsx)(`span`,{className:`text-sm truncate`,children:n.label})]},n.id)})]},n.id)})})})}function M({onSelect:e}){return(0,A.jsx)(y,{className:`h-full`,children:(0,A.jsx)(`nav`,{className:`p-3 space-y-5`,"aria-label":`Settings categories`,children:T.map(t=>{let n=k(t.id);return n.length===0?null:(0,A.jsxs)(`div`,{className:`space-y-1`,children:[t.label&&(0,A.jsx)(`h3`,{className:`px-1 pb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:t.label}),n.map(t=>{let n=t.icon;return(0,A.jsxs)(`button`,{onClick:()=>e(t.id),"data-testid":`settings-index-${t.id}`,className:`w-full flex items-center gap-3 px-2.5 py-3 rounded-lg text-left cursor-pointer group hover:bg-accent/50 active:bg-accent transition-colors`,children:[(0,A.jsx)(`div`,{className:`size-10 rounded-md bg-muted flex items-center justify-center shrink-0 group-hover:bg-accent`,children:(0,A.jsx)(n,{className:`size-4 text-muted-foreground`})}),(0,A.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,A.jsx)(`p`,{className:`text-sm font-medium truncate`,children:t.label}),(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:t.subtitle})]}),(0,A.jsx)(s,{className:`size-4 text-muted-foreground shrink-0`})]},t.id)})]},t.id)})})})}var N=e(t(),1),P={general:(0,N.lazy)(()=>d(()=>import(`./general-settings-section-C1EJzjhU.js`).then(e=>({default:e.GeneralSettingsSection})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45]))),appearance:(0,N.lazy)(()=>d(()=>import(`./appearance-settings-section-vLmakLtA.js`).then(e=>({default:e.AppearanceSettingsSection})),__vite__mapDeps([46,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,47,45]))),"ai-provider":(0,N.lazy)(()=>d(()=>import(`./ai-settings-section-CmoBsSpY.js`).then(e=>({default:e.AISettingsSection})),__vite__mapDeps([48,4,1,5,27,29,28,49,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,30,31,32,33,34,35,36,37,38,39,40,41,42,43,50]))),accounts:(0,N.lazy)(()=>d(()=>import(`./accounts-settings-section-CCFQV-RB.js`).then(e=>({default:e.AccountsSettingsSection})),__vite__mapDeps([51,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,52,44,53,50]))),ppmbot:(0,N.lazy)(()=>d(()=>import(`./ppmbot-settings-section-Bq4YAcFW.js`).then(e=>({default:e.PPMBotSettingsSection})),__vite__mapDeps([54,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,55,56,45]))),notifications:(0,N.lazy)(()=>d(()=>import(`./notifications-settings-section-ARQlF-6E.js`).then(e=>({default:e.NotificationsSettingsSection})),__vite__mapDeps([57,2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,45]))),jira:(0,N.lazy)(()=>d(()=>import(`./jira-watcher-section-DZh-Z2MK.js`).then(e=>({default:e.JiraWatcherSection})),__vite__mapDeps([58,2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43]))),extensions:(0,N.lazy)(()=>d(()=>import(`./extension-manager-section-BpyGq15A.js`).then(e=>({default:e.ExtensionManagerSection})),__vite__mapDeps([59,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,60,61]))),proxy:(0,N.lazy)(()=>d(()=>import(`./proxy-settings-section-wRbiyQiA.js`).then(e=>({default:e.ProxySettingsSection})),__vite__mapDeps([62,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,52,50]))),schedules:(0,N.lazy)(()=>d(()=>import(`./schedules-settings-section-BOecKJzl.js`).then(e=>({default:e.SchedulesSettingsSection})),__vite__mapDeps([63,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,64,61]))),shortcuts:(0,N.lazy)(()=>d(()=>import(`./keyboard-shortcuts-section-JBtcJGM3.js`).then(e=>({default:e.KeyboardShortcutsSection})),__vite__mapDeps([65,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43]))),files:(0,N.lazy)(()=>d(()=>import(`./files-settings-section-B0_aR1nL.js`).then(e=>({default:e.FilesSettingsSection})),__vite__mapDeps([66,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,45]))),"query-audit":(0,N.lazy)(()=>d(()=>import(`./query-audit-section-C5RmhRSu.js`).then(e=>({default:e.QueryAuditSection})),__vite__mapDeps([67,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,50])))};function F({category:e}){let t=P[e];return(0,A.jsx)(N.Suspense,{fallback:(0,A.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,A.jsx)(u,{className:`size-5 animate-spin text-muted-foreground`})}),children:(0,A.jsx)(t,{})})}function I({initialCategory:e,onCategoryChange:t}){let[n,r]=(0,N.useState)(e??`general`),[a,o]=(0,N.useState)(e===void 0),s=O(n),c=s.icon;function l(e){r(e),o(!1),t?.(e)}return(0,A.jsx)(`div`,{className:`@container h-full w-full`,"data-testid":`settings-window`,"data-category":n,children:(0,A.jsxs)(`div`,{className:`h-full w-full flex`,children:[(0,A.jsx)(`aside`,{className:`hidden @[640px]:flex @[640px]:flex-col w-[210px] shrink-0 border-r border-border min-h-0`,"data-testid":`settings-rail`,children:(0,A.jsx)(j,{active:n,onSelect:l})}),(0,A.jsxs)(`div`,{className:`relative flex-1 min-w-0`,children:[(0,A.jsxs)(`div`,{className:`h-full flex flex-col min-h-0`,children:[(0,A.jsxs)(`div`,{className:`shrink-0 flex items-center gap-2 px-2 py-2.5 @[640px]:px-4`,children:[(0,A.jsx)(p,{variant:`ghost`,size:`icon`,"aria-label":`Back to settings list`,className:`size-9 shrink-0 cursor-pointer @[640px]:hidden`,onClick:()=>o(!0),children:(0,A.jsx)(i,{className:`size-4`})}),(0,A.jsx)(c,{className:`size-4 text-muted-foreground shrink-0`}),(0,A.jsx)(`h2`,{className:`text-sm font-semibold truncate`,"data-testid":`settings-pane-title`,children:s.label})]}),(0,A.jsx)(x,{}),(0,A.jsx)(y,{className:`flex-1 min-h-0`,children:(0,A.jsx)(`div`,{className:`p-4 pb-8`,children:(0,A.jsx)(F,{category:n})})})]}),a&&(0,A.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background flex flex-col min-h-0 @[640px]:hidden`,"data-testid":`settings-index`,children:[(0,A.jsx)(`div`,{className:`shrink-0 px-4 py-3`,children:(0,A.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Settings`})}),(0,A.jsx)(x,{}),(0,A.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,A.jsx)(M,{onSelect:l})})]})]})]})})}export{D as n,I as t};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/general-settings-section-CFDRUc2E.js","assets/rolldown-runtime-FhOqtrmT.js","assets/index-LEL-8oU_.js","assets/vendor-mermaid-BKWscKt0.js","assets/vendor-ui-CaeeFO0B.js","assets/vendor-markdown-Ls5AcU91.js","assets/button-BZtEJcUv.js","assets/utils-C9OjCrou.js","assets/createLucideIcon-D8pyde1A.js","assets/arrow-left-CyFcsyzD.js","assets/bot-D6sx11y0.js","assets/check-DN75Ucvz.js","assets/chevron-down-Dp0rpHb8.js","assets/chevron-right-De-Wz5Lz.js","assets/chevron-up-8PbsNiJp.js","assets/circle-BCy0AUCo.js","assets/clock-C1CQUQPZ.js","assets/sparkles-Dh-_J2Rd.js","assets/copy-BewHj66E.js","assets/database-Y3ESDK4-.js","assets/download-DG3_9xXy.js","assets/use-coarse-long-press-BmI_GVW5.js","assets/eye-off-GjXVuAOn.js","assets/eye-gWwaF4Lg.js","assets/loader-circle-DPMrnLQ2.js","assets/monitor-C835ucWH.js","assets/x-YDu4m2Iq.js","assets/api-client-oY1tC3tM.js","assets/react-X4jUntEf.js","assets/window-store-DGKf9rPG.js","assets/window-pip-registry-BEN0QNSW.js","assets/panel-store-BRrnDO_i.js","assets/context-menu-C13b1uT3.js","assets/portal-container-context-a399Hd9F.js","assets/mobile-bottom-sheet-BD5b7KJF.js","assets/use-visual-viewport-rnvuooQZ.js","assets/use-is-mobile-CYW3FJFE.js","assets/project-store-BuY7rxn_.js","assets/ws-auth-Dawx17PM.js","assets/settings-store-Brjd0QnO.js","assets/tab-store-PZsP5ZwG.js","assets/apply-theme-DxTXOAcV.js","assets/resolve-theme-DQk_YcsT.js","assets/index-nP3uxXvR.css","assets/key-round-CQpDrDxg.js","assets/separator-DqGg3f9c.js","assets/appearance-settings-section-CvX5XncT.js","assets/text-wrap-oiekm5SB.js","assets/ai-settings-section-Bc91w0K4.js","assets/ai-settings-section-edmjpNtG.js","assets/api-settings-CTMdz_VF.js","assets/accounts-settings-section-DGsB-ynw.js","assets/flask-conical-tp8gyZGh.js","assets/use-accounts-data-B8ltBkBj.js","assets/ppmbot-settings-section-Dy1CBG9d.js","assets/brain-KDa9jFRq.js","assets/send-Bb0jtcR6.js","assets/notifications-settings-section--zzeoLfi.js","assets/jira-watcher-section-DznCP9IR.js","assets/extension-manager-section-Cepy9w0W.js","assets/folder-symlink-fQRoG_rV.js","assets/power-CriQkeK5.js","assets/proxy-settings-section-COr2LOQV.js","assets/schedules-settings-section-f6VP9Mde.js","assets/calendar-clock-C1asT-gk.js","assets/keyboard-shortcuts-section-C-BeYTwO.js","assets/files-settings-section-A_5QWv4b.js","assets/query-audit-section-CShd9Vo1.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import{t as r}from"./createLucideIcon-D8pyde1A.js";import{t as i}from"./arrow-left-CyFcsyzD.js";import{t as a}from"./bot-D6sx11y0.js";import{t as o}from"./calendar-clock-C1asT-gk.js";import{t as s}from"./chevron-right-De-Wz5Lz.js";import{t as c}from"./key-round-CQpDrDxg.js";import{t as l}from"./keyboard-DiOYrs6C.js";import{t as u}from"./loader-circle-DPMrnLQ2.js";import{q as d}from"./vendor-mermaid-BKWscKt0.js";import{n as f}from"./utils-C9OjCrou.js";import{t as p}from"./button-BZtEJcUv.js";import{$n as m,Hn as h,Mr as g,Nr as _,pr as v,q as y,qn as b}from"./index-LEL-8oU_.js";import{t as x}from"./separator-DqGg3f9c.js";var S=r(`bell-ring`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M22 8c0-2.3-.8-4.3-2-6`,key:`5bb3ad`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}],[`path`,{d:`M4 2C2.8 3.7 2 5.7 2 8`,key:`tap9e0`}]]),C=r(`database-zap`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 15 21.84`,key:`14ibmq`}],[`path`,{d:`M21 5V8`,key:`1marbg`}],[`path`,{d:`M21 12L18 17H22L19 22`,key:`zafso`}],[`path`,{d:`M3 12A9 3 0 0 0 14.59 14.87`,key:`1y4wr8`}]]),w=r(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),T=[{id:`core`,label:null},{id:`ai`,label:`AI & Accounts`},{id:`integrations`,label:`Integrations`},{id:`advanced`,label:`Advanced`}],E=[{id:`general`,group:`core`,label:`General`,subtitle:`Device name, password, version`,icon:h},{id:`appearance`,group:`core`,label:`Appearance`,subtitle:`Theme, tabs, explorer skin`,icon:m},{id:`ai-provider`,group:`ai`,label:`AI Provider`,subtitle:`Model, execution mode, limits`,icon:a},{id:`accounts`,group:`ai`,label:`Accounts`,subtitle:`Claude and Codex sign-ins, rotation`,icon:c},{id:`ppmbot`,group:`integrations`,label:`PPMBot`,subtitle:`Telegram AI bot`,icon:_},{id:`notifications`,group:`integrations`,label:`Notifications`,subtitle:`Push & Telegram alerts`,icon:S},{id:`jira`,group:`integrations`,label:`Jira Watcher`,subtitle:`Auto-debug Jira tickets`,icon:g},{id:`extensions`,group:`integrations`,label:`Extensions`,subtitle:`Install and manage extensions`,icon:b},{id:`proxy`,group:`integrations`,label:`API Proxy`,subtitle:`Expose accounts as Anthropic API`,icon:v},{id:`schedules`,group:`advanced`,label:`Scheduled Agents`,subtitle:`Run Claude on a cron schedule`,icon:o},{id:`shortcuts`,group:`advanced`,label:`Keyboard Shortcuts`,subtitle:`Customize key bindings`,icon:l},{id:`files`,group:`advanced`,label:`File Filters`,subtitle:`Exclude patterns, ignore files`,icon:w},{id:`query-audit`,group:`advanced`,label:`Query Audit Log`,subtitle:`SQL history retention and size`,icon:C}];function D(e){return typeof e==`string`&&E.some(t=>t.id===e)}function O(e){return E.find(t=>t.id===e)}function k(e){return E.filter(t=>t.group===e)}var A=n();function j({active:e,onSelect:t}){return(0,A.jsx)(y,{className:`h-full`,children:(0,A.jsx)(`nav`,{className:`p-2 space-y-4`,"aria-label":`Settings categories`,children:T.map(n=>{let r=k(n.id);return r.length===0?null:(0,A.jsxs)(`div`,{className:`space-y-1`,children:[n.label&&(0,A.jsx)(`h3`,{className:`px-2 pt-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:n.label}),r.map(n=>{let r=n.icon,i=n.id===e;return(0,A.jsxs)(`button`,{onClick:()=>t(n.id),"data-testid":`settings-rail-${n.id}`,"aria-current":i?`page`:void 0,className:f(`w-full flex items-center gap-2.5 px-2.5 py-2 rounded-md text-left cursor-pointer transition-colors`,i?`bg-accent text-accent-foreground`:`hover:bg-accent/50 active:bg-accent`),children:[(0,A.jsx)(r,{className:f(`size-4 shrink-0`,i?`text-foreground`:`text-muted-foreground`)}),(0,A.jsx)(`span`,{className:`text-sm truncate`,children:n.label})]},n.id)})]},n.id)})})})}function M({onSelect:e}){return(0,A.jsx)(y,{className:`h-full`,children:(0,A.jsx)(`nav`,{className:`p-3 space-y-5`,"aria-label":`Settings categories`,children:T.map(t=>{let n=k(t.id);return n.length===0?null:(0,A.jsxs)(`div`,{className:`space-y-1`,children:[t.label&&(0,A.jsx)(`h3`,{className:`px-1 pb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:t.label}),n.map(t=>{let n=t.icon;return(0,A.jsxs)(`button`,{onClick:()=>e(t.id),"data-testid":`settings-index-${t.id}`,className:`w-full flex items-center gap-3 px-2.5 py-3 rounded-lg text-left cursor-pointer group hover:bg-accent/50 active:bg-accent transition-colors`,children:[(0,A.jsx)(`div`,{className:`size-10 rounded-md bg-muted flex items-center justify-center shrink-0 group-hover:bg-accent`,children:(0,A.jsx)(n,{className:`size-4 text-muted-foreground`})}),(0,A.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,A.jsx)(`p`,{className:`text-sm font-medium truncate`,children:t.label}),(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:t.subtitle})]}),(0,A.jsx)(s,{className:`size-4 text-muted-foreground shrink-0`})]},t.id)})]},t.id)})})})}var N=e(t(),1),P={general:(0,N.lazy)(()=>d(()=>import(`./general-settings-section-CFDRUc2E.js`).then(e=>({default:e.GeneralSettingsSection})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45]))),appearance:(0,N.lazy)(()=>d(()=>import(`./appearance-settings-section-CvX5XncT.js`).then(e=>({default:e.AppearanceSettingsSection})),__vite__mapDeps([46,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,47,45]))),"ai-provider":(0,N.lazy)(()=>d(()=>import(`./ai-settings-section-Bc91w0K4.js`).then(e=>({default:e.AISettingsSection})),__vite__mapDeps([48,4,1,5,27,29,28,49,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,30,31,32,33,34,35,36,37,38,39,40,41,42,43,50]))),accounts:(0,N.lazy)(()=>d(()=>import(`./accounts-settings-section-DGsB-ynw.js`).then(e=>({default:e.AccountsSettingsSection})),__vite__mapDeps([51,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,52,44,53,50]))),ppmbot:(0,N.lazy)(()=>d(()=>import(`./ppmbot-settings-section-Dy1CBG9d.js`).then(e=>({default:e.PPMBotSettingsSection})),__vite__mapDeps([54,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,55,56,45]))),notifications:(0,N.lazy)(()=>d(()=>import(`./notifications-settings-section--zzeoLfi.js`).then(e=>({default:e.NotificationsSettingsSection})),__vite__mapDeps([57,2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,45]))),jira:(0,N.lazy)(()=>d(()=>import(`./jira-watcher-section-DznCP9IR.js`).then(e=>({default:e.JiraWatcherSection})),__vite__mapDeps([58,2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43]))),extensions:(0,N.lazy)(()=>d(()=>import(`./extension-manager-section-Cepy9w0W.js`).then(e=>({default:e.ExtensionManagerSection})),__vite__mapDeps([59,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,60,61]))),proxy:(0,N.lazy)(()=>d(()=>import(`./proxy-settings-section-COr2LOQV.js`).then(e=>({default:e.ProxySettingsSection})),__vite__mapDeps([62,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,52,50]))),schedules:(0,N.lazy)(()=>d(()=>import(`./schedules-settings-section-f6VP9Mde.js`).then(e=>({default:e.SchedulesSettingsSection})),__vite__mapDeps([63,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,64,61]))),shortcuts:(0,N.lazy)(()=>d(()=>import(`./keyboard-shortcuts-section-C-BeYTwO.js`).then(e=>({default:e.KeyboardShortcutsSection})),__vite__mapDeps([65,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43]))),files:(0,N.lazy)(()=>d(()=>import(`./files-settings-section-A_5QWv4b.js`).then(e=>({default:e.FilesSettingsSection})),__vite__mapDeps([66,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,45]))),"query-audit":(0,N.lazy)(()=>d(()=>import(`./query-audit-section-CShd9Vo1.js`).then(e=>({default:e.QueryAuditSection})),__vite__mapDeps([67,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,50])))};function F({category:e}){let t=P[e];return(0,A.jsx)(N.Suspense,{fallback:(0,A.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,A.jsx)(u,{className:`size-5 animate-spin text-muted-foreground`})}),children:(0,A.jsx)(t,{})})}function I({initialCategory:e,onCategoryChange:t}){let[n,r]=(0,N.useState)(e??`general`),[a,o]=(0,N.useState)(e===void 0),s=O(n),c=s.icon;function l(e){r(e),o(!1),t?.(e)}return(0,A.jsx)(`div`,{className:`@container h-full w-full`,"data-testid":`settings-window`,"data-category":n,children:(0,A.jsxs)(`div`,{className:`h-full w-full flex`,children:[(0,A.jsx)(`aside`,{className:`hidden @[640px]:flex @[640px]:flex-col w-[210px] shrink-0 border-r border-border min-h-0`,"data-testid":`settings-rail`,children:(0,A.jsx)(j,{active:n,onSelect:l})}),(0,A.jsxs)(`div`,{className:`relative flex-1 min-w-0`,children:[(0,A.jsxs)(`div`,{className:`h-full flex flex-col min-h-0`,children:[(0,A.jsxs)(`div`,{className:`shrink-0 flex items-center gap-2 px-2 py-2.5 @[640px]:px-4`,children:[(0,A.jsx)(p,{variant:`ghost`,size:`icon`,"aria-label":`Back to settings list`,className:`size-9 shrink-0 cursor-pointer @[640px]:hidden`,onClick:()=>o(!0),children:(0,A.jsx)(i,{className:`size-4`})}),(0,A.jsx)(c,{className:`size-4 text-muted-foreground shrink-0`}),(0,A.jsx)(`h2`,{className:`text-sm font-semibold truncate`,"data-testid":`settings-pane-title`,children:s.label})]}),(0,A.jsx)(x,{}),(0,A.jsx)(y,{className:`flex-1 min-h-0`,children:(0,A.jsx)(`div`,{className:`p-4 pb-8`,children:(0,A.jsx)(F,{category:n})})})]}),a&&(0,A.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background flex flex-col min-h-0 @[640px]:hidden`,"data-testid":`settings-index`,children:[(0,A.jsx)(`div`,{className:`shrink-0 px-4 py-3`,children:(0,A.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Settings`})}),(0,A.jsx)(x,{}),(0,A.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,A.jsx)(M,{onSelect:l})})]})]})]})})}export{D as n,I as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{x as e}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{n as t,t as n}from"./settings-body-
|
|
1
|
+
import{x as e}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{n as t,t as n}from"./settings-body-BRJapYD0.js";import"./vendor-mermaid-BKWscKt0.js";import"./button-BZtEJcUv.js";import"./separator-DqGg3f9c.js";var r=e(),i=({metadata:e})=>(0,r.jsx)(n,{initialCategory:t(e?.category)?e.category:void 0});export{i as SettingsTab};
|
package/dist/web/assets/{settings-window-content-Dvhxo4_H.js → settings-window-content-CUrGhhKI.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{x as e}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{n as t,t as n}from"./settings-body-
|
|
1
|
+
import{x as e}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{n as t,t as n}from"./settings-body-BRJapYD0.js";import"./vendor-mermaid-BKWscKt0.js";import{t as r}from"./window-store-DGKf9rPG.js";import"./button-BZtEJcUv.js";import"./separator-DqGg3f9c.js";var i=e();function a({id:e,payload:a}){let o=r(e=>e.setPayload);return(0,i.jsx)(n,{initialCategory:t(a?.category)?a.category:void 0,onCategoryChange:t=>o(e,{category:t})})}export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import{a as r,i,r as a}from"./glide-data-grid-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import{a as r,i,r as a}from"./glide-data-grid-Ch5Ap1WP.js";import{o}from"./index-LEL-8oU_.js";import{t as s}from"./use-monaco-theme-2YgX5HEz.js";var c=e(t(),1),l=n();function u({onExecute:e,loading:t,defaultValue:n=`SELECT * FROM `,schemaInfo:u,onSqlChange:d,persistedSql:f}){let[p,m]=(0,c.useState)(()=>f??n),h=(0,c.useRef)(!!f),g=(0,c.useRef)(null),_=(0,c.useRef)(null),v=(0,c.useRef)(null),y=(0,c.useRef)(e);y.current=e;let b=s();(0,c.useEffect)(()=>{if(!(!_.current||!u))return v.current?.dispose(),a(),v.current=_.current.languages.registerCompletionItemProvider(`sql`,i(_.current,u)),()=>{v.current?.dispose()}},[u]);let x=(0,c.useCallback)((e,t)=>{g.current=e,_.current=t,e.addAction({id:`run-query-at-cursor`,label:`Run Statement at Cursor`,keybindings:[t.KeyMod.CtrlCmd|t.KeyCode.Enter],run:e=>{let t=e.getPosition();if(!t)return;let n=r(e.getValue(),t.lineNumber);n&&y.current(n)}}),u&&(v.current?.dispose(),v.current=t.languages.registerCompletionItemProvider(`sql`,i(t,u)))},[u]);return(0,c.useEffect)(()=>{h.current||m(n)},[n]),(0,l.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,l.jsx)(o,{height:`100%`,language:`sql`,theme:b,value:p,onChange:e=>{let t=e??``;m(t),h.current=!0,d?.(t)},onMount:x,options:{minimap:{enabled:!1},lineNumbers:`off`,scrollBeyondLastLine:!1,wordWrap:`on`,fontSize:12,tabSize:2,renderLineHighlight:`none`,overviewRulerLanes:0,hideCursorInOverviewRuler:!0,scrollbar:{vertical:`auto`,horizontal:`auto`,verticalScrollbarSize:6,horizontalScrollbarSize:6},padding:{top:4,bottom:4},lineDecorationsWidth:4,lineNumbersMinChars:0,glyphMargin:!1,folding:!1,fixedOverflowWidgets:!0}})})}export{u as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./database-Y3ESDK4-.js";import{t as i}from"./glide-data-grid-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./database-Y3ESDK4-.js";import{t as i}from"./glide-data-grid-Ch5Ap1WP.js";import{t as a}from"./loader-circle-DPMrnLQ2.js";import{t as o}from"./table-CRJsmfeg.js";import{i as s,n as c,s as l}from"./api-client-oY1tC3tM.js";import"./vendor-mermaid-BKWscKt0.js";import"./settings-store-Brjd0QnO.js";import"./panel-store-BRrnDO_i.js";import"./window-store-DGKf9rPG.js";import"./tab-store-PZsP5ZwG.js";import{Kn as u,Or as d}from"./index-LEL-8oU_.js";import"./data-grid-types-CdAg-4W1.js";import"./use-monaco-theme-2YgX5HEz.js";import{t as f}from"./sql-query-editor-DxS_r9dM.js";var p=e(t(),1);function m(e,t,n){let[r,i]=(0,p.useState)([]),[a,o]=(0,p.useState)(null),[u,d]=(0,p.useState)(null),[f,m]=(0,p.useState)([]),[h,g]=(0,p.useState)(!1),[_,v]=(0,p.useState)(null),[y,b]=(0,p.useState)(1),[x,S]=(0,p.useState)(null),[C,w]=(0,p.useState)(null),[T,E]=(0,p.useState)(!1),D=n?`/api/db/connections/${n}`:null,O=!n&&!e&&/^(\/|[A-Za-z]:[/\\])/.test(t),k=D??(O?`/api/fs/sqlite`:`${s(e)}/sqlite`),A=D?``:`path=${encodeURIComponent(t)}`,j=(0,p.useCallback)(async()=>{g(!0),v(null);try{let e=D?`?cached=1`:A?`?${A}`:``,t=await c.get(`${k}/tables${e}`);i(t),!D&&t.length>0&&!a&&o(t[0].name)}catch(e){v(e.message)}finally{g(!1)}},[k,A,D]);(0,p.useEffect)(()=>{j()},[j]);let M=(0,p.useCallback)(async()=>{if(a){g(!0);try{let e=A?`${A}&`:``,[t,n]=await Promise.all([c.get(`${k}/data?${e}table=${encodeURIComponent(a)}&page=${y}&limit=100`),c.get(`${k}/schema?${e}table=${encodeURIComponent(a)}`)]);d(t),m(n)}catch(e){v(e.message)}finally{g(!1)}}},[k,A,a,y]);(0,p.useEffect)(()=>{M()},[M]);let N=(0,p.useCallback)(e=>{o(e),b(1),S(null)},[]),P=(0,p.useCallback)(async e=>{E(!0),w(null);try{let n=D?{sql:e}:{path:t,sql:e},r=await c.post(`${k}/query`,n);S(r),r.changeType===`modify`&&M()}catch(e){w(e.message)}finally{E(!1)}},[k,D,t,M]),F=(0,p.useCallback)((e,t)=>{let n=t.message;v(n),l.error(`${e} failed`,{description:n})},[]);return{tables:r,selectedTable:a,selectTable:N,tableData:u,schema:f,loading:h,error:_,page:y,setPage:b,queryResult:x,queryError:C,queryLoading:T,executeQuery:P,updateCell:(0,p.useCallback)(async(e,n,r)=>{if(a)try{D?await c.put(`${k}/cell`,{table:a,pkColumn:`rowid`,pkValue:e,column:n,value:r}):await c.put(`${k}/cell`,{path:t,table:a,rowid:e,column:n,value:r}),M()}catch(e){F(`Update cell`,e)}},[k,D,t,a,M,F]),deleteRow:(0,p.useCallback)(async e=>{if(a)try{D?await c.del(`${k}/row`,{table:a,pkColumn:`rowid`,pkValue:e}):await c.del(`${k}/row`,{path:t,table:a,rowid:e}),M(),j()}catch(e){F(`Delete row`,e)}},[k,D,t,a,M,j,F]),refreshTables:j,refreshData:M}}var h=n();function g({tables:e,selectedTable:t,onSelect:n,onRefresh:r}){return(0,h.jsxs)(`div`,{className:`w-48 shrink-0 flex flex-col bg-background overflow-hidden`,children:[(0,h.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[(0,h.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Tables`}),(0,h.jsx)(`button`,{type:`button`,onClick:r,className:`text-muted-foreground hover:text-foreground transition-colors`,title:`Refresh tables`,children:(0,h.jsx)(u,{className:`size-3`})})]}),(0,h.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[e.map(e=>(0,h.jsxs)(`button`,{type:`button`,onClick:()=>n(e.name),className:`w-full flex items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors ${t===e.name?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/50 hover:text-foreground`}`,children:[(0,h.jsx)(o,{className:`size-3 shrink-0`}),(0,h.jsx)(`span`,{className:`truncate flex-1`,children:e.name}),(0,h.jsx)(`span`,{className:`text-[10px] opacity-60`,children:e.rowCount})]},e.name)),e.length===0&&(0,h.jsx)(`p`,{className:`px-3 py-4 text-xs text-muted-foreground text-center`,children:`No tables found`})]})]})}function _({onExecute:e,loading:t}){return(0,h.jsx)(f,{onExecute:e,loading:t})}function v({metadata:e}){let t=e?.filePath,n=e?.projectName,i=e?.connectionId,a=e?.tableName,[o,s]=(0,p.useState)(!1);if(i)return(0,h.jsx)(y,{projectName:``,dbPath:``,connectionId:i,connectionName:e?.connectionName,initialTable:a,queryPanelOpen:o,onToggleQueryPanel:()=>s(e=>!e),hideTableList:!0});let c=!!t&&!n&&/^(\/|[A-Za-z]:[/\\])/.test(t);return!t||!n&&!c?(0,h.jsxs)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:[(0,h.jsx)(r,{className:`size-5 mr-2`}),` No database file selected.`]}):(0,h.jsx)(y,{projectName:n??``,dbPath:t,queryPanelOpen:o,onToggleQueryPanel:()=>s(e=>!e)})}function y({projectName:e,dbPath:t,connectionId:n,connectionName:o,initialTable:s,queryPanelOpen:c,onToggleQueryPanel:l,hideTableList:u}){let f=m(e,t,n),v=(0,p.useRef)(!1);return(0,p.useEffect)(()=>{s&&!v.current&&f.tables.length>0&&(v.current=!0,f.selectTable(s))},[s,f.tables]),f.error&&f.tables.length===0?(0,h.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,h.jsx)(d,{className:`size-10 text-destructive`}),(0,h.jsx)(`p`,{className:`text-sm`,children:f.error})]}):f.loading&&f.tables.length===0?(0,h.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-text-secondary`,children:[(0,h.jsx)(a,{className:`size-5 animate-spin`}),(0,h.jsx)(`span`,{className:`text-sm`,children:`Loading database...`})]}):(0,h.jsxs)(`div`,{className:`flex h-full w-full overflow-hidden`,children:[!u&&(0,h.jsx)(g,{tables:f.tables,selectedTable:f.selectedTable,onSelect:f.selectTable,onRefresh:f.refreshTables}),(0,h.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden ${u?``:`border-l border-border`}`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border bg-background shrink-0`,children:[(0,h.jsx)(r,{className:`size-3.5 text-muted-foreground`}),(0,h.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:o??t}),(0,h.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:f.selectedTable&&`/ ${f.selectedTable}`}),(0,h.jsx)(`div`,{className:`ml-auto`,children:(0,h.jsx)(`button`,{type:`button`,onClick:l,className:`px-2 py-1 rounded text-xs transition-colors ${c?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:`SQL`})})]}),(0,h.jsx)(`div`,{className:`flex-1 overflow-hidden ${c?`max-h-[60%]`:``}`,children:f.tableData?(0,h.jsx)(i,{columns:f.tableData.columns,rows:f.tableData.rows,total:f.tableData.total,limit:f.tableData.limit,schema:f.schema.map(e=>({name:e.name,type:e.type,nullable:!e.notnull,pk:!!e.pk,defaultValue:e.dflt_value,fk:e.fk??null})),loading:f.loading,page:f.page,onPageChange:f.setPage,onCellUpdate:(e,t,n,r)=>f.updateCell(t,n,r),onRowDelete:(e,t)=>f.deleteRow(t)}):(0,h.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:f.loading?(0,h.jsx)(a,{className:`size-4 animate-spin`}):`Select a table`})}),c&&(0,h.jsx)(`div`,{className:`border-t border-border h-[40%] shrink-0`,children:(0,h.jsx)(_,{onExecute:f.executeQuery,loading:f.queryLoading})})]})]})}export{v as SqliteViewer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/overview-panel-mhN0qw6Q.js","assets/rolldown-runtime-FhOqtrmT.js","assets/vendor-markdown-Ls5AcU91.js","assets/utils-C9OjCrou.js","assets/format-bytes-CKXk9k2d.js","assets/process-table-
|
|
2
|
-
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import{t as r}from"./createLucideIcon-D8pyde1A.js";import{q as i}from"./vendor-mermaid-BKWscKt0.js";import{n as a}from"./utils-C9OjCrou.js";import{g as o,kn as s}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/overview-panel-mhN0qw6Q.js","assets/rolldown-runtime-FhOqtrmT.js","assets/vendor-markdown-Ls5AcU91.js","assets/utils-C9OjCrou.js","assets/format-bytes-CKXk9k2d.js","assets/process-table-DSLrAJC5.js","assets/index-LEL-8oU_.js","assets/vendor-mermaid-BKWscKt0.js","assets/vendor-ui-CaeeFO0B.js","assets/button-BZtEJcUv.js","assets/createLucideIcon-D8pyde1A.js","assets/arrow-left-CyFcsyzD.js","assets/bot-D6sx11y0.js","assets/check-DN75Ucvz.js","assets/chevron-down-Dp0rpHb8.js","assets/chevron-right-De-Wz5Lz.js","assets/chevron-up-8PbsNiJp.js","assets/circle-BCy0AUCo.js","assets/clock-C1CQUQPZ.js","assets/sparkles-Dh-_J2Rd.js","assets/copy-BewHj66E.js","assets/database-Y3ESDK4-.js","assets/download-DG3_9xXy.js","assets/use-coarse-long-press-BmI_GVW5.js","assets/eye-off-GjXVuAOn.js","assets/eye-gWwaF4Lg.js","assets/loader-circle-DPMrnLQ2.js","assets/monitor-C835ucWH.js","assets/x-YDu4m2Iq.js","assets/api-client-oY1tC3tM.js","assets/react-X4jUntEf.js","assets/window-store-DGKf9rPG.js","assets/window-pip-registry-BEN0QNSW.js","assets/panel-store-BRrnDO_i.js","assets/context-menu-C13b1uT3.js","assets/portal-container-context-a399Hd9F.js","assets/mobile-bottom-sheet-BD5b7KJF.js","assets/use-visual-viewport-rnvuooQZ.js","assets/use-is-mobile-CYW3FJFE.js","assets/project-store-BuY7rxn_.js","assets/ws-auth-Dawx17PM.js","assets/settings-store-Brjd0QnO.js","assets/tab-store-PZsP5ZwG.js","assets/apply-theme-DxTXOAcV.js","assets/resolve-theme-DQk_YcsT.js","assets/index-nP3uxXvR.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import{t as r}from"./createLucideIcon-D8pyde1A.js";import{q as i}from"./vendor-mermaid-BKWscKt0.js";import{n as a}from"./utils-C9OjCrou.js";import{g as o,kn as s}from"./index-LEL-8oU_.js";var c=r(`wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),l=e(t(),1),u=n(),d=(0,l.lazy)(()=>i(()=>import(`./overview-panel-mhN0qw6Q.js`).then(e=>({default:e.OverviewPanel})),__vite__mapDeps([0,1,2,3,4]))),f=(0,l.lazy)(()=>i(()=>import(`./process-table-DSLrAJC5.js`).then(e=>({default:e.ProcessTable})),__vite__mapDeps([5,1,6,7,8,2,9,3,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,4])));function p({isConnected:e,elapsed:t,tickCount:n}){return(0,u.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-text-subtle`,"data-testid":`sysmon-connection`,"data-tick-count":n,children:[e?(0,u.jsx)(c,{className:`size-3 text-success`}):(0,u.jsx)(s,{className:`size-3 text-error`}),(0,u.jsx)(`span`,{children:e?`Updated ${t}s ago`:`Disconnected`})]})}var m=(0,l.memo)(function({initialTab:e=`overview`,onTabChange:t,variant:n=`tab`}){let{latest:r,history:i,isConnected:s,tickCount:c}=o({processes:!0}),[m,h]=(0,l.useState)(e),g=e=>{h(e),t?.(e)},_=r?Math.round((Date.now()-r.ts)/1e3):0,v=r?.warnings??[];return(0,u.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden`,"data-testid":`system-monitor-window`,children:[n===`tab`&&(0,u.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border shrink-0`,children:[(0,u.jsx)(`h2`,{className:`text-sm font-medium`,children:`System Monitor`}),(0,u.jsx)(p,{isConnected:s,elapsed:_,tickCount:c})]}),v.length>0&&(0,u.jsx)(`div`,{className:`px-3 py-1.5 text-[11px] text-warning bg-warning/10 border-b border-border shrink-0 space-y-0.5`,"data-testid":`sysmon-warnings`,children:v.map((e,t)=>(0,u.jsx)(`div`,{children:e},t))}),(0,u.jsxs)(`div`,{className:`flex items-center border-b border-border shrink-0`,role:`tablist`,children:[(0,u.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":m===`overview`,"data-testid":`sysmon-tab-overview`,onClick:()=>g(`overview`),className:a(`flex-1 md:flex-none min-h-11 px-4 text-sm font-medium transition-colors`,m===`overview`?`text-text-primary border-b-2 border-primary -mb-px`:`text-text-subtle hover:text-text-secondary`),children:`Overview`}),(0,u.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":m===`processes`,"data-testid":`sysmon-tab-processes`,onClick:()=>g(`processes`),className:a(`flex-1 md:flex-none min-h-11 px-4 text-sm font-medium transition-colors`,m===`processes`?`text-text-primary border-b-2 border-primary -mb-px`:`text-text-subtle hover:text-text-secondary`),children:`Processes`}),n===`window`&&(0,u.jsx)(`div`,{className:`ml-auto pr-3`,children:(0,u.jsx)(p,{isConnected:s,elapsed:_,tickCount:c})})]}),(0,u.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:(0,u.jsx)(l.Suspense,{fallback:(0,u.jsx)(`div`,{className:`p-4 text-xs text-text-subtle`,children:`Loading…`}),children:r?m===`overview`?(0,u.jsx)(d,{system:r.system,history:i}):(0,u.jsx)(f,{snapshot:r}):(0,u.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-subtle text-sm p-4`,children:s?`Waiting for data…`:`Connecting to resource monitor…`})})})]})});export{m as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{x as e}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t}from"./system-monitor-body-
|
|
1
|
+
import{x as e}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t}from"./system-monitor-body-CdWv_LBB.js";import"./api-client-oY1tC3tM.js";import"./vendor-mermaid-BKWscKt0.js";var n=e(),r=()=>(0,n.jsx)(t,{});export{r as SystemMonitorTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{x as e}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t}from"./system-monitor-body-
|
|
1
|
+
import{x as e}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t}from"./system-monitor-body-CdWv_LBB.js";import"./api-client-oY1tC3tM.js";import"./vendor-mermaid-BKWscKt0.js";import{t as n}from"./window-store-DGKf9rPG.js";var r=e();function i({id:e,payload:i}){let a=n(e=>e.setPayload);return(0,r.jsx)(t,{initialTab:i?.tab===`processes`?`processes`:`overview`,onTabChange:t=>a(e,{tab:t}),variant:`window`})}export{i as default};
|
package/dist/web/assets/{tab-host-window-content-BSP1SEXS.js → tab-host-window-content-2gwUy-OA.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import"./vendor-mermaid-BKWscKt0.js";import"./portal-container-context-a399Hd9F.js";import{p as r,t as i}from"./panel-store-BRrnDO_i.js";import"./window-store-DGKf9rPG.js";import"./use-is-mobile-CYW3FJFE.js";import"./window-pip-registry-BEN0QNSW.js";import{qt as a}from"./index-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import"./vendor-mermaid-BKWscKt0.js";import"./portal-container-context-a399Hd9F.js";import{p as r,t as i}from"./panel-store-BRrnDO_i.js";import"./window-store-DGKf9rPG.js";import"./use-is-mobile-CYW3FJFE.js";import"./window-pip-registry-BEN0QNSW.js";import{qt as a}from"./index-LEL-8oU_.js";var o=e(t(),1),s=n();function c({id:e,payload:t}){let n=r(e),c=(i(e=>e.panels[n])?.tabs.length??0)>0,l=(0,o.useRef)(!1);c&&(l.current=!0);let u=typeof t?.originPanelId==`string`?t.originPanelId:null,d=(0,o.useRef)(u);d.current=u;let f=(0,o.useCallback)(e=>a(n,e),[n]),p=(0,o.useRef)(null);return(0,o.useLayoutEffect)(()=>(p.current=null,()=>{let t={};p.current=t,queueMicrotask(()=>{p.current===t&&(p.current=null,i.getState().redockFromWindow(e,d.current))})}),[e]),(0,s.jsxs)(`div`,{className:`relative h-full w-full`,children:[(0,s.jsx)(`div`,{ref:f,className:`absolute inset-0`}),!c&&!l.current&&(0,s.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-xs text-text-2 pointer-events-none`,children:`Loading…`})]})}export{c as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/team-member-window-content-
|
|
2
|
-
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./x-YDu4m2Iq.js";import{q as i}from"./vendor-mermaid-BKWscKt0.js";import"./portal-container-context-a399Hd9F.js";import"./window-store-DGKf9rPG.js";import"./use-is-mobile-CYW3FJFE.js";import{t as a}from"./mobile-bottom-sheet-BD5b7KJF.js";import"./use-visual-viewport-rnvuooQZ.js";import{n as o}from"./use-open-team-member-CruUTqzD.js";var s=e(t(),1),c=n(),l=(0,s.lazy)(()=>i(()=>import(`./team-member-window-content-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/team-member-window-content-BvqhkPjH.js","assets/rolldown-runtime-FhOqtrmT.js","assets/index-LEL-8oU_.js","assets/vendor-mermaid-BKWscKt0.js","assets/vendor-ui-CaeeFO0B.js","assets/vendor-markdown-Ls5AcU91.js","assets/button-BZtEJcUv.js","assets/utils-C9OjCrou.js","assets/createLucideIcon-D8pyde1A.js","assets/arrow-left-CyFcsyzD.js","assets/bot-D6sx11y0.js","assets/check-DN75Ucvz.js","assets/chevron-down-Dp0rpHb8.js","assets/chevron-right-De-Wz5Lz.js","assets/chevron-up-8PbsNiJp.js","assets/circle-BCy0AUCo.js","assets/clock-C1CQUQPZ.js","assets/sparkles-Dh-_J2Rd.js","assets/copy-BewHj66E.js","assets/database-Y3ESDK4-.js","assets/download-DG3_9xXy.js","assets/use-coarse-long-press-BmI_GVW5.js","assets/eye-off-GjXVuAOn.js","assets/eye-gWwaF4Lg.js","assets/loader-circle-DPMrnLQ2.js","assets/monitor-C835ucWH.js","assets/x-YDu4m2Iq.js","assets/api-client-oY1tC3tM.js","assets/react-X4jUntEf.js","assets/window-store-DGKf9rPG.js","assets/window-pip-registry-BEN0QNSW.js","assets/panel-store-BRrnDO_i.js","assets/context-menu-C13b1uT3.js","assets/portal-container-context-a399Hd9F.js","assets/mobile-bottom-sheet-BD5b7KJF.js","assets/use-visual-viewport-rnvuooQZ.js","assets/use-is-mobile-CYW3FJFE.js","assets/project-store-BuY7rxn_.js","assets/ws-auth-Dawx17PM.js","assets/settings-store-Brjd0QnO.js","assets/tab-store-PZsP5ZwG.js","assets/apply-theme-DxTXOAcV.js","assets/resolve-theme-DQk_YcsT.js","assets/index-nP3uxXvR.css","assets/tool-cards-DIoAqDka.js","assets/circle-question-mark-CzR7YRc-.js","assets/code-DJgYrFzm.js","assets/send-Bb0jtcR6.js","assets/use-blob-url-Gfi69PtP.js","assets/image-gallery-Cj8nd4xW.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./x-YDu4m2Iq.js";import{q as i}from"./vendor-mermaid-BKWscKt0.js";import"./portal-container-context-a399Hd9F.js";import"./window-store-DGKf9rPG.js";import"./use-is-mobile-CYW3FJFE.js";import{t as a}from"./mobile-bottom-sheet-BD5b7KJF.js";import"./use-visual-viewport-rnvuooQZ.js";import{n as o}from"./use-open-team-member-CruUTqzD.js";var s=e(t(),1),c=n(),l=(0,s.lazy)(()=>i(()=>import(`./team-member-window-content-BvqhkPjH.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49])));function u(){let e=o(e=>e.payload),t=o(e=>e.close);return e?(0,c.jsxs)(a,{open:!0,onClose:t,zIndex:45,className:`flex h-[var(--sheet-vh)] flex-col p-0`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[(0,c.jsxs)(`span`,{className:`truncate text-sm font-medium text-text-primary`,children:[`Session — `,e.memberName]}),(0,c.jsx)(`button`,{type:`button`,onClick:t,className:`ml-auto flex size-11 items-center justify-center rounded text-text-secondary hover:text-text-primary`,"aria-label":`Close`,children:(0,c.jsx)(r,{className:`size-5`})})]}),(0,c.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,c.jsx)(s.Suspense,{fallback:(0,c.jsx)(`div`,{className:`p-4 text-sm text-text-2`,children:`Loading…`}),children:(0,c.jsx)(l,{id:`sheet-${e.memberName}`,payload:e})})})]}):null}export{u as TeamMemberSheet};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./tool-cards-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./tool-cards-DIoAqDka.js";import{t as i}from"./loader-circle-DPMrnLQ2.js";import{n as a}from"./api-client-oY1tC3tM.js";import"./vendor-mermaid-BKWscKt0.js";import{n as o}from"./utils-C9OjCrou.js";import"./panel-store-BRrnDO_i.js";import"./window-store-DGKf9rPG.js";import"./tab-store-PZsP5ZwG.js";import{Kn as s}from"./index-LEL-8oU_.js";import"./use-blob-url-Gfi69PtP.js";var c=e(t(),1),l=n();function u({payload:e}){let{teamName:t,memberName:n,projectName:u}=e??{},[d,f]=(0,c.useState)([]),[p,m]=(0,c.useState)(!0),[h,g]=(0,c.useState)(null),[_,v]=(0,c.useState)(0);return(0,c.useEffect)(()=>{if(!t||!n){g(`Missing team or member`),m(!1);return}let e=!1;return m(!0),g(null),a.get(`/api/teams/${encodeURIComponent(t)}/members/${encodeURIComponent(n)}/transcript`).then(t=>{e||f(t?.events??[])}).catch(()=>{e||g(`Could not read this member's session`)}).finally(()=>{e||m(!1)}),()=>{e=!0}},[t,n,_]),(0,l.jsxs)(`div`,{className:`flex flex-col h-full min-h-0 bg-surface`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border/30 shrink-0`,children:[(0,l.jsx)(`span`,{className:`text-xs font-medium truncate`,children:n}),(0,l.jsx)(`span`,{className:`text-[10px] text-text-subtle`,children:d.length>0?`${d.length} steps`:``}),(0,l.jsx)(`button`,{type:`button`,onClick:()=>v(e=>e+1),className:`ml-auto text-text-subtle hover:text-foreground p-1 shrink-0`,"aria-label":`Reload session`,children:(0,l.jsx)(s,{className:o(`size-3`,p&&`animate-spin`)})})]}),p&&d.length===0?(0,l.jsxs)(`div`,{className:`flex-1 flex items-center justify-center gap-2 text-xs text-text-subtle`,children:[(0,l.jsx)(i,{className:`size-3 animate-spin`}),`Loading session…`]}):h?(0,l.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-error px-4 text-center`,children:h}):d.length===0?(0,l.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-text-subtle`,children:`This member has no recorded session`}):(0,l.jsx)(r,{events:d,projectName:u,className:`flex-1 min-h-0 overflow-y-auto px-3 py-2 space-y-1`})]})}export{u as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./createLucideIcon-D8pyde1A.js";import{t as i}from"./copy-BewHj66E.js";import{t as a}from"./loader-circle-DPMrnLQ2.js";import{n as o,s}from"./api-client-oY1tC3tM.js";import"./vendor-mermaid-BKWscKt0.js";import{t as c}from"./settings-store-Brjd0QnO.js";import{n as l}from"./utils-C9OjCrou.js";import"./portal-container-context-a399Hd9F.js";import{t as u}from"./panel-store-BRrnDO_i.js";import"./window-store-DGKf9rPG.js";import{r as d,t as f}from"./apply-theme-DxTXOAcV.js";import{t as p}from"./mobile-bottom-sheet-BD5b7KJF.js";import"./use-visual-viewport-rnvuooQZ.js";import{t as m}from"./resolve-theme-DQk_YcsT.js";import{t as h}from"./ws-auth-Dawx17PM.js";import{Cr as g,Gn as _,Tr as v,in as y,rr as b,sr as x,tn as S}from"./index-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./createLucideIcon-D8pyde1A.js";import{t as i}from"./copy-BewHj66E.js";import{t as a}from"./loader-circle-DPMrnLQ2.js";import{n as o,s}from"./api-client-oY1tC3tM.js";import"./vendor-mermaid-BKWscKt0.js";import{t as c}from"./settings-store-Brjd0QnO.js";import{n as l}from"./utils-C9OjCrou.js";import"./portal-container-context-a399Hd9F.js";import{t as u}from"./panel-store-BRrnDO_i.js";import"./window-store-DGKf9rPG.js";import{r as d,t as f}from"./apply-theme-DxTXOAcV.js";import{t as p}from"./mobile-bottom-sheet-BD5b7KJF.js";import"./use-visual-viewport-rnvuooQZ.js";import{t as m}from"./resolve-theme-DQk_YcsT.js";import{t as h}from"./ws-auth-Dawx17PM.js";import{Cr as g,Gn as _,Tr as v,in as y,rr as b,sr as x,tn as S}from"./index-LEL-8oU_.js";import{r as C}from"./send-to-chat-S8LCNX7V.js";import{n as w,t as T}from"./run-in-terminal-bKRwuO2z.js";import{i as E,n as D,r as O,t as k}from"./vendor-xterm-BaMOj65g.js";var A=r(`link-2-off`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7`,key:`10o201`}],[`path`,{d:`M15 7h2a5 5 0 0 1 4 8`,key:`1d3206`}],[`line`,{x1:`8`,x2:`12`,y1:`12`,y2:`12`,key:`rvw6j4`}],[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}]]),j=r(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),M=r(`text-select`,[[`path`,{d:`M14 21h1`,key:`v9vybs`}],[`path`,{d:`M14 3h1`,key:`1ec4yj`}],[`path`,{d:`M19 3a2 2 0 0 1 2 2`,key:`18rm91`}],[`path`,{d:`M21 14v1`,key:`169vum`}],[`path`,{d:`M21 19a2 2 0 0 1-2 2`,key:`1j7049`}],[`path`,{d:`M21 9v1`,key:`mxsmne`}],[`path`,{d:`M3 14v1`,key:`vnatye`}],[`path`,{d:`M3 9v1`,key:`1r0deq`}],[`path`,{d:`M5 21a2 2 0 0 1-2-2`,key:`sbafld`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2`,key:`y57alp`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}],[`path`,{d:`M7 16h6`,key:`1vyc9m`}],[`path`,{d:`M7 8h8`,key:`1jbsf9`}],[`path`,{d:`M9 21h1`,key:`15o7lz`}],[`path`,{d:`M9 3h1`,key:`1yesri`}]]),N=e(t(),1);function P(e){let t=e.tokens;if(e.terminal){let n=e.terminal.ansi;return{background:t.bgSolid,foreground:t.text,cursor:e.terminal.cursor,cursorAccent:e.terminal.cursorAccent??t.bgSolid,selectionBackground:e.terminal.selection,black:n[0],red:n[1],green:n[2],yellow:n[3],blue:n[4],magenta:n[5],cyan:n[6],white:n[7],brightBlack:n[8],brightRed:n[9],brightGreen:n[10],brightYellow:n[11],brightBlue:n[12],brightMagenta:n[13],brightCyan:n[14],brightWhite:n[15]}}let n=e.mode===`dark`,r=n?`#1b1f2a`:`#2b2f38`,i=n?`#d7dce8`:`#e9edf5`,a=t.text3,o=n?`#f7f9ff`:`#ffffff`;return{background:t.bgSolid,foreground:t.text,cursor:t.accent,cursorAccent:t.bgSolid,selectionBackground:t.accentWash,black:r,red:t.error,green:t.success,yellow:t.warning,blue:t.accent,magenta:t.accent2,cyan:t.info,white:i,brightBlack:a,brightRed:t.error,brightGreen:t.success,brightYellow:t.warning,brightBlue:t.accent,brightMagenta:t.accent2,brightCyan:t.info,brightWhite:o}}function F(){let e=c.getState();return P(d()??m(e.themeStyle,e.themeMode,e.customThemes,e.customThemeId))}var ee=/[).,;:'"\]}>]+$/,te=/\bhttps?:\/\/[^\s<>"'`]+/g,I=5e3,L=100,R=250,z=3e3,B=`RESIZE:`,ne=`PING`,re=`PONG`,ie=15e3,ae=35e3;function V(e){let{sessionId:t,containerRef:n}=e,r=(0,N.useRef)(null),i=(0,N.useRef)(null),a=(0,N.useRef)(null),o=(0,N.useRef)(null),s=(0,N.useRef)(0),c=(0,N.useRef)(!1),l=(0,N.useRef)(Date.now()),[u,d]=(0,N.useState)(!1),[p,m]=(0,N.useState)(!1),[g,_]=(0,N.useState)(!1),[v,b]=(0,N.useState)(!1),x=(0,N.useRef)(null),S=(0,N.useRef)(null),C=e.tabId?`ppm:terminal-session:${e.tabId}`:null,w=(0,N.useRef)((()=>{if(C)try{return localStorage.getItem(C)??t}catch{}return t})()),T=(0,N.useRef)(0),A=(0,N.useRef)(-1),j=(0,N.useCallback)(e=>{let t=a.current;t?.readyState===WebSocket.OPEN&&t.send(e)},[]),M=(0,N.useCallback)(()=>{x.current&&clearTimeout(x.current),x.current=setTimeout(()=>b(!0),R)},[]),P=(0,N.useCallback)(()=>r.current?.getSelection()??``,[]),V=(0,N.useCallback)(()=>{let e=r.current;if(!e)return``;let t=e.buffer.active,n=T.current,i=t.baseY+t.cursorY,a=[];for(let e=n;e<=i;e++){let n=t.getLine(e);n&&a.push(n.translateToString(!0))}for(;a.length>0&&a[a.length-1].trim()===``;)a.pop();return a.join(`
|
|
2
2
|
`)},[]),H=(0,N.useCallback)(()=>{let e=r.current;return!e||A.current<0?``:e.buffer.active.getLine(A.current)?.translateToString(!0).trimEnd()??``},[]),U=(0,N.useCallback)(()=>{let e=r.current;if(!e)return[];let t=e.buffer.active,n=t.baseY+t.cursorY,i=Math.max(0,n-I),a=[],o=``;for(let e=i;e<=n;e++){let n=t.getLine(e);n&&(o+=n.translateToString(!0),!t.getLine(e+1)?.isWrapped&&(a.push(o),o=``))}o&&a.push(o);let s=new Set,c=[];for(let e of a)for(let t of e.match(te)??[]){let e=t.replace(ee,``);!e||s.has(e)||(s.add(e),c.push(e))}return c.reverse()},[]),W=(0,N.useCallback)(()=>{let e=r.current,t=a.current;e&&t?.readyState===WebSocket.OPEN&&t.send(`${B}${e.cols},${e.rows}`)},[]),G=(0,N.useCallback)(()=>{if(o.current&&clearTimeout(o.current),a.current?.close(),a.current=null,w.current=`new`,C)try{localStorage.removeItem(C)}catch{}s.current=0,_(!1),b(!1),d(!1),m(!1),setTimeout(()=>K(),0)},[]),K=(0,N.useCallback)(()=>{o.current&&=(clearTimeout(o.current),null),a.current&&=(a.current.onclose=null,a.current.close(),null);let t=r.current;if(!t)return;let n=window.location.protocol===`https:`?`wss:`:`ws:`,i=e.projectName??``,u=w.current,f=u===`new`&&e.cwd?`?cwd=${encodeURIComponent(e.cwd)}`:``,p=h(`/ws/project/${encodeURIComponent(i)}/terminal/${u}${f}`),g=`${n}//${window.location.host}${p}`,v=new WebSocket(g);a.current=v,v.onopen=()=>{c.current&&r.current&&r.current.clear(),c.current=!0,l.current=Date.now(),d(!0),m(!1),s.current=0,w.current===`new`&&b(!1),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>b(!0),z),W()},v.onmessage=e=>{if(l.current=Date.now(),typeof e.data==`string`){if(e.data===re)return;if(e.data.startsWith(`{`))try{let n=JSON.parse(e.data);if(n.type){if(n.type===`session`&&n.id&&(w.current=n.id,C))try{localStorage.setItem(C,n.id)}catch{}n.type===`error`&&t.write(`\r\n\x1b[31mError: ${n.message}\x1b[0m\r\n`),n.type===`exited`&&_(!0);return}}catch{}M(),t.write(e.data)}},v.onclose=()=>{d(!1),J()},v.onerror=()=>{v.close()}},[W]),q=(0,N.useCallback)(()=>{if(document.visibilityState!==`visible`)return;let e=a.current;if(!e||e.readyState!==WebSocket.OPEN){K();return}if(Date.now()-l.current>ae){K();return}try{e.send(ne)}catch{K()}},[K]);function J(){let e=Math.min(1e3*2**s.current,3e4);s.current++,m(!0),o.current=setTimeout(()=>{K()},e)}return(0,N.useEffect)(()=>{let e=n.current;if(!e)return;let t=new E({cursorBlink:!0,fontSize:13,scrollback:5e4,fontFamily:`Consolas, 'Cascadia Mono', Menlo, 'DejaVu Sans Mono', 'Courier New', monospace`,theme:F()}),s=new O,c=new D;if(t.loadAddon(s),t.loadAddon(c),t.open(e),!(`ontouchstart`in window||navigator.maxTouchPoints>0))try{let e=new k;e.onContextLoss(()=>e.dispose()),t.loadAddon(e)}catch{}s.fit(),r.current=t,i.current=s,t.onData(e=>{if(e.includes(`\r`)||e.includes(`
|
|
3
3
|
`)){let e=t.buffer.active;A.current=e.baseY+e.cursorY,T.current=A.current+1}let n=a.current;n?.readyState===WebSocket.OPEN&&n.send(e)}),K();let l=setInterval(q,ie),u=e.ownerDocument,d=()=>{u.visibilityState===`visible`&&q()};u.addEventListener(`visibilitychange`,d);let p=null,m=new ResizeObserver(e=>{let t=e[0];!t||t.contentRect.width===0||t.contentRect.height===0||(p&&clearTimeout(p),p=setTimeout(()=>{try{s.fit(),W()}catch{}},L))});m.observe(e);let h=y(e,()=>{try{s.fit(),W()}catch{}}),g=()=>{t.options.theme=F()};window.addEventListener(f,g);let _=()=>window.removeEventListener(f,g);return()=>{_(),h(),p&&clearTimeout(p),m.disconnect(),clearInterval(l),u.removeEventListener(`visibilitychange`,d),o.current&&clearTimeout(o.current),x.current&&clearTimeout(x.current),S.current&&clearTimeout(S.current),a.current?.close(),a.current=null,t.dispose(),r.current=null,i.current=null}},[]),{connected:u,reconnecting:p,exited:g,shellReady:v,sendData:j,getSelection:P,getLastCommandOutput:V,getLastCommand:H,getBufferUrls:U,restart:G}}function H(e,t,n){return new MouseEvent(e,{bubbles:!0,cancelable:!0,view:window,clientX:t.clientX,clientY:t.clientY,screenX:t.screenX,screenY:t.screenY,button:0,buttons:n,detail:1})}function U(e,t){(0,N.useEffect)(()=>{let n=e.current;if(!t||!n)return;let r=n.querySelector(`.xterm`);if(!r)return;let i=e=>{let t=e.touches[0];!t||e.touches.length>1||(e.preventDefault(),e.stopPropagation(),r.dispatchEvent(H(`mousedown`,t,1)))},a=e=>{let t=e.touches[0];t&&(e.preventDefault(),e.stopPropagation(),document.dispatchEvent(H(`mousemove`,t,1)))},o=e=>{let t=e.changedTouches[0];t&&(e.preventDefault(),e.stopPropagation(),document.dispatchEvent(H(`mouseup`,t,0)))},s={capture:!0,passive:!1};return n.addEventListener(`touchstart`,i,s),n.addEventListener(`touchmove`,a,s),n.addEventListener(`touchend`,o,s),n.addEventListener(`touchcancel`,o,s),()=>{n.removeEventListener(`touchstart`,i,s),n.removeEventListener(`touchmove`,a,s),n.removeEventListener(`touchend`,o,s),n.removeEventListener(`touchcancel`,o,s)}},[e,t])}var W=40;function G(e){if(!e||typeof e.checkVisibility==`function`&&!e.checkVisibility({visibilityProperty:!0}))return!1;let t=e.getBoundingClientRect();return t.width<W||t.height<W?!1:t.bottom>0&&t.right>0&&t.top<window.innerHeight&&t.left<window.innerWidth}function K({tabId:e,metadata:t,shellReady:n,sendData:r,focusTerminal:i,containerRef:a}){let o=(0,N.useRef)(null),[s,c]=(0,N.useState)(0),l=(0,N.useCallback)(e=>{o.current=e,c(e=>e+1)},[]),d=t?.pendingCommand;(0,N.useEffect)(()=>{if(!(typeof d!=`string`||!d)&&(l(d),e)){let n={...t??{}};delete n.pendingCommand,u.getState().updateTab(e,{metadata:n})}},[d,e,l]),(0,N.useEffect)(()=>{let e=e=>{let t=e.detail;t?.command&&G(a.current)&&(l(t.command),window.dispatchEvent(new Event(T)))};return window.addEventListener(w,e),()=>window.removeEventListener(w,e)},[a,l]),(0,N.useEffect)(()=>{if(!n)return;let e=o.current;e&&(o.current=null,r(e),i())},[n,s,r,i])}var q=n(),J=[{label:`Tab`,value:` `},{label:`Esc`,value:`\x1B`},{label:`Ctrl`,value:null},{label:`↑`,value:`\x1B[A`},{label:`↓`,value:`\x1B[B`},{label:`←`,value:`\x1B[D`},{label:`→`,value:`\x1B[C`},{label:`^C`,value:``}],Y=`flex items-center justify-center shrink-0 min-w-11 min-h-11 rounded text-xs bg-surface-elevated text-text-primary active:bg-primary active:text-primary-foreground transition-colors select-none`;function oe({ctrlMode:e,onToggleCtrl:t,selectMode:n,onToggleSelect:r,onKey:a,onCopy:o,onPaste:s,onSendToChat:c,onOpenLinks:u}){return(0,q.jsxs)(`div`,{className:`relative shrink-0 bg-surface border-t border-border`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1.5 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:[(0,q.jsx)(`button`,{onClick:r,"aria-label":`Select text`,"aria-pressed":n,className:l(Y,n&&`bg-primary text-primary-foreground`),children:(0,q.jsx)(M,{size:16})}),(0,q.jsx)(`button`,{onClick:o,"aria-label":`Copy`,className:Y,children:(0,q.jsx)(i,{size:16})}),(0,q.jsx)(`button`,{onClick:s,"aria-label":`Paste`,className:Y,children:(0,q.jsx)(v,{size:16})}),(0,q.jsx)(`button`,{onClick:u,"aria-label":`Links`,className:Y,children:(0,q.jsx)(x,{size:16})}),(0,q.jsx)(`button`,{onClick:c,"aria-label":`Send to Chat`,className:Y,children:(0,q.jsx)(b,{size:16})}),(0,q.jsx)(`div`,{className:`w-px h-6 shrink-0 bg-border mx-0.5`}),J.map(n=>(0,q.jsx)(`button`,{onClick:()=>n.value===null?t():a(n.value),className:l(Y,`font-mono`,n.value===null&&e&&`bg-primary text-primary-foreground`),children:n.label},n.label)),(0,q.jsx)(`div`,{className:`w-6 shrink-0`,"aria-hidden":!0})]}),(0,q.jsx)(`div`,{className:`pointer-events-none absolute inset-y-0 right-0 w-8 bg-gradient-to-l from-surface to-transparent`,"aria-hidden":!0})]})}var se=new Set([`localhost`,`::1`]);function X(e){let t=e.replace(/^\[|\]$/g,``).toLowerCase();return se.has(t)?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(t)}function Z(e){let t;try{t=new URL(e)}catch{return null}let n=t.searchParams.get(`redirect_uri`)??t.searchParams.get(`redirectUri`);if(!n)return null;try{let e=new URL(n);return X(e.hostname)?e.port||(e.protocol===`https:`?`443`:`80`):null}catch{return null}}function Q(e){try{let t=new URL(e.trim());return(t.protocol===`http:`||t.protocol===`https:`)&&X(t.hostname)}catch{return!1}}function ce({onDone:e}){let[t,n]=(0,N.useState)(``),[r,i]=(0,N.useState)(!1),c=t.trim(),l=!r&&Q(c),u=async()=>{i(!0);try{await o.post(`/api/loopback/callback`,{url:c}),s.success(`Sent to the waiting command`,{duration:2e3}),n(``),e()}catch(e){s.error(e.message,{duration:4e3})}finally{i(!1)}};return(0,q.jsxs)(`div`,{className:`shrink-0 border-t border-border px-3 py-3`,children:[(0,q.jsx)(`p`,{className:`pb-2 text-[11px] leading-snug text-text-secondary`,children:`Finished signing in and landed on a page that would not load? Paste that address here — the machine will deliver it to the command still waiting.`}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),inputMode:`url`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,placeholder:`http://127.0.0.1:54132/oauth/callback?code=…`,"aria-label":`Callback address`,className:`h-11 min-w-0 flex-1 rounded-lg border border-border bg-surface px-3 font-mono text-xs text-foreground placeholder:text-text-subtle`}),(0,q.jsx)(`button`,{onClick:()=>void u(),disabled:!l,"aria-label":`Finish login`,className:`flex size-11 shrink-0 items-center justify-center rounded-lg bg-primary text-primary-foreground disabled:opacity-40 active:opacity-80 transition-opacity`,children:r?(0,q.jsx)(a,{className:`size-4 animate-spin`}):(0,q.jsx)(j,{className:`size-4`})})]}),c!==``&&!Q(c)&&(0,q.jsx)(`p`,{className:`pt-1.5 text-[11px] text-error`,children:`Needs to be the http://127.0.0.1:… address the sign-in redirected to.`})]})}function le({open:e,onClose:t,urls:n}){let r=async e=>{let n=await S(e);s[n?`success`:`error`](n?`Link copied`:`Could not copy link`,{duration:1500}),t()},a=[...new Set(n.map(Z).filter(e=>!!e))];return(0,q.jsxs)(p,{open:e,onClose:t,zIndex:70,className:`flex flex-col max-h-[70vh]`,children:[(0,q.jsx)(`div`,{className:`shrink-0 px-4 pb-2 text-xs font-medium text-text-secondary`,children:n.length>0?`Links in terminal (${n.length})`:`Links in terminal`}),(0,q.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-2 pb-2`,children:n.length===0?(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-8 text-center text-sm text-text-secondary`,children:[(0,q.jsx)(A,{className:`size-5 text-text-subtle`}),`No links found in the visible scrollback.`]}):n.map(e=>{let n=Z(e);return(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-stretch gap-1`,children:[(0,q.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer noopener`,onClick:t,className:`flex min-h-11 flex-1 min-w-0 items-center gap-2 rounded-lg px-3 py-2 text-sm text-foreground active:bg-accent transition-colors`,children:[(0,q.jsx)(g,{className:`size-4 shrink-0 text-text-subtle`}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left font-mono text-xs`,children:e})]}),(0,q.jsx)(`button`,{onClick:()=>void r(e),"aria-label":`Copy ${e}`,className:`flex size-11 shrink-0 items-center justify-center rounded-lg text-text-secondary active:bg-accent transition-colors`,children:(0,q.jsx)(i,{className:`size-4`})})]}),n&&(0,q.jsxs)(`p`,{className:`px-3 pb-2 text-[11px] leading-snug text-text-secondary`,children:[`Signing in here sends you back to port `,n,` `,(0,q.jsx)(`strong`,{children:`on the machine`}),`, not this device — so the terminal keeps waiting. Afterwards, paste the address bar below to finish it.`]})]},e)})}),a.length>0&&(0,q.jsx)(ce,{onDone:t})]})}var $=(0,N.memo)(function({metadata:e,tabId:t}){let n=e?.sessionId??`new`,r=e?.projectName,i=e?.cwd,a=(0,N.useRef)(null),{connected:o,reconnecting:c,exited:u,shellReady:d,sendData:f,getSelection:p,getLastCommandOutput:m,getLastCommand:h,getBufferUrls:g,restart:v}=V({sessionId:n,projectName:r,cwd:i,containerRef:a,tabId:t}),[y,x]=(0,N.useState)(!1),[w,T]=(0,N.useState)(!1),[E,D]=(0,N.useState)(!1);U(a,w);let O=(0,N.useCallback)(()=>{(a.current?.querySelector(`.xterm-helper-textarea`))?.focus()},[]);K({tabId:t,metadata:e,shellReady:d,sendData:f,focusTerminal:O,containerRef:a}),(0,N.useEffect)(()=>{let e=a.current;if(!e||w)return;let t=()=>O();return e.addEventListener(`touchend`,t,{capture:!0}),()=>e.removeEventListener(`touchend`,t,{capture:!0})},[O,w]);let k=(0,N.useCallback)(e=>{if(O(),y&&e.length===1){let t=e.toLowerCase().charCodeAt(0)-96;t>=1&&t<=26&&f(String.fromCharCode(t)),x(!1);return}f(e)},[y,f,O]),A=(0,N.useCallback)(async()=>{let e=p(),t=e||m();if(!t.trim()){s(`Nothing to copy`,{duration:1500});return}let n=await S(t);s[n?`success`:`error`](n?e?`Selection copied`:`Last output copied`:`Could not copy`,{duration:1500})},[p,m]),j=(0,N.useCallback)(async()=>{try{let e=await navigator.clipboard.readText();e&&(f(e),O())}catch{s.error(`Clipboard blocked — paste with the keyboard instead`,{duration:2500})}},[f,O]),M=(0,N.useCallback)(()=>{let e=p(),t=e||m();if(!t.trim())return;let n=e?``:h();C({text:"```bash\n"+(n?`${n}\n${t}`:t)+"\n```",label:e?`Terminal selection`:`Terminal output`,projectName:r}),s.success(`Sent to chat`,{duration:1500})},[p,m,h,r]),P=typeof window<`u`&&`ontouchstart`in window;return(0,q.jsxs)(`div`,{className:`flex flex-col h-full min-h-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1 bg-surface border-b border-border text-xs`,children:[(0,q.jsx)(`span`,{className:l(`size-2 rounded-full`,u?`bg-error`:o?`bg-success`:c?`bg-warning`:`bg-error`)}),(0,q.jsx)(`span`,{className:`text-text-secondary`,children:u?`Process exited`:o?`Connected`:c?`Reconnecting...`:`Disconnected`}),u&&(0,q.jsxs)(`button`,{onClick:v,className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-xs bg-surface-elevated text-text-primary hover:bg-primary hover:text-primary-foreground active:bg-primary active:text-primary-foreground transition-colors`,children:[(0,q.jsx)(_,{size:10}),`Restart`]}),(0,q.jsxs)(`button`,{onClick:M,title:`Send to Chat`,className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-xs bg-surface-elevated text-text-primary hover:bg-primary hover:text-primary-foreground active:bg-primary active:text-primary-foreground transition-colors ml-auto`,children:[(0,q.jsx)(b,{size:10}),`Chat`]}),(0,q.jsx)(`span`,{className:`text-text-subtle font-mono`,children:n})]}),(0,q.jsx)(`div`,{ref:a,onClick:w?void 0:O,className:l(`flex-1 min-h-0 bg-background p-1`,w&&`touch-none`)}),P&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(oe,{ctrlMode:y,onToggleCtrl:()=>x(!y),selectMode:w,onToggleSelect:()=>T(!w),onKey:k,onCopy:()=>void A(),onPaste:()=>void j(),onSendToChat:M,onOpenLinks:()=>D(!0)}),(0,q.jsx)(le,{open:E,onClose:()=>D(!1),urls:E?g():[]})]})]})});export{$ as TerminalTab};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/markdown-renderer-
|
|
2
|
-
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import{t as r}from"./createLucideIcon-D8pyde1A.js";import{n as i,t as a}from"./circle-question-mark-CzR7YRc-.js";import{t as o}from"./bot-D6sx11y0.js";import{t as s}from"./chevron-down-Dp0rpHb8.js";import{t as c}from"./chevron-right-De-Wz5Lz.js";import{t as l}from"./clock-C1CQUQPZ.js";import{t as u}from"./code-DJgYrFzm.js";import{n as d,t as f}from"./sparkles-Dh-_J2Rd.js";import{t as p}from"./loader-circle-DPMrnLQ2.js";import{t as m}from"./send-Bb0jtcR6.js";import{q as h}from"./vendor-mermaid-BKWscKt0.js";import{t as g}from"./utils-C9OjCrou.js";import{t as _}from"./tab-store-PZsP5ZwG.js";import{An as v,Cr as y,Er as b,Fn as x,Ft as S,Or as C,Un as w,pr as T,r as E,tn as D}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/markdown-renderer-Dcq0J7Yw.js","assets/vendor-mermaid-BKWscKt0.js","assets/rolldown-runtime-FhOqtrmT.js","assets/vendor-ui-CaeeFO0B.js","assets/vendor-markdown-Ls5AcU91.js","assets/markdown-renderer-B47WcMMs.js","assets/index-LEL-8oU_.js","assets/button-BZtEJcUv.js","assets/utils-C9OjCrou.js","assets/createLucideIcon-D8pyde1A.js","assets/arrow-left-CyFcsyzD.js","assets/bot-D6sx11y0.js","assets/check-DN75Ucvz.js","assets/chevron-down-Dp0rpHb8.js","assets/chevron-right-De-Wz5Lz.js","assets/chevron-up-8PbsNiJp.js","assets/circle-BCy0AUCo.js","assets/clock-C1CQUQPZ.js","assets/sparkles-Dh-_J2Rd.js","assets/copy-BewHj66E.js","assets/database-Y3ESDK4-.js","assets/download-DG3_9xXy.js","assets/use-coarse-long-press-BmI_GVW5.js","assets/eye-off-GjXVuAOn.js","assets/eye-gWwaF4Lg.js","assets/loader-circle-DPMrnLQ2.js","assets/monitor-C835ucWH.js","assets/x-YDu4m2Iq.js","assets/api-client-oY1tC3tM.js","assets/react-X4jUntEf.js","assets/window-store-DGKf9rPG.js","assets/window-pip-registry-BEN0QNSW.js","assets/panel-store-BRrnDO_i.js","assets/context-menu-C13b1uT3.js","assets/portal-container-context-a399Hd9F.js","assets/mobile-bottom-sheet-BD5b7KJF.js","assets/use-visual-viewport-rnvuooQZ.js","assets/use-is-mobile-CYW3FJFE.js","assets/project-store-BuY7rxn_.js","assets/ws-auth-Dawx17PM.js","assets/settings-store-Brjd0QnO.js","assets/tab-store-PZsP5ZwG.js","assets/apply-theme-DxTXOAcV.js","assets/resolve-theme-DQk_YcsT.js","assets/index-nP3uxXvR.css","assets/image-gallery-Cj8nd4xW.js","assets/run-in-terminal-bKRwuO2z.js","assets/edit-diff-preview-DeHb85DN.js","assets/libesm-DLBE59ul.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import{t as r}from"./createLucideIcon-D8pyde1A.js";import{n as i,t as a}from"./circle-question-mark-CzR7YRc-.js";import{t as o}from"./bot-D6sx11y0.js";import{t as s}from"./chevron-down-Dp0rpHb8.js";import{t as c}from"./chevron-right-De-Wz5Lz.js";import{t as l}from"./clock-C1CQUQPZ.js";import{t as u}from"./code-DJgYrFzm.js";import{n as d,t as f}from"./sparkles-Dh-_J2Rd.js";import{t as p}from"./loader-circle-DPMrnLQ2.js";import{t as m}from"./send-Bb0jtcR6.js";import{q as h}from"./vendor-mermaid-BKWscKt0.js";import{t as g}from"./utils-C9OjCrou.js";import{t as _}from"./tab-store-PZsP5ZwG.js";import{An as v,Cr as y,Er as b,Fn as x,Ft as S,Or as C,Un as w,pr as T,r as E,tn as D}from"./index-LEL-8oU_.js";import{t as ee}from"./use-blob-url-Gfi69PtP.js";import{r as O,t as k}from"./image-gallery-Cj8nd4xW.js";var A=r(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),j=r(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),M=r(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),N=r(`file-plus-corner`,[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]]),P=r(`file-search`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`11.5`,cy:`14.5`,r:`2.5`,key:`1bq0ko`}],[`path`,{d:`M13.3 16.3 15 18`,key:`2quom7`}]]),F=r(`image-plus`,[[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`,key:`1ue2ih`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]),te=r(`list-checks`,[[`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`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),I=r(`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`}]]),L=e(t(),1),R=n(),ne=(0,L.lazy)(()=>h(()=>import(`./markdown-renderer-Dcq0J7Yw.js`).then(e=>({default:e.MarkdownRenderer})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46])));function z({content:e,maxHeight:t=`max-h-48`}){return(0,R.jsx)(L.Suspense,{fallback:(0,R.jsx)(`div`,{className:`animate-pulse h-4 bg-muted rounded`}),children:(0,R.jsx)(ne,{content:e,className:`text-text-secondary overflow-auto ${t}`})})}var B={task_assignment:{label:`task`,className:`bg-primary/20 text-primary`},idle_notification:{label:`idle`,className:`bg-warning/20 text-warning`},completion:{label:`done`,className:`bg-success/20 text-success`},shutdown_request:{label:`shutdown`,className:`bg-error/20 text-error`},shutdown_approved:{label:`shutdown ✓`,className:`bg-text-3/20 text-text-3`},shutdown_response:{label:`shutdown reply`,className:`bg-text-3/20 text-text-3`},plan_approval_request:{label:`plan review`,className:`bg-primary/20 text-primary`},plan_approval_response:{label:`plan reply`,className:`bg-primary/20 text-primary`}},re=new Set([`to`,`message`,`summary`,`notify_when_idle`,`recipient`,`content`,`type`]),V=e=>typeof e==`string`?e:e==null?``:String(e);function H(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e;return typeof t.type!=`string`||!t.type?null:{type:t.type,request_id:typeof t.request_id==`string`?t.request_id:void 0,approve:typeof t.approve==`boolean`?t.approve:void 0,reason:typeof t.reason==`string`?t.reason:void 0,feedback:typeof t.feedback==`string`?t.feedback:void 0}}function ie(e){let t=e.trim();if(!t.startsWith(`{`))return null;try{return H(JSON.parse(t))}catch{return null}}function U(e){let t=V(e.to)||V(e.recipient),n=e.message??e.content,r=H(n)??ie(V(n)),i=r?``:V(n),a=V(e.type),o=r?.type||(a&&a!==`message`?a:`message`),s=V(e.summary).trim(),c=Object.entries(e).filter(([e])=>!re.has(e)).map(([e,t])=>({key:e,value:typeof t==`string`?t:JSON.stringify(t)??``}));return{to:t,summary:s||void 0,text:i,firstLine:i.split(`
|
|
3
3
|
`).map(e=>e.trim()).find(e=>e.length>0)??``,protocol:r??void 0,kind:o,notifyWhenIdle:e.notify_when_idle===!0,extras:c}}function W(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}if(Array.isArray(t)){let e=V(t.find(e=>e&&typeof e==`object`&&e.type===`text`)?.text);if(!e)return null;try{t=JSON.parse(e)}catch{return null}}if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;if(typeof n.success!=`boolean`)return null;let r=n.pin&&typeof n.pin==`object`?n.pin:null;return{ok:n.success,detail:V(n.message)||V(n.error)||void 0,peer:r&&V(r.name)||void 0,ref:r&&V(r.ref)||void 0}}function ae({kind:e}){if(e===`message`)return null;let t=B[e];return(0,R.jsx)(`span`,{className:`inline-block rounded px-1.5 py-0.5 text-[10px] ${t?.className??`bg-panel-2 text-text-3`}`,children:t?.label??e})}function oe({name:e,input:t}){let n=U(t),r=n.summary||n.firstLine||(n.protocol?n.kind:``),a=r.length>72?`${r.slice(0,72)}…`:r;return(0,R.jsxs)(R.Fragment,{children:[e,` `,(0,R.jsxs)(`span`,{className:`text-text-subtle`,children:[(0,R.jsx)(i,{className:`size-3 inline`}),` `,n.to||`unknown`,a?` · ${a}`:``]}),n.notifyWhenIdle&&(0,R.jsx)(l,{className:`size-3 inline ml-1 text-text-3`})]})}function se({input:e}){let t=U(e);return(0,R.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`text-text-subtle`,children:`To`}),(0,R.jsx)(`span`,{className:`font-medium text-text-primary`,children:t.to||`unknown`}),(0,R.jsx)(ae,{kind:t.kind}),t.notifyWhenIdle&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] bg-panel-2 text-text-3`,children:[(0,R.jsx)(l,{className:`size-3`}),` notify when idle`]})]}),!!t.text&&(0,R.jsx)(z,{content:t.text,maxHeight:`max-h-40`}),t.protocol&&(0,R.jsxs)(`div`,{className:`space-y-0.5 text-text-secondary`,children:[t.protocol.approve!=null&&(0,R.jsxs)(`p`,{children:[t.protocol.approve?`Approved`:`Rejected`,t.protocol.request_id?(0,R.jsxs)(`span`,{className:`text-text-subtle font-mono`,children:[` · `,t.protocol.request_id]}):null]}),!!t.protocol.reason&&(0,R.jsx)(`p`,{className:`text-text-subtle`,children:t.protocol.reason}),!!t.protocol.feedback&&(0,R.jsx)(`p`,{className:`text-text-subtle`,children:t.protocol.feedback})]}),t.extras.length>0&&(0,R.jsx)(`div`,{className:`space-y-0.5`,children:t.extras.map(e=>(0,R.jsxs)(`p`,{className:`text-text-subtle`,children:[(0,R.jsx)(`span`,{className:`font-mono`,children:e.key}),`: `,e.value]},e.key))})]})}function ce({output:e}){let[t,n]=(0,L.useState)(!1),r=W(e);return r?(0,R.jsxs)(`div`,{className:`border-t border-border pt-1.5 space-y-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[r.ok?(0,R.jsx)(b,{className:`size-3 text-success shrink-0`}):(0,R.jsx)(A,{className:`size-3 text-error shrink-0`}),(0,R.jsx)(`span`,{className:r.ok?`text-success`:`text-error`,children:r.ok?`Delivered`:`Not delivered`}),!!r.detail&&(0,R.jsxs)(`span`,{className:`text-text-subtle`,children:[`· `,r.detail]}),!!r.ref&&(0,R.jsxs)(`span`,{className:`text-text-3 font-mono text-[10px]`,children:[`[`,r.ref,`]`]})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>n(!t),className:`flex items-center gap-1 text-[10px] text-text-subtle hover:text-text-secondary transition-colors`,children:[(0,R.jsx)(u,{className:`size-3`}),t?`Hide`:`Show`,` raw`]}),t&&(0,R.jsx)(`pre`,{className:`overflow-x-auto text-text-subtle font-mono max-h-40 whitespace-pre-wrap break-all text-[10px]`,children:e})]}):null}var le=new Set([`.png`,`.jpg`,`.jpeg`,`.gif`,`.webp`,`.bmp`,`.avif`,`.ico`]);function ue(e){let t=e.lastIndexOf(`.`);return t===-1?!1:le.has(e.slice(t).toLowerCase())}var de=/^\[image(?: · [\d.]+(?:B|KB|MB))?\]$/;function fe(e){if(!e.startsWith(`[`))return!1;let t;try{t=JSON.parse(e)}catch{return!1}return Array.isArray(t)?t.some(e=>{let t=e;return t?.type===`text`&&typeof t.text==`string`&&de.test(t.text)}):!1}var pe=`Async agent launched successfully`;function me(e){return!!e&&e.includes(pe)}var he=`text-[var(--img-meta-label)] @max-[470px]:hidden`,ge=[`60%`,`45%`,`80%`];function _e({aspect:e,actions:t}){return(0,R.jsxs)(`div`,{className:`grid grid-cols-[132px_1fr] items-start gap-[14px] overflow-hidden rounded-lg border border-border bg-panel p-[14px] @max-[470px]:grid-cols-[64px_1fr] @max-[470px]:gap-[11px] @max-[470px]:p-[11px]`,children:[(0,R.jsx)(`div`,{className:`img-skeleton rounded-lg`,style:{aspectRatio:e}}),(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-[9px]`,children:[(0,R.jsx)(`div`,{className:`img-skeleton h-[13px] w-2/5 rounded @max-[470px]:hidden`}),(0,R.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-[14px] gap-y-[4px] font-mono text-[11.5px] @max-[470px]:grid-cols-[1fr]`,children:[`dimensions`,`size`,`path`].map((e,t)=>(0,R.jsxs)(L.Fragment,{children:[(0,R.jsx)(`dt`,{className:he,children:e}),(0,R.jsx)(`dd`,{className:`flex items-center`,children:(0,R.jsx)(`span`,{className:`img-skeleton h-[11px] rounded`,style:{width:ge[t]}})})]},e))}),t]})]})}function ve({code:e,onRetry:t}){return(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-panel px-2.5 py-2 font-mono text-[12px] text-text-2`,children:[(0,R.jsx)(C,{className:`size-3 shrink-0`}),(0,R.jsxs)(`span`,{className:`truncate`,children:[`preview unavailable`,e?` · ${e}`:``]}),(0,R.jsx)(`button`,{type:`button`,onClick:t,className:`ml-auto shrink-0 text-accent`,children:`retry`})]})}var ye=.62;function be(e,t){let n=e.w/e.h;if(n>2.4)return{variant:`band`,aspect:n,fit:`contain`};let r=Math.max(ye,n),i=t/r;return e.w<t&&e.h<i?{variant:`split`,aspect:r,fit:`native`}:{variant:`split`,aspect:r,fit:n<.62?`contain`:`cover`}}function xe(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:e>=1024?`${Math.round(e/1024)} KB`:`${e} B`}function Se(e,t){let n=`${e.w} × ${e.h} px`;return t===`native`?`${n} · shown 1:1`:n}var G=new Map;function Ce(e){return G.get(e)}function we(e,t){G.set(e,t)}var Te=4/5,K=`text-[var(--img-meta-label)] @max-[470px]:hidden`,q=`truncate text-text @max-[470px]:text-text-2`,J=`h-[30px] @max-[470px]:h-[36px] shrink-0 rounded-[7px] px-[9px] font-mono text-[11.5px] text-text-2 bg-[var(--img-ghost)] border border-[var(--img-ghost-border)] backdrop-blur-[6px] transition-colors can-hover:hover:bg-[var(--img-ghost-hover)] can-hover:hover:border-[var(--img-ghost-hover-border)] can-hover:hover:text-text`;function Ee({filePath:e,projectName:t}){let[n,r]=(0,L.useState)(0),{blobUrl:i,blob:a,error:o,errorCode:s}=ee(e,t,void 0,n),[c,l]=(0,L.useState)(()=>Ce(e)),[u,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(!1),m=E(e=>e.open),{openTab:h}=_(S(e=>({openTab:e.openTab}))),v=g(e);(0,L.useEffect)(()=>{if(!f)return;let e=setTimeout(()=>p(!1),1200);return()=>clearTimeout(e)},[f]);let y=t=>{let n={w:t.naturalWidth,h:t.naturalHeight};if(!n.w||!n.h)return d(!0);we(e,n),l(n)},b=()=>{d(!1),r(e=>e+1)};if(o||u)return(0,R.jsx)(`div`,{className:`border-t border-border pt-1.5`,children:(0,R.jsx)(ve,{code:u?void 0:s??void 0,onRetry:b})});let x=c?be(c,132):null,C=x?.aspect??Te,w=(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-[6px]`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:T,className:J,children:[(0,R.jsx)(`span`,{className:`@max-[470px]:hidden`,children:`open in editor`}),(0,R.jsx)(`span`,{className:`hidden @max-[470px]:inline`,children:`open`})]}),(0,R.jsx)(`button`,{type:`button`,onClick:A,className:J,children:f?`copied`:`copy path`}),(0,R.jsx)(`button`,{type:`button`,onClick:j,className:J,children:`full size`})]});function T(){t&&h({type:`editor`,title:v,metadata:{filePath:e,projectName:t},projectId:t,closable:!0})}function A(){D(e).then(()=>p(!0))}function j(e){i&&m(i,v,O(e.currentTarget))}if(!i||!x||!c)return(0,R.jsxs)(`div`,{className:`@container border-t border-border pt-1.5`,children:[i&&(0,R.jsx)(`img`,{src:i,alt:``,className:`hidden`,onLoad:e=>y(e.currentTarget),onError:()=>d(!0)}),(0,R.jsx)(_e,{aspect:C,actions:w})]});let M=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`dt`,{className:K,children:`dimensions`}),(0,R.jsx)(`dd`,{className:q,children:Se(c,x.fit)}),a&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`dt`,{className:K,children:`size`}),(0,R.jsxs)(`dd`,{className:q,children:[xe(a.size),a.type?` · ${a.type}`:``]})]}),(0,R.jsx)(`dt`,{className:K,children:`path`}),(0,R.jsx)(`dd`,{dir:`rtl`,className:`${q} text-left`,children:e})]}),N=(0,R.jsx)(`img`,{src:i,alt:v,[k]:``,onLoad:e=>y(e.currentTarget),onError:()=>d(!0),className:x.fit===`cover`?`size-full object-cover`:x.fit===`contain`?`size-full object-contain`:`max-h-full max-w-full`});return(0,R.jsx)(`div`,{className:`@container border-t border-border pt-1.5`,children:(0,R.jsxs)(`div`,{className:`relative overflow-hidden rounded-lg border border-border p-[14px] @max-[470px]:p-[11px]`,children:[(0,R.jsx)(`img`,{"aria-hidden":`true`,alt:``,src:i,className:`absolute inset-0 size-full object-cover`,style:{filter:`var(--img-backdrop)`,transform:`scale(1.3)`}}),(0,R.jsx)(`div`,{className:`absolute inset-0`,style:{background:`var(--img-veil)`}}),x.variant===`band`?(0,R.jsxs)(`div`,{className:`relative grid gap-[11px]`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:j,title:`Open ${v}`,className:`img-checkerboard w-full cursor-zoom-in overflow-hidden rounded-lg border border-[var(--img-plate-border)]`,style:{aspectRatio:x.aspect},children:N}),(0,R.jsx)(`dl`,{className:`grid grid-cols-[auto_auto_1fr] gap-x-[18px] font-mono text-[11.5px] [&_dt]:hidden`,children:M}),w]}):(0,R.jsxs)(`div`,{className:`relative grid grid-cols-[132px_1fr] items-start gap-[14px] @max-[470px]:grid-cols-[64px_1fr] @max-[470px]:gap-[11px]`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:j,title:`Open ${v}`,className:`cursor-zoom-in overflow-hidden rounded-lg border border-[var(--img-plate-border)] bg-[var(--img-plate)] shadow-[var(--img-plate-shadow)] ${x.fit===`cover`?``:`img-checkerboard flex items-center justify-center`}`,style:{aspectRatio:x.aspect},children:N}),(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-[9px]`,children:[(0,R.jsx)(`p`,{className:`truncate text-[13px] font-semibold text-text @max-[470px]:hidden`,children:v}),(0,R.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-[14px] gap-y-[4px] font-mono text-[11.5px] @max-[470px]:grid-cols-[1fr]`,children:M}),w]})]})]})})}function Y(e,t){if(e!==`Agent`&&e!==`Task`)return null;let n=t.name;return typeof n==`string`&&n.trim()?n.trim():null}function De(e,t,n=!1){if(t&&(e===`Bash`||e===`PowerShell`))return{Icon:x,cls:`bg-error/15 text-error`};if(n)return{Icon:v,cls:`bg-accent-2/15 text-accent-2`};switch(e){case`Read`:case`Glob`:case`LS`:return{Icon:P,cls:`bg-accent-wash text-primary`};case`Grep`:case`Search`:case`WebSearch`:case`ToolSearch`:return{Icon:w,cls:`bg-accent-wash text-primary`};case`WebFetch`:case`Fetch`:return{Icon:T,cls:`bg-info/15 text-info`};case`Edit`:case`MultiEdit`:case`NotebookEdit`:return{Icon:M,cls:`bg-accent-2/15 text-accent-2`};case`Write`:return{Icon:N,cls:`bg-success/15 text-success`};case`Bash`:case`PowerShell`:return{Icon:x,cls:`bg-panel-2 text-text-2`};case`TodoWrite`:return{Icon:te,cls:`bg-warning/15 text-warning`};case`Task`:case`Agent`:return{Icon:o,cls:`bg-accent-wash text-primary`};case`SendMessage`:return{Icon:m,cls:`bg-info/15 text-info`};case`AskUserQuestion`:return{Icon:a,cls:`bg-accent-wash text-primary`};case`ExitPlanMode`:return{Icon:j,cls:`bg-accent-wash text-primary`};case`Skill`:return{Icon:f,cls:`bg-accent-2/15 text-accent-2`};case`ImageGen`:return{Icon:F,cls:`bg-accent-2/15 text-accent-2`};default:return{Icon:u,cls:`bg-panel-2 text-text-2`}}}function Oe(e){let t=e.type===`approval_request`;return{toolName:e.type===`tool_use`?e.tool:t?e.tool??`Tool`:`Tool`,input:e.type===`tool_use`?e.input:t?e.input??{}:{}}}var ke=new Set([`Read`,`ImageGen`]);function X(e){if(e.type!==`tool_use`||!ke.has(e.tool))return null;let t=e.input?.file_path;return typeof t!=`string`||!/^(\/|[A-Za-z]:[/\\])/.test(t)?null:ue(t)?t:null}function Z({tool:e,result:t,completed:n,projectName:r,bashPartialOutput:i}){let[a,o]=(0,L.useState)(()=>{let n=(e.type,e.tool),r=t?.type===`tool_result`&&!!t.isError;return(n===`Edit`||n===`MultiEdit`)&&!r?!0:!!X(e)});if(e.type===`error`)return(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded bg-error/10 border border-error/20 px-2 py-1.5 text-xs text-error`,children:[(0,R.jsx)(C,{className:`size-3`}),(0,R.jsx)(`span`,{children:e.message})]});let{toolName:l,input:u}=Oe(e),d=t?.type===`tool_result`,f=d&&!!t.isError,m=l===`AskUserQuestion`&&!!u?.answers,h=e.type===`approval_request`&&e.approved!=null,g=(l===`Agent`||l===`Task`)&&e.type===`tool_use`,_=g?e.children:void 0,v=_&&_.length>0,y=g&&e.type===`tool_use`?e.bgStatus:void 0,x=g&&(y!=null||d&&!f&&me(String(t.output??``)))&&y==null,S=y===`failed`||y===`stopped`,w=x?!1:d||m||h||n,T=[`Edit`,`MultiEdit`,`Write`,`NotebookEdit`].includes(l),E=X(e),D=d&&fe(String(t.output??``)),ee=!!E,O=e.type===`tool_use`?e.toolUseId:void 0,k=(l===`Bash`||l===`PowerShell`)&&!d&&O?i?.current?.get(O):void 0,j=!!k;(0,L.useEffect)(()=>{j&&!a&&o(!0)},[j]);let M=(0,L.useRef)(!1);(0,L.useEffect)(()=>{f&&(l===`Edit`||l===`MultiEdit`)&&!M.current&&(M.current=!0,o(!1))},[f,l]);let{Icon:N,cls:P}=De(l,f,!!Y(l,u)),F=l===`AskUserQuestion`||l===`ExitPlanMode`||g;return(0,R.jsxs)(`div`,{"data-tool-ref":O,className:`rounded-[11px] border overflow-hidden text-xs bg-panel ${F?`border-accent-wash-border`:`border-border`}`,children:[(0,R.jsxs)(`button`,{onClick:()=>o(!a),className:`flex items-center gap-2.5 px-2.5 py-2 w-full text-left hover:bg-panel-2/40 transition-colors min-w-0`,children:[(0,R.jsx)(`span`,{className:`inline-flex items-center justify-center size-6 rounded-[7px] shrink-0 ${P}`,children:(0,R.jsx)(N,{className:`size-3.5`})}),(0,R.jsx)(`span`,{className:`truncate text-text font-medium`,children:(0,R.jsx)(Ae,{name:l,input:u})}),(0,R.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 shrink-0`,children:[j&&(0,R.jsxs)(`span`,{className:`text-[10px] text-warning`,children:[k.lineCount,` line`,k.lineCount===1?``:`s`,` streaming…`]}),v&&!j&&(0,R.jsxs)(`span`,{className:`text-[10px] text-text-3 font-mono`,children:[_.length,` steps`]}),x&&(0,R.jsx)(`span`,{className:`text-[10px] text-primary`,children:`running…`}),f||S?(0,R.jsx)(A,{className:`size-3.5 text-error`}):w?(0,R.jsx)(b,{className:`size-3.5 text-success`}):(0,R.jsx)(p,{className:`size-3.5 text-primary animate-spin`}),a?(0,R.jsx)(s,{className:`size-3 text-text-3`}):(0,R.jsx)(c,{className:`size-3 text-text-3`})]})]}),a&&(0,R.jsxs)(`div`,{className:`px-2 pb-2 space-y-1.5 select-text`,children:[(e.type===`tool_use`||e.type===`approval_request`)&&(0,R.jsx)(je,{name:l,input:u,projectName:r,toolUseId:O}),k&&(0,R.jsx)(Ie,{content:k.content,lineCount:k.lineCount}),v&&(0,R.jsx)(Fe,{events:_,projectName:r}),E&&(0,R.jsx)(Ee,{filePath:E,projectName:r??``}),d&&!(T&&!f)&&!(D&&!f)&&!(ee&&!f)&&(0,R.jsx)(Ne,{toolName:l,output:t.output})]})]})}function Ae({name:e,input:t}){let n=e=>String(e??``);switch(e){case`Read`:case`Write`:case`Edit`:case`MultiEdit`:case`NotebookEdit`:return(0,R.jsxs)(R.Fragment,{children:[e,` `,(0,R.jsx)(`span`,{className:`text-text-subtle`,children:g(n(t.file_path))})]});case`Bash`:case`PowerShell`:{let r=t.description?n(t.description):n(t.command);return(0,R.jsxs)(R.Fragment,{children:[e,` `,(0,R.jsx)(`span`,{className:`text-text-subtle${t.description?``:` font-mono`}`,children:$(r,60)})]})}case`Glob`:return(0,R.jsxs)(R.Fragment,{children:[e,` `,(0,R.jsx)(`span`,{className:`font-mono text-text-subtle`,children:n(t.pattern)})]});case`Grep`:return(0,R.jsxs)(R.Fragment,{children:[e,` `,(0,R.jsx)(`span`,{className:`font-mono text-text-subtle`,children:$(n(t.pattern),40)})]});case`WebSearch`:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(w,{className:`size-3 inline`}),` `,e,` `,(0,R.jsx)(`span`,{className:`text-text-subtle`,children:$(n(t.query),50)})]});case`WebFetch`:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(T,{className:`size-3 inline`}),` `,e,` `,(0,R.jsx)(`span`,{className:`text-text-subtle`,children:$(n(t.url),50)})]});case`ToolSearch`:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(w,{className:`size-3 inline`}),` `,e,` `,(0,R.jsx)(`span`,{className:`text-text-subtle`,children:$(n(t.query),50)})]});case`ImageGen`:{let e=(n(t.prompt).split(`
|
|
4
4
|
`).find(e=>e.trim())??``)||g(n(t.file_path));return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(F,{className:`size-3 inline`}),` Image`,(0,R.jsxs)(`span`,{className:`text-text-subtle`,children:[` `,$(e,50)]})]})}case`Agent`:case`Task`:{let r=Y(e,t),i=$(n(t.description||t.prompt),r?44:60);return(0,R.jsxs)(R.Fragment,{children:[!r&&(0,R.jsx)(o,{className:`size-3 inline`}),` `,e,` `,r&&(0,R.jsx)(`span`,{className:`text-text-primary font-medium`,children:r}),(0,R.jsx)(`span`,{className:`text-text-subtle`,children:r?` · ${i}`:i})]})}case`SendMessage`:return(0,R.jsx)(oe,{name:e,input:t});case`TodoWrite`:{let n=Array.isArray(t.todos)?t.todos:[],r=n.filter(e=>e.status===`completed`).length;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(I,{className:`size-3 inline`}),` `,e,` `,(0,R.jsxs)(`span`,{className:`text-text-subtle`,children:[r,`/`,n.length,` done`]})]})}case`AskUserQuestion`:{let n=Array.isArray(t.questions)?t.questions:[],r=!!t.answers;return(0,R.jsxs)(R.Fragment,{children:[e,` `,(0,R.jsxs)(`span`,{className:`text-text-subtle`,children:[n.length,` question`,n.length===1?``:`s`,r?` ✓`:``]})]})}case`ScheduleWakeup`:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(l,{className:`size-3 inline`}),` `,e,` `,(0,R.jsxs)(`span`,{className:`text-text-subtle`,children:[`in `,Be(Number(t.delaySeconds)),t.reason?` — ${$(n(t.reason),50)}`:``]})]});case`TaskCreate`:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(I,{className:`size-3 inline`}),` `,e,` `,(0,R.jsx)(`span`,{className:`text-text-subtle`,children:$(n(t.subject),60)})]});case`TaskUpdate`:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(I,{className:`size-3 inline`}),` `,e,` `,(0,R.jsxs)(`span`,{className:`text-text-subtle`,children:[`#`,n(t.taskId),` → `,n(t.status)]})]});case`TaskStop`:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(I,{className:`size-3 inline`}),` `,e,` `,(0,R.jsxs)(`span`,{className:`text-text-subtle`,children:[`#`,n(t.taskId),` stopped`]})]});default:return(0,R.jsx)(R.Fragment,{children:e})}}function je({name:e,input:t,projectName:n,toolUseId:r}){let i=e=>String(e??``),{openTab:a}=_(S(e=>({openTab:e.openTab}))),o=e=>{n&&a({type:`editor`,title:g(e),metadata:{filePath:e,projectName:n},projectId:n,closable:!0})},s=(e,t,r)=>{a({type:`git-diff`,title:`Diff ${g(e)}`,metadata:{filePath:e,projectName:n,original:t,modified:r},projectId:n??null,closable:!0})};switch(e){case`Bash`:case`PowerShell`:return(0,R.jsxs)(`div`,{className:`space-y-1`,children:[!!t.description&&(0,R.jsx)(`p`,{className:`text-text-subtle italic`,children:i(t.description)}),(0,R.jsx)(`pre`,{className:`font-mono text-text-secondary overflow-x-auto whitespace-pre-wrap break-all`,children:i(t.command)})]});case`Read`:case`Write`:case`Edit`:case`MultiEdit`:case`NotebookEdit`:{let n=i(t.notebook_path||t.file_path),a=e===`Edit`&&(!!t.old_string||!!t.new_string),c=e=>r?`${r}-${e}`:void 0;return(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsxs)(`button`,{type:`button`,className:`font-mono text-text-secondary break-all hover:text-primary hover:underline text-left flex items-center gap-1 min-w-0`,onClick:()=>o(n),title:`Open file in editor`,children:[(0,R.jsx)(y,{className:`size-3 shrink-0`}),n]}),a&&(0,R.jsxs)(`button`,{type:`button`,className:`text-text-subtle hover:text-primary hover:underline flex items-center gap-1 shrink-0 whitespace-nowrap`,onClick:()=>s(n,i(t.old_string),i(t.new_string)),title:`View diff in new tab`,children:[(0,R.jsx)(d,{className:`size-3 shrink-0`}),`View Diff`]})]}),a&&(0,R.jsx)(`div`,{"data-edit-ref":c(0),children:(0,R.jsx)(ze,{oldStr:i(t.old_string),newStr:i(t.new_string),filePath:n})}),e===`MultiEdit`&&Array.isArray(t.edits)&&(0,R.jsx)(`div`,{className:`space-y-1.5`,children:t.edits.map((e,t)=>(0,R.jsxs)(`div`,{"data-edit-ref":c(t),className:`space-y-0.5`,children:[(0,R.jsxs)(`p`,{className:`text-text-subtle text-[10px]`,children:[`Edit `,t+1]}),(0,R.jsx)(ze,{oldStr:i(e.old_string),newStr:i(e.new_string),filePath:n})]},t))}),e===`Write`&&!!t.content&&(0,R.jsx)(`pre`,{"data-edit-ref":c(0),className:`font-mono text-text-subtle overflow-x-auto max-h-32 whitespace-pre-wrap`,children:$(i(t.content),300)})]})}case`Glob`:return(0,R.jsxs)(`p`,{className:`font-mono text-text-secondary`,children:[i(t.pattern),t.path?` in ${i(t.path)}`:``]});case`Grep`:return(0,R.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,R.jsxs)(`p`,{className:`font-mono text-text-secondary`,children:[`/`,i(t.pattern),`/`]}),!!t.path&&(0,R.jsxs)(`p`,{className:`text-text-subtle`,children:[`in `,i(t.path)]})]});case`TodoWrite`:return(0,R.jsx)(Me,{todos:t.todos??[]});case`Agent`:case`Task`:{let n=Y(e,t);return(0,R.jsxs)(`div`,{className:`space-y-1`,children:[!!n&&(0,R.jsxs)(`p`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`text-text-subtle`,children:`Name`}),(0,R.jsx)(`span`,{className:`font-medium text-text-primary`,children:n}),(0,R.jsx)(`span`,{className:`inline-block rounded px-1.5 py-0.5 text-[10px] bg-accent-2/15 text-accent-2`,children:`teammate`}),t.isolation===`worktree`&&(0,R.jsx)(`span`,{className:`inline-block rounded px-1.5 py-0.5 text-[10px] bg-panel-2 text-text-3`,children:`worktree`})]}),!!t.description&&(0,R.jsx)(`p`,{className:`text-text-secondary font-medium`,children:i(t.description)}),!!t.subagent_type&&(0,R.jsxs)(`p`,{className:`text-text-subtle`,children:[`Type: `,i(t.subagent_type)]}),!!t.prompt&&(0,R.jsx)(z,{content:i(t.prompt),maxHeight:`max-h-48`})]})}case`SendMessage`:return(0,R.jsx)(se,{input:t});case`ToolSearch`:return(0,R.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,R.jsx)(`p`,{className:`font-mono text-text-secondary`,children:i(t.query)}),!!t.max_results&&(0,R.jsxs)(`p`,{className:`text-text-subtle`,children:[`Max results: `,i(t.max_results)]})]});case`WebFetch`:return(0,R.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,R.jsxs)(`a`,{href:i(t.url),target:`_blank`,rel:`noopener noreferrer`,className:`font-mono text-primary hover:underline break-all flex items-center gap-1`,children:[(0,R.jsx)(T,{className:`size-3 shrink-0`}),i(t.url)]}),!!t.prompt&&(0,R.jsx)(`p`,{className:`text-text-subtle`,children:$(i(t.prompt),100)})]});case`AskUserQuestion`:{let e=t.questions??[],n=t.answers??{};return(0,R.jsx)(`div`,{className:`space-y-2`,children:e.map((e,t)=>(0,R.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,R.jsxs)(`p`,{className:`text-text-primary font-medium`,children:[e.header?`${e.header}: `:``,e.question]}),(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.options.map((t,r)=>(0,R.jsx)(`span`,{className:`inline-block rounded px-1.5 py-0.5 text-xs border ${(n[e.question]??``).split(`, `).includes(t.label)?`border-primary bg-primary/20 text-text-primary`:`border-border text-text-subtle`}`,children:t.label},r))}),n[e.question]&&(0,R.jsxs)(`p`,{className:`text-foreground text-xs`,children:[`Answer: `,n[e.question]]})]},t))})}case`ScheduleWakeup`:{let e=Number(t.delaySeconds)||0;return(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsxs)(`p`,{className:`text-text-secondary`,children:[(0,R.jsx)(l,{className:`size-3 inline mr-1`}),`Wake in `,(0,R.jsx)(`span`,{className:`font-medium text-text-primary`,children:Be(e)}),(0,R.jsxs)(`span`,{className:`text-text-subtle`,children:[` (`,e,`s)`]})]}),!!t.reason&&(0,R.jsx)(`p`,{className:`text-text-secondary italic`,children:i(t.reason)}),!!t.prompt&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`text-text-subtle text-[10px] mb-0.5`,children:`Prompt on wake`}),(0,R.jsx)(z,{content:i(t.prompt),maxHeight:`max-h-48`})]})]})}case`TaskCreate`:return(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsx)(`p`,{className:`text-text-primary font-medium`,children:i(t.subject)}),!!t.description&&(0,R.jsx)(`p`,{className:`text-text-subtle`,children:i(t.description)}),!!t.activeForm&&(0,R.jsx)(`p`,{className:`text-text-subtle italic`,children:i(t.activeForm)})]});case`TaskUpdate`:return(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsxs)(`span`,{className:`font-mono text-text-secondary`,children:[`#`,i(t.taskId)]}),(0,R.jsx)(Q,{status:i(t.status)})]});case`TaskStop`:return(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsxs)(`span`,{className:`font-mono text-text-secondary`,children:[`#`,i(t.taskId)]}),(0,R.jsx)(Q,{status:`stopped`})]});case`ImageGen`:return(0,R.jsxs)(`div`,{className:`space-y-1`,children:[!!t.prompt&&(0,R.jsx)(`p`,{className:`text-text-secondary whitespace-pre-wrap`,children:i(t.prompt)}),t.transparentBackground===!0&&(0,R.jsx)(`p`,{className:`text-text-subtle`,children:`Transparent background`})]});default:return(0,R.jsx)(`pre`,{className:`overflow-x-auto text-text-secondary font-mono whitespace-pre-wrap break-all`,children:JSON.stringify(t,null,2)})}}function Q({status:e}){return(0,R.jsx)(`span`,{className:`inline-block rounded px-1.5 py-0.5 text-[10px] border ${e===`completed`?`text-success border-success/30 bg-success/10`:e===`in_progress`?`text-warning border-warning/30 bg-warning/10`:`text-text-subtle border-border bg-surface`}`,children:e})}function Me({todos:e}){return(0,R.jsx)(`div`,{className:`space-y-0.5`,children:e.map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[(0,R.jsx)(`span`,{className:`shrink-0 mt-0.5 ${e.status===`completed`?`text-success`:e.status===`in_progress`?`text-warning`:`text-text-subtle`}`,children:e.status===`completed`?`✓`:e.status===`in_progress`?`▶`:`○`}),(0,R.jsx)(`span`,{className:e.status===`completed`?`line-through text-text-subtle`:`text-text-secondary`,children:e.content})]},t))})}function Ne({toolName:e,output:t}){let[n,r]=(0,L.useState)(!1),i=(0,L.useMemo)(()=>{if(e!==`Agent`&&e!==`Task`)return null;try{let e=JSON.parse(t);if(Array.isArray(e)){let t=e.filter(e=>e.type===`text`&&e.text).map(e=>e.text).join(`
|
|
5
5
|
|