@staff0rd/assist 0.1133.0 → 0.1133.1

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.
@@ -1 +1 @@
1
- 0.1133.0
1
+ 0.1133.1
@@ -4003,7 +4003,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4003
4003
  `)){let n=t[t.length-1];r.startsWith("@@")||n===void 0?t.push(r):t[t.length-1]=`${n}
4004
4004
  ${r}`}return t}function Y$r(e){return j$r(e??"").filter(t=>t.startsWith("@@"))}function VDo(e){return Number(/^@@ -(\d+)/.exec(e)?.[1]??1)}function WDo(e){return/^@@[^@]*@@/.exec(e)?.[0]??e.split(`
4005
4005
  `)[0]??""}function K$r(e,t){return e.reduce((r,n)=>r+q$r(n,t),0)}function X$r(e,t,r){let n=Y$r(e.patch),o=[],i=[];return n.forEach((a,s)=>{let l=r.get(`${e.path}#${s}`)??[];l.includes(t)?o.push(a):i.push({oldStart:VDo(a),header:WDo(a),slice:l[0]??0})}),o.length===0||i.length===0?e:{...e,patch:o.join(`
4006
- `),additions:K$r(o,"+"),deletions:K$r(o,"-"),split:{hunks:o.length,of:n.length,elsewhere:i}}}function Z$r(e){return e.flatMap(t=>{if(t.kind==="dir")return Z$r(t.children);let{kind:r,name:n,...o}=t;return[o]})}function GDo(e){let t=new Map;return e.forEach((r,n)=>{for(let o of r.hunks)t.set(o,[...t.get(o)??[],n+1])}),t}function Q$r(e,t,r=new Set,n=new Set){let o=Z$r(e.tree).filter(a=>!r.has(a.path)).map(a=>n.has(a.path)?{...a,critical:!0}:a),i=GDo(t);return t.map((a,s)=>{let l=new Set(a.hunks.map(tq));return G$r(o.filter(u=>l.has(u.path)).map(u=>X$r(u,s+1,i)))})}function qDo(e,t){let r=-1,n=0;return t.forEach((o,i)=>{let a=o.hunks.filter(s=>tq(s)===e).length;a>n&&(r=i,n=a)}),r}function J$r(e,t){let r=t.map(()=>[]);for(let n of e)r[qDo(n.path,t)]?.push(n);return r}function e9r(e,t){let r=Q$r(e.structure,t,new Set(e.tests.map(i=>i.path)),new Set(e.criticalDiffs.map(i=>i.path))),n=J$r(e.tests,t),o=A4e(t);return t.map((i,a)=>{let s=a+1;return{number:s,slice:i,structure:r[a]??e.structure,tests:n[a]??[],critical:e.criticalDiffs.filter(l=>o.get(l.path)?.some(u=>u.number===s))}})}function t9r(e){if(!e.slices)return;let t=e9r(e,e.slices);return{entries:B$r(e,t),slicing:{count:t.length,noCritical:new Set(t.filter(r=>r.critical.length===0).map(r=>r.number))}}}function r9r(e){if(!(!e.repo||!e.headSha))return`${e.repo}#${e.prNumber}@${e.headSha}`}var Lut="assist:high-level-progress:",jDo=`${Lut}head:`,YDo=720*60*60*1e3,wie=e=>`${Lut}${e}`,Iut=e=>`${jDo}${e}`,Aut=e=>ll(e)[0];function KDo(e,t){let r=e?Aut(wie(e)):void 0;return e&&Cv(wie(e)),r??(t?Aut(Iut(t)):void 0)}function n9r(e,t,r){return Tx(Lut,YDo),Aut(wie(e))??KDo(t,r)}function o9r(e,t,r){Rl(wie(e),[r]),t&&Rl(Iut(t),[r])}function i9r(e,t){Cv(wie(e)),t&&Cv(Iut(t))}function a9r(e){let t=e;return typeof t?.id=="string"&&typeof t.title=="string"&&typeof t.reason=="string"&&(t.kind==="deterministic"||t.kind==="manual")&&["pass","fail","manual"].includes(t.status)}function tM(e,t){return Array.isArray(e)?t?e.filter(t):e:[]}var uq={repo:"",prNumber:0,headSha:"",checks:[],structure:{tree:[],added:0,removed:0,modified:0,additions:0,deletions:0},criticalDiffs:[],criticalPaths:[],tests:[],testPaths:[],collapsedPaths:[]};function s9r(e){let t;try{t=JSON.parse(e)}catch{return uq}return typeof t!="object"||t===null?uq:{repo:typeof t.repo=="string"?t.repo:uq.repo,prNumber:typeof t.prNumber=="number"?t.prNumber:uq.prNumber,headSha:typeof t.headSha=="string"?t.headSha:uq.headSha,checks:tM(t.checks,a9r),structure:{...uq.structure,...t.structure},criticalDiffs:tM(t.criticalDiffs),criticalPaths:tM(t.criticalPaths),tests:tM(t.tests),testPaths:tM(t.testPaths),collapsedPaths:tM(t.collapsedPaths),...Array.isArray(t.slices)?{slices:t.slices}:{},...t.manualTesting?{manualTesting:t.manualTesting}:{},...t.saved?{saved:t.saved}:{},...t.draft?{draft:t.draft}:{}}}function l9r(e){let t=(0,Q4e.useMemo)(()=>s9r(e.body),[e.body]),r=(0,Q4e.useMemo)(()=>t9r(t),[t]),n=r9r(t),o=(0,Q4e.useMemo)(()=>n9r(e.requestId,e.supersedes,n)??t.draft??t.saved,[e.requestId,e.supersedes,n,t]);return{payload:t,sliced:r,progress:o,head:n}}var c9r=S(oe(),1);function u9r(e){let[t,r]=(0,c9r.useState)(()=>e?.reviewComments??[]);return{queued:t,onQueue:n=>r(o=>[...o,n]),onRemove:n=>r(o=>o.filter((i,a)=>a!==n)),onEdit:(n,o)=>r(i=>i.map((a,s)=>s===n?{...a,note:o}:a))}}var d9r=S(oe(),1);function f9r(e,t,r,n){(0,d9r.useEffect)(()=>{o9r(e,t,{items:r,reviewComments:n})},[e,t,r,n])}function h9r(e,t,r){let{payload:n,sliced:o,progress:i,head:a}=l9r(e),s=O$r(n.checks,i,o?.slicing),l=u9r(i),u=_$r(o?.entries??[]),{comments:d,sentTo:f,clearSent:p}=d4e(t,r),h={...d,onQueue:l.onQueue};f9r(e.requestId,a,s.items,l.queued);let m=(0,p9r.useMemo)(()=>L$r(n),[n]);return{payload:n,checklist:s,queue:l,details:A$r(n,h),counts:m,sentTo:f,clearSent:p,sliced:o,nav:u,diffComments:h,head:a}}var Xx=S(R(),1);function m9r({preview:e,session:t,sendInput:r,onDecision:n}){let o=h9r(e,t,r);return(0,Xx.jsxs)(W,{sx:Ny,children:[(0,Xx.jsx)(xh,{preview:e,draft:!1}),(0,Xx.jsx)(lq,{items:e.metadata??[]}),(0,Xx.jsx)(qn,{}),(0,Xx.jsx)(d$r,{payload:o.payload,checklist:o.checklist,details:o.details,counts:o.counts,sliced:o.sliced,nav:o.nav,comments:o.diffComments}),(0,Xx.jsx)(qn,{}),(0,Xx.jsx)(C$r,{pane:o,onDecision:(i,a)=>{i9r(e.requestId,o.head),n(i,a)}}),(0,Xx.jsx)(Py,{sessionName:o.sentTo,onClose:o.clearSent})]})}var w9r=S(oe(),1);var rM=S(R(),1);function XDo(e){return e.topLeft===null?"Click the top-left box":e.bottomRight===null?"Now click the bottom-right box":"Both anchors picked"}function g9r({selection:e,onConfirm:t,onReject:r}){let n=e.topLeft!==null&&e.bottomRight!==null;return(0,rM.jsxs)(St,{direction:"row",spacing:1,sx:{p:2,alignItems:"center",justifyContent:"flex-end"},children:[(0,rM.jsx)(Te,{variant:"body2",sx:{flex:1,color:"text.secondary"},children:XDo(e)}),(0,rM.jsx)(it,{color:"error",variant:"outlined",onClick:r,children:"Cancel"}),(0,rM.jsx)(it,{variant:"outlined",onClick:e.reset,children:"Start over"}),(0,rM.jsx)(it,{color:"success",variant:"contained",disabled:!n,onClick:t,children:"Extract boxes"})]})}var ZDo={"top-left":tc.miro.topLeft,"bottom-right":tc.miro.bottomRight};function y9r(e,t){let r=e.right-e.left,n=e.bottom-e.top;return{width:r,height:n,fontSize:Math.max(6,Math.min(n*.3,r/6,28)),radius:Math.min(8,n/4),colour:t?ZDo[t]:tc.miro.box,opacity:t?.75:.35,strokeWidth:Math.max(1,r*.004)}}var Cie=S(R(),1);function v9r({box:e,role:t,onSelect:r}){let n=y9r(e,t);return(0,Cie.jsxs)("g",{role:"button",tabIndex:0,"aria-label":t?`${e.text} (${t})`:e.text,onClick:()=>r(e.id),onKeyDown:o=>{o.key==="Enter"&&r(e.id)},style:{cursor:"pointer"},children:[(0,Cie.jsx)("rect",{x:e.left,y:e.top,width:n.width,height:n.height,rx:n.radius,fill:n.colour,fillOpacity:n.opacity,stroke:n.colour,strokeWidth:n.strokeWidth}),(0,Cie.jsx)("text",{x:e.left+n.width/2,y:e.top+n.height/2,textAnchor:"middle",dominantBaseline:"central",fontSize:n.fontSize,fill:tc.miro.text,children:e.text})]})}function b9r(e){if(e.length===0)return"0 0 100 100";let t=Math.min(...e.map(a=>a.left)),r=Math.min(...e.map(a=>a.top)),n=Math.max(...e.map(a=>a.right))-t,o=Math.max(...e.map(a=>a.bottom))-r,i=Math.max(n*.02,8);return`${t-i} ${r-i} ${n+i*2} ${o+i*2}`}var J4e=S(R(),1);function x9r({boxes:e,selection:t}){return(0,J4e.jsx)(W,{sx:{flex:1,minHeight:0,overflow:"auto",p:2},children:(0,J4e.jsx)("svg",{role:"img","aria-label":"Miro board boxes",viewBox:b9r(e),preserveAspectRatio:"xMidYMid meet",style:{width:"100%",height:"100%"},children:e.map(r=>(0,J4e.jsx)(v9r,{box:r,role:t.roleOf(r.id),onSelect:t.choose},r.id))})})}function QDo(e){return typeof e?.id=="string"&&typeof e.text=="string"&&[e.left,e.top,e.right,e.bottom].every(t=>typeof t=="number"&&Number.isFinite(t))}function S9r(e){try{let t=JSON.parse(e);return Array.isArray(t?.boxes)?t.boxes.filter(QDo):[]}catch{return[]}}var Dut=S(oe(),1);function T9r(){let[e,t]=(0,Dut.useState)(null),[r,n]=(0,Dut.useState)(null);return{topLeft:e,bottomRight:r,choose:s=>{if(e===null||r!==null){t(s),n(null);return}n(s)},reset:()=>{t(null),n(null)},roleOf:s=>s===e?"top-left":s===r?"bottom-right":null}}var zR=S(R(),1);function C9r({preview:e,onDecision:t}){let r=(0,w9r.useMemo)(()=>S9r(e.body),[e.body]),n=T9r();return(0,zR.jsxs)(W,{sx:Ny,children:[(0,zR.jsx)(xh,{preview:e,draft:!1}),(0,zR.jsx)(qn,{}),(0,zR.jsx)(x9r,{boxes:r,selection:n}),(0,zR.jsx)(qn,{}),(0,zR.jsx)(g9r,{selection:n,onConfirm:()=>{let{topLeft:i,bottomRight:a}=n;i===null||a===null||t("approve",Oc({topLeft:i,bottomRight:a}))},onReject:()=>t("reject",Oc())})]})}var tFr=S(oe(),1);function k9r(e){let t=[];return e.map(r=>(t.length=r+1,t[r]=(t[r]??0)+1,t.map(n=>n??1).join(".")))}function e5e(e){return e*22}function _9r(e){return Math.round(e/22)}var E9r={display:"flex",alignItems:"flex-start",gap:.25,"& .criterion-action":{opacity:0,transition:"opacity 120ms"},"&:hover .criterion-action":{opacity:1},"&:focus-within .criterion-action":{opacity:1},"& .criterion-action:focus-visible":{opacity:1}},R9r={p:.25,mt:"2px",color:"text.disabled",cursor:"grab",touchAction:"none","&:active":{cursor:"grabbing"}},P9r={fontFamily:"fontFamilyMono",fontSize:"0.8rem",color:"text.secondary",minWidth:32,pt:"5px",textAlign:"right",userSelect:"none",whiteSpace:"nowrap"},A9r={flex:1,fontSize:"inherit",lineHeight:1.5,px:.75,py:0,borderRadius:1,"&:hover":{bgcolor:"action.hover"},"&.Mui-focused":{bgcolor:"action.selected"}},Mut={p:.25,mt:"2px"},L9r={position:"absolute",right:8,height:2,borderRadius:1,bgcolor:"primary.main",pointerEvents:"none"};var D9r=S(R(),1),JDo=8;function I9r({drag:e}){return e?(0,D9r.jsx)(W,{sx:L9r,style:{top:e.top-1,left:JDo+e5e(e.depth)}}):null}var M9r=S(R(),1),N9r=ot((0,M9r.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");var Nut=S(R(),1);function O9r({number:e,onGrip:t}){return(0,Nut.jsx)(Vt,{size:"small",className:"criterion-action",sx:R9r,"aria-label":`Reorder criterion ${e}`,onPointerDown:t,children:(0,Nut.jsx)(N9r,{fontSize:"inherit"})})}var gC=S(R(),1);function B9r({number:e,onAdd:t,onDelete:r}){return(0,gC.jsxs)(gC.Fragment,{children:[(0,gC.jsx)(Vt,{size:"small",className:"criterion-action",sx:Mut,"aria-label":`Add criterion after ${e}`,onClick:t,children:(0,gC.jsx)(Vd,{fontSize:"inherit"})}),(0,gC.jsx)(Vt,{size:"small",className:"criterion-action",sx:Mut,"aria-label":`Delete criterion ${e}`,onClick:r,children:(0,gC.jsx)(Bo,{fontSize:"inherit"})})]})}var t5e=S(oe(),1);function $9r(e,t){return e==="start"?0:e==="end"?t:Math.min(Math.max(e,0),t)}function F9r(e){let t=(0,t5e.useRef)(null);return(0,t5e.useEffect)(()=>{let r=t.current;if(!e||!r)return;r.focus();let n=$9r(e.caret,r.value.length);r.setSelectionRange(n,n)},[e]),t}var nM=S(R(),1);function z9r({index:e,number:t,item:r,outline:n,dragging:o,onGrip:i}){let a=F9r(n.focus?.index===e?n.focus:null),s={marginLeft:e5e(r.depth),opacity:o?.4:1};return(0,nM.jsxs)(W,{sx:E9r,"data-criterion-row":!0,style:s,children:[(0,nM.jsx)(O9r,{number:t,onGrip:i}),(0,nM.jsx)(W,{component:"span",sx:P9r,"aria-hidden":"true",children:`${t}.`}),(0,nM.jsx)(oa,{multiline:!0,value:r.text,sx:A9r,inputRef:a,inputProps:{"aria-label":`Criterion ${t}`},onChange:l=>n.onText(e,l.target.value),onKeyDown:l=>n.onKeyDown(e,l)}),(0,nM.jsx)(B9r,{number:t,onAdd:()=>n.onAdd(e),onDelete:()=>n.onDelete(e)})]})}var j9r=S(oe(),1);function H9r(e,t,{key:r,shift:n,alt:o,caret:i,text:a}){return o||n?null:r==="ArrowUp"&&i===0&&t>0?{kind:"focus",index:t-1}:r==="ArrowDown"&&i===a.length&&t<e.length-1?{kind:"focus",index:t+1}:null}function HR(e){if(e.length===0)return[{text:"",depth:0}];let t=-1;return e.map(r=>{let n=Math.min(Math.max(r.depth,0),t+1);return t=n,r.depth===n?r:{...r,depth:n}})}function r5e(e,t,r,n){let o=e[t]?.depth??0,i=e.map((a,s)=>s===t?{...a,text:r}:a);return{items:HR([...i.slice(0,t+1),{text:n,depth:o},...i.slice(t+1)]),index:t+1}}function Gm(e,t){let r=t+1;for(;r<e.length&&e[r].depth>e[t].depth;)r+=1;return r}function n5e(e,t){let r=e[t].depth;for(let n=t-1;n>=0;n-=1){if(e[n].depth<r)return-1;if(e[n].depth===r)return n}return-1}function U9r(e,t){let r=Gm(e,t);return r<e.length&&e[r].depth===e[t].depth?r:-1}function V9r(e,t,r){let n=r<0?n5e(e,t):U9r(e,t);if(n<0)return null;let o=Gm(e,t),i=e.slice(t,o),a=[...e.slice(0,t),...e.slice(o)],s=r<0?n:Gm(e,n)-(o-t);return{items:[...a.slice(0,s),...i,...a.slice(s)],index:s}}function o5e(e,t){let r=Gm(e,t),n=e.map((o,i)=>i>t&&i<r?{...o,depth:o.depth-1}:o).filter((o,i)=>i!==t);return{items:HR(n),index:Math.max(0,t-1)}}function W9r(e,t,r){if(r<0&&e[t].depth===0||r>0&&n5e(e,t)<0)return null;let n=Gm(e,t);return e.map((o,i)=>i>=t&&i<n?{...o,depth:o.depth+r}:o)}function i5e(e,t){return e?{kind:"edit",edit:e,caret:t}:null}function eMo(e,t,{caret:r,text:n}){let o=n.slice(0,r);return i5e(r5e(e,t,o,n.slice(r)),"start")}function tMo(e,t,{shift:r,caret:n}){let o=W9r(e,t,r?-1:1);return i5e(o?{items:o,index:t}:null,n)}function G9r(e,t,r){let{key:n,shift:o,alt:i,caret:a,text:s}=r;return n==="Enter"&&!o?eMo(e,t,r):n==="Tab"?tMo(e,t,r):i&&(n==="ArrowUp"||n==="ArrowDown")?i5e(V9r(e,t,n==="ArrowUp"?-1:1),a):n==="Backspace"&&a===0&&s===""?i5e(o5e(e,t),"end"):null}function q9r(e,t,r){return G9r(e,t,r)??H9r(e,t,r)}function Y9r(e,t){let[r,n]=(0,j9r.useState)(null),o=(a,s)=>{a&&(t(a.items),n({index:a.index,caret:s}))};return{focus:r,onKeyDown:(a,s)=>{let l=s.currentTarget;(s.key==="Enter"||s.key==="Tab")&&s.preventDefault();let u=q9r(e,a,{key:s.key,shift:s.shiftKey,alt:s.altKey,caret:l.selectionStart??0,text:l.value});u&&(s.preventDefault(),u.kind==="focus"?n({index:u.index,caret:"end"}):o(u.edit,u.caret))},onDrop:a=>o(a,"end"),onText:(a,s)=>t(e.map((l,u)=>u===a?{...l,text:s}:l)),onAdd:a=>o(r5e(e,a,e[a].text,""),"start"),onDelete:a=>o(o5e(e,a),"end")}}var J9r=S(oe(),1);function rMo(e,t,r,n){let o=t.length;for(let a=0;a<e.length;a+=1)if(n<e[a].top+e[a].height/2){o=a;break}let i=Gm(t,r);return o>r&&o<i?r:o}function nMo(e,t,r,n){let o=Gm(e,t),i=r-1,a=i>=t&&i<o?t-1:i,s=a>=0?e[a].depth+1:0;return Math.max(0,Math.min(e[t].depth+_9r(n),s))}function oMo(e,t){if(t<e.length)return e[t].top;let r=e[e.length-1];return r?r.top+r.height:0}function K9r(e,t,r,n,o){let i=rMo(e,t,r,o);return{target:i,depth:nMo(t,r,i,n),top:oMo(e,i)}}function iMo(e){let t=e.getBoundingClientRect().top;return{boxes:Array.from(e.querySelectorAll("[data-criterion-row]")).map(n=>{let o=n.getBoundingClientRect();return{top:o.top-t,height:o.height}}),origin:t}}function X9r(e,t,r,n){return o=>{let{boxes:i,origin:a}=iMo(t);return K9r(i,e,r,o.clientX-n,o.clientY-a)}}function Z9r(e,t,r,n,o){let i=new AbortController,a=null,s=d=>{a=r(d),n(a)},l=()=>{i.abort(),a&&o(a)},u={signal:i.signal};return e.setPointerCapture(t),e.addEventListener("pointermove",s,u),e.addEventListener("pointerup",l,u),e.addEventListener("pointercancel",l,u),s}function Q9r(e,t,r,n){let o=Gm(e,t),i=n-e[t].depth,a=e.slice(t,o).map(u=>({...u,depth:Math.max(0,u.depth+i)})),s=[...e.slice(0,t),...e.slice(o)],l=r>t?r-a.length:r;return{items:HR([...s.slice(0,l),...a,...s.slice(l)]),index:l}}function eFr(e,t,r){let[n,o]=(0,J9r.useState)(null);return{drag:n,onGrip:a=>s=>{let l=t.current;if(!l||s.pointerType==="mouse"&&s.button!==0)return;s.preventDefault(),Z9r(s.currentTarget,s.pointerId,X9r(e,l,a,s.clientX),d=>o({from:a,depth:d.depth,top:d.top}),d=>{o(null),r(Q9r(e,a,d.target,d.depth))})(s)}}}var kie=S(R(),1),aMo={my:1,px:1,py:.5,border:1,borderColor:"divider",borderRadius:1,position:"relative",userSelect:"text",cursor:"auto"},sMo=[{text:"",depth:0}];function rFr({items:e,onChange:t}){let r=(0,tFr.useRef)(null),n=e.length>0?e:sMo,o=Y9r(n,t),{drag:i,onGrip:a}=eFr(n,r,o.onDrop),s=k9r(n.map(l=>l.depth));return(0,kie.jsxs)(W,{sx:aMo,ref:r,"data-preview-skip":!0,"aria-label":"Acceptance criteria",children:[n.map((l,u)=>(0,kie.jsx)(z9r,{index:u,number:s[u],item:l,outline:o,dragging:i?.from===u,onGrip:a(u)},`criterion-${u}`)),(0,kie.jsx)(I9r,{drag:i})]})}var nFr=S(R(),1),oFr=ot((0,nFr.jsx)("path",{d:"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2zm1-9h1V4H2v1h1zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2zm5-6v2h14V5zm0 14h14v-2H7zm0-6h14v-2H7z"}),"FormatListNumbered");var _ie=S(R(),1),lMo={insert:"Add acceptance criteria",convert:"Convert to outline"};function iFr({kind:e,onClick:t}){return(0,_ie.jsx)(W,{sx:{my:1},"data-preview-skip":!0,children:(0,_ie.jsx)(it,{size:"small",variant:"outlined",startIcon:e==="insert"?(0,_ie.jsx)(Vd,{}):(0,_ie.jsx)(oFr,{}),onClick:t,children:lMo[e]})})}var Eie=S(oe(),1);function aFr(e,t,{color:r,pin:n}){let o=UA(e),i=[],a=o.nextNode();for(;a;){let u=a;if(t.intersectsNode(u)){let d=u===t.startContainer?t.startOffset:0,f=u===t.endContainer?t.endOffset:u.length;d<f&&i.push({node:u,start:d,end:f})}a=o.nextNode()}let l=i.map(u=>cMo(u.node,u.start,u.end,r)).at(-1);l&&n&&(l.dataset.pin=n)}function cMo(e,t,r,n){let o=document.createRange();o.setStart(e,t),o.setEnd(e,r);let i=document.createElement("mark");return i.className="pr-comment",i.style.backgroundColor=n,o.surroundContents(i),i}function sFr(e){for(let t of e.querySelectorAll("mark.pr-comment"))if(t.parentNode){for(;t.firstChild;)t.before(t.firstChild);t.remove()}}function lFr(e,t){for(let r of t){let n=U6t(e,r);n&&aFr(e,n,r)}}var Rie=S(R(),1);function cFr({content:e,control:t,trailing:r,ranges:n,contentRef:o}){let i=(0,Eie.useMemo)(()=>GI(e),[e]),a=(0,Eie.useMemo)(()=>GI(r??""),[r]);return(0,Eie.useLayoutEffect)(()=>{let s=o.current;s&&(sFr(s),lFr(s,n))},[i,a,n,o]),(0,Rie.jsxs)(W,{ref:o,children:[(0,Rie.jsx)(UI,{segments:i,skipDiagramText:!0}),t,t?(0,Rie.jsx)(UI,{segments:a,skipDiagramText:!0}):null]})}var oM=e=>e.split(",").map(t=>`&& .markdown ${t.trim()}`).join(", ");function a5e(e){let{color:t,radius:r}=e.tokens;return{px:2.5,py:2,fontSize:14,lineHeight:1.6,[oM("")]:{lineHeight:1.6},[oM("h1, h2, h3, h4, h5, h6")]:{fontSize:15,fontWeight:600,lineHeight:1.4,mt:2,mb:1},[oM("ul, ol")]:{pl:2.5,mb:2},[oM("li")]:{mb:"6px"},[oM("code")]:{fontFamily:e.typography.fontFamilyMono,fontSize:"0.86em",px:"5px",py:0,bgcolor:t.raised,border:1,borderColor:t.lineSoft,borderRadius:"4px"},[oM("pre")]:{bgcolor:t.raised,border:1,borderColor:t.lineSoft,borderRadius:`${r.sm}px`},[oM("pre code")]:{border:0,px:0,bgcolor:"transparent"}}}var uFr=e=>({flex:1,overflow:"auto",position:"relative",userSelect:"none",cursor:"text",wordBreak:"break-word","& .markdown":{...$me(e),maxWidth:"none"},"& a":{color:"primary.main"},"& mark.pr-comment":{color:"inherit",borderRadius:"2px"},...a5e(e)});var dq=S(R(),1);function dFr({content:e,control:t,trailing:r,ranges:n,wrapperRef:o,contentRef:i,dragRects:a,dragColor:s,onMouseDown:l,footer:u}){return(0,dq.jsxs)(W,{ref:o,onMouseDown:l,sx:uFr,children:[(0,dq.jsx)(cFr,{content:e,control:t,trailing:r,ranges:n,contentRef:i}),u&&(0,dq.jsx)(W,{sx:{userSelect:"text"},children:u}),(0,dq.jsx)(SB,{rects:a,color:s})]})}function fFr(e){let t=new Map,r=[];for(let n of e){if(!n.group){r.push(n);continue}t.set(n.group,[...t.get(n.group)??[],n])}return{groups:[...t],ungrouped:r}}var s5e=S(oe(),1),pFr=S(R(),1);function Out({label:e,value:t,onCommit:r,listId:n}){let[o,i]=(0,s5e.useState)(t);return(0,s5e.useEffect)(()=>i(t),[t]),(0,pFr.jsx)(sn,{size:"small",variant:"standard",fullWidth:!0,label:e,value:o,onChange:s=>i(s.target.value),onBlur:()=>{let s=o.trim();i(t),s!==t&&r(s)},onKeyDown:s=>{s.key==="Enter"&&s.target.blur()},onMouseDown:s=>s.stopPropagation(),slotProps:{htmlInput:{list:n}}})}var Pie=S(R(),1),But="screenshot-groups";function uMo(e){return(e.split(/[\\/]/).pop()??e).replace(/\.[^.]+$/,"")}function hFr({screenshot:e,onUpdate:t}){return(0,Pie.jsxs)(St,{direction:"row",spacing:1,sx:{mt:.5},children:[(0,Pie.jsx)(Out,{label:"Caption",value:e.alt,onCommit:r=>t(e.id,{alt:r||uMo(e.path)})}),(0,Pie.jsx)(Out,{label:"Group",value:e.group??"",listId:But,onCommit:r=>t(e.id,{group:r})})]})}var UR=S(R(),1),mFr={display:"block",maxWidth:"100%",borderRadius:1,border:1,borderColor:"divider"},dMo={position:"absolute",top:4,right:4,bgcolor:"background.paper","&:hover":{bgcolor:"background.paper"}};function gFr({screenshot:e,onRemove:t,onUpdate:r}){let n=e.contentType.startsWith("video/");return(0,UR.jsxs)(W,{sx:{position:"relative"},children:[n?(0,UR.jsx)(W,{component:"video",controls:!0,src:e.url,"aria-label":"screenshot",sx:mFr}):(0,UR.jsx)(W,{component:"img",src:e.url,alt:"screenshot",sx:mFr}),(0,UR.jsx)(Vt,{size:"small","aria-label":"Remove screenshot",sx:dMo,onMouseDown:o=>o.stopPropagation(),onClick:()=>t(e.id),children:(0,UR.jsx)(Bo,{fontSize:"small"})}),(0,UR.jsx)(hFr,{screenshot:e,onUpdate:r})]})}var Vy=S(R(),1);function fMo(){return(0,Vy.jsxs)(St,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,Vy.jsx)(oo,{size:16}),(0,Vy.jsx)(Te,{variant:"caption",color:"text.secondary",children:"Attaching screenshot or video\u2026"})]})}function pMo({error:e}){return(0,Vy.jsx)(Te,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:e})}function yFr({uploads:e,empty:t}){return e.length>0?(0,Vy.jsx)(Vy.Fragment,{children:e.map(r=>r.error?(0,Vy.jsx)(pMo,{error:r.error},r.id):(0,Vy.jsx)(fMo,{},r.id))}):t?(0,Vy.jsx)(Te,{variant:"caption",color:"text.secondary",children:"Drop or paste an image or video to attach"}):null}var Wy=S(R(),1),hMo={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:1};function vFr({screenshots:e,uploads:t,onRemove:r,onUpdate:n}){let{groups:o,ungrouped:i}=fFr(e),a=s=>(0,Wy.jsx)(gFr,{screenshot:s,onRemove:r,onUpdate:n},s.id);return(0,Wy.jsxs)(W,{sx:{mt:3},children:[e.length>0&&(0,Wy.jsx)(W,{component:"h2",children:"Screenshots"}),(0,Wy.jsx)("datalist",{id:But,children:o.map(([s])=>(0,Wy.jsx)("option",{value:s},s))}),o.map(([s,l])=>(0,Wy.jsxs)(W,{sx:{mb:2},children:[(0,Wy.jsx)(W,{component:"h3",children:s}),(0,Wy.jsx)(W,{sx:hMo,children:l.map(a)})]},s)),(0,Wy.jsxs)(St,{spacing:1,children:[i.map(a),(0,Wy.jsx)(yFr,{uploads:t,empty:e.length===0})]})]})}var Aie=S(R(),1);function mMo(e){let t=e.criteria;if(!t)return{content:e.body};let r={content:t.before,trailing:t.after};return t.kind==="outline"?{...r,control:(0,Aie.jsx)(rFr,{items:t.items,onChange:e.onCriteriaChange})}:{...r,control:(0,Aie.jsx)(iFr,{kind:t.kind,onClick:t.kind==="insert"?e.onCriteriaInsert:e.onCriteriaConvert})}}function l5e({pane:e,screenshots:t}){return(0,Aie.jsx)(dFr,{...mMo(e),ranges:e.ranges,wrapperRef:e.wrapperRef,contentRef:e.contentRef,dragRects:e.dragRects,dragColor:e.dragColor,onMouseDown:e.onMouseDown,footer:t?(0,Aie.jsx)(vFr,{screenshots:e.screenshots,uploads:e.uploads,onRemove:e.removeScreenshot,onUpdate:e.updateScreenshot}):void 0})}var bFr=e=>({display:"grid",gap:1,maxHeight:220,overflow:"auto",px:2,py:1.25,borderTop:1,borderColor:e.tokens.color.lineSoft}),xFr={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"text.secondary"},SFr=e=>({display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",gap:"4px 8px",px:1.25,py:1,borderRadius:`${e.tokens.radius.sm}px`,bgcolor:e.tokens.color.raised,border:1,borderColor:e.tokens.color.lineSoft,fontSize:12.5}),TFr={gridColumn:2,gridRow:1,width:20,height:20,color:"text.disabled","& .MuiSvgIcon-root":{fontSize:14}};var yC=S(R(),1);function wFr({comments:e,colors:t,onRemove:r}){return(0,yC.jsxs)(W,{sx:bFr,children:[(0,yC.jsxs)(Te,{sx:xFr,children:["Comments (",e.length,")"]}),e.map((n,o)=>(0,yC.jsxs)(W,{sx:SFr,children:[(0,yC.jsx)(yB,{text:n.quote,sx:{gridColumn:1,borderLeft:2,pl:1,borderColor:t[o]}}),(0,yC.jsx)(W,{sx:{gridColumn:1,wordBreak:"break-word"},children:n.note}),(0,yC.jsx)(Vt,{"aria-label":"Remove comment",onClick:()=>r(n.id),sx:TFr,children:(0,yC.jsx)(Bo,{})})]},n.id))]})}var kFr=S(R(),1);function CFr(e){return e.comments.length===0?null:(0,kFr.jsx)(wFr,{...e})}var _Fr=S(R(),1),c5e=ot((0,_Fr.jsx)("path",{d:"M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2zM4 6h16v10H4z"}),"Computer");var IFr=S(oe(),1);var EFr=S(R(),1),RFr=ot((0,EFr.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2"}),"Circle");var Gy="0.1133.0";var gMo={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function PFr(e){return e?gMo[e]:"success.main"}function AFr(e){return e.split("-")[0].split(".").map(Number)}function LFr(e,t){if(!e||!t||e===t)return;let r=AFr(e),n=AFr(t);for(let o=0;o<Math.max(r.length,n.length);o++){let i=(r[o]??0)-(n[o]??0);if(Number.isNaN(i))return;if(i!==0)return i<0?"behind":"ahead"}}var u5e=S(oe(),1),$ut=(0,u5e.createContext)(null);function d5e(){return(0,u5e.useContext)($ut)}var iM=S(R(),1),yMo={height:16,fontSize:10},vMo={opacity:.6,fontSize:"0.85em"};function bMo(e,t){if(t===e.local)return"this machine";let r=e.links.find(n=>n.name===t);return r?r.error?`${r.state}: ${r.error}`:r.state:""}function VR({nodes:e,name:t,showVersion:r=!1}){let n=d5e()??Gy,o=e.links.find(a=>a.name===t),i=LFr(o?.peerVersion,n);return(0,iM.jsx)(pr,{title:bMo(e,t),placement:"right",children:(0,iM.jsxs)(W,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,iM.jsx)(RFr,{sx:{fontSize:8,color:PFr(o?.state)}}),t,r&&o?.peerVersion&&(0,iM.jsxs)(W,{component:"span",sx:vMo,children:["v",o.peerVersion]}),i&&(0,iM.jsx)(Sn,{label:i,size:"small",color:i==="behind"?"warning":"info",sx:yMo})]})})}var qy=S(R(),1),xMo={textTransform:"none"};function f5e({nodes:e,options:t,target:r,onPick:n}){let[o,i]=(0,IFr.useState)(null);return(0,qy.jsxs)(qy.Fragment,{children:[(0,qy.jsx)(it,{size:"small",color:"inherit",startIcon:(0,qy.jsx)(c5e,{fontSize:"small"}),"aria-label":"Start on node","aria-haspopup":"menu",onClick:a=>i(a.currentTarget),sx:xMo,children:(0,qy.jsx)(VR,{nodes:e,name:r.node})}),(0,qy.jsx)(Oi,{anchorEl:o,open:!!o,onClose:()=>i(null),children:t.map(({name:a,cwd:s})=>(0,qy.jsx)(Hr,{disabled:!s,selected:a===r.node,onClick:()=>{n(a),i(null)},children:(0,qy.jsx)(kf,{primary:(0,qy.jsx)(VR,{nodes:e,name:a}),secondary:s?void 0:"no clone"})},a))})]})}var DFr=S(oe(),1);function SMo(e,t){return e?.toLowerCase()===t.toLowerCase()}function p5e(e,t){let{nodes:r,names:n,visible:o}=cs(),{repos:i,selectedCwd:a,selectedNode:s,cloneOn:l,originOf:u}=In(),[d,f]=(0,DFr.useState)(),p=e&&u(e)?e:a,h=t?i.find(b=>SMo(u(b),t)):p,m=n.map(b=>({name:b,cwd:h?l(h,b):void 0})),g=b=>m.find(x=>x.name===b&&x.cwd),y=g(d)??g(s??r?.local)??m.find(b=>b.cwd),v=o&&y?.cwd?{node:y.name,cwd:y.cwd}:void 0;return{nodes:r,visible:o,options:m,target:v,pick:f}}var WR=S(R(),1);function MFr({canStart:e,startOrigin:t,cwd:r,onApprove:n,onApproveAndStart:o}){let i=Ype(),a=p5e(r,t);return(0,WR.jsxs)(WR.Fragment,{children:[(0,WR.jsx)(it,{color:"primary",variant:e?"tonal":"contained",onClick:n,...e?{}:i,children:"Approve"}),e&&a.nodes&&a.target&&(0,WR.jsx)(f5e,{nodes:a.nodes,options:a.options,target:a.target,onPick:a.pick}),e&&(0,WR.jsx)(it,{color:"primary",variant:"contained",onClick:()=>o(a.target),...i,children:"Approve & start"})]})}var Fut=S(R(),1),TMo={"& .MuiFormControlLabel-label":{fontSize:12}};function Lie({label:e,title:t,checked:r,onChange:n}){return(0,Fut.jsx)(Ld,{control:(0,Fut.jsx)(Ep,{size:"small",checked:r,onChange:o=>n(o.target.checked)}),label:e,title:t,sx:TMo})}var aM=S(R(),1);function h5e({chain:e,newPr:t,onChange:r}){return(0,aM.jsxs)(St,{direction:"row",sx:{mr:"auto"},children:[t&&(0,aM.jsx)(Lie,{label:"Draft",title:"Create the PR as a draft rather than ready for review",checked:e.draft,onChange:n=>r({...e,draft:n,autoMerge:n?!1:e.autoMerge})}),(0,aM.jsx)(Lie,{label:"Auto-merge (squash)",title:"Squash-merge the PR automatically once its required checks pass",checked:e.autoMerge,onChange:n=>r({...e,autoMerge:n,draft:n?!1:e.draft})}),(0,aM.jsx)(Lie,{label:"Review PR",title:"After raising, run a review that posts its findings and then addresses them",checked:e.reviewAfter,onChange:n=>r({...e,reviewAfter:n})}),(0,aM.jsx)(Lie,{label:"Post to Slack",title:"Announce the PR in Slack at the tail of the chain",checked:e.announceAfter,onChange:n=>r({...e,announceAfter:n})})]})}var sM=S(R(),1);function NFr({commentCount:e,chain:t,newPr:r,canStart:n,startOrigin:o,onChainChange:i,onApprove:a,cwd:s,onApproveAndStart:l,onReject:u,onRequestChanges:d}){return(0,sM.jsxs)(St,{direction:"row",spacing:1,sx:{px:2,py:1.5,alignItems:"center",justifyContent:"flex-end"},children:[t&&(0,sM.jsx)(h5e,{chain:t,newPr:r,onChange:i}),(0,sM.jsx)(it,{color:"error",variant:"outlined",onClick:u,children:"Reject"}),e>0&&(0,sM.jsxs)(it,{color:"warning",variant:"tonal",onClick:d,children:["Request changes (",e,")"]}),(0,sM.jsx)(MFr,{canStart:n,startOrigin:o,cwd:s,onApprove:a,onApproveAndStart:l})]})}var BFr=S(R(),1);function OFr({comments:e,cwd:t,onDecision:r,chain:n,newPr:o,canStart:i,startOrigin:a,onChainChange:s}){let l=()=>e.map(u=>({quote:u.quote,note:u.note}));return(0,BFr.jsx)(NFr,{commentCount:e.length,chain:n,newPr:o,canStart:i,startOrigin:a,onChainChange:s,onApprove:()=>r("approve",l()),cwd:t,onApproveAndStart:u=>r("approve",l(),u??!0),onReject:()=>r("reject",[]),onRequestChanges:()=>r("reject",l())})}var vC=S(R(),1);function $Fr(e){let{comments:t,commentColors:r,pending:n,cwd:o,unavailable:i,onAdd:a,onQueue:s,onCite:l,onAddRule:u,onRemove:d,onCancel:f,onCollapse:p,editable:h}=e;return(0,vC.jsxs)(vC.Fragment,{children:[(0,vC.jsx)(CFr,{comments:t,colors:r,onRemove:d}),(0,vC.jsx)(qn,{}),(0,vC.jsx)(OFr,{...e}),(0,vC.jsx)(ime,{pending:n,editable:h,cwd:o,unavailable:i,onAdd:a,onQueue:s,onCite:l,onAddRule:u,onCancel:f,onCollapse:p})]})}var Iie=S(R(),1),wMo={px:2,pb:2,display:"flex",alignItems:"center",gap:1.5,minWidth:0},CMo={color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function FFr({url:e}){return(0,Iie.jsxs)(W,{sx:wMo,children:[(0,Iie.jsx)(it,{variant:"contained",href:e,target:"_blank",rel:"noopener noreferrer",sx:{flexShrink:0},children:"Open design \u2197"}),(0,Iie.jsx)(Te,{variant:"body2",sx:CMo,title:e,children:e})]})}var zut=S(R(),1);function zFr({preview:e}){let t=e.kind==="design"?e.metadata?.[0]?.url:void 0;return t?(0,zut.jsx)(FFr,{url:t}):(0,zut.jsx)(lq,{items:e.metadata??[]})}function HFr({preview:e,pane:t,cwd:r,isPr:n,editable:o,sender:i,onCite:a,onAddRule:s}){return{comments:t.comments,commentColors:t.commentColors,pending:t.pending,cwd:r,unavailable:i.unavailable,onAdd:i.onSend,onQueue:t.onAdd,onCite:a,onAddRule:s,onRemove:t.remove,onCancel:t.onCancel,onCollapse:t.onCollapse,onDecision:t.onDecide,chain:n?t.chain:void 0,editable:o,newPr:n&&e.prNumber===null,canStart:e.kind==="backlog-item"&&e.canStart===!0,startOrigin:e.startOrigin,onChainChange:t.setChain}}function fq(e){let t=e??"pr";return{isPr:t==="pr",screenshots:t==="pr"||t==="github-issue",editable:t==="github-issue-edit",closeOnly:t==="show"}}function UFr(e,t){return e?`${e}:${t??"pr"}`:void 0}function m5e(e,t,r,n){return{...fq(e.kind),requestId:e.requestId,supersedes:e.supersedes,sessionId:t,cwd:r,onDecision:n,screenshotScope:UFr(t,e.kind),seededScreenshots:e.screenshots??[],chainDefaults:{draft:e.draft===!0,reviewAfter:e.reviewAfter??!0},initialBody:e.body}}function VFr(e,t,r,n){if(!(!e||!t))return o=>{r!==void 0&&lf(t,e,Ywe({quote:r,note:o})),n()}}function WFr(e,t,r,n){if(!(!e||!t))return o=>{r!==void 0&&lf(t,e,Sx(r,Zhe(o))),n()}}function g5e(e,t,r,n){return{onCite:WFr(e,t,r,n),onAddRule:VFr(e,t,r,n)}}function GFr(e){return{criteria:e.criteria,onCriteriaChange:e.writeCriteria,onCriteriaInsert:e.insertCriteria,onCriteriaConvert:e.convertCriteria}}var ezr=S(oe(),1);var bC=S(oe(),1);var qFr="assist:pr-preview-comments:",Hut=e=>`${qFr}${e}`;function Uut(e){return ll(Hut(e))}function Die(e,t){Rl(Hut(e),t)}function y5e(e){Cv(Hut(e))}function jFr(){Tx(qFr)}function YFr(e){let t=UA(e),r="";for(let n=t.nextNode();n;n=t.nextNode())r+=n.textContent??"";return r}function kMo(e,t,r){let n=-1;for(let o=e.indexOf(t);o!==-1;o=e.indexOf(t,o+1))(n===-1||Math.abs(o-r)<Math.abs(n-r))&&(n=o);return n}function KFr(e,t){return e.flatMap(r=>{let n=kMo(t,r.quote,r.start);return n===-1?[]:[{...r,start:n,end:n+r.quote.length}]})}function XFr(e,t,r){let n=Uut(e);if(n.length>0||!t||!r)return n;let o=KFr(Uut(t),YFr(r));return Die(e,o),y5e(t),o}function ZFr(e,t,r){let[n,o]=(0,bC.useState)([]),i=(0,bC.useRef)(0);(0,bC.useEffect)(()=>{jFr(),o(XFr(e,t,r.current).map(l=>({...l,id:i.current++})))},[e,t,r]);let a=(0,bC.useCallback)(l=>{o(u=>{let d=[...u,{...l,id:i.current++}];return Die(e,d),d})},[e]),s=(0,bC.useCallback)(l=>{o(u=>{let d=u.filter(f=>f.id!==l);return Die(e,d),d})},[e]);return{comments:n,add:a,remove:s}}function QFr(e,t){let r=e.map((i,a)=>tW(a).solid),n=tW(e.length).fill,o=e.map((i,a)=>({start:i.start,end:i.end,color:tW(a).fill,pin:String(a+1)}));return t&&o.push({start:t.start,end:t.end,color:n}),{commentColors:r,dragColor:n,ranges:o}}function JFr(e,t,r,n){return{onAdd:o=>{e&&t({quote:e.quote,note:o,start:e.start,end:e.end}),n()},onCollapse:()=>{e&&r(e.quote),n()}}}function tzr(e,t,r){let{wrapperRef:n,contentRef:o,pending:i,dragRects:a,onMouseDown:s,clear:l,select:u}=P5(),{comments:d,add:f,remove:p}=ZFr(e,t,o),{commentColors:h,dragColor:m,ranges:g}=(0,ezr.useMemo)(()=>QFr(d,i),[d,i]),{onAdd:y,onCollapse:v}=JFr(i,f,r,l);return{wrapperRef:n,contentRef:o,onMouseDown:s,comments:d,commentColors:h,remove:p,pending:i,ranges:g,dragRects:a,dragColor:m,onAdd:y,onCollapse:v,onCancel:l,onSelect:u}}var b5e=S(oe(),1);var Vut="assist:preview-screenshots:",Wut=e=>`${Vut}${e}`,v5e=e=>`${Vut}seeded:${e}`;function rzr(e){return e?(Tx(Vut),ll(Wut(e)).filter(t=>typeof t.path=="string")):[]}function lM(e,t){e&&Rl(Wut(e),t.map(({path:r,alt:n,group:o,contentType:i,seeded:a})=>({path:r,alt:n,group:o,contentType:i,seeded:a})))}function nzr(e){e&&(Cv(Wut(e)),Cv(v5e(e)))}var cM=S(oe(),1);var ozr={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","video/mp4":"mp4","video/webm":"webm","video/quicktime":"mov"};function _Mo(e){let t=e.split(".").pop()?.toLowerCase();return Object.entries(ozr).find(([,n])=>n===t)?.[0]??"application/octet-stream"}function izr(e){return e.map(t=>({...t,contentType:_Mo(t.path),seeded:!0}))}function azr(e,t,r){if(!e)return izr(r);let n=rzr(e);if(ll(v5e(e))[0]===t)return n;let o=[...izr(r),...n.filter(i=>!i.seeded)];return lM(e,o),Rl(v5e(e),[t]),o}function szr(e,t){let r=new URLSearchParams({path:e});return t&&r.set("node",t),W2(`/api/pr-preview/image?${r}`)}function lzr(e,t,r){let[n,o]=(0,cM.useState)([]),i=(0,cM.useRef)(0),a=hr(),s=(0,cM.useRef)(r);return s.current=r,(0,cM.useEffect)(()=>{o(azr(e,t,s.current).map(l=>({...l,url:szr(l.path,a),id:i.current++})))},[e,t,a]),{screenshots:n,setScreenshots:o,nextId:i}}var czr=S(oe(),1);function uzr(e,t){return(0,czr.useCallback)((r,n)=>{t(o=>{let i=o.map(a=>a.id===r?{...a,...n}:a);return lM(e,i),i})},[e,t])}function dzr(e,t,r){let{screenshots:n,setScreenshots:o,nextId:i}=lzr(e,t,r),a=(0,b5e.useCallback)(d=>{o(f=>{let p=[...f,{...d,id:i.current++}];return lM(e,p),p})},[e,o,i]),s=(0,b5e.useCallback)(d=>{o(f=>{let p=f.find(m=>m.id===d);p?.url.startsWith("blob:")&&URL.revokeObjectURL(p.url);let h=f.filter(m=>m.id!==d);return lM(e,h),h})},[e,o]),l=uzr(e,o),u=(0,b5e.useCallback)(()=>nzr(e),[e]);return{screenshots:n,add:a,remove:s,update:l,clearPersisted:u}}var pq=S(oe(),1);async function fzr(e,t,r){let n=new URLSearchParams;t&&n.set("cwd",t),r&&n.set("node",r),e instanceof File&&e.name&&n.set("name",e.name);let o=await Wt(`/api/pr-preview/upload-image?${n}`,{method:"POST",headers:{"Content-Type":e.type||"application/octet-stream"},body:e,timeoutMs:12e4}),i=await o.json().catch(()=>null);if(!o.ok||!i?.path)throw new Error(i?.error??"Failed to attach file");return{path:i.path,alt:i.alt??"screenshot"}}var gzr=S(oe(),1);function pzr(e){return e.startsWith("image/")||e.startsWith("video/")}function hzr(e){if(!e)return null;for(let t of e.items)if(t.kind==="file"&&pzr(t.type)){let r=t.getAsFile();if(r)return r}return null}function mzr(e){return e?Array.from(e.files).find(t=>pzr(t.type))??null:null}function yzr(e,t){return(0,gzr.useEffect)(()=>{if(!t)return;let o=i=>{let a=hzr(i.clipboardData);a&&(i.preventDefault(),e(a))};return globalThis.addEventListener("paste",o),()=>globalThis.removeEventListener("paste",o)},[e,t]),t?{onDrop:o=>{let i=mzr(o.dataTransfer);i&&(o.preventDefault(),e(i))},onDragOver:o=>{Array.from(o.dataTransfer.items).some(i=>i.kind==="file")&&o.preventDefault()}}:{onDrop:void 0,onDragOver:void 0}}function vzr(e,t,r){let[n,o]=(0,pq.useState)([]),i=(0,pq.useRef)(0),a=hr(),s=(0,pq.useCallback)(async d=>{let f=i.current++;o(p=>[...p.filter(h=>!h.error),{id:f}]);try{let p=await fzr(d,e,a);t({...p,url:URL.createObjectURL(d),contentType:d.type}),o(h=>h.filter(m=>m.id!==f))}catch(p){let h=p instanceof Error?p.message:"Failed to attach file";o(m=>m.map(g=>g.id===f?{id:f,error:h}:g))}},[e,a,t]),{onDrop:l,onDragOver:u}=yzr(s,r);return{uploads:n,onDrop:l,onDragOver:u}}function bzr({cwd:e,screenshots:t,screenshotScope:r,requestId:n,seededScreenshots:o}){let{screenshots:i,add:a,remove:s,update:l,clearPersisted:u}=dzr(t?r:void 0,n,t?o:[]),{uploads:d,onDrop:f,onDragOver:p}=vzr(e,a,t);return{screenshots:i,removeScreenshot:s,updateScreenshot:l,decision:{attachments:()=>i.map(({path:h,alt:m,group:g})=>g?{path:h,alt:m,group:g}:{path:h,alt:m}),clearPersisted:u},uploads:d,onDrop:f,onDragOver:p}}var Rzr=S(oe(),1);var xzr="assist:pr-preview-chain:",Gut=e=>`${xzr}${e}`;function Szr(e){if(e)return ll(Gut(e))[0]}function Tzr(e,t){e&&Rl(Gut(e),[t])}function wzr(e){e&&Cv(Gut(e))}function Czr(){Tx(xzr)}function kzr(e,t,r){if(!e)return{reviewAfter:!1,announceAfter:!1,draft:!1,autoMerge:!1};Czr();let n=Szr(t);return{reviewAfter:n?.reviewAfter??r.reviewAfter,announceAfter:n?.announceAfter??!0,draft:n?.draft??r.draft,autoMerge:n?.autoMerge??!1}}function _zr(e,t,r,n,o){return{comments:t,screenshots:n,reviewAfter:e&&r.reviewAfter,announceAfter:e&&r.announceAfter,draft:r.draft,autoMerge:e&&r.autoMerge,...o===void 0?{}:{body:o}}}function Ezr(e,t){return!e||t===!1?{}:t===!0?{autostart:!0}:{autostart:!0,startOn:t}}function Pzr(e,t,r,n,o,i,a){let[s,l]=(0,Rzr.useState)(()=>kzr(n,t,o));return{chain:s,setChain:f=>{l(f),Tzr(t,f)},onDecide:(f,p,h=!1)=>{let m=f==="approve";r(f,{..._zr(m,p,s,m?i.attachments():[],a()),...Ezr(m,h)}),y5e(e),m&&(wzr(t),i.clearPersisted())}}}var Fzr=S(oe(),1);var EMo=/^ {0,3}#{1,6}[ \t]+acceptance criteria[ \t]*$/i,RMo=/^ {0,3}#{1,6}[ \t]/;function GR(e){let t=e.split(`
4006
+ `),additions:K$r(o,"+"),deletions:K$r(o,"-"),split:{hunks:o.length,of:n.length,elsewhere:i}}}function Z$r(e){return e.flatMap(t=>{if(t.kind==="dir")return Z$r(t.children);let{kind:r,name:n,...o}=t;return[o]})}function GDo(e){let t=new Map;return e.forEach((r,n)=>{for(let o of r.hunks)t.set(o,[...t.get(o)??[],n+1])}),t}function Q$r(e,t,r=new Set,n=new Set){let o=Z$r(e.tree).filter(a=>!r.has(a.path)).map(a=>n.has(a.path)?{...a,critical:!0}:a),i=GDo(t);return t.map((a,s)=>{let l=new Set(a.hunks.map(tq));return G$r(o.filter(u=>l.has(u.path)).map(u=>X$r(u,s+1,i)))})}function qDo(e,t){let r=-1,n=0;return t.forEach((o,i)=>{let a=o.hunks.filter(s=>tq(s)===e).length;a>n&&(r=i,n=a)}),r}function J$r(e,t){let r=t.map(()=>[]);for(let n of e)r[qDo(n.path,t)]?.push(n);return r}function e9r(e,t){let r=Q$r(e.structure,t,new Set(e.tests.map(i=>i.path)),new Set(e.criticalDiffs.map(i=>i.path))),n=J$r(e.tests,t),o=A4e(t);return t.map((i,a)=>{let s=a+1;return{number:s,slice:i,structure:r[a]??e.structure,tests:n[a]??[],critical:e.criticalDiffs.filter(l=>o.get(l.path)?.some(u=>u.number===s))}})}function t9r(e){if(!e.slices)return;let t=e9r(e,e.slices);return{entries:B$r(e,t),slicing:{count:t.length,noCritical:new Set(t.filter(r=>r.critical.length===0).map(r=>r.number))}}}function r9r(e){if(!(!e.repo||!e.headSha))return`${e.repo}#${e.prNumber}@${e.headSha}`}var Lut="assist:high-level-progress:",jDo=`${Lut}head:`,YDo=720*60*60*1e3,wie=e=>`${Lut}${e}`,Iut=e=>`${jDo}${e}`,Aut=e=>ll(e)[0];function KDo(e,t){let r=e?Aut(wie(e)):void 0;return e&&Cv(wie(e)),r??(t?Aut(Iut(t)):void 0)}function n9r(e,t,r){return Tx(Lut,YDo),Aut(wie(e))??KDo(t,r)}function o9r(e,t,r){Rl(wie(e),[r]),t&&Rl(Iut(t),[r])}function i9r(e,t){Cv(wie(e)),t&&Cv(Iut(t))}function a9r(e){let t=e;return typeof t?.id=="string"&&typeof t.title=="string"&&typeof t.reason=="string"&&(t.kind==="deterministic"||t.kind==="manual")&&["pass","fail","manual"].includes(t.status)}function tM(e,t){return Array.isArray(e)?t?e.filter(t):e:[]}var uq={repo:"",prNumber:0,headSha:"",checks:[],structure:{tree:[],added:0,removed:0,modified:0,additions:0,deletions:0},criticalDiffs:[],criticalPaths:[],tests:[],testPaths:[],collapsedPaths:[]};function s9r(e){let t;try{t=JSON.parse(e)}catch{return uq}return typeof t!="object"||t===null?uq:{repo:typeof t.repo=="string"?t.repo:uq.repo,prNumber:typeof t.prNumber=="number"?t.prNumber:uq.prNumber,headSha:typeof t.headSha=="string"?t.headSha:uq.headSha,checks:tM(t.checks,a9r),structure:{...uq.structure,...t.structure},criticalDiffs:tM(t.criticalDiffs),criticalPaths:tM(t.criticalPaths),tests:tM(t.tests),testPaths:tM(t.testPaths),collapsedPaths:tM(t.collapsedPaths),...Array.isArray(t.slices)?{slices:t.slices}:{},...t.manualTesting?{manualTesting:t.manualTesting}:{},...t.saved?{saved:t.saved}:{},...t.draft?{draft:t.draft}:{}}}function l9r(e){let t=(0,Q4e.useMemo)(()=>s9r(e.body),[e.body]),r=(0,Q4e.useMemo)(()=>t9r(t),[t]),n=r9r(t),o=(0,Q4e.useMemo)(()=>n9r(e.requestId,e.supersedes,n)??t.draft??t.saved,[e.requestId,e.supersedes,n,t]);return{payload:t,sliced:r,progress:o,head:n}}var c9r=S(oe(),1);function u9r(e){let[t,r]=(0,c9r.useState)(()=>e?.reviewComments??[]);return{queued:t,onQueue:n=>r(o=>[...o,n]),onRemove:n=>r(o=>o.filter((i,a)=>a!==n)),onEdit:(n,o)=>r(i=>i.map((a,s)=>s===n?{...a,note:o}:a))}}var d9r=S(oe(),1);function f9r(e,t,r,n){(0,d9r.useEffect)(()=>{o9r(e,t,{items:r,reviewComments:n})},[e,t,r,n])}function h9r(e,t,r){let{payload:n,sliced:o,progress:i,head:a}=l9r(e),s=O$r(n.checks,i,o?.slicing),l=u9r(i),u=_$r(o?.entries??[]),{comments:d,sentTo:f,clearSent:p}=d4e(t,r),h={...d,onQueue:l.onQueue};f9r(e.requestId,a,s.items,l.queued);let m=(0,p9r.useMemo)(()=>L$r(n),[n]);return{payload:n,checklist:s,queue:l,details:A$r(n,h),counts:m,sentTo:f,clearSent:p,sliced:o,nav:u,diffComments:h,head:a}}var Xx=S(R(),1);function m9r({preview:e,session:t,sendInput:r,onDecision:n}){let o=h9r(e,t,r);return(0,Xx.jsxs)(W,{sx:Ny,children:[(0,Xx.jsx)(xh,{preview:e,draft:!1}),(0,Xx.jsx)(lq,{items:e.metadata??[]}),(0,Xx.jsx)(qn,{}),(0,Xx.jsx)(d$r,{payload:o.payload,checklist:o.checklist,details:o.details,counts:o.counts,sliced:o.sliced,nav:o.nav,comments:o.diffComments}),(0,Xx.jsx)(qn,{}),(0,Xx.jsx)(C$r,{pane:o,onDecision:(i,a)=>{i9r(e.requestId,o.head),n(i,a)}}),(0,Xx.jsx)(Py,{sessionName:o.sentTo,onClose:o.clearSent})]})}var w9r=S(oe(),1);var rM=S(R(),1);function XDo(e){return e.topLeft===null?"Click the top-left box":e.bottomRight===null?"Now click the bottom-right box":"Both anchors picked"}function g9r({selection:e,onConfirm:t,onReject:r}){let n=e.topLeft!==null&&e.bottomRight!==null;return(0,rM.jsxs)(St,{direction:"row",spacing:1,sx:{p:2,alignItems:"center",justifyContent:"flex-end"},children:[(0,rM.jsx)(Te,{variant:"body2",sx:{flex:1,color:"text.secondary"},children:XDo(e)}),(0,rM.jsx)(it,{color:"error",variant:"outlined",onClick:r,children:"Cancel"}),(0,rM.jsx)(it,{variant:"outlined",onClick:e.reset,children:"Start over"}),(0,rM.jsx)(it,{color:"success",variant:"contained",disabled:!n,onClick:t,children:"Extract boxes"})]})}var ZDo={"top-left":tc.miro.topLeft,"bottom-right":tc.miro.bottomRight};function y9r(e,t){let r=e.right-e.left,n=e.bottom-e.top;return{width:r,height:n,fontSize:Math.max(6,Math.min(n*.3,r/6,28)),radius:Math.min(8,n/4),colour:t?ZDo[t]:tc.miro.box,opacity:t?.75:.35,strokeWidth:Math.max(1,r*.004)}}var Cie=S(R(),1);function v9r({box:e,role:t,onSelect:r}){let n=y9r(e,t);return(0,Cie.jsxs)("g",{role:"button",tabIndex:0,"aria-label":t?`${e.text} (${t})`:e.text,onClick:()=>r(e.id),onKeyDown:o=>{o.key==="Enter"&&r(e.id)},style:{cursor:"pointer"},children:[(0,Cie.jsx)("rect",{x:e.left,y:e.top,width:n.width,height:n.height,rx:n.radius,fill:n.colour,fillOpacity:n.opacity,stroke:n.colour,strokeWidth:n.strokeWidth}),(0,Cie.jsx)("text",{x:e.left+n.width/2,y:e.top+n.height/2,textAnchor:"middle",dominantBaseline:"central",fontSize:n.fontSize,fill:tc.miro.text,children:e.text})]})}function b9r(e){if(e.length===0)return"0 0 100 100";let t=Math.min(...e.map(a=>a.left)),r=Math.min(...e.map(a=>a.top)),n=Math.max(...e.map(a=>a.right))-t,o=Math.max(...e.map(a=>a.bottom))-r,i=Math.max(n*.02,8);return`${t-i} ${r-i} ${n+i*2} ${o+i*2}`}var J4e=S(R(),1);function x9r({boxes:e,selection:t}){return(0,J4e.jsx)(W,{sx:{flex:1,minHeight:0,overflow:"auto",p:2},children:(0,J4e.jsx)("svg",{role:"img","aria-label":"Miro board boxes",viewBox:b9r(e),preserveAspectRatio:"xMidYMid meet",style:{width:"100%",height:"100%"},children:e.map(r=>(0,J4e.jsx)(v9r,{box:r,role:t.roleOf(r.id),onSelect:t.choose},r.id))})})}function QDo(e){return typeof e?.id=="string"&&typeof e.text=="string"&&[e.left,e.top,e.right,e.bottom].every(t=>typeof t=="number"&&Number.isFinite(t))}function S9r(e){try{let t=JSON.parse(e);return Array.isArray(t?.boxes)?t.boxes.filter(QDo):[]}catch{return[]}}var Dut=S(oe(),1);function T9r(){let[e,t]=(0,Dut.useState)(null),[r,n]=(0,Dut.useState)(null);return{topLeft:e,bottomRight:r,choose:s=>{if(e===null||r!==null){t(s),n(null);return}n(s)},reset:()=>{t(null),n(null)},roleOf:s=>s===e?"top-left":s===r?"bottom-right":null}}var zR=S(R(),1);function C9r({preview:e,onDecision:t}){let r=(0,w9r.useMemo)(()=>S9r(e.body),[e.body]),n=T9r();return(0,zR.jsxs)(W,{sx:Ny,children:[(0,zR.jsx)(xh,{preview:e,draft:!1}),(0,zR.jsx)(qn,{}),(0,zR.jsx)(x9r,{boxes:r,selection:n}),(0,zR.jsx)(qn,{}),(0,zR.jsx)(g9r,{selection:n,onConfirm:()=>{let{topLeft:i,bottomRight:a}=n;i===null||a===null||t("approve",Oc({topLeft:i,bottomRight:a}))},onReject:()=>t("reject",Oc())})]})}var tFr=S(oe(),1);function k9r(e){let t=[];return e.map(r=>(t.length=r+1,t[r]=(t[r]??0)+1,t.map(n=>n??1).join(".")))}function e5e(e){return e*22}function _9r(e){return Math.round(e/22)}var E9r={display:"flex",alignItems:"flex-start",gap:.25,"& .criterion-action":{opacity:0,transition:"opacity 120ms"},"&:hover .criterion-action":{opacity:1},"&:focus-within .criterion-action":{opacity:1},"& .criterion-action:focus-visible":{opacity:1}},R9r={p:.25,mt:"2px",color:"text.disabled",cursor:"grab",touchAction:"none","&:active":{cursor:"grabbing"}},P9r={fontFamily:"fontFamilyMono",fontSize:"0.8rem",color:"text.secondary",minWidth:32,pt:"5px",textAlign:"right",userSelect:"none",whiteSpace:"nowrap"},A9r={flex:1,fontSize:"inherit",lineHeight:1.5,px:.75,py:0,borderRadius:1,"&:hover":{bgcolor:"action.hover"},"&.Mui-focused":{bgcolor:"action.selected"}},Mut={p:.25,mt:"2px"},L9r={position:"absolute",right:8,height:2,borderRadius:1,bgcolor:"primary.main",pointerEvents:"none"};var D9r=S(R(),1),JDo=8;function I9r({drag:e}){return e?(0,D9r.jsx)(W,{sx:L9r,style:{top:e.top-1,left:JDo+e5e(e.depth)}}):null}var M9r=S(R(),1),N9r=ot((0,M9r.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");var Nut=S(R(),1);function O9r({number:e,onGrip:t}){return(0,Nut.jsx)(Vt,{size:"small",className:"criterion-action",sx:R9r,"aria-label":`Reorder criterion ${e}`,onPointerDown:t,children:(0,Nut.jsx)(N9r,{fontSize:"inherit"})})}var gC=S(R(),1);function B9r({number:e,onAdd:t,onDelete:r}){return(0,gC.jsxs)(gC.Fragment,{children:[(0,gC.jsx)(Vt,{size:"small",className:"criterion-action",sx:Mut,"aria-label":`Add criterion after ${e}`,onClick:t,children:(0,gC.jsx)(Vd,{fontSize:"inherit"})}),(0,gC.jsx)(Vt,{size:"small",className:"criterion-action",sx:Mut,"aria-label":`Delete criterion ${e}`,onClick:r,children:(0,gC.jsx)(Bo,{fontSize:"inherit"})})]})}var t5e=S(oe(),1);function $9r(e,t){return e==="start"?0:e==="end"?t:Math.min(Math.max(e,0),t)}function F9r(e){let t=(0,t5e.useRef)(null);return(0,t5e.useEffect)(()=>{let r=t.current;if(!e||!r)return;r.focus();let n=$9r(e.caret,r.value.length);r.setSelectionRange(n,n)},[e]),t}var nM=S(R(),1);function z9r({index:e,number:t,item:r,outline:n,dragging:o,onGrip:i}){let a=F9r(n.focus?.index===e?n.focus:null),s={marginLeft:e5e(r.depth),opacity:o?.4:1};return(0,nM.jsxs)(W,{sx:E9r,"data-criterion-row":!0,style:s,children:[(0,nM.jsx)(O9r,{number:t,onGrip:i}),(0,nM.jsx)(W,{component:"span",sx:P9r,"aria-hidden":"true",children:`${t}.`}),(0,nM.jsx)(oa,{multiline:!0,value:r.text,sx:A9r,inputRef:a,inputProps:{"aria-label":`Criterion ${t}`},onChange:l=>n.onText(e,l.target.value),onKeyDown:l=>n.onKeyDown(e,l)}),(0,nM.jsx)(B9r,{number:t,onAdd:()=>n.onAdd(e),onDelete:()=>n.onDelete(e)})]})}var j9r=S(oe(),1);function H9r(e,t,{key:r,shift:n,alt:o,caret:i,text:a}){return o||n?null:r==="ArrowUp"&&i===0&&t>0?{kind:"focus",index:t-1}:r==="ArrowDown"&&i===a.length&&t<e.length-1?{kind:"focus",index:t+1}:null}function HR(e){if(e.length===0)return[{text:"",depth:0}];let t=-1;return e.map(r=>{let n=Math.min(Math.max(r.depth,0),t+1);return t=n,r.depth===n?r:{...r,depth:n}})}function r5e(e,t,r,n){let o=e[t]?.depth??0,i=e.map((a,s)=>s===t?{...a,text:r}:a);return{items:HR([...i.slice(0,t+1),{text:n,depth:o},...i.slice(t+1)]),index:t+1}}function Gm(e,t){let r=t+1;for(;r<e.length&&e[r].depth>e[t].depth;)r+=1;return r}function n5e(e,t){let r=e[t].depth;for(let n=t-1;n>=0;n-=1){if(e[n].depth<r)return-1;if(e[n].depth===r)return n}return-1}function U9r(e,t){let r=Gm(e,t);return r<e.length&&e[r].depth===e[t].depth?r:-1}function V9r(e,t,r){let n=r<0?n5e(e,t):U9r(e,t);if(n<0)return null;let o=Gm(e,t),i=e.slice(t,o),a=[...e.slice(0,t),...e.slice(o)],s=r<0?n:Gm(e,n)-(o-t);return{items:[...a.slice(0,s),...i,...a.slice(s)],index:s}}function o5e(e,t){let r=Gm(e,t),n=e.map((o,i)=>i>t&&i<r?{...o,depth:o.depth-1}:o).filter((o,i)=>i!==t);return{items:HR(n),index:Math.max(0,t-1)}}function W9r(e,t,r){if(r<0&&e[t].depth===0||r>0&&n5e(e,t)<0)return null;let n=Gm(e,t);return e.map((o,i)=>i>=t&&i<n?{...o,depth:o.depth+r}:o)}function i5e(e,t){return e?{kind:"edit",edit:e,caret:t}:null}function eMo(e,t,{caret:r,text:n}){let o=n.slice(0,r);return i5e(r5e(e,t,o,n.slice(r)),"start")}function tMo(e,t,{shift:r,caret:n}){let o=W9r(e,t,r?-1:1);return i5e(o?{items:o,index:t}:null,n)}function G9r(e,t,r){let{key:n,shift:o,alt:i,caret:a,text:s}=r;return n==="Enter"&&!o?eMo(e,t,r):n==="Tab"?tMo(e,t,r):i&&(n==="ArrowUp"||n==="ArrowDown")?i5e(V9r(e,t,n==="ArrowUp"?-1:1),a):n==="Backspace"&&a===0&&s===""?i5e(o5e(e,t),"end"):null}function q9r(e,t,r){return G9r(e,t,r)??H9r(e,t,r)}function Y9r(e,t){let[r,n]=(0,j9r.useState)(null),o=(a,s)=>{a&&(t(a.items),n({index:a.index,caret:s}))};return{focus:r,onKeyDown:(a,s)=>{let l=s.currentTarget;(s.key==="Enter"||s.key==="Tab")&&s.preventDefault();let u=q9r(e,a,{key:s.key,shift:s.shiftKey,alt:s.altKey,caret:l.selectionStart??0,text:l.value});u&&(s.preventDefault(),u.kind==="focus"?n({index:u.index,caret:"end"}):o(u.edit,u.caret))},onDrop:a=>o(a,"end"),onText:(a,s)=>t(e.map((l,u)=>u===a?{...l,text:s}:l)),onAdd:a=>o(r5e(e,a,e[a].text,""),"start"),onDelete:a=>o(o5e(e,a),"end")}}var J9r=S(oe(),1);function rMo(e,t,r,n){let o=t.length;for(let a=0;a<e.length;a+=1)if(n<e[a].top+e[a].height/2){o=a;break}let i=Gm(t,r);return o>r&&o<i?r:o}function nMo(e,t,r,n){let o=Gm(e,t),i=r-1,a=i>=t&&i<o?t-1:i,s=a>=0?e[a].depth+1:0;return Math.max(0,Math.min(e[t].depth+_9r(n),s))}function oMo(e,t){if(t<e.length)return e[t].top;let r=e[e.length-1];return r?r.top+r.height:0}function K9r(e,t,r,n,o){let i=rMo(e,t,r,o);return{target:i,depth:nMo(t,r,i,n),top:oMo(e,i)}}function iMo(e){let t=e.getBoundingClientRect().top;return{boxes:Array.from(e.querySelectorAll("[data-criterion-row]")).map(n=>{let o=n.getBoundingClientRect();return{top:o.top-t,height:o.height}}),origin:t}}function X9r(e,t,r,n){return o=>{let{boxes:i,origin:a}=iMo(t);return K9r(i,e,r,o.clientX-n,o.clientY-a)}}function Z9r(e,t,r,n,o){let i=new AbortController,a=null,s=d=>{a=r(d),n(a)},l=()=>{i.abort(),a&&o(a)},u={signal:i.signal};return e.setPointerCapture(t),e.addEventListener("pointermove",s,u),e.addEventListener("pointerup",l,u),e.addEventListener("pointercancel",l,u),s}function Q9r(e,t,r,n){let o=Gm(e,t),i=n-e[t].depth,a=e.slice(t,o).map(u=>({...u,depth:Math.max(0,u.depth+i)})),s=[...e.slice(0,t),...e.slice(o)],l=r>t?r-a.length:r;return{items:HR([...s.slice(0,l),...a,...s.slice(l)]),index:l}}function eFr(e,t,r){let[n,o]=(0,J9r.useState)(null);return{drag:n,onGrip:a=>s=>{let l=t.current;if(!l||s.pointerType==="mouse"&&s.button!==0)return;s.preventDefault(),Z9r(s.currentTarget,s.pointerId,X9r(e,l,a,s.clientX),d=>o({from:a,depth:d.depth,top:d.top}),d=>{o(null),r(Q9r(e,a,d.target,d.depth))})(s)}}}var kie=S(R(),1),aMo={my:1,px:1,py:.5,border:1,borderColor:"divider",borderRadius:1,position:"relative",userSelect:"text",cursor:"auto"},sMo=[{text:"",depth:0}];function rFr({items:e,onChange:t}){let r=(0,tFr.useRef)(null),n=e.length>0?e:sMo,o=Y9r(n,t),{drag:i,onGrip:a}=eFr(n,r,o.onDrop),s=k9r(n.map(l=>l.depth));return(0,kie.jsxs)(W,{sx:aMo,ref:r,"data-preview-skip":!0,"aria-label":"Acceptance criteria",children:[n.map((l,u)=>(0,kie.jsx)(z9r,{index:u,number:s[u],item:l,outline:o,dragging:i?.from===u,onGrip:a(u)},`criterion-${u}`)),(0,kie.jsx)(I9r,{drag:i})]})}var nFr=S(R(),1),oFr=ot((0,nFr.jsx)("path",{d:"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2zm1-9h1V4H2v1h1zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2zm5-6v2h14V5zm0 14h14v-2H7zm0-6h14v-2H7z"}),"FormatListNumbered");var _ie=S(R(),1),lMo={insert:"Add acceptance criteria",convert:"Convert to outline"};function iFr({kind:e,onClick:t}){return(0,_ie.jsx)(W,{sx:{my:1},"data-preview-skip":!0,children:(0,_ie.jsx)(it,{size:"small",variant:"outlined",startIcon:e==="insert"?(0,_ie.jsx)(Vd,{}):(0,_ie.jsx)(oFr,{}),onClick:t,children:lMo[e]})})}var Eie=S(oe(),1);function aFr(e,t,{color:r,pin:n}){let o=UA(e),i=[],a=o.nextNode();for(;a;){let u=a;if(t.intersectsNode(u)){let d=u===t.startContainer?t.startOffset:0,f=u===t.endContainer?t.endOffset:u.length;d<f&&i.push({node:u,start:d,end:f})}a=o.nextNode()}let l=i.map(u=>cMo(u.node,u.start,u.end,r)).at(-1);l&&n&&(l.dataset.pin=n)}function cMo(e,t,r,n){let o=document.createRange();o.setStart(e,t),o.setEnd(e,r);let i=document.createElement("mark");return i.className="pr-comment",i.style.backgroundColor=n,o.surroundContents(i),i}function sFr(e){for(let t of e.querySelectorAll("mark.pr-comment"))if(t.parentNode){for(;t.firstChild;)t.before(t.firstChild);t.remove()}}function lFr(e,t){for(let r of t){let n=U6t(e,r);n&&aFr(e,n,r)}}var Rie=S(R(),1);function cFr({content:e,control:t,trailing:r,ranges:n,contentRef:o}){let i=(0,Eie.useMemo)(()=>GI(e),[e]),a=(0,Eie.useMemo)(()=>GI(r??""),[r]);return(0,Eie.useLayoutEffect)(()=>{let s=o.current;s&&(sFr(s),lFr(s,n))},[i,a,n,o]),(0,Rie.jsxs)(W,{ref:o,children:[(0,Rie.jsx)(UI,{segments:i,skipDiagramText:!0}),t,t?(0,Rie.jsx)(UI,{segments:a,skipDiagramText:!0}):null]})}var oM=e=>e.split(",").map(t=>`&& .markdown ${t.trim()}`).join(", ");function a5e(e){let{color:t,radius:r}=e.tokens;return{px:2.5,py:2,fontSize:14,lineHeight:1.6,[oM("")]:{lineHeight:1.6},[oM("h1, h2, h3, h4, h5, h6")]:{fontSize:15,fontWeight:600,lineHeight:1.4,mt:2,mb:1},[oM("ul, ol")]:{pl:2.5,mb:2},[oM("li")]:{mb:"6px"},[oM("code")]:{fontFamily:e.typography.fontFamilyMono,fontSize:"0.86em",px:"5px",py:0,bgcolor:t.raised,border:1,borderColor:t.lineSoft,borderRadius:"4px"},[oM("pre")]:{bgcolor:t.raised,border:1,borderColor:t.lineSoft,borderRadius:`${r.sm}px`},[oM("pre code")]:{border:0,px:0,bgcolor:"transparent"}}}var uFr=e=>({flex:1,overflow:"auto",position:"relative",userSelect:"none",cursor:"text",wordBreak:"break-word","& .markdown":{...$me(e),maxWidth:"none"},"& a":{color:"primary.main"},"& mark.pr-comment":{color:"inherit",borderRadius:"2px"},...a5e(e)});var dq=S(R(),1);function dFr({content:e,control:t,trailing:r,ranges:n,wrapperRef:o,contentRef:i,dragRects:a,dragColor:s,onMouseDown:l,footer:u}){return(0,dq.jsxs)(W,{ref:o,onMouseDown:l,sx:uFr,children:[(0,dq.jsx)(cFr,{content:e,control:t,trailing:r,ranges:n,contentRef:i}),u&&(0,dq.jsx)(W,{sx:{userSelect:"text"},children:u}),(0,dq.jsx)(SB,{rects:a,color:s})]})}function fFr(e){let t=new Map,r=[];for(let n of e){if(!n.group){r.push(n);continue}t.set(n.group,[...t.get(n.group)??[],n])}return{groups:[...t],ungrouped:r}}var s5e=S(oe(),1),pFr=S(R(),1);function Out({label:e,value:t,onCommit:r,listId:n}){let[o,i]=(0,s5e.useState)(t);return(0,s5e.useEffect)(()=>i(t),[t]),(0,pFr.jsx)(sn,{size:"small",variant:"standard",fullWidth:!0,label:e,value:o,onChange:s=>i(s.target.value),onBlur:()=>{let s=o.trim();i(t),s!==t&&r(s)},onKeyDown:s=>{s.key==="Enter"&&s.target.blur()},onMouseDown:s=>s.stopPropagation(),slotProps:{htmlInput:{list:n}}})}var Pie=S(R(),1),But="screenshot-groups";function uMo(e){return(e.split(/[\\/]/).pop()??e).replace(/\.[^.]+$/,"")}function hFr({screenshot:e,onUpdate:t}){return(0,Pie.jsxs)(St,{direction:"row",spacing:1,sx:{mt:.5},children:[(0,Pie.jsx)(Out,{label:"Caption",value:e.alt,onCommit:r=>t(e.id,{alt:r||uMo(e.path)})}),(0,Pie.jsx)(Out,{label:"Group",value:e.group??"",listId:But,onCommit:r=>t(e.id,{group:r})})]})}var UR=S(R(),1),mFr={display:"block",maxWidth:"100%",borderRadius:1,border:1,borderColor:"divider"},dMo={position:"absolute",top:4,right:4,bgcolor:"background.paper","&:hover":{bgcolor:"background.paper"}};function gFr({screenshot:e,onRemove:t,onUpdate:r}){let n=e.contentType.startsWith("video/");return(0,UR.jsxs)(W,{sx:{position:"relative"},children:[n?(0,UR.jsx)(W,{component:"video",controls:!0,src:e.url,"aria-label":"screenshot",sx:mFr}):(0,UR.jsx)(W,{component:"img",src:e.url,alt:"screenshot",sx:mFr}),(0,UR.jsx)(Vt,{size:"small","aria-label":"Remove screenshot",sx:dMo,onMouseDown:o=>o.stopPropagation(),onClick:()=>t(e.id),children:(0,UR.jsx)(Bo,{fontSize:"small"})}),(0,UR.jsx)(hFr,{screenshot:e,onUpdate:r})]})}var Vy=S(R(),1);function fMo(){return(0,Vy.jsxs)(St,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,Vy.jsx)(oo,{size:16}),(0,Vy.jsx)(Te,{variant:"caption",color:"text.secondary",children:"Attaching screenshot or video\u2026"})]})}function pMo({error:e}){return(0,Vy.jsx)(Te,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:e})}function yFr({uploads:e,empty:t}){return e.length>0?(0,Vy.jsx)(Vy.Fragment,{children:e.map(r=>r.error?(0,Vy.jsx)(pMo,{error:r.error},r.id):(0,Vy.jsx)(fMo,{},r.id))}):t?(0,Vy.jsx)(Te,{variant:"caption",color:"text.secondary",children:"Drop or paste an image or video to attach"}):null}var Wy=S(R(),1),hMo={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:1};function vFr({screenshots:e,uploads:t,onRemove:r,onUpdate:n}){let{groups:o,ungrouped:i}=fFr(e),a=s=>(0,Wy.jsx)(gFr,{screenshot:s,onRemove:r,onUpdate:n},s.id);return(0,Wy.jsxs)(W,{sx:{mt:3},children:[e.length>0&&(0,Wy.jsx)(W,{component:"h2",children:"Screenshots"}),(0,Wy.jsx)("datalist",{id:But,children:o.map(([s])=>(0,Wy.jsx)("option",{value:s},s))}),o.map(([s,l])=>(0,Wy.jsxs)(W,{sx:{mb:2},children:[(0,Wy.jsx)(W,{component:"h3",children:s}),(0,Wy.jsx)(W,{sx:hMo,children:l.map(a)})]},s)),(0,Wy.jsxs)(St,{spacing:1,children:[i.map(a),(0,Wy.jsx)(yFr,{uploads:t,empty:e.length===0})]})]})}var Aie=S(R(),1);function mMo(e){let t=e.criteria;if(!t)return{content:e.body};let r={content:t.before,trailing:t.after};return t.kind==="outline"?{...r,control:(0,Aie.jsx)(rFr,{items:t.items,onChange:e.onCriteriaChange})}:{...r,control:(0,Aie.jsx)(iFr,{kind:t.kind,onClick:t.kind==="insert"?e.onCriteriaInsert:e.onCriteriaConvert})}}function l5e({pane:e,screenshots:t}){return(0,Aie.jsx)(dFr,{...mMo(e),ranges:e.ranges,wrapperRef:e.wrapperRef,contentRef:e.contentRef,dragRects:e.dragRects,dragColor:e.dragColor,onMouseDown:e.onMouseDown,footer:t?(0,Aie.jsx)(vFr,{screenshots:e.screenshots,uploads:e.uploads,onRemove:e.removeScreenshot,onUpdate:e.updateScreenshot}):void 0})}var bFr=e=>({display:"grid",gap:1,maxHeight:220,overflow:"auto",px:2,py:1.25,borderTop:1,borderColor:e.tokens.color.lineSoft}),xFr={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"text.secondary"},SFr=e=>({display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",gap:"4px 8px",px:1.25,py:1,borderRadius:`${e.tokens.radius.sm}px`,bgcolor:e.tokens.color.raised,border:1,borderColor:e.tokens.color.lineSoft,fontSize:12.5}),TFr={gridColumn:2,gridRow:1,width:20,height:20,color:"text.disabled","& .MuiSvgIcon-root":{fontSize:14}};var yC=S(R(),1);function wFr({comments:e,colors:t,onRemove:r}){return(0,yC.jsxs)(W,{sx:bFr,children:[(0,yC.jsxs)(Te,{sx:xFr,children:["Comments (",e.length,")"]}),e.map((n,o)=>(0,yC.jsxs)(W,{sx:SFr,children:[(0,yC.jsx)(yB,{text:n.quote,sx:{gridColumn:1,borderLeft:2,pl:1,borderColor:t[o]}}),(0,yC.jsx)(W,{sx:{gridColumn:1,wordBreak:"break-word"},children:n.note}),(0,yC.jsx)(Vt,{"aria-label":"Remove comment",onClick:()=>r(n.id),sx:TFr,children:(0,yC.jsx)(Bo,{})})]},n.id))]})}var kFr=S(R(),1);function CFr(e){return e.comments.length===0?null:(0,kFr.jsx)(wFr,{...e})}var _Fr=S(R(),1),c5e=ot((0,_Fr.jsx)("path",{d:"M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2zM4 6h16v10H4z"}),"Computer");var IFr=S(oe(),1);var EFr=S(R(),1),RFr=ot((0,EFr.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2"}),"Circle");var Gy="0.1133.1";var gMo={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function PFr(e){return e?gMo[e]:"success.main"}function AFr(e){return e.split("-")[0].split(".").map(Number)}function LFr(e,t){if(!e||!t||e===t)return;let r=AFr(e),n=AFr(t);for(let o=0;o<Math.max(r.length,n.length);o++){let i=(r[o]??0)-(n[o]??0);if(Number.isNaN(i))return;if(i!==0)return i<0?"behind":"ahead"}}var u5e=S(oe(),1),$ut=(0,u5e.createContext)(null);function d5e(){return(0,u5e.useContext)($ut)}var iM=S(R(),1),yMo={height:16,fontSize:10},vMo={opacity:.6,fontSize:"0.85em"};function bMo(e,t){if(t===e.local)return"this machine";let r=e.links.find(n=>n.name===t);return r?r.error?`${r.state}: ${r.error}`:r.state:""}function VR({nodes:e,name:t,showVersion:r=!1}){let n=d5e()??Gy,o=e.links.find(a=>a.name===t),i=LFr(o?.peerVersion,n);return(0,iM.jsx)(pr,{title:bMo(e,t),placement:"right",children:(0,iM.jsxs)(W,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,iM.jsx)(RFr,{sx:{fontSize:8,color:PFr(o?.state)}}),t,r&&o?.peerVersion&&(0,iM.jsxs)(W,{component:"span",sx:vMo,children:["v",o.peerVersion]}),i&&(0,iM.jsx)(Sn,{label:i,size:"small",color:i==="behind"?"warning":"info",sx:yMo})]})})}var qy=S(R(),1),xMo={textTransform:"none"};function f5e({nodes:e,options:t,target:r,onPick:n}){let[o,i]=(0,IFr.useState)(null);return(0,qy.jsxs)(qy.Fragment,{children:[(0,qy.jsx)(it,{size:"small",color:"inherit",startIcon:(0,qy.jsx)(c5e,{fontSize:"small"}),"aria-label":"Start on node","aria-haspopup":"menu",onClick:a=>i(a.currentTarget),sx:xMo,children:(0,qy.jsx)(VR,{nodes:e,name:r.node})}),(0,qy.jsx)(Oi,{anchorEl:o,open:!!o,onClose:()=>i(null),children:t.map(({name:a,cwd:s})=>(0,qy.jsx)(Hr,{disabled:!s,selected:a===r.node,onClick:()=>{n(a),i(null)},children:(0,qy.jsx)(kf,{primary:(0,qy.jsx)(VR,{nodes:e,name:a}),secondary:s?void 0:"no clone"})},a))})]})}var DFr=S(oe(),1);function SMo(e,t){return e?.toLowerCase()===t.toLowerCase()}function p5e(e,t){let{nodes:r,names:n,visible:o}=cs(),{repos:i,selectedCwd:a,selectedNode:s,cloneOn:l,originOf:u}=In(),[d,f]=(0,DFr.useState)(),p=e&&u(e)?e:a,h=t?i.find(b=>SMo(u(b),t)):p,m=n.map(b=>({name:b,cwd:h?l(h,b):void 0})),g=b=>m.find(x=>x.name===b&&x.cwd),y=g(d)??g(s??r?.local)??m.find(b=>b.cwd),v=o&&y?.cwd?{node:y.name,cwd:y.cwd}:void 0;return{nodes:r,visible:o,options:m,target:v,pick:f}}var WR=S(R(),1);function MFr({canStart:e,startOrigin:t,cwd:r,onApprove:n,onApproveAndStart:o}){let i=Ype(),a=p5e(r,t);return(0,WR.jsxs)(WR.Fragment,{children:[(0,WR.jsx)(it,{color:"primary",variant:e?"tonal":"contained",onClick:n,...e?{}:i,children:"Approve"}),e&&a.nodes&&a.target&&(0,WR.jsx)(f5e,{nodes:a.nodes,options:a.options,target:a.target,onPick:a.pick}),e&&(0,WR.jsx)(it,{color:"primary",variant:"contained",onClick:()=>o(a.target),...i,children:"Approve & start"})]})}var Fut=S(R(),1),TMo={"& .MuiFormControlLabel-label":{fontSize:12}};function Lie({label:e,title:t,checked:r,onChange:n}){return(0,Fut.jsx)(Ld,{control:(0,Fut.jsx)(Ep,{size:"small",checked:r,onChange:o=>n(o.target.checked)}),label:e,title:t,sx:TMo})}var aM=S(R(),1);function h5e({chain:e,newPr:t,onChange:r}){return(0,aM.jsxs)(St,{direction:"row",sx:{mr:"auto"},children:[t&&(0,aM.jsx)(Lie,{label:"Draft",title:"Create the PR as a draft rather than ready for review",checked:e.draft,onChange:n=>r({...e,draft:n,autoMerge:n?!1:e.autoMerge})}),(0,aM.jsx)(Lie,{label:"Auto-merge (squash)",title:"Squash-merge the PR automatically once its required checks pass",checked:e.autoMerge,onChange:n=>r({...e,autoMerge:n,draft:n?!1:e.draft})}),(0,aM.jsx)(Lie,{label:"Review PR",title:"After raising, run a review that posts its findings and then addresses them",checked:e.reviewAfter,onChange:n=>r({...e,reviewAfter:n})}),(0,aM.jsx)(Lie,{label:"Post to Slack",title:"Announce the PR in Slack at the tail of the chain",checked:e.announceAfter,onChange:n=>r({...e,announceAfter:n})})]})}var sM=S(R(),1);function NFr({commentCount:e,chain:t,newPr:r,canStart:n,startOrigin:o,onChainChange:i,onApprove:a,cwd:s,onApproveAndStart:l,onReject:u,onRequestChanges:d}){return(0,sM.jsxs)(St,{direction:"row",spacing:1,sx:{px:2,py:1.5,alignItems:"center",justifyContent:"flex-end"},children:[t&&(0,sM.jsx)(h5e,{chain:t,newPr:r,onChange:i}),(0,sM.jsx)(it,{color:"error",variant:"outlined",onClick:u,children:"Reject"}),e>0&&(0,sM.jsxs)(it,{color:"warning",variant:"tonal",onClick:d,children:["Request changes (",e,")"]}),(0,sM.jsx)(MFr,{canStart:n,startOrigin:o,cwd:s,onApprove:a,onApproveAndStart:l})]})}var BFr=S(R(),1);function OFr({comments:e,cwd:t,onDecision:r,chain:n,newPr:o,canStart:i,startOrigin:a,onChainChange:s}){let l=()=>e.map(u=>({quote:u.quote,note:u.note}));return(0,BFr.jsx)(NFr,{commentCount:e.length,chain:n,newPr:o,canStart:i,startOrigin:a,onChainChange:s,onApprove:()=>r("approve",l()),cwd:t,onApproveAndStart:u=>r("approve",l(),u??!0),onReject:()=>r("reject",[]),onRequestChanges:()=>r("reject",l())})}var vC=S(R(),1);function $Fr(e){let{comments:t,commentColors:r,pending:n,cwd:o,unavailable:i,onAdd:a,onQueue:s,onCite:l,onAddRule:u,onRemove:d,onCancel:f,onCollapse:p,editable:h}=e;return(0,vC.jsxs)(vC.Fragment,{children:[(0,vC.jsx)(CFr,{comments:t,colors:r,onRemove:d}),(0,vC.jsx)(qn,{}),(0,vC.jsx)(OFr,{...e}),(0,vC.jsx)(ime,{pending:n,editable:h,cwd:o,unavailable:i,onAdd:a,onQueue:s,onCite:l,onAddRule:u,onCancel:f,onCollapse:p})]})}var Iie=S(R(),1),wMo={px:2,pb:2,display:"flex",alignItems:"center",gap:1.5,minWidth:0},CMo={color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function FFr({url:e}){return(0,Iie.jsxs)(W,{sx:wMo,children:[(0,Iie.jsx)(it,{variant:"contained",href:e,target:"_blank",rel:"noopener noreferrer",sx:{flexShrink:0},children:"Open design \u2197"}),(0,Iie.jsx)(Te,{variant:"body2",sx:CMo,title:e,children:e})]})}var zut=S(R(),1);function zFr({preview:e}){let t=e.kind==="design"?e.metadata?.[0]?.url:void 0;return t?(0,zut.jsx)(FFr,{url:t}):(0,zut.jsx)(lq,{items:e.metadata??[]})}function HFr({preview:e,pane:t,cwd:r,isPr:n,editable:o,sender:i,onCite:a,onAddRule:s}){return{comments:t.comments,commentColors:t.commentColors,pending:t.pending,cwd:r,unavailable:i.unavailable,onAdd:i.onSend,onQueue:t.onAdd,onCite:a,onAddRule:s,onRemove:t.remove,onCancel:t.onCancel,onCollapse:t.onCollapse,onDecision:t.onDecide,chain:n?t.chain:void 0,editable:o,newPr:n&&e.prNumber===null,canStart:e.kind==="backlog-item"&&e.canStart===!0,startOrigin:e.startOrigin,onChainChange:t.setChain}}function fq(e){let t=e??"pr";return{isPr:t==="pr",screenshots:t==="pr"||t==="github-issue",editable:t==="github-issue-edit",closeOnly:t==="show"}}function UFr(e,t){return e?`${e}:${t??"pr"}`:void 0}function m5e(e,t,r,n){return{...fq(e.kind),requestId:e.requestId,supersedes:e.supersedes,sessionId:t,cwd:r,onDecision:n,screenshotScope:UFr(t,e.kind),seededScreenshots:e.screenshots??[],chainDefaults:{draft:e.draft===!0,reviewAfter:e.reviewAfter??!0},initialBody:e.body}}function VFr(e,t,r,n){if(!(!e||!t))return o=>{r!==void 0&&lf(t,e,Ywe({quote:r,note:o})),n()}}function WFr(e,t,r,n){if(!(!e||!t))return o=>{r!==void 0&&lf(t,e,Sx(r,Zhe(o))),n()}}function g5e(e,t,r,n){return{onCite:WFr(e,t,r,n),onAddRule:VFr(e,t,r,n)}}function GFr(e){return{criteria:e.criteria,onCriteriaChange:e.writeCriteria,onCriteriaInsert:e.insertCriteria,onCriteriaConvert:e.convertCriteria}}var ezr=S(oe(),1);var bC=S(oe(),1);var qFr="assist:pr-preview-comments:",Hut=e=>`${qFr}${e}`;function Uut(e){return ll(Hut(e))}function Die(e,t){Rl(Hut(e),t)}function y5e(e){Cv(Hut(e))}function jFr(){Tx(qFr)}function YFr(e){let t=UA(e),r="";for(let n=t.nextNode();n;n=t.nextNode())r+=n.textContent??"";return r}function kMo(e,t,r){let n=-1;for(let o=e.indexOf(t);o!==-1;o=e.indexOf(t,o+1))(n===-1||Math.abs(o-r)<Math.abs(n-r))&&(n=o);return n}function KFr(e,t){return e.flatMap(r=>{let n=kMo(t,r.quote,r.start);return n===-1?[]:[{...r,start:n,end:n+r.quote.length}]})}function XFr(e,t,r){let n=Uut(e);if(n.length>0||!t||!r)return n;let o=KFr(Uut(t),YFr(r));return Die(e,o),y5e(t),o}function ZFr(e,t,r){let[n,o]=(0,bC.useState)([]),i=(0,bC.useRef)(0);(0,bC.useEffect)(()=>{jFr(),o(XFr(e,t,r.current).map(l=>({...l,id:i.current++})))},[e,t,r]);let a=(0,bC.useCallback)(l=>{o(u=>{let d=[...u,{...l,id:i.current++}];return Die(e,d),d})},[e]),s=(0,bC.useCallback)(l=>{o(u=>{let d=u.filter(f=>f.id!==l);return Die(e,d),d})},[e]);return{comments:n,add:a,remove:s}}function QFr(e,t){let r=e.map((i,a)=>tW(a).solid),n=tW(e.length).fill,o=e.map((i,a)=>({start:i.start,end:i.end,color:tW(a).fill,pin:String(a+1)}));return t&&o.push({start:t.start,end:t.end,color:n}),{commentColors:r,dragColor:n,ranges:o}}function JFr(e,t,r,n){return{onAdd:o=>{e&&t({quote:e.quote,note:o,start:e.start,end:e.end}),n()},onCollapse:()=>{e&&r(e.quote),n()}}}function tzr(e,t,r){let{wrapperRef:n,contentRef:o,pending:i,dragRects:a,onMouseDown:s,clear:l,select:u}=P5(),{comments:d,add:f,remove:p}=ZFr(e,t,o),{commentColors:h,dragColor:m,ranges:g}=(0,ezr.useMemo)(()=>QFr(d,i),[d,i]),{onAdd:y,onCollapse:v}=JFr(i,f,r,l);return{wrapperRef:n,contentRef:o,onMouseDown:s,comments:d,commentColors:h,remove:p,pending:i,ranges:g,dragRects:a,dragColor:m,onAdd:y,onCollapse:v,onCancel:l,onSelect:u}}var b5e=S(oe(),1);var Vut="assist:preview-screenshots:",Wut=e=>`${Vut}${e}`,v5e=e=>`${Vut}seeded:${e}`;function rzr(e){return e?(Tx(Vut),ll(Wut(e)).filter(t=>typeof t.path=="string")):[]}function lM(e,t){e&&Rl(Wut(e),t.map(({path:r,alt:n,group:o,contentType:i,seeded:a})=>({path:r,alt:n,group:o,contentType:i,seeded:a})))}function nzr(e){e&&(Cv(Wut(e)),Cv(v5e(e)))}var cM=S(oe(),1);var ozr={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","video/mp4":"mp4","video/webm":"webm","video/quicktime":"mov"};function _Mo(e){let t=e.split(".").pop()?.toLowerCase();return Object.entries(ozr).find(([,n])=>n===t)?.[0]??"application/octet-stream"}function izr(e){return e.map(t=>({...t,contentType:_Mo(t.path),seeded:!0}))}function azr(e,t,r){if(!e)return izr(r);let n=rzr(e);if(ll(v5e(e))[0]===t)return n;let o=[...izr(r),...n.filter(i=>!i.seeded)];return lM(e,o),Rl(v5e(e),[t]),o}function szr(e,t){let r=new URLSearchParams({path:e});return t&&r.set("node",t),W2(`/api/pr-preview/image?${r}`)}function lzr(e,t,r){let[n,o]=(0,cM.useState)([]),i=(0,cM.useRef)(0),a=hr(),s=(0,cM.useRef)(r);return s.current=r,(0,cM.useEffect)(()=>{o(azr(e,t,s.current).map(l=>({...l,url:szr(l.path,a),id:i.current++})))},[e,t,a]),{screenshots:n,setScreenshots:o,nextId:i}}var czr=S(oe(),1);function uzr(e,t){return(0,czr.useCallback)((r,n)=>{t(o=>{let i=o.map(a=>a.id===r?{...a,...n}:a);return lM(e,i),i})},[e,t])}function dzr(e,t,r){let{screenshots:n,setScreenshots:o,nextId:i}=lzr(e,t,r),a=(0,b5e.useCallback)(d=>{o(f=>{let p=[...f,{...d,id:i.current++}];return lM(e,p),p})},[e,o,i]),s=(0,b5e.useCallback)(d=>{o(f=>{let p=f.find(m=>m.id===d);p?.url.startsWith("blob:")&&URL.revokeObjectURL(p.url);let h=f.filter(m=>m.id!==d);return lM(e,h),h})},[e,o]),l=uzr(e,o),u=(0,b5e.useCallback)(()=>nzr(e),[e]);return{screenshots:n,add:a,remove:s,update:l,clearPersisted:u}}var pq=S(oe(),1);async function fzr(e,t,r){let n=new URLSearchParams;t&&n.set("cwd",t),r&&n.set("node",r),e instanceof File&&e.name&&n.set("name",e.name);let o=await Wt(`/api/pr-preview/upload-image?${n}`,{method:"POST",headers:{"Content-Type":e.type||"application/octet-stream"},body:e,timeoutMs:12e4}),i=await o.json().catch(()=>null);if(!o.ok||!i?.path)throw new Error(i?.error??"Failed to attach file");return{path:i.path,alt:i.alt??"screenshot"}}var gzr=S(oe(),1);function pzr(e){return e.startsWith("image/")||e.startsWith("video/")}function hzr(e){if(!e)return null;for(let t of e.items)if(t.kind==="file"&&pzr(t.type)){let r=t.getAsFile();if(r)return r}return null}function mzr(e){return e?Array.from(e.files).find(t=>pzr(t.type))??null:null}function yzr(e,t){return(0,gzr.useEffect)(()=>{if(!t)return;let o=i=>{let a=hzr(i.clipboardData);a&&(i.preventDefault(),e(a))};return globalThis.addEventListener("paste",o),()=>globalThis.removeEventListener("paste",o)},[e,t]),t?{onDrop:o=>{let i=mzr(o.dataTransfer);i&&(o.preventDefault(),e(i))},onDragOver:o=>{Array.from(o.dataTransfer.items).some(i=>i.kind==="file")&&o.preventDefault()}}:{onDrop:void 0,onDragOver:void 0}}function vzr(e,t,r){let[n,o]=(0,pq.useState)([]),i=(0,pq.useRef)(0),a=hr(),s=(0,pq.useCallback)(async d=>{let f=i.current++;o(p=>[...p.filter(h=>!h.error),{id:f}]);try{let p=await fzr(d,e,a);t({...p,url:URL.createObjectURL(d),contentType:d.type}),o(h=>h.filter(m=>m.id!==f))}catch(p){let h=p instanceof Error?p.message:"Failed to attach file";o(m=>m.map(g=>g.id===f?{id:f,error:h}:g))}},[e,a,t]),{onDrop:l,onDragOver:u}=yzr(s,r);return{uploads:n,onDrop:l,onDragOver:u}}function bzr({cwd:e,screenshots:t,screenshotScope:r,requestId:n,seededScreenshots:o}){let{screenshots:i,add:a,remove:s,update:l,clearPersisted:u}=dzr(t?r:void 0,n,t?o:[]),{uploads:d,onDrop:f,onDragOver:p}=vzr(e,a,t);return{screenshots:i,removeScreenshot:s,updateScreenshot:l,decision:{attachments:()=>i.map(({path:h,alt:m,group:g})=>g?{path:h,alt:m,group:g}:{path:h,alt:m}),clearPersisted:u},uploads:d,onDrop:f,onDragOver:p}}var Rzr=S(oe(),1);var xzr="assist:pr-preview-chain:",Gut=e=>`${xzr}${e}`;function Szr(e){if(e)return ll(Gut(e))[0]}function Tzr(e,t){e&&Rl(Gut(e),[t])}function wzr(e){e&&Cv(Gut(e))}function Czr(){Tx(xzr)}function kzr(e,t,r){if(!e)return{reviewAfter:!1,announceAfter:!1,draft:!1,autoMerge:!1};Czr();let n=Szr(t);return{reviewAfter:n?.reviewAfter??r.reviewAfter,announceAfter:n?.announceAfter??!0,draft:n?.draft??r.draft,autoMerge:n?.autoMerge??!1}}function _zr(e,t,r,n,o){return{comments:t,screenshots:n,reviewAfter:e&&r.reviewAfter,announceAfter:e&&r.announceAfter,draft:r.draft,autoMerge:e&&r.autoMerge,...o===void 0?{}:{body:o}}}function Ezr(e,t){return!e||t===!1?{}:t===!0?{autostart:!0}:{autostart:!0,startOn:t}}function Pzr(e,t,r,n,o,i,a){let[s,l]=(0,Rzr.useState)(()=>kzr(n,t,o));return{chain:s,setChain:f=>{l(f),Tzr(t,f)},onDecide:(f,p,h=!1)=>{let m=f==="approve";r(f,{..._zr(m,p,s,m?i.attachments():[],a()),...Ezr(m,h)}),y5e(e),m&&(wzr(t),i.clearPersisted())}}}var Fzr=S(oe(),1);var EMo=/^ {0,3}#{1,6}[ \t]+acceptance criteria[ \t]*$/i,RMo=/^ {0,3}#{1,6}[ \t]/;function GR(e){let t=e.split(`
4007
4007
  `),r=t.findIndex(a=>EMo.test(a));if(r===-1)return null;let n=r+1;for(;n<t.length&&!RMo.test(t[n]);)n+=1;let o=r+1;for(;o<n&&t[o].trim()==="";)o+=1;let i=n;for(;i>o&&t[i-1].trim()==="";)i-=1;return o===n&&(o=r+1,i=r+1),{before:t.slice(0,o),lines:t.slice(o,i),after:t.slice(i)}}function x5e(e){let t=0;for(let r of e)t+=r===" "?4:1;return t}function S5e(e){let t=[];return e.map(r=>{for(;t.length>0&&r<t[t.length-1];)t.pop();return(t.length===0||r>t[t.length-1])&&t.push(r),t.length-1})}var PMo=" ";function AMo({text:e,depth:t}){let r=`${PMo.repeat(t)}1.`;return e===""?r:`${r} ${e}`}function T5e(e,t){let r=GR(e);return r?[...r.before,...t.map(AMo),...r.after].join(`
4008
4008
  `):e}var LMo=/^([ \t]*)(?:[-*+]|\d+[.)])(?:[ \t]+(.*))?$/,IMo=/^\[[ xX]\][ \t]*/;function DMo(e){return e.slice(0,e.length-e.trimStart().length)}function Azr(e){let t=GR(e);if(!t)return e;let r=t.lines.filter(o=>o.trim()!=="").map(o=>{let i=LMo.exec(o);return{width:x5e(i?i[1]:DMo(o)),text:(i?i[2]??"":o.trim()).replace(IMo,"")}}),n=S5e(r.map(o=>o.width));return T5e(e,HR(r.map((o,i)=>({text:o.text,depth:n[i]}))))}var Lzr=`## Acceptance criteria
4009
4009
 
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.1133.0",
9
+ version: "0.1133.1",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -36301,6 +36301,39 @@ function resolveIssueMilestone(target, wanted) {
36301
36301
 
36302
36302
  // src/commands/prs/shared.ts
36303
36303
  import { execSync as execSync42 } from "child_process";
36304
+
36305
+ // src/commands/prs/currentPrSelector.ts
36306
+ import { execFileSync as execFileSync12 } from "child_process";
36307
+ var PULL_REF = /^refs\/pull\/(\d+)\/head$/;
36308
+ function gitOrNull3(args) {
36309
+ try {
36310
+ return execFileSync12("git", args, {
36311
+ encoding: "utf8",
36312
+ stdio: ["pipe", "pipe", "pipe"],
36313
+ windowsHide: true
36314
+ }).trim() || null;
36315
+ } catch {
36316
+ return null;
36317
+ }
36318
+ }
36319
+ function branchConfig(branch2, key) {
36320
+ return gitOrNull3(["config", "--get", `branch.${branch2}.${key}`]);
36321
+ }
36322
+ function remoteOwner(remote) {
36323
+ const url = parseGitHubUrl(remote) ? remote : gitOrNull3(["remote", "get-url", remote]);
36324
+ return url ? parseGitHubUrl(url)?.org ?? null : null;
36325
+ }
36326
+ function currentPrSelector(branch2, baseOrg) {
36327
+ const pull = branchConfig(branch2, "merge")?.match(PULL_REF);
36328
+ if (pull) return pull[1];
36329
+ const remote = branchConfig(branch2, "remote");
36330
+ const owner = remote ? remoteOwner(remote) : null;
36331
+ if (owner && owner.toLowerCase() !== baseOrg.toLowerCase())
36332
+ return `${owner}:${branch2}`;
36333
+ return branch2;
36334
+ }
36335
+
36336
+ // src/commands/prs/shared.ts
36304
36337
  function isGhNotInstalled(error) {
36305
36338
  if (error instanceof Error) {
36306
36339
  const msg = error.message.toLowerCase();
@@ -36323,13 +36356,11 @@ function getCurrentBranch2() {
36323
36356
  }
36324
36357
  function viewCurrentPr(fields) {
36325
36358
  const { org, repo } = getRepoInfo();
36359
+ const selector = currentPrSelector(getCurrentBranch2(), org);
36326
36360
  return JSON.parse(
36327
- execSync42(
36328
- `gh pr view ${getCurrentBranch2()} --json ${fields} -R ${org}/${repo}`,
36329
- {
36330
- encoding: "utf8"
36331
- }
36332
- )
36361
+ execSync42(`gh pr view ${selector} --json ${fields} -R ${org}/${repo}`, {
36362
+ encoding: "utf8"
36363
+ })
36333
36364
  );
36334
36365
  }
36335
36366
  function getCurrentPrNumber() {
@@ -36475,7 +36506,7 @@ function attachArgs(attachments) {
36475
36506
  }
36476
36507
 
36477
36508
  // src/commands/prs/runGhWithAttachments.ts
36478
- import { execFileSync as execFileSync12 } from "child_process";
36509
+ import { execFileSync as execFileSync13 } from "child_process";
36479
36510
  import { basename as basename20 } from "path";
36480
36511
 
36481
36512
  // src/shared/removeStagedAttachments.ts
@@ -36503,7 +36534,7 @@ function reportPartialFailure(attachments, stderr) {
36503
36534
  function runGhWithAttachments(args, attachments) {
36504
36535
  const attaching = attachments.length > 0;
36505
36536
  try {
36506
- const stdout = execFileSync12("gh", args, {
36537
+ const stdout = execFileSync13("gh", args, {
36507
36538
  encoding: "utf8",
36508
36539
  stdio: ["inherit", "pipe", attaching ? "pipe" : "inherit"]
36509
36540
  });
@@ -36614,7 +36645,7 @@ The project scope is needed for --project: gh auth refresh -h github.com -s proj
36614
36645
  }
36615
36646
 
36616
36647
  // src/commands/github/issue/fetchIssue.ts
36617
- import { execFileSync as execFileSync13 } from "child_process";
36648
+ import { execFileSync as execFileSync14 } from "child_process";
36618
36649
  function fetchIssue2(number, repo) {
36619
36650
  const args = [
36620
36651
  "issue",
@@ -36626,7 +36657,7 @@ function fetchIssue2(number, repo) {
36626
36657
  if (repo) args.push("--repo", repo);
36627
36658
  let raw;
36628
36659
  try {
36629
- raw = execFileSync13("gh", args, { encoding: "utf8" });
36660
+ raw = execFileSync14("gh", args, { encoding: "utf8" });
36630
36661
  } catch {
36631
36662
  console.error(`Could not fetch issue #${number} with gh issue view`);
36632
36663
  process.exit(1);
@@ -36736,12 +36767,12 @@ function prepareIssueEdit(number, repo, fresh, proposed) {
36736
36767
  }
36737
36768
 
36738
36769
  // src/commands/github/issue/pushIssueBody.ts
36739
- import { execFileSync as execFileSync14 } from "child_process";
36770
+ import { execFileSync as execFileSync15 } from "child_process";
36740
36771
  function pushIssueBody(number, repo, bodyPath) {
36741
36772
  const args = ["issue", "edit", String(number), "--body-file", bodyPath];
36742
36773
  if (repo) args.push("--repo", repo);
36743
36774
  try {
36744
- execFileSync14("gh", args, { stdio: "inherit" });
36775
+ execFileSync15("gh", args, { stdio: "inherit" });
36745
36776
  } catch {
36746
36777
  process.exit(1);
36747
36778
  }
@@ -36820,12 +36851,12 @@ function setIssueParent(number, repo, parentArg) {
36820
36851
  }
36821
36852
 
36822
36853
  // src/commands/github/issue/viewIssue.ts
36823
- import { execFileSync as execFileSync15 } from "child_process";
36854
+ import { execFileSync as execFileSync16 } from "child_process";
36824
36855
  function viewIssue(number, repo) {
36825
36856
  const args = ["issue", "view", String(number)];
36826
36857
  if (repo) args.push("--repo", repo);
36827
36858
  try {
36828
- execFileSync15("gh", args, { stdio: "inherit" });
36859
+ execFileSync16("gh", args, { stdio: "inherit" });
36829
36860
  } catch {
36830
36861
  process.exit(1);
36831
36862
  }
@@ -36879,7 +36910,7 @@ function registerEditIssue(issueCommand) {
36879
36910
  }
36880
36911
 
36881
36912
  // src/commands/github/issue/editIssueComment.ts
36882
- import { execFileSync as execFileSync16 } from "child_process";
36913
+ import { execFileSync as execFileSync17 } from "child_process";
36883
36914
  var USAGE5 = "Usage: assist github issue edit-comment <comment-id> --body <body> [-R <owner>/<repo>]";
36884
36915
  async function editIssueComment(commentIdArg, options2) {
36885
36916
  const commentId = Number.parseInt(commentIdArg, 10);
@@ -36906,7 +36937,7 @@ async function editIssueComment(commentIdArg, options2) {
36906
36937
  ];
36907
36938
  let raw;
36908
36939
  try {
36909
- raw = execFileSync16("gh", args, {
36940
+ raw = execFileSync17("gh", args, {
36910
36941
  input: JSON.stringify({ body }),
36911
36942
  encoding: "utf8"
36912
36943
  });
@@ -37806,7 +37837,7 @@ function registerRefineLaunch(program, resumeFlag) {
37806
37837
  import chalk202 from "chalk";
37807
37838
 
37808
37839
  // src/commands/review/checkoutPr.ts
37809
- import { execFileSync as execFileSync19 } from "child_process";
37840
+ import { execFileSync as execFileSync20 } from "child_process";
37810
37841
 
37811
37842
  // src/commands/review/clearStalePrBranch.ts
37812
37843
  var tipSetFromRemote = /^branch: (Created from|Reset to)|^fetch\b|: Fast-forward$/;
@@ -38437,13 +38468,13 @@ function prCliCommands(number, cwd) {
38437
38468
  }
38438
38469
 
38439
38470
  // src/commands/review/prHeadBranch.ts
38440
- import { execFileSync as execFileSync17 } from "child_process";
38471
+ import { execFileSync as execFileSync18 } from "child_process";
38441
38472
  function prHeadBranch({
38442
38473
  headBranch
38443
38474
  }) {
38444
38475
  try {
38445
38476
  return headBranch.parse(
38446
- execFileSync17(headBranch.file, headBranch.args, {
38477
+ execFileSync18(headBranch.file, headBranch.args, {
38447
38478
  encoding: "utf8",
38448
38479
  stdio: ["ignore", "pipe", "pipe"]
38449
38480
  })
@@ -38514,7 +38545,7 @@ function worktreeHoldingBranch(cwd, branch2) {
38514
38545
  import chalk201 from "chalk";
38515
38546
 
38516
38547
  // src/commands/review/azCliProblem.ts
38517
- import { execFileSync as execFileSync18 } from "child_process";
38548
+ import { execFileSync as execFileSync19 } from "child_process";
38518
38549
 
38519
38550
  // src/commands/review/azFailureProblem.ts
38520
38551
  var azProblems = {
@@ -38542,7 +38573,7 @@ function azFailureProblem(error) {
38542
38573
  // src/commands/review/azCliProblem.ts
38543
38574
  function runAz(args) {
38544
38575
  try {
38545
- execFileSync18("az", args, { stdio: "ignore" });
38576
+ execFileSync19("az", args, { stdio: "ignore" });
38546
38577
  return "ok";
38547
38578
  } catch (error) {
38548
38579
  return error.code === "ENOENT" ? "missing" : "failed";
@@ -38605,7 +38636,7 @@ async function checkoutPr(number) {
38605
38636
  const from = branch2 === "HEAD" ? gitSyncOrNull(process.cwd(), ["rev-parse", "HEAD"]) : branch2;
38606
38637
  const stale = headRef ? clearStalePrBranch(process.cwd(), headRef) : "absent";
38607
38638
  try {
38608
- execFileSync19(commands.checkout.file, commands.checkout.args, {
38639
+ execFileSync20(commands.checkout.file, commands.checkout.args, {
38609
38640
  stdio: "inherit"
38610
38641
  });
38611
38642
  } catch {
@@ -40659,9 +40690,9 @@ var azureDevopsThreadRequests = {
40659
40690
  };
40660
40691
 
40661
40692
  // src/commands/prs/azureDevops/currentAzureDevopsPr.ts
40662
- import { execFileSync as execFileSync20 } from "child_process";
40693
+ import { execFileSync as execFileSync21 } from "child_process";
40663
40694
  function findPrForBranch(repo, branch2) {
40664
- const stdout = execFileSync20(
40695
+ const stdout = execFileSync21(
40665
40696
  "az",
40666
40697
  [
40667
40698
  "repos",
@@ -40708,7 +40739,7 @@ function failAzureDevops(error) {
40708
40739
  }
40709
40740
 
40710
40741
  // src/commands/prs/azureDevops/invokeAzDevops.ts
40711
- import { execFileSync as execFileSync21 } from "child_process";
40742
+ import { execFileSync as execFileSync22 } from "child_process";
40712
40743
  import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync47 } from "fs";
40713
40744
  import { tmpdir as tmpdir7 } from "os";
40714
40745
  import { join as join99 } from "path";
@@ -40737,7 +40768,7 @@ function azDevopsInvokeArgs(request, inFile) {
40737
40768
  ];
40738
40769
  }
40739
40770
  function runAz2(args) {
40740
- const stdout = execFileSync21("az", args, {
40771
+ const stdout = execFileSync22("az", args, {
40741
40772
  encoding: "utf8",
40742
40773
  stdio: ["ignore", "pipe", "pipe"],
40743
40774
  windowsHide: true
@@ -40804,10 +40835,10 @@ function listAzureDevopsComments(repo) {
40804
40835
  }
40805
40836
 
40806
40837
  // src/commands/prs/fetchThreadIds.ts
40807
- import { execFileSync as execFileSync22 } from "child_process";
40838
+ import { execFileSync as execFileSync23 } from "child_process";
40808
40839
  var THREAD_QUERY = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { id isResolved comments(first: 100) { nodes { databaseId } } } } } } }`;
40809
40840
  function fetchThreadIds(org, repo, prNumber) {
40810
- const result = execFileSync22(
40841
+ const result = execFileSync23(
40811
40842
  "gh",
40812
40843
  [
40813
40844
  "api",
@@ -41088,7 +41119,7 @@ function printComments2(result) {
41088
41119
  import { execSync as execSync46 } from "child_process";
41089
41120
 
41090
41121
  // src/commands/prs/threadTarget.ts
41091
- import { execFileSync as execFileSync23 } from "child_process";
41122
+ import { execFileSync as execFileSync24 } from "child_process";
41092
41123
 
41093
41124
  // src/commands/prs/azureDevops/azureDevopsThreadActions.ts
41094
41125
  function attempt(run5) {
@@ -41136,7 +41167,7 @@ function replyToComment(org, repo, prNumber, commentId, message4) {
41136
41167
  // src/commands/prs/threadTarget.ts
41137
41168
  function resolveThread(threadId) {
41138
41169
  const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
41139
- execFileSync23(
41170
+ execFileSync24(
41140
41171
  "gh",
41141
41172
  ["api", "graphql", "-f", `query=${mutation}`, "-f", `threadId=${threadId}`],
41142
41173
  { stdio: ["inherit", "pipe", "inherit"] }
@@ -41778,7 +41809,7 @@ function buildValidatedBody(options2, usage) {
41778
41809
  }
41779
41810
 
41780
41811
  // src/commands/prs/placePr.ts
41781
- import { execFileSync as execFileSync24 } from "child_process";
41812
+ import { execFileSync as execFileSync25 } from "child_process";
41782
41813
 
41783
41814
  // src/commands/prs/buildCreateArgs.ts
41784
41815
  function buildCreateArgs(title, body, options2, attachments = []) {
@@ -41864,7 +41895,7 @@ function buildEditArgs(number, title, body, attachments = []) {
41864
41895
  // src/commands/prs/placePr.ts
41865
41896
  function hasUpstream2() {
41866
41897
  try {
41867
- execFileSync24(
41898
+ execFileSync25(
41868
41899
  "git",
41869
41900
  ["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
41870
41901
  { stdio: "pipe" }
@@ -41876,7 +41907,7 @@ function hasUpstream2() {
41876
41907
  }
41877
41908
  function ensureBranchPushed() {
41878
41909
  const args = hasUpstream2() ? ["push"] : ["push", "--set-upstream", "origin", "HEAD"];
41879
- execFileSync24("git", args, { stdio: "inherit" });
41910
+ execFileSync25("git", args, { stdio: "inherit" });
41880
41911
  }
41881
41912
  async function placePr(prNumber, title, body, options2, attachments = []) {
41882
41913
  const args = prNumber !== null ? buildEditArgs(prNumber, title, body, attachments) : buildCreateArgs(title, body, options2, attachments);
@@ -41947,10 +41978,10 @@ function warn(reason4) {
41947
41978
  }
41948
41979
 
41949
41980
  // src/commands/prs/enableAutoMerge.ts
41950
- import { execFileSync as execFileSync25 } from "child_process";
41981
+ import { execFileSync as execFileSync26 } from "child_process";
41951
41982
  function enableAutoMerge() {
41952
41983
  try {
41953
- execFileSync25(
41984
+ execFileSync26(
41954
41985
  "gh",
41955
41986
  ["pr", "merge", getCurrentBranch2(), "--auto", "--squash"],
41956
41987
  { stdio: "inherit" }
@@ -42210,10 +42241,10 @@ function prsSlackChannel() {
42210
42241
  }
42211
42242
 
42212
42243
  // src/commands/prs/status/fetchReviewThreads.ts
42213
- import { execFileSync as execFileSync26 } from "child_process";
42244
+ import { execFileSync as execFileSync27 } from "child_process";
42214
42245
  var THREAD_QUERY2 = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { isResolved } } } } }`;
42215
42246
  function fetchReviewThreads(org, repo, prNumber) {
42216
- const output = execFileSync26(
42247
+ const output = execFileSync27(
42217
42248
  "gh",
42218
42249
  [
42219
42250
  "api",
@@ -46695,7 +46726,7 @@ function readGlobs(value) {
46695
46726
  }
46696
46727
 
46697
46728
  // src/commands/review/highLevel/summariseRepoTree.ts
46698
- import { execFileSync as execFileSync27 } from "child_process";
46729
+ import { execFileSync as execFileSync28 } from "child_process";
46699
46730
  import { dirname as dirname46, extname as extname6 } from "path";
46700
46731
  var MAX_DIRECTORIES = 200;
46701
46732
  var MAX_EXTENSIONS_PER_DIRECTORY = 6;
@@ -46711,7 +46742,7 @@ function summariseRepoTree(cwd = process.cwd()) {
46711
46742
  }
46712
46743
  function listTrackedFiles(cwd) {
46713
46744
  try {
46714
- return execFileSync27("git", ["ls-files"], {
46745
+ return execFileSync28("git", ["ls-files"], {
46715
46746
  cwd,
46716
46747
  encoding: "utf8",
46717
46748
  maxBuffer: 64 * 1024 * 1024
@@ -47184,7 +47215,7 @@ function evaluateHighLevelChecks(subject) {
47184
47215
  }
47185
47216
 
47186
47217
  // src/commands/review/highLevel/fetchHighLevelFiles.ts
47187
- import { execFileSync as execFileSync28 } from "child_process";
47218
+ import { execFileSync as execFileSync29 } from "child_process";
47188
47219
  import { createHash as createHash4 } from "crypto";
47189
47220
  var JQ = ".[] | {filename,status,additions,deletions,patch} | @json";
47190
47221
  function toStatus(status2) {
@@ -47197,7 +47228,7 @@ function diffUrl(repo, prNumber, path128) {
47197
47228
  return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
47198
47229
  }
47199
47230
  function fetchHighLevelFiles(prNumber, repo) {
47200
- const out = execFileSync28(
47231
+ const out = execFileSync29(
47201
47232
  "gh",
47202
47233
  ["api", `repos/${repo}/pulls/${prNumber}/files`, "--paginate", "--jq", JQ],
47203
47234
  { encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
@@ -47720,11 +47751,11 @@ function collectHighLevelTests(files, testPaths, readSource4) {
47720
47751
  }
47721
47752
 
47722
47753
  // src/commands/review/highLevel/fetchFileAtSha.ts
47723
- import { execFileSync as execFileSync29 } from "child_process";
47754
+ import { execFileSync as execFileSync30 } from "child_process";
47724
47755
  function fetchFileAtSha(repo, sha, path128) {
47725
47756
  const encodedPath = path128.split("/").map(encodeURIComponent).join("/");
47726
47757
  try {
47727
- return execFileSync29(
47758
+ return execFileSync30(
47728
47759
  "gh",
47729
47760
  [
47730
47761
  "api",
@@ -53328,13 +53359,13 @@ Total: ${violations.length} forbidden string(s).`);
53328
53359
  }
53329
53360
 
53330
53361
  // src/commands/verify/hardcodedColors.ts
53331
- import { execFileSync as execFileSync30 } from "child_process";
53362
+ import { execFileSync as execFileSync31 } from "child_process";
53332
53363
  import { minimatch as minimatch11 } from "minimatch";
53333
53364
  var pattern = "0x[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,6}";
53334
53365
  function hardcodedColors() {
53335
53366
  const ignoreGlobs = loadConfig().hardcodedColors?.ignore ?? [];
53336
53367
  try {
53337
- const output = execFileSync30("grep", ["-rEnH", "-f", "-", "src/"], {
53368
+ const output = execFileSync31("grep", ["-rEnH", "-f", "-", "src/"], {
53338
53369
  encoding: "utf8",
53339
53370
  input: `${pattern}
53340
53371
  `
@@ -54290,11 +54321,11 @@ function consumeSimulatedDivergence(cwd) {
54290
54321
  }
54291
54322
 
54292
54323
  // src/commands/watch/fetchQuietly.ts
54293
- import { execFileSync as execFileSync31 } from "child_process";
54324
+ import { execFileSync as execFileSync32 } from "child_process";
54294
54325
  var MIN_FETCH_TIMEOUT_MS = 6e4;
54295
54326
  function fetchQuietly(cwd, intervalMs) {
54296
54327
  try {
54297
- execFileSync31("git", ["fetch", "--quiet"], {
54328
+ execFileSync32("git", ["fetch", "--quiet"], {
54298
54329
  stdio: ["pipe", "pipe", "pipe"],
54299
54330
  cwd,
54300
54331
  timeout: Math.max(intervalMs, MIN_FETCH_TIMEOUT_MS)
@@ -54563,7 +54594,7 @@ function registerWatch(program) {
54563
54594
  }
54564
54595
 
54565
54596
  // src/commands/roam/postRoamActivity.ts
54566
- import { execFileSync as execFileSync32 } from "child_process";
54597
+ import { execFileSync as execFileSync33 } from "child_process";
54567
54598
  import { readdirSync as readdirSync27, readFileSync as readFileSync86, statSync as statSync18 } from "fs";
54568
54599
  import { join as join123 } from "path";
54569
54600
  function findPortFile(roamDir) {
@@ -54602,7 +54633,7 @@ function postRoamActivity(app, event) {
54602
54633
  const pid = PID_BY_APP[app] ?? 99999;
54603
54634
  const url = `http://127.0.0.1:${port}/api/v1/activity/${app}/${event}?pid=${pid}`;
54604
54635
  try {
54605
- execFileSync32("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
54636
+ execFileSync33("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
54606
54637
  stdio: "ignore"
54607
54638
  });
54608
54639
  } catch {
@@ -55198,11 +55229,11 @@ function formatLink(link3) {
55198
55229
  }
55199
55230
 
55200
55231
  // src/commands/sessions/daemon/listDaemonPids.ts
55201
- import { execFileSync as execFileSync33 } from "child_process";
55232
+ import { execFileSync as execFileSync34 } from "child_process";
55202
55233
  function listDaemonPids() {
55203
55234
  if (process.platform === "win32") return [];
55204
55235
  try {
55205
- const out = execFileSync33("ps", ["-eo", "pid=,args="], {
55236
+ const out = execFileSync34("ps", ["-eo", "pid=,args="], {
55206
55237
  encoding: "utf8"
55207
55238
  });
55208
55239
  return out.split("\n").filter((line) => line.includes("assist") && / daemon run\b/.test(line)).map((line) => Number.parseInt(line.trim(), 10)).filter((pid) => Number.isInteger(pid));
@@ -60044,7 +60075,7 @@ function releaseClient(client, clients, prPreview, verify) {
60044
60075
  }
60045
60076
 
60046
60077
  // src/commands/sessions/daemon/findPortHolderPid.ts
60047
- import { execFileSync as execFileSync34 } from "child_process";
60078
+ import { execFileSync as execFileSync35 } from "child_process";
60048
60079
  var PROBE_TIMEOUT_MS = 3e3;
60049
60080
  function findPortHolderPid(port) {
60050
60081
  try {
@@ -60054,7 +60085,7 @@ function findPortHolderPid(port) {
60054
60085
  }
60055
60086
  }
60056
60087
  function probe2(command, args) {
60057
- return execFileSync34(command, args, {
60088
+ return execFileSync35(command, args, {
60058
60089
  encoding: "utf8",
60059
60090
  timeout: PROBE_TIMEOUT_MS,
60060
60091
  stdio: ["ignore", "pipe", "ignore"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.1133.0",
3
+ "version": "0.1133.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {