@cuongtran001/kanna 1.41.6 → 1.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/client/assets/BoardsPage-Bj2Crk7N.js +1 -0
  2. package/dist/client/assets/BoardsRoutePage-DwEgTFHY.js +1 -0
  3. package/dist/client/assets/ChatPreferenceControls-CIjhWP4p.js +56 -0
  4. package/dist/client/assets/CronJobsPage-DZau0FH0.js +1 -0
  5. package/dist/client/assets/CronRunMessage-Gq1oWvqg.js +11 -0
  6. package/dist/client/assets/LocalProjectsPage-DQ16ADLr.js +1 -0
  7. package/dist/client/assets/SettingsPage-CS3fUoKq.js +79 -0
  8. package/dist/client/assets/StackBoardsRoutePage-ToauPGm0.js +1 -0
  9. package/dist/client/assets/WorkflowsPage-CKG-2pXu.js +6 -0
  10. package/dist/client/assets/WorkflowsSection-DlQHEM8l.js +173 -0
  11. package/dist/client/assets/{arc-B9Y7oMUw.js → arc-6k0AAR6N.js} +1 -1
  12. package/dist/client/assets/architectureDiagram-3BPJPVTR-DH4bfQn7.js +36 -0
  13. package/dist/client/assets/{blockDiagram-GPEHLZMM-DQS8Oiwu.js → blockDiagram-GPEHLZMM-BJ0CHocc.js} +1 -1
  14. package/dist/client/assets/{c4Diagram-AAUBKEIU-ngMU3zdQ.js → c4Diagram-AAUBKEIU-CAucQI2K.js} +1 -1
  15. package/dist/client/assets/channel-fdb_OeYx.js +1 -0
  16. package/dist/client/assets/{chunk-2J33WTMH-DSqxrydI.js → chunk-2J33WTMH-NEuDoDLQ.js} +1 -1
  17. package/dist/client/assets/{chunk-4BX2VUAB-B2XxDfkr.js → chunk-4BX2VUAB-CaVpK7-e.js} +1 -1
  18. package/dist/client/assets/{chunk-55IACEB6-DsyfrIeG.js → chunk-55IACEB6-3TJmz8jB.js} +1 -1
  19. package/dist/client/assets/{chunk-727SXJPM-CobncF96.js → chunk-727SXJPM-BBS6-7E4.js} +1 -1
  20. package/dist/client/assets/{chunk-AQP2D5EJ-2zp7_DYP.js → chunk-AQP2D5EJ-BDxBeBbC.js} +1 -1
  21. package/dist/client/assets/{chunk-FMBD7UC4-WlTbypT2.js → chunk-FMBD7UC4-BJg3ZE7y.js} +1 -1
  22. package/dist/client/assets/{chunk-ND2GUHAM-CLx77xbF.js → chunk-ND2GUHAM-CZ15zZYS.js} +1 -1
  23. package/dist/client/assets/{chunk-QZHKN3VN-B4l70r-9.js → chunk-QZHKN3VN-Bl2Ve9t8.js} +1 -1
  24. package/dist/client/assets/classDiagram-4FO5ZUOK-DTN7ZAy4.js +1 -0
  25. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-DTN7ZAy4.js +1 -0
  26. package/dist/client/assets/columnStyle-BBfIeoZk.js +1 -0
  27. package/dist/client/assets/cose-bilkent-S5V4N54A-WnEFXk7h.js +1 -0
  28. package/dist/client/assets/{dagre-BM42HDAG-CHzcMKE4.js → dagre-BM42HDAG-CdaESrCs.js} +1 -1
  29. package/dist/client/assets/{diagram-2AECGRRQ-BiMFzoYM.js → diagram-2AECGRRQ-qrdMjPfL.js} +1 -1
  30. package/dist/client/assets/{diagram-5GNKFQAL-d-2r7-B9.js → diagram-5GNKFQAL-BgDn2xEy.js} +1 -1
  31. package/dist/client/assets/{diagram-KO2AKTUF-BuGys3Li.js → diagram-KO2AKTUF-Cs9PdUv9.js} +1 -1
  32. package/dist/client/assets/{diagram-LMA3HP47-B_T8a17f.js → diagram-LMA3HP47-B6sXmhV3.js} +1 -1
  33. package/dist/client/assets/{diagram-OG6HWLK6-iqF9USqm.js → diagram-OG6HWLK6-szGHhLsS.js} +1 -1
  34. package/dist/client/assets/{erDiagram-TEJ5UH35-DzDAZqEy.js → erDiagram-TEJ5UH35-CL19XW1x.js} +1 -1
  35. package/dist/client/assets/external-link-CEHxz8hW.js +6 -0
  36. package/dist/client/assets/{flowDiagram-I6XJVG4X-KisBDel-.js → flowDiagram-I6XJVG4X-Ds_FDS2h.js} +1 -1
  37. package/dist/client/assets/folder-PbmkrgCS.js +6 -0
  38. package/dist/client/assets/ganttDiagram-6RSMTGT7-bgzjdywz.js +292 -0
  39. package/dist/client/assets/{gitGraphDiagram-PVQCEYII-C7DY4Eee.js → gitGraphDiagram-PVQCEYII-C0YtRZaj.js} +1 -1
  40. package/dist/client/assets/index-B-Dgv9vc.js +333 -0
  41. package/dist/client/assets/index-C7q7I53R.css +32 -0
  42. package/dist/client/assets/index-Ck-A9Fbx.js +1719 -0
  43. package/dist/client/assets/index-CpOZ_0k6.js +153 -0
  44. package/dist/client/assets/index-_pacsCfy.js +297 -0
  45. package/dist/client/assets/{index-BByp1w2r.js → index-gtbL8xqQ.js} +1 -1
  46. package/dist/client/assets/{infoDiagram-5YYISTIA-ClUFosKG.js → infoDiagram-5YYISTIA-vR5DWbyS.js} +1 -1
  47. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-DToWPoZl.js → ishikawaDiagram-YF4QCWOH-yttYHeId.js} +1 -1
  48. package/dist/client/assets/{journeyDiagram-JHISSGLW-DSLSfmX3.js → journeyDiagram-JHISSGLW-Dqu6DkYF.js} +1 -1
  49. package/dist/client/assets/{kanban-definition-UN3LZRKU-ByOJ6V2l.js → kanban-definition-UN3LZRKU-D-bajoGp.js} +1 -1
  50. package/dist/client/assets/{linear-BupDI92H.js → linear-B9szucwV.js} +1 -1
  51. package/dist/client/assets/{mermaid.core-DDXvCx1b.js → mermaid.core-DcDN5vfE.js} +4 -4
  52. package/dist/client/assets/{mindmap-definition-RKZ34NQL-X1-P7Pba.js → mindmap-definition-RKZ34NQL-DAo1awdb.js} +1 -1
  53. package/dist/client/assets/monitor-B4KkWes1.js +6 -0
  54. package/dist/client/assets/{pieDiagram-4H26LBE5-BQTNyCDb.js → pieDiagram-4H26LBE5-CChdHJK3.js} +1 -1
  55. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-BOaO8zMB.js → quadrantDiagram-W4KKPZXB-DH27TOWM.js} +1 -1
  56. package/dist/client/assets/{requirementDiagram-4Y6WPE33-BI40F13W.js → requirementDiagram-4Y6WPE33-DlM6CJr3.js} +1 -1
  57. package/dist/client/assets/{sankeyDiagram-5OEKKPKP-GpPjyL8U.js → sankeyDiagram-5OEKKPKP-DKaYT01c.js} +1 -1
  58. package/dist/client/assets/search-DMhCr8LP.js +16 -0
  59. package/dist/client/assets/{sequenceDiagram-3UESZ5HK-DFkcjnWj.js → sequenceDiagram-3UESZ5HK-Bh-_9F0J.js} +1 -1
  60. package/dist/client/assets/settings-header-button-DOTVcRlN.js +1 -0
  61. package/dist/client/assets/{stateDiagram-AJRCARHV-euB2-tSC.js → stateDiagram-AJRCARHV-Uawnew0c.js} +1 -1
  62. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-XpwZa7CV.js +1 -0
  63. package/dist/client/assets/terminal-Bg_9x1Mp.js +11 -0
  64. package/dist/client/assets/{timeline-definition-PNZ67QCA-CiNsaxWa.js → timeline-definition-PNZ67QCA-BXyeMTj6.js} +1 -1
  65. package/dist/client/assets/{vennDiagram-CIIHVFJN-BoUXv9Cy.js → vennDiagram-CIIHVFJN-D5M43-cV.js} +1 -1
  66. package/dist/client/assets/{wardley-L42UT6IY-BnFa8Qyo.js → wardley-L42UT6IY-DzOxLq4t.js} +1 -1
  67. package/dist/client/assets/{wardleyDiagram-YWT4CUSO-DnC4zNIP.js → wardleyDiagram-YWT4CUSO-EdnV9eg-.js} +1 -1
  68. package/dist/client/assets/{xychartDiagram-2RQKCTM6-DjVNHNcf.js → xychartDiagram-2RQKCTM6-km4mWGBa.js} +1 -1
  69. package/dist/client/index.html +2 -2
  70. package/package.json +3 -2
  71. package/src/server/agent-coordinator.ts +27 -1
  72. package/src/server/agent.turn-tokens-metric.test.ts +153 -0
  73. package/src/server/claude-session-runner.ts +4 -0
  74. package/src/server/claude-session-state.ts +11 -0
  75. package/src/server/claude-turn-runner.ts +4 -0
  76. package/src/server/design/tone-pairings.test.ts +16 -0
  77. package/src/server/design/ui-source-contract.test.ts +36 -0
  78. package/src/server/observability.ts +36 -0
  79. package/src/server/subagent-orchestrator.ts +18 -0
  80. package/src/server/test-helpers/metric-recorder.ts +34 -18
  81. package/src/shared/design/tone-pairings.ts +1 -0
  82. package/src/shared/token-pricing.test.ts +84 -1
  83. package/src/shared/token-pricing.ts +42 -0
  84. package/dist/client/assets/architectureDiagram-3BPJPVTR-dA88JVfp.js +0 -36
  85. package/dist/client/assets/channel-BanydOky.js +0 -1
  86. package/dist/client/assets/classDiagram-4FO5ZUOK-CZQqoMrn.js +0 -1
  87. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-CZQqoMrn.js +0 -1
  88. package/dist/client/assets/cose-bilkent-S5V4N54A-Di6gZAyF.js +0 -1
  89. package/dist/client/assets/ganttDiagram-6RSMTGT7-fOvvHVMi.js +0 -292
  90. package/dist/client/assets/index-B9Cnxpmv.js +0 -2846
  91. package/dist/client/assets/index-CiKd-0SZ.css +0 -32
  92. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-Dh5KQHuQ.js +0 -1
@@ -0,0 +1 @@
1
+ import{l as I,r as o,j as t,B as T,P as R,I as A,d as E,m as z,n as O,E as _,o as $}from"./index-B-Dgv9vc.js";import{u as C,s as D,o as w,C as L}from"./columnStyle-BBfIeoZk.js";const F=[],u=I()(e=>({templates:F,openMenuId:null,picking:!1,renamingId:null,error:null,setTemplates:s=>e({templates:Array.isArray(s)?s:[]}),openMenu:s=>e({openMenuId:s}),closeMenu:()=>e({openMenuId:null}),openPicker:()=>e({picking:!0,error:null}),closePicker:()=>e({picking:!1}),startRename:s=>e({renamingId:s,picking:!1,openMenuId:null}),stopRename:()=>e({renamingId:null}),setError:s=>e({error:s})}));function U(e){return e.templates}function K({ownerKind:e,ownerId:s,ownerName:a,socket:c,onOpenBoard:l}){const r=w(e,s),i=C(D(r)),x=u(U),p=u(n=>n.picking),h=u(n=>n.renamingId),d=u(n=>n.error),{openPicker:f,closePicker:j,startRename:B,stopRename:k,setError:y,setTemplates:N}=u.getState();o.useEffect(()=>c.subscribe({type:"boards",ownerKind:e,ownerId:s},n=>{C.getState().setBoards(w(n.ownerKind,n.ownerId),n.boards)}),[e,s,c]),o.useEffect(()=>{let n=!1;return c.command({type:"board.templates.list"}).then(m=>{n||N(m)}).catch(()=>{}),()=>{n=!0}},[c,N]);const g=o.useCallback(async n=>{try{await c.command(n),y(null)}catch(m){y(m instanceof Error?m.message:"That did not work.")}},[c,y]),P=o.useCallback(n=>{j(),g({type:"board.create",ownerKind:e,ownerId:s,title:n?n.name:"Untitled board",templateId:(n==null?void 0:n.id)??null})},[j,e,s,g]),M=o.useCallback((n,m)=>{k();const v=m.trim();v!==""&&g({type:"board.update",boardId:n,title:v})},[g,k]),S=p||i.length===0;return t.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-background",children:[t.jsxs("header",{className:"flex items-end justify-between gap-4 border-b border-border px-6 py-4",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("h1",{className:"text-lg font-medium leading-tight tracking-[-0.01em] text-foreground",children:"Boards"}),t.jsxs("p",{className:"truncate text-13 text-muted-foreground",children:[a,i.length>0?t.jsxs("span",{className:"tabular-nums",children:[" · ",i.length," boards"]}):null]})]}),i.length>0?t.jsxs(T,{size:"sm",onClick:f,children:[t.jsx(R,{className:"size-3.5"}),"New board"]}):null]}),d?t.jsx("p",{className:"border-b border-border px-6 py-2 text-13 text-destructive-text",children:d}):null,t.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[S?t.jsx(q,{templates:x,firstRun:i.length===0,onPick:P,onCancel:j}):null,i.length>0?t.jsx("ul",{className:"px-4 py-1",children:i.map(n=>t.jsx(V,{board:n,renaming:h===n.id,onOpen:l,onStartRename:B,onRename:M,onCancelRename:k,onCommand:g},n.id))}):null]})]})}function V({board:e,renaming:s,onOpen:a,onStartRename:c,onRename:l,onCancelRename:r,onCommand:i}){const x=o.useCallback(()=>a(e.id),[e.id,a]),p=o.useCallback(d=>{d.key==="Enter"&&l(e.id,d.currentTarget.value),d.key==="Escape"&&r()},[e.id,r,l]),h=o.useCallback(d=>l(e.id,d.currentTarget.value),[e.id,l]);return t.jsxs("li",{className:"group grid grid-cols-[1fr_auto_auto] items-center gap-5 border-b border-border px-3 py-3 last:border-b-0 hover:bg-secondary",children:[t.jsx("div",{className:"min-w-0",children:s?t.jsx(A,{autoFocus:!0,defaultValue:e.title,onKeyDown:p,onBlur:h,className:"h-7 max-w-sm","aria-label":"Board name"}):t.jsxs("button",{type:"button",onClick:x,className:"block w-full text-left",children:[t.jsx("span",{className:"block truncate text-15 font-semibold tracking-[-0.005em] text-foreground",children:e.title}),e.description?t.jsx("span",{className:"mt-0.5 block truncate text-13 text-muted-foreground",children:e.description}):null]})}),t.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[t.jsxs("span",{children:[t.jsx("b",{className:"font-medium tabular-nums text-foreground",children:e.columnCount})," columns"]}),t.jsxs("span",{children:[t.jsx("b",{className:"font-medium tabular-nums text-foreground",children:e.cardCount})," cards"]})]}),t.jsx(Y,{board:e,onStartRename:c,onCommand:i})]})}function Y({board:e,onStartRename:s,onCommand:a}){const c=u(f=>f.openMenuId===e.id),{openMenu:l,closeMenu:r}=u.getState(),i=o.useCallback(f=>{f?l(e.id):r()},[e.id,r,l]),x=o.useCallback(()=>{r(),s(e.id)},[e.id,r,s]),p=o.useCallback(()=>{r(),a({type:"board.duplicate",boardId:e.id,title:`${e.title} copy`})},[e.id,e.title,r,a]),h=o.useCallback(()=>{r(),a({type:"board.saveAsTemplate",boardId:e.id,name:e.title})},[e.id,e.title,r,a]),d=o.useCallback(()=>{r(),a({type:"board.archive",boardId:e.id})},[e.id,r,a]);return t.jsxs(z,{open:c,onOpenChange:i,children:[t.jsx(O,{asChild:!0,children:t.jsx("button",{type:"button","aria-label":`Actions for ${e.title}`,className:"rounded-md px-1.5 py-1 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 data-[state=open]:opacity-100",children:t.jsx(_,{className:"size-4"})})}),t.jsxs($,{align:"end",className:"w-56 p-1",children:[t.jsx(b,{onClick:x,children:"Rename"}),t.jsx(b,{onClick:p,children:"Duplicate structure"}),t.jsx(b,{onClick:h,children:"Save as template"}),t.jsx("div",{className:"my-1 h-px bg-border"}),t.jsx(b,{onClick:d,tone:"destructive",children:"Archive"})]})]})}function b({onClick:e,children:s,tone:a}){return t.jsx("button",{type:"button",onClick:e,className:E("flex w-full items-center rounded-sm px-2 py-1.5 text-left text-xs font-medium hover:bg-secondary",a==="destructive"&&"text-destructive-text"),children:s})}function q({templates:e,firstRun:s,onPick:a,onCancel:c}){const l=o.useCallback(()=>a(null),[a]);return t.jsxs("div",{className:"px-6 py-8",children:[s?t.jsxs(t.Fragment,{children:[t.jsx("h2",{className:"text-15 font-semibold text-foreground",children:"No boards yet."}),t.jsx("p",{className:"mt-1 max-w-[58ch] text-sm text-muted-foreground",children:"A board turns issues into work your agents can pick up. Start from a shape, or import an existing tracker."})]}):t.jsx("h2",{className:"text-15 font-semibold text-foreground",children:"Start from a shape"}),t.jsxs("div",{className:"mt-4 max-w-xl rounded-lg border border-border",children:[e.map(r=>t.jsx(G,{template:r,onPick:a},r.id)),t.jsx("button",{type:"button",onClick:l,className:"flex w-full items-center border-t border-border px-3.5 py-2.5 text-left hover:bg-secondary",children:t.jsxs("span",{children:[t.jsx("span",{className:"block text-sm font-medium text-foreground",children:"Empty board"}),t.jsx("span",{className:"block text-xs text-muted-foreground",children:"Name your own columns"})]})})]}),s?null:t.jsx(T,{variant:"ghost",size:"sm",className:"mt-3",onClick:c,children:"Cancel"})]})}function G({template:e,onPick:s}){const a=o.useCallback(()=>s(e),[s,e]),c=e.definition.columns;return t.jsxs("button",{type:"button",onClick:a,className:"flex w-full items-center gap-3 border-b border-border px-3.5 py-2.5 text-left last:border-b-0 hover:bg-secondary",children:[t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"block text-sm font-medium text-foreground",children:e.name}),t.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:c.map(l=>l.title).join(" · ")})]}),t.jsx("span",{"aria-hidden":!0,className:"ml-auto flex shrink-0 gap-1",children:c.map((l,r)=>t.jsx("span",{className:E("size-1.5 rounded-full",l.colorToken?L[l.colorToken]:"bg-muted-icon")},`${e.id}-${String(r)}`))})]})}export{K as B};
@@ -0,0 +1 @@
1
+ import{u as p,a as i,b as d,g as u,r as l,j as r}from"./index-B-Dgv9vc.js";import{B as m}from"./BoardsPage-Bj2Crk7N.js";import"./columnStyle-BBfIeoZk.js";function P(){const o=p(),t=i(),{projectId:e=""}=d(),s=[...o.sidebarData.starredProjectGroups,...o.sidebarData.projectGroups].find(a=>a.groupKey===e),n=s?u(s.localPath):"Project",c=l.useCallback(a=>{t(`/boards/${e}/${a}`)},[t,e]);return r.jsx("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:r.jsx(m,{ownerKind:"project",ownerId:e,ownerName:n,socket:o.socket,onOpenBoard:c})})}export{P as BoardsRoutePage};
@@ -0,0 +1,56 @@
1
+ import{c as U,r,a2 as Dt,a3 as Le,j as e,a4 as Ot,a5 as Me,a6 as z,a7 as Q,a8 as D,a9 as $e,aa as Bt,ab as Vt,ac as Ht,ad as k,ae as Ft,af as Ke,ag as Wt,ah as Ut,ai as $t,aj as Kt,ak as qt,al as zt,am as Gt,an as Zt,ao as Xt,ap as Yt,d as M,_ as Qt,aq as Jt,p as qe,ar as eo,as as to,at as oo,H as no,au as De,av as ro,aw as Ce,ax as Oe,m as ze,n as Ge,o as Ze}from"./index-B-Dgv9vc.js";import{L as Be,S as so}from"./search-DMhCr8LP.js";/**
2
+ * @license lucide-react v0.562.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const ao=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],pn=U("bot",ao);/**
7
+ * @license lucide-react v0.562.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const co=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],Ie=U("box",co);/**
12
+ * @license lucide-react v0.562.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const lo=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Xe=U("chevron-down",lo);/**
17
+ * @license lucide-react v0.562.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const io=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],uo=U("chevron-up",io);/**
22
+ * @license lucide-react v0.562.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const po=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],he=U("gauge",po);/**
27
+ * @license lucide-react v0.562.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const fo=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],fn=U("key-round",fo);/**
32
+ * @license lucide-react v0.562.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const ho=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],Ve=U("lock-open",ho);/**
37
+ * @license lucide-react v0.562.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */const mo=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],xo=U("lock",mo);/**
42
+ * @license lucide-react v0.562.0 - ISC
43
+ *
44
+ * This source code is licensed under the ISC license.
45
+ * See the LICENSE file in the root directory of this source tree.
46
+ */const go=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],hn=U("settings-2",go);/**
47
+ * @license lucide-react v0.562.0 - ISC
48
+ *
49
+ * This source code is licensed under the ISC license.
50
+ * See the LICENSE file in the root directory of this source tree.
51
+ */const vo=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 8h10",key:"1jw688"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h10",key:"wp8him"}]],He=U("square-menu",vo);/**
52
+ * @license lucide-react v0.562.0 - ISC
53
+ *
54
+ * This source code is licensed under the ISC license.
55
+ * See the LICENSE file in the root directory of this source tree.
56
+ */const wo=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}]],Fe=U("square-minus",wo);function We(t,[o,n]){return Math.min(n,Math.max(o,t))}function So(t){const o=r.useRef({value:t,previous:t});return r.useMemo(()=>(o.current.value!==t&&(o.current.previous=o.current.value,o.current.value=t),o.current.previous),[t])}var yo=[" ","Enter","ArrowUp","ArrowDown"],bo=[" ","Enter"],re="Select",[xe,ge,jo]=Bt(re),[ie]=Wt(re,[jo,$e]),ve=$e(),[No,J]=ie(re),[Co,Io]=ie(re),Ye=t=>{const{__scopeSelect:o,children:n,open:a,defaultOpen:s,onOpenChange:i,value:d,defaultValue:l,onValueChange:c,dir:f,name:w,autoComplete:y,disabled:b,required:I,form:u}=t,h=ve(o),[S,j]=r.useState(null),[m,p]=r.useState(null),[A,P]=r.useState(!1),te=Dt(f),[R,O]=Le({prop:a,defaultProp:s??!1,onChange:i,caller:re}),[H,$]=Le({prop:d,defaultProp:l,onChange:c,caller:re}),B=r.useRef(null),V=S?u||!!S.closest("form"):!0,[F,v]=r.useState(new Set),g=Array.from(F).map(E=>E.props.value).join(";");return e.jsx(Ot,{...h,children:e.jsxs(No,{required:I,scope:o,trigger:S,onTriggerChange:j,valueNode:m,onValueNodeChange:p,valueNodeHasChildren:A,onValueNodeHasChildrenChange:P,contentId:Me(),value:H,onValueChange:$,open:R,onOpenChange:O,dir:te,triggerPointerDownPosRef:B,disabled:b,children:[e.jsx(xe.Provider,{scope:o,children:e.jsx(Co,{scope:t.__scopeSelect,onNativeOptionAdd:r.useCallback(E=>{v(K=>new Set(K).add(E))},[]),onNativeOptionRemove:r.useCallback(E=>{v(K=>{const G=new Set(K);return G.delete(E),G})},[]),children:n})}),V?e.jsxs(bt,{"aria-hidden":!0,required:I,tabIndex:-1,name:w,autoComplete:y,value:H,onChange:E=>$(E.target.value),disabled:b,form:u,children:[H===void 0?e.jsx("option",{value:""}):null,Array.from(F)]},g):null]})})};Ye.displayName=re;var Qe="SelectTrigger",Je=r.forwardRef((t,o)=>{const{__scopeSelect:n,disabled:a=!1,...s}=t,i=ve(n),d=J(Qe,n),l=d.disabled||a,c=z(o,d.onTriggerChange),f=ge(n),w=r.useRef("touch"),[y,b,I]=Nt(h=>{const S=f().filter(p=>!p.disabled),j=S.find(p=>p.value===d.value),m=Ct(S,h,j);m!==void 0&&d.onValueChange(m.value)}),u=h=>{l||(d.onOpenChange(!0),I()),h&&(d.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)})};return e.jsx(Ht,{asChild:!0,...i,children:e.jsx(D.button,{type:"button",role:"combobox","aria-controls":d.contentId,"aria-expanded":d.open,"aria-required":d.required,"aria-autocomplete":"none",dir:d.dir,"data-state":d.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":jt(d.value)?"":void 0,...s,ref:c,onClick:k(s.onClick,h=>{h.currentTarget.focus(),w.current!=="mouse"&&u(h)}),onPointerDown:k(s.onPointerDown,h=>{w.current=h.pointerType;const S=h.target;S.hasPointerCapture(h.pointerId)&&S.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(u(h),h.preventDefault())}),onKeyDown:k(s.onKeyDown,h=>{const S=y.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&b(h.key),!(S&&h.key===" ")&&yo.includes(h.key)&&(u(),h.preventDefault())})})})});Je.displayName=Qe;var et="SelectValue",tt=r.forwardRef((t,o)=>{const{__scopeSelect:n,className:a,style:s,children:i,placeholder:d="",...l}=t,c=J(et,n),{onValueNodeHasChildrenChange:f}=c,w=i!==void 0,y=z(o,c.onValueNodeChange);return Q(()=>{f(w)},[f,w]),e.jsx(D.span,{...l,ref:y,style:{pointerEvents:"none"},children:jt(c.value)?e.jsx(e.Fragment,{children:d}):i})});tt.displayName=et;var To="SelectIcon",ot=r.forwardRef((t,o)=>{const{__scopeSelect:n,children:a,...s}=t;return e.jsx(D.span,{"aria-hidden":!0,...s,ref:o,children:a||"▼"})});ot.displayName=To;var _o="SelectPortal",nt=t=>e.jsx(Ft,{asChild:!0,...t});nt.displayName=_o;var se="SelectContent",rt=r.forwardRef((t,o)=>{const n=J(se,t.__scopeSelect),[a,s]=r.useState();if(Q(()=>{s(new DocumentFragment)},[]),!n.open){const i=a;return i?Ke.createPortal(e.jsx(st,{scope:t.__scopeSelect,children:e.jsx(xe.Slot,{scope:t.__scopeSelect,children:e.jsx("div",{children:t.children})})}),i):null}return e.jsx(at,{...t,ref:o})});rt.displayName=se;var W=10,[st,ee]=ie(se),Eo="SelectContentImpl",Ro=Zt("SelectContent.RemoveScroll"),at=r.forwardRef((t,o)=>{const{__scopeSelect:n,position:a="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:d,side:l,sideOffset:c,align:f,alignOffset:w,arrowPadding:y,collisionBoundary:b,collisionPadding:I,sticky:u,hideWhenDetached:h,avoidCollisions:S,...j}=t,m=J(se,n),[p,A]=r.useState(null),[P,te]=r.useState(null),R=z(o,x=>A(x)),[O,H]=r.useState(null),[$,B]=r.useState(null),V=ge(n),[F,v]=r.useState(!1),g=r.useRef(!1);r.useEffect(()=>{if(p)return $t(p)},[p]),Kt();const E=r.useCallback(x=>{const[_,...L]=V().map(C=>C.ref.current),[T]=L.slice(-1),N=document.activeElement;for(const C of x)if(C===N||(C==null||C.scrollIntoView({block:"nearest"}),C===_&&P&&(P.scrollTop=0),C===T&&P&&(P.scrollTop=P.scrollHeight),C==null||C.focus(),document.activeElement!==N))return},[V,P]),K=r.useCallback(()=>E([O,p]),[E,O,p]);r.useEffect(()=>{F&&K()},[F,K]);const{onOpenChange:G,triggerPointerDownPosRef:Z}=m;r.useEffect(()=>{if(p){let x={x:0,y:0};const _=T=>{var N,C;x={x:Math.abs(Math.round(T.pageX)-(((N=Z.current)==null?void 0:N.x)??0)),y:Math.abs(Math.round(T.pageY)-(((C=Z.current)==null?void 0:C.y)??0))}},L=T=>{x.x<=10&&x.y<=10?T.preventDefault():p.contains(T.target)||G(!1),document.removeEventListener("pointermove",_),Z.current=null};return Z.current!==null&&(document.addEventListener("pointermove",_),document.addEventListener("pointerup",L,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",_),document.removeEventListener("pointerup",L,{capture:!0})}}},[p,G,Z]),r.useEffect(()=>{const x=()=>G(!1);return window.addEventListener("blur",x),window.addEventListener("resize",x),()=>{window.removeEventListener("blur",x),window.removeEventListener("resize",x)}},[G]);const[we,pe]=Nt(x=>{const _=V().filter(N=>!N.disabled),L=_.find(N=>N.ref.current===document.activeElement),T=Ct(_,x,L);T&&setTimeout(()=>T.ref.current.focus())}),Se=r.useCallback((x,_,L)=>{const T=!g.current&&!L;(m.value!==void 0&&m.value===_||T)&&(H(x),T&&(g.current=!0))},[m.value]),ye=r.useCallback(()=>p==null?void 0:p.focus(),[p]),ae=r.useCallback((x,_,L)=>{const T=!g.current&&!L;(m.value!==void 0&&m.value===_||T)&&B(x)},[m.value]),fe=a==="popper"?Te:ct,de=fe===Te?{side:l,sideOffset:c,align:f,alignOffset:w,arrowPadding:y,collisionBoundary:b,collisionPadding:I,sticky:u,hideWhenDetached:h,avoidCollisions:S}:{};return e.jsx(st,{scope:n,content:p,viewport:P,onViewportChange:te,itemRefCallback:Se,selectedItem:O,onItemLeave:ye,itemTextRefCallback:ae,focusSelectedItem:K,selectedItemText:$,position:a,isPositioned:F,searchRef:we,children:e.jsx(qt,{as:Ro,allowPinchZoom:!0,children:e.jsx(zt,{asChild:!0,trapped:m.open,onMountAutoFocus:x=>{x.preventDefault()},onUnmountAutoFocus:k(s,x=>{var _;(_=m.trigger)==null||_.focus({preventScroll:!0}),x.preventDefault()}),children:e.jsx(Gt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:d,onFocusOutside:x=>x.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:e.jsx(fe,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:x=>x.preventDefault(),...j,...de,onPlaced:()=>v(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...j.style},onKeyDown:k(j.onKeyDown,x=>{const _=x.ctrlKey||x.altKey||x.metaKey;if(x.key==="Tab"&&x.preventDefault(),!_&&x.key.length===1&&pe(x.key),["ArrowUp","ArrowDown","Home","End"].includes(x.key)){let T=V().filter(N=>!N.disabled).map(N=>N.ref.current);if(["ArrowUp","End"].includes(x.key)&&(T=T.slice().reverse()),["ArrowUp","ArrowDown"].includes(x.key)){const N=x.target,C=T.indexOf(N);T=T.slice(C+1)}setTimeout(()=>E(T)),x.preventDefault()}})})})})})})});at.displayName=Eo;var ko="SelectItemAlignedPosition",ct=r.forwardRef((t,o)=>{const{__scopeSelect:n,onPlaced:a,...s}=t,i=J(se,n),d=ee(se,n),[l,c]=r.useState(null),[f,w]=r.useState(null),y=z(o,R=>w(R)),b=ge(n),I=r.useRef(!1),u=r.useRef(!0),{viewport:h,selectedItem:S,selectedItemText:j,focusSelectedItem:m}=d,p=r.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&f&&h&&S&&j){const R=i.trigger.getBoundingClientRect(),O=f.getBoundingClientRect(),H=i.valueNode.getBoundingClientRect(),$=j.getBoundingClientRect();if(i.dir!=="rtl"){const N=$.left-O.left,C=H.left-N,oe=R.left-C,ne=R.width+oe,be=Math.max(ne,O.width),je=window.innerWidth-W,Ne=We(C,[W,Math.max(W,je-be)]);l.style.minWidth=ne+"px",l.style.left=Ne+"px"}else{const N=O.right-$.right,C=window.innerWidth-H.right-N,oe=window.innerWidth-R.right-C,ne=R.width+oe,be=Math.max(ne,O.width),je=window.innerWidth-W,Ne=We(C,[W,Math.max(W,je-be)]);l.style.minWidth=ne+"px",l.style.right=Ne+"px"}const B=b(),V=window.innerHeight-W*2,F=h.scrollHeight,v=window.getComputedStyle(f),g=parseInt(v.borderTopWidth,10),E=parseInt(v.paddingTop,10),K=parseInt(v.borderBottomWidth,10),G=parseInt(v.paddingBottom,10),Z=g+E+F+G+K,we=Math.min(S.offsetHeight*5,Z),pe=window.getComputedStyle(h),Se=parseInt(pe.paddingTop,10),ye=parseInt(pe.paddingBottom,10),ae=R.top+R.height/2-W,fe=V-ae,de=S.offsetHeight/2,x=S.offsetTop+de,_=g+E+x,L=Z-_;if(_<=ae){const N=B.length>0&&S===B[B.length-1].ref.current;l.style.bottom="0px";const C=f.clientHeight-h.offsetTop-h.offsetHeight,oe=Math.max(fe,de+(N?ye:0)+C+K),ne=_+oe;l.style.height=ne+"px"}else{const N=B.length>0&&S===B[0].ref.current;l.style.top="0px";const oe=Math.max(ae,g+h.offsetTop+(N?Se:0)+de)+L;l.style.height=oe+"px",h.scrollTop=_-ae+h.offsetTop}l.style.margin=`${W}px 0`,l.style.minHeight=we+"px",l.style.maxHeight=V+"px",a==null||a(),requestAnimationFrame(()=>I.current=!0)}},[b,i.trigger,i.valueNode,l,f,h,S,j,i.dir,a]);Q(()=>p(),[p]);const[A,P]=r.useState();Q(()=>{f&&P(window.getComputedStyle(f).zIndex)},[f]);const te=r.useCallback(R=>{R&&u.current===!0&&(p(),m==null||m(),u.current=!1)},[p,m]);return e.jsx(Mo,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:I,onScrollButtonChange:te,children:e.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:A},children:e.jsx(D.div,{...s,ref:y,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});ct.displayName=ko;var Po="SelectPopperPosition",Te=r.forwardRef((t,o)=>{const{__scopeSelect:n,align:a="start",collisionPadding:s=W,...i}=t,d=ve(n);return e.jsx(Xt,{...d,...i,ref:o,align:a,collisionPadding:s,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Te.displayName=Po;var[Mo,Ae]=ie(se,{}),_e="SelectViewport",lt=r.forwardRef((t,o)=>{const{__scopeSelect:n,nonce:a,...s}=t,i=ee(_e,n),d=Ae(_e,n),l=z(o,i.onViewportChange),c=r.useRef(0);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),e.jsx(xe.Slot,{scope:n,children:e.jsx(D.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:k(s.onScroll,f=>{const w=f.currentTarget,{contentWrapper:y,shouldExpandOnScrollRef:b}=d;if(b!=null&&b.current&&y){const I=Math.abs(c.current-w.scrollTop);if(I>0){const u=window.innerHeight-W*2,h=parseFloat(y.style.minHeight),S=parseFloat(y.style.height),j=Math.max(h,S);if(j<u){const m=j+I,p=Math.min(u,m),A=m-p;y.style.height=p+"px",y.style.bottom==="0px"&&(w.scrollTop=A>0?A:0,y.style.justifyContent="flex-end")}}}c.current=w.scrollTop})})})]})});lt.displayName=_e;var it="SelectGroup",[Ao,Lo]=ie(it),dt=r.forwardRef((t,o)=>{const{__scopeSelect:n,...a}=t,s=Me();return e.jsx(Ao,{scope:n,id:s,children:e.jsx(D.div,{role:"group","aria-labelledby":s,...a,ref:o})})});dt.displayName=it;var ut="SelectLabel",pt=r.forwardRef((t,o)=>{const{__scopeSelect:n,...a}=t,s=Lo(ut,n);return e.jsx(D.div,{id:s.id,...a,ref:o})});pt.displayName=ut;var me="SelectItem",[Do,ft]=ie(me),ht=r.forwardRef((t,o)=>{const{__scopeSelect:n,value:a,disabled:s=!1,textValue:i,...d}=t,l=J(me,n),c=ee(me,n),f=l.value===a,[w,y]=r.useState(i??""),[b,I]=r.useState(!1),u=z(o,m=>{var p;return(p=c.itemRefCallback)==null?void 0:p.call(c,m,a,s)}),h=Me(),S=r.useRef("touch"),j=()=>{s||(l.onValueChange(a),l.onOpenChange(!1))};if(a==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return e.jsx(Do,{scope:n,value:a,disabled:s,textId:h,isSelected:f,onItemTextChange:r.useCallback(m=>{y(p=>p||((m==null?void 0:m.textContent)??"").trim())},[]),children:e.jsx(xe.ItemSlot,{scope:n,value:a,disabled:s,textValue:w,children:e.jsx(D.div,{role:"option","aria-labelledby":h,"data-highlighted":b?"":void 0,"aria-selected":f&&b,"data-state":f?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...d,ref:u,onFocus:k(d.onFocus,()=>I(!0)),onBlur:k(d.onBlur,()=>I(!1)),onClick:k(d.onClick,()=>{S.current!=="mouse"&&j()}),onPointerUp:k(d.onPointerUp,()=>{S.current==="mouse"&&j()}),onPointerDown:k(d.onPointerDown,m=>{S.current=m.pointerType}),onPointerMove:k(d.onPointerMove,m=>{var p;S.current=m.pointerType,s?(p=c.onItemLeave)==null||p.call(c):S.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:k(d.onPointerLeave,m=>{var p;m.currentTarget===document.activeElement&&((p=c.onItemLeave)==null||p.call(c))}),onKeyDown:k(d.onKeyDown,m=>{var A;((A=c.searchRef)==null?void 0:A.current)!==""&&m.key===" "||(bo.includes(m.key)&&j(),m.key===" "&&m.preventDefault())})})})})});ht.displayName=me;var ue="SelectItemText",mt=r.forwardRef((t,o)=>{const{__scopeSelect:n,className:a,style:s,...i}=t,d=J(ue,n),l=ee(ue,n),c=ft(ue,n),f=Io(ue,n),[w,y]=r.useState(null),b=z(o,j=>y(j),c.onItemTextChange,j=>{var m;return(m=l.itemTextRefCallback)==null?void 0:m.call(l,j,c.value,c.disabled)}),I=w==null?void 0:w.textContent,u=r.useMemo(()=>e.jsx("option",{value:c.value,disabled:c.disabled,children:I},c.value),[c.disabled,c.value,I]),{onNativeOptionAdd:h,onNativeOptionRemove:S}=f;return Q(()=>(h(u),()=>S(u)),[h,S,u]),e.jsxs(e.Fragment,{children:[e.jsx(D.span,{id:c.textId,...i,ref:b}),c.isSelected&&d.valueNode&&!d.valueNodeHasChildren?Ke.createPortal(i.children,d.valueNode):null]})});mt.displayName=ue;var xt="SelectItemIndicator",gt=r.forwardRef((t,o)=>{const{__scopeSelect:n,...a}=t;return ft(xt,n).isSelected?e.jsx(D.span,{"aria-hidden":!0,...a,ref:o}):null});gt.displayName=xt;var Ee="SelectScrollUpButton",vt=r.forwardRef((t,o)=>{const n=ee(Ee,t.__scopeSelect),a=Ae(Ee,t.__scopeSelect),[s,i]=r.useState(!1),d=z(o,a.onScrollButtonChange);return Q(()=>{if(n.viewport&&n.isPositioned){let l=function(){const f=c.scrollTop>0;i(f)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?e.jsx(St,{...t,ref:d,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});vt.displayName=Ee;var Re="SelectScrollDownButton",wt=r.forwardRef((t,o)=>{const n=ee(Re,t.__scopeSelect),a=Ae(Re,t.__scopeSelect),[s,i]=r.useState(!1),d=z(o,a.onScrollButtonChange);return Q(()=>{if(n.viewport&&n.isPositioned){let l=function(){const f=c.scrollHeight-c.clientHeight,w=Math.ceil(c.scrollTop)<f;i(w)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?e.jsx(St,{...t,ref:d,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});wt.displayName=Re;var St=r.forwardRef((t,o)=>{const{__scopeSelect:n,onAutoScroll:a,...s}=t,i=ee("SelectScrollButton",n),d=r.useRef(null),l=ge(n),c=r.useCallback(()=>{d.current!==null&&(window.clearInterval(d.current),d.current=null)},[]);return r.useEffect(()=>()=>c(),[c]),Q(()=>{var w;const f=l().find(y=>y.ref.current===document.activeElement);(w=f==null?void 0:f.ref.current)==null||w.scrollIntoView({block:"nearest"})},[l]),e.jsx(D.div,{"aria-hidden":!0,...s,ref:o,style:{flexShrink:0,...s.style},onPointerDown:k(s.onPointerDown,()=>{d.current===null&&(d.current=window.setInterval(a,50))}),onPointerMove:k(s.onPointerMove,()=>{var f;(f=i.onItemLeave)==null||f.call(i),d.current===null&&(d.current=window.setInterval(a,50))}),onPointerLeave:k(s.onPointerLeave,()=>{c()})})}),Oo="SelectSeparator",yt=r.forwardRef((t,o)=>{const{__scopeSelect:n,...a}=t;return e.jsx(D.div,{"aria-hidden":!0,...a,ref:o})});yt.displayName=Oo;var ke="SelectArrow",Bo=r.forwardRef((t,o)=>{const{__scopeSelect:n,...a}=t,s=ve(n),i=J(ke,n),d=ee(ke,n);return i.open&&d.position==="popper"?e.jsx(Yt,{...s,...a,ref:o}):null});Bo.displayName=ke;var Vo="SelectBubbleInput",bt=r.forwardRef(({__scopeSelect:t,value:o,...n},a)=>{const s=r.useRef(null),i=z(a,s),d=So(o);return r.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLSelectElement.prototype,w=Object.getOwnPropertyDescriptor(c,"value").set;if(d!==o&&w){const y=new Event("change",{bubbles:!0});w.call(l,o),l.dispatchEvent(y)}},[d,o]),e.jsx(D.select,{...n,style:{...Vt,...n.style},ref:i,defaultValue:o})});bt.displayName=Vo;function jt(t){return t===""||t===void 0}function Nt(t){const o=Ut(t),n=r.useRef(""),a=r.useRef(0),s=r.useCallback(d=>{const l=n.current+d;o(l),(function c(f){n.current=f,window.clearTimeout(a.current),f!==""&&(a.current=window.setTimeout(()=>c(""),1e3))})(l)},[o]),i=r.useCallback(()=>{n.current="",window.clearTimeout(a.current)},[]);return r.useEffect(()=>()=>window.clearTimeout(a.current),[]),[n,s,i]}function Ct(t,o,n){const s=o.length>1&&Array.from(o).every(f=>f===o[0])?o[0]:o,i=n?t.indexOf(n):-1;let d=Ho(t,Math.max(i,0));s.length===1&&(d=d.filter(f=>f!==n));const c=d.find(f=>f.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function Ho(t,o){return t.map((n,a)=>t[(o+a)%t.length])}var Fo=Ye,It=Je,Wo=tt,Uo=ot,$o=nt,Tt=rt,Ko=lt,qo=dt,_t=pt,Et=ht,zo=mt,Go=gt,Rt=vt,kt=wt,Pt=yt;const mn=Fo,xn=qo,gn=Wo,Zo=r.forwardRef(({className:t,children:o,...n},a)=>e.jsxs(It,{ref:a,className:M("flex h-9 w-full items-center justify-between gap-2 rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none transition-colors","placeholder:text-muted-foreground","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background","disabled:cursor-not-allowed disabled:opacity-50","[&>span]:line-clamp-1",t),...n,children:[o,e.jsx(Uo,{asChild:!0,children:e.jsx(Xe,{className:"h-4 w-4 shrink-0 opacity-50"})})]}));Zo.displayName=It.displayName;const Mt=r.forwardRef(({className:t,...o},n)=>e.jsx(Rt,{ref:n,className:M("flex cursor-default items-center justify-center py-1",t),...o,children:e.jsx(uo,{className:"h-4 w-4"})}));Mt.displayName=Rt.displayName;const At=r.forwardRef(({className:t,...o},n)=>e.jsx(kt,{ref:n,className:M("flex cursor-default items-center justify-center py-1",t),...o,children:e.jsx(Xe,{className:"h-4 w-4"})}));At.displayName=kt.displayName;const Xo=r.forwardRef(({className:t,children:o,position:n="popper",...a},s)=>e.jsx($o,{children:e.jsxs(Tt,{ref:s,className:M("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-lg border border-border bg-background text-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...a,children:[e.jsx(Mt,{}),e.jsx(Ko,{className:M("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:o}),e.jsx(At,{})]})}));Xo.displayName=Tt.displayName;const Yo=r.forwardRef(({className:t,...o},n)=>e.jsx(_t,{ref:n,className:M("px-2 py-1.5 text-sm font-semibold",t),...o}));Yo.displayName=_t.displayName;const Qo=r.forwardRef(({className:t,children:o,...n},a)=>e.jsxs(Et,{ref:a,className:M("relative flex w-full cursor-default select-none items-center rounded-md py-1.5 pl-2 pr-8 text-sm outline-none","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Go,{children:e.jsx(Qt,{className:"h-4 w-4"})})}),e.jsx(zo,{children:o})]}));Qo.displayName=Et.displayName;const Jo=r.forwardRef(({className:t,...o},n)=>e.jsx(Pt,{ref:n,className:M("-mx-1 my-1 h-px bg-border",t),...o}));Jo.displayName=Pt.displayName;const Lt=60,en=200,tn=Lt;function vn(t){const o=typeof t=="number"?t:Number(t);return Number.isFinite(o)?Math.min(en,Math.max(Lt,Math.round(o))):tn}const wn=[{value:"cursor",label:"Cursor"},{value:"xcode",label:"Xcode"},{value:"windsurf",label:"Windsurf"},{value:"custom",label:"Custom"}],X={cursor:"/editor-icons/cursor.png",defaultApp:"/editor-icons/default-app.png",finder:"/editor-icons/finder.png",preview:"/editor-icons/preview.png",xcode:"/editor-icons/xcode.png",terminal:"/editor-icons/terminal.png",windsurf:"/editor-icons/windsurf.png",custom:"/editor-icons/custom.png"};function Y({src:t,className:o}){return e.jsx("img",{src:t,alt:"","aria-hidden":"true",draggable:!1,className:o})}function Sn({preset:t,className:o}){switch(t){case"xcode":return e.jsx(Y,{src:X.xcode,className:o});case"windsurf":return e.jsx(Y,{src:X.windsurf,className:o});case"custom":return e.jsx(Y,{src:X.custom,className:o});case"cursor":case"vscode":default:return e.jsx(Y,{src:X.cursor,className:o})}}function yn({className:t}){return e.jsx(Y,{src:X.finder,className:t})}function bn({className:t}){return e.jsx(Y,{src:X.preview,className:t})}function jn({className:t}){return e.jsx(Y,{src:X.defaultApp,className:t})}function Nn({className:t}){return e.jsx(Jt,{className:t})}function Cn({className:t}){return e.jsx(Y,{src:X.terminal,className:t})}const Pe=qe("InputPopover",()=>t=>({open:!1,setOpen:o=>t({open:o})}));function on(){return t=>({open:!1,query:"",setQuery:o=>t({query:o}),setPopoverOpen:o=>t(o?{open:!0}:{open:!1,query:""}),closeAndClearQuery:()=>t({open:!1,query:""})})}const le=qe("SearchableModelPopover",on);function nn({className:t,...o}){return e.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:M("shrink-0",t),...o,children:e.jsx("path",{d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"})})}function rn({className:t,...o}){return e.jsx("svg",{viewBox:"0 0 158.7128 157.296",fill:"currentColor","aria-hidden":"true",className:M("shrink-0",t),...o,children:e.jsx("path",{d:"M60.8734 57.2556V42.3124c0-1.2586.4722-2.2029 1.5728-2.8314l30.0443-17.3023c4.0899-2.3593 8.9662-3.4599 13.9988-3.4599 18.8759 0 30.8307 14.6289 30.8307 30.2006 0 1.1007 0 2.3593-.158 3.6178l-31.1446-18.2467c-1.8872-1.1006-3.7754-1.1006-5.6629 0L60.8734 57.2556Zm70.1542 58.2005V79.7487c0-2.2028-.9446-3.7756-2.8318-4.8763l-39.481-22.9651 12.8982-7.3934c1.1007-.6285 2.0453-.6285 3.1458 0l30.0441 17.3024c8.6523 5.0341 14.4708 15.7296 14.4708 26.1107 0 11.9539-7.0769 22.965-18.2461 27.527ZM51.593 83.9964l-12.8982-7.5497c-1.1007-.6285-1.5728-1.5728-1.5728-2.8314V39.0105c0-16.8303 12.8982-29.5722 30.3585-29.5722 6.607 0 12.7403 2.2029 17.9324 6.1349l-30.987 17.9324c-1.8871 1.1007-2.8314 2.6735-2.8314 4.8764v45.6159ZM79.3562 100.0403 60.8733 89.6592V67.6383l18.4829-10.3811 18.4812 10.3811v22.0209l-18.4812 10.3811Zm11.8757 47.8188c-6.607 0-12.7403-2.2031-17.9324-6.1344l30.9866-17.9333c1.8872-1.1005 2.8318-2.6728 2.8318-4.8759v-45.616l13.0564 7.5498c1.1005.6285 1.5723 1.5728 1.5723 2.8314v34.6051c0 16.8297-13.0564 29.5723-30.5147 29.5723ZM53.9522 112.7822 23.9079 95.4798c-8.652-5.0343-14.471-15.7296-14.471-26.1107 0-12.1119 7.2356-22.9652 18.403-27.5272v35.8634c0 2.2028.9443 3.7756 2.8314 4.8763l39.3248 22.8068-12.8982 7.3938c-1.1007.6287-2.045.6287-3.1456 0ZM52.2229 138.5791c-17.7745 0-30.8306-13.3713-30.8306-29.8871 0-1.2585.1578-2.5169.3143-3.7754l30.987 17.9323c1.8871 1.1005 3.7757 1.1005 5.6628 0l39.4811-22.807v14.9435c0 1.2585-.4721 2.2021-1.5728 2.8308l-30.0443 17.3025c-4.0898 2.359-8.9662 3.4605-13.9989 3.4605h.0014ZM91.2319 157.296c19.0327 0 34.9188-13.5272 38.5383-31.4594 17.6164-4.562 28.9425-21.0779 28.9425-37.908 0-11.0112-4.719-21.7066-13.2133-29.4143.7867-3.3035 1.2595-6.607 1.2595-9.909 0-22.4929-18.2471-39.3247-39.3251-39.3247-4.2461 0-8.3363.6285-12.4262 2.045-7.0792-6.9213-16.8318-11.3254-27.5271-11.3254-19.0331 0-34.9191 13.5268-38.5384 31.4591C11.3255 36.0212 0 52.5373 0 69.3675c0 11.0112 4.7184 21.7065 13.2125 29.4142-.7865 3.3035-1.2586 6.6067-1.2586 9.9092 0 22.4923 18.2466 39.3241 39.3248 39.3241 4.2462 0 8.3362-.6277 12.426-2.0441 7.0776 6.921 16.8302 11.3251 27.5271 11.3251Z"})})}function sn({className:t,...o}){return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:M("shrink-0",t),...o,children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M6.3 6.3a8 8 0 1 0 11.4 11.4"}),e.jsx("path",{d:"M17.7 6.3a8 8 0 0 1 0 11.4"}),e.jsx("path",{d:"M2 12h4"}),e.jsx("path",{d:"M18 12h4"})]})}const Ue={claude:nn,codex:rn,openrouter:sn};function q({onClick:t,selected:o,icon:n,label:a,description:s,disabled:i}){return e.jsxs("button",{onClick:t,disabled:i,className:M("w-full flex items-center gap-2 p-2 border border-border/0 rounded-lg text-left transition-opacity",o?"bg-muted border-border":"hover:opacity-60",i&&"opacity-40 cursor-not-allowed"),children:[n,e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:a}),s?e.jsx("div",{className:"text-xs text-muted-foreground",children:s}):null]})]})}function ce({trigger:t,triggerClassName:o,disabled:n=!1,children:a}){return n?e.jsx("button",{disabled:!0,className:M("flex min-h-[36px] items-center gap-1.5 px-2 py-1 text-sm rounded-md text-muted-foreground [&>svg]:shrink-0 opacity-70 cursor-default [&>span]:whitespace-nowrap",o),children:t}):e.jsx(Pe.Provider,{init:void 0,children:e.jsx(an,{trigger:t,triggerClassName:o,children:a})})}function an({trigger:t,triggerClassName:o,children:n}){const a=Pe.useScopedStore(i=>i.open),s=Pe.useScopedStore(i=>i.setOpen);return e.jsxs(ze,{open:a,onOpenChange:s,children:[e.jsx(Ge,{asChild:!0,children:e.jsx("button",{type:"button",className:M("flex min-h-[36px] cursor-pointer touch-manipulation items-center gap-1.5 px-2 py-1 text-sm rounded-md transition-colors text-muted-foreground [&>svg]:shrink-0 [&>span]:whitespace-nowrap","hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",o),children:t})}),e.jsx(Ze,{align:"center",className:"w-64 p-1",children:e.jsx("div",{className:"space-y-1",children:typeof n=="function"?n(()=>s(!1)):n})})]})}function cn({models:t,selectedModel:o,onSelect:n,ModelIcon:a}){return e.jsx(le.Provider,{init:void 0,children:e.jsx(ln,{models:t,selectedModel:o,onSelect:n,ModelIcon:a})})}function ln({models:t,selectedModel:o,onSelect:n,ModelIcon:a}){var I;const s=le.useScopedStore(u=>u.open),i=le.useScopedStore(u=>u.query),d=le.useScopedStore(u=>u.setPopoverOpen),l=le.useScopedStore(u=>u.setQuery),c=le.useScopedStore(u=>u.closeAndClearQuery),f=r.useCallback(u=>{n(u),c()},[n,c]),w=((I=t.find(u=>u.id===o))==null?void 0:I.label)??o,y=r.useMemo(()=>{const u=i.trim().toLowerCase();return u?t.filter(h=>h.id.toLowerCase().includes(u)||h.label.toLowerCase().includes(u)):t},[t,i]);let b;return t.length===0?b=e.jsx("div",{className:"px-2 py-3 text-xs text-muted-foreground text-center",children:"Loading models… verify OpenRouter API key in Settings."}):y.length===0?b=e.jsx("div",{className:"px-2 py-3 text-xs text-muted-foreground text-center",children:"No matches"}):b=y.map(u=>e.jsx(q,{onClick:()=>f(u.id),selected:o===u.id,icon:e.jsx(Ie,{className:"h-4 w-4 text-muted-foreground"}),label:u.label,description:u.id},u.id)),e.jsxs(ze,{open:s,onOpenChange:d,children:[e.jsx(Ge,{asChild:!0,children:e.jsxs("button",{type:"button",className:M("flex min-h-[36px] cursor-pointer touch-manipulation items-center gap-1.5 px-2 py-1 text-sm rounded-md transition-colors text-muted-foreground [&>svg]:shrink-0 [&>span]:whitespace-nowrap","hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:[e.jsx(a,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"max-w-[200px] truncate",children:w})]})}),e.jsxs(Ze,{align:"center",className:"w-80 p-1",children:[e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 border-b border-border/50",children:[e.jsx(so,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),e.jsx("input",{type:"text",value:i,onChange:u=>l(u.target.value),placeholder:"Search models...",autoFocus:!0,className:"flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e.jsx("div",{className:"max-h-72 overflow-y-auto py-1 space-y-1",children:b})]})]})}function In({availableProviders:t,selectedProvider:o,showProviderPicker:n=!0,showCodexCliRequirementHints:a=!1,model:s,modelOptions:i,onProviderChange:d,onModelChange:l,onModelOptionChange:c,planMode:f=!1,onPlanModeChange:w,includePlanMode:y=!0,className:b}){var H,$,B,V,F;const I=eo(to),u=t.find(v=>v.id===o)??t[0],h=Ue[o],S=Ie,j=y&&(u==null?void 0:u.supportsPlanMode)&&w,m=o==="claude"&&"contextWindow"in i?i:null,p=o==="codex"&&"fastMode"in i?i:null,A=((H=u.models.find(v=>v.id===s))==null?void 0:H.contextWindowOptions)??[],P=(m==null?void 0:m.contextWindow)??oo[0].id,te=P==="1m"?He:Fe,R=(($=u.models.find(v=>v.id===s))==null?void 0:$.label)??s,O=o==="openrouter"?e.jsx(cn,{models:u.models,selectedModel:s,onSelect:v=>l==null?void 0:l(o,v),ModelIcon:S}):e.jsx(ce,{trigger:e.jsxs(e.Fragment,{children:[e.jsx(S,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:R})]}),children:v=>u.models.map(g=>{const E=Ie;return e.jsx(q,{onClick:()=>{l==null||l(o,g.id),v()},selected:s===g.id,icon:e.jsx(E,{className:"h-4 w-4 text-muted-foreground"}),label:a&&o==="codex"&&g.id==="gpt-5.5"?e.jsxs(e.Fragment,{children:[g.label," ",e.jsx("span",{className:"text-xs font-normal text-muted-foreground",children:"codex-cli >= 0.124"})]}):g.label},g.id)})});return e.jsxs("div",{className:M("flex md:justify-center items-center gap-0.5",b),children:[n?e.jsx(ce,{disabled:!d,trigger:e.jsxs(e.Fragment,{children:[e.jsx(h,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:(u==null?void 0:u.label)??o})]}),children:v=>t.map(g=>{const E=Ue[g.id];return e.jsx(q,{onClick:()=>{d==null||d(g.id),v()},selected:o===g.id,icon:e.jsx(E,{className:"h-4 w-4 text-muted-foreground"}),label:g.label},g.id)})}):null,l==null?e.jsx(no,{label:"Model is locked while a cron job is running — pause or remove the cron job to change it",side:"top",children:e.jsxs("span",{"aria-disabled":"true",className:"flex min-h-[36px] items-center gap-1.5 px-2 py-1 text-sm rounded-md text-muted-foreground [&>svg]:shrink-0 opacity-70 cursor-default [&>span]:whitespace-nowrap",children:[e.jsx(xo,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:R})]})}):O,o!=="openrouter"?e.jsx(ce,{trigger:e.jsxs(e.Fragment,{children:[e.jsx(Ce,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:o==="claude"?((B=De.find(v=>v.id===i.reasoningEffort))==null?void 0:B.label)??i.reasoningEffort:((V=Oe.find(v=>v.id===i.reasoningEffort))==null?void 0:V.label)??i.reasoningEffort})]}),children:v=>o==="claude"?De.map(g=>e.jsx(q,{onClick:()=>{c({type:"claudeReasoningEffort",effort:g.id}),v()},selected:i.reasoningEffort===g.id,icon:e.jsx(Ce,{className:"h-4 w-4 text-muted-foreground"}),label:g.label,disabled:g.id==="max"&&!ro(s,I)},g.id)):Oe.map(g=>e.jsx(q,{onClick:()=>{c({type:"codexReasoningEffort",effort:g.id}),v()},selected:i.reasoningEffort===g.id,icon:e.jsx(Ce,{className:"h-4 w-4 text-muted-foreground"}),label:g.label},g.id))}):null,o==="claude"&&A.length>1?e.jsx(ce,{trigger:e.jsxs(e.Fragment,{children:[e.jsx(te,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:((F=A.find(v=>v.id===P))==null?void 0:F.label)??P})]}),children:v=>A.map(g=>e.jsx(q,{onClick:()=>{c({type:"contextWindow",contextWindow:g.id}),v()},selected:P===g.id,icon:g.id==="1m"?e.jsx(He,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Fe,{className:"h-4 w-4 text-muted-foreground"}),label:g.label,description:g.id==="1m"?"Expanded context window":"Standard context window"},g.id))}):null,o==="codex"?e.jsx(ce,{trigger:e.jsxs(e.Fragment,{children:[p!=null&&p.fastMode?e.jsx(he,{className:"h-3.5 w-3.5"}):e.jsx(he,{className:"h-3.5 w-3.5 -scale-x-100"}),e.jsx("span",{children:p!=null&&p.fastMode?"Fast Mode":"Standard"})]}),triggerClassName:p!=null&&p.fastMode?"text-success":void 0,children:v=>e.jsxs(e.Fragment,{children:[e.jsx(q,{onClick:()=>{c({type:"fastMode",fastMode:!1}),v()},selected:!(p!=null&&p.fastMode),icon:e.jsx(he,{className:"h-4 w-4 text-muted-foreground -scale-x-100"}),label:"Standard"}),e.jsx(q,{onClick:()=>{c({type:"fastMode",fastMode:!0}),v()},selected:!!(p!=null&&p.fastMode),icon:e.jsx(he,{className:"h-4 w-4 text-muted-foreground"}),label:"Fast Mode"})]})}):null,j?e.jsx(ce,{trigger:e.jsxs(e.Fragment,{children:[f?e.jsx(Be,{className:"h-3.5 w-3.5"}):e.jsx(Ve,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:f?"Plan Mode":"Full Access"})]}),triggerClassName:f?"text-info":void 0,children:v=>e.jsxs(e.Fragment,{children:[e.jsx(q,{onClick:()=>{w(!1),v()},selected:!f,icon:e.jsx(Ve,{className:"h-4 w-4 text-muted-foreground"}),label:"Full Access",description:"Execution without approval"}),e.jsx(q,{onClick:()=>{w(!0),v()},selected:f,icon:e.jsx(Be,{className:"h-4 w-4 text-muted-foreground"}),label:"Plan Mode",description:"Review a plan before execution"})]})}):null]})}export{pn as B,In as C,tn as D,wn as E,yn as F,fn as K,xo as L,en as M,bn as P,mn as S,Cn as T,Zo as a,gn as b,Xo as c,Qo as d,hn as e,xn as f,Sn as g,Lt as h,vn as i,Xe as j,uo as k,Nn as l,jn as m};
@@ -0,0 +1 @@
1
+ import{f as b,h as f,r as m,j as e,S as g,C as N,g as v,H as w,i as C,k as i,L as P,X as I,d as k}from"./index-B-Dgv9vc.js";import{u as y,C as L,a as x,h as R,P as S,b as A}from"./CronRunMessage-Gq1oWvqg.js";import{E}from"./external-link-CEHxz8hW.js";function D(){const n=b(t=>t.rows),d=f(),o=y(1e3),l=m.useCallback((t,a)=>{d.command({type:t,chatId:a.chatId,jobId:a.job.jobId}).catch(()=>{})},[d]),h=m.useMemo(()=>{const t=new Map;for(const a of n){const r=t.get(a.projectId)??{projectPath:a.projectPath,rows:[]};r.rows.push(a),t.set(a.projectId,r)}return[...t.values()]},[n]);return e.jsx("div",{className:g,children:e.jsxs("div",{className:"mx-auto w-full max-w-[900px] px-4 py-8",children:[e.jsxs("h1",{className:"flex items-center gap-2.5 text-lg font-semibold text-foreground",children:[e.jsx(N,{className:"h-5 w-5 text-muted-foreground","aria-hidden":"true"}),"Cron jobs",e.jsxs("span",{className:"text-sm font-normal text-muted-foreground tabular-nums",children:[n.length," armed"]})]}),n.length===0?e.jsxs("p",{className:"mt-6 text-sm text-muted-foreground",children:["No cron jobs armed anywhere. Arm one from any chat with"," ",e.jsx("code",{className:"font-mono text-xs",children:"/cron <instruction> inline|spawn <schedule>"}),"."]}):e.jsx("div",{className:"mt-6 space-y-6",children:h.map(t=>e.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[e.jsxs("h2",{className:"border-b border-border bg-card p-3 px-4 text-sm font-medium text-foreground",children:[v(t.projectPath),e.jsx("span",{className:"ml-2 font-mono text-xs font-normal text-muted-foreground",children:t.projectPath})]}),e.jsx("div",{children:t.rows.map((a,r)=>{var u;const s=a.job,j=r===t.rows.length-1,p=o-s.armedAt,c=((u=s.lastRun)==null?void 0:u.status)==="running"?s.lastRun:null;return e.jsxs("div",{className:k("flex items-center gap-3 bg-background px-4 py-2.5",!j&&"border-b border-border"),children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm text-foreground",children:s.instruction}),s.paused?e.jsx(L,{}):null,!s.paused&&s.lastRun?e.jsx(x,{status:s.lastRun.status}):null]}),e.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:s.jobId}),e.jsx("span",{children:R(s.schedule,s.scheduleText)}),e.jsxs("span",{children:["· ",s.mode]}),s.model?e.jsx("span",{className:"font-mono",children:s.model}):null,e.jsx(w,{label:new Date(s.armedAt).toLocaleString(),side:"top",children:e.jsxs("span",{className:"tabular-nums",children:["created ",C(p)," ago"]})}),c?e.jsxs("span",{className:"tabular-nums",children:["running for ",i(o-c.firedAt)]}):null,s.paused&&s.lastRun?e.jsxs("span",{className:"tabular-nums",children:["Last run: ",e.jsx(x,{status:s.lastRun.status})]}):null,!s.paused&&s.nextFireAt!==null?e.jsxs("span",{className:"tabular-nums",children:["next in ",i(Math.max(0,s.nextFireAt-o))]}):null,e.jsxs(P,{to:`/chat/${a.chatId}`,className:"inline-flex items-center gap-1 text-primary hover:underline",children:[e.jsx(E,{className:"h-3 w-3","aria-hidden":"true"}),a.chatTitle||"Open chat"]})]})]}),e.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[s.paused?e.jsx("button",{type:"button","aria-label":`Resume cron job ${s.jobId}`,className:"rounded-md p-1.5 text-muted-foreground hover:bg-muted/40 hover:text-foreground",onClick:()=>l("cron.resume",a),children:e.jsx(S,{className:"h-3.5 w-3.5","aria-hidden":"true"})}):e.jsx("button",{type:"button","aria-label":`Pause cron job ${s.jobId}`,className:"rounded-md p-1.5 text-muted-foreground hover:bg-muted/40 hover:text-foreground",onClick:()=>l("cron.pause",a),children:e.jsx(A,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),e.jsx("button",{type:"button","aria-label":`Remove cron job ${s.jobId}`,className:"rounded-md p-1.5 text-muted-foreground hover:bg-muted/40 hover:text-destructive",onClick:()=>l("cron.remove",a),children:e.jsx(I,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]})]},`${a.chatId} ${s.jobId}`)})})]},t.projectPath))})]})})}export{D as CronJobsPage};
@@ -0,0 +1,11 @@
1
+ import{c as v,r as m,y as b,j as r,d as g,C as S,a0 as j,L as w}from"./index-B-Dgv9vc.js";import{E as N}from"./external-link-CEHxz8hW.js";/**
2
+ * @license lucide-react v0.562.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const $=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],V=v("pause",$);/**
7
+ * @license lucide-react v0.562.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const C=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],z=v("play",C),L={timer:b};function F(e=1e3,t){const{timer:n}=L,[a,u]=m.useState(()=>Date.now()),s=m.useRef(e);return m.useLayoutEffect(()=>{s.current=e}),m.useEffect(()=>{const x=n.setInterval(()=>{u(Date.now())},s.current);return()=>n.clearInterval(x)},[n]),a}const I=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function M(e,t){if(e.type==="interval")return A(e.ms);const{second:n,minute:a,hour:u,dom:s,month:x,dow:c}=e;if(x.kind!=="any")return t;const l=s.kind==="any"&&c.kind==="any";if(n!==void 0&&a.kind==="any"&&u.kind==="any"&&l){if(n.kind==="any")return"every second";const d=_(n.values);if(d!==null)return d===1?"every second":`every ${d} seconds`;if(n.values.length>1)return t}const i=n===void 0?0:p(n);if(i===null)return t;const y=i===0?"":`:${o(i)}`,f=p(a),h=p(u);if(a.kind==="any"&&u.kind==="any"&&l)return i===0?"every minute":`every minute at :${o(i)}`;if(f!==null&&u.kind==="any"&&l)return`hourly at :${o(f)}${y}`;if(f!==null&&h!==null){const d=`${o(h)}:${o(f)}${y}`;if(l)return`daily at ${d}`;if(s.kind==="any"&&c.kind==="values")return`every ${c.values.map(k=>I[k]).join(", ")} at ${d}`;if(c.kind==="any"&&s.kind==="values"&&s.values.length===1)return`on day ${s.values[0]} of each month at ${d}`}return t}function A(e){const t=Math.round(e/1e3);if(t%3600===0){const n=t/3600;return n===1?"every hour":`every ${n} hours`}if(t%60===0){const n=t/60;return n===1?"every minute":`every ${n} minutes`}return t===1?"every second":`every ${t} seconds`}function p(e){return e.kind==="values"&&e.values.length===1?e.values[0]:null}function _(e){if(e.length<2||e[0]!==0)return null;const t=e[1];if(t<1||60%t!==0||e.length!==60/t)return null;for(let n=1;n<e.length;n++)if(e[n]!==n*t)return null;return t}function o(e){return String(e).padStart(2,"0")}const E={running:"border-warning/40 text-warning-text bg-warning/10",completed:"border-success/40 text-success-text bg-success/10",failed:"border-destructive/40 text-destructive-text bg-destructive/10",skipped:"border-border text-muted-foreground bg-muted/40"};function B({message:e,cronJobs:t}){const n=t==null?void 0:t.find(s=>s.jobId===e.jobId),a=n==null?void 0:n.recentRuns.find(s=>s.runId===e.runId),u=(a==null?void 0:a.status)??"running";return r.jsxs("div",{className:"rounded-lg border border-border bg-card px-4 py-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(S,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Cron run"}),r.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:e.jobId}),r.jsxs("span",{className:"ml-auto flex items-center gap-3",children:[r.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:j(e.firedAt)}),r.jsx(R,{status:u})]})]}),r.jsx("p",{className:"mt-1.5 text-sm text-foreground/90",children:e.instruction}),e.spawnedChatId?r.jsxs(w,{to:`/chat/${e.spawnedChatId}`,className:"mt-2 inline-flex items-center gap-1.5 text-xs font-medium text-primary hover:underline",children:[r.jsx(N,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Open run chat"]}):null]})}const P={running:"Running",completed:"Completed",failed:"Failed",skipped:"Skipped"},T={running:"bg-warning",completed:"bg-success",failed:"bg-destructive",skipped:"bg-muted-foreground"};function R({status:e}){return r.jsxs("span",{className:g("inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-xs font-medium",E[e]),children:[r.jsx("span",{className:g("h-1.5 w-1.5 rounded-full",T[e])}),P[e]]})}function W(){return r.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-muted/40 px-2 py-0.5 text-xs font-medium text-muted-foreground",children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-muted-foreground"}),"Paused"]})}export{W as C,z as P,R as a,V as b,B as c,M as h,F as u};
@@ -0,0 +1 @@
1
+ import{p as z,j as e,d as b,l as H,y as D,r as h,D as K,z as U,A as W,F as J,G as V,J as Y,I as L,K as q,B as v,M as n,s as M,N as g,P as G,O as Q,Q as X,T as Z,U as ee,g as te,V as se,Y as re,Z as oe,_ as ne,$ as ae,u as ie}from"./index-B-Dgv9vc.js";import{M as _}from"./monitor-B4KkWes1.js";import{C as F,T as ce}from"./terminal-Bg_9x1Mp.js";import{F as le}from"./folder-PbmkrgCS.js";const T=z("CopyButton",()=>t=>({copied:!1,setCopied:s=>t({copied:s})}));function O({narrow:t=!1,title:s,subtitle:o,icon:a=_}){return e.jsxs("div",{className:b("w-full",t?"max-w-2xl px-6 pt-16 mx-auto":"px-6 pt-16 mb-10"),children:[e.jsxs("div",{className:b("flex items-center gap-1 mb-2",t&&"justify-center"),children:[e.jsx("div",{className:"p-2 pl-0 rounded-lg",children:e.jsx(a,{className:"h-6 w-6 text-muted-foreground"})}),e.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:s})]}),o&&e.jsx("p",{className:b("text-muted-foreground",t&&"mb-10 text-center"),children:o})]})}const u=H()(t=>({tab:"new",name:"",existingPath:"",setTab:s=>t({tab:s}),setName:s=>t({name:s}),setExistingPath:s=>t({existingPath:s}),resetForOpen:()=>t({tab:"new",name:"",existingPath:""})})),de=()=>u(t=>t.tab),xe=()=>u(t=>t.name),me=()=>u(t=>t.existingPath);function ue(t){return t.toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}function he({open:t,onOpenChange:s,onConfirm:o,ports:a={}}){const l=a.timer??D,i=de(),d=xe(),x=me(),w=u(r=>r.setTab),j=u(r=>r.setName),m=u(r=>r.setExistingPath),f=u(r=>r.resetForOpen),c=h.useRef(null),E=h.useRef(null);h.useEffect(()=>{t&&(f(),l.setTimeout(()=>{var r;return(r=c.current)==null?void 0:r.focus()},0))},[t,f,l]),h.useEffect(()=>{t&&l.setTimeout(()=>{var r,I;i==="new"?(r=c.current)==null||r.focus():(I=E.current)==null||I.focus()},0)},[i,t,l]);const y=ue(d),P=y?`${Y}/${y}`:"",p=x.trim(),$=i==="new"?!!y:!!p,C=()=>{if($){if(i==="new")o({mode:"new",localPath:P,title:d.trim()});else{const r=p.split("/").pop()||p;o({mode:"existing",localPath:p,title:r})}s(!1)}};return e.jsx(K,{open:t,onOpenChange:s,children:e.jsxs(U,{size:"sm",children:[e.jsxs(W,{className:"space-y-4",children:[e.jsx(J,{children:"Add Project"}),e.jsx(V,{value:i,onValueChange:w,options:[{value:"new",label:"New Folder"},{value:"existing",label:"Existing Path"}],className:"w-full mb-2",optionClassName:"flex-1 justify-center"}),i==="new"?e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{ref:c,type:"text",value:d,onChange:r=>j(r.target.value),onKeyDown:r=>{r.key==="Enter"&&C(),r.key==="Escape"&&s(!1)},placeholder:"Project name"}),P&&e.jsx("p",{className:"text-xs text-muted-foreground font-mono",children:P})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{ref:E,type:"text",value:x,onChange:r=>m(r.target.value),onKeyDown:r=>{r.key==="Enter"&&C(),r.key==="Escape"&&s(!1)},placeholder:"~/Projects/my-app"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"The folder will be created if it doesn't exist."})]})]}),e.jsxs(q,{children:[e.jsx(v,{variant:"ghost",size:"sm",onClick:()=>s(!1),children:"Cancel"}),e.jsx(v,{variant:"secondary",size:"sm",onClick:C,disabled:!$,children:"Create"})]})]})})}function je({text:t,ports:s={}}){const o=T.useScopedStore(x=>x.copied),a=T.useScopedStore(x=>x.setCopied),l=s.clipboard??oe,i=s.timer??D;async function d(){await l.writeText(t),a(!0),i.setTimeout(()=>a(!1),2e3)}return e.jsx(v,{variant:"ghost",size:"icon-mobile","aria-label":o?"Copied":"Copy to clipboard",className:"text-muted-foreground hover:text-foreground",onClick:()=>void d(),children:o?e.jsx(ne,{className:"h-4 w-4 text-success"}):e.jsx(ae,{className:"h-4 w-4"})})}function fe({text:t}){return e.jsx(T.Provider,{init:{},children:e.jsx(je,{text:t})})}function R({children:t}){return e.jsxs("div",{className:"grid grid-cols-[1fr_auto] items-center group bg-background border border-border text-foreground rounded-xl p-1.5 pl-3 font-mono text-sm",children:[e.jsxs("pre",{className:"inline-flex items-center gap-2 overflow-x-auto",children:[e.jsx(X,{className:"inline h-4 w-4 opacity-40"}),e.jsx("code",{children:t})]}),e.jsx(fe,{text:t})]})}function N({children:t}){return e.jsx("div",{className:"bg-card border border-border rounded-2xl p-4",children:t})}function k({children:t}){return e.jsx("h2",{className:"text-13 font-medium text-muted-foreground tracking-wider mb-3",children:t})}function S({icon:t,title:s,subtitle:o,iconClassName:a}){return e.jsxs("div",{className:"flex flex-col items-start gap-1.5 min-w-0",children:[e.jsx(t,{className:a||"h-5 w-5 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:s}),e.jsx("span",{className:"text-xs text-muted-foreground leading-tight",children:o})]})}function A(){return e.jsx("div",{"aria-hidden":!0,className:"mt-5 h-px w-6 shrink-0 bg-border"})}function B({number:t,title:s,children:o}){return e.jsx("div",{className:"flex gap-4",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-baseline gap-3",children:[e.jsxs("div",{className:"flex-shrink-0 flex items-center justify-center font-medium text-logo",children:[t,"."]}),e.jsx("h3",{className:"font-medium text-foreground mb-2",children:s})]}),e.jsx("div",{className:"text-muted-foreground text-sm space-y-3",children:o})]})})}function pe({localPath:t,loading:s,onClick:o}){return e.jsxs(Z,{children:[e.jsx(ee,{asChild:!0,children:e.jsxs("button",{className:b("border border-border hover:border-primary/30 group rounded-lg bg-card px-4 py-3 flex items-center gap-3 w-full text-left hover:bg-muted/50 transition-colors",s&&"opacity-50 cursor-not-allowed"),disabled:s,onClick:o,children:[e.jsx(le,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"font-medium text-foreground truncate flex-1",children:te(t)}),s?e.jsx(M,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary animate-spin flex-shrink-0"}):e.jsx(se,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0"})]})}),e.jsx(re,{children:e.jsx("p",{children:t})})]})}function ge({connectionStatus:t,ready:s,snapshot:o,startingLocalPath:a,commandError:l,newProjectOpen:i,onNewProjectOpenChange:d,onOpenProject:x,onCreateProject:w}){const j=h.useMemo(()=>(o==null?void 0:o.projects)??[],[o==null?void 0:o.projects]),m=t==="connecting"||!s,f=t==="connected"&&s;return e.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-y-auto",children:[f?e.jsxs(e.Fragment,{children:[e.jsx(O,{title:(o==null?void 0:o.machine.displayName)??"Local Projects",subtitle:`${n} is connected, choose a project below to get started.`}),e.jsxs("div",{className:"w-full px-6 mb-10",children:[e.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[e.jsx("h2",{className:"text-13 font-medium text-muted-foreground tracking-wider",children:"Projects"}),e.jsxs(v,{variant:"default",size:"sm",onClick:()=>d(!0),children:[e.jsx(G,{className:"h-4 w-4 mr-1.5"}),"Add Project"]})]}),j.length>0?e.jsx("div",{className:"grid gap-2 [grid-template-columns:repeat(auto-fill,minmax(min(260px,100%),1fr))]",children:j.map(c=>e.jsx(pe,{localPath:c.localPath,loading:a===c.localPath,onClick:()=>{x(c.localPath)}},c.localPath))}):e.jsx(N,{children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"No local projects discovered yet. Open one with Claude or Codex, or create a new project here."})}),l?e.jsx("div",{className:"text-sm text-destructive border border-destructive/20 bg-destructive/5 rounded-xl px-4 py-3 mt-4",children:l}):null]})]}):e.jsxs(e.Fragment,{children:[e.jsx(O,{narrow:!0,icon:F,title:m?`Connecting ${n}`:`Connect ${n}`,subtitle:m?`${n} is starting up and loading your local projects.`:`Run ${n} directly on your machine with full access to your local files and agent project history.`}),e.jsxs("div",{className:"max-w-2xl w-full mx-auto pb-12 px-6",children:[e.jsx(k,{children:"Status"}),e.jsx("div",{className:"mb-8",children:e.jsx(N,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(M,{className:"h-4 w-4 text-muted-foreground animate-spin"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:m?`Connecting to your local ${n} server...`:e.jsxs(e.Fragment,{children:["Not connected. Run ",e.jsx("code",{className:"bg-background border border-border rounded-md mx-0.5 p-1 font-mono text-xs text-foreground",children:g()})," from any terminal on this machine."]})})]})})}),m?null:e.jsxs("div",{className:"mb-10",children:[e.jsx(k,{children:"How it works"}),e.jsx(N,{children:e.jsxs("div",{className:"flex items-start gap-4 py-2 px-2",children:[e.jsx(S,{icon:ce,title:`${n} CLI`,subtitle:"On Your Machine"}),e.jsx(A,{}),e.jsx(S,{icon:_,title:`${n} Server`,subtitle:"Local WebSocket"}),e.jsx(A,{}),e.jsx(S,{icon:F,title:`${n} UI`,subtitle:"Project Chat"})]})})]}),m?null:e.jsxs("div",{className:"mb-10",children:[e.jsx(k,{children:"Setup"}),e.jsx(N,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs(B,{number:1,title:`Start ${n}`,children:[e.jsx("p",{children:"Run this command in your terminal:"}),e.jsx(R,{children:g()})]}),e.jsxs(B,{number:2,title:"Open the local UI",children:[e.jsxs("p",{children:[n," serves the app locally and opens the Local Projects page in an app-style browser window."]}),e.jsx(R,{children:"http://localhost:3210/local"})]}),e.jsxs("div",{className:"mt-8",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground tracking-wider mb-4",children:"Notes"}),e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex gap-4",children:[e.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:g("").trim()}),e.jsx("span",{className:"text-muted-foreground",children:"Start in the current directory"})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:g("--no-open")}),e.jsx("span",{className:"text-muted-foreground",children:"Start the server without opening the browser"})]})]})]})]})})]})]})]}),e.jsx(he,{open:i,onOpenChange:d,onConfirm:c=>{w(c)}}),e.jsx("div",{className:"py-4 text-center",children:e.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["v",Q.split("/")[1]]})})]})}function ye(){const t=ie();return e.jsx("div",{className:"flex-1 flex flex-col min-w-0 min-h-0 relative",children:e.jsx(ge,{connectionStatus:t.connectionStatus,ready:t.localProjectsReady,snapshot:t.localProjects,startingLocalPath:t.startingLocalPath,commandError:t.commandError,newProjectOpen:t.addProjectModalOpen,onNewProjectOpenChange:s=>{if(s){t.openAddProjectModal();return}t.closeAddProjectModal()},onOpenProject:t.handleOpenLocalProject,onCreateProject:t.handleCreateProject})})}export{ye as LocalProjectsPage};