@hearsay-tools/squawk 0.19.0-dev.9172 → 0.19.0-dev.9180
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ci-wait/controller.d.ts +7 -7
- package/dist/contract/hosts.d.ts +925 -0
- package/dist/contract/index.js +104 -2
- package/dist/core/server-hook-registry.d.ts +13 -0
- package/dist/core/server-hook-registry.js.map +1 -1
- package/dist/delegation/routes.d.ts +78 -78
- package/dist/features/hosts/admission.d.ts +52 -0
- package/dist/features/hosts/admission.js +89 -0
- package/dist/features/hosts/admission.js.map +1 -0
- package/dist/features/hosts/gateway.d.ts +14 -3
- package/dist/features/hosts/gateway.js +35 -21
- package/dist/features/hosts/gateway.js.map +1 -1
- package/dist/features/hosts/index.d.ts +7 -3
- package/dist/features/hosts/index.js +41 -7
- package/dist/features/hosts/index.js.map +1 -1
- package/dist/features/hosts/registry-reconciler.d.ts +41 -0
- package/dist/features/hosts/registry-reconciler.js +168 -0
- package/dist/features/hosts/registry-reconciler.js.map +1 -0
- package/dist/features/hosts/routes.d.ts +414 -48
- package/dist/features/hosts/routes.js +72 -62
- package/dist/features/hosts/routes.js.map +1 -1
- package/dist/features/hosts/runs-index-events.d.ts +23 -0
- package/dist/features/hosts/runs-index-events.js +116 -0
- package/dist/features/hosts/runs-index-events.js.map +1 -0
- package/dist/features/hosts/runs-index-patch.d.ts +203 -0
- package/dist/features/hosts/runs-index-patch.js +798 -0
- package/dist/features/hosts/runs-index-patch.js.map +1 -0
- package/dist/features/hosts/runs-index.d.ts +149 -0
- package/dist/features/hosts/runs-index.js +762 -0
- package/dist/features/hosts/runs-index.js.map +1 -0
- package/dist/features/hosts/runs-search.d.ts +28 -0
- package/dist/features/hosts/runs-search.js +151 -0
- package/dist/features/hosts/runs-search.js.map +1 -0
- package/dist/features/hosts/supervisor.d.ts +4 -0
- package/dist/features/hosts/supervisor.js +14 -6
- package/dist/features/hosts/supervisor.js.map +1 -1
- package/dist/features/reports/routes.d.ts +2 -2
- package/dist/features/webhooks/routes.d.ts +38 -38
- package/dist/plugin/index.d.ts +1 -1
- package/dist/plugin/index.js.map +1 -1
- package/dist/server/activity-routes.d.ts +23 -23
- package/dist/server/models-routes.d.ts +12 -12
- package/dist/server/project-settings-routes.d.ts +107 -107
- package/dist/server/projects-routes.d.ts +41 -41
- package/dist/server/provider-sign-in-routes.d.ts +2 -2
- package/dist/server/providers-routes.d.ts +58 -58
- package/dist/server/runner-install-routes.d.ts +10 -10
- package/dist/server/runners-routes.d.ts +10 -10
- package/dist/server/runs-routes.d.ts +344 -344
- package/dist/server/server.d.ts +1195 -1195
- package/dist/server/server.js +7 -1
- package/dist/server/server.js.map +1 -1
- package/dist/server/workspace-identity-routes.d.ts +5 -5
- package/dist/server/workspace-live-routes.d.ts +5 -5
- package/dist/server/workspace-routes.d.ts +85 -85
- package/dist/server/workspace-run-feed.d.ts +4 -0
- package/dist/server/workspace-run-feed.js +13 -0
- package/dist/server/workspace-run-feed.js.map +1 -1
- package/package.json +4 -4
- package/scripts/benchmark-hosts-runs-index-probes.ts +242 -0
- package/scripts/benchmark-hosts-runs-index.ts +776 -0
- package/web/dist/assets/accounts-section-BDUoikVg.js +1 -0
- package/web/dist/assets/activity-motion-CYdEr0hu.js +1 -0
- package/web/dist/assets/{activity-route-C2zP5vVV.js → activity-route-D8BPLoZj.js} +1 -1
- package/web/dist/assets/{agent-accounts-D_ZKAmaW.js → agent-accounts-C2ILQhZy.js} +1 -1
- package/web/dist/assets/{agent-config-section-CwK_izpU.js → agent-config-section-BO8w2cry.js} +2 -2
- package/web/dist/assets/agent-defaults-section-BBcv7Vbh.js +1 -0
- package/web/dist/assets/{appearance-DvoRcoRX.js → appearance-yF_NXlq5.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-DWPtF9dh.js → archive-on-merge-field-Dh1M21D6.js} +1 -1
- package/web/dist/assets/{ask-card-D-om0EtP.js → ask-card-2E9m5VRA.js} +1 -1
- package/web/dist/assets/attention-C7BUdd2s.js +1 -0
- package/web/dist/assets/automations-route-D27bK2j6.js +2 -0
- package/web/dist/assets/{commit-list-CPJLP4DU.js → commit-list-sFxchD2V.js} +1 -1
- package/web/dist/assets/{diff-BQJN6jzN.js → diff-C5-32cRp.js} +2 -2
- package/web/dist/assets/{diff-controls-AsSX7gfO.js → diff-controls-Ci36iPlK.js} +1 -1
- package/web/dist/assets/{diff-view-BW5bbiaq.js → diff-view-CCtuYJNL.js} +1 -1
- package/web/dist/assets/{discard-changes-dialog-Bv4yc0N1.js → discard-changes-dialog-BACqR1hj.js} +1 -1
- package/web/dist/assets/{file-preview-CnrFxbea.js → file-preview-B7T7jFYo.js} +1 -1
- package/web/dist/assets/{folder-browser-CFd1U5hn.js → folder-browser-3cBLlnE9.js} +1 -1
- package/web/dist/assets/{git-toolbar-C7iolhIi.js → git-toolbar-UkRnjuDs.js} +1 -1
- package/web/dist/assets/github-CkbZgMnJ.js +1 -0
- package/web/dist/assets/{global-activity-route-Dijwg4OL.js → global-activity-route-j37l-BQU.js} +1 -1
- package/web/dist/assets/hosts-iUyg8S3j.js +1 -0
- package/web/dist/assets/index-DkQ5xrLr.js +21 -0
- package/web/dist/assets/{label-CgU9vxuM.js → label-CWlxyeC-.js} +1 -1
- package/web/dist/assets/{markdown-Cljq4S1h.js → markdown-FIfZPsax.js} +1 -1
- package/web/dist/assets/{open-in-menu-BI7mnPPf.js → open-in-menu-Bf8JA2DJ.js} +1 -1
- package/web/dist/assets/{option-select-BcTkv-7t.js → option-select-DylfDjGi.js} +1 -1
- package/web/dist/assets/{preferences-section-CEKXGhEj.js → preferences-section-DjWfc1i-.js} +1 -1
- package/web/dist/assets/{preview-EtD19mg1.js → preview-BSFJfN4s.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-CKRBfx7t.js → preview-pane-connected-CfiPFvTH.js} +2 -2
- package/web/dist/assets/{project-location-hufc_p8y.js → project-location-CEX0-MZp.js} +1 -1
- package/web/dist/assets/{project-router-Dc6KBQsv.js → project-router-CwD1firw.js} +1 -1
- package/web/dist/assets/{projects-section-vOFZ4lbx.js → projects-section-Czmf0wFK.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-Caash2nq.js → prompt-templates-section-DK4CV73w.js} +1 -1
- package/web/dist/assets/queries-D9mg7sFY.js +1 -0
- package/web/dist/assets/{read-state-BeVNfGkB.js → read-state-BsTfJki5.js} +1 -1
- package/web/dist/assets/{reference-chip-BjerVjzM.js → reference-chip-CZKBU_Ud.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-fNgh5LdN.js → remote-settings-notice-Dott-jyP.js} +1 -1
- package/web/dist/assets/repo-git-Djt3N2wP.js +1 -0
- package/web/dist/assets/{report-reader-CK1WDtEH.js → report-reader-CrdDix7Z.js} +1 -1
- package/web/dist/assets/{report-selection-CZ8eb9QP.js → report-selection-Y2F9NTAs.js} +1 -1
- package/web/dist/assets/{reports-B-GImLAo.js → reports-Iw4LUvz2.js} +1 -1
- package/web/dist/assets/{resources-section-ApF3gXrw.js → resources-section-D3wUzdUQ.js} +1 -1
- package/web/dist/assets/{review-notes-drafts-BdjEFs1G.js → review-notes-drafts-xyC7GvRB.js} +1 -1
- package/web/dist/assets/{review-panel-D4zmYH8O.js → review-panel-3x_2lbej.js} +1 -1
- package/web/dist/assets/{review-strip-BpHXklAn.js → review-strip-CDYpq9_S.js} +1 -1
- package/web/dist/assets/{run-detail-refresh-CE0vyYYA.js → run-detail-refresh-SYZM94ch.js} +1 -1
- package/web/dist/assets/{run-diff-ClfLRsHF.js → run-diff-D26PXp6r.js} +1 -1
- package/web/dist/assets/run-header-DZ0rkryR.js +2 -0
- package/web/dist/assets/{select-CwDhRDtw.js → select-DC_G2no3.js} +1 -1
- package/web/dist/assets/{session-context-section-C87jx7RB.js → session-context-section-DEUv-ISr.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-Dk8yJ57U.js → settings-agent-picker-BrFN2RaQ.js} +1 -1
- package/web/dist/assets/{settings-save-bar-cu8BKCGT.js → settings-save-bar-C0pFHqte.js} +1 -1
- package/web/dist/assets/{settings-shell-mhQfQKf1.js → settings-shell-BWWbVxv-.js} +1 -1
- package/web/dist/assets/{sidebar-section-DOQ5N1L6.js → sidebar-section-BGo1zjJt.js} +1 -1
- package/web/dist/assets/{skills-DXJ1gQBD.js → skills-qFMQz6sm.js} +1 -1
- package/web/dist/assets/{status-dot-Bmn4xhch.js → status-dot-DTU7afRv.js} +1 -1
- package/web/dist/assets/{tab-link-6TltE1jl.js → tab-link-BJDe5cT4.js} +1 -1
- package/web/dist/assets/{task-changes-D9Sdmpmw.js → task-changes-DKJHAtKC.js} +2 -2
- package/web/dist/assets/{task-commits-A0UIqxpL.js → task-commits-Dtt60D0o.js} +1 -1
- package/web/dist/assets/{task-file-scope-ID220XKo.js → task-file-scope-FTt7SiGn.js} +1 -1
- package/web/dist/assets/{task-files-Id2tuAAG.js → task-files-DVz4222z.js} +1 -1
- package/web/dist/assets/{task-github-item-YKUcwp2o.js → task-github-item-CJpKQ6cU.js} +1 -1
- package/web/dist/assets/{task-groups-DCg4iOB9.js → task-groups-BvVfsQKd.js} +1 -1
- package/web/dist/assets/{task-thread-A_vkygGX.js → task-thread-DiYtqka4.js} +2 -2
- package/web/dist/assets/{thread-state-6-BzRrJ_.js → thread-state-pO7Wy_7R.js} +1 -1
- package/web/dist/assets/toaster-2ud_VdfV.js +4 -0
- package/web/dist/assets/{use-finish-run-DO-nnAaa.js → use-finish-run-5S30Eu3d.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-CADaL8U8.js → use-hand-to-agent-state-BB_VmbF7.js} +1 -1
- package/web/dist/assets/use-path-bases-npA-uKvg.js +1 -0
- package/web/dist/assets/use-workspace-config-save-DDI7_WtK.js +1 -0
- package/web/dist/assets/{workflows-DOLG-Rns.js → workflows-DLuBawpi.js} +2 -2
- package/web/dist/assets/{workspace-tools-DTCJVDTE.js → workspace-tools-D4jshe-2.js} +1 -1
- package/web/dist/assets/{worktrees-section-BOHDbywt.js → worktrees-section-CESTBOem.js} +5 -5
- package/web/dist/index.html +19 -19
- package/web/dist/assets/accounts-section-Bnr89jmC.js +0 -1
- package/web/dist/assets/activity-motion-BW0tAmYF.js +0 -1
- package/web/dist/assets/agent-defaults-section-RyEogH0g.js +0 -1
- package/web/dist/assets/attention-BI6592lk.js +0 -1
- package/web/dist/assets/automations-route-DfGE4xWT.js +0 -2
- package/web/dist/assets/github-DGElvfMU.js +0 -1
- package/web/dist/assets/hosts-CpDMDiQW.js +0 -1
- package/web/dist/assets/index-DPfg7xSB.js +0 -21
- package/web/dist/assets/queries-IlC9MZgh.js +0 -1
- package/web/dist/assets/repo-git-5MK_RAR6.js +0 -1
- package/web/dist/assets/run-header-BUe92WWr.js +0 -2
- package/web/dist/assets/toaster-DNnL8v10.js +0 -4
- package/web/dist/assets/use-path-bases-CFAmFn_E.js +0 -1
- package/web/dist/assets/use-workspace-config-save-DScW6_8J.js +0 -1
|
@@ -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{$t as r,Qt as i,en as a,g as o,in as s,k as c}from"./queries-D9mg7sFY.js";import{c as l}from"./host-context-DDbYAKpm.js";import{$n as u,Cn as d,H as f,Ir as p,Lr as m,Pr as h,Si as g,U as ee,V as _,W as v,_ as y,c as b,d as te,g as ne,o as re,s as ie,v as ae,xi as oe,zr as se}from"./toaster-2ud_VdfV.js";import{B as x,G as ce,H as S,I as C,K as le,N as w,P as T,V as ue,W as E,j as D,z as O}from"./live-protocol-CNUmr-VT.js";import{g as de,n as fe}from"./chunk-KS7C4IRE-BdLLx37K.js";import{r as pe,t as k}from"./label-CWlxyeC-.js";import{o as A}from"./dist-CCX8mhHc.js";import{L as me,X as he,Z as ge,b as _e,ft as ve,ht as ye,nt as be,ot as xe,u as Se}from"./design-icons-QbNMZniQ.js";import{t as Ce}from"./check-OP-CVgZG.js";import{t as j}from"./button-BV_AiLj2.js";import{n as we,r as Te,t as Ee}from"./collapsible-D5i3hm2L.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-DC_G2no3.js";import{t as De}from"./switch-B9OfOEzC.js";import{c as Oe,s as ke,t as L}from"./project-router-CwD1firw.js";import{c as R,d as z,f as Ae,l as je,n as Me,o as Ne}from"./page-shell-BdjH5hyc.js";import{a as Pe}from"./agent-accounts-C2ILQhZy.js";import{r as Fe}from"./agents-settings-path-7X6_cvUg.js";import{t as Ie}from"./centered-state-N8vWM_Hw.js";import{$ as Le,Gn as Re,Kn as ze,M as Be,N as Ve,R as He,Sr as Ue,Tn as We,X as Ge,Z as Ke,ir as qe,j as Je,kn as Ye,lr as B,t as Xe}from"./index-DkQ5xrLr.js";import{t as Ze}from"./textarea-BGp28xFr.js";import{_ as Qe,a as $e,c as et,d as tt,f as nt,g as rt,h as it,i as at,l as ot,m as st,n as ct,o as lt,p as ut,r as dt,s as ft,t as V,u as pt,v as mt}from"./automation-format-jKMOXcHS.js";var H=e(t(),1),U=D([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),ht=x({includeExisting:T().optional(),authors:w(E()).optional(),assignees:w(E()).optional(),requireCurrentLabels:T().optional(),allLabels:w(E()).optional(),anyLabels:w(E()).optional(),excludeLabels:w(E()).optional(),changedLabels:w(E()).optional(),lookbackDays:O(),maxRecords:O()}),gt=D([`github`,`schedule`]),_t=h.omit({task:!0,images:!0,systemPrompt:!0}).extend({prompt:E(),variants:ce([C(1),C(2),C(3)]).optional(),systemPrompt:E().optional()}),vt=x({at:E(),outcome:D([`launched`,`cancelled`]),runId:E().optional(),receiptId:E().optional(),trigger:D([`schedule`,`late`,`manual`,`retry`]).optional()}),W=x({id:E(),revision:O(),name:E(),description:E().optional(),enabled:T(),kind:gt,events:w(U).optional(),intervalSeconds:O().optional(),filters:ht.optional(),schedule:et.optional(),task:_t,archived:vt.optional(),createdAt:E(),updatedAt:E()}),G=x({timestamp:E(),tieBreaker:E().optional()}),yt=x({since:E().datetime(),until:E().datetime(),source:O().int().min(0).max(2),page:O().int().min(1).max(10),item:O().int().min(0).max(100),event:O().int().min(0).max(1e3),cursor:G.optional()}),bt={lastError:E().max(1e3).optional(),lastErrorAt:E().datetime().optional()},xt=x({revision:O().optional(),baselineAt:E().optional(),armedAt:E().optional(),historyScan:yt.optional(),cursor:G.optional(),frozenHighWatermark:G.extend({tieBreaker:E()}).optional(),backlogAfter:G.extend({tieBreaker:E()}).optional(),nextCheckAt:E().optional(),lastSuccessAt:E().optional(),nextRunAt:E().optional(),lastRunAt:E().optional(),etags:S(E(),E()).optional(),backoffUntil:E().optional(),consecutiveFailures:O().optional(),...bt,onceOutcome:D([`failed`,`missed`]).optional()});function St(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 Ct=D([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]),wt=x({seq:O(),ts:E(),automationId:E(),revision:O(),event:U.optional(),result:Ct,reason:E().optional(),durationMs:O().optional(),receiptId:E().optional(),runId:E().optional(),githubNumber:O().optional(),githubTitle:E().optional(),githubUrl:E().optional(),rateLimit:x({bucket:D([`core`,`search`]),remaining:O().optional(),resetAt:E().optional()}).optional()}),Tt=x({matches:O(),launched:O(),duplicates:O(),errors:O()}),Et=W.extend({state:xt.optional(),latestLog:wt.optional(),counts:Tt,nextRunAt:E().optional(),onceStatus:ut.optional()});x({available:T(),reason:E().optional(),timeZone:E(),scheduler:x({state:D([`scheduled`,`idle`]),nextDue:E().optional()}),automations:w(Et)}),x({automation:W}).extend({once:x({dueAt:E(),timeZone:E(),resolvedInstant:E(),note:E()}).optional()}),x({automation:W,state:xt.optional(),latestLog:wt.optional(),onceStatus:ut.optional()}),x({id:E(),automationId:E(),mode:D([`preview`,`execute`]),status:D([`queued`,`running`,`complete`,`error`]),createdAt:E(),completedAt:E().optional(),matches:O().optional(),truncated:T().optional(),error:E().optional()}),x({checkId:E()}),x({records:w(wt)}),x({receiptId:E(),runId:E()}),x({runId:E()}),W.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0,kind:!0,archived:!0}).extend({kind:gt.optional(),task:_t.omit({variants:!0}).strict(),enable:T().optional()}).omit({enable:!0}).extend({enabled:T().optional(),expectedRevision:O()}),x({archived:D([`include`,`only`]).optional()}),x({mode:D([`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 Dt={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`},Ot={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 kt(e){let[t,n]=(0,H.useState)(),[r,i]=(0,H.useState)(``),a=(0,H.useCallback)(t=>y(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)(()=>u(a),[a]),(0,H.useEffect)(()=>pe((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function At(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 jt({records:e,all:t,timeZone:n,onRetried:r,readOnly:i=!1}){let a=e=>!i&&At(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 _(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)(qe,{dot:Dt[e.result],children:Ot[e.result]}),(0,K.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:ct(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 Mt({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 Nt({automationId:e,automationName:t,timeZone:n,readOnly:r=!1}){let{records:i,error:a,refresh:o}=kt(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)(je,{route:`automations`,density:i?Ae(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)(Mt,{label:`Result`,value:s,onChange:c,options:[{value:J,label:`All results`},...Ct.options.map(e=>({value:e,label:Ot[e]}))]}),f?(0,K.jsx)(Mt,{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)(jt,{records:d,all:i,timeZone:n,onRetried:()=>void o(),readOnly:r})]}):(0,K.jsx)(q,{text:`Loading execution log…`})})}function Pt({automationId:e,automationName:t,timeZone:n,showName:r=!1,readOnly:i=!1}){let{records:a,error:o,refresh:s}=kt(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)(jt,{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 Ft({automation:e,timeZone:t,onDeleted:n}){let r=e.archived,i=e.schedule,a=i?dt(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 te(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)(je,{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)(Pt,{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 It=D([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),Y=w(E().trim().min(1).max(200)).max(100).optional(),Lt=x({includeExisting:T().optional(),requireCurrentLabels:T().optional(),authors:Y,assignees:Y,allLabels:Y,anyLabels:Y,excludeLabels:Y,changedLabels:Y,lookbackDays:O().int().min(1).max(90).default(7),maxRecords:O().int().min(1).max(100).default(25)}).passthrough(),Rt=x({prompt:E().min(1).max(1e5),workflow:E().trim().min(1).max(200).optional(),steps:w(p).min(1).max(100).optional(),runner:oe.optional(),model:E().trim().min(1).max(200).optional(),effort:E().trim().min(1).max(32).optional(),variants:ce([C(1),C(2),C(3)]).optional(),worktree:T().optional(),autonomous:T().optional(),...m,...se,systemPrompt:E().max(1e5).optional()}).passthrough().refine(e=>!(e.workflow&&e.steps),{message:`task selects either a named workflow or inline steps, not both`}),zt=new Set(Object.keys(Rt.shape).filter(e=>e!==`variants`));function Bt(e){return Object.fromEntries(Object.entries(e).filter(([e])=>zt.has(e)))}ue(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??{}}},x({id:E().min(1).max(100),revision:O().int().positive(),name:E().trim().min(1).max(200),description:E().max(2e3).optional(),enabled:T().default(!1),kind:gt.default(`github`),events:w(It).min(1).max(4).optional(),intervalSeconds:O().int().min(60).max(86400).optional(),filters:Lt.optional(),schedule:et.passthrough().optional(),task:Rt,archived:x({at:E().datetime(),outcome:D([`launched`,`cancelled`]),runId:E().optional(),receiptId:E().optional(),trigger:D([`schedule`,`late`,`manual`,`retry`]).optional()}).passthrough().optional(),createdAt:E().datetime(),updatedAt:E().datetime()}).passthrough().superRefine((e,t)=>{if(e.kind===`schedule`){e.schedule||t.addIssue({code:g.custom,path:[`schedule`],message:`a scheduled automation needs a schedule`});return}e.events?.length||t.addIssue({code:g.custom,path:[`events`],message:`a GitHub automation needs at least one event`}),e.intervalSeconds===void 0&&t.addIssue({code:g.custom,path:[`intervalSeconds`],message:`a GitHub automation needs a poll interval`}),e.filters||t.addIssue({code:g.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:g.custom,path:[`filters`,`changedLabels`],message:`changedLabels is required for issue label events`})})),x({version:C(1).default(1),automations:w(le()).default([]),tombstones:S(E(),E().datetime()).optional()}).passthrough();var X=x({timestamp:E().datetime(),tieBreaker:E().optional()}).passthrough(),Vt=yt.extend({cursor:X.optional()}),Ht=x({revision:O().int().positive().optional(),baselineAt:E().datetime().optional(),armedAt:E().datetime().optional(),historyScan:Vt.optional(),cursor:X.optional(),frozenHighWatermark:X.extend({tieBreaker:E()}).optional(),backlogAfter:X.extend({tieBreaker:E()}).optional(),nextCheckAt:E().datetime().optional(),lastSuccessAt:E().datetime().optional(),nextRunAt:E().datetime().optional(),lastRunAt:E().datetime().optional(),etags:S(E(),E()).optional(),backoffUntil:E().datetime().optional(),consecutiveFailures:O().int().nonnegative().optional(),...bt,onceOutcome:D([`failed`,`missed`]).optional()}).passthrough();x({version:C(1).default(1),states:S(E(),Ht).default({})}).passthrough(),x({receiptId:E().min(1),receiptKey:E().min(1),eventId:E().min(1),automationId:E().min(1),revision:O().int().positive(),status:D([`reserved`,`launched`,`launch-error`,`released`]),runId:E().optional(),observedAt:E().datetime(),updatedAt:E().datetime(),error:E().max(2e3).optional(),occurrenceAt:E().datetime().optional(),candidate:x({eventId:E(),event:It,timestamp:E().datetime(),tieBreaker:E(),repo:E(),nodeId:E(),number:O().int().positive(),title:E().max(500),url:E().url(),author:E().max(200),assignees:w(E().max(200)).max(100),labels:w(E().max(200)).max(100),changedLabel:E().max(200).optional()}).passthrough().optional()}).passthrough();var Ut=D([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]);x({seq:O().int().positive(),ts:E().datetime(),automationId:E().min(1),revision:O().int().positive(),event:It.optional(),result:Ut,reason:E().max(2e3).optional(),durationMs:O().int().nonnegative().optional(),receiptId:E().optional(),runId:E().optional(),githubNumber:O().int().positive().optional(),githubTitle:E().max(500).optional(),githubUrl:E().url().optional(),rateLimit:x({bucket:D([`core`,`search`]),remaining:O().int().nonnegative().optional(),resetAt:E().datetime().optional()}).passthrough().optional()}).passthrough();var Wt=`quick-task`;function Gt(e={}){let{prompt:t,workflow:n,runner:r,model:i,autonomous:a,archiveWhenDone:o,autoMergePr:s,allowWorkers:c,allowMessaging:l,...u}=Bt(e.task??{prompt:``}),d=e.task===void 0;return{name:e.name??``,description:e.description??``,kind:e.kind??`schedule`,schedule:pt(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:Wt}:{}:{workflow:n},...r===void 0?{}:{runner:r},...i===void 0?{}:{model:i},autonomous:a??!0,archiveWhenDone:o??!1,autoMergePr:s??!1,allowWorkers:c!==!1,allowMessaging:l!==!1,enabled:e.enabled??e.enable??!1,taskExtra:u}}function Kt(e){switch(e.type){case`daily`:case`weekdays`:return{type:e.type,hour:e.hour,minute:e.minute};case`weekly`:return{type:`weekly`,hour:e.hour,minute:e.minute,day:e.day};case`hours`:return{type:`hours`,every:e.every};case`once`:return{type:`once`,at:e.at??``,timeZone:e.timeZone??``,...e.latestStartMinutes===void 0?{}:{latestStartMinutes:e.latestStartMinutes}}}}function qt(e){return{...e.taskExtra,prompt:e.prompt,...e.workflow?{workflow:e.workflow}:{},...e.runner?{runner:e.runner}:{},...e.model?{model:e.model}:{},autonomous:e.autonomous,...e.archiveWhenDone?{archiveWhenDone:!0}:{},...e.autoMergePr?{autoMergePr:!0}:{},...e.allowWorkers?{}:{allowWorkers:!1},...e.allowMessaging?{}:{allowMessaging:!1}}}function Jt(e){return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},kind:e.kind,...e.kind===`schedule`?{schedule:Kt(e.schedule)}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:qt(e)}}function Yt(e){return{...Jt(e),enable:e.enabled}}function Xt(e,t){return{...Jt(e),task:{...qt(e),archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging},enabled:e.enabled,expectedRevision:t}}function Z(e){return`'${e.replace(/'/g,`'\\''`)}'`}var Zt=new Set([`prompt`,`workflow`,`runner`,`model`,`autonomous`,`worktree`,`archiveWhenDone`,`autoMergePr`,`allowWorkers`,`allowMessaging`]),Qt=new Set([`anyLabels`,`authors`,`changedLabels`]);function $t(e){if(e.description!==void 0||!e.name.trim()||!e.task.prompt.trim())return!1;let t=e.task;if(Object.keys(t).some(e=>!Zt.has(e))||t.archiveWhenDone===!1||t.autoMergePr===!1||t.allowWorkers===!0||t.allowMessaging===!0||t.worktree!==!0)return!1;if(e.kind===`schedule`)return e.schedule!==void 0;let{events:n,filters:r}=e;return!n?.length||n.some(e=>e.includes(`,`))||!r||r.lookbackDays!==7||r.maxRecords!==25?!1:Object.entries(r).every(([e,t])=>e===`lookbackDays`||e===`maxRecords`||e===`includeExisting`&&t===!0||Qt.has(e)&&Array.isArray(t)&&t.length>0)}function en(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function tn(e){return e%1440==0?`${e/1440}d`:e%60==0?`${e/60}h`:`${e}m`}function Q(e,t){return t.startsWith(`-`)?`--${e}=${Z(t)}`:`--${e} ${Z(t)}`}function nn(e){let t=[`${We()} automation add`,Q(`name`,e.name)];if(e.schedule?.type===`once`)t.push(Q(`at`,e.schedule.at),Q(`tz`,e.schedule.timeZone)),e.schedule.latestStartMinutes!==void 0&&t.push(Q(`latest-start`,tn(e.schedule.latestStartMinutes)));else if(e.kind===`schedule`)t.push(Q(`cron`,ot(e.schedule)));else{t.push(Q(`on`,e.events.join(`,`)),`--every ${en(e.intervalSeconds??300)}`),e.filters?.includeExisting&&t.push(`--include-existing`);for(let n of e.filters?.anyLabels??[])t.push(Q(`label`,n));for(let n of e.filters?.authors??[])t.push(Q(`author`,n));for(let n of e.filters?.changedLabels??[])t.push(Q(`changed-label`,n))}return t.push(...rn(e.task)),e.enable===!0&&t.push(`--enable`),t.push(Q(`prompt`,e.task.prompt)),t.join(` `)}function rn(e){let t=[];return e.workflow&&t.push(Q(`workflow`,e.workflow)),e.runner&&t.push(Q(`runner`,e.runner)),e.model&&t.push(Q(`model`,e.model)),e.autonomous===!1&&t.push(`--no-autonomous`),e.archiveWhenDone&&t.push(`--archive-when-done`),e.autoMergePr&&t.push(`--auto-merge-pr`),e.allowWorkers===!1&&t.push(`--no-workers`),e.allowMessaging===!1&&t.push(`--no-messaging`),t}function an(e,t){let n=Yt(e),r=$t(n)?nn(n):`${We()} automation create --json ${Z(JSON.stringify(n))}`;return t?`CEZ_COCKPIT_URL=${Z(t.origin)} CEZ_PROJECT_ID=${Z(t.projectId)} HSQ_COCKPIT_URL=${Z(t.origin)} HSQ_PROJECT_ID=${Z(t.projectId)} ${r}`:r}function on(e){let t=[],n=!1;for(let r of sn(e)){let e=t.length-1;!n&&/^[A-Z_][A-Z0-9_]*=/.test(r)?t.push(r):r.startsWith(`--`)||!n?(t.push(r),n=!0):t[e]=`${t[e]} ${r}`}return t.map((e,t)=>t===0?e:` ${e}`).join(` \\
|
|
2
|
+
`)}function sn(e){let t=[],n=``,r=!1;for(let i=0;i<e.length;i+=1){let a=e[i];!r&&a===`\\`&&i+1<e.length?(n+=a+e[i+1],i+=1):a===`'`?(r=!r,n+=a):a===` `&&!r?(n&&t.push(n),n=``):n+=a}return n&&t.push(n),t}function cn({draft:e,saveLabel:t,editing:n}){let r=ke(),i=l(),a=window.location.origin,o=(0,H.useMemo)(()=>{let t=an(e);return r?`HSQ_COCKPIT_URL=${Z(a)} HSQ_PROJECT_ID=${Z(r)} ${t}`:t},[e,a,r]),s=(0,H.useMemo)(()=>on(o),[o]),[c,u]=(0,H.useState)(`idle`),[d,f]=(0,H.useState)(!1),p=(0,H.useId)(),m=(0,H.useRef)(void 0);if((0,H.useEffect)(()=>()=>clearTimeout(m.current),[]),(0,H.useEffect)(()=>u(`idle`),[o]),i)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.jsx)(`h2`,{id:`copy-as-cli-heading`,className:`text-[13px] font-medium text-muted-foreground`,children:`Copy as CLI`}),(0,K.jsx)(`p`,{"data-slot":`copy-as-cli-remote-note`,className:`mbs-2 text-xs break-words text-muted-foreground`,children:`Run automation CLI commands on that machine.`})]});let h=async()=>{clearTimeout(m.current);try{await navigator.clipboard.writeText(s),u(`copied`),m.current=setTimeout(()=>u(`idle`),1600)}catch{u(`failed`)}};return(0,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":d,"aria-controls":p,"aria-label":d?`Hide command`:`Show command`,className:`min-w-0 shrink gap-1 px-1.5 text-[12px] font-medium`,onClick:()=>f(e=>!e),children:[(0,K.jsx)(`span`,{className:`truncate`,children:d?`Hide`:`Show`}),(0,K.jsx)(Se,{"aria-hidden":`true`,className:A(`size-3.5 transition-transform`,d&&`rotate-180`)})]}),(0,K.jsxs)(j,{type:`button`,variant:`outline`,size:`sm`,className:`ms-auto gap-1.5 px-2 text-[12px] font-medium`,onClick:()=>void h(),children:[c===`copied`?(0,K.jsx)(Ce,{"aria-hidden":`true`,className:`size-3.5`}):(0,K.jsx)(Ue,{"aria-hidden":`true`,className:`size-3.5`}),c===`copied`?`Copied`:`Copy`]})]}),(0,K.jsx)(`div`,{id:p,hidden:!d,className:`mbs-2 max-w-full rounded-lg border border-border bg-muted has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-ring`,children:(0,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:s})}),(0,K.jsx)(`p`,{role:`status`,className:`mbs-2 text-xs break-words text-muted-foreground`,children:c===`failed`?`Could not copy — select the line and copy it by hand.`:(0,K.jsxs)(K.Fragment,{children:[`The definition ${t} would ${n?`save`:`create`}.`,` `,(0,K.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-px font-mono text-xs whitespace-nowrap text-foreground [word-spacing:-0.2em]`,children:`${We()} automation schema`}),` prints its shape.`]})})]})}function ln({pressed:e,onClick:t,disabled:n,children:r}){return(0,K.jsx)(`button`,{type:`button`,"aria-pressed":e,disabled:n,onClick:t,className:A(`inline-flex min-h-11 items-center justify-center rounded-md border px-3.5 text-[13px] font-medium transition-colors outline-hidden focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50`,e?`border-border bg-card font-semibold text-foreground shadow-xs`:`border-transparent bg-transparent text-muted-foreground hover:text-foreground`),children:r})}var un={"pull_request.opened":`a pull request opens`,"issue.opened":`an issue opens`,"issue.labeled":`an issue is labeled`,"issue.unlabeled":`an issue is unlabeled`},dn={"pull_request.opened":`Pull request opened`,"issue.opened":`Issue opened`,"issue.labeled":`Issue labeled`,"issue.unlabeled":`Issue unlabeled`};function fn(e){let t=e.map(e=>un[e]);if(t.length===0)return`When GitHub changes`;let n=t.slice(0,-1),r=t[t.length-1];return`When ${n.length>0?`${n.join(`, `)} or ${r}`:r}`}var pn=U.options,mn=[{seconds:60,label:`1 minute`},{seconds:300,label:`5 minutes`},{seconds:900,label:`15 minutes`},{seconds:1800,label:`30 minutes`},{seconds:3600,label:`1 hour`}],hn=[{key:`authors`,label:`Authors`},{key:`assignees`,label:`Assignees`},{key:`allLabels`,label:`Has all labels`},{key:`anyLabels`,label:`Has any label`},{key:`excludeLabels`,label:`Excludes labels`},{key:`changedLabels`,label:`Changed labels`,hint:`Required for the two label events.`}],gn=e=>(e??[]).join(`, `),_n=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function vn(e){return e?`Existing matches within the lookback are eligible on the next check. Previously processed matches will not run again.`:`Enabling starts from a current-time baseline. Existing matches will not launch tasks.`}function yn(e){let t=Math.max(1,Math.round(e.intervalSeconds/60));return`Polls GitHub every ${t} minute${t===1?``:`s`} for ${e.events.join(`, `)||`no events`}. ${vn(e.filters.includeExisting)}`}function bn({draft:e,onChange:t,disabledReason:n}){let r=n=>{t({events:e.events.includes(n)?e.events.filter(e=>e!==n):[...e.events,n]})},i=n=>t({filters:{...e.filters,...n}}),a=(n,r)=>{let i=_n(r),{[n]:a,...o}=e.filters;t({filters:i.length?{...o,[n]:i}:o})},o=mn.some(t=>t.seconds===e.intervalSeconds)?mn:[...mn,{seconds:e.intervalSeconds,label:`${Math.round(e.intervalSeconds/60)} minutes`}].sort((e,t)=>e.seconds-t.seconds);return(0,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:pn.map(t=>(0,K.jsx)(ln,{pressed:e.events.includes(t),onClick:()=>r(t),children:dn[t]},t))}),(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(k,{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)(De,{"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:vn(e.filters.includeExisting)})]}),(0,K.jsxs)(Ee,{children:[(0,K.jsxs)(Te,{className:`group flex min-h-11 items-center gap-2 text-sm font-medium`,children:[`Filters`,(0,K.jsx)(Se,{"aria-hidden":`true`,className:`size-4 text-soft-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-180`})]}),(0,K.jsx)(we,{children:(0,K.jsxs)(`div`,{className:`grid gap-4 pt-2 sm:grid-cols-2`,children:[hn.map(t=>(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,K.jsx)(k,{htmlFor:`automation-filter-${t.key}`,children:t.label}),(0,K.jsx)(B,{id:`automation-filter-${t.key}`,className:`border-border`,placeholder:`comma separated`,value:gn(e.filters[t.key]),onChange:e=>a(t.key,e.target.value)}),t.hint?(0,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)(k,{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)(k,{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 xn=e=>String(e).padStart(2,`0`);function Sn({label:e,value:t,max:n,onCommit:r}){let[i,a]=(0,H.useState)(xn(t)),o=(0,H.useRef)(null),s=!(/^\d{1,2}$/.test(i)&&Number(i)===t),c=`${e} must be 00–${xn(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(xn(t))}),s?(0,K.jsx)(`p`,{id:l,className:`order-last basis-full text-xs text-destructive`,children:c}):null]})}var Cn=[{minutes:void 0,label:`No limit`},{minutes:30,label:`30 minutes`},{minutes:120,label:`2 hours`},{minutes:360,label:`6 hours`},{minutes:1440,label:`1 day`},{minutes:10080,label:`7 days`}],wn=`none`,Tn=e=>String(e).padStart(2,`0`);function En(e,t=Date.now()){let n=mt(t,e)??mt(t,`UTC`),r=new Date(Date.UTC(n.year,n.month-1,n.day+1));return`${r.getUTCFullYear()}-${Tn(r.getUTCMonth()+1)}-${Tn(r.getUTCDate())}T09:00`}function Dn(){let e=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];return e.includes(`UTC`)?e:[`UTC`,...e]}function On({value:e,stored:t,onChange:n}){let r=t=>n({...e,...t}),i=e.at?st(e.at):null,a=e.at?.slice(0,10)??``,o=i?.hour??9,s=i?.minute??0,c=(e,t,n)=>r({at:`${e}T${Tn(t)}:${Tn(n)}`}),l=(0,H.useRef)(null),u=(0,H.useId)(),d=nt(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?$e:``)},[f]);let p=dt(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)(k,{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)(Sn,{label:`Hour`,value:o,max:23,onCommit:e=>c(a,e,s)}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,K.jsx)(Sn,{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:$e}):null,(0,K.jsx)(An,{value:e.timeZone??``,onCommit:e=>r({timeZone:e})}),(0,K.jsx)(jn,{value:e.latestStartMinutes,onChange:t=>n(kn(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 kn(e,t){let{latestStartMinutes:n,...r}=e;return t===void 0?r:{...r,latestStartMinutes:t}}function An({value:e,onCommit:t}){let[n,r]=(0,H.useState)(e),i=(0,H.useRef)(null),a=(0,H.useId)(),o=(0,H.useId)(),[s]=(0,H.useState)(Dn),c=n!==e||!Qe(n),l=rt(n);return(0,H.useEffect)(()=>{i.current?.setCustomValidity(c?l:``)},[c,l]),(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(k,{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),Qe(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 jn({value:e,onChange:t}){let n=Cn.some(t=>t.minutes===e)||e===void 0?Cn:[...Cn,{minutes:e,label:`${e} minutes`}];return(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(k,{htmlFor:`automation-once-latest`,children:`Latest start`}),(0,K.jsxs)(I,{value:e===void 0?wn:String(e),onValueChange:e=>t(e===wn?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?wn: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 Mn=[{type:`daily`,label:`Every day`},{type:`weekdays`,label:`Weekdays`},{type:`weekly`,label:`Weekly`},{type:`hours`,label:`Every N hours`},{type:`once`,label:`Once`}];function Nn({value:e,stored:t,onChange:n,timeZone:r}){let i=t=>n({...e,...t}),a=t=>i(t===`once`?{type:t,at:e.at??En(r),timeZone:e.timeZone??r}:{type:t});return(0,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:Mn.map(t=>(0,K.jsx)(ln,{pressed:e.type===t.type,onClick:()=>a(t.type),children:t.label},t.type))}),e.type===`once`?(0,K.jsx)(On,{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:ft.map((t,n)=>(0,K.jsx)(ln,{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)(k,{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:lt.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)(Sn,{label:`Hour`,value:e.hour,max:23,onCommit:e=>i({hour:e})}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,K.jsx)(Sn,{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:ot(e)})]})]})}var Pn=40*864e5,Fn=5;function In({schedule:e,timeZone:t,now:n=Date.now()}){if(e.type===`once`)return(0,K.jsx)(Ln,{schedule:e,now:n});let r=tt(e,n+1,n+Pn,t,Fn);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:at(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 Ln({schedule:e,now:t}){let n=nt(e),r=dt(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:at(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 Rn={schedule:`On a schedule`,github:`When GitHub changes`};function zn(e){return/time zone|due time/i.test(e)?`when`:/autonomous/i.test(e)?`execution`:/placeholder|prompt|workflow|runner|model|task/i.test(e)?`run`:/\bname\b/i.test(e)?`name`:/schedule|github|event|filter|label|interval|remote|forge|lookback|records?|hour|minute|poll|kind|archived/i.test(e)?`when`:`form`}function Bn({title:e,icon:t,hideLegend:n=!1,failure:r,section:i,children:a}){let o=(0,H.useId)();return(0,K.jsxs)(`section`,{role:n?void 0:`group`,"aria-labelledby":n?void 0:o,className:`grid min-w-0 gap-3.5 rounded-xl border border-card-edge bg-card shadow-card p-5`,children:[n?null:t?(0,K.jsxs)(`h2`,{id:o,className:`flex items-center gap-2 text-base font-semibold text-foreground`,children:[t,e]}):(0,K.jsx)(`h2`,{id:o,className:`text-sm font-semibold text-foreground`,children:e}),a,r?.section===i&&!r.conflict?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:r.message}):null]})}function Vn({draft:e,patch:t,forge:n,automation:r}){return(0,K.jsx)(K.Fragment,{children:r?(0,K.jsxs)(`p`,{className:`text-sm`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`Trigger · `}),Rn[e.kind]]}):(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,K.jsx)(Xe,{slot:`automation-kind`,label:`Trigger`,size:`touch`,value:e.kind,onChange:e=>t({kind:e}),options:[{value:`schedule`,label:Rn.schedule},{value:`github`,label:Rn.github,disabled:!n.available,...n.available?{}:{title:n.reason??`GitHub is unavailable`}}]}),n.available?null:(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`GitHub unavailable · ${n.reason??`no GitHub access`}`})]})})}function Hn({draft:e,patch:t,forge:n,timeZone:r,automation:i}){return e.kind===`schedule`?(0,K.jsx)(Nn,{value:e.schedule,stored:i?.schedule,onChange:e=>t({schedule:e}),timeZone:r}):(0,K.jsx)(bn,{draft:e,onChange:t,...n.available?{}:{disabledReason:n.reason??`no GitHub access`}})}function Un({draft:e,patch:t}){let n=e.kind===`schedule`?[`date`,`time`,`project`,`automation`]:[`github.kind`,`github.number`,`github.title`,`github.url`,`github.author`,`github.assignees`,`github.labels`,`github.event`],r=[...new Set([...e.prompt.matchAll(/\{\{([^{}]+)\}\}/g)].map(e=>e[1]))].filter(e=>!n.includes(e));return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,K.jsx)(k,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,K.jsx)(Ze,{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.`]})})]}),r.length?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:`Unavailable for this trigger: ${r.map(e=>`{{${e}}}`).join(`, `)}`}):null,(0,K.jsx)(Zn,{draft:e,patch:t})]})}function Wn({label:e,help:t,checked:n,onChange:r}){let i=(0,H.useId)();return(0,K.jsxs)(`label`,{htmlFor:i,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,K.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,K.jsx)(`span`,{id:`${i}-label`,children:e}),(0,K.jsx)(`span`,{id:`${i}-help`,className:`completion-control-help`,children:t})]}),(0,K.jsx)(De,{id:i,className:`completion-switch shrink-0`,checked:n,"aria-labelledby":`${i}-label`,"aria-describedby":`${i}-help`,onCheckedChange:r})]})}function Gn({draft:e,patch:t,saving:n,automation:r}){let i=e.kind===`schedule`,a=r?`Enabled`:`Enable after saving`,o=i&&e.schedule.type===`once`?`It runs once at the time set under When, then moves to Archived with its task.`:i?`The first run is the next occurrence in Next 5 runs.`:vn(e.filters.includeExisting);return(0,K.jsxs)(K.Fragment,{children:[(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.jsxs)(`div`,{"data-embedded":``,className:`grid min-w-0`,children:[(0,K.jsx)(Wn,{label:`Autonomous`,help:`Runs without waiting for answers.`,checked:e.autonomous,onChange:e=>t({autonomous:e})}),(0,K.jsx)(Ve,{embedded:!0,archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,onChange:t,disabled:n}),(0,K.jsx)(Be,{embedded:!0,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging,onChange:t,disabled:n}),(0,K.jsx)(Wn,{label:a,help:o,checked:e.enabled,onChange:e=>t({enabled:e})})]}),r?(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`These settings apply to future tasks. Existing tasks keep their settings.`}):null]})}function Kn({automation:e,forge:t,timeZone:n,onSaved:r,onReload:i}){let[a,o]=(0,H.useState)(()=>Gt(e)),[s,c]=(0,H.useState)(e?.revision),[l,u]=(0,H.useState)(),[f,p]=(0,H.useState)(!1),m=e=>o(t=>({...t,...e})),h=async t=>{if(t.preventDefault(),f)return;let n=t.currentTarget;if(n instanceof HTMLFormElement&&!n.checkValidity()){n.reportValidity();return}p(!0),u(void 0);let i=`save`;try{if(e&&s!==void 0){let{automation:t}=await v(e.id,Xt({...a,enabled:e.enabled},s));c(t.revision),a.enabled!==e.enabled&&(i=`enable`,await ee(e.id,a.enabled))}else await b(Yt(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`?`execution`:zn(n),message:n})}finally{p(!1)}},g=(0,H.useId)(),_=(0,H.useId)(),y=a.kind===`schedule`;return(0,K.jsx)(Ne,{route:`automations`,density:a.name.trim()===``&&a.prompt.trim()===``?`sparse`:`full`,header:Xn({automation:e,draft:a,formId:g,saveHintId:_,saving:f}),children:(0,K.jsxs)(`form`,{id:g,className:`automation-editor grid min-w-0 gap-4 md:grid-cols-[minmax(0,1fr)_320px] md:grid-rows-[auto_1fr] md:items-start`,onSubmit:h,children:[(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-3.5`,children:[(0,K.jsx)(Bn,{title:`Name`,hideLegend:!0,section:`name`,failure:l,children:(0,K.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,K.jsx)(k,{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=>m({name:e.target.value}),required:!0})]})}),(0,K.jsxs)(Bn,{title:`When`,section:`when`,failure:l,children:[(0,K.jsx)(Vn,{draft:a,patch:m,forge:t,automation:e}),(0,K.jsx)(Hn,{draft:a,patch:m,forge:t,timeZone:n,automation:e})]}),(0,K.jsx)(Bn,{title:`What to run`,section:`run`,failure:l,children:(0,K.jsx)(Un,{draft:a,patch:m})})]}),(0,K.jsxs)(`aside`,{className:`grid min-w-0 max-w-full grid-cols-[minmax(0,1fr)] gap-4 md:sticky md:top-4 md:col-start-2 md:row-span-2 md:row-start-1`,children:[(0,K.jsx)(Bn,{title:`Execution settings`,icon:(0,K.jsx)(be,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),section:`execution`,failure:l,children:(0,K.jsx)(Gn,{draft:a,patch:m,saving:f,automation:e})}),y?(0,K.jsx)(In,{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:yn(a)})]}),(0,K.jsx)(cn,{draft:a,saveLabel:Jn(e,a),editing:e!==void 0})]}),l?.section===`form`||e?(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-3.5 md:col-start-1`,children:[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.jsx)(qn,{automation:e,onDeleted:r}):null]}):null]})})}function qn({automation:e,onDeleted:t}){let[n,r]=(0,H.useState)(!1),[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(``),c=async()=>{if(!i){a(!0),s(``);try{await te(e.id),t()}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}};return(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2 border-t pt-4`,children:[n?(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:i,onClick:()=>void c(),children:`Delete automation`}),(0,K.jsx)(j,{type:`button`,variant:`outline`,disabled:i,onClick:()=>{r(!1),s(``)},children:`Keep`})]})]}):(0,K.jsx)(j,{type:`button`,variant:`outline`,"data-action":`automation-delete`,onClick:()=>r(!0),children:`Delete`}),o?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:o}):null]})}function Jn(e,t){return e?`Save changes`:t.enabled?`Save and enable`:`Save paused`}function Yn(e){let t=[!e.name.trim()&&`a name`,!e.prompt.trim()&&`a prompt`].filter(Boolean);return t.length?`Add ${t.join(` and `)} to save.`:``}function Xn({automation:e,draft:t,formId:n,saveHintId:r,saving:i}){let a=t.name.trim()?t.prompt.trim()?``:`Prompt`:`Name`,o=Yn(t),s=Jn(e,t);return{title:e?`Edit automation`:`New automation`,subtitle:`Define when it runs and the ordinary task it launches.`,status:(0,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 Zn({draft:e,patch:t}){let n=c(),l=Pe(),{runners:u,signedOut:d}=l.runnersOn(e=>l.repoAccount?.[e]),f=o(),p=a(),{runner:m,ready:h}=r(e.runner??f.data?.defaultRunner??`claude`),g=s(m,h,l.repoAccount?.[m]),ee=[...new Set([...(n.data?.workflows??[]).map(e=>e.name),...e.workflow?[e.workflow]:[]])],_=[...new Set([...u,...e.runner?[e.runner]:[]])],v=He(m,p.data,g.data,[e.model]),y=v.find(t=>t.id===(e.model??``))?.label??e.model??`Runner default`,b=e=>(0,K.jsx)(e,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`});return(0,K.jsx)(Ke,{children:(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(Ge,{slot:`automation-workflow-pill`,icon:b(ve),fieldLabel:!0,ariaLabel:`Workflow`,label:e.workflow??`inline steps`,value:e.workflow??``,disabled:e.workflow===void 0,disabledHint:`This automation carries its own steps.`,options:ee.map(e=>({value:e,label:e})),onPick:e=>t({workflow:e})}),(0,K.jsx)(Ge,{slot:`automation-runner-pill`,icon:b(xe),fieldLabel:!0,ariaLabel:`Runner`,label:e.runner?i(p.data,e.runner):`default`,value:e.runner??``,disabled:!p.data,options:[{value:``,label:`default`,desc:`The project’s default runner`},..._.map(e=>({value:e,label:i(p.data,e)}))],footer:(0,K.jsx)(Le,{uninstalled:l.uninstalled,signedOut:d.filter(t=>t!==e.runner)}),onPick:e=>{t({runner:e||void 0,model:void 0})}}),(0,K.jsx)(Ge,{slot:`automation-model-pill`,icon:b(_e),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 $n({data:e,error:t,refresh:n,archived:r=!1,onArchivedChange:i}){let[a,o]=(0,H.useState)({}),[s,c]=(0,H.useState)({}),l=(e,t)=>o(n=>{let{[e]:r,...i}=n;return t?{...i,[e]:t}:i}),u=async(e,t,n=!1)=>{c(t=>({...t,[e]:!0}));try{await t()}catch(t){let r=t instanceof Error?t.message:String(t);l(e,n?Qn(r):{text:r,tone:`error`})}finally{c(t=>({...t,[e]:!1}))}},d=e=>u(e.id,async()=>{l(e.id,{text:`Starting…`,tone:`info`});let{runId:t}=await f(e.id);l(e.id,{text:`Started task`,tone:`info`,runId:t}),n()}),p=e=>u(e.id,async()=>{l(e.id,void 0),await ee(e.id,!e.enabled),await n()}),m=e=>u(e.id,async()=>{l(e.id,void 0),await re(e.id),await n()}),h=e=>u(e.id,async()=>{l(e.id,{text:`Checking…`,tone:`info`});let{checkId:t}=await ie(e.id,`preview`);for(let r=0;r<60;r+=1){let r=await ne(t);if(r.status===`complete`){l(e.id,{text:`${r.matches??0} filter match${r.matches===1?``:`es`} found; no tasks launched. Counts can include closed items and previously processed events.`,tone:`info`}),n();return}if(r.status===`error`){let t=r.error??`Preview failed`;l(e.id,Qn(t));return}await new Promise(e=>setTimeout(e,500))}throw Error(`Preview is still running`)},!0),g=e?.automations??[],_=g.filter(e=>!e.archived),v=g.filter(e=>!!e.archived),y=r?v:_;return(0,K.jsx)(z,{route:`automations`,density:e?Ae(y.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)(he,{"aria-hidden":`true`,className:`size-4`}),`New automation`]})})},sparseFooter:e&&y.length>0&&!r?(0,K.jsx)(Me,{summary:`${y.length} active ${y.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,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:[i?(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":!r,onClick:()=>i(!1),className:A(`-mb-px flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground`,!r&&`border-accent-text text-foreground`),children:[`Current`,(0,K.jsx)(er,{count:_.length})]}),(0,K.jsxs)(`button`,{type:`button`,"data-slot":`automations-tab`,"data-view":`archived`,"aria-pressed":r,onClick:()=>i(!0),className:A(`-mb-px flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground`,r&&`border-accent-text text-foreground`),children:[`Archived`,(0,K.jsx)(er,{count:v.length})]})]}):(0,K.jsx)(`span`,{}),(0,K.jsx)(`div`,{className:`pb-2.5`,children:(0,K.jsx)(tr,{data:e})})]}),r&&y.length===0?(0,K.jsx)(q,{text:`No archived automations.`}):y.length===0?(0,K.jsx)(Ie,{icon:(0,K.jsx)(ye,{}),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)(he,{"aria-hidden":`true`,className:`size-4`}),`New automation`]})})}):(0,K.jsx)(`ul`,{className:`grid gap-3`,"aria-label":`Automations`,children:y.map(t=>(0,K.jsx)(ur,{automation:t,timeZone:e.timeZone,note:a[t.id],busy:s[t.id]===!0,onRun:()=>void d(t),onToggle:()=>void p(t),onPreview:()=>void h(t),onCancel:()=>void m(t)},t.id))})]}):(0,K.jsx)(q,{text:`Loading automations…`})})}function er({count:e}){return e===0?null:(0,K.jsx)(`span`,{"data-slot":`automations-tab-count`,className:`tabular-nums text-muted-foreground`,children:`· ${e}`})}function tr({data:e}){return(0,K.jsx)(`p`,{"data-slot":`automation-scheduler`,className:A(`text-xs break-words`,e.scheduler.state===`scheduled`?`text-success`:`text-muted-foreground`),children:`Scheduler ${e.scheduler.state===`scheduled`?`running`:`idle`} · GitHub ${e.available?`available`:`unavailable`}${e.reason?` · ${e.reason}`:``} · ${e.timeZone}`})}function nr(e){return e.kind===`schedule`&&e.schedule?it(e.schedule):`${fn(e.events??[])} · every ${Math.round((e.intervalSeconds??300)/60)} min`}function rr({automation:e,nextRun:t}){let n=e.kind===`schedule`?ge:me,r=Ye(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:nr(e)}),t?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),t]}):null]})]}),(0,K.jsx)(qe,{dot:r.tone,shape:r.shape,pulse:r.pulse,children:r.label})]})}function ir({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 ar({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:`· ${at(Date.now(),Date.parse(r))}`})]}):(0,K.jsx)(`span`,{children:`Next run: —`})}function or({automation:e,timeZone:t}){let n=e.enabled?St(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 $=`px-3`;function sr({automation:e,busy:t,confirmingCancel:n,cancelRef:r,onToggle:i,onRun:a,onPreview:o,onOpenCancel:s}){let c=e.kind===`schedule`,l=e.schedule?.type===`once`;return(0,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:i,children:e.enabled?`Pause`:`Enable`}),c?(0,K.jsx)(j,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-run`,disabled:t,onClick:a,children:`Run now`}):(0,K.jsx)(j,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-preview`,disabled:t,onClick:o,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`})}),l&&!n?(0,K.jsx)(j,{variant:`outline`,size:`sm`,className:A($,`text-destructive`),ref:r,"data-action":`automation-cancel`,disabled:t,onClick:s,children:`Cancel`}):null,(0,K.jsx)(j,{variant:`outline`,size:`sm`,className:A($,`sm:ms-auto`),asChild:!0,children:(0,K.jsx)(L,{to:`/automations/${e.id}/log`,children:`Execution log`})})]})}function cr({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 lr({note:e}){return(0,K.jsxs)(`div`,{role:e.tone===`error`?`alert`:`status`,className:A(`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)(fe,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:Fe(`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 ur({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)(rr,{automation:e,nextRun:h?void 0:(0,K.jsx)(ar,{automation:e,timeZone:t})}),h?(0,K.jsx)(ir,{automation:e,archive:h}):null,h?null:(0,K.jsx)(or,{automation:e,timeZone:t}),h?null:(0,K.jsx)(sr,{automation:e,busy:r,confirmingCancel:c,cancelRef:u,onToggle:a,onRun:i,onPreview:o,onOpenCancel:p}),e.schedule?.type===`once`&&!h&&c?(0,K.jsx)(cr,{automation:e,busy:r,keepRef:d,onConfirm:()=>{l(!1),s()},onKeep:m}):null,n?(0,K.jsx)(lr,{note:n}):null,(0,K.jsx)(Pt,{automationId:e.id,automationName:e.name,timeZone:t})]})}function dr(e){let t=ke(),n=ze(),[r,i]=(0,H.useState)(),[a,o]=(0,H.useState)(``),s=(0,H.useCallback)(t=>ae({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)(()=>u(async e=>{n&&await s(e)}),[n,s]),(0,H.useEffect)(()=>pe((e,n)=>{if(e!==`automation-change`)return;let r=n;typeof r.project==`string`&&(t===null||r.project===t)&&s()}),[t,s]),{data:r,error:a,refresh:s}}function fr({mode:e=`list`}){let{automationId:t}=de(),n=Oe(),[r,i]=(0,H.useState)(!1),{data:a,error:o,refresh:s}=dr(`include`),[c,l]=(0,H.useState)(0),u=Re();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)(Je,{});if(u===`disabled`)return(0,K.jsx)(z,{route:`automations`,density:`empty`,children:(0,K.jsx)(Ie,{icon:(0,K.jsx)(ye,{}),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)($n,{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)(Kn,{forge:p,timeZone:a.timeZone,onSaved:d}):e===`edit`?f?f.archived?(0,K.jsx)(Ft,{automation:f,timeZone:a.timeZone,onDeleted:d}):(0,K.jsx)(Kn,{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)(Nt,{automationId:t,automationName:f?.name,timeZone:a.timeZone,readOnly:!!f?.archived}):(0,K.jsx)(q,{text:`Automation not found.`})}export{fr 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{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Cn as r}from"./toaster-2ud_VdfV.js";import{o as i}from"./dist-CCX8mhHc.js";import{M as a,Q as o,ct as s,r as c}from"./design-icons-QbNMZniQ.js";import{n as l,r as u}from"./diff-controls-Ci36iPlK.js";import{t as d}from"./search-x-I9Q8pgUa.js";import{t as f}from"./button-BV_AiLj2.js";import{t as p}from"./project-router-CwD1firw.js";import{m}from"./page-shell-BdjH5hyc.js";import{t as h}from"./centered-state-N8vWM_Hw.js";import{Bn as g,Ln as _,Xt as v,Zt as y,lr as b,o as x}from"./index-DkQ5xrLr.js";import{t as S}from"./diff-C5-32cRp.js";var C=e(t(),1),w=n();function T({commit:e,sha:t,slot:n,heading:o=`h2`,diffRef:c,loadFileText:f,className:p}){let y=m(),[b,x]=(0,C.useState)(`unified`),[T,D]=(0,C.useState)(!0),O=(0,C.useRef)(null);E(O,t);let k=e.isError&&e.error instanceof r&&e.error.status===409;return(0,w.jsx)(`section`,{ref:O,"data-slot":n,"data-sha":t,"aria-label":`Selected commit`,className:i(`min-w-0 flex-1 scroll-mt-4 overflow-clip rounded-xl border border-border bg-card`,p),children:e.isPending?(0,w.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-8 text-center text-xs text-muted-foreground`,children:`Loading commit diff…`}):e.isError?(0,w.jsx)(h,{icon:k?(0,w.jsx)(d,{}):(0,w.jsx)(s,{size:16}),tone:k?`neutral`:`danger`,heading:`h2`,title:k?`Commit not found`:`Could not load commit diff`,subtitle:e.error.message}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{"data-slot":`commit-meta`,className:`flex flex-wrap items-start gap-x-3 gap-y-2 border-b border-border px-4 py-3`,children:[(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(o,{className:`break-words text-sm leading-snug font-semibold text-foreground`,children:e.data.subject}),(0,w.jsxs)(`p`,{className:`mt-0.5 flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,w.jsx)(`span`,{children:e.data.author}),(0,w.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,w.jsx)(`span`,{title:e.data.when,children:v(e.data.when)}),(0,w.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,w.jsx)(g,{sha:e.data.sha,variant:`inline`}),(0,w.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,w.jsx)(`span`,{"data-slot":`commit-stat`,children:(0,w.jsx)(_,{stat:e.data.stat})})]})]}),(0,w.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,w.jsx)(u,{mode:b,wrap:T,onModeChange:x,onWrapChange:D}),(0,w.jsx)(l,{wrap:T,onWrapChange:D})]})]}),e.data.files.length===0?(0,w.jsx)(h,{icon:(0,w.jsx)(a,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,w.jsx)(`div`,{className:`p-4 [--diff-sticky-top:0px]`,children:(0,w.jsx)(S,{...c?{viewRef:c}:{},...f?{loadFileText:f}:{},files:e.data.files,mode:y?b:`unified`,wrap:T,totals:!1,className:`min-w-0`},t)})]})})}function E(e,t){let n=(0,C.useRef)(t);(0,C.useLayoutEffect)(()=>{if(n.current===t)return;n.current=``;let r=e.current,i=r?.closest(`[data-slot="main"]`);if(!(!r||!i)&&r.getBoundingClientRect().top<i.getBoundingClientRect().top){let e=typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;r.scrollIntoView?.({block:`start`,behavior:e?`auto`:`smooth`})}},[e,t])}function D({commit:e,sha:t,backTo:n,backLabel:r,slot:i,loadFileText:a,diffRef:o}){return(0,w.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,w.jsx)(`div`,{className:`mx-4 border-b border-border py-2`,children:(0,w.jsx)(f,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,w.jsxs)(p,{to:n,children:[(0,w.jsx)(c,{size:16,"aria-hidden":`true`}),r]})})}),(0,w.jsx)(T,{commit:e,sha:t,slot:i,loadFileText:a,...o?{diffRef:o}:{},className:`rounded-none border-0 bg-transparent`})]})}var O=56;function k({slot:e,commits:t,selectedSha:n,className:r,heading:a}){let[s,c]=(0,C.useState)(``),l=s.trim().toLowerCase(),u=l?t.filter(e=>e.subject.toLowerCase().includes(l)):t,d=u.length>150,f=(0,C.useRef)(null),p=(0,C.useRef)(null),[m,h]=(0,C.useState)(0);(0,C.useLayoutEffect)(()=>{if(!d)return;let e=()=>{let e=f.current,t=p.current;!e||!t||h(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[d]);let g=u.map(e=>(0,w.jsx)(A,{commit:e,selected:n!==void 0&&e.sha===n},e.sha));return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`label`,{className:`relative mb-3 block`,children:[(0,w.jsx)(o,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3 left-3 size-4 text-muted-foreground`}),(0,w.jsx)(b,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:s,onChange:e=>c(e.target.value),className:`h-10 rounded-lg border-border bg-card pl-10`})]}),(0,w.jsxs)(`div`,{ref:e=>{f.current=e,e&&(p.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":d,className:i(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-3 py-1 md:px-4`,r),children:[a?(0,w.jsx)(`div`,{className:`flex min-h-11 flex-wrap items-center gap-2 py-2.5`,children:a}):null,u.length===0?(0,w.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,d?(0,w.jsx)(x,{scrollRef:p,startMargin:m,itemSize:O,children:g}):g]})]})}function A({commit:e,selected:t}){return(0,w.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_56px] [content-visibility:auto]`,children:(0,w.jsxs)(p,{"data-slot":`commit-row`,"data-sha":e.sha,"data-selected":t?`true`:void 0,"aria-current":t?`true`:void 0,to:e.href,className:i(`flex min-h-11 min-w-0 items-start gap-2.5 rounded-md px-2 py-2.5 transition-colors hover:bg-muted`,t&&`bg-muted/70`),children:[(0,w.jsx)(a,{size:16,"aria-hidden":`true`,className:`mt-px size-4 shrink-0 text-accent-text`}),(0,w.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(`span`,{"data-slot":`commit-row-subject`,title:e.subject,className:`line-clamp-2 text-[13px] leading-snug font-medium break-words text-foreground`,children:e.subject}),(0,w.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,w.jsx)(j,{sha:e.sha}),(0,w.jsxs)(`span`,{className:`min-w-0 truncate`,children:[e.author,` · `,(0,w.jsx)(`span`,{title:y(e.when,e.at),children:v(e.when,e.at)})]}),e.stat?(0,w.jsx)(_,{stat:e.stat}):null]})]})]})})}function j({sha:e}){return(0,w.jsx)(g,{"data-slot":`commit-sha`,sha:e,variant:`chip`})}export{T as i,j as n,D as r,k as t};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./preload-helper-Czpn1I53.js";import{o as i}from"./dist-CCX8mhHc.js";import{t as a}from"./diff-stat-DCO_BkZB.js";import{n as o,r as s,t as c}from"./image-preview-CdL9a1Zj.js";var l=e(t(),1),u=n();function d(e){let[t,n]=(0,l.useState)(null);return(0,l.useEffect)(()=>{let e=!1;return r(()=>import(`./diff-view-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-CCtuYJNL.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/dist-CCX8mhHc.js","assets/bundle-mjs-rHxsej31.js","assets/chevron-right-BENZ-1ZN.js","assets/createLucideIcon-BHp8sXmF.js","assets/eye-B8okNWXU.js","assets/button-BV_AiLj2.js","assets/diff-stat-DCO_BkZB.js","assets/index-DkQ5xrLr.js","assets/queries-D9mg7sFY.js","assets/host-context-DDbYAKpm.js","assets/toaster-2ud_VdfV.js","assets/live-protocol-CNUmr-VT.js","assets/host-storage-B72yoDU1.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-BdLLx37K.js","assets/reference-chip-CZKBU_Ud.js","assets/design-icons-QbNMZniQ.js","assets/popover-BQolmvDR.js","assets/es2015-BHonSvOU.js","assets/dist-Du6flkGD.js","assets/dist-ClMNSUvT.js","assets/attention-C7BUdd2s.js","assets/task-groups-BvVfsQKd.js","assets/label-CWlxyeC-.js","assets/cez-idle-C0drOeLs.js","assets/hosts-iUyg8S3j.js","assets/run-detail-refresh-SYZM94ch.js","assets/open-in-menu-Bf8JA2DJ.js","assets/bot-TkDIw4y-.js","assets/external-link-BE6y205O.js","assets/folder-o-AvL3y3.js","assets/smartphone-Lr8Ug2z_.js","assets/square-terminal-B6RYYieR.js","assets/dropdown-menu-NJZfnQCU.js","assets/dist-B2_vvox1.js","assets/own-lookup-DS54wXvD.js","assets/check-OP-CVgZG.js","assets/chevron-down-CHGyCDBH.js","assets/nav-row-styles-CIedRn3A.js","assets/folder-browser-3cBLlnE9.js","assets/loader-circle-CPBhhDbB.js","assets/play-CmVAj_fu.js","assets/search-x-I9Q8pgUa.js","assets/preview-BSFJfN4s.js","assets/dist-CyFJ-9Ex.js","assets/switch-B9OfOEzC.js","assets/dist-Czz3Y5qH.js","assets/badge-DAnkqD7i.js","assets/dialog-DKr-j9S6.js","assets/project-router-CwD1firw.js","assets/read-state-BsTfJki5.js","assets/status-dot-DTU7afRv.js","assets/report-selection-Y2F9NTAs.js","assets/use-search-params-writer-DD5PEEZw.js","assets/page-shell-BdjH5hyc.js","assets/page-shell-CEIoW56O.css","assets/format-BU7D3IfE.js","assets/command-4D8sPZJy.js","assets/project-order-AcHI4Dcl.js","assets/skills-pM_PouEs.js","assets/agent-accounts-C2ILQhZy.js","assets/control-locations-kCPVEtOM.js","assets/agents-settings-path-7X6_cvUg.js","assets/centered-state-N8vWM_Hw.js","assets/html-report-BX3msvci.js","assets/index-BVRdRJAN.css","assets/highlighter-Crq-WTmN.js","assets/image-preview-CdL9a1Zj.js","assets/zoomable-image-CULOtYYp.js","assets/textarea-BGp28xFr.js","assets/markdown-BBDDg-4t.js","assets/markdown-FIfZPsax.js","assets/chunk-BO2N2NFS-DQrpGzb-.js","assets/lib-DrPFkMXk.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./preload-helper-Czpn1I53.js";import{o as i}from"./dist-CCX8mhHc.js";import{t as a}from"./diff-stat-DCO_BkZB.js";import{n as o,r as s,t as c}from"./image-preview-CdL9a1Zj.js";var l=e(t(),1),u=n();function d(e){let[t,n]=(0,l.useState)(null);return(0,l.useEffect)(()=>{let e=!1;return r(()=>import(`./diff-view-CCtuYJNL.js`).then(t=>{e||n({View:t.DiffView})},()=>{e||n(`failed`)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76])),()=>{e=!0}},[]),e.files.length===0?(0,u.jsx)(`p`,{"data-slot":`diff-empty`,className:i(`px-1 text-xs text-muted-foreground`,e.className),children:`No changes.`}):t===`failed`?(0,u.jsx)(f,{...e}):t===null?(0,u.jsx)(`p`,{"data-slot":`diff-loading`,className:i(`px-1 text-xs text-muted-foreground`,e.className),children:`Loading diff…`}):(0,u.jsx)(t.View,{...e})}function f({files:e,wrap:t=!1,imageSrc:n,onOpenInApp:r,viewRef:a,totals:o=!0,actions:c,className:d}){let f={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},m=(0,l.useRef)(null);return(0,l.useImperativeHandle)(a,()=>({scrollToPath:e=>{for(let t of m.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,u.jsxs)(`div`,{ref:m,"data-slot":`diff`,"data-fallback":`true`,className:i(`flex min-w-0 flex-col gap-3`,d),children:[(0,u.jsxs)(`div`,{"data-slot":`diff-header`,hidden:!o&&!c,className:`flex min-h-9 flex-wrap items-center gap-x-2 gap-y-1.5 px-1`,children:[(0,u.jsx)(s,{stat:f,hidden:!o}),c?(0,u.jsx)(`div`,{"data-slot":`diff-actions`,className:`ms-auto flex items-center gap-1.5`,children:c}):null]}),e.map(e=>(0,u.jsx)(p,{file:e,wrap:t,imageSrc:n,onOpenInApp:r},`${e.oldPath??``}→${e.path}`))]})}function p({file:e,wrap:t,imageSrc:n,onOpenInApp:r}){let s=e.oldPath?`${e.oldPath} → ${e.path}`:e.path;return(0,u.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,u.jsxs)(`header`,{className:`flex items-start gap-2 border-b border-border px-3 py-2`,children:[(0,u.jsx)(`span`,{"data-slot":`diff-file-path`,title:s,className:`min-w-0 wrap-anywhere font-mono text-xs font-medium`,children:s}),(0,u.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,u.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-xs`})})]}),o(e)?(0,u.jsx)(c,{file:e,imageSrc:n,onOpenInApp:r}):e.binary?(0,u.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-muted-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,u.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-muted-foreground`,children:`No content changes (metadata only).`}):(0,u.jsx)(`pre`,{className:i(`py-2 font-mono text-xs leading-[1.7]`,t?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
|
|
3
3
|
`).map((e,t)=>(0,u.jsxs)(`span`,{className:i(`block px-4`,e.startsWith(`+`)&&!e.startsWith(`+++`)&&`bg-diff-add`,e.startsWith(`-`)&&!e.startsWith(`---`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-muted-foreground`),children:[e,e===``?` `:``]},t))})]})}export{d as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{o as t}from"./dist-CCX8mhHc.js";import{j as n,nt as r,u as i,v as a}from"./design-icons-QbNMZniQ.js";import{t as o}from"./createLucideIcon-BHp8sXmF.js";import{t as s}from"./button-BV_AiLj2.js";import{n as c,p as l,r as u,t as d}from"./dropdown-menu-NJZfnQCU.js";import{vr as f}from"./index-
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{o as t}from"./dist-CCX8mhHc.js";import{j as n,nt as r,u as i,v as a}from"./design-icons-QbNMZniQ.js";import{t as o}from"./createLucideIcon-BHp8sXmF.js";import{t as s}from"./button-BV_AiLj2.js";import{n as c,p as l,r as u,t as d}from"./dropdown-menu-NJZfnQCU.js";import{vr as f}from"./index-DkQ5xrLr.js";var p=o(`rows-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}]]),m=o(`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`}]]),h=e();function g({mode:e,wrap:t,onModeChange:n,onWrapChange:r,disabled:i=!1}){return(0,h.jsxs)(`span`,{className:`flex items-center gap-1.5 max-md:hidden`,children:[(0,h.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`,children:[(0,h.jsx)(S,{current:e,value:`unified`,onModeChange:n,disabled:i}),(0,h.jsx)(S,{current:e,value:`split`,onModeChange:n,disabled:i})]}),(0,h.jsx)(b,{wrap:t,onWrapChange:r,disabled:i,labelled:!0,className:`gap-1.5 rounded-lg px-3 text-xs font-medium`})]})}function _({wrap:e,onWrapChange:t,preview:n=!1,onPreviewChange:a,disabled:o=!1}){return(0,h.jsxs)(d,{children:[(0,h.jsx)(l,{asChild:!0,children:(0,h.jsxs)(s,{variant:`outline`,size:`sm`,"data-slot":`diff-view-menu`,className:`gap-1.5 rounded-lg px-3 text-xs font-medium md:hidden`,children:[(0,h.jsx)(r,{size:16,"aria-hidden":`true`,className:`size-4`}),`View`,(0,h.jsx)(i,{size:16,"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`})]})}),(0,h.jsxs)(u,{align:`end`,"data-slot":`diff-view-menu-content`,children:[(0,h.jsx)(c,{"data-slot":`diff-view-wrap`,className:`min-h-11`,checked:e,disabled:o,onCheckedChange:e=>t(e===!0),children:`Wrap long lines`}),a?(0,h.jsx)(c,{"data-slot":`diff-view-preview`,className:`min-h-11`,checked:n,onCheckedChange:e=>a(e===!0),children:`Preview Markdown`}):null]})]})}var v=`Unavailable while Markdown preview is on`;function y(){return(0,h.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 b({wrap:e,onWrapChange:n,className:r=`rounded-lg`,disabled:i=!1,labelled:a=!1}){return(0,h.jsxs)(s,{variant:`outline`,size:a?`default`:`icon-sm`,"data-slot":`wrap-toggle`,"aria-pressed":e,"aria-label":`Wrap long lines`,title:i?v:`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,h.jsx)(m,{"aria-hidden":`true`}),a?(0,h.jsx)(`span`,{"aria-hidden":`true`,children:`Wrap`}):null]})}function x({preview:e,onPreviewChange:n}){return(0,h.jsxs)(s,{variant:`outline`,size:`default`,"data-slot":`markdown-preview-toggle`,"aria-pressed":e,"aria-label":`Preview Markdown`,title:e?`Show Markdown as a diff`:`Preview Markdown`,className:t(`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,h.jsx)(f,{"aria-hidden":`true`,className:`size-4`}),(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`max-sm:hidden`,children:`Preview MD`})]})}function S({current:e,value:n,onModeChange:r,disabled:i}){let o=e===n;return(0,h.jsxs)(`button`,{type:`button`,"data-mode":n,"aria-pressed":o,disabled:i,title:i?v:void 0,onClick:()=>r(n),className:t(`inline-flex h-[30px] 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,h.jsx)(p,{"aria-hidden":`true`,className:`size-4`}):(0,h.jsx)(a,{size:16,"aria-hidden":`true`,className:`size-4`}),n]})}function C({branch:e}){return(0,h.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,h.jsx)(n,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,h.jsx)(`span`,{className:`truncate`,children:e})]})}export{x as a,y as i,_ as n,b as o,g as r,C 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-CCX8mhHc.js";import{t as i}from"./chevron-right-BENZ-1ZN.js";import{t as a}from"./eye-B8okNWXU.js";import{t as o}from"./button-BV_AiLj2.js";import{t as s}from"./diff-stat-DCO_BkZB.js";import{o as c,rt as l,wn as u}from"./index-
|
|
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-CCX8mhHc.js";import{t as i}from"./chevron-right-BENZ-1ZN.js";import{t as a}from"./eye-B8okNWXU.js";import{t as o}from"./button-BV_AiLj2.js";import{t as s}from"./diff-stat-DCO_BkZB.js";import{o as c,rt as l,wn as u}from"./index-DkQ5xrLr.js";import{a as d,i as f,r as p}from"./highlighter-Crq-WTmN.js";import{n as m,r as h,t as g}from"./image-preview-CdL9a1Zj.js";import{t as _}from"./textarea-BGp28xFr.js";import{n as v,t as y}from"./markdown-BBDDg-4t.js";import{t as b}from"./markdown-FIfZPsax.js";var x=e(t(),1),S=44;function C(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 ee(e){return C(e)*20+S}function te(e){return e.reduce((e,t)=>e+C(t),0)}function ne(e,t){let n=new URLSearchParams(e).get(`diff`);return n===`flat`||n===`virtual`?n:t>1500?`virtual`:`flat`}function w(e){return`${e.oldPath??``}→${e.path}`}function T(e){let t=0;for(let n of e.split(`
|
|
3
3
|
`))n.length>t&&(t=n.length);return t}var E=n();function D({path:e,side:t,line:n,hunk:r}){let i=typeof n==`number`?String(n):`${n.start}-${n.end}`;return`${r?`hunk`:`line`}:${t}:${i}:${e}`}function O(e,t){return t.kind===`del`||t.newLine===void 0?{path:e,side:`old`,line:t.oldLine??0,hunk:!1}:{path:e,side:`new`,line:t.newLine,hunk:!1}}function k(e,t){let[n,r,i]=t.newCount===0?[t.oldStart,t.oldCount,`old`]:[t.newStart,t.newCount,`new`];return{path:e,side:i,line:{start:n,end:n+Math.max(r,1)-1},hunk:!0}}function A(e){return e.hunk?`Add a note on this hunk`:`Add a note on ${e.side===`old`?`old `:``}line ${String(e.line)}`}function j(e){return typeof e.line==`number`?`Note on ${e.side===`old`?`old `:``}line ${e.line} of ${e.path}`:`Note on lines ${e.line.start}–${e.line.end} of ${e.path}`}function re(e){let[t,n]=(0,x.useState)(()=>new Map),r=(0,x.useRef)(null);if(u([...t.values()].some(e=>e.text.trim()!==``)),!e)return;let i=e=>n(t=>{let n=new Map(t);return n.delete(e),n});return{drafts:t,open:e=>{let t=D(e);r.current=t,n(n=>new Map(n).set(t,n.get(t)??{anchor:e,text:``}))},change:(e,t)=>n(n=>{let r=n.get(e);return r?new Map(n).set(e,{...r,text:t}):n}),close:i,save:n=>{let r=t.get(n);!r||r.text.trim()===``||(e(r.anchor,r.text),i(n))},takeFocus:e=>r.current===e?(r.current=null,!0):!1}}var M=r(`cursor-pointer pointer-coarse:min-h-11 pointer-coarse:min-w-11 hover:text-foreground hover:underline`,`focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-ring`);function N({noteKey:e,draft:t,notes:n}){let r=(0,x.useRef)(null);(0,x.useEffect)(()=>{n.takeFocus(e)&&r.current?.focus()});let i=t.text.trim()===``;return(0,E.jsxs)(`div`,{"data-slot":`diff-note-editor`,className:`sticky left-0 flex w-full max-w-[100cqi] flex-col gap-2 border-y border-border bg-card px-3 py-2 font-sans`,children:[(0,E.jsx)(_,{ref:r,"data-slot":`diff-note-text`,"aria-label":j(t.anchor),placeholder:`What should change here?`,rows:2,value:t.text,onChange:t=>n.change(e,t.target.value),onKeyDown:t=>{if(t.key===`Escape`){t.preventDefault(),t.stopPropagation(),n.close(e);return}l(t)&&(t.preventDefault(),n.save(e))},className:`min-h-11 text-base md:text-[13px]`}),(0,E.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,E.jsx)(o,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`diff-note-cancel`,onClick:()=>n.close(e),children:`Cancel`}),(0,E.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`diff-note-save`,disabled:i,onClick:()=>n.save(e),children:`Save`})]})]})}var P=/[A-Za-z0-9_]+|\s+|[^\sA-Za-z0-9_]+/g,F=300,I=.3;function L(e,t){if(e===t)return null;let n=e.match(P)??[],r=t.match(P)??[];if(n.length===0||r.length===0||n.length>F||r.length>F)return null;let i=ie(n,r),a=r.length+1;return(i[n.length*a+r.length]??0)/Math.max(n.length,r.length)<I?null:ae(n,r,i)}function ie(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 ae(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:R(e,i),add:R(t,a)}}function R(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 oe(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 se=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,ce=`… (patch truncated)`;function z(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=se.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(ce)){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 le(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 ue(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 de(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=L(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 B(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(de(t,i))}else t(i),r++}}function fe(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}),B(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 pe(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}),B(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}function me({file:e,loadFileText:t,imageSrc:n}){let r=(0,x.useMemo)(()=>he(e),[e]),i=(0,x.useRef)(t);i.current=t;let a=(0,x.useRef)(n);a.current=n;let o=t!==void 0,[s,c]=(0,x.useState)(null);(0,x.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,x.useCallback)(t=>{let n=a.current,r=n?v(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,E.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,E.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,E.jsx)(`div`,{"data-slot":`diff-markdown-preview`,className:`px-4 py-5 md:px-6`,children:(0,E.jsxs)(`div`,{className:`mx-auto max-w-[72ch]`,children:[f?(0,E.jsx)(`p`,{className:`mb-4 text-xs text-muted-foreground`,children:f}):null,(0,E.jsx)(b,{document:!0,imageSrc:l,children:d??r.text})]})})}function he(e){let t=z(e.patch);return{text:t.hunks.map(e=>e.lines.filter(e=>e.kind!==`del`).map(e=>e.text).join(`
|
package/web/dist/assets/{discard-changes-dialog-Bv4yc0N1.js → discard-changes-dialog-BACqR1hj.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{$t as t,an as n,en as r,in as i,nn as a,on as o,rn as s,tn as c}from"./index-
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{$t as t,an as n,en as r,in as i,nn as a,on as o,rn as s,tn as c}from"./index-DkQ5xrLr.js";var l=e();function u({open:e,subject:u,onKeep:d,onDiscard:f}){return(0,l.jsx)(t,{open:e,onOpenChange:e=>!e&&d(),children:(0,l.jsxs)(a,{"data-slot":`discard-changes-dialog`,className:`sm:max-w-[560px]`,children:[(0,l.jsxs)(n,{children:[(0,l.jsx)(o,{children:`Discard unsaved changes?`}),(0,l.jsxs)(s,{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)(i,{children:[(0,l.jsx)(c,{"data-slot":`discard-changes-keep`,children:`Keep editing`}),(0,l.jsx)(r,{"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{$ as r}from"./queries-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$ as r}from"./queries-D9mg7sFY.js";import{Cn as i,Gt as a}from"./toaster-2ud_VdfV.js";import{d as o,m as s,p as c}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as l}from"./dist-CCX8mhHc.js";import{T as u,ct as d}from"./design-icons-QbNMZniQ.js";import{t as f}from"./createLucideIcon-BHp8sXmF.js";import{o as p}from"./diff-controls-Ci36iPlK.js";import{t as m}from"./centered-state-N8vWM_Hw.js";import{r as h}from"./html-report-BX3msvci.js";import{a as g,i as _,r as v}from"./highlighter-Crq-WTmN.js";import{n as y,t as b}from"./markdown-FIfZPsax.js";import{t as x}from"./html-report-frame-Bk6UkqKa.js";var S=f(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),C=f(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),w=f(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),T=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`ico`,`avif`]);function E(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:T.has(t.slice(n+1).toLowerCase())}function D(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return E(e)||n>0&&t.slice(n+1).toLowerCase()===`svg`}var O=e(t(),1);function k(e){return e.tooLarge?`too-large`:D(e.path)?`image`:e.binary?`binary`:`text`}function A(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}var j=n();function M({runId:e,path:t,className:n}){let a=r(e,t??void 0);if(t===null)return(0,j.jsx)(z,{className:n,children:(0,j.jsx)(m,{icon:(0,j.jsx)(u,{size:16}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from this task’s worktree to inspect its contents.`,className:`[&_[data-slot=centered-state-tile]]:size-10 [&_[data-slot=centered-state-tile]]:border-0 [&_[data-slot=centered-state-tile]]:bg-transparent [&_[data-slot=centered-state-tile]]:text-accent-text [&_[data-slot=centered-state-tile]]:shadow-none [&_h2]:text-xl`})});if(a.isPending)return(0,j.jsx)(z,{className:n,children:(0,j.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(a.isError){let e=a.error instanceof i&&a.error.status===409;return(0,j.jsx)(z,{className:n,children:(0,j.jsx)(m,{icon:e?(0,j.jsx)(w,{}):(0,j.jsx)(d,{size:16}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:a.error.message})})}return a.data.type===`file`?(0,j.jsx)(F,{runId:e,entry:a.data,className:n}):(0,j.jsx)(z,{className:n,children:(0,j.jsx)(m,{icon:(0,j.jsx)(C,{}),tone:`neutral`,heading:`h2`,title:`Choose a file inside this directory`,subtitle:`Expand the folder in the tree, or enter the full path to a file.`})})}function N(e,t,n){let r=t?.replace(/\/+$/,``);if(r&&e.startsWith(`${r}/`))return e.slice(r.length+1);let i=/^.*\/\.ai\/(?:cezar|squawk)\/worktrees\/[^/]+\/(.+)$/.exec(e);if(i?.[1])return i[1];if(e.startsWith(`/`)&&n&&!n.startsWith(`/`)){let t=n.replace(/^\.?\//,``);if(t&&(e===`/${t}`||e.endsWith(`/${t}`)))return t}return e}function P(e,t,n){let r=t&&/\.(?:md|markdown)$/i.test(e.path),i=t&&h(e.path),a=/\.(?:png|jpe?g|gif|webp|bmp|ico|avif)$/i.test(e.path),o=t&&a&&e.size<=10*1024*1024?`image`:k(e);return{html:i,kind:o,toggle:(r||i)&&o===`text`,showImage:o===`image`&&(!t||a),rendered:n?null:r?`markdown`:i?`html`:null}}function F({runId:e,entry:t,displayPath:n,className:r,imageUrl:i,downloadUrl:a,snapshot:o,readerHref:s,documentPreview:c=!1}){let[u,d]=(0,O.useState)(!1),[f,m]=(0,O.useState)(!0),h=n??N(t.path),g=P(t,c,u),_=!!(o||a||g.toggle),v=!g.showImage&&g.kind===`text`&&g.rendered===null;return(0,j.jsxs)(z,{className:r,children:[(0,j.jsxs)(`header`,{"data-slot":`file-preview-head`,className:l(`flex min-h-11 items-center gap-2 border-b border-border bg-muted/40 ps-4 text-xs`,v?`pe-2 py-1`:`pe-4 py-2.5`),children:[(0,j.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium text-foreground`,title:h,children:h}),(0,j.jsx)(`span`,{"data-slot":`file-preview-size`,className:`ml-auto shrink-0 font-mono text-xs tabular-nums text-muted-foreground`,children:A(t.size)}),v?(0,j.jsx)(p,{wrap:f,onWrapChange:m,className:`rounded-md`}):null]}),_?(0,j.jsx)(L,{snapshot:o,downloadUrl:a,source:g.toggle?u:null,onSource:()=>d(e=>!e),readerHref:g.html&&g.kind===`text`?s:void 0}):null,(0,j.jsx)(I,{runId:e,entry:t,kind:g.kind,showImage:g.showImage,rendered:g.rendered,imageUrl:i,wrap:f})]})}function I({runId:e,entry:t,kind:n,showImage:r,rendered:i,imageUrl:o,wrap:s}){return r?(0,j.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,j.jsx)(`img`,{"data-slot":`file-preview-image`,src:o??a(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):n===`too-large`?(0,j.jsx)(m,{icon:(0,j.jsx)(S,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${A(t.size)} — past the preview cap. Open it in your editor instead.`}):n===`binary`?(0,j.jsx)(m,{icon:(0,j.jsx)(C,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${A(t.size)} of binary data — no text preview.`}):i===`markdown`?(0,j.jsx)(`div`,{className:`p-4`,children:(0,j.jsx)(b,{document:!0,children:t.content??``})}):i===`html`?(0,j.jsx)(x,{html:t.content??``,title:`Report: ${t.path}`,className:`h-[70vh]`}):(0,j.jsx)(H,{path:t.path,text:t.content??``,wrap:s})}function L({snapshot:e,downloadUrl:t,source:n,onSource:r,readerHref:i}){return(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-b border-border px-4 py-2 text-xs`,children:[e?(0,j.jsxs)(`span`,{children:[`Published snapshot · `,e]}):null,t?(0,j.jsx)(`a`,{className:`inline-flex min-h-11 items-center text-accent-text underline`,href:t,children:`Download`}):null,n===null?null:(0,j.jsx)(`button`,{className:`min-h-11 rounded px-2 text-accent-text underline focus-visible:ring-2`,onClick:r,children:n?`Preview`:`View source`}),i?(0,j.jsx)(R,{href:i}):null]})}function R({href:e}){let t=s(),n=c();return(0,j.jsx)(`a`,{className:`inline-flex min-h-11 items-center px-2 text-accent-text underline focus-visible:ring-2`,href:o(e),onClick:r=>y(r,t,e,n),children:`Open reader`})}function z({className:e,children:t}){return(0,j.jsx)(`section`,{"data-slot":`file-preview`,className:l(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var B=1500;function V(e,t){let n=(0,O.useMemo)(()=>t.split(`
|
|
2
2
|
`).map(e=>[{content:e}]),[t]),r=(0,O.useMemo)(()=>g(e),[e]),i=n.length>B,[a,o]=(0,O.useState)(null);return(0,O.useEffect)(()=>{if(r===null||i)return;let n=!1;return v(t,r).then(r=>{n||o({key:`${e}\0${t}`,tokens:r.tokens})}),()=>{n=!0}},[e,t,r,i]),r===null||i?n:a?.key===`${e}\0${t}`?a.tokens:_(t,r)?.tokens??n}function H({path:e,text:t,wrap:n=!1}){let r=V(e,t);return(0,j.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":g(e)??`plaintext`,className:`overflow-x-auto overscroll-x-contain py-2 font-mono text-xs leading-[1.7] [scrollbar-width:thin]`,children:(0,j.jsx)(`div`,{className:n?`min-w-0`:`w-max min-w-full`,children:r.map((e,t)=>(0,j.jsxs)(`div`,{className:`flex`,children:[(0,j.jsx)(`span`,{className:`sticky left-0 w-14 shrink-0 select-none bg-card pr-3 pl-4 text-right tabular-nums text-muted-foreground`,children:t+1}),(0,j.jsx)(`span`,{className:l(`min-w-0 flex-1 pr-6`,n?`whitespace-pre-wrap wrap-anywhere`:`whitespace-pre`),children:e.map((e,t)=>(0,j.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})})}export{A as a,C as c,N as i,S as l,F as n,D as o,M as r,w as s,H as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{gt as t}from"./queries-
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{gt as t}from"./queries-D9mg7sFY.js";import{Cn as n}from"./toaster-2ud_VdfV.js";import{o as r}from"./dist-CCX8mhHc.js";import{t as i}from"./createLucideIcon-BHp8sXmF.js";import{t as a}from"./chevron-right-BENZ-1ZN.js";import{t as o}from"./folder-o-AvL3y3.js";var s=i(`corner-left-up`,[[`path`,{d:`M14 9 9 4 4 9`,key:`1af5af`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`,key:`1blwi3`}]]),c=e(),l=`x-apple.systempreferences:com.apple.preference.security?Privacy_FilesAndFolders`,u=`inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-foreground hover:bg-muted`;function d(e){let t=e.replace(/[\\/]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n<0?null:n===0?t.slice(0,1):t.slice(0,n)}function f({path:e,selected:n,onSelect:i,onEnter:l,decorate:u,emptyHint:d,showHidden:f=!1}){let m=t(e,f),h=m.data?.parent??null;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`p`,{"data-slot":`fs-breadcrumb`,className:`truncate font-mono text-xs text-soft-foreground`,title:m.data?.path??void 0,children:m.data?.path??(m.isError?``:`Loading…`)}),m.isError?(0,c.jsx)(p,{error:m.error,path:e,onEnter:l,onRetry:()=>void m.refetch()}):(0,c.jsxs)(`ul`,{"data-slot":`fs-listing`,className:`max-h-64 divide-y divide-border/60 overflow-y-auto overscroll-contain rounded-md border border-border`,children:[h===null?null:(0,c.jsx)(`li`,{className:`flex`,children:(0,c.jsxs)(`button`,{type:`button`,"data-slot":`fs-up`,onClick:()=>l(h),className:`flex flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,children:[(0,c.jsx)(s,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),`Up one level`]})}),(m.data?.dirs??[]).map(e=>(0,c.jsxs)(`li`,{className:`flex items-stretch`,children:[(0,c.jsxs)(`button`,{type:`button`,"data-slot":`fs-dir`,"aria-pressed":n?.path===e.path,onClick:()=>i(e),onDoubleClick:()=>l(e.path),className:r(`flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,n?.path===e.path&&`bg-muted`),children:[(0,c.jsx)(o,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{className:`truncate`,children:e.name}),u?.(e)]}),(0,c.jsx)(`button`,{type:`button`,"data-slot":`fs-enter`,"aria-label":`Open ${e.name}`,onClick:()=>l(e.path),className:`flex shrink-0 items-center px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,c.jsx)(a,{className:`size-3.5`,"aria-hidden":`true`})})]},e.path)),m.data&&m.data.dirs.length===0?(0,c.jsx)(`li`,{className:`px-3 py-2 text-[13px] text-muted-foreground`,children:d}):null]}),m.data?.truncated?(0,c.jsx)(`p`,{"data-slot":`fs-truncated`,className:`text-xs text-muted-foreground`,children:`Too many folders to list — only the first ones are shown.`}):null]})}function p({error:e,path:t,onEnter:r,onRetry:i}){let a=e instanceof n&&e.status===403,o=t===null?null:d(t);return(0,c.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,c.jsx)(`p`,{"data-slot":`fs-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:e instanceof Error?e.message:`could not list that folder`}),a?(0,c.jsx)(`p`,{"data-slot":`fs-privacy-hint`,className:`text-[12.5px] text-soft-foreground`,children:`Allow it under Privacy & Security ▸ Files & Folders, then try again.`}):null,(0,c.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[12.5px]`,children:[o===null?null:(0,c.jsxs)(`button`,{type:`button`,"data-slot":`fs-error-back`,onClick:()=>r(o),className:u,children:[(0,c.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),`Back`]}),a?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`a`,{"data-slot":`fs-privacy-settings`,href:l,target:`_blank`,rel:`noreferrer`,className:u,children:`Open Privacy Settings`}),(0,c.jsx)(`button`,{type:`button`,"data-slot":`fs-retry`,onClick:i,className:u,children:`Try again`})]}):null]})]})}function m(e,n,r=!1){let i=t(e,r);return n?.path??i.data?.path??null}export{m as n,f as t};
|
|
@@ -1 +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-CCX8mhHc.js";import{E as a,I as o,M as s,d as c,lt as l}from"./design-icons-QbNMZniQ.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-
|
|
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-CCX8mhHc.js";import{E as a,I as o,M as s,d as c,lt as l}from"./design-icons-QbNMZniQ.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-Ci36iPlK.js";import{t as _}from"./square-terminal-B6RYYieR.js";import{t as v}from"./button-BV_AiLj2.js";import{i as y,p as b,r as x,t as S}from"./dropdown-menu-NJZfnQCU.js";import{t as C}from"./diff-stat-DCO_BkZB.js";import{t as w}from"./middle-truncated-name-jUQS2QzL.js";var T=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`}]]),E=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`}]]),D=e(t(),1),O=n();function k({root:e,selected:t,onSelect:n}){return(0,O.jsx)(`nav`,{"data-slot":`changes-tree`,"aria-label":`Changed files`,className:`min-w-0 text-[13px]`,children:(0,O.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,O.jsx)(j,{dir:e,depth:0,selected:t,onSelect:n},e.path)),e.files.map(e=>(0,O.jsx)(N,{file:e,depth:0,selected:t,onSelect:n},e.path))]})})}function A({adds:e,dels:t}){return(0,O.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-xs font-medium tabular-nums`,children:[e>0?(0,O.jsxs)(`span`,{className:`text-semantic-green`,children:[`+`,e]}):null,e>0&&t>0?` `:null,t>0?(0,O.jsxs)(`span`,{className:`text-semantic-red`,children:[`−`,t]}):null]})}function j({dir:e,depth:t,selected:n,onSelect:i}){let[o,s]=(0,D.useState)(!0);return(0,O.jsxs)(`li`,{children:[(0,O.jsxs)(`button`,{type:`button`,"data-slot":`tree-dir`,"data-path":e.path,"data-state":o?`open`:`closed`,"aria-expanded":o,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,O.jsx)(c,{size:16,"aria-hidden":`true`,className:r(`size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,o&&`rotate-90`)}),(0,O.jsx)(a,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,O.jsx)(`span`,{title:e.path,className:`min-w-0 truncate font-medium`,children:e.name}),(0,O.jsx)(A,{adds:e.adds,dels:e.dels})]}),o?(0,O.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,O.jsx)(j,{dir:e,depth:t+1,selected:n,onSelect:i},e.path)),e.files.map(e=>(0,O.jsx)(N,{file:e,depth:t+1,selected:n,onSelect:i},e.path))]}):null]})}var M={added:`text-semantic-green`,deleted:`text-semantic-red`};function N({file:e,depth:t,selected:n,onSelect:i}){let a=n===e.path;return(0,O.jsx)(`li`,{children:(0,O.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,O.jsx)(E,{"aria-hidden":`true`,className:r(`size-3.5 shrink-0`,M[e.status])}),(0,O.jsx)(w,{name:e.name,path:e.path}),(0,O.jsx)(A,{adds:e.adds,dels:e.dels})]})})}function P(e,t){return{kind:`dir`,name:e,path:t,dirs:[],files:[],adds:0,dels:0,fileCount:0}}function F(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(F)}}var I=(e,t)=>e.name.localeCompare(t.name);function L(e){let t=P(``,``),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=P(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(I),e.files.sort(I)};return i(t),{...t,dirs:t.dirs.map(F)}}function R({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,O.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:not([data-button-size])]:min-h-11`,children:[(0,O.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[n?(0,O.jsx)(g,{branch:n}):null,i?(0,O.jsx)(V,{stat:i}):null]}),(0,O.jsxs)(`span`,{className:r(`ml-auto flex items-center gap-1.5`,!u&&`md:hidden`),children:[(0,O.jsx)(m,{wrap:o,onWrapChange:l,preview:s,onPreviewChange:u,disabled:_}),_?(0,O.jsx)(p,{}):null,u?(0,O.jsx)(`span`,{className:`max-md:hidden`,children:(0,O.jsx)(f,{preview:s,onPreviewChange:u})}):null]}),(0,O.jsxs)(`span`,{className:r(`flex items-center gap-2 max-md:w-full`,!u&&`md:ml-auto`),children:[(0,O.jsx)(h,{mode:a,wrap:o,onModeChange:c,onWrapChange:l,disabled:_}),(0,O.jsx)(`span`,{"aria-hidden":`true`,className:`hidden h-5 w-px bg-border md:block`}),(0,O.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,O.jsx)(B,{action:e,variant:`outline`,onAction:d},e.id)),(0,O.jsx)(B,{action:e.primary,variant:e.primaryVariant,onAction:d})]}),e.menu.length>0?(0,O.jsxs)(S,{children:[(0,O.jsx)(b,{asChild:!0,children:(0,O.jsx)(v,{variant:`ghost`,size:`icon-sm`,"aria-label":`More git actions`,className:`max-md:border max-md:border-border max-md:bg-card`,children:(0,O.jsx)(T,{"aria-hidden":`true`})})}),(0,O.jsx)(x,{align:`end`,"data-slot":`git-toolbar-menu`,children:e.menu.map(e=>(0,O.jsxs)(y,{disabled:!e.enabled,title:e.reason,onSelect:()=>d(e.id),children:[z[e.id],e.label]},e.id))})]}):null]})]})}var z={commit:(0,O.jsx)(s,{size:16,"aria-hidden":`true`}),push:(0,O.jsx)(l,{size:16,"aria-hidden":`true`}),"create-pr":(0,O.jsx)(o,{size:16,"aria-hidden":`true`}),"view-pr":(0,O.jsx)(d,{"aria-hidden":`true`}),"open-terminal":(0,O.jsx)(_,{"aria-hidden":`true`})};function B({action:e,variant:t,onAction:n}){return e.id===`view-pr`?i(e.href)?(0,O.jsx)(v,{asChild:!0,variant:t,size:`sm`,"data-action":e.id,children:(0,O.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:[z[e.id],e.label]})}):(0,O.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:[z[e.id],e.label]}):(0,O.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:[z[e.id],e.label]})}function V({stat:e}){return(0,O.jsx)(`span`,{"data-slot":`changes-stat`,children:(0,O.jsx)(C,{stat:{adds:H(e.adds),dels:H(e.dels),files:e.files}})})}function H(e){let[t,n]=(0,D.useState)(e),r=(0,D.useRef)(e);return(0,D.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{k as i,R as n,L as r,V as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{O as r,Ut as i,Vt as a,Wt as o,a as s,an as c,c as l,d as u,i as d,j as f,n as p,o as m,r as h,un as g}from"./queries-D9mg7sFY.js";import{p as _}from"./host-context-DDbYAKpm.js";import{Fi as v,G as y,Hi as b,J as x,R as S,Y as C,n as w,oi as T,q as E}from"./toaster-2ud_VdfV.js";import{g as ee,p as D}from"./chunk-KS7C4IRE-BdLLx37K.js";import{c as te,i as ne,t as O}from"./reference-chip-CZKBU_Ud.js";import{o as k}from"./dist-CCX8mhHc.js";import{I as re,L as ie,Q as ae,Z as A,ct as j,i as oe,l as M,m as N,r as se,u as P,ut as ce}from"./design-icons-QbNMZniQ.js";import{t as le}from"./chevron-down-CHGyCDBH.js";import{t as ue}from"./chevron-right-BENZ-1ZN.js";import{t as F}from"./loader-circle-CPBhhDbB.js";import{t as de}from"./play-CmVAj_fu.js";import{t as I}from"./button-BV_AiLj2.js";import{a as fe,i as pe,n as me,r as L,t as he}from"./select-DC_G2no3.js";import{i as R,r as z,t as B}from"./popover-BQolmvDR.js";import{r as ge,t as V}from"./project-router-CwD1firw.js";import"./attention-C7BUdd2s.js";import{f as _e,v as ve}from"./task-groups-BvVfsQKd.js";import{t as ye}from"./status-dot-DTU7afRv.js";import{c as H,d as U,f as be,m as xe}from"./page-shell-BdjH5hyc.js";import{a as Se,o as Ce,r as we,s as Te,t as Ee}from"./command-4D8sPZJy.js";import{t as W}from"./centered-state-N8vWM_Hw.js";import{t as De}from"./use-search-params-writer-DD5PEEZw.js";import{At as G,Ct as Oe,Dn as K,Dt as ke,Et as Ae,Fn as je,Ft as Me,It as Ne,Kn as Pe,Lt as Fe,Mt as Ie,Nt as Le,Ot as Re,Pt as ze,St as Be,Tt as Ve,ir as He,jt as Ue,kt as We,o as Ge,pt as Ke,sr as qe,wt as Je,xt as Ye,zn as Xe}from"./index-DkQ5xrLr.js";import{t as Ze}from"./markdown-FIfZPsax.js";import{a as Qe,c as $e,f as et,h as tt,i as nt,l as rt,m as it,n as at,o as ot,p as q,r as st,s as ct,t as lt,u as ut}from"./use-hand-to-agent-state-BB_VmbF7.js";import{t as dt}from"./tab-link-BJDe5cT4.js";var J=e(t(),1),Y=n();function ft({number:e,repo:t}){let n=_();return(0,Y.jsx)(pt,{number:e,repo:t,scope:n},JSON.stringify([n,t,e]))}function pt({number:e,repo:t,scope:n}){let r=(0,J.useId)(),i=(0,J.useId)(),[a,o]=(0,J.useState)(!1),s=a?le:ue,l=c(n,!0,n==="default"),u=f(`#${e}`,!0),d=(0,J.useMemo)(()=>Le(ve(l.data??[],u.data?.pages.flatMap(e=>e.runs)??[]),e,t,n),[l.data,u.data,e,t,n]);return(0,Y.jsxs)(`section`,{"aria-labelledby":r,className:k(`mt-4 min-w-0 rounded-lg border border-border`,a?`p-3`:`p-0.5`),children:[(0,Y.jsx)(`h3`,{id:r,className:`text-xs font-semibold text-muted-foreground`,children:(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":a,"aria-controls":i,onClick:()=>o(e=>!e),className:`flex min-h-11 w-full items-center gap-2 rounded-md px-2.5 text-left hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,Y.jsx)(s,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Y.jsxs)(`span`,{children:[`Linked tasks`,l.data?` (${d.length}${u.hasNextPage||u.isError?`+`:``})`:``]})]})}),(0,Y.jsx)(`div`,{id:i,children:a?(0,Y.jsxs)(Y.Fragment,{children:[l.isPending?(0,Y.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-muted-foreground`,children:`Loading linked tasks…`}):null,l.isError?(0,Y.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`p`,{role:`status`,children:`Couldn’t load linked tasks. Check your connection and try again.`}),(0,Y.jsx)(I,{variant:`outline`,className:`mt-2`,onClick:()=>void l.refetch(),disabled:l.isFetching,children:`Retry linked tasks`})]}):null,l.data&&d.length===0&&!l.isError?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`No linked tasks yet.`}):null,d.length>0?(0,Y.jsx)(`ul`,{className:`mt-2 flex flex-col gap-1`,children:d.map(e=>{let t=je(e,T(e));return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(V,{to:`/tasks/${encodeURIComponent(e.id)}`,className:`flex min-h-11 min-w-0 flex-col justify-center gap-1 rounded-md px-2 py-2 hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium break-words [overflow-wrap:anywhere]`,children:_e(e)}),(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(ye,{tone:t.tone,shape:t.shape,pulse:t.pulse,role:`img`,"aria-label":t.label,title:t.label}),e.archived?(0,Y.jsx)(He,{"data-slot":`linked-task-archived`,dot:K.tone,shape:K.shape,className:`px-2 py-px`,children:K.label}):null,(0,Y.jsx)(`time`,{dateTime:e.createdAt,children:new Date(e.createdAt).toLocaleDateString()})]})]})},e.id)})}):null,u.isError?(0,Y.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`p`,{role:`status`,children:`Couldn’t load older archived linked tasks.`}),(0,Y.jsx)(I,{variant:`outline`,className:`mt-2`,onClick:()=>void u.refetch(),disabled:u.isFetching,children:`Retry older linked tasks`})]}):u.hasNextPage?(0,Y.jsx)(I,{variant:`outline`,className:`mt-2`,onClick:()=>void u.fetchNextPage(),disabled:u.isFetchingNextPage,children:u.isFetchingNextPage?`Loading older linked tasks…`:`Show older linked tasks`}):null]}):null})]})}var mt=`w-44 max-w-full`,X=`min-h-11 min-w-11 rounded-md border border-input bg-card px-3 text-sm font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-ring disabled:opacity-60`,Z=`__all__`;function ht(e,t){let n=new Map;for(let t of e)for(let e of t.assignees??[])n.set(e.toLowerCase(),e);for(let e of t)n.set(e.toLowerCase(),e);return[...n.values()].sort((e,t)=>e.localeCompare(t))}function gt(e,t){return!!e&&t.length===1&&t[0]?.toLowerCase()===e.toLowerCase()}function _t(e){let t=` Previous memberships are shown; issues with unknown membership remain visible.`;return e.projectsState===`refreshing`&&e.projects?`Refreshing project boards.${t}`:e.projectsState===`unavailable`&&e.projects?`${e.projectsReason}${t}`:e.projects?``:e.projectsReason??(e.projectsState===`refreshing`?`Project memberships pending.`:`Project boards unavailable.`)}function vt(e){return[e.viewerLogin?``:`GitHub login unavailable.`,_t(e)].filter(Boolean).join(` `)}function yt({options:e,assignees:t,onAssigneesChange:n}){return(0,Y.jsxs)(B,{children:[(0,Y.jsx)(R,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:`${X} inline-flex items-center gap-1.5`,disabled:e.length===0,children:[`Assignee`,t.length?` · ${t.length}`:``,(0,Y.jsx)(P,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-muted-foreground`})]})}),(0,Y.jsx)(z,{align:`start`,className:`w-64 max-w-[calc(100vw-2rem)] p-2`,children:(0,Y.jsxs)(`fieldset`,{className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto`,children:[(0,Y.jsx)(`legend`,{className:`px-2 text-xs text-muted-foreground`,children:`Match any selected assignee`}),e.map(e=>{let r=t.some(t=>t.toLowerCase()===e.toLowerCase());return(0,Y.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded px-2 hover:bg-muted`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>n(r?t.filter(t=>t.toLowerCase()!==e.toLowerCase()):[...t,e])}),(0,Y.jsx)(`span`,{className:`break-all text-sm`,children:e})]},e.toLowerCase())})]})})]})}function bt({data:e,projectId:t,onProjectChange:n,pickerRef:r}){if(e.projects?.length)return(0,Y.jsxs)(he,{value:t||Z,onValueChange:e=>n(e===Z?``:e),children:[(0,Y.jsx)(pe,{ref:r,"aria-label":`Project board`,"data-slot":`gh-board-filter`,"data-value":t,className:`${X} ${mt} justify-between`,children:(0,Y.jsx)(fe,{placeholder:`All boards`})}),(0,Y.jsxs)(me,{align:`start`,children:[(0,Y.jsx)(L,{value:Z,children:`All boards`}),e.projects.map(e=>(0,Y.jsx)(L,{value:e.id,"data-board":e.id,children:e.title},e.id))]})]});if(e.projects||e.projectsState){let t=e.projects?`No boards`:e.projectsState===`refreshing`?`Loading boards…`:`Boards unavailable`;return(0,Y.jsxs)(he,{disabled:!0,value:Z,children:[(0,Y.jsx)(pe,{ref:r,"aria-label":`Project board`,"data-slot":`gh-board-filter`,"data-value":``,className:`${X} ${mt} justify-between`,children:(0,Y.jsx)(fe,{placeholder:t,children:t})}),(0,Y.jsx)(me,{align:`start`,children:(0,Y.jsx)(L,{value:Z,children:t})})]})}return null}function xt({data:e,message:t,lastMessage:n,hasMessage:r,statusOpen:i,setStatusOpen:a,triggerRef:o,contentRef:s}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{role:`status`,className:`sr-only`,children:t}),(0,Y.jsxs)(B,{open:i,onOpenChange:a,children:[(0,Y.jsx)(R,{asChild:!0,children:(0,Y.jsx)(`button`,{ref:o,type:`button`,className:`${X} inline-flex items-center justify-center ${t?``:`invisible`}`,"aria-label":`Project board status`,tabIndex:t?void 0:-1,children:e.projectsState===`refreshing`?(0,Y.jsx)(A,{size:14,"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):(0,Y.jsx)(j,{size:14,"aria-hidden":`true`,className:`size-3.5`})})}),(0,Y.jsx)(z,{ref:s,align:`start`,"data-slot":`gh-issue-status`,onCloseAutoFocus:e=>{r||e.preventDefault()},className:`w-72 max-w-[calc(100vw-2rem)] p-3 text-xs text-muted-foreground`,children:t||n.current})]})]})}function St({data:e,assignees:t,projectId:n,onAssigneesChange:r,onProjectChange:i}){let[a,o]=(0,J.useState)(!1),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=(0,J.useRef)(null),u=(0,J.useRef)(null),d=ht(e.issues,t),f=gt(e.viewerLogin,t),p=vt(e),m=p!==``,h=(0,J.useRef)(p);m&&(h.current=p);let g=(0,J.useRef)(!m);g.current=!m;let _=()=>(l.current&&!l.current.disabled?l.current:u.current)?.focus();return(0,J.useEffect)(()=>{let e=s.current;if(!e)return;let t=e=>{g.current&&!e.relatedTarget&&requestAnimationFrame(()=>{(!document.activeElement||document.activeElement===document.body)&&_()})};return e.addEventListener(`blur`,t),()=>e.removeEventListener(`blur`,t)},[]),(0,J.useEffect)(()=>{if(m)return;let e=document.activeElement,t=!!e&&(e===s.current||!!c.current?.contains(e));o(!1),t&&_()},[m]),(0,Y.jsxs)(`div`,{className:`contents`,"data-slot":`gh-issue-filters`,children:[(0,Y.jsx)(yt,{options:d,assignees:t,onAssigneesChange:r}),(0,Y.jsxs)(`button`,{ref:u,type:`button`,"data-slot":`gh-assigned-me`,className:`${X} inline-flex items-center gap-1.5 rounded-full aria-pressed:border-accent-strong aria-pressed:bg-accent-strong aria-pressed:text-accent-strong-foreground aria-pressed:hover:bg-accent-strong`,disabled:!e.viewerLogin,"aria-pressed":f,onClick:()=>r(f?[]:[e.viewerLogin]),children:[(0,Y.jsx)(ce,{size:14,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`Assigned to me`]}),(0,Y.jsx)(bt,{data:e,projectId:n,onProjectChange:i,pickerRef:l}),(0,Y.jsx)(xt,{data:e,message:p,lastMessage:h,hasMessage:m,statusOpen:a,setStatusOpen:o,triggerRef:s,contentRef:c})]})}function Ct({onRefresh:e,refreshing:t}){let n=Ye(_());return(0,Y.jsx)(U,{route:`github`,density:`full`,headerSpacing:`compact`,header:{title:`GitHub`,secondaryActions:(0,Y.jsx)(H,{type:`button`,variant:`ghost`,"data-slot":`gh-screen-refresh`,"aria-label":`Refresh from GitHub`,title:`Refresh from GitHub`,disabled:t,onClick:e,children:(0,Y.jsx)(A,{size:17,"aria-hidden":`true`,className:k(`size-[17px]`,t&&`motion-safe:animate-spin`)})})},children:(0,Y.jsx)(`div`,{"data-slot":`github-filter-screen`,children:(0,Y.jsx)(Be,{model:n,variant:`screen`})})})}function wt({view:e,activeFilter:t,isDesktop:n,listInUrl:r,n:i,gh:a,actions:o}){return{headerSlot:`gh-masthead`,title:n?e===`issues`?`Issues`:`Pull requests`:`GitHub`,scope:n?Oe[t]:void 0,scopeSlot:`gh-title-qualifier`,subtitle:a.repo?(0,Y.jsxs)(`span`,{className:`block min-w-0 truncate`,children:[(0,Y.jsx)(`span`,{"data-slot":`gh-repo`,children:a.repo}),(0,Y.jsxs)(`span`,{"data-slot":`gh-synced`,title:a.syncedAt?new Date(a.syncedAt).toLocaleString():void 0,children:[` `,`· `,a.syncedAt?(0,Y.jsx)(Xe,{iso:a.syncedAt,prefix:`Synced `}):`Not synced yet`]})]}):void 0,secondaryActions:(0,Y.jsx)(Tt,{...o}),headerExtra:r&&i===void 0?(0,Y.jsxs)(`div`,{"data-slot":`gh-filter-context`,className:`mt-1 flex min-w-0 items-center gap-3 md:hidden`,children:[(0,Y.jsxs)(V,{to:`/github`,"data-slot":`gh-back-filters`,className:`inline-flex min-h-11 items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,Y.jsx)(se,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to filters`]}),t===`all`?null:(0,Y.jsx)(`span`,{"data-slot":`gh-active-filter`,className:`truncate text-xs text-muted-foreground`,children:[...Ae,...ke].find(e=>e.id===t)?.label})]}):void 0}}function Tt({automationsAvailable:e,refreshing:t,onRefresh:n}){return(0,Y.jsxs)(`div`,{"data-slot":`gh-page-actions`,className:`flex shrink-0 flex-wrap items-center gap-2`,children:[e?(0,Y.jsx)(H,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(V,{to:`/automations/new`,children:`Set up automations`})}):null,(0,Y.jsxs)(H,{type:`button`,variant:`outline`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:t,onClick:n,children:[(0,Y.jsx)(A,{size:16,"aria-hidden":`true`,className:k(`size-3.5`,t&&`motion-safe:animate-spin`)}),`Refresh`]})]})}function Et({view:e,number:t}){return(0,Y.jsx)(W,{icon:e===`issues`?(0,Y.jsx)(N,{size:16}):(0,Y.jsx)(re,{size:16}),tone:`neutral`,heading:`h2`,title:t===null?`Nothing selected`:`Not found`,subtitle:t===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${t} is not among the open ${e===`issues`?`issues`:`pull requests`}. Go back to the list and search for ${t} to look it up on GitHub, closed and merged included.`})}var Dt=/^(\[[^\]\n]{1,24}\]:?)\s+(\S.*)$/s;function Ot(e){let t=Dt.exec(e);return t?{prefix:t[1],rest:t[2]}:{prefix:null,rest:e}}function kt(e,t){if(!t)return e.kind===`issue`?`open`:e.isDraft?`draft`:void 0}function At(e){let t=e.reduce((e,t)=>Math.max(e,String(t.number).length),1);return Math.ceil(28+(t+1)*7.2)}var jt=2;function Mt({item:e,view:t,filter:n,narrows:r,colors:s,expanded:c,onToggle:l,queuedRunId:u,checks:d,comments:f,status:p,task:m,referenceWidth:h}){let g=v(),_=`gh-row-summary-${e.kind}-${e.number}`,y=e.kind===`pr`?`PR`:`Issue`,b=te(y,e.number),S=(y===`PR`&&b.conflicting===!0?i:o(p??b.status))?.label,C=Ot(e.title),w=()=>{g.prefetchQuery({queryKey:a.githubComments(e.kind,e.number),queryFn:({signal:t})=>x(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,Y.jsxs)(`div`,{"data-slot":`gh-row-shell`,"data-expanded":c||void 0,style:{"--gh-ref-width":`${h}px`},className:k(`@container rounded-md`,c&&`bg-sidebar-row-selected`),children:[(0,Y.jsxs)(`button`,{type:`button`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,st(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:w,onFocus:w,onClick:l,"data-slot":`gh-row`,"data-number":e.number,"data-kind":e.kind,"aria-expanded":c,"aria-controls":c?_:void 0,title:`Drag into the composer to prefill a task`,className:`grid w-full grid-cols-[var(--gh-ref-width)_minmax(0,1fr)_auto] items-start gap-x-3 gap-y-1.5 rounded-md px-3 py-2 text-left transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:-outline-offset-2 @4xl:grid-cols-[var(--gh-ref-width)_minmax(0,1fr)_auto_auto]`,children:[(0,Y.jsxs)(`span`,{"data-slot":`gh-row-ref`,title:S,className:`flex h-[18px] items-center`,children:[(0,Y.jsx)(O,{reference:{kind:y,number:e.number},taskTitle:e.title,status:p,compact:!0,inert:!0}),S?(0,Y.jsx)(`span`,{className:`sr-only`,children:S}):null]}),(0,Y.jsxs)(`span`,{"data-slot":`gh-row-title`,className:k(`line-clamp-2 min-w-0 text-[13px] leading-[18px] font-medium text-foreground [overflow-wrap:anywhere] @4xl:line-clamp-none`,c&&`font-semibold`),children:[C.prefix?(0,Y.jsxs)(`span`,{"data-slot":`gh-row-title-prefix`,className:`font-normal text-soft-foreground`,children:[C.prefix,` `]}):null,C.rest]}),(0,Y.jsx)(P,{"data-slot":`gh-row-cue`,"aria-hidden":`true`,className:k(`col-start-3 row-start-1 mt-px size-4 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none @4xl:col-start-4`,c&&`rotate-180`)}),e.labels.length>0?(0,Y.jsx)(`span`,{"data-slot":`gh-row-labels`,className:`col-start-2 col-end-4 flex min-w-0 flex-wrap gap-1 @4xl:col-end-3`,children:e.labels.map(e=>(0,Y.jsx)(ut,{label:e,color:s[e],className:`max-w-full truncate`},e))}):null,(0,Y.jsx)(Nt,{item:e,view:t,task:m,queuedRunId:u,checks:d,comments:f})]}),c?(0,Y.jsx)(Ft,{id:_,item:e,checks:d,detailPath:We(t,n,e.number,``,r),queuedRunId:u}):null]})}function Nt({item:e,view:t,task:n,queuedRunId:r,checks:i,comments:a}){let o=e.assignees??[];return(0,Y.jsxs)(`span`,{"data-slot":`gh-row-meta`,className:`col-start-2 col-end-4 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground @4xl:col-start-3 @4xl:col-end-4 @4xl:row-start-1 @4xl:h-[18px] @4xl:flex-nowrap`,children:[(0,Y.jsx)(`span`,{"data-slot":`gh-row-task`,className:Q.task,children:n?(0,Y.jsx)(He,{dot:n.status.tone,shape:n.status.shape,pulse:n.status.pulse,title:`Newest task: ${n.status.label}`,className:`max-w-full py-0.5`,children:(0,Y.jsx)(`span`,{className:`truncate`,children:n.status.label})}):r?(0,Y.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`shrink-0 font-sans font-medium text-accent-text`,children:`↗ run queued`}):null}),(0,Y.jsx)(`span`,{"data-slot":`gh-row-assignees`,className:Q.assignees,children:o.length>0?(0,Y.jsx)(Pt,{logins:o}):null}),t===`prs`?(0,Y.jsx)(`span`,{"data-slot":`gh-row-checks-slot`,className:Q.checks,children:i?(0,Y.jsx)(ot,{checks:i}):null}):null,(0,Y.jsx)(`span`,{"data-slot":`gh-row-comments`,className:Q.comments,children:a?(0,Y.jsx)(ct,{count:a}):null}),(0,Y.jsx)(Xe,{iso:e.createdAt,className:`shrink-0 @4xl:w-9 @4xl:text-right`})]})}var Q={task:`flex min-w-0 max-w-full empty:hidden @4xl:w-44 @4xl:empty:block`,assignees:`flex shrink-0 items-center empty:hidden @4xl:w-12 @4xl:justify-center @4xl:empty:block`,checks:`flex shrink-0 empty:hidden @4xl:w-4 @4xl:justify-center @4xl:empty:block`,comments:`flex shrink-0 empty:hidden @4xl:w-10 @4xl:empty:block`};function Pt({logins:e}){let t=e.join(`, `);return(0,Y.jsxs)(`span`,{title:`Assigned to ${t}`,className:`flex items-center -space-x-1`,children:[e.slice(0,jt).map(e=>(0,Y.jsx)(nt,{login:e},e)),e.length>jt?(0,Y.jsxs)(`span`,{"aria-hidden":`true`,className:`pl-2 tabular-nums`,children:[`+`,e.length-jt]}):null,(0,Y.jsxs)(`span`,{className:`sr-only`,children:[`Assigned to `,t]})]})}function Ft({id:e,item:t,checks:n,detailPath:r,queuedRunId:i}){let a=d(t.kind,t.number),o=(a.data?.detail?.body??t.body)?.trim(),s=t.kind===`pr`?`PR`:`issue`;return(0,Y.jsxs)(`div`,{id:e,"data-slot":`gh-row-summary`,className:`flex flex-col gap-3 px-3 pb-4 @4xl:pl-[calc(var(--gh-ref-width)+1.5rem)]`,children:[(0,Y.jsx)(`div`,{"data-slot":`gh-row-body`,className:`text-[13px] leading-relaxed text-soft-foreground`,children:o?(0,Y.jsx)(`div`,{"data-slot":`gh-row-excerpt`,inert:!0,className:It,children:(0,Y.jsx)(Ze,{document:!0,children:o})}):a.isPending?(0,Y.jsx)(qe,{className:`h-4 w-2/3`}):a.isError||a.data?.available===!1?(0,Y.jsx)(`p`,{"data-slot":`gh-row-body-unavailable`,className:`text-muted-foreground`,children:`Description unavailable. Use Refresh to try again.`}):(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:`(no description)`})}),(0,Y.jsxs)(`div`,{"data-slot":`gh-row-facts`,className:`flex flex-wrap items-center gap-x-2 gap-y-1.5 text-xs text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[`Opened by `,(0,Y.jsx)(`span`,{"data-slot":`gh-row-author`,className:`font-medium`,children:t.author})]}),n?(0,Y.jsx)(Qe,{checks:n,url:t.url}):null]}),(0,Y.jsxs)(`div`,{"data-slot":`gh-row-actions`,className:`flex flex-wrap items-center gap-2`,children:[i?(0,Y.jsx)(I,{asChild:!0,variant:`outline`,size:`sm`,children:(0,Y.jsxs)(V,{to:`/tasks/${i}`,"data-action":`gh-row-view-task`,children:[(0,Y.jsx)(M,{size:16,"aria-hidden":`true`,className:`size-3.5 text-success`}),`Open queued task`]})}):(0,Y.jsx)(I,{asChild:!0,variant:`primary`,size:`sm`,children:(0,Y.jsxs)(V,{to:r,state:{focusHandoff:!0},"data-action":`gh-row-handoff`,title:`Open this ${s} and write the prompt for an agent`,children:[(0,Y.jsx)(de,{"aria-hidden":`true`,className:`size-3.5`}),`Hand to agent`]})}),(0,Y.jsx)(I,{asChild:!0,variant:`outline`,size:`sm`,children:(0,Y.jsxs)(V,{to:r,"data-action":`gh-row-open`,children:[`Open `,s,(0,Y.jsx)(oe,{size:16,"aria-hidden":`true`,className:`size-3.5`})]})})]})]})}var It=k(`max-h-[calc(3lh)] overflow-hidden [overflow-wrap:anywhere]`,`[&_*]:!my-0 [&_p+*]:!mt-1 [&_ul]:list-inside [&_ol]:list-inside`,`[&_:is(h1,h2,h3,h4,h5,h6,pre,img,table,hr,[data-streamdown="code-block"],[data-streamdown="table-wrapper"],[data-streamdown="image-wrapper"],[data-streamdown="mermaid-block"])]:hidden`);function Lt(e){let t=getComputedStyle(e).overflowY;return t===`auto`||t===`scroll`?e:e.closest(`[data-slot="main"]`)??e}function Rt(e){let[t,n]=(0,J.useState)(null);return(0,J.useLayoutEffect)(()=>{if(!e){n(null);return}let t=()=>n(Lt(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 zt(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 Bt(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=Rt(a),u=(0,J.useRef)(null);u.current=l;let d=zt(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:Bt(p&&!i&&!t.isFetchingNextPage&&!t.isFetchNextPageError,l,()=>void t.fetchNextPage())}}function Ht({item:e,queuedRunId:t}){return t?(0,Y.jsx)(I,{asChild:!0,variant:`outline`,size:`sm`,children:(0,Y.jsxs)(V,{to:`/tasks/${t}`,"data-action":`gh-header-view-task`,children:[(0,Y.jsx)(M,{size:16,"aria-hidden":`true`,className:`size-3.5 text-success`}),`Open queued task`]})}):(0,Y.jsxs)(I,{type:`button`,variant:`primary`,size:`sm`,"data-action":`gh-header-handoff`,title:`Write the prompt and pick the workflow and runner for this ${e.kind===`pr`?`PR`:`issue`}`,onClick:$,children:[(0,Y.jsx)(de,{"aria-hidden":`true`,className:`size-3.5`}),`Hand to agent`]})}function $(){let e=document.querySelector(`[data-slot="gh-detail-inner"] [data-slot="gh-custom-prompt"]`);e?.scrollIntoView({block:`center`}),e?.focus({preventScroll:!0})}var Ut=100;function Wt(e,t,n,r,i){if(!e?.available||t!==`prs`)return[];let a=new Set;n!==null&&Number.isInteger(n)&&a.add(n);for(let t of[...r,...i,...e.prs]){if(a.size>=Ut)break;a.add(t.number)}return[...a]}function Gt(e,t,n,r,i,a){let o=Wt(n,e,r,i,a),s=p(o,e===`prs`),c=s.data?.available?s.data.checks:void 0,l=h(e===`issues`?`issue`:`pr`,(0,J.useMemo)(()=>(t.data?.pages??[]).map(t=>(e===`issues`?t.issues:t.prs).map(e=>e.number)),[t.data,e]),n?.available===!0&&n.commentsDeferred===!0),u=(0,J.useMemo)(()=>new Set(n?.commentsDeferred?(e===`issues`?n.issues:n.prs).map(e=>e.number):[]),[n,e]);return{checkPrNumbers:o,checksMap:c,commentsOf:e=>l[e.number]??(u.has(e.number)?void 0:e.comments)}}function Kt(e){let t=_(),n=c(t,!0,t==="default").data,r=(0,J.useMemo)(()=>n?ze(n,e,t):null,[n,e,t]);return(0,J.useCallback)(e=>{let t=e.kind===`issue`?r?.get(e.number):void 0;return t?{runId:t.id,status:je(t)}:null},[r])}function qt(e){let[t,n]=De(),r=t.get(`filter`),i=Me(e,r),a=i??`all`,o=e=>n(t=>{let n=new URLSearchParams(t);return e===null?n.delete(`filter`):n.set(`filter`,e),n}),s=G(t);return{rawFilterParam:r,filter:i,activeFilter:a,setFilterParam:o,narrows:s,url:(0,J.useMemo)(()=>{let t=new URLSearchParams(s);return{query:t.get(`q`)??``,labels:t.getAll(`label`),assignees:e===`issues`?t.getAll(`assignee`):[],board:e===`issues`?t.get(`board`)??``:``}},[s,e]),writeNarrows:(0,J.useCallback)(e=>n(t=>{let n=e(t);return(t.has(`filter`)||G(t)!==``)&&!n.has(`filter`)&&G(n)===``&&n.set(`filter`,`all`),n}),[n])}}function Jt(e,t){return n=>{let r=new URLSearchParams(n);r.delete(e);for(let n of t)r.append(e,n);return r}}function Yt(e,t,{rawFilterParam:n,filter:r,activeFilter:i,setFilterParam:a,narrows:o,url:s,writeNarrows:c}){let l=Zt(s.query,n!==null||o!==``,c),{query:u,setQuery:d}=l,f=s.labels,p=s.assignees,m=e=>c(Jt(`label`,e)),{setProjectFilter:h,activeProject:g}=Qt(t,s.board,c),_=e===`issues`&&i===`assigned`,v=_?t?.viewerLogin?[t.viewerLogin]:[]:p;return{query:u,setQuery:d,labelFilter:f,setLabelFilter:m,setProjectFilter:h,activeProject:g,isAssignedFilter:_,effectiveAssignees:v,changeAssignees:e=>{c(Jt(`assignee`,e)),_&&a(`all`)},clearFilters:()=>{l.clear(),c(e=>{let t=new URLSearchParams(e);for(let e of Ve)t.delete(e);return r!==null&&r!==`all`&&t.set(`filter`,`all`),t})},filtering:u.trim()!==``||f.length>0||e===`issues`&&(v.length>0||g!==``)||r!==null&&r!==`all`,narrowing:u.trim()!==``||f.length>0||e===`issues`&&(!_&&p.length>0||g!==``)}}var Xt=250;function Zt(e,t,n){let r=`${D().pathname}${t?``:`#entry`}`,[i,a]=(0,J.useState)(e),o=(0,J.useRef)(e),s=(0,J.useRef)(void 0),c=(0,J.useRef)(r);return(0,J.useEffect)(()=>{e===o.current&&r===c.current||(clearTimeout(s.current),c.current=r,o.current=e,a(e))},[e,r]),(0,J.useEffect)(()=>()=>clearTimeout(s.current),[]),{query:i,setQuery:e=>{a(e),clearTimeout(s.current),s.current=setTimeout(()=>{let t=e.trim();o.current=t,n(e=>{let n=new URLSearchParams(e);return t===``?n.delete(`q`):n.set(`q`,t),n})},Xt)},clear:()=>{clearTimeout(s.current),o.current=``,a(``)}}}function Qt(e,t,n){let r=e=>n(t=>{let n=new URLSearchParams(t);return e===``?n.delete(`board`):n.set(`board`,e),n}),i=e?.projectsState===`refreshing`||e?.projectsState===`unavailable`,a=i||e?.projects?.some(e=>e.id===t)===!0,o=e?.available===!0&&!i&&t!==``&&!a,[s,c]=(0,J.useState)(``);s!==``&&s!==t&&c(``),o&&s!==t&&c(t);let l=o||s!==``&&s===t,u=a&&!l?t:``;return(0,J.useEffect)(()=>{l&&n(e=>{let t=new URLSearchParams(e);return t.delete(`board`),t})},[l,n]),{setProjectFilter:r,activeProject:u}}function $t(e,t,{filter:n,activeFilter:r},i){let a=_(),o=e===`issues`&&(r===`no-task`||r===`has-task`),s=c(a,o,a==="default"),u=(0,J.useMemo)(()=>s.data?Ie(s.data,t?.repo,a):null,[s.data,t?.repo,a]),d=Ue(e,n)?Fe(n):null,f=l(`pr`,d??``,d!==null&&t?.available===!0),p=d!==null&&f.data?.available?f.data.items:null,m=(0,J.useMemo)(()=>t?.available?e===`issues`?t.issues:t.prs:[],[t,e]),h=(0,J.useMemo)(()=>p?Ne(p,m):null,[p,m]),g=en({view:e,gh:t,activeFilter:r,isAssignedFilter:i,taskFilter:o,taskNumbers:u,runsQuery:s,backedQuery:d,filterHits:p,filterSearch:f});return{backedQuery:d,filterSearch:f,fullList:m,filterRows:h,filterGate:g,openItems:(0,J.useMemo)(()=>g?[]:h??m,[g,h,m]),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}:p?{includeNumbers:new Set(p.map(e=>e.number))}:{},[e,r,u,t?.viewerLogin,p])}}function en({view:e,gh:t,activeFilter:n,isAssignedFilter:r,taskFilter:i,taskNumbers:a,runsQuery:o,backedQuery:s,filterHits:c,filterSearch:l}){return t?.available?(r||e===`prs`&&n===`mine`)&&!t.viewerLogin?{kind:`blocked`,message:`GitHub login unavailable, so this filter cannot be applied.`}:i&&!a?o.isError?{kind:`blocked`,message:`The task list is unavailable, so this filter cannot be applied.`}:{kind:`loading`,message:`Loading tasks…`}:s!==null&&!c?l.data?.available===!1?{kind:`blocked`,message:`GitHub could not be searched: ${l.data.reason??`unknown reason`}.`}:l.isError?{kind:`blocked`,message:`GitHub could not be searched: ${l.error instanceof Error?l.error.message:`the search request failed`}.`}:{kind:`loading`,message:`Searching GitHub…`}:null:null}function tn(e,t){return t?C(t.kind,t.number,{refresh:!0}).then(n=>(e.setQueryData(t.key,n),!0)).catch(()=>!1):Promise.resolve(!0)}function nn(e,t,n,{filterGate:r,filterRows:i,fullList:o}){let s=a.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&&!o.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 rn(e,t,n,{fullList:r,filterRows:i},o){let c=v(),l=(0,J.useRef)(null),u=e===`issues`?`issue`:`pr`,d=t?.available===!0&&n!==null&&Number.isSafeInteger(n)&&n>0&&!r.some(e=>e.number===n)&&!i?.some(e=>e.number===n)&&o===null,f=s(u,n??0,d),p=d&&f.data?.available&&f.data.item?.kind===u?f.data.item:null;l.current=d&&n!==null?{kind:u,number:n,key:a.githubItem(u,n)}:null;let[m,h]=(0,J.useState)(!1);return{exactWanted:d,exactItem:f,exactDetail:p,exactTargetRef:l,retryingExact:m,retryExact:()=>{h(!0),tn(c,l.current).then(e=>{h(!1),e||w(`Could not reach GitHub for #${n}`,{tone:`danger`})})}}}function an(e,t,n){let r=v(),i=(0,J.useRef)(null);return{refresh:g({mutationFn:e=>(tn(r,e),y({refresh:!0,limit:50})),onSuccess:async o=>{await r.cancelQueries({queryKey:a.githubPages(50),exact:!0}),r.setQueryData(a.githubPages(50),{pages:[o],pageParams:[{}]}),r.invalidateQueries({queryKey:a.githubChecks(t)});let s=e===`issues`?`issue`:`pr`,c=(e===`issues`?o.issues:o.prs).map(e=>e.number),l=a.githubCommentCounts(s,c);r.removeQueries({queryKey:a.githubCommentCounts(s,[]).slice(0,4),predicate:e=>e.queryHash!==b(l)}),o.available&&o.commentsDeferred&&c.length>0&&E(s,c,{refresh:!0}).then(e=>r.setQueryData(l,e)).catch(()=>{}),r.invalidateQueries({queryKey:a.githubSearch(e===`issues`?`issue`:`pr`,n)}),r.invalidateQueries({queryKey:a.githubSearch(`pr`,Re)}),r.invalidateQueries({queryKey:a.githubSearch(`pr`,Je)});let u=i.current,d=a.githubComments(`issue`,0).slice(0,3);if(!u){r.removeQueries({queryKey:d});return}let f=a.githubComments(u.kind,u.number);x(u.kind,u.number,{refresh:!0}).then(e=>r.setQueryData(f,e)).catch(()=>{}),r.removeQueries({queryKey:d,predicate:e=>e.queryHash!==b(f)})},onError:e=>w(e.message,{tone:`danger`})}),openThreadRef:i}}var on=350;function sn(e,t){let[n,r]=(0,J.useState)(e);return(0,J.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function cn(e,t,{query:n,labelFilter:r,effectiveAssignees:i,activeProject:a},{openItems:o,narrow:s,filterGate:c}){let u=sn(n,on),d=(0,J.useMemo)(()=>q(o,{query:u,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),[o,u,r,e,i,a,s]),f=n.trim()===u.trim(),p=t?.available===!0&&!c&&f&&tt(u,d),m=l(e===`issues`?`issue`:`pr`,u,p),h=q(o,{query:n,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),g=p&&m.data?.available?m.data:null,_=new Set(h.map(e=>e.number)),v=ln(e,g,a,i);return{debouncedQuery:u,searchWanted:p,forgeSearch:m,items:h,searchPayload:g,metadataFailure:v,searchHits:g&&!v?q(g.items,{labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}).filter(e=>!_.has(e.number)):[],...un(n,f,p,m)}}function ln(e,t,n,r){return e===`issues`&&t?n&&t.items.some(e=>e.projectIds===void 0)?t.projectsReason??`Project board data is incomplete. Refresh to try again.`:r.length&&t.items.some(e=>e.assignees===void 0)?`Assignee data is incomplete. Refresh to try again.`:null:null}function un(e,t,n,r){return{searching:e.trim()!==``&&!t||n&&r.isPending,searchFailed:n&&(r.data?.available===!1||r.isError),searchFailureReason:r.data?.available===!1?r.data.reason??`unknown reason`:r.error instanceof Error?r.error.message:`the search request failed`}}function dn({view:e,changes:t=!1,index:n=!1}){let{n:i}=ee(),a=qt(e),{rawFilterParam:o,activeFilter:s,narrows:c}=a,l=o!==null||c!==``,u=xe(),{pages:d,data:f}=m(50),p=Pe(),h=pn(),g=lt(),_=fn({index:n,isDesktop:u,listInUrl:l,n:i,rememberedView:r().data?.githubView}),[v,y]=(0,J.useState)(null),b=Yt(e,f,a),x=$t(e,f,a,b.isAssignedFilter),S=cn(e,f,b,x),C=nn(e,i,S.forgeSearch,x),w=rn(e,f,C.selectedNumber,x,C.remoteDetail),T=Gt(e,d,f,C.selectedNumber,S.searchHits,x.openItems),{refresh:E,openThreadRef:D}=an(e,T.checkPrNumbers,S.debouncedQuery),te=Vt(e,d,f,x.backedQuery,b.narrowing),ne=Kt(f?.available?f.repo:void 0);if(_.restorePrs)return(0,Y.jsx)(ge,{to:`/github/prs`,replace:!0});if(!f)return d.isError?(0,Y.jsx)(U,{route:`github`,density:`empty`,children:(0,Y.jsx)(W,{icon:(0,Y.jsx)(j,{size:16}),tone:`danger`,title:`Could not load GitHub`,subtitle:d.error.message})}):(0,Y.jsx)(Ke,{});D.current=null;let O=()=>E.mutate(w.exactTargetRef.current);if(_.filterScreen&&f.available)return(0,Y.jsx)(Ct,{onRefresh:O,refreshing:E.isPending});if(!f.available)return(0,Y.jsx)(vn,{reason:f.reason,refreshing:E.isPending,onRetry:O});let{labelColors:k,labelOptions:re}=mn(f,S.searchPayload,x.openItems,x.fullList),ie=hn({number:C.selectedNumber,fullList:x.fullList,filterRows:x.filterRows,remoteDetail:C.remoteDetail,exactDetail:w.exactDetail}),ae=i===void 0?[...S.items,...S.searchHits].find(e=>e.url===v)??null:null,A=ie??ae;D.current=A?{kind:A.kind,number:A.number}:null;let{linkFilter:oe,listPath:M}=gn(e,o,s,u,c),N={view:e,filter:oe,narrows:c,colors:k,expandedUrl:ae?.url??null,onToggle:e=>y(t=>t===e.url?null:e.url),queued:g.queued,checksMap:T.checksMap,commentsOf:T.commentsOf,taskOf:ne,referenceWidth:At([...S.items,...S.searchHits])},se=_n(e,b,x.filterGate,S),P=wt({view:e,activeFilter:s,isDesktop:u,listInUrl:l,n:i,gh:f,actions:{automationsAvailable:p,refreshing:E.isPending,onRefresh:O}});return i===void 0?(0,Y.jsxs)(U,{route:`github`,density:be(S.items.length+S.searchHits.length),headerSpacing:`compact`,className:`pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-4`,bodyClassName:`gap-2.5`,header:P,children:[(0,Y.jsxs)(`header`,{"data-slot":`gh-header`,className:`flex shrink-0 flex-col gap-3 bg-background md:gap-4`,children:[(0,Y.jsx)(yn,{view:e,isDesktop:u,gh:f,onSaveView:h}),(0,Y.jsx)(bn,{view:e,gh:f,filters:b,labelOptions:re,labelColors:k,searchPayload:S.searchPayload})]}),(0,Y.jsx)(Cn,{view:e,rows:N,verdict:se,search:S,sidebar:x,list:d,paging:te})]}):(0,Y.jsx)(U,{route:`github`,density:`full`,headerSpacing:`compact`,className:`pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-4`,header:P,children:(0,Y.jsx)(On,{view:e,selected:ie,selectedNumber:C.selectedNumber,exact:w,repo:f.repo,rows:N,listPath:M,changes:t,handToAgent:g})})}function fn({index:e,isDesktop:t,listInUrl:n,n:r,rememberedView:i}){return{filterScreen:e&&!t&&!n&&r===void 0,restorePrs:e&&t&&!n&&i===`prs`}}function pn(){let e=v();return t=>{e.setQueryData(a.uiState,e=>({...e,githubView:t})),S({githubView:t}).then(t=>e.setQueryData(a.uiState,t)).catch(t=>{w(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:a.uiState})})}}function mn(e,t,n,r){return{labelColors:{...t?.labelColors,...e.labelColors},labelOptions:et([...n,...r,...t?.items??[]])}}function hn({number:e,fullList:t,filterRows:n,remoteDetail:r,exactDetail:i}){return e===null?null:t.find(t=>t.number===e)??n?.find(t=>t.number===e)??r??i??null}function gn(e,t,n,r,i){let a=t===null?null:n;return{linkFilter:a,listPath:We(e,a??(e===`issues`&&!r?`all`:null),void 0,``,i)}}function _n(e,{query:t,filtering:n},r,{searching:i,searchFailed:a,searchFailureReason:o,metadataFailure:s,searchHits:c,searchPayload:l,items:u}){let d=e===`issues`?`issues`:`pull requests`;return r?(0,Y.jsxs)(`p`,{role:`status`,className:`flex items-center gap-1.5`,"data-slot":`gh-filter-gate`,"data-kind":r.kind,children:[r.kind===`loading`?(0,Y.jsx)(F,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):null,r.message]}):n?i?(0,Y.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(F,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,t.trim(),`”…`]}):a?c.length>0?(0,Y.jsxs)(`p`,{role:`status`,children:[`Showing previous results. GitHub could not be refreshed: `,o,`. Use Refresh to try again.`]}):u.length>0?(0,Y.jsxs)(`p`,{children:[`GitHub could not be searched: `,o,`.`]}):(0,Y.jsxs)(`p`,{children:[`No open `,d,` match your filter, and GitHub could not be searched: `,o,`.`]}):s?(0,Y.jsxs)(`p`,{role:`status`,children:[`Cannot apply the selected filters to GitHub results: `,s]}):c.length>0?null:l?.truncated?(0,Y.jsx)(`p`,{children:`No matches within GitHub’s first matches. Narrow your search to check more specific results.`}):l&&u.length>0?(0,Y.jsxs)(`p`,{children:[`No additional `,d,` match your filter on GitHub.`]}):l?(0,Y.jsxs)(`p`,{children:[`No `,d,` match your filter — open, closed or merged.`]}):(0,Y.jsxs)(`p`,{children:[`No open `,d,` match your filter.`]}):(0,Y.jsxs)(`p`,{children:[`No open `,d,`.`]})}function vn({reason:e,refreshing:t,onRetry:n}){return(0,Y.jsx)(U,{route:`github`,density:`empty`,children:(0,Y.jsx)(W,{icon:(0,Y.jsx)(ie,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:e??`unknown reason`,actions:(0,Y.jsx)(I,{variant:`outline`,"data-action":`gh-retry`,disabled:t,onClick:n,children:`Try again`}),children:(0,Y.jsxs)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[`The tab needs the `,(0,Y.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,Y.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in Squawk works without it.`]})})})}function yn({view:e,isDesktop:t,gh:n,onSaveView:r}){return(0,Y.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`flex min-h-11 flex-wrap items-center gap-3`,children:[(0,Y.jsxs)(dt,{to:t?`/github`:`/github?filter=all`,active:e===`issues`,onClick:()=>r(`issues`),children:[`Issues · `,n.issuesTotal??n.issues.length]}),(0,Y.jsxs)(dt,{to:`/github/prs`,active:e===`prs`,onClick:()=>r(`prs`),children:[`Pull requests · `,n.prsTotal??n.prs.length]})]})}function bn({view:e,gh:t,filters:n,labelOptions:r,labelColors:i,searchPayload:a}){return(0,Y.jsxs)(`div`,{"data-slot":`gh-filter-toolbar`,className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`div`,{className:`relative min-w-0 basis-full md:flex-1 md:basis-auto`,children:[(0,Y.jsx)(ae,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,Y.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:e===`issues`?`Filter issues…`:`Filter pull requests…`,value:n.query,onChange:e=>n.setQuery(e.target.value),className:`min-h-11 w-full rounded-lg border border-card-edge bg-card shadow-card py-1 pr-2.5 pl-8 text-[13px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,Y.jsx)(jn,{options:r,colors:i,selected:n.labelFilter,onChange:n.setLabelFilter}),e===`issues`?(0,Y.jsx)(St,{data:{...t,issues:[...t.issues,...a?.items??[]]},assignees:n.effectiveAssignees,projectId:n.activeProject,onAssigneesChange:n.changeAssignees,onProjectChange:n.setProjectFilter}):null,(0,Y.jsx)(`button`,{type:`button`,disabled:!n.filtering,"data-slot":`gh-clear-filters`,className:`min-h-11 min-w-11 rounded-md border border-input bg-card px-3 text-sm font-medium text-foreground transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:border-border disabled:bg-transparent disabled:text-muted-foreground`,onClick:n.clearFilters,children:`Clear filters`})]})}function xn(e,t){return e.kind===`pr`?t?.[e.number]??e.checks:e.checks}function Sn(e,t,n=!1){return(0,Y.jsx)(Mt,{item:e,view:t.view,filter:t.filter,narrows:t.narrows,colors:t.colors,expanded:t.expandedUrl===e.url,onToggle:()=>t.onToggle(e),queuedRunId:t.queued.get(e.url)??null,checks:xn(e,t.checksMap),comments:t.commentsOf(e),status:kt(e,n),task:t.taskOf(e),referenceWidth:t.referenceWidth})}function Cn({view:e,rows:t,verdict:n,search:r,sidebar:i,list:a,paging:o}){let{items:s,searchHits:c}=r;return(0,Y.jsxs)(`section`,{ref:o.setListEl,"data-slot":`gh-list`,className:`relative flex w-full min-w-0 flex-col rounded-lg border border-card-edge bg-card shadow-card p-3`,children:[s.length===0?n&&(0,Y.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-muted-foreground`,children:n}):(0,Y.jsx)(wn,{items:s,rows:t,paging:o}),o.pagingAvailable?(0,Y.jsx)(Tn,{view:e,list:a,paging:o}):null,(0,Y.jsx)(En,{backedQuery:i.backedQuery,filterSearch:i.filterSearch}),s.length>0&&r.searchWanted&&n?(0,Y.jsx)(`div`,{"data-slot":`gh-search-status`,role:`status`,className:`px-4 py-4 text-sm text-muted-foreground`,children:n}):null,c.length>0?(0,Y.jsx)(Dn,{hits:c,searchPayload:r.searchPayload,rows:t}):null]})}function wn({items:e,rows:t,paging:n}){let{setRowsEl:r,scrollOwner:i,listEl:a,scrollOwnerRef:o,startMargin:s}=n,c=(0,J.useRef)(null),l=(0,J.useRef)(!1);(0,J.useEffect)(()=>{if(l.current||!i)return;l.current=!0;let n=e.findIndex(e=>e.url===t.expandedUrl);n>=0&&c.current?.scrollToIndex(n,{align:`start`})},[i,e,t.expandedUrl]);let u=e.map((e,n)=>(0,Y.jsx)(`div`,{role:`listitem`,"data-slot":`gh-row-item`,"data-divided":n>0||void 0,children:Sn(e,t)},e.url));return(0,Y.jsx)(`div`,{ref:r,"data-slot":`gh-rows`,"data-virtualized":i?`true`:void 0,role:`list`,children:i?(0,Y.jsx)(Ge,{ref:c,scrollRef:o,startMargin:s,children:u},i===a?`list`:`main`):u})}function Tn({view:e,list:t,paging:n}){return(0,Y.jsx)(`div`,{ref:n.loadMoreRef,"data-slot":`gh-load-more`,className:`flex min-h-6 items-center justify-center gap-1.5 px-4 pb-3 text-xs text-muted-foreground`,children:t.isFetchingNextPage?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(F,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Loading more…`]}):t.isFetchNextPageError?(0,Y.jsxs)(Y.Fragment,{children:[`Could not load more.`,(0,Y.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-retry`,onClick:()=>void t.fetchNextPage(),className:`font-medium text-accent-text hover:underline`,children:`Retry`})]}):n.manualPaging?(0,Y.jsxs)(Y.Fragment,{children:[`Filters cover the loaded `,e===`issues`?`issues`:`pull requests`,`.`,(0,Y.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-manual`,onClick:()=>void t.fetchNextPage(),className:`font-medium text-accent-text hover:underline`,children:`Load more`})]}):null})}function En({backedQuery:e,filterSearch:t}){return e!==null&&t.data?.available&&t.data.truncated?(0,Y.jsxs)(`div`,{"data-slot":`gh-filter-note`,role:`status`,className:`px-4 py-3 text-xs text-muted-foreground`,children:[`Showing the first `,t.data.items.length,` matches from GitHub search; more may exist.`]}):null}function Dn({hits:e,searchPayload:t,rows:n}){let r=(0,J.useRef)(null),i=(0,J.useRef)(!1);(0,J.useEffect)(()=>{i.current||(i.current=!0,(r.current?.querySelector(`[data-slot="gh-row"][aria-expanded="true"]`))?.scrollIntoView({block:`start`}))},[]);let a=u();return(0,Y.jsx)(ne,{projectId:a,requests:a?e.map(e=>({projectId:a,kind:e.kind===`pr`?`PR`:`Issue`,number:e.number})):[],children:(0,Y.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,Y.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-xs font-medium tracking-wide text-muted-foreground uppercase`,children:[`Found on GitHub`,t?.truncated?` (first matches)`:``]}),(0,Y.jsx)(`ul`,{ref:r,className:`flex flex-col gap-0.5 px-2 pb-2`,children:e.map(e=>(0,Y.jsx)(`li`,{children:Sn(e,n,!0)},e.url))})]})})}function On({view:e,selected:t,selectedNumber:n,exact:r,repo:i,rows:a,listPath:o,changes:s,handToAgent:c}){let{exactWanted:l,exactItem:u}=r;return(0,Y.jsxs)(`section`,{"data-slot":`gh-detail`,className:`flex w-full min-w-0 flex-col rounded-lg border border-card-edge bg-card shadow-card`,children:[t?null:(0,Y.jsx)(`div`,{className:`px-4 pt-4 md:px-7 md:pt-5`,children:(0,Y.jsx)($e,{backLink:{to:o}})}),t?(0,Y.jsx)(kn,{item:t,repo:i,rows:a,listPath:o,changes:s,handToAgent:c}):l&&u.isPending?(0,Y.jsx)(`div`,{"data-slot":`gh-detail-loading`,className:`flex flex-1 flex-col`,children:(0,Y.jsx)(W,{icon:(0,Y.jsx)(F,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:`h2`,title:`Loading #${n}…`,subtitle:`It is not among the open items, so the tab is asking GitHub for it.`})}):l&&(u.isError||u.data?.available===!1)?(0,Y.jsx)(An,{number:n,exact:r}):(0,Y.jsx)(Et,{view:e,number:n})]})}function kn({item:e,repo:t,rows:n,listPath:r,changes:i,handToAgent:a}){let{workflows:o,skillList:s,workflow:c,setWorkflow:l,selectedSkills:u,setSelectedSkills:d,engine:f,setEngine:p,queued:m,onQueued:h}=a,g=D().state?.focusHandoff===!0;return(0,J.useEffect)(()=>{g&&$()},[g,e.url]),(0,Y.jsx)(rt,{item:e,comments:n.commentsOf(e),afterHeading:e.kind===`issue`?(0,Y.jsx)(ft,{number:e.number,repo:t},e.url):void 0,backLink:{to:r},subNav:{filter:n.filter,narrows:n.narrows,changes:i},onRunAgent:$,headerAction:(0,Y.jsx)(Ht,{item:e,queuedRunId:m.get(e.url)??null}),colors:n.colors,checks:xn(e,n.checksMap),children:(0,Y.jsx)(at,{item:e,workflows:o.data?.workflows??[],skills:s,workflow:c,onWorkflowChange:l,selectedSkills:u,onSkillsChange:d,engine:f,onEngineChange:p,queuedRunId:m.get(e.url)??null,onQueued:h},e.url)})}function An({number:e,exact:t}){let{exactItem:n,retryingExact:r,retryExact:i}=t;return(0,Y.jsx)(W,{icon:(0,Y.jsx)(j,{size:16}),tone:n.isError?`danger`:`neutral`,heading:`h2`,title:`Could not load #${e}`,subtitle:n.data?.available===!1?n.data.reason:n.error instanceof Error?n.error.message:`The request failed.`,actions:(0,Y.jsx)(I,{variant:`outline`,disabled:r,onClick:i,children:`Retry`})})}function jn({options:e,colors:t,selected:n,onChange:r}){let[i,a]=(0,J.useState)(!1),o=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,Y.jsxs)(B,{open:i,onOpenChange:a,children:[(0,Y.jsx)(R,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:k(`inline-flex min-h-11 min-w-11 shrink-0 items-center gap-1.5 rounded-md border border-input bg-card px-3 text-sm font-medium text-foreground transition-colors hover:bg-muted disabled:opacity-60`,n.length>0&&`border-accent-strong/60 text-foreground`),children:[n.length>0?`Labels · ${n.length}`:`Labels`,(0,Y.jsx)(P,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-muted-foreground`})]})}),(0,Y.jsx)(z,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,Y.jsxs)(Ee,{children:[(0,Y.jsx)(Se,{placeholder:`Filter labels…`}),(0,Y.jsxs)(Te,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Y.jsx)(we,{children:`No labels.`}),n.length>0?(0,Y.jsxs)(Ce,{value:`__clear__`,onSelect:()=>r([]),className:`min-h-11 text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let r=n.includes(e);return(0,Y.jsxs)(Ce,{value:e,onSelect:()=>o(e),className:`min-h-11`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`gh-label-dot`,className:`size-2.5 shrink-0 rounded-full ring-1 ring-foreground/30`,style:it(t[e])}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,Y.jsx)(M,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e)})]})]})})]})}export{dn as GithubRoute};
|
package/web/dist/assets/{global-activity-route-Dijwg4OL.js → global-activity-route-j37l-BQU.js}
RENAMED
|
@@ -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{vt as r,xt as i}from"./queries-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{vt as r,xt as i}from"./queries-D9mg7sFY.js";import{n as a,p as o}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as s}from"./dist-CCX8mhHc.js";import{A as c,C as l,D as u,F as d,I as f,L as p,M as m,N as h,O as g,P as _,R as ee,S as v,T as y,_ as b,a as x,b as S,c as te,d as ne,f as re,g as ie,h as ae,i as oe,j as se,k as ce,l as le,m as ue,n as de,o as fe,p as pe,r as me,s as C,t as w,u as T,v as E,w as D,x as O,y as k}from"./activity-motion-CYdEr0hu.js";import{t as A}from"./button-BV_AiLj2.js";import{a as j,f as M,n as N,t as P}from"./page-shell-BdjH5hyc.js";import{i as F}from"./project-order-AcHI4Dcl.js";import{En as I}from"./index-DkQ5xrLr.js";var L=e(t(),1),R=(e,t)=>({x0:Math.min(e.x,t.x),y0:Math.min(e.y,t.y),x1:Math.max(e.x,t.x),y1:Math.max(e.y,t.y)});function z(e,t,n=1){return t.some(t=>t.x+n<e.x1&&e.x0<t.x+t.w-n&&t.y+n<e.y1&&e.y0<t.y+t.h-n)}var he=(e,...t)=>e.filter(e=>!t.some(t=>ge(e,t))),ge=(e,t)=>e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h,B=e=>Math.round(e*10)/10,V=e=>`${B(e.x)} ${B(e.y)}`;function _e(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.x===n.x&&e.y===n.y)continue;let r=t[t.length-2];r&&e&&(r.x===e.x&&e.x===n.x||r.y===e.y&&e.y===n.y)&&t.pop(),t.push(n)}return t}function ve(e,t=8){let n=_e(e),r=n[0];if(!r)return``;let i=`M${V(r)}`;for(let e=1;e<n.length;e++){let r=n[e],a=n[e-1],o=n[e+1];if(!o){i+=` L ${V(r)}`;continue}let s=Math.min(t,Math.hypot(r.x-a.x,r.y-a.y)/2,Math.hypot(o.x-r.x,o.y-r.y)/2),c=(e,t,n)=>{let r=Math.hypot(t.x-e.x,t.y-e.y)||1;return{x:e.x+(t.x-e.x)/r*n,y:e.y+(t.y-e.y)/r*n}};i+=` L ${V(c(r,a,s))} Q ${V(r)}, ${V(c(r,o,s))}`}return i}function H(e,t,n){let r=[];for(let i of[...e].sort((e,n)=>t(e)-t(n))){let e=r[r.length-1];e&&Math.abs(t(i)-e.from)<=2?e.to=Math.max(e.to,n(i)):r.push({from:t(i),to:n(i)})}return r}function ye(e){return{rows:H(e,e=>e.y,e=>e.y+e.h).map(({from:e,to:t})=>({top:e,bottom:t})),cols:H(e,e=>e.x,e=>e.x+e.w).map(({from:e,to:t})=>({left:e,right:t}))}}var U=(e,t,n)=>Math.max(0,e.findIndex(e=>Math.abs(t(e)-n)<=2)),W=(e,t)=>((e.rows[t]?.bottom??0)+(e.rows[t+1]?.top??(e.rows[t]?.bottom??0)+16))/2;function be(e,t,n){let r=e.cols,i=e=>((r[e]?.right??0)+(r[e+1]?.left??0))/2;return t<n?i(t):t>n?i(t-1):t+1<r.length?i(t):t>0?i(t-1):(r[t]?.right??0)+8}function xe(e,t,n,r=0){let i=ye(n),a=U(i.rows,e=>e.top,e.y),o=U(i.rows,e=>e.top,t.y),s=o>a,c=e.x+e.w/2+r,l=t.x+t.w/2+r,u=(s?W(i,a):W(i,a-1))+r/2,d=(s?W(i,o-1):W(i,o))+r/2,f=be(i,U(i.cols,e=>e.left,e.x),U(i.cols,e=>e.left,t.x))+r/2,p={x:c,y:s?e.y+e.h+1:e.y-1},m={x:l,y:s?t.y-3:t.y+t.h+3};return{points:[p,{x:c,y:u},{x:f,y:u},{x:f,y:d},{x:l,y:d},m],label:{x:(c+f)/2,y:u}}}function Se(e){let t=new Map;for(let n of e){let e=[n.senderRunId,n.recipientRunId].sort().join(`
|
|
2
2
|
`);t.set(e,[...t.get(e)??[],n.requestId])}let n=new Map;for(let e of t.values())e.forEach((t,r)=>n.set(t,(r-(e.length-1)/2)*12));return n}function Ce(e,t,n,r=4){let i=[],a=new Map;for(let{id:o,at:s}of e){let e={...s};for(let a=0;a<=i.length;a++){let a=i.find(n=>Math.abs(e.x-n.x)<t.w+r&&Math.abs(e.y-n.y)<t.h+r);if(!a)break;n===`x`?e.x=a.x+t.w+r:e.y=a.y+t.h+r}i.push(e),a.set(o,e)}return a}var G=e=>Math.round(e*10)/10,K=e=>`${G(e.x)} ${G(e.y)}`;function we(e,t,n=[],r=0){let i=e.x+e.w/2+r,a=t.x+t.w/2+r;if(t.y>=e.y+e.h||t.y+t.h<=e.y){let o=t.y>e.y,s=o?e.y+e.h+1:e.y-1,c=o?t.y-3:t.y+t.h+3,l=(c-s)/2;if(z(R({x:i,y:s},{x:a,y:c}),he(n,e,t))){let i=xe(e,t,n,r);return{d:ve(i.points),label:i.label}}return{d:`M${K({x:i,y:s})} C ${K({x:i,y:s+l})}, ${K({x:a,y:c-l})}, ${K({x:a,y:c})}`,label:{x:(i+a)/2,y:(s+c)/2}}}let o=e.y-1,s=t.y-1,c=Math.min(o,s),l=Math.max(8,Math.min(30,18+Math.abs(a-i)*.05)+r);return{d:`M${K({x:i,y:o})} C ${K({x:i,y:c-l})}, ${K({x:a,y:c-l})}, ${K({x:a,y:s-3})}`,label:{x:(i+a)/2,y:c-l*.75}}}function Te(e,t){return{x:e.left-t.left,y:e.top-t.top,w:e.width,h:e.height}}function Ee(e,t){if(!t||t.length===0)return[...e];let n=new Map(t.map((e,t)=>[e,t])),r=e.filter(e=>n.has(e.projectId)),i=e.filter(e=>!n.has(e.projectId));return r.sort((e,t)=>(n.get(e.projectId)??0)-(n.get(t.projectId)??0)),[...r,...i]}function De(e){let t=[],n=[];for(let r of e)v(r)===void 0&&r.tasks.length===0?n.push(r):t.push(r);return{panels:t,idle:n}}function Oe(e){let t=new Set(e.tasks.map(e=>e.runId));return e.requests.filter(e=>e.relationship===`peer`&&t.has(e.senderRunId)&&t.has(e.recipientRunId))}function ke(e,t){let n=new Set(e.map(e=>e.runId));return t.filter(e=>n.has(e.waiterRunId)&&n.has(e.peerRunId))}function Ae(e){let t=e.tasks.length,n=e.tasks.reduce((e,t)=>e+t.workers.filter(e=>m(e.status)).length,0),r=[`${t} active task${t===1?``:`s`}`];return n>0&&r.push(`${n} worker${n===1?``:`s`}`),r.join(` · `)}function je(e,t){let n=t?`more `:``;return e===1?`1 ${n}project has no active work:`:`${e} ${n}projects have no active work:`}var q=n(),Me={w:104,h:20};function Ne(e){let t=e.getBoundingClientRect(),n=new Map;for(let r of e.querySelectorAll(`[data-activity-pill]`)){let e=r.getAttribute(`data-activity-pill`);e&&n.set(e,Te(r.getBoundingClientRect(),t))}return n}function Pe(e,t,n=[]){let r=Ne(e),i=[...r.values()],a=[...t.map(e=>({requestId:e.requestId,senderRunId:e.senderRunId,recipientRunId:e.recipientRunId,kind:`peer`})),...n.map(e=>({...re(e),kind:`wait`}))],o=Se(a),s=[];for(let e of a){let t=r.get(e.senderRunId),n=r.get(e.recipientRunId);t&&n&&s.push({id:e.requestId,kind:e.kind,...we(t,n,i,o.get(e.requestId))})}let c=Ce(s.map(e=>({id:e.id,at:e.label})),Me,`x`);return s.map(e=>({...e,label:c.get(e.id)??e.label}))}function Fe(e,t){return e.length===t.length&&e.every((e,n)=>e.id===t[n]?.id&&e.d===t[n]?.d&&e.label.x===t[n]?.label.x&&e.label.y===t[n]?.label.y)}var J=`pointer-events-none absolute z-[4] -translate-x-1/2 -translate-y-1/2 rounded-md border bg-background px-1.5 py-px text-xs whitespace-nowrap text-foreground tabular-nums max-md:hidden`;function Ie({arc:e,wait:t,now:n,motion:r}){return(0,q.jsxs)(`span`,{"data-slot":`activity-arc-label`,"data-wait":t.id,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y},className:s(J,`border-dashed border-message-peer-accent`,t.id in r.waitsClosing&&`activity-line-out`),children:[(0,q.jsx)(`span`,{className:`font-semibold text-message-peer-accent`,children:`Waiting`}),` · `,_(f(t.since,n))]})}function Le({arc:e,request:t,now:n,motion:r}){let i=te(r,e.id);return(0,q.jsxs)(`span`,{"data-slot":`activity-arc-label`,"data-request":e.id,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y},className:s(J,i?`border-success`:`border-message-peer-accent`,C(r,e.id)===`fade`&&`activity-line-out`),children:[i?(0,q.jsx)(`span`,{className:`font-semibold text-success`,children:`Replied`}):(0,q.jsx)(`span`,{className:`font-semibold text-message-peer-accent`,children:`Request`}),` · `,_(f(t.createdAt,n))]})}var Re=[],ze=new Set;function Be({arcs:e,waits:t=Re,active:n=ze,layoutKey:r,now:i,motion:a=b,paused:o=!1}){let c=L.useRef(null),l=T(c,L.useCallback(n=>Pe(n,e,t),[e,t]),Fe,`[data-activity-pill]`,r),u=L.useMemo(()=>new Set(l.map(e=>e.id)),[l]),d=ne(a.comets,u,o),f=new Map(e.map(e=>[e.requestId,e])),p=new Map(t.map(e=>[e.id,e])),m=L.useId().replace(/[^a-zA-Z0-9_-]/g,``),h=`activity-arrow-arc-${m}`,g=`activity-ring-arc-${m}`;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`svg`,{ref:c,"data-slot":`activity-arcs`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 z-[3] size-full overflow-visible max-md:hidden`,children:[(0,q.jsxs)(`defs`,{children:[(0,q.jsx)(`marker`,{id:h,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto`,children:(0,q.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-peer-accent`})}),(0,q.jsx)(x,{id:g})]}),l.map(e=>{if(e.kind===`wait`){let t=n.has(e.id);return(0,q.jsx)(`path`,{"data-wait":e.id,"data-kind":`wait`,"data-active":t?`true`:void 0,d:e.d,fill:`none`,strokeDasharray:`0 8`,strokeLinecap:`round`,strokeWidth:t?3:2.2,markerEnd:`url(#${g})`,className:s(`stroke-message-peer-accent`,t?`opacity-100`:`opacity-80`,le(a,e.id))},e.id)}let t=C(a,e.id);return(0,q.jsx)(`path`,{"data-request":e.id,"data-kind":`peer`,"data-phase":t,d:e.d,fill:`none`,strokeDasharray:t===`replied`?void 0:`6 5`,strokeWidth:2,markerEnd:`url(#${h})`,className:s(`stroke-message-peer-accent`,fe(t,e.id in a.opening))},e.id)}),(0,q.jsx)(`g`,{ref:d,"data-slot":`activity-comets`})]}),l.map(e=>{let t=e.kind===`wait`?p.get(e.id):void 0;if(t)return(0,q.jsx)(Ie,{arc:e,wait:t,now:i,motion:a},e.id);let n=f.get(e.id);return n?(0,q.jsx)(Le,{arc:e,request:n,now:i,motion:a},e.id):null})]})}var Y=(e,t)=>`/p/${encodeURIComponent(e)}/tasks/${encodeURIComponent(t)}`,Ve=[],He=`relative z-[1] inline-flex min-h-11 items-center text-[12px] text-message-peer-accent hover:underline focus-visible:outline-2 focus-visible:outline-ring`;function Ue({task:e}){let t=e.workers.filter(e=>m(e.status));return t.length===0?null:(0,q.jsxs)(`div`,{"data-slot":`activity-pill-workers`,className:`mt-1.5 ml-[19px] flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[t.map(e=>(0,q.jsx)(c,{run:e,role:`worker`},e.runId)),(0,q.jsxs)(`span`,{className:`ml-0.5`,children:[t.length,` worker`,t.length===1?``:`s`]})]})}function We({projectId:e,task:t,requests:n,waits:r=Ve,index:i,ctx:o,motion:l=b,linked:u=!1,onHover:g}){let _=h(t,o);return(0,q.jsxs)(`li`,{"data-activity-pill":t.runId,"data-rung":t.rung,"data-action":_.action,"data-linked":u?`true`:void 0,...ae(t.runId,g),className:s(`relative min-w-0 rounded-[10px] border bg-card-2 px-2.5 py-2`,_.action?_.tone===`info`?`border-info/70`:`border-pending/70`:t.rung===`running`&&m(t.status)?`border-status-running/60`:`border-border`,u&&`outline-2 outline-offset-2 outline-message-peer-accent`,t.runId in l.entering&&`activity-card-enter`),children:[(0,q.jsx)(pe,{task:t,motion:l,glow:_.action!==void 0}),(0,q.jsxs)(`div`,{className:`flex items-center gap-[7px]`,children:[(0,q.jsx)(c,{run:t,role:`root`}),(0,q.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[12.5px] font-medium`,children:(0,q.jsx)(a,{to:Y(e,t.runId),className:`after:absolute after:inset-0 after:rounded-[10px] after:content-[''] focus-visible:outline-2 focus-visible:outline-ring`,children:t.title})}),(0,q.jsx)(ce,{rate:t.rate,className:`h-3 w-10`})]}),(0,q.jsxs)(`div`,{className:`mt-[3px] ml-[19px] flex items-center gap-2`,children:[(0,q.jsxs)(`p`,{"data-slot":`activity-pill-line`,className:`min-w-0 flex-1 truncate text-xs text-muted-foreground tabular-nums`,children:[(0,q.jsx)(se,{"data-slot":`activity-verb`,tone:_.tone,className:`font-semibold`,children:_.verb}),_.action&&_.since?(0,q.jsxs)(q.Fragment,{children:[` · `,(0,q.jsx)(`span`,{"data-slot":`activity-pill-age`,title:d(_.since),children:p(f(_.since,o.now))})]}):null,` · `,(0,q.jsx)(`span`,{"data-slot":`activity-main`,className:s(_.mono&&`font-mono text-xs`),children:_.main})]}),_.action?(0,q.jsx)(A,{asChild:!0,size:`sm`,variant:_.action===`answer`?`primary`:`outline`,className:`relative z-[1] px-2 text-[12px]`,children:(0,q.jsx)(a,{"data-slot":`activity-pill-action`,to:Y(e,t.runId),children:_.action===`answer`?`Answer`:`Open task`})}):null]}),(0,q.jsx)(ue,{texts:k(t.runId,n,i,r)}),(0,q.jsx)(Ue,{task:t}),(0,q.jsx)(ie,{runId:t.runId,requests:n,waits:r,index:i,link:a,pathOf:t=>Y(e,t),className:`mt-1 ml-[19px] flex flex-col md:hidden`,linkClassName:He})]})}var X=e=>`/p/${encodeURIComponent(e)}/activity`,Ge=e=>`/p/${encodeURIComponent(e)}/`,Z=`rounded-xl border border-card-edge bg-card shadow-card px-4 pt-3.5 pb-4`,Q=`ml-auto inline-flex items-center text-[12px] text-accent-text hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11`;function $({project:e,headingId:t,detail:n,to:r,label:i}){return(0,q.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,q.jsx)(`h2`,{id:t,className:`min-w-0 truncate text-[14px] font-semibold`,children:e.name}),(0,q.jsx)(`span`,{"data-slot":`activity-panel-detail`,className:`text-[12px] text-muted-foreground`,children:n}),(0,q.jsx)(a,{to:r,className:Q,children:i})]})}function Ke({project:e,notice:t}){let n=L.useId();return(0,q.jsx)(`section`,{"aria-labelledby":n,"data-slot":`activity-panel`,"data-project":e.projectId,"data-notice":`true`,className:Z,children:(0,q.jsx)($,{project:e,headingId:n,detail:t,to:Ge(e.projectId),label:`Open project →`})})}function qe(e,t){return L.useMemo(()=>{let n=new Set(e.requests.map(e=>e.requestId)),r=Object.values(t.closing).filter(t=>t.projectId===e.projectId&&!n.has(t.request.requestId)).map(e=>e.request);return Oe({tasks:e.tasks,requests:[...e.requests,...r]})},[e,t.closing])}function Je({project:e,now:t,motion:n=b,paused:r=!1}){let i=L.useId(),a=L.useMemo(()=>l(e),[e]),o=qe(e,n),c=L.useMemo(()=>O(e.tasks),[e.tasks]),u=L.useMemo(()=>ke(e.tasks,[...c,...E(e.projectId,c,n)]),[e.tasks,e.projectId,c,n]),d=oe(c),f={now:t,titleOf:e=>S(a,e)},p=`${e.tasks.map(e=>e.runId).join(`,`)}:${o.map(e=>e.requestId).join(`,`)}:${u.map(e=>e.id).join(`,`)}`,m=o.length>0||u.length>0;return(0,q.jsxs)(`section`,{"aria-labelledby":i,"data-slot":`activity-panel`,"data-project":e.projectId,className:Z,children:[(0,q.jsx)($,{project:e,headingId:i,detail:Ae(e),to:X(e.projectId),label:`Open project activity →`}),(0,q.jsxs)(`div`,{className:s(`relative mt-3`,m&&`md:mt-1 md:pt-10`),children:[(0,q.jsx)(`ul`,{"data-slot":`activity-pills`,"aria-label":`${e.name} tasks`,className:s(`grid grid-cols-[repeat(auto-fit,minmax(min(100%,300px),1fr))] items-start gap-3.5`,m&&`md:gap-y-11`),children:e.tasks.map(t=>(0,q.jsx)(We,{projectId:e.projectId,task:t,requests:e.requests,waits:c,index:a,ctx:f,motion:n,linked:d.linked.has(t.runId),onHover:d.onHover},t.runId))}),m?(0,q.jsx)(Be,{arcs:o,waits:u,active:d.active,layoutKey:p,now:t,motion:n,paused:r}):null]})]})}function Ye(e){let t=v(e.project);return t===void 0?(0,q.jsx)(Je,{...e}):(0,q.jsx)(Ke,{project:e.project,notice:t})}function Xe({projects:e,belowPanels:t}){return e.length===0?null:(0,q.jsxs)(`p`,{"data-slot":`activity-idle`,className:`text-[12.5px] text-muted-foreground`,children:[je(e.length,t),` `,e.map((e,t)=>(0,q.jsxs)(L.Fragment,{children:[t>0?`, `:null,(0,q.jsx)(a,{to:X(e.projectId),"data-project":e.projectId,className:`text-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:e.name})]},e.projectId))]})}var Ze={kind:`workspace`};function Qe(){let e=i().data?.projects,{order:t}=I();return L.useMemo(()=>e?F(e,t).map(e=>e.id):void 0,[e,t])}function $e(){let e=i().data,t=r(),n=o().state?.activityProjectId,a=e?.bootProject??t.data?.bootProject??null,s=typeof n==`string`&&e?.projects.some(e=>e.id===n&&e.status!==`missing`)?n:a;return{id:s,name:e?.projects.find(e=>e.id===s)?.name,projects:e?.projects}}function et(){let e=ee(Ze),t=$e(),n=Qe(),[r,i]=L.useState(!1),o=w(e.data?.generatedAt,e.dataUpdatedAt),s=e.data?.projects,c=L.useMemo(()=>Ee(s??[],n),[s,n]),l=L.useMemo(()=>De(c),[c]),d=L.useMemo(()=>l.panels.filter(e=>v(e)===void 0),[l.panels]),f=L.useMemo(()=>l.panels.filter(e=>v(e)!==void 0),[l.panels]),p=L.useMemo(()=>c.map(e=>e.projectId),[c]),{motion:m,feed:h,paused:_,reduced:b}=de(e.data,`workspace`),x=d.reduce((e,t)=>e+t.tasks.length,0);return(0,q.jsxs)(j,{route:`activity-global`,density:s?M(x+f.length):`full`,headerSpacing:`compact`,rootProps:{"data-activity-paused":_?`true`:void 0},bodyClassName:`gap-3.5`,header:g({name:`All projects`,now:e.data?o:void 0,updatedAt:e.data?.generatedAt,stale:e.isError,scopeSwitch:(0,q.jsx)(y,{scope:`all`,projects:t.projects,projectId:t.id,projectName:t.name,grouped:r,onToggleGroup:()=>i(e=>!e)})}),sparseFooter:s&&l.panels.length>0?(0,q.jsx)(N,{summary:`${d.length} active ${d.length===1?`project`:`projects`} with live work.`,actions:(0,q.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,q.jsx)(a,{to:`/tasks`,children:`View all tasks`})})}):void 0,children:[s?(0,q.jsx)(u,{summary:D(s),tasksTo:`/tasks`,bumps:m.bumps}):null,e.isPending?(0,q.jsx)(`p`,{"data-slot":`activity-loading`,role:`status`,className:`text-xs text-muted-foreground`,children:`Loading activity…`}):null,e.isError&&!s?(0,q.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-xl border border-border bg-card p-5 text-[13px] text-muted-foreground`,children:[`Could not load activity: `,e.error.message,(0,q.jsx)(A,{size:`sm`,variant:`outline`,onClick:()=>void e.refetch(),children:`Retry`})]}):null,s&&l.panels.length===0&&l.idle.length===0?(0,q.jsx)(P,{slot:`activity-empty`,title:`No projects to show.`,description:`Register a project in Workspace tools to monitor live agent work across repositories.`,actions:(0,q.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,q.jsx)(a,{to:`/tools`,children:`Open workspace tools`})})}):null,d.length>0||h.length>0?(0,q.jsx)(me,{projects:d,now:o,global:!0,grouped:r,projectOrder:p,motion:m,feed:h,still:b,paused:_}):null,f.length>0?(0,q.jsx)(`div`,{"data-slot":`activity-panels`,className:`flex flex-col gap-3`,children:f.map(e=>(0,q.jsx)(Ye,{project:e,now:o,motion:m,paused:_||b},e.projectId))}):null,(0,q.jsx)(Xe,{projects:l.idle,belowPanels:l.panels.length>0})]})}export{et as GlobalActivityRoute};
|