@hearsay-tools/squawk 0.19.0-dev.8884 → 0.19.0-dev.8890

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 (62) hide show
  1. package/dist/server/models-routes.d.ts +12 -12
  2. package/dist/server/projects-routes.d.ts +45 -45
  3. package/dist/server/reports-api.d.ts +2 -2
  4. package/package.json +4 -4
  5. package/web/dist/assets/{accounts-section-hoIJ1y1g.js → accounts-section-DghVB9OC.js} +1 -1
  6. package/web/dist/assets/{activity-motion-DxZp9POT.js → activity-motion-B_nzNpf8.js} +1 -1
  7. package/web/dist/assets/{activity-route-DWv1sa1J.js → activity-route-B7vQBQJ9.js} +1 -1
  8. package/web/dist/assets/agent-config-section-BwZA2KUT.js +7 -0
  9. package/web/dist/assets/{agent-defaults-section-DV1EYjS4.js → agent-defaults-section-BV6e1x_k.js} +1 -1
  10. package/web/dist/assets/{appearance-CLw62KVo.js → appearance-DfQqAytS.js} +1 -1
  11. package/web/dist/assets/{archive-on-merge-field-DLzE1X_H.js → archive-on-merge-field-ux_-X6cJ.js} +1 -1
  12. package/web/dist/assets/automations-route-BW1xqdPJ.js +2 -0
  13. package/web/dist/assets/{commit-list-BZuXRQ3x.js → commit-list-B1QvE2mb.js} +1 -1
  14. package/web/dist/assets/{diff-DrARYKpR.js → diff-CVDYtR5f.js} +2 -2
  15. package/web/dist/assets/{diff-controls-C62rOSYk.js → diff-controls-DbAm3vyj.js} +1 -1
  16. package/web/dist/assets/{diff-view-CSgYwy29.js → diff-view-Bxr3btKH.js} +1 -1
  17. package/web/dist/assets/discard-changes-dialog-fxi67ueM.js +1 -0
  18. package/web/dist/assets/{file-preview-DNIfdHeC.js → file-preview-INgFZHXM.js} +1 -1
  19. package/web/dist/assets/{git-toolbar-DC4PBhUA.js → git-toolbar-DNHCL6Li.js} +1 -1
  20. package/web/dist/assets/{github-DXAy-1l9.js → github-DK8q8brO.js} +1 -1
  21. package/web/dist/assets/{global-activity-route-B3YY4F9O.js → global-activity-route-B2mVzJEQ.js} +1 -1
  22. package/web/dist/assets/{index-D0mx-XUg.css → index-CflkzdUL.css} +1 -1
  23. package/web/dist/assets/{index-DygQwjn7.js → index-Cmj0hLCQ.js} +7 -7
  24. package/web/dist/assets/{markdown-B7l0dDH1.js → markdown-DkzcTJZ1.js} +1 -1
  25. package/web/dist/assets/{notifications-section-D6ULf4HX.js → notifications-section-Bac0sdHD.js} +1 -1
  26. package/web/dist/assets/{option-select-DfIhavTu.js → option-select-C9D7zD0s.js} +1 -1
  27. package/web/dist/assets/{preview-pane-connected-DoxA-fww.js → preview-pane-connected-C7yWN61O.js} +3 -3
  28. package/web/dist/assets/{projects-section-CDMSMHFE.js → projects-section-i7nQVg42.js} +1 -1
  29. package/web/dist/assets/{prompt-templates-section-DMmsJLnJ.js → prompt-templates-section-Caje-66x.js} +1 -1
  30. package/web/dist/assets/{remote-settings-notice-vT_SqiND.js → remote-settings-notice-CCAvpXI2.js} +1 -1
  31. package/web/dist/assets/repo-git-Bj603ZUl.js +1 -0
  32. package/web/dist/assets/{report-reader-Db9uCHYJ.js → report-reader-B4vS0JHP.js} +1 -1
  33. package/web/dist/assets/reports-BdpQw6YT.js +1 -0
  34. package/web/dist/assets/{resources-section-DLBSQ86u.js → resources-section-DUZUN6C_.js} +1 -1
  35. package/web/dist/assets/review-panel-DpUBM9JE.js +11 -0
  36. package/web/dist/assets/{run-header-Dz_3eeYI.js → run-header-yU2n8t1w.js} +2 -2
  37. package/web/dist/assets/{select-D_VDDq-U.js → select-CRYap6qE.js} +1 -1
  38. package/web/dist/assets/{session-context-section-CrpBj5i2.js → session-context-section-CYwshrXd.js} +2 -2
  39. package/web/dist/assets/{settings-agent-picker-Djpp91WO.js → settings-agent-picker-DrZ3Y_T4.js} +1 -1
  40. package/web/dist/assets/{settings-shell-BnM8FG0q.js → settings-shell-CDMj5KA9.js} +1 -1
  41. package/web/dist/assets/{sidebar-section-WJiDdzkS.js → sidebar-section-Dt5jgm8T.js} +1 -1
  42. package/web/dist/assets/{skills-KIqozQUm.js → skills-Beb8A11l.js} +1 -1
  43. package/web/dist/assets/{task-changes-Bd_vt0EJ.js → task-changes-CkQP1FOg.js} +1 -1
  44. package/web/dist/assets/{task-commits-DHMAW2nI.js → task-commits-Ctwi85ad.js} +1 -1
  45. package/web/dist/assets/{task-file-scope-BlQFzrLW.js → task-file-scope-Nl1DkfPy.js} +1 -1
  46. package/web/dist/assets/{task-files-BwBvGURY.js → task-files-ClNa5Me9.js} +1 -1
  47. package/web/dist/assets/{task-github-item-WDODiSW4.js → task-github-item-C-YZ1Y6E.js} +1 -1
  48. package/web/dist/assets/task-thread-BN1MvuuJ.js +2 -0
  49. package/web/dist/assets/thread-state--bqdO3Qp.js +4 -0
  50. package/web/dist/assets/{use-hand-to-agent-state-iYYMqi-U.js → use-hand-to-agent-state-BE2hugZT.js} +1 -1
  51. package/web/dist/assets/workflows-BD1UEj-z.js +7 -0
  52. package/web/dist/assets/{workspace-tools-DvImV-Bw.js → workspace-tools-CTUdraaY.js} +1 -1
  53. package/web/dist/assets/{worktrees-section-DFTb8CjT.js → worktrees-section-HcsME2YD.js} +1 -1
  54. package/web/dist/index.html +2 -2
  55. package/web/dist/assets/agent-config-section-CaN9Tsqa.js +0 -7
  56. package/web/dist/assets/automations-route-C0HozfbY.js +0 -2
  57. package/web/dist/assets/repo-git-CojmT8ND.js +0 -1
  58. package/web/dist/assets/reports-Cg5pjc-Y.js +0 -1
  59. package/web/dist/assets/review-panel-B3nW4mdy.js +0 -11
  60. package/web/dist/assets/task-thread-BMva9nB6.js +0 -2
  61. package/web/dist/assets/thread-state-D9OBCI53.js +0 -4
  62. package/web/dist/assets/workflows-W1-z1hgt.js +0 -7
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{A as i,_ as a,nn as o,rn as s,sn as c,tn as l}from"./queries-ByqTmyCs.js";import{B as u,Fn as d,H as f,Ur as p,V as m,_ as h,ar as g,c as ee,d as _,g as v,ir as y,ni as b,nr as x,o as te,s as S,sr as ne,ti as re,v as ie,z as ae}from"./toaster-Lf_4oY96.js";import{B as C,G as oe,H as se,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-DMhTnCmf.js";import{h as ue,n as de}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as fe,t as A}from"./label-eNfbfYFG.js";import{I as pe,J as me,Y as he,it as ge,l as _e,pt as ve,ut as ye,y as be}from"./design-icons-CzEoMH9c.js";import{t as xe}from"./check-OP-CVgZG.js";import{t as j}from"./button-C8jUIs8Q.js";import{n as Se,r as Ce,t as we}from"./collapsible-CW6CfTJO.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-CRYap6qE.js";import{t as Te}from"./switch-DfPCm1H_.js";import{c as Ee,s as De,t as L}from"./project-router-CEnizJ8F.js";import{r as Oe}from"./agents-settings-path-7X6_cvUg.js";import{a as ke,c as Ae,d as je,n as Me,s as R,u as z}from"./page-shell-CpdYMj52.js";import{t as Ne}from"./centered-state-BgSV4e79.js";import{$n as B,D as Pe,G as Fe,J as Ie,K as Le,O as Re,P as ze,Rn as Be,bn as Ve,fr as He,gn as Ue,k as We,r as Ge,t as Ke,wn as qe,zn as Je}from"./index-Cmj0hLCQ.js";import{t as Ye}from"./textarea-vEsJAUAV.js";import{_ as Xe,a as Ze,c as Qe,d as $e,f as et,g as tt,h as nt,i as rt,l as it,m as at,n as ot,o as st,p as ct,r as lt,s as ut,t as V,u as dt,v as ft}from"./automation-format-DB34jUyF.js";var H=e(t(),1),U=O([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),pt=C({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()}),mt=O([`github`,`schedule`]),ht=x.omit({task:!0,images:!0,systemPrompt:!0}).extend({prompt:D(),variants:oe([w(1),w(2),w(3)]).optional(),systemPrompt:D().optional()}),gt=C({at:D(),outcome:O([`launched`,`cancelled`]),runId:D().optional(),receiptId:D().optional(),trigger:O([`schedule`,`late`,`manual`,`retry`]).optional()}),W=C({id:D(),revision:k(),name:D(),description:D().optional(),enabled:E(),kind:mt,events:T(U).optional(),intervalSeconds:k().optional(),filters:pt.optional(),schedule:Qe.optional(),task:ht,archived:gt.optional(),createdAt:D(),updatedAt:D()}),G=C({timestamp:D(),tieBreaker:D().optional()}),_t=C({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:G.optional()}),vt={lastError:D().max(1e3).optional(),lastErrorAt:D().datetime().optional()},yt=C({revision:k().optional(),baselineAt:D().optional(),armedAt:D().optional(),historyScan:_t.optional(),cursor:G.optional(),frozenHighWatermark:G.extend({tieBreaker:D()}).optional(),backlogAfter:G.extend({tieBreaker:D()}).optional(),nextCheckAt:D().optional(),lastSuccessAt:D().optional(),nextRunAt:D().optional(),lastRunAt:D().optional(),etags:se(D(),D()).optional(),backoffUntil:D().optional(),consecutiveFailures:k().optional(),...vt,onceOutcome:O([`failed`,`missed`]).optional()});function bt(e){let t=e?.consecutiveFailures??0;if(!(t<3||!e?.lastError))return{consecutiveFailures:t,lastError:e.lastError,...e.lastErrorAt?{lastErrorAt:e.lastErrorAt}:{},...e.backoffUntil?{retryAt:e.backoffUntil}:{}}}var xt=O([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]),St=C({seq:k(),ts:D(),automationId:D(),revision:k(),event:U.optional(),result:xt,reason:D().optional(),durationMs:k().optional(),receiptId:D().optional(),runId:D().optional(),githubNumber:k().optional(),githubTitle:D().optional(),githubUrl:D().optional(),rateLimit:C({bucket:O([`core`,`search`]),remaining:k().optional(),resetAt:D().optional()}).optional()}),Ct=C({matches:k(),launched:k(),duplicates:k(),errors:k()}),wt=W.extend({state:yt.optional(),latestLog:St.optional(),counts:Ct,nextRunAt:D().optional(),onceStatus:ct.optional()});C({available:E(),reason:D().optional(),timeZone:D(),scheduler:C({state:O([`scheduled`,`idle`]),nextDue:D().optional()}),automations:T(wt)}),C({automation:W}).extend({once:C({dueAt:D(),timeZone:D(),resolvedInstant:D(),note:D()}).optional()}),C({automation:W,state:yt.optional(),latestLog:St.optional(),onceStatus:ct.optional()}),C({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()}),C({checkId:D()}),C({records:T(St)}),C({receiptId:D(),runId:D()}),C({runId:D()}),W.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0,kind:!0,archived:!0}).extend({kind:mt.optional(),task:ht.omit({variants:!0}).strict(),enable:E().optional()}).omit({enable:!0}).extend({enabled:E().optional(),expectedRevision:k()}),C({archived:O([`include`,`only`]).optional()}),C({mode:O([`preview`,`execute`])});var K=n();function q({text:e}){return(0,K.jsx)(`div`,{role:`status`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:e})}var Tt={launched:`success`,manual:`success`,"catch-up":`success`,skipped:`neutral`,missed:`pending`,"no-match":`neutral`,preview:`neutral`,baseline:`neutral`,duplicate:`neutral`,failed:`danger`,error:`danger`,"rate-limited":`danger`},Et={launched:`Launched`,manual:`Manual`,"catch-up":`Catch up`,skipped:`Skipped`,missed:`Missed`,"no-match":`No match`,preview:`Preview`,baseline:`Baseline`,duplicate:`Duplicate`,failed:`Failed`,error:`Error`,"rate-limited":`Rate limited`};function Dt(e){let[t,n]=(0,H.useState)(),[r,i]=(0,H.useState)(``),a=(0,H.useCallback)(t=>h(e,{signal:t}).then(({records:e})=>{t?.aborted||(n(e),i(``))}).catch(e=>{t?.aborted||i(String(e))}),[e]);return(0,H.useEffect)(()=>{a()},[a]),(0,H.useEffect)(()=>p(a),[a]),(0,H.useEffect)(()=>fe((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function Ot(e,t){return e.result!==`failed`&&e.result!==`error`||!e.receiptId||e.runId?!1:!t.some(t=>t.receiptId===e.receiptId&&(t.runId||t.seq>e.seq))}function kt({records:e,all:t,timeZone:n,onRetried:r,readOnly:i=!1}){let a=e=>!i&&Ot(e,t),[o,s]=(0,H.useState)(),[c,l]=(0,H.useState)(),u=Date.now(),d=async e=>{s(e),l(void 0);try{await ae(e),r()}catch(t){l({receiptId:e,message:t instanceof Error?t.message:String(t)})}finally{s(void 0)}};return(0,K.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:e.map(e=>(0,K.jsxs)(`li`,{className:`min-w-0 rounded-xl border border-card-edge bg-card p-4 shadow-card`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(Ge,{dot:Tt[e.result],children:Et[e.result]}),(0,K.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:ot(e.ts,n,u)})]}),e.reason?(0,K.jsx)(`p`,{className:`mt-2 text-sm break-words text-muted-foreground`,children:e.reason}):null,e.githubUrl||e.runId||a(e)?(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[e.githubUrl?(0,K.jsx)(`a`,{className:`inline-flex min-h-11 items-center underline underline-offset-4 break-all`,href:e.githubUrl,target:`_blank`,rel:`noreferrer`,children:e.githubTitle??`GitHub #${e.githubNumber??``}`}):null,e.runId?(0,K.jsx)(L,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`}):null,a(e)?(0,K.jsx)(j,{variant:`outline`,disabled:o===e.receiptId,onClick:()=>void d(e.receiptId),children:`Retry task`}):null]}):null,c&&c.receiptId===e.receiptId?(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm break-words text-destructive`,children:c.message}):null]},e.seq))})}var J=`all`;function At({label:e,value:t,onChange:n,options:r}){return(0,K.jsxs)(I,{value:t,onValueChange:n,children:[(0,K.jsx)(N,{"aria-label":e,className:`w-full sm:w-52`,children:(0,K.jsx)(M,{})}),(0,K.jsx)(P,{children:r.map(e=>(0,K.jsx)(F,{value:e.value,children:e.label},e.value))})]})}function jt({automationId:e,automationName:t,timeZone:n,readOnly:r=!1}){let{records:i,error:a,refresh:o}=Dt(e),[s,c]=(0,H.useState)(J),[l,u]=(0,H.useState)(J),d=(0,H.useMemo)(()=>(i??[]).filter(e=>(s===J||e.result===s)&&(l===J||e.event===l)),[i,s,l]),f=(i??[]).some(e=>e.event);return(0,K.jsx)(Ae,{route:`automations`,density:i?je(d.length):`full`,header:{title:`Execution log`,subtitle:t??`Automation activity`,secondaryActions:(0,K.jsx)(R,{variant:`outline`,asChild:!0,children:(0,K.jsx)(L,{to:`/automations`,children:`Back to automations`})})},children:a&&!i?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,K.jsx)(q,{text:a}),(0,K.jsx)(j,{variant:`outline`,onClick:()=>void o(),children:`Retry`})]}):i?i.length===0?(0,K.jsx)(q,{text:`Nothing has run yet.`}):(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(At,{label:`Result`,value:s,onChange:c,options:[{value:J,label:`All results`},...xt.options.map(e=>({value:e,label:Et[e]}))]}),f?(0,K.jsx)(At,{label:`Event`,value:l,onChange:u,options:[{value:J,label:`All events`},...U.options.map(e=>({value:e,label:e}))]}):null]}),d.length===0?(0,K.jsx)(q,{text:`No rows match these filters.`}):(0,K.jsx)(kt,{records:d,all:i,timeZone:n,onRetried:()=>void o(),readOnly:r})]}):(0,K.jsx)(q,{text:`Loading execution log…`})})}function Mt({automationId:e,automationName:t,timeZone:n,showName:r=!1,readOnly:i=!1}){let{records:a,error:o,refresh:s}=Dt(e),c=`Recent activity${r&&t?` · ${t}`:``}`;return!o&&a&&a.length===0?(0,K.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`flex flex-wrap items-center gap-x-2 border-t border-border pt-2.5 text-xs text-muted-foreground`,children:[(0,K.jsx)(`h3`,{className:`font-medium text-foreground`,children:c}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,K.jsx)(`p`,{children:`Nothing has run yet.`})]}):(0,K.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`min-w-0 border-t border-border pt-2.5`,children:[(0,K.jsx)(`h3`,{className:`mb-1.5 text-xs font-medium text-muted-foreground`,children:c}),o&&!a?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,K.jsx)(q,{text:o}),(0,K.jsx)(j,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]}):a?(0,K.jsx)(kt,{records:a.slice(0,5),all:a,timeZone:n,onRetried:()=>void s(),readOnly:i}):(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading activity…`})]})}function Nt({automation:e,timeZone:t,onDeleted:n}){let r=e.archived,i=e.schedule,a=i?lt(i):null,[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(``),f=(0,H.useRef)(null),p=(0,H.useRef)(null),m=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=m.current===`keep`?p.current:m.current===`delete`?f.current:null;m.current=null,e?.focus()},[o]);let h=async()=>{l(!0);try{await _(e.id),n()}catch(e){d(e instanceof Error?e.message:String(e)),l(!1)}},g=[[`Workflow`,e.task.workflow],[`Runner`,e.task.runner],[`Model`,e.task.model],[`Effort`,e.task.effort]];return(0,K.jsx)(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,K.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[(0,K.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,K.jsxs)(`p`,{className:`text-sm break-words`,children:[(0,K.jsx)(`span`,{children:r.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`}),r.runId?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(L,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${r.runId}`,children:`Open task`})]}):null]}),(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Archived ${V(r.at,t)} (${t}).`}),a&&i?.timeZone?(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Was due ${a.date} ${a.time} (${i.timeZone}).`}):null]}),(0,K.jsxs)(`section`,{"aria-labelledby":`archived-inputs`,className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,K.jsx)(`h2`,{id:`archived-inputs`,className:`mb-3 text-[15px] font-medium`,children:`What it ran with`}),(0,K.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[(0,K.jsxs)(`div`,{className:`grid gap-1`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:`Prompt`}),(0,K.jsx)(`dd`,{className:`break-words whitespace-pre-wrap`,children:e.task.prompt})]}),g.filter(([,e])=>e).map(([e,t])=>(0,K.jsxs)(`div`,{className:`grid gap-1`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,K.jsx)(`dd`,{className:`break-words`,children:t})]},e))]})]}),(0,K.jsxs)(`section`,{className:`min-w-0`,children:[(0,K.jsx)(Mt,{automationId:e.id,automationName:e.name,timeZone:t,readOnly:!0}),(0,K.jsx)(j,{variant:`outline`,asChild:!0,className:`mt-3`,children:(0,K.jsx)(L,{to:`/automations/${e.id}/log`,children:`Execution log`})})]}),(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[o?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? Its record and log are removed; the task stays.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(j,{variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:c,onClick:()=>void h(),children:`Delete schedule`}),(0,K.jsx)(j,{ref:p,variant:`outline`,disabled:c,onClick:()=>{m.current=`delete`,s(!1)},children:`Keep`})]})]}):(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(j,{ref:f,variant:`outline`,"data-action":`automation-delete`,onClick:()=>{m.current=`keep`,s(!0)},children:`Delete`}),(0,K.jsx)(j,{variant:`outline`,asChild:!0,children:(0,K.jsx)(L,{to:`/automations`,children:`Back to automations`})})]}),u?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:u}):null]})]})})}var Pt=O([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),Y=T(D().trim().min(1).max(200)).max(100).optional(),Ft=C({includeExisting:E().optional(),requireCurrentLabels:E().optional(),authors:Y,assignees:Y,allLabels:Y,anyLabels:Y,excludeLabels:Y,changedLabels:Y,lookbackDays:k().int().min(1).max(90).default(7),maxRecords:k().int().min(1).max(100).default(25)}).passthrough(),It=C({prompt:D().min(1).max(1e5),workflow:D().trim().min(1).max(200).optional(),steps:T(y).min(1).max(100).optional(),runner:re.optional(),model:D().trim().min(1).max(200).optional(),effort:D().trim().min(1).max(32).optional(),variants:oe([w(1),w(2),w(3)]).optional(),worktree:E().optional(),autonomous:E().optional(),...g,...ne,systemPrompt:D().max(1e5).optional()}).passthrough().refine(e=>!(e.workflow&&e.steps),{message:`task selects either a named workflow or inline steps, not both`}),Lt=new Set(Object.keys(It.shape).filter(e=>e!==`variants`));function Rt(e){return Object.fromEntries(Object.entries(e).filter(([e])=>Lt.has(e)))}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??{}}},C({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:mt.default(`github`),events:T(Pt).min(1).max(4).optional(),intervalSeconds:k().int().min(60).max(86400).optional(),filters:Ft.optional(),schedule:Qe.passthrough().optional(),task:It,archived:C({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:b.custom,path:[`schedule`],message:`a scheduled automation needs a schedule`});return}e.events?.length||t.addIssue({code:b.custom,path:[`events`],message:`a GitHub automation needs at least one event`}),e.intervalSeconds===void 0&&t.addIssue({code:b.custom,path:[`intervalSeconds`],message:`a GitHub automation needs a poll interval`}),e.filters||t.addIssue({code:b.custom,path:[`filters`],message:`a GitHub automation needs its bounded filter`}),e.events?.some(e=>e===`issue.labeled`||e===`issue.unlabeled`)&&!e.filters?.changedLabels?.length&&t.addIssue({code:b.custom,path:[`filters`,`changedLabels`],message:`changedLabels is required for issue label events`})})),C({version:w(1).default(1),automations:T(ce()).default([]),tombstones:se(D(),D().datetime()).optional()}).passthrough();var X=C({timestamp:D().datetime(),tieBreaker:D().optional()}).passthrough(),zt=_t.extend({cursor:X.optional()}),Bt=C({revision:k().int().positive().optional(),baselineAt:D().datetime().optional(),armedAt:D().datetime().optional(),historyScan:zt.optional(),cursor:X.optional(),frozenHighWatermark:X.extend({tieBreaker:D()}).optional(),backlogAfter:X.extend({tieBreaker:D()}).optional(),nextCheckAt:D().datetime().optional(),lastSuccessAt:D().datetime().optional(),nextRunAt:D().datetime().optional(),lastRunAt:D().datetime().optional(),etags:se(D(),D()).optional(),backoffUntil:D().datetime().optional(),consecutiveFailures:k().int().nonnegative().optional(),...vt,onceOutcome:O([`failed`,`missed`]).optional()}).passthrough();C({version:w(1).default(1),states:se(D(),Bt).default({})}).passthrough(),C({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:C({eventId:D(),event:Pt,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 Vt=O([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]);C({seq:k().int().positive(),ts:D().datetime(),automationId:D().min(1),revision:k().int().positive(),event:Pt.optional(),result:Vt,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:C({bucket:O([`core`,`search`]),remaining:k().int().nonnegative().optional(),resetAt:D().datetime().optional()}).passthrough().optional()}).passthrough();var Ht=`quick-task`;function Ut(e={}){let{prompt:t,workflow:n,runner:r,model:i,autonomous:a,archiveWhenDone:o,autoMergePr:s,allowWorkers:c,allowMessaging:l,...u}=Rt(e.task??{prompt:``}),d=e.task===void 0;return{name:e.name??``,description:e.description??``,kind:e.kind??`schedule`,schedule:dt(e.schedule??{type:`daily`}),events:e.events??[U.options[0]],intervalSeconds:e.intervalSeconds??300,filters:e.filters??{lookbackDays:7,maxRecords:25},prompt:t,...n===void 0?d?{workflow:Ht}:{}:{workflow:n},...r===void 0?{}:{runner:r},...i===void 0?{}:{model:i},autonomous:a??!0,archiveWhenDone:o??!1,autoMergePr:s??!1,allowWorkers:c!==!1,allowMessaging:l!==!1,enabled:e.enabled??e.enable??!1,taskExtra:u}}function Wt(e){switch(e.type){case`daily`:case`weekdays`:return{type:e.type,hour:e.hour,minute:e.minute};case`weekly`:return{type:`weekly`,hour:e.hour,minute:e.minute,day:e.day};case`hours`:return{type:`hours`,every:e.every};case`once`:return{type:`once`,at:e.at??``,timeZone:e.timeZone??``,...e.latestStartMinutes===void 0?{}:{latestStartMinutes:e.latestStartMinutes}}}}function Gt(e){return{...e.taskExtra,prompt:e.prompt,...e.workflow?{workflow:e.workflow}:{},...e.runner?{runner:e.runner}:{},...e.model?{model:e.model}:{},autonomous:e.autonomous,...e.archiveWhenDone?{archiveWhenDone:!0}:{},...e.autoMergePr?{autoMergePr:!0}:{},...e.allowWorkers?{}:{allowWorkers:!1},...e.allowMessaging?{}:{allowMessaging:!1}}}function Kt(e){return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},kind:e.kind,...e.kind===`schedule`?{schedule:Wt(e.schedule)}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:Gt(e)}}function qt(e){return{...Kt(e),enable:e.enabled}}function Jt(e,t){return{...Kt(e),task:{...Gt(e),archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging},enabled:e.enabled,expectedRevision:t}}function Z(e){return`'${e.replace(/'/g,`'\\''`)}'`}var Yt=new Set([`prompt`,`workflow`,`runner`,`model`,`autonomous`,`worktree`,`archiveWhenDone`,`autoMergePr`,`allowWorkers`,`allowMessaging`]),Xt=new Set([`anyLabels`,`authors`,`changedLabels`]);function Zt(e){if(e.description!==void 0||!e.name.trim()||!e.task.prompt.trim())return!1;let t=e.task;if(Object.keys(t).some(e=>!Yt.has(e))||t.archiveWhenDone===!1||t.autoMergePr===!1||t.allowWorkers===!0||t.allowMessaging===!0||t.worktree!==!0)return!1;if(e.kind===`schedule`)return e.schedule!==void 0;let{events:n,filters:r}=e;return!n?.length||n.some(e=>e.includes(`,`))||!r||r.lookbackDays!==7||r.maxRecords!==25?!1:Object.entries(r).every(([e,t])=>e===`lookbackDays`||e===`maxRecords`||e===`includeExisting`&&t===!0||Xt.has(e)&&Array.isArray(t)&&t.length>0)}function Qt(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function $t(e){return e%1440==0?`${e/1440}d`:e%60==0?`${e/60}h`:`${e}m`}function Q(e,t){return t.startsWith(`-`)?`--${e}=${Z(t)}`:`--${e} ${Z(t)}`}function en(e){let t=[`${Ue()} automation add`,Q(`name`,e.name)];if(e.schedule?.type===`once`)t.push(Q(`at`,e.schedule.at),Q(`tz`,e.schedule.timeZone)),e.schedule.latestStartMinutes!==void 0&&t.push(Q(`latest-start`,$t(e.schedule.latestStartMinutes)));else if(e.kind===`schedule`)t.push(Q(`cron`,it(e.schedule)));else{t.push(Q(`on`,e.events.join(`,`)),`--every ${Qt(e.intervalSeconds??300)}`),e.filters?.includeExisting&&t.push(`--include-existing`);for(let n of e.filters?.anyLabels??[])t.push(Q(`label`,n));for(let n of e.filters?.authors??[])t.push(Q(`author`,n));for(let n of e.filters?.changedLabels??[])t.push(Q(`changed-label`,n))}return t.push(...tn(e.task)),e.enable===!0&&t.push(`--enable`),t.push(Q(`prompt`,e.task.prompt)),t.join(` `)}function tn(e){let t=[];return e.workflow&&t.push(Q(`workflow`,e.workflow)),e.runner&&t.push(Q(`runner`,e.runner)),e.model&&t.push(Q(`model`,e.model)),e.autonomous===!1&&t.push(`--no-autonomous`),e.archiveWhenDone&&t.push(`--archive-when-done`),e.autoMergePr&&t.push(`--auto-merge-pr`),e.allowWorkers===!1&&t.push(`--no-workers`),e.allowMessaging===!1&&t.push(`--no-messaging`),t}function nn(e,t){let n=qt(e),r=Zt(n)?en(n):`${Ue()} automation create --json ${Z(JSON.stringify(n))}`;return t?`CEZ_COCKPIT_URL=${Z(t.origin)} CEZ_PROJECT_ID=${Z(t.projectId)} HSQ_COCKPIT_URL=${Z(t.origin)} HSQ_PROJECT_ID=${Z(t.projectId)} ${r}`:r}function rn(e){let t=[],n=!1;for(let r of an(e)){let e=t.length-1;!n&&/^[A-Z_][A-Z0-9_]*=/.test(r)?t.push(r):r.startsWith(`--`)||!n?(t.push(r),n=!0):t[e]=`${t[e]} ${r}`}return t.map((e,t)=>t===0?e:` ${e}`).join(` \\
2
+ `)}function an(e){let t=[],n=``,r=!1;for(let i=0;i<e.length;i+=1){let a=e[i];!r&&a===`\\`&&i+1<e.length?(n+=a+e[i+1],i+=1):a===`'`?(r=!r,n+=a):a===` `&&!r?(n&&t.push(n),n=``):n+=a}return n&&t.push(n),t}function on({draft:e}){let t=De(),n=window.location.origin,i=(0,H.useMemo)(()=>{let r=nn(e);return t?`HSQ_COCKPIT_URL=${Z(n)} HSQ_PROJECT_ID=${Z(t)} ${r}`:r},[e,n,t]),a=(0,H.useMemo)(()=>rn(i),[i]),[o,s]=(0,H.useState)(`idle`),[c,l]=(0,H.useState)(!1),u=(0,H.useId)(),d=(0,H.useRef)(void 0);(0,H.useEffect)(()=>()=>clearTimeout(d.current),[]),(0,H.useEffect)(()=>s(`idle`),[i]);let f=async()=>{clearTimeout(d.current);try{await navigator.clipboard.writeText(a),s(`copied`),d.current=setTimeout(()=>s(`idle`),1600)}catch{s(`failed`)}};return(0,K.jsxs)(`section`,{"aria-labelledby":`copy-as-cli-heading`,"data-slot":`copy-as-cli`,className:`min-w-0 max-w-full overflow-hidden rounded-xl border border-card-edge bg-card shadow-card px-4 py-3.5`,children:[(0,K.jsxs)(`div`,{className:`flex min-h-8 min-w-0 flex-nowrap items-center justify-between gap-x-2`,children:[(0,K.jsx)(`h2`,{id:`copy-as-cli-heading`,className:`shrink-0 text-[13px] font-medium text-muted-foreground`,children:`Copy as CLI`}),(0,K.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`copy-as-cli-toggle`,"aria-expanded":c,"aria-controls":u,"aria-label":c?`Hide command`:`Show command`,className:`min-w-0 shrink gap-1 px-1.5 text-[12px] font-medium max-md:h-11 no-hover:h-11`,onClick:()=>l(e=>!e),children:[(0,K.jsx)(`span`,{className:`truncate`,children:c?`Hide`:`Show`}),(0,K.jsx)(_e,{"aria-hidden":`true`,className:r(`size-3.5 transition-transform`,c&&`rotate-180`)})]}),(0,K.jsxs)(j,{type:`button`,variant:`outline`,size:`sm`,className:`ms-auto gap-1.5 px-2 text-[12px] font-medium max-md:h-11 no-hover:h-11`,onClick:()=>void f(),children:[o===`copied`?(0,K.jsx)(xe,{"aria-hidden":`true`,className:`size-3.5`}):(0,K.jsx)(He,{"aria-hidden":`true`,className:`size-3.5`}),o===`copied`?`Copied`:`Copy`]})]}),(0,K.jsx)(`div`,{id:u,hidden:!c,className:`mbs-2 max-w-full rounded-lg border border-border bg-muted has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-ring`,children:(0,K.jsx)(`pre`,{"data-slot":`copy-as-cli-line`,tabIndex:0,"aria-label":`Command line`,className:`m-0 max-w-full px-3 pt-2.5 pb-3 font-mono text-xs leading-5 break-all whitespace-pre-wrap text-muted-foreground outline-none`,children:a})}),(0,K.jsx)(`p`,{role:`status`,className:`mbs-2 text-xs break-words text-muted-foreground`,children:o===`failed`?`Could not copy — select the line and copy it by hand.`:(0,K.jsxs)(K.Fragment,{children:[`The definition Save paused would create. `,(0,K.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-px font-mono text-xs whitespace-nowrap text-foreground [word-spacing:-0.2em]`,children:`${Ue()} automation schema`}),` prints its shape.`]})})]})}function sn({pressed:e,onClick:t,disabled:n,children:i}){return(0,K.jsx)(`button`,{type:`button`,"aria-pressed":e,disabled:n,onClick:t,className:r(`inline-flex min-h-11 items-center justify-center rounded-md border px-3.5 text-[13px] font-medium transition-colors outline-hidden focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50`,e?`border-border bg-card font-semibold text-foreground shadow-xs`:`border-transparent bg-transparent text-muted-foreground hover:text-foreground`),children:i})}var cn={"pull_request.opened":`a pull request opens`,"issue.opened":`an issue opens`,"issue.labeled":`an issue is labeled`,"issue.unlabeled":`an issue is unlabeled`},ln={"pull_request.opened":`Pull request opened`,"issue.opened":`Issue opened`,"issue.labeled":`Issue labeled`,"issue.unlabeled":`Issue unlabeled`};function un(e){let t=e.map(e=>cn[e]);if(t.length===0)return`When GitHub changes`;let n=t.slice(0,-1),r=t[t.length-1];return`When ${n.length>0?`${n.join(`, `)} or ${r}`:r}`}var dn=U.options,fn=[{seconds:60,label:`1 minute`},{seconds:300,label:`5 minutes`},{seconds:900,label:`15 minutes`},{seconds:1800,label:`30 minutes`},{seconds:3600,label:`1 hour`}],pn=[{key:`authors`,label:`Authors`},{key:`assignees`,label:`Assignees`},{key:`allLabels`,label:`Has all labels`},{key:`anyLabels`,label:`Has any label`},{key:`excludeLabels`,label:`Excludes labels`},{key:`changedLabels`,label:`Changed labels`,hint:`Required for the two label events.`}],mn=e=>(e??[]).join(`, `),hn=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function gn(e){return e?`Existing matches within the lookback are eligible on the next check. Previously processed matches will not run again.`:`Enabling starts from a current-time baseline. Existing matches will not launch tasks.`}function _n(e){let t=Math.max(1,Math.round(e.intervalSeconds/60));return`Polls GitHub every ${t} minute${t===1?``:`s`} for ${e.events.join(`, `)||`no events`}. ${gn(e.filters.includeExisting)}`}function vn({draft:e,onChange:t,disabledReason:n}){let r=n=>{t({events:e.events.includes(n)?e.events.filter(e=>e!==n):[...e.events,n]})},i=n=>t({filters:{...e.filters,...n}}),a=(n,r)=>{let i=hn(r),{[n]:a,...o}=e.filters;t({filters:i.length?{...o,[n]:i}:o})},o=fn.some(t=>t.seconds===e.intervalSeconds)?fn:[...fn,{seconds:e.intervalSeconds,label:`${Math.round(e.intervalSeconds/60)} minutes`}].sort((e,t)=>e.seconds-t.seconds);return(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[n?(0,K.jsx)(`p`,{className:`text-xs text-pending-strong`,children:`GitHub unavailable · ${n}`}):null,(0,K.jsx)(`div`,{role:`group`,"aria-label":`GitHub events`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:dn.map(t=>(0,K.jsx)(sn,{pressed:e.events.includes(t),onClick:()=>r(t),children:ln[t]},t))}),(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(A,{htmlFor:`automation-interval`,children:`Check every`}),(0,K.jsxs)(I,{value:String(e.intervalSeconds),onValueChange:e=>t({intervalSeconds:Number(e)}),children:[(0,K.jsx)(N,{id:`automation-interval`,className:`w-full sm:w-48`,"aria-label":`Check every`,children:(0,K.jsx)(M,{})}),(0,K.jsx)(P,{children:o.map(e=>(0,K.jsx)(F,{value:String(e.seconds),children:e.label},e.seconds))})]})]}),(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,K.jsx)(Te,{"aria-label":`Include existing items`,"aria-describedby":`automation-history-hint`,checked:e.filters.includeExisting??!1,onCheckedChange:e=>i({includeExisting:e})}),(0,K.jsx)(`span`,{children:`Include existing items`})]}),(0,K.jsx)(`p`,{id:`automation-history-hint`,className:`text-xs text-muted-foreground`,children:gn(e.filters.includeExisting)})]}),(0,K.jsxs)(we,{children:[(0,K.jsxs)(Ce,{className:`group flex min-h-11 items-center gap-2 text-sm font-medium`,children:[`Filters`,(0,K.jsx)(_e,{"aria-hidden":`true`,className:`size-4 text-soft-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-180`})]}),(0,K.jsx)(Se,{children:(0,K.jsxs)(`div`,{className:`grid gap-4 pt-2 sm:grid-cols-2`,children:[pn.map(t=>(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,K.jsx)(A,{htmlFor:`automation-filter-${t.key}`,children:t.label}),(0,K.jsx)(B,{id:`automation-filter-${t.key}`,className:`border-border`,placeholder:`comma separated`,value:mn(e.filters[t.key]),onChange:e=>a(t.key,e.target.value)}),t.hint?(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.hint}):null]},t.key)),(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,K.jsx)(A,{htmlFor:`automation-filter-lookback`,children:`Look back (days)`}),(0,K.jsx)(B,{id:`automation-filter-lookback`,className:`border-border`,type:`number`,min:1,value:e.filters.lookbackDays,onChange:e=>i({lookbackDays:Math.max(1,Number(e.target.value)||1)})})]}),(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,K.jsx)(A,{htmlFor:`automation-filter-max`,children:`Max records per check`}),(0,K.jsx)(B,{id:`automation-filter-max`,className:`border-border`,type:`number`,min:1,value:e.filters.maxRecords,onChange:e=>i({maxRecords:Math.max(1,Number(e.target.value)||1)})})]})]})})]})]})}var yn=e=>String(e).padStart(2,`0`);function bn({label:e,value:t,max:n,onCommit:r}){let[i,a]=(0,H.useState)(yn(t)),o=(0,H.useRef)(null),s=!(/^\d{1,2}$/.test(i)&&Number(i)===t),c=`${e} must be 00–${yn(n)}.`,l=(0,H.useId)();return(0,H.useEffect)(()=>{o.current?.setCustomValidity(s?c:``)},[s,c]),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{ref:o,"aria-label":e,"aria-invalid":s||void 0,"aria-describedby":s?l:void 0,inputMode:`numeric`,maxLength:2,className:`w-20 border-border text-center tabular-nums`,value:i,onChange:e=>{a(e.target.value),/^\d{1,2}$/.test(e.target.value)&&Number(e.target.value)<=n&&r(Number(e.target.value))},onBlur:()=>a(yn(t))}),s?(0,K.jsx)(`p`,{id:l,className:`order-last basis-full text-xs text-destructive`,children:c}):null]})}var xn=[{minutes:void 0,label:`No limit`},{minutes:30,label:`30 minutes`},{minutes:120,label:`2 hours`},{minutes:360,label:`6 hours`},{minutes:1440,label:`1 day`},{minutes:10080,label:`7 days`}],Sn=`none`,Cn=e=>String(e).padStart(2,`0`);function wn(e,t=Date.now()){let n=ft(t,e)??ft(t,`UTC`),r=new Date(Date.UTC(n.year,n.month-1,n.day+1));return`${r.getUTCFullYear()}-${Cn(r.getUTCMonth()+1)}-${Cn(r.getUTCDate())}T09:00`}function Tn(){let e=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];return e.includes(`UTC`)?e:[`UTC`,...e]}function En({value:e,stored:t,onChange:n}){let r=t=>n({...e,...t}),i=e.at?at(e.at):null,a=e.at?.slice(0,10)??``,o=i?.hour??9,s=i?.minute??0,c=(e,t,n)=>r({at:`${e}T${Cn(t)}:${Cn(n)}`}),l=(0,H.useRef)(null),u=(0,H.useId)(),d=et(e),f=!(t?.type===`once`&&t.at===e.at&&t.timeZone===e.timeZone)&&d!==null&&d<=Date.now();(0,H.useEffect)(()=>{l.current?.setCustomValidity(f?Ze:``)},[f]);let p=lt(e);return(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(A,{htmlFor:`automation-once-date`,children:`Date`}),(0,K.jsx)(B,{ref:l,id:`automation-once-date`,type:`date`,className:`w-44 max-w-full border-border`,value:a,"aria-invalid":f||void 0,"aria-describedby":f?u:void 0,onChange:e=>{/^\d{4}-\d{2}-\d{2}$/.test(e.target.value)&&c(e.target.value,o,s)},required:!0})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,K.jsx)(bn,{label:`Hour`,value:o,max:23,onCommit:e=>c(a,e,s)}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,K.jsx)(bn,{label:`Minute`,value:s,max:59,onCommit:e=>c(a,o,e)})]})]}),f?(0,K.jsx)(`p`,{id:u,className:`text-xs text-destructive`,children:Ze}):null,(0,K.jsx)(On,{value:e.timeZone??``,onCommit:e=>r({timeZone:e})}),(0,K.jsx)(kn,{value:e.latestStartMinutes,onChange:t=>n(Dn(e,t))}),p?(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Runs once at ${p.time} on ${p.date} (${e.timeZone}). ${p.note?`${p.note} `:``}Squawk must be running then.`}):null]})}function Dn(e,t){let{latestStartMinutes:n,...r}=e;return t===void 0?r:{...r,latestStartMinutes:t}}function On({value:e,onCommit:t}){let[n,r]=(0,H.useState)(e),i=(0,H.useRef)(null),a=(0,H.useId)(),o=(0,H.useId)(),[s]=(0,H.useState)(Tn),c=n!==e||!Xe(n),l=tt(n);return(0,H.useEffect)(()=>{i.current?.setCustomValidity(c?l:``)},[c,l]),(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(A,{htmlFor:`automation-once-zone`,children:`Time zone`}),(0,K.jsx)(B,{ref:i,id:`automation-once-zone`,list:a,autoComplete:`off`,spellCheck:!1,className:`w-full border-border sm:w-72`,value:n,"aria-invalid":c||void 0,"aria-describedby":c?o:void 0,onChange:e=>{r(e.target.value),Xe(e.target.value)&&t(e.target.value)}}),(0,K.jsx)(`datalist`,{id:a,children:s.map(e=>(0,K.jsx)(`option`,{value:e},e))}),c?(0,K.jsx)(`p`,{id:o,className:`text-xs break-words text-destructive`,children:l}):null]})}function kn({value:e,onChange:t}){let n=xn.some(t=>t.minutes===e)||e===void 0?xn:[...xn,{minutes:e,label:`${e} minutes`}];return(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(A,{htmlFor:`automation-once-latest`,children:`Latest start`}),(0,K.jsxs)(I,{value:e===void 0?Sn:String(e),onValueChange:e=>t(e===Sn?void 0:Number(e)),children:[(0,K.jsx)(N,{id:`automation-once-latest`,className:`w-full sm:w-48`,"aria-label":`Latest start`,children:(0,K.jsx)(M,{})}),(0,K.jsx)(P,{children:n.map(e=>(0,K.jsx)(F,{value:e.minutes===void 0?Sn:String(e.minutes),children:e.label},e.label))})]}),(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`If Squawk was not running at the time, it still starts the task this long afterwards; later, the schedule is marked missed.`})]})}var An=[{type:`daily`,label:`Every day`},{type:`weekdays`,label:`Weekdays`},{type:`weekly`,label:`Weekly`},{type:`hours`,label:`Every N hours`},{type:`once`,label:`Once`}];function jn({value:e,stored:t,onChange:n,timeZone:r}){let i=t=>n({...e,...t}),a=t=>i(t===`once`?{type:t,at:e.at??wn(r),timeZone:e.timeZone??r}:{type:t});return(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsx)(`div`,{role:`group`,"aria-label":`Repeat`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:An.map(t=>(0,K.jsx)(sn,{pressed:e.type===t.type,onClick:()=>a(t.type),children:t.label},t.type))}),e.type===`once`?(0,K.jsx)(En,{value:e,stored:t,onChange:n}):null,e.type===`weekly`?(0,K.jsx)(`div`,{role:`group`,"aria-label":`Day of the week`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:ut.map((t,n)=>(0,K.jsx)(sn,{pressed:e.day===n+1,onClick:()=>i({day:n+1}),children:t},t))}):null,e.type===`once`?null:e.type===`hours`?(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(A,{htmlFor:`automation-every`,children:`Run every`}),(0,K.jsxs)(I,{value:String(e.every),onValueChange:e=>i({every:Number(e)}),children:[(0,K.jsx)(N,{id:`automation-every`,className:`w-full sm:w-48`,"aria-label":`Run every`,children:(0,K.jsx)(M,{})}),(0,K.jsx)(P,{children:st.map(e=>(0,K.jsx)(F,{value:String(e),children:e===1?`hour`:`${e} hours`},e))})]}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Counted from midnight, so “every 6 hours” runs at 00:00, 06:00, 12:00 and 18:00.`})]}):(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,K.jsx)(bn,{label:`Hour`,value:e.hour,max:23,onCommit:e=>i({hour:e})}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,K.jsx)(bn,{label:`Minute`,value:e.minute,max:59,onCommit:e=>i({minute:e})}),(0,K.jsx)(`span`,{className:`text-sm break-all text-muted-foreground`,children:r})]}),e.type===`once`?null:(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Cron: `,(0,K.jsx)(`code`,{className:`font-mono text-foreground`,children:it(e)})]})]})}var Mn=40*864e5,Nn=5;function Pn({schedule:e,timeZone:t,now:n=Date.now()}){if(e.type===`once`)return(0,K.jsx)(Fn,{schedule:e,now:n});let r=$e(e,n+1,n+Mn,t,Nn);return(0,K.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,"data-slot":`next-runs`,className:`min-w-0 rounded-xl border bg-card p-5`,children:[(0,K.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-2 text-base font-semibold`,children:`Next 5 runs`}),r.length===0?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No runs in the next 40 days.`}):(0,K.jsx)(`ol`,{"aria-label":`Next 5 runs`,className:`grid divide-y divide-border text-sm`,children:r.map((e,r)=>(0,K.jsxs)(`li`,{className:`flex min-h-10 items-center justify-between gap-3 py-1.5`,children:[(0,K.jsx)(`span`,{className:r===0?`font-semibold tabular-nums text-foreground`:`font-medium tabular-nums`,children:V(new Date(e).toISOString(),t)}),(0,K.jsx)(`span`,{className:r===0?`font-medium text-accent-text`:`text-muted-foreground`,children:rt(n,e)})]},e))}),(0,K.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Times are in `,t,`, the zone this Squawk runs in.`]})]})}function Fn({schedule:e,now:t}){let n=et(e),r=lt(e);return(0,K.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,"data-slot":`next-runs`,className:`min-w-0 rounded-xl border bg-card p-5`,children:[(0,K.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-base font-semibold`,children:`Runs once`}),n===null||!r?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pick a date, a time and a time zone.`}):(0,K.jsxs)(`p`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 text-sm`,children:[(0,K.jsx)(`span`,{className:`font-medium tabular-nums`,children:`${r.date} ${r.time}`}),n>t?(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:rt(t,n)}):null]}),r?.note?(0,K.jsx)(`p`,{className:`mt-2 text-sm break-words`,children:r.note}):null,n!==null&&n<=t?(0,K.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:`The due time has passed.`}):null,(0,K.jsx)(`p`,{className:`mt-3 text-xs break-words text-muted-foreground`,children:`Times are in ${e.timeZone??`UTC`}. Squawk must be running then; afterwards the schedule is archived with its task.`})]})}var In={schedule:`On a schedule`,github:`When GitHub changes`};function Ln(e){return/time zone|due time/i.test(e)?`when`:/placeholder|prompt|workflow|runner|model|task|autonomous/i.test(e)?`run`:/\bname\b/i.test(e)?`name`:/schedule|github|event|filter|label|interval|remote|forge|lookback|records?|hour|minute|poll|kind|archived/i.test(e)?`when`:`form`}function Rn({title:e,hideLegend:t=!1,failure:n,section:r,children:i}){let a=(0,H.useId)();return(0,K.jsxs)(`section`,{role:t?void 0:`group`,"aria-labelledby":t?void 0:a,className:`grid min-w-0 gap-3.5 rounded-xl border border-card-edge bg-card shadow-card p-5`,children:[t?null:(0,K.jsx)(`h2`,{id:a,className:`text-sm font-semibold text-foreground`,children:e}),i,n?.section===r&&!n.conflict?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:n.message}):null]})}function zn({draft:e,patch:t,forge:n,automation:r}){return(0,K.jsx)(K.Fragment,{children:r?(0,K.jsxs)(`p`,{className:`text-sm`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`Trigger · `}),In[e.kind]]}):(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,K.jsx)(Ke,{slot:`automation-kind`,label:`Trigger`,size:`touch`,value:e.kind,onChange:e=>t({kind:e}),options:[{value:`schedule`,label:In.schedule},{value:`github`,label:In.github,disabled:!n.available,...n.available?{}:{title:n.reason??`GitHub is unavailable`}}]}),n.available?null:(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`GitHub unavailable · ${n.reason??`no GitHub access`}`})]})})}function Bn({draft:e,patch:t,forge:n,timeZone:r,automation:i}){return e.kind===`schedule`?(0,K.jsx)(jn,{value:e.schedule,stored:i?.schedule,onChange:e=>t({schedule:e}),timeZone:r}):(0,K.jsx)(vn,{draft:e,onChange:t,...n.available?{}:{disabledReason:n.reason??`no GitHub access`}})}function Vn({draft:e,patch:t,saving:n,automation:r}){let i=e.kind===`schedule`?[`date`,`time`,`project`,`automation`]:[`github.kind`,`github.number`,`github.title`,`github.url`,`github.author`,`github.assignees`,`github.labels`,`github.event`],a=[...new Set([...e.prompt.matchAll(/\{\{([^{}]+)\}\}/g)].map(e=>e[1]))].filter(e=>!i.includes(e));return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,K.jsx)(A,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,K.jsx)(Ye,{id:`automation-prompt`,value:e.prompt,onChange:e=>t({prompt:e.target.value}),rows:3,className:`[field-sizing:fixed] min-h-[88px] resize-none border-border bg-background`,required:!0}),(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:e.kind===`schedule`?(0,K.jsxs)(K.Fragment,{children:[`Available: `,`{{date}}`,` `,`{{time}}`,` `,`{{project}}`,` `,`{{automation}}`,`. A run-context block is appended automatically.`]}):(0,K.jsxs)(K.Fragment,{children:[`Available: `,`{{github.number}}`,` `,`{{github.title}}`,` `,`{{github.url}}`,` `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})})]}),a.length?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:`Unavailable for this trigger: ${a.map(e=>`{{${e}}}`).join(`, `)}`}):null,(0,K.jsx)(Kn,{draft:e,patch:t}),(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,K.jsx)(Te,{"aria-label":`Autonomous`,checked:e.autonomous,onCheckedChange:e=>t({autonomous:e})}),(0,K.jsxs)(`span`,{children:[`Autonomous `,(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`· runs without waiting for answers`})]})]}),(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`Each run is an ordinary task in its own worktree, queued behind the parallel cap.`}),(0,K.jsx)(We,{archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,onChange:t,disabled:n}),(0,K.jsx)(Re,{allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging,onChange:t,disabled:n}),r?(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`These settings apply to future tasks. Existing tasks keep their settings.`}):null]})}function Hn({draft:e,patch:t,automation:n}){let r=e.kind===`schedule`;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,K.jsx)(Te,{"aria-label":n?`Enabled`:`Enable after saving`,checked:e.enabled,onCheckedChange:e=>t({enabled:e})}),(0,K.jsx)(`span`,{children:n?`Enabled`:`Enable after saving`})]}),(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:r&&e.schedule.type===`once`?`It runs once at the time set above, then moves to Archived with its task.`:r?`The first run is the next occurrence shown beside the schedule.`:gn(e.filters.includeExisting)})]})}function Un({automation:e,forge:t,timeZone:n,onSaved:r,onReload:i}){let[a,o]=(0,H.useState)(()=>Ut(e)),[s,c]=(0,H.useState)(e?.revision),[l,u]=(0,H.useState)(),[p,h]=(0,H.useState)(!1),[g,v]=(0,H.useState)(!1),[y,b]=(0,H.useState)(!1),[x,te]=(0,H.useState)(``),S=e=>o(t=>({...t,...e})),ne=async t=>{if(t.preventDefault(),p)return;let n=t.currentTarget;if(n instanceof HTMLFormElement&&!n.checkValidity()){n.reportValidity();return}h(!0),u(void 0);let i=`save`;try{if(e&&s!==void 0){let{automation:t}=await f(e.id,Jt({...a,enabled:e.enabled},s));c(t.revision),a.enabled!==e.enabled&&(i=`enable`,await m(e.id,a.enabled))}else await ee(qt(a));r()}catch(t){let n=t instanceof Error?t.message:String(t);i===`save`&&e&&t instanceof d&&t.status===409&&/revision conflict/i.test(n)?u({section:`form`,message:`Edited elsewhere — reload to see the latest version`,conflict:!0}):u({section:i===`enable`?`enable`:Ln(n),message:n})}finally{h(!1)}},re=async()=>{if(!(!e||y)){b(!0),te(``);try{await _(e.id),r()}catch(e){te(e instanceof Error?e.message:String(e))}finally{b(!1)}}},ie=(0,H.useId)(),ae=(0,H.useId)(),C=a.kind===`schedule`;return(0,K.jsx)(ke,{route:`automations`,density:a.name.trim()===``&&a.prompt.trim()===``?`sparse`:`full`,header:Gn({automation:e,draft:a,formId:ie,saveHintId:ae,saving:p}),children:(0,K.jsxs)(`form`,{id:ie,className:`automation-editor grid min-w-0 gap-4 md:grid-cols-[minmax(0,1fr)_320px] md:items-start`,onSubmit:ne,children:[(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-3.5`,children:[(0,K.jsx)(Rn,{title:`Name`,hideLegend:!0,section:`name`,failure:l,children:(0,K.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,K.jsx)(A,{htmlFor:`automation-name`,className:`text-sm font-semibold text-foreground`,children:`Name`}),(0,K.jsx)(B,{id:`automation-name`,className:`border-border`,value:a.name,placeholder:`Daily dependency audit`,onChange:e=>S({name:e.target.value}),required:!0})]})}),(0,K.jsxs)(Rn,{title:`When`,section:`when`,failure:l,children:[(0,K.jsx)(zn,{draft:a,patch:S,forge:t,automation:e}),(0,K.jsx)(Bn,{draft:a,patch:S,forge:t,timeZone:n,automation:e})]}),(0,K.jsx)(Rn,{title:`What to run`,section:`run`,failure:l,children:(0,K.jsx)(Vn,{draft:a,patch:S,saving:p,automation:e})}),(0,K.jsx)(Rn,{title:`Enable`,section:`enable`,failure:l,children:(0,K.jsx)(Hn,{draft:a,patch:S,automation:e})}),l?.section===`form`?(0,K.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 text-sm text-destructive`,children:[(0,K.jsx)(`span`,{className:`break-words`,children:l.message}),l.conflict&&i?(0,K.jsx)(j,{type:`button`,variant:`outline`,onClick:i,children:`Reload`}):null]}):null,e?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2 border-t pt-4`,children:[g?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? It will stop running and cannot be restored.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(j,{type:`button`,variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:y,onClick:()=>void re(),children:`Delete automation`}),(0,K.jsx)(j,{type:`button`,variant:`outline`,disabled:y,onClick:()=>{v(!1),te(``)},children:`Keep`})]})]}):(0,K.jsx)(j,{type:`button`,variant:`outline`,"data-action":`automation-delete`,onClick:()=>v(!0),children:`Delete`}),x?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:x}):null]}):null]}),(0,K.jsxs)(`aside`,{className:`grid min-w-0 max-w-full grid-cols-[minmax(0,1fr)] gap-4 md:sticky md:top-4`,children:[C?(0,K.jsx)(Pn,{schedule:a.schedule,timeZone:n}):(0,K.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-5`,children:[(0,K.jsx)(`h2`,{className:`mb-2 text-base font-semibold`,children:`How it polls`}),(0,K.jsx)(`p`,{className:`text-sm break-words text-muted-foreground`,children:_n(a)})]}),(0,K.jsx)(on,{draft:a})]})]})})}function Wn(e){let t=[!e.name.trim()&&`a name`,!e.prompt.trim()&&`a prompt`].filter(Boolean);return t.length?`Add ${t.join(` and `)} to save.`:``}function Gn({automation:e,draft:t,formId:n,saveHintId:r,saving:i}){let a=t.name.trim()?t.prompt.trim()?``:`Prompt`:`Name`,o=Wn(t),s=e?`Save changes`:t.enabled?`Save and enable`:`Save paused`;return{title:e?`Edit automation`:`New automation`,subtitle:`Define when it runs and the ordinary task it launches.`,status:(0,K.jsx)(`p`,{id:r,"data-slot":`automation-save-hint`,className:`min-h-[1lh] text-xs text-muted-foreground`,children:o}),secondaryActions:(0,K.jsx)(R,{type:`button`,variant:`outline`,asChild:!0,children:(0,K.jsx)(L,{to:`/automations`,children:`Cancel`})}),primaryAction:(0,K.jsx)(R,{type:`submit`,form:n,variant:`primary`,disabled:i||a!==``,title:a?`${a} is required`:void 0,"aria-describedby":o?r:void 0,children:i?`Saving…`:s})}}function Kn({draft:e,patch:t}){let n=i(),r=Ve(),{runners:u,signedOut:d}=r.runnersOn(e=>r.repoAccount?.[e]),f=a(),p=s(),{runner:m,ready:h}=o(e.runner??f.data?.defaultRunner??`claude`),g=c(m,h,r.repoAccount?.[m]),ee=[...new Set([...(n.data?.workflows??[]).map(e=>e.name),...e.workflow?[e.workflow]:[]])],_=[...new Set([...u,...e.runner?[e.runner]:[]])],v=ze(m,p.data,g.data,[e.model]),y=v.find(t=>t.id===(e.model??``))?.label??e.model??`auto`,b=e=>(0,K.jsx)(e,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`});return(0,K.jsx)(Le,{children:(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(Fe,{slot:`automation-workflow-pill`,icon:b(ye),fieldLabel:!0,ariaLabel:`Workflow`,label:e.workflow??`inline steps`,value:e.workflow??``,disabled:e.workflow===void 0,disabledHint:`This automation carries its own steps.`,options:ee.map(e=>({value:e,label:e})),onPick:e=>t({workflow:e})}),(0,K.jsx)(Fe,{slot:`automation-runner-pill`,icon:b(ge),fieldLabel:!0,ariaLabel:`Runner`,label:e.runner?l(p.data,e.runner):`default`,value:e.runner??``,disabled:!p.data,options:[{value:``,label:`default`,desc:`The project’s default runner`},..._.map(e=>({value:e,label:l(p.data,e)}))],footer:(0,K.jsx)(Ie,{uninstalled:r.uninstalled,signedOut:d.filter(t=>t!==e.runner)}),onPick:e=>{t({runner:e||void 0,model:void 0})}}),(0,K.jsx)(Fe,{slot:`automation-model-pill`,icon:b(be),fieldLabel:!0,ariaLabel:`Model`,label:y,value:e.model??``,options:v.map(e=>({value:e.id,label:e.label,desc:e.desc})),onPick:e=>t({model:e||void 0})})]})})}function qn(e){return{text:/\bauth\b|sign.?in|\blogin\b|\btoken\b|credentials|HTTP 401/i.test(e)?`GitHub CLI is not signed in`:/ENOENT|not found.*gh|gh.*not found/i.test(e)?`GitHub CLI is not installed`:`GitHub filter check failed`,tone:`error`,details:e}}function Jn({data:e,error:t,refresh:n,archived:i=!1,onArchivedChange:a}){let[o,s]=(0,H.useState)({}),[c,l]=(0,H.useState)({}),d=(e,t)=>s(n=>{let{[e]:r,...i}=n;return t?{...i,[e]:t}:i}),f=async(e,t,n=!1)=>{l(t=>({...t,[e]:!0}));try{await t()}catch(t){let r=t instanceof Error?t.message:String(t);d(e,n?qn(r):{text:r,tone:`error`})}finally{l(t=>({...t,[e]:!1}))}},p=e=>f(e.id,async()=>{d(e.id,{text:`Starting…`,tone:`info`});let{runId:t}=await u(e.id);d(e.id,{text:`Started task`,tone:`info`,runId:t}),n()}),h=e=>f(e.id,async()=>{d(e.id,void 0),await m(e.id,!e.enabled),await n()}),g=e=>f(e.id,async()=>{d(e.id,void 0),await te(e.id),await n()}),ee=e=>f(e.id,async()=>{d(e.id,{text:`Checking…`,tone:`info`});let{checkId:t}=await S(e.id,`preview`);for(let r=0;r<60;r+=1){let r=await v(t);if(r.status===`complete`){d(e.id,{text:`${r.matches??0} filter match${r.matches===1?``:`es`} found; no tasks launched. Counts can include closed items and previously processed events.`,tone:`info`}),n();return}if(r.status===`error`){let t=r.error??`Preview failed`;d(e.id,qn(t));return}await new Promise(e=>setTimeout(e,500))}throw Error(`Preview is still running`)},!0),_=e?.automations??[],y=_.filter(e=>!e.archived),b=_.filter(e=>!!e.archived),x=i?b:y;return(0,K.jsx)(z,{route:`automations`,density:e?je(x.length):`full`,headerSpacing:`compact`,header:{title:`Automations`,subtitle:`Schedules and GitHub checks run while Squawk is open.`,primaryAction:(0,K.jsx)(R,{variant:`primary`,asChild:!0,children:(0,K.jsxs)(L,{to:`/automations/new`,children:[(0,K.jsx)(me,{"aria-hidden":`true`,className:`size-4`}),`New automation`]})})},sparseFooter:e&&x.length>0&&!i?(0,K.jsx)(Me,{summary:`${x.length} active ${x.length===1?`automation`:`automations`} configured. New automations start paused so you can test filters before enabling them.`,actions:(0,K.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,K.jsx)(L,{to:`/automations/new`,children:`Add another`})})}):void 0,children:t&&!e?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,K.jsx)(q,{text:t}),(0,K.jsx)(j,{variant:`outline`,onClick:()=>void n(),children:`Retry`})]}):e?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-end justify-between gap-3 border-b border-border`,children:[a?(0,K.jsxs)(`div`,{className:`flex gap-6`,role:`group`,"aria-label":`Filter automations`,children:[(0,K.jsxs)(`button`,{type:`button`,"data-slot":`automations-tab`,"data-view":`active`,"aria-pressed":!i,onClick:()=>a(!1),className:r(`-mb-px flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground`,!i&&`border-accent-text text-foreground`),children:[`Current`,(0,K.jsx)(Yn,{count:y.length})]}),(0,K.jsxs)(`button`,{type:`button`,"data-slot":`automations-tab`,"data-view":`archived`,"aria-pressed":i,onClick:()=>a(!0),className:r(`-mb-px flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground`,i&&`border-accent-text text-foreground`),children:[`Archived`,(0,K.jsx)(Yn,{count:b.length})]})]}):(0,K.jsx)(`span`,{}),(0,K.jsx)(`div`,{className:`pb-2.5`,children:(0,K.jsx)(Xn,{data:e})})]}),i&&x.length===0?(0,K.jsx)(q,{text:`No archived automations.`}):x.length===0?(0,K.jsx)(Ne,{icon:(0,K.jsx)(ve,{}),tone:`neutral`,title:`No automations yet`,subtitle:`Create one paused, preview it, then enable it.`,heading:`h2`,actions:(0,K.jsx)(j,{variant:`primary`,asChild:!0,children:(0,K.jsxs)(L,{to:`/automations/new`,children:[(0,K.jsx)(me,{"aria-hidden":`true`,className:`size-4`}),`New automation`]})})}):(0,K.jsx)(`ul`,{className:`grid gap-3`,"aria-label":`Automations`,children:x.map(t=>(0,K.jsx)(ar,{automation:t,timeZone:e.timeZone,note:o[t.id],busy:c[t.id]===!0,onRun:()=>void p(t),onToggle:()=>void h(t),onPreview:()=>void ee(t),onCancel:()=>void g(t)},t.id))})]}):(0,K.jsx)(q,{text:`Loading automations…`})})}function Yn({count:e}){return e===0?null:(0,K.jsx)(`span`,{"data-slot":`automations-tab-count`,className:`tabular-nums text-muted-foreground`,children:`· ${e}`})}function Xn({data:e}){return(0,K.jsx)(`p`,{"data-slot":`automation-scheduler`,className:r(`text-xs break-words`,e.scheduler.state===`scheduled`?`text-success`:`text-muted-foreground`),children:`Scheduler ${e.scheduler.state===`scheduled`?`running`:`idle`} · GitHub ${e.available?`available`:`unavailable`}${e.reason?` · ${e.reason}`:``} · ${e.timeZone}`})}function Zn(e){return e.kind===`schedule`&&e.schedule?nt(e.schedule):`${un(e.events??[])} · every ${Math.round((e.intervalSeconds??300)/60)} min`}function Qn({automation:e,nextRun:t}){let n=e.kind===`schedule`?he:pe,r=qe(e);return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 font-semibold break-words`,children:[(0,K.jsx)(n,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),e.name]}),(0,K.jsxs)(`p`,{"data-slot":`automation-meta`,className:`mt-1 flex flex-wrap items-baseline gap-x-1.5 ps-6 text-xs break-words text-muted-foreground`,children:[(0,K.jsx)(`span`,{children:Zn(e)}),t?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),t]}):null]})]}),(0,K.jsx)(Ge,{dot:r.tone,shape:r.shape,pulse:r.pulse,children:r.label})]})}function $n({automation:e,archive:t}){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`text-sm break-words`,children:[t.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`,t.runId?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(L,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${t.runId}`,children:`Open task`})]}):null]}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,K.jsx)(j,{variant:`outline`,asChild:!0,children:(0,K.jsx)(L,{to:`/automations/${e.id}`,children:`Details`})})})]})}function er({automation:e,timeZone:t}){let n=e.kind===`schedule`,r=e.enabled&&n?e.nextRunAt:void 0;return!n&&e.enabled?(0,K.jsx)(`span`,{children:`continuous`}):r?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-foreground`,children:`Next run: ${V(r,t)}`}),(0,K.jsx)(`span`,{children:`· ${rt(Date.now(),Date.parse(r))}`})]}):(0,K.jsx)(`span`,{children:`Next run: —`})}function tr({automation:e,timeZone:t}){let n=e.enabled?bt(e.state):void 0;return n?(0,K.jsxs)(`p`,{role:`alert`,"data-slot":`automation-failing`,className:`text-sm break-words text-destructive`,children:[`The last ${n.consecutiveFailures} checks failed: ${n.lastError}`,n.retryAt?(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:` · Next try ${V(n.retryAt,t)}`}):null]}):null}var $=`h-8 px-3 max-md:h-11 no-hover:h-11`;function nr({automation:e,busy:t,confirmingCancel:n,cancelRef:i,onToggle:a,onRun:o,onPreview:s,onOpenCancel:c}){let l=e.kind===`schedule`,u=e.schedule?.type===`once`;return(0,K.jsxs)(`div`,{"data-slot":`automation-actions`,className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(j,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-toggle`,disabled:t,onClick:a,children:e.enabled?`Pause`:`Enable`}),l?(0,K.jsx)(j,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-run`,disabled:t,onClick:o,children:`Run now`}):(0,K.jsx)(j,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-preview`,disabled:t,onClick:s,children:`Test filter`}),(0,K.jsx)(j,{variant:`outline`,size:`sm`,className:$,asChild:!0,children:(0,K.jsx)(L,{to:`/automations/${e.id}`,children:`Edit`})}),u&&!n?(0,K.jsx)(j,{variant:`outline`,size:`sm`,className:r($,`text-destructive`),ref:i,"data-action":`automation-cancel`,disabled:t,onClick:c,children:`Cancel`}):null,(0,K.jsx)(j,{variant:`outline`,size:`sm`,className:r($,`sm:ms-auto`),asChild:!0,children:(0,K.jsx)(L,{to:`/automations/${e.id}/log`,children:`Execution log`})})]})}function rr({automation:e,busy:t,keepRef:n,onConfirm:r,onKeep:i}){return(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Cancel “${e.name}”? It will never run, and it moves to Archived.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(j,{variant:`danger-ghost`,"data-action":`automation-cancel-confirm`,disabled:t,onClick:r,children:`Cancel schedule`}),(0,K.jsx)(j,{ref:n,variant:`outline`,disabled:t,onClick:i,children:`Keep`})]})]})}function ir({note:e}){return(0,K.jsxs)(`div`,{role:e.tone===`error`?`alert`:`status`,className:r(`text-sm break-words`,e.tone===`error`?`text-destructive`:`text-muted-foreground`),children:[e.text,e.details?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(de,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:Oe(`gh`),children:`Set up`}),(0,K.jsxs)(`details`,{children:[(0,K.jsx)(`summary`,{className:`min-h-11 cursor-pointer`,children:`Command details`}),(0,K.jsx)(`pre`,{className:`whitespace-pre-wrap break-words`,children:e.details})]})]}):null,e.runId?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(L,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`})]}):null]})}function ar({automation:e,timeZone:t,note:n,busy:r,onRun:i,onToggle:a,onPreview:o,onCancel:s}){let[c,l]=(0,H.useState)(!1),u=(0,H.useRef)(null),d=(0,H.useRef)(null),f=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=f.current===`keep`?d.current:f.current===`cancel`?u.current:null;f.current=null,e?.focus()},[c]);let p=()=>{f.current=`keep`,l(!0)},m=()=>{f.current=`cancel`,l(!1)},h=e.archived;return(0,K.jsxs)(`li`,{"data-slot":`automation-card`,"data-kind":e.kind,className:`flex min-w-0 flex-col gap-2.5 rounded-xl border border-card-edge bg-card p-4 shadow-card`,children:[(0,K.jsx)(Qn,{automation:e,nextRun:h?void 0:(0,K.jsx)(er,{automation:e,timeZone:t})}),h?(0,K.jsx)($n,{automation:e,archive:h}):null,h?null:(0,K.jsx)(tr,{automation:e,timeZone:t}),h?null:(0,K.jsx)(nr,{automation:e,busy:r,confirmingCancel:c,cancelRef:u,onToggle:a,onRun:i,onPreview:o,onOpenCancel:p}),e.schedule?.type===`once`&&!h&&c?(0,K.jsx)(rr,{automation:e,busy:r,keepRef:d,onConfirm:()=>{l(!1),s()},onKeep:m}):null,n?(0,K.jsx)(ir,{note:n}):null,(0,K.jsx)(Mt,{automationId:e.id,automationName:e.name,timeZone:t})]})}function or(e){let t=De(),n=Je(),[r,i]=(0,H.useState)(),[a,o]=(0,H.useState)(``),s=(0,H.useCallback)(t=>ie({signal:t,...e?{archived:e}:{}}).then(e=>{t?.aborted||(i(e),o(``))}).catch(e=>{t?.aborted||o(String(e))}),[e]);return(0,H.useEffect)(()=>{n&&s()},[n,s]),(0,H.useEffect)(()=>p(async e=>{n&&await s(e)}),[n,s]),(0,H.useEffect)(()=>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 sr({mode:e=`list`}){let{automationId:t}=ue(),n=Ee(),[r,i]=(0,H.useState)(!1),{data:a,error:o,refresh:s}=or(`include`),[c,l]=(0,H.useState)(0),u=Be();if(u===`unknown`)return(0,K.jsx)(z,{route:`automations`,density:`empty`,children:(0,K.jsx)(q,{text:`Loading automations…`})});if(u===`absent`)return(0,K.jsx)(Pe,{});if(u===`disabled`)return(0,K.jsx)(z,{route:`automations`,density:`empty`,children:(0,K.jsx)(Ne,{icon:(0,K.jsx)(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,K.jsx)(Jn,{data:a,error:o,refresh:s,archived:r,onArchivedChange:i});if(!a)return o?(0,K.jsx)(z,{route:`automations`,density:`empty`,header:{title:`Automations`,subtitle:`Could not load automations.`},children:(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,K.jsx)(q,{text:o}),(0,K.jsx)(j,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]})}):(0,K.jsx)(z,{route:`automations`,density:`empty`,children:(0,K.jsx)(q,{text:`Loading automations…`})});let p={available:a.available,...a.reason?{reason:a.reason}:{}};return e===`new`?(0,K.jsx)(Un,{forge:p,timeZone:a.timeZone,onSaved:d}):e===`edit`?f?f.archived?(0,K.jsx)(Nt,{automation:f,timeZone:a.timeZone,onDeleted:d}):(0,K.jsx)(Un,{automation:f,forge:p,timeZone:a.timeZone,onSaved:d,onReload:()=>void s().then(()=>l(e=>e+1))},`${f.id}:${c}`):(0,K.jsx)(z,{route:`automations`,density:`empty`,header:{title:`Automation not found`,subtitle:`This automation may have been removed.`},children:(0,K.jsx)(j,{asChild:!0,variant:`outline`,children:(0,K.jsx)(L,{to:`/automations`,children:`Back to automations`})})}):t?(0,K.jsx)(jt,{automationId:t,automationName:f?.name,timeZone:a.timeZone,readOnly:!!f?.archived}):(0,K.jsx)(q,{text:`Automation not found.`})}export{sr as AutomationsRoute};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{Fn as i}from"./toaster-Lf_4oY96.js";import{X as a,j as o,ot as s,r as c}from"./design-icons-CzEoMH9c.js";import{n as l}from"./diff-controls-C62rOSYk.js";import{l as u}from"./reference-chip-hn8jj_Mo.js";import{t as d}from"./button-C8jUIs8Q.js";import{t as f}from"./project-router-CEnizJ8F.js";import{t as p}from"./centered-state-BgSV4e79.js";import{Bt as m,Pn as h,Qn as g,Qt as _,Vt as v,jn as y,s as b}from"./index-DygQwjn7.js";import{t as x}from"./diff-DrARYKpR.js";var S=e(t(),1),C=n();function w({commit:e,sha:t,backTo:n,backLabel:r,slot:a,className:g,diffClassName:v}){let b=_(),[w,T]=(0,S.useState)(`unified`),[E,D]=(0,S.useState)(!0),O=e.isError&&e.error instanceof i&&e.error.status===409,k=b?w:`unified`;return(0,C.jsxs)(`section`,{"data-slot":a,"data-sha":t,className:g,children:[(0,C.jsxs)(`div`,{className:`mx-4 flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border py-2 md:mx-9`,children:[(0,C.jsx)(d,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,C.jsxs)(f,{to:n,children:[(0,C.jsx)(c,{size:16,"aria-hidden":`true`}),r]})}),(0,C.jsx)(`span`,{className:`ml-auto flex items-center gap-1`,children:(0,C.jsx)(l,{mode:w,wrap:E,onModeChange:T,onWrapChange:D})})]}),e.isPending?(0,C.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-muted-foreground md:px-9`,children:`Loading commit…`}):e.isError?(0,C.jsx)(p,{icon:O?(0,C.jsx)(u,{}):(0,C.jsx)(s,{size:16}),tone:O?`neutral`:`danger`,heading:`h2`,title:O?`Commit not found`:`Could not load the commit`,subtitle:e.error.message}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{"data-slot":`commit-meta`,className:`mx-4 border-b border-border py-3 md:mx-9`,children:[(0,C.jsx)(`h2`,{className:`text-sm font-semibold`,children:e.data.subject}),(0,C.jsxs)(`p`,{className:`mt-0.5 flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,C.jsx)(`span`,{children:e.data.author}),(0,C.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,C.jsx)(`span`,{title:e.data.when,children:m(e.data.when)}),(0,C.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,C.jsx)(h,{sha:e.data.sha,variant:`inline`}),(0,C.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,C.jsx)(`span`,{"data-slot":`commit-stat`,children:(0,C.jsx)(y,{stat:e.data.stat})})]})]}),e.data.files.length===0?(0,C.jsx)(p,{icon:(0,C.jsx)(o,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,C.jsx)(`div`,{className:v,children:(0,C.jsx)(x,{files:e.data.files,mode:k,wrap:E,totals:!1,className:`min-w-0`})})]})]})}var T=56;function E({slot:e,commits:t,selectedSha:n,className:i,heading:o}){let[s,c]=(0,S.useState)(``),l=s.trim().toLowerCase(),u=l?t.filter(e=>e.subject.toLowerCase().includes(l)):t,d=u.length>150,f=(0,S.useRef)(null),p=(0,S.useRef)(null),[m,h]=(0,S.useState)(0);(0,S.useLayoutEffect)(()=>{if(!d)return;let e=()=>{let e=f.current,t=p.current;!e||!t||h(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[d]);let _=u.map(e=>(0,C.jsx)(D,{commit:e,selected:n!==void 0&&e.sha===n},e.sha));return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`label`,{className:`relative mb-3 block`,children:[(0,C.jsx)(a,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3 left-3 size-4 text-muted-foreground`}),(0,C.jsx)(g,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:s,onChange:e=>c(e.target.value),className:`h-10 rounded-lg border-border bg-card pl-10`})]}),(0,C.jsxs)(`div`,{ref:e=>{f.current=e,e&&(p.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":d,className:r(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-3 py-1 md:px-4`,i),children:[o?(0,C.jsx)(`div`,{className:`flex min-h-11 flex-wrap items-center gap-2 py-2.5`,children:o}):null,u.length===0?(0,C.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,d?(0,C.jsx)(b,{scrollRef:p,startMargin:m,itemSize:T,children:_}):_]})]})}function D({commit:e,selected:t}){return(0,C.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_56px] [content-visibility:auto]`,children:(0,C.jsxs)(f,{"data-slot":`commit-row`,"data-sha":e.sha,"data-selected":t?`true`:void 0,"aria-current":t?`true`:void 0,to:e.href,className:r(`flex min-h-11 min-w-0 items-start gap-2.5 rounded-md px-2 py-2.5 transition-colors hover:bg-muted`,t&&`bg-muted/70`),children:[(0,C.jsx)(o,{size:16,"aria-hidden":`true`,className:`mt-px size-4 shrink-0 text-accent-text`}),(0,C.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`span`,{"data-slot":`commit-row-subject`,title:e.subject,className:`line-clamp-2 text-[13px] leading-snug font-medium break-words text-foreground`,children:e.subject}),(0,C.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,C.jsx)(O,{sha:e.sha}),(0,C.jsxs)(`span`,{className:`min-w-0 truncate`,children:[e.author,` · `,(0,C.jsx)(`span`,{title:v(e.when,e.at),children:m(e.when,e.at)})]}),e.stat?(0,C.jsx)(y,{stat:e.stat}):null]})]})]})})}function O({sha:e}){return(0,C.jsx)(h,{"data-slot":`commit-sha`,sha:e,variant:`chip`})}export{O as n,w as r,E as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{Fn as i}from"./toaster-Lf_4oY96.js";import{X as a,j as o,ot as s,r as c}from"./design-icons-CzEoMH9c.js";import{n as l}from"./diff-controls-DbAm3vyj.js";import{l as u}from"./reference-chip-hn8jj_Mo.js";import{t as d}from"./button-C8jUIs8Q.js";import{t as f}from"./project-router-CEnizJ8F.js";import{t as p}from"./centered-state-BgSV4e79.js";import{$n as m,Bt as h,Fn as g,Mn as _,Qt as v,Vt as y,s as b}from"./index-Cmj0hLCQ.js";import{t as x}from"./diff-CVDYtR5f.js";var S=e(t(),1),C=n();function w({commit:e,sha:t,backTo:n,backLabel:r,slot:a,className:m,diffClassName:y}){let b=v(),[w,T]=(0,S.useState)(`unified`),[E,D]=(0,S.useState)(!0),O=e.isError&&e.error instanceof i&&e.error.status===409,k=b?w:`unified`;return(0,C.jsxs)(`section`,{"data-slot":a,"data-sha":t,className:m,children:[(0,C.jsxs)(`div`,{className:`mx-4 flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border py-2 md:mx-9`,children:[(0,C.jsx)(d,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,C.jsxs)(f,{to:n,children:[(0,C.jsx)(c,{size:16,"aria-hidden":`true`}),r]})}),(0,C.jsx)(`span`,{className:`ml-auto flex items-center gap-1`,children:(0,C.jsx)(l,{mode:w,wrap:E,onModeChange:T,onWrapChange:D})})]}),e.isPending?(0,C.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-muted-foreground md:px-9`,children:`Loading commit…`}):e.isError?(0,C.jsx)(p,{icon:O?(0,C.jsx)(u,{}):(0,C.jsx)(s,{size:16}),tone:O?`neutral`:`danger`,heading:`h2`,title:O?`Commit not found`:`Could not load the commit`,subtitle:e.error.message}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{"data-slot":`commit-meta`,className:`mx-4 border-b border-border py-3 md:mx-9`,children:[(0,C.jsx)(`h2`,{className:`text-sm font-semibold`,children:e.data.subject}),(0,C.jsxs)(`p`,{className:`mt-0.5 flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,C.jsx)(`span`,{children:e.data.author}),(0,C.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,C.jsx)(`span`,{title:e.data.when,children:h(e.data.when)}),(0,C.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,C.jsx)(g,{sha:e.data.sha,variant:`inline`}),(0,C.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,C.jsx)(`span`,{"data-slot":`commit-stat`,children:(0,C.jsx)(_,{stat:e.data.stat})})]})]}),e.data.files.length===0?(0,C.jsx)(p,{icon:(0,C.jsx)(o,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,C.jsx)(`div`,{className:y,children:(0,C.jsx)(x,{files:e.data.files,mode:k,wrap:E,totals:!1,className:`min-w-0`})})]})]})}var T=56;function E({slot:e,commits:t,selectedSha:n,className:i,heading:o}){let[s,c]=(0,S.useState)(``),l=s.trim().toLowerCase(),u=l?t.filter(e=>e.subject.toLowerCase().includes(l)):t,d=u.length>150,f=(0,S.useRef)(null),p=(0,S.useRef)(null),[h,g]=(0,S.useState)(0);(0,S.useLayoutEffect)(()=>{if(!d)return;let e=()=>{let e=f.current,t=p.current;!e||!t||g(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[d]);let _=u.map(e=>(0,C.jsx)(D,{commit:e,selected:n!==void 0&&e.sha===n},e.sha));return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`label`,{className:`relative mb-3 block`,children:[(0,C.jsx)(a,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3 left-3 size-4 text-muted-foreground`}),(0,C.jsx)(m,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:s,onChange:e=>c(e.target.value),className:`h-10 rounded-lg border-border bg-card pl-10`})]}),(0,C.jsxs)(`div`,{ref:e=>{f.current=e,e&&(p.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":d,className:r(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-3 py-1 md:px-4`,i),children:[o?(0,C.jsx)(`div`,{className:`flex min-h-11 flex-wrap items-center gap-2 py-2.5`,children:o}):null,u.length===0?(0,C.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,d?(0,C.jsx)(b,{scrollRef:p,startMargin:h,itemSize:T,children:_}):_]})]})}function D({commit:e,selected:t}){return(0,C.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_56px] [content-visibility:auto]`,children:(0,C.jsxs)(f,{"data-slot":`commit-row`,"data-sha":e.sha,"data-selected":t?`true`:void 0,"aria-current":t?`true`:void 0,to:e.href,className:r(`flex min-h-11 min-w-0 items-start gap-2.5 rounded-md px-2 py-2.5 transition-colors hover:bg-muted`,t&&`bg-muted/70`),children:[(0,C.jsx)(o,{size:16,"aria-hidden":`true`,className:`mt-px size-4 shrink-0 text-accent-text`}),(0,C.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`span`,{"data-slot":`commit-row-subject`,title:e.subject,className:`line-clamp-2 text-[13px] leading-snug font-medium break-words text-foreground`,children:e.subject}),(0,C.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,C.jsx)(O,{sha:e.sha}),(0,C.jsxs)(`span`,{className:`min-w-0 truncate`,children:[e.author,` · `,(0,C.jsx)(`span`,{title:y(e.when,e.at),children:h(e.when,e.at)})]}),e.stat?(0,C.jsx)(_,{stat:e.stat}):null]})]})]})})}function O({sha:e}){return(0,C.jsx)(g,{"data-slot":`commit-sha`,sha:e,variant:`chip`})}export{O as n,w as r,E as t};
@@ -1,3 +1,3 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-CSgYwy29.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/dist-C_rn70hE.js","assets/bundle-mjs-rHxsej31.js","assets/chevron-right-BENZ-1ZN.js","assets/createLucideIcon-BHp8sXmF.js","assets/eye-B8okNWXU.js","assets/diff-stat-Dy4uLuyP.js","assets/index-DygQwjn7.js","assets/queries-ByqTmyCs.js","assets/toaster-Lf_4oY96.js","assets/live-protocol-DMhTnCmf.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-Cg8l-LDN.js","assets/label-eNfbfYFG.js","assets/cez-idle-CdswdDRd.js","assets/run-detail-refresh-BJ4laDVB.js","assets/dist-Tubgdd25.js","assets/tasks-table-DtLW8U-4.js","assets/attention-CnhIF76m.js","assets/task-groups-BRrlyl5P.js","assets/design-icons-CzEoMH9c.js","assets/open-in-menu-CSbpfQy7.js","assets/bot-TkDIw4y-.js","assets/external-link-BE6y205O.js","assets/folder-o-AvL3y3.js","assets/smartphone-Lr8Ug2z_.js","assets/square-terminal-B6RYYieR.js","assets/button-C8jUIs8Q.js","assets/dropdown-menu-BaqO-x7U.js","assets/dist-VPUfzsfL.js","assets/es2015-DpKptHDx.js","assets/dist-DDhqweuB.js","assets/dist-CtdIjNlG.js","assets/own-lookup-DS54wXvD.js","assets/check-OP-CVgZG.js","assets/chevron-down-CHGyCDBH.js","assets/nav-row-styles-CgP5uNp4.js","assets/folder-browser-CK1mNIQi.js","assets/loader-circle-CPBhhDbB.js","assets/play-CmVAj_fu.js","assets/reference-chip-hn8jj_Mo.js","assets/popover-CVo54-aS.js","assets/dist-BS5vYfFC.js","assets/switch-DfPCm1H_.js","assets/dist-Czz3Y5qH.js","assets/badge-B6B-xYQQ.js","assets/dialog-Dbu3HnqC.js","assets/project-router-CEnizJ8F.js","assets/status-dot-BXf-Ubd0.js","assets/report-selection-BkBJw-sm.js","assets/use-search-params-writer-ClMScnNe.js","assets/format-BU7D3IfE.js","assets/command-DuxcX6Hr.js","assets/project-order-AcHI4Dcl.js","assets/skills-pM_PouEs.js","assets/agents-settings-path-7X6_cvUg.js","assets/page-shell-CpdYMj52.js","assets/page-shell-DQPYcKyL.css","assets/centered-state-BgSV4e79.js","assets/index-D0mx-XUg.css","assets/highlighter-Cfo7mLVB.js","assets/image-preview-CeEKI2T5.js","assets/zoomable-image-BUTgYpld.js","assets/markdown-BBDDg-4t.js","assets/markdown-B7l0dDH1.js","assets/chunk-BO2N2NFS-DQrpGzb-.js","assets/lib-DrPFkMXk.js","assets/html-report-BX3msvci.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{t as a}from"./diff-stat-Dy4uLuyP.js";import{n as o,r as s,t as c}from"./image-preview-CeEKI2T5.js";var l=e(t(),1),u=n();function d(e){let[t,n]=(0,l.useState)(null);return(0,l.useEffect)(()=>{let e=!1;return i(()=>import(`./diff-view-CSgYwy29.js`).then(t=>{e||n({View:t.DiffView})},()=>{e||n(`failed`)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69])),()=>{e=!0}},[]),e.files.length===0?(0,u.jsx)(`p`,{"data-slot":`diff-empty`,className:r(`px-1 text-xs text-muted-foreground`,e.className),children:`No changes.`}):t===`failed`?(0,u.jsx)(f,{...e}):t===null?(0,u.jsx)(`p`,{"data-slot":`diff-loading`,className:r(`px-1 text-xs text-muted-foreground`,e.className),children:`Loading diff…`}):(0,u.jsx)(t.View,{...e})}function f({files:e,wrap:t=!1,imageSrc:n,onOpenInApp:i,viewRef:a,totals:o=!0,actions:c,className:d}){let f={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},m=(0,l.useRef)(null);return(0,l.useImperativeHandle)(a,()=>({scrollToPath:e=>{for(let t of m.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,u.jsxs)(`div`,{ref:m,"data-slot":`diff`,"data-fallback":`true`,className:r(`flex min-w-0 flex-col gap-3`,d),children:[(0,u.jsxs)(`div`,{"data-slot":`diff-header`,hidden:!o&&!c,className:`flex min-h-9 flex-wrap items-center gap-x-2 gap-y-1.5 px-1`,children:[(0,u.jsx)(s,{stat:f,hidden:!o}),c?(0,u.jsx)(`div`,{"data-slot":`diff-actions`,className:`ms-auto flex items-center gap-1.5`,children:c}):null]}),e.map(e=>(0,u.jsx)(p,{file:e,wrap:t,imageSrc:n,onOpenInApp:i},`${e.oldPath??``}→${e.path}`))]})}function p({file:e,wrap:t,imageSrc:n,onOpenInApp:i}){let s=e.oldPath?`${e.oldPath} → ${e.path}`:e.path;return(0,u.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,u.jsxs)(`header`,{className:`flex items-start gap-2 border-b border-border px-3 py-2`,children:[(0,u.jsx)(`span`,{"data-slot":`diff-file-path`,title:s,className:`min-w-0 wrap-anywhere font-mono text-xs font-medium`,children:s}),(0,u.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,u.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-xs`})})]}),o(e)?(0,u.jsx)(c,{file:e,imageSrc:n,onOpenInApp:i}):e.binary?(0,u.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-muted-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,u.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-muted-foreground`,children:`No content changes (metadata only).`}):(0,u.jsx)(`pre`,{className:r(`py-2 font-mono text-xs leading-[1.7]`,t?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-Bxr3btKH.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/dist-C_rn70hE.js","assets/bundle-mjs-rHxsej31.js","assets/chevron-right-BENZ-1ZN.js","assets/createLucideIcon-BHp8sXmF.js","assets/eye-B8okNWXU.js","assets/diff-stat-Dy4uLuyP.js","assets/index-Cmj0hLCQ.js","assets/queries-ByqTmyCs.js","assets/toaster-Lf_4oY96.js","assets/live-protocol-DMhTnCmf.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-Cg8l-LDN.js","assets/label-eNfbfYFG.js","assets/cez-idle-CdswdDRd.js","assets/run-detail-refresh-BJ4laDVB.js","assets/dist-Tubgdd25.js","assets/tasks-table-DtLW8U-4.js","assets/attention-CnhIF76m.js","assets/task-groups-BRrlyl5P.js","assets/design-icons-CzEoMH9c.js","assets/open-in-menu-CSbpfQy7.js","assets/bot-TkDIw4y-.js","assets/external-link-BE6y205O.js","assets/folder-o-AvL3y3.js","assets/smartphone-Lr8Ug2z_.js","assets/square-terminal-B6RYYieR.js","assets/button-C8jUIs8Q.js","assets/dropdown-menu-BaqO-x7U.js","assets/dist-VPUfzsfL.js","assets/es2015-DpKptHDx.js","assets/dist-DDhqweuB.js","assets/dist-CtdIjNlG.js","assets/own-lookup-DS54wXvD.js","assets/check-OP-CVgZG.js","assets/chevron-down-CHGyCDBH.js","assets/nav-row-styles-CgP5uNp4.js","assets/folder-browser-CK1mNIQi.js","assets/loader-circle-CPBhhDbB.js","assets/play-CmVAj_fu.js","assets/reference-chip-hn8jj_Mo.js","assets/popover-CVo54-aS.js","assets/dist-BS5vYfFC.js","assets/switch-DfPCm1H_.js","assets/dist-Czz3Y5qH.js","assets/badge-B6B-xYQQ.js","assets/dialog-Dbu3HnqC.js","assets/project-router-CEnizJ8F.js","assets/status-dot-BXf-Ubd0.js","assets/report-selection-BkBJw-sm.js","assets/use-search-params-writer-ClMScnNe.js","assets/format-BU7D3IfE.js","assets/command-DuxcX6Hr.js","assets/project-order-AcHI4Dcl.js","assets/skills-pM_PouEs.js","assets/agents-settings-path-7X6_cvUg.js","assets/page-shell-CpdYMj52.js","assets/page-shell-DQPYcKyL.css","assets/centered-state-BgSV4e79.js","assets/index-CflkzdUL.css","assets/highlighter-Cfo7mLVB.js","assets/image-preview-CeEKI2T5.js","assets/zoomable-image-BUTgYpld.js","assets/markdown-BBDDg-4t.js","assets/markdown-DkzcTJZ1.js","assets/chunk-BO2N2NFS-DQrpGzb-.js","assets/lib-DrPFkMXk.js","assets/html-report-BX3msvci.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{t as a}from"./diff-stat-Dy4uLuyP.js";import{n as o,r as s,t as c}from"./image-preview-CeEKI2T5.js";var l=e(t(),1),u=n();function d(e){let[t,n]=(0,l.useState)(null);return(0,l.useEffect)(()=>{let e=!1;return i(()=>import(`./diff-view-Bxr3btKH.js`).then(t=>{e||n({View:t.DiffView})},()=>{e||n(`failed`)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69])),()=>{e=!0}},[]),e.files.length===0?(0,u.jsx)(`p`,{"data-slot":`diff-empty`,className:r(`px-1 text-xs text-muted-foreground`,e.className),children:`No changes.`}):t===`failed`?(0,u.jsx)(f,{...e}):t===null?(0,u.jsx)(`p`,{"data-slot":`diff-loading`,className:r(`px-1 text-xs text-muted-foreground`,e.className),children:`Loading diff…`}):(0,u.jsx)(t.View,{...e})}function f({files:e,wrap:t=!1,imageSrc:n,onOpenInApp:i,viewRef:a,totals:o=!0,actions:c,className:d}){let f={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},m=(0,l.useRef)(null);return(0,l.useImperativeHandle)(a,()=>({scrollToPath:e=>{for(let t of m.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,u.jsxs)(`div`,{ref:m,"data-slot":`diff`,"data-fallback":`true`,className:r(`flex min-w-0 flex-col gap-3`,d),children:[(0,u.jsxs)(`div`,{"data-slot":`diff-header`,hidden:!o&&!c,className:`flex min-h-9 flex-wrap items-center gap-x-2 gap-y-1.5 px-1`,children:[(0,u.jsx)(s,{stat:f,hidden:!o}),c?(0,u.jsx)(`div`,{"data-slot":`diff-actions`,className:`ms-auto flex items-center gap-1.5`,children:c}):null]}),e.map(e=>(0,u.jsx)(p,{file:e,wrap:t,imageSrc:n,onOpenInApp:i},`${e.oldPath??``}→${e.path}`))]})}function p({file:e,wrap:t,imageSrc:n,onOpenInApp:i}){let s=e.oldPath?`${e.oldPath} → ${e.path}`:e.path;return(0,u.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,u.jsxs)(`header`,{className:`flex items-start gap-2 border-b border-border px-3 py-2`,children:[(0,u.jsx)(`span`,{"data-slot":`diff-file-path`,title:s,className:`min-w-0 wrap-anywhere font-mono text-xs font-medium`,children:s}),(0,u.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,u.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-xs`})})]}),o(e)?(0,u.jsx)(c,{file:e,imageSrc:n,onOpenInApp:i}):e.binary?(0,u.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-muted-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,u.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-muted-foreground`,children:`No content changes (metadata only).`}):(0,u.jsx)(`pre`,{className:r(`py-2 font-mono text-xs leading-[1.7]`,t?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
3
3
  `).map((e,t)=>(0,u.jsxs)(`span`,{className:r(`block px-4`,e.startsWith(`+`)&&!e.startsWith(`+++`)&&`bg-diff-add`,e.startsWith(`-`)&&!e.startsWith(`---`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-muted-foreground`),children:[e,e===``?` `:``]},t))})]})}export{d as t};
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{o as t}from"./dist-C_rn70hE.js";import{A as n,_ as r}from"./design-icons-CzEoMH9c.js";import{t as i}from"./createLucideIcon-BHp8sXmF.js";import{t as a}from"./button-C8jUIs8Q.js";import{sr as o}from"./index-DygQwjn7.js";var s=i(`rows-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}]]),c=i(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),l=e();function u({mode:e,wrap:t,onModeChange:n,onWrapChange:r,disabled:i=!1}){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`span`,{"data-slot":`diff-mode-toggle`,role:`group`,"aria-label":`Diff layout`,className:`inline-flex items-center rounded-lg border border-border bg-card p-0.5 max-md:hidden`,children:[(0,l.jsx)(h,{current:e,value:`unified`,onModeChange:n,disabled:i}),(0,l.jsx)(h,{current:e,value:`split`,onModeChange:n,disabled:i})]}),(0,l.jsx)(p,{wrap:t,onWrapChange:r,disabled:i})]})}var d=`Unavailable while Markdown preview is on`;function f(){return(0,l.jsx)(`span`,{"data-slot":`markdown-preview-hint`,role:`status`,className:`text-xs text-muted-foreground max-sm:sr-only`,children:`Full-document preview — layout and wrap are off`})}function p({wrap:e,onWrapChange:n,className:r=`size-11 rounded-lg`,disabled:i=!1}){return(0,l.jsx)(a,{variant:`outline`,size:`icon-sm`,"data-slot":`wrap-toggle`,"aria-pressed":e,"aria-label":`Wrap long lines`,title:i?d:`Wrap long lines`,disabled:i,className:t(r,e?`border-accent-text/40 bg-muted text-accent-text`:`text-muted-foreground hover:text-foreground`),onClick:()=>n(!e),children:(0,l.jsx)(c,{"aria-hidden":`true`})})}function m({preview:e,onPreviewChange:n}){return(0,l.jsxs)(a,{variant:`outline`,size:`sm`,"data-slot":`markdown-preview-toggle`,"aria-pressed":e,"aria-label":`Preview Markdown`,title:e?`Show Markdown as a diff`:`Preview Markdown`,className:t(`h-11 min-w-11 gap-1.5 rounded-lg px-0 text-xs font-medium sm:px-3`,e?`border-accent-text/40 bg-muted text-accent-text`:`text-muted-foreground hover:text-foreground`),onClick:()=>n(!e),children:[(0,l.jsx)(o,{"aria-hidden":`true`,className:`size-4`}),(0,l.jsx)(`span`,{"aria-hidden":`true`,className:`max-sm:hidden`,children:`Preview MD`})]})}function h({current:e,value:n,onModeChange:i,disabled:a}){let o=e===n;return(0,l.jsxs)(`button`,{type:`button`,"data-mode":n,"aria-pressed":o,disabled:a,title:a?d:void 0,onClick:()=>i(n),className:t(`inline-flex min-h-11 items-center gap-1.5 rounded-md px-3 text-xs font-medium capitalize transition-colors outline-hidden focus-visible:ring-2 focus-visible:ring-ring/50 disabled:opacity-50`,o?`bg-muted text-foreground`:`text-muted-foreground pointer-hover:text-foreground`),children:[n===`unified`?(0,l.jsx)(s,{"aria-hidden":`true`,className:`size-4`}):(0,l.jsx)(r,{size:16,"aria-hidden":`true`,className:`size-4`}),n]})}function g({branch:e}){return(0,l.jsxs)(`span`,{"data-slot":`branch-chip`,className:`flex min-w-0 items-center gap-1 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-xs font-medium`,children:[(0,l.jsx)(n,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,l.jsx)(`span`,{className:`truncate`,children:e})]})}export{p as a,m as i,u as n,f as r,g as t};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{o as t}from"./dist-C_rn70hE.js";import{A as n,_ as r}from"./design-icons-CzEoMH9c.js";import{t as i}from"./createLucideIcon-BHp8sXmF.js";import{t as a}from"./button-C8jUIs8Q.js";import{cr as o}from"./index-Cmj0hLCQ.js";var s=i(`rows-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}]]),c=i(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),l=e();function u({mode:e,wrap:t,onModeChange:n,onWrapChange:r,disabled:i=!1}){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`span`,{"data-slot":`diff-mode-toggle`,role:`group`,"aria-label":`Diff layout`,className:`inline-flex items-center rounded-lg border border-border bg-card p-0.5 max-md:hidden`,children:[(0,l.jsx)(h,{current:e,value:`unified`,onModeChange:n,disabled:i}),(0,l.jsx)(h,{current:e,value:`split`,onModeChange:n,disabled:i})]}),(0,l.jsx)(p,{wrap:t,onWrapChange:r,disabled:i})]})}var d=`Unavailable while Markdown preview is on`;function f(){return(0,l.jsx)(`span`,{"data-slot":`markdown-preview-hint`,role:`status`,className:`text-xs text-muted-foreground max-sm:sr-only`,children:`Full-document preview — layout and wrap are off`})}function p({wrap:e,onWrapChange:n,className:r=`size-11 rounded-lg`,disabled:i=!1}){return(0,l.jsx)(a,{variant:`outline`,size:`icon-sm`,"data-slot":`wrap-toggle`,"aria-pressed":e,"aria-label":`Wrap long lines`,title:i?d:`Wrap long lines`,disabled:i,className:t(r,e?`border-accent-text/40 bg-muted text-accent-text`:`text-muted-foreground hover:text-foreground`),onClick:()=>n(!e),children:(0,l.jsx)(c,{"aria-hidden":`true`})})}function m({preview:e,onPreviewChange:n}){return(0,l.jsxs)(a,{variant:`outline`,size:`sm`,"data-slot":`markdown-preview-toggle`,"aria-pressed":e,"aria-label":`Preview Markdown`,title:e?`Show Markdown as a diff`:`Preview Markdown`,className:t(`h-11 min-w-11 gap-1.5 rounded-lg px-0 text-xs font-medium sm:px-3`,e?`border-accent-text/40 bg-muted text-accent-text`:`text-muted-foreground hover:text-foreground`),onClick:()=>n(!e),children:[(0,l.jsx)(o,{"aria-hidden":`true`,className:`size-4`}),(0,l.jsx)(`span`,{"aria-hidden":`true`,className:`max-sm:hidden`,children:`Preview MD`})]})}function h({current:e,value:n,onModeChange:i,disabled:a}){let o=e===n;return(0,l.jsxs)(`button`,{type:`button`,"data-mode":n,"aria-pressed":o,disabled:a,title:a?d:void 0,onClick:()=>i(n),className:t(`inline-flex min-h-11 items-center gap-1.5 rounded-md px-3 text-xs font-medium capitalize transition-colors outline-hidden focus-visible:ring-2 focus-visible:ring-ring/50 disabled:opacity-50`,o?`bg-muted text-foreground`:`text-muted-foreground pointer-hover:text-foreground`),children:[n===`unified`?(0,l.jsx)(s,{"aria-hidden":`true`,className:`size-4`}):(0,l.jsx)(r,{size:16,"aria-hidden":`true`,className:`size-4`}),n]})}function g({branch:e}){return(0,l.jsxs)(`span`,{"data-slot":`branch-chip`,className:`flex min-w-0 items-center gap-1 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-xs font-medium`,children:[(0,l.jsx)(n,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,l.jsx)(`span`,{className:`truncate`,children:e})]})}export{p as a,m as i,u as n,f as r,g as t};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{t as i}from"./chevron-right-BENZ-1ZN.js";import{t as a}from"./eye-B8okNWXU.js";import{t as o}from"./diff-stat-Dy4uLuyP.js";import{s}from"./index-DygQwjn7.js";import{a as c,i as l,r as u}from"./highlighter-Cfo7mLVB.js";import{n as d,r as f,t as p}from"./image-preview-CeEKI2T5.js";import{n as m,t as h}from"./markdown-BBDDg-4t.js";import{t as g}from"./markdown-B7l0dDH1.js";var _=e(t(),1),v=44;function y(e){if(e.binary===!0||e.patch===``)return 1;let t=e.patch.split(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{t as i}from"./chevron-right-BENZ-1ZN.js";import{t as a}from"./eye-B8okNWXU.js";import{t as o}from"./diff-stat-Dy4uLuyP.js";import{s}from"./index-Cmj0hLCQ.js";import{a as c,i as l,r as u}from"./highlighter-Cfo7mLVB.js";import{n as d,r as f,t as p}from"./image-preview-CeEKI2T5.js";import{n as m,t as h}from"./markdown-BBDDg-4t.js";import{t as g}from"./markdown-DkzcTJZ1.js";var _=e(t(),1),v=44;function y(e){if(e.binary===!0||e.patch===``)return 1;let t=e.patch.split(`
2
2
  `),n=t.findIndex(e=>e.startsWith(`@@`));return n===-1?t.length:t.length-n}function b(e){return y(e)*20+v}function x(e){return e.reduce((e,t)=>e+y(t),0)}function S(e,t){let n=new URLSearchParams(e).get(`diff`);return n===`flat`||n===`virtual`?n:t>1500?`virtual`:`flat`}function C(e){return`${e.oldPath??``}→${e.path}`}function w(e){let t=0;for(let n of e.split(`
3
3
  `))n.length>t&&(t=n.length);return t}var T=/[A-Za-z0-9_]+|\s+|[^\sA-Za-z0-9_]+/g,E=300,D=.3;function O(e,t){if(e===t)return null;let n=e.match(T)??[],r=t.match(T)??[];if(n.length===0||r.length===0||n.length>E||r.length>E)return null;let i=k(n,r),a=r.length+1;return(i[n.length*a+r.length]??0)/Math.max(n.length,r.length)<D?null:A(n,r,i)}function k(e,t){let n=t.length+1,r=new Uint16Array((e.length+1)*n);for(let i=1;i<=e.length;i++)for(let a=1;a<=t.length;a++)r[i*n+a]=e[i-1]===t[a-1]?(r[(i-1)*n+(a-1)]??0)+1:Math.max(r[(i-1)*n+a]??0,r[i*n+(a-1)]??0);return r}function A(e,t,n){let r=t.length+1,i=Array.from({length:e.length},()=>!1),a=Array.from({length:t.length},()=>!1),o=e.length,s=t.length;for(;o>0&&s>0;)e[o-1]===t[s-1]?(i[o-1]=!0,a[s-1]=!0,o--,s--):(n[(o-1)*r+s]??0)>=(n[o*r+(s-1)]??0)?o--:s--;return{del:j(e,i),add:j(t,a)}}function j(e,t){let n=[];return e.forEach((e,r)=>{let i=!(t[r]??!1),a=n[n.length-1];a&&a.changed===i?a.text+=e:n.push({text:e,changed:i})}),n}function M(e,t,n){if(!t||t.length===0)return e?e.map(e=>({text:e.content,color:e.color,changed:!1})):n===``?[]:[{text:n,changed:!1}];if(!e||e.length===0)return t.map(e=>({text:e.text,changed:e.changed}));let r=[],i=0,a=0,o=0,s=0;for(;i<e.length&&o<t.length;){let n=e[i],c=t[o],l=n.content.length-a,u=c.text.length-s,d=Math.min(l,u);d>0&&(r.push({text:n.content.slice(a,a+d),color:n.color,changed:c.changed}),a+=d,s+=d),n.content.length-a<=0&&(i++,a=0),c.text.length-s<=0&&(o++,s=0)}for(;i<e.length;){let t=e[i],n=t.content.slice(a);n!==``&&r.push({text:n,color:t.color,changed:!1}),i++,a=0}return r}var N=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,P=`… (patch truncated)`;function F(e){let t=[],n=!1,r=null,i=0,a=0,o=e.split(`
4
4
  `);o.at(-1)===``&&o.pop();for(let e of o){let o=N.exec(e);if(o){r={header:e,oldStart:Number(o[1]),oldCount:o[2]===void 0?1:Number(o[2]),newStart:Number(o[3]),newCount:o[4]===void 0?1:Number(o[4]),lines:[]},i=r.oldStart,a=r.newStart,t.push(r);continue}if(e.includes(P)){n=!0,r=null;continue}r&&(e.startsWith(`+`)?r.lines.push({kind:`add`,text:e.slice(1),newLine:a++}):e.startsWith(`-`)?r.lines.push({kind:`del`,text:e.slice(1),oldLine:i++}):e.startsWith(`\\`)||r.lines.push({kind:`context`,text:e.slice(1),oldLine:i++,newLine:a++}))}return{hunks:t,truncated:n}}function I(e,t=!1){let n=[],r=e[0];if(!r)return n;r.newStart>1&&n.push({beforeHunk:0,count:r.newStart-1,oldStart:1,newStart:1});for(let t=1;t<e.length;t++){let r=e[t-1],i=e[t],a=r.oldStart+r.oldCount,o=r.newStart+r.newCount,s=i.newStart-o;s>0&&n.push({beforeHunk:t,count:s,oldStart:a,newStart:o})}if(t){let t=e[e.length-1];n.push({beforeHunk:e.length,oldStart:t.oldStart+t.oldCount,newStart:t.newStart+t.newCount})}return n}function L(e,t){let n=e.count===void 0?t.length:e.newStart+e.count-1,r=e.oldStart-e.newStart,i=[];for(let a=e.newStart;a<=Math.min(n,t.length);a++)i.push({kind:`context`,text:t[a-1]??``,oldLine:a+r,newLine:a});return i}function R(e,t){let n=Array.from({length:e.length}),r=Array.from({length:t.length}),i=Math.min(e.length,t.length);for(let a=0;a<i;a++){let i=O(e[a].text,t[a].text);i&&(n[a]=i.del,r[a]=i.add)}return{dels:e,adds:t,delSpans:n,addSpans:r}}function z(e,t,n){let r=0;for(;r<e.lines.length;){let i=e.lines[r];if(i.kind===`del`||i.kind===`add`){let t=[],i=[];for(;r<e.lines.length&&e.lines[r].kind===`del`;)t.push(e.lines[r++]);for(;r<e.lines.length&&e.lines[r].kind===`add`;)i.push(e.lines[r++]);n(R(t,i))}else t(i),r++}}function B(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`line`,cell:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),z(e,e=>i.push({type:`line`,cell:{line:e}}),e=>{e.dels.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.delSpans[n]}})),e.adds.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.addSpans[n]}}))})}),a(e.length),i}function V(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`pair`,left:{line:e},right:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),z(e,e=>i.push({type:`pair`,left:{line:e},right:{line:e}}),e=>{let t=Math.max(e.dels.length,e.adds.length);for(let n=0;n<t;n++){let t=e.dels[n],r=e.adds[n];i.push({type:`pair`,...t?{left:{line:t,spans:e.delSpans[n]}}:{},...r?{right:{line:r,spans:e.addSpans[n]}}:{}})}})}),a(e.length),i}var H=n();function U({file:e,loadFileText:t,imageSrc:n}){let r=(0,_.useMemo)(()=>W(e),[e]),i=(0,_.useRef)(t);i.current=t;let a=(0,_.useRef)(n);a.current=n;let o=t!==void 0,[s,c]=(0,_.useState)(null);(0,_.useEffect)(()=>{let t=i.current;if(!t)return;let n=!1;return t(e.path).then(t=>!n&&c({path:e.path,text:t}),()=>!n&&c({path:e.path,text:null})),()=>{n=!0}},[e.path,e.patch,o]);let l=(0,_.useCallback)(t=>{let n=a.current,r=n?m(e.path,t):null;return r===null||!n?null:n(r)},[e.path]),u=s?.path===e.path?s:null;if(o&&u===null)return(0,H.jsx)(`p`,{role:`status`,className:`px-4 py-2.5 text-xs text-muted-foreground`,children:`Loading preview…`});let d=u?.text??null;if(d===null&&r.text===``)return(0,H.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-muted-foreground`,children:`No content changes to preview.`});let f=d!==null||r.complete?null:o?`The full file could not be loaded. Showing the changed sections only.`:`Showing the changed sections only.`;return(0,H.jsx)(`div`,{"data-slot":`diff-markdown-preview`,className:`px-4 py-5 md:px-6`,children:(0,H.jsxs)(`div`,{className:`mx-auto max-w-[72ch]`,children:[f?(0,H.jsx)(`p`,{className:`mb-4 text-xs text-muted-foreground`,children:f}):null,(0,H.jsx)(g,{document:!0,imageSrc:l,children:d??r.text})]})})}function W(e){let t=F(e.patch);return{text:t.hunks.map(e=>e.lines.filter(e=>e.kind!==`del`).map(e=>e.text).join(`
@@ -0,0 +1 @@
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{Gt as t,Jt as n,Kt as r,Ut as i,Wt as a,Xt as o,Yt as s,qt as c}from"./index-Cmj0hLCQ.js";var l=e();function u({open:e,subject:u,onKeep:d,onDiscard:f}){return(0,l.jsx)(i,{open:e,onOpenChange:e=>!e&&d(),children:(0,l.jsxs)(r,{"data-slot":`discard-changes-dialog`,className:`sm:max-w-[560px]`,children:[(0,l.jsxs)(s,{children:[(0,l.jsx)(o,{children:`Discard unsaved changes?`}),(0,l.jsxs)(c,{children:[`Your edits to `,(0,l.jsx)(`span`,{className:`font-medium text-foreground`,children:u}),` are not saved. They are lost if you continue.`]})]}),(0,l.jsxs)(n,{children:[(0,l.jsx)(t,{"data-slot":`discard-changes-keep`,children:`Keep editing`}),(0,l.jsx)(a,{"data-slot":`discard-changes-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:f,children:`Discard changes`})]})]})})}export{u as t};
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{et as i}from"./queries-ByqTmyCs.js";import{Fn as a,Ht as o}from"./toaster-Lf_4oY96.js";import{f as s,p as c}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{ot as l,w as u}from"./design-icons-CzEoMH9c.js";import{t as d}from"./createLucideIcon-BHp8sXmF.js";import{a as f}from"./diff-controls-C62rOSYk.js";import{t as p}from"./centered-state-BgSV4e79.js";import{a as m,i as h,r as g}from"./highlighter-Cfo7mLVB.js";import{n as _,t as v}from"./markdown-B7l0dDH1.js";import{r as y}from"./html-report-BX3msvci.js";import{t as b}from"./html-report-frame-Ck76gKfA.js";var x=d(`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`}]]),S=d(`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`}]]),C=d(`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`}]]),w=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`ico`,`avif`]);function T(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:w.has(t.slice(n+1).toLowerCase())}function E(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return T(e)||n>0&&t.slice(n+1).toLowerCase()===`svg`}var D=e(t(),1);function O(e){return e.tooLarge?`too-large`:E(e.path)?`image`:e.binary?`binary`:`text`}function k(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}var A=n();function j({runId:e,path:t,className:n}){let r=i(e,t??void 0);if(t===null)return(0,A.jsx)(R,{className:n,children:(0,A.jsx)(p,{icon:(0,A.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(r.isPending)return(0,A.jsx)(R,{className:n,children:(0,A.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(r.isError){let e=r.error instanceof a&&r.error.status===409;return(0,A.jsx)(R,{className:n,children:(0,A.jsx)(p,{icon:e?(0,A.jsx)(C,{}):(0,A.jsx)(l,{size:16}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:r.error.message})})}return r.data.type===`file`?(0,A.jsx)(P,{runId:e,entry:r.data,className:n}):(0,A.jsx)(R,{className:n,children:(0,A.jsx)(p,{icon:(0,A.jsx)(S,{}),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 M(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 N(e,t,n){let r=t&&/\.(?:md|markdown)$/i.test(e.path),i=t&&y(e.path),a=/\.(?:png|jpe?g|gif|webp|bmp|ico|avif)$/i.test(e.path),o=t&&a&&e.size<=10*1024*1024?`image`:O(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 P({runId:e,entry:t,displayPath:n,className:i,imageUrl:a,downloadUrl:o,snapshot:s,readerHref:c,documentPreview:l=!1}){let[u,d]=(0,D.useState)(!1),[p,m]=(0,D.useState)(!0),h=n??M(t.path),g=N(t,l,u),_=!!(s||o||g.toggle),v=!g.showImage&&g.kind===`text`&&g.rendered===null;return(0,A.jsxs)(R,{className:i,children:[(0,A.jsxs)(`header`,{"data-slot":`file-preview-head`,className:r(`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,A.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium text-foreground`,title:h,children:h}),(0,A.jsx)(`span`,{"data-slot":`file-preview-size`,className:`ml-auto shrink-0 font-mono text-xs tabular-nums text-muted-foreground`,children:k(t.size)}),v?(0,A.jsx)(f,{wrap:p,onWrapChange:m,className:`size-8 rounded-md max-md:size-11 pointer-coarse:size-11`}):null]}),_?(0,A.jsx)(I,{snapshot:s,downloadUrl:o,source:g.toggle?u:null,onSource:()=>d(e=>!e),readerHref:g.html&&g.kind===`text`?c:void 0}):null,(0,A.jsx)(F,{runId:e,entry:t,kind:g.kind,showImage:g.showImage,rendered:g.rendered,imageUrl:a,wrap:p})]})}function F({runId:e,entry:t,kind:n,showImage:r,rendered:i,imageUrl:a,wrap:s}){return r?(0,A.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,A.jsx)(`img`,{"data-slot":`file-preview-image`,src:a??o(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):n===`too-large`?(0,A.jsx)(p,{icon:(0,A.jsx)(x,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${k(t.size)} — past the preview cap. Open it in your editor instead.`}):n===`binary`?(0,A.jsx)(p,{icon:(0,A.jsx)(S,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${k(t.size)} of binary data — no text preview.`}):i===`markdown`?(0,A.jsx)(`div`,{className:`p-4`,children:(0,A.jsx)(v,{document:!0,children:t.content??``})}):i===`html`?(0,A.jsx)(b,{html:t.content??``,title:`Report: ${t.path}`,className:`h-[70vh]`}):(0,A.jsx)(V,{path:t.path,text:t.content??``,wrap:s})}function I({snapshot:e,downloadUrl:t,source:n,onSource:r,readerHref:i}){return(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-b border-border px-4 py-2 text-xs`,children:[e?(0,A.jsxs)(`span`,{children:[`Published snapshot · `,e]}):null,t?(0,A.jsx)(`a`,{className:`inline-flex min-h-11 items-center text-accent-text underline`,href:t,children:`Download`}):null,n===null?null:(0,A.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,A.jsx)(L,{href:i}):null]})}function L({href:e}){let t=c(),n=s();return(0,A.jsx)(`a`,{className:`inline-flex min-h-11 items-center px-2 text-accent-text underline focus-visible:ring-2`,href:e,onClick:r=>_(r,t,e,n),children:`Open reader`})}function R({className:e,children:t}){return(0,A.jsx)(`section`,{"data-slot":`file-preview`,className:r(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var z=1500;function B(e,t){let n=(0,D.useMemo)(()=>t.split(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{et as i}from"./queries-ByqTmyCs.js";import{Fn as a,Ht as o}from"./toaster-Lf_4oY96.js";import{f as s,p as c}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{ot as l,w as u}from"./design-icons-CzEoMH9c.js";import{t as d}from"./createLucideIcon-BHp8sXmF.js";import{a as f}from"./diff-controls-DbAm3vyj.js";import{t as p}from"./centered-state-BgSV4e79.js";import{a as m,i as h,r as g}from"./highlighter-Cfo7mLVB.js";import{n as _,t as v}from"./markdown-DkzcTJZ1.js";import{r as y}from"./html-report-BX3msvci.js";import{t as b}from"./html-report-frame-Ck76gKfA.js";var x=d(`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`}]]),S=d(`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`}]]),C=d(`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`}]]),w=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`ico`,`avif`]);function T(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:w.has(t.slice(n+1).toLowerCase())}function E(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return T(e)||n>0&&t.slice(n+1).toLowerCase()===`svg`}var D=e(t(),1);function O(e){return e.tooLarge?`too-large`:E(e.path)?`image`:e.binary?`binary`:`text`}function k(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}var A=n();function j({runId:e,path:t,className:n}){let r=i(e,t??void 0);if(t===null)return(0,A.jsx)(R,{className:n,children:(0,A.jsx)(p,{icon:(0,A.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(r.isPending)return(0,A.jsx)(R,{className:n,children:(0,A.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(r.isError){let e=r.error instanceof a&&r.error.status===409;return(0,A.jsx)(R,{className:n,children:(0,A.jsx)(p,{icon:e?(0,A.jsx)(C,{}):(0,A.jsx)(l,{size:16}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:r.error.message})})}return r.data.type===`file`?(0,A.jsx)(P,{runId:e,entry:r.data,className:n}):(0,A.jsx)(R,{className:n,children:(0,A.jsx)(p,{icon:(0,A.jsx)(S,{}),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 M(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 N(e,t,n){let r=t&&/\.(?:md|markdown)$/i.test(e.path),i=t&&y(e.path),a=/\.(?:png|jpe?g|gif|webp|bmp|ico|avif)$/i.test(e.path),o=t&&a&&e.size<=10*1024*1024?`image`:O(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 P({runId:e,entry:t,displayPath:n,className:i,imageUrl:a,downloadUrl:o,snapshot:s,readerHref:c,documentPreview:l=!1}){let[u,d]=(0,D.useState)(!1),[p,m]=(0,D.useState)(!0),h=n??M(t.path),g=N(t,l,u),_=!!(s||o||g.toggle),v=!g.showImage&&g.kind===`text`&&g.rendered===null;return(0,A.jsxs)(R,{className:i,children:[(0,A.jsxs)(`header`,{"data-slot":`file-preview-head`,className:r(`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,A.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium text-foreground`,title:h,children:h}),(0,A.jsx)(`span`,{"data-slot":`file-preview-size`,className:`ml-auto shrink-0 font-mono text-xs tabular-nums text-muted-foreground`,children:k(t.size)}),v?(0,A.jsx)(f,{wrap:p,onWrapChange:m,className:`size-8 rounded-md max-md:size-11 pointer-coarse:size-11`}):null]}),_?(0,A.jsx)(I,{snapshot:s,downloadUrl:o,source:g.toggle?u:null,onSource:()=>d(e=>!e),readerHref:g.html&&g.kind===`text`?c:void 0}):null,(0,A.jsx)(F,{runId:e,entry:t,kind:g.kind,showImage:g.showImage,rendered:g.rendered,imageUrl:a,wrap:p})]})}function F({runId:e,entry:t,kind:n,showImage:r,rendered:i,imageUrl:a,wrap:s}){return r?(0,A.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,A.jsx)(`img`,{"data-slot":`file-preview-image`,src:a??o(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):n===`too-large`?(0,A.jsx)(p,{icon:(0,A.jsx)(x,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${k(t.size)} — past the preview cap. Open it in your editor instead.`}):n===`binary`?(0,A.jsx)(p,{icon:(0,A.jsx)(S,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${k(t.size)} of binary data — no text preview.`}):i===`markdown`?(0,A.jsx)(`div`,{className:`p-4`,children:(0,A.jsx)(v,{document:!0,children:t.content??``})}):i===`html`?(0,A.jsx)(b,{html:t.content??``,title:`Report: ${t.path}`,className:`h-[70vh]`}):(0,A.jsx)(V,{path:t.path,text:t.content??``,wrap:s})}function I({snapshot:e,downloadUrl:t,source:n,onSource:r,readerHref:i}){return(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-b border-border px-4 py-2 text-xs`,children:[e?(0,A.jsxs)(`span`,{children:[`Published snapshot · `,e]}):null,t?(0,A.jsx)(`a`,{className:`inline-flex min-h-11 items-center text-accent-text underline`,href:t,children:`Download`}):null,n===null?null:(0,A.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,A.jsx)(L,{href:i}):null]})}function L({href:e}){let t=c(),n=s();return(0,A.jsx)(`a`,{className:`inline-flex min-h-11 items-center px-2 text-accent-text underline focus-visible:ring-2`,href:e,onClick:r=>_(r,t,e,n),children:`Open reader`})}function R({className:e,children:t}){return(0,A.jsx)(`section`,{"data-slot":`file-preview`,className:r(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var z=1500;function B(e,t){let n=(0,D.useMemo)(()=>t.split(`
2
2
  `).map(e=>[{content:e}]),[t]),r=(0,D.useMemo)(()=>m(e),[e]),i=n.length>z,[a,o]=(0,D.useState)(null);return(0,D.useEffect)(()=>{if(r===null||i)return;let n=!1;return g(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:h(t,r)?.tokens??n}function V({path:e,text:t,wrap:n=!1}){let i=B(e,t);return(0,A.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":m(e)??`plaintext`,className:`overflow-x-auto overscroll-x-contain py-2 font-mono text-xs leading-[1.7] [scrollbar-width:thin]`,children:(0,A.jsx)(`div`,{className:n?`min-w-0`:`w-max min-w-full`,children:i.map((e,t)=>(0,A.jsxs)(`div`,{className:`flex`,children:[(0,A.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,A.jsx)(`span`,{className:r(`min-w-0 flex-1 pr-6`,n?`whitespace-pre-wrap wrap-anywhere`:`whitespace-pre`),children:e.map((e,t)=>(0,A.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})})}export{k as a,S as c,M as i,x as l,P as n,E as o,j as r,C as s,V as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r,s as i}from"./dist-C_rn70hE.js";import{F as a,T as o,j as s,st as c,u as l}from"./design-icons-CzEoMH9c.js";import{t as u}from"./createLucideIcon-BHp8sXmF.js";import{t as d}from"./external-link-BE6y205O.js";import{a as f,i as p,n as m,r as h,t as g}from"./diff-controls-C62rOSYk.js";import{t as _}from"./square-terminal-B6RYYieR.js";import{t as v}from"./button-C8jUIs8Q.js";import{i as y,p as b,r as x,t as S}from"./dropdown-menu-BaqO-x7U.js";import{t as C}from"./diff-stat-Dy4uLuyP.js";var w=u(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),T=u(`file`,[[`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`}]]),E=e(t(),1),D=n();function O({root:e,selected:t,onSelect:n}){return(0,D.jsx)(`nav`,{"data-slot":`changes-tree`,"aria-label":`Changed files`,className:`min-w-0 text-[13px]`,children:(0,D.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,D.jsx)(A,{dir:e,depth:0,selected:t,onSelect:n},e.path)),e.files.map(e=>(0,D.jsx)(M,{file:e,depth:0,selected:t,onSelect:n},e.path))]})})}function k({adds:e,dels:t}){return(0,D.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-xs font-medium tabular-nums`,children:[e>0?(0,D.jsxs)(`span`,{className:`text-semantic-green`,children:[`+`,e]}):null,e>0&&t>0?` `:null,t>0?(0,D.jsxs)(`span`,{className:`text-semantic-red`,children:[`−`,t]}):null]})}function A({dir:e,depth:t,selected:n,onSelect:i}){let[a,s]=(0,E.useState)(!0);return(0,D.jsxs)(`li`,{children:[(0,D.jsxs)(`button`,{type:`button`,"data-slot":`tree-dir`,"data-path":e.path,"data-state":a?`open`:`closed`,"aria-expanded":a,onClick:()=>s(e=>!e),className:`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+t*14}px`},children:[(0,D.jsx)(l,{size:16,"aria-hidden":`true`,className:r(`size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,a&&`rotate-90`)}),(0,D.jsx)(o,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,D.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name}),(0,D.jsx)(k,{adds:e.adds,dels:e.dels})]}),a?(0,D.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,D.jsx)(A,{dir:e,depth:t+1,selected:n,onSelect:i},e.path)),e.files.map(e=>(0,D.jsx)(M,{file:e,depth:t+1,selected:n,onSelect:i},e.path))]}):null]})}var j={added:`text-semantic-green`,deleted:`text-semantic-red`};function M({file:e,depth:t,selected:n,onSelect:i}){let a=n===e.path;return(0,D.jsx)(`li`,{children:(0,D.jsxs)(`button`,{type:`button`,"data-slot":`tree-file`,"data-path":e.path,"aria-current":a?`true`:void 0,onClick:()=>i(e.path),className:r(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,a?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+t*14}px`},children:[(0,D.jsx)(T,{"aria-hidden":`true`,className:r(`size-3.5 shrink-0`,j[e.status])}),(0,D.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,D.jsx)(k,{adds:e.adds,dels:e.dels})]})})}function N(e,t){return{kind:`dir`,name:e,path:t,dirs:[],files:[],adds:0,dels:0,fileCount:0}}function P(e){let t=e;for(;t.files.length===0&&t.dirs.length===1;){let e=t.dirs[0];t={...e,name:`${t.name}/${e.name}`}}return{...t,dirs:t.dirs.map(P)}}var F=(e,t)=>e.name.localeCompare(t.name);function I(e){let t=N(``,``),n=new Map([[``,t]]),r=e=>{let t=n.get(e);if(t)return t;let i=e.lastIndexOf(`/`),a=r(i===-1?``:e.slice(0,i)),o=N(i===-1?e:e.slice(i+1),e);return a.dirs.push(o),n.set(e,o),o};for(let t of e){let e=t.path.lastIndexOf(`/`);r(e===-1?``:t.path.slice(0,e)).files.push({kind:`file`,name:e===-1?t.path:t.path.slice(e+1),path:t.path,status:t.status,adds:t.adds,dels:t.dels,binary:t.binary})}let i=e=>{e.dirs.forEach(i),e.adds=e.files.reduce((e,t)=>e+t.adds,0)+e.dirs.reduce((e,t)=>e+t.adds,0),e.dels=e.files.reduce((e,t)=>e+t.dels,0)+e.dirs.reduce((e,t)=>e+t.dels,0),e.fileCount=e.files.length+e.dirs.reduce((e,t)=>e+t.fileCount,0),e.dirs.sort(F),e.files.sort(F)};return i(t),{...t,dirs:t.dirs.map(P)}}function L({bar:e,healthReady:t,branch:n,stat:i,mode:a,wrap:o,preview:s=!1,onModeChange:c,onWrapChange:l,onPreviewChange:u,onAction:d}){let _=s&&u!==void 0;return(0,D.jsxs)(`div`,{"data-slot":`git-toolbar`,"data-health-ready":t,className:`flex flex-wrap items-center gap-x-3 gap-y-2 px-4 py-4 md:px-9 [&_button]:min-h-11`,children:[(0,D.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[n?(0,D.jsx)(g,{branch:n}):null,i?(0,D.jsx)(B,{stat:i}):null]}),(0,D.jsxs)(`span`,{className:r(`ml-auto flex items-center gap-1.5`,!u&&`md:hidden`),children:[(0,D.jsx)(`span`,{className:`flex md:hidden`,children:(0,D.jsx)(f,{wrap:o,onWrapChange:l,disabled:_})}),_?(0,D.jsx)(h,{}):null,u?(0,D.jsx)(p,{preview:s,onPreviewChange:u}):null]}),(0,D.jsxs)(`span`,{className:r(`flex items-center gap-2 max-md:w-full`,!u&&`md:ml-auto`),children:[(0,D.jsx)(`span`,{className:`hidden items-center gap-1.5 md:flex`,children:(0,D.jsx)(m,{mode:a,wrap:o,onModeChange:c,onWrapChange:l,disabled:_})}),(0,D.jsx)(`span`,{"aria-hidden":`true`,className:`hidden h-5 w-px bg-border md:block`}),(0,D.jsxs)(`span`,{"data-slot":`git-toolbar-actions`,className:`flex items-center gap-1.5 max-md:flex-1 max-md:[&>*]:flex-1`,children:[e.secondary.map(e=>(0,D.jsx)(z,{action:e,variant:`outline`,onAction:d},e.id)),(0,D.jsx)(z,{action:e.primary,variant:`primary`,onAction:d})]}),e.menu.length>0?(0,D.jsxs)(S,{children:[(0,D.jsx)(b,{asChild:!0,children:(0,D.jsx)(v,{variant:`ghost`,size:`icon-sm`,"aria-label":`More git actions`,className:`max-md:min-w-11 max-md:border max-md:border-border max-md:bg-card`,children:(0,D.jsx)(w,{"aria-hidden":`true`})})}),(0,D.jsx)(x,{align:`end`,"data-slot":`git-toolbar-menu`,children:e.menu.map(e=>(0,D.jsxs)(y,{disabled:!e.enabled,title:e.reason,onSelect:()=>d(e.id),children:[R[e.id],e.label]},e.id))})]}):null]})]})}var R={commit:(0,D.jsx)(s,{size:16,"aria-hidden":`true`}),push:(0,D.jsx)(c,{size:16,"aria-hidden":`true`}),"create-pr":(0,D.jsx)(a,{size:16,"aria-hidden":`true`}),"view-pr":(0,D.jsx)(d,{"aria-hidden":`true`}),"open-terminal":(0,D.jsx)(_,{"aria-hidden":`true`})};function z({action:e,variant:t,onAction:n}){return e.id===`view-pr`?i(e.href)?(0,D.jsx)(v,{asChild:!0,variant:t,size:`sm`,"data-action":e.id,children:(0,D.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:[R[e.id],e.label]})}):(0,D.jsxs)(v,{variant:t,size:`sm`,"data-action":e.id,disabled:!0,title:`View PR unavailable — the recorded PR link is not an http(s) URL`,children:[R[e.id],e.label]}):(0,D.jsxs)(v,{variant:t,size:`sm`,"data-action":e.id,disabled:!e.enabled,title:e.enabled?void 0:e.reason,onClick:()=>n(e.id),children:[R[e.id],e.label]})}function B({stat:e}){return(0,D.jsx)(`span`,{"data-slot":`changes-stat`,children:(0,D.jsx)(C,{stat:{adds:V(e.adds),dels:V(e.dels),files:e.files}})})}function V(e){let[t,n]=(0,E.useState)(e),r=(0,E.useRef)(e);return(0,E.useEffect)(()=>{let t=r.current;if(t===e)return;if(typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||typeof requestAnimationFrame!=`function`){r.current=e,n(e);return}let i=performance.now(),a=0,o=s=>{let c=Math.min(1,(s-i)/350),l=1-(1-c)**3;n(Math.round(t+(e-t)*l)),c<1?a=requestAnimationFrame(o):r.current=e};return a=requestAnimationFrame(o),()=>{cancelAnimationFrame(a),r.current=e,n(e)}},[e]),t}export{O as i,L as n,I as r,B as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r,s as i}from"./dist-C_rn70hE.js";import{F as a,T as o,j as s,st as c,u as l}from"./design-icons-CzEoMH9c.js";import{t as u}from"./createLucideIcon-BHp8sXmF.js";import{t as d}from"./external-link-BE6y205O.js";import{a as f,i as p,n as m,r as h,t as g}from"./diff-controls-DbAm3vyj.js";import{t as _}from"./square-terminal-B6RYYieR.js";import{t as v}from"./button-C8jUIs8Q.js";import{i as y,p as b,r as x,t as S}from"./dropdown-menu-BaqO-x7U.js";import{t as C}from"./diff-stat-Dy4uLuyP.js";var w=u(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),T=u(`file`,[[`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`}]]),E=e(t(),1),D=n();function O({root:e,selected:t,onSelect:n}){return(0,D.jsx)(`nav`,{"data-slot":`changes-tree`,"aria-label":`Changed files`,className:`min-w-0 text-[13px]`,children:(0,D.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,D.jsx)(A,{dir:e,depth:0,selected:t,onSelect:n},e.path)),e.files.map(e=>(0,D.jsx)(M,{file:e,depth:0,selected:t,onSelect:n},e.path))]})})}function k({adds:e,dels:t}){return(0,D.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-xs font-medium tabular-nums`,children:[e>0?(0,D.jsxs)(`span`,{className:`text-semantic-green`,children:[`+`,e]}):null,e>0&&t>0?` `:null,t>0?(0,D.jsxs)(`span`,{className:`text-semantic-red`,children:[`−`,t]}):null]})}function A({dir:e,depth:t,selected:n,onSelect:i}){let[a,s]=(0,E.useState)(!0);return(0,D.jsxs)(`li`,{children:[(0,D.jsxs)(`button`,{type:`button`,"data-slot":`tree-dir`,"data-path":e.path,"data-state":a?`open`:`closed`,"aria-expanded":a,onClick:()=>s(e=>!e),className:`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+t*14}px`},children:[(0,D.jsx)(l,{size:16,"aria-hidden":`true`,className:r(`size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,a&&`rotate-90`)}),(0,D.jsx)(o,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,D.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name}),(0,D.jsx)(k,{adds:e.adds,dels:e.dels})]}),a?(0,D.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,D.jsx)(A,{dir:e,depth:t+1,selected:n,onSelect:i},e.path)),e.files.map(e=>(0,D.jsx)(M,{file:e,depth:t+1,selected:n,onSelect:i},e.path))]}):null]})}var j={added:`text-semantic-green`,deleted:`text-semantic-red`};function M({file:e,depth:t,selected:n,onSelect:i}){let a=n===e.path;return(0,D.jsx)(`li`,{children:(0,D.jsxs)(`button`,{type:`button`,"data-slot":`tree-file`,"data-path":e.path,"aria-current":a?`true`:void 0,onClick:()=>i(e.path),className:r(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,a?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+t*14}px`},children:[(0,D.jsx)(T,{"aria-hidden":`true`,className:r(`size-3.5 shrink-0`,j[e.status])}),(0,D.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,D.jsx)(k,{adds:e.adds,dels:e.dels})]})})}function N(e,t){return{kind:`dir`,name:e,path:t,dirs:[],files:[],adds:0,dels:0,fileCount:0}}function P(e){let t=e;for(;t.files.length===0&&t.dirs.length===1;){let e=t.dirs[0];t={...e,name:`${t.name}/${e.name}`}}return{...t,dirs:t.dirs.map(P)}}var F=(e,t)=>e.name.localeCompare(t.name);function I(e){let t=N(``,``),n=new Map([[``,t]]),r=e=>{let t=n.get(e);if(t)return t;let i=e.lastIndexOf(`/`),a=r(i===-1?``:e.slice(0,i)),o=N(i===-1?e:e.slice(i+1),e);return a.dirs.push(o),n.set(e,o),o};for(let t of e){let e=t.path.lastIndexOf(`/`);r(e===-1?``:t.path.slice(0,e)).files.push({kind:`file`,name:e===-1?t.path:t.path.slice(e+1),path:t.path,status:t.status,adds:t.adds,dels:t.dels,binary:t.binary})}let i=e=>{e.dirs.forEach(i),e.adds=e.files.reduce((e,t)=>e+t.adds,0)+e.dirs.reduce((e,t)=>e+t.adds,0),e.dels=e.files.reduce((e,t)=>e+t.dels,0)+e.dirs.reduce((e,t)=>e+t.dels,0),e.fileCount=e.files.length+e.dirs.reduce((e,t)=>e+t.fileCount,0),e.dirs.sort(F),e.files.sort(F)};return i(t),{...t,dirs:t.dirs.map(P)}}function L({bar:e,healthReady:t,branch:n,stat:i,mode:a,wrap:o,preview:s=!1,onModeChange:c,onWrapChange:l,onPreviewChange:u,onAction:d}){let _=s&&u!==void 0;return(0,D.jsxs)(`div`,{"data-slot":`git-toolbar`,"data-health-ready":t,className:`flex flex-wrap items-center gap-x-3 gap-y-2 px-4 py-4 md:px-9 [&_button]:min-h-11`,children:[(0,D.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[n?(0,D.jsx)(g,{branch:n}):null,i?(0,D.jsx)(B,{stat:i}):null]}),(0,D.jsxs)(`span`,{className:r(`ml-auto flex items-center gap-1.5`,!u&&`md:hidden`),children:[(0,D.jsx)(`span`,{className:`flex md:hidden`,children:(0,D.jsx)(f,{wrap:o,onWrapChange:l,disabled:_})}),_?(0,D.jsx)(h,{}):null,u?(0,D.jsx)(p,{preview:s,onPreviewChange:u}):null]}),(0,D.jsxs)(`span`,{className:r(`flex items-center gap-2 max-md:w-full`,!u&&`md:ml-auto`),children:[(0,D.jsx)(`span`,{className:`hidden items-center gap-1.5 md:flex`,children:(0,D.jsx)(m,{mode:a,wrap:o,onModeChange:c,onWrapChange:l,disabled:_})}),(0,D.jsx)(`span`,{"aria-hidden":`true`,className:`hidden h-5 w-px bg-border md:block`}),(0,D.jsxs)(`span`,{"data-slot":`git-toolbar-actions`,className:`flex items-center gap-1.5 max-md:flex-1 max-md:[&>*]:flex-1`,children:[e.secondary.map(e=>(0,D.jsx)(z,{action:e,variant:`outline`,onAction:d},e.id)),(0,D.jsx)(z,{action:e.primary,variant:`primary`,onAction:d})]}),e.menu.length>0?(0,D.jsxs)(S,{children:[(0,D.jsx)(b,{asChild:!0,children:(0,D.jsx)(v,{variant:`ghost`,size:`icon-sm`,"aria-label":`More git actions`,className:`max-md:min-w-11 max-md:border max-md:border-border max-md:bg-card`,children:(0,D.jsx)(w,{"aria-hidden":`true`})})}),(0,D.jsx)(x,{align:`end`,"data-slot":`git-toolbar-menu`,children:e.menu.map(e=>(0,D.jsxs)(y,{disabled:!e.enabled,title:e.reason,onSelect:()=>d(e.id),children:[R[e.id],e.label]},e.id))})]}):null]})]})}var R={commit:(0,D.jsx)(s,{size:16,"aria-hidden":`true`}),push:(0,D.jsx)(c,{size:16,"aria-hidden":`true`}),"create-pr":(0,D.jsx)(a,{size:16,"aria-hidden":`true`}),"view-pr":(0,D.jsx)(d,{"aria-hidden":`true`}),"open-terminal":(0,D.jsx)(_,{"aria-hidden":`true`})};function z({action:e,variant:t,onAction:n}){return e.id===`view-pr`?i(e.href)?(0,D.jsx)(v,{asChild:!0,variant:t,size:`sm`,"data-action":e.id,children:(0,D.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:[R[e.id],e.label]})}):(0,D.jsxs)(v,{variant:t,size:`sm`,"data-action":e.id,disabled:!0,title:`View PR unavailable — the recorded PR link is not an http(s) URL`,children:[R[e.id],e.label]}):(0,D.jsxs)(v,{variant:t,size:`sm`,"data-action":e.id,disabled:!e.enabled,title:e.enabled?void 0:e.reason,onClick:()=>n(e.id),children:[R[e.id],e.label]})}function B({stat:e}){return(0,D.jsx)(`span`,{"data-slot":`changes-stat`,children:(0,D.jsx)(C,{stat:{adds:V(e.adds),dels:V(e.dels),files:e.files}})})}function V(e){let[t,n]=(0,E.useState)(e),r=(0,E.useRef)(e);return(0,E.useEffect)(()=>{let t=r.current;if(t===e)return;if(typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||typeof requestAnimationFrame!=`function`){r.current=e,n(e);return}let i=performance.now(),a=0,o=s=>{let c=Math.min(1,(s-i)/350),l=1-(1-c)**3;n(Math.round(t+(e-t)*l)),c<1?a=requestAnimationFrame(o):r.current=e};return a=requestAnimationFrame(o),()=>{cancelAnimationFrame(a),r.current=e,n(e)}},[e]),t}export{O as i,L as n,I as r,B as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r,p as i}from"./dist-C_rn70hE.js";import{M as a,Wt as o,cn as s,dn as c,i as l,k as u,l as d,o as f,r as p,s as m}from"./queries-ByqTmyCs.js";import{An as h,G as g,I as _,K as v,Si as y,U as b,hi as x,n as S,q as C}from"./toaster-Lf_4oY96.js";import{h as ee}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{F as w,I as T,X as E,Y as D,c as O,ct as k,l as A,ot as j,p as M,r as te}from"./design-icons-CzEoMH9c.js";import{t as ne}from"./chevron-down-CHGyCDBH.js";import{t as N}from"./chevron-right-BENZ-1ZN.js";import{t as P}from"./loader-circle-CPBhhDbB.js";import{t as re}from"./play-CmVAj_fu.js";import{t as F}from"./button-C8jUIs8Q.js";import{a as I,i as L,n as ie,r as R,t as ae}from"./select-D_VDDq-U.js";import{i as z,r as B,t as V}from"./popover-CVo54-aS.js";import{r as oe,t as H}from"./project-router-CEnizJ8F.js";import"./attention-CnhIF76m.js";import{f as se,v as ce}from"./task-groups-BRrlyl5P.js";import{t as le}from"./status-dot-BXf-Ubd0.js";import{a as ue,o as de,r as fe,s as pe,t as me}from"./command-DuxcX6Hr.js";import{d as he,s as U,u as W}from"./page-shell-CpdYMj52.js";import{t as G}from"./centered-state-BgSV4e79.js";import{t as ge}from"./use-search-params-writer-ClMScnNe.js";import{Ct as _e,Dt as ve,Et as ye,Nn as be,Ot as xe,Qt as Se,Rn as Ce,St as we,Tt as Te,_t as Ee,bt as De,gt as Oe,ht as ke,kn as Ae,r as je,s as Me,st as Ne,vt as Pe,wt as Fe,xn as K,xt as Ie,yt as Le}from"./index-DygQwjn7.js";import{a as Re,d as ze,f as Be,i as Ve,l as He,n as Ue,o as We,r as Ge,s as Ke,t as qe,u as q}from"./use-hand-to-agent-state-iYYMqi-U.js";import{t as Je}from"./tab-link-3A_SF95U.js";var J=e(t(),1),Ye=`cez-github-list-width`;function Y(e){if(e==null||e===``||typeof e==`string`&&e.trim()===``)return 360;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(520,Math.max(280,Math.round(t))):360}function Xe(){try{let e=localStorage.getItem(Ye);return e===null?360:Y(e)}catch{return 360}}function Ze(e){try{localStorage.setItem(Ye,String(Y(e)))}catch{}}var X=n();function Qe({number:e,repo:t}){let n=i();return(0,X.jsx)($e,{number:e,repo:t,scope:n},JSON.stringify([n,t,e]))}function $e({number:e,repo:t,scope:n}){let i=(0,J.useId)(),o=(0,J.useId)(),[c,l]=(0,J.useState)(!1),u=c?ne:N,d=s(n,!0,n==="default"),f=a(`#${e}`,!0),p=(0,J.useMemo)(()=>Te(ce(d.data??[],f.data?.pages.flatMap(e=>e.runs)??[]),e,t,n),[d.data,f.data,e,t,n]);return(0,X.jsxs)(`section`,{"aria-labelledby":i,className:r(`mt-4 min-w-0 rounded-lg border border-border`,c?`p-3`:`p-0.5`),children:[(0,X.jsx)(`h3`,{id:i,className:`text-xs font-semibold text-muted-foreground`,children:(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":c,"aria-controls":o,onClick:()=>l(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,X.jsx)(u,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,X.jsxs)(`span`,{children:[`Linked tasks`,d.data?` (${p.length}${f.hasNextPage||f.isError?`+`:``})`:``]})]})}),(0,X.jsx)(`div`,{id:o,children:c?(0,X.jsxs)(X.Fragment,{children:[d.isPending?(0,X.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-muted-foreground`,children:`Loading linked tasks…`}):null,d.isError?(0,X.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`p`,{role:`status`,children:`Couldn’t load linked tasks. Check your connection and try again.`}),(0,X.jsx)(F,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void d.refetch(),disabled:d.isFetching,children:`Retry linked tasks`})]}):null,d.data&&p.length===0&&!d.isError?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`No linked tasks yet.`}):null,p.length>0?(0,X.jsx)(`ul`,{className:`mt-2 flex flex-col gap-1`,children:p.map(e=>{let t=Ae(e,h(e));return(0,X.jsx)(`li`,{children:(0,X.jsxs)(H,{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,X.jsx)(`span`,{className:`text-sm font-medium break-words [overflow-wrap:anywhere]`,children:se(e)}),(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(le,{tone:t.tone,shape:t.shape,pulse:t.pulse,role:`img`,"aria-label":t.label,title:t.label}),e.archived?(0,X.jsx)(je,{"data-slot":`linked-task-archived`,dot:K.tone,shape:K.shape,className:`px-2 py-px`,children:K.label}):null,(0,X.jsx)(`time`,{dateTime:e.createdAt,children:new Date(e.createdAt).toLocaleDateString()})]})]})},e.id)})}):null,f.isError?(0,X.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`p`,{role:`status`,children:`Couldn’t load older archived linked tasks.`}),(0,X.jsx)(F,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void f.refetch(),disabled:f.isFetching,children:`Retry older linked tasks`})]}):f.hasNextPage?(0,X.jsx)(F,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void f.fetchNextPage(),disabled:f.isFetchingNextPage,children:f.isFetchingNextPage?`Loading older linked tasks…`:`Show older linked tasks`}):null]}):null})]})}var et=`w-44 max-w-full`,Z=`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`,Q=`__all__`;function tt(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 nt(e,t){return!!e&&t.length===1&&t[0]?.toLowerCase()===e.toLowerCase()}function rt(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 it(e){return[e.viewerLogin?``:`GitHub login unavailable.`,rt(e)].filter(Boolean).join(` `)}function at({options:e,assignees:t,onAssigneesChange:n}){return(0,X.jsxs)(V,{children:[(0,X.jsx)(z,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:`${Z} inline-flex items-center gap-1.5`,disabled:e.length===0,children:[`Assignee`,t.length?` · ${t.length}`:``,(0,X.jsx)(A,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-muted-foreground`})]})}),(0,X.jsx)(B,{align:`start`,className:`w-64 max-w-[calc(100vw-2rem)] p-2`,children:(0,X.jsxs)(`fieldset`,{className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto`,children:[(0,X.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,X.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded px-2 hover:bg-muted`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>n(r?t.filter(t=>t.toLowerCase()!==e.toLowerCase()):[...t,e])}),(0,X.jsx)(`span`,{className:`break-all text-sm`,children:e})]},e.toLowerCase())})]})})]})}function ot({data:e,projectId:t,onProjectChange:n,pickerRef:r}){if(e.projects?.length)return(0,X.jsxs)(ae,{value:t||Q,onValueChange:e=>n(e===Q?``:e),children:[(0,X.jsx)(L,{ref:r,"aria-label":`Project board`,"data-slot":`gh-board-filter`,"data-value":t,className:`${Z} ${et} justify-between`,children:(0,X.jsx)(I,{placeholder:`All boards`})}),(0,X.jsxs)(ie,{align:`start`,children:[(0,X.jsx)(R,{value:Q,children:`All boards`}),e.projects.map(e=>(0,X.jsx)(R,{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,X.jsxs)(ae,{disabled:!0,value:Q,children:[(0,X.jsx)(L,{ref:r,"aria-label":`Project board`,"data-slot":`gh-board-filter`,"data-value":``,className:`${Z} ${et} justify-between`,children:(0,X.jsx)(I,{placeholder:t,children:t})}),(0,X.jsx)(ie,{align:`start`,children:(0,X.jsx)(R,{value:Q,children:t})})]})}return null}function st({data:e,message:t,lastMessage:n,hasMessage:r,statusOpen:i,setStatusOpen:a,triggerRef:o,contentRef:s}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{role:`status`,className:`sr-only`,children:t}),(0,X.jsxs)(V,{open:i,onOpenChange:a,children:[(0,X.jsx)(z,{asChild:!0,children:(0,X.jsx)(`button`,{ref:o,type:`button`,className:`${Z} inline-flex items-center justify-center ${t?``:`invisible`}`,"aria-label":`Project board status`,tabIndex:t?void 0:-1,children:e.projectsState===`refreshing`?(0,X.jsx)(D,{size:14,"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):(0,X.jsx)(j,{size:14,"aria-hidden":`true`,className:`size-3.5`})})}),(0,X.jsx)(B,{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 ct({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=tt(e.issues,t),f=nt(e.viewerLogin,t),p=it(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,X.jsxs)(`div`,{className:`contents`,"data-slot":`gh-issue-filters`,children:[(0,X.jsx)(at,{options:d,assignees:t,onAssigneesChange:r}),(0,X.jsxs)(`button`,{ref:u,type:`button`,"data-slot":`gh-assigned-me`,className:`${Z} inline-flex items-center gap-1.5 rounded-full aria-pressed:border-foreground aria-pressed:bg-foreground aria-pressed:text-background`,disabled:!e.viewerLogin,"aria-pressed":f,onClick:()=>r(f?[]:[e.viewerLogin]),children:[(0,X.jsx)(k,{size:14,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`Assigned to me`]}),(0,X.jsx)(ot,{data:e,projectId:n,onProjectChange:i,pickerRef:l}),(0,X.jsx)(st,{data:e,message:p,lastMessage:h,hasMessage:m,statusOpen:a,setStatusOpen:o,triggerRef:s,contentRef:c})]})}function lt({onRefresh:e,refreshing:t}){let n=ke(i());return(0,X.jsx)(W,{route:`github`,density:`full`,headerSpacing:`compact`,header:{title:`GitHub`,secondaryActions:(0,X.jsx)(U,{type:`button`,variant:`ghost`,"data-slot":`gh-screen-refresh`,"aria-label":`Refresh from GitHub`,title:`Refresh from GitHub`,disabled:t,onClick:e,children:(0,X.jsx)(D,{size:17,"aria-hidden":`true`,className:r(`size-[17px]`,t&&`motion-safe:animate-spin`)})})},children:(0,X.jsx)(`div`,{"data-slot":`github-filter-screen`,children:(0,X.jsx)(Oe,{model:n,variant:`screen`})})})}function ut({view:e,activeFilter:t,isDesktop:n,rawFilterParam:r,n:i,gh:a,actions:o}){return{headerSlot:`gh-masthead`,title:n?e===`issues`?`Issues`:`Pull requests`:`GitHub`,scope:n?Ee[t]:void 0,scopeSlot:`gh-title-qualifier`,subtitle:a.repo?(0,X.jsxs)(`span`,{className:`block min-w-0 truncate`,children:[(0,X.jsx)(`span`,{"data-slot":`gh-repo`,children:a.repo}),(0,X.jsxs)(`span`,{"data-slot":`gh-synced`,title:a.syncedAt?new Date(a.syncedAt).toLocaleString():void 0,children:[` `,`· `,a.syncedAt?(0,X.jsx)(be,{iso:a.syncedAt,prefix:`Synced `}):`Not synced yet`]})]}):void 0,secondaryActions:(0,X.jsx)(dt,{...o}),headerExtra:r!==null&&i===void 0?(0,X.jsxs)(`div`,{"data-slot":`gh-filter-context`,className:`mt-1 flex min-w-0 items-center gap-3 md:hidden`,children:[(0,X.jsxs)(H,{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,X.jsx)(te,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to filters`]}),t===`all`?null:(0,X.jsx)(`span`,{"data-slot":`gh-active-filter`,className:`truncate text-xs text-muted-foreground`,children:[...Le,...De].find(e=>e.id===t)?.label})]}):void 0}}function dt({automationsAvailable:e,refreshing:t,onRefresh:n}){return(0,X.jsxs)(`div`,{"data-slot":`gh-page-actions`,className:`flex shrink-0 flex-wrap items-center gap-2`,children:[e?(0,X.jsx)(U,{variant:`outline`,asChild:!0,children:(0,X.jsx)(H,{to:`/automations/new`,children:`Set up automations`})}):null,(0,X.jsxs)(U,{type:`button`,variant:`outline`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:t,onClick:n,children:[(0,X.jsx)(D,{size:16,"aria-hidden":`true`,className:r(`size-3.5`,t&&`motion-safe:animate-spin`)}),`Refresh`]})]})}function ft({view:e,number:t}){return(0,X.jsx)(G,{icon:e===`issues`?(0,X.jsx)(M,{size:16}):(0,X.jsx)(w,{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`}. Search for ${t} above to look it up on GitHub, closed and merged included.`})}function pt({item:e,view:t,filter:n,colors:i,active:a,queued:s,checks:c,comments:l}){let u=e.kind===`issue`?M:w,d=x(),f=()=>{d.prefetchQuery({queryKey:o.githubComments(e.kind,e.number),queryFn:({signal:t})=>v(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,X.jsxs)(H,{to:we(t,n,e.number),draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,Ge(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:f,onFocus:f,"data-slot":`gh-row`,"data-number":e.number,"data-kind":e.kind,"aria-current":a?`page`:void 0,title:`Drag into the composer to prefill a task`,className:r(`flex flex-col gap-2 rounded-md px-3 py-4 transition-colors hover:bg-muted`,a&&`bg-accent-strong/10 text-accent-text`),children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 md:items-center`,children:[(0,X.jsx)(u,{"aria-hidden":`true`,"data-slot":`gh-row-icon`,className:r(`mt-0.5 size-3.5 shrink-0 md:mt-0`,e.kind===`issue`?`text-success`:`text-accent-icon`)}),(0,X.jsx)(`span`,{"data-slot":`gh-row-title`,className:r(`line-clamp-2 min-w-0 text-[13px] font-medium md:block md:truncate`,a&&`font-semibold`),children:e.title})]}),(0,X.jsxs)(`span`,{"data-slot":`gh-row-meta`,className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 pl-[22px] text-xs text-muted-foreground md:flex-nowrap md:gap-y-0`,children:[(0,X.jsxs)(`span`,{className:`shrink-0 tabular-nums`,children:[`#`,e.number]}),(0,X.jsx)($,{}),(0,X.jsx)(`span`,{"data-slot":`gh-row-author`,className:`max-w-full shrink-0 truncate md:min-w-0 md:shrink`,children:e.author}),(0,X.jsx)($,{}),(0,X.jsx)(be,{iso:e.createdAt,className:`shrink-0`}),l?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{}),(0,X.jsx)(Re,{count:l})]}):null,c?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{}),(0,X.jsx)(Ve,{checks:c})]}):null,s?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{}),(0,X.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`shrink-0 font-sans font-medium text-accent-text`,children:`↗ run queued`})]}):null]}),e.labels.length>0?(0,X.jsx)(`span`,{"data-slot":`gh-row-labels`,className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,X.jsx)(Ke,{label:e,color:i[e],plain:!0},e))}):null]})}function $(){return(0,X.jsx)(`span`,{"data-slot":`gh-row-dot`,"aria-hidden":`true`,className:`shrink-0`,children:`·`})}function mt(e){let t=getComputedStyle(e).overflowY;return t===`auto`||t===`scroll`?e:e.closest(`[data-slot="main"]`)??e}function ht(e){let[t,n]=(0,J.useState)(null);return(0,J.useLayoutEffect)(()=>{if(!e){n(null);return}let t=()=>n(mt(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 gt(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 _t(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 vt(e,t,n,r,i){let[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(null),l=ht(a),u=(0,J.useRef)(null);u.current=l;let d=gt(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:_t(p&&!i&&!t.isFetchingNextPage&&!t.isFetchNextPageError,l,()=>void t.fetchNextPage())}}function yt({item:e,queuedRunId:t}){return t?(0,X.jsx)(F,{asChild:!0,variant:`outline`,size:`sm`,className:`max-md:h-11 no-hover:h-11`,children:(0,X.jsxs)(H,{to:`/tasks/${t}`,"data-action":`gh-header-view-task`,children:[(0,X.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5 text-success`}),`Open queued task`]})}):(0,X.jsxs)(F,{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`}`,className:`max-md:h-11 no-hover:h-11`,onClick:bt,children:[(0,X.jsx)(re,{"aria-hidden":`true`,className:`size-3.5`}),`Hand to agent`]})}function bt(){let e=document.querySelector(`[data-slot="gh-detail-inner"] [data-slot="gh-custom-prompt"]`);e?.scrollIntoView({block:`center`}),e?.focus({preventScroll:!0})}var xt=100;function St(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>=xt)break;a.add(t.number)}return[...a]}function Ct(e,t,n,r,i,a){let o=St(n,e,r,i,a),s=p(o,e===`prs`),c=s.data?.available?s.data.checks:void 0,u=l(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),d=(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=>u[e.number]??(d.has(e.number)?void 0:e.comments)}}function wt(e){let[t,n]=ge(),r=t.get(`filter`),i=ye(e,r);return{rawFilterParam:r,filter:i,activeFilter:i??`all`,setFilterParam:e=>n(t=>{let n=new URLSearchParams(t);return e===null?n.delete(`filter`):n.set(`filter`,e),n})}}function Tt(e,t,{filter:n,activeFilter:r,setFilterParam:i}){let[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)([]),[l,u]=(0,J.useState)([]),{setProjectFilter:d,activeProject:f}=Et(t),p=e===`issues`&&r===`assigned`,m=p?t?.viewerLogin?[t.viewerLogin]:[]:l;return{query:a,setQuery:o,labelFilter:s,setLabelFilter:c,setProjectFilter:d,activeProject:f,isAssignedFilter:p,effectiveAssignees:m,changeAssignees:e=>{u(e),p&&i(`all`)},clearFilters:()=>{o(``),c([]),u([]),d(``),n!==null&&n!==`all`&&i(`all`)},filtering:a.trim()!==``||s.length>0||e===`issues`&&(m.length>0||f!==``)||n!==null&&n!==`all`,narrowing:a.trim()!==``||s.length>0||e===`issues`&&(!p&&l.length>0||f!==``)}}function Et(e){let[t,n]=(0,J.useState)(``),r=e?.projectsState===`refreshing`||e?.projectsState===`unavailable`,i=r||e?.projects?.some(e=>e.id===t)?t:``;return(0,J.useEffect)(()=>{e&&!r&&t&&!i&&n(``)},[e,t,i,r]),{setProjectFilter:n,activeProject:i}}function Dt(e,t,{filter:n,activeFilter:r},a){let o=i(),c=e===`issues`&&(r===`no-task`||r===`has-task`),l=s(o,c,o==="default"),u=(0,J.useMemo)(()=>l.data?Fe(l.data,t?.repo,o):null,[l.data,t?.repo,o]),f=_e(e,n)?xe(n):null,p=d(`pr`,f??``,f!==null&&t?.available===!0),m=f!==null&&p.data?.available?p.data.items:null,h=(0,J.useMemo)(()=>t?.available?e===`issues`?t.issues:t.prs:[],[t,e]),g=(0,J.useMemo)(()=>m?ve(m,h):null,[m,h]),_=Ot({view:e,gh:t,activeFilter:r,isAssignedFilter:a,taskFilter:c,taskNumbers:u,runsQuery:l,backedQuery:f,filterHits:m,filterSearch:p});return{backedQuery:f,filterSearch:p,fullList:h,filterRows:g,filterGate:_,openItems:(0,J.useMemo)(()=>_?[]:g??h,[_,g,h]),narrow:(0,J.useMemo)(()=>e===`issues`?r===`no-task`&&u?{excludeNumbers:u}:r===`has-task`&&u?{includeNumbers:u}:{}:r===`mine`&&t?.viewerLogin?{author:t.viewerLogin}:m?{includeNumbers:new Set(m.map(e=>e.number))}:{},[e,r,u,t?.viewerLogin,m])}}function Ot({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 kt(e,t){return t?C(t.kind,t.number,{refresh:!0}).then(n=>(e.setQueryData(t.key,n),!0)).catch(()=>!1):Promise.resolve(!0)}function At(e,t,n,{filterGate:r,filterRows:i,fullList:a}){let s=o.github()[0],c=t===void 0?null:Number.parseInt(t,10),l=!r&&n.data?.available?n.data.items.find(e=>e.number===c):void 0,u=i&&c!==null&&!a.some(e=>e.number===c)?i.find(e=>e.number===c):void 0,d=l??u,[f,p]=(0,J.useState)(null);return(0,J.useEffect)(()=>{d&&p({scope:s,view:e,item:d})},[s,e,d]),{selectedNumber:c,remoteDetail:d??(f?.scope===s&&f.view===e&&f.item.number===c?f.item:null)}}function jt(e,t,n,{fullList:r,filterRows:i},a){let s=x(),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,d=f(l,n??0,u),p=u&&d.data?.available&&d.data.item?.kind===l?d.data.item:null;c.current=u&&n!==null?{kind:l,number:n,key:o.githubItem(l,n)}:null;let[m,h]=(0,J.useState)(!1);return{exactWanted:u,exactItem:d,exactDetail:p,exactTargetRef:c,retryingExact:m,retryExact:()=>{h(!0),kt(s,c.current).then(e=>{h(!1),e||S(`Could not reach GitHub for #${n}`,{tone:`danger`})})}}}function Mt(e,t,n){let r=x(),i=(0,J.useRef)(null);return{refresh:c({mutationFn:e=>(kt(r,e),b({refresh:!0,limit:50})),onSuccess:async a=>{await r.cancelQueries({queryKey:o.githubPages(50),exact:!0}),r.setQueryData(o.githubPages(50),{pages:[a],pageParams:[{}]}),r.invalidateQueries({queryKey:o.githubChecks(t)});let s=e===`issues`?`issue`:`pr`,c=(e===`issues`?a.issues:a.prs).map(e=>e.number),l=o.githubCommentCounts(s,c);r.removeQueries({queryKey:o.githubCommentCounts(s,[]).slice(0,4),predicate:e=>e.queryHash!==y(l)}),a.available&&a.commentsDeferred&&c.length>0&&g(s,c,{refresh:!0}).then(e=>r.setQueryData(l,e)).catch(()=>{}),r.invalidateQueries({queryKey:o.githubSearch(e===`issues`?`issue`:`pr`,n)}),r.invalidateQueries({queryKey:o.githubSearch(`pr`,Ie)}),r.invalidateQueries({queryKey:o.githubSearch(`pr`,Pe)});let u=i.current,d=o.githubComments(`issue`,0).slice(0,3);if(!u){r.removeQueries({queryKey:d});return}let f=o.githubComments(u.kind,u.number);v(u.kind,u.number,{refresh:!0}).then(e=>r.setQueryData(f,e)).catch(()=>{}),r.removeQueries({queryKey:d,predicate:e=>e.queryHash!==y(f)})},onError:e=>S(e.message,{tone:`danger`})}),openThreadRef:i}}var Nt=350;function Pt(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 Ft(e,t,{query:n,labelFilter:r,effectiveAssignees:i,activeProject:a},{openItems:o,narrow:s,filterGate:c}){let l=Pt(n,Nt),u=(0,J.useMemo)(()=>q(o,{query:l,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),[o,l,r,e,i,a,s]),f=n.trim()===l.trim(),p=t?.available===!0&&!c&&f&&Be(l,u),m=d(e===`issues`?`issue`:`pr`,l,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=It(e,g,a,i);return{debouncedQuery:l,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)):[],...Lt(n,f,p,m)}}function It(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 Lt(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 Rt({width:e,onWidthChange:t}){let n=(0,J.useRef)(null),r=t=>{t.button===0&&(n.current={x:t.clientX,width:e},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),t.currentTarget.focus())},i=e=>{let r=n.current;r&&t(Y(r.width+(e.clientX-r.x)))},a=e=>{n.current&&(n.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,X.jsx)(`div`,{"data-slot":`gh-list-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the GitHub list`,"aria-valuenow":e,"aria-valuemin":280,"aria-valuemax":520,tabIndex:0,onPointerDown:r,onPointerMove:i,onPointerUp:a,onPointerCancel:a,onKeyDown:n=>{let r=n.key===`ArrowLeft`?e-16:n.key===`ArrowRight`?e+16:n.key===`Home`?280:n.key===`End`?520:null;r!==null&&(n.preventDefault(),t(Y(r)))},onDoubleClick:()=>t(360),title:`Drag to resize the GitHub list — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 hidden w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-accent-strong/40 focus-visible:bg-accent-strong/60 focus-visible:outline-none md:block`})}function zt({view:e,changes:t=!1,index:n=!1}){let{n:r}=ee(),i=wt(e),{rawFilterParam:a,activeFilter:o}=i,s=Se(),{pages:c,data:l}=m(50),d=Ce(),f=Vt(),p=qe(),h=Bt({index:n,isDesktop:s,rawFilterParam:a,n:r,rememberedView:u().data?.githubView}),g=Ht(l?.available===!0&&!h.filterScreen),[_,v]=(0,J.useState)(!1),y=Tt(e,l,i),b=Dt(e,l,i,y.isAssignedFilter),x=Ft(e,l,y,b),S=At(e,r,x.forgeSearch,b),C=jt(e,l,S.selectedNumber,b,S.remoteDetail),w=Ct(e,c,l,S.selectedNumber,x.searchHits,b.openItems),{refresh:T,openThreadRef:E}=Mt(e,w.checkPrNumbers,x.debouncedQuery),D=vt(e,c,l,b.backedQuery,y.narrowing);if(h.restorePrs)return(0,X.jsx)(oe,{to:`/github/prs`,replace:!0});if(!l)return c.isError?(0,X.jsx)(W,{route:`github`,density:`empty`,children:(0,X.jsx)(G,{icon:(0,X.jsx)(j,{size:16}),tone:`danger`,title:`Could not load GitHub`,subtitle:c.error.message})}):(0,X.jsx)(Ne,{});E.current=null;let O=()=>T.mutate(C.exactTargetRef.current);if(h.filterScreen&&l.available)return(0,X.jsx)(lt,{onRefresh:O,refreshing:T.isPending});if(!l.available)return(0,X.jsx)(qt,{reason:l.reason,refreshing:T.isPending,onRetry:O});let{labelColors:k,labelOptions:A}=Ut(l,x.searchPayload,b.openItems,b.fullList),M=Wt({number:S.selectedNumber,items:x.items,searchHits:x.searchHits,fullList:b.fullList,filterRows:b.filterRows,remoteDetail:S.remoteDetail,exactDetail:C.exactDetail});E.current=M?{kind:M.kind,number:M.number}:null;let{linkFilter:te,listPath:ne}=Gt(e,a,o,s),N={view:e,filter:te,colors:k,selected:M,queued:p.queued,checksMap:w.checksMap,commentsOf:w.commentsOf},P=Kt(e,y,b.filterGate,x),re=he(x.items.length+x.searchHits.length);return(0,X.jsx)(W,{rootRef:g.routeRef,route:`github`,density:re,headerSpacing:`compact`,className:`pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-4`,bodyClassName:`gap-2.5`,header:ut({view:e,activeFilter:o,isDesktop:s,rawFilterParam:a,n:r,gh:l,actions:{automationsAvailable:d,refreshing:T.isPending,onRefresh:O}}),children:(0,X.jsxs)(`div`,{ref:g.workspaceRef,"data-slot":`gh-workspace`,"data-stacked":g.panesStacked,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-3 md:h-[calc(var(--gh-workspace-height,calc(100dvh-4rem))-1rem)] md:flex-none md:gap-5`,children:[(0,X.jsxs)(`header`,{"data-slot":`gh-header`,className:`flex shrink-0 flex-col gap-3 bg-background md:gap-4`,children:[(0,X.jsx)(Jt,{view:e,isDesktop:s,gh:l,onSaveView:f}),(0,X.jsx)(Yt,{view:e,gh:l,filters:y,labelOptions:A,labelColors:k,searchPayload:x.searchPayload})]}),(0,X.jsxs)(`div`,{"data-slot":`gh-panes`,className:`flex min-h-0 min-w-0 flex-1 flex-col items-start gap-[22px] md:flex-row md:items-stretch md:overflow-hidden`,children:[(0,X.jsx)(Qt,{view:e,n:r,rows:N,verdict:P,search:x,sidebar:b,list:c,paging:D,width:g.githubListWidth,onWidthChange:g.changeGithubListWidth,expanded:_,onExpandedChange:v}),(0,X.jsx)(an,{view:e,n:r,selected:M,selectedNumber:S.selectedNumber,exact:C,repo:l.repo,rows:N,listPath:ne,changes:t,handToAgent:p})]})]})})}function Bt({index:e,isDesktop:t,rawFilterParam:n,n:r,rememberedView:i}){return{filterScreen:e&&!t&&n===null&&r===void 0,restorePrs:e&&t&&n===null&&i===`prs`}}function Vt(){let e=x();return t=>{e.setQueryData(o.uiState,e=>({...e,githubView:t})),_({githubView:t}).then(t=>e.setQueryData(o.uiState,t)).catch(t=>{S(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:o.uiState})})}}function Ht(e){let[t,n]=(0,J.useState)(Xe),[r,i]=(0,J.useState)(!0),a=(0,J.useRef)(null),o=(0,J.useRef)(null);return(0,J.useEffect)(()=>{if(!e)return;let n=a.current,r=o.current,s=n?.closest(`[data-slot="main"]`);if(!n||!r||!s)return;let c=window.matchMedia(`(min-width: 768px)`),l=!1,u=()=>{if(l=c.matches&&r.clientWidth>=t+22+360,i(!l),!l||s.clientHeight<1){n.style.removeProperty(`--gh-workspace-height`);return}n.style.setProperty(`--gh-workspace-height`,`${Math.round(s.clientHeight)}px`)};u();let d=new ResizeObserver(u);d.observe(s),d.observe(r);let f=e=>{if(!l||e.ctrlKey||!e.deltaY||Math.abs(e.deltaX)>Math.abs(e.deltaY)||r.getBoundingClientRect().top<=s.getBoundingClientRect().top+1||!(e.target instanceof Element)||!e.target.closest(`[data-slot="gh-panes"]`))return;e.preventDefault();let t=e.deltaMode===1?16:e.deltaMode===2?s.clientHeight:1;s.scrollTop+=e.deltaY*t};return r.addEventListener(`wheel`,f,{passive:!1}),c.addEventListener(`change`,u),()=>{r.removeEventListener(`wheel`,f),d.disconnect(),c.removeEventListener(`change`,u)}},[e,t]),{githubListWidth:t,changeGithubListWidth:e=>{let t=Y(e);n(t),Ze(t)},panesStacked:r,routeRef:a,workspaceRef:o}}function Ut(e,t,n,r){return{labelColors:{...t?.labelColors,...e.labelColors},labelOptions:He([...n,...r,...t?.items??[]])}}function Wt({number:e,items:t,searchHits:n,fullList:r,filterRows:i,remoteDetail:a,exactDetail:o}){return e===null?t[0]??n[0]??null:r.find(t=>t.number===e)??i?.find(t=>t.number===e)??a??o??null}function Gt(e,t,n,r){let i=t===null?null:n;return{linkFilter:i,listPath:we(e,i??(e===`issues`&&!r?`all`:null))}}function Kt(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,X.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,X.jsx)(P,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):null,r.message]}):n?i?(0,X.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(P,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,t.trim(),`”…`]}):a?c.length>0?(0,X.jsxs)(`p`,{role:`status`,children:[`Showing previous results. GitHub could not be refreshed: `,o,`. Use Refresh to try again.`]}):u.length>0?(0,X.jsxs)(`p`,{children:[`GitHub could not be searched: `,o,`.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,` match your filter, and GitHub could not be searched: `,o,`.`]}):s?(0,X.jsxs)(`p`,{role:`status`,children:[`Cannot apply the selected filters to GitHub results: `,s]}):c.length>0?null:l?.truncated?(0,X.jsx)(`p`,{children:`No matches within GitHub’s first matches. Narrow your search to check more specific results.`}):l&&u.length>0?(0,X.jsxs)(`p`,{children:[`No additional `,d,` match your filter on GitHub.`]}):l?(0,X.jsxs)(`p`,{children:[`No `,d,` match your filter — open, closed or merged.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,` match your filter.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,`.`]})}function qt({reason:e,refreshing:t,onRetry:n}){return(0,X.jsx)(W,{route:`github`,density:`empty`,children:(0,X.jsx)(G,{icon:(0,X.jsx)(T,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:e??`unknown reason`,actions:(0,X.jsx)(F,{variant:`outline`,"data-action":`gh-retry`,disabled:t,onClick:n,children:`Try again`}),children:(0,X.jsxs)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[`The tab needs the `,(0,X.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,X.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in Squawk works without it.`]})})})}function Jt({view:e,isDesktop:t,gh:n,onSaveView:r}){return(0,X.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`flex min-h-11 flex-wrap items-center gap-3`,children:[(0,X.jsxs)(Je,{to:t?`/github`:`/github?filter=all`,active:e===`issues`,onClick:()=>r(`issues`),children:[`Issues · `,n.issuesTotal??n.issues.length]}),(0,X.jsxs)(Je,{to:`/github/prs`,active:e===`prs`,onClick:()=>r(`prs`),children:[`Pull requests · `,n.prsTotal??n.prs.length]})]})}function Yt({view:e,gh:t,filters:n,labelOptions:r,labelColors:i,searchPayload:a}){return(0,X.jsxs)(`div`,{"data-slot":`gh-filter-toolbar`,className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`div`,{className:`relative min-w-0 basis-full md:flex-1 md:basis-auto`,children:[(0,X.jsx)(E,{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,X.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,X.jsx)(cn,{options:r,colors:i,selected:n.labelFilter,onChange:n.setLabelFilter}),e===`issues`?(0,X.jsx)(ct,{data:{...t,issues:[...t.issues,...a?.items??[]]},assignees:n.effectiveAssignees,projectId:n.activeProject,onAssigneesChange:n.changeAssignees,onProjectChange:n.setProjectFilter}):null,(0,X.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 Xt(e,t){return e.kind===`pr`?t?.[e.number]??e.checks:e.checks}function Zt(e,t){return(0,X.jsx)(pt,{item:e,view:t.view,filter:t.filter,colors:t.colors,active:t.selected?.url===e.url,queued:t.queued.has(e.url),checks:Xt(e,t.checksMap),comments:t.commentsOf(e)})}function Qt({view:e,n:t,rows:n,verdict:r,search:i,sidebar:a,list:o,paging:s,width:c,onWidthChange:l,expanded:u,onExpandedChange:d}){let{items:f,searchHits:p}=i,m=e===`issues`&&t!==void 0&&!u;return(0,X.jsxs)(`section`,{ref:s.setListEl,"data-slot":`gh-list`,"data-mobile-preview":m||void 0,style:{"--github-list-width":`${c}px`},className:`relative flex w-full min-h-0 min-w-0 flex-col rounded-lg border border-card-edge bg-card shadow-card p-3 md:w-[var(--github-list-width)] md:shrink-0 md:overflow-x-hidden md:overflow-y-auto`,children:[f.length===0?r&&(0,X.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-muted-foreground`,children:r}):(0,X.jsx)($t,{items:f,rows:n,compactPreview:m,paging:s}),s.pagingAvailable?(0,X.jsx)(en,{view:e,list:o,paging:s}):null,(0,X.jsx)(tn,{backedQuery:a.backedQuery,filterSearch:a.filterSearch}),(0,X.jsx)(nn,{view:e,n:t,count:f.length,expanded:u,onExpandedChange:d}),f.length>0&&i.searchWanted&&r?(0,X.jsx)(`div`,{"data-slot":`gh-search-status`,role:`status`,className:`px-4 py-4 text-sm text-muted-foreground`,children:r}):null,p.length>0?(0,X.jsx)(rn,{hits:p,searchPayload:i.searchPayload,rows:n}):null,(0,X.jsx)(Rt,{width:c,onWidthChange:l})]})}function $t({items:e,rows:t,compactPreview:n,paging:r}){let{setRowsEl:i,scrollOwner:a,listEl:o,scrollOwnerRef:s,startMargin:c}=r,l=e.map((e,r)=>(0,X.jsx)(`div`,{role:`listitem`,"data-slot":`gh-row-item`,"data-divided":r>0||void 0,"data-compact-hidden":n&&r>=2&&t.selected?.url!==e.url||void 0,children:Zt(e,t)},e.url));return(0,X.jsx)(`div`,{ref:i,"data-slot":`gh-rows`,"data-virtualized":a?`true`:void 0,role:`list`,children:a?(0,X.jsx)(Me,{scrollRef:s,startMargin:c,children:l},a===o?`list`:`main`):l})}function en({view:e,list:t,paging:n}){return(0,X.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,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(P,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Loading more…`]}):t.isFetchNextPageError?(0,X.jsxs)(X.Fragment,{children:[`Could not load more.`,(0,X.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,X.jsxs)(X.Fragment,{children:[`Filters cover the loaded `,e===`issues`?`issues`:`pull requests`,`.`,(0,X.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 tn({backedQuery:e,filterSearch:t}){return e!==null&&t.data?.available&&t.data.truncated?(0,X.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 nn({view:e,n:t,count:n,expanded:r,onExpandedChange:i}){return e===`issues`&&t!==void 0&&n>2?(0,X.jsx)(F,{variant:`outline`,className:`mt-2 self-start md:hidden`,"data-slot":`gh-expand-list`,"aria-expanded":r,onClick:()=>i(e=>!e),children:r?`Show fewer issues`:`View all ${n} issues`}):null}function rn({hits:e,searchPayload:t,rows:n}){return(0,X.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,X.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,X.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:e.map(e=>(0,X.jsx)(`li`,{children:Zt(e,n)},e.url))})]})}function an({view:e,n:t,selected:n,selectedNumber:i,exact:a,repo:o,rows:s,listPath:c,changes:l,handToAgent:u}){let{exactWanted:d,exactItem:f}=a;return(0,X.jsx)(`section`,{"data-slot":`gh-detail`,className:r(`w-full min-w-0 min-h-0 flex-1 flex-col rounded-lg border border-card-edge bg-card shadow-card md:overflow-y-auto`,t===void 0?`hidden md:flex`:`flex`),children:n?(0,X.jsx)(on,{item:n,n:t,repo:o,rows:s,listPath:c,changes:l,handToAgent:u}):d&&f.isPending?(0,X.jsx)(`div`,{"data-slot":`gh-detail-loading`,className:`flex min-h-full flex-1 flex-col`,children:(0,X.jsx)(G,{icon:(0,X.jsx)(P,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:`h2`,title:`Loading #${i}…`,subtitle:`It is not among the open items, so the tab is asking GitHub for it.`})}):d&&(f.isError||f.data?.available===!1)?(0,X.jsx)(sn,{number:i,exact:a}):(0,X.jsx)(ft,{view:e,number:i})})}function on({item:e,n:t,repo:n,rows:r,listPath:i,changes:a,handToAgent:o}){let{workflows:s,skillList:c,workflow:l,setWorkflow:u,selectedSkills:d,setSelectedSkills:f,engine:p,setEngine:m,queued:h,onQueued:g}=o;return(0,X.jsx)(We,{item:e,comments:r.commentsOf(e),afterHeading:e.kind===`issue`?(0,X.jsx)(Qe,{number:e.number,repo:n},t??`list`):void 0,backLink:{to:i},subNav:{filter:r.filter,changes:a},onRunAgent:bt,headerAction:(0,X.jsx)(yt,{item:e,queuedRunId:h.get(e.url)??null}),colors:r.colors,checks:Xt(e,r.checksMap),children:(0,X.jsx)(Ue,{item:e,workflows:s.data?.workflows??[],skills:c,workflow:l,onWorkflowChange:u,selectedSkills:d,onSkillsChange:f,engine:p,onEngineChange:m,queuedRunId:h.get(e.url)??null,onQueued:g},e.url)})}function sn({number:e,exact:t}){let{exactItem:n,retryingExact:r,retryExact:i}=t;return(0,X.jsx)(G,{icon:(0,X.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,X.jsx)(F,{variant:`outline`,disabled:r,onClick:i,children:`Retry`})})}function cn({options:e,colors:t,selected:n,onChange:i}){let[a,o]=(0,J.useState)(!1),s=e=>i(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,X.jsxs)(V,{open:a,onOpenChange:o,children:[(0,X.jsx)(z,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:r(`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,X.jsx)(A,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-muted-foreground`})]})}),(0,X.jsx)(B,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,X.jsxs)(me,{children:[(0,X.jsx)(ue,{placeholder:`Filter labels…`}),(0,X.jsxs)(pe,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,X.jsx)(fe,{children:`No labels.`}),n.length>0?(0,X.jsxs)(de,{value:`__clear__`,onSelect:()=>i([]),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,X.jsxs)(de,{value:e,onSelect:()=>s(e),className:`min-h-11`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:ze(t[e])}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,X.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e)})]})]})})]})}export{zt as GithubRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r,p as i}from"./dist-C_rn70hE.js";import{M as a,Wt as o,cn as s,dn as c,i as l,k as u,l as d,o as f,r as p,s as m}from"./queries-ByqTmyCs.js";import{An as h,G as g,I as _,K as v,Si as y,U as b,hi as x,n as S,q as C}from"./toaster-Lf_4oY96.js";import{h as ee}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{F as w,I as T,X as E,Y as D,c as O,ct as k,l as A,ot as j,p as M,r as te}from"./design-icons-CzEoMH9c.js";import{t as ne}from"./chevron-down-CHGyCDBH.js";import{t as N}from"./chevron-right-BENZ-1ZN.js";import{t as P}from"./loader-circle-CPBhhDbB.js";import{t as re}from"./play-CmVAj_fu.js";import{t as F}from"./button-C8jUIs8Q.js";import{a as I,i as L,n as ie,r as R,t as ae}from"./select-CRYap6qE.js";import{i as z,r as B,t as V}from"./popover-CVo54-aS.js";import{r as oe,t as H}from"./project-router-CEnizJ8F.js";import"./attention-CnhIF76m.js";import{f as se,v as ce}from"./task-groups-BRrlyl5P.js";import{t as le}from"./status-dot-BXf-Ubd0.js";import{a as ue,o as de,r as fe,s as pe,t as me}from"./command-DuxcX6Hr.js";import{d as he,s as U,u as W}from"./page-shell-CpdYMj52.js";import{t as G}from"./centered-state-BgSV4e79.js";import{t as ge}from"./use-search-params-writer-ClMScnNe.js";import{An as _e,Ct as ve,Dt as ye,Et as be,Ot as xe,Pn as Se,Qt as Ce,Sn as K,St as we,Tt as Te,_t as Ee,bt as De,gt as Oe,ht as ke,r as Ae,s as je,st as Me,vt as Ne,wt as Pe,xt as Fe,yt as Ie,zn as Le}from"./index-Cmj0hLCQ.js";import{a as Re,d as ze,f as Be,i as Ve,l as He,n as Ue,o as We,r as Ge,s as Ke,t as qe,u as q}from"./use-hand-to-agent-state-BE2hugZT.js";import{t as Je}from"./tab-link-3A_SF95U.js";var J=e(t(),1),Ye=`cez-github-list-width`;function Y(e){if(e==null||e===``||typeof e==`string`&&e.trim()===``)return 360;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(520,Math.max(280,Math.round(t))):360}function Xe(){try{let e=localStorage.getItem(Ye);return e===null?360:Y(e)}catch{return 360}}function Ze(e){try{localStorage.setItem(Ye,String(Y(e)))}catch{}}var X=n();function Qe({number:e,repo:t}){let n=i();return(0,X.jsx)($e,{number:e,repo:t,scope:n},JSON.stringify([n,t,e]))}function $e({number:e,repo:t,scope:n}){let i=(0,J.useId)(),o=(0,J.useId)(),[c,l]=(0,J.useState)(!1),u=c?ne:N,d=s(n,!0,n==="default"),f=a(`#${e}`,!0),p=(0,J.useMemo)(()=>Te(ce(d.data??[],f.data?.pages.flatMap(e=>e.runs)??[]),e,t,n),[d.data,f.data,e,t,n]);return(0,X.jsxs)(`section`,{"aria-labelledby":i,className:r(`mt-4 min-w-0 rounded-lg border border-border`,c?`p-3`:`p-0.5`),children:[(0,X.jsx)(`h3`,{id:i,className:`text-xs font-semibold text-muted-foreground`,children:(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":c,"aria-controls":o,onClick:()=>l(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,X.jsx)(u,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,X.jsxs)(`span`,{children:[`Linked tasks`,d.data?` (${p.length}${f.hasNextPage||f.isError?`+`:``})`:``]})]})}),(0,X.jsx)(`div`,{id:o,children:c?(0,X.jsxs)(X.Fragment,{children:[d.isPending?(0,X.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-muted-foreground`,children:`Loading linked tasks…`}):null,d.isError?(0,X.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`p`,{role:`status`,children:`Couldn’t load linked tasks. Check your connection and try again.`}),(0,X.jsx)(F,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void d.refetch(),disabled:d.isFetching,children:`Retry linked tasks`})]}):null,d.data&&p.length===0&&!d.isError?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`No linked tasks yet.`}):null,p.length>0?(0,X.jsx)(`ul`,{className:`mt-2 flex flex-col gap-1`,children:p.map(e=>{let t=_e(e,h(e));return(0,X.jsx)(`li`,{children:(0,X.jsxs)(H,{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,X.jsx)(`span`,{className:`text-sm font-medium break-words [overflow-wrap:anywhere]`,children:se(e)}),(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(le,{tone:t.tone,shape:t.shape,pulse:t.pulse,role:`img`,"aria-label":t.label,title:t.label}),e.archived?(0,X.jsx)(Ae,{"data-slot":`linked-task-archived`,dot:K.tone,shape:K.shape,className:`px-2 py-px`,children:K.label}):null,(0,X.jsx)(`time`,{dateTime:e.createdAt,children:new Date(e.createdAt).toLocaleDateString()})]})]})},e.id)})}):null,f.isError?(0,X.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`p`,{role:`status`,children:`Couldn’t load older archived linked tasks.`}),(0,X.jsx)(F,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void f.refetch(),disabled:f.isFetching,children:`Retry older linked tasks`})]}):f.hasNextPage?(0,X.jsx)(F,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void f.fetchNextPage(),disabled:f.isFetchingNextPage,children:f.isFetchingNextPage?`Loading older linked tasks…`:`Show older linked tasks`}):null]}):null})]})}var et=`w-44 max-w-full`,Z=`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`,Q=`__all__`;function tt(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 nt(e,t){return!!e&&t.length===1&&t[0]?.toLowerCase()===e.toLowerCase()}function rt(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 it(e){return[e.viewerLogin?``:`GitHub login unavailable.`,rt(e)].filter(Boolean).join(` `)}function at({options:e,assignees:t,onAssigneesChange:n}){return(0,X.jsxs)(V,{children:[(0,X.jsx)(z,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:`${Z} inline-flex items-center gap-1.5`,disabled:e.length===0,children:[`Assignee`,t.length?` · ${t.length}`:``,(0,X.jsx)(A,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-muted-foreground`})]})}),(0,X.jsx)(B,{align:`start`,className:`w-64 max-w-[calc(100vw-2rem)] p-2`,children:(0,X.jsxs)(`fieldset`,{className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto`,children:[(0,X.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,X.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded px-2 hover:bg-muted`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>n(r?t.filter(t=>t.toLowerCase()!==e.toLowerCase()):[...t,e])}),(0,X.jsx)(`span`,{className:`break-all text-sm`,children:e})]},e.toLowerCase())})]})})]})}function ot({data:e,projectId:t,onProjectChange:n,pickerRef:r}){if(e.projects?.length)return(0,X.jsxs)(ae,{value:t||Q,onValueChange:e=>n(e===Q?``:e),children:[(0,X.jsx)(L,{ref:r,"aria-label":`Project board`,"data-slot":`gh-board-filter`,"data-value":t,className:`${Z} ${et} justify-between`,children:(0,X.jsx)(I,{placeholder:`All boards`})}),(0,X.jsxs)(ie,{align:`start`,children:[(0,X.jsx)(R,{value:Q,children:`All boards`}),e.projects.map(e=>(0,X.jsx)(R,{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,X.jsxs)(ae,{disabled:!0,value:Q,children:[(0,X.jsx)(L,{ref:r,"aria-label":`Project board`,"data-slot":`gh-board-filter`,"data-value":``,className:`${Z} ${et} justify-between`,children:(0,X.jsx)(I,{placeholder:t,children:t})}),(0,X.jsx)(ie,{align:`start`,children:(0,X.jsx)(R,{value:Q,children:t})})]})}return null}function st({data:e,message:t,lastMessage:n,hasMessage:r,statusOpen:i,setStatusOpen:a,triggerRef:o,contentRef:s}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{role:`status`,className:`sr-only`,children:t}),(0,X.jsxs)(V,{open:i,onOpenChange:a,children:[(0,X.jsx)(z,{asChild:!0,children:(0,X.jsx)(`button`,{ref:o,type:`button`,className:`${Z} inline-flex items-center justify-center ${t?``:`invisible`}`,"aria-label":`Project board status`,tabIndex:t?void 0:-1,children:e.projectsState===`refreshing`?(0,X.jsx)(D,{size:14,"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):(0,X.jsx)(j,{size:14,"aria-hidden":`true`,className:`size-3.5`})})}),(0,X.jsx)(B,{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 ct({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=tt(e.issues,t),f=nt(e.viewerLogin,t),p=it(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,X.jsxs)(`div`,{className:`contents`,"data-slot":`gh-issue-filters`,children:[(0,X.jsx)(at,{options:d,assignees:t,onAssigneesChange:r}),(0,X.jsxs)(`button`,{ref:u,type:`button`,"data-slot":`gh-assigned-me`,className:`${Z} inline-flex items-center gap-1.5 rounded-full aria-pressed:border-foreground aria-pressed:bg-foreground aria-pressed:text-background`,disabled:!e.viewerLogin,"aria-pressed":f,onClick:()=>r(f?[]:[e.viewerLogin]),children:[(0,X.jsx)(k,{size:14,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`Assigned to me`]}),(0,X.jsx)(ot,{data:e,projectId:n,onProjectChange:i,pickerRef:l}),(0,X.jsx)(st,{data:e,message:p,lastMessage:h,hasMessage:m,statusOpen:a,setStatusOpen:o,triggerRef:s,contentRef:c})]})}function lt({onRefresh:e,refreshing:t}){let n=ke(i());return(0,X.jsx)(W,{route:`github`,density:`full`,headerSpacing:`compact`,header:{title:`GitHub`,secondaryActions:(0,X.jsx)(U,{type:`button`,variant:`ghost`,"data-slot":`gh-screen-refresh`,"aria-label":`Refresh from GitHub`,title:`Refresh from GitHub`,disabled:t,onClick:e,children:(0,X.jsx)(D,{size:17,"aria-hidden":`true`,className:r(`size-[17px]`,t&&`motion-safe:animate-spin`)})})},children:(0,X.jsx)(`div`,{"data-slot":`github-filter-screen`,children:(0,X.jsx)(Oe,{model:n,variant:`screen`})})})}function ut({view:e,activeFilter:t,isDesktop:n,rawFilterParam:r,n:i,gh:a,actions:o}){return{headerSlot:`gh-masthead`,title:n?e===`issues`?`Issues`:`Pull requests`:`GitHub`,scope:n?Ee[t]:void 0,scopeSlot:`gh-title-qualifier`,subtitle:a.repo?(0,X.jsxs)(`span`,{className:`block min-w-0 truncate`,children:[(0,X.jsx)(`span`,{"data-slot":`gh-repo`,children:a.repo}),(0,X.jsxs)(`span`,{"data-slot":`gh-synced`,title:a.syncedAt?new Date(a.syncedAt).toLocaleString():void 0,children:[` `,`· `,a.syncedAt?(0,X.jsx)(Se,{iso:a.syncedAt,prefix:`Synced `}):`Not synced yet`]})]}):void 0,secondaryActions:(0,X.jsx)(dt,{...o}),headerExtra:r!==null&&i===void 0?(0,X.jsxs)(`div`,{"data-slot":`gh-filter-context`,className:`mt-1 flex min-w-0 items-center gap-3 md:hidden`,children:[(0,X.jsxs)(H,{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,X.jsx)(te,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to filters`]}),t===`all`?null:(0,X.jsx)(`span`,{"data-slot":`gh-active-filter`,className:`truncate text-xs text-muted-foreground`,children:[...Ie,...De].find(e=>e.id===t)?.label})]}):void 0}}function dt({automationsAvailable:e,refreshing:t,onRefresh:n}){return(0,X.jsxs)(`div`,{"data-slot":`gh-page-actions`,className:`flex shrink-0 flex-wrap items-center gap-2`,children:[e?(0,X.jsx)(U,{variant:`outline`,asChild:!0,children:(0,X.jsx)(H,{to:`/automations/new`,children:`Set up automations`})}):null,(0,X.jsxs)(U,{type:`button`,variant:`outline`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:t,onClick:n,children:[(0,X.jsx)(D,{size:16,"aria-hidden":`true`,className:r(`size-3.5`,t&&`motion-safe:animate-spin`)}),`Refresh`]})]})}function ft({view:e,number:t}){return(0,X.jsx)(G,{icon:e===`issues`?(0,X.jsx)(M,{size:16}):(0,X.jsx)(w,{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`}. Search for ${t} above to look it up on GitHub, closed and merged included.`})}function pt({item:e,view:t,filter:n,colors:i,active:a,queued:s,checks:c,comments:l}){let u=e.kind===`issue`?M:w,d=x(),f=()=>{d.prefetchQuery({queryKey:o.githubComments(e.kind,e.number),queryFn:({signal:t})=>v(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,X.jsxs)(H,{to:we(t,n,e.number),draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,Ge(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:f,onFocus:f,"data-slot":`gh-row`,"data-number":e.number,"data-kind":e.kind,"aria-current":a?`page`:void 0,title:`Drag into the composer to prefill a task`,className:r(`flex flex-col gap-2 rounded-md px-3 py-4 transition-colors hover:bg-muted`,a&&`bg-accent-strong/10 text-accent-text`),children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 md:items-center`,children:[(0,X.jsx)(u,{"aria-hidden":`true`,"data-slot":`gh-row-icon`,className:r(`mt-0.5 size-3.5 shrink-0 md:mt-0`,e.kind===`issue`?`text-success`:`text-accent-icon`)}),(0,X.jsx)(`span`,{"data-slot":`gh-row-title`,className:r(`line-clamp-2 min-w-0 text-[13px] font-medium md:block md:truncate`,a&&`font-semibold`),children:e.title})]}),(0,X.jsxs)(`span`,{"data-slot":`gh-row-meta`,className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 pl-[22px] text-xs text-muted-foreground md:flex-nowrap md:gap-y-0`,children:[(0,X.jsxs)(`span`,{className:`shrink-0 tabular-nums`,children:[`#`,e.number]}),(0,X.jsx)($,{}),(0,X.jsx)(`span`,{"data-slot":`gh-row-author`,className:`max-w-full shrink-0 truncate md:min-w-0 md:shrink`,children:e.author}),(0,X.jsx)($,{}),(0,X.jsx)(Se,{iso:e.createdAt,className:`shrink-0`}),l?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{}),(0,X.jsx)(Re,{count:l})]}):null,c?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{}),(0,X.jsx)(Ve,{checks:c})]}):null,s?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{}),(0,X.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`shrink-0 font-sans font-medium text-accent-text`,children:`↗ run queued`})]}):null]}),e.labels.length>0?(0,X.jsx)(`span`,{"data-slot":`gh-row-labels`,className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,X.jsx)(Ke,{label:e,color:i[e],plain:!0},e))}):null]})}function $(){return(0,X.jsx)(`span`,{"data-slot":`gh-row-dot`,"aria-hidden":`true`,className:`shrink-0`,children:`·`})}function mt(e){let t=getComputedStyle(e).overflowY;return t===`auto`||t===`scroll`?e:e.closest(`[data-slot="main"]`)??e}function ht(e){let[t,n]=(0,J.useState)(null);return(0,J.useLayoutEffect)(()=>{if(!e){n(null);return}let t=()=>n(mt(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 gt(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 _t(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 vt(e,t,n,r,i){let[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(null),l=ht(a),u=(0,J.useRef)(null);u.current=l;let d=gt(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:_t(p&&!i&&!t.isFetchingNextPage&&!t.isFetchNextPageError,l,()=>void t.fetchNextPage())}}function yt({item:e,queuedRunId:t}){return t?(0,X.jsx)(F,{asChild:!0,variant:`outline`,size:`sm`,className:`max-md:h-11 no-hover:h-11`,children:(0,X.jsxs)(H,{to:`/tasks/${t}`,"data-action":`gh-header-view-task`,children:[(0,X.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5 text-success`}),`Open queued task`]})}):(0,X.jsxs)(F,{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`}`,className:`max-md:h-11 no-hover:h-11`,onClick:bt,children:[(0,X.jsx)(re,{"aria-hidden":`true`,className:`size-3.5`}),`Hand to agent`]})}function bt(){let e=document.querySelector(`[data-slot="gh-detail-inner"] [data-slot="gh-custom-prompt"]`);e?.scrollIntoView({block:`center`}),e?.focus({preventScroll:!0})}var xt=100;function St(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>=xt)break;a.add(t.number)}return[...a]}function Ct(e,t,n,r,i,a){let o=St(n,e,r,i,a),s=p(o,e===`prs`),c=s.data?.available?s.data.checks:void 0,u=l(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),d=(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=>u[e.number]??(d.has(e.number)?void 0:e.comments)}}function wt(e){let[t,n]=ge(),r=t.get(`filter`),i=be(e,r);return{rawFilterParam:r,filter:i,activeFilter:i??`all`,setFilterParam:e=>n(t=>{let n=new URLSearchParams(t);return e===null?n.delete(`filter`):n.set(`filter`,e),n})}}function Tt(e,t,{filter:n,activeFilter:r,setFilterParam:i}){let[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)([]),[l,u]=(0,J.useState)([]),{setProjectFilter:d,activeProject:f}=Et(t),p=e===`issues`&&r===`assigned`,m=p?t?.viewerLogin?[t.viewerLogin]:[]:l;return{query:a,setQuery:o,labelFilter:s,setLabelFilter:c,setProjectFilter:d,activeProject:f,isAssignedFilter:p,effectiveAssignees:m,changeAssignees:e=>{u(e),p&&i(`all`)},clearFilters:()=>{o(``),c([]),u([]),d(``),n!==null&&n!==`all`&&i(`all`)},filtering:a.trim()!==``||s.length>0||e===`issues`&&(m.length>0||f!==``)||n!==null&&n!==`all`,narrowing:a.trim()!==``||s.length>0||e===`issues`&&(!p&&l.length>0||f!==``)}}function Et(e){let[t,n]=(0,J.useState)(``),r=e?.projectsState===`refreshing`||e?.projectsState===`unavailable`,i=r||e?.projects?.some(e=>e.id===t)?t:``;return(0,J.useEffect)(()=>{e&&!r&&t&&!i&&n(``)},[e,t,i,r]),{setProjectFilter:n,activeProject:i}}function Dt(e,t,{filter:n,activeFilter:r},a){let o=i(),c=e===`issues`&&(r===`no-task`||r===`has-task`),l=s(o,c,o==="default"),u=(0,J.useMemo)(()=>l.data?Pe(l.data,t?.repo,o):null,[l.data,t?.repo,o]),f=ve(e,n)?xe(n):null,p=d(`pr`,f??``,f!==null&&t?.available===!0),m=f!==null&&p.data?.available?p.data.items:null,h=(0,J.useMemo)(()=>t?.available?e===`issues`?t.issues:t.prs:[],[t,e]),g=(0,J.useMemo)(()=>m?ye(m,h):null,[m,h]),_=Ot({view:e,gh:t,activeFilter:r,isAssignedFilter:a,taskFilter:c,taskNumbers:u,runsQuery:l,backedQuery:f,filterHits:m,filterSearch:p});return{backedQuery:f,filterSearch:p,fullList:h,filterRows:g,filterGate:_,openItems:(0,J.useMemo)(()=>_?[]:g??h,[_,g,h]),narrow:(0,J.useMemo)(()=>e===`issues`?r===`no-task`&&u?{excludeNumbers:u}:r===`has-task`&&u?{includeNumbers:u}:{}:r===`mine`&&t?.viewerLogin?{author:t.viewerLogin}:m?{includeNumbers:new Set(m.map(e=>e.number))}:{},[e,r,u,t?.viewerLogin,m])}}function Ot({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 kt(e,t){return t?C(t.kind,t.number,{refresh:!0}).then(n=>(e.setQueryData(t.key,n),!0)).catch(()=>!1):Promise.resolve(!0)}function At(e,t,n,{filterGate:r,filterRows:i,fullList:a}){let s=o.github()[0],c=t===void 0?null:Number.parseInt(t,10),l=!r&&n.data?.available?n.data.items.find(e=>e.number===c):void 0,u=i&&c!==null&&!a.some(e=>e.number===c)?i.find(e=>e.number===c):void 0,d=l??u,[f,p]=(0,J.useState)(null);return(0,J.useEffect)(()=>{d&&p({scope:s,view:e,item:d})},[s,e,d]),{selectedNumber:c,remoteDetail:d??(f?.scope===s&&f.view===e&&f.item.number===c?f.item:null)}}function jt(e,t,n,{fullList:r,filterRows:i},a){let s=x(),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,d=f(l,n??0,u),p=u&&d.data?.available&&d.data.item?.kind===l?d.data.item:null;c.current=u&&n!==null?{kind:l,number:n,key:o.githubItem(l,n)}:null;let[m,h]=(0,J.useState)(!1);return{exactWanted:u,exactItem:d,exactDetail:p,exactTargetRef:c,retryingExact:m,retryExact:()=>{h(!0),kt(s,c.current).then(e=>{h(!1),e||S(`Could not reach GitHub for #${n}`,{tone:`danger`})})}}}function Mt(e,t,n){let r=x(),i=(0,J.useRef)(null);return{refresh:c({mutationFn:e=>(kt(r,e),b({refresh:!0,limit:50})),onSuccess:async a=>{await r.cancelQueries({queryKey:o.githubPages(50),exact:!0}),r.setQueryData(o.githubPages(50),{pages:[a],pageParams:[{}]}),r.invalidateQueries({queryKey:o.githubChecks(t)});let s=e===`issues`?`issue`:`pr`,c=(e===`issues`?a.issues:a.prs).map(e=>e.number),l=o.githubCommentCounts(s,c);r.removeQueries({queryKey:o.githubCommentCounts(s,[]).slice(0,4),predicate:e=>e.queryHash!==y(l)}),a.available&&a.commentsDeferred&&c.length>0&&g(s,c,{refresh:!0}).then(e=>r.setQueryData(l,e)).catch(()=>{}),r.invalidateQueries({queryKey:o.githubSearch(e===`issues`?`issue`:`pr`,n)}),r.invalidateQueries({queryKey:o.githubSearch(`pr`,Fe)}),r.invalidateQueries({queryKey:o.githubSearch(`pr`,Ne)});let u=i.current,d=o.githubComments(`issue`,0).slice(0,3);if(!u){r.removeQueries({queryKey:d});return}let f=o.githubComments(u.kind,u.number);v(u.kind,u.number,{refresh:!0}).then(e=>r.setQueryData(f,e)).catch(()=>{}),r.removeQueries({queryKey:d,predicate:e=>e.queryHash!==y(f)})},onError:e=>S(e.message,{tone:`danger`})}),openThreadRef:i}}var Nt=350;function Pt(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 Ft(e,t,{query:n,labelFilter:r,effectiveAssignees:i,activeProject:a},{openItems:o,narrow:s,filterGate:c}){let l=Pt(n,Nt),u=(0,J.useMemo)(()=>q(o,{query:l,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),[o,l,r,e,i,a,s]),f=n.trim()===l.trim(),p=t?.available===!0&&!c&&f&&Be(l,u),m=d(e===`issues`?`issue`:`pr`,l,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=It(e,g,a,i);return{debouncedQuery:l,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)):[],...Lt(n,f,p,m)}}function It(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 Lt(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 Rt({width:e,onWidthChange:t}){let n=(0,J.useRef)(null),r=t=>{t.button===0&&(n.current={x:t.clientX,width:e},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),t.currentTarget.focus())},i=e=>{let r=n.current;r&&t(Y(r.width+(e.clientX-r.x)))},a=e=>{n.current&&(n.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,X.jsx)(`div`,{"data-slot":`gh-list-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the GitHub list`,"aria-valuenow":e,"aria-valuemin":280,"aria-valuemax":520,tabIndex:0,onPointerDown:r,onPointerMove:i,onPointerUp:a,onPointerCancel:a,onKeyDown:n=>{let r=n.key===`ArrowLeft`?e-16:n.key===`ArrowRight`?e+16:n.key===`Home`?280:n.key===`End`?520:null;r!==null&&(n.preventDefault(),t(Y(r)))},onDoubleClick:()=>t(360),title:`Drag to resize the GitHub list — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 hidden w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-accent-strong/40 focus-visible:bg-accent-strong/60 focus-visible:outline-none md:block`})}function zt({view:e,changes:t=!1,index:n=!1}){let{n:r}=ee(),i=wt(e),{rawFilterParam:a,activeFilter:o}=i,s=Ce(),{pages:c,data:l}=m(50),d=Le(),f=Vt(),p=qe(),h=Bt({index:n,isDesktop:s,rawFilterParam:a,n:r,rememberedView:u().data?.githubView}),g=Ht(l?.available===!0&&!h.filterScreen),[_,v]=(0,J.useState)(!1),y=Tt(e,l,i),b=Dt(e,l,i,y.isAssignedFilter),x=Ft(e,l,y,b),S=At(e,r,x.forgeSearch,b),C=jt(e,l,S.selectedNumber,b,S.remoteDetail),w=Ct(e,c,l,S.selectedNumber,x.searchHits,b.openItems),{refresh:T,openThreadRef:E}=Mt(e,w.checkPrNumbers,x.debouncedQuery),D=vt(e,c,l,b.backedQuery,y.narrowing);if(h.restorePrs)return(0,X.jsx)(oe,{to:`/github/prs`,replace:!0});if(!l)return c.isError?(0,X.jsx)(W,{route:`github`,density:`empty`,children:(0,X.jsx)(G,{icon:(0,X.jsx)(j,{size:16}),tone:`danger`,title:`Could not load GitHub`,subtitle:c.error.message})}):(0,X.jsx)(Me,{});E.current=null;let O=()=>T.mutate(C.exactTargetRef.current);if(h.filterScreen&&l.available)return(0,X.jsx)(lt,{onRefresh:O,refreshing:T.isPending});if(!l.available)return(0,X.jsx)(qt,{reason:l.reason,refreshing:T.isPending,onRetry:O});let{labelColors:k,labelOptions:A}=Ut(l,x.searchPayload,b.openItems,b.fullList),M=Wt({number:S.selectedNumber,items:x.items,searchHits:x.searchHits,fullList:b.fullList,filterRows:b.filterRows,remoteDetail:S.remoteDetail,exactDetail:C.exactDetail});E.current=M?{kind:M.kind,number:M.number}:null;let{linkFilter:te,listPath:ne}=Gt(e,a,o,s),N={view:e,filter:te,colors:k,selected:M,queued:p.queued,checksMap:w.checksMap,commentsOf:w.commentsOf},P=Kt(e,y,b.filterGate,x),re=he(x.items.length+x.searchHits.length);return(0,X.jsx)(W,{rootRef:g.routeRef,route:`github`,density:re,headerSpacing:`compact`,className:`pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-4`,bodyClassName:`gap-2.5`,header:ut({view:e,activeFilter:o,isDesktop:s,rawFilterParam:a,n:r,gh:l,actions:{automationsAvailable:d,refreshing:T.isPending,onRefresh:O}}),children:(0,X.jsxs)(`div`,{ref:g.workspaceRef,"data-slot":`gh-workspace`,"data-stacked":g.panesStacked,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-3 md:h-[calc(var(--gh-workspace-height,calc(100dvh-4rem))-1rem)] md:flex-none md:gap-5`,children:[(0,X.jsxs)(`header`,{"data-slot":`gh-header`,className:`flex shrink-0 flex-col gap-3 bg-background md:gap-4`,children:[(0,X.jsx)(Jt,{view:e,isDesktop:s,gh:l,onSaveView:f}),(0,X.jsx)(Yt,{view:e,gh:l,filters:y,labelOptions:A,labelColors:k,searchPayload:x.searchPayload})]}),(0,X.jsxs)(`div`,{"data-slot":`gh-panes`,className:`flex min-h-0 min-w-0 flex-1 flex-col items-start gap-[22px] md:flex-row md:items-stretch md:overflow-hidden`,children:[(0,X.jsx)(Qt,{view:e,n:r,rows:N,verdict:P,search:x,sidebar:b,list:c,paging:D,width:g.githubListWidth,onWidthChange:g.changeGithubListWidth,expanded:_,onExpandedChange:v}),(0,X.jsx)(an,{view:e,n:r,selected:M,selectedNumber:S.selectedNumber,exact:C,repo:l.repo,rows:N,listPath:ne,changes:t,handToAgent:p})]})]})})}function Bt({index:e,isDesktop:t,rawFilterParam:n,n:r,rememberedView:i}){return{filterScreen:e&&!t&&n===null&&r===void 0,restorePrs:e&&t&&n===null&&i===`prs`}}function Vt(){let e=x();return t=>{e.setQueryData(o.uiState,e=>({...e,githubView:t})),_({githubView:t}).then(t=>e.setQueryData(o.uiState,t)).catch(t=>{S(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:o.uiState})})}}function Ht(e){let[t,n]=(0,J.useState)(Xe),[r,i]=(0,J.useState)(!0),a=(0,J.useRef)(null),o=(0,J.useRef)(null);return(0,J.useEffect)(()=>{if(!e)return;let n=a.current,r=o.current,s=n?.closest(`[data-slot="main"]`);if(!n||!r||!s)return;let c=window.matchMedia(`(min-width: 768px)`),l=!1,u=()=>{if(l=c.matches&&r.clientWidth>=t+22+360,i(!l),!l||s.clientHeight<1){n.style.removeProperty(`--gh-workspace-height`);return}n.style.setProperty(`--gh-workspace-height`,`${Math.round(s.clientHeight)}px`)};u();let d=new ResizeObserver(u);d.observe(s),d.observe(r);let f=e=>{if(!l||e.ctrlKey||!e.deltaY||Math.abs(e.deltaX)>Math.abs(e.deltaY)||r.getBoundingClientRect().top<=s.getBoundingClientRect().top+1||!(e.target instanceof Element)||!e.target.closest(`[data-slot="gh-panes"]`))return;e.preventDefault();let t=e.deltaMode===1?16:e.deltaMode===2?s.clientHeight:1;s.scrollTop+=e.deltaY*t};return r.addEventListener(`wheel`,f,{passive:!1}),c.addEventListener(`change`,u),()=>{r.removeEventListener(`wheel`,f),d.disconnect(),c.removeEventListener(`change`,u)}},[e,t]),{githubListWidth:t,changeGithubListWidth:e=>{let t=Y(e);n(t),Ze(t)},panesStacked:r,routeRef:a,workspaceRef:o}}function Ut(e,t,n,r){return{labelColors:{...t?.labelColors,...e.labelColors},labelOptions:He([...n,...r,...t?.items??[]])}}function Wt({number:e,items:t,searchHits:n,fullList:r,filterRows:i,remoteDetail:a,exactDetail:o}){return e===null?t[0]??n[0]??null:r.find(t=>t.number===e)??i?.find(t=>t.number===e)??a??o??null}function Gt(e,t,n,r){let i=t===null?null:n;return{linkFilter:i,listPath:we(e,i??(e===`issues`&&!r?`all`:null))}}function Kt(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,X.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,X.jsx)(P,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):null,r.message]}):n?i?(0,X.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(P,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,t.trim(),`”…`]}):a?c.length>0?(0,X.jsxs)(`p`,{role:`status`,children:[`Showing previous results. GitHub could not be refreshed: `,o,`. Use Refresh to try again.`]}):u.length>0?(0,X.jsxs)(`p`,{children:[`GitHub could not be searched: `,o,`.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,` match your filter, and GitHub could not be searched: `,o,`.`]}):s?(0,X.jsxs)(`p`,{role:`status`,children:[`Cannot apply the selected filters to GitHub results: `,s]}):c.length>0?null:l?.truncated?(0,X.jsx)(`p`,{children:`No matches within GitHub’s first matches. Narrow your search to check more specific results.`}):l&&u.length>0?(0,X.jsxs)(`p`,{children:[`No additional `,d,` match your filter on GitHub.`]}):l?(0,X.jsxs)(`p`,{children:[`No `,d,` match your filter — open, closed or merged.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,` match your filter.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,`.`]})}function qt({reason:e,refreshing:t,onRetry:n}){return(0,X.jsx)(W,{route:`github`,density:`empty`,children:(0,X.jsx)(G,{icon:(0,X.jsx)(T,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:e??`unknown reason`,actions:(0,X.jsx)(F,{variant:`outline`,"data-action":`gh-retry`,disabled:t,onClick:n,children:`Try again`}),children:(0,X.jsxs)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[`The tab needs the `,(0,X.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,X.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in Squawk works without it.`]})})})}function Jt({view:e,isDesktop:t,gh:n,onSaveView:r}){return(0,X.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`flex min-h-11 flex-wrap items-center gap-3`,children:[(0,X.jsxs)(Je,{to:t?`/github`:`/github?filter=all`,active:e===`issues`,onClick:()=>r(`issues`),children:[`Issues · `,n.issuesTotal??n.issues.length]}),(0,X.jsxs)(Je,{to:`/github/prs`,active:e===`prs`,onClick:()=>r(`prs`),children:[`Pull requests · `,n.prsTotal??n.prs.length]})]})}function Yt({view:e,gh:t,filters:n,labelOptions:r,labelColors:i,searchPayload:a}){return(0,X.jsxs)(`div`,{"data-slot":`gh-filter-toolbar`,className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`div`,{className:`relative min-w-0 basis-full md:flex-1 md:basis-auto`,children:[(0,X.jsx)(E,{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,X.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,X.jsx)(cn,{options:r,colors:i,selected:n.labelFilter,onChange:n.setLabelFilter}),e===`issues`?(0,X.jsx)(ct,{data:{...t,issues:[...t.issues,...a?.items??[]]},assignees:n.effectiveAssignees,projectId:n.activeProject,onAssigneesChange:n.changeAssignees,onProjectChange:n.setProjectFilter}):null,(0,X.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 Xt(e,t){return e.kind===`pr`?t?.[e.number]??e.checks:e.checks}function Zt(e,t){return(0,X.jsx)(pt,{item:e,view:t.view,filter:t.filter,colors:t.colors,active:t.selected?.url===e.url,queued:t.queued.has(e.url),checks:Xt(e,t.checksMap),comments:t.commentsOf(e)})}function Qt({view:e,n:t,rows:n,verdict:r,search:i,sidebar:a,list:o,paging:s,width:c,onWidthChange:l,expanded:u,onExpandedChange:d}){let{items:f,searchHits:p}=i,m=e===`issues`&&t!==void 0&&!u;return(0,X.jsxs)(`section`,{ref:s.setListEl,"data-slot":`gh-list`,"data-mobile-preview":m||void 0,style:{"--github-list-width":`${c}px`},className:`relative flex w-full min-h-0 min-w-0 flex-col rounded-lg border border-card-edge bg-card shadow-card p-3 md:w-[var(--github-list-width)] md:shrink-0 md:overflow-x-hidden md:overflow-y-auto`,children:[f.length===0?r&&(0,X.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-muted-foreground`,children:r}):(0,X.jsx)($t,{items:f,rows:n,compactPreview:m,paging:s}),s.pagingAvailable?(0,X.jsx)(en,{view:e,list:o,paging:s}):null,(0,X.jsx)(tn,{backedQuery:a.backedQuery,filterSearch:a.filterSearch}),(0,X.jsx)(nn,{view:e,n:t,count:f.length,expanded:u,onExpandedChange:d}),f.length>0&&i.searchWanted&&r?(0,X.jsx)(`div`,{"data-slot":`gh-search-status`,role:`status`,className:`px-4 py-4 text-sm text-muted-foreground`,children:r}):null,p.length>0?(0,X.jsx)(rn,{hits:p,searchPayload:i.searchPayload,rows:n}):null,(0,X.jsx)(Rt,{width:c,onWidthChange:l})]})}function $t({items:e,rows:t,compactPreview:n,paging:r}){let{setRowsEl:i,scrollOwner:a,listEl:o,scrollOwnerRef:s,startMargin:c}=r,l=e.map((e,r)=>(0,X.jsx)(`div`,{role:`listitem`,"data-slot":`gh-row-item`,"data-divided":r>0||void 0,"data-compact-hidden":n&&r>=2&&t.selected?.url!==e.url||void 0,children:Zt(e,t)},e.url));return(0,X.jsx)(`div`,{ref:i,"data-slot":`gh-rows`,"data-virtualized":a?`true`:void 0,role:`list`,children:a?(0,X.jsx)(je,{scrollRef:s,startMargin:c,children:l},a===o?`list`:`main`):l})}function en({view:e,list:t,paging:n}){return(0,X.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,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(P,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Loading more…`]}):t.isFetchNextPageError?(0,X.jsxs)(X.Fragment,{children:[`Could not load more.`,(0,X.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,X.jsxs)(X.Fragment,{children:[`Filters cover the loaded `,e===`issues`?`issues`:`pull requests`,`.`,(0,X.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 tn({backedQuery:e,filterSearch:t}){return e!==null&&t.data?.available&&t.data.truncated?(0,X.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 nn({view:e,n:t,count:n,expanded:r,onExpandedChange:i}){return e===`issues`&&t!==void 0&&n>2?(0,X.jsx)(F,{variant:`outline`,className:`mt-2 self-start md:hidden`,"data-slot":`gh-expand-list`,"aria-expanded":r,onClick:()=>i(e=>!e),children:r?`Show fewer issues`:`View all ${n} issues`}):null}function rn({hits:e,searchPayload:t,rows:n}){return(0,X.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,X.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,X.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:e.map(e=>(0,X.jsx)(`li`,{children:Zt(e,n)},e.url))})]})}function an({view:e,n:t,selected:n,selectedNumber:i,exact:a,repo:o,rows:s,listPath:c,changes:l,handToAgent:u}){let{exactWanted:d,exactItem:f}=a;return(0,X.jsx)(`section`,{"data-slot":`gh-detail`,className:r(`w-full min-w-0 min-h-0 flex-1 flex-col rounded-lg border border-card-edge bg-card shadow-card md:overflow-y-auto`,t===void 0?`hidden md:flex`:`flex`),children:n?(0,X.jsx)(on,{item:n,n:t,repo:o,rows:s,listPath:c,changes:l,handToAgent:u}):d&&f.isPending?(0,X.jsx)(`div`,{"data-slot":`gh-detail-loading`,className:`flex min-h-full flex-1 flex-col`,children:(0,X.jsx)(G,{icon:(0,X.jsx)(P,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:`h2`,title:`Loading #${i}…`,subtitle:`It is not among the open items, so the tab is asking GitHub for it.`})}):d&&(f.isError||f.data?.available===!1)?(0,X.jsx)(sn,{number:i,exact:a}):(0,X.jsx)(ft,{view:e,number:i})})}function on({item:e,n:t,repo:n,rows:r,listPath:i,changes:a,handToAgent:o}){let{workflows:s,skillList:c,workflow:l,setWorkflow:u,selectedSkills:d,setSelectedSkills:f,engine:p,setEngine:m,queued:h,onQueued:g}=o;return(0,X.jsx)(We,{item:e,comments:r.commentsOf(e),afterHeading:e.kind===`issue`?(0,X.jsx)(Qe,{number:e.number,repo:n},t??`list`):void 0,backLink:{to:i},subNav:{filter:r.filter,changes:a},onRunAgent:bt,headerAction:(0,X.jsx)(yt,{item:e,queuedRunId:h.get(e.url)??null}),colors:r.colors,checks:Xt(e,r.checksMap),children:(0,X.jsx)(Ue,{item:e,workflows:s.data?.workflows??[],skills:c,workflow:l,onWorkflowChange:u,selectedSkills:d,onSkillsChange:f,engine:p,onEngineChange:m,queuedRunId:h.get(e.url)??null,onQueued:g},e.url)})}function sn({number:e,exact:t}){let{exactItem:n,retryingExact:r,retryExact:i}=t;return(0,X.jsx)(G,{icon:(0,X.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,X.jsx)(F,{variant:`outline`,disabled:r,onClick:i,children:`Retry`})})}function cn({options:e,colors:t,selected:n,onChange:i}){let[a,o]=(0,J.useState)(!1),s=e=>i(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,X.jsxs)(V,{open:a,onOpenChange:o,children:[(0,X.jsx)(z,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:r(`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,X.jsx)(A,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-muted-foreground`})]})}),(0,X.jsx)(B,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,X.jsxs)(me,{children:[(0,X.jsx)(ue,{placeholder:`Filter labels…`}),(0,X.jsxs)(pe,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,X.jsx)(fe,{children:`No labels.`}),n.length>0?(0,X.jsxs)(de,{value:`__clear__`,onSelect:()=>i([]),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,X.jsxs)(de,{value:e,onSelect:()=>s(e),className:`min-h-11`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:ze(t[e])}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,X.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e)})]})]})})]})}export{zt as GithubRoute};