@hearsay-tools/squawk 0.19.0-dev.9216 → 0.19.0-dev.9229.2

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 (148) hide show
  1. package/dist/ci-wait/controller.d.ts +7 -7
  2. package/dist/contract/hosts.d.ts +3 -0
  3. package/dist/contract/index.js +8 -0
  4. package/dist/contract/projects.d.ts +6 -0
  5. package/dist/core/forge-registry.d.ts +8 -0
  6. package/dist/core/forge-registry.js +36 -13
  7. package/dist/core/forge-registry.js.map +1 -1
  8. package/dist/features/hosts/routes.d.ts +66 -64
  9. package/dist/features/webhooks/routes.d.ts +41 -38
  10. package/dist/server/activity-routes.d.ts +23 -23
  11. package/dist/server/projects-routes.d.ts +47 -41
  12. package/dist/server/repo-routes.d.ts +13 -13
  13. package/dist/server/runs-routes.d.ts +326 -326
  14. package/dist/server/server.d.ts +6 -0
  15. package/dist/workspace/projects.d.ts +5 -0
  16. package/dist/workspace/projects.js +8 -2
  17. package/dist/workspace/projects.js.map +1 -1
  18. package/package.json +4 -4
  19. package/web/dist/assets/accounts-section-lnMwvHTo.js +1 -0
  20. package/web/dist/assets/activity-motion-DBxIOskd.js +1 -0
  21. package/web/dist/assets/{activity-route-Bmig0E18.js → activity-route-BYf5OD8Y.js} +1 -1
  22. package/web/dist/assets/agent-accounts-BzD14qLU.js +1 -0
  23. package/web/dist/assets/agent-config-section-BwmBjoad.js +7 -0
  24. package/web/dist/assets/agent-defaults-section-BbFvw0IO.js +1 -0
  25. package/web/dist/assets/appearance-CkohbKAs.js +1 -0
  26. package/web/dist/assets/archive-on-merge-field-CQ8DBqiG.js +1 -0
  27. package/web/dist/assets/ask-card-Bli7vYif.js +9 -0
  28. package/web/dist/assets/automations-route-BNYFQeuu.js +2 -0
  29. package/web/dist/assets/commit-list-CJZtpbaw.js +1 -0
  30. package/web/dist/assets/diff-DPSOaO5_.js +3 -0
  31. package/web/dist/assets/{diff-controls-Bb70UBsP.js → diff-controls-rfNgY_Dd.js} +1 -1
  32. package/web/dist/assets/{diff-view-DLcxtXIH.js → diff-view-CswchTTd.js} +1 -1
  33. package/web/dist/assets/{discard-changes-dialog-BzypT4vb.js → discard-changes-dialog-BMT0YtWx.js} +1 -1
  34. package/web/dist/assets/file-preview-DoaMlVS3.js +2 -0
  35. package/web/dist/assets/folder-browser-D_q7aPq-.js +1 -0
  36. package/web/dist/assets/{git-toolbar-DPkpAaKz.js → git-toolbar-BCqNvkr5.js} +1 -1
  37. package/web/dist/assets/github-Bv1h-3dP.js +1 -0
  38. package/web/dist/assets/{global-activity-route-CQULPYKA.js → global-activity-route-CrAG-ji7.js} +1 -1
  39. package/web/dist/assets/{host-context-iTMFRMT5.js → host-context-KsSKxKbI.js} +1 -1
  40. package/web/dist/assets/host-storage-BHtMSWBL.js +1 -0
  41. package/web/dist/assets/hosts-pzCm30ta.js +1 -0
  42. package/web/dist/assets/{image-preview-C_xACQXI.js → image-preview-CvcSCCBU.js} +1 -1
  43. package/web/dist/assets/index-D9hyWO4C.js +21 -0
  44. package/web/dist/assets/index-DZXi-K2N.css +1 -0
  45. package/web/dist/assets/label-DEZnEIpB.js +1 -0
  46. package/web/dist/assets/{markdown-C1p1PDmF.js → markdown-BRE9fTUI.js} +1 -1
  47. package/web/dist/assets/{open-in-menu-CbPtuWnJ.js → open-in-menu-DomSOC26.js} +1 -1
  48. package/web/dist/assets/{option-select-C6d3jHce.js → option-select-Cqnmt-CB.js} +1 -1
  49. package/web/dist/assets/preferences-section-CC4m45tb.js +1 -0
  50. package/web/dist/assets/preview-DFL4D2C_.js +1 -0
  51. package/web/dist/assets/{preview-pane-connected-ELLewN-g.js → preview-pane-connected-CvF3zJ9A.js} +2 -2
  52. package/web/dist/assets/project-location-D6-Lo1vY.js +1 -0
  53. package/web/dist/assets/project-router-CARDbdMX.js +1 -0
  54. package/web/dist/assets/project-scope-context-Bz7AAyJ4.js +4 -0
  55. package/web/dist/assets/projects-section-zeGtqnI3.js +1 -0
  56. package/web/dist/assets/{prompt-templates-section-D3GzKJMf.js → prompt-templates-section--ygct2zC.js} +2 -2
  57. package/web/dist/assets/queries-D7W-eGim.js +1 -0
  58. package/web/dist/assets/reference-chip-D8ckcrda.js +1 -0
  59. package/web/dist/assets/remote-settings-notice-MxDxNXXw.js +1 -0
  60. package/web/dist/assets/repo-git-VfTEbVO3.js +1 -0
  61. package/web/dist/assets/report-reader-DLCLUfdH.js +1 -0
  62. package/web/dist/assets/{report-selection-DxBxW6dz.js → report-selection-BcsbTczw.js} +1 -1
  63. package/web/dist/assets/reports-QoDlngjL.js +1 -0
  64. package/web/dist/assets/{resources-section-CpAOY20Z.js → resources-section-CBL0htm5.js} +1 -1
  65. package/web/dist/assets/{review-notes-drafts-D25BaEEb.js → review-notes-drafts-DJDQNemf.js} +1 -1
  66. package/web/dist/assets/{review-panel-CS9wTfAu.js → review-panel-BY05CuXd.js} +1 -1
  67. package/web/dist/assets/review-strip-BWhQ5CIC.js +1 -0
  68. package/web/dist/assets/{run-detail-refresh-wJr0M04e.js → run-detail-refresh-CecZhU-h.js} +1 -1
  69. package/web/dist/assets/{run-diff-BBASqHSE.js → run-diff-CpwwrpXO.js} +1 -1
  70. package/web/dist/assets/run-header-CZU3e9Xk.js +2 -0
  71. package/web/dist/assets/{select-CEEeAH4k.js → select-C72KGfnK.js} +1 -1
  72. package/web/dist/assets/{session-context-section-F1umLA86.js → session-context-section-D8v30mSp.js} +1 -1
  73. package/web/dist/assets/settings-agent-picker-DGhJwDIY.js +1 -0
  74. package/web/dist/assets/{settings-save-bar-BkU1JDt3.js → settings-save-bar-Dp-eEIEF.js} +1 -1
  75. package/web/dist/assets/settings-shell-DZzgCmSz.js +1 -0
  76. package/web/dist/assets/sidebar-section-B94mdYUS.js +1 -0
  77. package/web/dist/assets/skills-B6jO_f1w.js +1 -0
  78. package/web/dist/assets/status-dot-B5MkhHDP.js +1 -0
  79. package/web/dist/assets/{tab-link-CiKWtkK_.js → tab-link-zXPa9LIz.js} +1 -1
  80. package/web/dist/assets/task-changes-B_2BDWIf.js +5 -0
  81. package/web/dist/assets/task-commits-kxDG4T81.js +1 -0
  82. package/web/dist/assets/{task-file-scope-DU8AkDkr.js → task-file-scope-DVACyrij.js} +1 -1
  83. package/web/dist/assets/task-files-4CxXkPOx.js +1 -0
  84. package/web/dist/assets/task-github-item-C8hMZej3.js +1 -0
  85. package/web/dist/assets/task-thread-Bv_Fjceh.js +2 -0
  86. package/web/dist/assets/thread-state-CufNf_fC.js +4 -0
  87. package/web/dist/assets/use-finish-run-CjYc6ovQ.js +1 -0
  88. package/web/dist/assets/use-hand-to-agent-state-B_j_e1kD.js +1 -0
  89. package/web/dist/assets/use-path-bases-BfjK7tem.js +1 -0
  90. package/web/dist/assets/use-workspace-config-save-toCmvqtz.js +1 -0
  91. package/web/dist/assets/{workflows-DdKRMlHR.js → workflows-iMfDerlK.js} +2 -2
  92. package/web/dist/assets/workspace-tools-CgYFRggf.js +1 -0
  93. package/web/dist/assets/{worktrees-section-CCgqbLAh.js → worktrees-section-CtT9bwKK.js} +5 -5
  94. package/web/dist/assets/{zoomable-image-DJ1lJEMc.js → zoomable-image-Dv85Vr4A.js} +1 -1
  95. package/web/dist/index.html +17 -20
  96. package/web/dist/live-worker.js +1 -1
  97. package/web/dist/assets/accounts-section-BJcwTmko.js +0 -1
  98. package/web/dist/assets/activity-motion-D7ylxNSA.js +0 -1
  99. package/web/dist/assets/agent-accounts-DaaS69XB.js +0 -1
  100. package/web/dist/assets/agent-config-section-BOXqQyTv.js +0 -7
  101. package/web/dist/assets/agent-defaults-section-Bxfreo-n.js +0 -1
  102. package/web/dist/assets/appearance-BRqSFVDC.js +0 -1
  103. package/web/dist/assets/archive-on-merge-field-hDSXItUf.js +0 -1
  104. package/web/dist/assets/ask-card-CWrAEuZE.js +0 -9
  105. package/web/dist/assets/attention-CFW302LY.js +0 -1
  106. package/web/dist/assets/automations-route-BBsU9yBn.js +0 -2
  107. package/web/dist/assets/commit-list-5iHD08NO.js +0 -1
  108. package/web/dist/assets/diff-CkIsqgZZ.js +0 -3
  109. package/web/dist/assets/file-preview-CJVN0cBa.js +0 -2
  110. package/web/dist/assets/folder-browser-Cdm2WZOB.js +0 -1
  111. package/web/dist/assets/github-DXBAYLfd.js +0 -1
  112. package/web/dist/assets/host-storage-Cr_NKfWy.js +0 -1
  113. package/web/dist/assets/hosts-IKDCpyJQ.js +0 -1
  114. package/web/dist/assets/index-D1E0Dmck.css +0 -1
  115. package/web/dist/assets/index-k2m-s5zD.js +0 -21
  116. package/web/dist/assets/label-ODcSLYVj.js +0 -1
  117. package/web/dist/assets/preferences-section-ChS8Q-Lu.js +0 -1
  118. package/web/dist/assets/preview-B5bPk6HT.js +0 -1
  119. package/web/dist/assets/project-location-D8vnqA4E.js +0 -1
  120. package/web/dist/assets/project-router-CPgPVoBJ.js +0 -1
  121. package/web/dist/assets/projects-section-L3QxEiRK.js +0 -1
  122. package/web/dist/assets/queries-DHjNE2es.js +0 -1
  123. package/web/dist/assets/read-state-jUDTdM3R.js +0 -1
  124. package/web/dist/assets/reference-chip-kvc51N1L.js +0 -1
  125. package/web/dist/assets/remote-settings-notice-BtVKQ2vp.js +0 -1
  126. package/web/dist/assets/repo-git-BGSxevNj.js +0 -1
  127. package/web/dist/assets/report-reader-CvEkEEwN.js +0 -1
  128. package/web/dist/assets/reports-1vI74Z6R.js +0 -1
  129. package/web/dist/assets/review-strip-nrpQBfNI.js +0 -1
  130. package/web/dist/assets/run-header-DVnksnr4.js +0 -2
  131. package/web/dist/assets/settings-agent-picker-sUQdIon3.js +0 -1
  132. package/web/dist/assets/settings-shell-DodTPpjl.js +0 -1
  133. package/web/dist/assets/sidebar-section-DspuARa_.js +0 -1
  134. package/web/dist/assets/skills-CrHHdPjJ.js +0 -1
  135. package/web/dist/assets/status-dot-DuorWA5M.js +0 -1
  136. package/web/dist/assets/task-changes-U1cnUd83.js +0 -5
  137. package/web/dist/assets/task-commits-DxuX8SZp.js +0 -1
  138. package/web/dist/assets/task-files-DaDM9FRg.js +0 -1
  139. package/web/dist/assets/task-github-item-CXzzVHXw.js +0 -1
  140. package/web/dist/assets/task-groups-BapM4YcT.js +0 -1
  141. package/web/dist/assets/task-thread-9WIv4rPC.js +0 -2
  142. package/web/dist/assets/thread-state-IooDEE0b.js +0 -4
  143. package/web/dist/assets/toaster-Dglox5F-.js +0 -4
  144. package/web/dist/assets/use-finish-run-jVAqsGkV.js +0 -1
  145. package/web/dist/assets/use-hand-to-agent-state-DfucUGAH.js +0 -1
  146. package/web/dist/assets/use-path-bases-C7DRxlRi.js +0 -1
  147. package/web/dist/assets/use-workspace-config-save-B2eroiEx.js +0 -1
  148. package/web/dist/assets/workspace-tools-CePJG7uG.js +0 -1
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Qt as r,Xt as i,Zt as a,g as o,k as s,tn as c}from"./queries-DHjNE2es.js";import{u as l}from"./host-context-iTMFRMT5.js";import{Cn as u,Fi as d,H as f,Pi as p,Qr as m,U as h,V as g,W as _,Xr as v,Yr as y,_ as b,c as x,d as ee,g as te,o as ne,qr as re,s as ie,tr as ae,v as oe}from"./toaster-Dglox5F-.js";import{B as S,G as se,H as C,I as w,K as ce,N as T,P as E,V as le,W as D,j as O,z as k}from"./live-protocol-CNUmr-VT.js";import{g as ue,n as de}from"./chunk-KS7C4IRE-BdLLx37K.js";import{r as fe,t as A}from"./label-ODcSLYVj.js";import{o as j}from"./dist-CCX8mhHc.js";import{L as pe,X as me,Z as he,b as ge,ft as _e,ht as ve,nt as ye,ot as be,u as xe}from"./design-icons-QbNMZniQ.js";import{t as Se}from"./check-OP-CVgZG.js";import{t as M}from"./button-BV_AiLj2.js";import{n as Ce,r as we,t as Te}from"./collapsible-D5i3hm2L.js";import{a as N,i as P,n as F,r as I,t as L}from"./select-CEEeAH4k.js";import{t as Ee}from"./switch-B9OfOEzC.js";import{c as De,s as Oe,t as R}from"./project-router-CPgPVoBJ.js";import{c as z,d as B,f as ke,l as Ae,n as je,o as Me}from"./page-shell-BdjH5hyc.js";import{a as Ne}from"./agent-accounts-DaaS69XB.js";import{r as Pe}from"./agents-settings-path-7X6_cvUg.js";import{t as Fe}from"./centered-state-N8vWM_Hw.js";import{$ as Ie,Gn as Le,Kn as Re,M as ze,N as Be,R as Ve,Sr as He,Tn as Ue,X as We,Z as Ge,ir as Ke,j as qe,kn as Je,lr as V,t as Ye}from"./index-k2m-s5zD.js";import{t as Xe}from"./textarea-BGp28xFr.js";import{_ as Ze,a as Qe,c as $e,d as et,f as tt,g as nt,h as rt,i as it,l as at,m as ot,n as st,o as ct,p as lt,r as ut,s as dt,t as H,u as ft,v as pt}from"./automation-format-jKMOXcHS.js";var U=e(t(),1),W=O([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),mt=S({includeExisting:E().optional(),authors:T(D()).optional(),assignees:T(D()).optional(),requireCurrentLabels:E().optional(),allLabels:T(D()).optional(),anyLabels:T(D()).optional(),excludeLabels:T(D()).optional(),changedLabels:T(D()).optional(),lookbackDays:k(),maxRecords:k()}),ht=O([`github`,`schedule`]),gt=re.omit({task:!0,images:!0,systemPrompt:!0}).extend({prompt:D(),variants:se([w(1),w(2),w(3)]).optional(),systemPrompt:D().optional()}),_t=S({at:D(),outcome:O([`launched`,`cancelled`]),runId:D().optional(),receiptId:D().optional(),trigger:O([`schedule`,`late`,`manual`,`retry`]).optional()}),G=S({id:D(),revision:k(),name:D(),description:D().optional(),enabled:E(),kind:ht,events:T(W).optional(),intervalSeconds:k().optional(),filters:mt.optional(),schedule:$e.optional(),task:gt,archived:_t.optional(),createdAt:D(),updatedAt:D()}),K=S({timestamp:D(),tieBreaker:D().optional()}),vt=S({since:D().datetime(),until:D().datetime(),source:k().int().min(0).max(2),page:k().int().min(1).max(10),item:k().int().min(0).max(100),event:k().int().min(0).max(1e3),cursor:K.optional()}),yt={lastError:D().max(1e3).optional(),lastErrorAt:D().datetime().optional()},bt=S({revision:k().optional(),baselineAt:D().optional(),armedAt:D().optional(),historyScan:vt.optional(),cursor:K.optional(),frozenHighWatermark:K.extend({tieBreaker:D()}).optional(),backlogAfter:K.extend({tieBreaker:D()}).optional(),nextCheckAt:D().optional(),lastSuccessAt:D().optional(),nextRunAt:D().optional(),lastRunAt:D().optional(),etags:C(D(),D()).optional(),backoffUntil:D().optional(),consecutiveFailures:k().optional(),...yt,onceOutcome:O([`failed`,`missed`]).optional()});function xt(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 St=O([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]),Ct=S({seq:k(),ts:D(),automationId:D(),revision:k(),event:W.optional(),result:St,reason:D().optional(),durationMs:k().optional(),receiptId:D().optional(),runId:D().optional(),githubNumber:k().optional(),githubTitle:D().optional(),githubUrl:D().optional(),rateLimit:S({bucket:O([`core`,`search`]),remaining:k().optional(),resetAt:D().optional()}).optional()}),wt=S({matches:k(),launched:k(),duplicates:k(),errors:k()}),Tt=G.extend({state:bt.optional(),latestLog:Ct.optional(),counts:wt,nextRunAt:D().optional(),onceStatus:lt.optional()});S({available:E(),reason:D().optional(),timeZone:D(),scheduler:S({state:O([`scheduled`,`idle`]),nextDue:D().optional()}),automations:T(Tt)}),S({automation:G}).extend({once:S({dueAt:D(),timeZone:D(),resolvedInstant:D(),note:D()}).optional()}),S({automation:G,state:bt.optional(),latestLog:Ct.optional(),onceStatus:lt.optional()}),S({id:D(),automationId:D(),mode:O([`preview`,`execute`]),status:O([`queued`,`running`,`complete`,`error`]),createdAt:D(),completedAt:D().optional(),matches:k().optional(),truncated:E().optional(),error:D().optional()}),S({checkId:D()}),S({records:T(Ct)}),S({receiptId:D(),runId:D()}),S({runId:D()}),G.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0,kind:!0,archived:!0}).extend({kind:ht.optional(),task:gt.omit({variants:!0}).strict(),enable:E().optional()}).omit({enable:!0}).extend({enabled:E().optional(),expectedRevision:k()}),S({archived:O([`include`,`only`]).optional()}),S({mode:O([`preview`,`execute`])});var q=n();function J({text:e}){return(0,q.jsx)(`div`,{role:`status`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:e})}var Et={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`},Dt={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 Ot(e){let[t,n]=(0,U.useState)(),[r,i]=(0,U.useState)(``),a=(0,U.useCallback)(t=>b(e,{signal:t}).then(({records:e})=>{t?.aborted||(n(e),i(``))}).catch(e=>{t?.aborted||i(String(e))}),[e]);return(0,U.useEffect)(()=>{a()},[a]),(0,U.useEffect)(()=>ae(a),[a]),(0,U.useEffect)(()=>fe((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function kt(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 At({records:e,all:t,timeZone:n,onRetried:r,readOnly:i=!1}){let a=e=>!i&&kt(e,t),[o,s]=(0,U.useState)(),[c,l]=(0,U.useState)(),u=Date.now(),d=async e=>{s(e),l(void 0);try{await g(e),r()}catch(t){l({receiptId:e,message:t instanceof Error?t.message:String(t)})}finally{s(void 0)}};return(0,q.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:e.map(e=>(0,q.jsxs)(`li`,{className:`min-w-0 rounded-xl border border-card-edge bg-card p-4 shadow-card`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,q.jsx)(Ke,{dot:Et[e.result],children:Dt[e.result]}),(0,q.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:st(e.ts,n,u)})]}),e.reason?(0,q.jsx)(`p`,{className:`mt-2 text-sm break-words text-muted-foreground`,children:e.reason}):null,e.githubUrl||e.runId||a(e)?(0,q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[e.githubUrl?(0,q.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,q.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,q.jsx)(M,{variant:`outline`,disabled:o===e.receiptId,onClick:()=>void d(e.receiptId),children:`Retry task`}):null]}):null,c&&c.receiptId===e.receiptId?(0,q.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm break-words text-destructive`,children:c.message}):null]},e.seq))})}var Y=`all`;function jt({label:e,value:t,onChange:n,options:r}){return(0,q.jsxs)(L,{value:t,onValueChange:n,children:[(0,q.jsx)(P,{"aria-label":e,className:`w-full sm:w-52`,children:(0,q.jsx)(N,{})}),(0,q.jsx)(F,{children:r.map(e=>(0,q.jsx)(I,{value:e.value,children:e.label},e.value))})]})}function Mt({automationId:e,automationName:t,timeZone:n,readOnly:r=!1}){let{records:i,error:a,refresh:o}=Ot(e),[s,c]=(0,U.useState)(Y),[l,u]=(0,U.useState)(Y),d=(0,U.useMemo)(()=>(i??[]).filter(e=>(s===Y||e.result===s)&&(l===Y||e.event===l)),[i,s,l]),f=(i??[]).some(e=>e.event);return(0,q.jsx)(Ae,{route:`automations`,density:i?ke(d.length):`full`,header:{title:`Execution log`,subtitle:t??`Automation activity`,secondaryActions:(0,q.jsx)(z,{variant:`outline`,asChild:!0,children:(0,q.jsx)(R,{to:`/automations`,children:`Back to automations`})})},children:a&&!i?(0,q.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,q.jsx)(J,{text:a}),(0,q.jsx)(M,{variant:`outline`,onClick:()=>void o(),children:`Retry`})]}):i?i.length===0?(0,q.jsx)(J,{text:`Nothing has run yet.`}):(0,q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(jt,{label:`Result`,value:s,onChange:c,options:[{value:Y,label:`All results`},...St.options.map(e=>({value:e,label:Dt[e]}))]}),f?(0,q.jsx)(jt,{label:`Event`,value:l,onChange:u,options:[{value:Y,label:`All events`},...W.options.map(e=>({value:e,label:e}))]}):null]}),d.length===0?(0,q.jsx)(J,{text:`No rows match these filters.`}):(0,q.jsx)(At,{records:d,all:i,timeZone:n,onRetried:()=>void o(),readOnly:r})]}):(0,q.jsx)(J,{text:`Loading execution log…`})})}function Nt({automationId:e,automationName:t,timeZone:n,showName:r=!1,readOnly:i=!1}){let{records:a,error:o,refresh:s}=Ot(e),c=`Recent activity${r&&t?` · ${t}`:``}`;return!o&&a&&a.length===0?(0,q.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,q.jsx)(`h3`,{className:`font-medium text-foreground`,children:c}),(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,q.jsx)(`p`,{children:`Nothing has run yet.`})]}):(0,q.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`min-w-0 border-t border-border pt-2.5`,children:[(0,q.jsx)(`h3`,{className:`mb-1.5 text-xs font-medium text-muted-foreground`,children:c}),o&&!a?(0,q.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,q.jsx)(J,{text:o}),(0,q.jsx)(M,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]}):a?(0,q.jsx)(At,{records:a.slice(0,5),all:a,timeZone:n,onRetried:()=>void s(),readOnly:i}):(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading activity…`})]})}function Pt({automation:e,timeZone:t,onDeleted:n}){let r=e.archived,i=e.schedule,a=i?ut(i):null,[o,s]=(0,U.useState)(!1),[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)(``),f=(0,U.useRef)(null),p=(0,U.useRef)(null),m=(0,U.useRef)(null);(0,U.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 ee(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,q.jsx)(Ae,{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,q.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[(0,q.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,q.jsxs)(`p`,{className:`text-sm break-words`,children:[(0,q.jsx)(`span`,{children:r.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`}),r.runId?(0,q.jsxs)(q.Fragment,{children:[` · `,(0,q.jsx)(R,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${r.runId}`,children:`Open task`})]}):null]}),(0,q.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Archived ${H(r.at,t)} (${t}).`}),a&&i?.timeZone?(0,q.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Was due ${a.date} ${a.time} (${i.timeZone}).`}):null]}),(0,q.jsxs)(`section`,{"aria-labelledby":`archived-inputs`,className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,q.jsx)(`h2`,{id:`archived-inputs`,className:`mb-3 text-[15px] font-medium`,children:`What it ran with`}),(0,q.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[(0,q.jsxs)(`div`,{className:`grid gap-1`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Prompt`}),(0,q.jsx)(`dd`,{className:`break-words whitespace-pre-wrap`,children:e.task.prompt})]}),g.filter(([,e])=>e).map(([e,t])=>(0,q.jsxs)(`div`,{className:`grid gap-1`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,q.jsx)(`dd`,{className:`break-words`,children:t})]},e))]})]}),(0,q.jsxs)(`section`,{className:`min-w-0`,children:[(0,q.jsx)(Nt,{automationId:e.id,automationName:e.name,timeZone:t,readOnly:!0}),(0,q.jsx)(M,{variant:`outline`,asChild:!0,className:`mt-3`,children:(0,q.jsx)(R,{to:`/automations/${e.id}/log`,children:`Execution log`})})]}),(0,q.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[o?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? Its record and log are removed; the task stays.`}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(M,{variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:c,onClick:()=>void h(),children:`Delete schedule`}),(0,q.jsx)(M,{ref:p,variant:`outline`,disabled:c,onClick:()=>{m.current=`delete`,s(!1)},children:`Keep`})]})]}):(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(M,{ref:f,variant:`outline`,"data-action":`automation-delete`,onClick:()=>{m.current=`keep`,s(!0)},children:`Delete`}),(0,q.jsx)(M,{variant:`outline`,asChild:!0,children:(0,q.jsx)(R,{to:`/automations`,children:`Back to automations`})})]}),u?(0,q.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:u}):null]})]})})}var Ft=O([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),X=T(D().trim().min(1).max(200)).max(100).optional(),It=S({includeExisting:E().optional(),requireCurrentLabels:E().optional(),authors:X,assignees:X,allLabels:X,anyLabels:X,excludeLabels:X,changedLabels:X,lookbackDays:k().int().min(1).max(90).default(7),maxRecords:k().int().min(1).max(100).default(25)}).passthrough(),Lt=S({prompt:D().min(1).max(1e5),workflow:D().trim().min(1).max(200).optional(),steps:T(y).min(1).max(100).optional(),runner:p.optional(),model:D().trim().min(1).max(200).optional(),effort:D().trim().min(1).max(32).optional(),variants:se([w(1),w(2),w(3)]).optional(),worktree:E().optional(),autonomous:E().optional(),...v,...m,systemPrompt:D().max(1e5).optional()}).passthrough().refine(e=>!(e.workflow&&e.steps),{message:`task selects either a named workflow or inline steps, not both`}),Rt=new Set(Object.keys(Lt.shape).filter(e=>e!==`variants`));function zt(e){return Object.fromEntries(Object.entries(e).filter(([e])=>Rt.has(e)))}le(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??{}}},S({id:D().min(1).max(100),revision:k().int().positive(),name:D().trim().min(1).max(200),description:D().max(2e3).optional(),enabled:E().default(!1),kind:ht.default(`github`),events:T(Ft).min(1).max(4).optional(),intervalSeconds:k().int().min(60).max(86400).optional(),filters:It.optional(),schedule:$e.passthrough().optional(),task:Lt,archived:S({at:D().datetime(),outcome:O([`launched`,`cancelled`]),runId:D().optional(),receiptId:D().optional(),trigger:O([`schedule`,`late`,`manual`,`retry`]).optional()}).passthrough().optional(),createdAt:D().datetime(),updatedAt:D().datetime()}).passthrough().superRefine((e,t)=>{if(e.kind===`schedule`){e.schedule||t.addIssue({code:d.custom,path:[`schedule`],message:`a scheduled automation needs a schedule`});return}e.events?.length||t.addIssue({code:d.custom,path:[`events`],message:`a GitHub automation needs at least one event`}),e.intervalSeconds===void 0&&t.addIssue({code:d.custom,path:[`intervalSeconds`],message:`a GitHub automation needs a poll interval`}),e.filters||t.addIssue({code:d.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:d.custom,path:[`filters`,`changedLabels`],message:`changedLabels is required for issue label events`})})),S({version:w(1).default(1),automations:T(ce()).default([]),tombstones:C(D(),D().datetime()).optional()}).passthrough();var Bt=S({timestamp:D().datetime(),tieBreaker:D().optional()}).passthrough(),Vt=vt.extend({cursor:Bt.optional()}),Ht=S({revision:k().int().positive().optional(),baselineAt:D().datetime().optional(),armedAt:D().datetime().optional(),historyScan:Vt.optional(),cursor:Bt.optional(),frozenHighWatermark:Bt.extend({tieBreaker:D()}).optional(),backlogAfter:Bt.extend({tieBreaker:D()}).optional(),nextCheckAt:D().datetime().optional(),lastSuccessAt:D().datetime().optional(),nextRunAt:D().datetime().optional(),lastRunAt:D().datetime().optional(),etags:C(D(),D()).optional(),backoffUntil:D().datetime().optional(),consecutiveFailures:k().int().nonnegative().optional(),...yt,onceOutcome:O([`failed`,`missed`]).optional()}).passthrough();S({version:w(1).default(1),states:C(D(),Ht).default({})}).passthrough(),S({receiptId:D().min(1),receiptKey:D().min(1),eventId:D().min(1),automationId:D().min(1),revision:k().int().positive(),status:O([`reserved`,`launched`,`launch-error`,`released`]),runId:D().optional(),observedAt:D().datetime(),updatedAt:D().datetime(),error:D().max(2e3).optional(),occurrenceAt:D().datetime().optional(),candidate:S({eventId:D(),event:Ft,timestamp:D().datetime(),tieBreaker:D(),repo:D(),nodeId:D(),number:k().int().positive(),title:D().max(500),url:D().url(),author:D().max(200),assignees:T(D().max(200)).max(100),labels:T(D().max(200)).max(100),changedLabel:D().max(200).optional()}).passthrough().optional()}).passthrough();var Ut=O([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]);S({seq:k().int().positive(),ts:D().datetime(),automationId:D().min(1),revision:k().int().positive(),event:Ft.optional(),result:Ut,reason:D().max(2e3).optional(),durationMs:k().int().nonnegative().optional(),receiptId:D().optional(),runId:D().optional(),githubNumber:k().int().positive().optional(),githubTitle:D().max(500).optional(),githubUrl:D().url().optional(),rateLimit:S({bucket:O([`core`,`search`]),remaining:k().int().nonnegative().optional(),resetAt:D().datetime().optional()}).passthrough().optional()}).passthrough();var Wt=`quick-task`;function Gt(e={}){let{prompt:t,workflow:n,runner:r,model:i,autonomous:a,archiveWhenDone:o,autoMergePr:s,allowWorkers:c,allowMessaging:l,...u}=zt(e.task??{prompt:``}),d=e.task===void 0;return{name:e.name??``,description:e.description??``,kind:e.kind??`schedule`,schedule:ft(e.schedule??{type:`daily`}),events:e.events??[W.options[0]],intervalSeconds:e.intervalSeconds??300,filters:e.filters??{lookbackDays:7,maxRecords:25},prompt:t,...n===void 0?d?{workflow:Wt}:{}:{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 Kt(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 qt(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 Jt(e){return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},kind:e.kind,...e.kind===`schedule`?{schedule:Kt(e.schedule)}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:qt(e)}}function Yt(e){return{...Jt(e),enable:e.enabled}}function Xt(e,t){return{...Jt(e),task:{...qt(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 Zt=new Set([`prompt`,`workflow`,`runner`,`model`,`autonomous`,`worktree`,`archiveWhenDone`,`autoMergePr`,`allowWorkers`,`allowMessaging`]),Qt=new Set([`anyLabels`,`authors`,`changedLabels`]);function $t(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=>!Zt.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||Qt.has(e)&&Array.isArray(t)&&t.length>0)}function en(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function tn(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 nn(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`,tn(e.schedule.latestStartMinutes)));else if(e.kind===`schedule`)t.push(Q(`cron`,at(e.schedule)));else{t.push(Q(`on`,e.events.join(`,`)),`--every ${en(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(...rn(e.task)),e.enable===!0&&t.push(`--enable`),t.push(Q(`prompt`,e.task.prompt)),t.join(` `)}function rn(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 an(e,t){let n=Yt(e),r=$t(n)?nn(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 on(e){let t=[],n=!1;for(let r of sn(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 sn(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 cn({draft:e,saveLabel:t,editing:n}){let r=Oe(),i=l(),a=window.location.origin,o=(0,U.useMemo)(()=>{let t=an(e);return r?`HSQ_COCKPIT_URL=${Z(a)} HSQ_PROJECT_ID=${Z(r)} ${t}`:t},[e,a,r]),s=(0,U.useMemo)(()=>on(o),[o]),[c,u]=(0,U.useState)(`idle`),[d,f]=(0,U.useState)(!1),p=(0,U.useId)(),m=(0,U.useRef)(void 0);if((0,U.useEffect)(()=>()=>clearTimeout(m.current),[]),(0,U.useEffect)(()=>u(`idle`),[o]),i)return(0,q.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,q.jsx)(`h2`,{id:`copy-as-cli-heading`,className:`text-[13px] font-medium text-muted-foreground`,children:`Copy as CLI`}),(0,q.jsx)(`p`,{"data-slot":`copy-as-cli-remote-note`,className:`mbs-2 text-xs break-words text-muted-foreground`,children:`Run automation CLI commands on that machine.`})]});let h=async()=>{clearTimeout(m.current);try{await navigator.clipboard.writeText(s),u(`copied`),m.current=setTimeout(()=>u(`idle`),1600)}catch{u(`failed`)}};return(0,q.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,q.jsxs)(`div`,{className:`flex min-h-8 min-w-0 flex-nowrap items-center justify-between gap-x-2`,children:[(0,q.jsx)(`h2`,{id:`copy-as-cli-heading`,className:`shrink-0 text-[13px] font-medium text-muted-foreground`,children:`Copy as CLI`}),(0,q.jsxs)(M,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`copy-as-cli-toggle`,"aria-expanded":d,"aria-controls":p,"aria-label":d?`Hide command`:`Show command`,className:`min-w-0 shrink gap-1 px-1.5 text-[12px] font-medium`,onClick:()=>f(e=>!e),children:[(0,q.jsx)(`span`,{className:`truncate`,children:d?`Hide`:`Show`}),(0,q.jsx)(xe,{"aria-hidden":`true`,className:j(`size-3.5 transition-transform`,d&&`rotate-180`)})]}),(0,q.jsxs)(M,{type:`button`,variant:`outline`,size:`sm`,className:`ms-auto gap-1.5 px-2 text-[12px] font-medium`,onClick:()=>void h(),children:[c===`copied`?(0,q.jsx)(Se,{"aria-hidden":`true`,className:`size-3.5`}):(0,q.jsx)(He,{"aria-hidden":`true`,className:`size-3.5`}),c===`copied`?`Copied`:`Copy`]})]}),(0,q.jsx)(`div`,{id:p,hidden:!d,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,q.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:s})}),(0,q.jsx)(`p`,{role:`status`,className:`mbs-2 text-xs break-words text-muted-foreground`,children:c===`failed`?`Could not copy — select the line and copy it by hand.`:(0,q.jsxs)(q.Fragment,{children:[`The definition ${t} would ${n?`save`:`create`}.`,` `,(0,q.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 ln({pressed:e,onClick:t,disabled:n,children:r}){return(0,q.jsx)(`button`,{type:`button`,"aria-pressed":e,disabled:n,onClick:t,className:j(`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:r})}var un={"pull_request.opened":`a pull request opens`,"issue.opened":`an issue opens`,"issue.labeled":`an issue is labeled`,"issue.unlabeled":`an issue is unlabeled`},dn={"pull_request.opened":`Pull request opened`,"issue.opened":`Issue opened`,"issue.labeled":`Issue labeled`,"issue.unlabeled":`Issue unlabeled`};function fn(e){let t=e.map(e=>un[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 pn=W.options,mn=[{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`}],hn=[{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.`}],gn=e=>(e??[]).join(`, `),_n=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function vn(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 yn(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`}. ${vn(e.filters.includeExisting)}`}function bn({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=_n(r),{[n]:a,...o}=e.filters;t({filters:i.length?{...o,[n]:i}:o})},o=mn.some(t=>t.seconds===e.intervalSeconds)?mn:[...mn,{seconds:e.intervalSeconds,label:`${Math.round(e.intervalSeconds/60)} minutes`}].sort((e,t)=>e.seconds-t.seconds);return(0,q.jsxs)(`div`,{className:`grid gap-4`,children:[n?(0,q.jsx)(`p`,{className:`text-xs text-pending-strong`,children:`GitHub unavailable · ${n}`}):null,(0,q.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:pn.map(t=>(0,q.jsx)(ln,{pressed:e.events.includes(t),onClick:()=>r(t),children:dn[t]},t))}),(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(A,{htmlFor:`automation-interval`,children:`Check every`}),(0,q.jsxs)(L,{value:String(e.intervalSeconds),onValueChange:e=>t({intervalSeconds:Number(e)}),children:[(0,q.jsx)(P,{id:`automation-interval`,className:`w-full sm:w-48`,"aria-label":`Check every`,children:(0,q.jsx)(N,{})}),(0,q.jsx)(F,{children:o.map(e=>(0,q.jsx)(I,{value:String(e.seconds),children:e.label},e.seconds))})]})]}),(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,q.jsx)(Ee,{"aria-label":`Include existing items`,"aria-describedby":`automation-history-hint`,checked:e.filters.includeExisting??!1,onCheckedChange:e=>i({includeExisting:e})}),(0,q.jsx)(`span`,{children:`Include existing items`})]}),(0,q.jsx)(`p`,{id:`automation-history-hint`,className:`text-xs text-muted-foreground`,children:vn(e.filters.includeExisting)})]}),(0,q.jsxs)(Te,{children:[(0,q.jsxs)(we,{className:`group flex min-h-11 items-center gap-2 text-sm font-medium`,children:[`Filters`,(0,q.jsx)(xe,{"aria-hidden":`true`,className:`size-4 text-soft-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-180`})]}),(0,q.jsx)(Ce,{children:(0,q.jsxs)(`div`,{className:`grid gap-4 pt-2 sm:grid-cols-2`,children:[hn.map(t=>(0,q.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,q.jsx)(A,{htmlFor:`automation-filter-${t.key}`,children:t.label}),(0,q.jsx)(V,{id:`automation-filter-${t.key}`,className:`border-border`,placeholder:`comma separated`,value:gn(e.filters[t.key]),onChange:e=>a(t.key,e.target.value)}),t.hint?(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.hint}):null]},t.key)),(0,q.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,q.jsx)(A,{htmlFor:`automation-filter-lookback`,children:`Look back (days)`}),(0,q.jsx)(V,{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,q.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,q.jsx)(A,{htmlFor:`automation-filter-max`,children:`Max records per check`}),(0,q.jsx)(V,{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 xn=e=>String(e).padStart(2,`0`);function Sn({label:e,value:t,max:n,onCommit:r}){let[i,a]=(0,U.useState)(xn(t)),o=(0,U.useRef)(null),s=!(/^\d{1,2}$/.test(i)&&Number(i)===t),c=`${e} must be 00–${xn(n)}.`,l=(0,U.useId)();return(0,U.useEffect)(()=>{o.current?.setCustomValidity(s?c:``)},[s,c]),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(V,{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(xn(t))}),s?(0,q.jsx)(`p`,{id:l,className:`order-last basis-full text-xs text-destructive`,children:c}):null]})}var Cn=[{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`}],wn=`none`,Tn=e=>String(e).padStart(2,`0`);function En(e,t=Date.now()){let n=pt(t,e)??pt(t,`UTC`),r=new Date(Date.UTC(n.year,n.month-1,n.day+1));return`${r.getUTCFullYear()}-${Tn(r.getUTCMonth()+1)}-${Tn(r.getUTCDate())}T09:00`}function Dn(){let e=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];return e.includes(`UTC`)?e:[`UTC`,...e]}function On({value:e,stored:t,onChange:n}){let r=t=>n({...e,...t}),i=e.at?ot(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${Tn(t)}:${Tn(n)}`}),l=(0,U.useRef)(null),u=(0,U.useId)(),d=tt(e),f=!(t?.type===`once`&&t.at===e.at&&t.timeZone===e.timeZone)&&d!==null&&d<=Date.now();(0,U.useEffect)(()=>{l.current?.setCustomValidity(f?Qe:``)},[f]);let p=ut(e);return(0,q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(A,{htmlFor:`automation-once-date`,children:`Date`}),(0,q.jsx)(V,{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,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,q.jsx)(Sn,{label:`Hour`,value:o,max:23,onCommit:e=>c(a,e,s)}),(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,q.jsx)(Sn,{label:`Minute`,value:s,max:59,onCommit:e=>c(a,o,e)})]})]}),f?(0,q.jsx)(`p`,{id:u,className:`text-xs text-destructive`,children:Qe}):null,(0,q.jsx)(An,{value:e.timeZone??``,onCommit:e=>r({timeZone:e})}),(0,q.jsx)(jn,{value:e.latestStartMinutes,onChange:t=>n(kn(e,t))}),p?(0,q.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 kn(e,t){let{latestStartMinutes:n,...r}=e;return t===void 0?r:{...r,latestStartMinutes:t}}function An({value:e,onCommit:t}){let[n,r]=(0,U.useState)(e),i=(0,U.useRef)(null),a=(0,U.useId)(),o=(0,U.useId)(),[s]=(0,U.useState)(Dn),c=n!==e||!Ze(n),l=nt(n);return(0,U.useEffect)(()=>{i.current?.setCustomValidity(c?l:``)},[c,l]),(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(A,{htmlFor:`automation-once-zone`,children:`Time zone`}),(0,q.jsx)(V,{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),Ze(e.target.value)&&t(e.target.value)}}),(0,q.jsx)(`datalist`,{id:a,children:s.map(e=>(0,q.jsx)(`option`,{value:e},e))}),c?(0,q.jsx)(`p`,{id:o,className:`text-xs break-words text-destructive`,children:l}):null]})}function jn({value:e,onChange:t}){let n=Cn.some(t=>t.minutes===e)||e===void 0?Cn:[...Cn,{minutes:e,label:`${e} minutes`}];return(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(A,{htmlFor:`automation-once-latest`,children:`Latest start`}),(0,q.jsxs)(L,{value:e===void 0?wn:String(e),onValueChange:e=>t(e===wn?void 0:Number(e)),children:[(0,q.jsx)(P,{id:`automation-once-latest`,className:`w-full sm:w-48`,"aria-label":`Latest start`,children:(0,q.jsx)(N,{})}),(0,q.jsx)(F,{children:n.map(e=>(0,q.jsx)(I,{value:e.minutes===void 0?wn:String(e.minutes),children:e.label},e.label))})]}),(0,q.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 Mn=[{type:`daily`,label:`Every day`},{type:`weekdays`,label:`Weekdays`},{type:`weekly`,label:`Weekly`},{type:`hours`,label:`Every N hours`},{type:`once`,label:`Once`}];function Nn({value:e,stored:t,onChange:n,timeZone:r}){let i=t=>n({...e,...t}),a=t=>i(t===`once`?{type:t,at:e.at??En(r),timeZone:e.timeZone??r}:{type:t});return(0,q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,q.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:Mn.map(t=>(0,q.jsx)(ln,{pressed:e.type===t.type,onClick:()=>a(t.type),children:t.label},t.type))}),e.type===`once`?(0,q.jsx)(On,{value:e,stored:t,onChange:n}):null,e.type===`weekly`?(0,q.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:dt.map((t,n)=>(0,q.jsx)(ln,{pressed:e.day===n+1,onClick:()=>i({day:n+1}),children:t},t))}):null,e.type===`once`?null:e.type===`hours`?(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(A,{htmlFor:`automation-every`,children:`Run every`}),(0,q.jsxs)(L,{value:String(e.every),onValueChange:e=>i({every:Number(e)}),children:[(0,q.jsx)(P,{id:`automation-every`,className:`w-full sm:w-48`,"aria-label":`Run every`,children:(0,q.jsx)(N,{})}),(0,q.jsx)(F,{children:ct.map(e=>(0,q.jsx)(I,{value:String(e),children:e===1?`hour`:`${e} hours`},e))})]}),(0,q.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,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,q.jsx)(Sn,{label:`Hour`,value:e.hour,max:23,onCommit:e=>i({hour:e})}),(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,q.jsx)(Sn,{label:`Minute`,value:e.minute,max:59,onCommit:e=>i({minute:e})}),(0,q.jsx)(`span`,{className:`text-sm break-all text-muted-foreground`,children:r})]}),e.type===`once`?null:(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Cron: `,(0,q.jsx)(`code`,{className:`font-mono text-foreground`,children:at(e)})]})]})}var Pn=40*864e5,Fn=5;function In({schedule:e,timeZone:t,now:n=Date.now()}){if(e.type===`once`)return(0,q.jsx)(Ln,{schedule:e,now:n});let r=et(e,n+1,n+Pn,t,Fn);return(0,q.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,"data-slot":`next-runs`,className:`min-w-0 rounded-xl border bg-card p-5`,children:[(0,q.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-2 text-base font-semibold`,children:`Next 5 runs`}),r.length===0?(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No runs in the next 40 days.`}):(0,q.jsx)(`ol`,{"aria-label":`Next 5 runs`,className:`grid divide-y divide-border text-sm`,children:r.map((e,r)=>(0,q.jsxs)(`li`,{className:`flex min-h-10 items-center justify-between gap-3 py-1.5`,children:[(0,q.jsx)(`span`,{className:r===0?`font-semibold tabular-nums text-foreground`:`font-medium tabular-nums`,children:H(new Date(e).toISOString(),t)}),(0,q.jsx)(`span`,{className:r===0?`font-medium text-accent-text`:`text-muted-foreground`,children:it(n,e)})]},e))}),(0,q.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Times are in `,t,`, the zone this Squawk runs in.`]})]})}function Ln({schedule:e,now:t}){let n=tt(e),r=ut(e);return(0,q.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,"data-slot":`next-runs`,className:`min-w-0 rounded-xl border bg-card p-5`,children:[(0,q.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-base font-semibold`,children:`Runs once`}),n===null||!r?(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pick a date, a time and a time zone.`}):(0,q.jsxs)(`p`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 text-sm`,children:[(0,q.jsx)(`span`,{className:`font-medium tabular-nums`,children:`${r.date} ${r.time}`}),n>t?(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:it(t,n)}):null]}),r?.note?(0,q.jsx)(`p`,{className:`mt-2 text-sm break-words`,children:r.note}):null,n!==null&&n<=t?(0,q.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:`The due time has passed.`}):null,(0,q.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 Rn={schedule:`On a schedule`,github:`When GitHub changes`};function zn(e){return/time zone|due time/i.test(e)?`when`:/autonomous/i.test(e)?`execution`:/placeholder|prompt|workflow|runner|model|task/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 Bn({title:e,icon:t,hideLegend:n=!1,failure:r,section:i,children:a}){let o=(0,U.useId)();return(0,q.jsxs)(`section`,{role:n?void 0:`group`,"aria-labelledby":n?void 0:o,className:`grid min-w-0 gap-3.5 rounded-xl border border-card-edge bg-card shadow-card p-5`,children:[n?null:t?(0,q.jsxs)(`h2`,{id:o,className:`flex items-center gap-2 text-base font-semibold text-foreground`,children:[t,e]}):(0,q.jsx)(`h2`,{id:o,className:`text-sm font-semibold text-foreground`,children:e}),a,r?.section===i&&!r.conflict?(0,q.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:r.message}):null]})}function Vn({draft:e,patch:t,forge:n,automation:r}){return(0,q.jsx)(q.Fragment,{children:r?(0,q.jsxs)(`p`,{className:`text-sm`,children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Trigger · `}),Rn[e.kind]]}):(0,q.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,q.jsx)(Ye,{slot:`automation-kind`,label:`Trigger`,size:`touch`,value:e.kind,onChange:e=>t({kind:e}),options:[{value:`schedule`,label:Rn.schedule},{value:`github`,label:Rn.github,disabled:!n.available,...n.available?{}:{title:n.reason??`GitHub is unavailable`}}]}),n.available?null:(0,q.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`GitHub unavailable · ${n.reason??`no GitHub access`}`})]})})}function Hn({draft:e,patch:t,forge:n,timeZone:r,automation:i}){return e.kind===`schedule`?(0,q.jsx)(Nn,{value:e.schedule,stored:i?.schedule,onChange:e=>t({schedule:e}),timeZone:r}):(0,q.jsx)(bn,{draft:e,onChange:t,...n.available?{}:{disabledReason:n.reason??`no GitHub access`}})}function Un({draft:e,patch:t}){let n=e.kind===`schedule`?[`date`,`time`,`project`,`automation`]:[`github.kind`,`github.number`,`github.title`,`github.url`,`github.author`,`github.assignees`,`github.labels`,`github.event`],r=[...new Set([...e.prompt.matchAll(/\{\{([^{}]+)\}\}/g)].map(e=>e[1]))].filter(e=>!n.includes(e));return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,q.jsx)(A,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,q.jsx)(Xe,{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,q.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:e.kind===`schedule`?(0,q.jsxs)(q.Fragment,{children:[`Available: `,`{{date}}`,` `,`{{time}}`,` `,`{{project}}`,` `,`{{automation}}`,`. A run-context block is appended automatically.`]}):(0,q.jsxs)(q.Fragment,{children:[`Available: `,`{{github.number}}`,` `,`{{github.title}}`,` `,`{{github.url}}`,` `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})})]}),r.length?(0,q.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:`Unavailable for this trigger: ${r.map(e=>`{{${e}}}`).join(`, `)}`}):null,(0,q.jsx)(Zn,{draft:e,patch:t})]})}function Wn({label:e,help:t,checked:n,onChange:r}){let i=(0,U.useId)();return(0,q.jsxs)(`label`,{htmlFor:i,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,q.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,q.jsx)(`span`,{id:`${i}-label`,children:e}),(0,q.jsx)(`span`,{id:`${i}-help`,className:`completion-control-help`,children:t})]}),(0,q.jsx)(Ee,{id:i,className:`completion-switch shrink-0`,checked:n,"aria-labelledby":`${i}-label`,"aria-describedby":`${i}-help`,onCheckedChange:r})]})}function Gn({draft:e,patch:t,saving:n,automation:r}){let i=e.kind===`schedule`,a=r?`Enabled`:`Enable after saving`,o=i&&e.schedule.type===`once`?`It runs once at the time set under When, then moves to Archived with its task.`:i?`The first run is the next occurrence in Next 5 runs.`:vn(e.filters.includeExisting);return(0,q.jsxs)(q.Fragment,{children:[(0,q.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,q.jsxs)(`div`,{"data-embedded":``,className:`grid min-w-0`,children:[(0,q.jsx)(Wn,{label:`Autonomous`,help:`Runs without waiting for answers.`,checked:e.autonomous,onChange:e=>t({autonomous:e})}),(0,q.jsx)(Be,{embedded:!0,archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,onChange:t,disabled:n}),(0,q.jsx)(ze,{embedded:!0,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging,onChange:t,disabled:n}),(0,q.jsx)(Wn,{label:a,help:o,checked:e.enabled,onChange:e=>t({enabled:e})})]}),r?(0,q.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`These settings apply to future tasks. Existing tasks keep their settings.`}):null]})}function Kn({automation:e,forge:t,timeZone:n,onSaved:r,onReload:i}){let[a,o]=(0,U.useState)(()=>Gt(e)),[s,c]=(0,U.useState)(e?.revision),[l,d]=(0,U.useState)(),[f,p]=(0,U.useState)(!1),m=e=>o(t=>({...t,...e})),g=async t=>{if(t.preventDefault(),f)return;let n=t.currentTarget;if(n instanceof HTMLFormElement&&!n.checkValidity()){n.reportValidity();return}p(!0),d(void 0);let i=`save`;try{if(e&&s!==void 0){let{automation:t}=await _(e.id,Xt({...a,enabled:e.enabled},s));c(t.revision),a.enabled!==e.enabled&&(i=`enable`,await h(e.id,a.enabled))}else await x(Yt(a));r()}catch(t){let n=t instanceof Error?t.message:String(t);i===`save`&&e&&t instanceof u&&t.status===409&&/revision conflict/i.test(n)?d({section:`form`,message:`Edited elsewhere — reload to see the latest version`,conflict:!0}):d({section:i===`enable`?`execution`:zn(n),message:n})}finally{p(!1)}},v=(0,U.useId)(),y=(0,U.useId)(),b=a.kind===`schedule`;return(0,q.jsx)(Me,{route:`automations`,density:a.name.trim()===``&&a.prompt.trim()===``?`sparse`:`full`,header:Xn({automation:e,draft:a,formId:v,saveHintId:y,saving:f}),children:(0,q.jsxs)(`form`,{id:v,className:`automation-editor grid min-w-0 gap-4 md:grid-cols-[minmax(0,1fr)_320px] md:grid-rows-[auto_1fr] md:items-start`,onSubmit:g,children:[(0,q.jsxs)(`div`,{className:`grid min-w-0 gap-3.5`,children:[(0,q.jsx)(Bn,{title:`Name`,hideLegend:!0,section:`name`,failure:l,children:(0,q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,q.jsx)(A,{htmlFor:`automation-name`,className:`text-sm font-semibold text-foreground`,children:`Name`}),(0,q.jsx)(V,{id:`automation-name`,className:`border-border`,value:a.name,placeholder:`Daily dependency audit`,onChange:e=>m({name:e.target.value}),required:!0})]})}),(0,q.jsxs)(Bn,{title:`When`,section:`when`,failure:l,children:[(0,q.jsx)(Vn,{draft:a,patch:m,forge:t,automation:e}),(0,q.jsx)(Hn,{draft:a,patch:m,forge:t,timeZone:n,automation:e})]}),(0,q.jsx)(Bn,{title:`What to run`,section:`run`,failure:l,children:(0,q.jsx)(Un,{draft:a,patch:m})})]}),(0,q.jsxs)(`aside`,{className:`grid min-w-0 max-w-full grid-cols-[minmax(0,1fr)] gap-4 md:sticky md:top-4 md:col-start-2 md:row-span-2 md:row-start-1`,children:[(0,q.jsx)(Bn,{title:`Execution settings`,icon:(0,q.jsx)(ye,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),section:`execution`,failure:l,children:(0,q.jsx)(Gn,{draft:a,patch:m,saving:f,automation:e})}),b?(0,q.jsx)(In,{schedule:a.schedule,timeZone:n}):(0,q.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-5`,children:[(0,q.jsx)(`h2`,{className:`mb-2 text-base font-semibold`,children:`How it polls`}),(0,q.jsx)(`p`,{className:`text-sm break-words text-muted-foreground`,children:yn(a)})]}),(0,q.jsx)(cn,{draft:a,saveLabel:Jn(e,a),editing:e!==void 0})]}),l?.section===`form`||e?(0,q.jsxs)(`div`,{className:`grid min-w-0 gap-3.5 md:col-start-1`,children:[l?.section===`form`?(0,q.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 text-sm text-destructive`,children:[(0,q.jsx)(`span`,{className:`break-words`,children:l.message}),l.conflict&&i?(0,q.jsx)(M,{type:`button`,variant:`outline`,onClick:i,children:`Reload`}):null]}):null,e?(0,q.jsx)(qn,{automation:e,onDeleted:r}):null]}):null]})})}function qn({automation:e,onDeleted:t}){let[n,r]=(0,U.useState)(!1),[i,a]=(0,U.useState)(!1),[o,s]=(0,U.useState)(``),c=async()=>{if(!i){a(!0),s(``);try{await ee(e.id),t()}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}};return(0,q.jsxs)(`div`,{className:`grid justify-items-start gap-2 border-t pt-4`,children:[n?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? It will stop running and cannot be restored.`}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(M,{type:`button`,variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:i,onClick:()=>void c(),children:`Delete automation`}),(0,q.jsx)(M,{type:`button`,variant:`outline`,disabled:i,onClick:()=>{r(!1),s(``)},children:`Keep`})]})]}):(0,q.jsx)(M,{type:`button`,variant:`outline`,"data-action":`automation-delete`,onClick:()=>r(!0),children:`Delete`}),o?(0,q.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:o}):null]})}function Jn(e,t){return e?`Save changes`:t.enabled?`Save and enable`:`Save paused`}function Yn(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 Xn({automation:e,draft:t,formId:n,saveHintId:r,saving:i}){let a=t.name.trim()?t.prompt.trim()?``:`Prompt`:`Name`,o=Yn(t),s=Jn(e,t);return{title:e?`Edit automation`:`New automation`,subtitle:`Define when it runs and the ordinary task it launches.`,status:(0,q.jsx)(`p`,{id:r,"data-slot":`automation-save-hint`,className:`min-h-[1lh] text-xs text-muted-foreground`,children:o}),secondaryActions:(0,q.jsx)(z,{type:`button`,variant:`outline`,asChild:!0,children:(0,q.jsx)(R,{to:`/automations`,children:`Cancel`})}),primaryAction:(0,q.jsx)(z,{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 Zn({draft:e,patch:t}){let n=s(),l=Ne(),{runners:u,signedOut:d}=l.runnersOn(e=>l.repoAccount?.[e]),f=o(),p=r(),{runner:m,ready:h}=a(e.runner??f.data?.defaultRunner??`claude`),g=c(m,h,l.repoAccount?.[m]),_=[...new Set([...(n.data?.workflows??[]).map(e=>e.name),...e.workflow?[e.workflow]:[]])],v=[...new Set([...u,...e.runner?[e.runner]:[]])],y=Ve(m,p.data,g.data,[e.model]),b=y.find(t=>t.id===(e.model??``))?.label??e.model??`Runner default`,x=e=>(0,q.jsx)(e,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`});return(0,q.jsx)(Ge,{children:(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(We,{slot:`automation-workflow-pill`,icon:x(_e),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:_.map(e=>({value:e,label:e})),onPick:e=>t({workflow:e})}),(0,q.jsx)(We,{slot:`automation-runner-pill`,icon:x(be),fieldLabel:!0,ariaLabel:`Runner`,label:e.runner?i(p.data,e.runner):`default`,value:e.runner??``,disabled:!p.data,options:[{value:``,label:`default`,desc:`The project’s default runner`},...v.map(e=>({value:e,label:i(p.data,e)}))],footer:(0,q.jsx)(Ie,{uninstalled:l.uninstalled,signedOut:d.filter(t=>t!==e.runner)}),onPick:e=>{t({runner:e||void 0,model:void 0})}}),(0,q.jsx)(We,{slot:`automation-model-pill`,icon:x(ge),fieldLabel:!0,ariaLabel:`Model`,label:b,value:e.model??``,options:y.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 $n({data:e,error:t,refresh:n,archived:r=!1,onArchivedChange:i}){let[a,o]=(0,U.useState)({}),[s,c]=(0,U.useState)({}),l=(e,t)=>o(n=>{let{[e]:r,...i}=n;return t?{...i,[e]:t}:i}),u=async(e,t,n=!1)=>{c(t=>({...t,[e]:!0}));try{await t()}catch(t){let r=t instanceof Error?t.message:String(t);l(e,n?Qn(r):{text:r,tone:`error`})}finally{c(t=>({...t,[e]:!1}))}},d=e=>u(e.id,async()=>{l(e.id,{text:`Starting…`,tone:`info`});let{runId:t}=await f(e.id);l(e.id,{text:`Started task`,tone:`info`,runId:t}),n()}),p=e=>u(e.id,async()=>{l(e.id,void 0),await h(e.id,!e.enabled),await n()}),m=e=>u(e.id,async()=>{l(e.id,void 0),await ne(e.id),await n()}),g=e=>u(e.id,async()=>{l(e.id,{text:`Checking…`,tone:`info`});let{checkId:t}=await ie(e.id,`preview`);for(let r=0;r<60;r+=1){let r=await te(t);if(r.status===`complete`){l(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`;l(e.id,Qn(t));return}await new Promise(e=>setTimeout(e,500))}throw Error(`Preview is still running`)},!0),_=e?.automations??[],v=_.filter(e=>!e.archived),y=_.filter(e=>!!e.archived),b=r?y:v;return(0,q.jsx)(B,{route:`automations`,density:e?ke(b.length):`full`,headerSpacing:`compact`,header:{title:`Automations`,subtitle:`Schedules and GitHub checks run while Squawk is open.`,primaryAction:(0,q.jsx)(z,{variant:`primary`,asChild:!0,children:(0,q.jsxs)(R,{to:`/automations/new`,children:[(0,q.jsx)(me,{"aria-hidden":`true`,className:`size-4`}),`New automation`]})})},sparseFooter:e&&b.length>0&&!r?(0,q.jsx)(je,{summary:`${b.length} active ${b.length===1?`automation`:`automations`} configured. New automations start paused so you can test filters before enabling them.`,actions:(0,q.jsx)(M,{variant:`outline`,size:`sm`,asChild:!0,children:(0,q.jsx)(R,{to:`/automations/new`,children:`Add another`})})}):void 0,children:t&&!e?(0,q.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,q.jsx)(J,{text:t}),(0,q.jsx)(M,{variant:`outline`,onClick:()=>void n(),children:`Retry`})]}):e?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-end justify-between gap-3 border-b border-border`,children:[i?(0,q.jsxs)(`div`,{className:`flex gap-6`,role:`group`,"aria-label":`Filter automations`,children:[(0,q.jsxs)(`button`,{type:`button`,"data-slot":`automations-tab`,"data-view":`active`,"aria-pressed":!r,onClick:()=>i(!1),className:j(`-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`,!r&&`border-accent-text text-foreground`),children:[`Current`,(0,q.jsx)(er,{count:v.length})]}),(0,q.jsxs)(`button`,{type:`button`,"data-slot":`automations-tab`,"data-view":`archived`,"aria-pressed":r,onClick:()=>i(!0),className:j(`-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`,r&&`border-accent-text text-foreground`),children:[`Archived`,(0,q.jsx)(er,{count:y.length})]})]}):(0,q.jsx)(`span`,{}),(0,q.jsx)(`div`,{className:`pb-2.5`,children:(0,q.jsx)(tr,{data:e})})]}),r&&b.length===0?(0,q.jsx)(J,{text:`No archived automations.`}):b.length===0?(0,q.jsx)(Fe,{icon:(0,q.jsx)(ve,{}),tone:`neutral`,title:`No automations yet`,subtitle:`Create one paused, preview it, then enable it.`,heading:`h2`,actions:(0,q.jsx)(M,{variant:`primary`,asChild:!0,children:(0,q.jsxs)(R,{to:`/automations/new`,children:[(0,q.jsx)(me,{"aria-hidden":`true`,className:`size-4`}),`New automation`]})})}):(0,q.jsx)(`ul`,{className:`grid gap-3`,"aria-label":`Automations`,children:b.map(t=>(0,q.jsx)(ur,{automation:t,timeZone:e.timeZone,note:a[t.id],busy:s[t.id]===!0,onRun:()=>void d(t),onToggle:()=>void p(t),onPreview:()=>void g(t),onCancel:()=>void m(t)},t.id))})]}):(0,q.jsx)(J,{text:`Loading automations…`})})}function er({count:e}){return e===0?null:(0,q.jsx)(`span`,{"data-slot":`automations-tab-count`,className:`tabular-nums text-muted-foreground`,children:`· ${e}`})}function tr({data:e}){return(0,q.jsx)(`p`,{"data-slot":`automation-scheduler`,className:j(`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 nr(e){return e.kind===`schedule`&&e.schedule?rt(e.schedule):`${fn(e.events??[])} · every ${Math.round((e.intervalSeconds??300)/60)} min`}function rr({automation:e,nextRun:t}){let n=e.kind===`schedule`?he:pe,r=Je(e);return(0,q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsxs)(`h2`,{className:`flex items-center gap-2 font-semibold break-words`,children:[(0,q.jsx)(n,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),e.name]}),(0,q.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,q.jsx)(`span`,{children:nr(e)}),t?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),t]}):null]})]}),(0,q.jsx)(Ke,{dot:r.tone,shape:r.shape,pulse:r.pulse,children:r.label})]})}function ir({automation:e,archive:t}){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`text-sm break-words`,children:[t.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`,t.runId?(0,q.jsxs)(q.Fragment,{children:[` · `,(0,q.jsx)(R,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${t.runId}`,children:`Open task`})]}):null]}),(0,q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,q.jsx)(M,{variant:`outline`,asChild:!0,children:(0,q.jsx)(R,{to:`/automations/${e.id}`,children:`Details`})})})]})}function ar({automation:e,timeZone:t}){let n=e.kind===`schedule`,r=e.enabled&&n?e.nextRunAt:void 0;return!n&&e.enabled?(0,q.jsx)(`span`,{children:`continuous`}):r?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`text-foreground`,children:`Next run: ${H(r,t)}`}),(0,q.jsx)(`span`,{children:`· ${it(Date.now(),Date.parse(r))}`})]}):(0,q.jsx)(`span`,{children:`Next run: —`})}function or({automation:e,timeZone:t}){let n=e.enabled?xt(e.state):void 0;return n?(0,q.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,q.jsx)(`span`,{className:`text-muted-foreground`,children:` · Next try ${H(n.retryAt,t)}`}):null]}):null}var $=`px-3`;function sr({automation:e,busy:t,confirmingCancel:n,cancelRef:r,onToggle:i,onRun:a,onPreview:o,onOpenCancel:s}){let c=e.kind===`schedule`,l=e.schedule?.type===`once`;return(0,q.jsxs)(`div`,{"data-slot":`automation-actions`,className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(M,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-toggle`,disabled:t,onClick:i,children:e.enabled?`Pause`:`Enable`}),c?(0,q.jsx)(M,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-run`,disabled:t,onClick:a,children:`Run now`}):(0,q.jsx)(M,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-preview`,disabled:t,onClick:o,children:`Test filter`}),(0,q.jsx)(M,{variant:`outline`,size:`sm`,className:$,asChild:!0,children:(0,q.jsx)(R,{to:`/automations/${e.id}`,children:`Edit`})}),l&&!n?(0,q.jsx)(M,{variant:`outline`,size:`sm`,className:j($,`text-destructive`),ref:r,"data-action":`automation-cancel`,disabled:t,onClick:s,children:`Cancel`}):null,(0,q.jsx)(M,{variant:`outline`,size:`sm`,className:j($,`sm:ms-auto`),asChild:!0,children:(0,q.jsx)(R,{to:`/automations/${e.id}/log`,children:`Execution log`})})]})}function cr({automation:e,busy:t,keepRef:n,onConfirm:r,onKeep:i}){return(0,q.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,q.jsx)(`p`,{className:`text-sm break-words`,children:`Cancel “${e.name}”? It will never run, and it moves to Archived.`}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(M,{variant:`danger-ghost`,"data-action":`automation-cancel-confirm`,disabled:t,onClick:r,children:`Cancel schedule`}),(0,q.jsx)(M,{ref:n,variant:`outline`,disabled:t,onClick:i,children:`Keep`})]})]})}function lr({note:e}){return(0,q.jsxs)(`div`,{role:e.tone===`error`?`alert`:`status`,className:j(`text-sm break-words`,e.tone===`error`?`text-destructive`:`text-muted-foreground`),children:[e.text,e.details?(0,q.jsxs)(q.Fragment,{children:[` · `,(0,q.jsx)(de,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:Pe(`gh`),children:`Set up`}),(0,q.jsxs)(`details`,{children:[(0,q.jsx)(`summary`,{className:`min-h-11 cursor-pointer`,children:`Command details`}),(0,q.jsx)(`pre`,{className:`whitespace-pre-wrap break-words`,children:e.details})]})]}):null,e.runId?(0,q.jsxs)(q.Fragment,{children:[` · `,(0,q.jsx)(R,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`})]}):null]})}function ur({automation:e,timeZone:t,note:n,busy:r,onRun:i,onToggle:a,onPreview:o,onCancel:s}){let[c,l]=(0,U.useState)(!1),u=(0,U.useRef)(null),d=(0,U.useRef)(null),f=(0,U.useRef)(null);(0,U.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,q.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,q.jsx)(rr,{automation:e,nextRun:h?void 0:(0,q.jsx)(ar,{automation:e,timeZone:t})}),h?(0,q.jsx)(ir,{automation:e,archive:h}):null,h?null:(0,q.jsx)(or,{automation:e,timeZone:t}),h?null:(0,q.jsx)(sr,{automation:e,busy:r,confirmingCancel:c,cancelRef:u,onToggle:a,onRun:i,onPreview:o,onOpenCancel:p}),e.schedule?.type===`once`&&!h&&c?(0,q.jsx)(cr,{automation:e,busy:r,keepRef:d,onConfirm:()=>{l(!1),s()},onKeep:m}):null,n?(0,q.jsx)(lr,{note:n}):null,(0,q.jsx)(Nt,{automationId:e.id,automationName:e.name,timeZone:t})]})}function dr(e){let t=Oe(),n=Re(),[r,i]=(0,U.useState)(),[a,o]=(0,U.useState)(``),s=(0,U.useCallback)(t=>oe({signal:t,...e?{archived:e}:{}}).then(e=>{t?.aborted||(i(e),o(``))}).catch(e=>{t?.aborted||o(String(e))}),[e]);return(0,U.useEffect)(()=>{n&&s()},[n,s]),(0,U.useEffect)(()=>ae(async e=>{n&&await s(e)}),[n,s]),(0,U.useEffect)(()=>fe((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 fr({mode:e=`list`}){let{automationId:t}=ue(),n=De(),[r,i]=(0,U.useState)(!1),{data:a,error:o,refresh:s}=dr(`include`),[c,l]=(0,U.useState)(0),u=Le();if(u===`unknown`)return(0,q.jsx)(B,{route:`automations`,density:`empty`,children:(0,q.jsx)(J,{text:`Loading automations…`})});if(u===`absent`)return(0,q.jsx)(qe,{});if(u===`disabled`)return(0,q.jsx)(B,{route:`automations`,density:`empty`,children:(0,q.jsx)(Fe,{icon:(0,q.jsx)(ve,{}),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,q.jsx)($n,{data:a,error:o,refresh:s,archived:r,onArchivedChange:i});if(!a)return o?(0,q.jsx)(B,{route:`automations`,density:`empty`,header:{title:`Automations`,subtitle:`Could not load automations.`},children:(0,q.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,q.jsx)(J,{text:o}),(0,q.jsx)(M,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]})}):(0,q.jsx)(B,{route:`automations`,density:`empty`,children:(0,q.jsx)(J,{text:`Loading automations…`})});let p={available:a.available,...a.reason?{reason:a.reason}:{}};return e===`new`?(0,q.jsx)(Kn,{forge:p,timeZone:a.timeZone,onSaved:d}):e===`edit`?f?f.archived?(0,q.jsx)(Pt,{automation:f,timeZone:a.timeZone,onDeleted:d}):(0,q.jsx)(Kn,{automation:f,forge:p,timeZone:a.timeZone,onSaved:d,onReload:()=>void s().then(()=>l(e=>e+1))},`${f.id}:${c}`):(0,q.jsx)(B,{route:`automations`,density:`empty`,header:{title:`Automation not found`,subtitle:`This automation may have been removed.`},children:(0,q.jsx)(M,{asChild:!0,variant:`outline`,children:(0,q.jsx)(R,{to:`/automations`,children:`Back to automations`})})}):t?(0,q.jsx)(Mt,{automationId:t,automationName:f?.name,timeZone:a.timeZone,readOnly:!!f?.archived}):(0,q.jsx)(J,{text:`Automation not found.`})}export{fr as AutomationsRoute};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Cn as r}from"./toaster-Dglox5F-.js";import{o as i}from"./dist-CCX8mhHc.js";import{M as a,Q as o,ct as s,r as c}from"./design-icons-QbNMZniQ.js";import{n as l,r as u}from"./diff-controls-Bb70UBsP.js";import{t as d}from"./search-x-I9Q8pgUa.js";import{t as f}from"./button-BV_AiLj2.js";import{t as p}from"./project-router-CPgPVoBJ.js";import{m}from"./page-shell-BdjH5hyc.js";import{t as h}from"./centered-state-N8vWM_Hw.js";import{Bn as g,Ln as _,Xt as v,Zt as y,lr as b,o as x}from"./index-k2m-s5zD.js";import{t as S}from"./diff-CkIsqgZZ.js";var C=e(t(),1),w=n();function T({commit:e,sha:t,slot:n,heading:o=`h2`,diffRef:c,loadFileText:f,className:p}){let y=m(),[b,x]=(0,C.useState)(`unified`),[T,D]=(0,C.useState)(!0),O=(0,C.useRef)(null);E(O,t);let k=e.isError&&e.error instanceof r&&e.error.status===409;return(0,w.jsx)(`section`,{ref:O,"data-slot":n,"data-sha":t,"aria-label":`Selected commit`,className:i(`min-w-0 flex-1 scroll-mt-4 overflow-clip rounded-xl border border-border bg-card`,p),children:e.isPending?(0,w.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-8 text-center text-xs text-muted-foreground`,children:`Loading commit diff…`}):e.isError?(0,w.jsx)(h,{icon:k?(0,w.jsx)(d,{}):(0,w.jsx)(s,{size:16}),tone:k?`neutral`:`danger`,heading:`h2`,title:k?`Commit not found`:`Could not load commit diff`,subtitle:e.error.message}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{"data-slot":`commit-meta`,className:`flex flex-wrap items-start gap-x-3 gap-y-2 border-b border-border px-4 py-3`,children:[(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(o,{className:`break-words text-sm leading-snug font-semibold text-foreground`,children:e.data.subject}),(0,w.jsxs)(`p`,{className:`mt-0.5 flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,w.jsx)(`span`,{children:e.data.author}),(0,w.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,w.jsx)(`span`,{title:e.data.when,children:v(e.data.when)}),(0,w.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,w.jsx)(g,{sha:e.data.sha,variant:`inline`}),(0,w.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,w.jsx)(`span`,{"data-slot":`commit-stat`,children:(0,w.jsx)(_,{stat:e.data.stat})})]})]}),(0,w.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,w.jsx)(u,{mode:b,wrap:T,onModeChange:x,onWrapChange:D}),(0,w.jsx)(l,{wrap:T,onWrapChange:D})]})]}),e.data.files.length===0?(0,w.jsx)(h,{icon:(0,w.jsx)(a,{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,w.jsx)(`div`,{className:`p-4 [--diff-sticky-top:0px]`,children:(0,w.jsx)(S,{...c?{viewRef:c}:{},...f?{loadFileText:f}:{},files:e.data.files,mode:y?b:`unified`,wrap:T,totals:!1,className:`min-w-0`},t)})]})})}function E(e,t){let n=(0,C.useRef)(t);(0,C.useLayoutEffect)(()=>{if(n.current===t)return;n.current=``;let r=e.current,i=r?.closest(`[data-slot="main"]`);if(!(!r||!i)&&r.getBoundingClientRect().top<i.getBoundingClientRect().top){let e=typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;r.scrollIntoView?.({block:`start`,behavior:e?`auto`:`smooth`})}},[e,t])}function D({commit:e,sha:t,backTo:n,backLabel:r,slot:i,loadFileText:a,diffRef:o}){return(0,w.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,w.jsx)(`div`,{className:`mx-4 border-b border-border py-2`,children:(0,w.jsx)(f,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,w.jsxs)(p,{to:n,children:[(0,w.jsx)(c,{size:16,"aria-hidden":`true`}),r]})})}),(0,w.jsx)(T,{commit:e,sha:t,slot:i,loadFileText:a,...o?{diffRef:o}:{},className:`rounded-none border-0 bg-transparent`})]})}var O=56;function k({slot:e,commits:t,selectedSha:n,className:r,heading:a}){let[s,c]=(0,C.useState)(``),l=s.trim().toLowerCase(),u=l?t.filter(e=>e.subject.toLowerCase().includes(l)):t,d=u.length>150,f=(0,C.useRef)(null),p=(0,C.useRef)(null),[m,h]=(0,C.useState)(0);(0,C.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 g=u.map(e=>(0,w.jsx)(A,{commit:e,selected:n!==void 0&&e.sha===n},e.sha));return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`label`,{className:`relative mb-3 block`,children:[(0,w.jsx)(o,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3 left-3 size-4 text-muted-foreground`}),(0,w.jsx)(b,{"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,w.jsxs)(`div`,{ref:e=>{f.current=e,e&&(p.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":d,className:i(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-3 py-1 md:px-4`,r),children:[a?(0,w.jsx)(`div`,{className:`flex min-h-11 flex-wrap items-center gap-2 py-2.5`,children:a}):null,u.length===0?(0,w.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,d?(0,w.jsx)(x,{scrollRef:p,startMargin:m,itemSize:O,children:g}):g]})]})}function A({commit:e,selected:t}){return(0,w.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_56px] [content-visibility:auto]`,children:(0,w.jsxs)(p,{"data-slot":`commit-row`,"data-sha":e.sha,"data-selected":t?`true`:void 0,"aria-current":t?`true`:void 0,to:e.href,className:i(`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,w.jsx)(a,{size:16,"aria-hidden":`true`,className:`mt-px size-4 shrink-0 text-accent-text`}),(0,w.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,w.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,w.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,w.jsx)(j,{sha:e.sha}),(0,w.jsxs)(`span`,{className:`min-w-0 truncate`,children:[e.author,` · `,(0,w.jsx)(`span`,{title:y(e.when,e.at),children:v(e.when,e.at)})]}),e.stat?(0,w.jsx)(_,{stat:e.stat}):null]})]})]})})}function j({sha:e}){return(0,w.jsx)(g,{"data-slot":`commit-sha`,sha:e,variant:`chip`})}export{T as i,j as n,D as r,k as t};
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-DLcxtXIH.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/dist-CCX8mhHc.js","assets/bundle-mjs-rHxsej31.js","assets/chevron-right-BENZ-1ZN.js","assets/createLucideIcon-BHp8sXmF.js","assets/eye-B8okNWXU.js","assets/button-BV_AiLj2.js","assets/diff-stat-DCO_BkZB.js","assets/index-k2m-s5zD.js","assets/queries-DHjNE2es.js","assets/host-context-iTMFRMT5.js","assets/toaster-Dglox5F-.js","assets/live-protocol-CNUmr-VT.js","assets/host-storage-Cr_NKfWy.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-BdLLx37K.js","assets/reference-chip-kvc51N1L.js","assets/design-icons-QbNMZniQ.js","assets/popover-BQolmvDR.js","assets/es2015-BHonSvOU.js","assets/dist-Du6flkGD.js","assets/dist-ClMNSUvT.js","assets/attention-CFW302LY.js","assets/task-groups-BapM4YcT.js","assets/label-ODcSLYVj.js","assets/cez-idle-C0drOeLs.js","assets/hosts-IKDCpyJQ.js","assets/run-detail-refresh-wJr0M04e.js","assets/open-in-menu-CbPtuWnJ.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/dropdown-menu-NJZfnQCU.js","assets/dist-B2_vvox1.js","assets/own-lookup-DS54wXvD.js","assets/check-OP-CVgZG.js","assets/chevron-down-CHGyCDBH.js","assets/nav-row-styles-CIedRn3A.js","assets/folder-browser-Cdm2WZOB.js","assets/loader-circle-CPBhhDbB.js","assets/play-CmVAj_fu.js","assets/search-x-I9Q8pgUa.js","assets/preview-B5bPk6HT.js","assets/dist-CyFJ-9Ex.js","assets/switch-B9OfOEzC.js","assets/dist-Czz3Y5qH.js","assets/badge-DAnkqD7i.js","assets/dialog-DKr-j9S6.js","assets/project-router-CPgPVoBJ.js","assets/read-state-jUDTdM3R.js","assets/status-dot-DuorWA5M.js","assets/report-selection-DxBxW6dz.js","assets/use-search-params-writer-DD5PEEZw.js","assets/page-shell-BdjH5hyc.js","assets/page-shell-CEIoW56O.css","assets/format-BU7D3IfE.js","assets/command-4D8sPZJy.js","assets/project-order-AcHI4Dcl.js","assets/skills-pM_PouEs.js","assets/agent-accounts-DaaS69XB.js","assets/control-locations-kCPVEtOM.js","assets/agents-settings-path-7X6_cvUg.js","assets/centered-state-N8vWM_Hw.js","assets/html-report-BX3msvci.js","assets/index-D1E0Dmck.css","assets/highlighter-Crq-WTmN.js","assets/image-preview-C_xACQXI.js","assets/zoomable-image-DJ1lJEMc.js","assets/textarea-BGp28xFr.js","assets/markdown-BBDDg-4t.js","assets/markdown-C1p1PDmF.js","assets/chunk-BO2N2NFS-DQrpGzb-.js","assets/lib-DrPFkMXk.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{t as r}from"./preload-helper-Czpn1I53.js";import{o as i}from"./dist-CCX8mhHc.js";import{t as a}from"./diff-stat-DCO_BkZB.js";import{n as o,r as s,t as c}from"./image-preview-C_xACQXI.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 r(()=>import(`./diff-view-DLcxtXIH.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,70,71,72,73,74,75,76])),()=>{e=!0}},[]),e.files.length===0?(0,u.jsx)(`p`,{"data-slot":`diff-empty`,className:i(`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:i(`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:r,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:i(`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:r},`${e.oldPath??``}→${e.path}`))]})}function p({file:e,wrap:t,imageSrc:n,onOpenInApp:r}){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:r}):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:i(`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:i(`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};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$ as r}from"./queries-DHjNE2es.js";import{Cn as i,Gt as a}from"./toaster-Dglox5F-.js";import{d as o,m as s,p as c}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as l}from"./dist-CCX8mhHc.js";import{T as u,ct as d}from"./design-icons-QbNMZniQ.js";import{t as f}from"./createLucideIcon-BHp8sXmF.js";import{o as p}from"./diff-controls-Bb70UBsP.js";import{t as m}from"./centered-state-N8vWM_Hw.js";import{r as h}from"./html-report-BX3msvci.js";import{a as g,i as _,r as v}from"./highlighter-Crq-WTmN.js";import{n as y,t as b}from"./markdown-C1p1PDmF.js";import{t as x}from"./html-report-frame-Bk6UkqKa.js";var S=f(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),C=f(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),w=f(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),T=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`ico`,`avif`]);function E(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:T.has(t.slice(n+1).toLowerCase())}function D(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return E(e)||n>0&&t.slice(n+1).toLowerCase()===`svg`}var O=e(t(),1);function k(e){return e.tooLarge?`too-large`:D(e.path)?`image`:e.binary?`binary`:`text`}function A(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}var j=n();function M({runId:e,path:t,className:n}){let a=r(e,t??void 0);if(t===null)return(0,j.jsx)(z,{className:n,children:(0,j.jsx)(m,{icon:(0,j.jsx)(u,{size:16}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from this task’s worktree to inspect its contents.`,className:`[&_[data-slot=centered-state-tile]]:size-10 [&_[data-slot=centered-state-tile]]:border-0 [&_[data-slot=centered-state-tile]]:bg-transparent [&_[data-slot=centered-state-tile]]:text-accent-text [&_[data-slot=centered-state-tile]]:shadow-none [&_h2]:text-xl`})});if(a.isPending)return(0,j.jsx)(z,{className:n,children:(0,j.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(a.isError){let e=a.error instanceof i&&a.error.status===409;return(0,j.jsx)(z,{className:n,children:(0,j.jsx)(m,{icon:e?(0,j.jsx)(w,{}):(0,j.jsx)(d,{size:16}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:a.error.message})})}return a.data.type===`file`?(0,j.jsx)(F,{runId:e,entry:a.data,className:n}):(0,j.jsx)(z,{className:n,children:(0,j.jsx)(m,{icon:(0,j.jsx)(C,{}),tone:`neutral`,heading:`h2`,title:`Choose a file inside this directory`,subtitle:`Expand the folder in the tree, or enter the full path to a file.`})})}function N(e,t,n){let r=t?.replace(/\/+$/,``);if(r&&e.startsWith(`${r}/`))return e.slice(r.length+1);let i=/^.*\/\.ai\/(?:cezar|squawk)\/worktrees\/[^/]+\/(.+)$/.exec(e);if(i?.[1])return i[1];if(e.startsWith(`/`)&&n&&!n.startsWith(`/`)){let t=n.replace(/^\.?\//,``);if(t&&(e===`/${t}`||e.endsWith(`/${t}`)))return t}return e}function P(e,t,n){let r=t&&/\.(?:md|markdown)$/i.test(e.path),i=t&&h(e.path),a=/\.(?:png|jpe?g|gif|webp|bmp|ico|avif)$/i.test(e.path),o=t&&a&&e.size<=10*1024*1024?`image`:k(e);return{html:i,kind:o,toggle:(r||i)&&o===`text`,showImage:o===`image`&&(!t||a),rendered:n?null:r?`markdown`:i?`html`:null}}function F({runId:e,entry:t,displayPath:n,className:r,imageUrl:i,downloadUrl:a,snapshot:o,readerHref:s,documentPreview:c=!1}){let[u,d]=(0,O.useState)(!1),[f,m]=(0,O.useState)(!0),h=n??N(t.path),g=P(t,c,u),_=!!(o||a||g.toggle),v=!g.showImage&&g.kind===`text`&&g.rendered===null;return(0,j.jsxs)(z,{className:r,children:[(0,j.jsxs)(`header`,{"data-slot":`file-preview-head`,className:l(`flex min-h-11 items-center gap-2 border-b border-border bg-muted/40 ps-4 text-xs`,v?`pe-2 py-1`:`pe-4 py-2.5`),children:[(0,j.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium text-foreground`,title:h,children:h}),(0,j.jsx)(`span`,{"data-slot":`file-preview-size`,className:`ml-auto shrink-0 font-mono text-xs tabular-nums text-muted-foreground`,children:A(t.size)}),v?(0,j.jsx)(p,{wrap:f,onWrapChange:m,className:`rounded-md`}):null]}),_?(0,j.jsx)(L,{snapshot:o,downloadUrl:a,source:g.toggle?u:null,onSource:()=>d(e=>!e),readerHref:g.html&&g.kind===`text`?s:void 0}):null,(0,j.jsx)(I,{runId:e,entry:t,kind:g.kind,showImage:g.showImage,rendered:g.rendered,imageUrl:i,wrap:f})]})}function I({runId:e,entry:t,kind:n,showImage:r,rendered:i,imageUrl:o,wrap:s}){return r?(0,j.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,j.jsx)(`img`,{"data-slot":`file-preview-image`,src:o??a(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):n===`too-large`?(0,j.jsx)(m,{icon:(0,j.jsx)(S,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${A(t.size)} — past the preview cap. Open it in your editor instead.`}):n===`binary`?(0,j.jsx)(m,{icon:(0,j.jsx)(C,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${A(t.size)} of binary data — no text preview.`}):i===`markdown`?(0,j.jsx)(`div`,{className:`p-4`,children:(0,j.jsx)(b,{document:!0,children:t.content??``})}):i===`html`?(0,j.jsx)(x,{html:t.content??``,title:`Report: ${t.path}`,className:`h-[70vh]`}):(0,j.jsx)(H,{path:t.path,text:t.content??``,wrap:s})}function L({snapshot:e,downloadUrl:t,source:n,onSource:r,readerHref:i}){return(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-b border-border px-4 py-2 text-xs`,children:[e?(0,j.jsxs)(`span`,{children:[`Published snapshot · `,e]}):null,t?(0,j.jsx)(`a`,{className:`inline-flex min-h-11 items-center text-accent-text underline`,href:t,children:`Download`}):null,n===null?null:(0,j.jsx)(`button`,{className:`min-h-11 rounded px-2 text-accent-text underline focus-visible:ring-2`,onClick:r,children:n?`Preview`:`View source`}),i?(0,j.jsx)(R,{href:i}):null]})}function R({href:e}){let t=s(),n=c();return(0,j.jsx)(`a`,{className:`inline-flex min-h-11 items-center px-2 text-accent-text underline focus-visible:ring-2`,href:o(e),onClick:r=>y(r,t,e,n),children:`Open reader`})}function z({className:e,children:t}){return(0,j.jsx)(`section`,{"data-slot":`file-preview`,className:l(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var B=1500;function V(e,t){let n=(0,O.useMemo)(()=>t.split(`
2
- `).map(e=>[{content:e}]),[t]),r=(0,O.useMemo)(()=>g(e),[e]),i=n.length>B,[a,o]=(0,O.useState)(null);return(0,O.useEffect)(()=>{if(r===null||i)return;let n=!1;return v(t,r).then(r=>{n||o({key:`${e}\0${t}`,tokens:r.tokens})}),()=>{n=!0}},[e,t,r,i]),r===null||i?n:a?.key===`${e}\0${t}`?a.tokens:_(t,r)?.tokens??n}function H({path:e,text:t,wrap:n=!1}){let r=V(e,t);return(0,j.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":g(e)??`plaintext`,className:`overflow-x-auto overscroll-x-contain py-2 font-mono text-xs leading-[1.7] [scrollbar-width:thin]`,children:(0,j.jsx)(`div`,{className:n?`min-w-0`:`w-max min-w-full`,children:r.map((e,t)=>(0,j.jsxs)(`div`,{className:`flex`,children:[(0,j.jsx)(`span`,{className:`sticky left-0 w-14 shrink-0 select-none bg-card pr-3 pl-4 text-right tabular-nums text-muted-foreground`,children:t+1}),(0,j.jsx)(`span`,{className:l(`min-w-0 flex-1 pr-6`,n?`whitespace-pre-wrap wrap-anywhere`:`whitespace-pre`),children:e.map((e,t)=>(0,j.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})})}export{A as a,C as c,N as i,S as l,F as n,D as o,M as r,w as s,H as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{gt as t}from"./queries-DHjNE2es.js";import{Cn as n}from"./toaster-Dglox5F-.js";import{o as r}from"./dist-CCX8mhHc.js";import{t as i}from"./createLucideIcon-BHp8sXmF.js";import{t as a}from"./chevron-right-BENZ-1ZN.js";import{t as o}from"./folder-o-AvL3y3.js";var s=i(`corner-left-up`,[[`path`,{d:`M14 9 9 4 4 9`,key:`1af5af`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`,key:`1blwi3`}]]),c=e(),l=`x-apple.systempreferences:com.apple.preference.security?Privacy_FilesAndFolders`,u=`inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-foreground hover:bg-muted`;function d(e){let t=e.replace(/[\\/]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n<0?null:n===0?t.slice(0,1):t.slice(0,n)}function f({path:e,selected:n,onSelect:i,onEnter:l,decorate:u,emptyHint:d,showHidden:f=!1}){let m=t(e,f),h=m.data?.parent??null;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`p`,{"data-slot":`fs-breadcrumb`,className:`truncate font-mono text-xs text-soft-foreground`,title:m.data?.path??void 0,children:m.data?.path??(m.isError?``:`Loading…`)}),m.isError?(0,c.jsx)(p,{error:m.error,path:e,onEnter:l,onRetry:()=>void m.refetch()}):(0,c.jsxs)(`ul`,{"data-slot":`fs-listing`,className:`max-h-64 divide-y divide-border/60 overflow-y-auto overscroll-contain rounded-md border border-border`,children:[h===null?null:(0,c.jsx)(`li`,{className:`flex`,children:(0,c.jsxs)(`button`,{type:`button`,"data-slot":`fs-up`,onClick:()=>l(h),className:`flex flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,children:[(0,c.jsx)(s,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),`Up one level`]})}),(m.data?.dirs??[]).map(e=>(0,c.jsxs)(`li`,{className:`flex items-stretch`,children:[(0,c.jsxs)(`button`,{type:`button`,"data-slot":`fs-dir`,"aria-pressed":n?.path===e.path,onClick:()=>i(e),onDoubleClick:()=>l(e.path),className:r(`flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,n?.path===e.path&&`bg-muted`),children:[(0,c.jsx)(o,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{className:`truncate`,children:e.name}),u?.(e)]}),(0,c.jsx)(`button`,{type:`button`,"data-slot":`fs-enter`,"aria-label":`Open ${e.name}`,onClick:()=>l(e.path),className:`flex shrink-0 items-center px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,c.jsx)(a,{className:`size-3.5`,"aria-hidden":`true`})})]},e.path)),m.data&&m.data.dirs.length===0?(0,c.jsx)(`li`,{className:`px-3 py-2 text-[13px] text-muted-foreground`,children:d}):null]}),m.data?.truncated?(0,c.jsx)(`p`,{"data-slot":`fs-truncated`,className:`text-xs text-muted-foreground`,children:`Too many folders to list — only the first ones are shown.`}):null]})}function p({error:e,path:t,onEnter:r,onRetry:i}){let a=e instanceof n&&e.status===403,o=t===null?null:d(t);return(0,c.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,c.jsx)(`p`,{"data-slot":`fs-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:e instanceof Error?e.message:`could not list that folder`}),a?(0,c.jsx)(`p`,{"data-slot":`fs-privacy-hint`,className:`text-[12.5px] text-soft-foreground`,children:`Allow it under Privacy & Security ▸ Files & Folders, then try again.`}):null,(0,c.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[12.5px]`,children:[o===null?null:(0,c.jsxs)(`button`,{type:`button`,"data-slot":`fs-error-back`,onClick:()=>r(o),className:u,children:[(0,c.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),`Back`]}),a?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`a`,{"data-slot":`fs-privacy-settings`,href:l,target:`_blank`,rel:`noreferrer`,className:u,children:`Open Privacy Settings`}),(0,c.jsx)(`button`,{type:`button`,"data-slot":`fs-retry`,onClick:i,className:u,children:`Try again`})]}):null]})]})}function m(e,n,r=!1){let i=t(e,r);return n?.path??i.data?.path??null}export{m as n,f as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{En as r,Ht as i,O as a,Vt as o,a as s,c,d as l,i as u,in as d,j as f,n as p,nn as m,o as h,r as g}from"./queries-DHjNE2es.js";import{h as _}from"./host-context-iTMFRMT5.js";import{G as v,J as y,Ji as b,R as x,Y as S,n as C,q as w,ta as T,yi as E}from"./toaster-Dglox5F-.js";import{g as ee,p as D}from"./chunk-KS7C4IRE-BdLLx37K.js";import{c as te,i as ne,t as O}from"./reference-chip-kvc51N1L.js";import{o as k}from"./dist-CCX8mhHc.js";import{I as re,L as ie,Q as ae,Z as A,ct as j,i as oe,l as M,m as N,r as se,u as P,ut as ce}from"./design-icons-QbNMZniQ.js";import{t as le}from"./chevron-down-CHGyCDBH.js";import{t as ue}from"./chevron-right-BENZ-1ZN.js";import{t as F}from"./loader-circle-CPBhhDbB.js";import{t as de}from"./play-CmVAj_fu.js";import{t as I}from"./button-BV_AiLj2.js";import{a as fe,i as pe,n as me,r as L,t as he}from"./select-CEEeAH4k.js";import{i as R,r as z,t as B}from"./popover-BQolmvDR.js";import{r as ge,t as V}from"./project-router-CPgPVoBJ.js";import"./attention-CFW302LY.js";import{m as _e,x as ve}from"./task-groups-BapM4YcT.js";import{t as ye}from"./status-dot-DuorWA5M.js";import{c as H,d as U,f as be,m as xe}from"./page-shell-BdjH5hyc.js";import{a as Se,o as Ce,r as we,s as Te,t as Ee}from"./command-4D8sPZJy.js";import{t as W}from"./centered-state-N8vWM_Hw.js";import{t as De}from"./use-search-params-writer-DD5PEEZw.js";import{At as G,Ct as Oe,Dn as K,Dt as ke,Et as Ae,Fn as je,Ft as Me,It as Ne,Kn as Pe,Lt as Fe,Mt as Ie,Nt as Le,Ot as Re,Pt as ze,St as Be,Tt as Ve,ir as He,jt as Ue,kt as We,o as Ge,pt as Ke,sr as qe,wt as Je,xt as Ye,zn as Xe}from"./index-k2m-s5zD.js";import{t as Ze}from"./markdown-C1p1PDmF.js";import{a as Qe,c as $e,f as et,h as tt,i as nt,l as rt,m as it,n as at,o as ot,p as q,r as st,s as ct,t as lt,u as ut}from"./use-hand-to-agent-state-DfucUGAH.js";import{t as dt}from"./tab-link-CiKWtkK_.js";var J=e(t(),1),Y=n();function ft({number:e,repo:t}){let n=_();return(0,Y.jsx)(pt,{number:e,repo:t,scope:n},JSON.stringify([n,t,e]))}function pt({number:e,repo:t,scope:n}){let r=(0,J.useId)(),i=(0,J.useId)(),[a,o]=(0,J.useState)(!1),s=a?le:ue,c=m(n,!0,n==="default"),l=f(`#${e}`,!0),u=(0,J.useMemo)(()=>Le(ve(c.data??[],l.data?.pages.flatMap(e=>e.runs)??[]),e,t,n),[c.data,l.data,e,t,n]);return(0,Y.jsxs)(`section`,{"aria-labelledby":r,className:k(`mt-4 min-w-0 rounded-lg border border-border`,a?`p-3`:`p-0.5`),children:[(0,Y.jsx)(`h3`,{id:r,className:`text-xs font-semibold text-muted-foreground`,children:(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":a,"aria-controls":i,onClick:()=>o(e=>!e),className:`flex min-h-11 w-full items-center gap-2 rounded-md px-2.5 text-left hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,Y.jsx)(s,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Y.jsxs)(`span`,{children:[`Linked tasks`,c.data?` (${u.length}${l.hasNextPage||l.isError?`+`:``})`:``]})]})}),(0,Y.jsx)(`div`,{id:i,children:a?(0,Y.jsxs)(Y.Fragment,{children:[c.isPending?(0,Y.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-muted-foreground`,children:`Loading linked tasks…`}):null,c.isError?(0,Y.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`p`,{role:`status`,children:`Couldn’t load linked tasks. Check your connection and try again.`}),(0,Y.jsx)(I,{variant:`outline`,className:`mt-2`,onClick:()=>void c.refetch(),disabled:c.isFetching,children:`Retry linked tasks`})]}):null,c.data&&u.length===0&&!c.isError?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`No linked tasks yet.`}):null,u.length>0?(0,Y.jsx)(`ul`,{className:`mt-2 flex flex-col gap-1`,children:u.map(e=>{let t=je(e,E(e));return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(V,{to:`/tasks/${encodeURIComponent(e.id)}`,className:`flex min-h-11 min-w-0 flex-col justify-center gap-1 rounded-md px-2 py-2 hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium break-words [overflow-wrap:anywhere]`,children:_e(e)}),(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(ye,{tone:t.tone,shape:t.shape,pulse:t.pulse,role:`img`,"aria-label":t.label,title:t.label}),e.archived?(0,Y.jsx)(He,{"data-slot":`linked-task-archived`,dot:K.tone,shape:K.shape,className:`px-2 py-px`,children:K.label}):null,(0,Y.jsx)(`time`,{dateTime:e.createdAt,children:new Date(e.createdAt).toLocaleDateString()})]})]})},e.id)})}):null,l.isError?(0,Y.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`p`,{role:`status`,children:`Couldn’t load older archived linked tasks.`}),(0,Y.jsx)(I,{variant:`outline`,className:`mt-2`,onClick:()=>void l.refetch(),disabled:l.isFetching,children:`Retry older linked tasks`})]}):l.hasNextPage?(0,Y.jsx)(I,{variant:`outline`,className:`mt-2`,onClick:()=>void l.fetchNextPage(),disabled:l.isFetchingNextPage,children:l.isFetchingNextPage?`Loading older linked tasks…`:`Show older linked tasks`}):null]}):null})]})}var mt=`w-44 max-w-full`,X=`min-h-11 min-w-11 rounded-md border border-input bg-card px-3 text-sm font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-ring disabled:opacity-60`,Z=`__all__`;function ht(e,t){let n=new Map;for(let t of e)for(let e of t.assignees??[])n.set(e.toLowerCase(),e);for(let e of t)n.set(e.toLowerCase(),e);return[...n.values()].sort((e,t)=>e.localeCompare(t))}function gt(e,t){return!!e&&t.length===1&&t[0]?.toLowerCase()===e.toLowerCase()}function _t(e){let t=` Previous memberships are shown; issues with unknown membership remain visible.`;return e.projectsState===`refreshing`&&e.projects?`Refreshing project boards.${t}`:e.projectsState===`unavailable`&&e.projects?`${e.projectsReason}${t}`:e.projects?``:e.projectsReason??(e.projectsState===`refreshing`?`Project memberships pending.`:`Project boards unavailable.`)}function vt(e){return[e.viewerLogin?``:`GitHub login unavailable.`,_t(e)].filter(Boolean).join(` `)}function yt({options:e,assignees:t,onAssigneesChange:n}){return(0,Y.jsxs)(B,{children:[(0,Y.jsx)(R,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:`${X} inline-flex items-center gap-1.5`,disabled:e.length===0,children:[`Assignee`,t.length?` · ${t.length}`:``,(0,Y.jsx)(P,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-muted-foreground`})]})}),(0,Y.jsx)(z,{align:`start`,className:`w-64 max-w-[calc(100vw-2rem)] p-2`,children:(0,Y.jsxs)(`fieldset`,{className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto`,children:[(0,Y.jsx)(`legend`,{className:`px-2 text-xs text-muted-foreground`,children:`Match any selected assignee`}),e.map(e=>{let r=t.some(t=>t.toLowerCase()===e.toLowerCase());return(0,Y.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded px-2 hover:bg-muted`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>n(r?t.filter(t=>t.toLowerCase()!==e.toLowerCase()):[...t,e])}),(0,Y.jsx)(`span`,{className:`break-all text-sm`,children:e})]},e.toLowerCase())})]})})]})}function bt({data:e,projectId:t,onProjectChange:n,pickerRef:r}){if(e.projects?.length)return(0,Y.jsxs)(he,{value:t||Z,onValueChange:e=>n(e===Z?``:e),children:[(0,Y.jsx)(pe,{ref:r,"aria-label":`Project board`,"data-slot":`gh-board-filter`,"data-value":t,className:`${X} ${mt} justify-between`,children:(0,Y.jsx)(fe,{placeholder:`All boards`})}),(0,Y.jsxs)(me,{align:`start`,children:[(0,Y.jsx)(L,{value:Z,children:`All boards`}),e.projects.map(e=>(0,Y.jsx)(L,{value:e.id,"data-board":e.id,children:e.title},e.id))]})]});if(e.projects||e.projectsState){let t=e.projects?`No boards`:e.projectsState===`refreshing`?`Loading boards…`:`Boards unavailable`;return(0,Y.jsxs)(he,{disabled:!0,value:Z,children:[(0,Y.jsx)(pe,{ref:r,"aria-label":`Project board`,"data-slot":`gh-board-filter`,"data-value":``,className:`${X} ${mt} justify-between`,children:(0,Y.jsx)(fe,{placeholder:t,children:t})}),(0,Y.jsx)(me,{align:`start`,children:(0,Y.jsx)(L,{value:Z,children:t})})]})}return null}function xt({data:e,message:t,lastMessage:n,hasMessage:r,statusOpen:i,setStatusOpen:a,triggerRef:o,contentRef:s}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{role:`status`,className:`sr-only`,children:t}),(0,Y.jsxs)(B,{open:i,onOpenChange:a,children:[(0,Y.jsx)(R,{asChild:!0,children:(0,Y.jsx)(`button`,{ref:o,type:`button`,className:`${X} inline-flex items-center justify-center ${t?``:`invisible`}`,"aria-label":`Project board status`,tabIndex:t?void 0:-1,children:e.projectsState===`refreshing`?(0,Y.jsx)(A,{size:14,"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):(0,Y.jsx)(j,{size:14,"aria-hidden":`true`,className:`size-3.5`})})}),(0,Y.jsx)(z,{ref:s,align:`start`,"data-slot":`gh-issue-status`,onCloseAutoFocus:e=>{r||e.preventDefault()},className:`w-72 max-w-[calc(100vw-2rem)] p-3 text-xs text-muted-foreground`,children:t||n.current})]})]})}function St({data:e,assignees:t,projectId:n,onAssigneesChange:r,onProjectChange:i}){let[a,o]=(0,J.useState)(!1),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=(0,J.useRef)(null),u=(0,J.useRef)(null),d=ht(e.issues,t),f=gt(e.viewerLogin,t),p=vt(e),m=p!==``,h=(0,J.useRef)(p);m&&(h.current=p);let g=(0,J.useRef)(!m);g.current=!m;let _=()=>(l.current&&!l.current.disabled?l.current:u.current)?.focus();return(0,J.useEffect)(()=>{let e=s.current;if(!e)return;let t=e=>{g.current&&!e.relatedTarget&&requestAnimationFrame(()=>{(!document.activeElement||document.activeElement===document.body)&&_()})};return e.addEventListener(`blur`,t),()=>e.removeEventListener(`blur`,t)},[]),(0,J.useEffect)(()=>{if(m)return;let e=document.activeElement,t=!!e&&(e===s.current||!!c.current?.contains(e));o(!1),t&&_()},[m]),(0,Y.jsxs)(`div`,{className:`contents`,"data-slot":`gh-issue-filters`,children:[(0,Y.jsx)(yt,{options:d,assignees:t,onAssigneesChange:r}),(0,Y.jsxs)(`button`,{ref:u,type:`button`,"data-slot":`gh-assigned-me`,className:`${X} inline-flex items-center gap-1.5 rounded-full aria-pressed:border-accent-strong aria-pressed:bg-accent-strong aria-pressed:text-accent-strong-foreground aria-pressed:hover:bg-accent-strong`,disabled:!e.viewerLogin,"aria-pressed":f,onClick:()=>r(f?[]:[e.viewerLogin]),children:[(0,Y.jsx)(ce,{size:14,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`Assigned to me`]}),(0,Y.jsx)(bt,{data:e,projectId:n,onProjectChange:i,pickerRef:l}),(0,Y.jsx)(xt,{data:e,message:p,lastMessage:h,hasMessage:m,statusOpen:a,setStatusOpen:o,triggerRef:s,contentRef:c})]})}function Ct({onRefresh:e,refreshing:t}){let n=Ye(_());return(0,Y.jsx)(U,{route:`github`,density:`full`,headerSpacing:`compact`,header:{title:`GitHub`,secondaryActions:(0,Y.jsx)(H,{type:`button`,variant:`ghost`,"data-slot":`gh-screen-refresh`,"aria-label":`Refresh from GitHub`,title:`Refresh from GitHub`,disabled:t,onClick:e,children:(0,Y.jsx)(A,{size:17,"aria-hidden":`true`,className:k(`size-[17px]`,t&&`motion-safe:animate-spin`)})})},children:(0,Y.jsx)(`div`,{"data-slot":`github-filter-screen`,children:(0,Y.jsx)(Be,{model:n,variant:`screen`})})})}function wt({view:e,activeFilter:t,isDesktop:n,listInUrl:r,n:i,gh:a,actions:o}){return{headerSlot:`gh-masthead`,title:n?e===`issues`?`Issues`:`Pull requests`:`GitHub`,scope:n?Oe[t]:void 0,scopeSlot:`gh-title-qualifier`,subtitle:a.repo?(0,Y.jsxs)(`span`,{className:`block min-w-0 truncate`,children:[(0,Y.jsx)(`span`,{"data-slot":`gh-repo`,children:a.repo}),(0,Y.jsxs)(`span`,{"data-slot":`gh-synced`,title:a.syncedAt?new Date(a.syncedAt).toLocaleString():void 0,children:[` `,`· `,a.syncedAt?(0,Y.jsx)(Xe,{iso:a.syncedAt,prefix:`Synced `}):`Not synced yet`]})]}):void 0,secondaryActions:(0,Y.jsx)(Tt,{...o}),headerExtra:r&&i===void 0?(0,Y.jsxs)(`div`,{"data-slot":`gh-filter-context`,className:`mt-1 flex min-w-0 items-center gap-3 md:hidden`,children:[(0,Y.jsxs)(V,{to:`/github`,"data-slot":`gh-back-filters`,className:`inline-flex min-h-11 items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,Y.jsx)(se,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to filters`]}),t===`all`?null:(0,Y.jsx)(`span`,{"data-slot":`gh-active-filter`,className:`truncate text-xs text-muted-foreground`,children:[...Ae,...ke].find(e=>e.id===t)?.label})]}):void 0}}function Tt({automationsAvailable:e,refreshing:t,onRefresh:n}){return(0,Y.jsxs)(`div`,{"data-slot":`gh-page-actions`,className:`flex shrink-0 flex-wrap items-center gap-2`,children:[e?(0,Y.jsx)(H,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(V,{to:`/automations/new`,children:`Set up automations`})}):null,(0,Y.jsxs)(H,{type:`button`,variant:`outline`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:t,onClick:n,children:[(0,Y.jsx)(A,{size:16,"aria-hidden":`true`,className:k(`size-3.5`,t&&`motion-safe:animate-spin`)}),`Refresh`]})]})}function Et({view:e,number:t}){return(0,Y.jsx)(W,{icon:e===`issues`?(0,Y.jsx)(N,{size:16}):(0,Y.jsx)(re,{size:16}),tone:`neutral`,heading:`h2`,title:t===null?`Nothing selected`:`Not found`,subtitle:t===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${t} is not among the open ${e===`issues`?`issues`:`pull requests`}. Go back to the list and search for ${t} to look it up on GitHub, closed and merged included.`})}var Dt=/^(\[[^\]\n]{1,24}\]:?)\s+(\S.*)$/s;function Ot(e){let t=Dt.exec(e);return t?{prefix:t[1],rest:t[2]}:{prefix:null,rest:e}}function kt(e,t){if(!t)return e.kind===`issue`?`open`:e.isDraft?`draft`:void 0}function At(e){let t=e.reduce((e,t)=>Math.max(e,String(t.number).length),1);return Math.ceil(28+(t+1)*7.2)}var Q=2;function jt({item:e,view:t,filter:n,narrows:r,colors:a,expanded:s,onToggle:c,queuedRunId:l,checks:u,comments:f,status:p,task:m,referenceWidth:h}){let g=b(),_=`gh-row-summary-${e.kind}-${e.number}`,v=e.kind===`pr`?`PR`:`Issue`,x=te(v,e.number),S=(v===`PR`&&x.conflicting===!0?o:i(p??x.status))?.label,C=Ot(e.title),w=()=>{g.prefetchQuery({queryKey:d.githubComments(e.kind,e.number),queryFn:({signal:t})=>y(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,Y.jsxs)(`div`,{"data-slot":`gh-row-shell`,"data-expanded":s||void 0,style:{"--gh-ref-width":`${h}px`},className:k(`@container rounded-md`,s&&`bg-sidebar-row-selected`),children:[(0,Y.jsxs)(`button`,{type:`button`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,st(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:w,onFocus:w,onClick:c,"data-slot":`gh-row`,"data-number":e.number,"data-kind":e.kind,"aria-expanded":s,"aria-controls":s?_:void 0,title:`Drag into the composer to prefill a task`,className:`grid w-full grid-cols-[var(--gh-ref-width)_minmax(0,1fr)_auto] items-start gap-x-3 gap-y-1.5 rounded-md px-3 py-2 text-left transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:-outline-offset-2 @4xl:grid-cols-[var(--gh-ref-width)_minmax(0,1fr)_auto_auto]`,children:[(0,Y.jsxs)(`span`,{"data-slot":`gh-row-ref`,title:S,className:`flex h-[18px] items-center`,children:[(0,Y.jsx)(O,{reference:{kind:v,number:e.number},taskTitle:e.title,status:p,compact:!0,inert:!0}),S?(0,Y.jsx)(`span`,{className:`sr-only`,children:S}):null]}),(0,Y.jsxs)(`span`,{"data-slot":`gh-row-title`,className:k(`line-clamp-2 min-w-0 text-[13px] leading-[18px] font-medium text-foreground [overflow-wrap:anywhere] @4xl:line-clamp-none`,s&&`font-semibold`),children:[C.prefix?(0,Y.jsxs)(`span`,{"data-slot":`gh-row-title-prefix`,className:`font-normal text-soft-foreground`,children:[C.prefix,` `]}):null,C.rest]}),(0,Y.jsx)(P,{"data-slot":`gh-row-cue`,"aria-hidden":`true`,className:k(`col-start-3 row-start-1 mt-px size-4 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none @4xl:col-start-4`,s&&`rotate-180`)}),e.labels.length>0?(0,Y.jsx)(`span`,{"data-slot":`gh-row-labels`,className:`col-start-2 col-end-4 flex min-w-0 flex-wrap gap-1 @4xl:col-end-3`,children:e.labels.map(e=>(0,Y.jsx)(ut,{label:e,color:a[e],className:`max-w-full truncate`},e))}):null,(0,Y.jsx)(Mt,{item:e,view:t,task:m,queuedRunId:l,checks:u,comments:f})]}),s?(0,Y.jsx)(Pt,{id:_,item:e,checks:u,detailPath:We(t,n,e.number,``,r),queuedRunId:l}):null]})}function Mt({item:e,view:t,task:n,queuedRunId:r,checks:i,comments:a}){let o=e.assignees??[];return(0,Y.jsxs)(`span`,{"data-slot":`gh-row-meta`,className:`col-start-2 col-end-4 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground @4xl:col-start-3 @4xl:col-end-4 @4xl:row-start-1 @4xl:h-[18px] @4xl:flex-nowrap`,children:[(0,Y.jsx)(`span`,{"data-slot":`gh-row-task`,className:$.task,children:n?(0,Y.jsx)(He,{dot:n.status.tone,shape:n.status.shape,pulse:n.status.pulse,title:`Newest task: ${n.status.label}`,className:`max-w-full py-0.5`,children:(0,Y.jsx)(`span`,{className:`truncate`,children:n.status.label})}):r?(0,Y.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`shrink-0 font-sans font-medium text-accent-text`,children:`↗ run queued`}):null}),(0,Y.jsx)(`span`,{"data-slot":`gh-row-assignees`,className:$.assignees,children:o.length>0?(0,Y.jsx)(Nt,{logins:o}):null}),t===`prs`?(0,Y.jsx)(`span`,{"data-slot":`gh-row-checks-slot`,className:$.checks,children:i?(0,Y.jsx)(ot,{checks:i}):null}):null,(0,Y.jsx)(`span`,{"data-slot":`gh-row-comments`,className:$.comments,children:a?(0,Y.jsx)(ct,{count:a}):null}),(0,Y.jsx)(Xe,{iso:e.createdAt,className:`shrink-0 @4xl:w-9 @4xl:text-right`})]})}var $={task:`flex min-w-0 max-w-full empty:hidden @4xl:w-44 @4xl:empty:block`,assignees:`flex shrink-0 items-center empty:hidden @4xl:w-12 @4xl:justify-center @4xl:empty:block`,checks:`flex shrink-0 empty:hidden @4xl:w-4 @4xl:justify-center @4xl:empty:block`,comments:`flex shrink-0 empty:hidden @4xl:w-10 @4xl:empty:block`};function Nt({logins:e}){let t=e.join(`, `);return(0,Y.jsxs)(`span`,{title:`Assigned to ${t}`,className:`flex items-center -space-x-1`,children:[e.slice(0,Q).map(e=>(0,Y.jsx)(nt,{login:e},e)),e.length>Q?(0,Y.jsxs)(`span`,{"aria-hidden":`true`,className:`pl-2 tabular-nums`,children:[`+`,e.length-Q]}):null,(0,Y.jsxs)(`span`,{className:`sr-only`,children:[`Assigned to `,t]})]})}function Pt({id:e,item:t,checks:n,detailPath:r,queuedRunId:i}){let a=u(t.kind,t.number),o=(a.data?.detail?.body??t.body)?.trim(),s=t.kind===`pr`?`PR`:`issue`;return(0,Y.jsxs)(`div`,{id:e,"data-slot":`gh-row-summary`,className:`flex flex-col gap-3 px-3 pb-4 @4xl:pl-[calc(var(--gh-ref-width)+1.5rem)]`,children:[(0,Y.jsx)(`div`,{"data-slot":`gh-row-body`,className:`text-[13px] leading-relaxed text-soft-foreground`,children:o?(0,Y.jsx)(`div`,{"data-slot":`gh-row-excerpt`,inert:!0,className:Ft,children:(0,Y.jsx)(Ze,{document:!0,children:o})}):a.isPending?(0,Y.jsx)(qe,{className:`h-4 w-2/3`}):a.isError||a.data?.available===!1?(0,Y.jsx)(`p`,{"data-slot":`gh-row-body-unavailable`,className:`text-muted-foreground`,children:`Description unavailable. Use Refresh to try again.`}):(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:`(no description)`})}),(0,Y.jsxs)(`div`,{"data-slot":`gh-row-facts`,className:`flex flex-wrap items-center gap-x-2 gap-y-1.5 text-xs text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[`Opened by `,(0,Y.jsx)(`span`,{"data-slot":`gh-row-author`,className:`font-medium`,children:t.author})]}),n?(0,Y.jsx)(Qe,{checks:n,url:t.url}):null]}),(0,Y.jsxs)(`div`,{"data-slot":`gh-row-actions`,className:`flex flex-wrap items-center gap-2`,children:[i?(0,Y.jsx)(I,{asChild:!0,variant:`outline`,size:`sm`,children:(0,Y.jsxs)(V,{to:`/tasks/${i}`,"data-action":`gh-row-view-task`,children:[(0,Y.jsx)(M,{size:16,"aria-hidden":`true`,className:`size-3.5 text-success`}),`Open queued task`]})}):(0,Y.jsx)(I,{asChild:!0,variant:`primary`,size:`sm`,children:(0,Y.jsxs)(V,{to:r,state:{focusHandoff:!0},"data-action":`gh-row-handoff`,title:`Open this ${s} and write the prompt for an agent`,children:[(0,Y.jsx)(de,{"aria-hidden":`true`,className:`size-3.5`}),`Hand to agent`]})}),(0,Y.jsx)(I,{asChild:!0,variant:`outline`,size:`sm`,children:(0,Y.jsxs)(V,{to:r,"data-action":`gh-row-open`,children:[`Open `,s,(0,Y.jsx)(oe,{size:16,"aria-hidden":`true`,className:`size-3.5`})]})})]})]})}var Ft=k(`max-h-[calc(3lh)] overflow-hidden [overflow-wrap:anywhere]`,`[&_*]:!my-0 [&_p+*]:!mt-1 [&_ul]:list-inside [&_ol]:list-inside`,`[&_:is(h1,h2,h3,h4,h5,h6,pre,img,table,hr,[data-streamdown="code-block"],[data-streamdown="table-wrapper"],[data-streamdown="image-wrapper"],[data-streamdown="mermaid-block"])]:hidden`);function It(e){let t=getComputedStyle(e).overflowY;return t===`auto`||t===`scroll`?e:e.closest(`[data-slot="main"]`)??e}function Lt(e){let[t,n]=(0,J.useState)(null);return(0,J.useLayoutEffect)(()=>{if(!e){n(null);return}let t=()=>n(It(e));t();let r=typeof window.matchMedia==`function`?window.matchMedia(`(min-width: 768px)`):null;r?.addEventListener(`change`,t);let i=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return i?.observe(e),()=>{r?.removeEventListener(`change`,t),i?.disconnect()}},[e]),t}function Rt(e,t){let[n,r]=(0,J.useState)(0);return(0,J.useLayoutEffect)(()=>{let n=()=>{!e||!t||r(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return n(),window.addEventListener(`resize`,n),()=>window.removeEventListener(`resize`,n)},[e,t]),n}function zt(e,t,n){let[r,i]=(0,J.useState)(null),a=(0,J.useRef)(n);return(0,J.useEffect)(()=>{a.current=n}),(0,J.useEffect)(()=>{if(!e||!r||!t||typeof IntersectionObserver>`u`)return;let n=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&a.current()},{root:t.getAttribute(`data-slot`)===`main`?null:t,rootMargin:`0px 0px 600px 0px`});return n.observe(r),()=>n.disconnect()},[e,r,t]),i}function Bt(e,t,n,r,i){let[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(null),l=Lt(a),u=(0,J.useRef)(null);u.current=l;let d=Rt(s,l),f=e===`issues`?n?.issues.length??0:n?.prs.length??0,p=t.hasNextPage&&r===null&&f>0;return{listEl:a,setListEl:o,setRowsEl:c,scrollOwner:l,scrollOwnerRef:u,startMargin:d,pagingAvailable:p,manualPaging:p&&i,loadMoreRef:zt(p&&!i&&!t.isFetchingNextPage&&!t.isFetchNextPageError,l,()=>void t.fetchNextPage())}}function Vt({item:e,queuedRunId:t}){return t?(0,Y.jsx)(I,{asChild:!0,variant:`outline`,size:`sm`,children:(0,Y.jsxs)(V,{to:`/tasks/${t}`,"data-action":`gh-header-view-task`,children:[(0,Y.jsx)(M,{size:16,"aria-hidden":`true`,className:`size-3.5 text-success`}),`Open queued task`]})}):(0,Y.jsxs)(I,{type:`button`,variant:`primary`,size:`sm`,"data-action":`gh-header-handoff`,title:`Write the prompt and pick the workflow and runner for this ${e.kind===`pr`?`PR`:`issue`}`,onClick:Ht,children:[(0,Y.jsx)(de,{"aria-hidden":`true`,className:`size-3.5`}),`Hand to agent`]})}function Ht(){let e=document.querySelector(`[data-slot="gh-detail-inner"] [data-slot="gh-custom-prompt"]`);e?.scrollIntoView({block:`center`}),e?.focus({preventScroll:!0})}var Ut=100;function Wt(e,t,n,r,i){if(!e?.available||t!==`prs`)return[];let a=new Set;n!==null&&Number.isInteger(n)&&a.add(n);for(let t of[...r,...i,...e.prs]){if(a.size>=Ut)break;a.add(t.number)}return[...a]}function Gt(e,t,n,r,i,a){let o=Wt(n,e,r,i,a),s=p(o,e===`prs`),c=s.data?.available?s.data.checks:void 0,l=g(e===`issues`?`issue`:`pr`,(0,J.useMemo)(()=>(t.data?.pages??[]).map(t=>(e===`issues`?t.issues:t.prs).map(e=>e.number)),[t.data,e]),n?.available===!0&&n.commentsDeferred===!0),u=(0,J.useMemo)(()=>new Set(n?.commentsDeferred?(e===`issues`?n.issues:n.prs).map(e=>e.number):[]),[n,e]);return{checkPrNumbers:o,checksMap:c,commentsOf:e=>l[e.number]??(u.has(e.number)?void 0:e.comments)}}function Kt(e){let t=_(),n=m(t,!0,t==="default").data,r=(0,J.useMemo)(()=>n?ze(n,e,t):null,[n,e,t]);return(0,J.useCallback)(e=>{let t=e.kind===`issue`?r?.get(e.number):void 0;return t?{runId:t.id,status:je(t)}:null},[r])}function qt(e){let[t,n]=De(),r=t.get(`filter`),i=Me(e,r),a=i??`all`,o=e=>n(t=>{let n=new URLSearchParams(t);return e===null?n.delete(`filter`):n.set(`filter`,e),n}),s=G(t);return{rawFilterParam:r,filter:i,activeFilter:a,setFilterParam:o,narrows:s,url:(0,J.useMemo)(()=>{let t=new URLSearchParams(s);return{query:t.get(`q`)??``,labels:t.getAll(`label`),assignees:e===`issues`?t.getAll(`assignee`):[],board:e===`issues`?t.get(`board`)??``:``}},[s,e]),writeNarrows:(0,J.useCallback)(e=>n(t=>{let n=e(t);return(t.has(`filter`)||G(t)!==``)&&!n.has(`filter`)&&G(n)===``&&n.set(`filter`,`all`),n}),[n])}}function Jt(e,t){return n=>{let r=new URLSearchParams(n);r.delete(e);for(let n of t)r.append(e,n);return r}}function Yt(e,t,{rawFilterParam:n,filter:r,activeFilter:i,setFilterParam:a,narrows:o,url:s,writeNarrows:c}){let l=Zt(s.query,n!==null||o!==``,c),{query:u,setQuery:d}=l,f=s.labels,p=s.assignees,m=e=>c(Jt(`label`,e)),{setProjectFilter:h,activeProject:g}=Qt(t,s.board,c),_=e===`issues`&&i===`assigned`,v=_?t?.viewerLogin?[t.viewerLogin]:[]:p;return{query:u,setQuery:d,labelFilter:f,setLabelFilter:m,setProjectFilter:h,activeProject:g,isAssignedFilter:_,effectiveAssignees:v,changeAssignees:e=>{c(Jt(`assignee`,e)),_&&a(`all`)},clearFilters:()=>{l.clear(),c(e=>{let t=new URLSearchParams(e);for(let e of Ve)t.delete(e);return r!==null&&r!==`all`&&t.set(`filter`,`all`),t})},filtering:u.trim()!==``||f.length>0||e===`issues`&&(v.length>0||g!==``)||r!==null&&r!==`all`,narrowing:u.trim()!==``||f.length>0||e===`issues`&&(!_&&p.length>0||g!==``)}}var Xt=250;function Zt(e,t,n){let r=`${D().pathname}${t?``:`#entry`}`,[i,a]=(0,J.useState)(e),o=(0,J.useRef)(e),s=(0,J.useRef)(void 0),c=(0,J.useRef)(r);return(0,J.useEffect)(()=>{e===o.current&&r===c.current||(clearTimeout(s.current),c.current=r,o.current=e,a(e))},[e,r]),(0,J.useEffect)(()=>()=>clearTimeout(s.current),[]),{query:i,setQuery:e=>{a(e),clearTimeout(s.current),s.current=setTimeout(()=>{let t=e.trim();o.current=t,n(e=>{let n=new URLSearchParams(e);return t===``?n.delete(`q`):n.set(`q`,t),n})},Xt)},clear:()=>{clearTimeout(s.current),o.current=``,a(``)}}}function Qt(e,t,n){let r=e=>n(t=>{let n=new URLSearchParams(t);return e===``?n.delete(`board`):n.set(`board`,e),n}),i=e?.projectsState===`refreshing`||e?.projectsState===`unavailable`,a=i||e?.projects?.some(e=>e.id===t)===!0,o=e?.available===!0&&!i&&t!==``&&!a,[s,c]=(0,J.useState)(``);s!==``&&s!==t&&c(``),o&&s!==t&&c(t);let l=o||s!==``&&s===t,u=a&&!l?t:``;return(0,J.useEffect)(()=>{l&&n(e=>{let t=new URLSearchParams(e);return t.delete(`board`),t})},[l,n]),{setProjectFilter:r,activeProject:u}}function $t(e,t,{filter:n,activeFilter:r},i){let a=_(),o=e===`issues`&&(r===`no-task`||r===`has-task`),s=m(a,o,a==="default"),l=(0,J.useMemo)(()=>s.data?Ie(s.data,t?.repo,a):null,[s.data,t?.repo,a]),u=Ue(e,n)?Fe(n):null,d=c(`pr`,u??``,u!==null&&t?.available===!0),f=u!==null&&d.data?.available?d.data.items:null,p=(0,J.useMemo)(()=>t?.available?e===`issues`?t.issues:t.prs:[],[t,e]),h=(0,J.useMemo)(()=>f?Ne(f,p):null,[f,p]),g=en({view:e,gh:t,activeFilter:r,isAssignedFilter:i,taskFilter:o,taskNumbers:l,runsQuery:s,backedQuery:u,filterHits:f,filterSearch:d});return{backedQuery:u,filterSearch:d,fullList:p,filterRows:h,filterGate:g,openItems:(0,J.useMemo)(()=>g?[]:h??p,[g,h,p]),narrow:(0,J.useMemo)(()=>e===`issues`?r===`no-task`&&l?{excludeNumbers:l}:r===`has-task`&&l?{includeNumbers:l}:{}:r===`mine`&&t?.viewerLogin?{author:t.viewerLogin}:f?{includeNumbers:new Set(f.map(e=>e.number))}:{},[e,r,l,t?.viewerLogin,f])}}function en({view:e,gh:t,activeFilter:n,isAssignedFilter:r,taskFilter:i,taskNumbers:a,runsQuery:o,backedQuery:s,filterHits:c,filterSearch:l}){return t?.available?(r||e===`prs`&&n===`mine`)&&!t.viewerLogin?{kind:`blocked`,message:`GitHub login unavailable, so this filter cannot be applied.`}:i&&!a?o.isError?{kind:`blocked`,message:`The task list is unavailable, so this filter cannot be applied.`}:{kind:`loading`,message:`Loading tasks…`}:s!==null&&!c?l.data?.available===!1?{kind:`blocked`,message:`GitHub could not be searched: ${l.data.reason??`unknown reason`}.`}:l.isError?{kind:`blocked`,message:`GitHub could not be searched: ${l.error instanceof Error?l.error.message:`the search request failed`}.`}:{kind:`loading`,message:`Searching GitHub…`}:null:null}function tn(e,t){return t?S(t.kind,t.number,{refresh:!0}).then(n=>(e.setQueryData(t.key,n),!0)).catch(()=>!1):Promise.resolve(!0)}function nn(e,t,n,{filterGate:r,filterRows:i,fullList:a}){let o=d.github()[0],s=t===void 0?null:Number.parseInt(t,10),c=!r&&n.data?.available?n.data.items.find(e=>e.number===s):void 0,l=i&&s!==null&&!a.some(e=>e.number===s)?i.find(e=>e.number===s):void 0,u=c??l,[f,p]=(0,J.useState)(null);return(0,J.useEffect)(()=>{u&&p({scope:o,view:e,item:u})},[o,e,u]),{selectedNumber:s,remoteDetail:u??(f?.scope===o&&f.view===e&&f.item.number===s?f.item:null)}}function rn(e,t,n,{fullList:r,filterRows:i},a){let o=b(),c=(0,J.useRef)(null),l=e===`issues`?`issue`:`pr`,u=t?.available===!0&&n!==null&&Number.isSafeInteger(n)&&n>0&&!r.some(e=>e.number===n)&&!i?.some(e=>e.number===n)&&a===null,f=s(l,n??0,u),p=u&&f.data?.available&&f.data.item?.kind===l?f.data.item:null;c.current=u&&n!==null?{kind:l,number:n,key:d.githubItem(l,n)}:null;let[m,h]=(0,J.useState)(!1);return{exactWanted:u,exactItem:f,exactDetail:p,exactTargetRef:c,retryingExact:m,retryExact:()=>{h(!0),tn(o,c.current).then(e=>{h(!1),e||C(`Could not reach GitHub for #${n}`,{tone:`danger`})})}}}function an(e,t,n){let i=b(),a=(0,J.useRef)(null);return{refresh:r({mutationFn:e=>(tn(i,e),v({refresh:!0,limit:50})),onSuccess:async r=>{await i.cancelQueries({queryKey:d.githubPages(50),exact:!0}),i.setQueryData(d.githubPages(50),{pages:[r],pageParams:[{}]}),i.invalidateQueries({queryKey:d.githubChecks(t)});let o=e===`issues`?`issue`:`pr`,s=(e===`issues`?r.issues:r.prs).map(e=>e.number),c=d.githubCommentCounts(o,s);i.removeQueries({queryKey:d.githubCommentCounts(o,[]).slice(0,4),predicate:e=>e.queryHash!==T(c)}),r.available&&r.commentsDeferred&&s.length>0&&w(o,s,{refresh:!0}).then(e=>i.setQueryData(c,e)).catch(()=>{}),i.invalidateQueries({queryKey:d.githubSearch(e===`issues`?`issue`:`pr`,n)}),i.invalidateQueries({queryKey:d.githubSearch(`pr`,Re)}),i.invalidateQueries({queryKey:d.githubSearch(`pr`,Je)});let l=a.current,u=d.githubComments(`issue`,0).slice(0,3);if(!l){i.removeQueries({queryKey:u});return}let f=d.githubComments(l.kind,l.number);y(l.kind,l.number,{refresh:!0}).then(e=>i.setQueryData(f,e)).catch(()=>{}),i.removeQueries({queryKey:u,predicate:e=>e.queryHash!==T(f)})},onError:e=>C(e.message,{tone:`danger`})}),openThreadRef:a}}var on=350;function sn(e,t){let[n,r]=(0,J.useState)(e);return(0,J.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function cn(e,t,{query:n,labelFilter:r,effectiveAssignees:i,activeProject:a},{openItems:o,narrow:s,filterGate:l}){let u=sn(n,on),d=(0,J.useMemo)(()=>q(o,{query:u,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),[o,u,r,e,i,a,s]),f=n.trim()===u.trim(),p=t?.available===!0&&!l&&f&&tt(u,d),m=c(e===`issues`?`issue`:`pr`,u,p),h=q(o,{query:n,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),g=p&&m.data?.available?m.data:null,_=new Set(h.map(e=>e.number)),v=ln(e,g,a,i);return{debouncedQuery:u,searchWanted:p,forgeSearch:m,items:h,searchPayload:g,metadataFailure:v,searchHits:g&&!v?q(g.items,{labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}).filter(e=>!_.has(e.number)):[],...un(n,f,p,m)}}function ln(e,t,n,r){return e===`issues`&&t?n&&t.items.some(e=>e.projectIds===void 0)?t.projectsReason??`Project board data is incomplete. Refresh to try again.`:r.length&&t.items.some(e=>e.assignees===void 0)?`Assignee data is incomplete. Refresh to try again.`:null:null}function un(e,t,n,r){return{searching:e.trim()!==``&&!t||n&&r.isPending,searchFailed:n&&(r.data?.available===!1||r.isError),searchFailureReason:r.data?.available===!1?r.data.reason??`unknown reason`:r.error instanceof Error?r.error.message:`the search request failed`}}function dn({view:e,changes:t=!1,index:n=!1}){let{n:r}=ee(),i=qt(e),{rawFilterParam:o,activeFilter:s,narrows:c}=i,l=o!==null||c!==``,u=xe(),{pages:d,data:f}=h(50),p=Pe(),m=pn(),g=lt(),_=fn({index:n,isDesktop:u,listInUrl:l,n:r,rememberedView:a().data?.githubView}),[v,y]=(0,J.useState)(null),b=Yt(e,f,i),x=$t(e,f,i,b.isAssignedFilter),S=cn(e,f,b,x),C=nn(e,r,S.forgeSearch,x),w=rn(e,f,C.selectedNumber,x,C.remoteDetail),T=Gt(e,d,f,C.selectedNumber,S.searchHits,x.openItems),{refresh:E,openThreadRef:D}=an(e,T.checkPrNumbers,S.debouncedQuery),te=Bt(e,d,f,x.backedQuery,b.narrowing),ne=Kt(f?.available?f.repo:void 0);if(_.restorePrs)return(0,Y.jsx)(ge,{to:`/github/prs`,replace:!0});if(!f)return d.isError?(0,Y.jsx)(U,{route:`github`,density:`empty`,children:(0,Y.jsx)(W,{icon:(0,Y.jsx)(j,{size:16}),tone:`danger`,title:`Could not load GitHub`,subtitle:d.error.message})}):(0,Y.jsx)(Ke,{});D.current=null;let O=()=>E.mutate(w.exactTargetRef.current);if(_.filterScreen&&f.available)return(0,Y.jsx)(Ct,{onRefresh:O,refreshing:E.isPending});if(!f.available)return(0,Y.jsx)(vn,{reason:f.reason,refreshing:E.isPending,onRetry:O});let{labelColors:k,labelOptions:re}=mn(f,S.searchPayload,x.openItems,x.fullList),ie=hn({number:C.selectedNumber,fullList:x.fullList,filterRows:x.filterRows,remoteDetail:C.remoteDetail,exactDetail:w.exactDetail}),ae=r===void 0?[...S.items,...S.searchHits].find(e=>e.url===v)??null:null,A=ie??ae;D.current=A?{kind:A.kind,number:A.number}:null;let{linkFilter:oe,listPath:M}=gn(e,o,s,u,c),N={view:e,filter:oe,narrows:c,colors:k,expandedUrl:ae?.url??null,onToggle:e=>y(t=>t===e.url?null:e.url),queued:g.queued,checksMap:T.checksMap,commentsOf:T.commentsOf,taskOf:ne,referenceWidth:At([...S.items,...S.searchHits])},se=_n(e,b,x.filterGate,S),P=wt({view:e,activeFilter:s,isDesktop:u,listInUrl:l,n:r,gh:f,actions:{automationsAvailable:p,refreshing:E.isPending,onRefresh:O}});return r===void 0?(0,Y.jsxs)(U,{route:`github`,density:be(S.items.length+S.searchHits.length),headerSpacing:`compact`,className:`pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-4`,bodyClassName:`gap-2.5`,header:P,children:[(0,Y.jsxs)(`header`,{"data-slot":`gh-header`,className:`flex shrink-0 flex-col gap-3 bg-background md:gap-4`,children:[(0,Y.jsx)(yn,{view:e,isDesktop:u,gh:f,onSaveView:m}),(0,Y.jsx)(bn,{view:e,gh:f,filters:b,labelOptions:re,labelColors:k,searchPayload:S.searchPayload})]}),(0,Y.jsx)(Cn,{view:e,rows:N,verdict:se,search:S,sidebar:x,list:d,paging:te})]}):(0,Y.jsx)(U,{route:`github`,density:`full`,headerSpacing:`compact`,className:`pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-4`,header:P,children:(0,Y.jsx)(On,{view:e,selected:ie,selectedNumber:C.selectedNumber,exact:w,repo:f.repo,rows:N,listPath:M,changes:t,handToAgent:g})})}function fn({index:e,isDesktop:t,listInUrl:n,n:r,rememberedView:i}){return{filterScreen:e&&!t&&!n&&r===void 0,restorePrs:e&&t&&!n&&i===`prs`}}function pn(){let e=b();return t=>{e.setQueryData(d.uiState,e=>({...e,githubView:t})),x({githubView:t}).then(t=>e.setQueryData(d.uiState,t)).catch(t=>{C(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:d.uiState})})}}function mn(e,t,n,r){return{labelColors:{...t?.labelColors,...e.labelColors},labelOptions:et([...n,...r,...t?.items??[]])}}function hn({number:e,fullList:t,filterRows:n,remoteDetail:r,exactDetail:i}){return e===null?null:t.find(t=>t.number===e)??n?.find(t=>t.number===e)??r??i??null}function gn(e,t,n,r,i){let a=t===null?null:n;return{linkFilter:a,listPath:We(e,a??(e===`issues`&&!r?`all`:null),void 0,``,i)}}function _n(e,{query:t,filtering:n},r,{searching:i,searchFailed:a,searchFailureReason:o,metadataFailure:s,searchHits:c,searchPayload:l,items:u}){let d=e===`issues`?`issues`:`pull requests`;return r?(0,Y.jsxs)(`p`,{role:`status`,className:`flex items-center gap-1.5`,"data-slot":`gh-filter-gate`,"data-kind":r.kind,children:[r.kind===`loading`?(0,Y.jsx)(F,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):null,r.message]}):n?i?(0,Y.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(F,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,t.trim(),`”…`]}):a?c.length>0?(0,Y.jsxs)(`p`,{role:`status`,children:[`Showing previous results. GitHub could not be refreshed: `,o,`. Use Refresh to try again.`]}):u.length>0?(0,Y.jsxs)(`p`,{children:[`GitHub could not be searched: `,o,`.`]}):(0,Y.jsxs)(`p`,{children:[`No open `,d,` match your filter, and GitHub could not be searched: `,o,`.`]}):s?(0,Y.jsxs)(`p`,{role:`status`,children:[`Cannot apply the selected filters to GitHub results: `,s]}):c.length>0?null:l?.truncated?(0,Y.jsx)(`p`,{children:`No matches within GitHub’s first matches. Narrow your search to check more specific results.`}):l&&u.length>0?(0,Y.jsxs)(`p`,{children:[`No additional `,d,` match your filter on GitHub.`]}):l?(0,Y.jsxs)(`p`,{children:[`No `,d,` match your filter — open, closed or merged.`]}):(0,Y.jsxs)(`p`,{children:[`No open `,d,` match your filter.`]}):(0,Y.jsxs)(`p`,{children:[`No open `,d,`.`]})}function vn({reason:e,refreshing:t,onRetry:n}){return(0,Y.jsx)(U,{route:`github`,density:`empty`,children:(0,Y.jsx)(W,{icon:(0,Y.jsx)(ie,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:e??`unknown reason`,actions:(0,Y.jsx)(I,{variant:`outline`,"data-action":`gh-retry`,disabled:t,onClick:n,children:`Try again`}),children:(0,Y.jsxs)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[`The tab needs the `,(0,Y.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,Y.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in Squawk works without it.`]})})})}function yn({view:e,isDesktop:t,gh:n,onSaveView:r}){return(0,Y.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`flex min-h-11 flex-wrap items-center gap-3`,children:[(0,Y.jsxs)(dt,{to:t?`/github`:`/github?filter=all`,active:e===`issues`,onClick:()=>r(`issues`),children:[`Issues · `,n.issuesTotal??n.issues.length]}),(0,Y.jsxs)(dt,{to:`/github/prs`,active:e===`prs`,onClick:()=>r(`prs`),children:[`Pull requests · `,n.prsTotal??n.prs.length]})]})}function bn({view:e,gh:t,filters:n,labelOptions:r,labelColors:i,searchPayload:a}){return(0,Y.jsxs)(`div`,{"data-slot":`gh-filter-toolbar`,className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`div`,{className:`relative min-w-0 basis-full md:flex-1 md:basis-auto`,children:[(0,Y.jsx)(ae,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,Y.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:e===`issues`?`Filter issues…`:`Filter pull requests…`,value:n.query,onChange:e=>n.setQuery(e.target.value),className:`min-h-11 w-full rounded-lg border border-card-edge bg-card shadow-card py-1 pr-2.5 pl-8 text-[13px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,Y.jsx)(jn,{options:r,colors:i,selected:n.labelFilter,onChange:n.setLabelFilter}),e===`issues`?(0,Y.jsx)(St,{data:{...t,issues:[...t.issues,...a?.items??[]]},assignees:n.effectiveAssignees,projectId:n.activeProject,onAssigneesChange:n.changeAssignees,onProjectChange:n.setProjectFilter}):null,(0,Y.jsx)(`button`,{type:`button`,disabled:!n.filtering,"data-slot":`gh-clear-filters`,className:`min-h-11 min-w-11 rounded-md border border-input bg-card px-3 text-sm font-medium text-foreground transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:border-border disabled:bg-transparent disabled:text-muted-foreground`,onClick:n.clearFilters,children:`Clear filters`})]})}function xn(e,t){return e.kind===`pr`?t?.[e.number]??e.checks:e.checks}function Sn(e,t,n=!1){return(0,Y.jsx)(jt,{item:e,view:t.view,filter:t.filter,narrows:t.narrows,colors:t.colors,expanded:t.expandedUrl===e.url,onToggle:()=>t.onToggle(e),queuedRunId:t.queued.get(e.url)??null,checks:xn(e,t.checksMap),comments:t.commentsOf(e),status:kt(e,n),task:t.taskOf(e),referenceWidth:t.referenceWidth})}function Cn({view:e,rows:t,verdict:n,search:r,sidebar:i,list:a,paging:o}){let{items:s,searchHits:c}=r;return(0,Y.jsxs)(`section`,{ref:o.setListEl,"data-slot":`gh-list`,className:`relative flex w-full min-w-0 flex-col rounded-lg border border-card-edge bg-card shadow-card p-3`,children:[s.length===0?n&&(0,Y.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-muted-foreground`,children:n}):(0,Y.jsx)(wn,{items:s,rows:t,paging:o}),o.pagingAvailable?(0,Y.jsx)(Tn,{view:e,list:a,paging:o}):null,(0,Y.jsx)(En,{backedQuery:i.backedQuery,filterSearch:i.filterSearch}),s.length>0&&r.searchWanted&&n?(0,Y.jsx)(`div`,{"data-slot":`gh-search-status`,role:`status`,className:`px-4 py-4 text-sm text-muted-foreground`,children:n}):null,c.length>0?(0,Y.jsx)(Dn,{hits:c,searchPayload:r.searchPayload,rows:t}):null]})}function wn({items:e,rows:t,paging:n}){let{setRowsEl:r,scrollOwner:i,listEl:a,scrollOwnerRef:o,startMargin:s}=n,c=(0,J.useRef)(null),l=(0,J.useRef)(!1);(0,J.useEffect)(()=>{if(l.current||!i)return;l.current=!0;let n=e.findIndex(e=>e.url===t.expandedUrl);n>=0&&c.current?.scrollToIndex(n,{align:`start`})},[i,e,t.expandedUrl]);let u=e.map((e,n)=>(0,Y.jsx)(`div`,{role:`listitem`,"data-slot":`gh-row-item`,"data-divided":n>0||void 0,children:Sn(e,t)},e.url));return(0,Y.jsx)(`div`,{ref:r,"data-slot":`gh-rows`,"data-virtualized":i?`true`:void 0,role:`list`,children:i?(0,Y.jsx)(Ge,{ref:c,scrollRef:o,startMargin:s,children:u},i===a?`list`:`main`):u})}function Tn({view:e,list:t,paging:n}){return(0,Y.jsx)(`div`,{ref:n.loadMoreRef,"data-slot":`gh-load-more`,className:`flex min-h-6 items-center justify-center gap-1.5 px-4 pb-3 text-xs text-muted-foreground`,children:t.isFetchingNextPage?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(F,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Loading more…`]}):t.isFetchNextPageError?(0,Y.jsxs)(Y.Fragment,{children:[`Could not load more.`,(0,Y.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-retry`,onClick:()=>void t.fetchNextPage(),className:`font-medium text-accent-text hover:underline`,children:`Retry`})]}):n.manualPaging?(0,Y.jsxs)(Y.Fragment,{children:[`Filters cover the loaded `,e===`issues`?`issues`:`pull requests`,`.`,(0,Y.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-manual`,onClick:()=>void t.fetchNextPage(),className:`font-medium text-accent-text hover:underline`,children:`Load more`})]}):null})}function En({backedQuery:e,filterSearch:t}){return e!==null&&t.data?.available&&t.data.truncated?(0,Y.jsxs)(`div`,{"data-slot":`gh-filter-note`,role:`status`,className:`px-4 py-3 text-xs text-muted-foreground`,children:[`Showing the first `,t.data.items.length,` matches from GitHub search; more may exist.`]}):null}function Dn({hits:e,searchPayload:t,rows:n}){let r=(0,J.useRef)(null),i=(0,J.useRef)(!1);(0,J.useEffect)(()=>{i.current||(i.current=!0,(r.current?.querySelector(`[data-slot="gh-row"][aria-expanded="true"]`))?.scrollIntoView({block:`start`}))},[]);let a=l();return(0,Y.jsx)(ne,{projectId:a,requests:a?e.map(e=>({projectId:a,kind:e.kind===`pr`?`PR`:`Issue`,number:e.number})):[],children:(0,Y.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,Y.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-xs font-medium tracking-wide text-muted-foreground uppercase`,children:[`Found on GitHub`,t?.truncated?` (first matches)`:``]}),(0,Y.jsx)(`ul`,{ref:r,className:`flex flex-col gap-0.5 px-2 pb-2`,children:e.map(e=>(0,Y.jsx)(`li`,{children:Sn(e,n,!0)},e.url))})]})})}function On({view:e,selected:t,selectedNumber:n,exact:r,repo:i,rows:a,listPath:o,changes:s,handToAgent:c}){let{exactWanted:l,exactItem:u}=r;return(0,Y.jsxs)(`section`,{"data-slot":`gh-detail`,className:`flex w-full min-w-0 flex-col rounded-lg border border-card-edge bg-card shadow-card`,children:[t?null:(0,Y.jsx)(`div`,{className:`px-4 pt-4 md:px-7 md:pt-5`,children:(0,Y.jsx)($e,{backLink:{to:o}})}),t?(0,Y.jsx)(kn,{item:t,repo:i,rows:a,listPath:o,changes:s,handToAgent:c}):l&&u.isPending?(0,Y.jsx)(`div`,{"data-slot":`gh-detail-loading`,className:`flex flex-1 flex-col`,children:(0,Y.jsx)(W,{icon:(0,Y.jsx)(F,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:`h2`,title:`Loading #${n}…`,subtitle:`It is not among the open items, so the tab is asking GitHub for it.`})}):l&&(u.isError||u.data?.available===!1)?(0,Y.jsx)(An,{number:n,exact:r}):(0,Y.jsx)(Et,{view:e,number:n})]})}function kn({item:e,repo:t,rows:n,listPath:r,changes:i,handToAgent:a}){let{workflows:o,skillList:s,workflow:c,setWorkflow:l,selectedSkills:u,setSelectedSkills:d,engine:f,setEngine:p,queued:m,onQueued:h}=a,g=D().state?.focusHandoff===!0;return(0,J.useEffect)(()=>{g&&Ht()},[g,e.url]),(0,Y.jsx)(rt,{item:e,comments:n.commentsOf(e),afterHeading:e.kind===`issue`?(0,Y.jsx)(ft,{number:e.number,repo:t},e.url):void 0,backLink:{to:r},subNav:{filter:n.filter,narrows:n.narrows,changes:i},onRunAgent:Ht,headerAction:(0,Y.jsx)(Vt,{item:e,queuedRunId:m.get(e.url)??null}),colors:n.colors,checks:xn(e,n.checksMap),children:(0,Y.jsx)(at,{item:e,workflows:o.data?.workflows??[],skills:s,workflow:c,onWorkflowChange:l,selectedSkills:u,onSkillsChange:d,engine:f,onEngineChange:p,queuedRunId:m.get(e.url)??null,onQueued:h},e.url)})}function An({number:e,exact:t}){let{exactItem:n,retryingExact:r,retryExact:i}=t;return(0,Y.jsx)(W,{icon:(0,Y.jsx)(j,{size:16}),tone:n.isError?`danger`:`neutral`,heading:`h2`,title:`Could not load #${e}`,subtitle:n.data?.available===!1?n.data.reason:n.error instanceof Error?n.error.message:`The request failed.`,actions:(0,Y.jsx)(I,{variant:`outline`,disabled:r,onClick:i,children:`Retry`})})}function jn({options:e,colors:t,selected:n,onChange:r}){let[i,a]=(0,J.useState)(!1),o=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,Y.jsxs)(B,{open:i,onOpenChange:a,children:[(0,Y.jsx)(R,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:k(`inline-flex min-h-11 min-w-11 shrink-0 items-center gap-1.5 rounded-md border border-input bg-card px-3 text-sm font-medium text-foreground transition-colors hover:bg-muted disabled:opacity-60`,n.length>0&&`border-accent-strong/60 text-foreground`),children:[n.length>0?`Labels · ${n.length}`:`Labels`,(0,Y.jsx)(P,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-muted-foreground`})]})}),(0,Y.jsx)(z,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,Y.jsxs)(Ee,{children:[(0,Y.jsx)(Se,{placeholder:`Filter labels…`}),(0,Y.jsxs)(Te,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Y.jsx)(we,{children:`No labels.`}),n.length>0?(0,Y.jsxs)(Ce,{value:`__clear__`,onSelect:()=>r([]),className:`min-h-11 text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let r=n.includes(e);return(0,Y.jsxs)(Ce,{value:e,onSelect:()=>o(e),className:`min-h-11`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`gh-label-dot`,className:`size-2.5 shrink-0 rounded-full ring-1 ring-foreground/30`,style:it(t[e])}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,Y.jsx)(M,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e)})]})]})})]})}export{dn as GithubRoute};
@@ -1 +0,0 @@
1
- import{n as e}from"./host-context-iTMFRMT5.js";var t=`cez-host:`;function n(n){let r=e();return r===null?n:`${t}${encodeURIComponent(r)}:${n}`}export{n as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{Sn as n,_n as r,bn as i,on as a,sn as o,vn as s,yn as c}from"./queries-DHjNE2es.js";import{n as l,u}from"./host-context-iTMFRMT5.js";import{Ji as d,Li as f,On as p,_r as m,an as h,br as g,dr as _,er as v,gr as y,lr as b,mr as x,nr as S,ur as C}from"./toaster-Dglox5F-.js";var w=e(t(),1),T=3e3,E=3e4,D=new WeakMap,O={health:[`main`,`health`],hosts:[`main`,`hosts`,`list`],hostsProjects:[`main`,`hosts`,`projects`],hostsRunsIndex:a,uiState:[`main`,`workspace`,`ui-state`]};function k(){return(0,w.useSyncExternalStore)(S,v,()=>void 0)}function A(e){return!u()&&e===`topics`}function j(e){let t=b();return f({queryKey:O.health,queryFn:({signal:e})=>r({signal:e}),enabled:e,...u()?{networkMode:`always`}:{},staleTime:E,refetchOnWindowFocus:e?`always`:!1,refetchInterval:n(e&&t?E:!1)})}function M(e={}){let{enabled:t=!0,pollWhileOffline:r=!1}=e,i=b(),a=m(),o=k(),c=l(),d=A(o),g=f({queryKey:O.hosts,queryFn:async({signal:e})=>{let t=C(),n=await s({signal:e});p(n.hosts),D.set(n,t);let i=l(),a=i?n.hosts.find(e=>e.id===i):void 0;if(i&&a){y(i,a.state,Date.now(),t);let n=_();r&&a.state===`connected`&&n.offline&&n.gatewayCode===`host-unreachable`&&h({signal:e}).catch(()=>void 0)}return n},enabled:t,...u()?{networkMode:`always`}:{},structuralSharing:!1,staleTime:1e4,refetchInterval:e=>{if(!t||!i)return!1;if(r&&a.offline)return T;let o=e.state.status===`error`||!!e.state.data?.warning;return d&&!o?!1:n(E)},refetchOnWindowFocus:t?`always`:!1});return(0,w.useEffect)(()=>{if(!c||!g.data)return;let e=g.data.hosts.find(e=>e.id===c);e&&y(c,e.state,g.dataUpdatedAt,D.get(g.data))},[c,g.data,g.dataUpdatedAt]),g}function N(e,t){return t?!0:e?e.hosts.length>0||!!e.warning:!1}function P(e={}){let{enabled:t=!0}=e,r=b();return f({queryKey:O.hostsProjects,queryFn:async({signal:e})=>{let t=await c({signal:e});return p(t.hosts),t},enabled:t,...u()?{networkMode:`always`}:{},staleTime:E,retry:!1,refetchOnWindowFocus:e=>t&&N(e.state.data,e.state.status===`error`)?`always`:!1,refetchInterval:e=>!t||!r||!N(e.state.data,e.state.status===`error`)?!1:n(E)})}function F(e){let t=o(d()),r=b(),i=k(),a=e&&!u(),s=a&&r&&i===`finite`?n(E):!1;return(0,w.useEffect)(()=>{if(!s)return;let e=setInterval(()=>{t.reconcileFinite()},s);return()=>clearInterval(e)},[s,t]),f({queryKey:O.hostsRunsIndex,queryFn:({signal:e})=>t.fetchFull(e),enabled:a,structuralSharing:!1,staleTime:1/0,retry:!1,refetchOnWindowFocus:e=>a&&e.state.status===`error`?`always`:!1})}function I(e){return f({queryKey:O.uiState,queryFn:({signal:e})=>i({signal:e}),enabled:e,...u()?{networkMode:`always`}:{}})}function L(){let e=d(),{hostId:t,offline:n}=m(),r=(0,w.useRef)(!1);(0,w.useEffect)(()=>{if(u())return x(()=>{e.refetchQueries({queryKey:O.hosts,exact:!0})})},[e]),(0,w.useEffect)(()=>{if(t===null){r.current=!1;return}r.current!==n&&e.invalidateQueries({queryKey:O.hostsProjects}),r.current=n},[t,n,e])}function R(){let e=l(),t=m(),n=M({enabled:e!==null,pollWhileOffline:!0});if(e===null)return null;let r=n.data?.hosts.find(t=>t.id===e),i=r?.label??e;return t.offline?{hostId:e,hostLabel:i,offline:!0,state:(r&&r.state!==`connected`?r.state:t.reportedState&&t.reportedState!==`connected`?t.reportedState:t.gatewayCode?g(t.gatewayCode):null)??`unreachable`,gatewayCode:t.gatewayCode}:{hostId:e,hostLabel:i,offline:!1,state:null,gatewayCode:null}}export{F as a,P as c,L as i,I as l,N as n,j as o,R as r,M as s,O as t};