@wjarka/cezarion 0.18.0-dev.6755 → 0.18.0-dev.6774
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-CjPL-sr2.js → activity-motion-gOopdagH.js} +1 -1
- package/web/dist/assets/{activity-route-C0tIKFED.js → activity-route-D7bDtXpW.js} +1 -1
- package/web/dist/assets/agent-accounts-otlDWnij.js +18 -0
- package/web/dist/assets/{commit-diff-panel-uIMnjowv.js → commit-diff-panel-iQf0Rlcx.js} +1 -1
- package/web/dist/assets/{diff-CUIYkwMG.js → diff-DQfcliZC.js} +2 -2
- package/web/dist/assets/{diff-view-CH27Vgln.js → diff-view-BbM-71Cs.js} +1 -1
- package/web/dist/assets/{file-preview-wrsPzzjz.js → file-preview-DgU8vo8k.js} +1 -1
- package/web/dist/assets/{git-toolbar-C1v8n8nd.js → git-toolbar-C8agvpYS.js} +1 -1
- package/web/dist/assets/{github-0PYN1Ju2.js → github-hXmxAXmA.js} +1 -1
- package/web/dist/assets/{global-activity-route-KDUFNxgb.js → global-activity-route-D_r1ImUh.js} +1 -1
- package/web/dist/assets/index-tN02NX7A.js +17 -0
- package/web/dist/assets/{preview-pane-connected-B1XJVVoo.js → preview-pane-connected-D__9JwyU.js} +1 -1
- package/web/dist/assets/{prompt-template-menu-DC5XoYEs.js → prompt-template-menu-BJfUg1uF.js} +1 -1
- package/web/dist/assets/queries-BJM44umy.js +1 -0
- package/web/dist/assets/{reference-chip-peKR_0El.js → reference-chip-vraIzoEF.js} +1 -1
- package/web/dist/assets/{repo-git-DU5eh5V8.js → repo-git-B4qZq37d.js} +1 -1
- package/web/dist/assets/{report-reader-DsvVau4u.js → report-reader-Djix-ICM.js} +1 -1
- package/web/dist/assets/{reports-Brs9M380.js → reports-Do-dkavq.js} +1 -1
- package/web/dist/assets/run-header-Di9LaKQs.js +2 -0
- package/web/dist/assets/{skills-TJPEPrU2.js → skills-CPnIvFnR.js} +1 -1
- package/web/dist/assets/{task-changes-BMMqKQZQ.js → task-changes-CW7NzgL5.js} +1 -1
- package/web/dist/assets/{task-commits-DzOQ_acm.js → task-commits-Bkwi7o1B.js} +1 -1
- package/web/dist/assets/{task-files-CqBxJ5lZ.js → task-files-geRzIszC.js} +1 -1
- package/web/dist/assets/{task-github-item-DYZGczpf.js → task-github-item-UbCCP2Ud.js} +1 -1
- package/web/dist/assets/task-thread-CkiEiypn.js +9 -0
- package/web/dist/assets/{thread-state-VHo3TMiY.js → thread-state-CajkV5Ft.js} +1 -1
- package/web/dist/assets/{use-desktop-DBpXK7UB.js → use-desktop-Ct4lvA3b.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-DiPruziF.js → use-hand-to-agent-state-Cnxq_2F6.js} +1 -1
- package/web/dist/assets/workflows-Csr2hbks.js +7 -0
- package/web/dist/index.html +6 -6
- package/web/dist/assets/agent-accounts-Bfv01ivB.js +0 -18
- package/web/dist/assets/index-DgeV0f4H.js +0 -17
- package/web/dist/assets/queries-Ce9CPdRy.js +0 -1
- package/web/dist/assets/run-header-BYyz-dXB.js +0 -2
- package/web/dist/assets/task-thread-DYEBHvdF.js +0 -9
- package/web/dist/assets/workflows-DiURHZJ-.js +0 -7
package/web/dist/assets/{use-hand-to-agent-state-DiPruziF.js → use-hand-to-agent-state-Cnxq_2F6.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,t as n,u as r}from"./button-DGwhwRuD.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{C as o,Ur as s,en as c,nt as l,r as u,rt as d,yr as f,zt as p}from"./project-scope-context-bgdvGX9z.js";import{$ as m,At as h,Lt as g,M as _,Nt as v,O as y,Qt as b,h as x,n as S,nt as C,wt as w}from"./queries-Ce9CPdRy.js";import{t as T}from"./useQuery-C0ee1rw5.js";import{Q as E,a as D,o as O,r as k}from"./use-desktop-DBpXK7UB.js";import{n as A}from"./toaster-CoMJoQvk.js";import{A as j,Z as ee,_ as M,b as N,ct as P,d as F,ft as te,h as I,l as L,mt as ne,ot as re,r as ie,rt as ae,u as oe,ut as se}from"./design-icons-DmYTv2r1.js";import{t as ce}from"./eye-B8okNWXU.js";import{a as le,i as R}from"./format-BNCkW110.js";import{t as ue}from"./message-square-B-MD-8rD.js";import{t as de}from"./play-CmVAj_fu.js";import{a as fe,i as pe,o as me,r as he,s as ge,t as _e}from"./dialog-B7p5oc5r.js";import{d as z,t as ve,y as B}from"./prompt-template-menu-DC5XoYEs.js";import{t as V}from"./project-router-WQWd3UUn.js";import{B as ye,E as be,G 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 Re,s as ze,t as Be,u as Ve,w as He,x as Ue,z as We}from"./agent-accounts-Bfv01ivB.js";import{d as Ge,f as Ke,i as qe,s as Je,t as Ye,u as Xe}from"./skills-DFBiAuJG.js";import{$ as Ze,F as Qe,L as $e,X as et,Y as tt,pn as nt}from"./index-DgeV0f4H.js";import{t as rt}from"./diff-CUIYkwMG.js";import{t as it}from"./tab-link-DiNYVlpl.js";var U=e(i(),1),W=a(),at={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function G({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,W.jsx)(L,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:r(t,`text-success`)}):e===`failing`?(0,W.jsx)(M,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:r(t,`text-danger`)}):e===`pending`?(0,W.jsx)(le,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:r(t,`animate-spin text-warning`)}):(0,W.jsx)(I,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:r(t,`text-soft-foreground`)})}function ot(e){return e?.available?e.mergeState:null}function st(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function ct(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 lt(e){return e===`approved`||e===`not-required`?`passing`:e===`unknown`?`unknown`:`failing`}function ut(e){return e===`mergeable`?`passing`:e===`conflicting`?`failing`:`unknown`}function dt(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function ft(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function pt(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function mt(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function K(e){return e?at[e]:`Merge`}function ht(e){return e===`conflicting`?`true`:void 0}function gt({check:e}){return(0,W.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,W.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(G,{state:e.state}),(0,W.jsxs)(`span`,{children:[e.name,` · `,e.state,ft(e.required)]})]}),e.url&&t(e.url)?(0,W.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function _t({reason:e}){return(0,W.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,W.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function vt({state:e,selectedMethod:t,overrideRules:i,mergeEnabled:a,refreshPending:o,onRefresh:s,onRunAgent:c,onConfirm:l,onMethodChange:u,onOverrideChange:d}){let f=ct(e),p=lt(e.reviewDecision),m=ut(e.mergeable);return(0,W.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,W.jsx)(L,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,W.jsx)(P,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,W.jsx)(`h3`,{className:`font-semibold`,children:f}),(0,W.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,disabled:o,onClick:s,children:[(0,W.jsx)(ee,{size:16,"aria-hidden":`true`,className:r(`size-3.5`,o&&`animate-spin`)}),`Refresh`]})]}),(0,W.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[e.headRef,` (`,e.headSha.slice(0,7),`) → `,e.baseRef]}),(0,W.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,W.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(G,{state:p}),(0,W.jsxs)(`span`,{children:[`Reviews: `,e.reviewDecision.replaceAll(`-`,` `)]})]}),(0,W.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(G,{state:m}),(0,W.jsxs)(`span`,{children:[`Conflicts: `,dt(e.mergeable)]})]}),e.checks.length===0?(0,W.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,W.jsx)(gt,{check:e},e.name)),e.blockers.map(e=>(0,W.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&c?(0,W.jsx)(n,{className:`mt-4`,onClick:c,children:`Run agent on this PR`}):null,e.canOverride?(0,W.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,W.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>d(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,W.jsxs)(`span`,{children:[(0,W.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,W.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,W.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,W.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,W.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,W.jsx)(`option`,{value:e,children:at[e]},e))}),(0,W.jsx)(n,{disabled:!a,onClick:l,children:K(t)})]}):null]})]})}function yt({number:e,state:t,selectedMethod:r,confirming:i,overrideRules:a,mergePending:o,mergeError:s,onOpenChange:c,onMerge:l}){return(0,W.jsx)(_e,{open:i,onOpenChange:c,children:(0,W.jsxs)(he,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,W.jsxs)(me,{children:[(0,W.jsxs)(ge,{children:[K(r),` pull request #`,e,`?`]}),(0,W.jsx)(pe,{asChild:!0,children:(0,W.jsxs)(`div`,{children:[(0,W.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,W.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,W.jsx)(`p`,{className:`text-sm text-danger`,children:s.message}):null,(0,W.jsxs)(fe,{children:[(0,W.jsx)(n,{variant:`outline`,disabled:o,onClick:()=>c(!1),children:`Cancel`}),(0,W.jsx)(n,{disabled:o,onClick:l,children:o?`Merging…`:K(r)})]})]})})}function bt({number:e,onRunAgent:t}){let n=s(),r=C(),i=T({queryKey:S.githubMergeState(e),queryFn:({signal:t})=>d(e,{},{signal:t}),retry:!1}),a=ot(i.data),[o,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(!1),[f,m]=(0,U.useState)(!1),h=b({mutationFn:t=>d(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>A(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=st(o,a),_=()=>({mergeState:S.githubMergeState(e),list:S.githubPages(50),comments:S.githubComments(`pr`,e),item:S.githubItem(`pr`,e),refStatus:r===void 0?void 0:S.githubRefStatusOf(r)}),v=b({mutationFn:t=>{if(!a||!g)throw Error(`No merge method is available.`);return p(e,{method:g,expectedHeadSha:a.headSha,...f&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{u(!1),A(`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)=>{A(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,W.jsx)(B,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,W.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":ht(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,W.jsx)(vt,{state:a,selectedMethod:g,overrideRules:f,mergeEnabled:mt(g,a,f),refreshPending:h.isPending,onRefresh:()=>h.mutate(S.githubMergeState(e)),onRunAgent:t,onConfirm:()=>u(!0),onMethodChange:c,onOverrideChange:m}),(0,W.jsx)(yt,{number:e,state:a,selectedMethod:g,confirming:l,overrideRules:f,mergePending:v.isPending,mergeError:v.error,onOpenChange:u,onMerge:()=>v.mutate(_())})]}):(0,W.jsx)(_t,{reason:pt(i.data)})}function xt(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 St(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 Ct(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 q(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 wt({label:e,color:t,plain:n=!1}){return(0,W.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:q(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 Tt(e){return e===`pr`?`pull request`:`issue`}function Et(e,t,n){return e===`pr`&&!!(t||n)}function Dt({backLink:e}){return e?(0,W.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,W.jsx)(ie,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}function Ot({item:e,kindWord:n,commentCount:r,hasDiffStat:i,additions:a,deletions:o}){return(0,W.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,W.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,W.jsx)(`span`,{children:n}),`·`,(0,W.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,W.jsxs)(`span`,{children:[R(e.createdAt),` ago`]}),r?(0,W.jsxs)(W.Fragment,{children:[`·`,(0,W.jsx)(Yt,{count:r})]}):null,i?(0,W.jsxs)(W.Fragment,{children:[`·`,(0,W.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,W.jsxs)(`span`,{className:`text-success`,children:[`+`,a??0]}),` `,(0,W.jsxs)(`span`,{className:`text-danger`,children:[`−`,o??0]})]})]}):null,`·`,t(e.url)?(0,W.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,W.jsx)(E,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,W.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function kt({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,W.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,W.jsx)(it,{to:z(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,W.jsx)(it,{to:z(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,W.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 At({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,W.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,W.jsx)(wt,{label:e,color:t[e]},e)),n?(0,W.jsx)(Xt,{checks:n,url:e.url}):null]}):null}function jt({item:e,colors:t,body:n}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:n?(0,W.jsx)($e,{children:n}):(0,W.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,W.jsx)(Pt,{item:e,colors:t})]})}function Mt({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,children:c}){let l=a?.changes??!1,u=Tt(e.kind),d=y(e.kind,e.number,!l).data?.detail,f=d?.body??e.body,p=d?.additions??e.additions,m=d?.deletions??e.deletions,h=Et(e.kind,p,m),g=r??e.comments;return(0,W.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,W.jsx)(Dt,{backLink:i}),(0,W.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,W.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,W.jsx)(Ot,{item:e,kindWord:u,commentCount:g,hasDiffStat:h,additions:p,deletions:m}),e.kind===`pr`?null:(0,W.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),s,(0,W.jsx)(kt,{item:e,subNav:a,changes:l}),(0,W.jsx)(At,{item:e,colors:t,checks:n}),l&&e.kind===`pr`?(0,W.jsx)(Nt,{item:e}):(0,W.jsx)(jt,{item:e,colors:t,body:f})]}),e.kind===`pr`?(0,W.jsx)(bt,{number:e.number,onRunAgent:o}):null,c]})}function Nt({item:e}){let i=s(),a=_(e.number),[o,c]=(0,U.useState)(``),[u,d]=(0,U.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,U.useEffect)(()=>{p.length>0&&!p.some(e=>e.path===u)&&d(p[0].path)},[f?.available?f.headSha:``,o]);let h=async()=>{let t=f?.available?f.headSha:null,n=S.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),A(`The reviewed revision changed.`))};if(a.isPending)return(0,W.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(a.isError||!f)return(0,W.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!f.available)return(0,W.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:f.reason});let g=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,W.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,W.jsxs)(`strong`,{children:[f.files.length,` changed files`]}),(0,W.jsxs)(`span`,{className:`text-success`,children:[`+`,f.additions]}),(0,W.jsxs)(`span`,{className:`text-danger`,children:[`−`,f.deletions]}),(0,W.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:f.headSha,children:[`head `,f.headSha.slice(0,8)]}),(0,W.jsx)(n,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void h(),children:`Refresh`})]}),f.truncated?(0,W.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,W.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,W.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,W.jsxs)(`aside`,{className:`min-w-0`,children:[(0,W.jsx)(`input`,{"aria-label":`Filter changed files`,value:o,onChange:e=>c(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,W.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,W.jsx)(`option`,{children:e.path},e.path))}),(0,W.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:p.map(e=>(0,W.jsx)(`li`,{children:(0,W.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,W.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,W.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,W.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,W.jsx)(nt,{})}),(0,W.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,W.jsx)(F,{size:16})})]}),p.length===0?(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(rt,{files:g.filter(e=>e.path===u),wrap:!0,className:`min-w-0`}),y&&!y.patch?(0,W.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,y.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Pt({item:e,colors:t}){let n=y(e.kind,e.number),r=n.data,i=(0,U.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(Ft(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,W.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,W.jsx)(B,{className:`mb-3 h-3 w-24`}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(B,{className:`h-14 w-full`}),(0,W.jsx)(B,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,W.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,W.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,W.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,W.jsx)(E,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,W.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,W.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,W.jsx)(`ul`,{className:`flex flex-col gap-5`,children:It(i).map(e=>e.group===`commits`?(0,W.jsx)(Lt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,W.jsx)(qt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,W.jsx)(Rt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,W.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,W.jsx)(E,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Ft=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function It(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 Lt({commits:e,colors:t}){let[n,r]=(0,U.useState)(!1),i=e[0]?.actor??`?`;return n?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,W.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,W.jsx)(`span`,{"aria-hidden":`true`,children:J.committed}),(0,W.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,W.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,W.jsx)(Rt,{event:e,colors:t},e.id))]}):(0,W.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,W.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,W.jsx)(`span`,{"aria-hidden":`true`,children:J.committed}),(0,W.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,W.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,W.jsx)(`span`,{className:`shrink-0`,children:R(e[e.length-1].createdAt)})]})})}var J={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Rt({event:e,colors:t}){return(0,W.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,W.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:J[e.kind]}),(0,W.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,W.jsx)(Wt,{event:e,colors:t}),(0,W.jsx)(`span`,{className:`shrink-0`,children:R(e.createdAt)}),e.url?(0,W.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,W.jsx)(E,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function zt({event:e}){return(0,W.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,W.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,W.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,W.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,W.jsx)(Gt,{checks:e.checks})]})}function Bt({event:e,colors:t}){return(0,W.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,W.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,W.jsx)(`span`,{"data-slot":`gh-event-label`,style:q(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,W.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function Vt({event:e}){return(0,W.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Ht({event:e}){return(0,W.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Ut={committed:e=>(0,W.jsx)(zt,{event:e}),labeled:(e,t)=>(0,W.jsx)(Bt,{event:e,colors:t}),unlabeled:(e,t)=>(0,W.jsx)(Bt,{event:e,colors:t}),assigned:e=>(0,W.jsx)(Vt,{event:e}),unassigned:e=>(0,W.jsx)(Vt,{event:e}),merged:()=>(0,W.jsx)(`span`,{children:`merged this`}),closed:()=>(0,W.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,W.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,W.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,W.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,W.jsx)(Ht,{event:e})};function Wt({event:e,colors:t}){return Ut[e.kind]?.(e,t)??null}function Gt({checks:e}){return e?(0,W.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:r(`shrink-0`,X[e]),children:Y[e]}):null}var Kt={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 qt({comment:e}){let t=e.reviewState?Kt[e.reviewState]:null;return(0,W.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,W.jsx)(Jt,{url:e.avatarUrl,login:e.author}),(0,W.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,W.jsx)(`span`,{children:R(e.createdAt)}),t?(0,W.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,W.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,W.jsx)(E,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,W.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,W.jsx)($e,{children:e.body}):(0,W.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Jt({url:e,login:t}){let[n,r]=(0,U.useState)(!1);return e&&!n?(0,W.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,W.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 Y={passing:`✓`,failing:`✗`,pending:`○`},X={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Yt({count:e}){return e?(0,W.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,W.jsx)(ue,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Xt({checks:e,url:t}){let n=r(`text-[11px] font-medium`,X[e],t&&`hover:underline`),i=`${Y[e]} checks ${e}`;return t?(0,W.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:i}):(0,W.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:i})}function Zt({checks:e}){return(0,W.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`,X[e]),children:Y[e]})}function Z(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=Z(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=Z(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=m(),n=x(),r=f(t.data),i=n.data?.defaultRunner,a=be(e.runner,r,i??r[0]??`claude`),o=w(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),p=Ae(a,d,o.data);return{runner:a,runnerExplicit:e.runner!==null,model:d,effort:s?``:He(e.effort,p),effortOptions:p,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,U.useRef)(null),o=(0,U.useRef)(null),[s,c]=(0,U.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,U.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,U.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,_=x(),v=w(u),y=De(u,v.data,[e.model,_.data?.defaultModels?.[u]]),b=n||!h,S=r?l.accounts:[],C=m.length>1||m.some(e=>Be(S,e))?(0,W.jsx)(ke,{icon:(0,W.jsx)(re,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:m,value:u,accounts:S,account:r?l.account:null,repoAccount:r?l.repoAccount:void 0,disabled:b,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,W.jsx)(Re,{icon:(0,W.jsx)(N,{"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:b,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:He(e.effort,r)})},options:y.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Ue(u,v.data,v.isError,v.isFetching)},`model`),E=(0,W.jsx)(Re,{icon:(0,W.jsx)(j,{"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:b,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,W.jsx)(`div`,{ref:a,"data-slot":`engine-row-box`,children:(0,W.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,W.jsx)(Ne,{children:s?[C,E,T]:[C,T,E]})})}):(0,W.jsxs)(Ne,{children:[C,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:l,selectedSkills:u,onSkillsChange:d,engine:f,onEngineChange:p,queuedRunId:m,onQueued:h}){let g=s(),_=v(),y=xe(),x=e.kind===`pr`?`PR`:`issue`,C=u.filter(e=>i.some(t=>t.name===e)),[w]=(0,U.useState)(()=>Z(e)),[T,E]=(0,U.useState)(()=>mn(e.url)||w),D=an(f),O=(0,U.useRef)(null),k=(0,U.useRef)(null);(0,U.useEffect)(()=>{hn(e.url,T===w?``:T)},[e.url,T,w]);let j=(0,U.useMemo)(()=>Me(je(_.data?.promptTemplates),{automations:y}),[_.data?.promptTemplates,y]),ee=e=>{let t=O.current,n=Fe({prompt:T,base:w,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:k.current}),r=Ve(T,n,e);E(r.text),k.current=r.caret,requestAnimationFrame(()=>{O.current?.focus(),O.current?.setSelectionRange(r.caret,r.caret)})},M=Pe(j,C),N=(0,U.useRef)(T);N.current=T;let P=(0,U.useRef)(``);(0,U.useEffect)(()=>{let e=Le(N.current,P.current,M,w);P.current=e.applied,e.text!==N.current&&E(e.text)},[M,w]);let F=b({mutationFn:async()=>D.canRun?o(rn(e,a,C,T,sn(D))):null,onSuccess:t=>{if(t===null)return;let n=t;n&&h(e.url,n.id),A(`Added to the queue — ${x} #${e.number}`),C.length>0&&_.data!==void 0&&c({skillUsage:C.reduce((e,t)=>Ye(e,t),_.data.skillUsage)}).then(()=>g.invalidateQueries({queryKey:S.uiState})).catch(()=>{}),hn(e.url,``),E(w),P.current=``,g.invalidateQueries({queryKey:S.runs.all})},onError:e=>A(e.message,{tone:`danger`})}),te=e=>{tt({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(),!F.isPending&&D.canRun&&F.mutate())},I=e=>d(u.includes(e)?u.filter(t=>t!==e):[...u,e]);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,W.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,W.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,W.jsx)(`span`,{children:`Instructions for the agent`}),(0,W.jsx)(Ze,{ref:O,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:T,onChange:e=>E(e.target.value),onSelect:e=>{k.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,W.jsx)(ve,{templates:j,onInsert:ee}),(0,W.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,W.jsxs)(`div`,{className:`gh-field`,children:[(0,W.jsx)(`span`,{children:`Workflow`}),(0,W.jsx)(_n,{workflows:r,value:a,onChange:l})]}),(0,W.jsxs)(`div`,{className:`gh-field`,children:[(0,W.jsx)(`span`,{children:`Skills · select one or more`}),(0,W.jsx)(yn,{skills:i,skillUsage:_.data?.skillUsage,selected:C,onToggle:I})]}),C.length>0?(0,W.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:C.map(e=>(0,W.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>I(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,W.jsx)(ne,{size:16,"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,W.jsx)(cn,{layout:`row`,pick:f,onChange:p,disabled:F.isPending||!D.canRun,accounts:!0}),(0,W.jsxs)(`div`,{className:`gh-field`,children:[(0,W.jsx)(`span`,{children:`Account`}),(0,W.jsx)(vn,{resolved:D,disabled:F.isPending||!D.canRun,onPick:e=>p({...f,account:e})})]}),!D.providerPending&&!D.canRun?(0,W.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[D.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,W.jsx)(V,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,W.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,W.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[t(e.url)?(0,W.jsx)(n,{asChild:!0,variant:`outline`,children:(0,W.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,W.jsxs)(n,{variant:`primary`,"data-action":`gh-run`,disabled:F.isPending||!D.canRun,onClick:()=>F.mutate(),children:[(0,W.jsx)(de,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,x]}),(0,W.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:et()}),m?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,W.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,W.jsx)(V,{to:`/tasks/${m}`,"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,U.useState)(!1),[o,s]=(0,U.useState)(``),c=(0,U.useRef)(null),l=Ge(e,o);return(0,W.jsxs)(k,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,W.jsx)(O,{asChild:!0,children:(0,W.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:r(ze,t&&`border-foreground/60 font-mono text-[11px] font-semibold text-foreground`),children:[(0,W.jsx)(te,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,W.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,W.jsx)(oe,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,W.jsx)(D,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,W.jsxs)(Te,{shouldFilter:!1,children:[(0,W.jsx)(Ee,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,W.jsxs)(ye,{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,W.jsx)(Se,{children:`Nothing matches.`}):null,(0,W.jsx)(H,{children:l.map(e=>{let r=t===e.name;return(0,W.jsxs)(We,{value:`workflow ${e.name}`,keywords:Ke(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,W.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,W.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,W.jsx)(Re,{icon:(0,W.jsx)(se,{"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,U.useState)(!1),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(null),d=(0,U.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=Xe(e,s,t),g=(e,t)=>{let a=n.includes(e.name);return(0,W.jsxs)(We,{value:`skill ${e.name} ${e.path}`,keywords:Ke(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,W.jsx)(`span`,{className:r(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,W.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,W.jsx)(ce,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,W.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,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Qe,{skill:l,onClose:()=>u(null)}),(0,W.jsxs)(k,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,W.jsx)(O,{asChild:!0,children:(0,W.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:r(ze,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,W.jsx)(ae,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,W.jsx)(oe,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,W.jsx)(D,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,W.jsxs)(Te,{shouldFilter:!1,children:[(0,W.jsx)(Ee,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,W.jsxs)(ye,{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,W.jsx)(Se,{children:`Nothing matches.`}):null,h?h.length>0?(0,W.jsx)(H,{children:h.map(e=>g(e,qe(e)))}):null:(0,W.jsxs)(W.Fragment,{children:[f.length>0?(0,W.jsx)(H,{heading:`Most used`,children:f.map(e=>g(e,qe(e)))}):null,p.length>0?(0,W.jsx)(H,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,W.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=s(),{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,c=(0,U.useSyncExternalStore)(a,i,i),l=g(),d=h(),f=v(),p=l.data?.workflows;(0,U.useEffect)(()=>{p&&c.workflow!==null&&!p.some(e=>e.name===c.workflow)&&o({workflow:null})},[o,p,c.workflow]);let m=(0,U.useMemo)(()=>Je(d.data??[],f.data?.skillUsage),[d.data,f.data?.skillUsage]);return{...c,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{Yt as a,It as c,q as d,Ct as f,Zt as i,xt as l,gn as n,Mt as o,Qt as r,wt as s,Sn as t,St as u};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,t as n,u as r}from"./button-DGwhwRuD.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{C as o,Ur as s,en as c,nt as l,r as u,rt as d,yr as f,zt as p}from"./project-scope-context-bgdvGX9z.js";import{$ as m,At as h,Lt as g,M as _,Nt as v,O as y,h as b,n as x,nn as S,nt as C,wt as w}from"./queries-BJM44umy.js";import{t as T}from"./useQuery-C0ee1rw5.js";import{Q as E,a as D,o as O,r as k}from"./use-desktop-Ct4lvA3b.js";import{n as A}from"./toaster-CoMJoQvk.js";import{A as j,Z as ee,_ as M,b as N,ct as P,d as F,ft as te,h as I,l as L,mt as ne,ot as re,r as ie,rt as ae,u as oe,ut as se}from"./design-icons-DmYTv2r1.js";import{t as ce}from"./eye-B8okNWXU.js";import{a as le,i as R}from"./format-BNCkW110.js";import{t as ue}from"./message-square-B-MD-8rD.js";import{t as de}from"./play-CmVAj_fu.js";import{a as fe,i as pe,o as me,r as he,s as ge,t as _e}from"./dialog-B7p5oc5r.js";import{d as z,t as ve,y as B}from"./prompt-template-menu-BJfUg1uF.js";import{t as V}from"./project-router-WQWd3UUn.js";import{B as ye,E as be,G 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 Re,s as ze,t as Be,u as Ve,w as He,x as Ue,z as We}from"./agent-accounts-otlDWnij.js";import{d as Ge,f as Ke,i as qe,s as Je,t as Ye,u as Xe}from"./skills-DFBiAuJG.js";import{$ as Ze,F as Qe,L as $e,X as et,Y as tt,pn as nt}from"./index-tN02NX7A.js";import{t as rt}from"./diff-DQfcliZC.js";import{t as it}from"./tab-link-DiNYVlpl.js";var U=e(i(),1),W=a(),at={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function G({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,W.jsx)(L,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:r(t,`text-success`)}):e===`failing`?(0,W.jsx)(M,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:r(t,`text-danger`)}):e===`pending`?(0,W.jsx)(le,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:r(t,`animate-spin text-warning`)}):(0,W.jsx)(I,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:r(t,`text-soft-foreground`)})}function ot(e){return e?.available?e.mergeState:null}function st(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function ct(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 lt(e){return e===`approved`||e===`not-required`?`passing`:e===`unknown`?`unknown`:`failing`}function ut(e){return e===`mergeable`?`passing`:e===`conflicting`?`failing`:`unknown`}function dt(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function ft(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function pt(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function mt(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function K(e){return e?at[e]:`Merge`}function ht(e){return e===`conflicting`?`true`:void 0}function gt({check:e}){return(0,W.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,W.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(G,{state:e.state}),(0,W.jsxs)(`span`,{children:[e.name,` · `,e.state,ft(e.required)]})]}),e.url&&t(e.url)?(0,W.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function _t({reason:e}){return(0,W.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,W.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function vt({state:e,selectedMethod:t,overrideRules:i,mergeEnabled:a,refreshPending:o,onRefresh:s,onRunAgent:c,onConfirm:l,onMethodChange:u,onOverrideChange:d}){let f=ct(e),p=lt(e.reviewDecision),m=ut(e.mergeable);return(0,W.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,W.jsx)(L,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,W.jsx)(P,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,W.jsx)(`h3`,{className:`font-semibold`,children:f}),(0,W.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,disabled:o,onClick:s,children:[(0,W.jsx)(ee,{size:16,"aria-hidden":`true`,className:r(`size-3.5`,o&&`animate-spin`)}),`Refresh`]})]}),(0,W.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[e.headRef,` (`,e.headSha.slice(0,7),`) → `,e.baseRef]}),(0,W.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,W.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(G,{state:p}),(0,W.jsxs)(`span`,{children:[`Reviews: `,e.reviewDecision.replaceAll(`-`,` `)]})]}),(0,W.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(G,{state:m}),(0,W.jsxs)(`span`,{children:[`Conflicts: `,dt(e.mergeable)]})]}),e.checks.length===0?(0,W.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,W.jsx)(gt,{check:e},e.name)),e.blockers.map(e=>(0,W.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&c?(0,W.jsx)(n,{className:`mt-4`,onClick:c,children:`Run agent on this PR`}):null,e.canOverride?(0,W.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,W.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>d(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,W.jsxs)(`span`,{children:[(0,W.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,W.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,W.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,W.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,W.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,W.jsx)(`option`,{value:e,children:at[e]},e))}),(0,W.jsx)(n,{disabled:!a,onClick:l,children:K(t)})]}):null]})]})}function yt({number:e,state:t,selectedMethod:r,confirming:i,overrideRules:a,mergePending:o,mergeError:s,onOpenChange:c,onMerge:l}){return(0,W.jsx)(_e,{open:i,onOpenChange:c,children:(0,W.jsxs)(he,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,W.jsxs)(me,{children:[(0,W.jsxs)(ge,{children:[K(r),` pull request #`,e,`?`]}),(0,W.jsx)(pe,{asChild:!0,children:(0,W.jsxs)(`div`,{children:[(0,W.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,W.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,W.jsx)(`p`,{className:`text-sm text-danger`,children:s.message}):null,(0,W.jsxs)(fe,{children:[(0,W.jsx)(n,{variant:`outline`,disabled:o,onClick:()=>c(!1),children:`Cancel`}),(0,W.jsx)(n,{disabled:o,onClick:l,children:o?`Merging…`:K(r)})]})]})})}function bt({number:e,onRunAgent:t}){let n=s(),r=C(),i=T({queryKey:x.githubMergeState(e),queryFn:({signal:t})=>d(e,{},{signal:t}),retry:!1}),a=ot(i.data),[o,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(!1),[f,m]=(0,U.useState)(!1),h=S({mutationFn:t=>d(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>A(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=st(o,a),_=()=>({mergeState:x.githubMergeState(e),list:x.githubPages(50),comments:x.githubComments(`pr`,e),item:x.githubItem(`pr`,e),refStatus:r===void 0?void 0:x.githubRefStatusOf(r)}),v=S({mutationFn:t=>{if(!a||!g)throw Error(`No merge method is available.`);return p(e,{method:g,expectedHeadSha:a.headSha,...f&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{u(!1),A(`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)=>{A(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,W.jsx)(B,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,W.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":ht(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,W.jsx)(vt,{state:a,selectedMethod:g,overrideRules:f,mergeEnabled:mt(g,a,f),refreshPending:h.isPending,onRefresh:()=>h.mutate(x.githubMergeState(e)),onRunAgent:t,onConfirm:()=>u(!0),onMethodChange:c,onOverrideChange:m}),(0,W.jsx)(yt,{number:e,state:a,selectedMethod:g,confirming:l,overrideRules:f,mergePending:v.isPending,mergeError:v.error,onOpenChange:u,onMerge:()=>v.mutate(_())})]}):(0,W.jsx)(_t,{reason:pt(i.data)})}function xt(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 St(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 Ct(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 q(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 wt({label:e,color:t,plain:n=!1}){return(0,W.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:q(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 Tt(e){return e===`pr`?`pull request`:`issue`}function Et(e,t,n){return e===`pr`&&!!(t||n)}function Dt({backLink:e}){return e?(0,W.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,W.jsx)(ie,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}function Ot({item:e,kindWord:n,commentCount:r,hasDiffStat:i,additions:a,deletions:o}){return(0,W.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,W.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,W.jsx)(`span`,{children:n}),`·`,(0,W.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,W.jsxs)(`span`,{children:[R(e.createdAt),` ago`]}),r?(0,W.jsxs)(W.Fragment,{children:[`·`,(0,W.jsx)(Yt,{count:r})]}):null,i?(0,W.jsxs)(W.Fragment,{children:[`·`,(0,W.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,W.jsxs)(`span`,{className:`text-success`,children:[`+`,a??0]}),` `,(0,W.jsxs)(`span`,{className:`text-danger`,children:[`−`,o??0]})]})]}):null,`·`,t(e.url)?(0,W.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,W.jsx)(E,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,W.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function kt({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,W.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,W.jsx)(it,{to:z(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,W.jsx)(it,{to:z(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,W.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 At({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,W.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,W.jsx)(wt,{label:e,color:t[e]},e)),n?(0,W.jsx)(Xt,{checks:n,url:e.url}):null]}):null}function jt({item:e,colors:t,body:n}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:n?(0,W.jsx)($e,{children:n}):(0,W.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,W.jsx)(Pt,{item:e,colors:t})]})}function Mt({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,children:c}){let l=a?.changes??!1,u=Tt(e.kind),d=y(e.kind,e.number,!l).data?.detail,f=d?.body??e.body,p=d?.additions??e.additions,m=d?.deletions??e.deletions,h=Et(e.kind,p,m),g=r??e.comments;return(0,W.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,W.jsx)(Dt,{backLink:i}),(0,W.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,W.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,W.jsx)(Ot,{item:e,kindWord:u,commentCount:g,hasDiffStat:h,additions:p,deletions:m}),e.kind===`pr`?null:(0,W.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),s,(0,W.jsx)(kt,{item:e,subNav:a,changes:l}),(0,W.jsx)(At,{item:e,colors:t,checks:n}),l&&e.kind===`pr`?(0,W.jsx)(Nt,{item:e}):(0,W.jsx)(jt,{item:e,colors:t,body:f})]}),e.kind===`pr`?(0,W.jsx)(bt,{number:e.number,onRunAgent:o}):null,c]})}function Nt({item:e}){let i=s(),a=_(e.number),[o,c]=(0,U.useState)(``),[u,d]=(0,U.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,U.useEffect)(()=>{p.length>0&&!p.some(e=>e.path===u)&&d(p[0].path)},[f?.available?f.headSha:``,o]);let h=async()=>{let t=f?.available?f.headSha:null,n=x.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),A(`The reviewed revision changed.`))};if(a.isPending)return(0,W.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(a.isError||!f)return(0,W.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!f.available)return(0,W.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:f.reason});let g=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,W.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,W.jsxs)(`strong`,{children:[f.files.length,` changed files`]}),(0,W.jsxs)(`span`,{className:`text-success`,children:[`+`,f.additions]}),(0,W.jsxs)(`span`,{className:`text-danger`,children:[`−`,f.deletions]}),(0,W.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:f.headSha,children:[`head `,f.headSha.slice(0,8)]}),(0,W.jsx)(n,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void h(),children:`Refresh`})]}),f.truncated?(0,W.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,W.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,W.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,W.jsxs)(`aside`,{className:`min-w-0`,children:[(0,W.jsx)(`input`,{"aria-label":`Filter changed files`,value:o,onChange:e=>c(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,W.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,W.jsx)(`option`,{children:e.path},e.path))}),(0,W.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:p.map(e=>(0,W.jsx)(`li`,{children:(0,W.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,W.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,W.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,W.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,W.jsx)(nt,{})}),(0,W.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,W.jsx)(F,{size:16})})]}),p.length===0?(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(rt,{files:g.filter(e=>e.path===u),wrap:!0,className:`min-w-0`}),y&&!y.patch?(0,W.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,y.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Pt({item:e,colors:t}){let n=y(e.kind,e.number),r=n.data,i=(0,U.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(Ft(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,W.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,W.jsx)(B,{className:`mb-3 h-3 w-24`}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(B,{className:`h-14 w-full`}),(0,W.jsx)(B,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,W.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,W.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,W.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,W.jsx)(E,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,W.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,W.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,W.jsx)(`ul`,{className:`flex flex-col gap-5`,children:It(i).map(e=>e.group===`commits`?(0,W.jsx)(Lt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,W.jsx)(qt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,W.jsx)(Rt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,W.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,W.jsx)(E,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Ft=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function It(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 Lt({commits:e,colors:t}){let[n,r]=(0,U.useState)(!1),i=e[0]?.actor??`?`;return n?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,W.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,W.jsx)(`span`,{"aria-hidden":`true`,children:J.committed}),(0,W.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,W.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,W.jsx)(Rt,{event:e,colors:t},e.id))]}):(0,W.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,W.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,W.jsx)(`span`,{"aria-hidden":`true`,children:J.committed}),(0,W.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,W.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,W.jsx)(`span`,{className:`shrink-0`,children:R(e[e.length-1].createdAt)})]})})}var J={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Rt({event:e,colors:t}){return(0,W.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,W.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:J[e.kind]}),(0,W.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,W.jsx)(Wt,{event:e,colors:t}),(0,W.jsx)(`span`,{className:`shrink-0`,children:R(e.createdAt)}),e.url?(0,W.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,W.jsx)(E,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function zt({event:e}){return(0,W.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,W.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,W.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,W.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,W.jsx)(Gt,{checks:e.checks})]})}function Bt({event:e,colors:t}){return(0,W.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,W.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,W.jsx)(`span`,{"data-slot":`gh-event-label`,style:q(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,W.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function Vt({event:e}){return(0,W.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Ht({event:e}){return(0,W.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Ut={committed:e=>(0,W.jsx)(zt,{event:e}),labeled:(e,t)=>(0,W.jsx)(Bt,{event:e,colors:t}),unlabeled:(e,t)=>(0,W.jsx)(Bt,{event:e,colors:t}),assigned:e=>(0,W.jsx)(Vt,{event:e}),unassigned:e=>(0,W.jsx)(Vt,{event:e}),merged:()=>(0,W.jsx)(`span`,{children:`merged this`}),closed:()=>(0,W.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,W.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,W.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,W.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,W.jsx)(Ht,{event:e})};function Wt({event:e,colors:t}){return Ut[e.kind]?.(e,t)??null}function Gt({checks:e}){return e?(0,W.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:r(`shrink-0`,X[e]),children:Y[e]}):null}var Kt={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 qt({comment:e}){let t=e.reviewState?Kt[e.reviewState]:null;return(0,W.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,W.jsx)(Jt,{url:e.avatarUrl,login:e.author}),(0,W.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,W.jsx)(`span`,{children:R(e.createdAt)}),t?(0,W.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,W.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,W.jsx)(E,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,W.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,W.jsx)($e,{children:e.body}):(0,W.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Jt({url:e,login:t}){let[n,r]=(0,U.useState)(!1);return e&&!n?(0,W.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,W.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 Y={passing:`✓`,failing:`✗`,pending:`○`},X={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Yt({count:e}){return e?(0,W.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,W.jsx)(ue,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Xt({checks:e,url:t}){let n=r(`text-[11px] font-medium`,X[e],t&&`hover:underline`),i=`${Y[e]} checks ${e}`;return t?(0,W.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:i}):(0,W.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:i})}function Zt({checks:e}){return(0,W.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`,X[e]),children:Y[e]})}function Z(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=Z(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=Z(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=m(),n=b(),r=f(t.data),i=n.data?.defaultRunner,a=be(e.runner,r,i??r[0]??`claude`),o=w(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),p=Ae(a,d,o.data);return{runner:a,runnerExplicit:e.runner!==null,model:d,effort:s?``:He(e.effort,p),effortOptions:p,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,U.useRef)(null),o=(0,U.useRef)(null),[s,c]=(0,U.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,U.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,U.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,_=b(),v=w(u),y=De(u,v.data,[e.model,_.data?.defaultModels?.[u]]),x=n||!h,S=r?l.accounts:[],C=m.length>1||m.some(e=>Be(S,e))?(0,W.jsx)(ke,{icon:(0,W.jsx)(re,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:m,value:u,accounts:S,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,W.jsx)(Re,{icon:(0,W.jsx)(N,{"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:He(e.effort,r)})},options:y.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Ue(u,v.data,v.isError,v.isFetching)},`model`),E=(0,W.jsx)(Re,{icon:(0,W.jsx)(j,{"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,W.jsx)(`div`,{ref:a,"data-slot":`engine-row-box`,children:(0,W.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,W.jsx)(Ne,{children:s?[C,E,T]:[C,T,E]})})}):(0,W.jsxs)(Ne,{children:[C,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:l,selectedSkills:u,onSkillsChange:d,engine:f,onEngineChange:p,queuedRunId:m,onQueued:h}){let g=s(),_=v(),y=xe(),b=e.kind===`pr`?`PR`:`issue`,C=u.filter(e=>i.some(t=>t.name===e)),[w]=(0,U.useState)(()=>Z(e)),[T,E]=(0,U.useState)(()=>mn(e.url)||w),D=an(f),O=(0,U.useRef)(null),k=(0,U.useRef)(null);(0,U.useEffect)(()=>{hn(e.url,T===w?``:T)},[e.url,T,w]);let j=(0,U.useMemo)(()=>Me(je(_.data?.promptTemplates),{automations:y}),[_.data?.promptTemplates,y]),ee=e=>{let t=O.current,n=Fe({prompt:T,base:w,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:k.current}),r=Ve(T,n,e);E(r.text),k.current=r.caret,requestAnimationFrame(()=>{O.current?.focus(),O.current?.setSelectionRange(r.caret,r.caret)})},M=Pe(j,C),N=(0,U.useRef)(T);N.current=T;let P=(0,U.useRef)(``);(0,U.useEffect)(()=>{let e=Le(N.current,P.current,M,w);P.current=e.applied,e.text!==N.current&&E(e.text)},[M,w]);let F=S({mutationFn:async()=>D.canRun?o(rn(e,a,C,T,sn(D))):null,onSuccess:t=>{if(t===null)return;let n=t;n&&h(e.url,n.id),A(`Added to the queue — ${b} #${e.number}`),C.length>0&&_.data!==void 0&&c({skillUsage:C.reduce((e,t)=>Ye(e,t),_.data.skillUsage)}).then(()=>g.invalidateQueries({queryKey:x.uiState})).catch(()=>{}),hn(e.url,``),E(w),P.current=``,g.invalidateQueries({queryKey:x.runs.all})},onError:e=>A(e.message,{tone:`danger`})}),te=e=>{tt({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(),!F.isPending&&D.canRun&&F.mutate())},I=e=>d(u.includes(e)?u.filter(t=>t!==e):[...u,e]);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,W.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,W.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,W.jsx)(`span`,{children:`Instructions for the agent`}),(0,W.jsx)(Ze,{ref:O,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:T,onChange:e=>E(e.target.value),onSelect:e=>{k.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,W.jsx)(ve,{templates:j,onInsert:ee}),(0,W.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,W.jsxs)(`div`,{className:`gh-field`,children:[(0,W.jsx)(`span`,{children:`Workflow`}),(0,W.jsx)(_n,{workflows:r,value:a,onChange:l})]}),(0,W.jsxs)(`div`,{className:`gh-field`,children:[(0,W.jsx)(`span`,{children:`Skills · select one or more`}),(0,W.jsx)(yn,{skills:i,skillUsage:_.data?.skillUsage,selected:C,onToggle:I})]}),C.length>0?(0,W.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:C.map(e=>(0,W.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>I(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,W.jsx)(ne,{size:16,"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,W.jsx)(cn,{layout:`row`,pick:f,onChange:p,disabled:F.isPending||!D.canRun,accounts:!0}),(0,W.jsxs)(`div`,{className:`gh-field`,children:[(0,W.jsx)(`span`,{children:`Account`}),(0,W.jsx)(vn,{resolved:D,disabled:F.isPending||!D.canRun,onPick:e=>p({...f,account:e})})]}),!D.providerPending&&!D.canRun?(0,W.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[D.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,W.jsx)(V,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,W.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,W.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[t(e.url)?(0,W.jsx)(n,{asChild:!0,variant:`outline`,children:(0,W.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,W.jsxs)(n,{variant:`primary`,"data-action":`gh-run`,disabled:F.isPending||!D.canRun,onClick:()=>F.mutate(),children:[(0,W.jsx)(de,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,b]}),(0,W.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:et()}),m?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,W.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,W.jsx)(V,{to:`/tasks/${m}`,"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,U.useState)(!1),[o,s]=(0,U.useState)(``),c=(0,U.useRef)(null),l=Ge(e,o);return(0,W.jsxs)(k,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,W.jsx)(O,{asChild:!0,children:(0,W.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:r(ze,t&&`border-foreground/60 font-mono text-[11px] font-semibold text-foreground`),children:[(0,W.jsx)(te,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,W.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,W.jsx)(oe,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,W.jsx)(D,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,W.jsxs)(Te,{shouldFilter:!1,children:[(0,W.jsx)(Ee,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,W.jsxs)(ye,{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,W.jsx)(Se,{children:`Nothing matches.`}):null,(0,W.jsx)(H,{children:l.map(e=>{let r=t===e.name;return(0,W.jsxs)(We,{value:`workflow ${e.name}`,keywords:Ke(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,W.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,W.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,W.jsx)(Re,{icon:(0,W.jsx)(se,{"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,U.useState)(!1),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(null),d=(0,U.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=Xe(e,s,t),g=(e,t)=>{let a=n.includes(e.name);return(0,W.jsxs)(We,{value:`skill ${e.name} ${e.path}`,keywords:Ke(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,W.jsx)(`span`,{className:r(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,W.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,W.jsx)(ce,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,W.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,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Qe,{skill:l,onClose:()=>u(null)}),(0,W.jsxs)(k,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,W.jsx)(O,{asChild:!0,children:(0,W.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:r(ze,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,W.jsx)(ae,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,W.jsx)(oe,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,W.jsx)(D,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,W.jsxs)(Te,{shouldFilter:!1,children:[(0,W.jsx)(Ee,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,W.jsxs)(ye,{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,W.jsx)(Se,{children:`Nothing matches.`}):null,h?h.length>0?(0,W.jsx)(H,{children:h.map(e=>g(e,qe(e)))}):null:(0,W.jsxs)(W.Fragment,{children:[f.length>0?(0,W.jsx)(H,{heading:`Most used`,children:f.map(e=>g(e,qe(e)))}):null,p.length>0?(0,W.jsx)(H,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,W.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=s(),{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,c=(0,U.useSyncExternalStore)(a,i,i),l=g(),d=h(),f=v(),p=l.data?.workflows;(0,U.useEffect)(()=>{p&&c.workflow!==null&&!p.some(e=>e.name===c.workflow)&&o({workflow:null})},[o,p,c.workflow]);let m=(0,U.useMemo)(()=>Je(d.data??[],f.data?.skillUsage),[d.data,f.data?.skillUsage]);return{...c,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{Yt as a,It as c,q as d,Ct as f,Zt as i,xt as l,gn as n,Mt as o,Qt as r,wt as s,Sn as t,St as u};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,t as n,u as r}from"./button-DGwhwRuD.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{A as o,Kt as s,T as c,Ur as l,Yt as u,i as d}from"./project-scope-context-bgdvGX9z.js";import{At as f,Lt as p,Nt as ee,n as te,nn as m}from"./queries-BJM44umy.js";import{n as h}from"./toaster-CoMJoQvk.js";import{C as g,Q as _,S as ne,X as v,a as re,ct as ie,dt as y,l as ae,lt as b,mt as x,n as oe,rt as se,st as S,u as ce,x as C,y as w}from"./design-icons-DmYTv2r1.js";import{i as T,p as le,r as E,t as D}from"./dropdown-menu-DPrTX-zi.js";import{a as O,c as k,i as A,n as j,o as M,r as ue,s as N,t as P}from"./alert-dialog-CH4SXGfX.js";import{i as F,o as de,r as I,s as L,t as R}from"./dialog-B7p5oc5r.js";import{_ as fe,a as z,d as pe,g as me,h as B,i as V,l as he,m as ge,o as _e,p as ve,r as ye,s as be,t as H,v as U}from"./sortable.esm-zp_qkYGV.js";import{i as W,l as xe,s as Se}from"./skills-DFBiAuJG.js";import{t as Ce}from"./centered-state-B5QmAy2y.js";import{$ as G,O as we,Zt as K}from"./index-tN02NX7A.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
|
+
`)?[`${r}${e}: |`,...t.split(`
|
|
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
|
+
`)}\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)(ce,{"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)(K,{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)(G,{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)(b,{"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)(C,{"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)(y,{"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)(S,{"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)(G,{"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)(y,{"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)(x,{"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)(G,{"data-slot":`wb-import-text`,"aria-label":`Workflow YAML to import`,rows:4,spellCheck:!1,placeholder:`name: my-flow
|
|
5
|
+
skills:
|
|
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)(_,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(K,{"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)(g,{"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)(se,{"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)(K,{"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)(A,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(N,{children:[(0,Q.jsxs)(k,{children:[`“`,e,`” already exists`]}),(0,Q.jsx)(O,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,Q.jsxs)(M,{children:[(0,Q.jsx)(ue,{children:`Keep the file`}),(0,Q.jsx)(j,{"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)(A,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(N,{children:[(0,Q.jsxs)(k,{children:[`Delete workflow “`,e,`”?`]}),(0,Q.jsxs)(O,{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)(M,{children:[(0,Q.jsx)(ue,{children:`Keep the file`}),(0,Q.jsx)(j,{"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)(D,{children:[(0,Q.jsx)(le,{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)(ne,{"aria-hidden":`true`,className:`size-4`})})}),(0,Q.jsx)(E,{align:`end`,children:(0,Q.jsxs)(T,{"data-slot":`wb-step-remove`,"aria-label":`Remove step ${e+1}: ${t}`,onSelect:a,children:[(0,Q.jsx)(S,{"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)(re,{"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)(oe,{"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}=ge({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`,W(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)(v,{"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)(ae,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(w,{"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=p(),r=f(),i=ee(),a=l(),[g,_]=(0,q.useState)(null),[ne,re]=(0,q.useState)(``),[y,b]=(0,q.useState)(!1),[x,oe]=(0,q.useState)(``),[se,S]=(0,q.useState)(null),[ce,C]=(0,q.useState)(!1),[w,T]=(0,q.useState)(``),[le,E]=(0,q.useState)(``),[D,O]=(0,q.useState)(!1),[k,A]=(0,q.useState)(``),[j,M]=(0,q.useState)(!1),[ue,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),ge=xe(V,x,i.data?.skillUsage);(0,q.useEffect)(()=>{if(g!==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`);_(r?st(r):$())},[g,t.data,e]);let H=e=>_(t=>t===null?t:{...t,steps:e}),U=m({mutationFn:e=>s(e),onSuccess:e=>{_({name:e.name,description:e.description??``,steps:e.steps}),C(!1),T(``),E(``),h(`Imported "${e.name}" — review, then Save.`)},onError:e=>E(e.message)}),W=m({mutationFn:e=>u(e),onSuccess:e=>{_(t=>{let n=t??$(),{name:r,steps:i}=Le(e,n.name);return{...n,name:r,steps:i}}),O(!1),A(``),h(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??g?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>h(e instanceof Error?e.message:String(e),{tone:`danger`})}),G=m({mutationFn:e=>c({...Re(g?.name??``,g?.description??``,g?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:e=>{M(!1),h(`Saved — ${e.path.split(`/`).pop()??e.path}`),a.invalidateQueries({queryKey:te.workflows})},onError:e=>{e instanceof d&&e.exists===!0?M(!0):h(e instanceof Error?e.message:String(e),{tone:`danger`})}}),K=m({mutationFn:e=>o(e),onSuccess:(e,t)=>{N(!1),h(`Deleted "${t}".`),_($()),a.invalidateQueries({queryKey:te.workflows})},onError:e=>{N(!1),h(e instanceof Error?e.message:String(e),{tone:`danger`})}}),Te=fe(me(pe,{activationConstraint:{distance:4}}),me(he,{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)(ie,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(g===null)return(0,Q.jsx)(we,{});let J=g.steps,Y=g.name.trim(),X=z.find(e=>e.name===Y&&e.source===`file`),Ae=Pe(g.name,g.description,J),Z=(e,t=J.length)=>{if(J.length>=8){h(`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:()=>_($()),children:[(0,Q.jsx)(v,{"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:g,trimmedName:Y,nameRef:L,onDraft:_,onLoadWorkflow:e=>_(st(e))}),(0,Q.jsx)(Be,{savedFile:X,autoOpen:D,onImportToggle:()=>{E(``),O(!1),C(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(g.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},onAutoToggle:()=>{C(!1),O(e=>!e)},onDeleteRequest:()=>N(!0)}),D?(0,Q.jsx)(Ve,{text:k,onTextChange:A,pending:W.isPending,onRun:()=>{let e=k.trim();e===``||W.isPending||W.mutate(e)},onCancel:()=>{O(!1),A(``)}}):null,(0,Q.jsx)(He,{open:ce,onOpenChange:C,text:w,onTextChange:T,error:le,pending:U.isPending,onRun:()=>{let e=w.trim();e!==``&&U.mutate(e)},onCancel:()=>{C(!1),T(``),E(``)}}),(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:()=>{S(null),oe(``),b(!0)},children:[(0,Q.jsx)(v,{"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){h(`Add at least one step first.`,{tone:`danger`});return}G.mutate(!1)},children:[(0,Q.jsx)(ae,{"aria-hidden":`true`,className:`size-3`}),`Save`]})]})]}),(0,Q.jsx)(Ue,{paletteSkills:V,query:ne,onQueryChange:re,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:y,onOpenChange:b,query:x,onQueryChange:oe,matches:ge,skillsCount:B.length,error:r.isError?r.error.message:null,selectedSkill:se,onSelectSkill:S,stepsCount:J.length,onCloseAutoFocus:e=>{e.preventDefault(),R.current?.focus()},onCancel:()=>b(!1),onAdd:e=>{Z(e),b(!1)}}),(0,Q.jsx)(Ke,{trimmedName:Y,savedFile:X,overwriteOpen:j,onOverwriteDismiss:()=>M(!1),deleteOpen:ue,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}=B({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)(H,{items:e.map(e=>e.id),strategy:z,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}=V({id:e.id,data:{type:`step`,step:e}});return(0,Q.jsxs)(`li`,{ref:u,style:{transform:U.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};
|
package/web/dist/index.html
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
}
|
|
48
48
|
})()
|
|
49
49
|
</script>
|
|
50
|
-
<script type="module" crossorigin src="/assets/index-
|
|
50
|
+
<script type="module" crossorigin src="/assets/index-tN02NX7A.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">
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
<link rel="modulepreload" crossorigin href="/assets/useQuery-C0ee1rw5.js">
|
|
60
60
|
<link rel="modulepreload" crossorigin href="/assets/ws-WW6DrfbT.js">
|
|
61
61
|
<link rel="modulepreload" crossorigin href="/assets/toaster-CoMJoQvk.js">
|
|
62
|
-
<link rel="modulepreload" crossorigin href="/assets/queries-
|
|
62
|
+
<link rel="modulepreload" crossorigin href="/assets/queries-BJM44umy.js">
|
|
63
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-DTn4s5Lh.js">
|
|
@@ -67,18 +67,18 @@
|
|
|
67
67
|
<link rel="modulepreload" crossorigin href="/assets/dist-ClnpAEgV.js">
|
|
68
68
|
<link rel="modulepreload" crossorigin href="/assets/dropdown-menu-DPrTX-zi.js">
|
|
69
69
|
<link rel="modulepreload" crossorigin href="/assets/attention-CVI366xV.js">
|
|
70
|
-
<link rel="modulepreload" crossorigin href="/assets/use-desktop-
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/use-desktop-Ct4lvA3b.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="/assets/nav-row-styles-DSBuSnEE.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-vraIzoEF.js">
|
|
76
76
|
<link rel="modulepreload" crossorigin href="/assets/alert-dialog-CH4SXGfX.js">
|
|
77
77
|
<link rel="modulepreload" crossorigin href="/assets/dialog-B7p5oc5r.js">
|
|
78
78
|
<link rel="modulepreload" crossorigin href="/assets/project-router-WQWd3UUn.js">
|
|
79
|
-
<link rel="modulepreload" crossorigin href="/assets/agent-accounts-
|
|
79
|
+
<link rel="modulepreload" crossorigin href="/assets/agent-accounts-otlDWnij.js">
|
|
80
80
|
<link rel="modulepreload" crossorigin href="/assets/skills-DFBiAuJG.js">
|
|
81
|
-
<link rel="modulepreload" crossorigin href="/assets/prompt-template-menu-
|
|
81
|
+
<link rel="modulepreload" crossorigin href="/assets/prompt-template-menu-BJfUg1uF.js">
|
|
82
82
|
<link rel="modulepreload" crossorigin href="/assets/sortable.esm-zp_qkYGV.js">
|
|
83
83
|
<link rel="modulepreload" crossorigin href="/assets/centered-state-B5QmAy2y.js">
|
|
84
84
|
<link rel="modulepreload" crossorigin href="/assets/lib-BxQXEXDF.js">
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{l as t,o as n,u as r}from"./button-DGwhwRuD.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{$ as o,F as s,N as c,P as l,X as u,Z as d,at as f,it as p,nt as m,z as h}from"./live-protocol-aMLJJ0MQ.js";import{P as g,c as _,ut as v}from"./queries-Ce9CPdRy.js";import{Q as ee,u as y}from"./design-icons-DmYTv2r1.js";import{h as b,l as x}from"./es2015-DTn4s5Lh.js";import{c as S,i as C,p as w,r as T,s as te,t as E}from"./dropdown-menu-DPrTX-zi.js";import{d as D,l as O,m as k,p as A}from"./alert-dialog-CH4SXGfX.js";import{i as j,o as M,r as N,s as P,t as ne}from"./dialog-B7p5oc5r.js";var F=e(i(),1);function I(e){return e?.capabilities?.automations===!0}function L(){let e=g().data,t=(0,F.useRef)(void 0);(0,F.useEffect)(()=>{e&&(t.current=e)},[e]);let n=e??t.current;return n?I(n)?`available`:`unavailable`:`unknown`}function re(){return L()===`available`}var ie=1,ae=.9,oe=.8,se=.17,ce=.1,le=.999,ue=.9999,de=.99,fe=/[\\\/_+.#"@\[\(\{&]/,pe=/[\\\/_+.#"@\[\(\{&]/g,me=/[\s-]/,he=/[\s-]/g;function R(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?ie:de;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=R(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=ie:fe.test(e.charAt(l-1))?(d*=oe,p=e.slice(i,l-1).match(pe),p&&i>0&&(d*=le**+p.length)):me.test(e.charAt(l-1))?(d*=ae,m=e.slice(i,l-1).match(he),m&&i>0&&(d*=le**+m.length)):(d*=se,i>0&&(d*=le**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=ue)),(d<ce&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=R(e,t,n,r,l+1,a+2,o),f*ce>d&&(d=f*ce)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function ge(e){return e.toLowerCase().replace(he,` `)}function _e(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,R(e,t,ge(e),ge(t),0,0,{})}var z=`[cmdk-group=""]`,ve=`[cmdk-group-items=""]`,ye=`[cmdk-group-heading=""]`,be=`[cmdk-item=""]`,xe=`${be}:not([aria-disabled="true"])`,Se=`cmdk-item-select`,B=`data-value`,Ce=(e,t,n)=>_e(e,t,n),we=F.createContext(void 0),V=()=>F.useContext(we),Te=F.createContext(void 0),H=()=>F.useContext(Te),Ee=F.createContext(void 0),De=F.forwardRef((e,t)=>{let n=G(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=G(()=>new Set),i=G(()=>new Map),a=G(()=>new Map),o=G(()=>new Set),s=Re(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=x(),ee=x(),y=x(),S=F.useRef(null),C=Be();W(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),W(()=>{C(6,k)},[]);let w=F.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),C(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(y);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=A()?.id,w.emit()}),r||C(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=F.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,te(t,r)),C(2,()=>{E(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{O(),E(),n.current.value||D(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();C(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:y,labelId:ee,listInnerRef:S}),[]);function te(e,t){let r=s.current?.filter??Ce;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(ve);t?t.appendChild(e.parentElement===t?e:e.closest(`${ve} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${ve} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${z}[${B}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(B);w.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=te(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(z)?.querySelector(ye))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return S.current?.querySelector(`${be}[aria-selected="true"]`)}function j(){return Array.from(S.current?.querySelectorAll(xe)||[])}function M(e){let t=j()[e];t&&w.setState(`value`,t.getAttribute(B))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(B))}function P(e){let t=A()?.closest(z),n;for(;t&&!n;)t=e>0?Ie(t,z):Le(t,z),n=t?.querySelector(xe);n?w.setState(`value`,n.getAttribute(B)):N(e)}let ne=()=>M(j().length-1),I=e=>{e.preventDefault(),e.metaKey?ne():e.altKey?P(1):N(1)},L=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return F.createElement(b.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&I(e);break;case`ArrowDown`:I(e);break;case`p`:case`k`:g&&e.ctrlKey&&L(e);break;case`ArrowUp`:L(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),ne();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(Se);t.dispatchEvent(e)}}}}},F.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:He},c),q(e,e=>F.createElement(Te.Provider,{value:w},F.createElement(we.Provider,{value:T},e))))}),Oe=F.forwardRef((e,t)=>{let r=x(),i=F.useRef(null),a=F.useContext(Ee),o=V(),s=Re(e),c=s.current?.forceMount??a?.forceMount;W(()=>{if(!c)return o.item(r,a?.id)},[c]);let l=ze(r,i,[e.value,e.children,i],e.keywords),u=H(),d=K(e=>e.value&&e.value===l.current),f=K(e=>c||o.filter()===!1?!0:!e.search||e.filtered.items.get(r)>0);F.useEffect(()=>{let t=i.current;if(!(!t||e.disabled))return t.addEventListener(Se,p),()=>t.removeEventListener(Se,p)},[f,e.onSelect,e.disabled]);function p(){var e,t;m(),(t=(e=s.current).onSelect)==null||t.call(e,l.current)}function m(){u.setState(`value`,l.current,!0)}if(!f)return null;let{disabled:h,value:g,onSelect:_,forceMount:v,keywords:ee,...y}=e;return F.createElement(b.div,{ref:n(i,t),...y,id:r,"cmdk-item":``,role:`option`,"aria-disabled":!!h,"aria-selected":!!d,"data-disabled":!!h,"data-selected":!!d,onPointerMove:h||o.getDisablePointerSelection()?void 0:m,onClick:h?void 0:p},e.children)}),ke=F.forwardRef((e,t)=>{let{heading:r,children:i,forceMount:a,...o}=e,s=x(),c=F.useRef(null),l=F.useRef(null),u=x(),d=V(),f=K(e=>a||d.filter()===!1?!0:!e.search||e.filtered.groups.has(s));W(()=>d.group(s),[]),ze(s,c,[e.value,e.heading,l]);let p=F.useMemo(()=>({id:s,forceMount:a}),[a]);return F.createElement(b.div,{ref:n(c,t),...o,"cmdk-group":``,role:`presentation`,hidden:!f||void 0},r&&F.createElement(`div`,{ref:l,"cmdk-group-heading":``,"aria-hidden":!0,id:u},r),q(e,e=>F.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":r?u:void 0},F.createElement(Ee.Provider,{value:p},e))))}),Ae=F.forwardRef((e,t)=>{let{alwaysRender:r,...i}=e,a=F.useRef(null),o=K(e=>!e.search);return!r&&!o?null:F.createElement(b.div,{ref:n(a,t),...i,"cmdk-separator":``,role:`separator`})}),je=F.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=H(),o=K(e=>e.search),s=K(e=>e.selectedItemId),c=V();return F.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),F.createElement(b.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Me=F.forwardRef((e,t)=>{let{children:r,label:i=`Suggestions`,...a}=e,o=F.useRef(null),s=F.useRef(null),c=K(e=>e.selectedItemId),l=V();return F.useEffect(()=>{if(s.current&&o.current){let e=s.current,t=o.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),F.createElement(b.div,{ref:n(o,t),...a,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":c,"aria-label":i,id:l.listId},q(e,e=>F.createElement(`div`,{ref:n(s,l.listInnerRef),"cmdk-list-sizer":``},e)))}),Ne=F.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return F.createElement(O,{open:n,onOpenChange:r},F.createElement(k,{container:o},F.createElement(A,{"cmdk-overlay":``,className:i}),F.createElement(D,{"aria-label":e.label,"cmdk-dialog":``,className:a},F.createElement(De,{ref:t,...s}))))}),Pe=F.forwardRef((e,t)=>K(e=>e.filtered.count===0)?F.createElement(b.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Fe=F.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return F.createElement(b.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},q(e,e=>F.createElement(`div`,{"aria-hidden":!0},e)))}),U=Object.assign(De,{List:Me,Item:Oe,Input:je,Group:ke,Separator:Ae,Dialog:Ne,Empty:Pe,Loading:Fe});function Ie(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Le(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Re(e){let t=F.useRef(e);return W(()=>{t.current=e}),t}var W=typeof window>`u`?F.useEffect:F.useLayoutEffect;function G(e){let t=F.useRef();return t.current===void 0&&(t.current=e()),t}function K(e){let t=H(),n=()=>e(t.snapshot());return F.useSyncExternalStore(t.subscribe,n,n)}function ze(e,t,n,r=[]){let i=F.useRef(),a=V();return W(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(B,s),i.current=s}),i}var Be=()=>{let[e,t]=F.useState(),n=G(()=>new Map);return W(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Ve(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function q({asChild:e,children:t},n){return e&&F.isValidElement(t)?F.cloneElement(Ve(t),{ref:t.ref},n(t.props.children)):n(t)}var He={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},J=a();function Ue({className:e,...t}){return(0,J.jsx)(U,{"data-slot":`command`,className:r(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function We({title:e=`Command Palette`,description:n=`Search for a command to run...`,children:i,className:a,showCloseButton:o=!0,filter:s,...c}){return(0,J.jsxs)(ne,{...c,children:[(0,J.jsxs)(M,{className:`sr-only`,children:[(0,J.jsx)(P,{children:e}),(0,J.jsx)(j,{children:n})]}),(0,J.jsx)(N,{className:r(`overflow-hidden p-0`,a),showCloseButton:o,children:(0,J.jsx)(Ue,{...t({filter:s}),className:`**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:i})})]})}function Ge({className:e,...t}){return(0,J.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex min-h-11 shrink-0 items-center gap-2 rounded-ss-[inherit] rounded-se-[inherit] border-b px-3`,children:[(0,J.jsx)(ee,{className:`size-4 shrink-0 opacity-50`}),(0,J.jsx)(U.Input,{"data-slot":`command-input`,className:r(`flex h-11 min-w-0 flex-1 rounded-md bg-transparent py-3 text-base md:text-sm placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]})}function Ke({className:e,onPointerMoveCapture:t,...n}){return(0,J.jsx)(U.List,{"data-slot":`command-list`,onPointerMoveCapture:e=>{t?.(e),e.pointerType===`touch`&&e.stopPropagation()},className:r(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...n})}function qe({...e}){return(0,J.jsx)(U.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function Je({className:e,...t}){return(0,J.jsx)(U.Group,{"data-slot":`command-group`,className:r(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function Ye({className:e,...t}){return(0,J.jsx)(U.Separator,{"data-slot":`command-separator`,className:r(`-mx-1 h-px bg-border`,e),...t})}function Xe({className:e,...t}){return(0,J.jsx)(U.Item,{"data-slot":`command-item`,className:r(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...t})}function Ze({className:e,...t}){return(0,J.jsx)(`span`,{"data-slot":`command-shortcut`,className:r(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}var Qe=`default`,$e=m({id:f(),label:f(),path:f(),exists:d()}),et=m({id:f(),provider:c,label:f(),configDir:f(),path:f(),exists:d(),looksValid:d(),isDefault:d(),status:l.optional(),files:u($e)});function tt(e){return e.isDefault?`default:${e.provider}`:e.id}var Y=h();m({editable:d(),profiles:u(et),profileCapableProviders:u(c),selections:p(f(),Y),defaults:Y}),m({projectId:f().min(1).max(64).nullable(),provider:c,profileId:f().max(64).nullable()}),m({selections:p(f(),Y),defaults:Y}),m({status:l}),m({available:d(),reason:f().optional(),fields:u(m({label:f(),value:f()}))}),m({file:f().min(1).max(200),target:f().min(1).max(64).optional()}),m({opened:o(!0),path:f()}),m({provider:c,label:f().trim().max(200).optional(),configDir:f().trim().min(1).max(4096)}),m({profile:et}),m({label:f().trim().max(200).optional(),configDir:f().trim().min(1).max(4096).optional()}),m({removed:o(!0),id:f()});var nt=`quick-task`;function rt(e,t,n=24){return[t,...(e??[]).filter(e=>!(e.source===t.source&&e.ref===t.ref))].slice(0,n)}var it=[{id:`claude`,label:`claude`,desc:`Claude Code CLI`},{id:`codex`,label:`codex`,desc:`OpenAI Codex (app-server)`},{id:`opencode`,label:`opencode`,desc:`OpenCode (serve)`},{id:`pi`,label:`pi`,desc:`pi CLI (provider/model)`},{id:`cursor`,label:`Cursor`,desc:`Cursor CLI`},{id:`omp`,label:`OMP`,desc:`Oh My Pi CLI (provider/model)`}],X={claude:[{id:``,label:`auto`,desc:`Pick the best model per step`},{id:`opus`,label:`opus`,desc:`Deep reasoning for hard tasks`},{id:`sonnet`,label:`sonnet`,desc:`Fast and cheap`},{id:`haiku`,label:`haiku`,desc:`Fastest — simple, scoped tasks`}],codex:[{id:``,label:`auto`,desc:`Use your Codex default model`}],opencode:[{id:``,label:`auto`,desc:`Use your OpenCode default model`}],cursor:[{id:``,label:`auto`,desc:`Use your Cursor default model`}],pi:[{id:``,label:`auto`,desc:`Use your pi default model`}],omp:[{id:``,label:`auto`,desc:`Use your OMP default model`}]},Z=[{value:``,label:`auto`,desc:`Harness default`},{value:`low`,label:`low`,desc:`Less reasoning, faster replies`},{value:`medium`,label:`medium`,desc:`Balanced reasoning`},{value:`high`,label:`high`,desc:`More reasoning for hard tasks`},{value:`xhigh`,label:`xhigh`,desc:`Extra-high reasoning`},{value:`max`,label:`max`,desc:`Maximum reasoning`}];function at(e,t,n){let r=e===`cursor`?[Z[0]]:Z,i=s(e)&&(e!==`cursor`||n?.runner===e)?n?.models.find(e=>e.id===t)?.effortLevels:void 0;if(!i?.length)return r;let a=[Z[0]],o=new Set;for(let e of i){if(o.has(e))continue;let t=Z.find(t=>t.value===e);t&&(o.add(e),a.push(t))}return a.length>1?a:r}function ot(e,t){let n=e??``;return t.some(e=>e.value===n)?n:``}var st=[`opencode`,`pi`,`omp`];function ct(e,t){return t===`cursor`||!e||X[t].some(t=>t.id===e)?!1:t!==`claude`&&[`claude-fable-5`,`claude-opus-4-8`,`claude-sonnet-5`,`claude-haiku-4-5`].includes(e)?!0:Object.entries(X).some(([n,r])=>n!==t&&!st.includes(n)&&r.some(t=>t.id!==``&&t.id===e))}function lt(e,t,n=[]){let r=t?.runner===e?t.models:[],i=X[e]??X.claude,a=[...r.length?i.slice(0,1):i],o=new Set(a.map(e=>e.id));if(s(e))for(let e of r)!e.id||o.has(e.id)||(o.add(e.id),a.push({id:e.id,label:e.label||e.id,desc:e.description}));for(let t of n)!t||o.has(t)||ct(t,e)||(o.add(t),a.push({id:t,label:t,desc:`Custom or legacy model`}));return a}var ut={claude:`Claude`,codex:`Codex`,opencode:`OpenCode`,pi:`Pi`,cursor:`Cursor`,omp:`OMP`};function dt(e,t,n=!1,r=!1){if(!s(e))return;let i=ut[e];if(t?.stale)return`Using cached ${i} model list`;if(n||t?.source===`unavailable`)return`Latest ${i} models unavailable`;if(r&&!t)return`Loading ${i} models…`}function ft(e){let t=it.map(e=>e.id).filter(t=>e.some(e=>e.name===t&&e.available));return t.length>0?t:[`claude`]}function pt(e,t,n){return e!==null&&t.includes(e)?e:t.includes(n)?n:t[0]??`claude`}function mt(e,t,n=!1){return!n&&e===t?void 0:e}function ht(e,t,n,r){let i=lt(t,r,[e,n?.[t]]);if(e!==null&&i.some(t=>t.id===e))return e;let a=n?.[t];return a!==void 0&&i.some(e=>e.id===a)?a:``}function gt(e,t,n){return e.source===`skill`?t.some(t=>t.name===e.ref):n.some(t=>t.name===e.ref)}function _t(e,t,n){return e&>(e,t,n)?e:null}function vt(e){let{task:t,source:n,model:r,modelsLocked:i,effort:a,runner:o,runnerExplicit:s,defaultRunner:c,agentProfile:l,images:u,worktree:d,autonomous:f,archiveWhenDone:p,autoMergePr:m,allowWorkers:h,allowMessaging:g}=e;return{task:t,...n?.source===`skill`?{steps:[{id:`task`,name:n.ref,skill:n.ref,prompt:`{{task}}`}]}:{workflow:n?.ref??`quick-task`},model:i?void 0:r||void 0,effort:i?void 0:a||void 0,runner:mt(o,c,s),agentProfile:l||void 0,images:u.length>0?[...u]:void 0,worktree:d!==!1&&void 0,autonomous:f===!0||void 0,...yt({archiveWhenDone:p,autoMergePr:m,allowWorkers:h,allowMessaging:g})}}function yt(e){return{...e.archiveWhenDone?{archiveWhenDone:!0}:{},...e.autoMergePr?{autoMergePr:!0}:{},...e.allowWorkers===!1?{allowWorkers:!1}:{},...e.allowMessaging===!1?{allowMessaging:!1}:{}}}function bt(e,t){return t?{...e,notify:!0}:e}function xt(e){return`/tasks/${e.id}`}var St=80,Ct=2e3,wt=50,Tt=200,Et=50,Dt=[{id:`add-tests`,label:`Add tests`,text:`Also add or update tests covering this change.`},{id:`explain-change`,label:`Explain the change`,text:`Explain what changed and why before finishing.`},{id:`keep-minimal`,label:`Keep it minimal`,text:`Keep the change as small and targeted as possible — no unrelated refactors.`},{id:`update-docs`,label:`Update docs`,text:`Also update any relevant documentation or comments.`},{id:`check-edge-cases`,label:`Double-check edge cases`,text:`Double-check edge cases and error handling before finishing.`},{id:`create-automation`,label:`Create an automation`,skills:[`create-cezarion-automation`],text:`Create an automation for this repository.
|
|
2
|
-
Trigger: <a GitHub event or a schedule, e.g. every new pull request; every issue labelled \`needs-agent\`; every day at 04:00; weekdays at 07:30; every 6 hours>.
|
|
3
|
-
Task for each run: <what the launched task must do, e.g. review the diff, run the tests and post findings as a review comment>.
|
|
4
|
-
Leave it paused and, for a GitHub trigger, preview its matches so I can check the filter before enabling it.`}],Ot=new Set([`create-automation`]);function kt(e,t){return t.automations===!0?e:e.filter(e=>!Ot.has(e.id))}function At(e){return!!e&&typeof e==`object`}function jt(e){if(e===void 0||!Array.isArray(e))return Dt.map(e=>({...e}));let t=new Set,n=[];for(let r of e){if(!At(r))continue;let e=typeof r.id==`string`?r.id.trim():``,i=typeof r.label==`string`?r.label.trim():``,a=typeof r.text==`string`?r.text.trim():``;if(!e||!i||!a||t.has(e))continue;t.add(e);let o=Mt(r.skills);if(n.push({id:e,label:i.slice(0,St),text:a.slice(0,Ct),...o.length>0?{skills:o}:{}}),n.length>=wt)break}return n}function Mt(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(!e||t.has(e))&&(t.add(e.slice(0,Tt)),t.size>=Et))break}return[...t]}function Nt(e,t){if(t.length===0)return[];let n=new Set(t);return e.filter(e=>e.skills?.some(e=>n.has(e)))}function Pt(e,t){return Nt(e,t).map(e=>e.text).join(`
|
|
5
|
-
|
|
6
|
-
`)}function Ft(e,t,n,r=``){if(e===``||e===r||e===t){let e=r&&n?`${r}\n\n${n}`:r||n;return{text:e,applied:n?e:``}}return{text:e,applied:t}}function It(){return`tpl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function Lt(e,t,n){let r=Math.max(0,Math.min(t,e.length)),i=e.slice(0,r),a=e.slice(r),o=``;i.length>0&&(o=i.endsWith(`
|
|
7
|
-
|
|
8
|
-
`)?``:i.endsWith(`
|
|
9
|
-
`)?`
|
|
10
|
-
`:`
|
|
11
|
-
|
|
12
|
-
`);let s=a.replace(/^[ \t]+/,``),c=``;return s.length>0&&(c=s.startsWith(`
|
|
13
|
-
|
|
14
|
-
`)?``:s.startsWith(`
|
|
15
|
-
`)?`
|
|
16
|
-
`:`
|
|
17
|
-
|
|
18
|
-
`),{text:i+o+n+c+s,caret:i.length+o.length+n.length}}function Rt({prompt:e,base:t,selectionStart:n,focused:r,remembered:i}){return e===t?e.length:r&&n!=null||n!=null&&n>0?n:i??e.length}var zt=`inline-flex h-[26px] min-w-0 max-w-full items-center gap-1.5 rounded-full border border-control-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:border-dashed disabled:bg-muted`,Bt=(0,J.jsx)(y,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-supporting-foreground`}),Vt=(0,F.createContext)(null),Q=e=>Number.parseFloat(e)||0;function Ht({pill:e,box:t,full:n}){let r=getComputedStyle(e),i=[...e.children].filter(e=>{if(e===t)return!1;let n=getComputedStyle(e);return n.display!==`none`&&n.position!==`absolute`});return i.reduce((e,t)=>e+t.getBoundingClientRect().width,0)+Q(r.columnGap)*i.length+n.getBoundingClientRect().width+Q(r.paddingLeft)+Q(r.paddingRight)+Q(r.borderLeftWidth)+Q(r.borderRightWidth)}function Ut(e){for(let t=e.parentElement;t;t=t.parentElement){if(t.dataset.slot===`picker-pill-disabled-wrapper`)continue;let e=getComputedStyle(t).display;if(e===`grid`||e===`flex`)return t}return e.parentElement}function Wt(e){let t=new Map;for(let n of e){let e=Ut(n.pill),r=t.get(e)??new Map,i=Math.round(n.pill.getBoundingClientRect().top);r.set(i,[...r.get(i)??[],n]),t.set(e,r)}for(let[e,n]of t){let t=getComputedStyle(e),r=e.clientWidth-Q(t.paddingLeft)-Q(t.paddingRight);for(let e of n.values())if(e.reduce((e,t)=>e+Ht(t),0)+Q(t.columnGap)*(e.length-1)>r+.5)return!1}return!0}function Gt({children:e}){let t=(0,F.useRef)(new Map),n=(0,F.useRef)(null),[r,i]=(0,F.useState)(!0),a=(0,F.useCallback)(()=>i(Wt([...t.current.values()])),[]),o=(0,F.useCallback)((e,r)=>{if(t.current.set(e,r),typeof ResizeObserver<`u`){n.current??=new ResizeObserver(a);for(let e of[r.box,r.full,Ut(r.pill)])n.current.observe(e)}return a(),()=>{if(t.current.delete(e),typeof ResizeObserver<`u`)for(let e of[r.box,r.full])n.current?.unobserve(e);a()}},[a]);(0,F.useLayoutEffect)(()=>()=>n.current?.disconnect(),[]);let s=(0,F.useMemo)(()=>({register:o,showPrefixes:r}),[o,r]);return(0,J.jsx)(Vt.Provider,{value:s,children:e})}function Kt({field:e,children:t}){let n=(0,F.useRef)(null),i=(0,F.useRef)(null),a=(0,F.useContext)(Vt),o=a?.register,s=(0,F.useId)(),[c,l]=(0,F.useState)(!0);(0,F.useLayoutEffect)(()=>{let e=n.current,t=i.current;if(o){let n=e.closest(`[data-slot$="pill"]`);return n?o(s,{pill:n,box:e,full:t}):void 0}let r=()=>l(t.getBoundingClientRect().width<=e.getBoundingClientRect().width+.5);if(r(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(r);return a.observe(e),a.observe(t),()=>a.disconnect()},[e,t,s,o]);let u=a!==null,d=u?a.showPrefixes:c,f=u&&!d;return(0,J.jsxs)(`span`,{ref:n,className:`relative min-w-0 overflow-hidden`,"aria-hidden":`true`,children:[(0,J.jsxs)(`span`,{ref:i,className:r(`invisible w-max whitespace-nowrap`,f?`absolute left-0 top-0`:`block`),children:[e,` · `,t]}),(0,J.jsxs)(`span`,{"data-slot":`picker-label`,className:r(`block truncate`,f?`relative`:`absolute inset-0`),children:[d?(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[e,` · `]}):null,t]})]})}function qt({fieldLabel:e,ariaLabel:t,label:n,options:r,value:i}){return e?`${t} · ${typeof n==`string`?n:r.find(e=>e.value===i)?.label??i}`:t}function Jt({readOnly:e,disabled:t,hint:n,disabledHint:r}){return e?r??n:t?r:n}function Yt({fieldLabel:e,fullLabel:t,explanation:n}){return e?[t,n].filter(Boolean).join(` — `):n}function Xt({icon:e,fieldLabel:t,ariaLabel:n,label:r}){return(0,J.jsxs)(J.Fragment,{children:[e,t?(0,J.jsx)(Kt,{field:n,children:r}):(0,J.jsx)(`span`,{className:`min-w-0 truncate`,title:typeof r==`string`?r:void 0,children:r})]})}function Zt({slot:e,ariaLabel:t,label:n,value:i,options:a,onPick:o,disabled:s=!1,readOnly:c=!1,hint:l,disabledHint:u,status:d,searchPlaceholder:f,icon:p,fieldLabel:m=!1}){let[h,g]=(0,F.useState)(!1),[_,v]=(0,F.useState)(``),b=(0,F.useRef)(null),x=(0,F.useRef)(null),D=f?a.filter(e=>e.label.toLowerCase().includes(_.trim().toLowerCase())):a;(0,F.useEffect)(()=>{if(!h||!f)return;let e=window.setTimeout(()=>b.current?.focus());return()=>window.clearTimeout(e)},[h,f]);let O=e=>{b.current&&document.activeElement===b.current&&e.preventDefault()},k=p?` h-11 gap-2 rounded-lg border-border px-3 text-foreground`:``,A=qt({fieldLabel:m,ariaLabel:t,label:n,options:a,value:i}),j=Yt({fieldLabel:m,fullLabel:A,explanation:Jt({readOnly:c,disabled:s,hint:l,disabledHint:u})}),M=Xt({icon:p,fieldLabel:m,ariaLabel:t,label:n});if(c)return(0,J.jsxs)(`span`,{"data-slot":e,"aria-label":A,title:j,className:r(zt,k,`cursor-default hover:bg-card hover:text-muted-foreground`),children:[M,m?(0,J.jsx)(`span`,{className:`sr-only`,children:A}):null]});let N=(0,J.jsxs)(`button`,{type:`button`,"data-slot":e,"aria-label":A,disabled:s,title:j,className:r(zt,k),children:[M,p?(0,J.jsx)(y,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-muted-foreground`}):Bt]});return s?(0,J.jsx)(`span`,{"data-slot":`picker-pill-disabled-wrapper`,title:j,className:`inline-flex min-w-0 max-w-full`,children:N}):(0,J.jsxs)(E,{open:h,onOpenChange:e=>{g(e),e||v(``)},children:[(0,J.jsx)(w,{asChild:!0,children:N}),(0,J.jsxs)(T,{ref:x,align:`start`,"data-testid":`${e}-menu`,children:[f?(0,J.jsxs)(`div`,{"data-slot":`picker-search`,className:`mbe-1 flex min-h-11 min-w-56 items-center gap-2 border-b border-border px-2`,children:[(0,J.jsx)(ee,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,J.jsx)(`input`,{ref:b,type:`search`,"aria-label":f,placeholder:f,value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation();let t=x.current?.querySelectorAll(`[role="menuitemradio"]:not([data-disabled])`);(e.key===`ArrowDown`?t?.[0]:t?.[t.length-1])?.focus()}else e.key!==`Escape`&&e.stopPropagation()},className:`h-11 w-0 min-w-0 flex-1 bg-transparent text-sm placeholder:text-muted-foreground`})]}):null,(0,J.jsx)(te,{value:i,onValueChange:o,children:D.map(e=>(0,J.jsx)(S,{value:e.value,className:r(`gap-2.5`,f&&`min-h-11`),onPointerMove:O,onPointerLeave:O,onKeyDown:t=>{b.current&&(t.key===`ArrowUp`&&e===D[0]||t.key===`Tab`&&t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),b.current.focus())},children:(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,J.jsx)(`span`,{className:`text-[13px] font-medium`,children:e.label}),e.desc?(0,J.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.desc}):null]})},e.value))}),f&&D.length===0?(0,J.jsx)(`p`,{role:`status`,className:`px-2 py-5 text-center text-xs text-muted-foreground`,children:`No matches found.`}):null,d?(0,J.jsx)(C,{disabled:!0,onPointerMove:O,onPointerLeave:O,className:`border-t border-border text-[11px] text-muted-foreground`,children:d}):null]})]})}var $=(e,t)=>t===null?e:`${e}:${t}`;function Qt({runners:e,value:t,onPick:n,disabled:r=!1,accounts:i=[],account:a=null,repoAccount:o,icon:s,fieldLabel:c}){let l=it.filter(t=>e.includes(t.id)).flatMap(e=>{let t=i.filter(t=>t.provider===e.id);return t.length<2?[{value:$(e.id,null),label:e.id,desc:e.desc}]:t.map(t=>({value:$(e.id,t.id),label:`${e.id} · ${t.label}`,desc:t.configDir}))}),u=a??o?.[t]??`default`,d=l.some(e=>e.value===$(t,u))?$(t,u):$(t,null);return(0,J.jsx)(Zt,{icon:s,fieldLabel:c,slot:`runner-pill`,ariaLabel:`Runner`,label:l.find(e=>e.value===d)?.label??t,value:d,disabled:r,onPick:e=>{let[t,r]=e.split(`:`);n(t,r??null)},options:l})}function $t(){let e=_(),t=v(),n=(e.data?.profiles??[]).map(e=>({provider:e.provider,id:e.id,label:e.label,configDir:e.configDir})),r=t.data?.info?.root;return{accounts:n,repoAccount:r?e.data?.selections?.[r]:void 0}}function en(e,t){return e.filter(e=>e.provider===t).length>1}export{yt as A,Ke as B,rt as C,_t as D,pt as E,We as F,re as G,Ze as H,qe as I,Je as L,Qe as M,tt as N,mt as O,Ue as P,Ge as R,lt as S,ht as T,I as U,Ye as V,L as W,it as _,Qt as a,at as b,Dt as c,It as d,jt as f,nt as g,kt as h,Gt as i,bt as j,xt as k,Pt as l,Rt as m,$t as n,Bt as o,Ft as p,Zt as r,zt as s,en as t,Lt as u,ft as v,ot as w,dt as x,vt as y,Xe as z};
|