@wjarka/cezarion 0.18.0-dev.8037 → 0.18.0-dev.8044
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/package.json +2 -2
- package/web/dist/assets/{accounts-section-B-zlsH7k.js → accounts-section-D3P_Z-Nu.js} +1 -1
- package/web/dist/assets/{activity-motion-psm6jyeg.js → activity-motion-BW-0k8s7.js} +1 -1
- package/web/dist/assets/{activity-route-DeK0riM9.js → activity-route-Bpgblioe.js} +1 -1
- package/web/dist/assets/{agent-config-section-BvmWn_h-.js → agent-config-section-Cj3w7UIn.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-DsuYOQpY.js → agent-defaults-section-BJ4poe9c.js} +1 -1
- package/web/dist/assets/{appearance-DNMXL1v0.js → appearance-BUsUTPF0.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-BovFB0t7.js → archive-on-merge-field-D_kgBFNv.js} +1 -1
- package/web/dist/assets/attention-lvUYNNvV.js +1 -0
- package/web/dist/assets/{automations-route-DyiKOd25.js → automations-route-CZaUrmDs.js} +1 -1
- package/web/dist/assets/{commit-diff-panel-DawdFJ6E.js → commit-diff-panel-xwLW6Ydr.js} +1 -1
- package/web/dist/assets/{diff-CfoXwmnl.js → diff-BB8SoL-s.js} +2 -2
- package/web/dist/assets/{diff-view-5xkdG47g.js → diff-view-O8lx1ztb.js} +1 -1
- package/web/dist/assets/{file-preview-DIVTxup4.js → file-preview-BS6M2tBo.js} +1 -1
- package/web/dist/assets/{folder-browser-BzVWaANT.js → folder-browser-Dsqz0Z1z.js} +1 -1
- package/web/dist/assets/{git-toolbar-BUViNmxj.js → git-toolbar-DoPFA36c.js} +1 -1
- package/web/dist/assets/{github-COe1nsmn.js → github-Bjy3WBvf.js} +1 -1
- package/web/dist/assets/{global-activity-route-B-cJo1pg.js → global-activity-route-BXBZKz_9.js} +1 -1
- package/web/dist/assets/{index-BZiixXpY.js → index-CmadQXcg.js} +5 -5
- package/web/dist/assets/{label-DVUPtyTI.js → label-CZp8t0zE.js} +1 -1
- package/web/dist/assets/{markdown-bvY77s5D.js → markdown-KHcncamw.js} +1 -1
- package/web/dist/assets/{notifications-section-Cet1mmEc.js → notifications-section-DD21Sd79.js} +1 -1
- package/web/dist/assets/{open-in-menu-BpSp2CJF.js → open-in-menu-DdKs6X5r.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-BCrpsIIn.js → preview-pane-connected-BvTZv2SQ.js} +1 -1
- package/web/dist/assets/{project-location-ClZPnbBZ.js → project-location-B3LBvkz2.js} +1 -1
- package/web/dist/assets/{project-router-BYrAO9Ws.js → project-router-CIKODSHW.js} +1 -1
- package/web/dist/assets/project-scope-context-D1bpJixc.js +4 -0
- package/web/dist/assets/{projects-section-CdUdrEPd.js → projects-section-C0k8kyb-.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-D3ojaPZw.js → prompt-templates-section-DNkosCni.js} +1 -1
- package/web/dist/assets/{queries--x5yVcip.js → queries-dHXhD3Hc.js} +1 -1
- package/web/dist/assets/{reference-chip-013dL8dQ.js → reference-chip-BWViAFIN.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-BbBWWAm8.js → remote-settings-notice-DPCENbhz.js} +1 -1
- package/web/dist/assets/{repo-git-1hSBzyJQ.js → repo-git-jKOnO3ba.js} +1 -1
- package/web/dist/assets/{report-reader-BNtgxtSI.js → report-reader-DXYiKNcg.js} +1 -1
- package/web/dist/assets/{reports-C64cW2KP.js → reports-DEE0bHNv.js} +1 -1
- package/web/dist/assets/{resources-section-xAUouGNM.js → resources-section-lqXgYTrv.js} +1 -1
- package/web/dist/assets/{run-header-75eMWFhM.js → run-header-CXlUbvDO.js} +1 -1
- package/web/dist/assets/{runners-C4-xD5Cz.js → runners-CGQjSsir.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-4P5j_ZP8.js → settings-agent-picker-BRvZn4kM.js} +1 -1
- package/web/dist/assets/{settings-shell-CME_R4D1.js → settings-shell-DTtd-vIa.js} +1 -1
- package/web/dist/assets/{sidebar-section-BQSB_KxK.js → sidebar-section-BFW4ZfBR.js} +1 -1
- package/web/dist/assets/{skills-RUJCWIve.js → skills-AImMlT1T.js} +1 -1
- package/web/dist/assets/{tab-link-DnbdjF4r.js → tab-link-CM6SDBtV.js} +1 -1
- package/web/dist/assets/{task-changes-Boec_UFj.js → task-changes-01Z_ppIw.js} +1 -1
- package/web/dist/assets/{task-commits-B6k-DdnE.js → task-commits-DRNIum3J.js} +1 -1
- package/web/dist/assets/{task-files-T731cz4q.js → task-files-Crz7Fo3C.js} +1 -1
- package/web/dist/assets/{task-github-item-iQd_C1Y4.js → task-github-item-psG2V47c.js} +1 -1
- package/web/dist/assets/{task-groups-BTMFLRHJ.js → task-groups-DF0XoB6U.js} +1 -1
- package/web/dist/assets/{task-thread-BaPz3rdA.js → task-thread-Bqg91ZVZ.js} +2 -2
- package/web/dist/assets/{tasks-table-BCuA9Kx7.js → tasks-table-DHTEGteC.js} +1 -1
- package/web/dist/assets/{thread-state-B3Ichxx9.js → thread-state-BWJ2YyXo.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-DIIBuX3r.js → use-hand-to-agent-state-DNROQerR.js} +1 -1
- package/web/dist/assets/{useInfiniteQuery-BxpPo6z-.js → useInfiniteQuery-qJeCNhM7.js} +1 -1
- package/web/dist/assets/useQuery-C3CQhXsT.js +1 -0
- package/web/dist/assets/{workflows-8HhOvPhw.js → workflows-Cx9lgrEo.js} +2 -2
- package/web/dist/assets/{workspace-tools-D6C2Yjat.js → workspace-tools-CVitt3kE.js} +1 -1
- package/web/dist/assets/{worktrees-section-Cm4JH128.js → worktrees-section-DxUg4l9n.js} +1 -1
- package/web/dist/assets/{ws-Iixb-QFR.js → ws-BisMp6U5.js} +1 -1
- package/web/dist/index.html +15 -15
- package/web/dist/assets/attention-DaLkUl4h.js +0 -1
- package/web/dist/assets/project-scope-context-BDU1qGx3.js +0 -4
- package/web/dist/assets/useQuery-DcVi2Spi.js +0 -1
|
@@ -1 +1 @@
|
|
|
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-BDU1qGx3.js";import{B as S,H as C,L as w,M as T,P as E,R as D,U as O,W as k,j as A,k as j,z as M}from"./live-protocol-D9ji1YCl.js";import{Gt as N,kt as ne,p as re}from"./queries--x5yVcip.js";import{h as ie}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as ae,t as P}from"./label-DVUPtyTI.js";import{o as oe,s as se}from"./runners-C4-xD5Cz.js";import{I as ce,Y as le,c as ue,d as de,it as fe,l as pe,pt as me,ut as he,y as ge}from"./design-icons-CzEoMH9c.js";import{n as _e,r as ve}from"./dist-C28wFbz0.js";import{t as F}from"./button-BQ2y4XRB.js";import{a as I,n as ye}from"./dist-BW234Kg5.js";import{a as L,i as be,n as R,r as z,t as xe}from"./dist-C5mlVBmd.js";import{h as Se,m as Ce}from"./dropdown-menu-4e2iKSMT.js";import{a as we,c as Te,i as Ee,l as De,n as Oe,o as ke,r as Ae,t as je,u as Me}from"./es2015-CQth82uv.js";import{n as Ne,r as Pe,t as Fe}from"./collapsible-BEV4FO-1.js";import{n as Ie,t as Le}from"./switch-Bv2Zf1uU.js";import{a as Re,i as ze,n as Be,r as Ve,t as He}from"./dist-BAoXdNsT.js";import{c as Ue,s as We,t as B}from"./project-router-BYrAO9Ws.js";import{t as Ge}from"./centered-state-V15AR_qo.js";import{$n as Ke,Cn as qe,G as Je,Hn as V,J as Ye,N as Xe,O as Ze,Sn as Qe,W as $e,gn as et,k as tt,q as nt,r as rt,t as it,yn as at}from"./index-BZiixXpY.js";import{_ as ot,a as st,c as ct,d as lt,f as ut,g as dt,h as ft,i as pt,l as mt,m as ht,n as gt,o as _t,p as vt,r as yt,s as bt,t as xt,u as St,v as Ct}from"./automation-format-1lHzRTbq.js";import{t as wt}from"./textarea-vJt9undk.js";function Tt(e,[t,n]){return Math.min(n,Math.max(t,e))}var H=e(t(),1),Et=e(n(),1),U=r(),Dt=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Ot=[` `,`Enter`],W=`Select`,[kt,At,jt]=Se(W),[G,Mt]=be(W,[jt,Re]),Nt=Re(),[Pt,K]=G(W),[Ft,It]=G(W),Lt=`SelectProvider`;function Rt(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=Nt(t),[_,v]=H.useState(null),[y,b]=H.useState(null),[x,ee]=H.useState(!1),te=Ce(l),[S,C]=xe({prop:r,defaultProp:i??!1,onChange:a,caller:W}),[w,T]=xe({prop:o,defaultProp:s,onChange:c,caller:W}),E=H.useRef(null),D=H.useRef(w);H.useEffect(()=>{let e=m?_?.ownerDocument.getElementById(m):_?.form;if(e instanceof HTMLFormElement){let t=()=>T(D.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,_,T]);let O=!_||!!m||!!_.closest(`form`),[k,A]=H.useState(new Set),j=De(),M=Array.from(k).map(e=>e.props.value).join(`;`),N=H.useCallback(e=>{A(t=>new Set(t).add(e))},[]),ne=H.useCallback(e=>{A(t=>{let n=new Set(t);return n.delete(e),n})},[]),re={required:p,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:ee,contentId:j,value:w,onValueChange:T,open:S,onOpenChange:C,dir:te,triggerPointerDownPosRef:E,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:k,nativeSelectKey:M,isFormControl:O};return(0,U.jsx)(ze,{...g,children:(0,U.jsx)(Pt,{scope:t,...re,children:(0,U.jsx)(kt.Provider,{scope:t,children:(0,U.jsx)(Ft,{scope:t,onNativeOptionAdd:N,onNativeOptionRemove:ne,children:In(h)?h(re):n})})})})}Rt.displayName=Lt;var zt=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,U.jsx)(Rt,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,U.jsxs)(U.Fragment,{children:[n,e?(0,U.jsx)(Fn,{__scopeSelect:t}):null]})})};zt.displayName=W;var Bt=`SelectTrigger`,Vt=H.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Nt(n),o=K(Bt,n),s=o.disabled||r,c=I(t,o.onTriggerChange),l=At(n),u=H.useRef(`touch`),[d,f,p]=Rn(e=>{let t=l().filter(e=>!e.disabled),n=zn(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,U.jsx)(He,{asChild:!0,...a,children:(0,U.jsx)(L.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":Ln(o.value)?``:void 0,...i,ref:c,onClick:z(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:z(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:z(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Dt.includes(e.key)&&(m(),e.preventDefault())})})})});Vt.displayName=Bt;var Ht=`SelectValue`,Ut=H.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=K(Ht,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=I(t,c.onValueNodeChange);R(()=>{l(u)},[l,u]);let f=Ln(c.value);return(0,U.jsx)(L.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,U.jsx)(H.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});Ut.displayName=Ht;var Wt=`SelectIcon`,Gt=H.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,U.jsx)(L.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});Gt.displayName=Wt;var Kt=`SelectPortal`,[qt,Jt]=G(Kt,{forceMount:void 0}),Yt=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,U.jsx)(qt,{scope:e.__scopeSelect,forceMount:n,children:(0,U.jsx)(Ee,{asChild:!0,...r})})};Yt.displayName=Kt;var q=`SelectContent`,Xt=H.forwardRef((e,t)=>{let n=Jt(q,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=K(q,e.__scopeSelect),[o,s]=H.useState();return R(()=>{s(new DocumentFragment)},[]),(0,U.jsx)(Me,{present:r||a.open,children:({present:e})=>e?(0,U.jsx)(tn,{...i,ref:t}):(0,U.jsx)(Zt,{...i,fragment:o})})});Xt.displayName=q;var Zt=H.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?Et.createPortal((0,U.jsx)(Qt,{scope:n,children:(0,U.jsx)(kt.Slot,{scope:n,children:(0,U.jsx)(`div`,{ref:t,children:r})})}),i):null});Zt.displayName=`SelectContentFragment`;var J=10,[Qt,Y]=G(q),$t=`SelectContentImpl`,en=ye(`SelectContent.RemoveScroll`),tn=H.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=K(q,n),[y,b]=H.useState(null),[x,ee]=H.useState(null),te=I(t,b),[S,C]=H.useState(null),[w,T]=H.useState(null),E=At(n),[D,O]=H.useState(!1),k=H.useRef(!1);H.useEffect(()=>{if(y)return je(y)},[y]),Ae();let A=H.useCallback(e=>{let[t,...n]=E().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},[E,x]),j=H.useCallback(()=>A([S,y]),[A,S,y]);H.useEffect(()=>{D&&j()},[D,j]);let{onOpenChange:M,triggerPointerDownPosRef:N}=v;H.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(N.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(N.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(y)||M(!1),document.removeEventListener(`pointermove`,t),N.current=null};return N.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,M,N]),H.useEffect(()=>{let e=()=>M(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[M]);let[ne,re]=Rn(e=>{let t=E().filter(e=>!e.disabled),n=zn(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ie=H.useCallback((e,t,n)=>{let r=!k.current&&!n;(v.value!==void 0&&v.value===t||r)&&(C(e),r&&(k.current=!0))},[v.value]),ae=H.useCallback(()=>y?.focus(),[y]),P=H.useCallback((e,t,n)=>{let r=!k.current&&!n;(v.value!==void 0&&v.value===t||r)&&T(e)},[v.value]),oe=r===`popper`?on:rn,se=oe===on?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,U.jsx)(Qt,{scope:n,content:y,viewport:x,onViewportChange:ee,itemRefCallback:ie,selectedItem:S,onItemLeave:ae,itemTextRefCallback:P,focusSelectedItem:j,selectedItemText:w,position:r,isPositioned:D,searchRef:ne,children:(0,U.jsx)(Oe,{as:en,allowPinchZoom:!0,children:(0,U.jsx)(we,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:z(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,U.jsx)(ke,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,U.jsx)(oe,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...se,onPlaced:()=>O(!0),ref:te,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:z(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&re(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=E().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(()=>A(t)),e.preventDefault()}})})})})})})});tn.displayName=$t;var nn=`SelectItemAlignedPosition`,rn=H.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=K(q,n),o=Y(q,n),[s,c]=H.useState(null),[l,u]=H.useState(null),d=I(t,u),f=At(n),p=H.useRef(!1),m=H.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=H.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-J,d=Tt(a,[J,Math.max(J,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-J,d=Tt(a,[J,Math.max(J,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-J*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),C=parseInt(te.paddingBottom,10),w=e.top+e.height/2-J,T=c-w,E=g.offsetHeight/2,D=g.offsetTop+E,O=m+v+D,k=x-O;if(O<=w){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=O+Math.max(T,E+(e?C: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(w,m+h.offsetTop+(e?S:0)+E)+k;s.style.height=t+`px`,h.scrollTop=O-w+h.offsetTop}s.style.margin=`${J}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]);R(()=>y(),[y]);let[b,x]=H.useState();return R(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,U.jsx)(sn,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:H.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,U.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,U.jsx)(L.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});rn.displayName=nn;var an=`SelectPopperPosition`,on=H.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=J,...a}=e,o=Nt(n);return(0,U.jsx)(Ve,{...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)`}})});on.displayName=an;var[sn,cn]=G(q,{}),ln=`SelectViewport`,un=H.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Y(ln,n),o=cn(ln,n),s=I(t,a.onViewportChange),c=H.useRef(0);return(0,U.jsxs)(U.Fragment,{children:[(0,U.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,U.jsx)(kt.Slot,{scope:n,children:(0,U.jsx)(L.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:z(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-J*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})})})]})});un.displayName=ln;var dn=`SelectGroup`,[fn,pn]=G(dn),mn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=De();return(0,U.jsx)(fn,{scope:n,id:i,children:(0,U.jsx)(L.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});mn.displayName=dn;var hn=`SelectLabel`,gn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=pn(hn,n);return(0,U.jsx)(L.div,{id:i.id,...r,ref:t})});gn.displayName=hn;var _n=`SelectItem`,[vn,yn]=G(_n),bn=H.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=K(_n,n),c=Y(_n,n),l=s.value===r,[u,d]=H.useState(a??``),[f,p]=H.useState(!1),m=I(t,Te(e=>c.itemRefCallback?.(e,r,i))),h=De(),g=H.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,U.jsx)(vn,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:H.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,U.jsx)(kt.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,U.jsx)(L.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:z(o.onFocus,()=>p(!0)),onBlur:z(o.onBlur,()=>p(!1)),onClick:z(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:z(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:z(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:z(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:z(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:z(o.onKeyDown,e=>{i||e.target!==e.currentTarget||c.searchRef?.current!==``&&e.key===` `||(Ot.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});bn.displayName=_n;var xn=`SelectItemText`,Sn=H.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=K(xn,n),s=Y(xn,n),c=yn(xn,n),l=It(xn,n),[u,d]=H.useState(null),f=Te(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=I(t,d,c.onItemTextChange,f),m=u?.textContent,h=H.useMemo(()=>(0,U.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return R(()=>(g(h),()=>_(h)),[g,_,h]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(L.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Ln(o.value)?Et.createPortal(a.children,o.valueNode):null]})});Sn.displayName=xn;var Cn=`SelectItemIndicator`,wn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return yn(Cn,n).isSelected?(0,U.jsx)(L.span,{"aria-hidden":!0,...r,ref:t}):null});wn.displayName=Cn;var Tn=`SelectScrollUpButton`,En=H.forwardRef((e,t)=>{let n=Y(Tn,e.__scopeSelect),r=cn(Tn,e.__scopeSelect),[i,a]=H.useState(!1),o=I(t,r.onScrollButtonChange);return R(()=>{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,U.jsx)(kn,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});En.displayName=Tn;var Dn=`SelectScrollDownButton`,On=H.forwardRef((e,t)=>{let n=Y(Dn,e.__scopeSelect),r=cn(Dn,e.__scopeSelect),[i,a]=H.useState(!1),o=I(t,r.onScrollButtonChange);return R(()=>{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,U.jsx)(kn,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});On.displayName=Dn;var kn=H.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Y(`SelectScrollButton`,n),o=H.useRef(null),s=At(n),c=H.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return H.useEffect(()=>()=>c(),[c]),R(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,U.jsx)(L.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:z(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:z(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:z(i.onPointerLeave,()=>{c()})})}),An=`SelectSeparator`,jn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,U.jsx)(L.div,{"aria-hidden":!0,...r,ref:t})});jn.displayName=An;var Mn=`SelectArrow`,Nn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Nt(n);return Y(Mn,n).position===`popper`?(0,U.jsx)(Be,{...i,...r,ref:t}):null});Nn.displayName=Mn;var Pn=`SelectBubbleInput`,Fn=H.forwardRef(({__scopeSelect:e,...t},n)=>{let r=K(Pn,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=H.useRef(null),m=I(n,p),h=i??``,g=Ie(h),_=Array.from(d).some(e=>(e.props.value??``)===``);return H.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,U.jsxs)(L.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{..._e,...t.style},ref:m,defaultValue:h,children:[Ln(i)&&!_?(0,U.jsx)(`option`,{value:``}):null,Array.from(d)]},f)});Fn.displayName=Pn;function In(e){return typeof e==`function`}function Ln(e){return e===``||e===void 0}function Rn(e){let t=Te(e),n=H.useRef(``),r=H.useRef(0),i=H.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=H.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return H.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function zn(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=Bn(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 Bn(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Vn=j([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),Hn=D({includeExisting:T().optional(),authors:A(C()).optional(),assignees:A(C()).optional(),requireCurrentLabels:T().optional(),allLabels:A(C()).optional(),anyLabels:A(C()).optional(),excludeLabels:A(C()).optional(),changedLabels:A(C()).optional(),lookbackDays:w(),maxRecords:w()}),Un=j([`github`,`schedule`]),Wn=f.omit({task:!0,images:!0,systemPrompt:!0}).extend({prompt:C(),variants:O([E(1),E(2),E(3)]).optional(),systemPrompt:C().optional()}),Gn=D({at:C(),outcome:j([`launched`,`cancelled`]),runId:C().optional(),receiptId:C().optional(),trigger:j([`schedule`,`late`,`manual`,`retry`]).optional()}),Kn=D({id:C(),revision:w(),name:C(),description:C().optional(),enabled:T(),kind:Un,events:A(Vn).optional(),intervalSeconds:w().optional(),filters:Hn.optional(),schedule:ct.optional(),task:Wn,archived:Gn.optional(),createdAt:C(),updatedAt:C()}),qn=D({timestamp:C(),tieBreaker:C().optional()}),Jn=D({since:C().datetime(),until:C().datetime(),source:w().int().min(0).max(2),page:w().int().min(1).max(10),item:w().int().min(0).max(100),event:w().int().min(0).max(1e3),cursor:qn.optional()}),Yn={lastError:C().max(1e3).optional(),lastErrorAt:C().datetime().optional()},Xn=D({revision:w().optional(),baselineAt:C().optional(),armedAt:C().optional(),historyScan:Jn.optional(),cursor:qn.optional(),frozenHighWatermark:qn.extend({tieBreaker:C()}).optional(),backlogAfter:qn.extend({tieBreaker:C()}).optional(),nextCheckAt:C().optional(),lastSuccessAt:C().optional(),nextRunAt:C().optional(),lastRunAt:C().optional(),etags:S(C(),C()).optional(),backoffUntil:C().optional(),consecutiveFailures:w().optional(),...Yn,onceOutcome:j([`failed`,`missed`]).optional()});function Zn(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 Qn=j([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]),$n=D({seq:w(),ts:C(),automationId:C(),revision:w(),event:Vn.optional(),result:Qn,reason:C().optional(),durationMs:w().optional(),receiptId:C().optional(),runId:C().optional(),githubNumber:w().optional(),githubTitle:C().optional(),githubUrl:C().optional(),rateLimit:D({bucket:j([`core`,`search`]),remaining:w().optional(),resetAt:C().optional()}).optional()}),er=D({matches:w(),launched:w(),duplicates:w(),errors:w()}),tr=Kn.extend({state:Xn.optional(),latestLog:$n.optional(),counts:er,nextRunAt:C().optional(),onceStatus:vt.optional()});D({available:T(),reason:C().optional(),timeZone:C(),scheduler:D({state:j([`scheduled`,`idle`]),nextDue:C().optional()}),automations:A(tr)}),D({automation:Kn}).extend({once:D({dueAt:C(),timeZone:C(),resolvedInstant:C(),note:C()}).optional()}),D({automation:Kn,state:Xn.optional(),latestLog:$n.optional(),onceStatus:vt.optional()}),D({id:C(),automationId:C(),mode:j([`preview`,`execute`]),status:j([`queued`,`running`,`complete`,`error`]),createdAt:C(),completedAt:C().optional(),matches:w().optional(),truncated:T().optional(),error:C().optional()}),D({checkId:C()}),D({records:A($n)}),D({receiptId:C(),runId:C()}),D({runId:C()}),Kn.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0,kind:!0,archived:!0}).extend({kind:Un.optional(),task:Wn.omit({variants:!0}).strict(),enable:T().optional()}).omit({enable:!0}).extend({enabled:T().optional(),expectedRevision:w()}),D({archived:j([`include`,`only`]).optional()}),D({mode:j([`preview`,`execute`])});function nr({...e}){return(0,U.jsx)(zt,{"data-slot":`select`,...e})}function rr({...e}){return(0,U.jsx)(Ut,{"data-slot":`select-value`,...e})}function ir({className:e,size:t=`default`,children:n,...r}){return(0,U.jsxs)(Vt,{"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,U.jsx)(Gt,{asChild:!0,children:(0,U.jsx)(pe,{className:`size-4 opacity-50`})})]})}function ar({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...a}){return(0,U.jsx)(Yt,{children:(0,U.jsxs)(Xt,{"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,U.jsx)(sr,{}),(0,U.jsx)(un,{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,U.jsx)(cr,{})]})})}function or({className:e,children:t,...n}){return(0,U.jsxs)(bn,{"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,U.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute end-2 flex size-3.5 items-center justify-center`,children:(0,U.jsx)(wn,{children:(0,U.jsx)(ue,{className:`size-4`})})}),(0,U.jsx)(Sn,{children:t})]})}function sr({className:e,...t}){return(0,U.jsx)(En,{"data-slot":`select-scroll-up-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,U.jsx)(de,{className:`size-4`})})}function cr({className:e,...t}){return(0,U.jsx)(On,{"data-slot":`select-scroll-down-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,U.jsx)(pe,{className:`size-4`})})}function X({title:e,subtitle:t,action:n,children:r}){return(0,U.jsxs)(`main`,{"data-route":`automations`,className:`task-flow-page w-full max-w-full min-w-0 max-md:p-4!`,children:[(0,U.jsxs)(`header`,{className:`mb-6 flex flex-col items-start gap-5 max-md:mb-4 max-md:gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h1`,{className:`mb-2 text-[28px] font-medium max-md:text-[22px]`,children:e}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),n]}),r]})}function Z({text:e}){return(0,U.jsx)(`div`,{role:`status`,className:`rounded-xl border bg-card p-6 text-sm text-muted-foreground`,children:e})}var lr={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`},ur={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 dr(e){let[t,n]=(0,H.useState)(),[r,i]=(0,H.useState)(``),a=(0,H.useCallback)(t=>l(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)(()=>c(a),[a]),(0,H.useEffect)(()=>ae((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function fr(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 pr({records:e,all:t,timeZone:n,onRetried:r,readOnly:i=!1}){let a=e=>!i&&fr(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 b(e),r()}catch(t){l({receiptId:e,message:t instanceof Error?t.message:String(t)})}finally{s(void 0)}};return(0,U.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:e.map(e=>(0,U.jsxs)(`li`,{className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,U.jsx)(rt,{dot:lr[e.result],children:ur[e.result]}),(0,U.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:gt(e.ts,n,u)})]}),e.reason?(0,U.jsx)(`p`,{className:`mt-2 text-sm break-words text-muted-foreground`,children:e.reason}):null,e.githubUrl||e.runId||a(e)?(0,U.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[e.githubUrl?(0,U.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,U.jsx)(B,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`}):null,a(e)?(0,U.jsx)(F,{variant:`outline`,disabled:o===e.receiptId,onClick:()=>void d(e.receiptId),children:`Retry task`}):null]}):null,c&&c.receiptId===e.receiptId?(0,U.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm break-words text-destructive`,children:c.message}):null]},e.seq))})}var mr=`all`;function hr({label:e,value:t,onChange:n,options:r}){return(0,U.jsxs)(nr,{value:t,onValueChange:n,children:[(0,U.jsx)(ir,{"aria-label":e,className:`w-full sm:w-52`,children:(0,U.jsx)(rr,{})}),(0,U.jsx)(ar,{children:r.map(e=>(0,U.jsx)(or,{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}=dr(e),[s,c]=(0,H.useState)(mr),[l,u]=(0,H.useState)(mr),d=(0,H.useMemo)(()=>(i??[]).filter(e=>(s===mr||e.result===s)&&(l===mr||e.event===l)),[i,s,l]),f=(i??[]).some(e=>e.event);return(0,U.jsx)(X,{title:`Execution log`,subtitle:t??`Automation activity`,action:(0,U.jsx)(F,{variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{to:`/automations`,children:`Back to automations`})}),children:a&&!i?(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,U.jsx)(Z,{text:a}),(0,U.jsx)(F,{variant:`outline`,onClick:()=>void o(),children:`Retry`})]}):i?i.length===0?(0,U.jsx)(Z,{text:`Nothing has run yet.`}):(0,U.jsxs)(`div`,{className:`grid gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(hr,{label:`Result`,value:s,onChange:c,options:[{value:mr,label:`All results`},...Qn.options.map(e=>({value:e,label:ur[e]}))]}),f?(0,U.jsx)(hr,{label:`Event`,value:l,onChange:u,options:[{value:mr,label:`All events`},...Vn.options.map(e=>({value:e,label:e}))]}):null]}),d.length===0?(0,U.jsx)(Z,{text:`No rows match these filters.`}):(0,U.jsx)(pr,{records:d,all:i,timeZone:n,onRetried:()=>void o(),readOnly:r})]}):(0,U.jsx)(Z,{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}=dr(e);return(0,U.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`mt-4 min-w-0 border-t pt-4`,children:[(0,U.jsxs)(`h3`,{className:`mb-3 text-sm font-medium`,children:[`Recent activity`,r&&t?` · ${t}`:``]}),o&&!a?(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,U.jsx)(Z,{text:o}),(0,U.jsx)(F,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]}):a?a.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing has run yet.`}):(0,U.jsx)(pr,{records:a.slice(0,5),all:a,timeZone:n,onRetried:()=>void s(),readOnly:i}):(0,U.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?yt(i):null,[s,c]=(0,H.useState)(!1),[l,u]=(0,H.useState)(!1),[d,f]=(0,H.useState)(``),p=(0,H.useRef)(null),m=(0,H.useRef)(null),h=(0,H.useRef)(null);(0,H.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,U.jsx)(X,{title:e.name,subtitle:`Archived one-time schedule. It cannot change; delete it when you no longer need the record.`,children:(0,U.jsxs)(`div`,{className:`grid min-w-0 max-w-3xl gap-5`,children:[(0,U.jsxs)(`section`,{className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,U.jsxs)(`p`,{className:`text-sm break-words`,children:[(0,U.jsx)(`span`,{children:r.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`}),r.runId?(0,U.jsxs)(U.Fragment,{children:[` · `,(0,U.jsx)(B,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${r.runId}`,children:`Open task`})]}):null]}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Archived ${xt(r.at,t)} (${t}).`}),a&&i?.timeZone?(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Was due ${a.date} ${a.time} (${i.timeZone}).`}):null]}),(0,U.jsxs)(`section`,{"aria-labelledby":`archived-inputs`,className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,U.jsx)(`h2`,{id:`archived-inputs`,className:`mb-3 text-[15px] font-medium`,children:`What it ran with`}),(0,U.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[(0,U.jsxs)(`div`,{className:`grid gap-1`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:`Prompt`}),(0,U.jsx)(`dd`,{className:`break-words whitespace-pre-wrap`,children:e.task.prompt})]}),_.filter(([,e])=>e).map(([e,t])=>(0,U.jsxs)(`div`,{className:`grid gap-1`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,U.jsx)(`dd`,{className:`break-words`,children:t})]},e))]})]}),(0,U.jsxs)(`section`,{className:`min-w-0`,children:[(0,U.jsx)(_r,{automationId:e.id,automationName:e.name,timeZone:t,readOnly:!0}),(0,U.jsx)(F,{variant:`outline`,asChild:!0,className:`mt-3`,children:(0,U.jsx)(B,{to:`/automations/${e.id}/log`,children:`Execution log`})})]}),(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[s?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? Its record and log are removed; the task stays.`}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:l,onClick:()=>void g(),children:`Delete schedule`}),(0,U.jsx)(F,{ref:m,variant:`outline`,disabled:l,onClick:()=>{h.current=`delete`,c(!1)},children:`Keep`})]})]}):(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{ref:p,variant:`outline`,"data-action":`automation-delete`,onClick:()=>{h.current=`keep`,c(!0)},children:`Delete`}),(0,U.jsx)(F,{variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{to:`/automations`,children:`Back to automations`})})]}),d?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:d}):null]})]})})}var yr=j([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),br=A(C().trim().min(1).max(200)).max(100).optional(),xr=D({includeExisting:T().optional(),requireCurrentLabels:T().optional(),authors:br,assignees:br,allLabels:br,anyLabels:br,excludeLabels:br,changedLabels:br,lookbackDays:w().int().min(1).max(90).default(7),maxRecords:w().int().min(1).max(100).default(25)}).passthrough(),Sr=D({prompt:C().min(1).max(1e5),workflow:C().trim().min(1).max(200).optional(),steps:A(a).min(1).max(100).optional(),runner:d.optional(),model:C().trim().min(1).max(200).optional(),effort:C().trim().min(1).max(32).optional(),variants:O([E(1),E(2),E(3)]).optional(),worktree:T().optional(),autonomous:T().optional(),...g,...v,systemPrompt:C().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)))}M(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??{}}},D({id:C().min(1).max(100),revision:w().int().positive(),name:C().trim().min(1).max(200),description:C().max(2e3).optional(),enabled:T().default(!1),kind:Un.default(`github`),events:A(yr).min(1).max(4).optional(),intervalSeconds:w().int().min(60).max(86400).optional(),filters:xr.optional(),schedule:ct.passthrough().optional(),task:Sr,archived:D({at:C().datetime(),outcome:j([`launched`,`cancelled`]),runId:C().optional(),receiptId:C().optional(),trigger:j([`schedule`,`late`,`manual`,`retry`]).optional()}).passthrough().optional(),createdAt:C().datetime(),updatedAt:C().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`})})),D({version:E(1).default(1),automations:A(k()).default([]),tombstones:S(C(),C().datetime()).optional()}).passthrough();var Tr=D({timestamp:C().datetime(),tieBreaker:C().optional()}).passthrough(),Er=Jn.extend({cursor:Tr.optional()}),Dr=D({revision:w().int().positive().optional(),baselineAt:C().datetime().optional(),armedAt:C().datetime().optional(),historyScan:Er.optional(),cursor:Tr.optional(),frozenHighWatermark:Tr.extend({tieBreaker:C()}).optional(),backlogAfter:Tr.extend({tieBreaker:C()}).optional(),nextCheckAt:C().datetime().optional(),lastSuccessAt:C().datetime().optional(),nextRunAt:C().datetime().optional(),lastRunAt:C().datetime().optional(),etags:S(C(),C()).optional(),backoffUntil:C().datetime().optional(),consecutiveFailures:w().int().nonnegative().optional(),...Yn,onceOutcome:j([`failed`,`missed`]).optional()}).passthrough();D({version:E(1).default(1),states:S(C(),Dr).default({})}).passthrough(),D({receiptId:C().min(1),receiptKey:C().min(1),eventId:C().min(1),automationId:C().min(1),revision:w().int().positive(),status:j([`reserved`,`launched`,`launch-error`,`released`]),runId:C().optional(),observedAt:C().datetime(),updatedAt:C().datetime(),error:C().max(2e3).optional(),occurrenceAt:C().datetime().optional(),candidate:D({eventId:C(),event:yr,timestamp:C().datetime(),tieBreaker:C(),repo:C(),nodeId:C(),number:w().int().positive(),title:C().max(500),url:C().url(),author:C().max(200),assignees:A(C().max(200)).max(100),labels:A(C().max(200)).max(100),changedLabel:C().max(200).optional()}).passthrough().optional()}).passthrough();var Or=j([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]);D({seq:w().int().positive(),ts:C().datetime(),automationId:C().min(1),revision:w().int().positive(),event:yr.optional(),result:Or,reason:C().max(2e3).optional(),durationMs:w().int().nonnegative().optional(),receiptId:C().optional(),runId:C().optional(),githubNumber:w().int().positive().optional(),githubTitle:C().max(500).optional(),githubUrl:C().url().optional(),rateLimit:D({bucket:j([`core`,`search`]),remaining:w().int().nonnegative().optional(),resetAt:C().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:St(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=[`${et()} 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`,mt(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):`${et()} 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=We(),n=window.location.origin,r=(0,H.useMemo)(()=>Ur(e,t?{origin:n,projectId:t}:void 0),[e,n,t]),[i,a]=(0,H.useState)(`idle`),o=(0,H.useRef)(void 0);(0,H.useEffect)(()=>()=>clearTimeout(o.current),[]),(0,H.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,U.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,U.jsxs)(`div`,{className:`mbe-2 flex items-center gap-2`,children:[(0,U.jsx)(`h2`,{id:`copy-as-cli-heading`,className:`text-[15px] font-medium`,children:`Copy as CLI`}),(0,U.jsxs)(F,{type:`button`,variant:`ghost`,size:`sm`,className:`ms-auto`,onClick:()=>void s(),children:[i===`copied`?(0,U.jsx)(ve,{"aria-hidden":`true`}):(0,U.jsx)(Ke,{"aria-hidden":`true`}),i===`copied`?`Copied`:`Copy`]})]}),(0,U.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,U.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,U.jsxs)(U.Fragment,{children:[`The definition Save would create. `,(0,U.jsxs)(`code`,{children:[et(),` automation schema`]}),` prints its shape.`]})})]})}function Gr({pressed:e,onClick:t,disabled:n,children:r}){return(0,U.jsx)(`button`,{type:`button`,"aria-pressed":e,disabled:n,onClick:t,className:i(Ye,`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=Vn.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,U.jsxs)(`div`,{className:`grid gap-4`,children:[n?(0,U.jsx)(`p`,{className:`text-xs text-pending-strong`,children:`GitHub unavailable · ${n}`}):null,(0,U.jsx)(`div`,{role:`group`,"aria-label":`GitHub events`,className:`flex flex-wrap gap-2`,children:Kr.map(t=>(0,U.jsx)(Gr,{pressed:e.events.includes(t),onClick:()=>r(t),children:t},t))}),(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-interval`,children:`Check every`}),(0,U.jsxs)(nr,{value:String(e.intervalSeconds),onValueChange:e=>t({intervalSeconds:Number(e)}),children:[(0,U.jsx)(ir,{id:`automation-interval`,className:`w-full sm:w-48`,"aria-label":`Check every`,children:(0,U.jsx)(rr,{})}),(0,U.jsx)(ar,{children:o.map(e=>(0,U.jsx)(or,{value:String(e.seconds),children:e.label},e.seconds))})]})]}),(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,U.jsx)(Le,{"aria-label":`Include existing items`,"aria-describedby":`automation-history-hint`,checked:e.filters.includeExisting??!1,onCheckedChange:e=>i({includeExisting:e})}),(0,U.jsx)(`span`,{children:`Include existing items`})]}),(0,U.jsx)(`p`,{id:`automation-history-hint`,className:`text-xs text-muted-foreground`,children:Zr(e.filters.includeExisting)})]}),(0,U.jsxs)(Fe,{children:[(0,U.jsxs)(Pe,{className:`group flex min-h-11 items-center gap-2 text-sm font-medium`,children:[`Filters`,(0,U.jsx)(pe,{"aria-hidden":`true`,className:`size-4 text-soft-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-180`})]}),(0,U.jsx)(Ne,{children:(0,U.jsxs)(`div`,{className:`grid gap-4 pt-2 sm:grid-cols-2`,children:[Jr.map(t=>(0,U.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-filter-${t.key}`,children:t.label}),(0,U.jsx)(V,{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,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.hint}):null]},t.key)),(0,U.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-filter-lookback`,children:`Look back (days)`}),(0,U.jsx)(V,{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,U.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-filter-max`,children:`Max records per check`}),(0,U.jsx)(V,{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,H.useState)(ei(t)),o=(0,H.useRef)(null),s=!(/^\d{1,2}$/.test(i)&&Number(i)===t),c=`${e} must be 00–${ei(n)}.`,l=(0,H.useId)();return(0,H.useEffect)(()=>{o.current?.setCustomValidity(s?c:``)},[s,c]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(V,{ref:o,"aria-label":e,"aria-invalid":s||void 0,"aria-describedby":s?l:void 0,inputMode:`numeric`,maxLength:2,className:`w-20 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,U.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=Ct(t,e)??Ct(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?ht(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,H.useRef)(null),u=(0,H.useId)(),d=ut(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?st:``)},[f]);let p=yt(e);return(0,U.jsxs)(`div`,{className:`grid gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-once-date`,children:`Date`}),(0,U.jsx)(V,{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,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,U.jsx)(ti,{label:`Hour`,value:o,max:23,onCommit:e=>c(a,e,s)}),(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,U.jsx)(ti,{label:`Minute`,value:s,max:59,onCommit:e=>c(a,o,e)})]})]}),f?(0,U.jsx)(`p`,{id:u,className:`text-xs text-destructive`,children:st}):null,(0,U.jsx)(li,{value:e.timeZone??``,onCommit:e=>r({timeZone:e})}),(0,U.jsx)(ui,{value:e.latestStartMinutes,onChange:t=>n(ci(e,t))}),p?(0,U.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,H.useState)(e),i=(0,H.useRef)(null),a=(0,H.useId)(),o=(0,H.useId)(),[s]=(0,H.useState)(oi),c=n!==e||!ot(n),l=dt(n);return(0,H.useEffect)(()=>{i.current?.setCustomValidity(c?l:``)},[c,l]),(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-once-zone`,children:`Time zone`}),(0,U.jsx)(V,{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),ot(e.target.value)&&t(e.target.value)}}),(0,U.jsx)(`datalist`,{id:a,children:s.map(e=>(0,U.jsx)(`option`,{value:e},e))}),c?(0,U.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,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-once-latest`,children:`Latest start`}),(0,U.jsxs)(nr,{value:e===void 0?ri:String(e),onValueChange:e=>t(e===ri?void 0:Number(e)),children:[(0,U.jsx)(ir,{id:`automation-once-latest`,className:`w-full sm:w-48`,"aria-label":`Latest start`,children:(0,U.jsx)(rr,{})}),(0,U.jsx)(ar,{children:n.map(e=>(0,U.jsx)(or,{value:e.minutes===void 0?ri:String(e.minutes),children:e.label},e.label))})]}),(0,U.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,U.jsxs)(`div`,{className:`grid gap-4`,children:[(0,U.jsx)(`div`,{role:`group`,"aria-label":`Repeat`,className:`flex flex-wrap gap-2`,children:di.map(t=>(0,U.jsx)(Gr,{pressed:e.type===t.type,onClick:()=>a(t.type),children:t.label},t.type))}),e.type===`once`?(0,U.jsx)(si,{value:e,stored:t,onChange:n}):null,e.type===`weekly`?(0,U.jsx)(`div`,{role:`group`,"aria-label":`Day of the week`,className:`flex flex-wrap gap-2`,children:bt.map((t,n)=>(0,U.jsx)(Gr,{pressed:e.day===n+1,onClick:()=>i({day:n+1}),children:t},t))}):null,e.type===`once`?null:e.type===`hours`?(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-every`,children:`Run every`}),(0,U.jsxs)(nr,{value:String(e.every),onValueChange:e=>i({every:Number(e)}),children:[(0,U.jsx)(ir,{id:`automation-every`,className:`w-full sm:w-48`,"aria-label":`Run every`,children:(0,U.jsx)(rr,{})}),(0,U.jsx)(ar,{children:_t.map(e=>(0,U.jsx)(or,{value:String(e),children:e===1?`hour`:`${e} hours`},e))})]}),(0,U.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,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,U.jsx)(ti,{label:`Hour`,value:e.hour,max:23,onCommit:e=>i({hour:e})}),(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,U.jsx)(ti,{label:`Minute`,value:e.minute,max:59,onCommit:e=>i({minute:e})}),(0,U.jsx)(`span`,{className:`text-sm break-all text-muted-foreground`,children:r})]}),e.type===`once`?null:(0,U.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Cron: `,(0,U.jsx)(`code`,{className:`font-mono text-foreground`,children:mt(e)})]})]})}var pi=40*864e5,mi=5;function hi({schedule:e,timeZone:t,now:n=Date.now()}){if(e.type===`once`)return(0,U.jsx)(gi,{schedule:e,now:n});let r=lt(e,n+1,n+pi,t,mi);return(0,U.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,className:`rounded-xl border bg-card p-4`,children:[(0,U.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-[15px] font-medium`,children:`Next 5 runs`}),r.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No runs in the next 40 days.`}):(0,U.jsx)(`ol`,{"aria-label":`Next 5 runs`,className:`grid gap-1.5 text-sm`,children:r.map(e=>(0,U.jsxs)(`li`,{className:`flex items-baseline justify-between gap-3`,children:[(0,U.jsx)(`span`,{className:`font-medium tabular-nums`,children:xt(new Date(e).toISOString(),t)}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:pt(n,e)})]},e))}),(0,U.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=ut(e),r=yt(e);return(0,U.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,className:`rounded-xl border bg-card p-4`,children:[(0,U.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-[15px] font-medium`,children:`Runs once`}),n===null||!r?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pick a date, a time and a time zone.`}):(0,U.jsxs)(`p`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 text-sm`,children:[(0,U.jsx)(`span`,{className:`font-medium tabular-nums`,children:`${r.date} ${r.time}`}),n>t?(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:pt(t,n)}):null]}),r?.note?(0,U.jsx)(`p`,{className:`mt-2 text-sm break-words`,children:r.note}):null,n!==null&&n<=t?(0,U.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:`The due time has passed.`}):null,(0,U.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,U.jsxs)(`fieldset`,{className:`grid min-w-0 gap-4 rounded-xl border p-5 max-md:p-4!`,children:[(0,U.jsx)(`legend`,{className:`px-0`,children:e}),r,t?.section===n&&!t.conflict?(0,U.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,U.jsx)(U.Fragment,{children:r?(0,U.jsxs)(`p`,{className:`text-sm`,children:[(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`Trigger · `}),_i[e.kind]]}):(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,U.jsx)(it,{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,U.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,U.jsx)(fi,{value:e.schedule,stored:i?.schedule,onChange:e=>t({schedule:e}),timeZone:r}):(0,U.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,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,U.jsx)(wt,{id:`automation-prompt`,value:e.prompt,onChange:e=>t({prompt:e.target.value}),rows:4,required:!0}),(0,U.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:e.kind===`schedule`?(0,U.jsxs)(U.Fragment,{children:[`Available: `,`{{date}}`,` `,`{{time}}`,` `,`{{project}}`,` `,`{{automation}}`,`. A run-context block is appended automatically.`]}):(0,U.jsxs)(U.Fragment,{children:[`Available: `,`{{github.number}}`,` `,`{{github.title}}`,` `,`{{github.url}}`,` `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})})]}),(0,U.jsx)(Ti,{draft:e,patch:t}),(0,U.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,U.jsx)(Le,{"aria-label":`Autonomous`,checked:e.autonomous,onCheckedChange:e=>t({autonomous:e})}),(0,U.jsxs)(`span`,{children:[`Autonomous `,(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`· runs without waiting for answers`})]})]}),(0,U.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,U.jsx)(tt,{archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,onChange:t,disabled:n}),(0,U.jsx)(Ze,{allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging,onChange:t,disabled:n}),r?(0,U.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,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,U.jsx)(Le,{"aria-label":n?`Enabled`:`Enable after saving`,checked:e.enabled,onCheckedChange:e=>t({enabled:e})}),(0,U.jsx)(`span`,{children:n?`Enabled`:`Enable after saving`})]}),(0,U.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,H.useState)(()=>Ar(e)),[c,l]=(0,H.useState)(e?.revision),[u,d]=(0,H.useState)(),[f,p]=(0,H.useState)(!1),[m,g]=(0,H.useState)(!1),[v,y]=(0,H.useState)(!1),[b,x]=(0,H.useState)(``),S=e=>s(t=>({...t,...e})),C=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)}},w=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)}}},T=e?`Save changes`:a.enabled?`Save and enable`:`Save paused`,E=a.kind===`schedule`;return(0,U.jsx)(X,{title:e?`Edit automation`:`New automation`,subtitle:`Define when it runs and the ordinary task it launches.`,children:(0,U.jsxs)(`form`,{className:`automation-editor grid min-w-0 gap-5 md:grid-cols-[minmax(0,1fr)_320px] md:items-start`,onSubmit:C,children:[(0,U.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[(0,U.jsx)(yi,{title:`Name`,section:`name`,failure:u,children:(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-name`,children:`Name`}),(0,U.jsx)(V,{id:`automation-name`,value:a.name,onChange:e=>S({name:e.target.value}),required:!0})]})}),(0,U.jsxs)(yi,{title:`When`,section:`when`,failure:u,children:[(0,U.jsx)(bi,{draft:a,patch:S,forge:t,automation:e}),(0,U.jsx)(xi,{draft:a,patch:S,forge:t,timeZone:n,automation:e})]}),(0,U.jsx)(yi,{title:`What to run`,section:`run`,failure:u,children:(0,U.jsx)(Si,{draft:a,patch:S,saving:f,automation:e})}),(0,U.jsx)(yi,{title:`Enable`,section:`enable`,failure:u,children:(0,U.jsx)(Ci,{draft:a,patch:S,automation:e})}),u?.section===`form`?(0,U.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 text-sm text-destructive`,children:[(0,U.jsx)(`span`,{className:`break-words`,children:u.message}),u.conflict&&i?(0,U.jsx)(F,{type:`button`,variant:`outline`,onClick:i,children:`Reload`}):null]}):null,(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{type:`submit`,disabled:f,children:f?`Saving…`:T}),(0,U.jsx)(F,{type:`button`,variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{to:`/automations`,children:`Cancel`})})]}),e?(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-2 border-t pt-4`,children:[m?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? It will stop running and cannot be restored.`}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{type:`button`,variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:v,onClick:()=>void w(),children:`Delete automation`}),(0,U.jsx)(F,{type:`button`,variant:`outline`,disabled:v,onClick:()=>{g(!1),x(``)},children:`Keep`})]})]}):(0,U.jsx)(F,{type:`button`,variant:`outline`,"data-action":`automation-delete`,onClick:()=>g(!0),children:`Delete`}),b?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:b}):null]}):null]}),(0,U.jsxs)(`aside`,{className:`min-w-0 md:sticky md:top-4`,children:[E?(0,U.jsx)(hi,{schedule:a.schedule,timeZone:n}):(0,U.jsxs)(`section`,{className:`rounded-xl border bg-card p-4`,children:[(0,U.jsx)(`h2`,{className:`mb-2 text-[15px] font-medium`,children:`How it polls`}),(0,U.jsx)(`p`,{className:`text-sm break-words text-muted-foreground`,children:Qr(a)})]}),(0,U.jsx)(Wr,{draft:a})]})]})})}function Ti({draft:e,patch:t}){let n=ne(),r=at(),{runners:i,signedOut:a}=r.runnersOn(e=>r.repoAccount?.[e]),o=re(),s=se(),c=e.runner??o.data?.defaultRunner??`claude`,l=N(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=Xe(c,s.data,l.data,[e.model]),p=f.find(t=>t.id===(e.model??``))?.label??e.model??`auto`,m=e=>(0,U.jsx)(e,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`});return(0,U.jsx)(Je,{children:(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)($e,{slot:`automation-workflow-pill`,icon:m(he),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,U.jsx)($e,{slot:`automation-runner-pill`,icon:m(fe),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:oe(s.data,e)}))],footer:(0,U.jsx)(nt,{uninstalled:r.uninstalled,signedOut:a.filter(t=>t!==e.runner)}),onPick:e=>{t({runner:e||void 0,model:void 0})}}),(0,U.jsx)($e,{slot:`automation-model-pill`,icon:m(ge),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,H.useState)({}),[c,l]=(0,H.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,U.jsx)(X,{title:`Automations`,subtitle:`Schedules and GitHub checks run while Squawk is open.`,action:(0,U.jsx)(F,{asChild:!0,children:(0,U.jsx)(B,{to:`/automations/new`,children:`New automation`})}),children:t&&!e?(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,U.jsx)(Z,{text:t}),(0,U.jsx)(F,{variant:`outline`,onClick:()=>void n(),children:`Retry`})]}):e?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Di,{data:e}),i?(0,U.jsx)(`div`,{className:`mb-4 flex flex-wrap gap-2`,children:(0,U.jsx)(Gr,{pressed:r,onClick:()=>i(!r),children:`Archived`})}):null,r&&e.automations.length===0?(0,U.jsx)(Z,{text:`No archived one-time schedules.`}):e.automations.length===0?(0,U.jsx)(Ge,{icon:(0,U.jsx)(me,{}),tone:`neutral`,title:`No automations yet`,subtitle:`Create one paused, preview it, then enable it.`,heading:`h2`,actions:(0,U.jsx)(F,{asChild:!0,children:(0,U.jsx)(B,{to:`/automations/new`,children:`New automation`})})}):(0,U.jsx)(`ul`,{className:`grid gap-3`,"aria-label":`Automations`,children:e.automations.map(t=>(0,U.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,U.jsx)(Z,{text:`Loading automations…`})})}function Di({data:e}){return(0,U.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?ft(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,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`h2`,{className:`flex items-center gap-2 font-semibold break-words`,children:[(0,U.jsx)(e.kind===`schedule`?le:ce,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),e.name]}),(0,U.jsx)(`p`,{className:`mt-1.5 text-[13px] break-words text-muted-foreground`,children:Oi(e)})]}),t?(0,U.jsx)(rt,{dot:t.dot,children:t.label}):(0,U.jsx)(rt,{dot:e.enabled?`success`:`neutral`,children:e.enabled?`Enabled`:`Paused`})]})}function Mi({automation:e,archive:t}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`mt-3 text-sm break-words`,children:[t.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`,t.runId?(0,U.jsxs)(U.Fragment,{children:[` · `,(0,U.jsx)(B,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${t.runId}`,children:`Open task`})]}):null]}),(0,U.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:(0,U.jsx)(F,{variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{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,U.jsx)(`p`,{className:`mt-3 text-sm`,children:!n&&e.enabled?(0,U.jsx)(`span`,{children:`continuous`}):r?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{children:`Next run: ${xt(r,t)}`}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:` · ${pt(Date.now(),Date.parse(r))}`})]}):(0,U.jsx)(`span`,{children:`Next run: —`})})}function Pi({automation:e,timeZone:t}){let n=e.enabled?Zn(e.state):void 0;return n?(0,U.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,U.jsx)(`span`,{className:`text-muted-foreground`,children:` · Next try ${xt(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,U.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{to:`/automations/${e.id}`,children:`Edit`})}),(0,U.jsx)(F,{variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{to:`/automations/${e.id}/log`,children:`Execution log`})}),(0,U.jsx)(F,{variant:`outline`,"data-action":`automation-toggle`,disabled:t,onClick:i,children:e.enabled?`Pause`:`Enable`}),c?(0,U.jsx)(F,{variant:`outline`,"data-action":`automation-run`,disabled:t,onClick:a,children:`Run now`}):(0,U.jsx)(F,{variant:`outline`,"data-action":`automation-preview`,disabled:t,onClick:o,children:`Test filter`}),l&&!n?(0,U.jsx)(F,{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,U.jsxs)(`div`,{className:`mt-3 grid justify-items-start gap-2`,children:[(0,U.jsx)(`p`,{className:`text-sm break-words`,children:`Cancel “${e.name}”? It will never run, and it moves to Archived.`}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{variant:`danger-ghost`,"data-action":`automation-cancel-confirm`,disabled:t,onClick:r,children:`Cancel schedule`}),(0,U.jsx)(F,{ref:n,variant:`outline`,disabled:t,onClick:i,children:`Keep`})]})]})}function Li({note:e}){return(0,U.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,U.jsxs)(U.Fragment,{children:[` · `,(0,U.jsx)(B,{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,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,U.jsxs)(`li`,{"data-slot":`automation-card`,"data-kind":e.kind,className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,U.jsx)(ji,{automation:e,badge:Ai(e)}),h?(0,U.jsx)(Mi,{automation:e,archive:h}):null,h?null:(0,U.jsx)(Ni,{automation:e,timeZone:t}),h?null:(0,U.jsx)(Pi,{automation:e,timeZone:t}),h?null:(0,U.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,U.jsx)(Ii,{automation:e,busy:r,keepRef:d,onConfirm:()=>{l(!1),s()},onKeep:m}):null,n?(0,U.jsx)(Li,{note:n}):null,(0,U.jsx)(_r,{automationId:e.id,automationName:e.name,timeZone:t})]})}function zi(e){let t=We(),n=qe(),[r,i]=(0,H.useState)(),[a,o]=(0,H.useState)(``),s=(0,H.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,H.useEffect)(()=>{n&&s()},[n,s]),(0,H.useEffect)(()=>c(async e=>{n&&await s(e)}),[n,s]),(0,H.useEffect)(()=>ae((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}=ie(),n=Ue(),[r,i]=(0,H.useState)(!1),{data:a,error:o,refresh:s}=zi(e===`list`?r?`only`:void 0:`include`),[c,l]=(0,H.useState)(0),u=Qe();if(u===`unknown`)return(0,U.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,U.jsx)(Z,{text:`Loading automations…`})});if(u===`unavailable`)return(0,U.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,U.jsx)(Ge,{icon:(0,U.jsx)(me,{}),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,U.jsx)(Ei,{data:a,error:o,refresh:s,archived:r,onArchivedChange:i});if(!a)return o?(0,U.jsx)(X,{title:`Automations`,subtitle:`Could not load automations.`,children:(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,U.jsx)(Z,{text:o}),(0,U.jsx)(F,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]})}):(0,U.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,U.jsx)(Z,{text:`Loading automations…`})});let p={available:a.available,...a.reason?{reason:a.reason}:{}};return e===`new`?(0,U.jsx)(wi,{forge:p,timeZone:a.timeZone,onSaved:d}):e===`edit`?f?f.archived?(0,U.jsx)(vr,{automation:f,timeZone:a.timeZone,onDeleted:d}):(0,U.jsx)(wi,{automation:f,forge:p,timeZone:a.timeZone,onSaved:d,onReload:()=>void s().then(()=>l(e=>e+1))},`${f.id}:${c}`):(0,U.jsx)(X,{title:`Automation not found`,subtitle:`This automation may have been removed.`,children:(0,U.jsx)(F,{asChild:!0,variant:`outline`,children:(0,U.jsx)(B,{to:`/automations`,children:`Back to automations`})})}):t?(0,U.jsx)(gr,{automationId:t,automationName:f?.name,timeZone:a.timeZone,readOnly:!!f?.archived}):(0,U.jsx)(Z,{text:`Automation not found.`})}export{Bi as AutomationsRoute};
|
|
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-D1bpJixc.js";import{B as S,H as C,L as w,M as T,P as E,R as D,U as O,W as k,j as A,k as j,z as M}from"./live-protocol-D9ji1YCl.js";import{Gt as N,kt as ne,p as re}from"./queries-dHXhD3Hc.js";import{h as ie}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as ae,t as P}from"./label-CZp8t0zE.js";import{o as oe,s as se}from"./runners-CGQjSsir.js";import{I as ce,Y as le,c as ue,d as de,it as fe,l as pe,pt as me,ut as he,y as ge}from"./design-icons-CzEoMH9c.js";import{n as _e,r as ve}from"./dist-C28wFbz0.js";import{t as F}from"./button-BQ2y4XRB.js";import{a as I,n as ye}from"./dist-BW234Kg5.js";import{a as L,i as be,n as R,r as z,t as xe}from"./dist-C5mlVBmd.js";import{h as Se,m as Ce}from"./dropdown-menu-4e2iKSMT.js";import{a as we,c as Te,i as Ee,l as De,n as Oe,o as ke,r as Ae,t as je,u as Me}from"./es2015-CQth82uv.js";import{n as Ne,r as Pe,t as Fe}from"./collapsible-BEV4FO-1.js";import{n as Ie,t as Le}from"./switch-Bv2Zf1uU.js";import{a as Re,i as ze,n as Be,r as Ve,t as He}from"./dist-BAoXdNsT.js";import{c as Ue,s as We,t as B}from"./project-router-CIKODSHW.js";import{t as Ge}from"./centered-state-V15AR_qo.js";import{$n as Ke,Cn as qe,G as Je,Hn as V,J as Ye,N as Xe,O as Ze,Sn as Qe,W as $e,gn as et,k as tt,q as nt,r as rt,t as it,yn as at}from"./index-CmadQXcg.js";import{_ as ot,a as st,c as ct,d as lt,f as ut,g as dt,h as ft,i as pt,l as mt,m as ht,n as gt,o as _t,p as vt,r as yt,s as bt,t as xt,u as St,v as Ct}from"./automation-format-1lHzRTbq.js";import{t as wt}from"./textarea-vJt9undk.js";function Tt(e,[t,n]){return Math.min(n,Math.max(t,e))}var H=e(t(),1),Et=e(n(),1),U=r(),Dt=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Ot=[` `,`Enter`],W=`Select`,[kt,At,jt]=Se(W),[G,Mt]=be(W,[jt,Re]),Nt=Re(),[Pt,K]=G(W),[Ft,It]=G(W),Lt=`SelectProvider`;function Rt(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=Nt(t),[_,v]=H.useState(null),[y,b]=H.useState(null),[x,ee]=H.useState(!1),te=Ce(l),[S,C]=xe({prop:r,defaultProp:i??!1,onChange:a,caller:W}),[w,T]=xe({prop:o,defaultProp:s,onChange:c,caller:W}),E=H.useRef(null),D=H.useRef(w);H.useEffect(()=>{let e=m?_?.ownerDocument.getElementById(m):_?.form;if(e instanceof HTMLFormElement){let t=()=>T(D.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,_,T]);let O=!_||!!m||!!_.closest(`form`),[k,A]=H.useState(new Set),j=De(),M=Array.from(k).map(e=>e.props.value).join(`;`),N=H.useCallback(e=>{A(t=>new Set(t).add(e))},[]),ne=H.useCallback(e=>{A(t=>{let n=new Set(t);return n.delete(e),n})},[]),re={required:p,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:ee,contentId:j,value:w,onValueChange:T,open:S,onOpenChange:C,dir:te,triggerPointerDownPosRef:E,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:k,nativeSelectKey:M,isFormControl:O};return(0,U.jsx)(ze,{...g,children:(0,U.jsx)(Pt,{scope:t,...re,children:(0,U.jsx)(kt.Provider,{scope:t,children:(0,U.jsx)(Ft,{scope:t,onNativeOptionAdd:N,onNativeOptionRemove:ne,children:In(h)?h(re):n})})})})}Rt.displayName=Lt;var zt=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,U.jsx)(Rt,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,U.jsxs)(U.Fragment,{children:[n,e?(0,U.jsx)(Fn,{__scopeSelect:t}):null]})})};zt.displayName=W;var Bt=`SelectTrigger`,Vt=H.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Nt(n),o=K(Bt,n),s=o.disabled||r,c=I(t,o.onTriggerChange),l=At(n),u=H.useRef(`touch`),[d,f,p]=Rn(e=>{let t=l().filter(e=>!e.disabled),n=zn(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,U.jsx)(He,{asChild:!0,...a,children:(0,U.jsx)(L.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":Ln(o.value)?``:void 0,...i,ref:c,onClick:z(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:z(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:z(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Dt.includes(e.key)&&(m(),e.preventDefault())})})})});Vt.displayName=Bt;var Ht=`SelectValue`,Ut=H.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=K(Ht,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=I(t,c.onValueNodeChange);R(()=>{l(u)},[l,u]);let f=Ln(c.value);return(0,U.jsx)(L.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,U.jsx)(H.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});Ut.displayName=Ht;var Wt=`SelectIcon`,Gt=H.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,U.jsx)(L.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});Gt.displayName=Wt;var Kt=`SelectPortal`,[qt,Jt]=G(Kt,{forceMount:void 0}),Yt=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,U.jsx)(qt,{scope:e.__scopeSelect,forceMount:n,children:(0,U.jsx)(Ee,{asChild:!0,...r})})};Yt.displayName=Kt;var q=`SelectContent`,Xt=H.forwardRef((e,t)=>{let n=Jt(q,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=K(q,e.__scopeSelect),[o,s]=H.useState();return R(()=>{s(new DocumentFragment)},[]),(0,U.jsx)(Me,{present:r||a.open,children:({present:e})=>e?(0,U.jsx)(tn,{...i,ref:t}):(0,U.jsx)(Zt,{...i,fragment:o})})});Xt.displayName=q;var Zt=H.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?Et.createPortal((0,U.jsx)(Qt,{scope:n,children:(0,U.jsx)(kt.Slot,{scope:n,children:(0,U.jsx)(`div`,{ref:t,children:r})})}),i):null});Zt.displayName=`SelectContentFragment`;var J=10,[Qt,Y]=G(q),$t=`SelectContentImpl`,en=ye(`SelectContent.RemoveScroll`),tn=H.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=K(q,n),[y,b]=H.useState(null),[x,ee]=H.useState(null),te=I(t,b),[S,C]=H.useState(null),[w,T]=H.useState(null),E=At(n),[D,O]=H.useState(!1),k=H.useRef(!1);H.useEffect(()=>{if(y)return je(y)},[y]),Ae();let A=H.useCallback(e=>{let[t,...n]=E().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},[E,x]),j=H.useCallback(()=>A([S,y]),[A,S,y]);H.useEffect(()=>{D&&j()},[D,j]);let{onOpenChange:M,triggerPointerDownPosRef:N}=v;H.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(N.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(N.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(y)||M(!1),document.removeEventListener(`pointermove`,t),N.current=null};return N.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,M,N]),H.useEffect(()=>{let e=()=>M(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[M]);let[ne,re]=Rn(e=>{let t=E().filter(e=>!e.disabled),n=zn(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ie=H.useCallback((e,t,n)=>{let r=!k.current&&!n;(v.value!==void 0&&v.value===t||r)&&(C(e),r&&(k.current=!0))},[v.value]),ae=H.useCallback(()=>y?.focus(),[y]),P=H.useCallback((e,t,n)=>{let r=!k.current&&!n;(v.value!==void 0&&v.value===t||r)&&T(e)},[v.value]),oe=r===`popper`?on:rn,se=oe===on?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,U.jsx)(Qt,{scope:n,content:y,viewport:x,onViewportChange:ee,itemRefCallback:ie,selectedItem:S,onItemLeave:ae,itemTextRefCallback:P,focusSelectedItem:j,selectedItemText:w,position:r,isPositioned:D,searchRef:ne,children:(0,U.jsx)(Oe,{as:en,allowPinchZoom:!0,children:(0,U.jsx)(we,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:z(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,U.jsx)(ke,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,U.jsx)(oe,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...se,onPlaced:()=>O(!0),ref:te,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:z(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&re(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=E().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(()=>A(t)),e.preventDefault()}})})})})})})});tn.displayName=$t;var nn=`SelectItemAlignedPosition`,rn=H.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=K(q,n),o=Y(q,n),[s,c]=H.useState(null),[l,u]=H.useState(null),d=I(t,u),f=At(n),p=H.useRef(!1),m=H.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=H.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-J,d=Tt(a,[J,Math.max(J,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-J,d=Tt(a,[J,Math.max(J,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-J*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),C=parseInt(te.paddingBottom,10),w=e.top+e.height/2-J,T=c-w,E=g.offsetHeight/2,D=g.offsetTop+E,O=m+v+D,k=x-O;if(O<=w){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=O+Math.max(T,E+(e?C: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(w,m+h.offsetTop+(e?S:0)+E)+k;s.style.height=t+`px`,h.scrollTop=O-w+h.offsetTop}s.style.margin=`${J}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]);R(()=>y(),[y]);let[b,x]=H.useState();return R(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,U.jsx)(sn,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:H.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,U.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,U.jsx)(L.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});rn.displayName=nn;var an=`SelectPopperPosition`,on=H.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=J,...a}=e,o=Nt(n);return(0,U.jsx)(Ve,{...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)`}})});on.displayName=an;var[sn,cn]=G(q,{}),ln=`SelectViewport`,un=H.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Y(ln,n),o=cn(ln,n),s=I(t,a.onViewportChange),c=H.useRef(0);return(0,U.jsxs)(U.Fragment,{children:[(0,U.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,U.jsx)(kt.Slot,{scope:n,children:(0,U.jsx)(L.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:z(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-J*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})})})]})});un.displayName=ln;var dn=`SelectGroup`,[fn,pn]=G(dn),mn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=De();return(0,U.jsx)(fn,{scope:n,id:i,children:(0,U.jsx)(L.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});mn.displayName=dn;var hn=`SelectLabel`,gn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=pn(hn,n);return(0,U.jsx)(L.div,{id:i.id,...r,ref:t})});gn.displayName=hn;var _n=`SelectItem`,[vn,yn]=G(_n),bn=H.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=K(_n,n),c=Y(_n,n),l=s.value===r,[u,d]=H.useState(a??``),[f,p]=H.useState(!1),m=I(t,Te(e=>c.itemRefCallback?.(e,r,i))),h=De(),g=H.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,U.jsx)(vn,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:H.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,U.jsx)(kt.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,U.jsx)(L.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:z(o.onFocus,()=>p(!0)),onBlur:z(o.onBlur,()=>p(!1)),onClick:z(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:z(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:z(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:z(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:z(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:z(o.onKeyDown,e=>{i||e.target!==e.currentTarget||c.searchRef?.current!==``&&e.key===` `||(Ot.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});bn.displayName=_n;var xn=`SelectItemText`,Sn=H.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=K(xn,n),s=Y(xn,n),c=yn(xn,n),l=It(xn,n),[u,d]=H.useState(null),f=Te(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=I(t,d,c.onItemTextChange,f),m=u?.textContent,h=H.useMemo(()=>(0,U.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return R(()=>(g(h),()=>_(h)),[g,_,h]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(L.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Ln(o.value)?Et.createPortal(a.children,o.valueNode):null]})});Sn.displayName=xn;var Cn=`SelectItemIndicator`,wn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return yn(Cn,n).isSelected?(0,U.jsx)(L.span,{"aria-hidden":!0,...r,ref:t}):null});wn.displayName=Cn;var Tn=`SelectScrollUpButton`,En=H.forwardRef((e,t)=>{let n=Y(Tn,e.__scopeSelect),r=cn(Tn,e.__scopeSelect),[i,a]=H.useState(!1),o=I(t,r.onScrollButtonChange);return R(()=>{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,U.jsx)(kn,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});En.displayName=Tn;var Dn=`SelectScrollDownButton`,On=H.forwardRef((e,t)=>{let n=Y(Dn,e.__scopeSelect),r=cn(Dn,e.__scopeSelect),[i,a]=H.useState(!1),o=I(t,r.onScrollButtonChange);return R(()=>{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,U.jsx)(kn,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});On.displayName=Dn;var kn=H.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Y(`SelectScrollButton`,n),o=H.useRef(null),s=At(n),c=H.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return H.useEffect(()=>()=>c(),[c]),R(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,U.jsx)(L.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:z(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:z(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:z(i.onPointerLeave,()=>{c()})})}),An=`SelectSeparator`,jn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,U.jsx)(L.div,{"aria-hidden":!0,...r,ref:t})});jn.displayName=An;var Mn=`SelectArrow`,Nn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Nt(n);return Y(Mn,n).position===`popper`?(0,U.jsx)(Be,{...i,...r,ref:t}):null});Nn.displayName=Mn;var Pn=`SelectBubbleInput`,Fn=H.forwardRef(({__scopeSelect:e,...t},n)=>{let r=K(Pn,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=H.useRef(null),m=I(n,p),h=i??``,g=Ie(h),_=Array.from(d).some(e=>(e.props.value??``)===``);return H.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,U.jsxs)(L.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{..._e,...t.style},ref:m,defaultValue:h,children:[Ln(i)&&!_?(0,U.jsx)(`option`,{value:``}):null,Array.from(d)]},f)});Fn.displayName=Pn;function In(e){return typeof e==`function`}function Ln(e){return e===``||e===void 0}function Rn(e){let t=Te(e),n=H.useRef(``),r=H.useRef(0),i=H.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=H.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return H.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function zn(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=Bn(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 Bn(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Vn=j([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),Hn=D({includeExisting:T().optional(),authors:A(C()).optional(),assignees:A(C()).optional(),requireCurrentLabels:T().optional(),allLabels:A(C()).optional(),anyLabels:A(C()).optional(),excludeLabels:A(C()).optional(),changedLabels:A(C()).optional(),lookbackDays:w(),maxRecords:w()}),Un=j([`github`,`schedule`]),Wn=f.omit({task:!0,images:!0,systemPrompt:!0}).extend({prompt:C(),variants:O([E(1),E(2),E(3)]).optional(),systemPrompt:C().optional()}),Gn=D({at:C(),outcome:j([`launched`,`cancelled`]),runId:C().optional(),receiptId:C().optional(),trigger:j([`schedule`,`late`,`manual`,`retry`]).optional()}),Kn=D({id:C(),revision:w(),name:C(),description:C().optional(),enabled:T(),kind:Un,events:A(Vn).optional(),intervalSeconds:w().optional(),filters:Hn.optional(),schedule:ct.optional(),task:Wn,archived:Gn.optional(),createdAt:C(),updatedAt:C()}),qn=D({timestamp:C(),tieBreaker:C().optional()}),Jn=D({since:C().datetime(),until:C().datetime(),source:w().int().min(0).max(2),page:w().int().min(1).max(10),item:w().int().min(0).max(100),event:w().int().min(0).max(1e3),cursor:qn.optional()}),Yn={lastError:C().max(1e3).optional(),lastErrorAt:C().datetime().optional()},Xn=D({revision:w().optional(),baselineAt:C().optional(),armedAt:C().optional(),historyScan:Jn.optional(),cursor:qn.optional(),frozenHighWatermark:qn.extend({tieBreaker:C()}).optional(),backlogAfter:qn.extend({tieBreaker:C()}).optional(),nextCheckAt:C().optional(),lastSuccessAt:C().optional(),nextRunAt:C().optional(),lastRunAt:C().optional(),etags:S(C(),C()).optional(),backoffUntil:C().optional(),consecutiveFailures:w().optional(),...Yn,onceOutcome:j([`failed`,`missed`]).optional()});function Zn(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 Qn=j([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]),$n=D({seq:w(),ts:C(),automationId:C(),revision:w(),event:Vn.optional(),result:Qn,reason:C().optional(),durationMs:w().optional(),receiptId:C().optional(),runId:C().optional(),githubNumber:w().optional(),githubTitle:C().optional(),githubUrl:C().optional(),rateLimit:D({bucket:j([`core`,`search`]),remaining:w().optional(),resetAt:C().optional()}).optional()}),er=D({matches:w(),launched:w(),duplicates:w(),errors:w()}),tr=Kn.extend({state:Xn.optional(),latestLog:$n.optional(),counts:er,nextRunAt:C().optional(),onceStatus:vt.optional()});D({available:T(),reason:C().optional(),timeZone:C(),scheduler:D({state:j([`scheduled`,`idle`]),nextDue:C().optional()}),automations:A(tr)}),D({automation:Kn}).extend({once:D({dueAt:C(),timeZone:C(),resolvedInstant:C(),note:C()}).optional()}),D({automation:Kn,state:Xn.optional(),latestLog:$n.optional(),onceStatus:vt.optional()}),D({id:C(),automationId:C(),mode:j([`preview`,`execute`]),status:j([`queued`,`running`,`complete`,`error`]),createdAt:C(),completedAt:C().optional(),matches:w().optional(),truncated:T().optional(),error:C().optional()}),D({checkId:C()}),D({records:A($n)}),D({receiptId:C(),runId:C()}),D({runId:C()}),Kn.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0,kind:!0,archived:!0}).extend({kind:Un.optional(),task:Wn.omit({variants:!0}).strict(),enable:T().optional()}).omit({enable:!0}).extend({enabled:T().optional(),expectedRevision:w()}),D({archived:j([`include`,`only`]).optional()}),D({mode:j([`preview`,`execute`])});function nr({...e}){return(0,U.jsx)(zt,{"data-slot":`select`,...e})}function rr({...e}){return(0,U.jsx)(Ut,{"data-slot":`select-value`,...e})}function ir({className:e,size:t=`default`,children:n,...r}){return(0,U.jsxs)(Vt,{"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,U.jsx)(Gt,{asChild:!0,children:(0,U.jsx)(pe,{className:`size-4 opacity-50`})})]})}function ar({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...a}){return(0,U.jsx)(Yt,{children:(0,U.jsxs)(Xt,{"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,U.jsx)(sr,{}),(0,U.jsx)(un,{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,U.jsx)(cr,{})]})})}function or({className:e,children:t,...n}){return(0,U.jsxs)(bn,{"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,U.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute end-2 flex size-3.5 items-center justify-center`,children:(0,U.jsx)(wn,{children:(0,U.jsx)(ue,{className:`size-4`})})}),(0,U.jsx)(Sn,{children:t})]})}function sr({className:e,...t}){return(0,U.jsx)(En,{"data-slot":`select-scroll-up-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,U.jsx)(de,{className:`size-4`})})}function cr({className:e,...t}){return(0,U.jsx)(On,{"data-slot":`select-scroll-down-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,U.jsx)(pe,{className:`size-4`})})}function X({title:e,subtitle:t,action:n,children:r}){return(0,U.jsxs)(`main`,{"data-route":`automations`,className:`task-flow-page w-full max-w-full min-w-0 max-md:p-4!`,children:[(0,U.jsxs)(`header`,{className:`mb-6 flex flex-col items-start gap-5 max-md:mb-4 max-md:gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h1`,{className:`mb-2 text-[28px] font-medium max-md:text-[22px]`,children:e}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),n]}),r]})}function Z({text:e}){return(0,U.jsx)(`div`,{role:`status`,className:`rounded-xl border bg-card p-6 text-sm text-muted-foreground`,children:e})}var lr={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`},ur={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 dr(e){let[t,n]=(0,H.useState)(),[r,i]=(0,H.useState)(``),a=(0,H.useCallback)(t=>l(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)(()=>c(a),[a]),(0,H.useEffect)(()=>ae((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function fr(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 pr({records:e,all:t,timeZone:n,onRetried:r,readOnly:i=!1}){let a=e=>!i&&fr(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 b(e),r()}catch(t){l({receiptId:e,message:t instanceof Error?t.message:String(t)})}finally{s(void 0)}};return(0,U.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:e.map(e=>(0,U.jsxs)(`li`,{className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,U.jsx)(rt,{dot:lr[e.result],children:ur[e.result]}),(0,U.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:gt(e.ts,n,u)})]}),e.reason?(0,U.jsx)(`p`,{className:`mt-2 text-sm break-words text-muted-foreground`,children:e.reason}):null,e.githubUrl||e.runId||a(e)?(0,U.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[e.githubUrl?(0,U.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,U.jsx)(B,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`}):null,a(e)?(0,U.jsx)(F,{variant:`outline`,disabled:o===e.receiptId,onClick:()=>void d(e.receiptId),children:`Retry task`}):null]}):null,c&&c.receiptId===e.receiptId?(0,U.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm break-words text-destructive`,children:c.message}):null]},e.seq))})}var mr=`all`;function hr({label:e,value:t,onChange:n,options:r}){return(0,U.jsxs)(nr,{value:t,onValueChange:n,children:[(0,U.jsx)(ir,{"aria-label":e,className:`w-full sm:w-52`,children:(0,U.jsx)(rr,{})}),(0,U.jsx)(ar,{children:r.map(e=>(0,U.jsx)(or,{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}=dr(e),[s,c]=(0,H.useState)(mr),[l,u]=(0,H.useState)(mr),d=(0,H.useMemo)(()=>(i??[]).filter(e=>(s===mr||e.result===s)&&(l===mr||e.event===l)),[i,s,l]),f=(i??[]).some(e=>e.event);return(0,U.jsx)(X,{title:`Execution log`,subtitle:t??`Automation activity`,action:(0,U.jsx)(F,{variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{to:`/automations`,children:`Back to automations`})}),children:a&&!i?(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,U.jsx)(Z,{text:a}),(0,U.jsx)(F,{variant:`outline`,onClick:()=>void o(),children:`Retry`})]}):i?i.length===0?(0,U.jsx)(Z,{text:`Nothing has run yet.`}):(0,U.jsxs)(`div`,{className:`grid gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(hr,{label:`Result`,value:s,onChange:c,options:[{value:mr,label:`All results`},...Qn.options.map(e=>({value:e,label:ur[e]}))]}),f?(0,U.jsx)(hr,{label:`Event`,value:l,onChange:u,options:[{value:mr,label:`All events`},...Vn.options.map(e=>({value:e,label:e}))]}):null]}),d.length===0?(0,U.jsx)(Z,{text:`No rows match these filters.`}):(0,U.jsx)(pr,{records:d,all:i,timeZone:n,onRetried:()=>void o(),readOnly:r})]}):(0,U.jsx)(Z,{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}=dr(e);return(0,U.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`mt-4 min-w-0 border-t pt-4`,children:[(0,U.jsxs)(`h3`,{className:`mb-3 text-sm font-medium`,children:[`Recent activity`,r&&t?` · ${t}`:``]}),o&&!a?(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,U.jsx)(Z,{text:o}),(0,U.jsx)(F,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]}):a?a.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing has run yet.`}):(0,U.jsx)(pr,{records:a.slice(0,5),all:a,timeZone:n,onRetried:()=>void s(),readOnly:i}):(0,U.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?yt(i):null,[s,c]=(0,H.useState)(!1),[l,u]=(0,H.useState)(!1),[d,f]=(0,H.useState)(``),p=(0,H.useRef)(null),m=(0,H.useRef)(null),h=(0,H.useRef)(null);(0,H.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,U.jsx)(X,{title:e.name,subtitle:`Archived one-time schedule. It cannot change; delete it when you no longer need the record.`,children:(0,U.jsxs)(`div`,{className:`grid min-w-0 max-w-3xl gap-5`,children:[(0,U.jsxs)(`section`,{className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,U.jsxs)(`p`,{className:`text-sm break-words`,children:[(0,U.jsx)(`span`,{children:r.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`}),r.runId?(0,U.jsxs)(U.Fragment,{children:[` · `,(0,U.jsx)(B,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${r.runId}`,children:`Open task`})]}):null]}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Archived ${xt(r.at,t)} (${t}).`}),a&&i?.timeZone?(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Was due ${a.date} ${a.time} (${i.timeZone}).`}):null]}),(0,U.jsxs)(`section`,{"aria-labelledby":`archived-inputs`,className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,U.jsx)(`h2`,{id:`archived-inputs`,className:`mb-3 text-[15px] font-medium`,children:`What it ran with`}),(0,U.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[(0,U.jsxs)(`div`,{className:`grid gap-1`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:`Prompt`}),(0,U.jsx)(`dd`,{className:`break-words whitespace-pre-wrap`,children:e.task.prompt})]}),_.filter(([,e])=>e).map(([e,t])=>(0,U.jsxs)(`div`,{className:`grid gap-1`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,U.jsx)(`dd`,{className:`break-words`,children:t})]},e))]})]}),(0,U.jsxs)(`section`,{className:`min-w-0`,children:[(0,U.jsx)(_r,{automationId:e.id,automationName:e.name,timeZone:t,readOnly:!0}),(0,U.jsx)(F,{variant:`outline`,asChild:!0,className:`mt-3`,children:(0,U.jsx)(B,{to:`/automations/${e.id}/log`,children:`Execution log`})})]}),(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[s?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? Its record and log are removed; the task stays.`}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:l,onClick:()=>void g(),children:`Delete schedule`}),(0,U.jsx)(F,{ref:m,variant:`outline`,disabled:l,onClick:()=>{h.current=`delete`,c(!1)},children:`Keep`})]})]}):(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{ref:p,variant:`outline`,"data-action":`automation-delete`,onClick:()=>{h.current=`keep`,c(!0)},children:`Delete`}),(0,U.jsx)(F,{variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{to:`/automations`,children:`Back to automations`})})]}),d?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:d}):null]})]})})}var yr=j([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),br=A(C().trim().min(1).max(200)).max(100).optional(),xr=D({includeExisting:T().optional(),requireCurrentLabels:T().optional(),authors:br,assignees:br,allLabels:br,anyLabels:br,excludeLabels:br,changedLabels:br,lookbackDays:w().int().min(1).max(90).default(7),maxRecords:w().int().min(1).max(100).default(25)}).passthrough(),Sr=D({prompt:C().min(1).max(1e5),workflow:C().trim().min(1).max(200).optional(),steps:A(a).min(1).max(100).optional(),runner:d.optional(),model:C().trim().min(1).max(200).optional(),effort:C().trim().min(1).max(32).optional(),variants:O([E(1),E(2),E(3)]).optional(),worktree:T().optional(),autonomous:T().optional(),...g,...v,systemPrompt:C().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)))}M(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??{}}},D({id:C().min(1).max(100),revision:w().int().positive(),name:C().trim().min(1).max(200),description:C().max(2e3).optional(),enabled:T().default(!1),kind:Un.default(`github`),events:A(yr).min(1).max(4).optional(),intervalSeconds:w().int().min(60).max(86400).optional(),filters:xr.optional(),schedule:ct.passthrough().optional(),task:Sr,archived:D({at:C().datetime(),outcome:j([`launched`,`cancelled`]),runId:C().optional(),receiptId:C().optional(),trigger:j([`schedule`,`late`,`manual`,`retry`]).optional()}).passthrough().optional(),createdAt:C().datetime(),updatedAt:C().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`})})),D({version:E(1).default(1),automations:A(k()).default([]),tombstones:S(C(),C().datetime()).optional()}).passthrough();var Tr=D({timestamp:C().datetime(),tieBreaker:C().optional()}).passthrough(),Er=Jn.extend({cursor:Tr.optional()}),Dr=D({revision:w().int().positive().optional(),baselineAt:C().datetime().optional(),armedAt:C().datetime().optional(),historyScan:Er.optional(),cursor:Tr.optional(),frozenHighWatermark:Tr.extend({tieBreaker:C()}).optional(),backlogAfter:Tr.extend({tieBreaker:C()}).optional(),nextCheckAt:C().datetime().optional(),lastSuccessAt:C().datetime().optional(),nextRunAt:C().datetime().optional(),lastRunAt:C().datetime().optional(),etags:S(C(),C()).optional(),backoffUntil:C().datetime().optional(),consecutiveFailures:w().int().nonnegative().optional(),...Yn,onceOutcome:j([`failed`,`missed`]).optional()}).passthrough();D({version:E(1).default(1),states:S(C(),Dr).default({})}).passthrough(),D({receiptId:C().min(1),receiptKey:C().min(1),eventId:C().min(1),automationId:C().min(1),revision:w().int().positive(),status:j([`reserved`,`launched`,`launch-error`,`released`]),runId:C().optional(),observedAt:C().datetime(),updatedAt:C().datetime(),error:C().max(2e3).optional(),occurrenceAt:C().datetime().optional(),candidate:D({eventId:C(),event:yr,timestamp:C().datetime(),tieBreaker:C(),repo:C(),nodeId:C(),number:w().int().positive(),title:C().max(500),url:C().url(),author:C().max(200),assignees:A(C().max(200)).max(100),labels:A(C().max(200)).max(100),changedLabel:C().max(200).optional()}).passthrough().optional()}).passthrough();var Or=j([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]);D({seq:w().int().positive(),ts:C().datetime(),automationId:C().min(1),revision:w().int().positive(),event:yr.optional(),result:Or,reason:C().max(2e3).optional(),durationMs:w().int().nonnegative().optional(),receiptId:C().optional(),runId:C().optional(),githubNumber:w().int().positive().optional(),githubTitle:C().max(500).optional(),githubUrl:C().url().optional(),rateLimit:D({bucket:j([`core`,`search`]),remaining:w().int().nonnegative().optional(),resetAt:C().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:St(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=[`${et()} 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`,mt(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):`${et()} 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=We(),n=window.location.origin,r=(0,H.useMemo)(()=>Ur(e,t?{origin:n,projectId:t}:void 0),[e,n,t]),[i,a]=(0,H.useState)(`idle`),o=(0,H.useRef)(void 0);(0,H.useEffect)(()=>()=>clearTimeout(o.current),[]),(0,H.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,U.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,U.jsxs)(`div`,{className:`mbe-2 flex items-center gap-2`,children:[(0,U.jsx)(`h2`,{id:`copy-as-cli-heading`,className:`text-[15px] font-medium`,children:`Copy as CLI`}),(0,U.jsxs)(F,{type:`button`,variant:`ghost`,size:`sm`,className:`ms-auto`,onClick:()=>void s(),children:[i===`copied`?(0,U.jsx)(ve,{"aria-hidden":`true`}):(0,U.jsx)(Ke,{"aria-hidden":`true`}),i===`copied`?`Copied`:`Copy`]})]}),(0,U.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,U.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,U.jsxs)(U.Fragment,{children:[`The definition Save would create. `,(0,U.jsxs)(`code`,{children:[et(),` automation schema`]}),` prints its shape.`]})})]})}function Gr({pressed:e,onClick:t,disabled:n,children:r}){return(0,U.jsx)(`button`,{type:`button`,"aria-pressed":e,disabled:n,onClick:t,className:i(Ye,`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=Vn.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,U.jsxs)(`div`,{className:`grid gap-4`,children:[n?(0,U.jsx)(`p`,{className:`text-xs text-pending-strong`,children:`GitHub unavailable · ${n}`}):null,(0,U.jsx)(`div`,{role:`group`,"aria-label":`GitHub events`,className:`flex flex-wrap gap-2`,children:Kr.map(t=>(0,U.jsx)(Gr,{pressed:e.events.includes(t),onClick:()=>r(t),children:t},t))}),(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-interval`,children:`Check every`}),(0,U.jsxs)(nr,{value:String(e.intervalSeconds),onValueChange:e=>t({intervalSeconds:Number(e)}),children:[(0,U.jsx)(ir,{id:`automation-interval`,className:`w-full sm:w-48`,"aria-label":`Check every`,children:(0,U.jsx)(rr,{})}),(0,U.jsx)(ar,{children:o.map(e=>(0,U.jsx)(or,{value:String(e.seconds),children:e.label},e.seconds))})]})]}),(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,U.jsx)(Le,{"aria-label":`Include existing items`,"aria-describedby":`automation-history-hint`,checked:e.filters.includeExisting??!1,onCheckedChange:e=>i({includeExisting:e})}),(0,U.jsx)(`span`,{children:`Include existing items`})]}),(0,U.jsx)(`p`,{id:`automation-history-hint`,className:`text-xs text-muted-foreground`,children:Zr(e.filters.includeExisting)})]}),(0,U.jsxs)(Fe,{children:[(0,U.jsxs)(Pe,{className:`group flex min-h-11 items-center gap-2 text-sm font-medium`,children:[`Filters`,(0,U.jsx)(pe,{"aria-hidden":`true`,className:`size-4 text-soft-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-180`})]}),(0,U.jsx)(Ne,{children:(0,U.jsxs)(`div`,{className:`grid gap-4 pt-2 sm:grid-cols-2`,children:[Jr.map(t=>(0,U.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-filter-${t.key}`,children:t.label}),(0,U.jsx)(V,{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,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.hint}):null]},t.key)),(0,U.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-filter-lookback`,children:`Look back (days)`}),(0,U.jsx)(V,{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,U.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-filter-max`,children:`Max records per check`}),(0,U.jsx)(V,{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,H.useState)(ei(t)),o=(0,H.useRef)(null),s=!(/^\d{1,2}$/.test(i)&&Number(i)===t),c=`${e} must be 00–${ei(n)}.`,l=(0,H.useId)();return(0,H.useEffect)(()=>{o.current?.setCustomValidity(s?c:``)},[s,c]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(V,{ref:o,"aria-label":e,"aria-invalid":s||void 0,"aria-describedby":s?l:void 0,inputMode:`numeric`,maxLength:2,className:`w-20 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,U.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=Ct(t,e)??Ct(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?ht(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,H.useRef)(null),u=(0,H.useId)(),d=ut(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?st:``)},[f]);let p=yt(e);return(0,U.jsxs)(`div`,{className:`grid gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-once-date`,children:`Date`}),(0,U.jsx)(V,{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,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,U.jsx)(ti,{label:`Hour`,value:o,max:23,onCommit:e=>c(a,e,s)}),(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,U.jsx)(ti,{label:`Minute`,value:s,max:59,onCommit:e=>c(a,o,e)})]})]}),f?(0,U.jsx)(`p`,{id:u,className:`text-xs text-destructive`,children:st}):null,(0,U.jsx)(li,{value:e.timeZone??``,onCommit:e=>r({timeZone:e})}),(0,U.jsx)(ui,{value:e.latestStartMinutes,onChange:t=>n(ci(e,t))}),p?(0,U.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,H.useState)(e),i=(0,H.useRef)(null),a=(0,H.useId)(),o=(0,H.useId)(),[s]=(0,H.useState)(oi),c=n!==e||!ot(n),l=dt(n);return(0,H.useEffect)(()=>{i.current?.setCustomValidity(c?l:``)},[c,l]),(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-once-zone`,children:`Time zone`}),(0,U.jsx)(V,{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),ot(e.target.value)&&t(e.target.value)}}),(0,U.jsx)(`datalist`,{id:a,children:s.map(e=>(0,U.jsx)(`option`,{value:e},e))}),c?(0,U.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,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-once-latest`,children:`Latest start`}),(0,U.jsxs)(nr,{value:e===void 0?ri:String(e),onValueChange:e=>t(e===ri?void 0:Number(e)),children:[(0,U.jsx)(ir,{id:`automation-once-latest`,className:`w-full sm:w-48`,"aria-label":`Latest start`,children:(0,U.jsx)(rr,{})}),(0,U.jsx)(ar,{children:n.map(e=>(0,U.jsx)(or,{value:e.minutes===void 0?ri:String(e.minutes),children:e.label},e.label))})]}),(0,U.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,U.jsxs)(`div`,{className:`grid gap-4`,children:[(0,U.jsx)(`div`,{role:`group`,"aria-label":`Repeat`,className:`flex flex-wrap gap-2`,children:di.map(t=>(0,U.jsx)(Gr,{pressed:e.type===t.type,onClick:()=>a(t.type),children:t.label},t.type))}),e.type===`once`?(0,U.jsx)(si,{value:e,stored:t,onChange:n}):null,e.type===`weekly`?(0,U.jsx)(`div`,{role:`group`,"aria-label":`Day of the week`,className:`flex flex-wrap gap-2`,children:bt.map((t,n)=>(0,U.jsx)(Gr,{pressed:e.day===n+1,onClick:()=>i({day:n+1}),children:t},t))}):null,e.type===`once`?null:e.type===`hours`?(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-every`,children:`Run every`}),(0,U.jsxs)(nr,{value:String(e.every),onValueChange:e=>i({every:Number(e)}),children:[(0,U.jsx)(ir,{id:`automation-every`,className:`w-full sm:w-48`,"aria-label":`Run every`,children:(0,U.jsx)(rr,{})}),(0,U.jsx)(ar,{children:_t.map(e=>(0,U.jsx)(or,{value:String(e),children:e===1?`hour`:`${e} hours`},e))})]}),(0,U.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,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,U.jsx)(ti,{label:`Hour`,value:e.hour,max:23,onCommit:e=>i({hour:e})}),(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,U.jsx)(ti,{label:`Minute`,value:e.minute,max:59,onCommit:e=>i({minute:e})}),(0,U.jsx)(`span`,{className:`text-sm break-all text-muted-foreground`,children:r})]}),e.type===`once`?null:(0,U.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Cron: `,(0,U.jsx)(`code`,{className:`font-mono text-foreground`,children:mt(e)})]})]})}var pi=40*864e5,mi=5;function hi({schedule:e,timeZone:t,now:n=Date.now()}){if(e.type===`once`)return(0,U.jsx)(gi,{schedule:e,now:n});let r=lt(e,n+1,n+pi,t,mi);return(0,U.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,className:`rounded-xl border bg-card p-4`,children:[(0,U.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-[15px] font-medium`,children:`Next 5 runs`}),r.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No runs in the next 40 days.`}):(0,U.jsx)(`ol`,{"aria-label":`Next 5 runs`,className:`grid gap-1.5 text-sm`,children:r.map(e=>(0,U.jsxs)(`li`,{className:`flex items-baseline justify-between gap-3`,children:[(0,U.jsx)(`span`,{className:`font-medium tabular-nums`,children:xt(new Date(e).toISOString(),t)}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:pt(n,e)})]},e))}),(0,U.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=ut(e),r=yt(e);return(0,U.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,className:`rounded-xl border bg-card p-4`,children:[(0,U.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-[15px] font-medium`,children:`Runs once`}),n===null||!r?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pick a date, a time and a time zone.`}):(0,U.jsxs)(`p`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 text-sm`,children:[(0,U.jsx)(`span`,{className:`font-medium tabular-nums`,children:`${r.date} ${r.time}`}),n>t?(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:pt(t,n)}):null]}),r?.note?(0,U.jsx)(`p`,{className:`mt-2 text-sm break-words`,children:r.note}):null,n!==null&&n<=t?(0,U.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:`The due time has passed.`}):null,(0,U.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,U.jsxs)(`fieldset`,{className:`grid min-w-0 gap-4 rounded-xl border p-5 max-md:p-4!`,children:[(0,U.jsx)(`legend`,{className:`px-0`,children:e}),r,t?.section===n&&!t.conflict?(0,U.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,U.jsx)(U.Fragment,{children:r?(0,U.jsxs)(`p`,{className:`text-sm`,children:[(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`Trigger · `}),_i[e.kind]]}):(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,U.jsx)(it,{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,U.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,U.jsx)(fi,{value:e.schedule,stored:i?.schedule,onChange:e=>t({schedule:e}),timeZone:r}):(0,U.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,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,U.jsx)(wt,{id:`automation-prompt`,value:e.prompt,onChange:e=>t({prompt:e.target.value}),rows:4,required:!0}),(0,U.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:e.kind===`schedule`?(0,U.jsxs)(U.Fragment,{children:[`Available: `,`{{date}}`,` `,`{{time}}`,` `,`{{project}}`,` `,`{{automation}}`,`. A run-context block is appended automatically.`]}):(0,U.jsxs)(U.Fragment,{children:[`Available: `,`{{github.number}}`,` `,`{{github.title}}`,` `,`{{github.url}}`,` `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})})]}),(0,U.jsx)(Ti,{draft:e,patch:t}),(0,U.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,U.jsx)(Le,{"aria-label":`Autonomous`,checked:e.autonomous,onCheckedChange:e=>t({autonomous:e})}),(0,U.jsxs)(`span`,{children:[`Autonomous `,(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`· runs without waiting for answers`})]})]}),(0,U.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,U.jsx)(tt,{archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,onChange:t,disabled:n}),(0,U.jsx)(Ze,{allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging,onChange:t,disabled:n}),r?(0,U.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,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,U.jsx)(Le,{"aria-label":n?`Enabled`:`Enable after saving`,checked:e.enabled,onCheckedChange:e=>t({enabled:e})}),(0,U.jsx)(`span`,{children:n?`Enabled`:`Enable after saving`})]}),(0,U.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,H.useState)(()=>Ar(e)),[c,l]=(0,H.useState)(e?.revision),[u,d]=(0,H.useState)(),[f,p]=(0,H.useState)(!1),[m,g]=(0,H.useState)(!1),[v,y]=(0,H.useState)(!1),[b,x]=(0,H.useState)(``),S=e=>s(t=>({...t,...e})),C=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)}},w=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)}}},T=e?`Save changes`:a.enabled?`Save and enable`:`Save paused`,E=a.kind===`schedule`;return(0,U.jsx)(X,{title:e?`Edit automation`:`New automation`,subtitle:`Define when it runs and the ordinary task it launches.`,children:(0,U.jsxs)(`form`,{className:`automation-editor grid min-w-0 gap-5 md:grid-cols-[minmax(0,1fr)_320px] md:items-start`,onSubmit:C,children:[(0,U.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[(0,U.jsx)(yi,{title:`Name`,section:`name`,failure:u,children:(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-name`,children:`Name`}),(0,U.jsx)(V,{id:`automation-name`,value:a.name,onChange:e=>S({name:e.target.value}),required:!0})]})}),(0,U.jsxs)(yi,{title:`When`,section:`when`,failure:u,children:[(0,U.jsx)(bi,{draft:a,patch:S,forge:t,automation:e}),(0,U.jsx)(xi,{draft:a,patch:S,forge:t,timeZone:n,automation:e})]}),(0,U.jsx)(yi,{title:`What to run`,section:`run`,failure:u,children:(0,U.jsx)(Si,{draft:a,patch:S,saving:f,automation:e})}),(0,U.jsx)(yi,{title:`Enable`,section:`enable`,failure:u,children:(0,U.jsx)(Ci,{draft:a,patch:S,automation:e})}),u?.section===`form`?(0,U.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 text-sm text-destructive`,children:[(0,U.jsx)(`span`,{className:`break-words`,children:u.message}),u.conflict&&i?(0,U.jsx)(F,{type:`button`,variant:`outline`,onClick:i,children:`Reload`}):null]}):null,(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{type:`submit`,disabled:f,children:f?`Saving…`:T}),(0,U.jsx)(F,{type:`button`,variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{to:`/automations`,children:`Cancel`})})]}),e?(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-2 border-t pt-4`,children:[m?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? It will stop running and cannot be restored.`}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{type:`button`,variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:v,onClick:()=>void w(),children:`Delete automation`}),(0,U.jsx)(F,{type:`button`,variant:`outline`,disabled:v,onClick:()=>{g(!1),x(``)},children:`Keep`})]})]}):(0,U.jsx)(F,{type:`button`,variant:`outline`,"data-action":`automation-delete`,onClick:()=>g(!0),children:`Delete`}),b?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:b}):null]}):null]}),(0,U.jsxs)(`aside`,{className:`min-w-0 md:sticky md:top-4`,children:[E?(0,U.jsx)(hi,{schedule:a.schedule,timeZone:n}):(0,U.jsxs)(`section`,{className:`rounded-xl border bg-card p-4`,children:[(0,U.jsx)(`h2`,{className:`mb-2 text-[15px] font-medium`,children:`How it polls`}),(0,U.jsx)(`p`,{className:`text-sm break-words text-muted-foreground`,children:Qr(a)})]}),(0,U.jsx)(Wr,{draft:a})]})]})})}function Ti({draft:e,patch:t}){let n=ne(),r=at(),{runners:i,signedOut:a}=r.runnersOn(e=>r.repoAccount?.[e]),o=re(),s=se(),c=e.runner??o.data?.defaultRunner??`claude`,l=N(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=Xe(c,s.data,l.data,[e.model]),p=f.find(t=>t.id===(e.model??``))?.label??e.model??`auto`,m=e=>(0,U.jsx)(e,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`});return(0,U.jsx)(Je,{children:(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)($e,{slot:`automation-workflow-pill`,icon:m(he),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,U.jsx)($e,{slot:`automation-runner-pill`,icon:m(fe),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:oe(s.data,e)}))],footer:(0,U.jsx)(nt,{uninstalled:r.uninstalled,signedOut:a.filter(t=>t!==e.runner)}),onPick:e=>{t({runner:e||void 0,model:void 0})}}),(0,U.jsx)($e,{slot:`automation-model-pill`,icon:m(ge),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,H.useState)({}),[c,l]=(0,H.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,U.jsx)(X,{title:`Automations`,subtitle:`Schedules and GitHub checks run while Squawk is open.`,action:(0,U.jsx)(F,{asChild:!0,children:(0,U.jsx)(B,{to:`/automations/new`,children:`New automation`})}),children:t&&!e?(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,U.jsx)(Z,{text:t}),(0,U.jsx)(F,{variant:`outline`,onClick:()=>void n(),children:`Retry`})]}):e?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Di,{data:e}),i?(0,U.jsx)(`div`,{className:`mb-4 flex flex-wrap gap-2`,children:(0,U.jsx)(Gr,{pressed:r,onClick:()=>i(!r),children:`Archived`})}):null,r&&e.automations.length===0?(0,U.jsx)(Z,{text:`No archived one-time schedules.`}):e.automations.length===0?(0,U.jsx)(Ge,{icon:(0,U.jsx)(me,{}),tone:`neutral`,title:`No automations yet`,subtitle:`Create one paused, preview it, then enable it.`,heading:`h2`,actions:(0,U.jsx)(F,{asChild:!0,children:(0,U.jsx)(B,{to:`/automations/new`,children:`New automation`})})}):(0,U.jsx)(`ul`,{className:`grid gap-3`,"aria-label":`Automations`,children:e.automations.map(t=>(0,U.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,U.jsx)(Z,{text:`Loading automations…`})})}function Di({data:e}){return(0,U.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?ft(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,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`h2`,{className:`flex items-center gap-2 font-semibold break-words`,children:[(0,U.jsx)(e.kind===`schedule`?le:ce,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),e.name]}),(0,U.jsx)(`p`,{className:`mt-1.5 text-[13px] break-words text-muted-foreground`,children:Oi(e)})]}),t?(0,U.jsx)(rt,{dot:t.dot,children:t.label}):(0,U.jsx)(rt,{dot:e.enabled?`success`:`neutral`,children:e.enabled?`Enabled`:`Paused`})]})}function Mi({automation:e,archive:t}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`mt-3 text-sm break-words`,children:[t.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`,t.runId?(0,U.jsxs)(U.Fragment,{children:[` · `,(0,U.jsx)(B,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${t.runId}`,children:`Open task`})]}):null]}),(0,U.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:(0,U.jsx)(F,{variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{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,U.jsx)(`p`,{className:`mt-3 text-sm`,children:!n&&e.enabled?(0,U.jsx)(`span`,{children:`continuous`}):r?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{children:`Next run: ${xt(r,t)}`}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:` · ${pt(Date.now(),Date.parse(r))}`})]}):(0,U.jsx)(`span`,{children:`Next run: —`})})}function Pi({automation:e,timeZone:t}){let n=e.enabled?Zn(e.state):void 0;return n?(0,U.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,U.jsx)(`span`,{className:`text-muted-foreground`,children:` · Next try ${xt(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,U.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{to:`/automations/${e.id}`,children:`Edit`})}),(0,U.jsx)(F,{variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{to:`/automations/${e.id}/log`,children:`Execution log`})}),(0,U.jsx)(F,{variant:`outline`,"data-action":`automation-toggle`,disabled:t,onClick:i,children:e.enabled?`Pause`:`Enable`}),c?(0,U.jsx)(F,{variant:`outline`,"data-action":`automation-run`,disabled:t,onClick:a,children:`Run now`}):(0,U.jsx)(F,{variant:`outline`,"data-action":`automation-preview`,disabled:t,onClick:o,children:`Test filter`}),l&&!n?(0,U.jsx)(F,{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,U.jsxs)(`div`,{className:`mt-3 grid justify-items-start gap-2`,children:[(0,U.jsx)(`p`,{className:`text-sm break-words`,children:`Cancel “${e.name}”? It will never run, and it moves to Archived.`}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{variant:`danger-ghost`,"data-action":`automation-cancel-confirm`,disabled:t,onClick:r,children:`Cancel schedule`}),(0,U.jsx)(F,{ref:n,variant:`outline`,disabled:t,onClick:i,children:`Keep`})]})]})}function Li({note:e}){return(0,U.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,U.jsxs)(U.Fragment,{children:[` · `,(0,U.jsx)(B,{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,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,U.jsxs)(`li`,{"data-slot":`automation-card`,"data-kind":e.kind,className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,U.jsx)(ji,{automation:e,badge:Ai(e)}),h?(0,U.jsx)(Mi,{automation:e,archive:h}):null,h?null:(0,U.jsx)(Ni,{automation:e,timeZone:t}),h?null:(0,U.jsx)(Pi,{automation:e,timeZone:t}),h?null:(0,U.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,U.jsx)(Ii,{automation:e,busy:r,keepRef:d,onConfirm:()=>{l(!1),s()},onKeep:m}):null,n?(0,U.jsx)(Li,{note:n}):null,(0,U.jsx)(_r,{automationId:e.id,automationName:e.name,timeZone:t})]})}function zi(e){let t=We(),n=qe(),[r,i]=(0,H.useState)(),[a,o]=(0,H.useState)(``),s=(0,H.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,H.useEffect)(()=>{n&&s()},[n,s]),(0,H.useEffect)(()=>c(async e=>{n&&await s(e)}),[n,s]),(0,H.useEffect)(()=>ae((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}=ie(),n=Ue(),[r,i]=(0,H.useState)(!1),{data:a,error:o,refresh:s}=zi(e===`list`?r?`only`:void 0:`include`),[c,l]=(0,H.useState)(0),u=Qe();if(u===`unknown`)return(0,U.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,U.jsx)(Z,{text:`Loading automations…`})});if(u===`unavailable`)return(0,U.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,U.jsx)(Ge,{icon:(0,U.jsx)(me,{}),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,U.jsx)(Ei,{data:a,error:o,refresh:s,archived:r,onArchivedChange:i});if(!a)return o?(0,U.jsx)(X,{title:`Automations`,subtitle:`Could not load automations.`,children:(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,U.jsx)(Z,{text:o}),(0,U.jsx)(F,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]})}):(0,U.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,U.jsx)(Z,{text:`Loading automations…`})});let p={available:a.available,...a.reason?{reason:a.reason}:{}};return e===`new`?(0,U.jsx)(wi,{forge:p,timeZone:a.timeZone,onSaved:d}):e===`edit`?f?f.archived?(0,U.jsx)(vr,{automation:f,timeZone:a.timeZone,onDeleted:d}):(0,U.jsx)(wi,{automation:f,forge:p,timeZone:a.timeZone,onSaved:d,onReload:()=>void s().then(()=>l(e=>e+1))},`${f.id}:${c}`):(0,U.jsx)(X,{title:`Automation not found`,subtitle:`This automation may have been removed.`,children:(0,U.jsx)(F,{asChild:!0,variant:`outline`,children:(0,U.jsx)(B,{to:`/automations`,children:`Back to automations`})})}):t?(0,U.jsx)(gr,{automationId:t,automationName:f?.name,timeZone:a.timeZone,readOnly:!!f?.archived}):(0,U.jsx)(Z,{text:`Automation not found.`})}export{Bi 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{i as r}from"./project-scope-context-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{i as r}from"./project-scope-context-D1bpJixc.js";import{j as i,ot as a,r as o}from"./design-icons-CzEoMH9c.js";import{n as s}from"./diff-controls-BSWICnsb.js";import{u as c}from"./reference-chip-BWViAFIN.js";import{t as l}from"./button-BQ2y4XRB.js";import{t as u}from"./project-router-CIKODSHW.js";import{t as d}from"./centered-state-V15AR_qo.js";import{$t as f,hn as p}from"./index-CmadQXcg.js";import{t as m}from"./diff-BB8SoL-s.js";var h=e(t(),1),g=n();function _({commit:e,sha:t,backTo:n,backLabel:_,slot:v,className:y,diffClassName:b}){let x=f(),[S,C]=(0,h.useState)(`unified`),[w,T]=(0,h.useState)(!1),E=e.isError&&e.error instanceof r&&e.error.status===409,D=x?S:`unified`,O=!x||w;return(0,g.jsxs)(`section`,{"data-slot":v,"data-sha":t,className:y,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,g.jsx)(l,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,g.jsxs)(u,{to:n,children:[(0,g.jsx)(o,{size:16,"aria-hidden":`true`}),_]})}),e.data?(0,g.jsx)(p,{stat:e.data.stat}):null,(0,g.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,g.jsx)(s,{mode:S,wrap:w,onModeChange:C,onWrapChange:T})})]}),e.isPending?(0,g.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):e.isError?(0,g.jsx)(d,{icon:E?(0,g.jsx)(c,{}):(0,g.jsx)(a,{size:16}),tone:E?`neutral`:`danger`,heading:`h2`,title:E?`Commit not found`:`Could not load the commit`,subtitle:e.error.message}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,g.jsx)(`h2`,{className:`text-sm font-semibold`,children:e.data.subject}),(0,g.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[e.data.author,` · `,e.data.when,` ·`,` `,(0,g.jsx)(`span`,{className:`font-mono select-all`,children:e.data.sha})]})]}),e.data.files.length===0?(0,g.jsx)(d,{icon:(0,g.jsx)(i,{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,g.jsx)(`div`,{className:b,children:(0,g.jsx)(m,{files:e.data.files,mode:D,wrap:O,className:`min-w-0`})})]})]})}export{_ 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"./utils-DSMR_WLb.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{hn as a}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-O8lx1ztb.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/utils-DSMR_WLb.js","assets/bundle-mjs-rHxsej31.js","assets/chevron-right-BENZ-1ZN.js","assets/createLucideIcon-BHp8sXmF.js","assets/eye-B8okNWXU.js","assets/index-CmadQXcg.js","assets/live-refetch-CZb2VOyu.js","assets/project-scope-context-D1bpJixc.js","assets/live-protocol-D9ji1YCl.js","assets/useInfiniteQuery-qJeCNhM7.js","assets/queries-dHXhD3Hc.js","assets/useQuery-C3CQhXsT.js","assets/ws-BisMp6U5.js","assets/toaster-Bo5vCbz-.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-Cg8l-LDN.js","assets/label-CZp8t0zE.js","assets/cez-idle-BY3rjM_y.js","assets/dist-C5mlVBmd.js","assets/dist-BW234Kg5.js","assets/tasks-table-DHTEGteC.js","assets/task-groups-DF0XoB6U.js","assets/attention-lvUYNNvV.js","assets/runners-CGQjSsir.js","assets/design-icons-CzEoMH9c.js","assets/open-in-menu-DdKs6X5r.js","assets/bot-TkDIw4y-.js","assets/external-link-BE6y205O.js","assets/folder-o-AvL3y3.js","assets/smartphone-Lr8Ug2z_.js","assets/square-terminal-B6RYYieR.js","assets/button-BQ2y4XRB.js","assets/dropdown-menu-4e2iKSMT.js","assets/es2015-CQth82uv.js","assets/dist-BAoXdNsT.js","assets/dist-DXO3xwbC.js","assets/own-lookup-DS54wXvD.js","assets/dist-C28wFbz0.js","assets/chevron-down-CHGyCDBH.js","assets/nav-row-styles-DqKjMToI.js","assets/folder-browser-Dsqz0Z1z.js","assets/format-BNCkW110.js","assets/play-CmVAj_fu.js","assets/reference-chip-BWViAFIN.js","assets/popover-BPgUYFyu.js","assets/dist-Da4ckcJG.js","assets/switch-Bv2Zf1uU.js","assets/badge-D9JrXe0o.js","assets/dialog-BVF6dIeS.js","assets/project-router-CIKODSHW.js","assets/status-dot-DtAOFiIi.js","assets/command-CDt1BsZy.js","assets/project-order-AcHI4Dcl.js","assets/skills-pM_PouEs.js","assets/agents-settings-path-7X6_cvUg.js","assets/centered-state-V15AR_qo.js","assets/index-F-X4qZSv.css","assets/highlighter-DvLzHjjY.js","assets/image-preview-CNBuRrK5.js","assets/zoomable-image-CIQl1Wpe.js","assets/markdown-BBDDg-4t.js","assets/markdown-KHcncamw.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"./utils-DSMR_WLb.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{hn as a}from"./index-CmadQXcg.js";import{n as o,t as s}from"./image-preview-CNBuRrK5.js";var c=e(t(),1),l=n();function u(e){let[t,n]=(0,c.useState)(null);return(0,c.useEffect)(()=>{let e=!1;return i(()=>import(`./diff-view-O8lx1ztb.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])),()=>{e=!0}},[]),e.files.length===0?(0,l.jsx)(`p`,{"data-slot":`diff-empty`,className:r(`px-1 text-xs text-soft-foreground`,e.className),children:`No changes.`}):t===`failed`?(0,l.jsx)(d,{...e}):t===null?(0,l.jsx)(`p`,{"data-slot":`diff-loading`,className:r(`px-1 text-xs text-soft-foreground`,e.className),children:`Loading diff…`}):(0,l.jsx)(t.View,{...e})}function d({files:e,wrap:t=!1,imageSrc:n,onOpenInApp:i,viewRef:o,className:s}){let u={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},d=(0,c.useRef)(null);return(0,c.useImperativeHandle)(o,()=>({scrollToPath:e=>{for(let t of d.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,l.jsxs)(`div`,{ref:d,"data-slot":`diff`,"data-fallback":`true`,className:r(`flex min-w-0 flex-col gap-3`,s),children:[(0,l.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,l.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,l.jsx)(a,{stat:u})]}),e.map(e=>(0,l.jsx)(f,{file:e,wrap:t,imageSrc:n,onOpenInApp:i},`${e.oldPath??``}→${e.path}`))]})}function f({file:e,wrap:t,imageSrc:n,onOpenInApp:i}){return(0,l.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,l.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,l.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?`${e.oldPath} → ${e.path}`:e.path}),(0,l.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,l.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]}),o(e)?(0,l.jsx)(s,{file:e,imageSrc:n,onOpenInApp:i}):e.binary?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,l.jsx)(`pre`,{className:r(`py-2 font-mono text-xs leading-[1.7]`,t?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
|
|
3
3
|
`).map((e,t)=>(0,l.jsxs)(`span`,{className:r(`block px-4`,e.startsWith(`+`)&&!e.startsWith(`+++`)&&`bg-diff-add`,e.startsWith(`-`)&&!e.startsWith(`---`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[e,e===``?` `:``]},t))})]})}export{u as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{t as i}from"./chevron-right-BENZ-1ZN.js";import{t as a}from"./eye-B8okNWXU.js";import{hn as o,s}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{t as r}from"./utils-DSMR_WLb.js";import{t as i}from"./chevron-right-BENZ-1ZN.js";import{t as a}from"./eye-B8okNWXU.js";import{hn as o,s}from"./index-CmadQXcg.js";import{a as c,i as l,r as u}from"./highlighter-DvLzHjjY.js";import{n as d,t as f}from"./image-preview-CNBuRrK5.js";import{n as p,t as m}from"./markdown-BBDDg-4t.js";import{t as h}from"./markdown-KHcncamw.js";var g=e(t(),1),_=44;function v(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 y(e){return v(e)*20+_}function b(e){return e.reduce((e,t)=>e+v(t),0)}function x(e,t){let n=new URLSearchParams(e).get(`diff`);return n===`flat`||n===`virtual`?n:t>1500?`virtual`:`flat`}function S(e){return`${e.oldPath??``}→${e.path}`}function C(e){let t=0;for(let n of e.split(`
|
|
3
3
|
`))n.length>t&&(t=n.length);return t}var w=/[A-Za-z0-9_]+|\s+|[^\sA-Za-z0-9_]+/g,T=300,E=.3;function D(e,t){if(e===t)return null;let n=e.match(w)??[],r=t.match(w)??[];if(n.length===0||r.length===0||n.length>T||r.length>T)return null;let i=O(n,r),a=r.length+1;return(i[n.length*a+r.length]??0)/Math.max(n.length,r.length)<E?null:k(n,r,i)}function O(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 k(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:A(e,i),add:A(t,a)}}function A(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 j(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 M=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,N=`… (patch truncated)`;function P(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=M.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(N)){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 F(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 I(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 L(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=D(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 R(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(L(t,i))}else t(i),r++}}function z(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}),R(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 B(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`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}),R(e,e=>i.push({type:`pair`,left:{line:e},right:{line:e}}),e=>{let t=Math.max(e.dels.length,e.adds.length);for(let n=0;n<t;n++){let t=e.dels[n],r=e.adds[n];i.push({type:`pair`,...t?{left:{line:t,spans:e.delSpans[n]}}:{},...r?{right:{line:r,spans:e.addSpans[n]}}:{}})}})}),a(e.length),i}var V=n();function H({file:e,loadFileText:t,imageSrc:n}){let r=(0,g.useMemo)(()=>U(e),[e]),i=(0,g.useRef)(t);i.current=t;let a=(0,g.useRef)(n);a.current=n;let o=t!==void 0,[s,c]=(0,g.useState)(null);(0,g.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,g.useCallback)(t=>{let n=a.current,r=n?p(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,V.jsx)(`p`,{role:`status`,className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Loading preview…`});let d=u?.text??null;if(d===null&&r.text===``)return(0,V.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-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,V.jsx)(`div`,{"data-slot":`diff-markdown-preview`,className:`px-4 py-5 md:px-6`,children:(0,V.jsxs)(`div`,{className:`mx-auto max-w-[72ch]`,children:[f?(0,V.jsx)(`p`,{className:`mb-4 text-xs text-soft-foreground`,children:f}):null,(0,V.jsx)(h,{document:!0,imageSrc:l,children:d??r.text})]})})}function U(e){let t=P(e.patch);return{text:t.hunks.map(e=>e.lines.filter(e=>e.kind!==`del`).map(e=>e.text).join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{i,on as a}from"./project-scope-context-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{i,on as a}from"./project-scope-context-D1bpJixc.js";import{ht as o}from"./queries-dHXhD3Hc.js";import{f as s,p as c}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{ot as l,w as u}from"./design-icons-CzEoMH9c.js";import{t as d}from"./createLucideIcon-BHp8sXmF.js";import{t as f}from"./centered-state-V15AR_qo.js";import{a as p,i as m,r as h}from"./highlighter-DvLzHjjY.js";import{a as g,c as _,d as v,l as y,n as b,o as x,s as S,t as C,u as w}from"./markdown-KHcncamw.js";var T=d(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),E=d(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),D=d(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),O=e(t(),1),k=n(),A=[[`scripts`,`remote script`,`remote scripts`],[`remote`,`remote resource`,`remote resources`],[`relative`,`linked file next to the report`,`linked files next to the report`],[`forms`,`form`,`forms`],[`embeds`,`embedded frame or object`,`embedded frames or objects`]];function j(e){let t=A.filter(([t])=>e[t]>0).map(([t,n,r])=>`${e[t]} ${e[t]===1?n:r}`);return t.length?t.join(`, `):null}var M={};function N(e){let t=(0,O.useMemo)(()=>w(e),[e]).join(` `),[n,r]=(0,O.useState)(null);return(0,O.useEffect)(()=>{if(!t)return;let e=!0;return v(t.split(` `)).then(n=>{e&&r({key:t,libraries:n})}),()=>{e=!1}},[t]),t?n?.key===t?n.libraries:null:M}function P({html:e,title:t,fragment:n,className:i}){let a=N(e);return a?(0,k.jsx)(F,{html:e,title:t,fragment:n,className:i,libraries:a}):(0,k.jsx)(`div`,{"data-slot":`html-report`,"aria-busy":`true`,className:r(`flex min-h-0 flex-col`,i)})}function F({html:e,title:t,fragment:n,className:i,libraries:a}){let{srcdoc:o,blocked:s}=(0,O.useMemo)(()=>{let n=_(e,a);return{srcdoc:y(n.srcdoc,t),blocked:n.blocked}},[e,a,t]),c=e=>{n&&/^#\S+$/.test(n)&&e.currentTarget.contentWindow?.frames[0]?.location.replace(`about:srcdoc${n}`)},l=j(s);return(0,k.jsxs)(`div`,{"data-slot":`html-report`,className:r(`flex min-h-0 flex-col`,i),children:[l?(0,k.jsxs)(`p`,{"data-slot":`html-report-blocked`,role:`note`,className:`border-b border-border bg-muted/40 px-4 py-2 text-xs text-foreground`,children:[`Blocked for your safety: `,l,`. Reports show only what they carry inside the file.`]}):null,(0,k.jsx)(`iframe`,{"data-slot":`html-report-frame`,title:t,sandbox:x,allow:g,srcDoc:o,referrerPolicy:`no-referrer`,onLoad:c,className:`block min-h-0 w-full flex-1 border-0 bg-report-canvas`})]})}var I=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`ico`,`avif`]);function L(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:I.has(t.slice(n+1).toLowerCase())}function R(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return L(e)||n>0&&t.slice(n+1).toLowerCase()===`svg`}function z(e){return e.tooLarge?`too-large`:R(e.path)?`image`:e.binary?`binary`:`text`}function B(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}function V({runId:e,path:t,className:n}){let r=o(e,t??void 0);if(t===null)return(0,k.jsx)(K,{className:n,children:(0,k.jsx)(f,{icon:(0,k.jsx)(u,{size:16}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from this task’s worktree to inspect its contents.`,className:`[&_[data-slot=centered-state-tile]]:size-10 [&_[data-slot=centered-state-tile]]:border-0 [&_[data-slot=centered-state-tile]]:bg-transparent [&_[data-slot=centered-state-tile]]:text-accent-text [&_[data-slot=centered-state-tile]]:shadow-none [&_h2]:text-xl`})});if(r.isPending)return(0,k.jsx)(K,{className:n,children:(0,k.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(r.isError){let e=r.error instanceof i&&r.error.status===409;return(0,k.jsx)(K,{className:n,children:(0,k.jsx)(f,{icon:e?(0,k.jsx)(D,{}):(0,k.jsx)(l,{size:16}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:r.error.message})})}return r.data.type===`file`?(0,k.jsx)(H,{runId:e,entry:r.data,className:n}):(0,k.jsx)(K,{className:n,children:(0,k.jsx)(f,{icon:(0,k.jsx)(E,{}),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 H({runId:e,entry:t,className:n,imageUrl:r,downloadUrl:i,snapshot:a,readerHref:o,documentPreview:s=!1}){let[c,l]=(0,O.useState)(!1),u=s&&/\.(?:md|markdown)$/i.test(t.path),d=s&&S(t.path),f=/\.(?:png|jpe?g|gif|webp|bmp|ico|avif)$/i.test(t.path),p=s&&f&&t.size<=10*1024*1024?`image`:z(t),m=(u||d)&&p===`text`;return(0,k.jsxs)(K,{className:n,children:[(0,k.jsxs)(`header`,{"data-slot":`file-preview-head`,className:`flex items-center gap-2 border-b border-border bg-muted/40 px-4 py-2 text-xs`,children:[(0,k.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:t.path}),(0,k.jsx)(`span`,{className:`ml-auto shrink-0 tabular-nums text-soft-foreground`,children:B(t.size)})]}),a||i||m?(0,k.jsx)(W,{snapshot:a,downloadUrl:i,source:m?c:null,onSource:()=>l(e=>!e),readerHref:d&&p===`text`?o:void 0}):null,(0,k.jsx)(U,{runId:e,entry:t,kind:p,showImage:p===`image`&&(!s||f),rendered:c?null:u?`markdown`:d?`html`:null,imageUrl:r})]})}function U({runId:e,entry:t,kind:n,showImage:r,rendered:i,imageUrl:o}){return r?(0,k.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,k.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,k.jsx)(f,{icon:(0,k.jsx)(T,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${B(t.size)} — past the preview cap. Open it in your editor instead.`}):n===`binary`?(0,k.jsx)(f,{icon:(0,k.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${B(t.size)} of binary data — no text preview.`}):i===`markdown`?(0,k.jsx)(`div`,{className:`p-4`,children:(0,k.jsx)(C,{document:!0,children:t.content??``})}):i===`html`?(0,k.jsx)(P,{html:t.content??``,title:`Report: ${t.path}`,className:`h-[70vh]`}):(0,k.jsx)(Y,{path:t.path,text:t.content??``})}function W({snapshot:e,downloadUrl:t,source:n,onSource:r,readerHref:i}){return(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-b border-border px-4 py-2 text-xs`,children:[e?(0,k.jsxs)(`span`,{children:[`Published snapshot · `,e]}):null,t?(0,k.jsx)(`a`,{className:`inline-flex min-h-11 items-center text-accent-text underline`,href:t,children:`Download`}):null,n===null?null:(0,k.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,k.jsx)(G,{href:i}):null]})}function G({href:e}){let t=c(),n=s();return(0,k.jsx)(`a`,{className:`inline-flex min-h-11 items-center px-2 text-accent-text underline focus-visible:ring-2`,href:e,onClick:r=>b(r,t,e,n),children:`Open reader`})}function K({className:e,children:t}){return(0,k.jsx)(`section`,{"data-slot":`file-preview`,className:r(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var q=1500;function J(e,t){let n=(0,O.useMemo)(()=>t.split(`
|
|
2
2
|
`).map(e=>[{content:e}]),[t]),r=(0,O.useMemo)(()=>p(e),[e]),i=n.length>q,[a,o]=(0,O.useState)(null);return(0,O.useEffect)(()=>{if(r===null||i)return;let n=!1;return h(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:m(t,r)?.tokens??n}function Y({path:e,text:t}){let n=J(e,t);return(0,k.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":p(e)??`plaintext`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7]`,children:n.map((e,t)=>(0,k.jsxs)(`div`,{className:`flex px-4`,children:[(0,k.jsx)(`span`,{className:`w-10 shrink-0 select-none pr-3 text-right tabular-nums text-soft-foreground`,children:t+1}),(0,k.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre pr-4`,children:e.map((e,t)=>(0,k.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})}export{R as a,E as c,B as i,T as l,H as n,P as o,V as r,D as s,Y as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-DSMR_WLb.js";import{i as n}from"./project-scope-context-
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-DSMR_WLb.js";import{i as n}from"./project-scope-context-D1bpJixc.js";import{S as r}from"./queries-dHXhD3Hc.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=r(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-[11px] 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:t(`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-[11px] 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,t,n=!1){let i=r(e,n);return t?.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{n as r,t as i}from"./utils-DSMR_WLb.js";import{F as a,T as o,j as s,st as c,u as l}from"./design-icons-CzEoMH9c.js";import{t as u}from"./createLucideIcon-BHp8sXmF.js";import{n as d,r as f,t as p}from"./diff-controls-BSWICnsb.js";import{t as m}from"./external-link-BE6y205O.js";import{t as h}from"./square-terminal-B6RYYieR.js";import{t as g}from"./button-BQ2y4XRB.js";import{i as _,p as v,r as y,t as b}from"./dropdown-menu-4e2iKSMT.js";import{hn as x}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{n as r,t as i}from"./utils-DSMR_WLb.js";import{F as a,T as o,j as s,st as c,u as l}from"./design-icons-CzEoMH9c.js";import{t as u}from"./createLucideIcon-BHp8sXmF.js";import{n as d,r as f,t as p}from"./diff-controls-BSWICnsb.js";import{t as m}from"./external-link-BE6y205O.js";import{t as h}from"./square-terminal-B6RYYieR.js";import{t as g}from"./button-BQ2y4XRB.js";import{i as _,p as v,r as y,t as b}from"./dropdown-menu-4e2iKSMT.js";import{hn as x}from"./index-CmadQXcg.js";var S=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`}]]),C=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`}]]),w=e(t(),1),T=n();function E({root:e,selected:t,onSelect:n}){return(0,T.jsx)(`nav`,{"data-slot":`changes-tree`,"aria-label":`Changed files`,className:`min-w-0 text-[13px]`,children:(0,T.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,T.jsx)(O,{dir:e,depth:0,selected:t,onSelect:n},e.path)),e.files.map(e=>(0,T.jsx)(A,{file:e,depth:0,selected:t,onSelect:n},e.path))]})})}function D({adds:e,dels:t}){return(0,T.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] font-medium tabular-nums`,children:[e>0?(0,T.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}):null,e>0&&t>0?` `:null,t>0?(0,T.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]}):null]})}function O({dir:e,depth:t,selected:n,onSelect:r}){let[a,s]=(0,w.useState)(!0);return(0,T.jsxs)(`li`,{children:[(0,T.jsxs)(`button`,{type:`button`,"data-slot":`tree-dir`,"data-path":e.path,"data-state":a?`open`:`closed`,"aria-expanded":a,onClick:()=>s(e=>!e),className:`flex min-h-11 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,T.jsx)(l,{size:16,"aria-hidden":`true`,className:i(`size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,a&&`rotate-90`)}),(0,T.jsx)(o,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,T.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name}),(0,T.jsx)(D,{adds:e.adds,dels:e.dels})]}),a?(0,T.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,T.jsx)(O,{dir:e,depth:t+1,selected:n,onSelect:r},e.path)),e.files.map(e=>(0,T.jsx)(A,{file:e,depth:t+1,selected:n,onSelect:r},e.path))]}):null]})}var k={added:`text-success`,deleted:`text-danger`};function A({file:e,depth:t,selected:n,onSelect:r}){let a=n===e.path;return(0,T.jsx)(`li`,{children:(0,T.jsxs)(`button`,{type:`button`,"data-slot":`tree-file`,"data-path":e.path,"aria-current":a?`true`:void 0,onClick:()=>r(e.path),className:i(`flex min-h-11 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,T.jsx)(C,{"aria-hidden":`true`,className:i(`size-3.5 shrink-0`,k[e.status])}),(0,T.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,T.jsx)(D,{adds:e.adds,dels:e.dels})]})})}function j(e,t){return{kind:`dir`,name:e,path:t,dirs:[],files:[],adds:0,dels:0,fileCount:0}}function M(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(M)}}var N=(e,t)=>e.name.localeCompare(t.name);function P(e){let t=j(``,``),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=j(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(N),e.files.sort(N)};return i(t),{...t,dirs:t.dirs.map(M)}}function F({bar:e,healthReady:t,branch:n,stat:r,mode:a,wrap:o,preview:s=!1,onModeChange:c,onWrapChange:l,onPreviewChange:u,onAction:m}){return(0,T.jsxs)(`div`,{"data-slot":`git-toolbar`,"data-health-ready":t,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 px-[18px] py-[22px] md:px-9 [&_button]:min-h-11`,children:[n?(0,T.jsx)(p,{branch:n}):null,r?(0,T.jsx)(R,{stat:r}):null,u?(0,T.jsx)(`span`,{className:`ml-auto flex items-center`,children:(0,T.jsx)(f,{preview:s,onPreviewChange:u})}):null,(0,T.jsxs)(`span`,{className:i(`flex items-center gap-1`,u?`max-md:ml-auto`:`ml-auto`),children:[(0,T.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,T.jsx)(d,{mode:a,wrap:o,onModeChange:c,onWrapChange:l})}),e.secondary.map(e=>(0,T.jsx)(L,{action:e,variant:`outline`,onAction:m},e.id)),(0,T.jsx)(L,{action:e.primary,variant:`primary`,onAction:m}),e.menu.length>0?(0,T.jsxs)(b,{children:[(0,T.jsx)(v,{asChild:!0,children:(0,T.jsx)(g,{variant:`ghost`,size:`icon-sm`,"aria-label":`More git actions`,children:(0,T.jsx)(S,{"aria-hidden":`true`})})}),(0,T.jsx)(y,{align:`end`,"data-slot":`git-toolbar-menu`,children:e.menu.map(e=>(0,T.jsxs)(_,{disabled:!e.enabled,title:e.reason,onSelect:()=>m(e.id),children:[I[e.id],e.label]},e.id))})]}):null]})]})}var I={commit:(0,T.jsx)(s,{size:16,"aria-hidden":`true`}),push:(0,T.jsx)(c,{size:16,"aria-hidden":`true`}),"create-pr":(0,T.jsx)(a,{size:16,"aria-hidden":`true`}),"view-pr":(0,T.jsx)(m,{"aria-hidden":`true`}),"open-terminal":(0,T.jsx)(h,{"aria-hidden":`true`})};function L({action:e,variant:t,onAction:n}){return e.id===`view-pr`?r(e.href)?(0,T.jsx)(g,{asChild:!0,variant:t,size:`sm`,"data-action":e.id,children:(0,T.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:[I[e.id],e.label]})}):(0,T.jsxs)(g,{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:[I[e.id],e.label]}):(0,T.jsxs)(g,{variant:t,size:`sm`,"data-action":e.id,disabled:!e.enabled,title:e.enabled?void 0:e.reason,onClick:()=>n(e.id),children:[I[e.id],e.label]})}function R({stat:e}){return(0,T.jsx)(`span`,{"data-slot":`changes-stat`,children:(0,T.jsx)(x,{stat:{adds:z(e.adds),dels:z(e.dels),files:e.files}})})}function z(e){let[t,n]=(0,w.useState)(e),r=(0,w.useRef)(e);return(0,w.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{E as i,F as n,P as r,R as t};
|