@hearsay-tools/squawk 0.18.0-pr4174.8066 → 0.18.0-pr4178.8069

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/dist/contract/conversations.d.ts +0 -2
  2. package/dist/contract/delegation.d.ts +0 -57
  3. package/dist/contract/index.js +144 -187
  4. package/dist/contract/run-predicates.d.ts +0 -9
  5. package/dist/contract/usage-limit-hold.d.ts +0 -7
  6. package/dist/contract/waits.d.ts +2 -2
  7. package/dist/delegation/cli.js +4 -8
  8. package/dist/delegation/cli.js.map +1 -1
  9. package/dist/delegation/conversation-send.js +4 -15
  10. package/dist/delegation/conversation-send.js.map +1 -1
  11. package/dist/delegation/conversations.js +0 -6
  12. package/dist/delegation/conversations.js.map +1 -1
  13. package/dist/delegation/execution-identity.d.ts +9 -53
  14. package/dist/delegation/execution-identity.js +9 -165
  15. package/dist/delegation/execution-identity.js.map +1 -1
  16. package/dist/delegation/park-notice.d.ts +3 -29
  17. package/dist/delegation/park-notice.js +4 -32
  18. package/dist/delegation/park-notice.js.map +1 -1
  19. package/dist/delegation/provision.js +3 -3
  20. package/dist/delegation/provision.js.map +1 -1
  21. package/dist/delegation/routes.d.ts +0 -19
  22. package/dist/delegation/service.d.ts +0 -5
  23. package/dist/delegation/service.js +14 -93
  24. package/dist/delegation/service.js.map +1 -1
  25. package/dist/delegation/transport.d.ts +4 -23
  26. package/dist/delegation/worker-executions.d.ts +0 -2
  27. package/dist/delegation/worker-executions.js +1 -5
  28. package/dist/delegation/worker-executions.js.map +1 -1
  29. package/dist/runs/ports.d.ts +0 -2
  30. package/dist/server/provider-action-gate.js +1 -2
  31. package/dist/server/provider-action-gate.js.map +1 -1
  32. package/dist/server/run-accounts.d.ts +3 -4
  33. package/dist/server/run-accounts.js +5 -20
  34. package/dist/server/run-accounts.js.map +1 -1
  35. package/dist/server/runner-install-routes.d.ts +10 -10
  36. package/dist/server/server.d.ts +58 -72
  37. package/dist/server/server.js +1 -1
  38. package/dist/server/server.js.map +1 -1
  39. package/dist/workflows/continuation-admission.d.ts +0 -7
  40. package/dist/workflows/continuation-admission.js +8 -21
  41. package/dist/workflows/continuation-admission.js.map +1 -1
  42. package/dist/workflows/input-acknowledgement.d.ts +24 -24
  43. package/dist/workflows/run/continuation-acceptance.d.ts +1 -5
  44. package/dist/workflows/run/continuation-acceptance.js +29 -94
  45. package/dist/workflows/run/continuation-acceptance.js.map +1 -1
  46. package/dist/workflows/run/launch-read-resolver.d.ts +0 -6
  47. package/dist/workflows/run/launch-read-resolver.js +2 -13
  48. package/dist/workflows/run/launch-read-resolver.js.map +1 -1
  49. package/dist/workflows/run/run-settlement.js +0 -1
  50. package/dist/workflows/run/run-settlement.js.map +1 -1
  51. package/dist/workflows/run/worker-questions.d.ts +0 -4
  52. package/dist/workflows/run/worker-questions.js +8 -42
  53. package/dist/workflows/run/worker-questions.js.map +1 -1
  54. package/dist/workflows/step-kind-ids.d.ts +9 -0
  55. package/dist/workflows/step-kind-ids.js +10 -0
  56. package/dist/workflows/step-kind-ids.js.map +1 -0
  57. package/dist/workflows/wait-kind-ids.d.ts +11 -0
  58. package/dist/workflows/wait-kind-ids.js +34 -0
  59. package/dist/workflows/wait-kind-ids.js.map +1 -0
  60. package/package.json +4 -4
  61. package/web/dist/assets/{accounts-section-TDhV5kKW.js → accounts-section-D3P_Z-Nu.js} +1 -1
  62. package/web/dist/assets/{activity-motion-BfE9wCn7.js → activity-motion-BW-0k8s7.js} +1 -1
  63. package/web/dist/assets/{activity-route-DSBv6t6R.js → activity-route-Bpgblioe.js} +1 -1
  64. package/web/dist/assets/{agent-config-section-3bIgmLYR.js → agent-config-section-Cj3w7UIn.js} +1 -1
  65. package/web/dist/assets/{agent-defaults-section-Bfu8Tma5.js → agent-defaults-section-BJ4poe9c.js} +1 -1
  66. package/web/dist/assets/{appearance-DPE7X6-a.js → appearance-BUsUTPF0.js} +1 -1
  67. package/web/dist/assets/{archive-on-merge-field-Bx1bEmI8.js → archive-on-merge-field-D_kgBFNv.js} +1 -1
  68. package/web/dist/assets/attention-lvUYNNvV.js +1 -0
  69. package/web/dist/assets/{automation-format-BsnXeUET.js → automation-format-1lHzRTbq.js} +1 -1
  70. package/web/dist/assets/automations-route-CZaUrmDs.js +1 -0
  71. package/web/dist/assets/{cez-idle-Crszm9Ts.js → cez-idle-BY3rjM_y.js} +1 -1
  72. package/web/dist/assets/{commit-diff-panel-CLg6vURE.js → commit-diff-panel-xwLW6Ydr.js} +1 -1
  73. package/web/dist/assets/{diff-DE0Xb0Z5.js → diff-BB8SoL-s.js} +2 -2
  74. package/web/dist/assets/{diff-view-CGETvhPt.js → diff-view-O8lx1ztb.js} +1 -1
  75. package/web/dist/assets/{file-preview-DVQ7eTcT.js → file-preview-BS6M2tBo.js} +1 -1
  76. package/web/dist/assets/{folder-browser-G_9ZgDjg.js → folder-browser-Dsqz0Z1z.js} +1 -1
  77. package/web/dist/assets/{git-toolbar-DOvJwlcb.js → git-toolbar-DoPFA36c.js} +1 -1
  78. package/web/dist/assets/{github-3XgNmHF-.js → github-Bjy3WBvf.js} +1 -1
  79. package/web/dist/assets/{global-activity-route-7aoJOaT9.js → global-activity-route-BXBZKz_9.js} +1 -1
  80. package/web/dist/assets/index-CmadQXcg.js +21 -0
  81. package/web/dist/assets/{label-BWld23ke.js → label-CZp8t0zE.js} +1 -1
  82. package/web/dist/assets/live-protocol-D9ji1YCl.js +64 -0
  83. package/web/dist/assets/{markdown-63jCKOob.js → markdown-KHcncamw.js} +1 -1
  84. package/web/dist/assets/{notifications-section-fQ-nbk6G.js → notifications-section-DD21Sd79.js} +1 -1
  85. package/web/dist/assets/{open-in-menu-D03osLGE.js → open-in-menu-DdKs6X5r.js} +1 -1
  86. package/web/dist/assets/{preview-pane-connected-C_LORmfr.js → preview-pane-connected-BvTZv2SQ.js} +1 -1
  87. package/web/dist/assets/{project-location-BM-6wMI3.js → project-location-B3LBvkz2.js} +1 -1
  88. package/web/dist/assets/{project-router-DtTvMbeA.js → project-router-CIKODSHW.js} +1 -1
  89. package/web/dist/assets/project-scope-context-D1bpJixc.js +4 -0
  90. package/web/dist/assets/{projects-section-WlDXEr2U.js → projects-section-C0k8kyb-.js} +1 -1
  91. package/web/dist/assets/{prompt-templates-section-BrRD9W-C.js → prompt-templates-section-DNkosCni.js} +1 -1
  92. package/web/dist/assets/queries-dHXhD3Hc.js +1 -0
  93. package/web/dist/assets/{reference-chip-DeqB7ZMB.js → reference-chip-BWViAFIN.js} +1 -1
  94. package/web/dist/assets/{remote-settings-notice-Dsz5ly3b.js → remote-settings-notice-DPCENbhz.js} +1 -1
  95. package/web/dist/assets/{repo-git-Bjx30PIk.js → repo-git-jKOnO3ba.js} +1 -1
  96. package/web/dist/assets/{report-reader-BIDMrkji.js → report-reader-DXYiKNcg.js} +1 -1
  97. package/web/dist/assets/{reports-CJmqlXn7.js → reports-DEE0bHNv.js} +1 -1
  98. package/web/dist/assets/{resources-section-C8KZ4hre.js → resources-section-lqXgYTrv.js} +1 -1
  99. package/web/dist/assets/{run-header-BzuB68Yq.js → run-header-CXlUbvDO.js} +1 -1
  100. package/web/dist/assets/runners-CGQjSsir.js +1 -0
  101. package/web/dist/assets/{settings-agent-picker-CSyeml1b.js → settings-agent-picker-BRvZn4kM.js} +1 -1
  102. package/web/dist/assets/{settings-shell-Cni3kHc9.js → settings-shell-DTtd-vIa.js} +1 -1
  103. package/web/dist/assets/{sidebar-section-CCg4QGtg.js → sidebar-section-BFW4ZfBR.js} +1 -1
  104. package/web/dist/assets/{skills-C-in30dy.js → skills-AImMlT1T.js} +1 -1
  105. package/web/dist/assets/{tab-link-Dl5Mmavw.js → tab-link-CM6SDBtV.js} +1 -1
  106. package/web/dist/assets/{task-changes-Bo4ZjMI9.js → task-changes-01Z_ppIw.js} +1 -1
  107. package/web/dist/assets/{task-commits-Ca0v06Ow.js → task-commits-DRNIum3J.js} +1 -1
  108. package/web/dist/assets/{task-files-1XZzDBKI.js → task-files-Crz7Fo3C.js} +1 -1
  109. package/web/dist/assets/{task-github-item-vJHng0ie.js → task-github-item-psG2V47c.js} +1 -1
  110. package/web/dist/assets/task-groups-DF0XoB6U.js +1 -0
  111. package/web/dist/assets/task-thread-Bqg91ZVZ.js +9 -0
  112. package/web/dist/assets/{tasks-table-DUrhAh4g.js → tasks-table-DHTEGteC.js} +1 -1
  113. package/web/dist/assets/{thread-state-CF0SB2iW.js → thread-state-BWJ2YyXo.js} +1 -1
  114. package/web/dist/assets/{use-hand-to-agent-state-B3y26akX.js → use-hand-to-agent-state-DNROQerR.js} +1 -1
  115. package/web/dist/assets/{useInfiniteQuery-BnyaEFle.js → useInfiniteQuery-qJeCNhM7.js} +1 -1
  116. package/web/dist/assets/useQuery-C3CQhXsT.js +1 -0
  117. package/web/dist/assets/{workflows-C6YdW7RT.js → workflows-Cx9lgrEo.js} +1 -1
  118. package/web/dist/assets/{workspace-tools-BDdrgrCg.js → workspace-tools-CVitt3kE.js} +1 -1
  119. package/web/dist/assets/{worktrees-section-DO1e87cC.js → worktrees-section-DxUg4l9n.js} +1 -1
  120. package/web/dist/assets/{ws-Bal5BUy2.js → ws-BisMp6U5.js} +1 -1
  121. package/web/dist/index.html +17 -17
  122. package/web/dist/live-worker.js +1 -1
  123. package/web/dist/assets/attention-otQlgfRj.js +0 -1
  124. package/web/dist/assets/automations-route-YYPPidII.js +0 -1
  125. package/web/dist/assets/index-CYYWiYLX.js +0 -21
  126. package/web/dist/assets/live-protocol-BXzu6cSE.js +0 -64
  127. package/web/dist/assets/project-scope-context-Dgq8_2JZ.js +0 -4
  128. package/web/dist/assets/queries-yuG-mM6_.js +0 -1
  129. package/web/dist/assets/runners-CDw7wLfd.js +0 -1
  130. package/web/dist/assets/task-groups-3jn_VZOd.js +0 -1
  131. package/web/dist/assets/task-thread-Cfgc4Wvc.js +0 -9
  132. package/web/dist/assets/useQuery-BUslvRIM.js +0 -1
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./utils-DSMR_WLb.js";import{$n as a,D as o,H as s,Rr as c,U as l,W as u,Xr as d,Zn as f,Zr as p,an as m,dn as h,er as g,i as _,nr as v,p as y,rn as b,u as x,vn as ee,y as te}from"./project-scope-context-Dgq8_2JZ.js";import{B as S,G as ne,H as C,I as w,K as T,N as E,P as D,V as O,W as k,j as A,z as j}from"./live-protocol-BXzu6cSE.js";import{Gt as M,kt as re,p as ie}from"./queries-yuG-mM6_.js";import{h as ae}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as oe,t as N}from"./label-BWld23ke.js";import{o as se,s as ce}from"./runners-CDw7wLfd.js";import{I as le,Y as ue,c as de,d as fe,it as pe,l as me,pt as he,ut as ge,y as _e}from"./design-icons-CzEoMH9c.js";import{n as ve,r as ye}from"./dist-C28wFbz0.js";import{t as P}from"./button-BQ2y4XRB.js";import{a as F,n as be}from"./dist-BW234Kg5.js";import{a as I,i as xe,n as L,r as R,t as Se}from"./dist-C5mlVBmd.js";import{h as Ce,m as we}from"./dropdown-menu-4e2iKSMT.js";import{a as Te,c as Ee,i as De,l as Oe,n as ke,o as Ae,r as je,t as Me,u as Ne}from"./es2015-CQth82uv.js";import{n as Pe,r as Fe,t as Ie}from"./collapsible-BEV4FO-1.js";import{n as Le,t as Re}from"./switch-Bv2Zf1uU.js";import{a as ze,i as Be,n as Ve,r as He,t as Ue}from"./dist-BAoXdNsT.js";import{c as We,s as Ge,t as z}from"./project-router-DtTvMbeA.js";import{t as Ke}from"./centered-state-V15AR_qo.js";import{$n as qe,Cn as Je,G as Ye,Hn as B,J as Xe,N as Ze,O as Qe,Sn as $e,W as et,gn as tt,k as nt,q as rt,r as it,t as at,yn as ot}from"./index-CYYWiYLX.js";import{_ as st,a as ct,c as lt,d as ut,f as dt,g as ft,h as pt,i as mt,l as ht,m as gt,n as _t,o as vt,p as yt,r as bt,s as xt,t as St,u as Ct,v as wt}from"./automation-format-BsnXeUET.js";import{t as Tt}from"./textarea-vJt9undk.js";function Et(e,[t,n]){return Math.min(n,Math.max(t,e))}var V=e(t(),1),Dt=e(n(),1),H=r(),Ot=[` `,`Enter`,`ArrowUp`,`ArrowDown`],kt=[` `,`Enter`],U=`Select`,[At,jt,Mt]=Ce(U),[W,Nt]=xe(U,[Mt,ze]),Pt=ze(),[Ft,G]=W(U),[It,Lt]=W(U),Rt=`SelectProvider`;function zt(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=Pt(t),[_,v]=V.useState(null),[y,b]=V.useState(null),[x,ee]=V.useState(!1),te=we(l),[S,ne]=Se({prop:r,defaultProp:i??!1,onChange:a,caller:U}),[C,w]=Se({prop:o,defaultProp:s,onChange:c,caller:U}),T=V.useRef(null),E=V.useRef(C);V.useEffect(()=>{let e=m?_?.ownerDocument.getElementById(m):_?.form;if(e instanceof HTMLFormElement){let t=()=>w(E.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,_,w]);let D=!_||!!m||!!_.closest(`form`),[O,k]=V.useState(new Set),A=Oe(),j=Array.from(O).map(e=>e.props.value).join(`;`),M=V.useCallback(e=>{k(t=>new Set(t).add(e))},[]),re=V.useCallback(e=>{k(t=>{let n=new Set(t);return n.delete(e),n})},[]),ie={required:p,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:ee,contentId:A,value:C,onValueChange:w,open:S,onOpenChange:ne,dir:te,triggerPointerDownPosRef:T,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:O,nativeSelectKey:j,isFormControl:D};return(0,H.jsx)(Be,{...g,children:(0,H.jsx)(Ft,{scope:t,...ie,children:(0,H.jsx)(At.Provider,{scope:t,children:(0,H.jsx)(It,{scope:t,onNativeOptionAdd:M,onNativeOptionRemove:re,children:Ln(h)?h(ie):n})})})})}zt.displayName=Rt;var Bt=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,H.jsx)(zt,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,H.jsxs)(H.Fragment,{children:[n,e?(0,H.jsx)(In,{__scopeSelect:t}):null]})})};Bt.displayName=U;var Vt=`SelectTrigger`,Ht=V.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Pt(n),o=G(Vt,n),s=o.disabled||r,c=F(t,o.onTriggerChange),l=jt(n),u=V.useRef(`touch`),[d,f,p]=zn(e=>{let t=l().filter(e=>!e.disabled),n=Bn(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,H.jsx)(Ue,{asChild:!0,...a,children:(0,H.jsx)(I.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Rn(o.value)?``:void 0,...i,ref:c,onClick:R(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:R(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:R(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Ot.includes(e.key)&&(m(),e.preventDefault())})})})});Ht.displayName=Vt;var Ut=`SelectValue`,Wt=V.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=G(Ut,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=F(t,c.onValueNodeChange);L(()=>{l(u)},[l,u]);let f=Rn(c.value);return(0,H.jsx)(I.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,H.jsx)(V.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});Wt.displayName=Ut;var Gt=`SelectIcon`,Kt=V.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,H.jsx)(I.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});Kt.displayName=Gt;var qt=`SelectPortal`,[Jt,Yt]=W(qt,{forceMount:void 0}),Xt=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,H.jsx)(Jt,{scope:e.__scopeSelect,forceMount:n,children:(0,H.jsx)(De,{asChild:!0,...r})})};Xt.displayName=qt;var K=`SelectContent`,Zt=V.forwardRef((e,t)=>{let n=Yt(K,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=G(K,e.__scopeSelect),[o,s]=V.useState();return L(()=>{s(new DocumentFragment)},[]),(0,H.jsx)(Ne,{present:r||a.open,children:({present:e})=>e?(0,H.jsx)(nn,{...i,ref:t}):(0,H.jsx)(Qt,{...i,fragment:o})})});Zt.displayName=K;var Qt=V.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?Dt.createPortal((0,H.jsx)($t,{scope:n,children:(0,H.jsx)(At.Slot,{scope:n,children:(0,H.jsx)(`div`,{ref:t,children:r})})}),i):null});Qt.displayName=`SelectContentFragment`;var q=10,[$t,J]=W(K),en=`SelectContentImpl`,tn=be(`SelectContent.RemoveScroll`),nn=V.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=G(K,n),[y,b]=V.useState(null),[x,ee]=V.useState(null),te=F(t,b),[S,ne]=V.useState(null),[C,w]=V.useState(null),T=jt(n),[E,D]=V.useState(!1),O=V.useRef(!1);V.useEffect(()=>{if(y)return Me(y)},[y]),je();let k=V.useCallback(e=>{let[t,...n]=T().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[T,x]),A=V.useCallback(()=>k([S,y]),[k,S,y]);V.useEffect(()=>{E&&A()},[E,A]);let{onOpenChange:j,triggerPointerDownPosRef:M}=v;V.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(M.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(M.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(y)||j(!1),document.removeEventListener(`pointermove`,t),M.current=null};return M.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,j,M]),V.useEffect(()=>{let e=()=>j(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[j]);let[re,ie]=zn(e=>{let t=T().filter(e=>!e.disabled),n=Bn(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ae=V.useCallback((e,t,n)=>{let r=!O.current&&!n;(v.value!==void 0&&v.value===t||r)&&(ne(e),r&&(O.current=!0))},[v.value]),oe=V.useCallback(()=>y?.focus(),[y]),N=V.useCallback((e,t,n)=>{let r=!O.current&&!n;(v.value!==void 0&&v.value===t||r)&&w(e)},[v.value]),se=r===`popper`?sn:an,ce=se===sn?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,H.jsx)($t,{scope:n,content:y,viewport:x,onViewportChange:ee,itemRefCallback:ae,selectedItem:S,onItemLeave:oe,itemTextRefCallback:N,focusSelectedItem:A,selectedItemText:C,position:r,isPositioned:E,searchRef:re,children:(0,H.jsx)(ke,{as:tn,allowPinchZoom:!0,children:(0,H.jsx)(Te,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:R(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,H.jsx)(Ae,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,H.jsx)(se,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...ce,onPlaced:()=>D(!0),ref:te,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:R(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ie(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=T().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>k(t)),e.preventDefault()}})})})})})})});nn.displayName=en;var rn=`SelectItemAlignedPosition`,an=V.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=G(K,n),o=J(K,n),[s,c]=V.useState(null),[l,u]=V.useState(null),d=F(t,u),f=jt(n),p=V.useRef(!1),m=V.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=V.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-q,d=Et(a,[q,Math.max(q,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-q,d=Et(a,[q,Math.max(q,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-q*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,ee=Math.min(g.offsetHeight*5,x),te=window.getComputedStyle(h),S=parseInt(te.paddingTop,10),ne=parseInt(te.paddingBottom,10),C=e.top+e.height/2-q,w=c-C,T=g.offsetHeight/2,E=g.offsetTop+T,D=m+v+E,O=x-D;if(D<=C){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=D+Math.max(w,T+(e?ne:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(C,m+h.offsetTop+(e?S:0)+T)+O;s.style.height=t+`px`,h.scrollTop=D-C+h.offsetTop}s.style.margin=`${q}px 0`,s.style.minHeight=ee+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);L(()=>y(),[y]);let[b,x]=V.useState();return L(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,H.jsx)(cn,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:V.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,H.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,H.jsx)(I.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});an.displayName=rn;var on=`SelectPopperPosition`,sn=V.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=q,...a}=e,o=Pt(n);return(0,H.jsx)(He,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});sn.displayName=on;var[cn,ln]=W(K,{}),un=`SelectViewport`,dn=V.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=J(un,n),o=ln(un,n),s=F(t,a.onViewportChange),c=V.useRef(0);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,H.jsx)(At.Slot,{scope:n,children:(0,H.jsx)(I.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:R(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-q*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});dn.displayName=un;var fn=`SelectGroup`,[pn,mn]=W(fn),hn=V.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Oe();return(0,H.jsx)(pn,{scope:n,id:i,children:(0,H.jsx)(I.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});hn.displayName=fn;var gn=`SelectLabel`,_n=V.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=mn(gn,n);return(0,H.jsx)(I.div,{id:i.id,...r,ref:t})});_n.displayName=gn;var vn=`SelectItem`,[yn,bn]=W(vn),xn=V.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=G(vn,n),c=J(vn,n),l=s.value===r,[u,d]=V.useState(a??``),[f,p]=V.useState(!1),m=F(t,Ee(e=>c.itemRefCallback?.(e,r,i))),h=Oe(),g=V.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,H.jsx)(yn,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:V.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,H.jsx)(At.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,H.jsx)(I.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:R(o.onFocus,()=>p(!0)),onBlur:R(o.onBlur,()=>p(!1)),onClick:R(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:R(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:R(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:R(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:R(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:R(o.onKeyDown,e=>{i||e.target!==e.currentTarget||c.searchRef?.current!==``&&e.key===` `||(kt.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});xn.displayName=vn;var Sn=`SelectItemText`,Cn=V.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=G(Sn,n),s=J(Sn,n),c=bn(Sn,n),l=Lt(Sn,n),[u,d]=V.useState(null),f=Ee(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=F(t,d,c.onItemTextChange,f),m=u?.textContent,h=V.useMemo(()=>(0,H.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return L(()=>(g(h),()=>_(h)),[g,_,h]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(I.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Rn(o.value)?Dt.createPortal(a.children,o.valueNode):null]})});Cn.displayName=Sn;var wn=`SelectItemIndicator`,Tn=V.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return bn(wn,n).isSelected?(0,H.jsx)(I.span,{"aria-hidden":!0,...r,ref:t}):null});Tn.displayName=wn;var En=`SelectScrollUpButton`,Dn=V.forwardRef((e,t)=>{let n=J(En,e.__scopeSelect),r=ln(En,e.__scopeSelect),[i,a]=V.useState(!1),o=F(t,r.onScrollButtonChange);return L(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,H.jsx)(An,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Dn.displayName=En;var On=`SelectScrollDownButton`,kn=V.forwardRef((e,t)=>{let n=J(On,e.__scopeSelect),r=ln(On,e.__scopeSelect),[i,a]=V.useState(!1),o=F(t,r.onScrollButtonChange);return L(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,H.jsx)(An,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});kn.displayName=On;var An=V.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=J(`SelectScrollButton`,n),o=V.useRef(null),s=jt(n),c=V.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return V.useEffect(()=>()=>c(),[c]),L(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,H.jsx)(I.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:R(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:R(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:R(i.onPointerLeave,()=>{c()})})}),jn=`SelectSeparator`,Mn=V.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,H.jsx)(I.div,{"aria-hidden":!0,...r,ref:t})});Mn.displayName=jn;var Nn=`SelectArrow`,Pn=V.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Pt(n);return J(Nn,n).position===`popper`?(0,H.jsx)(Ve,{...i,...r,ref:t}):null});Pn.displayName=Nn;var Fn=`SelectBubbleInput`,In=V.forwardRef(({__scopeSelect:e,...t},n)=>{let r=G(Fn,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=V.useRef(null),m=F(n,p),h=i??``,g=Le(h),_=Array.from(d).some(e=>(e.props.value??``)===``);return V.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(g!==h&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,h),e.dispatchEvent(t)}},[g,h]),(0,H.jsxs)(I.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...ve,...t.style},ref:m,defaultValue:h,children:[Rn(i)&&!_?(0,H.jsx)(`option`,{value:``}):null,Array.from(d)]},f)});In.displayName=Fn;function Ln(e){return typeof e==`function`}function Rn(e){return e===``||e===void 0}function zn(e){let t=Ee(e),n=V.useRef(``),r=V.useRef(0),i=V.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=V.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return V.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function Bn(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Vn(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Vn(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Hn=A([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),Un=S({includeExisting:D().optional(),authors:E(k()).optional(),assignees:E(k()).optional(),requireCurrentLabels:D().optional(),allLabels:E(k()).optional(),anyLabels:E(k()).optional(),excludeLabels:E(k()).optional(),changedLabels:E(k()).optional(),lookbackDays:j(),maxRecords:j()}),Wn=A([`github`,`schedule`]),Gn=f.omit({task:!0,images:!0,systemPrompt:!0}).extend({prompt:k(),variants:ne([w(1),w(2),w(3)]).optional(),systemPrompt:k().optional()}),Kn=S({at:k(),outcome:A([`launched`,`cancelled`]),runId:k().optional(),receiptId:k().optional(),trigger:A([`schedule`,`late`,`manual`,`retry`]).optional()}),qn=S({id:k(),revision:j(),name:k(),description:k().optional(),enabled:D(),kind:Wn,events:E(Hn).optional(),intervalSeconds:j().optional(),filters:Un.optional(),schedule:lt.optional(),task:Gn,archived:Kn.optional(),createdAt:k(),updatedAt:k()}),Jn=S({timestamp:k(),tieBreaker:k().optional()}),Yn=S({since:k().datetime(),until:k().datetime(),source:j().int().min(0).max(2),page:j().int().min(1).max(10),item:j().int().min(0).max(100),event:j().int().min(0).max(1e3),cursor:Jn.optional()}),Xn={lastError:k().max(1e3).optional(),lastErrorAt:k().datetime().optional()},Zn=S({revision:j().optional(),baselineAt:k().optional(),armedAt:k().optional(),historyScan:Yn.optional(),cursor:Jn.optional(),frozenHighWatermark:Jn.extend({tieBreaker:k()}).optional(),backlogAfter:Jn.extend({tieBreaker:k()}).optional(),nextCheckAt:k().optional(),lastSuccessAt:k().optional(),nextRunAt:k().optional(),lastRunAt:k().optional(),etags:C(k(),k()).optional(),backoffUntil:k().optional(),consecutiveFailures:j().optional(),...Xn,onceOutcome:A([`failed`,`missed`]).optional()});function Qn(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 $n=A([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]),er=S({seq:j(),ts:k(),automationId:k(),revision:j(),event:Hn.optional(),result:$n,reason:k().optional(),durationMs:j().optional(),receiptId:k().optional(),runId:k().optional(),githubNumber:j().optional(),githubTitle:k().optional(),githubUrl:k().optional(),rateLimit:S({bucket:A([`core`,`search`]),remaining:j().optional(),resetAt:k().optional()}).optional()}),tr=S({matches:j(),launched:j(),duplicates:j(),errors:j()}),nr=qn.extend({state:Zn.optional(),latestLog:er.optional(),counts:tr,nextRunAt:k().optional(),onceStatus:yt.optional()});S({available:D(),reason:k().optional(),timeZone:k(),scheduler:S({state:A([`scheduled`,`idle`]),nextDue:k().optional()}),automations:E(nr)}),S({automation:qn}).extend({once:S({dueAt:k(),timeZone:k(),resolvedInstant:k(),note:k()}).optional()}),S({automation:qn,state:Zn.optional(),latestLog:er.optional(),onceStatus:yt.optional()}),S({id:k(),automationId:k(),mode:A([`preview`,`execute`]),status:A([`queued`,`running`,`complete`,`error`]),createdAt:k(),completedAt:k().optional(),matches:j().optional(),truncated:D().optional(),error:k().optional()}),S({checkId:k()}),S({records:E(er)}),S({receiptId:k(),runId:k()}),S({runId:k()}),qn.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0,kind:!0,archived:!0}).extend({kind:Wn.optional(),task:Gn.omit({variants:!0}).strict(),enable:D().optional()}).omit({enable:!0}).extend({enabled:D().optional(),expectedRevision:j()}),S({archived:A([`include`,`only`]).optional()}),S({mode:A([`preview`,`execute`])});function rr({...e}){return(0,H.jsx)(Bt,{"data-slot":`select`,...e})}function ir({...e}){return(0,H.jsx)(Wt,{"data-slot":`select-value`,...e})}function ar({className:e,size:t=`default`,children:n,...r}){return(0,H.jsxs)(Ht,{"data-slot":`select-trigger`,"data-size":t,className:i(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-sm whitespace-nowrap shadow-none transition-[color,box-shadow] outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-11 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 pointer-hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,H.jsx)(Kt,{asChild:!0,children:(0,H.jsx)(me,{className:`size-4 opacity-50`})})]})}function or({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...a}){return(0,H.jsx)(Xt,{children:(0,H.jsxs)(Zt,{"data-slot":`select-content`,className:i(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...a,children:[(0,H.jsx)(cr,{}),(0,H.jsx)(dn,{className:i(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,H.jsx)(lr,{})]})})}function sr({className:e,children:t,...n}){return(0,H.jsxs)(xn,{"data-slot":`select-item`,className:i(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pe-8 ps-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,H.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute end-2 flex size-3.5 items-center justify-center`,children:(0,H.jsx)(Tn,{children:(0,H.jsx)(de,{className:`size-4`})})}),(0,H.jsx)(Cn,{children:t})]})}function cr({className:e,...t}){return(0,H.jsx)(Dn,{"data-slot":`select-scroll-up-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,H.jsx)(fe,{className:`size-4`})})}function lr({className:e,...t}){return(0,H.jsx)(kn,{"data-slot":`select-scroll-down-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,H.jsx)(me,{className:`size-4`})})}function Y({title:e,subtitle:t,action:n,children:r}){return(0,H.jsxs)(`main`,{"data-route":`automations`,className:`task-flow-page w-full max-w-full min-w-0 max-md:p-4!`,children:[(0,H.jsxs)(`header`,{className:`mb-6 flex flex-col items-start gap-5 max-md:mb-4 max-md:gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h1`,{className:`mb-2 text-[28px] font-medium max-md:text-[22px]`,children:e}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),n]}),r]})}function X({text:e}){return(0,H.jsx)(`div`,{role:`status`,className:`rounded-xl border bg-card p-6 text-sm text-muted-foreground`,children:e})}var ur={launched:`success`,manual:`success`,"catch-up":`success`,skipped:`neutral`,missed:`neutral`,"no-match":`neutral`,preview:`neutral`,baseline:`neutral`,duplicate:`neutral`,failed:`danger`,error:`danger`,"rate-limited":`danger`},dr={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 fr(e){let[t,n]=(0,V.useState)(),[r,i]=(0,V.useState)(``),a=(0,V.useCallback)(t=>l(e,{signal:t}).then(({records:e})=>{t?.aborted||(n(e),i(``))}).catch(e=>{t?.aborted||i(String(e))}),[e]);return(0,V.useEffect)(()=>{a()},[a]),(0,V.useEffect)(()=>c(a),[a]),(0,V.useEffect)(()=>oe((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function pr(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 mr({records:e,all:t,timeZone:n,onRetried:r,readOnly:i=!1}){let a=e=>!i&&pr(e,t),[o,s]=(0,V.useState)(),[c,l]=(0,V.useState)(),u=Date.now(),d=async e=>{s(e),l(void 0);try{await b(e),r()}catch(t){l({receiptId:e,message:t instanceof Error?t.message:String(t)})}finally{s(void 0)}};return(0,H.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:e.map(e=>(0,H.jsxs)(`li`,{className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsx)(it,{dot:ur[e.result],children:dr[e.result]}),(0,H.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:_t(e.ts,n,u)})]}),e.reason?(0,H.jsx)(`p`,{className:`mt-2 text-sm break-words text-muted-foreground`,children:e.reason}):null,e.githubUrl||e.runId||a(e)?(0,H.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[e.githubUrl?(0,H.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,H.jsx)(z,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`}):null,a(e)?(0,H.jsx)(P,{variant:`outline`,disabled:o===e.receiptId,onClick:()=>void d(e.receiptId),children:`Retry task`}):null]}):null,c&&c.receiptId===e.receiptId?(0,H.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm break-words text-destructive`,children:c.message}):null]},e.seq))})}var Z=`all`;function hr({label:e,value:t,onChange:n,options:r}){return(0,H.jsxs)(rr,{value:t,onValueChange:n,children:[(0,H.jsx)(ar,{"aria-label":e,className:`w-full sm:w-52`,children:(0,H.jsx)(ir,{})}),(0,H.jsx)(or,{children:r.map(e=>(0,H.jsx)(sr,{value:e.value,children:e.label},e.value))})]})}function gr({automationId:e,automationName:t,timeZone:n,readOnly:r=!1}){let{records:i,error:a,refresh:o}=fr(e),[s,c]=(0,V.useState)(Z),[l,u]=(0,V.useState)(Z),d=(0,V.useMemo)(()=>(i??[]).filter(e=>(s===Z||e.result===s)&&(l===Z||e.event===l)),[i,s,l]),f=(i??[]).some(e=>e.event);return(0,H.jsx)(Y,{title:`Execution log`,subtitle:t??`Automation activity`,action:(0,H.jsx)(P,{variant:`outline`,asChild:!0,children:(0,H.jsx)(z,{to:`/automations`,children:`Back to automations`})}),children:a&&!i?(0,H.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,H.jsx)(X,{text:a}),(0,H.jsx)(P,{variant:`outline`,onClick:()=>void o(),children:`Retry`})]}):i?i.length===0?(0,H.jsx)(X,{text:`Nothing has run yet.`}):(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(hr,{label:`Result`,value:s,onChange:c,options:[{value:Z,label:`All results`},...$n.options.map(e=>({value:e,label:dr[e]}))]}),f?(0,H.jsx)(hr,{label:`Event`,value:l,onChange:u,options:[{value:Z,label:`All events`},...Hn.options.map(e=>({value:e,label:e}))]}):null]}),d.length===0?(0,H.jsx)(X,{text:`No rows match these filters.`}):(0,H.jsx)(mr,{records:d,all:i,timeZone:n,onRetried:()=>void o(),readOnly:r})]}):(0,H.jsx)(X,{text:`Loading execution log…`})})}function _r({automationId:e,automationName:t,timeZone:n,showName:r=!1,readOnly:i=!1}){let{records:a,error:o,refresh:s}=fr(e);return(0,H.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`mt-4 min-w-0 border-t pt-4`,children:[(0,H.jsxs)(`h3`,{className:`mb-3 text-sm font-medium`,children:[`Recent activity`,r&&t?` · ${t}`:``]}),o&&!a?(0,H.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,H.jsx)(X,{text:o}),(0,H.jsx)(P,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]}):a?a.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing has run yet.`}):(0,H.jsx)(mr,{records:a.slice(0,5),all:a,timeZone:n,onRetried:()=>void s(),readOnly:i}):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading activity…`})]})}function vr({automation:e,timeZone:t,onDeleted:n}){let r=e.archived,i=e.schedule,a=i?bt(i):null,[s,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(``),p=(0,V.useRef)(null),m=(0,V.useRef)(null),h=(0,V.useRef)(null);(0,V.useEffect)(()=>{let e=h.current===`keep`?m.current:h.current===`delete`?p.current:null;h.current=null,e?.focus()},[s]);let g=async()=>{u(!0);try{await o(e.id),n()}catch(e){f(e instanceof Error?e.message:String(e)),u(!1)}},_=[[`Workflow`,e.task.workflow],[`Runner`,e.task.runner],[`Model`,e.task.model],[`Effort`,e.task.effort]];return(0,H.jsx)(Y,{title:e.name,subtitle:`Archived one-time schedule. It cannot change; delete it when you no longer need the record.`,children:(0,H.jsxs)(`div`,{className:`grid min-w-0 max-w-3xl gap-5`,children:[(0,H.jsxs)(`section`,{className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,H.jsxs)(`p`,{className:`text-sm break-words`,children:[(0,H.jsx)(`span`,{children:r.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`}),r.runId?(0,H.jsxs)(H.Fragment,{children:[` · `,(0,H.jsx)(z,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${r.runId}`,children:`Open task`})]}):null]}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Archived ${St(r.at,t)} (${t}).`}),a&&i?.timeZone?(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Was due ${a.date} ${a.time} (${i.timeZone}).`}):null]}),(0,H.jsxs)(`section`,{"aria-labelledby":`archived-inputs`,className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,H.jsx)(`h2`,{id:`archived-inputs`,className:`mb-3 text-[15px] font-medium`,children:`What it ran with`}),(0,H.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[(0,H.jsxs)(`div`,{className:`grid gap-1`,children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`Prompt`}),(0,H.jsx)(`dd`,{className:`break-words whitespace-pre-wrap`,children:e.task.prompt})]}),_.filter(([,e])=>e).map(([e,t])=>(0,H.jsxs)(`div`,{className:`grid gap-1`,children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,H.jsx)(`dd`,{className:`break-words`,children:t})]},e))]})]}),(0,H.jsxs)(`section`,{className:`min-w-0`,children:[(0,H.jsx)(_r,{automationId:e.id,automationName:e.name,timeZone:t,readOnly:!0}),(0,H.jsx)(P,{variant:`outline`,asChild:!0,className:`mt-3`,children:(0,H.jsx)(z,{to:`/automations/${e.id}/log`,children:`Execution log`})})]}),(0,H.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[s?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? Its record and log are removed; the task stays.`}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(P,{variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:l,onClick:()=>void g(),children:`Delete schedule`}),(0,H.jsx)(P,{ref:m,variant:`outline`,disabled:l,onClick:()=>{h.current=`delete`,c(!1)},children:`Keep`})]})]}):(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(P,{ref:p,variant:`outline`,"data-action":`automation-delete`,onClick:()=>{h.current=`keep`,c(!0)},children:`Delete`}),(0,H.jsx)(P,{variant:`outline`,asChild:!0,children:(0,H.jsx)(z,{to:`/automations`,children:`Back to automations`})})]}),d?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:d}):null]})]})})}var yr=A([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),br=E(k().trim().min(1).max(200)).max(100).optional(),xr=S({includeExisting:D().optional(),requireCurrentLabels:D().optional(),authors:br,assignees:br,allLabels:br,anyLabels:br,excludeLabels:br,changedLabels:br,lookbackDays:j().int().min(1).max(90).default(7),maxRecords:j().int().min(1).max(100).default(25)}).passthrough(),Sr=S({prompt:k().min(1).max(1e5),workflow:k().trim().min(1).max(200).optional(),steps:E(a).min(1).max(100).optional(),runner:d.optional(),model:k().trim().min(1).max(200).optional(),effort:k().trim().min(1).max(32).optional(),variants:ne([w(1),w(2),w(3)]).optional(),worktree:D().optional(),autonomous:D().optional(),...g,...v,systemPrompt:k().max(1e5).optional()}).passthrough().refine(e=>!(e.workflow&&e.steps),{message:`task selects either a named workflow or inline steps, not both`}),Cr=new Set(Object.keys(Sr.shape).filter(e=>e!==`variants`));function wr(e){return Object.fromEntries(Object.entries(e).filter(([e])=>Cr.has(e)))}O(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e;return t.kind===`schedule`?e:{...t,intervalSeconds:t.intervalSeconds??300,filters:t.filters??{}}},S({id:k().min(1).max(100),revision:j().int().positive(),name:k().trim().min(1).max(200),description:k().max(2e3).optional(),enabled:D().default(!1),kind:Wn.default(`github`),events:E(yr).min(1).max(4).optional(),intervalSeconds:j().int().min(60).max(86400).optional(),filters:xr.optional(),schedule:lt.passthrough().optional(),task:Sr,archived:S({at:k().datetime(),outcome:A([`launched`,`cancelled`]),runId:k().optional(),receiptId:k().optional(),trigger:A([`schedule`,`late`,`manual`,`retry`]).optional()}).passthrough().optional(),createdAt:k().datetime(),updatedAt:k().datetime()}).passthrough().superRefine((e,t)=>{if(e.kind===`schedule`){e.schedule||t.addIssue({code:p.custom,path:[`schedule`],message:`a scheduled automation needs a schedule`});return}e.events?.length||t.addIssue({code:p.custom,path:[`events`],message:`a GitHub automation needs at least one event`}),e.intervalSeconds===void 0&&t.addIssue({code:p.custom,path:[`intervalSeconds`],message:`a GitHub automation needs a poll interval`}),e.filters||t.addIssue({code:p.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:p.custom,path:[`filters`,`changedLabels`],message:`changedLabels is required for issue label events`})})),S({version:w(1).default(1),automations:E(T()).default([]),tombstones:C(k(),k().datetime()).optional()}).passthrough();var Tr=S({timestamp:k().datetime(),tieBreaker:k().optional()}).passthrough(),Er=Yn.extend({cursor:Tr.optional()}),Dr=S({revision:j().int().positive().optional(),baselineAt:k().datetime().optional(),armedAt:k().datetime().optional(),historyScan:Er.optional(),cursor:Tr.optional(),frozenHighWatermark:Tr.extend({tieBreaker:k()}).optional(),backlogAfter:Tr.extend({tieBreaker:k()}).optional(),nextCheckAt:k().datetime().optional(),lastSuccessAt:k().datetime().optional(),nextRunAt:k().datetime().optional(),lastRunAt:k().datetime().optional(),etags:C(k(),k()).optional(),backoffUntil:k().datetime().optional(),consecutiveFailures:j().int().nonnegative().optional(),...Xn,onceOutcome:A([`failed`,`missed`]).optional()}).passthrough();S({version:w(1).default(1),states:C(k(),Dr).default({})}).passthrough(),S({receiptId:k().min(1),receiptKey:k().min(1),eventId:k().min(1),automationId:k().min(1),revision:j().int().positive(),status:A([`reserved`,`launched`,`launch-error`,`released`]),runId:k().optional(),observedAt:k().datetime(),updatedAt:k().datetime(),error:k().max(2e3).optional(),occurrenceAt:k().datetime().optional(),candidate:S({eventId:k(),event:yr,timestamp:k().datetime(),tieBreaker:k(),repo:k(),nodeId:k(),number:j().int().positive(),title:k().max(500),url:k().url(),author:k().max(200),assignees:E(k().max(200)).max(100),labels:E(k().max(200)).max(100),changedLabel:k().max(200).optional()}).passthrough().optional()}).passthrough();var Or=A([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]);S({seq:j().int().positive(),ts:k().datetime(),automationId:k().min(1),revision:j().int().positive(),event:yr.optional(),result:Or,reason:k().max(2e3).optional(),durationMs:j().int().nonnegative().optional(),receiptId:k().optional(),runId:k().optional(),githubNumber:j().int().positive().optional(),githubTitle:k().max(500).optional(),githubUrl:k().url().optional(),rateLimit:S({bucket:A([`core`,`search`]),remaining:j().int().nonnegative().optional(),resetAt:k().datetime().optional()}).passthrough().optional()}).passthrough();var kr=`quick-task`;function Ar(e={}){let{prompt:t,workflow:n,runner:r,model:i,autonomous:a,archiveWhenDone:o,autoMergePr:s,allowWorkers:c,allowMessaging:l,...u}=wr(e.task??{prompt:``}),d=e.task===void 0;return{name:e.name??``,description:e.description??``,kind:e.kind??`schedule`,schedule:Ct(e.schedule??{type:`daily`}),events:e.events??[`issue.opened`],intervalSeconds:e.intervalSeconds??300,filters:e.filters??{lookbackDays:7,maxRecords:25},prompt:t,...n===void 0?d?{workflow:kr}:{}:{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 jr(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 Mr(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 Nr(e){return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},kind:e.kind,...e.kind===`schedule`?{schedule:jr(e.schedule)}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:Mr(e)}}function Pr(e){return{...Nr(e),enable:e.enabled}}function Fr(e,t){return{...Nr(e),task:{...Mr(e),archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging},enabled:e.enabled,expectedRevision:t}}function Q(e){return`'${e.replace(/'/g,`'\\''`)}'`}var Ir=new Set([`prompt`,`workflow`,`runner`,`model`,`autonomous`,`worktree`,`archiveWhenDone`,`autoMergePr`,`allowWorkers`,`allowMessaging`]),Lr=new Set([`anyLabels`,`authors`,`changedLabels`]);function Rr(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=>!Ir.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||Lr.has(e)&&Array.isArray(t)&&t.length>0)}function zr(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function Br(e){return e%1440==0?`${e/1440}d`:e%60==0?`${e/60}h`:`${e}m`}function $(e,t){return t.startsWith(`-`)?`--${e}=${Q(t)}`:`--${e} ${Q(t)}`}function Vr(e){let t=[`${tt()} automation add`,$(`name`,e.name)];if(e.schedule?.type===`once`)t.push($(`at`,e.schedule.at),$(`tz`,e.schedule.timeZone)),e.schedule.latestStartMinutes!==void 0&&t.push($(`latest-start`,Br(e.schedule.latestStartMinutes)));else if(e.kind===`schedule`)t.push($(`cron`,ht(e.schedule)));else{t.push($(`on`,e.events.join(`,`)),`--every ${zr(e.intervalSeconds??300)}`),e.filters?.includeExisting&&t.push(`--include-existing`);for(let n of e.filters?.anyLabels??[])t.push($(`label`,n));for(let n of e.filters?.authors??[])t.push($(`author`,n));for(let n of e.filters?.changedLabels??[])t.push($(`changed-label`,n))}return t.push(...Hr(e.task)),e.enable===!0&&t.push(`--enable`),t.push($(`prompt`,e.task.prompt)),t.join(` `)}function Hr(e){let t=[];return e.workflow&&t.push($(`workflow`,e.workflow)),e.runner&&t.push($(`runner`,e.runner)),e.model&&t.push($(`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 Ur(e,t){let n=Pr(e),r=Rr(n)?Vr(n):`${tt()} automation create --json ${Q(JSON.stringify(n))}`;return t?`CEZ_COCKPIT_URL=${Q(t.origin)} CEZ_PROJECT_ID=${Q(t.projectId)} HSQ_COCKPIT_URL=${Q(t.origin)} HSQ_PROJECT_ID=${Q(t.projectId)} ${r}`:r}function Wr({draft:e}){let t=Ge(),n=window.location.origin,r=(0,V.useMemo)(()=>Ur(e,t?{origin:n,projectId:t}:void 0),[e,n,t]),[i,a]=(0,V.useState)(`idle`),o=(0,V.useRef)(void 0);(0,V.useEffect)(()=>()=>clearTimeout(o.current),[]),(0,V.useEffect)(()=>a(`idle`),[r]);let s=async()=>{clearTimeout(o.current);try{await navigator.clipboard.writeText(r),a(`copied`),o.current=setTimeout(()=>a(`idle`),1600)}catch{a(`failed`)}};return(0,H.jsxs)(`section`,{"aria-labelledby":`copy-as-cli-heading`,"data-slot":`copy-as-cli`,className:`mbs-4 rounded-xl border bg-card p-4`,children:[(0,H.jsxs)(`div`,{className:`mbe-2 flex items-center gap-2`,children:[(0,H.jsx)(`h2`,{id:`copy-as-cli-heading`,className:`text-[15px] font-medium`,children:`Copy as CLI`}),(0,H.jsxs)(P,{type:`button`,variant:`ghost`,size:`sm`,className:`ms-auto`,onClick:()=>void s(),children:[i===`copied`?(0,H.jsx)(ye,{"aria-hidden":`true`}):(0,H.jsx)(qe,{"aria-hidden":`true`}),i===`copied`?`Copied`:`Copy`]})]}),(0,H.jsx)(`pre`,{className:`m-0 rounded-lg border bg-muted px-2.5 py-2 font-mono text-xs/relaxed break-words whitespace-pre-wrap text-muted-foreground`,children:r}),(0,H.jsx)(`p`,{role:`status`,className:`mbs-2 text-xs break-words text-muted-foreground`,children:i===`failed`?`Could not copy — select the line and copy it by hand.`:(0,H.jsxs)(H.Fragment,{children:[`The definition Save would create. `,(0,H.jsxs)(`code`,{children:[tt(),` automation schema`]}),` prints its shape.`]})})]})}function Gr({pressed:e,onClick:t,disabled:n,children:r}){return(0,H.jsx)(`button`,{type:`button`,"aria-pressed":e,disabled:n,onClick:t,className:i(Xe,`h-11 px-4 text-[13px]`,e&&`border-transparent bg-accent-strong text-accent-strong-foreground hover:bg-accent-strong hover:text-accent-strong-foreground`),children:r})}var Kr=Hn.options,qr=[{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`}],Jr=[{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.`}],Yr=e=>(e??[]).join(`, `),Xr=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function Zr(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 Qr(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`}. ${Zr(e.filters.includeExisting)}`}function $r({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=Xr(r),{[n]:a,...o}=e.filters;t({filters:i.length?{...o,[n]:i}:o})},o=qr.some(t=>t.seconds===e.intervalSeconds)?qr:[...qr,{seconds:e.intervalSeconds,label:`${Math.round(e.intervalSeconds/60)} minutes`}].sort((e,t)=>e.seconds-t.seconds);return(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[n?(0,H.jsx)(`p`,{className:`text-xs text-pending-strong`,children:`GitHub unavailable · ${n}`}):null,(0,H.jsx)(`div`,{role:`group`,"aria-label":`GitHub events`,className:`flex flex-wrap gap-2`,children:Kr.map(t=>(0,H.jsx)(Gr,{pressed:e.events.includes(t),onClick:()=>r(t),children:t},t))}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(N,{htmlFor:`automation-interval`,children:`Check every`}),(0,H.jsxs)(rr,{value:String(e.intervalSeconds),onValueChange:e=>t({intervalSeconds:Number(e)}),children:[(0,H.jsx)(ar,{id:`automation-interval`,className:`w-full sm:w-48`,"aria-label":`Check every`,children:(0,H.jsx)(ir,{})}),(0,H.jsx)(or,{children:o.map(e=>(0,H.jsx)(sr,{value:String(e.seconds),children:e.label},e.seconds))})]})]}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,H.jsx)(Re,{"aria-label":`Include existing items`,"aria-describedby":`automation-history-hint`,checked:e.filters.includeExisting??!1,onCheckedChange:e=>i({includeExisting:e})}),(0,H.jsx)(`span`,{children:`Include existing items`})]}),(0,H.jsx)(`p`,{id:`automation-history-hint`,className:`text-xs text-muted-foreground`,children:Zr(e.filters.includeExisting)})]}),(0,H.jsxs)(Ie,{children:[(0,H.jsxs)(Fe,{className:`group flex min-h-11 items-center gap-2 text-sm font-medium`,children:[`Filters`,(0,H.jsx)(me,{"aria-hidden":`true`,className:`size-4 text-soft-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-180`})]}),(0,H.jsx)(Pe,{children:(0,H.jsxs)(`div`,{className:`grid gap-4 pt-2 sm:grid-cols-2`,children:[Jr.map(t=>(0,H.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,H.jsx)(N,{htmlFor:`automation-filter-${t.key}`,children:t.label}),(0,H.jsx)(B,{id:`automation-filter-${t.key}`,placeholder:`comma separated`,value:Yr(e.filters[t.key]),onChange:e=>a(t.key,e.target.value)}),t.hint?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.hint}):null]},t.key)),(0,H.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,H.jsx)(N,{htmlFor:`automation-filter-lookback`,children:`Look back (days)`}),(0,H.jsx)(B,{id:`automation-filter-lookback`,type:`number`,min:1,value:e.filters.lookbackDays,onChange:e=>i({lookbackDays:Math.max(1,Number(e.target.value)||1)})})]}),(0,H.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,H.jsx)(N,{htmlFor:`automation-filter-max`,children:`Max records per check`}),(0,H.jsx)(B,{id:`automation-filter-max`,type:`number`,min:1,value:e.filters.maxRecords,onChange:e=>i({maxRecords:Math.max(1,Number(e.target.value)||1)})})]})]})})]})]})}var ei=e=>String(e).padStart(2,`0`);function ti({label:e,value:t,max:n,onCommit:r}){let[i,a]=(0,V.useState)(ei(t)),o=(0,V.useRef)(null),s=!(/^\d{1,2}$/.test(i)&&Number(i)===t),c=`${e} must be 00–${ei(n)}.`,l=(0,V.useId)();return(0,V.useEffect)(()=>{o.current?.setCustomValidity(s?c:``)},[s,c]),(0,H.jsxs)(H.Fragment,{children:[(0,H.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 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(ei(t))}),s?(0,H.jsx)(`p`,{id:l,className:`order-last basis-full text-xs text-destructive`,children:c}):null]})}var ni=[{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`}],ri=`none`,ii=e=>String(e).padStart(2,`0`);function ai(e,t=Date.now()){let n=wt(t,e)??wt(t,`UTC`),r=new Date(Date.UTC(n.year,n.month-1,n.day+1));return`${r.getUTCFullYear()}-${ii(r.getUTCMonth()+1)}-${ii(r.getUTCDate())}T09:00`}function oi(){let e=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];return e.includes(`UTC`)?e:[`UTC`,...e]}function si({value:e,stored:t,onChange:n}){let r=t=>n({...e,...t}),i=e.at?gt(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${ii(t)}:${ii(n)}`}),l=(0,V.useRef)(null),u=(0,V.useId)(),d=dt(e),f=!(t?.type===`once`&&t.at===e.at&&t.timeZone===e.timeZone)&&d!==null&&d<=Date.now();(0,V.useEffect)(()=>{l.current?.setCustomValidity(f?ct:``)},[f]);let p=bt(e);return(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(N,{htmlFor:`automation-once-date`,children:`Date`}),(0,H.jsx)(B,{ref:l,id:`automation-once-date`,type:`date`,className:`w-44 max-w-full`,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,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,H.jsx)(ti,{label:`Hour`,value:o,max:23,onCommit:e=>c(a,e,s)}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,H.jsx)(ti,{label:`Minute`,value:s,max:59,onCommit:e=>c(a,o,e)})]})]}),f?(0,H.jsx)(`p`,{id:u,className:`text-xs text-destructive`,children:ct}):null,(0,H.jsx)(li,{value:e.timeZone??``,onCommit:e=>r({timeZone:e})}),(0,H.jsx)(ui,{value:e.latestStartMinutes,onChange:t=>n(ci(e,t))}),p?(0,H.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 ci(e,t){let{latestStartMinutes:n,...r}=e;return t===void 0?r:{...r,latestStartMinutes:t}}function li({value:e,onCommit:t}){let[n,r]=(0,V.useState)(e),i=(0,V.useRef)(null),a=(0,V.useId)(),o=(0,V.useId)(),[s]=(0,V.useState)(oi),c=n!==e||!st(n),l=ft(n);return(0,V.useEffect)(()=>{i.current?.setCustomValidity(c?l:``)},[c,l]),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(N,{htmlFor:`automation-once-zone`,children:`Time zone`}),(0,H.jsx)(B,{ref:i,id:`automation-once-zone`,list:a,autoComplete:`off`,spellCheck:!1,className:`w-full sm:w-72`,value:n,"aria-invalid":c||void 0,"aria-describedby":c?o:void 0,onChange:e=>{r(e.target.value),st(e.target.value)&&t(e.target.value)}}),(0,H.jsx)(`datalist`,{id:a,children:s.map(e=>(0,H.jsx)(`option`,{value:e},e))}),c?(0,H.jsx)(`p`,{id:o,className:`text-xs break-words text-destructive`,children:l}):null]})}function ui({value:e,onChange:t}){let n=ni.some(t=>t.minutes===e)||e===void 0?ni:[...ni,{minutes:e,label:`${e} minutes`}];return(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(N,{htmlFor:`automation-once-latest`,children:`Latest start`}),(0,H.jsxs)(rr,{value:e===void 0?ri:String(e),onValueChange:e=>t(e===ri?void 0:Number(e)),children:[(0,H.jsx)(ar,{id:`automation-once-latest`,className:`w-full sm:w-48`,"aria-label":`Latest start`,children:(0,H.jsx)(ir,{})}),(0,H.jsx)(or,{children:n.map(e=>(0,H.jsx)(sr,{value:e.minutes===void 0?ri:String(e.minutes),children:e.label},e.label))})]}),(0,H.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 di=[{type:`daily`,label:`Every day`},{type:`weekdays`,label:`Weekdays`},{type:`weekly`,label:`Weekly`},{type:`hours`,label:`Every N hours`},{type:`once`,label:`Once`}];function fi({value:e,stored:t,onChange:n,timeZone:r}){let i=t=>n({...e,...t}),a=t=>i(t===`once`?{type:t,at:e.at??ai(r),timeZone:e.timeZone??r}:{type:t});return(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsx)(`div`,{role:`group`,"aria-label":`Repeat`,className:`flex flex-wrap gap-2`,children:di.map(t=>(0,H.jsx)(Gr,{pressed:e.type===t.type,onClick:()=>a(t.type),children:t.label},t.type))}),e.type===`once`?(0,H.jsx)(si,{value:e,stored:t,onChange:n}):null,e.type===`weekly`?(0,H.jsx)(`div`,{role:`group`,"aria-label":`Day of the week`,className:`flex flex-wrap gap-2`,children:xt.map((t,n)=>(0,H.jsx)(Gr,{pressed:e.day===n+1,onClick:()=>i({day:n+1}),children:t},t))}):null,e.type===`once`?null:e.type===`hours`?(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(N,{htmlFor:`automation-every`,children:`Run every`}),(0,H.jsxs)(rr,{value:String(e.every),onValueChange:e=>i({every:Number(e)}),children:[(0,H.jsx)(ar,{id:`automation-every`,className:`w-full sm:w-48`,"aria-label":`Run every`,children:(0,H.jsx)(ir,{})}),(0,H.jsx)(or,{children:vt.map(e=>(0,H.jsx)(sr,{value:String(e),children:e===1?`hour`:`${e} hours`},e))})]}),(0,H.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,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,H.jsx)(ti,{label:`Hour`,value:e.hour,max:23,onCommit:e=>i({hour:e})}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,H.jsx)(ti,{label:`Minute`,value:e.minute,max:59,onCommit:e=>i({minute:e})}),(0,H.jsx)(`span`,{className:`text-sm break-all text-muted-foreground`,children:r})]}),e.type===`once`?null:(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Cron: `,(0,H.jsx)(`code`,{className:`font-mono text-foreground`,children:ht(e)})]})]})}var pi=40*864e5,mi=5;function hi({schedule:e,timeZone:t,now:n=Date.now()}){if(e.type===`once`)return(0,H.jsx)(gi,{schedule:e,now:n});let r=ut(e,n+1,n+pi,t,mi);return(0,H.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,className:`rounded-xl border bg-card p-4`,children:[(0,H.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-[15px] font-medium`,children:`Next 5 runs`}),r.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No runs in the next 40 days.`}):(0,H.jsx)(`ol`,{"aria-label":`Next 5 runs`,className:`grid gap-1.5 text-sm`,children:r.map(e=>(0,H.jsxs)(`li`,{className:`flex items-baseline justify-between gap-3`,children:[(0,H.jsx)(`span`,{className:`font-medium tabular-nums`,children:St(new Date(e).toISOString(),t)}),(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:mt(n,e)})]},e))}),(0,H.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Times are in `,t,`, the zone this Squawk runs in.`]})]})}function gi({schedule:e,now:t}){let n=dt(e),r=bt(e);return(0,H.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,className:`rounded-xl border bg-card p-4`,children:[(0,H.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-[15px] font-medium`,children:`Runs once`}),n===null||!r?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pick a date, a time and a time zone.`}):(0,H.jsxs)(`p`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 text-sm`,children:[(0,H.jsx)(`span`,{className:`font-medium tabular-nums`,children:`${r.date} ${r.time}`}),n>t?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:mt(t,n)}):null]}),r?.note?(0,H.jsx)(`p`,{className:`mt-2 text-sm break-words`,children:r.note}):null,n!==null&&n<=t?(0,H.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:`The due time has passed.`}):null,(0,H.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 _i={schedule:`On a schedule`,github:`When GitHub changes`};function vi(e){return/time zone|due time/i.test(e)?`when`:/placeholder|prompt|workflow|runner|model|task|autonomous/i.test(e)?`run`:/\bname\b/i.test(e)?`name`:/schedule|github|event|filter|label|interval|remote|forge|lookback|records?|hour|minute|poll|kind|archived/i.test(e)?`when`:`form`}function yi({title:e,failure:t,section:n,children:r}){return(0,H.jsxs)(`fieldset`,{className:`grid min-w-0 gap-4 rounded-xl border p-5 max-md:p-4!`,children:[(0,H.jsx)(`legend`,{className:`px-0`,children:e}),r,t?.section===n&&!t.conflict?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:t.message}):null]})}function bi({draft:e,patch:t,forge:n,automation:r}){return(0,H.jsx)(H.Fragment,{children:r?(0,H.jsxs)(`p`,{className:`text-sm`,children:[(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`Trigger · `}),_i[e.kind]]}):(0,H.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,H.jsx)(at,{slot:`automation-kind`,label:`Trigger`,size:`touch`,value:e.kind,onChange:e=>t({kind:e}),options:[{value:`schedule`,label:_i.schedule},{value:`github`,label:_i.github,disabled:!n.available,...n.available?{}:{title:n.reason??`GitHub is unavailable`}}]}),n.available?null:(0,H.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`GitHub unavailable · ${n.reason??`no GitHub access`}`})]})})}function xi({draft:e,patch:t,forge:n,timeZone:r,automation:i}){return e.kind===`schedule`?(0,H.jsx)(fi,{value:e.schedule,stored:i?.schedule,onChange:e=>t({schedule:e}),timeZone:r}):(0,H.jsx)($r,{draft:e,onChange:t,...n.available?{}:{disabledReason:n.reason??`no GitHub access`}})}function Si({draft:e,patch:t,saving:n,automation:r}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(N,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,H.jsx)(Tt,{id:`automation-prompt`,value:e.prompt,onChange:e=>t({prompt:e.target.value}),rows:4,required:!0}),(0,H.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:e.kind===`schedule`?(0,H.jsxs)(H.Fragment,{children:[`Available: `,`{{date}}`,` `,`{{time}}`,` `,`{{project}}`,` `,`{{automation}}`,`. A run-context block is appended automatically.`]}):(0,H.jsxs)(H.Fragment,{children:[`Available: `,`{{github.number}}`,` `,`{{github.title}}`,` `,`{{github.url}}`,` `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})})]}),(0,H.jsx)(Ti,{draft:e,patch:t}),(0,H.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,H.jsx)(Re,{"aria-label":`Autonomous`,checked:e.autonomous,onCheckedChange:e=>t({autonomous:e})}),(0,H.jsxs)(`span`,{children:[`Autonomous `,(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`· runs without waiting for answers`})]})]}),(0,H.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,H.jsx)(nt,{archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,onChange:t,disabled:n}),(0,H.jsx)(Qe,{allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging,onChange:t,disabled:n}),r?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`These settings apply to future tasks. Existing tasks keep their settings.`}):null]})}function Ci({draft:e,patch:t,automation:n}){let r=e.kind===`schedule`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,H.jsx)(Re,{"aria-label":n?`Enabled`:`Enable after saving`,checked:e.enabled,onCheckedChange:e=>t({enabled:e})}),(0,H.jsx)(`span`,{children:n?`Enabled`:`Enable after saving`})]}),(0,H.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:r&&e.schedule.type===`once`?`It runs once at the time set above, then moves to Archived with its task.`:r?`The first run is the next occurrence shown beside the schedule.`:Zr(e.filters.includeExisting)})]})}function wi({automation:e,forge:t,timeZone:n,onSaved:r,onReload:i}){let[a,s]=(0,V.useState)(()=>Ar(e)),[c,l]=(0,V.useState)(e?.revision),[u,d]=(0,V.useState)(),[f,p]=(0,V.useState)(!1),[m,g]=(0,V.useState)(!1),[v,y]=(0,V.useState)(!1),[b,x]=(0,V.useState)(``),S=e=>s(t=>({...t,...e})),ne=async t=>{if(t.preventDefault(),f)return;let n=t.currentTarget;if(n instanceof HTMLFormElement&&!n.checkValidity()){n.reportValidity();return}p(!0),d(void 0);let i=`save`;try{if(e&&c!==void 0){let{automation:t}=await ee(e.id,Fr({...a,enabled:e.enabled},c));l(t.revision),a.enabled!==e.enabled&&(i=`enable`,await h(e.id,a.enabled))}else await te(Pr(a));r()}catch(t){let n=t instanceof Error?t.message:String(t);i===`save`&&e&&t instanceof _&&t.status===409&&/revision conflict/i.test(n)?d({section:`form`,message:`Edited elsewhere — reload to see the latest version`,conflict:!0}):d({section:i===`enable`?`enable`:vi(n),message:n})}finally{p(!1)}},C=async()=>{if(!(!e||v)){y(!0),x(``);try{await o(e.id),r()}catch(e){x(e instanceof Error?e.message:String(e))}finally{y(!1)}}},w=e?`Save changes`:a.enabled?`Save and enable`:`Save paused`,T=a.kind===`schedule`;return(0,H.jsx)(Y,{title:e?`Edit automation`:`New automation`,subtitle:`Define when it runs and the ordinary task it launches.`,children:(0,H.jsxs)(`form`,{className:`automation-editor grid min-w-0 gap-5 md:grid-cols-[minmax(0,1fr)_320px] md:items-start`,onSubmit:ne,children:[(0,H.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[(0,H.jsx)(yi,{title:`Name`,section:`name`,failure:u,children:(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(N,{htmlFor:`automation-name`,children:`Name`}),(0,H.jsx)(B,{id:`automation-name`,value:a.name,onChange:e=>S({name:e.target.value}),required:!0})]})}),(0,H.jsxs)(yi,{title:`When`,section:`when`,failure:u,children:[(0,H.jsx)(bi,{draft:a,patch:S,forge:t,automation:e}),(0,H.jsx)(xi,{draft:a,patch:S,forge:t,timeZone:n,automation:e})]}),(0,H.jsx)(yi,{title:`What to run`,section:`run`,failure:u,children:(0,H.jsx)(Si,{draft:a,patch:S,saving:f,automation:e})}),(0,H.jsx)(yi,{title:`Enable`,section:`enable`,failure:u,children:(0,H.jsx)(Ci,{draft:a,patch:S,automation:e})}),u?.section===`form`?(0,H.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 text-sm text-destructive`,children:[(0,H.jsx)(`span`,{className:`break-words`,children:u.message}),u.conflict&&i?(0,H.jsx)(P,{type:`button`,variant:`outline`,onClick:i,children:`Reload`}):null]}):null,(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(P,{type:`submit`,disabled:f,children:f?`Saving…`:w}),(0,H.jsx)(P,{type:`button`,variant:`outline`,asChild:!0,children:(0,H.jsx)(z,{to:`/automations`,children:`Cancel`})})]}),e?(0,H.jsxs)(`div`,{className:`grid justify-items-start gap-2 border-t pt-4`,children:[m?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? It will stop running and cannot be restored.`}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(P,{type:`button`,variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:v,onClick:()=>void C(),children:`Delete automation`}),(0,H.jsx)(P,{type:`button`,variant:`outline`,disabled:v,onClick:()=>{g(!1),x(``)},children:`Keep`})]})]}):(0,H.jsx)(P,{type:`button`,variant:`outline`,"data-action":`automation-delete`,onClick:()=>g(!0),children:`Delete`}),b?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:b}):null]}):null]}),(0,H.jsxs)(`aside`,{className:`min-w-0 md:sticky md:top-4`,children:[T?(0,H.jsx)(hi,{schedule:a.schedule,timeZone:n}):(0,H.jsxs)(`section`,{className:`rounded-xl border bg-card p-4`,children:[(0,H.jsx)(`h2`,{className:`mb-2 text-[15px] font-medium`,children:`How it polls`}),(0,H.jsx)(`p`,{className:`text-sm break-words text-muted-foreground`,children:Qr(a)})]}),(0,H.jsx)(Wr,{draft:a})]})]})})}function Ti({draft:e,patch:t}){let n=re(),r=ot(),{runners:i,signedOut:a}=r.runnersOn(e=>r.repoAccount?.[e]),o=ie(),s=ce(),c=e.runner??o.data?.defaultRunner??`claude`,l=M(c,!0,r.repoAccount?.[c]),u=[...new Set([...(n.data?.workflows??[]).map(e=>e.name),...e.workflow?[e.workflow]:[]])],d=[...new Set([...i,...e.runner?[e.runner]:[]])],f=Ze(c,s.data,l.data,[e.model]),p=f.find(t=>t.id===(e.model??``))?.label??e.model??`auto`,m=e=>(0,H.jsx)(e,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`});return(0,H.jsx)(Ye,{children:(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(et,{slot:`automation-workflow-pill`,icon:m(ge),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:u.map(e=>({value:e,label:e})),onPick:e=>t({workflow:e})}),(0,H.jsx)(et,{slot:`automation-runner-pill`,icon:m(pe),fieldLabel:!0,ariaLabel:`Runner`,label:e.runner??`default`,value:e.runner??``,disabled:!s.data,options:[{value:``,label:`default`,desc:`The project’s default runner`},...d.map(e=>({value:e,label:se(s.data,e)}))],footer:(0,H.jsx)(rt,{uninstalled:r.uninstalled,signedOut:a.filter(t=>t!==e.runner)}),onPick:e=>{t({runner:e||void 0,model:void 0})}}),(0,H.jsx)(et,{slot:`automation-model-pill`,icon:m(_e),fieldLabel:!0,ariaLabel:`Model`,label:p,value:e.model??``,options:f.map(e=>({value:e.id,label:e.label,desc:e.desc})),onPick:e=>t({model:e||void 0})})]})})}function Ei({data:e,error:t,refresh:n,archived:r=!1,onArchivedChange:i}){let[a,o]=(0,V.useState)({}),[c,l]=(0,V.useState)({}),u=(e,t)=>o(n=>{let{[e]:r,...i}=n;return t?{...i,[e]:t}:i}),d=async(e,t)=>{l(t=>({...t,[e]:!0}));try{await t()}catch(t){u(e,{text:t instanceof Error?t.message:String(t),tone:`error`})}finally{l(t=>({...t,[e]:!1}))}},f=e=>d(e.id,async()=>{u(e.id,{text:`Starting…`,tone:`info`});let{runId:t}=await m(e.id);u(e.id,{text:`Started task`,tone:`info`,runId:t}),n()}),p=e=>d(e.id,async()=>{u(e.id,void 0),await h(e.id,!e.enabled),await n()}),g=e=>d(e.id,async()=>{u(e.id,void 0),await x(e.id),await n()}),_=e=>d(e.id,async()=>{u(e.id,{text:`Checking…`,tone:`info`});let{checkId:t}=await y(e.id,`preview`);for(let r=0;r<60;r+=1){let r=await s(t);if(r.status===`complete`){u(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`)throw Error(r.error??`Preview failed`);await new Promise(e=>setTimeout(e,500))}throw Error(`Preview is still running`)});return(0,H.jsx)(Y,{title:`Automations`,subtitle:`Schedules and GitHub checks run while Squawk is open.`,action:(0,H.jsx)(P,{asChild:!0,children:(0,H.jsx)(z,{to:`/automations/new`,children:`New automation`})}),children:t&&!e?(0,H.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,H.jsx)(X,{text:t}),(0,H.jsx)(P,{variant:`outline`,onClick:()=>void n(),children:`Retry`})]}):e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Di,{data:e}),i?(0,H.jsx)(`div`,{className:`mb-4 flex flex-wrap gap-2`,children:(0,H.jsx)(Gr,{pressed:r,onClick:()=>i(!r),children:`Archived`})}):null,r&&e.automations.length===0?(0,H.jsx)(X,{text:`No archived one-time schedules.`}):e.automations.length===0?(0,H.jsx)(Ke,{icon:(0,H.jsx)(he,{}),tone:`neutral`,title:`No automations yet`,subtitle:`Create one paused, preview it, then enable it.`,heading:`h2`,actions:(0,H.jsx)(P,{asChild:!0,children:(0,H.jsx)(z,{to:`/automations/new`,children:`New automation`})})}):(0,H.jsx)(`ul`,{className:`grid gap-3`,"aria-label":`Automations`,children:e.automations.map(t=>(0,H.jsx)(Ri,{automation:t,timeZone:e.timeZone,note:a[t.id],busy:c[t.id]===!0,onRun:()=>void f(t),onToggle:()=>void p(t),onPreview:()=>void _(t),onCancel:()=>void g(t)},t.id))})]}):(0,H.jsx)(X,{text:`Loading automations…`})})}function Di({data:e}){return(0,H.jsx)(`p`,{"data-slot":`automation-scheduler`,className:i(`mb-4 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 Oi(e){return e.kind===`schedule`&&e.schedule?pt(e.schedule):`on ${(e.events??[]).join(`, `)} · every ${Math.round((e.intervalSeconds??300)/60)} min`}var ki={waiting:{label:`Waiting`,dot:`success`},paused:{label:`Paused`,dot:`neutral`},failed:{label:`Failed`,dot:`danger`},missed:{label:`Missed`,dot:`pending`},archived:{label:`Archived`,dot:`neutral`}};function Ai(e){if(e.schedule?.type===`once`)return ki[e.onceStatus??(e.enabled?`waiting`:`paused`)]}function ji({automation:e,badge:t}){return(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`h2`,{className:`flex items-center gap-2 font-semibold break-words`,children:[(0,H.jsx)(e.kind===`schedule`?ue:le,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),e.name]}),(0,H.jsx)(`p`,{className:`mt-1.5 text-[13px] break-words text-muted-foreground`,children:Oi(e)})]}),t?(0,H.jsx)(it,{dot:t.dot,children:t.label}):(0,H.jsx)(it,{dot:e.enabled?`success`:`neutral`,children:e.enabled?`Enabled`:`Paused`})]})}function Mi({automation:e,archive:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`p`,{className:`mt-3 text-sm break-words`,children:[t.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`,t.runId?(0,H.jsxs)(H.Fragment,{children:[` · `,(0,H.jsx)(z,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${t.runId}`,children:`Open task`})]}):null]}),(0,H.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:(0,H.jsx)(P,{variant:`outline`,asChild:!0,children:(0,H.jsx)(z,{to:`/automations/${e.id}`,children:`Details`})})})]})}function Ni({automation:e,timeZone:t}){let n=e.kind===`schedule`,r=e.enabled&&n?e.nextRunAt:void 0;return(0,H.jsx)(`p`,{className:`mt-3 text-sm`,children:!n&&e.enabled?(0,H.jsx)(`span`,{children:`continuous`}):r?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{children:`Next run: ${St(r,t)}`}),(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:` · ${mt(Date.now(),Date.parse(r))}`})]}):(0,H.jsx)(`span`,{children:`Next run: —`})})}function Pi({automation:e,timeZone:t}){let n=e.enabled?Qn(e.state):void 0;return n?(0,H.jsxs)(`p`,{role:`alert`,"data-slot":`automation-failing`,className:`mt-3 text-sm break-words text-destructive`,children:[`The last ${n.consecutiveFailures} checks failed: ${n.lastError}`,n.retryAt?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:` · Next try ${St(n.retryAt,t)}`}):null]}):null}function Fi({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,H.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,H.jsx)(P,{variant:`outline`,asChild:!0,children:(0,H.jsx)(z,{to:`/automations/${e.id}`,children:`Edit`})}),(0,H.jsx)(P,{variant:`outline`,asChild:!0,children:(0,H.jsx)(z,{to:`/automations/${e.id}/log`,children:`Execution log`})}),(0,H.jsx)(P,{variant:`outline`,"data-action":`automation-toggle`,disabled:t,onClick:i,children:e.enabled?`Pause`:`Enable`}),c?(0,H.jsx)(P,{variant:`outline`,"data-action":`automation-run`,disabled:t,onClick:a,children:`Run now`}):(0,H.jsx)(P,{variant:`outline`,"data-action":`automation-preview`,disabled:t,onClick:o,children:`Test filter`}),l&&!n?(0,H.jsx)(P,{variant:`outline`,ref:r,"data-action":`automation-cancel`,disabled:t,onClick:s,children:`Cancel`}):null]})}function Ii({automation:e,busy:t,keepRef:n,onConfirm:r,onKeep:i}){return(0,H.jsxs)(`div`,{className:`mt-3 grid justify-items-start gap-2`,children:[(0,H.jsx)(`p`,{className:`text-sm break-words`,children:`Cancel “${e.name}”? It will never run, and it moves to Archived.`}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(P,{variant:`danger-ghost`,"data-action":`automation-cancel-confirm`,disabled:t,onClick:r,children:`Cancel schedule`}),(0,H.jsx)(P,{ref:n,variant:`outline`,disabled:t,onClick:i,children:`Keep`})]})]})}function Li({note:e}){return(0,H.jsxs)(`p`,{role:e.tone===`error`?`alert`:`status`,className:i(`mt-3 text-sm break-words`,e.tone===`error`?`text-destructive`:`text-muted-foreground`),children:[e.text,e.runId?(0,H.jsxs)(H.Fragment,{children:[` · `,(0,H.jsx)(z,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`})]}):null]})}function Ri({automation:e,timeZone:t,note:n,busy:r,onRun:i,onToggle:a,onPreview:o,onCancel:s}){let[c,l]=(0,V.useState)(!1),u=(0,V.useRef)(null),d=(0,V.useRef)(null),f=(0,V.useRef)(null);(0,V.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,H.jsxs)(`li`,{"data-slot":`automation-card`,"data-kind":e.kind,className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,H.jsx)(ji,{automation:e,badge:Ai(e)}),h?(0,H.jsx)(Mi,{automation:e,archive:h}):null,h?null:(0,H.jsx)(Ni,{automation:e,timeZone:t}),h?null:(0,H.jsx)(Pi,{automation:e,timeZone:t}),h?null:(0,H.jsx)(Fi,{automation:e,busy:r,confirmingCancel:c,cancelRef:u,onToggle:a,onRun:i,onPreview:o,onOpenCancel:p}),e.schedule?.type===`once`&&!h&&c?(0,H.jsx)(Ii,{automation:e,busy:r,keepRef:d,onConfirm:()=>{l(!1),s()},onKeep:m}):null,n?(0,H.jsx)(Li,{note:n}):null,(0,H.jsx)(_r,{automationId:e.id,automationName:e.name,timeZone:t})]})}function zi(e){let t=Ge(),n=Je(),[r,i]=(0,V.useState)(),[a,o]=(0,V.useState)(``),s=(0,V.useCallback)(t=>u({signal:t,...e?{archived:e}:{}}).then(e=>{t?.aborted||(i(e),o(``))}).catch(e=>{t?.aborted||o(String(e))}),[e]);return(0,V.useEffect)(()=>{n&&s()},[n,s]),(0,V.useEffect)(()=>c(async e=>{n&&await s(e)}),[n,s]),(0,V.useEffect)(()=>oe((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 Bi({mode:e=`list`}){let{automationId:t}=ae(),n=We(),[r,i]=(0,V.useState)(!1),{data:a,error:o,refresh:s}=zi(e===`list`?r?`only`:void 0:`include`),[c,l]=(0,V.useState)(0),u=$e();if(u===`unknown`)return(0,H.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,H.jsx)(X,{text:`Loading automations…`})});if(u===`unavailable`)return(0,H.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,H.jsx)(Ke,{icon:(0,H.jsx)(he,{}),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,H.jsx)(Ei,{data:a,error:o,refresh:s,archived:r,onArchivedChange:i});if(!a)return o?(0,H.jsx)(Y,{title:`Automations`,subtitle:`Could not load automations.`,children:(0,H.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,H.jsx)(X,{text:o}),(0,H.jsx)(P,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]})}):(0,H.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,H.jsx)(X,{text:`Loading automations…`})});let p={available:a.available,...a.reason?{reason:a.reason}:{}};return e===`new`?(0,H.jsx)(wi,{forge:p,timeZone:a.timeZone,onSaved:d}):e===`edit`?f?f.archived?(0,H.jsx)(vr,{automation:f,timeZone:a.timeZone,onDeleted:d}):(0,H.jsx)(wi,{automation:f,forge:p,timeZone:a.timeZone,onSaved:d,onReload:()=>void s().then(()=>l(e=>e+1))},`${f.id}:${c}`):(0,H.jsx)(Y,{title:`Automation not found`,subtitle:`This automation may have been removed.`,children:(0,H.jsx)(P,{asChild:!0,variant:`outline`,children:(0,H.jsx)(z,{to:`/automations`,children:`Back to automations`})})}):t?(0,H.jsx)(gr,{automationId:t,automationName:f?.name,timeZone:a.timeZone,readOnly:!!f?.archived}):(0,H.jsx)(X,{text:`Automation not found.`})}export{Bi as AutomationsRoute};