@wjarka/cezarion 0.18.0-dev.6468 → 0.18.0-dev.6472
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/activity-motion-CSe8gVgw.js +2 -0
- package/web/dist/assets/{activity-route-su3KawLr.js → activity-route-DURvhLQf.js} +1 -1
- package/web/dist/assets/agent-accounts-BrFoXDpa.js +18 -0
- package/web/dist/assets/attention-BeBfNOUJ.js +1 -0
- package/web/dist/assets/{cez-idle-xv7f96fc.js → cez-idle-TVRD1sce.js} +1 -1
- package/web/dist/assets/{commit-diff-panel-DmhrguZk.js → commit-diff-panel-BbM4GEgm.js} +1 -1
- package/web/dist/assets/{diff-DDwr1gUX.js → diff-DgAd6acp.js} +2 -2
- package/web/dist/assets/{diff-view-BNL7l7Vp.js → diff-view--NwKwseV.js} +3 -3
- package/web/dist/assets/{file-preview-Cm1jWwBy.js → file-preview-B36xoAJ8.js} +1 -1
- package/web/dist/assets/git-toolbar-Db0h7gTI.js +1 -0
- package/web/dist/assets/{github-wWGhoE3O.js → github-CA0qpTLt.js} +1 -1
- package/web/dist/assets/{global-activity-route-DpQr_eU9.js → global-activity-route-DRc_wjkF.js} +1 -1
- package/web/dist/assets/index-De7eAZ5M.js +17 -0
- package/web/dist/assets/index-Dps0ABGp.css +1 -0
- package/web/dist/assets/{live-protocol-DjH6ZQwI.js → live-protocol-aMLJJ0MQ.js} +1 -1
- package/web/dist/assets/preview-pane-connected-CU_lEf11.js +3 -0
- package/web/dist/assets/{project-router-uJ3SkX70.js → project-router-ir-bfT5a.js} +1 -1
- package/web/dist/assets/project-scope-context-BSdXJd3m.js +4 -0
- package/web/dist/assets/{prompt-template-menu-D5T9W-K3.js → prompt-template-menu-BJlLqUsI.js} +1 -1
- package/web/dist/assets/queries-BXo4WfX0.js +1 -0
- package/web/dist/assets/{reference-chip-AZWOlSRV.js → reference-chip-pp1FgLpK.js} +1 -1
- package/web/dist/assets/{repo-git-DJPSn50o.js → repo-git-BOfsABl4.js} +1 -1
- package/web/dist/assets/{report-reader-kzlovTso.js → report-reader-C_r69KvS.js} +1 -1
- package/web/dist/assets/reports-CWIvS-PA.js +1 -0
- package/web/dist/assets/run-header-CSEAFAfa.js +2 -0
- package/web/dist/assets/skills-jwrn7yXY.js +1 -0
- package/web/dist/assets/{tab-link-h4IjTsRH.js → tab-link-92W6MWDZ.js} +1 -1
- package/web/dist/assets/{task-changes-Db3dmYAT.js → task-changes-EalDx6wh.js} +1 -1
- package/web/dist/assets/{task-commits-D4HdW5xE.js → task-commits-ZWjrQSnF.js} +1 -1
- package/web/dist/assets/{task-files-sdaEBCfr.js → task-files-Cg-INsaD.js} +1 -1
- package/web/dist/assets/task-github-item-B8yO5uo1.js +1 -0
- package/web/dist/assets/task-thread-Bs6ZnRXz.js +9 -0
- package/web/dist/assets/{thread-state-hhRCETQT.js → thread-state-DBalnt7M.js} +1 -1
- package/web/dist/assets/use-desktop-BYMCVpyw.js +1 -0
- package/web/dist/assets/use-hand-to-agent-state-Bhmmem1E.js +1 -0
- package/web/dist/assets/{useInfiniteQuery-BcY0ra-k.js → useInfiniteQuery-C22IahAC.js} +1 -1
- package/web/dist/assets/useQuery-C0rYnV6X.js +1 -0
- package/web/dist/assets/{workflows-DRO8PcD-.js → workflows-BRhGKY_0.js} +2 -2
- package/web/dist/assets/ws-D9whCwIN.js +1 -0
- package/web/dist/index.html +15 -15
- package/web/dist/live-worker.js +1 -1
- package/web/dist/assets/activity-motion-BeswQRe1.js +0 -2
- package/web/dist/assets/agent-accounts-DseqHuGY.js +0 -18
- package/web/dist/assets/attention-DlfFfWoj.js +0 -1
- package/web/dist/assets/git-toolbar-Dya9briW.js +0 -1
- package/web/dist/assets/index-DS1HIBHa.css +0 -1
- package/web/dist/assets/index-DYx21hr3.js +0 -17
- package/web/dist/assets/preview-pane-connected-DSStovll.js +0 -3
- package/web/dist/assets/project-scope-context-X6-LgbYE.js +0 -4
- package/web/dist/assets/queries-00V5jnAV.js +0 -1
- package/web/dist/assets/reports-Ds7nog_M.js +0 -1
- package/web/dist/assets/run-header-skVwUvR-.js +0 -2
- package/web/dist/assets/skills-BJPLRZL5.js +0 -1
- package/web/dist/assets/task-github-item-DyZdbhco.js +0 -1
- package/web/dist/assets/task-thread-QKAKHYiJ.js +0 -9
- package/web/dist/assets/use-desktop-C3yCutND.js +0 -1
- package/web/dist/assets/use-hand-to-agent-state-wGtVosbN.js +0 -1
- package/web/dist/assets/useQuery-C96hAjNV.js +0 -1
- package/web/dist/assets/ws-BD6s7UXb.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,s as n,u as r}from"./button-Czdi8NqC.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{Hn as o,Nn as s,Rn as c,rr as l}from"./project-scope-context-BSdXJd3m.js";import{M as u}from"./live-protocol-aMLJJ0MQ.js";import"./queries-BXo4WfX0.js";import{t as d}from"./createLucideIcon-BHp8sXmF.js";import{a as f,d as p,h as m,i as ee,l as te,m as ne,n as re,o as ie,p as h,r as ae,t as oe,u as g}from"./es2015-DnySZnV4.js";import{_,b as se,v as ce,x as le,y as ue}from"./dropdown-menu-BN2BI4R1.js";import"./attention-BeBfNOUJ.js";function de(e){if(e.workflow===`(planned)`||e.workflow===`(inbox)`){let t=(e.steps??[]).find(e=>e.kind===`agent`);if(t?.name)return t.name}return e.workflow}var fe=d(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),v=e(i(),1),y=a(),b=`Popover`,[pe,me]=ne(b,[le]),x=le(),[he,S]=pe(b),C=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=x(t),c=v.useRef(null),[l,u]=v.useState(!1),[d,f]=p({prop:r,defaultProp:i??!1,onChange:a,caller:b});return(0,y.jsx)(se,{...s,children:(0,y.jsx)(he,{scope:t,contentId:te(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:v.useCallback(()=>u(!0),[]),onCustomAnchorRemove:v.useCallback(()=>u(!1),[]),modal:o,children:n})})};C.displayName=b;var w=`PopoverAnchor`,T=v.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=S(w,n),a=x(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return v.useEffect(()=>(o(),()=>s()),[o,s]),(0,y.jsx)(_,{...a,...r,ref:t})});T.displayName=w;var ge=`PopoverTrigger`,_e=v.forwardRef((e,t)=>{let{__scopePopover:r,...i}=e,a=S(ge,r),o=x(r),s=n(t,a.triggerRef),c=(0,y.jsx)(m.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":A(a.open),...i,ref:s,onClick:h(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?c:(0,y.jsx)(_,{asChild:!0,...o,children:c})});_e.displayName=ge;var E=`PopoverPortal`,[ve,ye]=pe(E,{forceMount:void 0}),be=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=S(E,t);return(0,y.jsx)(ve,{scope:t,forceMount:n,children:(0,y.jsx)(g,{present:n||a.open,children:(0,y.jsx)(ee,{asChild:!0,container:i,children:r})})})};be.displayName=E;var D=`PopoverContent`,xe=v.forwardRef((e,t)=>{let n=ye(D,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=S(D,e.__scopePopover);return(0,y.jsx)(g,{present:r||a.open,children:a.modal?(0,y.jsx)(Ce,{...i,ref:t}):(0,y.jsx)(we,{...i,ref:t})})});xe.displayName=D;var Se=t(`PopoverContent.RemoveScroll`),Ce=v.forwardRef((e,t)=>{let r=S(D,e.__scopePopover),i=v.useRef(null),a=n(t,i),o=v.useRef(!1);return v.useEffect(()=>{let e=i.current;if(e)return oe(e)},[]),(0,y.jsx)(re,{as:Se,allowPinchZoom:!0,children:(0,y.jsx)(O,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:h(e.onCloseAutoFocus,e=>{e.preventDefault(),o.current||r.triggerRef.current?.focus()}),onPointerDownOutside:h(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;o.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:h(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),we=v.forwardRef((e,t)=>{let n=S(D,e.__scopePopover),r=v.useRef(!1),i=v.useRef(!1);return(0,y.jsx)(O,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),O=v.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,p=S(D,n),m=x(n);return ae(),(0,y.jsx)(f,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,y.jsx)(ie,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>p.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,y.jsx)(ue,{"data-state":A(p.open),role:`dialog`,id:p.contentId,...m,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),k=`PopoverClose`,Te=v.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=S(k,n);return(0,y.jsx)(m.button,{type:`button`,...r,ref:t,onClick:h(e.onClick,()=>i.onOpenChange(!1))})});Te.displayName=k;var Ee=`PopoverArrow`,De=v.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=x(n);return(0,y.jsx)(ce,{...i,...r,ref:t})});De.displayName=Ee;function A(e){return e?`open`:`closed`}var Oe=C,ke=T,Ae=_e,je=be,Me=xe,Ne=new Set([`queued`,`running`,`waiting`]);function Pe(e){return Ne.has(e)}function j(e){return l(e)?!1:e.status===`queued`||e.status===`running`||e.status===`waiting`}function Fe(e){return j(e)&&e.status!==`queued`}function M(e,t,n){return e.archived||!(e.status===`done`||e.status===`failed`||e.status===`cancelled`)||e.delegation?.role===`worker`||n!==void 0&&o(e)!==n?!1:t===`unpinned`?!e.pinned:t!==`pinned`||e.pinned===!0}var Ie=[`done`,`failed`];function N(e){return e.archived||l(e)||!Ie.includes(e.status)?!1:e.finishedAt!==void 0}function Le(e){let t=e.finishedAt;return t===void 0||!N(e)?!1:e.seenAt===void 0||e.seenAt<t}var P=[`Needs you`,`Finished`,`Working`,`Archived`],Re={waiting:0,review:1,running:2,queued:4,done:5,failed:6,cancelled:7},ze=3,F=e=>l(e)?ze:Re[e.status]??9;function Be(e){let t=e=>s[c(e).bucket];return[...e].sort((e,n)=>t(e)-t(n)||F(e)-F(n))[0]}function Ve(e,t){return t===`archived`?`Archived`:c(e).bucket===`waiting`?`Needs you`:e.status===`waiting`||e.status===`running`||e.status===`queued`?`Working`:`Finished`}function I(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function L(e){let t=/^(\d{1,9}): (.+)$/.exec(e),n=t?.[1],r=t?.[2];return n===void 0||r===void 0?{ref:null,rest:e}:{ref:Number(n),rest:r}}function He(e,t){return t!==void 0&&L(e).ref===t}function R(e){let t=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));return new Map(t.map((e,t)=>[e.id,t+1]))}function Ue(e,t){return e.filter(e=>t===`archived`?e.archived:!e.archived).sort((e,n)=>{if(t!==`archived`){let t=Number(!!n.pinned)-Number(!!e.pinned);if(t!==0)return t}let r=F(e)-F(n);if(r!==0)return r;if(l(e)&&l(n)){let t=e.autoResumeAt.localeCompare(n.autoResumeAt);if(t!==0)return t}return e.status===`queued`&&n.status===`queued`?e.createdAt.localeCompare(n.createdAt):n.createdAt.localeCompare(e.createdAt)})}function z(e){return e.delegation?.role===`worker`}function We(e,t){if(e==null)return null;let n=t.find(t=>t.id===e);return!n||!z(n)?e:n.delegation?.parentRunId??e}function Ge(e,t,n=R(e)){let r=Ue(e,t).filter(e=>!z(e)),i=new Map,a=(e,t)=>{let n=i.get(e);n?n.push(t):i.set(e,[t])};for(let e of r)a(Ve(e,t),{kind:`run`,run:e,queuePosition:n.get(e.id)??null});return P.filter(e=>i.has(e)).map(e=>({label:e,rows:i.get(e)}))}function Ke(e,t={}){let n=typeof t==`number`?{overall:t}:u(t),r={"Needs you":`needsYou`,Finished:`finished`,Working:`working`},i=[],a=n.overall===void 0?10:n.overall??1/0;for(let t of e){let e=t.label===`Archived`?1/0:n[r[t.label]]??1/0,o=t.rows.filter(n=>{let r=n.run.pinned;return t.label!==`Archived`&&r?!0:a<=0||e<=0?!1:(--a,--e,!0)});o.length&&i.push({label:t.label,rows:o})}return i}function qe(e,t){if(t.length===0)return[...e];let n=new Set(e.map(e=>e.id)),r=new Set,i=t.filter(e=>n.has(e.id)||r.has(e.id)?!1:(r.add(e.id),!0));return[...e,...i]}function Je(e){let t=0,n=0,r=0;for(let i of e)if(!z(i)){if(i.archived){n+=1;continue}t+=1,c(i).bucket===`waiting`&&(r+=1)}return{active:t,archived:n,waiting:r}}function Ye(e,t){let n=t===`automations`;return e.filter(e=>!e.archived&&o(e)===n)}var B={"Needs you":`needs-you`,Finished:`finished`,Working:`working`},V=Object.keys(B),H=`section`;function Xe(e,t){return`/?origin=${t===`automations`?`automations`:`direct`}&${H}=${B[e]}`}function Ze(e){return V.find(t=>B[t]===e)??null}function Qe(e){let t={active:0,automations:0,activeWaiting:0,automationsWaiting:0};for(let n of e){if(z(n)||n.archived)continue;let e=+(c(n).bucket===`waiting`);o(n)?(t.automations+=1,t.automationsWaiting+=e):(t.active+=1,t.activeWaiting+=e)}return t}function U(e){let t=e.visualViewport;return t?Math.max(0,Math.round(e.innerHeight-t.height-t.offsetTop)):0}function $e(e,t,n,r=250){let i=e.visualViewport;if(!i)return t(0),()=>{};let a,o=()=>{let i=U(e);t(i),n&&(clearTimeout(a),a=setTimeout(()=>n(i),r))};return t(U(e)),i.addEventListener(`resize`,o),i.addEventListener(`scroll`,o),()=>{clearTimeout(a),i.removeEventListener(`resize`,o),i.removeEventListener(`scroll`,o),t(0)}}function et(e){let t=e.visualViewport;return t?{top:Math.max(0,Math.round(t.offsetTop)),bottom:U(e)}:{top:0,bottom:0}}function tt(e,t=0){let n=typeof t==`number`?{top:t,right:t,bottom:t,left:t}:t;return{top:(n.top??0)+e.top,right:n.right??0,bottom:(n.bottom??0)+e.bottom,left:n.left??0}}function nt(e,t){let n=e.visualViewport;if(!n)return t({top:0,bottom:0}),()=>{};let r=()=>t(et(e));return r(),n.addEventListener(`resize`,r),n.addEventListener(`scroll`,r),()=>{n.removeEventListener(`resize`,r),n.removeEventListener(`scroll`,r)}}function rt(){let[e,t]=(0,v.useState)({top:0,bottom:0});return(0,v.useEffect)(()=>nt(window,e=>t(t=>t.top===e.top&&t.bottom===e.bottom?t:e)),[]),e}function it(e){let t=(0,v.useRef)(e);t.current=e,(0,v.useEffect)(()=>{let e=document.documentElement;return $e(window,t=>e.style.setProperty(`--kb`,`${t}px`),e=>t.current?.(e))},[])}var at=new Set([``,`text`,`search`,`email`,`url`,`tel`,`password`,`number`]);function ot(e){if(!e||typeof e!=`object`)return!1;let t=e,n=t.tagName?.toUpperCase();return n===`TEXTAREA`?!0:n===`INPUT`?at.has((t.type??``).toLowerCase()):t.isContentEditable===!0}var W=new WeakMap;function st(e){let t=W.get(e),n=t&&t.width===e.innerWidth?Math.max(t.height,e.innerHeight):e.innerHeight;return W.set(e,{width:e.innerWidth,height:n}),n-e.innerHeight}function ct(e){let t=st(e),n=e.visualViewport?.scale??1;return Math.abs(n-1)<.05&&U(e)>80||t>80&&ot(e.document?.activeElement)}function lt(){let[e,t]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let e=window,n=()=>t(ct(e));n();let r=e.visualViewport;return r?.addEventListener(`resize`,n),r?.addEventListener(`scroll`,n),window.addEventListener(`resize`,n),document.addEventListener(`focusin`,n),document.addEventListener(`focusout`,n),()=>{r?.removeEventListener(`resize`,n),r?.removeEventListener(`scroll`,n),window.removeEventListener(`resize`,n),document.removeEventListener(`focusin`,n),document.removeEventListener(`focusout`,n)}},[]),e}function ut(e){let t=/\/(\d+)\/?$/.exec(e.trim()),n=t?Number(t[1]):NaN;return Number.isInteger(n)&&n>0?n:null}function dt(e){let t=new Set;for(let n of[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl]){let e=n?ut(n):null;e!==null&&t.add(e)}for(let n of[e.prNumber,e.issueNumber,e.markerRefs?.pr,e.markerRefs?.issue])typeof n==`number`&&Number.isInteger(n)&&n>0&&t.add(n);for(let n of e.pullRequests??[])t.add(n.number);return[...t]}var ft=[{id:`title`,kind:`text`,scopes:[`stored`],source:`summary`,texts:e=>[e.title]},{id:`titleSummary`,kind:`text`,scopes:[`stored`],source:`summary`,texts:e=>[e.titleSummary]},{id:`displayTitle`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>[t.displayTitle]},{id:`branch`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.branch]},{id:`workflow`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.workflow]},{id:`workflowLabel`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.workflowLabel]},{id:`automation`,kind:`text`,scopes:[`stored`,`shown`],source:`reader`,texts:(e,t)=>[t.automation],universe:e=>[...e.automationNames?.values()??[]]},{id:`projectName`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>[t.projectName]},{id:`tags`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>t.tags??[]},{id:`id`,kind:`identifier`,scopes:[`stored`],source:`summary`,texts:e=>[e.id]},{id:`urls`,kind:`link`,scopes:[`stored`],source:`summary`,texts:e=>[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl,...(e.pullRequests??[]).map(e=>e.url)]},{id:`heldReferences`,kind:`reference`,scopes:[`stored`],source:`summary`,numbers:dt},{id:`shownReferences`,kind:`reference`,scopes:[`shown`],source:`reader`,numbers:(e,t)=>t.references?.()??[]}];function pt(e){return e.trim().toLowerCase().split(/\s+/).filter(e=>e!==``)}function mt(e,t){return t&&e.automationId!==void 0?t.get(e.automationId)??e.automationId:void 0}function ht(e,t){let n=t.scope??`stored`,r=t.scope===`shown`?t.extras:{automation:mt(e,t.automationNames)},i=[],a=[],o=[],s={text:i,identifier:a,link:o},c=[];for(let t of ft)if(t.scopes.includes(n)){if(t.kind===`reference`){c.push(()=>t.numbers(e,r));continue}for(let n of t.texts(e,r))typeof n==`string`&&s[t.kind].push(n.toLowerCase())}let l;return{prose:i,ids:a,links:o,references:()=>l??=new Set(c.flatMap(e=>e().map(String)))}}function G(e,t,n={}){let r=pt(t);if(r.length===0)return!1;let{prose:i,ids:a,links:o,references:s}=ht(e,n);return r.every(e=>{if(i.some(t=>t.includes(e)))return!0;let t=e.replace(/^#/,``);return/^\d+$/.test(t)?s().has(String(Number(t)))||a.some(e=>e.startsWith(t)):a.some(t=>t.includes(e))||o.some(t=>t.includes(e))})}var gt=new Set([`running`,`waiting`]);function K(e){return e?e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} kB`:``}function _t(e){return e===void 0?``:`$${e>=10?e.toFixed(0):e.toFixed(2)}`}function vt(e,t=new Date){if(!l(e))return;let n=new Date(e.autoResumeAt);if(!Number.isFinite(n.getTime()))return;let r=n.toDateString()===t.toDateString(),i=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n);return{label:r?i:`${new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(n)} ${i}`,title:`Resumes automatically at ${new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n)}`}}function yt(e){return e.steps?de({workflow:e.workflow,steps:e.steps}):e.workflowLabel??e.workflow}function bt(e,t,n=()=>``){let r=e.filter(e=>!z(e));return t.trim()?r.filter(e=>G(e,t,{scope:`shown`,extras:{displayTitle:I(e),automation:n(e),references:()=>q(e)}})):[...r]}function q(e){return Y(e).map(e=>e.number)}function J(e,t){return e.filter(e=>M(e,t)).length}function xt(e){return J(e)}function St(e){return Ct(e)[0]??e.pullRequests?.find(e=>e.url)?.url}function Ct(e){let t=[];return e.pullRequestUrl&&t.push(e.pullRequestUrl),!(e.markerRefs?.issue!==void 0&&e.markerRefs?.pr===void 0)&&e.referencedPullRequestUrl&&t.push(e.referencedPullRequestUrl),t}function wt(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.issueNumber??e.markerRefs?.issue;if(!(!n||!t))return`${t}/issues/${n}`}function Tt(e){let t=`${e.kind}#${e.number}`;if(!e.url)return`${t}@project:${e.projectId??`default`}`;try{let n=new URL(e.url),r=n.pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`);return`${t}@${n.host.toLowerCase()}/${r.toLowerCase()}`}catch{return`${t}@${e.url}`}}function Y(e,t,n=e.projectId){let r=Ct(e),i=e.markerRefs?.pr,a=[...i===void 0||[...r,...(e.pullRequests??[]).flatMap(e=>e.url?[e.url]:[])].some(e=>Z(e)===String(i))?[]:[{kind:`PR`,number:i}],...r.map(e=>({kind:`PR`,url:e})),{kind:`PR`,number:e.prNumber},...(e.pullRequests??[]).map(e=>({kind:`PR`,number:e.number,...e.url?{url:e.url}:{},authoritative:!0})),{kind:`Issue`,url:wt(e,t)},{kind:`Issue`,number:e.issueNumber}],o=new Set,s=[];for(let e of a){let r=e.url?Number(Z(e.url)):e.number;if(!r||!Number.isInteger(r)||!e.url&&!e.authoritative&&s.some(t=>t.url&&t.kind===e.kind&&t.number===r))continue;let i=e.url??Et(e.kind,r,t),a={kind:e.kind,number:r,...i?{url:i}:n===void 0?{}:{projectId:n}},c=Tt(a);o.has(c)||(o.add(c),s.push(a))}return s}function Et(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function Dt(e){return Y(e)[0]}function X(e,t){if(!e.url)return!0;if(!t)return!1;let n=Ot(t);return n!==void 0&&Ot(e.url)===n}function Ot(e){try{let t=new URL(e),[n,r]=t.pathname.split(`/`).filter(Boolean);return n&&r?`${t.host}/${n}/${r}`.toLowerCase():void 0}catch{return}}function kt(e,t){let n=[];for(let r of Y(e,t)){if(!X(r,t))continue;let e=r.kind===`PR`?`pr`:`issue`;n.some(t=>t.kind===e&&t.number===r.number)||n.push({kind:e,number:r.number})}return n}function At(e,t,n,r){if(X(n,r))return`/p/${e}/tasks/${t}/${n.kind===`PR`?`pr`:`issue`}/${n.number}`}function Z(e){return/\/(\d+)\/?(?:[?#].*)?$/.exec(e)?.[1]??null}function jt(e,t){let n=gt.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:K(n.rssBytes),kind:`live`}};let r=K(e.peakRssBytes);return{cpu:{text:``,kind:`none`},mem:r?{text:`peak ${r}`,kind:`peak`,title:`peak — run finished${e.peakProcCount?` · ${e.peakProcCount} procs`:``}`}:{text:``,kind:`none`}}}var Q=v.createContext(null);function Mt({...e}){let t=v.useRef(!1);return(0,y.jsx)(Q,{value:t,children:(0,y.jsx)(Oe,{"data-slot":`popover`,...e})})}function Nt({onPointerDownCapture:e,onKeyDownCapture:t,...n}){let r=v.useContext(Q);return(0,y.jsx)(Ae,{"data-slot":`popover-trigger`,...n,onPointerDownCapture:t=>{r&&(r.current=t.pointerType===`touch`),e?.(t)},onKeyDownCapture:e=>{r&&(r.current=!1),t?.(e)}})}function Pt({className:e,align:t=`center`,sideOffset:n=4,collisionPadding:i,onOpenAutoFocus:a,...o}){let s=rt(),c=v.useContext(Q);return(0,y.jsx)(je,{children:(0,y.jsx)(Me,{"data-slot":`popover-content`,align:t,sideOffset:n,onOpenAutoFocus:e=>{let t=c?.current;if(c&&(c.current=!1),a?.(e),e.defaultPrevented||!t)return;let n=e.target;n instanceof HTMLElement&&n.querySelector(`[cmdk-input]`)&&(e.preventDefault(),n.focus({preventScroll:!0}))},collisionPadding:tt(s,i),className:r(`z-50 w-72 max-w-(--radix-popover-content-available-width) [overflow-wrap:anywhere] origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden 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`,e),...o})})}function Ft({...e}){return(0,y.jsx)(ke,{"data-slot":`popover-anchor`,...e})}var $=`(min-width: 48rem)`;function It(){let[e,t]=(0,v.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 48rem)`).matches);return(0,v.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia($),n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}export{V as A,Xe as B,jt as C,lt as D,it as E,Be as F,qe as G,Qe as H,Ze as I,Pe as J,N as K,R as L,Ge as M,z as N,P as O,Je as P,fe as Q,He as R,Y as S,G as T,Ye as U,We as V,L as W,M as X,Fe as Y,Le as Z,wt as _,Pt as a,St as b,xt as c,X as d,Z as f,J as g,q as h,Ft as i,Ke as j,H as k,_t as l,vt as m,It as n,Nt as o,Tt as p,j as q,Mt as r,bt as s,$ as t,K as u,At as v,yt as w,Dt as x,kt as y,I as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,t as n,u as r}from"./button-Czdi8NqC.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{Bt as o,C as s,Ur as c,nt as l,r as u,rt as d,tn as f,yr as p}from"./project-scope-context-BSdXJd3m.js";import{$t as m,M as h,O as g,P as _,Pt as v,Rt as y,Tt as b,et as x,h as S,jt as C,n as w,rt as T}from"./queries-BXo4WfX0.js";import{t as E}from"./useQuery-C0rYnV6X.js";import{Q as D,a as O,o as k,r as A}from"./use-desktop-BYMCVpyw.js";import{n as j}from"./toaster-2NK3PogQ.js";import{A as M,Z as ee,_ as N,b as P,ct as F,d as I,ft as te,h as ne,l as L,mt as re,ot as ie,r as ae,rt as oe,u as se,ut as ce}from"./design-icons-DmYTv2r1.js";import{t as le}from"./eye-B8okNWXU.js";import{a as ue,i as R}from"./format-BNCkW110.js";import{t as de}from"./message-square-B-MD-8rD.js";import{t as fe}from"./play-CmVAj_fu.js";import{a as pe,i as me,o as he,r as ge,s as _e,t as ve}from"./dialog-CkU56ywj.js";import{d as z,t as ye,y as B}from"./prompt-template-menu-BJlLqUsI.js";import{t as V}from"./project-router-ir-bfT5a.js";import{B as be,E as xe,I as Se,L as H,M as Ce,O as we,P as Te,R as Ee,S as De,T as Oe,a as ke,b as Ae,f as je,h as Me,i as Ne,l as Pe,m as Fe,n as Ie,p as Le,r as U,s as Re,t as ze,u as Be,w as Ve,x as He,z as Ue}from"./agent-accounts-BrFoXDpa.js";import{d as We,f as Ge,i as Ke,s as qe,t as Je,u as Ye}from"./skills-DFBiAuJG.js";import{F as Xe,L as Ze,X as Qe,Y as $e,et,pn as tt}from"./index-De7eAZ5M.js";import{t as nt}from"./diff-DgAd6acp.js";import{t as rt}from"./tab-link-92W6MWDZ.js";var W=e(i(),1),G=a(),it={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function K({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,G.jsx)(L,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:r(t,`text-success`)}):e===`failing`?(0,G.jsx)(N,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:r(t,`text-danger`)}):e===`pending`?(0,G.jsx)(ue,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:r(t,`animate-spin text-warning`)}):(0,G.jsx)(ne,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:r(t,`text-soft-foreground`)})}function at(e){return e?.available?e.mergeState:null}function ot(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function st(e){return e.state===`merged`?`Merged`:e.state===`closed`?`Closed`:e.isDraft?`Draft`:e.mergeable===`conflicting`?`Conflicts must be resolved`:e.canMerge?`Ready to merge`:e.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`}function ct(e){return e===`approved`||e===`not-required`?`passing`:e===`unknown`?`unknown`:`failing`}function lt(e){return e===`mergeable`?`passing`:e===`conflicting`?`failing`:`unknown`}function ut(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function dt(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function ft(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function pt(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function q(e){return e?it[e]:`Merge`}function mt(e){return e===`conflicting`?`true`:void 0}function ht({check:e}){return(0,G.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(K,{state:e.state}),(0,G.jsxs)(`span`,{children:[e.name,` · `,e.state,dt(e.required)]})]}),e.url&&t(e.url)?(0,G.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function gt({reason:e}){return(0,G.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,G.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,G.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function _t({state:e,selectedMethod:t,overrideRules:i,mergeEnabled:a,refreshPending:o,onRefresh:s,onRunAgent:c,onConfirm:l,onMethodChange:u,onOverrideChange:d}){let f=st(e),p=ct(e.reviewDecision),m=lt(e.mergeable);return(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,G.jsx)(L,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,G.jsx)(F,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:f}),(0,G.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,disabled:o,onClick:s,children:[(0,G.jsx)(ee,{size:16,"aria-hidden":`true`,className:r(`size-3.5`,o&&`animate-spin`)}),`Refresh`]})]}),(0,G.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[e.headRef,` (`,e.headSha.slice(0,7),`) → `,e.baseRef]}),(0,G.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,G.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(K,{state:p}),(0,G.jsxs)(`span`,{children:[`Reviews: `,e.reviewDecision.replaceAll(`-`,` `)]})]}),(0,G.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(K,{state:m}),(0,G.jsxs)(`span`,{children:[`Conflicts: `,ut(e.mergeable)]})]}),e.checks.length===0?(0,G.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,G.jsx)(ht,{check:e},e.name)),e.blockers.map(e=>(0,G.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&c?(0,G.jsx)(n,{className:`mt-4`,onClick:c,children:`Run agent on this PR`}):null,e.canOverride?(0,G.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>d(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,G.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,e.eligibility===`unknown`?(0,G.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,e.state===`open`&&e.methods.length>0?(0,G.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,G.jsx)(`select`,{"aria-label":`Merge method`,value:t??``,onChange:e=>u(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:e.methods.map(e=>(0,G.jsx)(`option`,{value:e,children:it[e]},e))}),(0,G.jsx)(n,{disabled:!a,onClick:l,children:q(t)})]}):null]})]})}function vt({number:e,state:t,selectedMethod:r,confirming:i,overrideRules:a,mergePending:o,mergeError:s,onOpenChange:c,onMerge:l}){return(0,G.jsx)(ve,{open:i,onOpenChange:c,children:(0,G.jsxs)(ge,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,G.jsxs)(he,{children:[(0,G.jsxs)(_e,{children:[q(r),` pull request #`,e,`?`]}),(0,G.jsx)(me,{asChild:!0,children:(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`p`,{children:[`This will merge “`,t.title,`” into `,t.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),a&&t.canOverride?(0,G.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-warning`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),s?(0,G.jsx)(`p`,{className:`text-sm text-danger`,children:s.message}):null,(0,G.jsxs)(pe,{children:[(0,G.jsx)(n,{variant:`outline`,disabled:o,onClick:()=>c(!1),children:`Cancel`}),(0,G.jsx)(n,{disabled:o,onClick:l,children:o?`Merging…`:q(r)})]})]})})}function yt({number:e,onRunAgent:t}){let n=c(),r=T(),i=E({queryKey:w.githubMergeState(e),queryFn:({signal:t})=>d(e,{},{signal:t}),retry:!1}),a=at(i.data),[s,l]=(0,W.useState)(null),[u,f]=(0,W.useState)(!1),[p,h]=(0,W.useState)(!1),g=m({mutationFn:t=>d(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>j(e instanceof Error?e.message:String(e),{tone:`danger`})}),_=ot(s,a),v=()=>({mergeState:w.githubMergeState(e),list:w.githubPages(50),comments:w.githubComments(`pr`,e),item:w.githubItem(`pr`,e),refStatus:r===void 0?void 0:w.githubRefStatusOf(r)}),y=m({mutationFn:t=>{if(!a||!_)throw Error(`No merge method is available.`);return o(e,{method:_,expectedHeadSha:a.headSha,...p&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{f(!1),j(`Pull request #${e} merged`),n.invalidateQueries({queryKey:r.mergeState}),n.invalidateQueries({queryKey:r.list}),n.invalidateQueries({queryKey:r.comments}),n.invalidateQueries({queryKey:r.item}),r.refStatus&&n.invalidateQueries({queryKey:r.refStatus})},onError:(e,t)=>{j(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,G.jsx)(B,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,G.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":mt(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,G.jsx)(_t,{state:a,selectedMethod:_,overrideRules:p,mergeEnabled:pt(_,a,p),refreshPending:g.isPending,onRefresh:()=>g.mutate(w.githubMergeState(e)),onRunAgent:t,onConfirm:()=>f(!0),onMethodChange:l,onOverrideChange:h}),(0,G.jsx)(vt,{number:e,state:a,selectedMethod:_,confirming:u,overrideRules:p,mergePending:y.isPending,mergeError:y.error,onOpenChange:f,onMerge:()=>y.mutate(v())})]}):(0,G.jsx)(gt,{reason:ft(i.data)})}function bt(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function xt(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.author!==void 0&&e.author.toLowerCase()!==t.author.toLowerCase()||t.includeNumbers&&!t.includeNumbers.has(e.number)||t.excludeNumbers?.has(e.number)||t.projectId&&e.projectIds!==void 0&&!e.projectIds.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function St(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function J(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}function Ct({label:e,color:t,plain:n=!1}){return(0,G.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:J(t),className:n?`text-[11px] font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function wt(e){return e===`pr`?`pull request`:`issue`}function Tt(e,t,n){return e===`pr`&&!!(t||n)}function Et({backLink:e}){return e?(0,G.jsxs)(V,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,G.jsx)(ae,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}function Dt({item:e,kindWord:n,commentCount:r,hasDiffStat:i,additions:a,deletions:o}){return(0,G.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,G.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,G.jsx)(`span`,{children:n}),`·`,(0,G.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,G.jsxs)(`span`,{children:[R(e.createdAt),` ago`]}),r?(0,G.jsxs)(G.Fragment,{children:[`·`,(0,G.jsx)(Jt,{count:r})]}):null,i?(0,G.jsxs)(G.Fragment,{children:[`·`,(0,G.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,G.jsxs)(`span`,{className:`text-success`,children:[`+`,a??0]}),` `,(0,G.jsxs)(`span`,{className:`text-danger`,children:[`−`,o??0]})]})]}):null,`·`,t(e.url)?(0,G.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,G.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,G.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function Ot({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,G.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,G.jsx)(rt,{to:z(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,G.jsx)(rt,{to:z(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,G.jsx)(V,{to:z(`prs`,null,e.number,`/changes`),"data-slot":`gh-files-changed`,className:`mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:underline`,children:`Files changed`}):null}function kt({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,G.jsx)(Ct,{label:e,color:t[e]},e)),n?(0,G.jsx)(Yt,{checks:n,url:e.url}):null]}):null}function At({item:e,colors:t,body:n}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:n?(0,G.jsx)(Ze,{children:n}):(0,G.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,G.jsx)(Nt,{item:e,colors:t})]})}function jt({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,children:c}){let l=a?.changes??!1,u=wt(e.kind),d=g(e.kind,e.number,!l).data?.detail,f=d?.body??e.body,p=d?.additions??e.additions,m=d?.deletions??e.deletions,h=Tt(e.kind,p,m),_=r??e.comments;return(0,G.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,G.jsx)(Et,{backLink:i}),(0,G.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,G.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,G.jsx)(Dt,{item:e,kindWord:u,commentCount:_,hasDiffStat:h,additions:p,deletions:m}),e.kind===`pr`?null:(0,G.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),s,(0,G.jsx)(Ot,{item:e,subNav:a,changes:l}),(0,G.jsx)(kt,{item:e,colors:t,checks:n}),l&&e.kind===`pr`?(0,G.jsx)(Mt,{item:e}):(0,G.jsx)(At,{item:e,colors:t,body:f})]}),e.kind===`pr`?(0,G.jsx)(yt,{number:e.number,onRunAgent:o}):null,c]})}function Mt({item:e}){let i=c(),a=h(e.number),[o,s]=(0,W.useState)(``),[u,d]=(0,W.useState)(null),f=a.data,p=f?.available?f.files.filter(e=>e.path.toLowerCase().includes(o.toLowerCase())):[],m=p.findIndex(e=>e.path===u);(0,W.useEffect)(()=>{p.length>0&&!p.some(e=>e.path===u)&&d(p[0].path)},[f?.available?f.headSha:``,o]);let g=async()=>{let t=f?.available?f.headSha:null,n=w.githubPrChanges(e.number),r=await l(e.number,{refresh:!0});i.setQueryData(n,r),r.available&&t&&t!==r.headSha&&(d(r.files[0]?.path??null),j(`The reviewed revision changed.`))};if(a.isPending)return(0,G.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(a.isError||!f)return(0,G.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!f.available)return(0,G.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:f.reason});let _=p.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),v=t(e.url)?`${e.url}/files`:null,y=p.find(e=>e.path===u);return(0,G.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,G.jsxs)(`strong`,{children:[f.files.length,` changed files`]}),(0,G.jsxs)(`span`,{className:`text-success`,children:[`+`,f.additions]}),(0,G.jsxs)(`span`,{className:`text-danger`,children:[`−`,f.deletions]}),(0,G.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:f.headSha,children:[`head `,f.headSha.slice(0,8)]}),(0,G.jsx)(n,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void g(),children:`Refresh`})]}),f.truncated?(0,G.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[f.reason??`This response is incomplete.`,` `,v?(0,G.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,G.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,G.jsxs)(`aside`,{className:`min-w-0`,children:[(0,G.jsx)(`input`,{"aria-label":`Filter changed files`,value:o,onChange:e=>s(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,G.jsx)(`select`,{"aria-label":`Select changed file`,value:u??``,onChange:e=>d(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:p.map(e=>(0,G.jsx)(`option`,{children:e.path},e.path))}),(0,G.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:p.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>d(e.path),className:r(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,u===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,G.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,G.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,G.jsx)(n,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:m<=0,onClick:()=>d(p[m-1]?.path??null),children:(0,G.jsx)(tt,{})}),(0,G.jsx)(n,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:m<0||m>=p.length-1,onClick:()=>d(p[m+1]?.path??null),children:(0,G.jsx)(I,{size:16})})]}),p.length===0?(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(nt,{files:_.filter(e=>e.path===u),wrap:!0,className:`min-w-0`}),y&&!y.patch?(0,G.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,y.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Nt({item:e,colors:t}){let n=g(e.kind,e.number),r=n.data,i=(0,W.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(Pt(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,G.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,G.jsx)(B,{className:`mb-3 h-3 w-24`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(B,{className:`h-14 w-full`}),(0,G.jsx)(B,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,G.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,G.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,G.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,G.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,G.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,G.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,G.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Ft(i).map(e=>e.group===`commits`?(0,G.jsx)(It,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,G.jsx)(Kt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,G.jsx)(Lt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,G.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,G.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Pt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Ft(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function It({commits:e,colors:t}){let[n,r]=(0,W.useState)(!1),i=e[0]?.actor??`?`;return n?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,children:Y.committed}),(0,G.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,G.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,G.jsx)(Lt,{event:e,colors:t},e.id))]}):(0,G.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,children:Y.committed}),(0,G.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,G.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,G.jsx)(`span`,{className:`shrink-0`,children:R(e[e.length-1].createdAt)})]})})}var Y={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Lt({event:e,colors:t}){return(0,G.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:r(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Y[e.kind]}),(0,G.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,G.jsx)(Ut,{event:e,colors:t}),(0,G.jsx)(`span`,{className:`shrink-0`,children:R(e.createdAt)}),e.url?(0,G.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,G.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Rt({event:e}){return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,G.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,G.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,G.jsx)(Wt,{checks:e.checks})]})}function zt({event:e,colors:t}){return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,G.jsx)(`span`,{"data-slot":`gh-event-label`,style:J(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[12px]`,children:e.label.name}):null,(0,G.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function Bt({event:e}){return(0,G.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Vt({event:e}){return(0,G.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Ht={committed:e=>(0,G.jsx)(Rt,{event:e}),labeled:(e,t)=>(0,G.jsx)(zt,{event:e,colors:t}),unlabeled:(e,t)=>(0,G.jsx)(zt,{event:e,colors:t}),assigned:e=>(0,G.jsx)(Bt,{event:e}),unassigned:e=>(0,G.jsx)(Bt,{event:e}),merged:()=>(0,G.jsx)(`span`,{children:`merged this`}),closed:()=>(0,G.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,G.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,G.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,G.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,G.jsx)(Vt,{event:e})};function Ut({event:e,colors:t}){return Ht[e.kind]?.(e,t)??null}function Wt({checks:e}){return e?(0,G.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:r(`shrink-0`,Z[e]),children:X[e]}):null}var Gt={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function Kt({comment:e}){let t=e.reviewState?Gt[e.reviewState]:null;return(0,G.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,G.jsx)(qt,{url:e.avatarUrl,login:e.author}),(0,G.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,G.jsx)(`span`,{children:R(e.createdAt)}),t?(0,G.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:r(`rounded-full border px-1.5 py-px font-sans text-[12px] font-medium`,t.tone),children:t.label}):null,(0,G.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,G.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,G.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,G.jsx)(Ze,{children:e.body}):(0,G.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function qt({url:e,login:t}){let[n,r]=(0,W.useState)(!1);return e&&!n?(0,G.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,G.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var X={passing:`✓`,failing:`✗`,pending:`○`},Z={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Jt({count:e}){return e?(0,G.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,G.jsx)(de,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Yt({checks:e,url:t}){let n=r(`text-[11px] font-medium`,Z[e],t&&`hover:underline`),i=`${X[e]} checks ${e}`;return t?(0,G.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:i}):(0,G.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:i})}function Xt({checks:e}){return(0,G.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:r(`shrink-0 font-sans text-[11px] font-semibold`,Z[e]),children:X[e]})}function Zt(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function Qt(e,t=[]){let n=Zt(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=$t(t)),n}function $t(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function en(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function tn(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function Q(e,t,n){let r=(n??``).trim();if(!r)return Qt(e,t);let i=Zt(e),a=r.startsWith(i)?i+en(r.slice(i.length),e):en(r,e),o=tn(a,e)?a:`${i}\n\n${a}`;return t.length?o+$t(t):o}function nn(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function rn(e,t,n,r,i={}){return t?{...i,workflow:t,task:Q(e,n,r)}:n.length?{...i,steps:nn(n),task:Q(e,[],r)}:{...i,workflow:`quick-task`,task:Q(e,[],r)}}function an(e){let t=x(),n=S(),r=p(t.data),i=n.data?.defaultRunner,a=xe(e.runner,r,i??r[0]??`claude`),o=b(a),s=n.data?.modelsLocked===!0,{accounts:c,repoAccount:l}=Ie(),u=c.some(t=>t.provider===a&&t.id===e.account)?e.account:null,d=Oe(s?null:e.model,a,n.data?.defaultModels,o.data),f=Ae(a,d,o.data);return{runner:a,runnerExplicit:e.runner!==null,model:d,effort:s?``:Ve(e.effort,f),effortOptions:f,runners:r,defaultRunner:i,canRun:t.isSuccess&&r.length>0,modelsLocked:s,providerPending:t.isPending,providerError:t.isError,accounts:c,account:u,repoAccount:l}}function on(e){return{runner:we(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0,effort:e.modelsLocked?void 0:e.effort||void 0}}function sn(e){return{...on(e),...e.account?{agentProfile:e.account}:{}}}function cn({pick:e,onChange:t,disabled:n=!1,accounts:r=!1,layout:i}){let a=(0,W.useRef)(null),o=(0,W.useRef)(null),[s,c]=(0,W.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,W.useLayoutEffect)(()=>{let e=a.current;if(i!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;o.current=n instanceof HTMLElement&&e.contains(n)?n:null,c(t)};t();let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[i]),(0,W.useLayoutEffect)(()=>{let e=o.current;o.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[s]);let l=an(e),{runner:u,model:d,effort:f,effortOptions:p,runners:m,canRun:h,modelsLocked:g}=l,_=S(),v=b(u),y=De(u,v.data,[e.model,_.data?.defaultModels?.[u]]),x=n||!h,C=r?l.accounts:[],w=m.length>1||m.some(e=>ze(C,e))?(0,G.jsx)(ke,{icon:(0,G.jsx)(ie,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:m,value:u,accounts:C,account:r?l.account:null,repoAccount:r?l.repoAccount:void 0,disabled:x,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===u?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,T=(0,G.jsx)(U,{icon:(0,G.jsx)(P,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:d===``?`Default`:y.find(e=>e.id===d).label,value:d,disabled:x,readOnly:g===!0,disabledHint:g?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=Ae(u,n,v.data);t({...e,model:n,effort:e.effort===null?null:Ve(e.effort,r)})},options:y.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:He(u,v.data,v.isError,v.isFetching)},`model`),E=(0,G.jsx)(U,{icon:(0,G.jsx)(M,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:p.find(e=>e.value===f)?.label??`auto`,value:f,disabled:x,readOnly:g===!0,disabledHint:g?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:p.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return i===`row`?(0,G.jsx)(`div`,{ref:a,"data-slot":`engine-row-box`,children:(0,G.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,G.jsx)(Ne,{children:s?[w,E,T]:[w,T,E]})})}):(0,G.jsxs)(Ne,{children:[w,T,E]})}var ln={workflow:null,skills:[]},un=`cez-followup-selection`;function dn(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[]}}function fn(){try{let e=localStorage.getItem(un);return e?dn(JSON.parse(e)):{...ln}}catch{return{...ln}}}function pn(e){try{localStorage.setItem(un,JSON.stringify(e))}catch{}}var $=`cez-followup-prompt:`;function mn(e){try{return localStorage.getItem($+e)??``}catch{return``}}function hn(e,t){try{t===``?localStorage.removeItem($+e):localStorage.setItem($+e,t)}catch{}}function gn({item:e,workflows:r,skills:i,workflow:a,onWorkflowChange:o,selectedSkills:l,onSkillsChange:u,engine:d,onEngineChange:p,queuedRunId:h,onQueued:g}){let y=c(),b=v(),x=_().data?.capabilities.automations===!0,S=e.kind===`pr`?`PR`:`issue`,C=l.filter(e=>i.some(t=>t.name===e)),[T]=(0,W.useState)(()=>Zt(e)),[E,D]=(0,W.useState)(()=>mn(e.url)||T),O=an(d),k=(0,W.useRef)(null),A=(0,W.useRef)(null);(0,W.useEffect)(()=>{hn(e.url,E===T?``:E)},[e.url,E,T]);let M=(0,W.useMemo)(()=>Me(je(b.data?.promptTemplates),{automations:x}),[b.data?.promptTemplates,x]),ee=e=>{let t=k.current,n=Fe({prompt:E,base:T,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:A.current}),r=Be(E,n,e);D(r.text),A.current=r.caret,requestAnimationFrame(()=>{k.current?.focus(),k.current?.setSelectionRange(r.caret,r.caret)})},N=Pe(M,C),P=(0,W.useRef)(E);P.current=E;let F=(0,W.useRef)(``);(0,W.useEffect)(()=>{let e=Le(P.current,F.current,N,T);F.current=e.applied,e.text!==P.current&&D(e.text)},[N,T]);let I=m({mutationFn:async()=>O.canRun?s(rn(e,a,C,E,sn(O))):null,onSuccess:t=>{if(t===null)return;let n=t;n&&g(e.url,n.id),j(`Added to the queue — ${S} #${e.number}`),C.length>0&&b.data!==void 0&&f({skillUsage:C.reduce((e,t)=>Je(e,t),b.data.skillUsage)}).then(()=>y.invalidateQueries({queryKey:w.uiState})).catch(()=>{}),hn(e.url,``),D(T),F.current=``,y.invalidateQueries({queryKey:w.runs.all})},onError:e=>j(e.message,{tone:`danger`})}),te=e=>{$e({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!I.isPending&&O.canRun&&I.mutate())},ne=e=>u(l.includes(e)?l.filter(t=>t!==e):[...l,e]);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,G.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,G.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,G.jsx)(`span`,{children:`Instructions for the agent`}),(0,G.jsx)(et,{ref:k,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:E,onChange:e=>D(e.target.value),onSelect:e=>{A.current=e.currentTarget.selectionStart},onKeyDown:te,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,G.jsx)(ye,{templates:M,onInsert:ee}),(0,G.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,G.jsxs)(`div`,{className:`gh-field`,children:[(0,G.jsx)(`span`,{children:`Workflow`}),(0,G.jsx)(_n,{workflows:r,value:a,onChange:o})]}),(0,G.jsxs)(`div`,{className:`gh-field`,children:[(0,G.jsx)(`span`,{children:`Skills · select one or more`}),(0,G.jsx)(yn,{skills:i,skillUsage:b.data?.skillUsage,selected:C,onToggle:ne})]}),C.length>0?(0,G.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:C.map(e=>(0,G.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>ne(e),title:`Remove this skill`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,G.jsx)(re,{size:16,"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,G.jsx)(cn,{layout:`row`,pick:d,onChange:p,disabled:I.isPending||!O.canRun,accounts:!0}),(0,G.jsxs)(`div`,{className:`gh-field`,children:[(0,G.jsx)(`span`,{children:`Account`}),(0,G.jsx)(vn,{resolved:O,disabled:I.isPending||!O.canRun,onPick:e=>p({...d,account:e})})]}),!O.providerPending&&!O.canRun?(0,G.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[O.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,G.jsx)(V,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,G.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,G.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[t(e.url)?(0,G.jsx)(n,{asChild:!0,variant:`outline`,children:(0,G.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,G.jsxs)(n,{variant:`primary`,"data-action":`gh-run`,disabled:I.isPending||!O.canRun,onClick:()=>I.mutate(),children:[(0,G.jsx)(fe,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,S]}),(0,G.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[11px] font-medium text-muted-foreground`,children:Qe()}),h?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,G.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,G.jsx)(V,{to:`/tasks/${h}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function _n({workflows:e,value:t,onChange:n}){let[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(``),c=(0,W.useRef)(null),l=We(e,o);return(0,G.jsxs)(A,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,G.jsx)(k,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:r(Re,t&&`border-foreground/60 font-mono text-[11px] font-semibold text-foreground`),children:[(0,G.jsx)(te,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,G.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,G.jsx)(se,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,G.jsx)(O,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,G.jsxs)(Te,{shouldFilter:!1,children:[(0,G.jsx)(Ee,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,G.jsxs)(be,{ref:c,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,G.jsx)(Se,{children:`Nothing matches.`}):null,(0,G.jsx)(H,{children:l.map(e=>{let r=t===e.name;return(0,G.jsxs)(Ue,{value:`workflow ${e.name}`,keywords:Ge(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,G.jsx)(L,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function vn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:Ce,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,desc:e.configDir}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,G.jsx)(U,{icon:(0,G.jsx)(ce,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function yn({skills:e,skillUsage:t,selected:n,onToggle:i}){let[a,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(``),[l,u]=(0,W.useState)(null),d=(0,W.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=Ye(e,s,t),g=(e,t)=>{let a=n.includes(e.name);return(0,G.jsxs)(Ue,{value:`skill ${e.name} ${e.path}`,keywords:Ge(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":a?`true`:void 0,onSelect:()=>i(e.name),children:[(0,G.jsx)(`span`,{className:r(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,G.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,G.jsx)(le,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,G.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.path)};return e.length===0?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Xe,{skill:l,onClose:()=>u(null)}),(0,G.jsxs)(A,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,G.jsx)(k,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:r(Re,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,G.jsx)(oe,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,G.jsx)(se,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,G.jsx)(O,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,G.jsxs)(Te,{shouldFilter:!1,children:[(0,G.jsx)(Ee,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,G.jsxs)(be,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(h?h.length===0:f.length===0&&p.length===0&&m.length===0)?(0,G.jsx)(Se,{children:`Nothing matches.`}):null,h?h.length>0?(0,G.jsx)(H,{children:h.map(e=>g(e,Ke(e)))}):null:(0,G.jsxs)(G.Fragment,{children:[f.length>0?(0,G.jsx)(H,{heading:`Most used`,children:f.map(e=>g(e,Ke(e)))}):null,p.length>0?(0,G.jsx)(H,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,G.jsx)(H,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var bn=new WeakMap;function xn(){let e=fn(),t={workflow:e.workflow,selectedSkills:e.skills,engine:{runner:null,model:null,effort:null,account:null},queued:new Map},n=new Set;return{snapshot:()=>t,subscribe:e=>(n.add(e),()=>{n.delete(e)}),update:e=>{t={...t,...e},(e.workflow!==void 0||e.selectedSkills!==void 0)&&pn({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function Sn(){let e=c(),{projectId:t}=u(),n=bn.get(e);n||bn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=xn());let{snapshot:i,subscribe:a,update:o}=r,s=(0,W.useSyncExternalStore)(a,i,i),l=y(),d=C(),f=v(),p=l.data?.workflows;(0,W.useEffect)(()=>{p&&s.workflow!==null&&!p.some(e=>e.name===s.workflow)&&o({workflow:null})},[o,p,s.workflow]);let m=(0,W.useMemo)(()=>qe(d.data??[],f.data?.skillUsage),[d.data,f.data?.skillUsage]);return{...s,workflows:l,skillList:m,setWorkflow:e=>o({workflow:e}),setSelectedSkills:e=>o({selectedSkills:e}),setEngine:e=>o({engine:e}),onQueued:(e,t)=>o({queued:new Map(i().queued).set(e,t)})}}export{Jt as a,Ft as c,J as d,St as f,Xt as i,bt as l,gn as n,jt as o,Qt as r,Ct as s,Sn as t,xt as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Kr as e,Nr as t,Wr as n,qr as r}from"./project-scope-context-BSdXJd3m.js";var i=class extends n{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(t,n){let{state:i}=t,a=super.createResult(t,n),{isFetching:o,isRefetching:s,isError:c,isRefetchError:l}=a,u=i.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=o&&u===`forward`,p=c&&u===`backward`,m=o&&u===`backward`;return{...a,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:e(n,i.data),hasPreviousPage:r(n,i.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:s&&!f&&!m}}};function a(e,n){return t(e,i,n)}export{a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Nr as e,Wr as t}from"./project-scope-context-BSdXJd3m.js";function n(n,r){return e(n,t,r)}export{n as t};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,t as n,u as r}from"./button-Czdi8NqC.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{A as o,
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,t as n,u as r}from"./button-Czdi8NqC.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{A as o,T as s,Ur as c,Xt as l,i as u,qt as d}from"./project-scope-context-BSdXJd3m.js";import{$t as f,Pt as p,Rt as ee,jt as te,n as ne}from"./queries-BXo4WfX0.js";import{n as m}from"./toaster-2NK3PogQ.js";import{C as h,Q as g,S as re,X as _,a as ie,ct as ae,dt as oe,l as se,lt as v,mt as y,n as b,rt as ce,st as x,u as le,x as S,y as C}from"./design-icons-DmYTv2r1.js";import{i as w,p as ue,r as T,t as E}from"./dropdown-menu-BN2BI4R1.js";import{a as D,c as O,i as k,n as A,o as j,r as M,s as N,t as P}from"./alert-dialog-CPBKJTj_.js";import{i as F,o as de,r as I,s as L,t as R}from"./dialog-CkU56ywj.js";import{t as z}from"./input-Dilvz-YI.js";import{_ as fe,a as B,d as pe,g as me,h as V,i as he,l as ge,m as H,o as _e,p as ve,r as ye,s as be,t as U,v as W}from"./sortable.esm-zp_qkYGV.js";import{i as G,l as xe,s as Se}from"./skills-DFBiAuJG.js";import{t as Ce}from"./centered-state-8l6wvu0C.js";import{O as we,et as K}from"./index-De7eAZ5M.js";import{n as Te}from"./skill-empty-hint-YDmkqgo-.js";var q=e(i(),1);function J(e){let t=[];for(let n of e){if(n.command||!n.skill||n.prompt!==void 0&&n.prompt!==`{{task}}`||n.name!==void 0&&n.name!==n.skill||n.timeoutMs!==void 0||n.model||n.effort!==void 0||n.runner||n.agentProfile||n.allowedTools||n.bashAllowlist||n.onFail)return null;t.push(n.skill)}return t.length?t:null}function Ee(e,t){let n=new Set(t.map(e=>e.id)),r=e;for(let t=2;n.has(r);t++)r=`${e}-${t}`;return{id:r,name:e,skill:e,prompt:`{{task}}`}}function De(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function Oe(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return[...e];let r=[...e],[i]=r.splice(t,1);return i===void 0?[...e]:(r.splice(n,0,i),r)}function ke(e,t){return e.filter((e,n)=>n!==t)}function Y(e){let t=String(e),n=/^[A-Za-z0-9._][A-Za-z0-9 ._/-]*$/.test(t)&&!t.endsWith(` `),r=/^(true|false|yes|no|on|off|null|~)$/i.test(t)||/^[-+.]?\d/.test(t);return n&&!r?t:JSON.stringify(t)}function X(e,t,n){let r=` `.repeat(n);return t.includes(`
|
|
2
2
|
`)?[`${r}${e}: |`,...t.split(`
|
|
3
3
|
`).map(e=>`${r} ${e}`)]:[`${r}${e}: ${Y(t)}`]}function Ae(e){let t=[];return e.name&&e.name!==e.id&&t.push(` name: ${Y(e.name)}`),e.skill&&t.push(` skill: ${Y(e.skill)}`),t}function Z(e){let t=[];return e.model&&t.push(` model: ${Y(e.model)}`),e.timeoutMs!==void 0&&t.push(` timeoutMs: ${e.timeoutMs}`),e.effort!==void 0&&t.push(` effort: ${Y(e.effort)}`),e.runner&&t.push(` runner: ${Y(e.runner)}`),e.agentProfile&&t.push(` agentProfile: ${Y(e.agentProfile)}`),t}function je(e){let t=[];return e.allowedTools&&t.push(` allowedTools: [${e.allowedTools.map(Y).join(`, `)}]`),e.bashAllowlist&&t.push(` bashAllowlist: [${e.bashAllowlist.map(Y).join(`, `)}]`),t}function Me(e){return e.onFail?[` onFail:`,` retry: ${Y(e.onFail.retry)}`,` max: ${e.onFail.max??2}`]:[]}function Ne(e){return[` - id: ${Y(e.id)}`,...Ae(e),...e.prompt?X(`prompt`,e.prompt,4):[],...Z(e),...je(e),...e.command?X(`command`,e.command,4):[],...Me(e)]}function Pe(e,t,n){let r=[`name: ${Y(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...X(`description`,t.trim(),0));let i=J(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${Y(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(...Ne(e))}else r.push(`skills: []`);return`${r.join(`
|
|
4
4
|
`)}\n`}function Fe(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`workflow`}function Ie(e){let t=J(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function Le(e,t){let n=new Set,r=[];for(let t of e.steps.slice(0,8)){let e=t.id||`step`,i=e;for(let t=2;n.has(i);t++)i=`${e}-${t}`;n.add(i),r.push({...t,id:i})}return{name:e.name?.trim()||t,steps:r}}function Re(e,t,n){let r=J(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var Q=a();function ze({workflows:e,draft:t,trimmedName:n,nameRef:r,onDraft:i,onLoadWorkflow:a}){return(0,Q.jsxs)(`section`,{"data-slot":`wb-metadata`,className:`flex min-w-0 flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{"data-slot":`wb-load`,className:`flex flex-col items-start gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:`workflow-load`,className:`text-xs text-muted-foreground`,children:`Load an existing workflow`}),(0,Q.jsxs)(`div`,{className:`relative max-w-full`,children:[(0,Q.jsx)(le,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsxs)(`select`,{id:`workflow-load`,value:e.some(e=>e.name===n)?n:``,onChange:t=>{let n=e.find(e=>e.name===t.target.value);n&&a(n)},className:`h-11 max-w-full rounded-lg border border-border bg-card pl-9 pr-3 text-xs font-medium appearance-none focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(`option`,{value:``,disabled:!0,children:`Choose a workflow`}),e.map(e=>(0,Q.jsx)(`option`,{value:e.name,"data-slot":`wb-load-option`,"data-name":e.name,children:e.name},e.name))]})]})]}),(0,Q.jsx)(`label`,{htmlFor:`workflow-name`,className:`text-xs font-semibold`,children:`Workflow name`}),(0,Q.jsx)(z,{id:`workflow-name`,ref:r,"data-slot":`wb-name`,"aria-label":`Workflow name`,spellCheck:!1,value:t.name,onChange:e=>i({...t,name:e.target.value}),className:`h-12 bg-card text-sm`}),(0,Q.jsx)(`label`,{htmlFor:`workflow-description`,className:`text-xs font-semibold`,children:`Description`}),(0,Q.jsx)(K,{id:`workflow-description`,"data-slot":`wb-description`,"aria-label":`Description`,value:t.description,onChange:e=>i({...t,description:e.target.value}),className:`min-h-[72px] bg-card p-3.5 text-sm`})]})}function Be({savedFile:e,autoOpen:t,onImportToggle:r,onExport:i,onAutoToggle:a,onDeleteRequest:o}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-actions`,className:`grid grid-cols-[max-content_max-content] items-center justify-start gap-2 sm:flex sm:flex-wrap [&_button]:min-h-11 [&_button]:border [&_button]:border-border [&_button]:bg-card`,children:[(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import`,className:`col-span-2 justify-self-start`,onClick:r,children:[(0,Q.jsx)(v,{"aria-hidden":`true`,className:`size-3`}),`Import`]}),(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-export`,className:`col-span-2 justify-self-start`,title:`Download workflow.yaml`,onClick:i,children:[(0,Q.jsx)(S,{"aria-hidden":`true`,className:`size-3`}),`Export`]}),(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto`,"aria-expanded":t,title:`Describe a chain — the agent builds it`,onClick:a,children:[(0,Q.jsx)(oe,{"aria-hidden":`true`,className:`size-3`}),`Auto`]}),e?(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-delete`,className:`text-danger hover:text-danger`,title:`Delete the saved workflow file`,onClick:o,children:[(0,Q.jsx)(x,{"aria-hidden":`true`,className:`size-3`}),`Delete`]}):null]})}function Ve({text:e,onTextChange:t,pending:r,onRun:i,onCancel:a}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-auto-panel`,className:`rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(`h2`,{className:`text-lg font-normal`,children:`Build a chain from a prompt`}),(0,Q.jsx)(`p`,{className:`mt-4 text-[13px] leading-relaxed text-muted-foreground`,children:`Describe the outcome. An agent proposes a title and ordered skill/check steps. Review the result, edit it, then Save.`}),(0,Q.jsx)(K,{"data-slot":`wb-auto-text`,"aria-label":`Describe the chain to build`,rows:3,autoFocus:!0,placeholder:`e.g. Fix the bug, run the tests, then review the diff for regressions.`,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),i())},className:`mt-4 min-h-[108px] bg-background p-4 text-sm`}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsxs)(n,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-auto-run`,disabled:r||e.trim()===``,onClick:i,children:[(0,Q.jsx)(oe,{"aria-hidden":`true`,className:`size-3`}),r?`Building…`:`Build chain`]}),(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:a,children:[(0,Q.jsx)(y,{"aria-hidden":`true`,className:`size-4`}),`Cancel`]})]}),(0,Q.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Creates an editable draft. Review the generated name and steps before saving.`})]})}function He({open:e,onOpenChange:t,text:r,onTextChange:i,error:a,pending:o,onRun:s,onCancel:c}){return(0,Q.jsx)(R,{open:e,onOpenChange:t,children:(0,Q.jsxs)(I,{showCloseButton:!1,"data-slot":`wb-import-panel`,className:`max-md:translate-x-0 max-md:translate-y-0 sm:max-w-[660px] rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(L,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,Q.jsx)(F,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,Q.jsx)(K,{"data-slot":`wb-import-text`,"aria-label":`Workflow YAML to import`,rows:4,spellCheck:!1,placeholder:`name: my-flow
|
|
5
5
|
skills:
|
|
6
6
|
- test-conventions
|
|
7
|
-
- commit-style`,value:r,onChange:e=>i(e.target.value),className:`mt-4 min-h-[124px] bg-background p-4 font-mono text-[13px] leading-relaxed`}),(0,Q.jsx)(`p`,{className:`mt-4 text-[13px] text-muted-foreground`,children:`Paste a portable workflow definition. Imported steps appear in execution order.`}),a===``?null:(0,Q.jsx)(`p`,{"data-slot":`wb-import-error`,role:`alert`,className:`mt-2 text-xs text-danger`,children:a}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsx)(n,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-import-run`,disabled:o,onClick:s,children:`Import`}),(0,Q.jsx)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:c,children:`Cancel`})]})]})})}function Ue({paletteSkills:e,query:t,onQueryChange:n,error:r,inFlow:i,onAdd:a,yaml:o}){return(0,Q.jsxs)(`aside`,{"data-slot":`wb-aside`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:`Available skills`}),(0,Q.jsxs)(`div`,{className:`sw-search relative mt-4`,children:[(0,Q.jsx)(g,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(z,{"data-slot":`wb-filter`,placeholder:`Find a skill…`,"aria-label":`Filter skills`,value:t,onChange:e=>n(e.target.value),className:`h-11 pl-9 text-xs`})]}),(0,Q.jsx)(rt,{skills:e,query:t,error:r,inFlow:i,onAdd:a}),(0,Q.jsx)(`h3`,{className:`mt-5 text-sm font-semibold`,children:`workflow.yaml`}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-muted-foreground`,children:`Export the workflow to use this chain in another project.`}),(0,Q.jsxs)(`details`,{className:`mt-4 min-w-0`,children:[(0,Q.jsxs)(`summary`,{"data-slot":`wb-yaml-toggle`,className:`inline-flex min-h-[44px] cursor-pointer items-center rounded-lg border border-border px-3 text-xs font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(h,{"aria-hidden":`true`,className:`mr-2 size-4`}),`View YAML`]}),(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsx)(at,{yaml:o})}),(0,Q.jsx)(`pre`,{"data-slot":`wb-yaml`,className:`mt-2 max-h-96 overflow-auto rounded-lg border border-border bg-background p-3 font-mono text-[11px] leading-relaxed whitespace-pre text-muted-foreground`,children:o})]})]})}function We({dragging:e,steps:t,skills:n}){return e?.type===`palette`?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[13px] font-medium shadow-md`,children:[(0,Q.jsx)(ce,{"aria-hidden":`true`,className:`size-3.5 text-link-foreground`}),e.skill]}):e?.type===`step`?(0,Q.jsx)(nt,{step:e.step,index:t.findIndex(t=>t.id===e.step.id),skills:n,overlay:!0}):null}function Ge({open:e,onOpenChange:t,query:r,onQueryChange:i,matches:a,skillsCount:o,error:s,selectedSkill:c,onSelectSkill:l,stepsCount:u,onCloseAutoFocus:d,onCancel:f,onAdd:p}){return(0,Q.jsx)(R,{open:e,onOpenChange:t,children:(0,Q.jsxs)(I,{"data-slot":`wb-add-dialog`,onCloseAutoFocus:d,className:`max-h-[85dvh] overflow-y-auto sm:max-w-[660px] [&_button]:min-h-11`,children:[(0,Q.jsxs)(de,{children:[(0,Q.jsx)(L,{className:`text-xl font-normal`,children:`Add step`}),(0,Q.jsx)(F,{className:`sr-only`,children:`Choose a skill to append to this workflow.`})]}),(0,Q.jsx)(z,{"aria-label":`Filter skills`,placeholder:`Filter skills…`,value:r,onChange:e=>i(e.target.value)}),s===null?(0,Q.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Available skills`,className:`grid max-h-80 gap-2 overflow-y-auto`,children:[a.map(e=>(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg py-2 has-[:checked]:bg-accent-strong/10 has-[:focus-visible]:outline-2`,children:[(0,Q.jsx)(`input`,{type:`radio`,name:`workflow-add-skill`,className:`sr-only`,value:e.name,checked:c===e.name,onChange:()=>l(e.name)}),(0,Q.jsxs)(`span`,{className:`min-w-0 break-words text-sm`,children:[(0,Q.jsx)(`span`,{className:`block`,children:e.name}),(0,Q.jsx)(`span`,{className:`mt-2 block text-xs text-muted-foreground`,children:e.description})]})]},e.name)),a.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o===0?`No skills available in this project.`:`No matching skills.`}):null]}):(0,Q.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not load skills: `,s]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Q.jsx)(n,{variant:`outline`,onClick:f,children:`Cancel`}),(0,Q.jsx)(n,{variant:`primary`,disabled:!c||u>=8,onClick:()=>{c&&p(c)},children:`Add selected skill`})]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Append the selected skill, then reorder it in the existing canvas.`}),u>=8?(0,Q.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[`A workflow can contain up to `,8,` steps. Remove a step before adding another.`]}):null]})})}function Ke({trimmedName:e,savedFile:t,overwriteOpen:n,onOverwriteDismiss:r,deleteOpen:i,onDeleteDismiss:a,onOverwrite:o,onDelete:s}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(P,{open:n,onOpenChange:e=>!e&&r(),children:(0,Q.jsxs)(k,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(N,{children:[(0,Q.jsxs)(O,{children:[`“`,e,`” already exists`]}),(0,Q.jsx)(D,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(M,{children:`Keep the file`}),(0,Q.jsx)(A,{"data-slot":`wb-overwrite-confirm`,className:`bg-danger text-danger-foreground`,onClick:o,children:`Overwrite`})]})]})}),(0,Q.jsx)(P,{open:i,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(k,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(N,{children:[(0,Q.jsxs)(O,{children:[`Delete workflow “`,e,`”?`]}),(0,Q.jsxs)(D,{children:[`Removes `,t?.path?.split(`/`).pop()??`the saved file`,` from`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/workflows/`}),`. There is no undo.`]})]}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(M,{children:`Keep the file`}),(0,Q.jsx)(A,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:s,children:`Delete workflow`})]})]})})]})}function qe(e){return e.name??e.skill??e.id}function Je(e){return e.prompt?.trim()===`{{task}}`?void 0:e.prompt?.trim()}function Ye(e){let t=e.onFail?` — on fail retry from "${e.onFail.retry}" (×${e.onFail.max??2})`:``;return`$ ${e.command}${t}`}function Xe(e,t){return Je(e)||t?.description||`Not in this repo or the team skills — the step runs on its plain prompt.`}function Ze(e,t){return e.command?Ye(e):e.skill?Xe(e,t):e.prompt??``}function Qe(e,t){return e.skill&&!t?`unknown`:null}function $e(e){return e.command?`Command step${e.onFail?` · Retry ×${e.onFail.max??2}`:``}`:e.skill?`Skill step`:`Prompt step`}function et({index:e,title:t,badge:i,onRemove:a,gripProps:o}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-step-heading`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-step-grip`,"aria-label":`Reorder step ${e+1}: ${t}`,className:`inline-flex size-[26px] shrink-0 cursor-grab items-center justify-center rounded-md text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,...o,children:(0,Q.jsx)(`span`,{className:`rounded bg-accent-strong/10 px-2 py-1 font-mono text-[12px] text-link-foreground`,children:String(e+1).padStart(2,`0`)})}),(0,Q.jsx)(`div`,{className:`min-w-0 flex-1 break-words text-sm font-medium [overflow-wrap:anywhere]`,children:t}),i?(0,Q.jsx)(`span`,{"data-slot":`wb-step-badge`,className:r(`shrink-0 rounded-full border px-2 py-px font-mono text-[11px]`,i===`unknown`&&`border-danger/35 text-danger`),children:i}):null,a?(0,Q.jsxs)(E,{children:[(0,Q.jsx)(ue,{asChild:!0,children:(0,Q.jsx)(n,{"data-slot":`wb-step-actions`,variant:`ghost`,size:`icon`,className:`size-[26px]`,"aria-label":`Step ${e+1} actions: ${t}`,children:(0,Q.jsx)(re,{"aria-hidden":`true`,className:`size-4`})})}),(0,Q.jsx)(T,{align:`end`,children:(0,Q.jsxs)(w,{"data-slot":`wb-step-remove`,"aria-label":`Remove step ${e+1}: ${t}`,onSelect:a,children:[(0,Q.jsx)(x,{"aria-hidden":`true`}),` Remove step`]})})]}):null]})}function tt({index:e,onMoveUp:t,onMoveDown:r}){return(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 @min-[900px]:hidden`,children:[(0,Q.jsxs)(n,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} up`,disabled:!t,onClick:t,children:[(0,Q.jsx)(ie,{"aria-hidden":`true`,className:`size-4`}),`Move up`]}),(0,Q.jsxs)(n,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} down`,disabled:!r,onClick:r,children:[(0,Q.jsx)(b,{"aria-hidden":`true`,className:`size-4`}),`Move down`]})]})}function nt({step:e,index:t,skills:n,onRemove:i,gripProps:a,onMoveUp:o,onMoveDown:s,overlay:c=!1}){let l=n.find(t=>t.name===e.skill),u=qe(e),d=Ze(e,l),f=Qe(e,l);return(0,Q.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:r(`rounded-lg border border-border bg-background p-4`,c&&`shadow-md`),children:[(0,Q.jsx)(et,{index:t,title:u,badge:f,onRemove:i,gripProps:a}),d?(0,Q.jsx)(`div`,{"data-slot":`wb-step-summary`,className:`mt-3 break-words text-xs leading-relaxed text-muted-foreground`,children:d}):null,(0,Q.jsx)(`p`,{"data-slot":`wb-step-kind`,className:`mt-3 text-[12px] text-link-foreground`,children:$e(e)}),c?null:(0,Q.jsx)(tt,{index:t,onMoveUp:o,onMoveDown:s})]})}function rt({skills:e,query:t,error:n,inFlow:r,onAdd:i}){if(n!==null)return(0,Q.jsxs)(`p`,{"data-slot":`wb-palette`,className:`mt-2.5 text-xs text-danger`,children:[`Could not load skills: `,n]});let a=xe(e,t);return(0,Q.jsx)(`div`,{"data-slot":`wb-palette`,className:`mt-2.5 flex flex-col gap-1`,children:a.length>0?a.map(e=>(0,Q.jsx)(it,{skill:e,inFlow:r.has(e.name),onAdd:i},e.path)):(0,Q.jsx)(`p`,{className:`py-1 text-xs leading-relaxed text-soft-foreground`,children:e.length>0?`No skills match.`:(0,Q.jsx)(Te,{})})})}function it({skill:e,inFlow:t,onAdd:n}){let{attributes:i,listeners:a,setNodeRef:o,isDragging:s}=H({id:`palette:${e.name}`,data:{type:`palette`,skill:e.name}});return(0,Q.jsxs)(`div`,{ref:o,"data-slot":`wb-skill`,"data-skill":e.name,"data-in-flow":t||void 0,title:e.description??``,className:r(`flex min-h-11 cursor-grab items-center gap-2 rounded-md py-1 transition-colors hover:bg-muted`,s&&`opacity-40`),...i,...a,children:[(0,Q.jsx)(`span`,{className:r(`min-w-0 flex-1 break-words text-xs`,G(e)?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:e.name}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-skill-add`,"aria-label":`Add ${e.name} to the flow`,title:`Add to the flow`,onClick:()=>n(e.name),className:`inline-flex size-11 shrink-0 items-center justify-center rounded-md text-link-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,Q.jsx)(_,{"aria-hidden":`true`,className:`size-3.5`})})]})}function at({yaml:e}){let[t,n]=(0,q.useState)(!1),r=(0,q.useRef)(null);return(0,q.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-copy`,title:`Copy the YAML`,onClick:()=>{navigator.clipboard?.writeText(e).catch(()=>{}),n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1600)},className:`flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(se,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(C,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}var ot=`wb-canvas`;function $(){return{name:`my-workflow`,description:``,steps:[]}}function st(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function ct(){let{name:e}=t();return(0,Q.jsx)(lt,{routeName:e},e??``)}function lt({routeName:e}){let t=ee(),r=te(),i=p(),a=s(),[h,g]=(0,q.useState)(null),[re,ie]=(0,q.useState)(``),[oe,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(``),[ce,x]=(0,q.useState)(null),[le,S]=(0,q.useState)(!1),[C,w]=(0,q.useState)(``),[ue,T]=(0,q.useState)(``),[E,D]=(0,q.useState)(!1),[O,k]=(0,q.useState)(``),[A,j]=(0,q.useState)(!1),[M,N]=(0,q.useState)(!1),[P,F]=(0,q.useState)(null),[de,I]=(0,q.useState)(null),L=(0,q.useRef)(null),R=(0,q.useRef)(null),z=t.data?.workflows??[],B=r.data??[],V=Se(B,i.data?.skillUsage),he=xe(V,y,i.data?.skillUsage);(0,q.useEffect)(()=>{if(h!==null||t.data===void 0)return;let n=t.data.workflows,r=(e?n.find(t=>t.name===e):void 0)??n.find(e=>e.source===`file`);g(r?st(r):$())},[h,t.data,e]);let H=e=>g(t=>t===null?t:{...t,steps:e}),U=f({mutationFn:e=>d(e),onSuccess:e=>{g({name:e.name,description:e.description??``,steps:e.steps}),S(!1),w(``),T(``),m(`Imported "${e.name}" — review, then Save.`)},onError:e=>T(e.message)}),W=f({mutationFn:e=>l(e),onSuccess:e=>{g(t=>{let n=t??$(),{name:r,steps:i}=Le(e,n.name);return{...n,name:r,steps:i}}),D(!1),k(``),m(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??h?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>m(e instanceof Error?e.message:String(e),{tone:`danger`})}),G=f({mutationFn:e=>c({...Re(h?.name??``,h?.description??``,h?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:e=>{j(!1),m(`Saved — ${e.path.split(`/`).pop()??e.path}`),a.invalidateQueries({queryKey:ne.workflows})},onError:e=>{e instanceof u&&e.exists===!0?j(!0):m(e instanceof Error?e.message:String(e),{tone:`danger`})}}),K=f({mutationFn:e=>o(e),onSuccess:(e,t)=>{N(!1),m(`Deleted "${t}".`),g($()),a.invalidateQueries({queryKey:ne.workflows})},onError:e=>{N(!1),m(e instanceof Error?e.message:String(e),{tone:`danger`})}}),Te=fe(me(pe,{activationConstraint:{distance:4}}),me(ge,{coordinateGetter:ye}));if(t.isError)return(0,Q.jsx)(`div`,{"data-route":`workflows`,className:`@container mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:(0,Q.jsx)(Ce,{icon:(0,Q.jsx)(ae,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(h===null)return(0,Q.jsx)(we,{});let J=h.steps,Y=h.name.trim(),X=z.find(e=>e.name===Y&&e.source===`file`),Ae=Pe(h.name,h.description,J),Z=(e,t=J.length)=>{if(J.length>=8){m(`A workflow holds at most 8 steps.`,{tone:`danger`});return}H(De(J,Ee(e,J),t))};return(0,Q.jsxs)(`div`,{"data-route":`workflows`,className:`@container mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:[(0,Q.jsxs)(`header`,{className:`mb-[22px] flex flex-wrap items-center justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-[25px] font-semibold md:text-[30px]`,children:`Workflows`}),(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground md:text-[13px]`,children:`Portable skill chains. Steps run from top to bottom.`})]}),(0,Q.jsxs)(n,{variant:`primary`,"data-slot":`wb-new`,className:`min-h-11`,onClick:()=>g($()),children:[(0,Q.jsx)(_,{"aria-hidden":`true`,className:`size-4`}),`New workflow`]})]}),(0,Q.jsxs)(_e,{sensors:Te,collisionDetection:ve,onDragStart:e=>{let t=e.active.data.current;F(t??null)},onDragOver:e=>{I(e.over?String(e.over.id):null)},onDragEnd:e=>{F(null),I(null);let{active:t,over:n}=e;if(n===null)return;let r=t.data.current;if(r?.type===`palette`){let e=n.id===ot?J.length:J.findIndex(e=>e.id===n.id);Z(r.skill,e===-1?J.length:e);return}if(n.id===t.id)return;let i=J.findIndex(e=>e.id===t.id),a=J.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&H(Oe(J,i,a))},onDragCancel:()=>{F(null),I(null)},children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-[22px] pb-[calc(32px+env(safe-area-inset-bottom))]`,children:[(0,Q.jsx)(ze,{workflows:z,draft:h,trimmedName:Y,nameRef:L,onDraft:g,onLoadWorkflow:e=>g(st(e))}),(0,Q.jsx)(Be,{savedFile:X,autoOpen:E,onImportToggle:()=>{T(``),D(!1),S(e=>!e)},onExport:()=>{let e=new Blob([Ae],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${Fe(h.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},onAutoToggle:()=>{S(!1),D(e=>!e)},onDeleteRequest:()=>N(!0)}),E?(0,Q.jsx)(Ve,{text:O,onTextChange:k,pending:W.isPending,onRun:()=>{let e=O.trim();e===``||W.isPending||W.mutate(e)},onCancel:()=>{D(!1),k(``)}}):null,(0,Q.jsx)(He,{open:le,onOpenChange:S,text:C,onTextChange:w,error:ue,pending:U.isPending,onRun:()=>{let e=C.trim();e!==``&&U.mutate(e)},onCancel:()=>{S(!1),w(``),T(``)}}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] @min-[700px]:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,Q.jsxs)(`section`,{"data-slot":`wb-main`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Steps · `,J.length,` of `,8,(0,Q.jsx)(`span`,{"data-slot":`wb-count`,className:`sr-only`,children:Ie(J)})]}),(0,Q.jsx)(ut,{steps:J,skills:B,dragging:P!==null,overId:de,activeStepId:P?.type===`step`?P.step.id:null,onRemove:e=>H(ke(J,e)),onMove:(e,t)=>H(Oe(J,e,t))}),(0,Q.jsxs)(n,{ref:R,variant:`outline`,className:`mt-4 min-h-11`,onClick:()=>{x(null),b(``),v(!0)},children:[(0,Q.jsx)(_,{"aria-hidden":`true`,className:`size-4`}),`Add step`]}),(0,Q.jsxs)(`p`,{className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`hidden @min-[900px]:inline`,children:`Drag to reorder. The agent follows this sequence from top to bottom.`}),(0,Q.jsx)(`span`,{className:`@min-[900px]:hidden`,children:`Use Move up / Move down to reorder without dragging.`})]}),(0,Q.jsxs)(`footer`,{className:`mt-4 flex flex-wrap items-center justify-between gap-4 border-t border-border pt-4`,children:[(0,Q.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Review the name and steps, then save to a workflow file.`}),(0,Q.jsxs)(n,{type:`button`,variant:`primary`,size:`sm`,className:`min-h-11 max-sm:w-full`,"data-slot":`wb-save`,disabled:G.isPending,onClick:()=>{if(Y===``){L.current?.focus();return}if(J.length===0){m(`Add at least one step first.`,{tone:`danger`});return}G.mutate(!1)},children:[(0,Q.jsx)(se,{"aria-hidden":`true`,className:`size-3`}),`Save`]})]})]}),(0,Q.jsx)(Ue,{paletteSkills:V,query:re,onQueryChange:ie,error:r.isError?r.error.message:null,inFlow:new Set(J.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>Z(e),yaml:Ae})]})]}),(0,Q.jsx)(be,{children:(0,Q.jsx)(We,{dragging:P,steps:J,skills:B})})]}),(0,Q.jsx)(Ge,{open:oe,onOpenChange:v,query:y,onQueryChange:b,matches:he,skillsCount:B.length,error:r.isError?r.error.message:null,selectedSkill:ce,onSelectSkill:x,stepsCount:J.length,onCloseAutoFocus:e=>{e.preventDefault(),R.current?.focus()},onCancel:()=>v(!1),onAdd:e=>{Z(e),v(!1)}}),(0,Q.jsx)(Ke,{trimmedName:Y,savedFile:X,overwriteOpen:A,onOverwriteDismiss:()=>j(!1),deleteOpen:M,onDeleteDismiss:()=>N(!1),onOverwrite:()=>G.mutate(!0),onDelete:()=>K.mutate(Y)})]})}function ut({steps:e,skills:t,dragging:n,overId:i,activeStepId:a,onRemove:o,onMove:s}){let{setNodeRef:c,isOver:l}=V({id:ot}),u=n&&i===ot;return(0,Q.jsx)(`div`,{ref:c,"data-slot":`wb-steps`,"data-dragging":n||void 0,className:r(`relative mt-4 rounded-lg transition-colors`,l?`border-accent-strong/60 bg-accent-strong/5`:`border-muted-foreground/25`),children:e.length===0?(0,Q.jsx)(`p`,{className:r(`rounded-md px-3 py-10 text-center text-[13px] transition-colors`,l?`text-link-foreground`:`text-muted-foreground`),children:`Drop a skill here — or Import a workflow.yaml`}):(0,Q.jsxs)(U,{items:e.map(e=>e.id),strategy:B,children:[(0,Q.jsx)(`ol`,{className:`flex flex-col gap-4`,children:e.map((r,c)=>(0,Q.jsx)(dt,{step:r,index:c,skills:t,dragging:n,insertBefore:n&&i===r.id&&a!==r.id,onRemove:()=>o(c),onMoveUp:c>0?()=>s(c,c-1):void 0,onMoveDown:c<e.length-1?()=>s(c,c+1):void 0},r.id))}),(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:r(`absolute inset-x-0 mt-1 h-[3px] rounded-full transition-colors`,u?`bg-accent-strong`:`bg-transparent`)})]})})}function dt({step:e,index:t,skills:n,insertBefore:i,onRemove:a,onMoveUp:o,onMoveDown:s}){let{attributes:c,listeners:l,setNodeRef:u,transform:d,transition:f,isDragging:p}=he({id:e.id,data:{type:`step`,step:e}});return(0,Q.jsxs)(`li`,{ref:u,style:{transform:W.Transform.toString(d),transition:f},className:r(`relative`,p&&`opacity-40`),children:[i?(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-drop-line`,className:`pointer-events-none absolute -top-[7px] right-0 left-0 h-[3px] rounded-full bg-accent-strong`}):null,(0,Q.jsx)(nt,{step:e,index:t,skills:n,onRemove:a,onMoveUp:o,onMoveDown:s,gripProps:{...c,...l}})]})}export{ct as WorkflowsRoute};
|
|
7
|
+
- commit-style`,value:r,onChange:e=>i(e.target.value),className:`mt-4 min-h-[124px] bg-background p-4 font-mono text-[13px] leading-relaxed`}),(0,Q.jsx)(`p`,{className:`mt-4 text-[13px] text-muted-foreground`,children:`Paste a portable workflow definition. Imported steps appear in execution order.`}),a===``?null:(0,Q.jsx)(`p`,{"data-slot":`wb-import-error`,role:`alert`,className:`mt-2 text-xs text-danger`,children:a}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsx)(n,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-import-run`,disabled:o,onClick:s,children:`Import`}),(0,Q.jsx)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:c,children:`Cancel`})]})]})})}function Ue({paletteSkills:e,query:t,onQueryChange:n,error:r,inFlow:i,onAdd:a,yaml:o}){return(0,Q.jsxs)(`aside`,{"data-slot":`wb-aside`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:`Available skills`}),(0,Q.jsxs)(`div`,{className:`sw-search relative mt-4`,children:[(0,Q.jsx)(g,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(z,{"data-slot":`wb-filter`,placeholder:`Find a skill…`,"aria-label":`Filter skills`,value:t,onChange:e=>n(e.target.value),className:`h-11 pl-9 text-xs`})]}),(0,Q.jsx)(rt,{skills:e,query:t,error:r,inFlow:i,onAdd:a}),(0,Q.jsx)(`h3`,{className:`mt-5 text-sm font-semibold`,children:`workflow.yaml`}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-muted-foreground`,children:`Export the workflow to use this chain in another project.`}),(0,Q.jsxs)(`details`,{className:`mt-4 min-w-0`,children:[(0,Q.jsxs)(`summary`,{"data-slot":`wb-yaml-toggle`,className:`inline-flex min-h-[44px] cursor-pointer items-center rounded-lg border border-border px-3 text-xs font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(h,{"aria-hidden":`true`,className:`mr-2 size-4`}),`View YAML`]}),(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsx)(at,{yaml:o})}),(0,Q.jsx)(`pre`,{"data-slot":`wb-yaml`,className:`mt-2 max-h-96 overflow-auto rounded-lg border border-border bg-background p-3 font-mono text-[11px] leading-relaxed whitespace-pre text-muted-foreground`,children:o})]})]})}function We({dragging:e,steps:t,skills:n}){return e?.type===`palette`?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[13px] font-medium shadow-md`,children:[(0,Q.jsx)(ce,{"aria-hidden":`true`,className:`size-3.5 text-link-foreground`}),e.skill]}):e?.type===`step`?(0,Q.jsx)(nt,{step:e.step,index:t.findIndex(t=>t.id===e.step.id),skills:n,overlay:!0}):null}function Ge({open:e,onOpenChange:t,query:r,onQueryChange:i,matches:a,skillsCount:o,error:s,selectedSkill:c,onSelectSkill:l,stepsCount:u,onCloseAutoFocus:d,onCancel:f,onAdd:p}){return(0,Q.jsx)(R,{open:e,onOpenChange:t,children:(0,Q.jsxs)(I,{"data-slot":`wb-add-dialog`,onCloseAutoFocus:d,className:`max-h-[85dvh] overflow-y-auto sm:max-w-[660px] [&_button]:min-h-11`,children:[(0,Q.jsxs)(de,{children:[(0,Q.jsx)(L,{className:`text-xl font-normal`,children:`Add step`}),(0,Q.jsx)(F,{className:`sr-only`,children:`Choose a skill to append to this workflow.`})]}),(0,Q.jsx)(z,{"aria-label":`Filter skills`,placeholder:`Filter skills…`,value:r,onChange:e=>i(e.target.value)}),s===null?(0,Q.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Available skills`,className:`grid max-h-80 gap-2 overflow-y-auto`,children:[a.map(e=>(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg py-2 has-[:checked]:bg-accent-strong/10 has-[:focus-visible]:outline-2`,children:[(0,Q.jsx)(`input`,{type:`radio`,name:`workflow-add-skill`,className:`sr-only`,value:e.name,checked:c===e.name,onChange:()=>l(e.name)}),(0,Q.jsxs)(`span`,{className:`min-w-0 break-words text-sm`,children:[(0,Q.jsx)(`span`,{className:`block`,children:e.name}),(0,Q.jsx)(`span`,{className:`mt-2 block text-xs text-muted-foreground`,children:e.description})]})]},e.name)),a.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o===0?`No skills available in this project.`:`No matching skills.`}):null]}):(0,Q.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not load skills: `,s]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Q.jsx)(n,{variant:`outline`,onClick:f,children:`Cancel`}),(0,Q.jsx)(n,{variant:`primary`,disabled:!c||u>=8,onClick:()=>{c&&p(c)},children:`Add selected skill`})]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Append the selected skill, then reorder it in the existing canvas.`}),u>=8?(0,Q.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[`A workflow can contain up to `,8,` steps. Remove a step before adding another.`]}):null]})})}function Ke({trimmedName:e,savedFile:t,overwriteOpen:n,onOverwriteDismiss:r,deleteOpen:i,onDeleteDismiss:a,onOverwrite:o,onDelete:s}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(P,{open:n,onOpenChange:e=>!e&&r(),children:(0,Q.jsxs)(k,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(N,{children:[(0,Q.jsxs)(O,{children:[`“`,e,`” already exists`]}),(0,Q.jsx)(D,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(M,{children:`Keep the file`}),(0,Q.jsx)(A,{"data-slot":`wb-overwrite-confirm`,className:`bg-danger text-danger-foreground`,onClick:o,children:`Overwrite`})]})]})}),(0,Q.jsx)(P,{open:i,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(k,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(N,{children:[(0,Q.jsxs)(O,{children:[`Delete workflow “`,e,`”?`]}),(0,Q.jsxs)(D,{children:[`Removes `,t?.path?.split(`/`).pop()??`the saved file`,` from`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/workflows/`}),`. There is no undo.`]})]}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(M,{children:`Keep the file`}),(0,Q.jsx)(A,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:s,children:`Delete workflow`})]})]})})]})}function qe(e){return e.name??e.skill??e.id}function Je(e){return e.prompt?.trim()===`{{task}}`?void 0:e.prompt?.trim()}function Ye(e){let t=e.onFail?` — on fail retry from "${e.onFail.retry}" (×${e.onFail.max??2})`:``;return`$ ${e.command}${t}`}function Xe(e,t){return Je(e)||t?.description||`Not in this repo or the team skills — the step runs on its plain prompt.`}function Ze(e,t){return e.command?Ye(e):e.skill?Xe(e,t):e.prompt??``}function Qe(e,t){return e.skill&&!t?`unknown`:null}function $e(e){return e.command?`Command step${e.onFail?` · Retry ×${e.onFail.max??2}`:``}`:e.skill?`Skill step`:`Prompt step`}function et({index:e,title:t,badge:i,onRemove:a,gripProps:o}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-step-heading`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-step-grip`,"aria-label":`Reorder step ${e+1}: ${t}`,className:`inline-flex size-[26px] shrink-0 cursor-grab items-center justify-center rounded-md text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,...o,children:(0,Q.jsx)(`span`,{className:`rounded bg-accent-strong/10 px-2 py-1 font-mono text-[12px] text-link-foreground`,children:String(e+1).padStart(2,`0`)})}),(0,Q.jsx)(`div`,{className:`min-w-0 flex-1 break-words text-sm font-medium [overflow-wrap:anywhere]`,children:t}),i?(0,Q.jsx)(`span`,{"data-slot":`wb-step-badge`,className:r(`shrink-0 rounded-full border px-2 py-px font-mono text-[11px]`,i===`unknown`&&`border-danger/35 text-danger`),children:i}):null,a?(0,Q.jsxs)(E,{children:[(0,Q.jsx)(ue,{asChild:!0,children:(0,Q.jsx)(n,{"data-slot":`wb-step-actions`,variant:`ghost`,size:`icon`,className:`size-[26px]`,"aria-label":`Step ${e+1} actions: ${t}`,children:(0,Q.jsx)(re,{"aria-hidden":`true`,className:`size-4`})})}),(0,Q.jsx)(T,{align:`end`,children:(0,Q.jsxs)(w,{"data-slot":`wb-step-remove`,"aria-label":`Remove step ${e+1}: ${t}`,onSelect:a,children:[(0,Q.jsx)(x,{"aria-hidden":`true`}),` Remove step`]})})]}):null]})}function tt({index:e,onMoveUp:t,onMoveDown:r}){return(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 @min-[900px]:hidden`,children:[(0,Q.jsxs)(n,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} up`,disabled:!t,onClick:t,children:[(0,Q.jsx)(ie,{"aria-hidden":`true`,className:`size-4`}),`Move up`]}),(0,Q.jsxs)(n,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} down`,disabled:!r,onClick:r,children:[(0,Q.jsx)(b,{"aria-hidden":`true`,className:`size-4`}),`Move down`]})]})}function nt({step:e,index:t,skills:n,onRemove:i,gripProps:a,onMoveUp:o,onMoveDown:s,overlay:c=!1}){let l=n.find(t=>t.name===e.skill),u=qe(e),d=Ze(e,l),f=Qe(e,l);return(0,Q.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:r(`rounded-lg border border-border bg-background p-4`,c&&`shadow-md`),children:[(0,Q.jsx)(et,{index:t,title:u,badge:f,onRemove:i,gripProps:a}),d?(0,Q.jsx)(`div`,{"data-slot":`wb-step-summary`,className:`mt-3 break-words text-xs leading-relaxed text-muted-foreground`,children:d}):null,(0,Q.jsx)(`p`,{"data-slot":`wb-step-kind`,className:`mt-3 text-[12px] text-link-foreground`,children:$e(e)}),c?null:(0,Q.jsx)(tt,{index:t,onMoveUp:o,onMoveDown:s})]})}function rt({skills:e,query:t,error:n,inFlow:r,onAdd:i}){if(n!==null)return(0,Q.jsxs)(`p`,{"data-slot":`wb-palette`,className:`mt-2.5 text-xs text-danger`,children:[`Could not load skills: `,n]});let a=xe(e,t);return(0,Q.jsx)(`div`,{"data-slot":`wb-palette`,className:`mt-2.5 flex flex-col gap-1`,children:a.length>0?a.map(e=>(0,Q.jsx)(it,{skill:e,inFlow:r.has(e.name),onAdd:i},e.path)):(0,Q.jsx)(`p`,{className:`py-1 text-xs leading-relaxed text-soft-foreground`,children:e.length>0?`No skills match.`:(0,Q.jsx)(Te,{})})})}function it({skill:e,inFlow:t,onAdd:n}){let{attributes:i,listeners:a,setNodeRef:o,isDragging:s}=H({id:`palette:${e.name}`,data:{type:`palette`,skill:e.name}});return(0,Q.jsxs)(`div`,{ref:o,"data-slot":`wb-skill`,"data-skill":e.name,"data-in-flow":t||void 0,title:e.description??``,className:r(`flex min-h-11 cursor-grab items-center gap-2 rounded-md py-1 transition-colors hover:bg-muted`,s&&`opacity-40`),...i,...a,children:[(0,Q.jsx)(`span`,{className:r(`min-w-0 flex-1 break-words text-xs`,G(e)?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:e.name}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-skill-add`,"aria-label":`Add ${e.name} to the flow`,title:`Add to the flow`,onClick:()=>n(e.name),className:`inline-flex size-11 shrink-0 items-center justify-center rounded-md text-link-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,Q.jsx)(_,{"aria-hidden":`true`,className:`size-3.5`})})]})}function at({yaml:e}){let[t,n]=(0,q.useState)(!1),r=(0,q.useRef)(null);return(0,q.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-copy`,title:`Copy the YAML`,onClick:()=>{navigator.clipboard?.writeText(e).catch(()=>{}),n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1600)},className:`flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(se,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(C,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}var ot=`wb-canvas`;function $(){return{name:`my-workflow`,description:``,steps:[]}}function st(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function ct(){let{name:e}=t();return(0,Q.jsx)(lt,{routeName:e},e??``)}function lt({routeName:e}){let t=ee(),r=te(),i=p(),a=c(),[h,g]=(0,q.useState)(null),[re,ie]=(0,q.useState)(``),[oe,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(``),[ce,x]=(0,q.useState)(null),[le,S]=(0,q.useState)(!1),[C,w]=(0,q.useState)(``),[ue,T]=(0,q.useState)(``),[E,D]=(0,q.useState)(!1),[O,k]=(0,q.useState)(``),[A,j]=(0,q.useState)(!1),[M,N]=(0,q.useState)(!1),[P,F]=(0,q.useState)(null),[de,I]=(0,q.useState)(null),L=(0,q.useRef)(null),R=(0,q.useRef)(null),z=t.data?.workflows??[],B=r.data??[],V=Se(B,i.data?.skillUsage),he=xe(V,y,i.data?.skillUsage);(0,q.useEffect)(()=>{if(h!==null||t.data===void 0)return;let n=t.data.workflows,r=(e?n.find(t=>t.name===e):void 0)??n.find(e=>e.source===`file`);g(r?st(r):$())},[h,t.data,e]);let H=e=>g(t=>t===null?t:{...t,steps:e}),U=f({mutationFn:e=>d(e),onSuccess:e=>{g({name:e.name,description:e.description??``,steps:e.steps}),S(!1),w(``),T(``),m(`Imported "${e.name}" — review, then Save.`)},onError:e=>T(e.message)}),W=f({mutationFn:e=>l(e),onSuccess:e=>{g(t=>{let n=t??$(),{name:r,steps:i}=Le(e,n.name);return{...n,name:r,steps:i}}),D(!1),k(``),m(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??h?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>m(e instanceof Error?e.message:String(e),{tone:`danger`})}),G=f({mutationFn:e=>s({...Re(h?.name??``,h?.description??``,h?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:e=>{j(!1),m(`Saved — ${e.path.split(`/`).pop()??e.path}`),a.invalidateQueries({queryKey:ne.workflows})},onError:e=>{e instanceof u&&e.exists===!0?j(!0):m(e instanceof Error?e.message:String(e),{tone:`danger`})}}),K=f({mutationFn:e=>o(e),onSuccess:(e,t)=>{N(!1),m(`Deleted "${t}".`),g($()),a.invalidateQueries({queryKey:ne.workflows})},onError:e=>{N(!1),m(e instanceof Error?e.message:String(e),{tone:`danger`})}}),Te=fe(me(pe,{activationConstraint:{distance:4}}),me(ge,{coordinateGetter:ye}));if(t.isError)return(0,Q.jsx)(`div`,{"data-route":`workflows`,className:`@container mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:(0,Q.jsx)(Ce,{icon:(0,Q.jsx)(ae,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(h===null)return(0,Q.jsx)(we,{});let J=h.steps,Y=h.name.trim(),X=z.find(e=>e.name===Y&&e.source===`file`),Ae=Pe(h.name,h.description,J),Z=(e,t=J.length)=>{if(J.length>=8){m(`A workflow holds at most 8 steps.`,{tone:`danger`});return}H(De(J,Ee(e,J),t))};return(0,Q.jsxs)(`div`,{"data-route":`workflows`,className:`@container mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:[(0,Q.jsxs)(`header`,{className:`mb-[22px] flex flex-wrap items-center justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-[25px] font-semibold md:text-[30px]`,children:`Workflows`}),(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground md:text-[13px]`,children:`Portable skill chains. Steps run from top to bottom.`})]}),(0,Q.jsxs)(n,{variant:`primary`,"data-slot":`wb-new`,className:`min-h-11`,onClick:()=>g($()),children:[(0,Q.jsx)(_,{"aria-hidden":`true`,className:`size-4`}),`New workflow`]})]}),(0,Q.jsxs)(_e,{sensors:Te,collisionDetection:ve,onDragStart:e=>{let t=e.active.data.current;F(t??null)},onDragOver:e=>{I(e.over?String(e.over.id):null)},onDragEnd:e=>{F(null),I(null);let{active:t,over:n}=e;if(n===null)return;let r=t.data.current;if(r?.type===`palette`){let e=n.id===ot?J.length:J.findIndex(e=>e.id===n.id);Z(r.skill,e===-1?J.length:e);return}if(n.id===t.id)return;let i=J.findIndex(e=>e.id===t.id),a=J.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&H(Oe(J,i,a))},onDragCancel:()=>{F(null),I(null)},children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-[22px] pb-[calc(32px+env(safe-area-inset-bottom))]`,children:[(0,Q.jsx)(ze,{workflows:z,draft:h,trimmedName:Y,nameRef:L,onDraft:g,onLoadWorkflow:e=>g(st(e))}),(0,Q.jsx)(Be,{savedFile:X,autoOpen:E,onImportToggle:()=>{T(``),D(!1),S(e=>!e)},onExport:()=>{let e=new Blob([Ae],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${Fe(h.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},onAutoToggle:()=>{S(!1),D(e=>!e)},onDeleteRequest:()=>N(!0)}),E?(0,Q.jsx)(Ve,{text:O,onTextChange:k,pending:W.isPending,onRun:()=>{let e=O.trim();e===``||W.isPending||W.mutate(e)},onCancel:()=>{D(!1),k(``)}}):null,(0,Q.jsx)(He,{open:le,onOpenChange:S,text:C,onTextChange:w,error:ue,pending:U.isPending,onRun:()=>{let e=C.trim();e!==``&&U.mutate(e)},onCancel:()=>{S(!1),w(``),T(``)}}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] @min-[700px]:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,Q.jsxs)(`section`,{"data-slot":`wb-main`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Steps · `,J.length,` of `,8,(0,Q.jsx)(`span`,{"data-slot":`wb-count`,className:`sr-only`,children:Ie(J)})]}),(0,Q.jsx)(ut,{steps:J,skills:B,dragging:P!==null,overId:de,activeStepId:P?.type===`step`?P.step.id:null,onRemove:e=>H(ke(J,e)),onMove:(e,t)=>H(Oe(J,e,t))}),(0,Q.jsxs)(n,{ref:R,variant:`outline`,className:`mt-4 min-h-11`,onClick:()=>{x(null),b(``),v(!0)},children:[(0,Q.jsx)(_,{"aria-hidden":`true`,className:`size-4`}),`Add step`]}),(0,Q.jsxs)(`p`,{className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`hidden @min-[900px]:inline`,children:`Drag to reorder. The agent follows this sequence from top to bottom.`}),(0,Q.jsx)(`span`,{className:`@min-[900px]:hidden`,children:`Use Move up / Move down to reorder without dragging.`})]}),(0,Q.jsxs)(`footer`,{className:`mt-4 flex flex-wrap items-center justify-between gap-4 border-t border-border pt-4`,children:[(0,Q.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Review the name and steps, then save to a workflow file.`}),(0,Q.jsxs)(n,{type:`button`,variant:`primary`,size:`sm`,className:`min-h-11 max-sm:w-full`,"data-slot":`wb-save`,disabled:G.isPending,onClick:()=>{if(Y===``){L.current?.focus();return}if(J.length===0){m(`Add at least one step first.`,{tone:`danger`});return}G.mutate(!1)},children:[(0,Q.jsx)(se,{"aria-hidden":`true`,className:`size-3`}),`Save`]})]})]}),(0,Q.jsx)(Ue,{paletteSkills:V,query:re,onQueryChange:ie,error:r.isError?r.error.message:null,inFlow:new Set(J.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>Z(e),yaml:Ae})]})]}),(0,Q.jsx)(be,{children:(0,Q.jsx)(We,{dragging:P,steps:J,skills:B})})]}),(0,Q.jsx)(Ge,{open:oe,onOpenChange:v,query:y,onQueryChange:b,matches:he,skillsCount:B.length,error:r.isError?r.error.message:null,selectedSkill:ce,onSelectSkill:x,stepsCount:J.length,onCloseAutoFocus:e=>{e.preventDefault(),R.current?.focus()},onCancel:()=>v(!1),onAdd:e=>{Z(e),v(!1)}}),(0,Q.jsx)(Ke,{trimmedName:Y,savedFile:X,overwriteOpen:A,onOverwriteDismiss:()=>j(!1),deleteOpen:M,onDeleteDismiss:()=>N(!1),onOverwrite:()=>G.mutate(!0),onDelete:()=>K.mutate(Y)})]})}function ut({steps:e,skills:t,dragging:n,overId:i,activeStepId:a,onRemove:o,onMove:s}){let{setNodeRef:c,isOver:l}=V({id:ot}),u=n&&i===ot;return(0,Q.jsx)(`div`,{ref:c,"data-slot":`wb-steps`,"data-dragging":n||void 0,className:r(`relative mt-4 rounded-lg transition-colors`,l?`border-accent-strong/60 bg-accent-strong/5`:`border-muted-foreground/25`),children:e.length===0?(0,Q.jsx)(`p`,{className:r(`rounded-md px-3 py-10 text-center text-[13px] transition-colors`,l?`text-link-foreground`:`text-muted-foreground`),children:`Drop a skill here — or Import a workflow.yaml`}):(0,Q.jsxs)(U,{items:e.map(e=>e.id),strategy:B,children:[(0,Q.jsx)(`ol`,{className:`flex flex-col gap-4`,children:e.map((r,c)=>(0,Q.jsx)(dt,{step:r,index:c,skills:t,dragging:n,insertBefore:n&&i===r.id&&a!==r.id,onRemove:()=>o(c),onMoveUp:c>0?()=>s(c,c-1):void 0,onMoveDown:c<e.length-1?()=>s(c,c+1):void 0},r.id))}),(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:r(`absolute inset-x-0 mt-1 h-[3px] rounded-full transition-colors`,u?`bg-accent-strong`:`bg-transparent`)})]})})}function dt({step:e,index:t,skills:n,insertBefore:i,onRemove:a,onMoveUp:o,onMoveDown:s}){let{attributes:c,listeners:l,setNodeRef:u,transform:d,transition:f,isDragging:p}=he({id:e.id,data:{type:`step`,step:e}});return(0,Q.jsxs)(`li`,{ref:u,style:{transform:W.Transform.toString(d),transition:f},className:r(`relative`,p&&`opacity-40`),children:[i?(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-drop-line`,className:`pointer-events-none absolute -top-[7px] right-0 left-0 h-[3px] rounded-full bg-accent-strong`}):null,(0,Q.jsx)(nt,{step:e,index:t,skills:n,onRemove:a,onMoveUp:o,onMoveDown:s,gripProps:{...c,...l}})]})}export{ct as WorkflowsRoute};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{Dr as n,Ur as r}from"./project-scope-context-BSdXJd3m.js";import{i}from"./live-protocol-aMLJJ0MQ.js";var a=e(t(),1);function o(e,t){if(!i(e.path))throw Error(`unsupported shared read`);let r=new URL(e.path,`http://cezar.invalid`);return r.searchParams.sort(),n({kind:`read`,path:`${r.pathname}${r.search}`,intervalMs:e.intervalMs},{value:t})}function s(e,t,n,i){let s=r(),c=JSON.stringify(t),l=(0,a.useMemo)(()=>JSON.parse(c),[c]);(0,a.useEffect)(()=>{if(!e||n===!1)return;let t=!0,r=o({path:e,intervalMs:n},(e,n)=>{n||s.cancelQueries({queryKey:l,exact:!0}).then(()=>{t&&s.setQueryData(l,i?i(e,s):e)})});return()=>{t=!1,r()}},[s,e,l,n,i])}function c(e,t){return n({kind:`topic`,topic:e},{value:t})}export{o as n,s as r,c as t};
|
package/web/dist/index.html
CHANGED
|
@@ -47,44 +47,44 @@
|
|
|
47
47
|
}
|
|
48
48
|
})()
|
|
49
49
|
</script>
|
|
50
|
-
<script type="module" crossorigin src="/assets/index-
|
|
50
|
+
<script type="module" crossorigin src="/assets/index-De7eAZ5M.js"></script>
|
|
51
51
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
|
|
52
52
|
<link rel="modulepreload" crossorigin href="/assets/react-runtime-CCIEwYL0.js">
|
|
53
53
|
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-BT31bpU6.js">
|
|
54
54
|
<link rel="modulepreload" crossorigin href="/assets/button-Czdi8NqC.js">
|
|
55
55
|
<link rel="modulepreload" crossorigin href="/assets/live-refetch-CZb2VOyu.js">
|
|
56
|
-
<link rel="modulepreload" crossorigin href="/assets/live-protocol-
|
|
57
|
-
<link rel="modulepreload" crossorigin href="/assets/project-scope-context-
|
|
58
|
-
<link rel="modulepreload" crossorigin href="/assets/useInfiniteQuery-
|
|
59
|
-
<link rel="modulepreload" crossorigin href="/assets/useQuery-
|
|
60
|
-
<link rel="modulepreload" crossorigin href="/assets/ws-
|
|
56
|
+
<link rel="modulepreload" crossorigin href="/assets/live-protocol-aMLJJ0MQ.js">
|
|
57
|
+
<link rel="modulepreload" crossorigin href="/assets/project-scope-context-BSdXJd3m.js">
|
|
58
|
+
<link rel="modulepreload" crossorigin href="/assets/useInfiniteQuery-C22IahAC.js">
|
|
59
|
+
<link rel="modulepreload" crossorigin href="/assets/useQuery-C0rYnV6X.js">
|
|
60
|
+
<link rel="modulepreload" crossorigin href="/assets/ws-D9whCwIN.js">
|
|
61
61
|
<link rel="modulepreload" crossorigin href="/assets/toaster-2NK3PogQ.js">
|
|
62
|
-
<link rel="modulepreload" crossorigin href="/assets/queries-
|
|
63
|
-
<link rel="modulepreload" crossorigin href="/assets/cez-idle-
|
|
62
|
+
<link rel="modulepreload" crossorigin href="/assets/queries-BXo4WfX0.js">
|
|
63
|
+
<link rel="modulepreload" crossorigin href="/assets/cez-idle-TVRD1sce.js">
|
|
64
64
|
<link rel="modulepreload" crossorigin href="/assets/createLucideIcon-BHp8sXmF.js">
|
|
65
65
|
<link rel="modulepreload" crossorigin href="/assets/es2015-DnySZnV4.js">
|
|
66
66
|
<link rel="modulepreload" crossorigin href="/assets/design-icons-DmYTv2r1.js">
|
|
67
67
|
<link rel="modulepreload" crossorigin href="/assets/dist-D4TujV9O.js">
|
|
68
68
|
<link rel="modulepreload" crossorigin href="/assets/dropdown-menu-BN2BI4R1.js">
|
|
69
|
-
<link rel="modulepreload" crossorigin href="/assets/attention-
|
|
70
|
-
<link rel="modulepreload" crossorigin href="/assets/use-desktop-
|
|
69
|
+
<link rel="modulepreload" crossorigin href="/assets/attention-BeBfNOUJ.js">
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/use-desktop-BYMCVpyw.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="/assets/nav-row-styles-DoZBu-jT.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="/assets/eye-B8okNWXU.js">
|
|
73
73
|
<link rel="modulepreload" crossorigin href="/assets/format-BNCkW110.js">
|
|
74
74
|
<link rel="modulepreload" crossorigin href="/assets/play-CmVAj_fu.js">
|
|
75
|
-
<link rel="modulepreload" crossorigin href="/assets/reference-chip-
|
|
75
|
+
<link rel="modulepreload" crossorigin href="/assets/reference-chip-pp1FgLpK.js">
|
|
76
76
|
<link rel="modulepreload" crossorigin href="/assets/alert-dialog-CPBKJTj_.js">
|
|
77
77
|
<link rel="modulepreload" crossorigin href="/assets/dialog-CkU56ywj.js">
|
|
78
78
|
<link rel="modulepreload" crossorigin href="/assets/input-Dilvz-YI.js">
|
|
79
|
-
<link rel="modulepreload" crossorigin href="/assets/project-router-
|
|
80
|
-
<link rel="modulepreload" crossorigin href="/assets/agent-accounts-
|
|
79
|
+
<link rel="modulepreload" crossorigin href="/assets/project-router-ir-bfT5a.js">
|
|
80
|
+
<link rel="modulepreload" crossorigin href="/assets/agent-accounts-BrFoXDpa.js">
|
|
81
81
|
<link rel="modulepreload" crossorigin href="/assets/skills-DFBiAuJG.js">
|
|
82
|
-
<link rel="modulepreload" crossorigin href="/assets/prompt-template-menu-
|
|
82
|
+
<link rel="modulepreload" crossorigin href="/assets/prompt-template-menu-BJlLqUsI.js">
|
|
83
83
|
<link rel="modulepreload" crossorigin href="/assets/sortable.esm-zp_qkYGV.js">
|
|
84
84
|
<link rel="modulepreload" crossorigin href="/assets/centered-state-8l6wvu0C.js">
|
|
85
85
|
<link rel="modulepreload" crossorigin href="/assets/lib-BxQXEXDF.js">
|
|
86
86
|
<link rel="modulepreload" crossorigin href="/assets/chunk-BO2N2NFS-DE6qKn3r.js">
|
|
87
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
87
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Dps0ABGp.css">
|
|
88
88
|
</head>
|
|
89
89
|
<body>
|
|
90
90
|
<div id="root"></div>
|
package/web/dist/live-worker.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as e,o as t,u as n}from"./assets/live-protocol-
|
|
1
|
+
import{c as e,o as t,u as n}from"./assets/live-protocol-aMLJJ0MQ.js";import{n as r}from"./assets/cez-idle-TVRD1sce.js";var i=new Set;function a(e,t){t?i.add(e):i.delete(e),r(`ws`,i.size>0)}var o=`/api/v1/ws`,s=3e3,c=1e3,l=7e4,u=0,d=1;function f(e){let t=new Map,n=new Set,r={},i=!1,f=null,p,m,h,g=()=>{a(r,i||n.size>0)},_=()=>{clearTimeout(h),h=setTimeout(()=>{h=void 0,f?.close()},l)},v=()=>e??`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${o}`,y=e=>{f?.readyState===d&&f.send(JSON.stringify(e))},b=()=>{let e=globalThis.WebSocket;if(typeof e!=`function`||f&&(f.readyState===u||f.readyState===d))return;let r=new e(v());f=r,i=!0,g(),r.addEventListener(`open`,()=>{if(r===f){i=!1;for(let e of t.keys())n.add(e);g(),_();for(let e of t.keys())y({type:`subscribe`,topic:e})}}),r.addEventListener(`message`,e=>{if(r!==f)return;_();let i;try{i=JSON.parse(e.data)}catch{return}if(typeof i!=`object`||!i)return;let{type:a,topic:o,data:s}=i;if(a!==`event`||typeof o!=`string`)return;let c=t.get(o);if(c){n.delete(o),g();for(let e of[...c])e(s)}}),r.addEventListener(`close`,()=>{r===f&&(f=null,i=!1,g(),clearTimeout(h),h=void 0,t.size>0&&p===void 0&&(p=setTimeout(()=>{p=void 0,t.size>0&&b()},s)))}),r.addEventListener(`error`,()=>void 0)};return{subscribe(e,r){let i=t.get(e);i||(i=new Set,t.set(e,i));let a=i.size===0;i.add(r),a&&n.add(e),g(),clearTimeout(m),m=void 0,f?a&&y({type:`subscribe`,topic:e}):(clearTimeout(p),p=void 0,b());let o=!0;return()=>{o&&(o=!1,i.delete(r),!(i.size>0)&&(t.delete(e),n.delete(e),g(),y({type:`unsubscribe`,topic:e}),t.size===0&&m===void 0&&(m=setTimeout(()=>{m=void 0,!(t.size>0)&&(clearTimeout(p),p=void 0,clearTimeout(h),h=void 0,f?.close(),f=null)},c))))}}}}function p(n){let r=new Set,i={workspace:{signature:``,lastFrame:0},runs:{signature:``,lastFrame:0}},a=new Map,o=new Map,s=new Map,c,l=!1,u=!1,d=!1,f=!1,p,m,h=0,g=(e,t,n=h)=>{m===void 0||e.readyGeneration===m||(e.readyGeneration=m,C(e,t,{event:`ready`,data:JSON.stringify({generation:m,seq:n}),id:``}))},_=e=>{`event`in e&&e.event===`ping`&&(d=!0);let t=h,n=v(e);for(let{doc:r,entry:i}of y(`workspace`))n===void 0?g(r,i,t):r.readyGeneration=n,C(r,i,e)},v=e=>{if(!(!(`data`in e)||![`ready`,`run-summary`,`run-deleted`].includes(e.event)))try{let t=JSON.parse(e.data);if(e.event===`ready`&&typeof t.generation==`string`&&typeof t.seq==`number`)return m=t.generation,h=t.seq,t.generation;typeof t.seq==`number`&&(h=Math.max(h,t.seq))}catch{}},y=e=>[...r].flatMap(t=>[...t.entries.values()].filter(t=>!t.paused&&(!e||t.demand.kind===e)).map(e=>({doc:t,entry:e}))),b=(e,t)=>{try{e.port.postMessage(t)}catch{P(e)}},x=e=>{if(!(!(e instanceof Error)||e.message!==`authentication required`))for(let t of[...r])b(t,{type:`unavailable`,version:3,epoch:t.epoch,reason:e.message}),P(t)},S=(e,t,n)=>{t.paused=!0,t.unacked=[],t.bytes=0,b(e,{type:`reset`,version:3,epoch:e.epoch,id:t.id,reason:n}),N()},C=(e,t,n)=>{if(`type`in n&&n.type===`event`){if(n.event.seq<=t.sent)return;let r=new TextEncoder().encode(JSON.stringify(n)).length;if(t.bytes+r>1048576){S(e,t,`subscriber fell behind — reload history`);return}t.sent=n.event.seq,t.bytes+=r,t.unacked.push({seq:t.sent,bytes:r})}b(e,{type:`frame`,version:3,epoch:e.epoch,id:t.id,frame:n})},w=e=>{let t=p!==void 0&&e!==p;if(p=e,t)for(let{doc:e,entry:t}of y())S(e,t,`server restarted`)},T=e=>{clearTimeout(e.retry),e.retry=void 0;let t=e.controller;e.controller=void 0,t?.abort()},E=t=>{let r=i[t];if(!r.signature||u)return;T(r);let a=new AbortController;if(r.controller=a,r.lastFrame=Date.now(),t===`workspace`){if(d||f)for(let{doc:e,entry:t}of y(`workspace`))C(e,t,{event:`reconnect`,data:``,id:``});d=!1,f=!1}let o=new Map;if(t===`runs`)for(let{entry:t}of y(`run`)){let n=t.demand,r=o.get(e(n));if(!r||t.ack<r.afterSeq){let{kind:r,...i}=n;o.set(e(i),{...i,afterSeq:t.ack})}}n.stream(t,[...o.values()],n=>{if(!(r.controller!==a||a.signal.aborted)){if(r.lastFrame=Date.now(),`type`in n&&n.type===`ready`&&w(n.generation),`data`in n&&n.event===`ready`)try{let e=JSON.parse(n.data);typeof e.generation==`string`&&w(e.generation)}catch{}if(t===`workspace`){_(n);return}for(let{doc:t,entry:r}of y(`run`))r.demand.kind===`run`&&`type`in n&&`runId`in n&&e(n)!==e(r.demand)||C(t,r,n)}},a.signal).catch(x).finally(()=>{if(!(r.controller!==a||a.signal.aborted||u)){if(r.controller=void 0,t===`workspace`&&d){for(let{doc:e,entry:t}of y(`workspace`))C(e,t,{event:`disconnect`,data:``,id:``});d=!1,f=!0}r.retry=setTimeout(()=>{r.retry=void 0,E(t)},1500)}})},D=(e,t)=>{clearTimeout(t.timer),t.timer=void 0;let r=++t.revision;t.controller.abort(),t.controller=new AbortController,clearTimeout(t.deadline);let i=t.controller,a=t.deadline=setTimeout(()=>i.abort(),1e4);n.read(e,t.controller.signal).then(n=>{if(!(s.get(e)!==t||r!==t.revision))for(let{doc:t,entry:r}of y(`read`))r.demand.kind===`read`&&r.demand.path===e&&b(t,{type:`value`,version:3,epoch:t.epoch,id:r.id,...n})}).catch(x).finally(()=>{clearTimeout(a),s.get(e)===t&&r===t.revision&&(t.deadline=void 0,t.nextAt=Date.now()+t.interval,t.timer=setTimeout(()=>D(e,t),t.interval))})},O=()=>{let t=new Set;for(let{doc:n,entry:r}of y(`run`)){let i=e(r.demand);!t.has(i)&&t.size>=32?S(n,r,`shared task capacity reached`):t.add(i)}},k=e=>{let t={workspace:e.length?`workspace`:``,runs:y(`run`).map(({doc:e,entry:t})=>`${e.id}:${e.epoch}:${t.id}`).sort().join(`|`)};for(let e of[`workspace`,`runs`]){let n=i[e];n.signature!==t[e]&&(n.signature=t[e],T(n),n.signature?E(e):e===`workspace`&&(d=!1))}},A=()=>{let e=new Set(y(`topic`).map(({entry:e})=>e.demand.topic));for(let[t,n]of a)e.has(t)||(n(),a.delete(t),o.delete(t));for(let t of e)a.has(t)||a.set(t,n.topic(t,e=>{o.set(t,e);for(let{doc:n,entry:r}of y(`topic`))r.demand.kind===`topic`&&r.demand.topic===t&&b(n,{type:`value`,version:3,epoch:n.epoch,id:r.id,value:e})}))},j=()=>{let e=new Map;for(let{entry:t}of y(`read`))t.demand.kind===`read`&&e.set(t.demand.path,Math.min(e.get(t.demand.path)??1/0,t.demand.intervalMs));for(let[t,n]of s)e.has(t)||(s.delete(t),clearTimeout(n.timer),clearTimeout(n.deadline),n.controller.abort());for(let[t,n]of e){let e=s.get(t);if(e){n<e.interval&&e.timer&&(clearTimeout(e.timer),e.nextAt=Math.min(e.nextAt,Date.now()+n),e.timer=setTimeout(()=>D(t,e),Math.max(0,e.nextAt-Date.now()))),e.interval=n;continue}let r={controller:new AbortController,revision:0,interval:n,nextAt:Date.now()+n};s.set(t,r),r.timer=setTimeout(()=>D(t,r),n)}},M=()=>{if(l=!1,u)return;let e=y(`workspace`);O(),k(e),A(),j(),r.size||(clearInterval(c),c=void 0)};function N(){!l&&!u&&(l=!0,queueMicrotask(M))}function P(e){r.delete(e),e.port.onmessage=null,e.port.onmessageerror=null;try{e.port.close()}catch{}N()}let F=(e,t)=>(t&&(e.readyGeneration=void 0),![...e.entries.values()].some(e=>e.demand.kind===`workspace`)),I=(e,t)=>{let n=[...t.values()].find(e=>e.demand.kind===`workspace`&&!e.paused);n&&g(e,n)},L=e=>{let t=e.demand.kind===`run`?e.demand.afterSeq:0;return{...e,sent:t,ack:t,unacked:[],bytes:0,paused:!1}},R=(e,t,n)=>{let r=t.demand;r.kind===`topic`&&o.has(r.topic)&&b(e,{type:`value`,version:3,epoch:e.epoch,id:t.id,value:o.get(r.topic)}),r.kind===`workspace`&&n&&(e.readyGeneration=void 0),r.kind===`workspace`&&d&&(g(e,t),C(e,t,{event:`ping`,data:``,id:``}))};return{attach:e=>{if(u||r.size>=128)return e.close(),()=>{};let n={port:e,id:``,epoch:-1,seenAt:Date.now(),entries:new Map};return r.add(n),e.onmessageerror=()=>P(n),e.onmessage=({data:e})=>{let r=t.safeParse(e);if(!r.success){P(n);return}let i=r.data;if(!(n.id&&i.documentId!==n.id||i.epoch<n.epoch)){if(i.type===`sync`){n.id=i.documentId;let e=n.epoch!==i.epoch;n.epoch=i.epoch,n.seenAt=Date.now();let t=new Map,r=F(n,i.workspaceReady);for(let a of i.entries){let i=e?void 0:n.entries.get(a.id),o=i??L(a);t.set(a.id,o),i||R(n,o,r)}if(I(n,t),n.entries=t,!t.size){P(n);return}b(n,{type:`alive`,version:3,epoch:n.epoch}),N()}else if(i.epoch===n.epoch){let e=n.entries.get(i.id);if(!e)return;if(i.type===`ack`&&i.seq<=e.sent&&i.seq>e.ack&&(e.ack=i.seq,e.unacked=e.unacked.filter(t=>t.seq>i.seq?!0:(e.bytes-=t.bytes,!1))),i.type===`refresh`&&e.demand.kind===`read`){let t=s.get(e.demand.path);t&&D(e.demand.path,t)}}}},e.start(),b(n,{type:`hello`,version:3}),c??=setInterval(()=>{for(let e of[...r])Date.now()-e.seenAt>=15e3&&P(e);for(let e of[`workspace`,`runs`])i[e].controller&&Date.now()-i[e].lastFrame>=4e4&&E(e)},1e3),()=>P(n)},dispose(){u=!0;for(let e of[...r])P(e);for(let e of Object.values(i))T(e);for(let e of a.values())e();a.clear(),o.clear();for(let e of s.values())clearTimeout(e.timer),clearTimeout(e.deadline),e.controller.abort();s.clear(),clearInterval(c),c=void 0}}}async function m(e,t,n){if(!e.ok||!e.body)throw Error(`live stream HTTP ${e.status}`);let r=e.body.getReader(),i=new TextDecoder,a=new TextEncoder,o=``,s=[],c=``,l=``,u=0,d=()=>{r.cancel().catch(()=>{})};n.addEventListener(`abort`,d,{once:!0});let f=(e,n)=>{if(u+=a.encode(e).length+n,u>1048576)throw Error(`SSE frame exceeds limit`);if(e===``){s.length&&t({event:c||`message`,data:s.join(`
|
|
2
2
|
`),id:l}),s=[],c=``,u=0;return}if(e.startsWith(`:`))return;let r=e.indexOf(`:`),i=r<0?e:e.slice(0,r),o=r<0?``:e.slice(r+1).replace(/^ /,``);i===`data`?s.push(o):i===`event`?c=o:i===`id`&&!o.includes(`\0`)&&(l=o)};try{for(;;){n.throwIfAborted();let{done:e,value:t}=await r.read();if(e)break;o+=i.decode(t,{stream:!0});let s=0;for(let e=0;e<o.length;e++){let t=o[e];if(t!==`
|
|
3
3
|
`&&t!==`\r`)continue;if(t===`\r`&&e===o.length-1)break;let n=t===`\r`&&o[e+1]===`
|
|
4
4
|
`;f(o.slice(s,e),n?2:1),n&&e++,s=e+1}if(o=o.slice(s),a.encode(o).length+u>1048576)throw Error(`SSE frame exceeds limit`)}n.throwIfAborted()}finally{n.removeEventListener(`abort`,d),await r.cancel().catch(()=>{}),r.releaseLock()}}var h=f(),g=p({async stream(e,t,r,i){let a=await fetch(e===`workspace`?`/api/v1/workspace/events?runs=summary`:`/api/v1/workspace/run-events`,{credentials:`include`,signal:i,...e===`runs`?{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({runs:t})}:{}});if(a.status===401||a.status===403)throw Error(`authentication required`);await m(a,t=>{if(e===`workspace`){r(t);return}if(t.event===`live`)try{let e=n.safeParse(JSON.parse(t.data));e.success&&r(e.data)}catch{}},i)},topic:(e,t)=>h.subscribe(e,t),async read(e,t){let n=await fetch(e,{credentials:`include`,signal:t});if(n.status===401||n.status===403)throw Error(`authentication required`);if(!n.ok)throw Error(`HTTP ${n.status}`);return{value:await n.json()}}}),_=globalThis;_.onconnect=e=>{let t=e.ports[0];t&&g.attach(t)};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{L as t,p as n,t as r,u as i}from"./button-Czdi8NqC.js";import{i as a,t as o}from"./react-runtime-CCIEwYL0.js";import{t as s}from"./live-refetch-CZb2VOyu.js";import{An as c,Er as l,Gr as u,In as d,Nr as f,Rt as p,f as m,i as h,or as ee,wn as te,wr as ne,zn as g}from"./project-scope-context-X6-LgbYE.js";import{$ as re,A as ie,Q as ae,V as oe,W as se,Y as _,Z as v,dt as ce,et as y,nt as b,ot as x,q as le,rt as S,st as ue,ut as de}from"./live-protocol-DjH6ZQwI.js";import{t as fe}from"./useQuery-C96hAjNV.js";import{n as pe,t as me}from"./ws-BD6s7UXb.js";import{t as C}from"./createLucideIcon-BHp8sXmF.js";import{n as he,r as ge,t as _e}from"./hourglass-B0lPAJvT.js";import{t as ve}from"./eye-B8okNWXU.js";import{t as ye}from"./message-square-B-MD-8rD.js";import{t as w}from"./project-router-uJ3SkX70.js";import"./attention-DlfFfWoj.js";import{Yt as T,vn as be,vt as xe}from"./index-DYx21hr3.js";var Se=C(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),Ce=C(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),we=C(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),Te=C(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),Ee=C(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),De=C(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Oe=C(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),ke=C(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Ae=C(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),E=e(a(),1),D=o(),O=ce(),k=b().int().nonnegative(),A=x().min(1),je=S({title:x().max(160),toolKind:_([`read`,`edit`,`delete`,`move`,`search`,`execute`,`think`,`fetch`,`task`,`plan`,`other`]),status:_([`pending`,`running`,`completed`,`failed`,`declined`]),startedAt:O,endedAt:O.optional()}).strict(),Me=_([`pass`,`fail`,`pending`,`skipping`,`cancel`]),Ne=S({checks:v(S({name:x().max(100),bucket:Me}).strict()).max(100),counts:S({pass:k,fail:k,pending:k,skipping:k,cancel:k}).strict(),truncated:y(!0).optional()}).strict(),Pe=re(`kind`,[S({kind:y(`human`),since:O,detail:S({question:x().max(500).optional(),reason:_([`question`,`turn-end`,`budget`,`completion`]),queuedMessages:b().int().positive().optional()}).strict()}).strict(),S({kind:y(`usage-limit`),detail:S({resumeAt:x()}).strict()}).strict(),S({kind:y(`workers`),since:O,deadline:O.optional(),detail:S({owed:k,total:k,settled:k,replies:y(!0).optional(),mode:ie.optional(),recipientRunIds:v(A)}).strict()}).strict(),S({kind:y(`peers`),since:O,deadline:O,detail:S({peerRunIds:v(A)}).strict()}).strict(),S({kind:y(`subagents`),since:O,deadline:O,detail:S({running:k}).strict()}).strict(),S({kind:y(`pr`),since:O,deadline:O,detail:S({number:b().int().positive(),target:ee,checks:Ne.shape.checks.optional(),counts:Ne.shape.counts.optional(),truncated:y(!0).optional()}).strict()}).strict(),S({kind:y(`process`),since:O,deadline:O,detail:S({pid:b().int(),note:x().optional()}).strict()}).strict(),S({kind:y(`timer`),since:O,deadline:O,detail:S({wakeAt:O,note:x().optional()}).strict()}).strict()]),Fe={runId:A,title:x(),status:oe,rung:_(d),runner:le.optional(),model:x().optional(),currentStepId:x().optional(),startedAt:x().optional(),wait:Pe.optional(),tool:je.optional(),rate:v(k).length(30),error:x().max(200).optional()},Ie=S({...Fe,revision:k,collected:ae()}).strict(),Le=S({...Fe,workers:v(Ie)}).strict(),Re=S({requestId:de(),relationship:_([`family`,`peer`]),senderRunId:A,recipientRunId:A,text:x().max(500),senderTitle:x().optional(),recipientTitle:x().optional(),createdAt:O,deadline:O.optional()}).strict(),ze=S({requestId:de(),senderRunId:A,recipientRunId:A,status:se.shape.status,observedAt:O}).strict(),Be=S({generatedAt:O,projects:v(S({projectId:x(),name:x(),loaded:ae(),unavailable:S({status:ue([y(404),y(409),y(503)]),error:x()}).strict().optional(),inReview:k,tasks:v(Le),requests:v(Re),closed:v(ze)}).strict())}).strict();S({project:ue([y(`default`),x().regex(c)]).optional()});var Ve=5e3,He=e=>[`workspace`,`activity`,e.kind===`project`?e.projectId:null],Ue=e=>e.kind===`project`?`activity:project:${e.projectId}`:`activity:workspace`,We=e=>e.kind===`project`?`/api/v1/workspace/activity?project=${encodeURIComponent(e.projectId)}`:`/api/v1/workspace/activity`,Ge=`the ${t(`cezar`)} server answered /workspace/activity with an unexpected body`;function Ke(e){let t=Be.safeParse(e);if(!t.success)throw new h(200,Ge);return t.data}async function qe(e,t){let n=e.kind===`project`?{project:e.projectId}:{};return Ke(await te(await m.api.v1.workspace.activity.$get({query:n},p(t)),`/workspace/activity`))}function Je(e,t){return e!==void 0&&Date.parse(t.generatedAt)<Date.parse(e.generatedAt)?e:t}var Ye=new Date(0).toISOString();function Xe(e){return e!==void 0&&e!==Ye&&!Number.isNaN(Date.parse(e))}var Ze=new Set([404,409,503]);function Qe(e,t,n,r){let i=e?.projects.find(e=>e.projectId===t)?.name??t;return{generatedAt:e?.generatedAt??Ye,projects:[{projectId:t,name:i,loaded:!0,unavailable:{status:n,error:r},inReview:0,tasks:[],requests:[],closed:[]}]}}function $e(e,t){return new h(Number(/^HTTP (\d+)$/.exec(t)?.[1]??0),e&&typeof e==`object`&&typeof e.error==`string`?e.error:t)}var et=(e,t)=>e.kind===`project`&&Ze.has(t.status)?t.status:void 0;function tt(e){let t=e.kind===`project`?e.projectId:void 0,n=(0,E.useMemo)(()=>t===void 0?{kind:`workspace`}:{kind:`project`,projectId:t},[t]),r=(0,E.useMemo)(()=>He(n),[n]),i=u(),a=fe({queryKey:r,queryFn:async({signal:e})=>{let t=i.getQueryData(r);try{return Je(t,await qe(n,{signal:e}))}catch(e){let r=e instanceof h?et(n,e):void 0;if(r===void 0||n.kind!==`project`)throw e;return Qe(t,n.projectId,r,e.message)}},staleTime:1/0});return(0,E.useEffect)(()=>{let e=!0,t=t=>{i.cancelQueries({queryKey:r,exact:!0}).then(()=>{if(!e)return;let a=et(n,t);if(a!==void 0&&n.kind===`project`){i.setQueryData(r,e=>Qe(e,n.projectId,a,t.message));return}let o=i.getQueryCache().find({queryKey:r,exact:!0});o?.setState({status:`error`,error:t,errorUpdatedAt:Date.now(),errorUpdateCount:o.state.errorUpdateCount+1,fetchStatus:`idle`})})},a=n=>{let a;try{a=Ke(n)}catch(e){t(e);return}i.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&i.setQueryData(r,e=>Je(e,a))})},o=me(Ue(n),a),c=s(Ve),u,d=()=>{let e=ne()===`finite`&&c!==!1;e&&!u?u=pe({path:We(n),intervalMs:c},(e,n)=>{n===void 0?a(e):t($e(e,n))}):!e&&u&&(u(),u=void 0)};d();let f=l(d);return()=>{e=!1,f(),u?.(),o()}},[i,r,n]),a}var j=e=>String(e).padStart(2,`0`);function M(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t/60)%60,i=t%60;return n>0?`${n}:${j(r)}:${j(i)}`:`${r}:${j(i)}`}function nt(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t} s`;let n=Math.floor(t/60);return n<60?`${n} min`:`${Math.floor(n/60)} h ${j(n%60)} min`}function N(e,t){let n=e===void 0?NaN:Date.parse(e);return Number.isNaN(n)?0:t-n}var rt=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`});function P(e){let t=Date.parse(e);return Number.isNaN(t)?e:rt.format(t)}function it(){return Intl.DateTimeFormat().resolvedOptions().timeZone}var at=new Set([`queued`,`running`,`waiting`]),ot={review:`In review`,failed:`Failed`,done:`Done`,cancelled:`Cancelled`},st={review:`review`,failed:`failed`,done:`done`,cancelled:`cancelled`},F=e=>at.has(e),I=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,L=e=>g(e.rung).tone,ct=(e,t=`Deadline`)=>e?`${t} ${P(e)}`:void 0;function lt(e,t,n){return t.length===1&&t[0]!==void 0?`${e} ${n.titleOf(t[0])}`:`${e} ${I(t.length,`task`)}`}function ut(e,t){let n=e.tool,r={verb:`Doing`,tone:L(e),icon:`tool`},i=n?.endedAt!==void 0&&N(n.endedAt,t.now)>1e4;if(n===void 0)return{...r,main:`Thinking`,...e.startedAt?{since:e.startedAt}:{}};let a=`Last tool ${nt(N(n.endedAt??n.startedAt,t.now))} ago`;return i?{...r,main:`Thinking`,detail:a,since:n.endedAt??n.startedAt}:{...r,main:n.title,mono:!0,detail:a,since:n.startedAt}}function dt(e,t){let n={verb:`Needs you`,tone:L(e),icon:`user`,...t?{since:t.since}:{}};if(t?.detail.reason===`question`)return t.detail.question?{...n,main:t.detail.question,action:`answer`}:{...n,main:`Your turn`,action:`answer`};if(t?.detail.reason===`budget`){let e=t.detail.queuedMessages;return{...n,main:e?`Automatic wakes used up · ${I(e,`message`)} queued`:`Automatic wakes used up`,action:`open`}}return{...n,main:`Your turn`,action:`open`}}function ft(e){return{verb:`Needs you`,tone:L(e),icon:`user`,main:`Permission`,action:`open`}}function pt(e,t,n){let{owed:r,total:i,settled:a,replies:o,mode:s,recipientRunIds:c}=t.detail,l=i>0?a/i:0,u={tone:L(e),since:t.since};if(o){let e=c.length>0?lt(`From`,c,n):`Waiting for replies`;return{...u,verb:`Waiting for reply`,icon:`reply`,main:e,...R(`detail`,ct(t.deadline,`Reply due`))}}let d=c.length>0?`${r} owed · ${a} settled`:s?`${mt[s]} of ${i} · ${a} settled`:`${r} owed`;return{...u,verb:`Waiting for workers`,icon:`workers`,main:d,bar:l,...R(`detail`,ct(t.deadline))}}var mt={one:`One`,any:`Any`,all:`All`};function ht(e){let t=e.detail.counts;if(t===void 0)return`PR ${e.detail.number} checks`;let n=t.pass+t.fail+t.pending;return`PR ${e.detail.number} checks · ${t.pass} of ${n} passed`}var gt=[`fail`,`pending`,`pass`,`skipping`,`cancel`];function _t(e){let{counts:t,checks:n=[],truncated:r}=e.detail;if(!r||t===void 0)return;let i=e=>Math.max(0,t[e]-n.filter(t=>t.bucket===e).length),a=gt.reduce((e,t)=>e+i(t),0),o=gt.find(e=>i(e)>0);return a>0&&o?{count:a,bucket:o}:void 0}var vt=[[`pass`,`passed`],[`fail`,`failed`],[`pending`,`pending`],[`skipping`,`skipped`],[`cancel`,`cancelled`]];function yt(e){let{counts:t,checks:n}=e.detail,r=e=>t?t[e]:(n??[]).filter(t=>t.bucket===e).length,i=vt.filter(([e])=>r(e)>0).map(([e,t])=>`${r(e)} ${t}`),a=_t(e);return a&&i.push(`+${a.count} more not listed`),i.length>0?i.join(`, `):void 0}function bt(e,t){let n={tone:L(e),since:t.since,...R(`detail`,ct(t.deadline))};if(t.detail.target!==`checks`)return{...n,verb:`Waiting for merge`,icon:`merge`,main:`PR ${t.detail.number}`};let r=t.detail.checks?[...t.detail.checks].sort((e,t)=>e.name.localeCompare(t.name)):void 0;return{...n,verb:`Waiting for CI`,icon:`ci`,main:ht(t),...R(`checks`,r),...R(`overflow`,_t(t)),...R(`checkSummary`,yt(t))}}function R(e,t){return t===void 0?{}:{[e]:t}}function xt(e,t,n){let r=L(e);switch(t.kind){case`workers`:return pt(e,t,n);case`peers`:return{verb:`Waiting for a peer`,tone:r,icon:`peer`,since:t.since,main:lt(`For`,t.detail.peerRunIds,n),detail:`Deadline ${P(t.deadline)}`};case`subagents`:return{verb:`Waiting for subagents`,tone:r,icon:`subagents`,since:t.since,main:I(t.detail.running,`native subagent`),detail:`Deadline ${P(t.deadline)}`};case`pr`:return bt(e,t);case`process`:return{verb:`Waiting for command`,tone:r,icon:`command`,since:t.since,main:t.detail.note??`Process ${t.detail.pid}`,detail:`Running ${M(N(t.since,n.now))} · deadline ${P(t.deadline)}`};case`timer`:return{verb:`Waiting for timer`,tone:r,icon:`timer`,since:t.since,main:t.detail.note??`Timer`,detail:`Wakes ${P(t.detail.wakeAt)} · in ${M(-N(t.detail.wakeAt,n.now))}`};case`usage-limit`:return St(e,t.detail.resumeAt,n);case`human`:return}}function St(e,t,n){let r=Date.parse(t),i=Number.isNaN(r)?`Resumes ${t}`:`Resumes ${P(t)} · in ${M(r-n.now)}`;return{verb:`Paused`,tone:L(e),icon:`pause`,main:`Usage limit`,detail:i}}function Ct(e,t){let n=e.wait&&`since`in e.wait?e.wait.since:e.startedAt;return{verb:`Queued`,tone:L(e),icon:`queued`,main:`Waiting for a free slot`,...n?{since:n,detail:`Waiting ${nt(N(n,t.now))}`}:{}}}function z(e,t){return{verb:ot[e.status]??e.status,tone:L(e),icon:st[e.status]??`done`,main:t}}function wt(e,t){return F(e.status)?Tt(e,t):z(e,I(e.workers.filter(e=>F(e.status)).length,`live worker`))}function Tt(e,t){let n=e.wait;switch(e.rung){case`running`:return ut(e,t);case`needs-permission`:return ft(e);case`needs-you`:return dt(e,n?.kind===`human`?n:void 0);case`usage-limit`:return n?.kind===`usage-limit`?St(e,n.detail.resumeAt,t):{verb:`Paused`,tone:L(e),icon:`pause`,main:`Usage limit`};case`queued`:case`waiting-for-capacity`:return Ct(e,t);default:return(n&&xt(e,n,t))??Ct(e,t)}}function Et(e,t,n){if(n!==void 0&&F(e.status))return{verb:`Asks parent`,tone:L(e),main:`“${n}”`,asks:!0};let r=Dt(e,t);return{verb:r.verb,tone:r.tone,main:r.main,...r.mono?{mono:!0}:{}}}function Dt(e,t){switch(e.status){case`done`:return z(e,e.collected?`Collected`:`Ready to collect`);case`review`:return z(e,`Waiting for the parent’s review`);case`failed`:case`cancelled`:return z(e,e.error??ot[e.status]??e.status);default:return Tt({...e,workers:[]},t)}}function Ot(e){if(e.unavailable)return e.unavailable.error;if(!e.loaded)return`Not loaded in this cockpit`}function kt(e){let t=new Map;for(let n of e.tasks){t.set(n.runId,{title:n.title,cardId:n.runId,role:`root`});for(let e of n.workers)t.set(e.runId,{title:e.title,cardId:n.runId,role:`worker`})}return t}function B(e,t,n){return e.get(t)?.title??n??`Unreadable task`}var At=(e,t)=>B(e,t.senderRunId,t.senderTitle),V=(e,t)=>B(e,t.recipientRunId,t.recipientTitle),jt=(e,t)=>`wait:${e}:${t}`;function Mt(e){let t=[];for(let n of e){let e=n.wait;if(!(!F(n.status)||e?.kind!==`peers`))for(let r of new Set(e.detail.peerRunIds))r!==n.runId&&t.push({id:jt(n.runId,r),waiterRunId:n.runId,peerRunId:r,since:e.since,deadline:e.deadline})}return t}function Nt(e,t){let n=new Set;for(let r of t)r.waiterRunId===e&&n.add(r.peerRunId),r.peerRunId===e&&n.add(r.waiterRunId);return n}function Pt(e,t){return t.filter(t=>t.waiterRunId===e)}function Ft(e,t,n,r=[]){let i=[];for(let r of t)r.senderRunId===e&&i.push(`Waiting for a reply from ${V(n,r)}`),r.recipientRunId===e&&i.push(`${At(n,r)} waits for your reply`);for(let t of r)t.waiterRunId===e&&i.push(`Waiting for a message from ${B(n,t.peerRunId)}`),t.peerRunId===e&&i.push(`${B(n,t.waiterRunId)} waits for you to write`);return i}function It(e,t,n){return n.find(n=>n.relationship===`family`&&n.senderRunId===e&&n.recipientRunId===t)}function Lt(e,t){let n=-N(e,t);return n>=1e3?`reply due in ${M(n)}`:`reply overdue`}function Rt(e,t){return t.filter(t=>t.relationship===`peer`&&t.senderRunId===e)}function zt(e,t){return e.relationship===`peer`?{kind:`Request`,relation:`Peer`}:{kind:`Question`,relation:Bt[Vt(e,t)]}}var Bt={worker:`Worker → parent`,parent:`Parent → worker`,unknown:`Family`};function Vt(e,t){let n=t.get(e.senderRunId)?.role;if(n)return n===`worker`?`worker`:`parent`;let r=t.get(e.recipientRunId)?.role;return r?r===`root`?`worker`:`parent`:`unknown`}var Ht=new Set([`needs-you`,`needs-permission`]),Ut=new Set([`queued`,`waiting-for-capacity`]);function Wt(e){if(F(e.status))return Ht.has(e.rung)?`needsYou`:e.rung===`running`?`working`:Ut.has(e.rung)?`queued`:`waiting`}function Gt(e){let t={needsYou:0,working:0,waiting:0,queued:0,activeWorkers:0,openRequests:0,inReview:0};for(let n of e){t.inReview+=n.inReview,t.openRequests+=n.requests.length;for(let e of n.tasks){let n=Wt(e);n&&(t[n]+=1),t.activeWorkers+=e.workers.filter(e=>F(e.status)).length}}return t}function Kt(e,t=()=>!1){let n=0,r=0;for(let i of e.workers)t(i.runId)||((i.status===`done`||i.status===`cancelled`)&&(n+=1),i.status===`failed`&&(n+=1,r+=1));return{finished:n,failed:r}}function qt({finished:e,failed:t}){if(e!==0)return t>0?`✓ ${e} finished · ${t} failed`:`✓ ${e} worker${e===1?``:`s`} finished`}var H={flash:1300,cardEnter:700,cardLeave:500,workerEnter:700,workerHold:3e3,workerFold:500,comet:1100,replied:900,fade:800,bump:500,slide:450,check:800},U={flash:{},entering:{},leaving:{},workerEnter:{},workerHold:{},opening:{},closing:{},waitsClosing:{},comets:{},bumps:{},slides:{},checks:{}},Jt=(e,t)=>`${e}\n${t}`;function Yt(e,t){let n=Jt(t,``);return new Set(Object.keys(e.checks).filter(e=>e.startsWith(n)).map(e=>e.slice(n.length)))}var Xt=class{key;changes=[];timers=[];constructor(e){this.key=e}timed(e,t,n,r){this.changes.push({field:e,id:t,value:{...n,key:this.key}}),this.timers.push({after:r,change:{field:e,id:t,ifKey:this.key}})}later(e,t,n,r){this.timers.push({after:r,change:{field:e,id:t,value:{...n,key:this.key},ifKey:this.key}})}drop(e,t){this.changes.push({field:e,id:t})}},Zt={done:`success`,review:`success`,failed:`danger`,cancelled:`neutral`};function Qt(e,t){let n=Zt[t.status]??`success`;if(t.status===`review`){e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},H.flash);return}e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},H.workerHold+H.workerFold),e.later(`workerHold`,t.runId,{tone:n,phase:`fold`},H.workerHold)}function $t(e,t){e.drop(`closing`,t.requestId),e.timed(`opening`,t.requestId,{},H.fade),e.timed(`comets`,`${t.requestId}:open:${e.key}`,{requestId:t.requestId,reverse:!1,tone:t.relationship},H.comet)}function en(e,t,n,r){let i=n.requestId;if(e.drop(`opening`,i),!r){e.timed(`closing`,i,{projectId:t,request:n,replied:!1,phase:`fade`},H.fade);return}let a=H.comet+H.replied+H.fade;e.timed(`closing`,i,{projectId:t,request:n,replied:!0,phase:`reply`},a),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`replied`},H.comet),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`fade`},H.comet+H.replied),e.timed(`comets`,`${i}:reply:${e.key}`,{requestId:i,reverse:!0,tone:`success`},H.comet)}function tn(e,t){switch(t.kind){case`rung-changed`:return e.timed(`flash`,t.task.runId,{tone:g(t.task.rung).tone},H.flash);case`tool-started`:return e.timed(`slides`,t.runId,{},H.slide);case`worker-started`:return e.timed(`workerEnter`,t.worker.runId,{},H.workerEnter);case`worker-settled`:return Qt(e,t.worker);case`card-entered`:return e.drop(`leaving`,t.task.runId),e.timed(`entering`,t.task.runId,{},H.cardEnter);case`card-left`:return e.timed(`leaving`,t.task.runId,{projectId:t.projectId,task:t.task},H.cardLeave);case`check-passed`:return e.timed(`checks`,Jt(t.runId,t.name),{},H.check);case`request-opened`:return $t(e,t.request);case`request-closed`:return en(e,t.projectId,t.request,t.status===`replied`);case`chip-changed`:return e.timed(`bumps`,t.chip,{},H.bump);case`wait-opened`:return e.drop(`waitsClosing`,t.wait.id),e.timed(`opening`,t.wait.id,{},H.fade);case`wait-closed`:return e.drop(`opening`,t.wait.id),e.timed(`waitsClosing`,t.wait.id,{projectId:t.projectId,wait:t.wait},H.fade)}}function nn(e,t,n){let r=new Xt(t);if(!n)for(let t of e)tn(r,t);return{changes:r.changes,timers:r.timers}}function rn(e,t){let n=e[t.field];if(t.ifKey!==void 0&&n[t.id]?.key!==t.ifKey||t.value===void 0&&!(t.id in n))return e;let r={...n};return t.value===void 0?delete r[t.id]:r[t.id]=t.value,{...e,[t.field]:r}}function an(e,t){return t.reduce(rn,e)}function on(e,t,n){let r=new Set(t.map(e=>e.id));return Object.values(n.waitsClosing).filter(t=>t.projectId===e&&!r.has(t.wait.id)).map(e=>e.wait)}var sn={success:`text-success`,pending:`text-signal-word-amber`,danger:`text-signal-word-red`,accent:`text-accent-text`,info:`text-info`,running:`text-status-running`,neutral:`text-muted-foreground`};function cn({tone:e,className:t,children:n,...r}){return(0,D.jsx)(`span`,{...r,className:i(`bg-card-2`,{"text-success":e===`success`,"text-signal-word-amber":e===`pending`,"text-signal-word-red":e===`danger`,"text-accent-text":e===`accent`,"text-info":e===`info`,"text-status-running":e===`running`,"text-muted-foreground":e===`neutral`},t),children:n})}var ln={success:`border-success`,pending:`border-pending-strong`,danger:`border-danger`,accent:`border-accent-strong`,info:`border-info`,running:`border-status-running`,neutral:`border-soft-foreground`},un={success:`bg-success`,pending:`bg-pending-strong`,danger:`bg-danger`,accent:`bg-accent-strong`,info:`bg-info`,running:`bg-status-running`,neutral:`bg-soft-foreground`},dn={tool:Ae,user:ke,workers:be,reply:ye,peer:Ee,subagents:be,ci:Te,merge:we,command:Oe,timer:Ce,pause:De,queued:_e,review:ve,failed:he,done:ge,cancelled:Se};function fn(e,t){let n=g(e.rung),r=e.rung===`waiting-on-workers`&&(t===`worker`||e.wait?.kind===`peers`);return{tone:n.tone,shape:r?`ring`:n.shape,label:mn(e,t)??n.label}}var pn=(e,t,n)=>`${e} ${t} ${n}${t===1?``:`s`}`;function mn(e,t){let n=e.wait;if(e.rung===`waiting-on-workers`){if(t===`worker`)return`waiting on parent reply`;if(n?.kind===`peers`&&n.detail.peerRunIds.length>0)return pn(`waiting on`,n.detail.peerRunIds.length,`task`);if(n?.kind===`workers`&&n.detail.replies)return`waiting on replies`;if(n?.kind===`workers`&&n.detail.owed>0)return pn(`waiting on`,n.detail.owed,`worker`)}if(e.rung===`waiting-on-subagents`&&n?.kind===`subagents`&&n.detail.running>0)return pn(`waiting for`,n.detail.running,`subagent`)}function hn(e,t){if(F(e.status))return e.rung===`running`&&t===`filled`?`activity-pulse`:t===`filled`?void 0:`activity-breathe`}function W({run:e,role:t}){let{tone:n,shape:r,label:a}=fn(e,t);return(0,D.jsx)(`span`,{"data-activity-anchor":e.runId,className:i(`inline-flex size-[12px] shrink-0 items-center justify-center`,hn(e,r)),children:(0,D.jsx)(T,{tone:n,shape:r,role:`img`,"aria-label":a})})}function gn({runId:e,requests:t,waits:n,index:r,link:i,pathOf:a,className:o,linkClassName:s}){let c=Rt(e,t),l=Pt(e,n);return c.length===0&&l.length===0?null:(0,D.jsxs)(`ul`,{"data-slot":`activity-peer-links`,className:o,children:[c.map(e=>(0,D.jsx)(`li`,{children:(0,D.jsxs)(i,{to:a(e.recipientRunId),className:s,children:[`→ `,V(r,e)]})},e.requestId)),l.map(e=>(0,D.jsx)(`li`,{children:(0,D.jsxs)(i,{to:a(e.peerRunId),className:s,children:[`⋯ waits on `,B(r,e.peerRunId)]})},e.id))]})}var _n={pass:`bg-success`,fail:`bg-danger`,pending:`bg-info`,skipping:`border border-soft-foreground`,cancel:`border border-soft-foreground`},vn=(e,t)=>t?`activity-check-pass`:e===`pending`?`activity-breathe-fast`:void 0;function yn({checks:e,overflow:t,passed:n}){return(0,D.jsxs)(`span`,{"data-slot":`activity-checks`,"aria-hidden":`true`,className:i(`col-start-2 mt-[5px] flex items-center`,e.length>40?`gap-px`:`gap-[3px]`),children:[e.map(e=>(0,D.jsx)(`i`,{"data-bucket":e.bucket,"data-passed":n.has(e.name)?`true`:void 0,title:e.name,className:i(`h-[5px] min-w-px flex-1 rounded-[2px]`,_n[e.bucket],vn(e.bucket,n.has(e.name)))},e.name)),t?(0,D.jsxs)(`span`,{"data-slot":`activity-checks-overflow`,"data-bucket":t.bucket,className:`ml-1 flex shrink-0 items-center gap-1 text-[10px] leading-none text-muted-foreground tabular-nums`,children:[(0,D.jsx)(`i`,{className:i(`h-[5px] w-2 rounded-[2px]`,_n[t.bucket])}),`+`,t.count]}):null]})}function bn({value:e,ink:t}){return(0,D.jsx)(`span`,{"data-slot":`activity-bar`,"aria-hidden":`true`,className:`col-start-2 mt-[5px] block h-1 overflow-hidden rounded-sm bg-border`,children:(0,D.jsx)(`span`,{className:i(`block h-full bg-current`,t),style:{width:`${Math.round(e*100)}%`}})})}var xn=new Set;function Sn({box:e,now:t,dense:n,motion:r={}}){let a=dn[e.icon],o=sn[e.tone];return(0,D.jsxs)(`div`,{"data-slot":`activity-now`,"data-verb":e.verb,className:`relative grid grid-cols-[16px_minmax(0,1fr)] gap-x-2 gap-y-px overflow-hidden rounded-lg bg-card-2 px-2.5 py-2`,children:[r.sweep?(0,D.jsx)(`span`,{"data-slot":`activity-sweep`,"aria-hidden":`true`,className:`activity-sweep`}):null,(0,D.jsx)(a,{"aria-hidden":`true`,className:i(`mt-px size-[15px]`,o)}),(0,D.jsxs)(cn,{tone:e.tone,className:`flex gap-2 text-[11px] font-semibold tracking-[0.04em] uppercase`,children:[(0,D.jsx)(`span`,{"data-slot":`activity-verb`,children:e.verb}),e.since?(0,D.jsx)(`span`,{"data-slot":`activity-age`,className:`ml-auto font-medium tracking-normal text-muted-foreground normal-case tabular-nums`,children:M(N(e.since,t))}):null]}),(0,D.jsx)(`span`,{"data-slot":`activity-main`,className:i(`col-start-2 truncate text-[12.5px] text-foreground`,e.mono&&`font-mono text-[12px]`,r.slideKey!==void 0&&`activity-slide`),children:e.main},r.slideKey??`still`),e.checks?(0,D.jsx)(yn,{checks:e.checks,overflow:e.overflow,passed:r.passed??xn}):null,e.checkSummary?(0,D.jsx)(`span`,{"data-slot":`activity-checks-summary`,className:`sr-only`,children:e.checkSummary}):null,e.bar===void 0?null:(0,D.jsx)(bn,{value:e.bar,ink:o}),e.detail&&!n?(0,D.jsx)(`span`,{"data-slot":`activity-detail`,className:`col-start-2 text-[11.5px] text-muted-foreground tabular-nums`,children:e.detail}):null]})}function Cn({rate:e,className:t}){let n=e.reduce((e,t)=>e+t,0),r=Math.max(4,...e);return(0,D.jsxs)(`svg`,{"data-slot":`activity-heartbeat`,role:`img`,"aria-label":`${n} tool call${n===1?``:`s`} in the last ${e.length} s`,viewBox:`0 0 62 16`,className:i(`block h-4 w-[62px] shrink-0`,t),children:[(0,D.jsx)(`path`,{d:`M0 15.5h62`,className:`stroke-border`}),e.map((e,t)=>{if(e<=0)return null;let n=Math.max(1.5,e/r*14);return(0,D.jsx)(`rect`,{x:t*2.07,y:15-n,width:1.4,height:n,className:`fill-status-running`},t)})]})}var G=e=>`/tasks/${encodeURIComponent(e)}`;function wn(e,t){return[e.runner,e.model,e.currentStepId?`step ${e.currentStepId}`:void 0,e.startedAt?nt(N(e.startedAt,t)):void 0].filter(e=>!!e).join(` · `)}function Tn({texts:e}){return e.length===0?null:(0,D.jsx)(`ul`,{"data-slot":`activity-line-text`,className:`sr-only`,children:e.map((e,t)=>(0,D.jsx)(`li`,{children:e},t))})}function En({worker:e,parentId:t,requests:n,index:r,ctx:a,motion:o}){let s=Et(e,a,It(e.runId,t,n)?.text),c=o.workerHold[e.runId];return(0,D.jsxs)(`li`,{"data-slot":`activity-worker`,"data-run":e.runId,"data-asks":s.asks?`true`:void 0,"data-hold":c?.phase,className:i(`relative grid grid-cols-[14px_minmax(0,1fr)] items-start gap-x-2 rounded-lg py-[5px] before:absolute before:top-[13px] before:-left-3.5 before:w-2.5 before:border-t before:border-border`,s.asks&&`-mx-1.5 bg-message-inbound-bg px-1.5`,e.runId in o.workerEnter&&`activity-row-enter`,c?.phase===`fold`&&`activity-row-fold`),children:[c?(0,D.jsx)(`span`,{"aria-hidden":`true`,className:i(`activity-row-flash`,un[c.tone])},c.key):null,(0,D.jsx)(`span`,{className:`mt-[3px]`,children:(0,D.jsx)(W,{run:e,role:`worker`})}),(0,D.jsxs)(`span`,{className:`min-w-0 truncate text-[12.5px] font-medium`,children:[(0,D.jsx)(w,{to:G(e.runId),className:`relative z-[1] hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:e.title}),(0,D.jsx)(`span`,{className:`ml-1.5 text-[11px] font-normal text-muted-foreground`,children:[e.runner,e.model].filter(Boolean).join(` · `)})]}),(0,D.jsxs)(`span`,{"data-slot":`activity-worker-line`,className:`col-start-2 truncate text-[11.5px] text-muted-foreground tabular-nums`,children:[(0,D.jsx)(`b`,{className:i(`font-semibold`,sn[s.tone]),children:s.verb}),` · `,(0,D.jsx)(`span`,{className:i(s.mono&&`font-mono`),children:s.main})]}),(0,D.jsx)(Tn,{texts:Ft(e.runId,n,r)})]})}function Dn({workers:e}){return(0,D.jsxs)(`div`,{"data-slot":`activity-worker-dots`,className:`mt-2 ml-[18px] flex flex-wrap items-center gap-1 text-[11px] text-muted-foreground`,children:[e.map(e=>(0,D.jsx)(W,{run:e,role:`worker`},e.runId)),(0,D.jsxs)(`span`,{className:`ml-1`,children:[e.length,` worker`,e.length===1?``:`s`]})]})}function On({task:e,requests:t,index:n,ctx:r,dense:i,motion:a}){let o=e=>e in a.workerHold,s=e.workers.filter(e=>F(e.status)||e.status===`review`||o(e.runId)),c=qt(Kt(e,o));return(0,D.jsxs)(D.Fragment,{children:[s.length>0&&i?(0,D.jsx)(Dn,{workers:s}):null,s.length>0&&!i?(0,D.jsx)(`ul`,{"data-slot":`activity-workers`,className:`mt-2 ml-1 border-l border-border pl-3.5`,children:s.map(i=>(0,D.jsx)(En,{worker:i,parentId:e.runId,requests:t,index:n,ctx:r,motion:a},i.runId))}):null,c?(0,D.jsx)(`p`,{"data-slot":`activity-finished`,className:`mt-1.5 ml-[18px] text-[11px] text-muted-foreground`,children:c}):null]})}var kn=`relative z-[1] text-[12px] text-message-peer-accent hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`;function An(e,t){return t?{onPointerEnter:()=>t(`pointer`,e),onPointerLeave:()=>t(`pointer`,void 0),onFocus:()=>t(`focus`,e),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||t(`focus`,void 0)}}:{}}function jn(e,t,n){return n?`activity-card-leave`:e.runId in t.entering?`activity-card-enter`:void 0}function Mn({task:e,motion:t,glow:n}){let r=t.flash[e.runId];return(0,D.jsxs)(D.Fragment,{children:[n?(0,D.jsx)(`span`,{"aria-hidden":`true`,className:`activity-glow`}):null,r?(0,D.jsx)(`span`,{"data-slot":`activity-flash`,"data-tone":r.tone,"aria-hidden":`true`,className:i(`activity-flash`,ln[r.tone])},r.key):null]})}var Nn=[];function Pn({task:e,requests:t,waits:n=Nn,index:a,ctx:o,dense:s,narrow:c,motion:l=U,ghost:u=!1,linked:d=!1,onHover:f}){let p=wt(e,o),m=u?{"data-activity-ghost":e.runId,inert:!0,"aria-hidden":!0}:{"data-activity-card":e.runId},h={sweep:e.rung===`running`&&F(e.status),slideKey:l.slides[e.runId]?.key,passed:Yt(l,e.runId)};return(0,D.jsxs)(`article`,{...m,"data-flip":e.runId,"data-rung":e.rung,"data-action":p.action,"data-linked":d&&!u?`true`:void 0,...u?{}:An(e.runId,f),className:i(`relative min-w-0 rounded-xl border bg-card px-3.5 py-3`,p.action?`border-pending`:`border-border`,d&&!u&&`outline-2 outline-offset-2 outline-message-peer-accent`,jn(e,l,u)),children:[(0,D.jsx)(Mn,{task:e,motion:l,glow:p.action!==void 0&&!u}),(0,D.jsxs)(`header`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(W,{run:e,role:`root`}),(0,D.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[13.5px] font-semibold`,children:(0,D.jsx)(w,{to:G(e.runId),className:`after:absolute after:inset-0 after:rounded-xl after:content-[''] focus-visible:outline-2 focus-visible:outline-ring`,children:e.title})}),(0,D.jsx)(Cn,{rate:e.rate})]}),(0,D.jsx)(`p`,{className:`mt-0.5 mb-2 ml-5 truncate text-[11.5px] text-muted-foreground`,children:wn(e,o.now)}),(0,D.jsx)(Tn,{texts:Ft(e.runId,t,a,n)}),(0,D.jsx)(Sn,{box:p,now:o.now,dense:s,motion:h}),p.action?(0,D.jsx)(`div`,{className:`mt-2 flex gap-1.5`,children:(0,D.jsx)(r,{asChild:!0,size:`sm`,variant:p.action===`answer`?`primary`:`outline`,className:`relative z-[1] max-md:min-h-11`,children:(0,D.jsx)(w,{to:G(e.runId),children:p.action===`answer`?`Answer`:`Open task`})})}):null,c?(0,D.jsx)(gn,{runId:e.runId,requests:t,waits:n,index:a,link:w,pathOf:G,className:`mt-2 flex flex-col gap-1`,linkClassName:kn}):null,(0,D.jsx)(On,{task:e,requests:t,index:a,ctx:o,dense:s,motion:l})]})}function Fn(e){return!Number.isFinite(e)||e<=0?1:Math.max(1,Math.floor((e+96)/396))}function In(e,t){let n=e[0],r=1/0;for(let i of e){let e=i.reduce((e,n)=>e+t(n),0);e<r&&(n=i,r=e)}return n}function Ln(e,t,n,r=()=>1){let i=Math.max(1,Math.floor(n)),a=new Set(t),o=e?.length===i?e.map(e=>e.filter(e=>a.has(e))):Array.from({length:i},()=>[]),s=new Set(o.flat());for(let e of t)s.has(e)||(In(o,r).push(e),s.add(e));return o}function Rn(e,t){return e!==void 0&&e.length===t.length&&e.every((e,n)=>e.length===t[n]?.length&&e.every((e,r)=>e===t[n]?.[r]))}var zn=(e,t)=>({x0:Math.min(e.x,t.x),y0:Math.min(e.y,t.y),x1:Math.max(e.x,t.x),y1:Math.max(e.y,t.y)});function Bn(e,t,n=1){return t.some(t=>t.x+n<e.x1&&e.x0<t.x+t.w-n&&t.y+n<e.y1&&e.y0<t.y+t.h-n)}var Vn=(e,...t)=>e.filter(e=>!t.some(t=>Hn(e,t))),Hn=(e,t)=>e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h,Un=e=>Math.round(e*10)/10,K=e=>`${Un(e.x)} ${Un(e.y)}`;function Wn(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.x===n.x&&e.y===n.y)continue;let r=t[t.length-2];r&&e&&(r.x===e.x&&e.x===n.x||r.y===e.y&&e.y===n.y)&&t.pop(),t.push(n)}return t}function Gn(e,t=8){let n=Wn(e),r=n[0];if(!r)return``;let i=`M${K(r)}`;for(let e=1;e<n.length;e++){let r=n[e],a=n[e-1],o=n[e+1];if(!o){i+=` L ${K(r)}`;continue}let s=Math.min(t,Math.hypot(r.x-a.x,r.y-a.y)/2,Math.hypot(o.x-r.x,o.y-r.y)/2),c=(e,t,n)=>{let r=Math.hypot(t.x-e.x,t.y-e.y)||1;return{x:e.x+(t.x-e.x)/r*n,y:e.y+(t.y-e.y)/r*n}};i+=` L ${K(c(r,a,s))} Q ${K(r)}, ${K(c(r,o,s))}`}return i}function Kn(e,t,n){let r=[];for(let i of[...e].sort((e,n)=>t(e)-t(n))){let e=r[r.length-1];e&&Math.abs(t(i)-e.from)<=2?e.to=Math.max(e.to,n(i)):r.push({from:t(i),to:n(i)})}return r}function qn(e){return{rows:Kn(e,e=>e.y,e=>e.y+e.h).map(({from:e,to:t})=>({top:e,bottom:t})),cols:Kn(e,e=>e.x,e=>e.x+e.w).map(({from:e,to:t})=>({left:e,right:t}))}}var q=(e,t,n)=>Math.max(0,e.findIndex(e=>Math.abs(t(e)-n)<=2)),J=(e,t)=>((e.rows[t]?.bottom??0)+(e.rows[t+1]?.top??(e.rows[t]?.bottom??0)+16))/2;function Jn(e,t,n){let r=e.cols,i=e=>((r[e]?.right??0)+(r[e+1]?.left??0))/2;return t<n?i(t):t>n?i(t-1):t+1<r.length?i(t):t>0?i(t-1):(r[t]?.right??0)+8}function Yn(e,t,n,r=0){let i=qn(n),a=q(i.rows,e=>e.top,e.y),o=q(i.rows,e=>e.top,t.y),s=o>a,c=e.x+e.w/2+r,l=t.x+t.w/2+r,u=(s?J(i,a):J(i,a-1))+r/2,d=(s?J(i,o-1):J(i,o))+r/2,f=Jn(i,q(i.cols,e=>e.left,e.x),q(i.cols,e=>e.left,t.x))+r/2,p={x:c,y:s?e.y+e.h+1:e.y-1},m={x:l,y:s?t.y-3:t.y+t.h+3};return{points:[p,{x:c,y:u},{x:f,y:u},{x:f,y:d},{x:l,y:d},m],label:{x:(c+f)/2,y:u}}}var Xn=15;function Zn(e,t,n){let r=[...n,...e.flatMap(e=>[e.y-Xn,e.y+e.h+Xn])].filter(t=>t>=0&&!e.some(e=>e.y-6<t&&t<e.y+e.h+6));return r.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e,r[0]??t)}function Qn(e,t,n,r,i=0){let a=t.x>e.x?1:-1,o=e.x+a*n/2+i,s=t.x-a*n/2+i,c=Zn(r.filter(e=>e.x+e.w>Math.min(o,s)&&e.x<Math.max(o,s)),(e.y+t.y)/2,[e.y,t.y])+(i===0?0:Math.sign(i)*Math.min(Math.abs(i),Xn-6)),l=c===e.y?{x:s,y:(c+t.y)/2}:{x:o,y:(e.y+c)/2};return{points:[e,{x:o,y:e.y},{x:o,y:c},{x:s,y:c},{x:s,y:t.y},{x:t.x-a*2,y:t.y}],label:l}}function $n(e){let t=new Map;for(let n of e){let e=[n.senderRunId,n.recipientRunId].sort().join(`
|
|
2
|
-
`);t.set(e,[...t.get(e)??[],n.requestId])}let n=new Map;for(let e of t.values())e.forEach((t,r)=>n.set(t,(r-(e.length-1)/2)*12));return n}function er(e,t,n,r=4){let i=[],a=new Map;for(let{id:o,at:s}of e){let e={...s};for(let a=0;a<=i.length;a++){let a=i.find(n=>Math.abs(e.x-n.x)<t.w+r&&Math.abs(e.y-n.y)<t.h+r);if(!a)break;n===`x`?e.x=a.x+t.w+r:e.y=a.y+t.h+r}i.push(e),a.set(o,e)}return a}var tr=e=>Math.round(e*10)/10,Y=e=>`${tr(e.x)} ${tr(e.y)}`;function nr(e,t,n){return t&&t.x>e.x+40?1:t&&t.x<e.x-40?-1:e.x+e.w+96<=n+1?1:-1}function rr(e,t,n,r,i,a){let o=r>0?Math.max(e.x+e.w,t.x+t.w):Math.min(e.x,t.x),s=(70+n)*r;return{d:`M${Y({x:o,y:i})} C ${Y({x:o+s,y:i})}, ${Y({x:o+s,y:a})}, ${Y({x:o+2*r,y:a})}`,label:{x:o+s*.75,y:(i+a)/2}}}function ir(e,t,n=[],r=0,i=1){let a=e.y+22+r,o=t.y+22+r;if(Math.abs(e.x-t.x)<40)return rr(e,t,r,i,a,o);let s=t.x>e.x,c=s?e.x+e.w:e.x,l=s?t.x:t.x+t.w,u=Math.max(40,Math.abs(l-c)*.5)*(s?1:-1),d=l-(s?2:-2);if(Bn(zn({x:c,y:a},{x:l,y:o}),Vn(n,e,t))){let i=Qn({x:c,y:a},{x:l,y:o},96,Vn(n,e,t),r);return{d:Gn(i.points),label:i.label}}return{d:`M${Y({x:c,y:a})} C ${Y({x:c+u,y:a})}, ${Y({x:l-u,y:o})}, ${Y({x:d,y:o})}`,label:{x:(c+l)/2,y:(a+o)/2}}}function ar(e,{other:t,view:n,labelHeight:r}){let i=r/2+4,a=!t||!n?e+44:t.y>e?Math.max(e+44,n.y1-i):Math.min(e-44,n.y0+i);return n?or(a,n.y0+i,n.y1-i):a}var or=(e,t,n)=>Math.max(t,Math.min(n,e));function sr(e,t,n){let r=n.lane??0,i=e.y+22+r,a=n.side>0?e.x+e.w:e.x,o=a+n.side*96/2+r/2,s={x:o,y:ar(i,n)};return{d:Gn(t===`sender`?[{x:a,y:i},{x:o,y:i},s]:[s,{x:o,y:i},{x:a+2*n.side,y:i}]),label:s}}function cr(e,t,n,r=0){let i={x:e.x,y:e.y+e.h/2},a={x:t.x-2,y:t.y+t.h/2},o=n.x-18+r/2;return{d:`M${Y(i)} C ${Y({x:o,y:i.y})}, ${Y({x:o,y:a.y})}, ${Y(a)}`,label:{x:o,y:(i.y+a.y)/2}}}function lr(e,t,n=[],r=0){let i=e.x+e.w/2+r,a=t.x+t.w/2+r;if(t.y>=e.y+e.h||t.y+t.h<=e.y){let o=t.y>e.y,s=o?e.y+e.h+1:e.y-1,c=o?t.y-3:t.y+t.h+3,l=(c-s)/2;if(Bn(zn({x:i,y:s},{x:a,y:c}),Vn(n,e,t))){let i=Yn(e,t,n,r);return{d:Gn(i.points),label:i.label}}return{d:`M${Y({x:i,y:s})} C ${Y({x:i,y:s+l})}, ${Y({x:a,y:c-l})}, ${Y({x:a,y:c})}`,label:{x:(i+a)/2,y:(s+c)/2}}}let o=e.y-1,s=t.y-1,c=Math.min(o,s),l=Math.max(8,Math.min(30,18+Math.abs(a-i)*.05)+r);return{d:`M${Y({x:i,y:o})} C ${Y({x:i,y:c-l})}, ${Y({x:a,y:c-l})}, ${Y({x:a,y:s-3})}`,label:{x:(i+a)/2,y:c-l*.75}}}function ur(e,t){return{x:e.left-t.left,y:e.top-t.top,w:e.width,h:e.height}}function dr(e,t){let n=[];for(let r of e){let e=n.find(e=>Math.abs((e[0]?.at.x??NaN)-r.at.x)<t);e?e.push(r):n.push([r])}return n}function fr(e,t,n,r){let i=e.map(e=>Math.min(r,Math.max(n,e.at.y))),a=i.map((e,t)=>t).sort((e,t)=>i[e]-i[t]);for(let e=1;e<a.length;e++){let n=a[e];i[n]=Math.max(i[n],i[a[e-1]]+t)}for(let e=a.length-1;e>=0;e--){let n=a[e],o=e+1<a.length?i[a[e+1]]-t:r;i[n]=Math.min(i[n],o)}return e.map((e,t)=>({id:e.id,at:{x:e.at.x,y:i[t]}}))}function pr(e,t,n,r=4){let i=n?n.y0+t.h/2:-1/0,a=n?n.y1-t.h/2:1/0,o=new Map;for(let n of dr(e,t.w+r))for(let e of fr(n,t.h+r,i,a))o.set(e.id,e.at);return o}var mr=(e,t)=>e.x<=t.x1&&t.x0<=e.x+e.w&&e.y<=t.y1&&t.y0<=e.y+e.h;function hr(e,t,n){let r=e!==void 0&&mr(e,n),i=t!==void 0&&mr(t,n);return r&&i?`both`:r?`sender`:i?`recipient`:`none`}var gr=e=>/(auto|scroll|hidden|clip)/.test(getComputedStyle(e).overflowY);function _r(e){let t=[];for(let n=e.parentElement;n&&n!==document.body&&n!==document.documentElement;n=n.parentElement)gr(n)&&t.push(n);return t}function vr(e,t){return{x0:Math.max(e.x0,t.x0),y0:Math.max(e.y0,t.y0),x1:Math.min(e.x1,t.x1),y1:Math.min(e.y1,t.y1)}}function yr(e){let t=e.getBoundingClientRect(),n={x0:0,y0:0,x1:window.innerWidth,y1:window.innerHeight};for(let t of _r(e)){let e=t.getBoundingClientRect();e.width>0&&e.height>0&&(n=vr(n,{x0:e.left,y0:e.top,x1:e.right,y1:e.bottom}))}return{x0:n.x0-t.left,y0:n.y0-t.top,x1:n.x1-t.left,y1:n.y1-t.top}}var X={w:88,h:40};function br(e,t){let n=e.getBoundingClientRect(),r=new Map;for(let i of e.querySelectorAll(`[${t}]`)){let e=i.getAttribute(t);e&&r.set(e,ur(i.getBoundingClientRect(),n))}return r}function xr({base:e,from:t,to:n,fromName:r,toName:i},a,o,s){let c=a.get(t),l=a.get(n),u=s.view??{x0:-1/0,y0:-1/0,x1:1/0,y1:1/0},d=(e,t)=>({side:nr(e,t,s.width),labelHeight:X.h,lane:o??0,view:u,...t?{other:t}:{}});switch(hr(c,l,u)){case`both`:return c&&l?{...e,...ir(c,l,[...a.values()],o,nr(c,void 0,s.width))}:void 0;case`sender`:return c?{...e,...sr(c,`sender`,d(c,l)),away:i()}:void 0;case`recipient`:return l?{...e,...sr(l,`recipient`,d(l,c)),away:r()}:void 0;case`none`:return}}var Sr=(e,t)=>({base:{id:e.requestId,kind:`peer`},from:e.senderRunId,to:e.recipientRunId,fromName:()=>At(t,e),toName:()=>V(t,e)}),Cr=(e,t)=>({base:{id:e.id,kind:`wait`},from:e.peerRunId,to:e.waiterRunId,fromName:()=>B(t,e.peerRunId),toName:()=>B(t,e.waiterRunId)}),wr=e=>({requestId:e.id,senderRunId:e.peerRunId,recipientRunId:e.waiterRunId});function Tr(e,t){return[...new Set([...e.values()].map(e=>Math.round(e.x+e.w)))].filter(e=>e+96<=t+1).map(e=>e+96/2)}function Er(e,t){return t.length===0?e:{x:t.reduce((t,n)=>Math.abs(n-e.x)<Math.abs(t-e.x)?n:t),y:e.y}}function Dr(e,t,n,r,i,a){let o=r.get(e.senderRunId)?.cardId??r.get(e.recipientRunId)?.cardId,s=o===void 0?void 0:t.get(o),c=n.get(e.senderRunId),l=n.get(e.recipientRunId);if(!(!s||!c||!l||a&&!mr(s,a)))return{id:e.requestId,kind:`family`,...cr(c,l,s,i)}}function Or(e,t,n,{peers:r,frame:i={width:e.clientWidth},waits:a=[]}){let o=br(e,`data-activity-card`),s=br(e,`data-activity-anchor`),c=$n([...t,...a.map(wr)]),l=[];for(let e of t){let t=c.get(e.requestId),a=e.relationship===`peer`?r?xr(Sr(e,n),o,t,i):void 0:Dr(e,o,s,n,t,i.view);a&&l.push(a)}for(let e of r?a:[]){let t=xr(Cr(e,n),o,c.get(e.id),i);t&&l.push(t)}let u=Tr(o,i.width),d=pr(l.filter(e=>e.kind!==`family`).map(e=>({id:e.id,at:Er(e.label,u)})),X,i.view);return l.map(e=>({...e,label:d.get(e.id)??e.label}))}function kr(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!==void 0&&e.id===r.id&&e.d===r.d&&e.away===r.away&&e.label.x===r.label.x&&e.label.y===r.label.y})}function Ar({frame:e,cancel:t,draw:n}){let r=[],i,a=t=>{i=void 0,r=r.map(e=>({...e,start:e.start??t})).filter(e=>t<e.start+e.duration),n(r,t),r.length>0&&(i=e(a))};return{launch(t){r.some(e=>e.id===t.id)||(r.push(t),i===void 0&&(i=e(a)))},stop(){i!==void 0&&t(i),i=void 0,r=[],n([],0)},running:()=>i!==void 0}}var jr=e=>e<.5?2*e*e:1-(-2*e+2)**2/2;function Mr(e,t,n=0){let r=Math.min(1,Math.max(0,(t-e.start)/e.duration)),i=Math.max(0,jr(r)-n);return e.reverse?1-i:i}var Nr=`http://www.w3.org/2000/svg`,Pr=[0,.03,.06,.09,.12],Fr=[4.5,3.5,3,2.5,2],Ir={peer:`fill-message-peer-accent`,family:`fill-message-inbound-accent`,success:`fill-success`};function Lr(e,t){let n=e.querySelector(`g[data-comet="${CSS.escape(t.id)}"]`);if(n)return n;let r=document.createElementNS(Nr,`g`);r.setAttribute(`data-comet`,t.id);let i=document.createElementNS(Nr,`circle`);return i.setAttribute(`r`,`9`),i.setAttribute(`class`,`${Ir[t.tone]} opacity-35`),r.append(i),Pr.forEach((e,n)=>{let i=document.createElementNS(Nr,`circle`);i.setAttribute(`r`,String(Fr[n])),i.setAttribute(`class`,n===0?`fill-foreground`:Ir[t.tone]),i.setAttribute(`opacity`,String(1-n*.15)),r.append(i)}),e.append(r),r}function Rr(e,t,n){let r=new Set(t.map(e=>e.id));for(let t of e.querySelectorAll(`g[data-comet]`))r.has(t.getAttribute(`data-comet`)??``)||t.remove();let i=e.ownerSVGElement;for(let r of t){let t=i?.querySelector(`path[data-request="${CSS.escape(r.requestId)}"]`);if(!t||typeof t.getTotalLength!=`function`)continue;let a=t.getTotalLength();Lr(e,r).querySelectorAll(`circle`).forEach((e,i)=>{let o=t.getPointAtLength(Mr(r,n,Pr[Math.max(0,i-1)])*a);e.setAttribute(`transform`,`translate(${o.x} ${o.y})`)})}}var zr=e=>typeof requestAnimationFrame==`function`?requestAnimationFrame(e):setTimeout(()=>e(performance.now()),16),Br=e=>typeof cancelAnimationFrame==`function`?cancelAnimationFrame(e):clearTimeout(e);function Vr(e,t,n){let r=E.useRef(null),i=E.useRef(void 0),a=E.useRef(new Set);return E.useEffect(()=>{let e=r.current;if(!e)return;let t=Ar({frame:zr,cancel:Br,draw:(t,n)=>Rr(e,t,n)});return i.current=t,()=>{t.stop(),i.current=void 0}},[]),E.useEffect(()=>{if(n){i.current?.stop();return}for(let t of a.current)t in e||a.current.delete(t);for(let[n,r]of Object.entries(e))a.current.has(n)||!t.has(r.requestId)||(a.current.add(n),i.current?.launch({id:n,requestId:r.requestId,reverse:r.reverse,tone:r.tone,duration:H.comet}))},[e,t,n]),r}function Hr(e,t){let n=new Map;for(let[r,i]of t){let t=e.get(r);if(!t)continue;let a={x:t.x-i.x,y:t.y-i.y};(Math.abs(a.x)>=1||Math.abs(a.y)>=1)&&n.set(r,a)}return n}function Ur(e,t){let n=new Map;for(let r of e.querySelectorAll(`[${t}]`)){let e=r.getBoundingClientRect();n.set(r.getAttribute(t)??``,{el:r,at:{x:e.left,y:e.top}})}return n}var Wr=`activity-layout-settled`;function Gr(e,t,n,r){let i=E.useRef(void 0),a=E.useRef(new Set);E.useLayoutEffect(()=>{let o=e.current;if(!o)return;let s=Ur(o,t),c=new Map([...s].map(([e,t])=>[e,t.at])),l=i.current;if(i.current={key:n,at:c},!(!r||!l||l.key===n))for(let[e,t]of Hr(l.at,c)){let n=s.get(e)?.el.animate?.([{transform:`translate(${t.x}px, ${t.y}px)`},{transform:`none`}],{duration:400,easing:`cubic-bezier(0.2, 0, 0, 1)`});n&&Kr(n,a.current,o)}}),E.useEffect(()=>{if(!r)for(let e of[...a.current])e.cancel()},[r])}function Kr(e,t,n){t.add(e);let r=()=>{t.delete(e)&&t.size===0&&n.dispatchEvent(new Event(Wr))};e.addEventListener(`finish`,r),e.addEventListener(`cancel`,r)}function qr(e,t,n,r,i,a=!1){let[o,s]=E.useState([]);return E.useLayoutEffect(()=>{let i=e.current?.parentElement;if(!i)return;let o=()=>{let e=t(i);s(t=>n(t,e)?t:e)};o();let c=a?Jr(i,o):void 0;i.addEventListener(Wr,o);let l=typeof ResizeObserver>`u`?void 0:new ResizeObserver(o);l?.observe(i);for(let e of i.querySelectorAll(r))l?.observe(e);return()=>{l?.disconnect(),i.removeEventListener(Wr,o),c?.()}},[e,t,n,r,i,a]),o}function Jr(e,t){let n,r=()=>{n===void 0&&(n=requestAnimationFrame(()=>{n=void 0,t()}))},i=[..._r(e),window];for(let e of i)e.addEventListener(`scroll`,r,{passive:!0});return window.addEventListener(`resize`,r),()=>{for(let e of i)e.removeEventListener(`scroll`,r);window.removeEventListener(`resize`,r),n!==void 0&&cancelAnimationFrame(n)}}var Yr=28;function Xr(e){let t=e.replace(/\s+/g,` `).trim();return t.length>Yr?`${t.slice(0,Yr-1).trimEnd()}…`:t}function Zr(e,t){if(e.deadline!==void 0)return Qr(e.createdAt,e.deadline,t)}function Qr(e,t,n){let r=Date.parse(e),i=Date.parse(t);return Number.isNaN(r)||Number.isNaN(i)||i<=r?1:Math.min(1,Math.max(0,(n-r)/(i-r)))}function $r(e,t){if(e===`fade`)return`activity-line-out`;if(e!==`replied`)return i(`activity-march`,t&&`activity-line-in`)}function ei(e,t){return t in e.waitsClosing?`activity-line-out`:i(`activity-drift`,t in e.opening&&`activity-line-in`)}var ti=`pointer-events-none absolute z-[4] -translate-x-1/2 -translate-y-1/2 rounded-lg border bg-background px-1.5 py-[3px] text-[10px] leading-[1.3] text-foreground tabular-nums`;function ni({line:e,wait:t,now:n,motion:r}){return(0,D.jsxs)(`div`,{"data-slot":`activity-line-label`,"data-wait":t.id,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y,width:X.w},className:i(ti,`border-dashed border-message-peer-accent`,t.id in r.waitsClosing&&`activity-line-out`),children:[(0,D.jsxs)(`span`,{className:`flex gap-1 font-semibold`,children:[(0,D.jsx)(`span`,{className:`min-w-0 truncate text-message-peer-accent`,children:`Waiting`}),(0,D.jsx)(`span`,{className:`ml-auto shrink-0`,children:M(N(t.since,n))})]}),e.away?(0,D.jsx)(`span`,{className:`block truncate`,children:e.away}):null,(0,D.jsx)(`span`,{"data-slot":`activity-wait-bar`,className:`mt-[3px] block h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,D.jsx)(`span`,{className:`block h-full bg-message-peer-accent opacity-70`,style:{width:`${Math.round(Qr(t.since,t.deadline,n)*100)}%`}})})]})}function ri({line:e,request:t,now:n,phase:r,replied:a}){let o=Zr(t,n);return(0,D.jsxs)(`div`,{"data-slot":`activity-line-label`,"data-request":t.requestId,"data-phase":r,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y,width:X.w},className:i(ti,a?`border-success`:`border-message-peer-accent`,r===`fade`&&`activity-line-out`),children:[(0,D.jsxs)(`span`,{className:`flex gap-1 font-semibold`,children:[a?(0,D.jsx)(`span`,{className:`text-success`,children:`Replied`}):(0,D.jsx)(`span`,{className:`min-w-0 truncate text-message-peer-accent`,children:`Request`}),(0,D.jsx)(`span`,{className:`ml-auto shrink-0`,children:M(N(t.createdAt,n))})]}),(0,D.jsx)(`span`,{className:`block truncate`,children:e.away??Xr(t.text)}),o===void 0||a?null:(0,D.jsx)(`span`,{className:`mt-[3px] block h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,D.jsx)(`span`,{className:`block h-full bg-message-peer-accent`,style:{width:`${Math.round(o*100)}%`}})})]})}var Z=(e,t)=>e.closing[t]?.phase??`open`;function ii(e,t){let n=e.closing[t];return n!==void 0&&n.replied&&n.phase!==`reply`}var ai=new Set;function oi({line:e,motion:t}){let n=Z(t,e.id);return(0,D.jsx)(`path`,{"data-request":e.id,"data-kind":e.kind,"data-phase":n,d:e.d,fill:`none`,strokeDasharray:n===`replied`?void 0:`6 5`,strokeWidth:e.kind===`peer`?2.2:1.8,markerEnd:`url(#activity-arrow-${e.kind})`,className:i(e.kind===`peer`?`stroke-message-peer-accent`:`stroke-message-inbound-accent`,$r(n,e.id in t.opening))})}function si({line:e,motion:t,active:n}){return(0,D.jsx)(`path`,{"data-wait":e.id,"data-kind":`wait`,"data-active":n?`true`:void 0,d:e.d,fill:`none`,strokeDasharray:`0 8`,strokeLinecap:`round`,strokeWidth:n?3.2:2.4,markerEnd:`url(#activity-ring-wait)`,className:i(`stroke-message-peer-accent`,n?`opacity-100`:`opacity-80`,ei(t,e.id))})}function ci({id:e}){return(0,D.jsx)(`marker`,{id:e,viewBox:`0 0 12 12`,refX:`10`,refY:`6`,markerWidth:`5`,markerHeight:`5`,markerUnits:`strokeWidth`,orient:`auto`,children:(0,D.jsx)(`circle`,{cx:`6`,cy:`6`,r:`4`,strokeWidth:`2.4`,className:`fill-background stroke-message-peer-accent`})})}var li=[];function ui({requests:e,waits:t=li,active:n=ai,index:r,peers:i,layoutKey:a,now:o,motion:s=U,paused:c=!1}){let l=E.useRef(null),u=qr(l,E.useCallback(n=>Or(n,e,r,{peers:i,waits:t,frame:{width:n.clientWidth,view:yr(n)}}),[e,t,r,i]),kr,`[data-activity-card]`,a,!0),d=E.useMemo(()=>new Set(u.map(e=>e.id)),[u]),f=Vr(s.comets,d,c),p=new Map(e.map(e=>[e.requestId,e])),m=new Map(t.map(e=>[e.id,e]));return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`svg`,{ref:l,"data-slot":`activity-lines`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 z-[3] size-full overflow-visible`,children:[(0,D.jsxs)(`defs`,{children:[(0,D.jsx)(`marker`,{id:`activity-arrow-peer`,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto`,children:(0,D.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-peer-accent`})}),(0,D.jsx)(`marker`,{id:`activity-arrow-family`,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,D.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-inbound-accent`})}),(0,D.jsx)(ci,{id:`activity-ring-wait`})]}),u.map(e=>e.kind===`wait`?(0,D.jsx)(si,{line:e,motion:s,active:n.has(e.id)},e.id):(0,D.jsx)(oi,{line:e,motion:s},e.id)),(0,D.jsx)(`g`,{ref:f,"data-slot":`activity-comets`})]}),u.map(e=>{let t=e.kind===`wait`?m.get(e.id):void 0;if(t)return(0,D.jsx)(ni,{line:e,wait:t,now:o,motion:s},e.id);let n=p.get(e.id);return e.kind===`peer`&&n?(0,D.jsx)(ri,{line:e,request:n,now:o,phase:Z(s,e.id),replied:ii(s,e.id)},e.id):null})]})}function di(e,t){let n=new Map;for(let r of[...e?.projects??[],...t.projects])for(let[e,t]of kt(r))n.set(e,t);return n}var fi={"timed-out":`timed out`,cancelled:`was cancelled`,destroyed:`closed: the recipient was destroyed`,failed:`closed: the recipient failed`,"completed-without-reply":`closed without a reply`,"sender-closed":`was closed by its sender`,"human-fallback":`went to a human`,deleted:`closed: the recipient was deleted`};function pi(e,t,n){let r=n(e.senderRunId,e.senderTitle),i=n(e.recipientRunId,e.recipientTitle);return t===`replied`?`${i} replied to ${r}`:`${r}’s request to ${i} ${fi[t??``]??`closed`}`}var mi={done:{tone:`success`,word:`finished`},failed:{tone:`danger`,word:`failed`},cancelled:{tone:`neutral`,word:`was cancelled`},review:{tone:`info`,word:`waits for review`}},hi=e=>e.relationship===`peer`?`peer`:`family`;function gi(e,t,n){let r=(e,n)=>B(t,e,n);switch(e.kind){case`request-opened`:return{tone:hi(e.request),text:`${r(e.request.senderRunId,e.request.senderTitle)} asked ${r(e.request.recipientRunId,e.request.recipientTitle)}`};case`request-closed`:return{tone:e.status===`replied`?`success`:`neutral`,text:pi(e.request,e.status,r)};case`rung-changed`:return{tone:g(e.task.rung).tone,text:`${e.task.title}: ${wt(e.task,{now:n,titleOf:e=>r(e)}).verb}`};case`worker-started`:return{tone:`running`,text:`${e.worker.title} started`};case`worker-settled`:{let t=mi[e.worker.status]??{tone:`neutral`,word:`settled`};return{tone:t.tone,text:`${e.worker.title} ${t.word}`}}case`card-entered`:return{tone:g(e.task.rung).tone,text:`${e.task.title} started`};case`card-left`:return{tone:`neutral`,text:`${e.task.title} left active work`};case`check-passed`:return{tone:`success`,text:`PR ${e.pr}: check “${e.name}” passed`};default:return}}function _i(e,t,n,r){return[...t.map((e,t)=>({...e,id:r+t,at:n})),...e].slice(0,6)}function vi(e){let t=Math.max(0,Math.floor(e/1e3));return t<5?`now`:t<60?`${t} s`:`${Math.floor(t/60)} min`}var yi=new Set;function bi(e){let[t,n]=E.useState({}),r=t.pointer??t.focus,i=E.useCallback((e,t)=>n(n=>n[e]===t?n:{...n,[e]:t}),[]);return{linked:E.useMemo(()=>r===void 0?yi:Nt(r,e),[r,e]),active:E.useMemo(()=>r===void 0?yi:new Set(e.filter(e=>e.waiterRunId===r||e.peerRunId===r).map(e=>e.id)),[r,e]),onHover:i}}var xi=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),Si=`inline-flex items-center px-3 py-[5px] text-[12px] font-medium focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring max-md:min-h-11`;function Ci({scope:e,projectId:t}){let r=e=>i(Si,e?`bg-card-2 text-foreground`:`text-muted-foreground hover:text-foreground`);return(0,D.jsxs)(`nav`,{"aria-label":`Activity scope`,"data-slot":`activity-scope`,className:`ml-auto inline-flex overflow-hidden rounded-lg border border-border`,children:[t===null?null:(0,D.jsx)(n,{to:`/p/${encodeURIComponent(t)}/activity`,"aria-current":e===`project`?`page`:void 0,className:r(e===`project`),children:`This project`}),(0,D.jsx)(n,{to:`/activity`,state:{activityProjectId:t},"aria-current":e===`all`?`page`:void 0,className:r(e===`all`),children:`All projects`})]})}function wi({now:e,stale:t}){return(0,D.jsxs)(`span`,{"data-slot":`activity-clock`,"data-stale":t?`true`:void 0,className:`inline-flex items-center gap-1.5 text-[12px] text-muted-foreground tabular-nums`,children:[(0,D.jsx)(`span`,{"data-tone":`success`,className:i(`inline-flex size-[12px] items-center justify-center`,!t&&`activity-pulse`),children:(0,D.jsx)(T,{tone:t?`neutral`:`success`,"aria-hidden":`true`})}),(0,D.jsx)(`b`,{className:i(`font-semibold`,t?`text-muted-foreground`:`text-success`),children:t?`Not updating`:`Live`}),xi.format(e),` `,it()]})}function Ti({name:e,now:t,stale:n=!1,children:r}){return(0,D.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,D.jsxs)(`h1`,{className:`min-w-0 truncate text-[18px] font-semibold`,children:[`Activity `,(0,D.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`· `,e]})]}),t===void 0?null:(0,D.jsx)(wi,{now:t,stale:n}),r]})}function Ei({value:e,bump:t}){return(0,D.jsx)(`strong`,{"data-bump":t===void 0?void 0:`true`,className:i(`font-semibold text-foreground tabular-nums`,t!==void 0&&`activity-bump`),children:e},t??`still`)}function Q({icon:e,count:t,label:n,bump:r}){return(0,D.jsxs)(`li`,{"data-slot":`activity-chip`,"data-chip":n,className:`inline-flex items-center gap-[7px] rounded-full border border-border bg-card px-[11px] py-[5px] text-[12px] text-muted-foreground`,children:[e,(0,D.jsx)(Ei,{value:t,bump:r}),` `,n]})}function Di({summary:e,tasksTo:t,bumps:n={}}){let r=e=>n[e]?.key;return(0,D.jsxs)(`ul`,{"data-slot":`activity-summary`,"aria-live":`polite`,"aria-label":`Summary`,className:`flex flex-wrap gap-2`,children:[(0,D.jsx)(Q,{icon:(0,D.jsx)(T,{tone:`pending`,"aria-hidden":`true`}),count:e.needsYou,label:`needs you`,bump:r(`needsYou`)}),(0,D.jsx)(Q,{icon:(0,D.jsx)(T,{tone:`running`,"aria-hidden":`true`}),count:e.working,label:`working`,bump:r(`working`)}),(0,D.jsx)(Q,{icon:(0,D.jsx)(T,{tone:`running`,shape:`ring`,"aria-hidden":`true`}),count:e.waiting,label:`waiting`,bump:r(`waiting`)}),(0,D.jsx)(Q,{icon:(0,D.jsx)(T,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}),count:e.queued,label:`queued`,bump:r(`queued`)}),(0,D.jsx)(Q,{icon:(0,D.jsx)(be,{"aria-hidden":`true`,className:`size-3.5`}),count:e.activeWorkers,label:`active workers`,bump:r(`activeWorkers`)}),(0,D.jsx)(Q,{icon:(0,D.jsx)(ye,{"aria-hidden":`true`,className:`size-3.5 text-message-peer-accent`}),count:e.openRequests,label:`open requests`,bump:r(`openRequests`)}),(0,D.jsx)(`li`,{"data-slot":`activity-chip`,"data-chip":`in review`,children:(0,D.jsxs)(w,{to:t,className:`inline-flex items-center gap-[7px] rounded-full border border-border bg-card px-[11px] py-[5px] text-[12px] text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11`,children:[(0,D.jsx)(T,{tone:`info`,"aria-hidden":`true`}),(0,D.jsx)(Ei,{value:e.inReview,bump:r(`inReview`)}),` in review`]})})]})}var $=e=>new Map(e.map(e=>[e.runId,e])),Oi=e=>e!==void 0&&Ot(e)===void 0;function ki(e,t,n,r){let i=$(t.workers);for(let t of n.workers){let a=i.get(t.runId);!a&&F(t.status)&&r({kind:`worker-started`,projectId:e,parentId:n.runId,worker:t}),a&&F(a.status)&&!F(t.status)&&r({kind:`worker-settled`,projectId:e,parentId:n.runId,worker:t})}}function Ai(e,t,n,r){if(t.wait?.kind!==`pr`||n.wait?.kind!==`pr`||t.wait.detail.number!==n.wait.detail.number)return;let i=new Set((t.wait.detail.checks??[]).filter(e=>e.bucket===`pending`).map(e=>e.name));for(let t of n.wait.detail.checks??[])t.bucket===`pass`&&i.has(t.name)&&r({kind:`check-passed`,projectId:e,runId:n.runId,pr:n.wait.detail.number,name:t.name})}var ji=(e,t)=>t.tool!==void 0&&(t.tool.startedAt!==e.tool?.startedAt||t.tool.title!==e.tool?.title);function Mi(e,t,n,r){t.rung!==n.rung&&r({kind:`rung-changed`,projectId:e,task:n,from:t.rung}),ji(t,n)&&r({kind:`tool-started`,projectId:e,runId:n.runId}),ki(e,t,n,r),Ai(e,t,n,r)}function Ni(e,t,n){let r=$(e.tasks),i=$(t.tasks);for(let e of t.tasks){let i=r.get(e.runId);i?Mi(t.projectId,i,e,n):n({kind:`card-entered`,projectId:t.projectId,task:e})}for(let r of e.tasks)i.has(r.runId)||n({kind:`card-left`,projectId:t.projectId,task:r})}function Pi(e,t,n){let r=new Set(e.requests.map(e=>e.requestId)),i=new Set(t.requests.map(e=>e.requestId)),a=new Map(t.closed.map(e=>[e.requestId,e.status]));for(let e of t.requests)r.has(e.requestId)||n({kind:`request-opened`,projectId:t.projectId,request:e});for(let r of e.requests){if(i.has(r.requestId))continue;let e=a.get(r.requestId);n({kind:`request-closed`,projectId:t.projectId,request:r,...e?{status:e}:{}})}}function Fi(e,t,n){let r=Mt(e.tasks),i=Mt(t.tasks),a=new Set(r.map(e=>e.id)),o=new Set(i.map(e=>e.id));for(let e of i)a.has(e.id)||n({kind:`wait-opened`,projectId:t.projectId,wait:e});for(let e of r)o.has(e.id)||n({kind:`wait-closed`,projectId:t.projectId,wait:e})}var Ii=[`needsYou`,`working`,`waiting`,`queued`,`activeWorkers`,`openRequests`,`inReview`];function Li(e,t,n){let r=Gt(e),i=Gt(t);for(let e of Ii)r[e]!==i[e]&&n({kind:`chip-changed`,chip:e,from:r[e],to:i[e]})}function Ri(e,t){if(e===void 0)return[];let n=[],r=e=>n.push(e),i=new Map(e.projects.map(e=>[e.projectId,e]));for(let e of t.projects){let t=i.get(e.projectId);!Oi(t)||!Oi(e)||(Ni(t,e,r),Pi(t,e,r),Fi(t,e,r))}return Li(e.projects,t.projects,r),n}function zi(e){return{input:e,reconcile:!1,seq:0,motion:U,feed:[],epoch:0,...e.snapshot?{seen:e.snapshot}:{}}}function Bi(e){let{plan:t,...n}=e;return{...n,motion:U,epoch:e.epoch+1}}function Vi(e,t,n){let r=Ri(t,n);if(r.length===0)return e;let i=Date.parse(n.generatedAt),a=di(t,n),o=r.flatMap(e=>gi(e,a,i)??[]),s=e.seq+o.length+1,c=nn(r,s,e.input.reduced);return{...e,seq:s,feed:o.length>0?_i(e.feed,o,i,e.seq+1):e.feed,motion:an(e.motion,c.changes),...c.timers.length>0?{plan:{key:s,timers:c.timers}}:{}}}function Hi(e,t){let n=e.seen;if(!t||t===n)return e;let r={...e,seen:t};return!n||!e.input.active?r:e.reconcile?{...r,reconcile:!1}:Vi(r,n,t)}function Ui(e,t){let n=e.input;if(t.scope!==n.scope)return{...zi(t),seq:e.seq,epoch:e.epoch+1};if(t.snapshot===n.snapshot&&t.active===n.active&&t.reduced===n.reduced)return e;let r={...e,input:t};return n.active&&!t.active&&(r={...Bi(r),reconcile:!0}),!n.reduced&&t.reduced&&(r=Bi(r)),Hi(r,t.snapshot)}var Wi=`(prefers-reduced-motion: reduce)`,Gi=()=>typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(Wi):void 0;function Ki(e){let t=Gi();return t?.addEventListener?.(`change`,e),()=>t?.removeEventListener?.(`change`,e)}function qi(){return Gi()?.matches??!1}function Ji(){return(0,E.useSyncExternalStore)(Ki,qi,()=>!1)}function Yi(e,t){let n=E.useRef(new Set);E.useEffect(()=>{let e=n.current;return()=>{for(let t of e)clearTimeout(t);e.clear()}},[e.epoch]),E.useEffect(()=>{for(let{after:r,change:i}of e.plan?.timers??[]){let e=setTimeout(()=>{n.current.delete(e),t(e=>({...e,motion:an(e.motion,[i])}))},r);n.current.add(e)}},[e.plan?.key])}function Xi(e,t){let n=Ji(),r=f(),i={snapshot:e,scope:t,active:r,reduced:n},[a,o]=E.useState(()=>zi(i)),s=Ui(a,i);return s!==a&&o(s),Yi(s,o),{motion:s.motion,feed:s.feed,reduced:n,paused:!r}}function Zi(e,t){let n=xe(1e3),[r,i]=E.useState({offset:0}),a=r.offset;return Xe(e)&&e!==r.generatedAt&&t!==0&&(a=Date.parse(e)-t,i({generatedAt:e,offset:a})),n+a}export{Cn as A,Mt as B,Fn as C,Mn as D,Pn as E,U as F,At as G,V as H,on as I,wt as J,Gt as K,zt as L,W as M,un as N,Tn as O,cn as P,tt as Q,Ft as R,er as S,Rn as T,Lt as U,Ot as V,kt as W,M as X,P as Y,N as Z,Vr as _,Di as a,ur as b,ui as c,Z as d,ii as f,Gr as g,qr as h,Ci as i,gn as j,An as k,ci as l,Zr as m,Xi as n,bi as o,ei as p,F as q,Ti as r,vi as s,Zi as t,$r as u,wr as v,Ln as w,$n as x,lr as y,B as z};
|