@hearsay-tools/squawk 0.19.0-dev.8877 → 0.19.0-dev.8881

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 (153) hide show
  1. package/package.json +4 -4
  2. package/web/dist/assets/accounts-section-BM-HWieF.js +1 -0
  3. package/web/dist/assets/activity-motion-BlDa0Oee.js +1 -0
  4. package/web/dist/assets/activity-route-BOozKrPn.js +1 -0
  5. package/web/dist/assets/agent-config-section-Bg0OgLPn.js +7 -0
  6. package/web/dist/assets/agent-defaults-section-B-uXUUCT.js +1 -0
  7. package/web/dist/assets/appearance-Cv8Qr8nS.js +1 -0
  8. package/web/dist/assets/archive-on-merge-field-DExgXlBg.js +1 -0
  9. package/web/dist/assets/attention-CnhIF76m.js +1 -0
  10. package/web/dist/assets/{automations-route-Dj5mLsB_.js → automations-route-DqS_DIp2.js} +2 -2
  11. package/web/dist/assets/badge-B6B-xYQQ.js +1 -0
  12. package/web/dist/assets/button-C8jUIs8Q.js +1 -0
  13. package/web/dist/assets/centered-state-BgSV4e79.js +1 -0
  14. package/web/dist/assets/change-counts-wqSYI3W8.js +1 -0
  15. package/web/dist/assets/{code-editor-B4baSOhz.js → code-editor-GfQChdgl.js} +1 -1
  16. package/web/dist/assets/{collapsible-BEV4FO-1.js → collapsible-CW6CfTJO.js} +1 -1
  17. package/web/dist/assets/command-DuxcX6Hr.js +1 -0
  18. package/web/dist/assets/commit-list-a1vNhwzg.js +1 -0
  19. package/web/dist/assets/dialog-Dbu3HnqC.js +1 -0
  20. package/web/dist/assets/diff-DDjPsaQ6.js +3 -0
  21. package/web/dist/assets/diff-controls-QeCV3Sy1.js +1 -0
  22. package/web/dist/assets/diff-stat-Dy4uLuyP.js +1 -0
  23. package/web/dist/assets/{diff-view-mEcoOmP6.js → diff-view-Bv9YauBT.js} +1 -1
  24. package/web/dist/assets/{dist-Da4ckcJG.js → dist-BS5vYfFC.js} +1 -1
  25. package/web/dist/assets/dist-C_rn70hE.js +1 -0
  26. package/web/dist/assets/{dist-DXO3xwbC.js → dist-CtdIjNlG.js} +1 -1
  27. package/web/dist/assets/{dist-BAoXdNsT.js → dist-DDhqweuB.js} +1 -1
  28. package/web/dist/assets/{dist-C5mlVBmd.js → dist-Tubgdd25.js} +1 -1
  29. package/web/dist/assets/dist-VPUfzsfL.js +1 -0
  30. package/web/dist/assets/dropdown-menu-BaqO-x7U.js +1 -0
  31. package/web/dist/assets/{es2015-CQth82uv.js → es2015-DpKptHDx.js} +1 -1
  32. package/web/dist/assets/file-preview-CuwkUuqd.js +2 -0
  33. package/web/dist/assets/folder-browser-CK1mNIQi.js +1 -0
  34. package/web/dist/assets/git-toolbar-BWSmSiqy.js +1 -0
  35. package/web/dist/assets/github-CS_bLWjw.js +1 -0
  36. package/web/dist/assets/{global-activity-route-u1XpCWGK.js → global-activity-route-D7HmA4W3.js} +1 -1
  37. package/web/dist/assets/highlighter-Cfo7mLVB.js +3 -0
  38. package/web/dist/assets/html-report-frame-Ck76gKfA.js +1 -0
  39. package/web/dist/assets/{image-preview-DCUeM8u3.js → image-preview-CeEKI2T5.js} +1 -1
  40. package/web/dist/assets/index-B0_haEFL.js +21 -0
  41. package/web/dist/assets/index-D0mx-XUg.css +1 -0
  42. package/web/dist/assets/label-eNfbfYFG.js +1 -0
  43. package/web/dist/assets/markdown-Djjm7pRl.js +2 -0
  44. package/web/dist/assets/nav-row-styles-CgP5uNp4.js +1 -0
  45. package/web/dist/assets/{notifications-section-CBdv2T-_.js → notifications-section-Dcclastm.js} +1 -1
  46. package/web/dist/assets/{open-in-menu-VhRao_Jk.js → open-in-menu-CSbpfQy7.js} +1 -1
  47. package/web/dist/assets/option-select-DzjSpnye.js +1 -0
  48. package/web/dist/assets/page-shell-CpdYMj52.js +1 -0
  49. package/web/dist/assets/popover-CVo54-aS.js +1 -0
  50. package/web/dist/assets/{preview-pane-connected-B00yRXAd.js → preview-pane-connected-DOnixsSz.js} +3 -3
  51. package/web/dist/assets/{project-location-DATkk1gA.js → project-location-CBzVRz73.js} +1 -1
  52. package/web/dist/assets/{project-router-B9FTk0rB.js → project-router-CEnizJ8F.js} +1 -1
  53. package/web/dist/assets/projects-section-CJAE2fqb.js +1 -0
  54. package/web/dist/assets/prompt-templates-section-BqmYEq-d.js +1 -0
  55. package/web/dist/assets/queries-ByqTmyCs.js +1 -0
  56. package/web/dist/assets/reference-chip-hn8jj_Mo.js +1 -0
  57. package/web/dist/assets/{remote-settings-notice-BJwP8Vi8.js → remote-settings-notice-ChJJ2HzF.js} +1 -1
  58. package/web/dist/assets/repo-git-DzX-ZqFC.js +1 -0
  59. package/web/dist/assets/{report-reader-DDGKyj6B.js → report-reader-DMLkJxpC.js} +1 -1
  60. package/web/dist/assets/report-selection-BkBJw-sm.js +1 -0
  61. package/web/dist/assets/reports-DyilNFvz.js +1 -0
  62. package/web/dist/assets/resources-section-NWZHHXtk.js +1 -0
  63. package/web/dist/assets/{review-panel-5IbppuWS.js → review-panel-BsKM2hDc.js} +8 -8
  64. package/web/dist/assets/{run-detail-refresh-Ye2jcT7n.js → run-detail-refresh-BJ4laDVB.js} +1 -1
  65. package/web/dist/assets/run-header-DpTjMIK-.js +2 -0
  66. package/web/dist/assets/select-CvnOk0OI.js +1 -0
  67. package/web/dist/assets/{session-context-section-nSf23HuY.js → session-context-section-B3bs0GoD.js} +2 -2
  68. package/web/dist/assets/settings-agent-picker-DlX1-8_P.js +1 -0
  69. package/web/dist/assets/settings-shell-1FhhEiGa.css +1 -0
  70. package/web/dist/assets/{settings-shell-BlNdAbSK.js → settings-shell-twGuaJwv.js} +1 -1
  71. package/web/dist/assets/sidebar-section-Crbl2_-9.js +1 -0
  72. package/web/dist/assets/skills-CXdbXepC.js +1 -0
  73. package/web/dist/assets/status-dot-BXf-Ubd0.js +1 -0
  74. package/web/dist/assets/switch-DfPCm1H_.js +1 -0
  75. package/web/dist/assets/tab-link-3A_SF95U.js +1 -0
  76. package/web/dist/assets/task-changes-C8m5S54H.js +1 -0
  77. package/web/dist/assets/{task-commits-C3Aieqql.js → task-commits-CwNBsoyL.js} +1 -1
  78. package/web/dist/assets/{task-file-scope-EBj6BbvL.js → task-file-scope-C313CMq7.js} +1 -1
  79. package/web/dist/assets/task-files-CdpANvF1.js +1 -0
  80. package/web/dist/assets/task-github-item-f4J2WBEt.js +1 -0
  81. package/web/dist/assets/{task-groups-DD46syqv.js → task-groups-BRrlyl5P.js} +1 -1
  82. package/web/dist/assets/{task-thread-CbBHJkXy.js → task-thread-BqoX3viB.js} +2 -2
  83. package/web/dist/assets/{tasks-table-D17JLOhe.js → tasks-table-DtLW8U-4.js} +1 -1
  84. package/web/dist/assets/textarea-vEsJAUAV.js +1 -0
  85. package/web/dist/assets/thread-state-Bh4adRbN.js +4 -0
  86. package/web/dist/assets/toaster-Lf_4oY96.js +4 -0
  87. package/web/dist/assets/use-hand-to-agent-state-C3NlsVVQ.js +1 -0
  88. package/web/dist/assets/workflows-Df7ulEcU.js +7 -0
  89. package/web/dist/assets/{workspace-tools-C2ut23LU.js → workspace-tools-C_93GWNV.js} +1 -1
  90. package/web/dist/assets/{worktrees-section-BE61T3WC.js → worktrees-section-w9Q1xpeU.js} +4 -4
  91. package/web/dist/assets/zoomable-image-BUTgYpld.js +1 -0
  92. package/web/dist/index.html +33 -33
  93. package/web/dist/assets/accounts-section-UJZxye-z.js +0 -1
  94. package/web/dist/assets/activity-motion-BnRBlOlc.js +0 -1
  95. package/web/dist/assets/activity-route-weCjVQ4j.js +0 -1
  96. package/web/dist/assets/agent-config-section-CGrPPEQR.js +0 -7
  97. package/web/dist/assets/agent-defaults-section-mocZoAgX.js +0 -1
  98. package/web/dist/assets/appearance-dnjgFECm.js +0 -1
  99. package/web/dist/assets/archive-on-merge-field-BkwRlcuT.js +0 -1
  100. package/web/dist/assets/attention-ILOaW2-t.js +0 -1
  101. package/web/dist/assets/badge-DQ3U69Ht.js +0 -1
  102. package/web/dist/assets/button-B7MKxYjT.js +0 -1
  103. package/web/dist/assets/centered-state-V15AR_qo.js +0 -1
  104. package/web/dist/assets/change-counts-npLATh-3.js +0 -1
  105. package/web/dist/assets/command-KdW7aO0N.js +0 -1
  106. package/web/dist/assets/commit-list-C8pTI7mp.js +0 -1
  107. package/web/dist/assets/dialog-B531GGAo.js +0 -1
  108. package/web/dist/assets/diff-BUeqeifm.js +0 -3
  109. package/web/dist/assets/diff-controls-n4THBHKo.js +0 -1
  110. package/web/dist/assets/diff-stat-C7KB1kDX.js +0 -1
  111. package/web/dist/assets/dist-BW234Kg5.js +0 -1
  112. package/web/dist/assets/dropdown-menu-4e2iKSMT.js +0 -1
  113. package/web/dist/assets/file-preview-CQdNEFHu.js +0 -2
  114. package/web/dist/assets/folder-browser-B_jJl4is.js +0 -1
  115. package/web/dist/assets/git-toolbar-AbHPGj3l.js +0 -1
  116. package/web/dist/assets/github-DriOZy15.js +0 -1
  117. package/web/dist/assets/highlighter-DvLzHjjY.js +0 -3
  118. package/web/dist/assets/html-report-frame-DkHr39E2.js +0 -1
  119. package/web/dist/assets/index-DOVwFCfP.css +0 -1
  120. package/web/dist/assets/index-_LohQUeF.js +0 -21
  121. package/web/dist/assets/label-DMC9mkYa.js +0 -1
  122. package/web/dist/assets/markdown-DJkMnwyc.js +0 -2
  123. package/web/dist/assets/nav-row-styles-D5HpOmDZ.js +0 -1
  124. package/web/dist/assets/page-shell-7pLJMOgh.js +0 -1
  125. package/web/dist/assets/popover-CZV6tz9i.js +0 -1
  126. package/web/dist/assets/projects-section-BXkVtC6H.js +0 -1
  127. package/web/dist/assets/prompt-templates-section-RF3GKyNP.js +0 -1
  128. package/web/dist/assets/queries-hzlF788B.js +0 -1
  129. package/web/dist/assets/reference-chip-Dgo5aKeb.js +0 -1
  130. package/web/dist/assets/repo-git-DuPmx5Mc.js +0 -1
  131. package/web/dist/assets/report-selection-C-2DJb8L.js +0 -1
  132. package/web/dist/assets/reports-CUVVGSNs.js +0 -1
  133. package/web/dist/assets/resources-section-CO9ePehe.js +0 -1
  134. package/web/dist/assets/run-header-BbjUWTs-.js +0 -2
  135. package/web/dist/assets/select-Cnv2IYdg.js +0 -1
  136. package/web/dist/assets/settings-agent-picker-DFTg6k6E.js +0 -1
  137. package/web/dist/assets/settings-select-CCIMGnyA.js +0 -1
  138. package/web/dist/assets/settings-shell-AMRJAsgc.css +0 -1
  139. package/web/dist/assets/sidebar-section-DmBlDKYf.js +0 -1
  140. package/web/dist/assets/skills-BmwnEyVF.js +0 -1
  141. package/web/dist/assets/status-dot-BRzVlF2X.js +0 -1
  142. package/web/dist/assets/switch-DKqVf8-p.js +0 -1
  143. package/web/dist/assets/tab-link-BlZX-nKP.js +0 -1
  144. package/web/dist/assets/task-changes-BGxKFPHy.js +0 -1
  145. package/web/dist/assets/task-files-BkrKQUzS.js +0 -1
  146. package/web/dist/assets/task-github-item-DdpDpxtU.js +0 -1
  147. package/web/dist/assets/textarea-vJt9undk.js +0 -1
  148. package/web/dist/assets/thread-state-9hRlv8vK.js +0 -4
  149. package/web/dist/assets/toaster-fWyfEGWF.js +0 -4
  150. package/web/dist/assets/use-hand-to-agent-state-CCWMSRyA.js +0 -1
  151. package/web/dist/assets/utils-DSMR_WLb.js +0 -1
  152. package/web/dist/assets/workflows-XpPXRBCU.js +0 -7
  153. package/web/dist/assets/zoomable-image-6RTKhLGE.js +0 -1
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{A as i,_ as a,nn as o,rn as s,sn as c,tn as l}from"./queries-hzlF788B.js";import{B as u,Fn as d,H as f,Ur as p,V as m,_ as h,ar as g,c as ee,d as _,g as v,ir as y,ni as b,nr as x,o as te,s as S,sr as ne,ti as re,v as ie,z as ae}from"./toaster-fWyfEGWF.js";import{B as C,G as oe,H as w,I as T,K as se,N as E,P as D,V as ce,W as O,j as k,z as A}from"./live-protocol-DMhTnCmf.js";import{h as le,n as ue}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as de,t as j}from"./label-DMC9mkYa.js";import{I as fe,J as pe,Y as me,it as he,l as ge,pt as _e,ut as ve,y as ye}from"./design-icons-CzEoMH9c.js";import{t as be}from"./check-OP-CVgZG.js";import{t as M}from"./button-B7MKxYjT.js";import{n as xe,r as Se,t as Ce}from"./collapsible-BEV4FO-1.js";import{a as N,i as P,n as F,r as I,t as L}from"./select-Cnv2IYdg.js";import{t as we}from"./switch-DKqVf8-p.js";import{c as Te,s as Ee,t as R}from"./project-router-B9FTk0rB.js";import{r as De}from"./agents-settings-path-7X6_cvUg.js";import{a as Oe,c as ke,d as Ae,n as je,s as Me,u as z}from"./page-shell-7pLJMOgh.js";import{t as Ne}from"./centered-state-V15AR_qo.js";import{D as Pe,G as Fe,In as Ie,Ln as Le,N as Re,O as ze,Sn as Be,W as Ve,Zn as B,k as He,mn as Ue,q as We,r as Ge,t as Ke,ur as qe,vn as Je}from"./index-_LohQUeF.js";import{t as Ye}from"./textarea-vJt9undk.js";import{_ as Xe,a as Ze,c as Qe,d as $e,f as et,g as tt,h as nt,i as rt,l as it,m as at,n as ot,o as st,p as ct,r as lt,s as ut,t as V,u as dt,v as ft}from"./automation-format-DB34jUyF.js";var H=e(t(),1),U=k([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),pt=C({includeExisting:D().optional(),authors:E(O()).optional(),assignees:E(O()).optional(),requireCurrentLabels:D().optional(),allLabels:E(O()).optional(),anyLabels:E(O()).optional(),excludeLabels:E(O()).optional(),changedLabels:E(O()).optional(),lookbackDays:A(),maxRecords:A()}),mt=k([`github`,`schedule`]),ht=x.omit({task:!0,images:!0,systemPrompt:!0}).extend({prompt:O(),variants:oe([T(1),T(2),T(3)]).optional(),systemPrompt:O().optional()}),gt=C({at:O(),outcome:k([`launched`,`cancelled`]),runId:O().optional(),receiptId:O().optional(),trigger:k([`schedule`,`late`,`manual`,`retry`]).optional()}),W=C({id:O(),revision:A(),name:O(),description:O().optional(),enabled:D(),kind:mt,events:E(U).optional(),intervalSeconds:A().optional(),filters:pt.optional(),schedule:Qe.optional(),task:ht,archived:gt.optional(),createdAt:O(),updatedAt:O()}),G=C({timestamp:O(),tieBreaker:O().optional()}),_t=C({since:O().datetime(),until:O().datetime(),source:A().int().min(0).max(2),page:A().int().min(1).max(10),item:A().int().min(0).max(100),event:A().int().min(0).max(1e3),cursor:G.optional()}),vt={lastError:O().max(1e3).optional(),lastErrorAt:O().datetime().optional()},yt=C({revision:A().optional(),baselineAt:O().optional(),armedAt:O().optional(),historyScan:_t.optional(),cursor:G.optional(),frozenHighWatermark:G.extend({tieBreaker:O()}).optional(),backlogAfter:G.extend({tieBreaker:O()}).optional(),nextCheckAt:O().optional(),lastSuccessAt:O().optional(),nextRunAt:O().optional(),lastRunAt:O().optional(),etags:w(O(),O()).optional(),backoffUntil:O().optional(),consecutiveFailures:A().optional(),...vt,onceOutcome:k([`failed`,`missed`]).optional()});function bt(e){let t=e?.consecutiveFailures??0;if(!(t<3||!e?.lastError))return{consecutiveFailures:t,lastError:e.lastError,...e.lastErrorAt?{lastErrorAt:e.lastErrorAt}:{},...e.backoffUntil?{retryAt:e.backoffUntil}:{}}}var xt=k([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]),St=C({seq:A(),ts:O(),automationId:O(),revision:A(),event:U.optional(),result:xt,reason:O().optional(),durationMs:A().optional(),receiptId:O().optional(),runId:O().optional(),githubNumber:A().optional(),githubTitle:O().optional(),githubUrl:O().optional(),rateLimit:C({bucket:k([`core`,`search`]),remaining:A().optional(),resetAt:O().optional()}).optional()}),Ct=C({matches:A(),launched:A(),duplicates:A(),errors:A()}),wt=W.extend({state:yt.optional(),latestLog:St.optional(),counts:Ct,nextRunAt:O().optional(),onceStatus:ct.optional()});C({available:D(),reason:O().optional(),timeZone:O(),scheduler:C({state:k([`scheduled`,`idle`]),nextDue:O().optional()}),automations:E(wt)}),C({automation:W}).extend({once:C({dueAt:O(),timeZone:O(),resolvedInstant:O(),note:O()}).optional()}),C({automation:W,state:yt.optional(),latestLog:St.optional(),onceStatus:ct.optional()}),C({id:O(),automationId:O(),mode:k([`preview`,`execute`]),status:k([`queued`,`running`,`complete`,`error`]),createdAt:O(),completedAt:O().optional(),matches:A().optional(),truncated:D().optional(),error:O().optional()}),C({checkId:O()}),C({records:E(St)}),C({receiptId:O(),runId:O()}),C({runId:O()}),W.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0,kind:!0,archived:!0}).extend({kind:mt.optional(),task:ht.omit({variants:!0}).strict(),enable:D().optional()}).omit({enable:!0}).extend({enabled:D().optional(),expectedRevision:A()}),C({archived:k([`include`,`only`]).optional()}),C({mode:k([`preview`,`execute`])});var K=n();function q({text:e}){return(0,K.jsx)(`div`,{role:`status`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:e})}var Tt={launched:`success`,manual:`success`,"catch-up":`success`,skipped:`neutral`,missed:`pending`,"no-match":`neutral`,preview:`neutral`,baseline:`neutral`,duplicate:`neutral`,failed:`danger`,error:`danger`,"rate-limited":`danger`},Et={launched:`Launched`,manual:`Manual`,"catch-up":`Catch up`,skipped:`Skipped`,missed:`Missed`,"no-match":`No match`,preview:`Preview`,baseline:`Baseline`,duplicate:`Duplicate`,failed:`Failed`,error:`Error`,"rate-limited":`Rate limited`};function Dt(e){let[t,n]=(0,H.useState)(),[r,i]=(0,H.useState)(``),a=(0,H.useCallback)(t=>h(e,{signal:t}).then(({records:e})=>{t?.aborted||(n(e),i(``))}).catch(e=>{t?.aborted||i(String(e))}),[e]);return(0,H.useEffect)(()=>{a()},[a]),(0,H.useEffect)(()=>p(a),[a]),(0,H.useEffect)(()=>de((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function Ot(e,t){return e.result!==`failed`&&e.result!==`error`||!e.receiptId||e.runId?!1:!t.some(t=>t.receiptId===e.receiptId&&(t.runId||t.seq>e.seq))}function kt({records:e,all:t,timeZone:n,onRetried:r,readOnly:i=!1}){let a=e=>!i&&Ot(e,t),[o,s]=(0,H.useState)(),[c,l]=(0,H.useState)(),u=Date.now(),d=async e=>{s(e),l(void 0);try{await ae(e),r()}catch(t){l({receiptId:e,message:t instanceof Error?t.message:String(t)})}finally{s(void 0)}};return(0,K.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:e.map(e=>(0,K.jsxs)(`li`,{className:`min-w-0 rounded-xl border border-card-edge bg-card p-4 shadow-card`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(Ge,{dot:Tt[e.result],children:Et[e.result]}),(0,K.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:ot(e.ts,n,u)})]}),e.reason?(0,K.jsx)(`p`,{className:`mt-2 text-sm break-words text-muted-foreground`,children:e.reason}):null,e.githubUrl||e.runId||a(e)?(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[e.githubUrl?(0,K.jsx)(`a`,{className:`inline-flex min-h-11 items-center underline underline-offset-4 break-all`,href:e.githubUrl,target:`_blank`,rel:`noreferrer`,children:e.githubTitle??`GitHub #${e.githubNumber??``}`}):null,e.runId?(0,K.jsx)(R,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`}):null,a(e)?(0,K.jsx)(M,{variant:`outline`,disabled:o===e.receiptId,onClick:()=>void d(e.receiptId),children:`Retry task`}):null]}):null,c&&c.receiptId===e.receiptId?(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm break-words text-destructive`,children:c.message}):null]},e.seq))})}var J=`all`;function At({label:e,value:t,onChange:n,options:r}){return(0,K.jsxs)(L,{value:t,onValueChange:n,children:[(0,K.jsx)(P,{"aria-label":e,className:`w-full sm:w-52`,children:(0,K.jsx)(N,{})}),(0,K.jsx)(F,{children:r.map(e=>(0,K.jsx)(I,{value:e.value,children:e.label},e.value))})]})}function jt({automationId:e,automationName:t,timeZone:n,readOnly:r=!1}){let{records:i,error:a,refresh:o}=Dt(e),[s,c]=(0,H.useState)(J),[l,u]=(0,H.useState)(J),d=(0,H.useMemo)(()=>(i??[]).filter(e=>(s===J||e.result===s)&&(l===J||e.event===l)),[i,s,l]),f=(i??[]).some(e=>e.event);return(0,K.jsx)(ke,{route:`automations`,density:i?Ae(d.length):`full`,header:{title:`Execution log`,subtitle:t??`Automation activity`,secondaryActions:(0,K.jsx)(Me,{variant:`outline`,asChild:!0,children:(0,K.jsx)(R,{to:`/automations`,children:`Back to automations`})})},children:a&&!i?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,K.jsx)(q,{text:a}),(0,K.jsx)(M,{variant:`outline`,onClick:()=>void o(),children:`Retry`})]}):i?i.length===0?(0,K.jsx)(q,{text:`Nothing has run yet.`}):(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(At,{label:`Result`,value:s,onChange:c,options:[{value:J,label:`All results`},...xt.options.map(e=>({value:e,label:Et[e]}))]}),f?(0,K.jsx)(At,{label:`Event`,value:l,onChange:u,options:[{value:J,label:`All events`},...U.options.map(e=>({value:e,label:e}))]}):null]}),d.length===0?(0,K.jsx)(q,{text:`No rows match these filters.`}):(0,K.jsx)(kt,{records:d,all:i,timeZone:n,onRetried:()=>void o(),readOnly:r})]}):(0,K.jsx)(q,{text:`Loading execution log…`})})}function Mt({automationId:e,automationName:t,timeZone:n,showName:r=!1,readOnly:i=!1}){let{records:a,error:o,refresh:s}=Dt(e),c=`Recent activity${r&&t?` · ${t}`:``}`;return!o&&a&&a.length===0?(0,K.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`flex flex-wrap items-center gap-x-2 border-t border-border pt-2.5 text-xs text-muted-foreground`,children:[(0,K.jsx)(`h3`,{className:`font-medium text-foreground`,children:c}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,K.jsx)(`p`,{children:`Nothing has run yet.`})]}):(0,K.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`min-w-0 border-t border-border pt-2.5`,children:[(0,K.jsx)(`h3`,{className:`mb-1.5 text-xs font-medium text-muted-foreground`,children:c}),o&&!a?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,K.jsx)(q,{text:o}),(0,K.jsx)(M,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]}):a?(0,K.jsx)(kt,{records:a.slice(0,5),all:a,timeZone:n,onRetried:()=>void s(),readOnly:i}):(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading activity…`})]})}function Nt({automation:e,timeZone:t,onDeleted:n}){let r=e.archived,i=e.schedule,a=i?lt(i):null,[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(``),f=(0,H.useRef)(null),p=(0,H.useRef)(null),m=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=m.current===`keep`?p.current:m.current===`delete`?f.current:null;m.current=null,e?.focus()},[o]);let h=async()=>{l(!0);try{await _(e.id),n()}catch(e){d(e instanceof Error?e.message:String(e)),l(!1)}},g=[[`Workflow`,e.task.workflow],[`Runner`,e.task.runner],[`Model`,e.task.model],[`Effort`,e.task.effort]];return(0,K.jsx)(ke,{route:`automations`,density:`sparse`,header:{title:e.name,subtitle:`Archived one-time schedule. It cannot change; delete it when you no longer need the record.`},children:(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[(0,K.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,K.jsxs)(`p`,{className:`text-sm break-words`,children:[(0,K.jsx)(`span`,{children:r.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`}),r.runId?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(R,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${r.runId}`,children:`Open task`})]}):null]}),(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Archived ${V(r.at,t)} (${t}).`}),a&&i?.timeZone?(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Was due ${a.date} ${a.time} (${i.timeZone}).`}):null]}),(0,K.jsxs)(`section`,{"aria-labelledby":`archived-inputs`,className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,K.jsx)(`h2`,{id:`archived-inputs`,className:`mb-3 text-[15px] font-medium`,children:`What it ran with`}),(0,K.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[(0,K.jsxs)(`div`,{className:`grid gap-1`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:`Prompt`}),(0,K.jsx)(`dd`,{className:`break-words whitespace-pre-wrap`,children:e.task.prompt})]}),g.filter(([,e])=>e).map(([e,t])=>(0,K.jsxs)(`div`,{className:`grid gap-1`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,K.jsx)(`dd`,{className:`break-words`,children:t})]},e))]})]}),(0,K.jsxs)(`section`,{className:`min-w-0`,children:[(0,K.jsx)(Mt,{automationId:e.id,automationName:e.name,timeZone:t,readOnly:!0}),(0,K.jsx)(M,{variant:`outline`,asChild:!0,className:`mt-3`,children:(0,K.jsx)(R,{to:`/automations/${e.id}/log`,children:`Execution log`})})]}),(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[o?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? Its record and log are removed; the task stays.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(M,{variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:c,onClick:()=>void h(),children:`Delete schedule`}),(0,K.jsx)(M,{ref:p,variant:`outline`,disabled:c,onClick:()=>{m.current=`delete`,s(!1)},children:`Keep`})]})]}):(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(M,{ref:f,variant:`outline`,"data-action":`automation-delete`,onClick:()=>{m.current=`keep`,s(!0)},children:`Delete`}),(0,K.jsx)(M,{variant:`outline`,asChild:!0,children:(0,K.jsx)(R,{to:`/automations`,children:`Back to automations`})})]}),u?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:u}):null]})]})})}var Pt=k([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),Y=E(O().trim().min(1).max(200)).max(100).optional(),Ft=C({includeExisting:D().optional(),requireCurrentLabels:D().optional(),authors:Y,assignees:Y,allLabels:Y,anyLabels:Y,excludeLabels:Y,changedLabels:Y,lookbackDays:A().int().min(1).max(90).default(7),maxRecords:A().int().min(1).max(100).default(25)}).passthrough(),It=C({prompt:O().min(1).max(1e5),workflow:O().trim().min(1).max(200).optional(),steps:E(y).min(1).max(100).optional(),runner:re.optional(),model:O().trim().min(1).max(200).optional(),effort:O().trim().min(1).max(32).optional(),variants:oe([T(1),T(2),T(3)]).optional(),worktree:D().optional(),autonomous:D().optional(),...g,...ne,systemPrompt:O().max(1e5).optional()}).passthrough().refine(e=>!(e.workflow&&e.steps),{message:`task selects either a named workflow or inline steps, not both`}),Lt=new Set(Object.keys(It.shape).filter(e=>e!==`variants`));function Rt(e){return Object.fromEntries(Object.entries(e).filter(([e])=>Lt.has(e)))}ce(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e;return t.kind===`schedule`?e:{...t,intervalSeconds:t.intervalSeconds??300,filters:t.filters??{}}},C({id:O().min(1).max(100),revision:A().int().positive(),name:O().trim().min(1).max(200),description:O().max(2e3).optional(),enabled:D().default(!1),kind:mt.default(`github`),events:E(Pt).min(1).max(4).optional(),intervalSeconds:A().int().min(60).max(86400).optional(),filters:Ft.optional(),schedule:Qe.passthrough().optional(),task:It,archived:C({at:O().datetime(),outcome:k([`launched`,`cancelled`]),runId:O().optional(),receiptId:O().optional(),trigger:k([`schedule`,`late`,`manual`,`retry`]).optional()}).passthrough().optional(),createdAt:O().datetime(),updatedAt:O().datetime()}).passthrough().superRefine((e,t)=>{if(e.kind===`schedule`){e.schedule||t.addIssue({code:b.custom,path:[`schedule`],message:`a scheduled automation needs a schedule`});return}e.events?.length||t.addIssue({code:b.custom,path:[`events`],message:`a GitHub automation needs at least one event`}),e.intervalSeconds===void 0&&t.addIssue({code:b.custom,path:[`intervalSeconds`],message:`a GitHub automation needs a poll interval`}),e.filters||t.addIssue({code:b.custom,path:[`filters`],message:`a GitHub automation needs its bounded filter`}),e.events?.some(e=>e===`issue.labeled`||e===`issue.unlabeled`)&&!e.filters?.changedLabels?.length&&t.addIssue({code:b.custom,path:[`filters`,`changedLabels`],message:`changedLabels is required for issue label events`})})),C({version:T(1).default(1),automations:E(se()).default([]),tombstones:w(O(),O().datetime()).optional()}).passthrough();var X=C({timestamp:O().datetime(),tieBreaker:O().optional()}).passthrough(),zt=_t.extend({cursor:X.optional()}),Bt=C({revision:A().int().positive().optional(),baselineAt:O().datetime().optional(),armedAt:O().datetime().optional(),historyScan:zt.optional(),cursor:X.optional(),frozenHighWatermark:X.extend({tieBreaker:O()}).optional(),backlogAfter:X.extend({tieBreaker:O()}).optional(),nextCheckAt:O().datetime().optional(),lastSuccessAt:O().datetime().optional(),nextRunAt:O().datetime().optional(),lastRunAt:O().datetime().optional(),etags:w(O(),O()).optional(),backoffUntil:O().datetime().optional(),consecutiveFailures:A().int().nonnegative().optional(),...vt,onceOutcome:k([`failed`,`missed`]).optional()}).passthrough();C({version:T(1).default(1),states:w(O(),Bt).default({})}).passthrough(),C({receiptId:O().min(1),receiptKey:O().min(1),eventId:O().min(1),automationId:O().min(1),revision:A().int().positive(),status:k([`reserved`,`launched`,`launch-error`,`released`]),runId:O().optional(),observedAt:O().datetime(),updatedAt:O().datetime(),error:O().max(2e3).optional(),occurrenceAt:O().datetime().optional(),candidate:C({eventId:O(),event:Pt,timestamp:O().datetime(),tieBreaker:O(),repo:O(),nodeId:O(),number:A().int().positive(),title:O().max(500),url:O().url(),author:O().max(200),assignees:E(O().max(200)).max(100),labels:E(O().max(200)).max(100),changedLabel:O().max(200).optional()}).passthrough().optional()}).passthrough();var Vt=k([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]);C({seq:A().int().positive(),ts:O().datetime(),automationId:O().min(1),revision:A().int().positive(),event:Pt.optional(),result:Vt,reason:O().max(2e3).optional(),durationMs:A().int().nonnegative().optional(),receiptId:O().optional(),runId:O().optional(),githubNumber:A().int().positive().optional(),githubTitle:O().max(500).optional(),githubUrl:O().url().optional(),rateLimit:C({bucket:k([`core`,`search`]),remaining:A().int().nonnegative().optional(),resetAt:O().datetime().optional()}).passthrough().optional()}).passthrough();var Ht=`quick-task`;function Ut(e={}){let{prompt:t,workflow:n,runner:r,model:i,autonomous:a,archiveWhenDone:o,autoMergePr:s,allowWorkers:c,allowMessaging:l,...u}=Rt(e.task??{prompt:``}),d=e.task===void 0;return{name:e.name??``,description:e.description??``,kind:e.kind??`schedule`,schedule:dt(e.schedule??{type:`daily`}),events:e.events??[U.options[0]],intervalSeconds:e.intervalSeconds??300,filters:e.filters??{lookbackDays:7,maxRecords:25},prompt:t,...n===void 0?d?{workflow:Ht}:{}:{workflow:n},...r===void 0?{}:{runner:r},...i===void 0?{}:{model:i},autonomous:a??!0,archiveWhenDone:o??!1,autoMergePr:s??!1,allowWorkers:c!==!1,allowMessaging:l!==!1,enabled:e.enabled??e.enable??!1,taskExtra:u}}function Wt(e){switch(e.type){case`daily`:case`weekdays`:return{type:e.type,hour:e.hour,minute:e.minute};case`weekly`:return{type:`weekly`,hour:e.hour,minute:e.minute,day:e.day};case`hours`:return{type:`hours`,every:e.every};case`once`:return{type:`once`,at:e.at??``,timeZone:e.timeZone??``,...e.latestStartMinutes===void 0?{}:{latestStartMinutes:e.latestStartMinutes}}}}function Gt(e){return{...e.taskExtra,prompt:e.prompt,...e.workflow?{workflow:e.workflow}:{},...e.runner?{runner:e.runner}:{},...e.model?{model:e.model}:{},autonomous:e.autonomous,...e.archiveWhenDone?{archiveWhenDone:!0}:{},...e.autoMergePr?{autoMergePr:!0}:{},...e.allowWorkers?{}:{allowWorkers:!1},...e.allowMessaging?{}:{allowMessaging:!1}}}function Kt(e){return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},kind:e.kind,...e.kind===`schedule`?{schedule:Wt(e.schedule)}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:Gt(e)}}function qt(e){return{...Kt(e),enable:e.enabled}}function Jt(e,t){return{...Kt(e),task:{...Gt(e),archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging},enabled:e.enabled,expectedRevision:t}}function Z(e){return`'${e.replace(/'/g,`'\\''`)}'`}var Yt=new Set([`prompt`,`workflow`,`runner`,`model`,`autonomous`,`worktree`,`archiveWhenDone`,`autoMergePr`,`allowWorkers`,`allowMessaging`]),Xt=new Set([`anyLabels`,`authors`,`changedLabels`]);function Zt(e){if(e.description!==void 0||!e.name.trim()||!e.task.prompt.trim())return!1;let t=e.task;if(Object.keys(t).some(e=>!Yt.has(e))||t.archiveWhenDone===!1||t.autoMergePr===!1||t.allowWorkers===!0||t.allowMessaging===!0||t.worktree!==!0)return!1;if(e.kind===`schedule`)return e.schedule!==void 0;let{events:n,filters:r}=e;return!n?.length||n.some(e=>e.includes(`,`))||!r||r.lookbackDays!==7||r.maxRecords!==25?!1:Object.entries(r).every(([e,t])=>e===`lookbackDays`||e===`maxRecords`||e===`includeExisting`&&t===!0||Xt.has(e)&&Array.isArray(t)&&t.length>0)}function Qt(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function $t(e){return e%1440==0?`${e/1440}d`:e%60==0?`${e/60}h`:`${e}m`}function Q(e,t){return t.startsWith(`-`)?`--${e}=${Z(t)}`:`--${e} ${Z(t)}`}function en(e){let t=[`${Ue()} automation add`,Q(`name`,e.name)];if(e.schedule?.type===`once`)t.push(Q(`at`,e.schedule.at),Q(`tz`,e.schedule.timeZone)),e.schedule.latestStartMinutes!==void 0&&t.push(Q(`latest-start`,$t(e.schedule.latestStartMinutes)));else if(e.kind===`schedule`)t.push(Q(`cron`,it(e.schedule)));else{t.push(Q(`on`,e.events.join(`,`)),`--every ${Qt(e.intervalSeconds??300)}`),e.filters?.includeExisting&&t.push(`--include-existing`);for(let n of e.filters?.anyLabels??[])t.push(Q(`label`,n));for(let n of e.filters?.authors??[])t.push(Q(`author`,n));for(let n of e.filters?.changedLabels??[])t.push(Q(`changed-label`,n))}return t.push(...tn(e.task)),e.enable===!0&&t.push(`--enable`),t.push(Q(`prompt`,e.task.prompt)),t.join(` `)}function tn(e){let t=[];return e.workflow&&t.push(Q(`workflow`,e.workflow)),e.runner&&t.push(Q(`runner`,e.runner)),e.model&&t.push(Q(`model`,e.model)),e.autonomous===!1&&t.push(`--no-autonomous`),e.archiveWhenDone&&t.push(`--archive-when-done`),e.autoMergePr&&t.push(`--auto-merge-pr`),e.allowWorkers===!1&&t.push(`--no-workers`),e.allowMessaging===!1&&t.push(`--no-messaging`),t}function nn(e,t){let n=qt(e),r=Zt(n)?en(n):`${Ue()} automation create --json ${Z(JSON.stringify(n))}`;return t?`CEZ_COCKPIT_URL=${Z(t.origin)} CEZ_PROJECT_ID=${Z(t.projectId)} HSQ_COCKPIT_URL=${Z(t.origin)} HSQ_PROJECT_ID=${Z(t.projectId)} ${r}`:r}function rn(e){let t=[],n=!1;for(let r of an(e)){let e=t.length-1;!n&&/^[A-Z_][A-Z0-9_]*=/.test(r)?t.push(r):r.startsWith(`--`)||!n?(t.push(r),n=!0):t[e]=`${t[e]} ${r}`}return t.map((e,t)=>t===0?e:` ${e}`).join(` \\
2
- `)}function an(e){let t=[],n=``,r=!1;for(let i=0;i<e.length;i+=1){let a=e[i];!r&&a===`\\`&&i+1<e.length?(n+=a+e[i+1],i+=1):a===`'`?(r=!r,n+=a):a===` `&&!r?(n&&t.push(n),n=``):n+=a}return n&&t.push(n),t}function on({draft:e}){let t=Ee(),n=window.location.origin,i=(0,H.useMemo)(()=>{let r=nn(e);return t?`HSQ_COCKPIT_URL=${Z(n)} HSQ_PROJECT_ID=${Z(t)} ${r}`:r},[e,n,t]),a=(0,H.useMemo)(()=>rn(i),[i]),[o,s]=(0,H.useState)(`idle`),[c,l]=(0,H.useState)(!1),u=(0,H.useId)(),d=(0,H.useRef)(void 0);(0,H.useEffect)(()=>()=>clearTimeout(d.current),[]),(0,H.useEffect)(()=>s(`idle`),[i]);let f=async()=>{clearTimeout(d.current);try{await navigator.clipboard.writeText(a),s(`copied`),d.current=setTimeout(()=>s(`idle`),1600)}catch{s(`failed`)}};return(0,K.jsxs)(`section`,{"aria-labelledby":`copy-as-cli-heading`,"data-slot":`copy-as-cli`,className:`min-w-0 max-w-full overflow-hidden rounded-xl border border-card-edge bg-card shadow-card px-4 py-3.5`,children:[(0,K.jsxs)(`div`,{className:`flex min-h-8 min-w-0 flex-nowrap items-center justify-between gap-x-2`,children:[(0,K.jsx)(`h2`,{id:`copy-as-cli-heading`,className:`shrink-0 text-[13px] font-medium text-muted-foreground`,children:`Copy as CLI`}),(0,K.jsxs)(M,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`copy-as-cli-toggle`,"aria-expanded":c,"aria-controls":u,"aria-label":c?`Hide command`:`Show command`,className:`min-w-0 shrink gap-1 px-1.5 text-[12px] font-medium max-md:h-11 no-hover:h-11`,onClick:()=>l(e=>!e),children:[(0,K.jsx)(`span`,{className:`truncate`,children:c?`Hide`:`Show`}),(0,K.jsx)(ge,{"aria-hidden":`true`,className:r(`size-3.5 transition-transform`,c&&`rotate-180`)})]}),(0,K.jsxs)(M,{type:`button`,variant:`outline`,size:`sm`,className:`ms-auto gap-1.5 px-2 text-[12px] font-medium max-md:h-11 no-hover:h-11`,onClick:()=>void f(),children:[o===`copied`?(0,K.jsx)(be,{"aria-hidden":`true`,className:`size-3.5`}):(0,K.jsx)(qe,{"aria-hidden":`true`,className:`size-3.5`}),o===`copied`?`Copied`:`Copy`]})]}),(0,K.jsx)(`div`,{id:u,hidden:!c,className:`mbs-2 max-w-full rounded-lg border border-border bg-muted has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-ring`,children:(0,K.jsx)(`pre`,{"data-slot":`copy-as-cli-line`,tabIndex:0,"aria-label":`Command line`,className:`m-0 max-w-full px-3 pt-2.5 pb-3 font-mono text-xs leading-5 break-all whitespace-pre-wrap text-muted-foreground outline-none`,children:a})}),(0,K.jsx)(`p`,{role:`status`,className:`mbs-2 text-xs break-words text-muted-foreground`,children:o===`failed`?`Could not copy — select the line and copy it by hand.`:(0,K.jsxs)(K.Fragment,{children:[`The definition Save paused would create. `,(0,K.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-px font-mono text-xs whitespace-nowrap text-foreground [word-spacing:-0.2em]`,children:`${Ue()} automation schema`}),` prints its shape.`]})})]})}function sn({pressed:e,onClick:t,disabled:n,children:i}){return(0,K.jsx)(`button`,{type:`button`,"aria-pressed":e,disabled:n,onClick:t,className:r(`inline-flex min-h-11 items-center justify-center rounded-md border px-3.5 text-[13px] font-medium transition-colors outline-hidden focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50`,e?`border-border bg-card font-semibold text-foreground shadow-xs`:`border-transparent bg-transparent text-muted-foreground hover:text-foreground`),children:i})}var cn={"pull_request.opened":`a pull request opens`,"issue.opened":`an issue opens`,"issue.labeled":`an issue is labeled`,"issue.unlabeled":`an issue is unlabeled`},ln={"pull_request.opened":`Pull request opened`,"issue.opened":`Issue opened`,"issue.labeled":`Issue labeled`,"issue.unlabeled":`Issue unlabeled`};function un(e){let t=e.map(e=>cn[e]);if(t.length===0)return`When GitHub changes`;let n=t.slice(0,-1),r=t[t.length-1];return`When ${n.length>0?`${n.join(`, `)} or ${r}`:r}`}var dn=U.options,fn=[{seconds:60,label:`1 minute`},{seconds:300,label:`5 minutes`},{seconds:900,label:`15 minutes`},{seconds:1800,label:`30 minutes`},{seconds:3600,label:`1 hour`}],pn=[{key:`authors`,label:`Authors`},{key:`assignees`,label:`Assignees`},{key:`allLabels`,label:`Has all labels`},{key:`anyLabels`,label:`Has any label`},{key:`excludeLabels`,label:`Excludes labels`},{key:`changedLabels`,label:`Changed labels`,hint:`Required for the two label events.`}],mn=e=>(e??[]).join(`, `),hn=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function gn(e){return e?`Existing matches within the lookback are eligible on the next check. Previously processed matches will not run again.`:`Enabling starts from a current-time baseline. Existing matches will not launch tasks.`}function _n(e){let t=Math.max(1,Math.round(e.intervalSeconds/60));return`Polls GitHub every ${t} minute${t===1?``:`s`} for ${e.events.join(`, `)||`no events`}. ${gn(e.filters.includeExisting)}`}function vn({draft:e,onChange:t,disabledReason:n}){let r=n=>{t({events:e.events.includes(n)?e.events.filter(e=>e!==n):[...e.events,n]})},i=n=>t({filters:{...e.filters,...n}}),a=(n,r)=>{let i=hn(r),{[n]:a,...o}=e.filters;t({filters:i.length?{...o,[n]:i}:o})},o=fn.some(t=>t.seconds===e.intervalSeconds)?fn:[...fn,{seconds:e.intervalSeconds,label:`${Math.round(e.intervalSeconds/60)} minutes`}].sort((e,t)=>e.seconds-t.seconds);return(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[n?(0,K.jsx)(`p`,{className:`text-xs text-pending-strong`,children:`GitHub unavailable · ${n}`}):null,(0,K.jsx)(`div`,{role:`group`,"aria-label":`GitHub events`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:dn.map(t=>(0,K.jsx)(sn,{pressed:e.events.includes(t),onClick:()=>r(t),children:ln[t]},t))}),(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-interval`,children:`Check every`}),(0,K.jsxs)(L,{value:String(e.intervalSeconds),onValueChange:e=>t({intervalSeconds:Number(e)}),children:[(0,K.jsx)(P,{id:`automation-interval`,className:`w-full sm:w-48`,"aria-label":`Check every`,children:(0,K.jsx)(N,{})}),(0,K.jsx)(F,{children:o.map(e=>(0,K.jsx)(I,{value:String(e.seconds),children:e.label},e.seconds))})]})]}),(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,K.jsx)(we,{"aria-label":`Include existing items`,"aria-describedby":`automation-history-hint`,checked:e.filters.includeExisting??!1,onCheckedChange:e=>i({includeExisting:e})}),(0,K.jsx)(`span`,{children:`Include existing items`})]}),(0,K.jsx)(`p`,{id:`automation-history-hint`,className:`text-xs text-muted-foreground`,children:gn(e.filters.includeExisting)})]}),(0,K.jsxs)(Ce,{children:[(0,K.jsxs)(Se,{className:`group flex min-h-11 items-center gap-2 text-sm font-medium`,children:[`Filters`,(0,K.jsx)(ge,{"aria-hidden":`true`,className:`size-4 text-soft-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-180`})]}),(0,K.jsx)(xe,{children:(0,K.jsxs)(`div`,{className:`grid gap-4 pt-2 sm:grid-cols-2`,children:[pn.map(t=>(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-filter-${t.key}`,children:t.label}),(0,K.jsx)(B,{id:`automation-filter-${t.key}`,className:`border-border`,placeholder:`comma separated`,value:mn(e.filters[t.key]),onChange:e=>a(t.key,e.target.value)}),t.hint?(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.hint}):null]},t.key)),(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-filter-lookback`,children:`Look back (days)`}),(0,K.jsx)(B,{id:`automation-filter-lookback`,className:`border-border`,type:`number`,min:1,value:e.filters.lookbackDays,onChange:e=>i({lookbackDays:Math.max(1,Number(e.target.value)||1)})})]}),(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-filter-max`,children:`Max records per check`}),(0,K.jsx)(B,{id:`automation-filter-max`,className:`border-border`,type:`number`,min:1,value:e.filters.maxRecords,onChange:e=>i({maxRecords:Math.max(1,Number(e.target.value)||1)})})]})]})})]})]})}var yn=e=>String(e).padStart(2,`0`);function bn({label:e,value:t,max:n,onCommit:r}){let[i,a]=(0,H.useState)(yn(t)),o=(0,H.useRef)(null),s=!(/^\d{1,2}$/.test(i)&&Number(i)===t),c=`${e} must be 00–${yn(n)}.`,l=(0,H.useId)();return(0,H.useEffect)(()=>{o.current?.setCustomValidity(s?c:``)},[s,c]),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{ref:o,"aria-label":e,"aria-invalid":s||void 0,"aria-describedby":s?l:void 0,inputMode:`numeric`,maxLength:2,className:`w-20 border-border text-center tabular-nums`,value:i,onChange:e=>{a(e.target.value),/^\d{1,2}$/.test(e.target.value)&&Number(e.target.value)<=n&&r(Number(e.target.value))},onBlur:()=>a(yn(t))}),s?(0,K.jsx)(`p`,{id:l,className:`order-last basis-full text-xs text-destructive`,children:c}):null]})}var xn=[{minutes:void 0,label:`No limit`},{minutes:30,label:`30 minutes`},{minutes:120,label:`2 hours`},{minutes:360,label:`6 hours`},{minutes:1440,label:`1 day`},{minutes:10080,label:`7 days`}],Sn=`none`,Cn=e=>String(e).padStart(2,`0`);function wn(e,t=Date.now()){let n=ft(t,e)??ft(t,`UTC`),r=new Date(Date.UTC(n.year,n.month-1,n.day+1));return`${r.getUTCFullYear()}-${Cn(r.getUTCMonth()+1)}-${Cn(r.getUTCDate())}T09:00`}function Tn(){let e=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];return e.includes(`UTC`)?e:[`UTC`,...e]}function En({value:e,stored:t,onChange:n}){let r=t=>n({...e,...t}),i=e.at?at(e.at):null,a=e.at?.slice(0,10)??``,o=i?.hour??9,s=i?.minute??0,c=(e,t,n)=>r({at:`${e}T${Cn(t)}:${Cn(n)}`}),l=(0,H.useRef)(null),u=(0,H.useId)(),d=et(e),f=!(t?.type===`once`&&t.at===e.at&&t.timeZone===e.timeZone)&&d!==null&&d<=Date.now();(0,H.useEffect)(()=>{l.current?.setCustomValidity(f?Ze:``)},[f]);let p=lt(e);return(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-once-date`,children:`Date`}),(0,K.jsx)(B,{ref:l,id:`automation-once-date`,type:`date`,className:`w-44 max-w-full border-border`,value:a,"aria-invalid":f||void 0,"aria-describedby":f?u:void 0,onChange:e=>{/^\d{4}-\d{2}-\d{2}$/.test(e.target.value)&&c(e.target.value,o,s)},required:!0})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,K.jsx)(bn,{label:`Hour`,value:o,max:23,onCommit:e=>c(a,e,s)}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,K.jsx)(bn,{label:`Minute`,value:s,max:59,onCommit:e=>c(a,o,e)})]})]}),f?(0,K.jsx)(`p`,{id:u,className:`text-xs text-destructive`,children:Ze}):null,(0,K.jsx)(On,{value:e.timeZone??``,onCommit:e=>r({timeZone:e})}),(0,K.jsx)(kn,{value:e.latestStartMinutes,onChange:t=>n(Dn(e,t))}),p?(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Runs once at ${p.time} on ${p.date} (${e.timeZone}). ${p.note?`${p.note} `:``}Squawk must be running then.`}):null]})}function Dn(e,t){let{latestStartMinutes:n,...r}=e;return t===void 0?r:{...r,latestStartMinutes:t}}function On({value:e,onCommit:t}){let[n,r]=(0,H.useState)(e),i=(0,H.useRef)(null),a=(0,H.useId)(),o=(0,H.useId)(),[s]=(0,H.useState)(Tn),c=n!==e||!Xe(n),l=tt(n);return(0,H.useEffect)(()=>{i.current?.setCustomValidity(c?l:``)},[c,l]),(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-once-zone`,children:`Time zone`}),(0,K.jsx)(B,{ref:i,id:`automation-once-zone`,list:a,autoComplete:`off`,spellCheck:!1,className:`w-full border-border sm:w-72`,value:n,"aria-invalid":c||void 0,"aria-describedby":c?o:void 0,onChange:e=>{r(e.target.value),Xe(e.target.value)&&t(e.target.value)}}),(0,K.jsx)(`datalist`,{id:a,children:s.map(e=>(0,K.jsx)(`option`,{value:e},e))}),c?(0,K.jsx)(`p`,{id:o,className:`text-xs break-words text-destructive`,children:l}):null]})}function kn({value:e,onChange:t}){let n=xn.some(t=>t.minutes===e)||e===void 0?xn:[...xn,{minutes:e,label:`${e} minutes`}];return(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-once-latest`,children:`Latest start`}),(0,K.jsxs)(L,{value:e===void 0?Sn:String(e),onValueChange:e=>t(e===Sn?void 0:Number(e)),children:[(0,K.jsx)(P,{id:`automation-once-latest`,className:`w-full sm:w-48`,"aria-label":`Latest start`,children:(0,K.jsx)(N,{})}),(0,K.jsx)(F,{children:n.map(e=>(0,K.jsx)(I,{value:e.minutes===void 0?Sn:String(e.minutes),children:e.label},e.label))})]}),(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`If Squawk was not running at the time, it still starts the task this long afterwards; later, the schedule is marked missed.`})]})}var An=[{type:`daily`,label:`Every day`},{type:`weekdays`,label:`Weekdays`},{type:`weekly`,label:`Weekly`},{type:`hours`,label:`Every N hours`},{type:`once`,label:`Once`}];function jn({value:e,stored:t,onChange:n,timeZone:r}){let i=t=>n({...e,...t}),a=t=>i(t===`once`?{type:t,at:e.at??wn(r),timeZone:e.timeZone??r}:{type:t});return(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsx)(`div`,{role:`group`,"aria-label":`Repeat`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:An.map(t=>(0,K.jsx)(sn,{pressed:e.type===t.type,onClick:()=>a(t.type),children:t.label},t.type))}),e.type===`once`?(0,K.jsx)(En,{value:e,stored:t,onChange:n}):null,e.type===`weekly`?(0,K.jsx)(`div`,{role:`group`,"aria-label":`Day of the week`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:ut.map((t,n)=>(0,K.jsx)(sn,{pressed:e.day===n+1,onClick:()=>i({day:n+1}),children:t},t))}):null,e.type===`once`?null:e.type===`hours`?(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-every`,children:`Run every`}),(0,K.jsxs)(L,{value:String(e.every),onValueChange:e=>i({every:Number(e)}),children:[(0,K.jsx)(P,{id:`automation-every`,className:`w-full sm:w-48`,"aria-label":`Run every`,children:(0,K.jsx)(N,{})}),(0,K.jsx)(F,{children:st.map(e=>(0,K.jsx)(I,{value:String(e),children:e===1?`hour`:`${e} hours`},e))})]}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Counted from midnight, so “every 6 hours” runs at 00:00, 06:00, 12:00 and 18:00.`})]}):(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,K.jsx)(bn,{label:`Hour`,value:e.hour,max:23,onCommit:e=>i({hour:e})}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,K.jsx)(bn,{label:`Minute`,value:e.minute,max:59,onCommit:e=>i({minute:e})}),(0,K.jsx)(`span`,{className:`text-sm break-all text-muted-foreground`,children:r})]}),e.type===`once`?null:(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Cron: `,(0,K.jsx)(`code`,{className:`font-mono text-foreground`,children:it(e)})]})]})}var Mn=40*864e5,Nn=5;function Pn({schedule:e,timeZone:t,now:n=Date.now()}){if(e.type===`once`)return(0,K.jsx)(Fn,{schedule:e,now:n});let r=$e(e,n+1,n+Mn,t,Nn);return(0,K.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,"data-slot":`next-runs`,className:`min-w-0 rounded-xl border bg-card p-5`,children:[(0,K.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-2 text-base font-semibold`,children:`Next 5 runs`}),r.length===0?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No runs in the next 40 days.`}):(0,K.jsx)(`ol`,{"aria-label":`Next 5 runs`,className:`grid divide-y divide-border text-sm`,children:r.map((e,r)=>(0,K.jsxs)(`li`,{className:`flex min-h-10 items-center justify-between gap-3 py-1.5`,children:[(0,K.jsx)(`span`,{className:r===0?`font-semibold tabular-nums text-foreground`:`font-medium tabular-nums`,children:V(new Date(e).toISOString(),t)}),(0,K.jsx)(`span`,{className:r===0?`font-medium text-accent-text`:`text-muted-foreground`,children:rt(n,e)})]},e))}),(0,K.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Times are in `,t,`, the zone this Squawk runs in.`]})]})}function Fn({schedule:e,now:t}){let n=et(e),r=lt(e);return(0,K.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,"data-slot":`next-runs`,className:`min-w-0 rounded-xl border bg-card p-5`,children:[(0,K.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-base font-semibold`,children:`Runs once`}),n===null||!r?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pick a date, a time and a time zone.`}):(0,K.jsxs)(`p`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 text-sm`,children:[(0,K.jsx)(`span`,{className:`font-medium tabular-nums`,children:`${r.date} ${r.time}`}),n>t?(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:rt(t,n)}):null]}),r?.note?(0,K.jsx)(`p`,{className:`mt-2 text-sm break-words`,children:r.note}):null,n!==null&&n<=t?(0,K.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:`The due time has passed.`}):null,(0,K.jsx)(`p`,{className:`mt-3 text-xs break-words text-muted-foreground`,children:`Times are in ${e.timeZone??`UTC`}. Squawk must be running then; afterwards the schedule is archived with its task.`})]})}var In={schedule:`On a schedule`,github:`When GitHub changes`};function Ln(e){return/time zone|due time/i.test(e)?`when`:/placeholder|prompt|workflow|runner|model|task|autonomous/i.test(e)?`run`:/\bname\b/i.test(e)?`name`:/schedule|github|event|filter|label|interval|remote|forge|lookback|records?|hour|minute|poll|kind|archived/i.test(e)?`when`:`form`}function Rn({title:e,hideLegend:t=!1,failure:n,section:r,children:i}){let a=(0,H.useId)();return(0,K.jsxs)(`section`,{role:t?void 0:`group`,"aria-labelledby":t?void 0:a,className:`grid min-w-0 gap-3.5 rounded-xl border border-card-edge bg-card shadow-card p-5`,children:[t?null:(0,K.jsx)(`h2`,{id:a,className:`text-sm font-semibold text-foreground`,children:e}),i,n?.section===r&&!n.conflict?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:n.message}):null]})}function zn({draft:e,patch:t,forge:n,automation:r}){return(0,K.jsx)(K.Fragment,{children:r?(0,K.jsxs)(`p`,{className:`text-sm`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`Trigger · `}),In[e.kind]]}):(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,K.jsx)(Ke,{slot:`automation-kind`,label:`Trigger`,size:`touch`,value:e.kind,onChange:e=>t({kind:e}),options:[{value:`schedule`,label:In.schedule},{value:`github`,label:In.github,disabled:!n.available,...n.available?{}:{title:n.reason??`GitHub is unavailable`}}]}),n.available?null:(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`GitHub unavailable · ${n.reason??`no GitHub access`}`})]})})}function Bn({draft:e,patch:t,forge:n,timeZone:r,automation:i}){return e.kind===`schedule`?(0,K.jsx)(jn,{value:e.schedule,stored:i?.schedule,onChange:e=>t({schedule:e}),timeZone:r}):(0,K.jsx)(vn,{draft:e,onChange:t,...n.available?{}:{disabledReason:n.reason??`no GitHub access`}})}function Vn({draft:e,patch:t,saving:n,automation:r}){let i=e.kind===`schedule`?[`date`,`time`,`project`,`automation`]:[`github.kind`,`github.number`,`github.title`,`github.url`,`github.author`,`github.assignees`,`github.labels`,`github.event`],a=[...new Set([...e.prompt.matchAll(/\{\{([^{}]+)\}\}/g)].map(e=>e[1]))].filter(e=>!i.includes(e));return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,K.jsx)(j,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,K.jsx)(Ye,{id:`automation-prompt`,value:e.prompt,onChange:e=>t({prompt:e.target.value}),rows:3,className:`[field-sizing:fixed] min-h-[88px] resize-none border-border bg-background`,required:!0}),(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:e.kind===`schedule`?(0,K.jsxs)(K.Fragment,{children:[`Available: `,`{{date}}`,` `,`{{time}}`,` `,`{{project}}`,` `,`{{automation}}`,`. A run-context block is appended automatically.`]}):(0,K.jsxs)(K.Fragment,{children:[`Available: `,`{{github.number}}`,` `,`{{github.title}}`,` `,`{{github.url}}`,` `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})})]}),a.length?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:`Unavailable for this trigger: ${a.map(e=>`{{${e}}}`).join(`, `)}`}):null,(0,K.jsx)(Kn,{draft:e,patch:t}),(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,K.jsx)(we,{"aria-label":`Autonomous`,checked:e.autonomous,onCheckedChange:e=>t({autonomous:e})}),(0,K.jsxs)(`span`,{children:[`Autonomous `,(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`· runs without waiting for answers`})]})]}),(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`Each run is an ordinary task in its own worktree, queued behind the parallel cap.`}),(0,K.jsx)(He,{archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,onChange:t,disabled:n}),(0,K.jsx)(ze,{allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging,onChange:t,disabled:n}),r?(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`These settings apply to future tasks. Existing tasks keep their settings.`}):null]})}function Hn({draft:e,patch:t,automation:n}){let r=e.kind===`schedule`;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,K.jsx)(we,{"aria-label":n?`Enabled`:`Enable after saving`,checked:e.enabled,onCheckedChange:e=>t({enabled:e})}),(0,K.jsx)(`span`,{children:n?`Enabled`:`Enable after saving`})]}),(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:r&&e.schedule.type===`once`?`It runs once at the time set above, then moves to Archived with its task.`:r?`The first run is the next occurrence shown beside the schedule.`:gn(e.filters.includeExisting)})]})}function Un({automation:e,forge:t,timeZone:n,onSaved:r,onReload:i}){let[a,o]=(0,H.useState)(()=>Ut(e)),[s,c]=(0,H.useState)(e?.revision),[l,u]=(0,H.useState)(),[p,h]=(0,H.useState)(!1),[g,v]=(0,H.useState)(!1),[y,b]=(0,H.useState)(!1),[x,te]=(0,H.useState)(``),S=e=>o(t=>({...t,...e})),ne=async t=>{if(t.preventDefault(),p)return;let n=t.currentTarget;if(n instanceof HTMLFormElement&&!n.checkValidity()){n.reportValidity();return}h(!0),u(void 0);let i=`save`;try{if(e&&s!==void 0){let{automation:t}=await f(e.id,Jt({...a,enabled:e.enabled},s));c(t.revision),a.enabled!==e.enabled&&(i=`enable`,await m(e.id,a.enabled))}else await ee(qt(a));r()}catch(t){let n=t instanceof Error?t.message:String(t);i===`save`&&e&&t instanceof d&&t.status===409&&/revision conflict/i.test(n)?u({section:`form`,message:`Edited elsewhere — reload to see the latest version`,conflict:!0}):u({section:i===`enable`?`enable`:Ln(n),message:n})}finally{h(!1)}},re=async()=>{if(!(!e||y)){b(!0),te(``);try{await _(e.id),r()}catch(e){te(e instanceof Error?e.message:String(e))}finally{b(!1)}}},ie=(0,H.useId)(),ae=(0,H.useId)(),C=a.kind===`schedule`;return(0,K.jsx)(Oe,{route:`automations`,density:a.name.trim()===``&&a.prompt.trim()===``?`sparse`:`full`,header:Gn({automation:e,draft:a,formId:ie,saveHintId:ae,saving:p}),children:(0,K.jsxs)(`form`,{id:ie,className:`automation-editor grid min-w-0 gap-4 md:grid-cols-[minmax(0,1fr)_320px] md:items-start`,onSubmit:ne,children:[(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-3.5`,children:[(0,K.jsx)(Rn,{title:`Name`,hideLegend:!0,section:`name`,failure:l,children:(0,K.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,K.jsx)(j,{htmlFor:`automation-name`,className:`text-sm font-semibold text-foreground`,children:`Name`}),(0,K.jsx)(B,{id:`automation-name`,className:`border-border`,value:a.name,placeholder:`Daily dependency audit`,onChange:e=>S({name:e.target.value}),required:!0})]})}),(0,K.jsxs)(Rn,{title:`When`,section:`when`,failure:l,children:[(0,K.jsx)(zn,{draft:a,patch:S,forge:t,automation:e}),(0,K.jsx)(Bn,{draft:a,patch:S,forge:t,timeZone:n,automation:e})]}),(0,K.jsx)(Rn,{title:`What to run`,section:`run`,failure:l,children:(0,K.jsx)(Vn,{draft:a,patch:S,saving:p,automation:e})}),(0,K.jsx)(Rn,{title:`Enable`,section:`enable`,failure:l,children:(0,K.jsx)(Hn,{draft:a,patch:S,automation:e})}),l?.section===`form`?(0,K.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 text-sm text-destructive`,children:[(0,K.jsx)(`span`,{className:`break-words`,children:l.message}),l.conflict&&i?(0,K.jsx)(M,{type:`button`,variant:`outline`,onClick:i,children:`Reload`}):null]}):null,e?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2 border-t pt-4`,children:[g?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? It will stop running and cannot be restored.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(M,{type:`button`,variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:y,onClick:()=>void re(),children:`Delete automation`}),(0,K.jsx)(M,{type:`button`,variant:`outline`,disabled:y,onClick:()=>{v(!1),te(``)},children:`Keep`})]})]}):(0,K.jsx)(M,{type:`button`,variant:`outline`,"data-action":`automation-delete`,onClick:()=>v(!0),children:`Delete`}),x?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:x}):null]}):null]}),(0,K.jsxs)(`aside`,{className:`grid min-w-0 max-w-full grid-cols-[minmax(0,1fr)] gap-4 md:sticky md:top-4`,children:[C?(0,K.jsx)(Pn,{schedule:a.schedule,timeZone:n}):(0,K.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-5`,children:[(0,K.jsx)(`h2`,{className:`mb-2 text-base font-semibold`,children:`How it polls`}),(0,K.jsx)(`p`,{className:`text-sm break-words text-muted-foreground`,children:_n(a)})]}),(0,K.jsx)(on,{draft:a})]})]})})}function Wn(e){let t=[!e.name.trim()&&`a name`,!e.prompt.trim()&&`a prompt`].filter(Boolean);return t.length?`Add ${t.join(` and `)} to save.`:``}function Gn({automation:e,draft:t,formId:n,saveHintId:r,saving:i}){let a=t.name.trim()?t.prompt.trim()?``:`Prompt`:`Name`,o=Wn(t),s=e?`Save changes`:t.enabled?`Save and enable`:`Save paused`;return{title:e?`Edit automation`:`New automation`,subtitle:`Define when it runs and the ordinary task it launches.`,status:(0,K.jsx)(`p`,{id:r,"data-slot":`automation-save-hint`,className:`min-h-[1lh] text-xs text-muted-foreground`,children:o}),secondaryActions:(0,K.jsx)(Me,{type:`button`,variant:`outline`,asChild:!0,children:(0,K.jsx)(R,{to:`/automations`,children:`Cancel`})}),primaryAction:(0,K.jsx)(Me,{type:`submit`,form:n,variant:`primary`,disabled:i||a!==``,title:a?`${a} is required`:void 0,"aria-describedby":o?r:void 0,children:i?`Saving…`:s})}}function Kn({draft:e,patch:t}){let n=i(),r=Je(),{runners:u,signedOut:d}=r.runnersOn(e=>r.repoAccount?.[e]),f=a(),p=s(),{runner:m,ready:h}=o(e.runner??f.data?.defaultRunner??`claude`),g=c(m,h,r.repoAccount?.[m]),ee=[...new Set([...(n.data?.workflows??[]).map(e=>e.name),...e.workflow?[e.workflow]:[]])],_=[...new Set([...u,...e.runner?[e.runner]:[]])],v=Re(m,p.data,g.data,[e.model]),y=v.find(t=>t.id===(e.model??``))?.label??e.model??`auto`,b=e=>(0,K.jsx)(e,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`});return(0,K.jsx)(Fe,{children:(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(Ve,{slot:`automation-workflow-pill`,icon:b(ve),fieldLabel:!0,ariaLabel:`Workflow`,label:e.workflow??`inline steps`,value:e.workflow??``,disabled:e.workflow===void 0,disabledHint:`This automation carries its own steps.`,options:ee.map(e=>({value:e,label:e})),onPick:e=>t({workflow:e})}),(0,K.jsx)(Ve,{slot:`automation-runner-pill`,icon:b(he),fieldLabel:!0,ariaLabel:`Runner`,label:e.runner?l(p.data,e.runner):`default`,value:e.runner??``,disabled:!p.data,options:[{value:``,label:`default`,desc:`The project’s default runner`},..._.map(e=>({value:e,label:l(p.data,e)}))],footer:(0,K.jsx)(We,{uninstalled:r.uninstalled,signedOut:d.filter(t=>t!==e.runner)}),onPick:e=>{t({runner:e||void 0,model:void 0})}}),(0,K.jsx)(Ve,{slot:`automation-model-pill`,icon:b(ye),fieldLabel:!0,ariaLabel:`Model`,label:y,value:e.model??``,options:v.map(e=>({value:e.id,label:e.label,desc:e.desc})),onPick:e=>t({model:e||void 0})})]})})}function qn(e){return{text:/\bauth\b|sign.?in|\blogin\b|\btoken\b|credentials|HTTP 401/i.test(e)?`GitHub CLI is not signed in`:/ENOENT|not found.*gh|gh.*not found/i.test(e)?`GitHub CLI is not installed`:`GitHub filter check failed`,tone:`error`,details:e}}function Jn({data:e,error:t,refresh:n,archived:i=!1,onArchivedChange:a}){let[o,s]=(0,H.useState)({}),[c,l]=(0,H.useState)({}),d=(e,t)=>s(n=>{let{[e]:r,...i}=n;return t?{...i,[e]:t}:i}),f=async(e,t,n=!1)=>{l(t=>({...t,[e]:!0}));try{await t()}catch(t){let r=t instanceof Error?t.message:String(t);d(e,n?qn(r):{text:r,tone:`error`})}finally{l(t=>({...t,[e]:!1}))}},p=e=>f(e.id,async()=>{d(e.id,{text:`Starting…`,tone:`info`});let{runId:t}=await u(e.id);d(e.id,{text:`Started task`,tone:`info`,runId:t}),n()}),h=e=>f(e.id,async()=>{d(e.id,void 0),await m(e.id,!e.enabled),await n()}),g=e=>f(e.id,async()=>{d(e.id,void 0),await te(e.id),await n()}),ee=e=>f(e.id,async()=>{d(e.id,{text:`Checking…`,tone:`info`});let{checkId:t}=await S(e.id,`preview`);for(let r=0;r<60;r+=1){let r=await v(t);if(r.status===`complete`){d(e.id,{text:`${r.matches??0} filter match${r.matches===1?``:`es`} found; no tasks launched. Counts can include closed items and previously processed events.`,tone:`info`}),n();return}if(r.status===`error`){let t=r.error??`Preview failed`;d(e.id,qn(t));return}await new Promise(e=>setTimeout(e,500))}throw Error(`Preview is still running`)},!0),_=e?.automations??[],y=_.filter(e=>!e.archived),b=_.filter(e=>!!e.archived),x=i?b:y;return(0,K.jsx)(z,{route:`automations`,density:e?Ae(x.length):`full`,headerSpacing:`compact`,header:{title:`Automations`,subtitle:`Schedules and GitHub checks run while Squawk is open.`,primaryAction:(0,K.jsx)(Me,{variant:`primary`,asChild:!0,children:(0,K.jsxs)(R,{to:`/automations/new`,children:[(0,K.jsx)(pe,{"aria-hidden":`true`,className:`size-4`}),`New automation`]})})},sparseFooter:e&&x.length>0&&!i?(0,K.jsx)(je,{summary:`${x.length} active ${x.length===1?`automation`:`automations`} configured. New automations start paused so you can test filters before enabling them.`,actions:(0,K.jsx)(M,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,K.jsx)(R,{to:`/automations/new`,children:`Add another`})})}):void 0,children:t&&!e?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,K.jsx)(q,{text:t}),(0,K.jsx)(M,{variant:`outline`,onClick:()=>void n(),children:`Retry`})]}):e?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-end justify-between gap-3 border-b border-border`,children:[a?(0,K.jsxs)(`div`,{className:`flex gap-6`,role:`group`,"aria-label":`Filter automations`,children:[(0,K.jsxs)(`button`,{type:`button`,"data-slot":`automations-tab`,"data-view":`active`,"aria-pressed":!i,onClick:()=>a(!1),className:r(`-mb-px flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground`,!i&&`border-accent-text text-foreground`),children:[`Current`,(0,K.jsx)(Yn,{count:y.length})]}),(0,K.jsxs)(`button`,{type:`button`,"data-slot":`automations-tab`,"data-view":`archived`,"aria-pressed":i,onClick:()=>a(!0),className:r(`-mb-px flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground`,i&&`border-accent-text text-foreground`),children:[`Archived`,(0,K.jsx)(Yn,{count:b.length})]})]}):(0,K.jsx)(`span`,{}),(0,K.jsx)(`div`,{className:`pb-2.5`,children:(0,K.jsx)(Xn,{data:e})})]}),i&&x.length===0?(0,K.jsx)(q,{text:`No archived automations.`}):x.length===0?(0,K.jsx)(Ne,{icon:(0,K.jsx)(_e,{}),tone:`neutral`,title:`No automations yet`,subtitle:`Create one paused, preview it, then enable it.`,heading:`h2`,actions:(0,K.jsx)(M,{variant:`primary`,asChild:!0,children:(0,K.jsxs)(R,{to:`/automations/new`,children:[(0,K.jsx)(pe,{"aria-hidden":`true`,className:`size-4`}),`New automation`]})})}):(0,K.jsx)(`ul`,{className:`grid gap-3`,"aria-label":`Automations`,children:x.map(t=>(0,K.jsx)(ar,{automation:t,timeZone:e.timeZone,note:o[t.id],busy:c[t.id]===!0,onRun:()=>void p(t),onToggle:()=>void h(t),onPreview:()=>void ee(t),onCancel:()=>void g(t)},t.id))})]}):(0,K.jsx)(q,{text:`Loading automations…`})})}function Yn({count:e}){return e===0?null:(0,K.jsx)(`span`,{"data-slot":`automations-tab-count`,className:`tabular-nums text-muted-foreground`,children:`· ${e}`})}function Xn({data:e}){return(0,K.jsx)(`p`,{"data-slot":`automation-scheduler`,className:r(`text-xs break-words`,e.scheduler.state===`scheduled`?`text-success`:`text-muted-foreground`),children:`Scheduler ${e.scheduler.state===`scheduled`?`running`:`idle`} · GitHub ${e.available?`available`:`unavailable`}${e.reason?` · ${e.reason}`:``} · ${e.timeZone}`})}function Zn(e){return e.kind===`schedule`&&e.schedule?nt(e.schedule):`${un(e.events??[])} · every ${Math.round((e.intervalSeconds??300)/60)} min`}function Qn({automation:e,nextRun:t}){let n=e.kind===`schedule`?me:fe,r=Be(e);return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 font-semibold break-words`,children:[(0,K.jsx)(n,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),e.name]}),(0,K.jsxs)(`p`,{"data-slot":`automation-meta`,className:`mt-1 flex flex-wrap items-baseline gap-x-1.5 ps-6 text-xs break-words text-muted-foreground`,children:[(0,K.jsx)(`span`,{children:Zn(e)}),t?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),t]}):null]})]}),(0,K.jsx)(Ge,{dot:r.tone,shape:r.shape,pulse:r.pulse,children:r.label})]})}function $n({automation:e,archive:t}){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`text-sm break-words`,children:[t.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`,t.runId?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(R,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${t.runId}`,children:`Open task`})]}):null]}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,K.jsx)(M,{variant:`outline`,asChild:!0,children:(0,K.jsx)(R,{to:`/automations/${e.id}`,children:`Details`})})})]})}function er({automation:e,timeZone:t}){let n=e.kind===`schedule`,r=e.enabled&&n?e.nextRunAt:void 0;return!n&&e.enabled?(0,K.jsx)(`span`,{children:`continuous`}):r?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-foreground`,children:`Next run: ${V(r,t)}`}),(0,K.jsx)(`span`,{children:`· ${rt(Date.now(),Date.parse(r))}`})]}):(0,K.jsx)(`span`,{children:`Next run: —`})}function tr({automation:e,timeZone:t}){let n=e.enabled?bt(e.state):void 0;return n?(0,K.jsxs)(`p`,{role:`alert`,"data-slot":`automation-failing`,className:`text-sm break-words text-destructive`,children:[`The last ${n.consecutiveFailures} checks failed: ${n.lastError}`,n.retryAt?(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:` · Next try ${V(n.retryAt,t)}`}):null]}):null}var $=`h-8 px-3 max-md:h-11 no-hover:h-11`;function nr({automation:e,busy:t,confirmingCancel:n,cancelRef:i,onToggle:a,onRun:o,onPreview:s,onOpenCancel:c}){let l=e.kind===`schedule`,u=e.schedule?.type===`once`;return(0,K.jsxs)(`div`,{"data-slot":`automation-actions`,className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(M,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-toggle`,disabled:t,onClick:a,children:e.enabled?`Pause`:`Enable`}),l?(0,K.jsx)(M,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-run`,disabled:t,onClick:o,children:`Run now`}):(0,K.jsx)(M,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-preview`,disabled:t,onClick:s,children:`Test filter`}),(0,K.jsx)(M,{variant:`outline`,size:`sm`,className:$,asChild:!0,children:(0,K.jsx)(R,{to:`/automations/${e.id}`,children:`Edit`})}),u&&!n?(0,K.jsx)(M,{variant:`outline`,size:`sm`,className:r($,`text-destructive`),ref:i,"data-action":`automation-cancel`,disabled:t,onClick:c,children:`Cancel`}):null,(0,K.jsx)(M,{variant:`outline`,size:`sm`,className:r($,`sm:ms-auto`),asChild:!0,children:(0,K.jsx)(R,{to:`/automations/${e.id}/log`,children:`Execution log`})})]})}function rr({automation:e,busy:t,keepRef:n,onConfirm:r,onKeep:i}){return(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Cancel “${e.name}”? It will never run, and it moves to Archived.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(M,{variant:`danger-ghost`,"data-action":`automation-cancel-confirm`,disabled:t,onClick:r,children:`Cancel schedule`}),(0,K.jsx)(M,{ref:n,variant:`outline`,disabled:t,onClick:i,children:`Keep`})]})]})}function ir({note:e}){return(0,K.jsxs)(`div`,{role:e.tone===`error`?`alert`:`status`,className:r(`text-sm break-words`,e.tone===`error`?`text-destructive`:`text-muted-foreground`),children:[e.text,e.details?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(ue,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:De(`gh`),children:`Set up`}),(0,K.jsxs)(`details`,{children:[(0,K.jsx)(`summary`,{className:`min-h-11 cursor-pointer`,children:`Command details`}),(0,K.jsx)(`pre`,{className:`whitespace-pre-wrap break-words`,children:e.details})]})]}):null,e.runId?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(R,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`})]}):null]})}function ar({automation:e,timeZone:t,note:n,busy:r,onRun:i,onToggle:a,onPreview:o,onCancel:s}){let[c,l]=(0,H.useState)(!1),u=(0,H.useRef)(null),d=(0,H.useRef)(null),f=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=f.current===`keep`?d.current:f.current===`cancel`?u.current:null;f.current=null,e?.focus()},[c]);let p=()=>{f.current=`keep`,l(!0)},m=()=>{f.current=`cancel`,l(!1)},h=e.archived;return(0,K.jsxs)(`li`,{"data-slot":`automation-card`,"data-kind":e.kind,className:`flex min-w-0 flex-col gap-2.5 rounded-xl border border-card-edge bg-card p-4 shadow-card`,children:[(0,K.jsx)(Qn,{automation:e,nextRun:h?void 0:(0,K.jsx)(er,{automation:e,timeZone:t})}),h?(0,K.jsx)($n,{automation:e,archive:h}):null,h?null:(0,K.jsx)(tr,{automation:e,timeZone:t}),h?null:(0,K.jsx)(nr,{automation:e,busy:r,confirmingCancel:c,cancelRef:u,onToggle:a,onRun:i,onPreview:o,onOpenCancel:p}),e.schedule?.type===`once`&&!h&&c?(0,K.jsx)(rr,{automation:e,busy:r,keepRef:d,onConfirm:()=>{l(!1),s()},onKeep:m}):null,n?(0,K.jsx)(ir,{note:n}):null,(0,K.jsx)(Mt,{automationId:e.id,automationName:e.name,timeZone:t})]})}function or(e){let t=Ee(),n=Le(),[r,i]=(0,H.useState)(),[a,o]=(0,H.useState)(``),s=(0,H.useCallback)(t=>ie({signal:t,...e?{archived:e}:{}}).then(e=>{t?.aborted||(i(e),o(``))}).catch(e=>{t?.aborted||o(String(e))}),[e]);return(0,H.useEffect)(()=>{n&&s()},[n,s]),(0,H.useEffect)(()=>p(async e=>{n&&await s(e)}),[n,s]),(0,H.useEffect)(()=>de((e,n)=>{if(e!==`automation-change`)return;let r=n;typeof r.project==`string`&&(t===null||r.project===t)&&s()}),[t,s]),{data:r,error:a,refresh:s}}function sr({mode:e=`list`}){let{automationId:t}=le(),n=Te(),[r,i]=(0,H.useState)(!1),{data:a,error:o,refresh:s}=or(`include`),[c,l]=(0,H.useState)(0),u=Ie();if(u===`unknown`)return(0,K.jsx)(z,{route:`automations`,density:`empty`,children:(0,K.jsx)(q,{text:`Loading automations…`})});if(u===`absent`)return(0,K.jsx)(Pe,{});if(u===`disabled`)return(0,K.jsx)(z,{route:`automations`,density:`empty`,children:(0,K.jsx)(Ne,{icon:(0,K.jsx)(_e,{}),tone:`neutral`,title:`Automations are off`,subtitle:`This server does not run schedules, poll GitHub or launch tasks from them. Unset CEZ_AUTOMATIONS or set it to 1 and restart Squawk to turn automations on.`,heading:`h2`})});let d=()=>{n(`/automations`),s()},f=a?.automations.find(e=>e.id===t);if(e===`list`)return(0,K.jsx)(Jn,{data:a,error:o,refresh:s,archived:r,onArchivedChange:i});if(!a)return o?(0,K.jsx)(z,{route:`automations`,density:`empty`,header:{title:`Automations`,subtitle:`Could not load automations.`},children:(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,K.jsx)(q,{text:o}),(0,K.jsx)(M,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]})}):(0,K.jsx)(z,{route:`automations`,density:`empty`,children:(0,K.jsx)(q,{text:`Loading automations…`})});let p={available:a.available,...a.reason?{reason:a.reason}:{}};return e===`new`?(0,K.jsx)(Un,{forge:p,timeZone:a.timeZone,onSaved:d}):e===`edit`?f?f.archived?(0,K.jsx)(Nt,{automation:f,timeZone:a.timeZone,onDeleted:d}):(0,K.jsx)(Un,{automation:f,forge:p,timeZone:a.timeZone,onSaved:d,onReload:()=>void s().then(()=>l(e=>e+1))},`${f.id}:${c}`):(0,K.jsx)(z,{route:`automations`,density:`empty`,header:{title:`Automation not found`,subtitle:`This automation may have been removed.`},children:(0,K.jsx)(M,{asChild:!0,variant:`outline`,children:(0,K.jsx)(R,{to:`/automations`,children:`Back to automations`})})}):t?(0,K.jsx)(jt,{automationId:t,automationName:f?.name,timeZone:a.timeZone,readOnly:!!f?.archived}):(0,K.jsx)(q,{text:`Automation not found.`})}export{sr as AutomationsRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{A as i,_ as a,nn as o,rn as s,sn as c,tn as l}from"./queries-ByqTmyCs.js";import{B as u,Fn as d,H as f,Ur as p,V as m,_ as h,ar as g,c as ee,d as _,g as v,ir as y,ni as b,nr as x,o as te,s as S,sr as ne,ti as re,v as ie,z as ae}from"./toaster-Lf_4oY96.js";import{B as C,G as oe,H as w,I as T,K as se,N as E,P as D,V as ce,W as O,j as k,z as A}from"./live-protocol-DMhTnCmf.js";import{h as le,n as ue}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as de,t as j}from"./label-eNfbfYFG.js";import{I as fe,J as pe,Y as me,it as he,l as ge,pt as _e,ut as ve,y as ye}from"./design-icons-CzEoMH9c.js";import{t as be}from"./check-OP-CVgZG.js";import{t as M}from"./button-C8jUIs8Q.js";import{n as xe,r as Se,t as Ce}from"./collapsible-CW6CfTJO.js";import{a as N,i as P,n as F,r as I,t as L}from"./select-CvnOk0OI.js";import{t as we}from"./switch-DfPCm1H_.js";import{c as Te,s as Ee,t as R}from"./project-router-CEnizJ8F.js";import{r as De}from"./agents-settings-path-7X6_cvUg.js";import{a as Oe,c as ke,d as Ae,n as je,s as Me,u as z}from"./page-shell-CpdYMj52.js";import{t as Ne}from"./centered-state-BgSV4e79.js";import{Cn as Pe,D as Fe,G as Ie,J as Le,K as Re,Ln as ze,O as Be,P as Ve,Qn as B,Rn as He,dr as Ue,hn as We,k as Ge,r as Ke,t as qe,yn as Je}from"./index-B0_haEFL.js";import{t as Ye}from"./textarea-vEsJAUAV.js";import{_ as Xe,a as Ze,c as Qe,d as $e,f as et,g as tt,h as nt,i as rt,l as it,m as at,n as ot,o as st,p as ct,r as lt,s as ut,t as V,u as dt,v as ft}from"./automation-format-DB34jUyF.js";var H=e(t(),1),U=k([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),pt=C({includeExisting:D().optional(),authors:E(O()).optional(),assignees:E(O()).optional(),requireCurrentLabels:D().optional(),allLabels:E(O()).optional(),anyLabels:E(O()).optional(),excludeLabels:E(O()).optional(),changedLabels:E(O()).optional(),lookbackDays:A(),maxRecords:A()}),mt=k([`github`,`schedule`]),ht=x.omit({task:!0,images:!0,systemPrompt:!0}).extend({prompt:O(),variants:oe([T(1),T(2),T(3)]).optional(),systemPrompt:O().optional()}),gt=C({at:O(),outcome:k([`launched`,`cancelled`]),runId:O().optional(),receiptId:O().optional(),trigger:k([`schedule`,`late`,`manual`,`retry`]).optional()}),W=C({id:O(),revision:A(),name:O(),description:O().optional(),enabled:D(),kind:mt,events:E(U).optional(),intervalSeconds:A().optional(),filters:pt.optional(),schedule:Qe.optional(),task:ht,archived:gt.optional(),createdAt:O(),updatedAt:O()}),G=C({timestamp:O(),tieBreaker:O().optional()}),_t=C({since:O().datetime(),until:O().datetime(),source:A().int().min(0).max(2),page:A().int().min(1).max(10),item:A().int().min(0).max(100),event:A().int().min(0).max(1e3),cursor:G.optional()}),vt={lastError:O().max(1e3).optional(),lastErrorAt:O().datetime().optional()},yt=C({revision:A().optional(),baselineAt:O().optional(),armedAt:O().optional(),historyScan:_t.optional(),cursor:G.optional(),frozenHighWatermark:G.extend({tieBreaker:O()}).optional(),backlogAfter:G.extend({tieBreaker:O()}).optional(),nextCheckAt:O().optional(),lastSuccessAt:O().optional(),nextRunAt:O().optional(),lastRunAt:O().optional(),etags:w(O(),O()).optional(),backoffUntil:O().optional(),consecutiveFailures:A().optional(),...vt,onceOutcome:k([`failed`,`missed`]).optional()});function bt(e){let t=e?.consecutiveFailures??0;if(!(t<3||!e?.lastError))return{consecutiveFailures:t,lastError:e.lastError,...e.lastErrorAt?{lastErrorAt:e.lastErrorAt}:{},...e.backoffUntil?{retryAt:e.backoffUntil}:{}}}var xt=k([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]),St=C({seq:A(),ts:O(),automationId:O(),revision:A(),event:U.optional(),result:xt,reason:O().optional(),durationMs:A().optional(),receiptId:O().optional(),runId:O().optional(),githubNumber:A().optional(),githubTitle:O().optional(),githubUrl:O().optional(),rateLimit:C({bucket:k([`core`,`search`]),remaining:A().optional(),resetAt:O().optional()}).optional()}),Ct=C({matches:A(),launched:A(),duplicates:A(),errors:A()}),wt=W.extend({state:yt.optional(),latestLog:St.optional(),counts:Ct,nextRunAt:O().optional(),onceStatus:ct.optional()});C({available:D(),reason:O().optional(),timeZone:O(),scheduler:C({state:k([`scheduled`,`idle`]),nextDue:O().optional()}),automations:E(wt)}),C({automation:W}).extend({once:C({dueAt:O(),timeZone:O(),resolvedInstant:O(),note:O()}).optional()}),C({automation:W,state:yt.optional(),latestLog:St.optional(),onceStatus:ct.optional()}),C({id:O(),automationId:O(),mode:k([`preview`,`execute`]),status:k([`queued`,`running`,`complete`,`error`]),createdAt:O(),completedAt:O().optional(),matches:A().optional(),truncated:D().optional(),error:O().optional()}),C({checkId:O()}),C({records:E(St)}),C({receiptId:O(),runId:O()}),C({runId:O()}),W.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0,kind:!0,archived:!0}).extend({kind:mt.optional(),task:ht.omit({variants:!0}).strict(),enable:D().optional()}).omit({enable:!0}).extend({enabled:D().optional(),expectedRevision:A()}),C({archived:k([`include`,`only`]).optional()}),C({mode:k([`preview`,`execute`])});var K=n();function q({text:e}){return(0,K.jsx)(`div`,{role:`status`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:e})}var Tt={launched:`success`,manual:`success`,"catch-up":`success`,skipped:`neutral`,missed:`pending`,"no-match":`neutral`,preview:`neutral`,baseline:`neutral`,duplicate:`neutral`,failed:`danger`,error:`danger`,"rate-limited":`danger`},Et={launched:`Launched`,manual:`Manual`,"catch-up":`Catch up`,skipped:`Skipped`,missed:`Missed`,"no-match":`No match`,preview:`Preview`,baseline:`Baseline`,duplicate:`Duplicate`,failed:`Failed`,error:`Error`,"rate-limited":`Rate limited`};function Dt(e){let[t,n]=(0,H.useState)(),[r,i]=(0,H.useState)(``),a=(0,H.useCallback)(t=>h(e,{signal:t}).then(({records:e})=>{t?.aborted||(n(e),i(``))}).catch(e=>{t?.aborted||i(String(e))}),[e]);return(0,H.useEffect)(()=>{a()},[a]),(0,H.useEffect)(()=>p(a),[a]),(0,H.useEffect)(()=>de((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function Ot(e,t){return e.result!==`failed`&&e.result!==`error`||!e.receiptId||e.runId?!1:!t.some(t=>t.receiptId===e.receiptId&&(t.runId||t.seq>e.seq))}function kt({records:e,all:t,timeZone:n,onRetried:r,readOnly:i=!1}){let a=e=>!i&&Ot(e,t),[o,s]=(0,H.useState)(),[c,l]=(0,H.useState)(),u=Date.now(),d=async e=>{s(e),l(void 0);try{await ae(e),r()}catch(t){l({receiptId:e,message:t instanceof Error?t.message:String(t)})}finally{s(void 0)}};return(0,K.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:e.map(e=>(0,K.jsxs)(`li`,{className:`min-w-0 rounded-xl border border-card-edge bg-card p-4 shadow-card`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(Ke,{dot:Tt[e.result],children:Et[e.result]}),(0,K.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:ot(e.ts,n,u)})]}),e.reason?(0,K.jsx)(`p`,{className:`mt-2 text-sm break-words text-muted-foreground`,children:e.reason}):null,e.githubUrl||e.runId||a(e)?(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[e.githubUrl?(0,K.jsx)(`a`,{className:`inline-flex min-h-11 items-center underline underline-offset-4 break-all`,href:e.githubUrl,target:`_blank`,rel:`noreferrer`,children:e.githubTitle??`GitHub #${e.githubNumber??``}`}):null,e.runId?(0,K.jsx)(R,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`}):null,a(e)?(0,K.jsx)(M,{variant:`outline`,disabled:o===e.receiptId,onClick:()=>void d(e.receiptId),children:`Retry task`}):null]}):null,c&&c.receiptId===e.receiptId?(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm break-words text-destructive`,children:c.message}):null]},e.seq))})}var J=`all`;function At({label:e,value:t,onChange:n,options:r}){return(0,K.jsxs)(L,{value:t,onValueChange:n,children:[(0,K.jsx)(P,{"aria-label":e,className:`w-full sm:w-52`,children:(0,K.jsx)(N,{})}),(0,K.jsx)(F,{children:r.map(e=>(0,K.jsx)(I,{value:e.value,children:e.label},e.value))})]})}function jt({automationId:e,automationName:t,timeZone:n,readOnly:r=!1}){let{records:i,error:a,refresh:o}=Dt(e),[s,c]=(0,H.useState)(J),[l,u]=(0,H.useState)(J),d=(0,H.useMemo)(()=>(i??[]).filter(e=>(s===J||e.result===s)&&(l===J||e.event===l)),[i,s,l]),f=(i??[]).some(e=>e.event);return(0,K.jsx)(ke,{route:`automations`,density:i?Ae(d.length):`full`,header:{title:`Execution log`,subtitle:t??`Automation activity`,secondaryActions:(0,K.jsx)(Me,{variant:`outline`,asChild:!0,children:(0,K.jsx)(R,{to:`/automations`,children:`Back to automations`})})},children:a&&!i?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,K.jsx)(q,{text:a}),(0,K.jsx)(M,{variant:`outline`,onClick:()=>void o(),children:`Retry`})]}):i?i.length===0?(0,K.jsx)(q,{text:`Nothing has run yet.`}):(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(At,{label:`Result`,value:s,onChange:c,options:[{value:J,label:`All results`},...xt.options.map(e=>({value:e,label:Et[e]}))]}),f?(0,K.jsx)(At,{label:`Event`,value:l,onChange:u,options:[{value:J,label:`All events`},...U.options.map(e=>({value:e,label:e}))]}):null]}),d.length===0?(0,K.jsx)(q,{text:`No rows match these filters.`}):(0,K.jsx)(kt,{records:d,all:i,timeZone:n,onRetried:()=>void o(),readOnly:r})]}):(0,K.jsx)(q,{text:`Loading execution log…`})})}function Mt({automationId:e,automationName:t,timeZone:n,showName:r=!1,readOnly:i=!1}){let{records:a,error:o,refresh:s}=Dt(e),c=`Recent activity${r&&t?` · ${t}`:``}`;return!o&&a&&a.length===0?(0,K.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`flex flex-wrap items-center gap-x-2 border-t border-border pt-2.5 text-xs text-muted-foreground`,children:[(0,K.jsx)(`h3`,{className:`font-medium text-foreground`,children:c}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,K.jsx)(`p`,{children:`Nothing has run yet.`})]}):(0,K.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`min-w-0 border-t border-border pt-2.5`,children:[(0,K.jsx)(`h3`,{className:`mb-1.5 text-xs font-medium text-muted-foreground`,children:c}),o&&!a?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,K.jsx)(q,{text:o}),(0,K.jsx)(M,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]}):a?(0,K.jsx)(kt,{records:a.slice(0,5),all:a,timeZone:n,onRetried:()=>void s(),readOnly:i}):(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading activity…`})]})}function Nt({automation:e,timeZone:t,onDeleted:n}){let r=e.archived,i=e.schedule,a=i?lt(i):null,[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(``),f=(0,H.useRef)(null),p=(0,H.useRef)(null),m=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=m.current===`keep`?p.current:m.current===`delete`?f.current:null;m.current=null,e?.focus()},[o]);let h=async()=>{l(!0);try{await _(e.id),n()}catch(e){d(e instanceof Error?e.message:String(e)),l(!1)}},g=[[`Workflow`,e.task.workflow],[`Runner`,e.task.runner],[`Model`,e.task.model],[`Effort`,e.task.effort]];return(0,K.jsx)(ke,{route:`automations`,density:`sparse`,header:{title:e.name,subtitle:`Archived one-time schedule. It cannot change; delete it when you no longer need the record.`},children:(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[(0,K.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,K.jsxs)(`p`,{className:`text-sm break-words`,children:[(0,K.jsx)(`span`,{children:r.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`}),r.runId?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(R,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${r.runId}`,children:`Open task`})]}):null]}),(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Archived ${V(r.at,t)} (${t}).`}),a&&i?.timeZone?(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Was due ${a.date} ${a.time} (${i.timeZone}).`}):null]}),(0,K.jsxs)(`section`,{"aria-labelledby":`archived-inputs`,className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,K.jsx)(`h2`,{id:`archived-inputs`,className:`mb-3 text-[15px] font-medium`,children:`What it ran with`}),(0,K.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[(0,K.jsxs)(`div`,{className:`grid gap-1`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:`Prompt`}),(0,K.jsx)(`dd`,{className:`break-words whitespace-pre-wrap`,children:e.task.prompt})]}),g.filter(([,e])=>e).map(([e,t])=>(0,K.jsxs)(`div`,{className:`grid gap-1`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,K.jsx)(`dd`,{className:`break-words`,children:t})]},e))]})]}),(0,K.jsxs)(`section`,{className:`min-w-0`,children:[(0,K.jsx)(Mt,{automationId:e.id,automationName:e.name,timeZone:t,readOnly:!0}),(0,K.jsx)(M,{variant:`outline`,asChild:!0,className:`mt-3`,children:(0,K.jsx)(R,{to:`/automations/${e.id}/log`,children:`Execution log`})})]}),(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[o?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? Its record and log are removed; the task stays.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(M,{variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:c,onClick:()=>void h(),children:`Delete schedule`}),(0,K.jsx)(M,{ref:p,variant:`outline`,disabled:c,onClick:()=>{m.current=`delete`,s(!1)},children:`Keep`})]})]}):(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(M,{ref:f,variant:`outline`,"data-action":`automation-delete`,onClick:()=>{m.current=`keep`,s(!0)},children:`Delete`}),(0,K.jsx)(M,{variant:`outline`,asChild:!0,children:(0,K.jsx)(R,{to:`/automations`,children:`Back to automations`})})]}),u?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:u}):null]})]})})}var Pt=k([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),Y=E(O().trim().min(1).max(200)).max(100).optional(),Ft=C({includeExisting:D().optional(),requireCurrentLabels:D().optional(),authors:Y,assignees:Y,allLabels:Y,anyLabels:Y,excludeLabels:Y,changedLabels:Y,lookbackDays:A().int().min(1).max(90).default(7),maxRecords:A().int().min(1).max(100).default(25)}).passthrough(),It=C({prompt:O().min(1).max(1e5),workflow:O().trim().min(1).max(200).optional(),steps:E(y).min(1).max(100).optional(),runner:re.optional(),model:O().trim().min(1).max(200).optional(),effort:O().trim().min(1).max(32).optional(),variants:oe([T(1),T(2),T(3)]).optional(),worktree:D().optional(),autonomous:D().optional(),...g,...ne,systemPrompt:O().max(1e5).optional()}).passthrough().refine(e=>!(e.workflow&&e.steps),{message:`task selects either a named workflow or inline steps, not both`}),Lt=new Set(Object.keys(It.shape).filter(e=>e!==`variants`));function Rt(e){return Object.fromEntries(Object.entries(e).filter(([e])=>Lt.has(e)))}ce(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e;return t.kind===`schedule`?e:{...t,intervalSeconds:t.intervalSeconds??300,filters:t.filters??{}}},C({id:O().min(1).max(100),revision:A().int().positive(),name:O().trim().min(1).max(200),description:O().max(2e3).optional(),enabled:D().default(!1),kind:mt.default(`github`),events:E(Pt).min(1).max(4).optional(),intervalSeconds:A().int().min(60).max(86400).optional(),filters:Ft.optional(),schedule:Qe.passthrough().optional(),task:It,archived:C({at:O().datetime(),outcome:k([`launched`,`cancelled`]),runId:O().optional(),receiptId:O().optional(),trigger:k([`schedule`,`late`,`manual`,`retry`]).optional()}).passthrough().optional(),createdAt:O().datetime(),updatedAt:O().datetime()}).passthrough().superRefine((e,t)=>{if(e.kind===`schedule`){e.schedule||t.addIssue({code:b.custom,path:[`schedule`],message:`a scheduled automation needs a schedule`});return}e.events?.length||t.addIssue({code:b.custom,path:[`events`],message:`a GitHub automation needs at least one event`}),e.intervalSeconds===void 0&&t.addIssue({code:b.custom,path:[`intervalSeconds`],message:`a GitHub automation needs a poll interval`}),e.filters||t.addIssue({code:b.custom,path:[`filters`],message:`a GitHub automation needs its bounded filter`}),e.events?.some(e=>e===`issue.labeled`||e===`issue.unlabeled`)&&!e.filters?.changedLabels?.length&&t.addIssue({code:b.custom,path:[`filters`,`changedLabels`],message:`changedLabels is required for issue label events`})})),C({version:T(1).default(1),automations:E(se()).default([]),tombstones:w(O(),O().datetime()).optional()}).passthrough();var X=C({timestamp:O().datetime(),tieBreaker:O().optional()}).passthrough(),zt=_t.extend({cursor:X.optional()}),Bt=C({revision:A().int().positive().optional(),baselineAt:O().datetime().optional(),armedAt:O().datetime().optional(),historyScan:zt.optional(),cursor:X.optional(),frozenHighWatermark:X.extend({tieBreaker:O()}).optional(),backlogAfter:X.extend({tieBreaker:O()}).optional(),nextCheckAt:O().datetime().optional(),lastSuccessAt:O().datetime().optional(),nextRunAt:O().datetime().optional(),lastRunAt:O().datetime().optional(),etags:w(O(),O()).optional(),backoffUntil:O().datetime().optional(),consecutiveFailures:A().int().nonnegative().optional(),...vt,onceOutcome:k([`failed`,`missed`]).optional()}).passthrough();C({version:T(1).default(1),states:w(O(),Bt).default({})}).passthrough(),C({receiptId:O().min(1),receiptKey:O().min(1),eventId:O().min(1),automationId:O().min(1),revision:A().int().positive(),status:k([`reserved`,`launched`,`launch-error`,`released`]),runId:O().optional(),observedAt:O().datetime(),updatedAt:O().datetime(),error:O().max(2e3).optional(),occurrenceAt:O().datetime().optional(),candidate:C({eventId:O(),event:Pt,timestamp:O().datetime(),tieBreaker:O(),repo:O(),nodeId:O(),number:A().int().positive(),title:O().max(500),url:O().url(),author:O().max(200),assignees:E(O().max(200)).max(100),labels:E(O().max(200)).max(100),changedLabel:O().max(200).optional()}).passthrough().optional()}).passthrough();var Vt=k([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]);C({seq:A().int().positive(),ts:O().datetime(),automationId:O().min(1),revision:A().int().positive(),event:Pt.optional(),result:Vt,reason:O().max(2e3).optional(),durationMs:A().int().nonnegative().optional(),receiptId:O().optional(),runId:O().optional(),githubNumber:A().int().positive().optional(),githubTitle:O().max(500).optional(),githubUrl:O().url().optional(),rateLimit:C({bucket:k([`core`,`search`]),remaining:A().int().nonnegative().optional(),resetAt:O().datetime().optional()}).passthrough().optional()}).passthrough();var Ht=`quick-task`;function Ut(e={}){let{prompt:t,workflow:n,runner:r,model:i,autonomous:a,archiveWhenDone:o,autoMergePr:s,allowWorkers:c,allowMessaging:l,...u}=Rt(e.task??{prompt:``}),d=e.task===void 0;return{name:e.name??``,description:e.description??``,kind:e.kind??`schedule`,schedule:dt(e.schedule??{type:`daily`}),events:e.events??[U.options[0]],intervalSeconds:e.intervalSeconds??300,filters:e.filters??{lookbackDays:7,maxRecords:25},prompt:t,...n===void 0?d?{workflow:Ht}:{}:{workflow:n},...r===void 0?{}:{runner:r},...i===void 0?{}:{model:i},autonomous:a??!0,archiveWhenDone:o??!1,autoMergePr:s??!1,allowWorkers:c!==!1,allowMessaging:l!==!1,enabled:e.enabled??e.enable??!1,taskExtra:u}}function Wt(e){switch(e.type){case`daily`:case`weekdays`:return{type:e.type,hour:e.hour,minute:e.minute};case`weekly`:return{type:`weekly`,hour:e.hour,minute:e.minute,day:e.day};case`hours`:return{type:`hours`,every:e.every};case`once`:return{type:`once`,at:e.at??``,timeZone:e.timeZone??``,...e.latestStartMinutes===void 0?{}:{latestStartMinutes:e.latestStartMinutes}}}}function Gt(e){return{...e.taskExtra,prompt:e.prompt,...e.workflow?{workflow:e.workflow}:{},...e.runner?{runner:e.runner}:{},...e.model?{model:e.model}:{},autonomous:e.autonomous,...e.archiveWhenDone?{archiveWhenDone:!0}:{},...e.autoMergePr?{autoMergePr:!0}:{},...e.allowWorkers?{}:{allowWorkers:!1},...e.allowMessaging?{}:{allowMessaging:!1}}}function Kt(e){return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},kind:e.kind,...e.kind===`schedule`?{schedule:Wt(e.schedule)}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:Gt(e)}}function qt(e){return{...Kt(e),enable:e.enabled}}function Jt(e,t){return{...Kt(e),task:{...Gt(e),archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging},enabled:e.enabled,expectedRevision:t}}function Z(e){return`'${e.replace(/'/g,`'\\''`)}'`}var Yt=new Set([`prompt`,`workflow`,`runner`,`model`,`autonomous`,`worktree`,`archiveWhenDone`,`autoMergePr`,`allowWorkers`,`allowMessaging`]),Xt=new Set([`anyLabels`,`authors`,`changedLabels`]);function Zt(e){if(e.description!==void 0||!e.name.trim()||!e.task.prompt.trim())return!1;let t=e.task;if(Object.keys(t).some(e=>!Yt.has(e))||t.archiveWhenDone===!1||t.autoMergePr===!1||t.allowWorkers===!0||t.allowMessaging===!0||t.worktree!==!0)return!1;if(e.kind===`schedule`)return e.schedule!==void 0;let{events:n,filters:r}=e;return!n?.length||n.some(e=>e.includes(`,`))||!r||r.lookbackDays!==7||r.maxRecords!==25?!1:Object.entries(r).every(([e,t])=>e===`lookbackDays`||e===`maxRecords`||e===`includeExisting`&&t===!0||Xt.has(e)&&Array.isArray(t)&&t.length>0)}function Qt(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function $t(e){return e%1440==0?`${e/1440}d`:e%60==0?`${e/60}h`:`${e}m`}function Q(e,t){return t.startsWith(`-`)?`--${e}=${Z(t)}`:`--${e} ${Z(t)}`}function en(e){let t=[`${We()} automation add`,Q(`name`,e.name)];if(e.schedule?.type===`once`)t.push(Q(`at`,e.schedule.at),Q(`tz`,e.schedule.timeZone)),e.schedule.latestStartMinutes!==void 0&&t.push(Q(`latest-start`,$t(e.schedule.latestStartMinutes)));else if(e.kind===`schedule`)t.push(Q(`cron`,it(e.schedule)));else{t.push(Q(`on`,e.events.join(`,`)),`--every ${Qt(e.intervalSeconds??300)}`),e.filters?.includeExisting&&t.push(`--include-existing`);for(let n of e.filters?.anyLabels??[])t.push(Q(`label`,n));for(let n of e.filters?.authors??[])t.push(Q(`author`,n));for(let n of e.filters?.changedLabels??[])t.push(Q(`changed-label`,n))}return t.push(...tn(e.task)),e.enable===!0&&t.push(`--enable`),t.push(Q(`prompt`,e.task.prompt)),t.join(` `)}function tn(e){let t=[];return e.workflow&&t.push(Q(`workflow`,e.workflow)),e.runner&&t.push(Q(`runner`,e.runner)),e.model&&t.push(Q(`model`,e.model)),e.autonomous===!1&&t.push(`--no-autonomous`),e.archiveWhenDone&&t.push(`--archive-when-done`),e.autoMergePr&&t.push(`--auto-merge-pr`),e.allowWorkers===!1&&t.push(`--no-workers`),e.allowMessaging===!1&&t.push(`--no-messaging`),t}function nn(e,t){let n=qt(e),r=Zt(n)?en(n):`${We()} automation create --json ${Z(JSON.stringify(n))}`;return t?`CEZ_COCKPIT_URL=${Z(t.origin)} CEZ_PROJECT_ID=${Z(t.projectId)} HSQ_COCKPIT_URL=${Z(t.origin)} HSQ_PROJECT_ID=${Z(t.projectId)} ${r}`:r}function rn(e){let t=[],n=!1;for(let r of an(e)){let e=t.length-1;!n&&/^[A-Z_][A-Z0-9_]*=/.test(r)?t.push(r):r.startsWith(`--`)||!n?(t.push(r),n=!0):t[e]=`${t[e]} ${r}`}return t.map((e,t)=>t===0?e:` ${e}`).join(` \\
2
+ `)}function an(e){let t=[],n=``,r=!1;for(let i=0;i<e.length;i+=1){let a=e[i];!r&&a===`\\`&&i+1<e.length?(n+=a+e[i+1],i+=1):a===`'`?(r=!r,n+=a):a===` `&&!r?(n&&t.push(n),n=``):n+=a}return n&&t.push(n),t}function on({draft:e}){let t=Ee(),n=window.location.origin,i=(0,H.useMemo)(()=>{let r=nn(e);return t?`HSQ_COCKPIT_URL=${Z(n)} HSQ_PROJECT_ID=${Z(t)} ${r}`:r},[e,n,t]),a=(0,H.useMemo)(()=>rn(i),[i]),[o,s]=(0,H.useState)(`idle`),[c,l]=(0,H.useState)(!1),u=(0,H.useId)(),d=(0,H.useRef)(void 0);(0,H.useEffect)(()=>()=>clearTimeout(d.current),[]),(0,H.useEffect)(()=>s(`idle`),[i]);let f=async()=>{clearTimeout(d.current);try{await navigator.clipboard.writeText(a),s(`copied`),d.current=setTimeout(()=>s(`idle`),1600)}catch{s(`failed`)}};return(0,K.jsxs)(`section`,{"aria-labelledby":`copy-as-cli-heading`,"data-slot":`copy-as-cli`,className:`min-w-0 max-w-full overflow-hidden rounded-xl border border-card-edge bg-card shadow-card px-4 py-3.5`,children:[(0,K.jsxs)(`div`,{className:`flex min-h-8 min-w-0 flex-nowrap items-center justify-between gap-x-2`,children:[(0,K.jsx)(`h2`,{id:`copy-as-cli-heading`,className:`shrink-0 text-[13px] font-medium text-muted-foreground`,children:`Copy as CLI`}),(0,K.jsxs)(M,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`copy-as-cli-toggle`,"aria-expanded":c,"aria-controls":u,"aria-label":c?`Hide command`:`Show command`,className:`min-w-0 shrink gap-1 px-1.5 text-[12px] font-medium max-md:h-11 no-hover:h-11`,onClick:()=>l(e=>!e),children:[(0,K.jsx)(`span`,{className:`truncate`,children:c?`Hide`:`Show`}),(0,K.jsx)(ge,{"aria-hidden":`true`,className:r(`size-3.5 transition-transform`,c&&`rotate-180`)})]}),(0,K.jsxs)(M,{type:`button`,variant:`outline`,size:`sm`,className:`ms-auto gap-1.5 px-2 text-[12px] font-medium max-md:h-11 no-hover:h-11`,onClick:()=>void f(),children:[o===`copied`?(0,K.jsx)(be,{"aria-hidden":`true`,className:`size-3.5`}):(0,K.jsx)(Ue,{"aria-hidden":`true`,className:`size-3.5`}),o===`copied`?`Copied`:`Copy`]})]}),(0,K.jsx)(`div`,{id:u,hidden:!c,className:`mbs-2 max-w-full rounded-lg border border-border bg-muted has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-ring`,children:(0,K.jsx)(`pre`,{"data-slot":`copy-as-cli-line`,tabIndex:0,"aria-label":`Command line`,className:`m-0 max-w-full px-3 pt-2.5 pb-3 font-mono text-xs leading-5 break-all whitespace-pre-wrap text-muted-foreground outline-none`,children:a})}),(0,K.jsx)(`p`,{role:`status`,className:`mbs-2 text-xs break-words text-muted-foreground`,children:o===`failed`?`Could not copy — select the line and copy it by hand.`:(0,K.jsxs)(K.Fragment,{children:[`The definition Save paused would create. `,(0,K.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-px font-mono text-xs whitespace-nowrap text-foreground [word-spacing:-0.2em]`,children:`${We()} automation schema`}),` prints its shape.`]})})]})}function sn({pressed:e,onClick:t,disabled:n,children:i}){return(0,K.jsx)(`button`,{type:`button`,"aria-pressed":e,disabled:n,onClick:t,className:r(`inline-flex min-h-11 items-center justify-center rounded-md border px-3.5 text-[13px] font-medium transition-colors outline-hidden focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50`,e?`border-border bg-card font-semibold text-foreground shadow-xs`:`border-transparent bg-transparent text-muted-foreground hover:text-foreground`),children:i})}var cn={"pull_request.opened":`a pull request opens`,"issue.opened":`an issue opens`,"issue.labeled":`an issue is labeled`,"issue.unlabeled":`an issue is unlabeled`},ln={"pull_request.opened":`Pull request opened`,"issue.opened":`Issue opened`,"issue.labeled":`Issue labeled`,"issue.unlabeled":`Issue unlabeled`};function un(e){let t=e.map(e=>cn[e]);if(t.length===0)return`When GitHub changes`;let n=t.slice(0,-1),r=t[t.length-1];return`When ${n.length>0?`${n.join(`, `)} or ${r}`:r}`}var dn=U.options,fn=[{seconds:60,label:`1 minute`},{seconds:300,label:`5 minutes`},{seconds:900,label:`15 minutes`},{seconds:1800,label:`30 minutes`},{seconds:3600,label:`1 hour`}],pn=[{key:`authors`,label:`Authors`},{key:`assignees`,label:`Assignees`},{key:`allLabels`,label:`Has all labels`},{key:`anyLabels`,label:`Has any label`},{key:`excludeLabels`,label:`Excludes labels`},{key:`changedLabels`,label:`Changed labels`,hint:`Required for the two label events.`}],mn=e=>(e??[]).join(`, `),hn=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function gn(e){return e?`Existing matches within the lookback are eligible on the next check. Previously processed matches will not run again.`:`Enabling starts from a current-time baseline. Existing matches will not launch tasks.`}function _n(e){let t=Math.max(1,Math.round(e.intervalSeconds/60));return`Polls GitHub every ${t} minute${t===1?``:`s`} for ${e.events.join(`, `)||`no events`}. ${gn(e.filters.includeExisting)}`}function vn({draft:e,onChange:t,disabledReason:n}){let r=n=>{t({events:e.events.includes(n)?e.events.filter(e=>e!==n):[...e.events,n]})},i=n=>t({filters:{...e.filters,...n}}),a=(n,r)=>{let i=hn(r),{[n]:a,...o}=e.filters;t({filters:i.length?{...o,[n]:i}:o})},o=fn.some(t=>t.seconds===e.intervalSeconds)?fn:[...fn,{seconds:e.intervalSeconds,label:`${Math.round(e.intervalSeconds/60)} minutes`}].sort((e,t)=>e.seconds-t.seconds);return(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[n?(0,K.jsx)(`p`,{className:`text-xs text-pending-strong`,children:`GitHub unavailable · ${n}`}):null,(0,K.jsx)(`div`,{role:`group`,"aria-label":`GitHub events`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:dn.map(t=>(0,K.jsx)(sn,{pressed:e.events.includes(t),onClick:()=>r(t),children:ln[t]},t))}),(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-interval`,children:`Check every`}),(0,K.jsxs)(L,{value:String(e.intervalSeconds),onValueChange:e=>t({intervalSeconds:Number(e)}),children:[(0,K.jsx)(P,{id:`automation-interval`,className:`w-full sm:w-48`,"aria-label":`Check every`,children:(0,K.jsx)(N,{})}),(0,K.jsx)(F,{children:o.map(e=>(0,K.jsx)(I,{value:String(e.seconds),children:e.label},e.seconds))})]})]}),(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,K.jsx)(we,{"aria-label":`Include existing items`,"aria-describedby":`automation-history-hint`,checked:e.filters.includeExisting??!1,onCheckedChange:e=>i({includeExisting:e})}),(0,K.jsx)(`span`,{children:`Include existing items`})]}),(0,K.jsx)(`p`,{id:`automation-history-hint`,className:`text-xs text-muted-foreground`,children:gn(e.filters.includeExisting)})]}),(0,K.jsxs)(Ce,{children:[(0,K.jsxs)(Se,{className:`group flex min-h-11 items-center gap-2 text-sm font-medium`,children:[`Filters`,(0,K.jsx)(ge,{"aria-hidden":`true`,className:`size-4 text-soft-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-180`})]}),(0,K.jsx)(xe,{children:(0,K.jsxs)(`div`,{className:`grid gap-4 pt-2 sm:grid-cols-2`,children:[pn.map(t=>(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-filter-${t.key}`,children:t.label}),(0,K.jsx)(B,{id:`automation-filter-${t.key}`,className:`border-border`,placeholder:`comma separated`,value:mn(e.filters[t.key]),onChange:e=>a(t.key,e.target.value)}),t.hint?(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.hint}):null]},t.key)),(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-filter-lookback`,children:`Look back (days)`}),(0,K.jsx)(B,{id:`automation-filter-lookback`,className:`border-border`,type:`number`,min:1,value:e.filters.lookbackDays,onChange:e=>i({lookbackDays:Math.max(1,Number(e.target.value)||1)})})]}),(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-filter-max`,children:`Max records per check`}),(0,K.jsx)(B,{id:`automation-filter-max`,className:`border-border`,type:`number`,min:1,value:e.filters.maxRecords,onChange:e=>i({maxRecords:Math.max(1,Number(e.target.value)||1)})})]})]})})]})]})}var yn=e=>String(e).padStart(2,`0`);function bn({label:e,value:t,max:n,onCommit:r}){let[i,a]=(0,H.useState)(yn(t)),o=(0,H.useRef)(null),s=!(/^\d{1,2}$/.test(i)&&Number(i)===t),c=`${e} must be 00–${yn(n)}.`,l=(0,H.useId)();return(0,H.useEffect)(()=>{o.current?.setCustomValidity(s?c:``)},[s,c]),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{ref:o,"aria-label":e,"aria-invalid":s||void 0,"aria-describedby":s?l:void 0,inputMode:`numeric`,maxLength:2,className:`w-20 border-border text-center tabular-nums`,value:i,onChange:e=>{a(e.target.value),/^\d{1,2}$/.test(e.target.value)&&Number(e.target.value)<=n&&r(Number(e.target.value))},onBlur:()=>a(yn(t))}),s?(0,K.jsx)(`p`,{id:l,className:`order-last basis-full text-xs text-destructive`,children:c}):null]})}var xn=[{minutes:void 0,label:`No limit`},{minutes:30,label:`30 minutes`},{minutes:120,label:`2 hours`},{minutes:360,label:`6 hours`},{minutes:1440,label:`1 day`},{minutes:10080,label:`7 days`}],Sn=`none`,Cn=e=>String(e).padStart(2,`0`);function wn(e,t=Date.now()){let n=ft(t,e)??ft(t,`UTC`),r=new Date(Date.UTC(n.year,n.month-1,n.day+1));return`${r.getUTCFullYear()}-${Cn(r.getUTCMonth()+1)}-${Cn(r.getUTCDate())}T09:00`}function Tn(){let e=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];return e.includes(`UTC`)?e:[`UTC`,...e]}function En({value:e,stored:t,onChange:n}){let r=t=>n({...e,...t}),i=e.at?at(e.at):null,a=e.at?.slice(0,10)??``,o=i?.hour??9,s=i?.minute??0,c=(e,t,n)=>r({at:`${e}T${Cn(t)}:${Cn(n)}`}),l=(0,H.useRef)(null),u=(0,H.useId)(),d=et(e),f=!(t?.type===`once`&&t.at===e.at&&t.timeZone===e.timeZone)&&d!==null&&d<=Date.now();(0,H.useEffect)(()=>{l.current?.setCustomValidity(f?Ze:``)},[f]);let p=lt(e);return(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-once-date`,children:`Date`}),(0,K.jsx)(B,{ref:l,id:`automation-once-date`,type:`date`,className:`w-44 max-w-full border-border`,value:a,"aria-invalid":f||void 0,"aria-describedby":f?u:void 0,onChange:e=>{/^\d{4}-\d{2}-\d{2}$/.test(e.target.value)&&c(e.target.value,o,s)},required:!0})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,K.jsx)(bn,{label:`Hour`,value:o,max:23,onCommit:e=>c(a,e,s)}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,K.jsx)(bn,{label:`Minute`,value:s,max:59,onCommit:e=>c(a,o,e)})]})]}),f?(0,K.jsx)(`p`,{id:u,className:`text-xs text-destructive`,children:Ze}):null,(0,K.jsx)(On,{value:e.timeZone??``,onCommit:e=>r({timeZone:e})}),(0,K.jsx)(kn,{value:e.latestStartMinutes,onChange:t=>n(Dn(e,t))}),p?(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Runs once at ${p.time} on ${p.date} (${e.timeZone}). ${p.note?`${p.note} `:``}Squawk must be running then.`}):null]})}function Dn(e,t){let{latestStartMinutes:n,...r}=e;return t===void 0?r:{...r,latestStartMinutes:t}}function On({value:e,onCommit:t}){let[n,r]=(0,H.useState)(e),i=(0,H.useRef)(null),a=(0,H.useId)(),o=(0,H.useId)(),[s]=(0,H.useState)(Tn),c=n!==e||!Xe(n),l=tt(n);return(0,H.useEffect)(()=>{i.current?.setCustomValidity(c?l:``)},[c,l]),(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-once-zone`,children:`Time zone`}),(0,K.jsx)(B,{ref:i,id:`automation-once-zone`,list:a,autoComplete:`off`,spellCheck:!1,className:`w-full border-border sm:w-72`,value:n,"aria-invalid":c||void 0,"aria-describedby":c?o:void 0,onChange:e=>{r(e.target.value),Xe(e.target.value)&&t(e.target.value)}}),(0,K.jsx)(`datalist`,{id:a,children:s.map(e=>(0,K.jsx)(`option`,{value:e},e))}),c?(0,K.jsx)(`p`,{id:o,className:`text-xs break-words text-destructive`,children:l}):null]})}function kn({value:e,onChange:t}){let n=xn.some(t=>t.minutes===e)||e===void 0?xn:[...xn,{minutes:e,label:`${e} minutes`}];return(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-once-latest`,children:`Latest start`}),(0,K.jsxs)(L,{value:e===void 0?Sn:String(e),onValueChange:e=>t(e===Sn?void 0:Number(e)),children:[(0,K.jsx)(P,{id:`automation-once-latest`,className:`w-full sm:w-48`,"aria-label":`Latest start`,children:(0,K.jsx)(N,{})}),(0,K.jsx)(F,{children:n.map(e=>(0,K.jsx)(I,{value:e.minutes===void 0?Sn:String(e.minutes),children:e.label},e.label))})]}),(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`If Squawk was not running at the time, it still starts the task this long afterwards; later, the schedule is marked missed.`})]})}var An=[{type:`daily`,label:`Every day`},{type:`weekdays`,label:`Weekdays`},{type:`weekly`,label:`Weekly`},{type:`hours`,label:`Every N hours`},{type:`once`,label:`Once`}];function jn({value:e,stored:t,onChange:n,timeZone:r}){let i=t=>n({...e,...t}),a=t=>i(t===`once`?{type:t,at:e.at??wn(r),timeZone:e.timeZone??r}:{type:t});return(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsx)(`div`,{role:`group`,"aria-label":`Repeat`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:An.map(t=>(0,K.jsx)(sn,{pressed:e.type===t.type,onClick:()=>a(t.type),children:t.label},t.type))}),e.type===`once`?(0,K.jsx)(En,{value:e,stored:t,onChange:n}):null,e.type===`weekly`?(0,K.jsx)(`div`,{role:`group`,"aria-label":`Day of the week`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:ut.map((t,n)=>(0,K.jsx)(sn,{pressed:e.day===n+1,onClick:()=>i({day:n+1}),children:t},t))}):null,e.type===`once`?null:e.type===`hours`?(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-every`,children:`Run every`}),(0,K.jsxs)(L,{value:String(e.every),onValueChange:e=>i({every:Number(e)}),children:[(0,K.jsx)(P,{id:`automation-every`,className:`w-full sm:w-48`,"aria-label":`Run every`,children:(0,K.jsx)(N,{})}),(0,K.jsx)(F,{children:st.map(e=>(0,K.jsx)(I,{value:String(e),children:e===1?`hour`:`${e} hours`},e))})]}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Counted from midnight, so “every 6 hours” runs at 00:00, 06:00, 12:00 and 18:00.`})]}):(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,K.jsx)(bn,{label:`Hour`,value:e.hour,max:23,onCommit:e=>i({hour:e})}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,K.jsx)(bn,{label:`Minute`,value:e.minute,max:59,onCommit:e=>i({minute:e})}),(0,K.jsx)(`span`,{className:`text-sm break-all text-muted-foreground`,children:r})]}),e.type===`once`?null:(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Cron: `,(0,K.jsx)(`code`,{className:`font-mono text-foreground`,children:it(e)})]})]})}var Mn=40*864e5,Nn=5;function Pn({schedule:e,timeZone:t,now:n=Date.now()}){if(e.type===`once`)return(0,K.jsx)(Fn,{schedule:e,now:n});let r=$e(e,n+1,n+Mn,t,Nn);return(0,K.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,"data-slot":`next-runs`,className:`min-w-0 rounded-xl border bg-card p-5`,children:[(0,K.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-2 text-base font-semibold`,children:`Next 5 runs`}),r.length===0?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No runs in the next 40 days.`}):(0,K.jsx)(`ol`,{"aria-label":`Next 5 runs`,className:`grid divide-y divide-border text-sm`,children:r.map((e,r)=>(0,K.jsxs)(`li`,{className:`flex min-h-10 items-center justify-between gap-3 py-1.5`,children:[(0,K.jsx)(`span`,{className:r===0?`font-semibold tabular-nums text-foreground`:`font-medium tabular-nums`,children:V(new Date(e).toISOString(),t)}),(0,K.jsx)(`span`,{className:r===0?`font-medium text-accent-text`:`text-muted-foreground`,children:rt(n,e)})]},e))}),(0,K.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Times are in `,t,`, the zone this Squawk runs in.`]})]})}function Fn({schedule:e,now:t}){let n=et(e),r=lt(e);return(0,K.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,"data-slot":`next-runs`,className:`min-w-0 rounded-xl border bg-card p-5`,children:[(0,K.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-base font-semibold`,children:`Runs once`}),n===null||!r?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pick a date, a time and a time zone.`}):(0,K.jsxs)(`p`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 text-sm`,children:[(0,K.jsx)(`span`,{className:`font-medium tabular-nums`,children:`${r.date} ${r.time}`}),n>t?(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:rt(t,n)}):null]}),r?.note?(0,K.jsx)(`p`,{className:`mt-2 text-sm break-words`,children:r.note}):null,n!==null&&n<=t?(0,K.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:`The due time has passed.`}):null,(0,K.jsx)(`p`,{className:`mt-3 text-xs break-words text-muted-foreground`,children:`Times are in ${e.timeZone??`UTC`}. Squawk must be running then; afterwards the schedule is archived with its task.`})]})}var In={schedule:`On a schedule`,github:`When GitHub changes`};function Ln(e){return/time zone|due time/i.test(e)?`when`:/placeholder|prompt|workflow|runner|model|task|autonomous/i.test(e)?`run`:/\bname\b/i.test(e)?`name`:/schedule|github|event|filter|label|interval|remote|forge|lookback|records?|hour|minute|poll|kind|archived/i.test(e)?`when`:`form`}function Rn({title:e,hideLegend:t=!1,failure:n,section:r,children:i}){let a=(0,H.useId)();return(0,K.jsxs)(`section`,{role:t?void 0:`group`,"aria-labelledby":t?void 0:a,className:`grid min-w-0 gap-3.5 rounded-xl border border-card-edge bg-card shadow-card p-5`,children:[t?null:(0,K.jsx)(`h2`,{id:a,className:`text-sm font-semibold text-foreground`,children:e}),i,n?.section===r&&!n.conflict?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:n.message}):null]})}function zn({draft:e,patch:t,forge:n,automation:r}){return(0,K.jsx)(K.Fragment,{children:r?(0,K.jsxs)(`p`,{className:`text-sm`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`Trigger · `}),In[e.kind]]}):(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,K.jsx)(qe,{slot:`automation-kind`,label:`Trigger`,size:`touch`,value:e.kind,onChange:e=>t({kind:e}),options:[{value:`schedule`,label:In.schedule},{value:`github`,label:In.github,disabled:!n.available,...n.available?{}:{title:n.reason??`GitHub is unavailable`}}]}),n.available?null:(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`GitHub unavailable · ${n.reason??`no GitHub access`}`})]})})}function Bn({draft:e,patch:t,forge:n,timeZone:r,automation:i}){return e.kind===`schedule`?(0,K.jsx)(jn,{value:e.schedule,stored:i?.schedule,onChange:e=>t({schedule:e}),timeZone:r}):(0,K.jsx)(vn,{draft:e,onChange:t,...n.available?{}:{disabledReason:n.reason??`no GitHub access`}})}function Vn({draft:e,patch:t,saving:n,automation:r}){let i=e.kind===`schedule`?[`date`,`time`,`project`,`automation`]:[`github.kind`,`github.number`,`github.title`,`github.url`,`github.author`,`github.assignees`,`github.labels`,`github.event`],a=[...new Set([...e.prompt.matchAll(/\{\{([^{}]+)\}\}/g)].map(e=>e[1]))].filter(e=>!i.includes(e));return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,K.jsx)(j,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,K.jsx)(Ye,{id:`automation-prompt`,value:e.prompt,onChange:e=>t({prompt:e.target.value}),rows:3,className:`[field-sizing:fixed] min-h-[88px] resize-none border-border bg-background`,required:!0}),(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:e.kind===`schedule`?(0,K.jsxs)(K.Fragment,{children:[`Available: `,`{{date}}`,` `,`{{time}}`,` `,`{{project}}`,` `,`{{automation}}`,`. A run-context block is appended automatically.`]}):(0,K.jsxs)(K.Fragment,{children:[`Available: `,`{{github.number}}`,` `,`{{github.title}}`,` `,`{{github.url}}`,` `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})})]}),a.length?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:`Unavailable for this trigger: ${a.map(e=>`{{${e}}}`).join(`, `)}`}):null,(0,K.jsx)(Kn,{draft:e,patch:t}),(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,K.jsx)(we,{"aria-label":`Autonomous`,checked:e.autonomous,onCheckedChange:e=>t({autonomous:e})}),(0,K.jsxs)(`span`,{children:[`Autonomous `,(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`· runs without waiting for answers`})]})]}),(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`Each run is an ordinary task in its own worktree, queued behind the parallel cap.`}),(0,K.jsx)(Ge,{archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,onChange:t,disabled:n}),(0,K.jsx)(Be,{allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging,onChange:t,disabled:n}),r?(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`These settings apply to future tasks. Existing tasks keep their settings.`}):null]})}function Hn({draft:e,patch:t,automation:n}){let r=e.kind===`schedule`;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,K.jsx)(we,{"aria-label":n?`Enabled`:`Enable after saving`,checked:e.enabled,onCheckedChange:e=>t({enabled:e})}),(0,K.jsx)(`span`,{children:n?`Enabled`:`Enable after saving`})]}),(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:r&&e.schedule.type===`once`?`It runs once at the time set above, then moves to Archived with its task.`:r?`The first run is the next occurrence shown beside the schedule.`:gn(e.filters.includeExisting)})]})}function Un({automation:e,forge:t,timeZone:n,onSaved:r,onReload:i}){let[a,o]=(0,H.useState)(()=>Ut(e)),[s,c]=(0,H.useState)(e?.revision),[l,u]=(0,H.useState)(),[p,h]=(0,H.useState)(!1),[g,v]=(0,H.useState)(!1),[y,b]=(0,H.useState)(!1),[x,te]=(0,H.useState)(``),S=e=>o(t=>({...t,...e})),ne=async t=>{if(t.preventDefault(),p)return;let n=t.currentTarget;if(n instanceof HTMLFormElement&&!n.checkValidity()){n.reportValidity();return}h(!0),u(void 0);let i=`save`;try{if(e&&s!==void 0){let{automation:t}=await f(e.id,Jt({...a,enabled:e.enabled},s));c(t.revision),a.enabled!==e.enabled&&(i=`enable`,await m(e.id,a.enabled))}else await ee(qt(a));r()}catch(t){let n=t instanceof Error?t.message:String(t);i===`save`&&e&&t instanceof d&&t.status===409&&/revision conflict/i.test(n)?u({section:`form`,message:`Edited elsewhere — reload to see the latest version`,conflict:!0}):u({section:i===`enable`?`enable`:Ln(n),message:n})}finally{h(!1)}},re=async()=>{if(!(!e||y)){b(!0),te(``);try{await _(e.id),r()}catch(e){te(e instanceof Error?e.message:String(e))}finally{b(!1)}}},ie=(0,H.useId)(),ae=(0,H.useId)(),C=a.kind===`schedule`;return(0,K.jsx)(Oe,{route:`automations`,density:a.name.trim()===``&&a.prompt.trim()===``?`sparse`:`full`,header:Gn({automation:e,draft:a,formId:ie,saveHintId:ae,saving:p}),children:(0,K.jsxs)(`form`,{id:ie,className:`automation-editor grid min-w-0 gap-4 md:grid-cols-[minmax(0,1fr)_320px] md:items-start`,onSubmit:ne,children:[(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-3.5`,children:[(0,K.jsx)(Rn,{title:`Name`,hideLegend:!0,section:`name`,failure:l,children:(0,K.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,K.jsx)(j,{htmlFor:`automation-name`,className:`text-sm font-semibold text-foreground`,children:`Name`}),(0,K.jsx)(B,{id:`automation-name`,className:`border-border`,value:a.name,placeholder:`Daily dependency audit`,onChange:e=>S({name:e.target.value}),required:!0})]})}),(0,K.jsxs)(Rn,{title:`When`,section:`when`,failure:l,children:[(0,K.jsx)(zn,{draft:a,patch:S,forge:t,automation:e}),(0,K.jsx)(Bn,{draft:a,patch:S,forge:t,timeZone:n,automation:e})]}),(0,K.jsx)(Rn,{title:`What to run`,section:`run`,failure:l,children:(0,K.jsx)(Vn,{draft:a,patch:S,saving:p,automation:e})}),(0,K.jsx)(Rn,{title:`Enable`,section:`enable`,failure:l,children:(0,K.jsx)(Hn,{draft:a,patch:S,automation:e})}),l?.section===`form`?(0,K.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 text-sm text-destructive`,children:[(0,K.jsx)(`span`,{className:`break-words`,children:l.message}),l.conflict&&i?(0,K.jsx)(M,{type:`button`,variant:`outline`,onClick:i,children:`Reload`}):null]}):null,e?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2 border-t pt-4`,children:[g?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? It will stop running and cannot be restored.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(M,{type:`button`,variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:y,onClick:()=>void re(),children:`Delete automation`}),(0,K.jsx)(M,{type:`button`,variant:`outline`,disabled:y,onClick:()=>{v(!1),te(``)},children:`Keep`})]})]}):(0,K.jsx)(M,{type:`button`,variant:`outline`,"data-action":`automation-delete`,onClick:()=>v(!0),children:`Delete`}),x?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:x}):null]}):null]}),(0,K.jsxs)(`aside`,{className:`grid min-w-0 max-w-full grid-cols-[minmax(0,1fr)] gap-4 md:sticky md:top-4`,children:[C?(0,K.jsx)(Pn,{schedule:a.schedule,timeZone:n}):(0,K.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-5`,children:[(0,K.jsx)(`h2`,{className:`mb-2 text-base font-semibold`,children:`How it polls`}),(0,K.jsx)(`p`,{className:`text-sm break-words text-muted-foreground`,children:_n(a)})]}),(0,K.jsx)(on,{draft:a})]})]})})}function Wn(e){let t=[!e.name.trim()&&`a name`,!e.prompt.trim()&&`a prompt`].filter(Boolean);return t.length?`Add ${t.join(` and `)} to save.`:``}function Gn({automation:e,draft:t,formId:n,saveHintId:r,saving:i}){let a=t.name.trim()?t.prompt.trim()?``:`Prompt`:`Name`,o=Wn(t),s=e?`Save changes`:t.enabled?`Save and enable`:`Save paused`;return{title:e?`Edit automation`:`New automation`,subtitle:`Define when it runs and the ordinary task it launches.`,status:(0,K.jsx)(`p`,{id:r,"data-slot":`automation-save-hint`,className:`min-h-[1lh] text-xs text-muted-foreground`,children:o}),secondaryActions:(0,K.jsx)(Me,{type:`button`,variant:`outline`,asChild:!0,children:(0,K.jsx)(R,{to:`/automations`,children:`Cancel`})}),primaryAction:(0,K.jsx)(Me,{type:`submit`,form:n,variant:`primary`,disabled:i||a!==``,title:a?`${a} is required`:void 0,"aria-describedby":o?r:void 0,children:i?`Saving…`:s})}}function Kn({draft:e,patch:t}){let n=i(),r=Je(),{runners:u,signedOut:d}=r.runnersOn(e=>r.repoAccount?.[e]),f=a(),p=s(),{runner:m,ready:h}=o(e.runner??f.data?.defaultRunner??`claude`),g=c(m,h,r.repoAccount?.[m]),ee=[...new Set([...(n.data?.workflows??[]).map(e=>e.name),...e.workflow?[e.workflow]:[]])],_=[...new Set([...u,...e.runner?[e.runner]:[]])],v=Ve(m,p.data,g.data,[e.model]),y=v.find(t=>t.id===(e.model??``))?.label??e.model??`auto`,b=e=>(0,K.jsx)(e,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`});return(0,K.jsx)(Re,{children:(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(Ie,{slot:`automation-workflow-pill`,icon:b(ve),fieldLabel:!0,ariaLabel:`Workflow`,label:e.workflow??`inline steps`,value:e.workflow??``,disabled:e.workflow===void 0,disabledHint:`This automation carries its own steps.`,options:ee.map(e=>({value:e,label:e})),onPick:e=>t({workflow:e})}),(0,K.jsx)(Ie,{slot:`automation-runner-pill`,icon:b(he),fieldLabel:!0,ariaLabel:`Runner`,label:e.runner?l(p.data,e.runner):`default`,value:e.runner??``,disabled:!p.data,options:[{value:``,label:`default`,desc:`The project’s default runner`},..._.map(e=>({value:e,label:l(p.data,e)}))],footer:(0,K.jsx)(Le,{uninstalled:r.uninstalled,signedOut:d.filter(t=>t!==e.runner)}),onPick:e=>{t({runner:e||void 0,model:void 0})}}),(0,K.jsx)(Ie,{slot:`automation-model-pill`,icon:b(ye),fieldLabel:!0,ariaLabel:`Model`,label:y,value:e.model??``,options:v.map(e=>({value:e.id,label:e.label,desc:e.desc})),onPick:e=>t({model:e||void 0})})]})})}function qn(e){return{text:/\bauth\b|sign.?in|\blogin\b|\btoken\b|credentials|HTTP 401/i.test(e)?`GitHub CLI is not signed in`:/ENOENT|not found.*gh|gh.*not found/i.test(e)?`GitHub CLI is not installed`:`GitHub filter check failed`,tone:`error`,details:e}}function Jn({data:e,error:t,refresh:n,archived:i=!1,onArchivedChange:a}){let[o,s]=(0,H.useState)({}),[c,l]=(0,H.useState)({}),d=(e,t)=>s(n=>{let{[e]:r,...i}=n;return t?{...i,[e]:t}:i}),f=async(e,t,n=!1)=>{l(t=>({...t,[e]:!0}));try{await t()}catch(t){let r=t instanceof Error?t.message:String(t);d(e,n?qn(r):{text:r,tone:`error`})}finally{l(t=>({...t,[e]:!1}))}},p=e=>f(e.id,async()=>{d(e.id,{text:`Starting…`,tone:`info`});let{runId:t}=await u(e.id);d(e.id,{text:`Started task`,tone:`info`,runId:t}),n()}),h=e=>f(e.id,async()=>{d(e.id,void 0),await m(e.id,!e.enabled),await n()}),g=e=>f(e.id,async()=>{d(e.id,void 0),await te(e.id),await n()}),ee=e=>f(e.id,async()=>{d(e.id,{text:`Checking…`,tone:`info`});let{checkId:t}=await S(e.id,`preview`);for(let r=0;r<60;r+=1){let r=await v(t);if(r.status===`complete`){d(e.id,{text:`${r.matches??0} filter match${r.matches===1?``:`es`} found; no tasks launched. Counts can include closed items and previously processed events.`,tone:`info`}),n();return}if(r.status===`error`){let t=r.error??`Preview failed`;d(e.id,qn(t));return}await new Promise(e=>setTimeout(e,500))}throw Error(`Preview is still running`)},!0),_=e?.automations??[],y=_.filter(e=>!e.archived),b=_.filter(e=>!!e.archived),x=i?b:y;return(0,K.jsx)(z,{route:`automations`,density:e?Ae(x.length):`full`,headerSpacing:`compact`,header:{title:`Automations`,subtitle:`Schedules and GitHub checks run while Squawk is open.`,primaryAction:(0,K.jsx)(Me,{variant:`primary`,asChild:!0,children:(0,K.jsxs)(R,{to:`/automations/new`,children:[(0,K.jsx)(pe,{"aria-hidden":`true`,className:`size-4`}),`New automation`]})})},sparseFooter:e&&x.length>0&&!i?(0,K.jsx)(je,{summary:`${x.length} active ${x.length===1?`automation`:`automations`} configured. New automations start paused so you can test filters before enabling them.`,actions:(0,K.jsx)(M,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,K.jsx)(R,{to:`/automations/new`,children:`Add another`})})}):void 0,children:t&&!e?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,K.jsx)(q,{text:t}),(0,K.jsx)(M,{variant:`outline`,onClick:()=>void n(),children:`Retry`})]}):e?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-end justify-between gap-3 border-b border-border`,children:[a?(0,K.jsxs)(`div`,{className:`flex gap-6`,role:`group`,"aria-label":`Filter automations`,children:[(0,K.jsxs)(`button`,{type:`button`,"data-slot":`automations-tab`,"data-view":`active`,"aria-pressed":!i,onClick:()=>a(!1),className:r(`-mb-px flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground`,!i&&`border-accent-text text-foreground`),children:[`Current`,(0,K.jsx)(Yn,{count:y.length})]}),(0,K.jsxs)(`button`,{type:`button`,"data-slot":`automations-tab`,"data-view":`archived`,"aria-pressed":i,onClick:()=>a(!0),className:r(`-mb-px flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground`,i&&`border-accent-text text-foreground`),children:[`Archived`,(0,K.jsx)(Yn,{count:b.length})]})]}):(0,K.jsx)(`span`,{}),(0,K.jsx)(`div`,{className:`pb-2.5`,children:(0,K.jsx)(Xn,{data:e})})]}),i&&x.length===0?(0,K.jsx)(q,{text:`No archived automations.`}):x.length===0?(0,K.jsx)(Ne,{icon:(0,K.jsx)(_e,{}),tone:`neutral`,title:`No automations yet`,subtitle:`Create one paused, preview it, then enable it.`,heading:`h2`,actions:(0,K.jsx)(M,{variant:`primary`,asChild:!0,children:(0,K.jsxs)(R,{to:`/automations/new`,children:[(0,K.jsx)(pe,{"aria-hidden":`true`,className:`size-4`}),`New automation`]})})}):(0,K.jsx)(`ul`,{className:`grid gap-3`,"aria-label":`Automations`,children:x.map(t=>(0,K.jsx)(ar,{automation:t,timeZone:e.timeZone,note:o[t.id],busy:c[t.id]===!0,onRun:()=>void p(t),onToggle:()=>void h(t),onPreview:()=>void ee(t),onCancel:()=>void g(t)},t.id))})]}):(0,K.jsx)(q,{text:`Loading automations…`})})}function Yn({count:e}){return e===0?null:(0,K.jsx)(`span`,{"data-slot":`automations-tab-count`,className:`tabular-nums text-muted-foreground`,children:`· ${e}`})}function Xn({data:e}){return(0,K.jsx)(`p`,{"data-slot":`automation-scheduler`,className:r(`text-xs break-words`,e.scheduler.state===`scheduled`?`text-success`:`text-muted-foreground`),children:`Scheduler ${e.scheduler.state===`scheduled`?`running`:`idle`} · GitHub ${e.available?`available`:`unavailable`}${e.reason?` · ${e.reason}`:``} · ${e.timeZone}`})}function Zn(e){return e.kind===`schedule`&&e.schedule?nt(e.schedule):`${un(e.events??[])} · every ${Math.round((e.intervalSeconds??300)/60)} min`}function Qn({automation:e,nextRun:t}){let n=e.kind===`schedule`?me:fe,r=Pe(e);return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 font-semibold break-words`,children:[(0,K.jsx)(n,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),e.name]}),(0,K.jsxs)(`p`,{"data-slot":`automation-meta`,className:`mt-1 flex flex-wrap items-baseline gap-x-1.5 ps-6 text-xs break-words text-muted-foreground`,children:[(0,K.jsx)(`span`,{children:Zn(e)}),t?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),t]}):null]})]}),(0,K.jsx)(Ke,{dot:r.tone,shape:r.shape,pulse:r.pulse,children:r.label})]})}function $n({automation:e,archive:t}){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`text-sm break-words`,children:[t.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`,t.runId?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(R,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${t.runId}`,children:`Open task`})]}):null]}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,K.jsx)(M,{variant:`outline`,asChild:!0,children:(0,K.jsx)(R,{to:`/automations/${e.id}`,children:`Details`})})})]})}function er({automation:e,timeZone:t}){let n=e.kind===`schedule`,r=e.enabled&&n?e.nextRunAt:void 0;return!n&&e.enabled?(0,K.jsx)(`span`,{children:`continuous`}):r?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-foreground`,children:`Next run: ${V(r,t)}`}),(0,K.jsx)(`span`,{children:`· ${rt(Date.now(),Date.parse(r))}`})]}):(0,K.jsx)(`span`,{children:`Next run: —`})}function tr({automation:e,timeZone:t}){let n=e.enabled?bt(e.state):void 0;return n?(0,K.jsxs)(`p`,{role:`alert`,"data-slot":`automation-failing`,className:`text-sm break-words text-destructive`,children:[`The last ${n.consecutiveFailures} checks failed: ${n.lastError}`,n.retryAt?(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:` · Next try ${V(n.retryAt,t)}`}):null]}):null}var $=`h-8 px-3 max-md:h-11 no-hover:h-11`;function nr({automation:e,busy:t,confirmingCancel:n,cancelRef:i,onToggle:a,onRun:o,onPreview:s,onOpenCancel:c}){let l=e.kind===`schedule`,u=e.schedule?.type===`once`;return(0,K.jsxs)(`div`,{"data-slot":`automation-actions`,className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(M,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-toggle`,disabled:t,onClick:a,children:e.enabled?`Pause`:`Enable`}),l?(0,K.jsx)(M,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-run`,disabled:t,onClick:o,children:`Run now`}):(0,K.jsx)(M,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-preview`,disabled:t,onClick:s,children:`Test filter`}),(0,K.jsx)(M,{variant:`outline`,size:`sm`,className:$,asChild:!0,children:(0,K.jsx)(R,{to:`/automations/${e.id}`,children:`Edit`})}),u&&!n?(0,K.jsx)(M,{variant:`outline`,size:`sm`,className:r($,`text-destructive`),ref:i,"data-action":`automation-cancel`,disabled:t,onClick:c,children:`Cancel`}):null,(0,K.jsx)(M,{variant:`outline`,size:`sm`,className:r($,`sm:ms-auto`),asChild:!0,children:(0,K.jsx)(R,{to:`/automations/${e.id}/log`,children:`Execution log`})})]})}function rr({automation:e,busy:t,keepRef:n,onConfirm:r,onKeep:i}){return(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Cancel “${e.name}”? It will never run, and it moves to Archived.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(M,{variant:`danger-ghost`,"data-action":`automation-cancel-confirm`,disabled:t,onClick:r,children:`Cancel schedule`}),(0,K.jsx)(M,{ref:n,variant:`outline`,disabled:t,onClick:i,children:`Keep`})]})]})}function ir({note:e}){return(0,K.jsxs)(`div`,{role:e.tone===`error`?`alert`:`status`,className:r(`text-sm break-words`,e.tone===`error`?`text-destructive`:`text-muted-foreground`),children:[e.text,e.details?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(ue,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:De(`gh`),children:`Set up`}),(0,K.jsxs)(`details`,{children:[(0,K.jsx)(`summary`,{className:`min-h-11 cursor-pointer`,children:`Command details`}),(0,K.jsx)(`pre`,{className:`whitespace-pre-wrap break-words`,children:e.details})]})]}):null,e.runId?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(R,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`})]}):null]})}function ar({automation:e,timeZone:t,note:n,busy:r,onRun:i,onToggle:a,onPreview:o,onCancel:s}){let[c,l]=(0,H.useState)(!1),u=(0,H.useRef)(null),d=(0,H.useRef)(null),f=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=f.current===`keep`?d.current:f.current===`cancel`?u.current:null;f.current=null,e?.focus()},[c]);let p=()=>{f.current=`keep`,l(!0)},m=()=>{f.current=`cancel`,l(!1)},h=e.archived;return(0,K.jsxs)(`li`,{"data-slot":`automation-card`,"data-kind":e.kind,className:`flex min-w-0 flex-col gap-2.5 rounded-xl border border-card-edge bg-card p-4 shadow-card`,children:[(0,K.jsx)(Qn,{automation:e,nextRun:h?void 0:(0,K.jsx)(er,{automation:e,timeZone:t})}),h?(0,K.jsx)($n,{automation:e,archive:h}):null,h?null:(0,K.jsx)(tr,{automation:e,timeZone:t}),h?null:(0,K.jsx)(nr,{automation:e,busy:r,confirmingCancel:c,cancelRef:u,onToggle:a,onRun:i,onPreview:o,onOpenCancel:p}),e.schedule?.type===`once`&&!h&&c?(0,K.jsx)(rr,{automation:e,busy:r,keepRef:d,onConfirm:()=>{l(!1),s()},onKeep:m}):null,n?(0,K.jsx)(ir,{note:n}):null,(0,K.jsx)(Mt,{automationId:e.id,automationName:e.name,timeZone:t})]})}function or(e){let t=Ee(),n=He(),[r,i]=(0,H.useState)(),[a,o]=(0,H.useState)(``),s=(0,H.useCallback)(t=>ie({signal:t,...e?{archived:e}:{}}).then(e=>{t?.aborted||(i(e),o(``))}).catch(e=>{t?.aborted||o(String(e))}),[e]);return(0,H.useEffect)(()=>{n&&s()},[n,s]),(0,H.useEffect)(()=>p(async e=>{n&&await s(e)}),[n,s]),(0,H.useEffect)(()=>de((e,n)=>{if(e!==`automation-change`)return;let r=n;typeof r.project==`string`&&(t===null||r.project===t)&&s()}),[t,s]),{data:r,error:a,refresh:s}}function sr({mode:e=`list`}){let{automationId:t}=le(),n=Te(),[r,i]=(0,H.useState)(!1),{data:a,error:o,refresh:s}=or(`include`),[c,l]=(0,H.useState)(0),u=ze();if(u===`unknown`)return(0,K.jsx)(z,{route:`automations`,density:`empty`,children:(0,K.jsx)(q,{text:`Loading automations…`})});if(u===`absent`)return(0,K.jsx)(Fe,{});if(u===`disabled`)return(0,K.jsx)(z,{route:`automations`,density:`empty`,children:(0,K.jsx)(Ne,{icon:(0,K.jsx)(_e,{}),tone:`neutral`,title:`Automations are off`,subtitle:`This server does not run schedules, poll GitHub or launch tasks from them. Unset CEZ_AUTOMATIONS or set it to 1 and restart Squawk to turn automations on.`,heading:`h2`})});let d=()=>{n(`/automations`),s()},f=a?.automations.find(e=>e.id===t);if(e===`list`)return(0,K.jsx)(Jn,{data:a,error:o,refresh:s,archived:r,onArchivedChange:i});if(!a)return o?(0,K.jsx)(z,{route:`automations`,density:`empty`,header:{title:`Automations`,subtitle:`Could not load automations.`},children:(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,K.jsx)(q,{text:o}),(0,K.jsx)(M,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]})}):(0,K.jsx)(z,{route:`automations`,density:`empty`,children:(0,K.jsx)(q,{text:`Loading automations…`})});let p={available:a.available,...a.reason?{reason:a.reason}:{}};return e===`new`?(0,K.jsx)(Un,{forge:p,timeZone:a.timeZone,onSaved:d}):e===`edit`?f?f.archived?(0,K.jsx)(Nt,{automation:f,timeZone:a.timeZone,onDeleted:d}):(0,K.jsx)(Un,{automation:f,forge:p,timeZone:a.timeZone,onSaved:d,onReload:()=>void s().then(()=>l(e=>e+1))},`${f.id}:${c}`):(0,K.jsx)(z,{route:`automations`,density:`empty`,header:{title:`Automation not found`,subtitle:`This automation may have been removed.`},children:(0,K.jsx)(M,{asChild:!0,variant:`outline`,children:(0,K.jsx)(R,{to:`/automations`,children:`Back to automations`})})}):t?(0,K.jsx)(jt,{automationId:t,automationName:f?.name,timeZone:a.timeZone,readOnly:!!f?.archived}):(0,K.jsx)(q,{text:`Automation not found.`})}export{sr as AutomationsRoute};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{o as n,t as r}from"./dist-C_rn70hE.js";import{r as i}from"./button-C8jUIs8Q.js";e();var a=t(),o=i(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:`bg-accent-strong text-accent-strong-foreground [a&]:hover:bg-accent-strong/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-destructive-foreground focus-visible:ring-destructive/20 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-link-foreground underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function s({className:e,variant:t=`default`,asChild:i=!1,...s}){return(0,a.jsx)(i?r:`span`,{"data-slot":`badge`,"data-variant":t,className:n(o({variant:t}),e),...s})}export{s as t};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{o as n,t as r}from"./dist-C_rn70hE.js";import{r as i}from"./bundle-mjs-rHxsej31.js";e();var a=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,o=i,s=(e,t)=>n=>{if(t?.variants==null)return o(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,s=Object.keys(r).map(e=>{let t=n?.[e],o=i?.[e];if(t===null)return null;let s=a(t)||a(o);return r[e][s]}),c=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return o(e,s,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...c}[t]):{...i,...c}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},c=t(),l=s(`inline-flex shrink-0 items-center justify-center gap-[7px] rounded-md font-semibold whitespace-nowrap transition-[background-color,border-color,opacity,filter] outline-hidden focus-visible:ring-[3px] focus-visible:ring-ring/50 enabled:active:brightness-90 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{primary:`bg-action text-action-foreground pointer-hover:brightness-[0.96] disabled:border disabled:border-border disabled:bg-muted/80 disabled:text-muted-foreground disabled:opacity-100`,contrast:`bg-contrast text-contrast-foreground pointer-hover:brightness-[0.96]`,outline:`border border-border bg-card text-foreground pointer-hover:bg-muted`,ghost:`text-muted-foreground pointer-hover:bg-muted pointer-hover:text-foreground`,"danger-ghost":`text-danger pointer-hover:bg-danger/10`},size:{default:`h-11 px-3.5 text-[13px]`,sm:`h-[30px] rounded-sm px-2.5 text-[13px]`,icon:`size-9 text-[13px]`,"icon-sm":`size-[30px] rounded-sm text-[13px]`}},defaultVariants:{variant:`primary`,size:`default`}});function u({className:e,variant:t=`primary`,size:i=`default`,asChild:a=!1,...o}){return(0,c.jsx)(a?r:`button`,{"data-slot":`button`,"data-variant":t,"data-size":i,className:n(l({variant:t,size:i,className:e})),...o})}export{l as n,s as r,u as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{o as t}from"./dist-C_rn70hE.js";var n=e(),r={primary:`border-accent-strong/25 bg-accent-strong/15 text-link-foreground`,neutral:`border-border bg-card text-foreground shadow-xs`,danger:`border-danger/20 bg-danger/15 text-danger`};function i({icon:e,tone:i=`neutral`,title:a,subtitle:o,children:c,actions:l,backdrop:u=!1,heading:d=`h1`,className:f}){return(0,n.jsxs)(`div`,{"data-slot":`centered-state`,"data-tone":i,className:t(`relative isolate flex min-h-full flex-1 flex-col items-center justify-center px-6 py-12 text-center`,f),children:[u?(0,n.jsx)(s,{}):null,(0,n.jsxs)(`div`,{className:`flex w-full max-w-md flex-col items-center gap-4`,children:[(0,n.jsx)(`div`,{"data-slot":`centered-state-tile`,className:t(`flex size-[72px] items-center justify-center rounded-[18px] border [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-7`,r[i]),children:e}),(0,n.jsx)(d,{className:`text-2xl font-semibold text-balance text-foreground`,children:a}),o?(0,n.jsx)(`p`,{className:`text-sm text-pretty text-muted-foreground`,children:o}):null,c?(0,n.jsx)(`div`,{className:`w-full pt-2`,children:c}):null,l?(0,n.jsx)(`div`,{className:`flex items-center justify-center gap-3 pt-2`,children:l}):null]})]})}var a=[{top:`6%`,left:`14%`,size:2,tone:`accent`,opacity:.5},{top:`11%`,left:`31%`,size:3,tone:`accent`,opacity:.45},{top:`8%`,left:`52%`,size:2,tone:`pending`,opacity:.4},{top:`15%`,left:`71%`,size:2,tone:`accent`,opacity:.5},{top:`9%`,left:`86%`,size:3,tone:`primary`,opacity:.4},{top:`22%`,left:`8%`,size:2,tone:`pending`,opacity:.4},{top:`27%`,left:`24%`,size:2,tone:`primary`,opacity:.35},{top:`20%`,left:`44%`,size:3,tone:`accent`,opacity:.35},{top:`25%`,left:`62%`,size:2,tone:`accent`,opacity:.4},{top:`30%`,left:`79%`,size:2,tone:`primary`,opacity:.35},{top:`36%`,left:`12%`,size:3,tone:`accent`,opacity:.3},{top:`42%`,left:`35%`,size:2,tone:`pending`,opacity:.28},{top:`47%`,left:`58%`,size:2,tone:`primary`,opacity:.28},{top:`52%`,left:`88%`,size:2,tone:`accent`,opacity:.25},{top:`60%`,left:`29%`,size:3,tone:`accent`,opacity:.22}],o={accent:`bg-accent-strong`,primary:`bg-action`,pending:`bg-pending`};function s({className:e}){return(0,n.jsx)(`div`,{"data-slot":`twinkle-backdrop`,"aria-hidden":`true`,className:t(`pointer-events-none absolute inset-0 -z-10 overflow-hidden [mask-image:linear-gradient(to_bottom,black_25%,transparent_88%)]`,e),children:a.map((e,r)=>(0,n.jsx)(`span`,{className:t(`absolute rounded-[1px] motion-safe:animate-pulse`,e.size===3?`size-[3px]`:`size-0.5`,o[e.tone]),style:{top:e.top,left:e.left,opacity:e.opacity,animationDuration:`3.5s`,animationDelay:`${r%5*700}ms`}},r))})}export{s as n,i as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{o as t}from"./dist-C_rn70hE.js";var n=e();function r({adds:e,dels:r,className:i}){return e<=0&&r<=0?null:(0,n.jsxs)(`span`,{"data-slot":`change-counts`,className:t(`shrink-0 whitespace-nowrap tabular-nums`,i),children:[e>0?(0,n.jsxs)(`span`,{className:`text-semantic-green`,children:[`+`,e.toLocaleString(`en-US`)]}):null,e>0&&r>0?` `:null,r>0?(0,n.jsxs)(`span`,{className:`text-semantic-red`,children:[`−`,r.toLocaleString(`en-US`)]}):null]})}export{r as t};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{i,n as a,r as o}from"./highlighter-DvLzHjjY.js";var s=e(t(),1),c=n(),l=1500;function u(e,t){let n=(0,s.useMemo)(()=>e.split(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{i,n as a,r as o}from"./highlighter-Cfo7mLVB.js";var s=e(t(),1),c=n(),l=1500;function u(e,t){let n=(0,s.useMemo)(()=>e.split(`
2
2
  `).map(e=>[{content:e}]),[e]),r=(0,s.useMemo)(()=>a(t),[t]),c=n.length>l,[u,d]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(r===null||c)return;let t=!1;return o(e,r).then(n=>{t||d({key:e,tokens:n.tokens})}),()=>{t=!0}},[e,r,c]),r===null||c?n:u?.key===e?u.tokens:i(e,r)?.tokens??n}var d=`code-editor-surface m-0 min-h-full w-full whitespace-pre font-mono text-xs pointer-coarse:text-base leading-[1.7] px-3 py-2 [tab-size:2]`;function f({value:e,onChange:t,language:n,readOnly:i,className:a,markedLines:o,inputRef:l,...f}){let p=u(e,n),m=(0,s.useRef)(null),h=(0,s.useRef)(null),g=()=>{let e=h.current,t=m.current;!e||!t||(t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft)};return(0,s.useLayoutEffect)(g,[e]),(0,c.jsxs)(`div`,{"data-slot":`code-editor`,className:r(`relative overflow-hidden rounded-md border border-input bg-card`,a),children:[(0,c.jsx)(`pre`,{ref:m,"aria-hidden":`true`,className:r(d,`pointer-events-none absolute inset-0 overflow-auto text-soft-foreground`),children:p.map((e,t)=>(0,c.jsx)(`span`,{"data-marked":o?.has(t+1)?``:void 0,className:r(`block`,o?.has(t+1)&&`-mx-3 bg-destructive/15 px-3 shadow-[inset_2px_0_0_var(--danger)]`),children:e.length===0?`
3
3
  `:(0,c.jsxs)(c.Fragment,{children:[e.map((e,t)=>(0,c.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),`
4
4
  `]})},t))}),(0,c.jsx)(`textarea`,{ref:e=>{h.current=e,l&&(l.current=e)},"data-slot":`code-editor-input`,value:e,readOnly:i,onChange:e=>t?.(e.target.value),onScroll:g,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`,autoComplete:`off`,wrap:`off`,className:r(d,`relative block resize-none overflow-auto bg-transparent text-transparent caret-foreground outline-hidden`,`selection:bg-accent-strong/30 focus-visible:ring-0`,i&&`cursor-default`),...f})]})}export{f as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{a as r}from"./dist-BW234Kg5.js";import{a as i,i as a,n as o,r as s,t as c}from"./dist-C5mlVBmd.js";import{l,u}from"./es2015-CQth82uv.js";var d=e(t(),1),f=n(),p=`Collapsible`,[m,h]=a(p),[g,_]=m(p),v=d.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:a,disabled:o,onOpenChange:s,...u}=e,[m,h]=c({prop:r,defaultProp:a??!1,onChange:s,caller:p});return(0,f.jsx)(g,{scope:n,disabled:o,contentId:l(),open:m,onOpenToggle:d.useCallback(()=>h(e=>!e),[h]),children:(0,f.jsx)(i.div,{"data-state":w(m),"data-disabled":o?``:void 0,...u,ref:t})})});v.displayName=p;var y=`CollapsibleTrigger`,b=d.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,a=_(y,n);return(0,f.jsx)(i.button,{type:`button`,"aria-controls":a.open?a.contentId:void 0,"aria-expanded":a.open||!1,"data-state":w(a.open),"data-disabled":a.disabled?``:void 0,disabled:a.disabled,...r,ref:t,onClick:s(e.onClick,a.onOpenToggle)})});b.displayName=y;var x=`CollapsibleContent`,S=d.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=_(x,e.__scopeCollapsible);return(0,f.jsx)(u,{present:n||i.open,children:({present:e})=>(0,f.jsx)(C,{...r,ref:t,present:e})})});S.displayName=x;var C=d.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:a,children:s,...c}=e,l=_(x,n),[u,p]=d.useState(a),m=d.useRef(null),h=r(t,m),g=d.useRef(0),v=g.current,y=d.useRef(0),b=y.current,S=l.open||u,C=d.useRef(S),T=d.useRef(void 0);return d.useEffect(()=>{let e=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(e)},[]),o(()=>{let e=m.current;if(e){T.current=T.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();g.current=t.height,y.current=t.width,C.current||(e.style.transitionDuration=T.current.transitionDuration,e.style.animationName=T.current.animationName),p(a)}},[l.open,a]),(0,f.jsx)(i.div,{"data-state":w(l.open),"data-disabled":l.disabled?``:void 0,id:l.contentId,hidden:!S,...c,ref:h,style:{"--radix-collapsible-content-height":v?`${v}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...e.style},children:S&&s})});function w(e){return e?`open`:`closed`}var T=v;function E({...e}){return(0,f.jsx)(T,{"data-slot":`collapsible`,...e})}function D({...e}){return(0,f.jsx)(b,{"data-slot":`collapsible-trigger`,...e})}function O({...e}){return(0,f.jsx)(S,{"data-slot":`collapsible-content`,...e})}export{O as n,D as r,E as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{a as r}from"./dist-C_rn70hE.js";import{a as i,i as a,n as o,r as s,t as c}from"./dist-Tubgdd25.js";import{l,u}from"./es2015-DpKptHDx.js";var d=e(t(),1),f=n(),p=`Collapsible`,[m,h]=a(p),[g,_]=m(p),v=d.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:a,disabled:o,onOpenChange:s,...u}=e,[m,h]=c({prop:r,defaultProp:a??!1,onChange:s,caller:p});return(0,f.jsx)(g,{scope:n,disabled:o,contentId:l(),open:m,onOpenToggle:d.useCallback(()=>h(e=>!e),[h]),children:(0,f.jsx)(i.div,{"data-state":w(m),"data-disabled":o?``:void 0,...u,ref:t})})});v.displayName=p;var y=`CollapsibleTrigger`,b=d.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,a=_(y,n);return(0,f.jsx)(i.button,{type:`button`,"aria-controls":a.open?a.contentId:void 0,"aria-expanded":a.open||!1,"data-state":w(a.open),"data-disabled":a.disabled?``:void 0,disabled:a.disabled,...r,ref:t,onClick:s(e.onClick,a.onOpenToggle)})});b.displayName=y;var x=`CollapsibleContent`,S=d.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=_(x,e.__scopeCollapsible);return(0,f.jsx)(u,{present:n||i.open,children:({present:e})=>(0,f.jsx)(C,{...r,ref:t,present:e})})});S.displayName=x;var C=d.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:a,children:s,...c}=e,l=_(x,n),[u,p]=d.useState(a),m=d.useRef(null),h=r(t,m),g=d.useRef(0),v=g.current,y=d.useRef(0),b=y.current,S=l.open||u,C=d.useRef(S),T=d.useRef(void 0);return d.useEffect(()=>{let e=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(e)},[]),o(()=>{let e=m.current;if(e){T.current=T.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();g.current=t.height,y.current=t.width,C.current||(e.style.transitionDuration=T.current.transitionDuration,e.style.animationName=T.current.animationName),p(a)}},[l.open,a]),(0,f.jsx)(i.div,{"data-state":w(l.open),"data-disabled":l.disabled?``:void 0,id:l.contentId,hidden:!S,...c,ref:h,style:{"--radix-collapsible-content-height":v?`${v}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...e.style},children:S&&s})});function w(e){return e?`open`:`closed`}var T=v;function E({...e}){return(0,f.jsx)(T,{"data-slot":`collapsible`,...e})}function D({...e}){return(0,f.jsx)(b,{"data-slot":`collapsible-trigger`,...e})}function O({...e}){return(0,f.jsx)(S,{"data-slot":`collapsible-content`,...e})}export{O as n,D as r,E as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r,i,o as a}from"./dist-C_rn70hE.js";import{X as o}from"./design-icons-CzEoMH9c.js";import{a as s}from"./dist-Tubgdd25.js";import{l as c}from"./es2015-DpKptHDx.js";import{a as l,o as u,r as d,t as f}from"./dist-BS5vYfFC.js";import{i as p,o as m,r as h,s as g,t as _}from"./dialog-Dbu3HnqC.js";var v=e(t(),1),y=1,b=.9,x=.8,S=.17,C=.1,w=.999,T=.9999,E=.99,D=/[\\\/_+.#"@\[\(\{&]/,O=/[\\\/_+.#"@\[\(\{&]/g,k=/[\s-]/,A=/[\s-]/g;function j(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?y:E;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=j(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=y:D.test(e.charAt(l-1))?(d*=x,p=e.slice(i,l-1).match(O),p&&i>0&&(d*=w**+p.length)):k.test(e.charAt(l-1))?(d*=b,m=e.slice(i,l-1).match(A),m&&i>0&&(d*=w**+m.length)):(d*=S,i>0&&(d*=w**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=T)),(d<C&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=j(e,t,n,r,l+1,a+2,o),f*C>d&&(d=f*C)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function M(e){return e.toLowerCase().replace(A,` `)}function N(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,j(e,t,M(e),M(t),0,0,{})}var P=`[cmdk-group=""]`,F=`[cmdk-group-items=""]`,ee=`[cmdk-group-heading=""]`,I=`[cmdk-item=""]`,L=`${I}:not([aria-disabled="true"])`,R=`cmdk-item-select`,z=`data-value`,te=(e,t,n)=>N(e,t,n),ne=v.createContext(void 0),B=()=>v.useContext(ne),re=v.createContext(void 0),V=()=>v.useContext(re),H=v.createContext(void 0),U=v.forwardRef((e,t)=>{let n=X(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=X(()=>new Set),i=X(()=>new Map),a=X(()=>new Map),o=X(()=>new Set),l=J(e),{label:u,children:d,value:f,onValueChange:p,filter:m,shouldFilter:h,loop:g,disablePointerSelection:_=!1,vimBindings:y=!0,...b}=e,x=c(),S=c(),C=c(),w=v.useRef(null),T=fe();Y(()=>{if(f!==void 0){let e=f.trim();n.current.value=e,E.emit()}},[f]),Y(()=>{T(6,M)},[]);let E=v.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)j(),k(),T(1,A);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(C);e?e.focus():(i=document.getElementById(x))==null||i.focus()}if(T(7,()=>{n.current.selectedItemId=N()?.id,E.emit()}),r||T(5,M),l.current?.value!==void 0){let e=t??``;(o=(a=l.current).onValueChange)==null||o.call(a,e);return}}E.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),D=v.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,O(t,r)),T(2,()=>{k(),E.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),T(3,()=>{j(),k(),n.current.value||A(),E.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=N();T(4,()=>{j(),t?.getAttribute(`id`)===e&&A(),E.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>l.current.shouldFilter,label:u||e[`aria-label`],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:x,inputId:C,labelId:S,listInnerRef:w}),[]);function O(e,t){let r=l.current?.filter??te;return e?r(e,n.current.search,t):0}function k(){if(!n.current.search||l.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=w.current;B().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(F);t?t.appendChild(e.parentElement===t?e:e.closest(`${F} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${F} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=w.current?.querySelector(`${P}[${z}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function A(){let e=B().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(z);E.setState(`value`,e||void 0)}function j(){if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=O(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function M(){var e;let t=N();t&&(t.parentElement?.firstChild===t&&((e=t.closest(P)?.querySelector(ee))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function N(){return w.current?.querySelector(`${I}[aria-selected="true"]`)}function B(){return Array.from(w.current?.querySelectorAll(L)||[])}function V(e){let t=B()[e];t&&E.setState(`value`,t.getAttribute(z))}function H(e){var t;let n=N(),r=B(),i=r.findIndex(e=>e===n),a=r[i+e];(t=l.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&E.setState(`value`,a.getAttribute(z))}function U(e){let t=N()?.closest(P),n;for(;t&&!n;)t=e>0?le(t,P):ue(t,P),n=t?.querySelector(L);n?E.setState(`value`,n.getAttribute(z)):H(e)}let W=()=>V(B().length-1),G=e=>{e.preventDefault(),e.metaKey?W():e.altKey?U(1):H(1)},K=e=>{e.preventDefault(),e.metaKey?V(0):e.altKey?U(-1):H(-1)};return v.createElement(s.div,{ref:t,tabIndex:-1,...b,"cmdk-root":``,onKeyDown:e=>{var t;(t=b.onKeyDown)==null||t.call(b,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:y&&e.ctrlKey&&G(e);break;case`ArrowDown`:G(e);break;case`p`:case`k`:y&&e.ctrlKey&&K(e);break;case`ArrowUp`:K(e);break;case`Home`:e.preventDefault(),V(0);break;case`End`:e.preventDefault(),W();break;case`Enter`:{e.preventDefault();let t=N();if(t){let e=new Event(R);t.dispatchEvent(e)}}}}},v.createElement(`label`,{"cmdk-label":``,htmlFor:D.inputId,id:D.labelId,style:me},u),Q(e,e=>v.createElement(re.Provider,{value:E},v.createElement(ne.Provider,{value:D},e))))}),W=v.forwardRef((e,t)=>{let n=c(),r=v.useRef(null),a=v.useContext(H),o=B(),l=J(e),u=l.current?.forceMount??a?.forceMount;Y(()=>{if(!u)return o.item(n,a?.id)},[u]);let d=de(n,r,[e.value,e.children,r],e.keywords),f=V(),p=Z(e=>e.value&&e.value===d.current),m=Z(e=>u||o.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);v.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(R,h),()=>t.removeEventListener(R,h)},[m,e.onSelect,e.disabled]);function h(){var e,t;g(),(t=(e=l.current).onSelect)==null||t.call(e,d.current)}function g(){f.setState(`value`,d.current,!0)}if(!m)return null;let{disabled:_,value:y,onSelect:b,forceMount:x,keywords:S,...C}=e;return v.createElement(s.div,{ref:i(r,t),...C,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!_,"aria-selected":!!p,"data-disabled":!!_,"data-selected":!!p,onPointerMove:_||o.getDisablePointerSelection()?void 0:g,onClick:_?void 0:h},e.children)}),G=v.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:a,...o}=e,l=c(),u=v.useRef(null),d=v.useRef(null),f=c(),p=B(),m=Z(e=>a||p.filter()===!1?!0:!e.search||e.filtered.groups.has(l));Y(()=>p.group(l),[]),de(l,u,[e.value,e.heading,d]);let h=v.useMemo(()=>({id:l,forceMount:a}),[a]);return v.createElement(s.div,{ref:i(u,t),...o,"cmdk-group":``,role:`presentation`,hidden:!m||void 0},n&&v.createElement(`div`,{ref:d,"cmdk-group-heading":``,"aria-hidden":!0,id:f},n),Q(e,e=>v.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?f:void 0},v.createElement(H.Provider,{value:h},e))))}),K=v.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,a=v.useRef(null),o=Z(e=>!e.search);return!n&&!o?null:v.createElement(s.div,{ref:i(a,t),...r,"cmdk-separator":``,role:`separator`})}),ie=v.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=V(),o=Z(e=>e.search),c=Z(e=>e.selectedItemId),l=B();return v.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),v.createElement(s.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),ae=v.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...a}=e,o=v.useRef(null),c=v.useRef(null),l=Z(e=>e.selectedItemId),u=B();return v.useEffect(()=>{if(c.current&&o.current){let e=c.current,t=o.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),v.createElement(s.div,{ref:i(o,t),...a,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:u.listId},Q(e,e=>v.createElement(`div`,{ref:i(c,u.listInnerRef),"cmdk-list-sizer":``},e)))}),oe=v.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return v.createElement(f,{open:n,onOpenChange:r},v.createElement(u,{container:o},v.createElement(l,{"cmdk-overlay":``,className:i}),v.createElement(d,{"aria-label":e.label,"cmdk-dialog":``,className:a},v.createElement(U,{ref:t,...s}))))}),se=v.forwardRef((e,t)=>Z(e=>e.filtered.count===0)?v.createElement(s.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),ce=v.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return v.createElement(s.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Q(e,e=>v.createElement(`div`,{"aria-hidden":!0},e)))}),q=Object.assign(U,{List:ae,Item:W,Input:ie,Group:G,Separator:K,Dialog:oe,Empty:se,Loading:ce});function le(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function ue(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function J(e){let t=v.useRef(e);return Y(()=>{t.current=e}),t}var Y=typeof window>`u`?v.useEffect:v.useLayoutEffect;function X(e){let t=v.useRef();return t.current===void 0&&(t.current=e()),t}function Z(e){let t=V(),n=()=>e(t.snapshot());return v.useSyncExternalStore(t.subscribe,n,n)}function de(e,t,n,r=[]){let i=v.useRef(),a=B();return Y(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(z,s),i.current=s}),i}var fe=()=>{let[e,t]=v.useState(),n=X(()=>new Map);return Y(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function pe(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Q({asChild:e,children:t},n){return e&&v.isValidElement(t)?v.cloneElement(pe(t),{ref:t.ref},n(t.props.children)):n(t)}var me={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},$=n();function he({className:e,...t}){return(0,$.jsx)(q,{"data-slot":`command`,className:a(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function ge({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:i,showCloseButton:o=!0,filter:s,...c}){return(0,$.jsxs)(_,{...c,children:[(0,$.jsxs)(m,{className:`sr-only`,children:[(0,$.jsx)(g,{children:e}),(0,$.jsx)(p,{children:t})]}),(0,$.jsx)(h,{className:a(`overflow-hidden p-0`,i),showCloseButton:o,children:(0,$.jsx)(he,{...r({filter:s}),className:`**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n})})]})}function _e({className:e,...t}){return(0,$.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex min-h-11 shrink-0 items-center gap-2 rounded-ss-[inherit] rounded-se-[inherit] border-b px-3`,children:[(0,$.jsx)(o,{className:`size-4 shrink-0 opacity-50`}),(0,$.jsx)(q.Input,{"data-slot":`command-input`,className:a(`flex h-11 min-w-0 flex-1 rounded-md bg-transparent py-3 text-base md:text-sm placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]})}function ve({className:e,onPointerMoveCapture:t,...n}){return(0,$.jsx)(q.List,{"data-slot":`command-list`,onPointerMoveCapture:e=>{t?.(e),e.pointerType===`touch`&&e.stopPropagation()},className:a(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...n})}function ye({...e}){return(0,$.jsx)(q.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function be({className:e,...t}){return(0,$.jsx)(q.Group,{"data-slot":`command-group`,className:a(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function xe({className:e,...t}){return(0,$.jsx)(q.Separator,{"data-slot":`command-separator`,className:a(`-mx-1 h-px bg-border`,e),...t})}function Se({className:e,...t}){return(0,$.jsx)(q.Item,{"data-slot":`command-item`,className:a(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...t})}function Ce({className:e,...t}){return(0,$.jsx)(`span`,{"data-slot":`command-shortcut`,className:a(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}export{_e as a,xe as c,be as i,Ce as l,ge as n,Se as o,ye as r,ve as s,he as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{Fn as i}from"./toaster-Lf_4oY96.js";import{X as a,j as o,ot as s,r as c}from"./design-icons-CzEoMH9c.js";import{n as l}from"./diff-controls-QeCV3Sy1.js";import{l as u}from"./reference-chip-hn8jj_Mo.js";import{t as d}from"./button-C8jUIs8Q.js";import{t as f}from"./project-router-CEnizJ8F.js";import{t as p}from"./centered-state-BgSV4e79.js";import{Bt as m,Pn as h,Qn as g,Qt as _,Vt as v,jn as y,s as b}from"./index-B0_haEFL.js";import{t as x}from"./diff-DDjPsaQ6.js";var S=e(t(),1),C=n();function w({commit:e,sha:t,backTo:n,backLabel:r,slot:a,className:g,diffClassName:v}){let b=_(),[w,T]=(0,S.useState)(`unified`),[E,D]=(0,S.useState)(!0),O=e.isError&&e.error instanceof i&&e.error.status===409,k=b?w:`unified`;return(0,C.jsxs)(`section`,{"data-slot":a,"data-sha":t,className:g,children:[(0,C.jsxs)(`div`,{className:`mx-4 flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border py-2 md:mx-9`,children:[(0,C.jsx)(d,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,C.jsxs)(f,{to:n,children:[(0,C.jsx)(c,{size:16,"aria-hidden":`true`}),r]})}),(0,C.jsx)(`span`,{className:`ml-auto flex items-center gap-1`,children:(0,C.jsx)(l,{mode:w,wrap:E,onModeChange:T,onWrapChange:D})})]}),e.isPending?(0,C.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-muted-foreground md:px-9`,children:`Loading commit…`}):e.isError?(0,C.jsx)(p,{icon:O?(0,C.jsx)(u,{}):(0,C.jsx)(s,{size:16}),tone:O?`neutral`:`danger`,heading:`h2`,title:O?`Commit not found`:`Could not load the commit`,subtitle:e.error.message}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{"data-slot":`commit-meta`,className:`mx-4 border-b border-border py-3 md:mx-9`,children:[(0,C.jsx)(`h2`,{className:`text-sm font-semibold`,children:e.data.subject}),(0,C.jsxs)(`p`,{className:`mt-0.5 flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,C.jsx)(`span`,{children:e.data.author}),(0,C.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,C.jsx)(`span`,{title:e.data.when,children:m(e.data.when)}),(0,C.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,C.jsx)(h,{sha:e.data.sha,variant:`inline`}),(0,C.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,C.jsx)(`span`,{"data-slot":`commit-stat`,children:(0,C.jsx)(y,{stat:e.data.stat})})]})]}),e.data.files.length===0?(0,C.jsx)(p,{icon:(0,C.jsx)(o,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,C.jsx)(`div`,{className:v,children:(0,C.jsx)(x,{files:e.data.files,mode:k,wrap:E,totals:!1,className:`min-w-0`})})]})]})}var T=56;function E({slot:e,commits:t,selectedSha:n,className:i,heading:o}){let[s,c]=(0,S.useState)(``),l=s.trim().toLowerCase(),u=l?t.filter(e=>e.subject.toLowerCase().includes(l)):t,d=u.length>150,f=(0,S.useRef)(null),p=(0,S.useRef)(null),[m,h]=(0,S.useState)(0);(0,S.useLayoutEffect)(()=>{if(!d)return;let e=()=>{let e=f.current,t=p.current;!e||!t||h(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[d]);let _=u.map(e=>(0,C.jsx)(D,{commit:e,selected:n!==void 0&&e.sha===n},e.sha));return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`label`,{className:`relative mb-3 block`,children:[(0,C.jsx)(a,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3 left-3 size-4 text-muted-foreground`}),(0,C.jsx)(g,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:s,onChange:e=>c(e.target.value),className:`h-10 rounded-lg border-border bg-card pl-10`})]}),(0,C.jsxs)(`div`,{ref:e=>{f.current=e,e&&(p.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":d,className:r(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-3 py-1 md:px-4`,i),children:[o?(0,C.jsx)(`div`,{className:`flex min-h-11 flex-wrap items-center gap-2 py-2.5`,children:o}):null,u.length===0?(0,C.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,d?(0,C.jsx)(b,{scrollRef:p,startMargin:m,itemSize:T,children:_}):_]})]})}function D({commit:e,selected:t}){return(0,C.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_56px] [content-visibility:auto]`,children:(0,C.jsxs)(f,{"data-slot":`commit-row`,"data-sha":e.sha,"data-selected":t?`true`:void 0,"aria-current":t?`true`:void 0,to:e.href,className:r(`flex min-h-11 min-w-0 items-start gap-2.5 rounded-md px-2 py-2.5 transition-colors hover:bg-muted`,t&&`bg-muted/70`),children:[(0,C.jsx)(o,{size:16,"aria-hidden":`true`,className:`mt-px size-4 shrink-0 text-accent-text`}),(0,C.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`span`,{"data-slot":`commit-row-subject`,title:e.subject,className:`line-clamp-2 text-[13px] leading-snug font-medium break-words text-foreground`,children:e.subject}),(0,C.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,C.jsx)(O,{sha:e.sha}),(0,C.jsxs)(`span`,{className:`min-w-0 truncate`,children:[e.author,` · `,(0,C.jsx)(`span`,{title:v(e.when,e.at),children:m(e.when,e.at)})]}),e.stat?(0,C.jsx)(y,{stat:e.stat}):null]})]})]})})}function O({sha:e}){return(0,C.jsx)(h,{"data-slot":`commit-sha`,sha:e,variant:`chip`})}export{O as n,w as r,E as t};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{o as n}from"./dist-C_rn70hE.js";import{ft as r}from"./design-icons-CzEoMH9c.js";import{t as i}from"./button-C8jUIs8Q.js";import{a,i as o,n as s,o as c,r as l,s as u,t as d}from"./dist-BS5vYfFC.js";e();var f=t();function p({...e}){return(0,f.jsx)(d,{"data-slot":`dialog`,...e})}function m({...e}){return(0,f.jsx)(c,{"data-slot":`dialog-portal`,...e})}function h({className:e,...t}){return(0,f.jsx)(a,{"data-slot":`dialog-overlay`,className:n(`fixed inset-0 z-50 bg-black/50 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function g({className:e,children:t,showCloseButton:i=!0,overlayClassName:a,...o}){return(0,f.jsxs)(m,{"data-slot":`dialog-portal`,children:[(0,f.jsx)(h,{className:a}),(0,f.jsxs)(l,{"data-slot":`dialog-content`,className:n(`fixed inset-bs-[50%] start-[50%] z-50 grid max-h-[calc(100dvh-2rem)] overflow-y-auto overscroll-contain w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-hidden motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...o,children:[t,i&&(0,f.jsxs)(s,{"data-slot":`dialog-close`,className:`absolute inset-bs-4 end-4 rounded-sm opacity-70 ring-offset-background transition-opacity pointer-hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,f.jsx)(r,{}),(0,f.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function _({className:e,...t}){return(0,f.jsx)(`div`,{"data-slot":`dialog-header`,className:n(`flex shrink-0 flex-col gap-2 text-center sm:text-start`,e),...t})}function v({className:e,...t}){return(0,f.jsx)(`div`,{"data-slot":`dialog-body`,className:n(`min-h-0 min-w-0 overflow-y-auto overscroll-contain`,e),...t})}function y({className:e,showCloseButton:t=!1,children:r,...a}){return(0,f.jsxs)(`div`,{"data-slot":`dialog-footer`,className:n(`flex shrink-0 flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...a,children:[r,t&&(0,f.jsx)(s,{asChild:!0,children:(0,f.jsx)(i,{variant:`outline`,children:`Close`})})]})}function b({className:e,...t}){return(0,f.jsx)(u,{"data-slot":`dialog-title`,className:n(`text-lg leading-none font-semibold`,e),...t})}function x({className:e,...t}){return(0,f.jsx)(o,{"data-slot":`dialog-description`,className:n(`text-sm text-muted-foreground`,e),...t})}export{y as a,x as i,v as n,_ as o,g as r,b as s,p as t};
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-Bv9YauBT.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/dist-C_rn70hE.js","assets/bundle-mjs-rHxsej31.js","assets/chevron-right-BENZ-1ZN.js","assets/createLucideIcon-BHp8sXmF.js","assets/eye-B8okNWXU.js","assets/diff-stat-Dy4uLuyP.js","assets/index-B0_haEFL.js","assets/queries-ByqTmyCs.js","assets/toaster-Lf_4oY96.js","assets/live-protocol-DMhTnCmf.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-Cg8l-LDN.js","assets/label-eNfbfYFG.js","assets/cez-idle-CdswdDRd.js","assets/run-detail-refresh-BJ4laDVB.js","assets/dist-Tubgdd25.js","assets/tasks-table-DtLW8U-4.js","assets/attention-CnhIF76m.js","assets/task-groups-BRrlyl5P.js","assets/design-icons-CzEoMH9c.js","assets/open-in-menu-CSbpfQy7.js","assets/bot-TkDIw4y-.js","assets/external-link-BE6y205O.js","assets/folder-o-AvL3y3.js","assets/smartphone-Lr8Ug2z_.js","assets/square-terminal-B6RYYieR.js","assets/button-C8jUIs8Q.js","assets/dropdown-menu-BaqO-x7U.js","assets/dist-VPUfzsfL.js","assets/es2015-DpKptHDx.js","assets/dist-DDhqweuB.js","assets/dist-CtdIjNlG.js","assets/own-lookup-DS54wXvD.js","assets/check-OP-CVgZG.js","assets/chevron-down-CHGyCDBH.js","assets/nav-row-styles-CgP5uNp4.js","assets/folder-browser-CK1mNIQi.js","assets/loader-circle-CPBhhDbB.js","assets/play-CmVAj_fu.js","assets/reference-chip-hn8jj_Mo.js","assets/popover-CVo54-aS.js","assets/dist-BS5vYfFC.js","assets/switch-DfPCm1H_.js","assets/dist-Czz3Y5qH.js","assets/badge-B6B-xYQQ.js","assets/dialog-Dbu3HnqC.js","assets/project-router-CEnizJ8F.js","assets/status-dot-BXf-Ubd0.js","assets/report-selection-BkBJw-sm.js","assets/use-search-params-writer-ClMScnNe.js","assets/format-BU7D3IfE.js","assets/command-DuxcX6Hr.js","assets/project-order-AcHI4Dcl.js","assets/skills-pM_PouEs.js","assets/agents-settings-path-7X6_cvUg.js","assets/page-shell-CpdYMj52.js","assets/page-shell-DQPYcKyL.css","assets/centered-state-BgSV4e79.js","assets/index-D0mx-XUg.css","assets/highlighter-Cfo7mLVB.js","assets/image-preview-CeEKI2T5.js","assets/zoomable-image-BUTgYpld.js","assets/markdown-BBDDg-4t.js","assets/markdown-Djjm7pRl.js","assets/chunk-BO2N2NFS-DQrpGzb-.js","assets/lib-DrPFkMXk.js","assets/html-report-BX3msvci.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{t as a}from"./diff-stat-Dy4uLuyP.js";import{n as o,r as s,t as c}from"./image-preview-CeEKI2T5.js";var l=e(t(),1),u=n();function d(e){let[t,n]=(0,l.useState)(null);return(0,l.useEffect)(()=>{let e=!1;return i(()=>import(`./diff-view-Bv9YauBT.js`).then(t=>{e||n({View:t.DiffView})},()=>{e||n(`failed`)}),__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,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69])),()=>{e=!0}},[]),e.files.length===0?(0,u.jsx)(`p`,{"data-slot":`diff-empty`,className:r(`px-1 text-xs text-muted-foreground`,e.className),children:`No changes.`}):t===`failed`?(0,u.jsx)(f,{...e}):t===null?(0,u.jsx)(`p`,{"data-slot":`diff-loading`,className:r(`px-1 text-xs text-muted-foreground`,e.className),children:`Loading diff…`}):(0,u.jsx)(t.View,{...e})}function f({files:e,wrap:t=!1,imageSrc:n,onOpenInApp:i,viewRef:a,totals:o=!0,actions:c,className:d}){let f={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},m=(0,l.useRef)(null);return(0,l.useImperativeHandle)(a,()=>({scrollToPath:e=>{for(let t of m.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,u.jsxs)(`div`,{ref:m,"data-slot":`diff`,"data-fallback":`true`,className:r(`flex min-w-0 flex-col gap-3`,d),children:[(0,u.jsxs)(`div`,{"data-slot":`diff-header`,hidden:!o&&!c,className:`flex min-h-9 flex-wrap items-center gap-x-2 gap-y-1.5 px-1`,children:[(0,u.jsx)(s,{stat:f,hidden:!o}),c?(0,u.jsx)(`div`,{"data-slot":`diff-actions`,className:`ms-auto flex items-center gap-1.5`,children:c}):null]}),e.map(e=>(0,u.jsx)(p,{file:e,wrap:t,imageSrc:n,onOpenInApp:i},`${e.oldPath??``}→${e.path}`))]})}function p({file:e,wrap:t,imageSrc:n,onOpenInApp:i}){let s=e.oldPath?`${e.oldPath} → ${e.path}`:e.path;return(0,u.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,u.jsxs)(`header`,{className:`flex items-start gap-2 border-b border-border px-3 py-2`,children:[(0,u.jsx)(`span`,{"data-slot":`diff-file-path`,title:s,className:`min-w-0 wrap-anywhere font-mono text-xs font-medium`,children:s}),(0,u.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,u.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-xs`})})]}),o(e)?(0,u.jsx)(c,{file:e,imageSrc:n,onOpenInApp:i}):e.binary?(0,u.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-muted-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,u.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-muted-foreground`,children:`No content changes (metadata only).`}):(0,u.jsx)(`pre`,{className:r(`py-2 font-mono text-xs leading-[1.7]`,t?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
3
+ `).map((e,t)=>(0,u.jsxs)(`span`,{className:r(`block px-4`,e.startsWith(`+`)&&!e.startsWith(`+++`)&&`bg-diff-add`,e.startsWith(`-`)&&!e.startsWith(`---`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-muted-foreground`),children:[e,e===``?` `:``]},t))})]})}export{d as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{o as t}from"./dist-C_rn70hE.js";import{A as n,_ as r}from"./design-icons-CzEoMH9c.js";import{t as i}from"./createLucideIcon-BHp8sXmF.js";import{t as a}from"./button-C8jUIs8Q.js";import{sr as o}from"./index-B0_haEFL.js";var s=i(`rows-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}]]),c=i(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),l=e();function u({mode:e,wrap:t,onModeChange:n,onWrapChange:r,disabled:i=!1}){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`span`,{"data-slot":`diff-mode-toggle`,role:`group`,"aria-label":`Diff layout`,className:`inline-flex items-center rounded-lg border border-border bg-card p-0.5 max-md:hidden`,children:[(0,l.jsx)(h,{current:e,value:`unified`,onModeChange:n,disabled:i}),(0,l.jsx)(h,{current:e,value:`split`,onModeChange:n,disabled:i})]}),(0,l.jsx)(p,{wrap:t,onWrapChange:r,disabled:i})]})}var d=`Unavailable while Markdown preview is on`;function f(){return(0,l.jsx)(`span`,{"data-slot":`markdown-preview-hint`,role:`status`,className:`text-xs text-muted-foreground max-sm:sr-only`,children:`Full-document preview — layout and wrap are off`})}function p({wrap:e,onWrapChange:n,className:r=`size-11 rounded-lg`,disabled:i=!1}){return(0,l.jsx)(a,{variant:`outline`,size:`icon-sm`,"data-slot":`wrap-toggle`,"aria-pressed":e,"aria-label":`Wrap long lines`,title:i?d:`Wrap long lines`,disabled:i,className:t(r,e?`border-accent-text/40 bg-muted text-accent-text`:`text-muted-foreground hover:text-foreground`),onClick:()=>n(!e),children:(0,l.jsx)(c,{"aria-hidden":`true`})})}function m({preview:e,onPreviewChange:n}){return(0,l.jsxs)(a,{variant:`outline`,size:`sm`,"data-slot":`markdown-preview-toggle`,"aria-pressed":e,"aria-label":`Preview Markdown`,title:e?`Show Markdown as a diff`:`Preview Markdown`,className:t(`h-11 min-w-11 gap-1.5 rounded-lg px-0 text-xs font-medium sm:px-3`,e?`border-accent-text/40 bg-muted text-accent-text`:`text-muted-foreground hover:text-foreground`),onClick:()=>n(!e),children:[(0,l.jsx)(o,{"aria-hidden":`true`,className:`size-4`}),(0,l.jsx)(`span`,{"aria-hidden":`true`,className:`max-sm:hidden`,children:`Preview MD`})]})}function h({current:e,value:n,onModeChange:i,disabled:a}){let o=e===n;return(0,l.jsxs)(`button`,{type:`button`,"data-mode":n,"aria-pressed":o,disabled:a,title:a?d:void 0,onClick:()=>i(n),className:t(`inline-flex min-h-11 items-center gap-1.5 rounded-md px-3 text-xs font-medium capitalize transition-colors outline-hidden focus-visible:ring-2 focus-visible:ring-ring/50 disabled:opacity-50`,o?`bg-muted text-foreground`:`text-muted-foreground pointer-hover:text-foreground`),children:[n===`unified`?(0,l.jsx)(s,{"aria-hidden":`true`,className:`size-4`}):(0,l.jsx)(r,{size:16,"aria-hidden":`true`,className:`size-4`}),n]})}function g({branch:e}){return(0,l.jsxs)(`span`,{"data-slot":`branch-chip`,className:`flex min-w-0 items-center gap-1 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-xs font-medium`,children:[(0,l.jsx)(n,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,l.jsx)(`span`,{className:`truncate`,children:e})]})}export{p as a,m as i,u as n,f as r,g as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{o as t}from"./dist-C_rn70hE.js";var n=e();function r(e){if(e<1e3)return String(e);let t=[`k`,`M`,`B`,`T`],n=Math.floor(Math.log10(e)/3);return n>t.length?e.toExponential(0).replace(`+`,``):`${Math.floor(e/1e3**n)}${t[n-1]}`}function i({stat:e,className:i,compact:a=!1}){let o=`+${e.adds} −${e.dels} across ${e.files} ${e.files===1?`file`:`files`}`,s=e.repointed?`${o} — measured against another branch checked out in this task's worktree, as this task found it`:void 0;return(0,n.jsxs)(`span`,{"data-slot":`diff-stat`,...s?{"data-repointed":`true`,"aria-label":s}:{},...a&&!s?{"aria-label":o}:{},title:s??o,className:t(`font-mono! text-xs font-semibold tabular-nums`,e.repointed&&`cursor-help underline decoration-dotted underline-offset-2`,i),children:[e.adds===0&&e.dels===0?(0,n.jsx)(`span`,{"data-zero":!0,className:`text-muted-foreground`,children:`—`}):null,e.adds>0?(0,n.jsxs)(`span`,{className:`text-semantic-green`,children:[`+`,a?r(e.adds):e.adds.toLocaleString(`en-US`)]}):null,e.adds>0&&e.dels>0?` `:null,e.dels>0?(0,n.jsxs)(`span`,{className:`text-semantic-red`,children:[`−`,a?r(e.dels):e.dels.toLocaleString(`en-US`)]}):null]})}export{i as t};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{t as i}from"./chevron-right-BENZ-1ZN.js";import{t as a}from"./eye-B8okNWXU.js";import{t as o}from"./diff-stat-C7KB1kDX.js";import{s}from"./index-_LohQUeF.js";import{a as c,i as l,r as u}from"./highlighter-DvLzHjjY.js";import{n as d,r as f,t as p}from"./image-preview-DCUeM8u3.js";import{n as m,t as h}from"./markdown-BBDDg-4t.js";import{t as g}from"./markdown-DJkMnwyc.js";var _=e(t(),1),v=44;function y(e){if(e.binary===!0||e.patch===``)return 1;let t=e.patch.split(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{t as i}from"./chevron-right-BENZ-1ZN.js";import{t as a}from"./eye-B8okNWXU.js";import{t as o}from"./diff-stat-Dy4uLuyP.js";import{s}from"./index-B0_haEFL.js";import{a as c,i as l,r as u}from"./highlighter-Cfo7mLVB.js";import{n as d,r as f,t as p}from"./image-preview-CeEKI2T5.js";import{n as m,t as h}from"./markdown-BBDDg-4t.js";import{t as g}from"./markdown-Djjm7pRl.js";var _=e(t(),1),v=44;function y(e){if(e.binary===!0||e.patch===``)return 1;let t=e.patch.split(`
2
2
  `),n=t.findIndex(e=>e.startsWith(`@@`));return n===-1?t.length:t.length-n}function b(e){return y(e)*20+v}function x(e){return e.reduce((e,t)=>e+y(t),0)}function S(e,t){let n=new URLSearchParams(e).get(`diff`);return n===`flat`||n===`virtual`?n:t>1500?`virtual`:`flat`}function C(e){return`${e.oldPath??``}→${e.path}`}function w(e){let t=0;for(let n of e.split(`
3
3
  `))n.length>t&&(t=n.length);return t}var T=/[A-Za-z0-9_]+|\s+|[^\sA-Za-z0-9_]+/g,E=300,D=.3;function O(e,t){if(e===t)return null;let n=e.match(T)??[],r=t.match(T)??[];if(n.length===0||r.length===0||n.length>E||r.length>E)return null;let i=k(n,r),a=r.length+1;return(i[n.length*a+r.length]??0)/Math.max(n.length,r.length)<D?null:A(n,r,i)}function k(e,t){let n=t.length+1,r=new Uint16Array((e.length+1)*n);for(let i=1;i<=e.length;i++)for(let a=1;a<=t.length;a++)r[i*n+a]=e[i-1]===t[a-1]?(r[(i-1)*n+(a-1)]??0)+1:Math.max(r[(i-1)*n+a]??0,r[i*n+(a-1)]??0);return r}function A(e,t,n){let r=t.length+1,i=Array.from({length:e.length},()=>!1),a=Array.from({length:t.length},()=>!1),o=e.length,s=t.length;for(;o>0&&s>0;)e[o-1]===t[s-1]?(i[o-1]=!0,a[s-1]=!0,o--,s--):(n[(o-1)*r+s]??0)>=(n[o*r+(s-1)]??0)?o--:s--;return{del:j(e,i),add:j(t,a)}}function j(e,t){let n=[];return e.forEach((e,r)=>{let i=!(t[r]??!1),a=n[n.length-1];a&&a.changed===i?a.text+=e:n.push({text:e,changed:i})}),n}function M(e,t,n){if(!t||t.length===0)return e?e.map(e=>({text:e.content,color:e.color,changed:!1})):n===``?[]:[{text:n,changed:!1}];if(!e||e.length===0)return t.map(e=>({text:e.text,changed:e.changed}));let r=[],i=0,a=0,o=0,s=0;for(;i<e.length&&o<t.length;){let n=e[i],c=t[o],l=n.content.length-a,u=c.text.length-s,d=Math.min(l,u);d>0&&(r.push({text:n.content.slice(a,a+d),color:n.color,changed:c.changed}),a+=d,s+=d),n.content.length-a<=0&&(i++,a=0),c.text.length-s<=0&&(o++,s=0)}for(;i<e.length;){let t=e[i],n=t.content.slice(a);n!==``&&r.push({text:n,color:t.color,changed:!1}),i++,a=0}return r}var N=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,P=`… (patch truncated)`;function F(e){let t=[],n=!1,r=null,i=0,a=0,o=e.split(`
4
4
  `);o.at(-1)===``&&o.pop();for(let e of o){let o=N.exec(e);if(o){r={header:e,oldStart:Number(o[1]),oldCount:o[2]===void 0?1:Number(o[2]),newStart:Number(o[3]),newCount:o[4]===void 0?1:Number(o[4]),lines:[]},i=r.oldStart,a=r.newStart,t.push(r);continue}if(e.includes(P)){n=!0,r=null;continue}r&&(e.startsWith(`+`)?r.lines.push({kind:`add`,text:e.slice(1),newLine:a++}):e.startsWith(`-`)?r.lines.push({kind:`del`,text:e.slice(1),oldLine:i++}):e.startsWith(`\\`)||r.lines.push({kind:`context`,text:e.slice(1),oldLine:i++,newLine:a++}))}return{hunks:t,truncated:n}}function I(e,t=!1){let n=[],r=e[0];if(!r)return n;r.newStart>1&&n.push({beforeHunk:0,count:r.newStart-1,oldStart:1,newStart:1});for(let t=1;t<e.length;t++){let r=e[t-1],i=e[t],a=r.oldStart+r.oldCount,o=r.newStart+r.newCount,s=i.newStart-o;s>0&&n.push({beforeHunk:t,count:s,oldStart:a,newStart:o})}if(t){let t=e[e.length-1];n.push({beforeHunk:e.length,oldStart:t.oldStart+t.oldCount,newStart:t.newStart+t.newCount})}return n}function L(e,t){let n=e.count===void 0?t.length:e.newStart+e.count-1,r=e.oldStart-e.newStart,i=[];for(let a=e.newStart;a<=Math.min(n,t.length);a++)i.push({kind:`context`,text:t[a-1]??``,oldLine:a+r,newLine:a});return i}function R(e,t){let n=Array.from({length:e.length}),r=Array.from({length:t.length}),i=Math.min(e.length,t.length);for(let a=0;a<i;a++){let i=O(e[a].text,t[a].text);i&&(n[a]=i.del,r[a]=i.add)}return{dels:e,adds:t,delSpans:n,addSpans:r}}function z(e,t,n){let r=0;for(;r<e.lines.length;){let i=e.lines[r];if(i.kind===`del`||i.kind===`add`){let t=[],i=[];for(;r<e.lines.length&&e.lines[r].kind===`del`;)t.push(e.lines[r++]);for(;r<e.lines.length&&e.lines[r].kind===`add`;)i.push(e.lines[r++]);n(R(t,i))}else t(i),r++}}function B(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`line`,cell:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),z(e,e=>i.push({type:`line`,cell:{line:e}}),e=>{e.dels.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.delSpans[n]}})),e.adds.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.addSpans[n]}}))})}),a(e.length),i}function V(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`pair`,left:{line:e},right:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),z(e,e=>i.push({type:`pair`,left:{line:e},right:{line:e}}),e=>{let t=Math.max(e.dels.length,e.adds.length);for(let n=0;n<t;n++){let t=e.dels[n],r=e.adds[n];i.push({type:`pair`,...t?{left:{line:t,spans:e.delSpans[n]}}:{},...r?{right:{line:r,spans:e.addSpans[n]}}:{}})}})}),a(e.length),i}var H=n();function U({file:e,loadFileText:t,imageSrc:n}){let r=(0,_.useMemo)(()=>W(e),[e]),i=(0,_.useRef)(t);i.current=t;let a=(0,_.useRef)(n);a.current=n;let o=t!==void 0,[s,c]=(0,_.useState)(null);(0,_.useEffect)(()=>{let t=i.current;if(!t)return;let n=!1;return t(e.path).then(t=>!n&&c({path:e.path,text:t}),()=>!n&&c({path:e.path,text:null})),()=>{n=!0}},[e.path,e.patch,o]);let l=(0,_.useCallback)(t=>{let n=a.current,r=n?m(e.path,t):null;return r===null||!n?null:n(r)},[e.path]),u=s?.path===e.path?s:null;if(o&&u===null)return(0,H.jsx)(`p`,{role:`status`,className:`px-4 py-2.5 text-xs text-muted-foreground`,children:`Loading preview…`});let d=u?.text??null;if(d===null&&r.text===``)return(0,H.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-muted-foreground`,children:`No content changes to preview.`});let f=d!==null||r.complete?null:o?`The full file could not be loaded. Showing the changed sections only.`:`Showing the changed sections only.`;return(0,H.jsx)(`div`,{"data-slot":`diff-markdown-preview`,className:`px-4 py-5 md:px-6`,children:(0,H.jsxs)(`div`,{className:`mx-auto max-w-[72ch]`,children:[f?(0,H.jsx)(`p`,{className:`mb-4 text-xs text-muted-foreground`,children:f}):null,(0,H.jsx)(g,{document:!0,imageSrc:l,children:d??r.text})]})})}function W(e){let t=F(e.patch);return{text:t.hunks.map(e=>e.lines.filter(e=>e.kind!==`del`).map(e=>e.text).join(`
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{a as r,n as i}from"./dist-BW234Kg5.js";import{a,i as o,r as s,t as c}from"./dist-C5mlVBmd.js";import{a as l,i as u,l as d,n as f,o as p,r as m,s as h,t as g,u as _}from"./es2015-CQth82uv.js";var v=e(t(),1),y=n(),b=`Dialog`,[x,S]=o(b),[C,w]=x(b),T=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=v.useRef(null),l=v.useRef(null),[u,f]=c({prop:r,defaultProp:i??!1,onChange:a,caller:b});return(0,y.jsx)(C,{scope:t,triggerRef:s,contentRef:l,contentId:d(),titleId:d(),descriptionId:d(),open:u,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(e=>!e),[f]),modal:o,children:n})};T.displayName=b;var E=`DialogTrigger`,D=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,o=w(E,n),c=r(t,o.triggerRef);return(0,y.jsx)(a.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":q(o.open),...i,ref:c,onClick:s(e.onClick,o.onOpenToggle)})});D.displayName=E;var O=`DialogPortal`,[k,A]=x(O,{forceMount:void 0}),j=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=w(O,t);return(0,y.jsx)(k,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,y.jsx)(_,{present:n||a.open,children:(0,y.jsx)(u,{asChild:!0,container:i,children:e})}))})};j.displayName=O;var M=`DialogOverlay`,N=v.forwardRef((e,t)=>{let n=A(M,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(M,e.__scopeDialog);return a.modal?(0,y.jsx)(_,{present:r||a.open,children:(0,y.jsx)(F,{...i,ref:t})}):null});N.displayName=M;var P=i(`DialogOverlay.RemoveScroll`),F=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,o=w(M,n),s=r(t,h());return(0,y.jsx)(f,{as:P,allowPinchZoom:!0,shards:[o.contentRef],children:(0,y.jsx)(a.div,{"data-state":q(o.open),...i,ref:s,style:{pointerEvents:`auto`,...i.style}})})}),I=`DialogContent`,L=v.forwardRef((e,t)=>{let n=A(I,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(I,e.__scopeDialog);return(0,y.jsx)(_,{present:r||a.open,children:a.modal?(0,y.jsx)(R,{...i,ref:t}):(0,y.jsx)(z,{...i,ref:t})})});L.displayName=I;var R=v.forwardRef((e,t)=>{let n=w(I,e.__scopeDialog),i=v.useRef(null),a=r(t,n.contentRef,i);return v.useEffect(()=>{let e=i.current;if(e)return g(e)},[]),(0,y.jsx)(B,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:s(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:s(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:s(e.onFocusOutside,e=>e.preventDefault())})}),z=v.forwardRef((e,t)=>{let n=w(I,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,y.jsx)(B,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),B=v.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=w(I,n);return m(),(0,y.jsx)(y.Fragment,{children:(0,y.jsx)(l,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,y.jsx)(p,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":q(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})}),V=`DialogTitle`,H=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(V,n);return(0,y.jsx)(a.h2,{id:i.titleId,...r,ref:t})});H.displayName=V;var U=`DialogDescription`,W=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(U,n);return(0,y.jsx)(a.p,{id:i.descriptionId,...r,ref:t})});W.displayName=U;var G=`DialogClose`,K=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(G,n);return(0,y.jsx)(a.button,{type:`button`,...r,ref:t,onClick:s(e.onClick,()=>i.onOpenChange(!1))})});K.displayName=G;function q(e){return e?`open`:`closed`}export{N as a,D as c,W as i,S as l,K as n,j as o,L as r,H as s,T as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{a as r,n as i}from"./dist-C_rn70hE.js";import{a,i as o,r as s,t as c}from"./dist-Tubgdd25.js";import{a as l,i as u,l as d,n as f,o as p,r as m,s as h,t as g,u as _}from"./es2015-DpKptHDx.js";var v=e(t(),1),y=n(),b=`Dialog`,[x,S]=o(b),[C,w]=x(b),T=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=v.useRef(null),l=v.useRef(null),[u,f]=c({prop:r,defaultProp:i??!1,onChange:a,caller:b});return(0,y.jsx)(C,{scope:t,triggerRef:s,contentRef:l,contentId:d(),titleId:d(),descriptionId:d(),open:u,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(e=>!e),[f]),modal:o,children:n})};T.displayName=b;var E=`DialogTrigger`,D=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,o=w(E,n),c=r(t,o.triggerRef);return(0,y.jsx)(a.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":q(o.open),...i,ref:c,onClick:s(e.onClick,o.onOpenToggle)})});D.displayName=E;var O=`DialogPortal`,[k,A]=x(O,{forceMount:void 0}),j=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=w(O,t);return(0,y.jsx)(k,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,y.jsx)(_,{present:n||a.open,children:(0,y.jsx)(u,{asChild:!0,container:i,children:e})}))})};j.displayName=O;var M=`DialogOverlay`,N=v.forwardRef((e,t)=>{let n=A(M,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(M,e.__scopeDialog);return a.modal?(0,y.jsx)(_,{present:r||a.open,children:(0,y.jsx)(F,{...i,ref:t})}):null});N.displayName=M;var P=i(`DialogOverlay.RemoveScroll`),F=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,o=w(M,n),s=r(t,h());return(0,y.jsx)(f,{as:P,allowPinchZoom:!0,shards:[o.contentRef],children:(0,y.jsx)(a.div,{"data-state":q(o.open),...i,ref:s,style:{pointerEvents:`auto`,...i.style}})})}),I=`DialogContent`,L=v.forwardRef((e,t)=>{let n=A(I,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(I,e.__scopeDialog);return(0,y.jsx)(_,{present:r||a.open,children:a.modal?(0,y.jsx)(R,{...i,ref:t}):(0,y.jsx)(z,{...i,ref:t})})});L.displayName=I;var R=v.forwardRef((e,t)=>{let n=w(I,e.__scopeDialog),i=v.useRef(null),a=r(t,n.contentRef,i);return v.useEffect(()=>{let e=i.current;if(e)return g(e)},[]),(0,y.jsx)(B,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:s(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:s(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:s(e.onFocusOutside,e=>e.preventDefault())})}),z=v.forwardRef((e,t)=>{let n=w(I,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,y.jsx)(B,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),B=v.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=w(I,n);return m(),(0,y.jsx)(y.Fragment,{children:(0,y.jsx)(l,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,y.jsx)(p,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":q(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})}),V=`DialogTitle`,H=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(V,n);return(0,y.jsx)(a.h2,{id:i.titleId,...r,ref:t})});H.displayName=V;var U=`DialogDescription`,W=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(U,n);return(0,y.jsx)(a.p,{id:i.descriptionId,...r,ref:t})});W.displayName=U;var G=`DialogClose`,K=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(G,n);return(0,y.jsx)(a.button,{type:`button`,...r,ref:t,onClick:s(e.onClick,()=>i.onOpenChange(!1))})});K.displayName=G;function q(e){return e?`open`:`closed`}export{N as a,D as c,W as i,S as l,K as n,j as o,L as r,H as s,T as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{r as n,t as r}from"./bundle-mjs-rHxsej31.js";var i=`/api/v1`,a=``;function o(e){a=e.replace(/\/+$/,``)}function s(){return a}var c=null;function l(e){c=e===``?null:e}function u(){return c}function d(){return c??`default`}var f=/^\/(?:health$|models(?:$|[/?])|providers(?:$|[/?])|projects(?:$|[/?])|workspace\/|fs\/)/;function p(e){return`${a}${i}${m(e)}`}function m(e){return c===null||f.test(e)?e:`/p/${encodeURIComponent(c)}${e}`}var h=/^\/api(?:\/v1)?(\/.*)$/;function g(e){let t=/^[a-z][a-z0-9+.-]*:/i.exec(e);if(t){let n=e.indexOf(`//`,t[0].length);if(n!==t[0].length)return e;let r=e.indexOf(`/`,n+2);if(r===-1)return e;let i=e.slice(0,r),a=_(e.slice(r));return a===null?e:`${i}${a}`}let n=_(a&&e.startsWith(a)?e.slice(a.length):e);return n===null?e:`${a}${n}`}function _(e){let t=h.exec(e);if(!t)return null;let n=t[1];return n.startsWith(`/p/`)?`${i}${n}`:`${i}${m(n)}`}function v(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}var y=r({extend:{classGroups:{shadow:[`shadow-modal`]}}});function b(...e){return y(n(e))}function x(e){return typeof e==`string`&&/^https?:\/\//i.test(e)}var S=e(t(),1);function C(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function w(...e){return t=>{let n=!1,r=e.map(e=>{let r=C(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():C(e[t],null)}}}}function T(...e){return S.useCallback(w(...e),e)}function E(e){let t=S.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];F(r)&&typeof z==`function`&&(r=z(r._payload)),S.Children.forEach(r,e=>{if(N(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;F(n)&&typeof z==`function`&&(n=z(n._payload)),a=A(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=S.cloneElement(a,void 0,s):!o&&S.Children.count(r)===1&&S.isValidElement(r)&&(a=r);let c=a?M(a):void 0,l=T(n,c);if(!a){if(r||r===0)throw Error(o?R(e):L(e));return r}let u=j(i,a.props??{});return a.type!==S.Fragment&&(u.ref=n?l:c),S.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var D=E(`Slot`),O=Symbol.for(`radix.slottable`);function k(e){let t=e=>`child`in e?e.children(e.child):e.children;return t.displayName=`${e}.Slottable`,t.__radixId=O,t}var A=(e,t)=>{if(`child`in e.props){let t=e.props.child;return S.isValidElement(t)?S.cloneElement(t,void 0,e.props.children(t.props.children)):null}return S.isValidElement(t)?t:null};function j(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function M(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function N(e){return S.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===O}var P=Symbol.for(`react.lazy`);function F(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===P&&`_payload`in e&&I(e._payload)}function I(e){return typeof e==`object`&&!!e&&`then`in e}var L=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,R=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,z=S.use;export{T as a,v as c,s as d,u as f,l as g,o as h,w as i,i as l,g as m,E as n,b as o,d as p,k as r,x as s,D as t,p as u};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{n}from"./dist-C5mlVBmd.js";var r=e(t(),1);function i(e){let[t,i]=r.useState(void 0);return n(()=>{if(e){i({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let n=t[0],r,a;if(`borderBoxSize`in n){let e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;r=t.inlineSize,a=t.blockSize}else r=e.offsetWidth,a=e.offsetHeight;i({width:r,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else i(void 0)},[e]),t}export{i as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{n}from"./dist-Tubgdd25.js";var r=e(t(),1);function i(e){let[t,i]=r.useState(void 0);return n(()=>{if(e){i({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let n=t[0],r,a;if(`borderBoxSize`in n){let e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;r=t.inlineSize,a=t.blockSize}else r=e.offsetWidth,a=e.offsetHeight;i({width:r,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else i(void 0)},[e]),t}export{i as t};